diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index e39fc127a1123f..ec9168a7cffca9 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "1.0.0-prerelease.21404.1", + "version": "6.0.0-prerelease.24224.2", "commands": [ "xharness" ] diff --git a/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md index 6fd461e6fc3690..9a748a085a20f1 100644 --- a/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md @@ -21,3 +21,7 @@ main PR # Risk + +# Package authoring signed off? + +IMPORTANT: If this change touches code that ships in a NuGet package, please make certain that you have added any necessary [package authoring](../../docs/project/library-servicing.md) and gotten it explicitly reviewed. diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 9699f4db66961c..1bffaf03351228 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -52,3 +52,9 @@ jobs: ## Testing ## Risk + + **IMPORTANT**: If this backport is for a servicing release, please verify that: + + - The PR target branch is `release/X.0-staging`, not `release/X.0`. + + - If the change touches code that ships in a NuGet package, you have added the necessary [package authoring](https://github.com/dotnet/runtime/blob/release/7.0/docs/project/library-servicing.md) and gotten it explicitly reviewed. \ No newline at end of file diff --git a/.github/workflows/check-service-labels.yml b/.github/workflows/check-service-labels.yml new file mode 100644 index 00000000000000..5261cc165ee128 --- /dev/null +++ b/.github/workflows/check-service-labels.yml @@ -0,0 +1,24 @@ +name: check-service-labels + +permissions: + pull-requests: read + +on: + pull_request: + types: [opened, edited, reopened, labeled, unlabeled, synchronize] + branches: + - 'release/**' + +jobs: + check-labels: + runs-on: ubuntu-latest + steps: + - name: Check 'Servicing-approved' label + run: | + echo "Merging permission is enabled for servicing PRs when the `Servicing-approved` label is applied." + if [ "${{ contains(github.event.pull_request.labels.*.name, 'Servicing-approved') }}" = "true" ]; then + exit 0 + else + echo "::error:: 'Servicing-approved' label not applied to the PR yet. More information: https://github.com/dotnet/runtime/blob/main/docs/project/library-servicing.md#approval-process" + exit 1 + fi diff --git a/.github/workflows/inter-branch-merge-flow.yml b/.github/workflows/inter-branch-merge-flow.yml new file mode 100644 index 00000000000000..20246c14fc5851 --- /dev/null +++ b/.github/workflows/inter-branch-merge-flow.yml @@ -0,0 +1,13 @@ +name: Inter-branch merge workflow +on: + push: + branches: + - release/** + +permissions: + contents: write + pull-requests: write + +jobs: + Merge: + uses: dotnet/arcade/.github/workflows/inter-branch-merge-base.yml@main \ No newline at end of file diff --git a/Build.proj b/Build.proj index bff94b97a7a799..5f47e869fb6e42 100644 --- a/Build.proj +++ b/Build.proj @@ -10,7 +10,7 @@ - + $(NetCoreAppCurrentIdentifier),Version=v$(NetCoreAppToolCurrentVersion) Microsoft.NETCore.App .NET $(NetCoreAppCurrentVersion) + + net472 + + @@ -66,13 +70,13 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'ibc')) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'mibc')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'docs')) - $([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'microsoft.private.intellisense', '$(MicrosoftPrivateIntellisenseVersion)', 'IntellisenseFiles', 'net')) + $([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'microsoft.private.intellisense', '$(MicrosoftPrivateIntellisenseVersion)', 'IntellisenseFiles')) $([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'docs')) $([MSBuild]::NormalizeDirectory('$(DocsDir)', 'manpages')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)', 'publish')) - $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)', 'publish')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(NetCoreAppToolCurrent)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmBuildTasks', 'Debug', '$(NetCoreAppToolCurrent)', 'publish')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WorkloadBuildTasks', 'Debug', '$(NetCoreAppToolCurrent)', 'publish')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(NetCoreAppToolCurrent)')) @@ -140,7 +144,8 @@ <_runtimeOS Condition="$(_runtimeOS.StartsWith('tizen'))">linux <_runtimeOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS) - <_packageOS Condition="'$(CrossBuild)' == 'true'">$(_hostOS.ToLowerInvariant) + <_packageLibc Condition="$(_runtimeOS.Contains('musl'))">-musl + <_packageOS Condition="'$(CrossBuild)' == 'true'">$(_hostOS.ToLowerInvariant)$(_packageLibc) <_packageOS Condition="'$(_packageOS)' == '' and '$(PortableBuild)' == 'true'">$(_portableOS) <_packageOS Condition="'$(_packageOS)' == ''">$(_runtimeOS) @@ -206,6 +211,10 @@ $([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'native')) + + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(OutputRid).$(Configuration)', 'corehost')) + + true @@ -228,8 +237,10 @@ $([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'src')) + $([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'ref')) $([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj')) $([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj')) + $([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'System.Private.Uri', 'src', 'System.Private.Uri.csproj')) true @@ -242,7 +253,6 @@ https://dot.net microsoft,dotnetframework true - $([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json')) $(MSBuildThisFileDirectory)LICENSE.TXT MIT false @@ -251,14 +261,12 @@ https://go.microsoft.com/fwlink/?LinkID=799421 - true - $(MSBuildProjectName.Contains('Experimental')) + false $(MSBuildProjectName.Contains('Private')) - - true - false + + true - false + false $(RepositoryEngineeringDir)_._ @@ -270,6 +278,8 @@ strict;nullablePublicOnly true + + $(NoWarn),CS8969 portable true diff --git a/Directory.Build.targets b/Directory.Build.targets index d0c69879774269..98967298c62577 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -11,6 +11,21 @@ + + + + $(PackageRID) + + + $(PackageRID) + + + + + + + + + + + - diff --git a/THIRD-PARTY-NOTICES.TXT b/THIRD-PARTY-NOTICES.TXT index 89c59b21d64bd7..88017d19eb5aa2 100644 --- a/THIRD-PARTY-NOTICES.TXT +++ b/THIRD-PARTY-NOTICES.TXT @@ -70,12 +70,12 @@ License notice for Zlib ----------------------- https://github.com/madler/zlib -http://zlib.net/zlib_license.html +https://zlib.net/zlib_license.html /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11, January 15th, 2017 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -937,3 +937,21 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License for remote stack unwind (https://github.com/llvm/llvm-project/blob/main/lldb/source/Symbol/CompactUnwindInfo.cpp) +-------------------------------------- + +Copyright 2019 LLVM Project + +Licensed under the Apache License, Version 2.0 (the "License") with LLVM Exceptions; +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +https://llvm.org/LICENSE.txt + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/docs/coding-guidelines/updating-ref-source.md b/docs/coding-guidelines/updating-ref-source.md index d3f16179e089a2..641718b7875e39 100644 --- a/docs/coding-guidelines/updating-ref-source.md +++ b/docs/coding-guidelines/updating-ref-source.md @@ -13,7 +13,7 @@ This document provides the steps you need to take to update the reference assemb These steps can also be applied to some unique assemblies which depend on changes in System.Private.Corelib. (partial facades like System.Memory, for example). -1) Run `dotnet build --no-incremental /t:GenerateReferenceSource` from the System.Runtime/src directory. +1) Run `dotnet build --no-incremental /t:GenerateReferenceAssemblySource` from the System.Runtime/src directory. 2) Filter out all unrelated changes and extract the changes you care about (ignore certain attributes being removed). Generally, this step is not required for other reference assemblies. ## For Full Facade Assemblies implementation assemblies diff --git a/docs/design/features/images/intel-cet-dotnet6-fig1.png b/docs/design/features/images/intel-cet-dotnet6-fig1.png new file mode 100644 index 00000000000000..37d2aebb570397 Binary files /dev/null and b/docs/design/features/images/intel-cet-dotnet6-fig1.png differ diff --git a/docs/design/features/intel-cet-dotnet6.md b/docs/design/features/intel-cet-dotnet6.md new file mode 100644 index 00000000000000..abf5ca32b06223 --- /dev/null +++ b/docs/design/features/intel-cet-dotnet6.md @@ -0,0 +1,30 @@ +# .NET 6 compatibility with Intel CET shadow stacks (early preview on Windows) + +Intels [Control-flow Enforcement Technology (CET)](https://newsroom.intel.com/editorials/intel-cet-answers-call-protect-common-malware-threats/) is a security feature available in some newer Intel and AMD processors. It adds capabilities to the hardware that protect against some common types of attacks involving control-flow hijacking. With CET shadow stacks, the processor and operating system can track the control flow of calls and returns in a thread in the shadow stack in addition to the data stack, and detect unintended changes to the control flow. The shadow stack is protected from application code memory accesses and helps to defend against attacks involving return-oriented programming (ROP). Windows offers [Hardware-enforced Stack Protection](https://techcommunity.microsoft.com/t5/windows-kernel-internals/understanding-hardware-enforced-stack-protection/ba-p/1247815) for CET shadow stack compatibility and is available as an early preview in [Windows Insider preview builds (Dev channel)](https://insider.windows.com/en-us/understand-flighting). + +## Opting into CET shadow stack compatibility + +CET compatibility in .NET 6 is available as an early preview. In order to receive the security benefits of CET shadow stacks in .NET applications, ensure the following to opt into the feature for an executable: +- Verify that your processor supports Intel CET. There are Intel and AMD processors currently available with the feature. +- Get a recent build of Windows that has Hardware-enforced Stack Protection. The latest versions from [Windows Insider preview builds (Dev channel)](https://insider.windows.com/en-us/understand-flighting) have the feature. +- Install [.NET 6](https://dotnet.microsoft.com/download/dotnet) RC1 or a more recent release +- Build or publish your application targeting framework `net6.0` and runtime `win-x64` +- Open the Windows Security app + - Inside the "App & browser control" pane, select "Explicit protection settings" + - Under the "Program settings" tab, select "Add program to customize" and "Add by program name" + - Enter the file name of your applications executable file and select "Add" + - Select the following options and select "Apply": + + ![Hardware-enforced Stack Protection settings](images/intel-cet-dotnet6-fig1.png) + - See the [Developer Guidance for Hardware-enforced Stack Protection](https://techcommunity.microsoft.com/t5/windows-kernel-internals/developer-guidance-for-hardware-enforced-stack-protection/ba-p/2163340) for more details +- Task Managers Details tab has a new column "Hardware-enforced Stack Protection" that shows the compatibility level of a running process. If CET shadow stacks are enabled for the process, the column for the application should say "Compatible modules only". + +## Limitations + +CET shadow stack compatibility in .NET is under development and will be available as an early preview from .NET 6 RC1 as an opt-in for x64 applications. Aside from a notable limitation, most run-time scenarios should work as expected. There are plans for expanding the compatibility for .NET 7 and to have it be enabled by default on supported hardware for Windows x64 applications. + +For a .NET 6 application that is opted into CET shadow stack compatibility, managed or mixed-mode debugging through Visual Studio may not work as expected, and may cause the application to crash. Some basic features such as expression evaluation (including autos, locals, watch list expressions, quick watch, etc.) and stepping through code are currently incompatible with CET shadow stacks. Native debugging through Visual Studio and WinDbg/SOS should continue to work as expected with CET shadow stacks enabled for the application being debugged. + +When opted in as above, CET shadow stacks are enabled in compatibility mode. .NET 6 is not compatible with strict mode, support for strict mode is planned for .NET 7. + +For .NET 6 applications, CET shadow stack compatibility is available to try for Windows x64 applications. Support for the feature on Linux is pending. diff --git a/docs/project/library-servicing.md b/docs/project/library-servicing.md index 11fb03dfed51b7..a9431903fc7024 100644 --- a/docs/project/library-servicing.md +++ b/docs/project/library-servicing.md @@ -1,11 +1,18 @@ # How to service a library -This document provides the steps necessary after modifying a library in a servicing branch (where "servicing branch" refers to any branch whose name begins with `release/`). +This document provides the steps that need to be followed after modifying a library in a servicing branch. + +Servicing branches represent shipped versions of .NET, and their name is in the format `release/X.0-staging`. Examples: + +- `release/7.0-staging` +- `release/6.0-staging` ## Check if a package is generated If a library is packable (check for the `true` property) you'll need to set `true` in the source project. That is necessary as packages aren't generated by default in servicing releases. +Additionally, if the library is listed among the project references of [Microsoft.Windows.Compatibility.csproj](https://github.com/dotnet/runtime/blob/56c84971041ae1debfa5ff360c547392d29f4cb3/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj#L15-L48), please make sure to bump the value of `ServicingVersion` for `Microsoft.Windows.Compatibility.csproj` and also set its `GeneratePackageOnBuild` property value to `true`. The version number must only be bumped once per servicing release, even if multiple dependencies get modified. + ## Determine ServiceVersion When you make a change to a library & ship it during the servicing release, the `ServicingVersion` must be bumped. This property is found in the library's source project. It's also possible that the property is not in that file, in which case you'll need to add it to the library's source project and set it to 1. If the property is already present in your library's source project, just increment the servicing version by 1. @@ -23,4 +30,26 @@ All that's left is to ensure that your changes have worked as expected. To do so ## Approval Process -All the servicing change must go through an approval process. Please create your PR using [this template](https://raw.githubusercontent.com/dotnet/runtime/main/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md). You should also add `servicing-consider` label to the pull request and bring it to the attention of the engineering lead responsible for the area. +All the servicing change must go through an approval process. You have two ways to submit your PR: + +- By manually creating your PR using [this template](https://raw.githubusercontent.com/dotnet/runtime/main/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md). +- Or by asking the bot to automatically create the servicing PR for you using a merged `main` PR as source. This method requires typing an AzDO backport command as a comment of your merged PR using the format `/backport to release/X.0-staging`. Examples: +- + - `/backport to release/7.0-staging` + - `/backport to release/6.0-staging` + +For both cases, you must: + +- Fill out the template of the PR description. +- Bring it to the attention of the [engineering lead responsible for the area](~/docs/area-owners.md). +- If the fix is a product change, the area owner will: + - Add the `Servicing-consider` label. + - Ask the area owner to champion your PR in the .NET Tactics meeting to request merge approval. + - If the change is approved, they will replace the `Servicing-consider` label by `Servicing-approved` and sign-off the PR. +- If the fix is a test-only or infra-only change, the area owner will: + - Review the PR and sign-off if they approve it. + - Add the `Servicing-approved` label. + +The area owner can then merge the PR once the CI looks good (it's either green or the failures are investigated and determined to be unrelated to the PR). + +**Note**: Applying the `Servicing-approved` label ensures the `check-service-labels` CI job passes, which is a mandatory requirement for merging a PR in a servicing branch. diff --git a/eng/MultiTargetRoslynComponent.targets.template b/eng/MultiTargetRoslynComponent.targets.template new file mode 100644 index 00000000000000..420693a6262b9f --- /dev/null +++ b/eng/MultiTargetRoslynComponent.targets.template @@ -0,0 +1,31 @@ + + + + + <_{TargetPrefix}Analyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == '{NuGetPackageId}'" /> + + + + + + + + + + + + + + + + + + + diff --git a/eng/Publishing.props b/eng/Publishing.props index ba44e57c7c744b..8b796225f8274b 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -1,3 +1,7 @@ - - \ No newline at end of file + + + true + + + diff --git a/eng/Signing.props b/eng/Signing.props index b546fd4ec3b5d3..fd547195d60e54 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -1,4 +1,4 @@ - + + + @@ -56,33 +61,4 @@ - - - - - false - - - - - - - - - - - - - - - - diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 7dfc80d41fd14c..fcbe9fa75e2a9d 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -11,14 +11,20 @@ true false - + $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) $(__DistroRid) <_targetRidPlatformIndex>$(TargetRid.LastIndexOfAny("-")) - $(TargetRid.Substring(0, $(_targetRidPlatformIndex))) - $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) + $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) + + + $(TargetRid.Substring(0, $(_targetRidPlatformIndex))) + + + $(RuntimeOS) minimal @@ -34,22 +40,21 @@ - $(InnerBuildArgs) --arch $(TargetRidPlatform) + $(InnerBuildArgs) --arch $(TargetArch) $(InnerBuildArgs) --configuration $(Configuration) - $(InnerBuildArgs) --ci - $(InnerBuildArgs) --allconfigurations + $(InnerBuildArgs) --allconfigurations $(InnerBuildArgs) --verbosity $(LogVerbosity) $(InnerBuildArgs) --nodereuse false $(InnerBuildArgs) --warnAsError false - $(InnerBuildArgs) --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE - $(InnerBuildArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0 - $(InnerBuildArgs) /p:ContinuousIntegrationBuild=true - $(InnerBuildArgs) /p:PackageRid=$(TargetRid) + $(InnerBuildArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.2 + $(InnerBuildArgs) --outputrid $(TargetRid) + $(InnerBuildArgs) --portablebuild $(SourceBuildPortable) $(InnerBuildArgs) /p:NoPgoOptimize=true $(InnerBuildArgs) /p:KeepNativeSymbols=true - $(InnerBuildArgs) /p:RuntimeOS=$(TargetRidWithoutPlatform) - $(InnerBuildArgs) /p:PortableBuild=$(SourceBuildPortable) + $(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS) $(InnerBuildArgs) /p:BuildDebPackage=false + $(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS) + $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS) diff --git a/eng/Subsets.props b/eng/Subsets.props index 332632c32e5163..be4c6a8862480b 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -22,11 +22,19 @@ that indicates tests should be run. Otherwise, they'll only be built.) --> + + + CoreCLR + Mono + + clr+mono+libs+host+packs mono+libs+packs - - clr+libs+host+packs + + clr+libs+host+packs @@ -35,14 +43,6 @@ <_subset Condition="'$(Subset)' == ''">+$(DefaultSubsets)+ - - - CoreCLR - Mono - - Mono Mono @@ -66,13 +66,13 @@ $(DefaultLibrariesSubsets)libs.ref+libs.src $(DefaultLibrariesSubsets)+libs.pretest - host.native+host.tools - $(DefaultHostSubsets)+host.pkg+host.tests + host.native+host.tools+host.pkg + $(DefaultHostSubsets)+host.tests host.native packs.product - $(DefaultPacksSubsets)+packs.tests + $(DefaultPacksSubsets)+packs.tests $(DefaultPacksSubsets)+packs.installers @@ -120,7 +120,14 @@ - + + + + + + + + @@ -130,13 +137,6 @@ - - - - - - - @@ -263,6 +263,22 @@ + + + + + + + + + + + + + + + + @@ -288,22 +304,7 @@ - - - - - - - - - - - - - - - - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1ebd09b7378e75..6f3a59d99181da 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,130 +1,150 @@ - + https://github.com/dotnet/icu - 05dbba88d0ae799b4fea1e13c69b0c02beb7dcbe + def3524876b6b84a72e8ed02db6077f9c0ce8a75 - + https://github.com/dotnet/msquic - 98129287d56a5e0348c291ce4260e630b4aa510d + 7312355e44fd230b7aa26c7190f3870391751476 - + https://github.com/dotnet/emsdk - 9f2345b3c5f43dbf34790e21657ae1f2445cd06a + ab8bc4e2860e29d700542c68e57daa5e7663af62 + + + https://github.com/dotnet/emsdk + ab8bc4e2860e29d700542c68e57daa5e7663af62 + + + https://github.com/dotnet/emsdk + ab8bc4e2860e29d700542c68e57daa5e7663af62 + + + https://github.com/dotnet/wcf + 04c3656e0325277aefa18378f24238d39b259222 - + + https://github.com/dotnet/arcade + 2eab07c3d7b78219d10099b19fafeef2ecae1779 + + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 https://github.com/microsoft/vstest 140434f7109d357d0158ade9e5164a4861513965 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 + + + https://github.com/dotnet/runtime-assets + 600fbf042f688f9db813f69bd8a6525b84efb7e6 https://github.com/dotnet/llvm-project @@ -158,17 +178,17 @@ https://github.com/dotnet/llvm-project cea4a95e1505e737e768c8094d6aa880f5442ab7 - + https://github.com/dotnet/runtime - 38017c3935de95d0335bac04f4901ddfc2718656 + fde6b37e985605d862c070256de7c97e2a3f3342 - + https://github.com/dotnet/runtime - fde6b37e985605d862c070256de7c97e2a3f3342 + 1af80ba017f6f7644305e1781d8cc9845a92b5f8 - + https://github.com/dotnet/runtime - fde6b37e985605d862c070256de7c97e2a3f3342 + 1af80ba017f6f7644305e1781d8cc9845a92b5f8 https://github.com/dotnet/runtime @@ -190,21 +210,21 @@ https://github.com/dotnet/runtime fde6b37e985605d862c070256de7c97e2a3f3342 - + https://github.com/mono/linker - 5b2391c2c56af47350a5789375e8dbddc692e67f + c8499798a2a09639174e2f5c694d6652794cc73d - + https://github.com/dotnet/xharness - e9669dc84ecd668d3bbb748758103e23b394ffef + d1dd9c2ce3fc0b9358d2cda64c52d052d1a612c1 - + https://github.com/dotnet/xharness - e9669dc84ecd668d3bbb748758103e23b394ffef + d1dd9c2ce3fc0b9358d2cda64c52d052d1a612c1 - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + 2eab07c3d7b78219d10099b19fafeef2ecae1779 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -222,17 +242,21 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-optimization d50065944d8b41d804448a7056351481d583ad3d - + https://github.com/dotnet/hotreload-utils - 802e79f0cf423249d54bfaafca2da4a272f4ca07 + 6f095cd6901ed48a469289f7f4f91d30a420d1ad - + https://github.com/dotnet/runtime-assets - 7f980667ff908c5b5d7cf0dd66d48e7af23daae1 + 600fbf042f688f9db813f69bd8a6525b84efb7e6 https://github.com/dotnet/roslyn-analyzers 9a1f02eff42635a5a9934735f12c722c3bfba8e8 + + https://github.com/dotnet/sdk + fa2be1406598f8e473af9061e07488ae0778ea11 + diff --git a/eng/Versions.props b/eng/Versions.props index 4265ca90427500..0da0f60f30b951 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,80 +1,69 @@ - 6.0.0 + 6.0.33 6 0 - 0 - 6.0.100 - rc - 1 + 33 + 6.0.400 + servicing + + $(MajorVersion).$(MinorVersion).0.0 - false + true release true - - 4.0.0-3.21376.12 true false false + $(AssemblyVersion) - - - + + + - - 3.9.0 - 3.9.0 + + 3.11.0 + 4.0.0-3.final + 4.0.0-3.final 3.10.0 3.10.0 - 6.0.0-rc1.21413.4 + 6.0.0-rtm.21514.4 - 1.0.0-rc.1.21404.21 + 1.1.0-preview.22164.17 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 2.5.1-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 - 6.0.0-beta.21413.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 2.5.1-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 + 6.0.0-beta.24266.4 6.0.0-preview.1.102 - 6.0.0-alpha.1.20612.4 - 6.0.0-rc.1.21415.6 - 6.0.0-rc.1.21415.6 - 3.1.0 + 6.0.0-alpha.1.20612.4 + 6.0.13 + 6.0.13 + 6.0.0 6.0.0-rc.1.21415.6 @@ -85,7 +74,7 @@ 4.5.1 4.3.0 5.0.0 - 4.8.2 + 4.8.6 4.5.0 4.3.0 4.3.0 @@ -96,6 +85,9 @@ 4.3.1 4.5.0 5.0.0 + + 5.0.0 + 5.0.0 4.7.0 4.7.0 4.7.0 @@ -109,31 +101,32 @@ 5.0.0 5.0.0 5.0.0 - 4.8.1 + 4.9.0 6.0.0-rc.1.21415.6 6.0.0-rc.1.21415.6 4.5.4 4.5.0 6.0.0-rc.1.21415.6 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 - 6.0.0-beta.21416.1 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 + 6.0.0-beta.24271.2 1.0.0-prerelease.21416.5 1.0.0-prerelease.21416.5 1.0.0-prerelease.21416.5 1.0.0-prerelease.21416.5 - 16.9.0-beta1.21055.5 + 17.10.0-beta1.24272.1 2.0.0-beta1.20253.1 2.0.65 2.2.0 @@ -142,39 +135,36 @@ 1.0.0-beta-build0015 1.0.4-preview6.19326.1 0.2.61701 - - 16.10.0 - $(RefOnlyMicrosoftBuildVersion) - $(RefOnlyMicrosoftBuildVersion) - $(RefOnlyMicrosoftBuildVersion) - 5.8.0 - 5.8.0 + 16.10.0 + $(MicrosoftBuildVersion) + 4.7.2 + 6.7.1 + 6.2.4 1.0.1-prerelease-00006 - 16.9.0-preview-20201201-01 - 1.0.0-prerelease.21404.1 - 1.0.0-prerelease.21404.1 - 1.0.2-alpha.0.21413.1 - 2.4.1 + 17.4.0-preview-20220707-01 + 6.0.0-prerelease.24224.2 + 6.0.0-prerelease.24224.2 + 6.0.0-alpha.0.24271.2 + 2.4.2-pre.9 2.4.2 1.3.0 - 12.0.3 + 13.0.1 + 1.0.2 2.0.4 4.12.0 2.14.3 - 6.0.100-rc.1.21412.8 + 6.0.400-rtm.22371.2 + 6.0.4xx - 5.0.0-preview-20201009.2 + 6.0.0-preview-20211019.1 - 6.0.100-preview.6.21416.1 + 6.0.100-1.21459.1 $(MicrosoftNETILLinkTasksVersion) - 6.0.0-rc.1.21416.1 + 6.0.0-rtm.24269.3 - 6.0.0-preview.7.21417.1 + 6.0.0-servicing.22205.1 11.1.0-alpha.1.21416.1 11.1.0-alpha.1.21416.1 @@ -185,11 +175,13 @@ 11.1.0-alpha.1.21416.1 11.1.0-alpha.1.21416.1 - 6.0.0-rc.1.21416.1 + 6.0.32 + 6.0.32 + 6.0.32 $(MicrosoftNETWorkloadEmscriptenManifest60100Version) 1.1.87-gba258badda - 3.14.0-dotnet + 3.14.1-8722.20240403.1 6.0.0-preview.5.21275.7 diff --git a/eng/build.ps1 b/eng/build.ps1 index af253dfb3dbd43..14dadeec13b1de 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -254,6 +254,10 @@ foreach ($argument in $PSBoundParameters.Keys) $failedBuilds = @() +# Disable targeting pack caching as we reference a partially constructed targeting pack and update it later. +# The later changes are ignored when using the cache. +$env:DOTNETSDK_ALLOW_TARGETING_PACK_CACHING=0 + if ($os -eq "Browser") { # override default arch for Browser, we only support wasm $arch = "wasm" diff --git a/eng/build.sh b/eng/build.sh index 128e720d3c0b2d..ea6be90af61075 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -31,6 +31,7 @@ usage() echo " --os Target operating system: windows, Linux, FreeBSD, OSX, MacCatalyst, tvOS," echo " tvOSSimulator, iOS, iOSSimulator, Android, Browser, NetBSD, illumos or Solaris." echo " [Default: Your machine's OS.]" + echo " --outputrid Optional argument that overrides the target rid name." echo " --projects Project or solution file(s) to build." echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked." echo " Checked is exclusive to the CLR runtime. It is the same as Debug, except code is" @@ -400,6 +401,15 @@ while [[ $# > 0 ]]; do shift 1 ;; + -outputrid) + if [ -z ${2+x} ]; then + echo "No value for outputrid is supplied. See help (--help) for supported values." 1>&2 + exit 1 + fi + arguments="$arguments /p:OutputRid=$(echo "$2" | tr "[:upper:]" "[:lower:]")" + shift 2 + ;; + -portablebuild) if [ -z ${2+x} ]; then echo "No value for portablebuild is supplied. See help (--help) for supported values." 1>&2 @@ -468,6 +478,10 @@ fi initDistroRid $os $arch $crossBuild $portableBuild +# Disable targeting pack caching as we reference a partially constructed targeting pack and update it later. +# The later changes are ignored when using the cache. +export DOTNETSDK_ALLOW_TARGETING_PACK_CACHING=0 + # URL-encode space (%20) to avoid quoting issues until the msbuild call in /eng/common/tools.sh. # In *proj files (XML docs), URL-encoded string are rendered in their decoded form. cmakeargs="${cmakeargs// /%20}" diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 18823840b11275..4ed5c54e7331b5 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -35,7 +35,7 @@ Set-StrictMode -Version 2.0 . $PSScriptRoot\tools.ps1 # Add source entry to PackageSources -function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $Password) { +function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) { $packageSource = $sources.SelectSingleNode("add[@key='$SourceName']") if ($packageSource -eq $null) @@ -49,11 +49,11 @@ function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Usern Write-Host "Package source $SourceName already present." } - AddCredential -Creds $creds -Source $SourceName -Username $Username -Password $Password + AddCredential -Creds $creds -Source $SourceName -Username $Username -pwd $pwd } # Add a credential node for the specified source -function AddCredential($creds, $source, $username, $password) { +function AddCredential($creds, $source, $username, $pwd) { # Looks for credential configuration for the given SourceName. Create it if none is found. $sourceElement = $creds.SelectSingleNode($Source) if ($sourceElement -eq $null) @@ -82,17 +82,17 @@ function AddCredential($creds, $source, $username, $password) { $passwordElement.SetAttribute("key", "ClearTextPassword") $sourceElement.AppendChild($passwordElement) | Out-Null } - $passwordElement.SetAttribute("value", $Password) + $passwordElement.SetAttribute("value", $pwd) } -function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Password) { +function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $pwd) { $maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]") Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds." ForEach ($PackageSource in $maestroPrivateSources) { Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key - AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -Password $Password + AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -pwd $pwd } } @@ -144,24 +144,24 @@ if ($disabledSources -ne $null) { $userName = "dn-bot" # Insert credential nodes for Maestro's private feeds -InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -Password $Password +InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -pwd $Password $dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']") if ($dotnet31Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password } $dotnet5Source = $sources.SelectSingleNode("add[@key='dotnet5']") if ($dotnet5Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet5-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet5-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet5-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password + AddPackageSource -Sources $sources -SourceName "dotnet5-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password } $dotnet6Source = $sources.SelectSingleNode("add[@key='dotnet6']") if ($dotnet6Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet6-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet6-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet6-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password + AddPackageSource -Sources $sources -SourceName "dotnet6-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password } $doc.Save($filename) diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 8943da242f6e92..33a6f2d0e24811 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -26,6 +26,7 @@ Param( [string] $runtimeSourceFeed = '', [string] $runtimeSourceFeedKey = '', [switch] $excludePrereleaseVS, + [switch] $nativeToolsOnMachine, [switch] $help, [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties ) @@ -67,6 +68,7 @@ function Print-Usage() { Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio" + Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)" Write-Host "" Write-Host "Command line arguments not listed above are passed thru to msbuild." @@ -146,6 +148,9 @@ try { $nodeReuse = $false } + if ($nativeToolsOnMachine) { + $env:NativeToolsOnMachine = $true + } if ($restore) { InitializeNativeTools } diff --git a/eng/common/build.sh b/eng/common/build.sh index 55b298f16ccd1f..a16e18b174a759 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -187,6 +187,7 @@ function InitializeCustomToolset { } function Build { + InitializeToolset InitializeCustomToolset diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index fc11001aa76c82..51f30e53dd4303 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -1,5 +1,12 @@ set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) +# reset platform variables (e.g. cmake 3.25 sets LINUX=1) +unset(LINUX) +unset(FREEBSD) +unset(ILLUMOS) +unset(ANDROID) +unset(TIZEN) + set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) if(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version) set(CMAKE_SYSTEM_NAME FreeBSD) @@ -138,8 +145,8 @@ function(add_toolchain_linker_flag Flag) if (NOT Config STREQUAL "") set(CONFIG_SUFFIX "_${Config}") endif() - set("CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE) - set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE) + set("CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE) + set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE) endfunction() if(CMAKE_SYSTEM_NAME STREQUAL "Linux") diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 435e7641341b16..8fda30bdce2b09 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,6 +1,6 @@ param ( $darcVersion = $null, - $versionEndpoint = 'https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16', + $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16', $verbosity = 'minimal', $toolpath = $null ) diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index 39abdbecdcf11b..4e4116f1d0bf9b 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -2,7 +2,7 @@ source="${BASH_SOURCE[0]}" darcVersion='' -versionEndpoint='https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16' +versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16' verbosity='minimal' while [[ $# > 0 ]]; do diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh index fdfeea66e7d43f..b09ea669f9c0aa 100755 --- a/eng/common/dotnet-install.sh +++ b/eng/common/dotnet-install.sh @@ -52,7 +52,7 @@ done # Use uname to determine what the CPU is, see https://en.wikipedia.org/wiki/Uname#Examples cpuname=$(uname -m) case $cpuname in - aarch64) + arm64|aarch64) buildarch=arm64 ;; amd64|x86_64) @@ -61,7 +61,7 @@ case $cpuname in armv*l) buildarch=arm ;; - i686) + i[3-6]86) buildarch=x86 ;; *) 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/generate-sbom-prep.ps1 b/eng/common/generate-sbom-prep.ps1 new file mode 100644 index 00000000000000..3e5c1c74a1c50d --- /dev/null +++ b/eng/common/generate-sbom-prep.ps1 @@ -0,0 +1,21 @@ +Param( + [Parameter(Mandatory=$true)][string] $ManifestDirPath # Manifest directory where sbom will be placed +) + +. $PSScriptRoot\pipeline-logging-functions.ps1 + +Write-Host "Creating dir $ManifestDirPath" +# create directory for sbom manifest to be placed +if (!(Test-Path -path $ManifestDirPath)) +{ + New-Item -ItemType Directory -path $ManifestDirPath + Write-Host "Successfully created directory $ManifestDirPath" +} +else{ + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +} + +Write-Host "Updating artifact name" +$artifact_name = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" -replace '["/:<>\\|?@*"() ]', '_' +Write-Host "Artifact name $artifact_name" +Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$artifact_name" diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh new file mode 100644 index 00000000000000..d5c76dc827b496 --- /dev/null +++ b/eng/common/generate-sbom-prep.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +. $scriptroot/pipeline-logging-functions.sh + +manifest_dir=$1 + +if [ ! -d "$manifest_dir" ] ; then + mkdir -p "$manifest_dir" + echo "Sbom directory created." $manifest_dir +else + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +fi + +artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" +echo "Artifact name before : "$artifact_name +# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. +safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" +echo "Artifact name after : "$safe_artifact_name +export ARTIFACT_NAME=$safe_artifact_name +echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name" + +exit 0 diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index db830c00a6f8d8..6c7a851a8087e0 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -31,6 +31,10 @@ Wait time between retry attempts in seconds .PARAMETER GlobalJsonFile File path to global.json file +.PARAMETER PathPromotion +Optional switch to enable either promote native tools specified in the global.json to the path (in Azure Pipelines) +or break the build if a native tool is not found on the path (on a local dev machine) + .NOTES #> [CmdletBinding(PositionalBinding=$false)] @@ -41,7 +45,8 @@ Param ( [switch] $Force = $False, [int] $DownloadRetries = 5, [int] $RetryWaitTimeInSeconds = 30, - [string] $GlobalJsonFile + [string] $GlobalJsonFile, + [switch] $PathPromotion ) if (!$GlobalJsonFile) { @@ -77,53 +82,101 @@ try { ConvertFrom-Json | Select-Object -Expand 'native-tools' -ErrorAction SilentlyContinue if ($NativeTools) { - $NativeTools.PSObject.Properties | ForEach-Object { - $ToolName = $_.Name - $ToolVersion = $_.Value - $LocalInstallerArguments = @{ ToolName = "$ToolName" } - $LocalInstallerArguments += @{ InstallPath = "$InstallBin" } - $LocalInstallerArguments += @{ BaseUri = "$BaseUri" } - $LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" } - $LocalInstallerArguments += @{ Version = "$ToolVersion" } - - if ($Verbose) { - $LocalInstallerArguments += @{ Verbose = $True } - } - if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { - if($Force) { - $LocalInstallerArguments += @{ Force = $True } - } - } - if ($Clean) { - $LocalInstallerArguments += @{ Clean = $True } - } - - Write-Verbose "Installing $ToolName version $ToolVersion" - Write-Verbose "Executing '$InstallerPath $($LocalInstallerArguments.Keys.ForEach({"-$_ '$($LocalInstallerArguments.$_)'"}) -join ' ')'" - & $InstallerPath @LocalInstallerArguments - if ($LASTEXITCODE -Ne "0") { - $errMsg = "$ToolName installation failed" - if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { - $showNativeToolsWarning = $true - if ((Get-Variable 'DoNotDisplayNativeToolsInstallationWarnings' -ErrorAction 'SilentlyContinue') -and $DoNotDisplayNativeToolsInstallationWarnings) { - $showNativeToolsWarning = $false + if ($PathPromotion -eq $True) { + if ($env:SYSTEM_TEAMPROJECT) { # check to see if we're in an Azure pipelines build + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + $InstalledTools = @{} + + if ((Get-Command "$ToolName" -ErrorAction SilentlyContinue) -eq $null) { + if ($ToolVersion -eq "latest") { + $ToolVersion = "" + } + $ArcadeToolsDirectory = "C:\arcade-tools" + if (-not (Test-Path $ArcadeToolsDirectory)) { + Write-Error "Arcade tools directory '$ArcadeToolsDirectory' was not found; artifacts were not properly installed." + exit 1 + } + $ToolDirectory = (Get-ChildItem -Path "$ArcadeToolsDirectory" -Filter "$ToolName-$ToolVersion*" | Sort-Object -Descending)[0] + if ([string]::IsNullOrWhiteSpace($ToolDirectory)) { + Write-Error "Unable to find directory for $ToolName $ToolVersion; please make sure the tool is installed on this image." + exit 1 } - if ($showNativeToolsWarning) { - Write-Warning $errMsg + $BinPathFile = "$($ToolDirectory.FullName)\binpath.txt" + if (-not (Test-Path -Path "$BinPathFile")) { + Write-Error "Unable to find binpath.txt in '$($ToolDirectory.FullName)' ($ToolName $ToolVersion); artifact is either installed incorrectly or is not a bootstrappable tool." + exit 1 } - $toolInstallationFailure = $true - } else { - # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 - Write-Host $errMsg - exit 1 + $BinPath = Get-Content "$BinPathFile" + $ToolPath = Convert-Path -Path $BinPath + Write-Host "Adding $ToolName to the path ($ToolPath)..." + Write-Host "##vso[task.prependpath]$ToolPath" + $env:PATH = "$ToolPath;$env:PATH" + $InstalledTools += @{ $ToolName = $ToolDirectory.FullName } + } } + return $InstalledTools + } else { + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + + if ((Get-Command "$ToolName" -ErrorAction SilentlyContinue) -eq $null) { + Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message "$ToolName not found on path. Please install $ToolName $ToolVersion before proceeding." + } + } + exit 0 + } + } else { + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + $LocalInstallerArguments = @{ ToolName = "$ToolName" } + $LocalInstallerArguments += @{ InstallPath = "$InstallBin" } + $LocalInstallerArguments += @{ BaseUri = "$BaseUri" } + $LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" } + $LocalInstallerArguments += @{ Version = "$ToolVersion" } + + if ($Verbose) { + $LocalInstallerArguments += @{ Verbose = $True } + } + if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { + if($Force) { + $LocalInstallerArguments += @{ Force = $True } + } + } + if ($Clean) { + $LocalInstallerArguments += @{ Clean = $True } + } + + Write-Verbose "Installing $ToolName version $ToolVersion" + Write-Verbose "Executing '$InstallerPath $($LocalInstallerArguments.Keys.ForEach({"-$_ '$($LocalInstallerArguments.$_)'"}) -join ' ')'" + & $InstallerPath @LocalInstallerArguments + if ($LASTEXITCODE -Ne "0") { + $errMsg = "$ToolName installation failed" + if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { + $showNativeToolsWarning = $true + if ((Get-Variable 'DoNotDisplayNativeToolsInstallationWarnings' -ErrorAction 'SilentlyContinue') -and $DoNotDisplayNativeToolsInstallationWarnings) { + $showNativeToolsWarning = $false + } + if ($showNativeToolsWarning) { + Write-Warning $errMsg + } + $toolInstallationFailure = $true + } else { + # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 + Write-Host $errMsg + exit 1 + } + } + } + + if ((Get-Variable 'toolInstallationFailure' -ErrorAction 'SilentlyContinue') -and $toolInstallationFailure) { + # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 + Write-Host 'Native tools bootstrap failed' + exit 1 } - } - - if ((Get-Variable 'toolInstallationFailure' -ErrorAction 'SilentlyContinue') -and $toolInstallationFailure) { - # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 - Write-Host 'Native tools bootstrap failed' - exit 1 } } else { @@ -139,7 +192,7 @@ try { Write-Host "##vso[task.prependpath]$(Convert-Path -Path $InstallBin)" return $InstallBin } - else { + elseif (-not ($PathPromotion)) { Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message 'Native tools install directory does not exist, installation failed' exit 1 } @@ -149,4 +202,4 @@ catch { Write-Host $_.ScriptStackTrace Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message $_ ExitWithExitCode 1 -} +} \ No newline at end of file diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh index 5bd205b5da3b79..3e6a8d6acf2f57 100755 --- a/eng/common/init-tools-native.sh +++ b/eng/common/init-tools-native.sh @@ -10,7 +10,7 @@ force=false download_retries=5 retry_wait_time_seconds=30 global_json_file="$(dirname "$(dirname "${scriptroot}")")/global.json" -declare -A native_assets +declare -a native_assets . $scriptroot/pipeline-logging-functions.sh . $scriptroot/native/common-library.sh diff --git a/eng/common/internal/NuGet.config b/eng/common/internal/NuGet.config new file mode 100644 index 00000000000000..19d3d311b166f5 --- /dev/null +++ b/eng/common/internal/NuGet.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index beb9c4648ea19a..7f5ce6d6081338 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -8,6 +8,9 @@ + + + diff --git a/eng/common/native/common-library.sh b/eng/common/native/common-library.sh index bf272dcf55a538..080c2c283ae468 100755 --- a/eng/common/native/common-library.sh +++ b/eng/common/native/common-library.sh @@ -148,8 +148,12 @@ function NewScriptShim { fi if [[ ! -f $tool_file_path ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Specified tool file path:'$tool_file_path' does not exist" - return 1 + # try to see if the path is lower cased + tool_file_path="$(echo $tool_file_path | tr "[:upper:]" "[:lower:]")" + if [[ ! -f $tool_file_path ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Specified tool file path:'$tool_file_path' does not exist" + return 1 + fi fi local shim_contents=$'#!/usr/bin/env bash\n' diff --git a/eng/common/post-build/add-build-to-channel.ps1 b/eng/common/post-build/add-build-to-channel.ps1 index de2d957922a653..49938f0c89f768 100644 --- a/eng/common/post-build/add-build-to-channel.ps1 +++ b/eng/common/post-build/add-build-to-channel.ps1 @@ -2,7 +2,7 @@ param( [Parameter(Mandatory=$true)][int] $BuildId, [Parameter(Mandatory=$true)][int] $ChannelId, [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16' ) diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 2427ca6b6aec74..5a3a32ea8d75b4 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -3,21 +3,16 @@ param( [Parameter(Mandatory=$true)][int] $PublishingInfraVersion, [Parameter(Mandatory=$true)][string] $AzdoToken, [Parameter(Mandatory=$true)][string] $MaestroToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [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 { . $PSScriptRoot\post-build-utils.ps1 - $darc = Get-Darc + $darc = Get-Darc $optionalParams = [System.Collections.ArrayList]::new() @@ -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 ` @@ -72,7 +46,7 @@ try { } Write-Host 'done.' -} +} catch { Write-Host $_ Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to publish build '$BuildId' to default channels." diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 85c89861719ada..e8ab29afeb3330 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -17,6 +17,7 @@ $global:RepoFiles = @{} $MaxParallelJobs = 16 $MaxRetries = 5 +$RetryWaitTimeInSeconds = 30 # Wait time between check for system load $SecondsBetweenLoadChecks = 10 @@ -99,21 +100,25 @@ $ValidatePackage = { $Status = 200 $Cache = $using:RepoFiles - $totalRetries = 0 + $attempts = 0 - while ($totalRetries -lt $using:MaxRetries) { + while ($attempts -lt $using:MaxRetries) { if ( !($Cache.ContainsKey($FilePath)) ) { try { $Uri = $Link -as [System.URI] - # Only GitHub links are valid - if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { + if ($Link -match "submodules") { + # Skip submodule links until sourcelink properly handles submodules + $Status = 200 + } + elseif ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { + # Only GitHub links are valid $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode } else { # If it's not a github link, we want to break out of the loop and not retry. $Status = 0 - $totalRetries = $using:MaxRetries + $attempts = $using:MaxRetries } } catch { @@ -123,9 +128,15 @@ $ValidatePackage = { } if ($Status -ne 200) { - $totalRetries++ + $attempts++ - if ($totalRetries -ge $using:MaxRetries) { + if ($attempts -lt $using:MaxRetries) + { + $attemptsLeft = $using:MaxRetries - $attempts + Write-Warning "Download failed, $attemptsLeft attempts remaining, will retry in $using:RetryWaitTimeInSeconds seconds" + Start-Sleep -Seconds $using:RetryWaitTimeInSeconds + } + else { if ($NumFailedLinks -eq 0) { if ($FailedFiles.Value -eq 0) { Write-Host diff --git a/eng/common/post-build/trigger-subscriptions.ps1 b/eng/common/post-build/trigger-subscriptions.ps1 index 55dea518ac5850..ac9a95778fcd9e 100644 --- a/eng/common/post-build/trigger-subscriptions.ps1 +++ b/eng/common/post-build/trigger-subscriptions.ps1 @@ -2,7 +2,7 @@ param( [Parameter(Mandatory=$true)][string] $SourceRepo, [Parameter(Mandatory=$true)][int] $ChannelId, [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16' ) diff --git a/eng/common/retain-build.ps1 b/eng/common/retain-build.ps1 new file mode 100644 index 00000000000000..e7ba975adeb6b1 --- /dev/null +++ b/eng/common/retain-build.ps1 @@ -0,0 +1,45 @@ + +Param( +[Parameter(Mandatory=$true)][int] $buildId, +[Parameter(Mandatory=$true)][string] $azdoOrgUri, +[Parameter(Mandatory=$true)][string] $azdoProject, +[Parameter(Mandatory=$true)][string] $token +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +function Get-AzDOHeaders( + [string] $token) +{ + $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":${token}")) + $headers = @{"Authorization"="Basic $base64AuthInfo"} + return $headers +} + +function Update-BuildRetention( + [string] $azdoOrgUri, + [string] $azdoProject, + [int] $buildId, + [string] $token) +{ + $headers = Get-AzDOHeaders -token $token + $requestBody = "{ + `"keepForever`": `"true`" + }" + + $requestUri = "${azdoOrgUri}/${azdoProject}/_apis/build/builds/${buildId}?api-version=6.0" + write-Host "Attempting to retain build using the following URI: ${requestUri} ..." + + try { + Invoke-RestMethod -Uri $requestUri -Method Patch -Body $requestBody -Header $headers -contentType "application/json" + Write-Host "Updated retention settings for build ${buildId}." + } + catch { + Write-Error "Failed to update retention settings for build: $_.Exception.Response.StatusDescription" + exit 1 + } +} + +Update-BuildRetention -azdoOrgUri $azdoOrgUri -azdoProject $azdoProject -buildId $buildId -token $token +exit 0 diff --git a/eng/common/sdl/configure-sdl-tool.ps1 b/eng/common/sdl/configure-sdl-tool.ps1 index 4999c307088a03..adea8e8da2ab24 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 1157151f4862a2..b9fe7317964319 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/sdl/packages.config b/eng/common/sdl/packages.config index 3bd8b29ebd721b..b7bcfe38caf15f 100644 --- a/eng/common/sdl/packages.config +++ b/eng/common/sdl/packages.config @@ -1,4 +1,4 @@ - + diff --git a/eng/common/sdl/sdl.ps1 b/eng/common/sdl/sdl.ps1 new file mode 100644 index 00000000000000..648c5068d7d60f --- /dev/null +++ b/eng/common/sdl/sdl.ps1 @@ -0,0 +1,38 @@ + +function Install-Gdn { + param( + [Parameter(Mandatory=$true)] + [string]$Path, + + # If omitted, install the latest version of Guardian, otherwise install that specific version. + [string]$Version + ) + + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + $disableConfigureToolsetImport = $true + $global:LASTEXITCODE = 0 + + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + $argumentList = @("install", "Microsoft.Guardian.Cli", "-Source https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json", "-OutputDirectory $Path", "-NonInteractive", "-NoCache") + + if ($Version) { + $argumentList += "-Version $Version" + } + + Start-Process nuget -Verbose -ArgumentList $argumentList -NoNewWindow -Wait + + $gdnCliPath = Get-ChildItem -Filter guardian.cmd -Recurse -Path $Path + + if (!$gdnCliPath) + { + Write-PipelineTelemetryError -Category 'Sdl' -Message 'Failure installing Guardian' + } + + return $gdnCliPath.FullName +} \ No newline at end of file diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml new file mode 100644 index 00000000000000..21945ebdc9e31c --- /dev/null +++ b/eng/common/templates-official/job/job.yml @@ -0,0 +1,277 @@ +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +parameters: +# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + cancelTimeoutInMinutes: '' + condition: '' + container: '' + continueOnError: false + dependsOn: '' + displayName: '' + pool: '' + steps: [] + strategy: '' + timeoutInMinutes: '' + variables: [] + workspace: '' + templateContext: '' + +# Job base template specific parameters + # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md + artifacts: '' + enableMicrobuild: false + enablePublishBuildArtifacts: false + enablePublishBuildAssets: false + enablePublishTestResults: false + enablePublishUsingPipelines: false + disableComponentGovernance: '' + mergeTestResults: false + testRunTitle: '' + testResultsFormat: '' + name: '' + preSteps: [] + runAsPublic: false +# Sbom related params + enableSbom: true + PackageVersion: 6.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + +jobs: +- job: ${{ parameters.name }} + + ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: + cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} + + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + + ${{ if ne(parameters.container, '') }}: + container: ${{ parameters.container }} + + ${{ if ne(parameters.continueOnError, '') }}: + continueOnError: ${{ parameters.continueOnError }} + + ${{ if ne(parameters.dependsOn, '') }}: + dependsOn: ${{ parameters.dependsOn }} + + ${{ if ne(parameters.displayName, '') }}: + displayName: ${{ parameters.displayName }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + + ${{ if ne(parameters.strategy, '') }}: + strategy: ${{ parameters.strategy }} + + ${{ if ne(parameters.timeoutInMinutes, '') }}: + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + ${{ if ne(parameters.templateContext, '') }}: + templateContext: ${{ parameters.templateContext }} + + variables: + - ${{ if ne(parameters.enableTelemetry, 'false') }}: + - name: DOTNET_CLI_TELEMETRY_PROFILE + value: '$(Build.Repository.Uri)' + - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: + - name: EnableRichCodeNavigation + value: 'true' + # Retry signature validation up to three times, waiting 2 seconds between attempts. + # See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures + - name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY + value: 3,2000 + - ${{ each variable in parameters.variables }}: + # handle name-value variable syntax + # example: + # - name: [key] + # value: [value] + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + + # handle variable groups + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + + # handle key-value variable syntax. + # example: + # - [key]: [value] + - ${{ if and(eq(variable.name, ''), eq(variable.group, '')) }}: + - ${{ each pair in variable }}: + - name: ${{ pair.key }} + value: ${{ pair.value }} + + # DotNet-HelixApi-Access provides 'HelixApiAccessToken' for internal builds + - ${{ if and(eq(parameters.enableTelemetry, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: DotNet-HelixApi-Access + + ${{ if ne(parameters.workspace, '') }}: + workspace: ${{ parameters.workspace }} + + steps: + - ${{ if ne(parameters.preSteps, '') }}: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - task: MicroBuildSigningPlugin@4 + displayName: Install MicroBuild plugin + inputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + env: + TeamName: $(_TeamName) + MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + + - task: NuGetAuthenticate@1 + + - ${{ if or(eq(parameters.artifacts.download, 'true'), ne(parameters.artifacts.download, '')) }}: + - task: DownloadPipelineArtifact@2 + inputs: + buildType: current + artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} + targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} + itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} + + - ${{ each step in parameters.steps }}: + - ${{ step }} + + - ${{ if eq(parameters.enableRichCodeNavigation, true) }}: + - task: RichCodeNavIndexer@0 + displayName: RichCodeNav Upload + inputs: + languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }} + environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'production') }} + richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin + continueOnError: true + + - template: /eng/common/templates-official/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false + ${{ else }}: + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildCleanup@1 + displayName: Execute Microbuild cleanup tasks + condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + env: + TeamName: $(_TeamName) + + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if or(eq(parameters.artifacts.publish.artifacts, 'true'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - task: CopyFiles@2 + displayName: Gather binaries for publish to artifacts + inputs: + SourceFolder: 'artifacts/bin' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' + - task: CopyFiles@2 + displayName: Gather packages for publish to artifacts + inputs: + SourceFolder: 'artifacts/packages' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish pipeline artifacts + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + PublishLocation: Container + ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + continueOnError: true + condition: always() + - ${{ if or(eq(parameters.artifacts.publish.logs, 'true'), ne(parameters.artifacts.publish.logs, '')) }}: + - task: 1ES.PublishPipelineArtifact@1 + inputs: + targetPath: 'artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: 'Publish logs' + continueOnError: true + condition: always() + + - ${{ if or(eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - ${{ if and(ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.ArtifactStagingDirectory)/AssetManifests' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'xunit')) }}: + - task: PublishTestResults@2 + displayName: Publish XUnit Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'vstest')) }}: + - task: PublishTestResults@2 + displayName: Publish TRX Test Results + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '*.trx' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + + - ${{ if and(eq(parameters.enablePublishBuildAssets, true), ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.StagingDirectory)/AssetManifests' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates-official/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion}} + BuildDropPath: ${{ parameters.buildDropPath }} diff --git a/eng/common/templates-official/job/onelocbuild.yml b/eng/common/templates-official/job/onelocbuild.yml new file mode 100644 index 00000000000000..08df5637599d4d --- /dev/null +++ b/eng/common/templates-official/job/onelocbuild.yml @@ -0,0 +1,109 @@ +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: '' + + CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex + GithubPat: $(BotAccount-dotnet-bot-repo-PAT) + + SourcesDirectory: $(Build.SourcesDirectory) + CreatePr: true + AutoCompletePr: false + ReusePr: true + UseLfLineEndings: true + UseCheckedInLocProjectJson: false + LanguageSet: VS_Main_Languages + LclSource: lclFilesInRepo + LclPackageId: '' + RepoType: gitHub + GitHubOrg: dotnet + MirrorRepo: '' + MirrorBranch: main + condition: '' + +jobs: +- job: OneLocBuild + + dependsOn: ${{ parameters.dependsOn }} + + displayName: OneLocBuild + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Svc-Internal + image: 1es-windows-2022 + os: windows + + variables: + - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat + - name: _GenerateLocProjectArguments + value: -SourcesDirectory ${{ parameters.SourcesDirectory }} + -LanguageSet "${{ parameters.LanguageSet }}" + -CreateNeutralXlfs + - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: + - name: _GenerateLocProjectArguments + value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson + + + steps: + - task: Powershell@2 + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 + arguments: $(_GenerateLocProjectArguments) + displayName: Generate LocProject.json + condition: ${{ parameters.condition }} + + - task: OneLocBuild@2 + displayName: OneLocBuild + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + inputs: + locProj: eng/Localize/LocProject.json + outDir: $(Build.ArtifactStagingDirectory) + lclSource: ${{ parameters.LclSource }} + lclPackageId: ${{ parameters.LclPackageId }} + isCreatePrSelected: ${{ parameters.CreatePr }} + ${{ if eq(parameters.CreatePr, true) }}: + isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} + isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + isShouldReusePrSelected: ${{ parameters.ReusePr }} + packageSourceAuth: patAuth + patVariable: ${{ parameters.CeapexPat }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + repoType: ${{ parameters.RepoType }} + gitHubPatVariable: "${{ parameters.GithubPat }}" + ${{ if ne(parameters.MirrorRepo, '') }}: + isMirrorRepoSelected: true + gitHubOrganization: ${{ parameters.GitHubOrg }} + mirrorRepo: ${{ parameters.MirrorRepo }} + mirrorBranch: ${{ parameters.MirrorBranch }} + condition: ${{ parameters.condition }} + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish Localization Files + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/loc' + PublishLocation: Container + ArtifactName: Loc + condition: ${{ parameters.condition }} + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish LocProject.json + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/eng/Localize/' + PublishLocation: Container + ArtifactName: Loc + condition: ${{ parameters.condition }} \ No newline at end of file diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml new file mode 100644 index 00000000000000..1d84eb301c46c2 --- /dev/null +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -0,0 +1,123 @@ +parameters: + configuration: 'Debug' + + # Optional: condition for the job to run + condition: '' + + # Optional: 'true' if future jobs should run even if this job fails + continueOnError: false + + # Optional: dependencies of the job + dependsOn: '' + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: {} + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing + publishUsingPipelines: false + +jobs: +- job: Asset_Registry_Publish + + dependsOn: ${{ parameters.dependsOn }} + + displayName: Publish to Build Asset Registry + + pool: ${{ parameters.pool }} + + variables: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - name: _BuildConfig + value: ${{ parameters.configuration }} + - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats + - name: runCodesignValidationInjection + value: false + + steps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + checkDownloadedFiles: true + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: NuGetAuthenticate@1 + + - task: PowerShell@2 + displayName: Enable cross-org NuGet feed authentication + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-all-orgs-artifact-feeds-rw) + + - task: PowerShell@2 + displayName: Publish Build Assets + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro.dot.net + /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} + /p:Configuration=$(_BuildConfig) + /p:OfficialBuildId=$(Build.BuildNumber) + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - task: powershell@2 + displayName: Create ReleaseConfigs Artifact + inputs: + targetType: inline + script: | + New-Item -Path "$(Build.StagingDirectory)/ReleaseConfigs" -ItemType Directory -Force + $filePath = "$(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt" + Add-Content -Path $filePath -Value $(BARBuildId) + Add-Content -Path $filePath -Value "$(DefaultChannels)" + Add-Content -Path $filePath -Value $(IsStableBuild) + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish ReleaseConfigs Artifact + inputs: + PathtoPublish: '$(Build.StagingDirectory)/ReleaseConfigs' + PublishLocation: Container + ArtifactName: ReleaseConfigs + + - task: powershell@2 + displayName: Check if SymbolPublishingExclusionsFile.txt exists + inputs: + targetType: inline + script: | + $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" + if(Test-Path -Path $symbolExclusionfile) + { + Write-Host "SymbolExclusionFile exists" + Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]true" + } + else{ + Write-Host "Symbols Exclusion file does not exists" + Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]false" + } + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish SymbolPublishingExclusionsFile Artifact + condition: eq(variables['SymbolExclusionFile'], 'true') + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' + PublishLocation: Container + ArtifactName: ReleaseConfigs + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - template: /eng/common/templates-official/steps/publish-logs.yml + parameters: + JobLabel: 'Publish_Artifacts_Logs' diff --git a/eng/common/templates-official/job/source-build.yml b/eng/common/templates-official/job/source-build.yml new file mode 100644 index 00000000000000..f5fa09f4151173 --- /dev/null +++ b/eng/common/templates-official/job/source-build.yml @@ -0,0 +1,64 @@ +parameters: + # This template adds arcade-powered source-build to CI. The template produces a server job with a + # default ID 'Source_Build_Complete' to put in a dependency list if necessary. + + # Specifies the prefix for source-build jobs added to pipeline. Use this if disambiguation needed. + jobNamePrefix: 'Source_Build' + + # Defines the platform on which to run the job. By default, a linux-x64 machine, suitable for + # managed-only repositories. This is an object with these properties: + # + # name: '' + # The name of the job. This is included in the job ID. + # targetRID: '' + # The name of the target RID to use, instead of the one auto-detected by Arcade. + # nonPortable: false + # Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than + # linux-x64), and compiling against distro-provided packages rather than portable ones. + # skipPublishValidation: false + # Disables publishing validation. By default, a check is performed to ensure no packages are + # published by source-build. + # container: '' + # A container to use. Runs in docker. + # pool: {} + # A pool to use. Runs directly on an agent. + # buildScript: '' + # Specifies the build script to invoke to perform the build in the repo. The default + # './build.sh' should work for typical Arcade repositories, but this is customizable for + # difficult situations. + # jobProperties: {} + # A list of job properties to inject at the top level, for potential extensibility beyond + # container and pool. + platform: {} + +jobs: +- job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} + displayName: Source-Build (${{ parameters.platform.name }}) + + ${{ each property in parameters.platform.jobProperties }}: + ${{ property.key }}: ${{ property.value }} + + ${{ if ne(parameters.platform.container, '') }}: + container: ${{ parameters.platform.container }} + + ${{ if eq(parameters.platform.pool, '') }}: + # The default VM host AzDO pool. This should be capable of running Docker containers: almost all + # source-build builds run in Docker, including the default managed platform. + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: NetCore-Svc-Public + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: NetCore1ESPool-Svc-Internal + image: 1es-mariner-2 + os: linux + ${{ if ne(parameters.platform.pool, '') }}: + pool: ${{ parameters.platform.pool }} + + workspace: + clean: all + + steps: + - template: /eng/common/templates-official/steps/source-build.yml + parameters: + platform: ${{ parameters.platform }} diff --git a/eng/common/templates-official/job/source-index-stage1.yml b/eng/common/templates-official/job/source-index-stage1.yml new file mode 100644 index 00000000000000..f04ad04c2b1861 --- /dev/null +++ b/eng/common/templates-official/job/source-index-stage1.yml @@ -0,0 +1,59 @@ +parameters: + runAsPublic: false + sourceIndexPackageVersion: 1.0.1-20240320.1 + sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json + sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" + preSteps: [] + binlogPath: artifacts/log/Debug/Build.binlog + pool: + name: NetCore1ESPool-Svc-Internal + image: 1es-windows-2022 + os: windows + condition: '' + dependsOn: '' + +jobs: +- job: SourceIndexStage1 + dependsOn: ${{ parameters.dependsOn }} + condition: ${{ parameters.condition }} + variables: + - name: SourceIndexPackageVersion + value: ${{ parameters.sourceIndexPackageVersion }} + - name: SourceIndexPackageSource + value: ${{ parameters.sourceIndexPackageSource }} + - name: BinlogPath + value: ${{ parameters.binlogPath }} + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: source-dot-net stage1 variables + + pool: ${{ parameters.pool }} + steps: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + + - task: UseDotNet@2 + displayName: Use .NET 8 SDK + inputs: + packageType: sdk + version: 8.0.x + installationPath: $(Agent.TempDirectory)/dotnet + workingDirectory: $(Agent.TempDirectory) + + - script: | + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + displayName: Download Tools + # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. + workingDirectory: $(Agent.TempDirectory) + + - script: ${{ parameters.sourceIndexBuildCommand }} + displayName: Build Repository + + - script: $(Agent.TempDirectory)/.source-index/tools/BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output + displayName: Process Binlog into indexable sln + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) + displayName: Upload stage1 artifacts to source index + env: + BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) diff --git a/eng/common/templates-official/jobs/codeql-build.yml b/eng/common/templates-official/jobs/codeql-build.yml new file mode 100644 index 00000000000000..0bf7ee29f40853 --- /dev/null +++ b/eng/common/templates-official/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-official/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.110.1 + - 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-official/jobs/jobs.yml b/eng/common/templates-official/jobs/jobs.yml new file mode 100644 index 00000000000000..c124aa9957878f --- /dev/null +++ b/eng/common/templates-official/jobs/jobs.yml @@ -0,0 +1,100 @@ +parameters: + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + continueOnError: false + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: Enable publishing using release pipelines + enablePublishUsingPipelines: false + + # Optional: Enable running the source-build jobs to build repo from source + enableSourceBuild: false + + # Optional: Parameters for source-build template. + # See /eng/common/templates-official/jobs/source-build.yml for options + sourceBuildParameters: [] + + graphFileGeneration: + # Optional: Enable generating the graph files at the end of the build + enabled: false + # Optional: Include toolset dependencies in the generated graph files + includeToolset: 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: Override automatically derived dependsOn value for "publish build assets" job + publishBuildAssetsDependsOn: '' + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + enableSourceIndex: false + sourceIndexParams: {} + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +jobs: +- ${{ each job in parameters.jobs }}: + - template: ../job/job.yml + parameters: + # pass along parameters + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} + + # pass along job properties + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} + + name: ${{ job.job }} + +- ${{ if eq(parameters.enableSourceBuild, true) }}: + - template: /eng/common/templates-official/jobs/source-build.yml + parameters: + allCompletedJobId: Source_Build_Complete + ${{ each parameter in parameters.sourceBuildParameters }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if eq(parameters.enableSourceIndex, 'true') }}: + - template: ../job/source-index-stage1.yml + parameters: + runAsPublic: ${{ parameters.runAsPublic }} + ${{ each parameter in parameters.sourceIndexParams }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + + - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - template: ../job/publish-build-assets.yml + parameters: + continueOnError: ${{ parameters.continueOnError }} + dependsOn: + - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.publishBuildAssetsDependsOn }}: + - ${{ job.job }} + - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.jobs }}: + - ${{ job.job }} + - ${{ if eq(parameters.enableSourceBuild, true) }}: + - Source_Build_Complete + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + name: NetCore1ESPool-Svc-Internal + image: 1es-windows-2022 + os: windows + + runAsPublic: ${{ parameters.runAsPublic }} + publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} diff --git a/eng/common/templates-official/jobs/source-build.yml b/eng/common/templates-official/jobs/source-build.yml new file mode 100644 index 00000000000000..b9a1f67b9a9ac5 --- /dev/null +++ b/eng/common/templates-official/jobs/source-build.yml @@ -0,0 +1,46 @@ +parameters: + # This template adds arcade-powered source-build to CI. A job is created for each platform, as + # well as an optional server job that completes when all platform jobs complete. + + # The name of the "join" job for all source-build platforms. If set to empty string, the job is + # not included. Existing repo pipelines can use this job depend on all source-build jobs + # completing without maintaining a separate list of every single job ID: just depend on this one + # server job. By default, not included. Recommended name if used: 'Source_Build_Complete'. + allCompletedJobId: '' + + # See /eng/common/templates-official/job/source-build.yml + jobNamePrefix: 'Source_Build' + + # This is the default platform provided by Arcade, intended for use by a managed-only repo. + defaultManagedPlatform: + name: 'Managed' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7' + + # Defines the platforms on which to run build jobs. One job is created for each platform, and the + # object in this array is sent to the job template as 'platform'. If no platforms are specified, + # one job runs on 'defaultManagedPlatform'. + platforms: [] + +jobs: + +- ${{ if ne(parameters.allCompletedJobId, '') }}: + - job: ${{ parameters.allCompletedJobId }} + displayName: Source-Build Complete + pool: server + dependsOn: + - ${{ each platform in parameters.platforms }}: + - ${{ parameters.jobNamePrefix }}_${{ platform.name }} + - ${{ if eq(length(parameters.platforms), 0) }}: + - ${{ parameters.jobNamePrefix }}_${{ parameters.defaultManagedPlatform.name }} + +- ${{ each platform in parameters.platforms }}: + - template: /eng/common/templates-official/job/source-build.yml + parameters: + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ platform }} + +- ${{ if eq(length(parameters.platforms), 0) }}: + - template: /eng/common/templates-official/job/source-build.yml + parameters: + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ parameters.defaultManagedPlatform }} diff --git a/eng/common/templates-official/post-build/common-variables.yml b/eng/common/templates-official/post-build/common-variables.yml new file mode 100644 index 00000000000000..fae340f4d20d70 --- /dev/null +++ b/eng/common/templates-official/post-build/common-variables.yml @@ -0,0 +1,26 @@ +variables: + - group: AzureDevOps-Artifact-Feeds-Pats + - group: DotNet-Blob-Feed + - group: DotNet-DotNetCli-Storage + - group: DotNet-MSRC-Storage + - group: Publish-Build-Assets + + # Whether the build is internal or not + - name: IsInternalBuild + value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} + + # Default Maestro++ API Endpoint and API Version + - name: MaestroApiEndPoint + value: "https://maestro.dot.net" + - name: MaestroApiAccessToken + value: $(MaestroAccessToken) + - name: MaestroApiVersion + value: "2020-02-20" + + - name: SourceLinkCLIVersion + value: 3.0.0 + - name: SymbolToolVersion + value: 1.0.1 + + - name: runCodesignValidationInjection + value: false diff --git a/eng/common/templates-official/post-build/post-build.yml b/eng/common/templates-official/post-build/post-build.yml new file mode 100644 index 00000000000000..fce0d0bf5cef2f --- /dev/null +++ b/eng/common/templates-official/post-build/post-build.yml @@ -0,0 +1,279 @@ +parameters: + # 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 + - 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 + - name: validateDependsOn + type: object + default: + - build + + - name: publishDependsOn + type: object + default: + - Validate + +stages: +- ${{ 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 + variables: + - template: common-variables.yml + jobs: + - job: + displayName: NuGet Validation + condition: eq( ${{ parameters.enableNugetValidation }}, 'true') + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Svc-Internal + image: 1es-windows-2022 + os: windows + + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ + + - job: + displayName: Signing Validation + condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Svc-Internal + image: 1es-windows-2022 + os: windows + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + itemPattern: | + ** + !**/Microsoft.SourceBuild.Intermediate.*.nupkg + + # 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@1 + 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) + + # Signing validation will optionally work with the buildmanifest file which is downloaded from + # Azure DevOps above. + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task SigningValidation -restore -msbuildEngine vs + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' + /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' + ${{ parameters.signingValidationAdditionalParameters }} + + - template: ../steps/publish-logs.yml + parameters: + StageLabel: 'Validation' + JobLabel: 'Signing' + + - job: + displayName: SourceLink Validation + condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Svc-Internal + image: 1es-windows-2022 + os: windows + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BlobArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) + -GHCommit $(Build.SourceVersion) + -SourcelinkCliVersion $(SourceLinkCLIVersion) + continueOnError: true + +- 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: + - job: + displayName: Publish Using Darc + timeoutInMinutes: 120 + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + name: NetCore1ESPool-Svc-Internal + image: 1es-windows-2022 + os: windows + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - 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 }}' diff --git a/eng/common/templates-official/post-build/setup-maestro-vars.yml b/eng/common/templates-official/post-build/setup-maestro-vars.yml new file mode 100644 index 00000000000000..0c87f149a4ad77 --- /dev/null +++ b/eng/common/templates-official/post-build/setup-maestro-vars.yml @@ -0,0 +1,70 @@ +parameters: + BARBuildId: '' + PromoteToChannelIds: '' + +steps: + - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Release Configs + inputs: + buildType: current + artifactName: ReleaseConfigs + checkDownloadedFiles: true + + - task: PowerShell@2 + name: setReleaseVars + displayName: Set Release Configs Vars + inputs: + targetType: inline + pwsh: true + script: | + try { + if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { + $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt + + $BarId = $Content | Select -Index 0 + $Channels = $Content | Select -Index 1 + $IsStableBuild = $Content | Select -Index 2 + + $AzureDevOpsProject = $Env:System_TeamProject + $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId + $AzureDevOpsBuildId = $Env:Build_BuildId + } + else { + $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" + + $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' + $apiHeaders.Add('Accept', 'application/json') + $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") + + $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } + + $BarId = $Env:BARBuildId + $Channels = $Env:PromoteToMaestroChannels -split "," + $Channels = $Channels -join "][" + $Channels = "[$Channels]" + + $IsStableBuild = $buildInfo.stable + $AzureDevOpsProject = $buildInfo.azureDevOpsProject + $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId + $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId + } + + Write-Host "##vso[task.setvariable variable=BARBuildId]$BarId" + Write-Host "##vso[task.setvariable variable=TargetChannels]$Channels" + Write-Host "##vso[task.setvariable variable=IsStableBuild]$IsStableBuild" + + Write-Host "##vso[task.setvariable variable=AzDOProjectName]$AzureDevOpsProject" + Write-Host "##vso[task.setvariable variable=AzDOPipelineId]$AzureDevOpsBuildDefinitionId" + Write-Host "##vso[task.setvariable variable=AzDOBuildId]$AzureDevOpsBuildId" + } + catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 + } + env: + MAESTRO_API_TOKEN: $(MaestroApiAccessToken) + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/eng/common/templates-official/post-build/trigger-subscription.yml b/eng/common/templates-official/post-build/trigger-subscription.yml new file mode 100644 index 00000000000000..da669030daf6e9 --- /dev/null +++ b/eng/common/templates-official/post-build/trigger-subscription.yml @@ -0,0 +1,13 @@ +parameters: + ChannelId: 0 + +steps: +- task: PowerShell@2 + displayName: Triggering subscriptions + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1 + arguments: -SourceRepo $(Build.Repository.Uri) + -ChannelId ${{ parameters.ChannelId }} + -MaestroApiAccessToken $(MaestroAccessToken) + -MaestroApiEndPoint $(MaestroApiEndPoint) + -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates-official/steps/add-build-to-channel.yml b/eng/common/templates-official/steps/add-build-to-channel.yml new file mode 100644 index 00000000000000..f67a210d62f3e5 --- /dev/null +++ b/eng/common/templates-official/steps/add-build-to-channel.yml @@ -0,0 +1,13 @@ +parameters: + ChannelId: 0 + +steps: +- task: PowerShell@2 + displayName: Add Build to Channel + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/add-build-to-channel.ps1 + arguments: -BuildId $(BARBuildId) + -ChannelId ${{ parameters.ChannelId }} + -MaestroApiAccessToken $(MaestroApiAccessToken) + -MaestroApiEndPoint $(MaestroApiEndPoint) + -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates-official/steps/component-governance.yml b/eng/common/templates-official/steps/component-governance.yml new file mode 100644 index 00000000000000..12527b80ea9cdc --- /dev/null +++ b/eng/common/templates-official/steps/component-governance.yml @@ -0,0 +1,10 @@ +parameters: + disableComponentGovernance: false + +steps: +- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable +- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: + - task: ComponentGovernanceComponentDetection@0 + continueOnError: true \ No newline at end of file diff --git a/eng/common/templates-official/steps/execute-codeql.yml b/eng/common/templates-official/steps/execute-codeql.yml new file mode 100644 index 00000000000000..9b4a5ffa30a788 --- /dev/null +++ b/eng/common/templates-official/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-official/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-official/steps/generate-sbom.yml b/eng/common/templates-official/steps/generate-sbom.yml new file mode 100644 index 00000000000000..7fc4f358023d66 --- /dev/null +++ b/eng/common/templates-official/steps/generate-sbom.yml @@ -0,0 +1,44 @@ +# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. +# PackageName - The name of the package this SBOM represents. +# PackageVersion - The version of the package this SBOM represents. +# ManifestDirPath - The path of the directory where the generated manifest files will be placed + +parameters: + PackageVersion: 6.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + PackageName: '.NET' + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + sbomContinueOnError: true + +steps: +- task: PowerShell@2 + displayName: Prep for SBOM generation in (Non-linux) + condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) + inputs: + filePath: ./eng/common/generate-sbom-prep.ps1 + arguments: ${{parameters.manifestDirPath}} + +# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 +- script: | + chmod +x ./eng/common/generate-sbom-prep.sh + ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} + displayName: Prep for SBOM generation in (Linux) + condition: eq(variables['Agent.Os'], 'Linux') + continueOnError: ${{ parameters.sbomContinueOnError }} + +- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + displayName: 'Generate SBOM manifest' + continueOnError: ${{ parameters.sbomContinueOnError }} + inputs: + PackageName: ${{ parameters.packageName }} + BuildDropPath: ${{ parameters.buildDropPath }} + PackageVersion: ${{ parameters.packageVersion }} + ManifestDirPath: ${{ parameters.manifestDirPath }} + +- task: 1ES.PublishPipelineArtifact@1 + displayName: Publish SBOM manifest + continueOnError: ${{parameters.sbomContinueOnError}} + inputs: + targetPath: '${{parameters.manifestDirPath}}' + artifactName: $(ARTIFACT_NAME) + diff --git a/eng/common/templates-official/steps/publish-logs.yml b/eng/common/templates-official/steps/publish-logs.yml new file mode 100644 index 00000000000000..04012fed182a1f --- /dev/null +++ b/eng/common/templates-official/steps/publish-logs.yml @@ -0,0 +1,23 @@ +parameters: + StageLabel: '' + JobLabel: '' + +steps: +- task: Powershell@2 + displayName: Prepare Binlogs to Upload + inputs: + targetType: inline + script: | + New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + continueOnError: true + condition: always() + +- task: 1ES.PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs' + PublishLocation: Container + ArtifactName: PostBuildLogs + continueOnError: true + condition: always() diff --git a/eng/common/templates-official/steps/retain-build.yml b/eng/common/templates-official/steps/retain-build.yml new file mode 100644 index 00000000000000..83d97a26a01ff9 --- /dev/null +++ b/eng/common/templates-official/steps/retain-build.yml @@ -0,0 +1,28 @@ +parameters: + # Optional azure devops PAT with build execute permissions for the build's organization, + # only needed if the build that should be retained ran on a different organization than + # the pipeline where this template is executing from + Token: '' + # Optional BuildId to retain, defaults to the current running build + BuildId: '' + # Azure devops Organization URI for the build in the https://dev.azure.com/ format. + # Defaults to the organization the current pipeline is running on + AzdoOrgUri: '$(System.CollectionUri)' + # Azure devops project for the build. Defaults to the project the current pipeline is running on + AzdoProject: '$(System.TeamProject)' + +steps: + - task: powershell@2 + inputs: + targetType: 'filePath' + filePath: eng/common/retain-build.ps1 + pwsh: true + arguments: > + -AzdoOrgUri: ${{parameters.AzdoOrgUri}} + -AzdoProject ${{parameters.AzdoProject}} + -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} + -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} + displayName: Enable permanent build retention + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + BUILD_ID: $(Build.BuildId) \ No newline at end of file diff --git a/eng/common/templates-official/steps/send-to-helix.yml b/eng/common/templates-official/steps/send-to-helix.yml new file mode 100644 index 00000000000000..cd02ae1607f3b2 --- /dev/null +++ b/eng/common/templates-official/steps/send-to-helix.yml @@ -0,0 +1,94 @@ +# Please remember to update the documentation if you make changes to these parameters! +parameters: + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixConfiguration: '' # optional -- additional property attached to a job + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects + WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true + XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects + XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects + XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner + XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set + HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting int) + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false + +steps: + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates-official/steps/source-build.yml b/eng/common/templates-official/steps/source-build.yml new file mode 100644 index 00000000000000..9eb7e51456a792 --- /dev/null +++ b/eng/common/templates-official/steps/source-build.yml @@ -0,0 +1,108 @@ +parameters: + # This template adds arcade-powered source-build to CI. + + # This is a 'steps' template, and is intended for advanced scenarios where the existing build + # infra has a careful build methodology that must be followed. For example, a repo + # (dotnet/runtime) might choose to clone the GitHub repo only once and store it as a pipeline + # artifact for all subsequent jobs to use, to reduce dependence on a strong network connection to + # GitHub. Using this steps template leaves room for that infra to be included. + + # Defines the platform on which to run the steps. See 'eng/common/templates-official/job/source-build.yml' + # for details. The entire object is described in the 'job' template for simplicity, even though + # the usage of the properties on this object is split between the 'job' and 'steps' templates. + platform: {} + +steps: +# Build. Keep it self-contained for simple reusability. (No source-build-specific job variables.) +- script: | + set -x + df -h + + # If building on the internal project, the artifact feeds variable may be available (usually only if needed) + # In that case, call the feed setup script to add internal feeds corresponding to public ones. + # 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= + 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 + $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh $(Build.SourcesDirectory)/NuGet.config $(dn-bot-dnceng-artifact-feeds-rw) + internalRestoreArgs='/p:CopyWipIntoInnerSourceBuildRepo=true' + + # The 'Copy WIP' feature of source build uses git stash to apply changes from the original repo. + # This only works if there is a username/email configured, which won't be the case in most CI runs. + git config --get user.email + if [ $? -ne 0 ]; then + git config user.email dn-bot@microsoft.com + git config user.name dn-bot + fi + fi + + # If building on the internal project, the internal storage variable may be available (usually only if needed) + # In that case, add variables to allow the download of internal runtimes if the specified versions are not found + # in the default public locations. + internalRuntimeDownloadArgs= + if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then + internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' + fi + + buildConfig=Release + # Check if AzDO substitutes in a build config from a variable, and use it if so. + if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then + buildConfig='$(_BuildConfig)' + fi + + officialBuildArgs= + if [ '${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}' = 'True' ]; then + officialBuildArgs='/p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=$(BUILD.BUILDNUMBER)' + fi + + targetRidArgs= + if [ '${{ parameters.platform.targetRID }}' != '' ]; then + targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' + fi + + runtimeOsArgs= + if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then + runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' + fi + + publishArgs= + if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then + publishArgs='--publish' + fi + + ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ + --configuration $buildConfig \ + --restore --build --pack $publishArgs -bl \ + $officialBuildArgs \ + $internalRuntimeDownloadArgs \ + $internalRestoreArgs \ + $targetRidArgs \ + $runtimeOsArgs \ + /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ + /p:ArcadeBuildFromSource=true + displayName: Build + +# Upload build logs for diagnosis. +- task: CopyFiles@2 + displayName: Prepare BuildLogs staging directory + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/*.log + **/*.binlog + artifacts/source-build/self/prebuilt-report/** + TargetFolder: '$(Build.StagingDirectory)/BuildLogs' + CleanTargetFolder: true + continueOnError: true + condition: succeededOrFailed() + +- task: 1ES.PublishPipelineArtifact@1 + displayName: Publish BuildLogs + inputs: + targetPath: '$(Build.StagingDirectory)/BuildLogs' + artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) + continueOnError: true + condition: succeededOrFailed() diff --git a/eng/common/templates-official/variables/sdl-variables.yml b/eng/common/templates-official/variables/sdl-variables.yml new file mode 100644 index 00000000000000..1a860bd0406475 --- /dev/null +++ b/eng/common/templates-official/variables/sdl-variables.yml @@ -0,0 +1,7 @@ +variables: +# 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.110.1 +- name: GuardianPackagesConfigFile + value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config \ No newline at end of file diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 69eb67849d741d..aaeb83b4dcbdd8 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -29,14 +29,6 @@ parameters: # Optional: download a list of pipeline artifacts. 'downloadArtifacts' controls build artifacts, # not pipeline artifacts, so doesn't affect the use of this parameter. pipelineArtifactNames: [] - # Optional: location and ID of the AzDO build that the build/pipeline artifacts should be - # downloaded from. By default, uses runtime expressions to decide based on the variables set by - # the 'setupMaestroVars' dependency. Overriding this parameter is necessary if SDL tasks are - # running without Maestro++/BAR involved, or to download artifacts from a specific existing build - # to iterate quickly on SDL changes. - AzDOProjectName: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - AzDOPipelineId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - AzDOBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] jobs: - job: Run_SDL @@ -51,24 +43,24 @@ jobs: value: ${{ parameters.AzDOPipelineId }} - name: AzDOBuildId value: ${{ parameters.AzDOBuildId }} - # 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.53.3 + - template: /eng/common/templates/variables/sdl-variables.yml - name: GuardianVersion value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} - - name: GuardianPackagesConfigFile - value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config pool: - # To extract archives (.tar.gz, .zip), we need access to "tar", added in Windows 10/2019. - ${{ if eq(parameters.extractArchiveArtifacts, 'false') }}: - name: Hosted VS2017 - ${{ if ne(parameters.extractArchiveArtifacts, 'false') }}: - vmImage: windows-2019 + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 steps: - checkout: self clean: true + - template: /eng/common/templates/post-build/setup-maestro-vars.yml + - ${{ if ne(parameters.downloadArtifacts, 'false')}}: - ${{ if ne(parameters.artifactNames, '') }}: - ${{ each artifactName in parameters.artifactNames }}: @@ -129,57 +121,11 @@ jobs: displayName: Extract Archive Artifacts continueOnError: ${{ parameters.sdlContinueOnError }} - - ${{ if ne(parameters.overrideGuardianVersion, '') }}: - - powershell: | - $content = Get-Content $(GuardianPackagesConfigFile) - - Write-Host "packages.config content was:`n$content" - - $content = $content.Replace('$(DefaultGuardianVersion)', '$(GuardianVersion)') - $content | Set-Content $(GuardianPackagesConfigFile) - - Write-Host "packages.config content updated to:`n$content" - displayName: Use overridden Guardian version ${{ parameters.overrideGuardianVersion }} - - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - task: NuGetCommand@2 - displayName: 'Install Guardian' - inputs: - restoreSolution: $(Build.SourcesDirectory)\eng\common\sdl\packages.config - feedsToUse: config - nugetConfigPath: $(Build.SourcesDirectory)\eng\common\sdl\NuGet.config - externalFeedCredentials: GuardianConnect - restoreDirectory: $(Build.SourcesDirectory)\.packages - - - ${{ if ne(parameters.overrideParameters, '') }}: - - powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }} - displayName: Execute SDL - continueOnError: ${{ parameters.sdlContinueOnError }} - - ${{ if eq(parameters.overrideParameters, '') }}: - - powershell: ${{ parameters.executeAllSdlToolsScript }} - -GuardianPackageName Microsoft.Guardian.Cli.$(GuardianVersion) - -NugetPackageDirectory $(Build.SourcesDirectory)\.packages - -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) - ${{ parameters.additionalParameters }} - displayName: Execute SDL - continueOnError: ${{ parameters.sdlContinueOnError }} - - - ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}: - # We want to publish the Guardian results and configuration for easy diagnosis. However, the - # '.gdn' dir is a mix of configuration, results, extracted dependencies, and Guardian default - # tooling files. Some of these files are large and aren't useful during an investigation, so - # exclude them by simply deleting them before publishing. (As of writing, there is no documented - # way to selectively exclude a dir from the pipeline artifact publish task.) - - task: DeleteFiles@1 - displayName: Delete Guardian dependencies to avoid uploading - inputs: - SourceFolder: $(Agent.BuildDirectory)/.gdn - Contents: | - c - i - condition: succeededOrFailed() - - publish: $(Agent.BuildDirectory)/.gdn - artifact: GuardianConfiguration - displayName: Publish GuardianConfiguration - condition: succeededOrFailed() + - template: /eng/common/templates/steps/execute-sdl.yml + parameters: + overrideGuardianVersion: ${{ parameters.overrideGuardianVersion }} + executeAllSdlToolsScript: ${{ parameters.executeAllSdlToolsScript }} + overrideParameters: ${{ parameters.overrideParameters }} + additionalParameters: ${{ parameters.additionalParameters }} + publishGuardianDirectoryToPipeline: ${{ parameters.publishGuardianDirectoryToPipeline }} + sdlContinueOnError: ${{ parameters.sdlContinueOnError }} 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/job/job.yml b/eng/common/templates/job/job.yml index 8669679348024c..01da2420df6069 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -24,12 +24,17 @@ parameters: enablePublishBuildAssets: false enablePublishTestResults: false enablePublishUsingPipelines: false + disableComponentGovernance: '' mergeTestResults: false testRunTitle: '' testResultsFormat: '' name: '' preSteps: [] runAsPublic: false +# Sbom related params + enableSbom: true + PackageVersion: 6.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' jobs: - job: ${{ parameters.name }} @@ -68,6 +73,10 @@ jobs: - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: - name: EnableRichCodeNavigation value: 'true' + # Retry signature validation up to three times, waiting 2 seconds between attempts. + # See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures + - name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY + value: 3,2000 - ${{ each variable in parameters.variables }}: # handle name-value variable syntax # example: @@ -76,7 +85,7 @@ jobs: - ${{ if ne(variable.name, '') }}: - name: ${{ variable.name }} value: ${{ variable.value }} - + # handle variable groups - ${{ if ne(variable.group, '') }}: - group: ${{ variable.group }} @@ -103,7 +112,7 @@ jobs: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - task: MicroBuildSigningPlugin@2 + - task: MicroBuildSigningPlugin@3 displayName: Install MicroBuild plugin inputs: signType: $(_SignType) @@ -114,7 +123,7 @@ jobs: continueOnError: ${{ parameters.continueOnError }} condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 - ${{ if or(eq(parameters.artifacts.download, 'true'), ne(parameters.artifacts.download, '')) }}: - task: DownloadPipelineArtifact@2 @@ -136,10 +145,20 @@ jobs: richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin continueOnError: true + - template: /eng/common/templates/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false + ${{ else }}: + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: MicroBuildCleanup@1 - displayName: Execute Microbuild cleanup tasks + displayName: Execute Microbuild cleanup tasks condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} env: @@ -207,7 +226,7 @@ jobs: displayName: Publish XUnit Test Results inputs: testResultsFormat: 'xUnit' - testResultsFiles: '*.xml' + testResultsFiles: '*.xml' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit mergeTestResults: ${{ parameters.mergeTestResults }} @@ -218,7 +237,7 @@ jobs: displayName: Publish TRX Test Results inputs: testResultsFormat: 'VSTest' - testResultsFiles: '*.trx' + testResultsFiles: '*.trx' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx mergeTestResults: ${{ parameters.mergeTestResults }} @@ -242,3 +261,9 @@ jobs: ArtifactName: AssetManifests continueOnError: ${{ parameters.continueOnError }} condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion}} + BuildDropPath: ${{ parameters.buildDropPath }} diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml index e8bc77d2ebbe39..5b1b77d1c74adb 100644 --- a/eng/common/templates/job/onelocbuild.yml +++ b/eng/common/templates/job/onelocbuild.yml @@ -3,15 +3,15 @@ parameters: dependsOn: '' # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool - pool: - vmImage: vs2017-win2016 - + pool: '' + CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex GithubPat: $(BotAccount-dotnet-bot-repo-PAT) SourcesDirectory: $(Build.SourcesDirectory) CreatePr: true AutoCompletePr: false + ReusePr: true UseLfLineEndings: true UseCheckedInLocProjectJson: false LanguageSet: VS_Main_Languages @@ -30,7 +30,18 @@ jobs: displayName: OneLocBuild - pool: ${{ parameters.pool }} + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 variables: - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat @@ -64,6 +75,8 @@ jobs: ${{ if eq(parameters.CreatePr, true) }}: isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + isShouldReusePrSelected: ${{ parameters.ReusePr }} packageSourceAuth: patAuth patVariable: ${{ parameters.CeapexPat }} ${{ if eq(parameters.RepoType, 'gitHub') }}: diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index fe9dfdf720cf8a..bd3d54b760c230 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -38,10 +38,6 @@ jobs: value: ${{ parameters.configuration }} - group: Publish-Build-Assets - group: AzureDevOps-Artifact-Feeds-Pats - # Skip component governance and codesign validation for SDL. These jobs - # create no content. - - name: skipComponentGovernanceDetection - value: true - name: runCodesignValidationInjection value: false @@ -55,9 +51,9 @@ jobs: checkDownloadedFiles: true condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 - task: PowerShell@2 displayName: Enable cross-org NuGet feed authentication @@ -72,13 +68,13 @@ jobs: arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + /p:MaestroApiEndpoint=https://maestro.dot.net /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:Configuration=$(_BuildConfig) /p:OfficialBuildId=$(Build.BuildNumber) condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - + - task: powershell@2 displayName: Create ReleaseConfigs Artifact inputs: @@ -87,7 +83,7 @@ jobs: Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(BARBuildId) Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value "$(DefaultChannels)" Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsStableBuild) - + - task: PublishBuildArtifacts@1 displayName: Publish ReleaseConfigs Artifact inputs: @@ -113,7 +109,7 @@ jobs: - task: PublishBuildArtifacts@1 displayName: Publish SymbolPublishingExclusionsFile Artifact - condition: eq(variables['SymbolExclusionFile'], 'true') + condition: eq(variables['SymbolExclusionFile'], 'true') inputs: PathtoPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' PublishLocation: Container @@ -122,4 +118,4 @@ jobs: - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - template: /eng/common/templates/steps/publish-logs.yml parameters: - JobLabel: 'Publish_Artifacts_Logs' + JobLabel: 'Publish_Artifacts_Logs' diff --git a/eng/common/templates/job/source-build.yml b/eng/common/templates/job/source-build.yml index 5023d36dcb3c5b..b6137f44ada138 100644 --- a/eng/common/templates/job/source-build.yml +++ b/eng/common/templates/job/source-build.yml @@ -31,11 +31,6 @@ parameters: # container and pool. platform: {} - # The default VM host AzDO pool. This should be capable of running Docker containers: almost all - # source-build builds run in Docker, including the default managed platform. - defaultContainerHostPool: - vmImage: ubuntu-20.04 - jobs: - job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} displayName: Source-Build (${{ parameters.platform.name }}) @@ -47,7 +42,15 @@ jobs: container: ${{ parameters.platform.container }} ${{ if eq(parameters.platform.pool, '') }}: - pool: ${{ parameters.defaultContainerHostPool }} + # The default VM host AzDO pool. This should be capable of running Docker containers: almost all + # source-build builds run in Docker, including the default managed platform. + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: NetCore-Svc-Public + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 ${{ if ne(parameters.platform.pool, '') }}: pool: ${{ parameters.platform.pool }} diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index e60fdbccc9ec18..b710698eb4d4f1 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -1,12 +1,12 @@ parameters: runAsPublic: false - sourceIndexPackageVersion: 1.0.1-20210614.1 + sourceIndexPackageVersion: 1.0.1-20240320.1 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] binlogPath: artifacts/log/Debug/Build.binlog pool: - vmImage: vs2017-win2016 + vmImage: windows-2019 condition: '' dependsOn: '' @@ -30,28 +30,28 @@ jobs: - ${{ preStep }} - task: UseDotNet@2 - displayName: Use .NET Core sdk 3.1 + displayName: Use .NET 8 SDK inputs: packageType: sdk - version: 3.1.x - - - script: ${{ parameters.sourceIndexBuildCommand }} - displayName: Build Repository + version: 8.0.x + installationPath: $(Agent.TempDirectory)/dotnet + workingDirectory: $(Agent.TempDirectory) - script: | - dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path .source-index/tools - dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path .source-index/tools - echo ##vso[task.prependpath]$(Build.SourcesDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools displayName: Download Tools + # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. + workingDirectory: $(Agent.TempDirectory) + + - script: ${{ parameters.sourceIndexBuildCommand }} + displayName: Build Repository - - script: BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output + - script: $(Agent.TempDirectory)/.source-index/tools/BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output displayName: Process Binlog into indexable sln - env: - DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2 - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - script: UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) + - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) displayName: Upload stage1 artifacts to source index env: BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) - DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2 diff --git a/eng/common/templates/jobs/codeql-build.yml b/eng/common/templates/jobs/codeql-build.yml new file mode 100644 index 00000000000000..54c393af440d02 --- /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.110.1 + - 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 a1f8fce96ca81d..f70826518cca2c 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -20,7 +20,7 @@ parameters: enabled: false # Optional: Include toolset dependencies in the generated graph files includeToolset: 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: [] @@ -40,7 +40,7 @@ parameters: jobs: - ${{ each job in parameters.jobs }}: - template: ../job/job.yml - parameters: + parameters: # pass along parameters ${{ each parameter in parameters }}: ${{ if ne(parameter.key, 'jobs') }}: @@ -68,7 +68,7 @@ jobs: ${{ parameter.key }}: ${{ parameter.value }} - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - + - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: - template: ../job/publish-build-assets.yml parameters: @@ -83,17 +83,15 @@ jobs: - ${{ if eq(parameters.enableSourceBuild, true) }}: - Source_Build_Complete pool: - vmImage: vs2017-win2016 + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ else }}: + name: NetCore1ESPool-Publishing-Internal + demands: ImageOverride -equals windows.vs2019.amd64 + 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: vs2017-win2016 diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml index 00aa98eb3bfd38..7c240e65447243 100644 --- a/eng/common/templates/jobs/source-build.yml +++ b/eng/common/templates/jobs/source-build.yml @@ -14,7 +14,7 @@ parameters: # This is the default platform provided by Arcade, intended for use by a managed-only repo. defaultManagedPlatform: name: 'Managed' - container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-3e800f1-20190501005343' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7' # Defines the platforms on which to run build jobs. One job is created for each platform, and the # object in this array is sent to the job template as 'platform'. If no platforms are specified, 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/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index c99fd7503767cd..fae340f4d20d70 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -4,54 +4,6 @@ variables: - group: DotNet-DotNetCli-Storage - group: DotNet-MSRC-Storage - group: Publish-Build-Assets - - # .NET Core 3.1 Dev - - name: PublicDevRelease_31_Channel_Id - value: 128 - - # .NET 5 Dev - - name: Net_5_Dev_Channel_Id - value: 131 - - # .NET Eng - Validation - - name: Net_Eng_Validation_Channel_Id - value: 9 - - # .NET Eng - Latest - - name: Net_Eng_Latest_Channel_Id - value: 2 - - # .NET 3 Eng - Validation - - name: NET_3_Eng_Validation_Channel_Id - value: 390 - - # .NET 3 Eng - - name: NetCore_3_Tools_Channel_Id - value: 344 - - # .NET Core 3.0 Internal Servicing - - name: InternalServicing_30_Channel_Id - value: 184 - - # .NET Core 3.0 Release - - name: PublicRelease_30_Channel_Id - value: 19 - - # .NET Core 3.1 Release - - name: PublicRelease_31_Channel_Id - value: 129 - - # General Testing - - name: GeneralTesting_Channel_Id - value: 529 - - # .NET Core 3.1 Blazor Features - - name: NetCore_31_Blazor_Features_Channel_Id - value: 531 - - # .NET Core Experimental - - name: NetCore_Experimental_Channel_Id - value: 562 # Whether the build is internal or not - name: IsInternalBuild @@ -59,7 +11,7 @@ variables: # Default Maestro++ API Endpoint and API Version - name: MaestroApiEndPoint - value: "https://maestro-prod.westus2.cloudapp.azure.com" + value: "https://maestro.dot.net" - name: MaestroApiAccessToken value: $(MaestroAccessToken) - name: MaestroApiVersion @@ -70,30 +22,5 @@ variables: - name: SymbolToolVersion value: 1.0.1 - # Feed Configurations - # These should include the suffix "/index.json" - - # Default locations for Installers and checksums - # Public Locations - - name: ChecksumsBlobFeedUrl - value: https://dotnetclichecksums.blob.core.windows.net/dotnet/index.json - - name: InstallersBlobFeedUrl - value: https://dotnetcli.blob.core.windows.net/dotnet/index.json - - # Private Locations - - name: InternalChecksumsBlobFeedUrl - value: https://dotnetclichecksumsmsrc.blob.core.windows.net/dotnet/index.json - - name: InternalChecksumsBlobFeedKey - value: $(dotnetclichecksumsmsrc-storage-key) - - - name: InternalInstallersBlobFeedUrl - value: https://dotnetclimsrc.blob.core.windows.net/dotnet/index.json - - name: InternalInstallersBlobFeedKey - value: $(dotnetclimsrc-access-key) - - # Skip component governance and codesign validation for SDL. These jobs - # create no content. - - name: skipComponentGovernanceDetection - value: true - name: runCodesignValidationInjection value: false diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 4f79cf0f33703f..5a0bb8d96d2047 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -1,113 +1,114 @@ 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 variables: - template: common-variables.yml jobs: - - template: setup-maestro-vars.yml - parameters: - 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 condition: eq( ${{ parameters.enableNugetValidation }}, 'true') pool: - vmImage: 'windows-2019' - variables: - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + - task: DownloadBuildArtifacts@0 displayName: Download Package Artifacts inputs: @@ -123,24 +124,27 @@ stages: displayName: Validate inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 - arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ - -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ - job: displayName: Signing Validation - dependsOn: setupMaestroVars condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) - variables: - - template: common-variables.yml - - 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' + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + - task: DownloadBuildArtifacts@0 displayName: Download Package Artifacts inputs: @@ -158,7 +162,7 @@ stages: # 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 + - task: NuGetAuthenticate@1 displayName: 'Authenticate to AzDO Feeds' - task: PowerShell@2 @@ -185,19 +189,22 @@ stages: - job: displayName: SourceLink Validation - dependsOn: setupMaestroVars condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') - variables: - - template: common-variables.yml - - 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' + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + - task: DownloadBuildArtifacts@0 displayName: Download Blob Artifacts inputs: @@ -213,9 +220,9 @@ stages: displayName: Validate inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -ExtractPath $(Agent.BuildDirectory)/Extract/ - -GHRepoName $(Build.Repository.Name) + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) -GHCommit $(Build.SourceVersion) -SourcelinkCliVersion $(SourceLinkCLIVersion) continueOnError: true @@ -223,367 +230,46 @@ stages: - template: /eng/common/templates/job/execute-sdl.yml parameters: enable: ${{ parameters.SDLValidationParameters.enable }} - dependsOn: setupMaestroVars additionalParameters: ${{ parameters.SDLValidationParameters.params }} continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} 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 - 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' +- 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: + - job: + displayName: Publish Using Darc + timeoutInMinutes: 120 + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: VSEngSS-MicroBuild2022-1ES + demands: Cmd + # If it's not devdiv, it's dnceng + ${{ else }}: + name: NetCore1ESPool-Publishing-Internal + demands: ImageOverride -equals windows.vs2019.amd64 + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - 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 }}' diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 4a22b2e6f6de79..0c87f149a4ad77 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -2,77 +2,69 @@ parameters: BARBuildId: '' PromoteToChannelIds: '' -jobs: -- job: setupMaestroVars - displayName: Setup Maestro Vars - variables: - - template: common-variables.yml - pool: - vmImage: 'windows-2019' - steps: - - checkout: none - - - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Release Configs - inputs: - buildType: current - artifactName: ReleaseConfigs - checkDownloadedFiles: true - - - task: PowerShell@2 - name: setReleaseVars - displayName: Set Release Configs Vars +steps: + - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Release Configs inputs: - targetType: inline - script: | - try { - if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { - $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt + buildType: current + artifactName: ReleaseConfigs + checkDownloadedFiles: true - $BarId = $Content | Select -Index 0 - $Channels = $Content | Select -Index 1 - $IsStableBuild = $Content | Select -Index 2 + - task: PowerShell@2 + name: setReleaseVars + displayName: Set Release Configs Vars + inputs: + targetType: inline + pwsh: true + script: | + try { + if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { + $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt - $AzureDevOpsProject = $Env:System_TeamProject - $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId - $AzureDevOpsBuildId = $Env:Build_BuildId - } - else { - $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" + $BarId = $Content | Select -Index 0 + $Channels = $Content | Select -Index 1 + $IsStableBuild = $Content | Select -Index 2 - $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $apiHeaders.Add('Accept', 'application/json') - $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - - $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - - $BarId = $Env:BARBuildId - $Channels = $Env:PromoteToMaestroChannels -split "," - $Channels = $Channels -join "][" - $Channels = "[$Channels]" + $AzureDevOpsProject = $Env:System_TeamProject + $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId + $AzureDevOpsBuildId = $Env:Build_BuildId + } + else { + $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" - $IsStableBuild = $buildInfo.stable - $AzureDevOpsProject = $buildInfo.azureDevOpsProject - $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId - $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId - } + $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' + $apiHeaders.Add('Accept', 'application/json') + $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - Write-Host "##vso[task.setvariable variable=BARBuildId;isOutput=true]$BarId" - Write-Host "##vso[task.setvariable variable=TargetChannels;isOutput=true]$Channels" - Write-Host "##vso[task.setvariable variable=IsStableBuild;isOutput=true]$IsStableBuild" + $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } + + $BarId = $Env:BARBuildId + $Channels = $Env:PromoteToMaestroChannels -split "," + $Channels = $Channels -join "][" + $Channels = "[$Channels]" - Write-Host "##vso[task.setvariable variable=AzDOProjectName;isOutput=true]$AzureDevOpsProject" - Write-Host "##vso[task.setvariable variable=AzDOPipelineId;isOutput=true]$AzureDevOpsBuildDefinitionId" - Write-Host "##vso[task.setvariable variable=AzDOBuildId;isOutput=true]$AzureDevOpsBuildId" + $IsStableBuild = $buildInfo.stable + $AzureDevOpsProject = $buildInfo.azureDevOpsProject + $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId + $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId } - catch { - Write-Host $_ - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - exit 1 - } - env: - MAESTRO_API_TOKEN: $(MaestroApiAccessToken) - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} + + Write-Host "##vso[task.setvariable variable=BARBuildId]$BarId" + Write-Host "##vso[task.setvariable variable=TargetChannels]$Channels" + Write-Host "##vso[task.setvariable variable=IsStableBuild]$IsStableBuild" + + Write-Host "##vso[task.setvariable variable=AzDOProjectName]$AzureDevOpsProject" + Write-Host "##vso[task.setvariable variable=AzDOPipelineId]$AzureDevOpsBuildDefinitionId" + Write-Host "##vso[task.setvariable variable=AzDOBuildId]$AzureDevOpsBuildId" + } + catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 + } + env: + MAESTRO_API_TOKEN: $(MaestroApiAccessToken) + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/eng/common/templates/steps/component-governance.yml b/eng/common/templates/steps/component-governance.yml new file mode 100644 index 00000000000000..12527b80ea9cdc --- /dev/null +++ b/eng/common/templates/steps/component-governance.yml @@ -0,0 +1,10 @@ +parameters: + disableComponentGovernance: false + +steps: +- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable +- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: + - task: ComponentGovernanceComponentDetection@0 + continueOnError: true \ 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/execute-sdl.yml b/eng/common/templates/steps/execute-sdl.yml new file mode 100644 index 00000000000000..9dd5709f66dc71 --- /dev/null +++ b/eng/common/templates/steps/execute-sdl.yml @@ -0,0 +1,88 @@ +parameters: + overrideGuardianVersion: '' + executeAllSdlToolsScript: '' + overrideParameters: '' + additionalParameters: '' + publishGuardianDirectoryToPipeline: false + sdlContinueOnError: false + condition: '' + +steps: +- task: NuGetAuthenticate@1 + inputs: + nuGetServiceConnections: GuardianConnect + +- task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + +- ${{ if ne(parameters.overrideGuardianVersion, '') }}: + - pwsh: | + Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl + . .\sdl.ps1 + $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts -Version ${{ parameters.overrideGuardianVersion }} + Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" + displayName: Install Guardian (Overridden) + +- ${{ if eq(parameters.overrideGuardianVersion, '') }}: + - pwsh: | + Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl + . .\sdl.ps1 + $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts + Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" + displayName: Install Guardian + +- ${{ if ne(parameters.overrideParameters, '') }}: + - powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }} + displayName: Execute SDL + continueOnError: ${{ parameters.sdlContinueOnError }} + condition: ${{ parameters.condition }} + +- ${{ if eq(parameters.overrideParameters, '') }}: + - powershell: ${{ parameters.executeAllSdlToolsScript }} + -GuardianCliLocation $(GuardianCliLocation) + -NugetPackageDirectory $(Build.SourcesDirectory)\.packages + -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) + ${{ parameters.additionalParameters }} + displayName: Execute SDL + continueOnError: ${{ parameters.sdlContinueOnError }} + condition: ${{ parameters.condition }} + +- ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}: + # We want to publish the Guardian results and configuration for easy diagnosis. However, the + # '.gdn' dir is a mix of configuration, results, extracted dependencies, and Guardian default + # tooling files. Some of these files are large and aren't useful during an investigation, so + # exclude them by simply deleting them before publishing. (As of writing, there is no documented + # way to selectively exclude a dir from the pipeline artifact publish task.) + - task: DeleteFiles@1 + displayName: Delete Guardian dependencies to avoid uploading + inputs: + SourceFolder: $(Agent.BuildDirectory)/.gdn + Contents: | + c + i + condition: succeededOrFailed() + + - publish: $(Agent.BuildDirectory)/.gdn + artifact: GuardianConfiguration + displayName: Publish GuardianConfiguration + condition: succeededOrFailed() + + # Publish the SARIF files in a container named CodeAnalysisLogs to enable integration + # with the "SARIF SAST Scans Tab" Azure DevOps extension + - task: CopyFiles@2 + displayName: Copy SARIF files + inputs: + flattenFolders: true + sourceFolder: $(Agent.BuildDirectory)/.gdn/rc/ + contents: '**/*.sarif' + targetFolder: $(Build.SourcesDirectory)/CodeAnalysisLogs + condition: succeededOrFailed() + + # Use PublishBuildArtifacts because the SARIF extension only checks this case + # see microsoft/sarif-azuredevops-extension#4 + - task: PublishBuildArtifacts@1 + displayName: Publish SARIF files to CodeAnalysisLogs container + inputs: + pathToPublish: $(Build.SourcesDirectory)/CodeAnalysisLogs + artifactName: CodeAnalysisLogs + condition: succeededOrFailed() \ No newline at end of file diff --git a/eng/common/templates/steps/generate-sbom.yml b/eng/common/templates/steps/generate-sbom.yml new file mode 100644 index 00000000000000..f4d7937f3798c7 --- /dev/null +++ b/eng/common/templates/steps/generate-sbom.yml @@ -0,0 +1,44 @@ +# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. +# PackageName - The name of the package this SBOM represents. +# PackageVersion - The version of the package this SBOM represents. +# ManifestDirPath - The path of the directory where the generated manifest files will be placed + +parameters: + PackageVersion: 6.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + PackageName: '.NET' + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + sbomContinueOnError: true + +steps: +- task: PowerShell@2 + displayName: Prep for SBOM generation in (Non-linux) + condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) + inputs: + filePath: ./eng/common/generate-sbom-prep.ps1 + arguments: ${{parameters.manifestDirPath}} + +# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 +- script: | + chmod +x ./eng/common/generate-sbom-prep.sh + ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} + displayName: Prep for SBOM generation in (Linux) + condition: eq(variables['Agent.Os'], 'Linux') + continueOnError: ${{ parameters.sbomContinueOnError }} + +- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + displayName: 'Generate SBOM manifest' + continueOnError: ${{ parameters.sbomContinueOnError }} + inputs: + PackageName: ${{ parameters.packageName }} + BuildDropPath: ${{ parameters.buildDropPath }} + PackageVersion: ${{ parameters.packageVersion }} + ManifestDirPath: ${{ parameters.manifestDirPath }} + +- task: PublishPipelineArtifact@1 + displayName: Publish SBOM manifest + continueOnError: ${{parameters.sbomContinueOnError}} + inputs: + targetPath: '${{parameters.manifestDirPath}}' + artifactName: $(ARTIFACT_NAME) + diff --git a/eng/common/templates/steps/retain-build.yml b/eng/common/templates/steps/retain-build.yml new file mode 100644 index 00000000000000..83d97a26a01ff9 --- /dev/null +++ b/eng/common/templates/steps/retain-build.yml @@ -0,0 +1,28 @@ +parameters: + # Optional azure devops PAT with build execute permissions for the build's organization, + # only needed if the build that should be retained ran on a different organization than + # the pipeline where this template is executing from + Token: '' + # Optional BuildId to retain, defaults to the current running build + BuildId: '' + # Azure devops Organization URI for the build in the https://dev.azure.com/ format. + # Defaults to the organization the current pipeline is running on + AzdoOrgUri: '$(System.CollectionUri)' + # Azure devops project for the build. Defaults to the project the current pipeline is running on + AzdoProject: '$(System.TeamProject)' + +steps: + - task: powershell@2 + inputs: + targetType: 'filePath' + filePath: eng/common/retain-build.ps1 + pwsh: true + arguments: > + -AzdoOrgUri: ${{parameters.AzdoOrgUri}} + -AzdoProject ${{parameters.AzdoProject}} + -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} + -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} + displayName: Enable permanent build retention + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + BUILD_ID: $(Build.BuildId) \ 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..b5b3e5aeb3b915 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -43,8 +43,8 @@ steps: # In that case, add variables to allow the download of internal runtimes if the specified versions are not found # in the default public locations. internalRuntimeDownloadArgs= - if [ '$(dotnetclimsrc-read-sas-token-base64)' != '$''(dotnetclimsrc-read-sas-token-base64)' ]; then - internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetclimsrc.blob.core.windows.net/dotnet /p:DotNetRuntimeSourceFeedKey=$(dotnetclimsrc-read-sas-token-base64) --runtimesourcefeed https://dotnetclimsrc.blob.core.windows.net/dotnet --runtimesourcefeedkey $(dotnetclimsrc-read-sas-token-base64)' + if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then + internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' fi buildConfig=Release @@ -63,6 +63,11 @@ steps: targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' fi + runtimeOsArgs= + if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then + runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' + fi + publishArgs= if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then publishArgs='--publish' @@ -75,6 +80,7 @@ steps: $internalRuntimeDownloadArgs \ $internalRestoreArgs \ $targetRidArgs \ + $runtimeOsArgs \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ /p:ArcadeBuildFromSource=true displayName: Build diff --git a/eng/common/templates/variables/sdl-variables.yml b/eng/common/templates/variables/sdl-variables.yml new file mode 100644 index 00000000000000..1a860bd0406475 --- /dev/null +++ b/eng/common/templates/variables/sdl-variables.yml @@ -0,0 +1,7 @@ +variables: +# 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.110.1 +- name: GuardianPackagesConfigFile + value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config \ No newline at end of file diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 5d526c74d518ce..81d7b0355e3821 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -298,31 +298,44 @@ function InstallDotNet([string] $dotnetRoot, if ($skipNonVersionedFiles) { $installParameters.SkipNonVersionedFiles = $skipNonVersionedFiles } if ($noPath) { $installParameters.NoPath = $True } - try { - & $installScript @installParameters - } - catch { - if ($runtimeSourceFeed -or $runtimeSourceFeedKey) { - Write-Host "Failed to install dotnet from public location. Trying from '$runtimeSourceFeed'" - if ($runtimeSourceFeed) { $installParameters.AzureFeed = $runtimeSourceFeed } + $variations = @() + $variations += @($installParameters) - if ($runtimeSourceFeedKey) { - $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) - $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) - $installParameters.FeedCredential = $decodedString - } + $dotnetBuilds = $installParameters.Clone() + $dotnetbuilds.AzureFeed = "https://dotnetbuilds.azureedge.net/public" + $variations += @($dotnetBuilds) - try { - & $installScript @installParameters - } - catch { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from custom location '$runtimeSourceFeed'." - ExitWithExitCode 1 - } + if ($runtimeSourceFeed) { + $runtimeSource = $installParameters.Clone() + $runtimeSource.AzureFeed = $runtimeSourceFeed + if ($runtimeSourceFeedKey) { + $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) + $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) + $runtimeSource.FeedCredential = $decodedString + } + $variations += @($runtimeSource) + } + + $installSuccess = $false + foreach ($variation in $variations) { + if ($variation | Get-Member AzureFeed) { + $location = $variation.AzureFeed } else { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from public location." - ExitWithExitCode 1 + $location = "public location"; + } + Write-Host "Attempting to install dotnet from $location." + try { + & $installScript @variation + $installSuccess = $true + break } + catch { + Write-Host "Failed to install dotnet from $location." + } + } + if (-not $installSuccess) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from any of the specified locations." + ExitWithExitCode 1 } } @@ -622,6 +635,10 @@ function InitializeNativeTools() { InstallDirectory = "$ToolsDir" } } + if ($env:NativeToolsOnMachine) { + Write-Host "Variable NativeToolsOnMachine detected, enabling native tool path promotion..." + $nativeArgs += @{ PathPromotion = $true } + } & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs } } @@ -706,6 +723,8 @@ function MSBuild() { Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20' } + Enable-Nuget-EnhancedRetry + $toolsetBuildProject = InitializeToolset $basePath = Split-Path -parent $toolsetBuildProject $possiblePaths = @( @@ -714,6 +733,8 @@ function MSBuild() { (Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll')), (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.ArcadeLogging.dll')), (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.Arcade.Sdk.dll')) + (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.ArcadeLogging.dll')), + (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.Arcade.Sdk.dll')) ) $selectedPath = $null foreach ($path in $possiblePaths) { @@ -750,6 +771,8 @@ function MSBuild-Core() { } } + Enable-Nuget-EnhancedRetry + $buildTool = InitializeBuildTool $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" @@ -872,3 +895,18 @@ if (!$disableConfigureToolsetImport) { } } } + +# +# If $ci flag is set, turn on (and log that we did) special environment variables for improved Nuget client retry logic. +# +function Enable-Nuget-EnhancedRetry() { + if ($ci) { + Write-Host "Setting NUGET enhanced retry environment variables" + $env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true' + $env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6 + $env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 + Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true' + Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6' + Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' + } +} diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 828119be411b3d..e555c34269f6e8 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -188,28 +188,29 @@ function InstallDotNet { GetDotNetInstallScript "$root" local install_script=$_GetDotNetInstallScript - local archArg='' + local installParameters=(--version $version --install-dir "$root") + if [[ -n "${3:-}" ]] && [ "$3" != 'unset' ]; then - archArg="--architecture $3" + installParameters+=(--architecture $3) fi - local runtimeArg='' if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then - runtimeArg="--runtime $4" + installParameters+=(--runtime $4) fi - local skipNonVersionedFilesArg="" if [[ "$#" -ge "5" ]] && [[ "$5" != 'false' ]]; then - skipNonVersionedFilesArg="--skip-non-versioned-files" + installParameters+=(--skip-non-versioned-files) fi - bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg || { - local exit_code=$? - echo "Failed to install dotnet SDK from public location (exit code '$exit_code')." - local runtimeSourceFeed='' - if [[ -n "${6:-}" ]]; then - runtimeSourceFeed="--azure-feed $6" - fi + local variations=() # list of variable names with parameter arrays in them + + local public_location=("${installParameters[@]}") + variations+=(public_location) - local runtimeSourceFeedKey='' + local dotnetbuilds=("${installParameters[@]}" --azure-feed "https://dotnetbuilds.azureedge.net/public") + variations+=(dotnetbuilds) + + if [[ -n "${6:-}" ]]; then + variations+=(private_feed) + local private_feed=("${installParameters[@]}" --azure-feed $6) if [[ -n "${7:-}" ]]; then # The 'base64' binary on alpine uses '-d' and doesn't support '--decode' # '-d'. To work around this, do a simple detection and switch the parameter @@ -219,22 +220,27 @@ function InstallDotNet { decodeArg="-d" fi decodedFeedKey=`echo $7 | base64 $decodeArg` - runtimeSourceFeedKey="--feed-credential $decodedFeedKey" + private_feed+=(--feed-credential $decodedFeedKey) fi + fi - if [[ -n "$runtimeSourceFeed" || -n "$runtimeSourceFeedKey" ]]; then - bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg $runtimeSourceFeed $runtimeSourceFeedKey || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from custom location '$runtimeSourceFeed' (exit code '$exit_code')." - ExitWithExitCode $exit_code - } - else - if [[ $exit_code != 0 ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from public location (exit code '$exit_code')." - fi - ExitWithExitCode $exit_code + local installSuccess=0 + for variationName in "${variations[@]}"; do + local name="$variationName[@]" + local variation=("${!name}") + echo "Attempting to install dotnet from $variationName." + bash "$install_script" "${variation[@]}" && installSuccess=1 + if [[ "$installSuccess" -eq 1 ]]; then + break fi - } + + echo "Failed to install dotnet from $variationName." + done + + if [[ "$installSuccess" -eq 0 ]]; then + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from any of the specified locations." + ExitWithExitCode 1 + fi } function with_retries { @@ -410,6 +416,13 @@ function MSBuild { export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" + + export NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY=true + export NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT=6 + export NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS=1000 + Write-PipelineSetVariable -name "NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY" -value "true" + Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT" -value "6" + Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS" -value "1000" fi local toolset_dir="${_InitializeToolset%/*}" @@ -420,6 +433,8 @@ function MSBuild { possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" ) possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.ArcadeLogging.dll" ) possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" ) + possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" ) + possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" ) for path in "${possiblePaths[@]}"; do if [[ -f $path ]]; then selectedPath=$path diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index a29dfdf78aae49..b7d7c33a010b80 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -1,49 +1,51 @@ -#!/usr/bin/env bash +#!/bin/sh + +set -e # This is a simple script primarily used for CI to install necessary dependencies # -# For CI typical usage is -# -# ./install-native-dependencies.sh azDO -# -# For developer use it is not recommended to include the azDO final argument as that -# makes installation and configuration setting only required for azDO -# -# So simple developer usage would currently be +# Usage: # # ./install-native-dependencies.sh -if [ "$1" = "Linux" ]; then - sudo apt update - if [ "$?" != "0" ]; then - exit 1; - fi - sudo apt install cmake llvm-3.9 clang-3.9 lldb-3.9 liblldb-3.9-dev libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libcurl4-openssl-dev libssl-dev libkrb5-dev libnuma-dev build-essential - if [ "$?" != "0" ]; then - exit 1; - fi -elif [ "$1" = "MacCatalyst" ] || [ "$1" = "OSX" ] || [ "$1" = "tvOS" ] || [ "$1" = "iOS" ]; then - engdir=$(dirname "${BASH_SOURCE[0]}") - - echo "Installed xcode version: `xcode-select -p`" - - if [ "$3" = "azDO" ]; then - # workaround for old osx images on hosted agents - # piped in case we get an agent without these values installed - if ! brew_output="$(brew uninstall openssl@1.0.2t 2>&1 >/dev/null)"; then - echo "didn't uninstall openssl@1.0.2t" - else - echo "succesfully uninstalled openssl@1.0.2t" - fi - fi - - brew update --preinstall - brew bundle --no-upgrade --no-lock --file "${engdir}/Brewfile" - if [ "$?" != "0" ]; then - exit 1; - fi -else - echo "Must pass \"Linux\", \"tvOS\", \"iOS\" or \"OSX\" as first argument." - exit 1 +os="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + +if [ -z "$os" ]; then + . "$(dirname "$0")"/native/init-os-and-arch.sh + os="$(echo "$os" | tr "[:upper:]" "[:lower:]")" fi +case "$os" in + linux) + if [ -e /etc/os-release ]; then + . /etc/os-release + fi + + if [ "$ID" != "debian" ] && [ "$ID_LIKE" != "debian" ]; then + echo "Unsupported distro. distro: $ID" + exit 1 + fi + + apt update + + apt install -y build-essential gettext locales cmake llvm clang lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \ + libssl-dev libkrb5-dev libnuma-dev zlib1g-dev + + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 + ;; + + osx|mac*|ios*|tvos*) + echo "Installed xcode version: $(xcode-select -p)" + + export HOMEBREW_NO_INSTALL_CLEANUP=1 + export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + # Skip brew update for now, see https://github.com/actions/setup-python/issues/577 + # brew update --preinstall + brew bundle --no-upgrade --no-lock --file "$(dirname "$0")/Brewfile" + ;; + + *) + echo "Unsupported platform. OS: $os" + exit 1 + ;; +esac diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index d62f4bcd438d8c..0834d63b159424 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -193,6 +193,8 @@ - $(RuntimeIdGraphDefinitionFile) + + $([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'Microsoft.NETCore.Platforms', 'runtime.json')) + $([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json')) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index e07b5e0048cf14..85a6f50ec66680 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -27,7 +27,7 @@ isMSBuildOnNETCoreSupported() return fi - if [[ ( "$__HostOS" == "Linux" ) && ( "$__HostArch" == "x64" || "$__HostArch" == "arm" || "$__HostArch" == "armel" || "$__HostArch" == "arm64" ) ]]; then + if [[ ( "$__HostOS" == "Linux" ) && ( "$__HostArch" == "x64" || "$__HostArch" == "arm" || "$__HostArch" == "armel" || "$__HostArch" == "arm64" || "$__HostArch" == "s390x" ) ]]; then __IsMSBuildOnNETCoreSupported=1 elif [[ ( "$__HostOS" == "OSX" || "$__HostOS" == "FreeBSD" ) && "$__HostArch" == "x64" ]]; then __IsMSBuildOnNETCoreSupported=1 @@ -230,7 +230,7 @@ usage() echo "" echo "Common Options:" echo "" - echo "BuildArch can be: -arm, -armel, -arm64, x64, x86, -wasm" + echo "BuildArch can be: -arm, -armel, -arm64, -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)" @@ -246,6 +246,7 @@ usage() echo "-msbuildonunsupportedplatform: build managed binaries even if distro is not officially supported." echo "-ninja: target ninja instead of GNU make" echo "-numproc: set the number of build processes." + echo "-outputrid: optional argument that overrides the target rid name." echo "-portablebuild: pass -portablebuild=false to force a non-portable build." echo "-skipconfigure: skip build configuration." echo "-skipgenerateversion: disable version generation even if MSBuild is supported." @@ -268,6 +269,7 @@ __HostArch=$arch __TargetOS=$os __HostOS=$os __BuildOS=$os +__OutputRid='' __msbuildonunsupportedplatform=0 @@ -443,6 +445,16 @@ while :; do __BuildArch=wasm ;; + outputrid|-outputrid) + if [[ -n "$2" ]]; then + __OutputRid="$2" + shift + else + echo "ERROR: 'outputrid' requires a non-empty option argument" + exit 1 + fi + ;; + os|-os) if [[ -n "$2" ]]; then __TargetOS="$2" @@ -508,5 +520,8 @@ fi # init the target distro name initTargetDistroRid +if [ -z "$__OutputRid" ]; then + __OutputRid="$(echo $__DistroRid | tr '[:upper:]' '[:lower:]')" +fi # Init if MSBuild for .NET Core is supported for this platform isMSBuildOnNETCoreSupported diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 496384c35a70ea..88b3cd93745ca7 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -68,12 +68,14 @@ if (MSVC) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /PDBCOMPRESS") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUGTYPE:CV,FIXUP") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4197,4013,4254,4070,4221") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,${WINDOWS_SUBSYSTEM_VERSION}") set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUGTYPE:CV,FIXUP") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /PDBCOMPRESS") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1572864") @@ -338,15 +340,17 @@ if (CLR_CMAKE_HOST_UNIX) #These seem to indicate real issues add_compile_options($<$:-Wno-invalid-offsetof>) - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wno-unused-but-set-variable) + + if (CMAKE_C_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wno-unknown-warning-option) + # The -ferror-limit is helpful during the porting, it makes sure the compiler doesn't stop # after hitting just about 20 errors. add_compile_options(-ferror-limit=4096) # Disabled warnings add_compile_options(-Wno-unused-private-field) - # Explicit constructor calls are not supported by clang (this->ClassName::ClassName()) - add_compile_options(-Wno-microsoft) # There are constants of type BOOL used in a condition. But BOOL is defined as int # and so the compiler thinks that there is a mistake. add_compile_options(-Wno-constant-logical-operand) @@ -361,8 +365,21 @@ if (CLR_CMAKE_HOST_UNIX) # to a struct or a class that has virtual members or a base class. In that case, clang # may not generate the same object layout as MSVC. add_compile_options(-Wno-incompatible-ms-struct) + + add_compile_options(-Wno-reserved-identifier) + + # clang 16.0 introduced buffer hardening https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734 + # which we are not conforming to yet. + add_compile_options(-Wno-unsafe-buffer-usage) + + # other clang 16.0 suppressions + add_compile_options(-Wno-single-bit-bitfield-constant-conversion) + add_compile_options(-Wno-cast-function-type-strict) + add_compile_options(-Wno-incompatible-function-pointer-types-strict) + + # clang 18.1 supressions + add_compile_options(-Wno-switch-default) else() - add_compile_options(-Wno-unused-but-set-variable) add_compile_options(-Wno-unknown-pragmas) add_compile_options(-Wno-uninitialized) add_compile_options(-Wno-strict-aliasing) @@ -415,7 +432,7 @@ if (CLR_CMAKE_HOST_UNIX) set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") add_compile_options(-arch arm64) elseif(CLR_CMAKE_HOST_ARCH_AMD64) - set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13") + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") add_compile_options(-arch x86_64) else() clr_unknown_arch() @@ -573,7 +590,7 @@ if (MSVC) set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /guard:ehcont") add_linker_flag(/guard:ehcont) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /CETCOMPAT") - endif (CLR_CMAKE_HOST_ARCH_AMD64) + endif (CLR_CMAKE_HOST_ARCH_AMD64 AND NOT CLR_CMAKE_RUNTIME_MONO) # Statically linked CRT (libcmt[d].lib, libvcruntime[d].lib and libucrt[d].lib) by default. This is done to avoid # linking in VCRUNTIME140.DLL for a simplified xcopy experience by reducing the dependency on VC REDIST. @@ -665,6 +682,13 @@ if (CLR_CMAKE_HOST_WIN32) endif() else (CLR_CMAKE_HOST_WIN32) + # This is a workaround for upstream issue: https://gitlab.kitware.com/cmake/cmake/-/issues/22995. + # + # In Clang.cmake, the decision to use single or double hyphen for target and gcc-toolchain + # is made based on CMAKE_${LANG}_COMPILER_VERSION, but CMAKE_ASM_COMPILER_VERSION is empty + # so it picks up single hyphen options, which new clang versions don't recognize. + set (CMAKE_ASM_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}") + enable_language(ASM) endif(CLR_CMAKE_HOST_WIN32) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 5194317720045f..99556d80c052f9 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -2,7 +2,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/functions.cmake) # If set, indicates that this is not an officially supported release # Keep in sync with IsPrerelease in Directory.Build.props -set(PRERELEASE 1) +set(PRERELEASE 0) #---------------------------------------- # Detect and set platform variable names @@ -36,7 +36,7 @@ if(CLR_CMAKE_HOST_OS STREQUAL Linux) # "amd64" string. Accept either of the two here. if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64) set(CLR_CMAKE_HOST_UNIX_AMD64 1) - elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l) + elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv8l) set(CLR_CMAKE_HOST_UNIX_ARM 1) set(CLR_CMAKE_HOST_UNIX_ARMV7L 1) elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a) diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake index 136cd67925d0cb..2113153aac0b8c 100644 --- a/eng/native/configuretools.cmake +++ b/eng/native/configuretools.cmake @@ -53,7 +53,8 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER) if(CLR_CMAKE_TARGET_ANDROID) set(TOOLSET_PREFIX ${ANDROID_TOOLCHAIN_PREFIX}) elseif(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR - CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL s390x)) + CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL s390x OR + CMAKE_SYSTEM_PROCESSOR STREQUAL armv8l)) set(TOOLSET_PREFIX "${TOOLCHAIN}-") else() set(TOOLSET_PREFIX "") diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 0d03cc3d2d46eb..2b97b1f0fa46f3 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -89,6 +89,10 @@ function(find_unwind_libs UnwindLibs) find_library(UNWIND_ARCH NAMES unwind-x86_64) endif() + if(CLR_CMAKE_HOST_ARCH_S390X) + find_library(UNWIND_ARCH NAMES unwind-s390x) + endif() + if(NOT UNWIND_ARCH STREQUAL UNWIND_ARCH-NOTFOUND) set(UNWIND_LIBS ${UNWIND_ARCH}) endif() @@ -114,7 +118,8 @@ endfunction(find_unwind_libs) function(convert_to_absolute_path RetSources) set(Sources ${ARGN}) foreach(Source IN LISTS Sources) - list(APPEND AbsolutePathSources ${CMAKE_CURRENT_SOURCE_DIR}/${Source}) + get_filename_component(AbsolutePathSource ${Source} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + list(APPEND AbsolutePathSources ${AbsolutePathSource}) endforeach() set(${RetSources} ${AbsolutePathSources} PARENT_SCOPE) endfunction(convert_to_absolute_path) @@ -311,11 +316,21 @@ function(strip_symbols targetName outputFilename) set(strip_command) endif () + execute_process( + COMMAND ${DSYMUTIL} --help + OUTPUT_VARIABLE DSYMUTIL_HELP_OUTPUT + ) + + set(DSYMUTIL_OPTS "--flat") + if ("${DSYMUTIL_HELP_OUTPUT}" MATCHES "--minimize") + list(APPEND DSYMUTIL_OPTS "--minimize") + endif () + add_custom_command( TARGET ${targetName} POST_BUILD VERBATIM - COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file} + COMMAND ${DSYMUTIL} ${DSYMUTIL_OPTS} ${strip_source_file} COMMAND ${strip_command} COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}" ) diff --git a/eng/native/init-compiler.sh b/eng/native/init-compiler.sh index 567d18da4747a1..04761fe1b482f9 100755 --- a/eng/native/init-compiler.sh +++ b/eng/native/init-compiler.sh @@ -46,8 +46,8 @@ if [[ -z "$CLR_CC" ]]; then # Set default versions if [[ -z "$majorVersion" ]]; then # note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero. - if [[ "$compiler" == "clang" ]]; then versions=( 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) - elif [[ "$compiler" == "gcc" ]]; then versions=( 11 10 9 8 7 6 5 4.9 ); fi + if [[ "$compiler" == "clang" ]]; then versions=( 18 17 16 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) + elif [[ "$compiler" == "gcc" ]]; then versions=( 12 11 10 9 8 7 6 5 4.9 ); fi for version in "${versions[@]}"; do parts=(${version//./ }) diff --git a/eng/native/init-distro-rid.sh b/eng/native/init-distro-rid.sh index f71aa8640b1606..24d548993268ed 100644 --- a/eng/native/init-distro-rid.sh +++ b/eng/native/init-distro-rid.sh @@ -41,7 +41,7 @@ initNonPortableDistroRid() # We have forced __PortableBuild=0. This is because -portablebuld # has been passed as false. if (( isPortable == 0 )); then - if [ "${ID}" = "rhel" ]; then + if [[ "${ID}" == "rhel" || "${ID}" == "rocky" || "${ID}" == "alpine" ]]; then # remove the last version digit VERSION_ID="${VERSION_ID%.*}" fi diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh index fc4078fa3a9aa4..9ba5b3c227adf1 100644 --- a/eng/native/init-os-and-arch.sh +++ b/eng/native/init-os-and-arch.sh @@ -41,7 +41,7 @@ case "$CPUName" in arch=x64 ;; - armv7l) + armv7l|armv8l) if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then arch=armel else diff --git a/eng/packaging.targets b/eng/packaging.targets index f450f05adc55c9..77f0805b438f01 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -1,18 +1,17 @@ - true true - $([MSBuild]::Subtract($(MajorVersion), 1)).0.0 + 6.0.0 - AddNETStandardCompatErrorFileForPackaging;IncludeAnalyzersInPackage;$(PackDependsOn) - AddNETStandardCompatErrorFileForPackaging;IncludeAnalyzersInPackage;$(BeforePack) + BeforePack must be used. Setting both to ensure that we are always running before other targets. --> + IncludeAnalyzersInPackage;AddNETStandardCompatErrorFileForPackaging;$(PackDependsOn) + IncludeAnalyzersInPackage;AddNETStandardCompatErrorFileForPackaging;$(BeforePack) $(PackageOutputPath) $(TargetsForTfmSpecificContentInPackage);AddRuntimeSpecificFilesToPackage;IncludePrivateProjectReferencesWithPackAttributeInPackage $(TargetsForTfmSpecificDebugSymbolsInPackage);AddRuntimeSpecificSymbolToPackage - false + false true $(MSBuildThisFileDirectory)useSharedDesignerContext.txt @@ -24,23 +23,40 @@ '$(IsRIDSpecificProject)' == 'true') and '$(PreReleaseVersionLabel)' != 'servicing' and '$(GitHubRepositoryName)' != 'runtimelab'">true + false + + true - $(XmlDocFileRoot)1033\$(AssemblyName).xml + $([MSBuild]::NormalizePath('$(XmlDocFileRoot)', 'net', '1033', '$(AssemblyName).xml')) + $(IntellisenseNetFile) + $([MSBuild]::NormalizePath('$(XmlDocFileRoot)', 'dotnet-plat-ext', '1033', '$(AssemblyName).xml')) + $(IntellisenseDotNetPlatExtFile) true - + + + 0 + - $(MajorVersion).$(MinorVersion).$(ServicingVersion) + $(MajorVersion).$(MinorVersion).$(ServicingVersion) + $(Version)-$(VersionSuffix) <_IsWindowsDesktopApp Condition="$(WindowsDesktopCoreAppLibrary.Contains('$(AssemblyName);'))">true <_IsAspNetCoreApp Condition="$(AspNetCoreAppLibrary.Contains('$(AssemblyName);'))">true - <_AssemblyInTargetingPack Condition="'$(IsNETCoreAppSrc)' == 'true' or '$(_IsAspNetCoreApp)' == 'true' or '$(_IsWindowsDesktopApp)' == 'true'">true - - $(MajorVersion).$(MinorVersion).0.$(ServicingVersion) + <_AssemblyInTargetingPack Condition="('$(IsNETCoreAppSrc)' == 'true' or '$(IsNetCoreAppRef)' == 'true' or '$(_IsAspNetCoreApp)' == 'true' or '$(_IsWindowsDesktopApp)' == 'true') and '$(TargetFrameworkIdentifier)' != '.NETFramework'">true + + $(MajorVersion).$(MinorVersion).0.$(ServicingVersion) - + @@ -150,6 +166,40 @@ + + <_MultiTargetRoslynComponentTargetsTemplate>$(MSBuildThisFileDirectory)MultiTargetRoslynComponent.targets.template + $(IntermediateOutputPath)MultiTargetRoslynComponent.targets + true + + + + + + + + + + + + + <_MultiTargetRoslynComponentTargetPrefix>$(PackageId.Replace('.', '_')) + <_MultiTargetRoslynComponentDisableSourceGeneratorPropertyName>Disable$(PackageId.Replace('.', ''))SourceGenerator + <_MultiTargetRoslynComponentDisableSourceGeneratorPropertyName>$(_MultiTargetRoslynComponentDisableSourceGeneratorPropertyName.Replace('Abstractions', '')) + + + + + @@ -176,6 +226,7 @@ ]]> + <_NETStandardCompatErrorPlaceholderFilePackagePath>buildTransitive$([System.IO.Path]::DirectorySeparatorChar)%(NETStandardCompatError.Supported) + <_PackageBuildFile Include="@(None->Metadata('PackagePath')); + @(Content->Metadata('PackagePath'))" /> + <_PackageBuildFile PackagePathWithoutFilename="$([System.IO.Path]::GetDirectoryName('%(Identity)'))" /> + + + PackagePath="$(_NETStandardCompatErrorPlaceholderFilePackagePath)\" + Pack="true" + Condition="'@(_PackageBuildFile)' == '' or + !@(_PackageBuildFile->AnyHaveMetadataValue('PackagePathWithoutFilename', '$(_NETStandardCompatErrorPlaceholderFilePackagePath)'))" /> @@ -221,4 +279,16 @@ + + + + + + + + diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index 84f1786bd2171d..56fa7022289fc9 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -14,7 +14,6 @@ parameters: dependsOn: [] pool: '' platform: '' - pgoType: '' condition: true useContinueOnErrorDuringBuild: false shouldContinueOnError: false @@ -26,8 +25,7 @@ parameters: helixQueues: '' enablePublishTestResults: false testResultsFormat: '' - extraStepsTemplate: '' - extraStepsParameters: {} + postBuildSteps: [] enableRichCodeNavigation: false richCodeNavigationLanguage: 'csharp' richCodeNavigationEnvironment: 'production' @@ -60,6 +58,10 @@ jobs: - ${{ parameters.dependsOn }} variables: + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - group: DotNet-HelixApi-Access + - group: AzureDevOps-Artifact-Feeds-Pats + - name: _osParameter value: -os ${{ parameters.osGroup }} @@ -113,14 +115,43 @@ jobs: - ${{ if eq(parameters.isOfficialBuild, true) }}: - template: /eng/pipelines/common/restore-internal-tools.yml + # Do not set up nuget sources for source build because the source build scripts already do this. + # This will cause the working tree to be dirty, which breaks the stash command when shallow clones are used, like in CI or official builds. + - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(parameters.buildingOnSourceBuildImage, true)) }}: + - ${{ if ne(parameters.osGroup, 'windows') }}: + - task: Bash@3 + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh + arguments: $(Build.SourcesDirectory)/NuGet.config $Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) + - ${{ if eq(parameters.osGroup, 'windows') }}: + - task: PowerShell@2 + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) + - ${{ each monoCrossAOTTargetOS in parameters.monoCrossAOTTargetOS }}: - task: DownloadPipelineArtifact@2 displayName: Download ${{monoCrossAOTTargetOS}} AOT offset files inputs: artifact: Mono_Offsets_${{monoCrossAOTTargetOS}} path: '$(Build.SourcesDirectory)/artifacts/obj/mono/offsetfiles' + + - ${{ if eq(parameters.buildingOnSourceBuildImage, true) }}: + - template: /eng/common/templates/steps/source-build.yml + parameters: + platform: + buildScript: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) + nonPortable: true + targetRID: banana.24-x64 + runtimeOS: linux - - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO displayName: Install Build Dependencies @@ -140,10 +171,11 @@ jobs: displayName: Install native dependencies # Build - - script: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) ${{ parameters.buildArgs }} $(_officialBuildParameter) $(_crossBuildPropertyArg) $(_cxx11Parameter) $(_richCodeNavigationParam) $(_buildDarwinFrameworksParameter) - displayName: Build product - ${{ if eq(parameters.useContinueOnErrorDuringBuild, true) }}: - continueOnError: ${{ parameters.shouldContinueOnError }} + - ${{ if eq(parameters.buildingOnSourceBuildImage, false) }}: + - script: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) ${{ parameters.buildArgs }} $(_officialBuildParameter) $(_crossBuildPropertyArg) $(_cxx11Parameter) $(_richCodeNavigationParam) $(_buildDarwinFrameworksParameter) + displayName: Build product + ${{ if eq(parameters.useContinueOnErrorDuringBuild, true) }}: + continueOnError: ${{ parameters.shouldContinueOnError }} - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'Android') }}: - script: | @@ -153,22 +185,29 @@ jobs: condition: always() # If intended to send extra steps after regular build add them here. - - ${{ if ne(parameters.extraStepsTemplate, '') }}: - - template: ${{ parameters.extraStepsTemplate }} - parameters: - osGroup: ${{ parameters.osGroup }} - osSubgroup: ${{ parameters.osSubgroup }} - archType: ${{ parameters.archType }} - buildConfig: ${{ parameters.buildConfig }} - runtimeFlavor: ${{ parameters.runtimeFlavor }} - runtimeVariant: ${{ parameters.runtimeVariant }} - helixQueues: ${{ parameters.helixQueues }} - targetRid: ${{ parameters.targetRid }} - nameSuffix: ${{ parameters.nameSuffix }} - platform: ${{ parameters.platform }} - pgoType: ${{ parameters.pgoType }} - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - ${{ insert }}: ${{ parameters.extraStepsParameters }} + - ${{ if ne(parameters.postBuildSteps,'') }}: + - ${{ each postBuildStep in parameters.postBuildSteps }}: + - ${{ if ne(postBuildStep.template, '') }}: + - template: ${{ postBuildStep.template }} + parameters: + osGroup: ${{ parameters.osGroup }} + osSubgroup: ${{ parameters.osSubgroup }} + archType: ${{ parameters.archType }} + buildConfig: ${{ parameters.buildConfig }} + runtimeFlavor: ${{ parameters.runtimeFlavor }} + runtimeVariant: ${{ parameters.runtimeVariant }} + helixQueues: ${{ parameters.helixQueues }} + targetRid: ${{ parameters.targetRid }} + nameSuffix: ${{ parameters.nameSuffix }} + platform: ${{ parameters.platform }} + shouldContinueOnError: ${{ parameters.shouldContinueOnError }} + ${{ if ne(postBuildStep.forwardedParameters, '') }}: + ${{ each parameter in postBuildStep.forwardedParameters }}: + ${{ parameter }}: ${{ parameters[parameter] }} + ${{ if ne(postBuildStep.parameters, '') }}: + ${{ insert }}: ${{ postBuildStep.parameters }} + - ${{ else }}: + - ${{ postBuildStep }} - task: PublishBuildArtifacts@1 displayName: Publish Logs diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 15fe948e92967e..fbc12a81b5abc6 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -91,7 +91,7 @@ jobs: targetRid: linux-musl-x64 platform: Linux_musl_x64 container: - image: alpine-3.9-WithNode-20210714125437-9b5bbc2 + image: alpine-3.13-WithNode-20210910135845-c401c85 registry: mcr jobParameters: runtimeFlavor: ${{ parameters.runtimeFlavor }} @@ -205,6 +205,32 @@ jobs: ${{ insert }}: ${{ parameters.jobParameters }} buildingOnSourceBuildImage: true +# Linux s390x + +- ${{ if containsValue(parameters.platforms, 'Linux_s390x') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + variables: ${{ parameters.variables }} + osGroup: Linux + archType: s390x + targetRid: linux-s390x + platform: Linux_s390x + container: + image: ubuntu-18.04-cross-s390x-20201102145728-d6e0352 + registry: mcr + jobParameters: + runtimeFlavor: ${{ parameters.runtimeFlavor }} + stagedBuild: ${{ parameters.stagedBuild }} + buildConfig: ${{ parameters.buildConfig }} + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + crossBuild: true + crossrootfsDir: '/crossrootfs/s390x' + ${{ insert }}: ${{ parameters.jobParameters }} + # WebAssembly - ${{ if containsValue(parameters.platforms, 'Browser_wasm') }}: diff --git a/eng/pipelines/common/restore-internal-tools.yml b/eng/pipelines/common/restore-internal-tools.yml index d289d82b53505c..fdec41da53da55 100644 --- a/eng/pipelines/common/restore-internal-tools.yml +++ b/eng/pipelines/common/restore-internal-tools.yml @@ -1,7 +1,7 @@ steps: - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 inputs: - nuGetServiceConnections: 'dotnet-core-internal-tooling' + nuGetServiceConnections: 'devdiv/dotnet-core-internal-tooling' forceReinstallCredentialProvider: true - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) diff --git a/eng/pipelines/common/templates/runtimes/build-test-job.yml b/eng/pipelines/common/templates/runtimes/build-test-job.yml index b2252563496cc1..b04cc92688c17f 100644 --- a/eng/pipelines/common/templates/runtimes/build-test-job.yml +++ b/eng/pipelines/common/templates/runtimes/build-test-job.yml @@ -23,7 +23,6 @@ parameters: runtimeVariant: '' dependsOn: [] dependOnEvaluatePaths: false - pgoType: '' ### Build managed test components (native components are getting built as part ### of the the product build job). @@ -108,7 +107,7 @@ jobs: steps: # Install test build dependencies - - ${{ if eq(parameters.osGroup, 'OSX') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'windows') }}: diff --git a/eng/pipelines/common/variables.yml b/eng/pipelines/common/variables.yml index 760543475a7519..f302f02a38c8db 100644 --- a/eng/pipelines/common/variables.yml +++ b/eng/pipelines/common/variables.yml @@ -1,12 +1,23 @@ variables: + +# These values enable longer delays, configurable number of retries, and special understanding of TCP hang-up +# See https://github.com/NuGet/Home/issues/11027 for details +- name: NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY + value: true +- name: NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT + value: 6 +- name: NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS + value: 1000 + - name: isOfficialBuild - value: ${{ and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }} + value: ${{ and(eq(variables['Build.DefinitionName'], 'dotnet-runtime-official'), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }} - name: isFullMatrix - value: ${{ and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }} + value: ${{ ne(variables['Build.Reason'], 'PullRequest') }} -# We only run evaluate paths on runtime and runtime-staging pipelines on PRs +# 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')) }} + value: ${{ and(eq(variables['Build.Reason'], 'PullRequest'), in(variables['Build.DefinitionName'], 'runtime', 'runtime-staging', 'runtime-community')) }} - 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 74441b1168913b..58338384ec8496 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -22,7 +22,7 @@ jobs: shouldContinueOnError: ${{ and(endsWith(variables['Build.DefinitionName'], 'staging'), eq(variables['Build.Reason'], 'PullRequest')) }} # keep in sync with /eng/pipelines/common/variables.yml - dependOnEvaluatePaths: ${{ and(eq(variables['Build.Reason'], 'PullRequest'), in(variables['Build.DefinitionName'], 'runtime', 'runtime-staging')) }} + dependOnEvaluatePaths: ${{ and(eq(variables['Build.Reason'], 'PullRequest'), in(variables['Build.DefinitionName'], 'runtime', 'runtime-staging', 'runtime-community')) }} variables: # Disable component governance in our CI builds. These builds are not shipping nor @@ -111,27 +111,27 @@ jobs: pool: # Public Linux Build Pool ${{ if and(or(in(parameters.osGroup, 'Linux', 'FreeBSD', 'Android'), eq(parameters.hostedOs, 'Linux')), eq(variables['System.TeamProject'], 'public')) }}: - name: NetCorePublic-Pool - queue: BuildPool.Ubuntu.1804.Amd64.Open + name: NetCore-Svc-Public + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open # Official Build Linux Pool ${{ if and(or(in(parameters.osGroup, 'Linux', 'FreeBSD', 'Browser', 'Android'), eq(parameters.hostedOs, 'Linux')), ne(variables['System.TeamProject'], 'public')) }}: - name: NetCoreInternal-Pool - queue: BuildPool.Ubuntu.1804.Amd64 + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64 # OSX Build Pool (we don't have on-prem OSX BuildPool ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: - vmImage: 'macOS-10.15' + vmImage: 'macOS-11' # Official Build Windows Pool ${{ if and(eq(parameters.osGroup, 'windows'), ne(variables['System.TeamProject'], 'public')) }}: - name: NetCoreInternal-Pool - queue: BuildPool.Windows.10.Amd64.VS2019 + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 # Public Windows Build Pool ${{ if and(or(eq(parameters.osGroup, 'windows'), eq(parameters.hostedOs, 'windows')), eq(variables['System.TeamProject'], 'public')) }}: - name: NetCorePublic-Pool - queue: BuildPool.Windows.10.Amd64.VS2019.Open + name: NetCore-Svc-Public + demands: ImageOverride -equals windows.vs2019.amd64.open ${{ if eq(parameters.helixQueuesTemplate, '') }}: diff --git a/eng/pipelines/coreclr/ci.yml b/eng/pipelines/coreclr/ci.yml index c4cbf06a14bde6..282d83d4030e54 100644 --- a/eng/pipelines/coreclr/ci.yml +++ b/eng/pipelines/coreclr/ci.yml @@ -150,13 +150,3 @@ jobs: crossgen2: true displayNameArgs: R2R_CG2 liveLibrariesBuildConfig: Release - -# -# Formatting -# -- template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/coreclr/templates/format-job.yml - platforms: - - Linux_x64 - - windows_x64 diff --git a/eng/pipelines/coreclr/perf.yml b/eng/pipelines/coreclr/perf.yml index 5726e5ac7c0de6..02a3057996fa45 100644 --- a/eng/pipelines/coreclr/perf.yml +++ b/eng/pipelines/coreclr/perf.yml @@ -3,7 +3,7 @@ trigger: branches: include: - main - - release/* + - release/6.0 paths: include: - '*' @@ -65,14 +65,15 @@ jobs: buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) nameSuffix: wasm isOfficialBuild: false - extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml - extraStepsParameters: - rootFolder: '$(Build.SourcesDirectory)/artifacts/' - includeRootFolder: true - displayName: Browser Wasm Artifacts - artifactName: BrowserWasm - archiveType: zip - archiveExtension: .zip + postBuildSteps: + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: '$(Build.SourcesDirectory)/artifacts/' + includeRootFolder: true + displayName: Browser Wasm Artifacts + artifactName: BrowserWasm + archiveType: zip + archiveExtension: .zip #run mono wasm microbenchmarks perf job - template: /eng/pipelines/common/platform-matrix.yml @@ -139,14 +140,15 @@ jobs: buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) nameSuffix: wasm isOfficialBuild: false - extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml - extraStepsParameters: - rootFolder: '$(Build.SourcesDirectory)/artifacts/' - includeRootFolder: true - displayName: Browser Wasm Artifacts - artifactName: BrowserWasm - archiveType: zip - archiveExtension: .zip + postBuildSteps: + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: '$(Build.SourcesDirectory)/artifacts/' + includeRootFolder: true + displayName: Browser Wasm Artifacts + artifactName: BrowserWasm + archiveType: zip + archiveExtension: .zip # build mono for AOT - template: /eng/pipelines/common/platform-matrix.yml @@ -160,15 +162,16 @@ jobs: buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) nameSuffix: AOT isOfficialBuild: false - extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml - extraStepsParameters: - rootFolder: '$(Build.SourcesDirectory)/artifacts/' - includeRootFolder: true - displayName: AOT Mono Artifacts - artifactName: LinuxMonoAOTx64 - archiveExtension: '.tar.gz' - archiveType: tar - tarCompression: gz + postBuildSteps: + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: '$(Build.SourcesDirectory)/artifacts/' + includeRootFolder: true + displayName: AOT Mono Artifacts + artifactName: LinuxMonoAOTx64 + archiveExtension: '.tar.gz' + archiveType: tar + tarCompression: gz # build mono Android scenarios - template: /eng/pipelines/common/platform-matrix.yml @@ -182,15 +185,16 @@ jobs: buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) nameSuffix: AndroidMono isOfficialBuild: false - extraStepsTemplate: /eng/pipelines/coreclr/templates/build-perf-sample-apps.yml - extraStepsParameters: - rootFolder: '$(Build.SourcesDirectory)/artifacts/' - includeRootFolder: true - displayName: Android Mono Artifacts - artifactName: AndroidMonoarm64 - archiveExtension: '.tar.gz' - archiveType: tar - tarCompression: gz + postBuildSteps: + - template: /eng/pipelines/coreclr/templates/build-perf-sample-apps.yml + parameters: + rootFolder: '$(Build.SourcesDirectory)/artifacts/' + includeRootFolder: true + displayName: Android Mono Artifacts + artifactName: AndroidMonoarm64 + archiveExtension: '.tar.gz' + archiveType: tar + tarCompression: gz # build mono iOS scenarios - template: /eng/pipelines/common/platform-matrix.yml @@ -204,15 +208,16 @@ jobs: buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) nameSuffix: iOSMono isOfficialBuild: false - extraStepsTemplate: /eng/pipelines/coreclr/templates/build-perf-sample-apps.yml - extraStepsParameters: - rootFolder: '$(Build.SourcesDirectory)/artifacts/' - includeRootFolder: true - displayName: iOS Mono Artifacts - artifactName: iOSMonoarm64 - archiveExtension: '.tar.gz' - archiveType: tar - tarCompression: gz + postBuildSteps: + - template: /eng/pipelines/coreclr/templates/build-perf-sample-apps.yml + parameters: + rootFolder: '$(Build.SourcesDirectory)/artifacts/' + includeRootFolder: true + displayName: iOS Mono Artifacts + artifactName: iOSMonoarm64 + archiveExtension: '.tar.gz' + archiveType: tar + tarCompression: gz # build mono - template: /eng/pipelines/common/platform-matrix.yml @@ -464,7 +469,7 @@ jobs: projectFile: crossgen_perf.proj runKind: crossgen_scenarios runJobTemplate: /eng/pipelines/coreclr/templates/run-scenarios-job.yml - logicalmachine: 'perftiger' + logicalmachine: 'perftiger_crossgen' # run mono wasm blazor perf job - template: /eng/pipelines/common/platform-matrix.yml diff --git a/eng/pipelines/coreclr/perf_slow.yml b/eng/pipelines/coreclr/perf_slow.yml index 1ad80465846984..ab85e0a2458cdc 100644 --- a/eng/pipelines/coreclr/perf_slow.yml +++ b/eng/pipelines/coreclr/perf_slow.yml @@ -1,23 +1,4 @@ -trigger: - batch: true - branches: - include: - - main - - release/* - paths: - include: - - '*' - - src/libraries/System.Private.CoreLib/* - exclude: - - .github/* - - docs/* - - CODE-OF-CONDUCT.md - - CONTRIBUTING.md - - LICENSE.TXT - - PATENTS.TXT - - README.md - - SECURITY.md - - THIRD-PARTY-NOTICES.TXT +trigger: none variables: - template: /eng/pipelines/common/variables.yml @@ -83,14 +64,15 @@ jobs: buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) nameSuffix: wasm isOfficialBuild: false - extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml - extraStepsParameters: - rootFolder: '$(Build.SourcesDirectory)/artifacts/' - includeRootFolder: true - displayName: Browser Wasm Artifacts - artifactName: BrowserWasm - archiveType: zip - archiveExtension: .zip + postBuildSteps: + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: '$(Build.SourcesDirectory)/artifacts/' + includeRootFolder: true + displayName: Browser Wasm Artifacts + artifactName: BrowserWasm + archiveType: zip + archiveExtension: .zip - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'Schedule')) }}: @@ -117,14 +99,15 @@ jobs: buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) nameSuffix: wasm isOfficialBuild: false - extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml - extraStepsParameters: - rootFolder: '$(Build.SourcesDirectory)/artifacts/' - includeRootFolder: true - displayName: Browser Wasm Artifacts - artifactName: BrowserWasm - archiveType: zip - archiveExtension: .zip + postBuildSteps: + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: '$(Build.SourcesDirectory)/artifacts/' + includeRootFolder: true + displayName: Browser Wasm Artifacts + artifactName: BrowserWasm + archiveType: zip + archiveExtension: .zip - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -137,15 +120,16 @@ jobs: buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) nameSuffix: AOT isOfficialBuild: false - extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml - extraStepsParameters: - rootFolder: '$(Build.SourcesDirectory)/artifacts/' - includeRootFolder: true - displayName: AOT Mono Artifacts - artifactName: LinuxMonoAOTarm64 - archiveExtension: '.tar.gz' - archiveType: tar - tarCompression: gz + postBuildSteps: + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: '$(Build.SourcesDirectory)/artifacts/' + includeRootFolder: true + displayName: AOT Mono Artifacts + artifactName: LinuxMonoAOTarm64 + archiveExtension: '.tar.gz' + archiveType: tar + tarCompression: gz # run mono aot microbenchmarks perf job - template: /eng/pipelines/common/platform-matrix.yml @@ -195,5 +179,37 @@ jobs: projectFile: microbenchmarks.proj runKind: micro runJobTemplate: /eng/pipelines/coreclr/templates/run-performance-job.yml - logicalmachine: 'perfsurf' + logicalmachine: 'perfsurf' + +# Uncomment once we fix https://github.com/dotnet/performance/issues/1950 +# # run coreclr linux crossgen perf job +# - template: /eng/pipelines/common/platform-matrix.yml +# parameters: +# jobTemplate: /eng/pipelines/coreclr/templates/perf-job.yml +# buildConfig: release +# runtimeFlavor: coreclr +# platforms: +# - Linux_arm64 +# jobParameters: +# testGroup: perf +# liveLibrariesBuildConfig: Release +# projectFile: crossgen_perf.proj +# runKind: crossgen_scenarios +# runJobTemplate: /eng/pipelines/coreclr/templates/run-scenarios-job.yml +# logicalmachine: 'perfa64' +# # run coreclr windows crossgen perf job +# - template: /eng/pipelines/common/platform-matrix.yml +# parameters: +# jobTemplate: /eng/pipelines/coreclr/templates/perf-job.yml +# buildConfig: release +# runtimeFlavor: coreclr +# platforms: +# - windows_arm64 +# jobParameters: +# testGroup: perf +# liveLibrariesBuildConfig: Release +# projectFile: crossgen_perf.proj +# runKind: crossgen_scenarios +# runJobTemplate: /eng/pipelines/coreclr/templates/run-scenarios-job.yml +# logicalmachine: 'perfsurf' \ No newline at end of file diff --git a/eng/pipelines/coreclr/templates/build-jit-job.yml b/eng/pipelines/coreclr/templates/build-jit-job.yml index 5ac3f54679d862..a804944df11953 100644 --- a/eng/pipelines/coreclr/templates/build-jit-job.yml +++ b/eng/pipelines/coreclr/templates/build-jit-job.yml @@ -86,7 +86,7 @@ jobs: # Linux builds use docker images with dependencies preinstalled, # and FreeBSD builds use a build agent with dependencies # preinstalled, so we only need this step for OSX and Windows. - - ${{ if eq(parameters.osGroup, 'OSX') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies (OSX) - ${{ if eq(parameters.osGroup, 'windows') }}: diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml index e94d630ba2e957..1fe647f427f5c3 100644 --- a/eng/pipelines/coreclr/templates/build-job.yml +++ b/eng/pipelines/coreclr/templates/build-job.yml @@ -20,7 +20,6 @@ parameters: testGroup: '' timeoutInMinutes: '' variables: {} - pgoType: '' ### Product build jobs: @@ -38,25 +37,22 @@ jobs: pool: ${{ parameters.pool }} condition: ${{ parameters.condition }} dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }} - pgoType: ${{ parameters.pgoType }} # Compute job name from template parameters ${{ if and(ne(parameters.testGroup, 'clrTools'), eq(parameters.compilerName, 'gcc')) }}: name: ${{ format('coreclr_{0}_product_build_{1}{1}_{3}_{4}', parameters.compilerName, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} displayName: ${{ format('CoreCLR GCC Product Build {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} ${{ if and(ne(parameters.testGroup, 'clrTools'), ne(parameters.compilerName, 'gcc')) }}: - name: ${{ format('coreclr_{0}_product_build_{1}{2}_{3}_{4}{5}', + name: ${{ format('coreclr_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, - parameters.buildConfig, - parameters.pgoType) }} - displayName: ${{ format('CoreCLR {0} Product Build {1}{2} {3} {4} {5}', + parameters.buildConfig) }} + displayName: ${{ format('CoreCLR {0} Product Build {1}{2} {3} {4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, - parameters.buildConfig, - parameters.pgoType) }} + parameters.buildConfig) }} ${{ if eq(parameters.testGroup, 'clrTools') }}: name: ${{ format('coreclr_{0}_tools_unittests_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} displayName: ${{ format('CoreCLR {0} Tools Unit Tests {1}{2} {3} {4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} @@ -108,15 +104,17 @@ jobs: # Variables used by arcade to gather asset manifests - name: _DotNetPublishToBlobFeed value: true + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - group: AzureDevOps-Artifact-Feeds-Pats - name: officialBuildIdArg value: '' - - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.isOfficialBuild, true) }}: - name: officialBuildIdArg value: '/p:OfficialBuildId=$(Build.BuildNumber)' - name: enforcePgoArg value: '' # The EnforcePGO script is only supported on Windows and is not supported on arm or arm64. - - ${{ if and(eq(parameters.buildConfig, 'Release'), and(eq(parameters.osGroup, 'windows'), not(or(eq(parameters.archType, 'arm64'), eq(parameters.archType, 'arm')))), ne(parameters.pgoType, 'pgo')) }}: + - ${{ if and(eq(parameters.buildConfig, 'Release'), and(eq(parameters.osGroup, 'windows'), not(or(eq(parameters.archType, 'arm64'), eq(parameters.archType, 'arm'))))) }}: - name: enforcePgoArg value: '-enforcepgo' @@ -132,12 +130,6 @@ jobs: - name: clrBuildPALTestsBuildArg value: '-component runtime -component alljits -component paltests ' - - name: pgoInstrumentArg - value: '' - - ${{ if eq(parameters.pgoType, 'PGO' )}}: - - name: pgoInstrumentArg - value: '-pgoinstrument ' - - name: SignType value: $[ coalesce(variables.OfficialSignType, 'real') ] @@ -149,7 +141,7 @@ jobs: # Linux builds use docker images with dependencies preinstalled, # and FreeBSD builds use a build agent with dependencies # preinstalled, so we only need this step for OSX and Windows. - - ${{ if eq(parameters.osGroup, 'OSX') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'windows') }}: @@ -175,6 +167,24 @@ jobs: continueOnError: false condition: and(succeeded(), in(variables['SignType'], 'real', 'test')) + - ${{ if ne(variables['System.TeamProject'], 'public') }}: + - ${{ if ne(parameters.osGroup, 'windows') }}: + - task: Bash@3 + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh + arguments: $(Build.SourcesDirectory)/NuGet.config $Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) + - ${{ if eq(parameters.osGroup, 'windows') }}: + - task: PowerShell@2 + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) + - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: - script: | du -sh $(Build.SourcesDirectory)/* @@ -188,10 +198,10 @@ jobs: # Build CoreCLR Runtime - ${{ if ne(parameters.osGroup, 'windows') }}: - - script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(clrBuildPALTestsBuildArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) + - script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(clrBuildPALTestsBuildArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) displayName: Build CoreCLR Runtime - ${{ if eq(parameters.osGroup, 'windows') }}: - - script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) + - script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) displayName: Build CoreCLR Runtime - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: @@ -201,7 +211,7 @@ jobs: displayName: Disk Usage after Build # Build CoreCLR Managed Components - - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages+clr.paltestlist $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci + - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages+clr.paltestlist $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(officialBuildIdArg) -ci displayName: Build managed product components and packages # Run CoreCLR Tools unit tests @@ -238,23 +248,11 @@ jobs: # Sign diagnostic files on Windows - ${{ if and(eq(parameters.osGroup, 'windows'), eq(parameters.signBinaries, true)) }}: - - powershell: >- - eng\common\build.ps1 -ci -sign -restore -configuration:$(buildConfig) -warnaserror:0 $(officialBuildIdArg) - /p:DiagnosticsFilesRoot="$(buildProductRootFolderPath)" - /p:SignDiagnostics=true - /p:DotNetSignType=$(SignType) - -noBl - /bl:$(Build.SourcesDirectory)/artifacts/log/$(buildConfig)/SignDiagnostics.binlog - -projects $(Build.SourcesDirectory)\eng\empty.csproj - displayName: Sign Diagnostic Binaries - - - task: PublishPipelineArtifact@1 - displayName: Publish Signing Logs - inputs: - targetPath: '$(Build.SourcesDirectory)/artifacts/log/' - artifactName: ${{ format('SignLogs_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} - continueOnError: true - condition: always() + - template: /eng/pipelines/coreclr/templates/sign-diagnostic-files.yml + parameters: + basePath: $(buildProductRootFolderPath) + isOfficialBuild: ${{ parameters.isOfficialBuild }} + timeoutInMinutes: 30 # Builds using gcc are not tested, and clrTools unitests do not publish the build artifacts - ${{ if and(ne(parameters.compilerName, 'gcc'), ne(parameters.testGroup, 'clrTools')) }}: @@ -269,16 +267,17 @@ jobs: artifactName: $(buildProductArtifactName) displayName: 'product build' - - ${{ if and(in(parameters.osGroup, 'windows', 'Linux'), ne(parameters.archType, 'x86'), ne(parameters.compilerName, 'gcc'), ne(parameters.testGroup, 'clrTools'), eq(parameters.pgoType, '')) }}: + - ${{ if and(in(parameters.osGroup, 'windows', 'Linux'), ne(parameters.archType, 'x86'), ne(parameters.compilerName, 'gcc'), ne(parameters.testGroup, 'clrTools')) }}: - template: /eng/pipelines/coreclr/templates/crossdac-build.yml parameters: archType: ${{ parameters.archType }} osGroup: ${{ parameters.osGroup }} osSubgroup: ${{ parameters.osSubgroup }} + isOfficialBuild: ${{ parameters.isOfficialBuild }} - ${{ if and(ne(parameters.compilerName, 'gcc'), ne(parameters.testGroup, ''), ne(parameters.testGroup, 'clrTools')) }}: # Publish test native components for consumption by test execution. - - ${{ if and(ne(parameters.isOfficialBuild, true), eq(parameters.pgoType, '')) }}: + - ${{ if ne(parameters.isOfficialBuild, true) }}: - template: /eng/pipelines/common/upload-artifact-step.yml parameters: rootFolder: $(nativeTestArtifactRootFolderPath) @@ -319,6 +318,6 @@ jobs: displayName: Publish Logs inputs: targetPath: $(Build.SourcesDirectory)/artifacts/log - artifactName: '$(publishLogsArtifactPrefix)${{ parameters.pgoType }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' + artifactName: '$(publishLogsArtifactPrefix)_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' continueOnError: true condition: always() diff --git a/eng/pipelines/coreclr/templates/build-perf-sample-apps.yml b/eng/pipelines/coreclr/templates/build-perf-sample-apps.yml index 65b6226093a10f..3d5d83b6dadc88 100644 --- a/eng/pipelines/coreclr/templates/build-perf-sample-apps.yml +++ b/eng/pipelines/coreclr/templates/build-perf-sample-apps.yml @@ -24,7 +24,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/Android displayName: Build HelloAndroid sample app - ${{ if eq(parameters.osGroup, 'iOS') }}: - - script: make build-appbundle TARGET=iOS MONO_ARCH=arm64 MONO_CONFIG=Release AOT=True USE_LLVM=False + - script: make build-appbundle TARGET=iOS MONO_ARCH=arm64 MONO_CONFIG=Release AOT=True USE_LLVM=False DEPLOY_AND_RUN=false env: DevTeamProvisioning: '-' workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS @@ -47,7 +47,7 @@ steps: - script: rm -r -f $(Build.SourcesDirectory)/src/mono/sample/iOS/bin workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS displayName: Clean bindir - - script: make build-appbundle TARGET=iOS MONO_ARCH=arm64 MONO_CONFIG=Release AOT=True USE_LLVM=True + - script: make build-appbundle TARGET=iOS MONO_ARCH=arm64 MONO_CONFIG=Release AOT=True USE_LLVM=True DEPLOY_AND_RUN=false env: DevTeamProvisioning: '-' workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS diff --git a/eng/pipelines/coreclr/templates/crossdac-build.yml b/eng/pipelines/coreclr/templates/crossdac-build.yml index f38341c95e9b64..98cc123878ebb9 100644 --- a/eng/pipelines/coreclr/templates/crossdac-build.yml +++ b/eng/pipelines/coreclr/templates/crossdac-build.yml @@ -2,6 +2,7 @@ parameters: archType: '' osGroup: '' osSubgroup: '' + isOfficialBuild: false steps: # Always build the crossdac, that way we know in CI/PR if things break to build. @@ -30,6 +31,12 @@ steps: !**/sharedFramework/**/* TargetFolder: '$(buildMuslDacStagingPath)' + - template: /eng/pipelines/coreclr/templates/sign-diagnostic-files.yml + parameters: + basePath: $(crossDacArtifactPath) + isOfficialBuild: ${{ parameters.isOfficialBuild }} + timeoutInMinutes: 30 + - ${{ if eq(parameters.osGroup, 'Linux') }}: - task: CopyFiles@2 displayName: Gather runtime for CrossDac diff --git a/eng/pipelines/coreclr/templates/crossdac-pack.yml b/eng/pipelines/coreclr/templates/crossdac-pack.yml index 40e375bb9375c4..fc3ef404c171a9 100644 --- a/eng/pipelines/coreclr/templates/crossdac-pack.yml +++ b/eng/pipelines/coreclr/templates/crossdac-pack.yml @@ -54,19 +54,6 @@ jobs: - ${{ parameters.runtimeFlavor }}_${{ parameters.runtimeVariant }}_product_build_${{ platform }}_${{ parameters.buildConfig }} steps: - # Install MicroBuild for signing the package - - ${{ if eq(parameters.isOfficialBuild, true) }}: - - template: /eng/pipelines/common/restore-internal-tools.yml - - - task: MicroBuildSigningPlugin@2 - displayName: Install MicroBuild plugin for Signing - inputs: - signType: $(SignType) - zipSources: false - feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json - continueOnError: false - condition: and(succeeded(), in(variables['SignType'], 'real', 'test')) - - task: DownloadBuildArtifacts@0 displayName: Download CrossDac artifacts inputs: @@ -77,16 +64,6 @@ jobs: - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset crossdacpack -arch $(archType) $(osArg) -c $(buildConfig) $(officialBuildIdArg) $(crossDacArgs) -ci displayName: Build crossdac packaging - # Sign diagnostic files - - ${{ if eq(parameters.isOfficialBuild, true) }}: - - powershell: >- - eng\common\build.ps1 -ci -sign -restore -configuration:$(buildConfig) -warnaserror:0 $(officialBuildIdArg) - /p:PackagesFolder="$(Build.SourcesDirectory)/artifacts/packages/$(buildConfig)" - /p:SignDiagnosticsPackages=true - /p:DotNetSignType=$(SignType) - -projects $(Build.SourcesDirectory)\eng\empty.csproj - displayName: Sign CrossDac package and contents - # Save packages using the prepare-signed-artifacts format. - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml parameters: diff --git a/eng/pipelines/coreclr/templates/helix-queues-setup.yml b/eng/pipelines/coreclr/templates/helix-queues-setup.yml index 2b3a80ce94349c..3bdaeb1a049438 100644 --- a/eng/pipelines/coreclr/templates/helix-queues-setup.yml +++ b/eng/pipelines/coreclr/templates/helix-queues-setup.yml @@ -28,7 +28,7 @@ jobs: # iOS/tvOS simulator x64/x86 - ${{ if in(parameters.platform, 'iOSSimulator_x64', 'tvOSSimulator_x64') }}: - - OSX.1015.Amd64.Open + - OSX.1200.Amd64.Open # Android arm64 - ${{ if in(parameters.platform, 'Android_arm64') }}: @@ -36,7 +36,7 @@ jobs: # Android x64 - ${{ if in(parameters.platform, 'Android_x64') }}: - - Ubuntu.1804.Amd64.Android.Open + - Ubuntu.1804.Amd64.Android.29.Open # Browser wasm - ${{ if eq(parameters.platform, 'Browser_wasm') }}: @@ -45,58 +45,59 @@ jobs: # Linux arm - ${{ if eq(parameters.platform, 'Linux_arm') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 + - (Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Debian.9.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-9-helix-arm32v7-bfcd90a-20200121150037 - - (Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 + - (Debian.10.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-arm32v7 + - (Debian.11.Arm32)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-arm32v7 + - (Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7 # Linux arm64 - ${{ if eq(parameters.platform, 'Linux_arm64') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Ubuntu.1804.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652 + - (Ubuntu.1804.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8 - ${{ if and(eq(variables['System.TeamProject'], 'public'), notIn(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - - (Debian.9.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-9-helix-arm64v8-bfcd90a-20200121150055 + - (Debian.10.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-arm64v8 + - (Debian.11.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-arm64v8 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Debian.9.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-9-helix-arm64v8-bfcd90a-20200121150055 - - (Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652 + - (Debian.10.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-arm64v8 + - (Debian.11.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-arm64v8 + - (Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8 # Linux musl x64 - - ${{ if eq(parameters.platform, 'Linux_musl_x64') }}: + - ${{ if eq(parameters.platform, 'linux_musl_x64') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Alpine.312.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.12-helix-20200602002622-e06dc59 + - (Alpine.317.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-amd64 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Alpine.312.Amd64)ubuntu.1604.amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.12-helix-20200602002622-e06dc59 + - (Alpine.319.Amd64)Ubuntu.2204.Amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-helix-amd64 # Linux musl arm32 - - ${{ if eq(parameters.platform, 'Linux_musl_arm') }}: + - ${{ if eq(parameters.platform, 'linux_musl_arm') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Alpine.313.Arm32.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.13-helix-arm32v7-20210414141857-1ea6b0a + - (Alpine.317.Arm32.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm32v7 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Alpine.313.Arm32)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.13-helix-arm32v7-20210414141857-1ea6b0a + - (Alpine.319.Arm32)Ubuntu.2204.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-helix-arm32v7 # Linux musl arm64 - - ${{ if eq(parameters.platform, 'Linux_musl_arm64') }}: + - ${{ if eq(parameters.platform, 'linux_musl_arm64') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Alpine.312.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.12-helix-arm64v8-20200602002604-25f8a3e + - (Alpine.317.Arm64.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm64v8 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Alpine.312.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.12-helix-arm64v8-20200602002604-25f8a3e + - (Alpine.319.Arm64)Ubuntu.2204.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-helix-arm64v8 # Linux x64 - ${{ if eq(parameters.platform, 'Linux_x64') }}: - ${{ if and(eq(variables['System.TeamProject'], 'public'), in(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - Ubuntu.1804.Amd64.Open - ${{ if and(eq(variables['System.TeamProject'], 'public'), notIn(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - - Debian.9.Amd64.Open - - Ubuntu.1604.Amd64.Open + - (Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64 + - (Debian.11.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64 - Ubuntu.1804.Amd64.Open - - (Centos.8.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759 - RedHat.7.Amd64.Open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - Debian.9.Amd64 - - Ubuntu.1604.Amd64 + - (Debian.10.Amd64)Ubuntu.1804.amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64 + - (Debian.11.Amd64)Ubuntu.1804.amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64 - Ubuntu.1804.Amd64 - - (Centos.8.Amd64)Ubuntu.1604.amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759 - - (Fedora.34.Amd64)Ubuntu.1604.amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210728124700-4f64125 + - (Fedora.34.Amd64)Ubuntu.2204.amd64.svc@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix - RedHat.7.Amd64 # OSX arm64 @@ -108,58 +109,43 @@ jobs: # OSX x64 - ${{ if eq(parameters.platform, 'OSX_x64') }}: - - ${{ if and(eq(variables['System.TeamProject'], 'public'), in(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - - OSX.1013.Amd64.Open - - ${{ if and(eq(variables['System.TeamProject'], 'public'), notIn(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - - OSX.1013.Amd64.Open - - OSX.1014.Amd64.Open + - ${{ if eq(variables['System.TeamProject'], 'public') }}: + - OSX.1200.Amd64.Open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - OSX.1013.Amd64 - - OSX.1014.Amd64 - - OSX.1015.Amd64 + - OSX.1200.Amd64 # windows x64 - ${{ if eq(parameters.platform, 'windows_x64') }}: - ${{ if and(eq(variables['System.TeamProject'], 'public'), in(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - Windows.10.Amd64.Open - ${{ if and(eq(variables['System.TeamProject'], 'public'), notIn(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - - (Windows.Nano.1809.Amd64.Open)windows.10.amd64.serverrs5.open@mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504 - - Windows.7.Amd64.Open - - Windows.81.Amd64.Open + - (Windows.Nano.1809.Amd64.Open)windows.10.amd64.serverrs5.open@mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64 - Windows.10.Amd64.Open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - Windows.7.Amd64 - - Windows.81.Amd64 - Windows.10.Amd64 - - Windows.10.Amd64.Core - - (Windows.Nano.1809.Amd64.Open)windows.10.amd64.serverrs5.open@mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504 + - (Windows.Nano.1809.Amd64)windows.10.amd64.serverrs5@mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64 # windows x86 - ${{ if eq(parameters.platform, 'windows_x86') }}: - ${{ if and(eq(variables['System.TeamProject'], 'public'), in(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - Windows.10.Amd64.Open - ${{ if and(eq(variables['System.TeamProject'], 'public'), notIn(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - - Windows.7.Amd64.Open - - Windows.81.Amd64.Open - Windows.10.Amd64.Open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - Windows.7.Amd64 - - Windows.81.Amd64 - Windows.10.Amd64 - - Windows.10.Amd64.Core # windows arm - ${{ if eq(parameters.platform, 'windows_arm') }}: - ${{ if and(eq(variables['System.TeamProject'], 'public'), in(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - - Windows.10.Arm64v8.Open + - Windows.11.Arm64.Open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - Windows.10.Arm64 + - Windows.11.Arm64 # windows arm64 - ${{ if eq(parameters.platform, 'windows_arm64') }}: - ${{ if and(eq(variables['System.TeamProject'], 'public'), in(parameters.jobParameters.helixQueueGroup, 'pr', 'ci', 'libraries')) }}: - - Windows.10.Arm64v8.Open + - Windows.11.Arm64.Open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - Windows.10.Arm64 + - Windows.11.Arm64 ${{ insert }}: ${{ parameters.jobParameters }} diff --git a/eng/pipelines/coreclr/templates/perf-job.yml b/eng/pipelines/coreclr/templates/perf-job.yml index b3f66a235ed920..89318b47e9ea08 100644 --- a/eng/pipelines/coreclr/templates/perf-job.yml +++ b/eng/pipelines/coreclr/templates/perf-job.yml @@ -94,7 +94,10 @@ jobs: - ${{ parameters.framework }} steps: # Extra steps that will be passed to the performance template and run before sending the job to helix (all of which is done in the template) - + - script: | + $(Build.SourcesDirectory)/eng/common/msbuild.sh $(Build.SourcesDirectory)/eng/testing/performance/add_properties_to_pipeline.proj /t:SetVariables + displayName: Add Properties To Pipeline Env + # Optionally download live-built libraries - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}: - template: /eng/pipelines/common/download-artifact-step.yml @@ -181,10 +184,10 @@ jobs: condition: and(succeeded(), ne(variables.runtimeFlavorName, 'Mono')) # Copy the runtime directory into the testhost folder to include OOBs. - - script: "build.cmd -subset libs.pretest -configuration release -ci -arch $(archType) -testscope innerloop /p:RuntimeArtifactsPath=$(librariesDownloadDir)\\bin\\mono\\$(osGroup).$(archType).$(buildConfigUpper) /p:RuntimeFlavor=mono;xcopy $(Build.SourcesDirectory)\\artifacts\\bin\\runtime\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\* $(Build.SourcesDirectory)\\artifacts\\bin\\testhost\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\shared\\Microsoft.NETCore.App\\6.0.0 /E /I /Y;xcopy $(Build.SourcesDirectory)\\artifacts\\bin\\testhost\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\* $(Build.SourcesDirectory)\\.dotnet-mono /E /I /Y;copy $(Build.SourcesDirectory)\\artifacts\\bin\\coreclr\\$(osGroup).$(archType).$(buildConfigUpper)\\corerun.exe $(Build.SourcesDirectory)\\.dotnet-mono\\shared\\Microsoft.NETCore.App\\6.0.0\\corerun.exe" + - script: "build.cmd -subset libs.pretest -configuration release -ci -arch $(archType) -testscope innerloop /p:RuntimeArtifactsPath=$(librariesDownloadDir)\\bin\\mono\\$(osGroup).$(archType).$(buildConfigUpper) /p:RuntimeFlavor=mono;xcopy $(Build.SourcesDirectory)\\artifacts\\bin\\runtime\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\* $(Build.SourcesDirectory)\\artifacts\\bin\\testhost\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\shared\\Microsoft.NETCore.App\\$(productVersion) /E /I /Y;xcopy $(Build.SourcesDirectory)\\artifacts\\bin\\testhost\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\* $(Build.SourcesDirectory)\\.dotnet-mono /E /I /Y;copy $(Build.SourcesDirectory)\\artifacts\\bin\\coreclr\\$(osGroup).$(archType).$(buildConfigUpper)\\corerun.exe $(Build.SourcesDirectory)\\.dotnet-mono\\shared\\Microsoft.NETCore.App\\$(productVersion)\\corerun.exe" displayName: "Create mono dotnet (Windows)" condition: and(and(succeeded(), eq(variables.runtimeFlavorName, 'Mono')), eq(variables.osGroup, 'windows'), not(in('${{ parameters.runtimeType }}', 'AndroidMono', 'iOSMono'))) - - script: "mkdir $(Build.SourcesDirectory)/.dotnet-mono;./build.sh -subset libs.pretest -configuration release -ci -arch $(archType) -testscope innerloop /p:RuntimeArtifactsPath=$(librariesDownloadDir)/bin/mono/$(osGroup).$(archType).$(buildConfigUpper) /p:RuntimeFlavor=mono;cp $(Build.SourcesDirectory)/artifacts/bin/runtime/$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)/* $(Build.SourcesDirectory)/artifacts/bin/testhost/$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)/shared/Microsoft.NETCore.App/6.0.0 -rf;cp $(Build.SourcesDirectory)/artifacts/bin/testhost/$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)/* $(Build.SourcesDirectory)/.dotnet-mono -r;cp $(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).$(buildConfigUpper)/corerun $(Build.SourcesDirectory)/.dotnet-mono/shared/Microsoft.NETCore.App/6.0.0/corerun" + - script: "mkdir $(Build.SourcesDirectory)/.dotnet-mono;./build.sh -subset libs.pretest -configuration release -ci -arch $(archType) -testscope innerloop /p:RuntimeArtifactsPath=$(librariesDownloadDir)/bin/mono/$(osGroup).$(archType).$(buildConfigUpper) /p:RuntimeFlavor=mono;cp $(Build.SourcesDirectory)/artifacts/bin/runtime/$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)/* $(Build.SourcesDirectory)/artifacts/bin/testhost/$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)/shared/Microsoft.NETCore.App/$(productVersion) -rf;cp $(Build.SourcesDirectory)/artifacts/bin/testhost/$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)/* $(Build.SourcesDirectory)/.dotnet-mono -r;cp $(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).$(buildConfigUpper)/corerun $(Build.SourcesDirectory)/.dotnet-mono/shared/Microsoft.NETCore.App/$(productVersion)/corerun" displayName: "Create mono dotnet (Linux)" condition: and(and(succeeded(), eq(variables.runtimeFlavorName, 'Mono')), ne(variables.osGroup, 'windows'), not(in('${{ parameters.runtimeType }}', 'AndroidMono', 'iOSMono'))) diff --git a/eng/pipelines/coreclr/templates/run-performance-job.yml b/eng/pipelines/coreclr/templates/run-performance-job.yml index de523bb2d99e61..888febcb9b430c 100644 --- a/eng/pipelines/coreclr/templates/run-performance-job.yml +++ b/eng/pipelines/coreclr/templates/run-performance-job.yml @@ -23,7 +23,7 @@ parameters: runKind: '' # required -- test category logicalMachine: '' # required -- Used to specify a which pool of machines the test should run against javascriptEngine: 'NoJS' - + jobs: - template: xplat-pipeline-job.yml parameters: @@ -36,7 +36,7 @@ jobs: enableTelemetry: ${{ parameters.enableTelemetry }} enablePublishBuildArtifacts: true continueOnError: ${{ parameters.continueOnError }} - + ${{ if ne(parameters.displayName, '') }}: displayName: '${{ parameters.displayName }}' ${{ if eq(parameters.displayName, '') }}: @@ -55,9 +55,9 @@ jobs: - IsInternal: '' - HelixApiAccessToken: '' - - HelixPreCommandStemWindows: 'py -m pip install -U pip;py -3 -m venv %HELIX_WORKITEM_PAYLOAD%\.venv;call %HELIX_WORKITEM_PAYLOAD%\.venv\Scripts\activate.bat;set PYTHONPATH=;py -3 -m pip install -U pip;py -3 -m pip install azure.storage.blob==12.0.0;py -3 -m pip install azure.storage.queue==12.0.0;set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"' - - HelixPreCommandStemLinux: 'python3 -m pip install -U pip;sudo apt-get -y install python3-venv;python3 -m venv $HELIX_WORKITEM_PAYLOAD/.venv;source $HELIX_WORKITEM_PAYLOAD/.venv/Scripts/activate;export PYTHONPATH=;python3 -m pip install -U pip;pip3 install azure.storage.blob==12.0.0;pip3 install azure.storage.queue==12.0.0;sudo apt-get update;sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates;curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -;sudo apt-get -y install nodejs;sudo apt-get -y install npm;npm install --prefix $HELIX_WORKITEM_PAYLOAD jsvu -g;$HELIX_WORKITEM_PAYLOAD/bin/jsvu --os=linux64 --engines=v8,javascriptcore;export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' - - HelixPreCommandStemMsul: 'sudo apk add icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib;sudo apk add cargo --repository http://dl-cdn.alpinelinux.org/alpine/v3.12/community ;sudo apk add libgdiplus --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing; python3 -m venv $HELIX_WORKITEM_PAYLOAD/.venv;source $HELIX_WORKITEM_PAYLOAD/.venv/bin/activate;export PYTHONPATH=;python3 -m pip install -U pip;pip3 install azure.storage.blob==12.7.1;pip3 install azure.storage.queue==12.1.5;export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' + - HelixPreCommandStemWindows: 'set ORIGPYPATH=%PYTHONPATH%;py -m pip install -U pip;py -3 -m venv %HELIX_WORKITEM_PAYLOAD%\.venv;call %HELIX_WORKITEM_PAYLOAD%\.venv\Scripts\activate.bat;set PYTHONPATH=;py -3 -m pip install -U pip;py -3 -m pip install urllib3==1.26.15;py -3 -m pip install azure.storage.blob==12.0.0;py -3 -m pip install azure.storage.queue==12.0.0;set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"' + - HelixPreCommandStemLinux: 'export ORIGPYPATH=$PYTHONPATH;python3 -m pip install -U pip;sudo apt-get -y install python3-venv;python3 -m venv $HELIX_WORKITEM_PAYLOAD/.venv;source $HELIX_WORKITEM_PAYLOAD/.venv/bin/activate;export PYTHONPATH=;python3 -m pip install -U pip;pip3 install urllib3==1.26.15;pip3 install azure.storage.blob==12.0.0;pip3 install azure.storage.queue==12.0.0;sudo apt-get update;sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates;curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -;sudo apt-get -y install nodejs;sudo apt-get -y install npm;npm install --prefix $HELIX_WORKITEM_PAYLOAD jsvu -g;$HELIX_WORKITEM_PAYLOAD/bin/jsvu --os=linux64 --engines=v8,javascriptcore;export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' + - HelixPreCommandStemMusl: 'export ORIGPYPATH=$PYTHONPATH;sudo apk add icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib cargo;sudo apk add libgdiplus --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing; python3 -m venv $HELIX_WORKITEM_PAYLOAD/.venv;source $HELIX_WORKITEM_PAYLOAD/.venv/bin/activate;export PYTHONPATH=;python3 -m pip install -U pip;pip3 install urllib3==1.26.15;pip3 install azure.storage.blob==12.7.1;pip3 install azure.storage.queue==12.1.5;export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' - ExtraMSBuildLogsWindows: 'set MSBUILDDEBUGCOMM=1;set "MSBUILDDEBUGPATH=%HELIX_WORKITEM_UPLOAD_ROOT%"' - ExtraMSBuildLogsLinux: 'export MSBUILDDEBUGCOMM=1;export "MSBUILDDEBUGPATH=$HELIX_WORKITEM_UPLOAD_ROOT"' - HelixPreCommand: '' @@ -66,13 +66,16 @@ jobs: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if eq( parameters.osGroup, 'windows') }}: - HelixPreCommand: $(HelixPreCommandStemWindows);$(ExtraMSBuildLogsWindows) + - HelixPostCommand: 'set PYTHONPATH=%ORIGPYPATH%' - IsInternal: -Internal - ${{ if ne(parameters.osGroup, 'windows') }}: - ${{ if eq(parameters.osSubGroup, '_musl') }}: - - HelixPreCommand: $(HelixPreCommandStemMsul);$(ExtraMSBuildLogsLinux) + - HelixPreCommand: $(HelixPreCommandStemMusl);$(ExtraMSBuildLogsLinux) + - HelixPostCommand: 'export PYTHONPATH=$ORIGPYPATH' - IsInternal: --internal - ${{ if ne(parameters.osSubGroup, '_musl') }}: - HelixPreCommand: $(HelixPreCommandStemLinux);$(ExtraMSBuildLogsLinux) + - HelixPostCommand: 'export PYTHONPATH=$ORIGPYPATH' - IsInternal: --internal - group: DotNet-HelixApi-Access - group: dotnet-benchview @@ -82,7 +85,7 @@ jobs: - HelixPreCommand: $(ExtraMSBuildLogsWindows) - ${{ if ne(parameters.osGroup, 'windows') }}: - HelixPreCommand: $(ExtraMSBuildLogsLinux);npm install --prefix $HELIX_WORKITEM_PAYLOAD jsvu -g;$HELIX_WORKITEM_PAYLOAD/bin/jsvu --os=linux64 --engines=v8,javascriptcore - + - ${{ if and(eq(parameters.codeGenType, 'Interpreter'), eq(parameters.runtimeType, 'mono')) }}: - ${{ if eq( parameters.osGroup, 'windows') }}: @@ -132,6 +135,7 @@ jobs: HelixAccessToken: $(HelixApiAccessToken) HelixTargetQueues: $(Queue) HelixPreCommands: $(HelixPreCommand) + HelixPostCommands: $(HelixPostCommand) Creator: $(Creator) WorkItemTimeout: 4:00 # 4 hours WorkItemDirectory: '$(WorkItemDirectory)' # WorkItemDirectory can not be empty, so we send it some docs to keep it happy diff --git a/eng/pipelines/coreclr/templates/run-scenarios-job.yml b/eng/pipelines/coreclr/templates/run-scenarios-job.yml index 2fa6822205aa00..c3d78c9b529731 100644 --- a/eng/pipelines/coreclr/templates/run-scenarios-job.yml +++ b/eng/pipelines/coreclr/templates/run-scenarios-job.yml @@ -34,7 +34,7 @@ jobs: enableTelemetry: ${{ parameters.enableTelemetry }} enablePublishBuildArtifacts: true continueOnError: ${{ parameters.continueOnError }} - + ${{ if ne(parameters.displayName, '') }}: displayName: '${{ parameters.displayName }}' ${{ if eq(parameters.displayName, '') }}: @@ -59,17 +59,20 @@ jobs: - SharedHelixPreCommands: 'call %HELIX_WORKITEM_PAYLOAD%\machine-setup.cmd;set PYTHONPATH=%HELIX_WORKITEM_PAYLOAD%\scripts%3B%HELIX_WORKITEM_PAYLOAD%' - ${{ if ne(parameters.osGroup, 'windows') }}: - SharedHelixPreCommands: 'chmod +x $HELIX_WORKITEM_PAYLOAD/machine-setup.sh;. $HELIX_WORKITEM_PAYLOAD/machine-setup.sh;export PYTHONPATH=$HELIX_WORKITEM_PAYLOAD/scripts:$HELIX_WORKITEM_PAYLOAD' - + # extra private job settings - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if eq(parameters.osGroup, 'windows') }}: - - AdditionalHelixPreCommands: 'py -3 -m venv %HELIX_WORKITEM_PAYLOAD%\.venv;call %HELIX_WORKITEM_PAYLOAD%\.venv\Scripts\activate.bat;set PYTHONPATH=;py -3 -m pip install -U pip;py -3 -m pip install --user azure.storage.blob==12.0.0 --force-reinstall;py -3 -m pip install --user azure.storage.queue==12.0.0 --force-reinstall;set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"' - - IsInternal: -Internal + - AdditionalHelixPreCommands: 'set ORIGPYPATH=%PYTHONPATH%;py -3 -m venv %HELIX_WORKITEM_PAYLOAD%\.venv;call %HELIX_WORKITEM_PAYLOAD%\.venv\Scripts\activate.bat;set PYTHONPATH=;py -3 -m pip install -U pip;py -3 -m pip install --user azure.storage.blob==12.0.0;py -3 -m pip install --user azure.storage.queue==12.0.0;py -3 -m pip install --user urllib3==1.26.15;set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"' + - AdditionalHelixPostCommands: 'set PYTHONPATH=%ORIGPYPATH%' + - IsInternal: -Internal - ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.osSubGroup, '_musl')) }}: - - AdditionalHelixPreCommands: 'sudo apt-get -y install python3-venv;python3 -m venv $HELIX_WORKITEM_PAYLOAD/.venv;source $HELIX_WORKITEM_PAYLOAD/.venv/Scripts/activate;export PYTHONPATH=;python3 -m pip install -U pip;pip3 install --user azure.storage.blob==12.0.0 --force-reinstall;pip3 install --user azure.storage.queue==12.0.0 --force-reinstall;export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' + - AdditionalHelixPreCommands: 'export ORIGPYPATH=$PYTHONPATH;sudo apt-get -y install python3-venv;python3 -m venv $HELIX_WORKITEM_PAYLOAD/.venv;source $HELIX_WORKITEM_PAYLOAD/.venv/bin/activate;export PYTHONPATH=;python3 -m pip install -U pip;pip3 install --user azure.storage.blob==12.0.0;pip3 install --user azure.storage.queue==12.0.0;pip3 install --user urllib3==1.26.15;export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' + - AdditionalHelixPostCommands: 'export PYTHONPATH=$ORIGPYPATH' - IsInternal: --internal - ${{ if and(ne(parameters.osGroup, 'windows'), eq(parameters.osSubGroup, '_musl')) }}: - - AdditionalHelixPreCommands: 'sudo apk add py3-virtualenv;python3 -m venv $HELIX_WORKITEM_PAYLOAD/.venv;source $HELIX_WORKITEM_PAYLOAD/.venv/Scripts/activate;export PYTHONPATH=;python3 -m pip install -U pip;pip3 install --user azure.storage.blob==12.0.0 --force-reinstall;pip3 install --user azure.storage.queue==12.0.0 --force-reinstall;export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' + - AdditionalHelixPreCommands: 'export ORIGPYPATH=$PYTHONPATH;sudo apk add py3-virtualenv;python3 -m venv $HELIX_WORKITEM_PAYLOAD/.venv;source $HELIX_WORKITEM_PAYLOAD/.venv/bin/activate;export PYTHONPATH=;python3 -m pip install -U pip;pip3 install --user azure.storage.blob==12.0.0;pip3 install --user azure.storage.queue==12.0.0;pip3 install --user urllib3==1.26.15;export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' + - AdditionalHelixPostCommands: 'export PYTHONPATH=$ORIGPYPATH' - IsInternal: --internal - group: DotNet-HelixApi-Access - group: dotnet-benchview @@ -97,7 +100,7 @@ jobs: condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} # run ci-setup - - script: $(Python) $(PerformanceDirectory)\scripts\ci_setup.py $(SetupArguments) --install-dir $(PayloadDirectory)\dotnet --output-file $(WorkItemDirectory)\machine-setup.cmd + - script: $(Python) $(PerformanceDirectory)\scripts\ci_setup.py $(SetupArguments) --install-dir $(PayloadDirectory)\dotnet --output-file $(WorkItemDirectory)\machine-setup.cmd displayName: Run ci setup script (Windows) condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) - script: $(Python) $(PerformanceDirectory)/scripts/ci_setup.py $(SetupArguments) --install-dir $(PayloadDirectory)/dotnet --output-file $(WorkItemDirectory)/machine-setup.sh @@ -115,28 +118,28 @@ jobs: displayName: Copy scenario support files (Linux) condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) # build Startup - - script: $(PayloadDirectory)\dotnet\dotnet.exe publish -c Release -o $(WorkItemDirectory)\Startup -f netcoreapp3.1 -r win-$(Architecture) $(PerformanceDirectory)\src\tools\ScenarioMeasurement\Startup\Startup.csproj + - script: $(PayloadDirectory)\dotnet\dotnet.exe publish -c Release -o $(WorkItemDirectory)\Startup -f net6.0 -r win-$(Architecture) $(PerformanceDirectory)\src\tools\ScenarioMeasurement\Startup\Startup.csproj -p:DisableTransitiveFrameworkReferenceDownloads=true displayName: Build Startup tool (Windows) env: - PERFLAB_TARGET_FRAMEWORKS: netcoreapp3.1 + PERFLAB_TARGET_FRAMEWORKS: net6.0 condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) - - script: $(PayloadDirectory)/dotnet/dotnet publish -c Release -o $(WorkItemDirectory)/startup -f netcoreapp3.1 -r linux-$(Architecture) $(PerformanceDirectory)/src/tools/ScenarioMeasurement/Startup/Startup.csproj + - script: $(PayloadDirectory)/dotnet/dotnet publish -c Release -o $(WorkItemDirectory)/startup -f net6.0 -r linux-$(Architecture) $(PerformanceDirectory)/src/tools/ScenarioMeasurement/Startup/Startup.csproj -p:DisableTransitiveFrameworkReferenceDownloads=true displayName: Build Startup tool (Linux) env: - PERFLAB_TARGET_FRAMEWORKS: netcoreapp3.1 + PERFLAB_TARGET_FRAMEWORKS: net6.0 condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) # build SizeOnDisk - - script: $(PayloadDirectory)\dotnet\dotnet.exe publish -c Release -o $(WorkItemDirectory)\SOD -f netcoreapp3.1 -r win-$(Architecture) $(PerformanceDirectory)\src\tools\ScenarioMeasurement\SizeOnDisk\SizeOnDisk.csproj + - script: $(PayloadDirectory)\dotnet\dotnet.exe publish -c Release -o $(WorkItemDirectory)\SOD -f net6.0 -r win-$(Architecture) $(PerformanceDirectory)\src\tools\ScenarioMeasurement\SizeOnDisk\SizeOnDisk.csproj -p:DisableTransitiveFrameworkReferenceDownloads=true displayName: Build SizeOnDisk tool (Windows) env: - PERFLAB_TARGET_FRAMEWORKS: netcoreapp3.1 + PERFLAB_TARGET_FRAMEWORKS: net6.0 condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) - - script: $(PayloadDirectory)/dotnet/dotnet publish -c Release -o $(WorkItemDirectory)/SOD -f netcoreapp3.1 -r linux-$(Architecture) $(PerformanceDirectory)/src/tools/ScenarioMeasurement/SizeOnDisk/SizeOnDisk.csproj + - script: $(PayloadDirectory)/dotnet/dotnet publish -c Release -o $(WorkItemDirectory)/SOD -f net6.0 -r linux-$(Architecture) $(PerformanceDirectory)/src/tools/ScenarioMeasurement/SizeOnDisk/SizeOnDisk.csproj -p:DisableTransitiveFrameworkReferenceDownloads=true displayName: Build SizeOnDisk tool (Linux) env: - PERFLAB_TARGET_FRAMEWORKS: netcoreapp3.1 + PERFLAB_TARGET_FRAMEWORKS: net6.0 condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - + # run perf testing in helix - template: /eng/pipelines/coreclr/templates/perf-send-to-helix.yml parameters: @@ -145,6 +148,7 @@ jobs: HelixAccessToken: $(HelixApiAccessToken) HelixTargetQueues: $(Queue) HelixPreCommands: '$(AdditionalHelixPreCommands);$(SharedHelixPreCommands)' # $(HelixPreCommands) should follow $(AdditionalHelixPreCommands) because PYTHONPATH is cleared by the former + HelixPostCommands: $(AdditionalHelixPostCommands) Creator: $(Creator) WorkItemTimeout: 4:00 # 4 hours WorkItemDirectory: '$(WorkItemDirectory)' # contains scenario tools, shared python scripts, dotnet tool diff --git a/eng/pipelines/coreclr/templates/sign-diagnostic-files.yml b/eng/pipelines/coreclr/templates/sign-diagnostic-files.yml new file mode 100644 index 00000000000000..25f97276c74f26 --- /dev/null +++ b/eng/pipelines/coreclr/templates/sign-diagnostic-files.yml @@ -0,0 +1,75 @@ +parameters: + basePath: '' + isOfficialBuild: '' + timeoutInMinutes: '' + +steps: +- ${{ if and(eq(parameters.isOfficialBuild, true), ne(variables['Build.Reason'], 'PullRequest'), or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'))) }}: + - task: EsrpCodeSigning@5 + displayName: Sign Diagnostic Binaries + inputs: + ConnectedServiceName: 'diagnostics-esrp-kvcertuser' + AppRegistrationClientId: '2234cdec-a13f-4bb2-aa63-04c57fd7a1f9' + AppRegistrationTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47' + AuthAKVName: 'clrdiag-esrp-id' + AuthCertName: 'dotnetesrp-diagnostics-aad-ssl-cert' + AuthSignCertName: 'dotnet-diagnostics-esrp-pki-onecert' + FolderPath: ${{ parameters.basePath }} + Pattern: | + **/mscordaccore*.dll + **/mscordbi*.dll + UseMinimatch: true + signConfigType: 'inlineSignParams' + inlineOperation: >- + [ + { + "keyCode": "CP-471322", + "operationCode": "SigntoolSign", + "parameters": { + "OpusName": "Microsoft", + "OpusInfo": "http://www.microsoft.com", + "PageHash": "/NPH", + "FileDigest": "/fd sha256", + "TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + }, + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "KeyCode": "CP-471322", + "OperationCode": "SigntoolVerify", + "Parameters": {}, + "ToolName": "sign", + "ToolVersion": "1.0" + } + ] + SessionTimeout: ${{ parameters.timeoutInMinutes }} + MaxConcurrency: '50' + MaxRetryAttempts: '5' + PendingAnalysisWaitTimeoutMinutes: '5' + + - powershell: | + $filesToSign = $(Get-ChildItem -Recurse ${{ parameters.basePath }} -Include mscordaccore*.dll, mscordbi*.dll) + foreach ($file in $filesToSign) { + $signingCert = $(Get-AuthenticodeSignature $file).SignerCertificate + if ($signingCert -eq $null) + { + throw "File $file does not contain a signature." + } + + if ($signingCert.Subject -ne "CN=.NET DAC, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" ` + -or $signingCert.Issuer -ne "CN=Microsoft Code Signing PCA 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US") + { + throw "File $file not in expected trust chain." + } + + $certEKU = $signingCert.Extensions.Where({ $_.Oid.FriendlyName -eq "Enhanced Key Usage" }) | Select -First 1 + + if ($certEKU.EnhancedKeyUsages.Where({ $_.Value -eq "1.3.6.1.4.1.311.84.4.1" }).Count -ne 1) + { + throw "Signature for $file does not contain expected EKU." + } + + Write-Host "$file is correctly signed." + } + displayName: Validate diagnostic signatures diff --git a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml index dd27c1211844fa..7a57236ee14067 100644 --- a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml +++ b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml @@ -41,7 +41,6 @@ jobs: stagedBuild: ${{ parameters.stagedBuild }} strategy: ${{ parameters.strategy }} pool: ${{ parameters.pool }} - pgoType: ${{ parameters.pgoType }} # arcade-specific parameters condition: and(succeeded(), ${{ parameters.condition }}) @@ -67,7 +66,7 @@ jobs: # Build product defines what we are trying to build, either coreclr or mono - name: buildProductArtifactName - value: 'CoreCLRProduct_${{ parameters.pgoType }}_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' + value: 'CoreCLRProduct_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' - name: buildProductRootFolderPath value: '$(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).$(buildConfigUpper)' @@ -99,13 +98,13 @@ jobs: # We need this because both mono and coreclr build currently depends on CoreClr - name: coreClrProductArtifactName - value: 'CoreCLRProduct_${{ parameters.pgoType }}_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' + value: 'CoreCLRProduct_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' - name: coreClrProductRootFolderPath value: '$(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).$(buildConfigUpper)' - name: corelibProductArtifactName - value: 'CoreLib_${{ parameters.pgoType }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' + value: 'CoreLib_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' - name: managedGenericTestArtifactName value: 'CoreCLRManagedTestArtifacts_AnyOS_AnyCPU_$(buildConfig)' diff --git a/eng/pipelines/global-build.yml b/eng/pipelines/global-build.yml index 289f7d0033e9c2..420ba301ad12ee 100644 --- a/eng/pipelines/global-build.yml +++ b/eng/pipelines/global-build.yml @@ -133,5 +133,4 @@ jobs: - SourceBuild_Linux_x64 jobParameters: nameSuffix: SourceBuild - buildArgs: -subset clr+libs+host+packs /p:DotNetBuildFromSource=true --portableBuild false timeoutInMinutes: 90 diff --git a/eng/pipelines/installer/jobs/base-job.yml b/eng/pipelines/installer/jobs/base-job.yml index f40ab73d7d4289..6a2d1f919f22ce 100644 --- a/eng/pipelines/installer/jobs/base-job.yml +++ b/eng/pipelines/installer/jobs/base-job.yml @@ -12,7 +12,6 @@ parameters: container: '' buildSteps: [] dependsOn: [] - dependsOnGlobalBuild: false dependOnEvaluatePaths: false globalBuildSuffix: '' variables: [] @@ -20,7 +19,6 @@ parameters: displayName: '' runtimeVariant: '' pool: '' - pgoType: '' packageDistroList: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-14.04-debpkg-e5cf912-20175003025046 @@ -39,8 +37,8 @@ parameters: platforms: [] jobs: -- job: ${{ format('installer_{0}_{1}_{2}_{3}_{4}_', parameters.pgoType, parameters.runtimeFlavor, parameters.runtimeVariant, coalesce(parameters.name, parameters.platform), parameters.buildConfig) }} - displayName: ${{ format('{0} Installer Build and Test {1} {2} {3} {4}', parameters.pgoType, parameters.runtimeFlavor, parameters.runtimeVariant, coalesce(parameters.name, parameters.platform), parameters.buildConfig) }} +- job: ${{ format('installer_{0}_{1}_{2}_{3}_', parameters.runtimeFlavor, parameters.runtimeVariant, coalesce(parameters.name, parameters.platform), parameters.buildConfig) }} + displayName: ${{ format('Installer Build and Test {0} {1} {2} {3}', parameters.runtimeFlavor, parameters.runtimeVariant, coalesce(parameters.name, parameters.platform), parameters.buildConfig) }} condition: and(succeeded(), ${{ parameters.condition }}) pool: ${{ parameters.pool }} @@ -65,8 +63,7 @@ jobs: not(in(parameters.archType, 'x64', 'x86')), eq(parameters.runtimeFlavor, 'mono'), eq(parameters.isOfficialBuild, true), - eq(parameters.crossBuild, true), - eq(parameters.pgoType, 'PGO')) }} + eq(parameters.crossBuild, true)) }} - name: BuildAction value: -test @@ -78,12 +75,6 @@ jobs: - name: SignType value: test - - name: pgoInstrumentArg - value: '' - - ${{ if eq(parameters.pgoType, 'PGO' )}}: - - name: pgoInstrumentArg - value: '-pgoinstrument ' - # Set up non-PR build from internal project - ${{ if eq(parameters.isOfficialBuild, true) }}: - name: SignType @@ -98,6 +89,9 @@ jobs: ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}: value: '/root/runtime/' + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - group: AzureDevOps-Artifact-Feeds-Pats + ### ### Platform-specific variable setup ### @@ -123,7 +117,6 @@ jobs: build.cmd -subset host+packs -ci $(BuildAction) -configuration $(_BuildConfig) - $(pgoInstrumentArg) $(LiveOverridePathArgs) $(CommonMSBuildArgs) $(MsbuildSigningArguments) @@ -225,7 +218,6 @@ jobs: /p:CrossBuild=${{ parameters.crossBuild }} /p:PortableBuild=$(_PortableBuild) /p:SkipTests=$(SkipTests) - $(pgoInstrumentArg) $(LiveOverridePathArgs) $(CommonMSBuildArgs) $(OutputRidArg) @@ -287,7 +279,7 @@ jobs: /p:RuntimeArtifactsPath=$(buildCommandSourcesDirectory)$(RuntimeDownloadPath) /p:RuntimeConfiguration=${{ parameters.liveRuntimeBuildConfig }} - name: RuntimeArtifactName - value: $(runtimeFlavorName)Product_${{ parameters.pgoType }}_${{ parameters.runtimeVariant }}_$(liveRuntimeLegName) + value: $(runtimeFlavorName)Product_${{ parameters.runtimeVariant }}_$(liveRuntimeLegName) - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}: - name: liveLibrariesLegName @@ -308,14 +300,13 @@ jobs: - evaluate_paths - ${{ parameters.dependsOn }} - ${{ if ne(parameters.liveRuntimeBuildConfig, '') }}: - - ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}{6}', + - ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, - parameters.liveRuntimeBuildConfig, - parameters.pgoType) }} + parameters.liveRuntimeBuildConfig) }} - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}: - libraries_build_${{ format('{0}{1}_{2}_{3}', parameters.osGroup, @@ -341,7 +332,7 @@ jobs: displayName: Clean up old artifacts owned by root - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 - ${{ if eq(parameters.osGroup, 'windows') }}: # NuGet's http cache lasts 30 minutes. If we're on a static machine, this may interfere with @@ -356,7 +347,7 @@ jobs: zipSources: false feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json continueOnError: false - condition: and(succeeded(), in(variables['SignType'], 'real', 'test')) + condition: and(succeeded(), in(variables['SignType'], 'real', 'test'), eq(${{ parameters.isOfficialBuild }}, true)) - checkout: self clean: true @@ -379,7 +370,7 @@ jobs: displayName: 'Libraries artifacts' cleanUnpackFolder: false - - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO displayName: Install Build Dependencies @@ -388,6 +379,24 @@ jobs: df -h displayName: Disk Usage before Build + - ${{ if ne(variables['System.TeamProject'], 'public') }}: + - ${{ if ne(parameters.osGroup, 'windows') }}: + - task: Bash@3 + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh + arguments: $(Build.SourcesDirectory)/NuGet.config $Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) + - ${{ if eq(parameters.osGroup, 'windows') }}: + - task: PowerShell@2 + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) + # Build the default subset non-MacOS platforms - ${{ if ne(parameters.osGroup, 'OSX') }}: - script: $(BaseJobBuildCommand) @@ -422,18 +431,20 @@ jobs: displayName: Disk Usage after Build # Only in glibc leg, we produce RPMs and Debs - - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), eq(parameters.platform, 'Linux_x64'), eq(parameters.osSubgroup, ''), eq(parameters.pgoType, ''))}}: + - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), or(eq(parameters.platform, 'Linux_x64'), eq(parameters.platform, 'Linux_arm64')), eq(parameters.osSubgroup, ''))}}: - ${{ each packageBuild in parameters.packageDistroList }}: # This leg's RID matches the build image. Build its distro-dependent packages, as well as # the distro-independent installers. (There's no particular reason to build the distro- # independent installers on this leg, but we need to do it somewhere.) - - template: steps/build-linux-package.yml - parameters: - packageType: ${{ packageBuild.packageType }} - image: ${{ packageBuild.image }} - packageStepDescription: Runtime Deps, Runtime, Framework Packs installers - subsetArg: $(installersSubsetArg) - packagingArgs: ${{ packageBuild.packagingArgs }} + # Currently, Linux_arm64 supports 'rpm' type only. + - ${{ if or(not(eq(parameters.platform, 'Linux_arm64')), eq(packageBuild.packageType, 'rpm')) }}: + - template: steps/build-linux-package.yml + parameters: + packageType: ${{ packageBuild.packageType }} + image: ${{ packageBuild.image }} + packageStepDescription: Runtime Deps, Runtime, Framework Packs installers + subsetArg: $(installersSubsetArg) + packagingArgs: ${{ packageBuild.packagingArgs }} - ${{ if ne(parameters.container, '') }}: # Files may be owned by root because builds don't set user ID. Later build steps run 'find' in @@ -471,7 +482,6 @@ jobs: runtimeVariant: ${{ parameters.runtimeVariant }} skipTests: $(SkipTests) isOfficialBuild: ${{ eq(parameters.isOfficialBuild, true) }} - pgoType: ${{ parameters.pgoType }} - ${{ if ne(parameters.osGroup, 'windows') }}: - script: set -x && df -h diff --git a/eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml b/eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml index b45ff4cedc0523..30032b7da22eee 100644 --- a/eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml +++ b/eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml @@ -3,7 +3,6 @@ parameters: runtimeFlavor: 'coreclr' runtimeVariant: '' isOfficialBuild: false - pgoType: '' steps: # Upload build artifacts (packages) to pipeline only if official, to save storage space. @@ -39,6 +38,6 @@ steps: displayName: Publish BuildLogs inputs: targetPath: '$(Build.StagingDirectory)/BuildLogs' - artifactName: Installer-Logs-${{parameters.pgoType }}${{ parameters.runtimeFlavor }}-${{ parameters.runtimeVariant }}-${{ parameters.name }}-$(_BuildConfig) + artifactName: Installer-Logs-${{ parameters.runtimeFlavor }}-${{ parameters.runtimeVariant }}-${{ parameters.name }}-$(_BuildConfig) continueOnError: true condition: succeededOrFailed() diff --git a/eng/pipelines/libraries/base-job.yml b/eng/pipelines/libraries/base-job.yml index 9c5cff7cc5e81f..00adbce6bce703 100644 --- a/eng/pipelines/libraries/base-job.yml +++ b/eng/pipelines/libraries/base-job.yml @@ -6,7 +6,6 @@ parameters: crossBuild: false crossrootfsDir: '' framework: 'net6.0' - isOfficialAllConfigurations: false isSourceBuild: false liveRuntimeBuildConfig: '' runtimeFlavor: 'coreclr' @@ -23,17 +22,12 @@ parameters: testScope: '' pool: '' runTests: false - pgoType: '' jobs: - template: /eng/common/templates/job/job.yml parameters: - ${{ if notIn(parameters.framework, 'allConfigurations', 'net48') }}: - displayName: ${{ format('Libraries {0} {1}{2} {3} {4}', parameters.displayName, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} - name: ${{ format('libraries_{0}_{1}{2}_{3}_{4}', parameters.name, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} - ${{ if in(parameters.framework, 'allConfigurations', 'net48') }}: - displayName: ${{ format('Libraries {0} {1} {2} {3} {4}', parameters.displayName, parameters.osGroup, parameters.framework, parameters.archType, parameters.buildConfig) }} - name: ${{ format('libraries_{0}_{1}_{2}{3}_{4}_{5}', parameters.name, parameters.framework, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} + displayName: ${{ format('Libraries {0} {1}{2} {3} {4}', parameters.displayName, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} + name: ${{ format('libraries_{0}_{1}{2}_{3}_{4}', parameters.name, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} enableTelemetry: ${{ parameters.isOfficialBuild }} # TODO: figure out if it's needed container: ${{ parameters.container }} @@ -41,6 +35,10 @@ jobs: helixRepo: dotnet/runtime pool: ${{ parameters.pool }} variables: + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - group: DotNet-HelixApi-Access + - group: AzureDevOps-Artifact-Feeds-Pats + - _buildScriptFileName: build - _msbuildCommonParameters: '' @@ -67,7 +65,7 @@ jobs: - _runtimeOSArg: /p:RuntimeOS=linux-musl - ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, ''), eq(parameters.archType, 'arm')) }}: - - _runtimeOSArg: /p:RuntimeOS=ubuntu.16.04 + - _runtimeOSArg: /p:RuntimeOS=ubuntu.22.04 # force a value for OS when cross-building - ${{ if in(parameters.osGroup, 'Browser', 'iOS', 'tvOS', 'Android', 'FreeBSD') }}: @@ -77,14 +75,7 @@ jobs: - _finalFrameworkArg: -framework ${{ parameters.framework }} - _extraHelixArguments: /p:BuildTargetFramework=${{ parameters.framework }} - - ${{ if eq(parameters.framework, 'allConfigurations') }}: - - _finalFrameworkArg: -allConfigurations - - _testModeArg: /p:TestAssemblies=false /p:TestPackages=true - - - ${{ if eq(parameters.isOfficialAllConfigurations, true) }}: - - librariesBuildArtifactName: 'libraries_bin_official_allconfigurations' - - - ${{ if eq(parameters.isOfficialBuild, 'true') }}: + - ${{ if eq(parameters.isOfficialBuild, true) }}: - _msbuildCommonParameters: /p:OfficialBuildId=$(Build.BuildNumber) - _runtimeArtifactName: '' @@ -96,7 +87,7 @@ jobs: - _runtimeDownloadPath: '$(Build.SourcesDirectory)/artifacts/transport/${{ parameters.runtimeFlavor }}' - _runtimeConfigurationArg: -rc ${{ parameters.liveRuntimeBuildConfig }} - ${{ if eq(parameters.runTests, true) }}: - - _runtimeArtifactName: '$(runtimeFlavorName)Product_${{ parameters.pgoType }}_${{ parameters.runtimeVariant}}_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.liveRuntimeBuildConfig }}' + - _runtimeArtifactName: '$(runtimeFlavorName)Product_${{ parameters.runtimeVariant}}_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.liveRuntimeBuildConfig }}' - _runtimeArtifactsPathArg: ' /p:RuntimeArtifactsPath=$(_runtimeDownloadPath)' - ${{ if eq(parameters.testDisplayName, '') }}: - _testRunNamePrefixSuffix: $(runtimeFlavorName)_${{ parameters.liveRuntimeBuildConfig }} @@ -140,4 +131,22 @@ jobs: artifactName: '$(_runtimeArtifactName)' displayName: '$(runtimeFlavorName) build drop' + - ${{ if ne(variables['System.TeamProject'], 'public') }}: + - ${{ if ne(parameters.osGroup, 'windows') }}: + - task: Bash@3 + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh + arguments: $(Build.SourcesDirectory)/NuGet.config $Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) + - ${{ if eq(parameters.osGroup, 'windows') }}: + - task: PowerShell@2 + displayName: Setup Private Feeds Credentials + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token + env: + Token: $(dn-bot-dnceng-artifact-feeds-rw) + - ${{ parameters.steps }} diff --git a/eng/pipelines/libraries/build-job.yml b/eng/pipelines/libraries/build-job.yml index 4faaff1ac7036a..7577004470f945 100644 --- a/eng/pipelines/libraries/build-job.yml +++ b/eng/pipelines/libraries/build-job.yml @@ -8,29 +8,17 @@ parameters: crossrootfsDir: '' framework: 'net6.0' isOfficialBuild: false - isOfficialAllConfigurations: false runtimeVariant: '' platform: '' - - # When set to a non-empty value (Debug / Release), it determines the runtime's - # build configuration to use for building libraries and tests. Setting this - # property implies a dependency of this job on the appropriate runtime build - # and is used to construct the name of the Azure artifact representing - # runtime build to use for building the libraries and library tests. - liveRuntimeBuildConfig: '' - runtimeFlavor: 'coreclr' + testScope: '' timeoutInMinutes: 150 - preBuildSteps: [] container: '' condition: true dependOnEvaluatePaths: false shouldContinueOnError: false variables: {} pool: '' - runTests: false - useHelix: true - testScope: '' testBuildPlatforms: [] jobs: @@ -44,12 +32,9 @@ jobs: crossrootfsDir: ${{ parameters.crossrootfsDir }} framework: ${{ parameters.framework }} isOfficialBuild: ${{ parameters.isOfficialBuild }} - isOfficialAllConfigurations: ${{ parameters.isOfficialAllConfigurations }} - liveRuntimeBuildConfig: ${{ parameters.liveRuntimeBuildConfig }} runtimeFlavor: ${{ parameters.runtimeFlavor }} - runTests: ${{ parameters.runTests }} + runTests: false timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - preBuildSteps: ${{ parameters.preBuildSteps }} container: ${{ parameters.container }} condition: ${{ parameters.condition }} dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }} @@ -59,34 +44,15 @@ jobs: name: build displayName: 'Build' - ${{ if and(ne(parameters.liveRuntimeBuildConfig, ''), eq(parameters.runTests, true)) }}: - dependsOn: - # Use full product dependency for test runs - - ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveRuntimeBuildConfig) }} - variables: - librariesTestsArtifactName: ${{ format('libraries_test_assets_{0}_{1}_{2}', parameters.osGroup, parameters.archType, parameters.buildConfig) }} - - _subset: libs + - _subset: libs+libs.tests - _buildAction: '' - - _additionalBuildArguments: '' - - ${{ parameters.variables }} - - # Tests only run for 'allConfiguration' and 'net48' build-jobs - # If platform is in testBuildPlatforms we build tests as well. - - ${{ if or(eq(parameters.runTests, true), containsValue(parameters.testBuildPlatforms, parameters.platform)) }}: - - _subset: libs+libs.tests - - ${{ if eq(parameters.useHelix, false) }}: - - _buildAction: -restore -build -test - - ${{ if eq(parameters.useHelix, true) }}: - - _additionalBuildArguments: /p:ArchiveTests=true - + - _additionalBuildArguments: '/p:ArchiveTests=true' - ${{ parameters.variables }} steps: - - ${{ if eq(parameters.isOfficialBuild, true) }}: - - template: /eng/pipelines/common/restore-internal-tools.yml - - - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO displayName: Install Build Dependencies @@ -108,55 +74,26 @@ jobs: df -h displayName: Disk Usage after Build - - ${{ if eq(parameters.runTests, false) }}: - - template: /eng/pipelines/libraries/prepare-for-bin-publish.yml - parameters: - isOfficialBuild: ${{ parameters.isOfficialBuild }} - - - template: /eng/pipelines/common/upload-artifact-step.yml - parameters: - rootFolder: $(Build.ArtifactStagingDirectory)/artifacts - includeRootFolder: false - archiveType: $(archiveType) - archiveExtension: $(archiveExtension) - tarCompression: $(tarCompression) - artifactName: $(librariesBuildArtifactName) - displayName: Build Assets - - - ${{ if containsValue(parameters.testBuildPlatforms, parameters.platform) }}: - - template: /eng/pipelines/common/upload-artifact-step.yml - parameters: - rootFolder: $(Build.SourcesDirectory)/artifacts/helix - includeRootFolder: true - archiveType: $(archiveType) - archiveExtension: $(archiveExtension) - tarCompression: $(tarCompression) - artifactName: $(librariesTestsArtifactName) - displayName: Test Assets - - # Save AllConfigurations artifacts using the prepare-signed-artifacts format. The - # platform-specific jobs' nupkgs automatically flow through the matching platform-specific - # Installer build, but AllConfigurations should only be uploaded once, here. - - ${{ if eq(parameters.isOfficialAllConfigurations, true) }}: - - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml - parameters: - name: Libraries_AllConfigurations - publishPackagesCondition: >- - or( - eq(variables['_librariesBuildProducedPackages'], true), - eq(variables['Build.SourceBranchName'], 'main'), - eq(variables['System.PullRequest.TargetBranch'], 'main')) - - - ${{ if and(eq(parameters.runTests, true), eq(parameters.useHelix, true)) }}: - - template: /eng/pipelines/libraries/helix.yml - parameters: - osGroup: ${{ parameters.osGroup }} - targetRid: ${{ parameters.targetRid }} - archType: ${{ parameters.archType }} - buildConfig: ${{ parameters.buildConfig }} - helixQueues: ${{ parameters.helixQueues }} - testScope: ${{ parameters.testScope }} - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - creator: dotnet-bot - testRunNamePrefixSuffix: $(_testRunNamePrefixSuffix) - extraHelixArguments: $(_extraHelixArguments) + - template: /eng/pipelines/libraries/prepare-for-bin-publish.yml + + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: $(Build.ArtifactStagingDirectory)/artifacts + includeRootFolder: false + archiveType: $(archiveType) + archiveExtension: $(archiveExtension) + tarCompression: $(tarCompression) + artifactName: $(librariesBuildArtifactName) + displayName: Build Assets + + # Upload test assets + # We'll pull them down in another job to send to Helix + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: $(Build.SourcesDirectory)/artifacts/helix + includeRootFolder: true + archiveType: $(archiveType) + archiveExtension: $(archiveExtension) + tarCompression: $(tarCompression) + artifactName: $(librariesTestsArtifactName) + displayName: Test Assets \ No newline at end of file diff --git a/eng/pipelines/libraries/enterprise/linux.yml b/eng/pipelines/libraries/enterprise/linux.yml index 754b533564e3f4..6254a2d9c17ae4 100644 --- a/eng/pipelines/libraries/enterprise/linux.yml +++ b/eng/pipelines/libraries/enterprise/linux.yml @@ -18,9 +18,6 @@ pr: - src/libraries/System.Net.Http/* - src/libraries/System.Net.Security/* -pool: - vmImage: 'ubuntu-16.04' - variables: - template: ../variables.yml - name: enterpriseTestsSetup @@ -30,45 +27,54 @@ variables: - name: containerLibrariesRoot value: /repo/src/libraries -steps: -- bash: | - cd $(enterpriseTestsSetup) - docker-compose build - displayName: Build test machine images - env: - DOTNET_RUNTIME_REPO_ROOT: $(Build.SourcesDirectory) +jobs: +- job: EnterpriseLinuxTests + timeoutInMinutes: 120 + pool: + name: NetCore-Svc-Public + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open + steps: + - bash: | + cd $(enterpriseTestsSetup) + docker-compose build + displayName: Build test machine images + env: + DOTNET_RUNTIME_REPO_ROOT: $(Build.SourcesDirectory) -- bash: | - cd $(enterpriseTestsSetup) - docker-compose up -d - displayName: Start test network and machines - env: - DOTNET_RUNTIME_REPO_ROOT: $(Build.SourcesDirectory) + - bash: | + cd $(enterpriseTestsSetup) + docker-compose up -d + displayName: Start test network and machines + env: + DOTNET_RUNTIME_REPO_ROOT: $(Build.SourcesDirectory) -- bash: | - docker exec linuxclient bash /setup/test-webserver.sh - displayName: Test linuxclient connection to web server + - bash: | + docker exec linuxclient bash /setup/test-webserver.sh + displayName: Test linuxclient connection to web server -- bash: | - docker exec linuxclient bash -c '/repo/build.sh -subset clr+libs -runtimeconfiguration release -ci' - displayName: Build product sources + - bash: | + docker exec linuxclient bash -c '/repo/build.sh -subset clr+libs -runtimeconfiguration release -ci /p:NoPgoOptimize=true' + docker exec linuxclient bash -c '/repo/dotnet.sh build $(containerLibrariesRoot)/System.Net.Http/tests/EnterpriseTests/System.Net.Http.Enterprise.Tests.csproj' + docker exec linuxclient bash -c '/repo/dotnet.sh build $(containerLibrariesRoot)/System.Net.Security/tests/EnterpriseTests/System.Net.Security.Enterprise.Tests.csproj' + displayName: Build product sources -- bash: | - docker exec linuxclient $(containerRunTestsCommand) $(containerLibrariesRoot)/System.Net.Http/tests/EnterpriseTests/System.Net.Http.Enterprise.Tests.csproj - docker exec linuxclient $(containerRunTestsCommand) $(containerLibrariesRoot)/System.Net.Security/tests/EnterpriseTests/System.Net.Security.Enterprise.Tests.csproj - displayName: Build and run tests + - bash: | + docker exec linuxclient bash -c 'if [ -f /erc/resolv.conf.ORI ]; then cp -f /erc/resolv.conf.ORI /etc/resolv.conf; fi' + docker exec linuxclient $(containerRunTestsCommand) $(containerLibrariesRoot)/System.Net.Http/tests/EnterpriseTests/System.Net.Http.Enterprise.Tests.csproj + docker exec linuxclient $(containerRunTestsCommand) $(containerLibrariesRoot)/System.Net.Security/tests/EnterpriseTests/System.Net.Security.Enterprise.Tests.csproj + displayName: Build and run tests -- bash: | - cd $(enterpriseTestsSetup) - docker-compose down - displayName: Stop test network and machines - env: - DOTNET_RUNTIME_REPO_ROOT: $(Build.SourcesDirectory) + - bash: | + cd $(enterpriseTestsSetup) + docker-compose down + displayName: Stop test network and machines + env: + DOTNET_RUNTIME_REPO_ROOT: $(Build.SourcesDirectory) -- task: PublishTestResults@2 - inputs: - testRunner: 'xUnit' - testResultsFiles: '**/testResults.xml' - testRunTitle: 'Enterprise Tests' - mergeTestResults: true - failTaskOnFailedTests: true + - task: PublishTestResults@2 + inputs: + testRunner: 'xUnit' + testResultsFiles: '**/testResults.xml' + testRunTitle: 'Enterprise Tests' + mergeTestResults: true + failTaskOnFailedTests: true diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index b7690e833d2d25..28f9a23a04e6a0 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -29,61 +29,60 @@ jobs: # Linux arm - ${{ if eq(parameters.platform, 'Linux_arm') }}: - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}: - - (Debian.9.Arm32.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-9-helix-arm32v7-bfcd90a-20200121150037 + - (Debian.10.Arm32.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-arm32v7 + - (Debian.11.Arm32.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-arm32v7 # 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 + - (Ubuntu.1804.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8 - ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}: - - (Ubuntu.1804.ArmArch.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-helix-arm64v8-20210106155927-56c6673 + - (Ubuntu.1804.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8 # Linux musl x64 - ${{ if eq(parameters.platform, 'Linux_musl_x64') }}: - - ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}: - - (Alpine.312.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.12-helix-20200602002622-e06dc59 + - (Alpine.316.Amd64.Open)ubuntu.2204.amd64.open.svc@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-amd64 - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}: - - (Alpine.312.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.12-helix-20200601195603-e06dc59 + - (Alpine.319.Amd64.Open)ubuntu.2204.amd64.open.svc@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-helix-amd64 # Linux musl arm64 - - ${{ if eq(parameters.platform, 'Linux_musl_arm64') }}: - - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}: - - (Alpine.312.Arm64.Open)ubuntu.1804.armarch.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.12-helix-arm64v8-20200602002604-25f8a3e + - ${{ if and(eq(parameters.platform, 'Linux_musl_arm64'), eq(parameters.jobParameters.isFullMatrix, true)) }}: + - (Alpine.316.Arm64.Open)ubuntu.2204.armarch.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm64v8 + - (Alpine.319.Arm64.Open)ubuntu.2204.armarch.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-helix-arm64v8 # Linux x64 - ${{ if eq(parameters.platform, 'Linux_x64') }}: - ${{ if and(eq(parameters.jobParameters.interpreter, ''), ne(parameters.jobParameters.isSingleFile, true)) }}: - ${{ if and(eq(parameters.jobParameters.testScope, 'outerloop'), eq(parameters.jobParameters.runtimeFlavor, 'mono')) }}: - - (Centos.8.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759 - RedHat.7.Amd64.Open - SLES.15.Amd64.Open - - (Fedora.34.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210728124700-4f64125 - - (Ubuntu.1910.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-19.10-helix-amd64-cfcfd50-20191030180623 - - (Debian.10.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006 + - (Fedora.34.Amd64.Open)ubuntu.2204.amd64.open.svc@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix + - ubuntu.2204.amd64.open.svc + - (Debian.10.Amd64.Open)ubuntu.2204.amd64.open.svc@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64 - ${{ if or(ne(parameters.jobParameters.testScope, 'outerloop'), ne(parameters.jobParameters.runtimeFlavor, 'mono')) }}: - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}: - - (Centos.8.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759 + - (Centos.7.Amd64.Open)Ubuntu.2204.Amd64.Open.svc@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-mlnet-helix - RedHat.7.Amd64.Open - - Debian.9.Amd64.Open - - Ubuntu.1604.Amd64.Open - Ubuntu.1804.Amd64.Open - SLES.12.Amd64.Open - SLES.15.Amd64.Open - - (Fedora.34.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210728124700-4f64125 - - (Ubuntu.1910.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-19.10-helix-amd64-cfcfd50-20191030180623 - - (Debian.10.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006 - - (Mariner.1.0.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-1.0-helix-20210528192219-92bf620 + - (Fedora.34.Amd64.Open)ubuntu.2204.amd64.open.svc@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix + - ubuntu.2204.amd64.open.svc + - (Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64 + - (Debian.11.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64 + - (Mariner.1.0.Amd64.Open)ubuntu.2204.amd64.open.svc@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-1.0-helix - ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}: - - (Centos.8.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759 + - (Centos.7.Amd64.Open)Ubuntu.2204.Amd64.Open.svc@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-mlnet-helix - RedHat.7.Amd64.Open - - (Debian.10.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006 - - Ubuntu.1604.Amd64.Open + - (Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64 - Ubuntu.1804.Amd64.Open - - SLES.15.Amd64.Open - - (Fedora.34.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210728124700-4f64125 - ${{ if or(eq(parameters.jobParameters.interpreter, 'true'), eq(parameters.jobParameters.isSingleFile, true)) }}: # Limiting interp runs as we don't need as much coverage. - - Debian.9.Amd64.Open + - (Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64 + + # Linux s390x + - ${{ if eq(parameters.platform, 'Linux_s390x') }}: + - Ubuntu.2004.S390X.Experimental.Open # OSX arm64 - ${{ if eq(parameters.platform, 'OSX_arm64') }}: @@ -91,17 +90,11 @@ jobs: # OSX x64 - ${{ if eq(parameters.platform, 'OSX_x64') }}: - - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}: - - OSX.1013.Amd64.Open - - OSX.1014.Amd64.Open - - OSX.1015.Amd64.Open - - ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}: - - OSX.1014.Amd64.Open - - OSX.1015.Amd64.Open + - OSX.1200.Amd64.Open # Android - ${{ if in(parameters.platform, 'Android_x86', 'Android_x64') }}: - - Ubuntu.1804.Amd64.Android.Open + - Ubuntu.1804.Amd64.Android.29.Open - ${{ if in(parameters.platform, 'Android_arm', 'Android_arm64') }}: - Windows.10.Amd64.Android.Open @@ -111,15 +104,15 @@ jobs: # iOS/tvOS simulator x64/x86 & MacCatalyst x64 - ${{ if in(parameters.platform, 'iOSSimulator_x64', 'iOSSimulator_x86', 'tvOSSimulator_x64', 'MacCatalyst_x64') }}: - - OSX.1015.Amd64.Open + - OSX.1200.Amd64.Open # iOS devices - ${{ if in(parameters.platform, 'iOS_arm64') }}: - - OSX.1015.Amd64.Iphone.Open + - OSX.13.Amd64.Iphone.Open # tvOS devices - ${{ if in(parameters.platform, 'tvOS_arm64') }}: - - OSX.1015.Amd64.AppleTV.Open + - OSX.13.Amd64.AppleTV.Open # windows x64 - ${{ if eq(parameters.platform, 'windows_x64') }}: @@ -127,57 +120,55 @@ jobs: - ${{ if notIn(parameters.jobParameters.framework, 'net48') }}: - ${{ if and(eq(parameters.jobParameters.testScope, 'outerloop'), eq(parameters.jobParameters.runtimeFlavor, 'mono')) }}: - Windows.81.Amd64.Open - - Windows.10.Amd64.Server19H1.Open + - Windows.Amd64.Server2022.Open - ${{ if or(ne(parameters.jobParameters.testScope, 'outerloop'), ne(parameters.jobParameters.runtimeFlavor, 'mono')) }}: - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}: - Windows.81.Amd64.Open - Windows.10.Amd64.ServerRS5.Open - - Windows.10.Amd64.Server19H1.Open + - Windows.Amd64.Server2022.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 - - (Windows.Server.Core.1909.Amd64.Open)windows.10.amd64.server20h1.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-2004-helix-amd64-20200904200251-272704c + - (Windows.Nano.1809.Amd64.Open)windows.10.amd64.serverrs5.open@mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64 + - (Windows.Server.Core.ltsc2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-amd64 - ${{ if ne(parameters.jobParameters.isFullMatrix, true) }}: - Windows.81.Amd64.Open - - Windows.10.Amd64.Server19H1.ES.Open + - Windows.Amd64.Server2022.Open + - Windows.11.Amd64.Client.Open - ${{ if eq(parameters.jobParameters.testScope, 'outerloop') }}: - - (Windows.Server.Core.1909.Amd64.Open)windows.10.amd64.server20h1.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-2004-helix-amd64-20200904200251-272704c + - (Windows.Server.Core.ltsc2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-amd64 - ${{ 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 + - (Windows.Nano.1809.Amd64.Open)windows.10.amd64.serverrs5.open@mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64 # .NETFramework - ${{ if eq(parameters.jobParameters.framework, 'net48') }}: - - Windows.10.Amd64.Client19H1.Open + - Windows.10.Amd64.Client.Open # windows x86 - ${{ if eq(parameters.platform, 'windows_x86') }}: # netcoreapp - ${{ if notIn(parameters.jobParameters.framework, 'net48') }}: - ${{ if and(eq(parameters.jobParameters.testScope, 'outerloop'), eq(parameters.jobParameters.runtimeFlavor, 'mono')) }}: - - Windows.7.Amd64.Open - Windows.10.Amd64.ServerRS5.Open - ${{ if or(ne(parameters.jobParameters.testScope, 'outerloop'), ne(parameters.jobParameters.runtimeFlavor, 'mono')) }}: - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}: - - Windows.7.Amd64.Open - Windows.10.Amd64.ServerRS5.Open - - Windows.10.Amd64.Server19H1.Open + - Windows.Amd64.Server2022.Open - ${{ if ne(parameters.jobParameters.isFullMatrix, true) }}: - ${{ if eq(parameters.jobParameters.buildConfig, 'Release') }}: - - Windows.10.Amd64.Server19H1.ES.Open + - Windows.Amd64.Server2022.Open - ${{ if eq(parameters.jobParameters.buildConfig, 'Debug') }}: - - Windows.7.Amd64.Open - - Windows.10.Amd64.Server19H1.Open + - Windows.Amd64.Server2022.Open # .NETFramework - ${{ if eq(parameters.jobParameters.framework, 'net48') }}: - - Windows.10.Amd64.Client19H1.Open + - Windows.10.Amd64.Client.Open # windows arm - ${{ if eq(parameters.platform, 'windows_arm') }}: - - Windows.10.Arm64v8.Open + - Windows.11.Arm64.Open # windows arm64 - ${{ if eq(parameters.platform, 'windows_arm64') }}: - - Windows.10.Arm64.Open + - Windows.11.Arm64.Open # WebAssembly - ${{ if eq(parameters.platform, 'Browser_wasm') }}: @@ -185,6 +176,6 @@ jobs: # WebAssembly windows - ${{ if eq(parameters.platform, 'Browser_wasm_win') }}: - - (Windows.Server.Core.1909.Amd64.Open)windows.10.amd64.server20h1.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-2004-helix-webassembly-amd64-20210702131541-6837048 + - (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly ${{ insert }}: ${{ parameters.jobParameters }} diff --git a/eng/pipelines/libraries/helix.yml b/eng/pipelines/libraries/helix.yml index a8b6517efeb874..cb3b70890fd590 100644 --- a/eng/pipelines/libraries/helix.yml +++ b/eng/pipelines/libraries/helix.yml @@ -26,7 +26,6 @@ steps: /p:TestScope=${{ parameters.testScope }} /p:TestRunNamePrefixSuffix=${{ parameters.testRunNamePrefixSuffix }} /p:HelixBuild=$(Build.BuildNumber) - /p:Creator=${{ parameters.creator }} ${{ parameters.extraHelixArguments }} /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog displayName: Send to Helix @@ -34,5 +33,12 @@ steps: continueOnError: ${{ eq(parameters.shouldContinueOnError, true) }} env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops - HelixTargetQueues: ${{ join('+', parameters.helixQueues) }} # Pass queues to MSBuild as env var to avoid need of escaping them _Scenarios: ${{ join(',', parameters.scenarios) }} # Pass scenarios to MSBuild as env var to avoid need of escaping comma separated list + + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + HelixAccessToken: $(HelixApiAccessToken) + HelixTargetQueues: ${{ replace(lower(join('+', parameters.helixQueues)), '.open', '') }} + Creator: '' + ${{ if eq(variables['System.TeamProject'], 'public') }}: + HelixTargetQueues: ${{ join('+', parameters.helixQueues) }} + Creator: ${{ parameters.creator }} diff --git a/eng/pipelines/libraries/outerloop-mono.yml b/eng/pipelines/libraries/outerloop-mono.yml index f73f0c1e03c323..7c944b2c9a5072 100644 --- a/eng/pipelines/libraries/outerloop-mono.yml +++ b/eng/pipelines/libraries/outerloop-mono.yml @@ -36,13 +36,14 @@ jobs: timeoutInMinutes: 180 isFullMatrix: ${{ variables['isFullMatrix'] }} # extra steps, run tests - extraStepsTemplate: /eng/pipelines/libraries/helix.yml - extraStepsParameters: - scenarios: - - wasmtestonbrowser - testScope: outerloop - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + scenarios: + - wasmtestonbrowser + testScope: outerloop + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) - ${{ if eq(variables['isFullMatrix'], false) }}: - template: /eng/pipelines/common/platform-matrix.yml @@ -63,8 +64,9 @@ jobs: timeoutInMinutes: 180 isFullMatrix: ${{ variables['isFullMatrix'] }} # extra steps, run tests - extraStepsTemplate: /eng/pipelines/libraries/helix.yml - extraStepsParameters: - testScope: outerloop - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + testScope: outerloop + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) diff --git a/eng/pipelines/libraries/run-test-job.yml b/eng/pipelines/libraries/run-test-job.yml index 3e9d2de85f49fb..90235ef9921fc8 100644 --- a/eng/pipelines/libraries/run-test-job.yml +++ b/eng/pipelines/libraries/run-test-job.yml @@ -55,11 +55,11 @@ jobs: testDisplayName: ${{ parameters.runtimeFlavor }}_interpreter_${{ parameters.liveRuntimeBuildConfig }} # To run the tests we just send to helix and wait, use ubuntu hosted pools for faster providing and to not back up our build pools - ${{ if startsWith(parameters.pool.queue, 'BuildPool.Ubuntu') }}: + ${{ if startsWith(parameters.pool.queue, 'Build.Ubuntu') }}: pool: vmImage: 'ubuntu-latest' - ${{ if not(startsWith(parameters.pool.queue, 'BuildPool.Ubuntu')) }}: + ${{ if not(startsWith(parameters.pool.queue, 'Build.Ubuntu')) }}: pool: ${{ parameters.pool }} dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }} @@ -67,11 +67,7 @@ jobs: - ${{ if ne(parameters.dependsOn[0], '') }}: - ${{ parameters.dependsOn }} - ${{ if eq(parameters.dependsOn[0], '') }}: - - ${{ if notIn(parameters.framework, 'allConfigurations', 'net48') }}: - - ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} - # tests are built as part of product build - - ${{ if or(ne(parameters.archType, parameters.dependsOnTestArchitecture), ne(parameters.buildConfig, parameters.dependsOnTestBuildConfiguration), ne(parameters.osSubgroup, parameters.dependsOnTestOsSubgroup)) }}: - - ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.dependsOnTestOsSubgroup, parameters.dependsOnTestArchitecture, parameters.dependsOnTestBuildConfiguration) }} + - ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} - ${{ if ne(parameters.liveRuntimeBuildConfig, '') }}: - ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveRuntimeBuildConfig) }} @@ -98,6 +94,10 @@ jobs: artifactFileName: $(librariesTestsArtifactName)$(archiveExtension) unpackFolder: $(Build.SourcesDirectory)/artifacts + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: + - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} + displayName: Install Build Dependencies + - ${{ if in(parameters.coreclrTestGroup, 'gcstress0x3-gcstress0xc', 'gcstress-extra') }}: # We need to find and download the GC stress dependencies (namely, coredistools). Put them # in the 'sharedFramework' directory where we unpacked the CoreCLR build artifacts. The 'sharedFramework' diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml index ba3a9f875f9e92..14e7161e7a30e9 100644 --- a/eng/pipelines/libraries/stress/http.yml +++ b/eng/pipelines/libraries/stress/http.yml @@ -11,6 +11,7 @@ schedules: branches: include: - main + - release/6.0 variables: - template: ../variables.yml @@ -27,8 +28,8 @@ jobs: displayName: Docker Linux timeoutInMinutes: 180 pool: - name: NetCorePublic-Pool - queue: BuildPool.Ubuntu.1804.Amd64.Open + name: NetCore-Svc-Public + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open steps: - checkout: self @@ -75,8 +76,8 @@ jobs: displayName: Docker NanoServer timeoutInMinutes: 150 pool: - name: NetCorePublic-Pool - queue: BuildPool.Server.Amd64.VS2019.Open + name: NetCore-Svc-Public + demands: ImageOverride -equals windows.vs2019.amd64.open steps: - checkout: self diff --git a/eng/pipelines/libraries/stress/ssl.yml b/eng/pipelines/libraries/stress/ssl.yml index b0a654ba4d9dc8..0c080d62d374b6 100644 --- a/eng/pipelines/libraries/stress/ssl.yml +++ b/eng/pipelines/libraries/stress/ssl.yml @@ -11,6 +11,7 @@ schedules: branches: include: - main + - release/6.0 variables: - template: ../variables.yml @@ -28,8 +29,8 @@ jobs: displayName: Docker Linux timeoutInMinutes: 120 pool: - name: NetCorePublic-Pool - queue: BuildPool.Ubuntu.1804.Amd64.Open + name: NetCore-Svc-Public + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open steps: - checkout: self @@ -53,8 +54,8 @@ jobs: displayName: Docker NanoServer timeoutInMinutes: 120 pool: - name: NetCorePublic-Pool - queue: BuildPool.Server.Amd64.VS2019.Open + name: NetCore-Svc-Public + demands: ImageOverride -equals windows.vs2019.amd64.open steps: - checkout: self diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml index bdb15a09a665e5..a09a601c6c2d9e 100644 --- a/eng/pipelines/mono/templates/build-job.yml +++ b/eng/pipelines/mono/templates/build-job.yml @@ -16,7 +16,6 @@ parameters: dependsOn: [] monoCrossAOTTargetOS: [] dependOnEvaluatePaths: false - pgoType: '' ### Product build jobs: @@ -65,7 +64,7 @@ jobs: value: '+mono.mscordbi' - name: darwinFrameworks value: '' - - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.isOfficialBuild, true) }}: - name: officialBuildIdArg value: '/p:officialBuildId=$(Build.BuildNumber)' - ${{ if and(eq(parameters.osSubgroup, '_musl'), eq(parameters.osGroup, 'Linux')) }}: @@ -123,7 +122,7 @@ jobs: # Linux builds use docker images with dependencies preinstalled, # and FreeBSD builds use a build agent with dependencies # preinstalled, so we only need this step for OSX and Windows. - - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'windows') }}: diff --git a/eng/pipelines/mono/templates/generate-offsets.yml b/eng/pipelines/mono/templates/generate-offsets.yml index cbb05aaafff99c..c8bdebd7cf0468 100644 --- a/eng/pipelines/mono/templates/generate-offsets.yml +++ b/eng/pipelines/mono/templates/generate-offsets.yml @@ -41,7 +41,7 @@ jobs: value: ${{ parameters.osSubGroup }} - name: officialBuildIdArg value: '' - - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.isOfficialBuild, true) }}: - name: officialBuildIdArg value: '/p:officialBuildId=$(Build.BuildNumber)' - name: osOverride @@ -56,7 +56,7 @@ jobs: # Linux builds use docker images with dependencies preinstalled, # and FreeBSD builds use a build agent with dependencies # preinstalled, so we only need this step for OSX and Windows. - - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}: + - ${{ if in(parameters.osGroup, 'OSX', 'MacCatalyst', 'iOS', 'iOSSimulator', 'tvOS', 'tvOSSimulator') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'windows') }}: diff --git a/eng/pipelines/mono/templates/workloads-build.yml b/eng/pipelines/mono/templates/workloads-build.yml index a6b6e759306880..f213f3c3bd1f6e 100644 --- a/eng/pipelines/mono/templates/workloads-build.yml +++ b/eng/pipelines/mono/templates/workloads-build.yml @@ -39,7 +39,7 @@ jobs: variables: - name: officialBuildIdArg value: '' - - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.isOfficialBuild, true) }}: - name: officialBuildIdArg value: '/p:OfficialBuildId=$(Build.BuildNumber)' - name: SignType @@ -65,6 +65,10 @@ jobs: IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Runtime.MonoTargets.Sdk*.nupkg IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Runtime.MonoAOTCompiler.Task*.nupkg IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Runtime.WebAssembly.Sdk*.nupkg + IntermediateArtifacts/windows_arm/Shipping/Microsoft.NETCore.App.Runtime.win-arm*.nupkg + IntermediateArtifacts/windows_arm64/Shipping/Microsoft.NETCore.App.Runtime.win-arm64*.nupkg + IntermediateArtifacts/windows_x64/Shipping/Microsoft.NETCore.App.Runtime.win-x64*.nupkg + IntermediateArtifacts/windows_x86/Shipping/Microsoft.NETCore.App.Runtime.win-x86*.nupkg - task: CopyFiles@2 displayName: Flatten packages diff --git a/eng/pipelines/mono/templates/xplat-pipeline-job.yml b/eng/pipelines/mono/templates/xplat-pipeline-job.yml index 0b0ae5a28f6e64..5302b773181230 100644 --- a/eng/pipelines/mono/templates/xplat-pipeline-job.yml +++ b/eng/pipelines/mono/templates/xplat-pipeline-job.yml @@ -50,18 +50,18 @@ jobs: variables: - name: coreClrProductArtifactName - value: 'CoreCLRProduct___$(osGroup)$(osSubgroup)_$(archType)_${{ parameters.liveRuntimeBuildConfig }}' + value: 'CoreCLRProduct__$(osGroup)$(osSubgroup)_$(archType)_${{ parameters.liveRuntimeBuildConfig }}' - name: coreClrProductRootFolderPath value: '$(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).$(liveRuntimeBuildConfigUpper)' - name: buildProductArtifactName - value: 'MonoProduct__${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' + value: 'MonoProduct_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' # minijit and monointerpreter do not use seperate product builds. - ${{ if or(eq(parameters.runtimeVariant, 'minijit'), eq(parameters.runtimeVariant, 'monointerpreter')) }}: - name : buildProductArtifactName - value : 'MonoProduct___$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' + value : 'MonoProduct__$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)' - name: binTestsPath value: '$(Build.SourcesDirectory)/artifacts/tests/coreclr' diff --git a/eng/pipelines/mono/update-machine-certs.ps1 b/eng/pipelines/mono/update-machine-certs.ps1 index 1a6be78b199470..12e3a4d305a720 100644 --- a/eng/pipelines/mono/update-machine-certs.ps1 +++ b/eng/pipelines/mono/update-machine-certs.ps1 @@ -5,7 +5,7 @@ Try { Try { $Stream = New-Object System.Net.Security.SslStream($Conn.GetStream()) - $Stream.AuthenticateAsClient($WebsiteURL) + $Stream.AuthenticateAsClient($WebsiteURL, $null, [System.Security.Authentication.SslProtocols]::Tls12, $true) $Cert = $Stream.Get_RemoteCertificate() diff --git a/eng/pipelines/official/jobs/prepare-signed-artifacts.yml b/eng/pipelines/official/jobs/prepare-signed-artifacts.yml index a5457d751ad03f..481c69dc68f6a0 100644 --- a/eng/pipelines/official/jobs/prepare-signed-artifacts.yml +++ b/eng/pipelines/official/jobs/prepare-signed-artifacts.yml @@ -2,15 +2,15 @@ parameters: dependsOn: [] PublishRidAgnosticPackagesFromPlatform: '' isOfficialBuild: false - logArtifactName: 'Logs-PrepareSignedArtifacts' + logArtifactName: 'Logs-PrepareSignedArtifacts_Attempt$(System.JobAttempt)' jobs: - job: PrepareSignedArtifacts displayName: Prepare Signed Artifacts dependsOn: ${{ parameters.dependsOn }} pool: - name: NetCoreInternal-Pool - queue: buildpool.windows.10.amd64.vs2019 + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 # Double the default timeout. timeoutInMinutes: 180 workspace: @@ -26,7 +26,7 @@ jobs: fetchDepth: 20 - ${{ if eq(parameters.isOfficialBuild, true) }}: - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 - task: MicroBuildSigningPlugin@2 displayName: Install MicroBuild plugin for Signing diff --git a/eng/pipelines/official/stages/publish.yml b/eng/pipelines/official/stages/publish.yml index 10c6297566ad5a..98ae5d0ebc0986 100644 --- a/eng/pipelines/official/stages/publish.yml +++ b/eng/pipelines/official/stages/publish.yml @@ -19,7 +19,8 @@ stages: publishUsingPipelines: true dependsOn: PrepareSignedArtifacts pool: - vmImage: vs2017-win2016 + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 # Stages-based publishing entry point - template: /eng/common/templates/post-build/post-build.yml diff --git a/eng/pipelines/runtime-community.yml b/eng/pipelines/runtime-community.yml new file mode 100644 index 00000000000000..bce691fbc85687 --- /dev/null +++ b/eng/pipelines/runtime-community.yml @@ -0,0 +1,61 @@ +trigger: none + +schedules: + - cron: "0 7,19 * * *" # run at 7:00 and 19:00 (UTC) which is 23:00 and 11:00 (PST). + displayName: Runtime-community default schedule + branches: + include: + - main + - release/*.* + always: false # run only if there were changes since the last successful scheduled run. + +variables: + - template: /eng/pipelines/common/variables.yml + +jobs: +# +# Evaluate paths +# +- ${{ if eq(variables.dependOnEvaluatePaths, true) }}: + - template: /eng/pipelines/common/evaluate-default-paths.yml + +# +# s390x +# 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: + - Linux_s390x + 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 + 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 + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isRollingBuild'], true)) diff --git a/eng/pipelines/runtime-linker-tests.yml b/eng/pipelines/runtime-linker-tests.yml index 836b54c849ab5f..ba1151f9d6b7f5 100644 --- a/eng/pipelines/runtime-linker-tests.yml +++ b/eng/pipelines/runtime-linker-tests.yml @@ -60,7 +60,8 @@ jobs: timeoutInMinutes: 120 nameSuffix: Runtime_Release buildArgs: -s clr+libs -c $(_BuildConfig) - extraStepsTemplate: /eng/pipelines/libraries/execute-trimming-tests-steps.yml + postBuildSteps: + - template: /eng/pipelines/libraries/execute-trimming-tests-steps.yml # # Build Release config vertical for Browser-wasm @@ -76,6 +77,7 @@ jobs: timeoutInMinutes: 120 nameSuffix: Runtime_Release buildArgs: -s mono+libs -c $(_BuildConfig) -p:WasmBuildNative=false - extraStepsTemplate: /eng/pipelines/libraries/execute-trimming-tests-steps.yml - extraStepsParameters: - extraTestArgs: '/p:WasmBuildNative=false' + postBuildSteps: + - template: /eng/pipelines/libraries/execute-trimming-tests-steps.yml + parameters: + extraTestArgs: '/p:WasmBuildNative=false' diff --git a/eng/pipelines/runtime-official.yml b/eng/pipelines/runtime-official.yml index 5cb49dafbd9eea..5079f67b772c2c 100644 --- a/eng/pipelines/runtime-official.yml +++ b/eng/pipelines/runtime-official.yml @@ -54,7 +54,10 @@ stages: # # Source Index Build # - - template: ./source-index.yml + - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: + - template: /eng/common/templates/job/source-index-stage1.yml + parameters: + sourceIndexBuildCommand: build.cmd -subset libs.ref+libs.src -binarylog -os Linux -ci # # Build CoreCLR @@ -137,12 +140,13 @@ stages: # - windows_arm # - windows_arm64 jobParameters: - buildArgs: -s mono+libs+host+packs+mono.mscordbi -c $(_BuildConfig) + buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) nameSuffix: AllSubsets_Mono isOfficialBuild: ${{ variables.isOfficialBuild }} - extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml - extraStepsParameters: - name: MonoRuntimePacks + postBuildSteps: + - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml + parameters: + name: MonoRuntimePacks # Build Mono AOT offset headers once, for consumption elsewhere # @@ -156,6 +160,8 @@ stages: - tvOS_arm64 - iOS_arm64 - MacCatalyst_x64 + jobParameters: + isOfficialBuild: ${{ variables.isOfficialBuild }} # # Build Mono release AOT cross-compilers @@ -179,9 +185,10 @@ stages: - Android - Browser isOfficialBuild: ${{ variables.isOfficialBuild }} - extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml - extraStepsParameters: - name: MonoRuntimePacks + postBuildSteps: + - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml + parameters: + name: MonoRuntimePacks - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -202,9 +209,10 @@ stages: - Android - Browser isOfficialBuild: ${{ variables.isOfficialBuild }} - extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml - extraStepsParameters: - name: MonoRuntimePacks + postBuildSteps: + - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml + parameters: + name: MonoRuntimePacks - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -231,9 +239,10 @@ stages: - iOS - MacCatalyst isOfficialBuild: ${{ variables.isOfficialBuild }} - extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml - extraStepsParameters: - name: MonoRuntimePacks + postBuildSteps: + - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml + parameters: + name: MonoRuntimePacks # # Build Mono LLVM runtime packs @@ -262,9 +271,10 @@ stages: nameSuffix: AllSubsets_Mono_LLVMJIT runtimeVariant: LLVMJIT isOfficialBuild: ${{ variables.isOfficialBuild }} - extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml - extraStepsParameters: - name: MonoRuntimePacks + postBuildSteps: + - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml + parameters: + name: MonoRuntimePacks #LLVMAOT - jobTemplate: /eng/pipelines/common/global-build-job.yml buildConfig: release @@ -275,9 +285,10 @@ stages: nameSuffix: AllSubsets_Mono_LLVMAOT runtimeVariant: LLVMAOT isOfficialBuild: ${{ variables.isOfficialBuild }} - extraStepsTemplate: /eng/pipelines/common/upload-intermediate-artifacts-step.yml - extraStepsParameters: - name: MonoRuntimePacks + postBuildSteps: + - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml + parameters: + name: MonoRuntimePacks # # Build libraries using live CoreLib from CoreCLR @@ -308,15 +319,38 @@ stages: # - template: /eng/pipelines/common/platform-matrix.yml parameters: - jobTemplate: /eng/pipelines/libraries/build-job.yml + jobTemplate: /eng/pipelines/common/global-build-job.yml buildConfig: Release platforms: - windows_x64 jobParameters: - framework: allConfigurations + buildArgs: -s libs -allConfigurations -c $(_BuildConfig) /p:TestAssemblies=false /p:TestPackages=true + nameSuffix: Libraries_AllConfigurations isOfficialBuild: ${{ variables.isOfficialBuild }} - isOfficialAllConfigurations: true - liveRuntimeBuildConfig: release + postBuildSteps: + - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml + parameters: + name: Libraries_AllConfigurations + timeoutInMinutes: 95 + + # + # Build Sourcebuild leg + # +# - template: /eng/pipelines/common/platform-matrix.yml +# parameters: +# jobTemplate: /eng/pipelines/common/global-build-job.yml +# buildConfig: Release +# helixQueueGroup: ci +# platforms: +# - SourceBuild_Linux_x64 +# jobParameters: +# nameSuffix: SourceBuild +# postBuildSteps: +# - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml +# parameters: +# name: SourceBuildPackages +# timeoutInMinutes: 95 + # # Installer Build @@ -342,38 +376,29 @@ stages: - windows_arm64 # - # Build PGO CoreCLR release + # Build PGO Instrumented CoreCLR Release # - template: /eng/pipelines/common/platform-matrix.yml parameters: - jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml + jobTemplate: /eng/pipelines/common/global-build-job.yml buildConfig: release + helixQueueGroup: ci platforms: - windows_x64 - windows_x86 - Linux_x64 jobParameters: - testGroup: innerloop - pgoType: 'PGO' - - # - # PGO Build - # - - template: /eng/pipelines/installer/installer-matrix.yml - parameters: - buildConfig: Release - jobParameters: + buildArgs: -s clr.native+clr.corelib+clr.tools+clr.nativecorelib+libs+host+packs -c $(_BuildConfig) -pgoinstrument isOfficialBuild: ${{ variables.isOfficialBuild }} - liveRuntimeBuildConfig: release - liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - pgoType: 'PGO' - platforms: - - windows_x64 - - windows_x86 - - Linux_x64 + nameSuffix: PGO + postBuildSteps: + - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml + parameters: + name: PGO + timeoutInMinutes: 95 # - # Build Blazor Workload + # Build Workloads # - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -383,6 +408,7 @@ stages: - windows_x64 jobParameters: isOfficialBuild: ${{ variables.isOfficialBuild }} + timeoutInMinutes: 120 dependsOn: - Build_Android_arm_release_AllSubsets_Mono - Build_Android_arm64_release_AllSubsets_Mono @@ -400,6 +426,10 @@ stages: - Build_tvOSSimulator_arm64_release_AllSubsets_Mono - Build_tvOSSimulator_x64_release_AllSubsets_Mono - Build_Windows_x64_release_CrossAOT_Mono + - installer_coreclr__windows_x64_Release_ + - installer_coreclr__windows_x86_Release_ + - installer_coreclr__windows_arm_Release_ + - installer_coreclr__windows_arm64_Release_ - ${{ if eq(variables.isOfficialBuild, true) }}: - template: /eng/pipelines/official/stages/publish.yml diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index 40ca5bf9b2fabe..2fe63b5812e1e8 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -65,12 +65,10 @@ jobs: buildConfig: Release runtimeFlavor: mono platforms: - - MacCatalyst_x64 - iOSSimulator_x64 - tvOSSimulator_x64 # don't run tests on arm64 PRs until we can get significantly more devices - ${{ if eq(variables['isFullMatrix'], true) }}: - - MacCatalyst_arm64 - iOSSimulator_arm64 variables: # map dependencies variables to local variables @@ -90,16 +88,108 @@ jobs: 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 - interpreter: true - testRunNamePrefixSuffix: Mono_$(_BuildConfig) - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + interpreter: true + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) + +# +# 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 +# +- 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: + - MacCatalyst_x64 + # don't run tests on arm64 PRs until we can get significantly more devices + - ${{ if eq(variables['isFullMatrix'], true) }}: + - MacCatalyst_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_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 + 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 + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + interpreter: true + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) + +# +# MacCatalyst interp - requires AOT Compilation and Interp flags +# 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: + - MacCatalyst_x64 + # don't run tests on arm64 PRs until we can get significantly more devices + - ${{ if eq(variables['isFullMatrix'], true) }}: + - MacCatalyst_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 /p:DevTeamProvisioning=adhoc /p:RunAOTCompilation=true /p:MonoForceInterpreter=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['isFullMatrix'], true)) + # extra steps, run tests + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + interpreter: true + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) # # Build the whole product using Mono and run libraries tests @@ -131,15 +221,16 @@ jobs: 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) - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isFullMatrix'], true)) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) - template: /eng/pipelines/common/platform-matrix.yml parameters: @@ -171,15 +262,16 @@ jobs: # don't run tests on PRs until we can get significantly more devices ${{ if 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['isFullMatrix'], true)) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) # # Build the whole product using Mono and run libraries tests @@ -201,7 +293,7 @@ jobs: jobParameters: testScope: innerloop nameSuffix: AllSubsets_Mono - buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true + buildArgs: -s mono+mono.mscordbi+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true timeoutInMinutes: 120 condition: >- or( @@ -210,15 +302,16 @@ jobs: 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) - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isFullMatrix'], true)) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) # # Build the whole product using Mono for Android and run runtime tests with interpreter @@ -254,10 +347,11 @@ jobs: eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), 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) + postBuildSteps: + - template: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) # # Build the whole product using Mono and run runtime tests with the JIT. @@ -296,10 +390,11 @@ jobs: # successfully launch any tests. Re-enable once these issues have been fixed. # # extra steps, run tests - # extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml - # extraStepsParameters: - # creator: dotnet-bot - # testRunNamePrefixSuffix: Mono_$(_BuildConfig) + # postBuildSteps: + # - template: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml + # parameters: + # creator: dotnet-bot + # testRunNamePrefixSuffix: Mono_$(_BuildConfig) # # Build the whole product using Mono for Android and run runtime tests with Android devices @@ -336,10 +431,11 @@ jobs: # don't run tests on PRs until we can get significantly more devices ${{ 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) + postBuildSteps: + - template: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) # Run disabled installer tests on Linux x64 - template: /eng/pipelines/common/platform-matrix.yml @@ -386,19 +482,20 @@ jobs: 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 - scenarios: - - normal - - wasmtestonbrowser - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isFullMatrix'], true)) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + extraHelixArguments: /p:BrowserHost=windows + scenarios: + - normal + - wasmtestonbrowser + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) # # CoreCLR Build for running Apple Silicon libraries-innerloop diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 0fca635b793987..80ff1c9b745708 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -146,21 +146,6 @@ jobs: jobParameters: testGroup: innerloop -# -# Build PGO CoreCLR release -# -- template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml - buildConfig: release - platforms: - - windows_x64 - - windows_x86 - - Linux_x64 - jobParameters: - testGroup: innerloop - pgoType: 'PGO' - # # Build CoreCLR Formatting Job # Only when CoreCLR is changed, and only in the 'main' branch (no release branches; @@ -210,6 +195,7 @@ jobs: - iOS_arm64 - MacCatalyst_x64 jobParameters: + isOfficialBuild: ${{ variables.isOfficialBuild }} condition: >- or( eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), @@ -291,18 +277,19 @@ jobs: 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) - scenarios: - - normal - - wasmtestonbrowser - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isFullMatrix'], true)) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + scenarios: + - normal + - wasmtestonbrowser + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) # # Build the whole product using Mono and run libraries tests, for Wasm.Build.Tests @@ -332,17 +319,18 @@ jobs: 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) - scenarios: - - buildwasmapps - condition: >- - or( - eq(variables['monoContainsChange'], true), - eq(variables['installerContainsChange'], true), - eq(variables['isFullMatrix'], true)) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + scenarios: + - buildwasmapps + condition: >- + or( + eq(variables['monoContainsChange'], true), + eq(variables['installerContainsChange'], true), + eq(variables['isFullMatrix'], true)) # # Build for Browser/wasm, with EnableAggressiveTrimming=true @@ -373,18 +361,19 @@ jobs: 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:NeedsToBuildWasmAppsOnHelix=true - scenarios: - - normal - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isFullMatrix'], true)) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true + scenarios: + - normal + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) # # Build for Browser/wasm with RunAOTCompilation=true @@ -415,40 +404,19 @@ jobs: 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:NeedsToBuildWasmAppsOnHelix=true - scenarios: - - normal - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isFullMatrix'], true)) - -# Build and test libraries under single-file publishing -- 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 - platforms: - - windows_x64 - - 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 - timeoutInMinutes: 120 - # extra steps, run tests - extraStepsTemplate: /eng/pipelines/libraries/helix.yml - extraStepsParameters: - creator: dotnet-bot - testRunNamePrefixSuffix: SingleFile_$(_BuildConfig) + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true + scenarios: + - normal + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) # # Build the whole product using Mono and run runtime tests @@ -483,48 +451,50 @@ jobs: eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), eq(variables['isFullMatrix'], true)) # extra steps, run tests - extraStepsTemplate: /eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml - extraStepsParameters: - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) + postBuildSteps: + - template: /eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml + parameters: + 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: >- - or( - eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), - eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), - 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) +#- 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: >- +# or( +# eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), +# eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), +# eq(variables['isFullMatrix'], true)) +# # extra steps, run tests +# postBuildSteps: +# - template: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml +# parameters: +# creator: dotnet-bot +# testRunNamePrefixSuffix: Mono_$(_BuildConfig) # # Build Mono and Installer on LLVMJIT mode @@ -814,9 +784,12 @@ jobs: eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), eq(variables['isFullMatrix'], true)) +# +# Build and test libraries for .NET Framework +# - template: /eng/pipelines/common/platform-matrix.yml parameters: - jobTemplate: /eng/pipelines/libraries/build-job.yml + jobTemplate: /eng/pipelines/common/global-build-job.yml buildConfig: Release platforms: - windows_x86 @@ -826,24 +799,33 @@ jobs: jobParameters: isFullMatrix: ${{ variables.isFullMatrix }} framework: net48 - runTests: true - testScope: innerloop + buildArgs: -s libs+libs.tests -framework net48 -c $(_BuildConfig) -testscope innerloop /p:ArchiveTests=true + nameSuffix: Libraries_NET48 + timeoutInMinutes: 150 + postBuildSteps: + - template: /eng/pipelines/libraries/helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: NET48_$(_BuildConfig) + extraHelixArguments: /p:BuildTargetFramework=net48 condition: >- or( eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), eq(variables['isFullMatrix'], true)) +# +# Build and test libraries AllConfigurations +# - template: /eng/pipelines/common/platform-matrix.yml parameters: - jobTemplate: /eng/pipelines/libraries/build-job.yml + jobTemplate: /eng/pipelines/common/global-build-job.yml buildConfig: ${{ variables.debugOnPrReleaseOnRolling }} platforms: - windows_x64 jobParameters: - isFullMatrix: ${{ variables.isFullMatrix }} - framework: allConfigurations - runTests: true - useHelix: false + buildArgs: -test -s libs+libs.tests -allConfigurations -c $(_BuildConfig) /p:TestAssemblies=false /p:TestPackages=true + nameSuffix: Libraries_AllConfigurations + timeoutInMinutes: 150 condition: >- or( eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), @@ -883,22 +865,6 @@ jobs: liveRuntimeBuildConfig: release liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }} -# -# PGO Build -# -- template: /eng/pipelines/installer/installer-matrix.yml - parameters: - buildConfig: Release - jobParameters: - isOfficialBuild: ${{ variables.isOfficialBuild }} - liveRuntimeBuildConfig: release - liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }} - pgoType: 'PGO' - platforms: - - windows_x64 - - windows_x86 - - Linux_x64 - # # CoreCLR Test builds using live libraries release build # Only when CoreCLR is changed diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index db73445d799874..f88459777482f0 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -68,9 +68,10 @@ stages: timeoutInMinutes: 100 testGroup: innerloop buildArgs: -s clr+libs+host+packs -c debug -runtimeConfiguration Checked - extraStepsTemplate: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml - extraStepsParameters: - uploadRuntimeTests: true + postBuildSteps: + - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + parameters: + uploadRuntimeTests: true # # Build with Release config and Release runtimeConfiguration @@ -86,14 +87,15 @@ stages: timeoutInMinutes: 100 isOfficialBuild: ${{ variables.isOfficialBuild }} testGroup: innerloop - extraStepsTemplate: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml - extraStepsParameters: - uploadLibrariesTests: ${{ eq(variables.isOfficialBuild, false) }} - uploadIntermediateArtifacts: false - ${{ if eq(variables.isOfficialBuild, false) }}: - buildArgs: -s clr+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true - ${{ if eq(variables.isOfficialBuild, true) }}: - buildArgs: -s clr+libs -c $(_BuildConfig) + postBuildSteps: + - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + parameters: + uploadLibrariesTests: ${{ eq(variables.isOfficialBuild, false) }} + uploadIntermediateArtifacts: false + ${{ if eq(variables.isOfficialBuild, false) }}: + buildArgs: -s clr+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true + ${{ if eq(variables.isOfficialBuild, true) }}: + buildArgs: -s clr+libs -c $(_BuildConfig) # # Build with Release allConfigurations to produce packages @@ -110,11 +112,12 @@ stages: nameSuffix: AllConfigurations buildArgs: -s libs -c $(_BuildConfig) -allConfigurations ${{ if eq(variables.isOfficialBuild, true) }}: - extraStepsTemplate: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml - extraStepsParameters: - uploadIntermediateArtifacts: true - isOfficialBuild: true - librariesBinArtifactName: libraries_bin_official_allconfigurations + postBuildSteps: + - template: /eng/pipelines/runtimelab/runtimelab-post-build-steps.yml + parameters: + uploadIntermediateArtifacts: true + isOfficialBuild: true + librariesBinArtifactName: libraries_bin_official_allconfigurations # Installer official builds need to build installers and need the libraries all configurations build - ${{ if eq(variables.isOfficialBuild, true) }}: diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index a6187638cd3461..97c007ba4b3074 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -5,7 +5,6 @@ parameters: osSubgroup: '' nameSuffix: '' platform: '' - pgoType: '' runtimeVariant: '' librariesBinArtifactName: '' isOfficialBuild: false @@ -32,7 +31,7 @@ steps: tarCompression: $(tarCompression) includeRootFolder: false archiveExtension: $(archiveExtension) - artifactName: CoreCLRProduct_${{ parameters.pgoType }}_${{ parameters.runtimeVariant }}_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }} + artifactName: CoreCLRProduct_${{ parameters.runtimeVariant }}_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }} displayName: 'CoreCLR product build' # Zip Test Build diff --git a/eng/pipelines/source-index.yml b/eng/pipelines/source-index.yml deleted file mode 100644 index 201e84d4ef3295..00000000000000 --- a/eng/pipelines/source-index.yml +++ /dev/null @@ -1,10 +0,0 @@ -jobs: -# -# Source Index Build -# -- template: /eng/common/templates/job/source-index-stage1.yml - parameters: - sourceIndexBuildCommand: build.cmd -subset libs.ref+libs.src -binarylog -os Linux -ci - preSteps: - - script: | - rename dotnet.cmd dotnet.cmd.go-away diff --git a/eng/references.targets b/eng/references.targets index 7cfb60411ed182..8a238677f67b86 100644 --- a/eng/references.targets +++ b/eng/references.targets @@ -59,4 +59,15 @@ + + + + <_resolvedCoreLibProjectReference Include="@(_ResolvedProjectReferencePaths->WithMetadataValue('MSBuildSourceProjectFile','$(CoreLibProject)'))" /> + + + + + diff --git a/eng/restore/docs.targets b/eng/restore/docs.targets index 764bc5bbefb64b..791b15b939eb42 100644 --- a/eng/restore/docs.targets +++ b/eng/restore/docs.targets @@ -9,7 +9,7 @@ AfterTargets="Restore"> - + $([System.String]::new('%(RecursiveDir)').TrimEnd('\/')) @@ -35,7 +35,7 @@ - + + + + + + + + diff --git a/eng/testing/performance/crossgen_perf.proj b/eng/testing/performance/crossgen_perf.proj index c6599aecfd42f1..923882ea355873 100644 --- a/eng/testing/performance/crossgen_perf.proj +++ b/eng/testing/performance/crossgen_perf.proj @@ -59,7 +59,7 @@ - + $(WorkItemDirectory) $(Python) $(Crossgen2Directory)pre.py crossgen2 --core-root $(CoreRoot) --single %(Identity) $(Python) $(Crossgen2Directory)test.py sod --scenario-name "Crossgen2 %(Identity) Size" --dirs ./crossgen.out/ @@ -69,18 +69,18 @@ - + 4:00 - + 4:00 - + $(WorkItemDirectory) $(Python) $(Crossgen2Directory)test.py crossgen2 --core-root $(CoreRoot) --composite $(Crossgen2Directory)framework-r2r.dll.rsp 1:00 - + 4:00 diff --git a/eng/testing/performance/microbenchmarks.proj b/eng/testing/performance/microbenchmarks.proj index 318ca5f1b8d4c3..bdbe833c92a962 100644 --- a/eng/testing/performance/microbenchmarks.proj +++ b/eng/testing/performance/microbenchmarks.proj @@ -46,10 +46,10 @@ - --corerun %HELIX_CORRELATION_PAYLOAD%\dotnet-mono\shared\Microsoft.NETCore.App\6.0.0\corerun.exe + --corerun %HELIX_CORRELATION_PAYLOAD%\dotnet-mono\shared\Microsoft.NETCore.App\$(ProductVersion)\corerun.exe - --corerun $(BaseDirectory)/dotnet-mono/shared/Microsoft.NETCore.App/6.0.0/corerun + --corerun $(BaseDirectory)/dotnet-mono/shared/Microsoft.NETCore.App/$(ProductVersion)/corerun diff --git a/eng/testing/performance/performance-setup.ps1 b/eng/testing/performance/performance-setup.ps1 index 9ed93d17fbd829..a53f102f5d33e6 100644 --- a/eng/testing/performance/performance-setup.ps1 +++ b/eng/testing/performance/performance-setup.ps1 @@ -14,7 +14,7 @@ Param( [string] $Kind="micro", [switch] $LLVM, [switch] $MonoInterpreter, - [switch] $MonoAOT, + [switch] $MonoAOT, [switch] $Internal, [switch] $Compare, [string] $MonoDotnet="", @@ -44,11 +44,12 @@ $Queue = "" if ($Internal) { switch ($LogicalMachine) { - "perftiger" { $Queue = "Windows.10.Amd64.19H1.Tiger.Perf" } - "perfowl" { $Queue = "Windows.10.Amd64.20H2.Owl.Perf" } - "perfsurf" { $Queue = "Windows.10.Arm64.Perf.Surf" } - "perfpixel4a" { $Queue = "Windows.10.Amd64.Pixel.Perf" } - Default { $Queue = "Windows.10.Amd64.19H1.Tiger.Perf" } + "perftiger" { $Queue = "Windows.11.Amd64.Tiger.Perf" } + "perftiger_crossgen" { $Queue = "Windows.11.Amd64.Tiger.Perf" } + "perfowl" { $Queue = "Windows.11.Amd64.Owl.Perf" } + "perfsurf" { $Queue = "Windows.11.Arm64.Surf.Perf" } + "perfpixel4a" { $Queue = "Windows.11.Amd64.Pixel.Perf" } + Default { $Queue = "Windows.11.Amd64.Tiger.Perf" } } $PerfLabArguments = "--upload-to-perflab-container" $ExtraBenchmarkDotNetArguments = "" @@ -97,7 +98,12 @@ if ($iOSMono) { } # FIX ME: This is a workaround until we get this from the actual pipeline -$CommonSetupArguments="--channel main --queue $Queue --build-number $BuildNumber --build-configs $Configurations --architecture $Architecture" +$CleanedBranchName = "release/6.0" +if($Branch.Contains("refs/heads/release")) +{ + $CleanedBranchName = $Branch.replace('refs/heads/', '') +} +$CommonSetupArguments="--channel $CleanedBranchName --queue $Queue --build-number $BuildNumber --build-configs $Configurations --architecture $Architecture" $SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments" if($NoPGO) @@ -115,11 +121,11 @@ elseif($FullPGO) if ($RunFromPerformanceRepo) { $SetupArguments = "--perf-hash $CommitSha $CommonSetupArguments" - + robocopy $SourceDirectory $PerformanceDirectory /E /XD $PayloadDirectory $SourceDirectory\artifacts $SourceDirectory\.git } else { - git clone --branch main --depth 1 --quiet https://github.com/dotnet/performance $PerformanceDirectory + git clone --branch release/6.0 --depth 1 --quiet https://github.com/dotnet/performance $PerformanceDirectory } if($MonoDotnet -ne "") @@ -196,4 +202,4 @@ Write-PipelineSetVariable -Name 'Queue' -Value "$Queue" -IsMultiJobVariable $fal Write-PipelineSetVariable -Name 'HelixSourcePrefix' -Value "$HelixSourcePrefix" -IsMultiJobVariable $false Write-PipelineSetVariable -Name '_BuildConfig' -Value "$Architecture.$Kind.$Framework" -IsMultiJobVariable $false -exit 0 \ No newline at end of file +exit 0 diff --git a/eng/testing/performance/performance-setup.sh b/eng/testing/performance/performance-setup.sh index c99ad1f48f3fa5..c13804d8239e47 100755 --- a/eng/testing/performance/performance-setup.sh +++ b/eng/testing/performance/performance-setup.sh @@ -162,7 +162,7 @@ while (($# > 0)); do echo " --internal If the benchmarks are running as an official job." echo " --monodotnet Pass the path to the mono dotnet for mono performance testing." echo " --wasm Path to the unpacked wasm runtime pack." - echo " --wasmaot Indicate wasm aot" + echo " --wasmaot Indicate wasm aot" echo " --latestdotnet --dotnet-versions will not be specified. --dotnet-versions defaults to LKG version in global.json " echo " --alpine Set for runs on Alpine" echo "" @@ -193,7 +193,7 @@ benchmark_directory=$payload_directory/BenchmarkDotNet workitem_directory=$source_directory/workitem extra_benchmark_dotnet_arguments="--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" perflab_arguments= -queue=Ubuntu.1804.Amd64.Open +queue=Ubuntu.2204.Amd64.Open creator=$BUILD_DEFINITIONNAME helix_source_prefix="pr" @@ -202,14 +202,16 @@ if [[ "$internal" == true ]]; then helix_source_prefix="official" creator= extra_benchmark_dotnet_arguments= - + if [[ "$architecture" = "arm64" ]]; then - queue=Ubuntu.1804.Arm64.Perf + queue=Ubuntu.2204.Arm64.Perf else if [[ "$logical_machine" = "perfowl" ]]; then - queue=Ubuntu.1804.Amd64.Owl.Perf - else + queue=Ubuntu.2204.Amd64.Owl.Perf + elif [[ "$logical_machine" == "perftiger_crossgen" ]]; then queue=Ubuntu.1804.Amd64.Tiger.Perf + else + queue=Ubuntu.2204.Amd64.Tiger.Perf fi fi @@ -220,7 +222,7 @@ else if [[ "$architecture" = "arm64" ]]; then queue=ubuntu.1804.armarch.open else - queue=Ubuntu.1804.Amd64.Open + queue=Ubuntu.2204.Amd64.Open fi if [[ "$alpine" = "true" ]]; then @@ -255,7 +257,11 @@ if [[ "$monoaot" == "true" ]]; then extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --category-exclusion-filter NoAOT" fi -common_setup_arguments="--channel main --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture" +cleaned_branch_name="release/6.0" +if [[ $branch == *"refs/heads/release"* ]]; then + cleaned_branch_name=${branch/refs\/heads\//} +fi +common_setup_arguments="--channel $cleaned_branch_name --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture" setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" if [[ "$run_from_perf_repo" = true ]]; then @@ -264,7 +270,7 @@ if [[ "$run_from_perf_repo" = true ]]; then performance_directory=$workitem_directory setup_arguments="--perf-hash $commit_sha $common_setup_arguments" else - git clone --branch main --depth 1 --quiet https://github.com/dotnet/performance.git $performance_directory + git clone --branch release/6.0 --depth 1 --quiet https://github.com/dotnet/performance.git $performance_directory # uncomment to use BenchmarkDotNet sources instead of nuget packages # git clone https://github.com/dotnet/BenchmarkDotNet.git $benchmark_directory @@ -287,7 +293,7 @@ if [[ "$wasm_runtime_loc" != "" ]]; then rsync -a --progress $wasm_dotnet_path/artifacts/BrowserWasm/artifacts/* $wasm_dotnet_path/artifacts rm -r $wasm_dotnet_path/artifacts/BrowserWasm/artifacts if [[ "$wasmaot" == "true" ]]; then - extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --wasmEngine /home/helixbot/.jsvu/$javascript_engine --runtimeSrcDir \$HELIX_CORRELATION_PAYLOAD/dotnet-wasm --aotcompilermode wasm --buildTimeout 3600" + extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --wasmEngine /home/helixbot/.jsvu/$javascript_engine --runtimeSrcDir \$HELIX_CORRELATION_PAYLOAD/dotnet-wasm --aotcompilermode wasm --buildTimeout 3600" else extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --wasmEngine /home/helixbot/.jsvu/$javascript_engine --runtimeSrcDir \$HELIX_CORRELATION_PAYLOAD/dotnet-wasm" fi diff --git a/eng/testing/scenarios/BuildWasmAppsJobsList.txt b/eng/testing/scenarios/BuildWasmAppsJobsList.txt index ba322274dfe62c..8afeea6cdeeb13 100644 --- a/eng/testing/scenarios/BuildWasmAppsJobsList.txt +++ b/eng/testing/scenarios/BuildWasmAppsJobsList.txt @@ -1,14 +1,19 @@ -BlazorWasmTests -FlagsChangeRebuildTest -InvariantGlobalizationTests -LocalEMSDKTests -MainWithArgsTests -NativeBuildTests -NativeLibraryTests -NoopNativeRebuildTest -RebuildTests -ReferenceNewAssemblyRebuildTest -SatelliteAssembliesTests -SimpleSourceChangeRebuildTest -WasmBuildAppTest -WorkloadTests +Wasm.Build.NativeRebuild.Tests.FlagsChangeRebuildTest +Wasm.Build.NativeRebuild.Tests.NoopNativeRebuildTest +Wasm.Build.NativeRebuild.Tests.ReferenceNewAssemblyRebuildTest +Wasm.Build.NativeRebuild.Tests.SimpleSourceChangeRebuildTest +Wasm.Build.Tests.BlazorWasmBuildPublishTests +Wasm.Build.Tests.BlazorWasmTests +Wasm.Build.Tests.BuildPublishTests +Wasm.Build.Tests.CleanTests +Wasm.Build.Tests.InvariantGlobalizationTests +Wasm.Build.Tests.LocalEMSDKTests +Wasm.Build.Tests.MainWithArgsTests +Wasm.Build.Tests.NativeBuildTests +Wasm.Build.Tests.NativeLibraryTests +Wasm.Build.Tests.PInvokeTableGeneratorTests +Wasm.Build.Tests.RebuildTests +Wasm.Build.Tests.SatelliteAssembliesTests +Wasm.Build.Tests.WasmBuildAppTest +Wasm.Build.Tests.WasmNativeDefaultsTests +Wasm.Build.Tests.WorkloadTests diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index fc196e0053efbf..2b862dd6461264 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -2,11 +2,15 @@ $([MSBuild]::NormalizeDirectory('$(OutDir)', 'AppBundle')) + $(AppBundleRoot)tests\$(AssemblyName) + $(AppBundleRoot)runonly\$(AssemblyName) + $([MSBuild]::NormalizeDirectory('$(PublishDir)', 'AppBundle')) $([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)')) true true BundleTestAppleApp;BundleTestAndroidApp + Publish @@ -104,6 +108,7 @@ OutputType="AsmOnly" Assemblies="@(AotInputAssemblies)" AotModulesTablePath="$(BundleDir)\modules.c" + IntermediateOutputPath="$(IntermediateOutputPath)" UseLLVM="$(MonoEnableLLVM)" LLVMPath="$(MonoAotCrossDir)"> @@ -132,6 +137,9 @@ DestinationFolder="$(TestArchiveTestsDir)" SkipUnchangedFiles="true" Condition="'$(ArchiveTests)' == 'true' and '$(IgnoreForCI)' != 'true'" /> + + @@ -155,6 +163,10 @@ true AppleTestRunner.dll <_MobileIntermediateOutputPath Condition="'$(RunAOTCompilation)' == 'true'">$(IntermediateOutputPath)mobile + true + false + false + true Full @@ -189,6 +201,7 @@ Assemblies="@(AotInputAssemblies)" AotModulesTablePath="$(BundleDir)\modules.m" AotModulesTableLanguage="ObjC" + IntermediateOutputPath="$(IntermediateOutputPath)" UseLLVM="$(MonoEnableLLVM)" LLVMPath="$(MonoAotCrossDir)"> @@ -209,10 +222,12 @@ MainLibraryFileName="$(MainLibraryFileName)" ForceAOT="$(RunAOTCompilation)" ForceInterpreter="$(MonoForceInterpreter)" + EnableAppSandbox="$(EnableAppSandbox)" InvariantGlobalization="$(InvariantGlobalization)" UseConsoleUITemplate="True" - GenerateXcodeProject="True" - BuildAppBundle="True" + GenerateXcodeProject="$(GenerateXcodeProject)" + GenerateCMakeProject="$(GenerateCMakeProject)" + BuildAppBundle="$(GenerateXcodeProject)" Optimized="$(Optimized)" DevTeamProvisioning="$(DevTeamProvisioning)" OutputDirectory="$(BundleDir)" @@ -220,25 +235,20 @@ - - + + - + <_appFiles Include="$(AppBundlePath)/../**/*" /> - - - - <_removeFiles Include="$(OutDir)*.*" /> - + Condition="'$(ArchiveTests)' == 'true' and '$(IgnoreForCI)' != 'true' and '$(GenerateXcodeProject)' == 'true'" /> - - + + true + true $(BundleTestAppTargets);BundleTestWasmApp true true + + false @@ -55,10 +59,20 @@ Condition="'$(BuildAOTTestsOn)' == 'local'" /> - PrepareForWasmBuildApp;$(WasmBuildAppDependsOn) + WasmTriggerPublishApp + $(BundleTestWasmAppDependsOn);_BundleAOTTestWasmAppForHelix + - WasmBuildApp - $(BundleTestWasmAppDependsOn);_BundleAOTTestWasmAppForHelix + + + + + + true + + + + PrepareForWasmBuildApp;$(WasmNestedPublishAppDependsOn) @@ -80,6 +94,8 @@ $([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json')) + + @@ -154,7 +170,7 @@ - + <_CopyLocalPaths diff --git a/eng/testing/xunit/xunit.targets b/eng/testing/xunit/xunit.targets index 8a950eb58ef383..5cf2846d40d184 100644 --- a/eng/testing/xunit/xunit.targets +++ b/eng/testing/xunit/xunit.targets @@ -1,11 +1,14 @@ - + + + true + true + + $(OutDir) diff --git a/global.json b/global.json index e3425ab9bdd9de..ec967648df7acb 100644 --- a/global.json +++ b/global.json @@ -1,21 +1,21 @@ { "sdk": { - "version": "6.0.100-rc.1.21411.28", + "version": "6.0.130", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "6.0.100-rc.1.21411.28" + "dotnet": "6.0.130" }, "native-tools": { "cmake": "3.16.4", "python3": "3.7.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "6.0.0-beta.21413.4", - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21413.4", - "Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.21413.4", - "Microsoft.DotNet.SharedFramework.Sdk": "6.0.0-beta.21413.4", + "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "6.0.0-beta.24266.4", + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.24266.4", + "Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.24266.4", + "Microsoft.DotNet.SharedFramework.Sdk": "6.0.0-beta.24266.4", "Microsoft.Build.NoTargets": "3.1.0", "Microsoft.Build.Traversal": "3.0.23", "Microsoft.NET.Sdk.IL": "6.0.0-rc.1.21415.6" diff --git a/src/coreclr/.nuget/Directory.Build.props b/src/coreclr/.nuget/Directory.Build.props index cff00f49e0e561..e9351e6c127a17 100644 --- a/src/coreclr/.nuget/Directory.Build.props +++ b/src/coreclr/.nuget/Directory.Build.props @@ -16,10 +16,10 @@ true + - - 6.0.0 - $(PackageVersion) + + false diff --git a/src/coreclr/.nuget/Directory.Build.targets b/src/coreclr/.nuget/Directory.Build.targets index 365d5ed7a9ca60..687a6f40253106 100644 --- a/src/coreclr/.nuget/Directory.Build.targets +++ b/src/coreclr/.nuget/Directory.Build.targets @@ -1,5 +1,13 @@ + + + + $(ProductVersion) + $(PackageVersion) + + + $(ProductVersion) + $(ProductVersion) true $(NoWarn),0419,0649,CA2249,CA1830 enable @@ -354,4 +355,10 @@ + + + + true + + diff --git a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreCLR.cs index 948ebd2537230d..3cfc7cc193ec1f 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackFrame.CoreCLR.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Text; +using System.Reflection; +using System.Runtime.CompilerServices; namespace System.Diagnostics { @@ -50,5 +52,22 @@ private void BuildStackFrame(int skipFrames, bool needFileInfo) } private static bool AppendStackFrameWithoutMethodBase(StringBuilder sb) => false; + + /// + /// Returns the MethodBase instance for the managed code IP address. + /// + /// Warning: The implementation of this method has race for dynamic and collectible methods. + /// + /// code address + /// MethodBase instance for the method or null if IP not found + internal static MethodBase? GetMethodFromNativeIP(IntPtr ip) + { + RuntimeMethodHandleInternal method = StackTrace.GetMethodDescFromNativeIP(ip); + + if (method.Value == IntPtr.Zero) + return null; + + return RuntimeType.GetMethodBase(null, method); + } } } diff --git a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackTrace.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackTrace.CoreCLR.cs index 9bef9fb72fae58..d82bbaf7e1e342 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackTrace.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Diagnostics/StackTrace.CoreCLR.cs @@ -1,8 +1,9 @@ // 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.CompilerServices; using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; namespace System.Diagnostics { @@ -11,6 +12,9 @@ public partial class StackTrace [MethodImpl(MethodImplOptions.InternalCall)] internal static extern void GetStackFramesInternal(StackFrameHelper sfh, int iSkip, bool fNeedFileInfo, Exception? e); + [DllImport(RuntimeHelpers.QCall)] + internal static extern RuntimeMethodHandleInternal GetMethodDescFromNativeIP(IntPtr ip); + internal static int CalculateFramesToSkip(StackFrameHelper StackF, int iNumFrames) { int iRetVal = 0; diff --git a/src/coreclr/System.Private.CoreLib/src/System/GC.cs b/src/coreclr/System.Private.CoreLib/src/System/GC.cs index bcbf042fd1b24d..33594cca7170ae 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/GC.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/GC.cs @@ -719,5 +719,13 @@ public static T[] AllocateArray(int length, bool pinned = false) // T[] rathe return Unsafe.As(AllocateNewArray(typeof(T[]).TypeHandle.Value, length, flags)); } + + [MethodImpl(MethodImplOptions.InternalCall)] + private static extern long _GetTotalPauseDuration(); + + public static TimeSpan GetTotalPauseDuration() + { + return new TimeSpan(_GetTotalPauseDuration()); + } } } diff --git a/src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/DynamicInterfaceCastableHelpers.cs b/src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/DynamicInterfaceCastableHelpers.cs index 6ea1f1b444a507..da3cd7f1059e27 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/DynamicInterfaceCastableHelpers.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/DynamicInterfaceCastableHelpers.cs @@ -34,7 +34,7 @@ internal static bool IsInterfaceImplemented(IDynamicInterfaceCastable castable, if (!implType.IsDefined(typeof(DynamicInterfaceCastableImplementationAttribute), inherit: false)) throw new InvalidOperationException(SR.Format(SR.IDynamicInterfaceCastable_MissingImplementationAttribute, implType, nameof(DynamicInterfaceCastableImplementationAttribute))); - if (!implType.ImplementInterface(interfaceType)) + if (!implType.IsAssignableTo(interfaceType)) throw new InvalidOperationException(SR.Format(SR.IDynamicInterfaceCastable_DoesNotImplementRequested, implType, interfaceType)); return implType; diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h index 0f17ce7290e71c..4bffe52ecb4f63 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h @@ -157,6 +157,7 @@ LWM(TryResolveToken, Agnostic_CORINFO_RESOLVED_TOKENin, TryResolveTokenValue) LWM(SatisfiesClassConstraints, DWORDLONG, DWORD) LWM(SatisfiesMethodConstraints, DLDL, DWORD) LWM(GetUnmanagedCallConv, MethodOrSigInfoValue, DD) +LWM(DoesFieldBelongToClass, DLDL, DWORD) DENSELWM(SigInstHandleMap, DWORDLONG) #undef LWM diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index ae87cb1edde826..7d4a191c51cf62 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -6265,6 +6265,40 @@ DWORD MethodContext::repGetExpectedTargetArchitecture() return value; } +void MethodContext::recDoesFieldBelongToClass(CORINFO_FIELD_HANDLE fld, CORINFO_CLASS_HANDLE cls, bool result) +{ + if (DoesFieldBelongToClass == nullptr) + DoesFieldBelongToClass = new LightWeightMap(); + + DLDL key; + ZeroMemory(&key, sizeof(key)); // Zero key including any struct padding + key.A = CastHandle(fld); + key.B = CastHandle(cls); + + DWORD value = (DWORD)result; + DoesFieldBelongToClass->Add(key, value); + DEBUG_REC(dmpDoesFieldBelongToClass(key, result)); +} + +void MethodContext::dmpDoesFieldBelongToClass(DLDL key, bool value) +{ + printf("DoesFieldBelongToClass key fld=%016llX, cls=%016llx, result=%d", key.A, key.B, value); +} + +bool MethodContext::repDoesFieldBelongToClass(CORINFO_FIELD_HANDLE fld, CORINFO_CLASS_HANDLE cls) +{ + DLDL key; + ZeroMemory(&key, sizeof(key)); // Zero key including any struct padding + key.A = CastHandle(fld); + key.B = CastHandle(cls); + + AssertMapAndKeyExist(DoesFieldBelongToClass, key, ": key %016llX %016llX", key.A, key.B); + + bool value = (bool)DoesFieldBelongToClass->Get(key); + DEBUG_REP(dmpDoesFieldBelongToClass(key, value)); + return value; +} + void MethodContext::recIsValidToken(CORINFO_MODULE_HANDLE module, unsigned metaTOK, bool result) { if (IsValidToken == nullptr) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h index b342996b446317..4abbef3faf135d 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -769,6 +769,10 @@ class MethodContext void dmpGetExpectedTargetArchitecture(DWORD key, DWORD result); DWORD repGetExpectedTargetArchitecture(); + void recDoesFieldBelongToClass(CORINFO_FIELD_HANDLE fld, CORINFO_CLASS_HANDLE cls, bool result); + void dmpDoesFieldBelongToClass(DLDL key, bool value); + bool repDoesFieldBelongToClass(CORINFO_FIELD_HANDLE fld, CORINFO_CLASS_HANDLE cls); + void recIsValidToken(CORINFO_MODULE_HANDLE module, unsigned metaTOK, bool result); void dmpIsValidToken(DLD key, DWORD value); bool repIsValidToken(CORINFO_MODULE_HANDLE module, unsigned metaTOK); @@ -1063,7 +1067,7 @@ enum mcPackets Packet_TryResolveToken = 158, // Added 4/26/2016 Packet_SatisfiesClassConstraints = 110, Packet_SatisfiesMethodConstraints = 111, - Packet_ShouldEnforceCallvirtRestriction = 112, // Retired 2/18/2020 + Packet_DoesFieldBelongToClass = 112, // Added 8/12/2021 Packet_SigInstHandleMap = 184, Packet_AllocPgoInstrumentationBySchema = 186, // Added 1/4/2021 Packet_GetPgoInstrumentationResults = 187, // Added 1/4/2021 diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index 4390113cf02798..2b802b3eacc311 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -2010,3 +2010,13 @@ bool interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instruct { return original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported); } + +bool interceptor_ICJI::doesFieldBelongToClass( + CORINFO_FIELD_HANDLE fldHnd, + CORINFO_CLASS_HANDLE cls) +{ + mc->cr->AddCall("doesFieldBelongToClass"); + bool result = original_ICorJitInfo->doesFieldBelongToClass(fldHnd, cls); + mc->recDoesFieldBelongToClass(fldHnd, cls, result); + return result; +} diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp index 445cc2a490e5ba..e967975ae244a8 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp @@ -1389,3 +1389,11 @@ uint32_t interceptor_ICJI::getJitFlags( return original_ICorJitInfo->getJitFlags(flags, sizeInBytes); } +bool interceptor_ICJI::doesFieldBelongToClass( + CORINFO_FIELD_HANDLE fldHnd, + CORINFO_CLASS_HANDLE cls) +{ + mcs->AddCall("doesFieldBelongToClass"); + return original_ICorJitInfo->doesFieldBelongToClass(fldHnd, cls); +} + diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp index 7b04e139c4d016..8c982934239fe3 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp @@ -1217,3 +1217,10 @@ uint32_t interceptor_ICJI::getJitFlags( return original_ICorJitInfo->getJitFlags(flags, sizeInBytes); } +bool interceptor_ICJI::doesFieldBelongToClass( + CORINFO_FIELD_HANDLE fldHnd, + CORINFO_CLASS_HANDLE cls) +{ + return original_ICorJitInfo->doesFieldBelongToClass(fldHnd, cls); +} + diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp index b2cb35339adcc7..cac9ce2b0f8716 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -1574,6 +1574,13 @@ uint32_t MyICJI::getJitFlags(CORJIT_FLAGS* jitFlags, uint32_t sizeInBytes) return ret; } +bool MyICJI::doesFieldBelongToClass(CORINFO_FIELD_HANDLE fldHnd, CORINFO_CLASS_HANDLE cls) +{ + jitInstance->mc->cr->AddCall("doesFieldBelongToClass"); + bool result = jitInstance->mc->repDoesFieldBelongToClass(fldHnd, cls); + return result; +} + // Runs the given function with the given parameter under an error trap // and returns true if the function completes successfully. We fake this // up a bit for SuperPMI and simply catch all exceptions. diff --git a/src/coreclr/binder/assemblybinder.cpp b/src/coreclr/binder/assemblybinder.cpp index c4a2e85d8f5ac8..658e0e031086c6 100644 --- a/src/coreclr/binder/assemblybinder.cpp +++ b/src/coreclr/binder/assemblybinder.cpp @@ -33,6 +33,7 @@ extern HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToBindWithin, BINDER_SPACE::AssemblyName *pAssemblyName, CLRPrivBinderCoreCLR *pTPABinder, + AssemblyLoadContext *pBinder, ICLRPrivAssembly **ppLoadedAssembly); #endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) @@ -1408,6 +1409,7 @@ namespace BINDER_SPACE HRESULT AssemblyBinder::BindUsingHostAssemblyResolver(/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin, /* in */ AssemblyName *pAssemblyName, /* in */ CLRPrivBinderCoreCLR *pTPABinder, + /* in */ AssemblyLoadContext *pBinder, /* out */ Assembly **ppAssembly) { HRESULT hr = E_FAIL; @@ -1417,7 +1419,7 @@ HRESULT AssemblyBinder::BindUsingHostAssemblyResolver(/* in */ INT_PTR pManagedA // RuntimeInvokeHostAssemblyResolver will perform steps 2-4 of CLRPrivBinderAssemblyLoadContext::BindAssemblyByName. ICLRPrivAssembly *pLoadedAssembly = NULL; hr = RuntimeInvokeHostAssemblyResolver(pManagedAssemblyLoadContextToBindWithin, - pAssemblyName, pTPABinder, &pLoadedAssembly); + pAssemblyName, pTPABinder, pBinder, &pLoadedAssembly); if (SUCCEEDED(hr)) { _ASSERTE(pLoadedAssembly != NULL); diff --git a/src/coreclr/binder/clrprivbinderassemblyloadcontext.cpp b/src/coreclr/binder/clrprivbinderassemblyloadcontext.cpp index 92d83d75b111a3..f44db5af13342d 100644 --- a/src/coreclr/binder/clrprivbinderassemblyloadcontext.cpp +++ b/src/coreclr/binder/clrprivbinderassemblyloadcontext.cpp @@ -84,7 +84,7 @@ HRESULT CLRPrivBinderAssemblyLoadContext::BindAssemblyByName(AssemblyNameData *p // of what to do next. The host-overridden binder can either fail the bind or return reference to an existing assembly // that has been loaded. // - hr = AssemblyBinder::BindUsingHostAssemblyResolver(GetManagedAssemblyLoadContext(), pAssemblyName, m_pTPABinder, &pCoreCLRFoundAssembly); + hr = AssemblyBinder::BindUsingHostAssemblyResolver(GetManagedAssemblyLoadContext(), pAssemblyName, m_pTPABinder, this, &pCoreCLRFoundAssembly); if (SUCCEEDED(hr)) { // We maybe returned an assembly that was bound to a different AssemblyLoadContext instance. @@ -258,11 +258,13 @@ void CLRPrivBinderAssemblyLoadContext::PrepareForLoadContextRelease(INT_PTR ptrM _ASSERTE(m_pAssemblyLoaderAllocator != NULL); _ASSERTE(m_loaderAllocatorHandle != NULL); - // We cannot delete the binder here as it is used indirectly when comparing assemblies with the same binder - // It will be deleted when the LoaderAllocator will be deleted - // But we can release the LoaderAllocator as we are no longer using it here + // We need to keep the LoaderAllocator pointer set as it still may be needed for creating references between the + // native LoaderAllocators of two collectible contexts in case the AssemblyLoadContext.Unload was called on the current + // context before returning from its AssemblyLoadContext.Load override or the context's Resolving event. + // But we need to release the LoaderAllocator so that it doesn't prevent completion of the final phase of unloading in + // some cases. It is safe to do as the AssemblyLoaderAllocator is guaranteed to be alive at least until the + // CustomAssemblyBinder::ReleaseLoadContext is called, where we NULL this pointer. m_pAssemblyLoaderAllocator->Release(); - m_pAssemblyLoaderAllocator = NULL; // Destroy the strong handle to the LoaderAllocator in order to let it reach its finalizer DestroyHandle(reinterpret_cast(m_loaderAllocatorHandle)); @@ -287,6 +289,10 @@ void CLRPrivBinderAssemblyLoadContext::ReleaseLoadContext() handle = reinterpret_cast(m_ptrManagedStrongAssemblyLoadContext); DestroyHandle(handle); m_ptrManagedAssemblyLoadContext = NULL; + + // The AssemblyLoaderAllocator is in a process of shutdown and should not be used + // after this point. + m_pAssemblyLoaderAllocator = NULL; } #endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) diff --git a/src/coreclr/binder/clrprivbindercoreclr.cpp b/src/coreclr/binder/clrprivbindercoreclr.cpp index fec66a75458800..8a8aabb0976a5c 100644 --- a/src/coreclr/binder/clrprivbindercoreclr.cpp +++ b/src/coreclr/binder/clrprivbindercoreclr.cpp @@ -107,7 +107,7 @@ HRESULT CLRPrivBinderCoreCLR::BindUsingAssemblyName(BINDER_SPACE::AssemblyName * if (pManagedAssemblyLoadContext != NULL) { hr = AssemblyBinder::BindUsingHostAssemblyResolver(pManagedAssemblyLoadContext, pAssemblyName, - NULL, &pCoreCLRFoundAssembly); + NULL, this, &pCoreCLRFoundAssembly); if (SUCCEEDED(hr)) { // We maybe returned an assembly that was bound to a different AssemblyLoadContext instance. diff --git a/src/coreclr/binder/inc/assemblybinder.hpp b/src/coreclr/binder/inc/assemblybinder.hpp index 2ba11b7ac0183d..ffaab93e4fc3ff 100644 --- a/src/coreclr/binder/inc/assemblybinder.hpp +++ b/src/coreclr/binder/inc/assemblybinder.hpp @@ -21,6 +21,7 @@ class CLRPrivBinderCoreCLR; class PEAssembly; class PEImage; +class AssemblyLoadContext; namespace BINDER_SPACE { @@ -59,6 +60,7 @@ namespace BINDER_SPACE static HRESULT BindUsingHostAssemblyResolver (/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin, /* in */ AssemblyName *pAssemblyName, /* in */ CLRPrivBinderCoreCLR *pTPABinder, + /* in */ AssemblyLoadContext *pBinder, /* out */ Assembly **ppAssembly); static HRESULT BindUsingPEImage(/* in */ ApplicationContext *pApplicationContext, diff --git a/src/coreclr/debug/createdump/crashinfo.cpp b/src/coreclr/debug/createdump/crashinfo.cpp index 8ab327eb15578d..2ca9c21cd4c27f 100644 --- a/src/coreclr/debug/createdump/crashinfo.cpp +++ b/src/coreclr/debug/createdump/crashinfo.cpp @@ -8,14 +8,16 @@ CrashInfo* g_crashInfo; static bool ModuleInfoCompare(const ModuleInfo* lhs, const ModuleInfo* rhs) { return lhs->BaseAddress() < rhs->BaseAddress(); } -CrashInfo::CrashInfo(pid_t pid, bool gatherFrames, pid_t crashThread, uint32_t signal) : +CrashInfo::CrashInfo(const CreateDumpOptions& options) : m_ref(1), - m_pid(pid), + m_pid(options.Pid), m_ppid(-1), m_hdac(nullptr), - m_gatherFrames(gatherFrames), - m_crashThread(crashThread), - m_signal(signal), + m_pClrDataEnumRegions(nullptr), + m_pClrDataProcess(nullptr), + m_gatherFrames(options.CrashReport), + m_crashThread(options.CrashThread), + m_signal(options.Signal), m_moduleInfos(&ModuleInfoCompare), m_mainModule(nullptr) { @@ -25,6 +27,11 @@ CrashInfo::CrashInfo(pid_t pid, bool gatherFrames, pid_t crashThread, uint32_t s #else m_auxvValues.fill(0); m_fd = -1; + memset(&m_siginfo, 0, sizeof(m_siginfo)); + m_siginfo.si_signo = options.Signal; + m_siginfo.si_code = options.SignalCode; + m_siginfo.si_errno = options.SignalErrno; + m_siginfo.si_addr = options.SignalAddress; #endif } @@ -44,6 +51,15 @@ CrashInfo::~CrashInfo() } m_moduleInfos.clear(); + // Clean up DAC interfaces + if (m_pClrDataEnumRegions != nullptr) + { + m_pClrDataEnumRegions->Release(); + } + if (m_pClrDataProcess != nullptr) + { + m_pClrDataProcess->Release(); + } // Unload DAC module if (m_hdac != nullptr) { @@ -56,7 +72,7 @@ CrashInfo::~CrashInfo() kern_return_t result = ::mach_port_deallocate(mach_task_self(), m_task); if (result != KERN_SUCCESS) { - fprintf(stderr, "~CrashInfo: mach_port_deallocate FAILED %x %s\n", result, mach_error_string(result)); + printf_error("~CrashInfo: mach_port_deallocate FAILED %x %s\n", result, mach_error_string(result)); } } #endif @@ -190,13 +206,19 @@ CrashInfo::GatherCrashInfo(MINIDUMP_TYPE minidumpType) thread->GetThreadStack(); } } - // Gather all the useful memory regions from the DAC - if (!EnumerateMemoryRegionsWithDAC(minidumpType)) + // Load and initialize DAC interfaces + if (!InitializeDAC()) + { + return false; + } + if (!EnumerateManagedModules()) + { + return false; + } + if (!UnwindAllThreads()) { return false; } - // Join all adjacent memory regions - CombineMemoryRegions(); return true; } @@ -204,19 +226,15 @@ CrashInfo::GatherCrashInfo(MINIDUMP_TYPE minidumpType) // Enumerate all the memory regions using the DAC memory region support given a minidump type // bool -CrashInfo::EnumerateMemoryRegionsWithDAC(MINIDUMP_TYPE minidumpType) +CrashInfo::InitializeDAC() { ReleaseHolder dataTarget = new DumpDataTarget(*this); PFN_CLRDataCreateInstance pfnCLRDataCreateInstance = nullptr; - ICLRDataEnumMemoryRegions* pClrDataEnumRegions = nullptr; - IXCLRDataProcess* pClrDataProcess = nullptr; - HRESULT hr = S_OK; bool result = false; + HRESULT hr = S_OK; if (!m_coreclrPath.empty()) { - TRACE("EnumerateMemoryRegionsWithDAC: Memory enumeration STARTED\n"); - // We assume that the DAC is in the same location as the libcoreclr.so module std::string dacPath; dacPath.append(m_coreclrPath); @@ -226,149 +244,165 @@ CrashInfo::EnumerateMemoryRegionsWithDAC(MINIDUMP_TYPE minidumpType) m_hdac = LoadLibraryA(dacPath.c_str()); if (m_hdac == nullptr) { - fprintf(stderr, "LoadLibraryA(%s) FAILED %d\n", dacPath.c_str(), GetLastError()); + printf_error("LoadLibraryA(%s) FAILED %d\n", dacPath.c_str(), GetLastError()); goto exit; } pfnCLRDataCreateInstance = (PFN_CLRDataCreateInstance)GetProcAddress(m_hdac, "CLRDataCreateInstance"); if (pfnCLRDataCreateInstance == nullptr) { - fprintf(stderr, "GetProcAddress(CLRDataCreateInstance) FAILED %d\n", GetLastError()); + printf_error("GetProcAddress(CLRDataCreateInstance) FAILED %d\n", GetLastError()); goto exit; } - if ((minidumpType & MiniDumpWithFullMemory) == 0) - { - hr = pfnCLRDataCreateInstance(__uuidof(ICLRDataEnumMemoryRegions), dataTarget, (void**)&pClrDataEnumRegions); - if (FAILED(hr)) - { - fprintf(stderr, "CLRDataCreateInstance(ICLRDataEnumMemoryRegions) FAILED %08x\n", hr); - goto exit; - } - // Calls CrashInfo::EnumMemoryRegion for each memory region found by the DAC - hr = pClrDataEnumRegions->EnumMemoryRegions(this, minidumpType, CLRDATA_ENUM_MEM_DEFAULT); - if (FAILED(hr)) - { - fprintf(stderr, "EnumMemoryRegions FAILED %08x\n", hr); - goto exit; - } - } - hr = pfnCLRDataCreateInstance(__uuidof(IXCLRDataProcess), dataTarget, (void**)&pClrDataProcess); + hr = pfnCLRDataCreateInstance(__uuidof(ICLRDataEnumMemoryRegions), dataTarget, (void**)&m_pClrDataEnumRegions); if (FAILED(hr)) { - fprintf(stderr, "CLRDataCreateInstance(IXCLRDataProcess) FAILED %08x\n", hr); + printf_error("CLRDataCreateInstance(ICLRDataEnumMemoryRegions) FAILED %08x\n", hr); goto exit; } - TRACE("EnumerateMemoryRegionsWithDAC: Memory enumeration FINISHED\n"); - if (!EnumerateManagedModules(pClrDataProcess)) + hr = pfnCLRDataCreateInstance(__uuidof(IXCLRDataProcess), dataTarget, (void**)&m_pClrDataProcess); + if (FAILED(hr)) { + printf_error("CLRDataCreateInstance(IXCLRDataProcess) FAILED %08x\n", hr); goto exit; } } - else { - TRACE("EnumerateMemoryRegionsWithDAC: coreclr not found; not using DAC\n"); - } - if (!UnwindAllThreads(pClrDataProcess)) + else { - goto exit; + TRACE("InitializeDAC: coreclr not found; not using DAC\n"); } result = true; exit: - if (pClrDataEnumRegions != nullptr) - { - pClrDataEnumRegions->Release(); - } - if (pClrDataProcess != nullptr) + return result; +} + +// +// Enumerate all the memory regions using the DAC memory region support given a minidump type +// +bool +CrashInfo::EnumerateMemoryRegionsWithDAC(MINIDUMP_TYPE minidumpType) +{ + if (m_pClrDataEnumRegions != nullptr && (minidumpType & MiniDumpWithFullMemory) == 0) { - pClrDataProcess->Release(); + TRACE("EnumerateMemoryRegionsWithDAC: Memory enumeration STARTED\n"); + + // Since on both Linux and MacOS all the RW regions will be added for heap + // dumps by createdump, the only thing differentiating a MiniDumpNormal and + // a MiniDumpWithPrivateReadWriteMemory is that the later uses the EnumMemory + // APIs. This is kind of expensive on larger applications (4 minutes, or even + // more), and this should already be in RW pages. Change the dump type to the + // faster normal one. This one already ensures necessary DAC globals, etc. + // without the costly assembly, module, class, type runtime data structures + // enumeration. + if (minidumpType & MiniDumpWithPrivateReadWriteMemory) + { + char* fastHeapDumps = getenv("COMPlus_DbgEnableFastHeapDumps"); + if (fastHeapDumps != nullptr && strcmp(fastHeapDumps, "1") == 0) + { + minidumpType = MiniDumpNormal; + } + } + // Calls CrashInfo::EnumMemoryRegion for each memory region found by the DAC + HRESULT hr = m_pClrDataEnumRegions->EnumMemoryRegions(this, minidumpType, CLRDATA_ENUM_MEM_DEFAULT); + if (FAILED(hr)) + { + printf_error("EnumMemoryRegions FAILED %08x\n", hr); + return false; + } + TRACE("EnumerateMemoryRegionsWithDAC: Memory enumeration FINISHED\n"); } - return result; + return true; } // // Enumerate all the managed modules and replace the module mapping with the module name found. // bool -CrashInfo::EnumerateManagedModules(IXCLRDataProcess* pClrDataProcess) +CrashInfo::EnumerateManagedModules() { CLRDATA_ENUM enumModules = 0; - bool result = true; HRESULT hr = S_OK; - if (FAILED(hr = pClrDataProcess->StartEnumModules(&enumModules))) { - fprintf(stderr, "StartEnumModules FAILED %08x\n", hr); - return false; - } - - while (true) + if (m_pClrDataProcess != nullptr) { - ReleaseHolder pClrDataModule; - if ((hr = pClrDataProcess->EnumModule(&enumModules, &pClrDataModule)) != S_OK) { - break; - } + TRACE("EnumerateManagedModules: Module enumeration STARTED\n"); - // Skip any dynamic modules. The Request call below on some DACs crashes on dynamic modules. - ULONG32 flags; - if ((hr = pClrDataModule->GetFlags(&flags)) != S_OK) { - TRACE("MODULE: GetFlags FAILED %08x\n", hr); - continue; - } - if (flags & CLRDATA_MODULE_IS_DYNAMIC) { - TRACE("MODULE: Skipping dynamic module\n"); - continue; + if (FAILED(hr = m_pClrDataProcess->StartEnumModules(&enumModules))) { + printf_error("StartEnumModules FAILED %08x\n", hr); + return false; } - DacpGetModuleData moduleData; - if (SUCCEEDED(hr = moduleData.Request(pClrDataModule.GetPtr()))) + while (true) { - TRACE("MODULE: %" PRIA PRIx64 " dyn %d inmem %d file %d pe %" PRIA PRIx64 " pdb %" PRIA PRIx64, (uint64_t)moduleData.LoadedPEAddress, moduleData.IsDynamic, - moduleData.IsInMemory, moduleData.IsFileLayout, (uint64_t)moduleData.PEFile, (uint64_t)moduleData.InMemoryPdbAddress); + ReleaseHolder pClrDataModule; + if ((hr = m_pClrDataProcess->EnumModule(&enumModules, &pClrDataModule)) != S_OK) { + break; + } - if (!moduleData.IsDynamic && moduleData.LoadedPEAddress != 0) + // Skip any dynamic modules. The Request call below on some DACs crashes on dynamic modules. + ULONG32 flags; + if ((hr = pClrDataModule->GetFlags(&flags)) != S_OK) { + TRACE("MODULE: GetFlags FAILED %08x\n", hr); + continue; + } + if (flags & CLRDATA_MODULE_IS_DYNAMIC) { + TRACE("MODULE: Skipping dynamic module\n"); + continue; + } + + DacpGetModuleData moduleData; + if (SUCCEEDED(hr = moduleData.Request(pClrDataModule.GetPtr()))) { - ArrayHolder wszUnicodeName = new WCHAR[MAX_LONGPATH + 1]; - if (SUCCEEDED(hr = pClrDataModule->GetFileName(MAX_LONGPATH, nullptr, wszUnicodeName))) + TRACE("MODULE: %" PRIA PRIx64 " dyn %d inmem %d file %d pe %" PRIA PRIx64 " pdb %" PRIA PRIx64, (uint64_t)moduleData.LoadedPEAddress, moduleData.IsDynamic, + moduleData.IsInMemory, moduleData.IsFileLayout, (uint64_t)moduleData.PEFile, (uint64_t)moduleData.InMemoryPdbAddress); + + if (!moduleData.IsDynamic && moduleData.LoadedPEAddress != 0) { - std::string moduleName = FormatString("%S", wszUnicodeName.GetPtr()); + ArrayHolder wszUnicodeName = new WCHAR[MAX_LONGPATH + 1]; + if (SUCCEEDED(hr = pClrDataModule->GetFileName(MAX_LONGPATH, nullptr, wszUnicodeName))) + { + std::string moduleName = FormatString("%S", wszUnicodeName.GetPtr()); - // Change the module mapping name - ReplaceModuleMapping(moduleData.LoadedPEAddress, moduleData.LoadedPESize, moduleName); + // Change the module mapping name + ReplaceModuleMapping(moduleData.LoadedPEAddress, moduleData.LoadedPESize, moduleName); - // Add managed module info - AddModuleInfo(true, moduleData.LoadedPEAddress, pClrDataModule, moduleName); + // Add managed module info + AddModuleInfo(true, moduleData.LoadedPEAddress, pClrDataModule, moduleName); + } + else { + TRACE("\nModule.GetFileName FAILED %08x\n", hr); + } } else { - TRACE("\nModule.GetFileName FAILED %08x\n", hr); + TRACE("\n"); } } else { - TRACE("\n"); + TRACE("moduleData.Request FAILED %08x\n", hr); } } - else { - TRACE("moduleData.Request FAILED %08x\n", hr); - } - } - if (enumModules != 0) { - pClrDataProcess->EndEnumModules(enumModules); + if (enumModules != 0) { + m_pClrDataProcess->EndEnumModules(enumModules); + } + TRACE("EnumerateManagedModules: Module enumeration FINISHED\n"); } - - return result; + return true; } // // Unwind all the native threads to ensure that the dwarf unwind info is added to the core dump. // bool -CrashInfo::UnwindAllThreads(IXCLRDataProcess* pClrDataProcess) +CrashInfo::UnwindAllThreads() { ReleaseHolder pSos = nullptr; - if (pClrDataProcess != nullptr) { - pClrDataProcess->QueryInterface(__uuidof(ISOSDacInterface), (void**)&pSos); + if (m_pClrDataProcess != nullptr) { + m_pClrDataProcess->QueryInterface(__uuidof(ISOSDacInterface), (void**)&pSos); } // For each native and managed thread for (ThreadInfo* thread : m_threads) { - if (!thread->UnwindThread(pClrDataProcess, pSos)) { + if (!thread->UnwindThread(m_pClrDataProcess, pSos)) { return false; } } @@ -744,6 +778,7 @@ CrashInfo::Trace(const char* format, ...) { va_list args; va_start(args, format); + fprintf(stdout, "[createdump] "); vfprintf(stdout, format, args); fflush(stdout); va_end(args); @@ -757,6 +792,7 @@ CrashInfo::TraceVerbose(const char* format, ...) { va_list args; va_start(args, format); + fprintf(stdout, "[createdump] "); vfprintf(stdout, format, args); fflush(stdout); va_end(args); @@ -827,5 +863,5 @@ FormatGuid(const GUID* guid) { uint8_t* bytes = (uint8_t*)guid; return FormatString("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - bytes[3], bytes[2], bytes[1], bytes[0], bytes[5], bytes[4], bytes[7], bytes[6], bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]); + bytes[3], bytes[2], bytes[1], bytes[0], bytes[5], bytes[4], bytes[7], bytes[6], bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]); } diff --git a/src/coreclr/debug/createdump/crashinfo.h b/src/coreclr/debug/createdump/crashinfo.h index ca8f77994ac751..74f9c5d4d3b1d5 100644 --- a/src/coreclr/debug/createdump/crashinfo.h +++ b/src/coreclr/debug/createdump/crashinfo.h @@ -47,6 +47,8 @@ class CrashInfo : public ICLRDataEnumMemoryRegionsCallback, pid_t m_ppid; // parent pid pid_t m_tgid; // process group HMODULE m_hdac; // dac module handle when loaded + ICLRDataEnumMemoryRegions* m_pClrDataEnumRegions; // dac enumerate memory interface instance + IXCLRDataProcess* m_pClrDataProcess; // dac process interface instance bool m_gatherFrames; // if true, add the native and managed stack frames to the thread info pid_t m_crashThread; // crashing thread id or 0 if none uint32_t m_signal; // crash signal code or 0 if none @@ -54,6 +56,7 @@ class CrashInfo : public ICLRDataEnumMemoryRegionsCallback, #ifdef __APPLE__ vm_map_t m_task; // the mach task for the process #else + siginfo_t m_siginfo; // signal info (if any) bool m_canUseProcVmReadSyscall; int m_fd; // /proc//mem handle #endif @@ -77,13 +80,15 @@ class CrashInfo : public ICLRDataEnumMemoryRegionsCallback, void operator=(const CrashInfo&) = delete; public: - CrashInfo(pid_t pid, bool gatherFrames, pid_t crashThread, uint32_t signal); + CrashInfo(const CreateDumpOptions& options); virtual ~CrashInfo(); bool Initialize(); void CleanupAndResumeProcess(); bool EnumerateAndSuspendThreads(); bool GatherCrashInfo(MINIDUMP_TYPE minidumpType); + void CombineMemoryRegions(); + bool EnumerateMemoryRegionsWithDAC(MINIDUMP_TYPE minidumpType); bool ReadMemory(void* address, void* buffer, size_t size); // read memory and add to dump bool ReadProcessMemory(void* address, void* buffer, size_t size, size_t* read); // read raw memory uint64_t GetBaseAddressFromAddress(uint64_t address); @@ -113,6 +118,7 @@ class CrashInfo : public ICLRDataEnumMemoryRegionsCallback, #ifndef __APPLE__ inline const std::vector& AuxvEntries() const { return m_auxvEntries; } inline size_t GetAuxvSize() const { return m_auxvEntries.size() * sizeof(elf_aux_entry); } + inline const siginfo_t* SigInfo() const { return &m_siginfo; } #endif // IUnknown @@ -126,7 +132,6 @@ class CrashInfo : public ICLRDataEnumMemoryRegionsCallback, private: #ifdef __APPLE__ bool EnumerateMemoryRegions(); - bool TryFindDyLinker(mach_vm_address_t address, mach_vm_size_t size, bool* found); void VisitModule(MachOModule& module); void VisitSegment(MachOModule& module, const segment_command_64& segment); void VisitSection(MachOModule& module, const section_64& section); @@ -137,15 +142,14 @@ class CrashInfo : public ICLRDataEnumMemoryRegionsCallback, void VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, ElfW(Phdr)* phdr); bool EnumerateModuleMappings(); #endif - bool EnumerateMemoryRegionsWithDAC(MINIDUMP_TYPE minidumpType); - bool EnumerateManagedModules(IXCLRDataProcess* pClrDataProcess); - bool UnwindAllThreads(IXCLRDataProcess* pClrDataProcess); + bool InitializeDAC(); + bool EnumerateManagedModules(); + bool UnwindAllThreads(); void ReplaceModuleMapping(CLRDATA_ADDRESS baseAddress, ULONG64 size, const std::string& pszName); void InsertMemoryBackedRegion(const MemoryRegion& region); void InsertMemoryRegion(const MemoryRegion& region); uint32_t GetMemoryRegionFlags(uint64_t start); bool ValidRegion(const MemoryRegion& region); - void CombineMemoryRegions(); void Trace(const char* format, ...); void TraceVerbose(const char* format, ...); }; diff --git a/src/coreclr/debug/createdump/crashinfomac.cpp b/src/coreclr/debug/createdump/crashinfomac.cpp index ad9c247e37dfdc..6f0854b0743433 100644 --- a/src/coreclr/debug/createdump/crashinfomac.cpp +++ b/src/coreclr/debug/createdump/crashinfomac.cpp @@ -3,6 +3,8 @@ #include "createdump.h" +int g_readProcessMemoryResult = KERN_SUCCESS; + bool CrashInfo::Initialize() { @@ -12,7 +14,7 @@ CrashInfo::Initialize() kern_return_t result = ::task_for_pid(mach_task_self(), m_pid, &m_task); if (result != KERN_SUCCESS) { - fprintf(stderr, "task_for_pid(%d) FAILED %x %s\n", m_pid, result, mach_error_string(result)); + printf_error("task_for_pid(%d) FAILED %x %s\n", m_pid, result, mach_error_string(result)); return false; } return true; @@ -37,14 +39,14 @@ CrashInfo::EnumerateAndSuspendThreads() kern_return_t result = ::task_suspend(Task()); if (result != KERN_SUCCESS) { - fprintf(stderr, "task_suspend(%d) FAILED %x %s\n", m_pid, result, mach_error_string(result)); + printf_error("task_suspend(%d) FAILED %x %s\n", m_pid, result, mach_error_string(result)); return false; } result = ::task_threads(Task(), &threadList, &threadCount); if (result != KERN_SUCCESS) { - fprintf(stderr, "task_threads(%d) FAILED %x %s\n", m_pid, result, mach_error_string(result)); + printf_error("task_threads(%d) FAILED %x %s\n", m_pid, result, mach_error_string(result)); return false; } @@ -127,7 +129,7 @@ CrashInfo::EnumerateMemoryRegions() } else { - if ((info.protection & (VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE)) != 0) + if (info.share_mode != SM_EMPTY && (info.protection & (VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE)) != 0) { MemoryRegion memoryRegion(ConvertProtectionFlags(info.protection), address, address + size, info.offset); m_allMemoryRegions.insert(memoryRegion); @@ -136,16 +138,20 @@ CrashInfo::EnumerateMemoryRegions() } } - // Now find all the modules and add them to the module list - for (const MemoryRegion& region : m_allMemoryRegions) + // Get the dylinker info and enumerate all the modules + struct task_dyld_info dyld_info; + mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT; + kern_return_t result = ::task_info(Task(), TASK_DYLD_INFO, (task_info_t)&dyld_info, &count); + if (result != KERN_SUCCESS) { - bool found; - if (!TryFindDyLinker(region.StartAddress(), region.Size(), &found)) { - return false; - } - if (found) { - break; - } + TRACE("EnumerateMemoryRegions: task_info(TASK_DYLD_INFO) FAILED %x %s\n", result, mach_error_string(result)); + return false; + } + + // Enumerate all the modules in dyld's image cache. VisitModule is called for every module found. + if (!EnumerateModules(dyld_info.all_image_info_addr)) + { + return false; } // Filter out the module regions from the memory regions gathered @@ -195,46 +201,6 @@ CrashInfo::EnumerateMemoryRegions() return true; } -bool -CrashInfo::TryFindDyLinker(mach_vm_address_t address, mach_vm_size_t size, bool* found) -{ - bool result = true; - *found = false; - - if (size > sizeof(mach_header_64)) - { - mach_header_64 header; - size_t read = 0; - if (ReadProcessMemory((void*)address, &header, sizeof(mach_header_64), &read)) - { - if (header.magic == MH_MAGIC_64) - { - TRACE("TryFindDyLinker: found module header at %016llx %08llx ncmds %d sizeofcmds %08x type %02x\n", - address, - size, - header.ncmds, - header.sizeofcmds, - header.filetype); - - if (header.filetype == MH_DYLINKER) - { - TRACE("TryFindDyLinker: found dylinker\n"); - *found = true; - - // Enumerate all the modules in dyld's image cache. VisitModule is called for every module found. - result = EnumerateModules(address, &header); - } - } - } - else - { - TRACE("TryFindDyLinker: ReadProcessMemory header at %p %d FAILED\n", address, read); - } - } - - return result; -} - void CrashInfo::VisitModule(MachOModule& module) { AddModuleInfo(false, module.BaseAddress(), nullptr, module.Name()); @@ -277,6 +243,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 +266,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 { @@ -362,6 +328,7 @@ CrashInfo::ReadProcessMemory(void* address, void* buffer, size_t size, size_t* r kern_return_t result = ::vm_read_overwrite(Task(), addressAligned, PAGE_SIZE, (vm_address_t)data, &bytesRead); if (result != KERN_SUCCESS || bytesRead != PAGE_SIZE) { + g_readProcessMemoryResult = result; TRACE_VERBOSE("ReadProcessMemory(%p %d): vm_read_overwrite failed bytesLeft %d bytesRead %d from %p: %x %s\n", address, size, bytesLeft, bytesRead, (void*)addressAligned, result, mach_error_string(result)); break; diff --git a/src/coreclr/debug/createdump/crashinfounix.cpp b/src/coreclr/debug/createdump/crashinfounix.cpp index 2f9605554ad1f3..03712c3b6847d0 100644 --- a/src/coreclr/debug/createdump/crashinfounix.cpp +++ b/src/coreclr/debug/createdump/crashinfounix.cpp @@ -3,6 +3,12 @@ #include "createdump.h" +#ifndef PT_ARM_EXIDX +#define PT_ARM_EXIDX 0x70000001 /* See llvm ELF.h */ +#endif + +extern CrashInfo* g_crashInfo; + bool GetStatus(pid_t pid, pid_t* ppid, pid_t* tgid, std::string* name); bool @@ -14,7 +20,7 @@ CrashInfo::Initialize() m_fd = open(memPath, O_RDONLY); if (m_fd == -1) { - fprintf(stderr, "open(%s) FAILED %d (%s)\n", memPath, errno, strerror(errno)); + printf_error("open(%s) FAILED %d (%s)\n", memPath, errno, strerror(errno)); return false; } // Get the process info @@ -58,7 +64,7 @@ CrashInfo::EnumerateAndSuspendThreads() DIR* taskDir = opendir(taskPath); if (taskDir == nullptr) { - fprintf(stderr, "opendir(%s) FAILED %s\n", taskPath, strerror(errno)); + printf_error("opendir(%s) FAILED %s\n", taskPath, strerror(errno)); return false; } @@ -76,7 +82,7 @@ CrashInfo::EnumerateAndSuspendThreads() } else { - fprintf(stderr, "ptrace(ATTACH, %d) FAILED %s\n", tid, strerror(errno)); + printf_error("ptrace(ATTACH, %d) FAILED %s\n", tid, strerror(errno)); closedir(taskDir); return false; } @@ -102,7 +108,7 @@ CrashInfo::GetAuxvEntries() int fd = open(auxvPath, O_RDONLY, 0); if (fd == -1) { - fprintf(stderr, "open(%s) FAILED %s\n", auxvPath, strerror(errno)); + printf_error("open(%s) FAILED %s\n", auxvPath, strerror(errno)); return false; } bool result = false; @@ -159,7 +165,7 @@ CrashInfo::EnumerateModuleMappings() FILE* mapsFile = fopen(mapPath, "r"); if (mapsFile == nullptr) { - fprintf(stderr, "fopen(%s) FAILED %s\n", mapPath, strerror(errno)); + printf_error("fopen(%s) FAILED %s\n", mapPath, strerror(errno)); return false; } // linuxGateAddress is the beginning of the kernel's mapping of @@ -285,6 +291,14 @@ CrashInfo::VisitModule(uint64_t baseAddress, std::string& moduleName) EnumerateProgramHeaders(baseAddress); } +// Helper for PAL_GetUnwindInfoSize. Reads memory directly without adding it to the memory region list. +BOOL +ReadMemoryAdapter(PVOID address, PVOID buffer, SIZE_T size) +{ + size_t read = 0; + return g_crashInfo->ReadProcessMemory(address, buffer, size, &read); +} + // // Called for each program header adding the build id note, unwind frame // region and module addresses to the crash info. @@ -296,12 +310,40 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd { case PT_DYNAMIC: case PT_NOTE: - case PT_GNU_EH_FRAME: - if (phdr->p_vaddr != 0 && phdr->p_memsz != 0) { +#if defined(TARGET_ARM) + case PT_ARM_EXIDX: +#endif + if (phdr->p_vaddr != 0 && phdr->p_memsz != 0) + { InsertMemoryRegion(loadbias + phdr->p_vaddr, phdr->p_memsz); } break; + case PT_GNU_EH_FRAME: + if (phdr->p_vaddr != 0 && phdr->p_memsz != 0) + { + uint64_t ehFrameHdrStart = loadbias + phdr->p_vaddr; + uint64_t ehFrameHdrSize = phdr->p_memsz; + TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize); + InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize); + + uint64_t ehFrameStart; + uint64_t ehFrameSize; + if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize)) + { + TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize); + if (ehFrameStart != 0 && ehFrameSize != 0) + { + InsertMemoryRegion(ehFrameStart, ehFrameSize); + } + } + else + { + TRACE("VisitProgramHeader: PAL_GetUnwindInfoSize FAILED\n"); + } + } + break; + case PT_LOAD: AddModuleAddressRange(loadbias + phdr->p_vaddr, loadbias + phdr->p_vaddr + phdr->p_memsz, baseAddress); break; @@ -377,7 +419,7 @@ GetStatus(pid_t pid, pid_t* ppid, pid_t* tgid, std::string* name) FILE *statusFile = fopen(statusPath, "r"); if (statusFile == nullptr) { - fprintf(stderr, "GetStatus fopen(%s) FAILED\n", statusPath); + printf_error("GetStatus fopen(%s) FAILED\n", statusPath); return false; } diff --git a/src/coreclr/debug/createdump/crashreportwriter.cpp b/src/coreclr/debug/createdump/crashreportwriter.cpp index 1fb0865cf5d5f7..9cca2ccdfae6e6 100644 --- a/src/coreclr/debug/createdump/crashreportwriter.cpp +++ b/src/coreclr/debug/createdump/crashreportwriter.cpp @@ -33,7 +33,7 @@ CrashReportWriter::WriteCrashReport(const std::string& dumpFileName) { std::string crashReportFile(dumpFileName); crashReportFile.append(".crashreport.json"); - printf("Writing crash report to file %s\n", crashReportFile.c_str()); + printf_status("Writing crash report to file %s\n", crashReportFile.c_str()); try { if (!OpenWriter(crashReportFile.c_str())) { @@ -41,10 +41,11 @@ CrashReportWriter::WriteCrashReport(const std::string& dumpFileName) } WriteCrashReport(); CloseWriter(); + printf_status("Crash report successfully written\n"); } catch (const std::exception& e) { - fprintf(stderr, "Writing the crash report file FAILED\n"); + printf_error("Writing the crash report file FAILED\n"); // Delete the partial json file on error remove(crashReportFile.c_str()); @@ -84,18 +85,20 @@ CrashReportWriter::WriteCrashReport() { OpenObject(); bool crashed = false; - if (thread->ManagedExceptionObject() != 0) + if (thread->Tid() == m_crashInfo.CrashThread()) { crashed = true; - exceptionType = "0x05000000"; // ManagedException - } - else - { - if (thread->Tid() == m_crashInfo.CrashThread()) + if (thread->ManagedExceptionObject() != 0) + { + exceptionType = "0x05000000"; // ManagedException + } + else { - crashed = true; switch (m_crashInfo.Signal()) { + case 0: + break; + case SIGILL: exceptionType = "0x50000000"; break; @@ -121,9 +124,12 @@ CrashReportWriter::WriteCrashReport() break; case SIGABRT: - default: exceptionType = "0x30000000"; break; + + default: + exceptionType = "0x00000000"; + break; } } } @@ -169,17 +175,17 @@ CrashReportWriter::WriteCrashReport() } CloseArray(); // threads CloseObject(); // payload -#ifdef __APPLE__ OpenObject("parameters"); if (exceptionType != nullptr) { WriteValue("ExceptionType", exceptionType); } +#ifdef __APPLE__ WriteSysctl("kern.osproductversion", "OSVersion"); WriteSysctl("hw.model", "SystemModel"); WriteValue("SystemManufacturer", "apple"); - CloseObject(); // parameters #endif // __APPLE__ + CloseObject(); // parameters } #ifdef __APPLE__ @@ -266,7 +272,7 @@ CrashReportWriter::OpenWriter(const char* fileName) m_fd = open(fileName, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR | S_IRUSR); if (m_fd == -1) { - fprintf(stderr, "Could not create json file %s: %d %s\n", fileName, errno, strerror(errno)); + printf_error("Could not create json file %s: %d %s\n", fileName, errno, strerror(errno)); return false; } Write("{\n"); diff --git a/src/coreclr/debug/createdump/createdump.h b/src/coreclr/debug/createdump/createdump.h index f588867c7926f8..68012ffef7a3df 100644 --- a/src/coreclr/debug/createdump/createdump.h +++ b/src/coreclr/debug/createdump/createdump.h @@ -23,6 +23,9 @@ extern bool g_diagnosticsVerbose; #define TRACE_VERBOSE(args, ...) #endif +// Keep in sync with the definitions in dbgutil.cpp and daccess.h +#define DACCESS_TABLE_SYMBOL "g_dacTable" + #ifdef HOST_64BIT #define PRIA "016" #else @@ -89,6 +92,24 @@ typedef int T_CONTEXT; #include #include #include + +typedef struct +{ + const char* DumpPathTemplate; + const char* DumpType; + MINIDUMP_TYPE MinidumpType; + bool CreateDump; + bool CrashReport; + int Pid; + int CrashThread; + int Signal; +#if defined(HOST_UNIX) + int SignalCode; + int SignalErrno; + void* SignalAddress; +#endif +} CreateDumpOptions; + #ifdef HOST_UNIX #ifdef __APPLE__ #include @@ -108,6 +129,13 @@ typedef int T_CONTEXT; #define MAX_LONGPATH 1024 #endif -bool FormatDumpName(std::string& name, const char* pattern, const char* exename, int pid); -bool CreateDump(const char* dumpPathTemplate, int pid, const char* dumpType, MINIDUMP_TYPE minidumpType, bool crashReport, int crashThread, int signal); +extern bool CreateDump(const CreateDumpOptions& options); +extern bool FormatDumpName(std::string& name, const char* pattern, const char* exename, int pid); +#ifdef HOST_WINDOWS +extern DWORD GetTempPathWrapper(IN DWORD nBufferLength, OUT LPSTR lpBuffer); +#else +#define GetTempPathWrapper GetTempPathA +#endif +extern void printf_status(const char* format, ...); +extern void printf_error(const char* format, ...); diff --git a/src/coreclr/debug/createdump/createdumpunix.cpp b/src/coreclr/debug/createdump/createdumpunix.cpp index b789c98b820f14..96bcc0cf6a7f1f 100644 --- a/src/coreclr/debug/createdump/createdumpunix.cpp +++ b/src/coreclr/debug/createdump/createdumpunix.cpp @@ -7,9 +7,9 @@ // The Linux/MacOS create dump code // bool -CreateDump(const char* dumpPathTemplate, int pid, const char* dumpType, MINIDUMP_TYPE minidumpType, bool crashReport, int crashThread, int signal) +CreateDump(const CreateDumpOptions& options) { - ReleaseHolder crashInfo = new CrashInfo(pid, crashReport, crashThread, signal); + ReleaseHolder crashInfo = new CrashInfo(options); DumpWriter dumpWriter(*crashInfo); std::string dumpPath; bool result = false; @@ -19,11 +19,11 @@ CreateDump(const char* dumpPathTemplate, int pid, const char* dumpType, MINIDUMP { goto exit; } - printf("Gathering state for process %d %s\n", pid, crashInfo->Name().c_str()); + printf_status("Gathering state for process %d %s\n", options.Pid, crashInfo->Name().c_str()); - if (signal != 0 || crashThread != 0) + if (options.Signal != 0 || options.CrashThread != 0) { - printf("Crashing thread %08x signal %08x\n", crashThread, signal); + printf_status("Crashing thread %04x signal %d (%04x)\n", options.CrashThread, options.Signal, options.Signal); } // Suspend all the threads in the target process and build the list of threads @@ -32,38 +32,65 @@ CreateDump(const char* dumpPathTemplate, int pid, const char* dumpType, MINIDUMP goto exit; } // Gather all the info about the process, threads (registers, etc.) and memory regions - if (!crashInfo->GatherCrashInfo(minidumpType)) + if (!crashInfo->GatherCrashInfo(options.MinidumpType)) { goto exit; } // Format the dump pattern template now that the process name on MacOS has been obtained - if (!FormatDumpName(dumpPath, dumpPathTemplate, crashInfo->Name().c_str(), pid)) + if (!FormatDumpName(dumpPath, options.DumpPathTemplate, crashInfo->Name().c_str(), options.Pid)) { goto exit; } // Write the crash report json file if enabled - if (crashReport) + if (options.CrashReport) { CrashReportWriter crashReportWriter(*crashInfo); crashReportWriter.WriteCrashReport(dumpPath); } - printf("Writing %s to file %s\n", dumpType, dumpPath.c_str()); - - // Write the actual dump file - if (!dumpWriter.OpenDump(dumpPath.c_str())) + if (options.CreateDump) { - goto exit; - } - if (!dumpWriter.WriteDump()) - { - fprintf(stderr, "Writing dump FAILED\n"); + // Gather all the useful memory regions from the DAC + if (!crashInfo->EnumerateMemoryRegionsWithDAC(options.MinidumpType)) + { + goto exit; + } + // Join all adjacent memory regions + crashInfo->CombineMemoryRegions(); + + printf_status("Writing %s to file %s\n", options.DumpType, dumpPath.c_str()); + + // Write the actual dump file + if (!dumpWriter.OpenDump(dumpPath.c_str())) + { + goto exit; + } + if (!dumpWriter.WriteDump()) + { + printf_error( "Writing dump FAILED\n"); - // Delete the partial dump file on error - remove(dumpPath.c_str()); - goto exit; + // Delete the partial dump file on error + remove(dumpPath.c_str()); + goto exit; + } } result = true; exit: + if (kill(options.Pid, 0) == 0) + { + printf_status("Target process is alive\n"); + } + else + { + int err = errno; + if (err == ESRCH) + { + printf_error("Target process terminated\n"); + } + else + { + printf_error("kill(%d, 0) FAILED %s (%d)\n", options.Pid, strerror(err), err); + } + } crashInfo->CleanupAndResumeProcess(); return result; } diff --git a/src/coreclr/debug/createdump/createdumpwindows.cpp b/src/coreclr/debug/createdump/createdumpwindows.cpp index 6d474d3475d215..d598ade93e81f5 100644 --- a/src/coreclr/debug/createdump/createdumpwindows.cpp +++ b/src/coreclr/debug/createdump/createdumpwindows.cpp @@ -8,7 +8,7 @@ // The Windows create dump code // bool -CreateDump(const char* dumpPathTemplate, int pid, const char* dumpType, MINIDUMP_TYPE minidumpType, bool crashReport, int crashThread, int signal) +CreateDump(const CreateDumpOptions& options) { HANDLE hFile = INVALID_HANDLE_VALUE; HANDLE hProcess = NULL; @@ -17,34 +17,34 @@ CreateDump(const char* dumpPathTemplate, int pid, const char* dumpType, MINIDUMP ArrayHolder pszName = new char[MAX_LONGPATH + 1]; std::string dumpPath; - hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid); + hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, options.Pid); if (hProcess == NULL) { - fprintf(stderr, "Invalid process id '%d' error %d\n", pid, GetLastError()); + printf_error("Invalid process id '%d' error %d\n", options.Pid, GetLastError()); goto exit; } if (GetModuleBaseNameA(hProcess, NULL, pszName, MAX_LONGPATH) <= 0) { - fprintf(stderr, "Get process name FAILED %d\n", GetLastError()); + printf_error("Get process name FAILED %d\n", GetLastError()); goto exit; } - if (!FormatDumpName(dumpPath, dumpPathTemplate, pszName, pid)) + if (!FormatDumpName(dumpPath, options.DumpPathTemplate, pszName, options.Pid)) { goto exit; } - printf("Writing %s to file %s\n", dumpType, dumpPath.c_str()); + printf_status("Writing %s to file %s\n", options.DumpType, dumpPath.c_str()); hFile = CreateFileA(dumpPath.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - fprintf(stderr, "Invalid dump path '%s' error %d\n", dumpPath.c_str(), GetLastError()); + printf_error("Invalid dump path '%s' error %d\n", dumpPath.c_str(), GetLastError()); goto exit; } // Retry the write dump on ERROR_PARTIAL_COPY for (int i = 0; i < 5; i++) { - if (MiniDumpWriteDump(hProcess, pid, hFile, minidumpType, NULL, NULL, NULL)) + if (MiniDumpWriteDump(hProcess, options.Pid, hFile, options.MinidumpType, NULL, NULL, NULL)) { result = true; break; @@ -54,7 +54,7 @@ CreateDump(const char* dumpPathTemplate, int pid, const char* dumpType, MINIDUMP int err = GetLastError(); if (err != HRESULT_FROM_WIN32(ERROR_PARTIAL_COPY)) { - fprintf(stderr, "Write dump FAILED 0x%08x\n", err); + printf_error("Write dump FAILED 0x%08x\n", err); break; } } @@ -73,3 +73,38 @@ CreateDump(const char* dumpPathTemplate, int pid, const char* dumpType, MINIDUMP return result; } + +typedef DWORD(WINAPI *pfnGetTempPathA)(DWORD nBufferLength, LPSTR lpBuffer); + +static volatile pfnGetTempPathA +g_pfnGetTempPathA = nullptr; + + +DWORD +GetTempPathWrapper( + IN DWORD nBufferLength, + OUT LPSTR lpBuffer) +{ + if (g_pfnGetTempPathA == nullptr) + { + HMODULE hKernel32 = LoadLibraryExW(L"kernel32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); + + pfnGetTempPathA pLocalGetTempPathA = NULL; + if (hKernel32 != NULL) + { + // store to thread local variable to prevent data race + pLocalGetTempPathA = (pfnGetTempPathA)::GetProcAddress(hKernel32, "GetTempPath2A"); + } + + if (pLocalGetTempPathA == NULL) // method is only available with Windows 10 Creators Update or later + { + g_pfnGetTempPathA = &GetTempPathA; + } + else + { + g_pfnGetTempPathA = pLocalGetTempPathA; + } + } + + return g_pfnGetTempPathA(nBufferLength, lpBuffer); +} \ No newline at end of file diff --git a/src/coreclr/debug/createdump/dumpname.cpp b/src/coreclr/debug/createdump/dumpname.cpp index 751997c6755b94..a09a98aebc9b24 100644 --- a/src/coreclr/debug/createdump/dumpname.cpp +++ b/src/coreclr/debug/createdump/dumpname.cpp @@ -37,7 +37,7 @@ FormatDumpName(std::string& name, const char* pattern, const char* exename, int const char* p = pattern; if (*p == '|') { - fprintf(stderr, "Pipe syntax in dump name not supported\n"); + printf_error("Pipe syntax in dump name not supported\n"); return false; } @@ -81,7 +81,7 @@ FormatDumpName(std::string& name, const char* pattern, const char* exename, int ArrayHolder buffer = new char[MAX_LONGPATH + 1]; if (gethostname(buffer, MAX_LONGPATH) != 0) { - fprintf(stderr, "Could not get the host name for dump name: %d\n", + printf_error("Could not get the host name for dump name: %d\n", #ifdef HOST_WINDOWS WSAGetLastError()); #else @@ -114,7 +114,7 @@ FormatDumpName(std::string& name, const char* pattern, const char* exename, int // pid of dumped process case 'P': default: - fprintf(stderr, "Invalid dump name format char '%c'\n", *p); + printf_error("Invalid dump name format char '%c'\n", *p); return false; } } diff --git a/src/coreclr/debug/createdump/dumpwriter.cpp b/src/coreclr/debug/createdump/dumpwriter.cpp index 4aa46ac3681444..5946c37d6678d8 100644 --- a/src/coreclr/debug/createdump/dumpwriter.cpp +++ b/src/coreclr/debug/createdump/dumpwriter.cpp @@ -26,7 +26,7 @@ DumpWriter::OpenDump(const char* dumpFileName) m_fd = open(dumpFileName, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR | S_IRUSR); if (m_fd == -1) { - fprintf(stderr, "Could not open output %s: %d %s\n", dumpFileName, errno, strerror(errno)); + printf_error("Could not open output %s: %d %s\n", dumpFileName, errno, strerror(errno)); return false; } return true; @@ -46,7 +46,7 @@ DumpWriter::WriteData(int fd, const void* buffer, size_t length) } while (written == -1 && errno == EINTR); if (written < 1) { - fprintf(stderr, "WriteData FAILED %d %s\n", errno, strerror(errno)); + printf_error("WriteData FAILED %d %s\n", errno, strerror(errno)); return false; } done += written; diff --git a/src/coreclr/debug/createdump/dumpwriterelf.cpp b/src/coreclr/debug/createdump/dumpwriterelf.cpp index afd403212b2473..6ab8cfed5dbdcc 100644 --- a/src/coreclr/debug/createdump/dumpwriterelf.cpp +++ b/src/coreclr/debug/createdump/dumpwriterelf.cpp @@ -152,7 +152,7 @@ DumpWriter::WriteDump() // Write all the thread's state and registers for (const ThreadInfo* thread : m_crashInfo.Threads()) { - if (!WriteThread(*thread, SIGABRT)) { + if (!WriteThread(*thread)) { return false; } } @@ -161,7 +161,7 @@ DumpWriter::WriteDump() // and then laydown the memory blocks if (finalNoteAlignment > 0) { if (finalNoteAlignment > sizeof(m_tempBuffer)) { - fprintf(stderr, "finalNoteAlignment %zu > sizeof(m_tempBuffer)\n", finalNoteAlignment); + printf_error("finalNoteAlignment %zu > sizeof(m_tempBuffer)\n", finalNoteAlignment); return false; } memset(m_tempBuffer, 0, finalNoteAlignment); @@ -189,13 +189,13 @@ DumpWriter::WriteDump() size_t read = 0; if (!m_crashInfo.ReadProcessMemory((void*)address, m_tempBuffer, bytesToRead, &read)) { - fprintf(stderr, "ReadProcessMemory(%" PRIA PRIx64 ", %08zx) FAILED\n", address, bytesToRead); + printf_error("ReadProcessMemory(%" PRIA PRIx64 ", %08zx) FAILED\n", address, bytesToRead); return false; } // This can happen if the target process dies before createdump is finished if (read == 0) { - fprintf(stderr, "ReadProcessMemory(%" PRIA PRIx64 ", %08zx) returned 0 bytes read\n", address, bytesToRead); + printf_error("ReadProcessMemory(%" PRIA PRIx64 ", %08zx) returned 0 bytes read\n", address, bytesToRead); return false; } @@ -209,8 +209,7 @@ DumpWriter::WriteDump() } } - printf("Written %" PRId64 " bytes (%" PRId64 " pages) to core file\n", total, total / PAGE_SIZE); - + printf_status("Written %" PRId64 " bytes (%" PRId64 " pages) to core file\n", total, total / PAGE_SIZE); return true; } @@ -367,13 +366,20 @@ DumpWriter::WriteNTFileInfo() } bool -DumpWriter::WriteThread(const ThreadInfo& thread, int fatal_signal) +DumpWriter::WriteThread(const ThreadInfo& thread) { prstatus_t pr; memset(&pr, 0, sizeof(pr)); + const siginfo_t* siginfo = nullptr; - pr.pr_info.si_signo = fatal_signal; - pr.pr_cursig = fatal_signal; + if (m_crashInfo.Signal() != 0 && thread.IsCrashThread()) + { + siginfo = m_crashInfo.SigInfo(); + pr.pr_info.si_signo = siginfo->si_signo; + pr.pr_info.si_code = siginfo->si_code; + pr.pr_info.si_errno = siginfo->si_errno; + pr.pr_cursig = siginfo->si_signo; + } pr.pr_pid = thread.Tid(); pr.pr_ppid = thread.Ppid(); pr.pr_pgrp = thread.Tgid(); @@ -404,9 +410,8 @@ DumpWriter::WriteThread(const ThreadInfo& thread, int fatal_signal) return false; } - nhdr.n_namesz = 6; - #if defined(__i386__) + nhdr.n_namesz = 6; nhdr.n_descsz = sizeof(user_fpxregs_struct); nhdr.n_type = NT_PRXFPREG; if (!WriteData(&nhdr, sizeof(nhdr)) || @@ -417,6 +422,7 @@ DumpWriter::WriteThread(const ThreadInfo& thread, int fatal_signal) #endif #if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__) + nhdr.n_namesz = 6; nhdr.n_descsz = sizeof(user_vfpregs_struct); nhdr.n_type = NT_ARM_VFP; if (!WriteData(&nhdr, sizeof(nhdr)) || @@ -426,5 +432,19 @@ DumpWriter::WriteThread(const ThreadInfo& thread, int fatal_signal) } #endif + if (siginfo != nullptr) + { + TRACE("Writing NT_SIGINFO tid %04x signo %d (%04x) code %04x errno %04x addr %p\n", + thread.Tid(), siginfo->si_signo, siginfo->si_signo, siginfo->si_code, siginfo->si_errno, siginfo->si_addr); + + nhdr.n_namesz = 5; + nhdr.n_descsz = sizeof(siginfo_t); + nhdr.n_type = NT_SIGINFO; + if (!WriteData(&nhdr, sizeof(nhdr)) || + !WriteData("CORE\0SIG", 8) || + !WriteData(siginfo, sizeof(siginfo_t))) { + return false; + } + } return true; } diff --git a/src/coreclr/debug/createdump/dumpwriterelf.h b/src/coreclr/debug/createdump/dumpwriterelf.h index 6da55da2f13750..2a3d41d75d0df9 100644 --- a/src/coreclr/debug/createdump/dumpwriterelf.h +++ b/src/coreclr/debug/createdump/dumpwriterelf.h @@ -29,6 +29,10 @@ #define NT_FILE 0x46494c45 #endif +#ifndef NT_SIGINFO +#define NT_SIGINFO 0x53494749 +#endif + class DumpWriter { private: @@ -52,21 +56,22 @@ class DumpWriter bool WriteAuxv(); size_t GetNTFileInfoSize(size_t* alignmentBytes = nullptr); bool WriteNTFileInfo(); - bool WriteThread(const ThreadInfo& thread, int fatal_signal); + bool WriteThread(const ThreadInfo& thread); bool WriteData(const void* buffer, size_t length) { return WriteData(m_fd, buffer, length); } size_t GetProcessInfoSize() const { return sizeof(Nhdr) + 8 + sizeof(prpsinfo_t); } size_t GetAuxvInfoSize() const { return sizeof(Nhdr) + 8 + m_crashInfo.GetAuxvSize(); } size_t GetThreadInfoSize() const { - return m_crashInfo.Threads().size() * ((sizeof(Nhdr) + 8 + sizeof(prstatus_t)) - + sizeof(Nhdr) + 8 + sizeof(user_fpregs_struct) + return (m_crashInfo.Signal() != 0 ? (sizeof(Nhdr) + 8 + sizeof(siginfo_t)) : 0) + + (m_crashInfo.Threads().size() * ((sizeof(Nhdr) + 8 + sizeof(prstatus_t)) + + (sizeof(Nhdr) + 8 + sizeof(user_fpregs_struct)) #if defined(__i386__) - + sizeof(Nhdr) + 8 + sizeof(user_fpxregs_struct) + + (sizeof(Nhdr) + 8 + sizeof(user_fpxregs_struct)) #endif #if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__) - + sizeof(Nhdr) + 8 + sizeof(user_vfpregs_struct) + + (sizeof(Nhdr) + 8 + sizeof(user_vfpregs_struct)) #endif - ); + )); } }; diff --git a/src/coreclr/debug/createdump/dumpwritermacho.cpp b/src/coreclr/debug/createdump/dumpwritermacho.cpp index e5cefe9ffbe221..580c616552a250 100644 --- a/src/coreclr/debug/createdump/dumpwritermacho.cpp +++ b/src/coreclr/debug/createdump/dumpwritermacho.cpp @@ -4,6 +4,8 @@ #include "createdump.h" #include "specialthreadinfo.h" +extern int g_readProcessMemoryResult; + // // Write the core dump file // @@ -56,7 +58,7 @@ DumpWriter::WriteDump() if (alignment > 0) { if (alignment > sizeof(m_tempBuffer)) { - fprintf(stderr, "Segment alignment %llu > sizeof(m_tempBuffer)\n", alignment); + printf_error("Segment alignment %llu > sizeof(m_tempBuffer)\n", alignment); return false; } memset(m_tempBuffer, 0, alignment); @@ -264,13 +266,13 @@ DumpWriter::WriteSegments() size_t read = 0; if (!m_crashInfo.ReadProcessMemory((void*)address, m_tempBuffer, bytesToRead, &read)) { - fprintf(stderr, "ReadProcessMemory(%" PRIA PRIx64 ", %08zx) FAILED\n", address, bytesToRead); + printf_error("ReadProcessMemory(%" PRIA PRIx64 ", %08zx) read %d FAILED %s (%x)\n", address, bytesToRead, read, mach_error_string(g_readProcessMemoryResult), g_readProcessMemoryResult); return false; } // This can happen if the target process dies before createdump is finished if (read == 0) { - fprintf(stderr, "ReadProcessMemory(%" PRIA PRIx64 ", %08zx) returned 0 bytes read\n", address, bytesToRead); + printf_error("ReadProcessMemory(%" PRIA PRIx64 ", %08zx) returned 0 bytes read: %s (%x)\n", address, bytesToRead, mach_error_string(g_readProcessMemoryResult), g_readProcessMemoryResult); return false; } @@ -284,6 +286,6 @@ DumpWriter::WriteSegments() } } - printf("Written %" PRId64 " bytes (%" PRId64 " pages) to core file\n", total, total / PAGE_SIZE); + printf_status("Written %" PRId64 " bytes (%" PRId64 " pages) to core file\n", total, total / PAGE_SIZE); return true; } diff --git a/src/coreclr/debug/createdump/main.cpp b/src/coreclr/debug/createdump/main.cpp index f91a81ca66ccb8..89c8c7f4043506 100644 --- a/src/coreclr/debug/createdump/main.cpp +++ b/src/coreclr/debug/createdump/main.cpp @@ -25,6 +25,7 @@ const char* g_help = "createdump [options] pid\n" "-v, --verbose - enable verbose diagnostic messages.\n" #ifdef HOST_UNIX "--crashreport - write crash report file.\n" +"--crashreportonly - write crash report file only (no dump).\n" "--crashthread - the thread id of the crashing thread.\n" "--signal - the signal code of the crash.\n" #endif @@ -38,26 +39,33 @@ bool g_diagnosticsVerbose = false; // int __cdecl main(const int argc, const char* argv[]) { - MINIDUMP_TYPE minidumpType = (MINIDUMP_TYPE)(MiniDumpWithPrivateReadWriteMemory | - MiniDumpWithDataSegs | - MiniDumpWithHandleData | - MiniDumpWithUnloadedModules | - MiniDumpWithFullMemoryInfo | - MiniDumpWithThreadInfo | - MiniDumpWithTokenInformation); - const char* dumpType = "minidump with heap"; - const char* dumpPathTemplate = nullptr; - bool crashReport = false; - int signal = 0; - int crashThread = 0; + CreateDumpOptions options; + options.MinidumpType = (MINIDUMP_TYPE)(MiniDumpWithPrivateReadWriteMemory | + MiniDumpWithDataSegs | + MiniDumpWithHandleData | + MiniDumpWithUnloadedModules | + MiniDumpWithFullMemoryInfo | + MiniDumpWithThreadInfo | + MiniDumpWithTokenInformation); + options.DumpType = "minidump with heap"; + options.DumpPathTemplate = nullptr; + options.CrashReport = false; + options.CreateDump = true; + options.Signal = 0; + options.CrashThread = 0; + options.Pid = 0; +#if defined(HOST_UNIX) + options.SignalCode = 0; + options.SignalErrno = 0; + options.SignalAddress = nullptr; +#endif int exitCode = 0; - int pid = 0; #ifdef HOST_UNIX exitCode = PAL_InitializeDLL(); if (exitCode != 0) { - fprintf(stderr, "PAL initialization FAILED %d\n", exitCode); + printf_error("PAL initialization FAILED %d\n", exitCode); return exitCode; } #endif @@ -70,62 +78,79 @@ int __cdecl main(const int argc, const char* argv[]) { if ((strcmp(*argv, "-f") == 0) || (strcmp(*argv, "--name") == 0)) { - dumpPathTemplate = *++argv; + options.DumpPathTemplate = *++argv; } else if ((strcmp(*argv, "-n") == 0) || (strcmp(*argv, "--normal") == 0)) { - dumpType = "minidump"; - minidumpType = (MINIDUMP_TYPE)(MiniDumpNormal | - MiniDumpWithDataSegs | - MiniDumpWithHandleData | - MiniDumpWithThreadInfo); + options.DumpType = "minidump"; + options.MinidumpType = (MINIDUMP_TYPE)(MiniDumpNormal | + MiniDumpWithDataSegs | + MiniDumpWithHandleData | + MiniDumpWithThreadInfo); } else if ((strcmp(*argv, "-h") == 0) || (strcmp(*argv, "--withheap") == 0)) { - dumpType = "minidump with heap"; - minidumpType = (MINIDUMP_TYPE)(MiniDumpWithPrivateReadWriteMemory | - MiniDumpWithDataSegs | - MiniDumpWithHandleData | - MiniDumpWithUnloadedModules | - MiniDumpWithFullMemoryInfo | - MiniDumpWithThreadInfo | - MiniDumpWithTokenInformation); + options.DumpType = "minidump with heap"; + options.MinidumpType = (MINIDUMP_TYPE)(MiniDumpWithPrivateReadWriteMemory | + MiniDumpWithDataSegs | + MiniDumpWithHandleData | + MiniDumpWithUnloadedModules | + MiniDumpWithFullMemoryInfo | + MiniDumpWithThreadInfo | + MiniDumpWithTokenInformation); } else if ((strcmp(*argv, "-t") == 0) || (strcmp(*argv, "--triage") == 0)) { - dumpType = "triage minidump"; - minidumpType = (MINIDUMP_TYPE)(MiniDumpFilterTriage | - MiniDumpIgnoreInaccessibleMemory | - MiniDumpWithoutOptionalData | - MiniDumpWithProcessThreadData | - MiniDumpFilterModulePaths | - MiniDumpWithUnloadedModules | - MiniDumpFilterMemory | - MiniDumpWithHandleData); + options.DumpType = "triage minidump"; + options.MinidumpType = (MINIDUMP_TYPE)(MiniDumpFilterTriage | + MiniDumpIgnoreInaccessibleMemory | + MiniDumpWithoutOptionalData | + MiniDumpWithProcessThreadData | + MiniDumpFilterModulePaths | + MiniDumpWithUnloadedModules | + MiniDumpFilterMemory | + MiniDumpWithHandleData); } else if ((strcmp(*argv, "-u") == 0) || (strcmp(*argv, "--full") == 0)) { - dumpType = "full dump"; - minidumpType = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | - MiniDumpWithDataSegs | - MiniDumpWithHandleData | - MiniDumpWithUnloadedModules | - MiniDumpWithFullMemoryInfo | - MiniDumpWithThreadInfo | - MiniDumpWithTokenInformation); + options.DumpType = "full dump"; + options.MinidumpType = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | + MiniDumpWithDataSegs | + MiniDumpWithHandleData | + MiniDumpWithUnloadedModules | + MiniDumpWithFullMemoryInfo | + MiniDumpWithThreadInfo | + MiniDumpWithTokenInformation); } #ifdef HOST_UNIX else if (strcmp(*argv, "--crashreport") == 0) { - crashReport = true; + options.CrashReport = true; + } + else if (strcmp(*argv, "--crashreportonly") == 0) + { + options.CrashReport = true; + options.CreateDump = false; } else if (strcmp(*argv, "--crashthread") == 0) { - crashThread = atoi(*++argv); + options.CrashThread = atoi(*++argv); } else if (strcmp(*argv, "--signal") == 0) { - signal = atoi(*++argv); + options.Signal = atoi(*++argv); + } + else if (strcmp(*argv, "--code") == 0) + { + options.SignalCode = atoi(*++argv); + } + else if (strcmp(*argv, "--errno") == 0) + { + options.SignalErrno = atoi(*++argv); + } + else if (strcmp(*argv, "--address") == 0) + { + options.SignalAddress = (void*)atoll(*++argv); } #endif else if ((strcmp(*argv, "-d") == 0) || (strcmp(*argv, "--diag") == 0)) @@ -138,35 +163,35 @@ int __cdecl main(const int argc, const char* argv[]) g_diagnosticsVerbose = true; } else { - pid = atoi(*argv); + options.Pid = atoi(*argv); } argv++; } } - if (pid != 0) + if (options.Pid != 0) { ArrayHolder tmpPath = new char[MAX_LONGPATH]; - if (dumpPathTemplate == nullptr) + if (options.DumpPathTemplate == nullptr) { - if (::GetTempPathA(MAX_LONGPATH, tmpPath) == 0) + if (::GetTempPathWrapper(MAX_LONGPATH, tmpPath) == 0) { - fprintf(stderr, "GetTempPath failed (0x%08x)", ::GetLastError()); + printf_error("GetTempPath failed (0x%08x)\n", ::GetLastError()); return ::GetLastError(); } exitCode = strcat_s(tmpPath, MAX_LONGPATH, DEFAULT_DUMP_TEMPLATE); if (exitCode != 0) { - fprintf(stderr, "strcat_s failed (%d)", exitCode); + printf_error("strcat_s failed (%d)\n", exitCode); return exitCode; } - dumpPathTemplate = tmpPath; + options.DumpPathTemplate = tmpPath; } - if (CreateDump(dumpPathTemplate, pid, dumpType, minidumpType, crashReport, crashThread, signal)) + if (CreateDump(options)) { - printf("Dump successfully written\n"); + printf_status("Dump successfully written\n"); } else { @@ -179,7 +204,7 @@ int __cdecl main(const int argc, const char* argv[]) else { // if no pid or invalid command line option - fprintf(stderr, "%s", g_help); + printf_error("%s", g_help); exitCode = -1; } #ifdef HOST_UNIX @@ -188,6 +213,28 @@ int __cdecl main(const int argc, const char* argv[]) return exitCode; } +void +printf_status(const char* format, ...) +{ + va_list args; + va_start(args, format); + fprintf(stdout, "[createdump] "); + vfprintf(stdout, format, args); + fflush(stdout); + va_end(args); +} + +void +printf_error(const char* format, ...) +{ + va_list args; + va_start(args, format); + fprintf(stderr, "[createdump] "); + vfprintf(stderr, format, args); + fflush(stderr); + va_end(args); +} + void trace_printf(const char* format, ...) { @@ -195,6 +242,7 @@ trace_printf(const char* format, ...) { va_list args; va_start(args, format); + fprintf(stdout, "[createdump] "); vfprintf(stdout, format, args); fflush(stdout); va_end(args); @@ -208,10 +256,9 @@ trace_verbose_printf(const char* format, ...) { va_list args; va_start(args, format); + fprintf(stdout, "[createdump] "); vfprintf(stdout, format, args); fflush(stdout); va_end(args); } } - - 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..9536b7c815fd90 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; @@ -377,3 +387,9 @@ ThreadInfo::GetThreadStack() TRACE("Thread %04x null stack pointer\n", m_tid); } } + +bool +ThreadInfo::IsCrashThread() const +{ + return m_tid == m_crashInfo.CrashThread(); +} diff --git a/src/coreclr/debug/createdump/threadinfo.h b/src/coreclr/debug/createdump/threadinfo.h index 4142b55e333dd7..159df8c25d127c 100644 --- a/src/coreclr/debug/createdump/threadinfo.h +++ b/src/coreclr/debug/createdump/threadinfo.h @@ -136,6 +136,7 @@ class ThreadInfo inline const uint64_t GetFramePointer() const { return m_gpRegisters.ARM_fp; } #endif #endif // __APPLE__ + bool IsCrashThread() const; private: void UnwindNativeFrames(CONTEXT* pContext); diff --git a/src/coreclr/debug/createdump/threadinfomac.cpp b/src/coreclr/debug/createdump/threadinfomac.cpp index 918f0ae2310b5a..735794600d0aca 100644 --- a/src/coreclr/debug/createdump/threadinfomac.cpp +++ b/src/coreclr/debug/createdump/threadinfomac.cpp @@ -23,7 +23,7 @@ ThreadInfo::~ThreadInfo() kern_return_t result = ::mach_port_deallocate(mach_task_self(), m_port); if (result != KERN_SUCCESS) { - fprintf(stderr, "~ThreadInfo: mach_port_deallocate FAILED %x %s\n", result, mach_error_string(result)); + printf_error("~ThreadInfo: mach_port_deallocate FAILED %x %s\n", result, mach_error_string(result)); } } @@ -38,7 +38,7 @@ ThreadInfo::Initialize() kern_return_t result = ::thread_get_state(Port(), x86_THREAD_STATE64, (thread_state_t)&m_gpRegisters, &stateCount); if (result != KERN_SUCCESS) { - fprintf(stderr, "thread_get_state(%x) FAILED %x %s\n", m_tid, result, mach_error_string(result)); + printf_error("thread_get_state(%x) FAILED %x %s\n", m_tid, result, mach_error_string(result)); return false; } @@ -46,7 +46,7 @@ ThreadInfo::Initialize() result = ::thread_get_state(Port(), x86_FLOAT_STATE64, (thread_state_t)&m_fpRegisters, &stateCount); if (result != KERN_SUCCESS) { - fprintf(stderr, "thread_get_state(%x) FAILED %x %s\n", m_tid, result, mach_error_string(result)); + printf_error("thread_get_state(%x) FAILED %x %s\n", m_tid, result, mach_error_string(result)); return false; } #elif defined(__aarch64__) @@ -54,7 +54,7 @@ ThreadInfo::Initialize() kern_return_t result = ::thread_get_state(Port(), ARM_THREAD_STATE64, (thread_state_t)&m_gpRegisters, &stateCount); if (result != KERN_SUCCESS) { - fprintf(stderr, "thread_get_state(%x) FAILED %x %s\n", m_tid, result, mach_error_string(result)); + printf_error("thread_get_state(%x) FAILED %x %s\n", m_tid, result, mach_error_string(result)); return false; } @@ -62,7 +62,7 @@ ThreadInfo::Initialize() result = ::thread_get_state(Port(), ARM_NEON_STATE64, (thread_state_t)&m_fpRegisters, &stateCount); if (result != KERN_SUCCESS) { - fprintf(stderr, "thread_get_state(%x) FAILED %x %s\n", m_tid, result, mach_error_string(result)); + printf_error("thread_get_state(%x) FAILED %x %s\n", m_tid, result, mach_error_string(result)); return false; } #else diff --git a/src/coreclr/debug/createdump/threadinfounix.cpp b/src/coreclr/debug/createdump/threadinfounix.cpp index 856dfbb2993793..37af34ca2836e1 100644 --- a/src/coreclr/debug/createdump/threadinfounix.cpp +++ b/src/coreclr/debug/createdump/threadinfounix.cpp @@ -69,7 +69,7 @@ ThreadInfo::GetRegistersWithPTrace() struct iovec gpRegsVec = { &m_gpRegisters, sizeof(m_gpRegisters) }; if (ptrace((__ptrace_request)PTRACE_GETREGSET, m_tid, NT_PRSTATUS, &gpRegsVec) == -1) { - fprintf(stderr, "ptrace(PTRACE_GETREGSET, %d, NT_PRSTATUS) FAILED %d (%s)\n", m_tid, errno, strerror(errno)); + printf_error("ptrace(PTRACE_GETREGSET, %d, NT_PRSTATUS) FAILED %d (%s)\n", m_tid, errno, strerror(errno)); return false; } assert(sizeof(m_gpRegisters) == gpRegsVec.iov_len); @@ -80,7 +80,7 @@ ThreadInfo::GetRegistersWithPTrace() #if defined(__arm__) // Some aarch64 kernels may not support NT_FPREGSET for arm processes. We treat this failure as non-fatal. #else - fprintf(stderr, "ptrace(PTRACE_GETREGSET, %d, NT_FPREGSET) FAILED %d (%s)\n", m_tid, errno, strerror(errno)); + printf_error("ptrace(PTRACE_GETREGSET, %d, NT_FPREGSET) FAILED %d (%s)\n", m_tid, errno, strerror(errno)); return false; #endif } @@ -89,7 +89,7 @@ ThreadInfo::GetRegistersWithPTrace() #if defined(__i386__) if (ptrace((__ptrace_request)PTRACE_GETFPXREGS, m_tid, nullptr, &m_fpxRegisters) == -1) { - fprintf(stderr, "ptrace(GETFPXREGS, %d) FAILED %d (%s)\n", m_tid, errno, strerror(errno)); + printf_error("ptrace(GETFPXREGS, %d) FAILED %d (%s)\n", m_tid, errno, strerror(errno)); return false; } #elif defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__) @@ -100,7 +100,7 @@ ThreadInfo::GetRegistersWithPTrace() if (ptrace((__ptrace_request)PTRACE_GETVFPREGS, m_tid, nullptr, &m_vfpRegisters) == -1) { - fprintf(stderr, "ptrace(PTRACE_GETVFPREGS, %d) FAILED %d (%s)\n", m_tid, errno, strerror(errno)); + printf_error("ptrace(PTRACE_GETVFPREGS, %d) FAILED %d (%s)\n", m_tid, errno, strerror(errno)); return false; } #endif diff --git a/src/coreclr/debug/daccess/daccess.cpp b/src/coreclr/debug/daccess/daccess.cpp index 61f0d827e60f19..dee4fe132fa74c 100644 --- a/src/coreclr/debug/daccess/daccess.cpp +++ b/src/coreclr/debug/daccess/daccess.cpp @@ -6077,13 +6077,20 @@ ClrDataAccess::GetMethodVarInfo(MethodDesc* methodDesc, SUPPORTS_DAC; COUNT_T countNativeVarInfo; NewHolder nativeVars(NULL); - - NativeCodeVersion requestedNativeCodeVersion = ExecutionManager::GetNativeCodeVersion(address); - if (requestedNativeCodeVersion.IsNull() || requestedNativeCodeVersion.GetNativeCode() == NULL) + TADDR nativeCodeStartAddr; + if (address != NULL) { - return E_INVALIDARG; + NativeCodeVersion requestedNativeCodeVersion = ExecutionManager::GetNativeCodeVersion(address); + if (requestedNativeCodeVersion.IsNull() || requestedNativeCodeVersion.GetNativeCode() == NULL) + { + return E_INVALIDARG; + } + nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode()); + } + else + { + nativeCodeStartAddr = PCODEToPINSTR(methodDesc->GetNativeCode()); } - TADDR nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode()); DebugInfoRequest request; request.InitFromStartingAddr(methodDesc, nativeCodeStartAddr); @@ -6128,13 +6135,20 @@ ClrDataAccess::GetMethodNativeMap(MethodDesc* methodDesc, // Use the DebugInfoStore to get IL->Native maps. // It doesn't matter whether we're jitted, ngenned etc. - - NativeCodeVersion requestedNativeCodeVersion = ExecutionManager::GetNativeCodeVersion(address); - if (requestedNativeCodeVersion.IsNull() || requestedNativeCodeVersion.GetNativeCode() == NULL) + TADDR nativeCodeStartAddr; + if (address != NULL) { - return E_INVALIDARG; + NativeCodeVersion requestedNativeCodeVersion = ExecutionManager::GetNativeCodeVersion(address); + if (requestedNativeCodeVersion.IsNull() || requestedNativeCodeVersion.GetNativeCode() == NULL) + { + return E_INVALIDARG; + } + nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode()); + } + else + { + nativeCodeStartAddr = PCODEToPINSTR(methodDesc->GetNativeCode()); } - TADDR nativeCodeStartAddr = PCODEToPINSTR(requestedNativeCodeVersion.GetNativeCode()); DebugInfoRequest request; request.InitFromStartingAddr(methodDesc, nativeCodeStartAddr); diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 2924be33c049de..8e587b8d1e5c26 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -4771,15 +4771,15 @@ VMPTR_OBJECTHANDLE DacDbiInterfaceImpl::GetThreadObject(VMPTR_Thread vmThread) } } -void DacDbiInterfaceImpl::GetThreadAllocInfo(VMPTR_Thread vmThread, +void DacDbiInterfaceImpl::GetThreadAllocInfo(VMPTR_Thread vmThread, DacThreadAllocInfo* threadAllocInfo) { DD_ENTER_MAY_THROW; Thread * pThread = vmThread.GetDacPtr(); gc_alloc_context* allocContext = pThread->GetAllocContext(); - threadAllocInfo->m_allocBytesSOH = (ULONG)(allocContext->alloc_bytes - (allocContext->alloc_limit - allocContext->alloc_ptr)); - threadAllocInfo->m_allocBytesUOH = (ULONG)allocContext->alloc_bytes_uoh; + threadAllocInfo->m_allocBytesSOH = allocContext->alloc_bytes - (allocContext->alloc_limit - allocContext->alloc_ptr); + threadAllocInfo->m_allocBytesUOH = allocContext->alloc_bytes_uoh; } // Set and reset the TSNC_DebuggerUserSuspend bit on the state of the specified thread @@ -4939,6 +4939,10 @@ VMPTR_OBJECTHANDLE DacDbiInterfaceImpl::GetObjectForCCW(CORDB_ADDRESS ccwPtr) OBJECTHANDLE ohCCW = NULL; +#ifdef FEATURE_COMWRAPPERS + if (DACTryGetComWrappersHandleFromCCW(ccwPtr, &ohCCW) != S_OK) + { +#endif #ifdef FEATURE_COMINTEROP ComCallWrapper *pCCW = DACGetCCWFromAddress(ccwPtr); if (pCCW) @@ -4946,6 +4950,9 @@ VMPTR_OBJECTHANDLE DacDbiInterfaceImpl::GetObjectForCCW(CORDB_ADDRESS ccwPtr) ohCCW = pCCW->GetObjectHandle(); } #endif +#ifdef FEATURE_COMWRAPPERS + } +#endif VMPTR_OBJECTHANDLE vmObjHandle; vmObjHandle.SetDacTargetPtr(ohCCW); @@ -5462,6 +5469,12 @@ 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. This workaround + // should only cause us to degrade generic types from exact type parameters to approximate or canonical type parameters. + 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/dacimpl.h b/src/coreclr/debug/daccess/dacimpl.h index 62d99ec574929d..6e0001cf5c1acf 100644 --- a/src/coreclr/debug/daccess/dacimpl.h +++ b/src/coreclr/debug/daccess/dacimpl.h @@ -1498,6 +1498,11 @@ class ClrDataAccess static LONG s_procInit; +protected: +#ifdef FEATURE_COMWRAPPERS + HRESULT DACTryGetComWrappersHandleFromCCW(CLRDATA_ADDRESS ccwPtr, OBJECTHANDLE* objHandle); +#endif + public: // APIs for picking up the info needed for a debugger to look up an ngen image or IL image // from it's search path. diff --git a/src/coreclr/debug/daccess/enummem.cpp b/src/coreclr/debug/daccess/enummem.cpp index 577fdcbc6b2e44..a925d4b4ca0d23 100644 --- a/src/coreclr/debug/daccess/enummem.cpp +++ b/src/coreclr/debug/daccess/enummem.cpp @@ -237,6 +237,34 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags) ReportMem(g_gcDacGlobals.GetAddr(), sizeof(GcDacVars)); + PTR_WSTR entryAssemblyPath = (PTR_WSTR)g_EntryAssemblyPath; + entryAssemblyPath.EnumMem(); + + // Triage dumps must not include full paths (PII data). Replace entry assembly path with file name only. + if (flags == CLRDATA_ENUM_MEM_TRIAGE) + { + WCHAR* path = entryAssemblyPath; + if (path != NULL) + { + size_t pathLen = wcslen(path) + 1; + + // Get the file name based on the last directory separator + const WCHAR* name = wcsrchr(path, DIRECTORY_SEPARATOR_CHAR_W); + if (name != NULL) + { + name += 1; + size_t len = wcslen(name) + 1; + wcscpy_s(path, len, name); + + // Null out the rest of the buffer + for (size_t i = len; i < pathLen; ++i) + path[i] = W('\0'); + + DacUpdateMemoryRegion(entryAssemblyPath.GetAddr(), pathLen, (BYTE*)path); + } + } + } + // We need all of the dac variables referenced by the GC DAC global struct. // This struct contains pointers to pointers, so we first dereference the pointers // to obtain the location of the variable that's reported. @@ -1624,6 +1652,7 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerSkinny(IN CLRDataEnumMemoryFlags f // // collect CLR static CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemCLRStatic(flags); ) + CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemCLRHeapCrticalStatic(flags); ); // Dump AppDomain-specific info needed for MiniDumpNormal. CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemDumpAppDomainInfo(flags); ) diff --git a/src/coreclr/debug/daccess/request.cpp b/src/coreclr/debug/daccess/request.cpp index f075dbe29c4e2e..87a3a9838a5a84 100644 --- a/src/coreclr/debug/daccess/request.cpp +++ b/src/coreclr/debug/daccess/request.cpp @@ -2791,18 +2791,18 @@ ClrDataAccess::GetGCHeapStaticData(struct DacpGcHeapDetails *detailsData) detailsData->card_table = PTR_CDADDR(g_card_table); detailsData->mark_array = (CLRDATA_ADDRESS)*g_gcDacGlobals->mark_array; detailsData->next_sweep_obj = (CLRDATA_ADDRESS)*g_gcDacGlobals->next_sweep_obj; - if (g_gcDacGlobals->saved_sweep_ephemeral_seg != nullptr) - { - detailsData->saved_sweep_ephemeral_seg = (CLRDATA_ADDRESS)*g_gcDacGlobals->saved_sweep_ephemeral_seg; - detailsData->saved_sweep_ephemeral_start = (CLRDATA_ADDRESS)*g_gcDacGlobals->saved_sweep_ephemeral_start; - } - else + if (IsRegion()) { // with regions, we don't have these variables anymore // use special value -1 in saved_sweep_ephemeral_seg to signal the region case detailsData->saved_sweep_ephemeral_seg = (CLRDATA_ADDRESS)-1; detailsData->saved_sweep_ephemeral_start = 0; } + else + { + detailsData->saved_sweep_ephemeral_seg = (CLRDATA_ADDRESS)*g_gcDacGlobals->saved_sweep_ephemeral_seg; + detailsData->saved_sweep_ephemeral_start = (CLRDATA_ADDRESS)*g_gcDacGlobals->saved_sweep_ephemeral_start; + } detailsData->background_saved_lowest_address = (CLRDATA_ADDRESS)*g_gcDacGlobals->background_saved_lowest_address; detailsData->background_saved_highest_address = (CLRDATA_ADDRESS)*g_gcDacGlobals->background_saved_highest_address; @@ -3780,24 +3780,24 @@ ClrDataAccess::EnumWksGlobalMemoryRegions(CLRDataEnumMemoryFlags flags) Dereference(g_gcDacGlobals->finalize_queue).EnumMem(); // Enumerate the entire generation table, which has variable size - size_t gen_table_size = g_gcDacGlobals->generation_size * (*g_gcDacGlobals->max_gen + 2); - DacEnumMemoryRegion(dac_cast(g_gcDacGlobals->generation_table), gen_table_size); + EnumGenerationTable(dac_cast(g_gcDacGlobals->generation_table)); if (g_gcDacGlobals->generation_table.IsValid()) { - // enumerating the generations from max (which is normally gen2) to max+1 gives you - // the segment list for all the normal segements plus the large heap segment (max+1) - // this is the convention in the GC so it is repeated here - for (ULONG i = *g_gcDacGlobals->max_gen; i <= *g_gcDacGlobals->max_gen +1; i++) + ULONG first = IsRegion() ? 0 : (*g_gcDacGlobals->max_gen); + // enumerating the first to max + 2 gives you + // the segment list for all the normal segments plus the pinned heap segment (max + 2) + // this is the convention in the GC so it is repeated here + for (ULONG i = first; i <= *g_gcDacGlobals->max_gen + 2; i++) + { + dac_generation gen = GenerationTableIndex(g_gcDacGlobals->generation_table, i); + __DPtr seg = dac_cast(gen.start_segment); + while (seg) { - dac_generation gen = GenerationTableIndex(g_gcDacGlobals->generation_table, i); - __DPtr seg = dac_cast(gen.start_segment); - while (seg) - { - DacEnumMemoryRegion(dac_cast(seg), sizeof(dac_heap_segment)); - seg = seg->next; - } + DacEnumMemoryRegion(dac_cast(seg), sizeof(dac_heap_segment)); + seg = seg->next; } + } } } @@ -3842,11 +3842,11 @@ HRESULT ClrDataAccess::GetClrWatsonBucketsWorker(Thread * pThread, GenericModeBl if (oThrowable != NULL) { // Does the throwable have buckets? - if (((EXCEPTIONREF)oThrowable)->AreWatsonBucketsPresent()) + U1ARRAYREF refWatsonBucketArray = ((EXCEPTIONREF)oThrowable)->GetWatsonBucketReference(); + if (refWatsonBucketArray != NULL) { // Get the watson buckets from the throwable for non-preallocated // exceptions - U1ARRAYREF refWatsonBucketArray = ((EXCEPTIONREF)oThrowable)->GetWatsonBucketReference(); pBuckets = dac_cast(refWatsonBucketArray->GetDataPtr()); } else @@ -4176,12 +4176,18 @@ TADDR ClrDataAccess::DACGetManagedObjectWrapperFromCCW(CLRDATA_ADDRESS ccwPtr) return managedObjectWrapperPtr; } -HRESULT ClrDataAccess::DACTryGetComWrappersObjectFromCCW(CLRDATA_ADDRESS ccwPtr, OBJECTREF* objRef) +HRESULT ClrDataAccess::DACTryGetComWrappersHandleFromCCW(CLRDATA_ADDRESS ccwPtr, OBJECTHANDLE* objHandle) { - if (ccwPtr == 0 || objRef == NULL) - return E_INVALIDARG; + HRESULT hr = E_FAIL; + TADDR ccw, managedObjectWrapperPtr; + ULONG32 bytesRead = 0; + OBJECTHANDLE handle; - SOSDacEnter(); + if (ccwPtr == 0 || objHandle == NULL) + { + hr = E_INVALIDARG; + goto ErrExit; + } if (!DACIsComWrappersCCW(ccwPtr)) { @@ -4189,18 +4195,16 @@ HRESULT ClrDataAccess::DACTryGetComWrappersObjectFromCCW(CLRDATA_ADDRESS ccwPtr, goto ErrExit; } - TADDR ccw = CLRDATA_ADDRESS_TO_TADDR(ccwPtr); + ccw = CLRDATA_ADDRESS_TO_TADDR(ccwPtr); // Return ManagedObjectWrapper as an OBJECTHANDLE. (The OBJECTHANDLE is guaranteed to live at offset 0). - TADDR managedObjectWrapperPtr = DACGetManagedObjectWrapperFromCCW(ccwPtr); + managedObjectWrapperPtr = DACGetManagedObjectWrapperFromCCW(ccwPtr); if (managedObjectWrapperPtr == NULL) { hr = E_FAIL; goto ErrExit; } - ULONG32 bytesRead = 0; - OBJECTHANDLE handle; IfFailGo(m_pTarget->ReadVirtual(managedObjectWrapperPtr, (PBYTE)&handle, sizeof(OBJECTHANDLE), &bytesRead)); if (bytesRead != sizeof(OBJECTHANDLE)) { @@ -4208,9 +4212,31 @@ HRESULT ClrDataAccess::DACTryGetComWrappersObjectFromCCW(CLRDATA_ADDRESS ccwPtr, goto ErrExit; } - *objRef = ObjectFromHandle(handle); + *objHandle = handle; - SOSDacLeave(); + return S_OK; + +ErrExit: return hr; +} + +HRESULT ClrDataAccess::DACTryGetComWrappersObjectFromCCW(CLRDATA_ADDRESS ccwPtr, OBJECTREF* objRef) +{ + HRESULT hr = E_FAIL; + + if (ccwPtr == 0 || objRef == NULL) + { + hr = E_INVALIDARG; + goto ErrExit; + } + + OBJECTHANDLE handle; + if (DACTryGetComWrappersHandleFromCCW(ccwPtr, &handle) != S_OK) + { + hr = E_FAIL; + goto ErrExit; + } + + *objRef = ObjectFromHandle(handle); return S_OK; diff --git a/src/coreclr/debug/daccess/request_common.h b/src/coreclr/debug/daccess/request_common.h index e6c976f16ffa67..742d24fb3d391f 100644 --- a/src/coreclr/debug/daccess/request_common.h +++ b/src/coreclr/debug/daccess/request_common.h @@ -62,6 +62,15 @@ HeapTableIndex(DPTR(unused_gc_heap**) heaps, size_t index) result.field_name = field_name; \ } +// if (field_offset != -1) +// p_field.EnumMem(); +#define ENUM(field_name, field_type) \ + LOAD_BASE(field_name, field_type) \ + if (field_name##_offset != -1) \ + { \ + p_##field_name.EnumMem(); \ + } + // if (field_offset != -1) // result.field = DPTR(field_type)field_name #define LOAD_DPTR(field_name, field_type) \ @@ -87,6 +96,13 @@ HeapTableIndex(DPTR(unused_gc_heap**) heaps, size_t index) } \ } +#define ENUM_ARRAY(field_name, field_type, array_length) \ + LOAD_BASE(field_name, field_type) \ + if (field_name##_offset != -1) \ + { \ + DacEnumMemoryRegion(p_##field_name.GetAddr(), sizeof(field_type) * array_length); \ + } + inline bool IsRegion() { return (g_gcDacGlobals->minor_version_number & 1) != 0; @@ -121,6 +137,26 @@ LoadGcHeapData(TADDR heap) return result; } +inline void EnumGcHeap(TADDR heap) +{ + DPTR(int) field_offsets = g_gcDacGlobals->gc_heap_field_offsets; + int field_index = 0; + +#define BASE heap +#define ALL_FIELDS +#define DEFINE_FIELD(field_name, field_type) ENUM(field_name, field_type) +#define DEFINE_DPTR_FIELD(field_name, field_type) ENUM(field_name, field_type) +#define DEFINE_ARRAY_FIELD(field_name, field_type, array_length) ENUM_ARRAY(field_name, field_type, array_length) + +#include "../../gc/dac_gcheap_fields.h" + +#undef DEFINE_ARRAY_FIELD +#undef DEFINE_DPTR_FIELD +#undef DEFINE_FIELD +#undef ALL_FIELDS +#undef BASE +} + // Load an instance of dac_generation for the generation pointed by generation. // Fields that does not exist in the current generation instance is zero initialized. // Return the dac_generation object. @@ -148,6 +184,26 @@ LoadGeneration(TADDR generation) return result; } +inline void EnumGeneration(TADDR generation) +{ + DPTR(int) field_offsets = g_gcDacGlobals->generation_field_offsets; + int field_index = 0; + +#define BASE generation +#define ALL_FIELDS +#define DEFINE_FIELD(field_name, field_type) ENUM(field_name, field_type) +#define DEFINE_DPTR_FIELD(field_name, field_type) ENUM(field_name, field_type) +#define DEFINE_ARRAY_FIELD(field_name, field_type, array_length) ENUM_ARRAY(field_name, field_type, array_length) + +#include "../../gc/dac_generation_fields.h" + +#undef DEFINE_ARRAY_FIELD +#undef DEFINE_DPTR_FIELD +#undef DEFINE_FIELD +#undef ALL_FIELDS +#undef BASE +} + // Indexes into a given generation table, returning a dac_generation inline dac_generation GenerationTableIndex(DPTR(unused_generation) base, size_t index) @@ -155,10 +211,7 @@ GenerationTableIndex(DPTR(unused_generation) base, size_t index) return LoadGeneration(TableIndex(base, index, g_gcDacGlobals->generation_size).GetAddr()); } -// Indexes into a heap's generation table, given the heap instance -// and the desired index. Returns a dac_generation -inline dac_generation -ServerGenerationTableIndex(TADDR heap, size_t index) +inline TADDR ServerGenerationTableAddress(TADDR heap) { DPTR(int) field_offsets = g_gcDacGlobals->gc_heap_field_offsets; int field_index = GENERATION_TABLE_FIELD_INDEX; @@ -166,9 +219,27 @@ ServerGenerationTableIndex(TADDR heap, size_t index) LOAD_BASE (generation_table, unused_generation); #undef BASE assert (generation_table_offset != -1); + return p_generation_table.GetAddr(); +} + +// Indexes into a heap's generation table, given the heap instance +// and the desired index. Returns a dac_generation +inline dac_generation +ServerGenerationTableIndex(TADDR heap, size_t index) +{ + DPTR(unused_generation) p_generation_table = ServerGenerationTableAddress(heap); return LoadGeneration(TableIndex(p_generation_table, index, g_gcDacGlobals->generation_size).GetAddr()); } +inline void EnumGenerationTable(TADDR generation_table) +{ + DPTR(unused_generation) p_generation_table = generation_table; + for (unsigned int i = 0; i < *g_gcDacGlobals->max_gen + 2; i++) + { + EnumGeneration(TableIndex(p_generation_table, i, g_gcDacGlobals->generation_size).GetAddr()); + } +} + #undef LOAD_ARRAY #undef LOAD_DPTR #undef LOAD diff --git a/src/coreclr/debug/daccess/request_svr.cpp b/src/coreclr/debug/daccess/request_svr.cpp index 5ff14b0adb56a3..2f3b80fedc411b 100644 --- a/src/coreclr/debug/daccess/request_svr.cpp +++ b/src/coreclr/debug/daccess/request_svr.cpp @@ -122,8 +122,11 @@ ClrDataAccess::ServerGCHeapDetails(CLRDATA_ADDRESS heapAddr, DacpGcHeapDetails * detailsData->lowest_address = PTR_CDADDR(g_lowest_address); detailsData->highest_address = PTR_CDADDR(g_highest_address); - detailsData->current_c_gc_state = (CLRDATA_ADDRESS)*g_gcDacGlobals->current_c_gc_state; - + detailsData->current_c_gc_state = c_gc_state_free; + if (g_gcDacGlobals->current_c_gc_state != NULL) + { + detailsData->current_c_gc_state = (CLRDATA_ADDRESS)*g_gcDacGlobals->current_c_gc_state; + } // now get information specific to this heap (server mode gives us several heaps; we're getting // information about only one of them. detailsData->alloc_allocated = (CLRDATA_ADDRESS)pHeap->alloc_allocated; @@ -131,18 +134,18 @@ ClrDataAccess::ServerGCHeapDetails(CLRDATA_ADDRESS heapAddr, DacpGcHeapDetails * detailsData->card_table = (CLRDATA_ADDRESS)pHeap->card_table; detailsData->mark_array = (CLRDATA_ADDRESS)pHeap->mark_array; detailsData->next_sweep_obj = (CLRDATA_ADDRESS)pHeap->next_sweep_obj; - if (pHeap->saved_sweep_ephemeral_seg.IsValid()) - { - detailsData->saved_sweep_ephemeral_seg = (CLRDATA_ADDRESS)dac_cast(pHeap->saved_sweep_ephemeral_seg); - detailsData->saved_sweep_ephemeral_start = (CLRDATA_ADDRESS)pHeap->saved_sweep_ephemeral_start; - } - else + if (IsRegion()) { // with regions, we don't have these variables anymore // use special value -1 in saved_sweep_ephemeral_seg to signal the region case detailsData->saved_sweep_ephemeral_seg = (CLRDATA_ADDRESS)-1; detailsData->saved_sweep_ephemeral_start = 0; } + else + { + detailsData->saved_sweep_ephemeral_seg = (CLRDATA_ADDRESS)dac_cast(pHeap->saved_sweep_ephemeral_seg); + detailsData->saved_sweep_ephemeral_start = (CLRDATA_ADDRESS)pHeap->saved_sweep_ephemeral_start; + } detailsData->background_saved_lowest_address = (CLRDATA_ADDRESS)pHeap->background_saved_lowest_address; detailsData->background_saved_highest_address = (CLRDATA_ADDRESS)pHeap->background_saved_highest_address; @@ -252,21 +255,19 @@ ClrDataAccess::EnumSvrGlobalMemoryRegions(CLRDataEnumMemoryFlags flags) for (int i = 0; i < heaps; i++) { - TADDR heapAddress = HeapTableIndex(g_gcDacGlobals->g_heaps, i); + TADDR heapAddress = HeapTableIndex(g_gcDacGlobals->g_heaps, i); dac_gc_heap heap = LoadGcHeapData(heapAddress); dac_gc_heap* pHeap = &heap; - - size_t gen_table_size = g_gcDacGlobals->generation_size * (*g_gcDacGlobals->max_gen + 2); - DacEnumMemoryRegion(dac_cast(pHeap), sizeof(dac_gc_heap)); + EnumGcHeap(heapAddress); + TADDR generationTable = ServerGenerationTableAddress(heapAddress); + EnumGenerationTable(generationTable); DacEnumMemoryRegion(dac_cast(pHeap->finalize_queue), sizeof(dac_finalize_queue)); - TADDR taddrTable = dac_cast(pHeap) + offsetof(dac_gc_heap, generation_table); - DacEnumMemoryRegion(taddrTable, gen_table_size); - - // enumerating the generations from max (which is normally gen2) to max+1 gives you - // the segment list for all the normal segements plus the large heap segment (max+1) + ULONG first = IsRegion() ? 0 : (*g_gcDacGlobals->max_gen); + // enumerating the first to max + 2 gives you + // the segment list for all the normal segments plus the pinned heap segment (max + 2) // this is the convention in the GC so it is repeated here - for (ULONG i = *g_gcDacGlobals->max_gen; i <= *g_gcDacGlobals->max_gen +1; i++) + for (ULONG i = first; i <= *g_gcDacGlobals->max_gen + 2; i++) { dac_generation generation = ServerGenerationTableIndex(heapAddress, i); DPTR(dac_heap_segment) seg = generation.start_segment; @@ -305,7 +306,7 @@ HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount) for (int i = 0; i < heaps; ++i) { // Basic heap info. - TADDR heapAddress = HeapTableIndex(g_gcDacGlobals->g_heaps, i); + TADDR heapAddress = HeapTableIndex(g_gcDacGlobals->g_heaps, i); dac_gc_heap heap = LoadGcHeapData(heapAddress); dac_gc_heap* pHeap = &heap; dac_generation gen0 = ServerGenerationTableIndex(heapAddress, 0); diff --git a/src/coreclr/debug/dbgutil/machoreader.cpp b/src/coreclr/debug/dbgutil/machoreader.cpp index a19c01b94b3736..07528e1d176cbf 100644 --- a/src/coreclr/debug/dbgutil/machoreader.cpp +++ b/src/coreclr/debug/dbgutil/machoreader.cpp @@ -75,7 +75,7 @@ TryGetSymbol(ICorDebugDataTarget* dataTarget, uint64_t baseAddress, const char* // MachO module //-------------------------------------------------------------------- -MachOModule::MachOModule(MachOReader& reader, mach_vm_address_t baseAddress, mach_header_64* header, std::string* name) : +MachOModule::MachOModule(MachOReader& reader, mach_vm_address_t baseAddress, std::string* name) : m_reader(reader), m_baseAddress(baseAddress), m_loadBias(0), @@ -84,9 +84,6 @@ MachOModule::MachOModule(MachOReader& reader, mach_vm_address_t baseAddress, mac m_nlists(nullptr), m_strtabAddress(0) { - if (header != nullptr) { - m_header = *header; - } if (name != nullptr) { m_name = *name; } @@ -126,19 +123,41 @@ MachOModule::TryLookupSymbol(const char* symbolName, uint64_t* symbolValue) _ASSERTE(m_nlists != nullptr); _ASSERTE(m_strtabAddress != 0); - for (int i = 0; i < m_dysymtabCommand->nextdefsym; i++) + // First, search just the "external" export symbols + if (TryLookupSymbol(m_dysymtabCommand->iextdefsym, m_dysymtabCommand->nextdefsym, symbolName, symbolValue)) { - std::string name = GetSymbolName(i); - // Skip the leading underscores to match Linux externs - if (name[0] == '_') - { - name.erase(0, 1); - } - if (strcmp(name.c_str(), symbolName) == 0) - { - *symbolValue = m_loadBias + m_nlists[i].n_value; - return true; - } + m_reader.Trace("SYM: Found '%s' in external symbols\n", symbolName); + return true; + } + m_reader.Trace("SYM: Missed '%s' in external symbols\n", symbolName); + + // If not found in external symbols, search all of them + if (TryLookupSymbol(0, m_symtabCommand->nsyms, symbolName, symbolValue)) + { + m_reader.Trace("SYM: Found '%s' in all symbols\n", symbolName); + return true; + } + m_reader.Trace("SYM: Missed '%s' in all symbols\n", symbolName); + } + *symbolValue = 0; + return false; +} + +bool +MachOModule::TryLookupSymbol(int start, int nsyms, const char* symbolName, uint64_t* symbolValue) +{ + for (int i = 0; i < nsyms; i++) + { + std::string name = GetSymbolName(start + i); + + // Skip the leading underscores to match Linux externs + const char* currentName = name.length() > 0 && name[0] == '_' ? name.c_str() + 1 : name.c_str(); + + // Does this symbol match? + if (strcmp(currentName, symbolName) == 0) + { + *symbolValue = m_loadBias + m_nlists[start + i].n_value; + return true; } } *symbolValue = 0; @@ -207,11 +226,10 @@ 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. + // segment to get the actual address. if (strcmp(segment->segname, SEG_TEXT) == 0) { m_loadBias = m_baseAddress - segment->vmaddr; - m_reader.TraceVerbose("CMD: load bias %016llx\n", m_loadBias); } m_reader.TraceVerbose("CMD: vmaddr %016llx vmsize %016llx fileoff %016llx filesize %016llx nsects %d max %c%c%c init %c%c%c %02x %s\n", @@ -245,6 +263,7 @@ MachOModule::ReadLoadCommands() // Get next load command command = (load_command*)((char*)command + command->cmdsize); } + m_reader.TraceVerbose("CMD: load bias %016llx\n", m_loadBias); } return true; @@ -262,26 +281,30 @@ MachOModule::ReadSymbolTable() _ASSERTE(m_symtabCommand != nullptr); _ASSERTE(m_strtabAddress == 0); - m_reader.TraceVerbose("SYM: symoff %08x nsyms %d stroff %08x strsize %d iext %d next %d\n", + m_reader.TraceVerbose("SYM: symoff %08x nsyms %d stroff %08x strsize %d iext %d next %d iundef %d nundef %d extref %d nextref %d\n", m_symtabCommand->symoff, m_symtabCommand->nsyms, m_symtabCommand->stroff, m_symtabCommand->strsize, m_dysymtabCommand->iextdefsym, - m_dysymtabCommand->nextdefsym); - - // Read the external symbol part of symbol table. An array of "nlist" structs. - void* extSymbolTableAddress = (void*)(GetAddressFromFileOffset(m_symtabCommand->symoff) + (m_dysymtabCommand->iextdefsym * sizeof(nlist_64))); - size_t symtabSize = sizeof(nlist_64) * m_dysymtabCommand->nextdefsym; + m_dysymtabCommand->nextdefsym, + m_dysymtabCommand->iundefsym, + m_dysymtabCommand->nundefsym, + m_dysymtabCommand->extrefsymoff, + m_dysymtabCommand->nextrefsyms); + + // Read the entire symbol part of symbol table. An array of "nlist" structs. + void* symbolTableAddress = (void*)GetAddressFromFileOffset(m_symtabCommand->symoff); + size_t symtabSize = sizeof(nlist_64) * m_symtabCommand->nsyms; m_nlists = (nlist_64*)malloc(symtabSize); if (m_nlists == nullptr) { - m_reader.Trace("ERROR: Failed to allocate %zu byte external symbol table\n", symtabSize); + m_reader.Trace("ERROR: Failed to allocate %zu byte symtab\n", symtabSize); return false; } - if (!m_reader.ReadMemory(extSymbolTableAddress, m_nlists, symtabSize)) + if (!m_reader.ReadMemory(symbolTableAddress, m_nlists, symtabSize)) { - m_reader.Trace("ERROR: Failed to read external symtab at %p of %zu\n", extSymbolTableAddress, symtabSize); + m_reader.Trace("ERROR: Failed to read symtab at %p of %zu\n", symbolTableAddress, symtabSize); return false; } @@ -337,43 +360,25 @@ MachOReader::MachOReader() } bool -MachOReader::EnumerateModules(mach_vm_address_t address, mach_header_64* header) +MachOReader::EnumerateModules(mach_vm_address_t dyldInfoAddress) { - _ASSERTE(header->magic == MH_MAGIC_64); - _ASSERTE(header->filetype == MH_DYLINKER); - - MachOModule dylinker(*this, address, header); - - // Search for symbol for the dyld image info cache - uint64_t dyldInfoAddress = 0; - if (!dylinker.TryLookupSymbol("dyld_all_image_infos", &dyldInfoAddress)) - { - Trace("ERROR: Can not find the _dyld_all_image_infos symbol\n"); - return false; - } - // Read the all image info from the dylinker image dyld_all_image_infos dyldInfo; - if (!ReadMemory((void*)dyldInfoAddress, &dyldInfo, sizeof(dyld_all_image_infos))) { Trace("ERROR: Failed to read dyld_all_image_infos at %p\n", (void*)dyldInfoAddress); return false; } - std::string dylinkerPath; - if (!ReadString(dyldInfo.dyldPath, dylinkerPath)) + Trace("MOD: infoArray %p infoArrayCount %d\n", dyldInfo.infoArray, dyldInfo.infoArrayCount); + + // Create the dyld module info + if (!TryRegisterModule(dyldInfo.dyldImageLoadAddress, dyldInfo.dyldPath, true)) { - Trace("ERROR: Failed to read name at %p\n", dyldInfo.dyldPath); + Trace("ERROR: Failed to read dyld header at %p\n", dyldInfo.dyldImageLoadAddress); return false; } - dylinker.SetName(dylinkerPath); - Trace("MOD: %016llx %08x %s\n", dylinker.BaseAddress(), dylinker.Header().flags, dylinker.Name().c_str()); - VisitModule(dylinker); - void* imageInfosAddress = (void*)dyldInfo.infoArray; size_t imageInfosSize = dyldInfo.infoArrayCount * sizeof(dyld_image_info); - Trace("MOD: infoArray %p infoArrayCount %d\n", dyldInfo.infoArray, dyldInfo.infoArrayCount); - ArrayHolder imageInfos = new (std::nothrow) dyld_image_info[dyldInfo.infoArrayCount]; if (imageInfos == nullptr) { @@ -387,22 +392,38 @@ MachOReader::EnumerateModules(mach_vm_address_t address, mach_header_64* header) } for (int i = 0; i < dyldInfo.infoArrayCount; i++) { - mach_vm_address_t imageAddress = (mach_vm_address_t)imageInfos[i].imageLoadAddress; - const char* imageFilePathAddress = imageInfos[i].imageFilePath; + // Ignore any errors and continue to next module + TryRegisterModule(imageInfos[i].imageLoadAddress, imageInfos[i].imageFilePath, false); + } + return true; +} - std::string imagePath; - if (!ReadString(imageFilePathAddress, imagePath)) - { - Trace("ERROR: Failed to read image name at %p\n", imageFilePathAddress); - continue; - } - MachOModule module(*this, imageAddress, nullptr, &imagePath); - if (!module.ReadHeader()) +bool +MachOReader::TryRegisterModule(const struct mach_header* imageAddress, const char* imageFilePathAddress, bool dylinker) +{ + std::string imagePath; + if (!ReadString(imageFilePathAddress, imagePath)) + { + return false; + } + MachOModule module(*this, (mach_vm_address_t)imageAddress, &imagePath); + if (!module.ReadHeader()) + { + return false; + } + Trace("MOD: %016llx %08x %s\n", imageAddress, module.Header().flags, imagePath.c_str()); + VisitModule(module); + if (dylinker) + { + // Make sure the memory for the symbol and string tables are in the core dump for our + // dump readers which still use this symbol to enumerate modules. + uint64_t dyldInfoAddress = 0; + if (!module.TryLookupSymbol("dyld_all_image_infos", &dyldInfoAddress)) { - continue; + Trace("ERROR: Can not find the _dyld_all_image_infos symbol\n"); + return false; } - Trace("MOD: %016llx %08x %s\n", imageAddress, module.Header().flags, imagePath.c_str()); - VisitModule(module); + Trace("MOD: dyldInfoAddress %016llx\n", dyldInfoAddress); } return true; } diff --git a/src/coreclr/debug/dbgutil/machoreader.h b/src/coreclr/debug/dbgutil/machoreader.h index bb9ffe0fdd7ceb..19630e624f61c6 100644 --- a/src/coreclr/debug/dbgutil/machoreader.h +++ b/src/coreclr/debug/dbgutil/machoreader.h @@ -27,7 +27,7 @@ class MachOModule uint64_t m_strtabAddress; public: - MachOModule(MachOReader& reader, mach_vm_address_t baseAddress, mach_header_64* header = nullptr, std::string* name = nullptr); + MachOModule(MachOReader& reader, mach_vm_address_t baseAddress, std::string* name = nullptr); ~MachOModule(); inline mach_vm_address_t BaseAddress() const { return m_baseAddress; } @@ -37,11 +37,10 @@ class MachOModule bool ReadHeader(); bool TryLookupSymbol(const char* symbolName, uint64_t* symbolValue); + bool TryLookupSymbol(int start, int nsyms, const char* symbolName, uint64_t* symbolValue); bool EnumerateSegments(); private: - inline void SetName(std::string& name) { m_name = name; } - bool ReadLoadCommands(); bool ReadSymbolTable(); uint64_t GetAddressFromFileOffset(uint32_t offset); @@ -53,9 +52,10 @@ class MachOReader friend MachOModule; public: MachOReader(); - bool EnumerateModules(mach_vm_address_t address, mach_header_64* header); + bool EnumerateModules(mach_vm_address_t dyldInfoAddress); private: + bool TryRegisterModule(const struct mach_header* imageAddress, const char* imageFilePathAddress, bool dylinker); bool ReadString(const char* address, std::string& str); virtual void VisitModule(MachOModule& module) { }; virtual void VisitSegment(MachOModule& module, const segment_command_64& segment) { }; diff --git a/src/coreclr/debug/debug-pal/CMakeLists.txt b/src/coreclr/debug/debug-pal/CMakeLists.txt index d2846f93b13f93..a382af2c07ad74 100644 --- a/src/coreclr/debug/debug-pal/CMakeLists.txt +++ b/src/coreclr/debug/debug-pal/CMakeLists.txt @@ -1,6 +1,6 @@ - include_directories(../inc) include_directories(../../pal/inc) +include_directories(${EP_GENERATED_HEADER_PATH}) add_definitions(-DPAL_STDCPP_COMPAT) diff --git a/src/coreclr/debug/di/cordb.cpp b/src/coreclr/debug/di/cordb.cpp index 2c11397fcd3bc7..e3b54bf9f99855 100644 --- a/src/coreclr/debug/di/cordb.cpp +++ b/src/coreclr/debug/di/cordb.cpp @@ -102,29 +102,29 @@ STDAPI CreateCordbObject(int iDebuggerVersion, IUnknown ** ppCordb) { return E_INVALIDARG; } - return Cordb::CreateObject( - (CorDebugInterfaceVersion)iDebuggerVersion, ProcessDescriptor::UNINITIALIZED_PID, /*lpApplicationGroupId*/ NULL, IID_ICorDebug, (void **) ppCordb); + (CorDebugInterfaceVersion)iDebuggerVersion, ProcessDescriptor::UNINITIALIZED_PID, /*lpApplicationGroupId*/ NULL, /*dacModulePath*/ NULL, IID_ICorDebug, (void **) ppCordb); } // // Public API. -// Telesto Creation path with Mac sandbox support - only way to debug a sandboxed application on Mac. -// This supercedes code:CoreCLRCreateCordbObject +// Creation path with Mac sandbox support and explicit DAC module path for single-file apps +// This supercedes code:CoreCLRCreateCordbObjectEx // // Arguments: // iDebuggerVersion - version of ICorDebug interfaces that the debugger is requesting // pid - pid of debuggee that we're attaching to. -// lpApplicationGroupId - A string representing the application group ID of a sandboxed +// lpApplicationGroupId - a string representing the application group ID of a sandboxed // process running in Mac. Pass NULL if the process is not // running in a sandbox and other platforms. +// dacModulePath - the full module path of the DAC module or NULL. // hmodTargetCLR - module handle to clr in target pid that we're attaching to. // ppCordb - (out) the resulting ICorDebug object. // // Notes: // It's inconsistent that this takes a (handle, pid) but hands back an ICorDebug instead of an ICorDebugProcess. // Callers will need to call *ppCordb->DebugActiveProcess(pid). -STDAPI DLLEXPORT CoreCLRCreateCordbObjectEx(int iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, HMODULE hmodTargetCLR, IUnknown ** ppCordb) +STDAPI DLLEXPORT CoreCLRCreateCordbObject3(int iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, LPCWSTR dacModulePath, HMODULE hmodTargetCLR, IUnknown** ppCordb) { if (ppCordb == NULL) { @@ -140,7 +140,7 @@ STDAPI DLLEXPORT CoreCLRCreateCordbObjectEx(int iDebuggerVersion, DWORD pid, LPC // Create the ICorDebug object // RSExtSmartPtr pCordb; - Cordb::CreateObject((CorDebugInterfaceVersion)iDebuggerVersion, pid, lpApplicationGroupId, IID_ICorDebug, (void **) &pCordb); + Cordb::CreateObject((CorDebugInterfaceVersion)iDebuggerVersion, pid, lpApplicationGroupId, dacModulePath, IID_ICorDebug, (void **) &pCordb); // // Associate it with the target instance @@ -162,7 +162,29 @@ STDAPI DLLEXPORT CoreCLRCreateCordbObjectEx(int iDebuggerVersion, DWORD pid, LPC // // Public API. -// Telesto Creation path - only way to debug multi-instance. +// Creation path with Mac sandbox support - only way to debug a sandboxed application on Mac. +// This supercedes code:CoreCLRCreateCordbObject +// +// Arguments: +// iDebuggerVersion - version of ICorDebug interfaces that the debugger is requesting +// pid - pid of debuggee that we're attaching to. +// lpApplicationGroupId - a string representing the application group ID of a sandboxed +// process running in Mac. Pass NULL if the process is not +// running in a sandbox and other platforms. +// hmodTargetCLR - module handle to clr in target pid that we're attaching to. +// ppCordb - (out) the resulting ICorDebug object. +// +// Notes: +// It's inconsistent that this takes a (handle, pid) but hands back an ICorDebug instead of an ICorDebugProcess. +// Callers will need to call *ppCordb->DebugActiveProcess(pid). +STDAPI DLLEXPORT CoreCLRCreateCordbObjectEx(int iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, HMODULE hmodTargetCLR, IUnknown ** ppCordb) +{ + return CoreCLRCreateCordbObject3(iDebuggerVersion, pid, lpApplicationGroupId, NULL, hmodTargetCLR, ppCordb); +} + +// +// Public API. +// Creation path - only way to debug multi-instance. // This supercedes code:CreateCordbObject // // Arguments: @@ -180,9 +202,6 @@ STDAPI DLLEXPORT CoreCLRCreateCordbObject(int iDebuggerVersion, DWORD pid, HMODU } - - - //***************************************************************************** // The main dll entry point for this module. This routine is called by the // OS when the dll gets loaded. Control is simply deferred to the main code. diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp index 791871946a1b24..53f2db1109d87c 100644 --- a/src/coreclr/debug/di/process.cpp +++ b/src/coreclr/debug/di/process.cpp @@ -686,9 +686,9 @@ CordbProcess::CreateDacDbiInterface() // in the new arch we can get the module from OpenVirtualProcess2 but in the shim case // and the deprecated OpenVirtualProcess case we must assume it comes from DAC in the // same directory as DBI - if(m_hDacModule == NULL) + if (m_hDacModule == NULL) { - m_hDacModule.Assign(ShimProcess::GetDacModule()); + m_hDacModule.Assign(ShimProcess::GetDacModule(m_cordb->GetDacModulePath())); } // diff --git a/src/coreclr/debug/di/rsmain.cpp b/src/coreclr/debug/di/rsmain.cpp index ff49f2186a40ca..7a0875928c528e 100644 --- a/src/coreclr/debug/di/rsmain.cpp +++ b/src/coreclr/debug/di/rsmain.cpp @@ -956,16 +956,17 @@ namespace * Cordb class * ------------------------------------------------------------------------- */ Cordb::Cordb(CorDebugInterfaceVersion iDebuggerVersion) - : Cordb(iDebuggerVersion, ProcessDescriptor::CreateUninitialized()) + : Cordb(iDebuggerVersion, ProcessDescriptor::CreateUninitialized(), NULL) { } -Cordb::Cordb(CorDebugInterfaceVersion iDebuggerVersion, const ProcessDescriptor& pd) +Cordb::Cordb(CorDebugInterfaceVersion iDebuggerVersion, const ProcessDescriptor& pd, LPCWSTR dacModulePath) : CordbBase(NULL, 0, enumCordb), m_processes(11), m_initialized(false), m_debuggerSpecifiedVersion(iDebuggerVersion), - m_pd(pd) + m_pd(pd), + m_dacModulePath(dacModulePath) #ifdef FEATURE_CORESYSTEM , m_targetCLR(0) @@ -2065,7 +2066,7 @@ void Cordb::EnsureCanLaunchOrAttach(BOOL fWin32DebuggingEnabled) HRESULT Cordb::CreateObjectV1(REFIID id, void **object) { - return CreateObject(CorDebugVersion_1_0, ProcessDescriptor::UNINITIALIZED_PID, NULL, id, object); + return CreateObject(CorDebugVersion_1_0, ProcessDescriptor::UNINITIALIZED_PID, NULL, NULL, id, object); } #if defined(FEATURE_DBGIPC_TRANSPORT_DI) @@ -2073,13 +2074,13 @@ HRESULT Cordb::CreateObjectV1(REFIID id, void **object) // same debug engine version as V2, though this may change in the future. HRESULT Cordb::CreateObjectTelesto(REFIID id, void ** pObject) { - return CreateObject(CorDebugVersion_2_0, ProcessDescriptor::UNINITIALIZED_PID, NULL, id, pObject); + return CreateObject(CorDebugVersion_2_0, ProcessDescriptor::UNINITIALIZED_PID, NULL, NULL, id, pObject); } #endif // FEATURE_DBGIPC_TRANSPORT_DI // Static // Used to create an instance for a ClassFactory (thus an external ref). -HRESULT Cordb::CreateObject(CorDebugInterfaceVersion iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, REFIID id, void **object) +HRESULT Cordb::CreateObject(CorDebugInterfaceVersion iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, LPCWSTR dacModulePath, REFIID id, void **object) { if (id != IID_IUnknown && id != IID_ICorDebug) return (E_NOINTERFACE); @@ -2111,7 +2112,7 @@ HRESULT Cordb::CreateObject(CorDebugInterfaceVersion iDebuggerVersion, DWORD pid ProcessDescriptor pd = ProcessDescriptor::Create(pid, applicationGroupId); - Cordb *db = new (nothrow) Cordb(iDebuggerVersion, pd); + Cordb *db = new (nothrow) Cordb(iDebuggerVersion, pd, dacModulePath); if (db == NULL) { diff --git a/src/coreclr/debug/di/rspriv.h b/src/coreclr/debug/di/rspriv.h index f4e3077938b720..054ef9326abb95 100644 --- a/src/coreclr/debug/di/rspriv.h +++ b/src/coreclr/debug/di/rspriv.h @@ -2226,7 +2226,7 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote #if defined(FEATURE_DBGIPC_TRANSPORT_DI) static COM_METHOD CreateObjectTelesto(REFIID id, void ** pObject); #endif // FEATURE_DBGIPC_TRANSPORT_DI - static COM_METHOD CreateObject(CorDebugInterfaceVersion iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, REFIID id, void **object); + static COM_METHOD CreateObject(CorDebugInterfaceVersion iDebuggerVersion, DWORD pid, LPCWSTR lpApplicationGroupId, LPCWSTR lpwstrDacModulePath, REFIID id, void** object); //----------------------------------------------------------- // ICorDebugRemote @@ -2299,6 +2299,7 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote private: Cordb(CorDebugInterfaceVersion iDebuggerVersion, const ProcessDescriptor& pd); + Cordb(CorDebugInterfaceVersion iDebuggerVersion, const ProcessDescriptor& pd, LPCWSTR dacModulePath); //----------------------------------------------------------- // Data members @@ -2315,6 +2316,8 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote CorDebugInterfaceVersion GetDebuggerVersion() const; + PathString& GetDacModulePath() { return m_dacModulePath; } + #ifdef FEATURE_CORESYSTEM HMODULE GetTargetCLR() { return m_targetCLR; } #endif @@ -2338,6 +2341,8 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote // Store information about the process to be debugged ProcessDescriptor m_pd; + PathString m_dacModulePath; + //Note - this code could be useful outside coresystem, but keeping the change localized // because we are late in the win8 release #ifdef FEATURE_CORESYSTEM @@ -6045,7 +6050,8 @@ struct GetActiveInternalFramesData class CordbThread : public CordbBase, public ICorDebugThread, public ICorDebugThread2, public ICorDebugThread3, - public ICorDebugThread4 + public ICorDebugThread4, + public ICorDebugThread5 { public: CordbThread(CordbProcess * pProcess, VMPTR_Thread); @@ -6116,6 +6122,10 @@ class CordbThread : public CordbBase, public ICorDebugThread, // ICorDebugThread4 COM_METHOD HasUnhandledException(); + // ICorDebugThread5 + COM_METHOD GetBytesAllocated(ULONG64 *pSohAllocatedBytes, + ULONG64 *pUohAllocatedBytes); + COM_METHOD GetBlockingObjects(ICorDebugBlockingObjectEnum **ppBlockingObjectEnum); // Gets the current CustomNotification object from the thread or NULL if no such object exists diff --git a/src/coreclr/debug/di/rsthread.cpp b/src/coreclr/debug/di/rsthread.cpp index 04a7fa21a1db4d..577574b796019c 100644 --- a/src/coreclr/debug/di/rsthread.cpp +++ b/src/coreclr/debug/di/rsthread.cpp @@ -186,6 +186,10 @@ HRESULT CordbThread::QueryInterface(REFIID id, void ** ppInterface) { *ppInterface = static_cast(this); } + else if (id == IID_ICorDebugThread5) + { + *ppInterface = static_cast(this); + } else if (id == IID_IUnknown) { *ppInterface = static_cast(static_cast(this)); @@ -2457,6 +2461,42 @@ HRESULT CordbThread::GetCurrentCustomDebuggerNotification(ICorDebugValue ** ppNo return hr; } +// ICorDebugThread5 + +/* + * GetBytesAllocated + * + * Returns S_OK if it was possible to obtain the allocation information for the thread + * and sets the corresponding SOH and UOH allocations. + */ +HRESULT CordbThread::GetBytesAllocated(ULONG64 *pSohAllocatedBytes, + ULONG64 *pUohAllocatedBytes) +{ + PUBLIC_API_ENTRY(this); + FAIL_IF_NEUTERED(this); + ATT_REQUIRE_STOPPED_MAY_FAIL(GetProcess()); + + HRESULT hr = S_OK; + EX_TRY + { + DacThreadAllocInfo threadAllocInfo = { 0 }; + + if (pSohAllocatedBytes == NULL || pUohAllocatedBytes == NULL) + { + ThrowHR(E_INVALIDARG); + } + + IDacDbiInterface * pDAC = GetProcess()->GetDAC(); + pDAC->GetThreadAllocInfo(m_vmThreadToken, &threadAllocInfo); + + *pSohAllocatedBytes = threadAllocInfo.m_allocBytesSOH; + *pUohAllocatedBytes = threadAllocInfo.m_allocBytesUOH; + } + EX_CATCH_HRESULT(hr); + + return hr; +} // CordbThread::GetBytesAllocated + /* * * SetRemapIP @@ -10775,4 +10815,3 @@ HRESULT CordbCodeEnum::Next(ULONG celt, ICorDebugCode *values[], ULONG *pceltFet return hr; } - diff --git a/src/coreclr/debug/di/shimpriv.h b/src/coreclr/debug/di/shimpriv.h index 89a0c0d0c79374..0b34227767c96c 100644 --- a/src/coreclr/debug/di/shimpriv.h +++ b/src/coreclr/debug/di/shimpriv.h @@ -389,7 +389,7 @@ class ShimProcess ); // Locates the DAC module adjacent to DBI - static HMODULE GetDacModule(); + static HMODULE GetDacModule(PathString& dacModulePath); // // Functions used by CordbProcess diff --git a/src/coreclr/debug/di/shimprocess.cpp b/src/coreclr/debug/di/shimprocess.cpp index 72da6068e8235b..a49eb224543a35 100644 --- a/src/coreclr/debug/di/shimprocess.cpp +++ b/src/coreclr/debug/di/shimprocess.cpp @@ -1819,28 +1819,30 @@ HRESULT ShimProcess::FindLoadedCLR(CORDB_ADDRESS * pClrInstanceId) // Throws on errors. // -HMODULE ShimProcess::GetDacModule() +HMODULE ShimProcess::GetDacModule(PathString& dacModulePath) { - HModuleHolder hDacDll; - PathString wszAccessDllPath; + HMODULE hDacDll; + PathString wszAccessDllPath(dacModulePath); - // - // Load the access DLL from the same directory as the the current CLR Debugging Services DLL. - // - if (GetClrModuleDirectory(wszAccessDllPath) != S_OK) + if (wszAccessDllPath.IsEmpty()) { - ThrowLastError(); - } - - // Dac Dll is named: - // mscordaccore.dll <-- coreclr - // mscordacwks.dll <-- desktop - PCWSTR eeFlavor = MAKEDLLNAME_W(W("mscordaccore")); + // + // Load the access DLL from the same directory as the the current CLR Debugging Services DLL. + // + if (GetClrModuleDirectory(wszAccessDllPath) != S_OK) + { + ThrowLastError(); + } - wszAccessDllPath.Append(eeFlavor); + // Dac Dll is named: + // mscordaccore.dll <-- coreclr + // mscordacwks.dll <-- desktop + PCWSTR eeFlavor = MAKEDLLNAME_W(W("mscordaccore")); - hDacDll.Assign(WszLoadLibrary(wszAccessDllPath)); - if (!hDacDll) + wszAccessDllPath.Append(eeFlavor); + } + hDacDll = WszLoadLibrary(wszAccessDllPath); + if (hDacDll == NULL) { DWORD dwLastError = GetLastError(); if (dwLastError == ERROR_MOD_NOT_FOUND) @@ -1853,8 +1855,7 @@ HMODULE ShimProcess::GetDacModule() ThrowWin32(dwLastError); } } - hDacDll.SuppressRelease(); - return (HMODULE) hDacDll; + return hDacDll; } MachineInfo ShimProcess::GetMachineInfo() diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index ab0610226cbf5c..136105fe127bf9 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -2719,7 +2719,6 @@ DebuggerJitInfo *Debugger::GetJitInfoWorker(MethodDesc *fd, const BYTE *pbAddr, // This may take the lock and lazily create an entry, so we do it up front. dji = dmi->GetLatestJitInfo(fd); - DebuggerDataLockHolder debuggerDataLockHolder(this); // Note the call to GetLatestJitInfo() will lazily create the first DJI if we don't already have one. @@ -2730,6 +2729,7 @@ DebuggerJitInfo *Debugger::GetJitInfoWorker(MethodDesc *fd, const BYTE *pbAddr, break; } } + LOG((LF_CORDB, LL_INFO1000, "D::GJI: for md:0x%x (%s::%s), got dmi:0x%x.\n", fd, fd->m_pszDebugClassName, fd->m_pszDebugMethodName, dmi)); @@ -2757,7 +2757,9 @@ DebuggerJitInfo *Debugger::GetJitInfoWorker(MethodDesc *fd, const BYTE *pbAddr, LOG((LF_CORDB,LL_INFO1000,"Couldn't find a DJI by address 0x%p, " "so it might be a stub or thunk\n", pbAddr)); TraceDestination trace; - + // Nothing here needs the data lock anymore, and GetJitInfo will grab the lock as needed. + // However, tracing may go into code versioning paths and this lock can't be held for that. + debuggerDataLockHolder.Release(); g_pEEInterface->TraceStub((const BYTE *)pbAddr, &trace); if ((trace.GetTraceType() == TRACE_MANAGED) && (pbAddr != (const BYTE *)trace.GetAddress())) @@ -16507,7 +16509,7 @@ HRESULT DebuggerHeap::Init(BOOL fExecutable) return E_OUTOFMEMORY; } } -#endif +#endif #endif // !DACCESS_COMPILE diff --git a/src/coreclr/debug/inc/dacdbistructures.h b/src/coreclr/debug/inc/dacdbistructures.h index 2dabaa48e2c23d..19c788edb297f6 100644 --- a/src/coreclr/debug/inc/dacdbistructures.h +++ b/src/coreclr/debug/inc/dacdbistructures.h @@ -787,8 +787,8 @@ struct MSLAYOUT DacSharedReJitInfo // These represent the allocated bytes so far on the thread. struct MSLAYOUT DacThreadAllocInfo { - ULONG m_allocBytesSOH; - ULONG m_allocBytesUOH; + ULONG64 m_allocBytesSOH; + ULONG64 m_allocBytesUOH; }; #include "dacdbistructures.inl" diff --git a/src/coreclr/dlls/mscordac/mscordac_unixexports.src b/src/coreclr/dlls/mscordac/mscordac_unixexports.src index 4fc0af3d682340..046f71196b0d23 100644 --- a/src/coreclr/dlls/mscordac/mscordac_unixexports.src +++ b/src/coreclr/dlls/mscordac/mscordac_unixexports.src @@ -31,6 +31,7 @@ nativeStringResourceTable_mscorrc #PAL_GetLogicalCpuCountFromOS #PAL_GetTotalCpuCount #PAL_GetNumaProcessorNode +#PAL_GetUnwindInfoSize #PAL_get_stdout #PAL_get_stderr #PAL_GetApplicationGroupId diff --git a/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/coreclr/dlls/mscordbi/CMakeLists.txt index c7a23c9923fe1d..b7618b324c2608 100644 --- a/src/coreclr/dlls/mscordbi/CMakeLists.txt +++ b/src/coreclr/dlls/mscordbi/CMakeLists.txt @@ -99,6 +99,17 @@ elseif(CLR_CMAKE_HOST_UNIX) mscordaccore ) + # Before llvm 16, lld was setting `--undefined-version` by default. The default was + # flipped to `--no-undefined-version` in lld 16, so we will explicitly set it to + # `--undefined-version` for our use-case. + include(CheckLinkerFlag OPTIONAL) + if(COMMAND check_linker_flag) + check_linker_flag(CXX -Wl,--undefined-version LINKER_SUPPORTS_UNDEFINED_VERSION) + if (LINKER_SUPPORTS_UNDEFINED_VERSION) + add_linker_flag(-Wl,--undefined-version) + endif(LINKER_SUPPORTS_UNDEFINED_VERSION) + endif(COMMAND check_linker_flag) + # COREDBI_LIBRARIES is mentioned twice because ld is one pass linker and will not find symbols # if they are defined after they are used. Having all libs twice makes sure that ld will actually # find all symbols. diff --git a/src/coreclr/dlls/mscordbi/mscordbi.src b/src/coreclr/dlls/mscordbi/mscordbi.src index 04f7c172b9bd35..ec3aa1303fb232 100644 --- a/src/coreclr/dlls/mscordbi/mscordbi.src +++ b/src/coreclr/dlls/mscordbi/mscordbi.src @@ -20,6 +20,7 @@ EXPORTS CoreCLRCreateCordbObject private CoreCLRCreateCordbObjectEx private + CoreCLRCreateCordbObject3 private #if defined(FEATURE_DBGIPC_TRANSPORT_DI) DllGetClassObject private diff --git a/src/coreclr/dlls/mscordbi/mscordbi_unixexports.src b/src/coreclr/dlls/mscordbi/mscordbi_unixexports.src index 1ff9d997a445c1..78aaf25f69d58e 100644 --- a/src/coreclr/dlls/mscordbi/mscordbi_unixexports.src +++ b/src/coreclr/dlls/mscordbi/mscordbi_unixexports.src @@ -8,6 +8,7 @@ DllGetClassObject ; CoreClr API CoreCLRCreateCordbObject CoreCLRCreateCordbObjectEx +CoreCLRCreateCordbObject3 ; Out-of-proc creation path from the shim - ICLRDebugging OpenVirtualProcessImpl diff --git a/src/coreclr/dlls/mscoree/CMakeLists.txt b/src/coreclr/dlls/mscoree/CMakeLists.txt index 4571b196aaa942..3979c42245295d 100644 --- a/src/coreclr/dlls/mscoree/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/CMakeLists.txt @@ -11,7 +11,7 @@ set(CLR_SOURCES if(CLR_CMAKE_TARGET_WIN32) list(APPEND CLR_SOURCES - delayloadhook.cpp + ${CLR_SRC_NATIVE_DIR}/common/delayloadhook_windows.cpp Native.rc ) diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt index cfc08adbc43406..4d88855ca6a2f7 100644 --- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt @@ -167,10 +167,15 @@ if(FEATURE_MERGE_JIT_AND_ENGINE) set(CLRJIT_STATIC clrjit_static) endif(FEATURE_MERGE_JIT_AND_ENGINE) +if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST) + include(CMakeFindFrameworks) + find_library(FOUNDATION Foundation REQUIRED) +endif() + target_sources(coreclr PUBLIC $) -target_link_libraries(coreclr PUBLIC ${CORECLR_LIBRARIES} ${CLRJIT_STATIC} cee_wks) +target_link_libraries(coreclr PUBLIC ${CORECLR_LIBRARIES} ${CLRJIT_STATIC} cee_wks ${FOUNDATION}) target_sources(coreclr_static PUBLIC $) -target_link_libraries(coreclr_static PUBLIC ${CORECLR_LIBRARIES} clrjit_static cee_wks_mergeable) +target_link_libraries(coreclr_static PUBLIC ${CORECLR_LIBRARIES} clrjit_static cee_wks_mergeable ${FOUNDATION}) target_compile_definitions(coreclr_static PUBLIC CORECLR_EMBEDDED) if(CLR_CMAKE_TARGET_WIN32) diff --git a/src/coreclr/dlls/mscoree/unixinterface.cpp b/src/coreclr/dlls/mscoree/unixinterface.cpp index c6ce99302467ff..7a5524a939c6de 100644 --- a/src/coreclr/dlls/mscoree/unixinterface.cpp +++ b/src/coreclr/dlls/mscoree/unixinterface.cpp @@ -22,6 +22,25 @@ #define ASSERTE_ALL_BUILDS(expr) _ASSERTE_ALL_BUILDS(__FILE__, (expr)) +#ifdef TARGET_UNIX +#define NO_HOSTING_API_RETURN_ADDRESS ((void*)ULONG_PTR_MAX) +void* g_hostingApiReturnAddress = NO_HOSTING_API_RETURN_ADDRESS; + +class HostingApiFrameHolder +{ +public: + HostingApiFrameHolder(void* returnAddress) + { + g_hostingApiReturnAddress = returnAddress; + } + + ~HostingApiFrameHolder() + { + g_hostingApiReturnAddress = NO_HOSTING_API_RETURN_ADDRESS; + } +}; +#endif // TARGET_UNIX + // Holder for const wide strings typedef NewArrayHolder ConstWStringHolder; @@ -179,6 +198,7 @@ extern "C" int coreclr_create_delegate(void*, unsigned int, const char*, const c // HRESULT indicating status of the operation. S_OK if the assembly was successfully executed // extern "C" +NOINLINE DLLEXPORT int coreclr_initialize( const char* exePath, @@ -197,6 +217,10 @@ int coreclr_initialize( bool hostPolicyEmbedded = false; PInvokeOverrideFn* pinvokeOverride = nullptr; +#ifdef TARGET_UNIX + HostingApiFrameHolder apiFrameHolder(_ReturnAddress()); +#endif + ConvertConfigPropertiesToUnicode( propertyKeys, propertyValues, @@ -421,6 +445,7 @@ int coreclr_create_delegate( // HRESULT indicating status of the operation. S_OK if the assembly was successfully executed // extern "C" +NOINLINE DLLEXPORT int coreclr_execute_assembly( void* hostHandle, @@ -436,6 +461,10 @@ int coreclr_execute_assembly( } *exitCode = -1; +#ifdef TARGET_UNIX + HostingApiFrameHolder apiFrameHolder(_ReturnAddress()); +#endif + ICLRRuntimeHost4* host = reinterpret_cast(hostHandle); ConstWStringArrayHolder argvW; diff --git a/src/coreclr/dlls/mscorrc/mscorrc.rc b/src/coreclr/dlls/mscorrc/mscorrc.rc index 161f6e1e6c8c4c..7f83466b055e44 100644 --- a/src/coreclr/dlls/mscorrc/mscorrc.rc +++ b/src/coreclr/dlls/mscorrc/mscorrc.rc @@ -496,6 +496,7 @@ BEGIN IDS_EE_ARRAY_DIMENSIONS_EXCEEDED "Array dimensions exceeded supported range." + IDS_EE_OUT_OF_SYNCBLOCKS "Internal limitation: attempt to create more than 2^26 SyncBlocks." IDS_EE_THREAD_NOTSTARTED "Thread has not been started." IDS_EE_STRING_TOOLONG "Marshaler restriction: Excessively long string." diff --git a/src/coreclr/dlls/mscorrc/resource.h b/src/coreclr/dlls/mscorrc/resource.h index 0e39c27f0c88cf..7acb390b640a60 100644 --- a/src/coreclr/dlls/mscorrc/resource.h +++ b/src/coreclr/dlls/mscorrc/resource.h @@ -369,6 +369,7 @@ #define IDS_EE_COMIMPORT_METHOD_NO_INTERFACE 0x1aab #define IDS_EE_OUT_OF_MEMORY_WITHIN_RANGE 0x1aac #define IDS_EE_ARRAY_DIMENSIONS_EXCEEDED 0x1aad +#define IDS_EE_OUT_OF_SYNCBLOCKS 0x1aae #define IDS_CLASSLOAD_MI_CANNOT_OVERRIDE 0x1ab3 #define IDS_CLASSLOAD_COLLECTIBLEFIXEDVTATTR 0x1ab6 diff --git a/src/coreclr/gc/env/gcenv.base.h b/src/coreclr/gc/env/gcenv.base.h index 5cb2f4178ce0c7..c5e516ed15c82d 100644 --- a/src/coreclr/gc/env/gcenv.base.h +++ b/src/coreclr/gc/env/gcenv.base.h @@ -43,6 +43,10 @@ #define SSIZE_T_MAX ((ptrdiff_t)(SIZE_T_MAX / 2)) #endif +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + #ifndef _INC_WINDOWS // ----------------------------------------------------------------------------------------------------------- // @@ -191,26 +195,15 @@ typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)(void* lpThreadParameter); #endif #else // _MSC_VER -#ifdef __llvm__ -#define HAS_IA32_PAUSE __has_builtin(__builtin_ia32_pause) -#define HAS_IA32_MFENCE __has_builtin(__builtin_ia32_mfence) -#else -#define HAS_IA32_PAUSE 0 -#define HAS_IA32_MFENCE 0 -#endif - -// Only clang defines __has_builtin, so we first test for a GCC define -// before using __has_builtin. - #if defined(__i386__) || defined(__x86_64__) -#if (__GNUC__ > 4 && __GNUC_MINOR > 7) || HAS_IA32_PAUSE +#if __has_builtin(__builtin_ia32_pause) // clang added this intrinsic in 3.8 // gcc added this intrinsic by 4.7.1 #define YieldProcessor __builtin_ia32_pause #endif // __has_builtin(__builtin_ia32_pause) -#if defined(__GNUC__) || HAS_IA32_MFENCE +#if __has_builtin(__builtin_ia32_mfence) // clang has had this intrinsic since at least 3.0 // gcc has had this intrinsic since forever #define MemoryBarrier __builtin_ia32_mfence diff --git a/src/coreclr/gc/env/gcenv.ee.h b/src/coreclr/gc/env/gcenv.ee.h index 7ecbfdda4f21ad..472679736a538d 100644 --- a/src/coreclr/gc/env/gcenv.ee.h +++ b/src/coreclr/gc/env/gcenv.ee.h @@ -92,6 +92,8 @@ class GCToEEInterface static void UpdateGCEventStatus(int publicLevel, int publicKeywords, int privateLevel, int privateKeywords); static void LogStressMsg(unsigned level, unsigned facility, const StressLogMsg &msg); static uint32_t GetCurrentProcessCpuCount(); + + static void DiagAddNewRegion(int generation, uint8_t* rangeStart, uint8_t* rangeEnd, uint8_t* rangeEndReserved); }; #endif // __GCENV_EE_H__ diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 47ff77df3f49f8..df9a96b8dc0099 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -86,6 +86,7 @@ BOOL bgc_heap_walk_for_etw_p = FALSE; #define LOH_PIN_DECAY 10 uint32_t yp_spin_count_unit = 0; +uint32_t original_spin_count_unit = 0; size_t loh_size_threshold = LARGE_OBJECT_SIZE; #ifdef GC_CONFIG_DRIVEN @@ -2243,6 +2244,7 @@ double gc_heap::short_plugs_pad_ratio = 0; #endif //SHORT_PLUGS int gc_heap::generation_skip_ratio_threshold = 0; +int gc_heap::conserve_mem_setting = 0; uint64_t gc_heap::suspended_start_time = 0; uint64_t gc_heap::end_gc_time = 0; @@ -2724,7 +2726,7 @@ alloc_list gc_heap::poh_alloc_list [NUM_POH_ALIST-1]; #ifdef DOUBLY_LINKED_FL // size we removed with no undo; only for recording purpose size_t gc_heap::gen2_removed_no_undo = 0; -size_t gc_heap::saved_pinned_plug_index = 0; +size_t gc_heap::saved_pinned_plug_index = INVALID_SAVED_PINNED_PLUG_INDEX; #endif //DOUBLY_LINKED_FL #ifdef FEATURE_EVENT_TRACE @@ -3255,6 +3257,12 @@ gc_heap::dt_low_card_table_efficiency_p (gc_tuning_point tp) return ret; } +inline BOOL +gc_heap::dt_high_memory_load_p() +{ + return ((settings.entry_memory_load >= high_memory_load_th) || g_low_memory_status); +} + inline BOOL in_range_for_segment(uint8_t* add, heap_segment* seg) { @@ -5807,8 +5815,6 @@ heap_segment* gc_heap::get_segment_for_uoh (int gen_number, size_t size gc_etw_segment_pinned_object_heap : gc_etw_segment_large_object_heap); - GCToEEInterface::DiagUpdateGenerationBounds(); - #ifndef USE_REGIONS #ifdef MULTIPLE_HEAPS hp->thread_uoh_segment (gen_number, res); @@ -5816,6 +5822,12 @@ heap_segment* gc_heap::get_segment_for_uoh (int gen_number, size_t size thread_uoh_segment (gen_number, res); #endif //MULTIPLE_HEAPS #endif //!USE_REGIONS + GCToEEInterface::DiagAddNewRegion( + gen_number, + heap_segment_mem (res), + heap_segment_allocated (res), + heap_segment_reserved (res) + ); } return res; @@ -10913,7 +10925,7 @@ void gc_heap::clear_region_info (heap_segment* region) settings.gc_index, current_bgc_state, seg_deleted); - if (settings.entry_memory_load >= high_memory_load_th || g_low_memory_status) + if (dt_high_memory_load_p()) { decommit_mark_array_by_seg (region); } @@ -11372,7 +11384,7 @@ size_t gc_heap::decommit_heap_segment_pages_worker (heap_segment* seg, uint8_t* new_committed) { #ifdef USE_REGIONS - if (settings.entry_memory_load < high_memory_load_th && !g_low_memory_status) + if (!dt_high_memory_load_p()) { return 0; } @@ -11407,7 +11419,7 @@ size_t gc_heap::decommit_heap_segment_pages_worker (heap_segment* seg, void gc_heap::decommit_heap_segment (heap_segment* seg) { #ifdef USE_REGIONS - if (settings.entry_memory_load < high_memory_load_th && !g_low_memory_status) + if (!dt_high_memory_load_p()) { return; } @@ -12357,9 +12369,9 @@ void gc_heap::make_generation (int gen_num, heap_segment* seg, uint8_t* start) #endif //DOUBLY_LINKED_FL #ifdef FREE_USAGE_STATS - memset (gen->gen_free_spaces, 0, sizeof (gen.gen_free_spaces)); - memset (gen->gen_current_pinned_free_spaces, 0, sizeof (gen.gen_current_pinned_free_spaces)); - memset (gen->gen_plugs, 0, sizeof (gen.gen_plugs)); + memset (gen->gen_free_spaces, 0, sizeof (gen->gen_free_spaces)); + memset (gen->gen_current_pinned_free_spaces, 0, sizeof (gen->gen_current_pinned_free_spaces)); + memset (gen->gen_plugs, 0, sizeof (gen->gen_plugs)); #endif //FREE_USAGE_STATS } @@ -12717,6 +12729,8 @@ HRESULT gc_heap::initialize_gc (size_t soh_segment_size, yp_spin_count_unit = 32 * g_num_processors; #endif //MULTIPLE_HEAPS + original_spin_count_unit = yp_spin_count_unit; + #if defined(__linux__) GCToEEInterface::UpdateGCEventStatus(static_cast(GCEventStatus::GetEnabledLevel(GCEventProvider_Default)), static_cast(GCEventStatus::GetEnabledKeywords(GCEventProvider_Default)), @@ -12954,6 +12968,14 @@ gc_heap::init_semi_shared() #endif //FEATURE_LOH_COMPACTION #endif //FEATURE_EVENT_TRACE + conserve_mem_setting = (int)GCConfig::GetGCConserveMem(); + if (conserve_mem_setting < 0) + conserve_mem_setting = 0; + if (conserve_mem_setting > 9) + conserve_mem_setting = 9; + + dprintf (1, ("conserve_mem_setting = %d", conserve_mem_setting)); + ret = 1; cleanup: @@ -13884,7 +13906,20 @@ void gc_heap::adjust_limit (uint8_t* start, size_t limit_size, generation* gen) uint8_t* old_loc = generation_last_free_list_allocated (gen); // check if old_loc happens to be in a saved plug_and_gap with a pinned plug after it - uint8_t* saved_plug_and_gap = pinned_plug (pinned_plug_of (saved_pinned_plug_index)) - sizeof(plug_and_gap); + uint8_t* saved_plug_and_gap = nullptr; + if (saved_pinned_plug_index != INVALID_SAVED_PINNED_PLUG_INDEX) + { + saved_plug_and_gap = pinned_plug (pinned_plug_of (saved_pinned_plug_index)) - sizeof(plug_and_gap); + + dprintf (3333, ("[h%d] sppi: %Id mtos: %Id old_loc: %Ix pp: %Ix(%Id) offs: %Id", + heap_number, + saved_pinned_plug_index, + mark_stack_tos, + old_loc, + pinned_plug (pinned_plug_of (saved_pinned_plug_index)), + pinned_len (pinned_plug_of (saved_pinned_plug_index)), + old_loc - saved_plug_and_gap)); + } size_t offset = old_loc - saved_plug_and_gap; if (offset < sizeof(gap_reloc_pair)) { @@ -15904,11 +15939,13 @@ BOOL gc_heap::soh_try_fit (int gen_number, fix_youngest_allocation_area(); heap_segment* next_seg = heap_segment_next (ephemeral_heap_segment); + bool new_seg = false; if (!next_seg) { assert (ephemeral_heap_segment == generation_tail_region (generation_of (gen_number))); next_seg = get_new_region (gen_number); + new_seg = true; } if (next_seg) @@ -15916,6 +15953,15 @@ BOOL gc_heap::soh_try_fit (int gen_number, dprintf (REGIONS_LOG, ("eph seg %Ix -> next %Ix", heap_segment_mem (ephemeral_heap_segment), heap_segment_mem (next_seg))); ephemeral_heap_segment = next_seg; + if (new_seg) + { + GCToEEInterface::DiagAddNewRegion( + heap_segment_gen_num (next_seg), + heap_segment_mem (next_seg), + heap_segment_allocated (next_seg), + heap_segment_reserved (next_seg) + ); + } } else { @@ -17462,7 +17508,6 @@ void gc_heap::init_free_and_plug() #else memset (gen->gen_free_spaces, 0, sizeof (gen->gen_free_spaces)); #endif //DOUBLY_LINKED_FL - memset (gen->gen_plugs_allocated_in_free, 0, sizeof (gen->gen_plugs_allocated_in_free)); memset (gen->gen_plugs, 0, sizeof (gen->gen_plugs)); memset (gen->gen_current_pinned_free_spaces, 0, sizeof (gen->gen_current_pinned_free_spaces)); } @@ -17480,7 +17525,7 @@ void gc_heap::init_free_and_plug() void gc_heap::print_free_and_plug (const char* msg) { -#if defined(FREE_USAGE_STATS) && defined(SIMPLE_DPRINTF) +#ifdef FREE_USAGE_STATS int older_gen = ((settings.condemned_generation == max_generation) ? max_generation : (settings.condemned_generation + 1)); for (int i = 0; i <= older_gen; i++) { @@ -17501,7 +17546,7 @@ void gc_heap::print_free_and_plug (const char* msg) } #else UNREFERENCED_PARAMETER(msg); -#endif //FREE_USAGE_STATS && SIMPLE_DPRINTF +#endif //FREE_USAGE_STATS } // replace with allocator::first_suitable_bucket @@ -17573,8 +17618,8 @@ void gc_heap::add_gen_free (int gen_number, size_t free_size) (gen->gen_free_spaces[i])++; if (gen_number == max_generation) { - dprintf (3, ("Mb b%d: f+ %Id (%Id->%Id)", - i, free_size, (gen->gen_free_spaces[i]).num_items, (gen->gen_free_spaces[i]).total_size)); + dprintf (3, ("Mb b%d: f+ %Id (%Id)", + i, free_size, gen->gen_free_spaces[i])); } #else UNREFERENCED_PARAMETER(gen_number); @@ -17596,8 +17641,8 @@ void gc_heap::remove_gen_free (int gen_number, size_t free_size) (gen->gen_free_spaces[i])--; if (gen_number == max_generation) { - dprintf (3, ("Mb b%d: f- %Id (%Id->%Id)", - i, free_size, (gen->gen_free_spaces[i]).num_items, (gen->gen_free_spaces[i]).total_size)); + dprintf (3, ("Mb b%d: f- %Id (%Id)", + i, free_size, gen->gen_free_spaces[i])); } #else UNREFERENCED_PARAMETER(gen_number); @@ -18794,6 +18839,37 @@ int gc_heap::joined_generation_to_condemn (BOOL should_evaluate_elevation, } } + if ((conserve_mem_setting != 0) && (n == max_generation)) + { + float frag_limit = 1.0f - conserve_mem_setting / 10.0f; + + size_t loh_size = get_total_gen_size (loh_generation); + size_t gen2_size = get_total_gen_size (max_generation); + float loh_frag_ratio = 0.0f; + float combined_frag_ratio = 0.0f; + if (loh_size != 0) + { + size_t loh_frag = get_total_gen_fragmentation (loh_generation); + size_t gen2_frag = get_total_gen_fragmentation (max_generation); + loh_frag_ratio = (float)loh_frag / (float)loh_size; + combined_frag_ratio = (float)(gen2_frag + loh_frag) / (float)(gen2_size + loh_size); + } + if (combined_frag_ratio > frag_limit) + { + dprintf (GTC_LOG, ("combined frag: %f > limit %f, loh frag: %f", combined_frag_ratio, frag_limit, loh_frag_ratio)); + gc_data_global.gen_to_condemn_reasons.set_condition (gen_max_high_frag_p); + + n = max_generation; + *blocking_collection_p = TRUE; + if (loh_frag_ratio > frag_limit) + { + settings.loh_compaction = TRUE; + + dprintf (GTC_LOG, ("compacting LOH due to GCConserveMem setting")); + } + } + } + #ifdef BGC_SERVO_TUNING if (bgc_tuning::should_trigger_ngc2()) { @@ -19912,6 +19988,8 @@ BOOL gc_heap::should_proceed_with_gc() // The no_gc mode was already in progress yet we triggered another GC, // this effectively exits the no_gc mode. restore_data_for_no_gc(); + + memset (¤t_no_gc_region_info, 0, sizeof (current_no_gc_region_info)); } else return should_proceed_for_no_gc(); @@ -20996,9 +21074,22 @@ bool gc_heap::extend_soh_for_no_gc() } region = heap_segment_next (region); - if ((region == nullptr) && !(region = get_new_region (0))) + if (region == nullptr) { - break; + region = get_new_region (0); + if (region == nullptr) + { + break; + } + else + { + GCToEEInterface::DiagAddNewRegion( + 0, + heap_segment_mem (region), + heap_segment_allocated (region), + heap_segment_reserved (region) + ); + } } } else @@ -23939,6 +24030,21 @@ size_t gc_heap::get_total_gen_estimated_reclaim (int gen_number) return total_estimated_reclaim; } +size_t gc_heap::get_total_gen_size (int gen_number) +{ +#ifdef MULTIPLE_HEAPS + size_t size = 0; + for (int hn = 0; hn < gc_heap::n_heaps; hn++) + { + gc_heap* hp = gc_heap::g_heaps[hn]; + size += hp->generation_size (gen_number); + } +#else + size_t size = generation_size (gen_number); +#endif //MULTIPLE_HEAPS + return size; +} + size_t gc_heap::committed_size() { size_t total_committed = 0; @@ -26100,7 +26206,7 @@ BOOL gc_heap::plan_loh() void gc_heap::compact_loh() { - assert (loh_compaction_requested() || heap_hard_limit); + assert (loh_compaction_requested() || heap_hard_limit || conserve_mem_setting); #ifdef FEATURE_EVENT_TRACE uint64_t start_time, end_time; @@ -27431,7 +27537,7 @@ void gc_heap::plan_phase (int condemned_gen_number) #ifdef DOUBLY_LINKED_FL gen2_removed_no_undo = 0; - saved_pinned_plug_index = 0; + saved_pinned_plug_index = INVALID_SAVED_PINNED_PLUG_INDEX; #endif //DOUBLY_LINKED_FL while (1) @@ -33021,8 +33127,6 @@ void gc_heap::background_mark_phase () #endif //MULTIPLE_HEAPS } - gen0_bricks_cleared = FALSE; - dprintf (2, ("end of bgc mark: loh: %d, poh: %d, soh: %d", generation_size (loh_generation), generation_size (poh_generation), @@ -37881,6 +37985,19 @@ size_t gc_heap::desired_new_allocation (dynamic_data* dd, cst = min (1.0f, float (out) / float (dd_begin_data_size (dd))); f = surv_to_growth (cst, limit, max_limit); + if (conserve_mem_setting != 0) + { + // if this is set, compute a growth factor based on it. + // example: a setting of 6 means we have a goal of 60% live data + // this means we allow 40% fragmentation + // to keep heap size stable, we only use half of that (20%) for new allocation + // f is (live data + new allocation)/(live data), so would be (60% + 20%) / 60% or 1.33 + float f_conserve = ((10.0f / conserve_mem_setting) - 1) * 0.5f + 1.0f; + + // use the smaller one + f = min (f, f_conserve); + } + size_t max_growth_size = (size_t)(max_size / f); if (current_size >= max_growth_size) { @@ -37904,6 +38021,7 @@ size_t gc_heap::desired_new_allocation (dynamic_data* dd, #ifdef BGC_SERVO_TUNING !bgc_tuning::fl_tuning_triggered && #endif //BGC_SERVO_TUNING + (conserve_mem_setting == 0) && (dd_fragmentation (dd) > ((size_t)((f-1)*current_size)))) { //reducing allocation in case of fragmentation @@ -38163,7 +38281,8 @@ size_t gc_heap::trim_youngest_desired (uint32_t memory_load, } else { - return max (mem_one_percent, total_min_allocation); + size_t total_max_allocation = max (mem_one_percent, total_min_allocation); + return min (total_new_allocation, total_max_allocation); } } @@ -38395,7 +38514,7 @@ void gc_heap::decommit_ephemeral_segment_pages() dynamic_data* dd0 = dynamic_data_of (0); - ptrdiff_t desired_allocation = estimate_gen_growth (soh_gen0) + + ptrdiff_t desired_allocation = dd_new_allocation (dd0) + estimate_gen_growth (soh_gen1) + loh_size_threshold; @@ -39326,7 +39445,7 @@ void reset_memory (uint8_t* o, size_t sizeo) size_t size = align_lower_page ((size_t)o + sizeo - size_to_skip - plug_skew) - page_start; // Note we need to compensate for an OS bug here. This bug would cause the MEM_RESET to fail // on write watched memory. - if (reset_mm_p && gc_heap::g_low_memory_status) + if (reset_mm_p && gc_heap::dt_high_memory_load_p()) { #ifdef MULTIPLE_HEAPS bool unlock_p = true; @@ -42923,11 +43042,11 @@ size_t GCHeap::GetPromotedBytes(int heap_index) void GCHeap::SetYieldProcessorScalingFactor (float scalingFactor) { assert (yp_spin_count_unit != 0); - int saved_yp_spin_count_unit = yp_spin_count_unit; - yp_spin_count_unit = (int)((float)yp_spin_count_unit * scalingFactor / (float)9); + uint32_t saved_yp_spin_count_unit = yp_spin_count_unit; + yp_spin_count_unit = (uint32_t)((float)original_spin_count_unit * scalingFactor / (float)9); - // It's very suspicious if it becomes 0 - if (yp_spin_count_unit == 0) + // It's very suspicious if it becomes 0 and also, we don't want to spin too much. + if ((yp_spin_count_unit == 0) || (yp_spin_count_unit > 32768)) { yp_spin_count_unit = saved_yp_spin_count_unit; } @@ -42941,6 +43060,76 @@ unsigned int GCHeap::WhichGeneration (Object* object) return g; } +unsigned int GCHeap::GetGenerationWithRange (Object* object, uint8_t** ppStart, uint8_t** ppAllocated, uint8_t** ppReserved) +{ + int generation = -1; + heap_segment * hs = gc_heap::find_segment ((uint8_t*)object, FALSE); +#ifdef USE_REGIONS + generation = heap_segment_gen_num (hs); + if (generation == max_generation) + { + if (heap_segment_loh_p (hs)) + { + generation = loh_generation; + } + else if (heap_segment_poh_p (hs)) + { + generation = poh_generation; + } + } + + *ppStart = heap_segment_mem (hs); + *ppAllocated = heap_segment_allocated (hs); + *ppReserved = heap_segment_reserved (hs); +#else +#ifdef MULTIPLE_HEAPS + gc_heap* hp = heap_segment_heap (hs); +#else + gc_heap* hp = __this; +#endif //MULTIPLE_HEAPS + if (hs == hp->ephemeral_heap_segment) + { + uint8_t* reserved = heap_segment_reserved (hs); + uint8_t* end = heap_segment_allocated(hs); + for (int gen = 0; gen < max_generation; gen++) + { + uint8_t* start = generation_allocation_start (hp->generation_of (gen)); + if ((uint8_t*)object >= start) + { + generation = gen; + *ppStart = start; + *ppAllocated = end; + *ppReserved = reserved; + break; + } + end = reserved = start; + } + if (generation == -1) + { + generation = max_generation; + *ppStart = heap_segment_mem (hs); + *ppAllocated = *ppReserved = generation_allocation_start (hp->generation_of (max_generation - 1)); + } + } + else + { + generation = max_generation; + if (heap_segment_loh_p (hs)) + { + generation = loh_generation; + } + else if (heap_segment_poh_p (hs)) + { + generation = poh_generation; + } + *ppStart = heap_segment_mem (hs); + *ppAllocated = heap_segment_allocated (hs); + *ppReserved = heap_segment_reserved (hs); + } +#endif //USE_REGIONS + return (unsigned int)generation; +} + bool GCHeap::IsEphemeral (Object* object) { uint8_t* o = (uint8_t*)object; @@ -44170,6 +44359,8 @@ bool gc_heap::is_pm_ratio_exceeded() void gc_heap::update_recorded_gen_data (last_recorded_gc_info* gc_info) { + memset (gc_info->gen_info, 0, sizeof (gc_info->gen_info)); + #ifdef MULTIPLE_HEAPS for (int i = 0; i < gc_heap::n_heaps; i++) { @@ -44854,6 +45045,11 @@ void GCHeap::GetMemoryInfo(uint64_t* highMemLoadThresholdBytes, #endif //_DEBUG } +int64_t GCHeap::GetTotalPauseDuration() +{ + return (int64_t)(gc_heap::total_suspended_time * 10); +} + uint32_t GCHeap::GetMemoryLoad() { uint32_t memory_load = 0; diff --git a/src/coreclr/gc/gcconfig.h b/src/coreclr/gc/gcconfig.h index 8a9112ec480849..886ea17743880d 100644 --- a/src/coreclr/gc/gcconfig.h +++ b/src/coreclr/gc/gcconfig.h @@ -133,6 +133,7 @@ class GCConfigStringHolder INT_CONFIG (GCHeapHardLimitLOHPercent, "GCHeapHardLimitLOHPercent", "System.GC.HeapHardLimitLOHPercent", 0, "Specifies the GC heap LOH usage as a percentage of the total memory") \ INT_CONFIG (GCHeapHardLimitPOHPercent, "GCHeapHardLimitPOHPercent", "System.GC.HeapHardLimitPOHPercent", 0, "Specifies the GC heap POH usage as a percentage of the total memory") \ INT_CONFIG (GCEnabledInstructionSets, "GCEnabledInstructionSets", NULL, -1, "Specifies whether GC can use AVX2 or AVX512F - 0 for neither, 1 for AVX2, 3 for AVX512F")\ + INT_CONFIG (GCConserveMem, "GCConserveMemory", NULL, 0, "Specifies how hard GC should try to conserve memory - values 0-9") \ // This class is responsible for retreiving configuration information // for how the GC should operate. diff --git a/src/coreclr/gc/gcenv.ee.standalone.inl b/src/coreclr/gc/gcenv.ee.standalone.inl index c7e4dc4c98b2f0..c2a023fa5c5eb1 100644 --- a/src/coreclr/gc/gcenv.ee.standalone.inl +++ b/src/coreclr/gc/gcenv.ee.standalone.inl @@ -306,4 +306,9 @@ inline uint32_t GCToEEInterface::GetCurrentProcessCpuCount() return g_theGCToCLR->GetCurrentProcessCpuCount(); } +inline void GCToEEInterface::DiagAddNewRegion(int generation, uint8_t* rangeStart, uint8_t* rangeEnd, uint8_t* rangeEndReserved) +{ + g_theGCToCLR->DiagAddNewRegion(generation, rangeStart, rangeEnd, rangeEndReserved); +} + #endif // __GCTOENV_EE_STANDALONE_INL__ diff --git a/src/coreclr/gc/gcimpl.h b/src/coreclr/gc/gcimpl.h index 2c21ceada4fe00..1d470a0c8ca124 100644 --- a/src/coreclr/gc/gcimpl.h +++ b/src/coreclr/gc/gcimpl.h @@ -180,7 +180,9 @@ class GCHeap : public IGCHeapInternal bool* isConcurrent, uint64_t* genInfoRaw, uint64_t* pauseInfoRaw, - int kind);; + int kind); + + int64_t GetTotalPauseDuration(); uint32_t GetMemoryLoad(); @@ -309,6 +311,7 @@ class GCHeap : public IGCHeapInternal virtual void DiagGetGCSettings(EtwGCSettingsInfo* etw_settings); + virtual unsigned int GetGenerationWithRange(Object* object, uint8_t** ppStart, uint8_t** ppAllocated, uint8_t** ppReserved); public: Object * NextObj (Object * object); diff --git a/src/coreclr/gc/gcinterface.ee.h b/src/coreclr/gc/gcinterface.ee.h index 6525cc653ef635..e2019c8a1adbe6 100644 --- a/src/coreclr/gc/gcinterface.ee.h +++ b/src/coreclr/gc/gcinterface.ee.h @@ -443,6 +443,9 @@ class IGCToCLR { virtual uint32_t GetCurrentProcessCpuCount() = 0; + + virtual + void DiagAddNewRegion(int generation, uint8_t* rangeStart, uint8_t* rangeEnd, uint8_t* rangeEndReserved) = 0; }; #endif // _GCINTERFACE_EE_H_ diff --git a/src/coreclr/gc/gcinterface.h b/src/coreclr/gc/gcinterface.h index 920c321da8ebec..03c56d49dbb531 100644 --- a/src/coreclr/gc/gcinterface.h +++ b/src/coreclr/gc/gcinterface.h @@ -6,7 +6,7 @@ // The major version of the GC/EE interface. Breaking changes to this interface // require bumps in the major version number. -#define GC_INTERFACE_MAJOR_VERSION 4 +#define GC_INTERFACE_MAJOR_VERSION 5 // The minor version of the GC/EE interface. Non-breaking changes are required // to bump the minor version number. GCs and EEs with minor version number @@ -921,8 +921,13 @@ class IGCHeap { // Enables or disables the given keyword or level on the private event provider. virtual void ControlPrivateEvents(GCEventKeyword keyword, GCEventLevel level) = 0; + virtual unsigned int GetGenerationWithRange(Object* object, uint8_t** ppStart, uint8_t** ppAllocated, uint8_t** ppReserved) = 0; + IGCHeap() {} virtual ~IGCHeap() {} + + // Get the total paused duration + virtual int64_t GetTotalPauseDuration() = 0; }; #ifdef WRITE_BARRIER_CHECK diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h index cda8e68e0a08f8..a04e24c112a48c 100644 --- a/src/coreclr/gc/gcpriv.h +++ b/src/coreclr/gc/gcpriv.h @@ -3187,6 +3187,8 @@ class gc_heap PER_HEAP_ISOLATED size_t get_total_gen_estimated_reclaim (int gen_number); PER_HEAP_ISOLATED + size_t get_total_gen_size (int gen_number); + PER_HEAP_ISOLATED void get_memory_info (uint32_t* memory_load, uint64_t* available_physical=NULL, uint64_t* available_page_file=NULL); @@ -4494,6 +4496,8 @@ class gc_heap PER_HEAP size_t gen2_removed_no_undo; +#define INVALID_SAVED_PINNED_PLUG_INDEX ((size_t)~0) + PER_HEAP size_t saved_pinned_plug_index; #endif //DOUBLY_LINKED_FL @@ -4663,6 +4667,9 @@ class gc_heap PER_HEAP_ISOLATED int generation_skip_ratio_threshold; + PER_HEAP_ISOLATED + int conserve_mem_setting; + PER_HEAP BOOL gen0_bricks_cleared; PER_HEAP @@ -4962,6 +4969,9 @@ class gc_heap PER_HEAP_ISOLATED size_t exponential_smoothing (int gen, size_t collection_count, size_t desired_per_heap); + PER_HEAP_ISOLATED + BOOL dt_high_memory_load_p(); + protected: PER_HEAP void update_collection_counts (); diff --git a/src/coreclr/gc/sample/gcenv.ee.cpp b/src/coreclr/gc/sample/gcenv.ee.cpp index 060a5556e21715..84274f2341c3e4 100644 --- a/src/coreclr/gc/sample/gcenv.ee.cpp +++ b/src/coreclr/gc/sample/gcenv.ee.cpp @@ -354,3 +354,7 @@ uint32_t GCToEEInterface::GetCurrentProcessCpuCount() { return GCToOSInterface::GetTotalProcessorCount(); } + +void GCToEEInterface::DiagAddNewRegion(int generation, uint8_t* rangeStart, uint8_t* rangeEnd, uint8_t* rangeEndReserved) +{ +} diff --git a/src/coreclr/gc/unix/gcenv.unix.cpp b/src/coreclr/gc/unix/gcenv.unix.cpp index 2a37c17f8c9f81..0cce732ebc4725 100644 --- a/src/coreclr/gc/unix/gcenv.unix.cpp +++ b/src/coreclr/gc/unix/gcenv.unix.cpp @@ -67,7 +67,6 @@ #include #include -#if defined(HOST_ARM64) #include #include extern "C" @@ -84,7 +83,6 @@ extern "C" abort(); \ } \ } while (false) -#endif // defined(HOST_ARM64) #endif // __APPLE__ @@ -372,7 +370,7 @@ bool GCToOSInterface::Initialize() { s_flushUsingMemBarrier = TRUE; } -#if !(defined(TARGET_OSX) && defined(HOST_ARM64)) +#ifndef TARGET_OSX else { assert(g_helperPage == 0); @@ -404,7 +402,7 @@ bool GCToOSInterface::Initialize() return false; } } -#endif // !(defined(TARGET_OSX) && defined(HOST_ARM64)) +#endif // !TARGET_OSX InitializeCGroup(); @@ -544,7 +542,7 @@ void GCToOSInterface::FlushProcessWriteBuffers() status = pthread_mutex_unlock(&g_flushProcessWriteBuffersMutex); assert(status == 0 && "Failed to unlock the flushProcessWriteBuffersMutex lock"); } -#if defined(TARGET_OSX) && defined(HOST_ARM64) +#ifdef TARGET_OSX else { mach_msg_type_number_t cThreads; @@ -570,19 +568,13 @@ void GCToOSInterface::FlushProcessWriteBuffers() machret = vm_deallocate(mach_task_self(), (vm_address_t)pThreads, cThreads * sizeof(thread_act_t)); CHECK_MACH("vm_deallocate()", machret); } -#endif // defined(TARGET_OSX) && defined(HOST_ARM64) +#endif // TARGET_OSX } // Break into a debugger. Uses a compiler intrinsic if one is available, // otherwise raises a SIGTRAP. void GCToOSInterface::DebugBreak() { - // __has_builtin is only defined by clang. GCC doesn't have a debug - // trap intrinsic anyway. -#ifndef __has_builtin - #define __has_builtin(x) 0 -#endif // __has_builtin - #if __has_builtin(__builtin_debugtrap) __builtin_debugtrap(); #else diff --git a/src/coreclr/ilasm/writer.cpp b/src/coreclr/ilasm/writer.cpp index c7bc6d56d43674..7b5dd8a74f9eea 100644 --- a/src/coreclr/ilasm/writer.cpp +++ b/src/coreclr/ilasm/writer.cpp @@ -212,26 +212,28 @@ HRESULT Assembler::CreateDebugDirectory() param.debugDirData = NULL; // get module ID - DWORD rsds = 0x53445352; - DWORD pdbAge = 0x1; + DWORD rsds = VAL32(0x53445352); + DWORD pdbAge = VAL32(0x1); + GUID pdbGuid = *m_pPortablePdbWriter->GetGuid(); + SwapGuid(&pdbGuid); DWORD len = sizeof(rsds) + sizeof(GUID) + sizeof(pdbAge) + (DWORD)strlen(m_szPdbFileName) + 1; BYTE* dbgDirData = new BYTE[len]; DWORD offset = 0; memcpy_s(dbgDirData + offset, len, &rsds, sizeof(rsds)); // RSDS offset += sizeof(rsds); - memcpy_s(dbgDirData + offset, len, m_pPortablePdbWriter->GetGuid(), sizeof(GUID)); // PDB GUID + memcpy_s(dbgDirData + offset, len, &pdbGuid, sizeof(GUID)); // PDB GUID offset += sizeof(GUID); memcpy_s(dbgDirData + offset, len, &pdbAge, sizeof(pdbAge)); // PDB AGE offset += sizeof(pdbAge); memcpy_s(dbgDirData + offset, len, m_szPdbFileName, strlen(m_szPdbFileName) + 1); // PDB PATH debugDirIDD.Characteristics = 0; - debugDirIDD.TimeDateStamp = m_pPortablePdbWriter->GetTimestamp(); - debugDirIDD.MajorVersion = 0x100; - debugDirIDD.MinorVersion = 0x504d; - debugDirIDD.Type = IMAGE_DEBUG_TYPE_CODEVIEW; - debugDirIDD.SizeOfData = len; + debugDirIDD.TimeDateStamp = VAL32(m_pPortablePdbWriter->GetTimestamp()); + debugDirIDD.MajorVersion = VAL16(0x100); + debugDirIDD.MinorVersion = VAL16(0x504d); + debugDirIDD.Type = VAL32(IMAGE_DEBUG_TYPE_CODEVIEW); + debugDirIDD.SizeOfData = VAL32(len); debugDirIDD.AddressOfRawData = 0; // will be updated bellow debugDirIDD.PointerToRawData = 0; // will be updated bellow diff --git a/src/coreclr/inc/CrstTypes.def b/src/coreclr/inc/CrstTypes.def index c7266df7dbb012..d6fb713a98a1ec 100644 --- a/src/coreclr/inc/CrstTypes.def +++ b/src/coreclr/inc/CrstTypes.def @@ -381,6 +381,7 @@ End // between the thread executing DetachProfiler(), and the DetachThread // carrying out the evacuation order. Crst ProfilingAPIStatus + AcquiredBefore ThreadStore End Crst RCWCache @@ -496,9 +497,8 @@ End Crst ThreadStore AcquiredBefore AvailableParamTypes DeadlockDetection DebuggerController DebuggerHeapLock DebuggerJitInfo DynamicIL ExecuteManRangeLock HandleTable IbcProfile - JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilingAPIStatus - ProfilerGCRefDataFreeList SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList - ThreadIdDispenser DebuggerMutex + JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilerGCRefDataFreeList + SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList ThreadIdDispenser DebuggerMutex End Crst TypeIDMap diff --git a/src/coreclr/inc/clrconfigvalues.h b/src/coreclr/inc/clrconfigvalues.h index f8ffae0672e8a6..69b0dd758b7515 100644 --- a/src/coreclr/inc/clrconfigvalues.h +++ b/src/coreclr/inc/clrconfigvalues.h @@ -513,6 +513,7 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_DetachMinSleepMs, W("ProfAPI_DetachMin RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_DetachMaxSleepMs, W("ProfAPI_DetachMaxSleepMs"), 0, "The maximum time, in milliseconds, the CLR will wait before checking whether a profiler that is in the process of detaching is ready to be unloaded.") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_RejitOnAttach, W("ProfApi_RejitOnAttach"), 1, "Enables the ability for profilers to rejit methods on attach.") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_InliningTracking, W("ProfApi_InliningTracking"), 1, "Enables the runtime's tracking of inlining for profiler ReJIT.") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DebuggerLaunchDisablesCodeVersioning, W("EXTERNAL_DebuggerLaunchDisablesCodeVersioning"), 1, "Attaching a debugger at startup will disable TieredCompilation and RejitOnAttach.") CONFIG_DWORD_INFO(INTERNAL_ProfAPI_EnableRejitDiagnostics, W("ProfAPI_EnableRejitDiagnostics"), 0, "Enable extra dumping to stdout of rejit structures") CONFIG_DWORD_INFO(INTERNAL_ProfAPIFault, W("ProfAPIFault"), 0, "Test-only bitmask to inject various types of faults in the profapi code") CONFIG_DWORD_INFO(INTERNAL_TestOnlyAllowedEventMask, W("TestOnlyAllowedEventMask"), 0, "Test-only bitmask to allow profiler tests to override CLR enforcement of COR_PRF_ALLOWABLE_AFTER_ATTACH and COR_PRF_MONITOR_IMMUTABLE") @@ -525,7 +526,7 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_ProfAPI_ValidateNGENInstrumentation, W("Pro #ifdef FEATURE_PERFMAP RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapEnabled, W("PerfMapEnabled"), 0, "This flag is used on Linux to enable writing /tmp/perf-$pid.map. It is disabled by default") -RETAIL_CONFIG_STRING_INFO(EXTERNAL_PerfMapJitDumpPath, W("PerfMapJitDumpPath"), "Specifies a path to write the perf jitdump file. Defaults to GetTempPathA()") +RETAIL_CONFIG_STRING_INFO(EXTERNAL_PerfMapJitDumpPath, W("PerfMapJitDumpPath"), "Specifies a path to write the perf jitdump file. Defaults to /tmp") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapIgnoreSignal, W("PerfMapIgnoreSignal"), 0, "When perf map is enabled, this option will configure the specified signal to be accepted and ignored as a marker in the perf logs. It is disabled by default") RETAIL_CONFIG_DWORD_INFO(EXTERNAL_PerfMapShowOptimizationTiers, W("PerfMapShowOptimizationTiers"), 1, "Shows optimization tiers in the perf map for methods, as part of the symbol name. Useful for seeing separate stack frames for different optimization tiers of each method.") RETAIL_CONFIG_STRING_INFO(EXTERNAL_NativeImagePerfMapFormat, W("NativeImagePerfMapFormat"), "Specifies the format of native image perfmap files generated by crossgen. Valid options are RVA or OFFSET.") @@ -576,6 +577,8 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_UnfairSemaphoreSpinLimit, W("Thread #else // !TARGET_ARM64 RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_UnfairSemaphoreSpinLimit, W("ThreadPool_UnfairSemaphoreSpinLimit"), 0x46, "Maximum number of spins a thread pool worker thread performs before waiting for work") #endif // TARGET_ARM64 +RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_ThreadPool_ThreadTimeoutMs, W("ThreadPool_ThreadTimeoutMs"), (DWORD)-2, "The amount of time in milliseconds a thread pool thread waits without having done any work before timing out and exiting. Set to -1 to disable the timeout. Applies to worker threads, completion port threads, and wait threads. Also see the ThreadPool_ThreadsToKeepAlive config value for relevant information.", CLRConfig::LookupOptions::ParseIntegerAsBase10) +RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_ThreadPool_ThreadsToKeepAlive, W("ThreadPool_ThreadsToKeepAlive"), 0, "The number of worker or completion port threads to keep alive after they are created. Set to -1 to keep all created worker or completion port threads alive. When the ThreadPool_ThreadTimeoutMs config value is also set, for worker and completion port threads the timeout applies to threads in the respective pool that are in excess of the number configured for ThreadPool_ThreadsToKeepAlive.", CLRConfig::LookupOptions::ParseIntegerAsBase10) RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_Disable, W("HillClimbing_Disable"), 0, "Disables hill climbing for thread adjustments in the thread pool"); RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_WavePeriod, W("HillClimbing_WavePeriod"), 4, ""); diff --git a/src/coreclr/inc/cordebug.idl b/src/coreclr/inc/cordebug.idl index 66862c7c2b8b1c..c52ae26781dc90 100644 --- a/src/coreclr/inc/cordebug.idl +++ b/src/coreclr/inc/cordebug.idl @@ -135,6 +135,7 @@ interface ICorDebugThread; interface ICorDebugThread2; interface ICorDebugThread3; interface ICorDebugThread4; +interface ICorDebugThread5; interface ICorDebugStackWalk; interface ICorDebugChain; interface ICorDebugFrame; @@ -4376,6 +4377,26 @@ interface ICorDebugThread4 : IUnknown HRESULT GetCurrentCustomDebuggerNotification([out] ICorDebugValue ** ppNotificationObject); }; +/* + * ICorDebugThread5 is a logical extension to ICorDebugThread. + */ +[ + object, + local, + uuid(F98421C4-E506-4D24-916F-0237EE853EC6), + pointer_default(unique) +] +interface ICorDebugThread5 : IUnknown +{ + /* + * Returns S_OK if it was possible to obtain the allocation information for the thread + * and sets the corresponding SOH and UOH allocations. + * Returns E_INVALIDARG if any of the pointers for the outputs is null. + * Can return E_FAIL if the process is not properly stopped. + */ + HRESULT GetBytesAllocated([out] ULONG64 *pSohAllocatedBytes, [out] ULONG64 *pUohAllocatedBytes); +}; + /* * The new V3.0 stackwalking API. */ diff --git a/src/coreclr/inc/corhlpr.h b/src/coreclr/inc/corhlpr.h index 450514da95c180..427e8cdc0ff5c5 100644 --- a/src/coreclr/inc/corhlpr.h +++ b/src/coreclr/inc/corhlpr.h @@ -336,7 +336,7 @@ struct COR_ILMETHOD_SECT const COR_ILMETHOD_SECT* Next() const { if (!More()) return(0); - return ((COR_ILMETHOD_SECT*)(((BYTE *)this) + DataSize()))->Align(); + return ((COR_ILMETHOD_SECT*)Align(((BYTE *)this) + DataSize())); } const BYTE* Data() const @@ -374,9 +374,9 @@ struct COR_ILMETHOD_SECT return((AsSmall()->Kind & CorILMethod_Sect_FatFormat) != 0); } - const COR_ILMETHOD_SECT* Align() const + static const void* Align(const void* p) { - return((COR_ILMETHOD_SECT*) ((((UINT_PTR) this) + 3) & ~3)); + return((void*) ((((UINT_PTR) p) + 3) & ~3)); } protected: @@ -579,7 +579,7 @@ typedef struct tagCOR_ILMETHOD_FAT : IMAGE_COR_ILMETHOD_FAT const COR_ILMETHOD_SECT* GetSect() const { if (!More()) return (0); - return(((COR_ILMETHOD_SECT*) (GetCode() + GetCodeSize()))->Align()); + return(((COR_ILMETHOD_SECT*) COR_ILMETHOD_SECT::Align(GetCode() + GetCodeSize()))); } } COR_ILMETHOD_FAT; diff --git a/src/coreclr/inc/corjit.h b/src/coreclr/inc/corjit.h index d4a22f2ee3e4de..d679c99ce90270 100644 --- a/src/coreclr/inc/corjit.h +++ b/src/coreclr/inc/corjit.h @@ -484,6 +484,12 @@ class ICorJitInfo : public ICorDynamicInfo uint32_t sizeInBytes /* IN: The size of the buffer. Note that this is effectively a version number for the CORJIT_FLAGS value. */ ) = 0; + + // Checks if a field belongs to a given class. + virtual bool doesFieldBelongToClass( + CORINFO_FIELD_HANDLE fldHnd, /* IN: the field that we are checking */ + CORINFO_CLASS_HANDLE cls /* IN: the class that we are checking */ + ) = 0; }; /**********************************************************************************/ diff --git a/src/coreclr/inc/crsttypes.h b/src/coreclr/inc/crsttypes.h index 7be482c48bb551..23070d7820d61d 100644 --- a/src/coreclr/inc/crsttypes.h +++ b/src/coreclr/inc/crsttypes.h @@ -1,6 +1,7 @@ // // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. // #ifndef __CRST_TYPES_INCLUDED @@ -10,7 +11,7 @@ // This file describes the range of Crst types available and their mapping to a numeric level (used by the // runtime in debug mode to validate we're deadlock free). To modify these settings edit the -// file:CrstTypes.def file and run the clr\artifacts\CrstTypeTool utility to generate a new version of this file. +// file:CrstTypes.def file and run the clr\bin\CrstTypeTool utility to generate a new version of this file. // Each Crst type is declared as a value in the following CrstType enum. enum CrstType @@ -230,7 +231,7 @@ int g_rgCrstLevelMap[] = 4, // CrstPgoData 0, // CrstPinnedByrefValidation 0, // CrstProfilerGCRefDataFreeList - 0, // CrstProfilingAPIStatus + 13, // CrstProfilingAPIStatus 4, // CrstRCWCache 0, // CrstRCWCleanupList 10, // CrstReadyToRunEntryPointToMethodDescMap diff --git a/src/coreclr/inc/daccess.h b/src/coreclr/inc/daccess.h index 71c5d2f376025a..fb99c0c1fb6430 100644 --- a/src/coreclr/inc/daccess.h +++ b/src/coreclr/inc/daccess.h @@ -1469,10 +1469,10 @@ class __Str16Ptr : public __DPtr } void EnumMem(void) const { - char* str = DacInstantiateStringW(m_addr, maxChars, false); + WCHAR* str = DacInstantiateStringW(m_addr, maxChars, false); if (str) { - DacEnumMemoryRegion(m_addr, strlen(str) + 1); + DacEnumMemoryRegion(m_addr, wcslen(str) + 1); } } }; diff --git a/src/coreclr/inc/dacvars.h b/src/coreclr/inc/dacvars.h index e27c122b5645a2..21fa7ad6db61c8 100644 --- a/src/coreclr/inc/dacvars.h +++ b/src/coreclr/inc/dacvars.h @@ -252,5 +252,7 @@ DEFINE_DACVAR(ULONG, SIZE_T, dac__g_clrNotificationArguments, ::g_clrNotificatio DEFINE_DACVAR(ULONG, bool, dac__g_metadataUpdatesApplied, ::g_metadataUpdatesApplied) #endif +DEFINE_DACVAR(ULONG, PTR_WSTR, dac__g_EntryAssemblyPath, ::g_EntryAssemblyPath) + #undef DEFINE_DACVAR #undef DEFINE_DACVAR_NO_DUMP diff --git a/src/coreclr/inc/icorjitinfoimpl_generated.h b/src/coreclr/inc/icorjitinfoimpl_generated.h index b3b77ece974a87..1c470cf1fdd51d 100644 --- a/src/coreclr/inc/icorjitinfoimpl_generated.h +++ b/src/coreclr/inc/icorjitinfoimpl_generated.h @@ -710,6 +710,10 @@ uint32_t getJitFlags( CORJIT_FLAGS* flags, uint32_t sizeInBytes) override; +bool doesFieldBelongToClass( + CORINFO_FIELD_HANDLE fldHnd, + CORINFO_CLASS_HANDLE cls) override; + /**********************************************************************************/ // clang-format on /**********************************************************************************/ diff --git a/src/coreclr/inc/jiteeversionguid.h b/src/coreclr/inc/jiteeversionguid.h index f2d6921bc76cd7..f78582151fc69a 100644 --- a/src/coreclr/inc/jiteeversionguid.h +++ b/src/coreclr/inc/jiteeversionguid.h @@ -43,12 +43,12 @@ typedef const GUID *LPCGUID; #define GUID_DEFINED #endif // !GUID_DEFINED -constexpr GUID JITEEVersionIdentifier = { /* c2e4a466-795d-4e64-a776-0ae7b2eed65b */ - 0xc2e4a466, - 0x795d, - 0x4e64, - {0xa7, 0x76, 0x0a, 0xe7, 0xb2, 0xee, 0xd6, 0x5b} - }; +constexpr GUID JITEEVersionIdentifier = { /* 5ed35c58-857b-48dd-a818-7c0136dc9f73 */ + 0x5ed35c58, + 0x857b, + 0x48dd, + {0xa8, 0x18, 0x7c, 0x01, 0x36, 0xdc, 0x9f, 0x73} +}; ////////////////////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/src/coreclr/inc/longfilepathwrappers.h b/src/coreclr/inc/longfilepathwrappers.h index 149cdcf4443acd..e62f1ae6be3c71 100644 --- a/src/coreclr/inc/longfilepathwrappers.h +++ b/src/coreclr/inc/longfilepathwrappers.h @@ -87,10 +87,6 @@ UINT WINAPI GetTempFileNameWrapper( SString& lpTempFileName ); -DWORD WINAPI GetTempPathWrapper( - SString& lpBuffer - ); - DWORD WINAPI GetCurrentDirectoryWrapper( SString& lpBuffer ); diff --git a/src/coreclr/inc/profilepriv.h b/src/coreclr/inc/profilepriv.h index 4a77b65e8b24df..4bd3801644002b 100644 --- a/src/coreclr/inc/profilepriv.h +++ b/src/coreclr/inc/profilepriv.h @@ -109,16 +109,10 @@ class ProfilerInfo EventMask eventMask; - //--------------------------------------------------------------- - // dwProfilerEvacuationCounter keeps track of how many profiler - // callback calls remain on the stack - //--------------------------------------------------------------- - // Why volatile? - // See code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization. - Volatile dwProfilerEvacuationCounter; - Volatile inUse; + DWORD slot; + // Reset those variables that is only for the current attach session void ResetPerSessionStatus(); void Init(); @@ -150,19 +144,11 @@ class EvacuationCounterHolder { private: ProfilerInfo *m_pProfilerInfo; + Thread *m_pThread; public: - EvacuationCounterHolder(ProfilerInfo *pProfilerInfo) : - m_pProfilerInfo(pProfilerInfo) - { - _ASSERTE(m_pProfilerInfo != NULL); - InterlockedIncrement((LONG *)(m_pProfilerInfo->dwProfilerEvacuationCounter.GetPointer())); - } - - ~EvacuationCounterHolder() - { - InterlockedDecrement((LONG *)(m_pProfilerInfo->dwProfilerEvacuationCounter.GetPointer())); - } + EvacuationCounterHolder(ProfilerInfo *pProfilerInfo); + ~EvacuationCounterHolder(); }; struct StoredProfilerNode @@ -289,23 +275,26 @@ class ProfControlBlock BOOL IsMainProfiler(ProfToEEInterfaceImpl *pProfToEE); ProfilerInfo *GetProfilerInfo(ProfToEEInterfaceImpl *pProfToEE); - template - FORCEINLINE HRESULT DoProfilerCallback(ProfilerCallbackType callbackType, ConditionFunc condition, Data *additionalData, CallbackFunc callback, Args... args) + template + static void DoProfilerCallbackHelper(ProfilerInfo *pProfilerInfo, ConditionFunc condition, CallbackFunc callback, HRESULT *pHR, Args... args) + { + if (condition(pProfilerInfo)) + { + HRESULT innerHR = callback(pProfilerInfo->pProfInterface, args...); + if (FAILED(innerHR)) + { + *pHR = innerHR; + } + } + } + + template + FORCEINLINE HRESULT DoProfilerCallback(ProfilerCallbackType callbackType, ConditionFunc condition, CallbackFunc callback, Args... args) { HRESULT hr = S_OK; IterateProfilers(callbackType, - [](ProfilerInfo *pProfilerInfo, ConditionFunc condition, Data *additionalData, CallbackFunc callback, HRESULT *pHR, Args... args) - { - if (condition(pProfilerInfo)) - { - HRESULT innerHR = callback(additionalData, pProfilerInfo->pProfInterface, args...); - if (FAILED(innerHR)) - { - *pHR = innerHR; - } - } - }, - condition, additionalData, callback, &hr, args...); + &DoProfilerCallbackHelper, + condition, callback, &hr, args...); return hr; } @@ -317,7 +306,6 @@ class ProfControlBlock BOOL IsCallback3Supported(); BOOL IsCallback5Supported(); - BOOL IsDisableTransparencySet(); BOOL RequiresGenericsContextForEnterLeave(); UINT_PTR EEFunctionIDMapper(FunctionID funcId, BOOL * pbHookFunction); diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index cee2dfb36b273d..cd8d7f26b3b774 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -84,23 +84,24 @@ inline void ProfilerInfo::ResetPerSessionStatus() inline void ProfilerInfo::Init() { curProfStatus.Init(); - dwProfilerEvacuationCounter = 0; ResetPerSessionStatus(); inUse = FALSE; } +inline HRESULT AnyProfilerPassesConditionHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAnyPassed) +{ + *pAnyPassed = TRUE; + return S_OK; +} + template -inline BOOL AnyProfilerPassesCondition(ConditionFunc condition) +FORCEINLINE BOOL AnyProfilerPassesCondition(ConditionFunc condition) { BOOL anyPassed = FALSE; (&g_profControlBlock)->DoProfilerCallback(ProfilerCallbackType::ActiveOrInitializing, - condition, - &anyPassed, - [](BOOL *pAnyPassed, VolatilePtr profInterface) - { - *pAnyPassed = TRUE; - return S_OK; - }); + condition, + &AnyProfilerPassesConditionHelper, + &anyPassed); return anyPassed; } @@ -120,10 +121,13 @@ inline void ProfControlBlock::Init() CONTRACTL_END; mainProfilerInfo.Init(); + // Special magic value for the main one + mainProfilerInfo.slot = MAX_NOTIFICATION_PROFILERS; for (SIZE_T i = 0; i < MAX_NOTIFICATION_PROFILERS; ++i) { notificationOnlyProfilers[i].Init(); + notificationOnlyProfilers[i].slot = (DWORD)i; } globalEventMask.SetEventMask(COR_PRF_MONITOR_NONE); @@ -165,17 +169,19 @@ inline BOOL ProfControlBlock::IsMainProfiler(ProfToEEInterfaceImpl *pProfToEE) return pProfInterface != NULL && pProfInterface->m_pProfToEE == pProfToEE; } +inline void GetProfilerInfoHelper(ProfilerInfo *pProfilerInfo, ProfToEEInterfaceImpl *pProfToEE, ProfilerInfo **ppFoundProfilerInfo) +{ + if (pProfilerInfo->pProfInterface->GetProfToEE() == pProfToEE) + { + *ppFoundProfilerInfo = pProfilerInfo; + } +} + inline ProfilerInfo *ProfControlBlock::GetProfilerInfo(ProfToEEInterfaceImpl *pProfToEE) { ProfilerInfo *pProfilerInfo = NULL; IterateProfilers(ProfilerCallbackType::ActiveOrInitializing, - [](ProfilerInfo *pProfilerInfo, ProfToEEInterfaceImpl *pProfToEE, ProfilerInfo **ppFoundProfilerInfo) - { - if (pProfilerInfo->pProfInterface->m_pProfToEE == pProfToEE) - { - *ppFoundProfilerInfo = pProfilerInfo; - } - }, + &GetProfilerInfoHelper, pProfToEE, &pProfilerInfo); @@ -203,6 +209,16 @@ inline void ProfControlBlock::DeRegisterProfilerInfo(ProfilerInfo *pProfilerInfo InterlockedDecrement(notificationProfilerCount.GetPointer()); } +inline void UpdateGlobalEventMaskHelper(ProfilerInfo *pProfilerInfo, DWORD *pEventMask) +{ + *pEventMask |= pProfilerInfo->eventMask.GetEventMask(); +} + +inline void UpdateGlobalEventMaskHighHelper(ProfilerInfo *pProfilerInfo, DWORD *pEventMaskHigh) +{ + *pEventMaskHigh |= pProfilerInfo->eventMask.GetEventMaskHigh(); +} + inline void ProfControlBlock::UpdateGlobalEventMask() { while (true) @@ -227,53 +243,57 @@ inline void ProfControlBlock::UpdateGlobalEventMask() } #endif // DACCESS_COMPILE -inline BOOL ProfControlBlock::IsCallback3Supported() +inline BOOL IsCallback3SupportedHelper(ProfilerInfo *pProfilerInfo) { - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->pProfInterface->IsCallback3Supported(); }); + return pProfilerInfo->pProfInterface->IsCallback3Supported(); } -inline BOOL ProfControlBlock::IsCallback5Supported() +FORCEINLINE BOOL ProfControlBlock::IsCallback3Supported() { - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->pProfInterface->IsCallback5Supported(); }); + return AnyProfilerPassesCondition(&IsCallback3SupportedHelper); } -inline BOOL ProfControlBlock::IsDisableTransparencySet() +inline BOOL IsCallback5SupportedHelper(ProfilerInfo *pProfilerInfo) { - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_DISABLE_TRANSPARENCY_CHECKS_UNDER_FULL_TRUST); }); + return pProfilerInfo->pProfInterface->IsCallback5Supported(); } -inline BOOL ProfControlBlock::RequiresGenericsContextForEnterLeave() +FORCEINLINE BOOL ProfControlBlock::IsCallback5Supported() { - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->pProfInterface->RequiresGenericsContextForEnterLeave(); }); + return AnyProfilerPassesCondition(&IsCallback5SupportedHelper); } -inline bool DoesProfilerWantEEFunctionIDMapper(ProfilerInfo *pProfilerInfo) +inline BOOL RequiresGenericsContextForEnterLeaveHelper(ProfilerInfo *pProfilerInfo) { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + return pProfilerInfo->pProfInterface->RequiresGenericsContextForEnterLeave(); +} +FORCEINLINE BOOL ProfControlBlock::RequiresGenericsContextForEnterLeave() +{ + return AnyProfilerPassesCondition(&RequiresGenericsContextForEnterLeaveHelper); +} + +inline bool DoesProfilerWantEEFunctionIDMapper(ProfilerInfo *pProfilerInfo) +{ return ((pProfilerInfo->pProfInterface->GetFunctionIDMapper() != NULL) || (pProfilerInfo->pProfInterface->GetFunctionIDMapper2() != NULL)); } +inline void EEFunctionIDMapperHelper(ProfilerInfo *pProfilerInfo, FunctionID funcId, BOOL *pbHookFunction, UINT_PTR *pPtr) +{ + if (DoesProfilerWantEEFunctionIDMapper(pProfilerInfo)) + { + *pPtr = pProfilerInfo->pProfInterface->EEFunctionIDMapper(funcId, pbHookFunction); + } +} + inline UINT_PTR ProfControlBlock::EEFunctionIDMapper(FunctionID funcId, BOOL *pbHookFunction) { LIMITED_METHOD_CONTRACT; UINT_PTR ptr = NULL; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, FunctionID funcId, BOOL *pbHookFunction, UINT_PTR *pPtr) - { - if (DoesProfilerWantEEFunctionIDMapper(pProfilerInfo)) - { - *pPtr = pProfilerInfo->pProfInterface->EEFunctionIDMapper(funcId, pbHookFunction); - } - }, + &EEFunctionIDMapperHelper, funcId, pbHookFunction, &ptr); return ptr; @@ -292,18 +312,24 @@ inline BOOL IsProfilerTrackingThreads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_THREADS); } +inline HRESULT ThreadCreatedHelper(EEToProfInterfaceImpl *profInterface, ThreadID threadID) +{ + return profInterface->ThreadCreated(threadID); +} + inline void ProfControlBlock::ThreadCreated(ThreadID threadID) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID threadID) - { - return profInterface->ThreadCreated(threadID); - }, - threadID); + &ThreadCreatedHelper, + threadID); +} + +inline HRESULT ThreadDestroyedHelper(EEToProfInterfaceImpl *profInterface, ThreadID threadID) +{ + return profInterface->ThreadDestroyed(threadID); } inline void ProfControlBlock::ThreadDestroyed(ThreadID threadID) @@ -312,12 +338,13 @@ inline void ProfControlBlock::ThreadDestroyed(ThreadID threadID) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID threadID) - { - return profInterface->ThreadDestroyed(threadID); - }, - threadID); + &ThreadDestroyedHelper, + threadID); +} + +inline HRESULT ThreadAssignedToOSThreadHelper(EEToProfInterfaceImpl *profInterface, ThreadID managedThreadId, DWORD osThreadId) +{ + return profInterface->ThreadAssignedToOSThread(managedThreadId, osThreadId); } inline void ProfControlBlock::ThreadAssignedToOSThread(ThreadID managedThreadId, DWORD osThreadId) @@ -326,12 +353,13 @@ inline void ProfControlBlock::ThreadAssignedToOSThread(ThreadID managedThreadId, DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID managedThreadId, DWORD osThreadId) - { - return profInterface->ThreadAssignedToOSThread(managedThreadId, osThreadId); - }, - managedThreadId, osThreadId); + &ThreadAssignedToOSThreadHelper, + managedThreadId, osThreadId); +} + +inline HRESULT ThreadNameChangedHelper(EEToProfInterfaceImpl *profInterface, ThreadID managedThreadId, ULONG cchName, WCHAR name[]) +{ + return profInterface->ThreadNameChanged(managedThreadId, cchName, name); } inline void ProfControlBlock::ThreadNameChanged(ThreadID managedThreadId, ULONG cchName, WCHAR name[]) @@ -340,12 +368,13 @@ inline void ProfControlBlock::ThreadNameChanged(ThreadID managedThreadId, ULONG DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingThreads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID managedThreadId, ULONG cchName, WCHAR name[]) - { - return profInterface->ThreadNameChanged(managedThreadId, cchName, name); - }, - managedThreadId, cchName, name); + &ThreadNameChangedHelper, + managedThreadId, cchName, name); +} + +inline HRESULT ShutdownHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->Shutdown(); } inline void ProfControlBlock::Shutdown() @@ -354,11 +383,7 @@ inline void ProfControlBlock::Shutdown() DoProfilerCallback(ProfilerCallbackType::Active, [](ProfilerInfo *pProfilerInfo) { return true; }, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->Shutdown(); - }); + &ShutdownHelper); } inline BOOL IsProfilerTrackingJITInfo(ProfilerInfo *pProfilerInfo) @@ -374,18 +399,24 @@ inline BOOL IsProfilerTrackingJITInfo(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION); } +inline HRESULT JITCompilationFinishedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) +{ + return profInterface->JITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); +} + inline void ProfControlBlock::JITCompilationFinished(FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) - { - return profInterface->JITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); - }, - functionId, hrStatus, fIsSafeToBlock); + &JITCompilationFinishedHelper, + functionId, hrStatus, fIsSafeToBlock); +} + +inline HRESULT JITCompilationStartedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL fIsSafeToBlock) +{ + return profInterface->JITCompilationStarted(functionId, fIsSafeToBlock); } inline void ProfControlBlock::JITCompilationStarted(FunctionID functionId, BOOL fIsSafeToBlock) @@ -394,12 +425,13 @@ inline void ProfControlBlock::JITCompilationStarted(FunctionID functionId, BOOL DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, BOOL fIsSafeToBlock) - { - return profInterface->JITCompilationStarted(functionId, fIsSafeToBlock); - }, - functionId, fIsSafeToBlock); + &JITCompilationStartedHelper, + functionId, fIsSafeToBlock); +} + +inline HRESULT DynamicMethodJITCompilationStartedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) +{ + return profInterface->DynamicMethodJITCompilationStarted(functionId, fIsSafeToBlock, pILHeader, cbILHeader); } inline void ProfControlBlock::DynamicMethodJITCompilationStarted(FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) @@ -408,12 +440,13 @@ inline void ProfControlBlock::DynamicMethodJITCompilationStarted(FunctionID func DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, BOOL fIsSafeToBlock, LPCBYTE pILHeader, ULONG cbILHeader) - { - return profInterface->DynamicMethodJITCompilationStarted(functionId, fIsSafeToBlock, pILHeader, cbILHeader); - }, - functionId, fIsSafeToBlock, pILHeader, cbILHeader); + &DynamicMethodJITCompilationStartedHelper, + functionId, fIsSafeToBlock, pILHeader, cbILHeader); +} + +inline HRESULT DynamicMethodJITCompilationFinishedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) +{ + return profInterface->DynamicMethodJITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); } inline void ProfControlBlock::DynamicMethodJITCompilationFinished(FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) @@ -422,12 +455,8 @@ inline void ProfControlBlock::DynamicMethodJITCompilationFinished(FunctionID fun DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock) - { - return profInterface->DynamicMethodJITCompilationFinished(functionId, hrStatus, fIsSafeToBlock); - }, - functionId, hrStatus, fIsSafeToBlock); + &DynamicMethodJITCompilationFinishedHelper, + functionId, hrStatus, fIsSafeToBlock); } inline BOOL IsProfilerMonitoringDynamicFunctionUnloads(ProfilerInfo *pProfilerInfo) @@ -443,18 +472,19 @@ inline BOOL IsProfilerMonitoringDynamicFunctionUnloads(ProfilerInfo *pProfilerIn return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS); } +inline HRESULT DynamicMethodUnloadedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) +{ + return profInterface->DynamicMethodUnloaded(functionId); +} + inline void ProfControlBlock::DynamicMethodUnloaded(FunctionID functionId) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerMonitoringDynamicFunctionUnloads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->DynamicMethodUnloaded(functionId); - }, - functionId); + &DynamicMethodUnloadedHelper, + functionId); } inline BOOL IsProfilerTrackingCacheSearches(ProfilerInfo *pProfilerInfo) @@ -470,6 +500,14 @@ inline BOOL IsProfilerTrackingCacheSearches(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES); } +inline HRESULT JITCachedFunctionSearchStartedHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAllTrue, FunctionID functionId) +{ + BOOL fUseCachedFunction = TRUE; + HRESULT hr = profInterface->JITCachedFunctionSearchStarted(functionId, &fUseCachedFunction); + *pAllTrue = *pAllTrue && fUseCachedFunction; + return hr; +} + inline void ProfControlBlock::JITCachedFunctionSearchStarted(FunctionID functionId, BOOL *pbUseCachedFunction) { LIMITED_METHOD_CONTRACT; @@ -477,48 +515,46 @@ inline void ProfControlBlock::JITCachedFunctionSearchStarted(FunctionID function BOOL allTrue = TRUE; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCacheSearches, - &allTrue, - [](BOOL *pAllTrue, VolatilePtr profInterface, FunctionID functionId, BOOL *pbUseCachedFunction) - { - HRESULT hr = profInterface->JITCachedFunctionSearchStarted(functionId, pbUseCachedFunction); - *pAllTrue &= *pbUseCachedFunction; - return hr; - }, - functionId, pbUseCachedFunction); + &JITCachedFunctionSearchStartedHelper, + &allTrue, functionId); // If any reject it, consider it rejected. *pbUseCachedFunction = allTrue; } +inline HRESULT JITCachedFunctionSearchFinishedHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_JIT_CACHE result) +{ + return profInterface->JITCachedFunctionSearchFinished(functionId, result); +} + inline void ProfControlBlock::JITCachedFunctionSearchFinished(FunctionID functionId, COR_PRF_JIT_CACHE result) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCacheSearches, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_JIT_CACHE result) - { - return profInterface->JITCachedFunctionSearchFinished(functionId, result); - }, - functionId, result); + &JITCachedFunctionSearchFinishedHelper, + functionId, result); +} + +inline HRESULT JITInliningHelper(EEToProfInterfaceImpl *profInterface, BOOL *pAllTrue, FunctionID callerId, FunctionID calleeId) +{ + BOOL fShouldInline = TRUE; + HRESULT hr = profInterface->JITInlining(callerId, calleeId, &fShouldInline); + *pAllTrue = *pAllTrue && fShouldInline; + return hr; } inline HRESULT ProfControlBlock::JITInlining(FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) { LIMITED_METHOD_CONTRACT; + *pfShouldInline = TRUE; BOOL allTrue = TRUE; HRESULT hr = DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingJITInfo, - &allTrue, - [](BOOL *pAllTrue, VolatilePtr profInterface, FunctionID callerId, FunctionID calleeId, BOOL *pfShouldInline) - { - HRESULT hr = profInterface->JITInlining(callerId, calleeId, pfShouldInline); - *pAllTrue &= *pfShouldInline; - return hr; - }, - callerId, calleeId, pfShouldInline); + &JITInliningHelper, + &allTrue, callerId, calleeId); // If any reject it, consider it rejected. *pfShouldInline = allTrue; @@ -530,65 +566,73 @@ inline BOOL IsRejitEnabled(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_ENABLE_REJIT); } +inline void ReJITCompilationStartedHelper(ProfilerInfo *pProfilerInfo, FunctionID functionId, ReJITID reJitId, BOOL fIsSafeToBlock) +{ + if (IsRejitEnabled(pProfilerInfo)) + { + pProfilerInfo->pProfInterface->ReJITCompilationStarted(functionId, reJitId, fIsSafeToBlock); + } +} + inline void ProfControlBlock::ReJITCompilationStarted(FunctionID functionId, ReJITID reJitId, BOOL fIsSafeToBlock) { LIMITED_METHOD_CONTRACT; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, FunctionID functionId, ReJITID reJitId, BOOL fIsSafeToBlock) - { - if (IsRejitEnabled(pProfilerInfo)) - { - pProfilerInfo->pProfInterface->ReJITCompilationStarted(functionId, reJitId, fIsSafeToBlock); - } - }, + &ReJITCompilationStartedHelper, functionId, reJitId, fIsSafeToBlock); } +inline void GetReJITParametersHelper(ProfilerInfo *pProfilerInfo, ModuleID moduleId, mdMethodDef methodId, ICorProfilerFunctionControl *pFunctionControl, HRESULT *pHr) +{ + if (IsRejitEnabled(pProfilerInfo)) + { + *pHr = pProfilerInfo->pProfInterface->GetReJITParameters(moduleId, methodId, pFunctionControl); + } +} + inline HRESULT ProfControlBlock::GetReJITParameters(ModuleID moduleId, mdMethodDef methodId, ICorProfilerFunctionControl *pFunctionControl) { LIMITED_METHOD_CONTRACT; HRESULT hr = S_OK; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, ModuleID moduleId, mdMethodDef methodId, ICorProfilerFunctionControl *pFunctionControl, HRESULT *pHr) - { - if (IsRejitEnabled(pProfilerInfo)) - { - *pHr = pProfilerInfo->pProfInterface->GetReJITParameters(moduleId, methodId, pFunctionControl); - } - }, + &GetReJITParametersHelper, moduleId, methodId, pFunctionControl, &hr); return hr; } +inline void ReJITCompilationFinishedHelper(ProfilerInfo *pProfilerInfo, FunctionID functionId, ReJITID reJitId, HRESULT hrStatus, BOOL fIsSafeToBlock) +{ + if (IsRejitEnabled(pProfilerInfo)) + { + pProfilerInfo->pProfInterface->ReJITCompilationFinished(functionId, reJitId, hrStatus, fIsSafeToBlock); + } +} + inline void ProfControlBlock::ReJITCompilationFinished(FunctionID functionId, ReJITID reJitId, HRESULT hrStatus, BOOL fIsSafeToBlock) { LIMITED_METHOD_CONTRACT; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, FunctionID functionId, ReJITID reJitId, HRESULT hrStatus, BOOL fIsSafeToBlock) - { - if (IsRejitEnabled(pProfilerInfo)) - { - pProfilerInfo->pProfInterface->ReJITCompilationFinished(functionId, reJitId, hrStatus, fIsSafeToBlock); - } - }, + &ReJITCompilationFinishedHelper, functionId, reJitId, hrStatus, fIsSafeToBlock); } +inline void ReJITErrorHelper(ProfilerInfo *pProfilerInfo, ModuleID moduleId, mdMethodDef methodId, FunctionID functionId, HRESULT hrStatus) +{ + if (IsRejitEnabled(pProfilerInfo)) + { + pProfilerInfo->pProfInterface->ReJITError(moduleId, methodId, functionId, hrStatus); + } +} + inline void ProfControlBlock::ReJITError(ModuleID moduleId, mdMethodDef methodId, FunctionID functionId, HRESULT hrStatus) { LIMITED_METHOD_CONTRACT; DoOneProfilerIteration(&mainProfilerInfo, ProfilerCallbackType::Active, - [](ProfilerInfo *pProfilerInfo, ModuleID moduleId, mdMethodDef methodId, FunctionID functionId, HRESULT hrStatus) - { - if (IsRejitEnabled(pProfilerInfo)) - { - pProfilerInfo->pProfInterface->ReJITError(moduleId, methodId, functionId, hrStatus); - } - }, + &ReJITErrorHelper, moduleId, methodId, functionId, hrStatus); } @@ -605,18 +649,24 @@ inline BOOL IsProfilerTrackingModuleLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_MODULE_LOADS); } +inline HRESULT ModuleLoadStartedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId) +{ + return profInterface->ModuleLoadStarted(moduleId); +} + inline void ProfControlBlock::ModuleLoadStarted(ModuleID moduleId) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId) - { - return profInterface->ModuleLoadStarted(moduleId); - }, - moduleId); + &ModuleLoadStartedHelper, + moduleId); +} + +inline HRESULT ModuleLoadFinishedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId, HRESULT hrStatus) +{ + return profInterface->ModuleLoadFinished(moduleId, hrStatus); } inline void ProfControlBlock::ModuleLoadFinished(ModuleID moduleId, HRESULT hrStatus) @@ -625,12 +675,13 @@ inline void ProfControlBlock::ModuleLoadFinished(ModuleID moduleId, HRESULT hrSt DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId, HRESULT hrStatus) - { - return profInterface->ModuleLoadFinished(moduleId, hrStatus); - }, - moduleId, hrStatus); + &ModuleLoadFinishedHelper, + moduleId, hrStatus); +} + +inline HRESULT ModuleUnloadStartedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId) +{ + return profInterface->ModuleUnloadStarted(moduleId); } inline void ProfControlBlock::ModuleUnloadStarted(ModuleID moduleId) @@ -639,12 +690,13 @@ inline void ProfControlBlock::ModuleUnloadStarted(ModuleID moduleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId) - { - return profInterface->ModuleUnloadStarted(moduleId); - }, - moduleId); + &ModuleUnloadStartedHelper, + moduleId); +} + +inline HRESULT ModuleUnloadFinishedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId, HRESULT hrStatus) +{ + return profInterface->ModuleUnloadFinished(moduleId, hrStatus); } inline void ProfControlBlock::ModuleUnloadFinished(ModuleID moduleId, HRESULT hrStatus) @@ -653,12 +705,13 @@ inline void ProfControlBlock::ModuleUnloadFinished(ModuleID moduleId, HRESULT hr DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId, HRESULT hrStatus) - { - return profInterface->ModuleUnloadFinished(moduleId, hrStatus); - }, - moduleId, hrStatus); + &ModuleUnloadFinishedHelper, + moduleId, hrStatus); +} + +inline HRESULT ModuleAttachedToAssemblyHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId, AssemblyID AssemblyId) +{ + return profInterface->ModuleAttachedToAssembly(moduleId, AssemblyId); } inline void ProfControlBlock::ModuleAttachedToAssembly(ModuleID moduleId, AssemblyID AssemblyId) @@ -667,12 +720,8 @@ inline void ProfControlBlock::ModuleAttachedToAssembly(ModuleID moduleId, Assemb DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingModuleLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId, AssemblyID AssemblyId) - { - return profInterface->ModuleAttachedToAssembly(moduleId, AssemblyId); - }, - moduleId, AssemblyId); + &ModuleAttachedToAssemblyHelper, + moduleId, AssemblyId); } inline BOOL IsProfilerTrackingInMemorySymbolsUpdatesEnabled(ProfilerInfo *pProfilerInfo) @@ -688,18 +737,19 @@ inline BOOL IsProfilerTrackingInMemorySymbolsUpdatesEnabled(ProfilerInfo *pProfi return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED); } +inline HRESULT ModuleInMemorySymbolsUpdatedHelper(EEToProfInterfaceImpl *profInterface, ModuleID moduleId) +{ + return profInterface->ModuleInMemorySymbolsUpdated(moduleId); +} + inline void ProfControlBlock::ModuleInMemorySymbolsUpdated(ModuleID moduleId) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingInMemorySymbolsUpdatesEnabled, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ModuleID moduleId) - { - return profInterface->ModuleInMemorySymbolsUpdated(moduleId); - }, - moduleId); + &ModuleInMemorySymbolsUpdatedHelper, + moduleId); } inline BOOL IsProfilerTrackingClasses(ProfilerInfo *pProfilerInfo) @@ -715,18 +765,24 @@ inline BOOL IsProfilerTrackingClasses(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CLASS_LOADS); } +inline HRESULT ClassLoadStartedHelper(EEToProfInterfaceImpl *profInterface, ClassID classId) +{ + return profInterface->ClassLoadStarted(classId); +} + inline void ProfControlBlock::ClassLoadStarted(ClassID classId) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID classId) - { - return profInterface->ClassLoadStarted(classId); - }, - classId); + &ClassLoadStartedHelper, + classId); +} + +inline HRESULT ClassLoadFinishedHelper(EEToProfInterfaceImpl *profInterface, ClassID classId, HRESULT hrStatus) +{ + return profInterface->ClassLoadFinished(classId, hrStatus); } inline void ProfControlBlock::ClassLoadFinished(ClassID classId, HRESULT hrStatus) @@ -735,12 +791,13 @@ inline void ProfControlBlock::ClassLoadFinished(ClassID classId, HRESULT hrStatu DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID classId, HRESULT hrStatus) - { - return profInterface->ClassLoadFinished(classId, hrStatus); - }, - classId, hrStatus); + &ClassLoadFinishedHelper, + classId, hrStatus); +} + +inline HRESULT ClassUnloadStartedHelper(EEToProfInterfaceImpl *profInterface, ClassID classId) +{ + return profInterface->ClassUnloadStarted(classId); } inline void ProfControlBlock::ClassUnloadStarted(ClassID classId) @@ -749,12 +806,13 @@ inline void ProfControlBlock::ClassUnloadStarted(ClassID classId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID classId) - { - return profInterface->ClassUnloadStarted(classId); - }, - classId); + &ClassUnloadStartedHelper, + classId); +} + +inline HRESULT ClassUnloadFinishedHelper(EEToProfInterfaceImpl *profInterface, ClassID classId, HRESULT hrStatus) +{ + return profInterface->ClassUnloadFinished(classId, hrStatus); } inline void ProfControlBlock::ClassUnloadFinished(ClassID classId, HRESULT hrStatus) @@ -763,12 +821,8 @@ inline void ProfControlBlock::ClassUnloadFinished(ClassID classId, HRESULT hrSta DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingClasses, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID classId, HRESULT hrStatus) - { - return profInterface->ClassUnloadFinished(classId, hrStatus); - }, - classId, hrStatus); + &ClassUnloadFinishedHelper, + classId, hrStatus); } inline BOOL IsProfilerTrackingAppDomainLoads(ProfilerInfo *pProfilerInfo) @@ -784,18 +838,24 @@ inline BOOL IsProfilerTrackingAppDomainLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_APPDOMAIN_LOADS); } +inline HRESULT AppDomainCreationStartedHelper(EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId) +{ + return profInterface->AppDomainCreationStarted(appDomainId); +} + inline void ProfControlBlock::AppDomainCreationStarted(AppDomainID appDomainId) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId) - { - return profInterface->AppDomainCreationStarted(appDomainId); - }, - appDomainId); + &AppDomainCreationStartedHelper, + appDomainId); +} + +inline HRESULT AppDomainCreationFinishedHelper(EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId, HRESULT hrStatus) +{ + return profInterface->AppDomainCreationFinished(appDomainId, hrStatus); } inline void ProfControlBlock::AppDomainCreationFinished(AppDomainID appDomainId, HRESULT hrStatus) @@ -804,12 +864,13 @@ inline void ProfControlBlock::AppDomainCreationFinished(AppDomainID appDomainId, DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId, HRESULT hrStatus) - { - return profInterface->AppDomainCreationFinished(appDomainId, hrStatus); - }, - appDomainId, hrStatus); + &AppDomainCreationFinishedHelper, + appDomainId, hrStatus); +} + +inline HRESULT AppDomainShutdownStartedHelper(EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId) +{ + return profInterface->AppDomainShutdownStarted(appDomainId); } inline void ProfControlBlock::AppDomainShutdownStarted(AppDomainID appDomainId) @@ -818,12 +879,13 @@ inline void ProfControlBlock::AppDomainShutdownStarted(AppDomainID appDomainId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId) - { - return profInterface->AppDomainShutdownStarted(appDomainId); - }, - appDomainId); + &AppDomainShutdownStartedHelper, + appDomainId); +} + +inline HRESULT AppDomainShutdownFinishedHelper(EEToProfInterfaceImpl *profInterface, AppDomainID appDomainId, HRESULT hrStatus) +{ + return profInterface->AppDomainShutdownFinished(appDomainId, hrStatus); } inline void ProfControlBlock::AppDomainShutdownFinished(AppDomainID appDomainId, HRESULT hrStatus) @@ -832,12 +894,8 @@ inline void ProfControlBlock::AppDomainShutdownFinished(AppDomainID appDomainId, DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAppDomainLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AppDomainID appDomainId, HRESULT hrStatus) - { - return profInterface->AppDomainShutdownFinished(appDomainId, hrStatus); - }, - appDomainId, hrStatus); + &AppDomainShutdownFinishedHelper, + appDomainId, hrStatus); } inline BOOL IsProfilerTrackingAssemblyLoads(ProfilerInfo *pProfilerInfo) @@ -853,18 +911,24 @@ inline BOOL IsProfilerTrackingAssemblyLoads(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_ASSEMBLY_LOADS); } +inline HRESULT AssemblyLoadStartedHelper(EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId) +{ + return profInterface->AssemblyLoadStarted(assemblyId); +} + inline void ProfControlBlock::AssemblyLoadStarted(AssemblyID assemblyId) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId) - { - return profInterface->AssemblyLoadStarted(assemblyId); - }, - assemblyId); + &AssemblyLoadStartedHelper, + assemblyId); +} + +inline HRESULT AssemblyLoadFinishedHelper(EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId, HRESULT hrStatus) +{ + return profInterface->AssemblyLoadFinished(assemblyId, hrStatus); } inline void ProfControlBlock::AssemblyLoadFinished(AssemblyID assemblyId, HRESULT hrStatus) @@ -873,12 +937,13 @@ inline void ProfControlBlock::AssemblyLoadFinished(AssemblyID assemblyId, HRESUL DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId, HRESULT hrStatus) - { - return profInterface->AssemblyLoadFinished(assemblyId, hrStatus); - }, - assemblyId, hrStatus); + &AssemblyLoadFinishedHelper, + assemblyId, hrStatus); +} + +inline HRESULT AssemblyUnloadStartedHelper(EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId) +{ + return profInterface->AssemblyUnloadStarted(assemblyId); } inline void ProfControlBlock::AssemblyUnloadStarted(AssemblyID assemblyId) @@ -887,12 +952,13 @@ inline void ProfControlBlock::AssemblyUnloadStarted(AssemblyID assemblyId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId) - { - return profInterface->AssemblyUnloadStarted(assemblyId); - }, - assemblyId); + &AssemblyUnloadStartedHelper, + assemblyId); +} + +inline HRESULT AssemblyUnloadFinishedHelper(EEToProfInterfaceImpl *profInterface, AssemblyID assemblyId, HRESULT hrStatus) +{ + return profInterface->AssemblyUnloadFinished(assemblyId, hrStatus); } inline void ProfControlBlock::AssemblyUnloadFinished(AssemblyID assemblyId, HRESULT hrStatus) @@ -901,12 +967,8 @@ inline void ProfControlBlock::AssemblyUnloadFinished(AssemblyID assemblyId, HRES DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAssemblyLoads, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, AssemblyID assemblyId, HRESULT hrStatus) - { - return profInterface->AssemblyUnloadFinished(assemblyId, hrStatus); - }, - assemblyId, hrStatus); + &AssemblyUnloadFinishedHelper, + assemblyId, hrStatus); } inline BOOL IsProfilerTrackingTransitions(ProfilerInfo *pProfilerInfo) @@ -922,18 +984,24 @@ inline BOOL IsProfilerTrackingTransitions(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CODE_TRANSITIONS); } +inline HRESULT UnmanagedToManagedTransitionHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) +{ + return profInterface->UnmanagedToManagedTransition(functionId, reason); +} + inline void ProfControlBlock::UnmanagedToManagedTransition(FunctionID functionId, COR_PRF_TRANSITION_REASON reason) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingTransitions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) - { - return profInterface->UnmanagedToManagedTransition(functionId, reason); - }, - functionId, reason); + &UnmanagedToManagedTransitionHelper, + functionId, reason); +} + +inline HRESULT ManagedToUnmanagedTransitionHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) +{ + return profInterface->ManagedToUnmanagedTransition(functionId, reason); } inline void ProfControlBlock::ManagedToUnmanagedTransition(FunctionID functionId, COR_PRF_TRANSITION_REASON reason) @@ -942,12 +1010,8 @@ inline void ProfControlBlock::ManagedToUnmanagedTransition(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingTransitions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, COR_PRF_TRANSITION_REASON reason) - { - return profInterface->ManagedToUnmanagedTransition(functionId, reason); - }, - functionId, reason); + &ManagedToUnmanagedTransitionHelper, + functionId, reason); } inline BOOL IsProfilerTrackingExceptions(ProfilerInfo *pProfilerInfo) @@ -963,18 +1027,24 @@ inline BOOL IsProfilerTrackingExceptions(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_EXCEPTIONS); } +inline HRESULT ExceptionThrownHelper(EEToProfInterfaceImpl *profInterface, ObjectID thrownObjectId) +{ + return profInterface->ExceptionThrown(thrownObjectId); +} + inline void ProfControlBlock::ExceptionThrown(ObjectID thrownObjectId) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ObjectID thrownObjectId) - { - return profInterface->ExceptionThrown(thrownObjectId); - }, - thrownObjectId); + &ExceptionThrownHelper, + thrownObjectId); +} + +inline HRESULT ExceptionSearchFunctionEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) +{ + return profInterface->ExceptionSearchFunctionEnter(functionId); } inline void ProfControlBlock::ExceptionSearchFunctionEnter(FunctionID functionId) @@ -983,12 +1053,13 @@ inline void ProfControlBlock::ExceptionSearchFunctionEnter(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->ExceptionSearchFunctionEnter(functionId); - }, - functionId); + &ExceptionSearchFunctionEnterHelper, + functionId); +} + +inline HRESULT ExceptionSearchFunctionLeaveHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->ExceptionSearchFunctionLeave(); } inline void ProfControlBlock::ExceptionSearchFunctionLeave() @@ -997,11 +1068,12 @@ inline void ProfControlBlock::ExceptionSearchFunctionLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionSearchFunctionLeave(); - }); + &ExceptionSearchFunctionLeaveHelper); +} + +inline HRESULT ExceptionSearchFilterEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID funcId) +{ + return profInterface->ExceptionSearchFilterEnter(funcId); } inline void ProfControlBlock::ExceptionSearchFilterEnter(FunctionID funcId) @@ -1010,12 +1082,13 @@ inline void ProfControlBlock::ExceptionSearchFilterEnter(FunctionID funcId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID funcId) - { - return profInterface->ExceptionSearchFilterEnter(funcId); - }, - funcId); + &ExceptionSearchFilterEnterHelper, + funcId); +} + +inline HRESULT ExceptionSearchFilterLeaveHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->ExceptionSearchFilterLeave(); } inline void ProfControlBlock::ExceptionSearchFilterLeave() @@ -1024,11 +1097,12 @@ inline void ProfControlBlock::ExceptionSearchFilterLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionSearchFilterLeave(); - }); + &ExceptionSearchFilterLeaveHelper); +} + +inline HRESULT ExceptionSearchCatcherFoundHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) +{ + return profInterface->ExceptionSearchCatcherFound(functionId); } inline void ProfControlBlock::ExceptionSearchCatcherFound(FunctionID functionId) @@ -1037,12 +1111,13 @@ inline void ProfControlBlock::ExceptionSearchCatcherFound(FunctionID functionId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->ExceptionSearchCatcherFound(functionId); - }, - functionId); + &ExceptionSearchCatcherFoundHelper, + functionId); +} + +inline HRESULT ExceptionOSHandlerEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID funcId) +{ + return profInterface->ExceptionOSHandlerEnter(funcId); } inline void ProfControlBlock::ExceptionOSHandlerEnter(FunctionID funcId) @@ -1051,12 +1126,13 @@ inline void ProfControlBlock::ExceptionOSHandlerEnter(FunctionID funcId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID funcId) - { - return profInterface->ExceptionOSHandlerEnter(funcId); - }, - funcId); + &ExceptionOSHandlerEnterHelper, + funcId); +} + +inline HRESULT ExceptionOSHandlerLeaveHelper(EEToProfInterfaceImpl *profInterface, FunctionID funcId) +{ + return profInterface->ExceptionOSHandlerLeave(funcId); } inline void ProfControlBlock::ExceptionOSHandlerLeave(FunctionID funcId) @@ -1065,12 +1141,13 @@ inline void ProfControlBlock::ExceptionOSHandlerLeave(FunctionID funcId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID funcId) - { - return profInterface->ExceptionOSHandlerLeave(funcId); - }, - funcId); + &ExceptionOSHandlerLeaveHelper, + funcId); +} + +inline HRESULT ExceptionUnwindFunctionEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) +{ + return profInterface->ExceptionUnwindFunctionEnter(functionId); } inline void ProfControlBlock::ExceptionUnwindFunctionEnter(FunctionID functionId) @@ -1079,12 +1156,13 @@ inline void ProfControlBlock::ExceptionUnwindFunctionEnter(FunctionID functionId DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->ExceptionUnwindFunctionEnter(functionId); - }, - functionId); + &ExceptionUnwindFunctionEnterHelper, + functionId); +} + +inline HRESULT ExceptionUnwindFunctionLeaveHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->ExceptionUnwindFunctionLeave(); } inline void ProfControlBlock::ExceptionUnwindFunctionLeave() @@ -1093,11 +1171,12 @@ inline void ProfControlBlock::ExceptionUnwindFunctionLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionUnwindFunctionLeave(); - }); + &ExceptionUnwindFunctionLeaveHelper); +} + +inline HRESULT ExceptionUnwindFinallyEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId) +{ + return profInterface->ExceptionUnwindFinallyEnter(functionId); } inline void ProfControlBlock::ExceptionUnwindFinallyEnter(FunctionID functionId) @@ -1106,12 +1185,13 @@ inline void ProfControlBlock::ExceptionUnwindFinallyEnter(FunctionID functionId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId) - { - return profInterface->ExceptionUnwindFinallyEnter(functionId); - }, - functionId); + &ExceptionUnwindFinallyEnterHelper, + functionId); +} + +inline HRESULT ExceptionUnwindFinallyLeaveHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->ExceptionUnwindFinallyLeave(); } inline void ProfControlBlock::ExceptionUnwindFinallyLeave() @@ -1120,11 +1200,12 @@ inline void ProfControlBlock::ExceptionUnwindFinallyLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionUnwindFinallyLeave(); - }); + &ExceptionUnwindFinallyLeaveHelper); +} + +inline HRESULT ExceptionCatcherEnterHelper(EEToProfInterfaceImpl *profInterface, FunctionID functionId, ObjectID objectId) +{ + return profInterface->ExceptionCatcherEnter(functionId, objectId); } inline void ProfControlBlock::ExceptionCatcherEnter(FunctionID functionId, ObjectID objectId) @@ -1133,12 +1214,13 @@ inline void ProfControlBlock::ExceptionCatcherEnter(FunctionID functionId, Objec DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, FunctionID functionId, ObjectID objectId) - { - return profInterface->ExceptionCatcherEnter(functionId, objectId); - }, - functionId, objectId); + &ExceptionCatcherEnterHelper, + functionId, objectId); +} + +inline HRESULT ExceptionCatcherLeaveHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->ExceptionCatcherLeave(); } inline void ProfControlBlock::ExceptionCatcherLeave() @@ -1147,11 +1229,7 @@ inline void ProfControlBlock::ExceptionCatcherLeave() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingExceptions, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->ExceptionCatcherLeave(); - }); + &ExceptionCatcherLeaveHelper); } inline BOOL IsProfilerTrackingCCW(ProfilerInfo *pProfilerInfo) @@ -1167,18 +1245,19 @@ inline BOOL IsProfilerTrackingCCW(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_CCW); } +inline HRESULT COMClassicVTableCreatedHelper(EEToProfInterfaceImpl *profInterface, ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) +{ + return profInterface->COMClassicVTableCreated(wrappedClassId, implementedIID, pVTable, cSlots); +} + inline void ProfControlBlock::COMClassicVTableCreated(ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingCCW, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ClassID wrappedClassId, REFGUID implementedIID, void *pVTable, ULONG cSlots) - { - return profInterface->COMClassicVTableCreated(wrappedClassId, implementedIID, pVTable, cSlots); - }, - wrappedClassId, implementedIID, pVTable, cSlots); + &COMClassicVTableCreatedHelper, + wrappedClassId, implementedIID, pVTable, cSlots); } inline BOOL IsProfilerTrackingSuspends(ProfilerInfo *pProfilerInfo) @@ -1194,18 +1273,24 @@ inline BOOL IsProfilerTrackingSuspends(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_SUSPENDS); } +inline HRESULT RuntimeSuspendStartedHelper(EEToProfInterfaceImpl *profInterface, COR_PRF_SUSPEND_REASON suspendReason) +{ + return profInterface->RuntimeSuspendStarted(suspendReason); +} + inline void ProfControlBlock::RuntimeSuspendStarted(COR_PRF_SUSPEND_REASON suspendReason) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, COR_PRF_SUSPEND_REASON suspendReason) - { - return profInterface->RuntimeSuspendStarted(suspendReason); - }, - suspendReason); + &RuntimeSuspendStartedHelper, + suspendReason); +} + +inline HRESULT RuntimeSuspendFinishedHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->RuntimeSuspendFinished(); } inline void ProfControlBlock::RuntimeSuspendFinished() @@ -1214,11 +1299,12 @@ inline void ProfControlBlock::RuntimeSuspendFinished() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->RuntimeSuspendFinished(); - }); + &RuntimeSuspendFinishedHelper); +} + +inline HRESULT RuntimeSuspendAbortedHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->RuntimeSuspendAborted(); } inline void ProfControlBlock::RuntimeSuspendAborted() @@ -1227,11 +1313,12 @@ inline void ProfControlBlock::RuntimeSuspendAborted() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->RuntimeSuspendAborted(); - }); + &RuntimeSuspendAbortedHelper); +} + +inline HRESULT RuntimeResumeStartedHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->RuntimeResumeStarted(); } inline void ProfControlBlock::RuntimeResumeStarted() @@ -1240,11 +1327,12 @@ inline void ProfControlBlock::RuntimeResumeStarted() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->RuntimeResumeStarted(); - }); + &RuntimeResumeStartedHelper); +} + +inline HRESULT RuntimeResumeFinishedHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->RuntimeResumeFinished(); } inline void ProfControlBlock::RuntimeResumeFinished() @@ -1253,11 +1341,12 @@ inline void ProfControlBlock::RuntimeResumeFinished() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->RuntimeResumeFinished(); - }); + &RuntimeResumeFinishedHelper); +} + +inline HRESULT RuntimeThreadSuspendedHelper(EEToProfInterfaceImpl *profInterface, ThreadID suspendedThreadId) +{ + return profInterface->RuntimeThreadSuspended(suspendedThreadId); } inline void ProfControlBlock::RuntimeThreadSuspended(ThreadID suspendedThreadId) @@ -1266,12 +1355,13 @@ inline void ProfControlBlock::RuntimeThreadSuspended(ThreadID suspendedThreadId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID suspendedThreadId) - { - return profInterface->RuntimeThreadSuspended(suspendedThreadId); - }, - suspendedThreadId); + &RuntimeThreadSuspendedHelper, + suspendedThreadId); +} + +inline HRESULT RuntimeThreadResumedHelper(EEToProfInterfaceImpl *profInterface, ThreadID resumedThreadId) +{ + return profInterface->RuntimeThreadResumed(resumedThreadId); } inline void ProfControlBlock::RuntimeThreadResumed(ThreadID resumedThreadId) @@ -1280,12 +1370,8 @@ inline void ProfControlBlock::RuntimeThreadResumed(ThreadID resumedThreadId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingSuspends, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ThreadID resumedThreadId) - { - return profInterface->RuntimeThreadResumed(resumedThreadId); - }, - resumedThreadId); + &RuntimeThreadResumedHelper, + resumedThreadId); } inline BOOL IsProfilerTrackingAllocations(ProfilerInfo *pProfilerInfo) @@ -1302,18 +1388,19 @@ inline BOOL IsProfilerTrackingAllocations(ProfilerInfo *pProfilerInfo) || pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED)); } +inline HRESULT ObjectAllocatedHelper(EEToProfInterfaceImpl *profInterface, ObjectID objectId, ClassID classId) +{ + return profInterface->ObjectAllocated(objectId, classId); +} + inline void ProfControlBlock::ObjectAllocated(ObjectID objectId, ClassID classId) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingAllocations, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ObjectID objectId, ClassID classId) - { - return profInterface->ObjectAllocated(objectId, classId); - }, - objectId, classId); + &ObjectAllocatedHelper, + objectId, classId); } @@ -1330,18 +1417,24 @@ inline BOOL IsProfilerTrackingGC(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_GC); } +inline HRESULT FinalizeableObjectQueuedHelper(EEToProfInterfaceImpl *profInterface, BOOL isCritical, ObjectID objectID) +{ + return profInterface->FinalizeableObjectQueued(isCritical, objectID); +} + inline void ProfControlBlock::FinalizeableObjectQueued(BOOL isCritical, ObjectID objectID) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, BOOL isCritical, ObjectID objectID) - { - return profInterface->FinalizeableObjectQueued(isCritical, objectID); - }, - isCritical, objectID); + &FinalizeableObjectQueuedHelper, + isCritical, objectID); +} + +inline HRESULT MovedReferenceHelper(EEToProfInterfaceImpl *profInterface, BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) +{ + return profInterface->MovedReference(pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); } inline void ProfControlBlock::MovedReference(BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) @@ -1350,12 +1443,13 @@ inline void ProfControlBlock::MovedReference(BYTE *pbMemBlockStart, BYTE *pbMemB DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, BYTE *pbMemBlockStart, BYTE *pbMemBlockEnd, ptrdiff_t cbRelocDistance, void *pHeapId, BOOL fCompacting) - { - return profInterface->MovedReference(pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); - }, - pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); + &MovedReferenceHelper, + pbMemBlockStart, pbMemBlockEnd, cbRelocDistance, pHeapId, fCompacting); +} + +inline HRESULT EndMovedReferencesHelper(EEToProfInterfaceImpl *profInterface, void *pHeapId) +{ + return profInterface->EndMovedReferences(pHeapId); } inline void ProfControlBlock::EndMovedReferences(void *pHeapId) @@ -1364,12 +1458,13 @@ inline void ProfControlBlock::EndMovedReferences(void *pHeapId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, void *pHeapId) - { - return profInterface->EndMovedReferences(pHeapId); - }, - pHeapId); + &EndMovedReferencesHelper, + pHeapId); +} + +inline HRESULT RootReference2Helper(EEToProfInterfaceImpl *profInterface, BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) +{ + return profInterface->RootReference2(objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); } inline void ProfControlBlock::RootReference2(BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) @@ -1378,12 +1473,13 @@ inline void ProfControlBlock::RootReference2(BYTE *objectId, EtwGCRootKind dwEtw DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, BYTE *objectId, EtwGCRootKind dwEtwRootKind, EtwGCRootFlags dwEtwRootFlags, void *rootID, void *pHeapId) - { - return profInterface->RootReference2(objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); - }, - objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); + &RootReference2Helper, + objectId, dwEtwRootKind, dwEtwRootFlags, rootID, pHeapId); +} + +inline HRESULT EndRootReferences2Helper(EEToProfInterfaceImpl *profInterface, void *pHeapId) +{ + return profInterface->EndRootReferences2(pHeapId); } inline void ProfControlBlock::EndRootReferences2(void *pHeapId) @@ -1392,50 +1488,53 @@ inline void ProfControlBlock::EndRootReferences2(void *pHeapId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, void *pHeapId) - { - return profInterface->EndRootReferences2(pHeapId); - }, - pHeapId); + &EndRootReferences2Helper, + pHeapId); } -inline void ProfControlBlock::ConditionalWeakTableElementReference(BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) +inline HRESULT ConditionalWeakTableElementReferenceHelper(EEToProfInterfaceImpl *profInterface, BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) { - LIMITED_METHOD_CONTRACT; - - DoProfilerCallback(ProfilerCallbackType::Active, - IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) - { - if (!profInterface->IsCallback5Supported()) - { - return S_OK; - } + if (!profInterface->IsCallback5Supported()) + { + return S_OK; + } - return profInterface->ConditionalWeakTableElementReference(primaryObjectId, secondaryObjectId, rootID, pHeapId); - }, - primaryObjectId, secondaryObjectId, rootID, pHeapId); + return profInterface->ConditionalWeakTableElementReference(primaryObjectId, secondaryObjectId, rootID, pHeapId); } -inline void ProfControlBlock::EndConditionalWeakTableElementReferences(void *pHeapId) +inline void ProfControlBlock::ConditionalWeakTableElementReference(BYTE *primaryObjectId, BYTE *secondaryObjectId, void *rootID, void *pHeapId) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, void *pHeapId) - { - if (!profInterface->IsCallback5Supported()) - { - return S_OK; - } + &ConditionalWeakTableElementReferenceHelper, + primaryObjectId, secondaryObjectId, rootID, pHeapId); +} + +inline HRESULT EndConditionalWeakTableElementReferencesHelper(EEToProfInterfaceImpl *profInterface, void *pHeapId) +{ + if (!profInterface->IsCallback5Supported()) + { + return S_OK; + } + + return profInterface->EndConditionalWeakTableElementReferences(pHeapId); +} + +inline void ProfControlBlock::EndConditionalWeakTableElementReferences(void *pHeapId) +{ + LIMITED_METHOD_CONTRACT; + + DoProfilerCallback(ProfilerCallbackType::Active, + IsProfilerTrackingGC, + &EndConditionalWeakTableElementReferencesHelper, + pHeapId); +} - return profInterface->EndConditionalWeakTableElementReferences(pHeapId); - }, - pHeapId); +inline HRESULT AllocByClassHelper(EEToProfInterfaceImpl *profInterface, ObjectID objId, ClassID classId, void *pHeapId) +{ + return profInterface->AllocByClass(objId, classId, pHeapId); } inline void ProfControlBlock::AllocByClass(ObjectID objId, ClassID classId, void *pHeapId) @@ -1444,12 +1543,13 @@ inline void ProfControlBlock::AllocByClass(ObjectID objId, ClassID classId, void DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ObjectID objId, ClassID classId, void *pHeapId) - { - return profInterface->AllocByClass(objId, classId, pHeapId); - }, - objId, classId, pHeapId); + &AllocByClassHelper, + objId, classId, pHeapId); +} + +inline HRESULT EndAllocByClassHelper(EEToProfInterfaceImpl *profInterface, void *pHeapId) +{ + return profInterface->EndAllocByClass(pHeapId); } inline void ProfControlBlock::EndAllocByClass(void *pHeapId) @@ -1458,12 +1558,13 @@ inline void ProfControlBlock::EndAllocByClass(void *pHeapId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, void *pHeapId) - { - return profInterface->EndAllocByClass(pHeapId); - }, - pHeapId); + &EndAllocByClassHelper, + pHeapId); +} + +inline HRESULT ObjectReferenceHelper(EEToProfInterfaceImpl *profInterface, ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) +{ + return profInterface->ObjectReference(objId, classId, cNumRefs, arrObjRef); } inline HRESULT ProfControlBlock::ObjectReference(ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) @@ -1472,12 +1573,13 @@ inline HRESULT ProfControlBlock::ObjectReference(ObjectID objId, ClassID classId return DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, ObjectID objId, ClassID classId, ULONG cNumRefs, ObjectID *arrObjRef) - { - return profInterface->ObjectReference(objId, classId, cNumRefs, arrObjRef); - }, - objId, classId, cNumRefs, arrObjRef); + &ObjectReferenceHelper, + objId, classId, cNumRefs, arrObjRef); +} + +inline HRESULT HandleCreatedHelper(EEToProfInterfaceImpl *profInterface, UINT_PTR handleId, ObjectID initialObjectId) +{ + return profInterface->HandleCreated(handleId, initialObjectId); } inline void ProfControlBlock::HandleCreated(UINT_PTR handleId, ObjectID initialObjectId) @@ -1486,12 +1588,13 @@ inline void ProfControlBlock::HandleCreated(UINT_PTR handleId, ObjectID initialO DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, UINT_PTR handleId, ObjectID initialObjectId) - { - return profInterface->HandleCreated(handleId, initialObjectId); - }, - handleId, initialObjectId); + &HandleCreatedHelper, + handleId, initialObjectId); +} + +inline HRESULT HandleDestroyedHelper(EEToProfInterfaceImpl *profInterface, UINT_PTR handleId) +{ + return profInterface->HandleDestroyed(handleId); } inline void ProfControlBlock::HandleDestroyed(UINT_PTR handleId) @@ -1500,12 +1603,8 @@ inline void ProfControlBlock::HandleDestroyed(UINT_PTR handleId) DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, UINT_PTR handleId) - { - return profInterface->HandleDestroyed(handleId); - }, - handleId); + &HandleDestroyedHelper, + handleId); } @@ -1545,18 +1644,24 @@ inline BOOL IsProfilerTrackingGCOrMovedObjects(ProfilerInfo *pProfilerInfo) return IsProfilerTrackingGC(pProfilerInfo) || IsProfilerTrackingMovedObjects(pProfilerInfo); } +inline HRESULT GarbageCollectionStartedHelper(EEToProfInterfaceImpl *profInterface, int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) +{ + return profInterface->GarbageCollectionStarted(cGenerations, generationCollected, reason); +} + inline void ProfControlBlock::GarbageCollectionStarted(int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGCOrBasicGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) - { - return profInterface->GarbageCollectionStarted(cGenerations, generationCollected, reason); - }, - cGenerations, generationCollected, reason); + &GarbageCollectionStartedHelper, + cGenerations, generationCollected, reason); +} + +inline HRESULT GarbageCollectionFinishedHelper(EEToProfInterfaceImpl *profInterface) +{ + return profInterface->GarbageCollectionFinished(); } inline void ProfControlBlock::GarbageCollectionFinished() @@ -1565,11 +1670,7 @@ inline void ProfControlBlock::GarbageCollectionFinished() DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerTrackingGCOrBasicGC, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface) - { - return profInterface->GarbageCollectionFinished(); - }); + &GarbageCollectionFinishedHelper); } @@ -1586,6 +1687,33 @@ inline BOOL IsProfilerMonitoringEventPipe(ProfilerInfo *pProfilerInfo) return pProfilerInfo->eventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_EVENT_PIPE); } +inline HRESULT EventPipeEventDeliveredHelper(EEToProfInterfaceImpl *profInterface, + EventPipeProvider *provider, + DWORD eventId, + DWORD eventVersion, + ULONG cbMetadataBlob, + LPCBYTE metadataBlob, + ULONG cbEventData, + LPCBYTE eventData, + LPCGUID pActivityId, + LPCGUID pRelatedActivityId, + Thread *pEventThread, + ULONG numStackFrames, + UINT_PTR stackFrames[]) +{ + return profInterface->EventPipeEventDelivered(provider, + eventId, + eventVersion, + cbMetadataBlob, + metadataBlob, + cbEventData, + eventData, + pActivityId, + pRelatedActivityId, + pEventThread, + numStackFrames, + stackFrames); +} inline void ProfControlBlock::EventPipeEventDelivered(EventPipeProvider *provider, DWORD eventId, @@ -1604,33 +1732,7 @@ inline void ProfControlBlock::EventPipeEventDelivered(EventPipeProvider *provide DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerMonitoringEventPipe, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, EventPipeProvider *provider, - DWORD eventId, - DWORD eventVersion, - ULONG cbMetadataBlob, - LPCBYTE metadataBlob, - ULONG cbEventData, - LPCBYTE eventData, - LPCGUID pActivityId, - LPCGUID pRelatedActivityId, - Thread *pEventThread, - ULONG numStackFrames, - UINT_PTR stackFrames[]) - { - return profInterface->EventPipeEventDelivered(provider, - eventId, - eventVersion, - cbMetadataBlob, - metadataBlob, - cbEventData, - eventData, - pActivityId, - pRelatedActivityId, - pEventThread, - numStackFrames, - stackFrames); - }, + &EventPipeEventDeliveredHelper, provider, eventId, eventVersion, @@ -1645,18 +1747,19 @@ inline void ProfControlBlock::EventPipeEventDelivered(EventPipeProvider *provide stackFrames); } +inline HRESULT EventPipeProviderCreatedHelper(EEToProfInterfaceImpl *profInterface, EventPipeProvider *provider) +{ + return profInterface->EventPipeProviderCreated(provider); +} + inline void ProfControlBlock::EventPipeProviderCreated(EventPipeProvider *provider) { LIMITED_METHOD_CONTRACT; DoProfilerCallback(ProfilerCallbackType::Active, IsProfilerMonitoringEventPipe, - (void *)NULL, - [](void *additionalData, VolatilePtr profInterface, EventPipeProvider *provider) - { - return profInterface->EventPipeProviderCreated(provider); - }, - provider); + &EventPipeProviderCreatedHelper, + provider); } //--------------------------------------------------------------------------------------- @@ -1664,16 +1767,17 @@ inline void ProfControlBlock::EventPipeProviderCreated(EventPipeProvider *provid // and what features it enabled callbacks for. //--------------------------------------------------------------------------------------- -inline BOOL CORProfilerPresent() +FORCEINLINE BOOL CORProfilerPresent() { - LIMITED_METHOD_DAC_CONTRACT; + STATIC_CONTRACT_LIMITED_METHOD; - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->curProfStatus.Get() >= kProfStatusActive; }); + return (&g_profControlBlock)->mainProfilerInfo.pProfInterface.Load() != NULL + || (&g_profControlBlock)->notificationProfilerCount.Load() > 0; } -inline BOOL CORMainProfilerPresent() +FORCEINLINE BOOL CORMainProfilerPresent() { - LIMITED_METHOD_DAC_CONTRACT; + STATIC_CONTRACT_LIMITED_METHOD; return (&g_profControlBlock)->mainProfilerInfo.curProfStatus.Get() >= kProfStatusActive; } @@ -1681,15 +1785,9 @@ inline BOOL CORMainProfilerPresent() // These return whether a CLR Profiler is actively loaded AND has requested the // specified callback or functionality -inline BOOL CORProfilerFunctionIDMapperEnabled() +FORCEINLINE BOOL CORProfilerFunctionIDMapperEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return (CORMainProfilerPresent() && ( @@ -1698,287 +1796,151 @@ inline BOOL CORProfilerFunctionIDMapperEnabled() )); } -inline BOOL CORProfilerTrackJITInfo() +FORCEINLINE BOOL CORProfilerTrackJITInfo() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION); } -inline BOOL CORProfilerTrackCacheSearches() +FORCEINLINE BOOL CORProfilerTrackCacheSearches() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CACHE_SEARCHES); } -inline BOOL CORProfilerTrackModuleLoads() +FORCEINLINE BOOL CORProfilerTrackModuleLoads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_MODULE_LOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_MODULE_LOADS); } -inline BOOL CORProfilerTrackAssemblyLoads() +FORCEINLINE BOOL CORProfilerTrackAssemblyLoads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_ASSEMBLY_LOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_ASSEMBLY_LOADS); } -inline BOOL CORProfilerTrackAppDomainLoads() +FORCEINLINE BOOL CORProfilerTrackAppDomainLoads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_APPDOMAIN_LOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_APPDOMAIN_LOADS); } -inline BOOL CORProfilerTrackThreads() +FORCEINLINE BOOL CORProfilerTrackThreads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_THREADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_THREADS); } -inline BOOL CORProfilerTrackClasses() +FORCEINLINE BOOL CORProfilerTrackClasses() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CLASS_LOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CLASS_LOADS); } -inline BOOL CORProfilerTrackGC() +FORCEINLINE BOOL CORProfilerTrackGC() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_GC)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_GC); } -inline BOOL CORProfilerTrackAllocationsEnabled() +FORCEINLINE BOOL CORProfilerTrackAllocationsEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; return ( #ifdef PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED (&g_profControlBlock)->fTestOnlyForceObjectAllocated || #endif - (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_OBJECT_ALLOCATED)) + (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_OBJECT_ALLOCATED) ); } -inline BOOL CORProfilerTrackAllocations() +FORCEINLINE BOOL CORProfilerTrackAllocations() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return - (CORProfilerTrackAllocationsEnabled() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_OBJECT_ALLOCATED)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_OBJECT_ALLOCATED); } -inline BOOL CORProfilerTrackLargeAllocations() +FORCEINLINE BOOL CORProfilerTrackLargeAllocations() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return - (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED); } -inline BOOL CORProfilerTrackPinnedAllocations() +FORCEINLINE BOOL CORProfilerTrackPinnedAllocations() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return - (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED); } -inline BOOL CORProfilerEnableRejit() +FORCEINLINE BOOL CORProfilerEnableRejit() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORMainProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_REJIT)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_REJIT); } -inline BOOL CORProfilerTrackExceptions() +FORCEINLINE BOOL CORProfilerTrackExceptions() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_EXCEPTIONS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_EXCEPTIONS); } -inline BOOL CORProfilerTrackTransitions() +FORCEINLINE BOOL CORProfilerTrackTransitions() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CODE_TRANSITIONS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CODE_TRANSITIONS); } -inline BOOL CORProfilerTrackEnterLeave() +FORCEINLINE BOOL CORProfilerTrackEnterLeave() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; #ifdef PROF_TEST_ONLY_FORCE_ELT if ((&g_profControlBlock)->fTestOnlyForceEnterLeave) return TRUE; #endif // PROF_TEST_ONLY_FORCE_ELT - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_ENTERLEAVE)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_ENTERLEAVE); } -inline BOOL CORProfilerTrackCCW() +FORCEINLINE BOOL CORProfilerTrackCCW() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CCW)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_CCW); } -inline BOOL CORProfilerTrackSuspends() +FORCEINLINE BOOL CORProfilerTrackSuspends() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_SUSPENDS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_MONITOR_SUSPENDS); } -inline BOOL CORProfilerDisableInlining() +FORCEINLINE BOOL CORProfilerDisableInlining() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_INLINING)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_INLINING); } -inline BOOL CORProfilerDisableOptimizations() +FORCEINLINE BOOL CORProfilerDisableOptimizations() { CONTRACTL { @@ -1989,56 +1951,35 @@ inline BOOL CORProfilerDisableOptimizations() } CONTRACTL_END; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_OPTIMIZATIONS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_OPTIMIZATIONS); } -inline BOOL CORProfilerUseProfileImages() +FORCEINLINE BOOL CORProfilerUseProfileImages() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; #ifdef PROF_TEST_ONLY_FORCE_ELT if ((&g_profControlBlock)->fTestOnlyForceEnterLeave) return TRUE; #endif // PROF_TEST_ONLY_FORCE_ELT - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_REQUIRE_PROFILE_IMAGE)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_REQUIRE_PROFILE_IMAGE); } -inline BOOL CORProfilerDisableAllNGenImages() +FORCEINLINE BOOL CORProfilerDisableAllNGenImages() { - LIMITED_METHOD_DAC_CONTRACT; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_ALL_NGEN_IMAGES)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_DISABLE_ALL_NGEN_IMAGES); } -inline BOOL CORProfilerTrackConditionalWeakTableElements() +FORCEINLINE BOOL CORProfilerTrackConditionalWeakTableElements() { - LIMITED_METHOD_DAC_CONTRACT; + STATIC_CONTRACT_LIMITED_METHOD; return CORProfilerTrackGC() && (&g_profControlBlock)->IsCallback5Supported(); } -// CORProfilerPresentOrInitializing() returns nonzero iff a CLR Profiler is actively -// loaded and ready to receive callbacks OR a CLR Profiler has loaded just enough that it -// is ready to receive (or is currently executing inside) its Initialize() callback. -// Typically, you'll want to use code:CORProfilerPresent instead of this. But there is -// some internal profiling API code that wants to test for event flags for a profiler -// that may still be initializing, and this function is appropriate for that code. -inline BOOL CORProfilerPresentOrInitializing() -{ - LIMITED_METHOD_CONTRACT; - return AnyProfilerPassesCondition([](ProfilerInfo *pProfilerInfo) { return pProfilerInfo->curProfStatus.Get() > kProfStatusDetaching; }); -} - // These return whether a CLR Profiler has requested the specified functionality. // // Note that, unlike the above functions, a profiler that's not done loading (and is @@ -2047,243 +1988,124 @@ inline BOOL CORProfilerPresentOrInitializing() // are used primarily during the initialization path to choose between slow / fast-path // ELT hooks (and later on as part of asserts). -inline BOOL CORProfilerELT3SlowPathEnabled() +FORCEINLINE BOOL CORProfilerELT3SlowPathEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO))); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)); } -inline BOOL CORProfilerELT3SlowPathEnterEnabled() +FORCEINLINE BOOL CORProfilerELT3SlowPathEnterEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO))); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO)); } -inline BOOL CORProfilerELT3SlowPathLeaveEnabled() +FORCEINLINE BOOL CORProfilerELT3SlowPathLeaveEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO))); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)); } -inline BOOL CORProfilerELT3SlowPathTailcallEnabled() +FORCEINLINE BOOL CORProfilerELT3SlowPathTailcallEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FRAME_INFO))); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_FRAME_INFO)); } -inline BOOL CORProfilerELT2FastPathEnterEnabled() +FORCEINLINE BOOL CORProfilerELT2FastPathEnterEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO)))); + return !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO))); } -inline BOOL CORProfilerELT2FastPathLeaveEnabled() +FORCEINLINE BOOL CORProfilerELT2FastPathLeaveEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)))); + return !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO))); } -inline BOOL CORProfilerELT2FastPathTailcallEnabled() +FORCEINLINE BOOL CORProfilerELT2FastPathTailcallEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FRAME_INFO)))); + return !((&g_profControlBlock)->globalEventMask.IsEventMaskSet((COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FRAME_INFO))); } -inline BOOL CORProfilerFunctionArgsEnabled() +FORCEINLINE BOOL CORProfilerFunctionArgsEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_ARGS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_ARGS); } -inline BOOL CORProfilerFunctionReturnValueEnabled() +FORCEINLINE BOOL CORProfilerFunctionReturnValueEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_RETVAL)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FUNCTION_RETVAL); } -inline BOOL CORProfilerFrameInfoEnabled() +FORCEINLINE BOOL CORProfilerFrameInfoEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FRAME_INFO)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_FRAME_INFO); } -inline BOOL CORProfilerStackSnapshotEnabled() +FORCEINLINE BOOL CORProfilerStackSnapshotEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresentOrInitializing() && - (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_STACK_SNAPSHOT)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskSet(COR_PRF_ENABLE_STACK_SNAPSHOT); } -inline BOOL CORProfilerInMemorySymbolsUpdatesEnabled() +FORCEINLINE BOOL CORProfilerInMemorySymbolsUpdatesEnabled() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED); } -inline BOOL CORProfilerTrackDynamicFunctionUnloads() +FORCEINLINE BOOL CORProfilerTrackDynamicFunctionUnloads() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS); } -inline BOOL CORProfilerDisableTieredCompilation() +FORCEINLINE BOOL CORProfilerDisableTieredCompilation() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_DISABLE_TIERED_COMPILATION)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_DISABLE_TIERED_COMPILATION); } -inline BOOL CORProfilerTrackBasicGC() +FORCEINLINE BOOL CORProfilerTrackBasicGC() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_BASIC_GC)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_BASIC_GC); } -inline BOOL CORProfilerTrackGCMovedObjects() +FORCEINLINE BOOL CORProfilerTrackGCMovedObjects() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_GC_MOVED_OBJECTS)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_GC_MOVED_OBJECTS); } -inline BOOL CORProfilerTrackEventPipe() +FORCEINLINE BOOL CORProfilerTrackEventPipe() { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - CANNOT_TAKE_LOCK; - } - CONTRACTL_END; + STATIC_CONTRACT_LIMITED_METHOD; - return (CORProfilerPresent() && - (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_EVENT_PIPE)); + return (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_EVENT_PIPE); } #if defined(PROFILING_SUPPORTED) && !defined(CROSSGEN_COMPILE) diff --git a/src/coreclr/inc/safemath.h b/src/coreclr/inc/safemath.h index 3c020de6884781..f1b0300d581954 100644 --- a/src/coreclr/inc/safemath.h +++ b/src/coreclr/inc/safemath.h @@ -481,6 +481,9 @@ template class ClrSafeInt Which ought to inline nicely */ // Returns true if safe, false for overflow. +#if defined(_MSC_VER) && defined(HOST_ARM64) // Workaround for https://github.com/dotnet/runtime/issues/93442 +#pragma optimize("", off) +#endif static bool multiply(T lhs, T rhs, T &result) { if(Is64Bit()) @@ -675,6 +678,9 @@ template class ClrSafeInt } } } +#if defined(_MSC_VER) && defined(HOST_ARM64) // Workaround for https://github.com/dotnet/runtime/issues/93442 +#pragma optimize("", on) +#endif // Returns true if safe, false on overflow static inline bool addition(T lhs, T rhs, T &result) diff --git a/src/coreclr/inc/winwrap.h b/src/coreclr/inc/winwrap.h index 4d97618984fd2f..96fdb678ddbd7e 100644 --- a/src/coreclr/inc/winwrap.h +++ b/src/coreclr/inc/winwrap.h @@ -220,7 +220,6 @@ //Long Files will not work on these till redstone #define WszGetCurrentDirectory GetCurrentDirectoryWrapper #define WszGetTempFileName GetTempFileNameWrapper -#define WszGetTempPath GetTempPathWrapper //APIS which have a buffer as an out parameter #define WszGetEnvironmentVariable GetEnvironmentVariableWrapper diff --git a/src/coreclr/interop/comwrappers.cpp b/src/coreclr/interop/comwrappers.cpp index 5600b6a69f50dd..aad3d6fa235913 100644 --- a/src/coreclr/interop/comwrappers.cpp +++ b/src/coreclr/interop/comwrappers.cpp @@ -791,17 +791,6 @@ void NativeObjectWrapperContext::Destroy(_In_ NativeObjectWrapperContext* wrappe { _ASSERTE(wrapper != nullptr); - // Check if the tracker object manager should be informed prior to being destroyed. - IReferenceTracker* trackerMaybe = wrapper->GetReferenceTracker(); - if (trackerMaybe != nullptr) - { - // We only call this during a GC so ignore the failure as - // there is no way we can handle it at this point. - HRESULT hr = TrackerObjectManager::BeforeWrapperDestroyed(trackerMaybe); - _ASSERTE(SUCCEEDED(hr)); - (void)hr; - } - // Manually trigger the destructor since placement // new was used to allocate the object. wrapper->~NativeObjectWrapperContext(); diff --git a/src/coreclr/interop/comwrappers.hpp b/src/coreclr/interop/comwrappers.hpp index bd383beabc5dce..6217b0ebe7e7b9 100644 --- a/src/coreclr/interop/comwrappers.hpp +++ b/src/coreclr/interop/comwrappers.hpp @@ -212,8 +212,8 @@ class TrackerObjectManager // Called after wrapper has been created. static HRESULT AfterWrapperCreated(_In_ IReferenceTracker* obj); - // Called before wrapper is about to be destroyed (the same lifetime as short weak handle). - static HRESULT BeforeWrapperDestroyed(_In_ IReferenceTracker* obj); + // Called before wrapper is about to be finalized (the same lifetime as short weak handle). + static HRESULT BeforeWrapperFinalized(_In_ IReferenceTracker* obj); public: // Begin the reference tracking process for external objects. diff --git a/src/coreclr/interop/inc/interoplib.h b/src/coreclr/interop/inc/interoplib.h index 96f157929e0a5c..37237f5f7cab3c 100644 --- a/src/coreclr/interop/inc/interoplib.h +++ b/src/coreclr/interop/inc/interoplib.h @@ -87,8 +87,12 @@ namespace InteropLib _In_ size_t contextSize, _Out_ ExternalWrapperResult* result) noexcept; - // Destroy the supplied wrapper. - void DestroyWrapperForExternal(_In_ void* context) noexcept; + // Inform the wrapper it is being collected. + void NotifyWrapperForExternalIsBeingCollected(_In_ void* context) noexcept; + + // Destroy the supplied wrapper. + // Optionally notify the wrapper of collection at the same time. + void DestroyWrapperForExternal(_In_ void* context, _In_ bool notifyIsBeingCollected = false) noexcept; // Separate the supplied wrapper from the tracker runtime. void SeparateWrapperFromTrackerRuntime(_In_ void* context) noexcept; diff --git a/src/coreclr/interop/interoplib.cpp b/src/coreclr/interop/interoplib.cpp index 7af7af9e7adcf1..db9e9800fbd46e 100644 --- a/src/coreclr/interop/interoplib.cpp +++ b/src/coreclr/interop/interoplib.cpp @@ -166,15 +166,37 @@ namespace InteropLib return S_OK; } - void DestroyWrapperForExternal(_In_ void* contextMaybe) noexcept + void NotifyWrapperForExternalIsBeingCollected(_In_ void* contextMaybe) noexcept + { + NativeObjectWrapperContext* context = NativeObjectWrapperContext::MapFromRuntimeContext(contextMaybe); + + // A caller should not be destroying a context without knowing if the context is valid. + _ASSERTE(context != nullptr); + + // Check if the tracker object manager should be informed of collection. + IReferenceTracker* trackerMaybe = context->GetReferenceTracker(); + if (trackerMaybe != nullptr) + { + // We only call this during a GC so ignore the failure as + // there is no way we can handle it at this point. + HRESULT hr = TrackerObjectManager::BeforeWrapperFinalized(trackerMaybe); + _ASSERTE(SUCCEEDED(hr)); + (void)hr; + } + } + + void DestroyWrapperForExternal(_In_ void* contextMaybe, _In_ bool notifyIsBeingCollected) noexcept { NativeObjectWrapperContext* context = NativeObjectWrapperContext::MapFromRuntimeContext(contextMaybe); // A caller should not be destroying a context without knowing if the context is valid. _ASSERTE(context != nullptr); - NativeObjectWrapperContext::Destroy(context); - } + if (notifyIsBeingCollected) + NotifyWrapperForExternalIsBeingCollected(contextMaybe); + + NativeObjectWrapperContext::Destroy(context); + } void SeparateWrapperFromTrackerRuntime(_In_ void* contextMaybe) noexcept { diff --git a/src/coreclr/interop/trackerobjectmanager.cpp b/src/coreclr/interop/trackerobjectmanager.cpp index 0a199b71690a46..5214e6b8349d18 100644 --- a/src/coreclr/interop/trackerobjectmanager.cpp +++ b/src/coreclr/interop/trackerobjectmanager.cpp @@ -305,13 +305,13 @@ HRESULT TrackerObjectManager::AfterWrapperCreated(_In_ IReferenceTracker* obj) return S_OK; } -HRESULT TrackerObjectManager::BeforeWrapperDestroyed(_In_ IReferenceTracker* obj) +HRESULT TrackerObjectManager::BeforeWrapperFinalized(_In_ IReferenceTracker* obj) { _ASSERTE(obj != nullptr); HRESULT hr; - // Notify tracker runtime that we are about to destroy a wrapper + // Notify tracker runtime that we are about to finalize a wrapper // (same timing as short weak handle) for this object. // They need this information to disconnect weak refs and stop firing events, // so that they can avoid resurrecting the object. diff --git a/src/coreclr/jit/ICorJitInfo_API_names.h b/src/coreclr/jit/ICorJitInfo_API_names.h index f29e37f91baae3..fec125b78ae06e 100644 --- a/src/coreclr/jit/ICorJitInfo_API_names.h +++ b/src/coreclr/jit/ICorJitInfo_API_names.h @@ -176,5 +176,6 @@ DEF_CLR_API(recordRelocation) DEF_CLR_API(getRelocTypeHint) DEF_CLR_API(getExpectedTargetArchitecture) DEF_CLR_API(getJitFlags) +DEF_CLR_API(doesFieldBelongToClass) #undef DEF_CLR_API diff --git a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp index 66292765480a38..f902b3b99ecd6c 100644 --- a/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp +++ b/src/coreclr/jit/ICorJitInfo_API_wrapper.hpp @@ -1690,6 +1690,16 @@ uint32_t WrapICorJitInfo::getJitFlags( return temp; } +bool WrapICorJitInfo::doesFieldBelongToClass( + CORINFO_FIELD_HANDLE fldHnd, + CORINFO_CLASS_HANDLE cls) +{ + API_ENTER(doesFieldBelongToClass); + bool temp = wrapHnd->doesFieldBelongToClass(fldHnd, cls); + API_LEAVE(doesFieldBelongToClass); + return temp; +} + /**********************************************************************************/ // clang-format on /**********************************************************************************/ diff --git a/src/coreclr/jit/bitsetasshortlong.h b/src/coreclr/jit/bitsetasshortlong.h index dce54d6a5ca3ab..365cf346a10ac2 100644 --- a/src/coreclr/jit/bitsetasshortlong.h +++ b/src/coreclr/jit/bitsetasshortlong.h @@ -345,7 +345,7 @@ class BitSetOps - [{lvType,en}] - [{lvType,en}-{lvReason,s}] + [V{lvSlotNum,d}: {lvType,en}] + [V{lvSlotNum,d}: {lvType,en}-{lvReason,s}] diff --git a/src/coreclr/jit/codegenarmarch.cpp b/src/coreclr/jit/codegenarmarch.cpp index 1989d1d2036a43..1ce113357096c9 100644 --- a/src/coreclr/jit/codegenarmarch.cpp +++ b/src/coreclr/jit/codegenarmarch.cpp @@ -681,12 +681,6 @@ void CodeGen::genIntrinsic(GenTree* treeNode) void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) { assert(treeNode->OperIs(GT_PUTARG_STK)); - GenTree* source = treeNode->gtOp1; -#if !defined(OSX_ARM64_ABI) - var_types targetType = genActualType(source->TypeGet()); -#else - var_types targetType = source->TypeGet(); -#endif emitter* emit = GetEmitter(); // This is the varNum for our store operations, @@ -730,11 +724,13 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) argOffsetMax = compiler->lvaOutgoingArgSpaceSize; } - bool isStruct = (targetType == TYP_STRUCT) || (source->OperGet() == GT_FIELD_LIST); + GenTree* source = treeNode->gtGetOp1(); + + bool isStruct = source->TypeIs(TYP_STRUCT) || (source->OperGet() == GT_FIELD_LIST); if (!isStruct) // a normal non-Struct argument { - if (varTypeIsSIMD(targetType)) + if (varTypeIsSIMD(source->TypeGet())) { assert(!source->isContained()); @@ -753,7 +749,7 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) else #endif // OSX_ARM64_ABI { - emitAttr storeAttr = emitTypeSize(targetType); + emitAttr storeAttr = emitTypeSize(source->TypeGet()); emit->emitIns_S_R(INS_str, storeAttr, srcReg, varNumOut, argOffsetOut); argOffsetOut += EA_SIZE_IN_BYTES(storeAttr); } @@ -761,14 +757,17 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) return; } -#if defined(OSX_ARM64_ABI) + var_types slotType = genActualType(source); +#ifdef OSX_ARM64_ABI + // Small typed args do not get their own full stack slots, so make + // sure we do not overwrite adjacent arguments. switch (treeNode->GetStackByteSize()) { case 1: - targetType = TYP_BYTE; + slotType = TYP_BYTE; break; case 2: - targetType = TYP_SHORT; + slotType = TYP_SHORT; break; default: assert(treeNode->GetStackByteSize() >= 4); @@ -776,8 +775,8 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) } #endif - instruction storeIns = ins_Store(targetType); - emitAttr storeAttr = emitTypeSize(targetType); + instruction storeIns = ins_Store(slotType); + emitAttr storeAttr = emitTypeSize(slotType); // If it is contained then source must be the integer constant zero if (source->isContained()) @@ -797,7 +796,7 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) genConsumeReg(source); emit->emitIns_S_R(storeIns, storeAttr, source->GetRegNum(), varNumOut, argOffsetOut); #ifdef TARGET_ARM - if (targetType == TYP_LONG) + if (source->TypeIs(TYP_LONG)) { // This case currently only occurs for double types that are passed as TYP_LONG; // actual long types would have been decomposed by now. diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index dcf1768c60a7dd..4ba948ec4793c5 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -486,13 +486,14 @@ regMaskTP CodeGenInterface::genGetRegMask(const LclVarDsc* varDsc) assert(varDsc->lvIsInReg()); - if (varTypeUsesFloatReg(varDsc->TypeGet())) + regNumber reg = varDsc->GetRegNum(); + if (genIsValidFloatReg(reg)) { - regMask = genRegMaskFloat(varDsc->GetRegNum(), varDsc->TypeGet()); + regMask = genRegMaskFloat(reg, varDsc->GetRegisterType()); } else { - regMask = genRegMask(varDsc->GetRegNum()); + regMask = genRegMask(reg); } return regMask; } @@ -7148,8 +7149,9 @@ void CodeGen::genFnProlog() if (isInReg) { - regMaskTP regMask = genRegMask(varDsc->GetRegNum()); - if (!varDsc->IsFloatRegType()) + regNumber regForVar = varDsc->GetRegNum(); + regMaskTP regMask = genRegMask(regForVar); + if (!genIsValidFloatReg(regForVar)) { initRegs |= regMask; @@ -12551,6 +12553,17 @@ void CodeGen::genPoisonFrame(regMaskTP regLiveIn) assert(varDsc->lvOnFrame); + int size = (int)compiler->lvaLclSize(varNum); + + if ((size / TARGET_POINTER_SIZE) > 16) + { + // For very large structs the offsets in the movs we emit below can + // grow too large to be handled properly by JIT. Furthermore, while + // this is only debug code, for very large structs this can bloat + // the code too much due to the singular movs used. + continue; + } + if (!hasPoisonImm) { #ifdef TARGET_64BIT @@ -12568,8 +12581,7 @@ void CodeGen::genPoisonFrame(regMaskTP regLiveIn) #else int addr = 0; #endif - int size = (int)compiler->lvaLclSize(varNum); - int end = addr + size; + int end = addr + size; for (int offs = addr; offs < end;) { #ifdef TARGET_64BIT diff --git a/src/coreclr/jit/codegenlinear.cpp b/src/coreclr/jit/codegenlinear.cpp index f58a8db0997e3c..94da35b01c172e 100644 --- a/src/coreclr/jit/codegenlinear.cpp +++ b/src/coreclr/jit/codegenlinear.cpp @@ -51,19 +51,16 @@ void CodeGen::genInitializeRegisterState() continue; } - // Is this a floating-point argument? - if (varDsc->IsFloatRegType()) + if (varDsc->lvAddrExposed) { continue; } - noway_assert(!varTypeUsesFloatReg(varDsc->TypeGet())); - // Mark the register as holding the variable - assert(varDsc->GetRegNum() != REG_STK); - if (!varDsc->lvAddrExposed) + regNumber reg = varDsc->GetRegNum(); + if (genIsValidIntReg(reg)) { - regSet.verifyRegUsed(varDsc->GetRegNum()); + regSet.verifyRegUsed(reg); } } } diff --git a/src/coreclr/jit/codegenxarch.cpp b/src/coreclr/jit/codegenxarch.cpp index f268c6a066a86a..759f1037ca2da7 100644 --- a/src/coreclr/jit/codegenxarch.cpp +++ b/src/coreclr/jit/codegenxarch.cpp @@ -1891,7 +1891,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) // genMultiRegStoreToSIMDLocal: store multi-reg value to a single-reg SIMD local // // Arguments: -// lclNode - GentreeLclVar of GT_STORE_LCL_VAR +// lclNode - GenTreeLclVar of GT_STORE_LCL_VAR // // Return Value: // None @@ -1996,6 +1996,7 @@ void CodeGen::genMultiRegStoreToSIMDLocal(GenTreeLclVar* lclNode) else { regNumber tempXmm = lclNode->GetSingleTempReg(); + assert(tempXmm != targetReg); inst_Mov(TYP_FLOAT, tempXmm, reg1, /* canSkip */ false); GetEmitter()->emitIns_SIMD_R_R_R(INS_punpckldq, size, targetReg, targetReg, tempXmm); } diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 2c35262a5df0db..5422fa5a8d6818 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -2170,7 +2170,7 @@ VarName Compiler::compVarName(regNumber reg, bool isFloatReg) /* If the variable is not in a register, or not in the register we're looking for, quit. */ /* Also, if it is a compiler generated variable (i.e. slot# > info.compVarScopesCount), don't bother. */ if ((varDsc->lvRegister != 0) && (varDsc->GetRegNum() == reg) && - (varDsc->IsFloatRegType() || !isFloatReg) && (varDsc->lvSlotNum < info.compVarScopesCount)) + (varDsc->lvSlotNum < info.compVarScopesCount)) { /* check if variable in that register is live */ if (VarSetOps::IsMember(this, compCurLife, varDsc->lvVarIndex)) @@ -9175,6 +9175,11 @@ void cTreeFlags(Compiler* comp, GenTree* tree) { chars += printf("[BOX_VALUE]"); } + + if (tree->gtFlags & GTF_BOX_CLONED) + { + chars += printf("[BOX_CLONED]"); + } break; case GT_CNS_INT: diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index f843a6233e907b..0ccefbe4dcd08a 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -502,6 +502,9 @@ class LclVarDsc unsigned char lvUnusedStruct : 1; // All references to this promoted struct are through its field locals. // I.e. there is no longer any reference to the struct directly. // In this case we can simply remove this struct local. + + unsigned char lvUndoneStructPromotion : 1; // The struct promotion was undone and hence there should be no + // reference to the fields of this struct. #endif unsigned char lvLRACandidate : 1; // Tracked for linear scan register allocation purposes @@ -958,10 +961,6 @@ class LclVarDsc Compiler* pComp, RefCountState state = RCS_NORMAL, bool propagate = true); - bool IsFloatRegType() const - { - return varTypeUsesFloatReg(lvType) || lvIsHfaRegArg(); - } var_types GetHfaType() const { @@ -5204,6 +5203,8 @@ class Compiler // Does value-numbering for a block assignment. void fgValueNumberBlockAssignment(GenTree* tree); + bool fgValueNumberIsStructReinterpretation(GenTreeLclVarCommon* lhsLclVarTree, GenTreeLclVarCommon* rhsLclVarTree); + // Does value-numbering for a cast tree. void fgValueNumberCastTree(GenTree* tree); @@ -7612,8 +7613,9 @@ class Compiler }; bool optIsStackLocalInvariant(unsigned loopNum, unsigned lclNum); - bool optExtractArrIndex(GenTree* tree, ArrIndex* result, unsigned lhsNum); - bool optReconstructArrIndex(GenTree* tree, ArrIndex* result, unsigned lhsNum); + bool optExtractArrIndex(GenTree* tree, ArrIndex* result, unsigned lhsNum, bool* topLevelIsFinal); + bool optReconstructArrIndexHelp(GenTree* tree, ArrIndex* result, unsigned lhsNum, bool* topLevelIsFinal); + bool optReconstructArrIndex(GenTree* tree, ArrIndex* result); bool optIdentifyLoopOptInfo(unsigned loopNum, LoopCloneContext* context); static fgWalkPreFn optCanOptimizeByLoopCloningVisitor; fgWalkResult optCanOptimizeByLoopCloning(GenTree* tree, LoopCloneVisitorInfo* info); @@ -8910,15 +8912,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX } private: - unsigned getSIMDInitTempVarNum() - { - if (lvaSIMDInitTempVarNum == BAD_VAR_NUM) - { - lvaSIMDInitTempVarNum = lvaGrabTempWithImplicitUse(false DEBUGARG("SIMDInitTempVar")); - lvaTable[lvaSIMDInitTempVarNum].lvType = getSIMDVectorType(); - } - return lvaSIMDInitTempVarNum; - } + unsigned getSIMDInitTempVarNum(var_types simdType); #else // !FEATURE_SIMD bool isOpaqueSIMDLclVar(LclVarDsc* varDsc) diff --git a/src/coreclr/jit/compiler.hpp b/src/coreclr/jit/compiler.hpp index ed0b0940fee66b..d605339b77ca23 100644 --- a/src/coreclr/jit/compiler.hpp +++ b/src/coreclr/jit/compiler.hpp @@ -3488,7 +3488,7 @@ inline bool Compiler::LoopDsc::lpArrLenLimit(Compiler* comp, ArrIndex* index) co // We have a[i].length, extract a[i] pattern. else if (limit->AsArrLen()->ArrRef()->gtOper == GT_COMMA) { - return comp->optReconstructArrIndex(limit->AsArrLen()->ArrRef(), index, BAD_VAR_NUM); + return comp->optReconstructArrIndex(limit->AsArrLen()->ArrRef(), index); } return false; } diff --git a/src/coreclr/jit/emitxarch.cpp b/src/coreclr/jit/emitxarch.cpp index 16ad448cd3d768..97cbc11c3cb93c 100644 --- a/src/coreclr/jit/emitxarch.cpp +++ b/src/coreclr/jit/emitxarch.cpp @@ -10370,7 +10370,7 @@ BYTE* emitter::emitOutputAM(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc) noway_assert((int)dsp == dsp); // This requires, specifying a SIB byte after ModRM byte. - if (EncodedBySSE38orSSE3A(ins)) + if (EncodedBySSE38orSSE3A(ins) || (ins == INS_crc32)) { dst += emitOutputByte(dst, code | 0x04); } diff --git a/src/coreclr/jit/fgehopt.cpp b/src/coreclr/jit/fgehopt.cpp index 06abf455ac2df1..18cb78ac12e612 100644 --- a/src/coreclr/jit/fgehopt.cpp +++ b/src/coreclr/jit/fgehopt.cpp @@ -99,6 +99,14 @@ PhaseStatus Compiler::fgRemoveEmptyFinally() continue; } + // If the finally's block jumps back to itself, then it is not empty. + if ((firstBlock->bbJumpKind == BBJ_ALWAYS) && firstBlock->bbJumpDest == firstBlock) + { + JITDUMP("EH#%u finally has basic block that jumps to itself; skipping.\n", XTnum); + XTnum++; + continue; + } + // Limit for now to finallys that contain only a GT_RETFILT. bool isEmpty = true; diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 22e46b6a819eb2..58352e5a8eefcf 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -7422,7 +7422,11 @@ GenTree* Compiler::gtNewBitCastNode(var_types type, GenTree* arg) // Return Value: // Returns GT_ALLOCOBJ node that will be later morphed into an // allocation helper call or local variable allocation on the stack. - +// +// Node creation can fail for inlinees when the type described by pResolvedToken +// can't be represented in jitted code. If this happens, this method will return +// nullptr. +// GenTreeAllocObj* Compiler::gtNewAllocObjNode(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool useParent) { const bool mustRestoreHandle = true; @@ -7475,6 +7479,7 @@ GenTreeAllocObj* Compiler::gtNewAllocObjNode(CORINFO_RESOLVED_TOKEN* pResolvedTo #ifdef FEATURE_READYTORUN_COMPILER if (usingReadyToRunHelper) { + assert(lookup.addr != nullptr); allocObj->gtEntryPoint = lookup; } #endif @@ -7879,6 +7884,9 @@ GenTree* Compiler::gtCloneExpr( copy = new (this, GT_ALLOCOBJ) GenTreeAllocObj(tree->TypeGet(), asAllocObj->gtNewHelper, asAllocObj->gtHelperHasSideEffects, asAllocObj->gtAllocObjClsHnd, asAllocObj->gtOp1); +#ifdef FEATURE_READYTORUN_COMPILER + copy->AsAllocObj()->gtEntryPoint = asAllocObj->gtEntryPoint; +#endif } break; @@ -7927,6 +7935,8 @@ GenTree* Compiler::gtCloneExpr( copy = new (this, GT_BOX) GenTreeBox(tree->TypeGet(), tree->AsOp()->gtOp1, tree->AsBox()->gtAsgStmtWhenInlinedBoxValue, tree->AsBox()->gtCopyStmtWhenInlinedBoxValue); + tree->AsBox()->SetCloned(); + copy->AsBox()->SetCloned(); break; case GT_INTRINSIC: @@ -8157,6 +8167,7 @@ GenTree* Compiler::gtCloneExpr( gtCloneExpr(tree->AsBoundsChk()->gtArrLen, addFlags, deepVarNum, deepVarVal), tree->AsBoundsChk()->gtThrowKind); copy->AsBoundsChk()->gtIndRngFailBB = tree->AsBoundsChk()->gtIndRngFailBB; + copy->AsBoundsChk()->gtInxType = tree->AsBoundsChk()->gtInxType; break; case GT_STORE_DYN_BLK: @@ -13825,6 +13836,13 @@ GenTree* Compiler::gtTryRemoveBoxUpstreamEffects(GenTree* op, BoxRemovalOptions return nullptr; } + // If this box is no longer single-use, bail. + if (box->WasCloned()) + { + JITDUMP(" bailing; unsafe to remove box that has been cloned\n"); + return nullptr; + } + // If we're eventually going to return the type handle, remember it now. GenTree* boxTypeHandle = nullptr; if ((options == BR_REMOVE_AND_NARROW_WANT_TYPE_HANDLE) || (options == BR_DONT_REMOVE_WANT_TYPE_HANDLE)) @@ -18894,10 +18912,45 @@ bool GenTree::isCommutativeHWIntrinsic() const assert(gtOper == GT_HWINTRINSIC); #ifdef TARGET_XARCH - return HWIntrinsicInfo::IsCommutative(AsHWIntrinsic()->gtHWIntrinsicId); -#else - return false; + const GenTreeHWIntrinsic* node = AsHWIntrinsic(); + NamedIntrinsic id = node->gtHWIntrinsicId; + + if (HWIntrinsicInfo::IsCommutative(id)) + { + return true; + } + + if (HWIntrinsicInfo::IsMaybeCommutative(id)) + { + switch (id) + { + case NI_SSE_Max: + case NI_SSE_Min: + { + return false; + } + + case NI_SSE2_Max: + case NI_SSE2_Min: + { + return !varTypeIsFloating(node->GetSimdBaseType()); + } + + case NI_AVX_Max: + case NI_AVX_Min: + { + return false; + } + + default: + { + unreached(); + } + } + } #endif // TARGET_XARCH + + return false; } bool GenTree::isContainableHWIntrinsic() const diff --git a/src/coreclr/jit/gentree.h b/src/coreclr/jit/gentree.h index 2c8ad35b8cdb0f..1405b91d151889 100644 --- a/src/coreclr/jit/gentree.h +++ b/src/coreclr/jit/gentree.h @@ -543,6 +543,7 @@ enum GenTreeFlags : unsigned int GTF_QMARK_CAST_INSTOF = 0x80000000, // GT_QMARK -- Is this a top (not nested) level qmark created for // castclass or instanceof? + GTF_BOX_CLONED = 0x40000000, // GT_BOX -- this box and its operand has been cloned, cannot assume it to be single-use anymore GTF_BOX_VALUE = 0x80000000, // GT_BOX -- "box" is on a value type GTF_ICON_HDL_MASK = 0xF0000000, // Bits used by handle types below @@ -3638,6 +3639,16 @@ struct GenTreeBox : public GenTreeUnOp { } #endif + + bool WasCloned() + { + return (gtFlags & GTF_BOX_CLONED) != 0; + } + + void SetCloned() + { + gtFlags |= GTF_BOX_CLONED; + } }; /* gtField -- data member ref (GT_FIELD) */ @@ -5341,14 +5352,21 @@ struct GenTreeBoundsChk : public GenTree BasicBlock* gtIndRngFailBB; // Basic block to jump to for array-index-out-of-range SpecialCodeKind gtThrowKind; // Kind of throw block to branch to on failure + // Store some information about the array element type that was in the GT_INDEX node before morphing. + // Note that this information is also stored in the m_arrayInfoMap of the morphed IND node (that + // is marked with GTF_IND_ARR_INDEX), but that can be hard to find. + var_types gtInxType; // Save the GT_INDEX type + GenTreeBoundsChk(genTreeOps oper, var_types type, GenTree* index, GenTree* arrLen, SpecialCodeKind kind) - : GenTree(oper, type), gtIndex(index), gtArrLen(arrLen), gtIndRngFailBB(nullptr), gtThrowKind(kind) + : GenTree(oper, type), gtIndex(index), gtArrLen(arrLen), gtIndRngFailBB(nullptr), gtThrowKind(kind), + gtInxType(TYP_UNKNOWN) { // Effects flags propagate upwards. gtFlags |= (index->gtFlags & GTF_ALL_EFFECT); gtFlags |= (arrLen->gtFlags & GTF_ALL_EFFECT); gtFlags |= GTF_EXCEPT; } + #if DEBUGGABLE_GENTREE GenTreeBoundsChk() : GenTree() { diff --git a/src/coreclr/jit/hwintrinsic.h b/src/coreclr/jit/hwintrinsic.h index 0b35ca719b6e2f..7b1c2a9fbfa3bf 100644 --- a/src/coreclr/jit/hwintrinsic.h +++ b/src/coreclr/jit/hwintrinsic.h @@ -141,6 +141,11 @@ enum HWIntrinsicFlag : unsigned int // all the intrinsic that have explicit memory load/store semantics should have this flag HW_Flag_NoContainment = 0x8000, + // MaybeCommutative + // - if a binary-op intrinsic is maybe commutative (e.g., Max or Min for float/double), its op1 can possibly be + // contained + HW_Flag_MaybeCommutative = 0x80000, + #elif defined(TARGET_ARM64) // The intrinsic has an immediate operand // - the value can be (and should be) encoded in a corresponding instruction when the operand value is constant @@ -597,6 +602,18 @@ struct HWIntrinsicInfo return (flags & HW_Flag_Commutative) != 0; } + static bool IsMaybeCommutative(NamedIntrinsic id) + { + HWIntrinsicFlag flags = lookupFlags(id); +#if defined(TARGET_XARCH) + return (flags & HW_Flag_MaybeCommutative) != 0; +#elif defined(TARGET_ARM64) + return false; +#else +#error Unsupported platform +#endif + } + static bool RequiresCodegen(NamedIntrinsic id) { HWIntrinsicFlag flags = lookupFlags(id); diff --git a/src/coreclr/jit/hwintrinsiclistxarch.h b/src/coreclr/jit/hwintrinsiclistxarch.h index eb9bac12e3051c..66cc7c4d211231 100644 --- a/src/coreclr/jit/hwintrinsiclistxarch.h +++ b/src/coreclr/jit/hwintrinsiclistxarch.h @@ -158,9 +158,9 @@ HARDWARE_INTRINSIC(SSE, LoadHigh, HARDWARE_INTRINSIC(SSE, LoadLow, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movlps, INS_invalid}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics) HARDWARE_INTRINSIC(SSE, LoadScalarVector128, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movss, INS_invalid}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics) HARDWARE_INTRINSIC(SSE, LoadVector128, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movups, INS_invalid}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics) -HARDWARE_INTRINSIC(SSE, Max, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_maxps, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_Commutative) +HARDWARE_INTRINSIC(SSE, Max, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_maxps, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_MaybeCommutative) HARDWARE_INTRINSIC(SSE, MaxScalar, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_maxss, INS_invalid}, HW_Category_SIMDScalar, HW_Flag_CopyUpperBits) -HARDWARE_INTRINSIC(SSE, Min, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_minps, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_Commutative) +HARDWARE_INTRINSIC(SSE, Min, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_minps, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_MaybeCommutative) HARDWARE_INTRINSIC(SSE, MinScalar, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_minss, INS_invalid}, HW_Category_SIMDScalar, HW_Flag_CopyUpperBits) HARDWARE_INTRINSIC(SSE, MoveHighToLow, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movhlps, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoContainment) HARDWARE_INTRINSIC(SSE, MoveLowToHigh, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movlhps, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoContainment) @@ -271,10 +271,10 @@ HARDWARE_INTRINSIC(SSE2, LoadLow, HARDWARE_INTRINSIC(SSE2, LoadScalarVector128, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movd, INS_movd, INS_movq, INS_movq, INS_invalid, INS_movsdsse2}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics) HARDWARE_INTRINSIC(SSE2, LoadVector128, 16, 1, {INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_invalid, INS_movupd}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics) HARDWARE_INTRINSIC(SSE2, MaskMove, 16, 3, {INS_maskmovdqu, INS_maskmovdqu, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_MemoryStore, HW_Flag_NoContainment|HW_Flag_NoRMWSemantics|HW_Flag_BaseTypeFromSecondArg) -HARDWARE_INTRINSIC(SSE2, Max, 16, 2, {INS_invalid, INS_pmaxub, INS_pmaxsw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_maxpd}, HW_Category_SimpleSIMD, HW_Flag_Commutative) +HARDWARE_INTRINSIC(SSE2, Max, 16, 2, {INS_invalid, INS_pmaxub, INS_pmaxsw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_maxpd}, HW_Category_SimpleSIMD, HW_Flag_MaybeCommutative) HARDWARE_INTRINSIC(SSE2, MemoryFence, 0, 0, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_Special, HW_Flag_NoContainment|HW_Flag_NoRMWSemantics) HARDWARE_INTRINSIC(SSE2, MaxScalar, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_maxsd}, HW_Category_SIMDScalar, HW_Flag_CopyUpperBits) -HARDWARE_INTRINSIC(SSE2, Min, 16, 2, {INS_invalid, INS_pminub, INS_pminsw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_minpd}, HW_Category_SimpleSIMD, HW_Flag_Commutative) +HARDWARE_INTRINSIC(SSE2, Min, 16, 2, {INS_invalid, INS_pminub, INS_pminsw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_minpd}, HW_Category_SimpleSIMD, HW_Flag_MaybeCommutative) HARDWARE_INTRINSIC(SSE2, MinScalar, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_minsd}, HW_Category_SIMDScalar, HW_Flag_CopyUpperBits) HARDWARE_INTRINSIC(SSE2, MoveMask, 16, 1, {INS_pmovmskb, INS_pmovmskb, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movmskpd}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_NoRMWSemantics|HW_Flag_BaseTypeFromFirstArg) HARDWARE_INTRINSIC(SSE2, MoveScalar, 16, -1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movq, INS_movq, INS_invalid, INS_movsdsse2}, HW_Category_SIMDScalar, HW_Flag_NoContainment) @@ -466,8 +466,8 @@ HARDWARE_INTRINSIC(AVX, InsertVector128, HARDWARE_INTRINSIC(AVX, LoadAlignedVector256, 32, 1, {INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movaps, INS_movapd}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics) HARDWARE_INTRINSIC(AVX, LoadDquVector256, 32, 1, {INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_invalid, INS_invalid}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics) HARDWARE_INTRINSIC(AVX, LoadVector256, 32, 1, {INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movups, INS_movupd}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics) -HARDWARE_INTRINSIC(AVX, Max, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_maxps, INS_maxpd}, HW_Category_SimpleSIMD, HW_Flag_Commutative) -HARDWARE_INTRINSIC(AVX, Min, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_minps, INS_minpd}, HW_Category_SimpleSIMD, HW_Flag_Commutative) +HARDWARE_INTRINSIC(AVX, Max, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_maxps, INS_maxpd}, HW_Category_SimpleSIMD, HW_Flag_MaybeCommutative) +HARDWARE_INTRINSIC(AVX, Min, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_minps, INS_minpd}, HW_Category_SimpleSIMD, HW_Flag_MaybeCommutative) HARDWARE_INTRINSIC(AVX, MaskLoad, -1, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_vmaskmovps, INS_vmaskmovpd}, HW_Category_MemoryLoad, HW_Flag_NoFlag) HARDWARE_INTRINSIC(AVX, MaskStore, -1, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_vmaskmovps, INS_vmaskmovpd}, HW_Category_MemoryStore, HW_Flag_NoContainment|HW_Flag_BaseTypeFromSecondArg) HARDWARE_INTRINSIC(AVX, MoveMask, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movmskps, INS_movmskpd}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_BaseTypeFromFirstArg) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index da396f145bfe05..184fe78ba9c9c9 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -6787,59 +6787,113 @@ void Compiler::impImportAndPushBox(CORINFO_RESOLVED_TOKEN* pResolvedToken) // the opcode stack becomes empty impBoxTempInUse = true; + // Remember the current last statement in case we need to move + // a range of statements to ensure the box temp is initialized + // before it's used. + // + Statement* const cursor = impLastStmt; + const bool useParent = false; op1 = gtNewAllocObjNode(pResolvedToken, useParent); if (op1 == nullptr) { + // If we fail to create the newobj node, we must be inlining + // and have run across a type we can't describe. + // + assert(compDonotInline()); return; } - /* Remember that this basic block contains 'new' of an object, and so does this method */ + // Remember that this basic block contains 'new' of an object, + // and so does this method + // compCurBB->bbFlags |= BBF_HAS_NEWOBJ; optMethodFlags |= OMF_HAS_NEWOBJ; - GenTree* asg = gtNewTempAssign(impBoxTemp, op1); - + // Assign the boxed object to the box temp. + // + GenTree* asg = gtNewTempAssign(impBoxTemp, op1); Statement* asgStmt = impAppendTree(asg, (unsigned)CHECK_SPILL_NONE, impCurStmtOffs); - op1 = gtNewLclvNode(impBoxTemp, TYP_REF); - op2 = gtNewIconNode(TARGET_POINTER_SIZE, TYP_I_IMPL); - op1 = gtNewOperNode(GT_ADD, TYP_BYREF, op1, op2); - - if (varTypeIsStruct(exprToBox)) + // If the exprToBox is a call that returns its value via a ret buf arg, + // move the assignment statement(s) before the call (which must be a top level tree). + // + // We do this because impAssignStructPtr (invoked below) will + // back-substitute into a call when it sees a GT_RET_EXPR and the call + // has a hidden buffer pointer, So we need to reorder things to avoid + // creating out-of-sequence IR. + // + if (varTypeIsStruct(exprToBox) && exprToBox->OperIs(GT_RET_EXPR)) { - // Workaround for GitHub issue 53549. - // - // If the struct being boxed is returned via hidden buffer and comes from an inline/gdv candidate, - // the IR we produce after importation is out of order: - // - // call (&(box-temp + 8), ....) - // box-temp = newobj - // ret-val from call (void) - // ... box-temp (on stack) - // - // For inline candidates this bad ordering gets fixed up during inlining, but for GDV candidates - // the GDV expansion is such that the newobj follows the call as in the above. - // - // This is nontrivial to fix in GDV, so in these (rare) cases we simply disable GDV. - // - if (exprToBox->OperIs(GT_RET_EXPR)) + GenTreeCall* const call = exprToBox->AsRetExpr()->gtInlineCandidate->AsCall(); + + if (call->HasRetBufArg()) { - GenTreeCall* const call = exprToBox->AsRetExpr()->gtInlineCandidate->AsCall(); + JITDUMP("Must insert newobj stmts for box before call [%06u]\n", dspTreeID(call)); + + // Walk back through the statements in this block, looking for the one + // that has this call as the root node. + // + // Because gtNewTempAssign (above) may have added statements that + // feed into the actual assignment we need to move this set of added + // statements as a group. + // + // Note boxed allocations are side-effect free (no com or finalizer) so + // our only worries here are (correctness) not overlapping the box temp + // lifetime and (perf) stretching the temp lifetime across the inlinee + // body. + // + // Since this is an inline candidate, we must be optimizing, and so we have + // a unique box temp per call. So no worries about overlap. + // + assert(!opts.OptimizationDisabled()); + + // Lifetime stretching could addressed with some extra cleverness--sinking + // the allocation back down to just before the copy, once we figure out + // where the copy is. We defer for now. + // + Statement* insertBeforeStmt = cursor; + noway_assert(insertBeforeStmt != nullptr); - if (call->IsGuardedDevirtualizationCandidate() && call->HasRetBufArg()) + while (true) { - JITDUMP("Disabling GDV for [%06u] because of in-box struct return\n"); - call->ClearGuardedDevirtualizationCandidate(); - if (call->IsVirtualStub()) + if (insertBeforeStmt->GetRootNode() == call) { - JITDUMP("Restoring stub addr %p from guarded devirt candidate info\n", - dspPtr(call->gtGuardedDevirtualizationCandidateInfo->stubAddr)); - call->gtStubCallStubAddr = call->gtGuardedDevirtualizationCandidateInfo->stubAddr; + break; } + + // If we've searched all the statements in the block and failed to + // find the call, then something's wrong. + // + noway_assert(insertBeforeStmt != impStmtList); + + insertBeforeStmt = insertBeforeStmt->GetPrevStmt(); } + + // Found the call. Move the statements comprising the assignment. + // + JITDUMP("Moving " FMT_STMT "..." FMT_STMT " before " FMT_STMT "\n", cursor->GetNextStmt()->GetID(), + asgStmt->GetID(), insertBeforeStmt->GetID()); + assert(asgStmt == impLastStmt); + do + { + Statement* movingStmt = impExtractLastStmt(); + impInsertStmtBefore(movingStmt, insertBeforeStmt); + insertBeforeStmt = movingStmt; + } while (impLastStmt != cursor); } + } + + // Create a pointer to the box payload in op1. + // + op1 = gtNewLclvNode(impBoxTemp, TYP_REF); + op2 = gtNewIconNode(TARGET_POINTER_SIZE, TYP_I_IMPL); + op1 = gtNewOperNode(GT_ADD, TYP_BYREF, op1, op2); + // Copy from the exprToBox to the box payload. + // + if (varTypeIsStruct(exprToBox)) + { assert(info.compCompHnd->getClassSize(pResolvedToken->hClass) == info.compCompHnd->getClassSize(operCls)); op1 = impAssignStructPtr(op1, exprToBox, operCls, (unsigned)CHECK_SPILL_ALL); } @@ -6960,7 +7014,9 @@ void Compiler::impImportNewObjArray(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORI // CLANG_FORMAT_COMMENT_ANCHOR; +#ifndef OSX_ARM64_ABI if (!opts.IsReadyToRun() || IsTargetAbi(CORINFO_CORERT_ABI)) +#endif // !OSX_ARM64_ABI { // Reuse the temp used to pass the array dimensions to avoid bloating @@ -7017,6 +7073,7 @@ void Compiler::impImportNewObjArray(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORI node = gtNewHelperCallNode(CORINFO_HELP_NEW_MDARR_NONVARARG, TYP_REF, args); } +#ifndef OSX_ARM64_ABI else { // @@ -7046,6 +7103,7 @@ void Compiler::impImportNewObjArray(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORI } #endif } +#endif // !OSX_ARM64_ABI for (GenTreeCall::Use& use : node->AsCall()->Args()) { @@ -17275,45 +17333,6 @@ bool Compiler::impReturnInstruction(int prefixFlags, OPCODE& opcode) #endif } - // If we are inlining a method that returns a struct byref, check whether we are "reinterpreting" the - // struct. - GenTree* effectiveRetVal = op2->gtEffectiveVal(); - if ((returnType == TYP_BYREF) && (info.compRetType == TYP_BYREF) && - (effectiveRetVal->OperGet() == GT_ADDR)) - { - GenTree* addrChild = effectiveRetVal->gtGetOp1(); - if (addrChild->OperGet() == GT_LCL_VAR) - { - LclVarDsc* varDsc = lvaGetDesc(addrChild->AsLclVarCommon()); - - if (varTypeIsStruct(addrChild->TypeGet()) && !isOpaqueSIMDLclVar(varDsc)) - { - CORINFO_CLASS_HANDLE referentClassHandle; - CorInfoType referentType = - info.compCompHnd->getChildType(info.compMethodInfo->args.retTypeClass, - &referentClassHandle); - if (varTypeIsStruct(JITtype2varType(referentType)) && - (varDsc->GetStructHnd() != referentClassHandle)) - { - // We are returning a byref to struct1; the method signature specifies return type as - // byref - // to struct2. struct1 and struct2 are different so we are "reinterpreting" the struct. - // This may happen in, for example, System.Runtime.CompilerServices.Unsafe.As. - // We need to mark the source struct variable as having overlapping fields because its - // fields may be accessed using field handles of a different type, which may confuse - // optimizations, in particular, value numbering. - - JITDUMP("\nSetting lvOverlappingFields to true on V%02u because of struct " - "reinterpretation\n", - addrChild->AsLclVarCommon()->GetLclNum()); - - varDsc->lvOverlappingFields = true; - } - } - } - } - #ifdef DEBUG if (verbose) { diff --git a/src/coreclr/jit/inlinepolicy.h b/src/coreclr/jit/inlinepolicy.h index 466e17fe0e1127..e604fd57a36ed5 100644 --- a/src/coreclr/jit/inlinepolicy.h +++ b/src/coreclr/jit/inlinepolicy.h @@ -185,7 +185,7 @@ class DefaultPolicy : public LegalPolicy class ExtendedDefaultPolicy : public DefaultPolicy { public: - ExtendedDefaultPolicy::ExtendedDefaultPolicy(Compiler* compiler, bool isPrejitRoot) + ExtendedDefaultPolicy(Compiler* compiler, bool isPrejitRoot) : DefaultPolicy(compiler, isPrejitRoot) , m_ProfileFrequency(0.0) , m_BinaryExprWithCns(0) diff --git a/src/coreclr/jit/jiteh.cpp b/src/coreclr/jit/jiteh.cpp index da431dd82e2de9..12e91d077690ba 100644 --- a/src/coreclr/jit/jiteh.cpp +++ b/src/coreclr/jit/jiteh.cpp @@ -4410,7 +4410,7 @@ void Compiler::fgExtendEHRegionBefore(BasicBlock* block) #endif // DEBUG // The first block of a handler has an artificial extra refcount. Transfer that to the new block. - assert(block->bbRefs > 0); + noway_assert(block->countOfInEdges() > 0); block->bbRefs--; HBtab->ebdHndBeg = bPrev; @@ -4459,7 +4459,7 @@ void Compiler::fgExtendEHRegionBefore(BasicBlock* block) #endif // DEBUG // The first block of a filter has an artificial extra refcount. Transfer that to the new block. - assert(block->bbRefs > 0); + noway_assert(block->countOfInEdges() > 0); block->bbRefs--; HBtab->ebdFilter = bPrev; diff --git a/src/coreclr/jit/lclmorph.cpp b/src/coreclr/jit/lclmorph.cpp index caa8a1bdc872d6..0ffd46f47b7845 100644 --- a/src/coreclr/jit/lclmorph.cpp +++ b/src/coreclr/jit/lclmorph.cpp @@ -210,7 +210,7 @@ class LocalAddressVisitor final : public GenTreeVisitor // Arguments: // val - the input value // field - the FIELD node that uses the input address value - // fieldSeqStore - the compiler's field sequence store + // compiler - the compiler instance // // Return Value: // `true` if the value was consumed. `false` if the input value @@ -224,8 +224,9 @@ class LocalAddressVisitor final : public GenTreeVisitor // if the offset overflows then location is not representable, must escape // - UNKNOWN => UNKNOWN // - bool Field(Value& val, GenTreeField* field, FieldSeqStore* fieldSeqStore) + bool Field(Value& val, GenTreeField* field, Compiler* compiler) { + assert(!IsLocation() && !IsAddress()); if (val.IsLocation()) @@ -246,14 +247,80 @@ class LocalAddressVisitor final : public GenTreeVisitor m_lclNum = val.m_lclNum; m_offset = newOffset.Value(); + bool haveCorrectFieldForVN; if (field->gtFldMayOverlap) { - m_fieldSeq = FieldSeqStore::NotAField(); + haveCorrectFieldForVN = false; } else { + LclVarDsc* varDsc = compiler->lvaGetDesc(m_lclNum); + if (!varTypeIsStruct(varDsc)) + { + haveCorrectFieldForVN = false; + } + else if (FieldSeqStore::IsPseudoField(field->gtFldHnd)) + { + assert(compiler->compObjectStackAllocation()); + // We use PseudoFields when accessing stack allocated classes. + haveCorrectFieldForVN = false; + } + else if (val.m_fieldSeq == nullptr) + { + + CORINFO_CLASS_HANDLE clsHnd = varDsc->GetStructHnd(); + // If the answer is no we are probably accessing a canon type with a non-canon fldHnd, + // currently it could happen in crossgen2 scenario where VM distinguishes class._field + // from class._field. + haveCorrectFieldForVN = + compiler->info.compCompHnd->doesFieldBelongToClass(field->gtFldHnd, clsHnd); + } + else + { + FieldSeqNode* lastSeqNode = val.m_fieldSeq->GetTail(); + assert(lastSeqNode != nullptr); + if (lastSeqNode->IsPseudoField() || lastSeqNode == FieldSeqStore::NotAField()) + { + haveCorrectFieldForVN = false; + } + else + { + CORINFO_FIELD_HANDLE lastFieldBeforeTheCurrent = lastSeqNode->GetFieldHandle(); + + CORINFO_CLASS_HANDLE clsHnd; + CorInfoType fieldCorType = + compiler->info.compCompHnd->getFieldType(lastFieldBeforeTheCurrent, &clsHnd); + if (fieldCorType != CORINFO_TYPE_VALUECLASS) + { + // For example, System.IntPtr:ToInt64, when inlined, creates trees like + // * FIELD long _value + // \--* ADDR byref + // \--* FIELD long Information + // \--* ADDR byref + // \--* LCL_VAR struct V08 tmp7 + haveCorrectFieldForVN = false; + } + else + { + + haveCorrectFieldForVN = + compiler->info.compCompHnd->doesFieldBelongToClass(field->gtFldHnd, clsHnd); + noway_assert(haveCorrectFieldForVN); + } + } + } + } + + if (haveCorrectFieldForVN) + { + FieldSeqStore* fieldSeqStore = compiler->GetFieldSeqStore(); m_fieldSeq = fieldSeqStore->Append(val.m_fieldSeq, fieldSeqStore->CreateSingleton(field->gtFldHnd)); } + else + { + m_fieldSeq = FieldSeqStore::NotAField(); + JITDUMP("Setting NotAField for [%06u],\n", compiler->dspTreeID(field)); + } } INDEBUG(val.Consume();) @@ -463,7 +530,7 @@ class LocalAddressVisitor final : public GenTreeVisitor assert(TopValue(1).Node() == node); assert(TopValue(0).Node() == node->AsField()->gtFldObj); - if (!TopValue(1).Field(TopValue(0), node->AsField(), m_compiler->GetFieldSeqStore())) + if (!TopValue(1).Field(TopValue(0), node->AsField(), m_compiler)) { // Either the address comes from a location value (e.g. FIELD(IND(...))) // or the field offset has overflowed. diff --git a/src/coreclr/jit/lclvars.cpp b/src/coreclr/jit/lclvars.cpp index 27771bbb7c18ce..6b7032336bd2d2 100644 --- a/src/coreclr/jit/lclvars.cpp +++ b/src/coreclr/jit/lclvars.cpp @@ -2103,8 +2103,13 @@ bool Compiler::StructPromotionHelper::ShouldPromoteStructVar(unsigned lclNum) // multiple registers? if (compiler->lvaIsMultiregStruct(varDsc, compiler->info.compIsVarArgs)) { - if ((structPromotionInfo.fieldCnt != 2) && - !((structPromotionInfo.fieldCnt == 1) && varTypeIsSIMD(structPromotionInfo.fields[0].fldType))) + if (structPromotionInfo.containsHoles && structPromotionInfo.customLayout) + { + JITDUMP("Not promoting multi-reg struct local V%02u with holes.\n", lclNum); + shouldPromote = false; + } + else if ((structPromotionInfo.fieldCnt != 2) && + !((structPromotionInfo.fieldCnt == 1) && varTypeIsSIMD(structPromotionInfo.fields[0].fldType))) { JITDUMP("Not promoting multireg struct local V%02u, because lvIsParam is true, #fields != 2 and it's " "not a single SIMD.\n", @@ -4075,6 +4080,16 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt, varDsc->incRefCnts(weight, this); +#ifdef DEBUG + if (varDsc->lvIsStructField) + { + // If ref count was increased for struct field, ensure that the + // parent struct is still promoted. + LclVarDsc* parentStruct = &lvaTable[varDsc->lvParentLcl]; + assert(!parentStruct->lvUndoneStructPromotion); + } +#endif + if (!isRecompute) { if (lvaVarAddrExposed(lclNum)) @@ -4142,8 +4157,10 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt, { bool bbInALoop = (block->bbFlags & BBF_BACKWARD_JUMP) != 0; bool bbIsReturn = block->bbJumpKind == BBJ_RETURN; - // TODO: Zero-inits in LSRA are created with below condition. Try to use similar condition here as well. - // if (compiler->info.compInitMem || varTypeIsGC(varDsc->TypeGet())) + // TODO: Zero-inits in LSRA are created with below condition. But if filter out based on that condition + // we filter lot of interesting variables that would benefit otherwise with EH var enregistration. + // bool needsExplicitZeroInit = !varDsc->lvIsParam && (info.compInitMem || + // varTypeIsGC(varDsc->TypeGet())); bool needsExplicitZeroInit = fgVarNeedsExplicitZeroInit(lclNum, bbInALoop, bbIsReturn); if (varDsc->lvSingleDefRegCandidate || needsExplicitZeroInit) diff --git a/src/coreclr/jit/liveness.cpp b/src/coreclr/jit/liveness.cpp index 745cbb9d1a9af3..6d77489248d675 100644 --- a/src/coreclr/jit/liveness.cpp +++ b/src/coreclr/jit/liveness.cpp @@ -1971,25 +1971,45 @@ void Compiler::fgComputeLifeLIR(VARSET_TP& life, BasicBlock* block, VARSET_VALAR if (blockRange.TryGetUse(node, &addrUse) && (addrUse.User()->OperIs(GT_STOREIND, GT_STORE_BLK, GT_STORE_OBJ))) { - // Remove the store. DCE will iteratively clean up any ununsed operands. GenTreeIndir* const store = addrUse.User()->AsIndir(); - JITDUMP("Removing dead indirect store:\n"); - DISPNODE(store); + // If this is a zero init of an explicit zero init gc local + // that has at least one other reference, we will keep the zero init. + // + const LclVarDsc& varDsc = lvaTable[node->AsLclVarCommon()->GetLclNum()]; + const bool isExplicitInitLocal = varDsc.lvHasExplicitInit; + const bool isReferencedLocal = varDsc.lvRefCnt() > 1; + const bool isZeroInit = store->OperIsInitBlkOp(); + const bool isGCInit = varDsc.HasGCPtr(); - assert(store->Addr() == node); - blockRange.Delete(this, block, node); - - GenTree* data = - store->OperIs(GT_STOREIND) ? store->AsStoreInd()->Data() : store->AsBlk()->Data(); - data->SetUnusedValue(); - - if (data->isIndir()) + if (isExplicitInitLocal && isReferencedLocal && isZeroInit && isGCInit) { - Lowering::TransformUnusedIndirection(data->AsIndir(), this, block); + // Yes, we'd better keep it around. + // + JITDUMP("Keeping dead indirect store -- explicit zero init of gc type\n"); + DISPNODE(store); } + else + { + // Remove the store. DCE will iteratively clean up any ununsed operands. + // + JITDUMP("Removing dead indirect store:\n"); + DISPNODE(store); + + assert(store->Addr() == node); + blockRange.Delete(this, block, node); - fgRemoveDeadStoreLIR(store, block); + GenTree* data = + store->OperIs(GT_STOREIND) ? store->AsStoreInd()->Data() : store->AsBlk()->Data(); + data->SetUnusedValue(); + + if (data->isIndir()) + { + Lowering::TransformUnusedIndirection(data->AsIndir(), this, block); + } + + fgRemoveDeadStoreLIR(store, block); + } } } } diff --git a/src/coreclr/jit/loopcloning.cpp b/src/coreclr/jit/loopcloning.cpp index 69e916c3249525..da990d9c94a820 100644 --- a/src/coreclr/jit/loopcloning.cpp +++ b/src/coreclr/jit/loopcloning.cpp @@ -968,7 +968,14 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext else if (loop->lpFlags & LPFLG_VAR_INIT) { // initVar >= 0 - LC_Condition geZero(GT_GE, LC_Expr(LC_Ident(loop->lpVarInit, LC_Ident::Var)), + const unsigned initLcl = loop->lpVarInit; + if (!genActualTypeIsInt(lvaGetDesc(initLcl))) + { + JITDUMP("> Init var V%02u not compatible with TYP_INT\n", initLcl); + return false; + } + + LC_Condition geZero(GT_GE, LC_Expr(LC_Ident(initLcl, LC_Ident::Var)), LC_Expr(LC_Ident(0, LC_Ident::Const))); context->EnsureConditions(loopNum)->Push(geZero); } @@ -992,9 +999,14 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext } else if (loop->lpFlags & LPFLG_VAR_LIMIT) { - unsigned limitLcl = loop->lpVarLimit(); - ident = LC_Ident(limitLcl, LC_Ident::Var); + const unsigned limitLcl = loop->lpVarLimit(); + if (!genActualTypeIsInt(lvaGetDesc(limitLcl))) + { + JITDUMP("> Limit var V%02u not compatible with TYP_INT\n", limitLcl); + return false; + } + ident = LC_Ident(limitLcl, LC_Ident::Var); LC_Condition geZero(GT_GE, LC_Expr(ident), LC_Expr(LC_Ident(0, LC_Ident::Const))); context->EnsureConditions(loopNum)->Push(geZero); @@ -2064,9 +2076,10 @@ bool Compiler::optIsStackLocalInvariant(unsigned loopNum, unsigned lclNum) // optExtractArrIndex: Try to extract the array index from "tree". // // Arguments: -// tree the tree to be checked if it is the array [] operation. -// result the extracted GT_INDEX information is updated in result. -// lhsNum for the root level (function is recursive) callers should pass BAD_VAR_NUM. +// tree the tree to be checked if it is the array [] operation. +// result the extracted GT_INDEX information is updated in result. +// lhsNum for the root level (function is recursive) callers should pass BAD_VAR_NUM. +// topLevelIsFinal OUT: set to `true` if see a non-TYP_REF element type array. // // Return Value: // Returns true if array index can be extracted, else, return false. See assumption about @@ -2127,7 +2140,7 @@ bool Compiler::optIsStackLocalInvariant(unsigned loopNum, unsigned lclNum) // used as an index expression, or array base var is used as the array base. This saves us from parsing // all the forms that morph can create, especially for arrays of structs. // -bool Compiler::optExtractArrIndex(GenTree* tree, ArrIndex* result, unsigned lhsNum) +bool Compiler::optExtractArrIndex(GenTree* tree, ArrIndex* result, unsigned lhsNum, bool* topLevelIsFinal) { if (tree->gtOper != GT_COMMA) { @@ -2171,37 +2184,31 @@ bool Compiler::optExtractArrIndex(GenTree* tree, ArrIndex* result, unsigned lhsN result->useBlock = compCurBB; result->rank++; + // If the array element type (saved from the GT_INDEX node during morphing) is anything but + // TYP_REF, then it must the the final level of jagged array. + assert(arrBndsChk->gtInxType != TYP_VOID); + *topLevelIsFinal = (arrBndsChk->gtInxType != TYP_REF); + return true; } //--------------------------------------------------------------------------------------------------------------- -// optReconstructArrIndex: Reconstruct array index. +// optReconstructArrIndexHelp: Helper function for optReconstructArrIndex. See that function for more details. // // Arguments: -// tree the tree to be checked if it is an array [][][] operation. -// result OUT: the extracted GT_INDEX information. -// lhsNum for the root level (function is recursive) callers should pass BAD_VAR_NUM. +// tree the tree to be checked if it is an array [][][] operation. +// result OUT: the extracted GT_INDEX information. +// lhsNum var number of array object we're looking for. +// topLevelIsFinal OUT: set to `true` if we reached a non-TYP_REF element type array. // // Return Value: // Returns true if array index can be extracted, else, return false. "rank" field in -// "result" contains the array access depth. The "indLcls" fields contain the indices. -// -// Operation: -// Recursively look for a list of array indices. For example, if the tree is -// V03 = (V05 = V00[V01]), V05[V02] -// that corresponds to access of V00[V01][V02]. The return value would then be: -// ArrIndex result { arrLcl: V00, indLcls: [V01, V02], rank: 2 } +// "result" contains the array access depth. The "indLcls" field contains the indices. // -// Note that the array expression is implied by the array bounds check under the COMMA, and the array bounds -// checks is what is parsed from the morphed tree; the array addressing expression is not parsed. -// -// Assumption: -// The method extracts only if the array base and indices are GT_LCL_VAR. -// -bool Compiler::optReconstructArrIndex(GenTree* tree, ArrIndex* result, unsigned lhsNum) +bool Compiler::optReconstructArrIndexHelp(GenTree* tree, ArrIndex* result, unsigned lhsNum, bool* topLevelIsFinal) { // If we can extract "tree" (which is a top level comma) return. - if (optExtractArrIndex(tree, result, lhsNum)) + if (optExtractArrIndex(tree, result, lhsNum, topLevelIsFinal)) { return true; } @@ -2218,18 +2225,152 @@ bool Compiler::optReconstructArrIndex(GenTree* tree, ArrIndex* result, unsigned GenTree* rhs = before->gtGetOp2(); // "rhs" should contain an GT_INDEX - if (!lhs->IsLocal() || !optReconstructArrIndex(rhs, result, lhsNum)) + if (!lhs->IsLocal() || !optReconstructArrIndexHelp(rhs, result, lhsNum, topLevelIsFinal)) + { + return false; + } + + // If rhs represents an array of elements other than arrays (e.g., an array of structs), + // then we can't go any farther. + if (*topLevelIsFinal) { return false; } + unsigned lhsNum = lhs->AsLclVarCommon()->GetLclNum(); GenTree* after = tree->gtGetOp2(); // Pass the "lhsNum", so we can verify if indeed it is used as the array base. - return optExtractArrIndex(after, result, lhsNum); + return optExtractArrIndex(after, result, lhsNum, topLevelIsFinal); } return false; } +//--------------------------------------------------------------------------------------------------------------- +// optReconstructArrIndex: Reconstruct array index from a post-morph tree. +// +// Arguments: +// tree the tree to be checked if it is an array [][][] operation. +// result OUT: the extracted GT_INDEX information. +// +// Return Value: +// Returns true if array index can be extracted, else, return false. "rank" field in +// "result" contains the array access depth. The "indLcls" field contains the indices. +// +// Operation: +// Recursively look for a list of array indices. For example, if the tree is +// V03 = (V05 = V00[V01]), V05[V02] +// that corresponds to access of V00[V01][V02]. The return value would then be: +// ArrIndex result { arrLcl: V00, indLcls: [V01, V02], rank: 2 } +// +// Note that the array expression is implied by the array bounds check under the COMMA, and the array bounds +// checks is what is parsed from the morphed tree; the array addressing expression is not parsed. +// However, the array bounds checks are not quite sufficient because of the way "morph" alters the trees. +// Specifically, we normally see a COMMA node with a LHS of the morphed array INDEX expression and RHS +// of the bounds check. E.g., for int[][], a[i][j] we have a pre-morph tree: +// +// \--* INDEX int +// +--* INDEX ref +// | +--* LCL_VAR ref V00 loc0 +// | \--* LCL_VAR int V02 loc2 +// \--* LCL_VAR int V03 loc3 +// +// and post-morph tree: +// +// \--* COMMA int +// +--* ASG ref +// | +--* LCL_VAR ref V19 tmp12 +// | \--* COMMA ref +// | +--* BOUNDS_CHECK_Rng void +// | | +--* LCL_VAR int V02 loc2 +// | | \--* ARR_LENGTH int +// | | \--* LCL_VAR ref V00 loc0 +// | \--* IND ref +// | \--* ADD byref +// | +--* LCL_VAR ref V00 loc0 +// | \--* ADD long +// | +--* LSH long +// | | +--* CAST long <- uint +// | | | \--* LCL_VAR int V02 loc2 +// | | \--* CNS_INT long 3 +// | \--* CNS_INT long 16 Fseq[#FirstElem] +// \--* COMMA int +// +--* BOUNDS_CHECK_Rng void +// | +--* LCL_VAR int V03 loc3 +// | \--* ARR_LENGTH int +// | \--* LCL_VAR ref V19 tmp12 +// \--* IND int +// \--* ADD byref +// +--* LCL_VAR ref V19 tmp12 +// \--* ADD long +// +--* LSH long +// | +--* CAST long <- uint +// | | \--* LCL_VAR int V03 loc3 +// | \--* CNS_INT long 2 +// \--* CNS_INT long 16 Fseq[#FirstElem] +// +// However, for an array of structs that contains an array field, e.g. ValueTuple[], expression +// a[i].Item1[j], +// +// \--* INDEX int +// +--* FIELD ref Item1 +// | \--* ADDR byref +// | \--* INDEX struct +// | +--* LCL_VAR ref V01 loc1 +// | \--* LCL_VAR int V04 loc4 +// \--* LCL_VAR int V06 loc6 +// +// Morph "hoists" the bounds check above the struct field access: +// +// \--* COMMA int +// +--* ASG ref +// | +--* LCL_VAR ref V23 tmp16 +// | \--* COMMA ref +// | +--* BOUNDS_CHECK_Rng void +// | | +--* LCL_VAR int V04 loc4 +// | | \--* ARR_LENGTH int +// | | \--* LCL_VAR ref V01 loc1 +// | \--* IND ref +// | \--* ADDR byref Zero Fseq[Item1] +// | \--* IND struct +// | \--* ADD byref +// | +--* LCL_VAR ref V01 loc1 +// | \--* ADD long +// | +--* LSH long +// | | +--* CAST long <- uint +// | | | \--* LCL_VAR int V04 loc4 +// | | \--* CNS_INT long 4 +// | \--* CNS_INT long 16 Fseq[#FirstElem] +// \--* COMMA int +// +--* BOUNDS_CHECK_Rng void +// | +--* LCL_VAR int V06 loc6 +// | \--* ARR_LENGTH int +// | \--* LCL_VAR ref V23 tmp16 +// \--* IND int +// \--* ADD byref +// +--* LCL_VAR ref V23 tmp16 +// \--* ADD long +// +--* LSH long +// | +--* CAST long <- uint +// | | \--* LCL_VAR int V06 loc6 +// | \--* CNS_INT long 2 +// \--* CNS_INT long 16 Fseq[#FirstElem] +// +// This should not be parsed as a jagged array (e.g., a[i][j]). To ensure that it is not, the type of the +// GT_INDEX node is stashed in the GT_BOUNDS_CHECK node during morph. If we see a bounds check node where +// the GT_INDEX was not TYP_REF, then it must be the outermost jagged array level. E.g., if it is +// TYP_STRUCT, then we have an array of structs, and any further bounds checks must be of one of its fields. +// +// It would be much better if we didn't need to parse these trees at all, and did all this work pre-morph. +// +// Assumption: +// The method extracts only if the array base and indices are GT_LCL_VAR. +// +bool Compiler::optReconstructArrIndex(GenTree* tree, ArrIndex* result) +{ + bool topLevelIsFinal = false; + return optReconstructArrIndexHelp(tree, result, BAD_VAR_NUM, &topLevelIsFinal); +} + //---------------------------------------------------------------------------------------------- // optCanOptimizeByLoopCloning: Check if the tree can be optimized by loop cloning and if so, // identify as potential candidate and update the loop context. @@ -2253,7 +2394,7 @@ Compiler::fgWalkResult Compiler::optCanOptimizeByLoopCloning(GenTree* tree, Loop ArrIndex arrIndex(getAllocator(CMK_LoopClone)); // Check if array index can be optimized. - if (optReconstructArrIndex(tree, &arrIndex, BAD_VAR_NUM)) + if (optReconstructArrIndex(tree, &arrIndex)) { assert(tree->gtOper == GT_COMMA); diff --git a/src/coreclr/jit/lower.cpp b/src/coreclr/jit/lower.cpp index 08cbc8b0ad0d37..f0c735771e620b 100644 --- a/src/coreclr/jit/lower.cpp +++ b/src/coreclr/jit/lower.cpp @@ -2984,9 +2984,8 @@ void Lowering::LowerRet(GenTreeUnOp* ret) // There are two kinds of retyping: // - A simple bitcast can be inserted when: // - We're returning a floating type as an integral type or vice-versa, or - // - We're returning a struct as a primitive type and using the old form of retyping. - // - If we're returning a struct as a primitive type and *not* using old retying, we change the type of - // 'retval' in 'LowerRetStructLclVar()' + // - If we're returning a struct as a primitive type, we change the type of + // 'retval' in 'LowerRetStructLclVar()' bool needBitcast = (ret->TypeGet() != TYP_VOID) && (varTypeUsesFloatReg(ret) != varTypeUsesFloatReg(ret->gtGetOp1())); bool doPrimitiveBitcast = false; @@ -3296,15 +3295,15 @@ void Lowering::LowerRetStruct(GenTreeUnOp* ret) assert(ret->OperIs(GT_RETURN)); assert(varTypeIsStruct(ret)); - GenTree* retVal = ret->gtGetOp1(); + GenTree* retVal = ret->gtGetOp1(); + var_types nativeReturnType = comp->info.compRetNativeType; // Note: small types are returned as INT. - var_types nativeReturnType = genActualType(comp->info.compRetNativeType); - ret->ChangeType(nativeReturnType); + ret->ChangeType(genActualType(nativeReturnType)); switch (retVal->OperGet()) { case GT_CALL: - assert(retVal->TypeIs(nativeReturnType)); // Type should be changed during call processing. + assert(retVal->TypeIs(genActualType(nativeReturnType))); // Type should be changed during call processing. break; case GT_CNS_INT: @@ -3408,6 +3407,7 @@ void Lowering::LowerRetSingleRegStructLclVar(GenTreeUnOp* ret) unsigned lclNum = lclVar->GetLclNum(); LclVarDsc* varDsc = comp->lvaGetDesc(lclNum); + bool replacedInLowering = false; if (varDsc->CanBeReplacedWithItsField(comp)) { // We can replace the struct with its only field and keep the field on a register. @@ -3420,8 +3420,9 @@ void Lowering::LowerRetSingleRegStructLclVar(GenTreeUnOp* ret) "[%06u]\n", lclNum, fieldLclNum, comp->dspTreeID(ret)); lclVar->ChangeType(fieldDsc->lvType); - lclNum = fieldLclNum; - varDsc = comp->lvaGetDesc(lclNum); + lclNum = fieldLclNum; + varDsc = comp->lvaGetDesc(lclNum); + replacedInLowering = true; } else if (varDsc->lvPromoted) { @@ -3434,18 +3435,49 @@ void Lowering::LowerRetSingleRegStructLclVar(GenTreeUnOp* ret) { lclVar->ChangeOper(GT_LCL_FLD); lclVar->AsLclFld()->SetLclOffs(0); - lclVar->ChangeType(ret->TypeGet()); + + // We are returning as a primitive type and the lcl is of struct type. + assert(comp->info.compRetNativeType != TYP_STRUCT); + assert((genTypeSize(comp->info.compRetNativeType) == genTypeSize(ret)) || + (varTypeIsIntegral(ret) && varTypeIsIntegral(comp->info.compRetNativeType) && + (genTypeSize(comp->info.compRetNativeType) <= genTypeSize(ret)))); + // If the actual return type requires normalization, then make sure we + // do so by using the correct small type for the GT_LCL_FLD. It would + // be conservative to check just compRetNativeType for this since small + // structs are normalized to primitive types when they are returned in + // registers, so we would normalize for them as well. + if (varTypeIsSmall(comp->info.compRetType)) + { + assert(genTypeSize(comp->info.compRetNativeType) == genTypeSize(comp->info.compRetType)); + lclVar->ChangeType(comp->info.compRetType); + } + else + { + // Otherwise we don't mind that we leave the upper bits undefined. + lclVar->ChangeType(ret->TypeGet()); + } } else { const var_types lclVarType = varDsc->GetRegisterType(lclVar); assert(lclVarType != TYP_UNDEF); + + if (varDsc->lvNormalizeOnLoad() && replacedInLowering) + { + // For a normalize-on-load var that we replaced late we need to insert a cast + // as morph would typically be responsible for this. + GenTreeCast* cast = comp->gtNewCastNode(TYP_INT, lclVar, false, lclVarType); + ret->gtOp1 = cast; + BlockRange().InsertBefore(ret, cast); + ContainCheckCast(cast); + } + const var_types actualType = genActualType(lclVarType); lclVar->ChangeType(actualType); if (varTypeUsesFloatReg(ret) != varTypeUsesFloatReg(lclVarType)) { - GenTree* bitcast = comp->gtNewBitCastNode(ret->TypeGet(), lclVar); + GenTree* bitcast = comp->gtNewBitCastNode(ret->TypeGet(), ret->gtOp1); ret->gtOp1 = bitcast; BlockRange().InsertBefore(ret, bitcast); ContainCheckBitCast(bitcast); diff --git a/src/coreclr/jit/lsra.cpp b/src/coreclr/jit/lsra.cpp index 9491b2c0773578..723e363f0fa810 100644 --- a/src/coreclr/jit/lsra.cpp +++ b/src/coreclr/jit/lsra.cpp @@ -4945,6 +4945,13 @@ void LinearScan::allocateRegisters() // it to a different register file. allocate = false; } + else if ((currentInterval->isWriteThru) && (refType == RefTypeZeroInit)) + { + // For RefTypeZeroInit which is a write thru, there is no need to allocate register + // right away. It can be assigned when actually definition occurs. + // In future, see if avoiding allocation for RefTypeZeroInit gives any benefit in general. + allocate = false; + } if (!allocate) { INDEBUG(dumpLsraAllocationEvent(LSRA_EVENT_NO_ENTRY_REG_ALLOCATED, currentInterval)); @@ -5200,7 +5207,6 @@ void LinearScan::allocateRegisters() if (physRegRecord->assignedInterval == currentInterval) { unassignPhysRegNoSpill(physRegRecord); - physRegRecord->assignedInterval = nullptr; clearConstantReg(assignedRegister, currentInterval->registerType); } currentRefPosition->moveReg = true; diff --git a/src/coreclr/jit/lsraarm64.cpp b/src/coreclr/jit/lsraarm64.cpp index a7a14fdfe54f96..88644ead77225f 100644 --- a/src/coreclr/jit/lsraarm64.cpp +++ b/src/coreclr/jit/lsraarm64.cpp @@ -1132,7 +1132,8 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree) { // If the index is not a constant or op1 is in register, // we will use the SIMD temp location to store the vector. - compiler->getSIMDInitTempVarNum(); + var_types requiredSimdTempType = (intrin.id == NI_Vector64_GetElement) ? TYP_SIMD8 : TYP_SIMD16; + compiler->getSIMDInitTempVarNum(requiredSimdTempType); } } diff --git a/src/coreclr/jit/lsrabuild.cpp b/src/coreclr/jit/lsrabuild.cpp index cf11833a1f356a..3214c67ac17737 100644 --- a/src/coreclr/jit/lsrabuild.cpp +++ b/src/coreclr/jit/lsrabuild.cpp @@ -3413,6 +3413,8 @@ int LinearScan::BuildStoreLoc(GenTreeLclVarCommon* storeLoc) { // Need an additional register to create a SIMD8 from EAX/EDX without SSE4.1. buildInternalFloatRegisterDefForNode(storeLoc, allSIMDRegs()); + // This internal register must be different from the target register. + setInternalRegsDelayFree = true; } } #endif // FEATURE_SIMD && TARGET_X86 && TARGET_WINDOWS diff --git a/src/coreclr/jit/lsraxarch.cpp b/src/coreclr/jit/lsraxarch.cpp index f4401828f8ad21..5ccb43dbdd7a41 100644 --- a/src/coreclr/jit/lsraxarch.cpp +++ b/src/coreclr/jit/lsraxarch.cpp @@ -2201,7 +2201,8 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree) { // If the index is not a constant or op1 is in register, // we will use the SIMD temp location to store the vector. - compiler->getSIMDInitTempVarNum(); + var_types requiredSimdTempType = (intrinsicId == NI_Vector128_GetElement) ? TYP_SIMD16 : TYP_SIMD32; + compiler->getSIMDInitTempVarNum(requiredSimdTempType); } break; } diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 2ff290263c2798..b7ee483fcb09e9 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -5659,6 +5659,7 @@ GenTree* Compiler::fgMorphArrayIndex(GenTree* tree) GenTreeBoundsChk* arrBndsChk = new (this, GT_ARR_BOUNDS_CHECK) GenTreeBoundsChk(GT_ARR_BOUNDS_CHECK, TYP_VOID, index, arrLen, SCK_RNGCHK_FAIL); + arrBndsChk->gtInxType = elemTyp; bndsChk = arrBndsChk; @@ -7896,6 +7897,15 @@ GenTree* Compiler::fgMorphPotentialTailCall(GenTreeCall* call) // Avoid potential extra work for the return (for example, vzeroupper) call->gtType = TYP_VOID; + // The runtime requires that we perform a null check on the `this` argument before + // tail calling to a virtual dispatch stub. This requirement is a consequence of limitations + // in the runtime's ability to map an AV to a NullReferenceException if + // the AV occurs in a dispatch stub that has unmanaged caller. + if (call->IsVirtualStub()) + { + call->gtFlags |= GTF_CALL_NULLCHECK; + } + // Do some target-specific transformations (before we process the args, // etc.) for the JIT helper case. if (tailCallViaJitHelper) @@ -8622,15 +8632,6 @@ void Compiler::fgMorphTailCallViaJitHelper(GenTreeCall* call) JITDUMP("fgMorphTailCallViaJitHelper (before):\n"); DISPTREE(call); - // The runtime requires that we perform a null check on the `this` argument before - // tail calling to a virtual dispatch stub. This requirement is a consequence of limitations - // in the runtime's ability to map an AV to a NullReferenceException if - // the AV occurs in a dispatch stub that has unmanaged caller. - if (call->IsVirtualStub()) - { - call->gtFlags |= GTF_CALL_NULLCHECK; - } - // For the helper-assisted tail calls, we need to push all the arguments // into a single list, and then add a few extra at the beginning or end. // @@ -13177,6 +13178,7 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac) GenTree* newOp2 = gtNewIconNode(-constVal, op1op2->TypeGet()); // -C mulOrDiv->gtOp1 = newOp1; mulOrDiv->gtOp2 = newOp2; + mulOrDiv->SetVNsFromNode(tree); DEBUG_DESTROY_NODE(tree); DEBUG_DESTROY_NODE(op1op2); @@ -13996,6 +13998,12 @@ GenTree* Compiler::fgMorphRetInd(GenTreeUnOp* ret) if (addr->OperIs(GT_ADDR) && addr->gtGetOp1()->OperIs(GT_LCL_VAR)) { + // If struct promotion was undone, adjust the annotations + if (fgGlobalMorph && fgMorphImplicitByRefArgs(addr)) + { + return ind; + } + // If `return` retypes LCL_VAR as a smaller struct it should not set `doNotEnregister` on that // LclVar. // Example: in `Vector128:AsVector2` we have RETURN SIMD8(OBJ SIMD8(ADDR byref(LCL_VAR SIMD16))). @@ -14036,6 +14044,14 @@ GenTree* Compiler::fgMorphRetInd(GenTreeUnOp* ret) // long<->double` there. bool canFold = (indSize == lclVarSize) && (lclVarSize <= REGSIZE_BYTES); #endif + + // Avoid folding primitives to a struct-typed local for cases where we would maybe need to insert normalization on top. + // The backend does not correctly handle this for some promoted locals. + if (varTypeIsSmall(info.compRetType) && lclVar->TypeIs(TYP_STRUCT)) + { + canFold = false; + } + // TODO: support `genReturnBB != nullptr`, it requires #11413 to avoid `Incompatible types for // gtNewTempAssign`. if (canFold && (genReturnBB == nullptr)) @@ -17661,6 +17677,8 @@ void Compiler::fgRetypeImplicitByRefArgs() void Compiler::fgMarkDemotedImplicitByRefArgs() { + JITDUMP("\n*************** In fgMarkDemotedImplicitByRefArgs()\n"); + #if (defined(TARGET_AMD64) && !defined(UNIX_AMD64_ABI)) || defined(TARGET_ARM64) for (unsigned lclNum = 0; lclNum < info.compArgsCount; lclNum++) @@ -17669,6 +17687,8 @@ void Compiler::fgMarkDemotedImplicitByRefArgs() if (lvaIsImplicitByRefLocal(lclNum)) { + JITDUMP("Clearing annotation for V%02d\n", lclNum); + if (varDsc->lvPromoted) { // The parameter is simply a pointer now, so clear lvPromoted. It was left set @@ -17695,7 +17715,8 @@ void Compiler::fgMarkDemotedImplicitByRefArgs() LclVarDsc* structVarDsc = &lvaTable[structLclNum]; structVarDsc->lvAddrExposed = false; #ifdef DEBUG - structVarDsc->lvUnusedStruct = true; + structVarDsc->lvUnusedStruct = true; + structVarDsc->lvUndoneStructPromotion = true; #endif // DEBUG unsigned fieldLclStart = structVarDsc->lvFieldLclStart; @@ -17704,6 +17725,8 @@ void Compiler::fgMarkDemotedImplicitByRefArgs() for (unsigned fieldLclNum = fieldLclStart; fieldLclNum < fieldLclStop; ++fieldLclNum) { + JITDUMP("Fixing pointer for field V%02d from V%02d to V%02d\n", fieldLclNum, lclNum, structLclNum); + // Fix the pointer to the parent local. LclVarDsc* fieldVarDsc = &lvaTable[fieldLclNum]; assert(fieldVarDsc->lvParentLcl == lclNum); diff --git a/src/coreclr/jit/objectalloc.cpp b/src/coreclr/jit/objectalloc.cpp index 720ec2585c4d61..0d21c1ab6104db 100644 --- a/src/coreclr/jit/objectalloc.cpp +++ b/src/coreclr/jit/objectalloc.cpp @@ -481,6 +481,11 @@ GenTree* ObjectAllocator::MorphAllocObjNodeIntoHelperCall(GenTreeAllocObj* alloc assert(comp->opts.IsReadyToRun()); helperCall->AsCall()->setEntryPoint(entryPoint); } + else + { + assert(helper != CORINFO_HELP_READYTORUN_NEW); // If this is true, then we should have collected a non-null + // entrypoint above + } #endif return helperCall; diff --git a/src/coreclr/jit/optimizer.cpp b/src/coreclr/jit/optimizer.cpp index fd17d74e4d0899..74f9cbfe1f3da2 100644 --- a/src/coreclr/jit/optimizer.cpp +++ b/src/coreclr/jit/optimizer.cpp @@ -1928,13 +1928,26 @@ class LoopSearch // This blocks is lexically between TOP and BOTTOM, but it does not // participate in the flow cycle. Check for a run of consecutive // such blocks. + // + // If blocks have been reordered and bbNum no longer reflects bbNext ordering + // (say by a call to MakeCompactAndFindExits for an earlier loop or unsuccessful + // attempt to find a loop), the bottom block of this loop may now appear earlier + // in the bbNext chain than other loop blocks. So when the previous hasn't reached bottom + // and block is a non-loop block, and we walk the bbNext chain, we may reach the end. + // If so, give up on recognition of this loop. + // BasicBlock* lastNonLoopBlock = block; BasicBlock* nextLoopBlock = block->bbNext; - while (!loopBlocks.IsMember(nextLoopBlock->bbNum)) + while ((nextLoopBlock != nullptr) && !loopBlocks.IsMember(nextLoopBlock->bbNum)) { lastNonLoopBlock = nextLoopBlock; nextLoopBlock = nextLoopBlock->bbNext; - // This loop must terminate because we know BOTTOM is in loopBlocks. + } + + if (nextLoopBlock == nullptr) + { + JITDUMP("Did not find expected loop block when walking from " FMT_BB "\n", lastNonLoopBlock->bbNum); + return false; } // Choose an insertion point for non-loop blocks if we haven't yet done so. @@ -9033,7 +9046,7 @@ void Compiler::optRemoveRedundantZeroInits() // the prolog and this explicit intialization. Therefore, it doesn't // require zero initialization in the prolog. lclDsc->lvHasExplicitInit = 1; - JITDUMP("Marking L%02u as having an explicit init\n", lclNum); + JITDUMP("Marking V%02u as having an explicit init\n", lclNum); } } break; diff --git a/src/coreclr/jit/redundantbranchopts.cpp b/src/coreclr/jit/redundantbranchopts.cpp index 55568c3c74313e..6c96e96d5f761e 100644 --- a/src/coreclr/jit/redundantbranchopts.cpp +++ b/src/coreclr/jit/redundantbranchopts.cpp @@ -106,9 +106,11 @@ bool Compiler::optRedundantBranch(BasicBlock* const block) // Walk up the dom tree and see if any dominating block has branched on // exactly this tree's VN... // - BasicBlock* prevBlock = block; - BasicBlock* domBlock = block->bbIDom; - int relopValue = -1; + BasicBlock* prevBlock = block; + BasicBlock* domBlock = block->bbIDom; + int relopValue = -1; + unsigned matchCount = 0; + const unsigned matchLimit = 4; if (domBlock == nullptr) { @@ -140,6 +142,16 @@ bool Compiler::optRedundantBranch(BasicBlock* const block) // if (domCmpVN == tree->GetVN(VNK_Liberal)) { + // If we have a long skinny dominator tree we may scale poorly, + // and in particular reachability (below) is costly. Give up if + // we've matched a few times and failed to optimize. + // + if (++matchCount > matchLimit) + { + JITDUMP("Bailing out; %d matches found w/o optimizing\n", matchCount); + return false; + } + // The compare in "tree" is redundant. // Is there a unique path from the dominating compare? // diff --git a/src/coreclr/jit/simd.cpp b/src/coreclr/jit/simd.cpp index 2eb0fca532ca85..ef5e482df31139 100644 --- a/src/coreclr/jit/simd.cpp +++ b/src/coreclr/jit/simd.cpp @@ -107,6 +107,34 @@ int Compiler::getSIMDTypeAlignment(var_types simdType) #endif } +//------------------------------------------------------------------------ +// Get, and allocate if necessary, the SIMD temp used for various operations. +// The temp is allocated as the maximum sized type of all operations required. +// +// Arguments: +// simdType - Required SIMD type +// +// Returns: +// The temp number +// +unsigned Compiler::getSIMDInitTempVarNum(var_types simdType) +{ + if (lvaSIMDInitTempVarNum == BAD_VAR_NUM) + { + JITDUMP("Allocating SIMDInitTempVar as %s\n", varTypeName(simdType)); + lvaSIMDInitTempVarNum = lvaGrabTempWithImplicitUse(false DEBUGARG("SIMDInitTempVar")); + lvaTable[lvaSIMDInitTempVarNum].lvType = simdType; + } + else if (genTypeSize(lvaTable[lvaSIMDInitTempVarNum].lvType) < genTypeSize(simdType)) + { + // We want the largest required type size for the temp. + JITDUMP("Increasing SIMDInitTempVar type size from %s to %s\n", + varTypeName(lvaTable[lvaSIMDInitTempVarNum].lvType), varTypeName(simdType)); + lvaTable[lvaSIMDInitTempVarNum].lvType = simdType; + } + return lvaSIMDInitTempVarNum; +} + //---------------------------------------------------------------------------------- // Return the base type and size of SIMD vector type given its type handle. // diff --git a/src/coreclr/jit/valuenum.cpp b/src/coreclr/jit/valuenum.cpp index 0e924073112cda..4a77cb41a524d7 100644 --- a/src/coreclr/jit/valuenum.cpp +++ b/src/coreclr/jit/valuenum.cpp @@ -4242,11 +4242,12 @@ ValueNum Compiler::fgValueNumberArrIndexVal(GenTree* tree, var_types elemTyp = DecodeElemType(elemTypeEq); var_types indType = (tree == nullptr) ? elemTyp : tree->TypeGet(); ValueNum selectedElem; + unsigned elemWidth = elemTyp == TYP_STRUCT ? info.compCompHnd->getClassSize(elemTypeEq) : genTypeSize(elemTyp); - if (fldSeq == FieldSeqStore::NotAField()) + if ((fldSeq == FieldSeqStore::NotAField()) || (genTypeSize(indType) > elemWidth)) { // This doesn't represent a proper array access - JITDUMP(" *** NotAField sequence encountered in fgValueNumberArrIndexVal\n"); + JITDUMP(" *** Not a proper arrray access encountered in fgValueNumberArrIndexVal\n"); // a new unique value number selectedElem = vnStore->VNForExpr(compCurBB, elemTyp); @@ -5789,6 +5790,7 @@ static genTreeOps genTreeOpsIllegalAsVNFunc[] = {GT_IND, // When we do heap memo GT_OBJ, // May reference heap memory. GT_BLK, // May reference heap memory. GT_INIT_VAL, // Not strictly a pass-through. + GT_LEA, // Needs to encode scale/offset. .NET7+ has no LEA in HIR. // These control-flow operations need no values. GT_JTRUE, GT_RETURN, GT_SWITCH, GT_RETFILT, GT_CKFINITE}; @@ -7116,6 +7118,7 @@ void Compiler::fgValueNumberBlockAssignment(GenTree* tree) unsigned lhsLclNum = lclVarTree->GetLclNum(); FieldSeqNode* lhsFldSeq = nullptr; unsigned lclDefSsaNum = GetSsaNumForLocalVarDef(lclVarTree); + LclVarDsc* lhsVarDsc = lvaGetDesc(lhsLclNum); // If it's excluded from SSA, don't need to do anything. if (lvaInSsa(lhsLclNum) && lclDefSsaNum != SsaConfig::RESERVED_SSA_NUM) { @@ -7176,9 +7179,7 @@ void Compiler::fgValueNumberBlockAssignment(GenTree* tree) } else { - rhsVNPair = lvaTable[rhsLclVarTree->GetLclNum()] - .GetPerSsaData(rhsLclVarTree->GetSsaNum()) - ->m_vnPair; + rhsVNPair = rhsVarDsc->GetPerSsaData(rhsLclVarTree->GetSsaNum())->m_vnPair; var_types indType = rhsLclVarTree->TypeGet(); rhsVNPair = vnStore->VNPairApplySelectors(rhsVNPair, rhsFldSeq, indType); @@ -7186,7 +7187,6 @@ void Compiler::fgValueNumberBlockAssignment(GenTree* tree) } else { - rhsVNPair.SetBoth(vnStore->VNForExpr(compCurBB, rhs->TypeGet())); isNewUniq = true; } } @@ -7205,9 +7205,7 @@ void Compiler::fgValueNumberBlockAssignment(GenTree* tree) } else { - rhsVNPair = lvaTable[rhsLclVarTree->GetLclNum()] - .GetPerSsaData(rhsLclVarTree->GetSsaNum()) - ->m_vnPair; + rhsVNPair = rhsVarDsc->GetPerSsaData(rhsLclVarTree->GetSsaNum())->m_vnPair; var_types indType = rhsLclVarTree->TypeGet(); rhsVNPair = vnStore->VNPairApplySelectors(rhsVNPair, rhsFldSeq, indType); @@ -7273,6 +7271,11 @@ void Compiler::fgValueNumberBlockAssignment(GenTree* tree) isNewUniq = true; } + if (!isNewUniq && (lclVarTree != nullptr) && (rhsLclVarTree != nullptr)) + { + isNewUniq = fgValueNumberIsStructReinterpretation(lclVarTree, rhsLclVarTree); + } + if (isNewUniq) { rhsVNPair.SetBoth(vnStore->VNForExpr(compCurBB, lclVarTree->TypeGet())); @@ -7293,14 +7296,13 @@ void Compiler::fgValueNumberBlockAssignment(GenTree* tree) } else { - ValueNumPair oldLhsVNPair = - lvaTable[lhsLclNum].GetPerSsaData(lclVarTree->GetSsaNum())->m_vnPair; + ValueNumPair oldLhsVNPair = lhsVarDsc->GetPerSsaData(lclVarTree->GetSsaNum())->m_vnPair; rhsVNPair = vnStore->VNPairApplySelectorsAssign(oldLhsVNPair, lhsFldSeq, rhsVNPair, lclVarTree->TypeGet(), compCurBB); } } - lvaTable[lhsLclNum].GetPerSsaData(lclDefSsaNum)->m_vnPair = vnStore->VNPNormalPair(rhsVNPair); + lhsVarDsc->GetPerSsaData(lclDefSsaNum)->m_vnPair = vnStore->VNPNormalPair(rhsVNPair); #ifdef DEBUG if (verbose) @@ -7338,6 +7340,67 @@ void Compiler::fgValueNumberBlockAssignment(GenTree* tree) } } +//------------------------------------------------------------------------ +// fgValueNumberIsStructReinterpretation: Checks if there is a struct reinterpretation that prevent VN propagation. +// +// Arguments: +// lhsLclVarTree - a lcl var tree on the lhs of the asg; +// rhsLclVarTree - a lcl var tree on the rhs of the asg; +// +// Return Value: +// True if the locals have different struct types and VN can't use rhs VN for lhs VN. +// False if locals have the same struct type or if this ASG is not a struct ASG. +// +bool Compiler::fgValueNumberIsStructReinterpretation(GenTreeLclVarCommon* lhsLclVarTree, + GenTreeLclVarCommon* rhsLclVarTree) +{ + assert(lhsLclVarTree != nullptr); + assert(rhsLclVarTree != nullptr); + + if (rhsLclVarTree->TypeGet() == TYP_STRUCT) + { + if (rhsLclVarTree->TypeGet() == lhsLclVarTree->TypeGet()) + { + if (lhsLclVarTree->isLclField() || rhsLclVarTree->isLclField()) + { + // Jit does not have a real support for `LCL_FLD struct [FldSeq]` because it can't determinate their + // size + // when the fieldSeq is `NotAField`, but by mistake we could have + // `BLK(ADDR byref(LCL_FLD struct Fseq[]))` nowadays in out IR. + // Generate a unique VN for now, it currently won't match the other side, + // otherwise we would not have 'OBJ struct2 (ADDR(LCL_FLD struct1))` cast. + return true; + } + + assert(lhsLclVarTree->OperIs(GT_LCL_VAR)); + assert(rhsLclVarTree->OperIs(GT_LCL_VAR)); + + const LclVarDsc* lhsVarDsc = lvaGetDesc(lhsLclVarTree); + const LclVarDsc* rhsVarDsc = lvaGetDesc(rhsLclVarTree); + assert(rhsVarDsc->TypeGet() == TYP_STRUCT); + assert(lhsVarDsc->TypeGet() == TYP_STRUCT); + + CORINFO_CLASS_HANDLE rhsStructHnd = rhsVarDsc->GetStructHnd(); + CORINFO_CLASS_HANDLE lhsStructHnd = lhsVarDsc->GetStructHnd(); + + if (rhsStructHnd != lhsStructHnd) + { + // This can occur for nested structs or for unsafe casts, when we have IR like + // struct1 = struct2. + // Use an unique value number for the old map, as we don't have information about + // the dst field values using dst FIELD_HANDLE. + // Note that other asignments, like struct1 = IND struct(ADDR(LCL_VAR long)) + // will be handled in `VNPairApplySelectorsAssign`, here we care only about + // `LCL_VAR structX = (*)LCL_VAR structY` cases. + JITDUMP(" *** Different struct handles for Dst/Src of COPYBLK\n"); + return true; + } + } + } + + return false; +} + void Compiler::fgValueNumberTree(GenTree* tree) { genTreeOps oper = tree->OperGet(); @@ -7989,12 +8052,10 @@ void Compiler::fgValueNumberTree(GenTree* tree) rhsVNPair.SetBoth(vnStore->VNForExpr(compCurBB, lclVarTree->TypeGet())); } - unsigned lclDefSsaNum; ValueNumPair newLhsVNPair; if (isEntire) { newLhsVNPair = rhsVNPair; - lclDefSsaNum = lclVarTree->GetSsaNum(); } else { @@ -8003,12 +8064,13 @@ void Compiler::fgValueNumberTree(GenTree* tree) ValueNumPair oldLhsVNPair = lvaTable[lclVarTree->GetLclNum()] .GetPerSsaData(lclVarTree->GetSsaNum()) ->m_vnPair; - lclDefSsaNum = GetSsaNumForLocalVarDef(lclVarTree); newLhsVNPair = vnStore->VNPairApplySelectorsAssign(oldLhsVNPair, fieldSeq, rhsVNPair, lhs->TypeGet(), compCurBB); } + unsigned lclDefSsaNum = GetSsaNumForLocalVarDef(lclVarTree); + if (lclDefSsaNum != SsaConfig::RESERVED_SSA_NUM) { lvaTable[lclNum].GetPerSsaData(lclDefSsaNum)->m_vnPair = newLhsVNPair; @@ -9764,25 +9826,25 @@ VNFunc Compiler::fgValueNumberJitHelperMethodVNFunc(CorInfoHelpFunc helpFunc) vnf = VNF_Dbl2Int; break; case CORINFO_HELP_DBL2INT_OVF: - vnf = VNF_Dbl2Int; + vnf = VNF_Dbl2IntOvf; break; case CORINFO_HELP_DBL2LNG: vnf = VNF_Dbl2Lng; break; case CORINFO_HELP_DBL2LNG_OVF: - vnf = VNF_Dbl2Lng; + vnf = VNF_Dbl2LngOvf; break; case CORINFO_HELP_DBL2UINT: vnf = VNF_Dbl2UInt; break; case CORINFO_HELP_DBL2UINT_OVF: - vnf = VNF_Dbl2UInt; + vnf = VNF_Dbl2UIntOvf; break; case CORINFO_HELP_DBL2ULNG: vnf = VNF_Dbl2ULng; break; case CORINFO_HELP_DBL2ULNG_OVF: - vnf = VNF_Dbl2ULng; + vnf = VNF_Dbl2ULngOvf; break; case CORINFO_HELP_FLTREM: vnf = VNFunc(GT_MOD); diff --git a/src/coreclr/jit/valuenumfuncs.h b/src/coreclr/jit/valuenumfuncs.h index 6b5c89bbbbf485..6b2fa5236f3a17 100644 --- a/src/coreclr/jit/valuenumfuncs.h +++ b/src/coreclr/jit/valuenumfuncs.h @@ -75,6 +75,10 @@ ValueNumFuncDef(Dbl2Int, 1, false, false, false) ValueNumFuncDef(Dbl2UInt, 1, false, false, false) ValueNumFuncDef(Dbl2Lng, 1, false, false, false) ValueNumFuncDef(Dbl2ULng, 1, false, false, false) +ValueNumFuncDef(Dbl2IntOvf, 1, false, false, false) +ValueNumFuncDef(Dbl2UIntOvf, 1, false, false, false) +ValueNumFuncDef(Dbl2LngOvf, 1, false, false, false) +ValueNumFuncDef(Dbl2ULngOvf, 1, false, false, false) ValueNumFuncDef(FltRound, 1, false, false, false) ValueNumFuncDef(DblRound, 1, false, false, false) diff --git a/src/coreclr/md/enc/pdbheap.cpp b/src/coreclr/md/enc/pdbheap.cpp index 962472ac65a2e0..a95cf4ccefd6da 100644 --- a/src/coreclr/md/enc/pdbheap.cpp +++ b/src/coreclr/md/enc/pdbheap.cpp @@ -26,6 +26,16 @@ HRESULT PdbHeap::SetData(PORT_PDB_STREAM* data) (sizeof(ULONG) * data->typeSystemTableRowsSize); m_data = new BYTE[m_size]; +#if BIGENDIAN + PORT_PDB_STREAM swappedData = *data; + SwapGuid(&swappedData.id.pdbGuid); + swappedData.id.pdbTimeStamp = VAL32(swappedData.id.pdbTimeStamp); + swappedData.entryPoint = VAL32(swappedData.entryPoint); + swappedData.referencedTypeSystemTables = VAL64(swappedData.referencedTypeSystemTables); + // typeSystemTableRows and typeSystemTableRowsSize handled below + data = &swappedData; +#endif + ULONG offset = 0; if (memcpy_s(m_data + offset, m_size, &data->id, sizeof(data->id))) return E_FAIL; @@ -39,9 +49,17 @@ HRESULT PdbHeap::SetData(PORT_PDB_STREAM* data) return E_FAIL; offset += sizeof(data->referencedTypeSystemTables); +#if !BIGENDIAN if (memcpy_s(m_data + offset, m_size, data->typeSystemTableRows, sizeof(ULONG) * data->typeSystemTableRowsSize)) return E_FAIL; offset += sizeof(ULONG) * data->typeSystemTableRowsSize; +#else + for (int i = 0; i < data->typeSystemTableRowsSize; i++) + { + SET_UNALIGNED_VAL32(m_data + offset, data->typeSystemTableRows[i]); + offset += sizeof(ULONG); + } +#endif _ASSERTE(offset == m_size); diff --git a/src/coreclr/pal/inc/pal.h b/src/coreclr/pal/inc/pal.h index cd96f5753cc8fd..c17811b0853d81 100644 --- a/src/coreclr/pal/inc/pal.h +++ b/src/coreclr/pal/inc/pal.h @@ -432,13 +432,22 @@ PALAPI PAL_SetShutdownCallback( IN PSHUTDOWN_CALLBACK callback); +// Must be the same as the copy in excep.h and the WriteDumpFlags enum in the diagnostics repo +enum +{ + GenerateDumpFlagsNone = 0x00, + GenerateDumpFlagsLoggingEnabled = 0x01, + GenerateDumpFlagsVerboseLoggingEnabled = 0x02, + GenerateDumpFlagsCrashReportEnabled = 0x04 +}; + PALIMPORT BOOL PALAPI PAL_GenerateCoreDump( IN LPCSTR dumpName, IN INT dumpType, - IN BOOL diag); + IN ULONG32 flags); typedef VOID (*PPAL_STARTUP_CALLBACK)( char *modulePath, @@ -2405,6 +2414,7 @@ PALIMPORT size_t PALAPI PAL_GetLogicalProcessorCacheSizeFromOS(); +#define GetLogicalProcessorCacheSizeFromOS PAL_GetLogicalProcessorCacheSizeFromOS typedef BOOL(*UnwindReadMemoryCallback)(PVOID address, PVOID buffer, SIZE_T size); @@ -2412,7 +2422,7 @@ PALIMPORT BOOL PALAPI PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_P PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers, PULONG64 functionStart, SIZE_T baseAddress, UnwindReadMemoryCallback readMemoryCallback); -#define GetLogicalProcessorCacheSizeFromOS PAL_GetLogicalProcessorCacheSizeFromOS +PALIMPORT BOOL PALAPI PAL_GetUnwindInfoSize(SIZE_T baseAddress, ULONG64 ehFrameHdrAddr, UnwindReadMemoryCallback readMemoryCallback, PULONG64 ehFrameStart, PULONG64 ehFrameSize); /* PAL_CS_NATIVE_DATA_SIZE is defined as sizeof(PAL_CRITICAL_SECTION_NATIVE_DATA) */ @@ -4082,15 +4092,11 @@ inline WCHAR *PAL_wcsstr(WCHAR* S, const WCHAR* P) } #endif -#if defined(__llvm__) -#define HAS_ROTL __has_builtin(_rotl) -#define HAS_ROTR __has_builtin(_rotr) -#else -#define HAS_ROTL 0 -#define HAS_ROTR 0 +#ifndef __has_builtin +#define __has_builtin(x) 0 #endif -#if !HAS_ROTL +#if !__has_builtin(_rotl) /*++ Function: _rotl @@ -4108,14 +4114,14 @@ unsigned int __cdecl _rotl(unsigned int value, int shift) retval = (value << shift) | (value >> (sizeof(int) * CHAR_BIT - shift)); return retval; } -#endif // !HAS_ROTL +#endif // !__has_builtin(_rotl) // On 64 bit unix, make the long an int. #ifdef HOST_64BIT #define _lrotl _rotl -#endif // HOST_64BIT +#endif -#if !HAS_ROTR +#if !__has_builtin(_rotr) /*++ Function: @@ -4135,7 +4141,7 @@ unsigned int __cdecl _rotr(unsigned int value, int shift) return retval; } -#endif // !HAS_ROTR +#endif // !__has_builtin(_rotr) PALIMPORT int __cdecl abs(int); // clang complains if this is declared with __int64 diff --git a/src/coreclr/pal/prebuilt/idl/cordebug_i.cpp b/src/coreclr/pal/prebuilt/idl/cordebug_i.cpp index 0499684f403d4b..c509c3c16cd529 100644 --- a/src/coreclr/pal/prebuilt/idl/cordebug_i.cpp +++ b/src/coreclr/pal/prebuilt/idl/cordebug_i.cpp @@ -1,3 +1,5 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ @@ -7,10 +9,10 @@ /* File created by MIDL compiler version 8.01.0622 */ /* Compiler settings for cordebug.idl: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622 + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0622 protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ @@ -21,7 +23,7 @@ #ifdef __cplusplus extern "C"{ -#endif +#endif #include @@ -251,6 +253,9 @@ MIDL_DEFINE_GUID(IID, IID_ICorDebugThread3,0xF8544EC3,0x5E4E,0x46c7,0x8D,0x3E,0x MIDL_DEFINE_GUID(IID, IID_ICorDebugThread4,0x1A1F204B,0x1C66,0x4637,0x82,0x3F,0x3E,0xE6,0xC7,0x44,0xA6,0x9C); +MIDL_DEFINE_GUID(IID, IID_ICorDebugThread5,0xF98421C4,0xE506,0x4D24,0x91,0x6F,0x02,0x37,0xEE,0x85,0x3E,0xC6); + + MIDL_DEFINE_GUID(IID, IID_ICorDebugStackWalk,0xA0647DE9,0x55DE,0x4816,0x92,0x9C,0x38,0x52,0x71,0xC6,0x4C,0xF7); @@ -480,6 +485,3 @@ MIDL_DEFINE_GUID(CLSID, CLSID_EmbeddedCLRCorDebug,0x211f1254,0xbc7e,0x4af5,0xb9, #ifdef __cplusplus } #endif - - - diff --git a/src/coreclr/pal/prebuilt/inc/cordebug.h b/src/coreclr/pal/prebuilt/inc/cordebug.h index ed5c428df0e972..df876984714400 100644 --- a/src/coreclr/pal/prebuilt/inc/cordebug.h +++ b/src/coreclr/pal/prebuilt/inc/cordebug.h @@ -1,14 +1,15 @@ - +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. /* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 8.01.0622 */ /* Compiler settings for cordebug.idl: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622 + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0622 protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ @@ -41,7 +42,7 @@ #pragma once #endif -/* Forward Declarations */ +/* Forward Declarations */ #ifndef __ICorDebugDataTarget_FWD_DEFINED__ #define __ICorDebugDataTarget_FWD_DEFINED__ @@ -477,6 +478,13 @@ typedef interface ICorDebugThread4 ICorDebugThread4; #endif /* __ICorDebugThread4_FWD_DEFINED__ */ +#ifndef __ICorDebugThread5_FWD_DEFINED__ +#define __ICorDebugThread5_FWD_DEFINED__ +typedef interface ICorDebugThread5 ICorDebugThread5; + +#endif /* __ICorDebugThread5_FWD_DEFINED__ */ + + #ifndef __ICorDebugStackWalk_FWD_DEFINED__ #define __ICorDebugStackWalk_FWD_DEFINED__ typedef interface ICorDebugStackWalk ICorDebugStackWalk; @@ -1242,11 +1250,11 @@ typedef interface ICorDebugModule3 ICorDebugModule3; #ifdef __cplusplus extern "C"{ -#endif +#endif /* interface __MIDL_itf_cordebug_0000_0000 */ -/* [local] */ +/* [local] */ #if 0 typedef UINT32 mdToken; @@ -1300,7 +1308,7 @@ typedef struct _COR_IL_MAP #endif //_COR_IL_MAP #ifndef _COR_DEBUG_IL_TO_NATIVE_MAP_ #define _COR_DEBUG_IL_TO_NATIVE_MAP_ -typedef +typedef enum CorDebugIlToNativeMappingTypes { NO_MAPPING = -1, @@ -1317,7 +1325,7 @@ typedef struct COR_DEBUG_IL_TO_NATIVE_MAP #endif // _COR_DEBUG_IL_TO_NATIVE_MAP_ #define REMOTE_DEBUGGING_DLL_ENTRY L"Software\\Microsoft\\.NETFramework\\Debugger\\ActivateRemoteDebugging" -typedef +typedef enum CorDebugJITCompilerFlags { CORDEBUG_JIT_DEFAULT = 0x1, @@ -1325,20 +1333,21 @@ enum CorDebugJITCompilerFlags CORDEBUG_JIT_ENABLE_ENC = 0x7 } CorDebugJITCompilerFlags; -typedef +typedef enum CorDebugJITCompilerFlagsDecprecated { CORDEBUG_JIT_TRACK_DEBUG_INFO = 0x1 } CorDebugJITCompilerFlagsDeprecated; -typedef +typedef enum CorDebugNGENPolicy { DISABLE_LOCAL_NIC = 1 } CorDebugNGENPolicy; #pragma warning(push) -#pragma warning(disable:28718) +#pragma warning(disable:28718) + @@ -1412,7 +1421,7 @@ typedef ULONG64 CORDB_REGISTER; typedef DWORD CORDB_CONTINUE_STATUS; -typedef +typedef enum CorDebugBlockingReason { BLOCKING_NONE = 0, @@ -1450,9 +1459,9 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0000_v0_0_s_ifspec; #define __ICorDebugDataTarget_INTERFACE_DEFINED__ /* interface ICorDebugDataTarget */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugPlatform { CORDB_PLATFORM_WINDOWS_X86 = 0, @@ -1466,72 +1475,72 @@ enum CorDebugPlatform CORDB_PLATFORM_POSIX_AMD64 = ( CORDB_PLATFORM_WINDOWS_ARM64 + 1 ) , CORDB_PLATFORM_POSIX_X86 = ( CORDB_PLATFORM_POSIX_AMD64 + 1 ) , CORDB_PLATFORM_POSIX_ARM = ( CORDB_PLATFORM_POSIX_X86 + 1 ) , - CORDB_PLATFORM_POSIX_ARM64 = ( CORDB_PLATFORM_POSIX_ARM + 1 ) + CORDB_PLATFORM_POSIX_ARM64 = ( CORDB_PLATFORM_POSIX_ARM + 1 ) } CorDebugPlatform; EXTERN_C const IID IID_ICorDebugDataTarget; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("FE06DC28-49FB-4636-A4A3-E80DB4AE116C") ICorDebugDataTarget : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetPlatform( + virtual HRESULT STDMETHODCALLTYPE GetPlatform( /* [out] */ CorDebugPlatform *pTargetPlatform) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReadVirtual( + + virtual HRESULT STDMETHODCALLTYPE ReadVirtual( /* [in] */ CORDB_ADDRESS address, /* [length_is][size_is][out] */ BYTE *pBuffer, /* [in] */ ULONG32 bytesRequested, /* [out] */ ULONG32 *pBytesRead) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThreadContext( + + virtual HRESULT STDMETHODCALLTYPE GetThreadContext( /* [in] */ DWORD dwThreadID, /* [in] */ ULONG32 contextFlags, /* [in] */ ULONG32 contextSize, /* [size_is][out] */ BYTE *pContext) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugDataTargetVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugDataTarget * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugDataTarget * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugDataTarget * This); - - HRESULT ( STDMETHODCALLTYPE *GetPlatform )( + + HRESULT ( STDMETHODCALLTYPE *GetPlatform )( ICorDebugDataTarget * This, /* [out] */ CorDebugPlatform *pTargetPlatform); - - HRESULT ( STDMETHODCALLTYPE *ReadVirtual )( + + HRESULT ( STDMETHODCALLTYPE *ReadVirtual )( ICorDebugDataTarget * This, /* [in] */ CORDB_ADDRESS address, /* [length_is][size_is][out] */ BYTE *pBuffer, /* [in] */ ULONG32 bytesRequested, /* [out] */ ULONG32 *pBytesRead); - - HRESULT ( STDMETHODCALLTYPE *GetThreadContext )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadContext )( ICorDebugDataTarget * This, /* [in] */ DWORD dwThreadID, /* [in] */ ULONG32 contextFlags, /* [in] */ ULONG32 contextSize, /* [size_is][out] */ BYTE *pContext); - + END_INTERFACE } ICorDebugDataTargetVtbl; @@ -1540,29 +1549,29 @@ EXTERN_C const IID IID_ICorDebugDataTarget; CONST_VTBL struct ICorDebugDataTargetVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugDataTarget_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugDataTarget_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugDataTarget_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugDataTarget_GetPlatform(This,pTargetPlatform) \ - ( (This)->lpVtbl -> GetPlatform(This,pTargetPlatform) ) + ( (This)->lpVtbl -> GetPlatform(This,pTargetPlatform) ) #define ICorDebugDataTarget_ReadVirtual(This,address,pBuffer,bytesRequested,pBytesRead) \ - ( (This)->lpVtbl -> ReadVirtual(This,address,pBuffer,bytesRequested,pBytesRead) ) + ( (This)->lpVtbl -> ReadVirtual(This,address,pBuffer,bytesRequested,pBytesRead) ) #define ICorDebugDataTarget_GetThreadContext(This,dwThreadID,contextFlags,contextSize,pContext) \ - ( (This)->lpVtbl -> GetThreadContext(This,dwThreadID,contextFlags,contextSize,pContext) ) + ( (This)->lpVtbl -> GetThreadContext(This,dwThreadID,contextFlags,contextSize,pContext) ) #endif /* COBJMACROS */ @@ -1579,63 +1588,63 @@ EXTERN_C const IID IID_ICorDebugDataTarget; #define __ICorDebugStaticFieldSymbol_INTERFACE_DEFINED__ /* interface ICorDebugStaticFieldSymbol */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugStaticFieldSymbol; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CBF9DA63-F68D-4BBB-A21C-15A45EAADF5B") ICorDebugStaticFieldSymbol : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetName( + virtual HRESULT STDMETHODCALLTYPE GetName( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSize( + + virtual HRESULT STDMETHODCALLTYPE GetSize( /* [out] */ ULONG32 *pcbSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAddress( + + virtual HRESULT STDMETHODCALLTYPE GetAddress( /* [out] */ CORDB_ADDRESS *pRVA) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugStaticFieldSymbolVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugStaticFieldSymbol * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugStaticFieldSymbol * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugStaticFieldSymbol * This); - - HRESULT ( STDMETHODCALLTYPE *GetName )( + + HRESULT ( STDMETHODCALLTYPE *GetName )( ICorDebugStaticFieldSymbol * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugStaticFieldSymbol * This, /* [out] */ ULONG32 *pcbSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugStaticFieldSymbol * This, /* [out] */ CORDB_ADDRESS *pRVA); - + END_INTERFACE } ICorDebugStaticFieldSymbolVtbl; @@ -1644,29 +1653,29 @@ EXTERN_C const IID IID_ICorDebugStaticFieldSymbol; CONST_VTBL struct ICorDebugStaticFieldSymbolVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugStaticFieldSymbol_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugStaticFieldSymbol_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugStaticFieldSymbol_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugStaticFieldSymbol_GetName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) #define ICorDebugStaticFieldSymbol_GetSize(This,pcbSize) \ - ( (This)->lpVtbl -> GetSize(This,pcbSize) ) + ( (This)->lpVtbl -> GetSize(This,pcbSize) ) #define ICorDebugStaticFieldSymbol_GetAddress(This,pRVA) \ - ( (This)->lpVtbl -> GetAddress(This,pRVA) ) + ( (This)->lpVtbl -> GetAddress(This,pRVA) ) #endif /* COBJMACROS */ @@ -1683,63 +1692,63 @@ EXTERN_C const IID IID_ICorDebugStaticFieldSymbol; #define __ICorDebugInstanceFieldSymbol_INTERFACE_DEFINED__ /* interface ICorDebugInstanceFieldSymbol */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugInstanceFieldSymbol; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("A074096B-3ADC-4485-81DA-68C7A4EA52DB") ICorDebugInstanceFieldSymbol : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetName( + virtual HRESULT STDMETHODCALLTYPE GetName( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSize( + + virtual HRESULT STDMETHODCALLTYPE GetSize( /* [out] */ ULONG32 *pcbSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetOffset( + + virtual HRESULT STDMETHODCALLTYPE GetOffset( /* [out] */ ULONG32 *pcbOffset) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugInstanceFieldSymbolVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugInstanceFieldSymbol * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugInstanceFieldSymbol * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugInstanceFieldSymbol * This); - - HRESULT ( STDMETHODCALLTYPE *GetName )( + + HRESULT ( STDMETHODCALLTYPE *GetName )( ICorDebugInstanceFieldSymbol * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugInstanceFieldSymbol * This, /* [out] */ ULONG32 *pcbSize); - - HRESULT ( STDMETHODCALLTYPE *GetOffset )( + + HRESULT ( STDMETHODCALLTYPE *GetOffset )( ICorDebugInstanceFieldSymbol * This, /* [out] */ ULONG32 *pcbOffset); - + END_INTERFACE } ICorDebugInstanceFieldSymbolVtbl; @@ -1748,29 +1757,29 @@ EXTERN_C const IID IID_ICorDebugInstanceFieldSymbol; CONST_VTBL struct ICorDebugInstanceFieldSymbolVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugInstanceFieldSymbol_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugInstanceFieldSymbol_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugInstanceFieldSymbol_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugInstanceFieldSymbol_GetName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) #define ICorDebugInstanceFieldSymbol_GetSize(This,pcbSize) \ - ( (This)->lpVtbl -> GetSize(This,pcbSize) ) + ( (This)->lpVtbl -> GetSize(This,pcbSize) ) #define ICorDebugInstanceFieldSymbol_GetOffset(This,pcbOffset) \ - ( (This)->lpVtbl -> GetOffset(This,pcbOffset) ) + ( (This)->lpVtbl -> GetOffset(This,pcbOffset) ) #endif /* COBJMACROS */ @@ -1787,76 +1796,76 @@ EXTERN_C const IID IID_ICorDebugInstanceFieldSymbol; #define __ICorDebugVariableSymbol_INTERFACE_DEFINED__ /* interface ICorDebugVariableSymbol */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugVariableSymbol; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("707E8932-1163-48D9-8A93-F5B1F480FBB7") ICorDebugVariableSymbol : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetName( + virtual HRESULT STDMETHODCALLTYPE GetName( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSize( + + virtual HRESULT STDMETHODCALLTYPE GetSize( /* [out] */ ULONG32 *pcbValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetValue( + + virtual HRESULT STDMETHODCALLTYPE GetValue( /* [in] */ ULONG32 offset, /* [in] */ ULONG32 cbContext, /* [size_is][in] */ BYTE context[ ], /* [in] */ ULONG32 cbValue, /* [out] */ ULONG32 *pcbValue, /* [length_is][size_is][out] */ BYTE pValue[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetValue( + + virtual HRESULT STDMETHODCALLTYPE SetValue( /* [in] */ ULONG32 offset, /* [in] */ DWORD threadID, /* [in] */ ULONG32 cbContext, /* [size_is][in] */ BYTE context[ ], /* [in] */ ULONG32 cbValue, /* [size_is][in] */ BYTE pValue[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSlotIndex( + + virtual HRESULT STDMETHODCALLTYPE GetSlotIndex( /* [out] */ ULONG32 *pSlotIndex) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugVariableSymbolVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugVariableSymbol * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugVariableSymbol * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugVariableSymbol * This); - - HRESULT ( STDMETHODCALLTYPE *GetName )( + + HRESULT ( STDMETHODCALLTYPE *GetName )( ICorDebugVariableSymbol * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugVariableSymbol * This, /* [out] */ ULONG32 *pcbValue); - - HRESULT ( STDMETHODCALLTYPE *GetValue )( + + HRESULT ( STDMETHODCALLTYPE *GetValue )( ICorDebugVariableSymbol * This, /* [in] */ ULONG32 offset, /* [in] */ ULONG32 cbContext, @@ -1864,8 +1873,8 @@ EXTERN_C const IID IID_ICorDebugVariableSymbol; /* [in] */ ULONG32 cbValue, /* [out] */ ULONG32 *pcbValue, /* [length_is][size_is][out] */ BYTE pValue[ ]); - - HRESULT ( STDMETHODCALLTYPE *SetValue )( + + HRESULT ( STDMETHODCALLTYPE *SetValue )( ICorDebugVariableSymbol * This, /* [in] */ ULONG32 offset, /* [in] */ DWORD threadID, @@ -1873,11 +1882,11 @@ EXTERN_C const IID IID_ICorDebugVariableSymbol; /* [size_is][in] */ BYTE context[ ], /* [in] */ ULONG32 cbValue, /* [size_is][in] */ BYTE pValue[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetSlotIndex )( + + HRESULT ( STDMETHODCALLTYPE *GetSlotIndex )( ICorDebugVariableSymbol * This, /* [out] */ ULONG32 *pSlotIndex); - + END_INTERFACE } ICorDebugVariableSymbolVtbl; @@ -1886,35 +1895,35 @@ EXTERN_C const IID IID_ICorDebugVariableSymbol; CONST_VTBL struct ICorDebugVariableSymbolVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugVariableSymbol_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugVariableSymbol_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugVariableSymbol_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugVariableSymbol_GetName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) #define ICorDebugVariableSymbol_GetSize(This,pcbValue) \ - ( (This)->lpVtbl -> GetSize(This,pcbValue) ) + ( (This)->lpVtbl -> GetSize(This,pcbValue) ) #define ICorDebugVariableSymbol_GetValue(This,offset,cbContext,context,cbValue,pcbValue,pValue) \ - ( (This)->lpVtbl -> GetValue(This,offset,cbContext,context,cbValue,pcbValue,pValue) ) + ( (This)->lpVtbl -> GetValue(This,offset,cbContext,context,cbValue,pcbValue,pValue) ) #define ICorDebugVariableSymbol_SetValue(This,offset,threadID,cbContext,context,cbValue,pValue) \ - ( (This)->lpVtbl -> SetValue(This,offset,threadID,cbContext,context,cbValue,pValue) ) + ( (This)->lpVtbl -> SetValue(This,offset,threadID,cbContext,context,cbValue,pValue) ) #define ICorDebugVariableSymbol_GetSlotIndex(This,pSlotIndex) \ - ( (This)->lpVtbl -> GetSlotIndex(This,pSlotIndex) ) + ( (This)->lpVtbl -> GetSlotIndex(This,pSlotIndex) ) #endif /* COBJMACROS */ @@ -1931,52 +1940,52 @@ EXTERN_C const IID IID_ICorDebugVariableSymbol; #define __ICorDebugMemoryBuffer_INTERFACE_DEFINED__ /* interface ICorDebugMemoryBuffer */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugMemoryBuffer; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("677888B3-D160-4B8C-A73B-D79E6AAA1D13") ICorDebugMemoryBuffer : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetStartAddress( + virtual HRESULT STDMETHODCALLTYPE GetStartAddress( /* [out] */ LPCVOID *address) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSize( + + virtual HRESULT STDMETHODCALLTYPE GetSize( /* [out] */ ULONG32 *pcbBufferLength) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugMemoryBufferVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugMemoryBuffer * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugMemoryBuffer * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugMemoryBuffer * This); - - HRESULT ( STDMETHODCALLTYPE *GetStartAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetStartAddress )( ICorDebugMemoryBuffer * This, /* [out] */ LPCVOID *address); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugMemoryBuffer * This, /* [out] */ ULONG32 *pcbBufferLength); - + END_INTERFACE } ICorDebugMemoryBufferVtbl; @@ -1985,26 +1994,26 @@ EXTERN_C const IID IID_ICorDebugMemoryBuffer; CONST_VTBL struct ICorDebugMemoryBufferVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugMemoryBuffer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugMemoryBuffer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugMemoryBuffer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugMemoryBuffer_GetStartAddress(This,address) \ - ( (This)->lpVtbl -> GetStartAddress(This,address) ) + ( (This)->lpVtbl -> GetStartAddress(This,address) ) #define ICorDebugMemoryBuffer_GetSize(This,pcbBufferLength) \ - ( (This)->lpVtbl -> GetSize(This,pcbBufferLength) ) + ( (This)->lpVtbl -> GetSize(This,pcbBufferLength) ) #endif /* COBJMACROS */ @@ -2021,102 +2030,102 @@ EXTERN_C const IID IID_ICorDebugMemoryBuffer; #define __ICorDebugMergedAssemblyRecord_INTERFACE_DEFINED__ /* interface ICorDebugMergedAssemblyRecord */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugMergedAssemblyRecord; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("FAA8637B-3BBE-4671-8E26-3B59875B922A") ICorDebugMergedAssemblyRecord : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetSimpleName( + virtual HRESULT STDMETHODCALLTYPE GetSimpleName( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVersion( + + virtual HRESULT STDMETHODCALLTYPE GetVersion( /* [out] */ USHORT *pMajor, /* [out] */ USHORT *pMinor, /* [out] */ USHORT *pBuild, /* [out] */ USHORT *pRevision) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCulture( + + virtual HRESULT STDMETHODCALLTYPE GetCulture( /* [in] */ ULONG32 cchCulture, /* [out] */ ULONG32 *pcchCulture, /* [length_is][size_is][out] */ WCHAR szCulture[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPublicKey( + + virtual HRESULT STDMETHODCALLTYPE GetPublicKey( /* [in] */ ULONG32 cbPublicKey, /* [out] */ ULONG32 *pcbPublicKey, /* [length_is][size_is][out] */ BYTE pbPublicKey[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPublicKeyToken( + + virtual HRESULT STDMETHODCALLTYPE GetPublicKeyToken( /* [in] */ ULONG32 cbPublicKeyToken, /* [out] */ ULONG32 *pcbPublicKeyToken, /* [length_is][size_is][out] */ BYTE pbPublicKeyToken[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIndex( + + virtual HRESULT STDMETHODCALLTYPE GetIndex( /* [out] */ ULONG32 *pIndex) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugMergedAssemblyRecordVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugMergedAssemblyRecord * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugMergedAssemblyRecord * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugMergedAssemblyRecord * This); - - HRESULT ( STDMETHODCALLTYPE *GetSimpleName )( + + HRESULT ( STDMETHODCALLTYPE *GetSimpleName )( ICorDebugMergedAssemblyRecord * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetVersion )( + + HRESULT ( STDMETHODCALLTYPE *GetVersion )( ICorDebugMergedAssemblyRecord * This, /* [out] */ USHORT *pMajor, /* [out] */ USHORT *pMinor, /* [out] */ USHORT *pBuild, /* [out] */ USHORT *pRevision); - - HRESULT ( STDMETHODCALLTYPE *GetCulture )( + + HRESULT ( STDMETHODCALLTYPE *GetCulture )( ICorDebugMergedAssemblyRecord * This, /* [in] */ ULONG32 cchCulture, /* [out] */ ULONG32 *pcchCulture, /* [length_is][size_is][out] */ WCHAR szCulture[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetPublicKey )( + + HRESULT ( STDMETHODCALLTYPE *GetPublicKey )( ICorDebugMergedAssemblyRecord * This, /* [in] */ ULONG32 cbPublicKey, /* [out] */ ULONG32 *pcbPublicKey, /* [length_is][size_is][out] */ BYTE pbPublicKey[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetPublicKeyToken )( + + HRESULT ( STDMETHODCALLTYPE *GetPublicKeyToken )( ICorDebugMergedAssemblyRecord * This, /* [in] */ ULONG32 cbPublicKeyToken, /* [out] */ ULONG32 *pcbPublicKeyToken, /* [length_is][size_is][out] */ BYTE pbPublicKeyToken[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetIndex )( + + HRESULT ( STDMETHODCALLTYPE *GetIndex )( ICorDebugMergedAssemblyRecord * This, /* [out] */ ULONG32 *pIndex); - + END_INTERFACE } ICorDebugMergedAssemblyRecordVtbl; @@ -2125,38 +2134,38 @@ EXTERN_C const IID IID_ICorDebugMergedAssemblyRecord; CONST_VTBL struct ICorDebugMergedAssemblyRecordVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugMergedAssemblyRecord_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugMergedAssemblyRecord_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugMergedAssemblyRecord_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugMergedAssemblyRecord_GetSimpleName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetSimpleName(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetSimpleName(This,cchName,pcchName,szName) ) #define ICorDebugMergedAssemblyRecord_GetVersion(This,pMajor,pMinor,pBuild,pRevision) \ - ( (This)->lpVtbl -> GetVersion(This,pMajor,pMinor,pBuild,pRevision) ) + ( (This)->lpVtbl -> GetVersion(This,pMajor,pMinor,pBuild,pRevision) ) #define ICorDebugMergedAssemblyRecord_GetCulture(This,cchCulture,pcchCulture,szCulture) \ - ( (This)->lpVtbl -> GetCulture(This,cchCulture,pcchCulture,szCulture) ) + ( (This)->lpVtbl -> GetCulture(This,cchCulture,pcchCulture,szCulture) ) #define ICorDebugMergedAssemblyRecord_GetPublicKey(This,cbPublicKey,pcbPublicKey,pbPublicKey) \ - ( (This)->lpVtbl -> GetPublicKey(This,cbPublicKey,pcbPublicKey,pbPublicKey) ) + ( (This)->lpVtbl -> GetPublicKey(This,cbPublicKey,pcbPublicKey,pbPublicKey) ) #define ICorDebugMergedAssemblyRecord_GetPublicKeyToken(This,cbPublicKeyToken,pcbPublicKeyToken,pbPublicKeyToken) \ - ( (This)->lpVtbl -> GetPublicKeyToken(This,cbPublicKeyToken,pcbPublicKeyToken,pbPublicKeyToken) ) + ( (This)->lpVtbl -> GetPublicKeyToken(This,cbPublicKeyToken,pcbPublicKeyToken,pbPublicKeyToken) ) #define ICorDebugMergedAssemblyRecord_GetIndex(This,pIndex) \ - ( (This)->lpVtbl -> GetIndex(This,pIndex) ) + ( (This)->lpVtbl -> GetIndex(This,pIndex) ) #endif /* COBJMACROS */ @@ -2173,138 +2182,138 @@ EXTERN_C const IID IID_ICorDebugMergedAssemblyRecord; #define __ICorDebugSymbolProvider_INTERFACE_DEFINED__ /* interface ICorDebugSymbolProvider */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugSymbolProvider; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("3948A999-FD8A-4C38-A708-8A71E9B04DBB") ICorDebugSymbolProvider : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetStaticFieldSymbols( + virtual HRESULT STDMETHODCALLTYPE GetStaticFieldSymbols( /* [in] */ ULONG32 cbSignature, /* [size_is][in] */ BYTE typeSig[ ], /* [in] */ ULONG32 cRequestedSymbols, /* [out] */ ULONG32 *pcFetchedSymbols, /* [length_is][size_is][out] */ ICorDebugStaticFieldSymbol *pSymbols[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInstanceFieldSymbols( + + virtual HRESULT STDMETHODCALLTYPE GetInstanceFieldSymbols( /* [in] */ ULONG32 cbSignature, /* [size_is][in] */ BYTE typeSig[ ], /* [in] */ ULONG32 cRequestedSymbols, /* [out] */ ULONG32 *pcFetchedSymbols, /* [length_is][size_is][out] */ ICorDebugInstanceFieldSymbol *pSymbols[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodLocalSymbols( + + virtual HRESULT STDMETHODCALLTYPE GetMethodLocalSymbols( /* [in] */ ULONG32 nativeRVA, /* [in] */ ULONG32 cRequestedSymbols, /* [out] */ ULONG32 *pcFetchedSymbols, /* [length_is][size_is][out] */ ICorDebugVariableSymbol *pSymbols[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodParameterSymbols( + + virtual HRESULT STDMETHODCALLTYPE GetMethodParameterSymbols( /* [in] */ ULONG32 nativeRVA, /* [in] */ ULONG32 cRequestedSymbols, /* [out] */ ULONG32 *pcFetchedSymbols, /* [length_is][size_is][out] */ ICorDebugVariableSymbol *pSymbols[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMergedAssemblyRecords( + + virtual HRESULT STDMETHODCALLTYPE GetMergedAssemblyRecords( /* [in] */ ULONG32 cRequestedRecords, /* [out] */ ULONG32 *pcFetchedRecords, /* [length_is][size_is][out] */ ICorDebugMergedAssemblyRecord *pRecords[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMethodProps( + + virtual HRESULT STDMETHODCALLTYPE GetMethodProps( /* [in] */ ULONG32 codeRva, /* [out] */ mdToken *pMethodToken, /* [out] */ ULONG32 *pcGenericParams, /* [in] */ ULONG32 cbSignature, /* [out] */ ULONG32 *pcbSignature, /* [length_is][size_is][out] */ BYTE signature[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTypeProps( + + virtual HRESULT STDMETHODCALLTYPE GetTypeProps( /* [in] */ ULONG32 vtableRva, /* [in] */ ULONG32 cbSignature, /* [out] */ ULONG32 *pcbSignature, /* [length_is][size_is][out] */ BYTE signature[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCodeRange( + + virtual HRESULT STDMETHODCALLTYPE GetCodeRange( /* [in] */ ULONG32 codeRva, /* [out] */ ULONG32 *pCodeStartAddress, ULONG32 *pCodeSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyImageBytes( + + virtual HRESULT STDMETHODCALLTYPE GetAssemblyImageBytes( /* [in] */ CORDB_ADDRESS rva, /* [in] */ ULONG32 length, /* [out] */ ICorDebugMemoryBuffer **ppMemoryBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetObjectSize( + + virtual HRESULT STDMETHODCALLTYPE GetObjectSize( /* [in] */ ULONG32 cbSignature, /* [size_is][in] */ BYTE typeSig[ ], /* [out] */ ULONG32 *pObjectSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyImageMetadata( + + virtual HRESULT STDMETHODCALLTYPE GetAssemblyImageMetadata( /* [out] */ ICorDebugMemoryBuffer **ppMemoryBuffer) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugSymbolProviderVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugSymbolProvider * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugSymbolProvider * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugSymbolProvider * This); - - HRESULT ( STDMETHODCALLTYPE *GetStaticFieldSymbols )( + + HRESULT ( STDMETHODCALLTYPE *GetStaticFieldSymbols )( ICorDebugSymbolProvider * This, /* [in] */ ULONG32 cbSignature, /* [size_is][in] */ BYTE typeSig[ ], /* [in] */ ULONG32 cRequestedSymbols, /* [out] */ ULONG32 *pcFetchedSymbols, /* [length_is][size_is][out] */ ICorDebugStaticFieldSymbol *pSymbols[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetInstanceFieldSymbols )( + + HRESULT ( STDMETHODCALLTYPE *GetInstanceFieldSymbols )( ICorDebugSymbolProvider * This, /* [in] */ ULONG32 cbSignature, /* [size_is][in] */ BYTE typeSig[ ], /* [in] */ ULONG32 cRequestedSymbols, /* [out] */ ULONG32 *pcFetchedSymbols, /* [length_is][size_is][out] */ ICorDebugInstanceFieldSymbol *pSymbols[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetMethodLocalSymbols )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodLocalSymbols )( ICorDebugSymbolProvider * This, /* [in] */ ULONG32 nativeRVA, /* [in] */ ULONG32 cRequestedSymbols, /* [out] */ ULONG32 *pcFetchedSymbols, /* [length_is][size_is][out] */ ICorDebugVariableSymbol *pSymbols[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetMethodParameterSymbols )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodParameterSymbols )( ICorDebugSymbolProvider * This, /* [in] */ ULONG32 nativeRVA, /* [in] */ ULONG32 cRequestedSymbols, /* [out] */ ULONG32 *pcFetchedSymbols, /* [length_is][size_is][out] */ ICorDebugVariableSymbol *pSymbols[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetMergedAssemblyRecords )( + + HRESULT ( STDMETHODCALLTYPE *GetMergedAssemblyRecords )( ICorDebugSymbolProvider * This, /* [in] */ ULONG32 cRequestedRecords, /* [out] */ ULONG32 *pcFetchedRecords, /* [length_is][size_is][out] */ ICorDebugMergedAssemblyRecord *pRecords[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetMethodProps )( + + HRESULT ( STDMETHODCALLTYPE *GetMethodProps )( ICorDebugSymbolProvider * This, /* [in] */ ULONG32 codeRva, /* [out] */ mdToken *pMethodToken, @@ -2312,36 +2321,36 @@ EXTERN_C const IID IID_ICorDebugSymbolProvider; /* [in] */ ULONG32 cbSignature, /* [out] */ ULONG32 *pcbSignature, /* [length_is][size_is][out] */ BYTE signature[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetTypeProps )( + + HRESULT ( STDMETHODCALLTYPE *GetTypeProps )( ICorDebugSymbolProvider * This, /* [in] */ ULONG32 vtableRva, /* [in] */ ULONG32 cbSignature, /* [out] */ ULONG32 *pcbSignature, /* [length_is][size_is][out] */ BYTE signature[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetCodeRange )( + + HRESULT ( STDMETHODCALLTYPE *GetCodeRange )( ICorDebugSymbolProvider * This, /* [in] */ ULONG32 codeRva, /* [out] */ ULONG32 *pCodeStartAddress, ULONG32 *pCodeSize); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyImageBytes )( + + HRESULT ( STDMETHODCALLTYPE *GetAssemblyImageBytes )( ICorDebugSymbolProvider * This, /* [in] */ CORDB_ADDRESS rva, /* [in] */ ULONG32 length, /* [out] */ ICorDebugMemoryBuffer **ppMemoryBuffer); - - HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( + + HRESULT ( STDMETHODCALLTYPE *GetObjectSize )( ICorDebugSymbolProvider * This, /* [in] */ ULONG32 cbSignature, /* [size_is][in] */ BYTE typeSig[ ], /* [out] */ ULONG32 *pObjectSize); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyImageMetadata )( + + HRESULT ( STDMETHODCALLTYPE *GetAssemblyImageMetadata )( ICorDebugSymbolProvider * This, /* [out] */ ICorDebugMemoryBuffer **ppMemoryBuffer); - + END_INTERFACE } ICorDebugSymbolProviderVtbl; @@ -2350,53 +2359,53 @@ EXTERN_C const IID IID_ICorDebugSymbolProvider; CONST_VTBL struct ICorDebugSymbolProviderVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugSymbolProvider_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugSymbolProvider_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugSymbolProvider_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugSymbolProvider_GetStaticFieldSymbols(This,cbSignature,typeSig,cRequestedSymbols,pcFetchedSymbols,pSymbols) \ - ( (This)->lpVtbl -> GetStaticFieldSymbols(This,cbSignature,typeSig,cRequestedSymbols,pcFetchedSymbols,pSymbols) ) + ( (This)->lpVtbl -> GetStaticFieldSymbols(This,cbSignature,typeSig,cRequestedSymbols,pcFetchedSymbols,pSymbols) ) #define ICorDebugSymbolProvider_GetInstanceFieldSymbols(This,cbSignature,typeSig,cRequestedSymbols,pcFetchedSymbols,pSymbols) \ - ( (This)->lpVtbl -> GetInstanceFieldSymbols(This,cbSignature,typeSig,cRequestedSymbols,pcFetchedSymbols,pSymbols) ) + ( (This)->lpVtbl -> GetInstanceFieldSymbols(This,cbSignature,typeSig,cRequestedSymbols,pcFetchedSymbols,pSymbols) ) #define ICorDebugSymbolProvider_GetMethodLocalSymbols(This,nativeRVA,cRequestedSymbols,pcFetchedSymbols,pSymbols) \ - ( (This)->lpVtbl -> GetMethodLocalSymbols(This,nativeRVA,cRequestedSymbols,pcFetchedSymbols,pSymbols) ) + ( (This)->lpVtbl -> GetMethodLocalSymbols(This,nativeRVA,cRequestedSymbols,pcFetchedSymbols,pSymbols) ) #define ICorDebugSymbolProvider_GetMethodParameterSymbols(This,nativeRVA,cRequestedSymbols,pcFetchedSymbols,pSymbols) \ - ( (This)->lpVtbl -> GetMethodParameterSymbols(This,nativeRVA,cRequestedSymbols,pcFetchedSymbols,pSymbols) ) + ( (This)->lpVtbl -> GetMethodParameterSymbols(This,nativeRVA,cRequestedSymbols,pcFetchedSymbols,pSymbols) ) #define ICorDebugSymbolProvider_GetMergedAssemblyRecords(This,cRequestedRecords,pcFetchedRecords,pRecords) \ - ( (This)->lpVtbl -> GetMergedAssemblyRecords(This,cRequestedRecords,pcFetchedRecords,pRecords) ) + ( (This)->lpVtbl -> GetMergedAssemblyRecords(This,cRequestedRecords,pcFetchedRecords,pRecords) ) #define ICorDebugSymbolProvider_GetMethodProps(This,codeRva,pMethodToken,pcGenericParams,cbSignature,pcbSignature,signature) \ - ( (This)->lpVtbl -> GetMethodProps(This,codeRva,pMethodToken,pcGenericParams,cbSignature,pcbSignature,signature) ) + ( (This)->lpVtbl -> GetMethodProps(This,codeRva,pMethodToken,pcGenericParams,cbSignature,pcbSignature,signature) ) #define ICorDebugSymbolProvider_GetTypeProps(This,vtableRva,cbSignature,pcbSignature,signature) \ - ( (This)->lpVtbl -> GetTypeProps(This,vtableRva,cbSignature,pcbSignature,signature) ) + ( (This)->lpVtbl -> GetTypeProps(This,vtableRva,cbSignature,pcbSignature,signature) ) #define ICorDebugSymbolProvider_GetCodeRange(This,codeRva,pCodeStartAddress,pCodeSize) \ - ( (This)->lpVtbl -> GetCodeRange(This,codeRva,pCodeStartAddress,pCodeSize) ) + ( (This)->lpVtbl -> GetCodeRange(This,codeRva,pCodeStartAddress,pCodeSize) ) #define ICorDebugSymbolProvider_GetAssemblyImageBytes(This,rva,length,ppMemoryBuffer) \ - ( (This)->lpVtbl -> GetAssemblyImageBytes(This,rva,length,ppMemoryBuffer) ) + ( (This)->lpVtbl -> GetAssemblyImageBytes(This,rva,length,ppMemoryBuffer) ) #define ICorDebugSymbolProvider_GetObjectSize(This,cbSignature,typeSig,pObjectSize) \ - ( (This)->lpVtbl -> GetObjectSize(This,cbSignature,typeSig,pObjectSize) ) + ( (This)->lpVtbl -> GetObjectSize(This,cbSignature,typeSig,pObjectSize) ) #define ICorDebugSymbolProvider_GetAssemblyImageMetadata(This,ppMemoryBuffer) \ - ( (This)->lpVtbl -> GetAssemblyImageMetadata(This,ppMemoryBuffer) ) + ( (This)->lpVtbl -> GetAssemblyImageMetadata(This,ppMemoryBuffer) ) #endif /* COBJMACROS */ @@ -2413,56 +2422,56 @@ EXTERN_C const IID IID_ICorDebugSymbolProvider; #define __ICorDebugSymbolProvider2_INTERFACE_DEFINED__ /* interface ICorDebugSymbolProvider2 */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugSymbolProvider2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("F9801807-4764-4330-9E67-4F685094165E") ICorDebugSymbolProvider2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetGenericDictionaryInfo( + virtual HRESULT STDMETHODCALLTYPE GetGenericDictionaryInfo( /* [out] */ ICorDebugMemoryBuffer **ppMemoryBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameProps( + + virtual HRESULT STDMETHODCALLTYPE GetFrameProps( /* [in] */ ULONG32 codeRva, /* [out] */ ULONG32 *pCodeStartRva, /* [out] */ ULONG32 *pParentFrameStartRva) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugSymbolProvider2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugSymbolProvider2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugSymbolProvider2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugSymbolProvider2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetGenericDictionaryInfo )( + + HRESULT ( STDMETHODCALLTYPE *GetGenericDictionaryInfo )( ICorDebugSymbolProvider2 * This, /* [out] */ ICorDebugMemoryBuffer **ppMemoryBuffer); - - HRESULT ( STDMETHODCALLTYPE *GetFrameProps )( + + HRESULT ( STDMETHODCALLTYPE *GetFrameProps )( ICorDebugSymbolProvider2 * This, /* [in] */ ULONG32 codeRva, /* [out] */ ULONG32 *pCodeStartRva, /* [out] */ ULONG32 *pParentFrameStartRva); - + END_INTERFACE } ICorDebugSymbolProvider2Vtbl; @@ -2471,26 +2480,26 @@ EXTERN_C const IID IID_ICorDebugSymbolProvider2; CONST_VTBL struct ICorDebugSymbolProvider2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugSymbolProvider2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugSymbolProvider2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugSymbolProvider2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugSymbolProvider2_GetGenericDictionaryInfo(This,ppMemoryBuffer) \ - ( (This)->lpVtbl -> GetGenericDictionaryInfo(This,ppMemoryBuffer) ) + ( (This)->lpVtbl -> GetGenericDictionaryInfo(This,ppMemoryBuffer) ) #define ICorDebugSymbolProvider2_GetFrameProps(This,codeRva,pCodeStartRva,pParentFrameStartRva) \ - ( (This)->lpVtbl -> GetFrameProps(This,codeRva,pCodeStartRva,pParentFrameStartRva) ) + ( (This)->lpVtbl -> GetFrameProps(This,codeRva,pCodeStartRva,pParentFrameStartRva) ) #endif /* COBJMACROS */ @@ -2507,56 +2516,56 @@ EXTERN_C const IID IID_ICorDebugSymbolProvider2; #define __ICorDebugVirtualUnwinder_INTERFACE_DEFINED__ /* interface ICorDebugVirtualUnwinder */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugVirtualUnwinder; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("F69126B7-C787-4F6B-AE96-A569786FC670") ICorDebugVirtualUnwinder : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetContext( + virtual HRESULT STDMETHODCALLTYPE GetContext( /* [in] */ ULONG32 contextFlags, /* [in] */ ULONG32 cbContextBuf, /* [out] */ ULONG32 *contextSize, /* [size_is][out] */ BYTE contextBuf[ ]) = 0; - + virtual HRESULT STDMETHODCALLTYPE Next( void) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugVirtualUnwinderVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugVirtualUnwinder * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugVirtualUnwinder * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugVirtualUnwinder * This); - - HRESULT ( STDMETHODCALLTYPE *GetContext )( + + HRESULT ( STDMETHODCALLTYPE *GetContext )( ICorDebugVirtualUnwinder * This, /* [in] */ ULONG32 contextFlags, /* [in] */ ULONG32 cbContextBuf, /* [out] */ ULONG32 *contextSize, /* [size_is][out] */ BYTE contextBuf[ ]); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugVirtualUnwinder * This); - + END_INTERFACE } ICorDebugVirtualUnwinderVtbl; @@ -2565,26 +2574,26 @@ EXTERN_C const IID IID_ICorDebugVirtualUnwinder; CONST_VTBL struct ICorDebugVirtualUnwinderVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugVirtualUnwinder_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugVirtualUnwinder_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugVirtualUnwinder_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugVirtualUnwinder_GetContext(This,contextFlags,cbContextBuf,contextSize,contextBuf) \ - ( (This)->lpVtbl -> GetContext(This,contextFlags,cbContextBuf,contextSize,contextBuf) ) + ( (This)->lpVtbl -> GetContext(This,contextFlags,cbContextBuf,contextSize,contextBuf) ) #define ICorDebugVirtualUnwinder_Next(This) \ - ( (This)->lpVtbl -> Next(This) ) + ( (This)->lpVtbl -> Next(This) ) #endif /* COBJMACROS */ @@ -2601,97 +2610,97 @@ EXTERN_C const IID IID_ICorDebugVirtualUnwinder; #define __ICorDebugDataTarget2_INTERFACE_DEFINED__ /* interface ICorDebugDataTarget2 */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugDataTarget2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("2eb364da-605b-4e8d-b333-3394c4828d41") ICorDebugDataTarget2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetImageFromPointer( + virtual HRESULT STDMETHODCALLTYPE GetImageFromPointer( /* [in] */ CORDB_ADDRESS addr, /* [out] */ CORDB_ADDRESS *pImageBase, /* [out] */ ULONG32 *pSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetImageLocation( + + virtual HRESULT STDMETHODCALLTYPE GetImageLocation( /* [in] */ CORDB_ADDRESS baseAddress, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSymbolProviderForImage( + + virtual HRESULT STDMETHODCALLTYPE GetSymbolProviderForImage( /* [in] */ CORDB_ADDRESS imageBaseAddress, /* [out] */ ICorDebugSymbolProvider **ppSymProvider) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateThreadIDs( + + virtual HRESULT STDMETHODCALLTYPE EnumerateThreadIDs( /* [in] */ ULONG32 cThreadIds, /* [out] */ ULONG32 *pcThreadIds, /* [length_is][size_is][out] */ ULONG32 pThreadIds[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVirtualUnwinder( + + virtual HRESULT STDMETHODCALLTYPE CreateVirtualUnwinder( /* [in] */ DWORD nativeThreadID, /* [in] */ ULONG32 contextFlags, /* [in] */ ULONG32 cbContext, /* [size_is][in] */ BYTE initialContext[ ], /* [out] */ ICorDebugVirtualUnwinder **ppUnwinder) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugDataTarget2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugDataTarget2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugDataTarget2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugDataTarget2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetImageFromPointer )( + + HRESULT ( STDMETHODCALLTYPE *GetImageFromPointer )( ICorDebugDataTarget2 * This, /* [in] */ CORDB_ADDRESS addr, /* [out] */ CORDB_ADDRESS *pImageBase, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetImageLocation )( + + HRESULT ( STDMETHODCALLTYPE *GetImageLocation )( ICorDebugDataTarget2 * This, /* [in] */ CORDB_ADDRESS baseAddress, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetSymbolProviderForImage )( + + HRESULT ( STDMETHODCALLTYPE *GetSymbolProviderForImage )( ICorDebugDataTarget2 * This, /* [in] */ CORDB_ADDRESS imageBaseAddress, /* [out] */ ICorDebugSymbolProvider **ppSymProvider); - - HRESULT ( STDMETHODCALLTYPE *EnumerateThreadIDs )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateThreadIDs )( ICorDebugDataTarget2 * This, /* [in] */ ULONG32 cThreadIds, /* [out] */ ULONG32 *pcThreadIds, /* [length_is][size_is][out] */ ULONG32 pThreadIds[ ]); - - HRESULT ( STDMETHODCALLTYPE *CreateVirtualUnwinder )( + + HRESULT ( STDMETHODCALLTYPE *CreateVirtualUnwinder )( ICorDebugDataTarget2 * This, /* [in] */ DWORD nativeThreadID, /* [in] */ ULONG32 contextFlags, /* [in] */ ULONG32 cbContext, /* [size_is][in] */ BYTE initialContext[ ], /* [out] */ ICorDebugVirtualUnwinder **ppUnwinder); - + END_INTERFACE } ICorDebugDataTarget2Vtbl; @@ -2700,35 +2709,35 @@ EXTERN_C const IID IID_ICorDebugDataTarget2; CONST_VTBL struct ICorDebugDataTarget2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugDataTarget2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugDataTarget2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugDataTarget2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugDataTarget2_GetImageFromPointer(This,addr,pImageBase,pSize) \ - ( (This)->lpVtbl -> GetImageFromPointer(This,addr,pImageBase,pSize) ) + ( (This)->lpVtbl -> GetImageFromPointer(This,addr,pImageBase,pSize) ) #define ICorDebugDataTarget2_GetImageLocation(This,baseAddress,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetImageLocation(This,baseAddress,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetImageLocation(This,baseAddress,cchName,pcchName,szName) ) #define ICorDebugDataTarget2_GetSymbolProviderForImage(This,imageBaseAddress,ppSymProvider) \ - ( (This)->lpVtbl -> GetSymbolProviderForImage(This,imageBaseAddress,ppSymProvider) ) + ( (This)->lpVtbl -> GetSymbolProviderForImage(This,imageBaseAddress,ppSymProvider) ) #define ICorDebugDataTarget2_EnumerateThreadIDs(This,cThreadIds,pcThreadIds,pThreadIds) \ - ( (This)->lpVtbl -> EnumerateThreadIDs(This,cThreadIds,pcThreadIds,pThreadIds) ) + ( (This)->lpVtbl -> EnumerateThreadIDs(This,cThreadIds,pcThreadIds,pThreadIds) ) #define ICorDebugDataTarget2_CreateVirtualUnwinder(This,nativeThreadID,contextFlags,cbContext,initialContext,ppUnwinder) \ - ( (This)->lpVtbl -> CreateVirtualUnwinder(This,nativeThreadID,contextFlags,cbContext,initialContext,ppUnwinder) ) + ( (This)->lpVtbl -> CreateVirtualUnwinder(This,nativeThreadID,contextFlags,cbContext,initialContext,ppUnwinder) ) #endif /* COBJMACROS */ @@ -2745,63 +2754,63 @@ EXTERN_C const IID IID_ICorDebugDataTarget2; #define __ICorDebugLoadedModule_INTERFACE_DEFINED__ /* interface ICorDebugLoadedModule */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugLoadedModule; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("817F343A-6630-4578-96C5-D11BC0EC5EE2") ICorDebugLoadedModule : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetBaseAddress( + virtual HRESULT STDMETHODCALLTYPE GetBaseAddress( /* [out] */ CORDB_ADDRESS *pAddress) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetName( + + virtual HRESULT STDMETHODCALLTYPE GetName( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSize( + + virtual HRESULT STDMETHODCALLTYPE GetSize( /* [out] */ ULONG32 *pcBytes) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugLoadedModuleVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugLoadedModule * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugLoadedModule * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugLoadedModule * This); - - HRESULT ( STDMETHODCALLTYPE *GetBaseAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetBaseAddress )( ICorDebugLoadedModule * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *GetName )( + + HRESULT ( STDMETHODCALLTYPE *GetName )( ICorDebugLoadedModule * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugLoadedModule * This, /* [out] */ ULONG32 *pcBytes); - + END_INTERFACE } ICorDebugLoadedModuleVtbl; @@ -2810,29 +2819,29 @@ EXTERN_C const IID IID_ICorDebugLoadedModule; CONST_VTBL struct ICorDebugLoadedModuleVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugLoadedModule_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugLoadedModule_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugLoadedModule_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugLoadedModule_GetBaseAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetBaseAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetBaseAddress(This,pAddress) ) #define ICorDebugLoadedModule_GetName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) #define ICorDebugLoadedModule_GetSize(This,pcBytes) \ - ( (This)->lpVtbl -> GetSize(This,pcBytes) ) + ( (This)->lpVtbl -> GetSize(This,pcBytes) ) #endif /* COBJMACROS */ @@ -2849,49 +2858,49 @@ EXTERN_C const IID IID_ICorDebugLoadedModule; #define __ICorDebugDataTarget3_INTERFACE_DEFINED__ /* interface ICorDebugDataTarget3 */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugDataTarget3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("D05E60C3-848C-4E7D-894E-623320FF6AFA") ICorDebugDataTarget3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetLoadedModules( + virtual HRESULT STDMETHODCALLTYPE GetLoadedModules( /* [in] */ ULONG32 cRequestedModules, /* [out] */ ULONG32 *pcFetchedModules, /* [length_is][size_is][out] */ ICorDebugLoadedModule *pLoadedModules[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugDataTarget3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugDataTarget3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugDataTarget3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugDataTarget3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetLoadedModules )( + + HRESULT ( STDMETHODCALLTYPE *GetLoadedModules )( ICorDebugDataTarget3 * This, /* [in] */ ULONG32 cRequestedModules, /* [out] */ ULONG32 *pcFetchedModules, /* [length_is][size_is][out] */ ICorDebugLoadedModule *pLoadedModules[ ]); - + END_INTERFACE } ICorDebugDataTarget3Vtbl; @@ -2900,23 +2909,23 @@ EXTERN_C const IID IID_ICorDebugDataTarget3; CONST_VTBL struct ICorDebugDataTarget3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugDataTarget3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugDataTarget3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugDataTarget3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugDataTarget3_GetLoadedModules(This,cRequestedModules,pcFetchedModules,pLoadedModules) \ - ( (This)->lpVtbl -> GetLoadedModules(This,cRequestedModules,pcFetchedModules,pLoadedModules) ) + ( (This)->lpVtbl -> GetLoadedModules(This,cRequestedModules,pcFetchedModules,pLoadedModules) ) #endif /* COBJMACROS */ @@ -2933,49 +2942,49 @@ EXTERN_C const IID IID_ICorDebugDataTarget3; #define __ICorDebugDataTarget4_INTERFACE_DEFINED__ /* interface ICorDebugDataTarget4 */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugDataTarget4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("E799DC06-E099-4713-BDD9-906D3CC02CF2") ICorDebugDataTarget4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE VirtualUnwind( + virtual HRESULT STDMETHODCALLTYPE VirtualUnwind( /* [in] */ DWORD threadId, /* [in] */ ULONG32 contextSize, /* [size_is][out][in] */ BYTE *context) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugDataTarget4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugDataTarget4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugDataTarget4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugDataTarget4 * This); - - HRESULT ( STDMETHODCALLTYPE *VirtualUnwind )( + + HRESULT ( STDMETHODCALLTYPE *VirtualUnwind )( ICorDebugDataTarget4 * This, /* [in] */ DWORD threadId, /* [in] */ ULONG32 contextSize, /* [size_is][out][in] */ BYTE *context); - + END_INTERFACE } ICorDebugDataTarget4Vtbl; @@ -2984,23 +2993,23 @@ EXTERN_C const IID IID_ICorDebugDataTarget4; CONST_VTBL struct ICorDebugDataTarget4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugDataTarget4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugDataTarget4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugDataTarget4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugDataTarget4_VirtualUnwind(This,threadId,contextSize,context) \ - ( (This)->lpVtbl -> VirtualUnwind(This,threadId,contextSize,context) ) + ( (This)->lpVtbl -> VirtualUnwind(This,threadId,contextSize,context) ) #endif /* COBJMACROS */ @@ -3017,87 +3026,87 @@ EXTERN_C const IID IID_ICorDebugDataTarget4; #define __ICorDebugMutableDataTarget_INTERFACE_DEFINED__ /* interface ICorDebugMutableDataTarget */ -/* [unique][local][uuid][object] */ +/* [unique][local][uuid][object] */ EXTERN_C const IID IID_ICorDebugMutableDataTarget; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("A1B8A756-3CB6-4CCB-979F-3DF999673A59") ICorDebugMutableDataTarget : public ICorDebugDataTarget { public: - virtual HRESULT STDMETHODCALLTYPE WriteVirtual( + virtual HRESULT STDMETHODCALLTYPE WriteVirtual( /* [in] */ CORDB_ADDRESS address, /* [size_is][in] */ const BYTE *pBuffer, /* [in] */ ULONG32 bytesRequested) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetThreadContext( + + virtual HRESULT STDMETHODCALLTYPE SetThreadContext( /* [in] */ DWORD dwThreadID, /* [in] */ ULONG32 contextSize, /* [size_is][in] */ const BYTE *pContext) = 0; - - virtual HRESULT STDMETHODCALLTYPE ContinueStatusChanged( + + virtual HRESULT STDMETHODCALLTYPE ContinueStatusChanged( /* [in] */ DWORD dwThreadId, /* [in] */ CORDB_CONTINUE_STATUS continueStatus) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugMutableDataTargetVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugMutableDataTarget * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugMutableDataTarget * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugMutableDataTarget * This); - - HRESULT ( STDMETHODCALLTYPE *GetPlatform )( + + HRESULT ( STDMETHODCALLTYPE *GetPlatform )( ICorDebugMutableDataTarget * This, /* [out] */ CorDebugPlatform *pTargetPlatform); - - HRESULT ( STDMETHODCALLTYPE *ReadVirtual )( + + HRESULT ( STDMETHODCALLTYPE *ReadVirtual )( ICorDebugMutableDataTarget * This, /* [in] */ CORDB_ADDRESS address, /* [length_is][size_is][out] */ BYTE *pBuffer, /* [in] */ ULONG32 bytesRequested, /* [out] */ ULONG32 *pBytesRead); - - HRESULT ( STDMETHODCALLTYPE *GetThreadContext )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadContext )( ICorDebugMutableDataTarget * This, /* [in] */ DWORD dwThreadID, /* [in] */ ULONG32 contextFlags, /* [in] */ ULONG32 contextSize, /* [size_is][out] */ BYTE *pContext); - - HRESULT ( STDMETHODCALLTYPE *WriteVirtual )( + + HRESULT ( STDMETHODCALLTYPE *WriteVirtual )( ICorDebugMutableDataTarget * This, /* [in] */ CORDB_ADDRESS address, /* [size_is][in] */ const BYTE *pBuffer, /* [in] */ ULONG32 bytesRequested); - - HRESULT ( STDMETHODCALLTYPE *SetThreadContext )( + + HRESULT ( STDMETHODCALLTYPE *SetThreadContext )( ICorDebugMutableDataTarget * This, /* [in] */ DWORD dwThreadID, /* [in] */ ULONG32 contextSize, /* [size_is][in] */ const BYTE *pContext); - - HRESULT ( STDMETHODCALLTYPE *ContinueStatusChanged )( + + HRESULT ( STDMETHODCALLTYPE *ContinueStatusChanged )( ICorDebugMutableDataTarget * This, /* [in] */ DWORD dwThreadId, /* [in] */ CORDB_CONTINUE_STATUS continueStatus); - + END_INTERFACE } ICorDebugMutableDataTargetVtbl; @@ -3106,39 +3115,39 @@ EXTERN_C const IID IID_ICorDebugMutableDataTarget; CONST_VTBL struct ICorDebugMutableDataTargetVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugMutableDataTarget_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugMutableDataTarget_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugMutableDataTarget_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugMutableDataTarget_GetPlatform(This,pTargetPlatform) \ - ( (This)->lpVtbl -> GetPlatform(This,pTargetPlatform) ) + ( (This)->lpVtbl -> GetPlatform(This,pTargetPlatform) ) #define ICorDebugMutableDataTarget_ReadVirtual(This,address,pBuffer,bytesRequested,pBytesRead) \ - ( (This)->lpVtbl -> ReadVirtual(This,address,pBuffer,bytesRequested,pBytesRead) ) + ( (This)->lpVtbl -> ReadVirtual(This,address,pBuffer,bytesRequested,pBytesRead) ) #define ICorDebugMutableDataTarget_GetThreadContext(This,dwThreadID,contextFlags,contextSize,pContext) \ - ( (This)->lpVtbl -> GetThreadContext(This,dwThreadID,contextFlags,contextSize,pContext) ) + ( (This)->lpVtbl -> GetThreadContext(This,dwThreadID,contextFlags,contextSize,pContext) ) #define ICorDebugMutableDataTarget_WriteVirtual(This,address,pBuffer,bytesRequested) \ - ( (This)->lpVtbl -> WriteVirtual(This,address,pBuffer,bytesRequested) ) + ( (This)->lpVtbl -> WriteVirtual(This,address,pBuffer,bytesRequested) ) #define ICorDebugMutableDataTarget_SetThreadContext(This,dwThreadID,contextSize,pContext) \ - ( (This)->lpVtbl -> SetThreadContext(This,dwThreadID,contextSize,pContext) ) + ( (This)->lpVtbl -> SetThreadContext(This,dwThreadID,contextSize,pContext) ) #define ICorDebugMutableDataTarget_ContinueStatusChanged(This,dwThreadId,continueStatus) \ - ( (This)->lpVtbl -> ContinueStatusChanged(This,dwThreadId,continueStatus) ) + ( (This)->lpVtbl -> ContinueStatusChanged(This,dwThreadId,continueStatus) ) #endif /* COBJMACROS */ @@ -3155,59 +3164,59 @@ EXTERN_C const IID IID_ICorDebugMutableDataTarget; #define __ICorDebugMetaDataLocator_INTERFACE_DEFINED__ /* interface ICorDebugMetaDataLocator */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugMetaDataLocator; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("7cef8ba9-2ef7-42bf-973f-4171474f87d9") ICorDebugMetaDataLocator : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetMetaData( + virtual HRESULT STDMETHODCALLTYPE GetMetaData( /* [in] */ LPCWSTR wszImagePath, /* [in] */ DWORD dwImageTimeStamp, /* [in] */ DWORD dwImageSize, /* [in] */ ULONG32 cchPathBuffer, - /* [annotation][out] */ + /* [annotation][out] */ _Out_ ULONG32 *pcchPathBuffer, - /* [annotation][length_is][size_is][out] */ + /* [annotation][length_is][size_is][out] */ _Out_writes_to_(cchPathBuffer, *pcchPathBuffer) WCHAR wszPathBuffer[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugMetaDataLocatorVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugMetaDataLocator * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugMetaDataLocator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugMetaDataLocator * This); - - HRESULT ( STDMETHODCALLTYPE *GetMetaData )( + + HRESULT ( STDMETHODCALLTYPE *GetMetaData )( ICorDebugMetaDataLocator * This, /* [in] */ LPCWSTR wszImagePath, /* [in] */ DWORD dwImageTimeStamp, /* [in] */ DWORD dwImageSize, /* [in] */ ULONG32 cchPathBuffer, - /* [annotation][out] */ + /* [annotation][out] */ _Out_ ULONG32 *pcchPathBuffer, - /* [annotation][length_is][size_is][out] */ + /* [annotation][length_is][size_is][out] */ _Out_writes_to_(cchPathBuffer, *pcchPathBuffer) WCHAR wszPathBuffer[ ]); - + END_INTERFACE } ICorDebugMetaDataLocatorVtbl; @@ -3216,23 +3225,23 @@ EXTERN_C const IID IID_ICorDebugMetaDataLocator; CONST_VTBL struct ICorDebugMetaDataLocatorVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugMetaDataLocator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugMetaDataLocator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugMetaDataLocator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugMetaDataLocator_GetMetaData(This,wszImagePath,dwImageTimeStamp,dwImageSize,cchPathBuffer,pcchPathBuffer,wszPathBuffer) \ - ( (This)->lpVtbl -> GetMetaData(This,wszImagePath,dwImageTimeStamp,dwImageSize,cchPathBuffer,pcchPathBuffer,wszPathBuffer) ) + ( (This)->lpVtbl -> GetMetaData(This,wszImagePath,dwImageTimeStamp,dwImageSize,cchPathBuffer,pcchPathBuffer,wszPathBuffer) ) #endif /* COBJMACROS */ @@ -3246,10 +3255,10 @@ EXTERN_C const IID IID_ICorDebugMetaDataLocator; /* interface __MIDL_itf_cordebug_0000_0015 */ -/* [local] */ +/* [local] */ #pragma warning(push) -#pragma warning(disable:28718) +#pragma warning(disable:28718) extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0015_v0_0_c_ifspec; @@ -3259,9 +3268,9 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0015_v0_0_s_ifspec; #define __ICorDebugManagedCallback_INTERFACE_DEFINED__ /* interface ICorDebugManagedCallback */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugStepReason { STEP_NORMAL = 0, @@ -3270,10 +3279,10 @@ enum CorDebugStepReason STEP_EXCEPTION_FILTER = ( STEP_CALL + 1 ) , STEP_EXCEPTION_HANDLER = ( STEP_EXCEPTION_FILTER + 1 ) , STEP_INTERCEPT = ( STEP_EXCEPTION_HANDLER + 1 ) , - STEP_EXIT = ( STEP_INTERCEPT + 1 ) + STEP_EXIT = ( STEP_INTERCEPT + 1 ) } CorDebugStepReason; -typedef +typedef enum LoggingLevelEnum { LTraceLevel0 = 0, @@ -3291,253 +3300,253 @@ enum LoggingLevelEnum LPanicLevel = 100 } LoggingLevelEnum; -typedef +typedef enum LogSwitchCallReason { SWITCH_CREATE = 0, SWITCH_MODIFY = ( SWITCH_CREATE + 1 ) , - SWITCH_DELETE = ( SWITCH_MODIFY + 1 ) + SWITCH_DELETE = ( SWITCH_MODIFY + 1 ) } LogSwitchCallReason; EXTERN_C const IID IID_ICorDebugManagedCallback; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("3d6f5f60-7538-11d3-8d5b-00104b35e7ef") ICorDebugManagedCallback : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE Breakpoint( + virtual HRESULT STDMETHODCALLTYPE Breakpoint( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugBreakpoint *pBreakpoint) = 0; - - virtual HRESULT STDMETHODCALLTYPE StepComplete( + + virtual HRESULT STDMETHODCALLTYPE StepComplete( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugStepper *pStepper, /* [in] */ CorDebugStepReason reason) = 0; - - virtual HRESULT STDMETHODCALLTYPE Break( + + virtual HRESULT STDMETHODCALLTYPE Break( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *thread) = 0; - - virtual HRESULT STDMETHODCALLTYPE Exception( + + virtual HRESULT STDMETHODCALLTYPE Exception( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ BOOL unhandled) = 0; - - virtual HRESULT STDMETHODCALLTYPE EvalComplete( + + virtual HRESULT STDMETHODCALLTYPE EvalComplete( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugEval *pEval) = 0; - - virtual HRESULT STDMETHODCALLTYPE EvalException( + + virtual HRESULT STDMETHODCALLTYPE EvalException( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugEval *pEval) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateProcess( + + virtual HRESULT STDMETHODCALLTYPE CreateProcess( /* [in] */ ICorDebugProcess *pProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE ExitProcess( + + virtual HRESULT STDMETHODCALLTYPE ExitProcess( /* [in] */ ICorDebugProcess *pProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateThread( + + virtual HRESULT STDMETHODCALLTYPE CreateThread( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *thread) = 0; - - virtual HRESULT STDMETHODCALLTYPE ExitThread( + + virtual HRESULT STDMETHODCALLTYPE ExitThread( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *thread) = 0; - - virtual HRESULT STDMETHODCALLTYPE LoadModule( + + virtual HRESULT STDMETHODCALLTYPE LoadModule( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugModule *pModule) = 0; - - virtual HRESULT STDMETHODCALLTYPE UnloadModule( + + virtual HRESULT STDMETHODCALLTYPE UnloadModule( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugModule *pModule) = 0; - - virtual HRESULT STDMETHODCALLTYPE LoadClass( + + virtual HRESULT STDMETHODCALLTYPE LoadClass( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugClass *c) = 0; - - virtual HRESULT STDMETHODCALLTYPE UnloadClass( + + virtual HRESULT STDMETHODCALLTYPE UnloadClass( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugClass *c) = 0; - - virtual HRESULT STDMETHODCALLTYPE DebuggerError( + + virtual HRESULT STDMETHODCALLTYPE DebuggerError( /* [in] */ ICorDebugProcess *pProcess, /* [in] */ HRESULT errorHR, /* [in] */ DWORD errorCode) = 0; - - virtual HRESULT STDMETHODCALLTYPE LogMessage( + + virtual HRESULT STDMETHODCALLTYPE LogMessage( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ LONG lLevel, /* [in] */ WCHAR *pLogSwitchName, /* [in] */ WCHAR *pMessage) = 0; - - virtual HRESULT STDMETHODCALLTYPE LogSwitch( + + virtual HRESULT STDMETHODCALLTYPE LogSwitch( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ LONG lLevel, /* [in] */ ULONG ulReason, /* [in] */ WCHAR *pLogSwitchName, /* [in] */ WCHAR *pParentName) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateAppDomain( + + virtual HRESULT STDMETHODCALLTYPE CreateAppDomain( /* [in] */ ICorDebugProcess *pProcess, /* [in] */ ICorDebugAppDomain *pAppDomain) = 0; - - virtual HRESULT STDMETHODCALLTYPE ExitAppDomain( + + virtual HRESULT STDMETHODCALLTYPE ExitAppDomain( /* [in] */ ICorDebugProcess *pProcess, /* [in] */ ICorDebugAppDomain *pAppDomain) = 0; - - virtual HRESULT STDMETHODCALLTYPE LoadAssembly( + + virtual HRESULT STDMETHODCALLTYPE LoadAssembly( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugAssembly *pAssembly) = 0; - - virtual HRESULT STDMETHODCALLTYPE UnloadAssembly( + + virtual HRESULT STDMETHODCALLTYPE UnloadAssembly( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugAssembly *pAssembly) = 0; - - virtual HRESULT STDMETHODCALLTYPE ControlCTrap( + + virtual HRESULT STDMETHODCALLTYPE ControlCTrap( /* [in] */ ICorDebugProcess *pProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE NameChange( + + virtual HRESULT STDMETHODCALLTYPE NameChange( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread) = 0; - - virtual HRESULT STDMETHODCALLTYPE UpdateModuleSymbols( + + virtual HRESULT STDMETHODCALLTYPE UpdateModuleSymbols( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugModule *pModule, /* [in] */ IStream *pSymbolStream) = 0; - - virtual HRESULT STDMETHODCALLTYPE EditAndContinueRemap( + + virtual HRESULT STDMETHODCALLTYPE EditAndContinueRemap( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugFunction *pFunction, /* [in] */ BOOL fAccurate) = 0; - - virtual HRESULT STDMETHODCALLTYPE BreakpointSetError( + + virtual HRESULT STDMETHODCALLTYPE BreakpointSetError( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugBreakpoint *pBreakpoint, /* [in] */ DWORD dwError) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugManagedCallbackVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugManagedCallback * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugManagedCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugManagedCallback * This); - - HRESULT ( STDMETHODCALLTYPE *Breakpoint )( + + HRESULT ( STDMETHODCALLTYPE *Breakpoint )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugBreakpoint *pBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *StepComplete )( + + HRESULT ( STDMETHODCALLTYPE *StepComplete )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugStepper *pStepper, /* [in] */ CorDebugStepReason reason); - - HRESULT ( STDMETHODCALLTYPE *Break )( + + HRESULT ( STDMETHODCALLTYPE *Break )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *thread); - - HRESULT ( STDMETHODCALLTYPE *Exception )( + + HRESULT ( STDMETHODCALLTYPE *Exception )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ BOOL unhandled); - - HRESULT ( STDMETHODCALLTYPE *EvalComplete )( + + HRESULT ( STDMETHODCALLTYPE *EvalComplete )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugEval *pEval); - - HRESULT ( STDMETHODCALLTYPE *EvalException )( + + HRESULT ( STDMETHODCALLTYPE *EvalException )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugEval *pEval); - - HRESULT ( STDMETHODCALLTYPE *CreateProcess )( + + HRESULT ( STDMETHODCALLTYPE *CreateProcess )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugProcess *pProcess); - - HRESULT ( STDMETHODCALLTYPE *ExitProcess )( + + HRESULT ( STDMETHODCALLTYPE *ExitProcess )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugProcess *pProcess); - - HRESULT ( STDMETHODCALLTYPE *CreateThread )( + + HRESULT ( STDMETHODCALLTYPE *CreateThread )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *thread); - - HRESULT ( STDMETHODCALLTYPE *ExitThread )( + + HRESULT ( STDMETHODCALLTYPE *ExitThread )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *thread); - - HRESULT ( STDMETHODCALLTYPE *LoadModule )( + + HRESULT ( STDMETHODCALLTYPE *LoadModule )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugModule *pModule); - - HRESULT ( STDMETHODCALLTYPE *UnloadModule )( + + HRESULT ( STDMETHODCALLTYPE *UnloadModule )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugModule *pModule); - - HRESULT ( STDMETHODCALLTYPE *LoadClass )( + + HRESULT ( STDMETHODCALLTYPE *LoadClass )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugClass *c); - - HRESULT ( STDMETHODCALLTYPE *UnloadClass )( + + HRESULT ( STDMETHODCALLTYPE *UnloadClass )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugClass *c); - - HRESULT ( STDMETHODCALLTYPE *DebuggerError )( + + HRESULT ( STDMETHODCALLTYPE *DebuggerError )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugProcess *pProcess, /* [in] */ HRESULT errorHR, /* [in] */ DWORD errorCode); - - HRESULT ( STDMETHODCALLTYPE *LogMessage )( + + HRESULT ( STDMETHODCALLTYPE *LogMessage )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ LONG lLevel, /* [in] */ WCHAR *pLogSwitchName, /* [in] */ WCHAR *pMessage); - - HRESULT ( STDMETHODCALLTYPE *LogSwitch )( + + HRESULT ( STDMETHODCALLTYPE *LogSwitch )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, @@ -3545,56 +3554,56 @@ EXTERN_C const IID IID_ICorDebugManagedCallback; /* [in] */ ULONG ulReason, /* [in] */ WCHAR *pLogSwitchName, /* [in] */ WCHAR *pParentName); - - HRESULT ( STDMETHODCALLTYPE *CreateAppDomain )( + + HRESULT ( STDMETHODCALLTYPE *CreateAppDomain )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugProcess *pProcess, /* [in] */ ICorDebugAppDomain *pAppDomain); - - HRESULT ( STDMETHODCALLTYPE *ExitAppDomain )( + + HRESULT ( STDMETHODCALLTYPE *ExitAppDomain )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugProcess *pProcess, /* [in] */ ICorDebugAppDomain *pAppDomain); - - HRESULT ( STDMETHODCALLTYPE *LoadAssembly )( + + HRESULT ( STDMETHODCALLTYPE *LoadAssembly )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugAssembly *pAssembly); - - HRESULT ( STDMETHODCALLTYPE *UnloadAssembly )( + + HRESULT ( STDMETHODCALLTYPE *UnloadAssembly )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugAssembly *pAssembly); - - HRESULT ( STDMETHODCALLTYPE *ControlCTrap )( + + HRESULT ( STDMETHODCALLTYPE *ControlCTrap )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugProcess *pProcess); - - HRESULT ( STDMETHODCALLTYPE *NameChange )( + + HRESULT ( STDMETHODCALLTYPE *NameChange )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread); - - HRESULT ( STDMETHODCALLTYPE *UpdateModuleSymbols )( + + HRESULT ( STDMETHODCALLTYPE *UpdateModuleSymbols )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugModule *pModule, /* [in] */ IStream *pSymbolStream); - - HRESULT ( STDMETHODCALLTYPE *EditAndContinueRemap )( + + HRESULT ( STDMETHODCALLTYPE *EditAndContinueRemap )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugFunction *pFunction, /* [in] */ BOOL fAccurate); - - HRESULT ( STDMETHODCALLTYPE *BreakpointSetError )( + + HRESULT ( STDMETHODCALLTYPE *BreakpointSetError )( ICorDebugManagedCallback * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugBreakpoint *pBreakpoint, /* [in] */ DWORD dwError); - + END_INTERFACE } ICorDebugManagedCallbackVtbl; @@ -3603,98 +3612,98 @@ EXTERN_C const IID IID_ICorDebugManagedCallback; CONST_VTBL struct ICorDebugManagedCallbackVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugManagedCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugManagedCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugManagedCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugManagedCallback_Breakpoint(This,pAppDomain,pThread,pBreakpoint) \ - ( (This)->lpVtbl -> Breakpoint(This,pAppDomain,pThread,pBreakpoint) ) + ( (This)->lpVtbl -> Breakpoint(This,pAppDomain,pThread,pBreakpoint) ) #define ICorDebugManagedCallback_StepComplete(This,pAppDomain,pThread,pStepper,reason) \ - ( (This)->lpVtbl -> StepComplete(This,pAppDomain,pThread,pStepper,reason) ) + ( (This)->lpVtbl -> StepComplete(This,pAppDomain,pThread,pStepper,reason) ) #define ICorDebugManagedCallback_Break(This,pAppDomain,thread) \ - ( (This)->lpVtbl -> Break(This,pAppDomain,thread) ) + ( (This)->lpVtbl -> Break(This,pAppDomain,thread) ) #define ICorDebugManagedCallback_Exception(This,pAppDomain,pThread,unhandled) \ - ( (This)->lpVtbl -> Exception(This,pAppDomain,pThread,unhandled) ) + ( (This)->lpVtbl -> Exception(This,pAppDomain,pThread,unhandled) ) #define ICorDebugManagedCallback_EvalComplete(This,pAppDomain,pThread,pEval) \ - ( (This)->lpVtbl -> EvalComplete(This,pAppDomain,pThread,pEval) ) + ( (This)->lpVtbl -> EvalComplete(This,pAppDomain,pThread,pEval) ) #define ICorDebugManagedCallback_EvalException(This,pAppDomain,pThread,pEval) \ - ( (This)->lpVtbl -> EvalException(This,pAppDomain,pThread,pEval) ) + ( (This)->lpVtbl -> EvalException(This,pAppDomain,pThread,pEval) ) #define ICorDebugManagedCallback_CreateProcess(This,pProcess) \ - ( (This)->lpVtbl -> CreateProcess(This,pProcess) ) + ( (This)->lpVtbl -> CreateProcess(This,pProcess) ) #define ICorDebugManagedCallback_ExitProcess(This,pProcess) \ - ( (This)->lpVtbl -> ExitProcess(This,pProcess) ) + ( (This)->lpVtbl -> ExitProcess(This,pProcess) ) #define ICorDebugManagedCallback_CreateThread(This,pAppDomain,thread) \ - ( (This)->lpVtbl -> CreateThread(This,pAppDomain,thread) ) + ( (This)->lpVtbl -> CreateThread(This,pAppDomain,thread) ) #define ICorDebugManagedCallback_ExitThread(This,pAppDomain,thread) \ - ( (This)->lpVtbl -> ExitThread(This,pAppDomain,thread) ) + ( (This)->lpVtbl -> ExitThread(This,pAppDomain,thread) ) #define ICorDebugManagedCallback_LoadModule(This,pAppDomain,pModule) \ - ( (This)->lpVtbl -> LoadModule(This,pAppDomain,pModule) ) + ( (This)->lpVtbl -> LoadModule(This,pAppDomain,pModule) ) #define ICorDebugManagedCallback_UnloadModule(This,pAppDomain,pModule) \ - ( (This)->lpVtbl -> UnloadModule(This,pAppDomain,pModule) ) + ( (This)->lpVtbl -> UnloadModule(This,pAppDomain,pModule) ) #define ICorDebugManagedCallback_LoadClass(This,pAppDomain,c) \ - ( (This)->lpVtbl -> LoadClass(This,pAppDomain,c) ) + ( (This)->lpVtbl -> LoadClass(This,pAppDomain,c) ) #define ICorDebugManagedCallback_UnloadClass(This,pAppDomain,c) \ - ( (This)->lpVtbl -> UnloadClass(This,pAppDomain,c) ) + ( (This)->lpVtbl -> UnloadClass(This,pAppDomain,c) ) #define ICorDebugManagedCallback_DebuggerError(This,pProcess,errorHR,errorCode) \ - ( (This)->lpVtbl -> DebuggerError(This,pProcess,errorHR,errorCode) ) + ( (This)->lpVtbl -> DebuggerError(This,pProcess,errorHR,errorCode) ) #define ICorDebugManagedCallback_LogMessage(This,pAppDomain,pThread,lLevel,pLogSwitchName,pMessage) \ - ( (This)->lpVtbl -> LogMessage(This,pAppDomain,pThread,lLevel,pLogSwitchName,pMessage) ) + ( (This)->lpVtbl -> LogMessage(This,pAppDomain,pThread,lLevel,pLogSwitchName,pMessage) ) #define ICorDebugManagedCallback_LogSwitch(This,pAppDomain,pThread,lLevel,ulReason,pLogSwitchName,pParentName) \ - ( (This)->lpVtbl -> LogSwitch(This,pAppDomain,pThread,lLevel,ulReason,pLogSwitchName,pParentName) ) + ( (This)->lpVtbl -> LogSwitch(This,pAppDomain,pThread,lLevel,ulReason,pLogSwitchName,pParentName) ) #define ICorDebugManagedCallback_CreateAppDomain(This,pProcess,pAppDomain) \ - ( (This)->lpVtbl -> CreateAppDomain(This,pProcess,pAppDomain) ) + ( (This)->lpVtbl -> CreateAppDomain(This,pProcess,pAppDomain) ) #define ICorDebugManagedCallback_ExitAppDomain(This,pProcess,pAppDomain) \ - ( (This)->lpVtbl -> ExitAppDomain(This,pProcess,pAppDomain) ) + ( (This)->lpVtbl -> ExitAppDomain(This,pProcess,pAppDomain) ) #define ICorDebugManagedCallback_LoadAssembly(This,pAppDomain,pAssembly) \ - ( (This)->lpVtbl -> LoadAssembly(This,pAppDomain,pAssembly) ) + ( (This)->lpVtbl -> LoadAssembly(This,pAppDomain,pAssembly) ) #define ICorDebugManagedCallback_UnloadAssembly(This,pAppDomain,pAssembly) \ - ( (This)->lpVtbl -> UnloadAssembly(This,pAppDomain,pAssembly) ) + ( (This)->lpVtbl -> UnloadAssembly(This,pAppDomain,pAssembly) ) #define ICorDebugManagedCallback_ControlCTrap(This,pProcess) \ - ( (This)->lpVtbl -> ControlCTrap(This,pProcess) ) + ( (This)->lpVtbl -> ControlCTrap(This,pProcess) ) #define ICorDebugManagedCallback_NameChange(This,pAppDomain,pThread) \ - ( (This)->lpVtbl -> NameChange(This,pAppDomain,pThread) ) + ( (This)->lpVtbl -> NameChange(This,pAppDomain,pThread) ) #define ICorDebugManagedCallback_UpdateModuleSymbols(This,pAppDomain,pModule,pSymbolStream) \ - ( (This)->lpVtbl -> UpdateModuleSymbols(This,pAppDomain,pModule,pSymbolStream) ) + ( (This)->lpVtbl -> UpdateModuleSymbols(This,pAppDomain,pModule,pSymbolStream) ) #define ICorDebugManagedCallback_EditAndContinueRemap(This,pAppDomain,pThread,pFunction,fAccurate) \ - ( (This)->lpVtbl -> EditAndContinueRemap(This,pAppDomain,pThread,pFunction,fAccurate) ) + ( (This)->lpVtbl -> EditAndContinueRemap(This,pAppDomain,pThread,pFunction,fAccurate) ) #define ICorDebugManagedCallback_BreakpointSetError(This,pAppDomain,pThread,pBreakpoint,dwError) \ - ( (This)->lpVtbl -> BreakpointSetError(This,pAppDomain,pThread,pBreakpoint,dwError) ) + ( (This)->lpVtbl -> BreakpointSetError(This,pAppDomain,pThread,pBreakpoint,dwError) ) #endif /* COBJMACROS */ @@ -3708,7 +3717,7 @@ EXTERN_C const IID IID_ICorDebugManagedCallback; /* interface __MIDL_itf_cordebug_0000_0016 */ -/* [local] */ +/* [local] */ #pragma warning(pop) #pragma warning(push) @@ -3721,47 +3730,47 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0016_v0_0_s_ifspec; #define __ICorDebugManagedCallback3_INTERFACE_DEFINED__ /* interface ICorDebugManagedCallback3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugManagedCallback3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("264EA0FC-2591-49AA-868E-835E6515323F") ICorDebugManagedCallback3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CustomNotification( + virtual HRESULT STDMETHODCALLTYPE CustomNotification( /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugAppDomain *pAppDomain) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugManagedCallback3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugManagedCallback3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugManagedCallback3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugManagedCallback3 * This); - - HRESULT ( STDMETHODCALLTYPE *CustomNotification )( + + HRESULT ( STDMETHODCALLTYPE *CustomNotification )( ICorDebugManagedCallback3 * This, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugAppDomain *pAppDomain); - + END_INTERFACE } ICorDebugManagedCallback3Vtbl; @@ -3770,23 +3779,23 @@ EXTERN_C const IID IID_ICorDebugManagedCallback3; CONST_VTBL struct ICorDebugManagedCallback3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugManagedCallback3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugManagedCallback3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugManagedCallback3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugManagedCallback3_CustomNotification(This,pThread,pAppDomain) \ - ( (This)->lpVtbl -> CustomNotification(This,pThread,pAppDomain) ) + ( (This)->lpVtbl -> CustomNotification(This,pThread,pAppDomain) ) #endif /* COBJMACROS */ @@ -3803,65 +3812,65 @@ EXTERN_C const IID IID_ICorDebugManagedCallback3; #define __ICorDebugManagedCallback4_INTERFACE_DEFINED__ /* interface ICorDebugManagedCallback4 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugManagedCallback4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("322911AE-16A5-49BA-84A3-ED69678138A3") ICorDebugManagedCallback4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE BeforeGarbageCollection( + virtual HRESULT STDMETHODCALLTYPE BeforeGarbageCollection( /* [in] */ ICorDebugProcess *pProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE AfterGarbageCollection( + + virtual HRESULT STDMETHODCALLTYPE AfterGarbageCollection( /* [in] */ ICorDebugProcess *pProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE DataBreakpoint( + + virtual HRESULT STDMETHODCALLTYPE DataBreakpoint( /* [in] */ ICorDebugProcess *pProcess, /* [in] */ ICorDebugThread *pThread, /* [in] */ BYTE *pContext, /* [in] */ ULONG32 contextSize) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugManagedCallback4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugManagedCallback4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugManagedCallback4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugManagedCallback4 * This); - - HRESULT ( STDMETHODCALLTYPE *BeforeGarbageCollection )( + + HRESULT ( STDMETHODCALLTYPE *BeforeGarbageCollection )( ICorDebugManagedCallback4 * This, /* [in] */ ICorDebugProcess *pProcess); - - HRESULT ( STDMETHODCALLTYPE *AfterGarbageCollection )( + + HRESULT ( STDMETHODCALLTYPE *AfterGarbageCollection )( ICorDebugManagedCallback4 * This, /* [in] */ ICorDebugProcess *pProcess); - - HRESULT ( STDMETHODCALLTYPE *DataBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *DataBreakpoint )( ICorDebugManagedCallback4 * This, /* [in] */ ICorDebugProcess *pProcess, /* [in] */ ICorDebugThread *pThread, /* [in] */ BYTE *pContext, /* [in] */ ULONG32 contextSize); - + END_INTERFACE } ICorDebugManagedCallback4Vtbl; @@ -3870,29 +3879,29 @@ EXTERN_C const IID IID_ICorDebugManagedCallback4; CONST_VTBL struct ICorDebugManagedCallback4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugManagedCallback4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugManagedCallback4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugManagedCallback4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugManagedCallback4_BeforeGarbageCollection(This,pProcess) \ - ( (This)->lpVtbl -> BeforeGarbageCollection(This,pProcess) ) + ( (This)->lpVtbl -> BeforeGarbageCollection(This,pProcess) ) #define ICorDebugManagedCallback4_AfterGarbageCollection(This,pProcess) \ - ( (This)->lpVtbl -> AfterGarbageCollection(This,pProcess) ) + ( (This)->lpVtbl -> AfterGarbageCollection(This,pProcess) ) #define ICorDebugManagedCallback4_DataBreakpoint(This,pProcess,pThread,pContext,contextSize) \ - ( (This)->lpVtbl -> DataBreakpoint(This,pProcess,pThread,pContext,contextSize) ) + ( (This)->lpVtbl -> DataBreakpoint(This,pProcess,pThread,pContext,contextSize) ) #endif /* COBJMACROS */ @@ -3906,9 +3915,9 @@ EXTERN_C const IID IID_ICorDebugManagedCallback4; /* interface __MIDL_itf_cordebug_0000_0018 */ -/* [local] */ +/* [local] */ -#pragma warning(disable:28718) +#pragma warning(disable:28718) extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0018_v0_0_c_ifspec; @@ -3918,9 +3927,9 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0018_v0_0_s_ifspec; #define __ICorDebugManagedCallback2_INTERFACE_DEFINED__ /* interface ICorDebugManagedCallback2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugExceptionCallbackType { DEBUG_EXCEPTION_FIRST_CHANCE = 1, @@ -3929,14 +3938,14 @@ enum CorDebugExceptionCallbackType DEBUG_EXCEPTION_UNHANDLED = 4 } CorDebugExceptionCallbackType; -typedef +typedef enum CorDebugExceptionFlags { DEBUG_EXCEPTION_NONE = 0, DEBUG_EXCEPTION_CAN_BE_INTERCEPTED = 0x1 } CorDebugExceptionFlags; -typedef +typedef enum CorDebugExceptionUnwindCallbackType { DEBUG_EXCEPTION_UNWIND_BEGIN = 1, @@ -3947,101 +3956,101 @@ enum CorDebugExceptionUnwindCallbackType EXTERN_C const IID IID_ICorDebugManagedCallback2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("250E5EEA-DB5C-4C76-B6F3-8C46F12E3203") ICorDebugManagedCallback2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE FunctionRemapOpportunity( + virtual HRESULT STDMETHODCALLTYPE FunctionRemapOpportunity( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugFunction *pOldFunction, /* [in] */ ICorDebugFunction *pNewFunction, /* [in] */ ULONG32 oldILOffset) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateConnection( + + virtual HRESULT STDMETHODCALLTYPE CreateConnection( /* [in] */ ICorDebugProcess *pProcess, /* [in] */ CONNID dwConnectionId, /* [in] */ WCHAR *pConnName) = 0; - - virtual HRESULT STDMETHODCALLTYPE ChangeConnection( + + virtual HRESULT STDMETHODCALLTYPE ChangeConnection( /* [in] */ ICorDebugProcess *pProcess, /* [in] */ CONNID dwConnectionId) = 0; - - virtual HRESULT STDMETHODCALLTYPE DestroyConnection( + + virtual HRESULT STDMETHODCALLTYPE DestroyConnection( /* [in] */ ICorDebugProcess *pProcess, /* [in] */ CONNID dwConnectionId) = 0; - - virtual HRESULT STDMETHODCALLTYPE Exception( + + virtual HRESULT STDMETHODCALLTYPE Exception( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugFrame *pFrame, /* [in] */ ULONG32 nOffset, /* [in] */ CorDebugExceptionCallbackType dwEventType, /* [in] */ DWORD dwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE ExceptionUnwind( + + virtual HRESULT STDMETHODCALLTYPE ExceptionUnwind( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ CorDebugExceptionUnwindCallbackType dwEventType, /* [in] */ DWORD dwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE FunctionRemapComplete( + + virtual HRESULT STDMETHODCALLTYPE FunctionRemapComplete( /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugFunction *pFunction) = 0; - - virtual HRESULT STDMETHODCALLTYPE MDANotification( + + virtual HRESULT STDMETHODCALLTYPE MDANotification( /* [in] */ ICorDebugController *pController, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugMDA *pMDA) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugManagedCallback2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugManagedCallback2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugManagedCallback2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugManagedCallback2 * This); - - HRESULT ( STDMETHODCALLTYPE *FunctionRemapOpportunity )( + + HRESULT ( STDMETHODCALLTYPE *FunctionRemapOpportunity )( ICorDebugManagedCallback2 * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugFunction *pOldFunction, /* [in] */ ICorDebugFunction *pNewFunction, /* [in] */ ULONG32 oldILOffset); - - HRESULT ( STDMETHODCALLTYPE *CreateConnection )( + + HRESULT ( STDMETHODCALLTYPE *CreateConnection )( ICorDebugManagedCallback2 * This, /* [in] */ ICorDebugProcess *pProcess, /* [in] */ CONNID dwConnectionId, /* [in] */ WCHAR *pConnName); - - HRESULT ( STDMETHODCALLTYPE *ChangeConnection )( + + HRESULT ( STDMETHODCALLTYPE *ChangeConnection )( ICorDebugManagedCallback2 * This, /* [in] */ ICorDebugProcess *pProcess, /* [in] */ CONNID dwConnectionId); - - HRESULT ( STDMETHODCALLTYPE *DestroyConnection )( + + HRESULT ( STDMETHODCALLTYPE *DestroyConnection )( ICorDebugManagedCallback2 * This, /* [in] */ ICorDebugProcess *pProcess, /* [in] */ CONNID dwConnectionId); - - HRESULT ( STDMETHODCALLTYPE *Exception )( + + HRESULT ( STDMETHODCALLTYPE *Exception )( ICorDebugManagedCallback2 * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, @@ -4049,26 +4058,26 @@ EXTERN_C const IID IID_ICorDebugManagedCallback2; /* [in] */ ULONG32 nOffset, /* [in] */ CorDebugExceptionCallbackType dwEventType, /* [in] */ DWORD dwFlags); - - HRESULT ( STDMETHODCALLTYPE *ExceptionUnwind )( + + HRESULT ( STDMETHODCALLTYPE *ExceptionUnwind )( ICorDebugManagedCallback2 * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ CorDebugExceptionUnwindCallbackType dwEventType, /* [in] */ DWORD dwFlags); - - HRESULT ( STDMETHODCALLTYPE *FunctionRemapComplete )( + + HRESULT ( STDMETHODCALLTYPE *FunctionRemapComplete )( ICorDebugManagedCallback2 * This, /* [in] */ ICorDebugAppDomain *pAppDomain, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugFunction *pFunction); - - HRESULT ( STDMETHODCALLTYPE *MDANotification )( + + HRESULT ( STDMETHODCALLTYPE *MDANotification )( ICorDebugManagedCallback2 * This, /* [in] */ ICorDebugController *pController, /* [in] */ ICorDebugThread *pThread, /* [in] */ ICorDebugMDA *pMDA); - + END_INTERFACE } ICorDebugManagedCallback2Vtbl; @@ -4077,44 +4086,44 @@ EXTERN_C const IID IID_ICorDebugManagedCallback2; CONST_VTBL struct ICorDebugManagedCallback2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugManagedCallback2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugManagedCallback2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugManagedCallback2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugManagedCallback2_FunctionRemapOpportunity(This,pAppDomain,pThread,pOldFunction,pNewFunction,oldILOffset) \ - ( (This)->lpVtbl -> FunctionRemapOpportunity(This,pAppDomain,pThread,pOldFunction,pNewFunction,oldILOffset) ) + ( (This)->lpVtbl -> FunctionRemapOpportunity(This,pAppDomain,pThread,pOldFunction,pNewFunction,oldILOffset) ) #define ICorDebugManagedCallback2_CreateConnection(This,pProcess,dwConnectionId,pConnName) \ - ( (This)->lpVtbl -> CreateConnection(This,pProcess,dwConnectionId,pConnName) ) + ( (This)->lpVtbl -> CreateConnection(This,pProcess,dwConnectionId,pConnName) ) #define ICorDebugManagedCallback2_ChangeConnection(This,pProcess,dwConnectionId) \ - ( (This)->lpVtbl -> ChangeConnection(This,pProcess,dwConnectionId) ) + ( (This)->lpVtbl -> ChangeConnection(This,pProcess,dwConnectionId) ) #define ICorDebugManagedCallback2_DestroyConnection(This,pProcess,dwConnectionId) \ - ( (This)->lpVtbl -> DestroyConnection(This,pProcess,dwConnectionId) ) + ( (This)->lpVtbl -> DestroyConnection(This,pProcess,dwConnectionId) ) #define ICorDebugManagedCallback2_Exception(This,pAppDomain,pThread,pFrame,nOffset,dwEventType,dwFlags) \ - ( (This)->lpVtbl -> Exception(This,pAppDomain,pThread,pFrame,nOffset,dwEventType,dwFlags) ) + ( (This)->lpVtbl -> Exception(This,pAppDomain,pThread,pFrame,nOffset,dwEventType,dwFlags) ) #define ICorDebugManagedCallback2_ExceptionUnwind(This,pAppDomain,pThread,dwEventType,dwFlags) \ - ( (This)->lpVtbl -> ExceptionUnwind(This,pAppDomain,pThread,dwEventType,dwFlags) ) + ( (This)->lpVtbl -> ExceptionUnwind(This,pAppDomain,pThread,dwEventType,dwFlags) ) #define ICorDebugManagedCallback2_FunctionRemapComplete(This,pAppDomain,pThread,pFunction) \ - ( (This)->lpVtbl -> FunctionRemapComplete(This,pAppDomain,pThread,pFunction) ) + ( (This)->lpVtbl -> FunctionRemapComplete(This,pAppDomain,pThread,pFunction) ) #define ICorDebugManagedCallback2_MDANotification(This,pController,pThread,pMDA) \ - ( (This)->lpVtbl -> MDANotification(This,pController,pThread,pMDA) ) + ( (This)->lpVtbl -> MDANotification(This,pController,pThread,pMDA) ) #endif /* COBJMACROS */ @@ -4128,7 +4137,7 @@ EXTERN_C const IID IID_ICorDebugManagedCallback2; /* interface __MIDL_itf_cordebug_0000_0019 */ -/* [local] */ +/* [local] */ #pragma warning(pop) @@ -4140,47 +4149,47 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0019_v0_0_s_ifspec; #define __ICorDebugUnmanagedCallback_INTERFACE_DEFINED__ /* interface ICorDebugUnmanagedCallback */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugUnmanagedCallback; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("5263E909-8CB5-11d3-BD2F-0000F80849BD") ICorDebugUnmanagedCallback : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE DebugEvent( + virtual HRESULT STDMETHODCALLTYPE DebugEvent( /* [in] */ LPDEBUG_EVENT pDebugEvent, /* [in] */ BOOL fOutOfBand) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugUnmanagedCallbackVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugUnmanagedCallback * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugUnmanagedCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugUnmanagedCallback * This); - - HRESULT ( STDMETHODCALLTYPE *DebugEvent )( + + HRESULT ( STDMETHODCALLTYPE *DebugEvent )( ICorDebugUnmanagedCallback * This, /* [in] */ LPDEBUG_EVENT pDebugEvent, /* [in] */ BOOL fOutOfBand); - + END_INTERFACE } ICorDebugUnmanagedCallbackVtbl; @@ -4189,23 +4198,23 @@ EXTERN_C const IID IID_ICorDebugUnmanagedCallback; CONST_VTBL struct ICorDebugUnmanagedCallbackVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugUnmanagedCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugUnmanagedCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugUnmanagedCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugUnmanagedCallback_DebugEvent(This,pDebugEvent,fOutOfBand) \ - ( (This)->lpVtbl -> DebugEvent(This,pDebugEvent,fOutOfBand) ) + ( (This)->lpVtbl -> DebugEvent(This,pDebugEvent,fOutOfBand) ) #endif /* COBJMACROS */ @@ -4219,15 +4228,15 @@ EXTERN_C const IID IID_ICorDebugUnmanagedCallback; /* interface __MIDL_itf_cordebug_0000_0020 */ -/* [local] */ +/* [local] */ -typedef +typedef enum CorDebugCreateProcessFlags { DEBUG_NO_SPECIAL_OPTIONS = 0 } CorDebugCreateProcessFlags; -typedef +typedef enum CorDebugHandleType { HANDLE_STRONG = 1, @@ -4236,7 +4245,7 @@ enum CorDebugHandleType } CorDebugHandleType; #pragma warning(push) -#pragma warning(disable:28718) +#pragma warning(disable:28718) extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0020_v0_0_c_ifspec; @@ -4246,28 +4255,28 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0020_v0_0_s_ifspec; #define __ICorDebug_INTERFACE_DEFINED__ /* interface ICorDebug */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebug; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("3d6f5f61-7538-11d3-8d5b-00104b35e7ef") ICorDebug : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE Initialize( void) = 0; - + virtual HRESULT STDMETHODCALLTYPE Terminate( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetManagedHandler( + + virtual HRESULT STDMETHODCALLTYPE SetManagedHandler( /* [in] */ ICorDebugManagedCallback *pCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetUnmanagedHandler( + + virtual HRESULT STDMETHODCALLTYPE SetUnmanagedHandler( /* [in] */ ICorDebugUnmanagedCallback *pCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateProcess( + + virtual HRESULT STDMETHODCALLTYPE CreateProcess( /* [in] */ LPCWSTR lpApplicationName, /* [in] */ LPWSTR lpCommandLine, /* [in] */ LPSECURITY_ATTRIBUTES lpProcessAttributes, @@ -4280,59 +4289,59 @@ EXTERN_C const IID IID_ICorDebug; /* [in] */ LPPROCESS_INFORMATION lpProcessInformation, /* [in] */ CorDebugCreateProcessFlags debuggingFlags, /* [out] */ ICorDebugProcess **ppProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE DebugActiveProcess( + + virtual HRESULT STDMETHODCALLTYPE DebugActiveProcess( /* [in] */ DWORD id, /* [in] */ BOOL win32Attach, /* [out] */ ICorDebugProcess **ppProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateProcesses( + + virtual HRESULT STDMETHODCALLTYPE EnumerateProcesses( /* [out] */ ICorDebugProcessEnum **ppProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetProcess( + + virtual HRESULT STDMETHODCALLTYPE GetProcess( /* [in] */ DWORD dwProcessId, /* [out] */ ICorDebugProcess **ppProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE CanLaunchOrAttach( + + virtual HRESULT STDMETHODCALLTYPE CanLaunchOrAttach( /* [in] */ DWORD dwProcessId, /* [in] */ BOOL win32DebuggingEnabled) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebug * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebug * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebug * This); - - HRESULT ( STDMETHODCALLTYPE *Initialize )( + + HRESULT ( STDMETHODCALLTYPE *Initialize )( ICorDebug * This); - - HRESULT ( STDMETHODCALLTYPE *Terminate )( + + HRESULT ( STDMETHODCALLTYPE *Terminate )( ICorDebug * This); - - HRESULT ( STDMETHODCALLTYPE *SetManagedHandler )( + + HRESULT ( STDMETHODCALLTYPE *SetManagedHandler )( ICorDebug * This, /* [in] */ ICorDebugManagedCallback *pCallback); - - HRESULT ( STDMETHODCALLTYPE *SetUnmanagedHandler )( + + HRESULT ( STDMETHODCALLTYPE *SetUnmanagedHandler )( ICorDebug * This, /* [in] */ ICorDebugUnmanagedCallback *pCallback); - - HRESULT ( STDMETHODCALLTYPE *CreateProcess )( + + HRESULT ( STDMETHODCALLTYPE *CreateProcess )( ICorDebug * This, /* [in] */ LPCWSTR lpApplicationName, /* [in] */ LPWSTR lpCommandLine, @@ -4346,27 +4355,27 @@ EXTERN_C const IID IID_ICorDebug; /* [in] */ LPPROCESS_INFORMATION lpProcessInformation, /* [in] */ CorDebugCreateProcessFlags debuggingFlags, /* [out] */ ICorDebugProcess **ppProcess); - - HRESULT ( STDMETHODCALLTYPE *DebugActiveProcess )( + + HRESULT ( STDMETHODCALLTYPE *DebugActiveProcess )( ICorDebug * This, /* [in] */ DWORD id, /* [in] */ BOOL win32Attach, /* [out] */ ICorDebugProcess **ppProcess); - - HRESULT ( STDMETHODCALLTYPE *EnumerateProcesses )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateProcesses )( ICorDebug * This, /* [out] */ ICorDebugProcessEnum **ppProcess); - - HRESULT ( STDMETHODCALLTYPE *GetProcess )( + + HRESULT ( STDMETHODCALLTYPE *GetProcess )( ICorDebug * This, /* [in] */ DWORD dwProcessId, /* [out] */ ICorDebugProcess **ppProcess); - - HRESULT ( STDMETHODCALLTYPE *CanLaunchOrAttach )( + + HRESULT ( STDMETHODCALLTYPE *CanLaunchOrAttach )( ICorDebug * This, /* [in] */ DWORD dwProcessId, /* [in] */ BOOL win32DebuggingEnabled); - + END_INTERFACE } ICorDebugVtbl; @@ -4375,47 +4384,47 @@ EXTERN_C const IID IID_ICorDebug; CONST_VTBL struct ICorDebugVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebug_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebug_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebug_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebug_Initialize(This) \ - ( (This)->lpVtbl -> Initialize(This) ) + ( (This)->lpVtbl -> Initialize(This) ) #define ICorDebug_Terminate(This) \ - ( (This)->lpVtbl -> Terminate(This) ) + ( (This)->lpVtbl -> Terminate(This) ) #define ICorDebug_SetManagedHandler(This,pCallback) \ - ( (This)->lpVtbl -> SetManagedHandler(This,pCallback) ) + ( (This)->lpVtbl -> SetManagedHandler(This,pCallback) ) #define ICorDebug_SetUnmanagedHandler(This,pCallback) \ - ( (This)->lpVtbl -> SetUnmanagedHandler(This,pCallback) ) + ( (This)->lpVtbl -> SetUnmanagedHandler(This,pCallback) ) #define ICorDebug_CreateProcess(This,lpApplicationName,lpCommandLine,lpProcessAttributes,lpThreadAttributes,bInheritHandles,dwCreationFlags,lpEnvironment,lpCurrentDirectory,lpStartupInfo,lpProcessInformation,debuggingFlags,ppProcess) \ - ( (This)->lpVtbl -> CreateProcess(This,lpApplicationName,lpCommandLine,lpProcessAttributes,lpThreadAttributes,bInheritHandles,dwCreationFlags,lpEnvironment,lpCurrentDirectory,lpStartupInfo,lpProcessInformation,debuggingFlags,ppProcess) ) + ( (This)->lpVtbl -> CreateProcess(This,lpApplicationName,lpCommandLine,lpProcessAttributes,lpThreadAttributes,bInheritHandles,dwCreationFlags,lpEnvironment,lpCurrentDirectory,lpStartupInfo,lpProcessInformation,debuggingFlags,ppProcess) ) #define ICorDebug_DebugActiveProcess(This,id,win32Attach,ppProcess) \ - ( (This)->lpVtbl -> DebugActiveProcess(This,id,win32Attach,ppProcess) ) + ( (This)->lpVtbl -> DebugActiveProcess(This,id,win32Attach,ppProcess) ) #define ICorDebug_EnumerateProcesses(This,ppProcess) \ - ( (This)->lpVtbl -> EnumerateProcesses(This,ppProcess) ) + ( (This)->lpVtbl -> EnumerateProcesses(This,ppProcess) ) #define ICorDebug_GetProcess(This,dwProcessId,ppProcess) \ - ( (This)->lpVtbl -> GetProcess(This,dwProcessId,ppProcess) ) + ( (This)->lpVtbl -> GetProcess(This,dwProcessId,ppProcess) ) #define ICorDebug_CanLaunchOrAttach(This,dwProcessId,win32DebuggingEnabled) \ - ( (This)->lpVtbl -> CanLaunchOrAttach(This,dwProcessId,win32DebuggingEnabled) ) + ( (This)->lpVtbl -> CanLaunchOrAttach(This,dwProcessId,win32DebuggingEnabled) ) #endif /* COBJMACROS */ @@ -4429,7 +4438,7 @@ EXTERN_C const IID IID_ICorDebug; /* interface __MIDL_itf_cordebug_0000_0021 */ -/* [local] */ +/* [local] */ #pragma warning(pop) @@ -4441,53 +4450,53 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0021_v0_0_s_ifspec; #define __ICorDebugRemoteTarget_INTERFACE_DEFINED__ /* interface ICorDebugRemoteTarget */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugRemoteTarget; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("C3ED8383-5A49-4cf5-B4B7-01864D9E582D") ICorDebugRemoteTarget : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetHostName( + virtual HRESULT STDMETHODCALLTYPE GetHostName( /* [in] */ ULONG32 cchHostName, - /* [annotation][out] */ + /* [annotation][out] */ _Out_ ULONG32 *pcchHostName, - /* [annotation][length_is][size_is][out] */ + /* [annotation][length_is][size_is][out] */ _Out_writes_to_opt_(cchHostName, *pcchHostName) WCHAR szHostName[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugRemoteTargetVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugRemoteTarget * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugRemoteTarget * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugRemoteTarget * This); - - HRESULT ( STDMETHODCALLTYPE *GetHostName )( + + HRESULT ( STDMETHODCALLTYPE *GetHostName )( ICorDebugRemoteTarget * This, /* [in] */ ULONG32 cchHostName, - /* [annotation][out] */ + /* [annotation][out] */ _Out_ ULONG32 *pcchHostName, - /* [annotation][length_is][size_is][out] */ + /* [annotation][length_is][size_is][out] */ _Out_writes_to_opt_(cchHostName, *pcchHostName) WCHAR szHostName[ ]); - + END_INTERFACE } ICorDebugRemoteTargetVtbl; @@ -4496,23 +4505,23 @@ EXTERN_C const IID IID_ICorDebugRemoteTarget; CONST_VTBL struct ICorDebugRemoteTargetVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugRemoteTarget_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugRemoteTarget_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugRemoteTarget_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugRemoteTarget_GetHostName(This,cchHostName,pcchHostName,szHostName) \ - ( (This)->lpVtbl -> GetHostName(This,cchHostName,pcchHostName,szHostName) ) + ( (This)->lpVtbl -> GetHostName(This,cchHostName,pcchHostName,szHostName) ) #endif /* COBJMACROS */ @@ -4529,21 +4538,21 @@ EXTERN_C const IID IID_ICorDebugRemoteTarget; #define __ICorDebugRemote_INTERFACE_DEFINED__ /* interface ICorDebugRemote */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugRemote; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("D5EBB8E2-7BBE-4c1d-98A6-A3C04CBDEF64") ICorDebugRemote : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CreateProcessEx( + virtual HRESULT STDMETHODCALLTYPE CreateProcessEx( /* [in] */ ICorDebugRemoteTarget *pRemoteTarget, /* [in] */ LPCWSTR lpApplicationName, - /* [annotation][in] */ + /* [annotation][in] */ _In_ LPWSTR lpCommandLine, /* [in] */ LPSECURITY_ATTRIBUTES lpProcessAttributes, /* [in] */ LPSECURITY_ATTRIBUTES lpThreadAttributes, @@ -4555,39 +4564,39 @@ EXTERN_C const IID IID_ICorDebugRemote; /* [in] */ LPPROCESS_INFORMATION lpProcessInformation, /* [in] */ CorDebugCreateProcessFlags debuggingFlags, /* [out] */ ICorDebugProcess **ppProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE DebugActiveProcessEx( + + virtual HRESULT STDMETHODCALLTYPE DebugActiveProcessEx( /* [in] */ ICorDebugRemoteTarget *pRemoteTarget, /* [in] */ DWORD dwProcessId, /* [in] */ BOOL fWin32Attach, /* [out] */ ICorDebugProcess **ppProcess) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugRemoteVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugRemote * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugRemote * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugRemote * This); - - HRESULT ( STDMETHODCALLTYPE *CreateProcessEx )( + + HRESULT ( STDMETHODCALLTYPE *CreateProcessEx )( ICorDebugRemote * This, /* [in] */ ICorDebugRemoteTarget *pRemoteTarget, /* [in] */ LPCWSTR lpApplicationName, - /* [annotation][in] */ + /* [annotation][in] */ _In_ LPWSTR lpCommandLine, /* [in] */ LPSECURITY_ATTRIBUTES lpProcessAttributes, /* [in] */ LPSECURITY_ATTRIBUTES lpThreadAttributes, @@ -4599,14 +4608,14 @@ EXTERN_C const IID IID_ICorDebugRemote; /* [in] */ LPPROCESS_INFORMATION lpProcessInformation, /* [in] */ CorDebugCreateProcessFlags debuggingFlags, /* [out] */ ICorDebugProcess **ppProcess); - - HRESULT ( STDMETHODCALLTYPE *DebugActiveProcessEx )( + + HRESULT ( STDMETHODCALLTYPE *DebugActiveProcessEx )( ICorDebugRemote * This, /* [in] */ ICorDebugRemoteTarget *pRemoteTarget, /* [in] */ DWORD dwProcessId, /* [in] */ BOOL fWin32Attach, /* [out] */ ICorDebugProcess **ppProcess); - + END_INTERFACE } ICorDebugRemoteVtbl; @@ -4615,26 +4624,26 @@ EXTERN_C const IID IID_ICorDebugRemote; CONST_VTBL struct ICorDebugRemoteVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugRemote_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugRemote_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugRemote_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugRemote_CreateProcessEx(This,pRemoteTarget,lpApplicationName,lpCommandLine,lpProcessAttributes,lpThreadAttributes,bInheritHandles,dwCreationFlags,lpEnvironment,lpCurrentDirectory,lpStartupInfo,lpProcessInformation,debuggingFlags,ppProcess) \ - ( (This)->lpVtbl -> CreateProcessEx(This,pRemoteTarget,lpApplicationName,lpCommandLine,lpProcessAttributes,lpThreadAttributes,bInheritHandles,dwCreationFlags,lpEnvironment,lpCurrentDirectory,lpStartupInfo,lpProcessInformation,debuggingFlags,ppProcess) ) + ( (This)->lpVtbl -> CreateProcessEx(This,pRemoteTarget,lpApplicationName,lpCommandLine,lpProcessAttributes,lpThreadAttributes,bInheritHandles,dwCreationFlags,lpEnvironment,lpCurrentDirectory,lpStartupInfo,lpProcessInformation,debuggingFlags,ppProcess) ) #define ICorDebugRemote_DebugActiveProcessEx(This,pRemoteTarget,dwProcessId,fWin32Attach,ppProcess) \ - ( (This)->lpVtbl -> DebugActiveProcessEx(This,pRemoteTarget,dwProcessId,fWin32Attach,ppProcess) ) + ( (This)->lpVtbl -> DebugActiveProcessEx(This,pRemoteTarget,dwProcessId,fWin32Attach,ppProcess) ) #endif /* COBJMACROS */ @@ -4648,7 +4657,7 @@ EXTERN_C const IID IID_ICorDebugRemote; /* interface __MIDL_itf_cordebug_0000_0023 */ -/* [local] */ +/* [local] */ typedef struct _COR_VERSION { @@ -4667,9 +4676,9 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0023_v0_0_s_ifspec; #define __ICorDebug2_INTERFACE_DEFINED__ /* interface ICorDebug2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugInterfaceVersion { CorDebugInvalidVersion = 0, @@ -4763,32 +4772,32 @@ enum CorDebugInterfaceVersion EXTERN_C const IID IID_ICorDebug2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("ECCCCF2E-B286-4b3e-A983-860A8793D105") ICorDebug2 : public IUnknown { public: }; - - + + #else /* C style interface */ typedef struct ICorDebug2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebug2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebug2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebug2 * This); - + END_INTERFACE } ICorDebug2Vtbl; @@ -4797,19 +4806,19 @@ EXTERN_C const IID IID_ICorDebug2; CONST_VTBL struct ICorDebug2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebug2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebug2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebug2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #endif /* COBJMACROS */ @@ -4824,13 +4833,13 @@ EXTERN_C const IID IID_ICorDebug2; /* interface __MIDL_itf_cordebug_0000_0024 */ -/* [local] */ +/* [local] */ -typedef +typedef enum CorDebugThreadState { THREAD_RUN = 0, - THREAD_SUSPEND = ( THREAD_RUN + 1 ) + THREAD_SUSPEND = ( THREAD_RUN + 1 ) } CorDebugThreadState; @@ -4842,118 +4851,118 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0024_v0_0_s_ifspec; #define __ICorDebugController_INTERFACE_DEFINED__ /* interface ICorDebugController */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugController; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("3d6f5f62-7538-11d3-8d5b-00104b35e7ef") ICorDebugController : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE Stop( + virtual HRESULT STDMETHODCALLTYPE Stop( /* [in] */ DWORD dwTimeoutIgnored) = 0; - - virtual HRESULT STDMETHODCALLTYPE Continue( + + virtual HRESULT STDMETHODCALLTYPE Continue( /* [in] */ BOOL fIsOutOfBand) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsRunning( + + virtual HRESULT STDMETHODCALLTYPE IsRunning( /* [out] */ BOOL *pbRunning) = 0; - - virtual HRESULT STDMETHODCALLTYPE HasQueuedCallbacks( + + virtual HRESULT STDMETHODCALLTYPE HasQueuedCallbacks( /* [in] */ ICorDebugThread *pThread, /* [out] */ BOOL *pbQueued) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateThreads( + + virtual HRESULT STDMETHODCALLTYPE EnumerateThreads( /* [out] */ ICorDebugThreadEnum **ppThreads) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAllThreadsDebugState( + + virtual HRESULT STDMETHODCALLTYPE SetAllThreadsDebugState( /* [in] */ CorDebugThreadState state, /* [in] */ ICorDebugThread *pExceptThisThread) = 0; - + virtual HRESULT STDMETHODCALLTYPE Detach( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Terminate( + + virtual HRESULT STDMETHODCALLTYPE Terminate( /* [in] */ UINT exitCode) = 0; - - virtual HRESULT STDMETHODCALLTYPE CanCommitChanges( + + virtual HRESULT STDMETHODCALLTYPE CanCommitChanges( /* [in] */ ULONG cSnapshots, /* [size_is][in] */ ICorDebugEditAndContinueSnapshot *pSnapshots[ ], /* [out] */ ICorDebugErrorInfoEnum **pError) = 0; - - virtual HRESULT STDMETHODCALLTYPE CommitChanges( + + virtual HRESULT STDMETHODCALLTYPE CommitChanges( /* [in] */ ULONG cSnapshots, /* [size_is][in] */ ICorDebugEditAndContinueSnapshot *pSnapshots[ ], /* [out] */ ICorDebugErrorInfoEnum **pError) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugControllerVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugController * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugController * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugController * This); - - HRESULT ( STDMETHODCALLTYPE *Stop )( + + HRESULT ( STDMETHODCALLTYPE *Stop )( ICorDebugController * This, /* [in] */ DWORD dwTimeoutIgnored); - - HRESULT ( STDMETHODCALLTYPE *Continue )( + + HRESULT ( STDMETHODCALLTYPE *Continue )( ICorDebugController * This, /* [in] */ BOOL fIsOutOfBand); - - HRESULT ( STDMETHODCALLTYPE *IsRunning )( + + HRESULT ( STDMETHODCALLTYPE *IsRunning )( ICorDebugController * This, /* [out] */ BOOL *pbRunning); - - HRESULT ( STDMETHODCALLTYPE *HasQueuedCallbacks )( + + HRESULT ( STDMETHODCALLTYPE *HasQueuedCallbacks )( ICorDebugController * This, /* [in] */ ICorDebugThread *pThread, /* [out] */ BOOL *pbQueued); - - HRESULT ( STDMETHODCALLTYPE *EnumerateThreads )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateThreads )( ICorDebugController * This, /* [out] */ ICorDebugThreadEnum **ppThreads); - - HRESULT ( STDMETHODCALLTYPE *SetAllThreadsDebugState )( + + HRESULT ( STDMETHODCALLTYPE *SetAllThreadsDebugState )( ICorDebugController * This, /* [in] */ CorDebugThreadState state, /* [in] */ ICorDebugThread *pExceptThisThread); - - HRESULT ( STDMETHODCALLTYPE *Detach )( + + HRESULT ( STDMETHODCALLTYPE *Detach )( ICorDebugController * This); - - HRESULT ( STDMETHODCALLTYPE *Terminate )( + + HRESULT ( STDMETHODCALLTYPE *Terminate )( ICorDebugController * This, /* [in] */ UINT exitCode); - - HRESULT ( STDMETHODCALLTYPE *CanCommitChanges )( + + HRESULT ( STDMETHODCALLTYPE *CanCommitChanges )( ICorDebugController * This, /* [in] */ ULONG cSnapshots, /* [size_is][in] */ ICorDebugEditAndContinueSnapshot *pSnapshots[ ], /* [out] */ ICorDebugErrorInfoEnum **pError); - - HRESULT ( STDMETHODCALLTYPE *CommitChanges )( + + HRESULT ( STDMETHODCALLTYPE *CommitChanges )( ICorDebugController * This, /* [in] */ ULONG cSnapshots, /* [size_is][in] */ ICorDebugEditAndContinueSnapshot *pSnapshots[ ], /* [out] */ ICorDebugErrorInfoEnum **pError); - + END_INTERFACE } ICorDebugControllerVtbl; @@ -4962,50 +4971,50 @@ EXTERN_C const IID IID_ICorDebugController; CONST_VTBL struct ICorDebugControllerVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugController_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugController_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugController_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugController_Stop(This,dwTimeoutIgnored) \ - ( (This)->lpVtbl -> Stop(This,dwTimeoutIgnored) ) + ( (This)->lpVtbl -> Stop(This,dwTimeoutIgnored) ) #define ICorDebugController_Continue(This,fIsOutOfBand) \ - ( (This)->lpVtbl -> Continue(This,fIsOutOfBand) ) + ( (This)->lpVtbl -> Continue(This,fIsOutOfBand) ) #define ICorDebugController_IsRunning(This,pbRunning) \ - ( (This)->lpVtbl -> IsRunning(This,pbRunning) ) + ( (This)->lpVtbl -> IsRunning(This,pbRunning) ) #define ICorDebugController_HasQueuedCallbacks(This,pThread,pbQueued) \ - ( (This)->lpVtbl -> HasQueuedCallbacks(This,pThread,pbQueued) ) + ( (This)->lpVtbl -> HasQueuedCallbacks(This,pThread,pbQueued) ) #define ICorDebugController_EnumerateThreads(This,ppThreads) \ - ( (This)->lpVtbl -> EnumerateThreads(This,ppThreads) ) + ( (This)->lpVtbl -> EnumerateThreads(This,ppThreads) ) #define ICorDebugController_SetAllThreadsDebugState(This,state,pExceptThisThread) \ - ( (This)->lpVtbl -> SetAllThreadsDebugState(This,state,pExceptThisThread) ) + ( (This)->lpVtbl -> SetAllThreadsDebugState(This,state,pExceptThisThread) ) #define ICorDebugController_Detach(This) \ - ( (This)->lpVtbl -> Detach(This) ) + ( (This)->lpVtbl -> Detach(This) ) #define ICorDebugController_Terminate(This,exitCode) \ - ( (This)->lpVtbl -> Terminate(This,exitCode) ) + ( (This)->lpVtbl -> Terminate(This,exitCode) ) #define ICorDebugController_CanCommitChanges(This,cSnapshots,pSnapshots,pError) \ - ( (This)->lpVtbl -> CanCommitChanges(This,cSnapshots,pSnapshots,pError) ) + ( (This)->lpVtbl -> CanCommitChanges(This,cSnapshots,pSnapshots,pError) ) #define ICorDebugController_CommitChanges(This,cSnapshots,pSnapshots,pError) \ - ( (This)->lpVtbl -> CommitChanges(This,cSnapshots,pSnapshots,pError) ) + ( (This)->lpVtbl -> CommitChanges(This,cSnapshots,pSnapshots,pError) ) #endif /* COBJMACROS */ @@ -5019,10 +5028,10 @@ EXTERN_C const IID IID_ICorDebugController; /* interface __MIDL_itf_cordebug_0000_0025 */ -/* [local] */ +/* [local] */ #pragma warning(push) -#pragma warning(disable:28718) +#pragma warning(disable:28718) extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0025_v0_0_c_ifspec; @@ -5032,157 +5041,157 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0025_v0_0_s_ifspec; #define __ICorDebugAppDomain_INTERFACE_DEFINED__ /* interface ICorDebugAppDomain */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugAppDomain; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("3d6f5f63-7538-11d3-8d5b-00104b35e7ef") ICorDebugAppDomain : public ICorDebugController { public: - virtual HRESULT STDMETHODCALLTYPE GetProcess( + virtual HRESULT STDMETHODCALLTYPE GetProcess( /* [out] */ ICorDebugProcess **ppProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateAssemblies( + + virtual HRESULT STDMETHODCALLTYPE EnumerateAssemblies( /* [out] */ ICorDebugAssemblyEnum **ppAssemblies) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModuleFromMetaDataInterface( + + virtual HRESULT STDMETHODCALLTYPE GetModuleFromMetaDataInterface( /* [in] */ IUnknown *pIMetaData, /* [out] */ ICorDebugModule **ppModule) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateBreakpoints( + + virtual HRESULT STDMETHODCALLTYPE EnumerateBreakpoints( /* [out] */ ICorDebugBreakpointEnum **ppBreakpoints) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateSteppers( + + virtual HRESULT STDMETHODCALLTYPE EnumerateSteppers( /* [out] */ ICorDebugStepperEnum **ppSteppers) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsAttached( + + virtual HRESULT STDMETHODCALLTYPE IsAttached( /* [out] */ BOOL *pbAttached) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetName( + + virtual HRESULT STDMETHODCALLTYPE GetName( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetObject( + + virtual HRESULT STDMETHODCALLTYPE GetObject( /* [out] */ ICorDebugValue **ppObject) = 0; - + virtual HRESULT STDMETHODCALLTYPE Attach( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetID( + + virtual HRESULT STDMETHODCALLTYPE GetID( /* [out] */ ULONG32 *pId) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugAppDomainVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugAppDomain * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugAppDomain * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugAppDomain * This); - - HRESULT ( STDMETHODCALLTYPE *Stop )( + + HRESULT ( STDMETHODCALLTYPE *Stop )( ICorDebugAppDomain * This, /* [in] */ DWORD dwTimeoutIgnored); - - HRESULT ( STDMETHODCALLTYPE *Continue )( + + HRESULT ( STDMETHODCALLTYPE *Continue )( ICorDebugAppDomain * This, /* [in] */ BOOL fIsOutOfBand); - - HRESULT ( STDMETHODCALLTYPE *IsRunning )( + + HRESULT ( STDMETHODCALLTYPE *IsRunning )( ICorDebugAppDomain * This, /* [out] */ BOOL *pbRunning); - - HRESULT ( STDMETHODCALLTYPE *HasQueuedCallbacks )( + + HRESULT ( STDMETHODCALLTYPE *HasQueuedCallbacks )( ICorDebugAppDomain * This, /* [in] */ ICorDebugThread *pThread, /* [out] */ BOOL *pbQueued); - - HRESULT ( STDMETHODCALLTYPE *EnumerateThreads )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateThreads )( ICorDebugAppDomain * This, /* [out] */ ICorDebugThreadEnum **ppThreads); - - HRESULT ( STDMETHODCALLTYPE *SetAllThreadsDebugState )( + + HRESULT ( STDMETHODCALLTYPE *SetAllThreadsDebugState )( ICorDebugAppDomain * This, /* [in] */ CorDebugThreadState state, /* [in] */ ICorDebugThread *pExceptThisThread); - - HRESULT ( STDMETHODCALLTYPE *Detach )( + + HRESULT ( STDMETHODCALLTYPE *Detach )( ICorDebugAppDomain * This); - - HRESULT ( STDMETHODCALLTYPE *Terminate )( + + HRESULT ( STDMETHODCALLTYPE *Terminate )( ICorDebugAppDomain * This, /* [in] */ UINT exitCode); - - HRESULT ( STDMETHODCALLTYPE *CanCommitChanges )( + + HRESULT ( STDMETHODCALLTYPE *CanCommitChanges )( ICorDebugAppDomain * This, /* [in] */ ULONG cSnapshots, /* [size_is][in] */ ICorDebugEditAndContinueSnapshot *pSnapshots[ ], /* [out] */ ICorDebugErrorInfoEnum **pError); - - HRESULT ( STDMETHODCALLTYPE *CommitChanges )( + + HRESULT ( STDMETHODCALLTYPE *CommitChanges )( ICorDebugAppDomain * This, /* [in] */ ULONG cSnapshots, /* [size_is][in] */ ICorDebugEditAndContinueSnapshot *pSnapshots[ ], /* [out] */ ICorDebugErrorInfoEnum **pError); - - HRESULT ( STDMETHODCALLTYPE *GetProcess )( + + HRESULT ( STDMETHODCALLTYPE *GetProcess )( ICorDebugAppDomain * This, /* [out] */ ICorDebugProcess **ppProcess); - - HRESULT ( STDMETHODCALLTYPE *EnumerateAssemblies )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateAssemblies )( ICorDebugAppDomain * This, /* [out] */ ICorDebugAssemblyEnum **ppAssemblies); - - HRESULT ( STDMETHODCALLTYPE *GetModuleFromMetaDataInterface )( + + HRESULT ( STDMETHODCALLTYPE *GetModuleFromMetaDataInterface )( ICorDebugAppDomain * This, /* [in] */ IUnknown *pIMetaData, /* [out] */ ICorDebugModule **ppModule); - - HRESULT ( STDMETHODCALLTYPE *EnumerateBreakpoints )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateBreakpoints )( ICorDebugAppDomain * This, /* [out] */ ICorDebugBreakpointEnum **ppBreakpoints); - - HRESULT ( STDMETHODCALLTYPE *EnumerateSteppers )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateSteppers )( ICorDebugAppDomain * This, /* [out] */ ICorDebugStepperEnum **ppSteppers); - - HRESULT ( STDMETHODCALLTYPE *IsAttached )( + + HRESULT ( STDMETHODCALLTYPE *IsAttached )( ICorDebugAppDomain * This, /* [out] */ BOOL *pbAttached); - - HRESULT ( STDMETHODCALLTYPE *GetName )( + + HRESULT ( STDMETHODCALLTYPE *GetName )( ICorDebugAppDomain * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetObject )( + + HRESULT ( STDMETHODCALLTYPE *GetObject )( ICorDebugAppDomain * This, /* [out] */ ICorDebugValue **ppObject); - - HRESULT ( STDMETHODCALLTYPE *Attach )( + + HRESULT ( STDMETHODCALLTYPE *Attach )( ICorDebugAppDomain * This); - - HRESULT ( STDMETHODCALLTYPE *GetID )( + + HRESULT ( STDMETHODCALLTYPE *GetID )( ICorDebugAppDomain * This, /* [out] */ ULONG32 *pId); - + END_INTERFACE } ICorDebugAppDomainVtbl; @@ -5191,81 +5200,81 @@ EXTERN_C const IID IID_ICorDebugAppDomain; CONST_VTBL struct ICorDebugAppDomainVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugAppDomain_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugAppDomain_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugAppDomain_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugAppDomain_Stop(This,dwTimeoutIgnored) \ - ( (This)->lpVtbl -> Stop(This,dwTimeoutIgnored) ) + ( (This)->lpVtbl -> Stop(This,dwTimeoutIgnored) ) #define ICorDebugAppDomain_Continue(This,fIsOutOfBand) \ - ( (This)->lpVtbl -> Continue(This,fIsOutOfBand) ) + ( (This)->lpVtbl -> Continue(This,fIsOutOfBand) ) #define ICorDebugAppDomain_IsRunning(This,pbRunning) \ - ( (This)->lpVtbl -> IsRunning(This,pbRunning) ) + ( (This)->lpVtbl -> IsRunning(This,pbRunning) ) #define ICorDebugAppDomain_HasQueuedCallbacks(This,pThread,pbQueued) \ - ( (This)->lpVtbl -> HasQueuedCallbacks(This,pThread,pbQueued) ) + ( (This)->lpVtbl -> HasQueuedCallbacks(This,pThread,pbQueued) ) #define ICorDebugAppDomain_EnumerateThreads(This,ppThreads) \ - ( (This)->lpVtbl -> EnumerateThreads(This,ppThreads) ) + ( (This)->lpVtbl -> EnumerateThreads(This,ppThreads) ) #define ICorDebugAppDomain_SetAllThreadsDebugState(This,state,pExceptThisThread) \ - ( (This)->lpVtbl -> SetAllThreadsDebugState(This,state,pExceptThisThread) ) + ( (This)->lpVtbl -> SetAllThreadsDebugState(This,state,pExceptThisThread) ) #define ICorDebugAppDomain_Detach(This) \ - ( (This)->lpVtbl -> Detach(This) ) + ( (This)->lpVtbl -> Detach(This) ) #define ICorDebugAppDomain_Terminate(This,exitCode) \ - ( (This)->lpVtbl -> Terminate(This,exitCode) ) + ( (This)->lpVtbl -> Terminate(This,exitCode) ) #define ICorDebugAppDomain_CanCommitChanges(This,cSnapshots,pSnapshots,pError) \ - ( (This)->lpVtbl -> CanCommitChanges(This,cSnapshots,pSnapshots,pError) ) + ( (This)->lpVtbl -> CanCommitChanges(This,cSnapshots,pSnapshots,pError) ) #define ICorDebugAppDomain_CommitChanges(This,cSnapshots,pSnapshots,pError) \ - ( (This)->lpVtbl -> CommitChanges(This,cSnapshots,pSnapshots,pError) ) + ( (This)->lpVtbl -> CommitChanges(This,cSnapshots,pSnapshots,pError) ) #define ICorDebugAppDomain_GetProcess(This,ppProcess) \ - ( (This)->lpVtbl -> GetProcess(This,ppProcess) ) + ( (This)->lpVtbl -> GetProcess(This,ppProcess) ) #define ICorDebugAppDomain_EnumerateAssemblies(This,ppAssemblies) \ - ( (This)->lpVtbl -> EnumerateAssemblies(This,ppAssemblies) ) + ( (This)->lpVtbl -> EnumerateAssemblies(This,ppAssemblies) ) #define ICorDebugAppDomain_GetModuleFromMetaDataInterface(This,pIMetaData,ppModule) \ - ( (This)->lpVtbl -> GetModuleFromMetaDataInterface(This,pIMetaData,ppModule) ) + ( (This)->lpVtbl -> GetModuleFromMetaDataInterface(This,pIMetaData,ppModule) ) #define ICorDebugAppDomain_EnumerateBreakpoints(This,ppBreakpoints) \ - ( (This)->lpVtbl -> EnumerateBreakpoints(This,ppBreakpoints) ) + ( (This)->lpVtbl -> EnumerateBreakpoints(This,ppBreakpoints) ) #define ICorDebugAppDomain_EnumerateSteppers(This,ppSteppers) \ - ( (This)->lpVtbl -> EnumerateSteppers(This,ppSteppers) ) + ( (This)->lpVtbl -> EnumerateSteppers(This,ppSteppers) ) #define ICorDebugAppDomain_IsAttached(This,pbAttached) \ - ( (This)->lpVtbl -> IsAttached(This,pbAttached) ) + ( (This)->lpVtbl -> IsAttached(This,pbAttached) ) #define ICorDebugAppDomain_GetName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) #define ICorDebugAppDomain_GetObject(This,ppObject) \ - ( (This)->lpVtbl -> GetObject(This,ppObject) ) + ( (This)->lpVtbl -> GetObject(This,ppObject) ) #define ICorDebugAppDomain_Attach(This) \ - ( (This)->lpVtbl -> Attach(This) ) + ( (This)->lpVtbl -> Attach(This) ) #define ICorDebugAppDomain_GetID(This,pId) \ - ( (This)->lpVtbl -> GetID(This,pId) ) + ( (This)->lpVtbl -> GetID(This,pId) ) #endif /* COBJMACROS */ @@ -5279,7 +5288,7 @@ EXTERN_C const IID IID_ICorDebugAppDomain; /* interface __MIDL_itf_cordebug_0000_0026 */ -/* [local] */ +/* [local] */ #pragma warning(pop) @@ -5291,62 +5300,62 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0026_v0_0_s_ifspec; #define __ICorDebugAppDomain2_INTERFACE_DEFINED__ /* interface ICorDebugAppDomain2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugAppDomain2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("096E81D5-ECDA-4202-83F5-C65980A9EF75") ICorDebugAppDomain2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetArrayOrPointerType( + virtual HRESULT STDMETHODCALLTYPE GetArrayOrPointerType( /* [in] */ CorElementType elementType, /* [in] */ ULONG32 nRank, /* [in] */ ICorDebugType *pTypeArg, /* [out] */ ICorDebugType **ppType) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFunctionPointerType( + + virtual HRESULT STDMETHODCALLTYPE GetFunctionPointerType( /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ], /* [out] */ ICorDebugType **ppType) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugAppDomain2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugAppDomain2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugAppDomain2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugAppDomain2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetArrayOrPointerType )( + + HRESULT ( STDMETHODCALLTYPE *GetArrayOrPointerType )( ICorDebugAppDomain2 * This, /* [in] */ CorElementType elementType, /* [in] */ ULONG32 nRank, /* [in] */ ICorDebugType *pTypeArg, /* [out] */ ICorDebugType **ppType); - - HRESULT ( STDMETHODCALLTYPE *GetFunctionPointerType )( + + HRESULT ( STDMETHODCALLTYPE *GetFunctionPointerType )( ICorDebugAppDomain2 * This, /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ], /* [out] */ ICorDebugType **ppType); - + END_INTERFACE } ICorDebugAppDomain2Vtbl; @@ -5355,26 +5364,26 @@ EXTERN_C const IID IID_ICorDebugAppDomain2; CONST_VTBL struct ICorDebugAppDomain2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugAppDomain2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugAppDomain2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugAppDomain2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugAppDomain2_GetArrayOrPointerType(This,elementType,nRank,pTypeArg,ppType) \ - ( (This)->lpVtbl -> GetArrayOrPointerType(This,elementType,nRank,pTypeArg,ppType) ) + ( (This)->lpVtbl -> GetArrayOrPointerType(This,elementType,nRank,pTypeArg,ppType) ) #define ICorDebugAppDomain2_GetFunctionPointerType(This,nTypeArgs,ppTypeArgs,ppType) \ - ( (This)->lpVtbl -> GetFunctionPointerType(This,nTypeArgs,ppTypeArgs,ppType) ) + ( (This)->lpVtbl -> GetFunctionPointerType(This,nTypeArgs,ppTypeArgs,ppType) ) #endif /* COBJMACROS */ @@ -5391,64 +5400,64 @@ EXTERN_C const IID IID_ICorDebugAppDomain2; #define __ICorDebugEnum_INTERFACE_DEFINED__ /* interface ICorDebugEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB01-8A68-11d2-983C-0000F808342D") ICorDebugEnum : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE Skip( + virtual HRESULT STDMETHODCALLTYPE Skip( /* [in] */ ULONG celt) = 0; - + virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clone( + + virtual HRESULT STDMETHODCALLTYPE Clone( /* [out] */ ICorDebugEnum **ppEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCount( + + virtual HRESULT STDMETHODCALLTYPE GetCount( /* [out] */ ULONG *pcelt) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugEnum * This, /* [out] */ ULONG *pcelt); - + END_INTERFACE } ICorDebugEnumVtbl; @@ -5457,32 +5466,32 @@ EXTERN_C const IID IID_ICorDebugEnum; CONST_VTBL struct ICorDebugEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #endif /* COBJMACROS */ @@ -5499,64 +5508,64 @@ EXTERN_C const IID IID_ICorDebugEnum; #define __ICorDebugGuidToTypeEnum_INTERFACE_DEFINED__ /* interface ICorDebugGuidToTypeEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugGuidToTypeEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("6164D242-1015-4BD6-8CBE-D0DBD4B8275A") ICorDebugGuidToTypeEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ CorDebugGuidToTypeMapping values[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugGuidToTypeEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugGuidToTypeEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugGuidToTypeEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugGuidToTypeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugGuidToTypeEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugGuidToTypeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugGuidToTypeEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugGuidToTypeEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugGuidToTypeEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ CorDebugGuidToTypeMapping values[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugGuidToTypeEnumVtbl; @@ -5565,36 +5574,36 @@ EXTERN_C const IID IID_ICorDebugGuidToTypeEnum; CONST_VTBL struct ICorDebugGuidToTypeEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugGuidToTypeEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugGuidToTypeEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugGuidToTypeEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugGuidToTypeEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugGuidToTypeEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugGuidToTypeEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugGuidToTypeEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugGuidToTypeEnum_Next(This,celt,values,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) #endif /* COBJMACROS */ @@ -5611,56 +5620,56 @@ EXTERN_C const IID IID_ICorDebugGuidToTypeEnum; #define __ICorDebugAppDomain3_INTERFACE_DEFINED__ /* interface ICorDebugAppDomain3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugAppDomain3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("8CB96A16-B588-42E2-B71C-DD849FC2ECCC") ICorDebugAppDomain3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetCachedWinRTTypesForIIDs( + virtual HRESULT STDMETHODCALLTYPE GetCachedWinRTTypesForIIDs( /* [in] */ ULONG32 cReqTypes, /* [size_is][in] */ GUID *iidsToResolve, /* [out] */ ICorDebugTypeEnum **ppTypesEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCachedWinRTTypes( + + virtual HRESULT STDMETHODCALLTYPE GetCachedWinRTTypes( /* [out] */ ICorDebugGuidToTypeEnum **ppGuidToTypeEnum) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugAppDomain3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugAppDomain3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugAppDomain3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugAppDomain3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetCachedWinRTTypesForIIDs )( + + HRESULT ( STDMETHODCALLTYPE *GetCachedWinRTTypesForIIDs )( ICorDebugAppDomain3 * This, /* [in] */ ULONG32 cReqTypes, /* [size_is][in] */ GUID *iidsToResolve, /* [out] */ ICorDebugTypeEnum **ppTypesEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCachedWinRTTypes )( + + HRESULT ( STDMETHODCALLTYPE *GetCachedWinRTTypes )( ICorDebugAppDomain3 * This, /* [out] */ ICorDebugGuidToTypeEnum **ppGuidToTypeEnum); - + END_INTERFACE } ICorDebugAppDomain3Vtbl; @@ -5669,26 +5678,26 @@ EXTERN_C const IID IID_ICorDebugAppDomain3; CONST_VTBL struct ICorDebugAppDomain3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugAppDomain3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugAppDomain3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugAppDomain3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugAppDomain3_GetCachedWinRTTypesForIIDs(This,cReqTypes,iidsToResolve,ppTypesEnum) \ - ( (This)->lpVtbl -> GetCachedWinRTTypesForIIDs(This,cReqTypes,iidsToResolve,ppTypesEnum) ) + ( (This)->lpVtbl -> GetCachedWinRTTypesForIIDs(This,cReqTypes,iidsToResolve,ppTypesEnum) ) #define ICorDebugAppDomain3_GetCachedWinRTTypes(This,ppGuidToTypeEnum) \ - ( (This)->lpVtbl -> GetCachedWinRTTypes(This,ppGuidToTypeEnum) ) + ( (This)->lpVtbl -> GetCachedWinRTTypes(This,ppGuidToTypeEnum) ) #endif /* COBJMACROS */ @@ -5705,47 +5714,47 @@ EXTERN_C const IID IID_ICorDebugAppDomain3; #define __ICorDebugAppDomain4_INTERFACE_DEFINED__ /* interface ICorDebugAppDomain4 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugAppDomain4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("FB99CC40-83BE-4724-AB3B-768E796EBAC2") ICorDebugAppDomain4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetObjectForCCW( + virtual HRESULT STDMETHODCALLTYPE GetObjectForCCW( /* [in] */ CORDB_ADDRESS ccwPointer, /* [out] */ ICorDebugValue **ppManagedObject) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugAppDomain4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugAppDomain4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugAppDomain4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugAppDomain4 * This); - - HRESULT ( STDMETHODCALLTYPE *GetObjectForCCW )( + + HRESULT ( STDMETHODCALLTYPE *GetObjectForCCW )( ICorDebugAppDomain4 * This, /* [in] */ CORDB_ADDRESS ccwPointer, /* [out] */ ICorDebugValue **ppManagedObject); - + END_INTERFACE } ICorDebugAppDomain4Vtbl; @@ -5754,23 +5763,23 @@ EXTERN_C const IID IID_ICorDebugAppDomain4; CONST_VTBL struct ICorDebugAppDomain4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugAppDomain4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugAppDomain4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugAppDomain4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugAppDomain4_GetObjectForCCW(This,ccwPointer,ppManagedObject) \ - ( (This)->lpVtbl -> GetObjectForCCW(This,ccwPointer,ppManagedObject) ) + ( (This)->lpVtbl -> GetObjectForCCW(This,ccwPointer,ppManagedObject) ) #endif /* COBJMACROS */ @@ -5784,10 +5793,10 @@ EXTERN_C const IID IID_ICorDebugAppDomain4; /* interface __MIDL_itf_cordebug_0000_0030 */ -/* [local] */ +/* [local] */ #pragma warning(push) -#pragma warning(disable:28718) +#pragma warning(disable:28718) extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0030_v0_0_c_ifspec; @@ -5797,81 +5806,81 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0030_v0_0_s_ifspec; #define __ICorDebugAssembly_INTERFACE_DEFINED__ /* interface ICorDebugAssembly */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugAssembly; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("df59507c-d47a-459e-bce2-6427eac8fd06") ICorDebugAssembly : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetProcess( + virtual HRESULT STDMETHODCALLTYPE GetProcess( /* [out] */ ICorDebugProcess **ppProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAppDomain( + + virtual HRESULT STDMETHODCALLTYPE GetAppDomain( /* [out] */ ICorDebugAppDomain **ppAppDomain) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateModules( + + virtual HRESULT STDMETHODCALLTYPE EnumerateModules( /* [out] */ ICorDebugModuleEnum **ppModules) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCodeBase( + + virtual HRESULT STDMETHODCALLTYPE GetCodeBase( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetName( + + virtual HRESULT STDMETHODCALLTYPE GetName( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugAssemblyVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugAssembly * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugAssembly * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugAssembly * This); - - HRESULT ( STDMETHODCALLTYPE *GetProcess )( + + HRESULT ( STDMETHODCALLTYPE *GetProcess )( ICorDebugAssembly * This, /* [out] */ ICorDebugProcess **ppProcess); - - HRESULT ( STDMETHODCALLTYPE *GetAppDomain )( + + HRESULT ( STDMETHODCALLTYPE *GetAppDomain )( ICorDebugAssembly * This, /* [out] */ ICorDebugAppDomain **ppAppDomain); - - HRESULT ( STDMETHODCALLTYPE *EnumerateModules )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateModules )( ICorDebugAssembly * This, /* [out] */ ICorDebugModuleEnum **ppModules); - - HRESULT ( STDMETHODCALLTYPE *GetCodeBase )( + + HRESULT ( STDMETHODCALLTYPE *GetCodeBase )( ICorDebugAssembly * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetName )( + + HRESULT ( STDMETHODCALLTYPE *GetName )( ICorDebugAssembly * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - + END_INTERFACE } ICorDebugAssemblyVtbl; @@ -5880,35 +5889,35 @@ EXTERN_C const IID IID_ICorDebugAssembly; CONST_VTBL struct ICorDebugAssemblyVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugAssembly_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugAssembly_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugAssembly_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugAssembly_GetProcess(This,ppProcess) \ - ( (This)->lpVtbl -> GetProcess(This,ppProcess) ) + ( (This)->lpVtbl -> GetProcess(This,ppProcess) ) #define ICorDebugAssembly_GetAppDomain(This,ppAppDomain) \ - ( (This)->lpVtbl -> GetAppDomain(This,ppAppDomain) ) + ( (This)->lpVtbl -> GetAppDomain(This,ppAppDomain) ) #define ICorDebugAssembly_EnumerateModules(This,ppModules) \ - ( (This)->lpVtbl -> EnumerateModules(This,ppModules) ) + ( (This)->lpVtbl -> EnumerateModules(This,ppModules) ) #define ICorDebugAssembly_GetCodeBase(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetCodeBase(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetCodeBase(This,cchName,pcchName,szName) ) #define ICorDebugAssembly_GetName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) #endif /* COBJMACROS */ @@ -5922,7 +5931,7 @@ EXTERN_C const IID IID_ICorDebugAssembly; /* interface __MIDL_itf_cordebug_0000_0031 */ -/* [local] */ +/* [local] */ #pragma warning(pop) @@ -5934,45 +5943,45 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0031_v0_0_s_ifspec; #define __ICorDebugAssembly2_INTERFACE_DEFINED__ /* interface ICorDebugAssembly2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugAssembly2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("426d1f9e-6dd4-44c8-aec7-26cdbaf4e398") ICorDebugAssembly2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE IsFullyTrusted( + virtual HRESULT STDMETHODCALLTYPE IsFullyTrusted( /* [out] */ BOOL *pbFullyTrusted) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugAssembly2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugAssembly2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugAssembly2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugAssembly2 * This); - - HRESULT ( STDMETHODCALLTYPE *IsFullyTrusted )( + + HRESULT ( STDMETHODCALLTYPE *IsFullyTrusted )( ICorDebugAssembly2 * This, /* [out] */ BOOL *pbFullyTrusted); - + END_INTERFACE } ICorDebugAssembly2Vtbl; @@ -5981,23 +5990,23 @@ EXTERN_C const IID IID_ICorDebugAssembly2; CONST_VTBL struct ICorDebugAssembly2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugAssembly2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugAssembly2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugAssembly2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugAssembly2_IsFullyTrusted(This,pbFullyTrusted) \ - ( (This)->lpVtbl -> IsFullyTrusted(This,pbFullyTrusted) ) + ( (This)->lpVtbl -> IsFullyTrusted(This,pbFullyTrusted) ) #endif /* COBJMACROS */ @@ -6014,52 +6023,52 @@ EXTERN_C const IID IID_ICorDebugAssembly2; #define __ICorDebugAssembly3_INTERFACE_DEFINED__ /* interface ICorDebugAssembly3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugAssembly3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("76361AB2-8C86-4FE9-96F2-F73D8843570A") ICorDebugAssembly3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetContainerAssembly( + virtual HRESULT STDMETHODCALLTYPE GetContainerAssembly( ICorDebugAssembly **ppAssembly) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateContainedAssemblies( + + virtual HRESULT STDMETHODCALLTYPE EnumerateContainedAssemblies( ICorDebugAssemblyEnum **ppAssemblies) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugAssembly3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugAssembly3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugAssembly3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugAssembly3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetContainerAssembly )( + + HRESULT ( STDMETHODCALLTYPE *GetContainerAssembly )( ICorDebugAssembly3 * This, ICorDebugAssembly **ppAssembly); - - HRESULT ( STDMETHODCALLTYPE *EnumerateContainedAssemblies )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateContainedAssemblies )( ICorDebugAssembly3 * This, ICorDebugAssemblyEnum **ppAssemblies); - + END_INTERFACE } ICorDebugAssembly3Vtbl; @@ -6068,26 +6077,26 @@ EXTERN_C const IID IID_ICorDebugAssembly3; CONST_VTBL struct ICorDebugAssembly3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugAssembly3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugAssembly3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugAssembly3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugAssembly3_GetContainerAssembly(This,ppAssembly) \ - ( (This)->lpVtbl -> GetContainerAssembly(This,ppAssembly) ) + ( (This)->lpVtbl -> GetContainerAssembly(This,ppAssembly) ) #define ICorDebugAssembly3_EnumerateContainedAssemblies(This,ppAssemblies) \ - ( (This)->lpVtbl -> EnumerateContainedAssemblies(This,ppAssemblies) ) + ( (This)->lpVtbl -> EnumerateContainedAssemblies(This,ppAssemblies) ) #endif /* COBJMACROS */ @@ -6101,7 +6110,7 @@ EXTERN_C const IID IID_ICorDebugAssembly3; /* interface __MIDL_itf_cordebug_0000_0033 */ -/* [local] */ +/* [local] */ #ifndef _DEF_COR_TYPEID_ #define _DEF_COR_TYPEID_ @@ -6128,64 +6137,64 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0033_v0_0_s_ifspec; #define __ICorDebugHeapEnum_INTERFACE_DEFINED__ /* interface ICorDebugHeapEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugHeapEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("76D7DAB8-D044-11DF-9A15-7E29DFD72085") ICorDebugHeapEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ COR_HEAPOBJECT objects[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugHeapEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugHeapEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugHeapEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugHeapEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugHeapEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugHeapEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugHeapEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugHeapEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugHeapEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ COR_HEAPOBJECT objects[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugHeapEnumVtbl; @@ -6194,36 +6203,36 @@ EXTERN_C const IID IID_ICorDebugHeapEnum; CONST_VTBL struct ICorDebugHeapEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugHeapEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugHeapEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugHeapEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugHeapEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugHeapEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugHeapEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugHeapEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugHeapEnum_Next(This,celt,objects,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,objects,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,objects,pceltFetched) ) #endif /* COBJMACROS */ @@ -6237,9 +6246,9 @@ EXTERN_C const IID IID_ICorDebugHeapEnum; /* interface __MIDL_itf_cordebug_0000_0034 */ -/* [local] */ +/* [local] */ -typedef +typedef enum CorDebugGenerationTypes { CorDebug_Gen0 = 0, @@ -6257,11 +6266,11 @@ typedef struct _COR_SEGMENT ULONG heap; } COR_SEGMENT; -typedef +typedef enum CorDebugGCType { CorDebugWorkstationGC = 0, - CorDebugServerGC = ( CorDebugWorkstationGC + 1 ) + CorDebugServerGC = ( CorDebugWorkstationGC + 1 ) } CorDebugGCType; typedef struct _COR_HEAPINFO @@ -6282,64 +6291,64 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0034_v0_0_s_ifspec; #define __ICorDebugHeapSegmentEnum_INTERFACE_DEFINED__ /* interface ICorDebugHeapSegmentEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugHeapSegmentEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("A2FA0F8E-D045-11DF-AC8E-CE2ADFD72085") ICorDebugHeapSegmentEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ COR_SEGMENT segments[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugHeapSegmentEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugHeapSegmentEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugHeapSegmentEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugHeapSegmentEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugHeapSegmentEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugHeapSegmentEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugHeapSegmentEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugHeapSegmentEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugHeapSegmentEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ COR_SEGMENT segments[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugHeapSegmentEnumVtbl; @@ -6348,36 +6357,36 @@ EXTERN_C const IID IID_ICorDebugHeapSegmentEnum; CONST_VTBL struct ICorDebugHeapSegmentEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugHeapSegmentEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugHeapSegmentEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugHeapSegmentEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugHeapSegmentEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugHeapSegmentEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugHeapSegmentEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugHeapSegmentEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugHeapSegmentEnum_Next(This,celt,segments,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,segments,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,segments,pceltFetched) ) #endif /* COBJMACROS */ @@ -6391,9 +6400,9 @@ EXTERN_C const IID IID_ICorDebugHeapSegmentEnum; /* interface __MIDL_itf_cordebug_0000_0035 */ -/* [local] */ +/* [local] */ -typedef +typedef enum CorGCReferenceType { CorHandleStrong = ( 1 << 0 ) , @@ -6434,64 +6443,64 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0035_v0_0_s_ifspec; #define __ICorDebugGCReferenceEnum_INTERFACE_DEFINED__ /* interface ICorDebugGCReferenceEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugGCReferenceEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("7F3C24D3-7E1D-4245-AC3A-F72F8859C80C") ICorDebugGCReferenceEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ COR_GC_REFERENCE roots[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugGCReferenceEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugGCReferenceEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugGCReferenceEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugGCReferenceEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugGCReferenceEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugGCReferenceEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugGCReferenceEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugGCReferenceEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugGCReferenceEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ COR_GC_REFERENCE roots[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugGCReferenceEnumVtbl; @@ -6500,36 +6509,36 @@ EXTERN_C const IID IID_ICorDebugGCReferenceEnum; CONST_VTBL struct ICorDebugGCReferenceEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugGCReferenceEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugGCReferenceEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugGCReferenceEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugGCReferenceEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugGCReferenceEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugGCReferenceEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugGCReferenceEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugGCReferenceEnum_Next(This,celt,roots,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,roots,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,roots,pceltFetched) ) #endif /* COBJMACROS */ @@ -6543,7 +6552,7 @@ EXTERN_C const IID IID_ICorDebugGCReferenceEnum; /* interface __MIDL_itf_cordebug_0000_0036 */ -/* [local] */ +/* [local] */ #ifndef _DEF_COR_ARRAY_LAYOUT_ #define _DEF_COR_ARRAY_LAYOUT_ @@ -6584,7 +6593,7 @@ typedef struct COR_FIELD #endif // _DEF_COR_FIELD_ #pragma warning(push) -#pragma warning(disable:28718) +#pragma warning(disable:28718) extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0036_v0_0_c_ifspec; @@ -6594,234 +6603,234 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0036_v0_0_s_ifspec; #define __ICorDebugProcess_INTERFACE_DEFINED__ /* interface ICorDebugProcess */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcess; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("3d6f5f64-7538-11d3-8d5b-00104b35e7ef") ICorDebugProcess : public ICorDebugController { public: - virtual HRESULT STDMETHODCALLTYPE GetID( + virtual HRESULT STDMETHODCALLTYPE GetID( /* [out] */ DWORD *pdwProcessId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHandle( + + virtual HRESULT STDMETHODCALLTYPE GetHandle( /* [out] */ HPROCESS *phProcessHandle) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThread( + + virtual HRESULT STDMETHODCALLTYPE GetThread( /* [in] */ DWORD dwThreadId, /* [out] */ ICorDebugThread **ppThread) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateObjects( + + virtual HRESULT STDMETHODCALLTYPE EnumerateObjects( /* [out] */ ICorDebugObjectEnum **ppObjects) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsTransitionStub( + + virtual HRESULT STDMETHODCALLTYPE IsTransitionStub( /* [in] */ CORDB_ADDRESS address, /* [out] */ BOOL *pbTransitionStub) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsOSSuspended( + + virtual HRESULT STDMETHODCALLTYPE IsOSSuspended( /* [in] */ DWORD threadID, /* [out] */ BOOL *pbSuspended) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThreadContext( + + virtual HRESULT STDMETHODCALLTYPE GetThreadContext( /* [in] */ DWORD threadID, /* [in] */ ULONG32 contextSize, /* [size_is][length_is][out][in] */ BYTE context[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetThreadContext( + + virtual HRESULT STDMETHODCALLTYPE SetThreadContext( /* [in] */ DWORD threadID, /* [in] */ ULONG32 contextSize, /* [size_is][length_is][in] */ BYTE context[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReadMemory( + + virtual HRESULT STDMETHODCALLTYPE ReadMemory( /* [in] */ CORDB_ADDRESS address, /* [in] */ DWORD size, /* [length_is][size_is][out] */ BYTE buffer[ ], /* [out] */ SIZE_T *read) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteMemory( + + virtual HRESULT STDMETHODCALLTYPE WriteMemory( /* [in] */ CORDB_ADDRESS address, /* [in] */ DWORD size, /* [size_is][in] */ BYTE buffer[ ], /* [out] */ SIZE_T *written) = 0; - - virtual HRESULT STDMETHODCALLTYPE ClearCurrentException( + + virtual HRESULT STDMETHODCALLTYPE ClearCurrentException( /* [in] */ DWORD threadID) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableLogMessages( + + virtual HRESULT STDMETHODCALLTYPE EnableLogMessages( /* [in] */ BOOL fOnOff) = 0; - - virtual HRESULT STDMETHODCALLTYPE ModifyLogSwitch( - /* [annotation][in] */ + + virtual HRESULT STDMETHODCALLTYPE ModifyLogSwitch( + /* [annotation][in] */ _In_ WCHAR *pLogSwitchName, /* [in] */ LONG lLevel) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateAppDomains( + + virtual HRESULT STDMETHODCALLTYPE EnumerateAppDomains( /* [out] */ ICorDebugAppDomainEnum **ppAppDomains) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetObject( + + virtual HRESULT STDMETHODCALLTYPE GetObject( /* [out] */ ICorDebugValue **ppObject) = 0; - - virtual HRESULT STDMETHODCALLTYPE ThreadForFiberCookie( + + virtual HRESULT STDMETHODCALLTYPE ThreadForFiberCookie( /* [in] */ DWORD fiberCookie, /* [out] */ ICorDebugThread **ppThread) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHelperThreadID( + + virtual HRESULT STDMETHODCALLTYPE GetHelperThreadID( /* [out] */ DWORD *pThreadID) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcessVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcess * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcess * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcess * This); - - HRESULT ( STDMETHODCALLTYPE *Stop )( + + HRESULT ( STDMETHODCALLTYPE *Stop )( ICorDebugProcess * This, /* [in] */ DWORD dwTimeoutIgnored); - - HRESULT ( STDMETHODCALLTYPE *Continue )( + + HRESULT ( STDMETHODCALLTYPE *Continue )( ICorDebugProcess * This, /* [in] */ BOOL fIsOutOfBand); - - HRESULT ( STDMETHODCALLTYPE *IsRunning )( + + HRESULT ( STDMETHODCALLTYPE *IsRunning )( ICorDebugProcess * This, /* [out] */ BOOL *pbRunning); - - HRESULT ( STDMETHODCALLTYPE *HasQueuedCallbacks )( + + HRESULT ( STDMETHODCALLTYPE *HasQueuedCallbacks )( ICorDebugProcess * This, /* [in] */ ICorDebugThread *pThread, /* [out] */ BOOL *pbQueued); - - HRESULT ( STDMETHODCALLTYPE *EnumerateThreads )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateThreads )( ICorDebugProcess * This, /* [out] */ ICorDebugThreadEnum **ppThreads); - - HRESULT ( STDMETHODCALLTYPE *SetAllThreadsDebugState )( + + HRESULT ( STDMETHODCALLTYPE *SetAllThreadsDebugState )( ICorDebugProcess * This, /* [in] */ CorDebugThreadState state, /* [in] */ ICorDebugThread *pExceptThisThread); - - HRESULT ( STDMETHODCALLTYPE *Detach )( + + HRESULT ( STDMETHODCALLTYPE *Detach )( ICorDebugProcess * This); - - HRESULT ( STDMETHODCALLTYPE *Terminate )( + + HRESULT ( STDMETHODCALLTYPE *Terminate )( ICorDebugProcess * This, /* [in] */ UINT exitCode); - - HRESULT ( STDMETHODCALLTYPE *CanCommitChanges )( + + HRESULT ( STDMETHODCALLTYPE *CanCommitChanges )( ICorDebugProcess * This, /* [in] */ ULONG cSnapshots, /* [size_is][in] */ ICorDebugEditAndContinueSnapshot *pSnapshots[ ], /* [out] */ ICorDebugErrorInfoEnum **pError); - - HRESULT ( STDMETHODCALLTYPE *CommitChanges )( + + HRESULT ( STDMETHODCALLTYPE *CommitChanges )( ICorDebugProcess * This, /* [in] */ ULONG cSnapshots, /* [size_is][in] */ ICorDebugEditAndContinueSnapshot *pSnapshots[ ], /* [out] */ ICorDebugErrorInfoEnum **pError); - - HRESULT ( STDMETHODCALLTYPE *GetID )( + + HRESULT ( STDMETHODCALLTYPE *GetID )( ICorDebugProcess * This, /* [out] */ DWORD *pdwProcessId); - - HRESULT ( STDMETHODCALLTYPE *GetHandle )( + + HRESULT ( STDMETHODCALLTYPE *GetHandle )( ICorDebugProcess * This, /* [out] */ HPROCESS *phProcessHandle); - - HRESULT ( STDMETHODCALLTYPE *GetThread )( + + HRESULT ( STDMETHODCALLTYPE *GetThread )( ICorDebugProcess * This, /* [in] */ DWORD dwThreadId, /* [out] */ ICorDebugThread **ppThread); - - HRESULT ( STDMETHODCALLTYPE *EnumerateObjects )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateObjects )( ICorDebugProcess * This, /* [out] */ ICorDebugObjectEnum **ppObjects); - - HRESULT ( STDMETHODCALLTYPE *IsTransitionStub )( + + HRESULT ( STDMETHODCALLTYPE *IsTransitionStub )( ICorDebugProcess * This, /* [in] */ CORDB_ADDRESS address, /* [out] */ BOOL *pbTransitionStub); - - HRESULT ( STDMETHODCALLTYPE *IsOSSuspended )( + + HRESULT ( STDMETHODCALLTYPE *IsOSSuspended )( ICorDebugProcess * This, /* [in] */ DWORD threadID, /* [out] */ BOOL *pbSuspended); - - HRESULT ( STDMETHODCALLTYPE *GetThreadContext )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadContext )( ICorDebugProcess * This, /* [in] */ DWORD threadID, /* [in] */ ULONG32 contextSize, /* [size_is][length_is][out][in] */ BYTE context[ ]); - - HRESULT ( STDMETHODCALLTYPE *SetThreadContext )( + + HRESULT ( STDMETHODCALLTYPE *SetThreadContext )( ICorDebugProcess * This, /* [in] */ DWORD threadID, /* [in] */ ULONG32 contextSize, /* [size_is][length_is][in] */ BYTE context[ ]); - - HRESULT ( STDMETHODCALLTYPE *ReadMemory )( + + HRESULT ( STDMETHODCALLTYPE *ReadMemory )( ICorDebugProcess * This, /* [in] */ CORDB_ADDRESS address, /* [in] */ DWORD size, /* [length_is][size_is][out] */ BYTE buffer[ ], /* [out] */ SIZE_T *read); - - HRESULT ( STDMETHODCALLTYPE *WriteMemory )( + + HRESULT ( STDMETHODCALLTYPE *WriteMemory )( ICorDebugProcess * This, /* [in] */ CORDB_ADDRESS address, /* [in] */ DWORD size, /* [size_is][in] */ BYTE buffer[ ], /* [out] */ SIZE_T *written); - - HRESULT ( STDMETHODCALLTYPE *ClearCurrentException )( + + HRESULT ( STDMETHODCALLTYPE *ClearCurrentException )( ICorDebugProcess * This, /* [in] */ DWORD threadID); - - HRESULT ( STDMETHODCALLTYPE *EnableLogMessages )( + + HRESULT ( STDMETHODCALLTYPE *EnableLogMessages )( ICorDebugProcess * This, /* [in] */ BOOL fOnOff); - - HRESULT ( STDMETHODCALLTYPE *ModifyLogSwitch )( + + HRESULT ( STDMETHODCALLTYPE *ModifyLogSwitch )( ICorDebugProcess * This, - /* [annotation][in] */ + /* [annotation][in] */ _In_ WCHAR *pLogSwitchName, /* [in] */ LONG lLevel); - - HRESULT ( STDMETHODCALLTYPE *EnumerateAppDomains )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateAppDomains )( ICorDebugProcess * This, /* [out] */ ICorDebugAppDomainEnum **ppAppDomains); - - HRESULT ( STDMETHODCALLTYPE *GetObject )( + + HRESULT ( STDMETHODCALLTYPE *GetObject )( ICorDebugProcess * This, /* [out] */ ICorDebugValue **ppObject); - - HRESULT ( STDMETHODCALLTYPE *ThreadForFiberCookie )( + + HRESULT ( STDMETHODCALLTYPE *ThreadForFiberCookie )( ICorDebugProcess * This, /* [in] */ DWORD fiberCookie, /* [out] */ ICorDebugThread **ppThread); - - HRESULT ( STDMETHODCALLTYPE *GetHelperThreadID )( + + HRESULT ( STDMETHODCALLTYPE *GetHelperThreadID )( ICorDebugProcess * This, /* [out] */ DWORD *pThreadID); - + END_INTERFACE } ICorDebugProcessVtbl; @@ -6830,102 +6839,102 @@ EXTERN_C const IID IID_ICorDebugProcess; CONST_VTBL struct ICorDebugProcessVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcess_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcess_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcess_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcess_Stop(This,dwTimeoutIgnored) \ - ( (This)->lpVtbl -> Stop(This,dwTimeoutIgnored) ) + ( (This)->lpVtbl -> Stop(This,dwTimeoutIgnored) ) #define ICorDebugProcess_Continue(This,fIsOutOfBand) \ - ( (This)->lpVtbl -> Continue(This,fIsOutOfBand) ) + ( (This)->lpVtbl -> Continue(This,fIsOutOfBand) ) #define ICorDebugProcess_IsRunning(This,pbRunning) \ - ( (This)->lpVtbl -> IsRunning(This,pbRunning) ) + ( (This)->lpVtbl -> IsRunning(This,pbRunning) ) #define ICorDebugProcess_HasQueuedCallbacks(This,pThread,pbQueued) \ - ( (This)->lpVtbl -> HasQueuedCallbacks(This,pThread,pbQueued) ) + ( (This)->lpVtbl -> HasQueuedCallbacks(This,pThread,pbQueued) ) #define ICorDebugProcess_EnumerateThreads(This,ppThreads) \ - ( (This)->lpVtbl -> EnumerateThreads(This,ppThreads) ) + ( (This)->lpVtbl -> EnumerateThreads(This,ppThreads) ) #define ICorDebugProcess_SetAllThreadsDebugState(This,state,pExceptThisThread) \ - ( (This)->lpVtbl -> SetAllThreadsDebugState(This,state,pExceptThisThread) ) + ( (This)->lpVtbl -> SetAllThreadsDebugState(This,state,pExceptThisThread) ) #define ICorDebugProcess_Detach(This) \ - ( (This)->lpVtbl -> Detach(This) ) + ( (This)->lpVtbl -> Detach(This) ) #define ICorDebugProcess_Terminate(This,exitCode) \ - ( (This)->lpVtbl -> Terminate(This,exitCode) ) + ( (This)->lpVtbl -> Terminate(This,exitCode) ) #define ICorDebugProcess_CanCommitChanges(This,cSnapshots,pSnapshots,pError) \ - ( (This)->lpVtbl -> CanCommitChanges(This,cSnapshots,pSnapshots,pError) ) + ( (This)->lpVtbl -> CanCommitChanges(This,cSnapshots,pSnapshots,pError) ) #define ICorDebugProcess_CommitChanges(This,cSnapshots,pSnapshots,pError) \ - ( (This)->lpVtbl -> CommitChanges(This,cSnapshots,pSnapshots,pError) ) + ( (This)->lpVtbl -> CommitChanges(This,cSnapshots,pSnapshots,pError) ) #define ICorDebugProcess_GetID(This,pdwProcessId) \ - ( (This)->lpVtbl -> GetID(This,pdwProcessId) ) + ( (This)->lpVtbl -> GetID(This,pdwProcessId) ) #define ICorDebugProcess_GetHandle(This,phProcessHandle) \ - ( (This)->lpVtbl -> GetHandle(This,phProcessHandle) ) + ( (This)->lpVtbl -> GetHandle(This,phProcessHandle) ) #define ICorDebugProcess_GetThread(This,dwThreadId,ppThread) \ - ( (This)->lpVtbl -> GetThread(This,dwThreadId,ppThread) ) + ( (This)->lpVtbl -> GetThread(This,dwThreadId,ppThread) ) #define ICorDebugProcess_EnumerateObjects(This,ppObjects) \ - ( (This)->lpVtbl -> EnumerateObjects(This,ppObjects) ) + ( (This)->lpVtbl -> EnumerateObjects(This,ppObjects) ) #define ICorDebugProcess_IsTransitionStub(This,address,pbTransitionStub) \ - ( (This)->lpVtbl -> IsTransitionStub(This,address,pbTransitionStub) ) + ( (This)->lpVtbl -> IsTransitionStub(This,address,pbTransitionStub) ) #define ICorDebugProcess_IsOSSuspended(This,threadID,pbSuspended) \ - ( (This)->lpVtbl -> IsOSSuspended(This,threadID,pbSuspended) ) + ( (This)->lpVtbl -> IsOSSuspended(This,threadID,pbSuspended) ) #define ICorDebugProcess_GetThreadContext(This,threadID,contextSize,context) \ - ( (This)->lpVtbl -> GetThreadContext(This,threadID,contextSize,context) ) + ( (This)->lpVtbl -> GetThreadContext(This,threadID,contextSize,context) ) #define ICorDebugProcess_SetThreadContext(This,threadID,contextSize,context) \ - ( (This)->lpVtbl -> SetThreadContext(This,threadID,contextSize,context) ) + ( (This)->lpVtbl -> SetThreadContext(This,threadID,contextSize,context) ) #define ICorDebugProcess_ReadMemory(This,address,size,buffer,read) \ - ( (This)->lpVtbl -> ReadMemory(This,address,size,buffer,read) ) + ( (This)->lpVtbl -> ReadMemory(This,address,size,buffer,read) ) #define ICorDebugProcess_WriteMemory(This,address,size,buffer,written) \ - ( (This)->lpVtbl -> WriteMemory(This,address,size,buffer,written) ) + ( (This)->lpVtbl -> WriteMemory(This,address,size,buffer,written) ) #define ICorDebugProcess_ClearCurrentException(This,threadID) \ - ( (This)->lpVtbl -> ClearCurrentException(This,threadID) ) + ( (This)->lpVtbl -> ClearCurrentException(This,threadID) ) #define ICorDebugProcess_EnableLogMessages(This,fOnOff) \ - ( (This)->lpVtbl -> EnableLogMessages(This,fOnOff) ) + ( (This)->lpVtbl -> EnableLogMessages(This,fOnOff) ) #define ICorDebugProcess_ModifyLogSwitch(This,pLogSwitchName,lLevel) \ - ( (This)->lpVtbl -> ModifyLogSwitch(This,pLogSwitchName,lLevel) ) + ( (This)->lpVtbl -> ModifyLogSwitch(This,pLogSwitchName,lLevel) ) #define ICorDebugProcess_EnumerateAppDomains(This,ppAppDomains) \ - ( (This)->lpVtbl -> EnumerateAppDomains(This,ppAppDomains) ) + ( (This)->lpVtbl -> EnumerateAppDomains(This,ppAppDomains) ) #define ICorDebugProcess_GetObject(This,ppObject) \ - ( (This)->lpVtbl -> GetObject(This,ppObject) ) + ( (This)->lpVtbl -> GetObject(This,ppObject) ) #define ICorDebugProcess_ThreadForFiberCookie(This,fiberCookie,ppThread) \ - ( (This)->lpVtbl -> ThreadForFiberCookie(This,fiberCookie,ppThread) ) + ( (This)->lpVtbl -> ThreadForFiberCookie(This,fiberCookie,ppThread) ) #define ICorDebugProcess_GetHelperThreadID(This,pThreadID) \ - ( (This)->lpVtbl -> GetHelperThreadID(This,pThreadID) ) + ( (This)->lpVtbl -> GetHelperThreadID(This,pThreadID) ) #endif /* COBJMACROS */ @@ -6939,7 +6948,7 @@ EXTERN_C const IID IID_ICorDebugProcess; /* interface __MIDL_itf_cordebug_0000_0037 */ -/* [local] */ +/* [local] */ #pragma warning(pop) @@ -6951,97 +6960,97 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0037_v0_0_s_ifspec; #define __ICorDebugProcess2_INTERFACE_DEFINED__ /* interface ICorDebugProcess2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcess2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("AD1B3588-0EF0-4744-A496-AA09A9F80371") ICorDebugProcess2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetThreadForTaskID( + virtual HRESULT STDMETHODCALLTYPE GetThreadForTaskID( /* [in] */ TASKID taskid, /* [out] */ ICorDebugThread2 **ppThread) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVersion( + + virtual HRESULT STDMETHODCALLTYPE GetVersion( /* [out] */ COR_VERSION *version) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetUnmanagedBreakpoint( + + virtual HRESULT STDMETHODCALLTYPE SetUnmanagedBreakpoint( /* [in] */ CORDB_ADDRESS address, /* [in] */ ULONG32 bufsize, /* [length_is][size_is][out] */ BYTE buffer[ ], /* [out] */ ULONG32 *bufLen) = 0; - - virtual HRESULT STDMETHODCALLTYPE ClearUnmanagedBreakpoint( + + virtual HRESULT STDMETHODCALLTYPE ClearUnmanagedBreakpoint( /* [in] */ CORDB_ADDRESS address) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetDesiredNGENCompilerFlags( + + virtual HRESULT STDMETHODCALLTYPE SetDesiredNGENCompilerFlags( /* [in] */ DWORD pdwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDesiredNGENCompilerFlags( + + virtual HRESULT STDMETHODCALLTYPE GetDesiredNGENCompilerFlags( /* [out] */ DWORD *pdwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetReferenceValueFromGCHandle( + + virtual HRESULT STDMETHODCALLTYPE GetReferenceValueFromGCHandle( /* [in] */ UINT_PTR handle, /* [out] */ ICorDebugReferenceValue **pOutValue) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcess2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcess2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcess2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcess2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetThreadForTaskID )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadForTaskID )( ICorDebugProcess2 * This, /* [in] */ TASKID taskid, /* [out] */ ICorDebugThread2 **ppThread); - - HRESULT ( STDMETHODCALLTYPE *GetVersion )( + + HRESULT ( STDMETHODCALLTYPE *GetVersion )( ICorDebugProcess2 * This, /* [out] */ COR_VERSION *version); - - HRESULT ( STDMETHODCALLTYPE *SetUnmanagedBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *SetUnmanagedBreakpoint )( ICorDebugProcess2 * This, /* [in] */ CORDB_ADDRESS address, /* [in] */ ULONG32 bufsize, /* [length_is][size_is][out] */ BYTE buffer[ ], /* [out] */ ULONG32 *bufLen); - - HRESULT ( STDMETHODCALLTYPE *ClearUnmanagedBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *ClearUnmanagedBreakpoint )( ICorDebugProcess2 * This, /* [in] */ CORDB_ADDRESS address); - - HRESULT ( STDMETHODCALLTYPE *SetDesiredNGENCompilerFlags )( + + HRESULT ( STDMETHODCALLTYPE *SetDesiredNGENCompilerFlags )( ICorDebugProcess2 * This, /* [in] */ DWORD pdwFlags); - - HRESULT ( STDMETHODCALLTYPE *GetDesiredNGENCompilerFlags )( + + HRESULT ( STDMETHODCALLTYPE *GetDesiredNGENCompilerFlags )( ICorDebugProcess2 * This, /* [out] */ DWORD *pdwFlags); - - HRESULT ( STDMETHODCALLTYPE *GetReferenceValueFromGCHandle )( + + HRESULT ( STDMETHODCALLTYPE *GetReferenceValueFromGCHandle )( ICorDebugProcess2 * This, /* [in] */ UINT_PTR handle, /* [out] */ ICorDebugReferenceValue **pOutValue); - + END_INTERFACE } ICorDebugProcess2Vtbl; @@ -7050,41 +7059,41 @@ EXTERN_C const IID IID_ICorDebugProcess2; CONST_VTBL struct ICorDebugProcess2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcess2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcess2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcess2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcess2_GetThreadForTaskID(This,taskid,ppThread) \ - ( (This)->lpVtbl -> GetThreadForTaskID(This,taskid,ppThread) ) + ( (This)->lpVtbl -> GetThreadForTaskID(This,taskid,ppThread) ) #define ICorDebugProcess2_GetVersion(This,version) \ - ( (This)->lpVtbl -> GetVersion(This,version) ) + ( (This)->lpVtbl -> GetVersion(This,version) ) #define ICorDebugProcess2_SetUnmanagedBreakpoint(This,address,bufsize,buffer,bufLen) \ - ( (This)->lpVtbl -> SetUnmanagedBreakpoint(This,address,bufsize,buffer,bufLen) ) + ( (This)->lpVtbl -> SetUnmanagedBreakpoint(This,address,bufsize,buffer,bufLen) ) #define ICorDebugProcess2_ClearUnmanagedBreakpoint(This,address) \ - ( (This)->lpVtbl -> ClearUnmanagedBreakpoint(This,address) ) + ( (This)->lpVtbl -> ClearUnmanagedBreakpoint(This,address) ) #define ICorDebugProcess2_SetDesiredNGENCompilerFlags(This,pdwFlags) \ - ( (This)->lpVtbl -> SetDesiredNGENCompilerFlags(This,pdwFlags) ) + ( (This)->lpVtbl -> SetDesiredNGENCompilerFlags(This,pdwFlags) ) #define ICorDebugProcess2_GetDesiredNGENCompilerFlags(This,pdwFlags) \ - ( (This)->lpVtbl -> GetDesiredNGENCompilerFlags(This,pdwFlags) ) + ( (This)->lpVtbl -> GetDesiredNGENCompilerFlags(This,pdwFlags) ) #define ICorDebugProcess2_GetReferenceValueFromGCHandle(This,handle,pOutValue) \ - ( (This)->lpVtbl -> GetReferenceValueFromGCHandle(This,handle,pOutValue) ) + ( (This)->lpVtbl -> GetReferenceValueFromGCHandle(This,handle,pOutValue) ) #endif /* COBJMACROS */ @@ -7101,47 +7110,47 @@ EXTERN_C const IID IID_ICorDebugProcess2; #define __ICorDebugProcess3_INTERFACE_DEFINED__ /* interface ICorDebugProcess3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcess3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("2EE06488-C0D4-42B1-B26D-F3795EF606FB") ICorDebugProcess3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE SetEnableCustomNotification( + virtual HRESULT STDMETHODCALLTYPE SetEnableCustomNotification( ICorDebugClass *pClass, BOOL fEnable) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcess3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcess3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcess3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcess3 * This); - - HRESULT ( STDMETHODCALLTYPE *SetEnableCustomNotification )( + + HRESULT ( STDMETHODCALLTYPE *SetEnableCustomNotification )( ICorDebugProcess3 * This, ICorDebugClass *pClass, BOOL fEnable); - + END_INTERFACE } ICorDebugProcess3Vtbl; @@ -7150,23 +7159,23 @@ EXTERN_C const IID IID_ICorDebugProcess3; CONST_VTBL struct ICorDebugProcess3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcess3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcess3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcess3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcess3_SetEnableCustomNotification(This,pClass,fEnable) \ - ( (This)->lpVtbl -> SetEnableCustomNotification(This,pClass,fEnable) ) + ( (This)->lpVtbl -> SetEnableCustomNotification(This,pClass,fEnable) ) #endif /* COBJMACROS */ @@ -7183,142 +7192,142 @@ EXTERN_C const IID IID_ICorDebugProcess3; #define __ICorDebugProcess5_INTERFACE_DEFINED__ /* interface ICorDebugProcess5 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcess5; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("21e9d9c0-fcb8-11df-8cff-0800200c9a66") ICorDebugProcess5 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetGCHeapInformation( + virtual HRESULT STDMETHODCALLTYPE GetGCHeapInformation( /* [out] */ COR_HEAPINFO *pHeapInfo) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateHeap( + + virtual HRESULT STDMETHODCALLTYPE EnumerateHeap( /* [out] */ ICorDebugHeapEnum **ppObjects) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateHeapRegions( + + virtual HRESULT STDMETHODCALLTYPE EnumerateHeapRegions( /* [out] */ ICorDebugHeapSegmentEnum **ppRegions) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetObject( + + virtual HRESULT STDMETHODCALLTYPE GetObject( /* [in] */ CORDB_ADDRESS addr, /* [out] */ ICorDebugObjectValue **pObject) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateGCReferences( + + virtual HRESULT STDMETHODCALLTYPE EnumerateGCReferences( /* [in] */ BOOL enumerateWeakReferences, /* [out] */ ICorDebugGCReferenceEnum **ppEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateHandles( + + virtual HRESULT STDMETHODCALLTYPE EnumerateHandles( /* [in] */ CorGCReferenceType types, /* [out] */ ICorDebugGCReferenceEnum **ppEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTypeID( + + virtual HRESULT STDMETHODCALLTYPE GetTypeID( /* [in] */ CORDB_ADDRESS obj, /* [out] */ COR_TYPEID *pId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTypeForTypeID( + + virtual HRESULT STDMETHODCALLTYPE GetTypeForTypeID( /* [in] */ COR_TYPEID id, /* [out] */ ICorDebugType **ppType) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetArrayLayout( + + virtual HRESULT STDMETHODCALLTYPE GetArrayLayout( /* [in] */ COR_TYPEID id, /* [out] */ COR_ARRAY_LAYOUT *pLayout) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTypeLayout( + + virtual HRESULT STDMETHODCALLTYPE GetTypeLayout( /* [in] */ COR_TYPEID id, /* [out] */ COR_TYPE_LAYOUT *pLayout) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTypeFields( + + virtual HRESULT STDMETHODCALLTYPE GetTypeFields( /* [in] */ COR_TYPEID id, ULONG32 celt, COR_FIELD fields[ ], ULONG32 *pceltNeeded) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableNGENPolicy( + + virtual HRESULT STDMETHODCALLTYPE EnableNGENPolicy( /* [in] */ CorDebugNGENPolicy ePolicy) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcess5Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcess5 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcess5 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcess5 * This); - - HRESULT ( STDMETHODCALLTYPE *GetGCHeapInformation )( + + HRESULT ( STDMETHODCALLTYPE *GetGCHeapInformation )( ICorDebugProcess5 * This, /* [out] */ COR_HEAPINFO *pHeapInfo); - - HRESULT ( STDMETHODCALLTYPE *EnumerateHeap )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateHeap )( ICorDebugProcess5 * This, /* [out] */ ICorDebugHeapEnum **ppObjects); - - HRESULT ( STDMETHODCALLTYPE *EnumerateHeapRegions )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateHeapRegions )( ICorDebugProcess5 * This, /* [out] */ ICorDebugHeapSegmentEnum **ppRegions); - - HRESULT ( STDMETHODCALLTYPE *GetObject )( + + HRESULT ( STDMETHODCALLTYPE *GetObject )( ICorDebugProcess5 * This, /* [in] */ CORDB_ADDRESS addr, /* [out] */ ICorDebugObjectValue **pObject); - - HRESULT ( STDMETHODCALLTYPE *EnumerateGCReferences )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateGCReferences )( ICorDebugProcess5 * This, /* [in] */ BOOL enumerateWeakReferences, /* [out] */ ICorDebugGCReferenceEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *EnumerateHandles )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateHandles )( ICorDebugProcess5 * This, /* [in] */ CorGCReferenceType types, /* [out] */ ICorDebugGCReferenceEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetTypeID )( + + HRESULT ( STDMETHODCALLTYPE *GetTypeID )( ICorDebugProcess5 * This, /* [in] */ CORDB_ADDRESS obj, /* [out] */ COR_TYPEID *pId); - - HRESULT ( STDMETHODCALLTYPE *GetTypeForTypeID )( + + HRESULT ( STDMETHODCALLTYPE *GetTypeForTypeID )( ICorDebugProcess5 * This, /* [in] */ COR_TYPEID id, /* [out] */ ICorDebugType **ppType); - - HRESULT ( STDMETHODCALLTYPE *GetArrayLayout )( + + HRESULT ( STDMETHODCALLTYPE *GetArrayLayout )( ICorDebugProcess5 * This, /* [in] */ COR_TYPEID id, /* [out] */ COR_ARRAY_LAYOUT *pLayout); - - HRESULT ( STDMETHODCALLTYPE *GetTypeLayout )( + + HRESULT ( STDMETHODCALLTYPE *GetTypeLayout )( ICorDebugProcess5 * This, /* [in] */ COR_TYPEID id, /* [out] */ COR_TYPE_LAYOUT *pLayout); - - HRESULT ( STDMETHODCALLTYPE *GetTypeFields )( + + HRESULT ( STDMETHODCALLTYPE *GetTypeFields )( ICorDebugProcess5 * This, /* [in] */ COR_TYPEID id, ULONG32 celt, COR_FIELD fields[ ], ULONG32 *pceltNeeded); - - HRESULT ( STDMETHODCALLTYPE *EnableNGENPolicy )( + + HRESULT ( STDMETHODCALLTYPE *EnableNGENPolicy )( ICorDebugProcess5 * This, /* [in] */ CorDebugNGENPolicy ePolicy); - + END_INTERFACE } ICorDebugProcess5Vtbl; @@ -7327,56 +7336,56 @@ EXTERN_C const IID IID_ICorDebugProcess5; CONST_VTBL struct ICorDebugProcess5Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcess5_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcess5_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcess5_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcess5_GetGCHeapInformation(This,pHeapInfo) \ - ( (This)->lpVtbl -> GetGCHeapInformation(This,pHeapInfo) ) + ( (This)->lpVtbl -> GetGCHeapInformation(This,pHeapInfo) ) #define ICorDebugProcess5_EnumerateHeap(This,ppObjects) \ - ( (This)->lpVtbl -> EnumerateHeap(This,ppObjects) ) + ( (This)->lpVtbl -> EnumerateHeap(This,ppObjects) ) #define ICorDebugProcess5_EnumerateHeapRegions(This,ppRegions) \ - ( (This)->lpVtbl -> EnumerateHeapRegions(This,ppRegions) ) + ( (This)->lpVtbl -> EnumerateHeapRegions(This,ppRegions) ) #define ICorDebugProcess5_GetObject(This,addr,pObject) \ - ( (This)->lpVtbl -> GetObject(This,addr,pObject) ) + ( (This)->lpVtbl -> GetObject(This,addr,pObject) ) #define ICorDebugProcess5_EnumerateGCReferences(This,enumerateWeakReferences,ppEnum) \ - ( (This)->lpVtbl -> EnumerateGCReferences(This,enumerateWeakReferences,ppEnum) ) + ( (This)->lpVtbl -> EnumerateGCReferences(This,enumerateWeakReferences,ppEnum) ) #define ICorDebugProcess5_EnumerateHandles(This,types,ppEnum) \ - ( (This)->lpVtbl -> EnumerateHandles(This,types,ppEnum) ) + ( (This)->lpVtbl -> EnumerateHandles(This,types,ppEnum) ) #define ICorDebugProcess5_GetTypeID(This,obj,pId) \ - ( (This)->lpVtbl -> GetTypeID(This,obj,pId) ) + ( (This)->lpVtbl -> GetTypeID(This,obj,pId) ) #define ICorDebugProcess5_GetTypeForTypeID(This,id,ppType) \ - ( (This)->lpVtbl -> GetTypeForTypeID(This,id,ppType) ) + ( (This)->lpVtbl -> GetTypeForTypeID(This,id,ppType) ) #define ICorDebugProcess5_GetArrayLayout(This,id,pLayout) \ - ( (This)->lpVtbl -> GetArrayLayout(This,id,pLayout) ) + ( (This)->lpVtbl -> GetArrayLayout(This,id,pLayout) ) #define ICorDebugProcess5_GetTypeLayout(This,id,pLayout) \ - ( (This)->lpVtbl -> GetTypeLayout(This,id,pLayout) ) + ( (This)->lpVtbl -> GetTypeLayout(This,id,pLayout) ) #define ICorDebugProcess5_GetTypeFields(This,id,celt,fields,pceltNeeded) \ - ( (This)->lpVtbl -> GetTypeFields(This,id,celt,fields,pceltNeeded) ) + ( (This)->lpVtbl -> GetTypeFields(This,id,celt,fields,pceltNeeded) ) #define ICorDebugProcess5_EnableNGENPolicy(This,ePolicy) \ - ( (This)->lpVtbl -> EnableNGENPolicy(This,ePolicy) ) + ( (This)->lpVtbl -> EnableNGENPolicy(This,ePolicy) ) #endif /* COBJMACROS */ @@ -7390,22 +7399,22 @@ EXTERN_C const IID IID_ICorDebugProcess5; /* interface __MIDL_itf_cordebug_0000_0040 */ -/* [local] */ +/* [local] */ -typedef +typedef enum CorDebugRecordFormat { FORMAT_WINDOWS_EXCEPTIONRECORD32 = 1, FORMAT_WINDOWS_EXCEPTIONRECORD64 = 2 } CorDebugRecordFormat; -typedef +typedef enum CorDebugDecodeEventFlagsWindows { IS_FIRST_CHANCE = 1 } CorDebugDecodeEventFlagsWindows; -typedef +typedef enum CorDebugDebugEventKind { DEBUG_EVENT_KIND_MODULE_LOADED = 1, @@ -7416,7 +7425,7 @@ enum CorDebugDebugEventKind DEBUG_EVENT_KIND_MANAGED_EXCEPTION_UNHANDLED = 6 } CorDebugDebugEventKind; -typedef +typedef enum CorDebugStateChange { PROCESS_RUNNING = 0x1, @@ -7432,52 +7441,52 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0040_v0_0_s_ifspec; #define __ICorDebugDebugEvent_INTERFACE_DEFINED__ /* interface ICorDebugDebugEvent */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugDebugEvent; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("41BD395D-DE99-48F1-BF7A-CC0F44A6D281") ICorDebugDebugEvent : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetEventKind( + virtual HRESULT STDMETHODCALLTYPE GetEventKind( /* [out] */ CorDebugDebugEventKind *pDebugEventKind) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThread( + + virtual HRESULT STDMETHODCALLTYPE GetThread( /* [out] */ ICorDebugThread **ppThread) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugDebugEventVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugDebugEvent * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugDebugEvent * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugDebugEvent * This); - - HRESULT ( STDMETHODCALLTYPE *GetEventKind )( + + HRESULT ( STDMETHODCALLTYPE *GetEventKind )( ICorDebugDebugEvent * This, /* [out] */ CorDebugDebugEventKind *pDebugEventKind); - - HRESULT ( STDMETHODCALLTYPE *GetThread )( + + HRESULT ( STDMETHODCALLTYPE *GetThread )( ICorDebugDebugEvent * This, /* [out] */ ICorDebugThread **ppThread); - + END_INTERFACE } ICorDebugDebugEventVtbl; @@ -7486,26 +7495,26 @@ EXTERN_C const IID IID_ICorDebugDebugEvent; CONST_VTBL struct ICorDebugDebugEventVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugDebugEvent_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugDebugEvent_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugDebugEvent_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugDebugEvent_GetEventKind(This,pDebugEventKind) \ - ( (This)->lpVtbl -> GetEventKind(This,pDebugEventKind) ) + ( (This)->lpVtbl -> GetEventKind(This,pDebugEventKind) ) #define ICorDebugDebugEvent_GetThread(This,ppThread) \ - ( (This)->lpVtbl -> GetThread(This,ppThread) ) + ( (This)->lpVtbl -> GetThread(This,ppThread) ) #endif /* COBJMACROS */ @@ -7519,23 +7528,23 @@ EXTERN_C const IID IID_ICorDebugDebugEvent; /* interface __MIDL_itf_cordebug_0000_0041 */ -/* [local] */ +/* [local] */ -typedef +typedef enum CorDebugCodeInvokeKind { CODE_INVOKE_KIND_NONE = 0, CODE_INVOKE_KIND_RETURN = ( CODE_INVOKE_KIND_NONE + 1 ) , - CODE_INVOKE_KIND_TAILCALL = ( CODE_INVOKE_KIND_RETURN + 1 ) + CODE_INVOKE_KIND_TAILCALL = ( CODE_INVOKE_KIND_RETURN + 1 ) } CorDebugCodeInvokeKind; -typedef +typedef enum CorDebugCodeInvokePurpose { CODE_INVOKE_PURPOSE_NONE = 0, CODE_INVOKE_PURPOSE_NATIVE_TO_MANAGED_TRANSITION = ( CODE_INVOKE_PURPOSE_NONE + 1 ) , CODE_INVOKE_PURPOSE_CLASS_INIT = ( CODE_INVOKE_PURPOSE_NATIVE_TO_MANAGED_TRANSITION + 1 ) , - CODE_INVOKE_PURPOSE_INTERFACE_DISPATCH = ( CODE_INVOKE_PURPOSE_CLASS_INIT + 1 ) + CODE_INVOKE_PURPOSE_INTERFACE_DISPATCH = ( CODE_INVOKE_PURPOSE_CLASS_INIT + 1 ) } CorDebugCodeInvokePurpose; @@ -7547,65 +7556,65 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0041_v0_0_s_ifspec; #define __ICorDebugProcess6_INTERFACE_DEFINED__ /* interface ICorDebugProcess6 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcess6; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("11588775-7205-4CEB-A41A-93753C3153E9") ICorDebugProcess6 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE DecodeEvent( + virtual HRESULT STDMETHODCALLTYPE DecodeEvent( /* [size_is][length_is][in] */ const BYTE pRecord[ ], /* [in] */ DWORD countBytes, /* [in] */ CorDebugRecordFormat format, /* [in] */ DWORD dwFlags, /* [in] */ DWORD dwThreadId, /* [out] */ ICorDebugDebugEvent **ppEvent) = 0; - - virtual HRESULT STDMETHODCALLTYPE ProcessStateChanged( + + virtual HRESULT STDMETHODCALLTYPE ProcessStateChanged( /* [in] */ CorDebugStateChange change) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCode( + + virtual HRESULT STDMETHODCALLTYPE GetCode( /* [in] */ CORDB_ADDRESS codeAddress, /* [out] */ ICorDebugCode **ppCode) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVirtualModuleSplitting( + + virtual HRESULT STDMETHODCALLTYPE EnableVirtualModuleSplitting( BOOL enableSplitting) = 0; - - virtual HRESULT STDMETHODCALLTYPE MarkDebuggerAttached( + + virtual HRESULT STDMETHODCALLTYPE MarkDebuggerAttached( BOOL fIsAttached) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetExportStepInfo( + + virtual HRESULT STDMETHODCALLTYPE GetExportStepInfo( /* [in] */ LPCWSTR pszExportName, /* [out] */ CorDebugCodeInvokeKind *pInvokeKind, /* [out] */ CorDebugCodeInvokePurpose *pInvokePurpose) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcess6Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcess6 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcess6 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcess6 * This); - - HRESULT ( STDMETHODCALLTYPE *DecodeEvent )( + + HRESULT ( STDMETHODCALLTYPE *DecodeEvent )( ICorDebugProcess6 * This, /* [size_is][length_is][in] */ const BYTE pRecord[ ], /* [in] */ DWORD countBytes, @@ -7613,30 +7622,30 @@ EXTERN_C const IID IID_ICorDebugProcess6; /* [in] */ DWORD dwFlags, /* [in] */ DWORD dwThreadId, /* [out] */ ICorDebugDebugEvent **ppEvent); - - HRESULT ( STDMETHODCALLTYPE *ProcessStateChanged )( + + HRESULT ( STDMETHODCALLTYPE *ProcessStateChanged )( ICorDebugProcess6 * This, /* [in] */ CorDebugStateChange change); - - HRESULT ( STDMETHODCALLTYPE *GetCode )( + + HRESULT ( STDMETHODCALLTYPE *GetCode )( ICorDebugProcess6 * This, /* [in] */ CORDB_ADDRESS codeAddress, /* [out] */ ICorDebugCode **ppCode); - - HRESULT ( STDMETHODCALLTYPE *EnableVirtualModuleSplitting )( + + HRESULT ( STDMETHODCALLTYPE *EnableVirtualModuleSplitting )( ICorDebugProcess6 * This, BOOL enableSplitting); - - HRESULT ( STDMETHODCALLTYPE *MarkDebuggerAttached )( + + HRESULT ( STDMETHODCALLTYPE *MarkDebuggerAttached )( ICorDebugProcess6 * This, BOOL fIsAttached); - - HRESULT ( STDMETHODCALLTYPE *GetExportStepInfo )( + + HRESULT ( STDMETHODCALLTYPE *GetExportStepInfo )( ICorDebugProcess6 * This, /* [in] */ LPCWSTR pszExportName, /* [out] */ CorDebugCodeInvokeKind *pInvokeKind, /* [out] */ CorDebugCodeInvokePurpose *pInvokePurpose); - + END_INTERFACE } ICorDebugProcess6Vtbl; @@ -7645,38 +7654,38 @@ EXTERN_C const IID IID_ICorDebugProcess6; CONST_VTBL struct ICorDebugProcess6Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcess6_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcess6_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcess6_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcess6_DecodeEvent(This,pRecord,countBytes,format,dwFlags,dwThreadId,ppEvent) \ - ( (This)->lpVtbl -> DecodeEvent(This,pRecord,countBytes,format,dwFlags,dwThreadId,ppEvent) ) + ( (This)->lpVtbl -> DecodeEvent(This,pRecord,countBytes,format,dwFlags,dwThreadId,ppEvent) ) #define ICorDebugProcess6_ProcessStateChanged(This,change) \ - ( (This)->lpVtbl -> ProcessStateChanged(This,change) ) + ( (This)->lpVtbl -> ProcessStateChanged(This,change) ) #define ICorDebugProcess6_GetCode(This,codeAddress,ppCode) \ - ( (This)->lpVtbl -> GetCode(This,codeAddress,ppCode) ) + ( (This)->lpVtbl -> GetCode(This,codeAddress,ppCode) ) #define ICorDebugProcess6_EnableVirtualModuleSplitting(This,enableSplitting) \ - ( (This)->lpVtbl -> EnableVirtualModuleSplitting(This,enableSplitting) ) + ( (This)->lpVtbl -> EnableVirtualModuleSplitting(This,enableSplitting) ) #define ICorDebugProcess6_MarkDebuggerAttached(This,fIsAttached) \ - ( (This)->lpVtbl -> MarkDebuggerAttached(This,fIsAttached) ) + ( (This)->lpVtbl -> MarkDebuggerAttached(This,fIsAttached) ) #define ICorDebugProcess6_GetExportStepInfo(This,pszExportName,pInvokeKind,pInvokePurpose) \ - ( (This)->lpVtbl -> GetExportStepInfo(This,pszExportName,pInvokeKind,pInvokePurpose) ) + ( (This)->lpVtbl -> GetExportStepInfo(This,pszExportName,pInvokeKind,pInvokePurpose) ) #endif /* COBJMACROS */ @@ -7690,13 +7699,13 @@ EXTERN_C const IID IID_ICorDebugProcess6; /* interface __MIDL_itf_cordebug_0000_0042 */ -/* [local] */ +/* [local] */ -typedef +typedef enum WriteableMetadataUpdateMode { LegacyCompatPolicy = 0, - AlwaysShowUpdates = ( LegacyCompatPolicy + 1 ) + AlwaysShowUpdates = ( LegacyCompatPolicy + 1 ) } WriteableMetadataUpdateMode; @@ -7708,45 +7717,45 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0042_v0_0_s_ifspec; #define __ICorDebugProcess7_INTERFACE_DEFINED__ /* interface ICorDebugProcess7 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcess7; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("9B2C54E4-119F-4D6F-B402-527603266D69") ICorDebugProcess7 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE SetWriteableMetadataUpdateMode( + virtual HRESULT STDMETHODCALLTYPE SetWriteableMetadataUpdateMode( WriteableMetadataUpdateMode flags) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcess7Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcess7 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcess7 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcess7 * This); - - HRESULT ( STDMETHODCALLTYPE *SetWriteableMetadataUpdateMode )( + + HRESULT ( STDMETHODCALLTYPE *SetWriteableMetadataUpdateMode )( ICorDebugProcess7 * This, WriteableMetadataUpdateMode flags); - + END_INTERFACE } ICorDebugProcess7Vtbl; @@ -7755,23 +7764,23 @@ EXTERN_C const IID IID_ICorDebugProcess7; CONST_VTBL struct ICorDebugProcess7Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcess7_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcess7_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcess7_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcess7_SetWriteableMetadataUpdateMode(This,flags) \ - ( (This)->lpVtbl -> SetWriteableMetadataUpdateMode(This,flags) ) + ( (This)->lpVtbl -> SetWriteableMetadataUpdateMode(This,flags) ) #endif /* COBJMACROS */ @@ -7788,45 +7797,45 @@ EXTERN_C const IID IID_ICorDebugProcess7; #define __ICorDebugProcess8_INTERFACE_DEFINED__ /* interface ICorDebugProcess8 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcess8; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("2E6F28C1-85EB-4141-80AD-0A90944B9639") ICorDebugProcess8 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE EnableExceptionCallbacksOutsideOfMyCode( + virtual HRESULT STDMETHODCALLTYPE EnableExceptionCallbacksOutsideOfMyCode( /* [in] */ BOOL enableExceptionsOutsideOfJMC) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcess8Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcess8 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcess8 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcess8 * This); - - HRESULT ( STDMETHODCALLTYPE *EnableExceptionCallbacksOutsideOfMyCode )( + + HRESULT ( STDMETHODCALLTYPE *EnableExceptionCallbacksOutsideOfMyCode )( ICorDebugProcess8 * This, /* [in] */ BOOL enableExceptionsOutsideOfJMC); - + END_INTERFACE } ICorDebugProcess8Vtbl; @@ -7835,23 +7844,23 @@ EXTERN_C const IID IID_ICorDebugProcess8; CONST_VTBL struct ICorDebugProcess8Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcess8_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcess8_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcess8_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcess8_EnableExceptionCallbacksOutsideOfMyCode(This,enableExceptionsOutsideOfJMC) \ - ( (This)->lpVtbl -> EnableExceptionCallbacksOutsideOfMyCode(This,enableExceptionsOutsideOfJMC) ) + ( (This)->lpVtbl -> EnableExceptionCallbacksOutsideOfMyCode(This,enableExceptionsOutsideOfJMC) ) #endif /* COBJMACROS */ @@ -7868,45 +7877,45 @@ EXTERN_C const IID IID_ICorDebugProcess8; #define __ICorDebugProcess10_INTERFACE_DEFINED__ /* interface ICorDebugProcess10 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcess10; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("8F378F6F-1017-4461-9890-ECF64C54079F") ICorDebugProcess10 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE EnableGCNotificationEvents( + virtual HRESULT STDMETHODCALLTYPE EnableGCNotificationEvents( BOOL fEnable) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcess10Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcess10 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcess10 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcess10 * This); - - HRESULT ( STDMETHODCALLTYPE *EnableGCNotificationEvents )( + + HRESULT ( STDMETHODCALLTYPE *EnableGCNotificationEvents )( ICorDebugProcess10 * This, BOOL fEnable); - + END_INTERFACE } ICorDebugProcess10Vtbl; @@ -7915,23 +7924,23 @@ EXTERN_C const IID IID_ICorDebugProcess10; CONST_VTBL struct ICorDebugProcess10Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcess10_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcess10_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcess10_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcess10_EnableGCNotificationEvents(This,fEnable) \ - ( (This)->lpVtbl -> EnableGCNotificationEvents(This,fEnable) ) + ( (This)->lpVtbl -> EnableGCNotificationEvents(This,fEnable) ) #endif /* COBJMACROS */ @@ -7945,7 +7954,7 @@ EXTERN_C const IID IID_ICorDebugProcess10; /* interface __MIDL_itf_cordebug_0000_0045 */ -/* [local] */ +/* [local] */ typedef struct _COR_MEMORY_RANGE { @@ -7962,64 +7971,64 @@ extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0045_v0_0_s_ifspec; #define __ICorDebugMemoryRangeEnum_INTERFACE_DEFINED__ /* interface ICorDebugMemoryRangeEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugMemoryRangeEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("D1A0BCFC-5865-4437-BE3F-36F022951F8A") ICorDebugMemoryRangeEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ COR_MEMORY_RANGE objects[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugMemoryRangeEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugMemoryRangeEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugMemoryRangeEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugMemoryRangeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugMemoryRangeEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugMemoryRangeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugMemoryRangeEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugMemoryRangeEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugMemoryRangeEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ COR_MEMORY_RANGE objects[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugMemoryRangeEnumVtbl; @@ -8028,36 +8037,36 @@ EXTERN_C const IID IID_ICorDebugMemoryRangeEnum; CONST_VTBL struct ICorDebugMemoryRangeEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugMemoryRangeEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugMemoryRangeEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugMemoryRangeEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugMemoryRangeEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugMemoryRangeEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugMemoryRangeEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugMemoryRangeEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugMemoryRangeEnum_Next(This,celt,objects,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,objects,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,objects,pceltFetched) ) #endif /* COBJMACROS */ @@ -8074,45 +8083,45 @@ EXTERN_C const IID IID_ICorDebugMemoryRangeEnum; #define __ICorDebugProcess11_INTERFACE_DEFINED__ /* interface ICorDebugProcess11 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcess11; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("344B37AA-F2C0-4D3B-9909-91CCF787DA8C") ICorDebugProcess11 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE EnumerateLoaderHeapMemoryRegions( + virtual HRESULT STDMETHODCALLTYPE EnumerateLoaderHeapMemoryRegions( /* [out] */ ICorDebugMemoryRangeEnum **ppRanges) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcess11Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcess11 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcess11 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcess11 * This); - - HRESULT ( STDMETHODCALLTYPE *EnumerateLoaderHeapMemoryRegions )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateLoaderHeapMemoryRegions )( ICorDebugProcess11 * This, /* [out] */ ICorDebugMemoryRangeEnum **ppRanges); - + END_INTERFACE } ICorDebugProcess11Vtbl; @@ -8121,23 +8130,23 @@ EXTERN_C const IID IID_ICorDebugProcess11; CONST_VTBL struct ICorDebugProcess11Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcess11_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcess11_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcess11_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcess11_EnumerateLoaderHeapMemoryRegions(This,ppRanges) \ - ( (This)->lpVtbl -> EnumerateLoaderHeapMemoryRegions(This,ppRanges) ) + ( (This)->lpVtbl -> EnumerateLoaderHeapMemoryRegions(This,ppRanges) ) #endif /* COBJMACROS */ @@ -8154,53 +8163,53 @@ EXTERN_C const IID IID_ICorDebugProcess11; #define __ICorDebugModuleDebugEvent_INTERFACE_DEFINED__ /* interface ICorDebugModuleDebugEvent */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugModuleDebugEvent; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("51A15E8D-9FFF-4864-9B87-F4FBDEA747A2") ICorDebugModuleDebugEvent : public ICorDebugDebugEvent { public: - virtual HRESULT STDMETHODCALLTYPE GetModule( + virtual HRESULT STDMETHODCALLTYPE GetModule( /* [out] */ ICorDebugModule **ppModule) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugModuleDebugEventVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugModuleDebugEvent * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugModuleDebugEvent * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugModuleDebugEvent * This); - - HRESULT ( STDMETHODCALLTYPE *GetEventKind )( + + HRESULT ( STDMETHODCALLTYPE *GetEventKind )( ICorDebugModuleDebugEvent * This, /* [out] */ CorDebugDebugEventKind *pDebugEventKind); - - HRESULT ( STDMETHODCALLTYPE *GetThread )( + + HRESULT ( STDMETHODCALLTYPE *GetThread )( ICorDebugModuleDebugEvent * This, /* [out] */ ICorDebugThread **ppThread); - - HRESULT ( STDMETHODCALLTYPE *GetModule )( + + HRESULT ( STDMETHODCALLTYPE *GetModule )( ICorDebugModuleDebugEvent * This, /* [out] */ ICorDebugModule **ppModule); - + END_INTERFACE } ICorDebugModuleDebugEventVtbl; @@ -8209,30 +8218,30 @@ EXTERN_C const IID IID_ICorDebugModuleDebugEvent; CONST_VTBL struct ICorDebugModuleDebugEventVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugModuleDebugEvent_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugModuleDebugEvent_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugModuleDebugEvent_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugModuleDebugEvent_GetEventKind(This,pDebugEventKind) \ - ( (This)->lpVtbl -> GetEventKind(This,pDebugEventKind) ) + ( (This)->lpVtbl -> GetEventKind(This,pDebugEventKind) ) #define ICorDebugModuleDebugEvent_GetThread(This,ppThread) \ - ( (This)->lpVtbl -> GetThread(This,ppThread) ) + ( (This)->lpVtbl -> GetThread(This,ppThread) ) #define ICorDebugModuleDebugEvent_GetModule(This,ppModule) \ - ( (This)->lpVtbl -> GetModule(This,ppModule) ) + ( (This)->lpVtbl -> GetModule(This,ppModule) ) #endif /* COBJMACROS */ @@ -8249,67 +8258,67 @@ EXTERN_C const IID IID_ICorDebugModuleDebugEvent; #define __ICorDebugExceptionDebugEvent_INTERFACE_DEFINED__ /* interface ICorDebugExceptionDebugEvent */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugExceptionDebugEvent; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("AF79EC94-4752-419C-A626-5FB1CC1A5AB7") ICorDebugExceptionDebugEvent : public ICorDebugDebugEvent { public: - virtual HRESULT STDMETHODCALLTYPE GetStackPointer( + virtual HRESULT STDMETHODCALLTYPE GetStackPointer( /* [out] */ CORDB_ADDRESS *pStackPointer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNativeIP( + + virtual HRESULT STDMETHODCALLTYPE GetNativeIP( /* [out] */ CORDB_ADDRESS *pIP) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlags( + + virtual HRESULT STDMETHODCALLTYPE GetFlags( /* [out] */ CorDebugExceptionFlags *pdwFlags) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugExceptionDebugEventVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugExceptionDebugEvent * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugExceptionDebugEvent * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugExceptionDebugEvent * This); - - HRESULT ( STDMETHODCALLTYPE *GetEventKind )( + + HRESULT ( STDMETHODCALLTYPE *GetEventKind )( ICorDebugExceptionDebugEvent * This, /* [out] */ CorDebugDebugEventKind *pDebugEventKind); - - HRESULT ( STDMETHODCALLTYPE *GetThread )( + + HRESULT ( STDMETHODCALLTYPE *GetThread )( ICorDebugExceptionDebugEvent * This, /* [out] */ ICorDebugThread **ppThread); - - HRESULT ( STDMETHODCALLTYPE *GetStackPointer )( + + HRESULT ( STDMETHODCALLTYPE *GetStackPointer )( ICorDebugExceptionDebugEvent * This, /* [out] */ CORDB_ADDRESS *pStackPointer); - - HRESULT ( STDMETHODCALLTYPE *GetNativeIP )( + + HRESULT ( STDMETHODCALLTYPE *GetNativeIP )( ICorDebugExceptionDebugEvent * This, /* [out] */ CORDB_ADDRESS *pIP); - - HRESULT ( STDMETHODCALLTYPE *GetFlags )( + + HRESULT ( STDMETHODCALLTYPE *GetFlags )( ICorDebugExceptionDebugEvent * This, /* [out] */ CorDebugExceptionFlags *pdwFlags); - + END_INTERFACE } ICorDebugExceptionDebugEventVtbl; @@ -8318,36 +8327,36 @@ EXTERN_C const IID IID_ICorDebugExceptionDebugEvent; CONST_VTBL struct ICorDebugExceptionDebugEventVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugExceptionDebugEvent_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugExceptionDebugEvent_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugExceptionDebugEvent_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugExceptionDebugEvent_GetEventKind(This,pDebugEventKind) \ - ( (This)->lpVtbl -> GetEventKind(This,pDebugEventKind) ) + ( (This)->lpVtbl -> GetEventKind(This,pDebugEventKind) ) #define ICorDebugExceptionDebugEvent_GetThread(This,ppThread) \ - ( (This)->lpVtbl -> GetThread(This,ppThread) ) + ( (This)->lpVtbl -> GetThread(This,ppThread) ) #define ICorDebugExceptionDebugEvent_GetStackPointer(This,pStackPointer) \ - ( (This)->lpVtbl -> GetStackPointer(This,pStackPointer) ) + ( (This)->lpVtbl -> GetStackPointer(This,pStackPointer) ) #define ICorDebugExceptionDebugEvent_GetNativeIP(This,pIP) \ - ( (This)->lpVtbl -> GetNativeIP(This,pIP) ) + ( (This)->lpVtbl -> GetNativeIP(This,pIP) ) #define ICorDebugExceptionDebugEvent_GetFlags(This,pdwFlags) \ - ( (This)->lpVtbl -> GetFlags(This,pdwFlags) ) + ( (This)->lpVtbl -> GetFlags(This,pdwFlags) ) #endif /* COBJMACROS */ @@ -8364,52 +8373,52 @@ EXTERN_C const IID IID_ICorDebugExceptionDebugEvent; #define __ICorDebugBreakpoint_INTERFACE_DEFINED__ /* interface ICorDebugBreakpoint */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugBreakpoint; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAE8-8A68-11d2-983C-0000F808342D") ICorDebugBreakpoint : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE Activate( + virtual HRESULT STDMETHODCALLTYPE Activate( /* [in] */ BOOL bActive) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsActive( + + virtual HRESULT STDMETHODCALLTYPE IsActive( /* [out] */ BOOL *pbActive) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugBreakpointVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugBreakpoint * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugBreakpoint * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugBreakpoint * This); - - HRESULT ( STDMETHODCALLTYPE *Activate )( + + HRESULT ( STDMETHODCALLTYPE *Activate )( ICorDebugBreakpoint * This, /* [in] */ BOOL bActive); - - HRESULT ( STDMETHODCALLTYPE *IsActive )( + + HRESULT ( STDMETHODCALLTYPE *IsActive )( ICorDebugBreakpoint * This, /* [out] */ BOOL *pbActive); - + END_INTERFACE } ICorDebugBreakpointVtbl; @@ -8418,26 +8427,26 @@ EXTERN_C const IID IID_ICorDebugBreakpoint; CONST_VTBL struct ICorDebugBreakpointVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugBreakpoint_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugBreakpoint_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugBreakpoint_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugBreakpoint_Activate(This,bActive) \ - ( (This)->lpVtbl -> Activate(This,bActive) ) + ( (This)->lpVtbl -> Activate(This,bActive) ) #define ICorDebugBreakpoint_IsActive(This,pbActive) \ - ( (This)->lpVtbl -> IsActive(This,pbActive) ) + ( (This)->lpVtbl -> IsActive(This,pbActive) ) #endif /* COBJMACROS */ @@ -8454,60 +8463,60 @@ EXTERN_C const IID IID_ICorDebugBreakpoint; #define __ICorDebugFunctionBreakpoint_INTERFACE_DEFINED__ /* interface ICorDebugFunctionBreakpoint */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugFunctionBreakpoint; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAE9-8A68-11d2-983C-0000F808342D") ICorDebugFunctionBreakpoint : public ICorDebugBreakpoint { public: - virtual HRESULT STDMETHODCALLTYPE GetFunction( + virtual HRESULT STDMETHODCALLTYPE GetFunction( /* [out] */ ICorDebugFunction **ppFunction) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetOffset( + + virtual HRESULT STDMETHODCALLTYPE GetOffset( /* [out] */ ULONG32 *pnOffset) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugFunctionBreakpointVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugFunctionBreakpoint * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugFunctionBreakpoint * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugFunctionBreakpoint * This); - - HRESULT ( STDMETHODCALLTYPE *Activate )( + + HRESULT ( STDMETHODCALLTYPE *Activate )( ICorDebugFunctionBreakpoint * This, /* [in] */ BOOL bActive); - - HRESULT ( STDMETHODCALLTYPE *IsActive )( + + HRESULT ( STDMETHODCALLTYPE *IsActive )( ICorDebugFunctionBreakpoint * This, /* [out] */ BOOL *pbActive); - - HRESULT ( STDMETHODCALLTYPE *GetFunction )( + + HRESULT ( STDMETHODCALLTYPE *GetFunction )( ICorDebugFunctionBreakpoint * This, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetOffset )( + + HRESULT ( STDMETHODCALLTYPE *GetOffset )( ICorDebugFunctionBreakpoint * This, /* [out] */ ULONG32 *pnOffset); - + END_INTERFACE } ICorDebugFunctionBreakpointVtbl; @@ -8516,33 +8525,33 @@ EXTERN_C const IID IID_ICorDebugFunctionBreakpoint; CONST_VTBL struct ICorDebugFunctionBreakpointVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugFunctionBreakpoint_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugFunctionBreakpoint_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugFunctionBreakpoint_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugFunctionBreakpoint_Activate(This,bActive) \ - ( (This)->lpVtbl -> Activate(This,bActive) ) + ( (This)->lpVtbl -> Activate(This,bActive) ) #define ICorDebugFunctionBreakpoint_IsActive(This,pbActive) \ - ( (This)->lpVtbl -> IsActive(This,pbActive) ) + ( (This)->lpVtbl -> IsActive(This,pbActive) ) #define ICorDebugFunctionBreakpoint_GetFunction(This,ppFunction) \ - ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) + ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) #define ICorDebugFunctionBreakpoint_GetOffset(This,pnOffset) \ - ( (This)->lpVtbl -> GetOffset(This,pnOffset) ) + ( (This)->lpVtbl -> GetOffset(This,pnOffset) ) #endif /* COBJMACROS */ @@ -8559,53 +8568,53 @@ EXTERN_C const IID IID_ICorDebugFunctionBreakpoint; #define __ICorDebugModuleBreakpoint_INTERFACE_DEFINED__ /* interface ICorDebugModuleBreakpoint */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugModuleBreakpoint; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAEA-8A68-11d2-983C-0000F808342D") ICorDebugModuleBreakpoint : public ICorDebugBreakpoint { public: - virtual HRESULT STDMETHODCALLTYPE GetModule( + virtual HRESULT STDMETHODCALLTYPE GetModule( /* [out] */ ICorDebugModule **ppModule) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugModuleBreakpointVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugModuleBreakpoint * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugModuleBreakpoint * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugModuleBreakpoint * This); - - HRESULT ( STDMETHODCALLTYPE *Activate )( + + HRESULT ( STDMETHODCALLTYPE *Activate )( ICorDebugModuleBreakpoint * This, /* [in] */ BOOL bActive); - - HRESULT ( STDMETHODCALLTYPE *IsActive )( + + HRESULT ( STDMETHODCALLTYPE *IsActive )( ICorDebugModuleBreakpoint * This, /* [out] */ BOOL *pbActive); - - HRESULT ( STDMETHODCALLTYPE *GetModule )( + + HRESULT ( STDMETHODCALLTYPE *GetModule )( ICorDebugModuleBreakpoint * This, /* [out] */ ICorDebugModule **ppModule); - + END_INTERFACE } ICorDebugModuleBreakpointVtbl; @@ -8614,30 +8623,30 @@ EXTERN_C const IID IID_ICorDebugModuleBreakpoint; CONST_VTBL struct ICorDebugModuleBreakpointVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugModuleBreakpoint_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugModuleBreakpoint_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugModuleBreakpoint_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugModuleBreakpoint_Activate(This,bActive) \ - ( (This)->lpVtbl -> Activate(This,bActive) ) + ( (This)->lpVtbl -> Activate(This,bActive) ) #define ICorDebugModuleBreakpoint_IsActive(This,pbActive) \ - ( (This)->lpVtbl -> IsActive(This,pbActive) ) + ( (This)->lpVtbl -> IsActive(This,pbActive) ) #define ICorDebugModuleBreakpoint_GetModule(This,ppModule) \ - ( (This)->lpVtbl -> GetModule(This,ppModule) ) + ( (This)->lpVtbl -> GetModule(This,ppModule) ) #endif /* COBJMACROS */ @@ -8654,53 +8663,53 @@ EXTERN_C const IID IID_ICorDebugModuleBreakpoint; #define __ICorDebugValueBreakpoint_INTERFACE_DEFINED__ /* interface ICorDebugValueBreakpoint */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugValueBreakpoint; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAEB-8A68-11d2-983C-0000F808342D") ICorDebugValueBreakpoint : public ICorDebugBreakpoint { public: - virtual HRESULT STDMETHODCALLTYPE GetValue( + virtual HRESULT STDMETHODCALLTYPE GetValue( /* [out] */ ICorDebugValue **ppValue) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugValueBreakpointVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugValueBreakpoint * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugValueBreakpoint * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugValueBreakpoint * This); - - HRESULT ( STDMETHODCALLTYPE *Activate )( + + HRESULT ( STDMETHODCALLTYPE *Activate )( ICorDebugValueBreakpoint * This, /* [in] */ BOOL bActive); - - HRESULT ( STDMETHODCALLTYPE *IsActive )( + + HRESULT ( STDMETHODCALLTYPE *IsActive )( ICorDebugValueBreakpoint * This, /* [out] */ BOOL *pbActive); - - HRESULT ( STDMETHODCALLTYPE *GetValue )( + + HRESULT ( STDMETHODCALLTYPE *GetValue )( ICorDebugValueBreakpoint * This, /* [out] */ ICorDebugValue **ppValue); - + END_INTERFACE } ICorDebugValueBreakpointVtbl; @@ -8709,30 +8718,30 @@ EXTERN_C const IID IID_ICorDebugValueBreakpoint; CONST_VTBL struct ICorDebugValueBreakpointVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugValueBreakpoint_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugValueBreakpoint_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugValueBreakpoint_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugValueBreakpoint_Activate(This,bActive) \ - ( (This)->lpVtbl -> Activate(This,bActive) ) + ( (This)->lpVtbl -> Activate(This,bActive) ) #define ICorDebugValueBreakpoint_IsActive(This,pbActive) \ - ( (This)->lpVtbl -> IsActive(This,pbActive) ) + ( (This)->lpVtbl -> IsActive(This,pbActive) ) #define ICorDebugValueBreakpoint_GetValue(This,ppValue) \ - ( (This)->lpVtbl -> GetValue(This,ppValue) ) + ( (This)->lpVtbl -> GetValue(This,ppValue) ) #endif /* COBJMACROS */ @@ -8749,9 +8758,9 @@ EXTERN_C const IID IID_ICorDebugValueBreakpoint; #define __ICorDebugStepper_INTERFACE_DEFINED__ /* interface ICorDebugStepper */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugIntercept { INTERCEPT_NONE = 0, @@ -8763,7 +8772,7 @@ enum CorDebugIntercept INTERCEPT_ALL = 0xffff } CorDebugIntercept; -typedef +typedef enum CorDebugUnmappedStop { STOP_NONE = 0, @@ -8785,88 +8794,88 @@ typedef struct COR_DEBUG_STEP_RANGE EXTERN_C const IID IID_ICorDebugStepper; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAEC-8A68-11d2-983C-0000F808342D") ICorDebugStepper : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE IsActive( + virtual HRESULT STDMETHODCALLTYPE IsActive( /* [out] */ BOOL *pbActive) = 0; - + virtual HRESULT STDMETHODCALLTYPE Deactivate( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInterceptMask( + + virtual HRESULT STDMETHODCALLTYPE SetInterceptMask( /* [in] */ CorDebugIntercept mask) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetUnmappedStopMask( + + virtual HRESULT STDMETHODCALLTYPE SetUnmappedStopMask( /* [in] */ CorDebugUnmappedStop mask) = 0; - - virtual HRESULT STDMETHODCALLTYPE Step( + + virtual HRESULT STDMETHODCALLTYPE Step( /* [in] */ BOOL bStepIn) = 0; - - virtual HRESULT STDMETHODCALLTYPE StepRange( + + virtual HRESULT STDMETHODCALLTYPE StepRange( /* [in] */ BOOL bStepIn, /* [size_is][in] */ COR_DEBUG_STEP_RANGE ranges[ ], /* [in] */ ULONG32 cRangeCount) = 0; - + virtual HRESULT STDMETHODCALLTYPE StepOut( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetRangeIL( + + virtual HRESULT STDMETHODCALLTYPE SetRangeIL( /* [in] */ BOOL bIL) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugStepperVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugStepper * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugStepper * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugStepper * This); - - HRESULT ( STDMETHODCALLTYPE *IsActive )( + + HRESULT ( STDMETHODCALLTYPE *IsActive )( ICorDebugStepper * This, /* [out] */ BOOL *pbActive); - - HRESULT ( STDMETHODCALLTYPE *Deactivate )( + + HRESULT ( STDMETHODCALLTYPE *Deactivate )( ICorDebugStepper * This); - - HRESULT ( STDMETHODCALLTYPE *SetInterceptMask )( + + HRESULT ( STDMETHODCALLTYPE *SetInterceptMask )( ICorDebugStepper * This, /* [in] */ CorDebugIntercept mask); - - HRESULT ( STDMETHODCALLTYPE *SetUnmappedStopMask )( + + HRESULT ( STDMETHODCALLTYPE *SetUnmappedStopMask )( ICorDebugStepper * This, /* [in] */ CorDebugUnmappedStop mask); - - HRESULT ( STDMETHODCALLTYPE *Step )( + + HRESULT ( STDMETHODCALLTYPE *Step )( ICorDebugStepper * This, /* [in] */ BOOL bStepIn); - - HRESULT ( STDMETHODCALLTYPE *StepRange )( + + HRESULT ( STDMETHODCALLTYPE *StepRange )( ICorDebugStepper * This, /* [in] */ BOOL bStepIn, /* [size_is][in] */ COR_DEBUG_STEP_RANGE ranges[ ], /* [in] */ ULONG32 cRangeCount); - - HRESULT ( STDMETHODCALLTYPE *StepOut )( + + HRESULT ( STDMETHODCALLTYPE *StepOut )( ICorDebugStepper * This); - - HRESULT ( STDMETHODCALLTYPE *SetRangeIL )( + + HRESULT ( STDMETHODCALLTYPE *SetRangeIL )( ICorDebugStepper * This, /* [in] */ BOOL bIL); - + END_INTERFACE } ICorDebugStepperVtbl; @@ -8875,44 +8884,44 @@ EXTERN_C const IID IID_ICorDebugStepper; CONST_VTBL struct ICorDebugStepperVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugStepper_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugStepper_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugStepper_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugStepper_IsActive(This,pbActive) \ - ( (This)->lpVtbl -> IsActive(This,pbActive) ) + ( (This)->lpVtbl -> IsActive(This,pbActive) ) #define ICorDebugStepper_Deactivate(This) \ - ( (This)->lpVtbl -> Deactivate(This) ) + ( (This)->lpVtbl -> Deactivate(This) ) #define ICorDebugStepper_SetInterceptMask(This,mask) \ - ( (This)->lpVtbl -> SetInterceptMask(This,mask) ) + ( (This)->lpVtbl -> SetInterceptMask(This,mask) ) #define ICorDebugStepper_SetUnmappedStopMask(This,mask) \ - ( (This)->lpVtbl -> SetUnmappedStopMask(This,mask) ) + ( (This)->lpVtbl -> SetUnmappedStopMask(This,mask) ) #define ICorDebugStepper_Step(This,bStepIn) \ - ( (This)->lpVtbl -> Step(This,bStepIn) ) + ( (This)->lpVtbl -> Step(This,bStepIn) ) #define ICorDebugStepper_StepRange(This,bStepIn,ranges,cRangeCount) \ - ( (This)->lpVtbl -> StepRange(This,bStepIn,ranges,cRangeCount) ) + ( (This)->lpVtbl -> StepRange(This,bStepIn,ranges,cRangeCount) ) #define ICorDebugStepper_StepOut(This) \ - ( (This)->lpVtbl -> StepOut(This) ) + ( (This)->lpVtbl -> StepOut(This) ) #define ICorDebugStepper_SetRangeIL(This,bIL) \ - ( (This)->lpVtbl -> SetRangeIL(This,bIL) ) + ( (This)->lpVtbl -> SetRangeIL(This,bIL) ) #endif /* COBJMACROS */ @@ -8929,45 +8938,45 @@ EXTERN_C const IID IID_ICorDebugStepper; #define __ICorDebugStepper2_INTERFACE_DEFINED__ /* interface ICorDebugStepper2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugStepper2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("C5B6E9C3-E7D1-4a8e-873B-7F047F0706F7") ICorDebugStepper2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE SetJMC( + virtual HRESULT STDMETHODCALLTYPE SetJMC( /* [in] */ BOOL fIsJMCStepper) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugStepper2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugStepper2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugStepper2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugStepper2 * This); - - HRESULT ( STDMETHODCALLTYPE *SetJMC )( + + HRESULT ( STDMETHODCALLTYPE *SetJMC )( ICorDebugStepper2 * This, /* [in] */ BOOL fIsJMCStepper); - + END_INTERFACE } ICorDebugStepper2Vtbl; @@ -8976,23 +8985,23 @@ EXTERN_C const IID IID_ICorDebugStepper2; CONST_VTBL struct ICorDebugStepper2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugStepper2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugStepper2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugStepper2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugStepper2_SetJMC(This,fIsJMCStepper) \ - ( (This)->lpVtbl -> SetJMC(This,fIsJMCStepper) ) + ( (This)->lpVtbl -> SetJMC(This,fIsJMCStepper) ) #endif /* COBJMACROS */ @@ -9009,9 +9018,9 @@ EXTERN_C const IID IID_ICorDebugStepper2; #define __ICorDebugRegisterSet_INTERFACE_DEFINED__ /* interface ICorDebugRegisterSet */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugRegister { REGISTER_INSTRUCTION_POINTER = 0, @@ -9182,86 +9191,86 @@ enum CorDebugRegister REGISTER_ARM64_V28 = ( REGISTER_ARM64_V27 + 1 ) , REGISTER_ARM64_V29 = ( REGISTER_ARM64_V28 + 1 ) , REGISTER_ARM64_V30 = ( REGISTER_ARM64_V29 + 1 ) , - REGISTER_ARM64_V31 = ( REGISTER_ARM64_V30 + 1 ) + REGISTER_ARM64_V31 = ( REGISTER_ARM64_V30 + 1 ) } CorDebugRegister; EXTERN_C const IID IID_ICorDebugRegisterSet; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB0B-8A68-11d2-983C-0000F808342D") ICorDebugRegisterSet : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetRegistersAvailable( + virtual HRESULT STDMETHODCALLTYPE GetRegistersAvailable( /* [out] */ ULONG64 *pAvailable) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRegisters( + + virtual HRESULT STDMETHODCALLTYPE GetRegisters( /* [in] */ ULONG64 mask, /* [in] */ ULONG32 regCount, /* [length_is][size_is][out] */ CORDB_REGISTER regBuffer[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetRegisters( + + virtual HRESULT STDMETHODCALLTYPE SetRegisters( /* [in] */ ULONG64 mask, /* [in] */ ULONG32 regCount, /* [size_is][in] */ CORDB_REGISTER regBuffer[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThreadContext( + + virtual HRESULT STDMETHODCALLTYPE GetThreadContext( /* [in] */ ULONG32 contextSize, /* [size_is][length_is][out][in] */ BYTE context[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetThreadContext( + + virtual HRESULT STDMETHODCALLTYPE SetThreadContext( /* [in] */ ULONG32 contextSize, /* [size_is][length_is][in] */ BYTE context[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugRegisterSetVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugRegisterSet * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugRegisterSet * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugRegisterSet * This); - - HRESULT ( STDMETHODCALLTYPE *GetRegistersAvailable )( + + HRESULT ( STDMETHODCALLTYPE *GetRegistersAvailable )( ICorDebugRegisterSet * This, /* [out] */ ULONG64 *pAvailable); - - HRESULT ( STDMETHODCALLTYPE *GetRegisters )( + + HRESULT ( STDMETHODCALLTYPE *GetRegisters )( ICorDebugRegisterSet * This, /* [in] */ ULONG64 mask, /* [in] */ ULONG32 regCount, /* [length_is][size_is][out] */ CORDB_REGISTER regBuffer[ ]); - - HRESULT ( STDMETHODCALLTYPE *SetRegisters )( + + HRESULT ( STDMETHODCALLTYPE *SetRegisters )( ICorDebugRegisterSet * This, /* [in] */ ULONG64 mask, /* [in] */ ULONG32 regCount, /* [size_is][in] */ CORDB_REGISTER regBuffer[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetThreadContext )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadContext )( ICorDebugRegisterSet * This, /* [in] */ ULONG32 contextSize, /* [size_is][length_is][out][in] */ BYTE context[ ]); - - HRESULT ( STDMETHODCALLTYPE *SetThreadContext )( + + HRESULT ( STDMETHODCALLTYPE *SetThreadContext )( ICorDebugRegisterSet * This, /* [in] */ ULONG32 contextSize, /* [size_is][length_is][in] */ BYTE context[ ]); - + END_INTERFACE } ICorDebugRegisterSetVtbl; @@ -9270,35 +9279,35 @@ EXTERN_C const IID IID_ICorDebugRegisterSet; CONST_VTBL struct ICorDebugRegisterSetVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugRegisterSet_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugRegisterSet_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugRegisterSet_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugRegisterSet_GetRegistersAvailable(This,pAvailable) \ - ( (This)->lpVtbl -> GetRegistersAvailable(This,pAvailable) ) + ( (This)->lpVtbl -> GetRegistersAvailable(This,pAvailable) ) #define ICorDebugRegisterSet_GetRegisters(This,mask,regCount,regBuffer) \ - ( (This)->lpVtbl -> GetRegisters(This,mask,regCount,regBuffer) ) + ( (This)->lpVtbl -> GetRegisters(This,mask,regCount,regBuffer) ) #define ICorDebugRegisterSet_SetRegisters(This,mask,regCount,regBuffer) \ - ( (This)->lpVtbl -> SetRegisters(This,mask,regCount,regBuffer) ) + ( (This)->lpVtbl -> SetRegisters(This,mask,regCount,regBuffer) ) #define ICorDebugRegisterSet_GetThreadContext(This,contextSize,context) \ - ( (This)->lpVtbl -> GetThreadContext(This,contextSize,context) ) + ( (This)->lpVtbl -> GetThreadContext(This,contextSize,context) ) #define ICorDebugRegisterSet_SetThreadContext(This,contextSize,context) \ - ( (This)->lpVtbl -> SetThreadContext(This,contextSize,context) ) + ( (This)->lpVtbl -> SetThreadContext(This,contextSize,context) ) #endif /* COBJMACROS */ @@ -9315,73 +9324,73 @@ EXTERN_C const IID IID_ICorDebugRegisterSet; #define __ICorDebugRegisterSet2_INTERFACE_DEFINED__ /* interface ICorDebugRegisterSet2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugRegisterSet2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("6DC7BA3F-89BA-4459-9EC1-9D60937B468D") ICorDebugRegisterSet2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetRegistersAvailable( + virtual HRESULT STDMETHODCALLTYPE GetRegistersAvailable( /* [in] */ ULONG32 numChunks, /* [size_is][out] */ BYTE availableRegChunks[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRegisters( + + virtual HRESULT STDMETHODCALLTYPE GetRegisters( /* [in] */ ULONG32 maskCount, /* [size_is][in] */ BYTE mask[ ], /* [in] */ ULONG32 regCount, /* [size_is][out] */ CORDB_REGISTER regBuffer[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetRegisters( + + virtual HRESULT STDMETHODCALLTYPE SetRegisters( /* [in] */ ULONG32 maskCount, /* [size_is][in] */ BYTE mask[ ], /* [in] */ ULONG32 regCount, /* [size_is][in] */ CORDB_REGISTER regBuffer[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugRegisterSet2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugRegisterSet2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugRegisterSet2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugRegisterSet2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetRegistersAvailable )( + + HRESULT ( STDMETHODCALLTYPE *GetRegistersAvailable )( ICorDebugRegisterSet2 * This, /* [in] */ ULONG32 numChunks, /* [size_is][out] */ BYTE availableRegChunks[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetRegisters )( + + HRESULT ( STDMETHODCALLTYPE *GetRegisters )( ICorDebugRegisterSet2 * This, /* [in] */ ULONG32 maskCount, /* [size_is][in] */ BYTE mask[ ], /* [in] */ ULONG32 regCount, /* [size_is][out] */ CORDB_REGISTER regBuffer[ ]); - - HRESULT ( STDMETHODCALLTYPE *SetRegisters )( + + HRESULT ( STDMETHODCALLTYPE *SetRegisters )( ICorDebugRegisterSet2 * This, /* [in] */ ULONG32 maskCount, /* [size_is][in] */ BYTE mask[ ], /* [in] */ ULONG32 regCount, /* [size_is][in] */ CORDB_REGISTER regBuffer[ ]); - + END_INTERFACE } ICorDebugRegisterSet2Vtbl; @@ -9390,29 +9399,29 @@ EXTERN_C const IID IID_ICorDebugRegisterSet2; CONST_VTBL struct ICorDebugRegisterSet2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugRegisterSet2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugRegisterSet2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugRegisterSet2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugRegisterSet2_GetRegistersAvailable(This,numChunks,availableRegChunks) \ - ( (This)->lpVtbl -> GetRegistersAvailable(This,numChunks,availableRegChunks) ) + ( (This)->lpVtbl -> GetRegistersAvailable(This,numChunks,availableRegChunks) ) #define ICorDebugRegisterSet2_GetRegisters(This,maskCount,mask,regCount,regBuffer) \ - ( (This)->lpVtbl -> GetRegisters(This,maskCount,mask,regCount,regBuffer) ) + ( (This)->lpVtbl -> GetRegisters(This,maskCount,mask,regCount,regBuffer) ) #define ICorDebugRegisterSet2_SetRegisters(This,maskCount,mask,regCount,regBuffer) \ - ( (This)->lpVtbl -> SetRegisters(This,maskCount,mask,regCount,regBuffer) ) + ( (This)->lpVtbl -> SetRegisters(This,maskCount,mask,regCount,regBuffer) ) #endif /* COBJMACROS */ @@ -9429,9 +9438,9 @@ EXTERN_C const IID IID_ICorDebugRegisterSet2; #define __ICorDebugThread_INTERFACE_DEFINED__ /* interface ICorDebugThread */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugUserState { USER_STOP_REQUESTED = 0x1, @@ -9449,142 +9458,142 @@ enum CorDebugUserState EXTERN_C const IID IID_ICorDebugThread; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("938c6d66-7fb6-4f69-b389-425b8987329b") ICorDebugThread : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetProcess( + virtual HRESULT STDMETHODCALLTYPE GetProcess( /* [out] */ ICorDebugProcess **ppProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetID( + + virtual HRESULT STDMETHODCALLTYPE GetID( /* [out] */ DWORD *pdwThreadId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHandle( + + virtual HRESULT STDMETHODCALLTYPE GetHandle( /* [out] */ HTHREAD *phThreadHandle) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAppDomain( + + virtual HRESULT STDMETHODCALLTYPE GetAppDomain( /* [out] */ ICorDebugAppDomain **ppAppDomain) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetDebugState( + + virtual HRESULT STDMETHODCALLTYPE SetDebugState( /* [in] */ CorDebugThreadState state) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDebugState( + + virtual HRESULT STDMETHODCALLTYPE GetDebugState( /* [out] */ CorDebugThreadState *pState) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetUserState( + + virtual HRESULT STDMETHODCALLTYPE GetUserState( /* [out] */ CorDebugUserState *pState) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentException( + + virtual HRESULT STDMETHODCALLTYPE GetCurrentException( /* [out] */ ICorDebugValue **ppExceptionObject) = 0; - + virtual HRESULT STDMETHODCALLTYPE ClearCurrentException( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateStepper( + + virtual HRESULT STDMETHODCALLTYPE CreateStepper( /* [out] */ ICorDebugStepper **ppStepper) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateChains( + + virtual HRESULT STDMETHODCALLTYPE EnumerateChains( /* [out] */ ICorDebugChainEnum **ppChains) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetActiveChain( + + virtual HRESULT STDMETHODCALLTYPE GetActiveChain( /* [out] */ ICorDebugChain **ppChain) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetActiveFrame( + + virtual HRESULT STDMETHODCALLTYPE GetActiveFrame( /* [out] */ ICorDebugFrame **ppFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRegisterSet( + + virtual HRESULT STDMETHODCALLTYPE GetRegisterSet( /* [out] */ ICorDebugRegisterSet **ppRegisters) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateEval( + + virtual HRESULT STDMETHODCALLTYPE CreateEval( /* [out] */ ICorDebugEval **ppEval) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetObject( + + virtual HRESULT STDMETHODCALLTYPE GetObject( /* [out] */ ICorDebugValue **ppObject) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugThreadVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugThread * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugThread * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugThread * This); - - HRESULT ( STDMETHODCALLTYPE *GetProcess )( + + HRESULT ( STDMETHODCALLTYPE *GetProcess )( ICorDebugThread * This, /* [out] */ ICorDebugProcess **ppProcess); - - HRESULT ( STDMETHODCALLTYPE *GetID )( + + HRESULT ( STDMETHODCALLTYPE *GetID )( ICorDebugThread * This, /* [out] */ DWORD *pdwThreadId); - - HRESULT ( STDMETHODCALLTYPE *GetHandle )( + + HRESULT ( STDMETHODCALLTYPE *GetHandle )( ICorDebugThread * This, /* [out] */ HTHREAD *phThreadHandle); - - HRESULT ( STDMETHODCALLTYPE *GetAppDomain )( + + HRESULT ( STDMETHODCALLTYPE *GetAppDomain )( ICorDebugThread * This, /* [out] */ ICorDebugAppDomain **ppAppDomain); - - HRESULT ( STDMETHODCALLTYPE *SetDebugState )( + + HRESULT ( STDMETHODCALLTYPE *SetDebugState )( ICorDebugThread * This, /* [in] */ CorDebugThreadState state); - - HRESULT ( STDMETHODCALLTYPE *GetDebugState )( + + HRESULT ( STDMETHODCALLTYPE *GetDebugState )( ICorDebugThread * This, /* [out] */ CorDebugThreadState *pState); - - HRESULT ( STDMETHODCALLTYPE *GetUserState )( + + HRESULT ( STDMETHODCALLTYPE *GetUserState )( ICorDebugThread * This, /* [out] */ CorDebugUserState *pState); - - HRESULT ( STDMETHODCALLTYPE *GetCurrentException )( + + HRESULT ( STDMETHODCALLTYPE *GetCurrentException )( ICorDebugThread * This, /* [out] */ ICorDebugValue **ppExceptionObject); - - HRESULT ( STDMETHODCALLTYPE *ClearCurrentException )( + + HRESULT ( STDMETHODCALLTYPE *ClearCurrentException )( ICorDebugThread * This); - - HRESULT ( STDMETHODCALLTYPE *CreateStepper )( + + HRESULT ( STDMETHODCALLTYPE *CreateStepper )( ICorDebugThread * This, /* [out] */ ICorDebugStepper **ppStepper); - - HRESULT ( STDMETHODCALLTYPE *EnumerateChains )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateChains )( ICorDebugThread * This, /* [out] */ ICorDebugChainEnum **ppChains); - - HRESULT ( STDMETHODCALLTYPE *GetActiveChain )( + + HRESULT ( STDMETHODCALLTYPE *GetActiveChain )( ICorDebugThread * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *GetActiveFrame )( + + HRESULT ( STDMETHODCALLTYPE *GetActiveFrame )( ICorDebugThread * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *GetRegisterSet )( + + HRESULT ( STDMETHODCALLTYPE *GetRegisterSet )( ICorDebugThread * This, /* [out] */ ICorDebugRegisterSet **ppRegisters); - - HRESULT ( STDMETHODCALLTYPE *CreateEval )( + + HRESULT ( STDMETHODCALLTYPE *CreateEval )( ICorDebugThread * This, /* [out] */ ICorDebugEval **ppEval); - - HRESULT ( STDMETHODCALLTYPE *GetObject )( + + HRESULT ( STDMETHODCALLTYPE *GetObject )( ICorDebugThread * This, /* [out] */ ICorDebugValue **ppObject); - + END_INTERFACE } ICorDebugThreadVtbl; @@ -9593,68 +9602,68 @@ EXTERN_C const IID IID_ICorDebugThread; CONST_VTBL struct ICorDebugThreadVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugThread_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugThread_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugThread_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugThread_GetProcess(This,ppProcess) \ - ( (This)->lpVtbl -> GetProcess(This,ppProcess) ) + ( (This)->lpVtbl -> GetProcess(This,ppProcess) ) #define ICorDebugThread_GetID(This,pdwThreadId) \ - ( (This)->lpVtbl -> GetID(This,pdwThreadId) ) + ( (This)->lpVtbl -> GetID(This,pdwThreadId) ) #define ICorDebugThread_GetHandle(This,phThreadHandle) \ - ( (This)->lpVtbl -> GetHandle(This,phThreadHandle) ) + ( (This)->lpVtbl -> GetHandle(This,phThreadHandle) ) #define ICorDebugThread_GetAppDomain(This,ppAppDomain) \ - ( (This)->lpVtbl -> GetAppDomain(This,ppAppDomain) ) + ( (This)->lpVtbl -> GetAppDomain(This,ppAppDomain) ) #define ICorDebugThread_SetDebugState(This,state) \ - ( (This)->lpVtbl -> SetDebugState(This,state) ) + ( (This)->lpVtbl -> SetDebugState(This,state) ) #define ICorDebugThread_GetDebugState(This,pState) \ - ( (This)->lpVtbl -> GetDebugState(This,pState) ) + ( (This)->lpVtbl -> GetDebugState(This,pState) ) #define ICorDebugThread_GetUserState(This,pState) \ - ( (This)->lpVtbl -> GetUserState(This,pState) ) + ( (This)->lpVtbl -> GetUserState(This,pState) ) #define ICorDebugThread_GetCurrentException(This,ppExceptionObject) \ - ( (This)->lpVtbl -> GetCurrentException(This,ppExceptionObject) ) + ( (This)->lpVtbl -> GetCurrentException(This,ppExceptionObject) ) #define ICorDebugThread_ClearCurrentException(This) \ - ( (This)->lpVtbl -> ClearCurrentException(This) ) + ( (This)->lpVtbl -> ClearCurrentException(This) ) #define ICorDebugThread_CreateStepper(This,ppStepper) \ - ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) + ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) #define ICorDebugThread_EnumerateChains(This,ppChains) \ - ( (This)->lpVtbl -> EnumerateChains(This,ppChains) ) + ( (This)->lpVtbl -> EnumerateChains(This,ppChains) ) #define ICorDebugThread_GetActiveChain(This,ppChain) \ - ( (This)->lpVtbl -> GetActiveChain(This,ppChain) ) + ( (This)->lpVtbl -> GetActiveChain(This,ppChain) ) #define ICorDebugThread_GetActiveFrame(This,ppFrame) \ - ( (This)->lpVtbl -> GetActiveFrame(This,ppFrame) ) + ( (This)->lpVtbl -> GetActiveFrame(This,ppFrame) ) #define ICorDebugThread_GetRegisterSet(This,ppRegisters) \ - ( (This)->lpVtbl -> GetRegisterSet(This,ppRegisters) ) + ( (This)->lpVtbl -> GetRegisterSet(This,ppRegisters) ) #define ICorDebugThread_CreateEval(This,ppEval) \ - ( (This)->lpVtbl -> CreateEval(This,ppEval) ) + ( (This)->lpVtbl -> CreateEval(This,ppEval) ) #define ICorDebugThread_GetObject(This,ppObject) \ - ( (This)->lpVtbl -> GetObject(This,ppObject) ) + ( (This)->lpVtbl -> GetObject(This,ppObject) ) #endif /* COBJMACROS */ @@ -9671,7 +9680,7 @@ EXTERN_C const IID IID_ICorDebugThread; #define __ICorDebugThread2_INTERFACE_DEFINED__ /* interface ICorDebugThread2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ typedef struct _COR_ACTIVE_FUNCTION { @@ -9686,71 +9695,71 @@ typedef struct _COR_ACTIVE_FUNCTION EXTERN_C const IID IID_ICorDebugThread2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("2BD956D9-7B07-4bef-8A98-12AA862417C5") ICorDebugThread2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetActiveFunctions( + virtual HRESULT STDMETHODCALLTYPE GetActiveFunctions( /* [in] */ ULONG32 cFunctions, /* [out] */ ULONG32 *pcFunctions, /* [length_is][size_is][out][in] */ COR_ACTIVE_FUNCTION pFunctions[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetConnectionID( + + virtual HRESULT STDMETHODCALLTYPE GetConnectionID( /* [out] */ CONNID *pdwConnectionId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTaskID( + + virtual HRESULT STDMETHODCALLTYPE GetTaskID( /* [out] */ TASKID *pTaskId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVolatileOSThreadID( + + virtual HRESULT STDMETHODCALLTYPE GetVolatileOSThreadID( /* [out] */ DWORD *pdwTid) = 0; - - virtual HRESULT STDMETHODCALLTYPE InterceptCurrentException( + + virtual HRESULT STDMETHODCALLTYPE InterceptCurrentException( /* [in] */ ICorDebugFrame *pFrame) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugThread2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugThread2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugThread2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugThread2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetActiveFunctions )( + + HRESULT ( STDMETHODCALLTYPE *GetActiveFunctions )( ICorDebugThread2 * This, /* [in] */ ULONG32 cFunctions, /* [out] */ ULONG32 *pcFunctions, /* [length_is][size_is][out][in] */ COR_ACTIVE_FUNCTION pFunctions[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetConnectionID )( + + HRESULT ( STDMETHODCALLTYPE *GetConnectionID )( ICorDebugThread2 * This, /* [out] */ CONNID *pdwConnectionId); - - HRESULT ( STDMETHODCALLTYPE *GetTaskID )( + + HRESULT ( STDMETHODCALLTYPE *GetTaskID )( ICorDebugThread2 * This, /* [out] */ TASKID *pTaskId); - - HRESULT ( STDMETHODCALLTYPE *GetVolatileOSThreadID )( + + HRESULT ( STDMETHODCALLTYPE *GetVolatileOSThreadID )( ICorDebugThread2 * This, /* [out] */ DWORD *pdwTid); - - HRESULT ( STDMETHODCALLTYPE *InterceptCurrentException )( + + HRESULT ( STDMETHODCALLTYPE *InterceptCurrentException )( ICorDebugThread2 * This, /* [in] */ ICorDebugFrame *pFrame); - + END_INTERFACE } ICorDebugThread2Vtbl; @@ -9759,35 +9768,35 @@ EXTERN_C const IID IID_ICorDebugThread2; CONST_VTBL struct ICorDebugThread2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugThread2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugThread2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugThread2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugThread2_GetActiveFunctions(This,cFunctions,pcFunctions,pFunctions) \ - ( (This)->lpVtbl -> GetActiveFunctions(This,cFunctions,pcFunctions,pFunctions) ) + ( (This)->lpVtbl -> GetActiveFunctions(This,cFunctions,pcFunctions,pFunctions) ) #define ICorDebugThread2_GetConnectionID(This,pdwConnectionId) \ - ( (This)->lpVtbl -> GetConnectionID(This,pdwConnectionId) ) + ( (This)->lpVtbl -> GetConnectionID(This,pdwConnectionId) ) #define ICorDebugThread2_GetTaskID(This,pTaskId) \ - ( (This)->lpVtbl -> GetTaskID(This,pTaskId) ) + ( (This)->lpVtbl -> GetTaskID(This,pTaskId) ) #define ICorDebugThread2_GetVolatileOSThreadID(This,pdwTid) \ - ( (This)->lpVtbl -> GetVolatileOSThreadID(This,pdwTid) ) + ( (This)->lpVtbl -> GetVolatileOSThreadID(This,pdwTid) ) #define ICorDebugThread2_InterceptCurrentException(This,pFrame) \ - ( (This)->lpVtbl -> InterceptCurrentException(This,pFrame) ) + ( (This)->lpVtbl -> InterceptCurrentException(This,pFrame) ) #endif /* COBJMACROS */ @@ -9804,56 +9813,56 @@ EXTERN_C const IID IID_ICorDebugThread2; #define __ICorDebugThread3_INTERFACE_DEFINED__ /* interface ICorDebugThread3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugThread3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("F8544EC3-5E4E-46c7-8D3E-A52B8405B1F5") ICorDebugThread3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CreateStackWalk( + virtual HRESULT STDMETHODCALLTYPE CreateStackWalk( /* [out] */ ICorDebugStackWalk **ppStackWalk) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetActiveInternalFrames( + + virtual HRESULT STDMETHODCALLTYPE GetActiveInternalFrames( /* [in] */ ULONG32 cInternalFrames, /* [out] */ ULONG32 *pcInternalFrames, /* [length_is][size_is][out][in] */ ICorDebugInternalFrame2 *ppInternalFrames[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugThread3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugThread3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugThread3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugThread3 * This); - - HRESULT ( STDMETHODCALLTYPE *CreateStackWalk )( + + HRESULT ( STDMETHODCALLTYPE *CreateStackWalk )( ICorDebugThread3 * This, /* [out] */ ICorDebugStackWalk **ppStackWalk); - - HRESULT ( STDMETHODCALLTYPE *GetActiveInternalFrames )( + + HRESULT ( STDMETHODCALLTYPE *GetActiveInternalFrames )( ICorDebugThread3 * This, /* [in] */ ULONG32 cInternalFrames, /* [out] */ ULONG32 *pcInternalFrames, /* [length_is][size_is][out][in] */ ICorDebugInternalFrame2 *ppInternalFrames[ ]); - + END_INTERFACE } ICorDebugThread3Vtbl; @@ -9862,26 +9871,26 @@ EXTERN_C const IID IID_ICorDebugThread3; CONST_VTBL struct ICorDebugThread3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugThread3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugThread3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugThread3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugThread3_CreateStackWalk(This,ppStackWalk) \ - ( (This)->lpVtbl -> CreateStackWalk(This,ppStackWalk) ) + ( (This)->lpVtbl -> CreateStackWalk(This,ppStackWalk) ) #define ICorDebugThread3_GetActiveInternalFrames(This,cInternalFrames,pcInternalFrames,ppInternalFrames) \ - ( (This)->lpVtbl -> GetActiveInternalFrames(This,cInternalFrames,pcInternalFrames,ppInternalFrames) ) + ( (This)->lpVtbl -> GetActiveInternalFrames(This,cInternalFrames,pcInternalFrames,ppInternalFrames) ) #endif /* COBJMACROS */ @@ -9898,57 +9907,57 @@ EXTERN_C const IID IID_ICorDebugThread3; #define __ICorDebugThread4_INTERFACE_DEFINED__ /* interface ICorDebugThread4 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugThread4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("1A1F204B-1C66-4637-823F-3EE6C744A69C") ICorDebugThread4 : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE HasUnhandledException( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBlockingObjects( + + virtual HRESULT STDMETHODCALLTYPE GetBlockingObjects( /* [out] */ ICorDebugBlockingObjectEnum **ppBlockingObjectEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentCustomDebuggerNotification( + + virtual HRESULT STDMETHODCALLTYPE GetCurrentCustomDebuggerNotification( /* [out] */ ICorDebugValue **ppNotificationObject) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugThread4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugThread4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugThread4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugThread4 * This); - - HRESULT ( STDMETHODCALLTYPE *HasUnhandledException )( + + HRESULT ( STDMETHODCALLTYPE *HasUnhandledException )( ICorDebugThread4 * This); - - HRESULT ( STDMETHODCALLTYPE *GetBlockingObjects )( + + HRESULT ( STDMETHODCALLTYPE *GetBlockingObjects )( ICorDebugThread4 * This, /* [out] */ ICorDebugBlockingObjectEnum **ppBlockingObjectEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCurrentCustomDebuggerNotification )( + + HRESULT ( STDMETHODCALLTYPE *GetCurrentCustomDebuggerNotification )( ICorDebugThread4 * This, /* [out] */ ICorDebugValue **ppNotificationObject); - + END_INTERFACE } ICorDebugThread4Vtbl; @@ -9957,29 +9966,29 @@ EXTERN_C const IID IID_ICorDebugThread4; CONST_VTBL struct ICorDebugThread4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugThread4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugThread4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugThread4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugThread4_HasUnhandledException(This) \ - ( (This)->lpVtbl -> HasUnhandledException(This) ) + ( (This)->lpVtbl -> HasUnhandledException(This) ) #define ICorDebugThread4_GetBlockingObjects(This,ppBlockingObjectEnum) \ - ( (This)->lpVtbl -> GetBlockingObjects(This,ppBlockingObjectEnum) ) + ( (This)->lpVtbl -> GetBlockingObjects(This,ppBlockingObjectEnum) ) #define ICorDebugThread4_GetCurrentCustomDebuggerNotification(This,ppNotificationObject) \ - ( (This)->lpVtbl -> GetCurrentCustomDebuggerNotification(This,ppNotificationObject) ) + ( (This)->lpVtbl -> GetCurrentCustomDebuggerNotification(This,ppNotificationObject) ) #endif /* COBJMACROS */ @@ -9992,13 +10001,95 @@ EXTERN_C const IID IID_ICorDebugThread4; #endif /* __ICorDebugThread4_INTERFACE_DEFINED__ */ +#ifndef __ICorDebugThread5_INTERFACE_DEFINED__ +#define __ICorDebugThread5_INTERFACE_DEFINED__ + +/* interface ICorDebugThread5 */ +/* [unique][uuid][local][object] */ + + +EXTERN_C const IID IID_ICorDebugThread5; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F98421C4-E506-4D24-916F-0237EE853EC6") + ICorDebugThread5 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetBytesAllocated( + /* [out] */ ULONG64 *pSohAllocatedBytes, + /* [out] */ ULONG64 *pUohAllocatedBytes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ICorDebugThread5Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ICorDebugThread5 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ICorDebugThread5 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ICorDebugThread5 * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytesAllocated )( + ICorDebugThread5 * This, + /* [out] */ ULONG64 *pSohAllocatedBytes, + /* [out] */ ULONG64 *pUohAllocatedBytes); + + END_INTERFACE + } ICorDebugThread5Vtbl; + + interface ICorDebugThread5 + { + CONST_VTBL struct ICorDebugThread5Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ICorDebugThread5_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ICorDebugThread5_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ICorDebugThread5_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ICorDebugThread5_GetBytesAllocated(This,pSohAllocatedBytes,pUohAllocatedBytes) \ + ( (This)->lpVtbl -> GetBytesAllocated(This,pSohAllocatedBytes,pUohAllocatedBytes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ICorDebugThread5_INTERFACE_DEFINED__ */ + + #ifndef __ICorDebugStackWalk_INTERFACE_DEFINED__ #define __ICorDebugStackWalk_INTERFACE_DEFINED__ /* interface ICorDebugStackWalk */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugSetContextFlag { SET_CONTEXT_FLAG_ACTIVE_FRAME = 0x1, @@ -10009,68 +10100,68 @@ enum CorDebugSetContextFlag EXTERN_C const IID IID_ICorDebugStackWalk; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("A0647DE9-55DE-4816-929C-385271C64CF7") ICorDebugStackWalk : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetContext( + virtual HRESULT STDMETHODCALLTYPE GetContext( /* [in] */ ULONG32 contextFlags, /* [in] */ ULONG32 contextBufSize, /* [out] */ ULONG32 *contextSize, /* [size_is][out] */ BYTE contextBuf[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetContext( + + virtual HRESULT STDMETHODCALLTYPE SetContext( /* [in] */ CorDebugSetContextFlag flag, /* [in] */ ULONG32 contextSize, /* [size_is][in] */ BYTE context[ ]) = 0; - + virtual HRESULT STDMETHODCALLTYPE Next( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrame( + + virtual HRESULT STDMETHODCALLTYPE GetFrame( /* [out] */ ICorDebugFrame **pFrame) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugStackWalkVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugStackWalk * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugStackWalk * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugStackWalk * This); - - HRESULT ( STDMETHODCALLTYPE *GetContext )( + + HRESULT ( STDMETHODCALLTYPE *GetContext )( ICorDebugStackWalk * This, /* [in] */ ULONG32 contextFlags, /* [in] */ ULONG32 contextBufSize, /* [out] */ ULONG32 *contextSize, /* [size_is][out] */ BYTE contextBuf[ ]); - - HRESULT ( STDMETHODCALLTYPE *SetContext )( + + HRESULT ( STDMETHODCALLTYPE *SetContext )( ICorDebugStackWalk * This, /* [in] */ CorDebugSetContextFlag flag, /* [in] */ ULONG32 contextSize, /* [size_is][in] */ BYTE context[ ]); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugStackWalk * This); - - HRESULT ( STDMETHODCALLTYPE *GetFrame )( + + HRESULT ( STDMETHODCALLTYPE *GetFrame )( ICorDebugStackWalk * This, /* [out] */ ICorDebugFrame **pFrame); - + END_INTERFACE } ICorDebugStackWalkVtbl; @@ -10079,32 +10170,32 @@ EXTERN_C const IID IID_ICorDebugStackWalk; CONST_VTBL struct ICorDebugStackWalkVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugStackWalk_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugStackWalk_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugStackWalk_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugStackWalk_GetContext(This,contextFlags,contextBufSize,contextSize,contextBuf) \ - ( (This)->lpVtbl -> GetContext(This,contextFlags,contextBufSize,contextSize,contextBuf) ) + ( (This)->lpVtbl -> GetContext(This,contextFlags,contextBufSize,contextSize,contextBuf) ) #define ICorDebugStackWalk_SetContext(This,flag,contextSize,context) \ - ( (This)->lpVtbl -> SetContext(This,flag,contextSize,context) ) + ( (This)->lpVtbl -> SetContext(This,flag,contextSize,context) ) #define ICorDebugStackWalk_Next(This) \ - ( (This)->lpVtbl -> Next(This) ) + ( (This)->lpVtbl -> Next(This) ) #define ICorDebugStackWalk_GetFrame(This,pFrame) \ - ( (This)->lpVtbl -> GetFrame(This,pFrame) ) + ( (This)->lpVtbl -> GetFrame(This,pFrame) ) #endif /* COBJMACROS */ @@ -10121,9 +10212,9 @@ EXTERN_C const IID IID_ICorDebugStackWalk; #define __ICorDebugChain_INTERFACE_DEFINED__ /* interface ICorDebugChain */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugChainReason { CHAIN_NONE = 0, @@ -10145,118 +10236,118 @@ enum CorDebugChainReason EXTERN_C const IID IID_ICorDebugChain; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAEE-8A68-11d2-983C-0000F808342D") ICorDebugChain : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetThread( + virtual HRESULT STDMETHODCALLTYPE GetThread( /* [out] */ ICorDebugThread **ppThread) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStackRange( + + virtual HRESULT STDMETHODCALLTYPE GetStackRange( /* [out] */ CORDB_ADDRESS *pStart, /* [out] */ CORDB_ADDRESS *pEnd) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetContext( + + virtual HRESULT STDMETHODCALLTYPE GetContext( /* [out] */ ICorDebugContext **ppContext) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCaller( + + virtual HRESULT STDMETHODCALLTYPE GetCaller( /* [out] */ ICorDebugChain **ppChain) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCallee( + + virtual HRESULT STDMETHODCALLTYPE GetCallee( /* [out] */ ICorDebugChain **ppChain) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPrevious( + + virtual HRESULT STDMETHODCALLTYPE GetPrevious( /* [out] */ ICorDebugChain **ppChain) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNext( + + virtual HRESULT STDMETHODCALLTYPE GetNext( /* [out] */ ICorDebugChain **ppChain) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsManaged( + + virtual HRESULT STDMETHODCALLTYPE IsManaged( /* [out] */ BOOL *pManaged) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateFrames( + + virtual HRESULT STDMETHODCALLTYPE EnumerateFrames( /* [out] */ ICorDebugFrameEnum **ppFrames) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetActiveFrame( + + virtual HRESULT STDMETHODCALLTYPE GetActiveFrame( /* [out] */ ICorDebugFrame **ppFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRegisterSet( + + virtual HRESULT STDMETHODCALLTYPE GetRegisterSet( /* [out] */ ICorDebugRegisterSet **ppRegisters) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetReason( + + virtual HRESULT STDMETHODCALLTYPE GetReason( /* [out] */ CorDebugChainReason *pReason) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugChainVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugChain * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugChain * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugChain * This); - - HRESULT ( STDMETHODCALLTYPE *GetThread )( + + HRESULT ( STDMETHODCALLTYPE *GetThread )( ICorDebugChain * This, /* [out] */ ICorDebugThread **ppThread); - - HRESULT ( STDMETHODCALLTYPE *GetStackRange )( + + HRESULT ( STDMETHODCALLTYPE *GetStackRange )( ICorDebugChain * This, /* [out] */ CORDB_ADDRESS *pStart, /* [out] */ CORDB_ADDRESS *pEnd); - - HRESULT ( STDMETHODCALLTYPE *GetContext )( + + HRESULT ( STDMETHODCALLTYPE *GetContext )( ICorDebugChain * This, /* [out] */ ICorDebugContext **ppContext); - - HRESULT ( STDMETHODCALLTYPE *GetCaller )( + + HRESULT ( STDMETHODCALLTYPE *GetCaller )( ICorDebugChain * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *GetCallee )( + + HRESULT ( STDMETHODCALLTYPE *GetCallee )( ICorDebugChain * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *GetPrevious )( + + HRESULT ( STDMETHODCALLTYPE *GetPrevious )( ICorDebugChain * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *GetNext )( + + HRESULT ( STDMETHODCALLTYPE *GetNext )( ICorDebugChain * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *IsManaged )( + + HRESULT ( STDMETHODCALLTYPE *IsManaged )( ICorDebugChain * This, /* [out] */ BOOL *pManaged); - - HRESULT ( STDMETHODCALLTYPE *EnumerateFrames )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateFrames )( ICorDebugChain * This, /* [out] */ ICorDebugFrameEnum **ppFrames); - - HRESULT ( STDMETHODCALLTYPE *GetActiveFrame )( + + HRESULT ( STDMETHODCALLTYPE *GetActiveFrame )( ICorDebugChain * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *GetRegisterSet )( + + HRESULT ( STDMETHODCALLTYPE *GetRegisterSet )( ICorDebugChain * This, /* [out] */ ICorDebugRegisterSet **ppRegisters); - - HRESULT ( STDMETHODCALLTYPE *GetReason )( + + HRESULT ( STDMETHODCALLTYPE *GetReason )( ICorDebugChain * This, /* [out] */ CorDebugChainReason *pReason); - + END_INTERFACE } ICorDebugChainVtbl; @@ -10265,56 +10356,56 @@ EXTERN_C const IID IID_ICorDebugChain; CONST_VTBL struct ICorDebugChainVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugChain_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugChain_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugChain_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugChain_GetThread(This,ppThread) \ - ( (This)->lpVtbl -> GetThread(This,ppThread) ) + ( (This)->lpVtbl -> GetThread(This,ppThread) ) #define ICorDebugChain_GetStackRange(This,pStart,pEnd) \ - ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) + ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) #define ICorDebugChain_GetContext(This,ppContext) \ - ( (This)->lpVtbl -> GetContext(This,ppContext) ) + ( (This)->lpVtbl -> GetContext(This,ppContext) ) #define ICorDebugChain_GetCaller(This,ppChain) \ - ( (This)->lpVtbl -> GetCaller(This,ppChain) ) + ( (This)->lpVtbl -> GetCaller(This,ppChain) ) #define ICorDebugChain_GetCallee(This,ppChain) \ - ( (This)->lpVtbl -> GetCallee(This,ppChain) ) + ( (This)->lpVtbl -> GetCallee(This,ppChain) ) #define ICorDebugChain_GetPrevious(This,ppChain) \ - ( (This)->lpVtbl -> GetPrevious(This,ppChain) ) + ( (This)->lpVtbl -> GetPrevious(This,ppChain) ) #define ICorDebugChain_GetNext(This,ppChain) \ - ( (This)->lpVtbl -> GetNext(This,ppChain) ) + ( (This)->lpVtbl -> GetNext(This,ppChain) ) #define ICorDebugChain_IsManaged(This,pManaged) \ - ( (This)->lpVtbl -> IsManaged(This,pManaged) ) + ( (This)->lpVtbl -> IsManaged(This,pManaged) ) #define ICorDebugChain_EnumerateFrames(This,ppFrames) \ - ( (This)->lpVtbl -> EnumerateFrames(This,ppFrames) ) + ( (This)->lpVtbl -> EnumerateFrames(This,ppFrames) ) #define ICorDebugChain_GetActiveFrame(This,ppFrame) \ - ( (This)->lpVtbl -> GetActiveFrame(This,ppFrame) ) + ( (This)->lpVtbl -> GetActiveFrame(This,ppFrame) ) #define ICorDebugChain_GetRegisterSet(This,ppRegisters) \ - ( (This)->lpVtbl -> GetRegisterSet(This,ppRegisters) ) + ( (This)->lpVtbl -> GetRegisterSet(This,ppRegisters) ) #define ICorDebugChain_GetReason(This,pReason) \ - ( (This)->lpVtbl -> GetReason(This,pReason) ) + ( (This)->lpVtbl -> GetReason(This,pReason) ) #endif /* COBJMACROS */ @@ -10331,96 +10422,96 @@ EXTERN_C const IID IID_ICorDebugChain; #define __ICorDebugFrame_INTERFACE_DEFINED__ /* interface ICorDebugFrame */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugFrame; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAEF-8A68-11d2-983C-0000F808342D") ICorDebugFrame : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetChain( + virtual HRESULT STDMETHODCALLTYPE GetChain( /* [out] */ ICorDebugChain **ppChain) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCode( + + virtual HRESULT STDMETHODCALLTYPE GetCode( /* [out] */ ICorDebugCode **ppCode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFunction( + + virtual HRESULT STDMETHODCALLTYPE GetFunction( /* [out] */ ICorDebugFunction **ppFunction) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFunctionToken( + + virtual HRESULT STDMETHODCALLTYPE GetFunctionToken( /* [out] */ mdMethodDef *pToken) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStackRange( + + virtual HRESULT STDMETHODCALLTYPE GetStackRange( /* [out] */ CORDB_ADDRESS *pStart, /* [out] */ CORDB_ADDRESS *pEnd) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCaller( + + virtual HRESULT STDMETHODCALLTYPE GetCaller( /* [out] */ ICorDebugFrame **ppFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCallee( + + virtual HRESULT STDMETHODCALLTYPE GetCallee( /* [out] */ ICorDebugFrame **ppFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateStepper( + + virtual HRESULT STDMETHODCALLTYPE CreateStepper( /* [out] */ ICorDebugStepper **ppStepper) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugFrameVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugFrame * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugFrame * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugFrame * This); - - HRESULT ( STDMETHODCALLTYPE *GetChain )( + + HRESULT ( STDMETHODCALLTYPE *GetChain )( ICorDebugFrame * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *GetCode )( + + HRESULT ( STDMETHODCALLTYPE *GetCode )( ICorDebugFrame * This, /* [out] */ ICorDebugCode **ppCode); - - HRESULT ( STDMETHODCALLTYPE *GetFunction )( + + HRESULT ( STDMETHODCALLTYPE *GetFunction )( ICorDebugFrame * This, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( + + HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( ICorDebugFrame * This, /* [out] */ mdMethodDef *pToken); - - HRESULT ( STDMETHODCALLTYPE *GetStackRange )( + + HRESULT ( STDMETHODCALLTYPE *GetStackRange )( ICorDebugFrame * This, /* [out] */ CORDB_ADDRESS *pStart, /* [out] */ CORDB_ADDRESS *pEnd); - - HRESULT ( STDMETHODCALLTYPE *GetCaller )( + + HRESULT ( STDMETHODCALLTYPE *GetCaller )( ICorDebugFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *GetCallee )( + + HRESULT ( STDMETHODCALLTYPE *GetCallee )( ICorDebugFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *CreateStepper )( + + HRESULT ( STDMETHODCALLTYPE *CreateStepper )( ICorDebugFrame * This, /* [out] */ ICorDebugStepper **ppStepper); - + END_INTERFACE } ICorDebugFrameVtbl; @@ -10429,44 +10520,44 @@ EXTERN_C const IID IID_ICorDebugFrame; CONST_VTBL struct ICorDebugFrameVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugFrame_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugFrame_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugFrame_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugFrame_GetChain(This,ppChain) \ - ( (This)->lpVtbl -> GetChain(This,ppChain) ) + ( (This)->lpVtbl -> GetChain(This,ppChain) ) #define ICorDebugFrame_GetCode(This,ppCode) \ - ( (This)->lpVtbl -> GetCode(This,ppCode) ) + ( (This)->lpVtbl -> GetCode(This,ppCode) ) #define ICorDebugFrame_GetFunction(This,ppFunction) \ - ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) + ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) #define ICorDebugFrame_GetFunctionToken(This,pToken) \ - ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) + ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) #define ICorDebugFrame_GetStackRange(This,pStart,pEnd) \ - ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) + ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) #define ICorDebugFrame_GetCaller(This,ppFrame) \ - ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) + ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) #define ICorDebugFrame_GetCallee(This,ppFrame) \ - ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) + ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) #define ICorDebugFrame_CreateStepper(This,ppStepper) \ - ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) + ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) #endif /* COBJMACROS */ @@ -10483,9 +10574,9 @@ EXTERN_C const IID IID_ICorDebugFrame; #define __ICorDebugInternalFrame_INTERFACE_DEFINED__ /* interface ICorDebugInternalFrame */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugInternalFrameType { STUBFRAME_NONE = 0, @@ -10505,72 +10596,72 @@ enum CorDebugInternalFrameType EXTERN_C const IID IID_ICorDebugInternalFrame; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("B92CC7F7-9D2D-45c4-BC2B-621FCC9DFBF4") ICorDebugInternalFrame : public ICorDebugFrame { public: - virtual HRESULT STDMETHODCALLTYPE GetFrameType( + virtual HRESULT STDMETHODCALLTYPE GetFrameType( /* [out] */ CorDebugInternalFrameType *pType) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugInternalFrameVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugInternalFrame * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugInternalFrame * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugInternalFrame * This); - - HRESULT ( STDMETHODCALLTYPE *GetChain )( + + HRESULT ( STDMETHODCALLTYPE *GetChain )( ICorDebugInternalFrame * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *GetCode )( + + HRESULT ( STDMETHODCALLTYPE *GetCode )( ICorDebugInternalFrame * This, /* [out] */ ICorDebugCode **ppCode); - - HRESULT ( STDMETHODCALLTYPE *GetFunction )( + + HRESULT ( STDMETHODCALLTYPE *GetFunction )( ICorDebugInternalFrame * This, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( + + HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( ICorDebugInternalFrame * This, /* [out] */ mdMethodDef *pToken); - - HRESULT ( STDMETHODCALLTYPE *GetStackRange )( + + HRESULT ( STDMETHODCALLTYPE *GetStackRange )( ICorDebugInternalFrame * This, /* [out] */ CORDB_ADDRESS *pStart, /* [out] */ CORDB_ADDRESS *pEnd); - - HRESULT ( STDMETHODCALLTYPE *GetCaller )( + + HRESULT ( STDMETHODCALLTYPE *GetCaller )( ICorDebugInternalFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *GetCallee )( + + HRESULT ( STDMETHODCALLTYPE *GetCallee )( ICorDebugInternalFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *CreateStepper )( + + HRESULT ( STDMETHODCALLTYPE *CreateStepper )( ICorDebugInternalFrame * This, /* [out] */ ICorDebugStepper **ppStepper); - - HRESULT ( STDMETHODCALLTYPE *GetFrameType )( + + HRESULT ( STDMETHODCALLTYPE *GetFrameType )( ICorDebugInternalFrame * This, /* [out] */ CorDebugInternalFrameType *pType); - + END_INTERFACE } ICorDebugInternalFrameVtbl; @@ -10579,48 +10670,48 @@ EXTERN_C const IID IID_ICorDebugInternalFrame; CONST_VTBL struct ICorDebugInternalFrameVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugInternalFrame_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugInternalFrame_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugInternalFrame_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugInternalFrame_GetChain(This,ppChain) \ - ( (This)->lpVtbl -> GetChain(This,ppChain) ) + ( (This)->lpVtbl -> GetChain(This,ppChain) ) #define ICorDebugInternalFrame_GetCode(This,ppCode) \ - ( (This)->lpVtbl -> GetCode(This,ppCode) ) + ( (This)->lpVtbl -> GetCode(This,ppCode) ) #define ICorDebugInternalFrame_GetFunction(This,ppFunction) \ - ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) + ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) #define ICorDebugInternalFrame_GetFunctionToken(This,pToken) \ - ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) + ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) #define ICorDebugInternalFrame_GetStackRange(This,pStart,pEnd) \ - ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) + ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) #define ICorDebugInternalFrame_GetCaller(This,ppFrame) \ - ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) + ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) #define ICorDebugInternalFrame_GetCallee(This,ppFrame) \ - ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) + ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) #define ICorDebugInternalFrame_CreateStepper(This,ppStepper) \ - ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) + ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) #define ICorDebugInternalFrame_GetFrameType(This,pType) \ - ( (This)->lpVtbl -> GetFrameType(This,pType) ) + ( (This)->lpVtbl -> GetFrameType(This,pType) ) #endif /* COBJMACROS */ @@ -10637,54 +10728,54 @@ EXTERN_C const IID IID_ICorDebugInternalFrame; #define __ICorDebugInternalFrame2_INTERFACE_DEFINED__ /* interface ICorDebugInternalFrame2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugInternalFrame2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("C0815BDC-CFAB-447e-A779-C116B454EB5B") ICorDebugInternalFrame2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetAddress( + virtual HRESULT STDMETHODCALLTYPE GetAddress( /* [out] */ CORDB_ADDRESS *pAddress) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsCloserToLeaf( + + virtual HRESULT STDMETHODCALLTYPE IsCloserToLeaf( /* [in] */ ICorDebugFrame *pFrameToCompare, /* [out] */ BOOL *pIsCloser) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugInternalFrame2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugInternalFrame2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugInternalFrame2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugInternalFrame2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugInternalFrame2 * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *IsCloserToLeaf )( + + HRESULT ( STDMETHODCALLTYPE *IsCloserToLeaf )( ICorDebugInternalFrame2 * This, /* [in] */ ICorDebugFrame *pFrameToCompare, /* [out] */ BOOL *pIsCloser); - + END_INTERFACE } ICorDebugInternalFrame2Vtbl; @@ -10693,26 +10784,26 @@ EXTERN_C const IID IID_ICorDebugInternalFrame2; CONST_VTBL struct ICorDebugInternalFrame2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugInternalFrame2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugInternalFrame2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugInternalFrame2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugInternalFrame2_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugInternalFrame2_IsCloserToLeaf(This,pFrameToCompare,pIsCloser) \ - ( (This)->lpVtbl -> IsCloserToLeaf(This,pFrameToCompare,pIsCloser) ) + ( (This)->lpVtbl -> IsCloserToLeaf(This,pFrameToCompare,pIsCloser) ) #endif /* COBJMACROS */ @@ -10729,9 +10820,9 @@ EXTERN_C const IID IID_ICorDebugInternalFrame2; #define __ICorDebugILFrame_INTERFACE_DEFINED__ /* interface ICorDebugILFrame */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugMappingResult { MAPPING_PROLOG = 0x1, @@ -10746,136 +10837,136 @@ enum CorDebugMappingResult EXTERN_C const IID IID_ICorDebugILFrame; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("03E26311-4F76-11d3-88C6-006097945418") ICorDebugILFrame : public ICorDebugFrame { public: - virtual HRESULT STDMETHODCALLTYPE GetIP( + virtual HRESULT STDMETHODCALLTYPE GetIP( /* [out] */ ULONG32 *pnOffset, /* [out] */ CorDebugMappingResult *pMappingResult) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetIP( + + virtual HRESULT STDMETHODCALLTYPE SetIP( /* [in] */ ULONG32 nOffset) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateLocalVariables( + + virtual HRESULT STDMETHODCALLTYPE EnumerateLocalVariables( /* [out] */ ICorDebugValueEnum **ppValueEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocalVariable( + + virtual HRESULT STDMETHODCALLTYPE GetLocalVariable( /* [in] */ DWORD dwIndex, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateArguments( + + virtual HRESULT STDMETHODCALLTYPE EnumerateArguments( /* [out] */ ICorDebugValueEnum **ppValueEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetArgument( + + virtual HRESULT STDMETHODCALLTYPE GetArgument( /* [in] */ DWORD dwIndex, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStackDepth( + + virtual HRESULT STDMETHODCALLTYPE GetStackDepth( /* [out] */ ULONG32 *pDepth) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStackValue( + + virtual HRESULT STDMETHODCALLTYPE GetStackValue( /* [in] */ DWORD dwIndex, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE CanSetIP( + + virtual HRESULT STDMETHODCALLTYPE CanSetIP( /* [in] */ ULONG32 nOffset) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugILFrameVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugILFrame * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugILFrame * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugILFrame * This); - - HRESULT ( STDMETHODCALLTYPE *GetChain )( + + HRESULT ( STDMETHODCALLTYPE *GetChain )( ICorDebugILFrame * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *GetCode )( + + HRESULT ( STDMETHODCALLTYPE *GetCode )( ICorDebugILFrame * This, /* [out] */ ICorDebugCode **ppCode); - - HRESULT ( STDMETHODCALLTYPE *GetFunction )( + + HRESULT ( STDMETHODCALLTYPE *GetFunction )( ICorDebugILFrame * This, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( + + HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( ICorDebugILFrame * This, /* [out] */ mdMethodDef *pToken); - - HRESULT ( STDMETHODCALLTYPE *GetStackRange )( + + HRESULT ( STDMETHODCALLTYPE *GetStackRange )( ICorDebugILFrame * This, /* [out] */ CORDB_ADDRESS *pStart, /* [out] */ CORDB_ADDRESS *pEnd); - - HRESULT ( STDMETHODCALLTYPE *GetCaller )( + + HRESULT ( STDMETHODCALLTYPE *GetCaller )( ICorDebugILFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *GetCallee )( + + HRESULT ( STDMETHODCALLTYPE *GetCallee )( ICorDebugILFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *CreateStepper )( + + HRESULT ( STDMETHODCALLTYPE *CreateStepper )( ICorDebugILFrame * This, /* [out] */ ICorDebugStepper **ppStepper); - - HRESULT ( STDMETHODCALLTYPE *GetIP )( + + HRESULT ( STDMETHODCALLTYPE *GetIP )( ICorDebugILFrame * This, /* [out] */ ULONG32 *pnOffset, /* [out] */ CorDebugMappingResult *pMappingResult); - - HRESULT ( STDMETHODCALLTYPE *SetIP )( + + HRESULT ( STDMETHODCALLTYPE *SetIP )( ICorDebugILFrame * This, /* [in] */ ULONG32 nOffset); - - HRESULT ( STDMETHODCALLTYPE *EnumerateLocalVariables )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateLocalVariables )( ICorDebugILFrame * This, /* [out] */ ICorDebugValueEnum **ppValueEnum); - - HRESULT ( STDMETHODCALLTYPE *GetLocalVariable )( + + HRESULT ( STDMETHODCALLTYPE *GetLocalVariable )( ICorDebugILFrame * This, /* [in] */ DWORD dwIndex, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *EnumerateArguments )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateArguments )( ICorDebugILFrame * This, /* [out] */ ICorDebugValueEnum **ppValueEnum); - - HRESULT ( STDMETHODCALLTYPE *GetArgument )( + + HRESULT ( STDMETHODCALLTYPE *GetArgument )( ICorDebugILFrame * This, /* [in] */ DWORD dwIndex, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetStackDepth )( + + HRESULT ( STDMETHODCALLTYPE *GetStackDepth )( ICorDebugILFrame * This, /* [out] */ ULONG32 *pDepth); - - HRESULT ( STDMETHODCALLTYPE *GetStackValue )( + + HRESULT ( STDMETHODCALLTYPE *GetStackValue )( ICorDebugILFrame * This, /* [in] */ DWORD dwIndex, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *CanSetIP )( + + HRESULT ( STDMETHODCALLTYPE *CanSetIP )( ICorDebugILFrame * This, /* [in] */ ULONG32 nOffset); - + END_INTERFACE } ICorDebugILFrameVtbl; @@ -10884,72 +10975,72 @@ EXTERN_C const IID IID_ICorDebugILFrame; CONST_VTBL struct ICorDebugILFrameVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugILFrame_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugILFrame_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugILFrame_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugILFrame_GetChain(This,ppChain) \ - ( (This)->lpVtbl -> GetChain(This,ppChain) ) + ( (This)->lpVtbl -> GetChain(This,ppChain) ) #define ICorDebugILFrame_GetCode(This,ppCode) \ - ( (This)->lpVtbl -> GetCode(This,ppCode) ) + ( (This)->lpVtbl -> GetCode(This,ppCode) ) #define ICorDebugILFrame_GetFunction(This,ppFunction) \ - ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) + ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) #define ICorDebugILFrame_GetFunctionToken(This,pToken) \ - ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) + ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) #define ICorDebugILFrame_GetStackRange(This,pStart,pEnd) \ - ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) + ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) #define ICorDebugILFrame_GetCaller(This,ppFrame) \ - ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) + ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) #define ICorDebugILFrame_GetCallee(This,ppFrame) \ - ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) + ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) #define ICorDebugILFrame_CreateStepper(This,ppStepper) \ - ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) + ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) #define ICorDebugILFrame_GetIP(This,pnOffset,pMappingResult) \ - ( (This)->lpVtbl -> GetIP(This,pnOffset,pMappingResult) ) + ( (This)->lpVtbl -> GetIP(This,pnOffset,pMappingResult) ) #define ICorDebugILFrame_SetIP(This,nOffset) \ - ( (This)->lpVtbl -> SetIP(This,nOffset) ) + ( (This)->lpVtbl -> SetIP(This,nOffset) ) #define ICorDebugILFrame_EnumerateLocalVariables(This,ppValueEnum) \ - ( (This)->lpVtbl -> EnumerateLocalVariables(This,ppValueEnum) ) + ( (This)->lpVtbl -> EnumerateLocalVariables(This,ppValueEnum) ) #define ICorDebugILFrame_GetLocalVariable(This,dwIndex,ppValue) \ - ( (This)->lpVtbl -> GetLocalVariable(This,dwIndex,ppValue) ) + ( (This)->lpVtbl -> GetLocalVariable(This,dwIndex,ppValue) ) #define ICorDebugILFrame_EnumerateArguments(This,ppValueEnum) \ - ( (This)->lpVtbl -> EnumerateArguments(This,ppValueEnum) ) + ( (This)->lpVtbl -> EnumerateArguments(This,ppValueEnum) ) #define ICorDebugILFrame_GetArgument(This,dwIndex,ppValue) \ - ( (This)->lpVtbl -> GetArgument(This,dwIndex,ppValue) ) + ( (This)->lpVtbl -> GetArgument(This,dwIndex,ppValue) ) #define ICorDebugILFrame_GetStackDepth(This,pDepth) \ - ( (This)->lpVtbl -> GetStackDepth(This,pDepth) ) + ( (This)->lpVtbl -> GetStackDepth(This,pDepth) ) #define ICorDebugILFrame_GetStackValue(This,dwIndex,ppValue) \ - ( (This)->lpVtbl -> GetStackValue(This,dwIndex,ppValue) ) + ( (This)->lpVtbl -> GetStackValue(This,dwIndex,ppValue) ) #define ICorDebugILFrame_CanSetIP(This,nOffset) \ - ( (This)->lpVtbl -> CanSetIP(This,nOffset) ) + ( (This)->lpVtbl -> CanSetIP(This,nOffset) ) #endif /* COBJMACROS */ @@ -10966,52 +11057,52 @@ EXTERN_C const IID IID_ICorDebugILFrame; #define __ICorDebugILFrame2_INTERFACE_DEFINED__ /* interface ICorDebugILFrame2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugILFrame2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("5D88A994-6C30-479b-890F-BCEF88B129A5") ICorDebugILFrame2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE RemapFunction( + virtual HRESULT STDMETHODCALLTYPE RemapFunction( /* [in] */ ULONG32 newILOffset) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateTypeParameters( + + virtual HRESULT STDMETHODCALLTYPE EnumerateTypeParameters( /* [out] */ ICorDebugTypeEnum **ppTyParEnum) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugILFrame2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugILFrame2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugILFrame2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugILFrame2 * This); - - HRESULT ( STDMETHODCALLTYPE *RemapFunction )( + + HRESULT ( STDMETHODCALLTYPE *RemapFunction )( ICorDebugILFrame2 * This, /* [in] */ ULONG32 newILOffset); - - HRESULT ( STDMETHODCALLTYPE *EnumerateTypeParameters )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateTypeParameters )( ICorDebugILFrame2 * This, /* [out] */ ICorDebugTypeEnum **ppTyParEnum); - + END_INTERFACE } ICorDebugILFrame2Vtbl; @@ -11020,26 +11111,26 @@ EXTERN_C const IID IID_ICorDebugILFrame2; CONST_VTBL struct ICorDebugILFrame2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugILFrame2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugILFrame2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugILFrame2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugILFrame2_RemapFunction(This,newILOffset) \ - ( (This)->lpVtbl -> RemapFunction(This,newILOffset) ) + ( (This)->lpVtbl -> RemapFunction(This,newILOffset) ) #define ICorDebugILFrame2_EnumerateTypeParameters(This,ppTyParEnum) \ - ( (This)->lpVtbl -> EnumerateTypeParameters(This,ppTyParEnum) ) + ( (This)->lpVtbl -> EnumerateTypeParameters(This,ppTyParEnum) ) #endif /* COBJMACROS */ @@ -11056,47 +11147,47 @@ EXTERN_C const IID IID_ICorDebugILFrame2; #define __ICorDebugILFrame3_INTERFACE_DEFINED__ /* interface ICorDebugILFrame3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugILFrame3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("9A9E2ED6-04DF-4FE0-BB50-CAB64126AD24") ICorDebugILFrame3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetReturnValueForILOffset( + virtual HRESULT STDMETHODCALLTYPE GetReturnValueForILOffset( ULONG32 ILoffset, /* [out] */ ICorDebugValue **ppReturnValue) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugILFrame3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugILFrame3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugILFrame3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugILFrame3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetReturnValueForILOffset )( + + HRESULT ( STDMETHODCALLTYPE *GetReturnValueForILOffset )( ICorDebugILFrame3 * This, ULONG32 ILoffset, /* [out] */ ICorDebugValue **ppReturnValue); - + END_INTERFACE } ICorDebugILFrame3Vtbl; @@ -11105,23 +11196,23 @@ EXTERN_C const IID IID_ICorDebugILFrame3; CONST_VTBL struct ICorDebugILFrame3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugILFrame3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugILFrame3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugILFrame3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugILFrame3_GetReturnValueForILOffset(This,ILoffset,ppReturnValue) \ - ( (This)->lpVtbl -> GetReturnValueForILOffset(This,ILoffset,ppReturnValue) ) + ( (This)->lpVtbl -> GetReturnValueForILOffset(This,ILoffset,ppReturnValue) ) #endif /* COBJMACROS */ @@ -11134,10 +11225,10 @@ EXTERN_C const IID IID_ICorDebugILFrame3; #endif /* __ICorDebugILFrame3_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_cordebug_0000_0069 */ -/* [local] */ +/* interface __MIDL_itf_cordebug_0000_0070 */ +/* [local] */ -typedef +typedef enum ILCodeKind { ILCODE_ORIGINAL_IL = 0x1, @@ -11146,74 +11237,74 @@ enum ILCodeKind -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0069_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0069_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0070_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0070_v0_0_s_ifspec; #ifndef __ICorDebugILFrame4_INTERFACE_DEFINED__ #define __ICorDebugILFrame4_INTERFACE_DEFINED__ /* interface ICorDebugILFrame4 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugILFrame4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("AD914A30-C6D1-4AC5-9C5E-577F3BAA8A45") ICorDebugILFrame4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE EnumerateLocalVariablesEx( + virtual HRESULT STDMETHODCALLTYPE EnumerateLocalVariablesEx( /* [in] */ ILCodeKind flags, /* [out] */ ICorDebugValueEnum **ppValueEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocalVariableEx( + + virtual HRESULT STDMETHODCALLTYPE GetLocalVariableEx( /* [in] */ ILCodeKind flags, /* [in] */ DWORD dwIndex, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCodeEx( + + virtual HRESULT STDMETHODCALLTYPE GetCodeEx( /* [in] */ ILCodeKind flags, /* [out] */ ICorDebugCode **ppCode) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugILFrame4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugILFrame4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugILFrame4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugILFrame4 * This); - - HRESULT ( STDMETHODCALLTYPE *EnumerateLocalVariablesEx )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateLocalVariablesEx )( ICorDebugILFrame4 * This, /* [in] */ ILCodeKind flags, /* [out] */ ICorDebugValueEnum **ppValueEnum); - - HRESULT ( STDMETHODCALLTYPE *GetLocalVariableEx )( + + HRESULT ( STDMETHODCALLTYPE *GetLocalVariableEx )( ICorDebugILFrame4 * This, /* [in] */ ILCodeKind flags, /* [in] */ DWORD dwIndex, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetCodeEx )( + + HRESULT ( STDMETHODCALLTYPE *GetCodeEx )( ICorDebugILFrame4 * This, /* [in] */ ILCodeKind flags, /* [out] */ ICorDebugCode **ppCode); - + END_INTERFACE } ICorDebugILFrame4Vtbl; @@ -11222,29 +11313,29 @@ EXTERN_C const IID IID_ICorDebugILFrame4; CONST_VTBL struct ICorDebugILFrame4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugILFrame4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugILFrame4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugILFrame4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugILFrame4_EnumerateLocalVariablesEx(This,flags,ppValueEnum) \ - ( (This)->lpVtbl -> EnumerateLocalVariablesEx(This,flags,ppValueEnum) ) + ( (This)->lpVtbl -> EnumerateLocalVariablesEx(This,flags,ppValueEnum) ) #define ICorDebugILFrame4_GetLocalVariableEx(This,flags,dwIndex,ppValue) \ - ( (This)->lpVtbl -> GetLocalVariableEx(This,flags,dwIndex,ppValue) ) + ( (This)->lpVtbl -> GetLocalVariableEx(This,flags,dwIndex,ppValue) ) #define ICorDebugILFrame4_GetCodeEx(This,flags,ppCode) \ - ( (This)->lpVtbl -> GetCodeEx(This,flags,ppCode) ) + ( (This)->lpVtbl -> GetCodeEx(This,flags,ppCode) ) #endif /* COBJMACROS */ @@ -11261,170 +11352,170 @@ EXTERN_C const IID IID_ICorDebugILFrame4; #define __ICorDebugNativeFrame_INTERFACE_DEFINED__ /* interface ICorDebugNativeFrame */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugNativeFrame; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("03E26314-4F76-11d3-88C6-006097945418") ICorDebugNativeFrame : public ICorDebugFrame { public: - virtual HRESULT STDMETHODCALLTYPE GetIP( + virtual HRESULT STDMETHODCALLTYPE GetIP( /* [out] */ ULONG32 *pnOffset) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetIP( + + virtual HRESULT STDMETHODCALLTYPE SetIP( /* [in] */ ULONG32 nOffset) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRegisterSet( + + virtual HRESULT STDMETHODCALLTYPE GetRegisterSet( /* [out] */ ICorDebugRegisterSet **ppRegisters) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocalRegisterValue( + + virtual HRESULT STDMETHODCALLTYPE GetLocalRegisterValue( /* [in] */ CorDebugRegister reg, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocalDoubleRegisterValue( + + virtual HRESULT STDMETHODCALLTYPE GetLocalDoubleRegisterValue( /* [in] */ CorDebugRegister highWordReg, /* [in] */ CorDebugRegister lowWordReg, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocalMemoryValue( + + virtual HRESULT STDMETHODCALLTYPE GetLocalMemoryValue( /* [in] */ CORDB_ADDRESS address, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocalRegisterMemoryValue( + + virtual HRESULT STDMETHODCALLTYPE GetLocalRegisterMemoryValue( /* [in] */ CorDebugRegister highWordReg, /* [in] */ CORDB_ADDRESS lowWordAddress, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocalMemoryRegisterValue( + + virtual HRESULT STDMETHODCALLTYPE GetLocalMemoryRegisterValue( /* [in] */ CORDB_ADDRESS highWordAddress, /* [in] */ CorDebugRegister lowWordRegister, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE CanSetIP( + + virtual HRESULT STDMETHODCALLTYPE CanSetIP( /* [in] */ ULONG32 nOffset) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugNativeFrameVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugNativeFrame * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugNativeFrame * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugNativeFrame * This); - - HRESULT ( STDMETHODCALLTYPE *GetChain )( + + HRESULT ( STDMETHODCALLTYPE *GetChain )( ICorDebugNativeFrame * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *GetCode )( + + HRESULT ( STDMETHODCALLTYPE *GetCode )( ICorDebugNativeFrame * This, /* [out] */ ICorDebugCode **ppCode); - - HRESULT ( STDMETHODCALLTYPE *GetFunction )( + + HRESULT ( STDMETHODCALLTYPE *GetFunction )( ICorDebugNativeFrame * This, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( + + HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( ICorDebugNativeFrame * This, /* [out] */ mdMethodDef *pToken); - - HRESULT ( STDMETHODCALLTYPE *GetStackRange )( + + HRESULT ( STDMETHODCALLTYPE *GetStackRange )( ICorDebugNativeFrame * This, /* [out] */ CORDB_ADDRESS *pStart, /* [out] */ CORDB_ADDRESS *pEnd); - - HRESULT ( STDMETHODCALLTYPE *GetCaller )( + + HRESULT ( STDMETHODCALLTYPE *GetCaller )( ICorDebugNativeFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *GetCallee )( + + HRESULT ( STDMETHODCALLTYPE *GetCallee )( ICorDebugNativeFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *CreateStepper )( + + HRESULT ( STDMETHODCALLTYPE *CreateStepper )( ICorDebugNativeFrame * This, /* [out] */ ICorDebugStepper **ppStepper); - - HRESULT ( STDMETHODCALLTYPE *GetIP )( + + HRESULT ( STDMETHODCALLTYPE *GetIP )( ICorDebugNativeFrame * This, /* [out] */ ULONG32 *pnOffset); - - HRESULT ( STDMETHODCALLTYPE *SetIP )( + + HRESULT ( STDMETHODCALLTYPE *SetIP )( ICorDebugNativeFrame * This, /* [in] */ ULONG32 nOffset); - - HRESULT ( STDMETHODCALLTYPE *GetRegisterSet )( + + HRESULT ( STDMETHODCALLTYPE *GetRegisterSet )( ICorDebugNativeFrame * This, /* [out] */ ICorDebugRegisterSet **ppRegisters); - - HRESULT ( STDMETHODCALLTYPE *GetLocalRegisterValue )( + + HRESULT ( STDMETHODCALLTYPE *GetLocalRegisterValue )( ICorDebugNativeFrame * This, /* [in] */ CorDebugRegister reg, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetLocalDoubleRegisterValue )( + + HRESULT ( STDMETHODCALLTYPE *GetLocalDoubleRegisterValue )( ICorDebugNativeFrame * This, /* [in] */ CorDebugRegister highWordReg, /* [in] */ CorDebugRegister lowWordReg, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetLocalMemoryValue )( + + HRESULT ( STDMETHODCALLTYPE *GetLocalMemoryValue )( ICorDebugNativeFrame * This, /* [in] */ CORDB_ADDRESS address, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetLocalRegisterMemoryValue )( + + HRESULT ( STDMETHODCALLTYPE *GetLocalRegisterMemoryValue )( ICorDebugNativeFrame * This, /* [in] */ CorDebugRegister highWordReg, /* [in] */ CORDB_ADDRESS lowWordAddress, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetLocalMemoryRegisterValue )( + + HRESULT ( STDMETHODCALLTYPE *GetLocalMemoryRegisterValue )( ICorDebugNativeFrame * This, /* [in] */ CORDB_ADDRESS highWordAddress, /* [in] */ CorDebugRegister lowWordRegister, /* [in] */ ULONG cbSigBlob, /* [in] */ PCCOR_SIGNATURE pvSigBlob, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *CanSetIP )( + + HRESULT ( STDMETHODCALLTYPE *CanSetIP )( ICorDebugNativeFrame * This, /* [in] */ ULONG32 nOffset); - + END_INTERFACE } ICorDebugNativeFrameVtbl; @@ -11433,72 +11524,72 @@ EXTERN_C const IID IID_ICorDebugNativeFrame; CONST_VTBL struct ICorDebugNativeFrameVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugNativeFrame_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugNativeFrame_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugNativeFrame_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugNativeFrame_GetChain(This,ppChain) \ - ( (This)->lpVtbl -> GetChain(This,ppChain) ) + ( (This)->lpVtbl -> GetChain(This,ppChain) ) #define ICorDebugNativeFrame_GetCode(This,ppCode) \ - ( (This)->lpVtbl -> GetCode(This,ppCode) ) + ( (This)->lpVtbl -> GetCode(This,ppCode) ) #define ICorDebugNativeFrame_GetFunction(This,ppFunction) \ - ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) + ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) #define ICorDebugNativeFrame_GetFunctionToken(This,pToken) \ - ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) + ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) #define ICorDebugNativeFrame_GetStackRange(This,pStart,pEnd) \ - ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) + ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) #define ICorDebugNativeFrame_GetCaller(This,ppFrame) \ - ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) + ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) #define ICorDebugNativeFrame_GetCallee(This,ppFrame) \ - ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) + ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) #define ICorDebugNativeFrame_CreateStepper(This,ppStepper) \ - ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) + ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) #define ICorDebugNativeFrame_GetIP(This,pnOffset) \ - ( (This)->lpVtbl -> GetIP(This,pnOffset) ) + ( (This)->lpVtbl -> GetIP(This,pnOffset) ) #define ICorDebugNativeFrame_SetIP(This,nOffset) \ - ( (This)->lpVtbl -> SetIP(This,nOffset) ) + ( (This)->lpVtbl -> SetIP(This,nOffset) ) #define ICorDebugNativeFrame_GetRegisterSet(This,ppRegisters) \ - ( (This)->lpVtbl -> GetRegisterSet(This,ppRegisters) ) + ( (This)->lpVtbl -> GetRegisterSet(This,ppRegisters) ) #define ICorDebugNativeFrame_GetLocalRegisterValue(This,reg,cbSigBlob,pvSigBlob,ppValue) \ - ( (This)->lpVtbl -> GetLocalRegisterValue(This,reg,cbSigBlob,pvSigBlob,ppValue) ) + ( (This)->lpVtbl -> GetLocalRegisterValue(This,reg,cbSigBlob,pvSigBlob,ppValue) ) #define ICorDebugNativeFrame_GetLocalDoubleRegisterValue(This,highWordReg,lowWordReg,cbSigBlob,pvSigBlob,ppValue) \ - ( (This)->lpVtbl -> GetLocalDoubleRegisterValue(This,highWordReg,lowWordReg,cbSigBlob,pvSigBlob,ppValue) ) + ( (This)->lpVtbl -> GetLocalDoubleRegisterValue(This,highWordReg,lowWordReg,cbSigBlob,pvSigBlob,ppValue) ) #define ICorDebugNativeFrame_GetLocalMemoryValue(This,address,cbSigBlob,pvSigBlob,ppValue) \ - ( (This)->lpVtbl -> GetLocalMemoryValue(This,address,cbSigBlob,pvSigBlob,ppValue) ) + ( (This)->lpVtbl -> GetLocalMemoryValue(This,address,cbSigBlob,pvSigBlob,ppValue) ) #define ICorDebugNativeFrame_GetLocalRegisterMemoryValue(This,highWordReg,lowWordAddress,cbSigBlob,pvSigBlob,ppValue) \ - ( (This)->lpVtbl -> GetLocalRegisterMemoryValue(This,highWordReg,lowWordAddress,cbSigBlob,pvSigBlob,ppValue) ) + ( (This)->lpVtbl -> GetLocalRegisterMemoryValue(This,highWordReg,lowWordAddress,cbSigBlob,pvSigBlob,ppValue) ) #define ICorDebugNativeFrame_GetLocalMemoryRegisterValue(This,highWordAddress,lowWordRegister,cbSigBlob,pvSigBlob,ppValue) \ - ( (This)->lpVtbl -> GetLocalMemoryRegisterValue(This,highWordAddress,lowWordRegister,cbSigBlob,pvSigBlob,ppValue) ) + ( (This)->lpVtbl -> GetLocalMemoryRegisterValue(This,highWordAddress,lowWordRegister,cbSigBlob,pvSigBlob,ppValue) ) #define ICorDebugNativeFrame_CanSetIP(This,nOffset) \ - ( (This)->lpVtbl -> CanSetIP(This,nOffset) ) + ( (This)->lpVtbl -> CanSetIP(This,nOffset) ) #endif /* COBJMACROS */ @@ -11511,75 +11602,75 @@ EXTERN_C const IID IID_ICorDebugNativeFrame; #endif /* __ICorDebugNativeFrame_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_cordebug_0000_0071 */ -/* [local] */ +/* interface __MIDL_itf_cordebug_0000_0072 */ +/* [local] */ #pragma warning(push) -#pragma warning(disable:28718) +#pragma warning(disable:28718) -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0071_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0071_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0072_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0072_v0_0_s_ifspec; #ifndef __ICorDebugNativeFrame2_INTERFACE_DEFINED__ #define __ICorDebugNativeFrame2_INTERFACE_DEFINED__ /* interface ICorDebugNativeFrame2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugNativeFrame2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("35389FF1-3684-4c55-A2EE-210F26C60E5E") ICorDebugNativeFrame2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE IsChild( + virtual HRESULT STDMETHODCALLTYPE IsChild( /* [out] */ BOOL *pIsChild) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsMatchingParentFrame( + + virtual HRESULT STDMETHODCALLTYPE IsMatchingParentFrame( /* [in] */ ICorDebugNativeFrame2 *pPotentialParentFrame, /* [out] */ BOOL *pIsParent) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStackParameterSize( + + virtual HRESULT STDMETHODCALLTYPE GetStackParameterSize( /* [out] */ ULONG32 *pSize) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugNativeFrame2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugNativeFrame2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugNativeFrame2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugNativeFrame2 * This); - - HRESULT ( STDMETHODCALLTYPE *IsChild )( + + HRESULT ( STDMETHODCALLTYPE *IsChild )( ICorDebugNativeFrame2 * This, /* [out] */ BOOL *pIsChild); - - HRESULT ( STDMETHODCALLTYPE *IsMatchingParentFrame )( + + HRESULT ( STDMETHODCALLTYPE *IsMatchingParentFrame )( ICorDebugNativeFrame2 * This, /* [in] */ ICorDebugNativeFrame2 *pPotentialParentFrame, /* [out] */ BOOL *pIsParent); - - HRESULT ( STDMETHODCALLTYPE *GetStackParameterSize )( + + HRESULT ( STDMETHODCALLTYPE *GetStackParameterSize )( ICorDebugNativeFrame2 * This, /* [out] */ ULONG32 *pSize); - + END_INTERFACE } ICorDebugNativeFrame2Vtbl; @@ -11588,29 +11679,29 @@ EXTERN_C const IID IID_ICorDebugNativeFrame2; CONST_VTBL struct ICorDebugNativeFrame2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugNativeFrame2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugNativeFrame2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugNativeFrame2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugNativeFrame2_IsChild(This,pIsChild) \ - ( (This)->lpVtbl -> IsChild(This,pIsChild) ) + ( (This)->lpVtbl -> IsChild(This,pIsChild) ) #define ICorDebugNativeFrame2_IsMatchingParentFrame(This,pPotentialParentFrame,pIsParent) \ - ( (This)->lpVtbl -> IsMatchingParentFrame(This,pPotentialParentFrame,pIsParent) ) + ( (This)->lpVtbl -> IsMatchingParentFrame(This,pPotentialParentFrame,pIsParent) ) #define ICorDebugNativeFrame2_GetStackParameterSize(This,pSize) \ - ( (This)->lpVtbl -> GetStackParameterSize(This,pSize) ) + ( (This)->lpVtbl -> GetStackParameterSize(This,pSize) ) #endif /* COBJMACROS */ @@ -11627,47 +11718,47 @@ EXTERN_C const IID IID_ICorDebugNativeFrame2; #define __ICorDebugModule3_INTERFACE_DEFINED__ /* interface ICorDebugModule3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugModule3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("86F012BF-FF15-4372-BD30-B6F11CAAE1DD") ICorDebugModule3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CreateReaderForInMemorySymbols( + virtual HRESULT STDMETHODCALLTYPE CreateReaderForInMemorySymbols( /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppObj) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugModule3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugModule3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugModule3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugModule3 * This); - - HRESULT ( STDMETHODCALLTYPE *CreateReaderForInMemorySymbols )( + + HRESULT ( STDMETHODCALLTYPE *CreateReaderForInMemorySymbols )( ICorDebugModule3 * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppObj); - + END_INTERFACE } ICorDebugModule3Vtbl; @@ -11676,23 +11767,23 @@ EXTERN_C const IID IID_ICorDebugModule3; CONST_VTBL struct ICorDebugModule3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugModule3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugModule3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugModule3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugModule3_CreateReaderForInMemorySymbols(This,riid,ppObj) \ - ( (This)->lpVtbl -> CreateReaderForInMemorySymbols(This,riid,ppObj) ) + ( (This)->lpVtbl -> CreateReaderForInMemorySymbols(This,riid,ppObj) ) #endif /* COBJMACROS */ @@ -11709,45 +11800,45 @@ EXTERN_C const IID IID_ICorDebugModule3; #define __ICorDebugModule4_INTERFACE_DEFINED__ /* interface ICorDebugModule4 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugModule4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("FF8B8EAF-25CD-4316-8859-84416DE4402E") ICorDebugModule4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE IsMappedLayout( + virtual HRESULT STDMETHODCALLTYPE IsMappedLayout( /* [out] */ BOOL *pIsMapped) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugModule4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugModule4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugModule4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugModule4 * This); - - HRESULT ( STDMETHODCALLTYPE *IsMappedLayout )( + + HRESULT ( STDMETHODCALLTYPE *IsMappedLayout )( ICorDebugModule4 * This, /* [out] */ BOOL *pIsMapped); - + END_INTERFACE } ICorDebugModule4Vtbl; @@ -11756,23 +11847,23 @@ EXTERN_C const IID IID_ICorDebugModule4; CONST_VTBL struct ICorDebugModule4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugModule4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugModule4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugModule4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugModule4_IsMappedLayout(This,pIsMapped) \ - ( (This)->lpVtbl -> IsMappedLayout(This,pIsMapped) ) + ( (This)->lpVtbl -> IsMappedLayout(This,pIsMapped) ) #endif /* COBJMACROS */ @@ -11789,71 +11880,71 @@ EXTERN_C const IID IID_ICorDebugModule4; #define __ICorDebugRuntimeUnwindableFrame_INTERFACE_DEFINED__ /* interface ICorDebugRuntimeUnwindableFrame */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugRuntimeUnwindableFrame; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("879CAC0A-4A53-4668-B8E3-CB8473CB187F") ICorDebugRuntimeUnwindableFrame : public ICorDebugFrame { public: }; - - + + #else /* C style interface */ typedef struct ICorDebugRuntimeUnwindableFrameVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugRuntimeUnwindableFrame * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugRuntimeUnwindableFrame * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugRuntimeUnwindableFrame * This); - - HRESULT ( STDMETHODCALLTYPE *GetChain )( + + HRESULT ( STDMETHODCALLTYPE *GetChain )( ICorDebugRuntimeUnwindableFrame * This, /* [out] */ ICorDebugChain **ppChain); - - HRESULT ( STDMETHODCALLTYPE *GetCode )( + + HRESULT ( STDMETHODCALLTYPE *GetCode )( ICorDebugRuntimeUnwindableFrame * This, /* [out] */ ICorDebugCode **ppCode); - - HRESULT ( STDMETHODCALLTYPE *GetFunction )( + + HRESULT ( STDMETHODCALLTYPE *GetFunction )( ICorDebugRuntimeUnwindableFrame * This, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( + + HRESULT ( STDMETHODCALLTYPE *GetFunctionToken )( ICorDebugRuntimeUnwindableFrame * This, /* [out] */ mdMethodDef *pToken); - - HRESULT ( STDMETHODCALLTYPE *GetStackRange )( + + HRESULT ( STDMETHODCALLTYPE *GetStackRange )( ICorDebugRuntimeUnwindableFrame * This, /* [out] */ CORDB_ADDRESS *pStart, /* [out] */ CORDB_ADDRESS *pEnd); - - HRESULT ( STDMETHODCALLTYPE *GetCaller )( + + HRESULT ( STDMETHODCALLTYPE *GetCaller )( ICorDebugRuntimeUnwindableFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *GetCallee )( + + HRESULT ( STDMETHODCALLTYPE *GetCallee )( ICorDebugRuntimeUnwindableFrame * This, /* [out] */ ICorDebugFrame **ppFrame); - - HRESULT ( STDMETHODCALLTYPE *CreateStepper )( + + HRESULT ( STDMETHODCALLTYPE *CreateStepper )( ICorDebugRuntimeUnwindableFrame * This, /* [out] */ ICorDebugStepper **ppStepper); - + END_INTERFACE } ICorDebugRuntimeUnwindableFrameVtbl; @@ -11862,44 +11953,44 @@ EXTERN_C const IID IID_ICorDebugRuntimeUnwindableFrame; CONST_VTBL struct ICorDebugRuntimeUnwindableFrameVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugRuntimeUnwindableFrame_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugRuntimeUnwindableFrame_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugRuntimeUnwindableFrame_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugRuntimeUnwindableFrame_GetChain(This,ppChain) \ - ( (This)->lpVtbl -> GetChain(This,ppChain) ) + ( (This)->lpVtbl -> GetChain(This,ppChain) ) #define ICorDebugRuntimeUnwindableFrame_GetCode(This,ppCode) \ - ( (This)->lpVtbl -> GetCode(This,ppCode) ) + ( (This)->lpVtbl -> GetCode(This,ppCode) ) #define ICorDebugRuntimeUnwindableFrame_GetFunction(This,ppFunction) \ - ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) + ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) #define ICorDebugRuntimeUnwindableFrame_GetFunctionToken(This,pToken) \ - ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) + ( (This)->lpVtbl -> GetFunctionToken(This,pToken) ) #define ICorDebugRuntimeUnwindableFrame_GetStackRange(This,pStart,pEnd) \ - ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) + ( (This)->lpVtbl -> GetStackRange(This,pStart,pEnd) ) #define ICorDebugRuntimeUnwindableFrame_GetCaller(This,ppFrame) \ - ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) + ( (This)->lpVtbl -> GetCaller(This,ppFrame) ) #define ICorDebugRuntimeUnwindableFrame_GetCallee(This,ppFrame) \ - ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) + ( (This)->lpVtbl -> GetCallee(This,ppFrame) ) #define ICorDebugRuntimeUnwindableFrame_CreateStepper(This,ppStepper) \ - ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) + ( (This)->lpVtbl -> CreateStepper(This,ppStepper) ) #endif /* COBJMACROS */ @@ -11917,173 +12008,173 @@ EXTERN_C const IID IID_ICorDebugRuntimeUnwindableFrame; #define __ICorDebugModule_INTERFACE_DEFINED__ /* interface ICorDebugModule */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugModule; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("dba2d8c1-e5c5-4069-8c13-10a7c6abf43d") ICorDebugModule : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetProcess( + virtual HRESULT STDMETHODCALLTYPE GetProcess( /* [out] */ ICorDebugProcess **ppProcess) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBaseAddress( + + virtual HRESULT STDMETHODCALLTYPE GetBaseAddress( /* [out] */ CORDB_ADDRESS *pAddress) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssembly( + + virtual HRESULT STDMETHODCALLTYPE GetAssembly( /* [out] */ ICorDebugAssembly **ppAssembly) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetName( + + virtual HRESULT STDMETHODCALLTYPE GetName( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableJITDebugging( + + virtual HRESULT STDMETHODCALLTYPE EnableJITDebugging( /* [in] */ BOOL bTrackJITInfo, /* [in] */ BOOL bAllowJitOpts) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableClassLoadCallbacks( + + virtual HRESULT STDMETHODCALLTYPE EnableClassLoadCallbacks( /* [in] */ BOOL bClassLoadCallbacks) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFunctionFromToken( + + virtual HRESULT STDMETHODCALLTYPE GetFunctionFromToken( /* [in] */ mdMethodDef methodDef, /* [out] */ ICorDebugFunction **ppFunction) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFunctionFromRVA( + + virtual HRESULT STDMETHODCALLTYPE GetFunctionFromRVA( /* [in] */ CORDB_ADDRESS rva, /* [out] */ ICorDebugFunction **ppFunction) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetClassFromToken( + + virtual HRESULT STDMETHODCALLTYPE GetClassFromToken( /* [in] */ mdTypeDef typeDef, /* [out] */ ICorDebugClass **ppClass) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateBreakpoint( + + virtual HRESULT STDMETHODCALLTYPE CreateBreakpoint( /* [out] */ ICorDebugModuleBreakpoint **ppBreakpoint) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetEditAndContinueSnapshot( + + virtual HRESULT STDMETHODCALLTYPE GetEditAndContinueSnapshot( /* [out] */ ICorDebugEditAndContinueSnapshot **ppEditAndContinueSnapshot) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMetaDataInterface( + + virtual HRESULT STDMETHODCALLTYPE GetMetaDataInterface( /* [in] */ REFIID riid, /* [out] */ IUnknown **ppObj) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetToken( + + virtual HRESULT STDMETHODCALLTYPE GetToken( /* [out] */ mdModule *pToken) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsDynamic( + + virtual HRESULT STDMETHODCALLTYPE IsDynamic( /* [out] */ BOOL *pDynamic) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGlobalVariableValue( + + virtual HRESULT STDMETHODCALLTYPE GetGlobalVariableValue( /* [in] */ mdFieldDef fieldDef, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSize( + + virtual HRESULT STDMETHODCALLTYPE GetSize( /* [out] */ ULONG32 *pcBytes) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsInMemory( + + virtual HRESULT STDMETHODCALLTYPE IsInMemory( /* [out] */ BOOL *pInMemory) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugModuleVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugModule * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugModule * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugModule * This); - - HRESULT ( STDMETHODCALLTYPE *GetProcess )( + + HRESULT ( STDMETHODCALLTYPE *GetProcess )( ICorDebugModule * This, /* [out] */ ICorDebugProcess **ppProcess); - - HRESULT ( STDMETHODCALLTYPE *GetBaseAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetBaseAddress )( ICorDebugModule * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *GetAssembly )( + + HRESULT ( STDMETHODCALLTYPE *GetAssembly )( ICorDebugModule * This, /* [out] */ ICorDebugAssembly **ppAssembly); - - HRESULT ( STDMETHODCALLTYPE *GetName )( + + HRESULT ( STDMETHODCALLTYPE *GetName )( ICorDebugModule * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *EnableJITDebugging )( + + HRESULT ( STDMETHODCALLTYPE *EnableJITDebugging )( ICorDebugModule * This, /* [in] */ BOOL bTrackJITInfo, /* [in] */ BOOL bAllowJitOpts); - - HRESULT ( STDMETHODCALLTYPE *EnableClassLoadCallbacks )( + + HRESULT ( STDMETHODCALLTYPE *EnableClassLoadCallbacks )( ICorDebugModule * This, /* [in] */ BOOL bClassLoadCallbacks); - - HRESULT ( STDMETHODCALLTYPE *GetFunctionFromToken )( + + HRESULT ( STDMETHODCALLTYPE *GetFunctionFromToken )( ICorDebugModule * This, /* [in] */ mdMethodDef methodDef, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetFunctionFromRVA )( + + HRESULT ( STDMETHODCALLTYPE *GetFunctionFromRVA )( ICorDebugModule * This, /* [in] */ CORDB_ADDRESS rva, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetClassFromToken )( + + HRESULT ( STDMETHODCALLTYPE *GetClassFromToken )( ICorDebugModule * This, /* [in] */ mdTypeDef typeDef, /* [out] */ ICorDebugClass **ppClass); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugModule * This, /* [out] */ ICorDebugModuleBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *GetEditAndContinueSnapshot )( + + HRESULT ( STDMETHODCALLTYPE *GetEditAndContinueSnapshot )( ICorDebugModule * This, /* [out] */ ICorDebugEditAndContinueSnapshot **ppEditAndContinueSnapshot); - - HRESULT ( STDMETHODCALLTYPE *GetMetaDataInterface )( + + HRESULT ( STDMETHODCALLTYPE *GetMetaDataInterface )( ICorDebugModule * This, /* [in] */ REFIID riid, /* [out] */ IUnknown **ppObj); - - HRESULT ( STDMETHODCALLTYPE *GetToken )( + + HRESULT ( STDMETHODCALLTYPE *GetToken )( ICorDebugModule * This, /* [out] */ mdModule *pToken); - - HRESULT ( STDMETHODCALLTYPE *IsDynamic )( + + HRESULT ( STDMETHODCALLTYPE *IsDynamic )( ICorDebugModule * This, /* [out] */ BOOL *pDynamic); - - HRESULT ( STDMETHODCALLTYPE *GetGlobalVariableValue )( + + HRESULT ( STDMETHODCALLTYPE *GetGlobalVariableValue )( ICorDebugModule * This, /* [in] */ mdFieldDef fieldDef, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugModule * This, /* [out] */ ULONG32 *pcBytes); - - HRESULT ( STDMETHODCALLTYPE *IsInMemory )( + + HRESULT ( STDMETHODCALLTYPE *IsInMemory )( ICorDebugModule * This, /* [out] */ BOOL *pInMemory); - + END_INTERFACE } ICorDebugModuleVtbl; @@ -12092,71 +12183,71 @@ EXTERN_C const IID IID_ICorDebugModule; CONST_VTBL struct ICorDebugModuleVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugModule_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugModule_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugModule_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugModule_GetProcess(This,ppProcess) \ - ( (This)->lpVtbl -> GetProcess(This,ppProcess) ) + ( (This)->lpVtbl -> GetProcess(This,ppProcess) ) #define ICorDebugModule_GetBaseAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetBaseAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetBaseAddress(This,pAddress) ) #define ICorDebugModule_GetAssembly(This,ppAssembly) \ - ( (This)->lpVtbl -> GetAssembly(This,ppAssembly) ) + ( (This)->lpVtbl -> GetAssembly(This,ppAssembly) ) #define ICorDebugModule_GetName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) #define ICorDebugModule_EnableJITDebugging(This,bTrackJITInfo,bAllowJitOpts) \ - ( (This)->lpVtbl -> EnableJITDebugging(This,bTrackJITInfo,bAllowJitOpts) ) + ( (This)->lpVtbl -> EnableJITDebugging(This,bTrackJITInfo,bAllowJitOpts) ) #define ICorDebugModule_EnableClassLoadCallbacks(This,bClassLoadCallbacks) \ - ( (This)->lpVtbl -> EnableClassLoadCallbacks(This,bClassLoadCallbacks) ) + ( (This)->lpVtbl -> EnableClassLoadCallbacks(This,bClassLoadCallbacks) ) #define ICorDebugModule_GetFunctionFromToken(This,methodDef,ppFunction) \ - ( (This)->lpVtbl -> GetFunctionFromToken(This,methodDef,ppFunction) ) + ( (This)->lpVtbl -> GetFunctionFromToken(This,methodDef,ppFunction) ) #define ICorDebugModule_GetFunctionFromRVA(This,rva,ppFunction) \ - ( (This)->lpVtbl -> GetFunctionFromRVA(This,rva,ppFunction) ) + ( (This)->lpVtbl -> GetFunctionFromRVA(This,rva,ppFunction) ) #define ICorDebugModule_GetClassFromToken(This,typeDef,ppClass) \ - ( (This)->lpVtbl -> GetClassFromToken(This,typeDef,ppClass) ) + ( (This)->lpVtbl -> GetClassFromToken(This,typeDef,ppClass) ) #define ICorDebugModule_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugModule_GetEditAndContinueSnapshot(This,ppEditAndContinueSnapshot) \ - ( (This)->lpVtbl -> GetEditAndContinueSnapshot(This,ppEditAndContinueSnapshot) ) + ( (This)->lpVtbl -> GetEditAndContinueSnapshot(This,ppEditAndContinueSnapshot) ) #define ICorDebugModule_GetMetaDataInterface(This,riid,ppObj) \ - ( (This)->lpVtbl -> GetMetaDataInterface(This,riid,ppObj) ) + ( (This)->lpVtbl -> GetMetaDataInterface(This,riid,ppObj) ) #define ICorDebugModule_GetToken(This,pToken) \ - ( (This)->lpVtbl -> GetToken(This,pToken) ) + ( (This)->lpVtbl -> GetToken(This,pToken) ) #define ICorDebugModule_IsDynamic(This,pDynamic) \ - ( (This)->lpVtbl -> IsDynamic(This,pDynamic) ) + ( (This)->lpVtbl -> IsDynamic(This,pDynamic) ) #define ICorDebugModule_GetGlobalVariableValue(This,fieldDef,ppValue) \ - ( (This)->lpVtbl -> GetGlobalVariableValue(This,fieldDef,ppValue) ) + ( (This)->lpVtbl -> GetGlobalVariableValue(This,fieldDef,ppValue) ) #define ICorDebugModule_GetSize(This,pcBytes) \ - ( (This)->lpVtbl -> GetSize(This,pcBytes) ) + ( (This)->lpVtbl -> GetSize(This,pcBytes) ) #define ICorDebugModule_IsInMemory(This,pInMemory) \ - ( (This)->lpVtbl -> IsInMemory(This,pInMemory) ) + ( (This)->lpVtbl -> IsInMemory(This,pInMemory) ) #endif /* COBJMACROS */ @@ -12169,98 +12260,98 @@ EXTERN_C const IID IID_ICorDebugModule; #endif /* __ICorDebugModule_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_cordebug_0000_0076 */ -/* [local] */ +/* interface __MIDL_itf_cordebug_0000_0077 */ +/* [local] */ #pragma warning(pop) -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0076_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0076_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0077_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0077_v0_0_s_ifspec; #ifndef __ICorDebugModule2_INTERFACE_DEFINED__ #define __ICorDebugModule2_INTERFACE_DEFINED__ /* interface ICorDebugModule2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugModule2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("7FCC5FB5-49C0-41de-9938-3B88B5B9ADD7") ICorDebugModule2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE SetJMCStatus( + virtual HRESULT STDMETHODCALLTYPE SetJMCStatus( /* [in] */ BOOL bIsJustMyCode, /* [in] */ ULONG32 cTokens, /* [size_is][in] */ mdToken pTokens[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE ApplyChanges( + + virtual HRESULT STDMETHODCALLTYPE ApplyChanges( /* [in] */ ULONG cbMetadata, /* [size_is][in] */ BYTE pbMetadata[ ], /* [in] */ ULONG cbIL, /* [size_is][in] */ BYTE pbIL[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetJITCompilerFlags( + + virtual HRESULT STDMETHODCALLTYPE SetJITCompilerFlags( /* [in] */ DWORD dwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetJITCompilerFlags( + + virtual HRESULT STDMETHODCALLTYPE GetJITCompilerFlags( /* [out] */ DWORD *pdwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE ResolveAssembly( + + virtual HRESULT STDMETHODCALLTYPE ResolveAssembly( /* [in] */ mdToken tkAssemblyRef, /* [out] */ ICorDebugAssembly **ppAssembly) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugModule2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugModule2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugModule2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugModule2 * This); - - HRESULT ( STDMETHODCALLTYPE *SetJMCStatus )( + + HRESULT ( STDMETHODCALLTYPE *SetJMCStatus )( ICorDebugModule2 * This, /* [in] */ BOOL bIsJustMyCode, /* [in] */ ULONG32 cTokens, /* [size_is][in] */ mdToken pTokens[ ]); - - HRESULT ( STDMETHODCALLTYPE *ApplyChanges )( + + HRESULT ( STDMETHODCALLTYPE *ApplyChanges )( ICorDebugModule2 * This, /* [in] */ ULONG cbMetadata, /* [size_is][in] */ BYTE pbMetadata[ ], /* [in] */ ULONG cbIL, /* [size_is][in] */ BYTE pbIL[ ]); - - HRESULT ( STDMETHODCALLTYPE *SetJITCompilerFlags )( + + HRESULT ( STDMETHODCALLTYPE *SetJITCompilerFlags )( ICorDebugModule2 * This, /* [in] */ DWORD dwFlags); - - HRESULT ( STDMETHODCALLTYPE *GetJITCompilerFlags )( + + HRESULT ( STDMETHODCALLTYPE *GetJITCompilerFlags )( ICorDebugModule2 * This, /* [out] */ DWORD *pdwFlags); - - HRESULT ( STDMETHODCALLTYPE *ResolveAssembly )( + + HRESULT ( STDMETHODCALLTYPE *ResolveAssembly )( ICorDebugModule2 * This, /* [in] */ mdToken tkAssemblyRef, /* [out] */ ICorDebugAssembly **ppAssembly); - + END_INTERFACE } ICorDebugModule2Vtbl; @@ -12269,35 +12360,35 @@ EXTERN_C const IID IID_ICorDebugModule2; CONST_VTBL struct ICorDebugModule2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugModule2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugModule2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugModule2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugModule2_SetJMCStatus(This,bIsJustMyCode,cTokens,pTokens) \ - ( (This)->lpVtbl -> SetJMCStatus(This,bIsJustMyCode,cTokens,pTokens) ) + ( (This)->lpVtbl -> SetJMCStatus(This,bIsJustMyCode,cTokens,pTokens) ) #define ICorDebugModule2_ApplyChanges(This,cbMetadata,pbMetadata,cbIL,pbIL) \ - ( (This)->lpVtbl -> ApplyChanges(This,cbMetadata,pbMetadata,cbIL,pbIL) ) + ( (This)->lpVtbl -> ApplyChanges(This,cbMetadata,pbMetadata,cbIL,pbIL) ) #define ICorDebugModule2_SetJITCompilerFlags(This,dwFlags) \ - ( (This)->lpVtbl -> SetJITCompilerFlags(This,dwFlags) ) + ( (This)->lpVtbl -> SetJITCompilerFlags(This,dwFlags) ) #define ICorDebugModule2_GetJITCompilerFlags(This,pdwFlags) \ - ( (This)->lpVtbl -> GetJITCompilerFlags(This,pdwFlags) ) + ( (This)->lpVtbl -> GetJITCompilerFlags(This,pdwFlags) ) #define ICorDebugModule2_ResolveAssembly(This,tkAssemblyRef,ppAssembly) \ - ( (This)->lpVtbl -> ResolveAssembly(This,tkAssemblyRef,ppAssembly) ) + ( (This)->lpVtbl -> ResolveAssembly(This,tkAssemblyRef,ppAssembly) ) #endif /* COBJMACROS */ @@ -12314,94 +12405,94 @@ EXTERN_C const IID IID_ICorDebugModule2; #define __ICorDebugFunction_INTERFACE_DEFINED__ /* interface ICorDebugFunction */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugFunction; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAF3-8A68-11d2-983C-0000F808342D") ICorDebugFunction : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetModule( + virtual HRESULT STDMETHODCALLTYPE GetModule( /* [out] */ ICorDebugModule **ppModule) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetClass( + + virtual HRESULT STDMETHODCALLTYPE GetClass( /* [out] */ ICorDebugClass **ppClass) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetToken( + + virtual HRESULT STDMETHODCALLTYPE GetToken( /* [out] */ mdMethodDef *pMethodDef) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetILCode( + + virtual HRESULT STDMETHODCALLTYPE GetILCode( /* [out] */ ICorDebugCode **ppCode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNativeCode( + + virtual HRESULT STDMETHODCALLTYPE GetNativeCode( /* [out] */ ICorDebugCode **ppCode) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateBreakpoint( + + virtual HRESULT STDMETHODCALLTYPE CreateBreakpoint( /* [out] */ ICorDebugFunctionBreakpoint **ppBreakpoint) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocalVarSigToken( + + virtual HRESULT STDMETHODCALLTYPE GetLocalVarSigToken( /* [out] */ mdSignature *pmdSig) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentVersionNumber( + + virtual HRESULT STDMETHODCALLTYPE GetCurrentVersionNumber( /* [out] */ ULONG32 *pnCurrentVersion) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugFunctionVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugFunction * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugFunction * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugFunction * This); - - HRESULT ( STDMETHODCALLTYPE *GetModule )( + + HRESULT ( STDMETHODCALLTYPE *GetModule )( ICorDebugFunction * This, /* [out] */ ICorDebugModule **ppModule); - - HRESULT ( STDMETHODCALLTYPE *GetClass )( + + HRESULT ( STDMETHODCALLTYPE *GetClass )( ICorDebugFunction * This, /* [out] */ ICorDebugClass **ppClass); - - HRESULT ( STDMETHODCALLTYPE *GetToken )( + + HRESULT ( STDMETHODCALLTYPE *GetToken )( ICorDebugFunction * This, /* [out] */ mdMethodDef *pMethodDef); - - HRESULT ( STDMETHODCALLTYPE *GetILCode )( + + HRESULT ( STDMETHODCALLTYPE *GetILCode )( ICorDebugFunction * This, /* [out] */ ICorDebugCode **ppCode); - - HRESULT ( STDMETHODCALLTYPE *GetNativeCode )( + + HRESULT ( STDMETHODCALLTYPE *GetNativeCode )( ICorDebugFunction * This, /* [out] */ ICorDebugCode **ppCode); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugFunction * This, /* [out] */ ICorDebugFunctionBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *GetLocalVarSigToken )( + + HRESULT ( STDMETHODCALLTYPE *GetLocalVarSigToken )( ICorDebugFunction * This, /* [out] */ mdSignature *pmdSig); - - HRESULT ( STDMETHODCALLTYPE *GetCurrentVersionNumber )( + + HRESULT ( STDMETHODCALLTYPE *GetCurrentVersionNumber )( ICorDebugFunction * This, /* [out] */ ULONG32 *pnCurrentVersion); - + END_INTERFACE } ICorDebugFunctionVtbl; @@ -12410,44 +12501,44 @@ EXTERN_C const IID IID_ICorDebugFunction; CONST_VTBL struct ICorDebugFunctionVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugFunction_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugFunction_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugFunction_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugFunction_GetModule(This,ppModule) \ - ( (This)->lpVtbl -> GetModule(This,ppModule) ) + ( (This)->lpVtbl -> GetModule(This,ppModule) ) #define ICorDebugFunction_GetClass(This,ppClass) \ - ( (This)->lpVtbl -> GetClass(This,ppClass) ) + ( (This)->lpVtbl -> GetClass(This,ppClass) ) #define ICorDebugFunction_GetToken(This,pMethodDef) \ - ( (This)->lpVtbl -> GetToken(This,pMethodDef) ) + ( (This)->lpVtbl -> GetToken(This,pMethodDef) ) #define ICorDebugFunction_GetILCode(This,ppCode) \ - ( (This)->lpVtbl -> GetILCode(This,ppCode) ) + ( (This)->lpVtbl -> GetILCode(This,ppCode) ) #define ICorDebugFunction_GetNativeCode(This,ppCode) \ - ( (This)->lpVtbl -> GetNativeCode(This,ppCode) ) + ( (This)->lpVtbl -> GetNativeCode(This,ppCode) ) #define ICorDebugFunction_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugFunction_GetLocalVarSigToken(This,pmdSig) \ - ( (This)->lpVtbl -> GetLocalVarSigToken(This,pmdSig) ) + ( (This)->lpVtbl -> GetLocalVarSigToken(This,pmdSig) ) #define ICorDebugFunction_GetCurrentVersionNumber(This,pnCurrentVersion) \ - ( (This)->lpVtbl -> GetCurrentVersionNumber(This,pnCurrentVersion) ) + ( (This)->lpVtbl -> GetCurrentVersionNumber(This,pnCurrentVersion) ) #endif /* COBJMACROS */ @@ -12464,66 +12555,66 @@ EXTERN_C const IID IID_ICorDebugFunction; #define __ICorDebugFunction2_INTERFACE_DEFINED__ /* interface ICorDebugFunction2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugFunction2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("EF0C490B-94C3-4e4d-B629-DDC134C532D8") ICorDebugFunction2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE SetJMCStatus( + virtual HRESULT STDMETHODCALLTYPE SetJMCStatus( /* [in] */ BOOL bIsJustMyCode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetJMCStatus( + + virtual HRESULT STDMETHODCALLTYPE GetJMCStatus( /* [out] */ BOOL *pbIsJustMyCode) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateNativeCode( + + virtual HRESULT STDMETHODCALLTYPE EnumerateNativeCode( /* [out] */ ICorDebugCodeEnum **ppCodeEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVersionNumber( + + virtual HRESULT STDMETHODCALLTYPE GetVersionNumber( /* [out] */ ULONG32 *pnVersion) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugFunction2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugFunction2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugFunction2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugFunction2 * This); - - HRESULT ( STDMETHODCALLTYPE *SetJMCStatus )( + + HRESULT ( STDMETHODCALLTYPE *SetJMCStatus )( ICorDebugFunction2 * This, /* [in] */ BOOL bIsJustMyCode); - - HRESULT ( STDMETHODCALLTYPE *GetJMCStatus )( + + HRESULT ( STDMETHODCALLTYPE *GetJMCStatus )( ICorDebugFunction2 * This, /* [out] */ BOOL *pbIsJustMyCode); - - HRESULT ( STDMETHODCALLTYPE *EnumerateNativeCode )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateNativeCode )( ICorDebugFunction2 * This, /* [out] */ ICorDebugCodeEnum **ppCodeEnum); - - HRESULT ( STDMETHODCALLTYPE *GetVersionNumber )( + + HRESULT ( STDMETHODCALLTYPE *GetVersionNumber )( ICorDebugFunction2 * This, /* [out] */ ULONG32 *pnVersion); - + END_INTERFACE } ICorDebugFunction2Vtbl; @@ -12532,32 +12623,32 @@ EXTERN_C const IID IID_ICorDebugFunction2; CONST_VTBL struct ICorDebugFunction2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugFunction2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugFunction2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugFunction2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugFunction2_SetJMCStatus(This,bIsJustMyCode) \ - ( (This)->lpVtbl -> SetJMCStatus(This,bIsJustMyCode) ) + ( (This)->lpVtbl -> SetJMCStatus(This,bIsJustMyCode) ) #define ICorDebugFunction2_GetJMCStatus(This,pbIsJustMyCode) \ - ( (This)->lpVtbl -> GetJMCStatus(This,pbIsJustMyCode) ) + ( (This)->lpVtbl -> GetJMCStatus(This,pbIsJustMyCode) ) #define ICorDebugFunction2_EnumerateNativeCode(This,ppCodeEnum) \ - ( (This)->lpVtbl -> EnumerateNativeCode(This,ppCodeEnum) ) + ( (This)->lpVtbl -> EnumerateNativeCode(This,ppCodeEnum) ) #define ICorDebugFunction2_GetVersionNumber(This,pnVersion) \ - ( (This)->lpVtbl -> GetVersionNumber(This,pnVersion) ) + ( (This)->lpVtbl -> GetVersionNumber(This,pnVersion) ) #endif /* COBJMACROS */ @@ -12574,45 +12665,45 @@ EXTERN_C const IID IID_ICorDebugFunction2; #define __ICorDebugFunction3_INTERFACE_DEFINED__ /* interface ICorDebugFunction3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugFunction3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("09B70F28-E465-482D-99E0-81A165EB0532") ICorDebugFunction3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetActiveReJitRequestILCode( + virtual HRESULT STDMETHODCALLTYPE GetActiveReJitRequestILCode( ICorDebugILCode **ppReJitedILCode) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugFunction3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugFunction3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugFunction3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugFunction3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetActiveReJitRequestILCode )( + + HRESULT ( STDMETHODCALLTYPE *GetActiveReJitRequestILCode )( ICorDebugFunction3 * This, ICorDebugILCode **ppReJitedILCode); - + END_INTERFACE } ICorDebugFunction3Vtbl; @@ -12621,23 +12712,23 @@ EXTERN_C const IID IID_ICorDebugFunction3; CONST_VTBL struct ICorDebugFunction3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugFunction3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugFunction3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugFunction3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugFunction3_GetActiveReJitRequestILCode(This,ppReJitedILCode) \ - ( (This)->lpVtbl -> GetActiveReJitRequestILCode(This,ppReJitedILCode) ) + ( (This)->lpVtbl -> GetActiveReJitRequestILCode(This,ppReJitedILCode) ) #endif /* COBJMACROS */ @@ -12654,45 +12745,45 @@ EXTERN_C const IID IID_ICorDebugFunction3; #define __ICorDebugFunction4_INTERFACE_DEFINED__ /* interface ICorDebugFunction4 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugFunction4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("72965963-34fd-46e9-9434-b817fe6e7f43") ICorDebugFunction4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CreateNativeBreakpoint( + virtual HRESULT STDMETHODCALLTYPE CreateNativeBreakpoint( ICorDebugFunctionBreakpoint **ppBreakpoint) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugFunction4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugFunction4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugFunction4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugFunction4 * This); - - HRESULT ( STDMETHODCALLTYPE *CreateNativeBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateNativeBreakpoint )( ICorDebugFunction4 * This, ICorDebugFunctionBreakpoint **ppBreakpoint); - + END_INTERFACE } ICorDebugFunction4Vtbl; @@ -12701,23 +12792,23 @@ EXTERN_C const IID IID_ICorDebugFunction4; CONST_VTBL struct ICorDebugFunction4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugFunction4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugFunction4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugFunction4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugFunction4_CreateNativeBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateNativeBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateNativeBreakpoint(This,ppBreakpoint) ) #endif /* COBJMACROS */ @@ -12734,119 +12825,119 @@ EXTERN_C const IID IID_ICorDebugFunction4; #define __ICorDebugCode_INTERFACE_DEFINED__ /* interface ICorDebugCode */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugCode; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAF4-8A68-11d2-983C-0000F808342D") ICorDebugCode : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE IsIL( + virtual HRESULT STDMETHODCALLTYPE IsIL( /* [out] */ BOOL *pbIL) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFunction( + + virtual HRESULT STDMETHODCALLTYPE GetFunction( /* [out] */ ICorDebugFunction **ppFunction) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAddress( + + virtual HRESULT STDMETHODCALLTYPE GetAddress( /* [out] */ CORDB_ADDRESS *pStart) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSize( + + virtual HRESULT STDMETHODCALLTYPE GetSize( /* [out] */ ULONG32 *pcBytes) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateBreakpoint( + + virtual HRESULT STDMETHODCALLTYPE CreateBreakpoint( /* [in] */ ULONG32 offset, /* [out] */ ICorDebugFunctionBreakpoint **ppBreakpoint) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCode( + + virtual HRESULT STDMETHODCALLTYPE GetCode( /* [in] */ ULONG32 startOffset, /* [in] */ ULONG32 endOffset, /* [in] */ ULONG32 cBufferAlloc, /* [length_is][size_is][out] */ BYTE buffer[ ], /* [out] */ ULONG32 *pcBufferSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVersionNumber( + + virtual HRESULT STDMETHODCALLTYPE GetVersionNumber( /* [out] */ ULONG32 *nVersion) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetILToNativeMapping( + + virtual HRESULT STDMETHODCALLTYPE GetILToNativeMapping( /* [in] */ ULONG32 cMap, /* [out] */ ULONG32 *pcMap, /* [length_is][size_is][out] */ COR_DEBUG_IL_TO_NATIVE_MAP map[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetEnCRemapSequencePoints( + + virtual HRESULT STDMETHODCALLTYPE GetEnCRemapSequencePoints( /* [in] */ ULONG32 cMap, /* [out] */ ULONG32 *pcMap, /* [length_is][size_is][out] */ ULONG32 offsets[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugCodeVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugCode * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugCode * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugCode * This); - - HRESULT ( STDMETHODCALLTYPE *IsIL )( + + HRESULT ( STDMETHODCALLTYPE *IsIL )( ICorDebugCode * This, /* [out] */ BOOL *pbIL); - - HRESULT ( STDMETHODCALLTYPE *GetFunction )( + + HRESULT ( STDMETHODCALLTYPE *GetFunction )( ICorDebugCode * This, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugCode * This, /* [out] */ CORDB_ADDRESS *pStart); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugCode * This, /* [out] */ ULONG32 *pcBytes); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugCode * This, /* [in] */ ULONG32 offset, /* [out] */ ICorDebugFunctionBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *GetCode )( + + HRESULT ( STDMETHODCALLTYPE *GetCode )( ICorDebugCode * This, /* [in] */ ULONG32 startOffset, /* [in] */ ULONG32 endOffset, /* [in] */ ULONG32 cBufferAlloc, /* [length_is][size_is][out] */ BYTE buffer[ ], /* [out] */ ULONG32 *pcBufferSize); - - HRESULT ( STDMETHODCALLTYPE *GetVersionNumber )( + + HRESULT ( STDMETHODCALLTYPE *GetVersionNumber )( ICorDebugCode * This, /* [out] */ ULONG32 *nVersion); - - HRESULT ( STDMETHODCALLTYPE *GetILToNativeMapping )( + + HRESULT ( STDMETHODCALLTYPE *GetILToNativeMapping )( ICorDebugCode * This, /* [in] */ ULONG32 cMap, /* [out] */ ULONG32 *pcMap, /* [length_is][size_is][out] */ COR_DEBUG_IL_TO_NATIVE_MAP map[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetEnCRemapSequencePoints )( + + HRESULT ( STDMETHODCALLTYPE *GetEnCRemapSequencePoints )( ICorDebugCode * This, /* [in] */ ULONG32 cMap, /* [out] */ ULONG32 *pcMap, /* [length_is][size_is][out] */ ULONG32 offsets[ ]); - + END_INTERFACE } ICorDebugCodeVtbl; @@ -12855,47 +12946,47 @@ EXTERN_C const IID IID_ICorDebugCode; CONST_VTBL struct ICorDebugCodeVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugCode_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugCode_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugCode_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugCode_IsIL(This,pbIL) \ - ( (This)->lpVtbl -> IsIL(This,pbIL) ) + ( (This)->lpVtbl -> IsIL(This,pbIL) ) #define ICorDebugCode_GetFunction(This,ppFunction) \ - ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) + ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) #define ICorDebugCode_GetAddress(This,pStart) \ - ( (This)->lpVtbl -> GetAddress(This,pStart) ) + ( (This)->lpVtbl -> GetAddress(This,pStart) ) #define ICorDebugCode_GetSize(This,pcBytes) \ - ( (This)->lpVtbl -> GetSize(This,pcBytes) ) + ( (This)->lpVtbl -> GetSize(This,pcBytes) ) #define ICorDebugCode_CreateBreakpoint(This,offset,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,offset,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,offset,ppBreakpoint) ) #define ICorDebugCode_GetCode(This,startOffset,endOffset,cBufferAlloc,buffer,pcBufferSize) \ - ( (This)->lpVtbl -> GetCode(This,startOffset,endOffset,cBufferAlloc,buffer,pcBufferSize) ) + ( (This)->lpVtbl -> GetCode(This,startOffset,endOffset,cBufferAlloc,buffer,pcBufferSize) ) #define ICorDebugCode_GetVersionNumber(This,nVersion) \ - ( (This)->lpVtbl -> GetVersionNumber(This,nVersion) ) + ( (This)->lpVtbl -> GetVersionNumber(This,nVersion) ) #define ICorDebugCode_GetILToNativeMapping(This,cMap,pcMap,map) \ - ( (This)->lpVtbl -> GetILToNativeMapping(This,cMap,pcMap,map) ) + ( (This)->lpVtbl -> GetILToNativeMapping(This,cMap,pcMap,map) ) #define ICorDebugCode_GetEnCRemapSequencePoints(This,cMap,pcMap,offsets) \ - ( (This)->lpVtbl -> GetEnCRemapSequencePoints(This,cMap,pcMap,offsets) ) + ( (This)->lpVtbl -> GetEnCRemapSequencePoints(This,cMap,pcMap,offsets) ) #endif /* COBJMACROS */ @@ -12912,7 +13003,7 @@ EXTERN_C const IID IID_ICorDebugCode; #define __ICorDebugCode2_INTERFACE_DEFINED__ /* interface ICorDebugCode2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ typedef struct _CodeChunkInfo { @@ -12924,50 +13015,50 @@ typedef struct _CodeChunkInfo EXTERN_C const IID IID_ICorDebugCode2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("5F696509-452F-4436-A3FE-4D11FE7E2347") ICorDebugCode2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetCodeChunks( + virtual HRESULT STDMETHODCALLTYPE GetCodeChunks( /* [in] */ ULONG32 cbufSize, /* [out] */ ULONG32 *pcnumChunks, /* [length_is][size_is][out] */ CodeChunkInfo chunks[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCompilerFlags( + + virtual HRESULT STDMETHODCALLTYPE GetCompilerFlags( /* [out] */ DWORD *pdwFlags) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugCode2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugCode2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugCode2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugCode2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetCodeChunks )( + + HRESULT ( STDMETHODCALLTYPE *GetCodeChunks )( ICorDebugCode2 * This, /* [in] */ ULONG32 cbufSize, /* [out] */ ULONG32 *pcnumChunks, /* [length_is][size_is][out] */ CodeChunkInfo chunks[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetCompilerFlags )( + + HRESULT ( STDMETHODCALLTYPE *GetCompilerFlags )( ICorDebugCode2 * This, /* [out] */ DWORD *pdwFlags); - + END_INTERFACE } ICorDebugCode2Vtbl; @@ -12976,26 +13067,26 @@ EXTERN_C const IID IID_ICorDebugCode2; CONST_VTBL struct ICorDebugCode2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugCode2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugCode2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugCode2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugCode2_GetCodeChunks(This,cbufSize,pcnumChunks,chunks) \ - ( (This)->lpVtbl -> GetCodeChunks(This,cbufSize,pcnumChunks,chunks) ) + ( (This)->lpVtbl -> GetCodeChunks(This,cbufSize,pcnumChunks,chunks) ) #define ICorDebugCode2_GetCompilerFlags(This,pdwFlags) \ - ( (This)->lpVtbl -> GetCompilerFlags(This,pdwFlags) ) + ( (This)->lpVtbl -> GetCompilerFlags(This,pdwFlags) ) #endif /* COBJMACROS */ @@ -13012,51 +13103,51 @@ EXTERN_C const IID IID_ICorDebugCode2; #define __ICorDebugCode3_INTERFACE_DEFINED__ /* interface ICorDebugCode3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugCode3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("D13D3E88-E1F2-4020-AA1D-3D162DCBE966") ICorDebugCode3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetReturnValueLiveOffset( + virtual HRESULT STDMETHODCALLTYPE GetReturnValueLiveOffset( /* [in] */ ULONG32 ILoffset, /* [in] */ ULONG32 bufferSize, /* [out] */ ULONG32 *pFetched, /* [length_is][size_is][out] */ ULONG32 pOffsets[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugCode3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugCode3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugCode3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugCode3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetReturnValueLiveOffset )( + + HRESULT ( STDMETHODCALLTYPE *GetReturnValueLiveOffset )( ICorDebugCode3 * This, /* [in] */ ULONG32 ILoffset, /* [in] */ ULONG32 bufferSize, /* [out] */ ULONG32 *pFetched, /* [length_is][size_is][out] */ ULONG32 pOffsets[ ]); - + END_INTERFACE } ICorDebugCode3Vtbl; @@ -13065,23 +13156,23 @@ EXTERN_C const IID IID_ICorDebugCode3; CONST_VTBL struct ICorDebugCode3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugCode3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugCode3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugCode3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugCode3_GetReturnValueLiveOffset(This,ILoffset,bufferSize,pFetched,pOffsets) \ - ( (This)->lpVtbl -> GetReturnValueLiveOffset(This,ILoffset,bufferSize,pFetched,pOffsets) ) + ( (This)->lpVtbl -> GetReturnValueLiveOffset(This,ILoffset,bufferSize,pFetched,pOffsets) ) #endif /* COBJMACROS */ @@ -13098,45 +13189,45 @@ EXTERN_C const IID IID_ICorDebugCode3; #define __ICorDebugCode4_INTERFACE_DEFINED__ /* interface ICorDebugCode4 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugCode4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("18221fa4-20cb-40fa-b19d-9f91c4fa8c14") ICorDebugCode4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE EnumerateVariableHomes( + virtual HRESULT STDMETHODCALLTYPE EnumerateVariableHomes( /* [out] */ ICorDebugVariableHomeEnum **ppEnum) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugCode4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugCode4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugCode4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugCode4 * This); - - HRESULT ( STDMETHODCALLTYPE *EnumerateVariableHomes )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateVariableHomes )( ICorDebugCode4 * This, /* [out] */ ICorDebugVariableHomeEnum **ppEnum); - + END_INTERFACE } ICorDebugCode4Vtbl; @@ -13145,23 +13236,23 @@ EXTERN_C const IID IID_ICorDebugCode4; CONST_VTBL struct ICorDebugCode4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugCode4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugCode4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugCode4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugCode4_EnumerateVariableHomes(This,ppEnum) \ - ( (This)->lpVtbl -> EnumerateVariableHomes(This,ppEnum) ) + ( (This)->lpVtbl -> EnumerateVariableHomes(This,ppEnum) ) #endif /* COBJMACROS */ @@ -13178,7 +13269,7 @@ EXTERN_C const IID IID_ICorDebugCode4; #define __ICorDebugILCode_INTERFACE_DEFINED__ /* interface ICorDebugILCode */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ typedef struct _CorDebugEHClause { @@ -13195,43 +13286,43 @@ typedef struct _CorDebugEHClause EXTERN_C const IID IID_ICorDebugILCode; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("598D46C2-C877-42A7-89D2-3D0C7F1C1264") ICorDebugILCode : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetEHClauses( + virtual HRESULT STDMETHODCALLTYPE GetEHClauses( /* [in] */ ULONG32 cClauses, /* [out] */ ULONG32 *pcClauses, /* [length_is][size_is][out] */ CorDebugEHClause clauses[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugILCodeVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugILCode * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugILCode * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugILCode * This); - - HRESULT ( STDMETHODCALLTYPE *GetEHClauses )( + + HRESULT ( STDMETHODCALLTYPE *GetEHClauses )( ICorDebugILCode * This, /* [in] */ ULONG32 cClauses, /* [out] */ ULONG32 *pcClauses, /* [length_is][size_is][out] */ CorDebugEHClause clauses[ ]); - + END_INTERFACE } ICorDebugILCodeVtbl; @@ -13240,23 +13331,23 @@ EXTERN_C const IID IID_ICorDebugILCode; CONST_VTBL struct ICorDebugILCodeVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugILCode_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugILCode_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugILCode_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugILCode_GetEHClauses(This,cClauses,pcClauses,clauses) \ - ( (This)->lpVtbl -> GetEHClauses(This,cClauses,pcClauses,clauses) ) + ( (This)->lpVtbl -> GetEHClauses(This,cClauses,pcClauses,clauses) ) #endif /* COBJMACROS */ @@ -13273,56 +13364,56 @@ EXTERN_C const IID IID_ICorDebugILCode; #define __ICorDebugILCode2_INTERFACE_DEFINED__ /* interface ICorDebugILCode2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugILCode2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("46586093-D3F5-4DB6-ACDB-955BCE228C15") ICorDebugILCode2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetLocalVarSigToken( + virtual HRESULT STDMETHODCALLTYPE GetLocalVarSigToken( /* [out] */ mdSignature *pmdSig) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInstrumentedILMap( + + virtual HRESULT STDMETHODCALLTYPE GetInstrumentedILMap( /* [in] */ ULONG32 cMap, /* [out] */ ULONG32 *pcMap, /* [length_is][size_is][out] */ COR_IL_MAP map[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugILCode2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugILCode2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugILCode2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugILCode2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetLocalVarSigToken )( + + HRESULT ( STDMETHODCALLTYPE *GetLocalVarSigToken )( ICorDebugILCode2 * This, /* [out] */ mdSignature *pmdSig); - - HRESULT ( STDMETHODCALLTYPE *GetInstrumentedILMap )( + + HRESULT ( STDMETHODCALLTYPE *GetInstrumentedILMap )( ICorDebugILCode2 * This, /* [in] */ ULONG32 cMap, /* [out] */ ULONG32 *pcMap, /* [length_is][size_is][out] */ COR_IL_MAP map[ ]); - + END_INTERFACE } ICorDebugILCode2Vtbl; @@ -13331,26 +13422,26 @@ EXTERN_C const IID IID_ICorDebugILCode2; CONST_VTBL struct ICorDebugILCode2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugILCode2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugILCode2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugILCode2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugILCode2_GetLocalVarSigToken(This,pmdSig) \ - ( (This)->lpVtbl -> GetLocalVarSigToken(This,pmdSig) ) + ( (This)->lpVtbl -> GetLocalVarSigToken(This,pmdSig) ) #define ICorDebugILCode2_GetInstrumentedILMap(This,cMap,pcMap,map) \ - ( (This)->lpVtbl -> GetInstrumentedILMap(This,cMap,pcMap,map) ) + ( (This)->lpVtbl -> GetInstrumentedILMap(This,cMap,pcMap,map) ) #endif /* COBJMACROS */ @@ -13367,63 +13458,63 @@ EXTERN_C const IID IID_ICorDebugILCode2; #define __ICorDebugClass_INTERFACE_DEFINED__ /* interface ICorDebugClass */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugClass; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAF5-8A68-11d2-983C-0000F808342D") ICorDebugClass : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetModule( + virtual HRESULT STDMETHODCALLTYPE GetModule( /* [out] */ ICorDebugModule **pModule) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetToken( + + virtual HRESULT STDMETHODCALLTYPE GetToken( /* [out] */ mdTypeDef *pTypeDef) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStaticFieldValue( + + virtual HRESULT STDMETHODCALLTYPE GetStaticFieldValue( /* [in] */ mdFieldDef fieldDef, /* [in] */ ICorDebugFrame *pFrame, /* [out] */ ICorDebugValue **ppValue) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugClassVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugClass * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugClass * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugClass * This); - - HRESULT ( STDMETHODCALLTYPE *GetModule )( + + HRESULT ( STDMETHODCALLTYPE *GetModule )( ICorDebugClass * This, /* [out] */ ICorDebugModule **pModule); - - HRESULT ( STDMETHODCALLTYPE *GetToken )( + + HRESULT ( STDMETHODCALLTYPE *GetToken )( ICorDebugClass * This, /* [out] */ mdTypeDef *pTypeDef); - - HRESULT ( STDMETHODCALLTYPE *GetStaticFieldValue )( + + HRESULT ( STDMETHODCALLTYPE *GetStaticFieldValue )( ICorDebugClass * This, /* [in] */ mdFieldDef fieldDef, /* [in] */ ICorDebugFrame *pFrame, /* [out] */ ICorDebugValue **ppValue); - + END_INTERFACE } ICorDebugClassVtbl; @@ -13432,29 +13523,29 @@ EXTERN_C const IID IID_ICorDebugClass; CONST_VTBL struct ICorDebugClassVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugClass_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugClass_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugClass_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugClass_GetModule(This,pModule) \ - ( (This)->lpVtbl -> GetModule(This,pModule) ) + ( (This)->lpVtbl -> GetModule(This,pModule) ) #define ICorDebugClass_GetToken(This,pTypeDef) \ - ( (This)->lpVtbl -> GetToken(This,pTypeDef) ) + ( (This)->lpVtbl -> GetToken(This,pTypeDef) ) #define ICorDebugClass_GetStaticFieldValue(This,fieldDef,pFrame,ppValue) \ - ( (This)->lpVtbl -> GetStaticFieldValue(This,fieldDef,pFrame,ppValue) ) + ( (This)->lpVtbl -> GetStaticFieldValue(This,fieldDef,pFrame,ppValue) ) #endif /* COBJMACROS */ @@ -13471,58 +13562,58 @@ EXTERN_C const IID IID_ICorDebugClass; #define __ICorDebugClass2_INTERFACE_DEFINED__ /* interface ICorDebugClass2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugClass2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("B008EA8D-7AB1-43f7-BB20-FBB5A04038AE") ICorDebugClass2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetParameterizedType( + virtual HRESULT STDMETHODCALLTYPE GetParameterizedType( /* [in] */ CorElementType elementType, /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ], /* [out] */ ICorDebugType **ppType) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetJMCStatus( + + virtual HRESULT STDMETHODCALLTYPE SetJMCStatus( /* [in] */ BOOL bIsJustMyCode) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugClass2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugClass2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugClass2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugClass2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetParameterizedType )( + + HRESULT ( STDMETHODCALLTYPE *GetParameterizedType )( ICorDebugClass2 * This, /* [in] */ CorElementType elementType, /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ], /* [out] */ ICorDebugType **ppType); - - HRESULT ( STDMETHODCALLTYPE *SetJMCStatus )( + + HRESULT ( STDMETHODCALLTYPE *SetJMCStatus )( ICorDebugClass2 * This, /* [in] */ BOOL bIsJustMyCode); - + END_INTERFACE } ICorDebugClass2Vtbl; @@ -13531,26 +13622,26 @@ EXTERN_C const IID IID_ICorDebugClass2; CONST_VTBL struct ICorDebugClass2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugClass2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugClass2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugClass2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugClass2_GetParameterizedType(This,elementType,nTypeArgs,ppTypeArgs,ppType) \ - ( (This)->lpVtbl -> GetParameterizedType(This,elementType,nTypeArgs,ppTypeArgs,ppType) ) + ( (This)->lpVtbl -> GetParameterizedType(This,elementType,nTypeArgs,ppTypeArgs,ppType) ) #define ICorDebugClass2_SetJMCStatus(This,bIsJustMyCode) \ - ( (This)->lpVtbl -> SetJMCStatus(This,bIsJustMyCode) ) + ( (This)->lpVtbl -> SetJMCStatus(This,bIsJustMyCode) ) #endif /* COBJMACROS */ @@ -13567,126 +13658,126 @@ EXTERN_C const IID IID_ICorDebugClass2; #define __ICorDebugEval_INTERFACE_DEFINED__ /* interface ICorDebugEval */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugEval; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAF6-8A68-11d2-983C-0000F808342D") ICorDebugEval : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CallFunction( + virtual HRESULT STDMETHODCALLTYPE CallFunction( /* [in] */ ICorDebugFunction *pFunction, /* [in] */ ULONG32 nArgs, /* [size_is][in] */ ICorDebugValue *ppArgs[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE NewObject( + + virtual HRESULT STDMETHODCALLTYPE NewObject( /* [in] */ ICorDebugFunction *pConstructor, /* [in] */ ULONG32 nArgs, /* [size_is][in] */ ICorDebugValue *ppArgs[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE NewObjectNoConstructor( + + virtual HRESULT STDMETHODCALLTYPE NewObjectNoConstructor( /* [in] */ ICorDebugClass *pClass) = 0; - - virtual HRESULT STDMETHODCALLTYPE NewString( + + virtual HRESULT STDMETHODCALLTYPE NewString( /* [in] */ LPCWSTR string) = 0; - - virtual HRESULT STDMETHODCALLTYPE NewArray( + + virtual HRESULT STDMETHODCALLTYPE NewArray( /* [in] */ CorElementType elementType, /* [in] */ ICorDebugClass *pElementClass, /* [in] */ ULONG32 rank, /* [size_is][in] */ ULONG32 dims[ ], /* [size_is][in] */ ULONG32 lowBounds[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsActive( + + virtual HRESULT STDMETHODCALLTYPE IsActive( /* [out] */ BOOL *pbActive) = 0; - + virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetResult( + + virtual HRESULT STDMETHODCALLTYPE GetResult( /* [out] */ ICorDebugValue **ppResult) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetThread( + + virtual HRESULT STDMETHODCALLTYPE GetThread( /* [out] */ ICorDebugThread **ppThread) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateValue( + + virtual HRESULT STDMETHODCALLTYPE CreateValue( /* [in] */ CorElementType elementType, /* [in] */ ICorDebugClass *pElementClass, /* [out] */ ICorDebugValue **ppValue) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugEvalVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugEval * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugEval * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugEval * This); - - HRESULT ( STDMETHODCALLTYPE *CallFunction )( + + HRESULT ( STDMETHODCALLTYPE *CallFunction )( ICorDebugEval * This, /* [in] */ ICorDebugFunction *pFunction, /* [in] */ ULONG32 nArgs, /* [size_is][in] */ ICorDebugValue *ppArgs[ ]); - - HRESULT ( STDMETHODCALLTYPE *NewObject )( + + HRESULT ( STDMETHODCALLTYPE *NewObject )( ICorDebugEval * This, /* [in] */ ICorDebugFunction *pConstructor, /* [in] */ ULONG32 nArgs, /* [size_is][in] */ ICorDebugValue *ppArgs[ ]); - - HRESULT ( STDMETHODCALLTYPE *NewObjectNoConstructor )( + + HRESULT ( STDMETHODCALLTYPE *NewObjectNoConstructor )( ICorDebugEval * This, /* [in] */ ICorDebugClass *pClass); - - HRESULT ( STDMETHODCALLTYPE *NewString )( + + HRESULT ( STDMETHODCALLTYPE *NewString )( ICorDebugEval * This, /* [in] */ LPCWSTR string); - - HRESULT ( STDMETHODCALLTYPE *NewArray )( + + HRESULT ( STDMETHODCALLTYPE *NewArray )( ICorDebugEval * This, /* [in] */ CorElementType elementType, /* [in] */ ICorDebugClass *pElementClass, /* [in] */ ULONG32 rank, /* [size_is][in] */ ULONG32 dims[ ], /* [size_is][in] */ ULONG32 lowBounds[ ]); - - HRESULT ( STDMETHODCALLTYPE *IsActive )( + + HRESULT ( STDMETHODCALLTYPE *IsActive )( ICorDebugEval * This, /* [out] */ BOOL *pbActive); - - HRESULT ( STDMETHODCALLTYPE *Abort )( + + HRESULT ( STDMETHODCALLTYPE *Abort )( ICorDebugEval * This); - - HRESULT ( STDMETHODCALLTYPE *GetResult )( + + HRESULT ( STDMETHODCALLTYPE *GetResult )( ICorDebugEval * This, /* [out] */ ICorDebugValue **ppResult); - - HRESULT ( STDMETHODCALLTYPE *GetThread )( + + HRESULT ( STDMETHODCALLTYPE *GetThread )( ICorDebugEval * This, /* [out] */ ICorDebugThread **ppThread); - - HRESULT ( STDMETHODCALLTYPE *CreateValue )( + + HRESULT ( STDMETHODCALLTYPE *CreateValue )( ICorDebugEval * This, /* [in] */ CorElementType elementType, /* [in] */ ICorDebugClass *pElementClass, /* [out] */ ICorDebugValue **ppValue); - + END_INTERFACE } ICorDebugEvalVtbl; @@ -13695,50 +13786,50 @@ EXTERN_C const IID IID_ICorDebugEval; CONST_VTBL struct ICorDebugEvalVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugEval_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugEval_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugEval_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugEval_CallFunction(This,pFunction,nArgs,ppArgs) \ - ( (This)->lpVtbl -> CallFunction(This,pFunction,nArgs,ppArgs) ) + ( (This)->lpVtbl -> CallFunction(This,pFunction,nArgs,ppArgs) ) #define ICorDebugEval_NewObject(This,pConstructor,nArgs,ppArgs) \ - ( (This)->lpVtbl -> NewObject(This,pConstructor,nArgs,ppArgs) ) + ( (This)->lpVtbl -> NewObject(This,pConstructor,nArgs,ppArgs) ) #define ICorDebugEval_NewObjectNoConstructor(This,pClass) \ - ( (This)->lpVtbl -> NewObjectNoConstructor(This,pClass) ) + ( (This)->lpVtbl -> NewObjectNoConstructor(This,pClass) ) #define ICorDebugEval_NewString(This,string) \ - ( (This)->lpVtbl -> NewString(This,string) ) + ( (This)->lpVtbl -> NewString(This,string) ) #define ICorDebugEval_NewArray(This,elementType,pElementClass,rank,dims,lowBounds) \ - ( (This)->lpVtbl -> NewArray(This,elementType,pElementClass,rank,dims,lowBounds) ) + ( (This)->lpVtbl -> NewArray(This,elementType,pElementClass,rank,dims,lowBounds) ) #define ICorDebugEval_IsActive(This,pbActive) \ - ( (This)->lpVtbl -> IsActive(This,pbActive) ) + ( (This)->lpVtbl -> IsActive(This,pbActive) ) #define ICorDebugEval_Abort(This) \ - ( (This)->lpVtbl -> Abort(This) ) + ( (This)->lpVtbl -> Abort(This) ) #define ICorDebugEval_GetResult(This,ppResult) \ - ( (This)->lpVtbl -> GetResult(This,ppResult) ) + ( (This)->lpVtbl -> GetResult(This,ppResult) ) #define ICorDebugEval_GetThread(This,ppThread) \ - ( (This)->lpVtbl -> GetThread(This,ppThread) ) + ( (This)->lpVtbl -> GetThread(This,ppThread) ) #define ICorDebugEval_CreateValue(This,elementType,pElementClass,ppValue) \ - ( (This)->lpVtbl -> CreateValue(This,elementType,pElementClass,ppValue) ) + ( (This)->lpVtbl -> CreateValue(This,elementType,pElementClass,ppValue) ) #endif /* COBJMACROS */ @@ -13755,115 +13846,115 @@ EXTERN_C const IID IID_ICorDebugEval; #define __ICorDebugEval2_INTERFACE_DEFINED__ /* interface ICorDebugEval2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugEval2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("FB0D9CE7-BE66-4683-9D32-A42A04E2FD91") ICorDebugEval2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CallParameterizedFunction( + virtual HRESULT STDMETHODCALLTYPE CallParameterizedFunction( /* [in] */ ICorDebugFunction *pFunction, /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ], /* [in] */ ULONG32 nArgs, /* [size_is][in] */ ICorDebugValue *ppArgs[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateValueForType( + + virtual HRESULT STDMETHODCALLTYPE CreateValueForType( /* [in] */ ICorDebugType *pType, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE NewParameterizedObject( + + virtual HRESULT STDMETHODCALLTYPE NewParameterizedObject( /* [in] */ ICorDebugFunction *pConstructor, /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ], /* [in] */ ULONG32 nArgs, /* [size_is][in] */ ICorDebugValue *ppArgs[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE NewParameterizedObjectNoConstructor( + + virtual HRESULT STDMETHODCALLTYPE NewParameterizedObjectNoConstructor( /* [in] */ ICorDebugClass *pClass, /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE NewParameterizedArray( + + virtual HRESULT STDMETHODCALLTYPE NewParameterizedArray( /* [in] */ ICorDebugType *pElementType, /* [in] */ ULONG32 rank, /* [size_is][in] */ ULONG32 dims[ ], /* [size_is][in] */ ULONG32 lowBounds[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE NewStringWithLength( + + virtual HRESULT STDMETHODCALLTYPE NewStringWithLength( /* [in] */ LPCWSTR string, /* [in] */ UINT uiLength) = 0; - + virtual HRESULT STDMETHODCALLTYPE RudeAbort( void) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugEval2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugEval2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugEval2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugEval2 * This); - - HRESULT ( STDMETHODCALLTYPE *CallParameterizedFunction )( + + HRESULT ( STDMETHODCALLTYPE *CallParameterizedFunction )( ICorDebugEval2 * This, /* [in] */ ICorDebugFunction *pFunction, /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ], /* [in] */ ULONG32 nArgs, /* [size_is][in] */ ICorDebugValue *ppArgs[ ]); - - HRESULT ( STDMETHODCALLTYPE *CreateValueForType )( + + HRESULT ( STDMETHODCALLTYPE *CreateValueForType )( ICorDebugEval2 * This, /* [in] */ ICorDebugType *pType, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *NewParameterizedObject )( + + HRESULT ( STDMETHODCALLTYPE *NewParameterizedObject )( ICorDebugEval2 * This, /* [in] */ ICorDebugFunction *pConstructor, /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ], /* [in] */ ULONG32 nArgs, /* [size_is][in] */ ICorDebugValue *ppArgs[ ]); - - HRESULT ( STDMETHODCALLTYPE *NewParameterizedObjectNoConstructor )( + + HRESULT ( STDMETHODCALLTYPE *NewParameterizedObjectNoConstructor )( ICorDebugEval2 * This, /* [in] */ ICorDebugClass *pClass, /* [in] */ ULONG32 nTypeArgs, /* [size_is][in] */ ICorDebugType *ppTypeArgs[ ]); - - HRESULT ( STDMETHODCALLTYPE *NewParameterizedArray )( + + HRESULT ( STDMETHODCALLTYPE *NewParameterizedArray )( ICorDebugEval2 * This, /* [in] */ ICorDebugType *pElementType, /* [in] */ ULONG32 rank, /* [size_is][in] */ ULONG32 dims[ ], /* [size_is][in] */ ULONG32 lowBounds[ ]); - - HRESULT ( STDMETHODCALLTYPE *NewStringWithLength )( + + HRESULT ( STDMETHODCALLTYPE *NewStringWithLength )( ICorDebugEval2 * This, /* [in] */ LPCWSTR string, /* [in] */ UINT uiLength); - - HRESULT ( STDMETHODCALLTYPE *RudeAbort )( + + HRESULT ( STDMETHODCALLTYPE *RudeAbort )( ICorDebugEval2 * This); - + END_INTERFACE } ICorDebugEval2Vtbl; @@ -13872,41 +13963,41 @@ EXTERN_C const IID IID_ICorDebugEval2; CONST_VTBL struct ICorDebugEval2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugEval2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugEval2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugEval2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugEval2_CallParameterizedFunction(This,pFunction,nTypeArgs,ppTypeArgs,nArgs,ppArgs) \ - ( (This)->lpVtbl -> CallParameterizedFunction(This,pFunction,nTypeArgs,ppTypeArgs,nArgs,ppArgs) ) + ( (This)->lpVtbl -> CallParameterizedFunction(This,pFunction,nTypeArgs,ppTypeArgs,nArgs,ppArgs) ) #define ICorDebugEval2_CreateValueForType(This,pType,ppValue) \ - ( (This)->lpVtbl -> CreateValueForType(This,pType,ppValue) ) + ( (This)->lpVtbl -> CreateValueForType(This,pType,ppValue) ) #define ICorDebugEval2_NewParameterizedObject(This,pConstructor,nTypeArgs,ppTypeArgs,nArgs,ppArgs) \ - ( (This)->lpVtbl -> NewParameterizedObject(This,pConstructor,nTypeArgs,ppTypeArgs,nArgs,ppArgs) ) + ( (This)->lpVtbl -> NewParameterizedObject(This,pConstructor,nTypeArgs,ppTypeArgs,nArgs,ppArgs) ) #define ICorDebugEval2_NewParameterizedObjectNoConstructor(This,pClass,nTypeArgs,ppTypeArgs) \ - ( (This)->lpVtbl -> NewParameterizedObjectNoConstructor(This,pClass,nTypeArgs,ppTypeArgs) ) + ( (This)->lpVtbl -> NewParameterizedObjectNoConstructor(This,pClass,nTypeArgs,ppTypeArgs) ) #define ICorDebugEval2_NewParameterizedArray(This,pElementType,rank,dims,lowBounds) \ - ( (This)->lpVtbl -> NewParameterizedArray(This,pElementType,rank,dims,lowBounds) ) + ( (This)->lpVtbl -> NewParameterizedArray(This,pElementType,rank,dims,lowBounds) ) #define ICorDebugEval2_NewStringWithLength(This,string,uiLength) \ - ( (This)->lpVtbl -> NewStringWithLength(This,string,uiLength) ) + ( (This)->lpVtbl -> NewStringWithLength(This,string,uiLength) ) #define ICorDebugEval2_RudeAbort(This) \ - ( (This)->lpVtbl -> RudeAbort(This) ) + ( (This)->lpVtbl -> RudeAbort(This) ) #endif /* COBJMACROS */ @@ -13923,66 +14014,66 @@ EXTERN_C const IID IID_ICorDebugEval2; #define __ICorDebugValue_INTERFACE_DEFINED__ /* interface ICorDebugValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAF7-8A68-11d2-983C-0000F808342D") ICorDebugValue : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetType( + virtual HRESULT STDMETHODCALLTYPE GetType( /* [out] */ CorElementType *pType) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSize( + + virtual HRESULT STDMETHODCALLTYPE GetSize( /* [out] */ ULONG32 *pSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAddress( + + virtual HRESULT STDMETHODCALLTYPE GetAddress( /* [out] */ CORDB_ADDRESS *pAddress) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateBreakpoint( + + virtual HRESULT STDMETHODCALLTYPE CreateBreakpoint( /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugValue * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugValue * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - + END_INTERFACE } ICorDebugValueVtbl; @@ -13991,32 +14082,32 @@ EXTERN_C const IID IID_ICorDebugValue; CONST_VTBL struct ICorDebugValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugValue_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugValue_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugValue_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugValue_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #endif /* COBJMACROS */ @@ -14033,45 +14124,45 @@ EXTERN_C const IID IID_ICorDebugValue; #define __ICorDebugValue2_INTERFACE_DEFINED__ /* interface ICorDebugValue2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugValue2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("5E0B54E7-D88A-4626-9420-A691E0A78B49") ICorDebugValue2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetExactType( + virtual HRESULT STDMETHODCALLTYPE GetExactType( /* [out] */ ICorDebugType **ppType) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugValue2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugValue2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugValue2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugValue2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetExactType )( + + HRESULT ( STDMETHODCALLTYPE *GetExactType )( ICorDebugValue2 * This, /* [out] */ ICorDebugType **ppType); - + END_INTERFACE } ICorDebugValue2Vtbl; @@ -14080,23 +14171,23 @@ EXTERN_C const IID IID_ICorDebugValue2; CONST_VTBL struct ICorDebugValue2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugValue2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugValue2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugValue2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugValue2_GetExactType(This,ppType) \ - ( (This)->lpVtbl -> GetExactType(This,ppType) ) + ( (This)->lpVtbl -> GetExactType(This,ppType) ) #endif /* COBJMACROS */ @@ -14113,45 +14204,45 @@ EXTERN_C const IID IID_ICorDebugValue2; #define __ICorDebugValue3_INTERFACE_DEFINED__ /* interface ICorDebugValue3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugValue3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("565005FC-0F8A-4F3E-9EDB-83102B156595") ICorDebugValue3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetSize64( + virtual HRESULT STDMETHODCALLTYPE GetSize64( /* [out] */ ULONG64 *pSize) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugValue3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugValue3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugValue3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugValue3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetSize64 )( + + HRESULT ( STDMETHODCALLTYPE *GetSize64 )( ICorDebugValue3 * This, /* [out] */ ULONG64 *pSize); - + END_INTERFACE } ICorDebugValue3Vtbl; @@ -14160,23 +14251,23 @@ EXTERN_C const IID IID_ICorDebugValue3; CONST_VTBL struct ICorDebugValue3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugValue3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugValue3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugValue3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugValue3_GetSize64(This,pSize) \ - ( (This)->lpVtbl -> GetSize64(This,pSize) ) + ( (This)->lpVtbl -> GetSize64(This,pSize) ) #endif /* COBJMACROS */ @@ -14193,68 +14284,68 @@ EXTERN_C const IID IID_ICorDebugValue3; #define __ICorDebugGenericValue_INTERFACE_DEFINED__ /* interface ICorDebugGenericValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugGenericValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAF8-8A68-11d2-983C-0000F808342D") ICorDebugGenericValue : public ICorDebugValue { public: - virtual HRESULT STDMETHODCALLTYPE GetValue( + virtual HRESULT STDMETHODCALLTYPE GetValue( /* [out] */ void *pTo) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetValue( + + virtual HRESULT STDMETHODCALLTYPE SetValue( /* [in] */ void *pFrom) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugGenericValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugGenericValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugGenericValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugGenericValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugGenericValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugGenericValue * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugGenericValue * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugGenericValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *GetValue )( + + HRESULT ( STDMETHODCALLTYPE *GetValue )( ICorDebugGenericValue * This, /* [out] */ void *pTo); - - HRESULT ( STDMETHODCALLTYPE *SetValue )( + + HRESULT ( STDMETHODCALLTYPE *SetValue )( ICorDebugGenericValue * This, /* [in] */ void *pFrom); - + END_INTERFACE } ICorDebugGenericValueVtbl; @@ -14263,39 +14354,39 @@ EXTERN_C const IID IID_ICorDebugGenericValue; CONST_VTBL struct ICorDebugGenericValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugGenericValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugGenericValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugGenericValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugGenericValue_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugGenericValue_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugGenericValue_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugGenericValue_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugGenericValue_GetValue(This,pTo) \ - ( (This)->lpVtbl -> GetValue(This,pTo) ) + ( (This)->lpVtbl -> GetValue(This,pTo) ) #define ICorDebugGenericValue_SetValue(This,pFrom) \ - ( (This)->lpVtbl -> SetValue(This,pFrom) ) + ( (This)->lpVtbl -> SetValue(This,pFrom) ) #endif /* COBJMACROS */ @@ -14312,89 +14403,89 @@ EXTERN_C const IID IID_ICorDebugGenericValue; #define __ICorDebugReferenceValue_INTERFACE_DEFINED__ /* interface ICorDebugReferenceValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugReferenceValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAF9-8A68-11d2-983C-0000F808342D") ICorDebugReferenceValue : public ICorDebugValue { public: - virtual HRESULT STDMETHODCALLTYPE IsNull( + virtual HRESULT STDMETHODCALLTYPE IsNull( /* [out] */ BOOL *pbNull) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetValue( + + virtual HRESULT STDMETHODCALLTYPE GetValue( /* [out] */ CORDB_ADDRESS *pValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetValue( + + virtual HRESULT STDMETHODCALLTYPE SetValue( /* [in] */ CORDB_ADDRESS value) = 0; - - virtual HRESULT STDMETHODCALLTYPE Dereference( + + virtual HRESULT STDMETHODCALLTYPE Dereference( /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE DereferenceStrong( + + virtual HRESULT STDMETHODCALLTYPE DereferenceStrong( /* [out] */ ICorDebugValue **ppValue) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugReferenceValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugReferenceValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugReferenceValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugReferenceValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugReferenceValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugReferenceValue * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugReferenceValue * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugReferenceValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *IsNull )( + + HRESULT ( STDMETHODCALLTYPE *IsNull )( ICorDebugReferenceValue * This, /* [out] */ BOOL *pbNull); - - HRESULT ( STDMETHODCALLTYPE *GetValue )( + + HRESULT ( STDMETHODCALLTYPE *GetValue )( ICorDebugReferenceValue * This, /* [out] */ CORDB_ADDRESS *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetValue )( + + HRESULT ( STDMETHODCALLTYPE *SetValue )( ICorDebugReferenceValue * This, /* [in] */ CORDB_ADDRESS value); - - HRESULT ( STDMETHODCALLTYPE *Dereference )( + + HRESULT ( STDMETHODCALLTYPE *Dereference )( ICorDebugReferenceValue * This, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *DereferenceStrong )( + + HRESULT ( STDMETHODCALLTYPE *DereferenceStrong )( ICorDebugReferenceValue * This, /* [out] */ ICorDebugValue **ppValue); - + END_INTERFACE } ICorDebugReferenceValueVtbl; @@ -14403,48 +14494,48 @@ EXTERN_C const IID IID_ICorDebugReferenceValue; CONST_VTBL struct ICorDebugReferenceValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugReferenceValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugReferenceValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugReferenceValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugReferenceValue_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugReferenceValue_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugReferenceValue_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugReferenceValue_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugReferenceValue_IsNull(This,pbNull) \ - ( (This)->lpVtbl -> IsNull(This,pbNull) ) + ( (This)->lpVtbl -> IsNull(This,pbNull) ) #define ICorDebugReferenceValue_GetValue(This,pValue) \ - ( (This)->lpVtbl -> GetValue(This,pValue) ) + ( (This)->lpVtbl -> GetValue(This,pValue) ) #define ICorDebugReferenceValue_SetValue(This,value) \ - ( (This)->lpVtbl -> SetValue(This,value) ) + ( (This)->lpVtbl -> SetValue(This,value) ) #define ICorDebugReferenceValue_Dereference(This,ppValue) \ - ( (This)->lpVtbl -> Dereference(This,ppValue) ) + ( (This)->lpVtbl -> Dereference(This,ppValue) ) #define ICorDebugReferenceValue_DereferenceStrong(This,ppValue) \ - ( (This)->lpVtbl -> DereferenceStrong(This,ppValue) ) + ( (This)->lpVtbl -> DereferenceStrong(This,ppValue) ) #endif /* COBJMACROS */ @@ -14461,68 +14552,68 @@ EXTERN_C const IID IID_ICorDebugReferenceValue; #define __ICorDebugHeapValue_INTERFACE_DEFINED__ /* interface ICorDebugHeapValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugHeapValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAFA-8A68-11d2-983C-0000F808342D") ICorDebugHeapValue : public ICorDebugValue { public: - virtual HRESULT STDMETHODCALLTYPE IsValid( + virtual HRESULT STDMETHODCALLTYPE IsValid( /* [out] */ BOOL *pbValid) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateRelocBreakpoint( + + virtual HRESULT STDMETHODCALLTYPE CreateRelocBreakpoint( /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugHeapValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugHeapValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugHeapValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugHeapValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugHeapValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugHeapValue * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugHeapValue * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugHeapValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *IsValid )( + + HRESULT ( STDMETHODCALLTYPE *IsValid )( ICorDebugHeapValue * This, /* [out] */ BOOL *pbValid); - - HRESULT ( STDMETHODCALLTYPE *CreateRelocBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateRelocBreakpoint )( ICorDebugHeapValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - + END_INTERFACE } ICorDebugHeapValueVtbl; @@ -14531,39 +14622,39 @@ EXTERN_C const IID IID_ICorDebugHeapValue; CONST_VTBL struct ICorDebugHeapValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugHeapValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugHeapValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugHeapValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugHeapValue_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugHeapValue_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugHeapValue_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugHeapValue_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugHeapValue_IsValid(This,pbValid) \ - ( (This)->lpVtbl -> IsValid(This,pbValid) ) + ( (This)->lpVtbl -> IsValid(This,pbValid) ) #define ICorDebugHeapValue_CreateRelocBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateRelocBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateRelocBreakpoint(This,ppBreakpoint) ) #endif /* COBJMACROS */ @@ -14580,47 +14671,47 @@ EXTERN_C const IID IID_ICorDebugHeapValue; #define __ICorDebugHeapValue2_INTERFACE_DEFINED__ /* interface ICorDebugHeapValue2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugHeapValue2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("E3AC4D6C-9CB7-43e6-96CC-B21540E5083C") ICorDebugHeapValue2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CreateHandle( + virtual HRESULT STDMETHODCALLTYPE CreateHandle( /* [in] */ CorDebugHandleType type, /* [out] */ ICorDebugHandleValue **ppHandle) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugHeapValue2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugHeapValue2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugHeapValue2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugHeapValue2 * This); - - HRESULT ( STDMETHODCALLTYPE *CreateHandle )( + + HRESULT ( STDMETHODCALLTYPE *CreateHandle )( ICorDebugHeapValue2 * This, /* [in] */ CorDebugHandleType type, /* [out] */ ICorDebugHandleValue **ppHandle); - + END_INTERFACE } ICorDebugHeapValue2Vtbl; @@ -14629,23 +14720,23 @@ EXTERN_C const IID IID_ICorDebugHeapValue2; CONST_VTBL struct ICorDebugHeapValue2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugHeapValue2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugHeapValue2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugHeapValue2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugHeapValue2_CreateHandle(This,type,ppHandle) \ - ( (This)->lpVtbl -> CreateHandle(This,type,ppHandle) ) + ( (This)->lpVtbl -> CreateHandle(This,type,ppHandle) ) #endif /* COBJMACROS */ @@ -14662,54 +14753,54 @@ EXTERN_C const IID IID_ICorDebugHeapValue2; #define __ICorDebugHeapValue3_INTERFACE_DEFINED__ /* interface ICorDebugHeapValue3 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugHeapValue3; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("A69ACAD8-2374-46e9-9FF8-B1F14120D296") ICorDebugHeapValue3 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetThreadOwningMonitorLock( + virtual HRESULT STDMETHODCALLTYPE GetThreadOwningMonitorLock( /* [out] */ ICorDebugThread **ppThread, /* [out] */ DWORD *pAcquisitionCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMonitorEventWaitList( + + virtual HRESULT STDMETHODCALLTYPE GetMonitorEventWaitList( /* [out] */ ICorDebugThreadEnum **ppThreadEnum) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugHeapValue3Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugHeapValue3 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugHeapValue3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugHeapValue3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetThreadOwningMonitorLock )( + + HRESULT ( STDMETHODCALLTYPE *GetThreadOwningMonitorLock )( ICorDebugHeapValue3 * This, /* [out] */ ICorDebugThread **ppThread, /* [out] */ DWORD *pAcquisitionCount); - - HRESULT ( STDMETHODCALLTYPE *GetMonitorEventWaitList )( + + HRESULT ( STDMETHODCALLTYPE *GetMonitorEventWaitList )( ICorDebugHeapValue3 * This, /* [out] */ ICorDebugThreadEnum **ppThreadEnum); - + END_INTERFACE } ICorDebugHeapValue3Vtbl; @@ -14718,26 +14809,26 @@ EXTERN_C const IID IID_ICorDebugHeapValue3; CONST_VTBL struct ICorDebugHeapValue3Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugHeapValue3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugHeapValue3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugHeapValue3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugHeapValue3_GetThreadOwningMonitorLock(This,ppThread,pAcquisitionCount) \ - ( (This)->lpVtbl -> GetThreadOwningMonitorLock(This,ppThread,pAcquisitionCount) ) + ( (This)->lpVtbl -> GetThreadOwningMonitorLock(This,ppThread,pAcquisitionCount) ) #define ICorDebugHeapValue3_GetMonitorEventWaitList(This,ppThreadEnum) \ - ( (This)->lpVtbl -> GetMonitorEventWaitList(This,ppThreadEnum) ) + ( (This)->lpVtbl -> GetMonitorEventWaitList(This,ppThreadEnum) ) #endif /* COBJMACROS */ @@ -14754,45 +14845,45 @@ EXTERN_C const IID IID_ICorDebugHeapValue3; #define __ICorDebugHeapValue4_INTERFACE_DEFINED__ /* interface ICorDebugHeapValue4 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugHeapValue4; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("B35DD495-A555-463B-9BE9-C55338486BB8") ICorDebugHeapValue4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CreatePinnedHandle( + virtual HRESULT STDMETHODCALLTYPE CreatePinnedHandle( /* [out] */ ICorDebugHandleValue **ppHandle) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugHeapValue4Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugHeapValue4 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugHeapValue4 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugHeapValue4 * This); - - HRESULT ( STDMETHODCALLTYPE *CreatePinnedHandle )( + + HRESULT ( STDMETHODCALLTYPE *CreatePinnedHandle )( ICorDebugHeapValue4 * This, /* [out] */ ICorDebugHandleValue **ppHandle); - + END_INTERFACE } ICorDebugHeapValue4Vtbl; @@ -14801,23 +14892,23 @@ EXTERN_C const IID IID_ICorDebugHeapValue4; CONST_VTBL struct ICorDebugHeapValue4Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugHeapValue4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugHeapValue4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugHeapValue4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugHeapValue4_CreatePinnedHandle(This,ppHandle) \ - ( (This)->lpVtbl -> CreatePinnedHandle(This,ppHandle) ) + ( (This)->lpVtbl -> CreatePinnedHandle(This,ppHandle) ) #endif /* COBJMACROS */ @@ -14834,109 +14925,109 @@ EXTERN_C const IID IID_ICorDebugHeapValue4; #define __ICorDebugObjectValue_INTERFACE_DEFINED__ /* interface ICorDebugObjectValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugObjectValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("18AD3D6E-B7D2-11d2-BD04-0000F80849BD") ICorDebugObjectValue : public ICorDebugValue { public: - virtual HRESULT STDMETHODCALLTYPE GetClass( + virtual HRESULT STDMETHODCALLTYPE GetClass( /* [out] */ ICorDebugClass **ppClass) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFieldValue( + + virtual HRESULT STDMETHODCALLTYPE GetFieldValue( /* [in] */ ICorDebugClass *pClass, /* [in] */ mdFieldDef fieldDef, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVirtualMethod( + + virtual HRESULT STDMETHODCALLTYPE GetVirtualMethod( /* [in] */ mdMemberRef memberRef, /* [out] */ ICorDebugFunction **ppFunction) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetContext( + + virtual HRESULT STDMETHODCALLTYPE GetContext( /* [out] */ ICorDebugContext **ppContext) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsValueClass( + + virtual HRESULT STDMETHODCALLTYPE IsValueClass( /* [out] */ BOOL *pbIsValueClass) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetManagedCopy( + + virtual HRESULT STDMETHODCALLTYPE GetManagedCopy( /* [out] */ IUnknown **ppObject) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFromManagedCopy( + + virtual HRESULT STDMETHODCALLTYPE SetFromManagedCopy( /* [in] */ IUnknown *pObject) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugObjectValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugObjectValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugObjectValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugObjectValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugObjectValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugObjectValue * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugObjectValue * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugObjectValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *GetClass )( + + HRESULT ( STDMETHODCALLTYPE *GetClass )( ICorDebugObjectValue * This, /* [out] */ ICorDebugClass **ppClass); - - HRESULT ( STDMETHODCALLTYPE *GetFieldValue )( + + HRESULT ( STDMETHODCALLTYPE *GetFieldValue )( ICorDebugObjectValue * This, /* [in] */ ICorDebugClass *pClass, /* [in] */ mdFieldDef fieldDef, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetVirtualMethod )( + + HRESULT ( STDMETHODCALLTYPE *GetVirtualMethod )( ICorDebugObjectValue * This, /* [in] */ mdMemberRef memberRef, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetContext )( + + HRESULT ( STDMETHODCALLTYPE *GetContext )( ICorDebugObjectValue * This, /* [out] */ ICorDebugContext **ppContext); - - HRESULT ( STDMETHODCALLTYPE *IsValueClass )( + + HRESULT ( STDMETHODCALLTYPE *IsValueClass )( ICorDebugObjectValue * This, /* [out] */ BOOL *pbIsValueClass); - - HRESULT ( STDMETHODCALLTYPE *GetManagedCopy )( + + HRESULT ( STDMETHODCALLTYPE *GetManagedCopy )( ICorDebugObjectValue * This, /* [out] */ IUnknown **ppObject); - - HRESULT ( STDMETHODCALLTYPE *SetFromManagedCopy )( + + HRESULT ( STDMETHODCALLTYPE *SetFromManagedCopy )( ICorDebugObjectValue * This, /* [in] */ IUnknown *pObject); - + END_INTERFACE } ICorDebugObjectValueVtbl; @@ -14945,54 +15036,54 @@ EXTERN_C const IID IID_ICorDebugObjectValue; CONST_VTBL struct ICorDebugObjectValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugObjectValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugObjectValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugObjectValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugObjectValue_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugObjectValue_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugObjectValue_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugObjectValue_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugObjectValue_GetClass(This,ppClass) \ - ( (This)->lpVtbl -> GetClass(This,ppClass) ) + ( (This)->lpVtbl -> GetClass(This,ppClass) ) #define ICorDebugObjectValue_GetFieldValue(This,pClass,fieldDef,ppValue) \ - ( (This)->lpVtbl -> GetFieldValue(This,pClass,fieldDef,ppValue) ) + ( (This)->lpVtbl -> GetFieldValue(This,pClass,fieldDef,ppValue) ) #define ICorDebugObjectValue_GetVirtualMethod(This,memberRef,ppFunction) \ - ( (This)->lpVtbl -> GetVirtualMethod(This,memberRef,ppFunction) ) + ( (This)->lpVtbl -> GetVirtualMethod(This,memberRef,ppFunction) ) #define ICorDebugObjectValue_GetContext(This,ppContext) \ - ( (This)->lpVtbl -> GetContext(This,ppContext) ) + ( (This)->lpVtbl -> GetContext(This,ppContext) ) #define ICorDebugObjectValue_IsValueClass(This,pbIsValueClass) \ - ( (This)->lpVtbl -> IsValueClass(This,pbIsValueClass) ) + ( (This)->lpVtbl -> IsValueClass(This,pbIsValueClass) ) #define ICorDebugObjectValue_GetManagedCopy(This,ppObject) \ - ( (This)->lpVtbl -> GetManagedCopy(This,ppObject) ) + ( (This)->lpVtbl -> GetManagedCopy(This,ppObject) ) #define ICorDebugObjectValue_SetFromManagedCopy(This,pObject) \ - ( (This)->lpVtbl -> SetFromManagedCopy(This,pObject) ) + ( (This)->lpVtbl -> SetFromManagedCopy(This,pObject) ) #endif /* COBJMACROS */ @@ -15009,49 +15100,49 @@ EXTERN_C const IID IID_ICorDebugObjectValue; #define __ICorDebugObjectValue2_INTERFACE_DEFINED__ /* interface ICorDebugObjectValue2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugObjectValue2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("49E4A320-4A9B-4eca-B105-229FB7D5009F") ICorDebugObjectValue2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetVirtualMethodAndType( + virtual HRESULT STDMETHODCALLTYPE GetVirtualMethodAndType( /* [in] */ mdMemberRef memberRef, /* [out] */ ICorDebugFunction **ppFunction, /* [out] */ ICorDebugType **ppType) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugObjectValue2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugObjectValue2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugObjectValue2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugObjectValue2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetVirtualMethodAndType )( + + HRESULT ( STDMETHODCALLTYPE *GetVirtualMethodAndType )( ICorDebugObjectValue2 * This, /* [in] */ mdMemberRef memberRef, /* [out] */ ICorDebugFunction **ppFunction, /* [out] */ ICorDebugType **ppType); - + END_INTERFACE } ICorDebugObjectValue2Vtbl; @@ -15060,23 +15151,23 @@ EXTERN_C const IID IID_ICorDebugObjectValue2; CONST_VTBL struct ICorDebugObjectValue2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugObjectValue2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugObjectValue2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugObjectValue2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugObjectValue2_GetVirtualMethodAndType(This,memberRef,ppFunction,ppType) \ - ( (This)->lpVtbl -> GetVirtualMethodAndType(This,memberRef,ppFunction,ppType) ) + ( (This)->lpVtbl -> GetVirtualMethodAndType(This,memberRef,ppFunction,ppType) ) #endif /* COBJMACROS */ @@ -15093,52 +15184,52 @@ EXTERN_C const IID IID_ICorDebugObjectValue2; #define __ICorDebugDelegateObjectValue_INTERFACE_DEFINED__ /* interface ICorDebugDelegateObjectValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugDelegateObjectValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("3AF70CC7-6047-47F6-A5C5-090A1A622638") ICorDebugDelegateObjectValue : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetTarget( + virtual HRESULT STDMETHODCALLTYPE GetTarget( /* [out] */ ICorDebugReferenceValue **ppObject) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFunction( + + virtual HRESULT STDMETHODCALLTYPE GetFunction( /* [out] */ ICorDebugFunction **ppFunction) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugDelegateObjectValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugDelegateObjectValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugDelegateObjectValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugDelegateObjectValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetTarget )( + + HRESULT ( STDMETHODCALLTYPE *GetTarget )( ICorDebugDelegateObjectValue * This, /* [out] */ ICorDebugReferenceValue **ppObject); - - HRESULT ( STDMETHODCALLTYPE *GetFunction )( + + HRESULT ( STDMETHODCALLTYPE *GetFunction )( ICorDebugDelegateObjectValue * This, /* [out] */ ICorDebugFunction **ppFunction); - + END_INTERFACE } ICorDebugDelegateObjectValueVtbl; @@ -15147,26 +15238,26 @@ EXTERN_C const IID IID_ICorDebugDelegateObjectValue; CONST_VTBL struct ICorDebugDelegateObjectValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugDelegateObjectValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugDelegateObjectValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugDelegateObjectValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugDelegateObjectValue_GetTarget(This,ppObject) \ - ( (This)->lpVtbl -> GetTarget(This,ppObject) ) + ( (This)->lpVtbl -> GetTarget(This,ppObject) ) #define ICorDebugDelegateObjectValue_GetFunction(This,ppFunction) \ - ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) + ( (This)->lpVtbl -> GetFunction(This,ppFunction) ) #endif /* COBJMACROS */ @@ -15183,69 +15274,69 @@ EXTERN_C const IID IID_ICorDebugDelegateObjectValue; #define __ICorDebugBoxValue_INTERFACE_DEFINED__ /* interface ICorDebugBoxValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugBoxValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAFC-8A68-11d2-983C-0000F808342D") ICorDebugBoxValue : public ICorDebugHeapValue { public: - virtual HRESULT STDMETHODCALLTYPE GetObject( + virtual HRESULT STDMETHODCALLTYPE GetObject( /* [out] */ ICorDebugObjectValue **ppObject) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugBoxValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugBoxValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugBoxValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugBoxValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugBoxValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugBoxValue * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugBoxValue * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugBoxValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *IsValid )( + + HRESULT ( STDMETHODCALLTYPE *IsValid )( ICorDebugBoxValue * This, /* [out] */ BOOL *pbValid); - - HRESULT ( STDMETHODCALLTYPE *CreateRelocBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateRelocBreakpoint )( ICorDebugBoxValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *GetObject )( + + HRESULT ( STDMETHODCALLTYPE *GetObject )( ICorDebugBoxValue * This, /* [out] */ ICorDebugObjectValue **ppObject); - + END_INTERFACE } ICorDebugBoxValueVtbl; @@ -15254,43 +15345,43 @@ EXTERN_C const IID IID_ICorDebugBoxValue; CONST_VTBL struct ICorDebugBoxValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugBoxValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugBoxValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugBoxValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugBoxValue_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugBoxValue_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugBoxValue_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugBoxValue_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugBoxValue_IsValid(This,pbValid) \ - ( (This)->lpVtbl -> IsValid(This,pbValid) ) + ( (This)->lpVtbl -> IsValid(This,pbValid) ) #define ICorDebugBoxValue_CreateRelocBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateRelocBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateRelocBreakpoint(This,ppBreakpoint) ) #define ICorDebugBoxValue_GetObject(This,ppObject) \ - ( (This)->lpVtbl -> GetObject(This,ppObject) ) + ( (This)->lpVtbl -> GetObject(This,ppObject) ) #endif /* COBJMACROS */ @@ -15303,94 +15394,94 @@ EXTERN_C const IID IID_ICorDebugBoxValue; #endif /* __ICorDebugBoxValue_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_cordebug_0000_0104 */ -/* [local] */ +/* interface __MIDL_itf_cordebug_0000_0105 */ +/* [local] */ #pragma warning(push) -#pragma warning(disable:28718) +#pragma warning(disable:28718) -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0104_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0104_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0105_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0105_v0_0_s_ifspec; #ifndef __ICorDebugStringValue_INTERFACE_DEFINED__ #define __ICorDebugStringValue_INTERFACE_DEFINED__ /* interface ICorDebugStringValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugStringValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCAFD-8A68-11d2-983C-0000F808342D") ICorDebugStringValue : public ICorDebugHeapValue { public: - virtual HRESULT STDMETHODCALLTYPE GetLength( + virtual HRESULT STDMETHODCALLTYPE GetLength( /* [out] */ ULONG32 *pcchString) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( + + virtual HRESULT STDMETHODCALLTYPE GetString( /* [in] */ ULONG32 cchString, /* [out] */ ULONG32 *pcchString, /* [length_is][size_is][out] */ WCHAR szString[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugStringValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugStringValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugStringValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugStringValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugStringValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugStringValue * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugStringValue * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugStringValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *IsValid )( + + HRESULT ( STDMETHODCALLTYPE *IsValid )( ICorDebugStringValue * This, /* [out] */ BOOL *pbValid); - - HRESULT ( STDMETHODCALLTYPE *CreateRelocBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateRelocBreakpoint )( ICorDebugStringValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *GetLength )( + + HRESULT ( STDMETHODCALLTYPE *GetLength )( ICorDebugStringValue * This, /* [out] */ ULONG32 *pcchString); - - HRESULT ( STDMETHODCALLTYPE *GetString )( + + HRESULT ( STDMETHODCALLTYPE *GetString )( ICorDebugStringValue * This, /* [in] */ ULONG32 cchString, /* [out] */ ULONG32 *pcchString, /* [length_is][size_is][out] */ WCHAR szString[ ]); - + END_INTERFACE } ICorDebugStringValueVtbl; @@ -15399,46 +15490,46 @@ EXTERN_C const IID IID_ICorDebugStringValue; CONST_VTBL struct ICorDebugStringValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugStringValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugStringValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugStringValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugStringValue_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugStringValue_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugStringValue_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugStringValue_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugStringValue_IsValid(This,pbValid) \ - ( (This)->lpVtbl -> IsValid(This,pbValid) ) + ( (This)->lpVtbl -> IsValid(This,pbValid) ) #define ICorDebugStringValue_CreateRelocBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateRelocBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateRelocBreakpoint(This,ppBreakpoint) ) #define ICorDebugStringValue_GetLength(This,pcchString) \ - ( (This)->lpVtbl -> GetLength(This,pcchString) ) + ( (This)->lpVtbl -> GetLength(This,pcchString) ) #define ICorDebugStringValue_GetString(This,cchString,pcchString,szString) \ - ( (This)->lpVtbl -> GetString(This,cchString,pcchString,szString) ) + ( (This)->lpVtbl -> GetString(This,cchString,pcchString,szString) ) #endif /* COBJMACROS */ @@ -15451,141 +15542,141 @@ EXTERN_C const IID IID_ICorDebugStringValue; #endif /* __ICorDebugStringValue_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_cordebug_0000_0105 */ -/* [local] */ +/* interface __MIDL_itf_cordebug_0000_0106 */ +/* [local] */ #pragma warning(pop) -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0105_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0105_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0106_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0106_v0_0_s_ifspec; #ifndef __ICorDebugArrayValue_INTERFACE_DEFINED__ #define __ICorDebugArrayValue_INTERFACE_DEFINED__ /* interface ICorDebugArrayValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugArrayValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("0405B0DF-A660-11d2-BD02-0000F80849BD") ICorDebugArrayValue : public ICorDebugHeapValue { public: - virtual HRESULT STDMETHODCALLTYPE GetElementType( + virtual HRESULT STDMETHODCALLTYPE GetElementType( /* [out] */ CorElementType *pType) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRank( + + virtual HRESULT STDMETHODCALLTYPE GetRank( /* [out] */ ULONG32 *pnRank) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCount( + + virtual HRESULT STDMETHODCALLTYPE GetCount( /* [out] */ ULONG32 *pnCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDimensions( + + virtual HRESULT STDMETHODCALLTYPE GetDimensions( /* [in] */ ULONG32 cdim, /* [length_is][size_is][out] */ ULONG32 dims[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE HasBaseIndicies( + + virtual HRESULT STDMETHODCALLTYPE HasBaseIndicies( /* [out] */ BOOL *pbHasBaseIndicies) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBaseIndicies( + + virtual HRESULT STDMETHODCALLTYPE GetBaseIndicies( /* [in] */ ULONG32 cdim, /* [length_is][size_is][out] */ ULONG32 indicies[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetElement( + + virtual HRESULT STDMETHODCALLTYPE GetElement( /* [in] */ ULONG32 cdim, /* [length_is][size_is][in] */ ULONG32 indices[ ], /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetElementAtPosition( + + virtual HRESULT STDMETHODCALLTYPE GetElementAtPosition( /* [in] */ ULONG32 nPosition, /* [out] */ ICorDebugValue **ppValue) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugArrayValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugArrayValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugArrayValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugArrayValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugArrayValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugArrayValue * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugArrayValue * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugArrayValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *IsValid )( + + HRESULT ( STDMETHODCALLTYPE *IsValid )( ICorDebugArrayValue * This, /* [out] */ BOOL *pbValid); - - HRESULT ( STDMETHODCALLTYPE *CreateRelocBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateRelocBreakpoint )( ICorDebugArrayValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *GetElementType )( + + HRESULT ( STDMETHODCALLTYPE *GetElementType )( ICorDebugArrayValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetRank )( + + HRESULT ( STDMETHODCALLTYPE *GetRank )( ICorDebugArrayValue * This, /* [out] */ ULONG32 *pnRank); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugArrayValue * This, /* [out] */ ULONG32 *pnCount); - - HRESULT ( STDMETHODCALLTYPE *GetDimensions )( + + HRESULT ( STDMETHODCALLTYPE *GetDimensions )( ICorDebugArrayValue * This, /* [in] */ ULONG32 cdim, /* [length_is][size_is][out] */ ULONG32 dims[ ]); - - HRESULT ( STDMETHODCALLTYPE *HasBaseIndicies )( + + HRESULT ( STDMETHODCALLTYPE *HasBaseIndicies )( ICorDebugArrayValue * This, /* [out] */ BOOL *pbHasBaseIndicies); - - HRESULT ( STDMETHODCALLTYPE *GetBaseIndicies )( + + HRESULT ( STDMETHODCALLTYPE *GetBaseIndicies )( ICorDebugArrayValue * This, /* [in] */ ULONG32 cdim, /* [length_is][size_is][out] */ ULONG32 indicies[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetElement )( + + HRESULT ( STDMETHODCALLTYPE *GetElement )( ICorDebugArrayValue * This, /* [in] */ ULONG32 cdim, /* [length_is][size_is][in] */ ULONG32 indices[ ], /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetElementAtPosition )( + + HRESULT ( STDMETHODCALLTYPE *GetElementAtPosition )( ICorDebugArrayValue * This, /* [in] */ ULONG32 nPosition, /* [out] */ ICorDebugValue **ppValue); - + END_INTERFACE } ICorDebugArrayValueVtbl; @@ -15594,64 +15685,64 @@ EXTERN_C const IID IID_ICorDebugArrayValue; CONST_VTBL struct ICorDebugArrayValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugArrayValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugArrayValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugArrayValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugArrayValue_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugArrayValue_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugArrayValue_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugArrayValue_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugArrayValue_IsValid(This,pbValid) \ - ( (This)->lpVtbl -> IsValid(This,pbValid) ) + ( (This)->lpVtbl -> IsValid(This,pbValid) ) #define ICorDebugArrayValue_CreateRelocBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateRelocBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateRelocBreakpoint(This,ppBreakpoint) ) #define ICorDebugArrayValue_GetElementType(This,pType) \ - ( (This)->lpVtbl -> GetElementType(This,pType) ) + ( (This)->lpVtbl -> GetElementType(This,pType) ) #define ICorDebugArrayValue_GetRank(This,pnRank) \ - ( (This)->lpVtbl -> GetRank(This,pnRank) ) + ( (This)->lpVtbl -> GetRank(This,pnRank) ) #define ICorDebugArrayValue_GetCount(This,pnCount) \ - ( (This)->lpVtbl -> GetCount(This,pnCount) ) + ( (This)->lpVtbl -> GetCount(This,pnCount) ) #define ICorDebugArrayValue_GetDimensions(This,cdim,dims) \ - ( (This)->lpVtbl -> GetDimensions(This,cdim,dims) ) + ( (This)->lpVtbl -> GetDimensions(This,cdim,dims) ) #define ICorDebugArrayValue_HasBaseIndicies(This,pbHasBaseIndicies) \ - ( (This)->lpVtbl -> HasBaseIndicies(This,pbHasBaseIndicies) ) + ( (This)->lpVtbl -> HasBaseIndicies(This,pbHasBaseIndicies) ) #define ICorDebugArrayValue_GetBaseIndicies(This,cdim,indicies) \ - ( (This)->lpVtbl -> GetBaseIndicies(This,cdim,indicies) ) + ( (This)->lpVtbl -> GetBaseIndicies(This,cdim,indicies) ) #define ICorDebugArrayValue_GetElement(This,cdim,indices,ppValue) \ - ( (This)->lpVtbl -> GetElement(This,cdim,indices,ppValue) ) + ( (This)->lpVtbl -> GetElement(This,cdim,indices,ppValue) ) #define ICorDebugArrayValue_GetElementAtPosition(This,nPosition,ppValue) \ - ( (This)->lpVtbl -> GetElementAtPosition(This,nPosition,ppValue) ) + ( (This)->lpVtbl -> GetElementAtPosition(This,nPosition,ppValue) ) #endif /* COBJMACROS */ @@ -15668,97 +15759,97 @@ EXTERN_C const IID IID_ICorDebugArrayValue; #define __ICorDebugVariableHome_INTERFACE_DEFINED__ /* interface ICorDebugVariableHome */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum VariableLocationType { VLT_REGISTER = 0, VLT_REGISTER_RELATIVE = ( VLT_REGISTER + 1 ) , - VLT_INVALID = ( VLT_REGISTER_RELATIVE + 1 ) + VLT_INVALID = ( VLT_REGISTER_RELATIVE + 1 ) } VariableLocationType; EXTERN_C const IID IID_ICorDebugVariableHome; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("50847b8d-f43f-41b0-924c-6383a5f2278b") ICorDebugVariableHome : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetCode( + virtual HRESULT STDMETHODCALLTYPE GetCode( /* [out] */ ICorDebugCode **ppCode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSlotIndex( + + virtual HRESULT STDMETHODCALLTYPE GetSlotIndex( /* [out] */ ULONG32 *pSlotIndex) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetArgumentIndex( + + virtual HRESULT STDMETHODCALLTYPE GetArgumentIndex( /* [out] */ ULONG32 *pArgumentIndex) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLiveRange( + + virtual HRESULT STDMETHODCALLTYPE GetLiveRange( /* [out] */ ULONG32 *pStartOffset, /* [out] */ ULONG32 *pEndOffset) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocationType( + + virtual HRESULT STDMETHODCALLTYPE GetLocationType( /* [out] */ VariableLocationType *pLocationType) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRegister( + + virtual HRESULT STDMETHODCALLTYPE GetRegister( /* [out] */ CorDebugRegister *pRegister) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetOffset( + + virtual HRESULT STDMETHODCALLTYPE GetOffset( /* [out] */ LONG *pOffset) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugVariableHomeVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugVariableHome * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugVariableHome * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugVariableHome * This); - - HRESULT ( STDMETHODCALLTYPE *GetCode )( + + HRESULT ( STDMETHODCALLTYPE *GetCode )( ICorDebugVariableHome * This, /* [out] */ ICorDebugCode **ppCode); - - HRESULT ( STDMETHODCALLTYPE *GetSlotIndex )( + + HRESULT ( STDMETHODCALLTYPE *GetSlotIndex )( ICorDebugVariableHome * This, /* [out] */ ULONG32 *pSlotIndex); - - HRESULT ( STDMETHODCALLTYPE *GetArgumentIndex )( + + HRESULT ( STDMETHODCALLTYPE *GetArgumentIndex )( ICorDebugVariableHome * This, /* [out] */ ULONG32 *pArgumentIndex); - - HRESULT ( STDMETHODCALLTYPE *GetLiveRange )( + + HRESULT ( STDMETHODCALLTYPE *GetLiveRange )( ICorDebugVariableHome * This, /* [out] */ ULONG32 *pStartOffset, /* [out] */ ULONG32 *pEndOffset); - - HRESULT ( STDMETHODCALLTYPE *GetLocationType )( + + HRESULT ( STDMETHODCALLTYPE *GetLocationType )( ICorDebugVariableHome * This, /* [out] */ VariableLocationType *pLocationType); - - HRESULT ( STDMETHODCALLTYPE *GetRegister )( + + HRESULT ( STDMETHODCALLTYPE *GetRegister )( ICorDebugVariableHome * This, /* [out] */ CorDebugRegister *pRegister); - - HRESULT ( STDMETHODCALLTYPE *GetOffset )( + + HRESULT ( STDMETHODCALLTYPE *GetOffset )( ICorDebugVariableHome * This, /* [out] */ LONG *pOffset); - + END_INTERFACE } ICorDebugVariableHomeVtbl; @@ -15767,41 +15858,41 @@ EXTERN_C const IID IID_ICorDebugVariableHome; CONST_VTBL struct ICorDebugVariableHomeVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugVariableHome_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugVariableHome_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugVariableHome_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugVariableHome_GetCode(This,ppCode) \ - ( (This)->lpVtbl -> GetCode(This,ppCode) ) + ( (This)->lpVtbl -> GetCode(This,ppCode) ) #define ICorDebugVariableHome_GetSlotIndex(This,pSlotIndex) \ - ( (This)->lpVtbl -> GetSlotIndex(This,pSlotIndex) ) + ( (This)->lpVtbl -> GetSlotIndex(This,pSlotIndex) ) #define ICorDebugVariableHome_GetArgumentIndex(This,pArgumentIndex) \ - ( (This)->lpVtbl -> GetArgumentIndex(This,pArgumentIndex) ) + ( (This)->lpVtbl -> GetArgumentIndex(This,pArgumentIndex) ) #define ICorDebugVariableHome_GetLiveRange(This,pStartOffset,pEndOffset) \ - ( (This)->lpVtbl -> GetLiveRange(This,pStartOffset,pEndOffset) ) + ( (This)->lpVtbl -> GetLiveRange(This,pStartOffset,pEndOffset) ) #define ICorDebugVariableHome_GetLocationType(This,pLocationType) \ - ( (This)->lpVtbl -> GetLocationType(This,pLocationType) ) + ( (This)->lpVtbl -> GetLocationType(This,pLocationType) ) #define ICorDebugVariableHome_GetRegister(This,pRegister) \ - ( (This)->lpVtbl -> GetRegister(This,pRegister) ) + ( (This)->lpVtbl -> GetRegister(This,pRegister) ) #define ICorDebugVariableHome_GetOffset(This,pOffset) \ - ( (This)->lpVtbl -> GetOffset(This,pOffset) ) + ( (This)->lpVtbl -> GetOffset(This,pOffset) ) #endif /* COBJMACROS */ @@ -15818,86 +15909,86 @@ EXTERN_C const IID IID_ICorDebugVariableHome; #define __ICorDebugHandleValue_INTERFACE_DEFINED__ /* interface ICorDebugHandleValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugHandleValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("029596E8-276B-46a1-9821-732E96BBB00B") ICorDebugHandleValue : public ICorDebugReferenceValue { public: - virtual HRESULT STDMETHODCALLTYPE GetHandleType( + virtual HRESULT STDMETHODCALLTYPE GetHandleType( /* [out] */ CorDebugHandleType *pType) = 0; - + virtual HRESULT STDMETHODCALLTYPE Dispose( void) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugHandleValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugHandleValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugHandleValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugHandleValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugHandleValue * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugHandleValue * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugHandleValue * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugHandleValue * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *IsNull )( + + HRESULT ( STDMETHODCALLTYPE *IsNull )( ICorDebugHandleValue * This, /* [out] */ BOOL *pbNull); - - HRESULT ( STDMETHODCALLTYPE *GetValue )( + + HRESULT ( STDMETHODCALLTYPE *GetValue )( ICorDebugHandleValue * This, /* [out] */ CORDB_ADDRESS *pValue); - - HRESULT ( STDMETHODCALLTYPE *SetValue )( + + HRESULT ( STDMETHODCALLTYPE *SetValue )( ICorDebugHandleValue * This, /* [in] */ CORDB_ADDRESS value); - - HRESULT ( STDMETHODCALLTYPE *Dereference )( + + HRESULT ( STDMETHODCALLTYPE *Dereference )( ICorDebugHandleValue * This, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *DereferenceStrong )( + + HRESULT ( STDMETHODCALLTYPE *DereferenceStrong )( ICorDebugHandleValue * This, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetHandleType )( + + HRESULT ( STDMETHODCALLTYPE *GetHandleType )( ICorDebugHandleValue * This, /* [out] */ CorDebugHandleType *pType); - - HRESULT ( STDMETHODCALLTYPE *Dispose )( + + HRESULT ( STDMETHODCALLTYPE *Dispose )( ICorDebugHandleValue * This); - + END_INTERFACE } ICorDebugHandleValueVtbl; @@ -15906,55 +15997,55 @@ EXTERN_C const IID IID_ICorDebugHandleValue; CONST_VTBL struct ICorDebugHandleValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugHandleValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugHandleValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugHandleValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugHandleValue_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugHandleValue_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugHandleValue_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugHandleValue_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugHandleValue_IsNull(This,pbNull) \ - ( (This)->lpVtbl -> IsNull(This,pbNull) ) + ( (This)->lpVtbl -> IsNull(This,pbNull) ) #define ICorDebugHandleValue_GetValue(This,pValue) \ - ( (This)->lpVtbl -> GetValue(This,pValue) ) + ( (This)->lpVtbl -> GetValue(This,pValue) ) #define ICorDebugHandleValue_SetValue(This,value) \ - ( (This)->lpVtbl -> SetValue(This,value) ) + ( (This)->lpVtbl -> SetValue(This,value) ) #define ICorDebugHandleValue_Dereference(This,ppValue) \ - ( (This)->lpVtbl -> Dereference(This,ppValue) ) + ( (This)->lpVtbl -> Dereference(This,ppValue) ) #define ICorDebugHandleValue_DereferenceStrong(This,ppValue) \ - ( (This)->lpVtbl -> DereferenceStrong(This,ppValue) ) + ( (This)->lpVtbl -> DereferenceStrong(This,ppValue) ) #define ICorDebugHandleValue_GetHandleType(This,pType) \ - ( (This)->lpVtbl -> GetHandleType(This,pType) ) + ( (This)->lpVtbl -> GetHandleType(This,pType) ) #define ICorDebugHandleValue_Dispose(This) \ - ( (This)->lpVtbl -> Dispose(This) ) + ( (This)->lpVtbl -> Dispose(This) ) #endif /* COBJMACROS */ @@ -15971,85 +16062,85 @@ EXTERN_C const IID IID_ICorDebugHandleValue; #define __ICorDebugContext_INTERFACE_DEFINED__ /* interface ICorDebugContext */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugContext; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB00-8A68-11d2-983C-0000F808342D") ICorDebugContext : public ICorDebugObjectValue { public: }; - - + + #else /* C style interface */ typedef struct ICorDebugContextVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugContext * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugContext * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugContext * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugContext * This, /* [out] */ CorElementType *pType); - - HRESULT ( STDMETHODCALLTYPE *GetSize )( + + HRESULT ( STDMETHODCALLTYPE *GetSize )( ICorDebugContext * This, /* [out] */ ULONG32 *pSize); - - HRESULT ( STDMETHODCALLTYPE *GetAddress )( + + HRESULT ( STDMETHODCALLTYPE *GetAddress )( ICorDebugContext * This, /* [out] */ CORDB_ADDRESS *pAddress); - - HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( + + HRESULT ( STDMETHODCALLTYPE *CreateBreakpoint )( ICorDebugContext * This, /* [out] */ ICorDebugValueBreakpoint **ppBreakpoint); - - HRESULT ( STDMETHODCALLTYPE *GetClass )( + + HRESULT ( STDMETHODCALLTYPE *GetClass )( ICorDebugContext * This, /* [out] */ ICorDebugClass **ppClass); - - HRESULT ( STDMETHODCALLTYPE *GetFieldValue )( + + HRESULT ( STDMETHODCALLTYPE *GetFieldValue )( ICorDebugContext * This, /* [in] */ ICorDebugClass *pClass, /* [in] */ mdFieldDef fieldDef, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetVirtualMethod )( + + HRESULT ( STDMETHODCALLTYPE *GetVirtualMethod )( ICorDebugContext * This, /* [in] */ mdMemberRef memberRef, /* [out] */ ICorDebugFunction **ppFunction); - - HRESULT ( STDMETHODCALLTYPE *GetContext )( + + HRESULT ( STDMETHODCALLTYPE *GetContext )( ICorDebugContext * This, /* [out] */ ICorDebugContext **ppContext); - - HRESULT ( STDMETHODCALLTYPE *IsValueClass )( + + HRESULT ( STDMETHODCALLTYPE *IsValueClass )( ICorDebugContext * This, /* [out] */ BOOL *pbIsValueClass); - - HRESULT ( STDMETHODCALLTYPE *GetManagedCopy )( + + HRESULT ( STDMETHODCALLTYPE *GetManagedCopy )( ICorDebugContext * This, /* [out] */ IUnknown **ppObject); - - HRESULT ( STDMETHODCALLTYPE *SetFromManagedCopy )( + + HRESULT ( STDMETHODCALLTYPE *SetFromManagedCopy )( ICorDebugContext * This, /* [in] */ IUnknown *pObject); - + END_INTERFACE } ICorDebugContextVtbl; @@ -16058,54 +16149,54 @@ EXTERN_C const IID IID_ICorDebugContext; CONST_VTBL struct ICorDebugContextVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugContext_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugContext_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugContext_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugContext_GetType(This,pType) \ - ( (This)->lpVtbl -> GetType(This,pType) ) + ( (This)->lpVtbl -> GetType(This,pType) ) #define ICorDebugContext_GetSize(This,pSize) \ - ( (This)->lpVtbl -> GetSize(This,pSize) ) + ( (This)->lpVtbl -> GetSize(This,pSize) ) #define ICorDebugContext_GetAddress(This,pAddress) \ - ( (This)->lpVtbl -> GetAddress(This,pAddress) ) + ( (This)->lpVtbl -> GetAddress(This,pAddress) ) #define ICorDebugContext_CreateBreakpoint(This,ppBreakpoint) \ - ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) + ( (This)->lpVtbl -> CreateBreakpoint(This,ppBreakpoint) ) #define ICorDebugContext_GetClass(This,ppClass) \ - ( (This)->lpVtbl -> GetClass(This,ppClass) ) + ( (This)->lpVtbl -> GetClass(This,ppClass) ) #define ICorDebugContext_GetFieldValue(This,pClass,fieldDef,ppValue) \ - ( (This)->lpVtbl -> GetFieldValue(This,pClass,fieldDef,ppValue) ) + ( (This)->lpVtbl -> GetFieldValue(This,pClass,fieldDef,ppValue) ) #define ICorDebugContext_GetVirtualMethod(This,memberRef,ppFunction) \ - ( (This)->lpVtbl -> GetVirtualMethod(This,memberRef,ppFunction) ) + ( (This)->lpVtbl -> GetVirtualMethod(This,memberRef,ppFunction) ) #define ICorDebugContext_GetContext(This,ppContext) \ - ( (This)->lpVtbl -> GetContext(This,ppContext) ) + ( (This)->lpVtbl -> GetContext(This,ppContext) ) #define ICorDebugContext_IsValueClass(This,pbIsValueClass) \ - ( (This)->lpVtbl -> IsValueClass(This,pbIsValueClass) ) + ( (This)->lpVtbl -> IsValueClass(This,pbIsValueClass) ) #define ICorDebugContext_GetManagedCopy(This,ppObject) \ - ( (This)->lpVtbl -> GetManagedCopy(This,ppObject) ) + ( (This)->lpVtbl -> GetManagedCopy(This,ppObject) ) #define ICorDebugContext_SetFromManagedCopy(This,pObject) \ - ( (This)->lpVtbl -> SetFromManagedCopy(This,pObject) ) + ( (This)->lpVtbl -> SetFromManagedCopy(This,pObject) ) #endif /* COBJMACROS */ @@ -16123,60 +16214,60 @@ EXTERN_C const IID IID_ICorDebugContext; #define __ICorDebugComObjectValue_INTERFACE_DEFINED__ /* interface ICorDebugComObjectValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugComObjectValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("5F69C5E5-3E12-42DF-B371-F9D761D6EE24") ICorDebugComObjectValue : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetCachedInterfaceTypes( + virtual HRESULT STDMETHODCALLTYPE GetCachedInterfaceTypes( /* [in] */ BOOL bIInspectableOnly, /* [out] */ ICorDebugTypeEnum **ppInterfacesEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCachedInterfacePointers( + + virtual HRESULT STDMETHODCALLTYPE GetCachedInterfacePointers( /* [in] */ BOOL bIInspectableOnly, /* [in] */ ULONG32 celt, /* [out] */ ULONG32 *pcEltFetched, /* [length_is][size_is][out] */ CORDB_ADDRESS *ptrs) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugComObjectValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugComObjectValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugComObjectValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugComObjectValue * This); - - HRESULT ( STDMETHODCALLTYPE *GetCachedInterfaceTypes )( + + HRESULT ( STDMETHODCALLTYPE *GetCachedInterfaceTypes )( ICorDebugComObjectValue * This, /* [in] */ BOOL bIInspectableOnly, /* [out] */ ICorDebugTypeEnum **ppInterfacesEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCachedInterfacePointers )( + + HRESULT ( STDMETHODCALLTYPE *GetCachedInterfacePointers )( ICorDebugComObjectValue * This, /* [in] */ BOOL bIInspectableOnly, /* [in] */ ULONG32 celt, /* [out] */ ULONG32 *pcEltFetched, /* [length_is][size_is][out] */ CORDB_ADDRESS *ptrs); - + END_INTERFACE } ICorDebugComObjectValueVtbl; @@ -16185,26 +16276,26 @@ EXTERN_C const IID IID_ICorDebugComObjectValue; CONST_VTBL struct ICorDebugComObjectValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugComObjectValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugComObjectValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugComObjectValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugComObjectValue_GetCachedInterfaceTypes(This,bIInspectableOnly,ppInterfacesEnum) \ - ( (This)->lpVtbl -> GetCachedInterfaceTypes(This,bIInspectableOnly,ppInterfacesEnum) ) + ( (This)->lpVtbl -> GetCachedInterfaceTypes(This,bIInspectableOnly,ppInterfacesEnum) ) #define ICorDebugComObjectValue_GetCachedInterfacePointers(This,bIInspectableOnly,celt,pcEltFetched,ptrs) \ - ( (This)->lpVtbl -> GetCachedInterfacePointers(This,bIInspectableOnly,celt,pcEltFetched,ptrs) ) + ( (This)->lpVtbl -> GetCachedInterfacePointers(This,bIInspectableOnly,celt,pcEltFetched,ptrs) ) #endif /* COBJMACROS */ @@ -16221,64 +16312,64 @@ EXTERN_C const IID IID_ICorDebugComObjectValue; #define __ICorDebugObjectEnum_INTERFACE_DEFINED__ /* interface ICorDebugObjectEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugObjectEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB02-8A68-11d2-983C-0000F808342D") ICorDebugObjectEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ CORDB_ADDRESS objects[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugObjectEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugObjectEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugObjectEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugObjectEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugObjectEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugObjectEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugObjectEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugObjectEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugObjectEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ CORDB_ADDRESS objects[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugObjectEnumVtbl; @@ -16287,36 +16378,36 @@ EXTERN_C const IID IID_ICorDebugObjectEnum; CONST_VTBL struct ICorDebugObjectEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugObjectEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugObjectEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugObjectEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugObjectEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugObjectEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugObjectEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugObjectEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugObjectEnum_Next(This,celt,objects,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,objects,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,objects,pceltFetched) ) #endif /* COBJMACROS */ @@ -16333,64 +16424,64 @@ EXTERN_C const IID IID_ICorDebugObjectEnum; #define __ICorDebugBreakpointEnum_INTERFACE_DEFINED__ /* interface ICorDebugBreakpointEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugBreakpointEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB03-8A68-11d2-983C-0000F808342D") ICorDebugBreakpointEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugBreakpoint *breakpoints[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugBreakpointEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugBreakpointEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugBreakpointEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugBreakpointEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugBreakpointEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugBreakpointEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugBreakpointEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugBreakpointEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugBreakpointEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugBreakpoint *breakpoints[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugBreakpointEnumVtbl; @@ -16399,36 +16490,36 @@ EXTERN_C const IID IID_ICorDebugBreakpointEnum; CONST_VTBL struct ICorDebugBreakpointEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugBreakpointEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugBreakpointEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugBreakpointEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugBreakpointEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugBreakpointEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugBreakpointEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugBreakpointEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugBreakpointEnum_Next(This,celt,breakpoints,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,breakpoints,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,breakpoints,pceltFetched) ) #endif /* COBJMACROS */ @@ -16445,64 +16536,64 @@ EXTERN_C const IID IID_ICorDebugBreakpointEnum; #define __ICorDebugStepperEnum_INTERFACE_DEFINED__ /* interface ICorDebugStepperEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugStepperEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB04-8A68-11d2-983C-0000F808342D") ICorDebugStepperEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugStepper *steppers[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugStepperEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugStepperEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugStepperEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugStepperEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugStepperEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugStepperEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugStepperEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugStepperEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugStepperEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugStepper *steppers[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugStepperEnumVtbl; @@ -16511,36 +16602,36 @@ EXTERN_C const IID IID_ICorDebugStepperEnum; CONST_VTBL struct ICorDebugStepperEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugStepperEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugStepperEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugStepperEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugStepperEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugStepperEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugStepperEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugStepperEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugStepperEnum_Next(This,celt,steppers,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,steppers,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,steppers,pceltFetched) ) #endif /* COBJMACROS */ @@ -16557,64 +16648,64 @@ EXTERN_C const IID IID_ICorDebugStepperEnum; #define __ICorDebugProcessEnum_INTERFACE_DEFINED__ /* interface ICorDebugProcessEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugProcessEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB05-8A68-11d2-983C-0000F808342D") ICorDebugProcessEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugProcess *processes[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugProcessEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugProcessEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugProcessEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugProcessEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugProcessEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugProcessEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugProcessEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugProcessEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugProcessEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugProcess *processes[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugProcessEnumVtbl; @@ -16623,36 +16714,36 @@ EXTERN_C const IID IID_ICorDebugProcessEnum; CONST_VTBL struct ICorDebugProcessEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugProcessEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugProcessEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugProcessEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugProcessEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugProcessEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugProcessEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugProcessEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugProcessEnum_Next(This,celt,processes,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,processes,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,processes,pceltFetched) ) #endif /* COBJMACROS */ @@ -16669,64 +16760,64 @@ EXTERN_C const IID IID_ICorDebugProcessEnum; #define __ICorDebugThreadEnum_INTERFACE_DEFINED__ /* interface ICorDebugThreadEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugThreadEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB06-8A68-11d2-983C-0000F808342D") ICorDebugThreadEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugThread *threads[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugThreadEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugThreadEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugThreadEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugThreadEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugThreadEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugThreadEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugThreadEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugThreadEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugThreadEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugThread *threads[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugThreadEnumVtbl; @@ -16735,36 +16826,36 @@ EXTERN_C const IID IID_ICorDebugThreadEnum; CONST_VTBL struct ICorDebugThreadEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugThreadEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugThreadEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugThreadEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugThreadEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugThreadEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugThreadEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugThreadEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugThreadEnum_Next(This,celt,threads,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,threads,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,threads,pceltFetched) ) #endif /* COBJMACROS */ @@ -16781,64 +16872,64 @@ EXTERN_C const IID IID_ICorDebugThreadEnum; #define __ICorDebugFrameEnum_INTERFACE_DEFINED__ /* interface ICorDebugFrameEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugFrameEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB07-8A68-11d2-983C-0000F808342D") ICorDebugFrameEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugFrame *frames[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugFrameEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugFrameEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugFrameEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugFrameEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugFrameEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugFrameEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugFrameEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugFrameEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugFrameEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugFrame *frames[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugFrameEnumVtbl; @@ -16847,36 +16938,36 @@ EXTERN_C const IID IID_ICorDebugFrameEnum; CONST_VTBL struct ICorDebugFrameEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugFrameEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugFrameEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugFrameEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugFrameEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugFrameEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugFrameEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugFrameEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugFrameEnum_Next(This,celt,frames,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,frames,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,frames,pceltFetched) ) #endif /* COBJMACROS */ @@ -16893,64 +16984,64 @@ EXTERN_C const IID IID_ICorDebugFrameEnum; #define __ICorDebugChainEnum_INTERFACE_DEFINED__ /* interface ICorDebugChainEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugChainEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB08-8A68-11d2-983C-0000F808342D") ICorDebugChainEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugChain *chains[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugChainEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugChainEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugChainEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugChainEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugChainEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugChainEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugChainEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugChainEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugChainEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugChain *chains[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugChainEnumVtbl; @@ -16959,36 +17050,36 @@ EXTERN_C const IID IID_ICorDebugChainEnum; CONST_VTBL struct ICorDebugChainEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugChainEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugChainEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugChainEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugChainEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugChainEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugChainEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugChainEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugChainEnum_Next(This,celt,chains,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,chains,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,chains,pceltFetched) ) #endif /* COBJMACROS */ @@ -17005,64 +17096,64 @@ EXTERN_C const IID IID_ICorDebugChainEnum; #define __ICorDebugModuleEnum_INTERFACE_DEFINED__ /* interface ICorDebugModuleEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugModuleEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB09-8A68-11d2-983C-0000F808342D") ICorDebugModuleEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugModule *modules[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugModuleEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugModuleEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugModuleEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugModuleEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugModuleEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugModuleEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugModuleEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugModuleEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugModuleEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugModule *modules[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugModuleEnumVtbl; @@ -17071,36 +17162,36 @@ EXTERN_C const IID IID_ICorDebugModuleEnum; CONST_VTBL struct ICorDebugModuleEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugModuleEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugModuleEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugModuleEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugModuleEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugModuleEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugModuleEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugModuleEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugModuleEnum_Next(This,celt,modules,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,modules,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,modules,pceltFetched) ) #endif /* COBJMACROS */ @@ -17117,64 +17208,64 @@ EXTERN_C const IID IID_ICorDebugModuleEnum; #define __ICorDebugValueEnum_INTERFACE_DEFINED__ /* interface ICorDebugValueEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugValueEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC7BCB0A-8A68-11d2-983C-0000F808342D") ICorDebugValueEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugValue *values[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugValueEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugValueEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugValueEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugValueEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugValueEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugValueEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugValueEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugValueEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugValueEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugValue *values[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugValueEnumVtbl; @@ -17183,36 +17274,36 @@ EXTERN_C const IID IID_ICorDebugValueEnum; CONST_VTBL struct ICorDebugValueEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugValueEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugValueEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugValueEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugValueEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugValueEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugValueEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugValueEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugValueEnum_Next(This,celt,values,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) #endif /* COBJMACROS */ @@ -17229,64 +17320,64 @@ EXTERN_C const IID IID_ICorDebugValueEnum; #define __ICorDebugVariableHomeEnum_INTERFACE_DEFINED__ /* interface ICorDebugVariableHomeEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugVariableHomeEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("e76b7a57-4f7a-4309-85a7-5d918c3deaf7") ICorDebugVariableHomeEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugVariableHome *homes[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugVariableHomeEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugVariableHomeEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugVariableHomeEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugVariableHomeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugVariableHomeEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugVariableHomeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugVariableHomeEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugVariableHomeEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugVariableHomeEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugVariableHome *homes[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugVariableHomeEnumVtbl; @@ -17295,36 +17386,36 @@ EXTERN_C const IID IID_ICorDebugVariableHomeEnum; CONST_VTBL struct ICorDebugVariableHomeEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugVariableHomeEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugVariableHomeEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugVariableHomeEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugVariableHomeEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugVariableHomeEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugVariableHomeEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugVariableHomeEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugVariableHomeEnum_Next(This,celt,homes,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,homes,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,homes,pceltFetched) ) #endif /* COBJMACROS */ @@ -17341,64 +17432,64 @@ EXTERN_C const IID IID_ICorDebugVariableHomeEnum; #define __ICorDebugCodeEnum_INTERFACE_DEFINED__ /* interface ICorDebugCodeEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugCodeEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("55E96461-9645-45e4-A2FF-0367877ABCDE") ICorDebugCodeEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugCode *values[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugCodeEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugCodeEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugCodeEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugCodeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugCodeEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugCodeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugCodeEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugCodeEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugCodeEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugCode *values[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugCodeEnumVtbl; @@ -17407,36 +17498,36 @@ EXTERN_C const IID IID_ICorDebugCodeEnum; CONST_VTBL struct ICorDebugCodeEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugCodeEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugCodeEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugCodeEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugCodeEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugCodeEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugCodeEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugCodeEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugCodeEnum_Next(This,celt,values,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) #endif /* COBJMACROS */ @@ -17453,64 +17544,64 @@ EXTERN_C const IID IID_ICorDebugCodeEnum; #define __ICorDebugTypeEnum_INTERFACE_DEFINED__ /* interface ICorDebugTypeEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugTypeEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("10F27499-9DF2-43ce-8333-A321D7C99CB4") ICorDebugTypeEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugType *values[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugTypeEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugTypeEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugTypeEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugTypeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugTypeEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugTypeEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugTypeEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugTypeEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugTypeEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugType *values[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugTypeEnumVtbl; @@ -17519,36 +17610,36 @@ EXTERN_C const IID IID_ICorDebugTypeEnum; CONST_VTBL struct ICorDebugTypeEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugTypeEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugTypeEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugTypeEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugTypeEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugTypeEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugTypeEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugTypeEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugTypeEnum_Next(This,celt,values,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) #endif /* COBJMACROS */ @@ -17565,91 +17656,91 @@ EXTERN_C const IID IID_ICorDebugTypeEnum; #define __ICorDebugType_INTERFACE_DEFINED__ /* interface ICorDebugType */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugType; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("D613F0BB-ACE1-4c19-BD72-E4C08D5DA7F5") ICorDebugType : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetType( + virtual HRESULT STDMETHODCALLTYPE GetType( /* [out] */ CorElementType *ty) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetClass( + + virtual HRESULT STDMETHODCALLTYPE GetClass( /* [out] */ ICorDebugClass **ppClass) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateTypeParameters( + + virtual HRESULT STDMETHODCALLTYPE EnumerateTypeParameters( /* [out] */ ICorDebugTypeEnum **ppTyParEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFirstTypeParameter( + + virtual HRESULT STDMETHODCALLTYPE GetFirstTypeParameter( /* [out] */ ICorDebugType **value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBase( + + virtual HRESULT STDMETHODCALLTYPE GetBase( /* [out] */ ICorDebugType **pBase) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStaticFieldValue( + + virtual HRESULT STDMETHODCALLTYPE GetStaticFieldValue( /* [in] */ mdFieldDef fieldDef, /* [in] */ ICorDebugFrame *pFrame, /* [out] */ ICorDebugValue **ppValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRank( + + virtual HRESULT STDMETHODCALLTYPE GetRank( /* [out] */ ULONG32 *pnRank) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugTypeVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugType * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugType * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugType * This); - - HRESULT ( STDMETHODCALLTYPE *GetType )( + + HRESULT ( STDMETHODCALLTYPE *GetType )( ICorDebugType * This, /* [out] */ CorElementType *ty); - - HRESULT ( STDMETHODCALLTYPE *GetClass )( + + HRESULT ( STDMETHODCALLTYPE *GetClass )( ICorDebugType * This, /* [out] */ ICorDebugClass **ppClass); - - HRESULT ( STDMETHODCALLTYPE *EnumerateTypeParameters )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateTypeParameters )( ICorDebugType * This, /* [out] */ ICorDebugTypeEnum **ppTyParEnum); - - HRESULT ( STDMETHODCALLTYPE *GetFirstTypeParameter )( + + HRESULT ( STDMETHODCALLTYPE *GetFirstTypeParameter )( ICorDebugType * This, /* [out] */ ICorDebugType **value); - - HRESULT ( STDMETHODCALLTYPE *GetBase )( + + HRESULT ( STDMETHODCALLTYPE *GetBase )( ICorDebugType * This, /* [out] */ ICorDebugType **pBase); - - HRESULT ( STDMETHODCALLTYPE *GetStaticFieldValue )( + + HRESULT ( STDMETHODCALLTYPE *GetStaticFieldValue )( ICorDebugType * This, /* [in] */ mdFieldDef fieldDef, /* [in] */ ICorDebugFrame *pFrame, /* [out] */ ICorDebugValue **ppValue); - - HRESULT ( STDMETHODCALLTYPE *GetRank )( + + HRESULT ( STDMETHODCALLTYPE *GetRank )( ICorDebugType * This, /* [out] */ ULONG32 *pnRank); - + END_INTERFACE } ICorDebugTypeVtbl; @@ -17658,41 +17749,41 @@ EXTERN_C const IID IID_ICorDebugType; CONST_VTBL struct ICorDebugTypeVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugType_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugType_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugType_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugType_GetType(This,ty) \ - ( (This)->lpVtbl -> GetType(This,ty) ) + ( (This)->lpVtbl -> GetType(This,ty) ) #define ICorDebugType_GetClass(This,ppClass) \ - ( (This)->lpVtbl -> GetClass(This,ppClass) ) + ( (This)->lpVtbl -> GetClass(This,ppClass) ) #define ICorDebugType_EnumerateTypeParameters(This,ppTyParEnum) \ - ( (This)->lpVtbl -> EnumerateTypeParameters(This,ppTyParEnum) ) + ( (This)->lpVtbl -> EnumerateTypeParameters(This,ppTyParEnum) ) #define ICorDebugType_GetFirstTypeParameter(This,value) \ - ( (This)->lpVtbl -> GetFirstTypeParameter(This,value) ) + ( (This)->lpVtbl -> GetFirstTypeParameter(This,value) ) #define ICorDebugType_GetBase(This,pBase) \ - ( (This)->lpVtbl -> GetBase(This,pBase) ) + ( (This)->lpVtbl -> GetBase(This,pBase) ) #define ICorDebugType_GetStaticFieldValue(This,fieldDef,pFrame,ppValue) \ - ( (This)->lpVtbl -> GetStaticFieldValue(This,fieldDef,pFrame,ppValue) ) + ( (This)->lpVtbl -> GetStaticFieldValue(This,fieldDef,pFrame,ppValue) ) #define ICorDebugType_GetRank(This,pnRank) \ - ( (This)->lpVtbl -> GetRank(This,pnRank) ) + ( (This)->lpVtbl -> GetRank(This,pnRank) ) #endif /* COBJMACROS */ @@ -17709,45 +17800,45 @@ EXTERN_C const IID IID_ICorDebugType; #define __ICorDebugType2_INTERFACE_DEFINED__ /* interface ICorDebugType2 */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugType2; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("e6e91d79-693d-48bc-b417-8284b4f10fb5") ICorDebugType2 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetTypeID( + virtual HRESULT STDMETHODCALLTYPE GetTypeID( /* [out] */ COR_TYPEID *id) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugType2Vtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugType2 * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugType2 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugType2 * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeID )( + + HRESULT ( STDMETHODCALLTYPE *GetTypeID )( ICorDebugType2 * This, /* [out] */ COR_TYPEID *id); - + END_INTERFACE } ICorDebugType2Vtbl; @@ -17756,23 +17847,23 @@ EXTERN_C const IID IID_ICorDebugType2; CONST_VTBL struct ICorDebugType2Vtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugType2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugType2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugType2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugType2_GetTypeID(This,id) \ - ( (This)->lpVtbl -> GetTypeID(This,id) ) + ( (This)->lpVtbl -> GetTypeID(This,id) ) #endif /* COBJMACROS */ @@ -17789,64 +17880,64 @@ EXTERN_C const IID IID_ICorDebugType2; #define __ICorDebugErrorInfoEnum_INTERFACE_DEFINED__ /* interface ICorDebugErrorInfoEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugErrorInfoEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("F0E18809-72B5-11d2-976F-00A0C9B4D50C") ICorDebugErrorInfoEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugEditAndContinueErrorInfo *errors[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugErrorInfoEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugErrorInfoEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugErrorInfoEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugErrorInfoEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugErrorInfoEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugErrorInfoEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugErrorInfoEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugErrorInfoEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugErrorInfoEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugEditAndContinueErrorInfo *errors[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugErrorInfoEnumVtbl; @@ -17855,36 +17946,36 @@ EXTERN_C const IID IID_ICorDebugErrorInfoEnum; CONST_VTBL struct ICorDebugErrorInfoEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugErrorInfoEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugErrorInfoEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugErrorInfoEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugErrorInfoEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugErrorInfoEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugErrorInfoEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugErrorInfoEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugErrorInfoEnum_Next(This,celt,errors,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,errors,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,errors,pceltFetched) ) #endif /* COBJMACROS */ @@ -17901,64 +17992,64 @@ EXTERN_C const IID IID_ICorDebugErrorInfoEnum; #define __ICorDebugAppDomainEnum_INTERFACE_DEFINED__ /* interface ICorDebugAppDomainEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugAppDomainEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("63ca1b24-4359-4883-bd57-13f815f58744") ICorDebugAppDomainEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugAppDomain *values[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugAppDomainEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugAppDomainEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugAppDomainEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugAppDomainEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugAppDomainEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugAppDomainEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugAppDomainEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugAppDomainEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugAppDomainEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugAppDomain *values[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugAppDomainEnumVtbl; @@ -17967,36 +18058,36 @@ EXTERN_C const IID IID_ICorDebugAppDomainEnum; CONST_VTBL struct ICorDebugAppDomainEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugAppDomainEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugAppDomainEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugAppDomainEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugAppDomainEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugAppDomainEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugAppDomainEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugAppDomainEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugAppDomainEnum_Next(This,celt,values,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) #endif /* COBJMACROS */ @@ -18013,64 +18104,64 @@ EXTERN_C const IID IID_ICorDebugAppDomainEnum; #define __ICorDebugAssemblyEnum_INTERFACE_DEFINED__ /* interface ICorDebugAssemblyEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugAssemblyEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("4a2a1ec9-85ec-4bfb-9f15-a89fdfe0fe83") ICorDebugAssemblyEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugAssembly *values[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugAssemblyEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugAssemblyEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugAssemblyEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugAssemblyEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugAssemblyEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugAssemblyEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugAssemblyEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugAssemblyEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugAssemblyEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ ICorDebugAssembly *values[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugAssemblyEnumVtbl; @@ -18079,36 +18170,36 @@ EXTERN_C const IID IID_ICorDebugAssemblyEnum; CONST_VTBL struct ICorDebugAssemblyEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugAssemblyEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugAssemblyEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugAssemblyEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugAssemblyEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugAssemblyEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugAssemblyEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugAssemblyEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugAssemblyEnum_Next(This,celt,values,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) #endif /* COBJMACROS */ @@ -18125,64 +18216,64 @@ EXTERN_C const IID IID_ICorDebugAssemblyEnum; #define __ICorDebugBlockingObjectEnum_INTERFACE_DEFINED__ /* interface ICorDebugBlockingObjectEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugBlockingObjectEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("976A6278-134A-4a81-81A3-8F277943F4C3") ICorDebugBlockingObjectEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ CorDebugBlockingObject values[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugBlockingObjectEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugBlockingObjectEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugBlockingObjectEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugBlockingObjectEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugBlockingObjectEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugBlockingObjectEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugBlockingObjectEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugBlockingObjectEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugBlockingObjectEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ CorDebugBlockingObject values[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugBlockingObjectEnumVtbl; @@ -18191,36 +18282,36 @@ EXTERN_C const IID IID_ICorDebugBlockingObjectEnum; CONST_VTBL struct ICorDebugBlockingObjectEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugBlockingObjectEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugBlockingObjectEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugBlockingObjectEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugBlockingObjectEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugBlockingObjectEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugBlockingObjectEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugBlockingObjectEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugBlockingObjectEnum_Next(This,celt,values,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) #endif /* COBJMACROS */ @@ -18233,23 +18324,23 @@ EXTERN_C const IID IID_ICorDebugBlockingObjectEnum; #endif /* __ICorDebugBlockingObjectEnum_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_cordebug_0000_0129 */ -/* [local] */ +/* interface __MIDL_itf_cordebug_0000_0130 */ +/* [local] */ #pragma warning(push) #pragma warning(disable:28718) -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0129_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0129_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0130_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0130_v0_0_s_ifspec; #ifndef __ICorDebugMDA_INTERFACE_DEFINED__ #define __ICorDebugMDA_INTERFACE_DEFINED__ /* interface ICorDebugMDA */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ -typedef +typedef enum CorDebugMDAFlags { MDA_FLAG_SLIP = 0x2 @@ -18259,79 +18350,79 @@ enum CorDebugMDAFlags EXTERN_C const IID IID_ICorDebugMDA; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("CC726F2F-1DB7-459b-B0EC-05F01D841B42") ICorDebugMDA : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetName( + virtual HRESULT STDMETHODCALLTYPE GetName( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDescription( + + virtual HRESULT STDMETHODCALLTYPE GetDescription( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetXML( + + virtual HRESULT STDMETHODCALLTYPE GetXML( /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlags( + + virtual HRESULT STDMETHODCALLTYPE GetFlags( /* [in] */ CorDebugMDAFlags *pFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetOSThreadId( + + virtual HRESULT STDMETHODCALLTYPE GetOSThreadId( /* [out] */ DWORD *pOsTid) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugMDAVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugMDA * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugMDA * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugMDA * This); - - HRESULT ( STDMETHODCALLTYPE *GetName )( + + HRESULT ( STDMETHODCALLTYPE *GetName )( ICorDebugMDA * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetDescription )( + + HRESULT ( STDMETHODCALLTYPE *GetDescription )( ICorDebugMDA * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetXML )( + + HRESULT ( STDMETHODCALLTYPE *GetXML )( ICorDebugMDA * This, /* [in] */ ULONG32 cchName, /* [out] */ ULONG32 *pcchName, /* [length_is][size_is][out] */ WCHAR szName[ ]); - - HRESULT ( STDMETHODCALLTYPE *GetFlags )( + + HRESULT ( STDMETHODCALLTYPE *GetFlags )( ICorDebugMDA * This, /* [in] */ CorDebugMDAFlags *pFlags); - - HRESULT ( STDMETHODCALLTYPE *GetOSThreadId )( + + HRESULT ( STDMETHODCALLTYPE *GetOSThreadId )( ICorDebugMDA * This, /* [out] */ DWORD *pOsTid); - + END_INTERFACE } ICorDebugMDAVtbl; @@ -18340,35 +18431,35 @@ EXTERN_C const IID IID_ICorDebugMDA; CONST_VTBL struct ICorDebugMDAVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugMDA_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugMDA_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugMDA_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugMDA_GetName(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetName(This,cchName,pcchName,szName) ) #define ICorDebugMDA_GetDescription(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetDescription(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetDescription(This,cchName,pcchName,szName) ) #define ICorDebugMDA_GetXML(This,cchName,pcchName,szName) \ - ( (This)->lpVtbl -> GetXML(This,cchName,pcchName,szName) ) + ( (This)->lpVtbl -> GetXML(This,cchName,pcchName,szName) ) #define ICorDebugMDA_GetFlags(This,pFlags) \ - ( (This)->lpVtbl -> GetFlags(This,pFlags) ) + ( (This)->lpVtbl -> GetFlags(This,pFlags) ) #define ICorDebugMDA_GetOSThreadId(This,pOsTid) \ - ( (This)->lpVtbl -> GetOSThreadId(This,pOsTid) ) + ( (This)->lpVtbl -> GetOSThreadId(This,pOsTid) ) #endif /* COBJMACROS */ @@ -18381,85 +18472,85 @@ EXTERN_C const IID IID_ICorDebugMDA; #endif /* __ICorDebugMDA_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_cordebug_0000_0130 */ -/* [local] */ +/* interface __MIDL_itf_cordebug_0000_0131 */ +/* [local] */ #pragma warning(pop) #pragma warning(push) -#pragma warning(disable:28718) +#pragma warning(disable:28718) -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0130_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0130_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0131_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0131_v0_0_s_ifspec; #ifndef __ICorDebugEditAndContinueErrorInfo_INTERFACE_DEFINED__ #define __ICorDebugEditAndContinueErrorInfo_INTERFACE_DEFINED__ /* interface ICorDebugEditAndContinueErrorInfo */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugEditAndContinueErrorInfo; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("8D600D41-F4F6-4cb3-B7EC-7BD164944036") ICorDebugEditAndContinueErrorInfo : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetModule( + virtual HRESULT STDMETHODCALLTYPE GetModule( /* [out] */ ICorDebugModule **ppModule) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetToken( + + virtual HRESULT STDMETHODCALLTYPE GetToken( /* [out] */ mdToken *pToken) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetErrorCode( + + virtual HRESULT STDMETHODCALLTYPE GetErrorCode( /* [out] */ HRESULT *pHr) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( + + virtual HRESULT STDMETHODCALLTYPE GetString( /* [in] */ ULONG32 cchString, /* [out] */ ULONG32 *pcchString, /* [length_is][size_is][out] */ WCHAR szString[ ]) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugEditAndContinueErrorInfoVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugEditAndContinueErrorInfo * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugEditAndContinueErrorInfo * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugEditAndContinueErrorInfo * This); - - HRESULT ( STDMETHODCALLTYPE *GetModule )( + + HRESULT ( STDMETHODCALLTYPE *GetModule )( ICorDebugEditAndContinueErrorInfo * This, /* [out] */ ICorDebugModule **ppModule); - - HRESULT ( STDMETHODCALLTYPE *GetToken )( + + HRESULT ( STDMETHODCALLTYPE *GetToken )( ICorDebugEditAndContinueErrorInfo * This, /* [out] */ mdToken *pToken); - - HRESULT ( STDMETHODCALLTYPE *GetErrorCode )( + + HRESULT ( STDMETHODCALLTYPE *GetErrorCode )( ICorDebugEditAndContinueErrorInfo * This, /* [out] */ HRESULT *pHr); - - HRESULT ( STDMETHODCALLTYPE *GetString )( + + HRESULT ( STDMETHODCALLTYPE *GetString )( ICorDebugEditAndContinueErrorInfo * This, /* [in] */ ULONG32 cchString, /* [out] */ ULONG32 *pcchString, /* [length_is][size_is][out] */ WCHAR szString[ ]); - + END_INTERFACE } ICorDebugEditAndContinueErrorInfoVtbl; @@ -18468,32 +18559,32 @@ EXTERN_C const IID IID_ICorDebugEditAndContinueErrorInfo; CONST_VTBL struct ICorDebugEditAndContinueErrorInfoVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugEditAndContinueErrorInfo_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugEditAndContinueErrorInfo_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugEditAndContinueErrorInfo_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugEditAndContinueErrorInfo_GetModule(This,ppModule) \ - ( (This)->lpVtbl -> GetModule(This,ppModule) ) + ( (This)->lpVtbl -> GetModule(This,ppModule) ) #define ICorDebugEditAndContinueErrorInfo_GetToken(This,pToken) \ - ( (This)->lpVtbl -> GetToken(This,pToken) ) + ( (This)->lpVtbl -> GetToken(This,pToken) ) #define ICorDebugEditAndContinueErrorInfo_GetErrorCode(This,pHr) \ - ( (This)->lpVtbl -> GetErrorCode(This,pHr) ) + ( (This)->lpVtbl -> GetErrorCode(This,pHr) ) #define ICorDebugEditAndContinueErrorInfo_GetString(This,cchString,pcchString,szString) \ - ( (This)->lpVtbl -> GetString(This,cchString,pcchString,szString) ) + ( (This)->lpVtbl -> GetString(This,cchString,pcchString,szString) ) #endif /* COBJMACROS */ @@ -18506,106 +18597,106 @@ EXTERN_C const IID IID_ICorDebugEditAndContinueErrorInfo; #endif /* __ICorDebugEditAndContinueErrorInfo_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_cordebug_0000_0131 */ -/* [local] */ +/* interface __MIDL_itf_cordebug_0000_0132 */ +/* [local] */ #pragma warning(pop) -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0131_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0131_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0132_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_cordebug_0000_0132_v0_0_s_ifspec; #ifndef __ICorDebugEditAndContinueSnapshot_INTERFACE_DEFINED__ #define __ICorDebugEditAndContinueSnapshot_INTERFACE_DEFINED__ /* interface ICorDebugEditAndContinueSnapshot */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugEditAndContinueSnapshot; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("6DC3FA01-D7CB-11d2-8A95-0080C792E5D8") ICorDebugEditAndContinueSnapshot : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE CopyMetaData( + virtual HRESULT STDMETHODCALLTYPE CopyMetaData( /* [in] */ IStream *pIStream, /* [out] */ GUID *pMvid) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMvid( + + virtual HRESULT STDMETHODCALLTYPE GetMvid( /* [out] */ GUID *pMvid) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRoDataRVA( + + virtual HRESULT STDMETHODCALLTYPE GetRoDataRVA( /* [out] */ ULONG32 *pRoDataRVA) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRwDataRVA( + + virtual HRESULT STDMETHODCALLTYPE GetRwDataRVA( /* [out] */ ULONG32 *pRwDataRVA) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPEBytes( + + virtual HRESULT STDMETHODCALLTYPE SetPEBytes( /* [in] */ IStream *pIStream) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetILMap( + + virtual HRESULT STDMETHODCALLTYPE SetILMap( /* [in] */ mdToken mdFunction, /* [in] */ ULONG cMapSize, /* [size_is][in] */ COR_IL_MAP map[ ]) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPESymbolBytes( + + virtual HRESULT STDMETHODCALLTYPE SetPESymbolBytes( /* [in] */ IStream *pIStream) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugEditAndContinueSnapshotVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugEditAndContinueSnapshot * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugEditAndContinueSnapshot * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugEditAndContinueSnapshot * This); - - HRESULT ( STDMETHODCALLTYPE *CopyMetaData )( + + HRESULT ( STDMETHODCALLTYPE *CopyMetaData )( ICorDebugEditAndContinueSnapshot * This, /* [in] */ IStream *pIStream, /* [out] */ GUID *pMvid); - - HRESULT ( STDMETHODCALLTYPE *GetMvid )( + + HRESULT ( STDMETHODCALLTYPE *GetMvid )( ICorDebugEditAndContinueSnapshot * This, /* [out] */ GUID *pMvid); - - HRESULT ( STDMETHODCALLTYPE *GetRoDataRVA )( + + HRESULT ( STDMETHODCALLTYPE *GetRoDataRVA )( ICorDebugEditAndContinueSnapshot * This, /* [out] */ ULONG32 *pRoDataRVA); - - HRESULT ( STDMETHODCALLTYPE *GetRwDataRVA )( + + HRESULT ( STDMETHODCALLTYPE *GetRwDataRVA )( ICorDebugEditAndContinueSnapshot * This, /* [out] */ ULONG32 *pRwDataRVA); - - HRESULT ( STDMETHODCALLTYPE *SetPEBytes )( + + HRESULT ( STDMETHODCALLTYPE *SetPEBytes )( ICorDebugEditAndContinueSnapshot * This, /* [in] */ IStream *pIStream); - - HRESULT ( STDMETHODCALLTYPE *SetILMap )( + + HRESULT ( STDMETHODCALLTYPE *SetILMap )( ICorDebugEditAndContinueSnapshot * This, /* [in] */ mdToken mdFunction, /* [in] */ ULONG cMapSize, /* [size_is][in] */ COR_IL_MAP map[ ]); - - HRESULT ( STDMETHODCALLTYPE *SetPESymbolBytes )( + + HRESULT ( STDMETHODCALLTYPE *SetPESymbolBytes )( ICorDebugEditAndContinueSnapshot * This, /* [in] */ IStream *pIStream); - + END_INTERFACE } ICorDebugEditAndContinueSnapshotVtbl; @@ -18614,41 +18705,41 @@ EXTERN_C const IID IID_ICorDebugEditAndContinueSnapshot; CONST_VTBL struct ICorDebugEditAndContinueSnapshotVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugEditAndContinueSnapshot_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugEditAndContinueSnapshot_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugEditAndContinueSnapshot_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugEditAndContinueSnapshot_CopyMetaData(This,pIStream,pMvid) \ - ( (This)->lpVtbl -> CopyMetaData(This,pIStream,pMvid) ) + ( (This)->lpVtbl -> CopyMetaData(This,pIStream,pMvid) ) #define ICorDebugEditAndContinueSnapshot_GetMvid(This,pMvid) \ - ( (This)->lpVtbl -> GetMvid(This,pMvid) ) + ( (This)->lpVtbl -> GetMvid(This,pMvid) ) #define ICorDebugEditAndContinueSnapshot_GetRoDataRVA(This,pRoDataRVA) \ - ( (This)->lpVtbl -> GetRoDataRVA(This,pRoDataRVA) ) + ( (This)->lpVtbl -> GetRoDataRVA(This,pRoDataRVA) ) #define ICorDebugEditAndContinueSnapshot_GetRwDataRVA(This,pRwDataRVA) \ - ( (This)->lpVtbl -> GetRwDataRVA(This,pRwDataRVA) ) + ( (This)->lpVtbl -> GetRwDataRVA(This,pRwDataRVA) ) #define ICorDebugEditAndContinueSnapshot_SetPEBytes(This,pIStream) \ - ( (This)->lpVtbl -> SetPEBytes(This,pIStream) ) + ( (This)->lpVtbl -> SetPEBytes(This,pIStream) ) #define ICorDebugEditAndContinueSnapshot_SetILMap(This,mdFunction,cMapSize,map) \ - ( (This)->lpVtbl -> SetILMap(This,mdFunction,cMapSize,map) ) + ( (This)->lpVtbl -> SetILMap(This,mdFunction,cMapSize,map) ) #define ICorDebugEditAndContinueSnapshot_SetPESymbolBytes(This,pIStream) \ - ( (This)->lpVtbl -> SetPESymbolBytes(This,pIStream) ) + ( (This)->lpVtbl -> SetPESymbolBytes(This,pIStream) ) #endif /* COBJMACROS */ @@ -18665,64 +18756,64 @@ EXTERN_C const IID IID_ICorDebugEditAndContinueSnapshot; #define __ICorDebugExceptionObjectCallStackEnum_INTERFACE_DEFINED__ /* interface ICorDebugExceptionObjectCallStackEnum */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugExceptionObjectCallStackEnum; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("ED775530-4DC4-41F7-86D0-9E2DEF7DFC66") ICorDebugExceptionObjectCallStackEnum : public ICorDebugEnum { public: - virtual HRESULT STDMETHODCALLTYPE Next( + virtual HRESULT STDMETHODCALLTYPE Next( /* [in] */ ULONG celt, /* [length_is][size_is][out] */ CorDebugExceptionObjectStackFrame values[ ], /* [out] */ ULONG *pceltFetched) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugExceptionObjectCallStackEnumVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugExceptionObjectCallStackEnum * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugExceptionObjectCallStackEnum * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugExceptionObjectCallStackEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Skip )( + + HRESULT ( STDMETHODCALLTYPE *Skip )( ICorDebugExceptionObjectCallStackEnum * This, /* [in] */ ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( + + HRESULT ( STDMETHODCALLTYPE *Reset )( ICorDebugExceptionObjectCallStackEnum * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( + + HRESULT ( STDMETHODCALLTYPE *Clone )( ICorDebugExceptionObjectCallStackEnum * This, /* [out] */ ICorDebugEnum **ppEnum); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( + + HRESULT ( STDMETHODCALLTYPE *GetCount )( ICorDebugExceptionObjectCallStackEnum * This, /* [out] */ ULONG *pcelt); - - HRESULT ( STDMETHODCALLTYPE *Next )( + + HRESULT ( STDMETHODCALLTYPE *Next )( ICorDebugExceptionObjectCallStackEnum * This, /* [in] */ ULONG celt, /* [length_is][size_is][out] */ CorDebugExceptionObjectStackFrame values[ ], /* [out] */ ULONG *pceltFetched); - + END_INTERFACE } ICorDebugExceptionObjectCallStackEnumVtbl; @@ -18731,36 +18822,36 @@ EXTERN_C const IID IID_ICorDebugExceptionObjectCallStackEnum; CONST_VTBL struct ICorDebugExceptionObjectCallStackEnumVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugExceptionObjectCallStackEnum_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugExceptionObjectCallStackEnum_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugExceptionObjectCallStackEnum_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugExceptionObjectCallStackEnum_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) + ( (This)->lpVtbl -> Skip(This,celt) ) #define ICorDebugExceptionObjectCallStackEnum_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) + ( (This)->lpVtbl -> Reset(This) ) #define ICorDebugExceptionObjectCallStackEnum_Clone(This,ppEnum) \ - ( (This)->lpVtbl -> Clone(This,ppEnum) ) + ( (This)->lpVtbl -> Clone(This,ppEnum) ) #define ICorDebugExceptionObjectCallStackEnum_GetCount(This,pcelt) \ - ( (This)->lpVtbl -> GetCount(This,pcelt) ) + ( (This)->lpVtbl -> GetCount(This,pcelt) ) #define ICorDebugExceptionObjectCallStackEnum_Next(This,celt,values,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) + ( (This)->lpVtbl -> Next(This,celt,values,pceltFetched) ) #endif /* COBJMACROS */ @@ -18777,45 +18868,45 @@ EXTERN_C const IID IID_ICorDebugExceptionObjectCallStackEnum; #define __ICorDebugExceptionObjectValue_INTERFACE_DEFINED__ /* interface ICorDebugExceptionObjectValue */ -/* [unique][uuid][local][object] */ +/* [unique][uuid][local][object] */ EXTERN_C const IID IID_ICorDebugExceptionObjectValue; #if defined(__cplusplus) && !defined(CINTERFACE) - + MIDL_INTERFACE("AE4CA65D-59DD-42A2-83A5-57E8A08D8719") ICorDebugExceptionObjectValue : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE EnumerateExceptionCallStack( + virtual HRESULT STDMETHODCALLTYPE EnumerateExceptionCallStack( /* [out] */ ICorDebugExceptionObjectCallStackEnum **ppCallStackEnum) = 0; - + }; - - + + #else /* C style interface */ typedef struct ICorDebugExceptionObjectValueVtbl { BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( ICorDebugExceptionObjectValue * This, /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ + /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( ICorDebugExceptionObjectValue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugExceptionObjectValue * This); - - HRESULT ( STDMETHODCALLTYPE *EnumerateExceptionCallStack )( + + HRESULT ( STDMETHODCALLTYPE *EnumerateExceptionCallStack )( ICorDebugExceptionObjectValue * This, /* [out] */ ICorDebugExceptionObjectCallStackEnum **ppCallStackEnum); - + END_INTERFACE } ICorDebugExceptionObjectValueVtbl; @@ -18824,23 +18915,23 @@ EXTERN_C const IID IID_ICorDebugExceptionObjectValue; CONST_VTBL struct ICorDebugExceptionObjectValueVtbl *lpVtbl; }; - + #ifdef COBJMACROS #define ICorDebugExceptionObjectValue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define ICorDebugExceptionObjectValue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) + ( (This)->lpVtbl -> AddRef(This) ) #define ICorDebugExceptionObjectValue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) + ( (This)->lpVtbl -> Release(This) ) #define ICorDebugExceptionObjectValue_EnumerateExceptionCallStack(This,ppCallStackEnum) \ - ( (This)->lpVtbl -> EnumerateExceptionCallStack(This,ppCallStackEnum) ) + ( (This)->lpVtbl -> EnumerateExceptionCallStack(This,ppCallStackEnum) ) #endif /* COBJMACROS */ @@ -18858,7 +18949,7 @@ EXTERN_C const IID IID_ICorDebugExceptionObjectValue; #define __CORDBLib_LIBRARY_DEFINED__ /* library CORDBLib */ -/* [helpstring][version][uuid] */ +/* [helpstring][version][uuid] */ @@ -18919,5 +19010,3 @@ EmbeddedCLRCorDebug; #endif #endif - - diff --git a/src/coreclr/pal/src/arch/arm64/context2.S b/src/coreclr/pal/src/arch/arm64/context2.S index 2ebce4b440048e..12e5acf305cfd9 100644 --- a/src/coreclr/pal/src/arch/arm64/context2.S +++ b/src/coreclr/pal/src/arch/arm64/context2.S @@ -204,12 +204,11 @@ LOCAL_LABEL(No_Restore_CONTEXT_INTEGER): ldr w17, [x16, CONTEXT_Cpsr] msr nzcv, x17 ldp fp, lr, [x16, CONTEXT_Fp] - ldr x17, [x16, CONTEXT_Sp] - mov sp, x17 - ldr x17, [x16, CONTEXT_Pc] + ldp x16, x17, [x16, CONTEXT_Sp] // Context_Pc is right after Context_Sp + mov sp, x16 br x17 LOCAL_LABEL(No_Restore_CONTEXT_CONTROL): - ret + ret LEAF_END RtlRestoreContext, _TEXT diff --git a/src/coreclr/pal/src/config.h.in b/src/coreclr/pal/src/config.h.in index c68421302e1153..1de7a61dd6c524 100644 --- a/src/coreclr/pal/src/config.h.in +++ b/src/coreclr/pal/src/config.h.in @@ -68,6 +68,7 @@ #cmakedefine01 HAVE_SCHED_SETAFFINITY #cmakedefine HAVE_UNW_GET_SAVE_LOC #cmakedefine HAVE_UNW_GET_ACCESSORS +#cmakedefine HAVE_UNW_AARCH64_X19 #cmakedefine01 HAVE_XSWDEV #cmakedefine01 HAVE_XSW_USAGE #cmakedefine01 HAVE_PUBLIC_XSTATE_STRUCT diff --git a/src/coreclr/pal/src/configure.cmake b/src/coreclr/pal/src/configure.cmake index ee4a3241196eaa..80d257fa349b60 100644 --- a/src/coreclr/pal/src/configure.cmake +++ b/src/coreclr/pal/src/configure.cmake @@ -1047,6 +1047,15 @@ int main(int argc, char **argv) check_symbol_exists(unw_get_save_loc libunwind.h HAVE_UNW_GET_SAVE_LOC) check_symbol_exists(unw_get_accessors libunwind.h HAVE_UNW_GET_ACCESSORS) +check_cxx_source_compiles(" +#include + +int main(int argc, char **argv) +{ + int flag = (int)UNW_AARCH64_X19; + return 0; +}" HAVE_UNW_AARCH64_X19) + if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND) list(REMOVE_AT CMAKE_REQUIRED_INCLUDES 0 1) endif() 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/machmessage.h b/src/coreclr/pal/src/exception/machmessage.h index c24a979f52089d..a51d89890f6e15 100644 --- a/src/coreclr/pal/src/exception/machmessage.h +++ b/src/coreclr/pal/src/exception/machmessage.h @@ -21,7 +21,7 @@ using namespace CorUnix; #if HAVE_MACH_EXCEPTIONS -#if defined(HOST_AMD64) +#if defined(HOST_64BIT) #define MACH_EH_TYPE(x) mach_##x #else #define MACH_EH_TYPE(x) x diff --git a/src/coreclr/pal/src/exception/remote-unwind.cpp b/src/coreclr/pal/src/exception/remote-unwind.cpp index af0293ba5bc60c..f468cab68cc1e1 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 @@ -168,7 +169,7 @@ typedef struct _libunwindInfo UnwindReadMemoryCallback ReadMemory; } libunwindInfo; -#if defined(__APPLE__) || defined(FEATURE_USE_SYSTEM_LIBUNWIND) +#ifdef HOST_UNIX #define EXTRACT_BITS(value, mask) ((value >> __builtin_ctz(mask)) & (((1 << __builtin_popcount(mask))) - 1)) @@ -526,6 +527,10 @@ ReadEncodedPointer( return true; } +#endif // HOST_UNIX + +#if defined(__APPLE__) || defined(FEATURE_USE_SYSTEM_LIBUNWIND) + template static bool BinarySearchEntries( @@ -1309,6 +1314,14 @@ GetProcInfo(unw_word_t ip, unw_proc_info_t *pip, libunwindInfo* info, bool* step return false; } +//===-- CompactUnwindInfo.cpp ---------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + #if defined(TARGET_AMD64) static bool @@ -1380,6 +1393,163 @@ StepWithCompactEncodingRBPFrame(const libunwindInfo* info, compact_unwind_encodi return true; } +static bool +StepWithCompactEncodingFrameless(const libunwindInfo* info, compact_unwind_encoding_t compactEncoding, unw_word_t functionStart) +{ + int mode = compactEncoding & UNWIND_X86_64_MODE_MASK; + CONTEXT* context = info->Context; + + uint32_t stack_size = EXTRACT_BITS(compactEncoding, UNWIND_X86_64_FRAMELESS_STACK_SIZE); + uint32_t register_count = EXTRACT_BITS(compactEncoding, UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT); + uint32_t permutation = EXTRACT_BITS(compactEncoding, UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION); + + if (mode == UNWIND_X86_64_MODE_STACK_IND) + { + _ASSERTE(functionStart != 0); + unw_word_t addr = functionStart + stack_size; + if (!ReadValue32(info, &addr, &stack_size)) { + return false; + } + uint32_t stack_adjust = EXTRACT_BITS(compactEncoding, UNWIND_X86_64_FRAMELESS_STACK_ADJUST); + stack_size += stack_adjust * 8; + } + else + { + stack_size *= 8; + } + + TRACE("Frameless function: encoding %08x stack size %d register count %d\n", compactEncoding, stack_size, register_count); + + // We need to include (up to) 6 registers in 10 bits. + // That would be 18 bits if we just used 3 bits per reg to indicate + // the order they're saved on the stack. + // + // This is done with Lehmer code permutation, e.g. see + // http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms + int permunreg[6]; + + // This decodes the variable-base number in the 10 bits + // and gives us the Lehmer code sequence which can then + // be decoded. + switch (register_count) { + case 6: + permunreg[0] = permutation / 120; // 120 == 5! + permutation -= (permunreg[0] * 120); + permunreg[1] = permutation / 24; // 24 == 4! + permutation -= (permunreg[1] * 24); + permunreg[2] = permutation / 6; // 6 == 3! + permutation -= (permunreg[2] * 6); + permunreg[3] = permutation / 2; // 2 == 2! + permutation -= (permunreg[3] * 2); + permunreg[4] = permutation; // 1 == 1! + permunreg[5] = 0; + break; + case 5: + permunreg[0] = permutation / 120; + permutation -= (permunreg[0] * 120); + permunreg[1] = permutation / 24; + permutation -= (permunreg[1] * 24); + permunreg[2] = permutation / 6; + permutation -= (permunreg[2] * 6); + permunreg[3] = permutation / 2; + permutation -= (permunreg[3] * 2); + permunreg[4] = permutation; + break; + case 4: + permunreg[0] = permutation / 60; + permutation -= (permunreg[0] * 60); + permunreg[1] = permutation / 12; + permutation -= (permunreg[1] * 12); + permunreg[2] = permutation / 3; + permutation -= (permunreg[2] * 3); + permunreg[3] = permutation; + break; + case 3: + permunreg[0] = permutation / 20; + permutation -= (permunreg[0] * 20); + permunreg[1] = permutation / 4; + permutation -= (permunreg[1] * 4); + permunreg[2] = permutation; + break; + case 2: + permunreg[0] = permutation / 5; + permutation -= (permunreg[0] * 5); + permunreg[1] = permutation; + break; + case 1: + permunreg[0] = permutation; + break; + } + + // Decode the Lehmer code for this permutation of + // the registers v. http://en.wikipedia.org/wiki/Lehmer_code + int registers[6] = {UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, + UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, + UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE}; + bool used[7] = {false, false, false, false, false, false, false}; + for (int i = 0; i < register_count; i++) + { + int renum = 0; + for (int j = 1; j < 7; j++) + { + if (!used[j]) + { + if (renum == permunreg[i]) + { + registers[i] = j; + used[j] = true; + break; + } + renum++; + } + } + } + + uint64_t savedRegisters = context->Rsp + stack_size - 8 - (8 * register_count); + for (int i = 0; i < register_count; i++) + { + uint64_t reg; + if (!ReadValue64(info, &savedRegisters, ®)) { + return false; + } + switch (registers[i]) { + case UNWIND_X86_64_REG_RBX: + context->Rbx = reg; + break; + case UNWIND_X86_64_REG_R12: + context->R12 = reg; + break; + case UNWIND_X86_64_REG_R13: + context->R13 = reg; + break; + case UNWIND_X86_64_REG_R14: + context->R14 = reg; + break; + case UNWIND_X86_64_REG_R15: + context->R15 = reg; + break; + case UNWIND_X86_64_REG_RBP: + context->Rbp = reg; + break; + default: + ERROR("Bad register for frameless\n"); + break; + } + } + + // Now unwind the frame + uint64_t ip; + if (!ReadValue64(info, &savedRegisters, &ip)) { + return false; + } + context->Rip = ip; + context->Rsp = savedRegisters; + + TRACE("SUCCESS: frameless encoding %08x rip %p rsp %p rbp %p\n", + compactEncoding, (void*)context->Rip, (void*)context->Rsp, (void*)context->Rbp); + return true; +} + #define AMD64_SYSCALL_OPCODE 0x050f static bool @@ -1422,25 +1592,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 +1651,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 +1685,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 +1745,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 +1759,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: @@ -1569,17 +1771,12 @@ StepWithCompactEncoding(const libunwindInfo* info, compact_unwind_encoding_t com case UNWIND_X86_64_MODE_STACK_IMMD: case UNWIND_X86_64_MODE_STACK_IND: - break; + return StepWithCompactEncodingFrameless(info, compactEncoding, functionStart); case UNWIND_X86_64_MODE_DWARF: 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 +1914,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); @@ -1979,7 +2182,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pip, int nee } #ifdef FEATURE_USE_SYSTEM_LIBUNWIND - if (ehFrameHdrAddr == 0) { + if (ehFrameHdrAddr == 0) { ASSERT("ELF: No PT_GNU_EH_FRAME program header\n"); return -UNW_EINVAL; } @@ -2126,6 +2329,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 @@ -2176,6 +2406,148 @@ PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *cont return result; } +BOOL +PALAPI +PAL_GetUnwindInfoSize(SIZE_T baseAddress, ULONG64 ehFrameHdrAddr, UnwindReadMemoryCallback readMemoryCallback, PULONG64 ehFrameStart, PULONG64 ehFrameSize) +{ + _ASSERTE(ehFrameStart != nullptr); + _ASSERTE(ehFrameSize != nullptr); + _ASSERTE(ehFrameHdrAddr != 0); + *ehFrameStart = 0; + *ehFrameSize = 0; + +#ifdef HOST_UNIX + libunwindInfo info; + info.BaseAddress = baseAddress; + info.Context = nullptr; + info.FunctionStart = 0; + info.ReadMemory = readMemoryCallback; + + eh_frame_hdr ehFrameHdr; + if (!info.ReadMemory((PVOID)ehFrameHdrAddr, &ehFrameHdr, sizeof(eh_frame_hdr))) { + ERROR("ELF: reading ehFrameHdrAddr %p\n", ehFrameHdrAddr); + return FALSE; + } + TRACE("ehFrameHdrAddr %p version %d eh_frame_ptr_enc %d fde_count_enc %d table_enc %d\n", + ehFrameHdrAddr, ehFrameHdr.version, ehFrameHdr.eh_frame_ptr_enc, ehFrameHdr.fde_count_enc, ehFrameHdr.table_enc); + + if (ehFrameHdr.version != DW_EH_VERSION) { + ASSERT("ehFrameHdr version %x not supported\n", ehFrameHdr.version); + return FALSE; + } + unw_word_t addr = ehFrameHdrAddr + sizeof(eh_frame_hdr); + unw_word_t ehFramePtr; + unw_word_t fdeCount; + + // Decode the eh_frame_hdr info + if (!ReadEncodedPointer(&info, &addr, ehFrameHdr.eh_frame_ptr_enc, UINTPTR_MAX, &ehFramePtr)) { + ERROR("decoding eh_frame_ptr\n"); + return FALSE; + } + if (!ReadEncodedPointer(&info, &addr, ehFrameHdr.fde_count_enc, UINTPTR_MAX, &fdeCount)) { + ERROR("decoding fde_count_enc\n"); + return FALSE; + } + TRACE("ehFrameStart %p fdeCount %p\n", ehFrameStart, fdeCount); + + // If there are no frame table entries + if (fdeCount == 0) { + TRACE("No frame table entries\n"); + return FALSE; + } + + uint64_t totalSize = 0; + uint64_t encounteredCieCount = 0; + uint64_t encounteredFdeCount = 0; + addr = ehFramePtr; + + while (true) + { + bool is64BitEncoding = false; + uint64_t initialLength = 0; + uint32_t initialLength32; + + if (!ReadValue32(&info, &addr, &initialLength32)) { + return FALSE; + } + totalSize += sizeof(initialLength32); + + if (initialLength32 >= 0xfffffff0) + { + if (initialLength32 == 0xffffffff) + { + // 64 bit encoding + is64BitEncoding = true; + if (!ReadValue64(&info, &addr, &initialLength)) { + return FALSE; + } + totalSize += sizeof(initialLength); + } + else + { + ASSERT("Length encoding not supported: %08x\n", initialLength32); + return FALSE; + } + } + else + { + // 32 bit encoding + initialLength = static_cast(initialLength32); + } + + if (initialLength == 0) + { + break; + } + + // "addr" either points to a CIE_id in a CIE or CIE_ptr in a FDE. A value of zero indicates a CIE. + uint64_t ciePtr; + if (is64BitEncoding) + { + if (!ReadValue64(&info, &addr, &ciePtr)) { + return FALSE; + } + addr -= sizeof(ciePtr); + } + else + { + uint32_t ciePtr32; + if (!ReadValue32(&info, &addr, &ciePtr32)) { + return FALSE; + } + addr -= sizeof(ciePtr32); + ciePtr = static_cast(ciePtr32); + } + + if (ciePtr == 0) + { + encounteredCieCount++; + } + else + { + encounteredFdeCount++; + } + + totalSize += initialLength; + addr += initialLength; + + // If we've seen more FDEs than expected, somehow either the header is inconsistent or we overread the end of the table. + if (encounteredFdeCount >= fdeCount) + { + break; + } + } + + _ASSERTE(encounteredFdeCount == fdeCount); + + *ehFrameStart = ehFramePtr; + *ehFrameSize = totalSize; + return TRUE; +#else + return FALSE; +#endif // HOST_UNIX +} + #else BOOL @@ -2185,4 +2557,11 @@ PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *cont return FALSE; } +BOOL +PALAPI +PAL_GetUnwindInfoSize(SIZE_T baseAddress, ULONG64 ehFrameHdrAddr, UnwindReadMemoryCallback readMemoryCallback, PULONG64 ehFrameStart, PULONG64 ehFrameSize) +{ + return FALSE; +} + #endif // defined(__APPLE__) || defined(HAVE_UNW_GET_ACCESSORS) diff --git a/src/coreclr/pal/src/exception/seh-unwind.cpp b/src/coreclr/pal/src/exception/seh-unwind.cpp index 9a1f5d0b5e89d4..d1028feaeadac2 100644 --- a/src/coreclr/pal/src/exception/seh-unwind.cpp +++ b/src/coreclr/pal/src/exception/seh-unwind.cpp @@ -54,7 +54,7 @@ Module Name: #endif // HOST_UNIX -#if defined(TARGET_OSX) && defined(TARGET_ARM64) +#if defined(TARGET_OSX) && defined(TARGET_ARM64) && !defined(HAVE_UNW_AARCH64_X19) // MacOS uses ARM64 instead of AARCH64 to describe these registers // Create aliases to reuse more code enum @@ -476,7 +476,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) { @@ -486,19 +488,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) { diff --git a/src/coreclr/pal/src/exception/signal.cpp b/src/coreclr/pal/src/exception/signal.cpp index cbcd1cac6f226e..f4c7989bf8ab94 100644 --- a/src/coreclr/pal/src/exception/signal.cpp +++ b/src/coreclr/pal/src/exception/signal.cpp @@ -114,10 +114,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; @@ -286,22 +282,6 @@ void SEHCleanupSignals() } } -/*++ -Function : - SEHCleanupAbort() - - Restore default SIGABORT signal handlers - - (no parameters, no return value) ---*/ -void SEHCleanupAbort() -{ - if (g_registered_signal_handlers) - { - restore_signal(SIGABRT, &g_previous_sigabrt); - } -} - /* internal function definitions **********************************************/ /*++ @@ -388,7 +368,7 @@ static void invoke_previous_action(struct sigaction* action, int code, siginfo_t if (signalRestarts) { // This signal mustn't be ignored because it will be restarted. - PROCAbort(code); + PROCAbort(code, siginfo); } return; } @@ -403,7 +383,7 @@ static void invoke_previous_action(struct sigaction* action, int code, siginfo_t { // We can't invoke the original handler because returning from the // handler doesn't restart the exception. - PROCAbort(code); + PROCAbort(code, siginfo); } } else if (IsSaSigInfo(action)) @@ -421,7 +401,7 @@ static void invoke_previous_action(struct sigaction* action, int code, siginfo_t PROCNotifyProcessShutdown(IsRunningOnAlternateStack(context)); - PROCCreateCrashDumpIfEnabled(code); + PROCCreateCrashDumpIfEnabled(code, siginfo); } /*++ @@ -593,13 +573,13 @@ static void sigsegv_handler(int code, siginfo_t *siginfo, void *context) if (SwitchStackAndExecuteHandler(code | StackOverflowFlag, siginfo, context, (size_t)handlerStackTop)) { - PROCAbort(SIGSEGV); + PROCAbort(SIGSEGV, siginfo); } } else { (void)!write(STDERR_FILENO, StackOverflowMessage, sizeof(StackOverflowMessage) - 1); - PROCAbort(SIGSEGV); + PROCAbort(SIGSEGV, siginfo); } } @@ -750,6 +730,11 @@ static void sigterm_handler(int code, siginfo_t *siginfo, void *context) { if (PALIsInitialized()) { + char* enable = getenv("COMPlus_EnableDumpOnSigTerm"); + if (enable != nullptr && strcmp(enable, "1") == 0) + { + PROCCreateCrashDumpIfEnabled(code, siginfo); + } // g_pSynchronizationManager shouldn't be null if PAL is initialized. _ASSERTE(g_pSynchronizationManager != nullptr); @@ -845,6 +830,15 @@ PAL_ERROR InjectActivationInternal(CorUnix::CPalThread* pThread) // We can get EAGAIN when printing stack overflow stack trace and when other threads hit // stack overflow too. Those are held in the sigsegv_handler with blocked signals until // the process exits. + +#ifdef __APPLE__ + // On Apple, pthread_kill is not allowed to be sent to dispatch queue threads + if (status == ENOTSUP) + { + return ERROR_NOT_SUPPORTED; + } +#endif + if ((status != 0) && (status != EAGAIN)) { // Failure to send the signal is fatal. There are only two cases when sending @@ -922,11 +916,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/include/pal/mutex.hpp b/src/coreclr/pal/src/include/pal/mutex.hpp index 8aeaf9f62586ed..8a70fd6c7cd418 100644 --- a/src/coreclr/pal/src/include/pal/mutex.hpp +++ b/src/coreclr/pal/src/include/pal/mutex.hpp @@ -120,9 +120,16 @@ Miscellaneous existing shared memory, naming, and waiting infrastructure is not suitable for this purpose, and is not used. */ -// Temporarily disabling usage of pthread process-shared mutexes on ARM/ARM64 due to functional issues that cannot easily be -// detected with code due to hangs. See https://github.com/dotnet/runtime/issues/6014. -#if HAVE_FULLY_FEATURED_PTHREAD_MUTEXES && HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES && !(defined(HOST_ARM) || defined(HOST_ARM64) || defined(__FreeBSD__)) +// - Temporarily disabling usage of pthread process-shared mutexes on ARM/ARM64 due to functional issues that cannot easily be +// detected with code due to hangs. See https://github.com/dotnet/runtime/issues/6014. +// - On FreeBSD, pthread process-shared robust mutexes cannot be placed in shared memory mapped independently by the processes +// involved. See https://github.com/dotnet/runtime/issues/10519. +// - On OSX, pthread robust mutexes were/are not available at the time of this writing. In case they are made available in the +// future, their use is disabled for compatibility. +#if HAVE_FULLY_FEATURED_PTHREAD_MUTEXES && \ + HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES && \ + !(defined(HOST_ARM) || defined(HOST_ARM64) || defined(__FreeBSD__) || defined(TARGET_OSX)) + #define NAMED_MUTEX_USE_PTHREAD_MUTEX 1 #else #define NAMED_MUTEX_USE_PTHREAD_MUTEX 0 diff --git a/src/coreclr/pal/src/include/pal/palinternal.h b/src/coreclr/pal/src/include/pal/palinternal.h index b0abe2aa9be0ac..3fc42942be695d 100644 --- a/src/coreclr/pal/src/include/pal/palinternal.h +++ b/src/coreclr/pal/src/include/pal/palinternal.h @@ -430,6 +430,7 @@ function_name() to call the system's implementation #undef va_list #undef va_start #undef va_end +#undef va_arg #undef va_copy #undef stdin #undef stdout @@ -695,30 +696,30 @@ T* InterlockedCompareExchangePointerT( template inline T* InterlockedExchangePointerT( T* volatile * target, - int value) // When NULL is provided as argument. + std::nullptr_t value) // When NULL is provided as argument. { //STATIC_ASSERT(value == 0); - return InterlockedExchangePointerT(target, reinterpret_cast(value)); + return InterlockedExchangePointerT(target, (T*)(void*)value); } template inline T* InterlockedCompareExchangePointerT( T* volatile * destination, - int exchange, // When NULL is provided as argument. + std::nullptr_t exchange, // When NULL is provided as argument. T* comparand) { //STATIC_ASSERT(exchange == 0); - return InterlockedCompareExchangePointerT(destination, reinterpret_cast(exchange), comparand); + return InterlockedCompareExchangePointerT(destination, (T*)(void*)exchange, comparand); } template inline T* InterlockedCompareExchangePointerT( T* volatile * destination, T* exchange, - int comparand) // When NULL is provided as argument. + std::nullptr_t comparand) // When NULL is provided as argument. { //STATIC_ASSERT(comparand == 0); - return InterlockedCompareExchangePointerT(destination, exchange, reinterpret_cast(comparand)); + return InterlockedCompareExchangePointerT(destination, exchange, (T*)(void*)comparand); } #undef InterlockedExchangePointer diff --git a/src/coreclr/pal/src/include/pal/process.h b/src/coreclr/pal/src/include/pal/process.h index b1de472ad427f1..71788cb2d00866 100644 --- a/src/coreclr/pal/src/include/pal/process.h +++ b/src/coreclr/pal/src/include/pal/process.h @@ -151,11 +151,12 @@ BOOL PROCAbortInitialize(); Parameters: signal - POSIX signal number + siginfo - POSIX signal info Does not return --*/ PAL_NORETURN -VOID PROCAbort(int signal = SIGABRT); +VOID PROCAbort(int signal = SIGABRT, siginfo_t* siginfo = nullptr); /*++ Function: @@ -180,7 +181,7 @@ VOID PROCNotifyProcessShutdown(bool isExecutingOnAltStack = false); (no return value) --*/ -VOID PROCCreateCrashDumpIfEnabled(int signal); +VOID PROCCreateCrashDumpIfEnabled(int signal, siginfo_t* siginfo); /*++ Function: 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/include/pal/sharedmemory.h b/src/coreclr/pal/src/include/pal/sharedmemory.h index 1ded94e12fcc59..c6e5abe97c3a78 100644 --- a/src/coreclr/pal/src/include/pal/sharedmemory.h +++ b/src/coreclr/pal/src/include/pal/sharedmemory.h @@ -173,7 +173,8 @@ class SharedMemorySharedDataHeader }; public: - static SIZE_T DetermineTotalByteCount(SIZE_T dataByteCount); + static SIZE_T GetUsedByteCount(SIZE_T dataByteCount); + static SIZE_T GetTotalByteCount(SIZE_T dataByteCount); public: SharedMemorySharedDataHeader(SharedMemoryType type, UINT8 version); diff --git a/src/coreclr/pal/src/include/pal/signal.hpp b/src/coreclr/pal/src/include/pal/signal.hpp index a1b721b8fd3ce5..c5a1e276a05b53 100644 --- a/src/coreclr/pal/src/include/pal/signal.hpp +++ b/src/coreclr/pal/src/include/pal/signal.hpp @@ -117,14 +117,4 @@ Function : --*/ void SEHCleanupSignals(); -/*++ -Function : - SEHCleanupAbort() - - Restore default SIGABORT signal handlers - - (no parameters, no return value) ---*/ -void SEHCleanupAbort(); - #endif /* _PAL_SIGNAL_HPP_ */ diff --git a/src/coreclr/pal/src/init/pal.cpp b/src/coreclr/pal/src/init/pal.cpp index fee6957306635e..9babab4ea35d4f 100644 --- a/src/coreclr/pal/src/init/pal.cpp +++ b/src/coreclr/pal/src/init/pal.cpp @@ -134,7 +134,7 @@ static bool RunningNatively() { int ret = 0; size_t sz = sizeof(ret); - if (sysctlbyname("sysctl.proc_native", &ret, &sz, NULL, 0) != 0) + if (sysctlbyname("sysctl.proc_native", &ret, &sz, nullptr, 0) != 0) { // if the sysctl failed, we'll assume this OS does not support // binary translation - so we must be running natively. @@ -207,7 +207,7 @@ int PALAPI PAL_InitializeDLL() { - return Initialize(0, NULL, g_initializeDLLFlags); + return Initialize(0, nullptr, g_initializeDLLFlags); } /*++ @@ -269,12 +269,12 @@ void InitializeDefaultStackSize() { char* defaultStackSizeStr = getenv("COMPlus_DefaultStackSize"); - if (defaultStackSizeStr != NULL) + if (defaultStackSizeStr != nullptr) { errno = 0; // Like all numeric values specific by the COMPlus_xxx variables, it is a // hexadecimal string without any prefix. - long int size = strtol(defaultStackSizeStr, NULL, 16); + long int size = strtol(defaultStackSizeStr, nullptr, 16); if (errno == 0) { @@ -311,10 +311,10 @@ Initialize( DWORD flags) { PAL_ERROR palError = ERROR_GEN_FAILURE; - CPalThread *pThread = NULL; - CSharedMemoryObjectManager *pshmom = NULL; - LPWSTR command_line = NULL; - LPWSTR exe_path = NULL; + CPalThread *pThread = nullptr; + CSharedMemoryObjectManager *pshmom = nullptr; + LPWSTR command_line = nullptr; + LPWSTR exe_path = nullptr; int retval = -1; bool fFirstTimeInit = false; @@ -336,18 +336,18 @@ Initialize( CriticalSectionSubSysInitialize(); - if(NULL == init_critsec) + if(nullptr == init_critsec) { pthread_mutex_lock(&init_critsec_mutex); // prevents race condition of two threads // initializing the critical section. - if(NULL == init_critsec) + if(nullptr == init_critsec) { static CRITICAL_SECTION temp_critsec; // Want this critical section to NOT be internal to avoid the use of unsafe region markers. InternalInitializeCriticalSectionAndSpinCount(&temp_critsec, 0, false); - if(NULL != InterlockedCompareExchangePointer(&init_critsec, &temp_critsec, NULL)) + if(nullptr != InterlockedCompareExchangePointer(&init_critsec, &temp_critsec, nullptr)) { // Another thread got in before us! shouldn't happen, if the PAL // isn't initialized there shouldn't be any other threads @@ -358,7 +358,7 @@ Initialize( pthread_mutex_unlock(&init_critsec_mutex); } - InternalEnterCriticalSection(pThread, init_critsec); // here pThread is always NULL + InternalEnterCriticalSection(pThread, init_critsec); // here pThread is always nullptr if (init_count == 0) { @@ -407,12 +407,12 @@ Initialize( #ifdef FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION char* useDefaultBaseAddr = getenv("COMPlus_UseDefaultBaseAddr"); - if (useDefaultBaseAddr != NULL) + if (useDefaultBaseAddr != nullptr) { errno = 0; // Like all numeric values specific by the COMPlus_xxx variables, it is a // hexadecimal string without any prefix. - long int flag = strtol(useDefaultBaseAddr, NULL, 16); + long int flag = strtol(useDefaultBaseAddr, nullptr, 16); if (errno == 0) { @@ -508,7 +508,7 @@ Initialize( // pshmom = InternalNew(); - if (NULL == pshmom) + if (nullptr == pshmom) { ERROR("Unable to allocate new object manager\n"); palError = ERROR_OUTOFMEMORY; @@ -531,7 +531,7 @@ Initialize( g_pSynchronizationManager = CPalSynchMgrController::CreatePalSynchronizationManager(); - if (NULL == g_pSynchronizationManager) + if (nullptr == g_pSynchronizationManager) { palError = ERROR_NOT_ENOUGH_MEMORY; ERROR("Failure creating synchronization manager\n"); @@ -545,11 +545,11 @@ Initialize( palError = ERROR_GEN_FAILURE; - if (argc > 0 && argv != NULL) + if (argc > 0 && argv != nullptr) { /* build the command line */ command_line = INIT_FormatCommandLine(argc, argv); - if (NULL == command_line) + if (nullptr == command_line) { ERROR("Error building command line\n"); palError = ERROR_PALINIT_COMMAND_LINE; @@ -558,7 +558,7 @@ Initialize( /* find out the application's full path */ exe_path = INIT_GetCurrentEXEPath(); - if (NULL == exe_path) + if (nullptr == exe_path) { ERROR("Unable to find exe path\n"); palError = ERROR_PALINIT_CONVERT_EXE_PATH; @@ -576,7 +576,7 @@ Initialize( } // InitializeProcessCommandLine took ownership of this memory. - command_line = NULL; + command_line = nullptr; #ifdef PAL_PERF // Initialize the Profiling structure @@ -597,7 +597,7 @@ Initialize( } // LOADSetExeName took ownership of this memory. - exe_path = NULL; + exe_path = nullptr; } if (init_count == 0) @@ -742,7 +742,7 @@ Initialize( if (fFirstTimeInit && 0 == retval) { - _ASSERTE(NULL != pThread); + _ASSERTE(nullptr != pThread); } if (retval != 0 && GetLastError() == ERROR_SUCCESS) @@ -858,7 +858,7 @@ PAL_IsDebuggerPresent() struct kinfo_proc info = {}; size_t size = sizeof(info); int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() }; - int ret = sysctl(mib, sizeof(mib)/sizeof(*mib), &info, &size, NULL, 0); + int ret = sysctl(mib, sizeof(mib)/sizeof(*mib), &info, &size, nullptr, 0); if (ret == 0) return ((info.kp_proc.p_flag & P_TRACED) != 0); @@ -871,12 +871,12 @@ PAL_IsDebuggerPresent() struct kinfo_proc *info; - kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, "kvm_open"); - if (kd == NULL) + kd = kvm_open(nullptr, nullptr, nullptr, KVM_NO_FILES, "kvm_open"); + if (kd == nullptr) return FALSE; info = kvm_getprocs(kd, KERN_PROC_PID, getpid(), &cnt); - if (info == NULL || cnt < 1) + if (info == nullptr || cnt < 1) { kvm_close(kd); return FALSE; @@ -960,7 +960,7 @@ PAL_TerminateEx( { ENTRY_EXTERNAL("PAL_TerminateEx()\n"); - if (NULL == init_critsec) + if (nullptr == init_critsec) { /* note that these macros probably won't output anything, since the debug channels haven't been initialized yet */ @@ -1057,7 +1057,7 @@ BOOL PALInitLock(void) } CPalThread * pThread = - (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : NULL); + (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : nullptr); InternalEnterCriticalSection(pThread, init_critsec); return TRUE; @@ -1079,7 +1079,7 @@ void PALInitUnlock(void) } CPalThread * pThread = - (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : NULL); + (PALIsThreadDataInitialized() ? InternalGetCurrentThread() : nullptr); InternalLeaveCriticalSection(pThread, init_critsec); } @@ -1138,7 +1138,7 @@ static BOOL INIT_IncreaseDescriptorLimit(void) Parameters : int argc : number of arguments in argv - char **argv : argument list in an array of NULL-terminated strings + char **argv : argument list in an array of nullptr-terminated strings Return value : pointer to Unicode command line. This is a buffer allocated with malloc; @@ -1161,7 +1161,7 @@ Note : not all peculiarities of Windows command-line processing are supported; static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv) { LPWSTR retval; - LPSTR command_line=NULL, command_ptr; + LPSTR command_line=nullptr, command_ptr; LPCSTR arg_ptr; INT length, i,j; BOOL bQuoted = FALSE; @@ -1186,7 +1186,7 @@ static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv) if(!command_line) { ERROR("couldn't allocate memory for command line!\n"); - return NULL; + return nullptr; } command_ptr=command_line; @@ -1220,32 +1220,32 @@ static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv) } *command_ptr++=' '; } - /* replace the last space with a NULL terminator */ + /* replace the last space with a nullptr terminator */ command_ptr--; *command_ptr='\0'; /* convert to Unicode */ - i = MultiByteToWideChar(CP_ACP, 0,command_line, -1, NULL, 0); + i = MultiByteToWideChar(CP_ACP, 0,command_line, -1, nullptr, 0); if (i == 0) { ASSERT("MultiByteToWideChar failure\n"); free(command_line); - return NULL; + return nullptr; } retval = reinterpret_cast(InternalMalloc((sizeof(WCHAR)*i))); - if(retval == NULL) + if(retval == nullptr) { ERROR("can't allocate memory for Unicode command line!\n"); free(command_line); - return NULL; + return nullptr; } if(!MultiByteToWideChar(CP_ACP, 0,command_line, i, retval, i)) { ASSERT("MultiByteToWideChar failure\n"); free(retval); - retval = NULL; + retval = nullptr; } else TRACE("Command line is %s\n", command_line); @@ -1275,25 +1275,25 @@ static LPWSTR INIT_GetCurrentEXEPath() if (!path) { ERROR( "Cannot get current exe path\n" ); - return NULL; + return nullptr; } PathCharString real_path; real_path.Set(path, strlen(path)); free(path); - return_size = MultiByteToWideChar(CP_ACP, 0, real_path, -1, NULL, 0); + return_size = MultiByteToWideChar(CP_ACP, 0, real_path, -1, nullptr, 0); if (0 == return_size) { ASSERT("MultiByteToWideChar failure\n"); - return NULL; + return nullptr; } return_value = reinterpret_cast(InternalMalloc((return_size*sizeof(WCHAR)))); - if (NULL == return_value) + if (nullptr == return_value) { ERROR("Not enough memory to create full path\n"); - return NULL; + return nullptr; } else { @@ -1302,7 +1302,7 @@ static LPWSTR INIT_GetCurrentEXEPath() { ASSERT("MultiByteToWideChar failure\n"); free(return_value); - return_value = NULL; + return_value = nullptr; } else { diff --git a/src/coreclr/pal/src/map/map.cpp b/src/coreclr/pal/src/map/map.cpp index af97934f7ca845..7d0635c4abea2e 100644 --- a/src/coreclr/pal/src/map/map.cpp +++ b/src/coreclr/pal/src/map/map.cpp @@ -2045,14 +2045,48 @@ MAPmmapAndRecord( // Mojave hardened runtime doesn't allow executable mappings of a file. So we have to create an // anonymous mapping and read the file contents into it instead. +#if defined(HOST_ARM64) + // Set the requested mapping with forced PROT_WRITE, mmap the file, and copy its contents there. + // Once PROT_WRITE and PROT_EXEC are set together, Apple Silicon will require the use of + // PAL_JitWriteProtect to switch between executable and writable. + LPVOID pvMappedFile = mmap(NULL, len + adjust, PROT_READ, MAP_PRIVATE, fd, offset - adjust); + if (MAP_FAILED == pvMappedFile) + { + ERROR_(LOADER)("mmap failed with code %d: %s.\n", errno, strerror(errno)); + palError = FILEGetLastErrorFromErrno(); + } + else + { + if (-1 == mprotect(pvBaseAddress, len + adjust, prot | PROT_WRITE)) + { + ERROR_(LOADER)("mprotect failed with code %d: %s.\n", errno, strerror(errno)); + palError = FILEGetLastErrorFromErrno(); + } + else + { + PAL_JitWriteProtect(true); + memcpy(pvBaseAddress, pvMappedFile, len + adjust); + PAL_JitWriteProtect(false); + } + if (-1 == munmap(pvMappedFile, len + adjust)) + { + ERROR_(LOADER)("Unable to unmap the file. Expect trouble.\n"); + if (NO_ERROR == palError) + palError = FILEGetLastErrorFromErrno(); + } + } +#else // Set the requested mapping with forced PROT_WRITE to ensure data from the file can be read there, - // read the data in and finally remove the forced PROT_WRITE + // read the data in and finally remove the forced PROT_WRITE. On Intel we can still switch the + // protection later with mprotect. if ((mprotect(pvBaseAddress, len + adjust, prot | PROT_WRITE) == -1) || (pread(fd, pvBaseAddress, len + adjust, offset - adjust) == -1) || (((prot & PROT_WRITE) == 0) && mprotect(pvBaseAddress, len + adjust, prot) == -1)) { palError = FILEGetLastErrorFromErrno(); } +#endif + } else #endif diff --git a/src/coreclr/pal/src/sharedmemory/sharedmemory.cpp b/src/coreclr/pal/src/sharedmemory/sharedmemory.cpp index 4c946cc5257b74..2cec2008582119 100644 --- a/src/coreclr/pal/src/sharedmemory/sharedmemory.cpp +++ b/src/coreclr/pal/src/sharedmemory/sharedmemory.cpp @@ -188,7 +188,12 @@ bool SharedMemoryHelpers::EnsureDirectoryExists( } if (!createIfNotExist || chmod(path, PermissionsMask_AllUsers_ReadWriteExecute) != 0) { - throw SharedMemoryException(static_cast(SharedMemoryError::IO)); + // We were not asked to create the path or we weren't able to set the new permissions. + // As a last resort, check that at least the current user has full access. + if ((statInfo.st_mode & PermissionsMask_CurrentUser_ReadWriteExecute) != PermissionsMask_CurrentUser_ReadWriteExecute) + { + throw SharedMemoryException(static_cast(SharedMemoryError::IO)); + } } return true; } @@ -519,9 +524,14 @@ bool SharedMemoryId::AppendSessionDirectoryName(PathCharString& path) const //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SharedMemorySharedDataHeader -SIZE_T SharedMemorySharedDataHeader::DetermineTotalByteCount(SIZE_T dataByteCount) +SIZE_T SharedMemorySharedDataHeader::GetUsedByteCount(SIZE_T dataByteCount) +{ + return sizeof(SharedMemorySharedDataHeader) + dataByteCount; +} + +SIZE_T SharedMemorySharedDataHeader::GetTotalByteCount(SIZE_T dataByteCount) { - return SharedMemoryHelpers::AlignUp(sizeof(SharedMemorySharedDataHeader) + dataByteCount, GetVirtualPageSize()); + return SharedMemoryHelpers::AlignUp(GetUsedByteCount(dataByteCount), GetVirtualPageSize()); } SharedMemorySharedDataHeader::SharedMemorySharedDataHeader(SharedMemoryType type, UINT8 version) @@ -642,7 +652,7 @@ SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( { _ASSERTE( processDataHeader->GetSharedDataTotalByteCount() == - SharedMemorySharedDataHeader::DetermineTotalByteCount(sharedDataByteCount)); + SharedMemorySharedDataHeader::GetTotalByteCount(sharedDataByteCount)); processDataHeader->IncRefCount(); return processDataHeader; } @@ -697,14 +707,23 @@ SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( } // Set or validate the file length - SIZE_T sharedDataTotalByteCount = SharedMemorySharedDataHeader::DetermineTotalByteCount(sharedDataByteCount); + SIZE_T sharedDataUsedByteCount = SharedMemorySharedDataHeader::GetUsedByteCount(sharedDataByteCount); + SIZE_T sharedDataTotalByteCount = SharedMemorySharedDataHeader::GetTotalByteCount(sharedDataByteCount); if (createdFile) { SharedMemoryHelpers::SetFileSize(fileDescriptor, sharedDataTotalByteCount); } - else if (SharedMemoryHelpers::GetFileSize(fileDescriptor) != sharedDataTotalByteCount) + else { - throw SharedMemoryException(static_cast(SharedMemoryError::HeaderMismatch)); + SIZE_T currentFileSize = SharedMemoryHelpers::GetFileSize(fileDescriptor); + if (currentFileSize < sharedDataUsedByteCount) + { + throw SharedMemoryException(static_cast(SharedMemoryError::HeaderMismatch)); + } + if (currentFileSize < sharedDataTotalByteCount) + { + SharedMemoryHelpers::SetFileSize(fileDescriptor, sharedDataTotalByteCount); + } } // Acquire and hold a shared file lock on the shared memory file as long as it is open, to indicate that this process is @@ -726,7 +745,7 @@ SharedMemoryProcessDataHeader *SharedMemoryProcessDataHeader::CreateOrOpen( { if (clearContents) { - memset(mappedBuffer, 0, sharedDataTotalByteCount); + memset(mappedBuffer, 0, sharedDataUsedByteCount); } sharedDataHeader = new(mappedBuffer) SharedMemorySharedDataHeader(requiredSharedDataHeader); } diff --git a/src/coreclr/pal/src/thread/process.cpp b/src/coreclr/pal/src/thread/process.cpp index 0ae3f2eecafd05..5be5d1b90360e0 100644 --- a/src/coreclr/pal/src/thread/process.cpp +++ b/src/coreclr/pal/src/thread/process.cpp @@ -85,7 +85,6 @@ SET_DEFAULT_DEBUG_CHANNEL(PROCESS); // some headers have code with asserts, so d #include #include #include -#if defined(HOST_ARM64) #include #include extern "C" @@ -103,7 +102,6 @@ extern "C" } \ } while (false) -#endif // defined(HOST_ARM64) #endif // __APPLE__ #ifdef __NetBSD__ @@ -3108,6 +3106,28 @@ PROCFormatInt(ULONG32 value) return buffer; } +/*++ +Function: + PROCFormatInt64 + + Helper function to format an ULONG64 as a string. + +--*/ +char* +PROCFormatInt64(ULONG64 value) +{ + char* buffer = (char*)InternalMalloc(128); + if (buffer != nullptr) + { + if (sprintf_s(buffer, 128, "%lld", value) == -1) + { + free(buffer); + buffer = nullptr; + } + } + return buffer; +} + /*++ Function PROCBuildCreateDumpCommandLine @@ -3124,10 +3144,9 @@ PROCBuildCreateDumpCommandLine( std::vector& argv, char** pprogram, char** ppidarg, - char* dumpName, - char* dumpType, - BOOL diag, - BOOL crashReport) + const char* dumpName, + const char* dumpType, + ULONG32 flags) { if (g_szCoreCLRPath == nullptr) { @@ -3190,12 +3209,17 @@ PROCBuildCreateDumpCommandLine( } } - if (diag) + if (flags & GenerateDumpFlagsLoggingEnabled) { argv.push_back("--diag"); } - if (crashReport) + if (flags & GenerateDumpFlagsVerboseLoggingEnabled) + { + argv.push_back("--verbose"); + } + + if (flags & GenerateDumpFlagsCrashReportEnabled) { argv.push_back("--crashreport"); } @@ -3284,12 +3308,26 @@ PROCAbortInitialize() char* dumpType = getenv("COMPlus_DbgMiniDumpType"); char* diagStr = getenv("COMPlus_CreateDumpDiagnostics"); BOOL diag = diagStr != nullptr && strcmp(diagStr, "1") == 0; + char* verboseStr = getenv("COMPlus_CreateDumpVerboseDiagnostics"); + BOOL verbose = verboseStr != nullptr && strcmp(verboseStr, "1") == 0; char* crashReportStr = getenv("COMPlus_EnableCrashReport"); BOOL crashReport = crashReportStr != nullptr && strcmp(crashReportStr, "1") == 0; - + ULONG32 flags = GenerateDumpFlagsNone; + if (diag) + { + flags |= GenerateDumpFlagsLoggingEnabled; + } + if (verbose) + { + flags |= GenerateDumpFlagsVerboseLoggingEnabled; + } + if (crashReport) + { + flags |= GenerateDumpFlagsCrashReportEnabled; + } char* program = nullptr; char* pidarg = nullptr; - if (!PROCBuildCreateDumpCommandLine(g_argvCreateDump, &program, &pidarg, dumpName, dumpType, diag, crashReport)) + if (!PROCBuildCreateDumpCommandLine(g_argvCreateDump, &program, &pidarg, dumpName, dumpType, flags)) { return FALSE; } @@ -3311,8 +3349,8 @@ PROCAbortInitialize() WithHeap = 2, Triage = 3, Full = 4 - diag - true - log createdump diagnostics to console + flags + See enum Return: TRUE success @@ -3322,7 +3360,7 @@ BOOL PAL_GenerateCoreDump( LPCSTR dumpName, INT dumpType, - BOOL diag) + ULONG32 flags) { std::vector argvCreateDump; char dumpTypeStr[16]; @@ -3341,7 +3379,7 @@ PAL_GenerateCoreDump( } char* program = nullptr; char* pidarg = nullptr; - BOOL result = PROCBuildCreateDumpCommandLine(argvCreateDump, &program, &pidarg, (char*)dumpName, dumpTypeStr, diag, false); + BOOL result = PROCBuildCreateDumpCommandLine(argvCreateDump, &program, &pidarg, dumpName, dumpTypeStr, flags); if (result) { result = PROCCreateCrashDump(argvCreateDump); @@ -3364,7 +3402,7 @@ PAL_GenerateCoreDump( (no return value) --*/ VOID -PROCCreateCrashDumpIfEnabled(int signal) +PROCCreateCrashDumpIfEnabled(int signal, siginfo_t* siginfo) { // If enabled, launch the create minidump utility and wait until it completes if (!g_argvCreateDump.empty()) @@ -3372,13 +3410,16 @@ PROCCreateCrashDumpIfEnabled(int signal) std::vector argv(g_argvCreateDump); char* signalArg = nullptr; char* crashThreadArg = nullptr; + char* signalCodeArg = nullptr; + char* signalErrnoArg = nullptr; + char* signalAddressArg = nullptr; if (signal != 0) { // Remove the terminating nullptr argv.pop_back(); - // Add the Windows exception code to the command line + // Add the signal number to the command line signalArg = PROCFormatInt(signal); if (signalArg != nullptr) { @@ -3393,6 +3434,29 @@ PROCCreateCrashDumpIfEnabled(int signal) argv.push_back("--crashthread"); argv.push_back(crashThreadArg); } + + if (siginfo != nullptr) + { + signalCodeArg = PROCFormatInt(siginfo->si_code); + if (signalCodeArg != nullptr) + { + argv.push_back("--code"); + argv.push_back(signalCodeArg); + } + signalErrnoArg = PROCFormatInt(siginfo->si_errno); + if (signalErrnoArg != nullptr) + { + argv.push_back("--errno"); + argv.push_back(signalErrnoArg); + } + signalAddressArg = PROCFormatInt64((ULONG64)siginfo->si_addr); + if (signalAddressArg != nullptr) + { + argv.push_back("--address"); + argv.push_back(signalAddressArg); + } + } + argv.push_back(nullptr); } @@ -3400,6 +3464,9 @@ PROCCreateCrashDumpIfEnabled(int signal) free(signalArg); free(crashThreadArg); + free(signalCodeArg); + free(signalErrnoArg); + free(signalAddressArg); } } @@ -3417,15 +3484,16 @@ PROCCreateCrashDumpIfEnabled(int signal) --*/ PAL_NORETURN VOID -PROCAbort(int signal) +PROCAbort(int signal, siginfo_t* siginfo) { // Do any shutdown cleanup before aborting or creating a core dump PROCNotifyProcessShutdown(); - PROCCreateCrashDumpIfEnabled(signal); + PROCCreateCrashDumpIfEnabled(signal, siginfo); - // Restore the SIGABORT handler to prevent recursion - SEHCleanupAbort(); + // Restore all signals; the SIGABORT handler to prevent recursion and + // the others to prevent multiple core dumps from being generated. + SEHCleanupSignals(); // Abort the process after waiting for the core dump to complete abort(); @@ -3460,7 +3528,7 @@ InitializeFlushProcessWriteBuffers() } } -#if defined(TARGET_OSX) && defined(HOST_ARM64) +#ifdef TARGET_OSX return TRUE; #else s_helperPage = static_cast(mmap(0, GetVirtualPageSize(), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0)); @@ -3490,7 +3558,7 @@ InitializeFlushProcessWriteBuffers() } return status == 0; -#endif // defined(TARGET_OSX) && defined(HOST_ARM64) +#endif // TARGET_OSX } #define FATAL_ASSERT(e, msg) \ @@ -3540,7 +3608,7 @@ FlushProcessWriteBuffers() status = pthread_mutex_unlock(&flushProcessWriteBuffersMutex); FATAL_ASSERT(status == 0, "Failed to unlock the flushProcessWriteBuffersMutex lock"); } -#if defined(TARGET_OSX) && defined(HOST_ARM64) +#ifdef TARGET_OSX else { mach_msg_type_number_t cThreads; @@ -3566,7 +3634,7 @@ FlushProcessWriteBuffers() machret = vm_deallocate(mach_task_self(), (vm_address_t)pThreads, cThreads * sizeof(thread_act_t)); CHECK_MACH("vm_deallocate()", machret); } -#endif // defined(TARGET_OSX) && defined(HOST_ARM64) +#endif // TARGET_OSX } /*++ diff --git a/src/coreclr/scripts/superpmi_setup.py b/src/coreclr/scripts/superpmi_setup.py index 0d0bc0bb341232..0b4b9ecc2ae063 100644 --- a/src/coreclr/scripts/superpmi_setup.py +++ b/src/coreclr/scripts/superpmi_setup.py @@ -23,12 +23,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 | | -# | x64 | Windows.10.Amd64.X86 | 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 | +# |-------|----------------------|---------------------------------------------------------------------------------------------------------------| +# | x86 | Windows.10.Amd64.X86 | | +# | x64 | Windows.10.Amd64.X86 | Ubuntu.1804.Amd64 | +# | arm | - | (Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7 | +# | arm64 | Windows.10.Arm64 | (Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8 | ################################################################################ ################################################################################ @@ -490,9 +490,9 @@ def main(main_args): helix_queue = "Windows.10.Arm64" if arch == "arm64" else "Windows.10.Amd64.X86" else: if arch == "arm": - helix_queue = "(Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440" + helix_queue = "(Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-20230201170255-8b7d579" elif arch == "arm64": - helix_queue = "(Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652" + helix_queue = "(Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8" else: helix_queue = "Ubuntu.1804.Amd64" diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs index db9eb3f137a588..6fd7ca33bfb8db 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs @@ -2549,10 +2549,25 @@ static uint _getJitFlags(IntPtr thisHandle, IntPtr* ppException, CORJIT_FLAGS* f } } + [UnmanagedCallersOnly] + static byte _doesFieldBelongToClass(IntPtr thisHandle, IntPtr* ppException, CORINFO_FIELD_STRUCT_* fldHnd, CORINFO_CLASS_STRUCT_* cls) + { + var _this = GetThis(thisHandle); + try + { + return _this.doesFieldBelongToClass(fldHnd, cls) ? (byte)1 : (byte)0; + } + catch (Exception ex) + { + *ppException = _this.AllocException(ex); + return default; + } + } + static IntPtr GetUnmanagedCallbacks() { - void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 172); + void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 173); callbacks[0] = (delegate* unmanaged)&_isJitIntrinsic; callbacks[1] = (delegate* unmanaged)&_getMethodAttribs; @@ -2726,6 +2741,7 @@ static IntPtr GetUnmanagedCallbacks() callbacks[169] = (delegate* unmanaged)&_getRelocTypeHint; callbacks[170] = (delegate* unmanaged)&_getExpectedTargetArchitecture; callbacks[171] = (delegate* unmanaged)&_getJitFlags; + callbacks[172] = (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 a0ccb4400f0758..cbc776a932870c 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -392,9 +392,9 @@ private void PublishCode() _methodCodeNode.InitializeEHInfo(ehInfo); _methodCodeNode.InitializeDebugLocInfos(_debugLocInfos); - _methodCodeNode.InitializeDebugVarInfos(_debugVarInfos); + _methodCodeNode.InitializeDebugVarInfos(_debugVarInfos, _compilation.TypeSystemContext.Target); #if READYTORUN - _methodCodeNode.InitializeInliningInfo(_inlinedMethods.ToArray()); + _methodCodeNode.InitializeInliningInfo(_inlinedMethods.ToArray(), _compilation.NodeFactory); // Detect cases where the instruction set support used is a superset of the baseline instruction set specification var baselineSupport = _compilation.InstructionSetSupport; @@ -604,7 +604,8 @@ private bool Get_CORINFO_METHOD_INFO(MethodDesc method, MethodIL methodIL, CORIN methodInfo->ILCode = (byte*)GetPin(ilCode); methodInfo->ILCodeSize = (uint)ilCode.Length; methodInfo->maxStack = (uint)methodIL.MaxStack; - methodInfo->EHcount = (uint)methodIL.GetExceptionRegions().Length; + var exceptionRegions = methodIL.GetExceptionRegions(); + methodInfo->EHcount = (uint)exceptionRegions.Length; methodInfo->options = methodIL.IsInitLocals ? CorInfoOptions.CORINFO_OPT_INIT_LOCALS : (CorInfoOptions)0; if (method.AcquiresInstMethodTableFromThis()) @@ -623,6 +624,24 @@ private bool Get_CORINFO_METHOD_INFO(MethodDesc method, MethodIL methodIL, CORIN Get_CORINFO_SIG_INFO(method, sig: &methodInfo->args); Get_CORINFO_SIG_INFO(methodIL.GetLocals(), &methodInfo->locals); +#if READYTORUN + if ((methodInfo->options & CorInfoOptions.CORINFO_GENERICS_CTXT_MASK) != 0) + { + foreach (var region in exceptionRegions) + { + if (region.Kind == ILExceptionRegionKind.Catch) + { + TypeDesc catchType = (TypeDesc)methodIL.GetObject(region.ClassToken); + if (catchType.IsCanonicalSubtype(CanonicalFormKind.Any)) + { + methodInfo->options |= CorInfoOptions.CORINFO_GENERICS_CTXT_KEEP_ALIVE; + break; + } + } + } + } +#endif + return true; } @@ -3531,6 +3550,42 @@ private uint getExpectedTargetArchitecture() } } + private bool doesFieldBelongToClass(CORINFO_FIELD_STRUCT_* fld, CORINFO_CLASS_STRUCT_* cls) + { + var field = HandleToObject(fld); + var queryType = HandleToObject(cls); + + Debug.Assert(!field.IsStatic); + + // doesFieldBelongToClass implements the predicate of... + // if field is not associated with the class in any way, return false. + // if field is the only FieldDesc that the JIT might see for a given class handle + // and logical field pair then return true. This is needed as the field handle here + // is used as a key into a hashtable mapping writes to fields to value numbers. + // + // In this implmentation this is made more complex as the JIT is exposed to CORINFO_FIELD_STRUCT + // pointers which represent exact instantions, so performing exact matching is the necessary approach + + // BaseType._field, BaseType -> true + // BaseType._field, DerivedType -> true + // BaseType<__Canon>._field, BaseType<__Canon> -> true + // BaseType<__Canon>._field, BaseType -> false + // BaseType<__Canon>._field, BaseType -> false + // BaseType._field, BaseType -> true + // BaseType._field, BaseType -> false + + var fieldOwnerType = field.OwningType; + + while (queryType != null) + { + if (fieldOwnerType == queryType) + return true; + queryType = queryType.BaseType; + } + + return false; + } + private bool isMethodDefinedInCoreLib() { TypeDesc owningType = MethodBeingCompiled.OwningType; diff --git a/src/coreclr/tools/Common/JitInterface/SystemVStructClassificator.cs b/src/coreclr/tools/Common/JitInterface/SystemVStructClassificator.cs index 55b8e2d1dc02c8..c4105d1ce91739 100644 --- a/src/coreclr/tools/Common/JitInterface/SystemVStructClassificator.cs +++ b/src/coreclr/tools/Common/JitInterface/SystemVStructClassificator.cs @@ -158,7 +158,7 @@ private static SystemVClassificationType TypeDef2SystemVClassification(TypeDesc case TypeFlags.GenericParameter: case TypeFlags.SignatureTypeVariable: case TypeFlags.SignatureMethodVariable: - Debug.Assert(false, $"Type {typeDesc} with unexpected category {typeDesc.Category}"); + Debug.Fail($"Type {typeDesc} with unexpected category {typeDesc.Category}"); return SystemVClassificationTypeUnknown; default: return SystemVClassificationTypeUnknown; diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt index 22e390f52858ea..da802c872bb289 100644 --- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt +++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt @@ -325,4 +325,4 @@ FUNCTIONS uint16_t getRelocTypeHint(void* target) uint32_t getExpectedTargetArchitecture() uint32_t getJitFlags(CORJIT_FLAGS* flags, uint32_t sizeInBytes) - + bool doesFieldBelongToClass(CORINFO_FIELD_HANDLE fldHnd, CORINFO_CLASS_HANDLE cls) diff --git a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs index f445bb1a1fc70b..e17d5f5454d89f 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs @@ -920,7 +920,15 @@ public override ValueTypeShapeCharacteristics ComputeValueTypeShapeCharacteristi return result; } - private ValueTypeShapeCharacteristics ComputeHomogeneousAggregateCharacteristic(DefType type) + /// + /// Identify whether a given type is a homogeneous floating-point aggregate. This code must be + /// kept in sync with the CoreCLR runtime method EEClass::CheckForHFA, as of this change it + /// can be found at + /// https://github.com/dotnet/runtime/blob/1928cd2b65c04ebe6fe528d4ebb581e46f1fed47/src/coreclr/vm/class.cpp#L1567 + /// + /// Type to analyze + /// HFA classification of the type parameter + private static ValueTypeShapeCharacteristics ComputeHomogeneousAggregateCharacteristic(DefType type) { // Use this constant to make the code below more laconic const ValueTypeShapeCharacteristics NotHA = ValueTypeShapeCharacteristics.None; @@ -931,16 +939,8 @@ private ValueTypeShapeCharacteristics ComputeHomogeneousAggregateCharacteristic( if ((targetArch != TargetArchitecture.ARM) && (targetArch != TargetArchitecture.ARM64)) return NotHA; - if (type.Context.Target.Abi == TargetAbi.CoreRTArmel) - return NotHA; - MetadataType metadataType = (MetadataType)type; - - // No HAs with explicit layout. There may be cases where explicit layout may be still - // eligible for HA, but it is hard to tell the real intent. Make it simple and just - // unconditionally disable HAs for explicit layout. - if (metadataType.IsExplicitLayout) - return NotHA; + int haElementSize = 0; switch (metadataType.Category) { @@ -953,12 +953,18 @@ private ValueTypeShapeCharacteristics ComputeHomogeneousAggregateCharacteristic( case TypeFlags.ValueType: // Find the common HA element type if any ValueTypeShapeCharacteristics haResultType = NotHA; + bool hasZeroOffsetField = false; foreach (FieldDesc field in metadataType.GetFields()) { if (field.IsStatic) continue; + if (field.Offset == LayoutInt.Zero) + { + hasZeroOffsetField = true; + } + // If a field isn't a DefType, then this type cannot be a HA type if (!(field.FieldType is DefType fieldType)) return NotHA; @@ -972,6 +978,15 @@ private ValueTypeShapeCharacteristics ComputeHomogeneousAggregateCharacteristic( { // If we hadn't yet figured out what form of HA this type might be, we've now found one case haResultType = haFieldType; + + haElementSize = haResultType switch + { + ValueTypeShapeCharacteristics.Float32Aggregate => 4, + ValueTypeShapeCharacteristics.Float64Aggregate => 8, + ValueTypeShapeCharacteristics.Vector64Aggregate => 8, + ValueTypeShapeCharacteristics.Vector128Aggregate => 16, + _ => throw new ArgumentOutOfRangeException() + }; } else if (haResultType != haFieldType) { @@ -980,21 +995,17 @@ private ValueTypeShapeCharacteristics ComputeHomogeneousAggregateCharacteristic( // be a HA type. return NotHA; } + + if (field.Offset.IsIndeterminate || field.Offset.AsInt % haElementSize != 0) + { + return NotHA; + } } - // If there are no instance fields, this is not a HA type - if (haResultType == NotHA) + // If the struct doesn't have a zero-offset field, it's not an HFA. + if (!hasZeroOffsetField) return NotHA; - int haElementSize = haResultType switch - { - ValueTypeShapeCharacteristics.Float32Aggregate => 4, - ValueTypeShapeCharacteristics.Float64Aggregate => 8, - ValueTypeShapeCharacteristics.Vector64Aggregate => 8, - ValueTypeShapeCharacteristics.Vector128Aggregate => 16, - _ => throw new ArgumentOutOfRangeException() - }; - // Types which are indeterminate in field size are not considered to be HA if (type.InstanceFieldSize.IsIndeterminate) return NotHA; @@ -1003,8 +1014,13 @@ private ValueTypeShapeCharacteristics ComputeHomogeneousAggregateCharacteristic( // - Type of fields can be HA valuetype itself. // - Managed C++ HA valuetypes have just one of type float to signal that // the valuetype is HA and explicitly specified size. - int maxSize = haElementSize * type.Context.Target.MaxHomogeneousAggregateElementCount; - if (type.InstanceFieldSize.AsInt > maxSize) + int totalSize = type.InstanceFieldSize.AsInt; + + if (totalSize % haElementSize != 0) + return NotHA; + + // On ARM, HFAs can have a maximum of four fields regardless of whether those are float or double. + if (totalSize > haElementSize * type.Context.Target.MaxHomogeneousAggregateElementCount) return NotHA; // All the tests passed. This is a HA type. diff --git a/src/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs b/src/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs index dd494b9fdcf9a8..bba40fd1df33a4 100644 --- a/src/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.Diagnostics/PerfMapWriter.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Security.Cryptography; +using Internal.ReadyToRunDiagnosticsConstants; using Internal.TypeSystem; namespace ILCompiler.Diagnostics @@ -16,14 +17,8 @@ public class PerfMapWriter public const int LegacyCrossgen1FormatVersion = 0; public const int CurrentFormatVersion = 1; - - public enum PseudoRVA : uint - { - OutputGuid = 0xFFFFFFFF, - TargetOS = 0xFFFFFFFE, - TargetArchitecture = 0xFFFFFFFD, - FormatVersion = 0xFFFFFFFC, - } + + const int HeaderEntriesPseudoLength = 0; private TextWriter _writer; @@ -32,7 +27,7 @@ private PerfMapWriter(TextWriter writer) _writer = writer; } - public static void Write(string perfMapFileName, int perfMapFormatVersion, IEnumerable methods, IEnumerable inputAssemblies, TargetOS targetOS, TargetArchitecture targetArch) + public static void Write(string perfMapFileName, int perfMapFormatVersion, IEnumerable methods, IEnumerable inputAssemblies, TargetDetails details) { if (perfMapFormatVersion > CurrentFormatVersion) { @@ -41,22 +36,10 @@ public static void Write(string perfMapFileName, int perfMapFormatVersion, IEnum using (TextWriter writer = new StreamWriter(perfMapFileName)) { - IEnumerable orderedInputs = inputAssemblies.OrderBy(asm => asm.Name, StringComparer.OrdinalIgnoreCase); PerfMapWriter perfMapWriter = new PerfMapWriter(writer); - - List inputHash = new List(); - foreach (AssemblyInfo inputAssembly in orderedInputs) - { - inputHash.AddRange(inputAssembly.Mvid.ToByteArray()); - } - inputHash.Add((byte)targetOS); - inputHash.Add((byte)targetArch); - Guid outputGuid = new Guid(MD5.HashData(inputHash.ToArray())); - perfMapWriter.WriteLine(outputGuid.ToString(), (uint)PseudoRVA.OutputGuid, 0); - perfMapWriter.WriteLine(targetOS.ToString(), (uint)PseudoRVA.TargetOS, 0); - perfMapWriter.WriteLine(targetArch.ToString(), (uint)PseudoRVA.TargetArchitecture, 0); - perfMapWriter.WriteLine(CurrentFormatVersion.ToString(), (uint)PseudoRVA.FormatVersion, 0); + byte[] signature = PerfMapV1SignatureHelper(inputAssemblies, details); + WritePerfMapV1Header(inputAssemblies, details, perfMapWriter); foreach (MethodInfo methodInfo in methods) { @@ -72,6 +55,92 @@ public static void Write(string perfMapFileName, int perfMapFormatVersion, IEnum } } + private static void WritePerfMapV1Header(IEnumerable inputAssemblies, TargetDetails details, PerfMapWriter perfMapWriter) + { + byte[] signature = PerfMapV1SignatureHelper(inputAssemblies, details); + + // Make sure these get emitted in this order, other tools in the ecosystem like the symbol uploader and PerfView rely on this. + // In particular, the order of it. Append only. + string signatureFormatted = Convert.ToHexString(signature); + + PerfmapTokensForTarget targetTokens = TranslateTargetDetailsToPerfmapConstants(details); + + perfMapWriter.WriteLine(signatureFormatted, (uint)PerfMapPseudoRVAToken.OutputSignature, HeaderEntriesPseudoLength); + perfMapWriter.WriteLine(CurrentFormatVersion.ToString(), (uint)PerfMapPseudoRVAToken.FormatVersion, HeaderEntriesPseudoLength); + perfMapWriter.WriteLine(((uint)targetTokens.OperatingSystem).ToString(), (uint)PerfMapPseudoRVAToken.TargetOS, HeaderEntriesPseudoLength); + perfMapWriter.WriteLine(((uint)targetTokens.Architecture).ToString(), (uint)PerfMapPseudoRVAToken.TargetArchitecture, HeaderEntriesPseudoLength); + perfMapWriter.WriteLine(((uint)targetTokens.Abi).ToString(), (uint)PerfMapPseudoRVAToken.TargetABI, HeaderEntriesPseudoLength); + } + + public static byte[] PerfMapV1SignatureHelper(IEnumerable inputAssemblies, TargetDetails details) + { + IEnumerable orderedInputs = inputAssemblies.OrderBy(asm => asm.Name, StringComparer.OrdinalIgnoreCase); + List inputHash = new List(); + foreach (AssemblyInfo inputAssembly in orderedInputs) + { + inputHash.AddRange(inputAssembly.Mvid.ToByteArray()); + } + + PerfmapTokensForTarget targetTokens = TranslateTargetDetailsToPerfmapConstants(details); + + byte[] buffer = new byte[12]; + if (!BitConverter.TryWriteBytes(buffer.AsSpan(0, sizeof(uint)), (uint)targetTokens.OperatingSystem) + || !BitConverter.TryWriteBytes(buffer.AsSpan(4, sizeof(uint)), (uint)targetTokens.Architecture) + || !BitConverter.TryWriteBytes(buffer.AsSpan(8, sizeof(uint)), (uint)targetTokens.Abi)) + { + throw new InvalidOperationException(); + } + + if (!BitConverter.IsLittleEndian) + { + buffer.AsSpan(0, sizeof(uint)).Reverse(); + buffer.AsSpan(4, sizeof(uint)).Reverse(); + buffer.AsSpan(8, sizeof(uint)).Reverse(); + } + + inputHash.AddRange(buffer); + byte[] hash = MD5.HashData(inputHash.ToArray()); + + return hash; + } + + internal record struct PerfmapTokensForTarget(PerfMapOSToken OperatingSystem, PerfMapArchitectureToken Architecture, PerfMapAbiToken Abi); + + private static PerfmapTokensForTarget TranslateTargetDetailsToPerfmapConstants(TargetDetails details) + { + PerfMapOSToken osToken = details.OperatingSystem switch + { + TargetOS.Unknown => PerfMapOSToken.Unknown, + TargetOS.Windows => PerfMapOSToken.Windows, + TargetOS.Linux => PerfMapOSToken.Linux, + TargetOS.OSX => PerfMapOSToken.OSX, + TargetOS.FreeBSD => PerfMapOSToken.FreeBSD, + TargetOS.NetBSD => PerfMapOSToken.NetBSD, + TargetOS.SunOS => PerfMapOSToken.SunOS, + _ => throw new NotImplementedException(details.OperatingSystem.ToString()) + }; + + PerfMapAbiToken abiToken = details.Abi switch + { + TargetAbi.Unknown => PerfMapAbiToken.Unknown, + TargetAbi.CoreRT => PerfMapAbiToken.Default, + TargetAbi.CoreRTArmel => PerfMapAbiToken.Armel, + _ => throw new NotImplementedException(details.Abi.ToString()) + }; + + PerfMapArchitectureToken archToken = details.Architecture switch + { + TargetArchitecture.Unknown => PerfMapArchitectureToken.Unknown, + TargetArchitecture.ARM => PerfMapArchitectureToken.ARM, + TargetArchitecture.ARM64 => PerfMapArchitectureToken.ARM64, + TargetArchitecture.X64 => PerfMapArchitectureToken.X64, + TargetArchitecture.X86 => PerfMapArchitectureToken.X86, + _ => throw new NotImplementedException(details.Architecture.ToString()) + }; + + return new PerfmapTokensForTarget(osToken, archToken, abiToken); + } + private void WriteLine(string methodName, uint rva, uint length) { _writer.WriteLine($@"{rva:X8} {length:X2} {methodName}"); diff --git a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ReadyToRunDiagnosticsConstants.cs b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ReadyToRunDiagnosticsConstants.cs new file mode 100644 index 00000000000000..fea26f9db02897 --- /dev/null +++ b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ReadyToRunDiagnosticsConstants.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Internal.ReadyToRunDiagnosticsConstants; + +public enum PerfMapPseudoRVAToken : uint +{ + OutputSignature = 0xFFFFFFFF, + FormatVersion = 0xFFFFFFFE, + TargetOS = 0xFFFFFFFD, + TargetArchitecture = 0xFFFFFFFC, + TargetABI = 0xFFFFFFFB, +} + +public enum PerfMapArchitectureToken : uint +{ + Unknown = 0, + ARM = 1, + ARM64 = 2, + X64 = 3, + X86 = 4, +} + +public enum PerfMapOSToken : uint +{ + Unknown = 0, + Windows = 1, + Linux = 2, + OSX = 3, + FreeBSD = 4, + NetBSD = 5, + SunOS = 6, +} + +public enum PerfMapAbiToken : uint +{ + Unknown = 0, + Default = 1, + Armel = 2, +} diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs index 6404f77fbac06d..d704579efd7661 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs @@ -27,7 +27,7 @@ namespace ILCompiler.DependencyAnalysis internal class ReadyToRunObjectWriter { /// - /// Nodefactory for which ObjectWriter is instantiated for. + /// Nodefactory for which ObjectWriter is instantiated for. /// private readonly NodeFactory _nodeFactory; @@ -234,6 +234,7 @@ public void EmitPortableExecutable() peIdProvider); NativeDebugDirectoryEntryNode nativeDebugDirectoryEntryNode = null; + PerfMapDebugDirectoryEntryNode perfMapDebugDirectoryEntryNode = null; ISymbolDefinitionNode firstImportThunk = null; ISymbolDefinitionNode lastImportThunk = null; ObjectNode lastWrittenObjectNode = null; @@ -261,6 +262,13 @@ public void EmitPortableExecutable() nativeDebugDirectoryEntryNode = nddeNode; } + if (node is PerfMapDebugDirectoryEntryNode pmdeNode) + { + // There should be only one PerfMapDebugDirectoryEntryNode. + Debug.Assert(perfMapDebugDirectoryEntryNode is null); + perfMapDebugDirectoryEntryNode = pmdeNode; + } + if (node is ImportThunk importThunkNode) { Debug.Assert(firstImportThunk == null || lastWrittenObjectNode is ImportThunk, @@ -305,7 +313,7 @@ public void EmitPortableExecutable() { r2rPeBuilder.AddSymbolForRange(_nodeFactory.DelayLoadMethodCallThunks, firstImportThunk, lastImportThunk); } - + if (_nodeFactory.Win32ResourcesNode != null) { @@ -313,6 +321,14 @@ public void EmitPortableExecutable() r2rPeBuilder.SetWin32Resources(_nodeFactory.Win32ResourcesNode, _nodeFactory.Win32ResourcesNode.Size); } + if (_outputInfoBuilder != null) + { + foreach (string inputFile in _inputFiles) + { + _outputInfoBuilder.AddInputModule(_nodeFactory.TypeSystemContext.GetModuleFromPath(inputFile)); + } + } + using (var peStream = File.Create(_objectFilePath)) { r2rPeBuilder.Write(peStream, timeDateStamp); @@ -322,26 +338,36 @@ public void EmitPortableExecutable() _mapFileBuilder.SetFileSize(peStream.Length); } - // Compute MD5 hash of the output image and store that in the native DebugDirectory entry - using (var md5Hash = MD5.Create()) + if (nativeDebugDirectoryEntryNode is not null) { - peStream.Seek(0, SeekOrigin.Begin); - byte[] hash = md5Hash.ComputeHash(peStream); - byte[] rsdsEntry = nativeDebugDirectoryEntryNode.GenerateRSDSEntryData(hash); + Debug.Assert(_generatePdbFile); + // Compute MD5 hash of the output image and store that in the native DebugDirectory entry + using (var md5Hash = MD5.Create()) + { + peStream.Seek(0, SeekOrigin.Begin); + byte[] hash = md5Hash.ComputeHash(peStream); + byte[] rsdsEntry = nativeDebugDirectoryEntryNode.GenerateRSDSEntryData(hash); + + int offsetToUpdate = r2rPeBuilder.GetSymbolFilePosition(nativeDebugDirectoryEntryNode); + peStream.Seek(offsetToUpdate, SeekOrigin.Begin); + peStream.Write(rsdsEntry); + } + } + + if (perfMapDebugDirectoryEntryNode is not null) + { + Debug.Assert(_generatePerfMapFile && _outputInfoBuilder is not null && _outputInfoBuilder.EnumerateInputAssemblies().Any()); + byte[] perfmapSig = PerfMapWriter.PerfMapV1SignatureHelper(_outputInfoBuilder.EnumerateInputAssemblies(), _nodeFactory.Target); + byte[] perfMapEntry = perfMapDebugDirectoryEntryNode.GeneratePerfMapEntryData(perfmapSig, _perfMapFormatVersion); - int offsetToUpdate = r2rPeBuilder.GetSymbolFilePosition(nativeDebugDirectoryEntryNode); + int offsetToUpdate = r2rPeBuilder.GetSymbolFilePosition(perfMapDebugDirectoryEntryNode); peStream.Seek(offsetToUpdate, SeekOrigin.Begin); - peStream.Write(rsdsEntry); + peStream.Write(perfMapEntry); } } if (_outputInfoBuilder != null) { - foreach (string inputFile in _inputFiles) - { - _outputInfoBuilder.AddInputModule(_nodeFactory.TypeSystemContext.GetModuleFromPath(inputFile)); - } - r2rPeBuilder.AddSections(_outputInfoBuilder); if (_generateMapFile) @@ -374,7 +400,7 @@ public void EmitPortableExecutable() { path = Path.GetDirectoryName(_objectFilePath); } - _symbolFileBuilder.SavePerfMap(path, _perfMapFormatVersion, _objectFilePath, _nodeFactory.Target.OperatingSystem, _nodeFactory.Target.Architecture); + _symbolFileBuilder.SavePerfMap(path, _perfMapFormatVersion, _objectFilePath, _nodeFactory.Target); } if (_profileFileBuilder != null) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryEntryNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryEntryNode.cs index 9aa6e6bbc46099..ae6323797d2c31 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryEntryNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryEntryNode.cs @@ -43,6 +43,76 @@ public override int CompareToImpl(ISortableNode other, CompilerComparer comparer } } + public class PerfMapDebugDirectoryEntryNode : DebugDirectoryEntryNode + { + const int PerfMapEntrySize = + sizeof(uint) + // Magic + SignatureSize + // Signature + sizeof(uint) + // Age + 260; // FileName + + public const uint PerfMapMagic = 0x4D523252;// R2RM + + public const int PerfMapEntryType = 21; // DebugDirectoryEntryType for this entry. + + private const int SignatureSize = 16; + + public override int ClassCode => 813123850; + + public unsafe int Size => PerfMapEntrySize; + + public PerfMapDebugDirectoryEntryNode(string entryName) + : base(null) + { + _entryName = entryName; + } + + private string _entryName; + + public override void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) + { + sb.Append(nameMangler.CompilationUnitPrefix); + sb.Append($"__PerfMapDebugDirectoryEntryNode_{_entryName.Replace('.','_')}"); + } + + public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) + { + ObjectDataBuilder builder = new ObjectDataBuilder(factory, relocsOnly); + builder.RequireInitialPointerAlignment(); + builder.AddSymbol(this); + + // Emit empty entry. This will be filled with data after the output image is emitted + builder.EmitZeros(PerfMapEntrySize); + + return builder.ToObjectData(); + } + + public byte[] GeneratePerfMapEntryData(byte[] signature, int version) + { + Debug.Assert(SignatureSize == signature.Length); + MemoryStream perfmapEntry = new MemoryStream(PerfMapEntrySize); + + using (BinaryWriter writer = new BinaryWriter(perfmapEntry)) + { + writer.Write(PerfMapMagic); + writer.Write(signature); + writer.Write(version); + + byte[] perfmapNameBytes = Encoding.UTF8.GetBytes(_entryName); + writer.Write(perfmapNameBytes); + writer.Write(0); // Null terminator + + Debug.Assert(perfmapEntry.Length <= PerfMapEntrySize); + return perfmapEntry.ToArray(); + } + } + + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) + { + return _entryName.CompareTo(((PerfMapDebugDirectoryEntryNode)other)._entryName); + } + } + public class NativeDebugDirectoryEntryNode : DebugDirectoryEntryNode { const int RSDSSize = @@ -55,6 +125,8 @@ public class NativeDebugDirectoryEntryNode : DebugDirectoryEntryNode public unsafe int Size => RSDSSize; + public const uint RsdsMagic = 0x53445352;// R2RM + public NativeDebugDirectoryEntryNode(string pdbName) : base(null) { @@ -87,8 +159,7 @@ public byte[] GenerateRSDSEntryData(byte[] md5Hash) using (BinaryWriter writer = new BinaryWriter(rsdsEntry)) { - // Magic "RSDS" - writer.Write((uint)0x53445352); + writer.Write(RsdsMagic); // The PDB signature will be the same as our NGEN signature. // However we want the printed version of the GUID to be the same as the @@ -105,6 +176,7 @@ public byte[] GenerateRSDSEntryData(byte[] md5Hash) string pdbFileName = _pdbName; byte[] pdbFileNameBytes = Encoding.UTF8.GetBytes(pdbFileName); writer.Write(pdbFileNameBytes); + writer.Write(0); // Null terminator Debug.Assert(rsdsEntry.Length <= RSDSSize); return rsdsEntry.ToArray(); diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryNode.cs index 175025449039bd..fd1fb49d25febd 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryNode.cs @@ -1,13 +1,14 @@ // 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.Immutable; using System.Diagnostics; using System.IO; +using System.Linq; using System.Reflection.PortableExecutable; using Internal.Text; +using Internal.TypeSystem; using Internal.TypeSystem.Ecma; namespace ILCompiler.DependencyAnalysis.ReadyToRun @@ -26,9 +27,11 @@ public class DebugDirectoryNode : ObjectNode, ISymbolDefinitionNode private EcmaModule _module; private NativeDebugDirectoryEntryNode _nativeEntry; + private PerfMapDebugDirectoryEntryNode _perfMapEntry; + private bool _insertDeterministicEntry; - public DebugDirectoryNode(EcmaModule sourceModule, string outputFileName) + public DebugDirectoryNode(EcmaModule sourceModule, string outputFileName, bool shouldAddNiPdb, bool shouldGeneratePerfmap) { _module = sourceModule; _insertDeterministicEntry = sourceModule == null; // Mark module as deterministic if generating composite image @@ -37,7 +40,16 @@ public DebugDirectoryNode(EcmaModule sourceModule, string outputFileName) { pdbNameRoot = sourceModule.Assembly.GetName().Name; } - _nativeEntry = new NativeDebugDirectoryEntryNode(pdbNameRoot + ".ni.pdb"); + + if (shouldAddNiPdb) + { + _nativeEntry = new NativeDebugDirectoryEntryNode(pdbNameRoot + ".ni.pdb"); + } + + if (shouldGeneratePerfmap) + { + _perfMapEntry = new PerfMapDebugDirectoryEntryNode(pdbNameRoot + ".ni.r2rmap"); + } } public override ObjectNodeSection Section => ObjectNodeSection.TextSection; @@ -52,7 +64,10 @@ public DebugDirectoryNode(EcmaModule sourceModule, string outputFileName) public int Offset => 0; - public int Size => (GetNumDebugDirectoryEntriesInModule() + 1 + (_insertDeterministicEntry ? 1 : 0)) * ImageDebugDirectorySize; + public int Size => (GetNumDebugDirectoryEntriesInModule() + + (_nativeEntry is not null ? 1 : 0) + + (_perfMapEntry is not null ? 1 : 0) + + (_insertDeterministicEntry ? 1 : 0)) * ImageDebugDirectorySize; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { @@ -83,27 +98,23 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) builder.RequireInitialPointerAlignment(); builder.AddSymbol(this); - ImmutableArray entries = default(ImmutableArray); + ImmutableArray entries = ImmutableArray.Empty; if (_module != null) entries = _module.PEReader.ReadDebugDirectory(); int numEntries = GetNumDebugDirectoryEntriesInModule(); + // Reuse the module's PDB entry + DebugDirectoryEntry pdbEntry = entries.Where(s => s.Type == DebugDirectoryEntryType.CodeView).FirstOrDefault(); + // First, write the native debug directory entry + if (_nativeEntry is not null) { var entry = _nativeEntry; builder.EmitUInt(0 /* Characteristics */); - if (numEntries > 0) - { - builder.EmitUInt(entries[0].Stamp); - builder.EmitUShort(entries[0].MajorVersion); - } - else - { - builder.EmitUInt(0); - builder.EmitUShort(0); - } + builder.EmitUInt(pdbEntry.Stamp); + builder.EmitUShort(pdbEntry.MajorVersion); // Make sure the "is portable pdb" indicator (MinorVersion == 0x504d) is clear // for the NGen debug directory entry since this debug directory can be copied // from an existing entry which could be a portable pdb. @@ -114,6 +125,21 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) builder.EmitReloc(entry, RelocType.IMAGE_REL_FILE_ABSOLUTE); } + // Second emit a record for the perfmap + if (_perfMapEntry is not null) + { + var entry = _perfMapEntry; + + builder.EmitUInt(0); /* Characteristics */ + builder.EmitUInt(0); /* Stamp */ + builder.EmitUShort(1); /* Major */ + builder.EmitUShort(0); /* Minor */ + builder.EmitInt((int)PerfMapDebugDirectoryEntryNode.PerfMapEntryType); + builder.EmitInt(entry.Size); + builder.EmitReloc(entry, RelocType.IMAGE_REL_BASED_ADDR32NB); + builder.EmitReloc(entry, RelocType.IMAGE_REL_FILE_ABSOLUTE); + } + // If generating a composite image, emit the deterministic marker if (_insertDeterministicEntry) { diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugInfoTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugInfoTableNode.cs index fd628b637a17f9..24f5409a318f90 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugInfoTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugInfoTableNode.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using Internal.JitInterface; @@ -149,11 +150,13 @@ public static byte[] CreateBoundsBlobForMethod(OffsetMapping[] offsetMapping) return writer.ToArray(); } - public static byte[] CreateVarBlobForMethod(NativeVarInfo[] varInfos) + public static byte[] CreateVarBlobForMethod(NativeVarInfo[] varInfos, TargetDetails target) { if (varInfos == null || varInfos.Length == 0) return null; + bool isX86 = target.Architecture == TargetArchitecture.X86; + NibbleWriter writer = new NibbleWriter(); writer.WriteUInt((uint)varInfos.Length); @@ -177,7 +180,7 @@ public static byte[] CreateVarBlobForMethod(NativeVarInfo[] varInfos) case VarLocType.VLT_STK: case VarLocType.VLT_STK_BYREF: writer.WriteUInt((uint)nativeVarInfo.varLoc.B); - writer.WriteInt(nativeVarInfo.varLoc.C); + WriteEncodedStackOffset(writer, nativeVarInfo.varLoc.C, assume4ByteAligned : isX86); break; case VarLocType.VLT_REG_REG: writer.WriteUInt((uint)nativeVarInfo.varLoc.B); @@ -186,16 +189,16 @@ public static byte[] CreateVarBlobForMethod(NativeVarInfo[] varInfos) case VarLocType.VLT_REG_STK: writer.WriteUInt((uint)nativeVarInfo.varLoc.B); writer.WriteUInt((uint)nativeVarInfo.varLoc.C); - writer.WriteInt(nativeVarInfo.varLoc.D); + WriteEncodedStackOffset(writer, nativeVarInfo.varLoc.D, assume4ByteAligned : isX86); break; case VarLocType.VLT_STK_REG: - writer.WriteInt(nativeVarInfo.varLoc.B); + WriteEncodedStackOffset(writer, nativeVarInfo.varLoc.B, assume4ByteAligned : isX86); writer.WriteUInt((uint)nativeVarInfo.varLoc.C); writer.WriteUInt((uint)nativeVarInfo.varLoc.D); break; case VarLocType.VLT_STK2: writer.WriteUInt((uint)nativeVarInfo.varLoc.B); - writer.WriteInt(nativeVarInfo.varLoc.C); + WriteEncodedStackOffset(writer, nativeVarInfo.varLoc.C, assume4ByteAligned : isX86); break; case VarLocType.VLT_FPSTK: writer.WriteUInt((uint)nativeVarInfo.varLoc.B); @@ -206,6 +209,19 @@ public static byte[] CreateVarBlobForMethod(NativeVarInfo[] varInfos) default: throw new BadImageFormatException("Unexpected var loc type"); } + + static void WriteEncodedStackOffset(NibbleWriter _writer, int offset, bool assume4ByteAligned) + { + if (assume4ByteAligned) + { + Debug.Assert(offset % 4 == 0); + _writer.WriteInt(offset / 4); + } + else + { + _writer.WriteInt(offset); + } + } } return writer.ToArray(); diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstanceEntryPointTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstanceEntryPointTableNode.cs index 548abb4d8a5e99..c63e589328b305 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstanceEntryPointTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstanceEntryPointTableNode.cs @@ -17,22 +17,58 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { - public class InstanceEntryPointTableNode : HeaderTableNode + public class InstanceEntryPointTableNode : HeaderTableNode, ISignatureEmitter { private readonly NodeFactory _factory; + private bool _materializedSignature; public InstanceEntryPointTableNode(NodeFactory factory) : base(factory.Target) { _factory = factory; + _factory.ManifestMetadataTable.RegisterEmitter(this); } - + + public void MaterializeSignature() + { + if (!_materializedSignature) + { + if (_factory.CompilationModuleGroup.IsInputBubble) + { + foreach (MethodWithGCInfo method in _factory.EnumerateCompiledMethods(null, CompiledMethodCategory.Instantiated)) + { + BuildSignatureForMethod(method, _factory); + } + } + + _materializedSignature = true; + } + } + public override void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { sb.Append(nameMangler.CompilationUnitPrefix); sb.Append("__ReadyToRunInstanceEntryPointTable"); } + private ArraySignatureBuilder BuildSignatureForMethod(MethodWithGCInfo method, NodeFactory factory) + { + // In composite R2R format, always enforce owning type to let us share generic instantiations among modules + + EcmaMethod typicalMethod = (EcmaMethod)method.Method.GetTypicalMethodDefinition(); + ModuleToken moduleToken = new ModuleToken(typicalMethod.Module, typicalMethod.Handle); + + ArraySignatureBuilder signatureBuilder = new ArraySignatureBuilder(); + signatureBuilder.EmitMethodSignature( + new MethodWithToken(method.Method, moduleToken, constrainedType: null, unboxing: false, context: null), + enforceDefEncoding: true, + enforceOwningType: _factory.CompilationModuleGroup.EnforceOwningType(moduleToken.Module), + factory.SignatureContext, + isInstantiatingStub: false); + + return signatureBuilder; + } + public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) { if (relocsOnly) @@ -55,17 +91,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) int methodIndex = factory.RuntimeFunctionsTable.GetIndex(method); - // In composite R2R format, always enforce owning type to let us share generic instantiations among modules - EcmaMethod typicalMethod = (EcmaMethod)method.Method.GetTypicalMethodDefinition(); - ModuleToken moduleToken = new ModuleToken(typicalMethod.Module, typicalMethod.Handle); - - ArraySignatureBuilder signatureBuilder = new ArraySignatureBuilder(); - signatureBuilder.EmitMethodSignature( - new MethodWithToken(method.Method, moduleToken, constrainedType: null, unboxing: false, context: null), - enforceDefEncoding: true, - enforceOwningType: _factory.CompilationModuleGroup.EnforceOwningType(moduleToken.Module), - factory.SignatureContext, - isInstantiatingStub: false); + ArraySignatureBuilder signatureBuilder = BuildSignatureForMethod(method, factory); byte[] signature = signatureBuilder.ToArray(); BlobVertex signatureBlob; if (!uniqueSignatures.TryGetValue(signature, out signatureBlob)) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs index 80f80b202cecc7..ca6b4fc84d3a7d 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Collections.Concurrent; using System.Linq; using System.Reflection; using System.Reflection.Metadata; @@ -63,6 +64,11 @@ public class ManifestMetadataTableNode : HeaderTableNode /// private int _nextModuleId; + /// + /// Modules which need to exist in set of modules visible + /// + private ConcurrentBag _modulesWhichMustBeIndexable = new ConcurrentBag(); + /// /// Set to true after GetData has been called. After that, ModuleToIndex may be called no more. /// @@ -136,6 +142,19 @@ public int ModuleToIndex(EcmaModule module) return ModuleToIndexInternal(module); } + public void EnsureModuleIndexable(ModuleDesc module) + { + if (_emissionCompleted) + { + throw new InvalidOperationException("Adding a new assembly after signatures have been materialized."); + } + + if (module is EcmaModule ecmaModule && _nodeFactory.CompilationModuleGroup.VersionsWithModule(ecmaModule)) + { + _modulesWhichMustBeIndexable.Add(ecmaModule); + } + } + private int ModuleToIndexInternal(EcmaModule module) { AssemblyName assemblyName = module.Assembly.GetName(); @@ -170,13 +189,8 @@ public override void AppendMangledName(NameMangler nameMangler, Utf8StringBuilde sb.Append("ManifestMetadataTableNode"); } - public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) + private void ComputeLastSetOfModuleIndices() { - if (relocsOnly) - { - return new ObjectData(Array.Empty(), null, 1, null); - } - if (!_emissionCompleted) { foreach (ISignatureEmitter emitter in _signatureEmitters) @@ -184,8 +198,25 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) emitter.MaterializeSignature(); } + EcmaModule [] moduleArray = _modulesWhichMustBeIndexable.ToArray(); + Array.Sort(moduleArray, (EcmaModule moduleA, EcmaModule moduleB) => moduleA.CompareTo(moduleB)); + foreach (var module in moduleArray) + { + ModuleToIndex(module); + } + _emissionCompleted = true; } + } + + public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) + { + if (relocsOnly) + { + return new ObjectData(Array.Empty(), null, 1, null); + } + + ComputeLastSetOfModuleIndices(); MetadataBuilder metadataBuilder = new MetadataBuilder(); @@ -277,6 +308,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) internal byte[] GetManifestAssemblyMvidTableData() { + ComputeLastSetOfModuleIndices(); + byte[] manifestAssemblyMvidTable = new byte[ManifestAssemblyMvidTableSize]; for (int i = 0; i < _manifestAssemblyMvids.Count; i++) { diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodWithGCInfo.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodWithGCInfo.cs index 9dc2907900a4a5..514441e2ba646a 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodWithGCInfo.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodWithGCInfo.cs @@ -8,6 +8,7 @@ using Internal.JitInterface; using Internal.Text; using Internal.TypeSystem; +using Internal.TypeSystem.Ecma; namespace ILCompiler.DependencyAnalysis.ReadyToRun { @@ -45,6 +46,34 @@ protected override void OnMarked(NodeFactory context) InitializeFrameInfos(Array.Empty()); } _lateTriggeredCompilation = context.CompilationCurrentPhase != 0; + RegisterInlineeModuleIndices(context); + } + + private void RegisterInlineeModuleIndices(NodeFactory factory) + { + if (_inlinedMethods != null) + { + foreach (var inlinee in _inlinedMethods) + { + MethodDesc inlineeDefinition = inlinee.GetTypicalMethodDefinition(); + if (!(inlineeDefinition is EcmaMethod ecmaInlineeDefinition)) + { + // We don't record non-ECMA methods because they don't have tokens that + // diagnostic tools could reason about anyway. + continue; + } + + if (!factory.CompilationModuleGroup.VersionsWithMethodBody(inlinee)) + { + // We cannot record inlining info across version bubble as cross-bubble assemblies + // are not guaranteed to preserve token values. Only non-versionable methods may be + // inlined across the version bubble. + Debug.Assert(inlinee.IsNonVersionable()); + continue; + } + factory.ManifestMetadataTable.EnsureModuleIndexable(ecmaInlineeDefinition.Module); + } + } } public override int DependencyPhaseForDeferredStaticComputation => _lateTriggeredCompilation ? 2 : 0; @@ -296,12 +325,12 @@ public void InitializeDebugLocInfos(OffsetMapping[] debugLocInfos) _debugLocInfos = DebugInfoTableNode.CreateBoundsBlobForMethod(debugLocInfos); } - public void InitializeDebugVarInfos(NativeVarInfo[] debugVarInfos) + public void InitializeDebugVarInfos(NativeVarInfo[] debugVarInfos, TargetDetails target) { Debug.Assert(_debugVarInfos == null); // Process the debug info from JIT format to R2R format immediately as it is large // and not used in the rest of the process except to emit. - _debugVarInfos = DebugInfoTableNode.CreateVarBlobForMethod(debugVarInfos); + _debugVarInfos = DebugInfoTableNode.CreateVarBlobForMethod(debugVarInfos, target); } public void InitializeDebugEHClauseInfos(DebugEHClauseInfo[] debugEHClauseInfos) @@ -316,10 +345,12 @@ public override int CompareToImpl(ISortableNode other, CompilerComparer comparer return comparer.Compare(_method, otherNode._method); } - public void InitializeInliningInfo(MethodDesc[] inlinedMethods) + public void InitializeInliningInfo(MethodDesc[] inlinedMethods, NodeFactory factory) { Debug.Assert(_inlinedMethods == null); _inlinedMethods = inlinedMethods; + if (this.Marked) + RegisterInlineeModuleIndices(factory); } public int Offset => 0; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs index de7ada8b21e01a..a5c7359a048b04 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs @@ -236,7 +236,7 @@ public sealed class ReadyToRunCodegenCompilation : Compilation private readonly IEnumerable _inputFiles; private readonly string _compositeRootPath; - + private readonly bool _resilient; private readonly int _parallelism; @@ -400,7 +400,9 @@ private void RewriteComponentFile(string inputFile, string outputFile, string ow } CopiedCorHeaderNode copiedCorHeader = new CopiedCorHeaderNode(inputModule); - DebugDirectoryNode debugDirectory = new DebugDirectoryNode(inputModule, outputFile); + // Re-written components shouldn't have any additional diagnostic information - only information about the forwards. + // Even with all of this, we might be modifying the image in a silly manner - adding a directory when if didn't have one. + DebugDirectoryNode debugDirectory = new DebugDirectoryNode(inputModule, outputFile, shouldAddNiPdb: false, shouldGeneratePerfmap: false); NodeFactory componentFactory = new NodeFactory( _nodeFactory.TypeSystemContext, _nodeFactory.CompilationModuleGroup, @@ -490,7 +492,7 @@ private bool IsLayoutFixedInCurrentVersionBubbleInternal(TypeDesc type) var fieldType = field.FieldType; if (!fieldType.IsValueType) continue; - + if (!IsLayoutFixedInCurrentVersionBubble(fieldType)) { return false; @@ -515,7 +517,7 @@ public bool IsInheritanceChainLayoutFixedInCurrentVersionBubble(TypeDesc type) { return false; } - + type = type.BaseType; if (type != null) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs index c1207a4b5b2f00..34aced76b44b01 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs @@ -219,7 +219,7 @@ public override ICompilation ToCompilation() EcmaModule singleModule = _compilationGroup.IsCompositeBuildMode ? null : inputModules.First(); CopiedCorHeaderNode corHeaderNode = new CopiedCorHeaderNode(singleModule); // TODO: proper support for multiple input files - DebugDirectoryNode debugDirectoryNode = new DebugDirectoryNode(singleModule, _outputFile); + DebugDirectoryNode debugDirectoryNode = new DebugDirectoryNode(singleModule, _outputFile, _generatePdbFile, _generatePerfMapFile); // Produce a ResourceData where the IBC PROFILE_DATA entry has been filtered out // TODO: proper support for multiple input files diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunFileLayoutOptimizer.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunFileLayoutOptimizer.cs index d8d6d36191a7c7..4ef5443e4f5477 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunFileLayoutOptimizer.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunFileLayoutOptimizer.cs @@ -26,6 +26,7 @@ public enum ReadyToRunMethodLayoutAlgorithm HotWarmCold, CallFrequency, PettisHansen, + Random, } public enum ReadyToRunFileLayoutAlgorithm @@ -166,6 +167,17 @@ int ComputeHotWarmColdRegion(MethodWithGCInfo method) methods = PettisHansenSort(methods); break; + case ReadyToRunMethodLayoutAlgorithm.Random: + Random rand = new Random(0); + for (int i = 0; i < methods.Count - 1; i++) + { + int j = rand.Next(i, methods.Count); + MethodWithGCInfo temp = methods[i]; + methods[i] = methods[j]; + methods[j] = temp; + } + break; + default: throw new NotImplementedException(_methodLayoutAlgorithm.ToString()); } 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/Compiler/ReadyToRunTableManager.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunTableManager.cs index 8f37f8e9b62ff2..e8b8f0ab0b5e59 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunTableManager.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunTableManager.cs @@ -101,16 +101,30 @@ public IEnumerable GetCompiledMethods(EcmaModule moduleToEnumerate, { if (!_sortedMethods) { - TypeSystemComparer comparer = new TypeSystemComparer(); - Comparison sortHelper = (x, y) => comparer.Compare(x.Method, y.Method); + CompilerComparer comparer = new CompilerComparer(); + SortableDependencyNode.ObjectNodeComparer objectNodeComparer = new SortableDependencyNode.ObjectNodeComparer(comparer); + Comparison sortHelper = (x, y) => + { + int nodeComparerResult = objectNodeComparer.Compare((SortableDependencyNode)x, (SortableDependencyNode)y); +#if DEBUG + int methodOnlyResult = comparer.Compare(x.Method, y.Method); + + // Assert the two sorting techniques produce the same result unless there is a CustomSort applied + Debug.Assert((nodeComparerResult == methodOnlyResult) || + ((x is SortableDependencyNode sortableX && sortableX.CustomSort != Int32.MaxValue) || + (y is SortableDependencyNode sortableY && sortableY.CustomSort != Int32.MaxValue))); +#endif + return nodeComparerResult; + }; + Comparison sortHelperNoCustomSort = (x, y) => comparer.Compare(x, y); List perModuleDatas = new List(_methodsGenerated.Values); perModuleDatas.Sort((x, y) => x.Module.CompareTo(y.Module)); foreach (var perModuleData in perModuleDatas) { - perModuleData.MethodsGenerated.MergeSort(sortHelper); - perModuleData.GenericMethodsGenerated.MergeSort(sortHelper); + perModuleData.MethodsGenerated.MergeSort(sortHelperNoCustomSort); + perModuleData.GenericMethodsGenerated.MergeSort(sortHelperNoCustomSort); _completeSortedMethods.AddRange(perModuleData.MethodsGenerated); _completeSortedMethods.AddRange(perModuleData.GenericMethodsGenerated); _completeSortedGenericMethods.AddRange(perModuleData.GenericMethodsGenerated); 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 7da42e09791fda..927148cf006e26 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 @@ -40,21 +40,18 @@ protected static Marshaller CreateMarshaller(MarshallerKind kind) } } - public static Marshaller[] GetMarshallersForMethod(MethodDesc targetMethod) + private static Marshaller[] GetMarshallers( + MethodSignature methodSig, + PInvokeFlags flags, + ParameterMetadata[] parameterMetadataArray) { - Debug.Assert(targetMethod.IsPInvoke); - - MarshalDirection direction = MarshalDirection.Forward; - MethodSignature methodSig = targetMethod.Signature; - PInvokeFlags flags = targetMethod.GetPInvokeMethodMetadata().Flags; - - ParameterMetadata[] parameterMetadataArray = targetMethod.GetParameterMetadata(); Marshaller[] marshallers = new Marshaller[methodSig.Length + 1]; - ParameterMetadata parameterMetadata; for (int i = 0, parameterIndex = 0; i < marshallers.Length; i++) { Debug.Assert(parameterIndex == parameterMetadataArray.Length || i <= parameterMetadataArray[parameterIndex].Index); + + ParameterMetadata parameterMetadata; if (parameterIndex == parameterMetadataArray.Length || i < parameterMetadataArray[parameterIndex].Index) { // if we don't have metadata for the parameter, create a dummy one @@ -72,7 +69,7 @@ public static Marshaller[] GetMarshallersForMethod(MethodDesc targetMethod) methodSig.GetEmbeddedSignatureData(), MarshallerType.Argument, parameterMetadata.MarshalAsDescriptor, - direction, + MarshalDirection.Forward, marshallers, parameterMetadata.Index, flags, @@ -84,6 +81,24 @@ public static Marshaller[] GetMarshallersForMethod(MethodDesc targetMethod) return marshallers; } + + public static Marshaller[] GetMarshallersForMethod(MethodDesc targetMethod) + { + Debug.Assert(targetMethod.IsPInvoke); + return GetMarshallers( + targetMethod.Signature, + targetMethod.GetPInvokeMethodMetadata().Flags, + targetMethod.GetParameterMetadata()); + } + + public static Marshaller[] GetMarshallersForSignature(MethodSignature methodSig, ParameterMetadata[] paramMetadata) + { + return GetMarshallers( + methodSig, + new PInvokeFlags(PInvokeAttributes.None), + paramMetadata); + } + public static bool IsMarshallingRequired(MethodDesc targetMethod) { Debug.Assert(targetMethod.IsPInvoke); @@ -115,25 +130,10 @@ public static bool IsMarshallingRequired(MethodDesc targetMethod) public static bool IsMarshallingRequired(MethodSignature methodSig, ParameterMetadata[] paramMetadata) { - for (int i = 0, paramIndex = 0; i < methodSig.Length + 1; i++) + Marshaller[] marshallers = GetMarshallersForSignature(methodSig, paramMetadata); + for (int i = 0; i < marshallers.Length; i++) { - ParameterMetadata parameterMetadata = (paramIndex == paramMetadata.Length || i < paramMetadata[paramIndex].Index) ? - new ParameterMetadata(i, ParameterMetadataAttributes.None, null) : - paramMetadata[paramIndex++]; - - TypeDesc parameterType = (i == 0) ? methodSig.ReturnType : methodSig[i - 1]; //first item is the return type - - MarshallerKind marshallerKind = MarshalHelpers.GetMarshallerKind( - parameterType, - parameterIndex: i, - customModifierData: methodSig.GetEmbeddedSignatureData(), - parameterMetadata.MarshalAsDescriptor, - parameterMetadata.Return, - isAnsi: true, - MarshallerType.Argument, - out MarshallerKind elementMarshallerKind); - - if (IsMarshallingRequired(marshallerKind)) + if (marshallers[i].IsMarshallingRequired()) return true; } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SymbolFileBuilder.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SymbolFileBuilder.cs index 8cd0ad481cc6d2..d46dab26c7fd92 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SymbolFileBuilder.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/SymbolFileBuilder.cs @@ -29,7 +29,7 @@ public void SavePdb(string pdbPath, string dllFileName) new PdbWriter(pdbPath, PDBExtraData.None).WritePDBData(dllFileName, _outputInfoBuilder.EnumerateMethods()); } - public void SavePerfMap(string perfMapPath, int perfMapFormatVersion, string dllFileName, TargetOS targetOS, TargetArchitecture targetArch) + public void SavePerfMap(string perfMapPath, int perfMapFormatVersion, string dllFileName, TargetDetails details) { string perfMapExtension; if (perfMapFormatVersion == PerfMapWriter.LegacyCrossgen1FormatVersion) @@ -56,7 +56,7 @@ public void SavePerfMap(string perfMapPath, int perfMapFormatVersion, string dll string perfMapFileName = Path.Combine(perfMapPath, Path.GetFileNameWithoutExtension(dllFileName) + perfMapExtension); Console.WriteLine("Emitting PerfMap file: {0}", perfMapFileName); - PerfMapWriter.Write(perfMapFileName, perfMapFormatVersion, _outputInfoBuilder.EnumerateMethods(), _outputInfoBuilder.EnumerateInputAssemblies(), targetOS, targetArch); + PerfMapWriter.Write(perfMapFileName, perfMapFormatVersion, _outputInfoBuilder.EnumerateMethods(), _outputInfoBuilder.EnumerateInputAssemblies(), details); } } } 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 index 82452cfa3e9c6d..42a13564aac724 100644 --- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj +++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj @@ -30,7 +30,7 @@ 4.3.0 - $(SystemReflectionMetadataVersion) + $(SystemReflectionMetadataStaticVersion) 1.3.0 diff --git a/src/coreclr/tools/aot/crossgen2/Program.cs b/src/coreclr/tools/aot/crossgen2/Program.cs index afae84f57f6fac..e9eb59289f89f7 100644 --- a/src/coreclr/tools/aot/crossgen2/Program.cs +++ b/src/coreclr/tools/aot/crossgen2/Program.cs @@ -156,6 +156,7 @@ private void ProcessCommandLine(string[] args) "hotwarmcold" => ReadyToRunMethodLayoutAlgorithm.HotWarmCold, "callfrequency" => ReadyToRunMethodLayoutAlgorithm.CallFrequency, "pettishansen" => ReadyToRunMethodLayoutAlgorithm.PettisHansen, + "random" => ReadyToRunMethodLayoutAlgorithm.Random, _ => throw new CommandLineException(SR.InvalidMethodLayout) }; } diff --git a/src/coreclr/tools/aot/crossgen2/Properties/Resources.resx b/src/coreclr/tools/aot/crossgen2/Properties/Resources.resx index c122cd63abdfef..85ba1a7664ebad 100644 --- a/src/coreclr/tools/aot/crossgen2/Properties/Resources.resx +++ b/src/coreclr/tools/aot/crossgen2/Properties/Resources.resx @@ -148,7 +148,7 @@ Method layout must be either DefaultSort or MethodOrder. - Method layout must be either DefaultSort, ExclusiveWeight, HotCold, HotWarmCold, CallFrequency or PettisHansen. + Method layout must be either DefaultSort, ExclusiveWeight, HotCold, HotWarmCold, CallFrequency, PettisHansen, or Random. True to skip compiling methods into the R2R image (default = false) diff --git a/src/coreclr/tools/aot/jitinterface/jitinterface.h b/src/coreclr/tools/aot/jitinterface/jitinterface.h index 86591df5df32f9..68493f0bdc1e19 100644 --- a/src/coreclr/tools/aot/jitinterface/jitinterface.h +++ b/src/coreclr/tools/aot/jitinterface/jitinterface.h @@ -183,6 +183,7 @@ struct JitInterfaceCallbacks uint16_t (* getRelocTypeHint)(void * thisHandle, CorInfoExceptionClass** ppException, void* target); uint32_t (* getExpectedTargetArchitecture)(void * thisHandle, CorInfoExceptionClass** ppException); uint32_t (* getJitFlags)(void * thisHandle, CorInfoExceptionClass** ppException, CORJIT_FLAGS* flags, uint32_t sizeInBytes); + bool (* doesFieldBelongToClass)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_FIELD_HANDLE fldHnd, CORINFO_CLASS_HANDLE cls); }; @@ -1857,4 +1858,14 @@ class JitInterfaceWrapper : public ICorJitInfo if (pException != nullptr) throw pException; return temp; } + + virtual bool doesFieldBelongToClass( + CORINFO_FIELD_HANDLE fldHnd, + CORINFO_CLASS_HANDLE cls) +{ + CorInfoExceptionClass* pException = nullptr; + bool temp = _callbacks->doesFieldBelongToClass(_thisHandle, &pException, fldHnd, cls); + if (pException != nullptr) throw pException; + return temp; +} }; diff --git a/src/coreclr/tools/r2rdump/R2RDump.cs b/src/coreclr/tools/r2rdump/R2RDump.cs index 94d71835966e5a..db9ecd31d3ade4 100644 --- a/src/coreclr/tools/r2rdump/R2RDump.cs +++ b/src/coreclr/tools/r2rdump/R2RDump.cs @@ -146,7 +146,7 @@ private static unsafe IAssemblyMetadata Open(string filename) return new StandaloneAssemblyMetadata(peReader); } - + public SignatureFormattingOptions GetSignatureFormattingOptions() { if (signatureFormattingOptions == null) @@ -434,7 +434,9 @@ public void Dump(ReadyToRunReader r2r) { perfmapPath = Path.ChangeExtension(r2r.Filename, ".r2rmap"); } - PerfMapWriter.Write(perfmapPath, _options.PerfmapFormatVersion, ProduceDebugInfoMethods(r2r), ProduceDebugInfoAssemblies(r2r), r2r.TargetOperatingSystem, r2r.TargetArchitecture); + // TODO: can't seem to find any place that surfaces the ABI. This is for debugging purposes, so may not be as relevant to be correct. + TargetDetails details = new TargetDetails(r2r.TargetArchitecture, r2r.TargetOperatingSystem, TargetAbi.CoreRT); + PerfMapWriter.Write(perfmapPath, _options.PerfmapFormatVersion, ProduceDebugInfoMethods(r2r), ProduceDebugInfoAssemblies(r2r), details); } if (standardDump) @@ -459,7 +461,7 @@ IEnumerable ProduceDebugInfoMethods(ReadyToRunReader r2r) mi.AssemblyName = method.ComponentReader.MetadataReader.GetString(method.ComponentReader.MetadataReader.GetAssemblyDefinition().Name); mi.ColdRVA = 0; mi.ColdLength = 0; - + yield return mi; } } diff --git a/src/coreclr/tools/runincontext/runincontext.csproj b/src/coreclr/tools/runincontext/runincontext.csproj index 14a0a2cf310870..bf17769e6f0bd3 100644 --- a/src/coreclr/tools/runincontext/runincontext.csproj +++ b/src/coreclr/tools/runincontext/runincontext.csproj @@ -2,7 +2,7 @@ Exe $(NetCoreAppToolCurrent) - $(MicrosoftNETCoreAppVersion) + $(MicrosoftNETCoreAppRuntimewinx64Version) false BuildOnly $(RuntimeBinDir) diff --git a/src/coreclr/unwinder/arm64/unwinder_arm64.cpp b/src/coreclr/unwinder/arm64/unwinder_arm64.cpp index 5740c3cfcab80c..e2e1c512ee6cc3 100644 --- a/src/coreclr/unwinder/arm64/unwinder_arm64.cpp +++ b/src/coreclr/unwinder/arm64/unwinder_arm64.cpp @@ -1038,7 +1038,7 @@ Return Value: ContextRecord, 8 * (NextCode & 0x3f), 8 + ((CurCode & 1) << 2) + (NextCode >> 6), - 2 + AccumulatedSaveNexts, + 2 + 2 * AccumulatedSaveNexts, UnwindParams); AccumulatedSaveNexts = 0; } @@ -1054,7 +1054,7 @@ Return Value: ContextRecord, -8 * ((NextCode & 0x3f) + 1), 8 + ((CurCode & 1) << 2) + (NextCode >> 6), - 2 + AccumulatedSaveNexts, + 2 + 2 * AccumulatedSaveNexts, UnwindParams); AccumulatedSaveNexts = 0; } diff --git a/src/coreclr/utilcode/clrconfig.cpp b/src/coreclr/utilcode/clrconfig.cpp index 59d32c0c43091d..ca6e095504313b 100644 --- a/src/coreclr/utilcode/clrconfig.cpp +++ b/src/coreclr/utilcode/clrconfig.cpp @@ -410,7 +410,7 @@ namespace // // Arguments: // * info - see file:../inc/CLRConfig.h for details. -// +// * isDefault - the value was not set or had an invalid format so the default was returned. // * result - the result. // // Return value: @@ -431,9 +431,7 @@ DWORD CLRConfig::GetConfigValue(const ConfigDWORDInfo & info, /* [Out] */ bool * DWORD resultMaybe; HRESULT hr = GetConfigDWORD(info.name, info.defaultValue, &resultMaybe, info.options); - - // Ignore the default value even if it's set explicitly. - if (resultMaybe != info.defaultValue) + if (SUCCEEDED(hr)) { *isDefault = false; return resultMaybe; diff --git a/src/coreclr/utilcode/longfilepathwrappers.cpp b/src/coreclr/utilcode/longfilepathwrappers.cpp index 3afc611c3b2189..a3830906925950 100644 --- a/src/coreclr/utilcode/longfilepathwrappers.cpp +++ b/src/coreclr/utilcode/longfilepathwrappers.cpp @@ -514,46 +514,6 @@ UINT WINAPI GetTempFileNameWrapper( return ret; } -DWORD WINAPI GetTempPathWrapper( - SString& lpBuffer - ) -{ - CONTRACTL - { - NOTHROW; - } - CONTRACTL_END; - - HRESULT hr = S_OK; - DWORD ret = 0; - DWORD lastError; - - EX_TRY - { - //Change the behaviour in Redstone to retry - COUNT_T size = MAX_LONGPATH; - - ret = GetTempPathW( - size, - lpBuffer.OpenUnicodeBuffer(size - 1) - ); - - lastError = GetLastError(); - lpBuffer.CloseBuffer(ret); - } - EX_CATCH_HRESULT(hr); - - if (hr != S_OK) - { - SetLastError(hr); - } - else if (ret == 0) - { - SetLastError(lastError); - } - - return ret; -} DWORD WINAPI GetCurrentDirectoryWrapper( SString& lpBuffer diff --git a/src/coreclr/vm/amd64/unixstubs.cpp b/src/coreclr/vm/amd64/unixstubs.cpp index 517eea98f6b6a2..09d2568a9273b4 100644 --- a/src/coreclr/vm/amd64/unixstubs.cpp +++ b/src/coreclr/vm/amd64/unixstubs.cpp @@ -10,6 +10,7 @@ extern "C" PORTABILITY_ASSERT("Implement for PAL"); } +#if !__has_builtin(__cpuid) void __cpuid(int cpuInfo[4], int function_id) { // Based on the Clang implementation provided in cpuid.h: @@ -20,7 +21,9 @@ extern "C" : "0"(function_id) ); } +#endif +#if !__has_builtin(__cpuidex) void __cpuidex(int cpuInfo[4], int function_id, int subFunction_id) { // Based on the Clang implementation provided in cpuid.h: @@ -31,6 +34,7 @@ extern "C" : "0"(function_id), "2"(subFunction_id) ); } +#endif DWORD xmmYmmStateSupport() { diff --git a/src/coreclr/vm/appdomain.cpp b/src/coreclr/vm/appdomain.cpp index f7bf57c5b52cf1..66795acaf03762 100644 --- a/src/coreclr/vm/appdomain.cpp +++ b/src/coreclr/vm/appdomain.cpp @@ -3533,8 +3533,8 @@ DomainAssembly * AppDomain::FindAssembly(PEAssembly * pFile, FindAssemblyOptions !pManifestFile->IsResource() && pManifestFile->Equals(pFile)) { - // Caller already has PEAssembly, so we can give DomainAssembly away freely without AddRef - return pDomainAssembly.Extract(); + // Caller already has PEAssembly, so we can give DomainAssembly away freely without added reference + return pDomainAssembly.GetValue(); } } return NULL; @@ -3709,7 +3709,9 @@ BOOL AppDomain::AddFileToCache(AssemblySpec* pSpec, PEAssembly *pFile, BOOL fAll } CONTRACTL_END; - CrstHolder holder(&m_DomainCacheCrst); + GCX_PREEMP(); + DomainCacheCrstHolderForGCCoop holder(this); + // !!! suppress exceptions if(!m_AssemblyCache.StoreFile(pSpec, pFile) && !fAllowFailure) { @@ -3739,7 +3741,9 @@ BOOL AppDomain::AddAssemblyToCache(AssemblySpec* pSpec, DomainAssembly *pAssembl } CONTRACTL_END; - CrstHolder holder(&m_DomainCacheCrst); + GCX_PREEMP(); + DomainCacheCrstHolderForGCCoop holder(this); + // !!! suppress exceptions BOOL bRetVal = m_AssemblyCache.StoreAssembly(pSpec, pAssembly); return bRetVal; @@ -3760,7 +3764,9 @@ BOOL AppDomain::AddExceptionToCache(AssemblySpec* pSpec, Exception *ex) if (ex->IsTransient()) return TRUE; - CrstHolder holder(&m_DomainCacheCrst); + GCX_PREEMP(); + DomainCacheCrstHolderForGCCoop holder(this); + // !!! suppress exceptions return m_AssemblyCache.StoreException(pSpec, ex); } @@ -3778,7 +3784,7 @@ void AppDomain::AddUnmanagedImageToCache(LPCWSTR libraryName, NATIVE_LIBRARY_HAN } CONTRACTL_END; - CrstHolder lock(&m_DomainCacheCrst); + DomainCacheCrstHolderForGCPreemp lock(this); const UnmanagedImageCacheEntry *existingEntry = m_unmanagedCache.LookupPtr(libraryName); if (existingEntry != NULL) @@ -3808,7 +3814,8 @@ NATIVE_LIBRARY_HANDLE AppDomain::FindUnmanagedImageInCache(LPCWSTR libraryName) } CONTRACT_END; - CrstHolder lock(&m_DomainCacheCrst); + DomainCacheCrstHolderForGCPreemp lock(this); + const UnmanagedImageCacheEntry *existingEntry = m_unmanagedCache.LookupPtr(libraryName); if (existingEntry == NULL) RETURN NULL; @@ -3850,7 +3857,8 @@ BOOL AppDomain::RemoveAssemblyFromCache(DomainAssembly* pAssembly) } CONTRACTL_END; - CrstHolder holder(&m_DomainCacheCrst); + GCX_PREEMP(); + DomainCacheCrstHolderForGCCoop holder(this); return m_AssemblyCache.RemoveAssembly(pAssembly); } @@ -5267,7 +5275,7 @@ AppDomain::AssemblyIterator::Next_Unlocked( #if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) // Returns S_OK if the assembly was successfully loaded -HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToBindWithin, BINDER_SPACE::AssemblyName *pAssemblyName, CLRPrivBinderCoreCLR *pTPABinder, ICLRPrivAssembly **ppLoadedAssembly) +HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToBindWithin, BINDER_SPACE::AssemblyName *pAssemblyName, CLRPrivBinderCoreCLR *pTPABinder, AssemblyLoadContext *pBinder, ICLRPrivAssembly **ppLoadedAssembly) { CONTRACTL { @@ -5445,6 +5453,21 @@ HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToB COMPlusThrowHR(COR_E_INVALIDOPERATION, IDS_HOST_ASSEMBLY_RESOLVER_DYNAMICALLY_EMITTED_ASSEMBLIES_UNSUPPORTED, name); } + // For collectible assemblies, ensure that the parent loader allocator keeps the assembly's loader allocator + // alive for all its lifetime. + if (pDomainAssembly->IsCollectible()) + { + LoaderAllocator *pResultAssemblyLoaderAllocator = pDomainAssembly->GetLoaderAllocator(); + LoaderAllocator *pParentLoaderAllocator = NULL; + hr = pBinder->GetLoaderAllocator((LPVOID*)&pParentLoaderAllocator); + if (SUCCEEDED(hr)) + { + _ASSERTE(pParentLoaderAllocator); + _ASSERTE(pResultAssemblyLoaderAllocator); + pParentLoaderAllocator->EnsureReference(pResultAssemblyLoaderAllocator); + } + } + pResolvedAssembly = pLoadedPEAssembly->GetHostAssembly(); } diff --git a/src/coreclr/vm/appdomain.hpp b/src/coreclr/vm/appdomain.hpp index fb2e45682fc685..2babce339267f4 100644 --- a/src/coreclr/vm/appdomain.hpp +++ b/src/coreclr/vm/appdomain.hpp @@ -1171,6 +1171,30 @@ class BaseDomain }; friend class LockHolder; + // To be used when the thread will remain in preemptive GC mode while holding the lock + class DomainCacheCrstHolderForGCPreemp : private CrstHolder + { + public: + DomainCacheCrstHolderForGCPreemp(BaseDomain *pD) + : CrstHolder(&pD->m_DomainCacheCrst) + { + WRAPPER_NO_CONTRACT; + } + }; + + // To be used when the thread may enter cooperative GC mode while holding the lock. The thread enters a + // forbid-suspend-for-debugger region along with acquiring the lock, such that it would not suspend for the debugger while + // holding the lock, as that may otherwise cause a FuncEval to deadlock when trying to acquire the lock. + class DomainCacheCrstHolderForGCCoop : private CrstAndForbidSuspendForDebuggerHolder + { + public: + DomainCacheCrstHolderForGCCoop(BaseDomain *pD) + : CrstAndForbidSuspendForDebuggerHolder(&pD->m_DomainCacheCrst) + { + WRAPPER_NO_CONTRACT; + } + }; + class DomainLocalBlockLockHolder : public CrstHolder { public: diff --git a/src/coreclr/vm/callcounting.cpp b/src/coreclr/vm/callcounting.cpp index bdc4bc8a6d67fd..5a3561c284da88 100644 --- a/src/coreclr/vm/callcounting.cpp +++ b/src/coreclr/vm/callcounting.cpp @@ -715,14 +715,13 @@ extern "C" PCODE STDCALL OnCallCountThresholdReached(TransitionBlock *transition PCODE CallCountingManager::OnCallCountThresholdReached(TransitionBlock *transitionBlock, TADDR stubIdentifyingToken) { - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - PRECONDITION(CheckPointer(transitionBlock)); - } - CONTRACTL_END; + STATIC_CONTRACT_THROWS; + STATIC_CONTRACT_GC_TRIGGERS; + STATIC_CONTRACT_MODE_COOPERATIVE; + + PCODE codeEntryPoint; + + BEGIN_PRESERVE_LAST_ERROR; MAKE_CURRENT_THREAD_AVAILABLE(); @@ -740,8 +739,6 @@ PCODE CallCountingManager::OnCallCountThresholdReached(TransitionBlock *transiti CallCountingHelperFrame *frame = &frameWithCookie; frame->Push(CURRENT_THREAD); - PCODE codeEntryPoint; - INSTALL_MANAGED_EXCEPTION_DISPATCHER; INSTALL_UNWIND_AND_CONTINUE_HANDLER; @@ -786,6 +783,9 @@ PCODE CallCountingManager::OnCallCountThresholdReached(TransitionBlock *transiti UNINSTALL_MANAGED_EXCEPTION_DISPATCHER; frame->Pop(CURRENT_THREAD); + + END_PRESERVE_LAST_ERROR; + return codeEntryPoint; } diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index b8e7ab0b4d81da..9487b62ec9b0be 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -1350,6 +1350,10 @@ void Module::Destruct() m_file->Release(); } +#if defined(PROFILING_SUPPORTED) + delete m_pJitInlinerTrackingMap; +#endif + // If this module was loaded as domain-specific, then // we must free its ModuleIndex so that it can be reused FreeModuleIndex(); @@ -3425,26 +3429,17 @@ ISymUnmanagedReader *Module::GetISymUnmanagedReader(void) "reachable or needs to be reimplemented for CoreCLR!"); } - // We're going to be working with Windows PDB format symbols. Attempt to CoCreate the symbol binder. - // CoreCLR supports not having a symbol reader installed, so CoCreate searches the PATH env var - // and then tries coreclr dll location. - // On desktop, the framework installer is supposed to install diasymreader.dll as well - // and so this shouldn't happen. - hr = FakeCoCreateInstanceEx(CLSID_CorSymBinder_SxS, NATIVE_SYMBOL_READER_DLL, IID_ISymUnmanagedBinder, (void**)&pBinder, NULL); + PathString symbolReaderPath; + hr = GetClrModuleDirectory(symbolReaderPath); if (FAILED(hr)) { - PathString symbolReaderPath; - hr = GetClrModuleDirectory(symbolReaderPath); - if (FAILED(hr)) - { - RETURN (NULL); - } - symbolReaderPath.Append(NATIVE_SYMBOL_READER_DLL); - hr = FakeCoCreateInstanceEx(CLSID_CorSymBinder_SxS, symbolReaderPath.GetUnicode(), IID_ISymUnmanagedBinder, (void**)&pBinder, NULL); - if (FAILED(hr)) - { - RETURN (NULL); - } + RETURN (NULL); + } + symbolReaderPath.Append(NATIVE_SYMBOL_READER_DLL); + hr = FakeCoCreateInstanceEx(CLSID_CorSymBinder_SxS, symbolReaderPath.GetUnicode(), IID_ISymUnmanagedBinder, (void**)&pBinder, NULL); + if (FAILED(hr)) + { + RETURN (NULL); } LOG((LF_CORDB, LL_INFO10, "M::GISUR: Created binder\n")); @@ -9965,16 +9960,16 @@ void Module::RunEagerFixups() { // For composite images, multiple modules may request initializing eager fixups // from multiple threads so we need to lock their resolution. - if (compositeNativeImage->EagerFixupsHaveRun()) - { - return; - } CrstHolder compositeEagerFixups(compositeNativeImage->EagerFixupsLock()); if (compositeNativeImage->EagerFixupsHaveRun()) { + if (compositeNativeImage->ReadyToRunCodeDisabled()) + GetReadyToRunInfo()->DisableAllR2RCode(); return; } RunEagerFixupsUnlocked(); + if (GetReadyToRunInfo()->ReadyToRunCodeDisabled()) + compositeNativeImage->DisableAllR2RCode(); compositeNativeImage->SetEagerFixupsHaveRun(); } else @@ -12590,15 +12585,6 @@ void ReflectionModule::CaptureModuleMetaDataToMemory() } CONTRACTL_END; - // If a debugger is attached, then the CLR will still send ClassLoad notifications for dynamic modules, - // which mean we still need to keep the metadata available. This is the same as Whidbey. - // An alternative (and better) design would be to suppress ClassLoad notifications too, but then we'd - // need some way of sending a "catchup" notification to the debugger after we re-enable notifications. - if (!CORDebuggerAttached()) - { - return; - } - // Do not release the emitter. This is a weak reference. IMetaDataEmit *pEmitter = this->GetEmitter(); _ASSERTE(pEmitter != NULL); diff --git a/src/coreclr/vm/ceemain.cpp b/src/coreclr/vm/ceemain.cpp index 87106bbff4b41a..0d17a54fd09c9f 100644 --- a/src/coreclr/vm/ceemain.cpp +++ b/src/coreclr/vm/ceemain.cpp @@ -1878,35 +1878,42 @@ BOOL STDMETHODCALLTYPE EEDllMain( // TRUE on success, FALSE on error. struct TlsDestructionMonitor { - ~TlsDestructionMonitor() + bool m_activated = false; + + void Activate() { - // Don't destroy threads here if we're in shutdown (shutdown will - // clean up for us instead). + m_activated = true; + } - Thread* thread = GetThreadNULLOk(); - if (thread) + ~TlsDestructionMonitor() + { + if (m_activated) { + Thread* thread = GetThreadNULLOk(); + if (thread) + { #ifdef FEATURE_COMINTEROP - // reset the CoInitialize state - // so we don't call CoUninitialize during thread detach - thread->ResetCoInitialized(); + // reset the CoInitialize state + // so we don't call CoUninitialize during thread detach + thread->ResetCoInitialized(); #endif // FEATURE_COMINTEROP - // For case where thread calls ExitThread directly, we need to reset the - // frame pointer. Otherwise stackwalk would AV. We need to do it in cooperative mode. - // We need to set m_GCOnTransitionsOK so this thread won't trigger GC when toggle GC mode - if (thread->m_pFrame != FRAME_TOP) - { + // For case where thread calls ExitThread directly, we need to reset the + // frame pointer. Otherwise stackwalk would AV. We need to do it in cooperative mode. + // We need to set m_GCOnTransitionsOK so this thread won't trigger GC when toggle GC mode + if (thread->m_pFrame != FRAME_TOP) + { #ifdef _DEBUG - thread->m_GCOnTransitionsOK = FALSE; + thread->m_GCOnTransitionsOK = FALSE; #endif - GCX_COOP_NO_DTOR(); - thread->m_pFrame = FRAME_TOP; - GCX_COOP_NO_DTOR_END(); + GCX_COOP_NO_DTOR(); + thread->m_pFrame = FRAME_TOP; + GCX_COOP_NO_DTOR_END(); + } + thread->DetachThread(TRUE); } - thread->DetachThread(TRUE); - } - ThreadDetaching(); + ThreadDetaching(); + } } }; @@ -1914,6 +1921,11 @@ struct TlsDestructionMonitor // is called when a thread is being shut down. thread_local TlsDestructionMonitor tls_destructionMonitor; +void EnsureTlsDestructionMonitor() +{ + tls_destructionMonitor.Activate(); +} + #ifdef DEBUGGING_SUPPORTED // // InitializeDebugger initialized the Runtime-side COM+ Debugging Services @@ -1989,6 +2001,12 @@ static void InitializeDebugger(void) } } + static ConfigDWORD debuggerDisablesCodeVersioning; + if( (debuggerDisablesCodeVersioning.val(CLRConfig::EXTERNAL_DebuggerLaunchDisablesCodeVersioning) != 0) && CORDebuggerAttached()) + { + LOG((LF_CORDB, LL_INFO10, "Debugger is active at startup, disabling code versioning to prevent a potential deadlock.\n")); + g_pConfig->DisableDefaultCodeVersioning(); + } LOG((LF_CORDB, LL_INFO10, "Left-side debugging services setup.\n")); diff --git a/src/coreclr/vm/ceemain.h b/src/coreclr/vm/ceemain.h index 1f96cdea85f389..688f41c6deb1be 100644 --- a/src/coreclr/vm/ceemain.h +++ b/src/coreclr/vm/ceemain.h @@ -45,6 +45,8 @@ void ForceEEShutdown(ShutdownCompleteAction sca = SCA_ExitProcessWhenShutdownCom // Notification of a DLL_THREAD_DETACH or a Thread Terminate. void ThreadDetaching(); +void EnsureTlsDestructionMonitor(); + void SetLatchedExitCode (INT32 code); INT32 GetLatchedExitCode (void); diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index 78721292a3e9f5..153ca37d11b925 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -2412,6 +2412,11 @@ HeapList* EEJitManager::NewCodeHeap(CodeHeapRequestInfo *pInfo, DomainCodeHeapLi #endif size_t reserveSize = initialRequestSize; + +#if defined(TARGET_AMD64) || defined(TARGET_ARM64) + reserveSize += JUMP_ALLOCATE_SIZE; +#endif + if (reserveSize < minReserveSize) reserveSize = minReserveSize; reserveSize = ALIGN_UP(reserveSize, VIRTUAL_ALLOC_RESERVE_GRANULARITY); diff --git a/src/coreclr/vm/comthreadpool.cpp b/src/coreclr/vm/comthreadpool.cpp index 578f30e4f3d14d..8432da63611575 100644 --- a/src/coreclr/vm/comthreadpool.cpp +++ b/src/coreclr/vm/comthreadpool.cpp @@ -192,6 +192,34 @@ FCIMPL4(INT32, ThreadPoolNative::GetNextConfigUInt32Value, case 19: if (TryGetConfig(CLRConfig::INTERNAL_HillClimbing_SampleIntervalHigh, false, W("System.Threading.ThreadPool.HillClimbing.SampleIntervalHigh"))) { return 20; } FALLTHROUGH; case 20: if (TryGetConfig(CLRConfig::INTERNAL_HillClimbing_GainExponent, false, W("System.Threading.ThreadPool.HillClimbing.GainExponent"))) { return 21; } FALLTHROUGH; + case 21: + { + int threadPoolThreadTimeoutMs = g_pConfig->ThreadPoolThreadTimeoutMs(); + if (threadPoolThreadTimeoutMs >= -1) + { + *configValueRef = (UINT32)threadPoolThreadTimeoutMs; + *isBooleanRef = false; + *appContextConfigNameRef = W("System.Threading.ThreadPool.ThreadTimeoutMs"); + return 22; + } + + FALLTHROUGH; + } + + case 22: + { + int threadPoolThreadsToKeepAlive = g_pConfig->ThreadPoolThreadsToKeepAlive(); + if (threadPoolThreadsToKeepAlive >= -1) + { + *configValueRef = (UINT32)threadPoolThreadsToKeepAlive; + *isBooleanRef = false; + *appContextConfigNameRef = W("System.Threading.ThreadPool.ThreadsToKeepAlive"); + return 23; + } + + FALLTHROUGH; + } + default: *configValueRef = 0; *isBooleanRef = false; diff --git a/src/coreclr/vm/comutilnative.cpp b/src/coreclr/vm/comutilnative.cpp index fec65f96e5928f..6b5bdde020abf6 100644 --- a/src/coreclr/vm/comutilnative.cpp +++ b/src/coreclr/vm/comutilnative.cpp @@ -674,6 +674,16 @@ UINT64 GCInterface::m_remPressure[MEM_PRESSURE_COUNT] = {0, 0, 0, 0}; // his // (m_iteration % MEM_PRESSURE_COUNT) is used as an index into m_addPressure and m_remPressure UINT GCInterface::m_iteration = 0; +FCIMPL0(INT64, GCInterface::GetTotalPauseDuration) +{ + FCALL_CONTRACT; + + FC_GC_POLL_NOT_NEEDED(); + + return GCHeapUtilities::GetGCHeap()->GetTotalPauseDuration(); +} +FCIMPLEND + FCIMPL2(void, GCInterface::GetMemoryInfo, Object* objUNSAFE, int kind) { FCALL_CONTRACT; diff --git a/src/coreclr/vm/comutilnative.h b/src/coreclr/vm/comutilnative.h index f59bbe7f66c118..666ed6aefcfc25 100644 --- a/src/coreclr/vm/comutilnative.h +++ b/src/coreclr/vm/comutilnative.h @@ -143,6 +143,7 @@ class GCInterface { static FORCEINLINE UINT64 InterlockedAdd(UINT64 *pAugend, UINT64 addend); static FORCEINLINE UINT64 InterlockedSub(UINT64 *pMinuend, UINT64 subtrahend); + static FCDECL0(INT64, GetTotalPauseDuration); static FCDECL2(void, GetMemoryInfo, Object* objUNSAFE, int kind); static FCDECL0(UINT32, GetMemoryLoad); static FCDECL0(int, GetGcLatencyMode); diff --git a/src/coreclr/vm/corhost.cpp b/src/coreclr/vm/corhost.cpp index 689cf04c89a5ad..1000e87a90876c 100644 --- a/src/coreclr/vm/corhost.cpp +++ b/src/coreclr/vm/corhost.cpp @@ -347,6 +347,15 @@ HRESULT CorHost2::ExecuteAssembly(DWORD dwAppDomainId, _ASSERTE (!pThread->PreemptiveGCDisabled()); + if (g_EntryAssemblyPath == NULL) + { + // Store the entry assembly path for diagnostic purposes (for example, dumps) + size_t len = wcslen(pwzAssemblyPath) + 1; + NewArrayHolder path { new WCHAR[len] }; + wcscpy_s(path, len, pwzAssemblyPath); + g_EntryAssemblyPath = path.Extract(); + } + Assembly *pAssembly = AssemblySpec::LoadAssembly(pwzAssemblyPath); #if defined(FEATURE_MULTICOREJIT) diff --git a/src/coreclr/vm/crst.cpp b/src/coreclr/vm/crst.cpp index 63472e454e210b..d617647f27233b 100644 --- a/src/coreclr/vm/crst.cpp +++ b/src/coreclr/vm/crst.cpp @@ -789,8 +789,8 @@ CrstBase::CrstAndForbidSuspendForDebuggerHolder::CrstAndForbidSuspendForDebugger // Reentrant locks are currently not supported _ASSERTE((pCrst->m_dwFlags & CRST_REENTRANCY) == 0); - Thread *pThread = GetThread(); - if (pThread->IsInForbidSuspendForDebuggerRegion()) + Thread *pThread = GetThreadNULLOk(); + if (pThread == nullptr || pThread->IsInForbidSuspendForDebuggerRegion()) { AcquireLock(pCrst); return; diff --git a/src/coreclr/vm/debugdebugger.cpp b/src/coreclr/vm/debugdebugger.cpp index e21939990405c2..f08e5107b13812 100644 --- a/src/coreclr/vm/debugdebugger.cpp +++ b/src/coreclr/vm/debugdebugger.cpp @@ -776,6 +776,28 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal, } FCIMPLEND +MethodDesc* QCALLTYPE DebugStackTrace::GetMethodDescFromNativeIP(LPVOID ip) +{ + QCALL_CONTRACT; + + MethodDesc* pResult = nullptr; + + BEGIN_QCALL; + + // TODO: There is a race for dynamic and collectible methods here between getting + // the MethodDesc here and when the managed wrapper converts it into a MethodBase + // where the method could be collected. + EECodeInfo codeInfo((PCODE)ip); + if (codeInfo.IsValid()) + { + pResult = codeInfo.GetMethodDesc(); + } + + END_QCALL; + + return pResult; +} + FORCEINLINE void HolderDestroyStrongHandle(OBJECTHANDLE h) { if (h != NULL) DestroyStrongHandle(h); } typedef Wrapper, HolderDestroyStrongHandle, NULL> StrongHandleHolder; diff --git a/src/coreclr/vm/debugdebugger.h b/src/coreclr/vm/debugdebugger.h index cba432e3d8e5f2..2673f90717a695 100644 --- a/src/coreclr/vm/debugdebugger.h +++ b/src/coreclr/vm/debugdebugger.h @@ -158,6 +158,8 @@ class DebugStackTrace Object* pException ); + static MethodDesc* QCALLTYPE GetMethodDescFromNativeIP(LPVOID ip); + static void GetStackFramesFromException(OBJECTREF * e, GetStackFramesData *pData, PTRARRAYREF * pDynamicMethodArray = NULL); #ifndef DACCESS_COMPILE diff --git a/src/coreclr/vm/dynamicmethod.cpp b/src/coreclr/vm/dynamicmethod.cpp index 6b6c5ffacce4e7..6428256e81df76 100644 --- a/src/coreclr/vm/dynamicmethod.cpp +++ b/src/coreclr/vm/dynamicmethod.cpp @@ -398,6 +398,11 @@ HeapList* HostCodeHeap::InitializeHeapList(CodeHeapRequestInfo *pInfo) // Add TrackAllocation, HeapList and very conservative padding to make sure we have enough for the allocation ReserveBlockSize += sizeof(TrackAllocation) + HOST_CODEHEAP_SIZE_ALIGN + 0x100; + +#if defined(TARGET_AMD64) || defined(TARGET_ARM64) + ReserveBlockSize += JUMP_ALLOCATE_SIZE; +#endif + // reserve ReserveBlockSize rounded-up to VIRTUAL_ALLOC_RESERVE_GRANULARITY of memory ReserveBlockSize = ALIGN_UP(ReserveBlockSize, VIRTUAL_ALLOC_RESERVE_GRANULARITY); diff --git a/src/coreclr/vm/ecalllist.h b/src/coreclr/vm/ecalllist.h index c83248c00e2d0d..8317386a22f722 100644 --- a/src/coreclr/vm/ecalllist.h +++ b/src/coreclr/vm/ecalllist.h @@ -128,6 +128,7 @@ FCFuncEnd() FCFuncStart(gDiagnosticsStackTrace) FCFuncElement("GetStackFramesInternal", DebugStackTrace::GetStackFramesInternal) + QCFuncElement("GetMethodDescFromNativeIP", DebugStackTrace::GetMethodDescFromNativeIP) FCFuncEnd() FCFuncStart(gEnvironmentFuncs) @@ -705,6 +706,7 @@ FCFuncStart(gGCInterfaceFuncs) FCFuncElement("_WaitForFullGCComplete", GCInterface::WaitForFullGCComplete) FCFuncElement("_CollectionCount", GCInterface::CollectionCount) FCFuncElement("GetMemoryInfo", GCInterface::GetMemoryInfo) + FCFuncElement("_GetTotalPauseDuration", GCInterface::GetTotalPauseDuration) FCFuncElement("GetMemoryLoad", GCInterface::GetMemoryLoad) QCFuncElement("_StartNoGCRegion", GCInterface::StartNoGCRegion) QCFuncElement("_EndNoGCRegion", GCInterface::EndNoGCRegion) diff --git a/src/coreclr/vm/eeconfig.cpp b/src/coreclr/vm/eeconfig.cpp index dd180f3abe760e..f111cf08332633 100644 --- a/src/coreclr/vm/eeconfig.cpp +++ b/src/coreclr/vm/eeconfig.cpp @@ -237,6 +237,11 @@ HRESULT EEConfig::Init() bDiagnosticSuspend = false; #endif + threadPoolThreadTimeoutMs = -2; // not configured + threadPoolThreadsToKeepAlive = 0; + + fDisableDefaultCodeVersioning = false; + #if defined(FEATURE_TIERED_COMPILATION) fTieredCompilation = false; fTieredCompilation_QuickJit = false; @@ -736,6 +741,19 @@ HRESULT EEConfig::sync() #endif //_DEBUG + threadPoolThreadTimeoutMs = + (int)Configuration::GetKnobDWORDValue( + W("System.Threading.ThreadPool.ThreadTimeoutMs"), + CLRConfig::EXTERNAL_ThreadPool_ThreadTimeoutMs); + threadPoolThreadsToKeepAlive = + (int)Configuration::GetKnobDWORDValue( + W("System.Threading.ThreadPool.ThreadsToKeepAlive"), + CLRConfig::EXTERNAL_ThreadPool_ThreadsToKeepAlive); + if (threadPoolThreadsToKeepAlive < -1) + { + threadPoolThreadsToKeepAlive = 0; + } + m_fInteropValidatePinnedObjects = (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_InteropValidatePinnedObjects) != 0); m_fInteropLogArguments = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_InteropLogArguments) != 0); diff --git a/src/coreclr/vm/eeconfig.h b/src/coreclr/vm/eeconfig.h index bfb9ba16756120..2335752ff92d81 100644 --- a/src/coreclr/vm/eeconfig.h +++ b/src/coreclr/vm/eeconfig.h @@ -77,17 +77,20 @@ class EEConfig bool JitFramed(void) const {LIMITED_METHOD_CONTRACT; return fJitFramed; } bool JitMinOpts(void) const {LIMITED_METHOD_CONTRACT; return fJitMinOpts; } + void DisableDefaultCodeVersioning() { fDisableDefaultCodeVersioning = TRUE; } + bool DefaultCodeVersioningDisabled() const {LIMITED_METHOD_CONTRACT; return fDisableDefaultCodeVersioning; } + // Tiered Compilation config #if defined(FEATURE_TIERED_COMPILATION) - bool TieredCompilation(void) const { LIMITED_METHOD_CONTRACT; return fTieredCompilation; } - bool TieredCompilation_QuickJit() const { LIMITED_METHOD_CONTRACT; return fTieredCompilation_QuickJit; } - bool TieredCompilation_QuickJitForLoops() const { LIMITED_METHOD_CONTRACT; return fTieredCompilation_QuickJitForLoops; } - DWORD TieredCompilation_BackgroundWorkerTimeoutMs() const { LIMITED_METHOD_CONTRACT; return tieredCompilation_BackgroundWorkerTimeoutMs; } - bool TieredCompilation_CallCounting() const { LIMITED_METHOD_CONTRACT; return fTieredCompilation_CallCounting; } - UINT16 TieredCompilation_CallCountThreshold() const { LIMITED_METHOD_CONTRACT; return tieredCompilation_CallCountThreshold; } - DWORD TieredCompilation_CallCountingDelayMs() const { LIMITED_METHOD_CONTRACT; return tieredCompilation_CallCountingDelayMs; } - bool TieredCompilation_UseCallCountingStubs() const { LIMITED_METHOD_CONTRACT; return fTieredCompilation_UseCallCountingStubs; } - DWORD TieredCompilation_DeleteCallCountingStubsAfter() const { LIMITED_METHOD_CONTRACT; return tieredCompilation_DeleteCallCountingStubsAfter; } + bool TieredCompilation(void) const { LIMITED_METHOD_CONTRACT; return fTieredCompilation && !fDisableDefaultCodeVersioning; } + bool TieredCompilation_QuickJit() const { LIMITED_METHOD_CONTRACT; return fTieredCompilation_QuickJit && !fDisableDefaultCodeVersioning; } + bool TieredCompilation_QuickJitForLoops() const { LIMITED_METHOD_CONTRACT; return fTieredCompilation_QuickJitForLoops && !fDisableDefaultCodeVersioning; } + DWORD TieredCompilation_BackgroundWorkerTimeoutMs() const { LIMITED_METHOD_CONTRACT; return fDisableDefaultCodeVersioning ? 0 : tieredCompilation_BackgroundWorkerTimeoutMs; } + bool TieredCompilation_CallCounting() const { LIMITED_METHOD_CONTRACT; return fTieredCompilation_CallCounting && !fDisableDefaultCodeVersioning; } + UINT16 TieredCompilation_CallCountThreshold() const { LIMITED_METHOD_CONTRACT; return fDisableDefaultCodeVersioning ? 1 : tieredCompilation_CallCountThreshold; } + DWORD TieredCompilation_CallCountingDelayMs() const { LIMITED_METHOD_CONTRACT; return fDisableDefaultCodeVersioning ? 0 : tieredCompilation_CallCountingDelayMs; } + bool TieredCompilation_UseCallCountingStubs() const { LIMITED_METHOD_CONTRACT; return fTieredCompilation_UseCallCountingStubs && !fDisableDefaultCodeVersioning; } + DWORD TieredCompilation_DeleteCallCountingStubsAfter() const { LIMITED_METHOD_CONTRACT; return fDisableDefaultCodeVersioning ? 0 : tieredCompilation_DeleteCallCountingStubsAfter; } #endif #if defined(FEATURE_ON_STACK_REPLACEMENT) @@ -480,6 +483,9 @@ class EEConfig #endif + int ThreadPoolThreadTimeoutMs() const { LIMITED_METHOD_CONTRACT; return threadPoolThreadTimeoutMs; } + int ThreadPoolThreadsToKeepAlive() const { LIMITED_METHOD_CONTRACT; return threadPoolThreadsToKeepAlive; } + private: //---------------------------------------------------------------- bool fInited; // have we synced to the registry at least once? @@ -677,6 +683,11 @@ class EEConfig DWORD testThreadAbort; #endif + int threadPoolThreadTimeoutMs; + int threadPoolThreadsToKeepAlive; + + bool fDisableDefaultCodeVersioning; + #if defined(FEATURE_TIERED_COMPILATION) bool fTieredCompilation; bool fTieredCompilation_QuickJit; diff --git a/src/coreclr/vm/eepolicy.cpp b/src/coreclr/vm/eepolicy.cpp index b9084568144076..d9e81754ca2a61 100644 --- a/src/coreclr/vm/eepolicy.cpp +++ b/src/coreclr/vm/eepolicy.cpp @@ -361,6 +361,7 @@ void LogInfoForFatalError(UINT exitCode, LPCWSTR pszMessage, LPCWSTR errorSource } else if (pPreviousThread != nullptr) { + GCX_PREEMP(); // Avoid blocking other threads that may be trying to suspend the runtime while (s_pCrashingThread != FatalErrorLoggingFinished) { ClrSleepEx(50, /*bAlertable*/ FALSE); diff --git a/src/coreclr/vm/eeprofinterfaces.h b/src/coreclr/vm/eeprofinterfaces.h index ec51b014148b4b..9267fc356179a4 100644 --- a/src/coreclr/vm/eeprofinterfaces.h +++ b/src/coreclr/vm/eeprofinterfaces.h @@ -47,6 +47,8 @@ void __stdcall GarbageCollectionStartedCallback(int generation, BOOL induced); void __stdcall GarbageCollectionFinishedCallback(); void __stdcall UpdateGenerationBounds(); + +void __stdcall ProfilerAddNewRegion(int generation, uint8_t* rangeStart, uint8_t* rangeEnd, uint8_t* rangeEndReserved); #include "eetoprofinterfaceimpl.h" diff --git a/src/coreclr/vm/eetoprofinterfaceimpl.cpp b/src/coreclr/vm/eetoprofinterfaceimpl.cpp index 78a85b964e27a2..0f48e80e499605 100644 --- a/src/coreclr/vm/eetoprofinterfaceimpl.cpp +++ b/src/coreclr/vm/eetoprofinterfaceimpl.cpp @@ -102,8 +102,32 @@ enum ClrToProfEntrypointFlags kEE2PNoTrigger = 0x00000004, }; -#define ASSERT_EVAC_COUNTER_NONZERO() \ - _ASSERTE(m_pProfilerInfo->dwProfilerEvacuationCounter.Load() > 0) +EvacuationCounterHolder::EvacuationCounterHolder(ProfilerInfo *pProfilerInfo) : + m_pProfilerInfo(pProfilerInfo), + m_pThread(GetThreadNULLOk()) +{ + _ASSERTE(m_pProfilerInfo != NULL); + if (m_pThread == NULL) + { + return; + } + + m_pThread->IncProfilerEvacuationCounter(m_pProfilerInfo->slot); +} + +EvacuationCounterHolder::~EvacuationCounterHolder() +{ + if (m_pThread == NULL) + { + return; + } + + m_pThread->DecProfilerEvacuationCounter(m_pProfilerInfo->slot); +} + +#define ASSERT_EVAC_COUNTER_NONZERO() \ + _ASSERTE((GetThreadNULLOk() == NULL) || \ + (GetThread()->GetProfilerEvacuationCounter(m_pProfilerInfo->slot) > 0)) #define CHECK_PROFILER_STATUS(ee2pFlags) \ /* If one of these asserts fires, perhaps you forgot to use */ \ diff --git a/src/coreclr/vm/eetoprofinterfaceimpl.h b/src/coreclr/vm/eetoprofinterfaceimpl.h index 4ec468a4150c7d..5453723fb8e022 100644 --- a/src/coreclr/vm/eetoprofinterfaceimpl.h +++ b/src/coreclr/vm/eetoprofinterfaceimpl.h @@ -476,6 +476,10 @@ class EEToProfInterfaceImpl HRESULT LoadAsNotficationOnly(BOOL *pbNotificationOnly); + ProfToEEInterfaceImpl *GetProfToEE() + { + return m_pProfToEE; + } private: // diff --git a/src/coreclr/vm/eventing/eventpipe/CMakeLists.txt b/src/coreclr/vm/eventing/eventpipe/CMakeLists.txt index 3b03605aece06f..0936de2998e713 100644 --- a/src/coreclr/vm/eventing/eventpipe/CMakeLists.txt +++ b/src/coreclr/vm/eventing/eventpipe/CMakeLists.txt @@ -92,6 +92,7 @@ list(APPEND EVENTPIPE_SOURCES ${CORECLR_EVENTPIPE_SHIM_SOURCES} ${CORECLR_EVENTPIPE_SHIM_HEADERS} ${EVENTPIPE_HEADERS} + ${SHARED_EVENTPIPE_CONFIG_HEADERS} ) add_library_clr(eventpipe_gen_objs OBJECT ${GEN_EVENTPIPE_SOURCES}) diff --git a/src/coreclr/vm/eventing/eventpipe/ds-rt-coreclr.h b/src/coreclr/vm/eventing/eventpipe/ds-rt-coreclr.h index 646b8f9bd8f194..dd5e6837bb82e3 100644 --- a/src/coreclr/vm/eventing/eventpipe/ds-rt-coreclr.h +++ b/src/coreclr/vm/eventing/eventpipe/ds-rt-coreclr.h @@ -188,16 +188,22 @@ ds_rt_config_value_get_default_port_suspend (void) static ds_ipc_result_t -ds_rt_generate_core_dump (DiagnosticsGenerateCoreDumpCommandPayload *payload) +ds_rt_generate_core_dump (DiagnosticsDumpCommandId commandId, DiagnosticsGenerateCoreDumpCommandPayload *payload) { STATIC_CONTRACT_NOTHROW; ds_ipc_result_t result = DS_IPC_E_FAIL; EX_TRY { + uint32_t flags = ds_generate_core_dump_command_payload_get_flags(payload); + if (commandId == DS_DUMP_COMMANDID_GENERATE_CORE_DUMP) + { + // For the old commmand, this payload field is a bool of whether to enable logging + flags = flags != 0 ? GenerateDumpFlagsLoggingEnabled : 0; + } if (GenerateDump (reinterpret_cast(ds_generate_core_dump_command_payload_get_dump_name (payload)), static_cast(ds_generate_core_dump_command_payload_get_dump_type (payload)), - (ds_generate_core_dump_command_payload_get_diagnostics (payload) != 0) ? true : false)) + flags)) result = DS_IPC_S_OK; } EX_CATCH {} diff --git a/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.cpp b/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.cpp index 481cc505c43bce..3a15a5f56dafd4 100644 --- a/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.cpp +++ b/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.cpp @@ -12,7 +12,7 @@ CrstStatic _ep_rt_coreclr_config_lock; thread_local EventPipeCoreCLRThreadHolderTLS EventPipeCoreCLRThreadHolderTLS::g_threadHolderTLS; -ep_char8_t *_ep_rt_coreclr_diagnostics_cmd_line; +ep_char8_t *volatile _ep_rt_coreclr_diagnostics_cmd_line; #ifndef TARGET_UNIX uint32_t *_ep_rt_coreclr_proc_group_offsets; diff --git a/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h b/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h index 7ee83ae8c5f84e..d9053da9f177ee 100644 --- a/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h +++ b/src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h @@ -1107,50 +1107,6 @@ _rt_coreclr_hash_map_iterator_value (CONST_ITERATOR_TYPE *iterator) #define EP_RT_DEFINE_HASH_MAP_ITERATOR(hash_map_name, hash_map_type, iterator_type, key_type, value_type) \ EP_RT_DEFINE_HASH_MAP_ITERATOR_PREFIX(ep, hash_map_name, hash_map_type, iterator_type, key_type, value_type) -static -inline -char * -diagnostics_command_line_get (void) -{ - STATIC_CONTRACT_NOTHROW; - return ep_rt_utf16_to_utf8_string (reinterpret_cast(GetCommandLineForDiagnostics ()), -1); -} - -static -inline -ep_char8_t ** -diagnostics_command_line_get_ref (void) -{ - STATIC_CONTRACT_NOTHROW; - - extern ep_char8_t *_ep_rt_coreclr_diagnostics_cmd_line; - return &_ep_rt_coreclr_diagnostics_cmd_line; -} - -static -inline -void -diagnostics_command_line_lazy_init (void) -{ - STATIC_CONTRACT_NOTHROW; - - //TODO: Real lazy init implementation. - if (!*diagnostics_command_line_get_ref ()) - *diagnostics_command_line_get_ref () = diagnostics_command_line_get (); -} - -static -inline -void -diagnostics_command_line_lazy_clean (void) -{ - STATIC_CONTRACT_NOTHROW; - - //TODO: Real lazy clean up implementation. - ep_rt_utf8_string_free (*diagnostics_command_line_get_ref ()); - *diagnostics_command_line_get_ref () = NULL; -} - static inline ep_rt_lock_handle_t * @@ -1263,6 +1219,15 @@ ep_rt_atomic_compare_exchange_size_t (volatile size_t *target, size_t expected, return static_cast(InterlockedCompareExchangeT (target, value, expected)); } +static +inline +ep_char8_t * +ep_rt_atomic_compare_exchange_utf8_string (ep_char8_t *volatile *target, ep_char8_t *expected, ep_char8_t *value) +{ + STATIC_CONTRACT_NOTHROW; + return static_cast(InterlockedCompareExchangeT (target, value, expected)); +} + /* * EventPipe. */ @@ -1316,7 +1281,6 @@ void ep_rt_shutdown (void) { STATIC_CONTRACT_NOTHROW; - diagnostics_command_line_lazy_clean (); } static @@ -2711,8 +2675,32 @@ ep_rt_diagnostics_command_line_get (void) { STATIC_CONTRACT_NOTHROW; - diagnostics_command_line_lazy_init (); - return *diagnostics_command_line_get_ref (); + // In coreclr, this value can change over time, specifically before vs after suspension in diagnostics server. + // The host initializes the runtime in two phases, init and exec assembly. On non-Windows platforms the commandline returned by the runtime + // is different during each phase. We suspend during init where the runtime has populated the commandline with a + // mock value (the full path of the executing assembly) and the actual value isn't populated till the exec assembly phase. + // On Windows this does not apply as the value is retrieved directly from the OS any time it is requested. + // As a result, we cannot actually cache this value. We need to return the _current_ value. + // This function needs to handle freeing the string in order to make it consistent with Mono's version. + // There is a rare chance this may be called on multiple threads, so we attempt to always return the newest value + // and conservatively leak the old value if it changed. This is extremely rare and should only leak 1 string. + extern ep_char8_t *volatile _ep_rt_coreclr_diagnostics_cmd_line; + + ep_char8_t *old_cmd_line = _ep_rt_coreclr_diagnostics_cmd_line; + ep_char8_t *new_cmd_line = ep_rt_utf16_to_utf8_string (reinterpret_cast(GetCommandLineForDiagnostics ()), -1); + if (old_cmd_line && ep_rt_utf8_string_compare (old_cmd_line, new_cmd_line) == 0) { + // same as old, so free the new one + ep_rt_utf8_string_free (new_cmd_line); + } else { + // attempt an update, and give up if you lose the race + if (ep_rt_atomic_compare_exchange_utf8_string (&_ep_rt_coreclr_diagnostics_cmd_line, old_cmd_line, new_cmd_line) != old_cmd_line) { + ep_rt_utf8_string_free (new_cmd_line); + } + // NOTE: If there was a value we purposefully leak it since it may still be in use. + // This leak is *small* (length of the command line) and bounded (should only happen once) + } + + return _ep_rt_coreclr_diagnostics_cmd_line; } /* diff --git a/src/coreclr/vm/eventpipeinternal.cpp b/src/coreclr/vm/eventpipeinternal.cpp index 7097cb6208d34b..c9ac0b6ad5183e 100644 --- a/src/coreclr/vm/eventpipeinternal.cpp +++ b/src/coreclr/vm/eventpipeinternal.cpp @@ -60,7 +60,7 @@ void QCALLTYPE EventPipeInternal::Disable(UINT64 sessionID) END_QCALL; } -bool QCALLTYPE EventPipeInternal::GetSessionInfo(UINT64 sessionID, EventPipeSessionInfo *pSessionInfo) +BOOL QCALLTYPE EventPipeInternal::GetSessionInfo(UINT64 sessionID, EventPipeSessionInfo *pSessionInfo) { QCALL_CONTRACT; @@ -229,7 +229,7 @@ void QCALLTYPE EventPipeInternal::WriteEventData( END_QCALL; } -bool QCALLTYPE EventPipeInternal::GetNextEvent(UINT64 sessionID, EventPipeEventInstanceData *pInstance) +BOOL QCALLTYPE EventPipeInternal::GetNextEvent(UINT64 sessionID, EventPipeEventInstanceData *pInstance) { QCALL_CONTRACT; diff --git a/src/coreclr/vm/eventpipeinternal.h b/src/coreclr/vm/eventpipeinternal.h index acb52754a15e5e..d3ff21b158d331 100644 --- a/src/coreclr/vm/eventpipeinternal.h +++ b/src/coreclr/vm/eventpipeinternal.h @@ -55,7 +55,7 @@ class EventPipeInternal //! static void QCALLTYPE Disable(UINT64 sessionID); - static bool QCALLTYPE GetSessionInfo(UINT64 sessionID, EventPipeSessionInfo *pSessionInfo); + static BOOL QCALLTYPE GetSessionInfo(UINT64 sessionID, EventPipeSessionInfo *pSessionInfo); static INT_PTR QCALLTYPE CreateProvider( __in_z LPCWSTR providerName, @@ -86,7 +86,7 @@ class EventPipeInternal UINT32 eventDataCount, LPCGUID pActivityId, LPCGUID pRelatedActivityId); - static bool QCALLTYPE GetNextEvent( + static BOOL QCALLTYPE GetNextEvent( UINT64 sessionID, EventPipeEventInstanceData *pInstance); diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp index 74a1f9f6be7822..1674aa2adc43b9 100644 --- a/src/coreclr/vm/excep.cpp +++ b/src/coreclr/vm/excep.cpp @@ -4178,8 +4178,8 @@ InitializeCrashDump() bool GenerateDump( LPCWSTR dumpName, - int dumpType, - bool diag) + INT dumpType, + ULONG32 flags) { #ifdef TARGET_UNIX MAKE_UTF8PTR_FROMWIDE_NOTHROW (dumpNameUtf8, dumpName); @@ -4189,10 +4189,10 @@ bool GenerateDump( } else { - return PAL_GenerateCoreDump(dumpNameUtf8, dumpType, diag); + return PAL_GenerateCoreDump(dumpNameUtf8, dumpType, flags); } #else // TARGET_UNIX - return GenerateCrashDump(dumpName, dumpType, diag); + return GenerateCrashDump(dumpName, dumpType, flags & GenerateDumpFlagsLoggingEnabled); #endif // TARGET_UNIX } @@ -9096,6 +9096,7 @@ void SetupWatsonBucketsForUEF(BOOL fUseLastThrownObject) struct { OBJECTREF oThrowable; + U1ARRAYREF oBuckets; } gc; ZeroMemory(&gc, sizeof(gc)); GCPROTECT_BEGIN(gc); @@ -9197,9 +9198,10 @@ void SetupWatsonBucketsForUEF(BOOL fUseLastThrownObject) SetupWatsonBucketsForNonPreallocatedExceptions(gc.oThrowable); } - if (((EXCEPTIONREF)gc.oThrowable)->AreWatsonBucketsPresent()) + gc.oBuckets = ((EXCEPTIONREF)gc.oThrowable)->GetWatsonBucketReference(); + if (gc.oBuckets != NULL) { - pUEWatsonBucketTracker->CopyBucketsFromThrowable(gc.oThrowable); + pUEWatsonBucketTracker->CopyBuckets(gc.oBuckets); } if (pUEWatsonBucketTracker->RetrieveWatsonBuckets() == NULL) @@ -9519,6 +9521,7 @@ BOOL SetupWatsonBucketsForFailFast(EXCEPTIONREF refException) { OBJECTREF refException; OBJECTREF oInnerMostExceptionThrowable; + U1ARRAYREF oBuckets; } gc; ZeroMemory(&gc, sizeof(gc)); GCPROTECT_BEGIN(gc); @@ -9669,10 +9672,11 @@ BOOL SetupWatsonBucketsForFailFast(EXCEPTIONREF refException) } // If it has the buckets, copy them over to the current Watson bucket tracker - if (((EXCEPTIONREF)gc.oInnerMostExceptionThrowable)->AreWatsonBucketsPresent()) + gc.oBuckets = ((EXCEPTIONREF)gc.oInnerMostExceptionThrowable)->GetWatsonBucketReference(); + if (gc.oBuckets != NULL) { pUEWatsonBucketTracker->ClearWatsonBucketDetails(); - pUEWatsonBucketTracker->CopyBucketsFromThrowable(gc.oInnerMostExceptionThrowable); + pUEWatsonBucketTracker->CopyBuckets(gc.oBuckets); if (pUEWatsonBucketTracker->RetrieveWatsonBuckets() != NULL) { LOG((LF_EH, LL_INFO1000, "SetupWatsonBucketsForFailFast - Got watson buckets from regular innermost exception.\n")); @@ -9711,11 +9715,12 @@ BOOL SetupWatsonBucketsForFailFast(EXCEPTIONREF refException) SetupWatsonBucketsForNonPreallocatedExceptions(gc.refException); } - if (((EXCEPTIONREF)gc.refException)->AreWatsonBucketsPresent()) + gc.oBuckets = ((EXCEPTIONREF)gc.refException)->GetWatsonBucketReference(); + if (gc.oBuckets != NULL) { // Copy the buckets to the current watson bucket tracker pUEWatsonBucketTracker->ClearWatsonBucketDetails(); - pUEWatsonBucketTracker->CopyBucketsFromThrowable(gc.refException); + pUEWatsonBucketTracker->CopyBuckets(gc.oBuckets); if (pUEWatsonBucketTracker->RetrieveWatsonBuckets() != NULL) { LOG((LF_EH, LL_INFO1000, "SetupWatsonBucketsForFailFast - Watson buckets copied from the exception object.\n")); @@ -9950,6 +9955,9 @@ void SetupInitialThrowBucketDetails(UINT_PTR adjustedIp) EX_TRY { CopyWatsonBucketsToThrowable(pUEWatsonBucketTracker->RetrieveWatsonBuckets()); + + // Technically this assert can fail, as another thread could clear the buckets after + // CopyWatsonBucketsToThrowable but before the assert runs, but it is very unlikely. _ASSERTE(((EXCEPTIONREF)gc.oCurrentThrowable)->AreWatsonBucketsPresent()); } EX_CATCH @@ -10686,7 +10694,7 @@ void EHWatsonBucketTracker::Init() // This method copies the bucketing details from the specified throwable // to the current Watson Bucket tracker. -void EHWatsonBucketTracker::CopyBucketsFromThrowable(OBJECTREF oThrowable) +void EHWatsonBucketTracker::CopyBuckets(U1ARRAYREF oBuckets) { #ifndef DACCESS_COMPILE CONTRACTL @@ -10694,8 +10702,7 @@ void EHWatsonBucketTracker::CopyBucketsFromThrowable(OBJECTREF oThrowable) NOTHROW; GC_NOTRIGGER; MODE_ANY; - PRECONDITION(oThrowable != NULL); - PRECONDITION(((EXCEPTIONREF)oThrowable)->AreWatsonBucketsPresent()); + PRECONDITION(oBuckets != NULL); PRECONDITION(IsWatsonEnabled()); } CONTRACTL_END; @@ -10704,16 +10711,16 @@ void EHWatsonBucketTracker::CopyBucketsFromThrowable(OBJECTREF oThrowable) struct { - OBJECTREF oFrom; + U1ARRAYREF oFromBuckets; } _gc; ZeroMemory(&_gc, sizeof(_gc)); GCPROTECT_BEGIN(_gc); - _gc.oFrom = oThrowable; + _gc.oFromBuckets = oBuckets; - LOG((LF_EH, LL_INFO1000, "EHWatsonBucketTracker::CopyEHWatsonBucketTracker - Copying bucketing details from throwable (%p) to tracker (%p)\n", - OBJECTREFToObject(_gc.oFrom), this)); + LOG((LF_EH, LL_INFO1000, "EHWatsonBucketTracker::CopyEHWatsonBucketTracker - Copying bucketing details from bucket (%p) to tracker (%p)\n", + OBJECTREFToObject(_gc.oFromBuckets), this)); // Watson bucket is a "GenericModeBlock" type. Set up an empty GenericModeBlock // to hold the bucket parameters. @@ -10728,8 +10735,7 @@ void EHWatsonBucketTracker::CopyBucketsFromThrowable(OBJECTREF oThrowable) else { // Get the raw array data pointer - U1ARRAYREF refWatsonBucketArray = ((EXCEPTIONREF)_gc.oFrom)->GetWatsonBucketReference(); - PTR_VOID pRawWatsonBucketArray = dac_cast(refWatsonBucketArray->GetDataPtr()); + PTR_VOID pRawWatsonBucketArray = dac_cast(_gc.oFromBuckets->GetDataPtr()); // Copy over the details to our new allocation memcpyNoGCRefs(pgmb, pRawWatsonBucketArray, sizeof(GenericModeBlock)); @@ -11527,8 +11533,9 @@ VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(__in_z const ch msgStr += W(")"); } #endif - ThrowHR(COR_E_BADIMAGEFORMAT, msgStr); +#else // DACCESS_COMPILE + ThrowHR(COR_E_BADIMAGEFORMAT); #endif // #ifndef DACCESS_COMPILE } diff --git a/src/coreclr/vm/excep.h b/src/coreclr/vm/excep.h index f338dd76f4cb37..f95a8b6784ea97 100644 --- a/src/coreclr/vm/excep.h +++ b/src/coreclr/vm/excep.h @@ -195,10 +195,20 @@ enum UnhandledExceptionLocation }; #ifdef HOST_WINDOWS + +// Must be the same as the copy in pal.h and the WriteDumpFlags enum in the diagnostics repo +enum +{ + GenerateDumpFlagsNone = 0x00, + GenerateDumpFlagsLoggingEnabled = 0x01, + GenerateDumpFlagsVerboseLoggingEnabled = 0x02, + GenerateDumpFlagsCrashReportEnabled = 0x04 +}; + void InitializeCrashDump(); void CreateCrashDumpIfEnabled(bool stackoverflow = false); #endif -bool GenerateDump(LPCWSTR dumpName, int dumpType, bool diag); +bool GenerateDump(LPCWSTR dumpName, INT dumpType, ULONG32 flags); // Generates crash dumps if enabled for both Windows and Linux void CrashDumpAndTerminateProcess(UINT exitCode); diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index 4af702fab14996..5905a5311d1604 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -213,8 +213,7 @@ void HandleTerminationRequest(int terminationExitCode) { SetLatchedExitCode(terminationExitCode); - DWORD enabled = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_EnableDumpOnSigTerm); - ForceEEShutdown(enabled == 1 ? SCA_TerminateProcessWhenShutdownComplete : SCA_ExitProcessWhenShutdownComplete); + ForceEEShutdown(SCA_ExitProcessWhenShutdownComplete); } } #endif @@ -4519,6 +4518,8 @@ VOID UnwindManagedExceptionPass2(PAL_SEHException& ex, CONTEXT* unwindStartConte EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); } +extern void* g_hostingApiReturnAddress; + //--------------------------------------------------------------------------------------- // // This functions performs dispatching of a managed exception. @@ -4714,7 +4715,8 @@ VOID DECLSPEC_NORETURN UnwindManagedExceptionPass1(PAL_SEHException& ex, CONTEXT STRESS_LOG2(LF_EH, LL_INFO100, "Processing exception at native frame: IP = %p, SP = %p \n", controlPc, sp); - if (controlPc == 0) + // Consider the exception unhandled if the unwinding cannot proceed further or if it went past the coreclr_initialize or coreclr_execute_assembly + if ((controlPc == 0) || (controlPc == (UINT_PTR)g_hostingApiReturnAddress)) { if (!GetThread()->HasThreadStateNC(Thread::TSNC_ProcessedUnhandledException)) { diff --git a/src/coreclr/vm/exceptmacros.h b/src/coreclr/vm/exceptmacros.h index 7e3a058f7b2b6b..3fefb7936069a4 100644 --- a/src/coreclr/vm/exceptmacros.h +++ b/src/coreclr/vm/exceptmacros.h @@ -515,8 +515,12 @@ template NOINLINE VOID ThrowBadFormatWorkerT(UINT resID, T * pImgObj DEBUGARG(__in_z const char *cond)) { +#ifdef DACCESS_COMPILE + ThrowBadFormatWorker(resID, nullptr DEBUGARG(cond)); +#else LPCWSTR tmpStr = GetPathForErrorMessagesT(pImgObj); ThrowBadFormatWorker(resID, tmpStr DEBUGARG(cond)); +#endif } diff --git a/src/coreclr/vm/exstatecommon.h b/src/coreclr/vm/exstatecommon.h index ba8086a5402fe1..b2abb9d9f3c1d3 100644 --- a/src/coreclr/vm/exstatecommon.h +++ b/src/coreclr/vm/exstatecommon.h @@ -483,7 +483,7 @@ class EHWatsonBucketTracker EHWatsonBucketTracker(); void Init(); void CopyEHWatsonBucketTracker(const EHWatsonBucketTracker& srcTracker); - void CopyBucketsFromThrowable(OBJECTREF oThrowable); + void CopyBuckets(U1ARRAYREF oBuckets); void SaveIpForWatsonBucket(UINT_PTR ip); UINT_PTR RetrieveWatsonBucketIp(); PTR_VOID RetrieveWatsonBuckets(); diff --git a/src/coreclr/vm/gcenv.ee.cpp b/src/coreclr/vm/gcenv.ee.cpp index f963146ffb6163..e03bd67d8ba0d1 100644 --- a/src/coreclr/vm/gcenv.ee.cpp +++ b/src/coreclr/vm/gcenv.ee.cpp @@ -1656,7 +1656,7 @@ void GCToEEInterface::AnalyzeSurvivorsFinished(size_t gcIndex, int condemnedGene { EX_TRY { - GenerateDump (GENAWARE_DUMP_FILE_NAME, 2, false); + GenerateDump (GENAWARE_DUMP_FILE_NAME, 2, GenerateDumpFlagsNone); } EX_CATCH {} EX_END_CATCH(SwallowAllExceptions); @@ -1732,3 +1732,8 @@ uint32_t GCToEEInterface::GetCurrentProcessCpuCount() { return ::GetCurrentProcessCpuCount(); } + +void GCToEEInterface::DiagAddNewRegion(int generation, uint8_t* rangeStart, uint8_t* rangeEnd, uint8_t* rangeEndReserved) +{ + ProfilerAddNewRegion(generation, rangeStart, rangeEnd, rangeEndReserved); +} diff --git a/src/coreclr/vm/gcenv.ee.h b/src/coreclr/vm/gcenv.ee.h index 6ac79248a6d2c9..6403f2637b817f 100644 --- a/src/coreclr/vm/gcenv.ee.h +++ b/src/coreclr/vm/gcenv.ee.h @@ -85,6 +85,8 @@ class GCToEEInterface : public IGCToCLR { void LogStressMsg(unsigned level, unsigned facility, const StressLogMsg& msg); uint32_t GetCurrentProcessCpuCount(); + + void DiagAddNewRegion(int generation, BYTE * rangeStart, BYTE * rangeEnd, BYTE * rangeEndReserved); }; } // namespace standalone diff --git a/src/coreclr/vm/ilmarshalers.h b/src/coreclr/vm/ilmarshalers.h index ba07cd5b55c175..1eb3079f9c2f3f 100644 --- a/src/coreclr/vm/ilmarshalers.h +++ b/src/coreclr/vm/ilmarshalers.h @@ -988,11 +988,19 @@ class ILMarshaler m_nativeHome.InitHome(ILStubMarshalHome::HomeType_ILByrefLocal, pcsSetup->NewLocal(nativeFieldTypeByRef), &nativeType, /* unalignedIndirectStore */ true); + // During the cleanup pass, the managed typed is explicitly passed as null - see DestroyStructure(). This works + // except if the type has nested non-blittable fields. Not checking for null will compute invalid offsets that + // can cause an access violation during the field clean-up. + ILCodeLabel *pSkipComputeOffsetLabel = pcsSetup->NewCodeLabel(); + pcsSetup->EmitNOP("// field setup {"); pcsSetup->EmitNOP("// managed field setup {"); pcsSetup->EmitLDARG(StructMarshalStubs::MANAGED_STRUCT_ARGIDX); + pcsSetup->EmitDUP(); + pcsSetup->EmitBRFALSE(pSkipComputeOffsetLabel); pcsSetup->EmitLDC(managedOffset); pcsSetup->EmitADD(); + pcsSetup->EmitLabel(pSkipComputeOffsetLabel); EmitStoreManagedHomeAddr(pcsSetup); pcsSetup->EmitNOP("// } managed field setup"); pcsSetup->EmitNOP("// native field setup {"); @@ -3126,39 +3134,13 @@ class ILMngdMarshaler : public ILMarshaler void EmitClearNative(ILCodeStream* pslILEmit) override { WRAPPER_NO_CONTRACT; - ILCodeLabel* pNoManagedValueLabel = nullptr; - if (IsFieldMarshal(m_dwMarshalFlags)) - { - pNoManagedValueLabel = pslILEmit->NewCodeLabel(); - pslILEmit->EmitLDARG(StructMarshalStubs::MANAGED_STRUCT_ARGIDX); - pslILEmit->EmitBRFALSE(pNoManagedValueLabel); - } - EmitCallMngdMarshalerMethod(pslILEmit, GetClearNativeMethod()); - - if (IsFieldMarshal(m_dwMarshalFlags)) - { - pslILEmit->EmitLabel(pNoManagedValueLabel); - } } void EmitClearNativeContents(ILCodeStream* pslILEmit) override { WRAPPER_NO_CONTRACT; - ILCodeLabel* pNoManagedValueLabel = nullptr; - if (IsFieldMarshal(m_dwMarshalFlags)) - { - pNoManagedValueLabel = pslILEmit->NewCodeLabel(); - pslILEmit->EmitLDARG(StructMarshalStubs::MANAGED_STRUCT_ARGIDX); - pslILEmit->EmitBRFALSE(pNoManagedValueLabel); - } - EmitCallMngdMarshalerMethod(pslILEmit, GetClearNativeContentsMethod()); - - if (IsFieldMarshal(m_dwMarshalFlags)) - { - pslILEmit->EmitLabel(pNoManagedValueLabel); - } } bool NeedsClearCLR() override diff --git a/src/coreclr/vm/interoplibinterface.h b/src/coreclr/vm/interoplibinterface.h index 367b419e2a3342..be99852b4e68d2 100644 --- a/src/coreclr/vm/interoplibinterface.h +++ b/src/coreclr/vm/interoplibinterface.h @@ -57,7 +57,7 @@ class ComWrappersNative static void MarkWrapperAsComActivated(_In_ IUnknown* wrapperMaybe); public: // Unwrapping support - static IUnknown* GetIdentityForObject(_In_ OBJECTREF* objectPROTECTED, _In_ REFIID riid, _Out_ INT64* wrapperId); + static IUnknown* GetIdentityForObject(_In_ OBJECTREF* objectPROTECTED, _In_ REFIID riid, _Out_ INT64* wrapperId, _Out_ bool* isAggregated); static bool HasManagedObjectComWrapper(_In_ OBJECTREF object, _Out_ bool* isActive); public: // GC interaction diff --git a/src/coreclr/vm/interoplibinterface_comwrappers.cpp b/src/coreclr/vm/interoplibinterface_comwrappers.cpp index 030cabfc3e92ea..fceb5ab419ed44 100644 --- a/src/coreclr/vm/interoplibinterface_comwrappers.cpp +++ b/src/coreclr/vm/interoplibinterface_comwrappers.cpp @@ -53,6 +53,9 @@ namespace // The EOC is "detached" and no longer used to map between identity and a managed object. // This will only be set if the EOC was inserted into the cache. Flags_Detached = 8, + + // This EOC is an aggregated instance + Flags_Aggregated = 16 }; DWORD Flags; @@ -176,7 +179,10 @@ namespace if (Result.Context != NULL) { GCX_PREEMP(); - InteropLib::Com::DestroyWrapperForExternal(Result.Context); + // We also request collection notification since this holder is presently + // only used for new activation of wrappers therefore the notification won't occur + // at the typical time of before finalization. + InteropLib::Com::DestroyWrapperForExternal(Result.Context, /* notifyIsBeingCollected */ true); } } InteropLib::Com::ExternalWrapperResult* operator&() @@ -309,52 +315,100 @@ namespace GC_TRIGGERS; MODE_COOPERATIVE; PRECONDITION(!IsLockHeld()); + PRECONDITION(!(withFlags & ExternalObjectContext::Flags_Collected)); + PRECONDITION(!(withFlags & ExternalObjectContext::Flags_Detached)); POSTCONDITION(RETVAL != NULL); } CONTRACT_END; struct { + PTRARRAYREF arrRefTmp; PTRARRAYREF arrRef; } gc; ::ZeroMemory(&gc, sizeof(gc)); GCPROTECT_BEGIN(gc); + // Only add objects that are in the correct thread + // context, haven't been detached from the cache, and have + // the appropriate flags set. + // Define a macro predicate since it used in multiple places. + // If an instance is in the hashmap, it is active. This invariant + // holds because the GC is what marks and removes from the cache. +#define SELECT_OBJECT(XX) XX->ThreadContext == threadContext \ + && !XX->IsSet(ExternalObjectContext::Flags_Detached) \ + && (withFlags == ExternalObjectContext::Flags_None || XX->IsSet(withFlags)) + + // Determine the count of objects to return. + SIZE_T objCountMax = 0; + { + LockHolder lock(this); + Iterator end = _hashMap.End(); + for (Iterator curr = _hashMap.Begin(); curr != end; ++curr) + { + ExternalObjectContext* inst = *curr; + if (SELECT_OBJECT(inst)) + { + objCountMax++; + } + } + } + + // Allocate enumerable type to return. + gc.arrRef = (PTRARRAYREF)AllocateObjectArray((DWORD)objCountMax, g_pObjectClass); + CQuickArrayList localList; - // Determine objects to return + // Iterate over the hashmap again while populating the above array + // using the same predicate as before and holding onto context instances. + SIZE_T objCount = 0; + if (0 < objCountMax) { LockHolder lock(this); Iterator end = _hashMap.End(); for (Iterator curr = _hashMap.Begin(); curr != end; ++curr) { ExternalObjectContext* inst = *curr; - - // Only add objects that are in the correct thread - // context and have the appropriate flags set. - if (inst->ThreadContext == threadContext - && (withFlags == ExternalObjectContext::Flags_None || inst->IsSet(withFlags))) + if (SELECT_OBJECT(inst)) { localList.Push(inst); - STRESS_LOG1(LF_INTEROP, LL_INFO100, "Add EOC to Enumerable: 0x%p\n", inst); + + gc.arrRef->SetAt(objCount, inst->GetObjectRef()); + objCount++; + + STRESS_LOG1(LF_INTEROP, LL_INFO1000, "Add EOC to Enumerable: 0x%p\n", inst); } + + // There is a chance more objects were added to the hash while the + // lock was released during array allocation. Once we hit the computed max + // we stop to avoid looking longer than needed. + if (objCount == objCountMax) + break; } } - // Allocate enumerable type to return. - gc.arrRef = (PTRARRAYREF)AllocateObjectArray((DWORD)localList.Size(), g_pObjectClass); - - // Insert objects into enumerable. - // The ExternalObjectContexts in the hashmap are only - // removed and associated objects collected during a GC. Since - // this code is running in Cooperative mode they will never - // be null. - for (SIZE_T i = 0; i < localList.Size(); i++) +#undef SELECT_OBJECT + + // During the allocation of the array to return, a GC could have + // occurred and objects detached from this cache. In order to avoid + // having null array elements we will allocate a new array. + // This subsequent allocation is okay because the array we are + // replacing extends all object lifetimes. + if (objCount < objCountMax) { - ExternalObjectContext* inst = localList[i]; - gc.arrRef->SetAt(i, inst->GetObjectRef()); + gc.arrRefTmp = (PTRARRAYREF)AllocateObjectArray((DWORD)objCount, g_pObjectClass); + + void* dest = gc.arrRefTmp->GetDataPtr(); + void* src = gc.arrRef->GetDataPtr(); + SIZE_T elementSize = gc.arrRef->GetComponentSize(); + + memmoveGCRefs(dest, src, objCount * elementSize); + gc.arrRef = gc.arrRefTmp; } + // All objects are now referenced from the array so won't be collected + // at this point. This means we can safely iterate over the ExternalObjectContext + // instances. { // Separate the wrapper from the tracker runtime prior to // passing them onto the caller. This call is okay to make @@ -478,7 +532,11 @@ namespace if (!cxt->IsSet(ExternalObjectContext::Flags_Detached) && !GCHeapUtilities::GetGCHeap()->IsPromoted(OBJECTREFToObject(cxt->GetObjectRef()))) { + // Indicate the wrapper entry has been detached. cxt->MarkDetached(); + + // Notify the wrapper it was not promoted and is being collected. + InteropLib::Com::NotifyWrapperForExternalIsBeingCollected(cxt); } } } @@ -845,7 +903,11 @@ namespace : ExternalObjectContext::Flags_None) | (uniqueInstance ? ExternalObjectContext::Flags_None - : ExternalObjectContext::Flags_InCache); + : ExternalObjectContext::Flags_InCache) | + ((flags & CreateObjectFlags::CreateObjectFlags_Aggregated) != 0 + ? ExternalObjectContext::Flags_Aggregated + : ExternalObjectContext::Flags_None); + ExternalObjectContext::Construct( resultHolder.GetContext(), identity, @@ -1719,7 +1781,7 @@ bool GlobalComWrappersForTrackerSupport::TryGetOrCreateObjectForComInstance( objRef); } -IUnknown* ComWrappersNative::GetIdentityForObject(_In_ OBJECTREF* objectPROTECTED, _In_ REFIID riid, _Out_ INT64* wrapperId) +IUnknown* ComWrappersNative::GetIdentityForObject(_In_ OBJECTREF* objectPROTECTED, _In_ REFIID riid, _Out_ INT64* wrapperId, _Out_ bool* isAggregated) { CONTRACTL { @@ -1752,6 +1814,7 @@ IUnknown* ComWrappersNative::GetIdentityForObject(_In_ OBJECTREF* objectPROTECTE { ExternalObjectContext* context = reinterpret_cast(contextMaybe); *wrapperId = context->WrapperId; + *isAggregated = context->IsSet(ExternalObjectContext::Flags_Aggregated); IUnknown* identity = reinterpret_cast(context->Identity); GCX_PREEMP(); diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp index ea70bf8e0ac242..5f41caa0c3e85d 100644 --- a/src/coreclr/vm/jithelpers.cpp +++ b/src/coreclr/vm/jithelpers.cpp @@ -5572,7 +5572,7 @@ HCIMPL1_RAW(void, JIT_ReversePInvokeExitTrackTransitions, ReversePInvokeFrame* f #ifdef PROFILING_SUPPORTED if (CORProfilerTrackTransitions()) { - ProfilerUnmanagedToManagedTransitionMD(frame->pMD, COR_PRF_TRANSITION_RETURN); + ProfilerManagedToUnmanagedTransitionMD(frame->pMD, COR_PRF_TRANSITION_RETURN); } #endif } diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 692c35eb6dae7e..59fcb0c9f5ec9e 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -11946,6 +11946,50 @@ uint32_t CEEJitInfo::getExpectedTargetArchitecture() return IMAGE_FILE_MACHINE_NATIVE; } +bool CEEJitInfo::doesFieldBelongToClass(CORINFO_FIELD_HANDLE fldHnd, CORINFO_CLASS_HANDLE cls) +{ + CONTRACTL { + THROWS; + GC_TRIGGERS; + MODE_PREEMPTIVE; + } CONTRACTL_END; + + bool result; + + JIT_TO_EE_TRANSITION(); + + FieldDesc* field = (FieldDesc*) fldHnd; + TypeHandle th(cls); + + _ASSERTE(!field->IsStatic()); + + // doesFieldBelongToClass implements the predicate of... + // if field is not associated with the class in any way, return false. + // if field is the only FieldDesc that the JIT might see for a given class handle + // and logical field pair then return true. This is needed as the field handle here + // is used as a key into a hashtable mapping writes to fields to value numbers. + // + // In the CoreCLR VM implementation, verifying that the canonical MethodTable of + // the field matches the type found via GetExactDeclaringType, as all instance fields + // are only held on the canonical MethodTable. + // This yields a truth table such as + + // BaseType._field, BaseType -> true + // BaseType._field, DerivedType -> true + // BaseType<__Canon>._field, BaseType<__Canon> -> true + // BaseType<__Canon>._field, BaseType -> true + // BaseType<__Canon>._field, BaseType -> true + // BaseType._field, BaseType -> true + // BaseType._field, BaseType -> false + + MethodTable* pMT = field->GetExactDeclaringType(th.GetMethodTable()); + result = (pMT != nullptr) && (pMT->GetCanonicalMethodTable() == field->GetApproxEnclosingMethodTable()->GetCanonicalMethodTable()); + + EE_TO_JIT_TRANSITION(); + + return result; +} + void CEEInfo::JitProcessShutdownWork() { LIMITED_METHOD_CONTRACT; @@ -14156,6 +14200,13 @@ BOOL LoadDynamicInfoEntry(Module *currentModule, CorInfoHelpFunc corInfoHelpFunc = MapReadyToRunHelper((ReadyToRunHelper)helperNum); if (corInfoHelpFunc != CORINFO_HELP_UNDEF) { +#ifdef OSX_ARM64_ABI + if (corInfoHelpFunc == CORINFO_HELP_NEW_MDARR) + { + STRESS_LOG(LF_ZAP, LL_WARNING, "CORINFO_HELP_NEW_MDARR is not supported on osx-arm64\n"); + return FALSE; + } +#endif // OSX_ARM64_ABI result = (size_t)CEEJitInfo::getHelperFtnStatic(corInfoHelpFunc); } else @@ -14770,6 +14821,12 @@ uint32_t CEEInfo::getExpectedTargetArchitecture() return IMAGE_FILE_MACHINE_NATIVE; } +bool CEEInfo::doesFieldBelongToClass(CORINFO_FIELD_HANDLE fld, CORINFO_CLASS_HANDLE cls) +{ + LIMITED_METHOD_CONTRACT; + UNREACHABLE_RET(); // only called on derived class. +} + void CEEInfo::setBoundaries(CORINFO_METHOD_HANDLE ftn, ULONG32 cMap, ICorDebugInfo::OffsetMapping *pMap) { diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h index c231cc865ccaea..a3378207880aae 100644 --- a/src/coreclr/vm/jitinterface.h +++ b/src/coreclr/vm/jitinterface.h @@ -693,6 +693,8 @@ class CEEJitInfo : public CEEInfo uint32_t getExpectedTargetArchitecture() override final; + bool doesFieldBelongToClass(CORINFO_FIELD_HANDLE fld, CORINFO_CLASS_HANDLE cls) override final; + void ResetForJitRetry() { CONTRACTL { diff --git a/src/coreclr/vm/loaderallocator.cpp b/src/coreclr/vm/loaderallocator.cpp index 08ef69c1281acc..b4b710ea34483c 100644 --- a/src/coreclr/vm/loaderallocator.cpp +++ b/src/coreclr/vm/loaderallocator.cpp @@ -401,8 +401,9 @@ LoaderAllocator * LoaderAllocator::GCLoaderAllocators_RemoveAssemblies(AppDomain #endif //0 AppDomain::AssemblyIterator i; - // Iterate through every loader allocator, marking as we go { + // Iterate through every loader allocator, marking as we go + CrstHolder chLoaderAllocatorReferencesLock(pAppDomain->GetLoaderAllocatorReferencesLock()); CrstHolder chAssemblyListLock(pAppDomain->GetAssemblyListLock()); i = pAppDomain->IterateAssembliesEx((AssemblyIterationFlags)( @@ -424,17 +425,11 @@ LoaderAllocator * LoaderAllocator::GCLoaderAllocators_RemoveAssemblies(AppDomain } } } - } - - // Iterate through every loader allocator, unmarking marked loaderallocators, and - // build a free list of unmarked ones - { - CrstHolder chLoaderAllocatorReferencesLock(pAppDomain->GetLoaderAllocatorReferencesLock()); - CrstHolder chAssemblyListLock(pAppDomain->GetAssemblyListLock()); + // Iterate through every loader allocator, unmarking marked loaderallocators, and + // build a free list of unmarked ones i = pAppDomain->IterateAssembliesEx((AssemblyIterationFlags)( kIncludeExecution | kIncludeLoaded | kIncludeCollected)); - CollectibleAssemblyHolder pDomainAssembly; while (i.Next_Unlocked(pDomainAssembly.This())) { diff --git a/src/coreclr/vm/multicorejit.cpp b/src/coreclr/vm/multicorejit.cpp index 380a007c78085e..a1821efcaf4116 100644 --- a/src/coreclr/vm/multicorejit.cpp +++ b/src/coreclr/vm/multicorejit.cpp @@ -1202,16 +1202,13 @@ void MulticoreJitManager::StartProfile(AppDomain * pDomain, ICLRPrivBinder *pBin if ((pProfile != NULL) && (pProfile[0] != 0)) // Ignore empty file name, just same as StopProfile { - bool gatherProfile = (int)CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MultiCoreJitNoProfileGather) == 0; - MulticoreJitRecorder * pRecorder = new (nothrow) MulticoreJitRecorder( pDomain, - pBinderContext, - gatherProfile); + pBinderContext); if (pRecorder != NULL) { - gatherProfile = pRecorder->CanGatherProfile(); + bool gatherProfile = (int)CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MultiCoreJitNoProfileGather) == 0; m_pMulticoreJitRecorder = pRecorder; @@ -1221,9 +1218,10 @@ void MulticoreJitManager::StartProfile(AppDomain * pDomain, ICLRPrivBinder *pBin MulticoreJitTrace(("MulticoreJitRecorder session %d created: %x", sessionID, hr)); - if ((hr == COR_E_BADIMAGEFORMAT) || SUCCEEDED(hr)) // Ignore COR_E_BADIMAGEFORMAT, always record new profile + if ((hr == COR_E_BADIMAGEFORMAT) || (SUCCEEDED(hr) && gatherProfile)) // Ignore COR_E_BADIMAGEFORMAT, always record new profile { - m_fRecorderActive = gatherProfile; + m_pMulticoreJitRecorder->Activate(); + m_fRecorderActive = m_pMulticoreJitRecorder->CanGatherProfile(); } _FireEtwMulticoreJit(W("STARTPROFILE"), W("Recorder"), m_fRecorderActive, hr, 0); diff --git a/src/coreclr/vm/multicorejitimpl.h b/src/coreclr/vm/multicorejitimpl.h index d1f05816788f20..3a0d3b4eed0601 100644 --- a/src/coreclr/vm/multicorejitimpl.h +++ b/src/coreclr/vm/multicorejitimpl.h @@ -655,7 +655,7 @@ class MulticoreJitRecorder public: - MulticoreJitRecorder(AppDomain * pDomain, ICLRPrivBinder * pBinderContext, bool fRecorderActive) + MulticoreJitRecorder(AppDomain * pDomain, ICLRPrivBinder * pBinderContext) : m_stats(pDomain->GetMulticoreJitManager().GetStats()) , m_ModuleList(nullptr) , m_JitInfoArray(nullptr) @@ -665,18 +665,10 @@ class MulticoreJitRecorder m_pDomain = pDomain; m_pBinderContext = pBinderContext; - if (fRecorderActive) - { - m_ModuleList = new (nothrow) RecorderModuleInfo[MAX_MODULES]; - } m_ModuleCount = 0; m_ModuleDepCount = 0; - if (fRecorderActive) - { - m_JitInfoArray = new (nothrow) RecorderInfo[MAX_METHODS]; - } m_JitInfoCount = 0; m_fFirstMethod = true; @@ -726,6 +718,14 @@ class MulticoreJitRecorder (m_ModuleCount >= MAX_MODULES); } + void Activate() + { + LIMITED_METHOD_CONTRACT; + + m_ModuleList = new (nothrow) RecorderModuleInfo[MAX_MODULES]; + m_JitInfoArray = new (nothrow) RecorderInfo[MAX_METHODS]; + } + void RecordMethodJitOrLoad(MethodDesc * pMethod, bool application); MulticoreJitCodeInfo RequestMethodCode(MethodDesc * pMethod, MulticoreJitManager * pManager); diff --git a/src/coreclr/vm/nativeimage.cpp b/src/coreclr/vm/nativeimage.cpp index 8338dbc60960b4..60105f5cdb6e61 100644 --- a/src/coreclr/vm/nativeimage.cpp +++ b/src/coreclr/vm/nativeimage.cpp @@ -59,6 +59,7 @@ NativeImage::NativeImage(AssemblyLoadContext *pAssemblyLoadContext, PEImageLayou m_pImageLayout = pImageLayout; m_fileName = imageFileName; m_eagerFixupsHaveRun = false; + m_readyToRunCodeDisabled = false; } void NativeImage::Initialize(READYTORUN_HEADER *pHeader, LoaderAllocator *pLoaderAllocator, AllocMemTracker *pamTracker) diff --git a/src/coreclr/vm/nativeimage.h b/src/coreclr/vm/nativeimage.h index 447e600297ae3e..6c50dba998abf4 100644 --- a/src/coreclr/vm/nativeimage.h +++ b/src/coreclr/vm/nativeimage.h @@ -91,6 +91,7 @@ class NativeImage Crst m_eagerFixupsLock; bool m_eagerFixupsHaveRun; + bool m_readyToRunCodeDisabled; private: NativeImage(AssemblyLoadContext *pAssemblyLoadContext, PEImageLayout *peImageLayout, LPCUTF8 imageFileName); @@ -126,6 +127,18 @@ class NativeImage void CheckAssemblyMvid(Assembly *assembly) const; + void DisableAllR2RCode() + { + LIMITED_METHOD_CONTRACT; + m_readyToRunCodeDisabled = true; + } + + bool ReadyToRunCodeDisabled() + { + LIMITED_METHOD_CONTRACT; + return m_readyToRunCodeDisabled; + } + private: IMDInternalImport *LoadManifestMetadata(); }; diff --git a/src/coreclr/vm/object.cpp b/src/coreclr/vm/object.cpp index 36b100d6e9125a..af2201cbf4dce6 100644 --- a/src/coreclr/vm/object.cpp +++ b/src/coreclr/vm/object.cpp @@ -1033,6 +1033,41 @@ OBJECTREF::OBJECTREF(const OBJECTREF & objref) } +//------------------------------------------------------------- +// VolatileLoadWithoutBarrier constructor +//------------------------------------------------------------- +OBJECTREF::OBJECTREF(const OBJECTREF *pObjref, tagVolatileLoadWithoutBarrier tag) +{ + STATIC_CONTRACT_NOTHROW; + STATIC_CONTRACT_GC_NOTRIGGER; + STATIC_CONTRACT_MODE_COOPERATIVE; + STATIC_CONTRACT_FORBID_FAULT; + + Object* objrefAsObj = VolatileLoadWithoutBarrier(&pObjref->m_asObj); + VALIDATEOBJECT(objrefAsObj); + + // !!! If this assert is fired, there are two possibilities: + // !!! 1. You are doing a type cast, e.g. *(OBJECTREF*)pObj + // !!! Instead, you should use ObjectToOBJECTREF(*(Object**)pObj), + // !!! or ObjectToSTRINGREF(*(StringObject**)pObj) + // !!! 2. There is a real GC hole here. + // !!! Either way you need to fix the code. + _ASSERTE(Thread::IsObjRefValid(pObjref)); + if ((objrefAsObj != 0) && + ((IGCHeap*)GCHeapUtilities::GetGCHeap())->IsHeapPointer( (BYTE*)this )) + { + _ASSERTE(!"Write Barrier violation. Must use SetObjectReference() to assign OBJECTREF's into the GC heap!"); + } + m_asObj = objrefAsObj; + + if (m_asObj != 0) { + ENABLESTRESSHEAP(); + } + + Thread::ObjectRefNew(this); +} + + //------------------------------------------------------------- // To allow NULL to be used as an OBJECTREF. //------------------------------------------------------------- diff --git a/src/coreclr/vm/object.h b/src/coreclr/vm/object.h index e35bd90fd68ab5..398b4f49030a2e 100644 --- a/src/coreclr/vm/object.h +++ b/src/coreclr/vm/object.h @@ -2418,7 +2418,7 @@ class ExceptionObject : public Object OBJECTREF GetInnerException() { LIMITED_METHOD_DAC_CONTRACT; - return _innerException; + return VolatileLoadWithoutBarrierOBJECTREF(&_innerException); } // Returns the innermost exception object - equivalent of the @@ -2431,7 +2431,7 @@ class ExceptionObject : public Object OBJECTREF oInnerMostException = NULL; OBJECTREF oCurrent = NULL; - oCurrent = _innerException; + oCurrent = GetInnerException(); while(oCurrent != NULL) { oInnerMostException = oCurrent; @@ -2469,7 +2469,7 @@ class ExceptionObject : public Object STRINGREF GetRemoteStackTraceString() { LIMITED_METHOD_DAC_CONTRACT; - return _remoteStackTraceString; + return (STRINGREF)VolatileLoadWithoutBarrierOBJECTREF(&_remoteStackTraceString); } void SetHelpURL(STRINGREF helpURL) @@ -2512,7 +2512,7 @@ class ExceptionObject : public Object U1ARRAYREF GetWatsonBucketReference() { LIMITED_METHOD_CONTRACT; - return _watsonBuckets; + return (U1ARRAYREF)VolatileLoadWithoutBarrierOBJECTREF(&_watsonBuckets); } // This method will return a BOOL to indicate if the @@ -2520,7 +2520,7 @@ class ExceptionObject : public Object BOOL AreWatsonBucketsPresent() { LIMITED_METHOD_CONTRACT; - return (_watsonBuckets != NULL)?TRUE:FALSE; + return (GetWatsonBucketReference() != NULL)?TRUE:FALSE; } // This method will save the IP to be used for watson bucketing. @@ -2545,7 +2545,7 @@ class ExceptionObject : public Object { LIMITED_METHOD_CONTRACT; - return _ipForWatsonBuckets; + return VolatileLoadWithoutBarrier(&_ipForWatsonBuckets); } // README: diff --git a/src/coreclr/vm/peimagelayout.cpp b/src/coreclr/vm/peimagelayout.cpp index 76a4f52d6edd37..44781faa29128f 100644 --- a/src/coreclr/vm/peimagelayout.cpp +++ b/src/coreclr/vm/peimagelayout.cpp @@ -213,13 +213,18 @@ void PEImageLayout::ApplyBaseRelocations() // Restore the protection if (dwOldProtection != 0) { +#if defined(__APPLE__) && defined(HOST_ARM64) BOOL bExecRegion = (dwOldProtection & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY)) != 0; + // Disable writing on Apple Silicon + if (bExecRegion) + PAL_JitWriteProtect(false); +#else if (!ClrVirtualProtect(pWriteableRegion, cbWriteableRegion, dwOldProtection, &dwOldProtection)) ThrowLastError(); - +#endif // __APPLE__ && HOST_ARM64 dwOldProtection = 0; } @@ -238,14 +243,21 @@ void PEImageLayout::ApplyBaseRelocations() #if defined(TARGET_UNIX) && !defined(CROSSGEN_COMPILE) if (((pSection->Characteristics & VAL32(IMAGE_SCN_MEM_EXECUTE)) != 0)) { +#if defined(__APPLE__) && defined(HOST_ARM64) + // Enable writing on Apple Silicon + PAL_JitWriteProtect(true); +#else // On SELinux, we cannot change protection that doesn't have execute access rights // to one that has it, so we need to set the protection to RWX instead of RW dwNewProtection = PAGE_EXECUTE_READWRITE; +#endif // __APPLE__ && HOST_ARM64 } #endif // TARGET_UNIX && !CROSSGEN_COMPILE +#if !(defined(__APPLE__) && defined(HOST_ARM64)) if (!ClrVirtualProtect(pWriteableRegion, cbWriteableRegion, dwNewProtection, &dwOldProtection)) ThrowLastError(); +#endif // !(__APPLE__ && HOST_ARM64) #ifdef TARGET_UNIX dwOldProtection = SectionCharacteristicsToPageProtection(pSection->Characteristics); #endif // TARGET_UNIX @@ -307,13 +319,19 @@ void PEImageLayout::ApplyBaseRelocations() #ifndef CROSSGEN_COMPILE if (dwOldProtection != 0) { +#if defined(__APPLE__) && defined(HOST_ARM64) BOOL bExecRegion = (dwOldProtection & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY)) != 0; + // Disable writing on Apple Silicon + if (bExecRegion) + PAL_JitWriteProtect(false); +#else // Restore the protection if (!ClrVirtualProtect(pWriteableRegion, cbWriteableRegion, dwOldProtection, &dwOldProtection)) ThrowLastError(); +#endif // __APPLE__ && HOST_ARM64 } #ifdef TARGET_UNIX PAL_LOADMarkSectionAsNotNeeded((void*)dir); diff --git a/src/coreclr/vm/perfinfo.cpp b/src/coreclr/vm/perfinfo.cpp index 869476ea0fd574..d3a7fc0238e54f 100644 --- a/src/coreclr/vm/perfinfo.cpp +++ b/src/coreclr/vm/perfinfo.cpp @@ -10,19 +10,13 @@ #include "perfinfo.h" #include "pal.h" -PerfInfo::PerfInfo(int pid) +PerfInfo::PerfInfo(int pid, const char* basePath) : m_Stream(nullptr) { LIMITED_METHOD_CONTRACT; - SString tempPath; - if (!WszGetTempPath(tempPath)) - { - return; - } - SString path; - path.Printf("%Sperfinfo-%d.map", tempPath.GetUnicode(), pid); + path.Printf("%s/perfinfo-%d.map", basePath, pid); OpenFile(path); } diff --git a/src/coreclr/vm/perfinfo.h b/src/coreclr/vm/perfinfo.h index 759a844f30925c..79305a03b6f2cb 100644 --- a/src/coreclr/vm/perfinfo.h +++ b/src/coreclr/vm/perfinfo.h @@ -20,7 +20,7 @@ */ class PerfInfo { public: - PerfInfo(int pid); + PerfInfo(int pid, const char* basePath); ~PerfInfo(); void LogImage(PEFile* pFile, WCHAR* guid); diff --git a/src/coreclr/vm/perfmap.cpp b/src/coreclr/vm/perfmap.cpp index 8eb8925f7e0b7d..88bdd42dbe0279 100644 --- a/src/coreclr/vm/perfmap.cpp +++ b/src/coreclr/vm/perfmap.cpp @@ -11,6 +11,7 @@ #include "perfinfo.h" #include "pal.h" + // The code addresses are actually native image offsets during crossgen. Print // them as 32-bit numbers for consistent output when cross-targeting and to // make the output more compact. @@ -21,23 +22,50 @@ #define FMT_CODE_ADDR "%p" #endif +#ifndef __ANDROID__ +#define TEMP_DIRECTORY_PATH "/tmp" +#else +// On Android, "/tmp/" doesn't exist; temporary files should go to +// /data/local/tmp/ +#define TEMP_DIRECTORY_PATH "/data/local/tmp" +#endif + Volatile PerfMap::s_enabled = false; PerfMap * PerfMap::s_Current = nullptr; bool PerfMap::s_ShowOptimizationTiers = false; +unsigned PerfMap::s_StubsMapped = 0; + +enum +{ + DISABLED, + ALL, + JITDUMP, + PERFMAP +}; // Initialize the map for the process - called from EEStartupHelper. void PerfMap::Initialize() { LIMITED_METHOD_CONTRACT; + const DWORD perfMapEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled); + if (perfMapEnabled == DISABLED) + { + return; + } + + // Build the path to the map file on disk. + char tempPathBuffer[MAX_LONGPATH+1]; + const char* tempPath = InternalConstructPath(tempPathBuffer, sizeof(tempPathBuffer)); + // Only enable the map if requested. - if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapEnabled)) + if (perfMapEnabled == ALL || perfMapEnabled == PERFMAP) { // Get the current process id. int currentPid = GetCurrentProcessId(); // Create the map. - s_Current = new PerfMap(currentPid); + s_Current = new PerfMap(currentPid, tempPath); int signalNum = (int) CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapIgnoreSignal); @@ -45,30 +73,39 @@ void PerfMap::Initialize() { PAL_IgnoreProfileSignal(signalNum); } + } - if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapShowOptimizationTiers) != 0) - { - s_ShowOptimizationTiers = true; - } - - s_enabled = true; - -#ifndef CROSSGEN_COMPILE - char jitdumpPath[4096]; + // only enable JitDumps if requested + if (perfMapEnabled == ALL || perfMapEnabled == JITDUMP) + { + PAL_PerfJitDump_Start(tempPath); + } - // CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapJitDumpPath) returns a LPWSTR - // Use GetEnvironmentVariableA because it is simpler. - // Keep comment here to make it searchable. - DWORD len = GetEnvironmentVariableA("COMPlus_PerfMapJitDumpPath", jitdumpPath, sizeof(jitdumpPath) - 1); + if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerfMapShowOptimizationTiers) != 0) + { + s_ShowOptimizationTiers = true; + } + + s_enabled = true; +} - if (len == 0) - { - GetTempPathA(sizeof(jitdumpPath) - 1, jitdumpPath); - } +// InternalConstructPath is guaranteed to return a non-null path +// the function uses the input buffer only whe PerfMapJitDumpPath environment variable is set +const char * PerfMap::InternalConstructPath(char *tmpBuf, int lenBuf) +{ + DWORD len = GetEnvironmentVariableA("DOTNET_PerfMapJitDumpPath", tmpBuf, lenBuf); + if (len == 0) + { + len = GetEnvironmentVariableA("COMPlus_PerfMapJitDumpPath", tmpBuf, lenBuf); + } - PAL_PerfJitDump_Start(jitdumpPath); -#endif // CROSSGEN_COMPILE + if (len == 0 || // GetEnvironmentVariableA returns 0 if the variable is not found, + len >= lenBuf) // or the length of the string not including the null terminator on success. + { + return TEMP_DIRECTORY_PATH; } + + return tmpBuf; } // Destroy the map for the process - called from EEShutdownHelper. @@ -85,29 +122,21 @@ void PerfMap::Destroy() } // Construct a new map for the process. -PerfMap::PerfMap(int pid) +PerfMap::PerfMap(int pid, const char* path) { LIMITED_METHOD_CONTRACT; // Initialize with no failures. m_ErrorEncountered = false; - m_StubsMapped = 0; - // Build the path to the map file on disk. - WCHAR tempPath[MAX_LONGPATH+1]; - if(!GetTempPathW(MAX_LONGPATH, tempPath)) - { - return; - } - - SString path; - path.Printf("%Sperf-%d.map", &tempPath, pid); + SString pathFile; + pathFile.Printf("%s/perf-%d.map", path, pid); // Open the map file for writing. - OpenFile(path); + OpenFile(pathFile); - m_PerfInfo = new PerfInfo(pid); + m_PerfInfo = new PerfInfo(pid, path); } // Construct a new map without a specified file name. @@ -120,8 +149,6 @@ PerfMap::PerfMap() // Initialize with no failures. m_ErrorEncountered = false; - - m_StubsMapped = 0; } // Clean-up resources. @@ -159,6 +186,11 @@ void PerfMap::WriteLine(SString& line) { STANDARD_VM_CONTRACT; + if (m_FileStream == nullptr || m_ErrorEncountered) + { + return; + } + EX_TRY { // Write the line. @@ -180,51 +212,9 @@ void PerfMap::WriteLine(SString& line) EX_CATCH{} EX_END_CATCH(SwallowAllExceptions); } -// Log a method to the map. -void PerfMap::LogMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize, const char *optimizationTier) -{ - CONTRACTL{ - THROWS; - GC_NOTRIGGER; - MODE_PREEMPTIVE; - PRECONDITION(pMethod != nullptr); - PRECONDITION(pCode != nullptr); - PRECONDITION(codeSize > 0); - } CONTRACTL_END; - - if (m_FileStream == nullptr || m_ErrorEncountered) - { - // A failure occurred, do not log. - return; - } - - // Logging failures should not cause any exceptions to flow upstream. - EX_TRY - { - // Get the full method signature. - SString name; - pMethod->GetFullMethodInfo(name); - - // Build the map file line. - StackScratchBuffer scratch; - if (optimizationTier != nullptr && s_ShowOptimizationTiers) - { - name.AppendPrintf("[%s]", optimizationTier); - } - SString line; - line.Printf(FMT_CODE_ADDR " %x %s\n", pCode, codeSize, name.GetANSI(scratch)); - - // Write the line. - WriteLine(line); - PAL_PerfJitDump_LogMethod((void*)pCode, codeSize, name.GetANSI(scratch), nullptr, nullptr); - } - EX_CATCH{} EX_END_CATCH(SwallowAllExceptions); -} - - -void PerfMap::LogImageLoad(PEFile * pFile) +void PerfMap::LogImageLoad(PEFile *pFile) { - if (s_enabled) + if (s_enabled && s_Current != nullptr) { s_Current->LogImage(pFile); } @@ -263,6 +253,15 @@ void PerfMap::LogJITCompiledMethod(MethodDesc * pMethod, PCODE pCode, size_t cod { LIMITED_METHOD_CONTRACT; + CONTRACTL{ + THROWS; + GC_NOTRIGGER; + MODE_PREEMPTIVE; + PRECONDITION(pMethod != nullptr); + PRECONDITION(pCode != nullptr); + PRECONDITION(codeSize > 0); + } CONTRACTL_END; + if (!s_enabled) { return; @@ -276,7 +275,32 @@ void PerfMap::LogJITCompiledMethod(MethodDesc * pMethod, PCODE pCode, size_t cod } #endif // CROSSGEN_COMPILE - s_Current->LogMethod(pMethod, pCode, codeSize, optimizationTier); + // Logging failures should not cause any exceptions to flow upstream. + EX_TRY + { + // Get the full method signature. + SString name; + pMethod->GetFullMethodInfo(name); + + // Build the map file line. + if (optimizationTier != nullptr && s_ShowOptimizationTiers) + { + name.AppendPrintf("[%s]", optimizationTier); + } + + StackScratchBuffer scratch; + SString line; + line.Printf(FMT_CODE_ADDR " %x %s\n", pCode, codeSize, name.GetANSI(scratch)); + + // Write the line. + if(s_Current != nullptr) + { + s_Current->WriteLine(line); + } + PAL_PerfJitDump_LogMethod((void*)pCode, codeSize, name.GetANSI(scratch), nullptr, nullptr); + } + EX_CATCH{} EX_END_CATCH(SwallowAllExceptions); + } // Log a pre-compiled method to the perfmap. @@ -335,7 +359,7 @@ void PerfMap::LogStubs(const char* stubType, const char* stubOwner, PCODE pCode, { LIMITED_METHOD_CONTRACT; - if (!s_enabled || s_Current->m_FileStream == nullptr) + if (!s_enabled) { return; } @@ -355,12 +379,15 @@ void PerfMap::LogStubs(const char* stubType, const char* stubOwner, PCODE pCode, // Build the map file line. StackScratchBuffer scratch; SString name; - name.Printf("stub<%d> %s<%s>", ++(s_Current->m_StubsMapped), stubType, stubOwner); + name.Printf("stub<%d> %s<%s>", ++(s_StubsMapped), stubType, stubOwner); SString line; line.Printf(FMT_CODE_ADDR " %x %s\n", pCode, codeSize, name.GetANSI(scratch)); // Write the line. - s_Current->WriteLine(line); + if(s_Current != nullptr) + { + s_Current->WriteLine(line); + } PAL_PerfJitDump_LogMethod((void*)pCode, codeSize, name.GetANSI(scratch), nullptr, nullptr); } EX_CATCH{} EX_END_CATCH(SwallowAllExceptions); @@ -417,6 +444,42 @@ NativeImagePerfMap::NativeImagePerfMap(Assembly * pAssembly, BSTR pDestPath) } } +void NativeImagePerfMap::LogMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize, const char *optimizationTier) +{ + CONTRACTL{ + THROWS; + GC_NOTRIGGER; + MODE_PREEMPTIVE; + PRECONDITION(pMethod != nullptr); + PRECONDITION(pCode != nullptr); + PRECONDITION(codeSize > 0); + } CONTRACTL_END; + + // Logging failures should not cause any exceptions to flow upstream. + EX_TRY + { + // Get the full method signature. + SString name; + pMethod->GetFullMethodInfo(name); + + // Build the map file line. + StackScratchBuffer scratch; + if (optimizationTier != nullptr && s_ShowOptimizationTiers) + { + name.AppendPrintf("[%s]", optimizationTier); + } + SString line; + line.Printf(FMT_CODE_ADDR " %x %s\n", pCode, codeSize, name.GetANSI(scratch)); + + if (s_Current != nullptr) + { + s_Current->WriteLine(line); + } + PAL_PerfJitDump_LogMethod((void*)pCode, codeSize, name.GetANSI(scratch), nullptr, nullptr); + } + EX_CATCH{} EX_END_CATCH(SwallowAllExceptions); +} + // Log data to the perfmap for the specified module. void NativeImagePerfMap::LogDataForModule(Module * pModule) { diff --git a/src/coreclr/vm/perfmap.h b/src/coreclr/vm/perfmap.h index 14595813877d8b..f9665f8b27f0c2 100644 --- a/src/coreclr/vm/perfmap.h +++ b/src/coreclr/vm/perfmap.h @@ -18,11 +18,8 @@ class PerfMap private: static Volatile s_enabled; - // The one and only PerfMap for the process. - static PerfMap * s_Current; - - // Indicates whether optimization tiers should be shown for methods in perf maps - static bool s_ShowOptimizationTiers; + // Set to true if an error is encountered when writing to the file. + static unsigned s_StubsMapped; // The file stream to write the map to. CFileStream * m_FileStream; @@ -33,16 +30,19 @@ class PerfMap // Set to true if an error is encountered when writing to the file. bool m_ErrorEncountered; - // Set to true if an error is encountered when writing to the file. - unsigned m_StubsMapped; - // Construct a new map for the specified pid. - PerfMap(int pid); + PerfMap(int pid, const char* path); - // Write a line to the map file. - void WriteLine(SString & line); + // Default to /tmp or use DOTNET_PerfMapJitDumpPath if set + static const char* InternalConstructPath(char *tmpBuf, int lenBuf); protected: + // Indicates whether optimization tiers should be shown for methods in perf maps + static bool s_ShowOptimizationTiers; + + // The one and only PerfMap for the process. + static PerfMap * s_Current; + // Construct a new map without a specified file name. // Used for offline creation of NGEN map files. PerfMap(); @@ -53,9 +53,6 @@ class PerfMap // Open the perf map file for write. void OpenFile(SString& path); - // Does the actual work to log a method to the map. - void LogMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize, const char *optimizationTier); - // Does the actual work to log an image void LogImage(PEFile * pFile); @@ -63,6 +60,9 @@ class PerfMap static void GetNativeImageSignature(PEFile * pFile, WCHAR * pwszSig, unsigned int nSigSize); public: + // Write a line to the map file. + void WriteLine(SString & line); + // Initialize the map for the current process. static void Initialize(); @@ -91,6 +91,9 @@ class NativeImagePerfMap : PerfMap // Specify the address format since it's now possible for 'perf script' to output file offsets or RVAs. bool m_EmitRVAs; + // Does the actual work to log a method to the map. + void LogMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize, const char *optimizationTier); + // Log a pre-compiled method to the map. void LogPreCompiledMethod(MethodDesc * pMethod, PCODE pCode, PEImageLayout *pLoadedLayout, const char *optimizationTier); diff --git a/src/coreclr/vm/profilinghelper.cpp b/src/coreclr/vm/profilinghelper.cpp index ac2ea1469a4e3e..67bacc054bc265 100644 --- a/src/coreclr/vm/profilinghelper.cpp +++ b/src/coreclr/vm/profilinghelper.cpp @@ -166,7 +166,9 @@ void CurrentProfilerStatus::Set(ProfilerStatus newProfStatus) break; case kProfStatusNone: - _ASSERTE(newProfStatus == kProfStatusPreInitialize); + _ASSERTE((newProfStatus == kProfStatusPreInitialize) || + (newProfStatus == kProfStatusInitializingForStartupLoad) || + (newProfStatus == kProfStatusInitializingForAttachLoad)); break; case kProfStatusDetaching: @@ -1094,8 +1096,6 @@ HRESULT ProfilingAPIUtility::LoadProfiler( _ASSERTE((pvClientData == NULL) || (loadType == kAttachLoad)); ProfilerInfo profilerInfo; - // RAII type that will deregister if we bail at any point - ProfilerInfoHolder profilerInfoHolder(&profilerInfo); profilerInfo.Init(); profilerInfo.inUse = TRUE; @@ -1169,7 +1169,6 @@ HRESULT ProfilingAPIUtility::LoadProfiler( // Check if this profiler is notification only and load as appropriate BOOL notificationOnly = FALSE; { - EvacuationCounterHolder holder(&profilerInfo); HRESULT callHr = profilerInfo.pProfInterface->LoadAsNotficationOnly(¬ificationOnly); if (FAILED(callHr)) { @@ -1185,8 +1184,6 @@ HRESULT ProfilingAPIUtility::LoadProfiler( LogProfError(IDS_E_PROF_NOTIFICATION_LIMIT_EXCEEDED); return CORPROF_E_PROFILER_ALREADY_ACTIVE; } - - *pProfilerInfo = profilerInfo; } else { @@ -1197,13 +1194,14 @@ HRESULT ProfilingAPIUtility::LoadProfiler( return CORPROF_E_PROFILER_ALREADY_ACTIVE; } - // This profiler cannot be a notification only profiler, copy it over to the - // main slot and the ProfilerInfoHolder above will clear out the notification slot - g_profControlBlock.mainProfilerInfo = profilerInfo; + // This profiler cannot be a notification only profiler pProfilerInfo = &(g_profControlBlock.mainProfilerInfo); } + pProfilerInfo->curProfStatus.Set(profilerInfo.curProfStatus.Get()); + pProfilerInfo->pProfInterface = profilerInfo.pProfInterface; pProfilerInfo->pProfInterface->SetProfilerInfo(pProfilerInfo); + pProfilerInfo->inUse = TRUE; } // Now that the profiler is officially loaded and in Init status, call into the @@ -1396,8 +1394,6 @@ HRESULT ProfilingAPIUtility::LoadProfiler( } } - // Yay, the profiler is started up. Don't deregister it if we get to this point - profilerInfoHolder.SuppressRelease(); return S_OK; } @@ -1444,16 +1440,60 @@ BOOL ProfilingAPIUtility::IsProfilerEvacuated(ProfilerInfo *pProfilerInfo) // // (see // code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization - // for details) - DWORD dwEvacCounter = pProfilerInfo->dwProfilerEvacuationCounter; - if (dwEvacCounter != 0) + // for details)Doing this under the thread store lock not only ensures we can + // iterate through the Thread objects safely, but also forces us to serialize with + // the GC. The latter is important, as server GC enters the profiler on non-EE + // Threads, and so no evacuation counters might be incremented during server GC even + // though control could be entering the profiler. { - LOG(( - LF_CORPROF, - LL_INFO100, - "**PROF: Profiler not yet evacuated because it has evac counter of %d (decimal).\n", - dwEvacCounter)); - return FALSE; + ThreadStoreLockHolder TSLockHolder; + + Thread * pThread = ThreadStore::GetAllThreadList( + NULL, // cursor thread; always NULL to begin with + 0, // mask to AND with Thread::m_State to filter returned threads + 0); // bits to match the result of the above AND. (m_State & 0 == 0, + // so we won't filter out any threads) + + // Note that, by not filtering out any of the threads, we're intentionally including + // stuff like TS_Dead or TS_Unstarted. But that keeps us on the safe + // side. If an EE Thread object exists, we want to check its counters to be + // absolutely certain it isn't executing in a profiler. + + while (pThread != NULL) + { + // Note that pThread is still in motion as we check its evacuation counter. + // This is ok, because we've already changed the profiler status to + // kProfStatusDetaching and flushed CPU buffers. So at this point the counter + // will typically only go down to 0 (and not increment anymore), with one + // small exception (below). So if we get a read of 0 below, the counter will + // typically stay there. Specifically: + // * pThread is most likely not about to increment its evacuation counter + // from 0 to 1 because pThread sees that the status is + // kProfStatusDetaching. + // * Note that there is a small race where pThread might actually + // increment its evac counter from 0 to 1 (if it dirty-read the + // profiler status a tad too early), but that implies that when + // pThread rechecks the profiler status (clean read) then pThread + // will immediately decrement the evac counter back to 0 and avoid + // calling into the EEToProfInterfaceImpl pointer. + // + // (see + // code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization + // for details) + DWORD dwEvacCounter = pThread->GetProfilerEvacuationCounter(pProfilerInfo->slot); + if (dwEvacCounter != 0) + { + LOG(( + LF_CORPROF, + LL_INFO100, + "**PROF: Profiler not yet evacuated because OS Thread ID 0x%x has evac counter of %d (decimal).\n", + pThread->GetOSThreadId(), + dwEvacCounter)); + return FALSE; + } + + pThread = ThreadStore::GetAllThreadList(pThread, 0, 0); + } } // FUTURE: When rejit feature crew complete, add code to verify all rejitted diff --git a/src/coreclr/vm/profilinghelper.h b/src/coreclr/vm/profilinghelper.h index 1cf7ea4ab50005..ab64ee8287473c 100644 --- a/src/coreclr/vm/profilinghelper.h +++ b/src/coreclr/vm/profilinghelper.h @@ -136,11 +136,4 @@ class SetCallbackStateFlagsHolder DWORD m_dwOriginalFullState; }; -FORCEINLINE void DeregisterProfilerIfNotificationOnly(ProfilerInfo *pProfilerInfo) -{ - g_profControlBlock.DeRegisterProfilerInfo(pProfilerInfo); -} - -typedef Wrapper ProfilerInfoHolder; - #endif //__PROFILING_HELPER_H__ diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/vm/proftoeeinterfaceimpl.cpp index 40b3ce5b09476a..35bc318f1b20ea 100644 --- a/src/coreclr/vm/proftoeeinterfaceimpl.cpp +++ b/src/coreclr/vm/proftoeeinterfaceimpl.cpp @@ -719,20 +719,132 @@ struct GenerationDesc BYTE *rangeEndReserved; }; -struct GenerationTable -{ +class GenerationTable +{ +public: + GenerationTable(); + void AddRecord(int generation, BYTE* rangeStart, BYTE* rangeEnd, BYTE* rangeEndReserved); + void AddRecordNoLock(int generation, BYTE* rangeStart, BYTE* rangeEnd, BYTE* rangeEndReserved); + void Refresh(); + HRESULT GetGenerationBounds(ULONG cObjectRanges, ULONG* pcObjectRanges, COR_PRF_GC_GENERATION_RANGE* ranges); +private: + Crst mutex; ULONG count; ULONG capacity; static const ULONG defaultCapacity = 5; // that's the minimum for Gen0-2 + LOH + POH - GenerationTable *prev; GenerationDesc *genDescTable; -#ifdef _DEBUG - ULONG magic; -#define GENERATION_TABLE_MAGIC 0x34781256 -#define GENERATION_TABLE_BAD_MAGIC 0x55aa55aa -#endif }; +GenerationTable::GenerationTable() : mutex(CrstLeafLock, CRST_UNSAFE_ANYMODE) +{ + count = 0; + capacity = GenerationTable::defaultCapacity; + genDescTable = new (nothrow) GenerationDesc[capacity]; + if (genDescTable == NULL) + { + capacity = 0; + } +} + +void GenerationTable::AddRecord(int generation, BYTE* rangeStart, BYTE* rangeEnd, BYTE* rangeEndReserved) +{ + CONTRACT_VOID + { + NOTHROW; + GC_NOTRIGGER; + MODE_ANY; // can be called even on GC threads + PRECONDITION(0 <= generation && generation <= 4); + PRECONDITION(CheckPointer(rangeStart)); + PRECONDITION(CheckPointer(rangeEnd)); + PRECONDITION(CheckPointer(rangeEndReserved)); + } CONTRACT_END; + + CrstHolder holder(&mutex); + + // Because the segment/region are added to the heap before they are reported to the profiler, + // it is possible that the region is added to the heap, a racing GenerationTable refresh happened, + // that refresh would contain the new region, and then it get reported again here. + // This check will make sure we never add duplicated record to the table. + for (ULONG i = 0; i < count; i++) + { + if (genDescTable[i].rangeStart == rangeStart) + { + _ASSERTE (genDescTable[i].generation == generation); + _ASSERTE (genDescTable[i].rangeEnd == rangeEnd); + _ASSERTE (genDescTable[i].rangeEndReserved == rangeEndReserved); + RETURN; + } + } + AddRecordNoLock(generation, rangeStart, rangeEnd, rangeEndReserved); + RETURN; +} + +void GenerationTable::AddRecordNoLock(int generation, BYTE* rangeStart, BYTE* rangeEnd, BYTE* rangeEndReserved) +{ + CONTRACT_VOID + { + NOTHROW; + GC_NOTRIGGER; + MODE_ANY; // can be called even on GC threads + PRECONDITION(0 <= generation && generation <= 4); + PRECONDITION(CheckPointer(rangeStart)); + PRECONDITION(CheckPointer(rangeEnd)); + PRECONDITION(CheckPointer(rangeEndReserved)); + } CONTRACT_END; + + _ASSERTE (mutex.OwnedByCurrentThread()); + if (count >= capacity) + { + ULONG newCapacity = capacity == 0 ? GenerationTable::defaultCapacity : capacity * 2; + GenerationDesc *newGenDescTable = new (nothrow) GenerationDesc[newCapacity]; + if (newGenDescTable == NULL) + { + count = capacity = 0; + delete[] genDescTable; + genDescTable = nullptr; + RETURN; + } + memcpy(newGenDescTable, genDescTable, sizeof(genDescTable[0]) * count); + delete[] genDescTable; + genDescTable = newGenDescTable; + capacity = newCapacity; + } + _ASSERTE(count < capacity); + + genDescTable[count].generation = generation; + genDescTable[count].rangeStart = rangeStart; + genDescTable[count].rangeEnd = rangeEnd; + genDescTable[count].rangeEndReserved = rangeEndReserved; + + count = count + 1; + RETURN; +} + +HRESULT GenerationTable::GetGenerationBounds(ULONG cObjectRanges, ULONG* pcObjectRanges, COR_PRF_GC_GENERATION_RANGE* ranges) +{ + if ((cObjectRanges > 0) && (ranges == nullptr)) + { + return E_INVALIDARG; + } + CrstHolder holder(&mutex); + if (genDescTable == nullptr) + { + return E_FAIL; + } + ULONG copy = min(count, cObjectRanges); + for (ULONG i = 0; i < copy; i++) + { + ranges[i].generation = (COR_PRF_GC_GENERATION)genDescTable[i].generation; + ranges[i].rangeStart = (ObjectID)genDescTable[i].rangeStart; + ranges[i].rangeLength = genDescTable[i].rangeEnd - genDescTable[i].rangeStart; + ranges[i].rangeLengthReserved = genDescTable[i].rangeEndReserved - genDescTable[i].rangeStart; + } + if (pcObjectRanges != nullptr) + { + *pcObjectRanges = count; + } + return S_OK; +} //--------------------------------------------------------------------------------------- // @@ -769,46 +881,24 @@ static void GenWalkFunc(void * context, } CONTRACT_END; GenerationTable *generationTable = (GenerationTable *)context; + generationTable->AddRecordNoLock(generation, rangeStart, rangeEnd, rangeEndReserved); + RETURN; +} - _ASSERTE(generationTable->magic == GENERATION_TABLE_MAGIC); - - ULONG count = generationTable->count; - if (count >= generationTable->capacity) - { - ULONG newCapacity = generationTable->capacity == 0 ? GenerationTable::defaultCapacity : generationTable->capacity * 2; - GenerationDesc *newGenDescTable = new (nothrow) GenerationDesc[newCapacity]; - if (newGenDescTable == NULL) - { - // if we can't allocate a bigger table, we'll have to ignore this call - RETURN; - } - memcpy(newGenDescTable, generationTable->genDescTable, sizeof(generationTable->genDescTable[0]) * generationTable->count); - delete[] generationTable->genDescTable; - generationTable->genDescTable = newGenDescTable; - generationTable->capacity = newCapacity; - } - _ASSERTE(count < generationTable->capacity); - - GenerationDesc *genDescTable = generationTable->genDescTable; - - genDescTable[count].generation = generation; - genDescTable[count].rangeStart = rangeStart; - genDescTable[count].rangeEnd = rangeEnd; - genDescTable[count].rangeEndReserved = rangeEndReserved; - - generationTable->count = count + 1; +void GenerationTable::Refresh() +{ + // fill in the values by calling back into the gc, which will report + // the ranges by calling GenWalkFunc for each one + CrstHolder holder(&mutex); + IGCHeap *hp = GCHeapUtilities::GetGCHeap(); + this->count = 0; + hp->DiagDescrGenerations(GenWalkFunc, this); } // This is the table of generation bounds updated by the gc -// and read by the profiler. So this is a single writer, -// multiple readers scenario. +// and read by the profiler. static GenerationTable *s_currentGenerationTable; -// The generation table is updated atomically by replacing the -// pointer to it. The only tricky part is knowing when -// the old table can be deleted. -static Volatile s_generationTableLock; - // This is just so we can assert there's a single writer #ifdef ENABLE_CONTRACTS static Volatile s_generationTableWriterCount; @@ -837,67 +927,41 @@ void __stdcall UpdateGenerationBounds() // Notify the profiler of start of the collection if (CORProfilerTrackGC() || CORProfilerTrackBasicGC()) { - // generate a new generation table - GenerationTable *newGenerationTable = new (nothrow) GenerationTable(); - if (newGenerationTable == NULL) - RETURN; - newGenerationTable->count = 0; - newGenerationTable->capacity = GenerationTable::defaultCapacity; - // if there is already a current table, use its capacity as a guess for the capacity - if (s_currentGenerationTable != NULL) - newGenerationTable->capacity = s_currentGenerationTable->capacity; - newGenerationTable->prev = NULL; - newGenerationTable->genDescTable = new (nothrow) GenerationDesc[newGenerationTable->capacity]; - if (newGenerationTable->genDescTable == NULL) - newGenerationTable->capacity = 0; - -#ifdef _DEBUG - newGenerationTable->magic = GENERATION_TABLE_MAGIC; -#endif - // fill in the values by calling back into the gc, which will report - // the ranges by calling GenWalkFunc for each one - IGCHeap *hp = GCHeapUtilities::GetGCHeap(); - hp->DiagDescrGenerations(GenWalkFunc, newGenerationTable); - - // remember the old table and plug in the new one - GenerationTable *oldGenerationTable = s_currentGenerationTable; - s_currentGenerationTable = newGenerationTable; - // WARNING: tricky code! - // - // We sample the generation table lock *after* plugging in the new table - // We do so using an interlocked operation so the cpu can't reorder - // the write to the s_currentGenerationTable with the increment. - // If the interlocked increment returns 1, we know nobody can be using - // the old table (readers increment the lock before using the table, - // and decrement it afterwards). Any new readers coming in - // will use the new table. So it's safe to delete the old - // table. - // On the other hand, if the interlocked increment returns - // something other than one, we put the old table on a list - // dangling off of the new one. Next time around, we'll try again - // deleting any old tables. - if (FastInterlockIncrement(&s_generationTableLock) == 1) + if (s_currentGenerationTable == nullptr) { - // We know nobody can be using any of the old tables - while (oldGenerationTable != NULL) + EX_TRY { - _ASSERTE(oldGenerationTable->magic == GENERATION_TABLE_MAGIC); -#ifdef _DEBUG - oldGenerationTable->magic = GENERATION_TABLE_BAD_MAGIC; -#endif - GenerationTable *temp = oldGenerationTable; - oldGenerationTable = oldGenerationTable->prev; - delete[] temp->genDescTable; - delete temp; + s_currentGenerationTable = new (nothrow) GenerationTable(); } + EX_CATCH + { + } + EX_END_CATCH(SwallowAllExceptions) } - else + + if (s_currentGenerationTable == nullptr) { - // put the old table on a list - newGenerationTable->prev = oldGenerationTable; + RETURN; } - FastInterlockDecrement(&s_generationTableLock); + s_currentGenerationTable->Refresh(); + } +#endif // PROFILING_SUPPORTED + RETURN; +} + +void __stdcall ProfilerAddNewRegion(int generation, uint8_t* rangeStart, uint8_t* rangeEnd, uint8_t* rangeEndReserved) +{ + CONTRACT_VOID + { + NOTHROW; + GC_NOTRIGGER; + MODE_ANY; // can be called even on GC threads + } CONTRACT_END; +#ifdef PROFILING_SUPPORTED + if (CORProfilerTrackGC() || CORProfilerTrackBasicGC()) + { + s_currentGenerationTable->AddRecord(generation, rangeStart, rangeEnd, rangeEndReserved); } #endif // PROFILING_SUPPORTED RETURN; @@ -1210,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, @@ -1448,7 +1512,7 @@ HRESULT ProfToEEInterfaceImpl::SetEventMask(DWORD dwEventMask) "**PROF: SetEventMask 0x%08x.\n", dwEventMask)); - _ASSERTE(CORProfilerPresentOrInitializing()); + _ASSERTE(CORProfilerPresent()); return m_pProfilerInfo->pProfInterface->SetEventMask(dwEventMask, 0 /* No high bits */); } @@ -1480,7 +1544,7 @@ HRESULT ProfToEEInterfaceImpl::SetEventMask2(DWORD dwEventsLow, DWORD dwEventsHi "**PROF: SetEventMask2 0x%08x, 0x%08x.\n", dwEventsLow, dwEventsHigh)); - _ASSERTE(CORProfilerPresentOrInitializing()); + _ASSERTE(CORProfilerPresent()); return m_pProfilerInfo->pProfInterface->SetEventMask(dwEventsLow, dwEventsHigh); } @@ -8885,13 +8949,11 @@ HRESULT ProfToEEInterfaceImpl::GetGenerationBounds(ULONG cObjectRanges, // Yay! EE_THREAD_NOT_REQUIRED; - // Yay! - CANNOT_TAKE_LOCK; - + // Lock is required to ensure this is synchronized with GC's updates. + CAN_TAKE_LOCK; PRECONDITION(CheckPointer(pcObjectRanges)); PRECONDITION(cObjectRanges <= 0 || ranges != NULL); - PRECONDITION(s_generationTableLock >= 0); } CONTRACTL_END; @@ -8900,31 +8962,12 @@ HRESULT ProfToEEInterfaceImpl::GetGenerationBounds(ULONG cObjectRanges, LL_INFO1000, "**PROF: GetGenerationBounds.\n")); - // Announce we are using the generation table now - CounterHolder genTableLock(&s_generationTableLock); - - GenerationTable *generationTable = s_currentGenerationTable; - - if (generationTable == NULL) + if (s_currentGenerationTable == NULL) { return E_FAIL; } - _ASSERTE(generationTable->magic == GENERATION_TABLE_MAGIC); - - GenerationDesc *genDescTable = generationTable->genDescTable; - ULONG count = min(generationTable->count, cObjectRanges); - for (ULONG i = 0; i < count; i++) - { - ranges[i].generation = (COR_PRF_GC_GENERATION)genDescTable[i].generation; - ranges[i].rangeStart = (ObjectID)genDescTable[i].rangeStart; - ranges[i].rangeLength = genDescTable[i].rangeEnd - genDescTable[i].rangeStart; - ranges[i].rangeLengthReserved = genDescTable[i].rangeEndReserved - genDescTable[i].rangeStart; - } - - *pcObjectRanges = generationTable->count; - - return S_OK; + return s_currentGenerationTable->GetGenerationBounds(cObjectRanges, pcObjectRanges, ranges); } @@ -9020,7 +9063,6 @@ HRESULT ProfToEEInterfaceImpl::GetObjectGeneration(ObjectID objectId, PRECONDITION(objectId != NULL); PRECONDITION(CheckPointer(range)); - PRECONDITION(s_generationTableLock >= 0); } CONTRACTL_END; @@ -9032,36 +9074,22 @@ HRESULT ProfToEEInterfaceImpl::GetObjectGeneration(ObjectID objectId, _ASSERTE((GetThreadNULLOk() == NULL) || (GetThreadNULLOk()->PreemptiveGCDisabled())); - - - // Announce we are using the generation table now - CounterHolder genTableLock(&s_generationTableLock); - - GenerationTable *generationTable = s_currentGenerationTable; - - if (generationTable == NULL) - { - return E_FAIL; - } - _ASSERTE(generationTable->magic == GENERATION_TABLE_MAGIC); + IGCHeap *hp = GCHeapUtilities::GetGCHeap(); - GenerationDesc *genDescTable = generationTable->genDescTable; - ULONG count = generationTable->count; - for (ULONG i = 0; i < count; i++) - { - if (genDescTable[i].rangeStart <= (BYTE *)objectId && (BYTE *)objectId < genDescTable[i].rangeEndReserved) - { - range->generation = (COR_PRF_GC_GENERATION)genDescTable[i].generation; - range->rangeStart = (ObjectID)genDescTable[i].rangeStart; - range->rangeLength = genDescTable[i].rangeEnd - genDescTable[i].rangeStart; - range->rangeLengthReserved = genDescTable[i].rangeEndReserved - genDescTable[i].rangeStart; + uint8_t* pStart; + uint8_t* pAllocated; + uint8_t* pReserved; + unsigned int generation = hp->GetGenerationWithRange((Object*)objectId, &pStart, &pAllocated, &pReserved); - return S_OK; - } - } + UINT_PTR rangeLength = pAllocated - pStart; + UINT_PTR rangeLengthReserved = pReserved - pStart; - return E_FAIL; + range->generation = (COR_PRF_GC_GENERATION)generation; + range->rangeStart = (ObjectID)pStart; + range->rangeLength = rangeLength; + range->rangeLengthReserved = rangeLengthReserved; + return S_OK; } HRESULT ProfToEEInterfaceImpl::GetReJITIDs( diff --git a/src/coreclr/vm/readytoruninfo.cpp b/src/coreclr/vm/readytoruninfo.cpp index 0253d59e09c22f..34ab854c8d2738 100644 --- a/src/coreclr/vm/readytoruninfo.cpp +++ b/src/coreclr/vm/readytoruninfo.cpp @@ -837,7 +837,7 @@ bool ReadyToRunInfo::GetPgoInstrumentationData(MethodDesc * pMD, BYTE** pAllocat return false; // If R2R code is disabled for this module, simply behave as if it is never found - if (m_readyToRunCodeDisabled) + if (ReadyToRunCodeDisabled()) return false; if (m_pgoInstrumentationDataHashtable.IsNull()) @@ -907,7 +907,7 @@ PCODE ReadyToRunInfo::GetEntryPoint(MethodDesc * pMD, PrepareCodeConfig* pConfig goto done; // If R2R code is disabled for this module, simply behave as if it is never found - if (m_readyToRunCodeDisabled) + if (ReadyToRunCodeDisabled()) goto done; ETW::MethodLog::GetR2RGetEntryPointStart(pMD); @@ -1106,7 +1106,7 @@ BOOL ReadyToRunInfo::MethodIterator::Next() } CONTRACTL_END; - if (m_pInfo->m_readyToRunCodeDisabled) + if (m_pInfo->ReadyToRunCodeDisabled()) return FALSE; // Enumerate non-generic methods diff --git a/src/coreclr/vm/readytoruninfo.h b/src/coreclr/vm/readytoruninfo.h index acc909ab5dda33..89b7ab4a475734 100644 --- a/src/coreclr/vm/readytoruninfo.h +++ b/src/coreclr/vm/readytoruninfo.h @@ -66,7 +66,7 @@ class ReadyToRunInfo PTR_CORCOMPILE_IMPORT_SECTION m_pImportSections; DWORD m_nImportSections; - bool m_readyToRunCodeDisabled; + bool m_readyToRunCodeDisabled; // Is NativeFormat::NativeReader m_nativeReader; NativeFormat::NativeArray m_methodDefEntryPoints; @@ -125,7 +125,13 @@ class ReadyToRunInfo void DisableAllR2RCode() { LIMITED_METHOD_CONTRACT; - m_readyToRunCodeDisabled = TRUE; + m_readyToRunCodeDisabled = true; + } + + bool ReadyToRunCodeDisabled() + { + LIMITED_METHOD_CONTRACT; + return m_readyToRunCodeDisabled; } BOOL HasNonShareablePInvokeStubs() diff --git a/src/coreclr/vm/rejit.inl b/src/coreclr/vm/rejit.inl index f59c536af7893b..ad1d1f788644ac 100644 --- a/src/coreclr/vm/rejit.inl +++ b/src/coreclr/vm/rejit.inl @@ -28,7 +28,7 @@ inline BOOL ReJitManager::IsReJITEnabled() static bool profilerStartupRejit = CORProfilerEnableRejit() != FALSE; static ConfigDWORD rejitOnAttachEnabled; - return profilerStartupRejit || (rejitOnAttachEnabled.val(CLRConfig::EXTERNAL_ProfAPI_RejitOnAttach) != 0); + return profilerStartupRejit || ((rejitOnAttachEnabled.val(CLRConfig::EXTERNAL_ProfAPI_RejitOnAttach) != 0) && !g_pConfig->DefaultCodeVersioningDisabled()); } inline BOOL ReJitManager::IsReJITInlineTrackingEnabled() @@ -36,7 +36,7 @@ inline BOOL ReJitManager::IsReJITInlineTrackingEnabled() LIMITED_METHOD_CONTRACT; static ConfigDWORD rejitInliningEnabled; - return rejitInliningEnabled.val(CLRConfig::EXTERNAL_ProfAPI_RejitOnAttach) != 0; + return rejitInliningEnabled.val(CLRConfig::EXTERNAL_ProfAPI_RejitOnAttach) != 0 && !g_pConfig->DefaultCodeVersioningDisabled(); } #ifndef DACCESS_COMPILE diff --git a/src/coreclr/vm/stackwalk.cpp b/src/coreclr/vm/stackwalk.cpp index e61802b9849508..fc4a9642e530b1 100644 --- a/src/coreclr/vm/stackwalk.cpp +++ b/src/coreclr/vm/stackwalk.cpp @@ -697,6 +697,8 @@ PCODE Thread::VirtualUnwindNonLeafCallFrame(T_CONTEXT* pContext, KNONVOLATILE_CO return uControlPc; } +extern void* g_hostingApiReturnAddress; + // static UINT_PTR Thread::VirtualUnwindToFirstManagedCallFrame(T_CONTEXT* pContext) { @@ -739,8 +741,9 @@ UINT_PTR Thread::VirtualUnwindToFirstManagedCallFrame(T_CONTEXT* pContext) uControlPc = GetIP(pContext); - if (uControlPc == 0) + if ((uControlPc == 0) || (uControlPc == (PCODE)g_hostingApiReturnAddress)) { + uControlPc = 0; break; } #endif // !TARGET_UNIX diff --git a/src/coreclr/vm/syncblk.cpp b/src/coreclr/vm/syncblk.cpp index 1a2c9358bf1baa..b6e3f58bd21286 100644 --- a/src/coreclr/vm/syncblk.cpp +++ b/src/coreclr/vm/syncblk.cpp @@ -840,7 +840,7 @@ void SyncBlockCache::Grow() if (!(newSyncTableSize > m_SyncTableSize)) // Make sure we actually found room to grow! { - COMPlusThrowOM(); + EX_THROW(EEMessageException, (kOutOfMemoryException, IDS_EE_OUT_OF_SYNCBLOCKS)); } newSyncTable = new SyncTableEntry[newSyncTableSize]; diff --git a/src/coreclr/vm/syncblk.h b/src/coreclr/vm/syncblk.h index 3b79753069976e..2a7bfb34da5e04 100644 --- a/src/coreclr/vm/syncblk.h +++ b/src/coreclr/vm/syncblk.h @@ -621,6 +621,11 @@ class InteropSyncBlockInfo { LIMITED_METHOD_CONTRACT; ZeroMemory(this, sizeof(InteropSyncBlockInfo)); + +#if defined(FEATURE_COMWRAPPERS) + // The GC thread does enumerate these objects so add CRST_UNSAFE_COOPGC. + m_managedObjectComWrapperLock.Init(CrstManagedObjectWrapperMap, CRST_UNSAFE_COOPGC); +#endif // FEATURE_COMWRAPPERS } #ifndef DACCESS_COMPILE ~InteropSyncBlockInfo(); @@ -799,8 +804,6 @@ class InteropSyncBlockInfo if (FastInterlockCompareExchangePointer((ManagedObjectComWrapperByIdMap**)&m_managedObjectComWrapperMap, (ManagedObjectComWrapperByIdMap *)map, NULL) == NULL) { map.SuppressRelease(); - // The GC thread does enumerate these objects so add CRST_UNSAFE_COOPGC. - m_managedObjectComWrapperLock.Init(CrstManagedObjectWrapperMap, CRST_UNSAFE_COOPGC); } _ASSERTE(m_managedObjectComWrapperMap != NULL); diff --git a/src/coreclr/vm/threads.cpp b/src/coreclr/vm/threads.cpp index b38dc33185afbf..28446a25fc3b72 100644 --- a/src/coreclr/vm/threads.cpp +++ b/src/coreclr/vm/threads.cpp @@ -376,6 +376,10 @@ void SetThread(Thread* t) LIMITED_METHOD_CONTRACT gCurrentThreadInfo.m_pThread = t; + if (t != NULL) + { + EnsureTlsDestructionMonitor(); + } } void SetAppDomain(AppDomain* ad) @@ -1481,6 +1485,11 @@ Thread::Thread() m_fInteropDebuggingHijacked = FALSE; m_profilerCallbackState = 0; + for (int i = 0; i < MAX_NOTIFICATION_PROFILERS + 1; ++i) + { + m_dwProfilerEvacuationCounters[i] = 0; + } + m_pProfilerFilterContext = NULL; m_CacheStackBase = 0; diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h index f579984f7ba21c..acc23de0cbd015 100644 --- a/src/coreclr/vm/threads.h +++ b/src/coreclr/vm/threads.h @@ -3292,6 +3292,14 @@ class Thread static void __stdcall RedirectedHandledJITCaseForGCStress(); #endif // defined(HAVE_GCCOVER) && USE_REDIRECT_FOR_GCSTRESS +#ifdef TARGET_X86 + // RtlRestoreContext is available on x86, but relatively recently. + // RestoreContextSimulated uses SEH machinery for a similar result on legacy OS-es. + // This function should not be used on new OS-es as the pattern is not + // guaranteed to continue working in the future. + static void RestoreContextSimulated(Thread* pThread, CONTEXT* pCtx, void* pFrame, DWORD dwLastError); +#endif + friend void CPFH_AdjustContextForThreadSuspensionRace(T_CONTEXT *pContext, Thread *pThread); #endif // FEATURE_HIJACK && !TARGET_UNIX @@ -3667,6 +3675,16 @@ class Thread //--------------------------------------------------------------- DWORD m_profilerCallbackState; +#if defined(PROFILING_SUPPORTED) || defined(PROFILING_SUPPORTED_DATA) + //--------------------------------------------------------------- + // m_dwProfilerEvacuationCounters keeps track of how many profiler + // callback calls remain on the stack + //--------------------------------------------------------------- + // Why volatile? + // See code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization. + Volatile m_dwProfilerEvacuationCounters[MAX_NOTIFICATION_PROFILERS + 1]; +#endif // defined(PROFILING_SUPPORTED) || defined(PROFILING_SUPPORTED_DATA) + private: UINT32 m_workerThreadPoolCompletionCount; static UINT64 s_workerThreadPoolCompletionCountOverflow; @@ -3799,6 +3817,38 @@ class Thread m_pProfilerFilterContext = pContext; } +#ifdef PROFILING_SUPPORTED + FORCEINLINE DWORD GetProfilerEvacuationCounter(size_t slot) + { + LIMITED_METHOD_CONTRACT; + _ASSERTE(slot >= 0 && slot <= MAX_NOTIFICATION_PROFILERS); + return m_dwProfilerEvacuationCounters[slot]; + } + + FORCEINLINE void IncProfilerEvacuationCounter(size_t slot) + { + LIMITED_METHOD_CONTRACT; + _ASSERTE(slot >= 0 && slot <= MAX_NOTIFICATION_PROFILERS); +#ifdef _DEBUG + DWORD newValue = +#endif // _DEBUG + ++m_dwProfilerEvacuationCounters[slot]; + _ASSERTE(newValue != 0U); + } + + FORCEINLINE void DecProfilerEvacuationCounter(size_t slot) + { + LIMITED_METHOD_CONTRACT; + _ASSERTE(slot >= 0 && slot <= MAX_NOTIFICATION_PROFILERS); +#ifdef _DEBUG + DWORD newValue = +#endif // _DEBUG + --m_dwProfilerEvacuationCounters[slot]; + _ASSERTE(newValue != (DWORD)-1); + } + +#endif // PROFILING_SUPPORTED + // Used by the profiler API to find which flags have been set on the Thread object, // in order to authorize a profiler's call into ICorProfilerInfo(2). DWORD GetProfilerCallbackFullState() diff --git a/src/coreclr/vm/threadsuspend.cpp b/src/coreclr/vm/threadsuspend.cpp index 57318e29e898dc..b92af380085f03 100644 --- a/src/coreclr/vm/threadsuspend.cpp +++ b/src/coreclr/vm/threadsuspend.cpp @@ -1948,6 +1948,9 @@ typedef BOOL(WINAPI* PINITIALIZECONTEXT2)(PVOID Buffer, DWORD ContextFlags, PCON PINITIALIZECONTEXT2 pfnInitializeContext2 = NULL; #ifdef TARGET_X86 +typedef VOID(__cdecl* PRTLRESTORECONTEXT)(PCONTEXT ContextRecord, struct _EXCEPTION_RECORD* ExceptionRecord); +PRTLRESTORECONTEXT pfnRtlRestoreContext = NULL; + #define CONTEXT_COMPLETE (CONTEXT_FULL | CONTEXT_FLOATING_POINT | \ CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS | CONTEXT_EXCEPTION_REQUEST) #else @@ -1960,7 +1963,6 @@ CONTEXT* AllocateOSContextHelper(BYTE** contextBuffer) #if !defined(TARGET_UNIX) && (defined(TARGET_X86) || defined(TARGET_AMD64)) DWORD context = CONTEXT_COMPLETE; - BOOL supportsAVX = FALSE; if (pfnInitializeContext2 == NULL) { @@ -1968,13 +1970,20 @@ CONTEXT* AllocateOSContextHelper(BYTE** contextBuffer) pfnInitializeContext2 = (PINITIALIZECONTEXT2)GetProcAddress(hm, "InitializeContext2"); } - // Determine if the processor supports AVX so we could +#ifdef TARGET_X86 + if (pfnRtlRestoreContext == NULL) + { + HMODULE hm = GetModuleHandleW(_T("ntdll.dll")); + pfnRtlRestoreContext = (PRTLRESTORECONTEXT)GetProcAddress(hm, "RtlRestoreContext"); + } +#endif //TARGET_X86 + + // Determine if the processor supports AVX so we could // retrieve extended registers DWORD64 FeatureMask = GetEnabledXStateFeatures(); if ((FeatureMask & XSTATE_MASK_AVX) != 0) { context = context | CONTEXT_XSTATE; - supportsAVX = TRUE; } // Retrieve contextSize by passing NULL for Buffer @@ -1985,9 +1994,14 @@ CONTEXT* AllocateOSContextHelper(BYTE** contextBuffer) pfnInitializeContext2(NULL, context, NULL, &contextSize, xStateCompactionMask) : InitializeContext(NULL, context, NULL, &contextSize); - // The following assert is valid, but gets triggered in some Win7 runs with no impact on functionality. - // commenting this out to reduce noise, as long as Win7 is supported. - // _ASSERTE(!success && GetLastError() == ERROR_INSUFFICIENT_BUFFER); + // Spec mentions that we may get a different error (it was observed on Windows7). + // In such case the contextSize is undefined. + if (success || GetLastError() != ERROR_INSUFFICIENT_BUFFER) + { + STRESS_LOG2(LF_SYNC, LL_INFO1000, "AllocateOSContextHelper: Unexpected result from InitializeContext (success: %d, error: %d).\n", + success, GetLastError()); + return NULL; + } // So now allocate a buffer of that size and call InitializeContext again BYTE* buffer = new (nothrow)BYTE[contextSize]; @@ -1997,15 +2011,6 @@ CONTEXT* AllocateOSContextHelper(BYTE** contextBuffer) pfnInitializeContext2(buffer, context, &pOSContext, &contextSize, xStateCompactionMask): InitializeContext(buffer, context, &pOSContext, &contextSize); - // if AVX is supported set the appropriate features mask in the context - if (success && supportsAVX) - { - // This should not normally fail. - // The system silently ignores any feature specified in the FeatureMask - // which is not enabled on the processor. - success = SetXStateFeaturesMask(pOSContext, XSTATE_MASK_AVX); - } - if (!success) { delete[] buffer; @@ -2509,6 +2514,7 @@ void RedirectedThreadFrame::ExceptionUnwind() #ifndef TARGET_UNIX #ifdef TARGET_X86 + //**************************************************************************************** // This will check who caused the exception. If it was caused by the the redirect function, // the reason is to resume the thread back at the point it was redirected in the first @@ -2520,18 +2526,18 @@ void RedirectedThreadFrame::ExceptionUnwind() int RedirectedHandledJITCaseExceptionFilter( PEXCEPTION_POINTERS pExcepPtrs, // Exception data RedirectedThreadFrame *pFrame, // Frame on stack - BOOL fDone, // Whether redirect completed without exception - CONTEXT *pCtx) // Saved context + CONTEXT *pCtx, // Saved context + DWORD dwLastError) // saved last error { // !!! Do not use a non-static contract here. // !!! Contract may insert an exception handling record. // !!! This function assumes that GetCurrentSEHRecord() returns the exception record set up in - // !!! Thread::RedirectedHandledJITCase + // !!! Thread::RestoreContextSimulated // // !!! Do not use an object with dtor, since it injects a fs:0 entry. STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_MODE_ANY; + STATIC_CONTRACT_MODE_COOPERATIVE; if (pExcepPtrs->ExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW) { @@ -2540,44 +2546,22 @@ int RedirectedHandledJITCaseExceptionFilter( // Get the thread handle Thread *pThread = GetThread(); - - STRESS_LOG2(LF_SYNC, LL_INFO100, "In RedirectedHandledJITCaseExceptionFilter fDone = %d pFrame = %p\n", fDone, pFrame); - - // If we get here via COM+ exception, gc-mode is unknown. We need it to - // be cooperative for this function. - GCX_COOP_NO_DTOR(); - - // If the exception was due to the called client, then we need to figure out if it - // is an exception that can be eaten or if it needs to be handled elsewhere. - if (!fDone) - { - if (pExcepPtrs->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE) - { - return (EXCEPTION_CONTINUE_SEARCH); - } - - // Get the latest thrown object - OBJECTREF throwable = CLRException::GetThrowableFromExceptionRecord(pExcepPtrs->ExceptionRecord); - - // If this is an uncatchable exception, then let the exception be handled elsewhere - if (IsUncatchable(&throwable)) - { - pThread->EnablePreemptiveGC(); - return (EXCEPTION_CONTINUE_SEARCH); - } - } -#ifdef _DEBUG - else - { - _ASSERTE(pExcepPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_HIJACK); - } -#endif + STRESS_LOG1(LF_SYNC, LL_INFO100, "In RedirectedHandledJITCaseExceptionFilter pFrame = %p\n", pFrame); + _ASSERTE(pExcepPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_HIJACK); // Unlink the frame in preparation for resuming in managed code pFrame->Pop(); - // Copy the saved context record into the EH context; - ReplaceExceptionContextRecord(pExcepPtrs->ContextRecord, pCtx); + // Copy everything in the saved context record into the EH context. + // Historically the EH context has enough space for every enabled context feature. + // That may not hold for the future features beyond AVX, but this codepath is + // supposed to be used only on OSes that do not have RtlRestoreContext. + CONTEXT* pTarget = pExcepPtrs->ContextRecord; + if (!CopyContext(pTarget, pCtx->ContextFlags, pCtx)) + { + STRESS_LOG1(LF_SYNC, LL_ERROR, "ERROR: Could not set context record, lastError = 0x%x\n", GetLastError()); + EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); + } DWORD espValue = pCtx->Esp; @@ -2607,6 +2591,9 @@ int RedirectedHandledJITCaseExceptionFilter( // Register the special OS handler as the top handler with the OS SetCurrentSEHRecord(pCurSEH); + // restore last error + SetLastError(dwLastError); + // Resume execution at point where thread was originally redirected return (EXCEPTION_CONTINUE_EXECUTION); } @@ -2639,6 +2626,38 @@ extern "C" PCONTEXT __stdcall GetCurrentSavedRedirectContext() return pContext; } +#ifdef TARGET_X86 + +void Thread::RestoreContextSimulated(Thread* pThread, CONTEXT* pCtx, void* pFrame, DWORD dwLastError) +{ + pThread->HandleThreadAbort(); // Might throw an exception. + + // A counter to avoid a nasty case where an + // up-stack filter throws another exception + // causing our filter to be run again for + // some unrelated exception. + int filter_count = 0; + + __try + { + // Save the instruction pointer where we redirected last. This does not race with the check + // against this variable in HandledJitCase because the GC will not attempt to redirect the + // thread until the instruction pointer of this thread is back in managed code. + pThread->m_LastRedirectIP = GetIP(pCtx); + pThread->m_SpinCount = 0; + + RaiseException(EXCEPTION_HIJACK, 0, 0, NULL); + } + __except (++filter_count == 1 + ? RedirectedHandledJITCaseExceptionFilter(GetExceptionInformation(), (RedirectedThreadFrame*)pFrame, pCtx, dwLastError) + : EXCEPTION_CONTINUE_SEARCH) + { + _ASSERTE(!"Reached body of __except in Thread::RedirectedHandledJITCase"); + } +} + +#endif // TARGET_X86 + void __stdcall Thread::RedirectedHandledJITCase(RedirectReason reason) { STATIC_CONTRACT_THROWS; @@ -2662,140 +2681,106 @@ void __stdcall Thread::RedirectedHandledJITCase(RedirectReason reason) STRESS_LOG5(LF_SYNC, LL_INFO1000, "In RedirectedHandledJITcase reason 0x%x pFrame = %p pc = %p sp = %p fp = %p", reason, &frame, GetIP(pCtx), GetSP(pCtx), GetFP(pCtx)); -#ifdef TARGET_X86 - // This will indicate to the exception filter whether or not the exception is caused - // by us or the client. - BOOL fDone = FALSE; - int filter_count = 0; // A counter to avoid a nasty case where an - // up-stack filter throws another exception - // causing our filter to be run again for - // some unrelated exception. - - __try -#endif // TARGET_X86 - { - // Make sure this thread doesn't reuse the context memory. - pThread->MarkRedirectContextInUse(pCtx); + // Make sure this thread doesn't reuse the context memory. + pThread->MarkRedirectContextInUse(pCtx); - // Link in the frame - frame.Push(); + // Link in the frame + frame.Push(); #if defined(HAVE_GCCOVER) && defined(USE_REDIRECT_FOR_GCSTRESS) // GCCOVER - if (reason == RedirectReason_GCStress) - { - _ASSERTE(pThread->PreemptiveGCDisabledOther()); - DoGcStress(frame.GetContext(), NULL); - } - else + if (reason == RedirectReason_GCStress) + { + _ASSERTE(pThread->PreemptiveGCDisabledOther()); + DoGcStress(frame.GetContext(), NULL); + } + else #endif // HAVE_GCCOVER && USE_REDIRECT_FOR_GCSTRESS - { - // Enable PGC before calling out to the client to allow runtime suspend to finish - GCX_PREEMP_NO_DTOR(); + { + _ASSERTE(reason == RedirectReason_GCSuspension || + reason == RedirectReason_DebugSuspension || + reason == RedirectReason_UserSuspension); - // Notify the interface of the pending suspension - switch (reason) { - case RedirectReason_GCSuspension: - break; - case RedirectReason_DebugSuspension: - break; - case RedirectReason_UserSuspension: - // Do nothing; - break; - default: - _ASSERTE(!"Invalid redirect reason"); - break; - } + // Actual self-suspension. + // Leave and reenter COOP mode to be trapped on the way back. + GCX_PREEMP_NO_DTOR(); + GCX_PREEMP_NO_DTOR_END(); + } - // Disable preemptive GC so we can unlink the frame - GCX_PREEMP_NO_DTOR_END(); - } + // Once we get here the suspension is over! + // We will restore the state as it was at the point of redirection + // and continue normal execution. #ifdef TARGET_X86 - pThread->HandleThreadAbort(); // Might throw an exception. - - // Indicate that the call to the service went without an exception, and that - // we're raising our own exception to resume the thread to where it was - // redirected from - fDone = TRUE; - - // Save the instruction pointer where we redirected last. This does not race with the check - // against this variable in HandledJitCase because the GC will not attempt to redirect the - // thread until the instruction pointer of this thread is back in managed code. - pThread->m_LastRedirectIP = GetIP(pCtx); - pThread->m_SpinCount = 0; - - RaiseException(EXCEPTION_HIJACK, 0, 0, NULL); + if (!pfnRtlRestoreContext) + { + RestoreContextSimulated(pThread, pCtx, &frame, dwLastError); -#else // TARGET_X86 + // we never return to the caller. + __UNREACHABLE(); + } +#endif // TARGET_X86 #if defined(HAVE_GCCOVER) && defined(USE_REDIRECT_FOR_GCSTRESS) // GCCOVER - // - // If GCStress interrupts an IL stub or inlined p/invoke while it's running in preemptive mode, it switches the mode to - // cooperative - but we will resume to preemptive below. We should not trigger an abort in that case, as it will fail - // due to the GC mode. - // - if (!pThread->m_fPreemptiveGCDisabledForGCStress) + // + // If GCStress interrupts an IL stub or inlined p/invoke while it's running in preemptive mode, it switches the mode to + // cooperative - but we will resume to preemptive below. We should not trigger an abort in that case, as it will fail + // due to the GC mode. + // + if (!pThread->m_fPreemptiveGCDisabledForGCStress) #endif - { + { - UINT_PTR uAbortAddr; - UINT_PTR uResumePC = (UINT_PTR)GetIP(pCtx); - CopyOSContext(pThread->m_OSContext, pCtx); - uAbortAddr = (UINT_PTR)COMPlusCheckForAbort(); - if (uAbortAddr) - { - LOG((LF_EH, LL_INFO100, "thread abort in progress, resuming thread under control... (handled jit case)\n")); + UINT_PTR uAbortAddr; + UINT_PTR uResumePC = (UINT_PTR)GetIP(pCtx); + CopyOSContext(pThread->m_OSContext, pCtx); + uAbortAddr = (UINT_PTR)COMPlusCheckForAbort(); + if (uAbortAddr) + { + LOG((LF_EH, LL_INFO100, "thread abort in progress, resuming thread under control... (handled jit case)\n")); - CONSISTENCY_CHECK(CheckPointer(pCtx)); + CONSISTENCY_CHECK(CheckPointer(pCtx)); - STRESS_LOG1(LF_EH, LL_INFO10, "resume under control: ip: %p (handled jit case)\n", uResumePC); + STRESS_LOG1(LF_EH, LL_INFO10, "resume under control: ip: %p (handled jit case)\n", uResumePC); - SetIP(pThread->m_OSContext, uResumePC); + SetIP(pThread->m_OSContext, uResumePC); #if defined(TARGET_ARM) - // Save the original resume PC in Lr - pCtx->Lr = uResumePC; + // Save the original resume PC in Lr + pCtx->Lr = uResumePC; - // Since we have set a new IP, we have to clear conditional execution flags too. - ClearITState(pThread->m_OSContext); + // Since we have set a new IP, we have to clear conditional execution flags too. + ClearITState(pThread->m_OSContext); #endif // TARGET_ARM - SetIP(pCtx, uAbortAddr); - } + SetIP(pCtx, uAbortAddr); } + } - // Unlink the frame in preparation for resuming in managed code - frame.Pop(); + // Unlink the frame in preparation for resuming in managed code + frame.Pop(); - { - // Allow future use of the context - pThread->UnmarkRedirectContextInUse(pCtx); + // Allow future use of the context + pThread->UnmarkRedirectContextInUse(pCtx); #if defined(HAVE_GCCOVER) && defined(USE_REDIRECT_FOR_GCSTRESS) // GCCOVER - if (pThread->m_fPreemptiveGCDisabledForGCStress) - { - pThread->EnablePreemptiveGC(); - pThread->m_fPreemptiveGCDisabledForGCStress = false; - } + if (pThread->m_fPreemptiveGCDisabledForGCStress) + { + pThread->EnablePreemptiveGC(); + pThread->m_fPreemptiveGCDisabledForGCStress = false; + } #endif - LOG((LF_SYNC, LL_INFO1000, "Resuming execution with RtlRestoreContext\n")); - - SetLastError(dwLastError); // END_PRESERVE_LAST_ERROR + LOG((LF_SYNC, LL_INFO1000, "Resuming execution with RtlRestoreContext\n")); + SetLastError(dwLastError); // END_PRESERVE_LAST_ERROR - RtlRestoreContext(pCtx, NULL); - } -#endif // TARGET_X86 - } #ifdef TARGET_X86 - __except (++filter_count == 1 - ? RedirectedHandledJITCaseExceptionFilter(GetExceptionInformation(), &frame, fDone, pCtx) - : EXCEPTION_CONTINUE_SEARCH) - { - _ASSERTE(!"Reached body of __except in Thread::RedirectedHandledJITCase"); - } + pfnRtlRestoreContext(pCtx, NULL); +#else + RtlRestoreContext(pCtx, NULL); +#endif -#endif // TARGET_X86 + // we never return to the caller. + __UNREACHABLE(); } //**************************************************************************************** @@ -2898,14 +2883,34 @@ BOOL Thread::RedirectThreadAtHandledJITCase(PFN_REDIRECTTARGET pTgt) if (!pCtx) { pCtx = m_pSavedRedirectContext = ThreadStore::GrabOSContext(&m_pOSContextBuffer); - _ASSERTE(GetSavedRedirectContext() != NULL); } + // We may not have a preallocated context. Could be short on memory when we tried to preallocate. + // We cannot allocate here since we have a thread stopped in a random place, possibly holding locks + // that we would need while allocating. + // Other ways and attempts at suspending may yet succeed, but this redirection cannot continue. + if (!pCtx) + return (FALSE); + ////////////////////////////////////// // Get and save the thread's context + BOOL bRes = true; // Always get complete context, pCtx->ContextFlags are set during Initialization - BOOL bRes = EEGetThreadContext(this, pCtx); + +#if defined(TARGET_X86) || defined(TARGET_AMD64) + // Scenarios like GC stress may indirectly disable XState features in the pCtx + // depending on the state at the time of GC stress interrupt. + // + // Make sure that AVX feature mask is set, if supported. + // + // This should not normally fail. + // The system silently ignores any feature specified in the FeatureMask + // which is not enabled on the processor. + bRes &= SetXStateFeaturesMask(pCtx, XSTATE_MASK_AVX); +#endif //defined(TARGET_X86) || defined(TARGET_AMD64) + + bRes &= EEGetThreadContext(this, pCtx); _ASSERTE(bRes && "Failed to GetThreadContext in RedirectThreadAtHandledJITCase - aborting redirect."); if (!bRes) @@ -3020,8 +3025,35 @@ BOOL Thread::RedirectCurrentThreadAtHandledJITCase(PFN_REDIRECTTARGET pTgt, CONT ////////////////////////////////////// // Get and save the thread's context - BOOL success = CopyContext(pCtx, pCtx->ContextFlags, pCurrentThreadCtx); + BOOL success = TRUE; + +#if defined(TARGET_X86) || defined(TARGET_AMD64) + // This method is called for GC stress interrupts in managed code. + // The current context may have various XState features, depending on what is used/dirty, + // but only AVX feature may contain live data. (that could change with new features in JIT) + // Besides pCtx may not have space to store other features. + // So we will mask out everything but AVX. + DWORD64 srcFeatures = 0; + success = GetXStateFeaturesMask(pCurrentThreadCtx, &srcFeatures); _ASSERTE(success); + if (!success) + return FALSE; + + // Get may return 0 if no XState is set, which Set would not accept. + if (srcFeatures != 0) + { + success = SetXStateFeaturesMask(pCurrentThreadCtx, srcFeatures & XSTATE_MASK_AVX); + _ASSERTE(success); + if (!success) + return FALSE; + } + +#endif //defined(TARGET_X86) || defined(TARGET_AMD64) + + success = CopyContext(pCtx, pCtx->ContextFlags, pCurrentThreadCtx); + _ASSERTE(success); + if (!success) + return FALSE; // Ensure that this flag is set for the next time through the normal path, // RedirectThreadAtHandledJITCase. diff --git a/src/coreclr/vm/tieredcompilation.cpp b/src/coreclr/vm/tieredcompilation.cpp index 9adb2ca09785e0..6b3915702618f8 100644 --- a/src/coreclr/vm/tieredcompilation.cpp +++ b/src/coreclr/vm/tieredcompilation.cpp @@ -599,10 +599,17 @@ bool TieredCompilationManager::TryDeactivateTieringDelay() continue; } + PCODE codeEntryPoint = activeCodeVersion.GetNativeCode(); + if (codeEntryPoint == NULL) + { + // The active IL/native code version has changed since the method was queued, and the currently active version + // doesn't have a code entry point yet + continue; + } + EX_TRY { - bool wasSet = - CallCountingManager::SetCodeEntryPoint(activeCodeVersion, activeCodeVersion.GetNativeCode(), false, nullptr); + bool wasSet = CallCountingManager::SetCodeEntryPoint(activeCodeVersion, codeEntryPoint, false, nullptr); _ASSERTE(wasSet); } EX_CATCH diff --git a/src/coreclr/vm/vars.cpp b/src/coreclr/vm/vars.cpp index 5004599bc779c6..c57ff967c89d97 100644 --- a/src/coreclr/vm/vars.cpp +++ b/src/coreclr/vm/vars.cpp @@ -110,6 +110,8 @@ GVAL_IMPL_INIT(DWORD, g_debuggerWordTLSIndex, TLS_OUT_OF_INDEXES); #endif GVAL_IMPL_INIT(DWORD, g_TlsIndex, TLS_OUT_OF_INDEXES); +GVAL_IMPL_INIT(PTR_WSTR, g_EntryAssemblyPath, NULL); + #ifndef DACCESS_COMPILE // @TODO - PROMOTE. diff --git a/src/coreclr/vm/vars.hpp b/src/coreclr/vm/vars.hpp index 9400fd130132f6..4d0784bf313774 100644 --- a/src/coreclr/vm/vars.hpp +++ b/src/coreclr/vm/vars.hpp @@ -157,6 +157,8 @@ class OBJECTREF { }; public: + enum class tagVolatileLoadWithoutBarrier { tag }; + //------------------------------------------------------------- // Default constructor, for non-initializing declarations: // @@ -169,6 +171,12 @@ class OBJECTREF { //------------------------------------------------------------- OBJECTREF(const OBJECTREF & objref); + //------------------------------------------------------------- + // Copy constructor, for passing OBJECTREF's as function arguments + // using a volatile without barrier load + //------------------------------------------------------------- + OBJECTREF(const OBJECTREF * pObjref, tagVolatileLoadWithoutBarrier tag); + //------------------------------------------------------------- // To allow NULL to be used as an OBJECTREF. //------------------------------------------------------------- @@ -302,6 +310,7 @@ class REF : public OBJECTREF #define OBJECTREFToObject(objref) ((objref).operator-> ()) #define ObjectToSTRINGREF(obj) (STRINGREF(obj)) #define STRINGREFToObject(objref) (*( (StringObject**) &(objref) )) +#define VolatileLoadWithoutBarrierOBJECTREF(pObj) (OBJECTREF(pObj, OBJECTREF::tagVolatileLoadWithoutBarrier::tag)) // the while (0) syntax below is to force a trailing semicolon on users of the macro #define VALIDATEOBJECT(obj) do {if ((obj) != NULL) (obj)->Validate();} while (0) @@ -316,6 +325,7 @@ class REF : public OBJECTREF #define OBJECTREFToObject(objref) ((PTR_Object) (objref)) #define ObjectToSTRINGREF(obj) ((PTR_StringObject) (obj)) #define STRINGREFToObject(objref) ((PTR_StringObject) (objref)) +#define VolatileLoadWithoutBarrierOBJECTREF(pObj) VolatileLoadWithoutBarrier(pObj) #endif // _DEBUG_IMPL @@ -391,6 +401,9 @@ GVAL_DECL(DWORD, g_debuggerWordTLSIndex); #endif GVAL_DECL(DWORD, g_TlsIndex); +// Full path to the managed entry assembly - stored for ease of identifying the entry asssembly for diagnostics +GVAL_DECL(PTR_WSTR, g_EntryAssemblyPath); + // Global System Information extern SYSTEM_INFO g_SystemInfo; diff --git a/src/coreclr/vm/weakreferencenative.cpp b/src/coreclr/vm/weakreferencenative.cpp index ab2b6f9887c46e..c61467b8cf111e 100644 --- a/src/coreclr/vm/weakreferencenative.cpp +++ b/src/coreclr/vm/weakreferencenative.cpp @@ -108,6 +108,7 @@ struct WeakHandleSpinLockHolder // // In order to qualify to be used with a HNDTYPE_WEAK_NATIVE_COM, the incoming object must: // * be an RCW +// * not be an aggregated RCW // * respond to a QI for IWeakReferenceSource // * succeed when asked for an IWeakReference* // @@ -149,7 +150,14 @@ NativeComWeakHandleInfo* GetComWeakReferenceInfo(OBJECTREF* pObject) #endif { #ifdef FEATURE_COMWRAPPERS - pWeakReferenceSource = reinterpret_cast(ComWrappersNative::GetIdentityForObject(pObject, IID_IWeakReferenceSource, &wrapperId)); + bool isAggregated = false; + pWeakReferenceSource = reinterpret_cast(ComWrappersNative::GetIdentityForObject(pObject, IID_IWeakReferenceSource, &wrapperId, &isAggregated)); + if (isAggregated) + { + // If the RCW is an aggregated RCW, then the managed object cannot be recreated from the IUnknown as the outer IUnknown wraps the managed object. + // In this case, don't create a weak reference backed by a COM weak reference. + pWeakReferenceSource = nullptr; + } #endif } @@ -448,7 +456,7 @@ FCIMPL3(void, WeakReferenceNative::Create, WeakReferenceObject * pThisUNSAFE, Ob _ASSERTE(gc.pThis->GetMethodTable()->CanCastToClass(pWeakReferenceMT)); // Create the handle. -#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS) +#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS) NativeComWeakHandleInfo *comWeakHandleInfo = nullptr; if (gc.pTarget != NULL) { @@ -690,7 +698,7 @@ FCIMPL1(Object *, WeakReferenceNative::GetTarget, WeakReferenceObject * pThisUNS OBJECTREF pTarget = GetWeakReferenceTarget(pThis); -#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS) +#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS) // If we found an object, or we're not a native COM weak reference, then we're done. Othewrise // we can try to create a new RCW to the underlying native COM object if it's still alive. if (pTarget != NULL || !IsNativeComWeakReferenceHandle(pThis->m_Handle)) @@ -718,7 +726,7 @@ FCIMPL1(Object *, WeakReferenceOfTNative::GetTarget, WeakReferenceObject * pThis OBJECTREF pTarget = GetWeakReferenceTarget(pThis); -#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS) +#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS) // If we found an object, or we're not a native COM weak reference, then we're done. Othewrise // we can try to create a new RCW to the underlying native COM object if it's still alive. if (pTarget != NULL || !IsNativeComWeakReferenceHandle(pThis->m_Handle)) diff --git a/src/coreclr/vm/win32threadpool.cpp b/src/coreclr/vm/win32threadpool.cpp index 4f8646d73fa73a..1c8f26fa75f14b 100644 --- a/src/coreclr/vm/win32threadpool.cpp +++ b/src/coreclr/vm/win32threadpool.cpp @@ -126,6 +126,10 @@ SVAL_IMPL(ThreadpoolMgr::LIST_ENTRY,ThreadpoolMgr,TimerQueue); // queue of time unsigned int ThreadpoolMgr::LastCPThreadCreation=0; // last time a completion port thread was created unsigned int ThreadpoolMgr::NumberOfProcessors; // = NumberOfWorkerThreads - no. of blocked threads +DWORD ThreadpoolMgr::WorkerThreadTimeoutMs = 20 * 1000; +DWORD ThreadpoolMgr::IOCompletionThreadTimeoutMs = 15 * 1000; +int ThreadpoolMgr::NumWorkerThreadsBeingKeptAlive = 0; +int ThreadpoolMgr::NumIOCompletionThreadsBeingKeptAlive = 0; CrstStatic ThreadpoolMgr::WorkerCriticalSection; CLREvent * ThreadpoolMgr::RetiredCPWakeupEvent; // wakeup event for completion port threads @@ -354,6 +358,13 @@ BOOL ThreadpoolMgr::Initialize() NumberOfProcessors = GetCurrentProcessCpuCount(); InitPlatformVariables(); + int threadTimeoutMs = g_pConfig->ThreadPoolThreadTimeoutMs(); + if (threadTimeoutMs >= -1) + { + WorkerThreadTimeoutMs = (DWORD)threadTimeoutMs; + IOCompletionThreadTimeoutMs = (DWORD)threadTimeoutMs; + } + EX_TRY { if (!UsePortableThreadPool()) @@ -1809,6 +1820,9 @@ DWORD WINAPI ThreadpoolMgr::WorkerThreadStart(LPVOID lpArgs) ThreadCounter::Counts counts, oldCounts, newCounts; bool foundWork = true, wasNotRecalled = true; + bool isThreadKeepAliveInitialized = false; + bool keepThreadAlive = false; + counts = WorkerCounter.GetCleanCounts(); if (ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context, ThreadPoolWorkerThreadStart)) FireEtwThreadPoolWorkerThreadStart(counts.NumActive, counts.NumRetired, GetClrInstanceId()); @@ -1865,6 +1879,35 @@ DWORD WINAPI ThreadpoolMgr::WorkerThreadStart(LPVOID lpArgs) GCX_PREEMP_NO_DTOR(); _ASSERTE(pThread == NULL || !pThread->PreemptiveGCDisabled()); + if (!isThreadKeepAliveInitialized && fThreadInit) + { + // Determine whether to keep this thread alive. Some threads may always be kept alive based on config. + isThreadKeepAliveInitialized = true; + int threadsToKeepAlive = g_pConfig->ThreadPoolThreadsToKeepAlive(); + if (threadsToKeepAlive != 0) + { + if (threadsToKeepAlive < 0) + { + keepThreadAlive = true; + } + else + { + int count = VolatileLoadWithoutBarrier(&NumWorkerThreadsBeingKeptAlive); + while (count < threadsToKeepAlive) + { + int countBeforeUpdate = InterlockedCompareExchangeT(&NumWorkerThreadsBeingKeptAlive, count + 1, count); + if (countBeforeUpdate == count) + { + keepThreadAlive = true; + break; + } + + count = countBeforeUpdate; + } + } + } + } + // make sure there's really work. If not, go back to sleep // counts volatile read paired with CompareExchangeCounts loop set @@ -1951,7 +1994,7 @@ DWORD WINAPI ThreadpoolMgr::WorkerThreadStart(LPVOID lpArgs) while (true) { RetryRetire: - if (RetiredWorkerSemaphore->Wait(WorkerTimeout)) + if (RetiredWorkerSemaphore->Wait(keepThreadAlive ? INFINITE : WorkerThreadTimeoutMs)) { foundWork = true; @@ -2028,7 +2071,7 @@ DWORD WINAPI ThreadpoolMgr::WorkerThreadStart(LPVOID lpArgs) FireEtwThreadPoolWorkerThreadWait(counts.NumActive, counts.NumRetired, GetClrInstanceId()); RetryWaitForWork: - if (WorkerSemaphore->Wait(WorkerTimeout, WorkerThreadSpinLimit, NumberOfProcessors)) + if (WorkerSemaphore->Wait(keepThreadAlive ? INFINITE : WorkerThreadTimeoutMs, WorkerThreadSpinLimit, NumberOfProcessors)) { foundWork = true; goto Work; @@ -3153,13 +3196,13 @@ DWORD WINAPI ThreadpoolMgr::CompletionPortThreadStart(LPVOID lpArgs) PIOCompletionContext context; BOOL fIsCompletionContext; - const DWORD CP_THREAD_WAIT = 15000; /* milliseconds */ - _ASSERTE(GlobalCompletionPort != NULL); BOOL fThreadInit = FALSE; Thread *pThread = NULL; + bool isThreadKeepAliveInitialized = false; + bool keepThreadAlive = false; DWORD cpThreadWait = 0; if (g_fEEStarted) { @@ -3196,7 +3239,7 @@ DWORD WINAPI ThreadpoolMgr::CompletionPortThreadStart(LPVOID lpArgs) ThreadCounter::Counts oldCounts; ThreadCounter::Counts newCounts; - cpThreadWait = CP_THREAD_WAIT; + cpThreadWait = IOCompletionThreadTimeoutMs; for (;; ) { Top: @@ -3224,6 +3267,36 @@ DWORD WINAPI ThreadpoolMgr::CompletionPortThreadStart(LPVOID lpArgs) GCX_PREEMP_NO_DTOR(); + if (!isThreadKeepAliveInitialized && fThreadInit) + { + // Determine whether to keep this thread alive. Some threads may always be kept alive based on config. + isThreadKeepAliveInitialized = true; + int threadsToKeepAlive = g_pConfig->ThreadPoolThreadsToKeepAlive(); + if (threadsToKeepAlive != 0) + { + if (threadsToKeepAlive < 0) + { + keepThreadAlive = true; + } + else + { + int count = VolatileLoadWithoutBarrier(&NumIOCompletionThreadsBeingKeptAlive); + while (count < threadsToKeepAlive) + { + int countBeforeUpdate = + InterlockedCompareExchangeT(&NumIOCompletionThreadsBeingKeptAlive, count + 1, count); + if (countBeforeUpdate == count) + { + keepThreadAlive = true; + break; + } + + count = countBeforeUpdate; + } + } + } + } + // // We're about to wait on the IOCP; mark ourselves as no longer "working." // @@ -3238,7 +3311,7 @@ DWORD WINAPI ThreadpoolMgr::CompletionPortThreadStart(LPVOID lpArgs) // one thread listening for completions. So there's no point in having a timeout; it will // only use power unnecessarily. // - cpThreadWait = (newCounts.NumActive == 1) ? INFINITE : CP_THREAD_WAIT; + cpThreadWait = (newCounts.NumActive == 1 || keepThreadAlive) ? INFINITE : IOCompletionThreadTimeoutMs; if (oldCounts == CPThreadCounter.CompareExchangeCounts(newCounts, oldCounts)) break; @@ -4023,6 +4096,51 @@ DWORD WINAPI ThreadpoolMgr::GateThreadStart(LPVOID lpArgs) // CPU usage statistics int elementsNeeded = NumberOfProcessors > g_SystemInfo.dwNumberOfProcessors ? NumberOfProcessors : g_SystemInfo.dwNumberOfProcessors; + + // + // When CLR threads are not using all groups, GetCPUBusyTime_NT will read element X from + // the "prevCPUInfo.usageBuffer" array if and only if "prevCPUInfo.affinityMask" contains a + // set bit in bit position X. This implies that GetCPUBusyTime_NT would read past the end + // of the "usageBuffer" array if the index of the highest set bit in "affinityMask" was + // ever larger than the index of the last array element. + // + // If necessary, expand "elementsNeeded" to ensure that the index of the last array element + // is always at least as large as the index of the highest set bit in the "affinityMask". + // + // This expansion is necessary in any case where the mask returned by GetCurrentProcessCpuMask + // (which is just a wrapper around the Win32 GetProcessAffinityMask API) contains set bits + // at indices greater than or equal to the larger of the basline CPU count values (i.e., + // ThreadpoolMgr::NumberOfProcessors and g_SystemInfo.dwNumberOfProcessors) that were + // captured earlier on (during ThreadpoolMgr::Initialize and during EEStartupHelper, + // respectively). Note that in the relevant scenario (i.e., when CLR threads are not using + // all groups) the mask and CPU counts are all collected via "group-unaware" APIs and are + // all "group-local" values as a result. + // + // Expansion is necessary in at least the following cases: + // + // - If the baseline CPU counts were captured while running in groups that contain fewer + // CPUs (in a multi-group system with heterogenous CPU counts across groups), but this code + // is now running in a group that contains a larger number of CPUs. + // + // - If CPUs were hot-added to the system and then added to the current process affinity + // mask at some point after the baseline CPU counts were captured. + // + if (!CPUGroupInfo::CanEnableThreadUseAllCpuGroups()) + { + int elementsNeededToCoverMask = 0; + DWORD_PTR remainingMask = prevCPUInfo.affinityMask; + while (remainingMask != 0) + { + elementsNeededToCoverMask++; + remainingMask >>= 1; + } + + if (elementsNeeded < elementsNeededToCoverMask) + { + elementsNeeded = elementsNeededToCoverMask; + } + } + if (!ClrSafeInt::multiply(elementsNeeded, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION), prevCPUInfo.usageBufferSize)) return 0; diff --git a/src/coreclr/vm/win32threadpool.h b/src/coreclr/vm/win32threadpool.h index 4f3397821ded49..77f245c7fd998f 100644 --- a/src/coreclr/vm/win32threadpool.h +++ b/src/coreclr/vm/win32threadpool.h @@ -752,17 +752,23 @@ class ThreadpoolMgr #ifndef TARGET_UNIX if (CPUGroupInfo::CanEnableThreadUseAllCpuGroups()) - processorNumber = CPUGroupInfo::CalculateCurrentProcessorNumber(); + { + // The current processor number may not be within the total number of active processors determined at + // initialization time. + processorNumber = CPUGroupInfo::CalculateCurrentProcessorNumber() % CPUGroupInfo::GetNumActiveProcessors(); + } else + { // Turns out GetCurrentProcessorNumber can return a value greater than the number of processors reported by // GetSystemInfo, if we're running in WOW64 on a machine with >32 processors. - processorNumber = GetCurrentProcessorNumber()%NumberOfProcessors; + processorNumber = GetCurrentProcessorNumber() % g_SystemInfo.dwNumberOfProcessors; + } #else // !TARGET_UNIX if (PAL_HasGetCurrentProcessorNumber()) { // On linux, GetCurrentProcessorNumber which uses sched_getcpu() can return a value greater than the number // of processors reported by sysconf(_SC_NPROCESSORS_ONLN) when using OpenVZ kernel. - processorNumber = GetCurrentProcessorNumber()%NumberOfProcessors; + processorNumber = GetCurrentProcessorNumber() % PAL_GetTotalCpuCount(); } #endif // !TARGET_UNIX return pRecycledListPerProcessor[processorNumber][memType]; @@ -1049,6 +1055,11 @@ class ThreadpoolMgr static unsigned int LastCPThreadCreation; // last time a completion port thread was created static unsigned int NumberOfProcessors; // = NumberOfWorkerThreads - no. of blocked threads + static DWORD WorkerThreadTimeoutMs; + static DWORD IOCompletionThreadTimeoutMs; + static int NumWorkerThreadsBeingKeptAlive; + static int NumIOCompletionThreadsBeingKeptAlive; + static BOOL IsApcPendingOnWaitThread; // Indicates if an APC is pending on the wait thread // This needs to be non-hosted, because worker threads can run prior to EE startup. @@ -1058,8 +1069,6 @@ class ThreadpoolMgr static CrstStatic WorkerCriticalSection; private: - static const DWORD WorkerTimeout = 20 * 1000; - DECLSPEC_ALIGN(MAX_CACHE_LINE_SIZE) SVAL_DECL(ThreadCounter,WorkerCounter); // diff --git a/src/installer/Directory.Build.targets b/src/installer/Directory.Build.targets index c6e8cf1a140291..dccb8277ba7674 100644 --- a/src/installer/Directory.Build.targets +++ b/src/installer/Directory.Build.targets @@ -15,5 +15,5 @@ - + diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index 2d3f6566a5ad5c..6f9c742c882574 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -57,7 +57,7 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer throw new ArgumentException($"Invalid input: Unsupported Target Framework Version {targetFrameworkVersion}"); } - if (IsLinux && Arch == Architecture.Arm64) + if (Arch == Architecture.Arm64) { // We align assemblies in the bundle at 4K so that we can use mmap on Linux without changing the page alignment of ARM64 R2R code. // This is only necessary for R2R assemblies, but we do it for all assemblies for simplicity. diff --git a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj index 64ac366ee39023..49cea05ae7d822 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj +++ b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj @@ -4,7 +4,7 @@ netstandard2.0 Abstractions for modifying .NET host binaries false - true + true true true true @@ -15,7 +15,6 @@ MicrosoftAspNetCore true - Microsoft.Net.HostModel.PGO diff --git a/src/installer/pkg/Directory.Build.props b/src/installer/pkg/Directory.Build.props index 10f36b399c73b6..f51718676368a2 100644 --- a/src/installer/pkg/Directory.Build.props +++ b/src/installer/pkg/Directory.Build.props @@ -3,7 +3,6 @@ $(TargetArchitecture) - $(ArtifactsBinDir)$(OutputRid).$(Configuration)\corehost diff --git a/src/installer/pkg/THIRD-PARTY-NOTICES.TXT b/src/installer/pkg/THIRD-PARTY-NOTICES.TXT index 445eab67c7ff77..f9fae685f9cf00 100644 --- a/src/installer/pkg/THIRD-PARTY-NOTICES.TXT +++ b/src/installer/pkg/THIRD-PARTY-NOTICES.TXT @@ -875,8 +875,103 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +License notice for musl +----------------------- + +musl as a whole is licensed under the following standard MIT license: + +Copyright © 2005-2020 Rich Felker, et al. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License notice for "Faster Unsigned Division by Constants" +---------------------------------------------------------- + +Reference implementations of computing and using the "magic number" approach to dividing +by constants, including codegen instructions. The unsigned division incorporates the +"round down" optimization per ridiculous_fish. + +This is free and unencumbered software. Any copyright is dedicated to the Public Domain. + +License notice for mimalloc +--------------------------- + +MIT License + +Copyright (c) 2019 Microsoft Corporation, Daan Leijen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +License notice for Apple header files +------------------------------------- + +Copyright (c) 1980, 1986, 1993 + The Regents of the University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the University of + California, Berkeley and its contributors. +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + License notice for Angular v8.0 --------------------------------------------- +-------------------------------- + The MIT License (MIT) ===================== @@ -900,8 +995,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -License notice for corefx - License notice for BedrockFramework =================================== @@ -1211,3 +1304,172 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +License for fastmod (https://github.com/lemire/fastmod) and ibm-fpgen (https://github.com/nigeltao/parse-number-fxx-test-data) +-------------------------------------- + + Copyright 2018 Daniel Lemire + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +License notice for JavaScript queues +------------------------------------- + +CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. + +Statement of Purpose +The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). +Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. +For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: +the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; +moral rights retained by the original author(s) and/or performer(s); +publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; +rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; +rights protecting the extraction, dissemination, use and reuse of data in a Work; +database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and +other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. +2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. +3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. +4. Limitations and Disclaimers. +a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. +b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. +c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. +d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. + +License notice for MSBuild Locator +------------------------------------- + +https://github.com/Microsoft/MSBuildLocator + +Copyright (c) 2018 .NET Foundation and Contributors + +This software is licensed subject to the MIT license, available at +https://opensource.org/licenses/MIT + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License notice for Newtonsoft.Json +=================================== + +The MIT License (MIT) + +Copyright (c) 2007 James Newton-King + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License notice for NuGet.Client +------------------------------- + +In reference to: https://github.com/dotnet/templating/blob/main/build/nuget.exe + +https://github.com/NuGet/NuGet.Client/blob/dev/LICENSE.txt + +Copyright (c) .NET Foundation. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +these files except in compliance with the License. You may obtain a copy of the +License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed +under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. + +License notice for Roslyn Clr Heap Allocation Analyzer +------------------------------------- + +https://github.com/Microsoft/RoslynClrHeapAllocationAnalyzer + +Copyright (c) 2018 Microsoft Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +License notice for StyleCop Analyzers +------------------------------------- + +The MIT License (MIT) + +Copyright (c) Tunnel Vision Laboratories, LLC + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +License notice for corefx +------------------------------------- + +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/installer/pkg/projects/Directory.Build.targets b/src/installer/pkg/projects/Directory.Build.targets index 095938d03a4f84..f985295d2cd28d 100644 --- a/src/installer/pkg/projects/Directory.Build.targets +++ b/src/installer/pkg/projects/Directory.Build.targets @@ -6,6 +6,14 @@ Needs to happen in Directory.Build.targets to allow all the pkgproj's to set Version property first. --> $(Version) + + + $(PackageOutputPath) + + + <_Crossgen2SymbolFilesToPackage Include="@(Reference->'$(CoreCLRArtifactsPath)PDB\%(FileName).pdb')" /> + + <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPdbDir)%(FileName).pdb')" Condition="'$(TargetOS)' == 'windows' and '%(FileName)' != 'crossgen2'" /> + <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPath)%(FileName)%(Extension)$(SymbolsSuffix)')" Condition="'$(TargetOS)' != 'windows' and '%(FileName)' != 'crossgen2'" /> + <_Crossgen2SymbolFilesToPackage Remove="@(_Crossgen2SymbolFilesToPackage)" Condition="!Exists('%(Identity)')" /> + + <_SymbolFilesToPackage Include="@(_Crossgen2SymbolFilesToPackage)" TargetPath="tools/" /> + + + <_diaSymTargetArch>$(TargetArchitecture) diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Host.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Host.sfxproj index f32e7eb5e853bc..b0b9f8050273f1 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Host.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Host.sfxproj @@ -8,7 +8,7 @@ dotnet-apphost-pack dotnet-apphost-pack NetCore.AppHostPack - $(SharedFrameworkName).PGO + false - + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Ref.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Ref.sfxproj index f1e52a78e99c12..96f62091b66e25 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Ref.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Ref.sfxproj @@ -4,9 +4,10 @@ TargetingPack true + false dotnet-targeting-pack dotnet-targeting-pack - $(SharedFrameworkName).PGO + false NetCore.TargetingPack A set of .NET APIs that are included in the default .NET application model. Contains reference assemblies, documentation, and other design-time assets. @@ -19,4 +20,8 @@ + + + + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj index a3f364815d63c4..7d5a874a8547d1 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj @@ -7,7 +7,7 @@ dotnet-runtime-internal-composite $(SharedFrameworkName).Composite $(SharedFrameworkName).Composite.PGO - true + true dotnet-runtime-composite-symbols true true diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props index 87aaf9d263ced2..8bb473d3aa682d 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props @@ -45,6 +45,7 @@ + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj index 4fa48f4e0c96cc..d44ff729b3a1f7 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj @@ -7,8 +7,8 @@ dotnet-runtime-internal dotnet-runtime dotnet-runtime-internal - $(SharedFrameworkName).PGO - true + true + false dotnet-runtime-symbols NetCore.SharedFramework true diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/PlatformManifest.txt b/src/installer/pkg/sfx/Microsoft.NETCore.App/PlatformManifest.txt new file mode 100644 index 00000000000000..981251ae96d2bf --- /dev/null +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/PlatformManifest.txt @@ -0,0 +1,338 @@ +System.Globalization.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Globalization.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +System.IO.Compression.Native.a|Microsoft.NETCore.App.Ref||0.0.0.0 +System.IO.Compression.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +System.IO.Compression.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Native.a|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Net.Http.Native.a|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Net.Http.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Net.Http.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Net.Security.Native.a|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Net.Security.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Net.Security.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Security.Cryptography.Native.Apple.a|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Security.Cryptography.Native.Apple.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Security.Cryptography.Native.OpenSsl.a|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Security.Cryptography.Native.OpenSsl.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Security.Cryptography.Native.OpenSsl.so|Microsoft.NETCore.App.Ref||0.0.0.0 +clrcompression.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +Microsoft.CSharp.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +Microsoft.VisualBasic.Core.dll|Microsoft.NETCore.App.Ref|11.0.0.0|6.0.21.52210 +Microsoft.Win32.Primitives.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +Microsoft.Win32.Registry.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.AppContext.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Buffers.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Collections.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Collections.Concurrent.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Collections.Immutable.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Collections.NonGeneric.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Collections.Specialized.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.ComponentModel.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.ComponentModel.Annotations.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.ComponentModel.EventBasedAsync.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.ComponentModel.Primitives.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.ComponentModel.TypeConverter.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Console.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Data.Common.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Data.DataSetExtensions.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Diagnostics.Contracts.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Diagnostics.Debug.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Diagnostics.DiagnosticSource.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Diagnostics.FileVersionInfo.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Diagnostics.Process.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Diagnostics.StackTrace.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Diagnostics.TextWriterTraceListener.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Diagnostics.Tools.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Diagnostics.TraceSource.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Diagnostics.Tracing.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Drawing.Primitives.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Dynamic.Runtime.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Formats.Asn1.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Globalization.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Globalization.Calendars.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Globalization.Extensions.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.Compression.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.Compression.Brotli.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.Compression.ZipFile.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.FileSystem.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.FileSystem.AccessControl.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.FileSystem.DriveInfo.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.FileSystem.Primitives.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.FileSystem.Watcher.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.IsolatedStorage.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.MemoryMappedFiles.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.Pipes.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.Pipes.AccessControl.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.IO.UnmanagedMemoryStream.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Linq.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Linq.Expressions.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Linq.Parallel.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Linq.Queryable.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Memory.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.Http.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.Http.Json.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.HttpListener.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.Mail.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.NameResolution.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.NetworkInformation.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.Ping.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.Primitives.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.Quic.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.Requests.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.Security.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.ServicePoint.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.Sockets.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.WebClient.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.WebHeaderCollection.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.WebProxy.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.WebSockets.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Net.WebSockets.Client.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Numerics.Vectors.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.ObjectModel.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Private.DataContractSerialization.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Private.Runtime.InteropServices.JavaScript.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Private.Uri.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Private.Xml.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Private.Xml.Linq.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Reflection.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Reflection.DispatchProxy.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Reflection.Emit.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Reflection.Emit.ILGeneration.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Reflection.Emit.Lightweight.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Reflection.Extensions.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Reflection.Metadata.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Reflection.Primitives.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Reflection.TypeExtensions.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Resources.Reader.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Resources.ResourceManager.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Resources.Writer.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.CompilerServices.Unsafe.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.CompilerServices.VisualC.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.Extensions.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.Handles.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.InteropServices.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.InteropServices.RuntimeInformation.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.Intrinsics.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.Loader.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.Numerics.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.Serialization.Formatters.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.Serialization.Json.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.Serialization.Primitives.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Runtime.Serialization.Xml.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.AccessControl.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Claims.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Cryptography.Algorithms.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Cryptography.Cng.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Cryptography.Csp.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Cryptography.Encoding.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Cryptography.OpenSsl.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Cryptography.Primitives.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Cryptography.X509Certificates.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Principal.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.Principal.Windows.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Security.SecureString.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Text.Encoding.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Text.Encoding.CodePages.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Text.Encoding.Extensions.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Text.Encodings.Web.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Text.Json.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Text.RegularExpressions.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.Channels.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.Overlapped.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.Tasks.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.Tasks.Dataflow.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.Tasks.Extensions.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.Tasks.Parallel.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.Thread.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.ThreadPool.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Threading.Timer.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Transactions.Local.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.ValueTuple.dll|Microsoft.NETCore.App.Ref|4.0.3.0|6.0.21.52210 +System.Web.HttpUtility.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Xml.ReaderWriter.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Xml.XDocument.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Xml.XmlDocument.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Xml.XmlSerializer.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Xml.XPath.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Xml.XPath.XDocument.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +mscorlib.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +Microsoft.VisualBasic.dll|Microsoft.NETCore.App.Ref|10.0.0.0|6.0.21.52210 +System.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.ComponentModel.DataAnnotations.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Configuration.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Core.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Data.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Drawing.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.IO.Compression.FileSystem.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Net.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Numerics.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Runtime.Serialization.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Security.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.ServiceProcess.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.ServiceModel.Web.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Transactions.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Web.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Windows.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Xml.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Xml.Serialization.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +System.Xml.Linq.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +WindowsBase.dll|Microsoft.NETCore.App.Ref|4.0.0.0|6.0.21.52210 +netstandard.dll|Microsoft.NETCore.App.Ref|2.1.0.0|6.0.21.52210 +System.Private.CoreLib.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Private.DataContractSerialization.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Private.Uri.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Private.Xml.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +System.Private.Xml.Linq.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +libSystem.Globalization.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Globalization.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.IO.Compression.Native.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.IO.Compression.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.IO.Compression.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Native.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Net.Http.Native.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Net.Http.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Net.Http.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Net.Security.Native.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Net.Security.Native.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Net.Security.Native.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Security.Cryptography.Native.Apple.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Security.Cryptography.Native.Apple.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Security.Cryptography.Native.Android.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Security.Cryptography.Native.Android.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Security.Cryptography.Native.OpenSsl.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Security.Cryptography.Native.OpenSsl.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libSystem.Security.Cryptography.Native.OpenSsl.so|Microsoft.NETCore.App.Ref||0.0.0.0 +coreclr.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +libcoreclr.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libcoreclr.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +clretwrc.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +clrjit.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +libclrjit.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libclrjit.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +dbgshim.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +libdbgshim.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libdbgshim.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +mscordaccore.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +libmscordaccore.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libmscordaccore.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +mscordbi.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +libmscordbi.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libmscordbi.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +mscorrc.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +api-ms-win-core-console-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-console-l1-2-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-datetime-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-debug-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-errorhandling-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-file-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-file-l1-2-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-file-l2-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-handle-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-heap-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-interlocked-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-libraryloader-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-localization-l1-2-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-memory-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-namedpipe-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-processenvironment-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-processthreads-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-processthreads-l1-1-1.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-profile-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-rtlsupport-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-string-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-synch-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-synch-l1-2-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-sysinfo-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-timezone-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-core-util-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-conio-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-convert-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-environment-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-filesystem-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-heap-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-locale-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-math-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-multibyte-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-private-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-process-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-runtime-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-stdio-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-string-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-time-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +api-ms-win-crt-utility-l1-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +API-MS-Win-core-xstate-l2-1-0.dll|Microsoft.NETCore.App.Ref||10.0.19041.1 +ucrtbase.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +msquic.dll|Microsoft.NETCore.App.Ref||1.8.0.0 +System.IO.Compression.Native.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +createdump.exe|Microsoft.NETCore.App.Ref||6.0.21.52210 +createdump|Microsoft.NETCore.App.Ref||0.0.0.0 +libcoreclrtraceptprovider.so|Microsoft.NETCore.App.Ref||0.0.0.0 +Microsoft.DiaSymReader.Native.x86.dll|Microsoft.NETCore.App.Ref||14.28.29715.1 +Microsoft.DiaSymReader.Native.amd64.dll|Microsoft.NETCore.App.Ref||14.28.29715.1 +Microsoft.DiaSymReader.Native.arm.dll|Microsoft.NETCore.App.Ref||14.28.29715.1 +Microsoft.DiaSymReader.Native.arm64.dll|Microsoft.NETCore.App.Ref||14.28.29715.1 +libmonosgen-2.0.lib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmonosgen-2.0.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmonosgen-2.0.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libmonosgen-2.0.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +llc|Microsoft.NETCore.App.Ref||0.0.0.0 +mono-aot-cross|Microsoft.NETCore.App.Ref||0.0.0.0 +mono-aot-cross.exe|Microsoft.NETCore.App.Ref||6.0.21.52210 +opt|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-diagnostics_tracing.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +libmono-component-diagnostics_tracing.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-diagnostics_tracing.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-diagnostics_tracing-static.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-diagnostics_tracing-stub-static.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-diagnostics_tracing-static.lib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-diagnostics_tracing-stub-static.lib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-hot_reload.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +libmono-component-hot_reload.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-hot_reload.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-hot_reload-static.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-hot_reload-stub-static.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-hot_reload-static.lib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-hot_reload-stub-static.lib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-debugger.dll|Microsoft.NETCore.App.Ref||6.0.21.52210 +libmono-component-debugger.so|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-debugger.dylib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-debugger-static.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-debugger-stub-static.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-debugger-static.lib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-component-debugger-stub-static.lib|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-ee-interp.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-icall-table.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-ilgen.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libmono-profiler-aot.a|Microsoft.NETCore.App.Ref||0.0.0.0 +System.Private.Runtime.InteropServices.Javascript.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +dotnet.js|Microsoft.NETCore.App.Ref||0.0.0.0 +dotnet.wasm|Microsoft.NETCore.App.Ref||0.0.0.0 +dotnet.timezones.blat|Microsoft.NETCore.App.Ref||0.0.0.0 +icudt.dat|Microsoft.NETCore.App.Ref||0.0.0.0 +icudt_no_CJK.dat|Microsoft.NETCore.App.Ref||0.0.0.0 +icudt_CJK.dat|Microsoft.NETCore.App.Ref||0.0.0.0 +icudt_EFIGS.dat|Microsoft.NETCore.App.Ref||0.0.0.0 +icudt_optimal.dat|Microsoft.NETCore.App.Ref||0.0.0.0 +icudt_optimal_no_CJK.dat|Microsoft.NETCore.App.Ref||0.0.0.0 +binding_support.js|Microsoft.NETCore.App.Ref||0.0.0.0 +dotnet_support.js|Microsoft.NETCore.App.Ref||0.0.0.0 +library_mono.js|Microsoft.NETCore.App.Ref||0.0.0.0 +pal_random.js|Microsoft.NETCore.App.Ref||0.0.0.0 +corebindings.c|Microsoft.NETCore.App.Ref||0.0.0.0 +driver.c|Microsoft.NETCore.App.Ref||0.0.0.0 +pinvoke.c|Microsoft.NETCore.App.Ref||0.0.0.0 +pinvoke.h|Microsoft.NETCore.App.Ref||0.0.0.0 +emcc-default.rsp|Microsoft.NETCore.App.Ref||0.0.0.0 +emcc-props.json|Microsoft.NETCore.App.Ref||0.0.0.0 +libicudata.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libicui18n.a|Microsoft.NETCore.App.Ref||0.0.0.0 +libicuuc.a|Microsoft.NETCore.App.Ref||0.0.0.0 +mscordaccore_amd64_amd64_6.0.21.52210.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 +mscordaccore_amd64_amd64_6.0.21.52210.dll|Microsoft.NETCore.App.Ref|6.0.0.0|6.0.21.52210 diff --git a/src/installer/pkg/sfx/bundle/osx_resources/cs.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/cs.lproj/conclusion.html index e16c4b3148bcd4..af3bf5fd20ea09 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/cs.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/cs.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/bundle/osx_resources/de.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/de.lproj/conclusion.html index e16c4b3148bcd4..af3bf5fd20ea09 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/de.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/de.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/bundle/osx_resources/en.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/en.lproj/conclusion.html index 40f415ad8d9b72..a41e496b2e46aa 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/en.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/en.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/bundle/osx_resources/es.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/es.lproj/conclusion.html index e16c4b3148bcd4..af3bf5fd20ea09 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/es.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/es.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/bundle/osx_resources/fr.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/fr.lproj/conclusion.html index e16c4b3148bcd4..af3bf5fd20ea09 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/fr.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/fr.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/bundle/osx_resources/it.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/it.lproj/conclusion.html index e16c4b3148bcd4..af3bf5fd20ea09 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/it.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/it.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/bundle/osx_resources/ja.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/ja.lproj/conclusion.html index e16c4b3148bcd4..af3bf5fd20ea09 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/ja.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/ja.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/bundle/osx_resources/ko.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/ko.lproj/conclusion.html index e16c4b3148bcd4..af3bf5fd20ea09 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/ko.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/ko.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/bundle/osx_resources/pl.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/pl.lproj/conclusion.html index e16c4b3148bcd4..af3bf5fd20ea09 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/pl.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/pl.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/bundle/osx_resources/pt-br.lproj/conclusion.html b/src/installer/pkg/sfx/bundle/osx_resources/pt-br.lproj/conclusion.html index e16c4b3148bcd4..af3bf5fd20ea09 100644 --- a/src/installer/pkg/sfx/bundle/osx_resources/pt-br.lproj/conclusion.html +++ b/src/installer/pkg/sfx/bundle/osx_resources/pt-br.lproj/conclusion.html @@ -5,7 +5,7 @@
-

The following was installed at /usr/local/share/dotnet +

The following was installed

  • {SharedFxBrandName}
diff --git a/src/installer/pkg/sfx/installers.proj b/src/installer/pkg/sfx/installers.proj index 367470dacc4cab..35b97b6b8ec0b4 100644 --- a/src/installer/pkg/sfx/installers.proj +++ b/src/installer/pkg/sfx/installers.proj @@ -12,6 +12,7 @@ + diff --git a/src/installer/pkg/sfx/installers/dotnet-host.proj b/src/installer/pkg/sfx/installers/dotnet-host.proj index 953b0f4f8522f9..184770cb8c6089 100644 --- a/src/installer/pkg/sfx/installers/dotnet-host.proj +++ b/src/installer/pkg/sfx/installers/dotnet-host.proj @@ -4,6 +4,7 @@ true dotnet-host dotnet-host-internal + / Host NetCore.SharedHost true @@ -11,21 +12,27 @@ sharedhost Dotnet_CLI_SharedHost HostSrc + afterInstallExecute false true sharedhost false - osx_scripts/host + osx_scripts/host The .NET Shared Host. - $(MSBuildThisFileDirectory)rpm_scripts/host - $(RpmScriptsDirectory)/after_install.sh - $(RpmScriptsDirectory)/after_remove.sh + + {FD6988BF-5CCB-4202-3752-072442B1070B} + {97C9F490-5379-6902-7B80-D2723CA59D95} + {181630A5-53EA-4D70-E563-06F64946DE38} + + + + @@ -35,21 +42,37 @@ + + <_DestinationPath>$(OutputPath) + <_DestinationPath Condition="'$(BuildRpmPackage)' == 'true'">$(OutputPath)usr/share/dotnet/ + <_UsrBinPath>$(OutputPath)usr/bin/ + + + + + + Destination="$(_DestinationPath)dotnet$(ExeSuffix)" /> + Destination="$(_DestinationPath)ThirdPartyNotices.txt" /> + + + + @@ -71,11 +94,43 @@ - - + + + <_MacOSIntermediatesPath>$(IntermediateOutputPath)macos/ + + $(_MacOSIntermediatesPath)scripts + + + <_MacOSScript Include="$(MacOSScriptsTemplateDirectory)/*" Destination="$(MacOSScriptsDirectory)/%(FileName)%(Extension)"/> + + + + + <_UnameMachineRegex>$(InstallerTargetArchitecture) + <_UnameMachineRegex Condition="'$(InstallerTargetArchitecture)' == 'arm64'">arm64|aarch64 + <_UnameMachineRegex Condition="'$(InstallerTargetArchitecture)' == 'x64'">amd64|x86_64 + <_MacOSScriptsTemplateProperties>InstallerTargetArchitecture=$(InstallerTargetArchitecture);UnameMachineRegex=$(_UnameMachineRegex) + + + + + + + + + + + + diff --git a/src/installer/pkg/sfx/installers/dotnet-hostfxr.proj b/src/installer/pkg/sfx/installers/dotnet-hostfxr.proj index 2c5fa5d8188867..b9eb792a38fade 100644 --- a/src/installer/pkg/sfx/installers/dotnet-hostfxr.proj +++ b/src/installer/pkg/sfx/installers/dotnet-hostfxr.proj @@ -14,7 +14,6 @@ HostFxrSrc true hostfxr - osx_scripts/hostfxr The .NET HostFxr diff --git a/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-cm.2.proj b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-cm.2.proj new file mode 100644 index 00000000000000..76315c4255ec16 --- /dev/null +++ b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-cm.2.proj @@ -0,0 +1,10 @@ + + + false + cm.2 + + + + + + diff --git a/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-debian.proj b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-debian.proj index cbdc40bdb2f54b..be0713f05f7507 100644 --- a/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-debian.proj +++ b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-debian.proj @@ -5,7 +5,7 @@ - + + + + + + + + + + + + + + + + + + + NOT NON_NATIVE_ARCHITECTURE + + + NOT VersionNT64 + + + - + @@ -47,6 +71,16 @@ + + + + - - + + + + + NON_NATIVE_ARCHITECTURE + + + \ No newline at end of file diff --git a/src/installer/pkg/sfx/installers/osx_scripts/host/postinstall b/src/installer/pkg/sfx/installers/osx_scripts/host/postinstall index 531cb93fd382fc..3eba436d925092 100755 --- a/src/installer/pkg/sfx/installers/osx_scripts/host/postinstall +++ b/src/installer/pkg/sfx/installers/osx_scripts/host/postinstall @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. @@ -6,13 +6,23 @@ PACKAGE=$1 INSTALL_DESTINATION=$2 +[ "${InstallerTargetArchitecture}" == "x64" ] && X64_INSTALL_DESTINATION=$2 || X64_INSTALL_DESTINATION=$2/x64 # A temporary fix for the permissions issue(s) chmod 755 $INSTALL_DESTINATION/dotnet -# Add the installation directory to the system-wide paths -# But first create the directory if it doesn't exist -mkdir -p /etc/paths.d -echo $INSTALL_DESTINATION | tee /etc/paths.d/dotnet +mkdir -p /etc/dotnet +# set install_location (legacy location) to x64 location (regardless of wether or not we're installing x64) +echo $X64_INSTALL_DESTINATION | tee /etc/dotnet/install_location +# set install_location_arch to point to this installed location +echo $INSTALL_DESTINATION | tee /etc/dotnet/install_location_${InstallerTargetArchitecture} + +# if we're running on the native architecture +if [[ "$(uname -m)" =~ ${UnameMachineRegex} && "$(sysctl -i -n sysctl.proc_translated)" != "1" ]]; then + # Add the installation directory to the system-wide paths + # But first create the directory if it doesn't exist + mkdir -p /etc/paths.d + echo $INSTALL_DESTINATION | tee /etc/paths.d/dotnet +fi exit 0 diff --git a/src/installer/pkg/sfx/installers/osx_scripts/hostfxr/postinstall b/src/installer/pkg/sfx/installers/osx_scripts/hostfxr/postinstall deleted file mode 100755 index 2d0ceb82786936..00000000000000 --- a/src/installer/pkg/sfx/installers/osx_scripts/hostfxr/postinstall +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# - -PACKAGE=$1 -INSTALL_DESTINATION=$2 - -# A temporary fix for the permissions issue(s) -chmod 755 $INSTALL_DESTINATION/dotnet - -# Add the installation directory to the system-wide paths -echo $INSTALL_DESTINATION | tee /etc/paths.d/dotnet - -exit 0 diff --git a/src/installer/prepare-artifacts.proj b/src/installer/prepare-artifacts.proj index 159125bc2d03d5..2de1d3b43d3a20 100644 --- a/src/installer/prepare-artifacts.proj +++ b/src/installer/prepare-artifacts.proj @@ -23,6 +23,8 @@ + + @@ -56,6 +58,16 @@ + + + + DotNetReleaseShipping=true + + + + + @@ -204,11 +220,13 @@ Include="$(DownloadDirectory)**\VS.Redist.Common.*.nupkg" Exclude="@(DownloadedSymbolNupkgFile)" /> - + + $(DownloadDirectory)*\workloads-vs\**\*.zip"/> $(TestTargetRid) + + 13.0.1 \ No newline at end of file diff --git a/src/installer/tests/HostActivation.Tests/DependencyResolution/ResolveComponentDependencies.cs b/src/installer/tests/HostActivation.Tests/DependencyResolution/ResolveComponentDependencies.cs index ccf81e7cf8760f..4ee9248e41a895 100644 --- a/src/installer/tests/HostActivation.Tests/DependencyResolution/ResolveComponentDependencies.cs +++ b/src/installer/tests/HostActivation.Tests/DependencyResolution/ResolveComponentDependencies.cs @@ -449,9 +449,9 @@ public TestApp CreateComponentWithDependencies(Action customi NetCoreAppBuilder builder = NetCoreAppBuilder.PortableForNETCoreApp(componentWithDependencies) .WithProject(p => p.WithAssemblyGroup(null, g => g.WithMainAssembly())) .WithProject("ComponentDependency", "1.0.0", p => p.WithAssemblyGroup(null, g => g.WithAsset("ComponentDependency.dll"))) - .WithPackage("Newtonsoft.Json", "9.0.1", p => p.WithAssemblyGroup(null, g => g + .WithPackage("Newtonsoft.Json", "13.0.1", p => p.WithAssemblyGroup(null, g => g .WithAsset("lib/netstandard1.0/Newtonsoft.Json.dll", f => f - .WithVersion("9.0.0.0", "9.0.1.19813") + .WithVersion("13.0.0.0", "13.0.1.25517") .WithFileOnDiskPath("Newtonsoft.Json.dll")))) .WithPackage("Libuv", "1.9.1", p => p .WithNativeLibraryGroup("debian-x64", g => g.WithAsset("runtimes/debian-x64/native/libuv.so")) diff --git a/src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs b/src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs index bffa811215b679..f7c0bdc468fcac 100644 --- a/src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs +++ b/src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs @@ -79,7 +79,7 @@ public void InvalidFileOrCommand_NoSDK_ListsPossibleIssues() .Execute(fExpectedToFail: true) .Should().Fail() .And.HaveStdErrContaining($"The application '{fileName}' does not exist") - .And.HaveStdErrContaining($"It was not possible to find any installed .NET SDKs"); + .And.FindAnySdk(false); } // Return a non-exisitent path that contains a mix of / and \ diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/DotNetCliExtensions.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/DotNetCliExtensions.cs index 5a8830556f54b6..6f637a1f586907 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/DotNetCliExtensions.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/DotNetCliExtensions.cs @@ -77,7 +77,7 @@ public DotNetFramework RuntimeConfig(Action runtimeConfigCustomiz { string runtimeConfigPath = Path.Combine(_path, _name + ".runtimeconfig.json"); _backup.Backup(runtimeConfigPath); - RuntimeConfig runtimeConfig = HostActivation.RuntimeConfig.FromFile(runtimeConfigPath); + RuntimeConfig runtimeConfig = Test.RuntimeConfig.FromFile(runtimeConfigPath); runtimeConfigCustomizer(runtimeConfig); runtimeConfig.Save(); diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolutionCommandResultExtensions.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolutionCommandResultExtensions.cs index a0b6feda95774d..01c613d1e35ba4 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolutionCommandResultExtensions.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/FrameworkResolutionCommandResultExtensions.cs @@ -30,10 +30,10 @@ public static AndConstraint ShouldHaveResolvedFramework /// Constraint public static AndConstraint ShouldHaveResolvedFrameworkOrFailToFind(this CommandResult result, string resolvedFrameworkName, string resolvedFrameworkVersion) { - if (resolvedFrameworkName == null || resolvedFrameworkVersion == null || + if (resolvedFrameworkName == null || resolvedFrameworkVersion == null || resolvedFrameworkVersion == FrameworkResolutionBase.ResolvedFramework.NotFound) { - return result.ShouldFailToFindCompatibleFrameworkVersion(); + return result.ShouldFailToFindCompatibleFrameworkVersion(resolvedFrameworkName); } else { @@ -41,15 +41,21 @@ public static AndConstraint ShouldHaveResolvedFramework } } - public static AndConstraint DidNotFindCompatibleFrameworkVersion(this CommandResultAssertions assertion) + public static AndConstraint DidNotFindCompatibleFrameworkVersion(this CommandResultAssertions assertion, string frameworkName, string requestedVersion) { - return assertion.HaveStdErrContaining("It was not possible to find any compatible framework version"); + var constraint = assertion.HaveStdErrContaining("You must install or update .NET to run this application."); + if (frameworkName is not null) + { + constraint = constraint.And.HaveStdErrContaining($"Framework: '{frameworkName}', {(requestedVersion is null ? "" : $"version '{requestedVersion}'")}"); + } + + return constraint; } - public static AndConstraint ShouldFailToFindCompatibleFrameworkVersion(this CommandResult result) + public static AndConstraint ShouldFailToFindCompatibleFrameworkVersion(this CommandResult result, string frameworkName, string requestedVersion = null) { return result.Should().Fail() - .And.DidNotFindCompatibleFrameworkVersion(); + .And.DidNotFindCompatibleFrameworkVersion(frameworkName, requestedVersion); } public static AndConstraint FailedToReconcileFrameworkReference( @@ -91,7 +97,7 @@ public static AndConstraint ShouldHaveResolvedFramework } else if (resolvedVersion == FrameworkResolutionBase.ResolvedFramework.NotFound) { - return result.ShouldFailToFindCompatibleFrameworkVersion(); + return result.ShouldFailToFindCompatibleFrameworkVersion(frameworkName, null); } else { diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs index 0a12cd2640ce9b..5a91c88e3a8333 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs @@ -4,6 +4,7 @@ using Microsoft.DotNet.Cli.Build; using Microsoft.DotNet.Cli.Build.Framework; using System; +using System.IO; using System.Runtime.InteropServices; using Xunit; @@ -27,7 +28,8 @@ public void FrameworkHiveSelection_GlobalHiveWithBetterMatch() RunTest( runtimeConfig => runtimeConfig .WithFramework(MicrosoftNETCoreApp, "5.0.0")) - .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.2"); + .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.2") + .And.HaveStdErrContaining($"Ignoring FX version [5.0.0] without .deps.json"); } [Fact] @@ -37,7 +39,8 @@ public void FrameworkHiveSelection_MainHiveWithBetterMatch() RunTest( runtimeConfig => runtimeConfig .WithFramework(MicrosoftNETCoreApp, "6.0.0")) - .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "6.1.2"); + .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "6.1.2") + .And.HaveStdErrContaining($"Ignoring FX version [6.0.0] without .deps.json"); } [Fact] @@ -51,7 +54,8 @@ public void FrameworkHiveSelection_CurrentDirectoryIsIgnored() .WithRuntimeConfigCustomizer(runtimeConfig => runtimeConfig .WithFramework(MicrosoftNETCoreApp, "5.0.0")) .WithWorkingDirectory(SharedState.DotNetCurrentHive.BinPath)) - .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.2.0"); + .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.2.0") + .And.HaveStdErrContaining($"Ignoring FX version [5.0.0] without .deps.json"); } private CommandResult RunTest(Func runtimeConfig) @@ -89,6 +93,12 @@ public SharedTestState() .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("6.1.2") .Build(); + // Empty Microsoft.NETCore.App directory - should not be recognized as a valid framework + // Version is the best match for some test cases, but they should be ignored + string netCoreAppDir = Path.Combine(DotNetMainHive.BinPath, "shared", Constants.MicrosoftNETCoreApp); + Directory.CreateDirectory(Path.Combine(netCoreAppDir, "5.0.0")); + Directory.CreateDirectory(Path.Combine(netCoreAppDir, "6.0.0")); + DotNetGlobalHive = DotNet("GlobalHive") .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.2") .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("6.2.0") diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardAndRollForwardOnNoCandidateFxSettings.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardAndRollForwardOnNoCandidateFxSettings.cs index b5fb6718fdb232..b12199a7bb842f 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardAndRollForwardOnNoCandidateFxSettings.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardAndRollForwardOnNoCandidateFxSettings.cs @@ -101,10 +101,11 @@ public void Precedence( SettingLocation rollForwardOnNoCandidateFxLocation, bool passes) { + string requestedVersion = "5.0.0"; CommandResult result = RunTest( new TestSettings() .WithRuntimeConfigCustomizer(runtimeConfig => runtimeConfig - .WithFramework(MicrosoftNETCoreApp, "5.0.0")) + .WithFramework(MicrosoftNETCoreApp, requestedVersion)) .With(RollForwardSetting(rollForwardLocation, Constants.RollForwardSetting.Major)) .With(RollForwardOnNoCandidateFxSetting(rollForwardOnNoCandidateFxLocation, 0))); @@ -114,7 +115,7 @@ public void Precedence( } else { - result.Should().Fail().And.DidNotFindCompatibleFrameworkVersion(); + result.ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } } diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFx.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFx.cs index 935d4122fa7d33..dda6a1dd6d185a 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFx.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFx.cs @@ -8,7 +8,7 @@ namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution { - public class RollForwardOnNoCandidateFx : + public class RollForwardOnNoCandidateFx : FrameworkResolutionBase, IClassFixture { @@ -113,18 +113,19 @@ public void RollForwardToLatestPatch_RollForwardOnNoCandidateFx(int? rollForward [InlineData(2, false, true)] public void RollForwardOnMinor_RollForwardOnNoCandidateFx(int? rollForwardOnNoCandidateFx, bool? applyPatches, bool passes) { + string requestedVersion = "5.0.0"; CommandResult result = RunTestWithOneFramework( runtimeConfig => runtimeConfig .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.0.0")); + .WithFramework(MicrosoftNETCoreApp, requestedVersion)); if (passes) { result.ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3"); } else { - result.ShouldFailToFindCompatibleFrameworkVersion(); + result.ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } } @@ -140,18 +141,19 @@ public void RollForwardOnMinor_RollForwardOnNoCandidateFx(int? rollForwardOnNoCa [InlineData(2, false, true)] public void RollForwardOnMajor_RollForwardOnNoCandidateFx(int? rollForwardOnNoCandidateFx, bool? applyPatches, bool passes) { + string requestedVersion = "4.1.0"; CommandResult result = RunTestWithOneFramework( runtimeConfig => runtimeConfig .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "4.1.0")); + .WithFramework(MicrosoftNETCoreApp, requestedVersion)); if (passes) { result.ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3"); } else { - result.ShouldFailToFindCompatibleFrameworkVersion(); + result.ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } } @@ -165,12 +167,13 @@ public void RollForwardOnMajor_RollForwardOnNoCandidateFx(int? rollForwardOnNoCa [InlineData(2, false)] public void NeverRollBackOnRelease(int? rollForwardOnNoCandidateFx, bool? applyPatches) { + string requestedVersion = "5.1.4"; RunTestWithOneFramework( runtimeConfig => runtimeConfig .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.1.4")) - .ShouldFailToFindCompatibleFrameworkVersion(); + .WithFramework(MicrosoftNETCoreApp, requestedVersion)) + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } // Verifies that if both rollForwardOnNoCandidateFx=0 and applyPatches=0 there will be no rolling forward. @@ -203,14 +206,14 @@ public void RollForwardDisabledOnCandidateFxAndDisabledApplyPatches_MatchesExact [Fact] public void RollForwardOnMinorDisabledOnNoCandidateFx_FailsToRoll() { + string requestedVersion = "5.0.0"; RunTestWithOneFramework( runtimeConfig => runtimeConfig .WithRollForwardOnNoCandidateFx(0) - .WithFramework(MicrosoftNETCoreApp, "5.0.0")) + .WithFramework(MicrosoftNETCoreApp, requestedVersion)) // Will still attempt roll forward to latest patch - .Should().Fail() - .And.HaveStdErrContaining("Attempting FX roll forward") - .And.DidNotFindCompatibleFrameworkVersion(); + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion) + .And.HaveStdErrContaining("Attempting FX roll forward"); } // 3.0 change: In 2.* pre-release never rolled to release. In 3.* it will follow normal roll-forward rules. @@ -313,22 +316,23 @@ public void RollForwardToPreReleaseLatestPatch_RollForwardOnNoCandidateFx(int? r [InlineData(2, null, true)] [InlineData(2, false, true)] public void RollForwardToPreReleaseOnMinor_RollForwardOnNoCandidateFx( - int? rollForwardOnNoCandidateFx, - bool? applyPatches, + int? rollForwardOnNoCandidateFx, + bool? applyPatches, bool passes) { + string requestedVersion = "5.0.0"; CommandResult result = RunTestWithPreReleaseFramework( runtimeConfig => runtimeConfig .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.0.0")); + .WithFramework(MicrosoftNETCoreApp, requestedVersion)); if (passes) { result.ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3-preview.2"); } else { - result.ShouldFailToFindCompatibleFrameworkVersion(); + result.ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } } @@ -346,18 +350,19 @@ public void RollForwardToPreReleaseOnMajor_RollForwardOnNoCandidateFx( bool? applyPatches, bool passes) { + string requestedVersion = "4.1.0"; CommandResult result = RunTestWithPreReleaseFramework( runtimeConfig => runtimeConfig .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "4.1.0")); + .WithFramework(MicrosoftNETCoreApp, requestedVersion)); if (passes) { result.ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3-preview.2"); } else { - result.ShouldFailToFindCompatibleFrameworkVersion(); + result.ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } } @@ -371,12 +376,13 @@ public void RollForwardToPreReleaseOnMajor_RollForwardOnNoCandidateFx( [InlineData(2, false)] public void NeverRollBackOnPreRelease(int? rollForwardOnNoCandidateFx, bool? applyPatches) { + string requestedVersion = "5.1.3-preview.9"; RunTestWithPreReleaseFramework( runtimeConfig => runtimeConfig .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.1.3-preview.9")) - .ShouldFailToFindCompatibleFrameworkVersion(); + .WithFramework(MicrosoftNETCoreApp, requestedVersion)) + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } private CommandResult RunTestWithPreReleaseFramework(Func runtimeConfig) @@ -623,7 +629,7 @@ public void RollForwardToPreReleaseToClosestPreRelease_FromRelease( [InlineData(2, false, "2.3.2")] // Pre-release is ignored, roll forward to closest release available public void RollForwardToClosestReleaseWithPreReleaseAvailable_FromRelease( int? rollForwardOnNoCandidateFx, - bool? applyPatches, + bool? applyPatches, string resolvedFramework) { RunTestWithManyVersions( diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs index 3258653cdf40bd..b18b8c8131c6b1 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs @@ -24,12 +24,12 @@ public RollForwardOnNoCandidateFxSettings(SharedTestState sharedState) [Fact] public void Default() { + string requestedVersion = "4.0.0"; RunTest( new TestSettings() .WithRuntimeConfigCustomizer(runtimeConfig => runtimeConfig - .WithFramework(MicrosoftNETCoreApp, "4.0.0"))) - .Should().Fail() - .And.DidNotFindCompatibleFrameworkVersion(); + .WithFramework(MicrosoftNETCoreApp, requestedVersion))) + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); RunTest( new TestSettings() @@ -122,7 +122,7 @@ public void EnvironmentPriority(SettingLocation settingLocation, bool envVariabl // Verifies interaction between variour and inner framework reference setting [Theory] // settingLocation innerReferenceWins // Command line overrides everything - even inner framework references - [InlineData(SettingLocation.CommandLine, false)] + [InlineData(SettingLocation.CommandLine, false)] [InlineData(SettingLocation.RuntimeOptions, true)] [InlineData(SettingLocation.FrameworkReference, true)] [InlineData(SettingLocation.Environment, true)] @@ -149,7 +149,7 @@ public void InnerFrameworkReference(SettingLocation settingLocation, bool innerR // RuntimeOptions and FrameworkReference settings are not inherited to inner reference [InlineData(SettingLocation.FrameworkReference, false)] // Since none is specified for the inner reference, environment is used - [InlineData(SettingLocation.Environment, true)] + [InlineData(SettingLocation.Environment, true)] public void NoInheritance_MoreRelaxed(SettingLocation settingLocation, bool appWins) { RunTest( @@ -172,7 +172,7 @@ public void NoInheritance_MoreRelaxed(SettingLocation settingLocation, bool appW // RuntimeOptions and FrameworkReference settings are not inherited to inner reference [InlineData(SettingLocation.FrameworkReference, false)] // Since none is specified for the inner reference, environment is used - [InlineData(SettingLocation.Environment, true)] + [InlineData(SettingLocation.Environment, true)] public void NoInheritance_MoreRestrictive(SettingLocation settingLocation, bool appWins) { RunTest( @@ -186,7 +186,7 @@ public void NoInheritance_MoreRestrictive(SettingLocation settingLocation, bool .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, appWins ? null : "5.1.3"); } - private CommandResult RunTest(TestSettings testSettings) => + private CommandResult RunTest(TestSettings testSettings) => RunTest(SharedState.DotNetWithFrameworks, SharedState.FrameworkReferenceApp, testSettings); public class SharedTestState : SharedTestStateBase @@ -202,7 +202,7 @@ public SharedTestState() .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("2.5.5") .AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.3") .AddFramework( - MiddleWare, "2.1.2", + MiddleWare, "2.1.2", runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.3")) .Build(); diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardPreReleaseOnly.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardPreReleaseOnly.cs index b3b6cf8a935367..9e35ed8ff2a630 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardPreReleaseOnly.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardPreReleaseOnly.cs @@ -122,11 +122,12 @@ public void RollForwardOnMajor_FromReleaseToPreRelease(string rollForward, bool? [InlineData(Constants.RollForwardSetting.LatestPatch, false)] public void NeverRollBackOnPreRelease_PreReleaseOnly(string rollForward, bool? applyPatches) { + string requestedVersion = "5.1.2-preview.3"; RunTest( - "5.1.2-preview.3", + requestedVersion, rollForward, applyPatches) - .ShouldFailToFindCompatibleFrameworkVersion(); + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } // Verifies that rollForward settings won't roll back (on patch). @@ -139,11 +140,12 @@ public void NeverRollBackOnPreRelease_PreReleaseOnly(string rollForward, bool? a [InlineData(Constants.RollForwardSetting.LatestPatch, false)] public void NeverRollBackOnPatch_PreReleaseOnly(string rollForward, bool? applyPatches) { + string requestedVersion = "5.1.3-preview.1"; RunTest( - "5.1.3-preview.1", + requestedVersion, rollForward, applyPatches) - .ShouldFailToFindCompatibleFrameworkVersion(); + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } // Verifies that rollForward settings won't roll back (on minor). @@ -157,11 +159,12 @@ public void NeverRollBackOnPatch_PreReleaseOnly(string rollForward, bool? applyP [InlineData(Constants.RollForwardSetting.LatestMinor, false)] public void NeverRollBackOnMinor_PreReleaseOnly(string rollForward, bool? applyPatches) { + string requestedVersion = "5.3.0-preview.1"; RunTest( - "5.3.0-preview.1", + requestedVersion, rollForward, applyPatches) - .ShouldFailToFindCompatibleFrameworkVersion(); + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } // Verifies that rollForward settings won't roll back (on major). @@ -175,11 +178,12 @@ public void NeverRollBackOnMinor_PreReleaseOnly(string rollForward, bool? applyP [InlineData(Constants.RollForwardSetting.LatestMinor, false)] public void NeverRollBackOnMajor_PreReleaseOnly(string rollForward, bool? applyPatches) { + string requestedVersion = "7.1.0-preview.1"; RunTest( - "7.1.0-preview.1", + requestedVersion, rollForward, applyPatches) - .ShouldFailToFindCompatibleFrameworkVersion(); + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } // Verifies that rollForward settings behave as expected starting with framework reference diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardReleaseOnly.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardReleaseOnly.cs index 1f438a9d96d596..9899c4364a6cbc 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardReleaseOnly.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardReleaseOnly.cs @@ -166,11 +166,12 @@ public void RollForwardOnMajor_ReleaseOnly(string rollForward, bool? applyPatche [InlineData(Constants.RollForwardSetting.LatestPatch, false)] public void NeverRollBackOnPatch_ReleaseOnly(string rollForward, bool? applyPatches) { + string requestedVersion = "2.1.4"; RunTest( - "2.1.4", + requestedVersion, rollForward, applyPatches) - .ShouldFailToFindCompatibleFrameworkVersion(); + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } // Verify that rollForward settings will never roll back to lower minor version. @@ -183,11 +184,12 @@ public void NeverRollBackOnPatch_ReleaseOnly(string rollForward, bool? applyPatc [InlineData(Constants.RollForwardSetting.LatestMinor, false)] public void NeverRollBackOnMinor_ReleaseOnly(string rollForward, bool? applyPatches) { + string requestedVersion = "2.5.0"; RunTest( - "2.5.0", + requestedVersion, rollForward, applyPatches) - .ShouldFailToFindCompatibleFrameworkVersion(); + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } // Verify that rollForward settings will never roll back to lower major version. @@ -200,11 +202,12 @@ public void NeverRollBackOnMinor_ReleaseOnly(string rollForward, bool? applyPatc [InlineData(Constants.RollForwardSetting.LatestMinor, false)] public void NeverRollBackOnMajor_ReleaseOnly(string rollForward, bool? applyPatches) { + string requestedVersion = "4.1.0"; RunTest( - "4.1.0", + requestedVersion, rollForward, applyPatches) - .ShouldFailToFindCompatibleFrameworkVersion(); + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } private CommandResult RunTest( diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardSettings.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardSettings.cs index 7b35129c0577d8..b5e278c74ccabc 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardSettings.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardSettings.cs @@ -24,12 +24,12 @@ public RollForwardSettings(SharedTestState sharedState) [Fact] public void Default() { + string requestedVersion = "4.0.0"; RunTest( new TestSettings() .WithRuntimeConfigCustomizer(runtimeConfig => runtimeConfig .WithFramework(MicrosoftNETCoreApp, "4.0.0"))) - .Should().Fail() - .And.DidNotFindCompatibleFrameworkVersion(); + .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); RunTest( new TestSettings() @@ -138,7 +138,7 @@ private void ValidateValueIgnoresCase(SettingLocation settingLocation, string ro // RuntimeOptions and FrameworkReference settings are not inherited to inner reference [InlineData(SettingLocation.FrameworkReference, false)] // Since none is specified for the inner reference, environment is used - [InlineData(SettingLocation.Environment, true)] + [InlineData(SettingLocation.Environment, true)] public void NoInheritance_MoreRelaxed(SettingLocation settingLocation, bool appWins) { RunTest( @@ -161,7 +161,7 @@ public void NoInheritance_MoreRelaxed(SettingLocation settingLocation, bool appW // RuntimeOptions and FrameworkReference settings are not inherited to inner reference [InlineData(SettingLocation.FrameworkReference, false)] // Since none is specified for the inner reference, environment is used - [InlineData(SettingLocation.Environment, true)] + [InlineData(SettingLocation.Environment, true)] public void NoInheritance_MoreRestrictive(SettingLocation settingLocation, bool appWins) { RunTest( diff --git a/src/installer/tests/HostActivation.Tests/HostActivation.Tests.csproj b/src/installer/tests/HostActivation.Tests/HostActivation.Tests.csproj index 55c14ce9d5a6b5..9724d3326e75a0 100644 --- a/src/installer/tests/HostActivation.Tests/HostActivation.Tests.csproj +++ b/src/installer/tests/HostActivation.Tests/HostActivation.Tests.csproj @@ -5,7 +5,6 @@ HostActivation.Tests HostActivation.Tests true - $(DefineConstants);WINDOWS ha true @@ -17,7 +16,6 @@ - diff --git a/src/installer/tests/HostActivation.Tests/InstallLocationCommandResultExtensions.cs b/src/installer/tests/HostActivation.Tests/InstallLocationCommandResultExtensions.cs index c85b7d3e56cc5d..c4a8438d8117e4 100644 --- a/src/installer/tests/HostActivation.Tests/InstallLocationCommandResultExtensions.cs +++ b/src/installer/tests/HostActivation.Tests/InstallLocationCommandResultExtensions.cs @@ -3,6 +3,7 @@ using System; +using System.IO; using System.Runtime.InteropServices; using FluentAssertions; using Microsoft.DotNet.Cli.Build.Framework; @@ -45,14 +46,14 @@ public static AndConstraint HaveUsedGlobalInstallLocati return assertion.HaveStdErrContaining($"Using global installation location [{installLocation}]"); } - public static AndConstraint HaveFoundDefaultInstallLocationInConfigFile(this CommandResultAssertions assertion, string installLocation) + public static AndConstraint HaveLookedForDefaultInstallLocation(this CommandResultAssertions assertion, string installLocationPath) { - return assertion.HaveStdErrContaining($"Found install location path '{installLocation}'."); + return assertion.HaveStdErrContaining($"Looking for install_location file in '{Path.Combine(installLocationPath, "install_location")}'."); } - public static AndConstraint HaveFoundArchSpecificInstallLocationInConfigFile(this CommandResultAssertions assertion, string installLocation, string arch) + public static AndConstraint HaveLookedForArchitectureSpecificInstallLocation(this CommandResultAssertions assertion, string installLocationPath, string architecture) { - return assertion.HaveStdErrContaining($"Found architecture-specific install location path: '{installLocation}' ('{arch}')."); + return assertion.HaveStdErrContaining($"Looking for architecture specific install_location file in '{Path.Combine(installLocationPath, "install_location_" + architecture.ToLowerInvariant())}'."); } } } diff --git a/src/installer/tests/HostActivation.Tests/MultiArchInstallLocation.cs b/src/installer/tests/HostActivation.Tests/MultiArchInstallLocation.cs index 120b899cff451b..784b0930abed89 100644 --- a/src/installer/tests/HostActivation.Tests/MultiArchInstallLocation.cs +++ b/src/installer/tests/HostActivation.Tests/MultiArchInstallLocation.cs @@ -71,6 +71,31 @@ public void EnvironmentVariable_ArchSpecificDotnetRootIsUsedOverDotnetRoot() .And.NotHaveStdErrContaining("Using environment variable DOTNET_ROOT="); } + [Fact] + public void EnvironmentVariable_DotNetRootIsUsedOverInstallLocationIfSet() + { + var fixture = sharedTestState.PortableAppFixture + .Copy(); + + var appExe = fixture.TestProject.AppExe; + var arch = fixture.RepoDirProvider.BuildArchitecture.ToUpper(); + var dotnet = fixture.BuiltDotnet.BinPath; + + using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(appExe)) + { + registeredInstallLocationOverride.SetInstallLocation((arch, "some/install/location")); + + Command.Create(appExe) + .EnableTracingAndCaptureOutputs() + .ApplyRegisteredInstallLocationOverride(registeredInstallLocationOverride) + .DotNetRoot(dotnet, arch) + .Execute() + .Should().Pass() + .And.HaveUsedDotNetRootInstallLocation(dotnet, fixture.CurrentRid, arch) + .And.NotHaveStdErrContaining("Using global install location"); + } + } + [Fact] public void EnvironmentVariable_DotnetRootPathDoesNotExist() { @@ -107,22 +132,21 @@ public void EnvironmentVariable_DotnetRootPathExistsButHasNoHost() using (TestOnlyProductBehavior.Enable(appExe)) { Command.Create(appExe) - .EnableTracingAndCaptureOutputs() - .DotNetRoot(projDir) - .MultilevelLookup(false) - .EnvironmentVariable( - Constants.TestOnlyEnvironmentVariables.GloballyRegisteredPath, - sharedTestState.InstallLocation) - .Execute() - .Should().Fail() - .And.HaveUsedDotNetRootInstallLocation(projDir, fixture.CurrentRid) - // If DOTNET_ROOT points to a folder that exists we assume that there's a dotnet installation in it - .And.HaveStdErrContaining($"A fatal error occurred. The required library {RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform ("hostfxr")} could not be found."); + .EnableTracingAndCaptureOutputs() + .DotNetRoot(projDir) + .MultilevelLookup(false) + .EnvironmentVariable( + Constants.TestOnlyEnvironmentVariables.GloballyRegisteredPath, + sharedTestState.InstallLocation) + .Execute() + .Should().Fail() + .And.HaveUsedDotNetRootInstallLocation(projDir, fixture.CurrentRid) + // If DOTNET_ROOT points to a folder that exists we assume that there's a dotnet installation in it + .And.HaveStdErrContaining($"The required library {RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostfxr")} could not be found."); } } [Fact] - [SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")] public void InstallLocationFile_ArchSpecificLocationIsPickedFirst() { var fixture = sharedTestState.PortableAppFixture @@ -142,40 +166,19 @@ public void InstallLocationFile_ArchSpecificLocationIsPickedFirst() (arch2, path2) }); - Command.Create(appExe) + CommandResult result = Command.Create(appExe) .EnableTracingAndCaptureOutputs() .ApplyRegisteredInstallLocationOverride(registeredInstallLocationOverride) .DotNetRoot(null) - .Execute() - .Should().HaveFoundDefaultInstallLocationInConfigFile(path1) - .And.HaveFoundArchSpecificInstallLocationInConfigFile(path1, arch1) - .And.HaveFoundArchSpecificInstallLocationInConfigFile(path2, arch2) - .And.HaveUsedGlobalInstallLocation(path2); - } - } + .Execute(); - [Fact] - [SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")] - public void InstallLocationFile_OnlyFirstLineMayNotSpecifyArchitecture() - { - var fixture = sharedTestState.PortableAppFixture - .Copy(); + if (!OperatingSystem.IsWindows()) + { + result.Should() + .HaveLookedForArchitectureSpecificInstallLocation(registeredInstallLocationOverride.PathValueOverride, arch2); + } - var appExe = fixture.TestProject.AppExe; - using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(appExe)) - { - registeredInstallLocationOverride.SetInstallLocation(new (string, string)[] { - (string.Empty, "a/b/c"), - (string.Empty, "x/y/z"), - }); - Command.Create(appExe) - .EnableTracingAndCaptureOutputs() - .ApplyRegisteredInstallLocationOverride(registeredInstallLocationOverride) - .DotNetRoot(null) - .Execute() - .Should().HaveFoundDefaultInstallLocationInConfigFile("a/b/c") - .And.HaveStdErrContaining($"Only the first line in '{registeredInstallLocationOverride.PathValueOverride}' may not have an architecture prefix.") - .And.HaveUsedConfigFileInstallLocation("a/b/c"); + result.Should().HaveUsedGlobalInstallLocation(path2); } } @@ -200,7 +203,7 @@ public void InstallLocationFile_ReallyLongInstallPathIsParsedCorrectly() .ApplyRegisteredInstallLocationOverride(registeredInstallLocationOverride) .DotNetRoot(null) .Execute() - .Should().HaveFoundDefaultInstallLocationInConfigFile(reallyLongPath) + .Should().HaveLookedForDefaultInstallLocation(registeredInstallLocationOverride.PathValueOverride) .And.HaveUsedConfigFileInstallLocation(reallyLongPath); } } @@ -218,16 +221,15 @@ public void InstallLocationFile_MissingFile() { Directory.CreateDirectory(testArtifactsPath); - string directory = Path.Combine(testArtifactsPath, "installLocationOverride"); - Directory.CreateDirectory(directory); - string nonExistentLocationFile = Path.Combine(directory, "install_location"); + string installLocationDirectory = Path.Combine(testArtifactsPath, "installLocationOverride"); + Directory.CreateDirectory(installLocationDirectory); string defaultInstallLocation = Path.Combine(testArtifactsPath, "defaultInstallLocation"); Command.Create(appExe) .CaptureStdErr() .EnvironmentVariable( - Constants.TestOnlyEnvironmentVariables.InstallLocationFilePath, - nonExistentLocationFile) + Constants.TestOnlyEnvironmentVariables.InstallLocationPath, + installLocationDirectory) .EnvironmentVariable( Constants.TestOnlyEnvironmentVariables.DefaultInstallPath, defaultInstallLocation) diff --git a/src/installer/tests/HostActivation.Tests/MultilevelSDKLookup.cs b/src/installer/tests/HostActivation.Tests/MultilevelSDKLookup.cs index 76d11337c03ab5..05dc79548a5c7a 100644 --- a/src/installer/tests/HostActivation.Tests/MultilevelSDKLookup.cs +++ b/src/installer/tests/HostActivation.Tests/MultilevelSDKLookup.cs @@ -93,7 +93,8 @@ public void Dispose() public void SdkMultilevelLookup_Global_Json_Single_Digit_Patch_Rollup() { // Set specified SDK version = 9999.3.4-global-dummy - SetGlobalJsonVersion("SingleDigit-global.json"); + string globalJsonPath = SetGlobalJsonVersion("SingleDigit-global.json"); + string requestedVersion = "9999.3.4-global-dummy"; // Specified SDK version: 9999.3.4-global-dummy // Cwd: empty @@ -111,7 +112,7 @@ public void SdkMultilevelLookup_Global_Json_Single_Digit_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion); // Add SDK versions AddAvailableSdkVersions(_exeSdkBaseDir, "9999.4.1", "9999.3.4-dummy"); @@ -132,7 +133,7 @@ public void SdkMultilevelLookup_Global_Json_Single_Digit_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion); // Add SDK versions AddAvailableSdkVersions(_regSdkBaseDir, "9999.3.3"); @@ -153,7 +154,7 @@ public void SdkMultilevelLookup_Global_Json_Single_Digit_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion); // Add SDK versions AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.4"); @@ -263,7 +264,8 @@ public void SdkMultilevelLookup_Global_Json_Single_Digit_Patch_Rollup() public void SdkMultilevelLookup_Global_Json_Two_Part_Patch_Rollup() { // Set specified SDK version = 9999.3.304-global-dummy - SetGlobalJsonVersion("TwoPart-global.json"); + string globalJsonPath = SetGlobalJsonVersion("TwoPart-global.json"); + string requestedVersion = "9999.3.304-global-dummy"; // Specified SDK version: 9999.3.304-global-dummy // Cwd: empty @@ -281,7 +283,7 @@ public void SdkMultilevelLookup_Global_Json_Two_Part_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion); // Add SDK versions AddAvailableSdkVersions(_regSdkBaseDir, "9999.3.57", "9999.3.4-dummy"); @@ -302,7 +304,7 @@ public void SdkMultilevelLookup_Global_Json_Two_Part_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion); // Add SDK versions AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.300", "9999.7.304-global-dummy"); @@ -323,7 +325,7 @@ public void SdkMultilevelLookup_Global_Json_Two_Part_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion); // Add SDK versions AddAvailableSdkVersions(_regSdkBaseDir, "9999.3.304"); @@ -488,12 +490,12 @@ public void SdkMultilevelLookup_RegistryAccess() { // The purpose of this test is to verify that the product uses correct code to access // the registry to extract the path to search for SDKs. - // Most of our tests rely on a shortcut which is to set _DOTNET_TEST_SDK_SELF_REGISTERED_DIR env variable + // Most of our tests rely on a shortcut which is to set _DOTNET_TEST_GLOBALLY_REGISTERED_PATH env variable // which will skip the registry reading code in the product and simply use the specified value. // This test is different since it actually runs the registry reading code. // Normally the reg key the product uses is in HKEY_LOCAL_MACHINE which is only writable as admin // so we would require the tests to run as admin to modify that key (and it may introduce races with other code running on the machine). - // So instead the tests use _DOTENT_TEST_SDK_REGISTRY_PATH env variable to point to the produce to use + // So instead the tests use _DOTENT_TEST_REGISTRY_PATH env variable to point to the produce to use // different registry key, inside the HKEY_CURRENT_USER hive which is writable without admin. // Note that the test creates a unique key (based on PID) for every run, to avoid collisions between parallel running tests. @@ -702,13 +704,14 @@ private void AddAvailableSdkVersions(string sdkBaseDir, params string[] availabl } // Put a global.json file in the cwd in order to specify a CLI - private void SetGlobalJsonVersion(string globalJsonFileName) + private string SetGlobalJsonVersion(string globalJsonFileName) { string destFile = Path.Combine(_currentWorkingDir, "global.json"); string srcFile = Path.Combine(RepoDirectories.TestAssetsFolder, "TestUtils", "SDKLookup", globalJsonFileName); File.Copy(srcFile, destFile, true); + return destFile; } private void WriteGlobalJson(string contents) diff --git a/src/installer/tests/HostActivation.Tests/MultilevelSharedFxLookup.cs b/src/installer/tests/HostActivation.Tests/MultilevelSharedFxLookup.cs index 788963fa33e49b..889ba0c7da383f 100644 --- a/src/installer/tests/HostActivation.Tests/MultilevelSharedFxLookup.cs +++ b/src/installer/tests/HostActivation.Tests/MultilevelSharedFxLookup.cs @@ -106,6 +106,9 @@ public MultilevelSharedFxLookup() _builtSharedUberFxDir = Path.Combine(_builtDotnet, "shared", "Microsoft.UberFramework", _sharedFxVersion); SharedFramework.CreateUberFrameworkArtifacts(_builtSharedFxDir, _builtSharedUberFxDir, SystemCollectionsImmutableAssemblyVersion, SystemCollectionsImmutableFileVersion); + // Empty Microsoft.NETCore.App directory - should not be recognized as a valid framework + Directory.CreateDirectory(Path.Combine(_exeSharedFxBaseDir, "9999.9.9")); + // Trace messages used to identify from which folder the framework was picked _hostPolicyDllName = Path.GetFileName(fixture.TestProject.HostPolicyDll); _exeSelectedMessage = $"The expected {_hostPolicyDllName} directory is [{_exeSharedFxBaseDir}"; @@ -237,7 +240,8 @@ public void SharedMultilevelFxLookup_Must_Verify_Folders_in_the_Correct_Order() .CaptureStdErr() .Execute() .Should().Pass() - .And.HaveStdOutContaining("Microsoft.NETCore.App 9999.0.0"); + .And.HaveStdOutContaining("Microsoft.NETCore.App 9999.0.0") + .And.HaveStdErrContaining("Ignoring FX version [9999.9.9] without .deps.json"); } [Fact] @@ -341,7 +345,8 @@ public void SharedMultilevelFxLookup_Must_Not_Roll_Forward_If_Framework_Version_ .And.HaveStdOutContaining("Microsoft.NETCore.App 9999.0.0-dummy2") .And.HaveStdOutContaining("Microsoft.NETCore.App 9999.0.2") .And.HaveStdOutContaining("Microsoft.NETCore.App 9999.0.3") - .And.HaveStdOutContaining("Microsoft.NETCore.App 9999.0.0-dummy3"); + .And.HaveStdOutContaining("Microsoft.NETCore.App 9999.0.0-dummy3") + .And.HaveStdErrContaining("Ignoring FX version [9999.9.9] without .deps.json"); } } } diff --git a/src/installer/tests/HostActivation.Tests/NativeHostApis.cs b/src/installer/tests/HostActivation.Tests/NativeHostApis.cs index aaabf8e571bcd2..659f8374619d9d 100644 --- a/src/installer/tests/HostActivation.Tests/NativeHostApis.cs +++ b/src/installer/tests/HostActivation.Tests/NativeHostApis.cs @@ -97,7 +97,7 @@ public SdkResolutionFixture(SharedTestState state) Directory.CreateDirectory(WorkingDir); - // start with an empty global.json, it will be ignored, but prevent one lying on disk + // start with an empty global.json, it will be ignored, but prevent one lying on disk // on a given machine from impacting the test. File.WriteAllText(GlobalJson, "{}"); @@ -117,12 +117,22 @@ public SdkResolutionFixture(SharedTestState state) foreach ((string fwName, string[] fwVersions) in ProgramFilesGlobalFrameworks) { foreach (string fwVersion in fwVersions) - Directory.CreateDirectory(Path.Combine(ProgramFilesGlobalFrameworksDir, fwName, fwVersion)); + AddFrameworkDirectory(ProgramFilesGlobalFrameworksDir, fwName, fwVersion); } foreach ((string fwName, string[] fwVersions) in LocalFrameworks) { foreach (string fwVersion in fwVersions) - Directory.CreateDirectory(Path.Combine(LocalFrameworksDir, fwName, fwVersion)); + AddFrameworkDirectory(LocalFrameworksDir, fwName, fwVersion); + + // Empty framework directory - this should not be recognized as a valid framework directory + Directory.CreateDirectory(Path.Combine(LocalFrameworksDir, fwName, "9.9.9")); + } + + static void AddFrameworkDirectory(string frameworkDir, string name, string version) + { + string versionDir = Path.Combine(frameworkDir, name, version); + Directory.CreateDirectory(versionDir); + File.WriteAllText(Path.Combine(versionDir, $"{name}.deps.json"), string.Empty); } } } @@ -230,7 +240,7 @@ public void Hostfxr_resolve_sdk2_without_global_json_and_disallowing_previews() [Fact] public void Hostfxr_resolve_sdk2_with_global_json_and_disallowing_previews() { - // With global.json specifying a preview, roll forward to preview + // With global.json specifying a preview, roll forward to preview // since flag has no impact if global.json specifies a preview. // Also check that global.json that impacted resolution is reported. @@ -461,11 +471,57 @@ public void Hostfxr_get_dotnet_environment_info_with_multilevel_lookup_only() } } + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] // Multi-level lookup is only supported on Windows. + public void Hostfxr_get_dotnet_environment_info_with_multilevel_lookup_only_self_register_program_files() + { + var f = new SdkResolutionFixture(sharedTestState); + + string expectedFrameworkNames = string.Join(';', new[] + { + "HostFxr.Test.A", + "HostFxr.Test.A", + "HostFxr.Test.B", + }); + + string expectedFrameworkVersions = string.Join(';', new[] + { + "1.2.3", + "3.0.0", + "5.6.7-A", + }); + + string expectedFrameworkPaths = string.Join(';', new[] + { + Path.Combine(f.ProgramFilesGlobalFrameworksDir, "HostFxr.Test.A"), + Path.Combine(f.ProgramFilesGlobalFrameworksDir, "HostFxr.Test.A"), + Path.Combine(f.ProgramFilesGlobalFrameworksDir, "HostFxr.Test.B"), + }); + + using (TestOnlyProductBehavior.Enable(f.Dotnet.GreatestVersionHostFxrFilePath)) + { + // We pass f.WorkingDir so that we don't resolve dotnet_dir to the global installation + // in the native side. + f.Dotnet.Exec(f.AppDll, new[] { "hostfxr_get_dotnet_environment_info", f.WorkingDir }) + .EnvironmentVariable("TEST_MULTILEVEL_LOOKUP_PROGRAM_FILES", f.ProgramFiles) + // Test with a self-registered path the same as ProgramFiles, with a trailing slash. Expect this to be de-duped + .EnvironmentVariable("TEST_MULTILEVEL_LOOKUP_SELF_REGISTERED", Path.Combine(f.ProgramFiles, "dotnet") + Path.DirectorySeparatorChar) + .CaptureStdOut() + .CaptureStdErr() + .Execute() + .Should().Pass() + .And.HaveStdOutContaining("hostfxr_get_dotnet_environment_info:Success") + .And.HaveStdOutContaining($"hostfxr_get_dotnet_environment_info framework names:[{expectedFrameworkNames}]") + .And.HaveStdOutContaining($"hostfxr_get_dotnet_environment_info framework versions:[{expectedFrameworkVersions}]") + .And.HaveStdOutContaining($"hostfxr_get_dotnet_environment_info framework paths:[{expectedFrameworkPaths}]"); + } + } + [Fact] public void Hostfxr_get_dotnet_environment_info_global_install_path() { var f = new SdkResolutionFixture(sharedTestState); - + f.Dotnet.Exec(f.AppDll, new[] { "hostfxr_get_dotnet_environment_info" }) .CaptureStdOut() .CaptureStdErr() diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs index 0af2ce34774127..792bf4faf6f8f6 100644 --- a/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs +++ b/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using HostActivation.Tests; using Microsoft.DotNet.Cli.Build.Framework; using System; using System.IO; @@ -88,6 +89,7 @@ public void GetHostFxrPath_DotNetRootParameter(bool explicitLoad, bool useAssemb } [Theory] + [ActiveIssue("https://github.com/dotnet/runtime/issues/61131", TestPlatforms.OSX)] [InlineData(true, false, true, false)] [InlineData(true, false, true, true)] [InlineData(true, false, false, false)] @@ -179,6 +181,7 @@ public void GetHostFxrPath_HostFxrAlreadyLoaded() } [Theory] + [ActiveIssue("https://github.com/dotnet/runtime/issues/61131", TestPlatforms.OSX)] [SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")] [InlineData("{0}", false, true)] [InlineData("{0}\n", false, true)] @@ -216,12 +219,21 @@ public void GetHostFxrPath_InstallLocationFile(string value, bool shouldUseArchS .DotNetRoot(null) .Execute(); - result.Should().HaveStdErrContaining($"Looking for install_location file in '{registeredInstallLocationOverride.PathValueOverride}'."); + if (shouldUseArchSpecificInstallLocation) + { + result.Should().HaveLookedForArchitectureSpecificInstallLocation( + registeredInstallLocationOverride.PathValueOverride, + sharedState.RepoDirectories.BuildArchitecture); + } + else + { + result.Should().HaveLookedForDefaultInstallLocation(registeredInstallLocationOverride.PathValueOverride); + } if (shouldPass) { result.Should().Pass() - .And.HaveStdErrContaining($"Using install location '{installLocation}'.") + .And.HaveUsedConfigFileInstallLocation(installLocation) .And.HaveStdOutContaining($"hostfxr_path: {sharedState.HostFxrPath}".ToLower()); } else @@ -235,35 +247,7 @@ public void GetHostFxrPath_InstallLocationFile(string value, bool shouldUseArchS } [Fact] - [SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")] - public void GetHostFxrPath_GlobalInstallation_HasMoreThanOneDefaultInstallationPath() - { - string installLocation = Path.Combine(sharedState.ValidInstallRoot, "dotnet"); - using (var registeredInstallLocationOverride = new RegisteredInstallLocationOverride(sharedState.NethostPath)) - { - registeredInstallLocationOverride.SetInstallLocation(new (string, string)[] { - (string.Empty, installLocation), (string.Empty, installLocation) - }); - - CommandResult result = Command.Create(sharedState.NativeHostPath, GetHostFxrPath) - .EnableTracingAndCaptureOutputs() - .ApplyRegisteredInstallLocationOverride(registeredInstallLocationOverride) - .EnvironmentVariable( // Redirect the default install location to an invalid location so that it doesn't cause the test to pass - Constants.TestOnlyEnvironmentVariables.DefaultInstallPath, - sharedState.InvalidInstallRoot) - .DotNetRoot(null) - .Execute(); - - result.Should().Pass() - .And.HaveStdErrContaining($"Looking for install_location file in '{registeredInstallLocationOverride.PathValueOverride}'.") - .And.HaveStdErrContaining($"Found install location path '{installLocation}'.") - .And.HaveStdErrContaining($"Only the first line in '{registeredInstallLocationOverride.PathValueOverride}' may not have an architecture prefix.") - .And.HaveStdErrContaining($"Using install location '{installLocation}'.") - .And.HaveStdOutContaining($"hostfxr_path: {sharedState.HostFxrPath}".ToLower()); - } - } - - [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/61131", TestPlatforms.OSX)] [SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")] public void GetHostFxrPath_GlobalInstallation_HasNoDefaultInstallationPath() { @@ -285,14 +269,16 @@ public void GetHostFxrPath_GlobalInstallation_HasNoDefaultInstallationPath() .Execute(); result.Should().Pass() - .And.HaveStdErrContaining($"Looking for install_location file in '{registeredInstallLocationOverride.PathValueOverride}'.") - .And.HaveStdErrContaining($"Found architecture-specific install location path: '{installLocation}' ('{sharedState.RepoDirectories.BuildArchitecture.ToLower()}').") - .And.HaveStdErrContaining($"Using install location '{installLocation}'.") + .And.HaveLookedForArchitectureSpecificInstallLocation( + registeredInstallLocationOverride.PathValueOverride, + sharedState.RepoDirectories.BuildArchitecture) + .And.HaveUsedConfigFileInstallLocation(installLocation) .And.HaveStdOutContaining($"hostfxr_path: {sharedState.HostFxrPath}".ToLower()); } } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/61131", TestPlatforms.OSX)] [SkipOnPlatform(TestPlatforms.Windows, "This test targets the install_location config file which is only used on Linux and macOS.")] public void GetHostFxrPath_GlobalInstallation_ArchitectureSpecificPathIsPickedOverDefaultPath() { @@ -314,10 +300,10 @@ public void GetHostFxrPath_GlobalInstallation_ArchitectureSpecificPathIsPickedOv .Execute(); result.Should().Pass() - .And.HaveStdErrContaining($"Looking for install_location file in '{registeredInstallLocationOverride.PathValueOverride}'.") - .And.HaveStdErrContaining($"Found install location path '{installLocation}/a/b/c'.") - .And.HaveStdErrContaining($"Found architecture-specific install location path: '{installLocation}' ('{sharedState.RepoDirectories.BuildArchitecture.ToLower()}').") - .And.HaveStdErrContaining($"Using install location '{installLocation}'.") + .And.HaveLookedForArchitectureSpecificInstallLocation( + registeredInstallLocationOverride.PathValueOverride, + sharedState.RepoDirectories.BuildArchitecture) + .And.HaveUsedConfigFileInstallLocation(installLocation) .And.HaveStdOutContaining($"hostfxr_path: {sharedState.HostFxrPath}".ToLower()); } } diff --git a/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs b/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs index 4b1b28e32f3ee2..7819f3ed2f14d8 100644 --- a/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs +++ b/src/installer/tests/HostActivation.Tests/PortableAppActivation.cs @@ -322,7 +322,8 @@ public void AppHost_FrameworkDependent_GlobalLocation_Succeeds(bool useRegistere .Execute() .Should().Pass() .And.HaveStdOutContaining("Hello World") - .And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion); + .And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion) + .And.NotHaveStdErr(); // Verify running from within the working directory Command.Create(appExe) @@ -336,7 +337,8 @@ public void AppHost_FrameworkDependent_GlobalLocation_Succeeds(bool useRegistere .Execute() .Should().Pass() .And.HaveStdOutContaining("Hello World") - .And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion); + .And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion) + .And.NotHaveStdErr(); } } @@ -474,8 +476,8 @@ public void AppHost_CLI_FrameworkDependent_MissingRuntimeFramework_ErrorReported .BinPath; expectedErrorCode = Constants.ErrorCode.FrameworkMissingFailure; - expectedStdErr = $"The framework '{Constants.MicrosoftNETCoreApp}', " + - $"version '{sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion}' ({fixture.RepoDirProvider.BuildArchitecture}) was not found."; + expectedStdErr = $"Framework: '{Constants.MicrosoftNETCoreApp}', " + + $"version '{sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion}' ({fixture.RepoDirProvider.BuildArchitecture})"; expectedUrlQuery = $"framework={Constants.MicrosoftNETCoreApp}&framework_version={sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion}"; } @@ -487,7 +489,7 @@ public void AppHost_CLI_FrameworkDependent_MissingRuntimeFramework_ErrorReported var result = command.WaitForExit(true); result.Should().Fail() - .And.HaveStdErrContaining($"- https://aka.ms/dotnet-core-applaunch?{expectedUrlQuery}") + .And.HaveStdErrContaining($"https://aka.ms/dotnet-core-applaunch?{expectedUrlQuery}") .And.HaveStdErrContaining(expectedStdErr); // Some Unix systems will have 8 bit exit codes. @@ -526,14 +528,16 @@ public void AppHost_GUI_FrameworkDependent_MissingRuntimeFramework_ErrorReported .MultilevelLookup(false) .Start(); - WaitForPopupFromProcess(command.Process); + WindowsUtils.WaitForPopupFromProcess(command.Process); command.Process.Kill(); + string expectedMissingFramework = $"'{Constants.MicrosoftNETCoreApp}', version '{sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion}' ({fixture.RepoDirProvider.BuildArchitecture})"; var result = command.WaitForExit(true) .Should().Fail() .And.HaveStdErrContaining($"Showing error dialog for application: '{Path.GetFileName(appExe)}' - error code: 0x{expectedErrorCode}") .And.HaveStdErrContaining($"url: 'https://aka.ms/dotnet-core-applaunch?{expectedUrlQuery}") - .And.HaveStdErrContaining("&gui=true"); + .And.HaveStdErrContaining("&gui=true") + .And.HaveStdErrMatching($"dialog message: (?>.|\\s)*{System.Text.RegularExpressions.Regex.Escape(expectedMissingFramework)}"); } } @@ -559,7 +563,7 @@ public void AppHost_GUI_MissingRuntime_ErrorReportedInDialog() .MultilevelLookup(false) .Start(); - WaitForPopupFromProcess(command.Process); + WindowsUtils.WaitForPopupFromProcess(command.Process); command.Process.Kill(); var expectedErrorCode = Constants.ErrorCode.CoreHostLibMissingFailure.ToString("x"); @@ -590,7 +594,7 @@ public void AppHost_GUI_NoCustomErrorWriter_FrameworkMissing_ErrorReportedInDial Directory.CreateDirectory(dotnetWithMockHostFxr); string expectedErrorCode = Constants.ErrorCode.FrameworkMissingFailure.ToString("x"); - var dotnetBuilder = new DotNetBuilder(dotnetWithMockHostFxr, sharedTestState.RepoDirectories.BuiltDotnet, "hostfxrFrameworkMissingFailure") + var dotnetBuilder = new DotNetBuilder(dotnetWithMockHostFxr, sharedTestState.RepoDirectories.BuiltDotnet, "mockhostfxrFrameworkMissingFailure") .RemoveHostFxr() .AddMockHostFxr(new Version(2, 2, 0)); var dotnet = dotnetBuilder.Build(); @@ -601,7 +605,7 @@ public void AppHost_GUI_NoCustomErrorWriter_FrameworkMissing_ErrorReportedInDial .MultilevelLookup(false) .Start(); - WaitForPopupFromProcess(command.Process); + WindowsUtils.WaitForPopupFromProcess(command.Process); command.Process.Kill(); command.WaitForExit(true) @@ -689,50 +693,6 @@ private string CreateAStore(TestProjectFixture testProjectFixture) return storeoutputDirectory; } -#if WINDOWS - private delegate bool EnumThreadWindowsDelegate(IntPtr hWnd, IntPtr lParam); - - [DllImport("user32.dll")] - private static extern bool EnumThreadWindows(int dwThreadId, EnumThreadWindowsDelegate plfn, IntPtr lParam); - - private IntPtr WaitForPopupFromProcess(Process process, int timeout = 60000) - { - IntPtr windowHandle = IntPtr.Zero; - int timeRemaining = timeout; - while (timeRemaining > 0) - { - foreach (ProcessThread thread in process.Threads) - { - // We take the last window we find. There really should only be one at most anyways. - EnumThreadWindows(thread.Id, - (hWnd, lParam) => { - windowHandle = hWnd; - return true; - }, - IntPtr.Zero); - } - - if (windowHandle != IntPtr.Zero) - { - break; - } - - System.Threading.Thread.Sleep(100); - timeRemaining -= 100; - } - - // Do not fail if the window could be detected, sometimes the check is fragile and doesn't work. - // Not worth the trouble trying to figure out why (only happens rarely in the CI system). - // We will rely on product tracing in the failure case. - return windowHandle; - } -#else - private IntPtr WaitForPopupFromProcess(Process process, int timeout = 60000) - { - throw new PlatformNotSupportedException(); - } -#endif - public class SharedTestState : IDisposable { public TestProjectFixture PortableAppFixture_Built { get; } diff --git a/src/installer/tests/HostActivation.Tests/RegisteredInstallLocationOverride.cs b/src/installer/tests/HostActivation.Tests/RegisteredInstallLocationOverride.cs index d37cfafe649537..fcb29470d9eeb0 100644 --- a/src/installer/tests/HostActivation.Tests/RegisteredInstallLocationOverride.cs +++ b/src/installer/tests/HostActivation.Tests/RegisteredInstallLocationOverride.cs @@ -56,10 +56,11 @@ public RegisteredInstallLocationOverride(string productBinaryPath) // On Linux/macOS the install location is registered in a file which is normally // located in /etc/dotnet/install_location // So we need to redirect it to a different place here. - string directory = Path.Combine(TestArtifact.TestArtifactsPath, "installLocationOverride"); + string directory = Path.Combine(TestArtifact.TestArtifactsPath, "installLocationOverride" + Process.GetCurrentProcess().Id.ToString()); + if (Directory.Exists(directory)) + Directory.Delete(directory, true); Directory.CreateDirectory(directory); - PathValueOverride = Path.Combine(directory, "install_location." + Process.GetCurrentProcess().Id.ToString()); - File.WriteAllText(PathValueOverride, ""); + PathValueOverride = directory; } } @@ -78,9 +79,12 @@ public void SetInstallLocation(params (string Architecture, string Path)[] locat } else { - File.WriteAllText(PathValueOverride, string.Join(Environment.NewLine, - locations.Select(l => string.Format("{0}{1}", - (!string.IsNullOrWhiteSpace(l.Architecture) ? l.Architecture + "=" : ""), l.Path)))); + foreach (var location in locations) + { + string installLocationFileName = "install_location" + + (!string.IsNullOrWhiteSpace(location.Architecture) ? ("_" + location.Architecture) : string.Empty); + File.WriteAllText(Path.Combine(PathValueOverride, installLocationFileName), location.Path); + } } } @@ -127,7 +131,7 @@ public static Command ApplyRegisteredInstallLocationOverride( else { return command.EnvironmentVariable( - Constants.TestOnlyEnvironmentVariables.InstallLocationFilePath, + Constants.TestOnlyEnvironmentVariables.InstallLocationPath, registeredInstallLocationOverride.PathValueOverride); } } diff --git a/src/installer/tests/HostActivation.Tests/SDKLookup.cs b/src/installer/tests/HostActivation.Tests/SDKLookup.cs index b587a019edabdf..15d02939c25de4 100644 --- a/src/installer/tests/HostActivation.Tests/SDKLookup.cs +++ b/src/installer/tests/HostActivation.Tests/SDKLookup.cs @@ -78,7 +78,8 @@ public void Dispose() public void SdkLookup_Global_Json_Single_Digit_Patch_Rollup() { // Set specified SDK version = 9999.3.4-global-dummy - CopyGlobalJson("SingleDigit-global.json"); + string globalJsonPath = CopyGlobalJson("SingleDigit-global.json"); + string requestedVersion = "9999.3.4-global-dummy"; // Specified SDK version: 9999.3.4-global-dummy // Exe: empty @@ -92,8 +93,8 @@ public void SdkLookup_Global_Json_Single_Digit_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version") - .And.HaveStdErrContaining("It was not possible to find any installed .NET SDKs") + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion) + .And.FindAnySdk(false) .And.HaveStdErrContaining("aka.ms/dotnet-download") .And.NotHaveStdErrContaining("Checking if resolved SDK dir"); @@ -112,8 +113,8 @@ public void SdkLookup_Global_Json_Single_Digit_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version") - .And.NotHaveStdErrContaining("It was not possible to find any installed .NET SDKs"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion) + .And.FindAnySdk(true); // Add SDK versions AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.3"); @@ -130,8 +131,8 @@ public void SdkLookup_Global_Json_Single_Digit_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version") - .And.NotHaveStdErrContaining("It was not possible to find any installed .NET SDKs"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion) + .And.FindAnySdk(true); // Add SDK versions AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.4"); @@ -223,7 +224,8 @@ public void SdkLookup_Global_Json_Single_Digit_Patch_Rollup() public void SdkLookup_Global_Json_Two_Part_Patch_Rollup() { // Set specified SDK version = 9999.3.304-global-dummy - CopyGlobalJson("TwoPart-global.json"); + string globalJsonPath = CopyGlobalJson("TwoPart-global.json"); + string requestedVersion = "9999.3.304-global-dummy"; // Specified SDK version: 9999.3.304-global-dummy // Exe: empty @@ -237,8 +239,8 @@ public void SdkLookup_Global_Json_Two_Part_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version") - .And.HaveStdErrContaining("It was not possible to find any installed .NET SDKs"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion) + .And.FindAnySdk(false); // Add SDK versions AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.57", "9999.3.4-dummy"); @@ -255,8 +257,8 @@ public void SdkLookup_Global_Json_Two_Part_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version") - .And.NotHaveStdErrContaining("It was not possible to find any installed .NET SDKs"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion) + .And.FindAnySdk(true); // Add SDK versions AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.300", "9999.7.304-global-dummy"); @@ -273,8 +275,8 @@ public void SdkLookup_Global_Json_Two_Part_Patch_Rollup() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("A compatible installed .NET SDK for global.json version") - .And.NotHaveStdErrContaining("It was not possible to find any installed .NET SDKs"); + .And.NotFindCompatibleSdk(globalJsonPath, requestedVersion) + .And.FindAnySdk(true); // Add SDK versions AddAvailableSdkVersions(_exeSdkBaseDir, "9999.3.304"); @@ -386,8 +388,7 @@ public void SdkLookup_Negative_Version() .CaptureStdErr() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining("It was not possible to find any installed .NET SDKs") - .And.HaveStdErrContaining("Install a .NET SDK from"); + .And.FindAnySdk(false); // Add SDK versions AddAvailableSdkVersions(_exeSdkBaseDir, "9999.0.4"); @@ -639,16 +640,13 @@ public void It_rolls_forward_as_expected(string policy, string requested, bool a if (expected == null) { result - .Should() - .Fail() - .And.HaveStdErrContaining($"A compatible installed .NET SDK for global.json version [{requested}] from [{globalJson}] was not found") - .And.HaveStdErrContaining($"Install the [{requested}] .NET SDK or update [{globalJson}] with an installed .NET SDK:"); + .Should().Fail() + .And.NotFindCompatibleSdk(globalJson, requested); } else { result - .Should() - .Pass() + .Should().Pass() .And.HaveStdErrContaining($"SDK path resolved to [{Path.Combine(_exeSdkBaseDir, expected)}]"); } } @@ -1268,13 +1266,14 @@ private void AddAvailableSdkVersions(string sdkBaseDir, params string[] availabl } // Put a global.json file in the cwd in order to specify a CLI - private void CopyGlobalJson(string globalJsonFileName) + private string CopyGlobalJson(string globalJsonFileName) { string destFile = Path.Combine(_currentWorkingDir, "global.json"); string srcFile = Path.Combine(RepoDirectories.TestAssetsFolder, "TestUtils", "SDKLookup", globalJsonFileName); File.Copy(srcFile, destFile, true); + return destFile; } private static string FormatGlobalJson(string version = null, string policy = null, bool? allowPrerelease = null) diff --git a/src/installer/tests/HostActivation.Tests/SDKResolutionCommandResultExtensions.cs b/src/installer/tests/HostActivation.Tests/SDKResolutionCommandResultExtensions.cs new file mode 100644 index 00000000000000..322af9abf695d8 --- /dev/null +++ b/src/installer/tests/HostActivation.Tests/SDKResolutionCommandResultExtensions.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO; +using FluentAssertions; +using Microsoft.DotNet.Cli.Build.Framework; + +namespace Microsoft.DotNet.CoreSetup.Test.HostActivation +{ + internal static class SDKResolutionCommandResultExtensions + { + public static AndConstraint FindAnySdk(this CommandResultAssertions assertion, bool shouldFindAnySdk) + { + string noSdkMessage = "No .NET SDKs were found"; + return shouldFindAnySdk + ? assertion.NotHaveStdErrContaining(noSdkMessage) + : assertion.HaveStdErrContaining(noSdkMessage) + .And.HaveStdErrContaining("Download a .NET SDK:"); + } + + public static AndConstraint NotFindCompatibleSdk(this CommandResultAssertions assertion, string globalJsonPath = null, string requestedVersion = null) + { + var constraint = assertion.HaveStdErrContaining("compatible .NET SDK was not found"); + + if (globalJsonPath is not null) + { + constraint = constraint.And.HaveStdErrContaining($"global.json file: {globalJsonPath}"); + } + + if (requestedVersion is not null) + { + constraint = constraint.And.HaveStdErrContaining($"Requested SDK version: {requestedVersion}"); + } + + if (globalJsonPath is not null && requestedVersion is not null) + { + constraint = constraint.And.HaveStdErrContaining($"Install the [{requestedVersion}] .NET SDK or update [{globalJsonPath}] to match an installed SDK."); + } + + return constraint; + } + } +} diff --git a/src/installer/tests/HostActivation.Tests/StandaloneAppActivation.cs b/src/installer/tests/HostActivation.Tests/StandaloneAppActivation.cs index 352abb04f0dc1b..cc561c618800ce 100644 --- a/src/installer/tests/HostActivation.Tests/StandaloneAppActivation.cs +++ b/src/installer/tests/HostActivation.Tests/StandaloneAppActivation.cs @@ -1,20 +1,17 @@ // 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.IO; +using System.Text; + using FluentAssertions; using Microsoft.DotNet.Cli.Build.Framework; using Microsoft.DotNet.CoreSetup.Test; using Microsoft.NET.HostModel.AppHost; -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Security.Cryptography; -using System.Text; -using System.Threading; using Xunit; -namespace Microsoft.DotNet.CoreSetup.Test.HostActivation +namespace HostActivation.Tests { public class StandaloneAppActivation : IClassFixture { @@ -203,15 +200,12 @@ public void Running_Publish_Output_Standalone_EXE_With_DOTNET_ROOT_Fails() // This verifies a self-contained apphost cannot use DOTNET_ROOT to reference a flat // self-contained layout since a flat layout of the shared framework is not supported. Command.Create(appExe) - .EnvironmentVariable("COREHOST_TRACE", "1") + .EnableTracingAndCaptureOutputs() .DotNetRoot(newOutDir) - .CaptureStdErr() - .CaptureStdOut() .Execute(fExpectedToFail: true) .Should().Fail() - .And.HaveStdErrContaining($"Using environment variable DOTNET_ROOT") // use the first part avoiding "(x86)" if present - .And.HaveStdErrContaining($"=[{Path.GetFullPath(newOutDir)}] as runtime location.") // use the last part - .And.HaveStdErrContaining("A fatal error occurred"); + .And.HaveUsedDotNetRootInstallLocation(Path.GetFullPath(newOutDir), fixture.CurrentRid) + .And.HaveStdErrContaining($"The required library {RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostfxr")} could not be found."); } [Fact] @@ -226,9 +220,7 @@ public void Running_Publish_Output_Standalone_EXE_with_Bound_AppHost_Succeeds() AppHostExtensions.BindAppHost(appExe); Command.Create(appExe) - .EnvironmentVariable("COREHOST_TRACE", "1") - .CaptureStdErr() - .CaptureStdOut() + .EnableTracingAndCaptureOutputs() .Execute() .Should().Pass() .And.HaveStdOutContaining("Hello World") diff --git a/src/installer/tests/HostActivation.Tests/StartupHooks.cs b/src/installer/tests/HostActivation.Tests/StartupHooks.cs index a0533a60fd4772..ab1f1846062162 100644 --- a/src/installer/tests/HostActivation.Tests/StartupHooks.cs +++ b/src/installer/tests/HostActivation.Tests/StartupHooks.cs @@ -13,6 +13,7 @@ public class StartupHooks : IClassFixture { private SharedTestState sharedTestState; private string startupHookVarName = "DOTNET_STARTUP_HOOKS"; + private string startupHookRuntimeConfigName = "STARTUP_HOOKS"; private string startupHookSupport = "System.StartupHookProvider.IsSupported"; public StartupHooks(StartupHooks.SharedTestState fixture) @@ -105,6 +106,64 @@ public void Muxer_activation_of_Multiple_StartupHooks_Succeeds() .And.HaveStdOutContaining("Hello World"); } + [Fact] + public void Muxer_activation_of_RuntimeConfig_StartupHook_Succeeds() + { + var fixture = sharedTestState.PortableAppFixture.Copy(); + var dotnet = fixture.BuiltDotnet; + var appDll = fixture.TestProject.AppDll; + + var startupHookFixture = sharedTestState.StartupHookFixture.Copy(); + var startupHookDll = startupHookFixture.TestProject.AppDll; + + RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson) + .WithProperty(startupHookRuntimeConfigName, startupHookDll) + .Save(); + + // RuntimeConfig defined startup hook + dotnet.Exec(appDll) + .CaptureStdOut() + .CaptureStdErr() + .Execute() + .Should().Pass() + .And.HaveStdOutContaining("Hello from startup hook!") + .And.HaveStdOutContaining("Hello World"); + } + + [Fact] + public void Muxer_activation_of_RuntimeConfig_And_Environment_StartupHooks_SucceedsInExpectedOrder() + { + var fixture = sharedTestState.PortableAppFixture.Copy(); + var dotnet = fixture.BuiltDotnet; + var appDll = fixture.TestProject.AppDll; + + var startupHookFixture = sharedTestState.StartupHookFixture.Copy(); + var startupHookDll = startupHookFixture.TestProject.AppDll; + + RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson) + .WithProperty(startupHookRuntimeConfigName, startupHookDll) + .Save(); + + var startupHook2Fixture = sharedTestState.StartupHookWithDependencyFixture.Copy(); + var startupHook2Dll = startupHook2Fixture.TestProject.AppDll; + + // include any char to counter output from other threads such as in #57243 + const string wildcardPattern = @"[\r\n\s.]*"; + + // RuntimeConfig and Environment startup hooks in expected order + dotnet.Exec(appDll) + .EnvironmentVariable(startupHookVarName, startupHook2Dll) + .CaptureStdOut() + .CaptureStdErr() + .Execute() + .Should().Pass() + .And.HaveStdOutMatching("Hello from startup hook with dependency!" + + wildcardPattern + + "Hello from startup hook!" + + wildcardPattern + + "Hello World"); + } + // Empty startup hook variable [Fact] public void Muxer_activation_of_Empty_StartupHook_Variable_Succeeds() @@ -120,7 +179,8 @@ public void Muxer_activation_of_Empty_StartupHook_Variable_Succeeds() .CaptureStdErr() .Execute() .Should().Pass() - .And.HaveStdOutContaining("Hello World"); + .And.HaveStdOutContaining("Hello World") + .And.NotHaveStdErr(); } // Run the app with a startup hook assembly that depends on assemblies not on the TPA list diff --git a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/Microsoft.DotNet.CoreSetup.Packaging.Tests.csproj b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/Microsoft.DotNet.CoreSetup.Packaging.Tests.csproj index 8dcef20c22dea9..73a3fda2b55fd4 100644 --- a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/Microsoft.DotNet.CoreSetup.Packaging.Tests.csproj +++ b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/Microsoft.DotNet.CoreSetup.Packaging.Tests.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs index 65d19d7983c413..cda507f61480de 100644 --- a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs +++ b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs @@ -18,7 +18,7 @@ public void NETCoreTargetingPackIsValid() "Microsoft.NETCore.App.Ref")) { // Allow no targeting pack in case this is a servicing build. - // This condition should be tightened: https://github.com/dotnet/core-setup/issues/8830 + // This condition should be tightened: https://github.com/dotnet/runtime/issues/3836 if (tester == null) { return; diff --git a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs index 4af9206f6b3513..292e3522d961e1 100644 --- a/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs +++ b/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs @@ -41,10 +41,7 @@ public static NuGetArtifactTester OpenOrNull( "Shipping", $"{id}.{dirs.MicrosoftNETCoreAppVersion}.nupkg"); - // If the nuspec exists, the nupkg should exist. - Assert.True(File.Exists(nupkgPath)); - - return new NuGetArtifactTester(nupkgPath); + return File.Exists(nupkgPath) ? new NuGetArtifactTester(nupkgPath) : null; } public PackageIdentity Identity { get; } diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundleTestBase.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundleTestBase.cs index 18aba06f6d9786..669b300cb838ad 100644 --- a/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundleTestBase.cs +++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundleTestBase.cs @@ -25,7 +25,7 @@ public static string UseSingleFileSelfContainedHost(TestProjectFixture testFixtu var publishedHostPath = BundleHelper.GetHostPath(testFixture); HostWriter.CreateAppHost(singleFileHost, publishedHostPath, - BundleHelper.GetAppPath(testFixture)); + BundleHelper.GetAppName(testFixture)); return publishedHostPath; } @@ -37,7 +37,7 @@ public static string UseFrameworkDependentHost(TestProjectFixture testFixture) var publishedHostPath = BundleHelper.GetHostPath(testFixture); HostWriter.CreateAppHost(appHost, publishedHostPath, - BundleHelper.GetAppPath(testFixture)); + BundleHelper.GetAppName(testFixture)); return publishedHostPath; } diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs index 66212592138151..9442777b7a5fdc 100644 --- a/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs +++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/BundledAppWithSubDirs.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.IO; using BundleTests.Helpers; using Microsoft.DotNet.Cli.Build.Framework; using Microsoft.DotNet.CoreSetup.Test; @@ -22,9 +23,7 @@ public BundledAppWithSubDirs(SharedTestState fixture) private void RunTheApp(string path, TestProjectFixture fixture) { Command.Create(path) - .EnvironmentVariable("COREHOST_TRACE", "1") - .CaptureStdErr() - .CaptureStdOut() + .EnableTracingAndCaptureOutputs() .EnvironmentVariable("DOTNET_ROOT", fixture.BuiltDotnet.BinPath) .EnvironmentVariable("DOTNET_ROOT(x86)", fixture.BuiltDotnet.BinPath) .EnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0") @@ -52,6 +51,47 @@ public void Bundled_Framework_dependent_App_Run_Succeeds(BundleOptions options) RunTheApp(singleFile, fixture); } + [InlineData(BundleOptions.None)] + [InlineData(BundleOptions.BundleNativeBinaries)] + [InlineData(BundleOptions.BundleAllContent)] + [Theory] + [PlatformSpecific(TestPlatforms.Windows)] // GUI app host is only supported on Windows. + public void Bundled_Framework_dependent_App_GUI_DownlevelHostFxr_ErrorDialog(BundleOptions options) + { + var fixture = sharedTestState.TestFrameworkDependentFixture.Copy(); + UseFrameworkDependentHost(fixture); + var singleFile = BundleHelper.BundleApp(fixture, options); + AppHostExtensions.SetWindowsGraphicalUserInterfaceBit(singleFile); + + string dotnetWithMockHostFxr = SharedFramework.CalculateUniqueTestDirectory(Path.Combine(TestArtifact.TestArtifactsPath, "bundleErrors")); + using (new TestArtifact(dotnetWithMockHostFxr)) + { + Directory.CreateDirectory(dotnetWithMockHostFxr); + string expectedErrorCode = Constants.ErrorCode.BundleExtractionFailure.ToString("x"); + + var dotnetBuilder = new DotNetBuilder(dotnetWithMockHostFxr, sharedTestState.RepoDirectories.BuiltDotnet, "mockhostfxrBundleVersionFailure") + .RemoveHostFxr() + .AddMockHostFxr(new Version(5, 0, 0)); + var dotnet = dotnetBuilder.Build(); + + Command command = Command.Create(singleFile) + .EnableTracingAndCaptureOutputs() + .DotNetRoot(dotnet.BinPath, sharedTestState.RepoDirectories.BuildArchitecture) + .MultilevelLookup(false) + .Start(); + + WindowsUtils.WaitForPopupFromProcess(command.Process); + command.Process.Kill(); + + command + .WaitForExit(true) + .Should().Fail() + .And.HaveStdErrContaining("Bundle header version compatibility check failed.") + .And.HaveStdErrContaining($"Showing error dialog for application: '{Path.GetFileName(singleFile)}' - error code: 0x{expectedErrorCode}") + .And.HaveStdErrContaining("apphost_version="); + } + } + [InlineData(BundleOptions.None)] [InlineData(BundleOptions.BundleNativeBinaries)] [InlineData(BundleOptions.BundleAllContent)] diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/ClsidMapTests.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/ClsidMapTests.cs index 649b34c500b879..8b496c191f222c 100644 --- a/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/ClsidMapTests.cs +++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/ClsidMapTests.cs @@ -20,7 +20,7 @@ public class ClsidMapTests : IClassFixture public ClsidMapTests(SharedTestState fixture) { - sharedTestState = fixture; + sharedTestState = fixture; } [Fact] @@ -122,7 +122,7 @@ private JObject CreateClsidMap(TestProjectFixture project) } using (var clsidMapFile = File.OpenText(clsidMapPath)) - using (var clsidMapReader = new JsonTextReader(clsidMapFile)) + using (var clsidMapReader = new JsonTextReader(clsidMapFile) { MaxDepth = null }) { return JObject.Load(clsidMapReader); } diff --git a/src/installer/tests/TestUtils/Command.cs b/src/installer/tests/TestUtils/Command.cs index 3c3e5607dde90a..91f85be3584324 100644 --- a/src/installer/tests/TestUtils/Command.cs +++ b/src/installer/tests/TestUtils/Command.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; @@ -120,7 +121,7 @@ private static bool ShouldUseCmd(string executable) } else { - // Search the path to see if we can find it + // Search the path to see if we can find it foreach (var path in System.Environment.GetEnvironmentVariable("PATH").Split(Path.PathSeparator)) { var candidate = Path.Combine(path, executable + ".exe"); @@ -196,7 +197,20 @@ public Command Start() ReportExecBegin(); - Process.Start(); + // Retry if we hit ETXTBSY due to Linux race + // https://github.com/dotnet/runtime/issues/58964 + for (int i = 0; ; i++) + { + try + { + Process.Start(); + break; + } + catch (Win32Exception e) when (i < 4 && e.Message.Contains("Text file busy")) + { + Thread.Sleep(i * 20); + } + } if (Process.StartInfo.RedirectStandardOutput) { diff --git a/src/installer/tests/HostActivation.Tests/CommandExtensions.cs b/src/installer/tests/TestUtils/CommandExtensions.cs similarity index 81% rename from src/installer/tests/HostActivation.Tests/CommandExtensions.cs rename to src/installer/tests/TestUtils/CommandExtensions.cs index d8460c1368bdb5..38c4cbff3ba448 100644 --- a/src/installer/tests/HostActivation.Tests/CommandExtensions.cs +++ b/src/installer/tests/TestUtils/CommandExtensions.cs @@ -2,10 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.DotNet.Cli.Build.Framework; +using Microsoft.DotNet.CoreSetup.Test; using System; using System.IO; -namespace Microsoft.DotNet.CoreSetup.Test.HostActivation +namespace Microsoft.DotNet.CoreSetup.Test { public static class CommandExtensions { @@ -38,11 +39,11 @@ public static Command EnableTracingAndCaptureOutputs(this Command command) public static Command DotNetRoot(this Command command, string dotNetRoot, string architecture = null) { if (!string.IsNullOrEmpty(architecture)) - return command.EnvironmentVariable($"DOTNET_ROOT_{architecture.ToUpper()}", dotNetRoot); + return command.EnvironmentVariable(Constants.DotnetRoot.ArchitectureEnvironmentVariablePrefix + architecture.ToUpper(), dotNetRoot); return command - .EnvironmentVariable("DOTNET_ROOT", dotNetRoot) - .EnvironmentVariable("DOTNET_ROOT(x86)", dotNetRoot); + .EnvironmentVariable(Constants.DotnetRoot.EnvironmentVariable, dotNetRoot) + .EnvironmentVariable(Constants.DotnetRoot.WindowsX86EnvironmentVariable, dotNetRoot); } public static Command MultilevelLookup(this Command command, bool enable) diff --git a/src/installer/tests/HostActivation.Tests/Constants.cs b/src/installer/tests/TestUtils/Constants.cs similarity index 86% rename from src/installer/tests/HostActivation.Tests/Constants.cs rename to src/installer/tests/TestUtils/Constants.cs index f7e743aa99aa38..e36df4bd2cdb39 100644 --- a/src/installer/tests/HostActivation.Tests/Constants.cs +++ b/src/installer/tests/TestUtils/Constants.cs @@ -1,9 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.DotNet.CoreSetup.Test.HostActivation +namespace Microsoft.DotNet.CoreSetup.Test { - internal static class Constants + public static class Constants { public const string MicrosoftNETCoreApp = "Microsoft.NETCore.App"; @@ -53,7 +53,7 @@ public static class TestOnlyEnvironmentVariables public const string DefaultInstallPath = "_DOTNET_TEST_DEFAULT_INSTALL_PATH"; public const string RegistryPath = "_DOTNET_TEST_REGISTRY_PATH"; public const string GloballyRegisteredPath = "_DOTNET_TEST_GLOBALLY_REGISTERED_PATH"; - public const string InstallLocationFilePath = "_DOTNET_TEST_INSTALL_LOCATION_FILE_PATH"; + public const string InstallLocationPath = "_DOTNET_TEST_INSTALL_LOCATION_PATH"; } public static class RuntimeId @@ -72,6 +72,13 @@ public static class HostTracing public const string TraceFileEnvironmentVariable = "COREHOST_TRACEFILE"; } + public static class DotnetRoot + { + public const string EnvironmentVariable = "DOTNET_ROOT"; + public const string WindowsX86EnvironmentVariable = "DOTNET_ROOT(x86)"; + public const string ArchitectureEnvironmentVariablePrefix = "DOTNET_ROOT_"; + } + public static class ErrorCode { public const int InvalidArgFailure = unchecked((int)0x80008081); @@ -81,6 +88,7 @@ public static class ErrorCode public const int LibHostInvalidArgs = unchecked((int)0x80008092); public const int AppArgNotRunnable = unchecked((int)0x80008094); public const int FrameworkMissingFailure = unchecked((int)0x80008096); + public const int BundleExtractionFailure = unchecked((int)0x8000809f); public const int COMPlusException = unchecked((int)0xe0434352); public const int SIGABRT = 134; diff --git a/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs b/src/installer/tests/TestUtils/DotNetBuilder.cs similarity index 83% rename from src/installer/tests/HostActivation.Tests/DotNetBuilder.cs rename to src/installer/tests/TestUtils/DotNetBuilder.cs index 0a8d54559e2275..d2d125fa581b83 100644 --- a/src/installer/tests/HostActivation.Tests/DotNetBuilder.cs +++ b/src/installer/tests/TestUtils/DotNetBuilder.cs @@ -5,7 +5,7 @@ using System; using System.IO; -namespace Microsoft.DotNet.CoreSetup.Test.HostActivation +namespace Microsoft.DotNet.CoreSetup.Test { /// /// Helper class for creating a mock version of a dotnet installation @@ -51,8 +51,7 @@ public DotNetBuilder(string basePath, string builtDotnet, string name) public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockHostPolicy(string version) { // ./shared/Microsoft.NETCore.App/ - create a mock of the root framework - string netCoreAppPath = Path.Combine(_path, "shared", "Microsoft.NETCore.App", version); - Directory.CreateDirectory(netCoreAppPath); + string netCoreAppPath = AddFramework(Constants.MicrosoftNETCoreApp, version); // ./shared/Microsoft.NETCore.App//hostpolicy.dll - this is a mock, will not actually load CoreCLR string mockHostPolicyFileName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("mockhostpolicy"); @@ -68,16 +67,19 @@ public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockHostPolicy(string versio /// Use a mock version of HostFxr. /// /// Version to add - /// - /// Currently, the only mock version of HostFxr that we have is mockhostfxr_2_2. - /// public DotNetBuilder AddMockHostFxr(Version version) { string hostfxrPath = Path.Combine(_path, "host", "fxr", version.ToString()); Directory.CreateDirectory(hostfxrPath); - bool hasCustomErrorWriter = version.Major >= 3; - string mockHostFxrFileName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform(hasCustomErrorWriter ? "mockhostfxr" : "mockhostfxr_2_2"); + string mockHostFxrFileNameBase = version switch + { + { Major: 2, Minor: 2 } => "mockhostfxr_2_2", + { Major: 5, Minor: 0 } => "mockhostfxr_5_0", + _ => throw new InvalidOperationException($"Unsupported version {version} of mockhostfxr.") + }; + + string mockHostFxrFileName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform(mockHostFxrFileNameBase); File.Copy( Path.Combine(_repoDirectories.Artifacts, "corehost_test", mockHostFxrFileName), Path.Combine(hostfxrPath, RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostfxr")), @@ -119,8 +121,7 @@ public DotNetBuilder RemoveHostFxr(Version version = null) public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockCoreClr(string version, Action customizer = null) { // ./shared/Microsoft.NETCore.App/ - create a mock of the root framework - string netCoreAppPath = Path.Combine(_path, "shared", "Microsoft.NETCore.App", version); - Directory.CreateDirectory(netCoreAppPath); + string netCoreAppPath = AddFramework(Constants.MicrosoftNETCoreApp, version); string hostPolicyFileName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostpolicy"); string coreclrFileName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("coreclr"); @@ -128,9 +129,9 @@ public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockCoreClr(string version, string currentRid = _repoDirectories.TargetRID; - NetCoreAppBuilder.ForNETCoreApp("Microsoft.NETCore.App", currentRid) + NetCoreAppBuilder.ForNETCoreApp(Constants.MicrosoftNETCoreApp, currentRid) .WithStandardRuntimeFallbacks() - .WithProject("Microsoft.NETCore.App", version, p => p + .WithProject(Constants.MicrosoftNETCoreApp, version, p => p .WithNativeLibraryGroup(null, g => g // ./shared/Microsoft.NETCore.App//coreclr.dll - this is a mock, will not actually run CoreClr .WithAsset((new NetCoreAppBuilder.RuntimeFileBuilder($"runtimes/{currentRid}/native/{coreclrFileName}")) @@ -155,19 +156,18 @@ public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockCoreClr(string version, /// Framework version /// Customization function for the runtime config /// - /// The added mock framework will only contain a runtime.config.json file. + /// The added mock framework will only contain a deps.json and a runtime.config.json file. /// public DotNetBuilder AddFramework( string name, string version, Action runtimeConfigCustomizer) { - // ./shared// - create a mock of effectively empty non-root framework - string path = Path.Combine(_path, "shared", name, version); - Directory.CreateDirectory(path); + // ./shared// - create a mock of the framework + string path = AddFramework(name, version); // ./shared///.runtimeconfig.json - runtime config which can be customized - RuntimeConfig runtimeConfig = new RuntimeConfig(Path.Combine(path, name + ".runtimeconfig.json")); + RuntimeConfig runtimeConfig = new RuntimeConfig(Path.Combine(path, $"{name}.runtimeconfig.json")); runtimeConfigCustomizer(runtimeConfig); runtimeConfig.Save(); @@ -190,6 +190,27 @@ public DotNetBuilder AddMockSDK( return this; } + /// + /// Add a minimal mock framework with the specified framework name and version + /// + /// Framework name + /// Framework version + /// Framework directory + /// + /// The added mock framework will only contain a deps.json. + /// + private string AddFramework(string name, string version) + { + // ./shared// - create a mock of effectively the framework + string path = Path.Combine(_path, "shared", name, version); + Directory.CreateDirectory(path); + + // ./shared///.deps.json - empty file + File.WriteAllText(Path.Combine(path, $"{name}.deps.json"), string.Empty); + + return path; + } + public DotNetCli Build() { return new DotNetCli(_path); diff --git a/src/installer/tests/TestUtils/FileUtils.cs b/src/installer/tests/TestUtils/FileUtils.cs index 8da68f684734bf..a66ead73e0b026 100644 --- a/src/installer/tests/TestUtils/FileUtils.cs +++ b/src/installer/tests/TestUtils/FileUtils.cs @@ -5,7 +5,7 @@ using System.IO; using System.IO.MemoryMappedFiles; -namespace Microsoft.DotNet.CoreSetup.Test.HostActivation +namespace Microsoft.DotNet.CoreSetup.Test { public static class FileUtils { diff --git a/src/installer/tests/HostActivation.Tests/NetCoreAppBuilder.cs b/src/installer/tests/TestUtils/NetCoreAppBuilder.cs similarity index 99% rename from src/installer/tests/HostActivation.Tests/NetCoreAppBuilder.cs rename to src/installer/tests/TestUtils/NetCoreAppBuilder.cs index ba5e101558c29d..f4909cde996799 100644 --- a/src/installer/tests/HostActivation.Tests/NetCoreAppBuilder.cs +++ b/src/installer/tests/TestUtils/NetCoreAppBuilder.cs @@ -7,7 +7,7 @@ using System.IO; using System.Linq; -namespace Microsoft.DotNet.CoreSetup.Test.HostActivation +namespace Microsoft.DotNet.CoreSetup.Test { public class NetCoreAppBuilder { diff --git a/src/installer/tests/HostActivation.Tests/RuntimeConfig.cs b/src/installer/tests/TestUtils/RuntimeConfig.cs similarity index 98% rename from src/installer/tests/HostActivation.Tests/RuntimeConfig.cs rename to src/installer/tests/TestUtils/RuntimeConfig.cs index eaa95cb2dcced0..5f9679aad5e0df 100644 --- a/src/installer/tests/HostActivation.Tests/RuntimeConfig.cs +++ b/src/installer/tests/TestUtils/RuntimeConfig.cs @@ -8,7 +8,7 @@ using System.IO; using System.Linq; -namespace Microsoft.DotNet.CoreSetup.Test.HostActivation +namespace Microsoft.DotNet.CoreSetup.Test { public class RuntimeConfig { @@ -120,7 +120,7 @@ public static RuntimeConfig FromFile(string path) if (File.Exists(path)) { using (TextReader textReader = File.OpenText(path)) - using (JsonTextReader reader = new JsonTextReader(textReader)) + using (var reader = new JsonTextReader(textReader) { MaxDepth = null }) { JObject root = (JObject)JToken.ReadFrom(reader); JObject runtimeOptions = (JObject)root["runtimeOptions"]; diff --git a/src/installer/tests/HostActivation.Tests/SharedFramework.cs b/src/installer/tests/TestUtils/SharedFramework.cs similarity index 99% rename from src/installer/tests/HostActivation.Tests/SharedFramework.cs rename to src/installer/tests/TestUtils/SharedFramework.cs index a887b2bf65160a..408cf58f37b4e1 100644 --- a/src/installer/tests/HostActivation.Tests/SharedFramework.cs +++ b/src/installer/tests/TestUtils/SharedFramework.cs @@ -10,7 +10,7 @@ namespace Microsoft.DotNet.CoreSetup.Test /// /// Helper class for creating, modifying and cleaning up shared frameworks /// - internal static class SharedFramework + public static class SharedFramework { private static readonly Mutex id_mutex = new Mutex(); diff --git a/src/installer/tests/TestUtils/SymbolicLinking.cs b/src/installer/tests/TestUtils/SymbolicLinking.cs index bf7dbf45df0c8a..50b476368fca6b 100644 --- a/src/installer/tests/TestUtils/SymbolicLinking.cs +++ b/src/installer/tests/TestUtils/SymbolicLinking.cs @@ -64,6 +64,7 @@ private enum SymbolicLinkFlag } [DllImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.U1)] private static extern bool CreateSymbolicLink( string symbolicLinkName, string targetFileName, diff --git a/src/installer/tests/TestUtils/TestArtifact.cs b/src/installer/tests/TestUtils/TestArtifact.cs index 8483e4c88f7a8a..e1ca67416377ee 100644 --- a/src/installer/tests/TestUtils/TestArtifact.cs +++ b/src/installer/tests/TestUtils/TestArtifact.cs @@ -3,7 +3,6 @@ #nullable enable -using Microsoft.DotNet.CoreSetup.Test.HostActivation; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/installer/tests/TestUtils/TestUtils.csproj b/src/installer/tests/TestUtils/TestUtils.csproj index 35cb3e19e9d77a..8b3aa595237265 100644 --- a/src/installer/tests/TestUtils/TestUtils.csproj +++ b/src/installer/tests/TestUtils/TestUtils.csproj @@ -15,6 +15,8 @@ + + diff --git a/src/installer/tests/TestUtils/WindowsUtils.cs b/src/installer/tests/TestUtils/WindowsUtils.cs new file mode 100644 index 00000000000000..aff4c1fef8297b --- /dev/null +++ b/src/installer/tests/TestUtils/WindowsUtils.cs @@ -0,0 +1,54 @@ +// 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.Runtime.InteropServices; + +namespace Microsoft.DotNet.CoreSetup.Test +{ + public static class WindowsUtils + { + private delegate bool EnumThreadWindowsDelegate(IntPtr hWnd, IntPtr lParam); + + [DllImport("user32.dll")] + private static extern bool EnumThreadWindows(int dwThreadId, EnumThreadWindowsDelegate plfn, IntPtr lParam); + + public static IntPtr WaitForPopupFromProcess(Process process, int timeout = 60000) + { + if (!OperatingSystem.IsWindows()) + { + throw new PlatformNotSupportedException(); + } + + IntPtr windowHandle = IntPtr.Zero; + int timeRemaining = timeout; + while (timeRemaining > 0) + { + foreach (ProcessThread thread in process.Threads) + { + // We take the last window we find. There really should only be one at most anyways. + EnumThreadWindows(thread.Id, + (hWnd, lParam) => { + windowHandle = hWnd; + return true; + }, + IntPtr.Zero); + } + + if (windowHandle != IntPtr.Zero) + { + break; + } + + System.Threading.Thread.Sleep(100); + timeRemaining -= 100; + } + + // Do not fail if the window could be detected, sometimes the check is fragile and doesn't work. + // Not worth the trouble trying to figure out why (only happens rarely in the CI system). + // We will rely on product tracing in the failure case. + return windowHandle; + } + } +} diff --git a/src/libraries/Common/src/Internal/Cryptography/HashProviderCng.cs b/src/libraries/Common/src/Internal/Cryptography/HashProviderCng.cs index 3b864790b25252..c905ca1bd6996e 100644 --- a/src/libraries/Common/src/Internal/Cryptography/HashProviderCng.cs +++ b/src/libraries/Common/src/Internal/Cryptography/HashProviderCng.cs @@ -127,10 +127,15 @@ public override void Reset() { if (_reusable && !_running) return; + DestroyHash(); + BCryptCreateHashFlags flags = _reusable ? + BCryptCreateHashFlags.BCRYPT_HASH_REUSABLE_FLAG : + BCryptCreateHashFlags.None; + SafeBCryptHashHandle hHash; - NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash(_hAlgorithm, out hHash, IntPtr.Zero, 0, _key, _key == null ? 0 : _key.Length, BCryptCreateHashFlags.None); + NTSTATUS ntStatus = Interop.BCrypt.BCryptCreateHash(_hAlgorithm, out hHash, IntPtr.Zero, 0, _key, _key == null ? 0 : _key.Length, flags); if (ntStatus != NTSTATUS.STATUS_SUCCESS) throw Interop.BCrypt.CreateCryptographicException(ntStatus); 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 6f0c53bac516c6..4342e47a194894 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 @@ -57,15 +57,17 @@ private static extern int SSLStreamInitializeImpl( [MarshalAs(UnmanagedType.U1)] bool isServer, SSLReadCallback streamRead, SSLWriteCallback streamWrite, - int appBufferSize); + int appBufferSize, + [MarshalAs(UnmanagedType.LPUTF8Str)] string? peerHost); internal static void SSLStreamInitialize( SafeSslHandle sslHandle, bool isServer, SSLReadCallback streamRead, SSLWriteCallback streamWrite, - int appBufferSize) + int appBufferSize, + string? peerHost) { - int ret = SSLStreamInitializeImpl(sslHandle, isServer, streamRead, streamWrite, appBufferSize); + int ret = SSLStreamInitializeImpl(sslHandle, isServer, streamRead, streamWrite, appBufferSize, peerHost); if (ret != SUCCESS) throw new SslException(); } @@ -85,6 +87,10 @@ internal static void SSLStreamSetTargetHost( throw new SslException(); } + [DllImport(Interop.Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_SSLStreamIsLocalCertificateUsed")] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool SSLStreamIsLocalCertificateUsed(SafeSslHandle sslHandle); + [DllImport(Interop.Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_SSLStreamRequestClientAuthentication")] internal static extern void SSLStreamRequestClientAuthentication(SafeSslHandle sslHandle); diff --git a/src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs b/src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs index f38bb375b347e5..7fbaf9cc32eab8 100644 --- a/src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs +++ b/src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs @@ -136,8 +136,9 @@ static Ldap() [DllImport(Libraries.OpenLdap, EntryPoint = "ldap_set_option", CharSet = CharSet.Ansi)] public static extern int ldap_set_option_referral([In] ConnectionHandle ldapHandle, [In] LdapOption option, ref LdapReferralCallback outValue); + // Note that ldap_start_tls_s has a different signature across Windows LDAP and OpenLDAP [DllImport(Libraries.OpenLdap, EntryPoint = "ldap_start_tls_s", CharSet = CharSet.Ansi)] - public static extern int ldap_start_tls(ConnectionHandle ldapHandle, ref int ServerReturnValue, ref IntPtr Message, IntPtr ServerControls, IntPtr ClientControls); + public static extern int ldap_start_tls(ConnectionHandle ldapHandle, IntPtr serverControls, IntPtr clientControls); [DllImport(Libraries.OpenLdap, EntryPoint = "ldap_parse_result", CharSet = CharSet.Ansi)] public static extern int ldap_parse_result([In] ConnectionHandle ldapHandle, [In] IntPtr result, ref int serverError, ref IntPtr dn, ref IntPtr message, ref IntPtr referral, ref IntPtr control, byte freeIt); diff --git a/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs b/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs index a85ec0a5f4ffbc..6cf23c170f9651 100644 --- a/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs +++ b/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs @@ -19,10 +19,6 @@ internal static partial class procfs private const string FileDescriptorDirectoryName = "/fd/"; private const string TaskDirectoryName = "/task/"; - internal const string SelfExeFilePath = RootPath + "self" + ExeFileName; - internal const string SelfCmdLineFilePath = RootPath + "self" + CmdLineFileName; - internal const string ProcStatFilePath = RootPath + "stat"; - internal struct ParsedStat { // Commented out fields are available in the stat data file but diff --git a/src/libraries/Common/src/Interop/OSX/Interop.libproc.cs b/src/libraries/Common/src/Interop/OSX/Interop.libproc.cs index fd4b968c132ea8..af75653dd2f3c4 100644 --- a/src/libraries/Common/src/Interop/OSX/Interop.libproc.cs +++ b/src/libraries/Common/src/Interop/OSX/Interop.libproc.cs @@ -25,6 +25,9 @@ internal static partial class libproc // Constants from sys\resource.h private const int RUSAGE_INFO_V3 = 3; + // Constants from sys/errno.h + private const int EPERM = 1; + // Defines from proc_info.h internal enum ThreadRunState { @@ -120,7 +123,14 @@ internal static unsafe int[] proc_listallpids() { // Get the number of processes currently running to know how much data to allocate int numProcesses = proc_listallpids(null, 0); - if (numProcesses <= 0) + if (numProcesses == 0 && Marshal.GetLastPInvokeError() == EPERM) + { + // An app running in App Sandbox does not have permissions to list other running processes + // and so the `proc_listallpids` function returns 0 and sets errno to 1. As a fallback + // we return at least an array with the PID of the current process which we always know. + return new[] { Environment.ProcessId }; + } + else if (numProcesses <= 0) { throw new Win32Exception(SR.CantGetAllPids); } diff --git a/src/libraries/Common/src/Interop/OSX/System.Native/Interop.SearchPath.iOS.cs b/src/libraries/Common/src/Interop/OSX/System.Native/Interop.SearchPath.iOS.cs new file mode 100644 index 00000000000000..8d73184ca4d50a --- /dev/null +++ b/src/libraries/Common/src/Interop/OSX/System.Native/Interop.SearchPath.iOS.cs @@ -0,0 +1,14 @@ +// 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.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Sys + { + [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SearchPath_TempDirectory")] + internal static extern string SearchPathTempDirectory(); + } +} diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.RSA.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.RSA.cs index f0ebcf94d95e54..69b0c03f65e2eb 100644 --- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.RSA.cs +++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.RSA.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Buffers; using System.Diagnostics; using System.Runtime.InteropServices; using System.Security.Cryptography; @@ -111,6 +112,22 @@ private static extern int RsaDecryptPkcs( out SafeCFDataHandle pEncryptedOut, out SafeCFErrorHandle pErrorOut); + private static int RsaDecryptRaw( + SafeSecKeyRefHandle publicKey, + ReadOnlySpan pbData, + int cbData, + out SafeCFDataHandle pEncryptedOut, + out SafeCFErrorHandle pErrorOut) => + RsaDecryptRaw(publicKey, ref MemoryMarshal.GetReference(pbData), cbData, out pEncryptedOut, out pErrorOut); + + [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_RsaDecryptRaw")] + private static extern int RsaDecryptRaw( + SafeSecKeyRefHandle publicKey, + ref byte pbData, + int cbData, + out SafeCFDataHandle pEncryptedOut, + out SafeCFErrorHandle pErrorOut); + internal static void RsaGenerateKey( int keySizeInBits, out SafeSecKeyRefHandle pPublicKey, @@ -200,17 +217,40 @@ internal static byte[] RsaDecrypt( byte[] data, RSAEncryptionPadding padding) { + if (padding == RSAEncryptionPadding.Pkcs1) + { + byte[] padded = ExecuteTransform( + data, + (ReadOnlySpan source, out SafeCFDataHandle decrypted, out SafeCFErrorHandle error) => + RsaDecryptRaw(privateKey, source, source.Length, out decrypted, out error)); + + byte[] depad = CryptoPool.Rent(padded.Length); + OperationStatus status = RsaPaddingProcessor.DepadPkcs1Encryption(padded, depad, out int written); + byte[]? ret = null; + + if (status == OperationStatus.Done) + { + ret = depad.AsSpan(0, written).ToArray(); + } + + // Clear the whole thing, especially on failure. + CryptoPool.Return(depad); + CryptographicOperations.ZeroMemory(padded); + + if (ret is null) + { + throw new CryptographicException(SR.Cryptography_InvalidPadding); + } + + return ret; + } + + Debug.Assert(padding.Mode == RSAEncryptionPaddingMode.Oaep); + return ExecuteTransform( data, (ReadOnlySpan source, out SafeCFDataHandle decrypted, out SafeCFErrorHandle error) => { - if (padding == RSAEncryptionPadding.Pkcs1) - { - return RsaDecryptPkcs(privateKey, source, source.Length, out decrypted, out error); - } - - Debug.Assert(padding.Mode == RSAEncryptionPaddingMode.Oaep); - return RsaDecryptOaep( privateKey, source, @@ -229,14 +269,63 @@ internal static bool TryRsaDecrypt( out int bytesWritten) { Debug.Assert(padding.Mode == RSAEncryptionPaddingMode.Pkcs1 || padding.Mode == RSAEncryptionPaddingMode.Oaep); + + if (padding.Mode == RSAEncryptionPaddingMode.Pkcs1) + { + byte[] padded = CryptoPool.Rent(source.Length); + byte[] depad = CryptoPool.Rent(source.Length); + + bool processed = TryExecuteTransform( + source, + padded, + out int paddedLength, + (ReadOnlySpan innerSource, out SafeCFDataHandle outputHandle, out SafeCFErrorHandle errorHandle) => + RsaDecryptRaw(privateKey, innerSource, innerSource.Length, out outputHandle, out errorHandle)); + + Debug.Assert( + processed, + "TryExecuteTransform should always return true for a large enough buffer."); + + OperationStatus status = OperationStatus.InvalidData; + int depaddedLength = 0; + + if (processed) + { + status = RsaPaddingProcessor.DepadPkcs1Encryption( + new ReadOnlySpan(padded, 0, paddedLength), + depad, + out depaddedLength); + } + + CryptoPool.Return(padded); + + if (status == OperationStatus.Done) + { + if (depaddedLength <= destination.Length) + { + depad.AsSpan(0, depaddedLength).CopyTo(destination); + CryptoPool.Return(depad); + bytesWritten = depaddedLength; + return true; + } + + CryptoPool.Return(depad); + bytesWritten = 0; + return false; + } + + CryptoPool.Return(depad); + Debug.Assert(status == OperationStatus.InvalidData); + throw new CryptographicException(SR.Cryptography_InvalidPadding); + } + return TryExecuteTransform( source, destination, out bytesWritten, delegate (ReadOnlySpan innerSource, out SafeCFDataHandle outputHandle, out SafeCFErrorHandle errorHandle) { - return padding.Mode == RSAEncryptionPaddingMode.Pkcs1 ? - RsaDecryptPkcs(privateKey, innerSource, innerSource.Length, out outputHandle, out errorHandle) : + return RsaDecryptOaep(privateKey, innerSource, innerSource.Length, PalAlgorithmFromAlgorithmName(padding.OaepHashAlgorithm), out outputHandle, out errorHandle); }); } diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.SecKeyRef.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.SecKeyRef.cs index a479faf2be5598..221db64e187abb 100644 --- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.SecKeyRef.cs +++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.SecKeyRef.cs @@ -127,6 +127,10 @@ internal static bool TrySecKeyCopyExternalRepresentation( { const int errSecPassphraseRequired = -25260; + // macOS Sonoma 14.4 started returning errSecInvalidKeyAttributeMask when a key could not be exported + // because it must be exported with a password. + const int errSecInvalidKeyAttributeMask = -67738; + int result = AppleCryptoNative_SecKeyCopyExternalRepresentation( key, out SafeCFDataHandle data, @@ -141,7 +145,7 @@ internal static bool TrySecKeyCopyExternalRepresentation( externalRepresentation = CoreFoundation.CFGetData(data); return true; case kErrorSeeError: - if (Interop.CoreFoundation.GetErrorCode(errorHandle) == errSecPassphraseRequired) + if (Interop.CoreFoundation.GetErrorCode(errorHandle) is errSecPassphraseRequired or errSecInvalidKeyAttributeMask) { externalRepresentation = Array.Empty(); return false; diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.PosixFAllocate.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FAllocate.cs similarity index 63% rename from src/libraries/Common/src/Interop/Unix/System.Native/Interop.PosixFAllocate.cs rename to src/libraries/Common/src/Interop/Unix/System.Native/Interop.FAllocate.cs index 2866ed38935bdf..71155e0f35e67e 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.PosixFAllocate.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.FAllocate.cs @@ -9,9 +9,9 @@ internal static partial class Interop internal static partial class Sys { /// - /// Returns -1 on ENOSPC, -2 on EFBIG. On success or ignorable error, 0 is returned. + /// Returns -1 on error, 0 on success. /// - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PosixFAllocate", SetLastError = false)] - internal static extern int PosixFAllocate(SafeFileHandle fd, long offset, long length); + [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FAllocate", SetLastError = true)] + internal static extern int FAllocate(SafeFileHandle fd, long offset, long length); } } diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetBootTimeTicks.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetBootTimeTicks.cs new file mode 100644 index 00000000000000..e068ba47911365 --- /dev/null +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetBootTimeTicks.cs @@ -0,0 +1,14 @@ +// 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 Sys + { + [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetBootTimeTicks")] + [SuppressGCTransition] + internal static extern long GetBootTimeTicks(); + } +} diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetDefaultTimeZone.Android.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetDefaultTimeZone.AnyMobile.cs similarity index 100% rename from src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetDefaultTimeZone.Android.cs rename to src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetDefaultTimeZone.AnyMobile.cs diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetEnv.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetEnv.cs new file mode 100644 index 00000000000000..d83d6700b51622 --- /dev/null +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetEnv.cs @@ -0,0 +1,14 @@ +// 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.Runtime.InteropServices; + +internal static partial class Interop +{ + internal unsafe partial class Sys + { + [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetEnv")] + internal static extern unsafe IntPtr GetEnv(string name); + } +} \ No newline at end of file diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetEnviron.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetEnviron.cs new file mode 100644 index 00000000000000..abe8ff0e1916ec --- /dev/null +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetEnviron.cs @@ -0,0 +1,17 @@ +// 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.Runtime.InteropServices; + +internal static partial class Interop +{ + internal unsafe partial class Sys + { + [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetEnviron")] + internal static extern unsafe IntPtr GetEnviron(); + + [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_FreeEnviron")] + internal static extern unsafe void FreeEnviron(IntPtr environ); + } +} \ No newline at end of file diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs index 15d6aa3c2f147a..fbd95d485e8415 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs @@ -80,6 +80,7 @@ private static DriveType GetDriveType(string fileSystemName) // This list is based primarily on "man fs", "man mount", "mntent.h", "/proc/filesystems", coreutils "stat.c", // and "wiki.debian.org/FileSystem". It can be extended over time as we find additional file systems that should // be recognized as a particular drive type. + // Keep this in sync with the UnixFileSystemTypes enum in Interop.UnixFileSystemTypes.cs switch (fileSystemName) { case "cddafs": diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.UnixFileSystemTypes.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.UnixFileSystemTypes.cs index 892e5ccaaed336..d86dcfbe4e59ae 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.UnixFileSystemTypes.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.UnixFileSystemTypes.cs @@ -28,6 +28,7 @@ internal enum UnixFileSystemTypes : long befs = 0x42465331, bdevfs = 0x62646576, bfs = 0x1BADFACE, + bpf_fs = 0xCAFE4A11, binfmt_misc = 0x42494E4D, bootfs = 0xA56D3FF9, btrfs = 0x9123683E, @@ -53,6 +54,7 @@ internal enum UnixFileSystemTypes : long ext2 = 0xEF53, ext3 = 0xEF53, ext4 = 0xEF53, + f2fs = 0xF2F52010, fat = 0x4006, fd = 0xF00D1E, fhgfs = 0x19830326, @@ -122,6 +124,7 @@ internal enum UnixFileSystemTypes : long sysv2 = 0x012FF7B6, sysv4 = 0x012FF7B5, tmpfs = 0x01021994, + tracefs = 0x74726163, ubifs = 0x24051905, udf = 0x15013346, ufs = 0x00011954, diff --git a/src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.Initialization.cs b/src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.Initialization.cs index 39a0d67f2021cb..cf55076dfbb45e 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.Initialization.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.Initialization.cs @@ -24,11 +24,6 @@ static SslInitializer() //Call ssl specific initializer Ssl.EnsureLibSslInitialized(); - if (Interop.Crypto.ErrPeekLastError() != 0) - { - // It is going to be wrapped in a type load exception but will have the error information - throw Interop.Crypto.CreateOpenSslCryptographicException(); - } } #endif 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 924c2da14d4b59..4e82a6faf507e9 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( } [DllImport(Libraries.CryptoNative)] - private static extern int CryptoNative_GetPkcs8PrivateKeySize(IntPtr pkey); + private static extern 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; } [DllImport(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 73a9d32bb45c84..ae608c372778c9 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 @@ -59,7 +59,7 @@ internal static SafeSslHandle AllocateSslContext(SslProtocols protocols, SafeX50 throw CreateSslException(SR.net_allocate_ssl_context_failed); } - if (!Interop.Ssl.Tls13Supported) + if (!Interop.Ssl.Capabilities.Tls13Supported) { if (protocols != SslProtocols.None && CipherSuitesPolicyPal.WantsTls13(protocols)) 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 29154b77da6325..64db5a15147a4c 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 @@ -141,9 +141,13 @@ internal static partial class Ssl } [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_Tls13Supported")] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool Tls13SupportedImpl(); - internal static readonly bool Tls13Supported = Tls13SupportedImpl(); + private static extern int Tls13SupportedImpl(); + + internal static class Capabilities + { + // needs separate type (separate static cctor) to be sure OpenSSL is initialized. + internal static readonly bool Tls13Supported = Tls13SupportedImpl() != 0; + } internal static SafeSharedX509NameStackHandle SslGetClientCAList(SafeSslHandle ssl) { diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.QueryServiceStatusEx.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.QueryServiceStatusEx.cs new file mode 100644 index 00000000000000..f5793d56db2488 --- /dev/null +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.QueryServiceStatusEx.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.Win32.SafeHandles; +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Advapi32 + { + [StructLayout(LayoutKind.Sequential)] + internal struct SERVICE_STATUS_PROCESS + { + public int dwServiceType; + public int dwCurrentState; + public int dwControlsAccepted; + public int dwWin32ExitCode; + public int dwServiceSpecificExitCode; + public int dwCheckPoint; + public int dwWaitHint; + public int dwProcessId; + public int dwServiceFlags; + } + + private const int SC_STATUS_PROCESS_INFO = 0; + + [DllImport(Libraries.Advapi32, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static unsafe extern bool QueryServiceStatusEx(SafeServiceHandle serviceHandle, int InfoLevel, SERVICE_STATUS_PROCESS* pStatus, int cbBufSize, out int pcbBytesNeeded); + + internal static unsafe bool QueryServiceStatusEx(SafeServiceHandle serviceHandle, SERVICE_STATUS_PROCESS* pStatus) => QueryServiceStatusEx(serviceHandle, SC_STATUS_PROCESS_INFO, pStatus, sizeof(SERVICE_STATUS_PROCESS), out _); + } +} diff --git a/src/libraries/Common/src/Interop/Windows/Interop.Errors.cs b/src/libraries/Common/src/Interop/Windows/Interop.Errors.cs index d5f6d1637507fa..424b57f7a8d7ba 100644 --- a/src/libraries/Common/src/Interop/Windows/Interop.Errors.cs +++ b/src/libraries/Common/src/Interop/Windows/Interop.Errors.cs @@ -63,6 +63,8 @@ internal static partial class Errors internal const int ERROR_IO_PENDING = 0x3E5; internal const int ERROR_NO_TOKEN = 0x3f0; internal const int ERROR_SERVICE_DOES_NOT_EXIST = 0x424; + internal const int ERROR_EXCEPTION_IN_SERVICE = 0x428; + internal const int ERROR_PROCESS_ABORTED = 0x42B; internal const int ERROR_NO_UNICODE_TRANSLATION = 0x459; internal const int ERROR_DLL_INIT_FAILED = 0x45A; internal const int ERROR_COUNTER_TIMEOUT = 0x461; diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateSymbolicLink.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateSymbolicLink.cs index 9ecd41c46bd6b3..2981c209e06f3f 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateSymbolicLink.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateSymbolicLink.cs @@ -21,6 +21,7 @@ internal static partial class Kernel32 internal const int SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE = 0x2; [DllImport(Libraries.Kernel32, EntryPoint = "CreateSymbolicLinkW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)] + [return: MarshalAs(UnmanagedType.U1)] private static extern bool CreateSymbolicLinkPrivate(string lpSymlinkFileName, string lpTargetFileName, int dwFlags); /// @@ -38,9 +39,8 @@ internal static void CreateSymbolicLink(string symlinkFileName, string targetFil int flags = 0; - bool isAtLeastWin10Build14972 = - Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build >= 14972 || - Environment.OSVersion.Version.Major >= 11; + Version osVersion = Environment.OSVersion.Version; + bool isAtLeastWin10Build14972 = osVersion.Major >= 11 || osVersion.Major == 10 && osVersion.Build >= 14972; if (isAtLeastWin10Build14972) { @@ -54,17 +54,10 @@ internal static void CreateSymbolicLink(string symlinkFileName, string targetFil bool success = CreateSymbolicLinkPrivate(symlinkFileName, targetFileName, flags); - int error; if (!success) { throw Win32Marshal.GetExceptionForLastWin32Error(originalPath); } - // In older versions we need to check GetLastWin32Error regardless of the return value of CreateSymbolicLink, - // e.g: if the user doesn't have enough privileges to create a symlink the method returns success which we can consider as a silent failure. - else if (!isAtLeastWin10Build14972 && (error = Marshal.GetLastWin32Error()) != 0) - { - throw Win32Marshal.GetExceptionForWin32Error(error, originalPath); - } } } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FileOperations.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FileOperations.cs index cc4896c1c52e48..c43b4fd19d21d2 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FileOperations.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FileOperations.cs @@ -23,7 +23,8 @@ internal static partial class FileOperations internal const int FILE_FLAG_OVERLAPPED = 0x40000000; internal const int FILE_LIST_DIRECTORY = 0x0001; - } + internal const int FILE_WRITE_ATTRIBUTES = 0x100; + } } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetProcAddress.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetProcAddress.cs index 214050545ed15b..08a2f9ffd33f0d 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetProcAddress.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetProcAddress.cs @@ -10,8 +10,10 @@ internal static partial class Interop { internal static partial class Kernel32 { +#if !MS_IO_REDIST // SafeLibraryHandle is inaccessible due to its protection level [DllImport(Libraries.Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false)] public static extern IntPtr GetProcAddress(SafeLibraryHandle hModule, string lpProcName); +#endif [DllImport(Libraries.Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false)] public static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName); diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetTempPathW.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetTempPathW.cs index 5d555df58cd23a..80c71479c8e510 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetTempPathW.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetTempPathW.cs @@ -9,5 +9,8 @@ internal static partial class Kernel32 { [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)] internal static extern uint GetTempPathW(int bufferLen, ref char buffer); + + [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)] + internal static extern uint GetTempPath2W(int bufferLen, ref char buffer); } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.REPARSE_DATA_BUFFER.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.REPARSE_DATA_BUFFER.cs index 3bcb9162d57bfc..123ac9235b9fdc 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.REPARSE_DATA_BUFFER.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.REPARSE_DATA_BUFFER.cs @@ -14,24 +14,29 @@ internal static partial class Kernel32 internal const uint SYMLINK_FLAG_RELATIVE = 1; // https://msdn.microsoft.com/library/windows/hardware/ff552012.aspx - // We don't need all the struct fields; omitting the rest. [StructLayout(LayoutKind.Sequential)] - internal unsafe struct REPARSE_DATA_BUFFER + internal unsafe struct SymbolicLinkReparseBuffer { internal uint ReparseTag; internal ushort ReparseDataLength; internal ushort Reserved; - internal SymbolicLinkReparseBuffer ReparseBufferSymbolicLink; + internal ushort SubstituteNameOffset; + internal ushort SubstituteNameLength; + internal ushort PrintNameOffset; + internal ushort PrintNameLength; + internal uint Flags; + } - [StructLayout(LayoutKind.Sequential)] - internal struct SymbolicLinkReparseBuffer - { - internal ushort SubstituteNameOffset; - internal ushort SubstituteNameLength; - internal ushort PrintNameOffset; - internal ushort PrintNameLength; - internal uint Flags; - } + [StructLayout(LayoutKind.Sequential)] + internal struct MountPointReparseBuffer + { + public uint ReparseTag; + public ushort ReparseDataLength; + public ushort Reserved; + public ushort SubstituteNameOffset; + public ushort SubstituteNameLength; + public ushort PrintNameOffset; + public ushort PrintNameLength; } } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.Threading.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.Threading.cs index d4919d725a52cd..3eb2c7ccbf4d57 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.Threading.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.Threading.cs @@ -71,5 +71,9 @@ internal enum ThreadPriority : int [DllImport(Libraries.Kernel32)] internal static extern bool SetThreadPriority(SafeWaitHandle hThread, int nPriority); + + [DllImport(Libraries.Kernel32, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + internal static extern bool GetThreadIOPendingFlag(nint hThread, out BOOL lpIOIsPending); } } diff --git a/src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs b/src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs index 1694ca539a86a9..098057aca7cd5b 100644 --- a/src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs +++ b/src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs @@ -67,8 +67,10 @@ internal enum ContextAttribute SECPKG_ATTR_ISSUER_LIST_EX = 0x59, // returns SecPkgContext_IssuerListInfoEx SECPKG_ATTR_CLIENT_CERT_POLICY = 0x60, // sets SecPkgCred_ClientCertCtlPolicy SECPKG_ATTR_CONNECTION_INFO = 0x5A, // returns SecPkgContext_ConnectionInfo + SECPKG_ATTR_SESSION_INFO = 0x5D, // sets SecPkgContext_SessionInfo SECPKG_ATTR_CIPHER_INFO = 0x64, // returns SecPkgContext_CipherInfo - SECPKG_ATTR_UI_INFO = 0x68, // sets SEcPkgContext_UiInfo + SECPKG_ATTR_REMOTE_CERT_CHAIN = 0x67, // returns PCCERT_CONTEXT + SECPKG_ATTR_UI_INFO = 0x68, // sets SEcPkgContext_UiInfo } // These values are defined within sspi.h as ISC_REQ_*, ISC_RET_*, ASC_REQ_* and ASC_RET_*. @@ -330,6 +332,21 @@ internal unsafe struct SecPkgCred_ClientCertPolicy public char* pwszSslCtlIdentifier; } + [StructLayout(LayoutKind.Sequential)] + internal unsafe struct SecPkgContext_SessionInfo + { + public uint dwFlags; + public uint cbSessionId; + public fixed byte rgbSessionId[32]; + + [Flags] + public enum Flags + { + Zero = 0, + SSL_SESSION_RECONNECT = 0x01, + }; + } + [DllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)] internal static extern int EncryptMessage( ref CredHandle contextHandle, diff --git a/src/libraries/Common/src/Interop/Windows/SspiCli/SSPIWrapper.cs b/src/libraries/Common/src/Interop/Windows/SspiCli/SSPIWrapper.cs index 95763518c96ae7..f36a072d981f95 100644 --- a/src/libraries/Common/src/Interop/Windows/SspiCli/SSPIWrapper.cs +++ b/src/libraries/Common/src/Interop/Windows/SspiCli/SSPIWrapper.cs @@ -426,27 +426,41 @@ public static bool QueryBlittableContextAttributes(ISSPIInterface secModule, } } - public static SafeFreeCertContext? QueryContextAttributes_SECPKG_ATTR_REMOTE_CERT_CONTEXT(ISSPIInterface secModule, SafeDeleteContext securityContext) + private static bool QueryCertContextAttribute(ISSPIInterface secModule, SafeDeleteContext securityContext, Interop.SspiCli.ContextAttribute attribute, out SafeFreeCertContext? certContext) { Span buffer = stackalloc IntPtr[1]; int errorCode = secModule.QueryContextAttributes( securityContext, - Interop.SspiCli.ContextAttribute.SECPKG_ATTR_REMOTE_CERT_CONTEXT, + attribute, MemoryMarshal.AsBytes(buffer), typeof(SafeFreeCertContext), out SafeHandle? sspiHandle); - if (errorCode != 0) + // certificate is not always present (e.g. on server when querying client certificate) + // but we still want to consider such case as a success. + bool success = errorCode == 0 || errorCode == (int)Interop.SECURITY_STATUS.NoCredentials; + + if (!success) { sspiHandle?.Dispose(); + sspiHandle = null; if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(null, $"ERROR = {ErrorDescription(errorCode)}"); - return null; } - var result = (SafeFreeCertContext)sspiHandle!; - return result; + certContext = sspiHandle as SafeFreeCertContext; + return success; } + public static bool QueryContextAttributes_SECPKG_ATTR_REMOTE_CERT_CONTEXT(ISSPIInterface secModule, SafeDeleteContext securityContext, out SafeFreeCertContext? certContext) + => QueryCertContextAttribute(secModule, securityContext, Interop.SspiCli.ContextAttribute.SECPKG_ATTR_REMOTE_CERT_CONTEXT, out certContext); + + public static bool QueryContextAttributes_SECPKG_ATTR_LOCAL_CERT_CONTEXT(ISSPIInterface secModule, SafeDeleteContext securityContext, out SafeFreeCertContext? certContext) + => QueryCertContextAttribute(secModule, securityContext, Interop.SspiCli.ContextAttribute.SECPKG_ATTR_LOCAL_CERT_CONTEXT, out certContext); + + public static bool QueryContextAttributes_SECPKG_ATTR_REMOTE_CERT_CHAIN(ISSPIInterface secModule, SafeDeleteContext securityContext, out SafeFreeCertContext? certContext) + => QueryCertContextAttribute(secModule, securityContext, Interop.SspiCli.ContextAttribute.SECPKG_ATTR_REMOTE_CERT_CHAIN, out certContext); + + public static bool QueryContextAttributes_SECPKG_ATTR_ISSUER_LIST_EX(ISSPIInterface secModule, SafeDeleteContext securityContext, ref Interop.SspiCli.SecPkgContext_IssuerListInfoEx ctx, out SafeHandle? sspiHandle) { Span buffer = diff --git a/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs b/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs index 43b718524d1ca9..a0370ad6bff9b1 100644 --- a/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs +++ b/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs @@ -5,6 +5,7 @@ using System.Globalization; using System.Runtime.InteropServices; using System.Security.Authentication.ExtendedProtection; +using System.Security.Cryptography.X509Certificates; using Microsoft.Win32.SafeHandles; namespace System.Net.Security @@ -320,6 +321,10 @@ public static unsafe int AcquireCredentialsHandle( internal sealed class SafeFreeCredential_SECURITY : SafeFreeCredentials { +#pragma warning disable 0649 + // This is used only by SslStream but it is included elsewhere + public bool HasLocalCertificate; +#pragma warning restore 0649 public SafeFreeCredential_SECURITY() : base() { } protected override bool ReleaseHandle() diff --git a/src/libraries/Common/src/Interop/Windows/User32/Interop.Constants.cs b/src/libraries/Common/src/Interop/Windows/User32/Interop.Constants.cs index 7a1574155a7d9a..e1a9bc4cce2ac3 100644 --- a/src/libraries/Common/src/Interop/Windows/User32/Interop.Constants.cs +++ b/src/libraries/Common/src/Interop/Windows/User32/Interop.Constants.cs @@ -198,6 +198,7 @@ internal static partial class User32 public const int WAIT_TIMEOUT = 0x00000102; + public const int WM_DESTROY = 0x0002; public const int WM_CLOSE = 0x0010; public const int WM_QUERYENDSESSION = 0x0011; public const int WM_QUIT = 0x0012; diff --git a/src/libraries/Common/src/Interop/Windows/User32/Interop.PeekMessage.cs b/src/libraries/Common/src/Interop/Windows/User32/Interop.GetMessage.cs similarity index 75% rename from src/libraries/Common/src/Interop/Windows/User32/Interop.PeekMessage.cs rename to src/libraries/Common/src/Interop/Windows/User32/Interop.GetMessage.cs index 45710968dba9da..3f4a12dfa6610c 100644 --- a/src/libraries/Common/src/Interop/Windows/User32/Interop.PeekMessage.cs +++ b/src/libraries/Common/src/Interop/Windows/User32/Interop.GetMessage.cs @@ -9,6 +9,6 @@ internal static partial class Interop internal static partial class User32 { [DllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)] - public static extern bool PeekMessageW([In, Out] ref MSG msg, IntPtr hwnd, int msgMin, int msgMax, int remove); + public static extern int GetMessageW(ref MSG msg, IntPtr hwnd, int msgMin, int msgMax); } } diff --git a/src/libraries/Common/src/Interop/Windows/User32/Interop.PostQuitMessage.cs b/src/libraries/Common/src/Interop/Windows/User32/Interop.PostQuitMessage.cs new file mode 100644 index 00000000000000..b7595f9dcfbe11 --- /dev/null +++ b/src/libraries/Common/src/Interop/Windows/User32/Interop.PostQuitMessage.cs @@ -0,0 +1,14 @@ +// 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.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class User32 + { + [DllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)] + public static extern void PostQuitMessage(int exitCode); + } +} diff --git a/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs b/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs index 1b86a149072899..463de2572b2b3f 100644 --- a/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs +++ b/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs @@ -109,6 +109,7 @@ internal static partial class WinHttp public const uint WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 = 0x00000080; public const uint WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 = 0x00000200; public const uint WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 = 0x00000800; + public const uint WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3 = 0x00002000; public const uint SECURITY_FLAG_IGNORE_UNKNOWN_CA = 0x00000100; public const uint SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000; @@ -167,6 +168,7 @@ internal static partial class WinHttp public const uint WINHTTP_OPTION_TCP_KEEPALIVE = 152; public const uint WINHTTP_OPTION_STREAM_ERROR_CODE = 159; + public const uint WINHTTP_OPTION_REQUIRE_STREAM_END = 160; public enum WINHTTP_WEB_SOCKET_BUFFER_TYPE { diff --git a/src/libraries/Common/src/Roslyn/CSharpSyntaxHelper.cs b/src/libraries/Common/src/Roslyn/CSharpSyntaxHelper.cs new file mode 100644 index 00000000000000..f7ab0d494a5817 --- /dev/null +++ b/src/libraries/Common/src/Roslyn/CSharpSyntaxHelper.cs @@ -0,0 +1,125 @@ +// 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.Generic; +using System.Diagnostics; + +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace Microsoft.CodeAnalysis.DotnetRuntime.Extensions +{ + internal sealed class CSharpSyntaxHelper : AbstractSyntaxHelper + { + public static readonly ISyntaxHelper Instance = new CSharpSyntaxHelper(); + + private CSharpSyntaxHelper() + { + } + + public override bool IsCaseSensitive + => true; + + public override bool IsValidIdentifier(string name) + => SyntaxFacts.IsValidIdentifier(name); + + public override bool IsAnyNamespaceBlock(SyntaxNode node) + => node is BaseNamespaceDeclarationSyntax; + + public override bool IsAttribute(SyntaxNode node) + => node is AttributeSyntax; + + public override SyntaxNode GetNameOfAttribute(SyntaxNode node) + => ((AttributeSyntax)node).Name; + + public override bool IsAttributeList(SyntaxNode node) + => node is AttributeListSyntax; + + public override void AddAttributeTargets(SyntaxNode node, ref ValueListBuilder targets) + { + var attributeList = (AttributeListSyntax)node; + var container = attributeList.Parent; + Debug.Assert(container != null); + + // For fields/events, the attribute applies to all the variables declared. + if (container is FieldDeclarationSyntax field) + { + foreach (var variable in field.Declaration.Variables) + targets.Append(variable); + } + else if (container is EventFieldDeclarationSyntax ev) + { + foreach (var variable in ev.Declaration.Variables) + targets.Append(variable); + } + else + { + targets.Append(container); + } + } + + public override SeparatedSyntaxList GetAttributesOfAttributeList(SyntaxNode node) + => ((AttributeListSyntax)node).Attributes; + + public override bool IsLambdaExpression(SyntaxNode node) + => node is LambdaExpressionSyntax; + + public override SyntaxToken GetUnqualifiedIdentifierOfName(SyntaxNode node) + => ((NameSyntax)node).GetUnqualifiedName().Identifier; + + public override void AddAliases(SyntaxNode node, ref ValueListBuilder<(string aliasName, string symbolName)> aliases, bool global) + { + if (node is CompilationUnitSyntax compilationUnit) + { + AddAliases(compilationUnit.Usings, ref aliases, global); + } + else if (node is BaseNamespaceDeclarationSyntax namespaceDeclaration) + { + AddAliases(namespaceDeclaration.Usings, ref aliases, global); + } + else + { + Debug.Fail("This should not be reachable. Caller already checked we had a compilation unit or namespace."); + } + } + + private static void AddAliases(SyntaxList usings, ref ValueListBuilder<(string aliasName, string symbolName)> aliases, bool global) + { + foreach (var usingDirective in usings) + { + if (usingDirective.Alias is null) + continue; + + if (global != usingDirective.GlobalKeyword.Kind() is SyntaxKind.GlobalKeyword) + continue; + + var aliasName = usingDirective.Alias.Name.Identifier.ValueText; + var symbolName = usingDirective.Name.GetUnqualifiedName().Identifier.ValueText; + aliases.Append((aliasName, symbolName)); + } + } + + public override void AddAliases(CompilationOptions compilation, ref ValueListBuilder<(string aliasName, string symbolName)> aliases) + { + // C# doesn't have global aliases at the compilation level. + return; + } + + public override bool ContainsGlobalAliases(SyntaxNode root) + { + // Global usings can only exist at the compilation-unit level, so no need to dive any deeper than that. + var compilationUnit = (CompilationUnitSyntax)root; + + foreach (var directive in compilationUnit.Usings) + { + if (directive.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword) && + directive.Alias != null) + { + return true; + } + } + + return false; + } + } +} diff --git a/src/libraries/Common/src/Roslyn/GetBestTypeByMetadataName.cs b/src/libraries/Common/src/Roslyn/GetBestTypeByMetadataName.cs new file mode 100644 index 00000000000000..8dbf92f48a7fe1 --- /dev/null +++ b/src/libraries/Common/src/Roslyn/GetBestTypeByMetadataName.cs @@ -0,0 +1,176 @@ +// 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.Immutable; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace Microsoft.CodeAnalysis.DotnetRuntime.Extensions +{ + internal static class RoslynExtensions + { + // Copied from: https://github.com/dotnet/roslyn/blob/main/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/CompilationExtensions.cs + /// + /// Gets a type by its metadata name to use for code analysis within a . This method + /// attempts to find the "best" symbol to use for code analysis, which is the symbol matching the first of the + /// following rules. + /// + /// + /// + /// If only one type with the given name is found within the compilation and its referenced assemblies, that + /// type is returned regardless of accessibility. + /// + /// + /// If the current defines the symbol, that symbol is returned. + /// + /// + /// If exactly one referenced assembly defines the symbol in a manner that makes it visible to the current + /// , that symbol is returned. + /// + /// + /// Otherwise, this method returns . + /// + /// + /// + /// The to consider for analysis. + /// The fully-qualified metadata type name to find. + /// The symbol to use for code analysis; otherwise, . + public static INamedTypeSymbol? GetBestTypeByMetadataName(this Compilation compilation, string fullyQualifiedMetadataName) + { + // Try to get the unique type with this name, ignoring accessibility + var type = compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); + + // Otherwise, try to get the unique type with this name originally defined in 'compilation' + type ??= compilation.Assembly.GetTypeByMetadataName(fullyQualifiedMetadataName); + + // Otherwise, try to get the unique accessible type with this name from a reference + if (type is null) + { + foreach (var module in compilation.Assembly.Modules) + { + foreach (var referencedAssembly in module.ReferencedAssemblySymbols) + { + var currentType = referencedAssembly.GetTypeByMetadataName(fullyQualifiedMetadataName); + if (currentType is null) + continue; + + switch (currentType.GetResultantVisibility()) + { + case SymbolVisibility.Public: + case SymbolVisibility.Internal when referencedAssembly.GivesAccessTo(compilation.Assembly): + break; + + default: + continue; + } + + if (type is object) + { + // Multiple visible types with the same metadata name are present + return null; + } + + type = currentType; + } + } + } + + return type; + } + + // copied from https://github.com/dotnet/roslyn/blob/main/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs + private static SymbolVisibility GetResultantVisibility(this ISymbol symbol) + { + // Start by assuming it's visible. + SymbolVisibility visibility = SymbolVisibility.Public; + + switch (symbol.Kind) + { + case SymbolKind.Alias: + // Aliases are uber private. They're only visible in the same file that they + // were declared in. + return SymbolVisibility.Private; + + case SymbolKind.Parameter: + // Parameters are only as visible as their containing symbol + return GetResultantVisibility(symbol.ContainingSymbol); + + case SymbolKind.TypeParameter: + // Type Parameters are private. + return SymbolVisibility.Private; + } + + while (symbol != null && symbol.Kind != SymbolKind.Namespace) + { + switch (symbol.DeclaredAccessibility) + { + // If we see anything private, then the symbol is private. + case Accessibility.NotApplicable: + case Accessibility.Private: + return SymbolVisibility.Private; + + // If we see anything internal, then knock it down from public to + // internal. + case Accessibility.Internal: + case Accessibility.ProtectedAndInternal: + visibility = SymbolVisibility.Internal; + break; + + // For anything else (Public, Protected, ProtectedOrInternal), the + // symbol stays at the level we've gotten so far. + } + + symbol = symbol.ContainingSymbol; + } + + return visibility; + } + + // Copied from: https://github.com/dotnet/roslyn/blob/main/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/SymbolVisibility.cs +#pragma warning disable CA1027 // Mark enums with FlagsAttribute + private enum SymbolVisibility +#pragma warning restore CA1027 // Mark enums with FlagsAttribute + { + Public = 0, + Internal = 1, + Private = 2, + Friend = Internal, + } + + internal static bool HasAttributeSuffix(this string name, bool isCaseSensitive) + { + const string AttributeSuffix = "Attribute"; + + var comparison = isCaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; + return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); + } + + public static ImmutableArray ToImmutableArray(this ReadOnlySpan span) + { + switch (span.Length) + { + case 0: return ImmutableArray.Empty; + case 1: return ImmutableArray.Create(span[0]); + case 2: return ImmutableArray.Create(span[0], span[1]); + case 3: return ImmutableArray.Create(span[0], span[1], span[2]); + case 4: return ImmutableArray.Create(span[0], span[1], span[2], span[3]); + default: + var builder = ImmutableArray.CreateBuilder(span.Length); + foreach (var item in span) + builder.Add(item); + + return builder.MoveToImmutable(); + } + } + + public static SimpleNameSyntax GetUnqualifiedName(this NameSyntax name) + => name switch + { + AliasQualifiedNameSyntax alias => alias.Name, + QualifiedNameSyntax qualified => qualified.Right, + SimpleNameSyntax simple => simple, + _ => throw new InvalidOperationException("Unreachable"), + }; + } +} diff --git a/src/libraries/Common/src/Roslyn/GlobalAliases.cs b/src/libraries/Common/src/Roslyn/GlobalAliases.cs new file mode 100644 index 00000000000000..2108923c76c271 --- /dev/null +++ b/src/libraries/Common/src/Roslyn/GlobalAliases.cs @@ -0,0 +1,74 @@ +// 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.Immutable; +using Microsoft.CodeAnalysis.PooledObjects; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.DotnetRuntime.Extensions; + +/// +/// Simple wrapper class around an immutable array so we can have the value-semantics needed for the incremental +/// generator to know when a change actually happened and it should run later transform stages. +/// +internal sealed class GlobalAliases : IEquatable +{ + public static readonly GlobalAliases Empty = new(ImmutableArray<(string aliasName, string symbolName)>.Empty); + + public readonly ImmutableArray<(string aliasName, string symbolName)> AliasAndSymbolNames; + + private int _hashCode; + + private GlobalAliases(ImmutableArray<(string aliasName, string symbolName)> aliasAndSymbolNames) + { + AliasAndSymbolNames = aliasAndSymbolNames; + } + + public static GlobalAliases Create(ImmutableArray<(string aliasName, string symbolName)> aliasAndSymbolNames) + { + return aliasAndSymbolNames.IsEmpty ? Empty : new GlobalAliases(aliasAndSymbolNames); + } + + public static GlobalAliases Concat(GlobalAliases ga1, GlobalAliases ga2) + { + if (ga1.AliasAndSymbolNames.Length == 0) + return ga2; + + if (ga2.AliasAndSymbolNames.Length == 0) + return ga1; + + return new(ga1.AliasAndSymbolNames.AddRange(ga2.AliasAndSymbolNames)); + } + + public override int GetHashCode() + { + if (_hashCode == 0) + { + var hashCode = 0; + foreach (var tuple in this.AliasAndSymbolNames) + hashCode = Hash.Combine(tuple.GetHashCode(), hashCode); + + _hashCode = hashCode == 0 ? 1 : hashCode; + } + + return _hashCode; + } + + public override bool Equals(object? obj) + => this.Equals(obj as GlobalAliases); + + public bool Equals(GlobalAliases? aliases) + { + if (aliases is null) + return false; + + if (ReferenceEquals(this, aliases)) + return true; + + if (this.AliasAndSymbolNames == aliases.AliasAndSymbolNames) + return true; + + return this.AliasAndSymbolNames.AsSpan().SequenceEqual(aliases.AliasAndSymbolNames.AsSpan()); + } +} diff --git a/src/libraries/Common/src/Roslyn/Hash.cs b/src/libraries/Common/src/Roslyn/Hash.cs new file mode 100644 index 00000000000000..028ac50017e0b9 --- /dev/null +++ b/src/libraries/Common/src/Roslyn/Hash.cs @@ -0,0 +1,24 @@ +// 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.Collections.Immutable; +using Microsoft.CodeAnalysis; + +namespace Roslyn.Utilities +{ + internal static class Hash + { + /// + /// This is how VB Anonymous Types combine hash values for fields. + /// + internal static int Combine(int newKey, int currentKey) + { + return unchecked((currentKey * (int)0xA5555529) + newKey); + } + + // The rest of this file was removed as they were not currently needed in the polyfill of SyntaxValueProvider.ForAttributeWithMetadataName. + // If that changes, they should be added back as necessary. + } +} diff --git a/src/libraries/Common/src/Roslyn/ISyntaxHelper.cs b/src/libraries/Common/src/Roslyn/ISyntaxHelper.cs new file mode 100644 index 00000000000000..846ef9b16d13f2 --- /dev/null +++ b/src/libraries/Common/src/Roslyn/ISyntaxHelper.cs @@ -0,0 +1,66 @@ +// 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.Collections.Immutable; +using System.Linq; + +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.DotnetRuntime.Extensions +{ + internal interface ISyntaxHelper + { + bool IsCaseSensitive { get; } + + bool IsValidIdentifier(string name); + + bool IsAnyNamespaceBlock(SyntaxNode node); + + bool IsAttributeList(SyntaxNode node); + SeparatedSyntaxList GetAttributesOfAttributeList(SyntaxNode node); + + void AddAttributeTargets(SyntaxNode node, ref ValueListBuilder targets); + + bool IsAttribute(SyntaxNode node); + SyntaxNode GetNameOfAttribute(SyntaxNode node); + + bool IsLambdaExpression(SyntaxNode node); + + SyntaxToken GetUnqualifiedIdentifierOfName(SyntaxNode node); + + /// + /// must be a compilation unit or namespace block. + /// + void AddAliases(SyntaxNode node, ref ValueListBuilder<(string aliasName, string symbolName)> aliases, bool global); + void AddAliases(CompilationOptions options, ref ValueListBuilder<(string aliasName, string symbolName)> aliases); + + bool ContainsGlobalAliases(SyntaxNode root); + } + + internal abstract class AbstractSyntaxHelper : ISyntaxHelper + { + public abstract bool IsCaseSensitive { get; } + + public abstract bool IsValidIdentifier(string name); + + public abstract SyntaxToken GetUnqualifiedIdentifierOfName(SyntaxNode name); + + public abstract bool IsAnyNamespaceBlock(SyntaxNode node); + + public abstract bool IsAttribute(SyntaxNode node); + public abstract SyntaxNode GetNameOfAttribute(SyntaxNode node); + + public abstract bool IsAttributeList(SyntaxNode node); + public abstract SeparatedSyntaxList GetAttributesOfAttributeList(SyntaxNode node); + public abstract void AddAttributeTargets(SyntaxNode node, ref ValueListBuilder targets); + + public abstract bool IsLambdaExpression(SyntaxNode node); + + public abstract void AddAliases(SyntaxNode node, ref ValueListBuilder<(string aliasName, string symbolName)> aliases, bool global); + public abstract void AddAliases(CompilationOptions options, ref ValueListBuilder<(string aliasName, string symbolName)> aliases); + + public abstract bool ContainsGlobalAliases(SyntaxNode root); + } +} diff --git a/src/libraries/Common/src/Roslyn/SyntaxNodeGrouping.cs b/src/libraries/Common/src/Roslyn/SyntaxNodeGrouping.cs new file mode 100644 index 00000000000000..94dd5ae5f9d13c --- /dev/null +++ b/src/libraries/Common/src/Roslyn/SyntaxNodeGrouping.cs @@ -0,0 +1,42 @@ +// 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.Immutable; +using System.Linq; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.DotnetRuntime.Extensions; + +internal static partial class SyntaxValueProviderExtensions +{ + /// + /// Wraps a grouping of nodes within a syntax tree so we can have value-semantics around them usable by the + /// incremental driver. Note: we do something very sneaky here. Specifically, as long as we have the same from before, then we know we must have the same nodes as before (since the nodes are + /// entirely determined from the text+options which is exactly what the syntax tree represents). Similarly, if the + /// syntax tree changes, we will always get different nodes (since they point back at the syntax tree). So we can + /// just use the syntax tree itself to determine value semantics here. + /// + private sealed class SyntaxNodeGrouping : IEquatable> + where TSyntaxNode : SyntaxNode + { + public readonly SyntaxTree SyntaxTree; + public readonly ImmutableArray SyntaxNodes; + + public SyntaxNodeGrouping(IGrouping grouping) + { + SyntaxTree = grouping.Key; + SyntaxNodes = grouping.OrderBy(static n => n.FullSpan.Start).ToImmutableArray(); + } + + public override int GetHashCode() + => SyntaxTree.GetHashCode(); + + public override bool Equals(object? obj) + => Equals(obj as SyntaxNodeGrouping); + + public bool Equals(SyntaxNodeGrouping? obj) + => this.SyntaxTree == obj?.SyntaxTree; + } +} diff --git a/src/libraries/Common/src/Roslyn/SyntaxValueProvider.ImmutableArrayValueComparer.cs b/src/libraries/Common/src/Roslyn/SyntaxValueProvider.ImmutableArrayValueComparer.cs new file mode 100644 index 00000000000000..5323a100883a73 --- /dev/null +++ b/src/libraries/Common/src/Roslyn/SyntaxValueProvider.ImmutableArrayValueComparer.cs @@ -0,0 +1,29 @@ +// 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.Generic; +using System.Collections.Immutable; +using System.Linq; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.DotnetRuntime.Extensions; + +internal static partial class SyntaxValueProviderExtensions +{ + private sealed class ImmutableArrayValueComparer : IEqualityComparer> + { + public static readonly IEqualityComparer> Instance = new ImmutableArrayValueComparer(); + + public bool Equals(ImmutableArray x, ImmutableArray y) + => x.SequenceEqual(y, EqualityComparer.Default); + + public int GetHashCode(ImmutableArray obj) + { + var hashCode = 0; + foreach (var value in obj) + hashCode = Hash.Combine(hashCode, EqualityComparer.Default.GetHashCode(value!)); + + return hashCode; + } + } +} diff --git a/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithMetadataName.cs b/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithMetadataName.cs new file mode 100644 index 00000000000000..f6be8fbcb6858a --- /dev/null +++ b/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithMetadataName.cs @@ -0,0 +1,201 @@ +// 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.Collections.Immutable; +using System.Diagnostics; +using System.Linq; +using System.Threading; + +using Microsoft.CodeAnalysis; + +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.DotnetRuntime.Extensions; + +internal readonly struct GeneratorAttributeSyntaxContext +{ + /// + /// The syntax node the attribute is attached to. For example, with [CLSCompliant] class C { } this would + /// the class declaration node. + /// + public SyntaxNode TargetNode { get; } + + /// + /// The symbol that the attribute is attached to. For example, with [CLSCompliant] class C { } this would be + /// the for "C". + /// + public ISymbol TargetSymbol { get; } + + /// + /// Semantic model for the file that is contained within. + /// + public SemanticModel SemanticModel { get; } + + /// + /// s for any matching attributes on . Always non-empty. All + /// these attributes will have an whose fully qualified name metadata + /// name matches the name requested in . + /// + /// To get the entire list of attributes, use on . + /// + /// + public ImmutableArray Attributes { get; } + + internal GeneratorAttributeSyntaxContext( + SyntaxNode targetNode, + ISymbol targetSymbol, + SemanticModel semanticModel, + ImmutableArray attributes) + { + TargetNode = targetNode; + TargetSymbol = targetSymbol; + SemanticModel = semanticModel; + Attributes = attributes; + } +} + +internal static partial class SyntaxValueProviderExtensions +{ +#if false + + // Deviation from roslyn. We do not support attributes that are nested or generic. That's ok as that's not a + // scenario that ever arises in our generators. + + private static readonly char[] s_nestedTypeNameSeparators = new char[] { '+' }; + + private static readonly SymbolDisplayFormat s_metadataDisplayFormat = + SymbolDisplayFormat.QualifiedNameArityFormat.AddCompilerInternalOptions(SymbolDisplayCompilerInternalOptions.UsePlusForNestedTypes); + +#endif + + /// + /// Creates an that can provide a transform over all s if that node has an attribute on it that binds to a with the + /// same fully-qualified metadata as the provided . should be the fully-qualified, metadata name of the attribute, including the + /// Attribute suffix. For example "System.CLSCompliantAttribute for . + /// + /// A function that determines if the given attribute target () should be transformed. Nodes that do not pass this + /// predicate will not have their attributes looked at at all. + /// A function that performs the transform. This will only be passed nodes that return for and which have a matching whose + /// has the same fully qualified, metadata name as . + public static IncrementalValuesProvider ForAttributeWithMetadataName( + this SyntaxValueProvider @this, + IncrementalGeneratorInitializationContext context, + string fullyQualifiedMetadataName, + Func predicate, + Func transform) + { +#if false + + // Deviation from roslyn. We do not support attributes that are nested or generic. That's ok as that's not a + // scenario that ever arises in our generators. + + var metadataName = fullyQualifiedMetadataName.Contains('+') + ? MetadataTypeName.FromFullName(fullyQualifiedMetadataName.Split(s_nestedTypeNameSeparators).Last()) + : MetadataTypeName.FromFullName(fullyQualifiedMetadataName); + + var nodesWithAttributesMatchingSimpleName = @this.ForAttributeWithSimpleName(context, metadataName.UnmangledTypeName, predicate); + +#else + + var lastDotIndex = fullyQualifiedMetadataName.LastIndexOf('.'); + Debug.Assert(lastDotIndex > 0); + var unmangledTypeName = fullyQualifiedMetadataName.Substring(lastDotIndex + 1); + + var nodesWithAttributesMatchingSimpleName = @this.ForAttributeWithSimpleName(context, unmangledTypeName, predicate); + +#endif + + var compilationAndGroupedNodesProvider = nodesWithAttributesMatchingSimpleName + .Combine(context.CompilationProvider) + /*.WithTrackingName("compilationAndGroupedNodes_ForAttributeWithMetadataName")*/; + + var syntaxHelper = CSharpSyntaxHelper.Instance; + var finalProvider = compilationAndGroupedNodesProvider.SelectMany((tuple, cancellationToken) => + { + var ((syntaxTree, syntaxNodes), compilation) = tuple; + Debug.Assert(syntaxNodes.All(n => n.SyntaxTree == syntaxTree)); + + using var result = new ValueListBuilder(Span.Empty); + if (!syntaxNodes.IsEmpty) + { + var semanticModel = compilation.GetSemanticModel(syntaxTree); + + foreach (var targetNode in syntaxNodes) + { + cancellationToken.ThrowIfCancellationRequested(); + + var targetSymbol = + targetNode is ICompilationUnitSyntax compilationUnit ? semanticModel.Compilation.Assembly : + syntaxHelper.IsLambdaExpression(targetNode) ? semanticModel.GetSymbolInfo(targetNode, cancellationToken).Symbol : + semanticModel.GetDeclaredSymbol(targetNode, cancellationToken); + if (targetSymbol is null) + continue; + + var attributes = getMatchingAttributes(targetNode, targetSymbol, fullyQualifiedMetadataName); + if (attributes.Length > 0) + { + result.Append(transform( + new GeneratorAttributeSyntaxContext(targetNode, targetSymbol, semanticModel, attributes), + cancellationToken)); + } + } + } + + return result.AsSpan().ToImmutableArray(); + })/*.WithTrackingName("result_ForAttributeWithMetadataName")*/; + + return finalProvider; + + static ImmutableArray getMatchingAttributes( + SyntaxNode attributeTarget, + ISymbol symbol, + string fullyQualifiedMetadataName) + { + var targetSyntaxTree = attributeTarget.SyntaxTree; + var result = new ValueListBuilder(Span.Empty); + + try + { + addMatchingAttributes(ref result, symbol.GetAttributes()); + addMatchingAttributes(ref result, (symbol as IMethodSymbol)?.GetReturnTypeAttributes()); + + if (symbol is IAssemblySymbol assemblySymbol) + { + foreach (var module in assemblySymbol.Modules) + addMatchingAttributes(ref result, module.GetAttributes()); + } + + return result.AsSpan().ToImmutableArray(); + } + finally + { + result.Dispose(); + } + + void addMatchingAttributes( + ref ValueListBuilder result, + ImmutableArray? attributes) + { + if (!attributes.HasValue) + return; + + foreach (var attribute in attributes.Value) + { + if (attribute.ApplicationSyntaxReference?.SyntaxTree == targetSyntaxTree && + attribute.AttributeClass?.ToDisplayString(/*s_metadataDisplayFormat*/) == fullyQualifiedMetadataName) + { + result.Append(attribute); + } + } + } + } + } +} diff --git a/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithSimpleName.cs b/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithSimpleName.cs new file mode 100644 index 00000000000000..6ecbc1b35baaa7 --- /dev/null +++ b/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithSimpleName.cs @@ -0,0 +1,453 @@ +// 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.Collections.Immutable; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading; + +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Aliases = System.Collections.Generic.ValueListBuilder<(string aliasName, string symbolName)>; + +namespace Microsoft.CodeAnalysis.DotnetRuntime.Extensions; + +internal static partial class SyntaxValueProviderExtensions +{ + // Normal class as Runtime does not seem to support records currently. + + /// + /// Information computed about a particular tree. Cached so we don't repeatedly recompute this important + /// information each time the incremental pipeline is rerun. + /// + private sealed class SyntaxTreeInfo : IEquatable + { + public readonly SyntaxTree Tree; + public readonly bool ContainsGlobalAliases; + public readonly bool ContainsAttributeList; + + public SyntaxTreeInfo(SyntaxTree tree, bool containsGlobalAliases, bool containsAttributeList) + { + Tree = tree; + ContainsGlobalAliases = containsGlobalAliases; + ContainsAttributeList = containsAttributeList; + } + + public bool Equals(SyntaxTreeInfo other) + => Tree == other?.Tree; + + public override bool Equals(object obj) + => this.Equals(obj as SyntaxTreeInfo); + + public override int GetHashCode() + => Tree.GetHashCode(); + } + + /// + /// Caching of syntax-tree to the info we've computed about it. Used because compilations will have thousands of + /// trees, and the incremental pipeline will get called back for *all* of them each time a compilation changes. We + /// do not want to continually recompute this data over and over again each time that happens given that normally + /// only one tree will be different. We also do not want to create an IncrementalValuesProvider that yield this + /// information as that will mean we have a node in the tree that scales with the number of *all syntax trees*, not + /// the number of *relevant syntax trees*. This can lead to huge memory churn keeping track of a high number of + /// trees, most of which are not going to be relevant. + /// + private static readonly ConditionalWeakTable s_treeToInfo = new ConditionalWeakTable(); + +#if false + // Not used in runtime. Pooling is not a pattern here, and we use ValueListBuilder instead. + + private static readonly ObjectPool> s_stackPool = new(static () => new()); +#endif + + /// + /// Returns all syntax nodes of that match if that node has an attribute on it that + /// could possibly bind to the provided . should be the + /// simple, non-qualified, name of the attribute, including the Attribute suffix, and not containing any + /// generics, containing types, or namespaces. For example CLSCompliantAttribute for . + /// This provider understands (Import in Visual Basic) aliases and will find + /// matches even when the attribute references an alias name. For example, given: + /// + /// using XAttribute = System.CLSCompliantAttribute; + /// [X] + /// class C { } + /// + /// Then + /// context.SyntaxProvider.CreateSyntaxProviderForAttribute(nameof(CLSCompliantAttribute), (node, c) => node is ClassDeclarationSyntax) + /// will find the C class. + /// + /// + /// Note: a 'Values'-provider of arrays are returned. Each array provides all the matching nodes from a single . + /// + public static IncrementalValuesProvider<(SyntaxTree tree, ImmutableArray matches)> ForAttributeWithSimpleName( + this SyntaxValueProvider @this, + IncrementalGeneratorInitializationContext context, + string simpleName, + Func predicate) + { + var syntaxHelper = CSharpSyntaxHelper.Instance; + + // Create a provider over all the syntax trees in the compilation. This is better than CreateSyntaxProvider as + // using SyntaxTrees is purely syntax and will not update the incremental node for a tree when another tree is + // changed. CreateSyntaxProvider will have to rerun all incremental nodes since it passes along the + // SemanticModel, and that model is updated whenever any tree changes (since it is tied to the compilation). + var syntaxTreesProvider = context.CompilationProvider + .SelectMany((compilation, cancellationToken) => compilation.SyntaxTrees + .Select(tree => GetTreeInfo(tree, syntaxHelper, cancellationToken)) + .Where(info => info.ContainsGlobalAliases || info.ContainsAttributeList)) + /*.WithTrackingName("compilationUnit_ForAttribute")*/; + + // Create a provider that provides (and updates) the global aliases for any particular file when it is edited. + var individualFileGlobalAliasesProvider = syntaxTreesProvider + .Where(info => info.ContainsGlobalAliases) + .Select((info, cancellationToken) => getGlobalAliasesInCompilationUnit(info.Tree.GetRoot(cancellationToken))) + /*.WithTrackingName("individualFileGlobalAliases_ForAttribute")*/; + + // Create an aggregated view of all global aliases across all files. This should only update when an individual + // file changes its global aliases or a file is added / removed from the compilation + var collectedGlobalAliasesProvider = individualFileGlobalAliasesProvider + .Collect() + .WithComparer(ImmutableArrayValueComparer.Instance) + /*.WithTrackingName("collectedGlobalAliases_ForAttribute")*/; + + var allUpGlobalAliasesProvider = collectedGlobalAliasesProvider + .Select(static (arrays, _) => GlobalAliases.Create(arrays.SelectMany(a => a.AliasAndSymbolNames).ToImmutableArray())) + /*.WithTrackingName("allUpGlobalAliases_ForAttribute")*/; + +#if false + + // C# does not support global aliases from compilation options. So we can just ignore this part. + + // Regenerate our data if the compilation options changed. VB can supply global aliases with compilation options, + // so we have to reanalyze everything if those changed. + var compilationGlobalAliases = _context.CompilationOptionsProvider.Select( + (o, _) => + { + var aliases = Aliases.GetInstance(); + syntaxHelper.AddAliases(o, aliases); + return GlobalAliases.Create(aliases.ToImmutableAndFree()); + }).WithTrackingName("compilationGlobalAliases_ForAttribute"); + + allUpGlobalAliasesProvider = allUpGlobalAliasesProvider + .Combine(compilationGlobalAliases) + .Select((tuple, _) => GlobalAliases.Concat(tuple.Left, tuple.Right)) + .WithTrackingName("allUpIncludingCompilationGlobalAliases_ForAttribute"); + +#endif + + // Combine the two providers so that we reanalyze every file if the global aliases change, or we reanalyze a + // particular file when it's compilation unit changes. + var syntaxTreeAndGlobalAliasesProvider = syntaxTreesProvider + .Where(info => info.ContainsAttributeList) + .Combine(allUpGlobalAliasesProvider) + /*.WithTrackingName("compilationUnitAndGlobalAliases_ForAttribute")*/; + + // For each pair of compilation unit + global aliases, walk the compilation unit + var result = syntaxTreeAndGlobalAliasesProvider + .Select((tuple, c) => (tuple.Left.Tree, GetMatchingNodes(syntaxHelper, tuple.Right, tuple.Left.Tree, simpleName, predicate, c))) + .Where(tuple => tuple.Item2.Length > 0) + /*.WithTrackingName("result_ForAttribute")*/; + + return result; + + static GlobalAliases getGlobalAliasesInCompilationUnit( + SyntaxNode compilationUnit) + { + Debug.Assert(compilationUnit is ICompilationUnitSyntax); + var globalAliases = new Aliases(Span<(string aliasName, string symbolName)>.Empty); + + CSharpSyntaxHelper.Instance.AddAliases(compilationUnit, ref globalAliases, global: true); + + return GlobalAliases.Create(globalAliases.AsSpan().ToImmutableArray()); + } + } + + private static SyntaxTreeInfo GetTreeInfo( + SyntaxTree tree, ISyntaxHelper syntaxHelper, CancellationToken cancellationToken) + { + // prevent captures for the case where the item is in the tree. + return s_treeToInfo.TryGetValue(tree, out var info) + ? info + : computeTreeInfo(); + + SyntaxTreeInfo computeTreeInfo() + { + var root = tree.GetRoot(cancellationToken); + var containsGlobalAliases = syntaxHelper.ContainsGlobalAliases(root); + var containsAttributeList = ContainsAttributeList(root); + + var info = new SyntaxTreeInfo(tree, containsGlobalAliases, containsAttributeList); + return s_treeToInfo.GetValue(tree, _ => info); + } + } + + private static ImmutableArray GetMatchingNodes( + ISyntaxHelper syntaxHelper, + GlobalAliases globalAliases, + SyntaxTree syntaxTree, + string name, + Func predicate, + CancellationToken cancellationToken) + { + var compilationUnit = syntaxTree.GetRoot(cancellationToken); + Debug.Assert(compilationUnit is ICompilationUnitSyntax); + + var isCaseSensitive = syntaxHelper.IsCaseSensitive; + var comparison = isCaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; + + // As we walk down the compilation unit and nested namespaces, we may encounter additional using aliases local + // to this file. Keep track of them so we can determine if they would allow an attribute in code to bind to the + // attribute being searched for. + var localAliases = new Aliases(Span<(string, string)>.Empty); + var nameHasAttributeSuffix = name.HasAttributeSuffix(isCaseSensitive); + + // Used to ensure that as we recurse through alias names to see if they could bind to attributeName that we + // don't get into cycles. + + var seenNames = new ValueListBuilder(Span.Empty); + var results = new ValueListBuilder(Span.Empty); + var attributeTargets = new ValueListBuilder(Span.Empty); + + try + { + processCompilationUnit(compilationUnit, ref localAliases, ref seenNames, ref results, ref attributeTargets); + + if (results.Length == 0) + return ImmutableArray.Empty; + + return results.AsSpan().ToArray().Distinct().ToImmutableArray(); + } + finally + { + attributeTargets.Dispose(); + results.Dispose(); + seenNames.Dispose(); + } + + void processCompilationUnit( + SyntaxNode compilationUnit, + ref Aliases localAliases, + ref ValueListBuilder seenNames, + ref ValueListBuilder results, + ref ValueListBuilder attributeTargets) + { + cancellationToken.ThrowIfCancellationRequested(); + + syntaxHelper.AddAliases(compilationUnit, ref localAliases, global: false); + + processCompilationOrNamespaceMembers(compilationUnit, ref localAliases, ref seenNames, ref results, ref attributeTargets); + } + + void processCompilationOrNamespaceMembers( + SyntaxNode node, + ref Aliases localAliases, + ref ValueListBuilder seenNames, + ref ValueListBuilder results, + ref ValueListBuilder attributeTargets) + { + cancellationToken.ThrowIfCancellationRequested(); + + foreach (var child in node.ChildNodesAndTokens()) + { + if (child.IsNode) + { + var childNode = child.AsNode()!; + if (syntaxHelper.IsAnyNamespaceBlock(childNode)) + processNamespaceBlock(childNode, ref localAliases, ref seenNames, ref results, ref attributeTargets); + else + processMember(childNode, ref localAliases, ref seenNames, ref results, ref attributeTargets); + } + } + } + + void processNamespaceBlock( + SyntaxNode namespaceBlock, + ref Aliases localAliases, + ref ValueListBuilder seenNames, + ref ValueListBuilder results, + ref ValueListBuilder attributeTargets) + { + cancellationToken.ThrowIfCancellationRequested(); + + var localAliasCount = localAliases.Length; + syntaxHelper.AddAliases(namespaceBlock, ref localAliases, global: false); + + processCompilationOrNamespaceMembers( + namespaceBlock, ref localAliases, ref seenNames, ref results, ref attributeTargets); + + // after recursing into this namespace, dump any local aliases we added from this namespace decl itself. + localAliases.Length = localAliasCount; + } + + void processMember( + SyntaxNode member, + ref Aliases localAliases, + ref ValueListBuilder seenNames, + ref ValueListBuilder results, + ref ValueListBuilder attributeTargets) + { + cancellationToken.ThrowIfCancellationRequested(); + + // nodes can be arbitrarily deep. Use an explicit stack over recursion to prevent a stack-overflow. + var nodeStack = new ValueListBuilder(Span.Empty); + nodeStack.Append(member); + + try + { + while (nodeStack.Length > 0) + { + var node = nodeStack.Pop(); + + if (syntaxHelper.IsAttributeList(node)) + { + foreach (var attribute in syntaxHelper.GetAttributesOfAttributeList(node)) + { + // Have to lookup both with the name in the attribute, as well as adding the 'Attribute' suffix. + // e.g. if there is [X] then we have to lookup with X and with XAttribute. + var simpleAttributeName = syntaxHelper.GetUnqualifiedIdentifierOfName( + syntaxHelper.GetNameOfAttribute(attribute)).ValueText; + if (matchesAttributeName(ref localAliases, ref seenNames, simpleAttributeName, withAttributeSuffix: false) || + matchesAttributeName(ref localAliases, ref seenNames, simpleAttributeName, withAttributeSuffix: true)) + { + attributeTargets.Length = 0; + syntaxHelper.AddAttributeTargets(node, ref attributeTargets); + + foreach (var target in attributeTargets.AsSpan()) + { + if (predicate(target, cancellationToken)) + results.Append(target); + } + + break; + } + } + + // attributes can't have attributes inside of them. so no need to recurse when we're done. + } + else + { + // For any other node, just keep recursing deeper to see if we can find an attribute. Note: we cannot + // terminate the search anywhere as attributes may be found on things like local functions, and that + // means having to dive deep into statements and expressions. + var childNodesAndTokens = node.ChildNodesAndTokens(); + + // Avoid performance issue in ChildSyntaxList when iterating the child list in reverse + // (see https://github.com/dotnet/roslyn/issues/66475) by iterating forward first to + // ensure child nodes are realized. + foreach (var childNode in childNodesAndTokens) + { + } + + foreach (var child in childNodesAndTokens.Reverse()) + { + if (child.IsNode) + nodeStack.Append(child.AsNode()!); + } + } + + } + } + finally + { + nodeStack.Dispose(); + } + } + + // Checks if `name` is equal to `matchAgainst`. if `withAttributeSuffix` is true, then + // will check if `name` + "Attribute" is equal to `matchAgainst` + bool matchesName(string name, string matchAgainst, bool withAttributeSuffix) + { + if (withAttributeSuffix) + { + return name.Length + "Attribute".Length == matchAgainst.Length && + matchAgainst.HasAttributeSuffix(isCaseSensitive) && + matchAgainst.StartsWith(name, comparison); + } + else + { + return name.Equals(matchAgainst, comparison); + } + } + + bool matchesAttributeName( + ref Aliases localAliases, + ref ValueListBuilder seenNames, + string currentAttributeName, + bool withAttributeSuffix) + { + // If the names match, we're done. + if (withAttributeSuffix) + { + if (nameHasAttributeSuffix && + matchesName(currentAttributeName, name, withAttributeSuffix)) + { + return true; + } + } + else + { + if (matchesName(currentAttributeName, name, withAttributeSuffix: false)) + return true; + } + + // Otherwise, keep searching through aliases. Check that this is the first time seeing this name so we + // don't infinite recurse in error code where aliases reference each other. + // + // note: as we recurse up the aliases, we do not want to add the attribute suffix anymore. aliases must + // reference the actual real name of the symbol they are aliasing. + foreach (var seenName in seenNames.AsSpan()) + { + if (seenName == currentAttributeName) + return false; + } + + seenNames.Append(currentAttributeName); + + foreach (var (aliasName, symbolName) in localAliases.AsSpan()) + { + // see if user wrote `[SomeAlias]`. If so, if we find a `using SomeAlias = ...` recurse using the + // ... name portion to see if it might bind to the attr name the caller is searching for. + if (matchesName(currentAttributeName, aliasName, withAttributeSuffix) && + matchesAttributeName(ref localAliases, ref seenNames, symbolName, withAttributeSuffix: false)) + { + return true; + } + } + + foreach (var (aliasName, symbolName) in globalAliases.AliasAndSymbolNames) + { + if (matchesName(currentAttributeName, aliasName, withAttributeSuffix) && + matchesAttributeName(ref localAliases, ref seenNames, symbolName, withAttributeSuffix: false)) + { + return true; + } + } + + seenNames.Pop(); + return false; + } + } + + private static bool ContainsAttributeList(SyntaxNode node) + { + if (node.IsKind(SyntaxKind.AttributeList)) + return true; + + foreach (SyntaxNodeOrToken child in node.ChildNodesAndTokens()) + { + if (child.IsToken) + continue; + + SyntaxNode? childNode = child.AsNode()!; + if (ContainsAttributeList(childNode)) + return true; + } + + return false; + } +} diff --git a/src/libraries/Common/src/System/Net/Http/aspnetcore/Http2/Hpack/HPackDecoder.cs b/src/libraries/Common/src/System/Net/Http/aspnetcore/Http2/Hpack/HPackDecoder.cs index 22e2f8bd1987aa..329552a2010c25 100644 --- a/src/libraries/Common/src/System/Net/Http/aspnetcore/Http2/Hpack/HPackDecoder.cs +++ b/src/libraries/Common/src/System/Net/Http/aspnetcore/Http2/Hpack/HPackDecoder.cs @@ -187,12 +187,11 @@ private void DecodeInternal(ReadOnlySpan data, IHttpHeadersHandler handler // will no longer be valid. if (_headerNameRange != null) { - EnsureStringCapacity(ref _headerNameOctets); + EnsureStringCapacity(ref _headerNameOctets, _headerNameLength); _headerName = _headerNameOctets; ReadOnlySpan headerBytes = data.Slice(_headerNameRange.GetValueOrDefault().start, _headerNameRange.GetValueOrDefault().length); headerBytes.CopyTo(_headerName); - _headerNameLength = headerBytes.Length; _headerNameRange = null; } } @@ -427,6 +426,7 @@ private void ParseHeaderName(ReadOnlySpan data, ref int currentIndex, IHtt { // Fast path. Store the range rather than copying. _headerNameRange = (start: currentIndex, count); + _headerNameLength = _stringLength; currentIndex += count; _state = State.HeaderValueLength; @@ -616,11 +616,12 @@ int Decode(ref byte[] dst) _state = nextState; } - private void EnsureStringCapacity(ref byte[] dst) + private void EnsureStringCapacity(ref byte[] dst, int stringLength = -1) { - if (dst.Length < _stringLength) + stringLength = stringLength >= 0 ? stringLength : _stringLength; + if (dst.Length < stringLength) { - dst = new byte[Math.Max(_stringLength, dst.Length * 2)]; + dst = new byte[Math.Max(stringLength, dst.Length * 2)]; } } diff --git a/src/libraries/Common/src/System/Net/NetworkInformation/UnixCommandLinePing.cs b/src/libraries/Common/src/System/Net/NetworkInformation/UnixCommandLinePing.cs index 579e69a153f045..0a84d09df91457 100644 --- a/src/libraries/Common/src/System/Net/NetworkInformation/UnixCommandLinePing.cs +++ b/src/libraries/Common/src/System/Net/NetworkInformation/UnixCommandLinePing.cs @@ -9,8 +9,8 @@ namespace System.Net.NetworkInformation { internal static class UnixCommandLinePing { - // Ubuntu has ping under /bin, OSX under /sbin, ArchLinux under /usr/bin. - private static readonly string[] s_binFolders = { "/bin/", "/sbin/", "/usr/bin/" }; + // Ubuntu has ping under /bin, OSX under /sbin, ArchLinux under /usr/bin, Android under /system/bin. + private static readonly string[] s_binFolders = { "/bin/", "/sbin/", "/usr/bin/", "/system/bin" }; private const string s_ipv4PingFile = "ping"; private const string s_ipv6PingFile = "ping6"; diff --git a/src/libraries/Common/src/System/Runtime/InteropServices/ComEventsMethod.cs b/src/libraries/Common/src/System/Runtime/InteropServices/ComEventsMethod.cs index e8e736e0d78904..c07d944ea0fe65 100644 --- a/src/libraries/Common/src/System/Runtime/InteropServices/ComEventsMethod.cs +++ b/src/libraries/Common/src/System/Runtime/InteropServices/ComEventsMethod.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Threading; using System.Reflection; namespace System.Runtime.InteropServices @@ -102,7 +103,7 @@ private void PreProcessSignature() /// Since multicast delegate's built-in chaining supports only chaining instances of the same type, /// we need to complement this design by using an explicit linked list data structure. /// - private readonly List _delegateWrappers = new List(); + private DelegateWrapper[] _delegateWrappers = Array.Empty(); private readonly int _dispid; private ComEventsMethod? _next; @@ -157,48 +158,36 @@ public static ComEventsMethod Add(ComEventsMethod? methods, ComEventsMethod meth public bool Empty { - get - { - lock (_delegateWrappers) - { - return _delegateWrappers.Count == 0; - } - } + get => _delegateWrappers.Length == 0; } public void AddDelegate(Delegate d, bool wrapArgs = false) { - lock (_delegateWrappers) + DelegateWrapper[] wrappers, newWrappers; + do { - // Update an existing delegate wrapper - foreach (DelegateWrapper wrapper in _delegateWrappers) - { - if (wrapper.Delegate.GetType() == d.GetType() && wrapper.WrapArgs == wrapArgs) - { - wrapper.Delegate = Delegate.Combine(wrapper.Delegate, d); - return; - } - } - - var newWrapper = new DelegateWrapper(d, wrapArgs); - _delegateWrappers.Add(newWrapper); - } + wrappers = _delegateWrappers; + newWrappers = new DelegateWrapper[wrappers.Length + 1]; + wrappers.CopyTo(newWrappers, 0); + newWrappers[^1] = new DelegateWrapper(d, wrapArgs); + } while (!PublishNewWrappers(newWrappers, wrappers)); } public void RemoveDelegate(Delegate d, bool wrapArgs = false) { - lock (_delegateWrappers) + DelegateWrapper[] wrappers, newWrappers; + do { + wrappers = _delegateWrappers; + // Find delegate wrapper index int removeIdx = -1; - DelegateWrapper? wrapper = null; - for (int i = 0; i < _delegateWrappers.Count; i++) + for (int i = 0; i < wrappers.Length; i++) { - DelegateWrapper wrapperMaybe = _delegateWrappers[i]; - if (wrapperMaybe.Delegate.GetType() == d.GetType() && wrapperMaybe.WrapArgs == wrapArgs) + DelegateWrapper wrapperMaybe = wrappers[i]; + if (wrapperMaybe.Delegate == d && wrapperMaybe.WrapArgs == wrapArgs) { removeIdx = i; - wrapper = wrapperMaybe; break; } } @@ -209,51 +198,23 @@ public void RemoveDelegate(Delegate d, bool wrapArgs = false) return; } - // Update wrapper or remove from collection - Delegate? newDelegate = Delegate.Remove(wrapper!.Delegate, d); - if (newDelegate != null) - { - wrapper.Delegate = newDelegate; - } - else - { - _delegateWrappers.RemoveAt(removeIdx); - } - } + newWrappers = new DelegateWrapper[wrappers.Length - 1]; + wrappers.AsSpan(0, removeIdx).CopyTo(newWrappers); + wrappers.AsSpan(removeIdx + 1).CopyTo(newWrappers.AsSpan(removeIdx)); + } while (!PublishNewWrappers(newWrappers, wrappers)); } public void RemoveDelegates(Func condition) { - lock (_delegateWrappers) + DelegateWrapper[] wrappers, newWrappers; + do { - // Find delegate wrapper indexes. Iterate in reverse such that the list to remove is sorted by high to low index. - List toRemove = new List(); - for (int i = _delegateWrappers.Count - 1; i >= 0; i--) - { - DelegateWrapper wrapper = _delegateWrappers[i]; - Delegate[] invocationList = wrapper.Delegate.GetInvocationList(); - foreach (Delegate delegateMaybe in invocationList) - { - if (condition(delegateMaybe)) - { - Delegate? newDelegate = Delegate.Remove(wrapper!.Delegate, delegateMaybe); - if (newDelegate != null) - { - wrapper.Delegate = newDelegate; - } - else - { - toRemove.Add(i); - } - } - } - } - - foreach (int idx in toRemove) - { - _delegateWrappers.RemoveAt(idx); - } + wrappers = _delegateWrappers; + List tmp = new(wrappers); + tmp.RemoveAll(w => condition(w.Delegate)); + newWrappers = tmp.ToArray(); } + while (!PublishNewWrappers(newWrappers, wrappers)); } public object? Invoke(object[] args) @@ -261,15 +222,18 @@ public void RemoveDelegates(Func condition) Debug.Assert(!Empty); object? result = null; - lock (_delegateWrappers) + foreach (DelegateWrapper wrapper in _delegateWrappers) { - foreach (DelegateWrapper wrapper in _delegateWrappers) - { - result = wrapper.Invoke(args); - } + result = wrapper.Invoke(args); } return result; } + + // Attempt to update the member wrapper field + private bool PublishNewWrappers(DelegateWrapper[] newWrappers, DelegateWrapper[] currentMaybe) + { + return Interlocked.CompareExchange(ref _delegateWrappers, newWrappers, currentMaybe) == currentMaybe; + } } } diff --git a/src/libraries/Common/src/System/Security/Cryptography/DSAKeyFormatHelper.cs b/src/libraries/Common/src/System/Security/Cryptography/DSAKeyFormatHelper.cs index 63c7b451e142b4..e63792f3ba1aca 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/DSAKeyFormatHelper.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/DSAKeyFormatHelper.cs @@ -25,16 +25,6 @@ internal static void ReadDsaPrivateKey( throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); } - DssParms parms = DssParms.Decode(algId.Parameters.Value, AsnEncodingRules.BER); - - ret = new DSAParameters - { - P = parms.P.ToByteArray(isUnsigned: true, isBigEndian: true), - Q = parms.Q.ToByteArray(isUnsigned: true, isBigEndian: true), - }; - - ret.G = parms.G.ExportKeyParameter(ret.P.Length); - BigInteger x; try @@ -57,6 +47,34 @@ internal static void ReadDsaPrivateKey( throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); } + DssParms parms = DssParms.Decode(algId.Parameters.Value, AsnEncodingRules.BER); + + // Sanity checks from FIPS 186-4 4.1/4.2. Since FIPS 186-5 withdrew DSA/DSS + // these will never change again. + // + // This technically allows a non-standard combination of 1024-bit P and 256-bit Q, + // but that will get filtered out by the underlying provider. + // These checks just prevent obviously bad data from wasting work on reinterpretation. + + if (parms.P.Sign < 0 || + parms.Q.Sign < 0 || + !IsValidPLength(parms.P.GetBitLength()) || + !IsValidQLength(parms.Q.GetBitLength()) || + parms.G <= 1 || + parms.G >= parms.P || + x <= 1 || + x >= parms.Q) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + ret = new DSAParameters + { + P = parms.P.ToByteArray(isUnsigned: true, isBigEndian: true), + Q = parms.Q.ToByteArray(isUnsigned: true, isBigEndian: true), + }; + + ret.G = parms.G.ExportKeyParameter(ret.P.Length); ret.X = x.ExportKeyParameter(ret.Q.Length); // The public key is not contained within the format, calculate it. @@ -69,6 +87,11 @@ internal static void ReadDsaPublicKey( in AlgorithmIdentifierAsn algId, out DSAParameters ret) { + if (!algId.Parameters.HasValue) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + BigInteger y; try @@ -88,13 +111,27 @@ internal static void ReadDsaPublicKey( throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); } - if (!algId.Parameters.HasValue) + DssParms parms = DssParms.Decode(algId.Parameters.Value, AsnEncodingRules.BER); + + // Sanity checks from FIPS 186-4 4.1/4.2. Since FIPS 186-5 withdrew DSA/DSS + // these will never change again. + // + // This technically allows a non-standard combination of 1024-bit P and 256-bit Q, + // but that will get filtered out by the underlying provider. + // These checks just prevent obviously bad data from wasting work on reinterpretation. + + if (parms.P.Sign < 0 || + parms.Q.Sign < 0 || + !IsValidPLength(parms.P.GetBitLength()) || + !IsValidQLength(parms.Q.GetBitLength()) || + parms.G <= 1 || + parms.G >= parms.P || + y <= 1 || + y >= parms.P) { throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); } - DssParms parms = DssParms.Decode(algId.Parameters.Value, AsnEncodingRules.BER); - ret = new DSAParameters { P = parms.P.ToByteArray(isUnsigned: true, isBigEndian: true), @@ -105,6 +142,25 @@ internal static void ReadDsaPublicKey( ret.Y = y.ExportKeyParameter(ret.P.Length); } + private static bool IsValidPLength(long pBitLength) + { + return pBitLength switch + { + // FIPS 186-3/186-4 + 1024 or 2048 or 3072 => true, + // FIPS 186-1/186-2 + >= 512 and < 1024 => pBitLength % 64 == 0, + _ => false, + }; + } + + private static bool IsValidQLength(long qBitLength) + { + // FIPS 196-1/186-2 only allows 160 + // FIPS 186-3/186-4 allow 160/224/256 + return qBitLength is 160 or 224 or 256; + } + internal static void ReadSubjectPublicKeyInfo( ReadOnlySpan source, out int bytesRead, diff --git a/src/libraries/Common/src/System/Security/Cryptography/KdfWorkLimiter.cs b/src/libraries/Common/src/System/Security/Cryptography/KdfWorkLimiter.cs new file mode 100644 index 00000000000000..7500212fe27d9c --- /dev/null +++ b/src/libraries/Common/src/System/Security/Cryptography/KdfWorkLimiter.cs @@ -0,0 +1,86 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; + +namespace System.Security.Cryptography +{ + // Places KDF work limits on the current thread. + internal static class KdfWorkLimiter + { + [ThreadStatic] + private static State? t_state; + + // Entry point: sets the iteration limit to a new value. + internal static void SetIterationLimit(ulong workLimit) + { + Debug.Assert(t_state == null, "This method is not intended to be called recursively."); + State state = new State(); + state.RemainingAllowedWork = workLimit; + t_state = state; + } + + internal static bool WasWorkLimitExceeded() + { + Debug.Assert(t_state != null, "This method should only be called within a protected block."); + return t_state.WorkLimitWasExceeded; + } + + // Removes any iteration limit on the current thread. + internal static void ResetIterationLimit() + { + t_state = null; + } + + // Records that we're about to perform some amount of work. + // Overflows if the work count is exceeded. + internal static void RecordIterations(int workCount) + { + RecordIterations((long)workCount); + } + + // Records that we're about to perform some amount of work. + // Overflows if the work count is exceeded. + internal static void RecordIterations(long workCount) + { + State? state = t_state; + if (state == null) + { + return; + } + + bool success = false; + + if (workCount < 0) + { + throw new CryptographicException(); + } + + try + { + if (!state.WorkLimitWasExceeded) + { + state.RemainingAllowedWork = checked(state.RemainingAllowedWork - (ulong)workCount); + success = true; + } + } + finally + { + // If for any reason we failed, mark the thread as "no further work allowed" and + // normalize to CryptographicException. + if (!success) + { + state.RemainingAllowedWork = 0; + state.WorkLimitWasExceeded = true; + throw new CryptographicException(); + } + } + } + + private sealed class State + { + internal ulong RemainingAllowedWork; + internal bool WorkLimitWasExceeded; + } + } +} diff --git a/src/libraries/Common/src/System/Security/Cryptography/PasswordBasedEncryption.cs b/src/libraries/Common/src/System/Security/Cryptography/PasswordBasedEncryption.cs index dc1fd465acfe3b..d988ad14288e40 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/PasswordBasedEncryption.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/PasswordBasedEncryption.cs @@ -377,6 +377,7 @@ internal static unsafe int Encrypt( Debug.Assert(pwdTmpBytes!.Length == 0); } + KdfWorkLimiter.RecordIterations(iterationCount); using (var pbkdf2 = new Rfc2898DeriveBytes(pwdTmpBytes, salt.ToArray(), iterationCount, prf)) { derivedKey = pbkdf2.GetBytes(keySizeBytes); diff --git a/src/libraries/Common/src/System/Security/Cryptography/Pkcs12Kdf.cs b/src/libraries/Common/src/System/Security/Cryptography/Pkcs12Kdf.cs index 132b7a7e354835..feb6b9604b89d3 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/Pkcs12Kdf.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/Pkcs12Kdf.cs @@ -147,6 +147,7 @@ private static void Derive( I = IRented.AsSpan(0, ILen); } + KdfWorkLimiter.RecordIterations(iterationCount); IncrementalHash hash = IncrementalHash.CreateHash(hashAlgorithm); try diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs b/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs index afe27f535cd260..e7885d8456b4cf 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs @@ -217,7 +217,7 @@ private static bool TryDecrypt( if (rsaPaddingProcessor != null) { - return rsaPaddingProcessor.DepadOaep(paddingBuf, destination, out bytesWritten); + return rsaPaddingProcessor.DepadOaep(paddingBuf.AsSpan(0, returnValue), destination, out bytesWritten); } else { diff --git a/src/libraries/Common/src/System/Security/Cryptography/RsaPaddingProcessor.cs b/src/libraries/Common/src/System/Security/Cryptography/RsaPaddingProcessor.cs index 9538db1414322f..9d997165fde676 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/RsaPaddingProcessor.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/RsaPaddingProcessor.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Buffers; using System.Buffers.Binary; using System.Collections.Concurrent; using System.Diagnostics; @@ -147,6 +148,109 @@ internal static void PadPkcs1Encryption( source.CopyTo(mInEM); } + internal static OperationStatus DepadPkcs1Encryption( + ReadOnlySpan source, + Span destination, + out int bytesWritten) + { + int primitive = DepadPkcs1Encryption(source); + int primitiveSign = SignStretch(primitive); + + // Primitive is a positive length, or ~length to indicate + // an error, so flip ~length to length if the high bit is set. + int len = Choose(primitiveSign, ~primitive, primitive); + int spaceRemain = destination.Length - len; + int spaceRemainSign = SignStretch(spaceRemain); + + // len = clampHigh(len, destination.Length); + len = Choose(spaceRemainSign, destination.Length, len); + + // ret = spaceRemain < 0 ? DestinationTooSmall : Done + int ret = Choose( + spaceRemainSign, + (int)OperationStatus.DestinationTooSmall, + (int)OperationStatus.Done); + + // ret = primitive < 0 ? InvalidData : ret; + ret = Choose(primitiveSign, (int)OperationStatus.InvalidData, ret); + + // Write some number of bytes, regardless of the final return. + source[^len..].CopyTo(destination); + + // bytesWritten = ret == Done ? len : 0; + bytesWritten = Choose(CheckZero(ret), len, 0); + return (OperationStatus)ret; + } + + private static int DepadPkcs1Encryption(ReadOnlySpan source) + { + Debug.Assert(source.Length > 11); + ReadOnlySpan afterPadding = source.Slice(10); + ReadOnlySpan noZeros = source.Slice(2, 8); + + // Find the first zero in noZeros, or -1 for no zeros. + int zeroPos = BlindFindFirstZero(noZeros); + + // If zeroPos is negative, valid is -1, otherwise 0. + int valid = SignStretch(zeroPos); + + // If there are no zeros in afterPadding then zeroPos is negative, + // so negating the sign stretch is 0, which makes hasPos 0. + // If there -was- a zero, sign stretching is 0, so negating it makes hasPos -1. + zeroPos = BlindFindFirstZero(afterPadding); + int hasLen = ~SignStretch(zeroPos); + valid &= hasLen; + + // Check that the first two bytes are { 00 02 } + valid &= CheckZero(source[0] | (source[1] ^ 0x02)); + + int lenIfGood = afterPadding.Length - zeroPos - 1; + // If there were no zeros, use the full after-min-padding segment. + int lenIfBad = ~Choose(hasLen, lenIfGood, source.Length - 11); + + Debug.Assert(lenIfBad < 0); + return Choose(valid, lenIfGood, lenIfBad); + } + + private static int BlindFindFirstZero(ReadOnlySpan source) + { + // Any vectorization of this routine needs to use non-early termination, + // and instructions that do not vary their completion time on the input. + + int pos = -1; + + for (int i = source.Length - 1; i >= 0; i--) + { + // pos = source[i] == 0 ? i : pos; + int local = CheckZero(source[i]); + pos = Choose(local, i, pos); + } + + return pos; + } + + private static int SignStretch(int value) + { + return value >> 31; + } + + private static int Choose(int selector, int yes, int no) + { + Debug.Assert((selector | (selector - 1)) == -1); + return (selector & yes) | (~selector & no); + } + + private static int CheckZero(int value) + { + // For zero, ~value and value-1 are both all bits set (negative). + // For positive values, ~value is negative and value-1 is positive. + // For negative values except MinValue, ~value is positive and value-1 is negative. + // For MinValue, ~value is positive and value-1 is also positive. + // All together, the only thing that has negative & negative is 0, so stretch the sign bit. + int mask = ~value & (value - 1); + return SignStretch(mask); + } + internal void PadPkcs1Signature( ReadOnlySpan source, Span destination) diff --git a/src/libraries/Common/tests/SourceGenerators/RoslynTestUtils.cs b/src/libraries/Common/tests/SourceGenerators/RoslynTestUtils.cs index 4928270b06f170..23b1d5959aced5 100644 --- a/src/libraries/Common/tests/SourceGenerators/RoslynTestUtils.cs +++ b/src/libraries/Common/tests/SourceGenerators/RoslynTestUtils.cs @@ -48,10 +48,10 @@ public static Project CreateTestProject(IEnumerable? references, bool } return new AdhocWorkspace() - .AddSolution(SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create())) - .AddProject("Test", "test.dll", "C#") - .WithMetadataReferences(refs) - .WithCompilationOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable)); + .AddSolution(SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create())) + .AddProject("Test", "test.dll", "C#") + .WithMetadataReferences(refs) + .WithCompilationOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithNullableContextOptions(NullableContextOptions.Enable)); } public static Task CommitChanges(this Project proj, params string[] ignorables) @@ -141,23 +141,44 @@ public static TextSpan MakeSpan(string text, int spanNum) /// Runs a Roslyn generator over a set of source files. /// public static async Task<(ImmutableArray, ImmutableArray)> RunGenerator( +#if ROSLYN4_0_OR_GREATER + IIncrementalGenerator generator, +#else ISourceGenerator generator, +#endif IEnumerable? references, IEnumerable sources, - AnalyzerConfigOptionsProvider? optionsProvider = null, bool includeBaseReferences = true, CancellationToken cancellationToken = default) { Project proj = CreateTestProject(references, includeBaseReferences); - proj = proj.WithDocuments(sources); - Assert.True(proj.Solution.Workspace.TryApplyChanges(proj.Solution)); - Compilation? comp = await proj!.GetCompilationAsync(CancellationToken.None).ConfigureAwait(false); + return RunGenerator(comp!, generator, cancellationToken); + } - CSharpGeneratorDriver cgd = CSharpGeneratorDriver.Create(new[] { generator }, optionsProvider: optionsProvider); - GeneratorDriver gd = cgd.RunGenerators(comp!, cancellationToken); + /// + /// Runs a Roslyn generator given a Compilation. + /// + public static (ImmutableArray, ImmutableArray) RunGenerator( + Compilation compilation, +#if ROSLYN4_0_OR_GREATER + IIncrementalGenerator generator, +#else + ISourceGenerator generator, +#endif + CancellationToken cancellationToken = default) + { +#if ROSLYN4_0_OR_GREATER + // workaround https://github.com/dotnet/roslyn/pull/55866. We can remove "LangVersion=Preview" when we get a Roslyn build with that change. + CSharpParseOptions options = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Preview); + CSharpGeneratorDriver cgd = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, parseOptions: options); +#else + CSharpGeneratorDriver cgd = CSharpGeneratorDriver.Create(new[] { generator }); +#endif + + GeneratorDriver gd = cgd.RunGenerators(compilation, cancellationToken); GeneratorDriverRunResult r = gd.GetRunResult(); return (r.Results[0].Diagnostics, r.Results[0].GeneratedSources); diff --git a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/apacheweb/Dockerfile b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/apacheweb/Dockerfile index 0b6a7b19eba885..d3e266f4f7810d 100644 --- a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/apacheweb/Dockerfile +++ b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/apacheweb/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-20220421022739-9c434db ARG DEBIAN_FRONTEND=noninteractive diff --git a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/docker-compose.yml b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/docker-compose.yml index c54adfb7caaea3..0b524f35b381f1 100644 --- a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/docker-compose.yml +++ b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/docker-compose.yml @@ -60,6 +60,9 @@ services: hostname: linuxclient domainname: linux.contoso.com dns_search: linux.contoso.com + privileged: true + dns: + - 8.8.8.8 volumes: - shared-volume:/SHARED - ${DOTNET_RUNTIME_REPO_ROOT}:/repo diff --git a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/kdc/Dockerfile b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/kdc/Dockerfile index 1b28145ff833be..9abd3fa729d3ad 100644 --- a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/kdc/Dockerfile +++ b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/kdc/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-20220421022739-9c434db COPY ./kdc/kadm5.acl /etc/krb5kdc/ COPY ./kdc/kdc.conf /etc/krb5kdc/ diff --git a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/linuxclient/Dockerfile b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/linuxclient/Dockerfile index 8bb94ba8aa9924..7b7afc1b4a9b94 100644 --- a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/linuxclient/Dockerfile +++ b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/linuxclient/Dockerfile @@ -1,31 +1,12 @@ -# Switch to mcr.microsoft.com/dotnet-buildtools/prereqs ubuntu 18.04 images when they are fixed -FROM ubuntu:18.04 +FROM mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-20220421022739-9c434db # Prevents dialog prompting when installing packages ARG DEBIAN_FRONTEND=noninteractive -# This 'RUN' step can be removed once dotnet-buildtools/prereqs image is fixed -# -# Makes the image capable of building and running tests in dotnet-runtime repo. -# Add retries to apt-get since the ubuntu package servers have had errors lately such as: -# "E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/publicsuffix/publicsuffix_20180223.1310-1_all.deb Undetermined Error [IP: 91.189.88.31 80]" -ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 -RUN echo "APT::Acquire::Retries \"10\";" > /etc/apt/apt.conf.d/80-retries && \ - apt-get update && \ - apt-get install -y --no-install-recommends apt-transport-https ca-certificates gnupg software-properties-common wget && \ - wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - && \ - apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' && \ - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | apt-key add - && \ - apt-add-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' && \ - apt-get update && \ - apt-get install -y --no-install-recommends cmake llvm-9 clang-9 lldb-6.0 liblldb-6.0-dev libunwind8 libunwind-dev gettext libicu-dev liblttng-ust-dev libssl-dev libnuma-dev libkrb5-dev locales && \ - locale-gen en_US.UTF-8 && \ - update-locale LANG=en_US.UTF-8 - # Install Kerberos, NTLM, and diagnostic tools COPY ./common/krb5.conf /etc/krb5.conf RUN apt-get update && \ - apt-get install -y --no-install-recommends krb5-user gss-ntlmssp iputils-ping dnsutils nano curl + apt-get install -y --no-install-recommends krb5-user gss-ntlmssp iputils-ping dnsutils nano # Set environment variable to turn on enterprise tests ENV DOTNET_RUNTIME_ENTERPRISETESTS_ENABLED 1 diff --git a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/linuxclient/test-webserver.sh b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/linuxclient/test-webserver.sh index 2afd01f34335cf..058604296dc3b0 100644 --- a/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/linuxclient/test-webserver.sh +++ b/src/libraries/Common/tests/System/Net/EnterpriseTests/setup/linuxclient/test-webserver.sh @@ -4,3 +4,6 @@ kdestroy echo password | kinit user1 curl --verbose --negotiate -u: http://apacheweb.linux.contoso.com kdestroy + +nslookup github.com + diff --git a/src/libraries/Common/tests/System/Net/Http/Http3LoopbackStream.cs b/src/libraries/Common/tests/System/Net/Http/Http3LoopbackStream.cs index 958cb2abc1e156..346098414b39bd 100644 --- a/src/libraries/Common/tests/System/Net/Http/Http3LoopbackStream.cs +++ b/src/libraries/Common/tests/System/Net/Http/Http3LoopbackStream.cs @@ -20,10 +20,10 @@ internal sealed class Http3LoopbackStream : IDisposable private const int MaximumVarIntBytes = 8; private const long VarIntMax = (1L << 62) - 1; - private const long DataFrame = 0x0; - private const long HeadersFrame = 0x1; - private const long SettingsFrame = 0x4; - private const long GoAwayFrame = 0x7; + public const long DataFrame = 0x0; + public const long HeadersFrame = 0x1; + public const long SettingsFrame = 0x4; + public const long GoAwayFrame = 0x7; public const long ControlStream = 0x0; public const long PushStream = 0x1; diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Authentication.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Authentication.cs index 41718d37eb869e..7d0a476dd1a951 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Authentication.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Authentication.cs @@ -203,7 +203,7 @@ public static IEnumerable Authentication_TestData() { yield return new object[] { "Basic realm=\"testrealm\"", true }; yield return new object[] { "Basic ", true }; - yield return new object[] { "Basic realm=withoutquotes", true }; + yield return new object[] { "Basic realm=PLACEHOLDERwithoutquotes", true }; yield return new object[] { "basic ", true }; yield return new object[] { "bAsiC ", true }; yield return new object[] { "basic", true }; diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Decompression.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Decompression.cs index 88ac334a06de97..439cadf32ae620 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Decompression.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Decompression.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; +using System.Linq; using System.Net.Test.Common; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -26,19 +27,29 @@ public abstract class HttpClientHandler_Decompression_Test : HttpClientHandlerTe #endif public HttpClientHandler_Decompression_Test(ITestOutputHelper output) : base(output) { } + public static IEnumerable DecompressedResponse_MethodSpecified_DecompressedContentReturned_MemberData() => + from compressionName in new[] { "gzip", "zlib", "deflate", "br" } + from all in new[] { false, true } + from copyTo in new[] { false, true } + from contentLength in new[] { 0, 1, 12345 } + select new object[] { compressionName, all, copyTo, contentLength }; + [Theory] - [InlineData("gzip", false)] - [InlineData("gzip", true)] - [InlineData("deflate", false)] - [InlineData("deflate", true)] - [InlineData("br", false)] - [InlineData("br", true)] + [MemberData(nameof(DecompressedResponse_MethodSpecified_DecompressedContentReturned_MemberData))] [SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")] - public async Task DecompressedResponse_MethodSpecified_DecompressedContentReturned(string encodingName, bool all) + public async Task DecompressedResponse_MethodSpecified_DecompressedContentReturned(string compressionName, bool all, bool useCopyTo, int contentLength) { + if (IsWinHttpHandler && + (compressionName == "br" || compressionName == "zlib")) + { + // brotli and zlib not supported on WinHttpHandler + return; + } + Func compress; DecompressionMethods methods; - switch (encodingName) + string encodingName = compressionName; + switch (compressionName) { case "gzip": compress = s => new GZipStream(s, CompressionLevel.Optimal, leaveOpen: true); @@ -47,32 +58,27 @@ public async Task DecompressedResponse_MethodSpecified_DecompressedContentReturn #if !NETFRAMEWORK case "br": - if (IsWinHttpHandler) - { - // Brotli only supported on SocketsHttpHandler. - return; - } - compress = s => new BrotliStream(s, CompressionLevel.Optimal, leaveOpen: true); methods = all ? DecompressionMethods.Brotli : _all; break; - case "deflate": - // WinHttpHandler continues to use DeflateStream as it doesn't have a newer build than netstandard2.0 - // and doesn't have access to ZLibStream. - compress = IsWinHttpHandler ? - new Func(s => new DeflateStream(s, CompressionLevel.Optimal, leaveOpen: true)) : - new Func(s => new ZLibStream(s, CompressionLevel.Optimal, leaveOpen: true)); + case "zlib": + compress = s => new ZLibStream(s, CompressionLevel.Optimal, leaveOpen: true); methods = all ? DecompressionMethods.Deflate : _all; + encodingName = "deflate"; break; #endif + case "deflate": + compress = s => new DeflateStream(s, CompressionLevel.Optimal, leaveOpen: true); + methods = all ? DecompressionMethods.Deflate : _all; + break; + default: - Assert.Contains(encodingName, new[] { "br", "deflate", "gzip" }); - return; + throw new Exception($"Unexpected compression: {compressionName}"); } - var expectedContent = new byte[12345]; + var expectedContent = new byte[contentLength]; new Random(42).NextBytes(expectedContent); await LoopbackServer.CreateClientAndServerAsync(async uri => @@ -81,7 +87,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => using (HttpClient client = CreateHttpClient(handler)) { handler.AutomaticDecompression = methods; - Assert.Equal(expectedContent, await client.GetByteArrayAsync(uri)); + AssertExtensions.SequenceEqual(expectedContent, await client.GetByteArrayAsync(TestAsync, useCopyTo, uri)); } }, async server => { @@ -99,33 +105,39 @@ await server.AcceptConnectionAsync(async connection => public static IEnumerable DecompressedResponse_MethodNotSpecified_OriginalContentReturned_MemberData() { - yield return new object[] + foreach (bool useCopyTo in new[] { false, true }) { - "gzip", - new Func(s => new GZipStream(s, CompressionLevel.Optimal, leaveOpen: true)), - DecompressionMethods.None - }; + yield return new object[] + { + "gzip", + new Func(s => new GZipStream(s, CompressionLevel.Optimal, leaveOpen: true)), + DecompressionMethods.None, + useCopyTo + }; #if !NETFRAMEWORK - yield return new object[] - { - "deflate", - new Func(s => new ZLibStream(s, CompressionLevel.Optimal, leaveOpen: true)), - DecompressionMethods.Brotli - }; - yield return new object[] - { - "br", - new Func(s => new BrotliStream(s, CompressionLevel.Optimal, leaveOpen: true)), - DecompressionMethods.Deflate | DecompressionMethods.GZip - }; + yield return new object[] + { + "deflate", + new Func(s => new ZLibStream(s, CompressionLevel.Optimal, leaveOpen: true)), + DecompressionMethods.Brotli, + useCopyTo + }; + yield return new object[] + { + "br", + new Func(s => new BrotliStream(s, CompressionLevel.Optimal, leaveOpen: true)), + DecompressionMethods.Deflate | DecompressionMethods.GZip, + useCopyTo + }; #endif + } } [Theory] [MemberData(nameof(DecompressedResponse_MethodNotSpecified_OriginalContentReturned_MemberData))] [SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")] public async Task DecompressedResponse_MethodNotSpecified_OriginalContentReturned( - string encodingName, Func compress, DecompressionMethods methods) + string encodingName, Func compress, DecompressionMethods methods, bool useCopyTo) { var expectedContent = new byte[12345]; new Random(42).NextBytes(expectedContent); @@ -143,7 +155,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => using (HttpClient client = CreateHttpClient(handler)) { handler.AutomaticDecompression = methods; - Assert.Equal(compressedContent, await client.GetByteArrayAsync(uri)); + AssertExtensions.SequenceEqual(compressedContent, await client.GetByteArrayAsync(TestAsync, useCopyTo, uri)); } }, async server => { @@ -156,6 +168,33 @@ await server.AcceptConnectionAsync(async connection => }); } + [Theory] + [InlineData("gzip", DecompressionMethods.GZip)] +#if !NETFRAMEWORK + [InlineData("deflate", DecompressionMethods.Deflate)] + [InlineData("br", DecompressionMethods.Brotli)] +#endif + [SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")] + public async Task DecompressedResponse_EmptyBody_Success(string encodingName, DecompressionMethods methods) + { + await LoopbackServer.CreateClientAndServerAsync(async uri => + { + using (HttpClientHandler handler = CreateHttpClientHandler()) + using (HttpClient client = CreateHttpClient(handler)) + { + handler.AutomaticDecompression = methods; + Assert.Equal(Array.Empty(), await client.GetByteArrayAsync(TestAsync, useCopyTo: false, uri)); + } + }, async server => + { + await server.AcceptConnectionAsync(async connection => + { + await connection.ReadRequestHeaderAsync(); + await connection.WriteStringAsync($"HTTP/1.1 200 OK\r\nContent-Encoding: {encodingName}\r\n\r\n"); + }); + }); + } + [Theory] #if NETCOREAPP [InlineData(DecompressionMethods.Brotli, "br", "")] diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.RemoteServer.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.RemoteServer.cs index 9fd29a905f97f2..5e8b94d33705cc 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.RemoteServer.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.RemoteServer.cs @@ -136,7 +136,7 @@ public async Task GetAsync_ServerNeedsBasicAuthAndSetDefaultCredentials_StatusCo handler.Credentials = CredentialCache.DefaultCredentials; using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer, handler)) { - Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password); + Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password); using (HttpResponseMessage response = await client.GetAsync(uri)) { Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); @@ -153,7 +153,7 @@ public async Task GetAsync_ServerNeedsAuthAndSetCredential_StatusCodeOK(Configur handler.Credentials = _credential; using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer, handler)) { - Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password); + Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password); using (HttpResponseMessage response = await client.GetAsync(uri)) { Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -167,7 +167,7 @@ public async Task GetAsync_ServerNeedsAuthAndNoCredential_StatusCodeUnauthorized { using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer)) { - Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password); + Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password); using (HttpResponseMessage response = await client.GetAsync(uri)) { Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); @@ -1033,7 +1033,7 @@ public async Task GetAsync_AllowAutoRedirectTrue_RedirectToUriWithParams_Request { HttpClientHandler handler = CreateHttpClientHandler(); handler.AllowAutoRedirect = true; - Uri targetUri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password); + Uri targetUri = remoteServer.BasicAuthUriForCreds(Username, Password); using (HttpClient client = CreateHttpClientForRemoteServer(remoteServer, handler)) { Uri uri = remoteServer.RedirectUriForDestinationUri( @@ -1133,8 +1133,8 @@ public async Task GetAsync_CredentialIsNetworkCredentialUriRedirect_StatusCodeUn { Uri redirectUri = remoteServer.RedirectUriForCreds( statusCode: 302, - userName: Username, - password: Password); + Username, + Password); using (HttpResponseMessage unAuthResponse = await client.GetAsync(redirectUri)) { Assert.Equal(HttpStatusCode.Unauthorized, unAuthResponse.StatusCode); @@ -1153,15 +1153,15 @@ public async Task HttpClientHandler_CredentialIsNotCredentialCacheAfterRedirect_ { Uri redirectUri = remoteServer.RedirectUriForCreds( statusCode: 302, - userName: Username, - password: Password); + Username, + Password); using (HttpResponseMessage unAuthResponse = await client.GetAsync(redirectUri)) { Assert.Equal(HttpStatusCode.Unauthorized, unAuthResponse.StatusCode); } // Use the same handler to perform get request, authentication should succeed after redirect. - Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password); + Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password); using (HttpResponseMessage authResponse = await client.GetAsync(uri)) { Assert.Equal(HttpStatusCode.OK, authResponse.StatusCode); @@ -1180,11 +1180,11 @@ public async Task GetAsync_CredentialIsCredentialCacheUriRedirect_StatusCodeOK(C return; } - Uri uri = remoteServer.BasicAuthUriForCreds(userName: Username, password: Password); + Uri uri = remoteServer.BasicAuthUriForCreds(Username, Password); Uri redirectUri = remoteServer.RedirectUriForCreds( statusCode: statusCode, - userName: Username, - password: Password); + Username, + Password); _output.WriteLine(uri.AbsoluteUri); _output.WriteLine(redirectUri.AbsoluteUri); var credentialCache = new CredentialCache(); @@ -1237,8 +1237,9 @@ public static IEnumerable RemoteServersAndCompressionUris() { yield return new object[] { remoteServer, remoteServer.GZipUri }; - // Remote deflate endpoint isn't correctly following the deflate protocol. - //yield return new object[] { remoteServer, remoteServer.DeflateUri }; + // Remote deflate endpoint isn't correctly following the deflate protocol, + // but SocketsHttpHandler makes it work, anyway. + yield return new object[] { remoteServer, remoteServer.DeflateUri }; } } @@ -1271,10 +1272,6 @@ public async Task GetAsync_SetAutomaticDecompression_ContentDecompressed_GZip(Co } } - // The remote server endpoint was written to use DeflateStream, which isn't actually a correct - // implementation of the deflate protocol (the deflate protocol requires the zlib wrapper around - // deflate). Until we can get that updated (and deal with previous releases still testing it - // via a DeflateStream-based implementation), we utilize httpbin.org to help validate behavior. [OuterLoop("Uses external servers")] [Theory] [InlineData("http://httpbin.org/deflate", "\"deflated\": true")] diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs index c90753dd4025de..1d6c690516ec89 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs @@ -146,7 +146,8 @@ public async Task UseCallback_ValidCertificate_ExpectedValuesDuringCallback(Conf { bool callbackCalled = false; handler.CheckCertificateRevocationList = checkRevocation; - handler.ServerCertificateCustomValidationCallback = (request, cert, chain, errors) => { + handler.ServerCertificateCustomValidationCallback = (request, cert, chain, errors) => + { callbackCalled = true; Assert.NotNull(request); @@ -225,6 +226,7 @@ public async Task NoCallback_BadCertificate_ThrowsException(string url) } [OuterLoop("Uses external servers")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/77726")] [ConditionalFact(nameof(ClientSupportsDHECipherSuites))] public async Task NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds() { diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs index da250bf305f32c..d6ecb3bca3a2dc 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.SslProtocols.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Net.Security; using System.Net.Test.Common; @@ -121,7 +122,7 @@ public async Task GetAsync_AllowedSSLVersion_Succeeds(SslProtocols acceptedProto #if !NETFRAMEWORK handler.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13; #else - handler.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12; + handler.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | (SslProtocols)12288; #endif #pragma warning restore 0618 } @@ -294,9 +295,10 @@ await LoopbackServer.CreateServerAsync(async (server, url) => { await serverTask; } - catch (Exception e) when (e is IOException || e is AuthenticationException) + catch (Exception e) when (e is IOException || e is AuthenticationException || e is Win32Exception) { // Some SSL implementations simply close or reset connection after protocol mismatch. + // The call may fail if neither of the requested protocols is available // Newer OpenSSL sends Fatal Alert message before closing. return; } diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs index 17fcd64ee26d80..291611cd60ffcc 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs @@ -399,7 +399,7 @@ public async Task PostAsync_ManyDifferentRequestHeaders_SentCorrectly() } const string content = "hello world"; - + string authSafeValue = "QWxhZGRpbjpvcGVuIHNlc2FtZQ=="; // Using examples from https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields // Exercises all exposed request.Headers and request.Content.Headers strongly-typed properties await LoopbackServerFactory.CreateClientAndServerAsync(async uri => @@ -421,7 +421,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => request.Headers.Add("Access-Control-Request-Method", "GET"); request.Headers.Add("Access-Control-Request-Headers", "GET"); request.Headers.Add("Age", "12"); - request.Headers.Authorization = new AuthenticationHeaderValue("Basic", "QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); + request.Headers.Authorization = new AuthenticationHeaderValue("Basic", authSafeValue); request.Headers.CacheControl = new CacheControlHeaderValue() { NoCache = true }; request.Headers.Connection.Add("close"); request.Headers.Add("Cookie", "$Version=1; Skin=new"); @@ -444,7 +444,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => request.Headers.MaxForwards = 10; request.Headers.Add("Origin", "http://www.example-social-network.com"); request.Headers.Pragma.Add(new NameValueHeaderValue("no-cache")); - request.Headers.ProxyAuthorization = new AuthenticationHeaderValue("Basic", "QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); + request.Headers.ProxyAuthorization = new AuthenticationHeaderValue("Basic", authSafeValue); request.Headers.Range = new RangeHeaderValue(500, 999); request.Headers.Referrer = new Uri("http://en.wikipedia.org/wiki/Main_Page"); request.Headers.TE.Add(new TransferCodingWithQualityHeaderValue("trailers")); @@ -504,7 +504,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => Assert.Equal("GET", requestData.GetSingleHeaderValue("Access-Control-Request-Headers")); } Assert.Equal("12", requestData.GetSingleHeaderValue("Age")); - Assert.Equal("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", requestData.GetSingleHeaderValue("Authorization")); + Assert.Equal($"Basic {authSafeValue}", requestData.GetSingleHeaderValue("Authorization")); Assert.Equal("no-cache", requestData.GetSingleHeaderValue("Cache-Control")); if (PlatformDetection.IsNotBrowser) { @@ -512,7 +512,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => Assert.Equal("Tue, 15 Nov 1994 08:12:31 GMT", requestData.GetSingleHeaderValue("Date")); Assert.Equal("100-continue", requestData.GetSingleHeaderValue("Expect")); Assert.Equal("http://www.example-social-network.com", requestData.GetSingleHeaderValue("Origin")); - Assert.Equal("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", requestData.GetSingleHeaderValue("Proxy-Authorization")); + Assert.Equal($"Basic {authSafeValue}", requestData.GetSingleHeaderValue("Proxy-Authorization")); Assert.Equal("Mozilla/5.0", requestData.GetSingleHeaderValue("User-Agent")); Assert.Equal("http://en.wikipedia.org/wiki/Main_Page", requestData.GetSingleHeaderValue("Referer")); Assert.Equal("MyTrailer", requestData.GetSingleHeaderValue("Trailer")); diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTestBase.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTestBase.cs index 7d56c4ce48838b..798b23907cc9c0 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTestBase.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTestBase.cs @@ -196,5 +196,47 @@ public static Task ReadAsStreamAsync(this HttpContent content, bool asyn #endif } } + + public static Task GetByteArrayAsync(this HttpClient client, bool async, bool useCopyTo, Uri uri) + { +#if NETCOREAPP + return Task.Run(async () => + { + var m = new HttpRequestMessage(HttpMethod.Get, uri); + using HttpResponseMessage r = async ? await client.SendAsync(m, HttpCompletionOption.ResponseHeadersRead) : client.Send(m, HttpCompletionOption.ResponseHeadersRead); + using Stream s = async ? await r.Content.ReadAsStreamAsync() : r.Content.ReadAsStream(); + + var result = new MemoryStream(); + if (useCopyTo) + { + if (async) + { + await s.CopyToAsync(result); + } + else + { + s.CopyTo(result); + } + } + else + { + byte[] buffer = new byte[100]; + while (true) + { + int bytesRead = async ? await s.ReadAsync(buffer) : s.Read(buffer); + if (bytesRead == 0) + { + break; + } + result.Write(buffer.AsSpan(0, bytesRead)); + } + } + return result.ToArray(); + }); +#else + // For WinHttpHandler on .NET Framework, we fall back to ignoring async and useCopyTo. + return client.GetByteArrayAsync(uri); +#endif + } } } diff --git a/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs b/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs index 7594b4908010fc..2ec8717d900b4a 100644 --- a/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs +++ b/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs @@ -719,7 +719,7 @@ private async Task> ReadRequestHeaderBytesAsync() public async Task WriteStringAsync(string s) { byte[] bytes = Encoding.ASCII.GetBytes(s); - await _stream.WriteAsync(bytes); + await _stream.WriteAsync(bytes, 0, bytes.Length); } public async Task SendResponseAsync(string response) @@ -729,7 +729,7 @@ public async Task SendResponseAsync(string response) public async Task SendResponseAsync(byte[] response) { - await _stream.WriteAsync(response); + await _stream.WriteAsync(response, 0, response.Length); } public async Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, string additionalHeaders = null, string content = null) @@ -866,6 +866,12 @@ public override async Task ReadRequestBodyAsync() return buffer; } + public void CompleteRequestProcessing() + { + _contentLength = 0; + _bodyRead = false; + } + public override async Task SendResponseAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList headers = null, string content = "", bool isFinal = true, int requestId = 0) { MemoryStream headerBytes = new MemoryStream(); diff --git a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs index 98c19464db941a..b1ae822ea9e8fb 100644 --- a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs +++ b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs @@ -157,7 +157,7 @@ public static X509Certificate2 CreateServerSelfSignedCertificate(string name = " X509Certificate2 cert = req.CreateSelfSigned(start, end); if (PlatformDetection.IsWindows) { - cert = new X509Certificate2(cert.Export(X509ContentType.Pfx)); + cert = new X509Certificate2(cert.Export(X509ContentType.Pfx), (string?)null); } return cert; diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/README.md b/src/libraries/Common/tests/System/Net/Prerequisites/README.md index b273f0c48b902a..a1f766b07fe55d 100644 --- a/src/libraries/Common/tests/System/Net/Prerequisites/README.md +++ b/src/libraries/Common/tests/System/Net/Prerequisites/README.md @@ -38,10 +38,3 @@ This will join all machines to a test Active Directory and enable Windows Remoti Running as the Active Directory Administrator, run .\setup.ps1 from any of the machines within the environment. The script will use WinRM to connect and update all other roles. - -## Deployment Instructions to update the Azure-based environment - -1. Create a _Classic_ Azure WebService role. -2. Create a server certificate and add it to the subscription with the name: `CoreFxNetCertificate` -3. Edit `Servers\CoreFxNetCloudService\CoreFxNetCloudService\ServiceConfiguration.Cloud.cscfg` and ensure that the `CoreFxNetCertificate` `thumbprint` and `thumbprintAlgorithm` are correct. -4. Open the solution in Visual Studio and Run the Azure Publishing wizard to create and deploy the application. diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService.sln b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService.sln deleted file mode 100644 index b905dfaeecf721..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{CC5FD16D-436D-48AD-A40C-5A424C6E3E79}") = "CoreFxNetCloudService", "CoreFxNetCloudService\CoreFxNetCloudService.ccproj", "{57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServer", "WebServer\WebServer.csproj", "{6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}.Release|Any CPU.Build.0 = Release|Any CPU - {6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/CoreFxNetCloudService.ccproj b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/CoreFxNetCloudService.ccproj deleted file mode 100644 index 17b2a50c043d31..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/CoreFxNetCloudService.ccproj +++ /dev/null @@ -1,57 +0,0 @@ - - - - Debug - AnyCPU - 2.9 - 57e639ce-bd4d-4cb3-a913-ae51e18cd4a0 - Library - Properties - CoreFxNetCloudService - CoreFxNetCloudService - True - CoreFxNetCloudService - False - - - true - full - false - bin\Debug\ - DEBUG;TRACE - - - pdbonly - true - bin\Release\ - TRACE - - - - - - - - - - WebServer - {6acff710-5f63-4e46-b0da-0d1fe36ef4a7} - True - Web - WebServer - True - - - - - - - - - - - 10.0 - $(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\2.9\ - - - diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Cloud.cscfg b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Cloud.cscfg deleted file mode 100644 index 410b90b4dcc491..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Cloud.cscfg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Local.cscfg b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Local.cscfg deleted file mode 100644 index 473d8b0ce2c985..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Local.cscfg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceDefinition.csdef b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceDefinition.csdef deleted file mode 100644 index 66e00f2fd7803d..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceDefinition.csdef +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/WebServerContent/diagnostics.wadcfgx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/WebServerContent/diagnostics.wadcfgx deleted file mode 100644 index 8ca93efc6ebdda..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/WebServerContent/diagnostics.wadcfgx +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ecf/WebServerContent/diagnostics.wadcfgx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ecf/WebServerContent/diagnostics.wadcfgx deleted file mode 100644 index df40d84e9c3b58..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ecf/WebServerContent/diagnostics.wadcfgx +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - devstoreaccount1 - - - - - true - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/AuthenticationHelper.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/AuthenticationHelper.cs deleted file mode 100644 index e6ce64cbebb3f7..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/AuthenticationHelper.cs +++ /dev/null @@ -1,121 +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 System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Web; - -namespace WebServer -{ - public static class AuthenticationHelper - { - public static bool HandleAuthentication(HttpContext context) - { - string authType = context.Request.QueryString["auth"]; - string user = context.Request.QueryString["user"]; - string password = context.Request.QueryString["password"]; - string domain = context.Request.QueryString["domain"]; - - if (string.Equals("basic", authType, StringComparison.OrdinalIgnoreCase)) - { - if (!HandleBasicAuthentication(context, user, password, domain)) - { - context.Response.End(); - return false; - } - } - else if (string.Equals("Negotiate", authType, StringComparison.OrdinalIgnoreCase) || - string.Equals("NTLM", authType, StringComparison.OrdinalIgnoreCase)) - { - if (!HandleChallengeResponseAuthentication(context, authType, user, password, domain)) - { - context.Response.End(); - return false; - } - } - else if (authType != null) - { - context.Response.StatusCode = 501; - context.Response.StatusDescription = "Unsupported auth type: " + authType; - context.Response.End(); - return false; - } - - return true; - } - - private static bool HandleBasicAuthentication(HttpContext context, string user, string password, string domain) - { - const string WwwAuthenticateHeaderValue = "Basic realm=\"corefx-networking\""; - - string authHeader = context.Request.Headers["Authorization"]; - if (authHeader == null) - { - context.Response.StatusCode = 401; - context.Response.Headers.Add("WWW-Authenticate", WwwAuthenticateHeaderValue); - return false; - } - - string[] split = authHeader.Split(new char[] { ' ' }); - if (split.Length < 2) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = "Invalid Authorization header: " + authHeader; - return false; - } - - if (!string.Equals("basic", split[0], StringComparison.OrdinalIgnoreCase)) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = "Unsupported auth type: " + split[0]; - return false; - } - - // Decode base64 username:password. - byte[] bytes = Convert.FromBase64String(split[1]); - string credential = Encoding.ASCII.GetString(bytes); - string[] pair = credential.Split(new char[] { ':' }); - - // Prefix "domain\" to username if domain is specified. - if (domain != null) - { - user = domain + "\\" + user; - } - - if (pair.Length != 2 || pair[0] != user || pair[1] != password) - { - context.Response.StatusCode = 401; - context.Response.Headers.Add("WWW-Authenticate", WwwAuthenticateHeaderValue); - return false; - } - - // Success. - return true; - } - private static bool HandleChallengeResponseAuthentication( - HttpContext context, - string authType, - string user, - string password, - string domain) - { - string authHeader = context.Request.Headers["Authorization"]; - if (authHeader == null) - { - context.Response.StatusCode = 401; - context.Response.Headers.Add("WWW-Authenticate", authType); - return false; - } - - // We don't fully support this authentication method. - context.Response.StatusCode = 501; - context.Response.StatusDescription = string.Format( - "Attempt to use unsupported challenge/response auth type. {0}: {1}", - authType, - authHeader); - return false; - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/ContentHelper.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/ContentHelper.cs deleted file mode 100644 index ba64f862628f34..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/ContentHelper.cs +++ /dev/null @@ -1,53 +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 System; -using System.IO; -using System.IO.Compression; -using System.Security.Cryptography; -using System.Text; - -namespace WebServer -{ - public static class ContentHelper - { - public static byte[] GetDeflateBytes(string data) - { - byte[] bytes = Encoding.UTF8.GetBytes(data); - var compressedStream = new MemoryStream(); - - using (var compressor = new DeflateStream(compressedStream, CompressionMode.Compress, true)) - { - compressor.Write(bytes, 0, bytes.Length); - } - - return compressedStream.ToArray(); - } - - public static byte[] GetGZipBytes(string data) - { - byte[] bytes = Encoding.UTF8.GetBytes(data); - var compressedStream = new MemoryStream(); - - using (var compressor = new GZipStream(compressedStream, CompressionMode.Compress, true)) - { - compressor.Write(bytes, 0, bytes.Length); - } - - return compressedStream.ToArray(); - } - - public static byte[] ComputeMD5Hash(string data) - { - return ComputeMD5Hash(Encoding.UTF8.GetBytes(data)); - } - - public static byte[] ComputeMD5Hash(byte[] data) - { - using (MD5 md5 = MD5.Create()) - { - return md5.ComputeHash(data); - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx deleted file mode 100644 index 2a039a03b134d1..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="Deflate.ashx.cs" Class="WebServer.Deflate" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx.cs deleted file mode 100644 index ec90095d7bfe60..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx.cs +++ /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. - -using System; -using System.Web; - -namespace WebServer -{ - /// - /// Summary description for Deflate - /// - public class Deflate : IHttpHandler - { - public void ProcessRequest(HttpContext context) - { - string responseBody = "Sending DEFLATE compressed"; - - context.Response.Headers.Add("Content-MD5", Convert.ToBase64String(ContentHelper.ComputeMD5Hash(responseBody))); - context.Response.Headers.Add("Content-Encoding", "deflate"); - - context.Response.ContentType = "text/plain"; - - byte[] bytes = ContentHelper.GetDeflateBytes(responseBody); - context.Response.BinaryWrite(bytes); - } - - public bool IsReusable - { - get - { - return true; - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx deleted file mode 100644 index 05b60371b0c1c9..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="Echo.ashx.cs" Class="WebServer.Echo" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx.cs deleted file mode 100644 index 406193a506f5cd..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx.cs +++ /dev/null @@ -1,53 +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 System; -using System.Security.Cryptography; -using System.Text; -using System.Web; - -namespace WebServer -{ - public class Echo : IHttpHandler - { - public void ProcessRequest(HttpContext context) - { - RequestHelper.AddResponseCookies(context); - - if (!AuthenticationHelper.HandleAuthentication(context)) - { - context.Response.End(); - return; - } - - // Add original request method verb as a custom response header. - context.Response.Headers.Add("X-HttpRequest-Method", context.Request.HttpMethod); - - // Echo back JSON encoded payload. - RequestInformation info = RequestInformation.Create(context.Request); - string echoJson = info.SerializeToJson(); - - // Compute MD5 hash to clients can verify the received data. - using (MD5 md5 = MD5.Create()) - { - byte[] bytes = Encoding.UTF8.GetBytes(echoJson); - byte[] hash = md5.ComputeHash(bytes); - string encodedHash = Convert.ToBase64String(hash); - - context.Response.Headers.Add("Content-MD5", encodedHash); - context.Response.ContentType = "application/json"; - context.Response.Write(echoJson); - } - - context.Response.End(); - } - - public bool IsReusable - { - get - { - return true; - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx deleted file mode 100644 index a647c9a5da6b3b..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="EmptyContent.ashx.cs" Class="WebServer.EmptyContent" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx.cs deleted file mode 100644 index 66c09205cd574d..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx.cs +++ /dev/null @@ -1,30 +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 System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace WebServer -{ - /// - /// Summary description for EmptyContent - /// - public class EmptyContent : IHttpHandler - { - public void ProcessRequest(HttpContext context) - { - // By default, this empty method sends back a 200 status code with 'Content-Length: 0' response header. - // There are no other entity-body related (i.e. 'Content-Type') headers returned. - } - - public bool IsReusable - { - get - { - return true; - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx deleted file mode 100644 index b6ee5e1f5d8fca..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="GZip.ashx.cs" Class="WebServer.GZip" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx.cs deleted file mode 100644 index 64b334b32655b9..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx.cs +++ /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. - -using System; -using System.Web; - -namespace WebServer -{ - /// - /// Summary description for Gzip - /// - public class GZip : IHttpHandler - { - public void ProcessRequest(HttpContext context) - { - string responseBody = "Sending GZIP compressed"; - - context.Response.Headers.Add("Content-MD5", Convert.ToBase64String(ContentHelper.ComputeMD5Hash(responseBody))); - context.Response.Headers.Add("Content-Encoding", "gzip"); - - context.Response.ContentType = "text/plain"; - - byte[] bytes = ContentHelper.GetGZipBytes(responseBody); - context.Response.BinaryWrite(bytes); - } - - public bool IsReusable - { - get - { - return false; - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/NameValueCollectionConverter.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/NameValueCollectionConverter.cs deleted file mode 100644 index d0d78a366bdd25..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/NameValueCollectionConverter.cs +++ /dev/null @@ -1,76 +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 System; -using System.Collections.Specialized; - -using Newtonsoft.Json; - -namespace WebServer -{ - public class NameValueCollectionConverter : JsonConverter - { - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var collection = value as NameValueCollection; - if (collection == null) - { - return; - } - - writer.Formatting = Formatting.Indented; - writer.WriteStartObject(); - foreach (var key in collection.AllKeys) - { - writer.WritePropertyName(key); - writer.WriteValue(collection.Get(key)); - } - writer.WriteEndObject(); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - var nameValueCollection = new NameValueCollection(); - var key = ""; - while (reader.Read()) - { - if (reader.TokenType == JsonToken.StartObject) - { - nameValueCollection = new NameValueCollection(); - } - if (reader.TokenType == JsonToken.EndObject) - { - return nameValueCollection; - } - if (reader.TokenType == JsonToken.PropertyName) - { - key = reader.Value.ToString(); - } - if (reader.TokenType == JsonToken.String) - nameValueCollection.Add(key, reader.Value.ToString()); - } - return nameValueCollection; - } - - public override bool CanConvert(Type objectType) - { - return IsTypeDerivedFromType(objectType, typeof(NameValueCollection)); - } - - private bool IsTypeDerivedFromType(Type childType, Type parentType) - { - Type testType = childType; - while (testType != null) - { - if (testType == parentType) - { - return true; - } - - testType = testType.BaseType; - } - - return false; - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/AssemblyInfo.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/AssemblyInfo.cs deleted file mode 100644 index a32dd585a9ff69..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,30 +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 System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("WebServer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("WebServer")] -[assembly: AssemblyCopyright("Copyright \u00A9 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_CHK.pubxml b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_CHK.pubxml deleted file mode 100644 index 885092287ea9a5..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_CHK.pubxml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - FileSystem - Debug - Any CPU - - True - False - .\PublishToIIS - False - - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_RET.pubxml b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_RET.pubxml deleted file mode 100644 index 15494e57a62e89..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_RET.pubxml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - FileSystem - Release - Any CPU - - True - False - .\PublishToIIS - False - - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx deleted file mode 100644 index 819e88ec0d60b3..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="Redirect.ashx.cs" Class="WebServer.Redirect" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx.cs deleted file mode 100644 index 4c6ca5c342d1a0..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx.cs +++ /dev/null @@ -1,88 +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 System; -using System.Web; - -namespace WebServer -{ - /// - /// Summary description for Redirect - /// - public class Redirect : IHttpHandler - { - public void ProcessRequest(HttpContext context) - { - int statusCode = 302; - string statusCodeString = context.Request.QueryString["statuscode"]; - if (!string.IsNullOrEmpty(statusCodeString)) - { - try - { - statusCode = int.Parse(statusCodeString); - if (statusCode < 300 || statusCode > 307) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = "Invalid redirect statuscode: " + statusCodeString; - return; - } - } - catch (Exception) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = "Error parsing statuscode: " + statusCodeString; - return; - } - } - - string redirectUri = context.Request.QueryString["uri"]; - if (string.IsNullOrEmpty(redirectUri)) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = "Missing redirection uri"; - return; - } - - string hopsString = context.Request.QueryString["hops"]; - int hops = 1; - if (!string.IsNullOrEmpty(hopsString)) - { - try - { - hops = int.Parse(hopsString); - } - catch (Exception) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = "Error parsing hops: " + hopsString; - return; - } - } - - RequestHelper.AddResponseCookies(context); - - if (hops <= 1) - { - context.Response.Headers.Add("Location", redirectUri); - } - else - { - context.Response.Headers.Add( - "Location", - string.Format("/Redirect.ashx?uri={0}&hops={1}", - redirectUri, - hops - 1)); - } - - context.Response.StatusCode = statusCode; - } - - public bool IsReusable - { - get - { - return true; - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestHelper.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestHelper.cs deleted file mode 100644 index 39d5d3cf967ece..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestHelper.cs +++ /dev/null @@ -1,43 +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 System; -using System.Net; -using System.Web; - -namespace WebServer -{ - public static class RequestHelper - { - public static void AddResponseCookies(HttpContext context) - { - // Turn all 'X-SetCookie' request headers into 'Set-Cookie' response headers. - string headerName; - string headerValue; - for (int i = 0; i < context.Request.Headers.Count; i++) - { - headerName = context.Request.Headers.Keys[i]; - headerValue = context.Request.Headers[i]; - - if (string.Equals(headerName, "X-SetCookie", StringComparison.OrdinalIgnoreCase)) - { - context.Response.Headers.Add("Set-Cookie", headerValue); - } - } - } - - public static CookieCollection GetRequestCookies(HttpRequest request) - { - var cookieCollection = new CookieCollection(); - HttpCookieCollection cookies = request.Cookies; - - for (int i = 0; i < cookies.Count; i++) - { - var cookie = new Cookie(cookies[i].Name, cookies[i].Value); - cookieCollection.Add(cookie); - } - - return cookieCollection; - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestInformation.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestInformation.cs deleted file mode 100644 index 795f1a18e3527d..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestInformation.cs +++ /dev/null @@ -1,86 +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 System; -using System.Collections.Specialized; -using System.IO; -using System.Net; -using System.Web; - -using Newtonsoft.Json; - -namespace WebServer -{ - public class RequestInformation - { - public string Method { get; private set; } - - public string Url { get; private set; } - - public NameValueCollection Headers { get; private set; } - - public NameValueCollection Cookies { get; private set; } - - public string BodyContent { get; private set; } - - public int BodyLength { get; private set; } - - public bool SecureConnection { get; private set; } - - public bool ClientCertificatePresent { get; private set; } - - public HttpClientCertificate ClientCertificate { get; private set; } - - public static RequestInformation Create(HttpRequest request) - { - var info = new RequestInformation(); - info.Method = request.HttpMethod; - info.Url = request.RawUrl; - info.Headers = request.Headers; - - var cookies = new NameValueCollection(); - CookieCollection cookieCollection = RequestHelper.GetRequestCookies(request); - foreach (Cookie cookie in cookieCollection) - { - cookies.Add(cookie.Name, cookie.Value); - } - info.Cookies = cookies; - - Stream stream = request.GetBufferedInputStream(); - using (var reader = new StreamReader(stream)) - { - string body = reader.ReadToEnd(); - info.BodyContent = body; - info.BodyLength = body.Length; - } - - info.SecureConnection = request.IsSecureConnection; - - var cs = request.ClientCertificate; - info.ClientCertificatePresent = cs.IsPresent; - if (cs.IsPresent) - { - info.ClientCertificate = request.ClientCertificate; - } - - return info; - } - - public static RequestInformation DeSerializeFromJson(string json) - { - return (RequestInformation)JsonConvert.DeserializeObject( - json, - typeof(RequestInformation), - new NameValueCollectionConverter()); - } - - public string SerializeToJson() - { - return JsonConvert.SerializeObject(this, new NameValueCollectionConverter()); - } - - private RequestInformation() - { - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx deleted file mode 100644 index ea27244f48d5f2..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="StatusCode.ashx.cs" Class="WebServer.StatusCode" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx.cs deleted file mode 100644 index 02e3165759bfb1..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx.cs +++ /dev/null @@ -1,39 +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 System; -using System.Web; - -namespace WebServer -{ - public class StatusCode : IHttpHandler - { - public void ProcessRequest(HttpContext context) - { - string statusCodeString = context.Request.QueryString["statuscode"]; - string statusDescription = context.Request.QueryString["statusdescription"]; - try - { - int statusCode = int.Parse(statusCodeString); - context.Response.StatusCode = statusCode; - if (statusDescription != null) - { - context.Response.StatusDescription = statusDescription; - } - } - catch (Exception) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = "Error parsing statuscode: " + statusCodeString; - } - } - - public bool IsReusable - { - get - { - return true; - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx deleted file mode 100644 index 07bfc94e625d6d..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="Test.ashx.cs" Class="WebServer.Test" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx.cs deleted file mode 100644 index ad698047e5d92e..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx.cs +++ /dev/null @@ -1,45 +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 System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Net; -using System.Net.Http; -using System.Security.Cryptography; -using System.Text; -using System.Web; - -using Newtonsoft.Json; - -namespace WebServer -{ - public class Test : IHttpHandler - { - public void ProcessRequest(HttpContext context) - { - RequestInformation info = RequestInformation.Create(context.Request); - - string echoJson = info.SerializeToJson(); - - // Compute MD5 hash to clients can verify the received data. - MD5 md5 = MD5.Create(); - byte[] bytes = Encoding.ASCII.GetBytes(echoJson); - var hash = md5.ComputeHash(bytes); - string encodedHash = Convert.ToBase64String(hash); - context.Response.Headers.Add("Content-MD5", encodedHash); - - RequestInformation newEcho = RequestInformation.DeSerializeFromJson(echoJson); - context.Response.ContentType = "text/plain"; //"application/json"; - context.Response.Write(echoJson); - } - - public bool IsReusable - { - get - { - return false; - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx deleted file mode 100644 index c50104d4f49e24..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="VerifyUpload.ashx.cs" Class="WebServer.VerifyUpload" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx.cs deleted file mode 100644 index 67fd31989d836b..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx.cs +++ /dev/null @@ -1,82 +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 System; -using System.IO; -using System.Security.Cryptography; -using System.Web; - -namespace WebServer -{ - public class VerifyUpload : IHttpHandler - { - public void ProcessRequest(HttpContext context) - { - // Report back original request method verb. - context.Response.Headers.Add("X-HttpRequest-Method", context.Request.HttpMethod); - - // Report back original entity-body related request headers. - string contentLength = context.Request.Headers["Content-Length"]; - if (!string.IsNullOrEmpty(contentLength)) - { - context.Response.Headers.Add("X-HttpRequest-Headers-ContentLength", contentLength); - } - - string transferEncoding = context.Request.Headers["Transfer-Encoding"]; - if (!string.IsNullOrEmpty(transferEncoding)) - { - context.Response.Headers.Add("X-HttpRequest-Headers-TransferEncoding", transferEncoding); - } - - // Get expected MD5 hash of request body. - string expectedHash = context.Request.Headers["Content-MD5"]; - if (string.IsNullOrEmpty(expectedHash)) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = "Missing 'Content-MD5' request header"; - return; - } - - // Compute MD5 hash of received request body. - string actualHash; - using (MD5 md5 = MD5.Create()) - { - byte[] hash = md5.ComputeHash(ReadAllRequestBytes(context)); - actualHash = Convert.ToBase64String(hash); - } - - if (expectedHash == actualHash) - { - context.Response.StatusCode = 200; - } - else - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = "Request body not verfied"; - } - } - - public bool IsReusable - { - get - { - return true; - } - } - - private static byte[] ReadAllRequestBytes(HttpContext context) - { - Stream requestStream = context.Request.GetBufferedInputStream(); - byte[] buffer = new byte[16 * 1024]; - using (MemoryStream ms = new MemoryStream()) - { - int read; - while ((read = requestStream.Read(buffer, 0, buffer.Length)) > 0) - { - ms.Write(buffer, 0, read); - } - return ms.ToArray(); - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Debug.config b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Debug.config deleted file mode 100644 index 392bd6ae1652ba..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Debug.config +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Release.config b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Release.config deleted file mode 100644 index eac2ffb30d72b5..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Release.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.config b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.config deleted file mode 100644 index 1474319672d816..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.config +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebRole.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebRole.cs deleted file mode 100644 index faf1a3d4e147cb..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebRole.cs +++ /dev/null @@ -1,23 +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 System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.WindowsAzure; -using Microsoft.WindowsAzure.Diagnostics; -using Microsoft.WindowsAzure.ServiceRuntime; - -namespace WebServer -{ - public class WebRole : RoleEntryPoint - { - public override bool OnStart() - { - // For information on handling configuration changes - // see the MSDN topic at https://go.microsoft.com/fwlink/?LinkId=166357. - - return base.OnStart(); - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebServer.csproj b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebServer.csproj deleted file mode 100644 index 65dc1c23c46ba5..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebServer.csproj +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - Debug - AnyCPU - - - 2.0 - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - WebServer - WebServer - v4.5.1 - true - - - - - - - - bin\ - - - - - ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll - True - - - - ..\packages\Microsoft.Data.Edm.5.8.4\lib\net40\Microsoft.Data.Edm.dll - True - - - ..\packages\Microsoft.Data.OData.5.8.4\lib\net40\Microsoft.Data.OData.dll - True - - - ..\packages\Microsoft.Data.Services.Client.5.8.4\lib\net40\Microsoft.Data.Services.Client.dll - True - - - ..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll - True - - - True - - - False - - - ..\packages\WindowsAzure.Storage.4.3.0\lib\net40\Microsoft.WindowsAzure.Storage.dll - True - - - ..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - - - - ..\packages\System.Spatial.5.8.4\lib\net40\System.Spatial.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - - Web.config - - - Web.config - - - - - - - Designer - - - - - - - Deflate.ashx - - - Echo.ashx - - - EmptyContent.ashx - - - GZip.ashx - - - - - Redirect.ashx - - - - - StatusCode.ashx - - - Test.ashx - - - VerifyUpload.ashx - - - - EchoWebSocket.ashx - - - EchoWebSocketHeaders.ashx - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - True - True - 42127 - / - http://localhost:42127/ - False - False - - - False - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/Default.htm b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/Default.htm deleted file mode 100644 index 105c4b5fee7d78..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/Default.htm +++ /dev/null @@ -1,14 +0,0 @@ - - - - - -

Redirecting to the websocket.org test client in 5 seconds...

- -

Use the following URIs to test the local endpoint:

-
-    ws://testserver.contoso.com/WebSocket/EchoWebSocket.ashx
-    wss://testserver.contoso.com/WebSocket/EchoWebSocket.ashx
-    
- - diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx deleted file mode 100644 index 411704bca698ac..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="EchoWebSocket.ashx.cs" Class="WebServer.EchoWebSocket" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx.cs deleted file mode 100644 index 95ea6119f16a2a..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx.cs +++ /dev/null @@ -1,167 +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 System; -using System.Net.WebSockets; -using System.Web; -using System.Web.WebSockets; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace WebServer -{ - public class EchoWebSocket : IHttpHandler - { - private const int MaxBufferSize = 128 * 1024; - private bool _replyWithPartialMessages = false; - - public void ProcessRequest(HttpContext context) - { - _replyWithPartialMessages = context.Request.Url.Query.Contains("replyWithPartialMessages"); - - string subProtocol = context.Request.QueryString["subprotocol"]; - - if (context.Request.Url.Query.Contains("delay10sec")) - { - Thread.Sleep(10000); - } - - try - { - if (!context.IsWebSocketRequest) - { - context.Response.StatusCode = 200; - context.Response.ContentType = "text/plain"; - context.Response.Write("Not a websocket request"); - - return; - } - - if (!string.IsNullOrEmpty(subProtocol)) - { - var wsOptions = new AspNetWebSocketOptions(); - wsOptions.SubProtocol = subProtocol; - - context.AcceptWebSocketRequest(ProcessWebSocketRequest, wsOptions); - } - else - { - context.AcceptWebSocketRequest(ProcessWebSocketRequest); - } - } - catch (Exception ex) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = ex.Message; - } - } - - public bool IsReusable - { - get - { - return false; - } - } - - private async Task ProcessWebSocketRequest(WebSocketContext wsContext) - { - WebSocket socket = wsContext.WebSocket; - var receiveBuffer = new byte[MaxBufferSize]; - var throwAwayBuffer = new byte[MaxBufferSize]; - - // Stay in loop while websocket is open - while (socket.State == WebSocketState.Open || socket.State == WebSocketState.CloseSent) - { - var receiveResult = await socket.ReceiveAsync(new ArraySegment(receiveBuffer), CancellationToken.None); - if (receiveResult.MessageType == WebSocketMessageType.Close) - { - if (receiveResult.CloseStatus == WebSocketCloseStatus.Empty) - { - await socket.CloseAsync(WebSocketCloseStatus.Empty, null, CancellationToken.None); - } - else - { - await socket.CloseAsync( - receiveResult.CloseStatus.GetValueOrDefault(), - receiveResult.CloseStatusDescription, - CancellationToken.None); - } - - continue; - } - - // Keep reading until we get an entire message. - int offset = receiveResult.Count; - while (receiveResult.EndOfMessage == false) - { - if (offset < MaxBufferSize) - { - receiveResult = await socket.ReceiveAsync( - new ArraySegment(receiveBuffer, offset, MaxBufferSize - offset), - CancellationToken.None); - } - else - { - receiveResult = await socket.ReceiveAsync( - new ArraySegment(throwAwayBuffer), - CancellationToken.None); - } - - offset += receiveResult.Count; - } - - // Close socket if the message was too big. - if (offset > MaxBufferSize) - { - await socket.CloseAsync( - WebSocketCloseStatus.MessageTooBig, - string.Format("{0}: {1} > {2}", WebSocketCloseStatus.MessageTooBig.ToString(), offset, MaxBufferSize), - CancellationToken.None); - - continue; - } - - bool sendMessage = false; - if (receiveResult.MessageType == WebSocketMessageType.Text) - { - string receivedMessage = Encoding.UTF8.GetString(receiveBuffer, 0, offset); - if (receivedMessage == ".close") - { - await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, receivedMessage, CancellationToken.None); - } - if (receivedMessage == ".shutdown") - { - await socket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, receivedMessage, CancellationToken.None); - } - else if (receivedMessage == ".abort") - { - socket.Abort(); - } - else if (receivedMessage == ".delay5sec") - { - await Task.Delay(5000); - } - else if (socket.State == WebSocketState.Open) - { - sendMessage = true; - } - } - else - { - sendMessage = true; - } - - if (sendMessage) - { - await socket.SendAsync( - new ArraySegment(receiveBuffer, 0, offset), - receiveResult.MessageType, - !_replyWithPartialMessages, - CancellationToken.None); - } - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx deleted file mode 100644 index 72e742e93e1695..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebHandler Language="C#" CodeBehind="EchoWebSocketHeaders.ashx.cs" Class="WebServer.EchoWebSocketHeaders" %> diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx.cs deleted file mode 100644 index 28abef11fbdddf..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx.cs +++ /dev/null @@ -1,89 +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 System; -using System.Web; -using System.Net.WebSockets; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace WebServer -{ - public class EchoWebSocketHeaders : IHttpHandler - { - private const int MaxBufferSize = 1024; - - public void ProcessRequest(HttpContext context) - { - try - { - if (!context.IsWebSocketRequest) - { - context.Response.StatusCode = 200; - context.Response.ContentType = "text/plain"; - context.Response.Write("Not a websocket request"); - - return; - } - - context.AcceptWebSocketRequest(ProcessWebSocketRequest); - } - catch (Exception ex) - { - context.Response.StatusCode = 500; - context.Response.StatusDescription = ex.Message; - } - } - - public bool IsReusable - { - get - { - return false; - } - } - - private async Task ProcessWebSocketRequest(WebSocketContext wsContext) - { - WebSocket socket = wsContext.WebSocket; - var receiveBuffer = new byte[MaxBufferSize]; - - // Reflect all headers and cookies - var sb = new StringBuilder(); - sb.AppendLine("Headers:"); - - foreach (string header in wsContext.Headers.AllKeys) - { - sb.Append(header); - sb.Append(":"); - sb.AppendLine(wsContext.Headers[header]); - } - - byte[] sendBuffer = Encoding.UTF8.GetBytes(sb.ToString()); - await socket.SendAsync(new ArraySegment(sendBuffer), WebSocketMessageType.Text, true, new CancellationToken()); - - // Stay in loop while websocket is open - while (socket.State == WebSocketState.Open || socket.State == WebSocketState.CloseSent) - { - var receiveResult = await socket.ReceiveAsync(new ArraySegment(receiveBuffer), CancellationToken.None); - if (receiveResult.MessageType == WebSocketMessageType.Close) - { - if (receiveResult.CloseStatus == WebSocketCloseStatus.Empty) - { - await socket.CloseAsync(WebSocketCloseStatus.Empty, null, CancellationToken.None); - } - else - { - await socket.CloseAsync( - receiveResult.CloseStatus.GetValueOrDefault(), - receiveResult.CloseStatusDescription, - CancellationToken.None); - } - - continue; - } - } - } - } -} diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/index.html b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/index.html deleted file mode 100644 index 6deebf937f1651..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Networking Test Server - - - -

NetworkingTestServer

-

Networking test server in Azure. Used by dotnet/corefx repo.

- - diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/packages.config b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/packages.config deleted file mode 100644 index d0a39047efb507..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/buildAndPackage.ps1 b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/buildAndPackage.ps1 deleted file mode 100644 index bb3828e448338d..00000000000000 --- a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/buildAndPackage.ps1 +++ /dev/null @@ -1,32 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. - -# Requires Visual Studio Command Prompt -# Requires Azure SDK and .NET Framework SDK installed on the build machine. - -$cdir = pwd -$folderName = "CoreFxNetCloudService" -$src = Join-Path $cdir $folderName -$tmp = Join-Path $Env:TEMP $folderName -$tmpOut = Join-Path $tmp "WebServer\PublishToIIS" -$dst = Join-Path $cdir "..\Deployment\IISApplications" - -$nugetSrc = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" - -if (Test-Path $tmp) -{ - rm -Recurse $tmp -} - -copy -Recurse $src $Env:TEMP -Start-BitsTransfer -Source $nugetSrc -Destination $tmp - -cd $tmp - -.\nuget restore -msbuild /p:DeployOnBuild=true /p:PublishProfile=IIS_PublishToLocalPath_RET - -copy -Recurse $tmpOut $dst - -cd $cdir -rm -Recurse $tmp diff --git a/src/libraries/Common/tests/System/Net/Sockets/TestSettings.cs b/src/libraries/Common/tests/System/Net/Sockets/TestSettings.cs index 0accade3d3f445..164b4b8632a43b 100644 --- a/src/libraries/Common/tests/System/Net/Sockets/TestSettings.cs +++ b/src/libraries/Common/tests/System/Net/Sockets/TestSettings.cs @@ -8,7 +8,8 @@ namespace System.Net.Sockets.Tests public static class TestSettings { // Timeout values in milliseconds. - public const int PassingTestTimeout = 10000; + public const int PassingTestTimeout = 10_000; + public const int PassingTestLongTimeout = 30_000; public const int FailingTestTimeout = 100; public static Task WhenAllOrAnyFailedWithTimeout(params Task[] tasks) => tasks.WhenAllOrAnyFailed(PassingTestTimeout); diff --git a/src/libraries/Common/tests/System/Net/SslProtocolSupport.cs b/src/libraries/Common/tests/System/Net/SslProtocolSupport.cs index e6ac1884c358e7..302021b8c08531 100644 --- a/src/libraries/Common/tests/System/Net/SslProtocolSupport.cs +++ b/src/libraries/Common/tests/System/Net/SslProtocolSupport.cs @@ -61,10 +61,12 @@ public IEnumerator GetEnumerator() { foreach (SslProtocols protocol in Enum.GetValues(typeof(SslProtocols))) { - if (protocol != SslProtocols.None && (protocol & SupportedSslProtocols) == protocol) +#pragma warning disable 0618 // SSL2/3 are deprecated + if (protocol != SslProtocols.None && protocol != SslProtocols.Default && (protocol & SupportedSslProtocols) == protocol) { yield return new object[] { protocol }; } +#pragma warning restore 0618 } } diff --git a/src/libraries/Common/tests/System/Runtime/Serialization/Utils.cs b/src/libraries/Common/tests/System/Runtime/Serialization/Utils.cs index ca01381a6dff10..2e2ac299c2c53b 100644 --- a/src/libraries/Common/tests/System/Runtime/Serialization/Utils.cs +++ b/src/libraries/Common/tests/System/Runtime/Serialization/Utils.cs @@ -9,6 +9,8 @@ using System.Threading.Tasks; using System.Xml.Linq; using System.Linq; +using System.Reflection; +using System.Runtime.Loader; using Xunit; internal static class Utils @@ -351,3 +353,30 @@ private static bool IsPrefixedAttributeValue(string atrValue, out string localPr return false; } } + +internal class TestAssemblyLoadContext : AssemblyLoadContext +{ + private AssemblyDependencyResolver _resolver; + + public TestAssemblyLoadContext(string name, bool isCollectible, string mainAssemblyToLoadPath = null) : base(name, isCollectible) + { + if (!PlatformDetection.IsBrowser) + _resolver = new AssemblyDependencyResolver(mainAssemblyToLoadPath ?? Assembly.GetExecutingAssembly().Location); + } + + protected override Assembly Load(AssemblyName name) + { + if (PlatformDetection.IsBrowser) + { + return base.Load(name); + } + + string assemblyPath = _resolver.ResolveAssemblyToPath(name); + if (assemblyPath != null) + { + return LoadFromAssemblyPath(assemblyPath); + } + + return null; + } +} diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSAKeyFileTests.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSAKeyFileTests.cs index 5f3a0f5b82a6da..27a94ab1907d18 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSAKeyFileTests.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSAKeyFileTests.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Formats.Asn1; +using System.Numerics; using System.Security.Cryptography.Encryption.RC2.Tests; using System.Text; using Test.Cryptography; @@ -302,6 +304,150 @@ public static void ReadWriteDsa2048SubjectPublicKeyInfo() DSATestData.GetDSA2048Params()); } + [Fact] + [SkipOnPlatform(TestPlatforms.OSX, "DSASecurityTransforms goes straight to OS, has different failure mode")] + public static void ImportNonsensePublicParameters() + { + AsnWriter writer = new AsnWriter(AsnEncodingRules.DER); + + DSAParameters validParameters = DSATestData.GetDSA2048Params(); + BigInteger p = new BigInteger(validParameters.P, true, true); + BigInteger q = new BigInteger(validParameters.Q, true, true); + BigInteger g = new BigInteger(validParameters.G, true, true); + BigInteger y = new BigInteger(validParameters.Y, true, true); + + using (DSA dsa = DSAFactory.Create()) + { + // 1 < y < p, 1 < g < p, q is 160/224/256 bits + // p is 512..1024 % 64, or 1024/2048/3072 bits + ImportSPKI(dsa, p, q, g, p, writer); + ImportSPKI(dsa, p, q, g, BigInteger.One, writer); + ImportSPKI(dsa, p, q, g, BigInteger.MinusOne, writer); + ImportSPKI(dsa, p, q, p, y, writer); + ImportSPKI(dsa, p, q, -g, y, writer); + ImportSPKI(dsa, p, q, BigInteger.One, y, writer); + ImportSPKI(dsa, p, q, BigInteger.MinusOne, y, writer); + ImportSPKI(dsa, p, q << 1, g, y, writer); + ImportSPKI(dsa, p, q >> 1, g, y, writer); + ImportSPKI(dsa, p, -q, g, y, writer); + ImportSPKI(dsa, p >> 1, q, g, y, writer); + ImportSPKI(dsa, p << 1, q, g, y, writer); + ImportSPKI(dsa, BigInteger.One << 4095, q, 2, 97, writer); + } + + static void ImportSPKI( + DSA key, + BigInteger p, + BigInteger q, + BigInteger g, + BigInteger y, + AsnWriter writer) + { + writer.Reset(); + writer.WriteInteger(y); + byte[] encodedPublicKey = writer.Encode(); + writer.Reset(); + + using (writer.PushSequence()) + { + using (writer.PushSequence()) + { + writer.WriteObjectIdentifier("1.2.840.10040.4.1"); + + using (writer.PushSequence()) + { + writer.WriteInteger(p); + writer.WriteInteger(q); + writer.WriteInteger(g); + } + } + + writer.WriteBitString(encodedPublicKey); + } + + byte[] spki = writer.Encode(); + writer.Reset(); + + AssertExtensions.ThrowsContains( + () => key.ImportSubjectPublicKeyInfo(spki, out _), + "corrupted"); + } + } + + [Fact] + public static void ImportNonsensePrivateParameters() + { + AsnWriter writer = new AsnWriter(AsnEncodingRules.DER); + + DSAParameters validParameters = DSATestData.GetDSA2048Params(); + BigInteger p = new BigInteger(validParameters.P, true, true); + BigInteger q = new BigInteger(validParameters.Q, true, true); + BigInteger g = new BigInteger(validParameters.G, true, true); + BigInteger x = new BigInteger(validParameters.X, true, true); + + using (DSA dsa = DSAFactory.Create()) + { + // 1 < x < q, 1 < g < p, q is 160/224/256 bits + // p is 512..1024 % 64, or 1024/2048/3072 bits + ImportPkcs8(dsa, p, q, g, q, writer); + ImportPkcs8(dsa, p, q, g, BigInteger.One, writer); + // x = -1 gets re-interpreted as x = 255 because of a CAPI compat issue. + //ImportPkcs8(dsa, p, q, g, BigInteger.MinusOne, writer); + ImportPkcs8(dsa, p, q, g, -x, writer); + ImportPkcs8(dsa, p, q, p, x, writer); + ImportPkcs8(dsa, p, q, -g, x, writer); + ImportPkcs8(dsa, p, q, BigInteger.One, x, writer); + ImportPkcs8(dsa, p, q, BigInteger.MinusOne, x, writer); + ImportPkcs8(dsa, p, q << 1, g, x, writer); + ImportPkcs8(dsa, p, q >> 1, g, x, writer); + ImportPkcs8(dsa, p >> 1, q, g, x, writer); + ImportPkcs8(dsa, p << 1, q, g, x, writer); + ImportPkcs8(dsa, -q, q, g, x, writer); + ImportPkcs8(dsa, BigInteger.One << 4095, q, 2, 97, writer); + ImportPkcs8(dsa, -p, q, g, x, writer); + } + + static void ImportPkcs8( + DSA key, + BigInteger p, + BigInteger q, + BigInteger g, + BigInteger x, + AsnWriter writer) + { + writer.Reset(); + + using (writer.PushSequence()) + { + writer.WriteInteger(0); + + using (writer.PushSequence()) + { + writer.WriteObjectIdentifier("1.2.840.10040.4.1"); + + using (writer.PushSequence()) + { + writer.WriteInteger(p); + writer.WriteInteger(q); + writer.WriteInteger(g); + } + } + + using (writer.PushOctetString()) + { + writer.WriteInteger(x); + } + } + + byte[] pkcs8 = writer.Encode(); + writer.Reset(); + + AssertExtensions.ThrowsContains( + () => key.ImportPkcs8PrivateKey(pkcs8, out _), + "corrupted"); + } + } + [Fact] public static void NoFuzzySubjectPublicKeyInfo() { diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDhKeyFileTests.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDhKeyFileTests.cs index 2b814f581f90d5..197fcc49f113b7 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDhKeyFileTests.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDhKeyFileTests.cs @@ -7,6 +7,7 @@ namespace System.Security.Cryptography.EcDiffieHellman.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/64389", TestPlatforms.Windows)] public class ECDhKeyFileTests : ECKeyFileTests { protected override ECDiffieHellman CreateKey() diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaKeyFileTests.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaKeyFileTests.cs index 46f88abb735a0d..d95a3f060622ec 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaKeyFileTests.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaKeyFileTests.cs @@ -7,6 +7,7 @@ namespace System.Security.Cryptography.EcDsa.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/64389", TestPlatforms.Windows)] public class ECDsaKeyFileTests : ECKeyFileTests { protected override ECDsa CreateKey() diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherOneShotTests.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherOneShotTests.cs index 24d2befc125c4d..1fae853ae27081 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherOneShotTests.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherOneShotTests.cs @@ -10,6 +10,7 @@ namespace System.Security.Cryptography.Encryption.RC2.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + [ConditionalClass(typeof(RC2Factory), nameof(RC2Factory.IsSupported))] public class RC2CipherOneShotTests : SymmetricOneShotBase { protected override byte[] Key => new byte[] diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs index 85fb5c7691a9e4..fdb7d3836d00b3 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs @@ -1,6 +1,9 @@ // 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.Generic; +using System.Diagnostics; +using System.Numerics; using Test.Cryptography; using Microsoft.DotNet.XUnitExtensions; using Xunit; @@ -337,19 +340,10 @@ private void RsaCryptRoundtrip(RSAEncryptionPadding paddingMode, bool expectSucc Assert.Equal(TestData.HelloBytes, output); } - [ConditionalFact] + [ConditionalFact(nameof(PlatformSupportsEmptyRSAEncryption))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void RoundtripEmptyArray() { - if (OperatingSystem.IsIOS() && !OperatingSystem.IsIOSVersionAtLeast(13, 6)) - { - throw new SkipTestException("iOS prior to 13.6 does not reliably support RSA encryption of empty data."); - } - if (OperatingSystem.IsTvOS() && !OperatingSystem.IsTvOSVersionAtLeast(14, 0)) - { - throw new SkipTestException("tvOS prior to 14.0 does not reliably support RSA encryption of empty data."); - } - using (RSA rsa = RSAFactory.Create(TestData.RSA2048Params)) { void RoundtripEmpty(RSAEncryptionPadding paddingMode) @@ -673,6 +667,23 @@ public void UnusualExponentCryptRoundtrip() Assert.Equal(TestData.HelloBytes, output); } + [Theory] + [MemberData(nameof(OaepPaddingModes))] + public void NonPowerOfTwoKeySizeOaepRoundtrip(RSAEncryptionPadding oaepPaddingMode) + { + byte[] crypt; + byte[] output; + + using (RSA rsa = RSAFactory.Create(3072)) + { + crypt = Encrypt(rsa, TestData.HelloBytes, oaepPaddingMode); + output = Decrypt(rsa, crypt, oaepPaddingMode); + } + + Assert.NotEqual(crypt, output); + Assert.Equal(TestData.HelloBytes, output); + } + [Fact] public void NotSupportedValueMethods() { @@ -682,5 +693,151 @@ public void NotSupportedValueMethods() Assert.Throws(() => rsa.EncryptValue(null)); } } + + [Fact] + public void Decrypt_Pkcs1_BadPadding() + { + if ((PlatformDetection.IsWindows && !PlatformDetection.IsWindows10Version2004OrGreater)) + { + return; + } + + RSAParameters keyParams = TestData.RSA2048Params; + BigInteger e = new BigInteger(keyParams.Exponent, true, true); + BigInteger n = new BigInteger(keyParams.Modulus, true, true); + byte[] buf = new byte[keyParams.Modulus.Length]; + byte[] c = new byte[buf.Length]; + + buf[1] = 2; + buf.AsSpan(2).Fill(1); + + ref byte afterMinPadding = ref buf[10]; + ref byte lastByte = ref buf[^1]; + afterMinPadding = 0; + + using (RSA rsa = RSAFactory.Create(keyParams)) + { + RawEncrypt(buf, e, n, c); + // Assert.NoThrow, check that manual padding is coherent + Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1); + + // All RSA encryption schemes start with 00, so pick any other number. + // + // If buf > modulus then encrypt should fail, so this + // is the largest legal-but-invalid value to test. + buf[0] = keyParams.Modulus[0]; + RawEncrypt(buf, e, n, c); + Assert.ThrowsAny(() => Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1)); + + // Check again with a zero length payload + (afterMinPadding, lastByte) = (lastByte, afterMinPadding); + RawEncrypt(buf, e, n, c); + Assert.ThrowsAny(() => Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1)); + + // Back to valid padding + buf[0] = 0; + (afterMinPadding, lastByte) = (lastByte, afterMinPadding); + RawEncrypt(buf, e, n, c); + Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1); + + // This is (sort of) legal for PKCS1 signatures, but not decryption. + buf[1] = 1; + RawEncrypt(buf, e, n, c); + Assert.ThrowsAny(() => Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1)); + + // No RSA PKCS1 padding scheme starts with 00 FF. + buf[1] = 255; + RawEncrypt(buf, e, n, c); + Assert.ThrowsAny(() => Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1)); + + // Check again with a zero length payload + (afterMinPadding, lastByte) = (lastByte, afterMinPadding); + RawEncrypt(buf, e, n, c); + Assert.ThrowsAny(() => Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1)); + + // Back to valid padding + buf[1] = 2; + (afterMinPadding, lastByte) = (lastByte, afterMinPadding); + RawEncrypt(buf, e, n, c); + Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1); + + // Try a zero in every possible required padding position + for (int i = 2; i < 10; i++) + { + buf[i] = 0; + + RawEncrypt(buf, e, n, c); + Assert.ThrowsAny(() => Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1)); + + // It used to be 1, now it's 2, still not zero. + buf[i] = 2; + } + + // Back to valid padding + RawEncrypt(buf, e, n, c); + Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1); + + // Make it such that + // "there is no octet with hexadecimal value 0x00 to separate PS from M" + // (RFC 3447 sec 7.2.2, rule 3, third clause) + buf.AsSpan(10).Fill(3); + RawEncrypt(buf, e, n, c); + Assert.ThrowsAny(() => Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1)); + + // Every possible problem, for good measure. + buf[0] = 2; + buf[1] = 0; + buf[4] = 0; + RawEncrypt(buf, e, n, c); + Assert.ThrowsAny(() => Decrypt(rsa, c, RSAEncryptionPadding.Pkcs1)); + } + + static void RawEncrypt(ReadOnlySpan source, BigInteger e, BigInteger n, Span destination) + { + BigInteger m = new BigInteger(source, true, true); + BigInteger c = BigInteger.ModPow(m, e, n); + int shift = destination.Length - c.GetByteCount(true); + destination.Slice(0, shift).Clear(); + bool wrote = c.TryWriteBytes(destination.Slice(shift), out int written, true, true); + + if (!wrote || written + shift != destination.Length) + { + throw new InvalidOperationException(); + } + } + } + + public static IEnumerable OaepPaddingModes + { + get + { + yield return new object[] { RSAEncryptionPadding.OaepSHA1 }; + + if (RSAFactory.SupportsSha2Oaep) + { + yield return new object[] { RSAEncryptionPadding.OaepSHA256 }; + yield return new object[] { RSAEncryptionPadding.OaepSHA384 }; + yield return new object[] { RSAEncryptionPadding.OaepSHA512 }; + } + } + } + + public static bool PlatformSupportsEmptyRSAEncryption + { + get + { + if (OperatingSystem.IsIOS() && !OperatingSystem.IsIOSVersionAtLeast(13, 6)) + { + return false; + } + + if (OperatingSystem.IsTvOS() && !OperatingSystem.IsTvOSVersionAtLeast(14, 0)) + { + return false; + } + + return true; + } + } } } diff --git a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs index 3685c0d6f03a75..c06258168f0874 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/CertificateAuthority.cs @@ -517,9 +517,18 @@ singleExtensions [1] EXPLICIT Extensions OPTIONAL } } else if (status == CertStatus.Revoked) { - // Android does not support all precisions for seconds - just omit fractional seconds for testing on Android writer.PushSequence(s_context1); - writer.WriteGeneralizedTime(revokedTime, omitFractionalSeconds: OperatingSystem.IsAndroid()); + + // Fracational seconds "MUST NOT" be used here. Android and macOS 13+ enforce this and + // reject GeneralizedTime's with fractional seconds, so omit them. + // RFC 6960: 4.2.2.1: + // The format for GeneralizedTime is as specified in Section 4.1.2.5.2 of [RFC5280]. + // RFC 5280 4.1.2.5.2: + // For the purposes of this profile, GeneralizedTime values MUST be + // expressed in Greenwich Mean Time (Zulu) and MUST include seconds + // (i.e., times are YYYYMMDDHHMMSSZ), even where the number of seconds + // is zero. GeneralizedTime values MUST NOT include fractional seconds. + writer.WriteGeneralizedTime(revokedTime, omitFractionalSeconds: true); writer.PopSequence(s_context1); } else diff --git a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/RevocationResponder.cs b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/RevocationResponder.cs index 4e9e5e20612a94..b08655e6f1d10b 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/RevocationResponder.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/RevocationResponder.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using System.Web; +using Xunit; namespace System.Security.Cryptography.X509Certificates.Tests.Common { @@ -29,6 +30,7 @@ private readonly Dictionary _crlPaths public string UriPrefix { get; } public bool RespondEmpty { get; set; } + public AiaResponseKind AiaResponseKind { get; set; } public TimeSpan ResponseDelay { get; set; } public DelayedActionsFlag DelayedActions { get; set; } @@ -181,13 +183,13 @@ private void HandleRequest(HttpListenerContext context, ref bool responded) Thread.Sleep(ResponseDelay); } - byte[] certData = RespondEmpty ? Array.Empty() : authority.GetCertData(); + byte[] certData = RespondEmpty ? Array.Empty() : GetCertDataForAiaResponseKind(AiaResponseKind, authority); responded = true; context.Response.StatusCode = 200; - context.Response.ContentType = "application/pkix-cert"; + context.Response.ContentType = AiaResponseKindToContentType(AiaResponseKind); context.Response.Close(certData, willBlock: true); - Trace($"Responded with {certData.Length}-byte certificate from {authority.SubjectName}."); + Trace($"Responded with {certData.Length}-byte {AiaResponseKind} from {authority.SubjectName}."); return; } @@ -295,6 +297,41 @@ private static HttpListener OpenListener(out string uriPrefix) } } + private static string AiaResponseKindToContentType(AiaResponseKind kind) + { + if (kind == AiaResponseKind.Cert) + { + return "application/pkix-cert"; + } + else if (kind == AiaResponseKind.Pkcs12) + { + return "application/x-pkcs12"; + } + else + { + Assert.True(false, $"Unknown value AiaResponseKind.`{kind}`."); + return null; + } + } + + private static byte[] GetCertDataForAiaResponseKind(AiaResponseKind kind, CertificateAuthority authority) + { + if (kind == AiaResponseKind.Cert) + { + return authority.GetCertData(); + } + else if (kind == AiaResponseKind.Pkcs12) + { + using X509Certificate2 cert = new X509Certificate2(authority.GetCertData()); + return cert.Export(X509ContentType.Pkcs12); + } + else + { + Assert.True(false, $"Unknown value AiaResponseKind.`{kind}`."); + return null; + } + } + private static bool TryGetOcspRequestBytes(HttpListenerRequest request, string prefix, out byte[] requestBytes) { requestBytes = null; @@ -425,4 +462,10 @@ public enum DelayedActionsFlag : byte Aia = 0b100, All = 0b11111111 } + + public enum AiaResponseKind + { + Cert = 0, + Pkcs12 = 1, + } } diff --git a/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs b/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs index f2fb788960ff6d..aebd8d00dc0d2e 100644 --- a/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs +++ b/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs @@ -351,6 +351,20 @@ public static void GreaterThanOrEqualTo(T actual, T greaterThanOrEqualTo, str throw new XunitException(AddOptionalUserMessage($"Expected: {actual} to be greater than or equal to {greaterThanOrEqualTo}", userMessage)); } + /// + /// Validate that a given enum value has the expected flag set. + /// + /// The enum type. + /// The flag which should be present in . + /// The value which should contain the flag . + public static void HasFlag(T expected, T actual, string userMessage = null) where T : Enum + { + if (!actual.HasFlag(expected)) + { + throw new XunitException(AddOptionalUserMessage($"Expected: Value {actual} (of enum type {typeof(T).FullName}) to have the flag {expected} set.", userMessage)); + } + } + // NOTE: Consider using SequenceEqual below instead, as it will give more useful information about what // the actual differences are, especially for large arrays/spans. /// diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index 99492706f7ec99..a0a95604795828 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -14,7 +14,7 @@ public static partial class PlatformDetection // do it in a way that failures don't cascade. // - private static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux); + public static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux); public static bool IsOpenSUSE => IsDistroAndVersion("opensuse"); public static bool IsUbuntu => IsDistroAndVersion("ubuntu"); public static bool IsDebian => IsDistroAndVersion("debian"); @@ -32,6 +32,7 @@ public static partial class PlatformDetection public static bool IsSLES => IsDistroAndVersion("sles"); public static bool IsTizen => IsDistroAndVersion("tizen"); public static bool IsFedora => IsDistroAndVersion("fedora"); + public static bool IsLinuxBionic => IsBionic(); // OSX family public static bool IsOSXLike => IsOSX || IsiOS || IstvOS || IsMacCatalyst; @@ -41,6 +42,8 @@ public static partial class PlatformDetection public static bool IsMacOsCatalinaOrHigher => IsOSX && Environment.OSVersion.Version >= new Version(10, 15); public static bool IsMacOsAppleSilicon => IsOSX && IsArm64Process; public static bool IsNotMacOsAppleSilicon => !IsMacOsAppleSilicon; + public static bool IsAppSandbox => Environment.GetEnvironmentVariable("APP_SANDBOX_CONTAINER_ID") != null; + public static bool IsNotAppSandbox => !IsAppSandbox; // RedHat family covers RedHat and CentOS public static bool IsRedHatFamily => IsRedHatFamilyAndVersion(); @@ -55,6 +58,11 @@ public static partial class PlatformDetection GetOpenSslVersion() : throw new PlatformNotSupportedException(); + private static readonly Version s_openssl3Version = new Version(3, 0, 0); + public static bool IsOpenSsl3 => !IsOSXLike && !IsWindows && !IsAndroid && !IsBrowser ? + GetOpenSslVersion() >= s_openssl3Version : + false; + /// /// If gnulibc is available, returns the release, such as "stable". /// Otherwise returns "glibc_not_found". @@ -164,6 +172,21 @@ private static Version ToVersion(string versionString) } } + /// + /// Assume that Android environment variables but Linux OS mean Android libc + /// + private static bool IsBionic() + { + if (IsLinux) + { + if (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("ANDROID_STORAGE"))) + { + return true; + } + } + return false; + } + private static DistroInfo GetDistroInfo() { DistroInfo result = new DistroInfo(); diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs index 078f29be48e685..266ddd4ca613b5 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs @@ -55,7 +55,14 @@ public static partial class PlatformDetection // >= Windows 10 20H1 Update public static bool IsWindows10Version2004OrGreater => IsWindowsVersionOrLater(10, 0, 19041); - public static bool IsWindows10Version2004Build19573OrGreater => IsWindowsVersionOrLater(10, 0, 19573); + // WinHTTP update + public static bool IsWindows10Version19573OrGreater => IsWindowsVersionOrLater(10, 0, 19573); + + // Windows Server 2022 + public static bool IsWindows10Version20348OrGreater => IsWindowsVersionOrLater(10, 0, 20348); + + // Windows 11 aka 21H2 + public static bool IsWindows10Version22000OrGreater => IsWindowsVersionOrLater(10, 0, 22000); public static bool IsWindowsIoTCore { @@ -231,6 +238,8 @@ public static bool IsInAppContainer } } + public static bool CanRunImpersonatedTests => PlatformDetection.IsNotWindowsNanoServer && PlatformDetection.IsWindowsAndElevated; + private static int s_isWindowsElevated = -1; public static bool IsWindowsAndElevated { diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index efef067dbce645..54963a9de9bfcf 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -48,6 +48,8 @@ public static partial class PlatformDetection public static bool IsNotArm64Process => !IsArm64Process; public static bool IsArmOrArm64Process => IsArmProcess || IsArm64Process; public static bool IsNotArmNorArm64Process => !IsArmOrArm64Process; + public static bool IsX86Process => RuntimeInformation.ProcessArchitecture == Architecture.X86; + public static bool IsX64Process => RuntimeInformation.ProcessArchitecture == Architecture.X64; public static bool IsArgIteratorSupported => IsMonoRuntime || (IsWindows && IsNotArmProcess); public static bool IsArgIteratorNotSupported => !IsArgIteratorSupported; public static bool Is32BitProcess => IntPtr.Size == 4; @@ -189,7 +191,12 @@ private static bool GetAlpnSupport() if (IsOpenSslSupported) { - return OpenSslVersion.Major >= 1 && (OpenSslVersion.Minor >= 1 || OpenSslVersion.Build >= 2); + if (OpenSslVersion.Major >= 3) + { + return true; + } + + return OpenSslVersion.Major == 1 && (OpenSslVersion.Minor >= 1 || OpenSslVersion.Build >= 2); } if (IsAndroid) @@ -267,6 +274,28 @@ private static bool GetStaticNonPublicBooleanPropertyValue(string typeName, stri public static bool IsIcuGlobalization => ICUVersion > new Version(0,0,0,0); public static bool IsNlsGlobalization => IsNotInvariantGlobalization && !IsIcuGlobalization; + public static bool IsSubstAvailable + { + get + { + try + { + if (IsWindows) + { + string systemRoot = Environment.GetEnvironmentVariable("SystemRoot"); + if (string.IsNullOrWhiteSpace(systemRoot)) + { + return false; + } + string system32 = Path.Combine(systemRoot, "System32"); + return File.Exists(Path.Combine(system32, "subst.exe")); + } + } + catch { } + return false; + } + } + private static Version GetICUVersion() { int version = 0; @@ -311,34 +340,64 @@ private static bool GetIsInContainer() return (IsLinux && File.Exists("/.dockerenv")); } - private static bool GetSsl3Support() + private static bool GetProtocolSupportFromWindowsRegistry(SslProtocols protocol, bool defaultProtocolSupport, bool disabledByDefault = false) { - if (IsWindows) + string registryProtocolName = protocol switch { - string clientKey = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client"; - string serverKey = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server"; +#pragma warning disable CS0618 // Ssl2 and Ssl3 are obsolete + SslProtocols.Ssl3 => "SSL 3.0", +#pragma warning restore CS0618 + SslProtocols.Tls => "TLS 1.0", + SslProtocols.Tls11 => "TLS 1.1", + SslProtocols.Tls12 => "TLS 1.2", +#if !NETFRAMEWORK + SslProtocols.Tls13 => "TLS 1.3", +#endif + _ => throw new Exception($"Registry key not defined for {protocol}.") + }; - object client, server; - try - { - client = Registry.GetValue(clientKey, "Enabled", null); - server = Registry.GetValue(serverKey, "Enabled", null); - } - catch (SecurityException) - { - // Insufficient permission, assume that we don't have SSL3 (since we aren't exactly sure) - return false; - } + string clientKey = @$"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\{registryProtocolName}\Client"; + string serverKey = @$"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\{registryProtocolName}\Server"; + + object client, server; + object clientDefault, serverDefault; + try + { + client = Registry.GetValue(clientKey, "Enabled", defaultProtocolSupport ? 1 : 0); + server = Registry.GetValue(serverKey, "Enabled", defaultProtocolSupport ? 1 : 0); + + clientDefault = Registry.GetValue(clientKey, "DisabledByDefault", 1); + serverDefault = Registry.GetValue(serverKey, "DisabledByDefault", 1); - if (client is int c && server is int s) + if (client is int c && server is int s && clientDefault is int cd && serverDefault is int sd) { - return c == 1 && s == 1; + return (c == 1 && s == 1) && (!disabledByDefault || (cd == 0 && sd == 0)); } + } + catch (SecurityException) + { + // Insufficient permission, assume that we don't have protocol support (since we aren't exactly sure) + return false; + } + catch { } + + return defaultProtocolSupport; + } + + private static bool GetSsl3Support() + { + if (IsWindows) + { // Missing key. If we're pre-20H1 then assume SSL3 is enabled. // Otherwise, disabled. (See comments on https://github.com/dotnet/runtime/issues/1166) // Alternatively the returned values must have been some other types. - return !IsWindows10Version2004OrGreater; + bool ssl3DefaultSupport = !IsWindows10Version2004OrGreater; + +#pragma warning disable CS0618 // Ssl2 and Ssl3 are obsolete + return GetProtocolSupportFromWindowsRegistry(SslProtocols.Ssl3, ssl3DefaultSupport); +#pragma warning restore CS0618 + } return (IsOSX || (IsLinux && OpenSslVersion < new Version(1, 0, 2) && !IsDebian)); @@ -361,23 +420,35 @@ private static bool AndroidGetSslProtocolSupport(SslProtocols protocol) private static bool GetTls10Support() { - // on Windows, macOS, and Android TLS1.0/1.1 are supported. - if (IsWindows || IsOSXLike || IsAndroid) + // on macOS and Android TLS 1.0 is supported. + if (IsOSXLike || IsAndroid) { return true; } + // Windows depend on registry, enabled by default on all supported versions. + if (IsWindows) + { + return GetProtocolSupportFromWindowsRegistry(SslProtocols.Tls, defaultProtocolSupport: true) && !IsWindows10Version20348OrGreater; + } + return OpenSslGetTlsSupport(SslProtocols.Tls); } private static bool GetTls11Support() { - // on Windows, macOS, and Android TLS1.0/1.1 are supported. - // TLS 1.1 and 1.2 can work on Windows7 but it is not enabled by default. if (IsWindows) { - return !IsWindows7; + // TLS 1.1 can work on Windows 7 but it is disabled by default. + if (IsWindows7) + { + return GetProtocolSupportFromWindowsRegistry(SslProtocols.Tls11, defaultProtocolSupport: false, disabledByDefault: true); + } + + // It is enabled on other versions unless explicitly disabled. + return GetProtocolSupportFromWindowsRegistry(SslProtocols.Tls11, defaultProtocolSupport: true) && !IsWindows10Version20348OrGreater; } + // on macOS and Android TLS 1.1 is supported. else if (IsOSXLike || IsAndroid) { return true; @@ -388,8 +459,19 @@ private static bool GetTls11Support() private static bool GetTls12Support() { - // TLS 1.1 and 1.2 can work on Windows7 but it is not enabled by default. - return !IsWindows7; + if (IsWindows) + { + // TLS 1.2 can work on Windows 7 but it is disabled by default. + if (IsWindows7) + { + return GetProtocolSupportFromWindowsRegistry(SslProtocols.Tls12, defaultProtocolSupport: false, disabledByDefault: true); + } + + // It is enabled on other versions unless explicitly disabled. + return GetProtocolSupportFromWindowsRegistry(SslProtocols.Tls12, defaultProtocolSupport: true); + } + + return true; } private static bool GetTls13Support() @@ -400,25 +482,17 @@ private static bool GetTls13Support() { return false; } - - string clientKey = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client"; - string serverKey = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server"; - - object client, server; - try - { - client = Registry.GetValue(clientKey, "Enabled", null); - server = Registry.GetValue(serverKey, "Enabled", null); - if (client is int c && server is int s) - { - return c == 1 && s == 1; - } - } - catch { } // assume no if positive entry is missing on older Windows // Latest insider builds have TLS 1.3 enabled by default. // The build number is approximation. - return IsWindows10Version2004Build19573OrGreater; + bool defaultProtocolSupport = IsWindows10Version20348OrGreater; + +#if NETFRAMEWORK + return false; +#else + return GetProtocolSupportFromWindowsRegistry(SslProtocols.Tls13, defaultProtocolSupport); +#endif + } else if (IsOSX || IsMacCatalyst || IsiOS || IstvOS) { diff --git a/src/libraries/Common/tests/TestUtilities/System/WindowsIdentityFixture.cs b/src/libraries/Common/tests/TestUtilities/System/WindowsIdentityFixture.cs new file mode 100644 index 00000000000000..b0355f923295e4 --- /dev/null +++ b/src/libraries/Common/tests/TestUtilities/System/WindowsIdentityFixture.cs @@ -0,0 +1,148 @@ +// 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.ComponentModel; +using System.Linq; +using System.Net; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Security.Principal; +using System.Threading.Tasks; +using Microsoft.Win32.SafeHandles; +using Xunit; + +namespace System +{ + public class WindowsIdentityFixture : IDisposable + { + public WindowsTestAccount TestAccount { get; private set; } + + public WindowsIdentityFixture() + { + TestAccount = new WindowsTestAccount("CorFxTstWiIde01kiu"); + } + + public void Dispose() + { + TestAccount.Dispose(); + } + } + + public sealed class WindowsTestAccount : IDisposable + { + private readonly string _userName; + private SafeAccessTokenHandle _accountTokenHandle; + public SafeAccessTokenHandle AccountTokenHandle => _accountTokenHandle; + public string AccountName { get; private set; } + + public WindowsTestAccount(string userName) + { + Assert.True(PlatformDetection.IsWindowsAndElevated); + + _userName = userName; + CreateUser(); + } + + private void CreateUser() + { + string testAccountPassword; + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) + { + byte[] randomBytes = new byte[33]; + rng.GetBytes(randomBytes); + + // Add special chars to ensure it satisfies password requirements. + testAccountPassword = Convert.ToBase64String(randomBytes) + "_-As@!%*(1)4#2"; + + USER_INFO_1 userInfo = new USER_INFO_1 + { + usri1_name = _userName, + usri1_password = testAccountPassword, + usri1_priv = 1 + }; + + // Create user and remove/create if already exists + uint result = NetUserAdd(null, 1, ref userInfo, out uint param_err); + + // error codes https://docs.microsoft.com/en-us/windows/desktop/netmgmt/network-management-error-codes + // 0 == NERR_Success + if (result == 2224) // NERR_UserExists + { + result = NetUserDel(null, userInfo.usri1_name); + if (result != 0) + { + throw new Win32Exception((int)result); + } + result = NetUserAdd(null, 1, ref userInfo, out param_err); + if (result != 0) + { + throw new Win32Exception((int)result); + } + } + else if (result != 0) + { + throw new Win32Exception((int)result); + } + + const int LOGON32_PROVIDER_DEFAULT = 0; + const int LOGON32_LOGON_INTERACTIVE = 2; + + if (!LogonUser(_userName, ".", testAccountPassword, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, out _accountTokenHandle)) + { + _accountTokenHandle = null; + throw new Exception($"Failed to get SafeAccessTokenHandle for test account {_userName}", new Win32Exception()); + } + + bool gotRef = false; + try + { + _accountTokenHandle.DangerousAddRef(ref gotRef); + IntPtr logonToken = _accountTokenHandle.DangerousGetHandle(); + AccountName = new WindowsIdentity(logonToken).Name; + } + finally + { + if (gotRef) + _accountTokenHandle.DangerousRelease(); + } + } + } + + [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + private static extern bool LogonUser(string userName, string domain, string password, int logonType, int logonProvider, out SafeAccessTokenHandle safeAccessTokenHandle); + + [DllImport("netapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern uint NetUserAdd([MarshalAs(UnmanagedType.LPWStr)]string servername, uint level, ref USER_INFO_1 buf, out uint parm_err); + + [DllImport("netapi32.dll")] + internal static extern uint NetUserDel([MarshalAs(UnmanagedType.LPWStr)]string servername, [MarshalAs(UnmanagedType.LPWStr)]string username); + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct USER_INFO_1 + { + public string usri1_name; + public string usri1_password; + public uint usri1_password_age; + public uint usri1_priv; + public string usri1_home_dir; + public string usri1_comment; + public uint usri1_flags; + public string usri1_script_path; + } + + public void Dispose() + { + _accountTokenHandle?.Dispose(); + + uint result = NetUserDel(null, _userName); + + // 2221= NERR_UserNotFound + if (result != 0 && result != 2221) + { + throw new Win32Exception((int)result); + } + } + } + } + diff --git a/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj b/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj index 375fca4e582f8d..8400cd7e721e69 100644 --- a/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj +++ b/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj @@ -33,6 +33,7 @@ + + - - diff --git a/src/libraries/Common/tests/Tests/System/Net/aspnetcore/Http2/HPackDecoderTest.cs b/src/libraries/Common/tests/Tests/System/Net/aspnetcore/Http2/HPackDecoderTest.cs index f73d72d3dd32db..9305334e319e0a 100644 --- a/src/libraries/Common/tests/Tests/System/Net/aspnetcore/Http2/HPackDecoderTest.cs +++ b/src/libraries/Common/tests/Tests/System/Net/aspnetcore/Http2/HPackDecoderTest.cs @@ -46,8 +46,13 @@ public class HPackDecoderTests private const string _headerNameString = "new-header"; + // On purpose longer than 4096 (DefaultStringOctetsSize from HPackDecoder) to trigger https://github.com/dotnet/runtime/issues/78516 + private static readonly string _literalHeaderNameString = string.Concat(Enumerable.Range(0, 4100).Select(c => (char)('a' + (c % 26)))); + private static readonly byte[] _headerNameBytes = Encoding.ASCII.GetBytes(_headerNameString); + private static readonly byte[] _literalHeaderNameBytes = Encoding.ASCII.GetBytes(_literalHeaderNameString); + // n e w - h e a d e r * // 10101000 10111110 00010110 10011100 10100011 10010000 10110110 01111111 private static readonly byte[] _headerNameHuffmanBytes = new byte[] { 0xa8, 0xbe, 0x16, 0x9c, 0xa3, 0x90, 0xb6, 0x7f }; @@ -64,6 +69,12 @@ public class HPackDecoderTests .Concat(_headerNameBytes) .ToArray(); + // size = 4096 ==> 0x7f, 0x81, 0x1f (7+) prefixed integer + // size = 4100 ==> 0x7f, 0x85, 0x1f (7+) prefixed integer + private static readonly byte[] _literalHeaderName = new byte[] { 0x7f, 0x85, 0x1f } // 4100 + .Concat(_literalHeaderNameBytes) + .ToArray(); + private static readonly byte[] _headerNameHuffman = new byte[] { (byte)(0x80 | _headerNameHuffmanBytes.Length) } .Concat(_headerNameHuffmanBytes) .ToArray(); @@ -392,6 +403,101 @@ public void DecodesLiteralHeaderFieldNeverIndexed_IndexedName_OutOfRange_Error() Assert.Empty(_handler.DecodedHeaders); } + [Fact] + public void DecodesLiteralHeaderFieldNeverIndexed_NewName_SingleBuffer() + { + byte[] encoded = _literalHeaderFieldWithoutIndexingNewName + .Concat(_literalHeaderName) + .Concat(_headerValue) + .ToArray(); + + _decoder.Decode(encoded, endHeaders: true, handler: _handler); + + Assert.Equal(1, _handler.DecodedHeaders.Count); + Assert.True(_handler.DecodedHeaders.ContainsKey(_literalHeaderNameString)); + Assert.Equal(_headerValueString, _handler.DecodedHeaders[_literalHeaderNameString]); + } + + [Fact] + public void DecodesLiteralHeaderFieldNeverIndexed_NewName_NameLengthBrokenIntoSeparateBuffers() + { + byte[] encoded = _literalHeaderFieldWithoutIndexingNewName + .Concat(_literalHeaderName) + .Concat(_headerValue) + .ToArray(); + + _decoder.Decode(encoded[..1], endHeaders: false, handler: _handler); + _decoder.Decode(encoded[1..], endHeaders: true, handler: _handler); + + Assert.Equal(1, _handler.DecodedHeaders.Count); + Assert.True(_handler.DecodedHeaders.ContainsKey(_literalHeaderNameString)); + Assert.Equal(_headerValueString, _handler.DecodedHeaders[_literalHeaderNameString]); + } + + [Fact] + public void DecodesLiteralHeaderFieldNeverIndexed_NewName_NameBrokenIntoSeparateBuffers() + { + byte[] encoded = _literalHeaderFieldWithoutIndexingNewName + .Concat(_literalHeaderName) + .Concat(_headerValue) + .ToArray(); + + _decoder.Decode(encoded[..(_literalHeaderNameString.Length / 2)], endHeaders: false, handler: _handler); + _decoder.Decode(encoded[(_literalHeaderNameString.Length / 2)..], endHeaders: true, handler: _handler); + + Assert.Equal(1, _handler.DecodedHeaders.Count); + Assert.True(_handler.DecodedHeaders.ContainsKey(_literalHeaderNameString)); + Assert.Equal(_headerValueString, _handler.DecodedHeaders[_literalHeaderNameString]); + } + + [Fact] + public void DecodesLiteralHeaderFieldNeverIndexed_NewName_NameAndValueBrokenIntoSeparateBuffers() + { + byte[] encoded = _literalHeaderFieldWithoutIndexingNewName + .Concat(_literalHeaderName) + .Concat(_headerValue) + .ToArray(); + + _decoder.Decode(encoded[..^_headerValue.Length], endHeaders: false, handler: _handler); + _decoder.Decode(encoded[^_headerValue.Length..], endHeaders: true, handler: _handler); + + Assert.Equal(1, _handler.DecodedHeaders.Count); + Assert.True(_handler.DecodedHeaders.ContainsKey(_literalHeaderNameString)); + Assert.Equal(_headerValueString, _handler.DecodedHeaders[_literalHeaderNameString]); + } + + [Fact] + public void DecodesLiteralHeaderFieldNeverIndexed_NewName_ValueLengthBrokenIntoSeparateBuffers() + { + byte[] encoded = _literalHeaderFieldWithoutIndexingNewName + .Concat(_literalHeaderName) + .Concat(_headerValue) + .ToArray(); + + _decoder.Decode(encoded[..^(_headerValue.Length - 1)], endHeaders: false, handler: _handler); + _decoder.Decode(encoded[^(_headerValue.Length - 1)..], endHeaders: true, handler: _handler); + + Assert.Equal(1, _handler.DecodedHeaders.Count); + Assert.True(_handler.DecodedHeaders.ContainsKey(_literalHeaderNameString)); + Assert.Equal(_headerValueString, _handler.DecodedHeaders[_literalHeaderNameString]); + } + + [Fact] + public void DecodesLiteralHeaderFieldNeverIndexed_NewName_ValueBrokenIntoSeparateBuffers() + { + byte[] encoded = _literalHeaderFieldWithoutIndexingNewName + .Concat(_literalHeaderName) + .Concat(_headerValue) + .ToArray(); + + _decoder.Decode(encoded[..^(_headerValueString.Length / 2)], endHeaders: false, handler: _handler); + _decoder.Decode(encoded[^(_headerValueString.Length / 2)..], endHeaders: true, handler: _handler); + + Assert.Equal(1, _handler.DecodedHeaders.Count); + Assert.True(_handler.DecodedHeaders.ContainsKey(_literalHeaderNameString)); + Assert.Equal(_headerValueString, _handler.DecodedHeaders[_literalHeaderNameString]); + } + [Fact] public void DecodesDynamicTableSizeUpdate() { diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index e81806e83421f2..85f79abb6ce913 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -25,6 +25,13 @@ + + + true + + + + false @@ -109,6 +116,9 @@ $(TestArchiveTestsRoot)$(OSPlatformConfig)/ $(TestArchiveRoot)runtime/ + true + $(ArtifactsDir)bundles\ + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ref', '$(NetCoreAppCurrent)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'runtime', '$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)')) @@ -138,7 +148,7 @@ $([MSBuild]::NormalizeDirectory($(SdkWithNoWorkloadForTestingPath))) $(SdkWithNoWorkloadForTestingPath)version-$(SdkVersionForWorkloadTesting).stamp - $(SdkWithWorkloadForTestingPath)workload.stamp + $(SdkWithNoWorkloadForTestingPath)workload.stamp $(ArtifactsBinDir)dotnet-workload\ $([MSBuild]::NormalizeDirectory($(SdkWithWorkloadForTestingPath))) diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets index ca9b42f35ca9f1..a1e5b08838bbf6 100644 --- a/src/libraries/Directory.Build.targets +++ b/src/libraries/Directory.Build.targets @@ -218,8 +218,9 @@ + - true + true @@ -228,9 +229,11 @@ true + true + @@ -260,6 +263,7 @@ Returns="@(_AnalyzerPackFile)"> <_analyzerPath>analyzers/dotnet + <_analyzerPath Condition="'$(AnalyzerRoslynVersion)' != ''">$(_analyzerPath)/roslyn$(AnalyzerRoslynVersion) <_analyzerPath Condition="'$(AnalyzerLanguage)' != ''">$(_analyzerPath)/$(AnalyzerLanguage) diff --git a/src/libraries/Microsoft.Bcl.AsyncInterfaces/src/CompatibilitySuppressions.xml b/src/libraries/Microsoft.Bcl.AsyncInterfaces/src/CompatibilitySuppressions.xml deleted file mode 100644 index 13579d318e7039..00000000000000 --- a/src/libraries/Microsoft.Bcl.AsyncInterfaces/src/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - CP0001 - lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll - lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll - - \ No newline at end of file diff --git a/src/libraries/Microsoft.Diagnostics.Tracing.EventSource.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj b/src/libraries/Microsoft.Diagnostics.Tracing.EventSource.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj index 9e17bd12e7cb72..6d2b9e91c040d9 100644 --- a/src/libraries/Microsoft.Diagnostics.Tracing.EventSource.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj +++ b/src/libraries/Microsoft.Diagnostics.Tracing.EventSource.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj @@ -10,7 +10,7 @@ Microsoft.Diagnostics.Tracing.EventSource $(MSBuildProjectName) Microsoft.Diagnostics.Tracing.EventSource $(DefineConstants);NO_EVENTCOMMANDEXECUTED_SUPPORT;ES_BUILD_STANDALONE;FEATURE_MANAGED_ETW;TARGET_WINDOWS - net461-windows + net461 enable true true diff --git a/src/libraries/Microsoft.Diagnostics.Tracing.EventSource.Redist/tests/Microsoft.Diagnostics.Tracing.EventSource.Redist.Tests.csproj b/src/libraries/Microsoft.Diagnostics.Tracing.EventSource.Redist/tests/Microsoft.Diagnostics.Tracing.EventSource.Redist.Tests.csproj index 46457b709cc375..7ad4466cda7690 100644 --- a/src/libraries/Microsoft.Diagnostics.Tracing.EventSource.Redist/tests/Microsoft.Diagnostics.Tracing.EventSource.Redist.Tests.csproj +++ b/src/libraries/Microsoft.Diagnostics.Tracing.EventSource.Redist/tests/Microsoft.Diagnostics.Tracing.EventSource.Redist.Tests.csproj @@ -2,7 +2,7 @@ $(DefineConstants);USE_MDT_EVENTSOURCE true - net461-windows + net461 ..\..\System.Diagnostics.Tracing\tests diff --git a/src/libraries/Microsoft.Extensions.Caching.Memory/Microsoft.Extensions.Caching.Memory.sln b/src/libraries/Microsoft.Extensions.Caching.Memory/Microsoft.Extensions.Caching.Memory.sln index cbb219a495e05c..6fb211776e5f5c 100644 --- a/src/libraries/Microsoft.Extensions.Caching.Memory/Microsoft.Extensions.Caching.Memory.sln +++ b/src/libraries/Microsoft.Extensions.Caching.Memory/Microsoft.Extensions.Caching.Memory.sln @@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Depend EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection", "..\Microsoft.Extensions.DependencyInjection\src\Microsoft.Extensions.DependencyInjection.csproj", "{78971B06-2519-45B7-B761-C8A30C168EBE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{727A5FD3-0146-4E1E-81B6-E71D0C1A055E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{BDC4E2D9-627A-4DE2-BF31-A95351C1CB7C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{C76753D0-F564-45E9-AA60-A846EFE0A414}" @@ -121,10 +119,6 @@ Global {21CD6C35-65E2-414A-B9A1-22A0DD57977A}.Debug|Any CPU.Build.0 = Debug|Any CPU {21CD6C35-65E2-414A-B9A1-22A0DD57977A}.Release|Any CPU.ActiveCfg = Release|Any CPU {21CD6C35-65E2-414A-B9A1-22A0DD57977A}.Release|Any CPU.Build.0 = Release|Any CPU - {727A5FD3-0146-4E1E-81B6-E71D0C1A055E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {727A5FD3-0146-4E1E-81B6-E71D0C1A055E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {727A5FD3-0146-4E1E-81B6-E71D0C1A055E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {727A5FD3-0146-4E1E-81B6-E71D0C1A055E}.Release|Any CPU.Build.0 = Release|Any CPU {B6D30918-C1B7-4225-A809-E13A5817DE22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B6D30918-C1B7-4225-A809-E13A5817DE22}.Debug|Any CPU.Build.0 = Debug|Any CPU {B6D30918-C1B7-4225-A809-E13A5817DE22}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -161,7 +155,6 @@ Global {DA43AA92-35BA-4B84-BAA2-C3BB56C8BB3B} = {67719AA1-52DC-4E35-B6F7-2F53A50B913A} {78971B06-2519-45B7-B761-C8A30C168EBE} = {67719AA1-52DC-4E35-B6F7-2F53A50B913A} {21CD6C35-65E2-414A-B9A1-22A0DD57977A} = {67719AA1-52DC-4E35-B6F7-2F53A50B913A} - {727A5FD3-0146-4E1E-81B6-E71D0C1A055E} = {67719AA1-52DC-4E35-B6F7-2F53A50B913A} {B6D30918-C1B7-4225-A809-E13A5817DE22} = {67719AA1-52DC-4E35-B6F7-2F53A50B913A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs b/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs index 35121fc86ebc34..d9fa37e8cf8343 100644 --- a/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs +++ b/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs @@ -395,9 +395,10 @@ public void Compact(double percentage) private void Compact(long removalSizeTarget, Func computeEntrySize) { var entriesToRemove = new List(); - var lowPriEntries = new List(); - var normalPriEntries = new List(); - var highPriEntries = new List(); + // cache LastAccessed outside of the CacheEntry so it is stable during compaction + var lowPriEntries = new List(); + var normalPriEntries = new List(); + var highPriEntries = new List(); long removedSize = 0; // Sort items by expired & priority status @@ -415,13 +416,13 @@ private void Compact(long removalSizeTarget, Func computeEntry switch (entry.Priority) { case CacheItemPriority.Low: - lowPriEntries.Add(entry); + lowPriEntries.Add(new CompactPriorityEntry(entry, entry.LastAccessed)); break; case CacheItemPriority.Normal: - normalPriEntries.Add(entry); + normalPriEntries.Add(new CompactPriorityEntry(entry, entry.LastAccessed)); break; case CacheItemPriority.High: - highPriEntries.Add(entry); + highPriEntries.Add(new CompactPriorityEntry(entry, entry.LastAccessed)); break; case CacheItemPriority.NeverRemove: break; @@ -445,7 +446,7 @@ private void Compact(long removalSizeTarget, Func computeEntry // ?. Items with the soonest absolute expiration. // ?. Items with the soonest sliding expiration. // ?. Larger objects - estimated by object graph size, inaccurate. - static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, Func computeEntrySize, List entriesToRemove, List priorityEntries) + static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, Func computeEntrySize, List entriesToRemove, List priorityEntries) { // Do we meet our quota by just removing expired entries? if (removalSizeTarget <= removedSize) @@ -458,9 +459,10 @@ static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, F // TODO: Refine policy // LRU - priorityEntries.Sort((e1, e2) => e1.LastAccessed.CompareTo(e2.LastAccessed)); - foreach (CacheEntry entry in priorityEntries) + priorityEntries.Sort(static (e1, e2) => e1.LastAccessed.CompareTo(e2.LastAccessed)); + foreach (CompactPriorityEntry priorityEntry in priorityEntries) { + CacheEntry entry = priorityEntry.Entry; entry.SetExpired(EvictionReason.Capacity); entriesToRemove.Add(entry); removedSize += computeEntrySize(entry); @@ -473,6 +475,20 @@ static void ExpirePriorityBucket(ref long removedSize, long removalSizeTarget, F } } + // use a struct instead of a ValueTuple to avoid adding a new dependency + // on System.ValueTuple on .NET Framework in a servicing release + private readonly struct CompactPriorityEntry + { + public readonly CacheEntry Entry; + public readonly DateTimeOffset LastAccessed; + + public CompactPriorityEntry(CacheEntry entry, DateTimeOffset lastAccessed) + { + Entry = entry; + LastAccessed = lastAccessed; + } + } + public void Dispose() { Dispose(true); diff --git a/src/libraries/Microsoft.Extensions.Caching.Memory/src/Microsoft.Extensions.Caching.Memory.csproj b/src/libraries/Microsoft.Extensions.Caching.Memory/src/Microsoft.Extensions.Caching.Memory.csproj index 495c645ba993ad..a65eda71abed6a 100644 --- a/src/libraries/Microsoft.Extensions.Caching.Memory/src/Microsoft.Extensions.Caching.Memory.csproj +++ b/src/libraries/Microsoft.Extensions.Caching.Memory/src/Microsoft.Extensions.Caching.Memory.csproj @@ -4,6 +4,7 @@ netstandard2.0;net461 true In-memory cache implementation of Microsoft.Extensions.Caching.Memory.IMemoryCache. + 1 diff --git a/src/libraries/Microsoft.Extensions.Caching.Memory/tests/CompactTests.cs b/src/libraries/Microsoft.Extensions.Caching.Memory/tests/CompactTests.cs index 3d9c2625b19ed9..10b9cce7c4d459 100644 --- a/src/libraries/Microsoft.Extensions.Caching.Memory/tests/CompactTests.cs +++ b/src/libraries/Microsoft.Extensions.Caching.Memory/tests/CompactTests.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Threading; +using System.Threading.Tasks; using Microsoft.Extensions.Internal; using Xunit; @@ -83,4 +85,60 @@ public void CompactPrioritizesLRU() Assert.Equal("value4", cache.Get("key4")); } } + + [CollectionDefinition(nameof(DisableParallelization), DisableParallelization = true)] + public class DisableParallelization { } + + [Collection(nameof(DisableParallelization))] + public class CompactTestsDisableParallelization + { + /// + /// Tests a race condition in Compact where CacheEntry.LastAccessed is getting updated + /// by a different thread than what is doing the Compact, leading to sorting failing. + /// + /// See https://github.com/dotnet/runtime/issues/61032. + /// + [Fact] + public void CompactLastAccessedRaceCondition() + { + const int numEntries = 100; + MemoryCache cache = new MemoryCache(new MemoryCacheOptions()); + Random random = new Random(); + + void FillCache() + { + for (int i = 0; i < numEntries; i++) + { + cache.Set($"key{i}", $"value{i}"); + } + } + + // start a few tasks to access entries in the background + Task[] backgroundAccessTasks = new Task[Environment.ProcessorCount]; + bool done = false; + + for (int i = 0; i < backgroundAccessTasks.Length; i++) + { + backgroundAccessTasks[i] = Task.Run(async () => + { + while (!done) + { + cache.TryGetValue($"key{random.Next(numEntries)}", out _); + await Task.Yield(); + } + }); + } + + for (int i = 0; i < 1000; i++) + { + FillCache(); + + cache.Compact(1); + } + + done = true; + + Task.WaitAll(backgroundAccessTasks); + } + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/src/EnvironmentVariablesConfigurationProvider.cs b/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/src/EnvironmentVariablesConfigurationProvider.cs index 5ea29116ca2d9b..55f5290cd13da9 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/src/EnvironmentVariablesConfigurationProvider.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/src/EnvironmentVariablesConfigurationProvider.cs @@ -78,17 +78,9 @@ internal void Load(IDictionary envVariables) { prefix = CustomPrefix; } - else if (key.StartsWith(_prefix, StringComparison.OrdinalIgnoreCase)) - { - // This prevents the prefix from being normalized. - // We can also do a fast path branch, I guess? No point in reallocating if the prefix is empty. - key = NormalizeKey(key.Substring(_prefix.Length)); - data[key] = entry.Value as string; - - continue; - } else { + AddIfPrefixed(data, NormalizeKey(key), (string?)entry.Value); continue; } diff --git a/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/src/Microsoft.Extensions.Configuration.EnvironmentVariables.csproj b/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/src/Microsoft.Extensions.Configuration.EnvironmentVariables.csproj index c12fa852d9b768..8983f7795cb97f 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/src/Microsoft.Extensions.Configuration.EnvironmentVariables.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/src/Microsoft.Extensions.Configuration.EnvironmentVariables.csproj @@ -4,6 +4,7 @@ netstandard2.0;net461 true Environment variables configuration provider implementation for Microsoft.Extensions.Configuration. + 1 diff --git a/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/tests/EnvironmentVariablesTest.cs b/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/tests/EnvironmentVariablesTest.cs index c5b1030ee74a0b..1e98a5767096a0 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/tests/EnvironmentVariablesTest.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.EnvironmentVariables/tests/EnvironmentVariablesTest.cs @@ -166,7 +166,7 @@ public void ReplaceDoubleUnderscoreInEnvironmentVariablesButNotPrefix() envConfigSrc.Load(dict); - Assert.Equal("connection", envConfigSrc.Get("data:ConnectionString")); + Assert.Throws(() => envConfigSrc.Get("data:ConnectionString")); } [Fact] @@ -176,7 +176,7 @@ public void ReplaceDoubleUnderscoreInEnvironmentVariablesButNotInAnomalousPrefix { {"_____EXPERIMENTAL__data__ConnectionString", "connection"} }; - var envConfigSrc = new EnvironmentVariablesConfigurationProvider("_____EXPERIMENTAL__"); + var envConfigSrc = new EnvironmentVariablesConfigurationProvider("::_EXPERIMENTAL:"); envConfigSrc.Load(dict); @@ -194,7 +194,7 @@ public void ReplaceDoubleUnderscoreInEnvironmentVariablesWithDuplicatedPrefix() envConfigSrc.Load(dict); - Assert.Equal("connection", envConfigSrc.Get("test:ConnectionString")); + Assert.Throws(() => envConfigSrc.Get("test:ConnectionString")); } [Fact] @@ -205,7 +205,7 @@ public void PrefixPreventsLoadingSqlConnectionStrings() {"test__test__ConnectionString", "connection"}, {"SQLCONNSTR_db1", "connStr"} }; - var envConfigSrc = new EnvironmentVariablesConfigurationProvider("test__"); + var envConfigSrc = new EnvironmentVariablesConfigurationProvider("test:"); envConfigSrc.Load(dict); @@ -213,6 +213,54 @@ public void PrefixPreventsLoadingSqlConnectionStrings() Assert.Throws(() => envConfigSrc.Get("ConnectionStrings:db1_ProviderName")); } + public const string EnvironmentVariable = "Microsoft__Extensions__Configuration__EnvironmentVariables__Test__Foo"; + public class SettingsWithFoo + { + public string? Foo { get; set; } + } + + [Fact] + public void AddEnvironmentVariables_Bind_PrefixShouldNormalize() + { + try + { + Environment.SetEnvironmentVariable(EnvironmentVariable, "myFooValue"); + var configuration = new ConfigurationBuilder() + .AddEnvironmentVariables("Microsoft:Extensions:Configuration:EnvironmentVariables:Test:") + .Build(); + + var settingsWithFoo = new SettingsWithFoo(); + configuration.Bind(settingsWithFoo); + + Assert.Equal("myFooValue", settingsWithFoo.Foo); + } + finally + { + Environment.SetEnvironmentVariable(EnvironmentVariable, null); + } + } + + [Fact] + public void AddEnvironmentVariables_UsingDoubleUnderscores_Bind_PrefixWontNormalize() + { + try + { + Environment.SetEnvironmentVariable(EnvironmentVariable, "myFooValue"); + var configuration = new ConfigurationBuilder() + .AddEnvironmentVariables("Microsoft__Extensions__Configuration__EnvironmentVariables__Test__") + .Build(); + + var settingsWithFoo = new SettingsWithFoo(); + configuration.Bind(settingsWithFoo); + + Assert.Null(settingsWithFoo.Foo); + } + finally + { + Environment.SetEnvironmentVariable(EnvironmentVariable, null); + } + } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] public void BindingDoesNotThrowIfReloadedDuringBinding() { diff --git a/src/libraries/Microsoft.Extensions.Configuration.Json/Microsoft.Extensions.Configuration.Json.sln b/src/libraries/Microsoft.Extensions.Configuration.Json/Microsoft.Extensions.Configuration.Json.sln index 648fd67ef942e7..e7d5ca9c205118 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Json/Microsoft.Extensions.Configuration.Json.sln +++ b/src/libraries/Microsoft.Extensions.Configuration.Json/Microsoft.Extensions.Configuration.Json.sln @@ -49,8 +49,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{BD19B1E7-CAFF-4009-874A-760D5A466E28}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{160C3D6B-D90A-40B1-A695-81DB79EB24C4}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{A49023C8-173A-4B8F-84B3-2FF37FE8344A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{1F57E720-CBFF-4648-A507-EFCBCECB5FD3}" @@ -141,10 +139,6 @@ Global {BD19B1E7-CAFF-4009-874A-760D5A466E28}.Debug|Any CPU.Build.0 = Debug|Any CPU {BD19B1E7-CAFF-4009-874A-760D5A466E28}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD19B1E7-CAFF-4009-874A-760D5A466E28}.Release|Any CPU.Build.0 = Release|Any CPU - {160C3D6B-D90A-40B1-A695-81DB79EB24C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {160C3D6B-D90A-40B1-A695-81DB79EB24C4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {160C3D6B-D90A-40B1-A695-81DB79EB24C4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {160C3D6B-D90A-40B1-A695-81DB79EB24C4}.Release|Any CPU.Build.0 = Release|Any CPU {7517D0A0-5596-48B7-96EF-CB24DAD72675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7517D0A0-5596-48B7-96EF-CB24DAD72675}.Debug|Any CPU.Build.0 = Debug|Any CPU {7517D0A0-5596-48B7-96EF-CB24DAD72675}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -201,7 +195,6 @@ Global {6A80D098-69EC-45FE-A064-4CBDFA44BA43} = {1789A282-9C08-40AB-9FD0-0FB1FAB99621} {B1723D4C-15E3-4A39-8976-C3E1740E5F00} = {1789A282-9C08-40AB-9FD0-0FB1FAB99621} {BD19B1E7-CAFF-4009-874A-760D5A466E28} = {1789A282-9C08-40AB-9FD0-0FB1FAB99621} - {160C3D6B-D90A-40B1-A695-81DB79EB24C4} = {1789A282-9C08-40AB-9FD0-0FB1FAB99621} {7517D0A0-5596-48B7-96EF-CB24DAD72675} = {1789A282-9C08-40AB-9FD0-0FB1FAB99621} {68210977-E10C-4BC3-B235-31B6E2AF9830} = {1789A282-9C08-40AB-9FD0-0FB1FAB99621} {FE50757B-7862-49D2-812E-1646F6FE0070} = {1789A282-9C08-40AB-9FD0-0FB1FAB99621} diff --git a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/Microsoft.Extensions.Configuration.UserSecrets.sln b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/Microsoft.Extensions.Configuration.UserSecrets.sln index e13f9f1bb81357..6e0e8ac58fc456 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/Microsoft.Extensions.Configuration.UserSecrets.sln +++ b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/Microsoft.Extensions.Configuration.UserSecrets.sln @@ -49,8 +49,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{1555B38A-E9CB-4734-AAB1-59CFB833A06D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{30EBBE93-80FC-442D-ADC6-D0BB0A8CFA76}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{82700778-D9AD-4B9D-8A1C-CDC1A19E4D54}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{2434A707-1012-4104-81A0-1A1B25D9FEEA}" @@ -161,10 +159,6 @@ Global {1555B38A-E9CB-4734-AAB1-59CFB833A06D}.Debug|Any CPU.Build.0 = Debug|Any CPU {1555B38A-E9CB-4734-AAB1-59CFB833A06D}.Release|Any CPU.ActiveCfg = Release|Any CPU {1555B38A-E9CB-4734-AAB1-59CFB833A06D}.Release|Any CPU.Build.0 = Release|Any CPU - {30EBBE93-80FC-442D-ADC6-D0BB0A8CFA76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {30EBBE93-80FC-442D-ADC6-D0BB0A8CFA76}.Debug|Any CPU.Build.0 = Debug|Any CPU - {30EBBE93-80FC-442D-ADC6-D0BB0A8CFA76}.Release|Any CPU.ActiveCfg = Release|Any CPU - {30EBBE93-80FC-442D-ADC6-D0BB0A8CFA76}.Release|Any CPU.Build.0 = Release|Any CPU {96003091-9E9D-42D5-85A6-C2DFBD9DD847}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {96003091-9E9D-42D5-85A6-C2DFBD9DD847}.Debug|Any CPU.Build.0 = Debug|Any CPU {96003091-9E9D-42D5-85A6-C2DFBD9DD847}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -203,7 +197,6 @@ Global {82700778-D9AD-4B9D-8A1C-CDC1A19E4D54} = {B5EF5DDD-EB92-414C-B9D2-826BA6CECCBF} {1EF04395-4D84-43F1-BD99-7F6D6C3D70BB} = {B5EF5DDD-EB92-414C-B9D2-826BA6CECCBF} {1555B38A-E9CB-4734-AAB1-59CFB833A06D} = {B5EF5DDD-EB92-414C-B9D2-826BA6CECCBF} - {30EBBE93-80FC-442D-ADC6-D0BB0A8CFA76} = {B5EF5DDD-EB92-414C-B9D2-826BA6CECCBF} {54B89407-FCD9-4B1A-8F83-04585D437443} = {B5EF5DDD-EB92-414C-B9D2-826BA6CECCBF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/Microsoft.Extensions.Configuration.UserSecrets.csproj b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/Microsoft.Extensions.Configuration.UserSecrets.csproj index d488eecf483e74..a029a8c863902f 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/Microsoft.Extensions.Configuration.UserSecrets.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/Microsoft.Extensions.Configuration.UserSecrets.csproj @@ -4,6 +4,7 @@ netstandard2.0;net461 true User secrets configuration provider implementation for Microsoft.Extensions.Configuration. + 1 @@ -14,8 +15,8 @@ - - + + diff --git a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/UserSecretsConfigurationExtensions.cs b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/UserSecretsConfigurationExtensions.cs index 86139faf9b021d..963ac77a30eea6 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/UserSecretsConfigurationExtensions.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/UserSecretsConfigurationExtensions.cs @@ -29,7 +29,7 @@ public static class UserSecretsConfigurationExtensions /// The configuration builder. public static IConfigurationBuilder AddUserSecrets(this IConfigurationBuilder configuration) where T : class - => configuration.AddUserSecrets(typeof(T).Assembly, optional: false, reloadOnChange: false); + => configuration.AddUserSecrets(typeof(T).Assembly, optional: true, reloadOnChange: false); /// /// @@ -82,7 +82,7 @@ public static IConfigurationBuilder AddUserSecrets(this IConfigurationBuilder /// Thrown when does not have a valid /// The configuration builder. public static IConfigurationBuilder AddUserSecrets(this IConfigurationBuilder configuration, Assembly assembly) - => configuration.AddUserSecrets(assembly, optional: false, reloadOnChange: false); + => configuration.AddUserSecrets(assembly, optional: true, reloadOnChange: false); /// /// diff --git a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/build/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.props b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.props similarity index 100% rename from src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/build/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.props rename to src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.props diff --git a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/build/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.targets b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.targets similarity index 100% rename from src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/build/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.targets rename to src/libraries/Microsoft.Extensions.Configuration.UserSecrets/src/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.UserSecrets.targets diff --git a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/tests/ConfigurationExtensionTest.cs b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/tests/ConfigurationExtensionTest.cs index 03667ab17b33c5..53dde10c61df4a 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/tests/ConfigurationExtensionTest.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.UserSecrets/tests/ConfigurationExtensionTest.cs @@ -85,23 +85,23 @@ public void AddUserSecrets_FindsAssemblyAttributeFromType() public void AddUserSecrets_ThrowsIfAssemblyAttributeFromType() { var ex = Assert.Throws(() => - new ConfigurationBuilder().AddUserSecrets()); + new ConfigurationBuilder().AddUserSecrets(optional: false)); Assert.Equal(SR.Format(SR.Error_Missing_UserSecretsIdAttribute, typeof(string).Assembly.GetName().Name), ex.Message); ex = Assert.Throws(() => - new ConfigurationBuilder().AddUserSecrets(typeof(JObject).Assembly)); + new ConfigurationBuilder().AddUserSecrets(typeof(JObject).Assembly, optional: false)); Assert.Equal(SR.Format(SR.Error_Missing_UserSecretsIdAttribute, typeof(JObject).Assembly.GetName().Name), ex.Message); } [Fact] - public void AddUserSecrets_DoesNotThrowsIfOptional() + public void AddUserSecrets_DoesNotThrowsIfOptionalByDefault() { var config = new ConfigurationBuilder() - .AddUserSecrets(optional: true) - .AddUserSecrets(typeof(List<>).Assembly, optional: true) + .AddUserSecrets() + .AddUserSecrets(typeof(List<>).Assembly) .Build(); Assert.Empty(config.AsEnumerable()); diff --git a/src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj b/src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj index c9c66f5c8c67f2..9a06f8e7ad52b3 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj @@ -1,7 +1,7 @@ - netstandard2.0;net461 + netstandard2.0;net461-windows true XML configuration provider implementation for Microsoft.Extensions.Configuration. diff --git a/src/libraries/Microsoft.Extensions.Configuration.Xml/tests/Microsoft.Extensions.Configuration.Xml.Tests.csproj b/src/libraries/Microsoft.Extensions.Configuration.Xml/tests/Microsoft.Extensions.Configuration.Xml.Tests.csproj index 85e8e1de25876a..35ceadc08eed45 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Xml/tests/Microsoft.Extensions.Configuration.Xml.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration.Xml/tests/Microsoft.Extensions.Configuration.Xml.Tests.csproj @@ -1,7 +1,7 @@ - $(NetCoreAppCurrent);net461 + $(NetCoreAppCurrent);net461-windows true diff --git a/src/libraries/Microsoft.Extensions.Configuration/Microsoft.Extensions.Configuration.sln b/src/libraries/Microsoft.Extensions.Configuration/Microsoft.Extensions.Configuration.sln index a2ec3b0599f575..57cf3b372163b0 100644 --- a/src/libraries/Microsoft.Extensions.Configuration/Microsoft.Extensions.Configuration.sln +++ b/src/libraries/Microsoft.Extensions.Configuration/Microsoft.Extensions.Configuration.sln @@ -95,8 +95,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{23F4102D-67BD-4865-BB19-195C47945733}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{634542E9-CF9A-4BD2-BC36-71D12BEF2B36}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{41234DB5-1F3A-4E4A-8BD9-4A277C249666}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Extensions", "..\System.Windows.Extensions\ref\System.Windows.Extensions.csproj", "{6CDFD705-28EC-4D58-A2F9-715A3B06661B}" @@ -251,10 +249,6 @@ Global {23F4102D-67BD-4865-BB19-195C47945733}.Debug|Any CPU.Build.0 = Debug|Any CPU {23F4102D-67BD-4865-BB19-195C47945733}.Release|Any CPU.ActiveCfg = Release|Any CPU {23F4102D-67BD-4865-BB19-195C47945733}.Release|Any CPU.Build.0 = Release|Any CPU - {634542E9-CF9A-4BD2-BC36-71D12BEF2B36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {634542E9-CF9A-4BD2-BC36-71D12BEF2B36}.Debug|Any CPU.Build.0 = Debug|Any CPU - {634542E9-CF9A-4BD2-BC36-71D12BEF2B36}.Release|Any CPU.ActiveCfg = Release|Any CPU - {634542E9-CF9A-4BD2-BC36-71D12BEF2B36}.Release|Any CPU.Build.0 = Release|Any CPU {CDC60461-56B7-4941-AD08-90228BD450CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CDC60461-56B7-4941-AD08-90228BD450CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {CDC60461-56B7-4941-AD08-90228BD450CE}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -303,7 +297,7 @@ Global {7CFEB13D-63D5-42A7-868C-CE1D0049EAF0}.Debug|Any CPU.Build.0 = Debug|Any CPU {7CFEB13D-63D5-42A7-868C-CE1D0049EAF0}.Release|Any CPU.ActiveCfg = Release|Any CPU {7CFEB13D-63D5-42A7-868C-CE1D0049EAF0}.Release|Any CPU.Build.0 = Release|Any CPU - {6CDFD705-28EC-4D58-A2F9-715A3B06661B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CDFD705-28EC-4D58-A2F9-715A3B06661B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6CDFD705-28EC-4D58-A2F9-715A3B06661B}.Debug|Any CPU.Build.0 = Debug|Any CPU {6CDFD705-28EC-4D58-A2F9-715A3B06661B}.Release|Any CPU.ActiveCfg = Release|Any CPU {6CDFD705-28EC-4D58-A2F9-715A3B06661B}.Release|Any CPU.Build.0 = Release|Any CPU @@ -370,7 +364,6 @@ Global {BAA953EF-6529-4F2C-8F89-C76A05258677} = {76107BEB-02C0-4A83-9631-B226340752A7} {42C10152-F747-443F-9AC1-5738CB62EA6C} = {76107BEB-02C0-4A83-9631-B226340752A7} {23F4102D-67BD-4865-BB19-195C47945733} = {76107BEB-02C0-4A83-9631-B226340752A7} - {634542E9-CF9A-4BD2-BC36-71D12BEF2B36} = {76107BEB-02C0-4A83-9631-B226340752A7} {CDC60461-56B7-4941-AD08-90228BD450CE} = {76107BEB-02C0-4A83-9631-B226340752A7} {6CCBE9AB-E620-4616-9B80-1F9D3E722B87} = {76107BEB-02C0-4A83-9631-B226340752A7} {8F65DFBB-9196-4E69-879A-C99C641B3E49} = {76107BEB-02C0-4A83-9631-B226340752A7} diff --git a/src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationManager.cs b/src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationManager.cs index 9578f3c334ac3f..84cceb06218d74 100644 --- a/src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationManager.cs +++ b/src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationManager.cs @@ -12,15 +12,20 @@ namespace Microsoft.Extensions.Configuration { /// /// Configuration is mutable configuration object. It is both an and an . - /// As sources are added, it updates its current view of configuration. Once Build is called, configuration is frozen. + /// As sources are added, it updates its current view of configuration. /// public sealed class ConfigurationManager : IConfigurationBuilder, IConfigurationRoot, IDisposable { + // Concurrently modifying config sources or properties is not thread-safe. However, it is thread-safe to read config while modifying sources or properties. private readonly ConfigurationSources _sources; private readonly ConfigurationBuilderProperties _properties; - private readonly object _providerLock = new(); - private readonly List _providers = new(); + // ReferenceCountedProviderManager manages copy-on-write references to support concurrently reading config while modifying sources. + // It waits for readers to unreference the providers before disposing them without blocking on any concurrent operations. + private readonly ReferenceCountedProviderManager _providerManager = new(); + + // _changeTokenRegistrations is only modified when config sources are modified. It is not referenced by any read operations. + // Because modify config sources is not thread-safe, modifying _changeTokenRegistrations does not need to be thread-safe either. private readonly List _changeTokenRegistrations = new(); private ConfigurationReloadToken _changeToken = new(); @@ -43,17 +48,13 @@ public string this[string key] { get { - lock (_providerLock) - { - return ConfigurationRoot.GetConfiguration(_providers, key); - } + using ReferenceCountedProviders reference = _providerManager.GetReference(); + return ConfigurationRoot.GetConfiguration(reference.Providers, key); } set { - lock (_providerLock) - { - ConfigurationRoot.SetConfiguration(_providers, key, value); - } + using ReferenceCountedProviders reference = _providerManager.GetReference(); + ConfigurationRoot.SetConfiguration(reference.Providers, key, value); } } @@ -61,37 +62,22 @@ public string this[string key] public IConfigurationSection GetSection(string key) => new ConfigurationSection(this, key); /// - public IEnumerable GetChildren() - { - lock (_providerLock) - { - // ToList() to eagerly evaluate inside lock. - return this.GetChildrenImplementation(null).ToList(); - } - } + public IEnumerable GetChildren() => this.GetChildrenImplementation(null); IDictionary IConfigurationBuilder.Properties => _properties; IList IConfigurationBuilder.Sources => _sources; - IEnumerable IConfigurationRoot.Providers - { - get - { - lock (_providerLock) - { - return new List(_providers); - } - } - } + // We cannot track the duration of the reference to the providers if this property is used. + // If a configuration source is removed after this is accessed but before it's completely enumerated, + // this may allow access to a disposed provider. + IEnumerable IConfigurationRoot.Providers => _providerManager.NonReferenceCountedProviders; /// public void Dispose() { - lock (_providerLock) - { - DisposeRegistrationsAndProvidersUnsynchronized(); - } + DisposeRegistrations(); + _providerManager.Dispose(); } IConfigurationBuilder IConfigurationBuilder.Add(IConfigurationSource source) @@ -106,9 +92,9 @@ IConfigurationBuilder IConfigurationBuilder.Add(IConfigurationSource source) void IConfigurationRoot.Reload() { - lock (_providerLock) + using (ReferenceCountedProviders reference = _providerManager.GetReference()) { - foreach (var provider in _providers) + foreach (IConfigurationProvider provider in reference.Providers) { provider.Load(); } @@ -117,6 +103,8 @@ void IConfigurationRoot.Reload() RaiseChanged(); } + internal ReferenceCountedProviders GetProvidersReference() => _providerManager.GetReference(); + private void RaiseChanged() { var previousToken = Interlocked.Exchange(ref _changeToken, new ConfigurationReloadToken()); @@ -126,59 +114,49 @@ private void RaiseChanged() // Don't rebuild and reload all providers in the common case when a source is simply added to the IList. private void AddSource(IConfigurationSource source) { - lock (_providerLock) - { - var provider = source.Build(this); - _providers.Add(provider); + IConfigurationProvider provider = source.Build(this); - provider.Load(); - _changeTokenRegistrations.Add(ChangeToken.OnChange(() => provider.GetReloadToken(), () => RaiseChanged())); - } + provider.Load(); + _changeTokenRegistrations.Add(ChangeToken.OnChange(() => provider.GetReloadToken(), () => RaiseChanged())); + _providerManager.AddProvider(provider); RaiseChanged(); } // Something other than Add was called on IConfigurationBuilder.Sources or IConfigurationBuilder.Properties has changed. private void ReloadSources() { - lock (_providerLock) - { - DisposeRegistrationsAndProvidersUnsynchronized(); + DisposeRegistrations(); - _changeTokenRegistrations.Clear(); - _providers.Clear(); + _changeTokenRegistrations.Clear(); - foreach (var source in _sources) - { - _providers.Add(source.Build(this)); - } + var newProvidersList = new List(); - foreach (var p in _providers) - { - p.Load(); - _changeTokenRegistrations.Add(ChangeToken.OnChange(() => p.GetReloadToken(), () => RaiseChanged())); - } + foreach (IConfigurationSource source in _sources) + { + newProvidersList.Add(source.Build(this)); + } + + foreach (IConfigurationProvider p in newProvidersList) + { + p.Load(); + _changeTokenRegistrations.Add(ChangeToken.OnChange(() => p.GetReloadToken(), () => RaiseChanged())); } + _providerManager.ReplaceProviders(newProvidersList); RaiseChanged(); } - private void DisposeRegistrationsAndProvidersUnsynchronized() + private void DisposeRegistrations() { // dispose change token registrations - foreach (var registration in _changeTokenRegistrations) + foreach (IDisposable registration in _changeTokenRegistrations) { registration.Dispose(); } - - // dispose providers - foreach (var provider in _providers) - { - (provider as IDisposable)?.Dispose(); - } } - private class ConfigurationSources : IList + private sealed class ConfigurationSources : IList { private readonly List _sources = new(); private readonly ConfigurationManager _config; @@ -259,7 +237,7 @@ IEnumerator IEnumerable.GetEnumerator() } } - private class ConfigurationBuilderProperties : IDictionary + private sealed class ConfigurationBuilderProperties : IDictionary { private readonly Dictionary _properties = new(); private readonly ConfigurationManager _config; diff --git a/src/libraries/Microsoft.Extensions.Configuration/src/InternalConfigurationRootExtensions.cs b/src/libraries/Microsoft.Extensions.Configuration/src/InternalConfigurationRootExtensions.cs index bff5c527104008..de86a8473d9812 100644 --- a/src/libraries/Microsoft.Extensions.Configuration/src/InternalConfigurationRootExtensions.cs +++ b/src/libraries/Microsoft.Extensions.Configuration/src/InternalConfigurationRootExtensions.cs @@ -20,11 +20,24 @@ internal static class InternalConfigurationRootExtensions /// Immediate children sub-sections of section specified by key. internal static IEnumerable GetChildrenImplementation(this IConfigurationRoot root, string path) { - return root.Providers + using ReferenceCountedProviders? reference = (root as ConfigurationManager)?.GetProvidersReference(); + IEnumerable providers = reference?.Providers ?? root.Providers; + + IEnumerable children = providers .Aggregate(Enumerable.Empty(), (seed, source) => source.GetChildKeys(seed, path)) .Distinct(StringComparer.OrdinalIgnoreCase) .Select(key => root.GetSection(path == null ? key : ConfigurationPath.Combine(path, key))); + + if (reference is null) + { + return children; + } + else + { + // Eagerly evaluate the IEnumerable before releasing the reference so we don't allow iteration over disposed providers. + return children.ToList(); + } } } } diff --git a/src/libraries/Microsoft.Extensions.Configuration/src/Microsoft.Extensions.Configuration.csproj b/src/libraries/Microsoft.Extensions.Configuration/src/Microsoft.Extensions.Configuration.csproj index 62243f8db8537a..e20863957c5223 100644 --- a/src/libraries/Microsoft.Extensions.Configuration/src/Microsoft.Extensions.Configuration.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration/src/Microsoft.Extensions.Configuration.csproj @@ -4,6 +4,7 @@ netstandard2.0;net461 true Implementation of key-value pair based configuration for Microsoft.Extensions.Configuration. Includes the memory configuration provider. + 1 diff --git a/src/libraries/Microsoft.Extensions.Configuration/src/ReferenceCountedProviders.cs b/src/libraries/Microsoft.Extensions.Configuration/src/ReferenceCountedProviders.cs new file mode 100644 index 00000000000000..2c2e32fc7e47d0 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Configuration/src/ReferenceCountedProviders.cs @@ -0,0 +1,93 @@ +// 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.Threading; + +namespace Microsoft.Extensions.Configuration +{ + // ReferenceCountedProviders is used by ConfigurationManager to wait until all readers unreference it before disposing any providers. + internal abstract class ReferenceCountedProviders : IDisposable + { + public static ReferenceCountedProviders Create(List providers) => new ActiveReferenceCountedProviders(providers); + + // If anything references DisposedReferenceCountedProviders, it indicates something is using the ConfigurationManager after it's been disposed. + // We could preemptively throw an ODE from ReferenceCountedProviderManager.GetReference() instead of returning this type, but this might + // break existing apps that are previously able to continue to read configuration after disposing an ConfigurationManager. + public static ReferenceCountedProviders CreateDisposed(List providers) => new DisposedReferenceCountedProviders(providers); + + public abstract List Providers { get; set; } + + // NonReferenceCountedProviders is only used to: + // 1. Support IConfigurationRoot.Providers because we cannot track the lifetime of that reference. + // 2. Construct DisposedReferenceCountedProviders because the providers are disposed anyway and no longer reference counted. + public abstract List NonReferenceCountedProviders { get; } + + public abstract void AddReference(); + // This is Dispose() rather than RemoveReference() so we can conveniently release a reference at the end of a using block. + public abstract void Dispose(); + + private sealed class ActiveReferenceCountedProviders : ReferenceCountedProviders + { + private long _refCount = 1; + // volatile is not strictly necessary because the runtime adds a barrier either way, but volatile indicates that this field has + // unsynchronized readers meaning the all writes initializing the list must be published before updating the _providers reference. + private volatile List _providers; + + public ActiveReferenceCountedProviders(List providers) + { + _providers = providers; + } + + public override List Providers + { + get + { + Debug.Assert(_refCount > 0); + return _providers; + } + set + { + Debug.Assert(_refCount > 0); + _providers = value; + } + } + + public override List NonReferenceCountedProviders => _providers; + + public override void AddReference() + { + // AddReference() is always called with a lock to ensure _refCount hasn't already decremented to zero. + Debug.Assert(_refCount > 0); + Interlocked.Increment(ref _refCount); + } + + public override void Dispose() + { + if (Interlocked.Decrement(ref _refCount) == 0) + { + foreach (IConfigurationProvider provider in _providers) + { + (provider as IDisposable)?.Dispose(); + } + } + } + } + + private sealed class DisposedReferenceCountedProviders : ReferenceCountedProviders + { + public DisposedReferenceCountedProviders(List providers) + { + Providers = providers; + } + + public override List Providers { get; set; } + public override List NonReferenceCountedProviders => Providers; + + public override void AddReference() { } + public override void Dispose() { } + } + } +} diff --git a/src/libraries/Microsoft.Extensions.Configuration/src/ReferenceCountedProvidersManager.cs b/src/libraries/Microsoft.Extensions.Configuration/src/ReferenceCountedProvidersManager.cs new file mode 100644 index 00000000000000..210e41f665a47a --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Configuration/src/ReferenceCountedProvidersManager.cs @@ -0,0 +1,93 @@ +// 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; + +namespace Microsoft.Extensions.Configuration +{ + // ReferenceCountedProviderManager is used by ConfigurationManager to provide copy-on-write references that support concurrently + // reading config while modifying sources. It waits for readers to unreference the providers before disposing them + // without blocking on any concurrent operations. + internal sealed class ReferenceCountedProviderManager : IDisposable + { + private readonly object _replaceProvidersLock = new object(); + private ReferenceCountedProviders _refCountedProviders = ReferenceCountedProviders.Create(new List()); + private bool _disposed; + + // This is only used to support IConfigurationRoot.Providers because we cannot track the lifetime of that reference. + public IEnumerable NonReferenceCountedProviders => _refCountedProviders.NonReferenceCountedProviders; + + public ReferenceCountedProviders GetReference() + { + // Lock to ensure oldRefCountedProviders.Dispose() in ReplaceProviders() or Dispose() doesn't decrement ref count to zero + // before calling _refCountedProviders.AddReference(). + lock (_replaceProvidersLock) + { + if (_disposed) + { + // Return a non-reference-counting ReferenceCountedProviders instance now that the ConfigurationManager is disposed. + // We could preemptively throw an ODE instead, but this might break existing apps that were previously able to + // continue to read configuration after disposing an ConfigurationManager. + return ReferenceCountedProviders.CreateDisposed(_refCountedProviders.NonReferenceCountedProviders); + } + + _refCountedProviders.AddReference(); + return _refCountedProviders; + } + } + + // Providers should never be concurrently modified. Reading during modification is allowed. + public void ReplaceProviders(List providers) + { + ReferenceCountedProviders oldRefCountedProviders = _refCountedProviders; + + lock (_replaceProvidersLock) + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(ConfigurationManager)); + } + + _refCountedProviders = ReferenceCountedProviders.Create(providers); + } + + // Decrement the reference count to the old providers. If they are being concurrently read from + // the actual disposal of the old providers will be delayed until the final reference is released. + // Never dispose ReferenceCountedProviders with a lock because this may call into user code. + oldRefCountedProviders.Dispose(); + } + + public void AddProvider(IConfigurationProvider provider) + { + lock (_replaceProvidersLock) + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(ConfigurationManager)); + } + + // Maintain existing references, but replace list with copy containing new item. + _refCountedProviders.Providers = new List(_refCountedProviders.Providers) + { + provider + }; + } + } + + public void Dispose() + { + ReferenceCountedProviders oldRefCountedProviders = _refCountedProviders; + + // This lock ensures that we cannot reduce the ref count to zero before GetReference() calls AddReference(). + // Once _disposed is set, GetReference() stops reference counting. + lock (_replaceProvidersLock) + { + _disposed = true; + } + + // Never dispose ReferenceCountedProviders with a lock because this may call into user code. + oldRefCountedProviders.Dispose(); + } + } +} diff --git a/src/libraries/Microsoft.Extensions.Configuration/tests/ConfigurationManagerTest.cs b/src/libraries/Microsoft.Extensions.Configuration/tests/ConfigurationManagerTest.cs index 89da7883517544..aa36cceb424e5d 100644 --- a/src/libraries/Microsoft.Extensions.Configuration/tests/ConfigurationManagerTest.cs +++ b/src/libraries/Microsoft.Extensions.Configuration/tests/ConfigurationManagerTest.cs @@ -4,6 +4,8 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using Microsoft.Extensions.Configuration.Memory; using Microsoft.Extensions.Primitives; using Moq; @@ -171,6 +173,91 @@ public void DisposesProvidersOnRemoval() Assert.True(provider5.IsDisposed); } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + public async Task ProviderCanBlockLoadWaitingOnConcurrentRead() + { + using var mre = new ManualResetEventSlim(false); + var provider = new BlockLoadOnMREProvider(mre, timeout: TimeSpan.FromSeconds(30)); + + var config = new ConfigurationManager(); + IConfigurationBuilder builder = config; + + // builder.Add(source) will block on provider.Load(). + var loadTask = Task.Run(() => builder.Add(new TestConfigurationSource(provider))); + await provider.LoadStartedTask; + + // Read configuration while provider.Load() is blocked waiting on us. + _ = config["key"]; + + // Unblock provider.Load() + mre.Set(); + + // This will throw if provider.Load() timed out instead of unblocking gracefully after the read. + await loadTask; + } + + public static TheoryData ConcurrentReadActions + { + get + { + return new TheoryData> + { + config => _ = config["key"], + config => config.GetChildren(), + config => config.GetSection("key").GetChildren(), + }; + } + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [MemberData(nameof(ConcurrentReadActions))] + public async Task ProviderDisposeDelayedWaitingOnConcurrentRead(Action concurrentReadAction) + { + using var mre = new ManualResetEventSlim(false); + var provider = new BlockReadOnMREProvider(mre, timeout: TimeSpan.FromSeconds(30)); + + var config = new ConfigurationManager(); + IConfigurationBuilder builder = config; + + builder.Add(new TestConfigurationSource(provider)); + + // Reading configuration will block on provider.TryRead() or profvider.GetChildKeys(). + var readTask = Task.Run(() => concurrentReadAction(config)); + await provider.ReadStartedTask; + + // Removing the source normally disposes the provider except when there provider is in use as is the case here. + builder.Sources.Clear(); + + Assert.False(provider.IsDisposed); + + // Unblock TryRead() or GetChildKeys() + mre.Set(); + + // This will throw if TryRead() or GetChildKeys() timed out instead of unblocking gracefully after setting the MRE. + await readTask; + + // The provider should be disposed when the concurrentReadAction releases the last reference to the provider. + Assert.True(provider.IsDisposed); + } + + [Fact] + public void DisposingConfigurationManagerCausesOnlySourceChangesToThrow() + { + var config = new ConfigurationManager + { + ["TestKey"] = "TestValue", + }; + + config.Dispose(); + + Assert.Equal("TestValue", config["TestKey"]); + config["TestKey"] = "TestValue2"; + Assert.Equal("TestValue2", config["TestKey"]); + + Assert.Throws(() => config.AddInMemoryCollection()); + Assert.Throws(() => ((IConfigurationBuilder)config).Sources.Clear()); + } + [Fact] public void DisposesChangeTokenRegistrationsOnDispose() { @@ -1128,6 +1215,62 @@ public TestConfigurationProvider(string key, string value) => Data.Add(key, value); } + private class BlockLoadOnMREProvider : ConfigurationProvider + { + private readonly ManualResetEventSlim _mre; + private readonly TimeSpan _timeout; + + private readonly TaskCompletionSource _loadStartedTcs = new(TaskCreationOptions.RunContinuationsAsynchronously); + + public BlockLoadOnMREProvider(ManualResetEventSlim mre, TimeSpan timeout) + { + _mre = mre; + _timeout = timeout; + } + + public Task LoadStartedTask => _loadStartedTcs.Task; + + public override void Load() + { + _loadStartedTcs.SetResult(null); + Assert.True(_mre.Wait(_timeout), "BlockLoadOnMREProvider.Load() timed out."); + } + } + + private class BlockReadOnMREProvider : ConfigurationProvider, IDisposable + { + private readonly ManualResetEventSlim _mre; + private readonly TimeSpan _timeout; + + private readonly TaskCompletionSource _readStartedTcs = new(TaskCreationOptions.RunContinuationsAsynchronously); + + public BlockReadOnMREProvider(ManualResetEventSlim mre, TimeSpan timeout) + { + _mre = mre; + _timeout = timeout; + } + + public Task ReadStartedTask => _readStartedTcs.Task; + + public bool IsDisposed { get; set; } + + public override bool TryGet(string key, out string? value) + { + _readStartedTcs.SetResult(null); + Assert.True(_mre.Wait(_timeout), "BlockReadOnMREProvider.TryGet() timed out."); + return base.TryGet(key, out value); + } + + public override IEnumerable GetChildKeys(IEnumerable earlierKeys, string? parentPath) + { + _readStartedTcs.SetResult(null); + Assert.True(_mre.Wait(_timeout), "BlockReadOnMREProvider.GetChildKeys() timed out."); + return base.GetChildKeys(earlierKeys, parentPath); + } + + public void Dispose() => IsDisposed = true; + } + private class DisposableTestConfigurationProvider : ConfigurationProvider, IDisposable { public bool IsDisposed { get; set; } diff --git a/src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/ConfigurationTests.cs b/src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/ConfigurationTests.cs index 50ffa927af1177..fc26cf88b653a2 100644 --- a/src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/ConfigurationTests.cs +++ b/src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/ConfigurationTests.cs @@ -903,7 +903,7 @@ public void GetDefaultBasePathForSources() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public void CanEnumerateProviders() { var config = CreateBuilder() diff --git a/src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/Microsoft.Extensions.Configuration.Functional.Tests.csproj b/src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/Microsoft.Extensions.Configuration.Functional.Tests.csproj index e28690dc03d718..e2ca66c3ff7cce 100644 --- a/src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/Microsoft.Extensions.Configuration.Functional.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/Microsoft.Extensions.Configuration.Functional.Tests.csproj @@ -1,7 +1,7 @@ - $(NetCoreAppCurrent);net461 + $(NetCoreAppCurrent);net461-windows true diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj index 4c1f40cce828db..915591133734e3 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/DependencyInjectionEventSource.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/src/DependencyInjectionEventSource.cs index 338325edb830f6..03b245224d8bb6 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/src/DependencyInjectionEventSource.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/src/DependencyInjectionEventSource.cs @@ -79,9 +79,9 @@ public void ServiceRealizationFailed(string? exceptionMessage, int serviceProvid [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")] [Event(7, Level = EventLevel.Informational, Keywords = Keywords.ServiceProviderInitialized)] - private void ServiceProviderBuilt(int serviceProviderHashCode, int singletonServices, int scopedServices, int transientServices) + private void ServiceProviderBuilt(int serviceProviderHashCode, int singletonServices, int scopedServices, int transientServices, int closedGenericsServices, int openGenericsServices) { - WriteEvent(7, serviceProviderHashCode, singletonServices, scopedServices, transientServices); + WriteEvent(7, serviceProviderHashCode, singletonServices, scopedServices, transientServices, closedGenericsServices, openGenericsServices); } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", @@ -174,6 +174,8 @@ private void WriteServiceProviderBuilt(ServiceProvider provider) int singletonServices = 0; int scopedServices = 0; int transientServices = 0; + int closedGenericsServices = 0; + int openGenericsServices = 0; StringBuilder descriptorBuilder = new StringBuilder("{ \"descriptors\":[ "); bool firstDescriptor = true; @@ -202,11 +204,23 @@ private void WriteServiceProviderBuilt(ServiceProvider provider) transientServices++; break; } + + if (descriptor.ServiceType.IsGenericType) + { + if (descriptor.ServiceType.IsConstructedGenericType) + { + closedGenericsServices++; + } + else + { + openGenericsServices++; + } + } } descriptorBuilder.Append(" ] }"); int providerHashCode = provider.GetHashCode(); - ServiceProviderBuilt(providerHashCode, singletonServices, scopedServices, transientServices); + ServiceProviderBuilt(providerHashCode, singletonServices, scopedServices, transientServices, closedGenericsServices, openGenericsServices); string descriptorString = descriptorBuilder.ToString(); int chunkCount = descriptorString.Length / MaxChunkSize + (descriptorString.Length % MaxChunkSize > 0 ? 1 : 0); diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/Microsoft.Extensions.DependencyInjection.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/src/Microsoft.Extensions.DependencyInjection.csproj index 7ee51306d042d5..2f840f92672d6b 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/src/Microsoft.Extensions.DependencyInjection.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/src/Microsoft.Extensions.DependencyInjection.csproj @@ -10,13 +10,14 @@ Default implementation of dependency injection for Microsoft.Extensions.DependencyInjection. false + 1 - + True $(DefineConstants);IL_EMIT - $(DefineConstants);SAVE_ASSEMBLIES + $(DefineConstants);SAVE_ASSEMBLIES @@ -36,7 +37,7 @@ - + @@ -46,7 +47,7 @@ - + diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceProviderEngineScope.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceProviderEngineScope.cs index 4ad8b1579a0290..400b38c5d0833d 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceProviderEngineScope.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/ServiceProviderEngineScope.cs @@ -185,12 +185,20 @@ private List BeginDispose() // No further changes to _state.Disposables, are allowed. _disposed = true; - // ResolvedServices is never cleared for singletons because there might be a compilation running in background - // trying to get a cached singleton service. If it doesn't find it - // it will try to create a new one which will result in an ObjectDisposedException. + } - return _disposables; + if (IsRootScope && !RootProvider.IsDisposed()) + { + // If this ServiceProviderEngineScope instance is a root scope, disposing this instance will need to dispose the RootProvider too. + // Otherwise the RootProvider will never get disposed and will leak. + // Note, if the RootProvider get disposed first, it will automatically dispose all attached ServiceProviderEngineScope objects. + RootProvider.Dispose(); } + + // ResolvedServices is never cleared for singletons because there might be a compilation running in background + // trying to get a cached singleton service. If it doesn't find it + // it will try to create a new one which will result in an ObjectDisposedException. + return _disposables; } } } diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceProvider.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceProvider.cs index db1c1e72e93497..21a9b67c1511b9 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceProvider.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceProvider.cs @@ -85,6 +85,8 @@ internal ServiceProvider(ICollection serviceDescriptors, Serv /// The service that was produced. public object GetService(Type serviceType) => GetService(serviceType, Root); + internal bool IsDisposed() => _disposed; + /// public void Dispose() { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/DependencyInjectionEventSourceTests.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/DependencyInjectionEventSourceTests.cs index 11d8ae91570ecc..deaaba56b47fd2 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/DependencyInjectionEventSourceTests.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/DependencyInjectionEventSourceTests.cs @@ -241,14 +241,18 @@ public void EmitsServiceProviderBuilt() serviceCollection.AddScoped(); serviceCollection.AddTransient(); serviceCollection.AddSingleton(); + serviceCollection.AddScoped(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>)); + serviceCollection.AddTransient, FakeOpenGenericService>(); using ServiceProvider provider = serviceCollection.BuildServiceProvider(); EventWrittenEventArgs serviceProviderBuiltEvent = _listener.EventData.Single(e => e.EventName == "ServiceProviderBuilt"); GetProperty(serviceProviderBuiltEvent, "serviceProviderHashCode"); // assert hashcode exists as an int Assert.Equal(4, GetProperty(serviceProviderBuiltEvent, "singletonServices")); - Assert.Equal(1, GetProperty(serviceProviderBuiltEvent, "scopedServices")); - Assert.Equal(2, GetProperty(serviceProviderBuiltEvent, "transientServices")); + Assert.Equal(2, GetProperty(serviceProviderBuiltEvent, "scopedServices")); + Assert.Equal(3, GetProperty(serviceProviderBuiltEvent, "transientServices")); + Assert.Equal(1, GetProperty(serviceProviderBuiltEvent, "closedGenericsServices")); + Assert.Equal(1, GetProperty(serviceProviderBuiltEvent, "openGenericsServices")); Assert.Equal(7, serviceProviderBuiltEvent.EventId); EventWrittenEventArgs serviceProviderDescriptorsEvent = _listener.EventData.Single(e => e.EventName == "ServiceProviderDescriptors"); @@ -290,6 +294,16 @@ public void EmitsServiceProviderBuilt() " \"serviceType\": \"Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService\",", " \"lifetime\": \"Singleton\",", " \"implementationType\": \"Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeDisposableCallbackInnerService\"", + " },", + " {", + " \"serviceType\": \"Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService`1[TValue]\",", + " \"lifetime\": \"Scoped\",", + " \"implementationType\": \"Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeOpenGenericService`1[TVal]\"", + " },", + " {", + " \"serviceType\": \"Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService`1[Microsoft.Extensions.DependencyInjection.Specification.Fakes.PocoClass]\",", + " \"lifetime\": \"Transient\",", + " \"implementationType\": \"Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeOpenGenericService`1[Microsoft.Extensions.DependencyInjection.Specification.Fakes.PocoClass]\"", " }", " ]", "}"), diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceProviderEngineScopeTests.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceProviderEngineScopeTests.cs index d43752db21eba7..e801497236f0b9 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceProviderEngineScopeTests.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceProviderEngineScopeTests.cs @@ -1,6 +1,7 @@ // 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 Microsoft.Extensions.DependencyInjection.Specification.Fakes; using Xunit; @@ -17,5 +18,16 @@ public void DoubleDisposeWorks() serviceProviderEngineScope.Dispose(); serviceProviderEngineScope.Dispose(); } + + [Fact] + public void RootEngineScopeDisposeTest() + { + var services = new ServiceCollection(); + ServiceProvider sp = services.BuildServiceProvider(); + var s = sp.GetRequiredService(); + ((IDisposable)s).Dispose(); + + Assert.Throws(() => sp.GetRequiredService()); + } } } diff --git a/src/libraries/Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.sln b/src/libraries/Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.sln index 6510d1b3940139..b59269c9e27155 100644 --- a/src/libraries/Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.sln +++ b/src/libraries/Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.sln @@ -19,8 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{7902A0CA-E94D-4C96-A112-455A1E5E2390}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{6699E51A-8DC5-4DBA-A06B-B4A04144E4FA}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{FA7201FE-097D-4197-BDEC-329986814D8D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{50BA55F5-BD05-4C05-910F-2BFD20BD3465}" @@ -67,10 +65,6 @@ Global {4A28B457-D950-486B-B59B-A4C977A733B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {4A28B457-D950-486B-B59B-A4C977A733B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {4A28B457-D950-486B-B59B-A4C977A733B1}.Release|Any CPU.Build.0 = Release|Any CPU - {6699E51A-8DC5-4DBA-A06B-B4A04144E4FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6699E51A-8DC5-4DBA-A06B-B4A04144E4FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6699E51A-8DC5-4DBA-A06B-B4A04144E4FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6699E51A-8DC5-4DBA-A06B-B4A04144E4FA}.Release|Any CPU.Build.0 = Release|Any CPU {F38E2965-8DBB-4795-89AF-C0109EB23574}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F38E2965-8DBB-4795-89AF-C0109EB23574}.Debug|Any CPU.Build.0 = Debug|Any CPU {F38E2965-8DBB-4795-89AF-C0109EB23574}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -98,7 +92,6 @@ Global {FA7201FE-097D-4197-BDEC-329986814D8D} = {5725D7DF-DC33-47D2-90C9-D8736C579E77} {7902A0CA-E94D-4C96-A112-455A1E5E2390} = {5725D7DF-DC33-47D2-90C9-D8736C579E77} {4A28B457-D950-486B-B59B-A4C977A733B1} = {5725D7DF-DC33-47D2-90C9-D8736C579E77} - {6699E51A-8DC5-4DBA-A06B-B4A04144E4FA} = {5725D7DF-DC33-47D2-90C9-D8736C579E77} {2AED2951-7724-4EFC-8E16-6DF877C6B4A6} = {5725D7DF-DC33-47D2-90C9-D8736C579E77} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/libraries/Microsoft.Extensions.DependencyModel/tests/DependencyContextJsonWriterTests.cs b/src/libraries/Microsoft.Extensions.DependencyModel/tests/DependencyContextJsonWriterTests.cs index 50f6bbdd54642b..4da13c18b432d8 100644 --- a/src/libraries/Microsoft.Extensions.DependencyModel/tests/DependencyContextJsonWriterTests.cs +++ b/src/libraries/Microsoft.Extensions.DependencyModel/tests/DependencyContextJsonWriterTests.cs @@ -23,7 +23,7 @@ public JObject Save(DependencyContext dependencyContext) { using (var textReader = new StreamReader(readStream)) { - using (var reader = new JsonTextReader(textReader)) + using (var reader = new JsonTextReader(textReader) { MaxDepth = null }) { return JObject.Load(reader); } diff --git a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs index de58daa3906d4e..63855745dbffe6 100644 --- a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs +++ b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs @@ -162,8 +162,8 @@ internal PhysicalFilesWatcher CreateFileWatcher() FileSystemWatcher watcher; #if NETCOREAPP - // For browser we will proactively fallback to polling since FileSystemWatcher is not supported. - if (OperatingSystem.IsBrowser()) + // For browser/iOS/tvOS we will proactively fallback to polling since FileSystemWatcher is not supported. + if (OperatingSystem.IsBrowser() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) { UsePollingFileWatcher = true; UseActivePolling = true; diff --git a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs index 81df7c51532bf3..21d1ed8deedc11 100644 --- a/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs +++ b/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs @@ -90,7 +90,7 @@ public PhysicalFilesWatcher( if (fileSystemWatcher != null) { #if NETCOREAPP - if (OperatingSystem.IsBrowser()) + if (OperatingSystem.IsBrowser() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) { throw new PlatformNotSupportedException(SR.Format(SR.FileSystemWatcher_PlatformNotSupported, typeof(FileSystemWatcher))); } @@ -148,7 +148,7 @@ public IChangeToken CreateFileChangeToken(string filter) } IChangeToken changeToken = GetOrAddChangeToken(filter); -// We made sure that browser never uses FileSystemWatcher. +// We made sure that browser/iOS/tvOS never uses FileSystemWatcher. #pragma warning disable CA1416 // Validate platform compatibility TryEnableFileSystemWatcher(); #pragma warning restore CA1416 // Validate platform compatibility @@ -276,6 +276,9 @@ protected virtual void Dispose(bool disposing) } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] private void OnRenamed(object sender, RenamedEventArgs e) { // For a file name change or a directory's name change notify registered tokens. @@ -309,12 +312,18 @@ ex is DirectoryNotFoundException || } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] private void OnChanged(object sender, FileSystemEventArgs e) { OnFileSystemEntryChange(e.FullPath); } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] private void OnError(object sender, ErrorEventArgs e) { // Notify all cache entries on error. @@ -325,6 +334,9 @@ private void OnError(object sender, ErrorEventArgs e) } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] private void OnFileSystemEntryChange(string fullPath) { try @@ -348,6 +360,9 @@ ex is SecurityException || } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] private void ReportChangeForMatchedEntries(string path) { if (string.IsNullOrEmpty(path)) @@ -385,6 +400,9 @@ private void ReportChangeForMatchedEntries(string path) } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] private void TryDisableFileSystemWatcher() { if (_fileWatcher != null) @@ -403,6 +421,9 @@ private void TryDisableFileSystemWatcher() } [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] private void TryEnableFileSystemWatcher() { if (_fileWatcher != null) diff --git a/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFileProviderTests.cs b/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFileProviderTests.cs index e1480ab8686b4d..4aa57114fcdc69 100644 --- a/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFileProviderTests.cs +++ b/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFileProviderTests.cs @@ -137,7 +137,7 @@ public void PollingFileProviderShouldntConsumeINotifyInstances() } } } - + private void GetFileInfoReturnsNotFoundFileInfoForIllegalPathWithLeadingSlashes(string path) { using (var provider = new PhysicalFileProvider(Path.GetTempPath())) @@ -325,7 +325,7 @@ public void GetFileInfoReturnsFileInfoWhenExclusionDisabled() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "Browser always uses Active Polling which doesn't return the same instance between multiple calls to Watch(string)")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "Browser/iOS/tvOS always uses Active Polling which doesn't return the same instance between multiple calls to Watch(string)")] public void TokenIsSameForSamePath() { using (var root = new DisposableFileSystem()) @@ -349,7 +349,7 @@ public void TokenIsSameForSamePath() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokensFiredOnFileChange() { using (var root = new DisposableFileSystem()) @@ -380,7 +380,7 @@ public async Task TokensFiredOnFileChange() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokenCallbackInvokedOnFileChange() { using (var root = new DisposableFileSystem()) @@ -417,7 +417,7 @@ public async Task TokenCallbackInvokedOnFileChange() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task WatcherWithPolling_ReturnsTrueForFileChangedWhenFileSystemWatcherDoesNotRaiseEvents() { using (var root = new DisposableFileSystem()) @@ -448,7 +448,7 @@ public async Task WatcherWithPolling_ReturnsTrueForFileChangedWhenFileSystemWatc [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task WatcherWithPolling_ReturnsTrueForFileRemovedWhenFileSystemWatcherDoesNotRaiseEvents() { using (var root = new DisposableFileSystem()) @@ -481,7 +481,7 @@ public async Task WatcherWithPolling_ReturnsTrueForFileRemovedWhenFileSystemWatc [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokensFiredOnFileDeleted() { using (var root = new DisposableFileSystem()) @@ -793,7 +793,7 @@ public void GetDirectoryContentsReturnsFilesWhenExclusionDisabled() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task FileChangeTokenNotNotifiedAfterExpiry() { using (var root = new DisposableFileSystem()) @@ -826,7 +826,7 @@ public async Task FileChangeTokenNotNotifiedAfterExpiry() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "Browser always uses Active Polling which doesn't return the same instance between multiple calls to Watch(string)")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "Browser/iOS/tvOS always uses Active Polling which doesn't return the same instance between multiple calls to Watch(string)")] public void TokenIsSameForSamePathCaseInsensitive() { using (var root = new DisposableFileSystem()) @@ -843,7 +843,7 @@ public void TokenIsSameForSamePathCaseInsensitive() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task CorrectTokensFiredForMultipleFiles() { using (var root = new DisposableFileSystem()) @@ -877,7 +877,7 @@ public async Task CorrectTokensFiredForMultipleFiles() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokenNotAffectedByExceptions() { using (var root = new DisposableFileSystem()) @@ -936,6 +936,7 @@ public void NoopChangeTokenForFilterThatNavigatesAboveRoot() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/58584", TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS)] public void TokenForEmptyFilter() { using (var root = new DisposableFileSystem()) @@ -985,7 +986,7 @@ public void NoopChangeTokenForAbsolutePathFilters() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokenFiredOnCreation() { using (var root = new DisposableFileSystem()) @@ -1011,7 +1012,7 @@ public async Task TokenFiredOnCreation() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokenFiredOnDeletion() { using (var root = new DisposableFileSystem()) @@ -1037,7 +1038,7 @@ public async Task TokenFiredOnDeletion() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokenFiredForFilesUnderPathEndingWithSlash() { using (var root = new DisposableFileSystem()) @@ -1092,7 +1093,7 @@ public async Task TokenFiredForRelativePathStartingWithSlash_Windows(string slas [InlineData("///")] // Testing Unix specific behaviour on leading slashes. [PlatformSpecific(TestPlatforms.AnyUnix)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokenFiredForRelativePathStartingWithSlash_Unix(string slashes) { await TokenFiredForRelativePathStartingWithSlash(slashes); @@ -1135,7 +1136,7 @@ public async Task TokenNotFiredForInvalidPathStartingWithSlash_Windows(string sl [InlineData("/\0/")] // Testing Unix specific behaviour on leading slashes. [PlatformSpecific(TestPlatforms.AnyUnix)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokenNotFiredForInvalidPathStartingWithSlash_Unix(string slashes) { await TokenNotFiredForInvalidPathStartingWithSlash(slashes); @@ -1167,7 +1168,7 @@ private async Task TokenNotFiredForInvalidPathStartingWithSlash(string slashes) [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokenFiredForGlobbingPatternsPointingToSubDirectory() { using (var root = new DisposableFileSystem()) @@ -1201,7 +1202,7 @@ public async Task TokenFiredForGlobbingPatternsPointingToSubDirectory() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "Browser always uses Active Polling which doesn't return the same instance between multiple calls to Watch(string)")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "Browser/iOS/tvOS always uses Active Polling which doesn't return the same instance between multiple calls to Watch(string)")] public void TokensWithForwardAndBackwardSlashesAreSame() { using (var root = new DisposableFileSystem()) @@ -1218,7 +1219,7 @@ public void TokensWithForwardAndBackwardSlashesAreSame() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokensFiredForOldAndNewNamesOnRename() { using (var root = new DisposableFileSystem()) @@ -1248,7 +1249,7 @@ public async Task TokensFiredForOldAndNewNamesOnRename() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokensFiredForNewDirectoryContentsOnRename() { var tcsShouldNotFire = new TaskCompletionSource(); @@ -1322,7 +1323,7 @@ void Fail(object state) [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokenNotFiredForFileNameStartingWithPeriod() { using (var root = new DisposableFileSystem()) @@ -1390,7 +1391,7 @@ public async Task TokensNotFiredForHiddenAndSystemFiles() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task TokensFiredForAllEntriesOnError() { using (var root = new DisposableFileSystem()) @@ -1419,7 +1420,7 @@ public async Task TokensFiredForAllEntriesOnError() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task WildCardToken_RaisesEventsForNewFilesAdded() { // Arrange @@ -1446,7 +1447,7 @@ public async Task WildCardToken_RaisesEventsForNewFilesAdded() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task WildCardToken_RaisesEventsWhenFileSystemWatcherDoesNotFire() { // Arrange @@ -1496,7 +1497,7 @@ public void UsePollingFileWatcher_FileWatcherNull_SetsSuccessfully() } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public void UsePollingFileWatcher_FileWatcherNotNull_SetterThrows() { // Arrange @@ -1517,7 +1518,7 @@ public void UsePollingFileWatcher_FileWatcherNotNull_SetterThrows() } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public void UsePollingFileWatcher_FileWatcherNotNull_ReturnsFalse() { // Arrange @@ -1618,7 +1619,7 @@ public void CreateFileWatcher_CreatesWatcherWithPollingAndActiveFlags() [InlineData(false)] [InlineData(true)] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task CanDeleteWatchedDirectory(bool useActivePolling) { using (var root = new DisposableFileSystem()) diff --git a/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFilesWatcherTests.cs b/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFilesWatcherTests.cs index 2e48a7cb0c0f70..fed678475f8e8d 100644 --- a/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFilesWatcherTests.cs +++ b/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFilesWatcherTests.cs @@ -18,7 +18,7 @@ public class PhysicalFilesWatcherTests private const int WaitTimeForTokenToFire = 500; [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public void CreateFileChangeToken_DoesNotAllowPathsAboveRoot() { using (var root = new DisposableFileSystem()) @@ -38,7 +38,7 @@ public void CreateFileChangeToken_DoesNotAllowPathsAboveRoot() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public async Task HandlesOnRenamedEventsThatMatchRootPath() { using (var root = new DisposableFileSystem()) @@ -131,7 +131,7 @@ public void RaiseChangeEvents_CancelsAndRemovesMultipleChangedTokens() } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public void GetOrAddFilePathChangeToken_AddsPollingChangeTokenWithCancellationToken_WhenActiveCallbackIsTrue() { using (var root = new DisposableFileSystem()) @@ -158,7 +158,7 @@ public void GetOrAddFilePathChangeToken_AddsPollingChangeTokenWithCancellationTo } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public void GetOrAddFilePathChangeToken_AddsPollingChangeTokenWhenPollingIsEnabled() { using (var root = new DisposableFileSystem()) @@ -183,7 +183,7 @@ public void GetOrAddFilePathChangeToken_AddsPollingChangeTokenWhenPollingIsEnabl } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public void GetOrAddFilePathChangeToken_DoesNotAddsPollingChangeTokenWhenCallbackIsDisabled() { using (var root = new DisposableFileSystem()) @@ -198,7 +198,7 @@ public void GetOrAddFilePathChangeToken_DoesNotAddsPollingChangeTokenWhenCallbac } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] public void GetOrAddWildcardChangeToken_AddsPollingChangeTokenWithCancellationToken_WhenActiveCallbackIsTrue() { using (var root = new DisposableFileSystem()) diff --git a/src/libraries/Microsoft.Extensions.HostFactoryResolver/src/HostFactoryResolver.cs b/src/libraries/Microsoft.Extensions.HostFactoryResolver/src/HostFactoryResolver.cs index 49ef8b69517309..ec4335d5f5343b 100644 --- a/src/libraries/Microsoft.Extensions.HostFactoryResolver/src/HostFactoryResolver.cs +++ b/src/libraries/Microsoft.Extensions.HostFactoryResolver/src/HostFactoryResolver.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -19,9 +20,25 @@ internal sealed class HostFactoryResolver public const string BuildWebHost = nameof(BuildWebHost); public const string CreateWebHostBuilder = nameof(CreateWebHostBuilder); public const string CreateHostBuilder = nameof(CreateHostBuilder); + private const string TimeoutEnvironmentKey = "DOTNET_HOST_FACTORY_RESOLVER_DEFAULT_TIMEOUT_IN_SECONDS"; // The amount of time we wait for the diagnostic source events to fire - private static readonly TimeSpan s_defaultWaitTimeout = Debugger.IsAttached ? Timeout.InfiniteTimeSpan : TimeSpan.FromSeconds(5); + private static readonly TimeSpan s_defaultWaitTimeout = SetupDefaultTimout(); + + private static TimeSpan SetupDefaultTimout() + { + if (Debugger.IsAttached) + { + return Timeout.InfiniteTimeSpan; + } + + if (uint.TryParse(Environment.GetEnvironmentVariable(TimeoutEnvironmentKey), out uint timeoutInSeconds)) + { + return TimeSpan.FromSeconds((int)timeoutInSeconds); + } + + return TimeSpan.FromMinutes(5); + } public static Func? ResolveWebHostFactory(Assembly assembly) { @@ -144,6 +161,14 @@ private static bool IsFactory(MethodInfo? factory) { return args => { + static bool IsApplicationNameArg(string arg) + => arg.Equals("--applicationName", StringComparison.OrdinalIgnoreCase) || + arg.Equals("/applicationName", StringComparison.OrdinalIgnoreCase); + + args = args.Any(arg => IsApplicationNameArg(arg)) || assembly.FullName is null + ? args + : args.Concat(new[] { "--applicationName", assembly.FullName }).ToArray(); + var host = hostFactory(args); return GetServiceProvider(host); }; @@ -220,7 +245,7 @@ public object CreateHost() // Try to set an exception if the entry point returns gracefully, this will force // build to throw - _hostTcs.TrySetException(new InvalidOperationException("Unable to build IHost")); + _hostTcs.TrySetException(new InvalidOperationException("The entry point exited without ever building an IHost.")); } catch (TargetInvocationException tie) when (tie.InnerException is StopTheHostException) { @@ -259,7 +284,7 @@ public object CreateHost() // Wait before throwing an exception if (!_hostTcs.Task.Wait(_waitTimeout)) { - throw new InvalidOperationException("Unable to build IHost"); + throw new InvalidOperationException($"Timed out waiting for the entry point to build the IHost after {s_defaultWaitTimeout}. This timeout can be modified using the '{TimeoutEnvironmentKey}' environment variable."); } } catch (AggregateException) when (_hostTcs.Task.IsCompleted) diff --git a/src/libraries/Microsoft.Extensions.HostFactoryResolver/src/Microsoft.Extensions.HostFactoryResolver.Sources.csproj b/src/libraries/Microsoft.Extensions.HostFactoryResolver/src/Microsoft.Extensions.HostFactoryResolver.Sources.csproj index 31cd86025ee019..9d328fb100d1ad 100644 --- a/src/libraries/Microsoft.Extensions.HostFactoryResolver/src/Microsoft.Extensions.HostFactoryResolver.Sources.csproj +++ b/src/libraries/Microsoft.Extensions.HostFactoryResolver/src/Microsoft.Extensions.HostFactoryResolver.Sources.csproj @@ -9,6 +9,7 @@ true true + 1 Internal package for sharing Microsoft.Extensions.Hosting.HostFactoryResolver type. diff --git a/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/ApplicationNameSetFromAgrument/ApplicationNameSetFromAgrument.csproj b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/ApplicationNameSetFromAgrument/ApplicationNameSetFromAgrument.csproj new file mode 100644 index 00000000000000..716b25a87281da --- /dev/null +++ b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/ApplicationNameSetFromAgrument/ApplicationNameSetFromAgrument.csproj @@ -0,0 +1,13 @@ + + + + $(NetCoreAppCurrent);net461 + true + Exe + + + + + + + diff --git a/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/ApplicationNameSetFromAgrument/Program.cs b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/ApplicationNameSetFromAgrument/Program.cs new file mode 100644 index 00000000000000..f83f5c12af7966 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/ApplicationNameSetFromAgrument/Program.cs @@ -0,0 +1,8 @@ +// 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 Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; + +var host = new HostBuilder().ConfigureAppConfiguration(builder => builder.AddCommandLine(args)).Build(); \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/HostFactoryResolverTests.cs b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/HostFactoryResolverTests.cs index 8f6cf79de0bf3e..d6cf530c94e93a 100644 --- a/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/HostFactoryResolverTests.cs +++ b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/HostFactoryResolverTests.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.Extensions.Configuration; using MockHostTypes; using System; using System.Diagnostics.CodeAnalysis; @@ -252,6 +253,27 @@ public void TopLevelStatements() Assert.IsAssignableFrom(factory(Array.Empty())); } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + public void TopLevelStatementsTestsTimeout() + { + var assembly = Assembly.Load("TopLevelStatementsTestsTimeout"); + var factory = HostFactoryResolver.ResolveServiceProviderFactory(assembly, s_WaitTimeout); + + Assert.NotNull(factory); + Assert.Throws(() => factory(Array.Empty())); + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + public void ApplicationNameSetFromAgrument() + { + Assembly assembly = Assembly.Load("ApplicationNameSetFromAgrument"); + var factory = HostFactoryResolver.ResolveServiceProviderFactory(assembly, s_WaitTimeout); + IServiceProvider? serviceProvider = factory(Array.Empty()); + + var configuration = (IConfiguration)serviceProvider.GetService(typeof(IConfiguration)); + Assert.Contains("ApplicationNameSetFromAgrument", configuration["applicationName"]); + } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(NoSpecialEntryPointPattern.Program))] public void NoSpecialEntryPointPatternCanRunInParallel() diff --git a/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/Microsoft.Extensions.HostFactoryResolver.Tests.csproj b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/Microsoft.Extensions.HostFactoryResolver.Tests.csproj index dc808c40b7cc99..fe811f1fe1b5df 100644 --- a/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/Microsoft.Extensions.HostFactoryResolver.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/Microsoft.Extensions.HostFactoryResolver.Tests.csproj @@ -14,6 +14,7 @@ + @@ -27,6 +28,7 @@ + diff --git a/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/TopLevelStatementsTestsTimeout/Program.cs b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/TopLevelStatementsTestsTimeout/Program.cs new file mode 100644 index 00000000000000..f4c01882987e12 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/TopLevelStatementsTestsTimeout/Program.cs @@ -0,0 +1,10 @@ +// 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.Threading; +using Microsoft.Extensions.Hosting; + +var hostBuilder = new HostBuilder(); +Thread.Sleep(TimeSpan.FromSeconds(30)); +hostBuilder.Build(); \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/TopLevelStatementsTestsTimeout/TopLevelStatementsTestsTimeout.csproj b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/TopLevelStatementsTestsTimeout/TopLevelStatementsTestsTimeout.csproj new file mode 100644 index 00000000000000..716b25a87281da --- /dev/null +++ b/src/libraries/Microsoft.Extensions.HostFactoryResolver/tests/TopLevelStatementsTestsTimeout/TopLevelStatementsTestsTimeout.csproj @@ -0,0 +1,13 @@ + + + + $(NetCoreAppCurrent);net461 + true + Exe + + + + + + + diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/Microsoft.Extensions.Hosting.Systemd.sln b/src/libraries/Microsoft.Extensions.Hosting.Systemd/Microsoft.Extensions.Hosting.Systemd.sln index 4d180d0e8e5926..fad399ab4ffd49 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/Microsoft.Extensions.Hosting.Systemd.sln +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/Microsoft.Extensions.Hosting.Systemd.sln @@ -71,8 +71,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hostin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hosting", "..\Microsoft.Extensions.Hosting\src\Microsoft.Extensions.Hosting.csproj", "{AFC1BDAA-7E40-4118-BB80-F8057752A600}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{21A8F1A2-DB8F-40BB-8B41-34FFBFF678BE}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{860B845B-929F-4442-AED1-1F4186DBF497}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{A0AF82AE-ED18-4EEB-AD9A-B44017510F0C}" @@ -131,8 +129,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{47A3CDB0-8252-4536-B61F-C2E10F6EC2B9}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{CA49BE02-D809-4F18-8E0B-54FA365429E3}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{25474DE2-4D3D-4950-BDA7-CF6FE3CCD940}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Threading.AccessControl", "..\System.Threading.AccessControl\ref\System.Threading.AccessControl.csproj", "{6061433D-2A71-47B3-B34B-3EDF523ABB78}" @@ -397,10 +393,6 @@ Global {1A3EF133-CC86-4CC9-BBB8-333D41563AC3}.Debug|Any CPU.Build.0 = Debug|Any CPU {1A3EF133-CC86-4CC9-BBB8-333D41563AC3}.Release|Any CPU.ActiveCfg = Release|Any CPU {1A3EF133-CC86-4CC9-BBB8-333D41563AC3}.Release|Any CPU.Build.0 = Release|Any CPU - {CA49BE02-D809-4F18-8E0B-54FA365429E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CA49BE02-D809-4F18-8E0B-54FA365429E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CA49BE02-D809-4F18-8E0B-54FA365429E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CA49BE02-D809-4F18-8E0B-54FA365429E3}.Release|Any CPU.Build.0 = Release|Any CPU {47A3CDB0-8252-4536-B61F-C2E10F6EC2B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {47A3CDB0-8252-4536-B61F-C2E10F6EC2B9}.Debug|Any CPU.Build.0 = Debug|Any CPU {47A3CDB0-8252-4536-B61F-C2E10F6EC2B9}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -509,7 +501,6 @@ Global {3488D63C-0C29-442C-8145-407DE19C7480} = {192FD259-E55F-40C5-82EE-9E924EA6C3CB} {2E027B76-275A-4FCE-9774-A2F8C3CD0C7E} = {192FD259-E55F-40C5-82EE-9E924EA6C3CB} {578661A4-C136-4533-819E-AF3352F79953} = {192FD259-E55F-40C5-82EE-9E924EA6C3CB} - {CA49BE02-D809-4F18-8E0B-54FA365429E3} = {192FD259-E55F-40C5-82EE-9E924EA6C3CB} {47A3CDB0-8252-4536-B61F-C2E10F6EC2B9} = {192FD259-E55F-40C5-82EE-9E924EA6C3CB} {C1ACBD81-9577-483B-8E33-819F1313114A} = {192FD259-E55F-40C5-82EE-9E924EA6C3CB} {01DB5E6D-40C5-42F7-8F9D-6F8DBC591129} = {192FD259-E55F-40C5-82EE-9E924EA6C3CB} diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/Directory.Build.props b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/Directory.Build.props index 899ad9d38a52d6..3d31843054e721 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/Directory.Build.props +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/Directory.Build.props @@ -2,6 +2,5 @@ hosting - windows diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/Microsoft.Extensions.Hosting.WindowsServices.sln b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/Microsoft.Extensions.Hosting.WindowsServices.sln index d044381432e722..b07fcf11887c4b 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/Microsoft.Extensions.Hosting.WindowsServices.sln +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/Microsoft.Extensions.Hosting.WindowsServices.sln @@ -67,8 +67,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hostin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hosting", "..\Microsoft.Extensions.Hosting\src\Microsoft.Extensions.Hosting.csproj", "{36FAE390-EAAE-4193-98E7-34F10D3FA8E1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{9CECED3B-385A-4C54-9E07-74E8341EB52D}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{723957C4-C433-4B6D-BF0C-28AE36AEDDBD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{E5F61C36-FB9B-4DA7-96C0-056FBEADBB53}" @@ -131,8 +129,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.ServiceProcess.Servi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{2D8B86CE-7A3A-45F0-9127-AE6CDCEC6EA5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{CC36DF9A-6602-47D9-B44B-C2D2C33A80D0}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{C50BBD27-2445-4DF4-9A1D-C7919D016BBC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Threading.AccessControl", "..\System.Threading.AccessControl\ref\System.Threading.AccessControl.csproj", "{B7ACDBBE-C64B-482B-B80D-3DC002AD450B}" @@ -419,10 +415,6 @@ Global {B7ACDBBE-C64B-482B-B80D-3DC002AD450B}.Debug|Any CPU.Build.0 = Debug|Any CPU {B7ACDBBE-C64B-482B-B80D-3DC002AD450B}.Release|Any CPU.ActiveCfg = Release|Any CPU {B7ACDBBE-C64B-482B-B80D-3DC002AD450B}.Release|Any CPU.Build.0 = Release|Any CPU - {CC36DF9A-6602-47D9-B44B-C2D2C33A80D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CC36DF9A-6602-47D9-B44B-C2D2C33A80D0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CC36DF9A-6602-47D9-B44B-C2D2C33A80D0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CC36DF9A-6602-47D9-B44B-C2D2C33A80D0}.Release|Any CPU.Build.0 = Release|Any CPU {2D8B86CE-7A3A-45F0-9127-AE6CDCEC6EA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2D8B86CE-7A3A-45F0-9127-AE6CDCEC6EA5}.Debug|Any CPU.Build.0 = Debug|Any CPU {2D8B86CE-7A3A-45F0-9127-AE6CDCEC6EA5}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -509,7 +501,6 @@ Global {C50BBD27-2445-4DF4-9A1D-C7919D016BBC} = {76933DF1-12AA-4B5B-8863-EF38F10B1EC9} {83D8F9FB-0A8D-4E48-A7CF-D169432A41AD} = {76933DF1-12AA-4B5B-8863-EF38F10B1EC9} {BAE78100-3020-4AAE-BDBF-ACF9D1D1BA2F} = {76933DF1-12AA-4B5B-8863-EF38F10B1EC9} - {CC36DF9A-6602-47D9-B44B-C2D2C33A80D0} = {76933DF1-12AA-4B5B-8863-EF38F10B1EC9} {2D8B86CE-7A3A-45F0-9127-AE6CDCEC6EA5} = {76933DF1-12AA-4B5B-8863-EF38F10B1EC9} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/Microsoft.Extensions.Hosting.WindowsServices.csproj b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/Microsoft.Extensions.Hosting.WindowsServices.csproj index 243e7948567867..052c68ff8b2d99 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/Microsoft.Extensions.Hosting.WindowsServices.csproj +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/Microsoft.Extensions.Hosting.WindowsServices.csproj @@ -4,6 +4,8 @@ net461;netstandard2.0;netstandard2.1 true .NET hosting infrastructure for Windows Services. + false + 2 diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceHelpers.cs b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceHelpers.cs index d19cdd01aab779..3fbc939eebde0d 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceHelpers.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceHelpers.cs @@ -27,7 +27,7 @@ public static bool IsWindowsService() { return false; } - return parent.SessionId == 0 && string.Equals("services", parent.ProcessName, StringComparison.OrdinalIgnoreCase); + return string.Equals("services", parent.ProcessName, StringComparison.OrdinalIgnoreCase); } } } \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs index f374e3f0f7132b..6f76ab3975bd37 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/src/WindowsServiceLifetime.cs @@ -13,8 +13,10 @@ namespace Microsoft.Extensions.Hosting.WindowsServices public class WindowsServiceLifetime : ServiceBase, IHostLifetime { private readonly TaskCompletionSource _delayStart = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + private readonly TaskCompletionSource _serviceDispatcherStopped = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); private readonly ManualResetEventSlim _delayStop = new ManualResetEventSlim(); private readonly HostOptions _hostOptions; + private bool _serviceStopRequested; public WindowsServiceLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory, IOptions optionsAccessor) : this(environment, applicationLifetime, loggerFactory, optionsAccessor, Options.Options.Create(new WindowsServiceLifetimeOptions())) @@ -73,19 +75,30 @@ private void Run() { Run(this); // This blocks until the service is stopped. _delayStart.TrySetException(new InvalidOperationException("Stopped without starting")); + _serviceDispatcherStopped.TrySetResult(null); } catch (Exception ex) { _delayStart.TrySetException(ex); + _serviceDispatcherStopped.TrySetException(ex); } } - public Task StopAsync(CancellationToken cancellationToken) + /// + /// Called from to stop the service if not already stopped, and wait for the service dispatcher to exit. + /// Once this method returns the service is stopped and the process can be terminated at any time. + /// + public async Task StopAsync(CancellationToken cancellationToken) { - // Avoid deadlock where host waits for StopAsync before firing ApplicationStopped, - // and Stop waits for ApplicationStopped. - Task.Run(Stop, CancellationToken.None); - return Task.CompletedTask; + cancellationToken.ThrowIfCancellationRequested(); + + if (!_serviceStopRequested) + { + await Task.Run(Stop, cancellationToken).ConfigureAwait(false); + } + + // When the underlying service is stopped this will cause the ServiceBase.Run method to complete and return, which completes _serviceDispatcherStopped. + await _serviceDispatcherStopped.Task.ConfigureAwait(false); } // Called by base.Run when the service is ready to start. @@ -95,18 +108,28 @@ protected override void OnStart(string[] args) base.OnStart(args); } - // Called by base.Stop. This may be called multiple times by service Stop, ApplicationStopping, and StopAsync. - // That's OK because StopApplication uses a CancellationTokenSource and prevents any recursion. + /// + /// Executes when a Stop command is sent to the service by the Service Control Manager (SCM). + /// Triggers and waits for . + /// Shortly after this method returns, the Service will be marked as stopped in SCM and the process may exit at any point. + /// protected override void OnStop() { + _serviceStopRequested = true; ApplicationLifetime.StopApplication(); // Wait for the host to shutdown before marking service as stopped. _delayStop.Wait(_hostOptions.ShutdownTimeout); base.OnStop(); } + /// + /// Executes when a Shutdown command is sent to the service by the Service Control Manager (SCM). + /// Triggers and waits for . + /// Shortly after this method returns, the Service will be marked as stopped in SCM and the process may exit at any point. + /// protected override void OnShutdown() { + _serviceStopRequested = true; ApplicationLifetime.StopApplication(); // Wait for the host to shutdown before marking service as stopped. _delayStop.Wait(_hostOptions.ShutdownTimeout); diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/Microsoft.Extensions.Hosting.WindowsServices.Tests.csproj b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/Microsoft.Extensions.Hosting.WindowsServices.Tests.csproj index 67b1cb31ee5212..bbbcfb8bee9645 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/Microsoft.Extensions.Hosting.WindowsServices.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/Microsoft.Extensions.Hosting.WindowsServices.Tests.csproj @@ -1,12 +1,46 @@ - + - $(NetCoreAppCurrent);net461 + + $(NetCoreAppCurrent)-windows;net461 true + true + true + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/UseWindowsServiceTests.cs b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/UseWindowsServiceTests.cs index 7e24685466d913..aec72dbdb27fe0 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/UseWindowsServiceTests.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/UseWindowsServiceTests.cs @@ -1,14 +1,24 @@ // 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.Reflection; +using System.ServiceProcess; +using Microsoft.DotNet.RemoteExecutor; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting.Internal; +using Microsoft.Extensions.Hosting.WindowsServices; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.EventLog; +using Microsoft.Extensions.Options; using Xunit; namespace Microsoft.Extensions.Hosting { public class UseWindowsServiceTests { + private static bool IsRemoteExecutorSupportedAndPrivilegedProcess => RemoteExecutor.IsSupported && AdminHelpers.IsProcessElevated(); + [Fact] public void DefaultsToOffOutsideOfService() { @@ -18,9 +28,29 @@ public void DefaultsToOffOutsideOfService() using (host) { - var lifetime = host.Services.GetRequiredService(); - Assert.IsType(lifetime); - } + var lifetime = host.Services.GetRequiredService(); + Assert.IsType(lifetime); + } + } + + [ConditionalFact(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))] + public void CanCreateService() + { + using var serviceTester = WindowsServiceTester.Create(() => + { + using IHost host = new HostBuilder() + .UseWindowsService() + .Build(); + host.Run(); + }); + + serviceTester.Start(); + serviceTester.WaitForStatus(ServiceControllerStatus.Running); + serviceTester.Stop(); + serviceTester.WaitForStatus(ServiceControllerStatus.Stopped); + + var status = serviceTester.QueryServiceStatus(); + Assert.Equal(0, status.win32ExitCode); } } } diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/WindowsServiceLifetimeTests.cs b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/WindowsServiceLifetimeTests.cs new file mode 100644 index 00000000000000..fda639fbc9715e --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/WindowsServiceLifetimeTests.cs @@ -0,0 +1,348 @@ +// 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.ServiceProcess; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.DotNet.RemoteExecutor; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting.Internal; +using Microsoft.Extensions.Hosting.WindowsServices; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using Xunit; + +namespace Microsoft.Extensions.Hosting +{ + public class WindowsServiceLifetimeTests + { + private static bool IsRemoteExecutorSupportedAndPrivilegedProcess => RemoteExecutor.IsSupported && AdminHelpers.IsProcessElevated(); + + [ConditionalFact(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))] + public void ServiceStops() + { + using var serviceTester = WindowsServiceTester.Create(async () => + { + var applicationLifetime = new ApplicationLifetime(NullLogger.Instance); + using var lifetime = new WindowsServiceLifetime( + new HostingEnvironment(), + applicationLifetime, + NullLoggerFactory.Instance, + new OptionsWrapper(new HostOptions())); + + await lifetime.WaitForStartAsync(CancellationToken.None); + + // would normally occur here, but WindowsServiceLifetime does not depend on it. + // applicationLifetime.NotifyStarted(); + + // will be signaled by WindowsServiceLifetime when SCM stops the service. + applicationLifetime.ApplicationStopping.WaitHandle.WaitOne(); + + // required by WindowsServiceLifetime to identify that app has stopped. + applicationLifetime.NotifyStopped(); + + await lifetime.StopAsync(CancellationToken.None); + }); + + serviceTester.Start(); + serviceTester.WaitForStatus(ServiceControllerStatus.Running); + + var statusEx = serviceTester.QueryServiceStatusEx(); + var serviceProcess = Process.GetProcessById(statusEx.dwProcessId); + + serviceTester.Stop(); + serviceTester.WaitForStatus(ServiceControllerStatus.Stopped); + + serviceProcess.WaitForExit(); + + var status = serviceTester.QueryServiceStatus(); + Assert.Equal(0, status.win32ExitCode); + } + + [ConditionalFact(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Framework is missing the fix from https://github.com/dotnet/corefx/commit/3e68d791066ad0fdc6e0b81828afbd9df00dd7f8")] + public void ExceptionOnStartIsPropagated() + { + using var serviceTester = WindowsServiceTester.Create(async () => + { + using (var lifetime = ThrowingWindowsServiceLifetime.Create(throwOnStart: new Exception("Should be thrown"))) + { + Assert.Equal(lifetime.ThrowOnStart, + await Assert.ThrowsAsync(async () => + await lifetime.WaitForStartAsync(CancellationToken.None))); + } + }); + + serviceTester.Start(); + + serviceTester.WaitForStatus(ServiceControllerStatus.Stopped); + var status = serviceTester.QueryServiceStatus(); + Assert.Equal(Interop.Errors.ERROR_EXCEPTION_IN_SERVICE, status.win32ExitCode); + } + + [ConditionalFact(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))] + public void ExceptionOnStopIsPropagated() + { + using var serviceTester = WindowsServiceTester.Create(async () => + { + using (var lifetime = ThrowingWindowsServiceLifetime.Create(throwOnStop: new Exception("Should be thrown"))) + { + await lifetime.WaitForStartAsync(CancellationToken.None); + lifetime.ApplicationLifetime.NotifyStopped(); + Assert.Equal(lifetime.ThrowOnStop, + await Assert.ThrowsAsync(async () => + await lifetime.StopAsync(CancellationToken.None))); + } + }); + + serviceTester.Start(); + + serviceTester.WaitForStatus(ServiceControllerStatus.Stopped); + var status = serviceTester.QueryServiceStatus(); + Assert.Equal(Interop.Errors.ERROR_PROCESS_ABORTED, status.win32ExitCode); + } + + [ConditionalFact(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))] + public void CancelStopAsync() + { + using var serviceTester = WindowsServiceTester.Create(async () => + { + var applicationLifetime = new ApplicationLifetime(NullLogger.Instance); + using var lifetime = new WindowsServiceLifetime( + new HostingEnvironment(), + applicationLifetime, + NullLoggerFactory.Instance, + new OptionsWrapper(new HostOptions())); + await lifetime.WaitForStartAsync(CancellationToken.None); + + await Assert.ThrowsAsync(async () => await lifetime.StopAsync(new CancellationToken(true))); + }); + + serviceTester.Start(); + + serviceTester.WaitForStatus(ServiceControllerStatus.Stopped); + var status = serviceTester.QueryServiceStatus(); + Assert.Equal(Interop.Errors.ERROR_PROCESS_ABORTED, status.win32ExitCode); + } + + [ConditionalFact(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))] + public void ServiceCanStopItself() + { + using (var serviceTester = WindowsServiceTester.Create(async () => + { + FileLogger.InitializeForTestCase(nameof(ServiceCanStopItself)); + using IHost host = new HostBuilder() + .ConfigureServices(services => + { + services.AddHostedService(); + services.AddSingleton(); + }) + .Build(); + + var applicationLifetime = host.Services.GetRequiredService(); + applicationLifetime.ApplicationStarted.Register(() => FileLogger.Log($"lifetime started")); + applicationLifetime.ApplicationStopping.Register(() => FileLogger.Log($"lifetime stopping")); + applicationLifetime.ApplicationStopped.Register(() => FileLogger.Log($"lifetime stopped")); + + FileLogger.Log("host.Start()"); + host.Start(); + + using (ServiceController selfController = new(nameof(ServiceCanStopItself))) + { + selfController.WaitForStatus(ServiceControllerStatus.Running, WindowsServiceTester.WaitForStatusTimeout); + Assert.Equal(ServiceControllerStatus.Running, selfController.Status); + + FileLogger.Log("host.Stop()"); + await host.StopAsync(); + FileLogger.Log("host.Stop() complete"); + + selfController.WaitForStatus(ServiceControllerStatus.Stopped, WindowsServiceTester.WaitForStatusTimeout); + Assert.Equal(ServiceControllerStatus.Stopped, selfController.Status); + } + })) + { + FileLogger.DeleteLog(nameof(ServiceCanStopItself)); + + // service should start cleanly + serviceTester.Start(); + + // service will proceed to stopped without any error + serviceTester.WaitForStatus(ServiceControllerStatus.Stopped); + + var status = serviceTester.QueryServiceStatus(); + Assert.Equal(0, status.win32ExitCode); + + } + + var logText = FileLogger.ReadLog(nameof(ServiceCanStopItself)); + Assert.Equal( +@"host.Start() +WindowsServiceLifetime.OnStart +BackgroundService.StartAsync +lifetime started +host.Stop() +lifetime stopping +BackgroundService.StopAsync +lifetime stopped +WindowsServiceLifetime.OnStop +host.Stop() complete +", logText); + } + + [ConditionalFact(nameof(IsRemoteExecutorSupportedAndPrivilegedProcess))] + public void ServiceSequenceIsCorrect() + { + using (var serviceTester = WindowsServiceTester.Create(() => + { + FileLogger.InitializeForTestCase(nameof(ServiceSequenceIsCorrect)); + using IHost host = new HostBuilder() + .ConfigureServices(services => + { + services.AddHostedService(); + services.AddSingleton(); + }) + .Build(); + + var applicationLifetime = host.Services.GetRequiredService(); + applicationLifetime.ApplicationStarted.Register(() => FileLogger.Log($"lifetime started")); + applicationLifetime.ApplicationStopping.Register(() => FileLogger.Log($"lifetime stopping")); + applicationLifetime.ApplicationStopped.Register(() => FileLogger.Log($"lifetime stopped")); + + FileLogger.Log("host.Run()"); + host.Run(); + FileLogger.Log("host.Run() complete"); + })) + { + + FileLogger.DeleteLog(nameof(ServiceSequenceIsCorrect)); + + serviceTester.Start(); + serviceTester.WaitForStatus(ServiceControllerStatus.Running); + + var statusEx = serviceTester.QueryServiceStatusEx(); + var serviceProcess = Process.GetProcessById(statusEx.dwProcessId); + + // Give a chance for all asynchronous "started" events to be raised, these happen after the service status changes to started + Thread.Sleep(1000); + + serviceTester.Stop(); + serviceTester.WaitForStatus(ServiceControllerStatus.Stopped); + + var status = serviceTester.QueryServiceStatus(); + Assert.Equal(0, status.win32ExitCode); + + } + + var logText = FileLogger.ReadLog(nameof(ServiceSequenceIsCorrect)); + Assert.Equal( +@"host.Run() +WindowsServiceLifetime.OnStart +BackgroundService.StartAsync +lifetime started +WindowsServiceLifetime.OnStop +lifetime stopping +BackgroundService.StopAsync +lifetime stopped +host.Run() complete +", logText); + + } + + public class LoggingWindowsServiceLifetime : WindowsServiceLifetime + { + public LoggingWindowsServiceLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory, IOptions optionsAccessor) : + base(environment, applicationLifetime, loggerFactory, optionsAccessor) + { } + + protected override void OnStart(string[] args) + { + FileLogger.Log("WindowsServiceLifetime.OnStart"); + base.OnStart(args); + } + + protected override void OnStop() + { + FileLogger.Log("WindowsServiceLifetime.OnStop"); + base.OnStop(); + } + } + + public class ThrowingWindowsServiceLifetime : WindowsServiceLifetime + { + public static ThrowingWindowsServiceLifetime Create(Exception throwOnStart = null, Exception throwOnStop = null) => + new ThrowingWindowsServiceLifetime( + new HostingEnvironment(), + new ApplicationLifetime(NullLogger.Instance), + NullLoggerFactory.Instance, + new OptionsWrapper(new HostOptions())) + { + ThrowOnStart = throwOnStart, + ThrowOnStop = throwOnStop + }; + + public ThrowingWindowsServiceLifetime(IHostEnvironment environment, ApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory, IOptions optionsAccessor) : + base(environment, applicationLifetime, loggerFactory, optionsAccessor) + { + ApplicationLifetime = applicationLifetime; + } + + public ApplicationLifetime ApplicationLifetime { get; } + + public Exception ThrowOnStart { get; set; } + protected override void OnStart(string[] args) + { + if (ThrowOnStart != null) + { + throw ThrowOnStart; + } + base.OnStart(args); + } + + public Exception ThrowOnStop { get; set; } + protected override void OnStop() + { + if (ThrowOnStop != null) + { + throw ThrowOnStop; + } + base.OnStop(); + } + } + + public class LoggingBackgroundService : BackgroundService + { +#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously + protected override async Task ExecuteAsync(CancellationToken stoppingToken) => FileLogger.Log("BackgroundService.ExecuteAsync"); + public override async Task StartAsync(CancellationToken stoppingToken) => FileLogger.Log("BackgroundService.StartAsync"); + public override async Task StopAsync(CancellationToken stoppingToken) => FileLogger.Log("BackgroundService.StopAsync"); +#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously + } + + static class FileLogger + { + static string _fileName; + + public static void InitializeForTestCase(string testCaseName) + { + Assert.Null(_fileName); + _fileName = GetLogForTestCase(testCaseName); + } + + private static string GetLogForTestCase(string testCaseName) => Path.Combine(AppContext.BaseDirectory, $"{testCaseName}.log"); + public static void DeleteLog(string testCaseName) => File.Delete(GetLogForTestCase(testCaseName)); + public static string ReadLog(string testCaseName) => File.ReadAllText(GetLogForTestCase(testCaseName)); + public static void Log(string message) + { + Assert.NotNull(_fileName); + lock (_fileName) + { + File.AppendAllText(_fileName, message + Environment.NewLine); + } + } + } + } +} diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/WindowsServiceTester.cs b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/WindowsServiceTester.cs new file mode 100644 index 00000000000000..63103dacd3e6db --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/test/WindowsServiceTester.cs @@ -0,0 +1,158 @@ +// 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.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.ServiceProcess; +using System.Threading.Tasks; +using Microsoft.DotNet.RemoteExecutor; +using Microsoft.Win32.SafeHandles; +using Xunit; + +namespace Microsoft.Extensions.Hosting +{ + public class WindowsServiceTester : ServiceController + { + private WindowsServiceTester(SafeServiceHandle serviceHandle, RemoteInvokeHandle remoteInvokeHandle, string serviceName) : base(serviceName) + { + _serviceHandle = serviceHandle; + _remoteInvokeHandle = remoteInvokeHandle; + } + + private SafeServiceHandle _serviceHandle; + private RemoteInvokeHandle _remoteInvokeHandle; + + public new void Start() + { + Start(Array.Empty()); + } + + public new void Start(string[] args) + { + base.Start(args); + + // get the process + _remoteInvokeHandle.Process.Dispose(); + _remoteInvokeHandle.Process = null; + + var statusEx = QueryServiceStatusEx(); + try + { + _remoteInvokeHandle.Process = Process.GetProcessById(statusEx.dwProcessId); + // fetch the process handle so that we can get the exit code later. + var _ = _remoteInvokeHandle.Process.SafeHandle; + } + catch (ArgumentException) + { } + } + + public static TimeSpan WaitForStatusTimeout { get; set; } = TimeSpan.FromSeconds(30); + + public new void WaitForStatus(ServiceControllerStatus desiredStatus) => + WaitForStatus(desiredStatus, WaitForStatusTimeout); + + public new void WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout) + { + base.WaitForStatus(desiredStatus, timeout); + + Assert.Equal(Status, desiredStatus); + } + + // the following overloads are necessary to ensure the compiler will produce the correct signature from a lambda. + public static WindowsServiceTester Create(Func serviceMain, [CallerMemberName] string serviceName = null) => Create(RemoteExecutor.Invoke(serviceMain, remoteInvokeOptions), serviceName); + + public static WindowsServiceTester Create(Func> serviceMain, [CallerMemberName] string serviceName = null) => Create(RemoteExecutor.Invoke(serviceMain, remoteInvokeOptions), serviceName); + + public static WindowsServiceTester Create(Func serviceMain, [CallerMemberName] string serviceName = null) => Create(RemoteExecutor.Invoke(serviceMain, remoteInvokeOptions), serviceName); + + public static WindowsServiceTester Create(Action serviceMain, [CallerMemberName] string serviceName = null) => Create(RemoteExecutor.Invoke(serviceMain, remoteInvokeOptions), serviceName); + + private static RemoteInvokeOptions remoteInvokeOptions = new RemoteInvokeOptions() { Start = false }; + + private static WindowsServiceTester Create(RemoteInvokeHandle remoteInvokeHandle, string serviceName) + { + // create remote executor commandline arguments + var startInfo = remoteInvokeHandle.Process.StartInfo; + string commandLine = startInfo.FileName + " " + startInfo.Arguments; + + // install the service + using (var serviceManagerHandle = new SafeServiceHandle(Interop.Advapi32.OpenSCManager(null, null, Interop.Advapi32.ServiceControllerOptions.SC_MANAGER_ALL))) + { + if (serviceManagerHandle.IsInvalid) + { + throw new InvalidOperationException(); + } + + // delete existing service if it exists + using (var existingServiceHandle = new SafeServiceHandle(Interop.Advapi32.OpenService(serviceManagerHandle, serviceName, Interop.Advapi32.ServiceAccessOptions.ACCESS_TYPE_ALL))) + { + if (!existingServiceHandle.IsInvalid) + { + Interop.Advapi32.DeleteService(existingServiceHandle); + } + } + + var serviceHandle = new SafeServiceHandle( + Interop.Advapi32.CreateService(serviceManagerHandle, + serviceName, + $"{nameof(WindowsServiceTester)} {serviceName} test service", + Interop.Advapi32.ServiceAccessOptions.ACCESS_TYPE_ALL, + Interop.Advapi32.ServiceTypeOptions.SERVICE_TYPE_WIN32_OWN_PROCESS, + (int)ServiceStartMode.Manual, + Interop.Advapi32.ServiceStartErrorModes.ERROR_CONTROL_NORMAL, + commandLine, + loadOrderGroup: null, + pTagId: IntPtr.Zero, + dependencies: null, + servicesStartName: null, + password: null)); + + if (serviceHandle.IsInvalid) + { + throw new Win32Exception(); + } + + return new WindowsServiceTester(serviceHandle, remoteInvokeHandle, serviceName); + } + } + + internal unsafe Interop.Advapi32.SERVICE_STATUS QueryServiceStatus() + { + Interop.Advapi32.SERVICE_STATUS status = default; + bool success = Interop.Advapi32.QueryServiceStatus(_serviceHandle, &status); + if (!success) + { + throw new Win32Exception(); + } + return status; + } + + internal unsafe Interop.Advapi32.SERVICE_STATUS_PROCESS QueryServiceStatusEx() + { + Interop.Advapi32.SERVICE_STATUS_PROCESS status = default; + bool success = Interop.Advapi32.QueryServiceStatusEx(_serviceHandle, &status); + if (!success) + { + throw new Win32Exception(); + } + return status; + } + + protected override void Dispose(bool disposing) + { + if (_remoteInvokeHandle != null) + { + _remoteInvokeHandle.Dispose(); + } + + if (!_serviceHandle.IsInvalid) + { + // delete the temporary test service + Interop.Advapi32.DeleteService(_serviceHandle); + _serviceHandle.Close(); + } + } + } +} diff --git a/src/libraries/Microsoft.Extensions.Hosting/Directory.Build.props b/src/libraries/Microsoft.Extensions.Hosting/Directory.Build.props index 43dc3a2640bbae..207017db91b3d1 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/Directory.Build.props +++ b/src/libraries/Microsoft.Extensions.Hosting/Directory.Build.props @@ -2,5 +2,6 @@ true + 1 diff --git a/src/libraries/Microsoft.Extensions.Hosting/Microsoft.Extensions.Hosting.sln b/src/libraries/Microsoft.Extensions.Hosting/Microsoft.Extensions.Hosting.sln index a9809bec457afd..529c17516ab669 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/Microsoft.Extensions.Hosting.sln +++ b/src/libraries/Microsoft.Extensions.Hosting/Microsoft.Extensions.Hosting.sln @@ -71,8 +71,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hostin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hosting.Unit.Tests", "tests\UnitTests\Microsoft.Extensions.Hosting.Unit.Tests.csproj", "{33C3D8F0-297F-4471-92B0-F4E8717F10E3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{FBF0B5C9-CD20-4B8A-83B4-6281A2EEBC45}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{42E1BF94-6FE0-4017-9702-55913BD95EDE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{8845E6FF-94B2-4994-A8F4-DF30844A2168}" @@ -131,8 +129,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{B41AA17B-5129-41CC-8EA4-250B80BABF87}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{631AE96F-2615-4D38-B3BB-0D98777C4667}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{0813853E-8C78-429A-B01A-3FB2EF1898F8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Threading.AccessControl", "..\System.Threading.AccessControl\ref\System.Threading.AccessControl.csproj", "{6F69FD88-7BD1-41DF-BF5D-F0E5F12BE766}" @@ -401,10 +397,6 @@ Global {014EE6B4-BE08-4E50-9EBD-0D7A0CB7A76E}.Debug|Any CPU.Build.0 = Debug|Any CPU {014EE6B4-BE08-4E50-9EBD-0D7A0CB7A76E}.Release|Any CPU.ActiveCfg = Release|Any CPU {014EE6B4-BE08-4E50-9EBD-0D7A0CB7A76E}.Release|Any CPU.Build.0 = Release|Any CPU - {631AE96F-2615-4D38-B3BB-0D98777C4667}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {631AE96F-2615-4D38-B3BB-0D98777C4667}.Debug|Any CPU.Build.0 = Debug|Any CPU - {631AE96F-2615-4D38-B3BB-0D98777C4667}.Release|Any CPU.ActiveCfg = Release|Any CPU - {631AE96F-2615-4D38-B3BB-0D98777C4667}.Release|Any CPU.Build.0 = Release|Any CPU {B41AA17B-5129-41CC-8EA4-250B80BABF87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B41AA17B-5129-41CC-8EA4-250B80BABF87}.Debug|Any CPU.Build.0 = Debug|Any CPU {B41AA17B-5129-41CC-8EA4-250B80BABF87}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -509,7 +501,6 @@ Global {0AEAD15B-CD38-4462-A36C-655ED8D0CBD1} = {59A29BF0-B76B-41F8-A733-E2A0847AB992} {0BC9E4F4-5C34-4B90-80AB-2933992D99A6} = {59A29BF0-B76B-41F8-A733-E2A0847AB992} {4ED9C0A9-C1EF-47ED-99F8-74B7411C971B} = {59A29BF0-B76B-41F8-A733-E2A0847AB992} - {631AE96F-2615-4D38-B3BB-0D98777C4667} = {59A29BF0-B76B-41F8-A733-E2A0847AB992} {B41AA17B-5129-41CC-8EA4-250B80BABF87} = {59A29BF0-B76B-41F8-A733-E2A0847AB992} {C58E2CF3-F8AA-47C1-8A49-65B91252F2AA} = {59A29BF0-B76B-41F8-A733-E2A0847AB992} {A5DD36AF-F0AD-4616-AB91-BC63E89B2744} = {59A29BF0-B76B-41F8-A733-E2A0847AB992} diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/Internal/Host.cs b/src/libraries/Microsoft.Extensions.Hosting/src/Internal/Host.cs index 4041133a0a9f25..2f73146e695ef2 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/Internal/Host.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/src/Internal/Host.cs @@ -79,15 +79,22 @@ public async Task StartAsync(CancellationToken cancellationToken = default) private async Task TryExecuteBackgroundServiceAsync(BackgroundService backgroundService) { + // backgroundService.ExecuteTask may not be set (e.g. if the derived class doesn't call base.StartAsync) + Task backgroundTask = backgroundService.ExecuteTask; + if (backgroundTask == null) + { + return; + } + try { - await backgroundService.ExecuteTask.ConfigureAwait(false); + await backgroundTask.ConfigureAwait(false); } catch (Exception ex) { // When the host is being stopped, it cancels the background services. // This isn't an error condition, so don't log it as an error. - if (_stopCalled && backgroundService.ExecuteTask.IsCanceled && ex is OperationCanceledException) + if (_stopCalled && backgroundTask.IsCanceled && ex is OperationCanceledException) { return; } diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/Microsoft.Extensions.Hosting.csproj b/src/libraries/Microsoft.Extensions.Hosting/src/Microsoft.Extensions.Hosting.csproj index b868be57845e0c..5962169ce1aea5 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/src/Microsoft.Extensions.Hosting.csproj +++ b/src/libraries/Microsoft.Extensions.Hosting/src/Microsoft.Extensions.Hosting.csproj @@ -1,4 +1,4 @@ - + $(NetCoreAppCurrent);netstandard2.0;netstandard2.1;net461 @@ -6,6 +6,7 @@ Hosting and startup infrastructures for applications. false + diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs index d07c2bc57eaa71..b3133dba3be886 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs @@ -1394,6 +1394,36 @@ public async Task HostNoErrorWhenServiceIsCanceledAsPartOfStop() } } + /// + /// Tests that when a BackgroundService does not call base, the Host still starts and stops successfully. + /// + [Fact] + public async Task StartOnBackgroundServiceThatDoesNotCallBase() + { + TestLoggerProvider logger = new TestLoggerProvider(); + + using IHost host = CreateBuilder() + .ConfigureLogging(logging => + { + logging.AddProvider(logger); + }) + .ConfigureServices(services => + { + services.AddHostedService(); + }) + .Build(); + + host.Start(); + await host.StopAsync(); + + foreach (LogEvent logEvent in logger.GetEvents()) + { + Assert.True(logEvent.LogLevel <= LogLevel.Information, "All logged events should be less than or equal to Information. No Warnings or Errors."); + + Assert.NotEqual("BackgroundServiceFaulted", logEvent.EventId.Name); + } + } + private IHostBuilder CreateBuilder(IConfiguration config = null) { return new HostBuilder().ConfigureHostConfiguration(builder => builder.AddConfiguration(config ?? new ConfigurationBuilder().Build())); @@ -1562,5 +1592,14 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) } } } + + private class BackgroundServiceDoesNotCallBase : BackgroundService + { + public override Task StartAsync(CancellationToken cancellationToken) => Task.CompletedTask; + + protected override Task ExecuteAsync(CancellationToken stoppingToken) => Task.CompletedTask; + + public override Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } } } diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Microsoft.Extensions.Hosting.Unit.Tests.csproj b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Microsoft.Extensions.Hosting.Unit.Tests.csproj index ee0c814c41b3f0..babb650155cbfb 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Microsoft.Extensions.Hosting.Unit.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Microsoft.Extensions.Hosting.Unit.Tests.csproj @@ -18,4 +18,10 @@ + + + + + diff --git a/src/libraries/Microsoft.Extensions.Http/Microsoft.Extensions.Http.sln b/src/libraries/Microsoft.Extensions.Http/Microsoft.Extensions.Http.sln index bbb76ebd7a1ab7..1f763e573612b6 100644 --- a/src/libraries/Microsoft.Extensions.Http/Microsoft.Extensions.Http.sln +++ b/src/libraries/Microsoft.Extensions.Http/Microsoft.Extensions.Http.sln @@ -19,8 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Http", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Http.Tests", "tests\Microsoft.Extensions.Http.Tests\Microsoft.Extensions.Http.Tests.csproj", "{58A1E42E-5DA1-452A-B39C-A1819171970A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{3DD4EF0E-36D5-48BD-8F8A-1D7DAF74EC25}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{85615392-9242-4CAF-A0FE-A439FF615462}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{BAFF07C7-1F5F-4706-B7D7-9D5D309CBFE2}" diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.Abstractions.sln b/src/libraries/Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.Abstractions.sln index 869ed2e72f0dd8..147339db0e9240 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.Abstractions.sln +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.Abstractions.sln @@ -1,13 +1,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "..\Common\tests\TestUtilities\TestUtilities.csproj", "{79CE8C7E-A4AF-413C-A54D-86F17073559C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "gen\Microsoft.Extensions.Logging.Generators.csproj", "{1CB925AD-09DA-4734-BA05-619A00E5B448}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{7F536552-0E2A-4642-B7CF-863727C2F9CD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "src\Microsoft.Extensions.Logging.Abstractions.csproj", "{75C579F7-F20B-41F1-8CAF-641DE7ADA4EE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators.Tests", "tests\Microsoft.Extensions.Logging.Generators.Tests\Microsoft.Extensions.Logging.Generators.Tests.csproj", "{1CB869A7-2EEC-4A53-9C33-DF9E0C75825B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests", "tests\Microsoft.Extensions.Logging.Generators.Tests\Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests.csproj", "{1CB869A7-2EEC-4A53-9C33-DF9E0C75825B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServices.Unsafe", "..\System.Runtime.CompilerServices.Unsafe\ref\System.Runtime.CompilerServices.Unsafe.csproj", "{DAA1349E-960E-49EB-81F3-FF4F99D8A325}" EndProject @@ -19,6 +17,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{4DE63935 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{548DF5F7-790C-4A1C-89EB-BD904CA1BA86}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators.Roslyn4.0", "gen\Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj", "{A5439E79-96D6-4F02-8DD0-23DFF979851D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators.Roslyn3.11", "gen\Microsoft.Extensions.Logging.Generators.Roslyn3.11.csproj", "{1491B9C9-955D-4DB0-B1D5-70137A78EAAE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests", "tests\Microsoft.Extensions.Logging.Generators.Tests\Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests.csproj", "{C333EC5A-F386-4A01-AE20-12D499551304}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,18 +45,38 @@ Global {79CE8C7E-A4AF-413C-A54D-86F17073559C}.Debug|Any CPU.Build.0 = Debug|Any CPU {79CE8C7E-A4AF-413C-A54D-86F17073559C}.Release|Any CPU.ActiveCfg = Release|Any CPU {79CE8C7E-A4AF-413C-A54D-86F17073559C}.Release|Any CPU.Build.0 = Release|Any CPU - {1CB925AD-09DA-4734-BA05-619A00E5B448}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1CB925AD-09DA-4734-BA05-619A00E5B448}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1CB925AD-09DA-4734-BA05-619A00E5B448}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1CB925AD-09DA-4734-BA05-619A00E5B448}.Release|Any CPU.Build.0 = Release|Any CPU - {F8CF3192-B902-4631-972A-C405FDECC48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F8CF3192-B902-4631-972A-C405FDECC48D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F8CF3192-B902-4631-972A-C405FDECC48D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F8CF3192-B902-4631-972A-C405FDECC48D}.Release|Any CPU.Build.0 = Release|Any CPU + {7F536552-0E2A-4642-B7CF-863727C2F9CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F536552-0E2A-4642-B7CF-863727C2F9CD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F536552-0E2A-4642-B7CF-863727C2F9CD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F536552-0E2A-4642-B7CF-863727C2F9CD}.Release|Any CPU.Build.0 = Release|Any CPU + {75C579F7-F20B-41F1-8CAF-641DE7ADA4EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {75C579F7-F20B-41F1-8CAF-641DE7ADA4EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75C579F7-F20B-41F1-8CAF-641DE7ADA4EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {75C579F7-F20B-41F1-8CAF-641DE7ADA4EE}.Release|Any CPU.Build.0 = Release|Any CPU + {1CB869A7-2EEC-4A53-9C33-DF9E0C75825B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CB869A7-2EEC-4A53-9C33-DF9E0C75825B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CB869A7-2EEC-4A53-9C33-DF9E0C75825B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CB869A7-2EEC-4A53-9C33-DF9E0C75825B}.Release|Any CPU.Build.0 = Release|Any CPU {DAA1349E-960E-49EB-81F3-FF4F99D8A325}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DAA1349E-960E-49EB-81F3-FF4F99D8A325}.Debug|Any CPU.Build.0 = Debug|Any CPU {DAA1349E-960E-49EB-81F3-FF4F99D8A325}.Release|Any CPU.ActiveCfg = Release|Any CPU {DAA1349E-960E-49EB-81F3-FF4F99D8A325}.Release|Any CPU.Build.0 = Release|Any CPU + {F8CF3192-B902-4631-972A-C405FDECC48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8CF3192-B902-4631-972A-C405FDECC48D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8CF3192-B902-4631-972A-C405FDECC48D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8CF3192-B902-4631-972A-C405FDECC48D}.Release|Any CPU.Build.0 = Release|Any CPU + {A5439E79-96D6-4F02-8DD0-23DFF979851D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5439E79-96D6-4F02-8DD0-23DFF979851D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5439E79-96D6-4F02-8DD0-23DFF979851D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5439E79-96D6-4F02-8DD0-23DFF979851D}.Release|Any CPU.Build.0 = Release|Any CPU + {1491B9C9-955D-4DB0-B1D5-70137A78EAAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1491B9C9-955D-4DB0-B1D5-70137A78EAAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1491B9C9-955D-4DB0-B1D5-70137A78EAAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1491B9C9-955D-4DB0-B1D5-70137A78EAAE}.Release|Any CPU.Build.0 = Release|Any CPU + {C333EC5A-F386-4A01-AE20-12D499551304}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C333EC5A-F386-4A01-AE20-12D499551304}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C333EC5A-F386-4A01-AE20-12D499551304}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C333EC5A-F386-4A01-AE20-12D499551304}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -62,9 +86,14 @@ Global {DAA1349E-960E-49EB-81F3-FF4F99D8A325} = {7631380A-FB73-4241-9987-0891A21E9769} {1CB869A7-2EEC-4A53-9C33-DF9E0C75825B} = {4DE63935-DCA9-4D63-9C1F-AAE79C89CA8B} {79CE8C7E-A4AF-413C-A54D-86F17073559C} = {4DE63935-DCA9-4D63-9C1F-AAE79C89CA8B} + {7F536552-0E2A-4642-B7CF-863727C2F9CD} = {7631380A-FB73-4241-9987-0891A21E9769} {75C579F7-F20B-41F1-8CAF-641DE7ADA4EE} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} - {1CB925AD-09DA-4734-BA05-619A00E5B448} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} + {1CB869A7-2EEC-4A53-9C33-DF9E0C75825B} = {4DE63935-DCA9-4D63-9C1F-AAE79C89CA8B} + {DAA1349E-960E-49EB-81F3-FF4F99D8A325} = {7631380A-FB73-4241-9987-0891A21E9769} {F8CF3192-B902-4631-972A-C405FDECC48D} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} + {A5439E79-96D6-4F02-8DD0-23DFF979851D} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} + {1491B9C9-955D-4DB0-B1D5-70137A78EAAE} = {548DF5F7-790C-4A1C-89EB-BD904CA1BA86} + {C333EC5A-F386-4A01-AE20-12D499551304} = {4DE63935-DCA9-4D63-9C1F-AAE79C89CA8B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {450DA749-CBDC-4BDC-950F-8A491CF59D49} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Emitter.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Emitter.cs index 53dd062b5d4b4c..249672b37058b1 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Emitter.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Emitter.cs @@ -78,7 +78,7 @@ namespace {lc.Namespace} // loop until you find top level nested class while (parent != null) { - parentClasses.Add($"partial {parent.Keyword} {parent.Name} {parent.Constraints}"); + parentClasses.Add($"partial {parent.Keyword} {parent.Name} "); parent = parent.ParentClass; } @@ -92,7 +92,7 @@ namespace {lc.Namespace} } _builder.Append($@" - {nestedIndentation}partial {lc.Keyword} {lc.Name} {lc.Constraints} + {nestedIndentation}partial {lc.Keyword} {lc.Name} {nestedIndentation}{{"); foreach (LoggerMethod lm in lc.Methods) @@ -196,7 +196,7 @@ private void GenFieldAssignments(LoggerMethod lm, string nestedIndentation) { foreach (LoggerParameter p in lm.TemplateParameters) { - _builder.AppendLine($" {nestedIndentation}this._{p.Name} = {p.Name};"); + _builder.AppendLine($" {nestedIndentation}this._{p.Name} = {p.CodeName};"); } } @@ -255,7 +255,7 @@ private void GenCallbackArguments(LoggerMethod lm) { foreach (LoggerParameter p in lm.TemplateParameters) { - _builder.Append($"{p.Name}, "); + _builder.Append($"{p.CodeName}, "); } } @@ -309,7 +309,11 @@ private void GenParameters(LoggerMethod lm) _builder.Append(", "); } - _builder.Append($"{p.Type} {p.Name}"); + if (p.Qualifier != null) + { + _builder.Append($"{p.Qualifier} "); + } + _builder.Append($"{p.Type} {p.CodeName}"); } } @@ -327,7 +331,7 @@ private void GenArguments(LoggerMethod lm) _builder.Append(", "); } - _builder.Append($"{p.Type} {p.Name}"); + _builder.Append($"{p.Type} {p.CodeName}"); } } @@ -343,7 +347,7 @@ private void GenHolder(LoggerMethod lm) _builder.Append(", "); } - _builder.Append(p.Name); + _builder.Append(p.CodeName); } _builder.Append(')'); diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs index 4a995039104b9d..c84d195e22227e 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Parser.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using System.Collections.Immutable; +using Microsoft.CodeAnalysis.DotnetRuntime.Extensions; namespace Microsoft.Extensions.Logging.Generators { @@ -17,6 +18,8 @@ public partial class LoggerMessageGenerator { internal class Parser { + internal const string LoggerMessageAttribute = "Microsoft.Extensions.Logging.LoggerMessageAttribute"; + private readonly CancellationToken _cancellationToken; private readonly Compilation _compilation; private readonly Action _reportDiagnostic; @@ -28,35 +31,63 @@ public Parser(Compilation compilation, Action reportDiagnostic, Canc _reportDiagnostic = reportDiagnostic; } + internal static bool IsSyntaxTargetForGeneration(SyntaxNode node) => + node is MethodDeclarationSyntax m && m.AttributeLists.Count > 0; + + internal static ClassDeclarationSyntax? GetSemanticTargetForGeneration(GeneratorSyntaxContext context) + { + var methodDeclarationSyntax = (MethodDeclarationSyntax)context.Node; + + foreach (AttributeListSyntax attributeListSyntax in methodDeclarationSyntax.AttributeLists) + { + foreach (AttributeSyntax attributeSyntax in attributeListSyntax.Attributes) + { + IMethodSymbol attributeSymbol = context.SemanticModel.GetSymbolInfo(attributeSyntax).Symbol as IMethodSymbol; + if (attributeSymbol == null) + { + continue; + } + + INamedTypeSymbol attributeContainingTypeSymbol = attributeSymbol.ContainingType; + string fullName = attributeContainingTypeSymbol.ToDisplayString(); + + if (fullName == LoggerMessageAttribute) + { + return methodDeclarationSyntax.Parent as ClassDeclarationSyntax; + } + } + } + + return null; + } + /// /// Gets the set of logging classes containing methods to output. /// public IReadOnlyList GetLogClasses(IEnumerable classes) { - const string LoggerMessageAttribute = "Microsoft.Extensions.Logging.LoggerMessageAttribute"; - - INamedTypeSymbol loggerMessageAttribute = _compilation.GetTypeByMetadataName(LoggerMessageAttribute); + INamedTypeSymbol loggerMessageAttribute = _compilation.GetBestTypeByMetadataName(LoggerMessageAttribute); if (loggerMessageAttribute == null) { // nothing to do if this type isn't available return Array.Empty(); } - INamedTypeSymbol loggerSymbol = _compilation.GetTypeByMetadataName("Microsoft.Extensions.Logging.ILogger"); + INamedTypeSymbol loggerSymbol = _compilation.GetBestTypeByMetadataName("Microsoft.Extensions.Logging.ILogger"); if (loggerSymbol == null) { // nothing to do if this type isn't available return Array.Empty(); } - INamedTypeSymbol logLevelSymbol = _compilation.GetTypeByMetadataName("Microsoft.Extensions.Logging.LogLevel"); + INamedTypeSymbol logLevelSymbol = _compilation.GetBestTypeByMetadataName("Microsoft.Extensions.Logging.LogLevel"); if (logLevelSymbol == null) { // nothing to do if this type isn't available return Array.Empty(); } - INamedTypeSymbol exceptionSymbol = _compilation.GetTypeByMetadataName("System.Exception"); + INamedTypeSymbol exceptionSymbol = _compilation.GetBestTypeByMetadataName("System.Exception"); if (exceptionSymbol == null) { Diag(DiagnosticDescriptors.MissingRequiredType, null, "System.Exception"); @@ -277,6 +308,15 @@ public IReadOnlyList GetLogClasses(IEnumerable 0) + { + ParameterSyntax paramSyntax = paramSymbol.DeclaringSyntaxReferences[0].GetSyntax(_cancellationToken) as ParameterSyntax; + if (paramSyntax != null && !string.IsNullOrEmpty(paramSyntax.Identifier.Text)) + { + needsAtSign = paramSyntax.Identifier.Text[0] == '@'; + } + } if (string.IsNullOrWhiteSpace(paramName)) { // semantic problem, just bail quietly @@ -292,6 +332,15 @@ public IReadOnlyList GetLogClasses(IEnumerable GetLogClasses(IEnumerable GetLogClasses(IEnumerable GetLogClasses(IEnumerable + bool IsAllowedKind(SyntaxKind kind) => kind == SyntaxKind.ClassDeclaration || kind == SyntaxKind.StructDeclaration || kind == SyntaxKind.RecordDeclaration; - + while (parentLoggerClass != null && IsAllowedKind(parentLoggerClass.Kind())) { currentLoggerClass.ParentClass = new LoggerClass @@ -454,7 +514,6 @@ bool IsAllowedKind(SyntaxKind kind) => Keyword = parentLoggerClass.Keyword.ValueText, Namespace = nspace, Name = parentLoggerClass.Identifier.ToString() + parentLoggerClass.TypeParameterList, - Constraints = parentLoggerClass.ConstraintClauses.ToString(), ParentClass = null, }; @@ -640,7 +699,6 @@ internal class LoggerClass public string Keyword = string.Empty; public string Namespace = string.Empty; public string Name = string.Empty; - public string Constraints = string.Empty; public LoggerClass? ParentClass; } @@ -671,6 +729,8 @@ internal class LoggerParameter { public string Name = string.Empty; public string Type = string.Empty; + public string CodeName = string.Empty; + public string? Qualifier; public bool IsLogger; public bool IsException; public bool IsLogLevel; diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Roslyn3.11.cs similarity index 61% rename from src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.cs rename to src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Roslyn3.11.cs index 92105d515e328c..52a42cec41d08c 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Roslyn3.11.cs @@ -1,10 +1,7 @@ // 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.CodeAnalysis; -using System.Runtime.CompilerServices; using System.Text; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -17,16 +14,14 @@ namespace Microsoft.Extensions.Logging.Generators [Generator] public partial class LoggerMessageGenerator : ISourceGenerator { - [ExcludeFromCodeCoverage] public void Initialize(GeneratorInitializationContext context) { - context.RegisterForSyntaxNotifications(SyntaxReceiver.Create); + context.RegisterForSyntaxNotifications(SyntaxContextReceiver.Create); } - [ExcludeFromCodeCoverage] public void Execute(GeneratorExecutionContext context) { - if (context.SyntaxReceiver is not SyntaxReceiver receiver || receiver.ClassDeclarations.Count == 0) + if (context.SyntaxContextReceiver is not SyntaxContextReceiver receiver || receiver.ClassDeclarations.Count == 0) { // nothing to do yet return; @@ -38,26 +33,29 @@ public void Execute(GeneratorExecutionContext context) { var e = new Emitter(); string result = e.Emit(logClasses, context.CancellationToken); - + context.AddSource("LoggerMessage.g.cs", SourceText.From(result, Encoding.UTF8)); } } - [ExcludeFromCodeCoverage] - private sealed class SyntaxReceiver : ISyntaxReceiver + private sealed class SyntaxContextReceiver : ISyntaxContextReceiver { - internal static ISyntaxReceiver Create() + internal static ISyntaxContextReceiver Create() { - return new SyntaxReceiver(); + return new SyntaxContextReceiver(); } - public List ClassDeclarations { get; } = new (); + public HashSet ClassDeclarations { get; } = new(); - public void OnVisitSyntaxNode(SyntaxNode syntaxNode) + public void OnVisitSyntaxNode(GeneratorSyntaxContext context) { - if (syntaxNode is ClassDeclarationSyntax classSyntax) + if (Parser.IsSyntaxTargetForGeneration(context.Node)) { - ClassDeclarations.Add(classSyntax); + ClassDeclarationSyntax classSyntax = Parser.GetSemanticTargetForGeneration(context); + if (classSyntax != null) + { + ClassDeclarations.Add(classSyntax); + } } } } diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Roslyn4.0.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Roslyn4.0.cs new file mode 100644 index 00000000000000..ab342384270807 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Roslyn4.0.cs @@ -0,0 +1,57 @@ +// 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.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.DotnetRuntime.Extensions; +using Microsoft.CodeAnalysis.Text; + +[assembly: System.Resources.NeutralResourcesLanguage("en-us")] + +namespace Microsoft.Extensions.Logging.Generators +{ + [Generator] + public partial class LoggerMessageGenerator : IIncrementalGenerator + { + public void Initialize(IncrementalGeneratorInitializationContext context) + { + IncrementalValuesProvider classDeclarations = context.SyntaxProvider + .ForAttributeWithMetadataName( + context, + Parser.LoggerMessageAttribute, + (node, _) => node is MethodDeclarationSyntax, + (context, _) => context.TargetNode.Parent as ClassDeclarationSyntax) + .Where(static m => m is not null); + + IncrementalValueProvider<(Compilation, ImmutableArray)> compilationAndClasses = + context.CompilationProvider.Combine(classDeclarations.Collect()); + + context.RegisterSourceOutput(compilationAndClasses, static (spc, source) => Execute(source.Item1, source.Item2, spc)); + } + + private static void Execute(Compilation compilation, ImmutableArray classes, SourceProductionContext context) + { + if (classes.IsDefaultOrEmpty) + { + // nothing to do yet + return; + } + + IEnumerable distinctClasses = classes.Distinct(); + + var p = new Parser(compilation, context.ReportDiagnostic, context.CancellationToken); + IReadOnlyList logClasses = p.GetLogClasses(distinctClasses); + if (logClasses.Count > 0) + { + var e = new Emitter(); + string result = e.Emit(logClasses, context.CancellationToken); + + context.AddSource("LoggerMessage.g.cs", SourceText.From(result, Encoding.UTF8)); + } + } + } +} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.Roslyn3.11.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.Roslyn3.11.csproj new file mode 100644 index 00000000000000..4a0f7955215914 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.Roslyn3.11.csproj @@ -0,0 +1,14 @@ + + + + 3.11 + $(MicrosoftCodeAnalysisCSharpWorkspacesVersion_3_11) + + + + + + + + + diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj new file mode 100644 index 00000000000000..03d839d0869cda --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj @@ -0,0 +1,29 @@ + + + + 4.0 + $(MicrosoftCodeAnalysisCSharpWorkspacesVersion) + $(DefineConstants);ROSLYN4_0_OR_GREATER + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.targets similarity index 57% rename from src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.csproj rename to src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.targets index 1531036a02e811..77a182fa4649aa 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Microsoft.Extensions.Logging.Generators.targets @@ -1,7 +1,11 @@ - + netstandard2.0 + $(MSBuildThisFileName) + $(MSBuildThisFileName) + SR + FxResources.$(RootNamespace).$(StringResourcesClassName) enable true false @@ -12,8 +16,12 @@ - + + + + + diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj index 71e35b67179fa7..1b443483dd66c9 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj @@ -17,6 +17,8 @@ Microsoft.Extensions.Logging.LogLevel Microsoft.Extensions.Logging.Logger<T> Microsoft.Extensions.Logging.LoggerMessage Microsoft.Extensions.Logging.Abstractions.NullLogger + false + 4 @@ -30,13 +32,15 @@ Microsoft.Extensions.Logging.Abstractions.NullLogger Link="Common\System\Text\ValueStringBuilder.cs" /> - + - - + + + diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithDefaultValues.generated.txt b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithDefaultValues.generated.txt index c61da37d27bba4..f4747ef679f83c 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithDefaultValues.generated.txt +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithDefaultValues.generated.txt @@ -5,7 +5,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses { partial class TestWithDefaultValues { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] private readonly struct __M0Struct : global::System.Collections.Generic.IReadOnlyList> { @@ -40,7 +40,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] public static partial void M0(global::Microsoft.Extensions.Logging.ILogger logger, global::Microsoft.Extensions.Logging.LogLevel level) { if (logger.IsEnabled(level)) @@ -54,4 +54,4 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses } } } -} +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithDynamicLogLevel.generated.txt b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithDynamicLogLevel.generated.txt index 7a2026361b561b..1d1af4719fe40d 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithDynamicLogLevel.generated.txt +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithDynamicLogLevel.generated.txt @@ -5,7 +5,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses { partial class TestWithDynamicLogLevel { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] private readonly struct __M9Struct : global::System.Collections.Generic.IReadOnlyList> { @@ -40,7 +40,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] public static partial void M9(global::Microsoft.Extensions.Logging.LogLevel level, global::Microsoft.Extensions.Logging.ILogger logger) { if (logger.IsEnabled(level)) diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithMoreThan6Params.generated.txt b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithMoreThan6Params.generated.txt index 90455e122c1d42..3387ec2da1a327 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithMoreThan6Params.generated.txt +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithMoreThan6Params.generated.txt @@ -5,7 +5,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses { partial class TestWithMoreThan6Params { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] private readonly struct __Method9Struct : global::System.Collections.Generic.IReadOnlyList> { private readonly global::System.Int32 _p1; @@ -73,7 +73,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); } - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] public static partial void Method9(global::Microsoft.Extensions.Logging.ILogger logger, global::System.Int32 p1, global::System.Int32 p2, global::System.Int32 p3, global::System.Int32 p4, global::System.Int32 p5, global::System.Int32 p6, global::System.Collections.Generic.IEnumerable p7) { if (logger.IsEnabled(global::Microsoft.Extensions.Logging.LogLevel.Error)) @@ -88,7 +88,7 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses } } } -[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] +[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] internal static class __LoggerMessageGenerator { public static string Enumerate(global::System.Collections.IEnumerable? enumerable) diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithNestedClass.generated.txt b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithNestedClass.generated.txt index e10a678aef24cf..07cd2a3aff4211 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithNestedClass.generated.txt +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithNestedClass.generated.txt @@ -9,17 +9,17 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses.NestedNamesp { partial record NestedRecord { - partial class NestedClassTestsExtensions where T1 : Class1 + partial class NestedClassTestsExtensions { partial class NestedMiddleParentClass { - partial class Nested where T2 : Class2 + partial class Nested { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] private static readonly global::System.Action __M9Callback = global::Microsoft.Extensions.Logging.LoggerMessage.Define(global::Microsoft.Extensions.Logging.LogLevel.Debug, new global::Microsoft.Extensions.Logging.EventId(9, nameof(M9)), "M9", new global::Microsoft.Extensions.Logging.LogDefineOptions() { SkipEnabledCheck = true }); - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] public static partial void M9(global::Microsoft.Extensions.Logging.ILogger logger) { if (logger.IsEnabled(global::Microsoft.Extensions.Logging.LogLevel.Debug)) diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithSkipEnabledCheck.generated.txt b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithSkipEnabledCheck.generated.txt index 6576bb4b394f1b..24575eb81bf458 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithSkipEnabledCheck.generated.txt +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithSkipEnabledCheck.generated.txt @@ -5,11 +5,11 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses { partial class TestWithSkipEnabledCheck { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] private static readonly global::System.Action __M0Callback = global::Microsoft.Extensions.Logging.LoggerMessage.Define(global::Microsoft.Extensions.Logging.LogLevel.Information, new global::Microsoft.Extensions.Logging.EventId(0, nameof(M0)), "Message: When using SkipEnabledCheck, the generated code skips logger.IsEnabled(logLevel) check before calling log. To be used when consumer has already guarded logger method in an IsEnabled check.", new global::Microsoft.Extensions.Logging.LogDefineOptions() { SkipEnabledCheck = true }); - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] public static partial void M0(global::Microsoft.Extensions.Logging.ILogger logger) { __M0Callback(logger, null); diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithTwoParams.generated.txt b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithTwoParams.generated.txt index 5daee3ddd43a1e..d7c2482cdd9216 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithTwoParams.generated.txt +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithTwoParams.generated.txt @@ -5,11 +5,11 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses { partial class TestWithTwoParams { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] private static readonly global::System.Action, global::System.Exception?> __M0Callback = global::Microsoft.Extensions.Logging.LoggerMessage.Define>(global::Microsoft.Extensions.Logging.LogLevel.Error, new global::Microsoft.Extensions.Logging.EventId(0, nameof(M0)), "M0 {a1} {a2}", new global::Microsoft.Extensions.Logging.LogDefineOptions() { SkipEnabledCheck = true }); - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "6.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Extensions.Logging.Generators", "%VERSION%")] public static partial void M0(global::Microsoft.Extensions.Logging.ILogger logger, global::System.Int32 a1, global::System.Collections.Generic.IEnumerable a2) { if (logger.IsEnabled(global::Microsoft.Extensions.Logging.LogLevel.Error)) diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/CompilationHelper.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/CompilationHelper.cs new file mode 100644 index 00000000000000..59c82a5437147f --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/CompilationHelper.cs @@ -0,0 +1,64 @@ +// 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.IO; +using System.Reflection; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; + +namespace Microsoft.Extensions.Logging.Generators.Tests +{ + public class CompilationHelper + { + public static Compilation CreateCompilation( + string source, + MetadataReference[]? additionalReferences = null, + string assemblyName = "TestAssembly") + { + string corelib = Assembly.GetAssembly(typeof(object))!.Location; + string runtimeDir = Path.GetDirectoryName(corelib)!; + + var refs = new List(); + refs.Add(MetadataReference.CreateFromFile(corelib)); + refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "netstandard.dll"))); + refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "System.Runtime.dll"))); + refs.Add(MetadataReference.CreateFromFile(typeof(ILogger).Assembly.Location)); + refs.Add(MetadataReference.CreateFromFile(typeof(LoggerMessageAttribute).Assembly.Location)); + + if (additionalReferences != null) + { + foreach (MetadataReference reference in additionalReferences) + { + refs.Add(reference); + } + } + + CSharpParseOptions options = CSharpParseOptions.Default; + +#if ROSLYN4_0_OR_GREATER + // workaround https://github.com/dotnet/roslyn/pull/55866. We can remove "LangVersion=Preview" when we get a Roslyn build with that change. + options = options.WithLanguageVersion(LanguageVersion.Preview); +#endif + + return CSharpCompilation.Create( + assemblyName, + syntaxTrees: new[] { CSharpSyntaxTree.ParseText(source, options) }, + references: refs.ToArray(), + options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary) + ); + } + + public static byte[] CreateAssemblyImage(Compilation compilation) + { + MemoryStream ms = new MemoryStream(); + var emitResult = compilation.Emit(ms); + if (!emitResult.Success) + { + throw new InvalidOperationException(); + } + return ms.ToArray(); + } + } +} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratedCodeTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratedCodeTests.cs index d55bf4a8028d52..3b0650309a0179 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratedCodeTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratedCodeTests.cs @@ -3,8 +3,12 @@ using System; using System.Collections.Generic; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Generators.Tests.TestClasses; +using Microsoft.Extensions.Logging.Generators.Tests.TestClasses.UsesConstraintInAnotherNamespace; using Xunit; +using NamespaceForABC; +using ConstraintInAnotherNamespace; namespace Microsoft.Extensions.Logging.Generators.Tests { @@ -410,6 +414,71 @@ public void SkipEnabledCheckTests() Assert.Equal(1, logger.CallCount); Assert.Equal("LoggerMethodWithTrueSkipEnabledCheck", logger.LastEventId.Name); } + private struct MyStruct { } + + [Fact] + public void ConstraintsTests() + { + var logger = new MockLogger(); + + var printer = new MessagePrinter(); + logger.Reset(); + printer.Print(logger, new Message() { Text = "Hello" }); + Assert.Equal(LogLevel.Information, logger.LastLogLevel); + Assert.Null(logger.LastException); + Assert.Equal("The message is Hello.", logger.LastFormattedString); + Assert.Equal(1, logger.CallCount); + + var printer2 = new MessagePrinterHasConstraintOnLogClassAndLogMethod(); + logger.Reset(); + printer2.Print(logger, new Message() { Text = "Hello" }); + Assert.Equal(LogLevel.Information, logger.LastLogLevel); + Assert.Null(logger.LastException); + Assert.Equal("The message is `Hello`.", logger.LastFormattedString); + Assert.Equal(1, logger.CallCount); + + logger.Reset(); + ConstraintsTestExtensions.M0(logger, 12); + Assert.Equal(LogLevel.Debug, logger.LastLogLevel); + Assert.Null(logger.LastException); + Assert.Equal("M012", logger.LastFormattedString); + Assert.Equal(1, logger.CallCount); + + logger.Reset(); + ConstraintsTestExtensions1.M0(logger, 12); + Assert.Equal(LogLevel.Debug, logger.LastLogLevel); + Assert.Null(logger.LastException); + Assert.Equal("M012", logger.LastFormattedString); + Assert.Equal(1, logger.CallCount); + + logger.Reset(); + ConstraintsTestExtensions2.M0(logger, 12); + Assert.Equal(LogLevel.Debug, logger.LastLogLevel); + Assert.Null(logger.LastException); + Assert.Equal("M012", logger.LastFormattedString); + Assert.Equal(1, logger.CallCount); + + logger.Reset(); + ConstraintsTestExtensions3.M0(logger, 12); + Assert.Equal(LogLevel.Debug, logger.LastLogLevel); + Assert.Null(logger.LastException); + Assert.Equal("M012", logger.LastFormattedString); + Assert.Equal(1, logger.CallCount); + + logger.Reset(); + ConstraintsTestExtensions4.M0(logger, 12); + Assert.Equal(LogLevel.Debug, logger.LastLogLevel); + Assert.Null(logger.LastException); + Assert.Equal("M012", logger.LastFormattedString); + Assert.Equal(1, logger.CallCount); + + logger.Reset(); + ConstraintsTestExtensions5.M0(logger, 12); + Assert.Equal(LogLevel.Debug, logger.LastLogLevel); + Assert.Null(logger.LastException); + Assert.Equal("M012", logger.LastFormattedString); + Assert.Equal(1, logger.CallCount); + } [Fact] public void NestedClassTests() diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs index 917d87cd127f1e..097dcc722d4007 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorEmitterTests.cs @@ -3,9 +3,7 @@ using System; using System.IO; -using System.Reflection; using System.Threading.Tasks; -using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Text; using SourceGenerators.Tests; using Xunit; @@ -149,9 +147,25 @@ internal class Class2 { } await VerifyAgainstBaselineUsingFile("TestWithNestedClass.generated.txt", testSourceCode); } + [Fact] + public async Task TestBaseline_TestWithFileScopedNamespace_Success() + { + string testSourceCode = @" +namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses; + +internal static partial class TestWithDefaultValues +{ + [LoggerMessage] + public static partial void M0(ILogger logger, LogLevel level); +}"; + await VerifyAgainstBaselineUsingFile("TestWithDefaultValues.generated.txt", testSourceCode); + } + private async Task VerifyAgainstBaselineUsingFile(string filename, string testSourceCode) { - string[] expectedLines = await File.ReadAllLinesAsync(Path.Combine("Baselines", filename)).ConfigureAwait(false); + string baseline = await File.ReadAllTextAsync(Path.Combine("Baselines", filename)).ConfigureAwait(false); + string[] expectedLines = baseline.Replace("%VERSION%", typeof(LoggerMessageGenerator).Assembly.GetName().Version?.ToString()) + .Split(Environment.NewLine); var (d, r) = await RoslynTestUtils.RunGenerator( new LoggerMessageGenerator(), diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs index b2fe61084c52ea..228a386c834af6 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/LoggerMessageGeneratorParserTests.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -350,6 +351,24 @@ public partial class Nested Assert.Empty(diagnostics); } + [Fact] + public async Task FileScopedNamespaceOK() + { + IReadOnlyList diagnostics = await RunGenerator(@" + using Microsoft.Extensions.Logging; + + namespace MyLibrary; + + internal partial class Logger + { + [LoggerMessage(EventId = 1, Level = LogLevel.Information, Message = ""Hello {Name}!"")] + public static partial void Greeting(ILogger logger, string name); + } + "); + + Assert.Empty(diagnostics); + } + [Theory] [InlineData("false")] [InlineData("true")] @@ -380,6 +399,7 @@ public class Object {} public class Void {} public class String {} public struct DateTime {} + public abstract class Attribute {} } namespace System.Collections { @@ -392,10 +412,12 @@ public interface ILogger {} } namespace Microsoft.Extensions.Logging { - public class LoggerMessageAttribute {} + public class LoggerMessageAttribute : System.Attribute {} } partial class C { + [Microsoft.Extensions.Logging.LoggerMessage] + public static partial void Log(ILogger logger); } ", false, includeBaseReferences: false, includeLoggingReferences: false); @@ -584,6 +606,21 @@ partial class C Assert.Equal(DiagnosticDescriptors.LoggingMethodIsGeneric.Id, diagnostics[0].Id); } + [Theory] + [InlineData("ref")] + [InlineData("in")] + public async Task SupportsRefKindsInAndRef(string modifier) + { + IReadOnlyList diagnostics = await RunGenerator(@$" + partial class C + {{ + [LoggerMessage(EventId = 0, Level = LogLevel.Debug, Message = ""Parameter {{P1}}"")] + static partial void M(ILogger logger, {modifier} int p1); + }}"); + + Assert.Empty(diagnostics); + } + [Fact] public async Task Templates() { @@ -656,6 +693,89 @@ static partial class C Assert.Empty(diagnostics); // should fail quietly on broken code } + [Fact] + internal void MultipleTypeDefinitions() + { + // Adding a dependency to an assembly that has internal definitions of public types + // should not result in a collision and break generation. + // Verify usage of the extension GetBestTypeByMetadataName(this Compilation) instead of Compilation.GetTypeByMetadataName(). + var referencedSource = @" + namespace Microsoft.Extensions.Logging + { + internal class LoggerMessageAttribute { } + } + namespace Microsoft.Extensions.Logging + { + internal interface ILogger { } + internal enum LogLevel { } + }"; + + // Compile the referenced assembly first. + Compilation referencedCompilation = CompilationHelper.CreateCompilation(referencedSource); + + // Obtain the image of the referenced assembly. + byte[] referencedImage = CompilationHelper.CreateAssemblyImage(referencedCompilation); + + // Generate the code + string source = @" + namespace Test + { + using Microsoft.Extensions.Logging; + + partial class C + { + [LoggerMessage(EventId = 1, Level = LogLevel.Debug, Message = ""M1"")] + static partial void M1(ILogger logger); + } + }"; + + MetadataReference[] additionalReferences = { MetadataReference.CreateFromImage(referencedImage) }; + Compilation compilation = CompilationHelper.CreateCompilation(source, additionalReferences); + LoggerMessageGenerator generator = new LoggerMessageGenerator(); + + (ImmutableArray diagnostics, ImmutableArray generatedSources) = + RoslynTestUtils.RunGenerator(compilation, generator); + + // Make sure compilation was successful. + Assert.Empty(diagnostics); + Assert.Equal(1, generatedSources.Length); + Assert.Equal(21, generatedSources[0].SourceText.Lines.Count); + } + + [Fact] + public static void SyntaxListWithManyItems() + { + const int nItems = 200000; + var builder = new System.Text.StringBuilder(); + builder.AppendLine( + @" + using Microsoft.Extensions.Logging; + class Program + { + [LoggerMessage(EventId = 1, Level = LogLevel.Debug, Message = ""M1"")] + static partial void M1(ILogger logger) + { + "); + builder.AppendLine(" int[] values = new[] { "); + for (int i = 0; i < nItems; i++) + { + builder.Append("0, "); + } + builder.AppendLine("};"); + builder.AppendLine("}"); + builder.AppendLine("}"); + + string source = builder.ToString(); + Compilation compilation = CompilationHelper.CreateCompilation(source); + LoggerMessageGenerator generator = new LoggerMessageGenerator(); + + (ImmutableArray diagnostics, _) = + RoslynTestUtils.RunGenerator(compilation, generator); + + Assert.Single(diagnostics); + Assert.Equal(DiagnosticDescriptors.LoggingMethodHasBody.Id, diagnostics[0].Id); + } + private static async Task> RunGenerator( string code, bool wrap = true, diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests.csproj new file mode 100644 index 00000000000000..bb4f032a25357c --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests.csproj @@ -0,0 +1,13 @@ + + + + $(MicrosoftCodeAnalysisCSharpWorkspacesVersion_3_11) + + + + + + + + + diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests.csproj new file mode 100644 index 00000000000000..1c826c0b30a3f2 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests.csproj @@ -0,0 +1,14 @@ + + + + $(MicrosoftCodeAnalysisCSharpWorkspacesVersion) + $(DefineConstants);ROSLYN4_0_OR_GREATER + + + + + + + + + diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Tests.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.targets similarity index 83% rename from src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Tests.csproj rename to src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.targets index 1e837898edb969..50df6bb7cc044f 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.targets @@ -1,4 +1,4 @@ - + $(NetCoreAppCurrent) @@ -14,9 +14,8 @@ - + - diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/AtSymbolTestExtensions.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/AtSymbolTestExtensions.cs new file mode 100644 index 00000000000000..be41f22e5a73a5 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/AtSymbolTestExtensions.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses +{ + internal static partial class AtSymbolTestExtensions + { + [LoggerMessage(EventId = 0, Level = LogLevel.Information, Message = "M0 {event}")] + internal static partial void M0(ILogger logger, string @event); + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/ConstaintsTestExtensions.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/ConstaintsTestExtensions.cs new file mode 100644 index 00000000000000..7e6f87271b535f --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/ConstaintsTestExtensions.cs @@ -0,0 +1,118 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses +{ + using ConstraintInAnotherNamespace; + namespace UsesConstraintInAnotherNamespace + { + public partial class MessagePrinter + where T : Message + { + public void Print(ILogger logger, T message) + { + Log.Message(logger, message.Text); + } + + internal static partial class Log + { + [LoggerMessage(EventId = 1, Level = LogLevel.Information, Message = "The message is {Text}.")] + internal static partial void Message(ILogger logger, string? text); + } + } + + public partial class MessagePrinterHasConstraintOnLogClassAndLogMethod + where T : Message + { + public void Print(ILogger logger, T message) + { + Log.Message(logger, message); + } + + internal static partial class Log where U : Message + { + [LoggerMessage(EventId = 1, Level = LogLevel.Information, Message = "The message is {Text}.")] + internal static partial void Message(ILogger logger, U text); + } + } + } + + internal static partial class ConstraintsTestExtensions + where T : class + { + [LoggerMessage(EventId = 0, Level = LogLevel.Debug, Message = "M0{p0}")] + public static partial void M0(ILogger logger, int p0); + + public static void Foo(T dummy) + { + } + } + + internal static partial class ConstraintsTestExtensions1 + where T : struct + { + [LoggerMessage(EventId = 0, Level = LogLevel.Debug, Message = "M0{p0}")] + public static partial void M0(ILogger logger, int p0); + + public static void Foo(T dummy) + { + } + } + + internal static partial class ConstraintsTestExtensions2 + where T : unmanaged + { + [LoggerMessage(EventId = 0, Level = LogLevel.Debug, Message = "M0{p0}")] + public static partial void M0(ILogger logger, int p0); + + public static void Foo(T dummy) + { + } + } + + internal static partial class ConstraintsTestExtensions3 + where T : new() + { + [LoggerMessage(EventId = 0, Level = LogLevel.Debug, Message = "M0{p0}")] + public static partial void M0(ILogger logger, int p0); + + public static void Foo(T dummy) + { + } + } + + internal static partial class ConstraintsTestExtensions4 + where T : System.Attribute + { + [LoggerMessage(EventId = 0, Level = LogLevel.Debug, Message = "M0{p0}")] + public static partial void M0(ILogger logger, int p0); + + public static void Foo(T dummy) + { + } + } + + internal static partial class ConstraintsTestExtensions5 + where T : notnull + { + [LoggerMessage(EventId = 0, Level = LogLevel.Debug, Message = "M0{p0}")] + public static partial void M0(ILogger logger, int p0); + + public static void Foo(T dummy) + { + } + } +} + +namespace ConstraintInAnotherNamespace +{ + public class Message + { + public string? Text { get; set; } + + public override string ToString() + { + return $"`{Text}`"; + } + } +} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/NestedClassTestsExtensions.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/NestedClassTestsExtensions.cs index 4b5b6cdbf90a26..ba6b87f6d5308a 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/NestedClassTestsExtensions.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/NestedClassTestsExtensions.cs @@ -3,6 +3,8 @@ namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses { + using NamespaceForABC; + internal static partial class NestedClassTestsExtensions where T : ABC { internal static partial class NestedMiddleParentClass @@ -26,7 +28,6 @@ internal static partial class NestedClass } } } - public class ABC {} public partial struct NestedStruct { @@ -61,3 +62,8 @@ internal static partial class Logger } } } + +namespace NamespaceForABC +{ + public class ABC {} +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/ParameterTestExtensions.cs b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/ParameterTestExtensions.cs new file mode 100644 index 00000000000000..f51fc2e62f6a96 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/TestClasses/ParameterTestExtensions.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.Extensions.Logging.Generators.Tests.TestClasses +{ + internal static partial class ParameterTestExtensions + { + internal struct S + { + public override string ToString() => "Hello from S"; + } + + [LoggerMessage(EventId = 0, Level = LogLevel.Information, Message = "UseInParameter {s}")] + internal static partial void UseInParameter(ILogger logger, in S s); + + [LoggerMessage(EventId = 1, Level = LogLevel.Information, Message = "UseRefParameter {s}")] + internal static partial void UseRefParameter(ILogger logger, ref S s); + } +} diff --git a/src/libraries/Microsoft.Extensions.Logging.Configuration/Microsoft.Extensions.Logging.Configuration.sln b/src/libraries/Microsoft.Extensions.Logging.Configuration/Microsoft.Extensions.Logging.Configuration.sln index 970154049e48ad..f9d674fdba5679 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Configuration/Microsoft.Extensions.Logging.Configuration.sln +++ b/src/libraries/Microsoft.Extensions.Logging.Configuration/Microsoft.Extensions.Logging.Configuration.sln @@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Depend EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection", "..\Microsoft.Extensions.DependencyInjection\src\Microsoft.Extensions.DependencyInjection.csproj", "{788150B7-B822-4466-A1DC-C875449DE449}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{6D6D8484-D8D0-4FCA-B6FA-B665C629D78F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{C4F75024-EA9D-46C5-B2D9-CAE8FC5EFF38}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{E7035B72-0180-437E-A696-1F0CD8921279}" diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/Microsoft.Extensions.Logging.Console.sln b/src/libraries/Microsoft.Extensions.Logging.Console/Microsoft.Extensions.Logging.Console.sln index 992cbc4d3929ef..f8e2622773b41e 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/Microsoft.Extensions.Logging.Console.sln +++ b/src/libraries/Microsoft.Extensions.Logging.Console/Microsoft.Extensions.Logging.Console.sln @@ -25,8 +25,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Depend EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection", "..\Microsoft.Extensions.DependencyInjection\src\Microsoft.Extensions.DependencyInjection.csproj", "{2E4D0EB0-E34B-4D47-A7F1-E35C696066E8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{D902BAF8-7431-4017-BD56-F4EABE38D7F9}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{9BCECFDA-BF6E-4BD8-BFE2-A25C61F57874}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{6A02D298-6899-4DD0-BFF4-40702BC30BCD}" @@ -65,8 +63,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{BF5E5B5A-AC50-4FF1-AADB-0DFC1AA8E429}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{AD117F41-062A-4158-A17D-3375820A53FA}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{C9F3D8F9-8646-432E-82FC-2E4E8411CFFE}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{AB19DE2B-6A14-4CDA-94EF-845BAF293051}" @@ -189,10 +185,6 @@ Global {1B33EC41-F711-4111-8818-FEEBC9A0BD8D}.Debug|Any CPU.Build.0 = Debug|Any CPU {1B33EC41-F711-4111-8818-FEEBC9A0BD8D}.Release|Any CPU.ActiveCfg = Release|Any CPU {1B33EC41-F711-4111-8818-FEEBC9A0BD8D}.Release|Any CPU.Build.0 = Release|Any CPU - {AD117F41-062A-4158-A17D-3375820A53FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD117F41-062A-4158-A17D-3375820A53FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD117F41-062A-4158-A17D-3375820A53FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD117F41-062A-4158-A17D-3375820A53FA}.Release|Any CPU.Build.0 = Release|Any CPU {BF5E5B5A-AC50-4FF1-AADB-0DFC1AA8E429}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF5E5B5A-AC50-4FF1-AADB-0DFC1AA8E429}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF5E5B5A-AC50-4FF1-AADB-0DFC1AA8E429}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -259,7 +251,6 @@ Global {F3F1AF4B-963B-4DCC-80AF-11DFEB652D8D} = {F3BAE0A3-1AF5-4F38-ADBE-6FEC99664322} {ED51A791-65BB-4F8B-B76C-769D0663D4A7} = {F3BAE0A3-1AF5-4F38-ADBE-6FEC99664322} {D3E483FC-DF73-4CD8-AFAA-1DA752F49304} = {F3BAE0A3-1AF5-4F38-ADBE-6FEC99664322} - {AD117F41-062A-4158-A17D-3375820A53FA} = {F3BAE0A3-1AF5-4F38-ADBE-6FEC99664322} {BF5E5B5A-AC50-4FF1-AADB-0DFC1AA8E429} = {F3BAE0A3-1AF5-4F38-ADBE-6FEC99664322} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/libraries/Microsoft.Extensions.Logging.Debug/Microsoft.Extensions.Logging.Debug.sln b/src/libraries/Microsoft.Extensions.Logging.Debug/Microsoft.Extensions.Logging.Debug.sln index 255b413c6450bc..99d30d9127f861 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Debug/Microsoft.Extensions.Logging.Debug.sln +++ b/src/libraries/Microsoft.Extensions.Logging.Debug/Microsoft.Extensions.Logging.Debug.sln @@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Depend EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection", "..\Microsoft.Extensions.DependencyInjection\src\Microsoft.Extensions.DependencyInjection.csproj", "{850FBE78-DE29-480D-B4EE-6D260B0341B4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{3FB47333-590F-417A-832D-83CD81BAA4E1}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{16E075F3-372C-4A98-BDAF-FF615B8A9855}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{3DDCFBB7-A438-46BB-9094-A1A39060DD2A}" diff --git a/src/libraries/Microsoft.Extensions.Logging.EventLog/Microsoft.Extensions.Logging.EventLog.sln b/src/libraries/Microsoft.Extensions.Logging.EventLog/Microsoft.Extensions.Logging.EventLog.sln index f902c80971692d..15164504862054 100644 --- a/src/libraries/Microsoft.Extensions.Logging.EventLog/Microsoft.Extensions.Logging.EventLog.sln +++ b/src/libraries/Microsoft.Extensions.Logging.EventLog/Microsoft.Extensions.Logging.EventLog.sln @@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Depend EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection", "..\Microsoft.Extensions.DependencyInjection\src\Microsoft.Extensions.DependencyInjection.csproj", "{62D0B220-DABD-4C56-A0E2-640D74465328}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{AF5C6565-09EE-4E1F-A146-72785C0FF66F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{B1BE2665-7E3F-46FB-BCE1-774D5984F76C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{6C2850C7-56F0-4DCF-BFBF-4365DE2FC439}" diff --git a/src/libraries/Microsoft.Extensions.Logging.EventSource/Microsoft.Extensions.Logging.EventSource.sln b/src/libraries/Microsoft.Extensions.Logging.EventSource/Microsoft.Extensions.Logging.EventSource.sln index 5a6064ddaabe48..a35664f1b47212 100644 --- a/src/libraries/Microsoft.Extensions.Logging.EventSource/Microsoft.Extensions.Logging.EventSource.sln +++ b/src/libraries/Microsoft.Extensions.Logging.EventSource/Microsoft.Extensions.Logging.EventSource.sln @@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Depend EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection", "..\Microsoft.Extensions.DependencyInjection\src\Microsoft.Extensions.DependencyInjection.csproj", "{7834A5FC-A39B-4435-9D8C-2EEABFFA7A84}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{0C1BD2DA-FA39-458E-8BCB-0D73231C43D3}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{F5B4A3CF-03B5-40A2-BE78-DA6230270113}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{F4A703F8-3D69-4113-A86F-9AD908086092}" @@ -45,8 +43,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{50CC33E5-CB2C-4CFB-9CDE-BBD41B30FB86}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{4BF31DFE-A930-499C-B696-BB1958C08089}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{5A956452-F322-4C4F-8689-D2B425764293}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{5A06587C-82E8-4B40-9C0A-DD06CB986625}" @@ -153,10 +149,6 @@ Global {50CC33E5-CB2C-4CFB-9CDE-BBD41B30FB86}.Debug|Any CPU.Build.0 = Debug|Any CPU {50CC33E5-CB2C-4CFB-9CDE-BBD41B30FB86}.Release|Any CPU.ActiveCfg = Release|Any CPU {50CC33E5-CB2C-4CFB-9CDE-BBD41B30FB86}.Release|Any CPU.Build.0 = Release|Any CPU - {4BF31DFE-A930-499C-B696-BB1958C08089}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4BF31DFE-A930-499C-B696-BB1958C08089}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4BF31DFE-A930-499C-B696-BB1958C08089}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4BF31DFE-A930-499C-B696-BB1958C08089}.Release|Any CPU.Build.0 = Release|Any CPU {EF689C53-9B62-4E17-B412-92FAD527FA59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EF689C53-9B62-4E17-B412-92FAD527FA59}.Debug|Any CPU.Build.0 = Debug|Any CPU {EF689C53-9B62-4E17-B412-92FAD527FA59}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -190,7 +182,6 @@ Global {0C1BD2DA-FA39-458E-8BCB-0D73231C43D3} = {887BF6A4-CB22-4DF4-8E24-A1B267161ECB} {23F45D4C-4E33-4334-A5BF-D34E24165E0B} = {887BF6A4-CB22-4DF4-8E24-A1B267161ECB} {50CC33E5-CB2C-4CFB-9CDE-BBD41B30FB86} = {887BF6A4-CB22-4DF4-8E24-A1B267161ECB} - {4BF31DFE-A930-499C-B696-BB1958C08089} = {887BF6A4-CB22-4DF4-8E24-A1B267161ECB} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {67B715CE-2E67-4605-BFB0-CA65F345C3A5} diff --git a/src/libraries/Microsoft.Extensions.Logging.TraceSource/Microsoft.Extensions.Logging.TraceSource.sln b/src/libraries/Microsoft.Extensions.Logging.TraceSource/Microsoft.Extensions.Logging.TraceSource.sln index bcfcc830a1c42d..0520a0c4137b8b 100644 --- a/src/libraries/Microsoft.Extensions.Logging.TraceSource/Microsoft.Extensions.Logging.TraceSource.sln +++ b/src/libraries/Microsoft.Extensions.Logging.TraceSource/Microsoft.Extensions.Logging.TraceSource.sln @@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Depend EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection", "..\Microsoft.Extensions.DependencyInjection\src\Microsoft.Extensions.DependencyInjection.csproj", "{A64CC82B-B781-4469-B009-49A43A0A2A96}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{F4DE0466-D21E-4CAF-9307-999478A64D5B}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{367922CE-A24E-4977-89BE-D1F2F678F8B2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{F63AB9DB-6E62-4FEC-BA06-E146615C08AC}" diff --git a/src/libraries/Microsoft.Extensions.Logging/Microsoft.Extensions.Logging.sln b/src/libraries/Microsoft.Extensions.Logging/Microsoft.Extensions.Logging.sln index 056d8c4141fcaa..99cbfceba7692c 100644 --- a/src/libraries/Microsoft.Extensions.Logging/Microsoft.Extensions.Logging.sln +++ b/src/libraries/Microsoft.Extensions.Logging/Microsoft.Extensions.Logging.sln @@ -49,8 +49,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.FileSy EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.FileSystemGlobbing", "..\Microsoft.Extensions.FileSystemGlobbing\src\Microsoft.Extensions.FileSystemGlobbing.csproj", "{7C562B37-19E5-44BE-85D5-15FFA9FAEF5A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{56A5DED2-47C2-4938-931E-B896A6BDDA0D}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{5CC86773-7762-4FB7-9B6E-F4002F286AD4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{4BEF5648-8DBF-4E16-B6E6-6F80694E140D}" @@ -113,8 +111,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{B5B30447-25D0-42C0-920A-092247C95664}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{B4313086-0B16-4A80-BA04-964F64745DC2}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{34C22E86-B0A3-457D-B8D9-7CF47AAF2570}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Threading.AccessControl", "..\System.Threading.AccessControl\ref\System.Threading.AccessControl.csproj", "{5FF1A443-F491-428F-9121-51523AA65052}" @@ -229,10 +225,6 @@ Global {7C562B37-19E5-44BE-85D5-15FFA9FAEF5A}.Debug|Any CPU.Build.0 = Debug|Any CPU {7C562B37-19E5-44BE-85D5-15FFA9FAEF5A}.Release|Any CPU.ActiveCfg = Release|Any CPU {7C562B37-19E5-44BE-85D5-15FFA9FAEF5A}.Release|Any CPU.Build.0 = Release|Any CPU - {56A5DED2-47C2-4938-931E-B896A6BDDA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {56A5DED2-47C2-4938-931E-B896A6BDDA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {56A5DED2-47C2-4938-931E-B896A6BDDA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {56A5DED2-47C2-4938-931E-B896A6BDDA0D}.Release|Any CPU.Build.0 = Release|Any CPU {5CC86773-7762-4FB7-9B6E-F4002F286AD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5CC86773-7762-4FB7-9B6E-F4002F286AD4}.Debug|Any CPU.Build.0 = Debug|Any CPU {5CC86773-7762-4FB7-9B6E-F4002F286AD4}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -357,10 +349,6 @@ Global {B5B30447-25D0-42C0-920A-092247C95664}.Debug|Any CPU.Build.0 = Debug|Any CPU {B5B30447-25D0-42C0-920A-092247C95664}.Release|Any CPU.ActiveCfg = Release|Any CPU {B5B30447-25D0-42C0-920A-092247C95664}.Release|Any CPU.Build.0 = Release|Any CPU - {B4313086-0B16-4A80-BA04-964F64745DC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B4313086-0B16-4A80-BA04-964F64745DC2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B4313086-0B16-4A80-BA04-964F64745DC2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B4313086-0B16-4A80-BA04-964F64745DC2}.Release|Any CPU.Build.0 = Release|Any CPU {34C22E86-B0A3-457D-B8D9-7CF47AAF2570}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {34C22E86-B0A3-457D-B8D9-7CF47AAF2570}.Debug|Any CPU.Build.0 = Debug|Any CPU {34C22E86-B0A3-457D-B8D9-7CF47AAF2570}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -409,7 +397,6 @@ Global {5F0CF40F-D54D-4101-94EA-8FE7F9C843CB} = {D8928AB2-2939-4421-90C5-56B789BF93E5} {F61AC077-D30A-4F65-9831-5F9DC23B3561} = {E70034C8-3FE8-4A9E-9D2C-569FB4AE2AD7} {7C562B37-19E5-44BE-85D5-15FFA9FAEF5A} = {D8928AB2-2939-4421-90C5-56B789BF93E5} - {56A5DED2-47C2-4938-931E-B896A6BDDA0D} = {D8928AB2-2939-4421-90C5-56B789BF93E5} {5CC86773-7762-4FB7-9B6E-F4002F286AD4} = {E70034C8-3FE8-4A9E-9D2C-569FB4AE2AD7} {4BEF5648-8DBF-4E16-B6E6-6F80694E140D} = {D8928AB2-2939-4421-90C5-56B789BF93E5} {E68B2719-B7A0-46F4-A5F0-72BB03BF8167} = {E70034C8-3FE8-4A9E-9D2C-569FB4AE2AD7} @@ -441,7 +428,6 @@ Global {04BA3E3C-6979-4792-B19E-C797AD607F42} = {D8928AB2-2939-4421-90C5-56B789BF93E5} {DDE4AAB2-E249-4A1A-A0CB-4C1AF440B620} = {E70034C8-3FE8-4A9E-9D2C-569FB4AE2AD7} {B5B30447-25D0-42C0-920A-092247C95664} = {D8928AB2-2939-4421-90C5-56B789BF93E5} - {B4313086-0B16-4A80-BA04-964F64745DC2} = {D8928AB2-2939-4421-90C5-56B789BF93E5} {34C22E86-B0A3-457D-B8D9-7CF47AAF2570} = {D8928AB2-2939-4421-90C5-56B789BF93E5} {5FF1A443-F491-428F-9121-51523AA65052} = {E70034C8-3FE8-4A9E-9D2C-569FB4AE2AD7} {504464B5-B163-4D6B-A113-52DDC78A401D} = {D8928AB2-2939-4421-90C5-56B789BF93E5} diff --git a/src/libraries/Microsoft.Extensions.Options/Microsoft.Extensions.Options.sln b/src/libraries/Microsoft.Extensions.Options/Microsoft.Extensions.Options.sln index 20100a69c0f5a0..8271c101f02c72 100644 --- a/src/libraries/Microsoft.Extensions.Options/Microsoft.Extensions.Options.sln +++ b/src/libraries/Microsoft.Extensions.Options/Microsoft.Extensions.Options.sln @@ -65,8 +65,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hostin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hosting", "..\Microsoft.Extensions.Hosting\src\Microsoft.Extensions.Hosting.csproj", "{6AD51705-102E-4E9D-B62E-6BF19025F3A7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Generators", "..\Microsoft.Extensions.Logging.Abstractions\gen\Microsoft.Extensions.Logging.Generators.csproj", "{0641221C-4409-4805-8CA4-4023809D5AD1}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\ref\Microsoft.Extensions.Logging.Abstractions.csproj", "{EFFB59C1-CAF4-4347-B996-4C773E1AFAA8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Abstractions", "..\Microsoft.Extensions.Logging.Abstractions\src\Microsoft.Extensions.Logging.Abstractions.csproj", "{56D37CB2-68A3-42D3-AA0E-416813ABAD8B}" @@ -131,8 +129,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{59D31D62-3BF9-4F4A-9FF7-3A61F297F714}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{850A0E3B-1C09-40EF-8F3E-D61D93663C4E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{D7CEC738-5D2D-4FCB-9268-9650EB01BF31}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Threading.AccessControl", "..\System.Threading.AccessControl\ref\System.Threading.AccessControl.csproj", "{39D50C3D-609B-4B4E-955F-252E469A55C9}" @@ -401,10 +397,6 @@ Global {6F7512BA-9B15-4395-AE05-C546F0770344}.Debug|Any CPU.Build.0 = Debug|Any CPU {6F7512BA-9B15-4395-AE05-C546F0770344}.Release|Any CPU.ActiveCfg = Release|Any CPU {6F7512BA-9B15-4395-AE05-C546F0770344}.Release|Any CPU.Build.0 = Release|Any CPU - {850A0E3B-1C09-40EF-8F3E-D61D93663C4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {850A0E3B-1C09-40EF-8F3E-D61D93663C4E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {850A0E3B-1C09-40EF-8F3E-D61D93663C4E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {850A0E3B-1C09-40EF-8F3E-D61D93663C4E}.Release|Any CPU.Build.0 = Release|Any CPU {59D31D62-3BF9-4F4A-9FF7-3A61F297F714}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {59D31D62-3BF9-4F4A-9FF7-3A61F297F714}.Debug|Any CPU.Build.0 = Debug|Any CPU {59D31D62-3BF9-4F4A-9FF7-3A61F297F714}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -509,7 +501,6 @@ Global {429C9D71-4BBD-489D-9C86-EC240F652008} = {7028EE0A-D314-4F48-91CA-51A1633BC3F4} {0641221C-4409-4805-8CA4-4023809D5AD1} = {7028EE0A-D314-4F48-91CA-51A1633BC3F4} {9175023F-6982-45CD-B360-C4FC1E145B25} = {7028EE0A-D314-4F48-91CA-51A1633BC3F4} - {850A0E3B-1C09-40EF-8F3E-D61D93663C4E} = {7028EE0A-D314-4F48-91CA-51A1633BC3F4} {59D31D62-3BF9-4F4A-9FF7-3A61F297F714} = {7028EE0A-D314-4F48-91CA-51A1633BC3F4} {B82AF93C-33D7-4B48-B36E-A9873D74601C} = {7028EE0A-D314-4F48-91CA-51A1633BC3F4} {99007CDD-4840-4B94-8A8A-FECF72BCEE3F} = {7028EE0A-D314-4F48-91CA-51A1633BC3F4} diff --git a/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj b/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj index 674d785cb7e8bb..f86b4eda02cc0d 100644 --- a/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj +++ b/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj @@ -1,6 +1,8 @@  true + true + 1 Downlevel support package for System.IO classes. $(DefineConstants);MS_IO_REDIST true @@ -108,6 +110,10 @@ Link="Interop\Windows\Interop.GetTempFileNameW.cs" /> + + + $(NetCoreAppCurrent) false @@ -13,6 +13,8 @@ Internal transport package to provide aspnetcore with the assemblies from dotnet/runtime that make up the Microsoft.AspNetCore.App shared framework. $(NoWarn);NU5131 + true + $(PatchVersion) @@ -20,6 +22,7 @@ - + + diff --git a/src/libraries/Microsoft.Internal.Runtime.WindowsDesktop.Transport/src/Microsoft.Internal.Runtime.WindowsDesktop.Transport.proj b/src/libraries/Microsoft.Internal.Runtime.WindowsDesktop.Transport/src/Microsoft.Internal.Runtime.WindowsDesktop.Transport.proj index fa9dc31e8edfa7..b32a72e59f1a4e 100644 --- a/src/libraries/Microsoft.Internal.Runtime.WindowsDesktop.Transport/src/Microsoft.Internal.Runtime.WindowsDesktop.Transport.proj +++ b/src/libraries/Microsoft.Internal.Runtime.WindowsDesktop.Transport/src/Microsoft.Internal.Runtime.WindowsDesktop.Transport.proj @@ -8,15 +8,24 @@ true false none - + true Internal transport package to provide windowsdesktop with the assemblies from dotnet/runtime that make up the Microsoft.WindowsDesktop.App shared framework. $(NoWarn);NU5131 + true + $(PatchVersion) - - + + diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs b/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs index 1421200ead56ae..af12041e8cb20e 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs +++ b/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs @@ -344,7 +344,7 @@ private static IDictionary> ReadCompatibilityMap(str { var serializer = new JsonSerializer(); using (var file = File.OpenText(mapFile)) - using (var jsonTextReader = new JsonTextReader(file)) + using (var jsonTextReader = new JsonTextReader(file) { MaxDepth = null }) { return serializer.Deserialize>>(jsonTextReader); } diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj b/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj index 71cf1e98a1c5c0..696bcf801b2f84 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj +++ b/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj @@ -1,12 +1,11 @@ - + - $(NetCoreAppToolCurrent);net472 + $(NetCoreAppToolCurrent);$(NetFrameworkToolCurrent) false $(MSBuildProjectName) true Microsoft.NETCore.Platforms.BuildTasks - false true @@ -16,12 +15,14 @@ true $(NoWarn);NU5128 Provides runtime information required to resolve target framework, platform, and runtime specific implementations of .NETCore packages. - + $(AdditionalRuntimeIdentifiers);$(OutputRID) + 13 + false - + @@ -39,24 +40,24 @@ - + - - - + + + - + - + diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs b/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs index 6f08d1a510e567..42ce8b4e9631ae 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs +++ b/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs @@ -56,7 +56,7 @@ private enum RIDPart : int Max = Qualifier } - public static RID Parse(string runtimeIdentifier) + public static RID Parse(string runtimeIdentifier, bool noQualifier) { string[] parts = new string[(int)RIDPart.Max + 1]; bool omitVersionDelimiter = true; @@ -90,6 +90,15 @@ public static RID Parse(string runtimeIdentifier) // version might be omitted else if (current == ArchitectureDelimiter) { + // The qualifier delimiter and architecture delimiter are the same. + // When there is no qualifier, there will be one delimiter past the base part + // for the architecture. + // So if we see another delimiter later in the string (for the architecture), + // extend the base part instead of starting the architecture part. + if (noQualifier && runtimeIdentifier.IndexOf(ArchitectureDelimiter, i + 1) != -1) + { + break; + } // ensure there's no version later in the string if (runtimeIdentifier.IndexOf(VersionDelimiter, i) != -1) { diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs b/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs index 970da5c1f86652..5c2f0c42078f99 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs +++ b/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs @@ -34,7 +34,8 @@ public RuntimeGroupCollection(ICollection runtimeGroups) /// public void AddRuntimeIdentifier(string runtimeIdentifier, string parent) { - RID rid = RID.Parse(runtimeIdentifier); + // don't parse qualifier since we don't use them and they are ambiguous with `-` in base RID + RID rid = RID.Parse(runtimeIdentifier, noQualifier: true); AddRuntimeIdentifier(rid, parent); } diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json index 1617ecf4dab272..a1397baaf8fdef 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json +++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json @@ -31,6 +31,18 @@ "any", "base" ], + "alpine-s390x": [ + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], "alpine-x64": [ "alpine-x64", "alpine", @@ -43,6 +55,18 @@ "any", "base" ], + "alpine-x86": [ + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "alpine.3.10": [ "alpine.3.10", "alpine.3.9", @@ -100,6 +124,28 @@ "any", "base" ], + "alpine.3.10-s390x": [ + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], "alpine.3.10-x64": [ "alpine.3.10-x64", "alpine.3.10", @@ -122,6 +168,28 @@ "any", "base" ], + "alpine.3.10-x86": [ + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "alpine.3.11": [ "alpine.3.11", "alpine.3.10", @@ -184,6 +252,30 @@ "any", "base" ], + "alpine.3.11-s390x": [ + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], "alpine.3.11-x64": [ "alpine.3.11-x64", "alpine.3.11", @@ -208,6 +300,30 @@ "any", "base" ], + "alpine.3.11-x86": [ + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "alpine.3.12": [ "alpine.3.12", "alpine.3.11", @@ -275,6 +391,32 @@ "any", "base" ], + "alpine.3.12-s390x": [ + "alpine.3.12-s390x", + "alpine.3.12", + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], "alpine.3.12-x64": [ "alpine.3.12-x64", "alpine.3.12", @@ -301,6 +443,32 @@ "any", "base" ], + "alpine.3.12-x86": [ + "alpine.3.12-x86", + "alpine.3.12", + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "alpine.3.13": [ "alpine.3.13", "alpine.3.12", @@ -373,6 +541,34 @@ "any", "base" ], + "alpine.3.13-s390x": [ + "alpine.3.13-s390x", + "alpine.3.13", + "alpine.3.12-s390x", + "alpine.3.12", + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], "alpine.3.13-x64": [ "alpine.3.13-x64", "alpine.3.13", @@ -401,6 +597,34 @@ "any", "base" ], + "alpine.3.13-x86": [ + "alpine.3.13-x86", + "alpine.3.13", + "alpine.3.12-x86", + "alpine.3.12", + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "alpine.3.14": [ "alpine.3.14", "alpine.3.13", @@ -478,6 +702,36 @@ "any", "base" ], + "alpine.3.14-s390x": [ + "alpine.3.14-s390x", + "alpine.3.14", + "alpine.3.13-s390x", + "alpine.3.13", + "alpine.3.12-s390x", + "alpine.3.12", + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], "alpine.3.14-x64": [ "alpine.3.14-x64", "alpine.3.14", @@ -508,16 +762,73 @@ "any", "base" ], - "alpine.3.6": [ + "alpine.3.14-x86": [ + "alpine.3.14-x86", + "alpine.3.14", + "alpine.3.13-x86", + "alpine.3.13", + "alpine.3.12-x86", + "alpine.3.12", + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", "alpine.3.6", + "alpine-x86", "alpine", + "linux-musl-x86", "linux-musl", + "linux-x86", "linux", + "unix-x86", "unix", "any", "base" ], - "alpine.3.6-arm": [ + "alpine.3.15": [ + "alpine.3.15", + "alpine.3.14", + "alpine.3.13", + "alpine.3.12", + "alpine.3.11", + "alpine.3.10", + "alpine.3.9", + "alpine.3.8", + "alpine.3.7", + "alpine.3.6", + "alpine", + "linux-musl", + "linux", + "unix", + "any", + "base" + ], + "alpine.3.15-arm": [ + "alpine.3.15-arm", + "alpine.3.15", + "alpine.3.14-arm", + "alpine.3.14", + "alpine.3.13-arm", + "alpine.3.13", + "alpine.3.12-arm", + "alpine.3.12", + "alpine.3.11-arm", + "alpine.3.11", + "alpine.3.10-arm", + "alpine.3.10", + "alpine.3.9-arm", + "alpine.3.9", + "alpine.3.8-arm", + "alpine.3.8", + "alpine.3.7-arm", + "alpine.3.7", "alpine.3.6-arm", "alpine.3.6", "alpine-arm", @@ -531,7 +842,25 @@ "any", "base" ], - "alpine.3.6-arm64": [ + "alpine.3.15-arm64": [ + "alpine.3.15-arm64", + "alpine.3.15", + "alpine.3.14-arm64", + "alpine.3.14", + "alpine.3.13-arm64", + "alpine.3.13", + "alpine.3.12-arm64", + "alpine.3.12", + "alpine.3.11-arm64", + "alpine.3.11", + "alpine.3.10-arm64", + "alpine.3.10", + "alpine.3.9-arm64", + "alpine.3.9", + "alpine.3.8-arm64", + "alpine.3.8", + "alpine.3.7-arm64", + "alpine.3.7", "alpine.3.6-arm64", "alpine.3.6", "alpine-arm64", @@ -545,26 +874,1242 @@ "any", "base" ], - "alpine.3.6-x64": [ - "alpine.3.6-x64", + "alpine.3.15-s390x": [ + "alpine.3.15-s390x", + "alpine.3.15", + "alpine.3.14-s390x", + "alpine.3.14", + "alpine.3.13-s390x", + "alpine.3.13", + "alpine.3.12-s390x", + "alpine.3.12", + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", "alpine.3.6", - "alpine-x64", + "alpine-s390x", "alpine", - "linux-musl-x64", + "linux-musl-s390x", "linux-musl", - "linux-x64", + "linux-s390x", "linux", - "unix-x64", + "unix-s390x", "unix", "any", "base" ], - "alpine.3.7": [ - "alpine.3.7", - "alpine.3.6", - "alpine", - "linux-musl", - "linux", + "alpine.3.15-x64": [ + "alpine.3.15-x64", + "alpine.3.15", + "alpine.3.14-x64", + "alpine.3.14", + "alpine.3.13-x64", + "alpine.3.13", + "alpine.3.12-x64", + "alpine.3.12", + "alpine.3.11-x64", + "alpine.3.11", + "alpine.3.10-x64", + "alpine.3.10", + "alpine.3.9-x64", + "alpine.3.9", + "alpine.3.8-x64", + "alpine.3.8", + "alpine.3.7-x64", + "alpine.3.7", + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64", + "alpine", + "linux-musl-x64", + "linux-musl", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "alpine.3.15-x86": [ + "alpine.3.15-x86", + "alpine.3.15", + "alpine.3.14-x86", + "alpine.3.14", + "alpine.3.13-x86", + "alpine.3.13", + "alpine.3.12-x86", + "alpine.3.12", + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "alpine.3.16": [ + "alpine.3.16", + "alpine.3.15", + "alpine.3.14", + "alpine.3.13", + "alpine.3.12", + "alpine.3.11", + "alpine.3.10", + "alpine.3.9", + "alpine.3.8", + "alpine.3.7", + "alpine.3.6", + "alpine", + "linux-musl", + "linux", + "unix", + "any", + "base" + ], + "alpine.3.16-arm": [ + "alpine.3.16-arm", + "alpine.3.16", + "alpine.3.15-arm", + "alpine.3.15", + "alpine.3.14-arm", + "alpine.3.14", + "alpine.3.13-arm", + "alpine.3.13", + "alpine.3.12-arm", + "alpine.3.12", + "alpine.3.11-arm", + "alpine.3.11", + "alpine.3.10-arm", + "alpine.3.10", + "alpine.3.9-arm", + "alpine.3.9", + "alpine.3.8-arm", + "alpine.3.8", + "alpine.3.7-arm", + "alpine.3.7", + "alpine.3.6-arm", + "alpine.3.6", + "alpine-arm", + "alpine", + "linux-musl-arm", + "linux-musl", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "alpine.3.16-arm64": [ + "alpine.3.16-arm64", + "alpine.3.16", + "alpine.3.15-arm64", + "alpine.3.15", + "alpine.3.14-arm64", + "alpine.3.14", + "alpine.3.13-arm64", + "alpine.3.13", + "alpine.3.12-arm64", + "alpine.3.12", + "alpine.3.11-arm64", + "alpine.3.11", + "alpine.3.10-arm64", + "alpine.3.10", + "alpine.3.9-arm64", + "alpine.3.9", + "alpine.3.8-arm64", + "alpine.3.8", + "alpine.3.7-arm64", + "alpine.3.7", + "alpine.3.6-arm64", + "alpine.3.6", + "alpine-arm64", + "alpine", + "linux-musl-arm64", + "linux-musl", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "alpine.3.16-s390x": [ + "alpine.3.16-s390x", + "alpine.3.16", + "alpine.3.15-s390x", + "alpine.3.15", + "alpine.3.14-s390x", + "alpine.3.14", + "alpine.3.13-s390x", + "alpine.3.13", + "alpine.3.12-s390x", + "alpine.3.12", + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], + "alpine.3.16-x64": [ + "alpine.3.16-x64", + "alpine.3.16", + "alpine.3.15-x64", + "alpine.3.15", + "alpine.3.14-x64", + "alpine.3.14", + "alpine.3.13-x64", + "alpine.3.13", + "alpine.3.12-x64", + "alpine.3.12", + "alpine.3.11-x64", + "alpine.3.11", + "alpine.3.10-x64", + "alpine.3.10", + "alpine.3.9-x64", + "alpine.3.9", + "alpine.3.8-x64", + "alpine.3.8", + "alpine.3.7-x64", + "alpine.3.7", + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64", + "alpine", + "linux-musl-x64", + "linux-musl", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "alpine.3.16-x86": [ + "alpine.3.16-x86", + "alpine.3.16", + "alpine.3.15-x86", + "alpine.3.15", + "alpine.3.14-x86", + "alpine.3.14", + "alpine.3.13-x86", + "alpine.3.13", + "alpine.3.12-x86", + "alpine.3.12", + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "alpine.3.17": [ + "alpine.3.17", + "alpine.3.16", + "alpine.3.15", + "alpine.3.14", + "alpine.3.13", + "alpine.3.12", + "alpine.3.11", + "alpine.3.10", + "alpine.3.9", + "alpine.3.8", + "alpine.3.7", + "alpine.3.6", + "alpine", + "linux-musl", + "linux", + "unix", + "any", + "base" + ], + "alpine.3.17-arm": [ + "alpine.3.17-arm", + "alpine.3.17", + "alpine.3.16-arm", + "alpine.3.16", + "alpine.3.15-arm", + "alpine.3.15", + "alpine.3.14-arm", + "alpine.3.14", + "alpine.3.13-arm", + "alpine.3.13", + "alpine.3.12-arm", + "alpine.3.12", + "alpine.3.11-arm", + "alpine.3.11", + "alpine.3.10-arm", + "alpine.3.10", + "alpine.3.9-arm", + "alpine.3.9", + "alpine.3.8-arm", + "alpine.3.8", + "alpine.3.7-arm", + "alpine.3.7", + "alpine.3.6-arm", + "alpine.3.6", + "alpine-arm", + "alpine", + "linux-musl-arm", + "linux-musl", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "alpine.3.17-arm64": [ + "alpine.3.17-arm64", + "alpine.3.17", + "alpine.3.16-arm64", + "alpine.3.16", + "alpine.3.15-arm64", + "alpine.3.15", + "alpine.3.14-arm64", + "alpine.3.14", + "alpine.3.13-arm64", + "alpine.3.13", + "alpine.3.12-arm64", + "alpine.3.12", + "alpine.3.11-arm64", + "alpine.3.11", + "alpine.3.10-arm64", + "alpine.3.10", + "alpine.3.9-arm64", + "alpine.3.9", + "alpine.3.8-arm64", + "alpine.3.8", + "alpine.3.7-arm64", + "alpine.3.7", + "alpine.3.6-arm64", + "alpine.3.6", + "alpine-arm64", + "alpine", + "linux-musl-arm64", + "linux-musl", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "alpine.3.17-s390x": [ + "alpine.3.17-s390x", + "alpine.3.17", + "alpine.3.16-s390x", + "alpine.3.16", + "alpine.3.15-s390x", + "alpine.3.15", + "alpine.3.14-s390x", + "alpine.3.14", + "alpine.3.13-s390x", + "alpine.3.13", + "alpine.3.12-s390x", + "alpine.3.12", + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], + "alpine.3.17-x64": [ + "alpine.3.17-x64", + "alpine.3.17", + "alpine.3.16-x64", + "alpine.3.16", + "alpine.3.15-x64", + "alpine.3.15", + "alpine.3.14-x64", + "alpine.3.14", + "alpine.3.13-x64", + "alpine.3.13", + "alpine.3.12-x64", + "alpine.3.12", + "alpine.3.11-x64", + "alpine.3.11", + "alpine.3.10-x64", + "alpine.3.10", + "alpine.3.9-x64", + "alpine.3.9", + "alpine.3.8-x64", + "alpine.3.8", + "alpine.3.7-x64", + "alpine.3.7", + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64", + "alpine", + "linux-musl-x64", + "linux-musl", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "alpine.3.17-x86": [ + "alpine.3.17-x86", + "alpine.3.17", + "alpine.3.16-x86", + "alpine.3.16", + "alpine.3.15-x86", + "alpine.3.15", + "alpine.3.14-x86", + "alpine.3.14", + "alpine.3.13-x86", + "alpine.3.13", + "alpine.3.12-x86", + "alpine.3.12", + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "alpine.3.18": [ + "alpine.3.18", + "alpine.3.17", + "alpine.3.16", + "alpine.3.15", + "alpine.3.14", + "alpine.3.13", + "alpine.3.12", + "alpine.3.11", + "alpine.3.10", + "alpine.3.9", + "alpine.3.8", + "alpine.3.7", + "alpine.3.6", + "alpine", + "linux-musl", + "linux", + "unix", + "any", + "base" + ], + "alpine.3.18-arm": [ + "alpine.3.18-arm", + "alpine.3.18", + "alpine.3.17-arm", + "alpine.3.17", + "alpine.3.16-arm", + "alpine.3.16", + "alpine.3.15-arm", + "alpine.3.15", + "alpine.3.14-arm", + "alpine.3.14", + "alpine.3.13-arm", + "alpine.3.13", + "alpine.3.12-arm", + "alpine.3.12", + "alpine.3.11-arm", + "alpine.3.11", + "alpine.3.10-arm", + "alpine.3.10", + "alpine.3.9-arm", + "alpine.3.9", + "alpine.3.8-arm", + "alpine.3.8", + "alpine.3.7-arm", + "alpine.3.7", + "alpine.3.6-arm", + "alpine.3.6", + "alpine-arm", + "alpine", + "linux-musl-arm", + "linux-musl", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "alpine.3.18-arm64": [ + "alpine.3.18-arm64", + "alpine.3.18", + "alpine.3.17-arm64", + "alpine.3.17", + "alpine.3.16-arm64", + "alpine.3.16", + "alpine.3.15-arm64", + "alpine.3.15", + "alpine.3.14-arm64", + "alpine.3.14", + "alpine.3.13-arm64", + "alpine.3.13", + "alpine.3.12-arm64", + "alpine.3.12", + "alpine.3.11-arm64", + "alpine.3.11", + "alpine.3.10-arm64", + "alpine.3.10", + "alpine.3.9-arm64", + "alpine.3.9", + "alpine.3.8-arm64", + "alpine.3.8", + "alpine.3.7-arm64", + "alpine.3.7", + "alpine.3.6-arm64", + "alpine.3.6", + "alpine-arm64", + "alpine", + "linux-musl-arm64", + "linux-musl", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "alpine.3.18-s390x": [ + "alpine.3.18-s390x", + "alpine.3.18", + "alpine.3.17-s390x", + "alpine.3.17", + "alpine.3.16-s390x", + "alpine.3.16", + "alpine.3.15-s390x", + "alpine.3.15", + "alpine.3.14-s390x", + "alpine.3.14", + "alpine.3.13-s390x", + "alpine.3.13", + "alpine.3.12-s390x", + "alpine.3.12", + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], + "alpine.3.18-x64": [ + "alpine.3.18-x64", + "alpine.3.18", + "alpine.3.17-x64", + "alpine.3.17", + "alpine.3.16-x64", + "alpine.3.16", + "alpine.3.15-x64", + "alpine.3.15", + "alpine.3.14-x64", + "alpine.3.14", + "alpine.3.13-x64", + "alpine.3.13", + "alpine.3.12-x64", + "alpine.3.12", + "alpine.3.11-x64", + "alpine.3.11", + "alpine.3.10-x64", + "alpine.3.10", + "alpine.3.9-x64", + "alpine.3.9", + "alpine.3.8-x64", + "alpine.3.8", + "alpine.3.7-x64", + "alpine.3.7", + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64", + "alpine", + "linux-musl-x64", + "linux-musl", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "alpine.3.18-x86": [ + "alpine.3.18-x86", + "alpine.3.18", + "alpine.3.17-x86", + "alpine.3.17", + "alpine.3.16-x86", + "alpine.3.16", + "alpine.3.15-x86", + "alpine.3.15", + "alpine.3.14-x86", + "alpine.3.14", + "alpine.3.13-x86", + "alpine.3.13", + "alpine.3.12-x86", + "alpine.3.12", + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "alpine.3.19": [ + "alpine.3.19", + "alpine.3.18", + "alpine.3.17", + "alpine.3.16", + "alpine.3.15", + "alpine.3.14", + "alpine.3.13", + "alpine.3.12", + "alpine.3.11", + "alpine.3.10", + "alpine.3.9", + "alpine.3.8", + "alpine.3.7", + "alpine.3.6", + "alpine", + "linux-musl", + "linux", + "unix", + "any", + "base" + ], + "alpine.3.19-arm": [ + "alpine.3.19-arm", + "alpine.3.19", + "alpine.3.18-arm", + "alpine.3.18", + "alpine.3.17-arm", + "alpine.3.17", + "alpine.3.16-arm", + "alpine.3.16", + "alpine.3.15-arm", + "alpine.3.15", + "alpine.3.14-arm", + "alpine.3.14", + "alpine.3.13-arm", + "alpine.3.13", + "alpine.3.12-arm", + "alpine.3.12", + "alpine.3.11-arm", + "alpine.3.11", + "alpine.3.10-arm", + "alpine.3.10", + "alpine.3.9-arm", + "alpine.3.9", + "alpine.3.8-arm", + "alpine.3.8", + "alpine.3.7-arm", + "alpine.3.7", + "alpine.3.6-arm", + "alpine.3.6", + "alpine-arm", + "alpine", + "linux-musl-arm", + "linux-musl", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "alpine.3.19-arm64": [ + "alpine.3.19-arm64", + "alpine.3.19", + "alpine.3.18-arm64", + "alpine.3.18", + "alpine.3.17-arm64", + "alpine.3.17", + "alpine.3.16-arm64", + "alpine.3.16", + "alpine.3.15-arm64", + "alpine.3.15", + "alpine.3.14-arm64", + "alpine.3.14", + "alpine.3.13-arm64", + "alpine.3.13", + "alpine.3.12-arm64", + "alpine.3.12", + "alpine.3.11-arm64", + "alpine.3.11", + "alpine.3.10-arm64", + "alpine.3.10", + "alpine.3.9-arm64", + "alpine.3.9", + "alpine.3.8-arm64", + "alpine.3.8", + "alpine.3.7-arm64", + "alpine.3.7", + "alpine.3.6-arm64", + "alpine.3.6", + "alpine-arm64", + "alpine", + "linux-musl-arm64", + "linux-musl", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "alpine.3.19-s390x": [ + "alpine.3.19-s390x", + "alpine.3.19", + "alpine.3.18-s390x", + "alpine.3.18", + "alpine.3.17-s390x", + "alpine.3.17", + "alpine.3.16-s390x", + "alpine.3.16", + "alpine.3.15-s390x", + "alpine.3.15", + "alpine.3.14-s390x", + "alpine.3.14", + "alpine.3.13-s390x", + "alpine.3.13", + "alpine.3.12-s390x", + "alpine.3.12", + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], + "alpine.3.19-x64": [ + "alpine.3.19-x64", + "alpine.3.19", + "alpine.3.18-x64", + "alpine.3.18", + "alpine.3.17-x64", + "alpine.3.17", + "alpine.3.16-x64", + "alpine.3.16", + "alpine.3.15-x64", + "alpine.3.15", + "alpine.3.14-x64", + "alpine.3.14", + "alpine.3.13-x64", + "alpine.3.13", + "alpine.3.12-x64", + "alpine.3.12", + "alpine.3.11-x64", + "alpine.3.11", + "alpine.3.10-x64", + "alpine.3.10", + "alpine.3.9-x64", + "alpine.3.9", + "alpine.3.8-x64", + "alpine.3.8", + "alpine.3.7-x64", + "alpine.3.7", + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64", + "alpine", + "linux-musl-x64", + "linux-musl", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "alpine.3.19-x86": [ + "alpine.3.19-x86", + "alpine.3.19", + "alpine.3.18-x86", + "alpine.3.18", + "alpine.3.17-x86", + "alpine.3.17", + "alpine.3.16-x86", + "alpine.3.16", + "alpine.3.15-x86", + "alpine.3.15", + "alpine.3.14-x86", + "alpine.3.14", + "alpine.3.13-x86", + "alpine.3.13", + "alpine.3.12-x86", + "alpine.3.12", + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "alpine.3.20": [ + "alpine.3.20", + "alpine.3.19", + "alpine.3.18", + "alpine.3.17", + "alpine.3.16", + "alpine.3.15", + "alpine.3.14", + "alpine.3.13", + "alpine.3.12", + "alpine.3.11", + "alpine.3.10", + "alpine.3.9", + "alpine.3.8", + "alpine.3.7", + "alpine.3.6", + "alpine", + "linux-musl", + "linux", + "unix", + "any", + "base" + ], + "alpine.3.20-arm": [ + "alpine.3.20-arm", + "alpine.3.20", + "alpine.3.19-arm", + "alpine.3.19", + "alpine.3.18-arm", + "alpine.3.18", + "alpine.3.17-arm", + "alpine.3.17", + "alpine.3.16-arm", + "alpine.3.16", + "alpine.3.15-arm", + "alpine.3.15", + "alpine.3.14-arm", + "alpine.3.14", + "alpine.3.13-arm", + "alpine.3.13", + "alpine.3.12-arm", + "alpine.3.12", + "alpine.3.11-arm", + "alpine.3.11", + "alpine.3.10-arm", + "alpine.3.10", + "alpine.3.9-arm", + "alpine.3.9", + "alpine.3.8-arm", + "alpine.3.8", + "alpine.3.7-arm", + "alpine.3.7", + "alpine.3.6-arm", + "alpine.3.6", + "alpine-arm", + "alpine", + "linux-musl-arm", + "linux-musl", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "alpine.3.20-arm64": [ + "alpine.3.20-arm64", + "alpine.3.20", + "alpine.3.19-arm64", + "alpine.3.19", + "alpine.3.18-arm64", + "alpine.3.18", + "alpine.3.17-arm64", + "alpine.3.17", + "alpine.3.16-arm64", + "alpine.3.16", + "alpine.3.15-arm64", + "alpine.3.15", + "alpine.3.14-arm64", + "alpine.3.14", + "alpine.3.13-arm64", + "alpine.3.13", + "alpine.3.12-arm64", + "alpine.3.12", + "alpine.3.11-arm64", + "alpine.3.11", + "alpine.3.10-arm64", + "alpine.3.10", + "alpine.3.9-arm64", + "alpine.3.9", + "alpine.3.8-arm64", + "alpine.3.8", + "alpine.3.7-arm64", + "alpine.3.7", + "alpine.3.6-arm64", + "alpine.3.6", + "alpine-arm64", + "alpine", + "linux-musl-arm64", + "linux-musl", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "alpine.3.20-s390x": [ + "alpine.3.20-s390x", + "alpine.3.20", + "alpine.3.19-s390x", + "alpine.3.19", + "alpine.3.18-s390x", + "alpine.3.18", + "alpine.3.17-s390x", + "alpine.3.17", + "alpine.3.16-s390x", + "alpine.3.16", + "alpine.3.15-s390x", + "alpine.3.15", + "alpine.3.14-s390x", + "alpine.3.14", + "alpine.3.13-s390x", + "alpine.3.13", + "alpine.3.12-s390x", + "alpine.3.12", + "alpine.3.11-s390x", + "alpine.3.11", + "alpine.3.10-s390x", + "alpine.3.10", + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], + "alpine.3.20-x64": [ + "alpine.3.20-x64", + "alpine.3.20", + "alpine.3.19-x64", + "alpine.3.19", + "alpine.3.18-x64", + "alpine.3.18", + "alpine.3.17-x64", + "alpine.3.17", + "alpine.3.16-x64", + "alpine.3.16", + "alpine.3.15-x64", + "alpine.3.15", + "alpine.3.14-x64", + "alpine.3.14", + "alpine.3.13-x64", + "alpine.3.13", + "alpine.3.12-x64", + "alpine.3.12", + "alpine.3.11-x64", + "alpine.3.11", + "alpine.3.10-x64", + "alpine.3.10", + "alpine.3.9-x64", + "alpine.3.9", + "alpine.3.8-x64", + "alpine.3.8", + "alpine.3.7-x64", + "alpine.3.7", + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64", + "alpine", + "linux-musl-x64", + "linux-musl", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "alpine.3.20-x86": [ + "alpine.3.20-x86", + "alpine.3.20", + "alpine.3.19-x86", + "alpine.3.19", + "alpine.3.18-x86", + "alpine.3.18", + "alpine.3.17-x86", + "alpine.3.17", + "alpine.3.16-x86", + "alpine.3.16", + "alpine.3.15-x86", + "alpine.3.15", + "alpine.3.14-x86", + "alpine.3.14", + "alpine.3.13-x86", + "alpine.3.13", + "alpine.3.12-x86", + "alpine.3.12", + "alpine.3.11-x86", + "alpine.3.11", + "alpine.3.10-x86", + "alpine.3.10", + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "alpine.3.6": [ + "alpine.3.6", + "alpine", + "linux-musl", + "linux", + "unix", + "any", + "base" + ], + "alpine.3.6-arm": [ + "alpine.3.6-arm", + "alpine.3.6", + "alpine-arm", + "alpine", + "linux-musl-arm", + "linux-musl", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "alpine.3.6-arm64": [ + "alpine.3.6-arm64", + "alpine.3.6", + "alpine-arm64", + "alpine", + "linux-musl-arm64", + "linux-musl", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "alpine.3.6-s390x": [ + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], + "alpine.3.6-x64": [ + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64", + "alpine", + "linux-musl-x64", + "linux-musl", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "alpine.3.6-x86": [ + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "alpine.3.7": [ + "alpine.3.7", + "alpine.3.6", + "alpine", + "linux-musl", + "linux", "unix", "any", "base" @@ -601,6 +2146,22 @@ "any", "base" ], + "alpine.3.7-s390x": [ + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], "alpine.3.7-x64": [ "alpine.3.7-x64", "alpine.3.7", @@ -617,6 +2178,22 @@ "any", "base" ], + "alpine.3.7-x86": [ + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "alpine.3.8": [ "alpine.3.8", "alpine.3.7", @@ -651,15 +2228,33 @@ "alpine.3.8", "alpine.3.7-arm64", "alpine.3.7", - "alpine.3.6-arm64", + "alpine.3.6-arm64", + "alpine.3.6", + "alpine-arm64", + "alpine", + "linux-musl-arm64", + "linux-musl", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "alpine.3.8-s390x": [ + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", "alpine.3.6", - "alpine-arm64", + "alpine-s390x", "alpine", - "linux-musl-arm64", + "linux-musl-s390x", "linux-musl", - "linux-arm64", + "linux-s390x", "linux", - "unix-arm64", + "unix-s390x", "unix", "any", "base" @@ -682,6 +2277,24 @@ "any", "base" ], + "alpine.3.8-x86": [ + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "alpine.3.9": [ "alpine.3.9", "alpine.3.8", @@ -734,6 +2347,26 @@ "any", "base" ], + "alpine.3.9-s390x": [ + "alpine.3.9-s390x", + "alpine.3.9", + "alpine.3.8-s390x", + "alpine.3.8", + "alpine.3.7-s390x", + "alpine.3.7", + "alpine.3.6-s390x", + "alpine.3.6", + "alpine-s390x", + "alpine", + "linux-musl-s390x", + "linux-musl", + "linux-s390x", + "linux", + "unix-s390x", + "unix", + "any", + "base" + ], "alpine.3.9-x64": [ "alpine.3.9-x64", "alpine.3.9", @@ -754,6 +2387,26 @@ "any", "base" ], + "alpine.3.9-x86": [ + "alpine.3.9-x86", + "alpine.3.9", + "alpine.3.8-x86", + "alpine.3.8", + "alpine.3.7-x86", + "alpine.3.7", + "alpine.3.6-x86", + "alpine.3.6", + "alpine-x86", + "alpine", + "linux-musl-x86", + "linux-musl", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "android": [ "android", "linux", @@ -1912,6 +3565,161 @@ "any", "base" ], + "android.32": [ + "android.32", + "android.31", + "android.30", + "android.29", + "android.28", + "android.27", + "android.26", + "android.25", + "android.24", + "android.23", + "android.22", + "android.21", + "android", + "linux", + "unix", + "any", + "base" + ], + "android.32-arm": [ + "android.32-arm", + "android.32", + "android.31-arm", + "android.31", + "android.30-arm", + "android.30", + "android.29-arm", + "android.29", + "android.28-arm", + "android.28", + "android.27-arm", + "android.27", + "android.26-arm", + "android.26", + "android.25-arm", + "android.25", + "android.24-arm", + "android.24", + "android.23-arm", + "android.23", + "android.22-arm", + "android.22", + "android.21-arm", + "android.21", + "android-arm", + "android", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "android.32-arm64": [ + "android.32-arm64", + "android.32", + "android.31-arm64", + "android.31", + "android.30-arm64", + "android.30", + "android.29-arm64", + "android.29", + "android.28-arm64", + "android.28", + "android.27-arm64", + "android.27", + "android.26-arm64", + "android.26", + "android.25-arm64", + "android.25", + "android.24-arm64", + "android.24", + "android.23-arm64", + "android.23", + "android.22-arm64", + "android.22", + "android.21-arm64", + "android.21", + "android-arm64", + "android", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "android.32-x64": [ + "android.32-x64", + "android.32", + "android.31-x64", + "android.31", + "android.30-x64", + "android.30", + "android.29-x64", + "android.29", + "android.28-x64", + "android.28", + "android.27-x64", + "android.27", + "android.26-x64", + "android.26", + "android.25-x64", + "android.25", + "android.24-x64", + "android.24", + "android.23-x64", + "android.23", + "android.22-x64", + "android.22", + "android.21-x64", + "android.21", + "android-x64", + "android", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "android.32-x86": [ + "android.32-x86", + "android.32", + "android.31-x86", + "android.31", + "android.30-x86", + "android.30", + "android.29-x86", + "android.29", + "android.28-x86", + "android.28", + "android.27-x86", + "android.27", + "android.26-x86", + "android.26", + "android.25-x86", + "android.25", + "android.24-x86", + "android.24", + "android.23-x86", + "android.23", + "android.22-x86", + "android.22", + "android.21-x86", + "android.21", + "android-x86", + "android", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "any": [ "any", "base" @@ -2171,9 +3979,77 @@ "any", "base" ], - "debian.10-arm64": [ - "debian.10-arm64", - "debian.10", + "debian.10-arm64": [ + "debian.10-arm64", + "debian.10", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "debian.10-armel": [ + "debian.10-armel", + "debian.10", + "debian-armel", + "debian", + "linux-armel", + "linux", + "unix-armel", + "unix", + "any", + "base" + ], + "debian.10-x64": [ + "debian.10-x64", + "debian.10", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "debian.10-x86": [ + "debian.10-x86", + "debian.10", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "debian.11": [ + "debian.11", + "debian", + "linux", + "unix", + "any", + "base" + ], + "debian.11-arm": [ + "debian.11-arm", + "debian.11", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "debian.11-arm64": [ + "debian.11-arm64", + "debian.11", "debian-arm64", "debian", "linux-arm64", @@ -2183,9 +4059,9 @@ "any", "base" ], - "debian.10-armel": [ - "debian.10-armel", - "debian.10", + "debian.11-armel": [ + "debian.11-armel", + "debian.11", "debian-armel", "debian", "linux-armel", @@ -2195,9 +4071,9 @@ "any", "base" ], - "debian.10-x64": [ - "debian.10-x64", - "debian.10", + "debian.11-x64": [ + "debian.11-x64", + "debian.11", "debian-x64", "debian", "linux-x64", @@ -2207,9 +4083,9 @@ "any", "base" ], - "debian.10-x86": [ - "debian.10-x86", - "debian.10", + "debian.11-x86": [ + "debian.11-x86", + "debian.11", "debian-x86", "debian", "linux-x86", @@ -2219,17 +4095,17 @@ "any", "base" ], - "debian.11": [ - "debian.11", + "debian.12": [ + "debian.12", "debian", "linux", "unix", "any", "base" ], - "debian.11-arm": [ - "debian.11-arm", - "debian.11", + "debian.12-arm": [ + "debian.12-arm", + "debian.12", "debian-arm", "debian", "linux-arm", @@ -2239,9 +4115,9 @@ "any", "base" ], - "debian.11-arm64": [ - "debian.11-arm64", - "debian.11", + "debian.12-arm64": [ + "debian.12-arm64", + "debian.12", "debian-arm64", "debian", "linux-arm64", @@ -2251,9 +4127,9 @@ "any", "base" ], - "debian.11-armel": [ - "debian.11-armel", - "debian.11", + "debian.12-armel": [ + "debian.12-armel", + "debian.12", "debian-armel", "debian", "linux-armel", @@ -2263,9 +4139,9 @@ "any", "base" ], - "debian.11-x64": [ - "debian.11-x64", - "debian.11", + "debian.12-x64": [ + "debian.12-x64", + "debian.12", "debian-x64", "debian", "linux-x64", @@ -2275,9 +4151,9 @@ "any", "base" ], - "debian.11-x86": [ - "debian.11-x86", - "debian.11", + "debian.12-x86": [ + "debian.12-x86", + "debian.12", "debian-x86", "debian", "linux-x86", @@ -2883,6 +4759,166 @@ "any", "base" ], + "fedora.36": [ + "fedora.36", + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora.36-arm64": [ + "fedora.36-arm64", + "fedora.36", + "fedora-arm64", + "fedora", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "fedora.36-x64": [ + "fedora.36-x64", + "fedora.36", + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "fedora.37": [ + "fedora.37", + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora.37-arm64": [ + "fedora.37-arm64", + "fedora.37", + "fedora-arm64", + "fedora", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "fedora.37-x64": [ + "fedora.37-x64", + "fedora.37", + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "fedora.38": [ + "fedora.38", + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora.38-arm64": [ + "fedora.38-arm64", + "fedora.38", + "fedora-arm64", + "fedora", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "fedora.38-x64": [ + "fedora.38-x64", + "fedora.38", + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "fedora.39": [ + "fedora.39", + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora.39-arm64": [ + "fedora.39-arm64", + "fedora.39", + "fedora-arm64", + "fedora", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "fedora.39-x64": [ + "fedora.39-x64", + "fedora.39", + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "fedora.40": [ + "fedora.40", + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora.40-arm64": [ + "fedora.40-arm64", + "fedora.40", + "fedora-arm64", + "fedora", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "fedora.40-x64": [ + "fedora.40-x64", + "fedora.40", + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], "freebsd": [ "freebsd", "unix", @@ -4986,7 +7022,106 @@ "any", "base" ], - "osx.10.13-x64": [ + "osx.10.13-x64": [ + "osx.10.13-x64", + "osx.10.13", + "osx.10.12-x64", + "osx.10.12", + "osx.10.11-x64", + "osx.10.11", + "osx.10.10-x64", + "osx.10.10", + "osx-x64", + "osx", + "unix-x64", + "unix", + "any", + "base" + ], + "osx.10.14": [ + "osx.10.14", + "osx.10.13", + "osx.10.12", + "osx.10.11", + "osx.10.10", + "osx", + "unix", + "any", + "base" + ], + "osx.10.14-arm64": [ + "osx.10.14-arm64", + "osx.10.14", + "osx.10.13-arm64", + "osx.10.13", + "osx.10.12-arm64", + "osx.10.12", + "osx.10.11-arm64", + "osx.10.11", + "osx.10.10-arm64", + "osx.10.10", + "osx-arm64", + "osx", + "unix-arm64", + "unix", + "any", + "base" + ], + "osx.10.14-x64": [ + "osx.10.14-x64", + "osx.10.14", + "osx.10.13-x64", + "osx.10.13", + "osx.10.12-x64", + "osx.10.12", + "osx.10.11-x64", + "osx.10.11", + "osx.10.10-x64", + "osx.10.10", + "osx-x64", + "osx", + "unix-x64", + "unix", + "any", + "base" + ], + "osx.10.15": [ + "osx.10.15", + "osx.10.14", + "osx.10.13", + "osx.10.12", + "osx.10.11", + "osx.10.10", + "osx", + "unix", + "any", + "base" + ], + "osx.10.15-arm64": [ + "osx.10.15-arm64", + "osx.10.15", + "osx.10.14-arm64", + "osx.10.14", + "osx.10.13-arm64", + "osx.10.13", + "osx.10.12-arm64", + "osx.10.12", + "osx.10.11-arm64", + "osx.10.11", + "osx.10.10-arm64", + "osx.10.10", + "osx-arm64", + "osx", + "unix-arm64", + "unix", + "any", + "base" + ], + "osx.10.15-x64": [ + "osx.10.15-x64", + "osx.10.15", + "osx.10.14-x64", + "osx.10.14", "osx.10.13-x64", "osx.10.13", "osx.10.12-x64", @@ -5002,7 +7137,9 @@ "any", "base" ], - "osx.10.14": [ + "osx.10.16": [ + "osx.10.16", + "osx.10.15", "osx.10.14", "osx.10.13", "osx.10.12", @@ -5013,7 +7150,11 @@ "any", "base" ], - "osx.10.14-arm64": [ + "osx.10.16-arm64": [ + "osx.10.16-arm64", + "osx.10.16", + "osx.10.15-arm64", + "osx.10.15", "osx.10.14-arm64", "osx.10.14", "osx.10.13-arm64", @@ -5031,7 +7172,11 @@ "any", "base" ], - "osx.10.14-x64": [ + "osx.10.16-x64": [ + "osx.10.16-x64", + "osx.10.16", + "osx.10.15-x64", + "osx.10.15", "osx.10.14-x64", "osx.10.14", "osx.10.13-x64", @@ -5049,7 +7194,9 @@ "any", "base" ], - "osx.10.15": [ + "osx.11.0": [ + "osx.11.0", + "osx.10.16", "osx.10.15", "osx.10.14", "osx.10.13", @@ -5061,7 +7208,11 @@ "any", "base" ], - "osx.10.15-arm64": [ + "osx.11.0-arm64": [ + "osx.11.0-arm64", + "osx.11.0", + "osx.10.16-arm64", + "osx.10.16", "osx.10.15-arm64", "osx.10.15", "osx.10.14-arm64", @@ -5081,7 +7232,11 @@ "any", "base" ], - "osx.10.15-x64": [ + "osx.11.0-x64": [ + "osx.11.0-x64", + "osx.11.0", + "osx.10.16-x64", + "osx.10.16", "osx.10.15-x64", "osx.10.15", "osx.10.14-x64", @@ -5101,7 +7256,9 @@ "any", "base" ], - "osx.10.16": [ + "osx.12": [ + "osx.12", + "osx.11.0", "osx.10.16", "osx.10.15", "osx.10.14", @@ -5114,7 +7271,11 @@ "any", "base" ], - "osx.10.16-arm64": [ + "osx.12-arm64": [ + "osx.12-arm64", + "osx.12", + "osx.11.0-arm64", + "osx.11.0", "osx.10.16-arm64", "osx.10.16", "osx.10.15-arm64", @@ -5136,7 +7297,11 @@ "any", "base" ], - "osx.10.16-x64": [ + "osx.12-x64": [ + "osx.12-x64", + "osx.12", + "osx.11.0-x64", + "osx.11.0", "osx.10.16-x64", "osx.10.16", "osx.10.15-x64", @@ -5158,7 +7323,9 @@ "any", "base" ], - "osx.11.0": [ + "osx.13": [ + "osx.13", + "osx.12", "osx.11.0", "osx.10.16", "osx.10.15", @@ -5172,7 +7339,11 @@ "any", "base" ], - "osx.11.0-arm64": [ + "osx.13-arm64": [ + "osx.13-arm64", + "osx.13", + "osx.12-arm64", + "osx.12", "osx.11.0-arm64", "osx.11.0", "osx.10.16-arm64", @@ -5196,7 +7367,11 @@ "any", "base" ], - "osx.11.0-x64": [ + "osx.13-x64": [ + "osx.13-x64", + "osx.13", + "osx.12-x64", + "osx.12", "osx.11.0-x64", "osx.11.0", "osx.10.16-x64", @@ -5654,6 +7829,122 @@ "any", "base" ], + "rocky": [ + "rocky", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rocky-arm64": [ + "rocky-arm64", + "rocky", + "rhel-arm64", + "rhel", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "rocky-x64": [ + "rocky-x64", + "rocky", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rocky.8": [ + "rocky.8", + "rocky", + "rhel.8", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rocky.8-arm64": [ + "rocky.8-arm64", + "rocky.8", + "rocky-arm64", + "rhel.8-arm64", + "rocky", + "rhel.8", + "rhel-arm64", + "rhel", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "rocky.8-x64": [ + "rocky.8-x64", + "rocky.8", + "rocky-x64", + "rhel.8-x64", + "rocky", + "rhel.8", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rocky.9": [ + "rocky.9", + "rocky", + "rhel.9", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rocky.9-arm64": [ + "rocky.9-arm64", + "rocky.9", + "rocky-arm64", + "rhel.9-arm64", + "rocky", + "rhel.9", + "rhel-arm64", + "rhel", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "rocky.9-x64": [ + "rocky.9-x64", + "rocky.9", + "rocky-x64", + "rhel.9-x64", + "rocky", + "rhel.9", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], "sles": [ "sles", "linux", @@ -6202,7 +8493,158 @@ "any", "base" ], - "tizen.6.0.0-x86": [ + "tizen.6.0.0-x86": [ + "tizen.6.0.0-x86", + "tizen.6.0.0", + "tizen.5.5.0-x86", + "tizen.5.5.0", + "tizen.5.0.0-x86", + "tizen.5.0.0", + "tizen.4.0.0-x86", + "tizen.4.0.0", + "tizen-x86", + "tizen", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "tizen.6.5.0": [ + "tizen.6.5.0", + "tizen.6.0.0", + "tizen.5.5.0", + "tizen.5.0.0", + "tizen.4.0.0", + "tizen", + "linux", + "unix", + "any", + "base" + ], + "tizen.6.5.0-arm64": [ + "tizen.6.5.0-arm64", + "tizen.6.5.0", + "tizen.6.0.0-arm64", + "tizen.6.0.0", + "tizen.5.5.0-arm64", + "tizen.5.5.0", + "tizen.5.0.0-arm64", + "tizen.5.0.0", + "tizen.4.0.0-arm64", + "tizen.4.0.0", + "tizen-arm64", + "tizen", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "tizen.6.5.0-armel": [ + "tizen.6.5.0-armel", + "tizen.6.5.0", + "tizen.6.0.0-armel", + "tizen.6.0.0", + "tizen.5.5.0-armel", + "tizen.5.5.0", + "tizen.5.0.0-armel", + "tizen.5.0.0", + "tizen.4.0.0-armel", + "tizen.4.0.0", + "tizen-armel", + "tizen", + "linux-armel", + "linux", + "unix-armel", + "unix", + "any", + "base" + ], + "tizen.6.5.0-x86": [ + "tizen.6.5.0-x86", + "tizen.6.5.0", + "tizen.6.0.0-x86", + "tizen.6.0.0", + "tizen.5.5.0-x86", + "tizen.5.5.0", + "tizen.5.0.0-x86", + "tizen.5.0.0", + "tizen.4.0.0-x86", + "tizen.4.0.0", + "tizen-x86", + "tizen", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "tizen.7.0.0": [ + "tizen.7.0.0", + "tizen.6.5.0", + "tizen.6.0.0", + "tizen.5.5.0", + "tizen.5.0.0", + "tizen.4.0.0", + "tizen", + "linux", + "unix", + "any", + "base" + ], + "tizen.7.0.0-arm64": [ + "tizen.7.0.0-arm64", + "tizen.7.0.0", + "tizen.6.5.0-arm64", + "tizen.6.5.0", + "tizen.6.0.0-arm64", + "tizen.6.0.0", + "tizen.5.5.0-arm64", + "tizen.5.5.0", + "tizen.5.0.0-arm64", + "tizen.5.0.0", + "tizen.4.0.0-arm64", + "tizen.4.0.0", + "tizen-arm64", + "tizen", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "tizen.7.0.0-armel": [ + "tizen.7.0.0-armel", + "tizen.7.0.0", + "tizen.6.5.0-armel", + "tizen.6.5.0", + "tizen.6.0.0-armel", + "tizen.6.0.0", + "tizen.5.5.0-armel", + "tizen.5.5.0", + "tizen.5.0.0-armel", + "tizen.5.0.0", + "tizen.4.0.0-armel", + "tizen.4.0.0", + "tizen-armel", + "tizen", + "linux-armel", + "linux", + "unix-armel", + "unix", + "any", + "base" + ], + "tizen.7.0.0-x86": [ + "tizen.7.0.0-x86", + "tizen.7.0.0", + "tizen.6.5.0-x86", + "tizen.6.5.0", "tizen.6.0.0-x86", "tizen.6.0.0", "tizen.5.5.0-x86", @@ -7813,6 +10255,331 @@ "any", "base" ], + "ubuntu.22.04": [ + "ubuntu.22.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.22.04-arm": [ + "ubuntu.22.04-arm", + "ubuntu.22.04", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.22.04-arm64": [ + "ubuntu.22.04-arm64", + "ubuntu.22.04", + "ubuntu-arm64", + "ubuntu", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "ubuntu.22.04-x64": [ + "ubuntu.22.04-x64", + "ubuntu.22.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.22.04-x86": [ + "ubuntu.22.04-x86", + "ubuntu.22.04", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.22.10": [ + "ubuntu.22.10", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.22.10-arm": [ + "ubuntu.22.10-arm", + "ubuntu.22.10", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.22.10-arm64": [ + "ubuntu.22.10-arm64", + "ubuntu.22.10", + "ubuntu-arm64", + "ubuntu", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "ubuntu.22.10-x64": [ + "ubuntu.22.10-x64", + "ubuntu.22.10", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.22.10-x86": [ + "ubuntu.22.10-x86", + "ubuntu.22.10", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.23.04": [ + "ubuntu.23.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.23.04-arm": [ + "ubuntu.23.04-arm", + "ubuntu.23.04", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.23.04-arm64": [ + "ubuntu.23.04-arm64", + "ubuntu.23.04", + "ubuntu-arm64", + "ubuntu", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "ubuntu.23.04-x64": [ + "ubuntu.23.04-x64", + "ubuntu.23.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.23.04-x86": [ + "ubuntu.23.04-x86", + "ubuntu.23.04", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.23.10": [ + "ubuntu.23.10", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.23.10-arm": [ + "ubuntu.23.10-arm", + "ubuntu.23.10", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.23.10-arm64": [ + "ubuntu.23.10-arm64", + "ubuntu.23.10", + "ubuntu-arm64", + "ubuntu", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "ubuntu.23.10-x64": [ + "ubuntu.23.10-x64", + "ubuntu.23.10", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.23.10-x86": [ + "ubuntu.23.10-x86", + "ubuntu.23.10", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.24.04": [ + "ubuntu.24.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.24.04-arm": [ + "ubuntu.24.04-arm", + "ubuntu.24.04", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.24.04-arm64": [ + "ubuntu.24.04-arm64", + "ubuntu.24.04", + "ubuntu-arm64", + "ubuntu", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "ubuntu.24.04-x64": [ + "ubuntu.24.04-x64", + "ubuntu.24.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.24.04-x86": [ + "ubuntu.24.04-x86", + "ubuntu.24.04", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], "unix": [ "unix", "any", @@ -8490,4 +11257,4 @@ "any", "base" ] -} \ No newline at end of file +} diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json index 04e41069e0a6d5..32ba949a6f8062 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json +++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json @@ -17,12 +17,24 @@ "linux-musl-arm64" ] }, + "alpine-s390x": { + "#import": [ + "alpine", + "linux-musl-s390x" + ] + }, "alpine-x64": { "#import": [ "alpine", "linux-musl-x64" ] }, + "alpine-x86": { + "#import": [ + "alpine", + "linux-musl-x86" + ] + }, "alpine.3.10": { "#import": [ "alpine.3.9" @@ -40,12 +52,24 @@ "alpine.3.9-arm64" ] }, + "alpine.3.10-s390x": { + "#import": [ + "alpine.3.10", + "alpine.3.9-s390x" + ] + }, "alpine.3.10-x64": { "#import": [ "alpine.3.10", "alpine.3.9-x64" ] }, + "alpine.3.10-x86": { + "#import": [ + "alpine.3.10", + "alpine.3.9-x86" + ] + }, "alpine.3.11": { "#import": [ "alpine.3.10" @@ -63,12 +87,24 @@ "alpine.3.10-arm64" ] }, + "alpine.3.11-s390x": { + "#import": [ + "alpine.3.11", + "alpine.3.10-s390x" + ] + }, "alpine.3.11-x64": { "#import": [ "alpine.3.11", "alpine.3.10-x64" ] }, + "alpine.3.11-x86": { + "#import": [ + "alpine.3.11", + "alpine.3.10-x86" + ] + }, "alpine.3.12": { "#import": [ "alpine.3.11" @@ -86,12 +122,24 @@ "alpine.3.11-arm64" ] }, + "alpine.3.12-s390x": { + "#import": [ + "alpine.3.12", + "alpine.3.11-s390x" + ] + }, "alpine.3.12-x64": { "#import": [ "alpine.3.12", "alpine.3.11-x64" ] }, + "alpine.3.12-x86": { + "#import": [ + "alpine.3.12", + "alpine.3.11-x86" + ] + }, "alpine.3.13": { "#import": [ "alpine.3.12" @@ -109,12 +157,24 @@ "alpine.3.12-arm64" ] }, + "alpine.3.13-s390x": { + "#import": [ + "alpine.3.13", + "alpine.3.12-s390x" + ] + }, "alpine.3.13-x64": { "#import": [ "alpine.3.13", "alpine.3.12-x64" ] }, + "alpine.3.13-x86": { + "#import": [ + "alpine.3.13", + "alpine.3.12-x86" + ] + }, "alpine.3.14": { "#import": [ "alpine.3.13" @@ -132,12 +192,234 @@ "alpine.3.13-arm64" ] }, + "alpine.3.14-s390x": { + "#import": [ + "alpine.3.14", + "alpine.3.13-s390x" + ] + }, "alpine.3.14-x64": { "#import": [ "alpine.3.14", "alpine.3.13-x64" ] }, + "alpine.3.14-x86": { + "#import": [ + "alpine.3.14", + "alpine.3.13-x86" + ] + }, + "alpine.3.15": { + "#import": [ + "alpine.3.14" + ] + }, + "alpine.3.15-arm": { + "#import": [ + "alpine.3.15", + "alpine.3.14-arm" + ] + }, + "alpine.3.15-arm64": { + "#import": [ + "alpine.3.15", + "alpine.3.14-arm64" + ] + }, + "alpine.3.15-s390x": { + "#import": [ + "alpine.3.15", + "alpine.3.14-s390x" + ] + }, + "alpine.3.15-x64": { + "#import": [ + "alpine.3.15", + "alpine.3.14-x64" + ] + }, + "alpine.3.15-x86": { + "#import": [ + "alpine.3.15", + "alpine.3.14-x86" + ] + }, + "alpine.3.16": { + "#import": [ + "alpine.3.15" + ] + }, + "alpine.3.16-arm": { + "#import": [ + "alpine.3.16", + "alpine.3.15-arm" + ] + }, + "alpine.3.16-arm64": { + "#import": [ + "alpine.3.16", + "alpine.3.15-arm64" + ] + }, + "alpine.3.16-s390x": { + "#import": [ + "alpine.3.16", + "alpine.3.15-s390x" + ] + }, + "alpine.3.16-x64": { + "#import": [ + "alpine.3.16", + "alpine.3.15-x64" + ] + }, + "alpine.3.16-x86": { + "#import": [ + "alpine.3.16", + "alpine.3.15-x86" + ] + }, + "alpine.3.17": { + "#import": [ + "alpine.3.16" + ] + }, + "alpine.3.17-arm": { + "#import": [ + "alpine.3.17", + "alpine.3.16-arm" + ] + }, + "alpine.3.17-arm64": { + "#import": [ + "alpine.3.17", + "alpine.3.16-arm64" + ] + }, + "alpine.3.17-s390x": { + "#import": [ + "alpine.3.17", + "alpine.3.16-s390x" + ] + }, + "alpine.3.17-x64": { + "#import": [ + "alpine.3.17", + "alpine.3.16-x64" + ] + }, + "alpine.3.17-x86": { + "#import": [ + "alpine.3.17", + "alpine.3.16-x86" + ] + }, + "alpine.3.18": { + "#import": [ + "alpine.3.17" + ] + }, + "alpine.3.18-arm": { + "#import": [ + "alpine.3.18", + "alpine.3.17-arm" + ] + }, + "alpine.3.18-arm64": { + "#import": [ + "alpine.3.18", + "alpine.3.17-arm64" + ] + }, + "alpine.3.18-s390x": { + "#import": [ + "alpine.3.18", + "alpine.3.17-s390x" + ] + }, + "alpine.3.18-x64": { + "#import": [ + "alpine.3.18", + "alpine.3.17-x64" + ] + }, + "alpine.3.18-x86": { + "#import": [ + "alpine.3.18", + "alpine.3.17-x86" + ] + }, + "alpine.3.19": { + "#import": [ + "alpine.3.18" + ] + }, + "alpine.3.19-arm": { + "#import": [ + "alpine.3.19", + "alpine.3.18-arm" + ] + }, + "alpine.3.19-arm64": { + "#import": [ + "alpine.3.19", + "alpine.3.18-arm64" + ] + }, + "alpine.3.19-s390x": { + "#import": [ + "alpine.3.19", + "alpine.3.18-s390x" + ] + }, + "alpine.3.19-x64": { + "#import": [ + "alpine.3.19", + "alpine.3.18-x64" + ] + }, + "alpine.3.19-x86": { + "#import": [ + "alpine.3.19", + "alpine.3.18-x86" + ] + }, + "alpine.3.20": { + "#import": [ + "alpine.3.19" + ] + }, + "alpine.3.20-arm": { + "#import": [ + "alpine.3.20", + "alpine.3.19-arm" + ] + }, + "alpine.3.20-arm64": { + "#import": [ + "alpine.3.20", + "alpine.3.19-arm64" + ] + }, + "alpine.3.20-s390x": { + "#import": [ + "alpine.3.20", + "alpine.3.19-s390x" + ] + }, + "alpine.3.20-x64": { + "#import": [ + "alpine.3.20", + "alpine.3.19-x64" + ] + }, + "alpine.3.20-x86": { + "#import": [ + "alpine.3.20", + "alpine.3.19-x86" + ] + }, "alpine.3.6": { "#import": [ "alpine" @@ -155,12 +437,24 @@ "alpine-arm64" ] }, + "alpine.3.6-s390x": { + "#import": [ + "alpine.3.6", + "alpine-s390x" + ] + }, "alpine.3.6-x64": { "#import": [ "alpine.3.6", "alpine-x64" ] }, + "alpine.3.6-x86": { + "#import": [ + "alpine.3.6", + "alpine-x86" + ] + }, "alpine.3.7": { "#import": [ "alpine.3.6" @@ -178,12 +472,24 @@ "alpine.3.6-arm64" ] }, + "alpine.3.7-s390x": { + "#import": [ + "alpine.3.7", + "alpine.3.6-s390x" + ] + }, "alpine.3.7-x64": { "#import": [ "alpine.3.7", "alpine.3.6-x64" ] }, + "alpine.3.7-x86": { + "#import": [ + "alpine.3.7", + "alpine.3.6-x86" + ] + }, "alpine.3.8": { "#import": [ "alpine.3.7" @@ -201,12 +507,24 @@ "alpine.3.7-arm64" ] }, + "alpine.3.8-s390x": { + "#import": [ + "alpine.3.8", + "alpine.3.7-s390x" + ] + }, "alpine.3.8-x64": { "#import": [ "alpine.3.8", "alpine.3.7-x64" ] }, + "alpine.3.8-x86": { + "#import": [ + "alpine.3.8", + "alpine.3.7-x86" + ] + }, "alpine.3.9": { "#import": [ "alpine.3.8" @@ -224,12 +542,24 @@ "alpine.3.8-arm64" ] }, + "alpine.3.9-s390x": { + "#import": [ + "alpine.3.9", + "alpine.3.8-s390x" + ] + }, "alpine.3.9-x64": { "#import": [ "alpine.3.9", "alpine.3.8-x64" ] }, + "alpine.3.9-x86": { + "#import": [ + "alpine.3.9", + "alpine.3.8-x86" + ] + }, "android": { "#import": [ "linux" @@ -578,6 +908,35 @@ "android.30-x86" ] }, + "android.32": { + "#import": [ + "android.31" + ] + }, + "android.32-arm": { + "#import": [ + "android.32", + "android.31-arm" + ] + }, + "android.32-arm64": { + "#import": [ + "android.32", + "android.31-arm64" + ] + }, + "android.32-x64": { + "#import": [ + "android.32", + "android.31-x64" + ] + }, + "android.32-x86": { + "#import": [ + "android.32", + "android.31-x86" + ] + }, "any": { "#import": [ "base" @@ -787,6 +1146,41 @@ "debian-x86" ] }, + "debian.12": { + "#import": [ + "debian" + ] + }, + "debian.12-arm": { + "#import": [ + "debian.12", + "debian-arm" + ] + }, + "debian.12-arm64": { + "#import": [ + "debian.12", + "debian-arm64" + ] + }, + "debian.12-armel": { + "#import": [ + "debian.12", + "debian-armel" + ] + }, + "debian.12-x64": { + "#import": [ + "debian.12", + "debian-x64" + ] + }, + "debian.12-x86": { + "#import": [ + "debian.12", + "debian-x86" + ] + }, "debian.8": { "#import": [ "debian" @@ -1106,6 +1500,91 @@ "fedora-x64" ] }, + "fedora.36": { + "#import": [ + "fedora" + ] + }, + "fedora.36-arm64": { + "#import": [ + "fedora.36", + "fedora-arm64" + ] + }, + "fedora.36-x64": { + "#import": [ + "fedora.36", + "fedora-x64" + ] + }, + "fedora.37": { + "#import": [ + "fedora" + ] + }, + "fedora.37-arm64": { + "#import": [ + "fedora.37", + "fedora-arm64" + ] + }, + "fedora.37-x64": { + "#import": [ + "fedora.37", + "fedora-x64" + ] + }, + "fedora.38": { + "#import": [ + "fedora" + ] + }, + "fedora.38-arm64": { + "#import": [ + "fedora.38", + "fedora-arm64" + ] + }, + "fedora.38-x64": { + "#import": [ + "fedora.38", + "fedora-x64" + ] + }, + "fedora.39": { + "#import": [ + "fedora" + ] + }, + "fedora.39-arm64": { + "#import": [ + "fedora.39", + "fedora-arm64" + ] + }, + "fedora.39-x64": { + "#import": [ + "fedora.39", + "fedora-x64" + ] + }, + "fedora.40": { + "#import": [ + "fedora" + ] + }, + "fedora.40-arm64": { + "#import": [ + "fedora.40", + "fedora-arm64" + ] + }, + "fedora.40-x64": { + "#import": [ + "fedora.40", + "fedora-x64" + ] + }, "freebsd": { "#import": [ "unix" @@ -2127,6 +2606,40 @@ "osx.10.16-x64" ] }, + "osx.12": { + "#import": [ + "osx.11.0" + ] + }, + "osx.12-arm64": { + "#import": [ + "osx.12", + "osx.11.0-arm64" + ] + }, + "osx.12-x64": { + "#import": [ + "osx.12", + "osx.11.0-x64" + ] + }, + "osx.13": { + "#import": [ + "osx.12" + ] + }, + "osx.13-arm64": { + "#import": [ + "osx.13", + "osx.12-arm64" + ] + }, + "osx.13-x64": { + "#import": [ + "osx.13", + "osx.12-x64" + ] + }, "rhel": { "#import": [ "linux" @@ -2311,6 +2824,63 @@ "rhel-x64" ] }, + "rocky": { + "#import": [ + "rhel" + ] + }, + "rocky-arm64": { + "#import": [ + "rocky", + "rhel-arm64" + ] + }, + "rocky-x64": { + "#import": [ + "rocky", + "rhel-x64" + ] + }, + "rocky.8": { + "#import": [ + "rocky", + "rhel.8" + ] + }, + "rocky.8-arm64": { + "#import": [ + "rocky.8", + "rocky-arm64", + "rhel.8-arm64" + ] + }, + "rocky.8-x64": { + "#import": [ + "rocky.8", + "rocky-x64", + "rhel.8-x64" + ] + }, + "rocky.9": { + "#import": [ + "rocky", + "rhel.9" + ] + }, + "rocky.9-arm64": { + "#import": [ + "rocky.9", + "rocky-arm64", + "rhel.9-arm64" + ] + }, + "rocky.9-x64": { + "#import": [ + "rocky.9", + "rocky-x64", + "rhel.9-x64" + ] + }, "sles": { "#import": [ "linux" @@ -2569,6 +3139,52 @@ "tizen.5.5.0-x86" ] }, + "tizen.6.5.0": { + "#import": [ + "tizen.6.0.0" + ] + }, + "tizen.6.5.0-arm64": { + "#import": [ + "tizen.6.5.0", + "tizen.6.0.0-arm64" + ] + }, + "tizen.6.5.0-armel": { + "#import": [ + "tizen.6.5.0", + "tizen.6.0.0-armel" + ] + }, + "tizen.6.5.0-x86": { + "#import": [ + "tizen.6.5.0", + "tizen.6.0.0-x86" + ] + }, + "tizen.7.0.0": { + "#import": [ + "tizen.6.5.0" + ] + }, + "tizen.7.0.0-arm64": { + "#import": [ + "tizen.7.0.0", + "tizen.6.5.0-arm64" + ] + }, + "tizen.7.0.0-armel": { + "#import": [ + "tizen.7.0.0", + "tizen.6.5.0-armel" + ] + }, + "tizen.7.0.0-x86": { + "#import": [ + "tizen.7.0.0", + "tizen.6.5.0-x86" + ] + }, "tvos": { "#import": [ "unix" @@ -3276,6 +3892,151 @@ "ubuntu-x86" ] }, + "ubuntu.22.04": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.22.04-arm": { + "#import": [ + "ubuntu.22.04", + "ubuntu-arm" + ] + }, + "ubuntu.22.04-arm64": { + "#import": [ + "ubuntu.22.04", + "ubuntu-arm64" + ] + }, + "ubuntu.22.04-x64": { + "#import": [ + "ubuntu.22.04", + "ubuntu-x64" + ] + }, + "ubuntu.22.04-x86": { + "#import": [ + "ubuntu.22.04", + "ubuntu-x86" + ] + }, + "ubuntu.22.10": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.22.10-arm": { + "#import": [ + "ubuntu.22.10", + "ubuntu-arm" + ] + }, + "ubuntu.22.10-arm64": { + "#import": [ + "ubuntu.22.10", + "ubuntu-arm64" + ] + }, + "ubuntu.22.10-x64": { + "#import": [ + "ubuntu.22.10", + "ubuntu-x64" + ] + }, + "ubuntu.22.10-x86": { + "#import": [ + "ubuntu.22.10", + "ubuntu-x86" + ] + }, + "ubuntu.23.04": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.23.04-arm": { + "#import": [ + "ubuntu.23.04", + "ubuntu-arm" + ] + }, + "ubuntu.23.04-arm64": { + "#import": [ + "ubuntu.23.04", + "ubuntu-arm64" + ] + }, + "ubuntu.23.04-x64": { + "#import": [ + "ubuntu.23.04", + "ubuntu-x64" + ] + }, + "ubuntu.23.04-x86": { + "#import": [ + "ubuntu.23.04", + "ubuntu-x86" + ] + }, + "ubuntu.23.10": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.23.10-arm": { + "#import": [ + "ubuntu.23.10", + "ubuntu-arm" + ] + }, + "ubuntu.23.10-arm64": { + "#import": [ + "ubuntu.23.10", + "ubuntu-arm64" + ] + }, + "ubuntu.23.10-x64": { + "#import": [ + "ubuntu.23.10", + "ubuntu-x64" + ] + }, + "ubuntu.23.10-x86": { + "#import": [ + "ubuntu.23.10", + "ubuntu-x86" + ] + }, + "ubuntu.24.04": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.24.04-arm": { + "#import": [ + "ubuntu.24.04", + "ubuntu-arm" + ] + }, + "ubuntu.24.04-arm64": { + "#import": [ + "ubuntu.24.04", + "ubuntu-arm64" + ] + }, + "ubuntu.24.04-x64": { + "#import": [ + "ubuntu.24.04", + "ubuntu-x64" + ] + }, + "ubuntu.24.04-x86": { + "#import": [ + "ubuntu.24.04", + "ubuntu-x86" + ] + }, "unix": { "#import": [ "any" @@ -3640,4 +4401,4 @@ ] } } -} \ No newline at end of file +} diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props index 63e342106d82d7..06ca771082ec35 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props +++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props @@ -15,14 +15,14 @@ linux-musl - x64;arm;arm64 - 3.6;3.7;3.8;3.9;3.10;3.11;3.12;3.13;3.14 + x64;x86;arm;arm64;s390x + 3.6;3.7;3.8;3.9;3.10;3.11;3.12;3.13;3.14;3.15;3.16;3.17;3.18;3.19;3.20 linux x64;x86;arm;arm64 - 21;22;23;24;25;26;27;28;29;30;31 + 21;22;23;24;25;26;27;28;29;30;31;32 @@ -59,7 +59,7 @@ linux x64;x86;arm;armel;arm64 - 8;9;10;11 + 8;9;10;11;12 false @@ -71,7 +71,7 @@ linux x64;arm64 - 23;24;25;26;27;28;29;30;31;32;33;34;35 + 23;24;25;26;27;28;29;30;31;32;33;34;35;36;37;38;39;40 false @@ -155,7 +155,7 @@ unix x64;arm64 - 10.10;10.11;10.12;10.13;10.14;10.15;10.16;11.0 + 10.10;10.11;10.12;10.13;10.14;10.15;10.16;11.0;12;13 @@ -215,6 +215,14 @@ 9 + + rhel + x64;arm64 + 8;9 + true + false + + linux x64 @@ -224,7 +232,7 @@ linux x86;armel;arm64 - 4.0.0;5.0.0;5.5.0;6.0.0 + 4.0.0;5.0.0;5.5.0;6.0.0;6.5.0;7.0.0 @@ -236,7 +244,7 @@ debian x64;x86;arm;arm64 - 16.04;16.10;17.04;17.10;18.04;18.10;19.04;19.10;20.04;20.10;21.04;21.10 + 16.04;16.10;17.04;17.10;18.04;18.10;19.04;19.10;20.04;20.10;21.04;21.10;22.04;22.10;23.04;23.10;24.04 false diff --git a/src/libraries/Microsoft.NETCore.Platforms/tests/GenerateRuntimeGraphTests.cs b/src/libraries/Microsoft.NETCore.Platforms/tests/GenerateRuntimeGraphTests.cs index 53bc785e09deee..ed8e8b281409ab 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/tests/GenerateRuntimeGraphTests.cs +++ b/src/libraries/Microsoft.NETCore.Platforms/tests/GenerateRuntimeGraphTests.cs @@ -196,14 +196,15 @@ public void CanAddArchitectureToExistingGroups() [Fact] public void CanAddArchitectureAndVersionToExistingGroups() { - var additionalRIDs = new[] { "osx.12-powerpc" }; + var additionalRIDs = new[] { "osx.13-powerpc" }; var expectedAdditions = new[] { - new RuntimeDescription("osx.12-powerpc", new[] { "osx.12", "osx.11.0-powerpc" }), - new RuntimeDescription("osx.12-arm64", new[] { "osx.12", "osx.11.0-arm64" }), - new RuntimeDescription("osx.12-x64", new[] { "osx.12", "osx.11.0-x64" }), - new RuntimeDescription("osx.12", new[] { "osx.11.0" }), + new RuntimeDescription("osx.13-powerpc", new[] { "osx.13", "osx.12-powerpc" }), + new RuntimeDescription("osx.13-arm64", new[] { "osx.13", "osx.12-arm64" }), + new RuntimeDescription("osx.13-x64", new[] { "osx.13", "osx.12-x64" }), + new RuntimeDescription("osx.13", new[] { "osx.12" }), // our RID model doesn't give priority to architecture, so the new architecture is applied to all past versions + new RuntimeDescription("osx.12-powerpc", new[] { "osx.12", "osx.11.0-powerpc" }), new RuntimeDescription("osx.11.0-powerpc", new[] { "osx.11.0", "osx.10.16-powerpc" }), new RuntimeDescription("osx.10.16-powerpc", new[] { "osx.10.16", "osx.10.15-powerpc" }), new RuntimeDescription("osx.10.15-powerpc", new[] { "osx.10.15", "osx.10.14-powerpc" }), diff --git a/src/libraries/Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj b/src/libraries/Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj index a2a273ed6e042f..00e2f561d82625 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj +++ b/src/libraries/Microsoft.NETCore.Platforms/tests/Microsoft.NETCore.Platforms.Tests.csproj @@ -4,14 +4,6 @@ true - - - - - - - - @@ -25,4 +17,16 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs b/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs index 227bcbdd10d4db..8dee0ebeda17a4 100644 --- a/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs +++ b/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs @@ -10,35 +10,57 @@ public class RidTests { public static IEnumerable ValidRIDData() { - yield return new object[] { "win10-x64", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10"), Architecture = "x64" } }; - yield return new object[] { "win10", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10")} }; - yield return new object[] { "linux", new RID() { BaseRID = "linux" } }; - yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" } }; - yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" } }; - yield return new object[] { "debian.10-x64", new RID() { BaseRID = "debian", Version = new RuntimeVersion("10"), Architecture = "x64" } }; - yield return new object[] { "linuxmint.19.2-x64", new RID() { BaseRID = "linuxmint", Version = new RuntimeVersion("19.2"), Architecture = "x64" } }; - yield return new object[] { "ubuntu.14.04-x64", new RID() { BaseRID = "ubuntu", Version = new RuntimeVersion("14.04"), Architecture = "x64" } }; - yield return new object[] { "foo-bar.42-arm", new RID() { BaseRID = "foo-bar", Version = new RuntimeVersion("42"), Architecture = "arm" } }; - yield return new object[] { "foo-bar-arm", new RID() { BaseRID = "foo", Architecture = "bar", Qualifier = "arm" } }; // demonstrates ambiguity, avoid using `-` in base - yield return new object[] { "linux-musl-x64", new RID() { BaseRID = "linux", Architecture = "musl", Qualifier = "x64" } }; // yes, we already have ambiguous RIDs + yield return new object[] { "win10-x64", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10"), Architecture = "x64" }, null }; + yield return new object[] { "win10", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10")}, null }; + yield return new object[] { "linux", new RID() { BaseRID = "linux" }, null }; + yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" }, null }; + yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" }, null }; + yield return new object[] { "debian.10-x64", new RID() { BaseRID = "debian", Version = new RuntimeVersion("10"), Architecture = "x64" }, null }; + yield return new object[] { "linuxmint.19.2-x64", new RID() { BaseRID = "linuxmint", Version = new RuntimeVersion("19.2"), Architecture = "x64" }, null }; + yield return new object[] { "ubuntu.14.04-x64", new RID() { BaseRID = "ubuntu", Version = new RuntimeVersion("14.04"), Architecture = "x64" }, null }; + yield return new object[] { "foo-bar.42-arm", new RID() { BaseRID = "foo-bar", Version = new RuntimeVersion("42"), Architecture = "arm" }, null }; + yield return new object[] { "foo-bar-arm", new RID() { BaseRID = "foo", Architecture = "bar", Qualifier = "arm" }, // demonstrates ambiguity, avoid using `-` in base + new RID() { BaseRID = "foo-bar", Architecture = "arm" } }; + yield return new object[] { "linux-musl-x64", new RID() { BaseRID = "linux", Architecture = "musl", Qualifier = "x64" }, // yes, we already have ambiguous RIDs + new RID() { BaseRID = "linux-musl", Architecture = "x64" } }; } [Theory] [MemberData(nameof(ValidRIDData))] - internal void ParseCorrectly(string input, RID expected) + internal void ParseCorrectly(string input, RID expected, RID? expectedNoQualifier) { - RID actual = RID.Parse(input); + _ = expectedNoQualifier; // unused + + RID actual = RID.Parse(input, noQualifier: false); Assert.Equal(expected, actual); } [Theory] [MemberData(nameof(ValidRIDData))] - internal void ToStringAsExpected(string expected, RID rid) + internal void ParseCorrectlyNoQualifier(string input, RID expected, RID? expectedNoQualifier) + { + expectedNoQualifier ??= expected; + + RID actual = RID.Parse(input, noQualifier: true); + + Assert.Equal(expectedNoQualifier, actual); + } + + [Theory] + [MemberData(nameof(ValidRIDData))] + internal void ToStringAsExpected(string expected, RID rid, RID? expectedNoQualifierRid) { string actual = rid.ToString(); Assert.Equal(expected, actual); + + if (expectedNoQualifierRid is not null) + { + actual = expectedNoQualifierRid.ToString(); + + Assert.Equal(expected, actual); + } } } } diff --git a/src/libraries/Microsoft.VisualBasic.Core/Directory.Build.props b/src/libraries/Microsoft.VisualBasic.Core/Directory.Build.props index fac4b55f49cd7d..74f97da58b5daf 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/Directory.Build.props +++ b/src/libraries/Microsoft.VisualBasic.Core/Directory.Build.props @@ -1,7 +1,13 @@  - $([MSBuild]::Add($(MajorVersion), 5)).$(MinorVersion).0.0 + + $([MSBuild]::Add($(MajorVersion), 5)) + $(MajorVersion).$(MinorVersion).0.0 + + 1 Microsoft true diff --git a/src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/TextFieldParser.vb b/src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/TextFieldParser.vb index 9f9140eb846231..3ffcac0d716232 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/TextFieldParser.vb +++ b/src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/FileIO/TextFieldParser.vb @@ -690,16 +690,14 @@ Namespace Microsoft.VisualBasic.FileIO ' No need to slide if we're already at the beginning If m_Position > 0 Then - Dim BufferLength As Integer = m_Buffer.Length - Dim TempArray(BufferLength - 1) As Char - Array.Copy(m_Buffer, m_Position, TempArray, 0, BufferLength - m_Position) + Dim ContentLength As Integer = m_CharsRead - m_Position - ' Fill the rest of the buffer - Dim CharsRead As Integer = m_Reader.Read(TempArray, BufferLength - m_Position, m_Position) - m_CharsRead = m_CharsRead - m_Position + CharsRead + Array.Copy(m_Buffer, m_Position, m_Buffer, 0, ContentLength) + ' Try to fill the rest of the buffer + Dim CharsRead As Integer = m_Reader.Read(m_Buffer, ContentLength, m_Buffer.Length - ContentLength) + m_CharsRead = ContentLength + CharsRead m_Position = 0 - m_Buffer = TempArray Return CharsRead End If @@ -717,27 +715,30 @@ Namespace Microsoft.VisualBasic.FileIO Debug.Assert(m_Buffer IsNot Nothing, "There's no buffer") Debug.Assert(m_Reader IsNot Nothing, "There's no StreamReader") + Debug.Assert(m_Position = 0, "Non-zero position") ' Set cursor m_PeekPosition = m_CharsRead - ' Create a larger buffer and copy our data into it - Dim BufferSize As Integer = m_Buffer.Length + DEFAULT_BUFFER_LENGTH + If m_CharsRead = m_Buffer.Length Then + ' Create a larger buffer and copy our data into it + Dim BufferSize As Integer = m_Buffer.Length + DEFAULT_BUFFER_LENGTH + + ' Make sure the buffer hasn't grown too large + If BufferSize > m_MaxBufferSize Then + Throw GetInvalidOperationException(SR.TextFieldParser_BufferExceededMaxSize) + End If - ' Make sure the buffer hasn't grown too large - If BufferSize > m_MaxBufferSize Then - Throw GetInvalidOperationException(SR.TextFieldParser_BufferExceededMaxSize) + Dim TempArray(BufferSize - 1) As Char + Array.Copy(m_Buffer, TempArray, m_Buffer.Length) + m_Buffer = TempArray End If - Dim TempArray(BufferSize - 1) As Char + Dim CharsRead As Integer = m_Reader.Read(m_Buffer, m_CharsRead, m_Buffer.Length - m_CharsRead) + Debug.Assert(CharsRead <= m_Buffer.Length - m_CharsRead, "We've read more chars than we have space for") - Array.Copy(m_Buffer, TempArray, m_Buffer.Length) - Dim CharsRead As Integer = m_Reader.Read(TempArray, m_Buffer.Length, DEFAULT_BUFFER_LENGTH) - m_Buffer = TempArray m_CharsRead += CharsRead - Debug.Assert(m_CharsRead <= BufferSize, "We've read more chars than we have space for") - Return CharsRead End Function diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj index 3900dc68845302..821cd0397ac1c6 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft.VisualBasic.Core.Tests.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent);net461 + $(NetCoreAppCurrent);net48-windows @@ -52,7 +52,7 @@ - + diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/FileIO/TextFieldParserTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/FileIO/TextFieldParserTests.cs index a9f0553e54236a..925741dbcc06ee 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/FileIO/TextFieldParserTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/FileIO/TextFieldParserTests.cs @@ -2,7 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Generic; using System.IO; +using System.Linq; +using System.Text; using Xunit; namespace Microsoft.VisualBasic.FileIO.Tests @@ -372,5 +375,73 @@ public void UnmatchedQuote_MalformedLineException() Assert.Throws(() => parser.ReadFields()); } } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void ReadFields_PartialReadsFromStream_Large(bool fieldsInQuotes) => + ReadFields_PartialReadsFromStream(fieldsInQuotes, 1023); + + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Framework doesn't properly handle streams frequently returning much less than requested")] + [Theory] + [InlineData(false)] + [InlineData(true)] + public void ReadFields_PartialReadsFromStream_Small(bool fieldsInQuotes) => + ReadFields_PartialReadsFromStream(fieldsInQuotes, 10); + + private void ReadFields_PartialReadsFromStream(bool fieldsInQuotes, int maxCount) + { + // Generate some data + var rand = new Random(42); + string[][] expected = Enumerable + .Range(0, 10_000) + .Select(_ => Enumerable.Range(0, 4).Select(_ => new string('s', rand.Next(0, 10))).ToArray()) + .ToArray(); + + // Write it out + Stream s = new DribbleStream() { MaxCount = maxCount }; + using (var writer = new StreamWriter(s, Encoding.UTF8, 1024, leaveOpen: true)) + { + foreach (string[] line in expected) + { + string separator = ""; + foreach (string part in line) + { + writer.Write(separator); + separator = ","; + if (fieldsInQuotes) writer.Write('"'); + writer.Write(part); + if (fieldsInQuotes) writer.Write('"'); + } + writer.WriteLine(); + } + } + + // Read/parse it back in + s.Position = 0; + using (var parser = new TextFieldParser(s)) + { + parser.TextFieldType = FieldType.Delimited; + parser.SetDelimiters(new[] { "," }); + parser.HasFieldsEnclosedInQuotes = fieldsInQuotes; + + int i = 0; + while (!parser.EndOfData) + { + string[]? actual = parser.ReadFields(); + Assert.Equal(expected[i], actual); + i++; + } + Assert.Equal(expected.Length, i); + } + } + + private sealed class DribbleStream : MemoryStream + { + public int MaxCount { get; set; } = 1; + + public override int Read(byte[] buffer, int offset, int count) => + base.Read(buffer, offset, Math.Min(count, MaxCount)); + } } } diff --git a/src/libraries/Microsoft.Win32.Registry.AccessControl/ref/Microsoft.Win32.Registry.AccessControl.csproj b/src/libraries/Microsoft.Win32.Registry.AccessControl/ref/Microsoft.Win32.Registry.AccessControl.csproj index a0b77d033ab7ec..ab664dfa2e23ee 100644 --- a/src/libraries/Microsoft.Win32.Registry.AccessControl/ref/Microsoft.Win32.Registry.AccessControl.csproj +++ b/src/libraries/Microsoft.Win32.Registry.AccessControl/ref/Microsoft.Win32.Registry.AccessControl.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/libraries/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj b/src/libraries/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj index 881805e1df0ef0..923e64056e39f5 100644 --- a/src/libraries/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj +++ b/src/libraries/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj @@ -3,6 +3,9 @@ true enable true + + false + 0 Provides support for managing access and audit control lists for Microsoft.Win32.RegistryKey. Commonly Used Types: @@ -23,14 +26,18 @@ System.Security.AccessControl.RegistrySecurity + + + + - - + + \ No newline at end of file diff --git a/src/libraries/Microsoft.Win32.SystemEvents/src/CompatibilitySuppressions.xml b/src/libraries/Microsoft.Win32.SystemEvents/src/CompatibilitySuppressions.xml deleted file mode 100644 index 7a8b03634badf8..00000000000000 --- a/src/libraries/Microsoft.Win32.SystemEvents/src/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - CP0001 - lib/netstandard2.0/Microsoft.Win32.SystemEvents.dll - lib/net461/Microsoft.Win32.SystemEvents.dll - - \ No newline at end of file diff --git a/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft.Win32.SystemEvents.csproj b/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft.Win32.SystemEvents.csproj index 068e9ed7954e4f..2e693d5648336e 100644 --- a/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft.Win32.SystemEvents.csproj +++ b/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft.Win32.SystemEvents.csproj @@ -1,6 +1,9 @@ true + + false + 1 Provides access to Windows system event notifications. Commonly Used Types: @@ -35,6 +38,8 @@ Microsoft.Win32.SystemEvents Link="Common\Interop\Windows\User32\Interop.DispatchMessage.cs" /> + Link="Common\Interop\Windows\User32\Interop.MSG.cs" /> - + ? s_threadCallbackList; // list of Delegates private static volatile int s_threadCallbackMessage; - private static volatile ManualResetEvent? s_eventThreadTerminated; // Per-instance data that is isolated to the window thread. private volatile IntPtr _windowHandle; @@ -1071,7 +1070,7 @@ private static void RemoveEventHandler(object key, Delegate? value) private static void Shutdown() { - if (s_systemEvents != null && s_systemEvents._windowHandle != IntPtr.Zero) + if (s_systemEvents != null) { lock (s_procLockObject) { @@ -1080,17 +1079,22 @@ private static void Shutdown() // If we are using system events from another thread, request that it terminate if (s_windowThread != null) { - s_eventThreadTerminated = new ManualResetEvent(false); - #if DEBUG int pid; int thread = Interop.User32.GetWindowThreadProcessId(new HandleRef(s_systemEvents, s_systemEvents._windowHandle), out pid); Debug.Assert(thread != Interop.Kernel32.GetCurrentThreadId(), "Don't call Shutdown on the system events thread"); #endif - Interop.User32.PostMessageW(new HandleRef(s_systemEvents, s_systemEvents._windowHandle), Interop.User32.WM_QUIT, IntPtr.Zero, IntPtr.Zero); - s_eventThreadTerminated.WaitOne(); - s_windowThread.Join(); // avoids an AppDomainUnloaded exception on our background thread. + // The handle could be valid, Zero or invalid depending on the state of the thread + // that is processing the messages. We optimistically expect it to be valid to + // notify the thread to shutdown. The Zero or invalid values should be present + // only when the thread is already shutting down due to external factors. + if (s_systemEvents._windowHandle != IntPtr.Zero) + { + Interop.User32.PostMessageW(new HandleRef(s_systemEvents, s_systemEvents._windowHandle), Interop.User32.WM_QUIT, IntPtr.Zero, IntPtr.Zero); + } + + s_windowThread.Join(); } else { @@ -1218,6 +1222,11 @@ private IntPtr WindowProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam) OnTimerElapsed(wParam); break; + case Interop.User32.WM_DESTROY: + Interop.User32.PostQuitMessage(0); + _windowHandle = IntPtr.Zero; + break; + default: // If we received a thread execute message, then execute it. if (msg == s_threadCallbackMessage && msg != 0) @@ -1248,33 +1257,10 @@ private void WindowThreadProc() { Interop.User32.MSG msg = default(Interop.User32.MSG); - bool keepRunning = true; - - // Blocking on a GetMessage() call prevents the EE from being able to unwind - // this thread properly (e.g. during AppDomainUnload). So, we use PeekMessage() - // and sleep so we always block in managed code instead. - while (keepRunning) + while (Interop.User32.GetMessageW(ref msg, _windowHandle, 0, 0) > 0) { - int ret = Interop.User32.MsgWaitForMultipleObjectsEx(0, IntPtr.Zero, 100, Interop.User32.QS_ALLINPUT, Interop.User32.MWMO_INPUTAVAILABLE); - - if (ret == Interop.User32.WAIT_TIMEOUT) - { - Thread.Sleep(1); - } - else - { - while (Interop.User32.PeekMessageW(ref msg, IntPtr.Zero, 0, 0, Interop.User32.PM_REMOVE)) - { - if (msg.message == Interop.User32.WM_QUIT) - { - keepRunning = false; - break; - } - - Interop.User32.TranslateMessage(ref msg); - Interop.User32.DispatchMessageW(ref msg); - } - } + Interop.User32.TranslateMessage(ref msg); + Interop.User32.DispatchMessageW(ref msg); } } @@ -1293,10 +1279,6 @@ private void WindowThreadProc() } Dispose(); - if (s_eventThreadTerminated != null) - { - s_eventThreadTerminated.Set(); - } } // A class that helps fire events on the right thread. diff --git a/src/libraries/Microsoft.Win32.SystemEvents/tests/Microsoft.Win32.SystemEvents.Tests.csproj b/src/libraries/Microsoft.Win32.SystemEvents/tests/Microsoft.Win32.SystemEvents.Tests.csproj index 4ccc4b8d8845d4..1341ae4f701b7a 100644 --- a/src/libraries/Microsoft.Win32.SystemEvents/tests/Microsoft.Win32.SystemEvents.Tests.csproj +++ b/src/libraries/Microsoft.Win32.SystemEvents/tests/Microsoft.Win32.SystemEvents.Tests.csproj @@ -1,6 +1,6 @@ - $(NetCoreAppCurrent)-windows;net461-windows + $(NetCoreAppCurrent)-windows;net461 true @@ -23,6 +23,7 @@ + diff --git a/src/libraries/Microsoft.Win32.SystemEvents/tests/ShutdownTest.cs b/src/libraries/Microsoft.Win32.SystemEvents/tests/ShutdownTest.cs new file mode 100644 index 00000000000000..d8012da78db70b --- /dev/null +++ b/src/libraries/Microsoft.Win32.SystemEvents/tests/ShutdownTest.cs @@ -0,0 +1,33 @@ +// 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.Threading; +using Microsoft.DotNet.RemoteExecutor; +using Xunit; +using static Interop; + +namespace Microsoft.Win32.SystemEventsTests +{ + public abstract class ShutdownTest : SystemEventsTest + { + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] + public void ShutdownThroughRestartManager() + { + RemoteExecutor.Invoke(() => + { + // Register any event to ensure that SystemEvents get initialized + SystemEvents.TimeChanged += (o, e) => { }; + + // Fake Restart Manager behavior by sending external WM_CLOSE message + SendMessage(Interop.User32.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); + + // Emulate calling the Shutdown event + var shutdownMethod = typeof(SystemEvents).GetMethod("Shutdown", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type[0], null); + Assert.NotNull(shutdownMethod); + shutdownMethod.Invoke(null, null); + }).Dispose(); + } + } +} diff --git a/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj b/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj index ee16f0c79eba8d..a86115b820874c 100644 --- a/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj +++ b/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj @@ -5,6 +5,8 @@ false true + false + 8 $(NoWarn);NU5128 This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard. @@ -29,6 +31,7 @@ + @@ -45,13 +48,14 @@ - + + System.ServiceModel.Security; + System.Web.Services.Description" + Version="$(SystemServiceModelPrimitivesVersion)" /> @@ -63,7 +67,6 @@ - diff --git a/src/libraries/Microsoft.XmlSerializer.Generator/tests/SerializableAssembly.csproj b/src/libraries/Microsoft.XmlSerializer.Generator/tests/SerializableAssembly.csproj index f2a884f290a4f9..d5e4523452eb90 100644 --- a/src/libraries/Microsoft.XmlSerializer.Generator/tests/SerializableAssembly.csproj +++ b/src/libraries/Microsoft.XmlSerializer.Generator/tests/SerializableAssembly.csproj @@ -8,7 +8,7 @@ - + all diff --git a/src/libraries/Native/AnyOS/zlib/pal_zlib.c b/src/libraries/Native/AnyOS/zlib/pal_zlib.c index aa4dcdca8a29e8..8dfbd908276c9b 100644 --- a/src/libraries/Native/AnyOS/zlib/pal_zlib.c +++ b/src/libraries/Native/AnyOS/zlib/pal_zlib.c @@ -7,6 +7,11 @@ #ifdef _WIN32 #define c_static_assert(e) static_assert((e),"") +#endif + +#ifdef INTERNAL_ZLIB_INTEL + #include "../../Windows/System.IO.Compression.Native/zlib-intel/zlib.h" +#elif defined(_WIN32) || defined(__EMSCRIPTEN__) #include "../../Windows/System.IO.Compression.Native/zlib/zlib.h" #else #include "pal_utilities.h" @@ -37,14 +42,11 @@ Initializes the PAL_ZStream by creating and setting its underlying z_stream. */ static int32_t Init(PAL_ZStream* stream) { - z_stream* zStream = (z_stream*)malloc(sizeof(z_stream)); + z_stream* zStream = (z_stream*)calloc(1, sizeof(z_stream)); stream->internalState = zStream; if (zStream != NULL) { - zStream->zalloc = Z_NULL; - zStream->zfree = Z_NULL; - zStream->opaque = Z_NULL; return PAL_Z_OK; } else diff --git a/src/libraries/Native/AnyOS/zlib/zlib_allocator_unix.c b/src/libraries/Native/AnyOS/zlib/zlib_allocator_unix.c new file mode 100644 index 00000000000000..a4f14c69f1a65b --- /dev/null +++ b/src/libraries/Native/AnyOS/zlib/zlib_allocator_unix.c @@ -0,0 +1,201 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include +#include +#include "../../Windows/System.IO.Compression.Native/zlib/zutil.h" + +/* A custom allocator for zlib that provides some defense-in-depth over standard malloc / free. + * (non-Windows version) + * + * 1. When zlib allocates fixed-length data structures for containing stream metadata, we zero + * the memory before using it, preventing use of uninitialized memory within these structures. + * Ideally we would do this for dynamically-sized buffers as well, but there is a measurable + * perf impact to doing this. Zeroing fixed structures seems like a good trade-off here, since + * these data structures contain most of the metadata used for managing the variable-length + * dynamically allocated buffers. + * + * 2. We put a cookie both before and after any allocated memory, which allows us to detect local + * buffer overruns on the call to free(). The cookie values are tied to the addresses where + * the data is located in memory. + * + * 3. We trash the aforementioned cookie on free(), which allows us to detect double-free. + * + * If any of these checks fails, the application raises SIGABRT. + */ + +static bool IsMitigationDisabled() +{ + enum _MitigationEnablementTristate + { + MITIGATION_NOT_YET_QUERIED = 0, + MITIGATION_DISABLED = 1, + MITIGATION_ENABLED = 2 // really, anything other than 0 or 1 + }; + static int s_fMitigationEnablementState = MITIGATION_NOT_YET_QUERIED; + + // If already initialized, return immediately. + // We don't need a volatile read here since the publish is performed with release semantics. + if (s_fMitigationEnablementState != MITIGATION_NOT_YET_QUERIED) + { + return (s_fMitigationEnablementState == MITIGATION_DISABLED); + } + + // Initialize the tri-state now. + // It's ok for multiple threads to do this simultaneously. Only one thread will win. + // Valid env var values to disable mitigation: "true" and "1" + // All other env var values (or error) leaves mitigation enabled. + + char* pchEnvVar = getenv("DOTNET_SYSTEM_IO_COMPRESSION_DISABLEZLIBMITIGATIONS"); + bool fMitigationDisabled = (pchEnvVar && (strcmp(pchEnvVar, "1") == 0 || strcmp(pchEnvVar, "true") == 0)); + + // We really don't care about the return value of the ICE operation. If another thread + // beat us to it, so be it. The recursive call will figure it out. + __sync_val_compare_and_swap( + /* destination: */ &s_fMitigationEnablementState, + /* comparand: */ MITIGATION_NOT_YET_QUERIED, + /* exchange: */ fMitigationDisabled ? MITIGATION_DISABLED : MITIGATION_ENABLED); + return IsMitigationDisabled(); +} + +#ifndef MEMORY_ALLOCATION_ALIGNMENT +// malloc() returns an address suitably aligned for any built-in data type. +// Historically, this has been twice the arch's natural word size. +#ifdef HOST_64BIT +#define MEMORY_ALLOCATION_ALIGNMENT 16 +#else +#define MEMORY_ALLOCATION_ALIGNMENT 8 +#endif +#endif + +typedef struct _DOTNET_ALLOC_COOKIE +{ + void* Address; + size_t Size; +} DOTNET_ALLOC_COOKIE; + +static bool SafeAdd(size_t a, size_t b, size_t* sum) +{ + if (SIZE_MAX - a >= b) { *sum = a + b; return true; } + else { *sum = 0; return false; } +} + +static bool SafeMult(size_t a, size_t b, size_t* product) +{ + if (SIZE_MAX / a >= b) { *product = a * b; return true; } + else { *product = 0; return false; } +} + +static DOTNET_ALLOC_COOKIE ReadAllocCookieUnaligned(const void* pSrc) +{ + DOTNET_ALLOC_COOKIE vCookie; + memcpy(&vCookie, pSrc, sizeof(DOTNET_ALLOC_COOKIE)); + return vCookie; +} + +static void WriteAllocCookieUnaligned(void* pDest, DOTNET_ALLOC_COOKIE vCookie) +{ + memcpy(pDest, &vCookie, sizeof(DOTNET_ALLOC_COOKIE)); +} + +// Historically, the memory allocator always returns addresses aligned to some +// particular boundary. We'll make that same guarantee here just in case somebody +// depends on it. +const size_t DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING = (sizeof(DOTNET_ALLOC_COOKIE) + MEMORY_ALLOCATION_ALIGNMENT - 1) & ~((size_t)MEMORY_ALLOCATION_ALIGNMENT - 1); +const size_t DOTNET_ALLOC_TRAILER_COOKIE_SIZE = sizeof(DOTNET_ALLOC_COOKIE); + +voidpf ZLIB_INTERNAL zcalloc(opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + (void)opaque; // unreferenced formal parameter + + if (IsMitigationDisabled()) + { + // fallback logic copied from zutil.c + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); + } + + // If initializing a fixed-size structure, zero the memory. + bool fZeroMemory = (items == 1); + + size_t cbRequested; + if (sizeof(items) + sizeof(size) <= sizeof(cbRequested)) + { + // multiplication can't overflow; no need for safeint + cbRequested = (size_t)items * (size_t)size; + } + else + { + // multiplication can overflow; go through safeint + if (!SafeMult((size_t)items, (size_t)size, &cbRequested)) { return NULL; } + } + + // Make sure the actual allocation has enough room for our frontside & backside cookies. + size_t cbActualAllocationSize; + if (!SafeAdd(cbRequested, DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING + DOTNET_ALLOC_TRAILER_COOKIE_SIZE, &cbActualAllocationSize)) { return NULL; } + + void* pAlloced = (fZeroMemory) ? calloc(1, cbActualAllocationSize) : malloc(cbActualAllocationSize); + if (pAlloced == NULL) { return NULL; } // OOM + + DOTNET_ALLOC_COOKIE* pHeaderCookie = (DOTNET_ALLOC_COOKIE*)pAlloced; + uint8_t* pReturnToCaller = (uint8_t*)pAlloced + DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING; + uint8_t* pTrailerCookie = pReturnToCaller + cbRequested; + + // Write out the same cookie for the header & the trailer, then we're done. + + DOTNET_ALLOC_COOKIE vCookie = { 0 }; + vCookie.Address = pReturnToCaller; + vCookie.Size = cbRequested; + *pHeaderCookie = vCookie; // aligned + WriteAllocCookieUnaligned(pTrailerCookie, vCookie); + + return pReturnToCaller; +} + +static void zcfree_trash_cookie(void* pCookie) +{ + memset(pCookie, 0, sizeof(DOTNET_ALLOC_COOKIE)); +} + +void ZLIB_INTERNAL zcfree(opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + (void)opaque; // unreferenced formal parameter + + if (IsMitigationDisabled()) + { + // fallback logic copied from zutil.c + free(ptr); + return; + } + + if (ptr == NULL) { return; } // ok to free nullptr + + // Check cookie at beginning + + DOTNET_ALLOC_COOKIE* pHeaderCookie = (DOTNET_ALLOC_COOKIE*)((uint8_t*)ptr - DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING); + if (pHeaderCookie->Address != ptr) { goto Fail; } + size_t cbRequested = pHeaderCookie->Size; + + // Check cookie at end + + uint8_t* pTrailerCookie = (uint8_t*)ptr + cbRequested; + DOTNET_ALLOC_COOKIE vTrailerCookie = ReadAllocCookieUnaligned(pTrailerCookie); + if (vTrailerCookie.Address != ptr) { goto Fail; } + if (vTrailerCookie.Size != cbRequested) { goto Fail; } + + // Checks passed - now trash the cookies and free memory + + zcfree_trash_cookie(pHeaderCookie); + zcfree_trash_cookie(pTrailerCookie); + + free(pHeaderCookie); + return; + +Fail: + abort(); // cookie check failed +} diff --git a/src/libraries/Native/AnyOS/zlib/zlib_allocator_win.c b/src/libraries/Native/AnyOS/zlib/zlib_allocator_win.c new file mode 100644 index 00000000000000..9693b0730aa2fe --- /dev/null +++ b/src/libraries/Native/AnyOS/zlib/zlib_allocator_win.c @@ -0,0 +1,234 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include +#include +#include +#include +#include /* _ASSERTE */ + +#ifdef INTERNAL_ZLIB_INTEL +#include "../../Windows/System.IO.Compression.Native/zlib-intel/zutil.h" +#else +#include "../../Windows/System.IO.Compression.Native/zlib/zutil.h" +#endif + +/* A custom allocator for zlib that provides some defense-in-depth over standard malloc / free. + * (Windows-specific version) + * + * 1. In 64-bit processes, we use a custom heap rather than relying on the standard process heap. + * This should cause zlib's buffers to go into a separate address range from the rest of app + * data, making it more difficult for buffer overruns to affect non-zlib-related data structures. + * + * 2. When zlib allocates fixed-length data structures for containing stream metadata, we zero + * the memory before using it, preventing use of uninitialized memory within these structures. + * Ideally we would do this for dynamically-sized buffers as well, but there is a measurable + * perf impact to doing this. Zeroing fixed structures seems like a good trade-off here, since + * these data structures contain most of the metadata used for managing the variable-length + * dynamically allocated buffers. + * + * 3. We put a cookie both before and after any allocated memory, which allows us to detect local + * buffer overruns on the call to free(). The cookie values are enciphered to make it more + * difficult for somebody to guess a correct value. + * + * 4. We trash the aforementioned cookie on free(), which allows us to detect double-free. + * + * If any of these checks fails, the application terminates immediately, optionally triggering a + * crash dump. We use a special code that's easy to search for in Watson. + */ + +BOOL IsMitigationDisabled() +{ + enum _MitigationEnablementTristate + { + MITIGATION_NOT_YET_QUERIED = 0, + MITIGATION_DISABLED = 1, + MITIGATION_ENABLED = 2 // really, anything other than 0 or 1 + }; + static long s_fMitigationEnablementState = MITIGATION_NOT_YET_QUERIED; + + // If already initialized, return immediately. + // We don't need a volatile read here since the publish is performed with release semantics. + if (s_fMitigationEnablementState != MITIGATION_NOT_YET_QUERIED) + { + return (s_fMitigationEnablementState == MITIGATION_DISABLED); + } + + // Initialize the tri-state now. + // It's ok for multiple threads to do this simultaneously. Only one thread will win. + // Valid env var values to disable mitigation: "true" and "1" + // All other env var values (or error) leaves mitigation enabled. + // + // Buffer needs to be large enough to hold null terminator, but returned cch does not include + // null terminator. Note *exclusive* bounds of 0 and buffer length on returned cch. + // Ref: https://learn.microsoft.com/windows/win32/api/winbase/nf-winbase-getenvironmentvariable + CHAR pchBuffer[5]; // enough to hold "true" and a terminator + DWORD dwEnvVarLength = GetEnvironmentVariableA("DOTNET_SYSTEM_IO_COMPRESSION_DISABLEZLIBMITIGATIONS", pchBuffer, _countof(pchBuffer)); + BOOL fMitigationDisabled = (dwEnvVarLength > 0 && dwEnvVarLength < _countof(pchBuffer)) + && (strcmp(pchBuffer, "1") == 0 || strcmp(pchBuffer, "true") == 0); + + // We really don't care about the return value of the ICE operation. If another thread + // beat us to it, so be it. The recursive call will figure it out. + InterlockedCompareExchange( + /* destination: */ &s_fMitigationEnablementState, + /* exchange: */ fMitigationDisabled ? MITIGATION_DISABLED : MITIGATION_ENABLED, + /* comparand: */ MITIGATION_NOT_YET_QUERIED); + return IsMitigationDisabled(); +} + +// Gets the special heap we'll allocate from. +HANDLE GetZlibHeap() +{ +#ifdef _WIN64 + static HANDLE s_hPublishedHeap = NULL; + + // If already initialized, return immediately. + // We don't need a volatile read here since the publish is performed with release semantics. + if (s_hPublishedHeap != NULL) { return s_hPublishedHeap; } + + // Attempt to create a new heap. The heap will be dynamically sized. + HANDLE hNewHeap = HeapCreate(0, 0, 0); + + if (hNewHeap != NULL) + { + // We created a new heap. Attempt to publish it. + if (InterlockedCompareExchangePointer(&s_hPublishedHeap, hNewHeap, NULL) != NULL) + { + HeapDestroy(hNewHeap); // Somebody published before us. Destroy our heap. + hNewHeap = NULL; // Guard against accidental use later in the method. + } + } + else + { + // If we can't create a new heap, fall back to the process default heap. + InterlockedCompareExchangePointer(&s_hPublishedHeap, GetProcessHeap(), NULL); + } + + // Some thread - perhaps us, perhaps somebody else - published the heap. Return it. + // We don't need a volatile read here since the publish is performed with release semantics. + _ASSERTE(s_hPublishedHeap != NULL); + return s_hPublishedHeap; +#else + // We don't want to create a new heap in a 32-bit process because it could end up + // reserving too much of the address space. Instead, fall back to the normal process heap. + return GetProcessHeap(); +#endif +} + +typedef struct _DOTNET_ALLOC_COOKIE +{ + PVOID CookieValue; + union _Size + { + SIZE_T RawValue; + LPVOID EncodedValue; + } Size; +} DOTNET_ALLOC_COOKIE; + +// Historically, the Windows memory allocator always returns addresses aligned to some +// particular boundary. We'll make that same guarantee here just in case somebody +// depends on it. +const SIZE_T DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING = (sizeof(DOTNET_ALLOC_COOKIE) + MEMORY_ALLOCATION_ALIGNMENT - 1) & ~((SIZE_T)MEMORY_ALLOCATION_ALIGNMENT - 1); +const SIZE_T DOTNET_ALLOC_TRAILER_COOKIE_SIZE = sizeof(DOTNET_ALLOC_COOKIE); + +voidpf ZLIB_INTERNAL zcalloc(opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + (void)opaque; // suppress C4100 - unreferenced formal parameter + + if (IsMitigationDisabled()) + { + // fallback logic copied from zutil.c + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); + } + + // If initializing a fixed-size structure, zero the memory. + DWORD dwFlags = (items == 1) ? HEAP_ZERO_MEMORY : 0; + + SIZE_T cbRequested; + if (sizeof(items) + sizeof(size) <= sizeof(cbRequested)) + { + // multiplication can't overflow; no need for safeint + cbRequested = (SIZE_T)items * (SIZE_T)size; + } + else + { + // multiplication can overflow; go through safeint + if (FAILED(SIZETMult(items, size, &cbRequested))) { return NULL; } + } + + // Make sure the actual allocation has enough room for our frontside & backside cookies. + SIZE_T cbActualAllocationSize; + if (FAILED(SIZETAdd(cbRequested, DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING + DOTNET_ALLOC_TRAILER_COOKIE_SIZE, &cbActualAllocationSize))) { return NULL; } + + LPVOID pAlloced = HeapAlloc(GetZlibHeap(), dwFlags, cbActualAllocationSize); + if (pAlloced == NULL) { return NULL; } // OOM + + // Now set the header & trailer cookies + DOTNET_ALLOC_COOKIE* pHeaderCookie = (DOTNET_ALLOC_COOKIE*)pAlloced; + pHeaderCookie->CookieValue = EncodePointer(&pHeaderCookie->CookieValue); + pHeaderCookie->Size.RawValue = cbRequested; + + LPBYTE pReturnToCaller = (LPBYTE)pHeaderCookie + DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING; + + UNALIGNED DOTNET_ALLOC_COOKIE* pTrailerCookie = (UNALIGNED DOTNET_ALLOC_COOKIE*)(pReturnToCaller + cbRequested); + pTrailerCookie->CookieValue = EncodePointer(&pTrailerCookie->CookieValue); + pTrailerCookie->Size.EncodedValue = EncodePointer((PVOID)cbRequested); + + return pReturnToCaller; +} + +FORCEINLINE +void zcfree_trash_cookie(UNALIGNED DOTNET_ALLOC_COOKIE* pCookie) +{ + memset(pCookie, 0, sizeof(*pCookie)); + pCookie->CookieValue = (PVOID)(SIZE_T)0xDEADBEEF; +} + +// Marked noinline to keep it on the call stack during crash reports. +DECLSPEC_NOINLINE +DECLSPEC_NORETURN +void zcfree_cookie_check_failed() +{ + __fastfail(FAST_FAIL_HEAP_METADATA_CORRUPTION); +} + +void ZLIB_INTERNAL zcfree(opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + (void)opaque; // suppress C4100 - unreferenced formal parameter + + if (IsMitigationDisabled()) + { + // fallback logic copied from zutil.c + free(ptr); + return; + } + + if (ptr == NULL) { return; } // ok to free nullptr + + // Check cookie at beginning and end + + DOTNET_ALLOC_COOKIE* pHeaderCookie = (DOTNET_ALLOC_COOKIE*)((LPBYTE)ptr - DOTNET_ALLOC_HEADER_COOKIE_SIZE_WITH_PADDING); + if (DecodePointer(pHeaderCookie->CookieValue) != &pHeaderCookie->CookieValue) { goto Fail; } + SIZE_T cbRequested = pHeaderCookie->Size.RawValue; + + UNALIGNED DOTNET_ALLOC_COOKIE* pTrailerCookie = (UNALIGNED DOTNET_ALLOC_COOKIE*)((LPBYTE)ptr + cbRequested); + if (DecodePointer(pTrailerCookie->CookieValue) != &pTrailerCookie->CookieValue) { goto Fail; } + if (DecodePointer(pTrailerCookie->Size.EncodedValue) != (LPVOID)cbRequested) { goto Fail; } + + // Checks passed - now trash the cookies and free memory + + zcfree_trash_cookie(pHeaderCookie); + zcfree_trash_cookie(pTrailerCookie); + + if (!HeapFree(GetZlibHeap(), 0, pHeaderCookie)) { goto Fail; } + return; + +Fail: + zcfree_cookie_check_failed(); +} diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index 31cea57a629380..d6a53c3a9cde79 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -22,7 +22,7 @@ if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS endif() set(CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir}) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wno-declaration-after-statement") set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.c") # We mark the function which needs exporting with PALEXPORT @@ -36,6 +36,8 @@ add_compile_options(-Wno-cast-align) add_compile_options(-Wno-typedef-redefinition) add_compile_options(-Wno-c11-extensions) add_compile_options(-Wno-unknown-pragmas) +add_compile_options(-Wno-unknown-warning-option) +add_compile_options(-Wno-unused-but-set-variable) check_c_compiler_flag(-Wimplicit-fallthrough COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH) if (COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH) @@ -48,6 +50,19 @@ add_compile_options(-g) if(CMAKE_C_COMPILER_ID STREQUAL Clang) add_compile_options(-Wthread-safety) add_compile_options(-Wno-thread-safety-analysis) + add_compile_options(-Wno-reserved-identifier) + + # clang 16.0 introduced buffer hardening https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734 + # which we are not conforming to yet. + add_compile_options(-Wno-unsafe-buffer-usage) + + # other clang 16.0 suppressions + add_compile_options(-Wno-single-bit-bitfield-constant-conversion) + add_compile_options(-Wno-cast-function-type-strict) + add_compile_options(-Wno-incompatible-function-pointer-types-strict) + + # clang 18.1 supressions + add_compile_options(-Wno-switch-default) elseif(CMAKE_C_COMPILER_ID STREQUAL GNU) add_compile_options(-Wno-stringop-truncation) endif() @@ -206,6 +221,17 @@ else () message(FATAL_ERROR "Unknown build type. Set CMAKE_BUILD_TYPE to DEBUG or RELEASE.") endif () +if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + # Clang will by default emit objc_msgSend stubs in Xcode 14, which ld from earlier Xcodes doesn't understand. + # We disable this by passing -fno-objc-msgsend-selector-stubs to clang. + # We can probably remove this flag once we require developers to use Xcode 14. + # Ref: https://github.com/xamarin/xamarin-macios/issues/16223 + check_c_compiler_flag(-fno-objc-msgsend-selector-stubs COMPILER_SUPPORTS_FNO_OBJC_MSGSEND_SELECTOR_STUBS) + if(COMPILER_SUPPORTS_FNO_OBJC_MSGSEND_SELECTOR_STUBS) + set(CLR_CMAKE_COMMON_OBJC_FLAGS "${CLR_CMAKE_COMMON_OBJC_FLAGS} -fno-objc-msgsend-selector-stubs") + endif() +endif() + if(CLR_CMAKE_TARGET_BROWSER) elseif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) add_definitions(-D__APPLE_USE_RFC_3542) @@ -217,6 +243,7 @@ else () endif () if (CLR_CMAKE_TARGET_LINUX) + add_definitions(-DTARGET_LINUX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") endif () diff --git a/src/libraries/Native/Unix/Common/pal_config.h.in b/src/libraries/Native/Unix/Common/pal_config.h.in index 9a02610534101b..9cffccbb0cc718 100644 --- a/src/libraries/Native/Unix/Common/pal_config.h.in +++ b/src/libraries/Native/Unix/Common/pal_config.h.in @@ -36,8 +36,7 @@ #cmakedefine01 HAVE_STRLCAT #cmakedefine01 HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP #cmakedefine01 HAVE_POSIX_ADVISE -#cmakedefine01 HAVE_POSIX_FALLOCATE -#cmakedefine01 HAVE_POSIX_FALLOCATE64 +#cmakedefine01 HAVE_FALLOCATE #cmakedefine01 HAVE_PREADV #cmakedefine01 HAVE_PWRITEV #cmakedefine01 PRIORITY_REQUIRES_INT_WHO @@ -78,6 +77,10 @@ #cmakedefine01 HAVE_NETINET_IP_VAR_H #cmakedefine01 HAVE_NETINET_ICMP_VAR_H #cmakedefine01 HAVE_IOS_NET_ROUTE_H +#cmakedefine01 HAVE_IOS_NETINET_IP_VAR_H +#cmakedefine01 HAVE_IOS_NETINET_ICMP_VAR_H +#cmakedefine01 HAVE_IOS_NETINET_TCPFSM_H +#cmakedefine01 HAVE_IOS_NETINET_UDP_VAR_H #cmakedefine01 HAVE_RT_MSGHDR #cmakedefine01 HAVE_RT_MSGHDR2 #cmakedefine01 HAVE_IF_MSGHDR2 @@ -88,6 +91,7 @@ #cmakedefine01 HAVE_NET_IF_ARP_H #cmakedefine01 HAVE_SYS_MNTENT_H #cmakedefine01 HAVE_NET_IFMEDIA_H +#cmakedefine01 HAVE_IOS_NET_IFMEDIA_H #cmakedefine01 HAVE_LINUX_RTNETLINK_H #cmakedefine01 HAVE_LINUX_CAN_H #cmakedefine01 HAVE_GETDOMAINNAME_SIZET diff --git a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt index 644d7774feffa7..5435f6b38a29d8 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt @@ -64,6 +64,11 @@ set(NATIVEGLOBALIZATION_SOURCES pal_icushim.c ) +if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} pal_locale.m) + set_source_files_properties(pal_locale.m PROPERTIES COMPILE_FLAGS "${CLR_CMAKE_COMMON_OBJC_FLAGS}") +endif() + # time zone names are filtered out of icu data for the browser and associated functionality is disabled if (NOT CLR_CMAKE_TARGET_BROWSER) set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} pal_timeZoneInfo.c) @@ -80,6 +85,11 @@ endif() include_directories("../Common") if (GEN_SHARED_LIB) + if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + include(CMakeFindFrameworks) + find_library(FOUNDATION Foundation REQUIRED) + endif() + add_library(System.Globalization.Native SHARED ${NATIVEGLOBALIZATION_SOURCES} @@ -88,12 +98,12 @@ if (GEN_SHARED_LIB) target_link_libraries(System.Globalization.Native dl + ${FOUNDATION} ) install_with_stripped_symbols (System.Globalization.Native PROGRAMS .) endif() - add_library(System.Globalization.Native-Static STATIC ${NATIVEGLOBALIZATION_SOURCES} diff --git a/src/libraries/Native/Unix/System.Globalization.Native/configure.cmake b/src/libraries/Native/Unix/System.Globalization.Native/configure.cmake index fc00d106185b25..da5562b736d2b6 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/configure.cmake +++ b/src/libraries/Native/Unix/System.Globalization.Native/configure.cmake @@ -19,6 +19,11 @@ else() ucol_setMaxVariable "unicode/ucol.h" HAVE_SET_MAX_VARIABLE) + + check_symbol_exists( + ucol_clone + "unicode/ucol.h" + HAVE_UCOL_CLONE) unset(CMAKE_REQUIRED_LIBRARIES) unset(CMAKE_REQUIRED_INCLUDES) diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c index 4a4c969485cb1c..8ae6b040bb9a4c 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_collation.c @@ -321,7 +321,24 @@ static UCollator* CloneCollatorWithOptions(const UCollator* pCollator, int32_t o if (customRuleLength == 0) { +#if !defined(STATIC_ICU) + if (ucol_clone_ptr != NULL) + { + pClonedCollator = ucol_clone(pCollator, pErr); + } + else + { + pClonedCollator = ucol_safeClone_ptr(pCollator, NULL, NULL, pErr); + } +#else // !defined(STATIC_ICU) + +#if HAVE_UCOL_CLONE + pClonedCollator = ucol_clone(pCollator, pErr); +#else pClonedCollator = ucol_safeClone(pCollator, NULL, NULL, pErr); +#endif // HAVE_UCOL_CLONE + +#endif // !defined(STATIC_ICU) } else { @@ -365,6 +382,24 @@ static UCollator* CloneCollatorWithOptions(const UCollator* pCollator, int32_t o { ucol_setAttribute(pClonedCollator, UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, pErr); +#if !defined(STATIC_ICU) + if (ucol_setMaxVariable_ptr != NULL) + { + // by default, ICU alternate shifted handling only ignores punctuation, but + // IgnoreSymbols needs symbols and currency as well, so change the "variable top" + // to include all symbols and currency + ucol_setMaxVariable(pClonedCollator, UCOL_REORDER_CODE_CURRENCY, pErr); + } + else + { + assert(ucol_setVariableTop_ptr != NULL); + // 0xfdfc is the last currency character before the first digit character + // in http://source.icu-project.org/repos/icu/icu/tags/release-52-1/source/data/unidata/FractionalUCA.txt + const UChar ignoreSymbolsVariableTop[] = { 0xfdfc }; + ucol_setVariableTop_ptr(pClonedCollator, ignoreSymbolsVariableTop, 1, pErr); + } + +#else // !defined(STATIC_ICU) // by default, ICU alternate shifted handling only ignores punctuation, but // IgnoreSymbols needs symbols and currency as well, so change the "variable top" // to include all symbols and currency @@ -376,6 +411,8 @@ static UCollator* CloneCollatorWithOptions(const UCollator* pCollator, int32_t o const UChar ignoreSymbolsVariableTop[] = { 0xfdfc }; ucol_setVariableTop(pClonedCollator, ignoreSymbolsVariableTop, 1, pErr); #endif + +#endif //!defined(STATIC_ICU) } ucol_setAttribute(pClonedCollator, UCOL_STRENGTH, strength, pErr); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c index 4f71b66c2678f8..af1a4a59454ac6 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c @@ -29,7 +29,6 @@ FOR_ALL_ICU_FUNCTIONS #define SYMBOL_NAME_SIZE (128 + SYMBOL_CUSTOM_SUFFIX_SIZE) #define MaxICUVersionStringWithSuffixLength (MaxICUVersionStringLength + SYMBOL_CUSTOM_SUFFIX_SIZE) - #if defined(TARGET_WINDOWS) || defined(TARGET_OSX) || defined(TARGET_ANDROID) #define MaxICUVersionStringLength 33 @@ -38,6 +37,8 @@ FOR_ALL_ICU_FUNCTIONS static void* libicuuc = NULL; static void* libicui18n = NULL; +ucol_setVariableTop_func ucol_setVariableTop_ptr = NULL; +ucol_safeClone_func ucol_safeClone_ptr = NULL; #if defined (TARGET_UNIX) @@ -380,6 +381,58 @@ static void ValidateICUDataCanLoad() } } +static void InitializeUColClonePointers(char* symbolVersion) +{ + if (ucol_clone_ptr != NULL) + { + return; + } + +#if defined(TARGET_WINDOWS) + char symbolName[SYMBOL_NAME_SIZE]; + sprintf_s(symbolName, SYMBOL_NAME_SIZE, "ucol_safeClone%s", symbolVersion); + ucol_safeClone_ptr = (ucol_safeClone_func)GetProcAddress((HMODULE)libicui18n, symbolName); +#else + char symbolName[SYMBOL_NAME_SIZE]; + sprintf(symbolName, "ucol_safeClone%s", symbolVersion); + ucol_safeClone_ptr = (ucol_safeClone_func)dlsym(libicui18n, symbolName); +#endif // defined(TARGET_WINDOWS) + + if (ucol_safeClone_ptr == NULL) + { + fprintf(stderr, "Cannot get the symbols of ICU APIs ucol_safeClone or ucol_clone.\n"); + abort(); + } +} + +static void InitializeVariableMaxAndTopPointers(char* symbolVersion) +{ + if (ucol_setMaxVariable_ptr != NULL) + { + return; + } + +#if defined(TARGET_OSX) || defined(TARGET_ANDROID) + // OSX and Android always run against ICU version which has ucol_setMaxVariable. + // We shouldn't come here. + assert(false); +#elif defined(TARGET_WINDOWS) + char symbolName[SYMBOL_NAME_SIZE]; + sprintf_s(symbolName, SYMBOL_NAME_SIZE, "ucol_setVariableTop%s", symbolVersion); + ucol_setVariableTop_ptr = (ucol_setVariableTop_func)GetProcAddress((HMODULE)libicui18n, symbolName); +#else + char symbolName[SYMBOL_NAME_SIZE]; + sprintf(symbolName, "ucol_setVariableTop%s", symbolVersion); + ucol_setVariableTop_ptr = (ucol_setVariableTop_func)dlsym(libicui18n, symbolName); +#endif // defined(TARGET_OSX) || defined(TARGET_ANDROID) + + if (ucol_setVariableTop_ptr == NULL) + { + fprintf(stderr, "Cannot get the symbols of ICU APIs ucol_setMaxVariable or ucol_setVariableTop.\n"); + abort(); + } +} + // GlobalizationNative_LoadICU // This method get called from the managed side during the globalization initialization. // This method shouldn't get called at all if we are running in globalization invariant mode @@ -413,6 +466,10 @@ int32_t GlobalizationNative_LoadICU() FOR_ALL_ICU_FUNCTIONS ValidateICUDataCanLoad(); + + InitializeVariableMaxAndTopPointers(symbolVersion); + InitializeUColClonePointers(symbolVersion); + return true; } @@ -466,6 +523,9 @@ void GlobalizationNative_InitICUFunctions(void* icuuc, void* icuin, const char* FOR_ALL_ICU_FUNCTIONS ValidateICUDataCanLoad(); + + InitializeVariableMaxAndTopPointers(symbolVersion); + InitializeUColClonePointers(symbolVersion); } #undef PER_FUNCTION_BLOCK diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h index 92ded52d687245..47e30e50fda6f9 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h @@ -58,9 +58,32 @@ // (U_ICU_VERSION_MAJOR_NUM < 52) // The following APIs are not supported in the ICU versions less than 52. We need to define them manually. // We have to do runtime check before using the pointers to these APIs. That is why these are listed in the FOR_ALL_OPTIONAL_ICU_FUNCTIONS list. +U_CAPI void U_EXPORT2 ucol_setMaxVariable(UCollator* coll, UColReorderCode group, UErrorCode* pErrorCode); U_CAPI int32_t U_EXPORT2 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region, UChar* id, int32_t idCapacity, UErrorCode* status); U_CAPI int32_t U_EXPORT2 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, UChar* winid, int32_t winidCapacity, UErrorCode* status); -#endif + +// (U_ICU_VERSION_MAJOR_NUM < 71) +// The following API is not supported in the ICU versions less than 71. We need to define it manually. +// We have to do runtime check before using the pointers to this API. That is why these are listed in the FOR_ALL_OPTIONAL_ICU_FUNCTIONS list. +U_CAPI UCollator* U_EXPORT2 ucol_clone(const UCollator* coll, UErrorCode* status); + +// ucol_setVariableTop is a deprecated function on the newer ICU versions and ucol_setMaxVariable should be used instead. +// As can run against ICU versions which not supported ucol_setMaxVariable, we'll dynamically try to get the pointer to ucol_setVariableTop +// when we couldn't get a pointer to ucol_setMaxVariable. +typedef uint32_t (U_EXPORT2 *ucol_setVariableTop_func)(UCollator* coll, const UChar* varTop, int32_t len, UErrorCode* status); + +// ucol_safeClone is deprecated in ICU version 71. We have to handle it manually to avoid getting a build break when referencing it in the code. +typedef UCollator* (U_EXPORT2 *ucol_safeClone_func)(const UCollator* coll, void* stackBuffer, int32_t* pBufferSize, UErrorCode* status); + +#else // !defined(TARGET_ANDROID) + +typedef uint32_t (*ucol_setVariableTop_func)(UCollator* coll, const UChar* varTop, int32_t len, UErrorCode* status); +typedef UCollator* (*ucol_safeClone_func)(const UCollator* coll, void* stackBuffer, int32_t* pBufferSize, UErrorCode* status); + +#endif // !defined(TARGET_ANDROID) + +extern ucol_setVariableTop_func ucol_setVariableTop_ptr; +extern ucol_safeClone_func ucol_safeClone_ptr; // List of all functions from the ICU libraries that are used in the System.Globalization.Native.so #define FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \ @@ -73,8 +96,8 @@ U_CAPI int32_t U_EXPORT2 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, PER_FUNCTION_BLOCK(u_tolower, libicuuc, true) \ PER_FUNCTION_BLOCK(u_toupper, libicuuc, true) \ PER_FUNCTION_BLOCK(u_uastrncpy, libicuuc, true) \ - PER_FUNCTION_BLOCK(ubrk_close, libicui18n, true) \ - PER_FUNCTION_BLOCK(ubrk_openRules, libicui18n, true) \ + PER_FUNCTION_BLOCK(ubrk_close, libicuuc, true) \ + PER_FUNCTION_BLOCK(ubrk_openRules, libicuuc, true) \ PER_FUNCTION_BLOCK(ucal_add, libicui18n, true) \ PER_FUNCTION_BLOCK(ucal_close, libicui18n, true) \ PER_FUNCTION_BLOCK(ucal_get, libicui18n, true) \ @@ -99,7 +122,6 @@ U_CAPI int32_t U_EXPORT2 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, PER_FUNCTION_BLOCK(ucol_open, libicui18n, true) \ PER_FUNCTION_BLOCK(ucol_openElements, libicui18n, true) \ PER_FUNCTION_BLOCK(ucol_openRules, libicui18n, true) \ - PER_FUNCTION_BLOCK(ucol_safeClone, libicui18n, true) \ PER_FUNCTION_BLOCK(ucol_setAttribute, libicui18n, true) \ PER_FUNCTION_BLOCK(ucol_strcoll, libicui18n, true) \ PER_FUNCTION_BLOCK(udat_close, libicui18n, true) \ @@ -164,15 +186,6 @@ U_CAPI int32_t U_EXPORT2 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, PER_FUNCTION_BLOCK(usearch_setPattern, libicui18n, true) \ PER_FUNCTION_BLOCK(usearch_setText, libicui18n, true) -#if HAVE_SET_MAX_VARIABLE -#define FOR_ALL_SET_VARIABLE_ICU_FUNCTIONS \ - PER_FUNCTION_BLOCK(ucol_setMaxVariable, libicui18n, true) -#else - -#define FOR_ALL_SET_VARIABLE_ICU_FUNCTIONS \ - PER_FUNCTION_BLOCK(ucol_setVariableTop, libicui18n, true) -#endif - #if defined(TARGET_WINDOWS) #define FOR_ALL_OS_CONDITIONAL_ICU_FUNCTIONS \ PER_FUNCTION_BLOCK(ucurr_forLocale, libicuuc, true) \ @@ -195,11 +208,12 @@ U_CAPI int32_t U_EXPORT2 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, // Otherwise, we'll just not provide the functionality to users which needed these APIs. #define FOR_ALL_OPTIONAL_ICU_FUNCTIONS \ PER_FUNCTION_BLOCK(ucal_getWindowsTimeZoneID, libicui18n, false) \ - PER_FUNCTION_BLOCK(ucal_getTimeZoneIDForWindowsID, libicui18n, false) + PER_FUNCTION_BLOCK(ucal_getTimeZoneIDForWindowsID, libicui18n, false) \ + PER_FUNCTION_BLOCK(ucol_setMaxVariable, libicui18n, false) \ + PER_FUNCTION_BLOCK(ucol_clone, libicui18n, false) #define FOR_ALL_ICU_FUNCTIONS \ FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \ - FOR_ALL_SET_VARIABLE_ICU_FUNCTIONS \ FOR_ALL_OPTIONAL_ICU_FUNCTIONS \ FOR_ALL_OS_CONDITIONAL_ICU_FUNCTIONS @@ -235,6 +249,7 @@ FOR_ALL_ICU_FUNCTIONS #define ucal_openTimeZoneIDEnumeration(...) ucal_openTimeZoneIDEnumeration_ptr(__VA_ARGS__) #define ucal_set(...) ucal_set_ptr(__VA_ARGS__) #define ucal_setMillis(...) ucal_setMillis_ptr(__VA_ARGS__) +#define ucol_clone(...) ucol_clone_ptr(__VA_ARGS__) #define ucol_close(...) ucol_close_ptr(__VA_ARGS__) #define ucol_closeElements(...) ucol_closeElements_ptr(__VA_ARGS__) #define ucol_getOffset(...) ucol_getOffset_ptr(__VA_ARGS__) @@ -247,13 +262,8 @@ FOR_ALL_ICU_FUNCTIONS #define ucol_open(...) ucol_open_ptr(__VA_ARGS__) #define ucol_openElements(...) ucol_openElements_ptr(__VA_ARGS__) #define ucol_openRules(...) ucol_openRules_ptr(__VA_ARGS__) -#define ucol_safeClone(...) ucol_safeClone_ptr(__VA_ARGS__) #define ucol_setAttribute(...) ucol_setAttribute_ptr(__VA_ARGS__) -#if HAVE_SET_MAX_VARIABLE #define ucol_setMaxVariable(...) ucol_setMaxVariable_ptr(__VA_ARGS__) -#else -#define ucol_setVariableTop(...) ucol_setVariableTop_ptr(__VA_ARGS__) -#endif #define ucol_strcoll(...) ucol_strcoll_ptr(__VA_ARGS__) #define ucurr_forLocale(...) ucurr_forLocale_ptr(__VA_ARGS__) #define ucurr_getName(...) ucurr_getName_ptr(__VA_ARGS__) diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal_android.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal_android.h index 1125ce91c3f804..424f72597dc7d9 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal_android.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal_android.h @@ -470,7 +470,7 @@ int32_t ucol_previous(UCollationElements * elems, UErrorCode * status); UCollator * ucol_open(const char * loc, UErrorCode * status); UCollationElements * ucol_openElements(const UCollator * coll, const UChar * text, int32_t textLength, UErrorCode * status); UCollator * ucol_openRules(const UChar * rules, int32_t rulesLength, UColAttributeValue normalizationMode, UCollationStrength strength, UParseError * parseError, UErrorCode * status); -UCollator * ucol_safeClone(const UCollator * coll, void * stackBuffer, int32_t * pBufferSize, UErrorCode * status); +UCollator * ucol_clone(const UCollator * coll, UErrorCode * status); void ucol_setAttribute(UCollator * coll, UColAttribute attr, UColAttributeValue value, UErrorCode * status); UCollationResult ucol_strcoll(const UCollator * coll, const UChar * source, int32_t sourceLength, const UChar * target, int32_t targetLength); int32_t ucurr_forLocale(const char * locale, UChar * buff, int32_t buffCapacity, UErrorCode * ec); diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.c index cd0e25ed8837fe..498f713404ca09 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.c @@ -129,12 +129,15 @@ int32_t FixupLocaleName(UChar* value, int32_t valueLength) return i; } -// We use whatever ICU give us as the default locale except if it is en_US_POSIX. We'll map -// this POSIX locale to Invariant instead. The reason is POSIX locale collation behavior -// is not desirable at all because it doesn't support case insensitive string comparisons. +// We use whatever ICU give us as the default locale except if it is en_US_POSIX. +// +// On Apple related platforms (OSX, iOS, tvOS, MacCatalyst), we'll take what the system locale is. +// On all other platforms we'll map this POSIX locale to Invariant instead. +// The reason is POSIX locale collation behavior is not desirable at all because it doesn't support case insensitive string comparisons. const char* DetectDefaultLocaleName() { const char* icuLocale = uloc_getDefault(); + if (strcmp(icuLocale, "en_US_POSIX") == 0) { return ""; @@ -216,6 +219,16 @@ int32_t GlobalizationNative_GetDefaultLocaleName(UChar* value, int32_t valueLeng const char* defaultLocale = DetectDefaultLocaleName(); +#ifdef __APPLE__ + char* appleLocale = NULL; + + if (strcmp(defaultLocale, "") == 0) + { + appleLocale = DetectDefaultAppleLocaleName(); + defaultLocale = appleLocale; + } +#endif + uloc_getBaseName(defaultLocale, localeNameBuffer, ULOC_FULLNAME_CAPACITY, &status); u_charsToUChars_safe(localeNameBuffer, value, valueLength, &status); @@ -236,6 +249,11 @@ int32_t GlobalizationNative_GetDefaultLocaleName(UChar* value, int32_t valueLeng } } +#ifdef __APPLE__ + if (appleLocale) + free(appleLocale); +#endif + return UErrorCodeToBool(status); } diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.m b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.m new file mode 100644 index 00000000000000..f574b9d14797e3 --- /dev/null +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale.m @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include +#include "pal_locale_internal.h" + +#import + +char* DetectDefaultAppleLocaleName() +{ + NSLocale *currentLocale = [NSLocale currentLocale]; + NSString *localeName = @""; + + if (!currentLocale) + { + return strdup([localeName UTF8String]); + } + + if ([currentLocale.languageCode length] > 0 && [currentLocale.countryCode length] > 0) + { + localeName = [NSString stringWithFormat:@"%@-%@", currentLocale.languageCode, currentLocale.countryCode]; + } + else + { + localeName = currentLocale.localeIdentifier; + } + + return strdup([localeName UTF8String]); +} + diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale_internal.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale_internal.h index c58436ab77517d..c754554bbfdd55 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_locale_internal.h +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_locale_internal.h @@ -51,3 +51,13 @@ Detect the default locale for the machine, defaulting to Invaraint if we can't compute one (different from uloc_getDefault()) would do. */ const char* DetectDefaultLocaleName(void); + +#ifdef __APPLE__ +/* +Function: +DetectDefaultSystemLocaleName + +Detects the default locale string for Apple platforms +*/ +char* DetectDefaultAppleLocaleName(void); +#endif diff --git a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt index f68e1acef69b00..886309f7b4e675 100644 --- a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt @@ -1,9 +1,5 @@ project(System.IO.Compression.Native C) -if (CLR_CMAKE_TARGET_BROWSER) - add_definitions(-s USE_ZLIB) -endif() - include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake) set(NATIVE_LIBS_EXTRA) @@ -13,7 +9,24 @@ set(NATIVECOMPRESSION_SOURCES ../../AnyOS/zlib/pal_zlib.c ) -if (NOT CLR_CMAKE_TARGET_BROWSER) +if (CLR_CMAKE_TARGET_BROWSER) + set (NATIVECOMPRESSION_SOURCES + ${NATIVECOMPRESSION_SOURCES} + ../../AnyOS/zlib/zlib_allocator_unix.c + ../../Windows/System.IO.Compression.Native/zlib/adler32.c + ../../Windows/System.IO.Compression.Native/zlib/compress.c + ../../Windows/System.IO.Compression.Native/zlib/crc32.c + ../../Windows/System.IO.Compression.Native/zlib/deflate.c + ../../Windows/System.IO.Compression.Native/zlib/inffast.c + ../../Windows/System.IO.Compression.Native/zlib/inflate.c + ../../Windows/System.IO.Compression.Native/zlib/inftrees.c + ../../Windows/System.IO.Compression.Native/zlib/trees.c + ../../Windows/System.IO.Compression.Native/zlib/zutil.c + ) + set_source_files_properties(${NATIVECOMPRESSION_SOURCES} PROPERTIES COMPILE_FLAGS -Wno-implicit-fallthrough) + # enable custom zlib allocator + add_definitions(-DMY_ZCALLOC) +else() #Include Brotli include files include_directories("../../AnyOS/brotli/include") diff --git a/src/libraries/Native/Unix/System.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Native/CMakeLists.txt index a28952750b3ef9..7d118fe6049211 100644 --- a/src/libraries/Native/Unix/System.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Native/CMakeLists.txt @@ -35,15 +35,29 @@ set(NATIVE_SOURCES if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) list (APPEND NATIVE_SOURCES pal_autoreleasepool.m) - set_source_files_properties(pal_autoreleasepool.m PROPERTIES COMPILE_FLAGS -fno-objc-arc) + set_source_files_properties(pal_autoreleasepool.m PROPERTIES COMPILE_FLAGS "-fno-objc-arc ${CLR_CMAKE_COMMON_OBJC_FLAGS}") else() list (APPEND NATIVE_SOURCES pal_autoreleasepool.c) endif() +if (CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + list (APPEND NATIVE_SOURCES pal_environment.m) + set_source_files_properties(pal_environment.m PROPERTIES COMPILE_FLAGS "${CLR_CMAKE_COMMON_OBJC_FLAGS}") +else() + list (APPEND NATIVE_SOURCES pal_environment.c) +endif() + +if (CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + set(NATIVE_SOURCES ${NATIVE_SOURCES} + pal_datetime.m) + set_source_files_properties(pal_datetime.m PROPERTIES COMPILE_FLAGS "${CLR_CMAKE_COMMON_OBJC_FLAGS}") +endif() + if (CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(NATIVE_SOURCES ${NATIVE_SOURCES} pal_log.m pal_searchpath.m) + set_source_files_properties(pal_log.m pal_searchpath.m PROPERTIES COMPILE_FLAGS "${CLR_CMAKE_COMMON_OBJC_FLAGS}") else () list (APPEND NATIVE_SOURCES pal_searchpath.c @@ -54,6 +68,7 @@ endif () if (CLR_CMAKE_TARGET_MACCATALYST) set(NATIVE_SOURCES ${NATIVE_SOURCES} pal_iossupportversion.m) + set_source_files_properties(pal_iossupportversion.m PROPERTIES COMPILE_FLAGS "${CLR_CMAKE_COMMON_OBJC_FLAGS}") else () list (APPEND NATIVE_SOURCES pal_iossupportversion.c) @@ -68,6 +83,14 @@ include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake) set(NATIVE_LIBS_EXTRA) append_extra_system_libs(NATIVE_LIBS_EXTRA) +if (CLR_CMAKE_TARGET_ANDROID AND NOT HAVE_GETIFADDRS) + add_definitions(-DANDROID_GETIFADDRS_WORKAROUND) + add_compile_options(-Wno-gnu-zero-variadic-macro-arguments) + + list (APPEND NATIVE_LIBS_EXTRA -llog) + list (APPEND NATIVE_SOURCES pal_ifaddrs.c) +endif () + if (GEN_SHARED_LIB) add_library(System.Native SHARED diff --git a/src/libraries/Native/Unix/System.Native/entrypoints.c b/src/libraries/Native/Unix/System.Native/entrypoints.c index c8b678ec08340b..5e3ce05d0b1cd9 100644 --- a/src/libraries/Native/Unix/System.Native/entrypoints.c +++ b/src/libraries/Native/Unix/System.Native/entrypoints.c @@ -7,6 +7,7 @@ #include "pal_autoreleasepool.h" #include "pal_console.h" #include "pal_datetime.h" +#include "pal_environment.h" #include "pal_errno.h" #include "pal_interfaceaddresses.h" #include "pal_io.h" @@ -91,7 +92,7 @@ static const Entry s_sysNative[] = DllImportEntry(SystemNative_FTruncate) DllImportEntry(SystemNative_Poll) DllImportEntry(SystemNative_PosixFAdvise) - DllImportEntry(SystemNative_PosixFAllocate) + DllImportEntry(SystemNative_FAllocate) DllImportEntry(SystemNative_Read) DllImportEntry(SystemNative_ReadLink) DllImportEntry(SystemNative_Rename) @@ -218,6 +219,7 @@ static const Entry s_sysNative[] = DllImportEntry(SystemNative_GetOSArchitecture) DllImportEntry(SystemNative_GetProcessArchitecture) DllImportEntry(SystemNative_SearchPath) + DllImportEntry(SystemNative_SearchPath_TempDirectory) DllImportEntry(SystemNative_RegisterForSigChld) DllImportEntry(SystemNative_SetDelayedSigChildConsoleConfigurationHandler) DllImportEntry(SystemNative_SetTerminalInvalidationHandler) @@ -233,6 +235,7 @@ static const Entry s_sysNative[] = DllImportEntry(SystemNative_LowLevelMonitor_Signal_Release) DllImportEntry(SystemNative_UTimensat) DllImportEntry(SystemNative_GetTimestamp) + DllImportEntry(SystemNative_GetBootTimeTicks) DllImportEntry(SystemNative_GetCpuUtilization) DllImportEntry(SystemNative_GetPwUidR) DllImportEntry(SystemNative_GetPwNamR) @@ -257,6 +260,9 @@ static const Entry s_sysNative[] = DllImportEntry(SystemNative_SetPosixSignalHandler) DllImportEntry(SystemNative_GetPlatformSignalNumber) DllImportEntry(SystemNative_GetGroups) + DllImportEntry(SystemNative_GetEnv) + DllImportEntry(SystemNative_GetEnviron) + DllImportEntry(SystemNative_FreeEnviron) }; EXTERN_C const void* SystemResolveDllImport(const char* name); diff --git a/src/libraries/Native/Unix/System.Native/ios/net/if_media.h b/src/libraries/Native/Unix/System.Native/ios/net/if_media.h new file mode 100644 index 00000000000000..e7e1a838d420fc --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/ios/net/if_media.h @@ -0,0 +1,589 @@ +/* + * Copyright (c) 2000-2019 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ +/* $FreeBSD: src/sys/net/if_media.h,v 1.9.2.1 2001/07/04 00:12:38 brooks Exp $ */ + +/* + * Copyright (c) 1997 + * Jonathan Stone and Jason R. Thorpe. All rights reserved. + * + * This software is derived from information provided by Matt Thomas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jonathan Stone + * and Jason R. Thorpe for the NetBSD Project. + * 4. The names of the authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NET_IF_MEDIA_H_ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#define _NET_IF_MEDIA_H_ +#pragma clang diagnostic pop +#ifndef DRIVERKIT +#include +#endif /* DRIVERKIT */ + +/* + * Prototypes and definitions for BSD/OS-compatible network interface + * media selection. + * + * Where it is safe to do so, this code strays slightly from the BSD/OS + * design. Software which uses the API (device drivers, basically) + * shouldn't notice any difference. + * + * Many thanks to Matt Thomas for providing the information necessary + * to implement this interface. + */ + +#ifdef KERNEL_PRIVATE +/* sigh; some modules are lazy and thus rely on this */ +#include +#endif /* KERNEL_PRIVATE */ + +/* + * if_media Options word: + * Bits Use + * ---- ------- + * 0-4 Media variant + * 5-7 Media type + * 8-15 Type specific options + * 16-19 Extended media variant bits + * 20-27 Shared (global) options + * 28-31 Instance + */ + +/* + * Ethernet + * + * In order to use more than 31 subtypes, Ethernet uses the extended media + * variant bits + * + * The extended media variant bits are not backward compatible so they + * must not be used by kernel extensions like ifnet and drivers that + * are to be deployed on older system versions + */ +#define IFM_X(x) IFM_X_SUBTYPE(x) /* internal shorthand */ + +#define IFM_ETHER 0x00000020 +#define IFM_10_T 3 /* 10BaseT - RJ45 */ +#define IFM_10_2 4 /* 10Base2 - Thinnet */ +#define IFM_10_5 5 /* 10Base5 - AUI */ +#define IFM_100_TX 6 /* 100BaseTX - RJ45 */ +#define IFM_100_FX 7 /* 100BaseFX - Fiber */ +#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ +#define IFM_100_VG 9 /* 100VG-AnyLAN */ +#define IFM_100_T2 10 /* 100BaseT2 */ +#define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */ +#define IFM_10_STP 12 /* 10BaseT over shielded TP */ +#define IFM_10_FL 13 /* 10baseFL - Fiber */ +#define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */ +#define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ +#define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */ +#ifdef PRIVATE +#define IFM_1000_TX IFM_1000_T /* For compatibility */ +#endif /* PRIVATE */ +#define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ +#define IFM_10G_SR 18 /* 10GbaseSR - multi-mode fiber */ +#define IFM_10G_LR 19 /* 10GbaseLR - single-mode fiber */ +#define IFM_10G_CX4 20 /* 10GbaseCX4 - copper */ +#define IFM_10G_T 21 /* 10GbaseT - 4 pair cat 6 */ +#define IFM_2500_T 22 /* 2500baseT - 4 pair cat 5 */ +#define IFM_5000_T 23 /* 5000baseT - 4 pair cat 5 */ +#define IFM_1000_CX_SGMII 24 /* 1000Base-CX-SGMII */ +#define IFM_1000_KX 25 /* 1000Base-KX backplane */ +#define IFM_10G_KX4 26 /* 10GBase-KX4 backplane */ +#define IFM_10G_KR 27 /* 10GBase-KR backplane */ +#define IFM_10G_CR1 28 /* 10GBase-CR1 Twinax splitter */ +#define IFM_10G_ER 29 /* 10GBase-ER */ +#define IFM_20G_KR2 30 /* 20GBase-KR2 backplane */ +#define IFM_OTHER 31 /* Other: one of the following */ + +/* following types are not visible to old binaries using the low bits of IFM_TMASK */ +#define IFM_2500_SX IFM_X(32) /* 2500BaseSX - multi-mode fiber */ +#define IFM_10G_TWINAX IFM_X(33) /* 10GBase Twinax copper */ +#define IFM_10G_TWINAX_LONG IFM_X(34) /* 10GBase Twinax Long copper */ +#define IFM_10G_LRM IFM_X(35) /* 10GBase-LRM 850nm Multi-mode */ +#define IFM_2500_KX IFM_X(36) /* 2500Base-KX backplane */ +#define IFM_40G_CR4 IFM_X(37) /* 40GBase-CR4 */ +#define IFM_40G_SR4 IFM_X(38) /* 40GBase-SR4 */ +#define IFM_50G_PCIE IFM_X(39) /* 50G Ethernet over PCIE */ +#define IFM_25G_PCIE IFM_X(40) /* 25G Ethernet over PCIE */ +#define IFM_1000_SGMII IFM_X(41) /* 1G media interface */ +#define IFM_10G_SFI IFM_X(42) /* 10G media interface */ +#define IFM_40G_XLPPI IFM_X(43) /* 40G media interface */ +#define IFM_40G_LR4 IFM_X(44) /* 40GBase-LR4 */ +#define IFM_40G_KR4 IFM_X(45) /* 40GBase-KR4 */ +#define IFM_100G_CR4 IFM_X(47) /* 100GBase-CR4 */ +#define IFM_100G_SR4 IFM_X(48) /* 100GBase-SR4 */ +#define IFM_100G_KR4 IFM_X(49) /* 100GBase-KR4 */ +#define IFM_100G_LR4 IFM_X(50) /* 100GBase-LR4 */ +#define IFM_56G_R4 IFM_X(51) /* 56GBase-R4 */ +#define IFM_100_T IFM_X(52) /* 100BaseT - RJ45 */ +#define IFM_25G_CR IFM_X(53) /* 25GBase-CR */ +#define IFM_25G_KR IFM_X(54) /* 25GBase-KR */ +#define IFM_25G_SR IFM_X(55) /* 25GBase-SR */ +#define IFM_50G_CR2 IFM_X(56) /* 50GBase-CR2 */ +#define IFM_50G_KR2 IFM_X(57) /* 50GBase-KR2 */ +#define IFM_25G_LR IFM_X(58) /* 25GBase-LR */ +#define IFM_10G_AOC IFM_X(59) /* 10G active optical cable */ +#define IFM_25G_ACC IFM_X(60) /* 25G active copper cable */ +#define IFM_25G_AOC IFM_X(61) /* 25G active optical cable */ +#define IFM_100_SGMII IFM_X(62) /* 100M media interface */ +#define IFM_2500_X IFM_X(63) /* 2500BaseX */ +#define IFM_5000_KR IFM_X(64) /* 5GBase-KR backplane */ +#define IFM_25G_T IFM_X(65) /* 25GBase-T - RJ45 */ +#define IFM_25G_CR_S IFM_X(66) /* 25GBase-CR (short) */ +#define IFM_25G_CR1 IFM_X(67) /* 25GBase-CR1 DA cable */ +#define IFM_25G_KR_S IFM_X(68) /* 25GBase-KR (short) */ +#define IFM_5000_KR_S IFM_X(69) /* 5GBase-KR backplane (short) */ +#define IFM_5000_KR1 IFM_X(70) /* 5GBase-KR backplane */ +#define IFM_25G_AUI IFM_X(71) /* 25G-AUI-C2C (chip to chip) */ +#define IFM_40G_XLAUI IFM_X(72) /* 40G-XLAUI */ +#define IFM_40G_XLAUI_AC IFM_X(73) /* 40G active copper/optical */ +#define IFM_40G_ER4 IFM_X(74) /* 40GBase-ER4 */ +#define IFM_50G_SR2 IFM_X(75) /* 50GBase-SR2 */ +#define IFM_50G_LR2 IFM_X(76) /* 50GBase-LR2 */ +#define IFM_50G_LAUI2_AC IFM_X(77) /* 50G active copper/optical */ +#define IFM_50G_LAUI2 IFM_X(78) /* 50G-LAUI2 */ +#define IFM_50G_AUI2_AC IFM_X(79) /* 50G active copper/optical */ +#define IFM_50G_AUI2 IFM_X(80) /* 50G-AUI2 */ +#define IFM_50G_CP IFM_X(81) /* 50GBase-CP */ +#define IFM_50G_SR IFM_X(82) /* 50GBase-SR */ +#define IFM_50G_LR IFM_X(83) /* 50GBase-LR */ +#define IFM_50G_FR IFM_X(84) /* 50GBase-FR */ +#define IFM_50G_KR_PAM4 IFM_X(85) /* 50GBase-KR PAM4 */ +#define IFM_25G_KR1 IFM_X(86) /* 25GBase-KR1 */ +#define IFM_50G_AUI1_AC IFM_X(87) /* 50G active copper/optical */ +#define IFM_50G_AUI1 IFM_X(88) /* 50G-AUI1 */ +#define IFM_100G_CAUI4_AC IFM_X(89) /* 100G-CAUI4 active copper/optical */ +#define IFM_100G_CAUI4 IFM_X(90) /* 100G-CAUI4 */ +#define IFM_100G_AUI4_AC IFM_X(91) /* 100G-AUI4 active copper/optical */ +#define IFM_100G_AUI4 IFM_X(92) /* 100G-AUI4 */ +#define IFM_100G_CR_PAM4 IFM_X(93) /* 100GBase-CR PAM4 */ +#define IFM_100G_KR_PAM4 IFM_X(94) /* 100GBase-CR PAM4 */ +#define IFM_100G_CP2 IFM_X(95) /* 100GBase-CP2 */ +#define IFM_100G_SR2 IFM_X(96) /* 100GBase-SR2 */ +#define IFM_100G_DR IFM_X(97) /* 100GBase-DR */ +#define IFM_100G_KR2_PAM4 IFM_X(98) /* 100GBase-KR2 PAM4 */ +#define IFM_100G_CAUI2_AC IFM_X(99) /* 100G-CAUI2 active copper/optical */ +#define IFM_100G_CAUI2 IFM_X(100) /* 100G-CAUI2 */ +#define IFM_100G_AUI2_AC IFM_X(101) /* 100G-AUI2 active copper/optical */ +#define IFM_100G_AUI2 IFM_X(102) /* 100G-AUI2 */ +#define IFM_200G_CR4_PAM4 IFM_X(103) /* 200GBase-CR4 PAM4 */ +#define IFM_200G_SR4 IFM_X(104) /* 200GBase-SR4 */ +#define IFM_200G_FR4 IFM_X(105) /* 200GBase-FR4 */ +#define IFM_200G_LR4 IFM_X(106) /* 200GBase-LR4 */ +#define IFM_200G_DR4 IFM_X(107) /* 200GBase-DR4 */ +#define IFM_200G_KR4_PAM4 IFM_X(108) /* 200GBase-KR4 PAM4 */ +#define IFM_200G_AUI4_AC IFM_X(109) /* 200G-AUI4 active copper/optical */ +#define IFM_200G_AUI4 IFM_X(110) /* 200G-AUI4 */ +#define IFM_200G_AUI8_AC IFM_X(111) /* 200G-AUI8 active copper/optical */ +#define IFM_200G_AUI8 IFM_X(112) /* 200G-AUI8 */ +#define IFM_400G_FR8 IFM_X(113) /* 400GBase-FR8 */ +#define IFM_400G_LR8 IFM_X(114) /* 400GBase-LR8 */ +#define IFM_400G_DR4 IFM_X(115) /* 400GBase-DR4 */ +#define IFM_400G_AUI8_AC IFM_X(116) /* 400G-AUI8 active copper/optical */ +#define IFM_400G_AUI8 IFM_X(117) /* 400G-AUI8 */ + +/* + * Token ring + */ +#define IFM_TOKEN 0x00000040 +#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ +#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ +#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ +#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ +#define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */ +#define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */ +#define IFM_TOK_ETR 0x00000200 /* Early token release */ +#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ +#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ +#define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */ +#define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */ +#define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */ + +/* + * FDDI + */ +#define IFM_FDDI 0x00000060 +#define IFM_FDDI_SMF 3 /* Single-mode fiber */ +#define IFM_FDDI_MMF 4 /* Multi-mode fiber */ +#define IFM_FDDI_UTP 5 /* CDDI / UTP */ +#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ + +/* + * IEEE 802.11 Wireless + */ +#define IFM_IEEE80211 0x00000080 +#define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ +#define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ +#define IFM_IEEE80211_DS2 5 /* Direct Sequence 2Mbps */ +#define IFM_IEEE80211_DS5 6 /* Direct Sequence 5Mbps*/ +#define IFM_IEEE80211_DS11 7 /* Direct Sequence 11Mbps*/ +#define IFM_IEEE80211_DS1 8 /* Direct Sequence 1Mbps */ +#define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ +#define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ + +/* + * Shared media sub-types + */ +#define IFM_AUTO 0 /* Autoselect best media */ +#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ +#define IFM_NONE 2 /* Deselect all media */ + +/* + * Shared options + */ +#define IFM_FDX 0x00100000 /* Force full duplex */ +#define IFM_HDX 0x00200000 /* Force half duplex */ +#define IFM_FLOW 0x00400000 /* enable hardware flow control */ +#define IFM_EEE 0x00800000 /* Support energy efficient ethernet */ +#define IFM_FLAG0 0x01000000 /* Driver defined flag */ +#define IFM_FLAG1 0x02000000 /* Driver defined flag */ +#define IFM_FLAG2 0x04000000 /* Driver defined flag */ +#define IFM_LOOP 0x08000000 /* Put hardware in loopback */ + +/* + * Macros to access bits of extended media sub-types (media variants) + */ +#define IFM_TMASK_COMPAT 0x0000001f /* Lower bits of media sub-type */ +#define IFM_TMASK_EXT 0x000f0000 /* For extended media sub-type */ +#define IFM_TMASK_EXT_SHIFT 11 /* to extract high bits */ +#define IFM_X_SUBTYPE(x) (((x) & IFM_TMASK_COMPAT) | \ + (((x) & (IFM_TMASK_EXT >> IFM_TMASK_EXT_SHIFT)) << IFM_TMASK_EXT_SHIFT)) + +/* + * Masks + */ +#define IFM_NMASK 0x000000e0 /* Network type */ +#define IFM_TMASK (IFM_TMASK_COMPAT|IFM_TMASK_EXT) /* Media sub-type */ +#define IFM_IMASK 0xf0000000 /* Instance */ +#define IFM_ISHIFT 28 /* Instance shift */ +#define IFM_OMASK 0x0000ff00 /* Type specific options */ +#define IFM_GMASK 0x0ff00000 /* Global options */ + +/* + * Status bits + */ +#define IFM_AVALID 0x00000001 /* Active bit valid */ +#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ +#define IFM_WAKESAMENET 0x00000004 /* No link transition while asleep */ + +/* + * Macros to extract various bits of information from the media word. + */ +#define IFM_TYPE(x) ((x) & IFM_NMASK) +#define IFM_SUBTYPE(x) ((x) & IFM_TMASK) +#define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) +#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) +#define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) + +#define IFM_INST_MAX IFM_INST(IFM_IMASK) + +/* + * Macro to create a media word. + */ +#define IFM_MAKEWORD(type, subtype, options, instance) \ + ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) + +/* + * NetBSD extension not defined in the BSDI API. This is used in various + * places to get the canonical description for a given type/subtype. + * + * NOTE: all but the top-level type descriptions must contain NO whitespace! + * Otherwise, parsing these in ifconfig(8) would be a nightmare. + */ +struct ifmedia_description { + int ifmt_word; /* word value; may be masked */ + const char *ifmt_string; /* description */ +}; + +#define IFM_TYPE_DESCRIPTIONS { \ + { IFM_ETHER, "Ethernet" }, \ + { IFM_TOKEN, "Token ring" }, \ + { IFM_FDDI, "FDDI" }, \ + { IFM_IEEE80211, "IEEE802.11" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ + { IFM_10_T, "10baseT/UTP" }, \ + { IFM_10_2, "10base2/BNC" }, \ + { IFM_10_5, "10base5/AUI" }, \ + { IFM_100_TX, "100baseTX" }, \ + { IFM_100_FX, "100baseFX" }, \ + { IFM_100_T4, "100baseT4" }, \ + { IFM_100_VG, "100baseVG" }, \ + { IFM_100_T2, "100baseT2" }, \ + { IFM_10_STP, "10baseSTP" }, \ + { IFM_10_FL, "10baseFL" }, \ + { IFM_1000_SX, "1000baseSX" }, \ + { IFM_1000_LX, "1000baseLX" }, \ + { IFM_1000_CX, "1000baseCX" }, \ + { IFM_1000_T, "1000baseT" }, \ + { IFM_HPNA_1, "homePNA" }, \ + { IFM_10G_LR, "10Gbase-LR" }, \ + { IFM_10G_SR, "10Gbase-SR" }, \ + { IFM_10G_CX4, "10Gbase-CX4" }, \ + { IFM_2500_SX, "2500BaseSX" }, \ + { IFM_10G_LRM, "10Gbase-LRM" }, \ + { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ + { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ + { IFM_10G_T, "10Gbase-T" }, \ + { IFM_40G_CR4, "40Gbase-CR4" }, \ + { IFM_40G_SR4, "40Gbase-SR4" }, \ + { IFM_40G_LR4, "40Gbase-LR4" }, \ + { IFM_1000_KX, "1000Base-KX" }, \ + { IFM_OTHER, "Other" }, \ + { IFM_10G_KX4, "10GBase-KX4" }, \ + { IFM_10G_KR, "10GBase-KR" }, \ + { IFM_10G_CR1, "10GBase-CR1" }, \ + { IFM_20G_KR2, "20GBase-KR2" }, \ + { IFM_2500_KX, "2500Base-KX" }, \ + { IFM_2500_T, "2500Base-T" }, \ + { IFM_5000_T, "5000Base-T" }, \ + { IFM_50G_PCIE, "PCIExpress-50G" }, \ + { IFM_25G_PCIE, "PCIExpress-25G" }, \ + { IFM_1000_SGMII, "1000Base-SGMII" }, \ + { IFM_10G_SFI, "10GBase-SFI" }, \ + { IFM_40G_XLPPI, "40GBase-XLPPI" }, \ + { IFM_1000_CX_SGMII, "1000Base-CX-SGMII" }, \ + { IFM_40G_KR4, "40GBase-KR4" }, \ + { IFM_10G_ER, "10GBase-ER" }, \ + { IFM_100G_CR4, "100GBase-CR4" }, \ + { IFM_100G_SR4, "100GBase-SR4" }, \ + { IFM_100G_KR4, "100GBase-KR4" }, \ + { IFM_100G_LR4, "100GBase-LR4" }, \ + { IFM_56G_R4, "56GBase-R4" }, \ + { IFM_100_T, "100BaseT" }, \ + { IFM_25G_CR, "25GBase-CR" }, \ + { IFM_25G_KR, "25GBase-KR" }, \ + { IFM_25G_SR, "25GBase-SR" }, \ + { IFM_50G_CR2, "50GBase-CR2" }, \ + { IFM_50G_KR2, "50GBase-KR2" }, \ + { IFM_25G_LR, "25GBase-LR" }, \ + { IFM_10G_AOC, "10GBase-AOC" }, \ + { IFM_25G_ACC, "25GBase-ACC" }, \ + { IFM_25G_AOC, "25GBase-AOC" }, \ + { IFM_100_SGMII, "100M-SGMII" }, \ + { IFM_2500_X, "2500Base-X" }, \ + { IFM_5000_KR, "5000Base-KR" }, \ + { IFM_25G_T, "25GBase-T" }, \ + { IFM_25G_CR_S, "25GBase-CR-S" }, \ + { IFM_25G_CR1, "25GBase-CR1" }, \ + { IFM_25G_KR_S, "25GBase-KR-S" }, \ + { IFM_5000_KR_S, "5000Base-KR-S" }, \ + { IFM_5000_KR1, "5000Base-KR1" }, \ + { IFM_25G_AUI, "25G-AUI" }, \ + { IFM_40G_XLAUI, "40G-XLAUI" }, \ + { IFM_40G_XLAUI_AC, "40G-XLAUI-AC" }, \ + { IFM_40G_ER4, "40GBase-ER4" }, \ + { IFM_50G_SR2, "50GBase-SR2" }, \ + { IFM_50G_LR2, "50GBase-LR2" }, \ + { IFM_50G_LAUI2_AC, "50G-LAUI2-AC" }, \ + { IFM_50G_LAUI2, "50G-LAUI2" }, \ + { IFM_50G_AUI2_AC, "50G-AUI2-AC" }, \ + { IFM_50G_AUI2, "50G-AUI2" }, \ + { IFM_50G_CP, "50GBase-CP" }, \ + { IFM_50G_SR, "50GBase-SR" }, \ + { IFM_50G_LR, "50GBase-LR" }, \ + { IFM_50G_FR, "50GBase-FR" }, \ + { IFM_50G_KR_PAM4, "50GBase-KR-PAM4" }, \ + { IFM_25G_KR1, "25GBase-KR1" }, \ + { IFM_50G_AUI1_AC, "50G-AUI1-AC" }, \ + { IFM_50G_AUI1, "50G-AUI1" }, \ + { IFM_100G_CAUI4_AC, "100G-CAUI4-AC" }, \ + { IFM_100G_CAUI4, "100G-CAUI4" }, \ + { IFM_100G_AUI4_AC, "100G-AUI4-AC" }, \ + { IFM_100G_AUI4, "100G-AUI4" }, \ + { IFM_100G_CR_PAM4, "100GBase-CR-PAM4" }, \ + { IFM_100G_KR_PAM4, "100GBase-KR-PAM4" }, \ + { IFM_100G_CP2, "100GBase-CP2" }, \ + { IFM_100G_SR2, "100GBase-SR2" }, \ + { IFM_100G_DR, "100GBase-DR" }, \ + { IFM_100G_KR2_PAM4, "100GBase-KR2-PAM4" }, \ + { IFM_100G_CAUI2_AC, "100G-CAUI2-AC" }, \ + { IFM_100G_CAUI2, "100G-CAUI2" }, \ + { IFM_100G_AUI2_AC, "100G-AUI2-AC" }, \ + { IFM_100G_AUI2, "100G-AUI2" }, \ + { IFM_200G_CR4_PAM4, "200GBase-CR4-PAM4" }, \ + { IFM_200G_SR4, "200GBase-SR4" }, \ + { IFM_200G_FR4, "200GBase-FR4" }, \ + { IFM_200G_LR4, "200GBase-LR4" }, \ + { IFM_200G_DR4, "200GBase-DR4" }, \ + { IFM_200G_KR4_PAM4, "200GBase-KR4-PAM4" }, \ + { IFM_200G_AUI4_AC, "200G-AUI4-AC" }, \ + { IFM_200G_AUI4, "200G-AUI4" }, \ + { IFM_200G_AUI8_AC, "200G-AUI8-AC" }, \ + { IFM_200G_AUI8, "200G-AUI8" }, \ + { IFM_400G_FR8, "400GBase-FR8" }, \ + { IFM_400G_LR8, "400GBase-LR8" }, \ + { IFM_400G_DR4, "400GBase-DR4" }, \ + { IFM_400G_AUI8_AC, "400G-AUI8-AC" }, \ + { IFM_400G_AUI8, "400G-AUI8" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_ALIASES { \ + { IFM_10_T, "UTP" }, \ + { IFM_10_T, "10UTP" }, \ + { IFM_10_2, "BNC" }, \ + { IFM_10_2, "10BNC" }, \ + { IFM_10_5, "AUI" }, \ + { IFM_10_5, "10AUI" }, \ + { IFM_100_TX, "100TX" }, \ + { IFM_100_FX, "100FX" }, \ + { IFM_100_T4, "100T4" }, \ + { IFM_100_VG, "100VG" }, \ + { IFM_100_T2, "100T2" }, \ + { IFM_1000_SX, "1000SX" }, \ + { IFM_10_STP, "STP" }, \ + { IFM_10_STP, "10STP" }, \ + { IFM_10_FL, "FL" }, \ + { IFM_10_FL, "10FL" }, \ + { IFM_1000_LX, "1000LX" }, \ + { IFM_1000_CX, "1000CX" }, \ + { IFM_1000_T, "1000T" }, \ + { IFM_HPNA_1, "HPNA1" }, \ + { IFM_10G_SR, "10GSR" }, \ + { IFM_10G_LR, "10GLR" }, \ + { IFM_10G_CX4, "10GCX4" }, \ + { IFM_10G_T, "10GT" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \ + { IFM_TOK_STP4, "DB9/4Mbit" }, \ + { IFM_TOK_STP16, "DB9/16Mbit" }, \ + { IFM_TOK_UTP4, "UTP/4Mbit" }, \ + { IFM_TOK_UTP16, "UTP/16Mbit" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_ALIASES { \ + { IFM_TOK_STP4, "4STP" }, \ + { IFM_TOK_STP16, "16STP" }, \ + { IFM_TOK_UTP4, "4UTP" }, \ + { IFM_TOK_UTP16, "16UTP" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \ + { IFM_TOK_ETR, "EarlyTokenRelease" }, \ + { IFM_TOK_SRCRT, "SourceRouting" }, \ + { IFM_TOK_ALLR, "AllRoutes" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \ + { IFM_FDDI_SMF, "Single-mode" }, \ + { IFM_FDDI_MMF, "Multi-mode" }, \ + { IFM_FDDI_UTP, "UTP" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_ALIASES { \ + { IFM_FDDI_SMF, "SMF" }, \ + { IFM_FDDI_MMF, "MMF" }, \ + { IFM_FDDI_UTP, "CDDI" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \ + { IFM_FDDI_DA, "Dual-attach" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ + { IFM_IEEE80211_FH1, "FH1" }, \ + { IFM_IEEE80211_FH2, "FH2" }, \ + { IFM_IEEE80211_DS1, "DS1" }, \ + { IFM_IEEE80211_DS2, "DS2" }, \ + { IFM_IEEE80211_DS5, "DS5" }, \ + { IFM_IEEE80211_DS11, "DS11" }, \ + { IFM_IEEE80211_DS22, "DS22" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ + { IFM_IEEE80211_ADHOC, "adhoc" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ + { IFM_AUTO, "autoselect" }, \ + { IFM_MANUAL, "manual" }, \ + { IFM_NONE, "none" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_SHARED_ALIASES { \ + { IFM_AUTO, "auto" }, \ + { 0, NULL }, \ +} + +#define IFM_SHARED_OPTION_DESCRIPTIONS { \ + { IFM_FDX, "full-duplex" }, \ + { IFM_HDX, "half-duplex" }, \ + { IFM_FLOW, "flow-control" }, \ + { IFM_EEE, "energy-efficient-ethernet" }, \ + { IFM_FLAG0, "flag0" }, \ + { IFM_FLAG1, "flag1" }, \ + { IFM_FLAG2, "flag2" }, \ + { IFM_LOOP, "hw-loopback" }, \ + { 0, NULL }, \ +} + +#endif /* _NET_IF_MEDIA_H_ */ \ No newline at end of file diff --git a/src/libraries/Native/Unix/System.Native/ios/netinet/icmp_var.h b/src/libraries/Native/Unix/System.Native/ios/netinet/icmp_var.h new file mode 100644 index 00000000000000..2633ab1bcf5a3e --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/ios/netinet/icmp_var.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2000-2013 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)icmp_var.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/icmp_var.h,v 1.15.2.1 2001/02/24 21:35:18 bmilekic Exp $ + */ + +#ifndef _NETINET_ICMP_VAR_H_ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#define _NETINET_ICMP_VAR_H_ +#pragma clang diagnostic pop +#include + +/* + * Variables related to this implementation + * of the internet control message protocol. + */ +struct icmpstat { +/* statistics related to icmp packets generated */ + u_int32_t icps_error; /* # of calls to icmp_error */ + u_int32_t icps_oldshort; /* no error 'cuz old ip too short */ + u_int32_t icps_oldicmp; /* no error 'cuz old was icmp */ + u_int32_t icps_outhist[ICMP_MAXTYPE + 1]; +/* statistics related to input messages processed */ + u_int32_t icps_badcode; /* icmp_code out of range */ + u_int32_t icps_tooshort; /* packet < ICMP_MINLEN */ + u_int32_t icps_checksum; /* bad checksum */ + u_int32_t icps_badlen; /* calculated bound mismatch */ + u_int32_t icps_reflect; /* number of responses */ + u_int32_t icps_inhist[ICMP_MAXTYPE + 1]; + u_int32_t icps_bmcastecho;/* b/mcast echo requests dropped */ + u_int32_t icps_bmcasttstamp; /* b/mcast tstamp requests dropped */ +}; + +/* + * Names for ICMP sysctl objects + */ +#define ICMPCTL_MASKREPL 1 /* allow replies to netmask requests */ +#define ICMPCTL_STATS 2 /* statistics (read-only) */ +#define ICMPCTL_ICMPLIM 3 +#define ICMPCTL_TIMESTAMP 4 /* allow replies to time stamp requests */ +#define ICMPCTL_MAXID 5 + +#ifdef BSD_KERNEL_PRIVATE +#define ICMPCTL_NAMES { \ + { 0, 0 }, \ + { "maskrepl", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "icmplim", CTLTYPE_INT }, \ + { "icmptimestamp", CTLTYPE_INT }, \ +} + +SYSCTL_DECL(_net_inet_icmp); +#ifdef ICMP_BANDLIM +extern boolean_t badport_bandlim(int which); +#endif +#define BANDLIM_ICMP_UNREACH 0 +#define BANDLIM_ICMP_ECHO 1 +#define BANDLIM_ICMP_TSTAMP 2 +#define BANDLIM_MAX 4 + +extern struct icmpstat icmpstat; +#endif /* BSD_KERNEL_PRIVATE */ +#endif /* _NETINET_ICMP_VAR_H_ */ \ No newline at end of file diff --git a/src/libraries/Native/Unix/System.Native/ios/netinet/ip_var.h b/src/libraries/Native/Unix/System.Native/ios/netinet/ip_var.h new file mode 100644 index 00000000000000..e5137effeed46f --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/ios/netinet/ip_var.h @@ -0,0 +1,371 @@ +/* + * Copyright (c) 2000-2020 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_var.h 8.2 (Berkeley) 1/9/95 + */ +/* + * NOTICE: This file was modified by SPARTA, Inc. in 2007 to introduce + * support for mandatory and extensible security protections. This notice + * is included in support of clause 2.2 (b) of the Apple Public License, + * Version 2.0. + */ + +#ifndef _NETINET_IP_VAR_H_ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#define _NETINET_IP_VAR_H_ +#pragma clang diagnostic pop +#include + +/* + * Overlay for ip header used by other protocols (tcp, udp). + */ +struct ipovly { + u_char ih_x1[9]; /* (unused) */ + u_char ih_pr; /* protocol */ + u_short ih_len; /* protocol length */ + struct in_addr ih_src; /* source internet address */ + struct in_addr ih_dst; /* destination internet address */ +}; + +#ifdef BSD_KERNEL_PRIVATE +/* + * Ip reassembly queue structure. Each fragment + * being reassembled is attached to one of these structures. + * They are timed out after ipq_ttl drops to 0, and may also + * be reclaimed if memory becomes tight. + */ +struct ipq { + TAILQ_ENTRY(ipq) ipq_list; /* to other reass headers */ + struct mbuf *ipq_frags; /* to ip headers of fragments */ + u_char ipq_ttl; /* time for reass q to live */ + u_char ipq_p; /* protocol of this fragment */ + u_short ipq_id; /* sequence id for reassembly */ + struct in_addr ipq_src, ipq_dst; + u_int32_t ipq_nfrags; /* # frags in this packet */ + uint32_t ipq_csum_flags; /* checksum flags */ + uint32_t ipq_csum; /* partial checksum value */ +}; + +/* + * Structure stored in mbuf in inpcb.ip_options + * and passed to ip_output when ip options are in use. + * The actual length of the options (including ipopt_dst) + * is in m_len. + */ +#endif /* BSD_KERNEL_PRIVATE */ +#define MAX_IPOPTLEN 40 +#ifdef BSD_KERNEL_PRIVATE +struct ipoption { + struct in_addr ipopt_dst; /* first-hop dst if source routed */ + char ipopt_list[MAX_IPOPTLEN]; /* options proper */ +}; + +/* + * Structure attached to inpcb.ip_moptions and + * passed to ip_output when IP multicast options are in use. + */ +struct ip_moptions { + decl_lck_mtx_data(, imo_lock); + uint32_t imo_refcnt; /* ref count */ + uint32_t imo_debug; /* see ifa_debug flags */ + struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */ + u_char imo_multicast_ttl; /* TTL for outgoing multicasts */ + u_char imo_multicast_loop; /* 1 => hear sends if a member */ + u_short imo_num_memberships; /* no. memberships this socket */ + u_short imo_max_memberships; /* max memberships this socket */ + struct in_multi **imo_membership; /* group memberships */ + struct in_mfilter *imo_mfilters; /* source filters */ + u_int32_t imo_multicast_vif; /* vif num outgoing multicasts */ + struct in_addr imo_multicast_addr; /* ifindex/addr on MULTICAST_IF */ + void (*imo_trace) /* callback fn for tracing refs */ + (struct ip_moptions *, int); +}; + +#define IMO_LOCK_ASSERT_HELD(_imo) \ + LCK_MTX_ASSERT(&(_imo)->imo_lock, LCK_MTX_ASSERT_OWNED) + +#define IMO_LOCK_ASSERT_NOTHELD(_imo) \ + LCK_MTX_ASSERT(&(_imo)->imo_lock, LCK_MTX_ASSERT_NOTOWNED) + +#define IMO_LOCK(_imo) \ + lck_mtx_lock(&(_imo)->imo_lock) + +#define IMO_LOCK_SPIN(_imo) \ + lck_mtx_lock_spin(&(_imo)->imo_lock) + +#define IMO_CONVERT_LOCK(_imo) do { \ + IMO_LOCK_ASSERT_HELD(_imo); \ + lck_mtx_convert_spin(&(_imo)->imo_lock); \ +} while (0) + +#define IMO_UNLOCK(_imo) \ + lck_mtx_unlock(&(_imo)->imo_lock) + +#define IMO_ADDREF(_imo) \ + imo_addref(_imo, 0) + +#define IMO_ADDREF_LOCKED(_imo) \ + imo_addref(_imo, 1) + +#define IMO_REMREF(_imo) \ + imo_remref(_imo) + +/* mbuf tag for ip_forwarding info */ +struct ip_fwd_tag { + struct sockaddr_in *next_hop; /* next_hop */ +}; +#endif /* BSD_KERNEL_PRIVATE */ + +struct ipstat { + u_int32_t ips_total; /* total packets received */ + u_int32_t ips_badsum; /* checksum bad */ + u_int32_t ips_tooshort; /* packet too short */ + u_int32_t ips_toosmall; /* not enough data */ + u_int32_t ips_badhlen; /* ip header length < data size */ + u_int32_t ips_badlen; /* ip length < ip header length */ + u_int32_t ips_fragments; /* fragments received */ + u_int32_t ips_fragdropped; /* frags dropped (dups, out of space) */ + u_int32_t ips_fragtimeout; /* fragments timed out */ + u_int32_t ips_forward; /* packets forwarded */ + u_int32_t ips_fastforward; /* packets fast forwarded */ + u_int32_t ips_cantforward; /* packets rcvd for unreachable dest */ + u_int32_t ips_redirectsent; /* packets forwarded on same net */ + u_int32_t ips_noproto; /* unknown or unsupported protocol */ + u_int32_t ips_delivered; /* datagrams delivered to upper level */ + u_int32_t ips_localout; /* total ip packets generated here */ + u_int32_t ips_odropped; /* lost packets due to nobufs, etc. */ + u_int32_t ips_reassembled; /* total packets reassembled ok */ + u_int32_t ips_fragmented; /* datagrams successfully fragmented */ + u_int32_t ips_ofragments; /* output fragments created */ + u_int32_t ips_cantfrag; /* don't fragment flag was set, etc. */ + u_int32_t ips_badoptions; /* error in option processing */ + u_int32_t ips_noroute; /* packets discarded due to no route */ + u_int32_t ips_badvers; /* ip version != 4 */ + u_int32_t ips_rawout; /* total raw ip packets generated */ + u_int32_t ips_toolong; /* ip length > max ip packet size */ + u_int32_t ips_notmember; /* multicasts for unregistered grps */ + u_int32_t ips_nogif; /* no match gif found */ + u_int32_t ips_badaddr; /* invalid address on header */ + u_int32_t ips_pktdropcntrl; /* pkt dropped, no mbufs for ctl data */ + u_int32_t ips_rcv_swcsum; /* ip hdr swcksum (inbound), packets */ + u_int32_t ips_rcv_swcsum_bytes; /* ip hdr swcksum (inbound), bytes */ + u_int32_t ips_snd_swcsum; /* ip hdr swcksum (outbound), packets */ + u_int32_t ips_snd_swcsum_bytes; /* ip hdr swcksum (outbound), bytes */ + u_int32_t ips_adj; /* total packets trimmed/adjusted */ + u_int32_t ips_adj_hwcsum_clr; /* hwcksum discarded during adj */ + u_int32_t ips_rxc_collisions; /* rx chaining collisions */ + u_int32_t ips_rxc_chained; /* rx chains */ + u_int32_t ips_rxc_notchain; /* rx bypassed chaining */ + u_int32_t ips_rxc_chainsz_gt2; /* rx chain size greater than 2 */ + u_int32_t ips_rxc_chainsz_gt4; /* rx chain size greater than 4 */ + u_int32_t ips_rxc_notlist; /* count of pkts through ip_input */ + u_int32_t ips_raw_sappend_fail; /* sock append failed */ + u_int32_t ips_necp_policy_drop; /* NECP policy related drop */ + u_int32_t ips_rcv_if_weak_match; /* packets whose receive interface that passed the Weak ES address check */ + u_int32_t ips_rcv_if_no_match; /* packets whose receive interface did not pass the address check */ +}; + +struct ip_linklocal_stat { + u_int32_t iplls_in_total; + u_int32_t iplls_in_badttl; + u_int32_t iplls_out_total; + u_int32_t iplls_out_badttl; +}; + +#ifdef KERNEL_PRIVATE +/* forward declarations for ip_output() */ +struct ip_out_args; +struct ip_moptions; +#endif /* KERNEL_PRIVATE */ + +#ifdef BSD_KERNEL_PRIVATE +/* flags passed to ip_output as last parameter */ +#define IP_FORWARDING 0x1 /* most of ip header exists */ +#define IP_RAWOUTPUT 0x2 /* raw ip header exists */ +#define IP_NOIPSEC 0x4 /* No IPsec processing */ +#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables (0x0010) */ +#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast pkts (0x0020) */ +#define IP_OUTARGS 0x100 /* has ancillary output info */ + +#define IP_HDR_ALIGNED_P(_ip) ((((uintptr_t)(_ip)) & ((uintptr_t)3)) == 0) +#define IP_OFF_IS_ATOMIC(_ip_off) ((_ip_off & (IP_DF | IP_MF | IP_OFFMASK)) == IP_DF) + +/* + * On platforms which require strict alignment (currently for anything but + * i386 or x86_64), this macro checks whether the pointer to the IP header + * is 32-bit aligned, and assert otherwise. + */ +#if defined(__i386__) || defined(__x86_64__) +#define IP_HDR_STRICT_ALIGNMENT_CHECK(_ip) do { } while (0) +#else /* !__i386__ && !__x86_64__ */ +#define IP_HDR_STRICT_ALIGNMENT_CHECK(_ip) do { \ + if (!IP_HDR_ALIGNED_P(_ip)) { \ + panic_plain("\n%s: Unaligned IP header %p\n", \ + __func__, _ip); \ + } \ +} while (0) +#endif /* !__i386__ && !__x86_64__ */ + +struct ip; +struct inpcb; +struct route; +struct sockopt; + +#include +#include + +/* + * Extra information passed to ip_output when IP_OUTARGS is set. + * + * Upon returning an error to the caller, ip_output may indicate through + * ipoa_retflags any additional information regarding the error. + */ +struct ip_out_args { + unsigned int ipoa_boundif; /* boundif interface index */ + struct flowadv ipoa_flowadv; /* flow advisory code */ + u_int32_t ipoa_flags; /* IPOAF output flags (see below) */ +#define IPOAF_SELECT_SRCIF 0x00000001 /* src interface selection */ +#define IPOAF_BOUND_IF 0x00000002 /* boundif value is valid */ +#define IPOAF_BOUND_SRCADDR 0x00000004 /* bound to src address */ +#define IPOAF_NO_CELLULAR 0x00000010 /* skip IFT_CELLULAR */ +#define IPOAF_NO_EXPENSIVE 0x00000020 /* skip IFT_EXPENSIVE */ +#define IPOAF_AWDL_UNRESTRICTED 0x00000040 /* can send over + * AWDL_RESTRICTED */ +#define IPOAF_QOSMARKING_ALLOWED 0x00000080 /* policy allows Fastlane DSCP marking */ +#define IPOAF_NO_CONSTRAINED 0x00000100 /* skip IFXF_CONSTRAINED */ +#define IPOAF_REDO_QOSMARKING_POLICY 0x00000200 /* Re-evaluate QOS marking policy */ + u_int32_t ipoa_retflags; /* IPOARF return flags (see below) */ +#define IPOARF_IFDENIED 0x00000001 /* denied access to interface */ + int ipoa_sotc; /* traffic class for Fastlane DSCP mapping */ + int ipoa_netsvctype; /* network service type */ + int32_t qos_marking_gencount; +}; + +extern struct ipstat ipstat; +extern int ip_use_randomid; +extern u_short ip_id; /* ip packet ctr, for ids */ +extern int ip_defttl; /* default IP ttl */ +extern int ipforwarding; /* ip forwarding */ +extern int rfc6864; +extern struct protosw *ip_protox[]; +extern struct pr_usrreqs rip_usrreqs; + +extern void ip_moptions_init(void); +extern struct ip_moptions *ip_allocmoptions(zalloc_flags_t); +extern int inp_getmoptions(struct inpcb *, struct sockopt *); +extern int inp_setmoptions(struct inpcb *, struct sockopt *); +extern void imo_addref(struct ip_moptions *, int); +extern void imo_remref(struct ip_moptions *); + +struct protosw; +struct domain; + +extern int ip_checkrouteralert(struct mbuf *); +extern int ip_ctloutput(struct socket *, struct sockopt *sopt); +extern void ip_drain(void); +extern void ip_init(struct protosw *, struct domain *); +extern int ip_output(struct mbuf *, struct mbuf *, struct route *, int, + struct ip_moptions *, struct ip_out_args *); +extern int ip_output_list(struct mbuf *, int, struct mbuf *, struct route *, + int, struct ip_moptions *, struct ip_out_args *); +extern void ip_output_checksum(struct ifnet *, struct mbuf *, int, int, + uint32_t *); +extern struct in_ifaddr *ip_rtaddr(struct in_addr); +extern int ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *, + struct mbuf *); +extern struct mbuf *ip_srcroute(void); +extern void ip_stripoptions(struct mbuf *); +extern void ip_initid(void); +extern u_int16_t ip_randomid(void); +extern int ip_fragment(struct mbuf *, struct ifnet *, uint32_t, int); + +extern void ip_setsrcifaddr_info(struct mbuf *, uint32_t, struct in_ifaddr *); +extern void ip_setdstifaddr_info(struct mbuf *, uint32_t, struct in_ifaddr *); +extern int ip_getsrcifaddr_info(struct mbuf *, uint32_t *, uint32_t *); +extern int ip_getdstifaddr_info(struct mbuf *, uint32_t *, uint32_t *); + +extern int rip_ctloutput(struct socket *, struct sockopt *); +extern void rip_ctlinput(int, struct sockaddr *, void *, struct ifnet *); +extern void rip_init(struct protosw *, struct domain *); +extern void rip_input(struct mbuf *, int); +extern int rip_output(struct mbuf *, struct socket *, u_int32_t, struct mbuf *); +extern int rip_unlock(struct socket *, int, void *); +extern int rip_send(struct socket *, int, struct mbuf *, struct sockaddr *, + struct mbuf *, struct proc *); + +extern void tcp_in_cksum_stats(u_int32_t); +extern void tcp_out_cksum_stats(u_int32_t); + +extern void udp_in_cksum_stats(u_int32_t); +extern void udp_out_cksum_stats(u_int32_t); + +extern void tcp_in6_cksum_stats(u_int32_t); +extern void tcp_out6_cksum_stats(u_int32_t); + +extern void udp_in6_cksum_stats(u_int32_t); +extern void udp_out6_cksum_stats(u_int32_t); +#endif /* BSD_KERNEL_PRIVATE */ +#ifdef KERNEL_PRIVATE +/* for PPP/PPTP */ +extern int ip_gre_output(struct mbuf *); +typedef struct mbuf *(*gre_input_func_t)(struct mbuf *, int, int); +extern int ip_gre_register_input(gre_input_func_t); +#endif /* KERNEL_PRIVATE */ +#endif /* !_NETINET_IP_VAR_H_ */ \ No newline at end of file diff --git a/src/libraries/Native/Unix/System.Native/ios/netinet/tcp_fsm.h b/src/libraries/Native/Unix/System.Native/ios/netinet/tcp_fsm.h new file mode 100644 index 00000000000000..869d9bcef8d511 --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/ios/netinet/tcp_fsm.h @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/netinet/tcp_fsm.h,v 1.14 1999/11/07 04:18:30 jlemon Exp $ + */ + +#ifndef _NETINET_TCP_FSM_H_ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#define _NETINET_TCP_FSM_H_ +#pragma clang diagnostic pop +#include + +/* + * TCP FSM state definitions. + * Per RFC793, September, 1981. + */ + +#define TCP_NSTATES 11 + +#define TCPS_CLOSED 0 /* closed */ +#define TCPS_LISTEN 1 /* listening for connection */ +#define TCPS_SYN_SENT 2 /* active, have sent syn */ +#define TCPS_SYN_RECEIVED 3 /* have send and received syn */ +/* states < TCPS_ESTABLISHED are those where connections not established */ +#define TCPS_ESTABLISHED 4 /* established */ +#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ +/* states > TCPS_CLOSE_WAIT are those where user has closed */ +#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ +#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ +#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ +/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ +#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ +#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ + +/* for KAME src sync over BSD*'s */ +#define TCP6_NSTATES TCP_NSTATES +#define TCP6S_CLOSED TCPS_CLOSED +#define TCP6S_LISTEN TCPS_LISTEN +#define TCP6S_SYN_SENT TCPS_SYN_SENT +#define TCP6S_SYN_RECEIVED TCPS_SYN_RECEIVED +#define TCP6S_ESTABLISHED TCPS_ESTABLISHED +#define TCP6S_CLOSE_WAIT TCPS_CLOSE_WAIT +#define TCP6S_FIN_WAIT_1 TCPS_FIN_WAIT_1 +#define TCP6S_CLOSING TCPS_CLOSING +#define TCP6S_LAST_ACK TCPS_LAST_ACK +#define TCP6S_FIN_WAIT_2 TCPS_FIN_WAIT_2 +#define TCP6S_TIME_WAIT TCPS_TIME_WAIT + +#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED) +#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED) +#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT) +#define TCPS_HAVERCVDFIN2(s) ((s) == TCPS_CLOSE_WAIT || \ + (s) == TCPS_CLOSING || \ + (s) == TCPS_LAST_ACK || \ + (s) == TCPS_TIME_WAIT) + +#ifdef KERNEL_PRIVATE +#ifdef TCPOUTFLAGS +/* + * Flags used when sending segments in tcp_output. + * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally + * determined by state, with the proviso that TH_FIN is sent only + * if all data queued for output is included in the segment. + */ +static u_char tcp_outflags[TCP_NSTATES] = { + TH_RST | TH_ACK, /* 0, CLOSED */ + 0, /* 1, LISTEN */ + TH_SYN, /* 2, SYN_SENT */ + TH_SYN | TH_ACK, /* 3, SYN_RECEIVED */ + TH_ACK, /* 4, ESTABLISHED */ + TH_ACK, /* 5, CLOSE_WAIT */ + TH_FIN | TH_ACK, /* 6, FIN_WAIT_1 */ + TH_FIN | TH_ACK, /* 7, CLOSING */ + TH_FIN | TH_ACK, /* 8, LAST_ACK */ + TH_ACK, /* 9, FIN_WAIT_2 */ + TH_ACK, /* 10, TIME_WAIT */ +}; +#endif +#endif /* KERNEL_PRIVATE */ + +#if KPROF +#ifdef KERNEL_PRIVATE +int tcp_acounts[TCP_NSTATES][PRU_NREQ]; +#endif /* KERNEL_PRIVATE */ +#endif + +#ifdef TCPSTATES +char *tcpstates[] = { + "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", + "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", + "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT" +}; +#endif + +#endif \ No newline at end of file diff --git a/src/libraries/Native/Unix/System.Native/ios/netinet/udp_var.h b/src/libraries/Native/Unix/System.Native/ios/netinet/udp_var.h new file mode 100644 index 00000000000000..12e4ea51f0b49e --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/ios/netinet/udp_var.h @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2008-2016 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_UDP_VAR_H_ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#define _NETINET_UDP_VAR_H_ +#pragma clang diagnostic pop + +#include +#include + +/* + * UDP kernel structures and variables. + */ +struct udpiphdr { + struct ipovly ui_i; /* overlaid ip structure */ + struct udphdr ui_u; /* udp header */ +}; +#define ui_x1 ui_i.ih_x1 +#define ui_pr ui_i.ih_pr +#define ui_len ui_i.ih_len +#define ui_src ui_i.ih_src +#define ui_dst ui_i.ih_dst +#define ui_sport ui_u.uh_sport +#define ui_dport ui_u.uh_dport +#define ui_ulen ui_u.uh_ulen +#define ui_sum ui_u.uh_sum +#define ui_next ui_i.ih_next +#define ui_prev ui_i.ih_prev + +struct udpstat { + /* input statistics: */ + u_int32_t udps_ipackets; /* total input packets */ + u_int32_t udps_hdrops; /* packet shorter than header */ + u_int32_t udps_badsum; /* checksum error */ + u_int32_t udps_badlen; /* data length larger than packet */ + u_int32_t udps_noport; /* no socket on port */ + u_int32_t udps_noportbcast; /* of above, arrived as broadcast */ + u_int32_t udps_fullsock; /* not delivered, input socket full */ + u_int32_t udpps_pcbcachemiss; /* input packets missing pcb cache */ + u_int32_t udpps_pcbhashmiss; /* input packets not for hashed pcb */ + /* output statistics: */ + u_int32_t udps_opackets; /* total output packets */ + u_int32_t udps_fastout; /* output packets on fast path */ + u_int32_t udps_nosum; /* no checksum */ + u_int32_t udps_noportmcast; /* of no socket on port, multicast */ + u_int32_t udps_filtermcast; /* blocked by multicast filter */ + /* checksum statistics: */ + u_int32_t udps_rcv_swcsum; /* udp swcksum (inbound), packets */ + u_int32_t udps_rcv_swcsum_bytes; /* udp swcksum (inbound), bytes */ + u_int32_t udps_rcv6_swcsum; /* udp6 swcksum (inbound), packets */ + u_int32_t udps_rcv6_swcsum_bytes; /* udp6 swcksum (inbound), bytes */ + u_int32_t udps_snd_swcsum; /* udp swcksum (outbound), packets */ + u_int32_t udps_snd_swcsum_bytes; /* udp swcksum (outbound), bytes */ + u_int32_t udps_snd6_swcsum; /* udp6 swcksum (outbound), packets */ + u_int32_t udps_snd6_swcsum_bytes; /* udp6 swcksum (outbound), bytes */ +}; + +/* + * Names for UDP sysctl objects + */ +#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */ +#define UDPCTL_STATS 2 /* statistics (read-only) */ +#define UDPCTL_MAXDGRAM 3 /* max datagram size */ +#define UDPCTL_RECVSPACE 4 /* default receive buffer space */ +#define UDPCTL_PCBLIST 5 /* list of PCBs for UDP sockets */ +#define UDPCTL_MAXID 6 + +#ifdef BSD_KERNEL_PRIVATE +#include +#include + +#define UDPCTL_NAMES { \ + { 0, 0 }, \ + { "checksum", CTLTYPE_INT }, \ + { "stats", CTLTYPE_STRUCT }, \ + { "maxdgram", CTLTYPE_INT }, \ + { "recvspace", CTLTYPE_INT }, \ + { "pcblist", CTLTYPE_STRUCT }, \ +} + +#define udp6stat udpstat +#define udp6s_opackets udps_opackets + +SYSCTL_DECL(_net_inet_udp); + +struct udpstat_local { + u_int64_t port_unreach; + u_int64_t faithprefix; /* deprecated */ + u_int64_t port0; + u_int64_t badlength; + u_int64_t badchksum; + u_int64_t badmcast; + u_int64_t cleanup; + u_int64_t badipsec; +}; + +extern struct pr_usrreqs udp_usrreqs; +extern struct inpcbhead udb; +extern struct inpcbinfo udbinfo; +extern u_int32_t udp_sendspace; +extern u_int32_t udp_recvspace; +extern struct udpstat udpstat; +extern int udp_log_in_vain; + +__BEGIN_DECLS +extern void udp_ctlinput(int, struct sockaddr *, void *, struct ifnet *); +extern int udp_ctloutput(struct socket *, struct sockopt *); +extern void udp_init(struct protosw *, struct domain *); +extern void udp_input(struct mbuf *, int); +extern int udp_connectx_common(struct socket *, int, struct sockaddr *, + struct sockaddr *, struct proc *, uint32_t, sae_associd_t, + sae_connid_t *, uint32_t, void *, uint32_t, struct uio*, user_ssize_t *); +extern void udp_notify(struct inpcb *inp, int errno); +extern int udp_shutdown(struct socket *so); +extern int udp_lock(struct socket *, int, void *); +extern int udp_unlock(struct socket *, int, void *); +extern lck_mtx_t *udp_getlock(struct socket *, int); +extern void udp_get_ports_used(u_int32_t, int, u_int32_t, bitstr_t *); +extern uint32_t udp_count_opportunistic(unsigned int, u_int32_t); +extern uint32_t udp_find_anypcb_byaddr(struct ifaddr *); + +extern void udp_fill_keepalive_offload_frames(struct ifnet *, + struct ifnet_keepalive_offload_frame *, u_int32_t, size_t, u_int32_t *); + +__END_DECLS +#endif /* BSD_KERNEL_PRIVATE */ +#endif /* _NETINET_UDP_VAR_H_ */ \ No newline at end of file diff --git a/src/libraries/Native/Unix/System.Native/pal_datetime.h b/src/libraries/Native/Unix/System.Native/pal_datetime.h index 1b88d472780fd1..bc59762a066b0d 100644 --- a/src/libraries/Native/Unix/System.Native/pal_datetime.h +++ b/src/libraries/Native/Unix/System.Native/pal_datetime.h @@ -8,6 +8,6 @@ PALEXPORT int64_t SystemNative_GetSystemTimeAsTicks(void); -#if defined(TARGET_ANDROID) +#if defined(TARGET_ANDROID) || defined(__APPLE__) PALEXPORT char* SystemNative_GetDefaultTimeZone(void); #endif diff --git a/src/libraries/Native/Unix/System.Native/pal_datetime.m b/src/libraries/Native/Unix/System.Native/pal_datetime.m new file mode 100644 index 00000000000000..cd45b54358fc4c --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/pal_datetime.m @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include "pal_datetime.h" +#import + +char* SystemNative_GetDefaultTimeZone() +{ + NSTimeZone *tz = [NSTimeZone localTimeZone]; + NSString *name = [tz name]; + return (name != nil) ? strdup([name UTF8String]) : NULL; +} \ No newline at end of file diff --git a/src/libraries/Native/Unix/System.Native/pal_environment.c b/src/libraries/Native/Unix/System.Native/pal_environment.c new file mode 100644 index 00000000000000..fd9e68f0230281 --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/pal_environment.c @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include "pal_config.h" +#include "pal_environment.h" + +#include +#include +#if HAVE_NSGETENVIRON +#include +#endif + +char* SystemNative_GetEnv(const char* variable) +{ + return getenv(variable); +} + +char** SystemNative_GetEnviron() +{ +#if HAVE_NSGETENVIRON + return *(_NSGetEnviron()); +#else + extern char **environ; + return environ; +#endif +} + +void SystemNative_FreeEnviron(char** environ) +{ + // no op + (void)environ; +} diff --git a/src/libraries/Native/Unix/System.Native/pal_environment.h b/src/libraries/Native/Unix/System.Native/pal_environment.h new file mode 100644 index 00000000000000..dee7a10f3aecdc --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/pal_environment.h @@ -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. + +#pragma once + +#include "pal_compiler.h" +#include "pal_types.h" + +PALEXPORT char* SystemNative_GetEnv(const char* variable); + +PALEXPORT char** SystemNative_GetEnviron(void); + +PALEXPORT void SystemNative_FreeEnviron(char** environ); diff --git a/src/libraries/Native/Unix/System.Native/pal_environment.m b/src/libraries/Native/Unix/System.Native/pal_environment.m new file mode 100644 index 00000000000000..ea4edc6ccd3196 --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/pal_environment.m @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include "pal_config.h" +#include "pal_environment.h" + +#include +#include +#include +#include + +char* SystemNative_GetEnv(const char* variable) +{ + return getenv(variable); +} + +static char *empty_key_value_pair = "="; + +static void get_environ_helper(const void *key, const void *value, void *context) +{ + char ***temp_environ_ptr = (char***)context; + const char *utf8_key = [(NSString *)key UTF8String]; + const char *utf8_value = [(NSString *)value UTF8String]; + int utf8_key_length = strlen(utf8_key); + int utf8_value_length = strlen(utf8_value); + char *key_value_pair; + + key_value_pair = malloc(utf8_key_length + utf8_value_length + 2); + if (key_value_pair != NULL) + { + strcpy(key_value_pair, utf8_key); + key_value_pair[utf8_key_length] = '='; + strcpy(key_value_pair + utf8_key_length + 1, utf8_value); + } + else + { + // In case of failed allocation add pointer to preallocated entry. This is + // ignored on the managed side and skipped over in SystemNative_FreeEnviron. + key_value_pair = empty_key_value_pair; + } + + **temp_environ_ptr = key_value_pair; + (*temp_environ_ptr)++; +} + +char** SystemNative_GetEnviron() +{ + char **temp_environ; + char **temp_environ_ptr; + + CFDictionaryRef environment = (CFDictionaryRef)[[NSProcessInfo processInfo] environment]; + int count = CFDictionaryGetCount(environment); + temp_environ = (char **)malloc((count + 1) * sizeof(char *)); + if (temp_environ != NULL) + { + temp_environ_ptr = temp_environ; + CFDictionaryApplyFunction(environment, get_environ_helper, &temp_environ_ptr); + *temp_environ_ptr = NULL; + } + + return temp_environ; +} + +void SystemNative_FreeEnviron(char** environ) +{ + if (environ != NULL) + { + for (char** environ_ptr = environ; *environ_ptr != NULL; environ_ptr++) + { + if (*environ_ptr != empty_key_value_pair) + { + free(*environ_ptr); + } + } + + free(environ); + } +} diff --git a/src/libraries/Native/Unix/System.Native/pal_ifaddrs.c b/src/libraries/Native/Unix/System.Native/pal_ifaddrs.c new file mode 100644 index 00000000000000..b49edd513280e5 --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/pal_ifaddrs.c @@ -0,0 +1,760 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include "pal_ifaddrs.h" +#include "pal_safecrt.h" + +#include +#include +#include +#include +#include + +#include +#include + +#include +#define LOG(level, ...) __android_log_print(level, "DOTNET_NETLINK", ## __VA_ARGS__) +#define LOG_INFO(...) LOG(ANDROID_LOG_INFO, ## __VA_ARGS__) +#define LOG_WARN(...) LOG(ANDROID_LOG_WARN, ## __VA_ARGS__) +#ifdef DEBUG +#define LOG_DEBUG(...) LOG(ANDROID_LOG_DEBUG, ## __VA_ARGS__) +#else +#define LOG_DEBUG(...) do {} while (0) +#endif + +/* Maximum interface address label size, should be more than enough */ +#define MAX_IFA_LABEL_SIZE 1024 + +/* This is the message we send to the kernel */ +struct netlink_request { + struct nlmsghdr header; + struct rtgenmsg message; +}; + +struct netlink_session { + int sock_fd; + int seq; + struct sockaddr_nl them; /* kernel end */ + struct sockaddr_nl us; /* our end */ + struct msghdr message_header; /* for use with sendmsg */ + struct iovec payload_vector; /* Used to send netlink_request */ +}; + +struct sockaddr_ll_extended { + unsigned short int sll_family; + unsigned short int sll_protocol; + int sll_ifindex; + unsigned short int sll_hatype; + unsigned char sll_pkttype; + unsigned char sll_halen; + unsigned char sll_addr[24]; +}; + +static void free_single_ifaddrs(struct ifaddrs **ifap) +{ + struct ifaddrs *ifa = ifap ? *ifap : NULL; + if (!ifa) + return; + + if (ifa->ifa_name) + free(ifa->ifa_name); + + if (ifa->ifa_addr) + free(ifa->ifa_addr); + + if (ifa->ifa_netmask) + free(ifa->ifa_netmask); + + if (ifa->ifa_broadaddr) + free(ifa->ifa_broadaddr); + + if (ifa->ifa_data) + free(ifa->ifa_data); + + free(ifa); + *ifap = NULL; +} + +static int open_netlink_session(struct netlink_session *session) +{ + abort_if_invalid_pointer_argument(session); + + memset(session, 0, sizeof(*session)); + session->sock_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); + if (session->sock_fd == -1) { + LOG_WARN("Failed to create a netlink socket. %s\n", strerror(errno)); + return -1; + } + + /* Fill out addresses */ + session->us.nl_family = AF_NETLINK; + + /* We have previously used `getpid()` here but it turns out that WebView/Chromium does the same + and there can only be one session with the same PID. Setting it to 0 will cause the kernel to + assign some PID that's unique and valid instead. + See: https://bugzilla.xamarin.com/show_bug.cgi?id=41860 + */ + session->us.nl_pid = 0; + session->us.nl_groups = 0; + + session->them.nl_family = AF_NETLINK; + + if (bind (session->sock_fd, (struct sockaddr *)&session->us, sizeof(session->us)) < 0) { + LOG_WARN("Failed to bind to the netlink socket. %s\n", strerror(errno)); + return -1; + } + + return 0; +} + +static int send_netlink_dump_request(struct netlink_session *session, int type) +{ + struct netlink_request request; + + memset(&request, 0, sizeof(request)); + request.header.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg)); + /* Flags (from netlink.h): + NLM_F_REQUEST - it's a request message + NLM_F_DUMP - gives us the root of the link tree and returns all links matching our requested + AF, which in our case means all of them (AF_PACKET) + */ + request.header.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT | NLM_F_MATCH; + request.header.nlmsg_seq = (uint32_t)++session->seq; + request.header.nlmsg_pid = session->us.nl_pid; + request.header.nlmsg_type = (uint16_t)type; + + /* AF_PACKET means we want to see everything */ + request.message.rtgen_family = AF_PACKET; + + memset(&session->payload_vector, 0, sizeof(session->payload_vector)); + session->payload_vector.iov_len = request.header.nlmsg_len; + session->payload_vector.iov_base = &request; + + memset(&session->message_header, 0, sizeof(session->message_header)); + session->message_header.msg_namelen = sizeof(session->them); + session->message_header.msg_name = &session->them; + session->message_header.msg_iovlen = 1; + session->message_header.msg_iov = &session->payload_vector; + + if (sendmsg(session->sock_fd, (const struct msghdr*)&session->message_header, 0) < 0) { + LOG_WARN("Failed to send netlink message. %s\n", strerror(errno)); + return -1; + } + + return 0; +} + +static int append_ifaddr(struct ifaddrs *addr, struct ifaddrs **ifaddrs_head, struct ifaddrs **last_ifaddr) +{ + abort_if_invalid_pointer_argument(addr); + abort_if_invalid_pointer_argument(ifaddrs_head); + abort_if_invalid_pointer_argument(last_ifaddr); + + if (addr->ifa_name == NULL) { + LOG_WARN("ifa_name is NULL -- skipping"); + return 0; // skip this addr + } + + if (!*ifaddrs_head) { + *ifaddrs_head = *last_ifaddr = addr; + if (!*ifaddrs_head) + return -1; + } else if (!*last_ifaddr) { + struct ifaddrs *last = *ifaddrs_head; + + while (last->ifa_next) + last = last->ifa_next; + *last_ifaddr = last; + } + + addr->ifa_next = NULL; + if (addr == *last_ifaddr) + return 0; + + (*last_ifaddr)->ifa_next = addr; + *last_ifaddr = addr; + + return 0; +} + +static int fill_sa_address(struct sockaddr **sa, struct ifaddrmsg *net_address, void *rta_data, size_t rta_payload_length) +{ + abort_if_invalid_pointer_argument(sa); + abort_if_invalid_pointer_argument(net_address); + abort_if_invalid_pointer_argument(rta_data); + + switch (net_address->ifa_family) { + case AF_INET: { + struct sockaddr_in *sa4; + if (rta_payload_length != 4) /* IPv4 address length */ { + LOG_WARN("Unexpected IPv4 address payload length %zu", rta_payload_length); + return -1; + } + sa4 = (struct sockaddr_in*)calloc(1, sizeof(*sa4)); + if (sa4 == NULL) + return -1; + + sa4->sin_family = AF_INET; + memcpy(&sa4->sin_addr, rta_data, rta_payload_length); + *sa = (struct sockaddr*)sa4; + break; + } + + case AF_INET6: { + struct sockaddr_in6 *sa6; + if (rta_payload_length != 16) /* IPv6 address length */ { + LOG_WARN("Unexpected IPv6 address payload length %zu", rta_payload_length); + return -1; + } + sa6 = (struct sockaddr_in6*)calloc(1, sizeof(*sa6)); + if (sa6 == NULL) + return -1; + + sa6->sin6_family = AF_INET6; + memcpy(&sa6->sin6_addr, rta_data, rta_payload_length); + if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr) || IN6_IS_ADDR_MC_LINKLOCAL (&sa6->sin6_addr)) + sa6->sin6_scope_id = net_address->ifa_index; + *sa = (struct sockaddr*)sa6; + break; + } + + default: { + struct sockaddr *sagen; + if (rta_payload_length > sizeof(sagen->sa_data)) { + LOG_WARN("Unexpected RTA payload length %zu (wanted at most %zu)", rta_payload_length, sizeof(sagen->sa_data)); + return -1; + } + + *sa = sagen = (struct sockaddr*)calloc(1, sizeof(*sagen)); + if (!sagen) + return -1; + + sagen->sa_family = net_address->ifa_family; + memcpy(&sagen->sa_data, rta_data, rta_payload_length); + break; + } + } + + return 0; +} + +static int fill_ll_address(struct sockaddr_ll_extended **sa, struct ifinfomsg *net_interface, void *rta_data, size_t rta_payload_length) +{ + abort_if_invalid_pointer_argument(sa); + abort_if_invalid_pointer_argument(net_interface); + + /* Always allocate, do not free - caller may reuse the same variable */ + *sa = (struct sockaddr_ll_extended*)calloc(1, sizeof(**sa)); + if (!*sa) + return -1; + + (*sa)->sll_family = AF_PACKET; /* Always for physical links */ + + /* The assert can only fail for Iniband links, which are quite unlikely to be found + * in any mobile devices + */ + LOG_DEBUG("rta_payload_length == %zu; sizeof sll_addr == %zu; hw type == 0x%X\n", rta_payload_length, sizeof((*sa)->sll_addr), net_interface->ifi_type); + if ((size_t)(rta_payload_length) > sizeof((*sa)->sll_addr)) { + LOG_INFO("Address is too long to place in sockaddr_ll (%zu > %zu)", rta_payload_length, sizeof((*sa)->sll_addr)); + free(*sa); + *sa = NULL; + return -1; + } + + if (rta_payload_length > UCHAR_MAX) { + LOG_INFO("Payload length too big to fit in the address structure"); + free(*sa); + *sa = NULL; + return -1; + } + + (*sa)->sll_ifindex = net_interface->ifi_index; + (*sa)->sll_hatype = net_interface->ifi_type; + (*sa)->sll_halen = (unsigned char)(rta_payload_length); + memcpy((*sa)->sll_addr, rta_data, rta_payload_length); + + return 0; +} + + +static struct ifaddrs *get_link_info(struct nlmsghdr *message) +{ + ssize_t length; + struct rtattr *attribute; + struct ifinfomsg *net_interface; + struct ifaddrs *ifa = NULL; + struct sockaddr_ll_extended *sa = NULL; + + abort_if_invalid_pointer_argument(message); + net_interface = (struct ifinfomsg*)(NLMSG_DATA(message)); + length = (ssize_t)(message->nlmsg_len - NLMSG_LENGTH(sizeof(*net_interface))); + if (length <= 0) { + goto error; + } + + ifa = (struct ifaddrs*)calloc(1, sizeof(*ifa)); + if (!ifa) { + goto error; + } + + ifa->ifa_flags = net_interface->ifi_flags; + attribute = IFLA_RTA(net_interface); + while (RTA_OK(attribute, length)) { + switch (attribute->rta_type) { + case IFLA_IFNAME: + ifa->ifa_name = strdup((const char*)(RTA_DATA(attribute))); + if (!ifa->ifa_name) { + goto error; + } + LOG_DEBUG(" interface name (payload length: %zu; string length: %zu)\n", RTA_PAYLOAD(attribute), strlen(ifa->ifa_name)); + LOG_DEBUG(" %s\n", ifa->ifa_name); + break; + + case IFLA_BROADCAST: + LOG_DEBUG(" interface broadcast (%zu bytes)\n", RTA_PAYLOAD(attribute)); + if (fill_ll_address(&sa, net_interface, RTA_DATA(attribute), RTA_PAYLOAD(attribute)) < 0) { + goto error; + } + ifa->ifa_broadaddr = (struct sockaddr*)sa; + break; + + case IFLA_ADDRESS: + LOG_DEBUG(" interface address (%zu bytes)\n", RTA_PAYLOAD(attribute)); + if (fill_ll_address(&sa, net_interface, RTA_DATA(attribute), RTA_PAYLOAD(attribute)) < 0) { + goto error; + } + ifa->ifa_addr = (struct sockaddr*)sa; + break; + + default: + break; + } + + attribute = RTA_NEXT (attribute, length); + } + + LOG_DEBUG("link flags: 0x%X", ifa->ifa_flags); + return ifa; + + error: + if (sa) + free(sa); + free_single_ifaddrs(&ifa); + + return NULL; +} + +static struct ifaddrs *find_interface_by_index(int index, struct ifaddrs **ifaddrs_head) +{ + struct ifaddrs *cur; + if (!ifaddrs_head || !*ifaddrs_head) + return NULL; + + /* Normally expensive, but with the small amount of links in the chain we'll deal with it's not + * worth the extra housekeeping and memory overhead + */ + cur = *ifaddrs_head; + while (cur) { + if (cur->ifa_addr && cur->ifa_addr->sa_family == AF_PACKET && ((struct sockaddr_ll_extended*)cur->ifa_addr)->sll_ifindex == index) + return cur; + if (cur == cur->ifa_next) + break; + cur = cur->ifa_next; + } + + return NULL; +} + +static char *get_interface_name_by_index(int index, struct ifaddrs **ifaddrs_head) +{ + struct ifaddrs *iface = find_interface_by_index(index, ifaddrs_head); + if (!iface || !iface->ifa_name) + return NULL; + + return iface->ifa_name; +} + +static int get_interface_flags_by_index(int index, struct ifaddrs **ifaddrs_head) +{ + struct ifaddrs *iface = find_interface_by_index(index, ifaddrs_head); + if (!iface) + return 0; + + return (int)(iface->ifa_flags); +} + +static int calculate_address_netmask(struct ifaddrs *ifa, struct ifaddrmsg *net_address) +{ + if (ifa->ifa_addr && ifa->ifa_addr->sa_family != AF_UNSPEC && ifa->ifa_addr->sa_family != AF_PACKET) { + uint32_t prefix_length = 0; + uint32_t data_length = 0; + unsigned char *netmask_data = NULL; + + switch (ifa->ifa_addr->sa_family) { + case AF_INET: { + struct sockaddr_in *sa = (struct sockaddr_in*)calloc(1, sizeof(struct sockaddr_in)); + if (!sa) + return -1; + + ifa->ifa_netmask = (struct sockaddr*)sa; + prefix_length = net_address->ifa_prefixlen; + if (prefix_length > 32) + prefix_length = 32; + data_length = sizeof(sa->sin_addr); + netmask_data = (unsigned char*)&sa->sin_addr; + break; + } + + case AF_INET6: { + struct sockaddr_in6 *sa = (struct sockaddr_in6*)calloc(1, sizeof(struct sockaddr_in6)); + if (!sa) + return -1; + + ifa->ifa_netmask = (struct sockaddr*)sa; + prefix_length = net_address->ifa_prefixlen; + if (prefix_length > 128) + prefix_length = 128; + data_length = sizeof(sa->sin6_addr); + netmask_data = (unsigned char*)&sa->sin6_addr; + break; + } + } + + if (ifa->ifa_netmask && netmask_data) { + /* Fill the first X bytes with 255 */ + uint32_t prefix_bytes = prefix_length / 8; + uint32_t postfix_bytes; + + if (prefix_bytes > data_length) { + errno = EINVAL; + return -1; + } + postfix_bytes = data_length - prefix_bytes; + memset(netmask_data, 0xFF, prefix_bytes); + if (postfix_bytes > 0) + memset(netmask_data + prefix_bytes + 1, 0x00, postfix_bytes); + LOG_DEBUG(" calculating netmask, prefix length is %u bits (%u bytes), data length is %u bytes\n", prefix_length, prefix_bytes, data_length); + if (prefix_bytes + 2 < data_length) + /* Set the rest of the mask bits in the byte following the last 0xFF value */ + netmask_data[prefix_bytes + 1] = (unsigned char)(0xff << (8 - (prefix_length % 8))); + } + } + + return 0; +} + + +static struct ifaddrs *get_link_address(struct nlmsghdr *message, struct ifaddrs **ifaddrs_head) +{ + ssize_t length = 0; + struct rtattr *attribute; + struct ifaddrmsg *net_address; + struct ifaddrs *ifa = NULL; + struct sockaddr **sa; + size_t payload_size; + + abort_if_invalid_pointer_argument(message); + net_address = (struct ifaddrmsg*)(NLMSG_DATA(message)); + length = (ssize_t)(IFA_PAYLOAD(message)); + LOG_DEBUG(" address data length: %zu", length); + if (length <= 0) { + goto error; + } + + ifa = (struct ifaddrs*)(calloc(1, sizeof(*ifa))); + if (!ifa) { + goto error; + } + + // values < 0 are never returned, the cast is safe + ifa->ifa_flags = (unsigned int)(get_interface_flags_by_index((int)(net_address->ifa_index), ifaddrs_head)); + + attribute = IFA_RTA(net_address); + LOG_DEBUG(" reading attributes"); + while (RTA_OK(attribute, length)) { + payload_size = RTA_PAYLOAD(attribute); + LOG_DEBUG(" attribute payload_size == %zu\n", payload_size); + sa = NULL; + + switch (attribute->rta_type) { + case IFA_LABEL: { + size_t room_for_trailing_null = 0; + + LOG_DEBUG(" attribute type: LABEL"); + if (payload_size > MAX_IFA_LABEL_SIZE) { + payload_size = MAX_IFA_LABEL_SIZE; + room_for_trailing_null = 1; + } + + if (payload_size > 0) { + size_t alloc_size; + if (!multiply_s(payload_size, room_for_trailing_null, &alloc_size)) { + goto error; + } + + ifa->ifa_name = (char*)malloc(alloc_size); + if (!ifa->ifa_name) { + goto error; + } + + memcpy(ifa->ifa_name, RTA_DATA (attribute), payload_size); + if (room_for_trailing_null) + ifa->ifa_name[payload_size] = '\0'; + } + break; + } + + case IFA_LOCAL: + LOG_DEBUG(" attribute type: LOCAL"); + if (ifa->ifa_addr) { + /* P2P protocol, set the dst/broadcast address union from the original address. + * Since ifa_addr is set it means IFA_ADDRESS occurred earlier and that address + * is indeed the P2P destination one. + */ + ifa->ifa_dstaddr = ifa->ifa_addr; + ifa->ifa_addr = 0; + } + sa = &ifa->ifa_addr; + break; + + case IFA_BROADCAST: + LOG_DEBUG(" attribute type: BROADCAST"); + if (ifa->ifa_dstaddr) { + /* IFA_LOCAL happened earlier, undo its effect here */ + free(ifa->ifa_dstaddr); + ifa->ifa_dstaddr = NULL; + } + sa = &ifa->ifa_broadaddr; + break; + + case IFA_ADDRESS: + LOG_DEBUG(" attribute type: ADDRESS"); + if (ifa->ifa_addr) { + /* Apparently IFA_LOCAL occurred earlier and we have a P2P connection + * here. IFA_LOCAL carries the destination address, move it there + */ + ifa->ifa_dstaddr = ifa->ifa_addr; + ifa->ifa_addr = NULL; + } + sa = &ifa->ifa_addr; + break; + + case IFA_UNSPEC: + LOG_DEBUG(" attribute type: UNSPEC"); + break; + + case IFA_ANYCAST: + LOG_DEBUG(" attribute type: ANYCAST"); + break; + + case IFA_CACHEINFO: + LOG_DEBUG(" attribute type: CACHEINFO"); + break; + + case IFA_MULTICAST: + LOG_DEBUG(" attribute type: MULTICAST"); + break; + + default: + LOG_DEBUG(" attribute type: %u", attribute->rta_type); + break; + } + + if (sa) { + if (fill_sa_address(sa, net_address, RTA_DATA(attribute), RTA_PAYLOAD(attribute)) < 0) { + goto error; + } + } + + attribute = RTA_NEXT(attribute, length); + } + + /* glibc stores the associated interface name in the address if IFA_LABEL never occurred */ + if (!ifa->ifa_name) { + char *name = get_interface_name_by_index((int)(net_address->ifa_index), ifaddrs_head); + LOG_DEBUG(" address has no name/label, getting one from interface\n"); + ifa->ifa_name = name ? strdup(name) : NULL; + } + LOG_DEBUG(" address label: %s\n", ifa->ifa_name); + + if (calculate_address_netmask(ifa, net_address) < 0) { + goto error; + } + + return ifa; + + error: + { + /* errno may be modified by free, or any other call inside the free_single_xamarin_ifaddrs + * function. We don't care about errors in there since it is more important to know how we + * failed to obtain the link address and not that we went OOM. Save and restore the value + * after the resources are freed. + */ + int errno_save = errno; + free_single_ifaddrs (&ifa); + errno = errno_save; + return NULL; + } + +} + +static int parse_netlink_reply(struct netlink_session *session, struct ifaddrs **ifaddrs_head, struct ifaddrs **last_ifaddr) +{ + struct msghdr netlink_reply; + struct iovec reply_vector; + struct nlmsghdr *current_message; + struct ifaddrs *addr; + int ret = -1; + unsigned char *response = NULL; + + abort_if_invalid_pointer_argument(session); + abort_if_invalid_pointer_argument(ifaddrs_head); + abort_if_invalid_pointer_argument(last_ifaddr); + + size_t buf_size = (size_t)(getpagesize()); + LOG_DEBUG("receive buffer size == %zu", buf_size); + + size_t alloc_size; + if (!multiply_s(sizeof(*response), buf_size, &alloc_size)) { + goto cleanup; + } + + response = (unsigned char*)malloc(alloc_size); + ssize_t length = 0; + if (!response) { + goto cleanup; + } + + while (1) { + memset(response, 0, buf_size); + memset(&reply_vector, 0, sizeof(reply_vector)); + reply_vector.iov_len = buf_size; + reply_vector.iov_base = response; + + memset(&netlink_reply, 0, sizeof(netlink_reply)); + netlink_reply.msg_namelen = sizeof(&session->them); + netlink_reply.msg_name = &session->them; + netlink_reply.msg_iovlen = 1; + netlink_reply.msg_iov = &reply_vector; + + length = recvmsg(session->sock_fd, &netlink_reply, 0); + LOG_DEBUG(" length == %d\n", (int)length); + + if (length < 0) { + LOG_DEBUG("Failed to receive reply from netlink. %s\n", strerror(errno)); + goto cleanup; + } + +#ifdef DEBUG + LOG_DEBUG("response flags:"); + if (netlink_reply.msg_flags == 0) + LOG_DEBUG(" [NONE]"); + else { + if (netlink_reply.msg_flags & MSG_EOR) + LOG_DEBUG(" MSG_EOR"); + if (netlink_reply.msg_flags & MSG_TRUNC) + LOG_DEBUG(" MSG_TRUNC"); + if (netlink_reply.msg_flags & MSG_CTRUNC) + LOG_DEBUG(" MSG_CTRUNC"); + if (netlink_reply.msg_flags & MSG_OOB) + LOG_DEBUG(" MSG_OOB"); + if (netlink_reply.msg_flags & MSG_ERRQUEUE) + LOG_DEBUG(" MSG_ERRQUEUE"); + } +#endif + + if (length == 0) + break; + + for (current_message = (struct nlmsghdr*)response; current_message && NLMSG_OK(current_message, (size_t)length); current_message = NLMSG_NEXT(current_message, length)) { + LOG_DEBUG("next message... (type: %u)\n", current_message->nlmsg_type); + switch (current_message->nlmsg_type) { + /* See rtnetlink.h */ + case RTM_NEWLINK: + LOG_DEBUG(" dumping link...\n"); + addr = get_link_info(current_message); + if (!addr || append_ifaddr(addr, ifaddrs_head, last_ifaddr) < 0) { + ret = -1; + goto cleanup; + } + LOG_DEBUG(" done\n"); + break; + + case RTM_NEWADDR: + LOG_DEBUG(" got an address\n"); + addr = get_link_address(current_message, ifaddrs_head); + if (!addr || append_ifaddr(addr, ifaddrs_head, last_ifaddr) < 0) { + ret = -1; + goto cleanup; + } + break; + + case NLMSG_DONE: + LOG_DEBUG(" message done\n"); + ret = 0; + goto cleanup; + + default: + LOG_DEBUG(" message type: %u", current_message->nlmsg_type); + break; + } + } + } + + cleanup: + if (response) + free(response); + return ret; +} + +int _netlink_getifaddrs(struct ifaddrs **ifap) +{ + int ret = -1; + + *ifap = NULL; + struct ifaddrs *ifaddrs_head = 0; + struct ifaddrs *last_ifaddr = 0; + struct netlink_session session; + + if (open_netlink_session(&session) < 0) { + goto cleanup; + } + + /* Request information about the specified link. In our case it will be all of them since we + request the root of the link tree below + */ + if ((send_netlink_dump_request(&session, RTM_GETLINK) < 0) || + (parse_netlink_reply(&session, &ifaddrs_head, &last_ifaddr) < 0) || + (send_netlink_dump_request(&session, RTM_GETADDR) < 0) || + (parse_netlink_reply(&session, &ifaddrs_head, &last_ifaddr) < 0)) { + _netlink_freeifaddrs (ifaddrs_head); + goto cleanup; + } + + ret = 0; + *ifap = ifaddrs_head; + +cleanup: + if (session.sock_fd >= 0) { + close(session.sock_fd); + session.sock_fd = -1; + } + + return ret; +} + +void _netlink_freeifaddrs(struct ifaddrs *ifa) +{ + struct ifaddrs *cur, *next; + + if (!ifa) + return; + + cur = ifa; + while (cur) { + next = cur->ifa_next; + free_single_ifaddrs (&cur); + cur = next; + } +} diff --git a/src/libraries/Native/Unix/System.Native/pal_ifaddrs.h b/src/libraries/Native/Unix/System.Native/pal_ifaddrs.h new file mode 100644 index 00000000000000..0944eeb43eb9f1 --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/pal_ifaddrs.h @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#pragma once + +#ifndef TARGET_ANDROID +#error The pal_ifaddrs.h shim is intended only for Android +#endif + +#if __ANDROID_API__ >= 24 +#error The pal_ifaddrs.h shim is only necessary for Android API 21-23 and it should be removed now that the minimum supported API level is 24 or higher +#endif + +// Android doesn't include the getifaddrs and freeifaddrs functions in older Bionic libc (pre API 24). +// This shim is a port of Xamarin Android's implementation of getifaddrs using Netlink. +// https://github.com/xamarin/xamarin-android/blob/681887ebdbd192ce7ce1cd02221d4939599ba762/src/monodroid/jni/xamarin_getifaddrs.h + +#include + +int _netlink_getifaddrs (struct ifaddrs **ifap); +void _netlink_freeifaddrs (struct ifaddrs *ifap); diff --git a/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c b/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c index bc95883b7cb04d..506127d641156d 100644 --- a/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c +++ b/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c @@ -11,7 +11,14 @@ #include #include #include +#if HAVE_GETIFADDRS || defined(ANDROID_GETIFADDRS_WORKAROUND) #include +#endif +#ifdef ANDROID_GETIFADDRS_WORKAROUND +#include +#include +#include "pal_ifaddrs.h" // fallback for Android API 21-23 +#endif #include #include #include @@ -29,6 +36,8 @@ #endif #if HAVE_NET_IFMEDIA_H #include +#elif HAVE_IOS_NET_IFMEDIA_H +#include "ios/net/if_media.h" #endif #if defined(AF_PACKET) @@ -53,7 +62,6 @@ #endif #endif -#if HAVE_GETIFADDRS // Convert mask to prefix length e.g. 255.255.255.0 -> 24 // mask parameter is pointer to buffer where address starts and length is // buffer length e.g. 4 for IPv4 and 16 for IPv6. @@ -93,6 +101,41 @@ static inline uint8_t mask2prefix(uint8_t* mask, int length) return len; } + +#ifdef ANDROID_GETIFADDRS_WORKAROUND +// This workaround is necessary as long as we support Android API 21-23 and it can be removed once +// we drop support for these old Android versions. +static int (*getifaddrs)(struct ifaddrs**) = NULL; +static void (*freeifaddrs)(struct ifaddrs*) = NULL; + +static void try_loading_getifaddrs() +{ + if (android_get_device_api_level() >= 24) + { + // Bionic on API 24+ contains the getifaddrs/freeifaddrs functions but the NDK doesn't expose those functions + // in ifaddrs.h when the minimum supported SDK is lower than 24 and therefore we need to load them manually + void *libc = dlopen("libc.so", RTLD_NOW); + if (libc) + { + getifaddrs = (int (*)(struct ifaddrs**)) dlsym(libc, "getifaddrs"); + freeifaddrs = (void (*)(struct ifaddrs*)) dlsym(libc, "freeifaddrs"); + } + } + else + { + // Bionic on API 21-23 doesn't contain the implementation of getifaddrs/freeifaddrs at all + // and we need to reimplement it using netlink (see pal_ifaddrs) + getifaddrs = _netlink_getifaddrs; + freeifaddrs = _netlink_freeifaddrs; + } +} + +static bool ensure_getifaddrs_is_loaded() +{ + static pthread_once_t getifaddrs_is_loaded = PTHREAD_ONCE_INIT; + pthread_once(&getifaddrs_is_loaded, try_loading_getifaddrs); + return getifaddrs != NULL && freeifaddrs != NULL; +} #endif int32_t SystemNative_EnumerateInterfaceAddresses(void* context, @@ -100,7 +143,15 @@ int32_t SystemNative_EnumerateInterfaceAddresses(void* context, IPv6AddressFound onIpv6Found, LinkLayerAddressFound onLinkLayerFound) { -#if HAVE_GETIFADDRS +#ifdef ANDROID_GETIFADDRS_WORKAROUND + if (!ensure_getifaddrs_is_loaded()) + { + errno = ENOTSUP; + return -1; + } +#endif + +#if HAVE_GETIFADDRS || defined(ANDROID_GETIFADDRS_WORKAROUND) struct ifaddrs* headAddr; if (getifaddrs(&headAddr) == -1) { @@ -203,7 +254,7 @@ int32_t SystemNative_EnumerateInterfaceAddresses(void* context, lla.NumAddressBytes = sadl->sdl_alen; lla.HardwareType = MapHardwareType(sadl->sdl_type); -#if HAVE_NET_IFMEDIA_H +#if HAVE_NET_IFMEDIA_H || HAVE_IOS_NET_IFMEDIA_H if (lla.HardwareType == NetworkInterfaceType_Ethernet) { // WI-FI and Ethernet have same address type so we can try to distinguish more @@ -233,7 +284,7 @@ int32_t SystemNative_EnumerateInterfaceAddresses(void* context, freeifaddrs(headAddr); return 0; #else - // Not supported on e.g. Android. Also, prevent a compiler error because parameters are unused + // Not supported. Also, prevent a compiler error because parameters are unused (void)context; (void)onIpv4Found; (void)onIpv6Found; @@ -245,7 +296,15 @@ int32_t SystemNative_EnumerateInterfaceAddresses(void* context, int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInterfaceInfo **interfaceList, int32_t * addressCount, IpAddressInfo **addressList ) { -#if HAVE_GETIFADDRS +#ifdef ANDROID_GETIFADDRS_WORKAROUND + if (!ensure_getifaddrs_is_loaded()) + { + errno = ENOTSUP; + return -1; + } +#endif + +#if HAVE_GETIFADDRS || defined(ANDROID_GETIFADDRS_WORKAROUND) struct ifaddrs* head; // Pointer to block allocated by getifaddrs(). struct ifaddrs* ifaddrsEntry; IpAddressInfo *ai; @@ -284,7 +343,16 @@ int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInter // To save allocation need for separate free() we will allocate one memory chunk // where we first write out NetworkInterfaceInfo entries immediately followed by // IpAddressInfo list. - void * memoryBlock = calloc((size_t)count, sizeof(NetworkInterfaceInfo)); +#ifdef TARGET_ANDROID + // Since Android API 30, getifaddrs returns only AF_INET and AF_INET6 addresses and we do not + // get any AF_PACKET addresses and so count == ip4count + ip6count. We need to make sure that + // the memoryBlock is large enough to hold all interfaces (up to `count` entries) and all + // addresses (ip4count + ip6count) without any overlap between interfaceList and addressList. + int entriesCount = count + ip4count + ip6count; +#else + int entriesCount = count; +#endif + void * memoryBlock = calloc((size_t)entriesCount, sizeof(NetworkInterfaceInfo)); if (memoryBlock == NULL) { errno = ENOMEM; @@ -295,7 +363,7 @@ int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInter ifaddrsEntry = head; *interfaceList = nii = (NetworkInterfaceInfo*)memoryBlock; // address of first IpAddressInfo after all NetworkInterfaceInfo entries. - *addressList = ai = (IpAddressInfo*)(nii + (count - ip4count - ip6count)); + *addressList = ai = (IpAddressInfo*)(nii + (entriesCount - ip4count - ip6count)); while (ifaddrsEntry != NULL) { @@ -319,7 +387,7 @@ int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInter memcpy(nii->Name, ifaddrsEntry->ifa_name, sizeof(nii->Name)); nii->InterfaceIndex = if_nametoindex(ifaddrsEntry->ifa_name); nii->Speed = -1; - nii->HardwareType = NetworkInterfaceType_Unknown; + nii->HardwareType = ((ifaddrsEntry->ifa_flags & IFF_LOOPBACK) == IFF_LOOPBACK) ? NetworkInterfaceType_Loopback : NetworkInterfaceType_Unknown; // Get operational state and multicast support. if ((ifaddrsEntry->ifa_flags & (IFF_MULTICAST|IFF_ALLMULTI)) != 0) @@ -451,7 +519,7 @@ int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInter return 0; #else - // Not supported on e.g. Android. Also, prevent a compiler error because parameters are unused + // Not supported. Also, prevent a compiler error because parameters are unused (void)interfaceCount; (void)interfaceList; (void)addressCount; diff --git a/src/libraries/Native/Unix/System.Native/pal_io.c b/src/libraries/Native/Unix/System.Native/pal_io.c index 51d841ffc55bdb..3541a90f1858bb 100644 --- a/src/libraries/Native/Unix/System.Native/pal_io.c +++ b/src/libraries/Native/Unix/System.Native/pal_io.c @@ -324,6 +324,12 @@ int32_t SystemNative_Unlink(const char* path) intptr_t SystemNative_ShmOpen(const char* name, int32_t flags, int32_t mode) { +#if defined(SHM_NAME_MAX) // macOS + assert(strlen(name) <= SHM_NAME_MAX); +#elif defined(PATH_MAX) // other Unixes + assert(strlen(name) <= PATH_MAX); +#endif + #if HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP flags = ConvertOpenFlags(flags); if (flags == -1) @@ -1008,83 +1014,35 @@ int32_t SystemNative_PosixFAdvise(intptr_t fd, int64_t offset, int64_t length, i #endif } -int32_t SystemNative_PosixFAllocate(intptr_t fd, int64_t offset, int64_t length) +int32_t SystemNative_FAllocate(intptr_t fd, int64_t offset, int64_t length) { assert_msg(offset == 0, "Invalid offset value", (int)offset); - int fileDescriptor = ToFileDescriptor(fd); int32_t result; -#if HAVE_POSIX_FALLOCATE64 // 64-bit Linux - while ((result = posix_fallocate64(fileDescriptor, (off64_t)offset, (off64_t)length)) == EINTR); -#elif HAVE_POSIX_FALLOCATE // 32-bit Linux - while ((result = posix_fallocate(fileDescriptor, (off_t)offset, (off_t)length)) == EINTR); +#if HAVE_FALLOCATE // Linux + int fileDescriptor = ToFileDescriptor(fd); + while ((result = fallocate(fileDescriptor, FALLOC_FL_KEEP_SIZE, (off_t)offset, (off_t)length)) == EINTR); #elif defined(F_PREALLOCATE) // macOS + int fileDescriptor = ToFileDescriptor(fd); fstore_t fstore; - fstore.fst_flags = F_ALLOCATECONTIG; // ensure contiguous space - fstore.fst_posmode = F_PEOFPOSMODE; // allocate from the physical end of file, as offset MUST NOT be 0 for F_VOLPOSMODE + fstore.fst_flags = F_ALLOCATEALL; // Allocate all requested space or no space at all. + fstore.fst_posmode = F_PEOFPOSMODE; // Allocate from the physical end of file. fstore.fst_offset = (off_t)offset; fstore.fst_length = (off_t)length; fstore.fst_bytesalloc = 0; // output size, can be > length while ((result = fcntl(fileDescriptor, F_PREALLOCATE, &fstore)) == -1 && errno == EINTR); - - if (result == -1) - { - // we have failed to allocate contiguous space, let's try non-contiguous - fstore.fst_flags = F_ALLOCATEALL; // all or nothing - while ((result = fcntl(fileDescriptor, F_PREALLOCATE, &fstore)) == -1 && errno == EINTR); - } -#elif defined(F_ALLOCSP) || defined(F_ALLOCSP64) // FreeBSD - #if HAVE_FLOCK64 - struct flock64 lockArgs; - int command = F_ALLOCSP64; - #else - struct flock lockArgs; - int command = F_ALLOCSP; - #endif - - lockArgs.l_whence = SEEK_SET; - lockArgs.l_start = (off_t)offset; - lockArgs.l_len = (off_t)length; - - while ((result = fcntl(fileDescriptor, command, &lockArgs)) == -1 && errno == EINTR); +#else + (void)fd; // unused + (void)offset; // unused + (void)length; // unused + result = -1; + errno = EOPNOTSUPP; #endif -#if defined(F_PREALLOCATE) || defined(F_ALLOCSP) || defined(F_ALLOCSP64) - // most of the Unixes implement posix_fallocate which does NOT set the last error - // fctnl does, but to mimic the posix_fallocate behaviour we just return error - if (result == -1) - { - result = errno; - } - else - { - // align the behaviour with what posix_fallocate does (change reported file size) - ftruncate(fileDescriptor, length); - } -#endif + assert(result == 0 || errno != EINVAL); - // error codes can be OS-specific, so this is why this handling is done here rather than in the managed layer - switch (result) - { - case ENOSPC: // there was not enough space - return -1; - case EFBIG: // the file was too large - return -2; - case ENODEV: // not a regular file - case ESPIPE: // a pipe - // We ignore it, as FileStream contract makes it clear that allocationSize is ignored for non-regular files. - return 0; - case EINVAL: - // We control the offset and length so they are correct. - assert_msg(length >= 0, "Invalid length value", (int)length); - // But if the underlying filesystem does not support the operation, we just ignore it and treat as a hint. - return 0; - default: - assert(result != EINTR); // it can't happen here as we retry the call on EINTR - assert(result != EBADF); // it can't happen here as this method is being called after a succesfull call to open (with write permissions) before returning the SafeFileHandle to the user - return 0; - } + return result; } int32_t SystemNative_Read(intptr_t fd, void* buffer, int32_t bufferSize) @@ -1427,6 +1385,7 @@ int64_t SystemNative_GetFileSystemType(intptr_t fd) else if (strcmp(statfsArgs.f_basetype, "befs") == 0) result = 0x42465331; else if (strcmp(statfsArgs.f_basetype, "bdevfs") == 0) result = 0x62646576; else if (strcmp(statfsArgs.f_basetype, "bfs") == 0) result = 0x1BADFACE; + else if (strcmp(statfsArgs.f_basetype, "bpf_fs") == 0) result = 0xCAFE4A11; else if (strcmp(statfsArgs.f_basetype, "binfmt_misc") == 0) result = 0x42494E4D; else if (strcmp(statfsArgs.f_basetype, "bootfs") == 0) result = 0xA56D3FF9; else if (strcmp(statfsArgs.f_basetype, "btrfs") == 0) result = 0x9123683E; @@ -1452,6 +1411,7 @@ int64_t SystemNative_GetFileSystemType(intptr_t fd) else if (strcmp(statfsArgs.f_basetype, "ext2") == 0) result = 0xEF53; else if (strcmp(statfsArgs.f_basetype, "ext3") == 0) result = 0xEF53; else if (strcmp(statfsArgs.f_basetype, "ext4") == 0) result = 0xEF53; + else if (strcmp(statfsArgs.f_basetype, "f2fs") == 0) result = 0xF2F52010; else if (strcmp(statfsArgs.f_basetype, "fat") == 0) result = 0x4006; else if (strcmp(statfsArgs.f_basetype, "fd") == 0) result = 0xF00D1E; else if (strcmp(statfsArgs.f_basetype, "fhgfs") == 0) result = 0x19830326; @@ -1519,6 +1479,7 @@ int64_t SystemNative_GetFileSystemType(intptr_t fd) else if (strcmp(statfsArgs.f_basetype, "sysv2") == 0) result = 0x012FF7B6; else if (strcmp(statfsArgs.f_basetype, "sysv4") == 0) result = 0x012FF7B5; else if (strcmp(statfsArgs.f_basetype, "tmpfs") == 0) result = 0x01021994; + else if (strcmp(statfsArgs.f_basetype, "tracefs") == 0) result = 0x74726163; else if (strcmp(statfsArgs.f_basetype, "ubifs") == 0) result = 0x24051905; else if (strcmp(statfsArgs.f_basetype, "udf") == 0) result = 0x15013346; else if (strcmp(statfsArgs.f_basetype, "ufs") == 0) result = 0x00011954; @@ -1560,13 +1521,21 @@ int32_t SystemNative_LockFileRegion(intptr_t fd, int64_t offset, int64_t length, struct flock lockArgs; #endif +#if defined(TARGET_ANDROID) && defined(HAVE_FLOCK64) + // On Android, fcntl is always implemented by fcntl64 but before https://github.com/aosp-mirror/platform_bionic/commit/09e77f35ab8d291bf88302bb9673aaa518c6bcb0 + // there was no remapping of F_SETLK to F_SETLK64 when _FILE_OFFSET_BITS=64 (which we set in eng/native/configurecompiler.cmake) so we need to always pass F_SETLK64 + int command = F_SETLK64; +#else + int command = F_SETLK; +#endif + lockArgs.l_type = unixLockType; lockArgs.l_whence = SEEK_SET; lockArgs.l_start = (off_t)offset; lockArgs.l_len = (off_t)length; int32_t ret; - while ((ret = fcntl (ToFileDescriptor(fd), F_SETLK, &lockArgs)) < 0 && errno == EINTR); + while ((ret = fcntl (ToFileDescriptor(fd), command, &lockArgs)) < 0 && errno == EINTR); return ret; } diff --git a/src/libraries/Native/Unix/System.Native/pal_io.h b/src/libraries/Native/Unix/System.Native/pal_io.h index 3f0db054d4368b..0e5d4cae2feb8f 100644 --- a/src/libraries/Native/Unix/System.Native/pal_io.h +++ b/src/libraries/Native/Unix/System.Native/pal_io.h @@ -620,11 +620,11 @@ PALEXPORT int32_t SystemNative_Poll(PollEvent* pollEvents, uint32_t eventCount, PALEXPORT int32_t SystemNative_PosixFAdvise(intptr_t fd, int64_t offset, int64_t length, int32_t advice); /** - * Ensures that disk space is allocated. + * Preallocates disk space. * - * Returns -1 on ENOSPC, -2 on EFBIG. On success or ignorable error, 0 is returned. + * Returns 0 for success, -1 for failure. Sets errno on failure. */ -PALEXPORT int32_t SystemNative_PosixFAllocate(intptr_t fd, int64_t offset, int64_t length); +PALEXPORT int32_t SystemNative_FAllocate(intptr_t fd, int64_t offset, int64_t length); /** * Reads the number of bytes specified into the provided buffer from the specified, opened file descriptor. diff --git a/src/libraries/Native/Unix/System.Native/pal_networkstatistics.c b/src/libraries/Native/Unix/System.Native/pal_networkstatistics.c index c0ab5dfc3ad94a..33bb76b1583a90 100644 --- a/src/libraries/Native/Unix/System.Native/pal_networkstatistics.c +++ b/src/libraries/Native/Unix/System.Native/pal_networkstatistics.c @@ -36,6 +36,9 @@ #if HAVE_NET_IFMEDIA_H #include #include +#elif HAVE_IOS_NET_IFMEDIA_H +#include "ios/net/if_media.h" +#include #endif #include #include @@ -44,6 +47,8 @@ #include #if HAVE_NETINET_IP_VAR_H #include +#elif HAVE_IOS_NETINET_IP_VAR_H +#include "ios/netinet/ip_var.h" #endif #include #if HAVE_TCP_FSM_H @@ -53,10 +58,14 @@ #include #if HAVE_NETINET_UDP_VAR_H #include +#elif HAVE_IOS_NETINET_UDP_VAR_H +#include "ios/netinet/udp_var.h" #endif #include #if HAVE_NETINET_ICMP_VAR_H #include +#elif HAVE_IOS_NETINET_ICMP_VAR_H +#include "ios/netinet/icmp_var.h" #endif static _Atomic(int) icmp6statSize = sizeof(struct icmp6stat); @@ -105,7 +114,7 @@ int32_t SystemNative_GetTcpGlobalStatistics(TcpGlobalStatistics* retStats) int32_t SystemNative_GetIPv4GlobalStatistics(IPv4GlobalStatistics* retStats) { -#if HAVE_NETINET_IP_VAR_H +#if HAVE_NETINET_IP_VAR_H || HAVE_IOS_NETINET_IP_VAR_H size_t oldlenp; assert(retStats != NULL); @@ -154,7 +163,7 @@ int32_t SystemNative_GetIPv4GlobalStatistics(IPv4GlobalStatistics* retStats) int32_t SystemNative_GetUdpGlobalStatistics(UdpGlobalStatistics* retStats) { -#if HAVE_NETINET_UDP_VAR_H +#if HAVE_NETINET_UDP_VAR_H || HAVE_IOS_NETINET_UDP_VAR_H size_t oldlenp; assert(retStats != NULL); @@ -194,7 +203,7 @@ int32_t SystemNative_GetUdpGlobalStatistics(UdpGlobalStatistics* retStats) int32_t SystemNative_GetIcmpv4GlobalStatistics(Icmpv4GlobalStatistics* retStats) { -#if HAVE_NETINET_ICMP_VAR_H +#if HAVE_NETINET_ICMP_VAR_H || HAVE_IOS_NETINET_ICMP_VAR_H size_t oldlenp; assert(retStats != NULL); @@ -587,7 +596,7 @@ int32_t SystemNative_GetNativeIPInterfaceStatistics(char* interfaceName, NativeI if (ifHdr->ifm_flags & IFF_UP) { retStats->Flags |= InterfaceUp; -#if HAVE_NET_IFMEDIA_H +#if HAVE_NET_IFMEDIA_H || HAVE_IOS_NET_IFMEDIA_H int fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) { retStats->Flags |= InterfaceError; diff --git a/src/libraries/Native/Unix/System.Native/pal_process.c b/src/libraries/Native/Unix/System.Native/pal_process.c index 5e97d958f74d17..fabdfae76187ca 100644 --- a/src/libraries/Native/Unix/System.Native/pal_process.c +++ b/src/libraries/Native/Unix/System.Native/pal_process.c @@ -191,6 +191,24 @@ static int SetGroups(uint32_t* userGroups, int32_t userGroupsLength, uint32_t* p return rv; } +typedef void (*VoidIntFn)(int); + +static +VoidIntFn +handler_from_sigaction (struct sigaction *sa) +{ + if (((unsigned int)sa->sa_flags) & SA_SIGINFO) + { + // work around -Wcast-function-type + void (*tmp)(void) = (void (*)(void))sa->sa_sigaction; + return (void (*)(int))tmp; + } + else + { + return sa->sa_handler; + } +} + int32_t SystemNative_ForkAndExecProcess(const char* filename, char* const argv[], char* const envp[], @@ -371,7 +389,7 @@ int32_t SystemNative_ForkAndExecProcess(const char* filename, } if (!sigaction(sig, NULL, &sa_old)) { - void (*oldhandler)(int) = (((unsigned int)sa_old.sa_flags) & SA_SIGINFO) ? (void (*)(int))sa_old.sa_sigaction : sa_old.sa_handler; + void (*oldhandler)(int) = handler_from_sigaction (&sa_old); if (oldhandler != SIG_IGN && oldhandler != SIG_DFL) { // It has a custom handler, put the default handler back. diff --git a/src/libraries/Native/Unix/System.Native/pal_searchpath.c b/src/libraries/Native/Unix/System.Native/pal_searchpath.c index fbf3d903df01c7..de8037dc1a2959 100644 --- a/src/libraries/Native/Unix/System.Native/pal_searchpath.c +++ b/src/libraries/Native/Unix/System.Native/pal_searchpath.c @@ -10,3 +10,9 @@ const char* SystemNative_SearchPath(int32_t folderId) __builtin_unreachable(); return NULL; } + +const char* SystemNative_SearchPath_TempDirectory() +{ + __builtin_unreachable(); + return NULL; +} diff --git a/src/libraries/Native/Unix/System.Native/pal_searchpath.h b/src/libraries/Native/Unix/System.Native/pal_searchpath.h index e2de05d8c8860a..cdb872914624ca 100644 --- a/src/libraries/Native/Unix/System.Native/pal_searchpath.h +++ b/src/libraries/Native/Unix/System.Native/pal_searchpath.h @@ -7,3 +7,5 @@ #include "pal_types.h" PALEXPORT const char* SystemNative_SearchPath(int32_t folderId); + +PALEXPORT const char* SystemNative_SearchPath_TempDirectory(void); diff --git a/src/libraries/Native/Unix/System.Native/pal_searchpath.m b/src/libraries/Native/Unix/System.Native/pal_searchpath.m index 2e96041f3dda82..231c508c527cab 100644 --- a/src/libraries/Native/Unix/System.Native/pal_searchpath.m +++ b/src/libraries/Native/Unix/System.Native/pal_searchpath.m @@ -11,3 +11,10 @@ const char* path = [[url path] UTF8String]; return path == NULL ? NULL : strdup (path); } + +const char* SystemNative_SearchPath_TempDirectory() +{ + NSString* tempPath = NSTemporaryDirectory(); + const char *path = [tempPath UTF8String]; + return path == NULL ? NULL : strdup (path); +} diff --git a/src/libraries/Native/Unix/System.Native/pal_signal.c b/src/libraries/Native/Unix/System.Native/pal_signal.c index 6e7243fca17eee..fb9628382762e4 100644 --- a/src/libraries/Native/Unix/System.Native/pal_signal.c +++ b/src/libraries/Native/Unix/System.Native/pal_signal.c @@ -584,6 +584,16 @@ int32_t InitializeSignalHandlingCore() return 0; } +#ifdef HAS_CONSOLE_SIGNALS + // Unconditionally register signals for terminal configuration. + bool installed = InstallSignalHandler(SIGINT, SA_RESTART); + assert(installed); + installed = InstallSignalHandler(SIGQUIT, SA_RESTART); + assert(installed); + installed = InstallSignalHandler(SIGCONT, SA_RESTART); + assert(installed); +#endif + return 1; } @@ -612,7 +622,12 @@ void SystemNative_DisablePosixSignalHandling(int signalCode) { g_hasPosixSignalRegistrations[signalCode - 1] = false; - if (!(g_consoleTtouHandler && signalCode == SIGTTOU) && + // Don't restore handler when something other than posix handling needs the signal. + if ( +#ifdef HAS_CONSOLE_SIGNALS + signalCode != SIGINT && signalCode != SIGQUIT && signalCode != SIGCONT && +#endif + !(g_consoleTtouHandler && signalCode == SIGTTOU) && !(g_sigChldCallback && signalCode == SIGCHLD) && !(g_terminalInvalidationCallback && (signalCode == SIGCONT || signalCode == SIGCHLD || diff --git a/src/libraries/Native/Unix/System.Native/pal_signal.h b/src/libraries/Native/Unix/System.Native/pal_signal.h index 146fdabbfceb14..c3c21009dc836c 100644 --- a/src/libraries/Native/Unix/System.Native/pal_signal.h +++ b/src/libraries/Native/Unix/System.Native/pal_signal.h @@ -40,8 +40,8 @@ typedef enum PosixSignalSIGQUIT = -3, PosixSignalSIGTERM = -4, PosixSignalSIGCHLD = -5, - PosixSignalSIGWINCH = -6, - PosixSignalSIGCONT = -7, + PosixSignalSIGCONT = -6, + PosixSignalSIGWINCH = -7, PosixSignalSIGTTIN = -8, PosixSignalSIGTTOU = -9, PosixSignalSIGTSTP = -10 diff --git a/src/libraries/Native/Unix/System.Native/pal_tcpstate.c b/src/libraries/Native/Unix/System.Native/pal_tcpstate.c index 5b428ba6c8f11b..db5f775164c4c8 100644 --- a/src/libraries/Native/Unix/System.Native/pal_tcpstate.c +++ b/src/libraries/Native/Unix/System.Native/pal_tcpstate.c @@ -7,6 +7,8 @@ #if HAVE_TCP_FSM_H #include +#elif HAVE_IOS_NETINET_TCPFSM_H +#include "ios/netinet/tcp_fsm.h" #elif HAVE_TCP_H_TCPSTATE_ENUM #include #endif @@ -15,7 +17,7 @@ int32_t SystemNative_MapTcpState(int32_t tcpState) { switch (tcpState) { -#if HAVE_TCP_FSM_H +#if HAVE_TCP_FSM_H || HAVE_IOS_NETINET_TCPFSM_H case TCPS_CLOSED: return TcpState_Closed; case TCPS_LISTEN: diff --git a/src/libraries/Native/Unix/System.Native/pal_time.c b/src/libraries/Native/Unix/System.Native/pal_time.c index 56e23138a7b77e..5b1615a0f1e9fd 100644 --- a/src/libraries/Native/Unix/System.Native/pal_time.c +++ b/src/libraries/Native/Unix/System.Native/pal_time.c @@ -18,9 +18,10 @@ enum { - SecondsToMicroSeconds = 1000000, // 10^6 - SecondsToNanoSeconds = 1000000000, // 10^9 - MicroSecondsToNanoSeconds = 1000 // 10^3 + MicroSecondsToNanoSeconds = 1000, // 10^3 + SecondsToNanoSeconds = 1000000000, // 10^9 + SecondsToTicks = 10000000, // 10^7 + TicksToNanoSeconds = 100, // 10^2 }; int32_t SystemNative_UTimensat(const char* path, TimeSpec* times) @@ -62,6 +63,29 @@ uint64_t SystemNative_GetTimestamp() #endif } +int64_t SystemNative_GetBootTimeTicks() +{ +#if defined(TARGET_LINUX) || defined(TARGET_ANDROID) + struct timespec ts; + + int result = clock_gettime(CLOCK_BOOTTIME, &ts); + assert(result == 0); // only possible errors are if the given clockId isn't supported or &ts is an invalid address + (void)result; // suppress unused parameter warning in release builds + + int64_t sinceBootTicks = ((int64_t)ts.tv_sec * SecondsToTicks) + (ts.tv_nsec / TicksToNanoSeconds); + + result = clock_gettime(CLOCK_REALTIME_COARSE, &ts); + assert(result == 0); + + int64_t sinceEpochTicks = ((int64_t)ts.tv_sec * SecondsToTicks) + (ts.tv_nsec / TicksToNanoSeconds); + const int64_t UnixEpochTicks = 621355968000000000; + + return UnixEpochTicks + sinceEpochTicks - sinceBootTicks; +#else + return -1; +#endif +} + int32_t SystemNative_GetCpuUtilization(ProcessCpuInformation* previousCpuInfo) { uint64_t kernelTime = 0; @@ -76,7 +100,7 @@ int32_t SystemNative_GetCpuUtilization(ProcessCpuInformation* previousCpuInfo) else { kernelTime = - ((uint64_t)(resUsage.ru_stime.tv_sec) * SecondsToNanoSeconds) + + ((uint64_t)(resUsage.ru_stime.tv_sec) * SecondsToNanoSeconds) + ((uint64_t)(resUsage.ru_stime.tv_usec) * MicroSecondsToNanoSeconds); userTime = ((uint64_t)(resUsage.ru_utime.tv_sec) * SecondsToNanoSeconds) + diff --git a/src/libraries/Native/Unix/System.Native/pal_time.h b/src/libraries/Native/Unix/System.Native/pal_time.h index 12fe5001334183..b2c6079602bd20 100644 --- a/src/libraries/Native/Unix/System.Native/pal_time.h +++ b/src/libraries/Native/Unix/System.Native/pal_time.h @@ -32,6 +32,11 @@ PALEXPORT int32_t SystemNative_UTimensat(const char* path, TimeSpec* times); */ PALEXPORT uint64_t SystemNative_GetTimestamp(void); +/** + * Gets system boot time ticks. (Linux only) + */ +PALEXPORT int64_t SystemNative_GetBootTimeTicks(void); + /** * The main purpose of this function is to compute the overall CPU utilization * for the CLR thread pool to regulate the number of worker threads. diff --git a/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.c b/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.c index d5b0e0bcdda1b3..ef84a024777d3c 100644 --- a/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.c +++ b/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.c @@ -123,7 +123,7 @@ static void* volatile s_gssLib = NULL; #define GSS_C_NT_HOSTBASED_SERVICE (*GSS_C_NT_HOSTBASED_SERVICE_ptr) #define gss_mech_krb5 (*gss_mech_krb5_ptr) -#define gss_lib_name "libgssapi_krb5.so" +#define gss_lib_name "libgssapi_krb5.so.2" static int32_t ensure_gss_shim_initialized() { diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_evp.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_evp.c index 3156d524503fd2..04ff98209b0c4b 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_evp.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_evp.c @@ -50,9 +50,7 @@ static jobject GetMessageDigestInstance(JNIEnv* env, intptr_t type) int32_t CryptoNative_EvpDigestOneShot(intptr_t type, void* source, int32_t sourceSize, uint8_t* md, uint32_t* mdSize) { - abort_if_invalid_pointer_argument (source); - - if (!type || !md || !mdSize || sourceSize < 0) + if (!type || !md || !mdSize || sourceSize < 0 || (sourceSize > 0 && !source)) return FAIL; JNIEnv* env = GetJNIEnv(); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_hmac.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_hmac.c index 7632eed59050fd..0dccef8d2c590c 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_hmac.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_hmac.c @@ -82,10 +82,10 @@ int32_t CryptoNative_HmacReset(jobject ctx) int32_t CryptoNative_HmacUpdate(jobject ctx, uint8_t* data, int32_t len) { - if (!ctx) + // Callers are expected to skip update calls with no data. + if (!ctx || !data || len <= 0) return FAIL; - abort_if_invalid_pointer_argument (data); JNIEnv* env = GetJNIEnv(); jbyteArray dataBytes = make_java_byte_array(env, len); (*env)->SetByteArrayRegion(env, dataBytes, 0, len, (jbyte*)data); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_jni.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_jni.c index fe92ce9ebe3ebe..473f6bd4d01657 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_jni.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_jni.c @@ -83,6 +83,14 @@ jmethodID g_SSLParametersGetProtocols; jmethodID g_SSLParametersSetApplicationProtocols; jmethodID g_SSLParametersSetServerNames; +// com/android/org/conscrypt/OpenSSLEngineImpl +jclass g_ConscryptOpenSSLEngineImplClass; +jfieldID g_ConscryptOpenSSLEngineImplSslParametersField; + +// com/android/org/conscrypt/SSLParametersImpl +jclass g_ConscryptSSLParametersImplClass; +jmethodID g_ConscryptSSLParametersImplSetUseSni; + // javax/net/ssl/SSLContext jclass g_sslCtxClass; jmethodID g_sslCtxGetDefaultMethod; @@ -401,6 +409,7 @@ jmethodID g_SSLEngineBeginHandshake; jmethodID g_SSLEngineCloseOutbound; jmethodID g_SSLEngineGetApplicationProtocol; jmethodID g_SSLEngineGetHandshakeStatus; +jmethodID g_SSLEngineGetHandshakeSession; jmethodID g_SSLEngineGetSession; jmethodID g_SSLEngineGetSSLParameters; jmethodID g_SSLEngineGetSupportedProtocols; @@ -430,6 +439,7 @@ jmethodID g_SSLContextGetDefault; jmethodID g_SSLContextGetInstanceMethod; jmethodID g_SSLContextInitMethod; jmethodID g_SSLContextCreateSSLEngineMethod; +jmethodID g_SSLContextCreateSSLEngineMethodWithHostAndPort; // javax/net/ssl/SSLSession jclass g_SSLSession; @@ -443,6 +453,7 @@ jmethodID g_SSLSessionGetProtocol; jclass g_SSLEngineResult; jmethodID g_SSLEngineResultGetStatus; jmethodID g_SSLEngineResultGetHandshakeStatus; +bool g_SSLEngineResultStatusLegacyOrder; // javax/crypto/KeyAgreement jclass g_KeyAgreementClass; @@ -618,7 +629,7 @@ JNIEnv* GetJNIEnv() LOG_DEBUG("Registering JNI thread detach. env ptr %p. Key: %ld", (void*)env, (long)threadLocalEnvKey); pthread_setspecific(threadLocalEnvKey, env); - abort_unless(ret == JNI_OK, "Unable to attach thread to JVM"); + abort_unless(ret == JNI_OK, "Unable to attach thread to JVM (error: %d)", ret); return env; } @@ -706,6 +717,15 @@ JNI_OnLoad(JavaVM *vm, void *reserved) g_SSLParametersGetProtocols = GetMethod(env, false, g_SSLParametersClass, "getProtocols", "()[Ljava/lang/String;"); g_SSLParametersSetApplicationProtocols = GetOptionalMethod(env, false, g_SSLParametersClass, "setApplicationProtocols", "([Ljava/lang/String;)V"); + g_ConscryptOpenSSLEngineImplClass = GetOptionalClassGRef(env, "com/android/org/conscrypt/OpenSSLEngineImpl"); + if (g_ConscryptOpenSSLEngineImplClass != NULL) + { + g_ConscryptOpenSSLEngineImplSslParametersField = GetField(env, false, g_ConscryptOpenSSLEngineImplClass, "sslParameters", "Lcom/android/org/conscrypt/SSLParametersImpl;"); + + g_ConscryptSSLParametersImplClass = GetClassGRef(env, "com/android/org/conscrypt/SSLParametersImpl"); + g_ConscryptSSLParametersImplSetUseSni = GetMethod(env, false, g_ConscryptSSLParametersImplClass, "setUseSni", "(Z)V"); + } + g_sslCtxClass = GetClassGRef(env, "javax/net/ssl/SSLContext"); g_sslCtxGetDefaultMethod = GetMethod(env, true, g_sslCtxClass, "getDefault", "()Ljavax/net/ssl/SSLContext;"); g_sslCtxGetDefaultSslParamsMethod = GetMethod(env, false, g_sslCtxClass, "getDefaultSSLParameters", "()Ljavax/net/ssl/SSLParameters;"); @@ -970,6 +990,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved) g_SSLEngineGetApplicationProtocol = GetOptionalMethod(env, false, g_SSLEngine, "getApplicationProtocol", "()Ljava/lang/String;"); g_SSLEngineGetHandshakeStatus = GetMethod(env, false, g_SSLEngine, "getHandshakeStatus", "()Ljavax/net/ssl/SSLEngineResult$HandshakeStatus;"); g_SSLEngineGetSession = GetMethod(env, false, g_SSLEngine, "getSession", "()Ljavax/net/ssl/SSLSession;"); + g_SSLEngineGetHandshakeSession = GetOptionalMethod(env, false, g_SSLEngine, "getHandshakeSession", "()Ljavax/net/ssl/SSLSession;"); g_SSLEngineGetSSLParameters = GetMethod(env, false, g_SSLEngine, "getSSLParameters", "()Ljavax/net/ssl/SSLParameters;"); g_SSLEngineGetSupportedProtocols = GetMethod(env, false, g_SSLEngine, "getSupportedProtocols", "()[Ljava/lang/String;"); g_SSLEngineSetEnabledProtocols = GetMethod(env, false, g_SSLEngine, "setEnabledProtocols", "([Ljava/lang/String;)V"); @@ -996,6 +1017,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved) g_SSLContextGetInstanceMethod = GetMethod(env, true, g_SSLContext, "getInstance", "(Ljava/lang/String;)Ljavax/net/ssl/SSLContext;"); g_SSLContextInitMethod = GetMethod(env, false, g_SSLContext, "init", "([Ljavax/net/ssl/KeyManager;[Ljavax/net/ssl/TrustManager;Ljava/security/SecureRandom;)V"); g_SSLContextCreateSSLEngineMethod = GetMethod(env, false, g_SSLContext, "createSSLEngine", "()Ljavax/net/ssl/SSLEngine;"); + g_SSLContextCreateSSLEngineMethodWithHostAndPort = GetMethod(env, false, g_SSLContext, "createSSLEngine", "(Ljava/lang/String;I)Ljavax/net/ssl/SSLEngine;"); g_SSLSession = GetClassGRef(env, "javax/net/ssl/SSLSession"); g_SSLSessionGetApplicationBufferSize = GetMethod(env, false, g_SSLSession, "getApplicationBufferSize", "()I"); @@ -1007,6 +1029,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved) g_SSLEngineResult = GetClassGRef(env, "javax/net/ssl/SSLEngineResult"); g_SSLEngineResultGetStatus = GetMethod(env, false, g_SSLEngineResult, "getStatus", "()Ljavax/net/ssl/SSLEngineResult$Status;"); g_SSLEngineResultGetHandshakeStatus = GetMethod(env, false, g_SSLEngineResult, "getHandshakeStatus", "()Ljavax/net/ssl/SSLEngineResult$HandshakeStatus;"); + g_SSLEngineResultStatusLegacyOrder = android_get_device_api_level() < 24; g_KeyAgreementClass = GetClassGRef(env, "javax/crypto/KeyAgreement"); g_KeyAgreementGetInstance = GetMethod(env, true, g_KeyAgreementClass, "getInstance", "(Ljava/lang/String;)Ljavax/crypto/KeyAgreement;"); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_jni.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_jni.h index f9e9bc7acf5863..c1f325d0a7e419 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_jni.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_jni.h @@ -92,6 +92,14 @@ extern jmethodID g_SSLParametersGetProtocols; extern jmethodID g_SSLParametersSetApplicationProtocols; extern jmethodID g_SSLParametersSetServerNames; +// com/android/org/conscrypt/OpenSSLEngineImpl +extern jclass g_ConscryptOpenSSLEngineImplClass; +extern jfieldID g_ConscryptOpenSSLEngineImplSslParametersField; + +// com/android/org/conscrypt/SSLParametersImpl +extern jclass g_ConscryptSSLParametersImplClass; +extern jmethodID g_ConscryptSSLParametersImplSetUseSni; + // javax/net/ssl/SSLContext extern jclass g_sslCtxClass; extern jmethodID g_sslCtxGetDefaultMethod; @@ -415,6 +423,7 @@ extern jmethodID g_SSLEngineBeginHandshake; extern jmethodID g_SSLEngineCloseOutbound; extern jmethodID g_SSLEngineGetApplicationProtocol; extern jmethodID g_SSLEngineGetHandshakeStatus; +extern jmethodID g_SSLEngineGetHandshakeSession; extern jmethodID g_SSLEngineGetSession; extern jmethodID g_SSLEngineGetSSLParameters; extern jmethodID g_SSLEngineGetSupportedProtocols; @@ -444,7 +453,7 @@ extern jmethodID g_SSLContextGetDefault; extern jmethodID g_SSLContextGetInstanceMethod; extern jmethodID g_SSLContextInitMethod; extern jmethodID g_SSLContextCreateSSLEngineMethod; -extern jmethodID g_SSLContextCreateSSLEngineWithPeer; +extern jmethodID g_SSLContextCreateSSLEngineMethodWithHostAndPort; // javax/net/ssl/SSLSession extern jclass g_SSLSession; @@ -458,6 +467,7 @@ extern jmethodID g_SSLSessionGetProtocol; extern jclass g_SSLEngineResult; extern jmethodID g_SSLEngineResultGetStatus; extern jmethodID g_SSLEngineResultGetHandshakeStatus; +extern bool g_SSLEngineResultStatusLegacyOrder; // javax/crypto/KeyAgreement extern jclass g_KeyAgreementClass; diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_rsa.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_rsa.c index 54613c6e64b513..91fcc38ffb29e3 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_rsa.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_rsa.c @@ -44,10 +44,12 @@ PALEXPORT void AndroidCryptoNative_RsaDestroy(RSA* rsa) PALEXPORT int32_t AndroidCryptoNative_RsaPublicEncrypt(int32_t flen, uint8_t* from, uint8_t* to, RSA* rsa, RsaPadding padding) { - abort_if_invalid_pointer_argument (from); abort_if_invalid_pointer_argument (to); abort_if_invalid_pointer_argument (rsa); + if ((flen > 0 && !from) || flen < 0) + return RSA_FAIL; + JNIEnv* env = GetJNIEnv(); int32_t ret = RSA_FAIL; diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_sslstream.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_sslstream.c index 4b95faf7a191bd..2b582a53ec7b33 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_sslstream.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_sslstream.c @@ -15,6 +15,7 @@ enum }; // javax/net/ssl/SSLEngineResult$Status +// Android API 24+ enum { STATUS__BUFFER_UNDERFLOW = 0, @@ -23,6 +24,16 @@ enum STATUS__CLOSED = 3, }; +// javax/net/ssl/SSLEngineResult$Status +// Android API 21-23 +enum +{ + LEGACY__STATUS__BUFFER_OVERFLOW = 0, + LEGACY__STATUS__BUFFER_UNDERFLOW = 1, + LEGACY__STATUS__OK = 3, + LEGACY__STATUS__CLOSED = 2, +}; + struct ApplicationProtocolData_t { uint8_t* data; @@ -40,6 +51,27 @@ static bool IsHandshaking(int handshakeStatus) return handshakeStatus != HANDSHAKE_STATUS__NOT_HANDSHAKING && handshakeStatus != HANDSHAKE_STATUS__FINISHED; } +static jobject GetSslSessionForHandshakeStatus(JNIEnv* env, SSLStream* sslStream, int handshakeStatus) +{ + // SSLEngine.getHandshakeSession() is available since API 24 + jobject sslSession = IsHandshaking(handshakeStatus) && g_SSLEngineGetHandshakeSession != NULL + ? (*env)->CallObjectMethod(env, sslStream->sslEngine, g_SSLEngineGetHandshakeSession) + : (*env)->CallObjectMethod(env, sslStream->sslEngine, g_SSLEngineGetSession); + if (CheckJNIExceptions(env)) + return NULL; + + return sslSession; +} + +static jobject GetCurrentSslSession(JNIEnv* env, SSLStream* sslStream) +{ + int handshakeStatus = GetEnumAsInt(env, (*env)->CallObjectMethod(env, sslStream->sslEngine, g_SSLEngineGetHandshakeStatus)); + if (CheckJNIExceptions(env)) + return NULL; + + return GetSslSessionForHandshakeStatus(env, sslStream, handshakeStatus); +} + ARGS_NON_NULL_ALL static PAL_SSLStreamStatus Close(JNIEnv* env, SSLStream* sslStream) { // Call wrap to clear any remaining data before closing @@ -115,6 +147,27 @@ ARGS_NON_NULL_ALL static jobject EnsureRemaining(JNIEnv* env, jobject oldBuffer, } } +// There has been a change in the SSLEngineResult.Status enum between API 23 and 24 that changed +// the order/interger values of the enum options. +static int MapLegacySSLEngineResultStatus(int legacyStatus) +{ + switch (legacyStatus) + { + case LEGACY__STATUS__BUFFER_OVERFLOW: + return STATUS__BUFFER_OVERFLOW; + case LEGACY__STATUS__BUFFER_UNDERFLOW: + return STATUS__BUFFER_UNDERFLOW; + case LEGACY__STATUS__CLOSED: + return STATUS__CLOSED; + case LEGACY__STATUS__OK: + return STATUS__OK; + default: + LOG_ERROR("Unknown legacy SSLEngineResult status: %d", legacyStatus); + assert(false && "Unknown SSLEngineResult status"); + return -1; + } +} + ARGS_NON_NULL_ALL static PAL_SSLStreamStatus DoWrap(JNIEnv* env, SSLStream* sslStream, int* handshakeStatus) { // appOutBuffer.flip(); @@ -134,6 +187,11 @@ ARGS_NON_NULL_ALL static PAL_SSLStreamStatus DoWrap(JNIEnv* env, SSLStream* sslS int status = GetEnumAsInt(env, (*env)->CallObjectMethod(env, result, g_SSLEngineResultGetStatus)); (*env)->DeleteLocalRef(env, result); + if (g_SSLEngineResultStatusLegacyOrder) + { + status = MapLegacySSLEngineResultStatus(status); + } + switch (status) { case STATUS__OK: @@ -207,6 +265,12 @@ ARGS_NON_NULL_ALL static PAL_SSLStreamStatus DoUnwrap(JNIEnv* env, SSLStream* ss *handshakeStatus = GetEnumAsInt(env, (*env)->CallObjectMethod(env, result, g_SSLEngineResultGetHandshakeStatus)); int status = GetEnumAsInt(env, (*env)->CallObjectMethod(env, result, g_SSLEngineResultGetStatus)); (*env)->DeleteLocalRef(env, result); + + if (g_SSLEngineResultStatusLegacyOrder) + { + status = MapLegacySSLEngineResultStatus(status); + } + switch (status) { case STATUS__OK: @@ -424,7 +488,7 @@ SSLStream* AndroidCryptoNative_SSLStreamCreateWithCertificates(uint8_t* pkcs8Pri } int32_t AndroidCryptoNative_SSLStreamInitialize( - SSLStream* sslStream, bool isServer, STREAM_READER streamReader, STREAM_WRITER streamWriter, int32_t appBufferSize) + SSLStream* sslStream, bool isServer, STREAM_READER streamReader, STREAM_WRITER streamWriter, int32_t appBufferSize, char* peerHost) { abort_if_invalid_pointer_argument (sslStream); abort_unless(sslStream->sslContext != NULL, "sslContext is NULL in SSL stream"); @@ -434,10 +498,23 @@ int32_t AndroidCryptoNative_SSLStreamInitialize( int32_t ret = FAIL; JNIEnv* env = GetJNIEnv(); - // SSLEngine sslEngine = sslContext.createSSLEngine(); + jobject sslEngine = NULL; + if (peerHost) + { + // SSLEngine sslEngine = sslContext.createSSLEngine(peerHost, -1); + jstring peerHostStr = make_java_string(env, peerHost); + sslEngine = (*env)->CallObjectMethod(env, sslStream->sslContext, g_SSLContextCreateSSLEngineMethodWithHostAndPort, peerHostStr, -1); + ReleaseLRef(env, peerHostStr); + ON_EXCEPTION_PRINT_AND_GOTO(exit); + } + else + { + // SSLEngine sslEngine = sslContext.createSSLEngine(); + sslEngine = (*env)->CallObjectMethod(env, sslStream->sslContext, g_SSLContextCreateSSLEngineMethod); + ON_EXCEPTION_PRINT_AND_GOTO(exit); + } + // sslEngine.setUseClientMode(!isServer); - jobject sslEngine = (*env)->CallObjectMethod(env, sslStream->sslContext, g_SSLContextCreateSSLEngineMethod); - ON_EXCEPTION_PRINT_AND_GOTO(exit); sslStream->sslEngine = ToGRef(env, sslEngine); (*env)->CallVoidMethod(env, sslStream->sslEngine, g_SSLEngineSetUseClientMode, !isServer); ON_EXCEPTION_PRINT_AND_GOTO(exit); @@ -474,19 +551,48 @@ int32_t AndroidCryptoNative_SSLStreamInitialize( return ret; } +// This method calls internal Android APIs that are specific to Android API 21-23 and it won't work +// on newer API levels. By calling the sslEngine.sslParameters.useSni(true) method, the SSLEngine +// will include the peerHost that was passed in to the SSLEngine factory method in the client hello +// message. +ARGS_NON_NULL_ALL static int32_t ApplyLegacyAndroidSNIWorkaround(JNIEnv* env, SSLStream* sslStream) +{ + if (g_ConscryptOpenSSLEngineImplClass == NULL || !(*env)->IsInstanceOf(env, sslStream->sslEngine, g_ConscryptOpenSSLEngineImplClass)) + return FAIL; + + int32_t ret = FAIL; + INIT_LOCALS(loc, sslParameters); + + loc[sslParameters] = (*env)->GetObjectField(env, sslStream->sslEngine, g_ConscryptOpenSSLEngineImplSslParametersField); + ON_EXCEPTION_PRINT_AND_GOTO(cleanup); + + if (!loc[sslParameters]) + goto cleanup; + + (*env)->CallVoidMethod(env, loc[sslParameters], g_ConscryptSSLParametersImplSetUseSni, true); + ON_EXCEPTION_PRINT_AND_GOTO(cleanup); + + ret = SUCCESS; + +cleanup: + RELEASE_LOCALS(loc, env); + return ret; +} + int32_t AndroidCryptoNative_SSLStreamSetTargetHost(SSLStream* sslStream, char* targetHost) { abort_if_invalid_pointer_argument (sslStream); abort_if_invalid_pointer_argument (targetHost); + JNIEnv* env = GetJNIEnv(); + if (g_SNIHostName == NULL || g_SSLParametersSetServerNames == NULL) { - // SSL not supported below API Level 24 - return UNSUPPORTED_API_LEVEL; + // SNIHostName is only available since API 24 + // on APIs 21-23 we use a workaround to force the SSLEngine to use SNI + return ApplyLegacyAndroidSNIWorkaround(env, sslStream); } - JNIEnv* env = GetJNIEnv(); - int32_t ret = FAIL; INIT_LOCALS(loc, hostStr, nameList, hostName, params); @@ -521,10 +627,13 @@ PAL_SSLStreamStatus AndroidCryptoNative_SSLStreamHandshake(SSLStream* sslStream) abort_if_invalid_pointer_argument (sslStream); JNIEnv* env = GetJNIEnv(); - // sslEngine.beginHandshake(); - (*env)->CallVoidMethod(env, sslStream->sslEngine, g_SSLEngineBeginHandshake); - if (CheckJNIExceptions(env)) - return SSLStreamStatus_Error; + int handshakeStatus = GetEnumAsInt(env, (*env)->CallObjectMethod(env, sslStream->sslEngine, g_SSLEngineGetHandshakeStatus)); + if (!IsHandshaking(handshakeStatus)) { + // sslEngine.beginHandshake(); + (*env)->CallVoidMethod(env, sslStream->sslEngine, g_SSLEngineBeginHandshake); + if (CheckJNIExceptions(env)) + return SSLStreamStatus_Error; + } return DoHandshake(env, sslStream); } @@ -585,13 +694,14 @@ AndroidCryptoNative_SSLStreamRead(SSLStream* sslStream, uint8_t* buffer, int32_t if (rem > 0) { - data = make_java_byte_array(env, rem); + int32_t bytes_to_read = rem < length ? rem : length; + data = make_java_byte_array(env, bytes_to_read); IGNORE_RETURN((*env)->CallObjectMethod(env, sslStream->appInBuffer, g_ByteBufferGet, data)); ON_EXCEPTION_PRINT_AND_GOTO(cleanup); IGNORE_RETURN((*env)->CallObjectMethod(env, sslStream->appInBuffer, g_ByteBufferCompact)); ON_EXCEPTION_PRINT_AND_GOTO(cleanup); - (*env)->GetByteArrayRegion(env, data, 0, rem, (jbyte*)buffer); - *read = rem; + (*env)->GetByteArrayRegion(env, data, 0, bytes_to_read, (jbyte*)buffer); + *read = bytes_to_read; ret = SSLStreamStatus_OK; } else @@ -702,14 +812,16 @@ int32_t AndroidCryptoNative_SSLStreamGetCipherSuite(SSLStream* sslStream, uint16 *out = NULL; // String cipherSuite = sslSession.getCipherSuite(); - jstring cipherSuite = (*env)->CallObjectMethod(env, sslStream->sslSession, g_SSLSessionGetCipherSuite); + jobject sslSession = GetCurrentSslSession(env, sslStream); + jstring cipherSuite = (*env)->CallObjectMethod(env, sslSession, g_SSLSessionGetCipherSuite); ON_EXCEPTION_PRINT_AND_GOTO(cleanup); *out = AllocateString(env, cipherSuite); ret = SUCCESS; cleanup: - (*env)->DeleteLocalRef(env, cipherSuite); + ReleaseLRef(env, sslSession); + ReleaseLRef(env, cipherSuite); return ret; } @@ -723,14 +835,16 @@ int32_t AndroidCryptoNative_SSLStreamGetProtocol(SSLStream* sslStream, uint16_t* *out = NULL; // String protocol = sslSession.getProtocol(); - jstring protocol = (*env)->CallObjectMethod(env, sslStream->sslSession, g_SSLSessionGetProtocol); + jobject sslSession = GetCurrentSslSession(env, sslStream); + jstring protocol = (*env)->CallObjectMethod(env, sslSession, g_SSLSessionGetProtocol); ON_EXCEPTION_PRINT_AND_GOTO(cleanup); *out = AllocateString(env, protocol); ret = SUCCESS; cleanup: - (*env)->DeleteLocalRef(env, protocol); + ReleaseLRef(env, sslSession); + ReleaseLRef(env, protocol); return ret; } @@ -743,7 +857,8 @@ jobject /*X509Certificate*/ AndroidCryptoNative_SSLStreamGetPeerCertificate(SSLS // Certificate[] certs = sslSession.getPeerCertificates(); // out = certs[0]; - jobjectArray certs = (*env)->CallObjectMethod(env, sslStream->sslSession, g_SSLSessionGetPeerCertificates); + jobject sslSession = GetCurrentSslSession(env, sslStream); + jobjectArray certs = (*env)->CallObjectMethod(env, sslSession, g_SSLSessionGetPeerCertificates); // If there are no peer certificates, getPeerCertificates will throw. Return null to indicate no certificate. if (TryClearJNIExceptions(env)) @@ -758,7 +873,8 @@ jobject /*X509Certificate*/ AndroidCryptoNative_SSLStreamGetPeerCertificate(SSLS } cleanup: - (*env)->DeleteLocalRef(env, certs); + ReleaseLRef(env, sslSession); + ReleaseLRef(env, certs); return ret; } @@ -776,7 +892,8 @@ void AndroidCryptoNative_SSLStreamGetPeerCertificates(SSLStream* sslStream, jobj // for (int i = 0; i < certs.length; i++) { // out[i] = certs[i]; // } - jobjectArray certs = (*env)->CallObjectMethod(env, sslStream->sslSession, g_SSLSessionGetPeerCertificates); + jobject sslSession = GetCurrentSslSession(env, sslStream); + jobjectArray certs = (*env)->CallObjectMethod(env, sslSession, g_SSLSessionGetPeerCertificates); // If there are no peer certificates, getPeerCertificates will throw. Return null and length of zero to indicate no certificates. if (TryClearJNIExceptions(env)) @@ -795,7 +912,8 @@ void AndroidCryptoNative_SSLStreamGetPeerCertificates(SSLStream* sslStream, jobj } cleanup: - (*env)->DeleteLocalRef(env, certs); + ReleaseLRef(env, sslSession); + ReleaseLRef(env, certs); } void AndroidCryptoNative_SSLStreamRequestClientAuthentication(SSLStream* sslStream) @@ -909,14 +1027,15 @@ bool AndroidCryptoNative_SSLStreamVerifyHostname(SSLStream* sslStream, char* hos JNIEnv* env = GetJNIEnv(); bool ret = false; - INIT_LOCALS(loc, name, verifier); + INIT_LOCALS(loc, name, verifier, sslSession); // HostnameVerifier verifier = HttpsURLConnection.getDefaultHostnameVerifier(); // return verifier.verify(hostname, sslSession); loc[name] = make_java_string(env, hostname); + loc[sslSession] = GetCurrentSslSession(env, sslStream); loc[verifier] = (*env)->CallStaticObjectMethod(env, g_HttpsURLConnection, g_HttpsURLConnectionGetDefaultHostnameVerifier); - ret = (*env)->CallBooleanMethod(env, loc[verifier], g_HostnameVerifierVerify, loc[name], sslStream->sslSession); + ret = (*env)->CallBooleanMethod(env, loc[verifier], g_HostnameVerifierVerify, loc[name], loc[sslSession]); RELEASE_LOCALS(loc, env); return ret; diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_sslstream.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_sslstream.h index 07a40bf8315cc6..2fd50aa8bcc8a2 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_sslstream.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Android/pal_sslstream.h @@ -65,7 +65,7 @@ Initialize an SSL context Returns 1 on success, 0 otherwise */ PALEXPORT int32_t AndroidCryptoNative_SSLStreamInitialize( - SSLStream* sslStream, bool isServer, STREAM_READER streamReader, STREAM_WRITER streamWriter, int32_t appBufferSize); + SSLStream* sslStream, bool isServer, STREAM_READER streamReader, STREAM_WRITER streamWriter, int32_t appBufferSize, char* peerHost); /* Set target host diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/entrypoints.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/entrypoints.c index db75e90b3a4365..2a1b138e4b51f8 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/entrypoints.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/entrypoints.c @@ -63,6 +63,7 @@ static const Entry s_cryptoAppleNative[] = DllImportEntry(AppleCryptoNative_RsaGenerateKey) DllImportEntry(AppleCryptoNative_RsaDecryptOaep) DllImportEntry(AppleCryptoNative_RsaDecryptPkcs) + DllImportEntry(AppleCryptoNative_RsaDecryptRaw) DllImportEntry(AppleCryptoNative_RsaEncryptOaep) DllImportEntry(AppleCryptoNative_RsaEncryptPkcs) DllImportEntry(AppleCryptoNative_RsaSignaturePrimitive) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain_macos.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain_macos.c index 84ba72ca7812ba..ba88e4c7c82a26 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain_macos.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain_macos.c @@ -16,7 +16,10 @@ int32_t AppleCryptoNative_SecKeychainItemCopyKeychain(SecKeychainItemRef item, S if (itemType == SecKeyGetTypeID() || itemType == SecIdentityGetTypeID() || itemType == SecCertificateGetTypeID()) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" OSStatus status = SecKeychainItemCopyKeychain(item, pKeychainOut); +#pragma clang diagnostic pop if (status == noErr) { @@ -40,12 +43,18 @@ int32_t AppleCryptoNative_SecKeychainCreate(const char* pathName, const uint8_t* passphraseUtf8, SecKeychainRef* pKeychainOut) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" return SecKeychainCreate(pathName, passphraseLength, passphraseUtf8, false, NULL, pKeychainOut); +#pragma clang diagnostic pop } int32_t AppleCryptoNative_SecKeychainDelete(SecKeychainRef keychain) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" return SecKeychainDelete(keychain); +#pragma clang diagnostic pop } int32_t AppleCryptoNative_SecKeychainCopyDefault(SecKeychainRef* pKeychainOut) @@ -53,7 +62,10 @@ int32_t AppleCryptoNative_SecKeychainCopyDefault(SecKeychainRef* pKeychainOut) if (pKeychainOut != NULL) *pKeychainOut = NULL; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" return SecKeychainCopyDefault(pKeychainOut); +#pragma clang diagnostic pop } int32_t AppleCryptoNative_SecKeychainOpen(const char* pszKeychainPath, SecKeychainRef* pKeychainOut) @@ -64,12 +76,18 @@ int32_t AppleCryptoNative_SecKeychainOpen(const char* pszKeychainPath, SecKeycha if (pszKeychainPath == NULL) return errSecParam; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" return SecKeychainOpen(pszKeychainPath, pKeychainOut); +#pragma clang diagnostic pop } int32_t AppleCryptoNative_SecKeychainUnlock(SecKeychainRef keychain, uint32_t passphraseLength, const uint8_t* passphraseUtf8) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" return SecKeychainUnlock(keychain, passphraseLength, passphraseUtf8, true); +#pragma clang diagnostic pop } int32_t AppleCryptoNative_SetKeychainNeverLock(SecKeychainRef keychain) @@ -81,7 +99,10 @@ int32_t AppleCryptoNative_SetKeychainNeverLock(SecKeychainRef keychain) .lockInterval = INT_MAX, }; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" return SecKeychainSetSettings(keychain, &settings); +#pragma clang diagnostic pop } static int32_t @@ -254,7 +275,10 @@ static bool IsCertInKeychain(CFTypeRef needle, SecKeychainRef haystack) CFDictionarySetValue(query, kSecMatchSearchList, searchList); CFDictionarySetValue(query, kSecMatchItemList, itemMatch); CFDictionarySetValue(query, kSecClass, kSecClassCertificate); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" OSStatus status = SecItemCopyMatching(query, &result); +#pragma clang diagnostic pop bool ret = true; @@ -350,7 +374,10 @@ int32_t AppleCryptoNative_X509StoreAddCertificate(CFTypeRef certOrIdentity, SecK // keychain back to disk. if (status == noErr && privateKey != NULL) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" status = SecKeychainItemCreateCopy((SecKeychainItemRef)privateKey, keychain, NULL, &itemCopy); +#pragma clang diagnostic pop } if (status == errSecDuplicateItem) @@ -369,7 +396,10 @@ int32_t AppleCryptoNative_X509StoreAddCertificate(CFTypeRef certOrIdentity, SecK if (status == noErr && cert != NULL) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" status = SecKeychainItemCreateCopy((SecKeychainItemRef)cert, keychain, NULL, &itemCopy); +#pragma clang diagnostic pop } if (status == errSecDuplicateItem) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.c index a9aece35fb0f59..1746828d5b0d7d 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.c @@ -134,6 +134,13 @@ int32_t AppleCryptoNative_RsaDecryptOaep(SecKeyRef privateKey, privateKey, pbData, cbData, pDecryptedOut, pErrorOut, mgfAlgorithm, SecKeyCreateDecryptedData); } +int32_t AppleCryptoNative_RsaDecryptRaw( + SecKeyRef privateKey, uint8_t* pbData, int32_t cbData, CFDataRef* pDecryptedOut, CFErrorRef* pErrorOut) +{ + return RsaPrimitive( + privateKey, pbData, cbData, pDecryptedOut, pErrorOut, kSecKeyAlgorithmRSAEncryptionRaw, SecKeyCreateDecryptedData); +} + int32_t AppleCryptoNative_RsaDecryptPkcs( SecKeyRef privateKey, uint8_t* pbData, int32_t cbData, CFDataRef* pDecryptedOut, CFErrorRef* pErrorOut) { diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h index 253fdae78e4b3e..34a350f80f9bcf 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_rsa.h @@ -31,6 +31,14 @@ PALEXPORT int32_t AppleCryptoNative_RsaDecryptOaep(SecKeyRef privateKey, CFDataRef* pDecryptedOut, CFErrorRef* pErrorOut); +/* +Decrypt the contents of pbData using the provided privateKey without validating or removing padding. + +Follows pal_seckey return conventions. +*/ +PALEXPORT int32_t AppleCryptoNative_RsaDecryptRaw( + SecKeyRef privateKey, uint8_t* pbData, int32_t cbData, CFDataRef* pDecryptedOut, CFErrorRef* pErrorOut); + /* Decrypt the contents of pbData using the provided privateKey under PKCS#1 padding. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.c index 2d66847c1731b3..0770a946bee1ed 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_ssl.c @@ -596,19 +596,19 @@ int32_t AppleCryptoNative_SslSetEnabledCipherSuites(SSLContextRef sslContext, co // Max numCipherSuites is 2^16 (all possible cipher suites) assert(numCipherSuites < (1 << 16)); -#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) +#if !defined(TARGET_ARM64) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) if (sizeof(SSLCipherSuite) == sizeof(uint32_t)) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - // macOS + // macOS & MacCatalyst x64 return SSLSetEnabledCiphers(sslContext, (const SSLCipherSuite *)cipherSuites, (size_t)numCipherSuites); #pragma clang diagnostic pop } else #endif { - // MacCatalyst, iOS, tvOS, watchOS + // MacCatalyst arm64, iOS, tvOS, watchOS SSLCipherSuite* cipherSuites16 = (SSLCipherSuite*)calloc((size_t)numCipherSuites, sizeof(SSLCipherSuite)); if (cipherSuites16 == NULL) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.c index 0b6d1f889bc691..8d2b87d466f13f 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509.c @@ -106,7 +106,6 @@ PAL_X509ContentType AppleCryptoNative_X509GetContentType(uint8_t* pbData, int32_ // The sniffing order is: // * X509 DER // * PKCS7 PEM/DER - // * PKCS12 DER (or PEM if Apple has non-standard support for that) // * X509 PEM or PEM aggregate (or DER, but that already matched) // // If the X509 PEM check is done first SecItemImport will erroneously match @@ -114,6 +113,11 @@ PAL_X509ContentType AppleCryptoNative_X509GetContentType(uint8_t* pbData, int32_ // // Likewise, if the X509 DER check isn't done first, Apple will report it as // being a PKCS#7. + // + // This does not attempt to open a PFX / PKCS12 as Apple does not provide + // a suitable API to determine if it is PKCS12 without doing potentially + // unbound MAC / KDF work. Instead, let that return Unknown and let the managed + // decoding do the check. SecCertificateRef certref = SecCertificateCreateWithData(NULL, cfData); if (certref != NULL) @@ -140,41 +144,6 @@ PAL_X509ContentType AppleCryptoNative_X509GetContentType(uint8_t* pbData, int32_ } } - dataFormat = kSecFormatPKCS12; - actualFormat = dataFormat; - itemType = kSecItemTypeAggregate; - actualType = itemType; - - osStatus = SecItemImport(cfData, NULL, &actualFormat, &actualType, 0, NULL, NULL, NULL); - - if (osStatus == errSecPassphraseRequired) - { - dataFormat = kSecFormatPKCS12; - actualFormat = dataFormat; - itemType = kSecItemTypeAggregate; - actualType = itemType; - - SecItemImportExportKeyParameters importParams; - memset(&importParams, 0, sizeof(SecItemImportExportKeyParameters)); - - importParams.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION; - importParams.passphrase = CFSTR(""); - - osStatus = SecItemImport(cfData, NULL, &actualFormat, &actualType, 0, &importParams, NULL, NULL); - - CFRelease(importParams.passphrase); - importParams.passphrase = NULL; - } - - if (osStatus == noErr || osStatus == errSecPkcs12VerifyFailure) - { - if (actualType == itemType && actualFormat == dataFormat) - { - CFRelease(cfData); - return PAL_Pkcs12; - } - } - dataFormat = kSecFormatX509Cert; actualFormat = dataFormat; itemType = kSecItemTypeCertificate; diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509_macos.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509_macos.c index a396ec7f649da8..41ba9648259c76 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509_macos.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509_macos.c @@ -384,8 +384,10 @@ int32_t AppleCryptoNative_X509CopyWithPrivateKey(SecCertificateRef cert, } SecKeychainRef keyKeychain = NULL; - +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" OSStatus status = SecKeychainItemCopyKeychain((SecKeychainItemRef)privateKey, &keyKeychain); +#pragma clang diagnostic pop SecKeychainItemRef itemCopy = NULL; // This only happens with an ephemeral key, so the keychain we're adding it to is temporary. @@ -536,7 +538,10 @@ int32_t AppleCryptoNative_X509MoveToKeychain(SecCertificateRef cert, SecKeychainRef curKeychain = NULL; SecKeyRef importedKey = NULL; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" OSStatus status = SecKeychainItemCopyKeychain((SecKeychainItemRef)cert, &curKeychain); +#pragma clang diagnostic pop if (status == errSecNoSuchKeychain) { @@ -559,7 +564,10 @@ int32_t AppleCryptoNative_X509MoveToKeychain(SecCertificateRef cert, if (status == noErr && privateKey != NULL) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" status = SecKeychainItemCopyKeychain((SecKeychainItemRef)privateKey, &curKeychain); +#pragma clang diagnostic pop if (status == errSecNoSuchKeychain) { diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509chain.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509chain.c index ec12984bb3a9c5..06f09cfd9f47a8 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509chain.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/pal_x509chain.c @@ -195,7 +195,7 @@ static void MergeStatusCodes(CFTypeRef key, CFTypeRef value, void* context) } else if (CFEqual(keyString, CFSTR("NonEmptySubject")) || CFEqual(keyString, CFSTR("GrayListedKey")) || CFEqual(keyString, CFSTR("CTRequired")) || CFEqual(keyString, CFSTR("GrayListedLeaf")) || - CFEqual(keyString, CFSTR("IdLinkage"))) + CFEqual(keyString, CFSTR("IdLinkage")) || CFEqual(keyString, CFSTR("DuplicateExtension"))) { // Not a "problem" that we report. } diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c index 15df621f7a7dfa..78d34ff2ac3fcf 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c @@ -112,7 +112,7 @@ int32_t local_X509_get_version(const X509* x509) X509_PUBKEY* local_X509_get_X509_PUBKEY(const X509* x509) { - if (x509) + if (x509 && x509->cert_info) { return x509->cert_info->key; } @@ -123,13 +123,28 @@ X509_PUBKEY* local_X509_get_X509_PUBKEY(const X509* x509) int32_t local_X509_PUBKEY_get0_param( ASN1_OBJECT** palgOid, const uint8_t** pkeyBytes, int* pkeyBytesLen, X509_ALGOR** palg, X509_PUBKEY* pubkey) { + if (!pubkey) + { + return 0; + } + if (palgOid) { + if (!pubkey->algor) + { + return 0; + } + *palgOid = pubkey->algor->algorithm; } if (pkeyBytes) { + if (!pubkey->public_key) + { + return 0; + } + *pkeyBytes = pubkey->public_key->data; *pkeyBytesLen = pubkey->public_key->length; } diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.c index ad93dbf74d87d7..c11da4c0f69e91 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.c @@ -564,7 +564,7 @@ BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssue if (answer) { BIO* b = BIO_new(BIO_s_mem()); - ASN1_STRING_print_ex(b, answer, 0); + ASN1_STRING_print_ex(b, answer, ASN1_STRFLGS_UTF8_CONVERT); return b; } } @@ -593,8 +593,8 @@ BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssue break; } - STACK_OF(GENERAL_NAME)* altNames = (STACK_OF(GENERAL_NAME)*)( - X509_get_ext_d2i(x509, forIssuer ? NID_issuer_alt_name : NID_subject_alt_name, NULL, NULL)); + GENERAL_NAMES* altNames = (GENERAL_NAMES*) + X509_get_ext_d2i(x509, forIssuer ? NID_issuer_alt_name : NID_subject_alt_name, NULL, NULL); if (altNames) { @@ -635,6 +635,11 @@ BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssue 0 == strncmp(localOid, szOidUpn, sizeof(szOidUpn))) { // OTHERNAME->ASN1_TYPE->union.field + if (!value->value) + { + return NULL; + } + str = value->value->value.asn1_string; } } @@ -646,14 +651,14 @@ BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssue if (str) { BIO* b = BIO_new(BIO_s_mem()); - ASN1_STRING_print_ex(b, str, 0); - sk_GENERAL_NAME_free(altNames); + ASN1_STRING_print_ex(b, str, ASN1_STRFLGS_UTF8_CONVERT); + GENERAL_NAMES_free(altNames); return b; } } } - sk_GENERAL_NAME_free(altNames); + GENERAL_NAMES_free(altNames); } } @@ -1068,27 +1073,30 @@ int32_t CryptoNative_LookupFriendlyNameByOid(const char* oidValue, const char** return -2; } + // First, check if oidValue parses as a dotted decimal OID. If not, we'll + // return not-found and let the system cache that. + int asnRet = a2d_ASN1_OBJECT(NULL, 0, oidValue, -1); + + if (asnRet <= 0) + { + return 0; + } + // Do a lookup with no_name set. The purpose of this function is to map only the // dotted decimal to the friendly name. "sha1" in should not result in "sha1" out. oid = OBJ_txt2obj(oidValue, 1); - if (!oid) + if (oid == NULL) { - unsigned long err = ERR_peek_last_error(); - - // If the most recent error pushed onto the error queue is NOT from OID parsing - // then signal for an exception to be thrown. - if (err != 0 && ERR_GET_FUNC(err) != ASN1_F_A2D_ASN1_OBJECT) - { - return -1; - } - - return 0; + // We know that the OID parsed (unless it underwent concurrent modification, + // which is unsupported), so any error in this stage should be an exception. + return -1; } // Look in the predefined, and late-registered, OIDs list to get the lookup table // identifier for this OID. The OBJ_txt2obj object will not have ln set. nid = OBJ_obj2nid(oid); + ASN1_OBJECT_free(oid); if (nid == NID_undef) { diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.h index 69c95b532ade08..050df1193ff021 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.h @@ -159,6 +159,7 @@ const EVP_CIPHER* EVP_chacha20_poly1305(void); // that needs to be added. #define FOR_ALL_OPENSSL_FUNCTIONS \ + REQUIRED_FUNCTION(a2d_ASN1_OBJECT) \ REQUIRED_FUNCTION(ASN1_BIT_STRING_free) \ REQUIRED_FUNCTION(ASN1_d2i_bio) \ REQUIRED_FUNCTION(ASN1_i2d_bio) \ @@ -269,9 +270,12 @@ const EVP_CIPHER* EVP_chacha20_poly1305(void); LEGACY_FUNCTION(ERR_load_crypto_strings) \ LIGHTUP_FUNCTION(ERR_new) \ REQUIRED_FUNCTION(ERR_peek_error) \ + REQUIRED_FUNCTION(ERR_peek_error_line) \ REQUIRED_FUNCTION(ERR_peek_last_error) \ + REQUIRED_FUNCTION(ERR_pop_to_mark) \ FALLBACK_FUNCTION(ERR_put_error) \ REQUIRED_FUNCTION(ERR_reason_error_string) \ + REQUIRED_FUNCTION(ERR_set_mark) \ LIGHTUP_FUNCTION(ERR_set_debug) \ LIGHTUP_FUNCTION(ERR_set_error) \ REQUIRED_FUNCTION(EVP_aes_128_cbc) \ @@ -320,10 +324,13 @@ const EVP_CIPHER* EVP_chacha20_poly1305(void); REQUIRED_FUNCTION(EVP_MD_CTX_copy_ex) \ RENAMED_FUNCTION(EVP_MD_CTX_free, EVP_MD_CTX_destroy) \ RENAMED_FUNCTION(EVP_MD_CTX_new, EVP_MD_CTX_create) \ + REQUIRED_FUNCTION(EVP_MD_CTX_set_flags) \ + LIGHTUP_FUNCTION(EVP_MD_fetch) \ RENAMED_FUNCTION(EVP_MD_get_size, EVP_MD_size) \ REQUIRED_FUNCTION(EVP_PKCS82PKEY) \ REQUIRED_FUNCTION(EVP_PKEY2PKCS8) \ REQUIRED_FUNCTION(EVP_PKEY_CTX_ctrl) \ + REQUIRED_FUNCTION(EVP_PKEY_CTX_ctrl_str) \ REQUIRED_FUNCTION(EVP_PKEY_CTX_free) \ REQUIRED_FUNCTION(EVP_PKEY_CTX_get0_pkey) \ REQUIRED_FUNCTION(EVP_PKEY_CTX_new) \ @@ -607,6 +614,7 @@ FOR_ALL_OPENSSL_FUNCTIONS // Redefine all calls to OpenSSL functions as calls through pointers that are set // to the functions from the libssl.so selected by the shim. +#define a2d_ASN1_OBJECT a2d_ASN1_OBJECT_ptr #define ASN1_BIT_STRING_free ASN1_BIT_STRING_free_ptr #define ASN1_GENERALIZEDTIME_free ASN1_GENERALIZEDTIME_free_ptr #define ASN1_d2i_bio ASN1_d2i_bio_ptr @@ -717,10 +725,13 @@ FOR_ALL_OPENSSL_FUNCTIONS #define ERR_load_crypto_strings ERR_load_crypto_strings_ptr #define ERR_new ERR_new_ptr #define ERR_peek_error ERR_peek_error_ptr +#define ERR_peek_error_line ERR_peek_error_line_ptr #define ERR_peek_last_error ERR_peek_last_error_ptr #define ERR_put_error ERR_put_error_ptr +#define ERR_pop_to_mark ERR_pop_to_mark_ptr #define ERR_reason_error_string ERR_reason_error_string_ptr #define ERR_set_debug ERR_set_debug_ptr +#define ERR_set_mark ERR_set_mark_ptr #define ERR_set_error ERR_set_error_ptr #define EVP_aes_128_cbc EVP_aes_128_cbc_ptr #define EVP_aes_128_cfb8 EVP_aes_128_cfb8_ptr @@ -768,10 +779,13 @@ FOR_ALL_OPENSSL_FUNCTIONS #define EVP_MD_CTX_copy_ex EVP_MD_CTX_copy_ex_ptr #define EVP_MD_CTX_free EVP_MD_CTX_free_ptr #define EVP_MD_CTX_new EVP_MD_CTX_new_ptr +#define EVP_MD_CTX_set_flags EVP_MD_CTX_set_flags_ptr +#define EVP_MD_fetch EVP_MD_fetch_ptr #define EVP_MD_get_size EVP_MD_get_size_ptr #define EVP_PKCS82PKEY EVP_PKCS82PKEY_ptr #define EVP_PKEY2PKCS8 EVP_PKEY2PKCS8_ptr #define EVP_PKEY_CTX_ctrl EVP_PKEY_CTX_ctrl_ptr +#define EVP_PKEY_CTX_ctrl_str EVP_PKEY_CTX_ctrl_str_ptr #define EVP_PKEY_CTX_free EVP_PKEY_CTX_free_ptr #define EVP_PKEY_CTX_get0_pkey EVP_PKEY_CTX_get0_pkey_ptr #define EVP_PKEY_CTX_new EVP_PKEY_CTX_new_ptr diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/osslcompat_30.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/osslcompat_30.h index dba69f1382d2fc..2614c53a2551d2 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/osslcompat_30.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/osslcompat_30.h @@ -19,6 +19,7 @@ void ERR_new(void); void ERR_set_debug(const char *file, int line, const char *func); void ERR_set_error(int lib, int reason, const char *fmt, ...); int EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len); +EVP_MD* EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, const char *properties); int EVP_MD_get_size(const EVP_MD* md); int EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX* ctx, int bits); int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX* ctx, const EVP_MD* md); diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.c index 9cf042a29e9fca..c949bffce88cfd 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp.c @@ -1,12 +1,40 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#include "openssl.h" #include "pal_evp.h" #include +#include #define SUCCESS 1 +static const EVP_MD* g_evpFetchMd5 = NULL; +static pthread_once_t g_evpFetch = PTHREAD_ONCE_INIT; + +static void EnsureFetchEvpMdAlgorithms(void) +{ + // This is called from a pthread_once - this method should not be called directly. + +#ifdef NEED_OPENSSL_3_0 + if (API_EXISTS(EVP_MD_fetch)) + { + ERR_clear_error(); + + // Try to fetch an MD5 implementation that will work regardless if + // FIPS is enforced or not. + g_evpFetchMd5 = EVP_MD_fetch(NULL, "MD5", "-fips"); + } +#endif + + // No error queue impact. + // If EVP_MD_fetch is unavailable, use the implicit loader. If it failed, use the implicit loader as a last resort. + if (g_evpFetchMd5 == NULL) + { + g_evpFetchMd5 = EVP_md5(); + } +} + EVP_MD_CTX* CryptoNative_EvpMdCtxCreate(const EVP_MD* type) { EVP_MD_CTX* ctx = EVP_MD_CTX_new(); @@ -16,6 +44,13 @@ EVP_MD_CTX* CryptoNative_EvpMdCtxCreate(const EVP_MD* type) return NULL; } + // For OpenSSL 1.x, set the non-FIPS allow flag for MD5. OpenSSL 3 does this differently with EVP_MD_fetch + // and no longer has this flag. + if (CryptoNative_OpenSslVersionNumber() < OPENSSL_VERSION_3_0_RTM && type == EVP_md5()) + { + EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); + } + int ret = EVP_DigestInit_ex(ctx, type, NULL); if (!ret) { @@ -124,7 +159,8 @@ int32_t CryptoNative_EvpMdSize(const EVP_MD* md) const EVP_MD* CryptoNative_EvpMd5() { - return EVP_md5(); + pthread_once(&g_evpFetch, EnsureFetchEvpMdAlgorithms); + return g_evpFetchMd5; } const EVP_MD* CryptoNative_EvpSha1() diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.c index 6839d4c2fe04ef..79de386f097215 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.c @@ -152,20 +152,59 @@ EVP_PKEY* CryptoNative_DecodePkcs8PrivateKey(const uint8_t* buf, int32_t len, in return key; } -int32_t CryptoNative_GetPkcs8PrivateKeySize(EVP_PKEY* pkey) +int32_t CryptoNative_GetPkcs8PrivateKeySize(EVP_PKEY* pkey, int32_t* p8size) { assert(pkey != NULL); + assert(p8size != NULL); + + *p8size = 0; + ERR_clear_error(); PKCS8_PRIV_KEY_INFO* p8 = EVP_PKEY2PKCS8(pkey); if (p8 == NULL) { + // OpenSSL 1.1 and 3 have a behavioral change with EVP_PKEY2PKCS8 + // with regard to handling EVP_PKEYs that do not contain a private key. + // + // In OpenSSL 1.1, it would always succeed, but the private parameters + // would be missing (thus making an invalid PKCS8 structure). + // Over in the managed side, we detect these invalid PKCS8 blobs and + // convert that to a "no private key" error. + // + // In OpenSSL 3, this now correctly errors, with the error + // ASN1_R_ILLEGAL_ZERO_CONTENT. We want to preserve allocation failures + // as OutOfMemoryException. So we peek at the error. If it's a malloc + // failure, -1 is returned to indcate "throw what is on the error queue". + // If the error is not a malloc failure, return -2 to mean "no private key". + // If OpenSSL ever changes the error to something more to explicitly mean + // "no private key" then we should test for that explicitly. Until then, + // we treat all errors, except a malloc error, to mean "no private key". + + const char* file = NULL; + int line = 0; + unsigned long error = ERR_peek_error_line(&file, &line); + + // If it's not a malloc failure, assume it's because the private key is + // missing. + if (ERR_GET_REASON(error) != ERR_R_MALLOC_FAILURE) + { + ERR_clear_error(); + return -2; + } + + // It is a malloc failure. Clear the error queue and set the error + // as a malloc error so it's the only error in the queue. + ERR_clear_error(); + ERR_put_error(ERR_GET_LIB(error), 0, ERR_R_MALLOC_FAILURE, file, line); + return -1; } - int ret = i2d_PKCS8_PRIV_KEY_INFO(p8, NULL); + *p8size = i2d_PKCS8_PRIV_KEY_INFO(p8, NULL); PKCS8_PRIV_KEY_INFO_free(p8); - return ret; + + return *p8size < 0 ? -1 : 1; } int32_t CryptoNative_EncodePkcs8PrivateKey(EVP_PKEY* pkey, uint8_t* buf) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h index 012ac98e03db20..fac7ee32b5bbcc 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.h @@ -58,9 +58,13 @@ Requres a non-null buf, and len > 0. PALEXPORT EVP_PKEY* CryptoNative_DecodePkcs8PrivateKey(const uint8_t* buf, int32_t len, int32_t algId); /* -Reports the number of bytes rqeuired to encode an EVP_PKEY* as a Pkcs8PrivateKeyInfo, or a negative value on error. +Gets the number of bytes rqeuired to encode an EVP_PKEY* as a Pkcs8PrivateKeyInfo. + +On success, 1 is returned and p8size contains the size of the Pkcs8PrivateKeyInfo. +On failure, -1 is used to indicate the openssl error queue contains the error. +On failure, -2 is used to indcate that the supplied EVP_PKEY* is possibly missing a private key. */ -PALEXPORT int32_t CryptoNative_GetPkcs8PrivateKeySize(EVP_PKEY* pkey); +PALEXPORT int32_t CryptoNative_GetPkcs8PrivateKeySize(EVP_PKEY* pkey, int32_t* p8size); /* Encodes the EVP_PKEY* as a Pkcs8PrivateKeyInfo, writing the encoded value to buf. diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c index 36924abb505818..c3e491a868f5ea 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c @@ -63,6 +63,19 @@ static bool ConfigureEncryption(EVP_PKEY_CTX* ctx, RsaPaddingMode padding, const { return false; } + + // OpenSSL 3.2 introduced a change where PKCS#1 RSA decryption does not fail for invalid padding. + // If the padding is invalid, the decryption operation returns random data. + // See https://github.com/openssl/openssl/pull/13817 for background. + // Some Linux distributions backported this change to previous versions of OpenSSL. + // Here we do a best-effort to set a flag to revert the behavior to failing if the padding is invalid. + ERR_set_mark(); + + EVP_PKEY_CTX_ctrl_str(ctx, "rsa_pkcs1_implicit_rejection", "0"); + + // Undo any changes to the error queue that may have occured while configuring implicit rejection if the + // current version does not support implicit rejection. + ERR_pop_to_mark(); } else { diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.c index ae1b33d8b4782f..3521a8073f9b4c 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_pkcs7.c @@ -46,9 +46,19 @@ int32_t CryptoNative_GetPkcs7Certificates(PKCS7* p7, X509Stack** certs) switch (OBJ_obj2nid(p7->type)) { case NID_pkcs7_signed: + if (!p7->d.sign) + { + return 0; + } + *certs = p7->d.sign->cert; return 1; case NID_pkcs7_signedAndEnveloped: + if (!p7->d.signed_and_enveloped) + { + return 0; + } + *certs = p7->d.signed_and_enveloped->cert; return 1; } diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ssl.c b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ssl.c index 77ac385a799059..e97092339bb65d 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ssl.c +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ssl.c @@ -38,6 +38,53 @@ static void EnsureLibSsl10Initialized() } #endif +#ifdef FEATURE_DISTRO_AGNOSTIC_SSL +// redirect all SSL_CTX_set_options and SSL_set_options calls via dynamic shims +// to work around ABI breaking change between 1.1 and 3.0 + +#undef SSL_CTX_set_options +#define SSL_CTX_set_options SSL_CTX_set_options_dynamic +static uint64_t SSL_CTX_set_options_dynamic(SSL_CTX* ctx, uint64_t options) +{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-function-type" + if (API_EXISTS(ERR_new)) // OpenSSL 3.0 sentinel function + { + // OpenSSL 3.0 and newer, use uint64_t for options + uint64_t (*func)(SSL_CTX* ctx, uint64_t op) = (uint64_t(*)(SSL_CTX*, uint64_t))SSL_CTX_set_options_ptr; + return func(ctx, options); + } + else + { + // OpenSSL 1.1 and earlier, use uint32_t for options + uint32_t (*func)(SSL_CTX* ctx, uint32_t op) = (uint32_t(*)(SSL_CTX*, uint32_t))SSL_CTX_set_options_ptr; + return func(ctx, (uint32_t)options); + } +#pragma clang diagnostic pop +} + +#undef SSL_set_options +#define SSL_set_options SSL_set_options_dynamic +static uint64_t SSL_set_options_dynamic(SSL* s, uint64_t options) +{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-function-type" + if (API_EXISTS(ERR_new)) // OpenSSL 3.0 sentinel function + { + // OpenSSL 3.0 and newer, use uint64_t for options + uint64_t (*func)(SSL* s, uint64_t op) = (uint64_t(*)(SSL*, uint64_t))SSL_set_options_ptr; + return func(s, options); + } + else + { + // OpenSSL 1.1 and earlier, use uint32_t for options + uint32_t (*func)(SSL* s, uint32_t op) = (uint32_t(*)(SSL*, uint32_t))SSL_set_options_ptr; + return func(s, (uint32_t)options); + } +#pragma clang diagnostic pop +} +#endif + static int32_t g_config_specified_ciphersuites = 0; static void DetectCiphersuiteConfiguration() @@ -359,11 +406,15 @@ int32_t CryptoNative_SslSessionReused(SSL* ssl) int32_t CryptoNative_SslWrite(SSL* ssl, const void* buf, int32_t num) { + ERR_clear_error(); + return SSL_write(ssl, buf, num); } int32_t CryptoNative_SslRead(SSL* ssl, void* buf, int32_t num) { + ERR_clear_error(); + return SSL_read(ssl, buf, num); } diff --git a/src/libraries/Native/Unix/configure.cmake b/src/libraries/Native/Unix/configure.cmake index 18afacc2dbc59c..5ff7dc14618f54 100644 --- a/src/libraries/Native/Unix/configure.cmake +++ b/src/libraries/Native/Unix/configure.cmake @@ -7,6 +7,7 @@ include(CheckStructHasMember) include(CheckSymbolExists) include(CheckTypeSize) include(CheckLibraryExists) +include(CheckFunctionExists) # CMP0075 Include file check macros honor CMAKE_REQUIRED_LIBRARIES. if(POLICY CMP0075) @@ -71,6 +72,12 @@ if(C_SUPPORTS_WUNGUARDED_AVAILABILITY) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wunguarded-availability") endif() +# Enable building on platforms where strict-prototypes is enabled by default. +check_c_compiler_flag(-Wno-strict-prototypes COMPILER_SUPPORTS_W_NO_STRICT_PROTOTYPES) +if(COMPILER_SUPPORTS_W_NO_STRICT_PROTOTYPES) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-strict-prototypes") +endif() + # in_pktinfo: Find whether this struct exists check_include_files( "sys/socket.h;linux/in.h" @@ -156,9 +163,8 @@ check_symbol_exists( fcntl.h HAVE_F_FULLFSYNC) -check_symbol_exists( +check_function_exists( getifaddrs - ifaddrs.h HAVE_GETIFADDRS) check_symbol_exists( @@ -232,14 +238,9 @@ check_symbol_exists( HAVE_POSIX_ADVISE) check_symbol_exists( - posix_fallocate - fcntl.h - HAVE_POSIX_FALLOCATE) - -check_symbol_exists( - posix_fallocate64 + fallocate fcntl.h - HAVE_POSIX_FALLOCATE64) + HAVE_FALLOCATE) check_symbol_exists( preadv @@ -879,7 +880,15 @@ check_symbol_exists( if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(HAVE_IOS_NET_ROUTE_H 1) - set(CMAKE_EXTRA_INCLUDE_FILES sys/types.h "${CMAKE_CURRENT_SOURCE_DIR}/System.Native/ios/net/route.h") + set(HAVE_IOS_NET_IFMEDIA_H 1) + set(HAVE_IOS_NETINET_TCPFSM_H 1) + set(HAVE_IOS_NETINET_IP_VAR_H 1) + set(HAVE_IOS_NETINET_ICMP_VAR_H 1) + set(HAVE_IOS_NETINET_UDP_VAR_H 1) + set(CMAKE_EXTRA_INCLUDE_FILES + sys/types.h + "${CMAKE_CURRENT_SOURCE_DIR}/System.Native/ios/net/route.h" + ) else() set(CMAKE_EXTRA_INCLUDE_FILES sys/types.h net/if.h net/route.h) endif() diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt index 0ca238d56fd92d..bcad7b2b21da71 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt @@ -27,7 +27,8 @@ if(${CLR_CMAKE_HOST_ARCH} STREQUAL x86 OR ${CLR_CMAKE_HOST_ARCH} STREQUAL x64) zlib-intel/trees.c zlib-intel/x86.c zlib-intel/zutil.c -) + ) + add_definitions(-DINTERNAL_ZLIB_INTEL) else() set(NATIVECOMPRESSION_SOURCES zlib/adler32.c @@ -42,9 +43,13 @@ else() ) endif() +# enable custom zlib allocator +add_definitions(-DMY_ZCALLOC) + set (NATIVECOMPRESSION_SOURCES ${NATIVECOMPRESSION_SOURCES} ../../AnyOS/zlib/pal_zlib.c + ../../AnyOS/zlib/zlib_allocator_win.c ../../AnyOS/brotli/common/constants.c ../../AnyOS/brotli/common/context.c ../../AnyOS/brotli/common/dictionary.c diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/cgmanifest.json b/src/libraries/Native/Windows/System.IO.Compression.Native/cgmanifest.json new file mode 100644 index 00000000000000..e8df9d49bd621c --- /dev/null +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/cgmanifest.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ + { + "Component": { + "Type": "git", + "Git": { + "RepositoryUrl": "https://github.com/madler/zlib", + "CommitHash": "51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf" + } + }, + "DevelopmentDependency": false + }, + { + "Component": { + "Type": "git", + "Git": { + "RepositoryUrl": "https://github.com/intel/zlib", + "CommitHash": "6160a8f20c3626aec2f8b0fda5bf2e65bfe31781" + } + }, + "DevelopmentDependency": false + } + ] +} diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/patches/zlib/0001-Make-zlib-compile-clean-against-C4244.patch b/src/libraries/Native/Windows/System.IO.Compression.Native/patches/zlib/0001-Make-zlib-compile-clean-against-C4244.patch new file mode 100644 index 00000000000000..d849588e80cf6b --- /dev/null +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/patches/zlib/0001-Make-zlib-compile-clean-against-C4244.patch @@ -0,0 +1,57 @@ +From 86d96652ddd60f61dc7b0c94b601f6d156d34632 Mon Sep 17 00:00:00 2001 +From: Levi Broderick +Date: Mon, 28 Aug 2023 15:26:38 -0700 +Subject: [PATCH] Make zlib compile clean against C4244 clang equivalent is + "implicit-int-conversion" warning + +The change to deflate.c is legal because 'len' has an upper bound of +MAX_STORED, which means it fits cleanly into a 16-bit integer. So +writing out 2x 8-bit values will not result in data loss. + +The change to trees.c is legal because within this loop, 'count' is +intended to have an upper bound of 138, with the target assignment +only executing if 'count' is bounded by 4. Neither the 'count' local +in isolation nor the addition that's part of the target line is +expected to result in integer overflow. But even if it did, that's a +matter for a different warning code and doesn't impact the correctness +of the narrowing cast being considered here. +--- + src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.c | 8 ++++---- + src/libraries/Native/Windows/System.IO.Compression.Native/zlib/trees.c | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.c +index d2e1106ef5d..b7636639754 100644 +--- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.c ++++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.c +@@ -1738,10 +1738,10 @@ local block_state deflate_stored(s, flush) + _tr_stored_block(s, (char *)0, 0L, last); + + /* Replace the lengths in the dummy stored block with len. */ +- s->pending_buf[s->pending - 4] = len; +- s->pending_buf[s->pending - 3] = len >> 8; +- s->pending_buf[s->pending - 2] = ~len; +- s->pending_buf[s->pending - 1] = ~len >> 8; ++ s->pending_buf[s->pending - 4] = (Bytef)len; ++ s->pending_buf[s->pending - 3] = (Bytef)(len >> 8); ++ s->pending_buf[s->pending - 2] = (Bytef)~len; ++ s->pending_buf[s->pending - 1] = (Bytef)(~len >> 8); + + /* Write the stored block header bytes. */ + flush_pending(s->strm); +diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/trees.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/trees.c +index 5f305c47221..8a3eec559e5 100644 +--- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/trees.c ++++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/trees.c +@@ -721,7 +721,7 @@ local void scan_tree(s, tree, max_code) + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { +- s->bl_tree[curlen].Freq += count; ++ s->bl_tree[curlen].Freq += (ush)count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; +-- +2.42.0.windows.1 + diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel-version.txt b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel-version.txt new file mode 100644 index 00000000000000..d406ffbcc459b3 --- /dev/null +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel-version.txt @@ -0,0 +1,14 @@ +v1.2.13_jtk +(6160a8f20c3626aec2f8b0fda5bf2e65bfe31781) + +https://github.com/intel/zlib/releases/tag/v1.2.13_jtk + +Note: This library does not use a standard release lifecycle. + We're pointing to the latest available tagged version as of this writing. + +We do not pull in every file from the intel/zlib repo. Instead, some years ago, +somebody determined what they believed was the minimum set that needed to be +copied into our repo in order to build. Since then, we've just updated only +those files in-place, ignoring other files in the intel/zlib repo. If new files +are introduced which are necessary for building the product, feel free to bring +those down as well. diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/compress.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/compress.c index e2db404abf888b..2ad5326c14ec04 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/compress.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/compress.c @@ -19,7 +19,7 @@ memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) +int ZEXPORT compress2(dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -65,7 +65,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) /* =========================================================================== */ -int ZEXPORT compress (dest, destLen, source, sourceLen) +int ZEXPORT compress(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -78,7 +78,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ -uLong ZEXPORT compressBound (sourceLen) +uLong ZEXPORT compressBound(sourceLen) uLong sourceLen; { return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc32.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc32.c index 3ff7d6f9f67743..49c4f1b828e525 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc32.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc32.c @@ -1,12 +1,10 @@ /* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + * This interleaved implementation of a CRC makes use of pipelined multiple + * arithmetic-logic units, commonly found in modern CPU cores. It is due to + * Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution. */ /* @(#) $Id$ */ @@ -14,11 +12,12 @@ /* Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore protection on the static variables used to control the first-use generation - of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should first call get_crc_table() to initialize the tables before allowing more than one thread to use crc32(). - DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. + MAKECRCH can be #defined to write out crc32.h. A main() routine is also + produced, so that this one source file can be compiled to an executable. */ #ifdef MAKECRCH @@ -28,430 +27,1100 @@ # endif /* !DYNAMIC_CRC_TABLE */ #endif /* MAKECRCH */ -#include "zutil.h" /* for STDC and FAR definitions */ +#include "zutil.h" /* for Z_U4, Z_U8, z_crc_t, and FAR definitions */ + + /* + A CRC of a message is computed on N braids of words in the message, where + each word consists of W bytes (4 or 8). If N is 3, for example, then three + running sparse CRCs are calculated respectively on each braid, at these + indices in the array of words: 0, 3, 6, ..., 1, 4, 7, ..., and 2, 5, 8, ... + This is done starting at a word boundary, and continues until as many blocks + of N * W bytes as are available have been processed. The results are combined + into a single CRC at the end. For this code, N must be in the range 1..6 and + W must be 4 or 8. The upper limit on N can be increased if desired by adding + more #if blocks, extending the patterns apparent in the code. In addition, + crc32.h would need to be regenerated, if the maximum N value is increased. + + N and W are chosen empirically by benchmarking the execution time on a given + processor. The choices for N and W below were based on testing on Intel Kaby + Lake i7, AMD Ryzen 7, ARM Cortex-A57, Sparc64-VII, PowerPC POWER9, and MIPS64 + Octeon II processors. The Intel, AMD, and ARM processors were all fastest + with N=5, W=8. The Sparc, PowerPC, and MIPS64 were all fastest at N=5, W=4. + They were all tested with either gcc or clang, all using the -O3 optimization + level. Your mileage may vary. + */ -/* Definitions for doing the crc four data bytes at a time. */ -#if !defined(NOBYFOUR) && defined(Z_U4) -# define BYFOUR +/* Define N */ +#ifdef Z_TESTN +# define N Z_TESTN +#else +# define N 5 +#endif +#if N < 1 || N > 6 +# error N must be in 1..6 #endif -#ifdef BYFOUR - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, z_size_t)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, z_size_t)); -# define TBLS 8 + +/* + z_crc_t must be at least 32 bits. z_word_t must be at least as long as + z_crc_t. It is assumed here that z_word_t is either 32 bits or 64 bits, and + that bytes are eight bits. + */ + +/* + Define W and the associated z_word_t type. If W is not defined, then a + braided calculation is not used, and the associated tables and code are not + compiled. + */ +#ifdef Z_TESTW +# if Z_TESTW-1 != -1 +# define W Z_TESTW +# endif #else -# define TBLS 1 -#endif /* BYFOUR */ +# ifdef MAKECRCH +# define W 8 /* required for MAKECRCH */ +# else +# if defined(__x86_64__) || defined(__aarch64__) +# define W 8 +# else +# define W 4 +# endif +# endif +#endif +#ifdef W +# if W == 8 && defined(Z_U8) + typedef Z_U8 z_word_t; +# elif defined(Z_U4) +# undef W +# define W 4 + typedef Z_U4 z_word_t; +# else +# undef W +# endif +#endif -/* Local functions for crc concatenation */ -local unsigned long gf2_matrix_times OF((unsigned long *mat, - unsigned long vec)); -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); -local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); +/* If available, use the ARM processor CRC32 instruction. */ +#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 +# define ARMCRC32 +#endif +/* Local functions. */ +local z_crc_t multmodp OF((z_crc_t a, z_crc_t b)); +local z_crc_t x2nmodp OF((z_off64_t n, unsigned k)); + +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) + local z_word_t byte_swap OF((z_word_t word)); +#endif + +#if defined(W) && !defined(ARMCRC32) + local z_crc_t crc_word OF((z_word_t data)); + local z_word_t crc_word_big OF((z_word_t data)); +#endif + +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) +/* + Swap the bytes in a z_word_t to convert between little and big endian. Any + self-respecting compiler will optimize this to a single machine byte-swap + instruction, if one is available. This assumes that word_t is either 32 bits + or 64 bits. + */ +local z_word_t byte_swap(word) + z_word_t word; +{ +# if W == 8 + return + (word & 0xff00000000000000) >> 56 | + (word & 0xff000000000000) >> 40 | + (word & 0xff0000000000) >> 24 | + (word & 0xff00000000) >> 8 | + (word & 0xff000000) << 8 | + (word & 0xff0000) << 24 | + (word & 0xff00) << 40 | + (word & 0xff) << 56; +# else /* W == 4 */ + return + (word & 0xff000000) >> 24 | + (word & 0xff0000) >> 8 | + (word & 0xff00) << 8 | + (word & 0xff) << 24; +# endif +} +#endif + +/* CRC polynomial. */ +#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */ #ifdef DYNAMIC_CRC_TABLE -local volatile int crc_table_empty = 1; -local z_crc_t FAR crc_table[TBLS][256]; +local z_crc_t FAR crc_table[256]; +local z_crc_t FAR x2n_table[32]; local void make_crc_table OF((void)); +#ifdef W + local z_word_t FAR crc_big_table[256]; + local z_crc_t FAR crc_braid_table[W][256]; + local z_word_t FAR crc_braid_big_table[W][256]; + local void braid OF((z_crc_t [][256], z_word_t [][256], int, int)); +#endif #ifdef MAKECRCH - local void write_table OF((FILE *, const z_crc_t FAR *)); + local void write_table OF((FILE *, const z_crc_t FAR *, int)); + local void write_table32hi OF((FILE *, const z_word_t FAR *, int)); + local void write_table64 OF((FILE *, const z_word_t FAR *, int)); #endif /* MAKECRCH */ + +/* + Define a once() function depending on the availability of atomics. If this is + compiled with DYNAMIC_CRC_TABLE defined, and if CRCs will be computed in + multiple threads, and if atomics are not available, then get_crc_table() must + be called to initialize the tables and must return before any threads are + allowed to compute or combine CRCs. + */ + +/* Definition of once functionality. */ +typedef struct once_s once_t; +local void once OF((once_t *, void (*)(void))); + +/* Check for the availability of atomics. */ +#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \ + !defined(__STDC_NO_ATOMICS__) + +#include + +/* Structure for once(), which must be initialized with ONCE_INIT. */ +struct once_s { + atomic_flag begun; + atomic_int done; +}; +#define ONCE_INIT {ATOMIC_FLAG_INIT, 0} + +/* + Run the provided init() function exactly once, even if multiple threads + invoke once() at the same time. The state must be a once_t initialized with + ONCE_INIT. + */ +local void once(state, init) + once_t *state; + void (*init)(void); +{ + if (!atomic_load(&state->done)) { + if (atomic_flag_test_and_set(&state->begun)) + while (!atomic_load(&state->done)) + ; + else { + init(); + atomic_store(&state->done, 1); + } + } +} + +#else /* no atomics */ + +/* Structure for once(), which must be initialized with ONCE_INIT. */ +struct once_s { + volatile int begun; + volatile int done; +}; +#define ONCE_INIT {0, 0} + +/* Test and set. Alas, not atomic, but tries to minimize the period of + vulnerability. */ +local int test_and_set OF((int volatile *)); +local int test_and_set(flag) + int volatile *flag; +{ + int was; + + was = *flag; + *flag = 1; + return was; +} + +/* Run the provided init() function once. This is not thread-safe. */ +local void once(state, init) + once_t *state; + void (*init)(void); +{ + if (!state->done) { + if (test_and_set(&state->begun)) + while (!state->done) + ; + else { + init(); + state->done = 1; + } + } +} + +#endif + +/* State for once(). */ +local once_t made = ONCE_INIT; + /* Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials + with the lowest powers in the most significant bit. Then adding polynomials is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the + one. If we call the above polynomial p, and represent a byte as the polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + byte 0xb1 is the polynomial x^7+x^3+x^2+1), then the CRC is (q*x^32) mod p, where a mod b means the remainder after dividing a by b. This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each + taking the remainder. The register is initialized to zero, and for each incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x + (which is shifting right by one and adding x^32 mod p if the bit shifted out + is a one). We start with the highest power (least significant bit) of q and + repeat for all eight bits of q. + + The table is simply the CRC of all possible eight bit values. This is all the + information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. + */ + local void make_crc_table() { - z_crc_t c; - int n, k; - z_crc_t poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static volatile int first = 1; /* flag to limit concurrent making */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* See if another task is already doing this (not thread-safe, but better - than nothing -- significantly reduces duration of vulnerability in - case the advice about DYNAMIC_CRC_TABLE is ignored) */ - if (first) { - first = 0; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0; - for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) - poly |= (z_crc_t)1 << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (z_crc_t)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } + unsigned i, j, n; + z_crc_t p; + + /* initialize the CRC of bytes tables */ + for (i = 0; i < 256; i++) { + p = i; + for (j = 0; j < 8; j++) + p = p & 1 ? (p >> 1) ^ POLY : p >> 1; + crc_table[i] = p; +#ifdef W + crc_big_table[i] = byte_swap(p); +#endif + } -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = ZSWAP32(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = ZSWAP32(c); - } - } -#endif /* BYFOUR */ + /* initialize the x^2^n mod p(x) table */ + p = (z_crc_t)1 << 30; /* x^1 */ + x2n_table[0] = p; + for (n = 1; n < 32; n++) + x2n_table[n] = p = multmodp(p, p); - crc_table_empty = 0; - } - else { /* not first */ - /* wait for the other task to finish (not efficient, but rare) */ - while (crc_table_empty) - ; - } +#ifdef W + /* initialize the braiding tables -- needs x2n_table[] */ + braid(crc_braid_table, crc_braid_big_table, N, W); +#endif #ifdef MAKECRCH - /* write out CRC tables to crc32.h */ { + /* + The crc32.h header file contains tables for both 32-bit and 64-bit + z_word_t's, and so requires a 64-bit type be available. In that case, + z_word_t must be defined to be 64-bits. This code then also generates + and writes out the tables for the case that z_word_t is 32 bits. + */ +#if !defined(W) || W != 8 +# error Need a 64-bit integer type in order to generate crc32.h. +#endif FILE *out; + int k, n; + z_crc_t ltl[8][256]; + z_word_t big[8][256]; out = fopen("crc32.h", "w"); if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const z_crc_t FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); + + /* write out little-endian CRC table to crc32.h */ + fprintf(out, + "/* crc32.h -- tables for rapid CRC calculation\n" + " * Generated automatically by crc32.c\n */\n" + "\n" + "local const z_crc_t FAR crc_table[] = {\n" + " "); + write_table(out, crc_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#ifdef W\n" + "\n" + "#if W == 8\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table64(out, crc_big_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table32hi(out, crc_big_table, 256); + fprintf(out, + "};\n" + "\n" + "#endif\n"); + + /* write out braid tables for each value of N */ + for (n = 1; n <= 6; n++) { + fprintf(out, + "\n" + "#if N == %d\n", n); + + /* compute braid tables for this N and 64-bit word_t */ + braid(ltl, big, n, 8); + + /* write out braid tables for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#if W == 8\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table64(out, big[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n"); + + /* compute braid tables for this N and 32-bit word_t */ + braid(ltl, big, n, 4); + + /* write out braid tables for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table32hi(out, big[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "#endif\n" + "\n" + "#endif\n"); } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); + fprintf(out, + "\n" + "#endif\n"); + + /* write out zeros operator table to crc32.h */ + fprintf(out, + "\n" + "local const z_crc_t FAR x2n_table[] = {\n" + " "); + write_table(out, x2n_table, 32); + fprintf(out, + "};\n"); fclose(out); } #endif /* MAKECRCH */ } #ifdef MAKECRCH -local void write_table(out, table) + +/* + Write the 32-bit values in table[0..k-1] to out, five per line in + hexadecimal separated by commas. + */ +local void write_table(out, table, k) FILE *out; const z_crc_t FAR *table; + int k; { int n; - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", (unsigned long)(table[n]), - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); +} + +/* + Write the high 32-bits of each value in table[0..k-1] to out, five per line + in hexadecimal separated by commas. + */ +local void write_table32hi(out, table, k) +FILE *out; +const z_word_t FAR *table; +int k; +{ + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", + (unsigned long)(table[n] >> 32), + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); } + +/* + Write the 64-bit values in table[0..k-1] to out, three per line in + hexadecimal separated by commas. This assumes that if there is a 64-bit + type, then there is also a long long integer type, and it is at least 64 + bits. If not, then the type cast and format string can be adjusted + accordingly. + */ +local void write_table64(out, table, k) + FILE *out; + const z_word_t FAR *table; + int k; +{ + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%016llx%s", n == 0 || n % 3 ? "" : " ", + (unsigned long long)(table[n]), + n == k - 1 ? "" : (n % 3 == 2 ? ",\n" : ", ")); +} + +/* Actually do the deed. */ +int main() +{ + make_crc_table(); + return 0; +} + #endif /* MAKECRCH */ +#ifdef W +/* + Generate the little and big-endian braid tables for the given n and z_word_t + size w. Each array must have room for w blocks of 256 elements. + */ +local void braid(ltl, big, n, w) + z_crc_t ltl[][256]; + z_word_t big[][256]; + int n; + int w; +{ + int k; + z_crc_t i, p, q; + for (k = 0; k < w; k++) { + p = x2nmodp((n * w + 3 - k) << 3, 0); + ltl[k][0] = 0; + big[w - 1 - k][0] = 0; + for (i = 1; i < 256; i++) { + ltl[k][i] = q = multmodp(i << 24, p); + big[w - 1 - k][i] = byte_swap(q); + } + } +} +#endif + #else /* !DYNAMIC_CRC_TABLE */ /* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + * Tables for byte-wise and braided CRC-32 calculations, and a table of powers + * of x for combining CRC-32s, all made by make_crc_table(). */ #include "crc32.h" #endif /* DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Routines used for CRC calculation. Some are also required for the table + * generation above. + */ + +/* + Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, + reflected. For speed, this requires that a not be zero. + */ +local z_crc_t multmodp(a, b) + z_crc_t a; + z_crc_t b; +{ + z_crc_t m, p; + + m = (z_crc_t)1 << 31; + p = 0; + for (;;) { + if (a & m) { + p ^= b; + if ((a & (m - 1)) == 0) + break; + } + m >>= 1; + b = b & 1 ? (b >> 1) ^ POLY : b >> 1; + } + return p; +} + +/* + Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been + initialized. + */ +local z_crc_t x2nmodp(n, k) + z_off64_t n; + unsigned k; +{ + z_crc_t p; + + p = (z_crc_t)1 << 31; /* x^0 == 1 */ + while (n) { + if (n & 1) + p = multmodp(x2n_table[k & 31], p); + n >>= 1; + k++; + } + return p; +} + /* ========================================================================= - * This function can be used by asm versions of crc32() + * This function can be used by asm versions of crc32(), and to force the + * generation of the CRC tables in a threaded application. */ const z_crc_t FAR * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); + once(&made, make_crc_table); #endif /* DYNAMIC_CRC_TABLE */ return (const z_crc_t FAR *)crc_table; } -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 -#define DO4 DO1; DO1; DO1; DO1 +/* ========================================================================= + * Use ARM machine instructions if available. This will compute the CRC about + * ten times faster than the braided calculation. This code does not check for + * the presence of the CRC instruction at run time. __ARM_FEATURE_CRC32 will + * only be defined if the compilation specifies an ARM processor architecture + * that has the instructions. For example, compiling with -march=armv8.1-a or + * -march=armv8-a+crc, or -march=native if the compile machine has the crc32 + * instructions. + */ +#ifdef ARMCRC32 + +/* + Constants empirically determined to maximize speed. These values are from + measurements on a Cortex-A57. Your mileage may vary. + */ +#define Z_BATCH 3990 /* number of words in a batch */ +#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */ +#define Z_BATCH_MIN 800 /* fewest words in a final batch */ -/* ========================================================================= */ unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; z_size_t len; { - if (buf == Z_NULL) return 0UL; + z_crc_t val; + z_word_t crc1, crc2; + const z_word_t *word; + z_word_t val0, val1, val2; + z_size_t last, last2, i; + z_size_t num; + + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; #ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); + once(&made, make_crc_table); #endif /* DYNAMIC_CRC_TABLE */ -#ifdef BYFOUR - if (sizeof(void *) == sizeof(z_size_t)) { - z_crc_t endian; + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); + /* Compute the CRC up to a word boundary. */ + while (len && ((z_size_t)buf & 7) != 0) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; -#ifdef CRC32_UNROLL_LESS - while (len >= 4) { - DO4; - len -= 4; + /* Prepare to compute the CRC on full 64-bit words word[0..num-1]. */ + word = (z_word_t const *)buf; + num = len >> 3; + len &= 7; + + /* Do three interleaved CRCs to realize the throughput of one crc32x + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ + while (num >= 3 * Z_BATCH) { + crc1 = 0; + crc2 = 0; + for (i = 0; i < Z_BATCH; i++) { + val0 = word[i]; + val1 = word[i + Z_BATCH]; + val2 = word[i + 2 * Z_BATCH]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * Z_BATCH; + num -= 3 * Z_BATCH; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc1; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc2; } -#else - while (len >= 8) { - DO8; - len -= 8; + + /* Do one last smaller batch with the remaining words, if there are enough + to pay for the combination of CRCs. */ + last = num / 3; + if (last >= Z_BATCH_MIN) { + last2 = last << 1; + crc1 = 0; + crc2 = 0; + for (i = 0; i < last; i++) { + val0 = word[i]; + val1 = word[i + last]; + val2 = word[i + last2]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * last; + num -= 3 * last; + val = x2nmodp(last, 6); + crc = multmodp(val, crc) ^ crc1; + crc = multmodp(val, crc) ^ crc2; } -#endif - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} + /* Compute the CRC on any remaining words. */ + for (i = 0; i < num; i++) { + val0 = word[i]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + } + word += num; -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - uInt len; -{ - return crc32_z(crc, buf, len); + /* Complete the CRC on any remaining bytes. */ + buf = (const unsigned char FAR *)word; + while (len) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); + } + + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; } -#ifdef BYFOUR +#else + +#ifdef W /* - This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit - integer pointer type. This violates the strict aliasing rule, where a - compiler can assume, for optimization purposes, that two pointers to - fundamentally different types won't ever point to the same memory. This can - manifest as a problem only if one of the pointers is written to. This code - only reads from those pointers. So long as this code remains isolated in - this compilation unit, there won't be a problem. For this reason, this code - should not be copied and pasted into a compilation unit in which other code - writes to the buffer that is passed to these routines. + Return the CRC of the W bytes in the word_t data, taking the + least-significant byte of the word as the first byte of data, without any pre + or post conditioning. This is used to combine the CRCs of each braid. */ +local z_crc_t crc_word(data) + z_word_t data; +{ + int k; + for (k = 0; k < W; k++) + data = (data >> 8) ^ crc_table[data & 0xff]; + return (z_crc_t)data; +} -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 +local z_word_t crc_word_big(data) + z_word_t data; +{ + int k; + for (k = 0; k < W; k++) + data = (data << 8) ^ + crc_big_table[(data >> ((W - 1) << 3)) & 0xff]; + return data; +} + +#endif /* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) +unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; z_size_t len; { - register z_crc_t c; - register const z_crc_t FAR *buf4; + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; - c = (z_crc_t)crc; - c = ~c; - while (len && ((z_size_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; -#ifndef CRC32_UNROLL_LESS - while (len >= 32) { - DOLIT32; - len -= 32; - } +#ifdef W + + /* If provided enough bytes, do a braided CRC calculation. */ + if (len >= N * W + W - 1) { + z_size_t blks; + z_word_t const *words; + unsigned endian; + int k; + + /* Compute the CRC up to a z_word_t boundary. */ + while (len && ((z_size_t)buf & (W - 1)) != 0) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + } + + /* Compute the CRC on as many N z_word_t blocks as are available. */ + blks = len / (N * W); + len -= blks * N * W; + words = (z_word_t const *)buf; + + /* Do endian check at execution time instead of compile time, since ARM + processors can change the endianess at execution time. If the + compiler knows what the endianess will be, it can optimize out the + check and the unused branch. */ + endian = 1; + if (*(unsigned char *)&endian) { + /* Little endian. */ + + z_crc_t crc0; + z_word_t word0; +#if N > 1 + z_crc_t crc1; + z_word_t word1; +#if N > 2 + z_crc_t crc2; + z_word_t word2; +#if N > 3 + z_crc_t crc3; + z_word_t word3; +#if N > 4 + z_crc_t crc4; + z_word_t word4; +#if N > 5 + z_crc_t crc5; + z_word_t word5; +#endif +#endif +#endif +#endif #endif - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; + /* Initialize the CRC for each braid. */ + crc0 = crc; +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } -/* ========================================================================= */ -#define DOBIG4 c ^= *buf4++; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + crc = crc_word(crc0 ^ words[0]); +#if N > 1 + crc = crc_word(crc1 ^ words[1] ^ crc); +#if N > 2 + crc = crc_word(crc2 ^ words[2] ^ crc); +#if N > 3 + crc = crc_word(crc3 ^ words[3] ^ crc); +#if N > 4 + crc = crc_word(crc4 ^ words[4] ^ crc); +#if N > 5 + crc = crc_word(crc5 ^ words[5] ^ crc); +#endif +#endif +#endif +#endif +#endif + words += N; + } + else { + /* Big endian. */ + + z_word_t crc0, word0, comb; +#if N > 1 + z_word_t crc1, word1; +#if N > 2 + z_word_t crc2, word2; +#if N > 3 + z_word_t crc3, word3; +#if N > 4 + z_word_t crc4, word4; +#if N > 5 + z_word_t crc5, word5; +#endif +#endif +#endif +#endif +#endif -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; + /* Initialize the CRC for each braid. */ + crc0 = byte_swap(crc); +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif - c = ZSWAP32((z_crc_t)crc); - c = ~c; - while (len && ((z_size_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_big_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_big_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_big_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_big_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_big_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_big_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_big_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_big_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_big_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_big_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_big_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_big_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + comb = crc_word_big(crc0 ^ words[0]); +#if N > 1 + comb = crc_word_big(crc1 ^ words[1] ^ comb); +#if N > 2 + comb = crc_word_big(crc2 ^ words[2] ^ comb); +#if N > 3 + comb = crc_word_big(crc3 ^ words[3] ^ comb); +#if N > 4 + comb = crc_word_big(crc4 ^ words[4] ^ comb); +#if N > 5 + comb = crc_word_big(crc5 ^ words[5] ^ comb); +#endif +#endif +#endif +#endif +#endif + words += N; + crc = byte_swap(comb); + } + + /* + Update the pointer to the remaining bytes to process. + */ + buf = (unsigned char const *)words; } - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOBIG32; - len -= 32; +#endif /* W */ + + /* Complete the computation of the CRC on any remaining bytes. */ + while (len >= 8) { + len -= 8; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; } - while (len >= 4) { - DOBIG4; - len -= 4; + while (len) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; } - buf = (const unsigned char FAR *)buf4; - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(ZSWAP32(c)); + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; } -#endif /* BYFOUR */ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ +#endif /* ========================================================================= */ -local unsigned long gf2_matrix_times(mat, vec) - unsigned long *mat; - unsigned long vec; +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; { - unsigned long sum; - - sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; + return crc32_z(crc, buf, len); } /* ========================================================================= */ -local void gf2_matrix_square(square, mat) - unsigned long *square; - unsigned long *mat; +uLong ZEXPORT crc32_combine64(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; { - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff); } /* ========================================================================= */ -local uLong crc32_combine_(crc1, crc2, len2) +uLong ZEXPORT crc32_combine(crc1, crc2, len2) uLong crc1; uLong crc2; - z_off64_t len2; + z_off_t len2; { - int n; - unsigned long row; - unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ - unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ - - /* degenerate case (also disallow negative lengths) */ - if (len2 <= 0) - return crc1; - - /* put operator for one zero bit in odd */ - odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ - row = 1; - for (n = 1; n < GF2_DIM; n++) { - odd[n] = row; - row <<= 1; - } + return crc32_combine64(crc1, crc2, (z_off64_t)len2); +} - /* put operator for two zero bits in even */ - gf2_matrix_square(even, odd); - - /* put operator for four zero bits in odd */ - gf2_matrix_square(odd, even); - - /* apply len2 zeros to crc1 (first square will put the operator for one - zero byte, eight zero bits, in even) */ - do { - /* apply zeros operator for this bit of len2 */ - gf2_matrix_square(even, odd); - if (len2 & 1) - crc1 = gf2_matrix_times(even, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - if (len2 == 0) - break; - - /* another iteration of the loop with odd and even swapped */ - gf2_matrix_square(odd, even); - if (len2 & 1) - crc1 = gf2_matrix_times(odd, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - } while (len2 != 0); - - /* return combined crc */ - crc1 ^= crc2; - return crc1; +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_gen64(len2) + z_off64_t len2; +{ +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return x2nmodp(len2, 3); } /* ========================================================================= */ -uLong ZEXPORT crc32_combine(crc1, crc2, len2) - uLong crc1; - uLong crc2; +uLong ZEXPORT crc32_combine_gen(len2) z_off_t len2; { - return crc32_combine_(crc1, crc2, len2); + return crc32_combine_gen64((z_off64_t)len2); } -uLong ZEXPORT crc32_combine64(crc1, crc2, len2) +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_op(crc1, crc2, op) uLong crc1; uLong crc2; - z_off64_t len2; + uLong op; { - return crc32_combine_(crc1, crc2, len2); + return multmodp(op, crc1) ^ (crc2 & 0xffffffff); } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc32.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc32.h index 9e0c7781025148..137df68d616c5e 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc32.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc32.h @@ -2,440 +2,9445 @@ * Generated automatically by crc32.c */ -local const z_crc_t FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL +local const z_crc_t FAR crc_table[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}; + +#ifdef W + +#if W == 8 + +local const z_word_t FAR crc_big_table[] = { + 0x0000000000000000, 0x9630077700000000, 0x2c610eee00000000, + 0xba51099900000000, 0x19c46d0700000000, 0x8ff46a7000000000, + 0x35a563e900000000, 0xa395649e00000000, 0x3288db0e00000000, + 0xa4b8dc7900000000, 0x1ee9d5e000000000, 0x88d9d29700000000, + 0x2b4cb60900000000, 0xbd7cb17e00000000, 0x072db8e700000000, + 0x911dbf9000000000, 0x6410b71d00000000, 0xf220b06a00000000, + 0x4871b9f300000000, 0xde41be8400000000, 0x7dd4da1a00000000, + 0xebe4dd6d00000000, 0x51b5d4f400000000, 0xc785d38300000000, + 0x56986c1300000000, 0xc0a86b6400000000, 0x7af962fd00000000, + 0xecc9658a00000000, 0x4f5c011400000000, 0xd96c066300000000, + 0x633d0ffa00000000, 0xf50d088d00000000, 0xc8206e3b00000000, + 0x5e10694c00000000, 0xe44160d500000000, 0x727167a200000000, + 0xd1e4033c00000000, 0x47d4044b00000000, 0xfd850dd200000000, + 0x6bb50aa500000000, 0xfaa8b53500000000, 0x6c98b24200000000, + 0xd6c9bbdb00000000, 0x40f9bcac00000000, 0xe36cd83200000000, + 0x755cdf4500000000, 0xcf0dd6dc00000000, 0x593dd1ab00000000, + 0xac30d92600000000, 0x3a00de5100000000, 0x8051d7c800000000, + 0x1661d0bf00000000, 0xb5f4b42100000000, 0x23c4b35600000000, + 0x9995bacf00000000, 0x0fa5bdb800000000, 0x9eb8022800000000, + 0x0888055f00000000, 0xb2d90cc600000000, 0x24e90bb100000000, + 0x877c6f2f00000000, 0x114c685800000000, 0xab1d61c100000000, + 0x3d2d66b600000000, 0x9041dc7600000000, 0x0671db0100000000, + 0xbc20d29800000000, 0x2a10d5ef00000000, 0x8985b17100000000, + 0x1fb5b60600000000, 0xa5e4bf9f00000000, 0x33d4b8e800000000, + 0xa2c9077800000000, 0x34f9000f00000000, 0x8ea8099600000000, + 0x18980ee100000000, 0xbb0d6a7f00000000, 0x2d3d6d0800000000, + 0x976c649100000000, 0x015c63e600000000, 0xf4516b6b00000000, + 0x62616c1c00000000, 0xd830658500000000, 0x4e0062f200000000, + 0xed95066c00000000, 0x7ba5011b00000000, 0xc1f4088200000000, + 0x57c40ff500000000, 0xc6d9b06500000000, 0x50e9b71200000000, + 0xeab8be8b00000000, 0x7c88b9fc00000000, 0xdf1ddd6200000000, + 0x492dda1500000000, 0xf37cd38c00000000, 0x654cd4fb00000000, + 0x5861b24d00000000, 0xce51b53a00000000, 0x7400bca300000000, + 0xe230bbd400000000, 0x41a5df4a00000000, 0xd795d83d00000000, + 0x6dc4d1a400000000, 0xfbf4d6d300000000, 0x6ae9694300000000, + 0xfcd96e3400000000, 0x468867ad00000000, 0xd0b860da00000000, + 0x732d044400000000, 0xe51d033300000000, 0x5f4c0aaa00000000, + 0xc97c0ddd00000000, 0x3c71055000000000, 0xaa41022700000000, + 0x10100bbe00000000, 0x86200cc900000000, 0x25b5685700000000, + 0xb3856f2000000000, 0x09d466b900000000, 0x9fe461ce00000000, + 0x0ef9de5e00000000, 0x98c9d92900000000, 0x2298d0b000000000, + 0xb4a8d7c700000000, 0x173db35900000000, 0x810db42e00000000, + 0x3b5cbdb700000000, 0xad6cbac000000000, 0x2083b8ed00000000, + 0xb6b3bf9a00000000, 0x0ce2b60300000000, 0x9ad2b17400000000, + 0x3947d5ea00000000, 0xaf77d29d00000000, 0x1526db0400000000, + 0x8316dc7300000000, 0x120b63e300000000, 0x843b649400000000, + 0x3e6a6d0d00000000, 0xa85a6a7a00000000, 0x0bcf0ee400000000, + 0x9dff099300000000, 0x27ae000a00000000, 0xb19e077d00000000, + 0x44930ff000000000, 0xd2a3088700000000, 0x68f2011e00000000, + 0xfec2066900000000, 0x5d5762f700000000, 0xcb67658000000000, + 0x71366c1900000000, 0xe7066b6e00000000, 0x761bd4fe00000000, + 0xe02bd38900000000, 0x5a7ada1000000000, 0xcc4add6700000000, + 0x6fdfb9f900000000, 0xf9efbe8e00000000, 0x43beb71700000000, + 0xd58eb06000000000, 0xe8a3d6d600000000, 0x7e93d1a100000000, + 0xc4c2d83800000000, 0x52f2df4f00000000, 0xf167bbd100000000, + 0x6757bca600000000, 0xdd06b53f00000000, 0x4b36b24800000000, + 0xda2b0dd800000000, 0x4c1b0aaf00000000, 0xf64a033600000000, + 0x607a044100000000, 0xc3ef60df00000000, 0x55df67a800000000, + 0xef8e6e3100000000, 0x79be694600000000, 0x8cb361cb00000000, + 0x1a8366bc00000000, 0xa0d26f2500000000, 0x36e2685200000000, + 0x95770ccc00000000, 0x03470bbb00000000, 0xb916022200000000, + 0x2f26055500000000, 0xbe3bbac500000000, 0x280bbdb200000000, + 0x925ab42b00000000, 0x046ab35c00000000, 0xa7ffd7c200000000, + 0x31cfd0b500000000, 0x8b9ed92c00000000, 0x1daede5b00000000, + 0xb0c2649b00000000, 0x26f263ec00000000, 0x9ca36a7500000000, + 0x0a936d0200000000, 0xa906099c00000000, 0x3f360eeb00000000, + 0x8567077200000000, 0x1357000500000000, 0x824abf9500000000, + 0x147ab8e200000000, 0xae2bb17b00000000, 0x381bb60c00000000, + 0x9b8ed29200000000, 0x0dbed5e500000000, 0xb7efdc7c00000000, + 0x21dfdb0b00000000, 0xd4d2d38600000000, 0x42e2d4f100000000, + 0xf8b3dd6800000000, 0x6e83da1f00000000, 0xcd16be8100000000, + 0x5b26b9f600000000, 0xe177b06f00000000, 0x7747b71800000000, + 0xe65a088800000000, 0x706a0fff00000000, 0xca3b066600000000, + 0x5c0b011100000000, 0xff9e658f00000000, 0x69ae62f800000000, + 0xd3ff6b6100000000, 0x45cf6c1600000000, 0x78e20aa000000000, + 0xeed20dd700000000, 0x5483044e00000000, 0xc2b3033900000000, + 0x612667a700000000, 0xf71660d000000000, 0x4d47694900000000, + 0xdb776e3e00000000, 0x4a6ad1ae00000000, 0xdc5ad6d900000000, + 0x660bdf4000000000, 0xf03bd83700000000, 0x53aebca900000000, + 0xc59ebbde00000000, 0x7fcfb24700000000, 0xe9ffb53000000000, + 0x1cf2bdbd00000000, 0x8ac2baca00000000, 0x3093b35300000000, + 0xa6a3b42400000000, 0x0536d0ba00000000, 0x9306d7cd00000000, + 0x2957de5400000000, 0xbf67d92300000000, 0x2e7a66b300000000, + 0xb84a61c400000000, 0x021b685d00000000, 0x942b6f2a00000000, + 0x37be0bb400000000, 0xa18e0cc300000000, 0x1bdf055a00000000, + 0x8def022d00000000}; + +#else /* W == 4 */ + +local const z_word_t FAR crc_big_table[] = { + 0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, + 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, + 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, + 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, + 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, + 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, + 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, + 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, + 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, + 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, + 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, + 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, + 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, + 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, + 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, + 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, + 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, + 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, + 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, + 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, + 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, + 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, + 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, + 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, + 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, + 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, + 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, + 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, + 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, + 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, + 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, + 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, + 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, + 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, + 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, + 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, + 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, + 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, + 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, + 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, + 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, + 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, + 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, + 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, + 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, + 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, + 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, + 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, + 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, + 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, + 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, + 0x8def022d}; + +#endif + +#if N == 1 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xccaa009e, 0x4225077d, 0x8e8f07e3, 0x844a0efa, + 0x48e00e64, 0xc66f0987, 0x0ac50919, 0xd3e51bb5, 0x1f4f1b2b, + 0x91c01cc8, 0x5d6a1c56, 0x57af154f, 0x9b0515d1, 0x158a1232, + 0xd92012ac, 0x7cbb312b, 0xb01131b5, 0x3e9e3656, 0xf23436c8, + 0xf8f13fd1, 0x345b3f4f, 0xbad438ac, 0x767e3832, 0xaf5e2a9e, + 0x63f42a00, 0xed7b2de3, 0x21d12d7d, 0x2b142464, 0xe7be24fa, + 0x69312319, 0xa59b2387, 0xf9766256, 0x35dc62c8, 0xbb53652b, + 0x77f965b5, 0x7d3c6cac, 0xb1966c32, 0x3f196bd1, 0xf3b36b4f, + 0x2a9379e3, 0xe639797d, 0x68b67e9e, 0xa41c7e00, 0xaed97719, + 0x62737787, 0xecfc7064, 0x205670fa, 0x85cd537d, 0x496753e3, + 0xc7e85400, 0x0b42549e, 0x01875d87, 0xcd2d5d19, 0x43a25afa, + 0x8f085a64, 0x562848c8, 0x9a824856, 0x140d4fb5, 0xd8a74f2b, + 0xd2624632, 0x1ec846ac, 0x9047414f, 0x5ced41d1, 0x299dc2ed, + 0xe537c273, 0x6bb8c590, 0xa712c50e, 0xadd7cc17, 0x617dcc89, + 0xeff2cb6a, 0x2358cbf4, 0xfa78d958, 0x36d2d9c6, 0xb85dde25, + 0x74f7debb, 0x7e32d7a2, 0xb298d73c, 0x3c17d0df, 0xf0bdd041, + 0x5526f3c6, 0x998cf358, 0x1703f4bb, 0xdba9f425, 0xd16cfd3c, + 0x1dc6fda2, 0x9349fa41, 0x5fe3fadf, 0x86c3e873, 0x4a69e8ed, + 0xc4e6ef0e, 0x084cef90, 0x0289e689, 0xce23e617, 0x40ace1f4, + 0x8c06e16a, 0xd0eba0bb, 0x1c41a025, 0x92cea7c6, 0x5e64a758, + 0x54a1ae41, 0x980baedf, 0x1684a93c, 0xda2ea9a2, 0x030ebb0e, + 0xcfa4bb90, 0x412bbc73, 0x8d81bced, 0x8744b5f4, 0x4beeb56a, + 0xc561b289, 0x09cbb217, 0xac509190, 0x60fa910e, 0xee7596ed, + 0x22df9673, 0x281a9f6a, 0xe4b09ff4, 0x6a3f9817, 0xa6959889, + 0x7fb58a25, 0xb31f8abb, 0x3d908d58, 0xf13a8dc6, 0xfbff84df, + 0x37558441, 0xb9da83a2, 0x7570833c, 0x533b85da, 0x9f918544, + 0x111e82a7, 0xddb48239, 0xd7718b20, 0x1bdb8bbe, 0x95548c5d, + 0x59fe8cc3, 0x80de9e6f, 0x4c749ef1, 0xc2fb9912, 0x0e51998c, + 0x04949095, 0xc83e900b, 0x46b197e8, 0x8a1b9776, 0x2f80b4f1, + 0xe32ab46f, 0x6da5b38c, 0xa10fb312, 0xabcaba0b, 0x6760ba95, + 0xe9efbd76, 0x2545bde8, 0xfc65af44, 0x30cfafda, 0xbe40a839, + 0x72eaa8a7, 0x782fa1be, 0xb485a120, 0x3a0aa6c3, 0xf6a0a65d, + 0xaa4de78c, 0x66e7e712, 0xe868e0f1, 0x24c2e06f, 0x2e07e976, + 0xe2ade9e8, 0x6c22ee0b, 0xa088ee95, 0x79a8fc39, 0xb502fca7, + 0x3b8dfb44, 0xf727fbda, 0xfde2f2c3, 0x3148f25d, 0xbfc7f5be, + 0x736df520, 0xd6f6d6a7, 0x1a5cd639, 0x94d3d1da, 0x5879d144, + 0x52bcd85d, 0x9e16d8c3, 0x1099df20, 0xdc33dfbe, 0x0513cd12, + 0xc9b9cd8c, 0x4736ca6f, 0x8b9ccaf1, 0x8159c3e8, 0x4df3c376, + 0xc37cc495, 0x0fd6c40b, 0x7aa64737, 0xb60c47a9, 0x3883404a, + 0xf42940d4, 0xfeec49cd, 0x32464953, 0xbcc94eb0, 0x70634e2e, + 0xa9435c82, 0x65e95c1c, 0xeb665bff, 0x27cc5b61, 0x2d095278, + 0xe1a352e6, 0x6f2c5505, 0xa386559b, 0x061d761c, 0xcab77682, + 0x44387161, 0x889271ff, 0x825778e6, 0x4efd7878, 0xc0727f9b, + 0x0cd87f05, 0xd5f86da9, 0x19526d37, 0x97dd6ad4, 0x5b776a4a, + 0x51b26353, 0x9d1863cd, 0x1397642e, 0xdf3d64b0, 0x83d02561, + 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, + 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, + 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd, + 0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, + 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, + 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, + 0x264b06e6}, + {0x00000000, 0xa6770bb4, 0x979f1129, 0x31e81a9d, 0xf44f2413, + 0x52382fa7, 0x63d0353a, 0xc5a73e8e, 0x33ef4e67, 0x959845d3, + 0xa4705f4e, 0x020754fa, 0xc7a06a74, 0x61d761c0, 0x503f7b5d, + 0xf64870e9, 0x67de9cce, 0xc1a9977a, 0xf0418de7, 0x56368653, + 0x9391b8dd, 0x35e6b369, 0x040ea9f4, 0xa279a240, 0x5431d2a9, + 0xf246d91d, 0xc3aec380, 0x65d9c834, 0xa07ef6ba, 0x0609fd0e, + 0x37e1e793, 0x9196ec27, 0xcfbd399c, 0x69ca3228, 0x582228b5, + 0xfe552301, 0x3bf21d8f, 0x9d85163b, 0xac6d0ca6, 0x0a1a0712, + 0xfc5277fb, 0x5a257c4f, 0x6bcd66d2, 0xcdba6d66, 0x081d53e8, + 0xae6a585c, 0x9f8242c1, 0x39f54975, 0xa863a552, 0x0e14aee6, + 0x3ffcb47b, 0x998bbfcf, 0x5c2c8141, 0xfa5b8af5, 0xcbb39068, + 0x6dc49bdc, 0x9b8ceb35, 0x3dfbe081, 0x0c13fa1c, 0xaa64f1a8, + 0x6fc3cf26, 0xc9b4c492, 0xf85cde0f, 0x5e2bd5bb, 0x440b7579, + 0xe27c7ecd, 0xd3946450, 0x75e36fe4, 0xb044516a, 0x16335ade, + 0x27db4043, 0x81ac4bf7, 0x77e43b1e, 0xd19330aa, 0xe07b2a37, + 0x460c2183, 0x83ab1f0d, 0x25dc14b9, 0x14340e24, 0xb2430590, + 0x23d5e9b7, 0x85a2e203, 0xb44af89e, 0x123df32a, 0xd79acda4, + 0x71edc610, 0x4005dc8d, 0xe672d739, 0x103aa7d0, 0xb64dac64, + 0x87a5b6f9, 0x21d2bd4d, 0xe47583c3, 0x42028877, 0x73ea92ea, + 0xd59d995e, 0x8bb64ce5, 0x2dc14751, 0x1c295dcc, 0xba5e5678, + 0x7ff968f6, 0xd98e6342, 0xe86679df, 0x4e11726b, 0xb8590282, + 0x1e2e0936, 0x2fc613ab, 0x89b1181f, 0x4c162691, 0xea612d25, + 0xdb8937b8, 0x7dfe3c0c, 0xec68d02b, 0x4a1fdb9f, 0x7bf7c102, + 0xdd80cab6, 0x1827f438, 0xbe50ff8c, 0x8fb8e511, 0x29cfeea5, + 0xdf879e4c, 0x79f095f8, 0x48188f65, 0xee6f84d1, 0x2bc8ba5f, + 0x8dbfb1eb, 0xbc57ab76, 0x1a20a0c2, 0x8816eaf2, 0x2e61e146, + 0x1f89fbdb, 0xb9fef06f, 0x7c59cee1, 0xda2ec555, 0xebc6dfc8, + 0x4db1d47c, 0xbbf9a495, 0x1d8eaf21, 0x2c66b5bc, 0x8a11be08, + 0x4fb68086, 0xe9c18b32, 0xd82991af, 0x7e5e9a1b, 0xefc8763c, + 0x49bf7d88, 0x78576715, 0xde206ca1, 0x1b87522f, 0xbdf0599b, + 0x8c184306, 0x2a6f48b2, 0xdc27385b, 0x7a5033ef, 0x4bb82972, + 0xedcf22c6, 0x28681c48, 0x8e1f17fc, 0xbff70d61, 0x198006d5, + 0x47abd36e, 0xe1dcd8da, 0xd034c247, 0x7643c9f3, 0xb3e4f77d, + 0x1593fcc9, 0x247be654, 0x820cede0, 0x74449d09, 0xd23396bd, + 0xe3db8c20, 0x45ac8794, 0x800bb91a, 0x267cb2ae, 0x1794a833, + 0xb1e3a387, 0x20754fa0, 0x86024414, 0xb7ea5e89, 0x119d553d, + 0xd43a6bb3, 0x724d6007, 0x43a57a9a, 0xe5d2712e, 0x139a01c7, + 0xb5ed0a73, 0x840510ee, 0x22721b5a, 0xe7d525d4, 0x41a22e60, + 0x704a34fd, 0xd63d3f49, 0xcc1d9f8b, 0x6a6a943f, 0x5b828ea2, + 0xfdf58516, 0x3852bb98, 0x9e25b02c, 0xafcdaab1, 0x09baa105, + 0xfff2d1ec, 0x5985da58, 0x686dc0c5, 0xce1acb71, 0x0bbdf5ff, + 0xadcafe4b, 0x9c22e4d6, 0x3a55ef62, 0xabc30345, 0x0db408f1, + 0x3c5c126c, 0x9a2b19d8, 0x5f8c2756, 0xf9fb2ce2, 0xc813367f, + 0x6e643dcb, 0x982c4d22, 0x3e5b4696, 0x0fb35c0b, 0xa9c457bf, + 0x6c636931, 0xca146285, 0xfbfc7818, 0x5d8b73ac, 0x03a0a617, + 0xa5d7ada3, 0x943fb73e, 0x3248bc8a, 0xf7ef8204, 0x519889b0, + 0x6070932d, 0xc6079899, 0x304fe870, 0x9638e3c4, 0xa7d0f959, + 0x01a7f2ed, 0xc400cc63, 0x6277c7d7, 0x539fdd4a, 0xf5e8d6fe, + 0x647e3ad9, 0xc209316d, 0xf3e12bf0, 0x55962044, 0x90311eca, + 0x3646157e, 0x07ae0fe3, 0xa1d90457, 0x579174be, 0xf1e67f0a, + 0xc00e6597, 0x66796e23, 0xa3de50ad, 0x05a95b19, 0x34414184, + 0x92364a30}, + {0x00000000, 0xcb5cd3a5, 0x4dc8a10b, 0x869472ae, 0x9b914216, + 0x50cd91b3, 0xd659e31d, 0x1d0530b8, 0xec53826d, 0x270f51c8, + 0xa19b2366, 0x6ac7f0c3, 0x77c2c07b, 0xbc9e13de, 0x3a0a6170, + 0xf156b2d5, 0x03d6029b, 0xc88ad13e, 0x4e1ea390, 0x85427035, + 0x9847408d, 0x531b9328, 0xd58fe186, 0x1ed33223, 0xef8580f6, + 0x24d95353, 0xa24d21fd, 0x6911f258, 0x7414c2e0, 0xbf481145, + 0x39dc63eb, 0xf280b04e, 0x07ac0536, 0xccf0d693, 0x4a64a43d, + 0x81387798, 0x9c3d4720, 0x57619485, 0xd1f5e62b, 0x1aa9358e, + 0xebff875b, 0x20a354fe, 0xa6372650, 0x6d6bf5f5, 0x706ec54d, + 0xbb3216e8, 0x3da66446, 0xf6fab7e3, 0x047a07ad, 0xcf26d408, + 0x49b2a6a6, 0x82ee7503, 0x9feb45bb, 0x54b7961e, 0xd223e4b0, + 0x197f3715, 0xe82985c0, 0x23755665, 0xa5e124cb, 0x6ebdf76e, + 0x73b8c7d6, 0xb8e41473, 0x3e7066dd, 0xf52cb578, 0x0f580a6c, + 0xc404d9c9, 0x4290ab67, 0x89cc78c2, 0x94c9487a, 0x5f959bdf, + 0xd901e971, 0x125d3ad4, 0xe30b8801, 0x28575ba4, 0xaec3290a, + 0x659ffaaf, 0x789aca17, 0xb3c619b2, 0x35526b1c, 0xfe0eb8b9, + 0x0c8e08f7, 0xc7d2db52, 0x4146a9fc, 0x8a1a7a59, 0x971f4ae1, + 0x5c439944, 0xdad7ebea, 0x118b384f, 0xe0dd8a9a, 0x2b81593f, + 0xad152b91, 0x6649f834, 0x7b4cc88c, 0xb0101b29, 0x36846987, + 0xfdd8ba22, 0x08f40f5a, 0xc3a8dcff, 0x453cae51, 0x8e607df4, + 0x93654d4c, 0x58399ee9, 0xdeadec47, 0x15f13fe2, 0xe4a78d37, + 0x2ffb5e92, 0xa96f2c3c, 0x6233ff99, 0x7f36cf21, 0xb46a1c84, + 0x32fe6e2a, 0xf9a2bd8f, 0x0b220dc1, 0xc07ede64, 0x46eaacca, + 0x8db67f6f, 0x90b34fd7, 0x5bef9c72, 0xdd7beedc, 0x16273d79, + 0xe7718fac, 0x2c2d5c09, 0xaab92ea7, 0x61e5fd02, 0x7ce0cdba, + 0xb7bc1e1f, 0x31286cb1, 0xfa74bf14, 0x1eb014d8, 0xd5ecc77d, + 0x5378b5d3, 0x98246676, 0x852156ce, 0x4e7d856b, 0xc8e9f7c5, + 0x03b52460, 0xf2e396b5, 0x39bf4510, 0xbf2b37be, 0x7477e41b, + 0x6972d4a3, 0xa22e0706, 0x24ba75a8, 0xefe6a60d, 0x1d661643, + 0xd63ac5e6, 0x50aeb748, 0x9bf264ed, 0x86f75455, 0x4dab87f0, + 0xcb3ff55e, 0x006326fb, 0xf135942e, 0x3a69478b, 0xbcfd3525, + 0x77a1e680, 0x6aa4d638, 0xa1f8059d, 0x276c7733, 0xec30a496, + 0x191c11ee, 0xd240c24b, 0x54d4b0e5, 0x9f886340, 0x828d53f8, + 0x49d1805d, 0xcf45f2f3, 0x04192156, 0xf54f9383, 0x3e134026, + 0xb8873288, 0x73dbe12d, 0x6eded195, 0xa5820230, 0x2316709e, + 0xe84aa33b, 0x1aca1375, 0xd196c0d0, 0x5702b27e, 0x9c5e61db, + 0x815b5163, 0x4a0782c6, 0xcc93f068, 0x07cf23cd, 0xf6999118, + 0x3dc542bd, 0xbb513013, 0x700de3b6, 0x6d08d30e, 0xa65400ab, + 0x20c07205, 0xeb9ca1a0, 0x11e81eb4, 0xdab4cd11, 0x5c20bfbf, + 0x977c6c1a, 0x8a795ca2, 0x41258f07, 0xc7b1fda9, 0x0ced2e0c, + 0xfdbb9cd9, 0x36e74f7c, 0xb0733dd2, 0x7b2fee77, 0x662adecf, + 0xad760d6a, 0x2be27fc4, 0xe0beac61, 0x123e1c2f, 0xd962cf8a, + 0x5ff6bd24, 0x94aa6e81, 0x89af5e39, 0x42f38d9c, 0xc467ff32, + 0x0f3b2c97, 0xfe6d9e42, 0x35314de7, 0xb3a53f49, 0x78f9ecec, + 0x65fcdc54, 0xaea00ff1, 0x28347d5f, 0xe368aefa, 0x16441b82, + 0xdd18c827, 0x5b8cba89, 0x90d0692c, 0x8dd55994, 0x46898a31, + 0xc01df89f, 0x0b412b3a, 0xfa1799ef, 0x314b4a4a, 0xb7df38e4, + 0x7c83eb41, 0x6186dbf9, 0xaada085c, 0x2c4e7af2, 0xe712a957, + 0x15921919, 0xdececabc, 0x585ab812, 0x93066bb7, 0x8e035b0f, + 0x455f88aa, 0xc3cbfa04, 0x089729a1, 0xf9c19b74, 0x329d48d1, + 0xb4093a7f, 0x7f55e9da, 0x6250d962, 0xa90c0ac7, 0x2f987869, + 0xe4c4abcc}, + {0x00000000, 0x3d6029b0, 0x7ac05360, 0x47a07ad0, 0xf580a6c0, + 0xc8e08f70, 0x8f40f5a0, 0xb220dc10, 0x30704bc1, 0x0d106271, + 0x4ab018a1, 0x77d03111, 0xc5f0ed01, 0xf890c4b1, 0xbf30be61, + 0x825097d1, 0x60e09782, 0x5d80be32, 0x1a20c4e2, 0x2740ed52, + 0x95603142, 0xa80018f2, 0xefa06222, 0xd2c04b92, 0x5090dc43, + 0x6df0f5f3, 0x2a508f23, 0x1730a693, 0xa5107a83, 0x98705333, + 0xdfd029e3, 0xe2b00053, 0xc1c12f04, 0xfca106b4, 0xbb017c64, + 0x866155d4, 0x344189c4, 0x0921a074, 0x4e81daa4, 0x73e1f314, + 0xf1b164c5, 0xccd14d75, 0x8b7137a5, 0xb6111e15, 0x0431c205, + 0x3951ebb5, 0x7ef19165, 0x4391b8d5, 0xa121b886, 0x9c419136, + 0xdbe1ebe6, 0xe681c256, 0x54a11e46, 0x69c137f6, 0x2e614d26, + 0x13016496, 0x9151f347, 0xac31daf7, 0xeb91a027, 0xd6f18997, + 0x64d15587, 0x59b17c37, 0x1e1106e7, 0x23712f57, 0x58f35849, + 0x659371f9, 0x22330b29, 0x1f532299, 0xad73fe89, 0x9013d739, + 0xd7b3ade9, 0xead38459, 0x68831388, 0x55e33a38, 0x124340e8, + 0x2f236958, 0x9d03b548, 0xa0639cf8, 0xe7c3e628, 0xdaa3cf98, + 0x3813cfcb, 0x0573e67b, 0x42d39cab, 0x7fb3b51b, 0xcd93690b, + 0xf0f340bb, 0xb7533a6b, 0x8a3313db, 0x0863840a, 0x3503adba, + 0x72a3d76a, 0x4fc3feda, 0xfde322ca, 0xc0830b7a, 0x872371aa, + 0xba43581a, 0x9932774d, 0xa4525efd, 0xe3f2242d, 0xde920d9d, + 0x6cb2d18d, 0x51d2f83d, 0x167282ed, 0x2b12ab5d, 0xa9423c8c, + 0x9422153c, 0xd3826fec, 0xeee2465c, 0x5cc29a4c, 0x61a2b3fc, + 0x2602c92c, 0x1b62e09c, 0xf9d2e0cf, 0xc4b2c97f, 0x8312b3af, + 0xbe729a1f, 0x0c52460f, 0x31326fbf, 0x7692156f, 0x4bf23cdf, + 0xc9a2ab0e, 0xf4c282be, 0xb362f86e, 0x8e02d1de, 0x3c220dce, + 0x0142247e, 0x46e25eae, 0x7b82771e, 0xb1e6b092, 0x8c869922, + 0xcb26e3f2, 0xf646ca42, 0x44661652, 0x79063fe2, 0x3ea64532, + 0x03c66c82, 0x8196fb53, 0xbcf6d2e3, 0xfb56a833, 0xc6368183, + 0x74165d93, 0x49767423, 0x0ed60ef3, 0x33b62743, 0xd1062710, + 0xec660ea0, 0xabc67470, 0x96a65dc0, 0x248681d0, 0x19e6a860, + 0x5e46d2b0, 0x6326fb00, 0xe1766cd1, 0xdc164561, 0x9bb63fb1, + 0xa6d61601, 0x14f6ca11, 0x2996e3a1, 0x6e369971, 0x5356b0c1, + 0x70279f96, 0x4d47b626, 0x0ae7ccf6, 0x3787e546, 0x85a73956, + 0xb8c710e6, 0xff676a36, 0xc2074386, 0x4057d457, 0x7d37fde7, + 0x3a978737, 0x07f7ae87, 0xb5d77297, 0x88b75b27, 0xcf1721f7, + 0xf2770847, 0x10c70814, 0x2da721a4, 0x6a075b74, 0x576772c4, + 0xe547aed4, 0xd8278764, 0x9f87fdb4, 0xa2e7d404, 0x20b743d5, + 0x1dd76a65, 0x5a7710b5, 0x67173905, 0xd537e515, 0xe857cca5, + 0xaff7b675, 0x92979fc5, 0xe915e8db, 0xd475c16b, 0x93d5bbbb, + 0xaeb5920b, 0x1c954e1b, 0x21f567ab, 0x66551d7b, 0x5b3534cb, + 0xd965a31a, 0xe4058aaa, 0xa3a5f07a, 0x9ec5d9ca, 0x2ce505da, + 0x11852c6a, 0x562556ba, 0x6b457f0a, 0x89f57f59, 0xb49556e9, + 0xf3352c39, 0xce550589, 0x7c75d999, 0x4115f029, 0x06b58af9, + 0x3bd5a349, 0xb9853498, 0x84e51d28, 0xc34567f8, 0xfe254e48, + 0x4c059258, 0x7165bbe8, 0x36c5c138, 0x0ba5e888, 0x28d4c7df, + 0x15b4ee6f, 0x521494bf, 0x6f74bd0f, 0xdd54611f, 0xe03448af, + 0xa794327f, 0x9af41bcf, 0x18a48c1e, 0x25c4a5ae, 0x6264df7e, + 0x5f04f6ce, 0xed242ade, 0xd044036e, 0x97e479be, 0xaa84500e, + 0x4834505d, 0x755479ed, 0x32f4033d, 0x0f942a8d, 0xbdb4f69d, + 0x80d4df2d, 0xc774a5fd, 0xfa148c4d, 0x78441b9c, 0x4524322c, + 0x028448fc, 0x3fe4614c, 0x8dc4bd5c, 0xb0a494ec, 0xf704ee3c, + 0xca64c78c}, + {0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, + 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, + 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, + 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, + 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, + 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, + 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, + 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, + 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, + 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, + 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, + 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, + 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, + 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, + 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, + 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, + 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, + 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, + 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, + 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, + 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, + 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, + 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, + 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, + 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, + 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, + 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, + 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, + 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, + 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, + 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, + 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, + 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, + 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, + 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, + 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, + 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, + 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, + 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, + 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, + 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, + 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, + 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, + 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, + 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, + 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, + 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, + 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, + 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, + 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, + 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, + 0xde0506f1}, + {0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, + 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, + 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, + 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, + 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, + 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, + 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, + 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, + 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, + 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, + 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, + 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, + 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, + 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, + 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, + 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, + 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, + 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, + 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, + 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, + 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, + 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, + 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, + 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, + 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, + 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, + 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, + 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, + 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, + 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, + 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, + 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, + 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, + 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, + 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, + 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, + 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, + 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, + 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, + 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, + 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, + 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, + 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, + 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, + 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, + 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, + 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, + 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, + 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, + 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, + 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, + 0xbe9834ed}, + {0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, + 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, + 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, + 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, + 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, + 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, + 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, + 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, + 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, + 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, + 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, + 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, + 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, + 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, + 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, + 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, + 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, + 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, + 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, + 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, + 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, + 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, + 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, + 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, + 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, + 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, + 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, + 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, + 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, + 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, + 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, + 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, + 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, + 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, + 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, + 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, + 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, + 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, + 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, + 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, + 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, + 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, + 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, + 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, + 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, + 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, + 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, + 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, + 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, + 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, + 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, + 0x9324fd72}, + {0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x9630077700000000, 0x2c610eee00000000, + 0xba51099900000000, 0x19c46d0700000000, 0x8ff46a7000000000, + 0x35a563e900000000, 0xa395649e00000000, 0x3288db0e00000000, + 0xa4b8dc7900000000, 0x1ee9d5e000000000, 0x88d9d29700000000, + 0x2b4cb60900000000, 0xbd7cb17e00000000, 0x072db8e700000000, + 0x911dbf9000000000, 0x6410b71d00000000, 0xf220b06a00000000, + 0x4871b9f300000000, 0xde41be8400000000, 0x7dd4da1a00000000, + 0xebe4dd6d00000000, 0x51b5d4f400000000, 0xc785d38300000000, + 0x56986c1300000000, 0xc0a86b6400000000, 0x7af962fd00000000, + 0xecc9658a00000000, 0x4f5c011400000000, 0xd96c066300000000, + 0x633d0ffa00000000, 0xf50d088d00000000, 0xc8206e3b00000000, + 0x5e10694c00000000, 0xe44160d500000000, 0x727167a200000000, + 0xd1e4033c00000000, 0x47d4044b00000000, 0xfd850dd200000000, + 0x6bb50aa500000000, 0xfaa8b53500000000, 0x6c98b24200000000, + 0xd6c9bbdb00000000, 0x40f9bcac00000000, 0xe36cd83200000000, + 0x755cdf4500000000, 0xcf0dd6dc00000000, 0x593dd1ab00000000, + 0xac30d92600000000, 0x3a00de5100000000, 0x8051d7c800000000, + 0x1661d0bf00000000, 0xb5f4b42100000000, 0x23c4b35600000000, + 0x9995bacf00000000, 0x0fa5bdb800000000, 0x9eb8022800000000, + 0x0888055f00000000, 0xb2d90cc600000000, 0x24e90bb100000000, + 0x877c6f2f00000000, 0x114c685800000000, 0xab1d61c100000000, + 0x3d2d66b600000000, 0x9041dc7600000000, 0x0671db0100000000, + 0xbc20d29800000000, 0x2a10d5ef00000000, 0x8985b17100000000, + 0x1fb5b60600000000, 0xa5e4bf9f00000000, 0x33d4b8e800000000, + 0xa2c9077800000000, 0x34f9000f00000000, 0x8ea8099600000000, + 0x18980ee100000000, 0xbb0d6a7f00000000, 0x2d3d6d0800000000, + 0x976c649100000000, 0x015c63e600000000, 0xf4516b6b00000000, + 0x62616c1c00000000, 0xd830658500000000, 0x4e0062f200000000, + 0xed95066c00000000, 0x7ba5011b00000000, 0xc1f4088200000000, + 0x57c40ff500000000, 0xc6d9b06500000000, 0x50e9b71200000000, + 0xeab8be8b00000000, 0x7c88b9fc00000000, 0xdf1ddd6200000000, + 0x492dda1500000000, 0xf37cd38c00000000, 0x654cd4fb00000000, + 0x5861b24d00000000, 0xce51b53a00000000, 0x7400bca300000000, + 0xe230bbd400000000, 0x41a5df4a00000000, 0xd795d83d00000000, + 0x6dc4d1a400000000, 0xfbf4d6d300000000, 0x6ae9694300000000, + 0xfcd96e3400000000, 0x468867ad00000000, 0xd0b860da00000000, + 0x732d044400000000, 0xe51d033300000000, 0x5f4c0aaa00000000, + 0xc97c0ddd00000000, 0x3c71055000000000, 0xaa41022700000000, + 0x10100bbe00000000, 0x86200cc900000000, 0x25b5685700000000, + 0xb3856f2000000000, 0x09d466b900000000, 0x9fe461ce00000000, + 0x0ef9de5e00000000, 0x98c9d92900000000, 0x2298d0b000000000, + 0xb4a8d7c700000000, 0x173db35900000000, 0x810db42e00000000, + 0x3b5cbdb700000000, 0xad6cbac000000000, 0x2083b8ed00000000, + 0xb6b3bf9a00000000, 0x0ce2b60300000000, 0x9ad2b17400000000, + 0x3947d5ea00000000, 0xaf77d29d00000000, 0x1526db0400000000, + 0x8316dc7300000000, 0x120b63e300000000, 0x843b649400000000, + 0x3e6a6d0d00000000, 0xa85a6a7a00000000, 0x0bcf0ee400000000, + 0x9dff099300000000, 0x27ae000a00000000, 0xb19e077d00000000, + 0x44930ff000000000, 0xd2a3088700000000, 0x68f2011e00000000, + 0xfec2066900000000, 0x5d5762f700000000, 0xcb67658000000000, + 0x71366c1900000000, 0xe7066b6e00000000, 0x761bd4fe00000000, + 0xe02bd38900000000, 0x5a7ada1000000000, 0xcc4add6700000000, + 0x6fdfb9f900000000, 0xf9efbe8e00000000, 0x43beb71700000000, + 0xd58eb06000000000, 0xe8a3d6d600000000, 0x7e93d1a100000000, + 0xc4c2d83800000000, 0x52f2df4f00000000, 0xf167bbd100000000, + 0x6757bca600000000, 0xdd06b53f00000000, 0x4b36b24800000000, + 0xda2b0dd800000000, 0x4c1b0aaf00000000, 0xf64a033600000000, + 0x607a044100000000, 0xc3ef60df00000000, 0x55df67a800000000, + 0xef8e6e3100000000, 0x79be694600000000, 0x8cb361cb00000000, + 0x1a8366bc00000000, 0xa0d26f2500000000, 0x36e2685200000000, + 0x95770ccc00000000, 0x03470bbb00000000, 0xb916022200000000, + 0x2f26055500000000, 0xbe3bbac500000000, 0x280bbdb200000000, + 0x925ab42b00000000, 0x046ab35c00000000, 0xa7ffd7c200000000, + 0x31cfd0b500000000, 0x8b9ed92c00000000, 0x1daede5b00000000, + 0xb0c2649b00000000, 0x26f263ec00000000, 0x9ca36a7500000000, + 0x0a936d0200000000, 0xa906099c00000000, 0x3f360eeb00000000, + 0x8567077200000000, 0x1357000500000000, 0x824abf9500000000, + 0x147ab8e200000000, 0xae2bb17b00000000, 0x381bb60c00000000, + 0x9b8ed29200000000, 0x0dbed5e500000000, 0xb7efdc7c00000000, + 0x21dfdb0b00000000, 0xd4d2d38600000000, 0x42e2d4f100000000, + 0xf8b3dd6800000000, 0x6e83da1f00000000, 0xcd16be8100000000, + 0x5b26b9f600000000, 0xe177b06f00000000, 0x7747b71800000000, + 0xe65a088800000000, 0x706a0fff00000000, 0xca3b066600000000, + 0x5c0b011100000000, 0xff9e658f00000000, 0x69ae62f800000000, + 0xd3ff6b6100000000, 0x45cf6c1600000000, 0x78e20aa000000000, + 0xeed20dd700000000, 0x5483044e00000000, 0xc2b3033900000000, + 0x612667a700000000, 0xf71660d000000000, 0x4d47694900000000, + 0xdb776e3e00000000, 0x4a6ad1ae00000000, 0xdc5ad6d900000000, + 0x660bdf4000000000, 0xf03bd83700000000, 0x53aebca900000000, + 0xc59ebbde00000000, 0x7fcfb24700000000, 0xe9ffb53000000000, + 0x1cf2bdbd00000000, 0x8ac2baca00000000, 0x3093b35300000000, + 0xa6a3b42400000000, 0x0536d0ba00000000, 0x9306d7cd00000000, + 0x2957de5400000000, 0xbf67d92300000000, 0x2e7a66b300000000, + 0xb84a61c400000000, 0x021b685d00000000, 0x942b6f2a00000000, + 0x37be0bb400000000, 0xa18e0cc300000000, 0x1bdf055a00000000, + 0x8def022d00000000}, + {0x0000000000000000, 0x41311b1900000000, 0x8262363200000000, + 0xc3532d2b00000000, 0x04c56c6400000000, 0x45f4777d00000000, + 0x86a75a5600000000, 0xc796414f00000000, 0x088ad9c800000000, + 0x49bbc2d100000000, 0x8ae8effa00000000, 0xcbd9f4e300000000, + 0x0c4fb5ac00000000, 0x4d7eaeb500000000, 0x8e2d839e00000000, + 0xcf1c988700000000, 0x5112c24a00000000, 0x1023d95300000000, + 0xd370f47800000000, 0x9241ef6100000000, 0x55d7ae2e00000000, + 0x14e6b53700000000, 0xd7b5981c00000000, 0x9684830500000000, + 0x59981b8200000000, 0x18a9009b00000000, 0xdbfa2db000000000, + 0x9acb36a900000000, 0x5d5d77e600000000, 0x1c6c6cff00000000, + 0xdf3f41d400000000, 0x9e0e5acd00000000, 0xa224849500000000, + 0xe3159f8c00000000, 0x2046b2a700000000, 0x6177a9be00000000, + 0xa6e1e8f100000000, 0xe7d0f3e800000000, 0x2483dec300000000, + 0x65b2c5da00000000, 0xaaae5d5d00000000, 0xeb9f464400000000, + 0x28cc6b6f00000000, 0x69fd707600000000, 0xae6b313900000000, + 0xef5a2a2000000000, 0x2c09070b00000000, 0x6d381c1200000000, + 0xf33646df00000000, 0xb2075dc600000000, 0x715470ed00000000, + 0x30656bf400000000, 0xf7f32abb00000000, 0xb6c231a200000000, + 0x75911c8900000000, 0x34a0079000000000, 0xfbbc9f1700000000, + 0xba8d840e00000000, 0x79dea92500000000, 0x38efb23c00000000, + 0xff79f37300000000, 0xbe48e86a00000000, 0x7d1bc54100000000, + 0x3c2ade5800000000, 0x054f79f000000000, 0x447e62e900000000, + 0x872d4fc200000000, 0xc61c54db00000000, 0x018a159400000000, + 0x40bb0e8d00000000, 0x83e823a600000000, 0xc2d938bf00000000, + 0x0dc5a03800000000, 0x4cf4bb2100000000, 0x8fa7960a00000000, + 0xce968d1300000000, 0x0900cc5c00000000, 0x4831d74500000000, + 0x8b62fa6e00000000, 0xca53e17700000000, 0x545dbbba00000000, + 0x156ca0a300000000, 0xd63f8d8800000000, 0x970e969100000000, + 0x5098d7de00000000, 0x11a9ccc700000000, 0xd2fae1ec00000000, + 0x93cbfaf500000000, 0x5cd7627200000000, 0x1de6796b00000000, + 0xdeb5544000000000, 0x9f844f5900000000, 0x58120e1600000000, + 0x1923150f00000000, 0xda70382400000000, 0x9b41233d00000000, + 0xa76bfd6500000000, 0xe65ae67c00000000, 0x2509cb5700000000, + 0x6438d04e00000000, 0xa3ae910100000000, 0xe29f8a1800000000, + 0x21cca73300000000, 0x60fdbc2a00000000, 0xafe124ad00000000, + 0xeed03fb400000000, 0x2d83129f00000000, 0x6cb2098600000000, + 0xab2448c900000000, 0xea1553d000000000, 0x29467efb00000000, + 0x687765e200000000, 0xf6793f2f00000000, 0xb748243600000000, + 0x741b091d00000000, 0x352a120400000000, 0xf2bc534b00000000, + 0xb38d485200000000, 0x70de657900000000, 0x31ef7e6000000000, + 0xfef3e6e700000000, 0xbfc2fdfe00000000, 0x7c91d0d500000000, + 0x3da0cbcc00000000, 0xfa368a8300000000, 0xbb07919a00000000, + 0x7854bcb100000000, 0x3965a7a800000000, 0x4b98833b00000000, + 0x0aa9982200000000, 0xc9fab50900000000, 0x88cbae1000000000, + 0x4f5def5f00000000, 0x0e6cf44600000000, 0xcd3fd96d00000000, + 0x8c0ec27400000000, 0x43125af300000000, 0x022341ea00000000, + 0xc1706cc100000000, 0x804177d800000000, 0x47d7369700000000, + 0x06e62d8e00000000, 0xc5b500a500000000, 0x84841bbc00000000, + 0x1a8a417100000000, 0x5bbb5a6800000000, 0x98e8774300000000, + 0xd9d96c5a00000000, 0x1e4f2d1500000000, 0x5f7e360c00000000, + 0x9c2d1b2700000000, 0xdd1c003e00000000, 0x120098b900000000, + 0x533183a000000000, 0x9062ae8b00000000, 0xd153b59200000000, + 0x16c5f4dd00000000, 0x57f4efc400000000, 0x94a7c2ef00000000, + 0xd596d9f600000000, 0xe9bc07ae00000000, 0xa88d1cb700000000, + 0x6bde319c00000000, 0x2aef2a8500000000, 0xed796bca00000000, + 0xac4870d300000000, 0x6f1b5df800000000, 0x2e2a46e100000000, + 0xe136de6600000000, 0xa007c57f00000000, 0x6354e85400000000, + 0x2265f34d00000000, 0xe5f3b20200000000, 0xa4c2a91b00000000, + 0x6791843000000000, 0x26a09f2900000000, 0xb8aec5e400000000, + 0xf99fdefd00000000, 0x3accf3d600000000, 0x7bfde8cf00000000, + 0xbc6ba98000000000, 0xfd5ab29900000000, 0x3e099fb200000000, + 0x7f3884ab00000000, 0xb0241c2c00000000, 0xf115073500000000, + 0x32462a1e00000000, 0x7377310700000000, 0xb4e1704800000000, + 0xf5d06b5100000000, 0x3683467a00000000, 0x77b25d6300000000, + 0x4ed7facb00000000, 0x0fe6e1d200000000, 0xccb5ccf900000000, + 0x8d84d7e000000000, 0x4a1296af00000000, 0x0b238db600000000, + 0xc870a09d00000000, 0x8941bb8400000000, 0x465d230300000000, + 0x076c381a00000000, 0xc43f153100000000, 0x850e0e2800000000, + 0x42984f6700000000, 0x03a9547e00000000, 0xc0fa795500000000, + 0x81cb624c00000000, 0x1fc5388100000000, 0x5ef4239800000000, + 0x9da70eb300000000, 0xdc9615aa00000000, 0x1b0054e500000000, + 0x5a314ffc00000000, 0x996262d700000000, 0xd85379ce00000000, + 0x174fe14900000000, 0x567efa5000000000, 0x952dd77b00000000, + 0xd41ccc6200000000, 0x138a8d2d00000000, 0x52bb963400000000, + 0x91e8bb1f00000000, 0xd0d9a00600000000, 0xecf37e5e00000000, + 0xadc2654700000000, 0x6e91486c00000000, 0x2fa0537500000000, + 0xe836123a00000000, 0xa907092300000000, 0x6a54240800000000, + 0x2b653f1100000000, 0xe479a79600000000, 0xa548bc8f00000000, + 0x661b91a400000000, 0x272a8abd00000000, 0xe0bccbf200000000, + 0xa18dd0eb00000000, 0x62defdc000000000, 0x23efe6d900000000, + 0xbde1bc1400000000, 0xfcd0a70d00000000, 0x3f838a2600000000, + 0x7eb2913f00000000, 0xb924d07000000000, 0xf815cb6900000000, + 0x3b46e64200000000, 0x7a77fd5b00000000, 0xb56b65dc00000000, + 0xf45a7ec500000000, 0x370953ee00000000, 0x763848f700000000, + 0xb1ae09b800000000, 0xf09f12a100000000, 0x33cc3f8a00000000, + 0x72fd249300000000}, + {0x0000000000000000, 0x376ac20100000000, 0x6ed4840300000000, + 0x59be460200000000, 0xdca8090700000000, 0xebc2cb0600000000, + 0xb27c8d0400000000, 0x85164f0500000000, 0xb851130e00000000, + 0x8f3bd10f00000000, 0xd685970d00000000, 0xe1ef550c00000000, + 0x64f91a0900000000, 0x5393d80800000000, 0x0a2d9e0a00000000, + 0x3d475c0b00000000, 0x70a3261c00000000, 0x47c9e41d00000000, + 0x1e77a21f00000000, 0x291d601e00000000, 0xac0b2f1b00000000, + 0x9b61ed1a00000000, 0xc2dfab1800000000, 0xf5b5691900000000, + 0xc8f2351200000000, 0xff98f71300000000, 0xa626b11100000000, + 0x914c731000000000, 0x145a3c1500000000, 0x2330fe1400000000, + 0x7a8eb81600000000, 0x4de47a1700000000, 0xe0464d3800000000, + 0xd72c8f3900000000, 0x8e92c93b00000000, 0xb9f80b3a00000000, + 0x3cee443f00000000, 0x0b84863e00000000, 0x523ac03c00000000, + 0x6550023d00000000, 0x58175e3600000000, 0x6f7d9c3700000000, + 0x36c3da3500000000, 0x01a9183400000000, 0x84bf573100000000, + 0xb3d5953000000000, 0xea6bd33200000000, 0xdd01113300000000, + 0x90e56b2400000000, 0xa78fa92500000000, 0xfe31ef2700000000, + 0xc95b2d2600000000, 0x4c4d622300000000, 0x7b27a02200000000, + 0x2299e62000000000, 0x15f3242100000000, 0x28b4782a00000000, + 0x1fdeba2b00000000, 0x4660fc2900000000, 0x710a3e2800000000, + 0xf41c712d00000000, 0xc376b32c00000000, 0x9ac8f52e00000000, + 0xada2372f00000000, 0xc08d9a7000000000, 0xf7e7587100000000, + 0xae591e7300000000, 0x9933dc7200000000, 0x1c25937700000000, + 0x2b4f517600000000, 0x72f1177400000000, 0x459bd57500000000, + 0x78dc897e00000000, 0x4fb64b7f00000000, 0x16080d7d00000000, + 0x2162cf7c00000000, 0xa474807900000000, 0x931e427800000000, + 0xcaa0047a00000000, 0xfdcac67b00000000, 0xb02ebc6c00000000, + 0x87447e6d00000000, 0xdefa386f00000000, 0xe990fa6e00000000, + 0x6c86b56b00000000, 0x5bec776a00000000, 0x0252316800000000, + 0x3538f36900000000, 0x087faf6200000000, 0x3f156d6300000000, + 0x66ab2b6100000000, 0x51c1e96000000000, 0xd4d7a66500000000, + 0xe3bd646400000000, 0xba03226600000000, 0x8d69e06700000000, + 0x20cbd74800000000, 0x17a1154900000000, 0x4e1f534b00000000, + 0x7975914a00000000, 0xfc63de4f00000000, 0xcb091c4e00000000, + 0x92b75a4c00000000, 0xa5dd984d00000000, 0x989ac44600000000, + 0xaff0064700000000, 0xf64e404500000000, 0xc124824400000000, + 0x4432cd4100000000, 0x73580f4000000000, 0x2ae6494200000000, + 0x1d8c8b4300000000, 0x5068f15400000000, 0x6702335500000000, + 0x3ebc755700000000, 0x09d6b75600000000, 0x8cc0f85300000000, + 0xbbaa3a5200000000, 0xe2147c5000000000, 0xd57ebe5100000000, + 0xe839e25a00000000, 0xdf53205b00000000, 0x86ed665900000000, + 0xb187a45800000000, 0x3491eb5d00000000, 0x03fb295c00000000, + 0x5a456f5e00000000, 0x6d2fad5f00000000, 0x801b35e100000000, + 0xb771f7e000000000, 0xeecfb1e200000000, 0xd9a573e300000000, + 0x5cb33ce600000000, 0x6bd9fee700000000, 0x3267b8e500000000, + 0x050d7ae400000000, 0x384a26ef00000000, 0x0f20e4ee00000000, + 0x569ea2ec00000000, 0x61f460ed00000000, 0xe4e22fe800000000, + 0xd388ede900000000, 0x8a36abeb00000000, 0xbd5c69ea00000000, + 0xf0b813fd00000000, 0xc7d2d1fc00000000, 0x9e6c97fe00000000, + 0xa90655ff00000000, 0x2c101afa00000000, 0x1b7ad8fb00000000, + 0x42c49ef900000000, 0x75ae5cf800000000, 0x48e900f300000000, + 0x7f83c2f200000000, 0x263d84f000000000, 0x115746f100000000, + 0x944109f400000000, 0xa32bcbf500000000, 0xfa958df700000000, + 0xcdff4ff600000000, 0x605d78d900000000, 0x5737bad800000000, + 0x0e89fcda00000000, 0x39e33edb00000000, 0xbcf571de00000000, + 0x8b9fb3df00000000, 0xd221f5dd00000000, 0xe54b37dc00000000, + 0xd80c6bd700000000, 0xef66a9d600000000, 0xb6d8efd400000000, + 0x81b22dd500000000, 0x04a462d000000000, 0x33cea0d100000000, + 0x6a70e6d300000000, 0x5d1a24d200000000, 0x10fe5ec500000000, + 0x27949cc400000000, 0x7e2adac600000000, 0x494018c700000000, + 0xcc5657c200000000, 0xfb3c95c300000000, 0xa282d3c100000000, + 0x95e811c000000000, 0xa8af4dcb00000000, 0x9fc58fca00000000, + 0xc67bc9c800000000, 0xf1110bc900000000, 0x740744cc00000000, + 0x436d86cd00000000, 0x1ad3c0cf00000000, 0x2db902ce00000000, + 0x4096af9100000000, 0x77fc6d9000000000, 0x2e422b9200000000, + 0x1928e99300000000, 0x9c3ea69600000000, 0xab54649700000000, + 0xf2ea229500000000, 0xc580e09400000000, 0xf8c7bc9f00000000, + 0xcfad7e9e00000000, 0x9613389c00000000, 0xa179fa9d00000000, + 0x246fb59800000000, 0x1305779900000000, 0x4abb319b00000000, + 0x7dd1f39a00000000, 0x3035898d00000000, 0x075f4b8c00000000, + 0x5ee10d8e00000000, 0x698bcf8f00000000, 0xec9d808a00000000, + 0xdbf7428b00000000, 0x8249048900000000, 0xb523c68800000000, + 0x88649a8300000000, 0xbf0e588200000000, 0xe6b01e8000000000, + 0xd1dadc8100000000, 0x54cc938400000000, 0x63a6518500000000, + 0x3a18178700000000, 0x0d72d58600000000, 0xa0d0e2a900000000, + 0x97ba20a800000000, 0xce0466aa00000000, 0xf96ea4ab00000000, + 0x7c78ebae00000000, 0x4b1229af00000000, 0x12ac6fad00000000, + 0x25c6adac00000000, 0x1881f1a700000000, 0x2feb33a600000000, + 0x765575a400000000, 0x413fb7a500000000, 0xc429f8a000000000, + 0xf3433aa100000000, 0xaafd7ca300000000, 0x9d97bea200000000, + 0xd073c4b500000000, 0xe71906b400000000, 0xbea740b600000000, + 0x89cd82b700000000, 0x0cdbcdb200000000, 0x3bb10fb300000000, + 0x620f49b100000000, 0x55658bb000000000, 0x6822d7bb00000000, + 0x5f4815ba00000000, 0x06f653b800000000, 0x319c91b900000000, + 0xb48adebc00000000, 0x83e01cbd00000000, 0xda5e5abf00000000, + 0xed3498be00000000}, + {0x0000000000000000, 0x6567bcb800000000, 0x8bc809aa00000000, + 0xeeafb51200000000, 0x5797628f00000000, 0x32f0de3700000000, + 0xdc5f6b2500000000, 0xb938d79d00000000, 0xef28b4c500000000, + 0x8a4f087d00000000, 0x64e0bd6f00000000, 0x018701d700000000, + 0xb8bfd64a00000000, 0xddd86af200000000, 0x3377dfe000000000, + 0x5610635800000000, 0x9f57195000000000, 0xfa30a5e800000000, + 0x149f10fa00000000, 0x71f8ac4200000000, 0xc8c07bdf00000000, + 0xada7c76700000000, 0x4308727500000000, 0x266fcecd00000000, + 0x707fad9500000000, 0x1518112d00000000, 0xfbb7a43f00000000, + 0x9ed0188700000000, 0x27e8cf1a00000000, 0x428f73a200000000, + 0xac20c6b000000000, 0xc9477a0800000000, 0x3eaf32a000000000, + 0x5bc88e1800000000, 0xb5673b0a00000000, 0xd00087b200000000, + 0x6938502f00000000, 0x0c5fec9700000000, 0xe2f0598500000000, + 0x8797e53d00000000, 0xd187866500000000, 0xb4e03add00000000, + 0x5a4f8fcf00000000, 0x3f28337700000000, 0x8610e4ea00000000, + 0xe377585200000000, 0x0dd8ed4000000000, 0x68bf51f800000000, + 0xa1f82bf000000000, 0xc49f974800000000, 0x2a30225a00000000, + 0x4f579ee200000000, 0xf66f497f00000000, 0x9308f5c700000000, + 0x7da740d500000000, 0x18c0fc6d00000000, 0x4ed09f3500000000, + 0x2bb7238d00000000, 0xc518969f00000000, 0xa07f2a2700000000, + 0x1947fdba00000000, 0x7c20410200000000, 0x928ff41000000000, + 0xf7e848a800000000, 0x3d58149b00000000, 0x583fa82300000000, + 0xb6901d3100000000, 0xd3f7a18900000000, 0x6acf761400000000, + 0x0fa8caac00000000, 0xe1077fbe00000000, 0x8460c30600000000, + 0xd270a05e00000000, 0xb7171ce600000000, 0x59b8a9f400000000, + 0x3cdf154c00000000, 0x85e7c2d100000000, 0xe0807e6900000000, + 0x0e2fcb7b00000000, 0x6b4877c300000000, 0xa20f0dcb00000000, + 0xc768b17300000000, 0x29c7046100000000, 0x4ca0b8d900000000, + 0xf5986f4400000000, 0x90ffd3fc00000000, 0x7e5066ee00000000, + 0x1b37da5600000000, 0x4d27b90e00000000, 0x284005b600000000, + 0xc6efb0a400000000, 0xa3880c1c00000000, 0x1ab0db8100000000, + 0x7fd7673900000000, 0x9178d22b00000000, 0xf41f6e9300000000, + 0x03f7263b00000000, 0x66909a8300000000, 0x883f2f9100000000, + 0xed58932900000000, 0x546044b400000000, 0x3107f80c00000000, + 0xdfa84d1e00000000, 0xbacff1a600000000, 0xecdf92fe00000000, + 0x89b82e4600000000, 0x67179b5400000000, 0x027027ec00000000, + 0xbb48f07100000000, 0xde2f4cc900000000, 0x3080f9db00000000, + 0x55e7456300000000, 0x9ca03f6b00000000, 0xf9c783d300000000, + 0x176836c100000000, 0x720f8a7900000000, 0xcb375de400000000, + 0xae50e15c00000000, 0x40ff544e00000000, 0x2598e8f600000000, + 0x73888bae00000000, 0x16ef371600000000, 0xf840820400000000, + 0x9d273ebc00000000, 0x241fe92100000000, 0x4178559900000000, + 0xafd7e08b00000000, 0xcab05c3300000000, 0x3bb659ed00000000, + 0x5ed1e55500000000, 0xb07e504700000000, 0xd519ecff00000000, + 0x6c213b6200000000, 0x094687da00000000, 0xe7e932c800000000, + 0x828e8e7000000000, 0xd49eed2800000000, 0xb1f9519000000000, + 0x5f56e48200000000, 0x3a31583a00000000, 0x83098fa700000000, + 0xe66e331f00000000, 0x08c1860d00000000, 0x6da63ab500000000, + 0xa4e140bd00000000, 0xc186fc0500000000, 0x2f29491700000000, + 0x4a4ef5af00000000, 0xf376223200000000, 0x96119e8a00000000, + 0x78be2b9800000000, 0x1dd9972000000000, 0x4bc9f47800000000, + 0x2eae48c000000000, 0xc001fdd200000000, 0xa566416a00000000, + 0x1c5e96f700000000, 0x79392a4f00000000, 0x97969f5d00000000, + 0xf2f123e500000000, 0x05196b4d00000000, 0x607ed7f500000000, + 0x8ed162e700000000, 0xebb6de5f00000000, 0x528e09c200000000, + 0x37e9b57a00000000, 0xd946006800000000, 0xbc21bcd000000000, + 0xea31df8800000000, 0x8f56633000000000, 0x61f9d62200000000, + 0x049e6a9a00000000, 0xbda6bd0700000000, 0xd8c101bf00000000, + 0x366eb4ad00000000, 0x5309081500000000, 0x9a4e721d00000000, + 0xff29cea500000000, 0x11867bb700000000, 0x74e1c70f00000000, + 0xcdd9109200000000, 0xa8beac2a00000000, 0x4611193800000000, + 0x2376a58000000000, 0x7566c6d800000000, 0x10017a6000000000, + 0xfeaecf7200000000, 0x9bc973ca00000000, 0x22f1a45700000000, + 0x479618ef00000000, 0xa939adfd00000000, 0xcc5e114500000000, + 0x06ee4d7600000000, 0x6389f1ce00000000, 0x8d2644dc00000000, + 0xe841f86400000000, 0x51792ff900000000, 0x341e934100000000, + 0xdab1265300000000, 0xbfd69aeb00000000, 0xe9c6f9b300000000, + 0x8ca1450b00000000, 0x620ef01900000000, 0x07694ca100000000, + 0xbe519b3c00000000, 0xdb36278400000000, 0x3599929600000000, + 0x50fe2e2e00000000, 0x99b9542600000000, 0xfcdee89e00000000, + 0x12715d8c00000000, 0x7716e13400000000, 0xce2e36a900000000, + 0xab498a1100000000, 0x45e63f0300000000, 0x208183bb00000000, + 0x7691e0e300000000, 0x13f65c5b00000000, 0xfd59e94900000000, + 0x983e55f100000000, 0x2106826c00000000, 0x44613ed400000000, + 0xaace8bc600000000, 0xcfa9377e00000000, 0x38417fd600000000, + 0x5d26c36e00000000, 0xb389767c00000000, 0xd6eecac400000000, + 0x6fd61d5900000000, 0x0ab1a1e100000000, 0xe41e14f300000000, + 0x8179a84b00000000, 0xd769cb1300000000, 0xb20e77ab00000000, + 0x5ca1c2b900000000, 0x39c67e0100000000, 0x80fea99c00000000, + 0xe599152400000000, 0x0b36a03600000000, 0x6e511c8e00000000, + 0xa716668600000000, 0xc271da3e00000000, 0x2cde6f2c00000000, + 0x49b9d39400000000, 0xf081040900000000, 0x95e6b8b100000000, + 0x7b490da300000000, 0x1e2eb11b00000000, 0x483ed24300000000, + 0x2d596efb00000000, 0xc3f6dbe900000000, 0xa691675100000000, + 0x1fa9b0cc00000000, 0x7ace0c7400000000, 0x9461b96600000000, + 0xf10605de00000000}, + {0x0000000000000000, 0xb029603d00000000, 0x6053c07a00000000, + 0xd07aa04700000000, 0xc0a680f500000000, 0x708fe0c800000000, + 0xa0f5408f00000000, 0x10dc20b200000000, 0xc14b703000000000, + 0x7162100d00000000, 0xa118b04a00000000, 0x1131d07700000000, + 0x01edf0c500000000, 0xb1c490f800000000, 0x61be30bf00000000, + 0xd197508200000000, 0x8297e06000000000, 0x32be805d00000000, + 0xe2c4201a00000000, 0x52ed402700000000, 0x4231609500000000, + 0xf21800a800000000, 0x2262a0ef00000000, 0x924bc0d200000000, + 0x43dc905000000000, 0xf3f5f06d00000000, 0x238f502a00000000, + 0x93a6301700000000, 0x837a10a500000000, 0x3353709800000000, + 0xe329d0df00000000, 0x5300b0e200000000, 0x042fc1c100000000, + 0xb406a1fc00000000, 0x647c01bb00000000, 0xd455618600000000, + 0xc489413400000000, 0x74a0210900000000, 0xa4da814e00000000, + 0x14f3e17300000000, 0xc564b1f100000000, 0x754dd1cc00000000, + 0xa537718b00000000, 0x151e11b600000000, 0x05c2310400000000, + 0xb5eb513900000000, 0x6591f17e00000000, 0xd5b8914300000000, + 0x86b821a100000000, 0x3691419c00000000, 0xe6ebe1db00000000, + 0x56c281e600000000, 0x461ea15400000000, 0xf637c16900000000, + 0x264d612e00000000, 0x9664011300000000, 0x47f3519100000000, + 0xf7da31ac00000000, 0x27a091eb00000000, 0x9789f1d600000000, + 0x8755d16400000000, 0x377cb15900000000, 0xe706111e00000000, + 0x572f712300000000, 0x4958f35800000000, 0xf971936500000000, + 0x290b332200000000, 0x9922531f00000000, 0x89fe73ad00000000, + 0x39d7139000000000, 0xe9adb3d700000000, 0x5984d3ea00000000, + 0x8813836800000000, 0x383ae35500000000, 0xe840431200000000, + 0x5869232f00000000, 0x48b5039d00000000, 0xf89c63a000000000, + 0x28e6c3e700000000, 0x98cfa3da00000000, 0xcbcf133800000000, + 0x7be6730500000000, 0xab9cd34200000000, 0x1bb5b37f00000000, + 0x0b6993cd00000000, 0xbb40f3f000000000, 0x6b3a53b700000000, + 0xdb13338a00000000, 0x0a84630800000000, 0xbaad033500000000, + 0x6ad7a37200000000, 0xdafec34f00000000, 0xca22e3fd00000000, + 0x7a0b83c000000000, 0xaa71238700000000, 0x1a5843ba00000000, + 0x4d77329900000000, 0xfd5e52a400000000, 0x2d24f2e300000000, + 0x9d0d92de00000000, 0x8dd1b26c00000000, 0x3df8d25100000000, + 0xed82721600000000, 0x5dab122b00000000, 0x8c3c42a900000000, + 0x3c15229400000000, 0xec6f82d300000000, 0x5c46e2ee00000000, + 0x4c9ac25c00000000, 0xfcb3a26100000000, 0x2cc9022600000000, + 0x9ce0621b00000000, 0xcfe0d2f900000000, 0x7fc9b2c400000000, + 0xafb3128300000000, 0x1f9a72be00000000, 0x0f46520c00000000, + 0xbf6f323100000000, 0x6f15927600000000, 0xdf3cf24b00000000, + 0x0eaba2c900000000, 0xbe82c2f400000000, 0x6ef862b300000000, + 0xded1028e00000000, 0xce0d223c00000000, 0x7e24420100000000, + 0xae5ee24600000000, 0x1e77827b00000000, 0x92b0e6b100000000, + 0x2299868c00000000, 0xf2e326cb00000000, 0x42ca46f600000000, + 0x5216664400000000, 0xe23f067900000000, 0x3245a63e00000000, + 0x826cc60300000000, 0x53fb968100000000, 0xe3d2f6bc00000000, + 0x33a856fb00000000, 0x838136c600000000, 0x935d167400000000, + 0x2374764900000000, 0xf30ed60e00000000, 0x4327b63300000000, + 0x102706d100000000, 0xa00e66ec00000000, 0x7074c6ab00000000, + 0xc05da69600000000, 0xd081862400000000, 0x60a8e61900000000, + 0xb0d2465e00000000, 0x00fb266300000000, 0xd16c76e100000000, + 0x614516dc00000000, 0xb13fb69b00000000, 0x0116d6a600000000, + 0x11caf61400000000, 0xa1e3962900000000, 0x7199366e00000000, + 0xc1b0565300000000, 0x969f277000000000, 0x26b6474d00000000, + 0xf6cce70a00000000, 0x46e5873700000000, 0x5639a78500000000, + 0xe610c7b800000000, 0x366a67ff00000000, 0x864307c200000000, + 0x57d4574000000000, 0xe7fd377d00000000, 0x3787973a00000000, + 0x87aef70700000000, 0x9772d7b500000000, 0x275bb78800000000, + 0xf72117cf00000000, 0x470877f200000000, 0x1408c71000000000, + 0xa421a72d00000000, 0x745b076a00000000, 0xc472675700000000, + 0xd4ae47e500000000, 0x648727d800000000, 0xb4fd879f00000000, + 0x04d4e7a200000000, 0xd543b72000000000, 0x656ad71d00000000, + 0xb510775a00000000, 0x0539176700000000, 0x15e537d500000000, + 0xa5cc57e800000000, 0x75b6f7af00000000, 0xc59f979200000000, + 0xdbe815e900000000, 0x6bc175d400000000, 0xbbbbd59300000000, + 0x0b92b5ae00000000, 0x1b4e951c00000000, 0xab67f52100000000, + 0x7b1d556600000000, 0xcb34355b00000000, 0x1aa365d900000000, + 0xaa8a05e400000000, 0x7af0a5a300000000, 0xcad9c59e00000000, + 0xda05e52c00000000, 0x6a2c851100000000, 0xba56255600000000, + 0x0a7f456b00000000, 0x597ff58900000000, 0xe95695b400000000, + 0x392c35f300000000, 0x890555ce00000000, 0x99d9757c00000000, + 0x29f0154100000000, 0xf98ab50600000000, 0x49a3d53b00000000, + 0x983485b900000000, 0x281de58400000000, 0xf86745c300000000, + 0x484e25fe00000000, 0x5892054c00000000, 0xe8bb657100000000, + 0x38c1c53600000000, 0x88e8a50b00000000, 0xdfc7d42800000000, + 0x6feeb41500000000, 0xbf94145200000000, 0x0fbd746f00000000, + 0x1f6154dd00000000, 0xaf4834e000000000, 0x7f3294a700000000, + 0xcf1bf49a00000000, 0x1e8ca41800000000, 0xaea5c42500000000, + 0x7edf646200000000, 0xcef6045f00000000, 0xde2a24ed00000000, + 0x6e0344d000000000, 0xbe79e49700000000, 0x0e5084aa00000000, + 0x5d50344800000000, 0xed79547500000000, 0x3d03f43200000000, + 0x8d2a940f00000000, 0x9df6b4bd00000000, 0x2ddfd48000000000, + 0xfda574c700000000, 0x4d8c14fa00000000, 0x9c1b447800000000, + 0x2c32244500000000, 0xfc48840200000000, 0x4c61e43f00000000, + 0x5cbdc48d00000000, 0xec94a4b000000000, 0x3cee04f700000000, + 0x8cc764ca00000000}, + {0x0000000000000000, 0xa5d35ccb00000000, 0x0ba1c84d00000000, + 0xae72948600000000, 0x1642919b00000000, 0xb391cd5000000000, + 0x1de359d600000000, 0xb830051d00000000, 0x6d8253ec00000000, + 0xc8510f2700000000, 0x66239ba100000000, 0xc3f0c76a00000000, + 0x7bc0c27700000000, 0xde139ebc00000000, 0x70610a3a00000000, + 0xd5b256f100000000, 0x9b02d60300000000, 0x3ed18ac800000000, + 0x90a31e4e00000000, 0x3570428500000000, 0x8d40479800000000, + 0x28931b5300000000, 0x86e18fd500000000, 0x2332d31e00000000, + 0xf68085ef00000000, 0x5353d92400000000, 0xfd214da200000000, + 0x58f2116900000000, 0xe0c2147400000000, 0x451148bf00000000, + 0xeb63dc3900000000, 0x4eb080f200000000, 0x3605ac0700000000, + 0x93d6f0cc00000000, 0x3da4644a00000000, 0x9877388100000000, + 0x20473d9c00000000, 0x8594615700000000, 0x2be6f5d100000000, + 0x8e35a91a00000000, 0x5b87ffeb00000000, 0xfe54a32000000000, + 0x502637a600000000, 0xf5f56b6d00000000, 0x4dc56e7000000000, + 0xe81632bb00000000, 0x4664a63d00000000, 0xe3b7faf600000000, + 0xad077a0400000000, 0x08d426cf00000000, 0xa6a6b24900000000, + 0x0375ee8200000000, 0xbb45eb9f00000000, 0x1e96b75400000000, + 0xb0e423d200000000, 0x15377f1900000000, 0xc08529e800000000, + 0x6556752300000000, 0xcb24e1a500000000, 0x6ef7bd6e00000000, + 0xd6c7b87300000000, 0x7314e4b800000000, 0xdd66703e00000000, + 0x78b52cf500000000, 0x6c0a580f00000000, 0xc9d904c400000000, + 0x67ab904200000000, 0xc278cc8900000000, 0x7a48c99400000000, + 0xdf9b955f00000000, 0x71e901d900000000, 0xd43a5d1200000000, + 0x01880be300000000, 0xa45b572800000000, 0x0a29c3ae00000000, + 0xaffa9f6500000000, 0x17ca9a7800000000, 0xb219c6b300000000, + 0x1c6b523500000000, 0xb9b80efe00000000, 0xf7088e0c00000000, + 0x52dbd2c700000000, 0xfca9464100000000, 0x597a1a8a00000000, + 0xe14a1f9700000000, 0x4499435c00000000, 0xeaebd7da00000000, + 0x4f388b1100000000, 0x9a8adde000000000, 0x3f59812b00000000, + 0x912b15ad00000000, 0x34f8496600000000, 0x8cc84c7b00000000, + 0x291b10b000000000, 0x8769843600000000, 0x22bad8fd00000000, + 0x5a0ff40800000000, 0xffdca8c300000000, 0x51ae3c4500000000, + 0xf47d608e00000000, 0x4c4d659300000000, 0xe99e395800000000, + 0x47ecadde00000000, 0xe23ff11500000000, 0x378da7e400000000, + 0x925efb2f00000000, 0x3c2c6fa900000000, 0x99ff336200000000, + 0x21cf367f00000000, 0x841c6ab400000000, 0x2a6efe3200000000, + 0x8fbda2f900000000, 0xc10d220b00000000, 0x64de7ec000000000, + 0xcaacea4600000000, 0x6f7fb68d00000000, 0xd74fb39000000000, + 0x729cef5b00000000, 0xdcee7bdd00000000, 0x793d271600000000, + 0xac8f71e700000000, 0x095c2d2c00000000, 0xa72eb9aa00000000, + 0x02fde56100000000, 0xbacde07c00000000, 0x1f1ebcb700000000, + 0xb16c283100000000, 0x14bf74fa00000000, 0xd814b01e00000000, + 0x7dc7ecd500000000, 0xd3b5785300000000, 0x7666249800000000, + 0xce56218500000000, 0x6b857d4e00000000, 0xc5f7e9c800000000, + 0x6024b50300000000, 0xb596e3f200000000, 0x1045bf3900000000, + 0xbe372bbf00000000, 0x1be4777400000000, 0xa3d4726900000000, + 0x06072ea200000000, 0xa875ba2400000000, 0x0da6e6ef00000000, + 0x4316661d00000000, 0xe6c53ad600000000, 0x48b7ae5000000000, + 0xed64f29b00000000, 0x5554f78600000000, 0xf087ab4d00000000, + 0x5ef53fcb00000000, 0xfb26630000000000, 0x2e9435f100000000, + 0x8b47693a00000000, 0x2535fdbc00000000, 0x80e6a17700000000, + 0x38d6a46a00000000, 0x9d05f8a100000000, 0x33776c2700000000, + 0x96a430ec00000000, 0xee111c1900000000, 0x4bc240d200000000, + 0xe5b0d45400000000, 0x4063889f00000000, 0xf8538d8200000000, + 0x5d80d14900000000, 0xf3f245cf00000000, 0x5621190400000000, + 0x83934ff500000000, 0x2640133e00000000, 0x883287b800000000, + 0x2de1db7300000000, 0x95d1de6e00000000, 0x300282a500000000, + 0x9e70162300000000, 0x3ba34ae800000000, 0x7513ca1a00000000, + 0xd0c096d100000000, 0x7eb2025700000000, 0xdb615e9c00000000, + 0x63515b8100000000, 0xc682074a00000000, 0x68f093cc00000000, + 0xcd23cf0700000000, 0x189199f600000000, 0xbd42c53d00000000, + 0x133051bb00000000, 0xb6e30d7000000000, 0x0ed3086d00000000, + 0xab0054a600000000, 0x0572c02000000000, 0xa0a19ceb00000000, + 0xb41ee81100000000, 0x11cdb4da00000000, 0xbfbf205c00000000, + 0x1a6c7c9700000000, 0xa25c798a00000000, 0x078f254100000000, + 0xa9fdb1c700000000, 0x0c2eed0c00000000, 0xd99cbbfd00000000, + 0x7c4fe73600000000, 0xd23d73b000000000, 0x77ee2f7b00000000, + 0xcfde2a6600000000, 0x6a0d76ad00000000, 0xc47fe22b00000000, + 0x61acbee000000000, 0x2f1c3e1200000000, 0x8acf62d900000000, + 0x24bdf65f00000000, 0x816eaa9400000000, 0x395eaf8900000000, + 0x9c8df34200000000, 0x32ff67c400000000, 0x972c3b0f00000000, + 0x429e6dfe00000000, 0xe74d313500000000, 0x493fa5b300000000, + 0xececf97800000000, 0x54dcfc6500000000, 0xf10fa0ae00000000, + 0x5f7d342800000000, 0xfaae68e300000000, 0x821b441600000000, + 0x27c818dd00000000, 0x89ba8c5b00000000, 0x2c69d09000000000, + 0x9459d58d00000000, 0x318a894600000000, 0x9ff81dc000000000, + 0x3a2b410b00000000, 0xef9917fa00000000, 0x4a4a4b3100000000, + 0xe438dfb700000000, 0x41eb837c00000000, 0xf9db866100000000, + 0x5c08daaa00000000, 0xf27a4e2c00000000, 0x57a912e700000000, + 0x1919921500000000, 0xbccacede00000000, 0x12b85a5800000000, + 0xb76b069300000000, 0x0f5b038e00000000, 0xaa885f4500000000, + 0x04facbc300000000, 0xa129970800000000, 0x749bc1f900000000, + 0xd1489d3200000000, 0x7f3a09b400000000, 0xdae9557f00000000, + 0x62d9506200000000, 0xc70a0ca900000000, 0x6978982f00000000, + 0xccabc4e400000000}, + {0x0000000000000000, 0xb40b77a600000000, 0x29119f9700000000, + 0x9d1ae83100000000, 0x13244ff400000000, 0xa72f385200000000, + 0x3a35d06300000000, 0x8e3ea7c500000000, 0x674eef3300000000, + 0xd345989500000000, 0x4e5f70a400000000, 0xfa54070200000000, + 0x746aa0c700000000, 0xc061d76100000000, 0x5d7b3f5000000000, + 0xe97048f600000000, 0xce9cde6700000000, 0x7a97a9c100000000, + 0xe78d41f000000000, 0x5386365600000000, 0xddb8919300000000, + 0x69b3e63500000000, 0xf4a90e0400000000, 0x40a279a200000000, + 0xa9d2315400000000, 0x1dd946f200000000, 0x80c3aec300000000, + 0x34c8d96500000000, 0xbaf67ea000000000, 0x0efd090600000000, + 0x93e7e13700000000, 0x27ec969100000000, 0x9c39bdcf00000000, + 0x2832ca6900000000, 0xb528225800000000, 0x012355fe00000000, + 0x8f1df23b00000000, 0x3b16859d00000000, 0xa60c6dac00000000, + 0x12071a0a00000000, 0xfb7752fc00000000, 0x4f7c255a00000000, + 0xd266cd6b00000000, 0x666dbacd00000000, 0xe8531d0800000000, + 0x5c586aae00000000, 0xc142829f00000000, 0x7549f53900000000, + 0x52a563a800000000, 0xe6ae140e00000000, 0x7bb4fc3f00000000, + 0xcfbf8b9900000000, 0x41812c5c00000000, 0xf58a5bfa00000000, + 0x6890b3cb00000000, 0xdc9bc46d00000000, 0x35eb8c9b00000000, + 0x81e0fb3d00000000, 0x1cfa130c00000000, 0xa8f164aa00000000, + 0x26cfc36f00000000, 0x92c4b4c900000000, 0x0fde5cf800000000, + 0xbbd52b5e00000000, 0x79750b4400000000, 0xcd7e7ce200000000, + 0x506494d300000000, 0xe46fe37500000000, 0x6a5144b000000000, + 0xde5a331600000000, 0x4340db2700000000, 0xf74bac8100000000, + 0x1e3be47700000000, 0xaa3093d100000000, 0x372a7be000000000, + 0x83210c4600000000, 0x0d1fab8300000000, 0xb914dc2500000000, + 0x240e341400000000, 0x900543b200000000, 0xb7e9d52300000000, + 0x03e2a28500000000, 0x9ef84ab400000000, 0x2af33d1200000000, + 0xa4cd9ad700000000, 0x10c6ed7100000000, 0x8ddc054000000000, + 0x39d772e600000000, 0xd0a73a1000000000, 0x64ac4db600000000, + 0xf9b6a58700000000, 0x4dbdd22100000000, 0xc38375e400000000, + 0x7788024200000000, 0xea92ea7300000000, 0x5e999dd500000000, + 0xe54cb68b00000000, 0x5147c12d00000000, 0xcc5d291c00000000, + 0x78565eba00000000, 0xf668f97f00000000, 0x42638ed900000000, + 0xdf7966e800000000, 0x6b72114e00000000, 0x820259b800000000, + 0x36092e1e00000000, 0xab13c62f00000000, 0x1f18b18900000000, + 0x9126164c00000000, 0x252d61ea00000000, 0xb83789db00000000, + 0x0c3cfe7d00000000, 0x2bd068ec00000000, 0x9fdb1f4a00000000, + 0x02c1f77b00000000, 0xb6ca80dd00000000, 0x38f4271800000000, + 0x8cff50be00000000, 0x11e5b88f00000000, 0xa5eecf2900000000, + 0x4c9e87df00000000, 0xf895f07900000000, 0x658f184800000000, + 0xd1846fee00000000, 0x5fbac82b00000000, 0xebb1bf8d00000000, + 0x76ab57bc00000000, 0xc2a0201a00000000, 0xf2ea168800000000, + 0x46e1612e00000000, 0xdbfb891f00000000, 0x6ff0feb900000000, + 0xe1ce597c00000000, 0x55c52eda00000000, 0xc8dfc6eb00000000, + 0x7cd4b14d00000000, 0x95a4f9bb00000000, 0x21af8e1d00000000, + 0xbcb5662c00000000, 0x08be118a00000000, 0x8680b64f00000000, + 0x328bc1e900000000, 0xaf9129d800000000, 0x1b9a5e7e00000000, + 0x3c76c8ef00000000, 0x887dbf4900000000, 0x1567577800000000, + 0xa16c20de00000000, 0x2f52871b00000000, 0x9b59f0bd00000000, + 0x0643188c00000000, 0xb2486f2a00000000, 0x5b3827dc00000000, + 0xef33507a00000000, 0x7229b84b00000000, 0xc622cfed00000000, + 0x481c682800000000, 0xfc171f8e00000000, 0x610df7bf00000000, + 0xd506801900000000, 0x6ed3ab4700000000, 0xdad8dce100000000, + 0x47c234d000000000, 0xf3c9437600000000, 0x7df7e4b300000000, + 0xc9fc931500000000, 0x54e67b2400000000, 0xe0ed0c8200000000, + 0x099d447400000000, 0xbd9633d200000000, 0x208cdbe300000000, + 0x9487ac4500000000, 0x1ab90b8000000000, 0xaeb27c2600000000, + 0x33a8941700000000, 0x87a3e3b100000000, 0xa04f752000000000, + 0x1444028600000000, 0x895eeab700000000, 0x3d559d1100000000, + 0xb36b3ad400000000, 0x07604d7200000000, 0x9a7aa54300000000, + 0x2e71d2e500000000, 0xc7019a1300000000, 0x730aedb500000000, + 0xee10058400000000, 0x5a1b722200000000, 0xd425d5e700000000, + 0x602ea24100000000, 0xfd344a7000000000, 0x493f3dd600000000, + 0x8b9f1dcc00000000, 0x3f946a6a00000000, 0xa28e825b00000000, + 0x1685f5fd00000000, 0x98bb523800000000, 0x2cb0259e00000000, + 0xb1aacdaf00000000, 0x05a1ba0900000000, 0xecd1f2ff00000000, + 0x58da855900000000, 0xc5c06d6800000000, 0x71cb1ace00000000, + 0xfff5bd0b00000000, 0x4bfecaad00000000, 0xd6e4229c00000000, + 0x62ef553a00000000, 0x4503c3ab00000000, 0xf108b40d00000000, + 0x6c125c3c00000000, 0xd8192b9a00000000, 0x56278c5f00000000, + 0xe22cfbf900000000, 0x7f3613c800000000, 0xcb3d646e00000000, + 0x224d2c9800000000, 0x96465b3e00000000, 0x0b5cb30f00000000, + 0xbf57c4a900000000, 0x3169636c00000000, 0x856214ca00000000, + 0x1878fcfb00000000, 0xac738b5d00000000, 0x17a6a00300000000, + 0xa3add7a500000000, 0x3eb73f9400000000, 0x8abc483200000000, + 0x0482eff700000000, 0xb089985100000000, 0x2d93706000000000, + 0x999807c600000000, 0x70e84f3000000000, 0xc4e3389600000000, + 0x59f9d0a700000000, 0xedf2a70100000000, 0x63cc00c400000000, + 0xd7c7776200000000, 0x4add9f5300000000, 0xfed6e8f500000000, + 0xd93a7e6400000000, 0x6d3109c200000000, 0xf02be1f300000000, + 0x4420965500000000, 0xca1e319000000000, 0x7e15463600000000, + 0xe30fae0700000000, 0x5704d9a100000000, 0xbe74915700000000, + 0x0a7fe6f100000000, 0x97650ec000000000, 0x236e796600000000, + 0xad50dea300000000, 0x195ba90500000000, 0x8441413400000000, + 0x304a369200000000}, + {0x0000000000000000, 0x9e00aacc00000000, 0x7d07254200000000, + 0xe3078f8e00000000, 0xfa0e4a8400000000, 0x640ee04800000000, + 0x87096fc600000000, 0x1909c50a00000000, 0xb51be5d300000000, + 0x2b1b4f1f00000000, 0xc81cc09100000000, 0x561c6a5d00000000, + 0x4f15af5700000000, 0xd115059b00000000, 0x32128a1500000000, + 0xac1220d900000000, 0x2b31bb7c00000000, 0xb53111b000000000, + 0x56369e3e00000000, 0xc83634f200000000, 0xd13ff1f800000000, + 0x4f3f5b3400000000, 0xac38d4ba00000000, 0x32387e7600000000, + 0x9e2a5eaf00000000, 0x002af46300000000, 0xe32d7bed00000000, + 0x7d2dd12100000000, 0x6424142b00000000, 0xfa24bee700000000, + 0x1923316900000000, 0x87239ba500000000, 0x566276f900000000, + 0xc862dc3500000000, 0x2b6553bb00000000, 0xb565f97700000000, + 0xac6c3c7d00000000, 0x326c96b100000000, 0xd16b193f00000000, + 0x4f6bb3f300000000, 0xe379932a00000000, 0x7d7939e600000000, + 0x9e7eb66800000000, 0x007e1ca400000000, 0x1977d9ae00000000, + 0x8777736200000000, 0x6470fcec00000000, 0xfa70562000000000, + 0x7d53cd8500000000, 0xe353674900000000, 0x0054e8c700000000, + 0x9e54420b00000000, 0x875d870100000000, 0x195d2dcd00000000, + 0xfa5aa24300000000, 0x645a088f00000000, 0xc848285600000000, + 0x5648829a00000000, 0xb54f0d1400000000, 0x2b4fa7d800000000, + 0x324662d200000000, 0xac46c81e00000000, 0x4f41479000000000, + 0xd141ed5c00000000, 0xedc29d2900000000, 0x73c237e500000000, + 0x90c5b86b00000000, 0x0ec512a700000000, 0x17ccd7ad00000000, + 0x89cc7d6100000000, 0x6acbf2ef00000000, 0xf4cb582300000000, + 0x58d978fa00000000, 0xc6d9d23600000000, 0x25de5db800000000, + 0xbbdef77400000000, 0xa2d7327e00000000, 0x3cd798b200000000, + 0xdfd0173c00000000, 0x41d0bdf000000000, 0xc6f3265500000000, + 0x58f38c9900000000, 0xbbf4031700000000, 0x25f4a9db00000000, + 0x3cfd6cd100000000, 0xa2fdc61d00000000, 0x41fa499300000000, + 0xdffae35f00000000, 0x73e8c38600000000, 0xede8694a00000000, + 0x0eefe6c400000000, 0x90ef4c0800000000, 0x89e6890200000000, + 0x17e623ce00000000, 0xf4e1ac4000000000, 0x6ae1068c00000000, + 0xbba0ebd000000000, 0x25a0411c00000000, 0xc6a7ce9200000000, + 0x58a7645e00000000, 0x41aea15400000000, 0xdfae0b9800000000, + 0x3ca9841600000000, 0xa2a92eda00000000, 0x0ebb0e0300000000, + 0x90bba4cf00000000, 0x73bc2b4100000000, 0xedbc818d00000000, + 0xf4b5448700000000, 0x6ab5ee4b00000000, 0x89b261c500000000, + 0x17b2cb0900000000, 0x909150ac00000000, 0x0e91fa6000000000, + 0xed9675ee00000000, 0x7396df2200000000, 0x6a9f1a2800000000, + 0xf49fb0e400000000, 0x17983f6a00000000, 0x899895a600000000, + 0x258ab57f00000000, 0xbb8a1fb300000000, 0x588d903d00000000, + 0xc68d3af100000000, 0xdf84fffb00000000, 0x4184553700000000, + 0xa283dab900000000, 0x3c83707500000000, 0xda853b5300000000, + 0x4485919f00000000, 0xa7821e1100000000, 0x3982b4dd00000000, + 0x208b71d700000000, 0xbe8bdb1b00000000, 0x5d8c549500000000, + 0xc38cfe5900000000, 0x6f9ede8000000000, 0xf19e744c00000000, + 0x1299fbc200000000, 0x8c99510e00000000, 0x9590940400000000, + 0x0b903ec800000000, 0xe897b14600000000, 0x76971b8a00000000, + 0xf1b4802f00000000, 0x6fb42ae300000000, 0x8cb3a56d00000000, + 0x12b30fa100000000, 0x0bbacaab00000000, 0x95ba606700000000, + 0x76bdefe900000000, 0xe8bd452500000000, 0x44af65fc00000000, + 0xdaafcf3000000000, 0x39a840be00000000, 0xa7a8ea7200000000, + 0xbea12f7800000000, 0x20a185b400000000, 0xc3a60a3a00000000, + 0x5da6a0f600000000, 0x8ce74daa00000000, 0x12e7e76600000000, + 0xf1e068e800000000, 0x6fe0c22400000000, 0x76e9072e00000000, + 0xe8e9ade200000000, 0x0bee226c00000000, 0x95ee88a000000000, + 0x39fca87900000000, 0xa7fc02b500000000, 0x44fb8d3b00000000, + 0xdafb27f700000000, 0xc3f2e2fd00000000, 0x5df2483100000000, + 0xbef5c7bf00000000, 0x20f56d7300000000, 0xa7d6f6d600000000, + 0x39d65c1a00000000, 0xdad1d39400000000, 0x44d1795800000000, + 0x5dd8bc5200000000, 0xc3d8169e00000000, 0x20df991000000000, + 0xbedf33dc00000000, 0x12cd130500000000, 0x8ccdb9c900000000, + 0x6fca364700000000, 0xf1ca9c8b00000000, 0xe8c3598100000000, + 0x76c3f34d00000000, 0x95c47cc300000000, 0x0bc4d60f00000000, + 0x3747a67a00000000, 0xa9470cb600000000, 0x4a40833800000000, + 0xd44029f400000000, 0xcd49ecfe00000000, 0x5349463200000000, + 0xb04ec9bc00000000, 0x2e4e637000000000, 0x825c43a900000000, + 0x1c5ce96500000000, 0xff5b66eb00000000, 0x615bcc2700000000, + 0x7852092d00000000, 0xe652a3e100000000, 0x05552c6f00000000, + 0x9b5586a300000000, 0x1c761d0600000000, 0x8276b7ca00000000, + 0x6171384400000000, 0xff71928800000000, 0xe678578200000000, + 0x7878fd4e00000000, 0x9b7f72c000000000, 0x057fd80c00000000, + 0xa96df8d500000000, 0x376d521900000000, 0xd46add9700000000, + 0x4a6a775b00000000, 0x5363b25100000000, 0xcd63189d00000000, + 0x2e64971300000000, 0xb0643ddf00000000, 0x6125d08300000000, + 0xff257a4f00000000, 0x1c22f5c100000000, 0x82225f0d00000000, + 0x9b2b9a0700000000, 0x052b30cb00000000, 0xe62cbf4500000000, + 0x782c158900000000, 0xd43e355000000000, 0x4a3e9f9c00000000, + 0xa939101200000000, 0x3739bade00000000, 0x2e307fd400000000, + 0xb030d51800000000, 0x53375a9600000000, 0xcd37f05a00000000, + 0x4a146bff00000000, 0xd414c13300000000, 0x37134ebd00000000, + 0xa913e47100000000, 0xb01a217b00000000, 0x2e1a8bb700000000, + 0xcd1d043900000000, 0x531daef500000000, 0xff0f8e2c00000000, + 0x610f24e000000000, 0x8208ab6e00000000, 0x1c0801a200000000, + 0x0501c4a800000000, 0x9b016e6400000000, 0x7806e1ea00000000, + 0xe6064b2600000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, + 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, + 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, + 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, + 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, + 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, + 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, + 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, + 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, + 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, + 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, + 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, + 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, + 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, + 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, + 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, + 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, + 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, + 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, + 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, + 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, + 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, + 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, + 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, + 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, + 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, + 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, + 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, + 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, + 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, + 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, + 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, + 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, + 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, + 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, + 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, + 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, + 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, + 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, + 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, + 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, + 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, + 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, + 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, + 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, + 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, + 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, + 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, + 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, + 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, + 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, + 0xde0506f1}, + {0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, + 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, + 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, + 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, + 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, + 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, + 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, + 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, + 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, + 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, + 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, + 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, + 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, + 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, + 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, + 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, + 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, + 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, + 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, + 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, + 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, + 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, + 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, + 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, + 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, + 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, + 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, + 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, + 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, + 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, + 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, + 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, + 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, + 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, + 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, + 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, + 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, + 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, + 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, + 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, + 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, + 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, + 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, + 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, + 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, + 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, + 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, + 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, + 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, + 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, + 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, + 0xbe9834ed}, + {0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, + 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, + 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, + 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, + 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, + 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, + 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, + 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, + 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, + 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, + 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, + 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, + 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, + 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, + 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, + 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, + 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, + 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, + 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, + 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, + 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, + 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, + 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, + 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, + 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, + 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, + 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, + 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, + 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, + 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, + 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, + 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, + 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, + 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, + 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, + 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, + 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, + 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, + 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, + 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, + 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, + 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, + 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, + 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, + 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, + 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, + 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, + 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, + 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, + 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, + 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, + 0x9324fd72}, + {0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, + 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, + 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, + 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, + 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, + 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, + 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, + 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, + 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, + 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, + 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, + 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, + 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, + 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, + 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, + 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, + 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, + 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, + 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, + 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, + 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, + 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, + 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, + 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, + 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, + 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, + 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, + 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, + 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, + 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, + 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, + 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, + 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, + 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, + 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, + 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, + 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, + 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, + 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, + 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, + 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, + 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, + 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, + 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, + 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, + 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, + 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, + 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, + 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, + 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, + 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, + 0x8def022d}, + {0x00000000, 0x41311b19, 0x82623632, 0xc3532d2b, 0x04c56c64, + 0x45f4777d, 0x86a75a56, 0xc796414f, 0x088ad9c8, 0x49bbc2d1, + 0x8ae8effa, 0xcbd9f4e3, 0x0c4fb5ac, 0x4d7eaeb5, 0x8e2d839e, + 0xcf1c9887, 0x5112c24a, 0x1023d953, 0xd370f478, 0x9241ef61, + 0x55d7ae2e, 0x14e6b537, 0xd7b5981c, 0x96848305, 0x59981b82, + 0x18a9009b, 0xdbfa2db0, 0x9acb36a9, 0x5d5d77e6, 0x1c6c6cff, + 0xdf3f41d4, 0x9e0e5acd, 0xa2248495, 0xe3159f8c, 0x2046b2a7, + 0x6177a9be, 0xa6e1e8f1, 0xe7d0f3e8, 0x2483dec3, 0x65b2c5da, + 0xaaae5d5d, 0xeb9f4644, 0x28cc6b6f, 0x69fd7076, 0xae6b3139, + 0xef5a2a20, 0x2c09070b, 0x6d381c12, 0xf33646df, 0xb2075dc6, + 0x715470ed, 0x30656bf4, 0xf7f32abb, 0xb6c231a2, 0x75911c89, + 0x34a00790, 0xfbbc9f17, 0xba8d840e, 0x79dea925, 0x38efb23c, + 0xff79f373, 0xbe48e86a, 0x7d1bc541, 0x3c2ade58, 0x054f79f0, + 0x447e62e9, 0x872d4fc2, 0xc61c54db, 0x018a1594, 0x40bb0e8d, + 0x83e823a6, 0xc2d938bf, 0x0dc5a038, 0x4cf4bb21, 0x8fa7960a, + 0xce968d13, 0x0900cc5c, 0x4831d745, 0x8b62fa6e, 0xca53e177, + 0x545dbbba, 0x156ca0a3, 0xd63f8d88, 0x970e9691, 0x5098d7de, + 0x11a9ccc7, 0xd2fae1ec, 0x93cbfaf5, 0x5cd76272, 0x1de6796b, + 0xdeb55440, 0x9f844f59, 0x58120e16, 0x1923150f, 0xda703824, + 0x9b41233d, 0xa76bfd65, 0xe65ae67c, 0x2509cb57, 0x6438d04e, + 0xa3ae9101, 0xe29f8a18, 0x21cca733, 0x60fdbc2a, 0xafe124ad, + 0xeed03fb4, 0x2d83129f, 0x6cb20986, 0xab2448c9, 0xea1553d0, + 0x29467efb, 0x687765e2, 0xf6793f2f, 0xb7482436, 0x741b091d, + 0x352a1204, 0xf2bc534b, 0xb38d4852, 0x70de6579, 0x31ef7e60, + 0xfef3e6e7, 0xbfc2fdfe, 0x7c91d0d5, 0x3da0cbcc, 0xfa368a83, + 0xbb07919a, 0x7854bcb1, 0x3965a7a8, 0x4b98833b, 0x0aa99822, + 0xc9fab509, 0x88cbae10, 0x4f5def5f, 0x0e6cf446, 0xcd3fd96d, + 0x8c0ec274, 0x43125af3, 0x022341ea, 0xc1706cc1, 0x804177d8, + 0x47d73697, 0x06e62d8e, 0xc5b500a5, 0x84841bbc, 0x1a8a4171, + 0x5bbb5a68, 0x98e87743, 0xd9d96c5a, 0x1e4f2d15, 0x5f7e360c, + 0x9c2d1b27, 0xdd1c003e, 0x120098b9, 0x533183a0, 0x9062ae8b, + 0xd153b592, 0x16c5f4dd, 0x57f4efc4, 0x94a7c2ef, 0xd596d9f6, + 0xe9bc07ae, 0xa88d1cb7, 0x6bde319c, 0x2aef2a85, 0xed796bca, + 0xac4870d3, 0x6f1b5df8, 0x2e2a46e1, 0xe136de66, 0xa007c57f, + 0x6354e854, 0x2265f34d, 0xe5f3b202, 0xa4c2a91b, 0x67918430, + 0x26a09f29, 0xb8aec5e4, 0xf99fdefd, 0x3accf3d6, 0x7bfde8cf, + 0xbc6ba980, 0xfd5ab299, 0x3e099fb2, 0x7f3884ab, 0xb0241c2c, + 0xf1150735, 0x32462a1e, 0x73773107, 0xb4e17048, 0xf5d06b51, + 0x3683467a, 0x77b25d63, 0x4ed7facb, 0x0fe6e1d2, 0xccb5ccf9, + 0x8d84d7e0, 0x4a1296af, 0x0b238db6, 0xc870a09d, 0x8941bb84, + 0x465d2303, 0x076c381a, 0xc43f1531, 0x850e0e28, 0x42984f67, + 0x03a9547e, 0xc0fa7955, 0x81cb624c, 0x1fc53881, 0x5ef42398, + 0x9da70eb3, 0xdc9615aa, 0x1b0054e5, 0x5a314ffc, 0x996262d7, + 0xd85379ce, 0x174fe149, 0x567efa50, 0x952dd77b, 0xd41ccc62, + 0x138a8d2d, 0x52bb9634, 0x91e8bb1f, 0xd0d9a006, 0xecf37e5e, + 0xadc26547, 0x6e91486c, 0x2fa05375, 0xe836123a, 0xa9070923, + 0x6a542408, 0x2b653f11, 0xe479a796, 0xa548bc8f, 0x661b91a4, + 0x272a8abd, 0xe0bccbf2, 0xa18dd0eb, 0x62defdc0, 0x23efe6d9, + 0xbde1bc14, 0xfcd0a70d, 0x3f838a26, 0x7eb2913f, 0xb924d070, + 0xf815cb69, 0x3b46e642, 0x7a77fd5b, 0xb56b65dc, 0xf45a7ec5, + 0x370953ee, 0x763848f7, 0xb1ae09b8, 0xf09f12a1, 0x33cc3f8a, + 0x72fd2493}, + {0x00000000, 0x376ac201, 0x6ed48403, 0x59be4602, 0xdca80907, + 0xebc2cb06, 0xb27c8d04, 0x85164f05, 0xb851130e, 0x8f3bd10f, + 0xd685970d, 0xe1ef550c, 0x64f91a09, 0x5393d808, 0x0a2d9e0a, + 0x3d475c0b, 0x70a3261c, 0x47c9e41d, 0x1e77a21f, 0x291d601e, + 0xac0b2f1b, 0x9b61ed1a, 0xc2dfab18, 0xf5b56919, 0xc8f23512, + 0xff98f713, 0xa626b111, 0x914c7310, 0x145a3c15, 0x2330fe14, + 0x7a8eb816, 0x4de47a17, 0xe0464d38, 0xd72c8f39, 0x8e92c93b, + 0xb9f80b3a, 0x3cee443f, 0x0b84863e, 0x523ac03c, 0x6550023d, + 0x58175e36, 0x6f7d9c37, 0x36c3da35, 0x01a91834, 0x84bf5731, + 0xb3d59530, 0xea6bd332, 0xdd011133, 0x90e56b24, 0xa78fa925, + 0xfe31ef27, 0xc95b2d26, 0x4c4d6223, 0x7b27a022, 0x2299e620, + 0x15f32421, 0x28b4782a, 0x1fdeba2b, 0x4660fc29, 0x710a3e28, + 0xf41c712d, 0xc376b32c, 0x9ac8f52e, 0xada2372f, 0xc08d9a70, + 0xf7e75871, 0xae591e73, 0x9933dc72, 0x1c259377, 0x2b4f5176, + 0x72f11774, 0x459bd575, 0x78dc897e, 0x4fb64b7f, 0x16080d7d, + 0x2162cf7c, 0xa4748079, 0x931e4278, 0xcaa0047a, 0xfdcac67b, + 0xb02ebc6c, 0x87447e6d, 0xdefa386f, 0xe990fa6e, 0x6c86b56b, + 0x5bec776a, 0x02523168, 0x3538f369, 0x087faf62, 0x3f156d63, + 0x66ab2b61, 0x51c1e960, 0xd4d7a665, 0xe3bd6464, 0xba032266, + 0x8d69e067, 0x20cbd748, 0x17a11549, 0x4e1f534b, 0x7975914a, + 0xfc63de4f, 0xcb091c4e, 0x92b75a4c, 0xa5dd984d, 0x989ac446, + 0xaff00647, 0xf64e4045, 0xc1248244, 0x4432cd41, 0x73580f40, + 0x2ae64942, 0x1d8c8b43, 0x5068f154, 0x67023355, 0x3ebc7557, + 0x09d6b756, 0x8cc0f853, 0xbbaa3a52, 0xe2147c50, 0xd57ebe51, + 0xe839e25a, 0xdf53205b, 0x86ed6659, 0xb187a458, 0x3491eb5d, + 0x03fb295c, 0x5a456f5e, 0x6d2fad5f, 0x801b35e1, 0xb771f7e0, + 0xeecfb1e2, 0xd9a573e3, 0x5cb33ce6, 0x6bd9fee7, 0x3267b8e5, + 0x050d7ae4, 0x384a26ef, 0x0f20e4ee, 0x569ea2ec, 0x61f460ed, + 0xe4e22fe8, 0xd388ede9, 0x8a36abeb, 0xbd5c69ea, 0xf0b813fd, + 0xc7d2d1fc, 0x9e6c97fe, 0xa90655ff, 0x2c101afa, 0x1b7ad8fb, + 0x42c49ef9, 0x75ae5cf8, 0x48e900f3, 0x7f83c2f2, 0x263d84f0, + 0x115746f1, 0x944109f4, 0xa32bcbf5, 0xfa958df7, 0xcdff4ff6, + 0x605d78d9, 0x5737bad8, 0x0e89fcda, 0x39e33edb, 0xbcf571de, + 0x8b9fb3df, 0xd221f5dd, 0xe54b37dc, 0xd80c6bd7, 0xef66a9d6, + 0xb6d8efd4, 0x81b22dd5, 0x04a462d0, 0x33cea0d1, 0x6a70e6d3, + 0x5d1a24d2, 0x10fe5ec5, 0x27949cc4, 0x7e2adac6, 0x494018c7, + 0xcc5657c2, 0xfb3c95c3, 0xa282d3c1, 0x95e811c0, 0xa8af4dcb, + 0x9fc58fca, 0xc67bc9c8, 0xf1110bc9, 0x740744cc, 0x436d86cd, + 0x1ad3c0cf, 0x2db902ce, 0x4096af91, 0x77fc6d90, 0x2e422b92, + 0x1928e993, 0x9c3ea696, 0xab546497, 0xf2ea2295, 0xc580e094, + 0xf8c7bc9f, 0xcfad7e9e, 0x9613389c, 0xa179fa9d, 0x246fb598, + 0x13057799, 0x4abb319b, 0x7dd1f39a, 0x3035898d, 0x075f4b8c, + 0x5ee10d8e, 0x698bcf8f, 0xec9d808a, 0xdbf7428b, 0x82490489, + 0xb523c688, 0x88649a83, 0xbf0e5882, 0xe6b01e80, 0xd1dadc81, + 0x54cc9384, 0x63a65185, 0x3a181787, 0x0d72d586, 0xa0d0e2a9, + 0x97ba20a8, 0xce0466aa, 0xf96ea4ab, 0x7c78ebae, 0x4b1229af, + 0x12ac6fad, 0x25c6adac, 0x1881f1a7, 0x2feb33a6, 0x765575a4, + 0x413fb7a5, 0xc429f8a0, 0xf3433aa1, 0xaafd7ca3, 0x9d97bea2, + 0xd073c4b5, 0xe71906b4, 0xbea740b6, 0x89cd82b7, 0x0cdbcdb2, + 0x3bb10fb3, 0x620f49b1, 0x55658bb0, 0x6822d7bb, 0x5f4815ba, + 0x06f653b8, 0x319c91b9, 0xb48adebc, 0x83e01cbd, 0xda5e5abf, + 0xed3498be}, + {0x00000000, 0x6567bcb8, 0x8bc809aa, 0xeeafb512, 0x5797628f, + 0x32f0de37, 0xdc5f6b25, 0xb938d79d, 0xef28b4c5, 0x8a4f087d, + 0x64e0bd6f, 0x018701d7, 0xb8bfd64a, 0xddd86af2, 0x3377dfe0, + 0x56106358, 0x9f571950, 0xfa30a5e8, 0x149f10fa, 0x71f8ac42, + 0xc8c07bdf, 0xada7c767, 0x43087275, 0x266fcecd, 0x707fad95, + 0x1518112d, 0xfbb7a43f, 0x9ed01887, 0x27e8cf1a, 0x428f73a2, + 0xac20c6b0, 0xc9477a08, 0x3eaf32a0, 0x5bc88e18, 0xb5673b0a, + 0xd00087b2, 0x6938502f, 0x0c5fec97, 0xe2f05985, 0x8797e53d, + 0xd1878665, 0xb4e03add, 0x5a4f8fcf, 0x3f283377, 0x8610e4ea, + 0xe3775852, 0x0dd8ed40, 0x68bf51f8, 0xa1f82bf0, 0xc49f9748, + 0x2a30225a, 0x4f579ee2, 0xf66f497f, 0x9308f5c7, 0x7da740d5, + 0x18c0fc6d, 0x4ed09f35, 0x2bb7238d, 0xc518969f, 0xa07f2a27, + 0x1947fdba, 0x7c204102, 0x928ff410, 0xf7e848a8, 0x3d58149b, + 0x583fa823, 0xb6901d31, 0xd3f7a189, 0x6acf7614, 0x0fa8caac, + 0xe1077fbe, 0x8460c306, 0xd270a05e, 0xb7171ce6, 0x59b8a9f4, + 0x3cdf154c, 0x85e7c2d1, 0xe0807e69, 0x0e2fcb7b, 0x6b4877c3, + 0xa20f0dcb, 0xc768b173, 0x29c70461, 0x4ca0b8d9, 0xf5986f44, + 0x90ffd3fc, 0x7e5066ee, 0x1b37da56, 0x4d27b90e, 0x284005b6, + 0xc6efb0a4, 0xa3880c1c, 0x1ab0db81, 0x7fd76739, 0x9178d22b, + 0xf41f6e93, 0x03f7263b, 0x66909a83, 0x883f2f91, 0xed589329, + 0x546044b4, 0x3107f80c, 0xdfa84d1e, 0xbacff1a6, 0xecdf92fe, + 0x89b82e46, 0x67179b54, 0x027027ec, 0xbb48f071, 0xde2f4cc9, + 0x3080f9db, 0x55e74563, 0x9ca03f6b, 0xf9c783d3, 0x176836c1, + 0x720f8a79, 0xcb375de4, 0xae50e15c, 0x40ff544e, 0x2598e8f6, + 0x73888bae, 0x16ef3716, 0xf8408204, 0x9d273ebc, 0x241fe921, + 0x41785599, 0xafd7e08b, 0xcab05c33, 0x3bb659ed, 0x5ed1e555, + 0xb07e5047, 0xd519ecff, 0x6c213b62, 0x094687da, 0xe7e932c8, + 0x828e8e70, 0xd49eed28, 0xb1f95190, 0x5f56e482, 0x3a31583a, + 0x83098fa7, 0xe66e331f, 0x08c1860d, 0x6da63ab5, 0xa4e140bd, + 0xc186fc05, 0x2f294917, 0x4a4ef5af, 0xf3762232, 0x96119e8a, + 0x78be2b98, 0x1dd99720, 0x4bc9f478, 0x2eae48c0, 0xc001fdd2, + 0xa566416a, 0x1c5e96f7, 0x79392a4f, 0x97969f5d, 0xf2f123e5, + 0x05196b4d, 0x607ed7f5, 0x8ed162e7, 0xebb6de5f, 0x528e09c2, + 0x37e9b57a, 0xd9460068, 0xbc21bcd0, 0xea31df88, 0x8f566330, + 0x61f9d622, 0x049e6a9a, 0xbda6bd07, 0xd8c101bf, 0x366eb4ad, + 0x53090815, 0x9a4e721d, 0xff29cea5, 0x11867bb7, 0x74e1c70f, + 0xcdd91092, 0xa8beac2a, 0x46111938, 0x2376a580, 0x7566c6d8, + 0x10017a60, 0xfeaecf72, 0x9bc973ca, 0x22f1a457, 0x479618ef, + 0xa939adfd, 0xcc5e1145, 0x06ee4d76, 0x6389f1ce, 0x8d2644dc, + 0xe841f864, 0x51792ff9, 0x341e9341, 0xdab12653, 0xbfd69aeb, + 0xe9c6f9b3, 0x8ca1450b, 0x620ef019, 0x07694ca1, 0xbe519b3c, + 0xdb362784, 0x35999296, 0x50fe2e2e, 0x99b95426, 0xfcdee89e, + 0x12715d8c, 0x7716e134, 0xce2e36a9, 0xab498a11, 0x45e63f03, + 0x208183bb, 0x7691e0e3, 0x13f65c5b, 0xfd59e949, 0x983e55f1, + 0x2106826c, 0x44613ed4, 0xaace8bc6, 0xcfa9377e, 0x38417fd6, + 0x5d26c36e, 0xb389767c, 0xd6eecac4, 0x6fd61d59, 0x0ab1a1e1, + 0xe41e14f3, 0x8179a84b, 0xd769cb13, 0xb20e77ab, 0x5ca1c2b9, + 0x39c67e01, 0x80fea99c, 0xe5991524, 0x0b36a036, 0x6e511c8e, + 0xa7166686, 0xc271da3e, 0x2cde6f2c, 0x49b9d394, 0xf0810409, + 0x95e6b8b1, 0x7b490da3, 0x1e2eb11b, 0x483ed243, 0x2d596efb, + 0xc3f6dbe9, 0xa6916751, 0x1fa9b0cc, 0x7ace0c74, 0x9461b966, + 0xf10605de}}; + +#endif + +#endif + +#if N == 2 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xae689191, 0x87a02563, 0x29c8b4f2, 0xd4314c87, + 0x7a59dd16, 0x539169e4, 0xfdf9f875, 0x73139f4f, 0xdd7b0ede, + 0xf4b3ba2c, 0x5adb2bbd, 0xa722d3c8, 0x094a4259, 0x2082f6ab, + 0x8eea673a, 0xe6273e9e, 0x484faf0f, 0x61871bfd, 0xcfef8a6c, + 0x32167219, 0x9c7ee388, 0xb5b6577a, 0x1bdec6eb, 0x9534a1d1, + 0x3b5c3040, 0x129484b2, 0xbcfc1523, 0x4105ed56, 0xef6d7cc7, + 0xc6a5c835, 0x68cd59a4, 0x173f7b7d, 0xb957eaec, 0x909f5e1e, + 0x3ef7cf8f, 0xc30e37fa, 0x6d66a66b, 0x44ae1299, 0xeac68308, + 0x642ce432, 0xca4475a3, 0xe38cc151, 0x4de450c0, 0xb01da8b5, + 0x1e753924, 0x37bd8dd6, 0x99d51c47, 0xf11845e3, 0x5f70d472, + 0x76b86080, 0xd8d0f111, 0x25290964, 0x8b4198f5, 0xa2892c07, + 0x0ce1bd96, 0x820bdaac, 0x2c634b3d, 0x05abffcf, 0xabc36e5e, + 0x563a962b, 0xf85207ba, 0xd19ab348, 0x7ff222d9, 0x2e7ef6fa, + 0x8016676b, 0xa9ded399, 0x07b64208, 0xfa4fba7d, 0x54272bec, + 0x7def9f1e, 0xd3870e8f, 0x5d6d69b5, 0xf305f824, 0xdacd4cd6, + 0x74a5dd47, 0x895c2532, 0x2734b4a3, 0x0efc0051, 0xa09491c0, + 0xc859c864, 0x663159f5, 0x4ff9ed07, 0xe1917c96, 0x1c6884e3, + 0xb2001572, 0x9bc8a180, 0x35a03011, 0xbb4a572b, 0x1522c6ba, + 0x3cea7248, 0x9282e3d9, 0x6f7b1bac, 0xc1138a3d, 0xe8db3ecf, + 0x46b3af5e, 0x39418d87, 0x97291c16, 0xbee1a8e4, 0x10893975, + 0xed70c100, 0x43185091, 0x6ad0e463, 0xc4b875f2, 0x4a5212c8, + 0xe43a8359, 0xcdf237ab, 0x639aa63a, 0x9e635e4f, 0x300bcfde, + 0x19c37b2c, 0xb7abeabd, 0xdf66b319, 0x710e2288, 0x58c6967a, + 0xf6ae07eb, 0x0b57ff9e, 0xa53f6e0f, 0x8cf7dafd, 0x229f4b6c, + 0xac752c56, 0x021dbdc7, 0x2bd50935, 0x85bd98a4, 0x784460d1, + 0xd62cf140, 0xffe445b2, 0x518cd423, 0x5cfdedf4, 0xf2957c65, + 0xdb5dc897, 0x75355906, 0x88cca173, 0x26a430e2, 0x0f6c8410, + 0xa1041581, 0x2fee72bb, 0x8186e32a, 0xa84e57d8, 0x0626c649, + 0xfbdf3e3c, 0x55b7afad, 0x7c7f1b5f, 0xd2178ace, 0xbadad36a, + 0x14b242fb, 0x3d7af609, 0x93126798, 0x6eeb9fed, 0xc0830e7c, + 0xe94bba8e, 0x47232b1f, 0xc9c94c25, 0x67a1ddb4, 0x4e696946, + 0xe001f8d7, 0x1df800a2, 0xb3909133, 0x9a5825c1, 0x3430b450, + 0x4bc29689, 0xe5aa0718, 0xcc62b3ea, 0x620a227b, 0x9ff3da0e, + 0x319b4b9f, 0x1853ff6d, 0xb63b6efc, 0x38d109c6, 0x96b99857, + 0xbf712ca5, 0x1119bd34, 0xece04541, 0x4288d4d0, 0x6b406022, + 0xc528f1b3, 0xade5a817, 0x038d3986, 0x2a458d74, 0x842d1ce5, + 0x79d4e490, 0xd7bc7501, 0xfe74c1f3, 0x501c5062, 0xdef63758, + 0x709ea6c9, 0x5956123b, 0xf73e83aa, 0x0ac77bdf, 0xa4afea4e, + 0x8d675ebc, 0x230fcf2d, 0x72831b0e, 0xdceb8a9f, 0xf5233e6d, + 0x5b4baffc, 0xa6b25789, 0x08dac618, 0x211272ea, 0x8f7ae37b, + 0x01908441, 0xaff815d0, 0x8630a122, 0x285830b3, 0xd5a1c8c6, + 0x7bc95957, 0x5201eda5, 0xfc697c34, 0x94a42590, 0x3accb401, + 0x130400f3, 0xbd6c9162, 0x40956917, 0xeefdf886, 0xc7354c74, + 0x695ddde5, 0xe7b7badf, 0x49df2b4e, 0x60179fbc, 0xce7f0e2d, + 0x3386f658, 0x9dee67c9, 0xb426d33b, 0x1a4e42aa, 0x65bc6073, + 0xcbd4f1e2, 0xe21c4510, 0x4c74d481, 0xb18d2cf4, 0x1fe5bd65, + 0x362d0997, 0x98459806, 0x16afff3c, 0xb8c76ead, 0x910fda5f, + 0x3f674bce, 0xc29eb3bb, 0x6cf6222a, 0x453e96d8, 0xeb560749, + 0x839b5eed, 0x2df3cf7c, 0x043b7b8e, 0xaa53ea1f, 0x57aa126a, + 0xf9c283fb, 0xd00a3709, 0x7e62a698, 0xf088c1a2, 0x5ee05033, + 0x7728e4c1, 0xd9407550, 0x24b98d25, 0x8ad11cb4, 0xa319a846, + 0x0d7139d7}, + {0x00000000, 0xb9fbdbe8, 0xa886b191, 0x117d6a79, 0x8a7c6563, + 0x3387be8b, 0x22fad4f2, 0x9b010f1a, 0xcf89cc87, 0x7672176f, + 0x670f7d16, 0xdef4a6fe, 0x45f5a9e4, 0xfc0e720c, 0xed731875, + 0x5488c39d, 0x44629f4f, 0xfd9944a7, 0xece42ede, 0x551ff536, + 0xce1efa2c, 0x77e521c4, 0x66984bbd, 0xdf639055, 0x8beb53c8, + 0x32108820, 0x236de259, 0x9a9639b1, 0x019736ab, 0xb86ced43, + 0xa911873a, 0x10ea5cd2, 0x88c53e9e, 0x313ee576, 0x20438f0f, + 0x99b854e7, 0x02b95bfd, 0xbb428015, 0xaa3fea6c, 0x13c43184, + 0x474cf219, 0xfeb729f1, 0xefca4388, 0x56319860, 0xcd30977a, + 0x74cb4c92, 0x65b626eb, 0xdc4dfd03, 0xcca7a1d1, 0x755c7a39, + 0x64211040, 0xdddacba8, 0x46dbc4b2, 0xff201f5a, 0xee5d7523, + 0x57a6aecb, 0x032e6d56, 0xbad5b6be, 0xaba8dcc7, 0x1253072f, + 0x89520835, 0x30a9d3dd, 0x21d4b9a4, 0x982f624c, 0xcafb7b7d, + 0x7300a095, 0x627dcaec, 0xdb861104, 0x40871e1e, 0xf97cc5f6, + 0xe801af8f, 0x51fa7467, 0x0572b7fa, 0xbc896c12, 0xadf4066b, + 0x140fdd83, 0x8f0ed299, 0x36f50971, 0x27886308, 0x9e73b8e0, + 0x8e99e432, 0x37623fda, 0x261f55a3, 0x9fe48e4b, 0x04e58151, + 0xbd1e5ab9, 0xac6330c0, 0x1598eb28, 0x411028b5, 0xf8ebf35d, + 0xe9969924, 0x506d42cc, 0xcb6c4dd6, 0x7297963e, 0x63eafc47, + 0xda1127af, 0x423e45e3, 0xfbc59e0b, 0xeab8f472, 0x53432f9a, + 0xc8422080, 0x71b9fb68, 0x60c49111, 0xd93f4af9, 0x8db78964, + 0x344c528c, 0x253138f5, 0x9ccae31d, 0x07cbec07, 0xbe3037ef, + 0xaf4d5d96, 0x16b6867e, 0x065cdaac, 0xbfa70144, 0xaeda6b3d, + 0x1721b0d5, 0x8c20bfcf, 0x35db6427, 0x24a60e5e, 0x9d5dd5b6, + 0xc9d5162b, 0x702ecdc3, 0x6153a7ba, 0xd8a87c52, 0x43a97348, + 0xfa52a8a0, 0xeb2fc2d9, 0x52d41931, 0x4e87f0bb, 0xf77c2b53, + 0xe601412a, 0x5ffa9ac2, 0xc4fb95d8, 0x7d004e30, 0x6c7d2449, + 0xd586ffa1, 0x810e3c3c, 0x38f5e7d4, 0x29888dad, 0x90735645, + 0x0b72595f, 0xb28982b7, 0xa3f4e8ce, 0x1a0f3326, 0x0ae56ff4, + 0xb31eb41c, 0xa263de65, 0x1b98058d, 0x80990a97, 0x3962d17f, + 0x281fbb06, 0x91e460ee, 0xc56ca373, 0x7c97789b, 0x6dea12e2, + 0xd411c90a, 0x4f10c610, 0xf6eb1df8, 0xe7967781, 0x5e6dac69, + 0xc642ce25, 0x7fb915cd, 0x6ec47fb4, 0xd73fa45c, 0x4c3eab46, + 0xf5c570ae, 0xe4b81ad7, 0x5d43c13f, 0x09cb02a2, 0xb030d94a, + 0xa14db333, 0x18b668db, 0x83b767c1, 0x3a4cbc29, 0x2b31d650, + 0x92ca0db8, 0x8220516a, 0x3bdb8a82, 0x2aa6e0fb, 0x935d3b13, + 0x085c3409, 0xb1a7efe1, 0xa0da8598, 0x19215e70, 0x4da99ded, + 0xf4524605, 0xe52f2c7c, 0x5cd4f794, 0xc7d5f88e, 0x7e2e2366, + 0x6f53491f, 0xd6a892f7, 0x847c8bc6, 0x3d87502e, 0x2cfa3a57, + 0x9501e1bf, 0x0e00eea5, 0xb7fb354d, 0xa6865f34, 0x1f7d84dc, + 0x4bf54741, 0xf20e9ca9, 0xe373f6d0, 0x5a882d38, 0xc1892222, + 0x7872f9ca, 0x690f93b3, 0xd0f4485b, 0xc01e1489, 0x79e5cf61, + 0x6898a518, 0xd1637ef0, 0x4a6271ea, 0xf399aa02, 0xe2e4c07b, + 0x5b1f1b93, 0x0f97d80e, 0xb66c03e6, 0xa711699f, 0x1eeab277, + 0x85ebbd6d, 0x3c106685, 0x2d6d0cfc, 0x9496d714, 0x0cb9b558, + 0xb5426eb0, 0xa43f04c9, 0x1dc4df21, 0x86c5d03b, 0x3f3e0bd3, + 0x2e4361aa, 0x97b8ba42, 0xc33079df, 0x7acba237, 0x6bb6c84e, + 0xd24d13a6, 0x494c1cbc, 0xf0b7c754, 0xe1caad2d, 0x583176c5, + 0x48db2a17, 0xf120f1ff, 0xe05d9b86, 0x59a6406e, 0xc2a74f74, + 0x7b5c949c, 0x6a21fee5, 0xd3da250d, 0x8752e690, 0x3ea93d78, + 0x2fd45701, 0x962f8ce9, 0x0d2e83f3, 0xb4d5581b, 0xa5a83262, + 0x1c53e98a}, + {0x00000000, 0x9d0fe176, 0xe16ec4ad, 0x7c6125db, 0x19ac8f1b, + 0x84a36e6d, 0xf8c24bb6, 0x65cdaac0, 0x33591e36, 0xae56ff40, + 0xd237da9b, 0x4f383bed, 0x2af5912d, 0xb7fa705b, 0xcb9b5580, + 0x5694b4f6, 0x66b23c6c, 0xfbbddd1a, 0x87dcf8c1, 0x1ad319b7, + 0x7f1eb377, 0xe2115201, 0x9e7077da, 0x037f96ac, 0x55eb225a, + 0xc8e4c32c, 0xb485e6f7, 0x298a0781, 0x4c47ad41, 0xd1484c37, + 0xad2969ec, 0x3026889a, 0xcd6478d8, 0x506b99ae, 0x2c0abc75, + 0xb1055d03, 0xd4c8f7c3, 0x49c716b5, 0x35a6336e, 0xa8a9d218, + 0xfe3d66ee, 0x63328798, 0x1f53a243, 0x825c4335, 0xe791e9f5, + 0x7a9e0883, 0x06ff2d58, 0x9bf0cc2e, 0xabd644b4, 0x36d9a5c2, + 0x4ab88019, 0xd7b7616f, 0xb27acbaf, 0x2f752ad9, 0x53140f02, + 0xce1bee74, 0x988f5a82, 0x0580bbf4, 0x79e19e2f, 0xe4ee7f59, + 0x8123d599, 0x1c2c34ef, 0x604d1134, 0xfd42f042, 0x41b9f7f1, + 0xdcb61687, 0xa0d7335c, 0x3dd8d22a, 0x581578ea, 0xc51a999c, + 0xb97bbc47, 0x24745d31, 0x72e0e9c7, 0xefef08b1, 0x938e2d6a, + 0x0e81cc1c, 0x6b4c66dc, 0xf64387aa, 0x8a22a271, 0x172d4307, + 0x270bcb9d, 0xba042aeb, 0xc6650f30, 0x5b6aee46, 0x3ea74486, + 0xa3a8a5f0, 0xdfc9802b, 0x42c6615d, 0x1452d5ab, 0x895d34dd, + 0xf53c1106, 0x6833f070, 0x0dfe5ab0, 0x90f1bbc6, 0xec909e1d, + 0x719f7f6b, 0x8cdd8f29, 0x11d26e5f, 0x6db34b84, 0xf0bcaaf2, + 0x95710032, 0x087ee144, 0x741fc49f, 0xe91025e9, 0xbf84911f, + 0x228b7069, 0x5eea55b2, 0xc3e5b4c4, 0xa6281e04, 0x3b27ff72, + 0x4746daa9, 0xda493bdf, 0xea6fb345, 0x77605233, 0x0b0177e8, + 0x960e969e, 0xf3c33c5e, 0x6eccdd28, 0x12adf8f3, 0x8fa21985, + 0xd936ad73, 0x44394c05, 0x385869de, 0xa55788a8, 0xc09a2268, + 0x5d95c31e, 0x21f4e6c5, 0xbcfb07b3, 0x8373efe2, 0x1e7c0e94, + 0x621d2b4f, 0xff12ca39, 0x9adf60f9, 0x07d0818f, 0x7bb1a454, + 0xe6be4522, 0xb02af1d4, 0x2d2510a2, 0x51443579, 0xcc4bd40f, + 0xa9867ecf, 0x34899fb9, 0x48e8ba62, 0xd5e75b14, 0xe5c1d38e, + 0x78ce32f8, 0x04af1723, 0x99a0f655, 0xfc6d5c95, 0x6162bde3, + 0x1d039838, 0x800c794e, 0xd698cdb8, 0x4b972cce, 0x37f60915, + 0xaaf9e863, 0xcf3442a3, 0x523ba3d5, 0x2e5a860e, 0xb3556778, + 0x4e17973a, 0xd318764c, 0xaf795397, 0x3276b2e1, 0x57bb1821, + 0xcab4f957, 0xb6d5dc8c, 0x2bda3dfa, 0x7d4e890c, 0xe041687a, + 0x9c204da1, 0x012facd7, 0x64e20617, 0xf9ede761, 0x858cc2ba, + 0x188323cc, 0x28a5ab56, 0xb5aa4a20, 0xc9cb6ffb, 0x54c48e8d, + 0x3109244d, 0xac06c53b, 0xd067e0e0, 0x4d680196, 0x1bfcb560, + 0x86f35416, 0xfa9271cd, 0x679d90bb, 0x02503a7b, 0x9f5fdb0d, + 0xe33efed6, 0x7e311fa0, 0xc2ca1813, 0x5fc5f965, 0x23a4dcbe, + 0xbeab3dc8, 0xdb669708, 0x4669767e, 0x3a0853a5, 0xa707b2d3, + 0xf1930625, 0x6c9ce753, 0x10fdc288, 0x8df223fe, 0xe83f893e, + 0x75306848, 0x09514d93, 0x945eace5, 0xa478247f, 0x3977c509, + 0x4516e0d2, 0xd81901a4, 0xbdd4ab64, 0x20db4a12, 0x5cba6fc9, + 0xc1b58ebf, 0x97213a49, 0x0a2edb3f, 0x764ffee4, 0xeb401f92, + 0x8e8db552, 0x13825424, 0x6fe371ff, 0xf2ec9089, 0x0fae60cb, + 0x92a181bd, 0xeec0a466, 0x73cf4510, 0x1602efd0, 0x8b0d0ea6, + 0xf76c2b7d, 0x6a63ca0b, 0x3cf77efd, 0xa1f89f8b, 0xdd99ba50, + 0x40965b26, 0x255bf1e6, 0xb8541090, 0xc435354b, 0x593ad43d, + 0x691c5ca7, 0xf413bdd1, 0x8872980a, 0x157d797c, 0x70b0d3bc, + 0xedbf32ca, 0x91de1711, 0x0cd1f667, 0x5a454291, 0xc74aa3e7, + 0xbb2b863c, 0x2624674a, 0x43e9cd8a, 0xdee62cfc, 0xa2870927, + 0x3f88e851}, + {0x00000000, 0xdd96d985, 0x605cb54b, 0xbdca6cce, 0xc0b96a96, + 0x1d2fb313, 0xa0e5dfdd, 0x7d730658, 0x5a03d36d, 0x87950ae8, + 0x3a5f6626, 0xe7c9bfa3, 0x9abab9fb, 0x472c607e, 0xfae60cb0, + 0x2770d535, 0xb407a6da, 0x69917f5f, 0xd45b1391, 0x09cdca14, + 0x74becc4c, 0xa92815c9, 0x14e27907, 0xc974a082, 0xee0475b7, + 0x3392ac32, 0x8e58c0fc, 0x53ce1979, 0x2ebd1f21, 0xf32bc6a4, + 0x4ee1aa6a, 0x937773ef, 0xb37e4bf5, 0x6ee89270, 0xd322febe, + 0x0eb4273b, 0x73c72163, 0xae51f8e6, 0x139b9428, 0xce0d4dad, + 0xe97d9898, 0x34eb411d, 0x89212dd3, 0x54b7f456, 0x29c4f20e, + 0xf4522b8b, 0x49984745, 0x940e9ec0, 0x0779ed2f, 0xdaef34aa, + 0x67255864, 0xbab381e1, 0xc7c087b9, 0x1a565e3c, 0xa79c32f2, + 0x7a0aeb77, 0x5d7a3e42, 0x80ece7c7, 0x3d268b09, 0xe0b0528c, + 0x9dc354d4, 0x40558d51, 0xfd9fe19f, 0x2009381a, 0xbd8d91ab, + 0x601b482e, 0xddd124e0, 0x0047fd65, 0x7d34fb3d, 0xa0a222b8, + 0x1d684e76, 0xc0fe97f3, 0xe78e42c6, 0x3a189b43, 0x87d2f78d, + 0x5a442e08, 0x27372850, 0xfaa1f1d5, 0x476b9d1b, 0x9afd449e, + 0x098a3771, 0xd41ceef4, 0x69d6823a, 0xb4405bbf, 0xc9335de7, + 0x14a58462, 0xa96fe8ac, 0x74f93129, 0x5389e41c, 0x8e1f3d99, + 0x33d55157, 0xee4388d2, 0x93308e8a, 0x4ea6570f, 0xf36c3bc1, + 0x2efae244, 0x0ef3da5e, 0xd36503db, 0x6eaf6f15, 0xb339b690, + 0xce4ab0c8, 0x13dc694d, 0xae160583, 0x7380dc06, 0x54f00933, + 0x8966d0b6, 0x34acbc78, 0xe93a65fd, 0x944963a5, 0x49dfba20, + 0xf415d6ee, 0x29830f6b, 0xbaf47c84, 0x6762a501, 0xdaa8c9cf, + 0x073e104a, 0x7a4d1612, 0xa7dbcf97, 0x1a11a359, 0xc7877adc, + 0xe0f7afe9, 0x3d61766c, 0x80ab1aa2, 0x5d3dc327, 0x204ec57f, + 0xfdd81cfa, 0x40127034, 0x9d84a9b1, 0xa06a2517, 0x7dfcfc92, + 0xc036905c, 0x1da049d9, 0x60d34f81, 0xbd459604, 0x008ffaca, + 0xdd19234f, 0xfa69f67a, 0x27ff2fff, 0x9a354331, 0x47a39ab4, + 0x3ad09cec, 0xe7464569, 0x5a8c29a7, 0x871af022, 0x146d83cd, + 0xc9fb5a48, 0x74313686, 0xa9a7ef03, 0xd4d4e95b, 0x094230de, + 0xb4885c10, 0x691e8595, 0x4e6e50a0, 0x93f88925, 0x2e32e5eb, + 0xf3a43c6e, 0x8ed73a36, 0x5341e3b3, 0xee8b8f7d, 0x331d56f8, + 0x13146ee2, 0xce82b767, 0x7348dba9, 0xaede022c, 0xd3ad0474, + 0x0e3bddf1, 0xb3f1b13f, 0x6e6768ba, 0x4917bd8f, 0x9481640a, + 0x294b08c4, 0xf4ddd141, 0x89aed719, 0x54380e9c, 0xe9f26252, + 0x3464bbd7, 0xa713c838, 0x7a8511bd, 0xc74f7d73, 0x1ad9a4f6, + 0x67aaa2ae, 0xba3c7b2b, 0x07f617e5, 0xda60ce60, 0xfd101b55, + 0x2086c2d0, 0x9d4cae1e, 0x40da779b, 0x3da971c3, 0xe03fa846, + 0x5df5c488, 0x80631d0d, 0x1de7b4bc, 0xc0716d39, 0x7dbb01f7, + 0xa02dd872, 0xdd5ede2a, 0x00c807af, 0xbd026b61, 0x6094b2e4, + 0x47e467d1, 0x9a72be54, 0x27b8d29a, 0xfa2e0b1f, 0x875d0d47, + 0x5acbd4c2, 0xe701b80c, 0x3a976189, 0xa9e01266, 0x7476cbe3, + 0xc9bca72d, 0x142a7ea8, 0x695978f0, 0xb4cfa175, 0x0905cdbb, + 0xd493143e, 0xf3e3c10b, 0x2e75188e, 0x93bf7440, 0x4e29adc5, + 0x335aab9d, 0xeecc7218, 0x53061ed6, 0x8e90c753, 0xae99ff49, + 0x730f26cc, 0xcec54a02, 0x13539387, 0x6e2095df, 0xb3b64c5a, + 0x0e7c2094, 0xd3eaf911, 0xf49a2c24, 0x290cf5a1, 0x94c6996f, + 0x495040ea, 0x342346b2, 0xe9b59f37, 0x547ff3f9, 0x89e92a7c, + 0x1a9e5993, 0xc7088016, 0x7ac2ecd8, 0xa754355d, 0xda273305, + 0x07b1ea80, 0xba7b864e, 0x67ed5fcb, 0x409d8afe, 0x9d0b537b, + 0x20c13fb5, 0xfd57e630, 0x8024e068, 0x5db239ed, 0xe0785523, + 0x3dee8ca6}, + {0x00000000, 0x9ba54c6f, 0xec3b9e9f, 0x779ed2f0, 0x03063b7f, + 0x98a37710, 0xef3da5e0, 0x7498e98f, 0x060c76fe, 0x9da93a91, + 0xea37e861, 0x7192a40e, 0x050a4d81, 0x9eaf01ee, 0xe931d31e, + 0x72949f71, 0x0c18edfc, 0x97bda193, 0xe0237363, 0x7b863f0c, + 0x0f1ed683, 0x94bb9aec, 0xe325481c, 0x78800473, 0x0a149b02, + 0x91b1d76d, 0xe62f059d, 0x7d8a49f2, 0x0912a07d, 0x92b7ec12, + 0xe5293ee2, 0x7e8c728d, 0x1831dbf8, 0x83949797, 0xf40a4567, + 0x6faf0908, 0x1b37e087, 0x8092ace8, 0xf70c7e18, 0x6ca93277, + 0x1e3dad06, 0x8598e169, 0xf2063399, 0x69a37ff6, 0x1d3b9679, + 0x869eda16, 0xf10008e6, 0x6aa54489, 0x14293604, 0x8f8c7a6b, + 0xf812a89b, 0x63b7e4f4, 0x172f0d7b, 0x8c8a4114, 0xfb1493e4, + 0x60b1df8b, 0x122540fa, 0x89800c95, 0xfe1ede65, 0x65bb920a, + 0x11237b85, 0x8a8637ea, 0xfd18e51a, 0x66bda975, 0x3063b7f0, + 0xabc6fb9f, 0xdc58296f, 0x47fd6500, 0x33658c8f, 0xa8c0c0e0, + 0xdf5e1210, 0x44fb5e7f, 0x366fc10e, 0xadca8d61, 0xda545f91, + 0x41f113fe, 0x3569fa71, 0xaeccb61e, 0xd95264ee, 0x42f72881, + 0x3c7b5a0c, 0xa7de1663, 0xd040c493, 0x4be588fc, 0x3f7d6173, + 0xa4d82d1c, 0xd346ffec, 0x48e3b383, 0x3a772cf2, 0xa1d2609d, + 0xd64cb26d, 0x4de9fe02, 0x3971178d, 0xa2d45be2, 0xd54a8912, + 0x4eefc57d, 0x28526c08, 0xb3f72067, 0xc469f297, 0x5fccbef8, + 0x2b545777, 0xb0f11b18, 0xc76fc9e8, 0x5cca8587, 0x2e5e1af6, + 0xb5fb5699, 0xc2658469, 0x59c0c806, 0x2d582189, 0xb6fd6de6, + 0xc163bf16, 0x5ac6f379, 0x244a81f4, 0xbfefcd9b, 0xc8711f6b, + 0x53d45304, 0x274cba8b, 0xbce9f6e4, 0xcb772414, 0x50d2687b, + 0x2246f70a, 0xb9e3bb65, 0xce7d6995, 0x55d825fa, 0x2140cc75, + 0xbae5801a, 0xcd7b52ea, 0x56de1e85, 0x60c76fe0, 0xfb62238f, + 0x8cfcf17f, 0x1759bd10, 0x63c1549f, 0xf86418f0, 0x8ffaca00, + 0x145f866f, 0x66cb191e, 0xfd6e5571, 0x8af08781, 0x1155cbee, + 0x65cd2261, 0xfe686e0e, 0x89f6bcfe, 0x1253f091, 0x6cdf821c, + 0xf77ace73, 0x80e41c83, 0x1b4150ec, 0x6fd9b963, 0xf47cf50c, + 0x83e227fc, 0x18476b93, 0x6ad3f4e2, 0xf176b88d, 0x86e86a7d, + 0x1d4d2612, 0x69d5cf9d, 0xf27083f2, 0x85ee5102, 0x1e4b1d6d, + 0x78f6b418, 0xe353f877, 0x94cd2a87, 0x0f6866e8, 0x7bf08f67, + 0xe055c308, 0x97cb11f8, 0x0c6e5d97, 0x7efac2e6, 0xe55f8e89, + 0x92c15c79, 0x09641016, 0x7dfcf999, 0xe659b5f6, 0x91c76706, + 0x0a622b69, 0x74ee59e4, 0xef4b158b, 0x98d5c77b, 0x03708b14, + 0x77e8629b, 0xec4d2ef4, 0x9bd3fc04, 0x0076b06b, 0x72e22f1a, + 0xe9476375, 0x9ed9b185, 0x057cfdea, 0x71e41465, 0xea41580a, + 0x9ddf8afa, 0x067ac695, 0x50a4d810, 0xcb01947f, 0xbc9f468f, + 0x273a0ae0, 0x53a2e36f, 0xc807af00, 0xbf997df0, 0x243c319f, + 0x56a8aeee, 0xcd0de281, 0xba933071, 0x21367c1e, 0x55ae9591, + 0xce0bd9fe, 0xb9950b0e, 0x22304761, 0x5cbc35ec, 0xc7197983, + 0xb087ab73, 0x2b22e71c, 0x5fba0e93, 0xc41f42fc, 0xb381900c, + 0x2824dc63, 0x5ab04312, 0xc1150f7d, 0xb68bdd8d, 0x2d2e91e2, + 0x59b6786d, 0xc2133402, 0xb58de6f2, 0x2e28aa9d, 0x489503e8, + 0xd3304f87, 0xa4ae9d77, 0x3f0bd118, 0x4b933897, 0xd03674f8, + 0xa7a8a608, 0x3c0dea67, 0x4e997516, 0xd53c3979, 0xa2a2eb89, + 0x3907a7e6, 0x4d9f4e69, 0xd63a0206, 0xa1a4d0f6, 0x3a019c99, + 0x448dee14, 0xdf28a27b, 0xa8b6708b, 0x33133ce4, 0x478bd56b, + 0xdc2e9904, 0xabb04bf4, 0x3015079b, 0x428198ea, 0xd924d485, + 0xaeba0675, 0x351f4a1a, 0x4187a395, 0xda22effa, 0xadbc3d0a, + 0x36197165}, + {0x00000000, 0xc18edfc0, 0x586cb9c1, 0x99e26601, 0xb0d97382, + 0x7157ac42, 0xe8b5ca43, 0x293b1583, 0xbac3e145, 0x7b4d3e85, + 0xe2af5884, 0x23218744, 0x0a1a92c7, 0xcb944d07, 0x52762b06, + 0x93f8f4c6, 0xaef6c4cb, 0x6f781b0b, 0xf69a7d0a, 0x3714a2ca, + 0x1e2fb749, 0xdfa16889, 0x46430e88, 0x87cdd148, 0x1435258e, + 0xd5bbfa4e, 0x4c599c4f, 0x8dd7438f, 0xa4ec560c, 0x656289cc, + 0xfc80efcd, 0x3d0e300d, 0x869c8fd7, 0x47125017, 0xdef03616, + 0x1f7ee9d6, 0x3645fc55, 0xf7cb2395, 0x6e294594, 0xafa79a54, + 0x3c5f6e92, 0xfdd1b152, 0x6433d753, 0xa5bd0893, 0x8c861d10, + 0x4d08c2d0, 0xd4eaa4d1, 0x15647b11, 0x286a4b1c, 0xe9e494dc, + 0x7006f2dd, 0xb1882d1d, 0x98b3389e, 0x593de75e, 0xc0df815f, + 0x01515e9f, 0x92a9aa59, 0x53277599, 0xcac51398, 0x0b4bcc58, + 0x2270d9db, 0xe3fe061b, 0x7a1c601a, 0xbb92bfda, 0xd64819ef, + 0x17c6c62f, 0x8e24a02e, 0x4faa7fee, 0x66916a6d, 0xa71fb5ad, + 0x3efdd3ac, 0xff730c6c, 0x6c8bf8aa, 0xad05276a, 0x34e7416b, + 0xf5699eab, 0xdc528b28, 0x1ddc54e8, 0x843e32e9, 0x45b0ed29, + 0x78bedd24, 0xb93002e4, 0x20d264e5, 0xe15cbb25, 0xc867aea6, + 0x09e97166, 0x900b1767, 0x5185c8a7, 0xc27d3c61, 0x03f3e3a1, + 0x9a1185a0, 0x5b9f5a60, 0x72a44fe3, 0xb32a9023, 0x2ac8f622, + 0xeb4629e2, 0x50d49638, 0x915a49f8, 0x08b82ff9, 0xc936f039, + 0xe00de5ba, 0x21833a7a, 0xb8615c7b, 0x79ef83bb, 0xea17777d, + 0x2b99a8bd, 0xb27bcebc, 0x73f5117c, 0x5ace04ff, 0x9b40db3f, + 0x02a2bd3e, 0xc32c62fe, 0xfe2252f3, 0x3fac8d33, 0xa64eeb32, + 0x67c034f2, 0x4efb2171, 0x8f75feb1, 0x169798b0, 0xd7194770, + 0x44e1b3b6, 0x856f6c76, 0x1c8d0a77, 0xdd03d5b7, 0xf438c034, + 0x35b61ff4, 0xac5479f5, 0x6ddaa635, 0x77e1359f, 0xb66fea5f, + 0x2f8d8c5e, 0xee03539e, 0xc738461d, 0x06b699dd, 0x9f54ffdc, + 0x5eda201c, 0xcd22d4da, 0x0cac0b1a, 0x954e6d1b, 0x54c0b2db, + 0x7dfba758, 0xbc757898, 0x25971e99, 0xe419c159, 0xd917f154, + 0x18992e94, 0x817b4895, 0x40f59755, 0x69ce82d6, 0xa8405d16, + 0x31a23b17, 0xf02ce4d7, 0x63d41011, 0xa25acfd1, 0x3bb8a9d0, + 0xfa367610, 0xd30d6393, 0x1283bc53, 0x8b61da52, 0x4aef0592, + 0xf17dba48, 0x30f36588, 0xa9110389, 0x689fdc49, 0x41a4c9ca, + 0x802a160a, 0x19c8700b, 0xd846afcb, 0x4bbe5b0d, 0x8a3084cd, + 0x13d2e2cc, 0xd25c3d0c, 0xfb67288f, 0x3ae9f74f, 0xa30b914e, + 0x62854e8e, 0x5f8b7e83, 0x9e05a143, 0x07e7c742, 0xc6691882, + 0xef520d01, 0x2edcd2c1, 0xb73eb4c0, 0x76b06b00, 0xe5489fc6, + 0x24c64006, 0xbd242607, 0x7caaf9c7, 0x5591ec44, 0x941f3384, + 0x0dfd5585, 0xcc738a45, 0xa1a92c70, 0x6027f3b0, 0xf9c595b1, + 0x384b4a71, 0x11705ff2, 0xd0fe8032, 0x491ce633, 0x889239f3, + 0x1b6acd35, 0xdae412f5, 0x430674f4, 0x8288ab34, 0xabb3beb7, + 0x6a3d6177, 0xf3df0776, 0x3251d8b6, 0x0f5fe8bb, 0xced1377b, + 0x5733517a, 0x96bd8eba, 0xbf869b39, 0x7e0844f9, 0xe7ea22f8, + 0x2664fd38, 0xb59c09fe, 0x7412d63e, 0xedf0b03f, 0x2c7e6fff, + 0x05457a7c, 0xc4cba5bc, 0x5d29c3bd, 0x9ca71c7d, 0x2735a3a7, + 0xe6bb7c67, 0x7f591a66, 0xbed7c5a6, 0x97ecd025, 0x56620fe5, + 0xcf8069e4, 0x0e0eb624, 0x9df642e2, 0x5c789d22, 0xc59afb23, + 0x041424e3, 0x2d2f3160, 0xeca1eea0, 0x754388a1, 0xb4cd5761, + 0x89c3676c, 0x484db8ac, 0xd1afdead, 0x1021016d, 0x391a14ee, + 0xf894cb2e, 0x6176ad2f, 0xa0f872ef, 0x33008629, 0xf28e59e9, + 0x6b6c3fe8, 0xaae2e028, 0x83d9f5ab, 0x42572a6b, 0xdbb54c6a, + 0x1a3b93aa}, + {0x00000000, 0xefc26b3e, 0x04f5d03d, 0xeb37bb03, 0x09eba07a, + 0xe629cb44, 0x0d1e7047, 0xe2dc1b79, 0x13d740f4, 0xfc152bca, + 0x172290c9, 0xf8e0fbf7, 0x1a3ce08e, 0xf5fe8bb0, 0x1ec930b3, + 0xf10b5b8d, 0x27ae81e8, 0xc86cead6, 0x235b51d5, 0xcc993aeb, + 0x2e452192, 0xc1874aac, 0x2ab0f1af, 0xc5729a91, 0x3479c11c, + 0xdbbbaa22, 0x308c1121, 0xdf4e7a1f, 0x3d926166, 0xd2500a58, + 0x3967b15b, 0xd6a5da65, 0x4f5d03d0, 0xa09f68ee, 0x4ba8d3ed, + 0xa46ab8d3, 0x46b6a3aa, 0xa974c894, 0x42437397, 0xad8118a9, + 0x5c8a4324, 0xb348281a, 0x587f9319, 0xb7bdf827, 0x5561e35e, + 0xbaa38860, 0x51943363, 0xbe56585d, 0x68f38238, 0x8731e906, + 0x6c065205, 0x83c4393b, 0x61182242, 0x8eda497c, 0x65edf27f, + 0x8a2f9941, 0x7b24c2cc, 0x94e6a9f2, 0x7fd112f1, 0x901379cf, + 0x72cf62b6, 0x9d0d0988, 0x763ab28b, 0x99f8d9b5, 0x9eba07a0, + 0x71786c9e, 0x9a4fd79d, 0x758dbca3, 0x9751a7da, 0x7893cce4, + 0x93a477e7, 0x7c661cd9, 0x8d6d4754, 0x62af2c6a, 0x89989769, + 0x665afc57, 0x8486e72e, 0x6b448c10, 0x80733713, 0x6fb15c2d, + 0xb9148648, 0x56d6ed76, 0xbde15675, 0x52233d4b, 0xb0ff2632, + 0x5f3d4d0c, 0xb40af60f, 0x5bc89d31, 0xaac3c6bc, 0x4501ad82, + 0xae361681, 0x41f47dbf, 0xa32866c6, 0x4cea0df8, 0xa7ddb6fb, + 0x481fddc5, 0xd1e70470, 0x3e256f4e, 0xd512d44d, 0x3ad0bf73, + 0xd80ca40a, 0x37cecf34, 0xdcf97437, 0x333b1f09, 0xc2304484, + 0x2df22fba, 0xc6c594b9, 0x2907ff87, 0xcbdbe4fe, 0x24198fc0, + 0xcf2e34c3, 0x20ec5ffd, 0xf6498598, 0x198beea6, 0xf2bc55a5, + 0x1d7e3e9b, 0xffa225e2, 0x10604edc, 0xfb57f5df, 0x14959ee1, + 0xe59ec56c, 0x0a5cae52, 0xe16b1551, 0x0ea97e6f, 0xec756516, + 0x03b70e28, 0xe880b52b, 0x0742de15, 0xe6050901, 0x09c7623f, + 0xe2f0d93c, 0x0d32b202, 0xefeea97b, 0x002cc245, 0xeb1b7946, + 0x04d91278, 0xf5d249f5, 0x1a1022cb, 0xf12799c8, 0x1ee5f2f6, + 0xfc39e98f, 0x13fb82b1, 0xf8cc39b2, 0x170e528c, 0xc1ab88e9, + 0x2e69e3d7, 0xc55e58d4, 0x2a9c33ea, 0xc8402893, 0x278243ad, + 0xccb5f8ae, 0x23779390, 0xd27cc81d, 0x3dbea323, 0xd6891820, + 0x394b731e, 0xdb976867, 0x34550359, 0xdf62b85a, 0x30a0d364, + 0xa9580ad1, 0x469a61ef, 0xadaddaec, 0x426fb1d2, 0xa0b3aaab, + 0x4f71c195, 0xa4467a96, 0x4b8411a8, 0xba8f4a25, 0x554d211b, + 0xbe7a9a18, 0x51b8f126, 0xb364ea5f, 0x5ca68161, 0xb7913a62, + 0x5853515c, 0x8ef68b39, 0x6134e007, 0x8a035b04, 0x65c1303a, + 0x871d2b43, 0x68df407d, 0x83e8fb7e, 0x6c2a9040, 0x9d21cbcd, + 0x72e3a0f3, 0x99d41bf0, 0x761670ce, 0x94ca6bb7, 0x7b080089, + 0x903fbb8a, 0x7ffdd0b4, 0x78bf0ea1, 0x977d659f, 0x7c4ade9c, + 0x9388b5a2, 0x7154aedb, 0x9e96c5e5, 0x75a17ee6, 0x9a6315d8, + 0x6b684e55, 0x84aa256b, 0x6f9d9e68, 0x805ff556, 0x6283ee2f, + 0x8d418511, 0x66763e12, 0x89b4552c, 0x5f118f49, 0xb0d3e477, + 0x5be45f74, 0xb426344a, 0x56fa2f33, 0xb938440d, 0x520fff0e, + 0xbdcd9430, 0x4cc6cfbd, 0xa304a483, 0x48331f80, 0xa7f174be, + 0x452d6fc7, 0xaaef04f9, 0x41d8bffa, 0xae1ad4c4, 0x37e20d71, + 0xd820664f, 0x3317dd4c, 0xdcd5b672, 0x3e09ad0b, 0xd1cbc635, + 0x3afc7d36, 0xd53e1608, 0x24354d85, 0xcbf726bb, 0x20c09db8, + 0xcf02f686, 0x2ddeedff, 0xc21c86c1, 0x292b3dc2, 0xc6e956fc, + 0x104c8c99, 0xff8ee7a7, 0x14b95ca4, 0xfb7b379a, 0x19a72ce3, + 0xf66547dd, 0x1d52fcde, 0xf29097e0, 0x039bcc6d, 0xec59a753, + 0x076e1c50, 0xe8ac776e, 0x0a706c17, 0xe5b20729, 0x0e85bc2a, + 0xe147d714}, + {0x00000000, 0x177b1443, 0x2ef62886, 0x398d3cc5, 0x5dec510c, + 0x4a97454f, 0x731a798a, 0x64616dc9, 0xbbd8a218, 0xaca3b65b, + 0x952e8a9e, 0x82559edd, 0xe634f314, 0xf14fe757, 0xc8c2db92, + 0xdfb9cfd1, 0xacc04271, 0xbbbb5632, 0x82366af7, 0x954d7eb4, + 0xf12c137d, 0xe657073e, 0xdfda3bfb, 0xc8a12fb8, 0x1718e069, + 0x0063f42a, 0x39eec8ef, 0x2e95dcac, 0x4af4b165, 0x5d8fa526, + 0x640299e3, 0x73798da0, 0x82f182a3, 0x958a96e0, 0xac07aa25, + 0xbb7cbe66, 0xdf1dd3af, 0xc866c7ec, 0xf1ebfb29, 0xe690ef6a, + 0x392920bb, 0x2e5234f8, 0x17df083d, 0x00a41c7e, 0x64c571b7, + 0x73be65f4, 0x4a335931, 0x5d484d72, 0x2e31c0d2, 0x394ad491, + 0x00c7e854, 0x17bcfc17, 0x73dd91de, 0x64a6859d, 0x5d2bb958, + 0x4a50ad1b, 0x95e962ca, 0x82927689, 0xbb1f4a4c, 0xac645e0f, + 0xc80533c6, 0xdf7e2785, 0xe6f31b40, 0xf1880f03, 0xde920307, + 0xc9e91744, 0xf0642b81, 0xe71f3fc2, 0x837e520b, 0x94054648, + 0xad887a8d, 0xbaf36ece, 0x654aa11f, 0x7231b55c, 0x4bbc8999, + 0x5cc79dda, 0x38a6f013, 0x2fdde450, 0x1650d895, 0x012bccd6, + 0x72524176, 0x65295535, 0x5ca469f0, 0x4bdf7db3, 0x2fbe107a, + 0x38c50439, 0x014838fc, 0x16332cbf, 0xc98ae36e, 0xdef1f72d, + 0xe77ccbe8, 0xf007dfab, 0x9466b262, 0x831da621, 0xba909ae4, + 0xadeb8ea7, 0x5c6381a4, 0x4b1895e7, 0x7295a922, 0x65eebd61, + 0x018fd0a8, 0x16f4c4eb, 0x2f79f82e, 0x3802ec6d, 0xe7bb23bc, + 0xf0c037ff, 0xc94d0b3a, 0xde361f79, 0xba5772b0, 0xad2c66f3, + 0x94a15a36, 0x83da4e75, 0xf0a3c3d5, 0xe7d8d796, 0xde55eb53, + 0xc92eff10, 0xad4f92d9, 0xba34869a, 0x83b9ba5f, 0x94c2ae1c, + 0x4b7b61cd, 0x5c00758e, 0x658d494b, 0x72f65d08, 0x169730c1, + 0x01ec2482, 0x38611847, 0x2f1a0c04, 0x6655004f, 0x712e140c, + 0x48a328c9, 0x5fd83c8a, 0x3bb95143, 0x2cc24500, 0x154f79c5, + 0x02346d86, 0xdd8da257, 0xcaf6b614, 0xf37b8ad1, 0xe4009e92, + 0x8061f35b, 0x971ae718, 0xae97dbdd, 0xb9eccf9e, 0xca95423e, + 0xddee567d, 0xe4636ab8, 0xf3187efb, 0x97791332, 0x80020771, + 0xb98f3bb4, 0xaef42ff7, 0x714de026, 0x6636f465, 0x5fbbc8a0, + 0x48c0dce3, 0x2ca1b12a, 0x3bdaa569, 0x025799ac, 0x152c8def, + 0xe4a482ec, 0xf3df96af, 0xca52aa6a, 0xdd29be29, 0xb948d3e0, + 0xae33c7a3, 0x97befb66, 0x80c5ef25, 0x5f7c20f4, 0x480734b7, + 0x718a0872, 0x66f11c31, 0x029071f8, 0x15eb65bb, 0x2c66597e, + 0x3b1d4d3d, 0x4864c09d, 0x5f1fd4de, 0x6692e81b, 0x71e9fc58, + 0x15889191, 0x02f385d2, 0x3b7eb917, 0x2c05ad54, 0xf3bc6285, + 0xe4c776c6, 0xdd4a4a03, 0xca315e40, 0xae503389, 0xb92b27ca, + 0x80a61b0f, 0x97dd0f4c, 0xb8c70348, 0xafbc170b, 0x96312bce, + 0x814a3f8d, 0xe52b5244, 0xf2504607, 0xcbdd7ac2, 0xdca66e81, + 0x031fa150, 0x1464b513, 0x2de989d6, 0x3a929d95, 0x5ef3f05c, + 0x4988e41f, 0x7005d8da, 0x677ecc99, 0x14074139, 0x037c557a, + 0x3af169bf, 0x2d8a7dfc, 0x49eb1035, 0x5e900476, 0x671d38b3, + 0x70662cf0, 0xafdfe321, 0xb8a4f762, 0x8129cba7, 0x9652dfe4, + 0xf233b22d, 0xe548a66e, 0xdcc59aab, 0xcbbe8ee8, 0x3a3681eb, + 0x2d4d95a8, 0x14c0a96d, 0x03bbbd2e, 0x67dad0e7, 0x70a1c4a4, + 0x492cf861, 0x5e57ec22, 0x81ee23f3, 0x969537b0, 0xaf180b75, + 0xb8631f36, 0xdc0272ff, 0xcb7966bc, 0xf2f45a79, 0xe58f4e3a, + 0x96f6c39a, 0x818dd7d9, 0xb800eb1c, 0xaf7bff5f, 0xcb1a9296, + 0xdc6186d5, 0xe5ecba10, 0xf297ae53, 0x2d2e6182, 0x3a5575c1, + 0x03d84904, 0x14a35d47, 0x70c2308e, 0x67b924cd, 0x5e341808, + 0x494f0c4b}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x43147b1700000000, 0x8628f62e00000000, + 0xc53c8d3900000000, 0x0c51ec5d00000000, 0x4f45974a00000000, + 0x8a791a7300000000, 0xc96d616400000000, 0x18a2d8bb00000000, + 0x5bb6a3ac00000000, 0x9e8a2e9500000000, 0xdd9e558200000000, + 0x14f334e600000000, 0x57e74ff100000000, 0x92dbc2c800000000, + 0xd1cfb9df00000000, 0x7142c0ac00000000, 0x3256bbbb00000000, + 0xf76a368200000000, 0xb47e4d9500000000, 0x7d132cf100000000, + 0x3e0757e600000000, 0xfb3bdadf00000000, 0xb82fa1c800000000, + 0x69e0181700000000, 0x2af4630000000000, 0xefc8ee3900000000, + 0xacdc952e00000000, 0x65b1f44a00000000, 0x26a58f5d00000000, + 0xe399026400000000, 0xa08d797300000000, 0xa382f18200000000, + 0xe0968a9500000000, 0x25aa07ac00000000, 0x66be7cbb00000000, + 0xafd31ddf00000000, 0xecc766c800000000, 0x29fbebf100000000, + 0x6aef90e600000000, 0xbb20293900000000, 0xf834522e00000000, + 0x3d08df1700000000, 0x7e1ca40000000000, 0xb771c56400000000, + 0xf465be7300000000, 0x3159334a00000000, 0x724d485d00000000, + 0xd2c0312e00000000, 0x91d44a3900000000, 0x54e8c70000000000, + 0x17fcbc1700000000, 0xde91dd7300000000, 0x9d85a66400000000, + 0x58b92b5d00000000, 0x1bad504a00000000, 0xca62e99500000000, + 0x8976928200000000, 0x4c4a1fbb00000000, 0x0f5e64ac00000000, + 0xc63305c800000000, 0x85277edf00000000, 0x401bf3e600000000, + 0x030f88f100000000, 0x070392de00000000, 0x4417e9c900000000, + 0x812b64f000000000, 0xc23f1fe700000000, 0x0b527e8300000000, + 0x4846059400000000, 0x8d7a88ad00000000, 0xce6ef3ba00000000, + 0x1fa14a6500000000, 0x5cb5317200000000, 0x9989bc4b00000000, + 0xda9dc75c00000000, 0x13f0a63800000000, 0x50e4dd2f00000000, + 0x95d8501600000000, 0xd6cc2b0100000000, 0x7641527200000000, + 0x3555296500000000, 0xf069a45c00000000, 0xb37ddf4b00000000, + 0x7a10be2f00000000, 0x3904c53800000000, 0xfc38480100000000, + 0xbf2c331600000000, 0x6ee38ac900000000, 0x2df7f1de00000000, + 0xe8cb7ce700000000, 0xabdf07f000000000, 0x62b2669400000000, + 0x21a61d8300000000, 0xe49a90ba00000000, 0xa78eebad00000000, + 0xa481635c00000000, 0xe795184b00000000, 0x22a9957200000000, + 0x61bdee6500000000, 0xa8d08f0100000000, 0xebc4f41600000000, + 0x2ef8792f00000000, 0x6dec023800000000, 0xbc23bbe700000000, + 0xff37c0f000000000, 0x3a0b4dc900000000, 0x791f36de00000000, + 0xb07257ba00000000, 0xf3662cad00000000, 0x365aa19400000000, + 0x754eda8300000000, 0xd5c3a3f000000000, 0x96d7d8e700000000, + 0x53eb55de00000000, 0x10ff2ec900000000, 0xd9924fad00000000, + 0x9a8634ba00000000, 0x5fbab98300000000, 0x1caec29400000000, + 0xcd617b4b00000000, 0x8e75005c00000000, 0x4b498d6500000000, + 0x085df67200000000, 0xc130971600000000, 0x8224ec0100000000, + 0x4718613800000000, 0x040c1a2f00000000, 0x4f00556600000000, + 0x0c142e7100000000, 0xc928a34800000000, 0x8a3cd85f00000000, + 0x4351b93b00000000, 0x0045c22c00000000, 0xc5794f1500000000, + 0x866d340200000000, 0x57a28ddd00000000, 0x14b6f6ca00000000, + 0xd18a7bf300000000, 0x929e00e400000000, 0x5bf3618000000000, + 0x18e71a9700000000, 0xdddb97ae00000000, 0x9ecfecb900000000, + 0x3e4295ca00000000, 0x7d56eedd00000000, 0xb86a63e400000000, + 0xfb7e18f300000000, 0x3213799700000000, 0x7107028000000000, + 0xb43b8fb900000000, 0xf72ff4ae00000000, 0x26e04d7100000000, + 0x65f4366600000000, 0xa0c8bb5f00000000, 0xe3dcc04800000000, + 0x2ab1a12c00000000, 0x69a5da3b00000000, 0xac99570200000000, + 0xef8d2c1500000000, 0xec82a4e400000000, 0xaf96dff300000000, + 0x6aaa52ca00000000, 0x29be29dd00000000, 0xe0d348b900000000, + 0xa3c733ae00000000, 0x66fbbe9700000000, 0x25efc58000000000, + 0xf4207c5f00000000, 0xb734074800000000, 0x72088a7100000000, + 0x311cf16600000000, 0xf871900200000000, 0xbb65eb1500000000, + 0x7e59662c00000000, 0x3d4d1d3b00000000, 0x9dc0644800000000, + 0xded41f5f00000000, 0x1be8926600000000, 0x58fce97100000000, + 0x9191881500000000, 0xd285f30200000000, 0x17b97e3b00000000, + 0x54ad052c00000000, 0x8562bcf300000000, 0xc676c7e400000000, + 0x034a4add00000000, 0x405e31ca00000000, 0x893350ae00000000, + 0xca272bb900000000, 0x0f1ba68000000000, 0x4c0fdd9700000000, + 0x4803c7b800000000, 0x0b17bcaf00000000, 0xce2b319600000000, + 0x8d3f4a8100000000, 0x44522be500000000, 0x074650f200000000, + 0xc27addcb00000000, 0x816ea6dc00000000, 0x50a11f0300000000, + 0x13b5641400000000, 0xd689e92d00000000, 0x959d923a00000000, + 0x5cf0f35e00000000, 0x1fe4884900000000, 0xdad8057000000000, + 0x99cc7e6700000000, 0x3941071400000000, 0x7a557c0300000000, + 0xbf69f13a00000000, 0xfc7d8a2d00000000, 0x3510eb4900000000, + 0x7604905e00000000, 0xb3381d6700000000, 0xf02c667000000000, + 0x21e3dfaf00000000, 0x62f7a4b800000000, 0xa7cb298100000000, + 0xe4df529600000000, 0x2db233f200000000, 0x6ea648e500000000, + 0xab9ac5dc00000000, 0xe88ebecb00000000, 0xeb81363a00000000, + 0xa8954d2d00000000, 0x6da9c01400000000, 0x2ebdbb0300000000, + 0xe7d0da6700000000, 0xa4c4a17000000000, 0x61f82c4900000000, + 0x22ec575e00000000, 0xf323ee8100000000, 0xb037959600000000, + 0x750b18af00000000, 0x361f63b800000000, 0xff7202dc00000000, + 0xbc6679cb00000000, 0x795af4f200000000, 0x3a4e8fe500000000, + 0x9ac3f69600000000, 0xd9d78d8100000000, 0x1ceb00b800000000, + 0x5fff7baf00000000, 0x96921acb00000000, 0xd58661dc00000000, + 0x10baece500000000, 0x53ae97f200000000, 0x82612e2d00000000, + 0xc175553a00000000, 0x0449d80300000000, 0x475da31400000000, + 0x8e30c27000000000, 0xcd24b96700000000, 0x0818345e00000000, + 0x4b0c4f4900000000}, + {0x0000000000000000, 0x3e6bc2ef00000000, 0x3dd0f50400000000, + 0x03bb37eb00000000, 0x7aa0eb0900000000, 0x44cb29e600000000, + 0x47701e0d00000000, 0x791bdce200000000, 0xf440d71300000000, + 0xca2b15fc00000000, 0xc990221700000000, 0xf7fbe0f800000000, + 0x8ee03c1a00000000, 0xb08bfef500000000, 0xb330c91e00000000, + 0x8d5b0bf100000000, 0xe881ae2700000000, 0xd6ea6cc800000000, + 0xd5515b2300000000, 0xeb3a99cc00000000, 0x9221452e00000000, + 0xac4a87c100000000, 0xaff1b02a00000000, 0x919a72c500000000, + 0x1cc1793400000000, 0x22aabbdb00000000, 0x21118c3000000000, + 0x1f7a4edf00000000, 0x6661923d00000000, 0x580a50d200000000, + 0x5bb1673900000000, 0x65daa5d600000000, 0xd0035d4f00000000, + 0xee689fa000000000, 0xedd3a84b00000000, 0xd3b86aa400000000, + 0xaaa3b64600000000, 0x94c874a900000000, 0x9773434200000000, + 0xa91881ad00000000, 0x24438a5c00000000, 0x1a2848b300000000, + 0x19937f5800000000, 0x27f8bdb700000000, 0x5ee3615500000000, + 0x6088a3ba00000000, 0x6333945100000000, 0x5d5856be00000000, + 0x3882f36800000000, 0x06e9318700000000, 0x0552066c00000000, + 0x3b39c48300000000, 0x4222186100000000, 0x7c49da8e00000000, + 0x7ff2ed6500000000, 0x41992f8a00000000, 0xccc2247b00000000, + 0xf2a9e69400000000, 0xf112d17f00000000, 0xcf79139000000000, + 0xb662cf7200000000, 0x88090d9d00000000, 0x8bb23a7600000000, + 0xb5d9f89900000000, 0xa007ba9e00000000, 0x9e6c787100000000, + 0x9dd74f9a00000000, 0xa3bc8d7500000000, 0xdaa7519700000000, + 0xe4cc937800000000, 0xe777a49300000000, 0xd91c667c00000000, + 0x54476d8d00000000, 0x6a2caf6200000000, 0x6997988900000000, + 0x57fc5a6600000000, 0x2ee7868400000000, 0x108c446b00000000, + 0x1337738000000000, 0x2d5cb16f00000000, 0x488614b900000000, + 0x76edd65600000000, 0x7556e1bd00000000, 0x4b3d235200000000, + 0x3226ffb000000000, 0x0c4d3d5f00000000, 0x0ff60ab400000000, + 0x319dc85b00000000, 0xbcc6c3aa00000000, 0x82ad014500000000, + 0x811636ae00000000, 0xbf7df44100000000, 0xc66628a300000000, + 0xf80dea4c00000000, 0xfbb6dda700000000, 0xc5dd1f4800000000, + 0x7004e7d100000000, 0x4e6f253e00000000, 0x4dd412d500000000, + 0x73bfd03a00000000, 0x0aa40cd800000000, 0x34cfce3700000000, + 0x3774f9dc00000000, 0x091f3b3300000000, 0x844430c200000000, + 0xba2ff22d00000000, 0xb994c5c600000000, 0x87ff072900000000, + 0xfee4dbcb00000000, 0xc08f192400000000, 0xc3342ecf00000000, + 0xfd5fec2000000000, 0x988549f600000000, 0xa6ee8b1900000000, + 0xa555bcf200000000, 0x9b3e7e1d00000000, 0xe225a2ff00000000, + 0xdc4e601000000000, 0xdff557fb00000000, 0xe19e951400000000, + 0x6cc59ee500000000, 0x52ae5c0a00000000, 0x51156be100000000, + 0x6f7ea90e00000000, 0x166575ec00000000, 0x280eb70300000000, + 0x2bb580e800000000, 0x15de420700000000, 0x010905e600000000, + 0x3f62c70900000000, 0x3cd9f0e200000000, 0x02b2320d00000000, + 0x7ba9eeef00000000, 0x45c22c0000000000, 0x46791beb00000000, + 0x7812d90400000000, 0xf549d2f500000000, 0xcb22101a00000000, + 0xc89927f100000000, 0xf6f2e51e00000000, 0x8fe939fc00000000, + 0xb182fb1300000000, 0xb239ccf800000000, 0x8c520e1700000000, + 0xe988abc100000000, 0xd7e3692e00000000, 0xd4585ec500000000, + 0xea339c2a00000000, 0x932840c800000000, 0xad43822700000000, + 0xaef8b5cc00000000, 0x9093772300000000, 0x1dc87cd200000000, + 0x23a3be3d00000000, 0x201889d600000000, 0x1e734b3900000000, + 0x676897db00000000, 0x5903553400000000, 0x5ab862df00000000, + 0x64d3a03000000000, 0xd10a58a900000000, 0xef619a4600000000, + 0xecdaadad00000000, 0xd2b16f4200000000, 0xabaab3a000000000, + 0x95c1714f00000000, 0x967a46a400000000, 0xa811844b00000000, + 0x254a8fba00000000, 0x1b214d5500000000, 0x189a7abe00000000, + 0x26f1b85100000000, 0x5fea64b300000000, 0x6181a65c00000000, + 0x623a91b700000000, 0x5c51535800000000, 0x398bf68e00000000, + 0x07e0346100000000, 0x045b038a00000000, 0x3a30c16500000000, + 0x432b1d8700000000, 0x7d40df6800000000, 0x7efbe88300000000, + 0x40902a6c00000000, 0xcdcb219d00000000, 0xf3a0e37200000000, + 0xf01bd49900000000, 0xce70167600000000, 0xb76bca9400000000, + 0x8900087b00000000, 0x8abb3f9000000000, 0xb4d0fd7f00000000, + 0xa10ebf7800000000, 0x9f657d9700000000, 0x9cde4a7c00000000, + 0xa2b5889300000000, 0xdbae547100000000, 0xe5c5969e00000000, + 0xe67ea17500000000, 0xd815639a00000000, 0x554e686b00000000, + 0x6b25aa8400000000, 0x689e9d6f00000000, 0x56f55f8000000000, + 0x2fee836200000000, 0x1185418d00000000, 0x123e766600000000, + 0x2c55b48900000000, 0x498f115f00000000, 0x77e4d3b000000000, + 0x745fe45b00000000, 0x4a3426b400000000, 0x332ffa5600000000, + 0x0d4438b900000000, 0x0eff0f5200000000, 0x3094cdbd00000000, + 0xbdcfc64c00000000, 0x83a404a300000000, 0x801f334800000000, + 0xbe74f1a700000000, 0xc76f2d4500000000, 0xf904efaa00000000, + 0xfabfd84100000000, 0xc4d41aae00000000, 0x710de23700000000, + 0x4f6620d800000000, 0x4cdd173300000000, 0x72b6d5dc00000000, + 0x0bad093e00000000, 0x35c6cbd100000000, 0x367dfc3a00000000, + 0x08163ed500000000, 0x854d352400000000, 0xbb26f7cb00000000, + 0xb89dc02000000000, 0x86f602cf00000000, 0xffedde2d00000000, + 0xc1861cc200000000, 0xc23d2b2900000000, 0xfc56e9c600000000, + 0x998c4c1000000000, 0xa7e78eff00000000, 0xa45cb91400000000, + 0x9a377bfb00000000, 0xe32ca71900000000, 0xdd4765f600000000, + 0xdefc521d00000000, 0xe09790f200000000, 0x6dcc9b0300000000, + 0x53a759ec00000000, 0x501c6e0700000000, 0x6e77ace800000000, + 0x176c700a00000000, 0x2907b2e500000000, 0x2abc850e00000000, + 0x14d747e100000000}, + {0x0000000000000000, 0xc0df8ec100000000, 0xc1b96c5800000000, + 0x0166e29900000000, 0x8273d9b000000000, 0x42ac577100000000, + 0x43cab5e800000000, 0x83153b2900000000, 0x45e1c3ba00000000, + 0x853e4d7b00000000, 0x8458afe200000000, 0x4487212300000000, + 0xc7921a0a00000000, 0x074d94cb00000000, 0x062b765200000000, + 0xc6f4f89300000000, 0xcbc4f6ae00000000, 0x0b1b786f00000000, + 0x0a7d9af600000000, 0xcaa2143700000000, 0x49b72f1e00000000, + 0x8968a1df00000000, 0x880e434600000000, 0x48d1cd8700000000, + 0x8e25351400000000, 0x4efabbd500000000, 0x4f9c594c00000000, + 0x8f43d78d00000000, 0x0c56eca400000000, 0xcc89626500000000, + 0xcdef80fc00000000, 0x0d300e3d00000000, 0xd78f9c8600000000, + 0x1750124700000000, 0x1636f0de00000000, 0xd6e97e1f00000000, + 0x55fc453600000000, 0x9523cbf700000000, 0x9445296e00000000, + 0x549aa7af00000000, 0x926e5f3c00000000, 0x52b1d1fd00000000, + 0x53d7336400000000, 0x9308bda500000000, 0x101d868c00000000, + 0xd0c2084d00000000, 0xd1a4ead400000000, 0x117b641500000000, + 0x1c4b6a2800000000, 0xdc94e4e900000000, 0xddf2067000000000, + 0x1d2d88b100000000, 0x9e38b39800000000, 0x5ee73d5900000000, + 0x5f81dfc000000000, 0x9f5e510100000000, 0x59aaa99200000000, + 0x9975275300000000, 0x9813c5ca00000000, 0x58cc4b0b00000000, + 0xdbd9702200000000, 0x1b06fee300000000, 0x1a601c7a00000000, + 0xdabf92bb00000000, 0xef1948d600000000, 0x2fc6c61700000000, + 0x2ea0248e00000000, 0xee7faa4f00000000, 0x6d6a916600000000, + 0xadb51fa700000000, 0xacd3fd3e00000000, 0x6c0c73ff00000000, + 0xaaf88b6c00000000, 0x6a2705ad00000000, 0x6b41e73400000000, + 0xab9e69f500000000, 0x288b52dc00000000, 0xe854dc1d00000000, + 0xe9323e8400000000, 0x29edb04500000000, 0x24ddbe7800000000, + 0xe40230b900000000, 0xe564d22000000000, 0x25bb5ce100000000, + 0xa6ae67c800000000, 0x6671e90900000000, 0x67170b9000000000, + 0xa7c8855100000000, 0x613c7dc200000000, 0xa1e3f30300000000, + 0xa085119a00000000, 0x605a9f5b00000000, 0xe34fa47200000000, + 0x23902ab300000000, 0x22f6c82a00000000, 0xe22946eb00000000, + 0x3896d45000000000, 0xf8495a9100000000, 0xf92fb80800000000, + 0x39f036c900000000, 0xbae50de000000000, 0x7a3a832100000000, + 0x7b5c61b800000000, 0xbb83ef7900000000, 0x7d7717ea00000000, + 0xbda8992b00000000, 0xbcce7bb200000000, 0x7c11f57300000000, + 0xff04ce5a00000000, 0x3fdb409b00000000, 0x3ebda20200000000, + 0xfe622cc300000000, 0xf35222fe00000000, 0x338dac3f00000000, + 0x32eb4ea600000000, 0xf234c06700000000, 0x7121fb4e00000000, + 0xb1fe758f00000000, 0xb098971600000000, 0x704719d700000000, + 0xb6b3e14400000000, 0x766c6f8500000000, 0x770a8d1c00000000, + 0xb7d503dd00000000, 0x34c038f400000000, 0xf41fb63500000000, + 0xf57954ac00000000, 0x35a6da6d00000000, 0x9f35e17700000000, + 0x5fea6fb600000000, 0x5e8c8d2f00000000, 0x9e5303ee00000000, + 0x1d4638c700000000, 0xdd99b60600000000, 0xdcff549f00000000, + 0x1c20da5e00000000, 0xdad422cd00000000, 0x1a0bac0c00000000, + 0x1b6d4e9500000000, 0xdbb2c05400000000, 0x58a7fb7d00000000, + 0x987875bc00000000, 0x991e972500000000, 0x59c119e400000000, + 0x54f117d900000000, 0x942e991800000000, 0x95487b8100000000, + 0x5597f54000000000, 0xd682ce6900000000, 0x165d40a800000000, + 0x173ba23100000000, 0xd7e42cf000000000, 0x1110d46300000000, + 0xd1cf5aa200000000, 0xd0a9b83b00000000, 0x107636fa00000000, + 0x93630dd300000000, 0x53bc831200000000, 0x52da618b00000000, + 0x9205ef4a00000000, 0x48ba7df100000000, 0x8865f33000000000, + 0x890311a900000000, 0x49dc9f6800000000, 0xcac9a44100000000, + 0x0a162a8000000000, 0x0b70c81900000000, 0xcbaf46d800000000, + 0x0d5bbe4b00000000, 0xcd84308a00000000, 0xcce2d21300000000, + 0x0c3d5cd200000000, 0x8f2867fb00000000, 0x4ff7e93a00000000, + 0x4e910ba300000000, 0x8e4e856200000000, 0x837e8b5f00000000, + 0x43a1059e00000000, 0x42c7e70700000000, 0x821869c600000000, + 0x010d52ef00000000, 0xc1d2dc2e00000000, 0xc0b43eb700000000, + 0x006bb07600000000, 0xc69f48e500000000, 0x0640c62400000000, + 0x072624bd00000000, 0xc7f9aa7c00000000, 0x44ec915500000000, + 0x84331f9400000000, 0x8555fd0d00000000, 0x458a73cc00000000, + 0x702ca9a100000000, 0xb0f3276000000000, 0xb195c5f900000000, + 0x714a4b3800000000, 0xf25f701100000000, 0x3280fed000000000, + 0x33e61c4900000000, 0xf339928800000000, 0x35cd6a1b00000000, + 0xf512e4da00000000, 0xf474064300000000, 0x34ab888200000000, + 0xb7beb3ab00000000, 0x77613d6a00000000, 0x7607dff300000000, + 0xb6d8513200000000, 0xbbe85f0f00000000, 0x7b37d1ce00000000, + 0x7a51335700000000, 0xba8ebd9600000000, 0x399b86bf00000000, + 0xf944087e00000000, 0xf822eae700000000, 0x38fd642600000000, + 0xfe099cb500000000, 0x3ed6127400000000, 0x3fb0f0ed00000000, + 0xff6f7e2c00000000, 0x7c7a450500000000, 0xbca5cbc400000000, + 0xbdc3295d00000000, 0x7d1ca79c00000000, 0xa7a3352700000000, + 0x677cbbe600000000, 0x661a597f00000000, 0xa6c5d7be00000000, + 0x25d0ec9700000000, 0xe50f625600000000, 0xe46980cf00000000, + 0x24b60e0e00000000, 0xe242f69d00000000, 0x229d785c00000000, + 0x23fb9ac500000000, 0xe324140400000000, 0x60312f2d00000000, + 0xa0eea1ec00000000, 0xa188437500000000, 0x6157cdb400000000, + 0x6c67c38900000000, 0xacb84d4800000000, 0xaddeafd100000000, + 0x6d01211000000000, 0xee141a3900000000, 0x2ecb94f800000000, + 0x2fad766100000000, 0xef72f8a000000000, 0x2986003300000000, + 0xe9598ef200000000, 0xe83f6c6b00000000, 0x28e0e2aa00000000, + 0xabf5d98300000000, 0x6b2a574200000000, 0x6a4cb5db00000000, + 0xaa933b1a00000000}, + {0x0000000000000000, 0x6f4ca59b00000000, 0x9f9e3bec00000000, + 0xf0d29e7700000000, 0x7f3b060300000000, 0x1077a39800000000, + 0xe0a53def00000000, 0x8fe9987400000000, 0xfe760c0600000000, + 0x913aa99d00000000, 0x61e837ea00000000, 0x0ea4927100000000, + 0x814d0a0500000000, 0xee01af9e00000000, 0x1ed331e900000000, + 0x719f947200000000, 0xfced180c00000000, 0x93a1bd9700000000, + 0x637323e000000000, 0x0c3f867b00000000, 0x83d61e0f00000000, + 0xec9abb9400000000, 0x1c4825e300000000, 0x7304807800000000, + 0x029b140a00000000, 0x6dd7b19100000000, 0x9d052fe600000000, + 0xf2498a7d00000000, 0x7da0120900000000, 0x12ecb79200000000, + 0xe23e29e500000000, 0x8d728c7e00000000, 0xf8db311800000000, + 0x9797948300000000, 0x67450af400000000, 0x0809af6f00000000, + 0x87e0371b00000000, 0xe8ac928000000000, 0x187e0cf700000000, + 0x7732a96c00000000, 0x06ad3d1e00000000, 0x69e1988500000000, + 0x993306f200000000, 0xf67fa36900000000, 0x79963b1d00000000, + 0x16da9e8600000000, 0xe60800f100000000, 0x8944a56a00000000, + 0x0436291400000000, 0x6b7a8c8f00000000, 0x9ba812f800000000, + 0xf4e4b76300000000, 0x7b0d2f1700000000, 0x14418a8c00000000, + 0xe49314fb00000000, 0x8bdfb16000000000, 0xfa40251200000000, + 0x950c808900000000, 0x65de1efe00000000, 0x0a92bb6500000000, + 0x857b231100000000, 0xea37868a00000000, 0x1ae518fd00000000, + 0x75a9bd6600000000, 0xf0b7633000000000, 0x9ffbc6ab00000000, + 0x6f2958dc00000000, 0x0065fd4700000000, 0x8f8c653300000000, + 0xe0c0c0a800000000, 0x10125edf00000000, 0x7f5efb4400000000, + 0x0ec16f3600000000, 0x618dcaad00000000, 0x915f54da00000000, + 0xfe13f14100000000, 0x71fa693500000000, 0x1eb6ccae00000000, + 0xee6452d900000000, 0x8128f74200000000, 0x0c5a7b3c00000000, + 0x6316dea700000000, 0x93c440d000000000, 0xfc88e54b00000000, + 0x73617d3f00000000, 0x1c2dd8a400000000, 0xecff46d300000000, + 0x83b3e34800000000, 0xf22c773a00000000, 0x9d60d2a100000000, + 0x6db24cd600000000, 0x02fee94d00000000, 0x8d17713900000000, + 0xe25bd4a200000000, 0x12894ad500000000, 0x7dc5ef4e00000000, + 0x086c522800000000, 0x6720f7b300000000, 0x97f269c400000000, + 0xf8becc5f00000000, 0x7757542b00000000, 0x181bf1b000000000, + 0xe8c96fc700000000, 0x8785ca5c00000000, 0xf61a5e2e00000000, + 0x9956fbb500000000, 0x698465c200000000, 0x06c8c05900000000, + 0x8921582d00000000, 0xe66dfdb600000000, 0x16bf63c100000000, + 0x79f3c65a00000000, 0xf4814a2400000000, 0x9bcdefbf00000000, + 0x6b1f71c800000000, 0x0453d45300000000, 0x8bba4c2700000000, + 0xe4f6e9bc00000000, 0x142477cb00000000, 0x7b68d25000000000, + 0x0af7462200000000, 0x65bbe3b900000000, 0x95697dce00000000, + 0xfa25d85500000000, 0x75cc402100000000, 0x1a80e5ba00000000, + 0xea527bcd00000000, 0x851ede5600000000, 0xe06fc76000000000, + 0x8f2362fb00000000, 0x7ff1fc8c00000000, 0x10bd591700000000, + 0x9f54c16300000000, 0xf01864f800000000, 0x00cafa8f00000000, + 0x6f865f1400000000, 0x1e19cb6600000000, 0x71556efd00000000, + 0x8187f08a00000000, 0xeecb551100000000, 0x6122cd6500000000, + 0x0e6e68fe00000000, 0xfebcf68900000000, 0x91f0531200000000, + 0x1c82df6c00000000, 0x73ce7af700000000, 0x831ce48000000000, + 0xec50411b00000000, 0x63b9d96f00000000, 0x0cf57cf400000000, + 0xfc27e28300000000, 0x936b471800000000, 0xe2f4d36a00000000, + 0x8db876f100000000, 0x7d6ae88600000000, 0x12264d1d00000000, + 0x9dcfd56900000000, 0xf28370f200000000, 0x0251ee8500000000, + 0x6d1d4b1e00000000, 0x18b4f67800000000, 0x77f853e300000000, + 0x872acd9400000000, 0xe866680f00000000, 0x678ff07b00000000, + 0x08c355e000000000, 0xf811cb9700000000, 0x975d6e0c00000000, + 0xe6c2fa7e00000000, 0x898e5fe500000000, 0x795cc19200000000, + 0x1610640900000000, 0x99f9fc7d00000000, 0xf6b559e600000000, + 0x0667c79100000000, 0x692b620a00000000, 0xe459ee7400000000, + 0x8b154bef00000000, 0x7bc7d59800000000, 0x148b700300000000, + 0x9b62e87700000000, 0xf42e4dec00000000, 0x04fcd39b00000000, + 0x6bb0760000000000, 0x1a2fe27200000000, 0x756347e900000000, + 0x85b1d99e00000000, 0xeafd7c0500000000, 0x6514e47100000000, + 0x0a5841ea00000000, 0xfa8adf9d00000000, 0x95c67a0600000000, + 0x10d8a45000000000, 0x7f9401cb00000000, 0x8f469fbc00000000, + 0xe00a3a2700000000, 0x6fe3a25300000000, 0x00af07c800000000, + 0xf07d99bf00000000, 0x9f313c2400000000, 0xeeaea85600000000, + 0x81e20dcd00000000, 0x713093ba00000000, 0x1e7c362100000000, + 0x9195ae5500000000, 0xfed90bce00000000, 0x0e0b95b900000000, + 0x6147302200000000, 0xec35bc5c00000000, 0x837919c700000000, + 0x73ab87b000000000, 0x1ce7222b00000000, 0x930eba5f00000000, + 0xfc421fc400000000, 0x0c9081b300000000, 0x63dc242800000000, + 0x1243b05a00000000, 0x7d0f15c100000000, 0x8ddd8bb600000000, + 0xe2912e2d00000000, 0x6d78b65900000000, 0x023413c200000000, + 0xf2e68db500000000, 0x9daa282e00000000, 0xe803954800000000, + 0x874f30d300000000, 0x779daea400000000, 0x18d10b3f00000000, + 0x9738934b00000000, 0xf87436d000000000, 0x08a6a8a700000000, + 0x67ea0d3c00000000, 0x1675994e00000000, 0x79393cd500000000, + 0x89eba2a200000000, 0xe6a7073900000000, 0x694e9f4d00000000, + 0x06023ad600000000, 0xf6d0a4a100000000, 0x999c013a00000000, + 0x14ee8d4400000000, 0x7ba228df00000000, 0x8b70b6a800000000, + 0xe43c133300000000, 0x6bd58b4700000000, 0x04992edc00000000, + 0xf44bb0ab00000000, 0x9b07153000000000, 0xea98814200000000, + 0x85d424d900000000, 0x7506baae00000000, 0x1a4a1f3500000000, + 0x95a3874100000000, 0xfaef22da00000000, 0x0a3dbcad00000000, + 0x6571193600000000}, + {0x0000000000000000, 0x85d996dd00000000, 0x4bb55c6000000000, + 0xce6ccabd00000000, 0x966ab9c000000000, 0x13b32f1d00000000, + 0xdddfe5a000000000, 0x5806737d00000000, 0x6dd3035a00000000, + 0xe80a958700000000, 0x26665f3a00000000, 0xa3bfc9e700000000, + 0xfbb9ba9a00000000, 0x7e602c4700000000, 0xb00ce6fa00000000, + 0x35d5702700000000, 0xdaa607b400000000, 0x5f7f916900000000, + 0x91135bd400000000, 0x14cacd0900000000, 0x4cccbe7400000000, + 0xc91528a900000000, 0x0779e21400000000, 0x82a074c900000000, + 0xb77504ee00000000, 0x32ac923300000000, 0xfcc0588e00000000, + 0x7919ce5300000000, 0x211fbd2e00000000, 0xa4c62bf300000000, + 0x6aaae14e00000000, 0xef73779300000000, 0xf54b7eb300000000, + 0x7092e86e00000000, 0xbefe22d300000000, 0x3b27b40e00000000, + 0x6321c77300000000, 0xe6f851ae00000000, 0x28949b1300000000, + 0xad4d0dce00000000, 0x98987de900000000, 0x1d41eb3400000000, + 0xd32d218900000000, 0x56f4b75400000000, 0x0ef2c42900000000, + 0x8b2b52f400000000, 0x4547984900000000, 0xc09e0e9400000000, + 0x2fed790700000000, 0xaa34efda00000000, 0x6458256700000000, + 0xe181b3ba00000000, 0xb987c0c700000000, 0x3c5e561a00000000, + 0xf2329ca700000000, 0x77eb0a7a00000000, 0x423e7a5d00000000, + 0xc7e7ec8000000000, 0x098b263d00000000, 0x8c52b0e000000000, + 0xd454c39d00000000, 0x518d554000000000, 0x9fe19ffd00000000, + 0x1a38092000000000, 0xab918dbd00000000, 0x2e481b6000000000, + 0xe024d1dd00000000, 0x65fd470000000000, 0x3dfb347d00000000, + 0xb822a2a000000000, 0x764e681d00000000, 0xf397fec000000000, + 0xc6428ee700000000, 0x439b183a00000000, 0x8df7d28700000000, + 0x082e445a00000000, 0x5028372700000000, 0xd5f1a1fa00000000, + 0x1b9d6b4700000000, 0x9e44fd9a00000000, 0x71378a0900000000, + 0xf4ee1cd400000000, 0x3a82d66900000000, 0xbf5b40b400000000, + 0xe75d33c900000000, 0x6284a51400000000, 0xace86fa900000000, + 0x2931f97400000000, 0x1ce4895300000000, 0x993d1f8e00000000, + 0x5751d53300000000, 0xd28843ee00000000, 0x8a8e309300000000, + 0x0f57a64e00000000, 0xc13b6cf300000000, 0x44e2fa2e00000000, + 0x5edaf30e00000000, 0xdb0365d300000000, 0x156faf6e00000000, + 0x90b639b300000000, 0xc8b04ace00000000, 0x4d69dc1300000000, + 0x830516ae00000000, 0x06dc807300000000, 0x3309f05400000000, + 0xb6d0668900000000, 0x78bcac3400000000, 0xfd653ae900000000, + 0xa563499400000000, 0x20badf4900000000, 0xeed615f400000000, + 0x6b0f832900000000, 0x847cf4ba00000000, 0x01a5626700000000, + 0xcfc9a8da00000000, 0x4a103e0700000000, 0x12164d7a00000000, + 0x97cfdba700000000, 0x59a3111a00000000, 0xdc7a87c700000000, + 0xe9aff7e000000000, 0x6c76613d00000000, 0xa21aab8000000000, + 0x27c33d5d00000000, 0x7fc54e2000000000, 0xfa1cd8fd00000000, + 0x3470124000000000, 0xb1a9849d00000000, 0x17256aa000000000, + 0x92fcfc7d00000000, 0x5c9036c000000000, 0xd949a01d00000000, + 0x814fd36000000000, 0x049645bd00000000, 0xcafa8f0000000000, + 0x4f2319dd00000000, 0x7af669fa00000000, 0xff2fff2700000000, + 0x3143359a00000000, 0xb49aa34700000000, 0xec9cd03a00000000, + 0x694546e700000000, 0xa7298c5a00000000, 0x22f01a8700000000, + 0xcd836d1400000000, 0x485afbc900000000, 0x8636317400000000, + 0x03efa7a900000000, 0x5be9d4d400000000, 0xde30420900000000, + 0x105c88b400000000, 0x95851e6900000000, 0xa0506e4e00000000, + 0x2589f89300000000, 0xebe5322e00000000, 0x6e3ca4f300000000, + 0x363ad78e00000000, 0xb3e3415300000000, 0x7d8f8bee00000000, + 0xf8561d3300000000, 0xe26e141300000000, 0x67b782ce00000000, + 0xa9db487300000000, 0x2c02deae00000000, 0x7404add300000000, + 0xf1dd3b0e00000000, 0x3fb1f1b300000000, 0xba68676e00000000, + 0x8fbd174900000000, 0x0a64819400000000, 0xc4084b2900000000, + 0x41d1ddf400000000, 0x19d7ae8900000000, 0x9c0e385400000000, + 0x5262f2e900000000, 0xd7bb643400000000, 0x38c813a700000000, + 0xbd11857a00000000, 0x737d4fc700000000, 0xf6a4d91a00000000, + 0xaea2aa6700000000, 0x2b7b3cba00000000, 0xe517f60700000000, + 0x60ce60da00000000, 0x551b10fd00000000, 0xd0c2862000000000, + 0x1eae4c9d00000000, 0x9b77da4000000000, 0xc371a93d00000000, + 0x46a83fe000000000, 0x88c4f55d00000000, 0x0d1d638000000000, + 0xbcb4e71d00000000, 0x396d71c000000000, 0xf701bb7d00000000, + 0x72d82da000000000, 0x2ade5edd00000000, 0xaf07c80000000000, + 0x616b02bd00000000, 0xe4b2946000000000, 0xd167e44700000000, + 0x54be729a00000000, 0x9ad2b82700000000, 0x1f0b2efa00000000, + 0x470d5d8700000000, 0xc2d4cb5a00000000, 0x0cb801e700000000, + 0x8961973a00000000, 0x6612e0a900000000, 0xe3cb767400000000, + 0x2da7bcc900000000, 0xa87e2a1400000000, 0xf078596900000000, + 0x75a1cfb400000000, 0xbbcd050900000000, 0x3e1493d400000000, + 0x0bc1e3f300000000, 0x8e18752e00000000, 0x4074bf9300000000, + 0xc5ad294e00000000, 0x9dab5a3300000000, 0x1872ccee00000000, + 0xd61e065300000000, 0x53c7908e00000000, 0x49ff99ae00000000, + 0xcc260f7300000000, 0x024ac5ce00000000, 0x8793531300000000, + 0xdf95206e00000000, 0x5a4cb6b300000000, 0x94207c0e00000000, + 0x11f9ead300000000, 0x242c9af400000000, 0xa1f50c2900000000, + 0x6f99c69400000000, 0xea40504900000000, 0xb246233400000000, + 0x379fb5e900000000, 0xf9f37f5400000000, 0x7c2ae98900000000, + 0x93599e1a00000000, 0x168008c700000000, 0xd8ecc27a00000000, + 0x5d3554a700000000, 0x053327da00000000, 0x80eab10700000000, + 0x4e867bba00000000, 0xcb5fed6700000000, 0xfe8a9d4000000000, + 0x7b530b9d00000000, 0xb53fc12000000000, 0x30e657fd00000000, + 0x68e0248000000000, 0xed39b25d00000000, 0x235578e000000000, + 0xa68cee3d00000000}, + {0x0000000000000000, 0x76e10f9d00000000, 0xadc46ee100000000, + 0xdb25617c00000000, 0x1b8fac1900000000, 0x6d6ea38400000000, + 0xb64bc2f800000000, 0xc0aacd6500000000, 0x361e593300000000, + 0x40ff56ae00000000, 0x9bda37d200000000, 0xed3b384f00000000, + 0x2d91f52a00000000, 0x5b70fab700000000, 0x80559bcb00000000, + 0xf6b4945600000000, 0x6c3cb26600000000, 0x1addbdfb00000000, + 0xc1f8dc8700000000, 0xb719d31a00000000, 0x77b31e7f00000000, + 0x015211e200000000, 0xda77709e00000000, 0xac967f0300000000, + 0x5a22eb5500000000, 0x2cc3e4c800000000, 0xf7e685b400000000, + 0x81078a2900000000, 0x41ad474c00000000, 0x374c48d100000000, + 0xec6929ad00000000, 0x9a88263000000000, 0xd87864cd00000000, + 0xae996b5000000000, 0x75bc0a2c00000000, 0x035d05b100000000, + 0xc3f7c8d400000000, 0xb516c74900000000, 0x6e33a63500000000, + 0x18d2a9a800000000, 0xee663dfe00000000, 0x9887326300000000, + 0x43a2531f00000000, 0x35435c8200000000, 0xf5e991e700000000, + 0x83089e7a00000000, 0x582dff0600000000, 0x2eccf09b00000000, + 0xb444d6ab00000000, 0xc2a5d93600000000, 0x1980b84a00000000, + 0x6f61b7d700000000, 0xafcb7ab200000000, 0xd92a752f00000000, + 0x020f145300000000, 0x74ee1bce00000000, 0x825a8f9800000000, + 0xf4bb800500000000, 0x2f9ee17900000000, 0x597feee400000000, + 0x99d5238100000000, 0xef342c1c00000000, 0x34114d6000000000, + 0x42f042fd00000000, 0xf1f7b94100000000, 0x8716b6dc00000000, + 0x5c33d7a000000000, 0x2ad2d83d00000000, 0xea78155800000000, + 0x9c991ac500000000, 0x47bc7bb900000000, 0x315d742400000000, + 0xc7e9e07200000000, 0xb108efef00000000, 0x6a2d8e9300000000, + 0x1ccc810e00000000, 0xdc664c6b00000000, 0xaa8743f600000000, + 0x71a2228a00000000, 0x07432d1700000000, 0x9dcb0b2700000000, + 0xeb2a04ba00000000, 0x300f65c600000000, 0x46ee6a5b00000000, + 0x8644a73e00000000, 0xf0a5a8a300000000, 0x2b80c9df00000000, + 0x5d61c64200000000, 0xabd5521400000000, 0xdd345d8900000000, + 0x06113cf500000000, 0x70f0336800000000, 0xb05afe0d00000000, + 0xc6bbf19000000000, 0x1d9e90ec00000000, 0x6b7f9f7100000000, + 0x298fdd8c00000000, 0x5f6ed21100000000, 0x844bb36d00000000, + 0xf2aabcf000000000, 0x3200719500000000, 0x44e17e0800000000, + 0x9fc41f7400000000, 0xe92510e900000000, 0x1f9184bf00000000, + 0x69708b2200000000, 0xb255ea5e00000000, 0xc4b4e5c300000000, + 0x041e28a600000000, 0x72ff273b00000000, 0xa9da464700000000, + 0xdf3b49da00000000, 0x45b36fea00000000, 0x3352607700000000, + 0xe877010b00000000, 0x9e960e9600000000, 0x5e3cc3f300000000, + 0x28ddcc6e00000000, 0xf3f8ad1200000000, 0x8519a28f00000000, + 0x73ad36d900000000, 0x054c394400000000, 0xde69583800000000, + 0xa88857a500000000, 0x68229ac000000000, 0x1ec3955d00000000, + 0xc5e6f42100000000, 0xb307fbbc00000000, 0xe2ef738300000000, + 0x940e7c1e00000000, 0x4f2b1d6200000000, 0x39ca12ff00000000, + 0xf960df9a00000000, 0x8f81d00700000000, 0x54a4b17b00000000, + 0x2245bee600000000, 0xd4f12ab000000000, 0xa210252d00000000, + 0x7935445100000000, 0x0fd44bcc00000000, 0xcf7e86a900000000, + 0xb99f893400000000, 0x62bae84800000000, 0x145be7d500000000, + 0x8ed3c1e500000000, 0xf832ce7800000000, 0x2317af0400000000, + 0x55f6a09900000000, 0x955c6dfc00000000, 0xe3bd626100000000, + 0x3898031d00000000, 0x4e790c8000000000, 0xb8cd98d600000000, + 0xce2c974b00000000, 0x1509f63700000000, 0x63e8f9aa00000000, + 0xa34234cf00000000, 0xd5a33b5200000000, 0x0e865a2e00000000, + 0x786755b300000000, 0x3a97174e00000000, 0x4c7618d300000000, + 0x975379af00000000, 0xe1b2763200000000, 0x2118bb5700000000, + 0x57f9b4ca00000000, 0x8cdcd5b600000000, 0xfa3dda2b00000000, + 0x0c894e7d00000000, 0x7a6841e000000000, 0xa14d209c00000000, + 0xd7ac2f0100000000, 0x1706e26400000000, 0x61e7edf900000000, + 0xbac28c8500000000, 0xcc23831800000000, 0x56aba52800000000, + 0x204aaab500000000, 0xfb6fcbc900000000, 0x8d8ec45400000000, + 0x4d24093100000000, 0x3bc506ac00000000, 0xe0e067d000000000, + 0x9601684d00000000, 0x60b5fc1b00000000, 0x1654f38600000000, + 0xcd7192fa00000000, 0xbb909d6700000000, 0x7b3a500200000000, + 0x0ddb5f9f00000000, 0xd6fe3ee300000000, 0xa01f317e00000000, + 0x1318cac200000000, 0x65f9c55f00000000, 0xbedca42300000000, + 0xc83dabbe00000000, 0x089766db00000000, 0x7e76694600000000, + 0xa553083a00000000, 0xd3b207a700000000, 0x250693f100000000, + 0x53e79c6c00000000, 0x88c2fd1000000000, 0xfe23f28d00000000, + 0x3e893fe800000000, 0x4868307500000000, 0x934d510900000000, + 0xe5ac5e9400000000, 0x7f2478a400000000, 0x09c5773900000000, + 0xd2e0164500000000, 0xa40119d800000000, 0x64abd4bd00000000, + 0x124adb2000000000, 0xc96fba5c00000000, 0xbf8eb5c100000000, + 0x493a219700000000, 0x3fdb2e0a00000000, 0xe4fe4f7600000000, + 0x921f40eb00000000, 0x52b58d8e00000000, 0x2454821300000000, + 0xff71e36f00000000, 0x8990ecf200000000, 0xcb60ae0f00000000, + 0xbd81a19200000000, 0x66a4c0ee00000000, 0x1045cf7300000000, + 0xd0ef021600000000, 0xa60e0d8b00000000, 0x7d2b6cf700000000, + 0x0bca636a00000000, 0xfd7ef73c00000000, 0x8b9ff8a100000000, + 0x50ba99dd00000000, 0x265b964000000000, 0xe6f15b2500000000, + 0x901054b800000000, 0x4b3535c400000000, 0x3dd43a5900000000, + 0xa75c1c6900000000, 0xd1bd13f400000000, 0x0a98728800000000, + 0x7c797d1500000000, 0xbcd3b07000000000, 0xca32bfed00000000, + 0x1117de9100000000, 0x67f6d10c00000000, 0x9142455a00000000, + 0xe7a34ac700000000, 0x3c862bbb00000000, 0x4a67242600000000, + 0x8acde94300000000, 0xfc2ce6de00000000, 0x270987a200000000, + 0x51e8883f00000000}, + {0x0000000000000000, 0xe8dbfbb900000000, 0x91b186a800000000, + 0x796a7d1100000000, 0x63657c8a00000000, 0x8bbe873300000000, + 0xf2d4fa2200000000, 0x1a0f019b00000000, 0x87cc89cf00000000, + 0x6f17727600000000, 0x167d0f6700000000, 0xfea6f4de00000000, + 0xe4a9f54500000000, 0x0c720efc00000000, 0x751873ed00000000, + 0x9dc3885400000000, 0x4f9f624400000000, 0xa74499fd00000000, + 0xde2ee4ec00000000, 0x36f51f5500000000, 0x2cfa1ece00000000, + 0xc421e57700000000, 0xbd4b986600000000, 0x559063df00000000, + 0xc853eb8b00000000, 0x2088103200000000, 0x59e26d2300000000, + 0xb139969a00000000, 0xab36970100000000, 0x43ed6cb800000000, + 0x3a8711a900000000, 0xd25cea1000000000, 0x9e3ec58800000000, + 0x76e53e3100000000, 0x0f8f432000000000, 0xe754b89900000000, + 0xfd5bb90200000000, 0x158042bb00000000, 0x6cea3faa00000000, + 0x8431c41300000000, 0x19f24c4700000000, 0xf129b7fe00000000, + 0x8843caef00000000, 0x6098315600000000, 0x7a9730cd00000000, + 0x924ccb7400000000, 0xeb26b66500000000, 0x03fd4ddc00000000, + 0xd1a1a7cc00000000, 0x397a5c7500000000, 0x4010216400000000, + 0xa8cbdadd00000000, 0xb2c4db4600000000, 0x5a1f20ff00000000, + 0x23755dee00000000, 0xcbaea65700000000, 0x566d2e0300000000, + 0xbeb6d5ba00000000, 0xc7dca8ab00000000, 0x2f07531200000000, + 0x3508528900000000, 0xddd3a93000000000, 0xa4b9d42100000000, + 0x4c622f9800000000, 0x7d7bfbca00000000, 0x95a0007300000000, + 0xecca7d6200000000, 0x041186db00000000, 0x1e1e874000000000, + 0xf6c57cf900000000, 0x8faf01e800000000, 0x6774fa5100000000, + 0xfab7720500000000, 0x126c89bc00000000, 0x6b06f4ad00000000, + 0x83dd0f1400000000, 0x99d20e8f00000000, 0x7109f53600000000, + 0x0863882700000000, 0xe0b8739e00000000, 0x32e4998e00000000, + 0xda3f623700000000, 0xa3551f2600000000, 0x4b8ee49f00000000, + 0x5181e50400000000, 0xb95a1ebd00000000, 0xc03063ac00000000, + 0x28eb981500000000, 0xb528104100000000, 0x5df3ebf800000000, + 0x249996e900000000, 0xcc426d5000000000, 0xd64d6ccb00000000, + 0x3e96977200000000, 0x47fcea6300000000, 0xaf2711da00000000, + 0xe3453e4200000000, 0x0b9ec5fb00000000, 0x72f4b8ea00000000, + 0x9a2f435300000000, 0x802042c800000000, 0x68fbb97100000000, + 0x1191c46000000000, 0xf94a3fd900000000, 0x6489b78d00000000, + 0x8c524c3400000000, 0xf538312500000000, 0x1de3ca9c00000000, + 0x07eccb0700000000, 0xef3730be00000000, 0x965d4daf00000000, + 0x7e86b61600000000, 0xacda5c0600000000, 0x4401a7bf00000000, + 0x3d6bdaae00000000, 0xd5b0211700000000, 0xcfbf208c00000000, + 0x2764db3500000000, 0x5e0ea62400000000, 0xb6d55d9d00000000, + 0x2b16d5c900000000, 0xc3cd2e7000000000, 0xbaa7536100000000, + 0x527ca8d800000000, 0x4873a94300000000, 0xa0a852fa00000000, + 0xd9c22feb00000000, 0x3119d45200000000, 0xbbf0874e00000000, + 0x532b7cf700000000, 0x2a4101e600000000, 0xc29afa5f00000000, + 0xd895fbc400000000, 0x304e007d00000000, 0x49247d6c00000000, + 0xa1ff86d500000000, 0x3c3c0e8100000000, 0xd4e7f53800000000, + 0xad8d882900000000, 0x4556739000000000, 0x5f59720b00000000, + 0xb78289b200000000, 0xcee8f4a300000000, 0x26330f1a00000000, + 0xf46fe50a00000000, 0x1cb41eb300000000, 0x65de63a200000000, + 0x8d05981b00000000, 0x970a998000000000, 0x7fd1623900000000, + 0x06bb1f2800000000, 0xee60e49100000000, 0x73a36cc500000000, + 0x9b78977c00000000, 0xe212ea6d00000000, 0x0ac911d400000000, + 0x10c6104f00000000, 0xf81debf600000000, 0x817796e700000000, + 0x69ac6d5e00000000, 0x25ce42c600000000, 0xcd15b97f00000000, + 0xb47fc46e00000000, 0x5ca43fd700000000, 0x46ab3e4c00000000, + 0xae70c5f500000000, 0xd71ab8e400000000, 0x3fc1435d00000000, + 0xa202cb0900000000, 0x4ad930b000000000, 0x33b34da100000000, + 0xdb68b61800000000, 0xc167b78300000000, 0x29bc4c3a00000000, + 0x50d6312b00000000, 0xb80dca9200000000, 0x6a51208200000000, + 0x828adb3b00000000, 0xfbe0a62a00000000, 0x133b5d9300000000, + 0x09345c0800000000, 0xe1efa7b100000000, 0x9885daa000000000, + 0x705e211900000000, 0xed9da94d00000000, 0x054652f400000000, + 0x7c2c2fe500000000, 0x94f7d45c00000000, 0x8ef8d5c700000000, + 0x66232e7e00000000, 0x1f49536f00000000, 0xf792a8d600000000, + 0xc68b7c8400000000, 0x2e50873d00000000, 0x573afa2c00000000, + 0xbfe1019500000000, 0xa5ee000e00000000, 0x4d35fbb700000000, + 0x345f86a600000000, 0xdc847d1f00000000, 0x4147f54b00000000, + 0xa99c0ef200000000, 0xd0f673e300000000, 0x382d885a00000000, + 0x222289c100000000, 0xcaf9727800000000, 0xb3930f6900000000, + 0x5b48f4d000000000, 0x89141ec000000000, 0x61cfe57900000000, + 0x18a5986800000000, 0xf07e63d100000000, 0xea71624a00000000, + 0x02aa99f300000000, 0x7bc0e4e200000000, 0x931b1f5b00000000, + 0x0ed8970f00000000, 0xe6036cb600000000, 0x9f6911a700000000, + 0x77b2ea1e00000000, 0x6dbdeb8500000000, 0x8566103c00000000, + 0xfc0c6d2d00000000, 0x14d7969400000000, 0x58b5b90c00000000, + 0xb06e42b500000000, 0xc9043fa400000000, 0x21dfc41d00000000, + 0x3bd0c58600000000, 0xd30b3e3f00000000, 0xaa61432e00000000, + 0x42bab89700000000, 0xdf7930c300000000, 0x37a2cb7a00000000, + 0x4ec8b66b00000000, 0xa6134dd200000000, 0xbc1c4c4900000000, + 0x54c7b7f000000000, 0x2dadcae100000000, 0xc576315800000000, + 0x172adb4800000000, 0xfff120f100000000, 0x869b5de000000000, + 0x6e40a65900000000, 0x744fa7c200000000, 0x9c945c7b00000000, + 0xe5fe216a00000000, 0x0d25dad300000000, 0x90e6528700000000, + 0x783da93e00000000, 0x0157d42f00000000, 0xe98c2f9600000000, + 0xf3832e0d00000000, 0x1b58d5b400000000, 0x6232a8a500000000, + 0x8ae9531c00000000}, + {0x0000000000000000, 0x919168ae00000000, 0x6325a08700000000, + 0xf2b4c82900000000, 0x874c31d400000000, 0x16dd597a00000000, + 0xe469915300000000, 0x75f8f9fd00000000, 0x4f9f137300000000, + 0xde0e7bdd00000000, 0x2cbab3f400000000, 0xbd2bdb5a00000000, + 0xc8d322a700000000, 0x59424a0900000000, 0xabf6822000000000, + 0x3a67ea8e00000000, 0x9e3e27e600000000, 0x0faf4f4800000000, + 0xfd1b876100000000, 0x6c8aefcf00000000, 0x1972163200000000, + 0x88e37e9c00000000, 0x7a57b6b500000000, 0xebc6de1b00000000, + 0xd1a1349500000000, 0x40305c3b00000000, 0xb284941200000000, + 0x2315fcbc00000000, 0x56ed054100000000, 0xc77c6def00000000, + 0x35c8a5c600000000, 0xa459cd6800000000, 0x7d7b3f1700000000, + 0xecea57b900000000, 0x1e5e9f9000000000, 0x8fcff73e00000000, + 0xfa370ec300000000, 0x6ba6666d00000000, 0x9912ae4400000000, + 0x0883c6ea00000000, 0x32e42c6400000000, 0xa37544ca00000000, + 0x51c18ce300000000, 0xc050e44d00000000, 0xb5a81db000000000, + 0x2439751e00000000, 0xd68dbd3700000000, 0x471cd59900000000, + 0xe34518f100000000, 0x72d4705f00000000, 0x8060b87600000000, + 0x11f1d0d800000000, 0x6409292500000000, 0xf598418b00000000, + 0x072c89a200000000, 0x96bde10c00000000, 0xacda0b8200000000, + 0x3d4b632c00000000, 0xcfffab0500000000, 0x5e6ec3ab00000000, + 0x2b963a5600000000, 0xba0752f800000000, 0x48b39ad100000000, + 0xd922f27f00000000, 0xfaf67e2e00000000, 0x6b67168000000000, + 0x99d3dea900000000, 0x0842b60700000000, 0x7dba4ffa00000000, + 0xec2b275400000000, 0x1e9fef7d00000000, 0x8f0e87d300000000, + 0xb5696d5d00000000, 0x24f805f300000000, 0xd64ccdda00000000, + 0x47dda57400000000, 0x32255c8900000000, 0xa3b4342700000000, + 0x5100fc0e00000000, 0xc09194a000000000, 0x64c859c800000000, + 0xf559316600000000, 0x07edf94f00000000, 0x967c91e100000000, + 0xe384681c00000000, 0x721500b200000000, 0x80a1c89b00000000, + 0x1130a03500000000, 0x2b574abb00000000, 0xbac6221500000000, + 0x4872ea3c00000000, 0xd9e3829200000000, 0xac1b7b6f00000000, + 0x3d8a13c100000000, 0xcf3edbe800000000, 0x5eafb34600000000, + 0x878d413900000000, 0x161c299700000000, 0xe4a8e1be00000000, + 0x7539891000000000, 0x00c170ed00000000, 0x9150184300000000, + 0x63e4d06a00000000, 0xf275b8c400000000, 0xc812524a00000000, + 0x59833ae400000000, 0xab37f2cd00000000, 0x3aa69a6300000000, + 0x4f5e639e00000000, 0xdecf0b3000000000, 0x2c7bc31900000000, + 0xbdeaabb700000000, 0x19b366df00000000, 0x88220e7100000000, + 0x7a96c65800000000, 0xeb07aef600000000, 0x9eff570b00000000, + 0x0f6e3fa500000000, 0xfddaf78c00000000, 0x6c4b9f2200000000, + 0x562c75ac00000000, 0xc7bd1d0200000000, 0x3509d52b00000000, + 0xa498bd8500000000, 0xd160447800000000, 0x40f12cd600000000, + 0xb245e4ff00000000, 0x23d48c5100000000, 0xf4edfd5c00000000, + 0x657c95f200000000, 0x97c85ddb00000000, 0x0659357500000000, + 0x73a1cc8800000000, 0xe230a42600000000, 0x10846c0f00000000, + 0x811504a100000000, 0xbb72ee2f00000000, 0x2ae3868100000000, + 0xd8574ea800000000, 0x49c6260600000000, 0x3c3edffb00000000, + 0xadafb75500000000, 0x5f1b7f7c00000000, 0xce8a17d200000000, + 0x6ad3daba00000000, 0xfb42b21400000000, 0x09f67a3d00000000, + 0x9867129300000000, 0xed9feb6e00000000, 0x7c0e83c000000000, + 0x8eba4be900000000, 0x1f2b234700000000, 0x254cc9c900000000, + 0xb4dda16700000000, 0x4669694e00000000, 0xd7f801e000000000, + 0xa200f81d00000000, 0x339190b300000000, 0xc125589a00000000, + 0x50b4303400000000, 0x8996c24b00000000, 0x1807aae500000000, + 0xeab362cc00000000, 0x7b220a6200000000, 0x0edaf39f00000000, + 0x9f4b9b3100000000, 0x6dff531800000000, 0xfc6e3bb600000000, + 0xc609d13800000000, 0x5798b99600000000, 0xa52c71bf00000000, + 0x34bd191100000000, 0x4145e0ec00000000, 0xd0d4884200000000, + 0x2260406b00000000, 0xb3f128c500000000, 0x17a8e5ad00000000, + 0x86398d0300000000, 0x748d452a00000000, 0xe51c2d8400000000, + 0x90e4d47900000000, 0x0175bcd700000000, 0xf3c174fe00000000, + 0x62501c5000000000, 0x5837f6de00000000, 0xc9a69e7000000000, + 0x3b12565900000000, 0xaa833ef700000000, 0xdf7bc70a00000000, + 0x4eeaafa400000000, 0xbc5e678d00000000, 0x2dcf0f2300000000, + 0x0e1b837200000000, 0x9f8aebdc00000000, 0x6d3e23f500000000, + 0xfcaf4b5b00000000, 0x8957b2a600000000, 0x18c6da0800000000, + 0xea72122100000000, 0x7be37a8f00000000, 0x4184900100000000, + 0xd015f8af00000000, 0x22a1308600000000, 0xb330582800000000, + 0xc6c8a1d500000000, 0x5759c97b00000000, 0xa5ed015200000000, + 0x347c69fc00000000, 0x9025a49400000000, 0x01b4cc3a00000000, + 0xf300041300000000, 0x62916cbd00000000, 0x1769954000000000, + 0x86f8fdee00000000, 0x744c35c700000000, 0xe5dd5d6900000000, + 0xdfbab7e700000000, 0x4e2bdf4900000000, 0xbc9f176000000000, + 0x2d0e7fce00000000, 0x58f6863300000000, 0xc967ee9d00000000, + 0x3bd326b400000000, 0xaa424e1a00000000, 0x7360bc6500000000, + 0xe2f1d4cb00000000, 0x10451ce200000000, 0x81d4744c00000000, + 0xf42c8db100000000, 0x65bde51f00000000, 0x97092d3600000000, + 0x0698459800000000, 0x3cffaf1600000000, 0xad6ec7b800000000, + 0x5fda0f9100000000, 0xce4b673f00000000, 0xbbb39ec200000000, + 0x2a22f66c00000000, 0xd8963e4500000000, 0x490756eb00000000, + 0xed5e9b8300000000, 0x7ccff32d00000000, 0x8e7b3b0400000000, + 0x1fea53aa00000000, 0x6a12aa5700000000, 0xfb83c2f900000000, + 0x09370ad000000000, 0x98a6627e00000000, 0xa2c188f000000000, + 0x3350e05e00000000, 0xc1e4287700000000, 0x507540d900000000, + 0x258db92400000000, 0xb41cd18a00000000, 0x46a819a300000000, + 0xd739710d00000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xccaa009e, 0x4225077d, 0x8e8f07e3, 0x844a0efa, + 0x48e00e64, 0xc66f0987, 0x0ac50919, 0xd3e51bb5, 0x1f4f1b2b, + 0x91c01cc8, 0x5d6a1c56, 0x57af154f, 0x9b0515d1, 0x158a1232, + 0xd92012ac, 0x7cbb312b, 0xb01131b5, 0x3e9e3656, 0xf23436c8, + 0xf8f13fd1, 0x345b3f4f, 0xbad438ac, 0x767e3832, 0xaf5e2a9e, + 0x63f42a00, 0xed7b2de3, 0x21d12d7d, 0x2b142464, 0xe7be24fa, + 0x69312319, 0xa59b2387, 0xf9766256, 0x35dc62c8, 0xbb53652b, + 0x77f965b5, 0x7d3c6cac, 0xb1966c32, 0x3f196bd1, 0xf3b36b4f, + 0x2a9379e3, 0xe639797d, 0x68b67e9e, 0xa41c7e00, 0xaed97719, + 0x62737787, 0xecfc7064, 0x205670fa, 0x85cd537d, 0x496753e3, + 0xc7e85400, 0x0b42549e, 0x01875d87, 0xcd2d5d19, 0x43a25afa, + 0x8f085a64, 0x562848c8, 0x9a824856, 0x140d4fb5, 0xd8a74f2b, + 0xd2624632, 0x1ec846ac, 0x9047414f, 0x5ced41d1, 0x299dc2ed, + 0xe537c273, 0x6bb8c590, 0xa712c50e, 0xadd7cc17, 0x617dcc89, + 0xeff2cb6a, 0x2358cbf4, 0xfa78d958, 0x36d2d9c6, 0xb85dde25, + 0x74f7debb, 0x7e32d7a2, 0xb298d73c, 0x3c17d0df, 0xf0bdd041, + 0x5526f3c6, 0x998cf358, 0x1703f4bb, 0xdba9f425, 0xd16cfd3c, + 0x1dc6fda2, 0x9349fa41, 0x5fe3fadf, 0x86c3e873, 0x4a69e8ed, + 0xc4e6ef0e, 0x084cef90, 0x0289e689, 0xce23e617, 0x40ace1f4, + 0x8c06e16a, 0xd0eba0bb, 0x1c41a025, 0x92cea7c6, 0x5e64a758, + 0x54a1ae41, 0x980baedf, 0x1684a93c, 0xda2ea9a2, 0x030ebb0e, + 0xcfa4bb90, 0x412bbc73, 0x8d81bced, 0x8744b5f4, 0x4beeb56a, + 0xc561b289, 0x09cbb217, 0xac509190, 0x60fa910e, 0xee7596ed, + 0x22df9673, 0x281a9f6a, 0xe4b09ff4, 0x6a3f9817, 0xa6959889, + 0x7fb58a25, 0xb31f8abb, 0x3d908d58, 0xf13a8dc6, 0xfbff84df, + 0x37558441, 0xb9da83a2, 0x7570833c, 0x533b85da, 0x9f918544, + 0x111e82a7, 0xddb48239, 0xd7718b20, 0x1bdb8bbe, 0x95548c5d, + 0x59fe8cc3, 0x80de9e6f, 0x4c749ef1, 0xc2fb9912, 0x0e51998c, + 0x04949095, 0xc83e900b, 0x46b197e8, 0x8a1b9776, 0x2f80b4f1, + 0xe32ab46f, 0x6da5b38c, 0xa10fb312, 0xabcaba0b, 0x6760ba95, + 0xe9efbd76, 0x2545bde8, 0xfc65af44, 0x30cfafda, 0xbe40a839, + 0x72eaa8a7, 0x782fa1be, 0xb485a120, 0x3a0aa6c3, 0xf6a0a65d, + 0xaa4de78c, 0x66e7e712, 0xe868e0f1, 0x24c2e06f, 0x2e07e976, + 0xe2ade9e8, 0x6c22ee0b, 0xa088ee95, 0x79a8fc39, 0xb502fca7, + 0x3b8dfb44, 0xf727fbda, 0xfde2f2c3, 0x3148f25d, 0xbfc7f5be, + 0x736df520, 0xd6f6d6a7, 0x1a5cd639, 0x94d3d1da, 0x5879d144, + 0x52bcd85d, 0x9e16d8c3, 0x1099df20, 0xdc33dfbe, 0x0513cd12, + 0xc9b9cd8c, 0x4736ca6f, 0x8b9ccaf1, 0x8159c3e8, 0x4df3c376, + 0xc37cc495, 0x0fd6c40b, 0x7aa64737, 0xb60c47a9, 0x3883404a, + 0xf42940d4, 0xfeec49cd, 0x32464953, 0xbcc94eb0, 0x70634e2e, + 0xa9435c82, 0x65e95c1c, 0xeb665bff, 0x27cc5b61, 0x2d095278, + 0xe1a352e6, 0x6f2c5505, 0xa386559b, 0x061d761c, 0xcab77682, + 0x44387161, 0x889271ff, 0x825778e6, 0x4efd7878, 0xc0727f9b, + 0x0cd87f05, 0xd5f86da9, 0x19526d37, 0x97dd6ad4, 0x5b776a4a, + 0x51b26353, 0x9d1863cd, 0x1397642e, 0xdf3d64b0, 0x83d02561, + 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, + 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, + 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd, + 0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, + 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, + 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, + 0x264b06e6}, + {0x00000000, 0xa6770bb4, 0x979f1129, 0x31e81a9d, 0xf44f2413, + 0x52382fa7, 0x63d0353a, 0xc5a73e8e, 0x33ef4e67, 0x959845d3, + 0xa4705f4e, 0x020754fa, 0xc7a06a74, 0x61d761c0, 0x503f7b5d, + 0xf64870e9, 0x67de9cce, 0xc1a9977a, 0xf0418de7, 0x56368653, + 0x9391b8dd, 0x35e6b369, 0x040ea9f4, 0xa279a240, 0x5431d2a9, + 0xf246d91d, 0xc3aec380, 0x65d9c834, 0xa07ef6ba, 0x0609fd0e, + 0x37e1e793, 0x9196ec27, 0xcfbd399c, 0x69ca3228, 0x582228b5, + 0xfe552301, 0x3bf21d8f, 0x9d85163b, 0xac6d0ca6, 0x0a1a0712, + 0xfc5277fb, 0x5a257c4f, 0x6bcd66d2, 0xcdba6d66, 0x081d53e8, + 0xae6a585c, 0x9f8242c1, 0x39f54975, 0xa863a552, 0x0e14aee6, + 0x3ffcb47b, 0x998bbfcf, 0x5c2c8141, 0xfa5b8af5, 0xcbb39068, + 0x6dc49bdc, 0x9b8ceb35, 0x3dfbe081, 0x0c13fa1c, 0xaa64f1a8, + 0x6fc3cf26, 0xc9b4c492, 0xf85cde0f, 0x5e2bd5bb, 0x440b7579, + 0xe27c7ecd, 0xd3946450, 0x75e36fe4, 0xb044516a, 0x16335ade, + 0x27db4043, 0x81ac4bf7, 0x77e43b1e, 0xd19330aa, 0xe07b2a37, + 0x460c2183, 0x83ab1f0d, 0x25dc14b9, 0x14340e24, 0xb2430590, + 0x23d5e9b7, 0x85a2e203, 0xb44af89e, 0x123df32a, 0xd79acda4, + 0x71edc610, 0x4005dc8d, 0xe672d739, 0x103aa7d0, 0xb64dac64, + 0x87a5b6f9, 0x21d2bd4d, 0xe47583c3, 0x42028877, 0x73ea92ea, + 0xd59d995e, 0x8bb64ce5, 0x2dc14751, 0x1c295dcc, 0xba5e5678, + 0x7ff968f6, 0xd98e6342, 0xe86679df, 0x4e11726b, 0xb8590282, + 0x1e2e0936, 0x2fc613ab, 0x89b1181f, 0x4c162691, 0xea612d25, + 0xdb8937b8, 0x7dfe3c0c, 0xec68d02b, 0x4a1fdb9f, 0x7bf7c102, + 0xdd80cab6, 0x1827f438, 0xbe50ff8c, 0x8fb8e511, 0x29cfeea5, + 0xdf879e4c, 0x79f095f8, 0x48188f65, 0xee6f84d1, 0x2bc8ba5f, + 0x8dbfb1eb, 0xbc57ab76, 0x1a20a0c2, 0x8816eaf2, 0x2e61e146, + 0x1f89fbdb, 0xb9fef06f, 0x7c59cee1, 0xda2ec555, 0xebc6dfc8, + 0x4db1d47c, 0xbbf9a495, 0x1d8eaf21, 0x2c66b5bc, 0x8a11be08, + 0x4fb68086, 0xe9c18b32, 0xd82991af, 0x7e5e9a1b, 0xefc8763c, + 0x49bf7d88, 0x78576715, 0xde206ca1, 0x1b87522f, 0xbdf0599b, + 0x8c184306, 0x2a6f48b2, 0xdc27385b, 0x7a5033ef, 0x4bb82972, + 0xedcf22c6, 0x28681c48, 0x8e1f17fc, 0xbff70d61, 0x198006d5, + 0x47abd36e, 0xe1dcd8da, 0xd034c247, 0x7643c9f3, 0xb3e4f77d, + 0x1593fcc9, 0x247be654, 0x820cede0, 0x74449d09, 0xd23396bd, + 0xe3db8c20, 0x45ac8794, 0x800bb91a, 0x267cb2ae, 0x1794a833, + 0xb1e3a387, 0x20754fa0, 0x86024414, 0xb7ea5e89, 0x119d553d, + 0xd43a6bb3, 0x724d6007, 0x43a57a9a, 0xe5d2712e, 0x139a01c7, + 0xb5ed0a73, 0x840510ee, 0x22721b5a, 0xe7d525d4, 0x41a22e60, + 0x704a34fd, 0xd63d3f49, 0xcc1d9f8b, 0x6a6a943f, 0x5b828ea2, + 0xfdf58516, 0x3852bb98, 0x9e25b02c, 0xafcdaab1, 0x09baa105, + 0xfff2d1ec, 0x5985da58, 0x686dc0c5, 0xce1acb71, 0x0bbdf5ff, + 0xadcafe4b, 0x9c22e4d6, 0x3a55ef62, 0xabc30345, 0x0db408f1, + 0x3c5c126c, 0x9a2b19d8, 0x5f8c2756, 0xf9fb2ce2, 0xc813367f, + 0x6e643dcb, 0x982c4d22, 0x3e5b4696, 0x0fb35c0b, 0xa9c457bf, + 0x6c636931, 0xca146285, 0xfbfc7818, 0x5d8b73ac, 0x03a0a617, + 0xa5d7ada3, 0x943fb73e, 0x3248bc8a, 0xf7ef8204, 0x519889b0, + 0x6070932d, 0xc6079899, 0x304fe870, 0x9638e3c4, 0xa7d0f959, + 0x01a7f2ed, 0xc400cc63, 0x6277c7d7, 0x539fdd4a, 0xf5e8d6fe, + 0x647e3ad9, 0xc209316d, 0xf3e12bf0, 0x55962044, 0x90311eca, + 0x3646157e, 0x07ae0fe3, 0xa1d90457, 0x579174be, 0xf1e67f0a, + 0xc00e6597, 0x66796e23, 0xa3de50ad, 0x05a95b19, 0x34414184, + 0x92364a30}, + {0x00000000, 0xcb5cd3a5, 0x4dc8a10b, 0x869472ae, 0x9b914216, + 0x50cd91b3, 0xd659e31d, 0x1d0530b8, 0xec53826d, 0x270f51c8, + 0xa19b2366, 0x6ac7f0c3, 0x77c2c07b, 0xbc9e13de, 0x3a0a6170, + 0xf156b2d5, 0x03d6029b, 0xc88ad13e, 0x4e1ea390, 0x85427035, + 0x9847408d, 0x531b9328, 0xd58fe186, 0x1ed33223, 0xef8580f6, + 0x24d95353, 0xa24d21fd, 0x6911f258, 0x7414c2e0, 0xbf481145, + 0x39dc63eb, 0xf280b04e, 0x07ac0536, 0xccf0d693, 0x4a64a43d, + 0x81387798, 0x9c3d4720, 0x57619485, 0xd1f5e62b, 0x1aa9358e, + 0xebff875b, 0x20a354fe, 0xa6372650, 0x6d6bf5f5, 0x706ec54d, + 0xbb3216e8, 0x3da66446, 0xf6fab7e3, 0x047a07ad, 0xcf26d408, + 0x49b2a6a6, 0x82ee7503, 0x9feb45bb, 0x54b7961e, 0xd223e4b0, + 0x197f3715, 0xe82985c0, 0x23755665, 0xa5e124cb, 0x6ebdf76e, + 0x73b8c7d6, 0xb8e41473, 0x3e7066dd, 0xf52cb578, 0x0f580a6c, + 0xc404d9c9, 0x4290ab67, 0x89cc78c2, 0x94c9487a, 0x5f959bdf, + 0xd901e971, 0x125d3ad4, 0xe30b8801, 0x28575ba4, 0xaec3290a, + 0x659ffaaf, 0x789aca17, 0xb3c619b2, 0x35526b1c, 0xfe0eb8b9, + 0x0c8e08f7, 0xc7d2db52, 0x4146a9fc, 0x8a1a7a59, 0x971f4ae1, + 0x5c439944, 0xdad7ebea, 0x118b384f, 0xe0dd8a9a, 0x2b81593f, + 0xad152b91, 0x6649f834, 0x7b4cc88c, 0xb0101b29, 0x36846987, + 0xfdd8ba22, 0x08f40f5a, 0xc3a8dcff, 0x453cae51, 0x8e607df4, + 0x93654d4c, 0x58399ee9, 0xdeadec47, 0x15f13fe2, 0xe4a78d37, + 0x2ffb5e92, 0xa96f2c3c, 0x6233ff99, 0x7f36cf21, 0xb46a1c84, + 0x32fe6e2a, 0xf9a2bd8f, 0x0b220dc1, 0xc07ede64, 0x46eaacca, + 0x8db67f6f, 0x90b34fd7, 0x5bef9c72, 0xdd7beedc, 0x16273d79, + 0xe7718fac, 0x2c2d5c09, 0xaab92ea7, 0x61e5fd02, 0x7ce0cdba, + 0xb7bc1e1f, 0x31286cb1, 0xfa74bf14, 0x1eb014d8, 0xd5ecc77d, + 0x5378b5d3, 0x98246676, 0x852156ce, 0x4e7d856b, 0xc8e9f7c5, + 0x03b52460, 0xf2e396b5, 0x39bf4510, 0xbf2b37be, 0x7477e41b, + 0x6972d4a3, 0xa22e0706, 0x24ba75a8, 0xefe6a60d, 0x1d661643, + 0xd63ac5e6, 0x50aeb748, 0x9bf264ed, 0x86f75455, 0x4dab87f0, + 0xcb3ff55e, 0x006326fb, 0xf135942e, 0x3a69478b, 0xbcfd3525, + 0x77a1e680, 0x6aa4d638, 0xa1f8059d, 0x276c7733, 0xec30a496, + 0x191c11ee, 0xd240c24b, 0x54d4b0e5, 0x9f886340, 0x828d53f8, + 0x49d1805d, 0xcf45f2f3, 0x04192156, 0xf54f9383, 0x3e134026, + 0xb8873288, 0x73dbe12d, 0x6eded195, 0xa5820230, 0x2316709e, + 0xe84aa33b, 0x1aca1375, 0xd196c0d0, 0x5702b27e, 0x9c5e61db, + 0x815b5163, 0x4a0782c6, 0xcc93f068, 0x07cf23cd, 0xf6999118, + 0x3dc542bd, 0xbb513013, 0x700de3b6, 0x6d08d30e, 0xa65400ab, + 0x20c07205, 0xeb9ca1a0, 0x11e81eb4, 0xdab4cd11, 0x5c20bfbf, + 0x977c6c1a, 0x8a795ca2, 0x41258f07, 0xc7b1fda9, 0x0ced2e0c, + 0xfdbb9cd9, 0x36e74f7c, 0xb0733dd2, 0x7b2fee77, 0x662adecf, + 0xad760d6a, 0x2be27fc4, 0xe0beac61, 0x123e1c2f, 0xd962cf8a, + 0x5ff6bd24, 0x94aa6e81, 0x89af5e39, 0x42f38d9c, 0xc467ff32, + 0x0f3b2c97, 0xfe6d9e42, 0x35314de7, 0xb3a53f49, 0x78f9ecec, + 0x65fcdc54, 0xaea00ff1, 0x28347d5f, 0xe368aefa, 0x16441b82, + 0xdd18c827, 0x5b8cba89, 0x90d0692c, 0x8dd55994, 0x46898a31, + 0xc01df89f, 0x0b412b3a, 0xfa1799ef, 0x314b4a4a, 0xb7df38e4, + 0x7c83eb41, 0x6186dbf9, 0xaada085c, 0x2c4e7af2, 0xe712a957, + 0x15921919, 0xdececabc, 0x585ab812, 0x93066bb7, 0x8e035b0f, + 0x455f88aa, 0xc3cbfa04, 0x089729a1, 0xf9c19b74, 0x329d48d1, + 0xb4093a7f, 0x7f55e9da, 0x6250d962, 0xa90c0ac7, 0x2f987869, + 0xe4c4abcc}, + {0x00000000, 0x3d6029b0, 0x7ac05360, 0x47a07ad0, 0xf580a6c0, + 0xc8e08f70, 0x8f40f5a0, 0xb220dc10, 0x30704bc1, 0x0d106271, + 0x4ab018a1, 0x77d03111, 0xc5f0ed01, 0xf890c4b1, 0xbf30be61, + 0x825097d1, 0x60e09782, 0x5d80be32, 0x1a20c4e2, 0x2740ed52, + 0x95603142, 0xa80018f2, 0xefa06222, 0xd2c04b92, 0x5090dc43, + 0x6df0f5f3, 0x2a508f23, 0x1730a693, 0xa5107a83, 0x98705333, + 0xdfd029e3, 0xe2b00053, 0xc1c12f04, 0xfca106b4, 0xbb017c64, + 0x866155d4, 0x344189c4, 0x0921a074, 0x4e81daa4, 0x73e1f314, + 0xf1b164c5, 0xccd14d75, 0x8b7137a5, 0xb6111e15, 0x0431c205, + 0x3951ebb5, 0x7ef19165, 0x4391b8d5, 0xa121b886, 0x9c419136, + 0xdbe1ebe6, 0xe681c256, 0x54a11e46, 0x69c137f6, 0x2e614d26, + 0x13016496, 0x9151f347, 0xac31daf7, 0xeb91a027, 0xd6f18997, + 0x64d15587, 0x59b17c37, 0x1e1106e7, 0x23712f57, 0x58f35849, + 0x659371f9, 0x22330b29, 0x1f532299, 0xad73fe89, 0x9013d739, + 0xd7b3ade9, 0xead38459, 0x68831388, 0x55e33a38, 0x124340e8, + 0x2f236958, 0x9d03b548, 0xa0639cf8, 0xe7c3e628, 0xdaa3cf98, + 0x3813cfcb, 0x0573e67b, 0x42d39cab, 0x7fb3b51b, 0xcd93690b, + 0xf0f340bb, 0xb7533a6b, 0x8a3313db, 0x0863840a, 0x3503adba, + 0x72a3d76a, 0x4fc3feda, 0xfde322ca, 0xc0830b7a, 0x872371aa, + 0xba43581a, 0x9932774d, 0xa4525efd, 0xe3f2242d, 0xde920d9d, + 0x6cb2d18d, 0x51d2f83d, 0x167282ed, 0x2b12ab5d, 0xa9423c8c, + 0x9422153c, 0xd3826fec, 0xeee2465c, 0x5cc29a4c, 0x61a2b3fc, + 0x2602c92c, 0x1b62e09c, 0xf9d2e0cf, 0xc4b2c97f, 0x8312b3af, + 0xbe729a1f, 0x0c52460f, 0x31326fbf, 0x7692156f, 0x4bf23cdf, + 0xc9a2ab0e, 0xf4c282be, 0xb362f86e, 0x8e02d1de, 0x3c220dce, + 0x0142247e, 0x46e25eae, 0x7b82771e, 0xb1e6b092, 0x8c869922, + 0xcb26e3f2, 0xf646ca42, 0x44661652, 0x79063fe2, 0x3ea64532, + 0x03c66c82, 0x8196fb53, 0xbcf6d2e3, 0xfb56a833, 0xc6368183, + 0x74165d93, 0x49767423, 0x0ed60ef3, 0x33b62743, 0xd1062710, + 0xec660ea0, 0xabc67470, 0x96a65dc0, 0x248681d0, 0x19e6a860, + 0x5e46d2b0, 0x6326fb00, 0xe1766cd1, 0xdc164561, 0x9bb63fb1, + 0xa6d61601, 0x14f6ca11, 0x2996e3a1, 0x6e369971, 0x5356b0c1, + 0x70279f96, 0x4d47b626, 0x0ae7ccf6, 0x3787e546, 0x85a73956, + 0xb8c710e6, 0xff676a36, 0xc2074386, 0x4057d457, 0x7d37fde7, + 0x3a978737, 0x07f7ae87, 0xb5d77297, 0x88b75b27, 0xcf1721f7, + 0xf2770847, 0x10c70814, 0x2da721a4, 0x6a075b74, 0x576772c4, + 0xe547aed4, 0xd8278764, 0x9f87fdb4, 0xa2e7d404, 0x20b743d5, + 0x1dd76a65, 0x5a7710b5, 0x67173905, 0xd537e515, 0xe857cca5, + 0xaff7b675, 0x92979fc5, 0xe915e8db, 0xd475c16b, 0x93d5bbbb, + 0xaeb5920b, 0x1c954e1b, 0x21f567ab, 0x66551d7b, 0x5b3534cb, + 0xd965a31a, 0xe4058aaa, 0xa3a5f07a, 0x9ec5d9ca, 0x2ce505da, + 0x11852c6a, 0x562556ba, 0x6b457f0a, 0x89f57f59, 0xb49556e9, + 0xf3352c39, 0xce550589, 0x7c75d999, 0x4115f029, 0x06b58af9, + 0x3bd5a349, 0xb9853498, 0x84e51d28, 0xc34567f8, 0xfe254e48, + 0x4c059258, 0x7165bbe8, 0x36c5c138, 0x0ba5e888, 0x28d4c7df, + 0x15b4ee6f, 0x521494bf, 0x6f74bd0f, 0xdd54611f, 0xe03448af, + 0xa794327f, 0x9af41bcf, 0x18a48c1e, 0x25c4a5ae, 0x6264df7e, + 0x5f04f6ce, 0xed242ade, 0xd044036e, 0x97e479be, 0xaa84500e, + 0x4834505d, 0x755479ed, 0x32f4033d, 0x0f942a8d, 0xbdb4f69d, + 0x80d4df2d, 0xc774a5fd, 0xfa148c4d, 0x78441b9c, 0x4524322c, + 0x028448fc, 0x3fe4614c, 0x8dc4bd5c, 0xb0a494ec, 0xf704ee3c, + 0xca64c78c}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0xb029603d, 0x6053c07a, 0xd07aa047, 0xc0a680f5, + 0x708fe0c8, 0xa0f5408f, 0x10dc20b2, 0xc14b7030, 0x7162100d, + 0xa118b04a, 0x1131d077, 0x01edf0c5, 0xb1c490f8, 0x61be30bf, + 0xd1975082, 0x8297e060, 0x32be805d, 0xe2c4201a, 0x52ed4027, + 0x42316095, 0xf21800a8, 0x2262a0ef, 0x924bc0d2, 0x43dc9050, + 0xf3f5f06d, 0x238f502a, 0x93a63017, 0x837a10a5, 0x33537098, + 0xe329d0df, 0x5300b0e2, 0x042fc1c1, 0xb406a1fc, 0x647c01bb, + 0xd4556186, 0xc4894134, 0x74a02109, 0xa4da814e, 0x14f3e173, + 0xc564b1f1, 0x754dd1cc, 0xa537718b, 0x151e11b6, 0x05c23104, + 0xb5eb5139, 0x6591f17e, 0xd5b89143, 0x86b821a1, 0x3691419c, + 0xe6ebe1db, 0x56c281e6, 0x461ea154, 0xf637c169, 0x264d612e, + 0x96640113, 0x47f35191, 0xf7da31ac, 0x27a091eb, 0x9789f1d6, + 0x8755d164, 0x377cb159, 0xe706111e, 0x572f7123, 0x4958f358, + 0xf9719365, 0x290b3322, 0x9922531f, 0x89fe73ad, 0x39d71390, + 0xe9adb3d7, 0x5984d3ea, 0x88138368, 0x383ae355, 0xe8404312, + 0x5869232f, 0x48b5039d, 0xf89c63a0, 0x28e6c3e7, 0x98cfa3da, + 0xcbcf1338, 0x7be67305, 0xab9cd342, 0x1bb5b37f, 0x0b6993cd, + 0xbb40f3f0, 0x6b3a53b7, 0xdb13338a, 0x0a846308, 0xbaad0335, + 0x6ad7a372, 0xdafec34f, 0xca22e3fd, 0x7a0b83c0, 0xaa712387, + 0x1a5843ba, 0x4d773299, 0xfd5e52a4, 0x2d24f2e3, 0x9d0d92de, + 0x8dd1b26c, 0x3df8d251, 0xed827216, 0x5dab122b, 0x8c3c42a9, + 0x3c152294, 0xec6f82d3, 0x5c46e2ee, 0x4c9ac25c, 0xfcb3a261, + 0x2cc90226, 0x9ce0621b, 0xcfe0d2f9, 0x7fc9b2c4, 0xafb31283, + 0x1f9a72be, 0x0f46520c, 0xbf6f3231, 0x6f159276, 0xdf3cf24b, + 0x0eaba2c9, 0xbe82c2f4, 0x6ef862b3, 0xded1028e, 0xce0d223c, + 0x7e244201, 0xae5ee246, 0x1e77827b, 0x92b0e6b1, 0x2299868c, + 0xf2e326cb, 0x42ca46f6, 0x52166644, 0xe23f0679, 0x3245a63e, + 0x826cc603, 0x53fb9681, 0xe3d2f6bc, 0x33a856fb, 0x838136c6, + 0x935d1674, 0x23747649, 0xf30ed60e, 0x4327b633, 0x102706d1, + 0xa00e66ec, 0x7074c6ab, 0xc05da696, 0xd0818624, 0x60a8e619, + 0xb0d2465e, 0x00fb2663, 0xd16c76e1, 0x614516dc, 0xb13fb69b, + 0x0116d6a6, 0x11caf614, 0xa1e39629, 0x7199366e, 0xc1b05653, + 0x969f2770, 0x26b6474d, 0xf6cce70a, 0x46e58737, 0x5639a785, + 0xe610c7b8, 0x366a67ff, 0x864307c2, 0x57d45740, 0xe7fd377d, + 0x3787973a, 0x87aef707, 0x9772d7b5, 0x275bb788, 0xf72117cf, + 0x470877f2, 0x1408c710, 0xa421a72d, 0x745b076a, 0xc4726757, + 0xd4ae47e5, 0x648727d8, 0xb4fd879f, 0x04d4e7a2, 0xd543b720, + 0x656ad71d, 0xb510775a, 0x05391767, 0x15e537d5, 0xa5cc57e8, + 0x75b6f7af, 0xc59f9792, 0xdbe815e9, 0x6bc175d4, 0xbbbbd593, + 0x0b92b5ae, 0x1b4e951c, 0xab67f521, 0x7b1d5566, 0xcb34355b, + 0x1aa365d9, 0xaa8a05e4, 0x7af0a5a3, 0xcad9c59e, 0xda05e52c, + 0x6a2c8511, 0xba562556, 0x0a7f456b, 0x597ff589, 0xe95695b4, + 0x392c35f3, 0x890555ce, 0x99d9757c, 0x29f01541, 0xf98ab506, + 0x49a3d53b, 0x983485b9, 0x281de584, 0xf86745c3, 0x484e25fe, + 0x5892054c, 0xe8bb6571, 0x38c1c536, 0x88e8a50b, 0xdfc7d428, + 0x6feeb415, 0xbf941452, 0x0fbd746f, 0x1f6154dd, 0xaf4834e0, + 0x7f3294a7, 0xcf1bf49a, 0x1e8ca418, 0xaea5c425, 0x7edf6462, + 0xcef6045f, 0xde2a24ed, 0x6e0344d0, 0xbe79e497, 0x0e5084aa, + 0x5d503448, 0xed795475, 0x3d03f432, 0x8d2a940f, 0x9df6b4bd, + 0x2ddfd480, 0xfda574c7, 0x4d8c14fa, 0x9c1b4478, 0x2c322445, + 0xfc488402, 0x4c61e43f, 0x5cbdc48d, 0xec94a4b0, 0x3cee04f7, + 0x8cc764ca}, + {0x00000000, 0xa5d35ccb, 0x0ba1c84d, 0xae729486, 0x1642919b, + 0xb391cd50, 0x1de359d6, 0xb830051d, 0x6d8253ec, 0xc8510f27, + 0x66239ba1, 0xc3f0c76a, 0x7bc0c277, 0xde139ebc, 0x70610a3a, + 0xd5b256f1, 0x9b02d603, 0x3ed18ac8, 0x90a31e4e, 0x35704285, + 0x8d404798, 0x28931b53, 0x86e18fd5, 0x2332d31e, 0xf68085ef, + 0x5353d924, 0xfd214da2, 0x58f21169, 0xe0c21474, 0x451148bf, + 0xeb63dc39, 0x4eb080f2, 0x3605ac07, 0x93d6f0cc, 0x3da4644a, + 0x98773881, 0x20473d9c, 0x85946157, 0x2be6f5d1, 0x8e35a91a, + 0x5b87ffeb, 0xfe54a320, 0x502637a6, 0xf5f56b6d, 0x4dc56e70, + 0xe81632bb, 0x4664a63d, 0xe3b7faf6, 0xad077a04, 0x08d426cf, + 0xa6a6b249, 0x0375ee82, 0xbb45eb9f, 0x1e96b754, 0xb0e423d2, + 0x15377f19, 0xc08529e8, 0x65567523, 0xcb24e1a5, 0x6ef7bd6e, + 0xd6c7b873, 0x7314e4b8, 0xdd66703e, 0x78b52cf5, 0x6c0a580f, + 0xc9d904c4, 0x67ab9042, 0xc278cc89, 0x7a48c994, 0xdf9b955f, + 0x71e901d9, 0xd43a5d12, 0x01880be3, 0xa45b5728, 0x0a29c3ae, + 0xaffa9f65, 0x17ca9a78, 0xb219c6b3, 0x1c6b5235, 0xb9b80efe, + 0xf7088e0c, 0x52dbd2c7, 0xfca94641, 0x597a1a8a, 0xe14a1f97, + 0x4499435c, 0xeaebd7da, 0x4f388b11, 0x9a8adde0, 0x3f59812b, + 0x912b15ad, 0x34f84966, 0x8cc84c7b, 0x291b10b0, 0x87698436, + 0x22bad8fd, 0x5a0ff408, 0xffdca8c3, 0x51ae3c45, 0xf47d608e, + 0x4c4d6593, 0xe99e3958, 0x47ecadde, 0xe23ff115, 0x378da7e4, + 0x925efb2f, 0x3c2c6fa9, 0x99ff3362, 0x21cf367f, 0x841c6ab4, + 0x2a6efe32, 0x8fbda2f9, 0xc10d220b, 0x64de7ec0, 0xcaacea46, + 0x6f7fb68d, 0xd74fb390, 0x729cef5b, 0xdcee7bdd, 0x793d2716, + 0xac8f71e7, 0x095c2d2c, 0xa72eb9aa, 0x02fde561, 0xbacde07c, + 0x1f1ebcb7, 0xb16c2831, 0x14bf74fa, 0xd814b01e, 0x7dc7ecd5, + 0xd3b57853, 0x76662498, 0xce562185, 0x6b857d4e, 0xc5f7e9c8, + 0x6024b503, 0xb596e3f2, 0x1045bf39, 0xbe372bbf, 0x1be47774, + 0xa3d47269, 0x06072ea2, 0xa875ba24, 0x0da6e6ef, 0x4316661d, + 0xe6c53ad6, 0x48b7ae50, 0xed64f29b, 0x5554f786, 0xf087ab4d, + 0x5ef53fcb, 0xfb266300, 0x2e9435f1, 0x8b47693a, 0x2535fdbc, + 0x80e6a177, 0x38d6a46a, 0x9d05f8a1, 0x33776c27, 0x96a430ec, + 0xee111c19, 0x4bc240d2, 0xe5b0d454, 0x4063889f, 0xf8538d82, + 0x5d80d149, 0xf3f245cf, 0x56211904, 0x83934ff5, 0x2640133e, + 0x883287b8, 0x2de1db73, 0x95d1de6e, 0x300282a5, 0x9e701623, + 0x3ba34ae8, 0x7513ca1a, 0xd0c096d1, 0x7eb20257, 0xdb615e9c, + 0x63515b81, 0xc682074a, 0x68f093cc, 0xcd23cf07, 0x189199f6, + 0xbd42c53d, 0x133051bb, 0xb6e30d70, 0x0ed3086d, 0xab0054a6, + 0x0572c020, 0xa0a19ceb, 0xb41ee811, 0x11cdb4da, 0xbfbf205c, + 0x1a6c7c97, 0xa25c798a, 0x078f2541, 0xa9fdb1c7, 0x0c2eed0c, + 0xd99cbbfd, 0x7c4fe736, 0xd23d73b0, 0x77ee2f7b, 0xcfde2a66, + 0x6a0d76ad, 0xc47fe22b, 0x61acbee0, 0x2f1c3e12, 0x8acf62d9, + 0x24bdf65f, 0x816eaa94, 0x395eaf89, 0x9c8df342, 0x32ff67c4, + 0x972c3b0f, 0x429e6dfe, 0xe74d3135, 0x493fa5b3, 0xececf978, + 0x54dcfc65, 0xf10fa0ae, 0x5f7d3428, 0xfaae68e3, 0x821b4416, + 0x27c818dd, 0x89ba8c5b, 0x2c69d090, 0x9459d58d, 0x318a8946, + 0x9ff81dc0, 0x3a2b410b, 0xef9917fa, 0x4a4a4b31, 0xe438dfb7, + 0x41eb837c, 0xf9db8661, 0x5c08daaa, 0xf27a4e2c, 0x57a912e7, + 0x19199215, 0xbccacede, 0x12b85a58, 0xb76b0693, 0x0f5b038e, + 0xaa885f45, 0x04facbc3, 0xa1299708, 0x749bc1f9, 0xd1489d32, + 0x7f3a09b4, 0xdae9557f, 0x62d95062, 0xc70a0ca9, 0x6978982f, + 0xccabc4e4}, + {0x00000000, 0xb40b77a6, 0x29119f97, 0x9d1ae831, 0x13244ff4, + 0xa72f3852, 0x3a35d063, 0x8e3ea7c5, 0x674eef33, 0xd3459895, + 0x4e5f70a4, 0xfa540702, 0x746aa0c7, 0xc061d761, 0x5d7b3f50, + 0xe97048f6, 0xce9cde67, 0x7a97a9c1, 0xe78d41f0, 0x53863656, + 0xddb89193, 0x69b3e635, 0xf4a90e04, 0x40a279a2, 0xa9d23154, + 0x1dd946f2, 0x80c3aec3, 0x34c8d965, 0xbaf67ea0, 0x0efd0906, + 0x93e7e137, 0x27ec9691, 0x9c39bdcf, 0x2832ca69, 0xb5282258, + 0x012355fe, 0x8f1df23b, 0x3b16859d, 0xa60c6dac, 0x12071a0a, + 0xfb7752fc, 0x4f7c255a, 0xd266cd6b, 0x666dbacd, 0xe8531d08, + 0x5c586aae, 0xc142829f, 0x7549f539, 0x52a563a8, 0xe6ae140e, + 0x7bb4fc3f, 0xcfbf8b99, 0x41812c5c, 0xf58a5bfa, 0x6890b3cb, + 0xdc9bc46d, 0x35eb8c9b, 0x81e0fb3d, 0x1cfa130c, 0xa8f164aa, + 0x26cfc36f, 0x92c4b4c9, 0x0fde5cf8, 0xbbd52b5e, 0x79750b44, + 0xcd7e7ce2, 0x506494d3, 0xe46fe375, 0x6a5144b0, 0xde5a3316, + 0x4340db27, 0xf74bac81, 0x1e3be477, 0xaa3093d1, 0x372a7be0, + 0x83210c46, 0x0d1fab83, 0xb914dc25, 0x240e3414, 0x900543b2, + 0xb7e9d523, 0x03e2a285, 0x9ef84ab4, 0x2af33d12, 0xa4cd9ad7, + 0x10c6ed71, 0x8ddc0540, 0x39d772e6, 0xd0a73a10, 0x64ac4db6, + 0xf9b6a587, 0x4dbdd221, 0xc38375e4, 0x77880242, 0xea92ea73, + 0x5e999dd5, 0xe54cb68b, 0x5147c12d, 0xcc5d291c, 0x78565eba, + 0xf668f97f, 0x42638ed9, 0xdf7966e8, 0x6b72114e, 0x820259b8, + 0x36092e1e, 0xab13c62f, 0x1f18b189, 0x9126164c, 0x252d61ea, + 0xb83789db, 0x0c3cfe7d, 0x2bd068ec, 0x9fdb1f4a, 0x02c1f77b, + 0xb6ca80dd, 0x38f42718, 0x8cff50be, 0x11e5b88f, 0xa5eecf29, + 0x4c9e87df, 0xf895f079, 0x658f1848, 0xd1846fee, 0x5fbac82b, + 0xebb1bf8d, 0x76ab57bc, 0xc2a0201a, 0xf2ea1688, 0x46e1612e, + 0xdbfb891f, 0x6ff0feb9, 0xe1ce597c, 0x55c52eda, 0xc8dfc6eb, + 0x7cd4b14d, 0x95a4f9bb, 0x21af8e1d, 0xbcb5662c, 0x08be118a, + 0x8680b64f, 0x328bc1e9, 0xaf9129d8, 0x1b9a5e7e, 0x3c76c8ef, + 0x887dbf49, 0x15675778, 0xa16c20de, 0x2f52871b, 0x9b59f0bd, + 0x0643188c, 0xb2486f2a, 0x5b3827dc, 0xef33507a, 0x7229b84b, + 0xc622cfed, 0x481c6828, 0xfc171f8e, 0x610df7bf, 0xd5068019, + 0x6ed3ab47, 0xdad8dce1, 0x47c234d0, 0xf3c94376, 0x7df7e4b3, + 0xc9fc9315, 0x54e67b24, 0xe0ed0c82, 0x099d4474, 0xbd9633d2, + 0x208cdbe3, 0x9487ac45, 0x1ab90b80, 0xaeb27c26, 0x33a89417, + 0x87a3e3b1, 0xa04f7520, 0x14440286, 0x895eeab7, 0x3d559d11, + 0xb36b3ad4, 0x07604d72, 0x9a7aa543, 0x2e71d2e5, 0xc7019a13, + 0x730aedb5, 0xee100584, 0x5a1b7222, 0xd425d5e7, 0x602ea241, + 0xfd344a70, 0x493f3dd6, 0x8b9f1dcc, 0x3f946a6a, 0xa28e825b, + 0x1685f5fd, 0x98bb5238, 0x2cb0259e, 0xb1aacdaf, 0x05a1ba09, + 0xecd1f2ff, 0x58da8559, 0xc5c06d68, 0x71cb1ace, 0xfff5bd0b, + 0x4bfecaad, 0xd6e4229c, 0x62ef553a, 0x4503c3ab, 0xf108b40d, + 0x6c125c3c, 0xd8192b9a, 0x56278c5f, 0xe22cfbf9, 0x7f3613c8, + 0xcb3d646e, 0x224d2c98, 0x96465b3e, 0x0b5cb30f, 0xbf57c4a9, + 0x3169636c, 0x856214ca, 0x1878fcfb, 0xac738b5d, 0x17a6a003, + 0xa3add7a5, 0x3eb73f94, 0x8abc4832, 0x0482eff7, 0xb0899851, + 0x2d937060, 0x999807c6, 0x70e84f30, 0xc4e33896, 0x59f9d0a7, + 0xedf2a701, 0x63cc00c4, 0xd7c77762, 0x4add9f53, 0xfed6e8f5, + 0xd93a7e64, 0x6d3109c2, 0xf02be1f3, 0x44209655, 0xca1e3190, + 0x7e154636, 0xe30fae07, 0x5704d9a1, 0xbe749157, 0x0a7fe6f1, + 0x97650ec0, 0x236e7966, 0xad50dea3, 0x195ba905, 0x84414134, + 0x304a3692}, + {0x00000000, 0x9e00aacc, 0x7d072542, 0xe3078f8e, 0xfa0e4a84, + 0x640ee048, 0x87096fc6, 0x1909c50a, 0xb51be5d3, 0x2b1b4f1f, + 0xc81cc091, 0x561c6a5d, 0x4f15af57, 0xd115059b, 0x32128a15, + 0xac1220d9, 0x2b31bb7c, 0xb53111b0, 0x56369e3e, 0xc83634f2, + 0xd13ff1f8, 0x4f3f5b34, 0xac38d4ba, 0x32387e76, 0x9e2a5eaf, + 0x002af463, 0xe32d7bed, 0x7d2dd121, 0x6424142b, 0xfa24bee7, + 0x19233169, 0x87239ba5, 0x566276f9, 0xc862dc35, 0x2b6553bb, + 0xb565f977, 0xac6c3c7d, 0x326c96b1, 0xd16b193f, 0x4f6bb3f3, + 0xe379932a, 0x7d7939e6, 0x9e7eb668, 0x007e1ca4, 0x1977d9ae, + 0x87777362, 0x6470fcec, 0xfa705620, 0x7d53cd85, 0xe3536749, + 0x0054e8c7, 0x9e54420b, 0x875d8701, 0x195d2dcd, 0xfa5aa243, + 0x645a088f, 0xc8482856, 0x5648829a, 0xb54f0d14, 0x2b4fa7d8, + 0x324662d2, 0xac46c81e, 0x4f414790, 0xd141ed5c, 0xedc29d29, + 0x73c237e5, 0x90c5b86b, 0x0ec512a7, 0x17ccd7ad, 0x89cc7d61, + 0x6acbf2ef, 0xf4cb5823, 0x58d978fa, 0xc6d9d236, 0x25de5db8, + 0xbbdef774, 0xa2d7327e, 0x3cd798b2, 0xdfd0173c, 0x41d0bdf0, + 0xc6f32655, 0x58f38c99, 0xbbf40317, 0x25f4a9db, 0x3cfd6cd1, + 0xa2fdc61d, 0x41fa4993, 0xdffae35f, 0x73e8c386, 0xede8694a, + 0x0eefe6c4, 0x90ef4c08, 0x89e68902, 0x17e623ce, 0xf4e1ac40, + 0x6ae1068c, 0xbba0ebd0, 0x25a0411c, 0xc6a7ce92, 0x58a7645e, + 0x41aea154, 0xdfae0b98, 0x3ca98416, 0xa2a92eda, 0x0ebb0e03, + 0x90bba4cf, 0x73bc2b41, 0xedbc818d, 0xf4b54487, 0x6ab5ee4b, + 0x89b261c5, 0x17b2cb09, 0x909150ac, 0x0e91fa60, 0xed9675ee, + 0x7396df22, 0x6a9f1a28, 0xf49fb0e4, 0x17983f6a, 0x899895a6, + 0x258ab57f, 0xbb8a1fb3, 0x588d903d, 0xc68d3af1, 0xdf84fffb, + 0x41845537, 0xa283dab9, 0x3c837075, 0xda853b53, 0x4485919f, + 0xa7821e11, 0x3982b4dd, 0x208b71d7, 0xbe8bdb1b, 0x5d8c5495, + 0xc38cfe59, 0x6f9ede80, 0xf19e744c, 0x1299fbc2, 0x8c99510e, + 0x95909404, 0x0b903ec8, 0xe897b146, 0x76971b8a, 0xf1b4802f, + 0x6fb42ae3, 0x8cb3a56d, 0x12b30fa1, 0x0bbacaab, 0x95ba6067, + 0x76bdefe9, 0xe8bd4525, 0x44af65fc, 0xdaafcf30, 0x39a840be, + 0xa7a8ea72, 0xbea12f78, 0x20a185b4, 0xc3a60a3a, 0x5da6a0f6, + 0x8ce74daa, 0x12e7e766, 0xf1e068e8, 0x6fe0c224, 0x76e9072e, + 0xe8e9ade2, 0x0bee226c, 0x95ee88a0, 0x39fca879, 0xa7fc02b5, + 0x44fb8d3b, 0xdafb27f7, 0xc3f2e2fd, 0x5df24831, 0xbef5c7bf, + 0x20f56d73, 0xa7d6f6d6, 0x39d65c1a, 0xdad1d394, 0x44d17958, + 0x5dd8bc52, 0xc3d8169e, 0x20df9910, 0xbedf33dc, 0x12cd1305, + 0x8ccdb9c9, 0x6fca3647, 0xf1ca9c8b, 0xe8c35981, 0x76c3f34d, + 0x95c47cc3, 0x0bc4d60f, 0x3747a67a, 0xa9470cb6, 0x4a408338, + 0xd44029f4, 0xcd49ecfe, 0x53494632, 0xb04ec9bc, 0x2e4e6370, + 0x825c43a9, 0x1c5ce965, 0xff5b66eb, 0x615bcc27, 0x7852092d, + 0xe652a3e1, 0x05552c6f, 0x9b5586a3, 0x1c761d06, 0x8276b7ca, + 0x61713844, 0xff719288, 0xe6785782, 0x7878fd4e, 0x9b7f72c0, + 0x057fd80c, 0xa96df8d5, 0x376d5219, 0xd46add97, 0x4a6a775b, + 0x5363b251, 0xcd63189d, 0x2e649713, 0xb0643ddf, 0x6125d083, + 0xff257a4f, 0x1c22f5c1, 0x82225f0d, 0x9b2b9a07, 0x052b30cb, + 0xe62cbf45, 0x782c1589, 0xd43e3550, 0x4a3e9f9c, 0xa9391012, + 0x3739bade, 0x2e307fd4, 0xb030d518, 0x53375a96, 0xcd37f05a, + 0x4a146bff, 0xd414c133, 0x37134ebd, 0xa913e471, 0xb01a217b, + 0x2e1a8bb7, 0xcd1d0439, 0x531daef5, 0xff0f8e2c, 0x610f24e0, + 0x8208ab6e, 0x1c0801a2, 0x0501c4a8, 0x9b016e64, 0x7806e1ea, + 0xe6064b26}}; + #endif - } -}; + +#endif + +#if N == 3 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x81256527, 0xd93bcc0f, 0x581ea928, 0x69069e5f, + 0xe823fb78, 0xb03d5250, 0x31183777, 0xd20d3cbe, 0x53285999, + 0x0b36f0b1, 0x8a139596, 0xbb0ba2e1, 0x3a2ec7c6, 0x62306eee, + 0xe3150bc9, 0x7f6b7f3d, 0xfe4e1a1a, 0xa650b332, 0x2775d615, + 0x166de162, 0x97488445, 0xcf562d6d, 0x4e73484a, 0xad664383, + 0x2c4326a4, 0x745d8f8c, 0xf578eaab, 0xc460dddc, 0x4545b8fb, + 0x1d5b11d3, 0x9c7e74f4, 0xfed6fe7a, 0x7ff39b5d, 0x27ed3275, + 0xa6c85752, 0x97d06025, 0x16f50502, 0x4eebac2a, 0xcfcec90d, + 0x2cdbc2c4, 0xadfea7e3, 0xf5e00ecb, 0x74c56bec, 0x45dd5c9b, + 0xc4f839bc, 0x9ce69094, 0x1dc3f5b3, 0x81bd8147, 0x0098e460, + 0x58864d48, 0xd9a3286f, 0xe8bb1f18, 0x699e7a3f, 0x3180d317, + 0xb0a5b630, 0x53b0bdf9, 0xd295d8de, 0x8a8b71f6, 0x0bae14d1, + 0x3ab623a6, 0xbb934681, 0xe38defa9, 0x62a88a8e, 0x26dcfab5, + 0xa7f99f92, 0xffe736ba, 0x7ec2539d, 0x4fda64ea, 0xceff01cd, + 0x96e1a8e5, 0x17c4cdc2, 0xf4d1c60b, 0x75f4a32c, 0x2dea0a04, + 0xaccf6f23, 0x9dd75854, 0x1cf23d73, 0x44ec945b, 0xc5c9f17c, + 0x59b78588, 0xd892e0af, 0x808c4987, 0x01a92ca0, 0x30b11bd7, + 0xb1947ef0, 0xe98ad7d8, 0x68afb2ff, 0x8bbab936, 0x0a9fdc11, + 0x52817539, 0xd3a4101e, 0xe2bc2769, 0x6399424e, 0x3b87eb66, + 0xbaa28e41, 0xd80a04cf, 0x592f61e8, 0x0131c8c0, 0x8014ade7, + 0xb10c9a90, 0x3029ffb7, 0x6837569f, 0xe91233b8, 0x0a073871, + 0x8b225d56, 0xd33cf47e, 0x52199159, 0x6301a62e, 0xe224c309, + 0xba3a6a21, 0x3b1f0f06, 0xa7617bf2, 0x26441ed5, 0x7e5ab7fd, + 0xff7fd2da, 0xce67e5ad, 0x4f42808a, 0x175c29a2, 0x96794c85, + 0x756c474c, 0xf449226b, 0xac578b43, 0x2d72ee64, 0x1c6ad913, + 0x9d4fbc34, 0xc551151c, 0x4474703b, 0x4db9f56a, 0xcc9c904d, + 0x94823965, 0x15a75c42, 0x24bf6b35, 0xa59a0e12, 0xfd84a73a, + 0x7ca1c21d, 0x9fb4c9d4, 0x1e91acf3, 0x468f05db, 0xc7aa60fc, + 0xf6b2578b, 0x779732ac, 0x2f899b84, 0xaeacfea3, 0x32d28a57, + 0xb3f7ef70, 0xebe94658, 0x6acc237f, 0x5bd41408, 0xdaf1712f, + 0x82efd807, 0x03cabd20, 0xe0dfb6e9, 0x61fad3ce, 0x39e47ae6, + 0xb8c11fc1, 0x89d928b6, 0x08fc4d91, 0x50e2e4b9, 0xd1c7819e, + 0xb36f0b10, 0x324a6e37, 0x6a54c71f, 0xeb71a238, 0xda69954f, + 0x5b4cf068, 0x03525940, 0x82773c67, 0x616237ae, 0xe0475289, + 0xb859fba1, 0x397c9e86, 0x0864a9f1, 0x8941ccd6, 0xd15f65fe, + 0x507a00d9, 0xcc04742d, 0x4d21110a, 0x153fb822, 0x941add05, + 0xa502ea72, 0x24278f55, 0x7c39267d, 0xfd1c435a, 0x1e094893, + 0x9f2c2db4, 0xc732849c, 0x4617e1bb, 0x770fd6cc, 0xf62ab3eb, + 0xae341ac3, 0x2f117fe4, 0x6b650fdf, 0xea406af8, 0xb25ec3d0, + 0x337ba6f7, 0x02639180, 0x8346f4a7, 0xdb585d8f, 0x5a7d38a8, + 0xb9683361, 0x384d5646, 0x6053ff6e, 0xe1769a49, 0xd06ead3e, + 0x514bc819, 0x09556131, 0x88700416, 0x140e70e2, 0x952b15c5, + 0xcd35bced, 0x4c10d9ca, 0x7d08eebd, 0xfc2d8b9a, 0xa43322b2, + 0x25164795, 0xc6034c5c, 0x4726297b, 0x1f388053, 0x9e1de574, + 0xaf05d203, 0x2e20b724, 0x763e1e0c, 0xf71b7b2b, 0x95b3f1a5, + 0x14969482, 0x4c883daa, 0xcdad588d, 0xfcb56ffa, 0x7d900add, + 0x258ea3f5, 0xa4abc6d2, 0x47becd1b, 0xc69ba83c, 0x9e850114, + 0x1fa06433, 0x2eb85344, 0xaf9d3663, 0xf7839f4b, 0x76a6fa6c, + 0xead88e98, 0x6bfdebbf, 0x33e34297, 0xb2c627b0, 0x83de10c7, + 0x02fb75e0, 0x5ae5dcc8, 0xdbc0b9ef, 0x38d5b226, 0xb9f0d701, + 0xe1ee7e29, 0x60cb1b0e, 0x51d32c79, 0xd0f6495e, 0x88e8e076, + 0x09cd8551}, + {0x00000000, 0x9b73ead4, 0xed96d3e9, 0x76e5393d, 0x005ca193, + 0x9b2f4b47, 0xedca727a, 0x76b998ae, 0x00b94326, 0x9bcaa9f2, + 0xed2f90cf, 0x765c7a1b, 0x00e5e2b5, 0x9b960861, 0xed73315c, + 0x7600db88, 0x0172864c, 0x9a016c98, 0xece455a5, 0x7797bf71, + 0x012e27df, 0x9a5dcd0b, 0xecb8f436, 0x77cb1ee2, 0x01cbc56a, + 0x9ab82fbe, 0xec5d1683, 0x772efc57, 0x019764f9, 0x9ae48e2d, + 0xec01b710, 0x77725dc4, 0x02e50c98, 0x9996e64c, 0xef73df71, + 0x740035a5, 0x02b9ad0b, 0x99ca47df, 0xef2f7ee2, 0x745c9436, + 0x025c4fbe, 0x992fa56a, 0xefca9c57, 0x74b97683, 0x0200ee2d, + 0x997304f9, 0xef963dc4, 0x74e5d710, 0x03978ad4, 0x98e46000, + 0xee01593d, 0x7572b3e9, 0x03cb2b47, 0x98b8c193, 0xee5df8ae, + 0x752e127a, 0x032ec9f2, 0x985d2326, 0xeeb81a1b, 0x75cbf0cf, + 0x03726861, 0x980182b5, 0xeee4bb88, 0x7597515c, 0x05ca1930, + 0x9eb9f3e4, 0xe85ccad9, 0x732f200d, 0x0596b8a3, 0x9ee55277, + 0xe8006b4a, 0x7373819e, 0x05735a16, 0x9e00b0c2, 0xe8e589ff, + 0x7396632b, 0x052ffb85, 0x9e5c1151, 0xe8b9286c, 0x73cac2b8, + 0x04b89f7c, 0x9fcb75a8, 0xe92e4c95, 0x725da641, 0x04e43eef, + 0x9f97d43b, 0xe972ed06, 0x720107d2, 0x0401dc5a, 0x9f72368e, + 0xe9970fb3, 0x72e4e567, 0x045d7dc9, 0x9f2e971d, 0xe9cbae20, + 0x72b844f4, 0x072f15a8, 0x9c5cff7c, 0xeab9c641, 0x71ca2c95, + 0x0773b43b, 0x9c005eef, 0xeae567d2, 0x71968d06, 0x0796568e, + 0x9ce5bc5a, 0xea008567, 0x71736fb3, 0x07caf71d, 0x9cb91dc9, + 0xea5c24f4, 0x712fce20, 0x065d93e4, 0x9d2e7930, 0xebcb400d, + 0x70b8aad9, 0x06013277, 0x9d72d8a3, 0xeb97e19e, 0x70e40b4a, + 0x06e4d0c2, 0x9d973a16, 0xeb72032b, 0x7001e9ff, 0x06b87151, + 0x9dcb9b85, 0xeb2ea2b8, 0x705d486c, 0x0b943260, 0x90e7d8b4, + 0xe602e189, 0x7d710b5d, 0x0bc893f3, 0x90bb7927, 0xe65e401a, + 0x7d2daace, 0x0b2d7146, 0x905e9b92, 0xe6bba2af, 0x7dc8487b, + 0x0b71d0d5, 0x90023a01, 0xe6e7033c, 0x7d94e9e8, 0x0ae6b42c, + 0x91955ef8, 0xe77067c5, 0x7c038d11, 0x0aba15bf, 0x91c9ff6b, + 0xe72cc656, 0x7c5f2c82, 0x0a5ff70a, 0x912c1dde, 0xe7c924e3, + 0x7cbace37, 0x0a035699, 0x9170bc4d, 0xe7958570, 0x7ce66fa4, + 0x09713ef8, 0x9202d42c, 0xe4e7ed11, 0x7f9407c5, 0x092d9f6b, + 0x925e75bf, 0xe4bb4c82, 0x7fc8a656, 0x09c87dde, 0x92bb970a, + 0xe45eae37, 0x7f2d44e3, 0x0994dc4d, 0x92e73699, 0xe4020fa4, + 0x7f71e570, 0x0803b8b4, 0x93705260, 0xe5956b5d, 0x7ee68189, + 0x085f1927, 0x932cf3f3, 0xe5c9cace, 0x7eba201a, 0x08bafb92, + 0x93c91146, 0xe52c287b, 0x7e5fc2af, 0x08e65a01, 0x9395b0d5, + 0xe57089e8, 0x7e03633c, 0x0e5e2b50, 0x952dc184, 0xe3c8f8b9, + 0x78bb126d, 0x0e028ac3, 0x95716017, 0xe394592a, 0x78e7b3fe, + 0x0ee76876, 0x959482a2, 0xe371bb9f, 0x7802514b, 0x0ebbc9e5, + 0x95c82331, 0xe32d1a0c, 0x785ef0d8, 0x0f2cad1c, 0x945f47c8, + 0xe2ba7ef5, 0x79c99421, 0x0f700c8f, 0x9403e65b, 0xe2e6df66, + 0x799535b2, 0x0f95ee3a, 0x94e604ee, 0xe2033dd3, 0x7970d707, + 0x0fc94fa9, 0x94baa57d, 0xe25f9c40, 0x792c7694, 0x0cbb27c8, + 0x97c8cd1c, 0xe12df421, 0x7a5e1ef5, 0x0ce7865b, 0x97946c8f, + 0xe17155b2, 0x7a02bf66, 0x0c0264ee, 0x97718e3a, 0xe194b707, + 0x7ae75dd3, 0x0c5ec57d, 0x972d2fa9, 0xe1c81694, 0x7abbfc40, + 0x0dc9a184, 0x96ba4b50, 0xe05f726d, 0x7b2c98b9, 0x0d950017, + 0x96e6eac3, 0xe003d3fe, 0x7b70392a, 0x0d70e2a2, 0x96030876, + 0xe0e6314b, 0x7b95db9f, 0x0d2c4331, 0x965fa9e5, 0xe0ba90d8, + 0x7bc97a0c}, + {0x00000000, 0x172864c0, 0x2e50c980, 0x3978ad40, 0x5ca19300, + 0x4b89f7c0, 0x72f15a80, 0x65d93e40, 0xb9432600, 0xae6b42c0, + 0x9713ef80, 0x803b8b40, 0xe5e2b500, 0xf2cad1c0, 0xcbb27c80, + 0xdc9a1840, 0xa9f74a41, 0xbedf2e81, 0x87a783c1, 0x908fe701, + 0xf556d941, 0xe27ebd81, 0xdb0610c1, 0xcc2e7401, 0x10b46c41, + 0x079c0881, 0x3ee4a5c1, 0x29ccc101, 0x4c15ff41, 0x5b3d9b81, + 0x624536c1, 0x756d5201, 0x889f92c3, 0x9fb7f603, 0xa6cf5b43, + 0xb1e73f83, 0xd43e01c3, 0xc3166503, 0xfa6ec843, 0xed46ac83, + 0x31dcb4c3, 0x26f4d003, 0x1f8c7d43, 0x08a41983, 0x6d7d27c3, + 0x7a554303, 0x432dee43, 0x54058a83, 0x2168d882, 0x3640bc42, + 0x0f381102, 0x181075c2, 0x7dc94b82, 0x6ae12f42, 0x53998202, + 0x44b1e6c2, 0x982bfe82, 0x8f039a42, 0xb67b3702, 0xa15353c2, + 0xc48a6d82, 0xd3a20942, 0xeadaa402, 0xfdf2c0c2, 0xca4e23c7, + 0xdd664707, 0xe41eea47, 0xf3368e87, 0x96efb0c7, 0x81c7d407, + 0xb8bf7947, 0xaf971d87, 0x730d05c7, 0x64256107, 0x5d5dcc47, + 0x4a75a887, 0x2fac96c7, 0x3884f207, 0x01fc5f47, 0x16d43b87, + 0x63b96986, 0x74910d46, 0x4de9a006, 0x5ac1c4c6, 0x3f18fa86, + 0x28309e46, 0x11483306, 0x066057c6, 0xdafa4f86, 0xcdd22b46, + 0xf4aa8606, 0xe382e2c6, 0x865bdc86, 0x9173b846, 0xa80b1506, + 0xbf2371c6, 0x42d1b104, 0x55f9d5c4, 0x6c817884, 0x7ba91c44, + 0x1e702204, 0x095846c4, 0x3020eb84, 0x27088f44, 0xfb929704, + 0xecbaf3c4, 0xd5c25e84, 0xc2ea3a44, 0xa7330404, 0xb01b60c4, + 0x8963cd84, 0x9e4ba944, 0xeb26fb45, 0xfc0e9f85, 0xc57632c5, + 0xd25e5605, 0xb7876845, 0xa0af0c85, 0x99d7a1c5, 0x8effc505, + 0x5265dd45, 0x454db985, 0x7c3514c5, 0x6b1d7005, 0x0ec44e45, + 0x19ec2a85, 0x209487c5, 0x37bce305, 0x4fed41cf, 0x58c5250f, + 0x61bd884f, 0x7695ec8f, 0x134cd2cf, 0x0464b60f, 0x3d1c1b4f, + 0x2a347f8f, 0xf6ae67cf, 0xe186030f, 0xd8feae4f, 0xcfd6ca8f, + 0xaa0ff4cf, 0xbd27900f, 0x845f3d4f, 0x9377598f, 0xe61a0b8e, + 0xf1326f4e, 0xc84ac20e, 0xdf62a6ce, 0xbabb988e, 0xad93fc4e, + 0x94eb510e, 0x83c335ce, 0x5f592d8e, 0x4871494e, 0x7109e40e, + 0x662180ce, 0x03f8be8e, 0x14d0da4e, 0x2da8770e, 0x3a8013ce, + 0xc772d30c, 0xd05ab7cc, 0xe9221a8c, 0xfe0a7e4c, 0x9bd3400c, + 0x8cfb24cc, 0xb583898c, 0xa2abed4c, 0x7e31f50c, 0x691991cc, + 0x50613c8c, 0x4749584c, 0x2290660c, 0x35b802cc, 0x0cc0af8c, + 0x1be8cb4c, 0x6e85994d, 0x79adfd8d, 0x40d550cd, 0x57fd340d, + 0x32240a4d, 0x250c6e8d, 0x1c74c3cd, 0x0b5ca70d, 0xd7c6bf4d, + 0xc0eedb8d, 0xf99676cd, 0xeebe120d, 0x8b672c4d, 0x9c4f488d, + 0xa537e5cd, 0xb21f810d, 0x85a36208, 0x928b06c8, 0xabf3ab88, + 0xbcdbcf48, 0xd902f108, 0xce2a95c8, 0xf7523888, 0xe07a5c48, + 0x3ce04408, 0x2bc820c8, 0x12b08d88, 0x0598e948, 0x6041d708, + 0x7769b3c8, 0x4e111e88, 0x59397a48, 0x2c542849, 0x3b7c4c89, + 0x0204e1c9, 0x152c8509, 0x70f5bb49, 0x67dddf89, 0x5ea572c9, + 0x498d1609, 0x95170e49, 0x823f6a89, 0xbb47c7c9, 0xac6fa309, + 0xc9b69d49, 0xde9ef989, 0xe7e654c9, 0xf0ce3009, 0x0d3cf0cb, + 0x1a14940b, 0x236c394b, 0x34445d8b, 0x519d63cb, 0x46b5070b, + 0x7fcdaa4b, 0x68e5ce8b, 0xb47fd6cb, 0xa357b20b, 0x9a2f1f4b, + 0x8d077b8b, 0xe8de45cb, 0xfff6210b, 0xc68e8c4b, 0xd1a6e88b, + 0xa4cbba8a, 0xb3e3de4a, 0x8a9b730a, 0x9db317ca, 0xf86a298a, + 0xef424d4a, 0xd63ae00a, 0xc11284ca, 0x1d889c8a, 0x0aa0f84a, + 0x33d8550a, 0x24f031ca, 0x41290f8a, 0x56016b4a, 0x6f79c60a, + 0x7851a2ca}, + {0x00000000, 0x9fda839e, 0xe4c4017d, 0x7b1e82e3, 0x12f904bb, + 0x8d238725, 0xf63d05c6, 0x69e78658, 0x25f20976, 0xba288ae8, + 0xc136080b, 0x5eec8b95, 0x370b0dcd, 0xa8d18e53, 0xd3cf0cb0, + 0x4c158f2e, 0x4be412ec, 0xd43e9172, 0xaf201391, 0x30fa900f, + 0x591d1657, 0xc6c795c9, 0xbdd9172a, 0x220394b4, 0x6e161b9a, + 0xf1cc9804, 0x8ad21ae7, 0x15089979, 0x7cef1f21, 0xe3359cbf, + 0x982b1e5c, 0x07f19dc2, 0x97c825d8, 0x0812a646, 0x730c24a5, + 0xecd6a73b, 0x85312163, 0x1aeba2fd, 0x61f5201e, 0xfe2fa380, + 0xb23a2cae, 0x2de0af30, 0x56fe2dd3, 0xc924ae4d, 0xa0c32815, + 0x3f19ab8b, 0x44072968, 0xdbddaaf6, 0xdc2c3734, 0x43f6b4aa, + 0x38e83649, 0xa732b5d7, 0xced5338f, 0x510fb011, 0x2a1132f2, + 0xb5cbb16c, 0xf9de3e42, 0x6604bddc, 0x1d1a3f3f, 0x82c0bca1, + 0xeb273af9, 0x74fdb967, 0x0fe33b84, 0x9039b81a, 0xf4e14df1, + 0x6b3bce6f, 0x10254c8c, 0x8fffcf12, 0xe618494a, 0x79c2cad4, + 0x02dc4837, 0x9d06cba9, 0xd1134487, 0x4ec9c719, 0x35d745fa, + 0xaa0dc664, 0xc3ea403c, 0x5c30c3a2, 0x272e4141, 0xb8f4c2df, + 0xbf055f1d, 0x20dfdc83, 0x5bc15e60, 0xc41bddfe, 0xadfc5ba6, + 0x3226d838, 0x49385adb, 0xd6e2d945, 0x9af7566b, 0x052dd5f5, + 0x7e335716, 0xe1e9d488, 0x880e52d0, 0x17d4d14e, 0x6cca53ad, + 0xf310d033, 0x63296829, 0xfcf3ebb7, 0x87ed6954, 0x1837eaca, + 0x71d06c92, 0xee0aef0c, 0x95146def, 0x0aceee71, 0x46db615f, + 0xd901e2c1, 0xa21f6022, 0x3dc5e3bc, 0x542265e4, 0xcbf8e67a, + 0xb0e66499, 0x2f3ce707, 0x28cd7ac5, 0xb717f95b, 0xcc097bb8, + 0x53d3f826, 0x3a347e7e, 0xa5eefde0, 0xdef07f03, 0x412afc9d, + 0x0d3f73b3, 0x92e5f02d, 0xe9fb72ce, 0x7621f150, 0x1fc67708, + 0x801cf496, 0xfb027675, 0x64d8f5eb, 0x32b39da3, 0xad691e3d, + 0xd6779cde, 0x49ad1f40, 0x204a9918, 0xbf901a86, 0xc48e9865, + 0x5b541bfb, 0x174194d5, 0x889b174b, 0xf38595a8, 0x6c5f1636, + 0x05b8906e, 0x9a6213f0, 0xe17c9113, 0x7ea6128d, 0x79578f4f, + 0xe68d0cd1, 0x9d938e32, 0x02490dac, 0x6bae8bf4, 0xf474086a, + 0x8f6a8a89, 0x10b00917, 0x5ca58639, 0xc37f05a7, 0xb8618744, + 0x27bb04da, 0x4e5c8282, 0xd186011c, 0xaa9883ff, 0x35420061, + 0xa57bb87b, 0x3aa13be5, 0x41bfb906, 0xde653a98, 0xb782bcc0, + 0x28583f5e, 0x5346bdbd, 0xcc9c3e23, 0x8089b10d, 0x1f533293, + 0x644db070, 0xfb9733ee, 0x9270b5b6, 0x0daa3628, 0x76b4b4cb, + 0xe96e3755, 0xee9faa97, 0x71452909, 0x0a5babea, 0x95812874, + 0xfc66ae2c, 0x63bc2db2, 0x18a2af51, 0x87782ccf, 0xcb6da3e1, + 0x54b7207f, 0x2fa9a29c, 0xb0732102, 0xd994a75a, 0x464e24c4, + 0x3d50a627, 0xa28a25b9, 0xc652d052, 0x598853cc, 0x2296d12f, + 0xbd4c52b1, 0xd4abd4e9, 0x4b715777, 0x306fd594, 0xafb5560a, + 0xe3a0d924, 0x7c7a5aba, 0x0764d859, 0x98be5bc7, 0xf159dd9f, + 0x6e835e01, 0x159ddce2, 0x8a475f7c, 0x8db6c2be, 0x126c4120, + 0x6972c3c3, 0xf6a8405d, 0x9f4fc605, 0x0095459b, 0x7b8bc778, + 0xe45144e6, 0xa844cbc8, 0x379e4856, 0x4c80cab5, 0xd35a492b, + 0xbabdcf73, 0x25674ced, 0x5e79ce0e, 0xc1a34d90, 0x519af58a, + 0xce407614, 0xb55ef4f7, 0x2a847769, 0x4363f131, 0xdcb972af, + 0xa7a7f04c, 0x387d73d2, 0x7468fcfc, 0xebb27f62, 0x90acfd81, + 0x0f767e1f, 0x6691f847, 0xf94b7bd9, 0x8255f93a, 0x1d8f7aa4, + 0x1a7ee766, 0x85a464f8, 0xfebae61b, 0x61606585, 0x0887e3dd, + 0x975d6043, 0xec43e2a0, 0x7399613e, 0x3f8cee10, 0xa0566d8e, + 0xdb48ef6d, 0x44926cf3, 0x2d75eaab, 0xb2af6935, 0xc9b1ebd6, + 0x566b6848}, + {0x00000000, 0x65673b46, 0xcace768c, 0xafa94dca, 0x4eedeb59, + 0x2b8ad01f, 0x84239dd5, 0xe144a693, 0x9ddbd6b2, 0xf8bcedf4, + 0x5715a03e, 0x32729b78, 0xd3363deb, 0xb65106ad, 0x19f84b67, + 0x7c9f7021, 0xe0c6ab25, 0x85a19063, 0x2a08dda9, 0x4f6fe6ef, + 0xae2b407c, 0xcb4c7b3a, 0x64e536f0, 0x01820db6, 0x7d1d7d97, + 0x187a46d1, 0xb7d30b1b, 0xd2b4305d, 0x33f096ce, 0x5697ad88, + 0xf93ee042, 0x9c59db04, 0x1afc500b, 0x7f9b6b4d, 0xd0322687, + 0xb5551dc1, 0x5411bb52, 0x31768014, 0x9edfcdde, 0xfbb8f698, + 0x872786b9, 0xe240bdff, 0x4de9f035, 0x288ecb73, 0xc9ca6de0, + 0xacad56a6, 0x03041b6c, 0x6663202a, 0xfa3afb2e, 0x9f5dc068, + 0x30f48da2, 0x5593b6e4, 0xb4d71077, 0xd1b02b31, 0x7e1966fb, + 0x1b7e5dbd, 0x67e12d9c, 0x028616da, 0xad2f5b10, 0xc8486056, + 0x290cc6c5, 0x4c6bfd83, 0xe3c2b049, 0x86a58b0f, 0x35f8a016, + 0x509f9b50, 0xff36d69a, 0x9a51eddc, 0x7b154b4f, 0x1e727009, + 0xb1db3dc3, 0xd4bc0685, 0xa82376a4, 0xcd444de2, 0x62ed0028, + 0x078a3b6e, 0xe6ce9dfd, 0x83a9a6bb, 0x2c00eb71, 0x4967d037, + 0xd53e0b33, 0xb0593075, 0x1ff07dbf, 0x7a9746f9, 0x9bd3e06a, + 0xfeb4db2c, 0x511d96e6, 0x347aada0, 0x48e5dd81, 0x2d82e6c7, + 0x822bab0d, 0xe74c904b, 0x060836d8, 0x636f0d9e, 0xccc64054, + 0xa9a17b12, 0x2f04f01d, 0x4a63cb5b, 0xe5ca8691, 0x80adbdd7, + 0x61e91b44, 0x048e2002, 0xab276dc8, 0xce40568e, 0xb2df26af, + 0xd7b81de9, 0x78115023, 0x1d766b65, 0xfc32cdf6, 0x9955f6b0, + 0x36fcbb7a, 0x539b803c, 0xcfc25b38, 0xaaa5607e, 0x050c2db4, + 0x606b16f2, 0x812fb061, 0xe4488b27, 0x4be1c6ed, 0x2e86fdab, + 0x52198d8a, 0x377eb6cc, 0x98d7fb06, 0xfdb0c040, 0x1cf466d3, + 0x79935d95, 0xd63a105f, 0xb35d2b19, 0x6bf1402c, 0x0e967b6a, + 0xa13f36a0, 0xc4580de6, 0x251cab75, 0x407b9033, 0xefd2ddf9, + 0x8ab5e6bf, 0xf62a969e, 0x934dadd8, 0x3ce4e012, 0x5983db54, + 0xb8c77dc7, 0xdda04681, 0x72090b4b, 0x176e300d, 0x8b37eb09, + 0xee50d04f, 0x41f99d85, 0x249ea6c3, 0xc5da0050, 0xa0bd3b16, + 0x0f1476dc, 0x6a734d9a, 0x16ec3dbb, 0x738b06fd, 0xdc224b37, + 0xb9457071, 0x5801d6e2, 0x3d66eda4, 0x92cfa06e, 0xf7a89b28, + 0x710d1027, 0x146a2b61, 0xbbc366ab, 0xdea45ded, 0x3fe0fb7e, + 0x5a87c038, 0xf52e8df2, 0x9049b6b4, 0xecd6c695, 0x89b1fdd3, + 0x2618b019, 0x437f8b5f, 0xa23b2dcc, 0xc75c168a, 0x68f55b40, + 0x0d926006, 0x91cbbb02, 0xf4ac8044, 0x5b05cd8e, 0x3e62f6c8, + 0xdf26505b, 0xba416b1d, 0x15e826d7, 0x708f1d91, 0x0c106db0, + 0x697756f6, 0xc6de1b3c, 0xa3b9207a, 0x42fd86e9, 0x279abdaf, + 0x8833f065, 0xed54cb23, 0x5e09e03a, 0x3b6edb7c, 0x94c796b6, + 0xf1a0adf0, 0x10e40b63, 0x75833025, 0xda2a7def, 0xbf4d46a9, + 0xc3d23688, 0xa6b50dce, 0x091c4004, 0x6c7b7b42, 0x8d3fddd1, + 0xe858e697, 0x47f1ab5d, 0x2296901b, 0xbecf4b1f, 0xdba87059, + 0x74013d93, 0x116606d5, 0xf022a046, 0x95459b00, 0x3aecd6ca, + 0x5f8bed8c, 0x23149dad, 0x4673a6eb, 0xe9daeb21, 0x8cbdd067, + 0x6df976f4, 0x089e4db2, 0xa7370078, 0xc2503b3e, 0x44f5b031, + 0x21928b77, 0x8e3bc6bd, 0xeb5cfdfb, 0x0a185b68, 0x6f7f602e, + 0xc0d62de4, 0xa5b116a2, 0xd92e6683, 0xbc495dc5, 0x13e0100f, + 0x76872b49, 0x97c38dda, 0xf2a4b69c, 0x5d0dfb56, 0x386ac010, + 0xa4331b14, 0xc1542052, 0x6efd6d98, 0x0b9a56de, 0xeadef04d, + 0x8fb9cb0b, 0x201086c1, 0x4577bd87, 0x39e8cda6, 0x5c8ff6e0, + 0xf326bb2a, 0x9641806c, 0x770526ff, 0x12621db9, 0xbdcb5073, + 0xd8ac6b35}, + {0x00000000, 0xd7e28058, 0x74b406f1, 0xa35686a9, 0xe9680de2, + 0x3e8a8dba, 0x9ddc0b13, 0x4a3e8b4b, 0x09a11d85, 0xde439ddd, + 0x7d151b74, 0xaaf79b2c, 0xe0c91067, 0x372b903f, 0x947d1696, + 0x439f96ce, 0x13423b0a, 0xc4a0bb52, 0x67f63dfb, 0xb014bda3, + 0xfa2a36e8, 0x2dc8b6b0, 0x8e9e3019, 0x597cb041, 0x1ae3268f, + 0xcd01a6d7, 0x6e57207e, 0xb9b5a026, 0xf38b2b6d, 0x2469ab35, + 0x873f2d9c, 0x50ddadc4, 0x26847614, 0xf166f64c, 0x523070e5, + 0x85d2f0bd, 0xcfec7bf6, 0x180efbae, 0xbb587d07, 0x6cbafd5f, + 0x2f256b91, 0xf8c7ebc9, 0x5b916d60, 0x8c73ed38, 0xc64d6673, + 0x11afe62b, 0xb2f96082, 0x651be0da, 0x35c64d1e, 0xe224cd46, + 0x41724bef, 0x9690cbb7, 0xdcae40fc, 0x0b4cc0a4, 0xa81a460d, + 0x7ff8c655, 0x3c67509b, 0xeb85d0c3, 0x48d3566a, 0x9f31d632, + 0xd50f5d79, 0x02eddd21, 0xa1bb5b88, 0x7659dbd0, 0x4d08ec28, + 0x9aea6c70, 0x39bcead9, 0xee5e6a81, 0xa460e1ca, 0x73826192, + 0xd0d4e73b, 0x07366763, 0x44a9f1ad, 0x934b71f5, 0x301df75c, + 0xe7ff7704, 0xadc1fc4f, 0x7a237c17, 0xd975fabe, 0x0e977ae6, + 0x5e4ad722, 0x89a8577a, 0x2afed1d3, 0xfd1c518b, 0xb722dac0, + 0x60c05a98, 0xc396dc31, 0x14745c69, 0x57ebcaa7, 0x80094aff, + 0x235fcc56, 0xf4bd4c0e, 0xbe83c745, 0x6961471d, 0xca37c1b4, + 0x1dd541ec, 0x6b8c9a3c, 0xbc6e1a64, 0x1f389ccd, 0xc8da1c95, + 0x82e497de, 0x55061786, 0xf650912f, 0x21b21177, 0x622d87b9, + 0xb5cf07e1, 0x16998148, 0xc17b0110, 0x8b458a5b, 0x5ca70a03, + 0xfff18caa, 0x28130cf2, 0x78cea136, 0xaf2c216e, 0x0c7aa7c7, + 0xdb98279f, 0x91a6acd4, 0x46442c8c, 0xe512aa25, 0x32f02a7d, + 0x716fbcb3, 0xa68d3ceb, 0x05dbba42, 0xd2393a1a, 0x9807b151, + 0x4fe53109, 0xecb3b7a0, 0x3b5137f8, 0x9a11d850, 0x4df35808, + 0xeea5dea1, 0x39475ef9, 0x7379d5b2, 0xa49b55ea, 0x07cdd343, + 0xd02f531b, 0x93b0c5d5, 0x4452458d, 0xe704c324, 0x30e6437c, + 0x7ad8c837, 0xad3a486f, 0x0e6ccec6, 0xd98e4e9e, 0x8953e35a, + 0x5eb16302, 0xfde7e5ab, 0x2a0565f3, 0x603beeb8, 0xb7d96ee0, + 0x148fe849, 0xc36d6811, 0x80f2fedf, 0x57107e87, 0xf446f82e, + 0x23a47876, 0x699af33d, 0xbe787365, 0x1d2ef5cc, 0xcacc7594, + 0xbc95ae44, 0x6b772e1c, 0xc821a8b5, 0x1fc328ed, 0x55fda3a6, + 0x821f23fe, 0x2149a557, 0xf6ab250f, 0xb534b3c1, 0x62d63399, + 0xc180b530, 0x16623568, 0x5c5cbe23, 0x8bbe3e7b, 0x28e8b8d2, + 0xff0a388a, 0xafd7954e, 0x78351516, 0xdb6393bf, 0x0c8113e7, + 0x46bf98ac, 0x915d18f4, 0x320b9e5d, 0xe5e91e05, 0xa67688cb, + 0x71940893, 0xd2c28e3a, 0x05200e62, 0x4f1e8529, 0x98fc0571, + 0x3baa83d8, 0xec480380, 0xd7193478, 0x00fbb420, 0xa3ad3289, + 0x744fb2d1, 0x3e71399a, 0xe993b9c2, 0x4ac53f6b, 0x9d27bf33, + 0xdeb829fd, 0x095aa9a5, 0xaa0c2f0c, 0x7deeaf54, 0x37d0241f, + 0xe032a447, 0x436422ee, 0x9486a2b6, 0xc45b0f72, 0x13b98f2a, + 0xb0ef0983, 0x670d89db, 0x2d330290, 0xfad182c8, 0x59870461, + 0x8e658439, 0xcdfa12f7, 0x1a1892af, 0xb94e1406, 0x6eac945e, + 0x24921f15, 0xf3709f4d, 0x502619e4, 0x87c499bc, 0xf19d426c, + 0x267fc234, 0x8529449d, 0x52cbc4c5, 0x18f54f8e, 0xcf17cfd6, + 0x6c41497f, 0xbba3c927, 0xf83c5fe9, 0x2fdedfb1, 0x8c885918, + 0x5b6ad940, 0x1154520b, 0xc6b6d253, 0x65e054fa, 0xb202d4a2, + 0xe2df7966, 0x353df93e, 0x966b7f97, 0x4189ffcf, 0x0bb77484, + 0xdc55f4dc, 0x7f037275, 0xa8e1f22d, 0xeb7e64e3, 0x3c9ce4bb, + 0x9fca6212, 0x4828e24a, 0x02166901, 0xd5f4e959, 0x76a26ff0, + 0xa140efa8}, + {0x00000000, 0xef52b6e1, 0x05d46b83, 0xea86dd62, 0x0ba8d706, + 0xe4fa61e7, 0x0e7cbc85, 0xe12e0a64, 0x1751ae0c, 0xf80318ed, + 0x1285c58f, 0xfdd7736e, 0x1cf9790a, 0xf3abcfeb, 0x192d1289, + 0xf67fa468, 0x2ea35c18, 0xc1f1eaf9, 0x2b77379b, 0xc425817a, + 0x250b8b1e, 0xca593dff, 0x20dfe09d, 0xcf8d567c, 0x39f2f214, + 0xd6a044f5, 0x3c269997, 0xd3742f76, 0x325a2512, 0xdd0893f3, + 0x378e4e91, 0xd8dcf870, 0x5d46b830, 0xb2140ed1, 0x5892d3b3, + 0xb7c06552, 0x56ee6f36, 0xb9bcd9d7, 0x533a04b5, 0xbc68b254, + 0x4a17163c, 0xa545a0dd, 0x4fc37dbf, 0xa091cb5e, 0x41bfc13a, + 0xaeed77db, 0x446baab9, 0xab391c58, 0x73e5e428, 0x9cb752c9, + 0x76318fab, 0x9963394a, 0x784d332e, 0x971f85cf, 0x7d9958ad, + 0x92cbee4c, 0x64b44a24, 0x8be6fcc5, 0x616021a7, 0x8e329746, + 0x6f1c9d22, 0x804e2bc3, 0x6ac8f6a1, 0x859a4040, 0xba8d7060, + 0x55dfc681, 0xbf591be3, 0x500bad02, 0xb125a766, 0x5e771187, + 0xb4f1cce5, 0x5ba37a04, 0xaddcde6c, 0x428e688d, 0xa808b5ef, + 0x475a030e, 0xa674096a, 0x4926bf8b, 0xa3a062e9, 0x4cf2d408, + 0x942e2c78, 0x7b7c9a99, 0x91fa47fb, 0x7ea8f11a, 0x9f86fb7e, + 0x70d44d9f, 0x9a5290fd, 0x7500261c, 0x837f8274, 0x6c2d3495, + 0x86abe9f7, 0x69f95f16, 0x88d75572, 0x6785e393, 0x8d033ef1, + 0x62518810, 0xe7cbc850, 0x08997eb1, 0xe21fa3d3, 0x0d4d1532, + 0xec631f56, 0x0331a9b7, 0xe9b774d5, 0x06e5c234, 0xf09a665c, + 0x1fc8d0bd, 0xf54e0ddf, 0x1a1cbb3e, 0xfb32b15a, 0x146007bb, + 0xfee6dad9, 0x11b46c38, 0xc9689448, 0x263a22a9, 0xccbcffcb, + 0x23ee492a, 0xc2c0434e, 0x2d92f5af, 0xc71428cd, 0x28469e2c, + 0xde393a44, 0x316b8ca5, 0xdbed51c7, 0x34bfe726, 0xd591ed42, + 0x3ac35ba3, 0xd04586c1, 0x3f173020, 0xae6be681, 0x41395060, + 0xabbf8d02, 0x44ed3be3, 0xa5c33187, 0x4a918766, 0xa0175a04, + 0x4f45ece5, 0xb93a488d, 0x5668fe6c, 0xbcee230e, 0x53bc95ef, + 0xb2929f8b, 0x5dc0296a, 0xb746f408, 0x581442e9, 0x80c8ba99, + 0x6f9a0c78, 0x851cd11a, 0x6a4e67fb, 0x8b606d9f, 0x6432db7e, + 0x8eb4061c, 0x61e6b0fd, 0x97991495, 0x78cba274, 0x924d7f16, + 0x7d1fc9f7, 0x9c31c393, 0x73637572, 0x99e5a810, 0x76b71ef1, + 0xf32d5eb1, 0x1c7fe850, 0xf6f93532, 0x19ab83d3, 0xf88589b7, + 0x17d73f56, 0xfd51e234, 0x120354d5, 0xe47cf0bd, 0x0b2e465c, + 0xe1a89b3e, 0x0efa2ddf, 0xefd427bb, 0x0086915a, 0xea004c38, + 0x0552fad9, 0xdd8e02a9, 0x32dcb448, 0xd85a692a, 0x3708dfcb, + 0xd626d5af, 0x3974634e, 0xd3f2be2c, 0x3ca008cd, 0xcadfaca5, + 0x258d1a44, 0xcf0bc726, 0x205971c7, 0xc1777ba3, 0x2e25cd42, + 0xc4a31020, 0x2bf1a6c1, 0x14e696e1, 0xfbb42000, 0x1132fd62, + 0xfe604b83, 0x1f4e41e7, 0xf01cf706, 0x1a9a2a64, 0xf5c89c85, + 0x03b738ed, 0xece58e0c, 0x0663536e, 0xe931e58f, 0x081fefeb, + 0xe74d590a, 0x0dcb8468, 0xe2993289, 0x3a45caf9, 0xd5177c18, + 0x3f91a17a, 0xd0c3179b, 0x31ed1dff, 0xdebfab1e, 0x3439767c, + 0xdb6bc09d, 0x2d1464f5, 0xc246d214, 0x28c00f76, 0xc792b997, + 0x26bcb3f3, 0xc9ee0512, 0x2368d870, 0xcc3a6e91, 0x49a02ed1, + 0xa6f29830, 0x4c744552, 0xa326f3b3, 0x4208f9d7, 0xad5a4f36, + 0x47dc9254, 0xa88e24b5, 0x5ef180dd, 0xb1a3363c, 0x5b25eb5e, + 0xb4775dbf, 0x555957db, 0xba0be13a, 0x508d3c58, 0xbfdf8ab9, + 0x670372c9, 0x8851c428, 0x62d7194a, 0x8d85afab, 0x6caba5cf, + 0x83f9132e, 0x697fce4c, 0x862d78ad, 0x7052dcc5, 0x9f006a24, + 0x7586b746, 0x9ad401a7, 0x7bfa0bc3, 0x94a8bd22, 0x7e2e6040, + 0x917cd6a1}, + {0x00000000, 0x87a6cb43, 0xd43c90c7, 0x539a5b84, 0x730827cf, + 0xf4aeec8c, 0xa734b708, 0x20927c4b, 0xe6104f9e, 0x61b684dd, + 0x322cdf59, 0xb58a141a, 0x95186851, 0x12bea312, 0x4124f896, + 0xc68233d5, 0x1751997d, 0x90f7523e, 0xc36d09ba, 0x44cbc2f9, + 0x6459beb2, 0xe3ff75f1, 0xb0652e75, 0x37c3e536, 0xf141d6e3, + 0x76e71da0, 0x257d4624, 0xa2db8d67, 0x8249f12c, 0x05ef3a6f, + 0x567561eb, 0xd1d3aaa8, 0x2ea332fa, 0xa905f9b9, 0xfa9fa23d, + 0x7d39697e, 0x5dab1535, 0xda0dde76, 0x899785f2, 0x0e314eb1, + 0xc8b37d64, 0x4f15b627, 0x1c8feda3, 0x9b2926e0, 0xbbbb5aab, + 0x3c1d91e8, 0x6f87ca6c, 0xe821012f, 0x39f2ab87, 0xbe5460c4, + 0xedce3b40, 0x6a68f003, 0x4afa8c48, 0xcd5c470b, 0x9ec61c8f, + 0x1960d7cc, 0xdfe2e419, 0x58442f5a, 0x0bde74de, 0x8c78bf9d, + 0xaceac3d6, 0x2b4c0895, 0x78d65311, 0xff709852, 0x5d4665f4, + 0xdae0aeb7, 0x897af533, 0x0edc3e70, 0x2e4e423b, 0xa9e88978, + 0xfa72d2fc, 0x7dd419bf, 0xbb562a6a, 0x3cf0e129, 0x6f6abaad, + 0xe8cc71ee, 0xc85e0da5, 0x4ff8c6e6, 0x1c629d62, 0x9bc45621, + 0x4a17fc89, 0xcdb137ca, 0x9e2b6c4e, 0x198da70d, 0x391fdb46, + 0xbeb91005, 0xed234b81, 0x6a8580c2, 0xac07b317, 0x2ba17854, + 0x783b23d0, 0xff9de893, 0xdf0f94d8, 0x58a95f9b, 0x0b33041f, + 0x8c95cf5c, 0x73e5570e, 0xf4439c4d, 0xa7d9c7c9, 0x207f0c8a, + 0x00ed70c1, 0x874bbb82, 0xd4d1e006, 0x53772b45, 0x95f51890, + 0x1253d3d3, 0x41c98857, 0xc66f4314, 0xe6fd3f5f, 0x615bf41c, + 0x32c1af98, 0xb56764db, 0x64b4ce73, 0xe3120530, 0xb0885eb4, + 0x372e95f7, 0x17bce9bc, 0x901a22ff, 0xc380797b, 0x4426b238, + 0x82a481ed, 0x05024aae, 0x5698112a, 0xd13eda69, 0xf1aca622, + 0x760a6d61, 0x259036e5, 0xa236fda6, 0xba8ccbe8, 0x3d2a00ab, + 0x6eb05b2f, 0xe916906c, 0xc984ec27, 0x4e222764, 0x1db87ce0, + 0x9a1eb7a3, 0x5c9c8476, 0xdb3a4f35, 0x88a014b1, 0x0f06dff2, + 0x2f94a3b9, 0xa83268fa, 0xfba8337e, 0x7c0ef83d, 0xaddd5295, + 0x2a7b99d6, 0x79e1c252, 0xfe470911, 0xded5755a, 0x5973be19, + 0x0ae9e59d, 0x8d4f2ede, 0x4bcd1d0b, 0xcc6bd648, 0x9ff18dcc, + 0x1857468f, 0x38c53ac4, 0xbf63f187, 0xecf9aa03, 0x6b5f6140, + 0x942ff912, 0x13893251, 0x401369d5, 0xc7b5a296, 0xe727dedd, + 0x6081159e, 0x331b4e1a, 0xb4bd8559, 0x723fb68c, 0xf5997dcf, + 0xa603264b, 0x21a5ed08, 0x01379143, 0x86915a00, 0xd50b0184, + 0x52adcac7, 0x837e606f, 0x04d8ab2c, 0x5742f0a8, 0xd0e43beb, + 0xf07647a0, 0x77d08ce3, 0x244ad767, 0xa3ec1c24, 0x656e2ff1, + 0xe2c8e4b2, 0xb152bf36, 0x36f47475, 0x1666083e, 0x91c0c37d, + 0xc25a98f9, 0x45fc53ba, 0xe7caae1c, 0x606c655f, 0x33f63edb, + 0xb450f598, 0x94c289d3, 0x13644290, 0x40fe1914, 0xc758d257, + 0x01dae182, 0x867c2ac1, 0xd5e67145, 0x5240ba06, 0x72d2c64d, + 0xf5740d0e, 0xa6ee568a, 0x21489dc9, 0xf09b3761, 0x773dfc22, + 0x24a7a7a6, 0xa3016ce5, 0x839310ae, 0x0435dbed, 0x57af8069, + 0xd0094b2a, 0x168b78ff, 0x912db3bc, 0xc2b7e838, 0x4511237b, + 0x65835f30, 0xe2259473, 0xb1bfcff7, 0x361904b4, 0xc9699ce6, + 0x4ecf57a5, 0x1d550c21, 0x9af3c762, 0xba61bb29, 0x3dc7706a, + 0x6e5d2bee, 0xe9fbe0ad, 0x2f79d378, 0xa8df183b, 0xfb4543bf, + 0x7ce388fc, 0x5c71f4b7, 0xdbd73ff4, 0x884d6470, 0x0febaf33, + 0xde38059b, 0x599eced8, 0x0a04955c, 0x8da25e1f, 0xad302254, + 0x2a96e917, 0x790cb293, 0xfeaa79d0, 0x38284a05, 0xbf8e8146, + 0xec14dac2, 0x6bb21181, 0x4b206dca, 0xcc86a689, 0x9f1cfd0d, + 0x18ba364e}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x43cba68700000000, 0xc7903cd400000000, + 0x845b9a5300000000, 0xcf27087300000000, 0x8cecaef400000000, + 0x08b734a700000000, 0x4b7c922000000000, 0x9e4f10e600000000, + 0xdd84b66100000000, 0x59df2c3200000000, 0x1a148ab500000000, + 0x5168189500000000, 0x12a3be1200000000, 0x96f8244100000000, + 0xd53382c600000000, 0x7d99511700000000, 0x3e52f79000000000, + 0xba096dc300000000, 0xf9c2cb4400000000, 0xb2be596400000000, + 0xf175ffe300000000, 0x752e65b000000000, 0x36e5c33700000000, + 0xe3d641f100000000, 0xa01de77600000000, 0x24467d2500000000, + 0x678ddba200000000, 0x2cf1498200000000, 0x6f3aef0500000000, + 0xeb61755600000000, 0xa8aad3d100000000, 0xfa32a32e00000000, + 0xb9f905a900000000, 0x3da29ffa00000000, 0x7e69397d00000000, + 0x3515ab5d00000000, 0x76de0dda00000000, 0xf285978900000000, + 0xb14e310e00000000, 0x647db3c800000000, 0x27b6154f00000000, + 0xa3ed8f1c00000000, 0xe026299b00000000, 0xab5abbbb00000000, + 0xe8911d3c00000000, 0x6cca876f00000000, 0x2f0121e800000000, + 0x87abf23900000000, 0xc46054be00000000, 0x403bceed00000000, + 0x03f0686a00000000, 0x488cfa4a00000000, 0x0b475ccd00000000, + 0x8f1cc69e00000000, 0xccd7601900000000, 0x19e4e2df00000000, + 0x5a2f445800000000, 0xde74de0b00000000, 0x9dbf788c00000000, + 0xd6c3eaac00000000, 0x95084c2b00000000, 0x1153d67800000000, + 0x529870ff00000000, 0xf465465d00000000, 0xb7aee0da00000000, + 0x33f57a8900000000, 0x703edc0e00000000, 0x3b424e2e00000000, + 0x7889e8a900000000, 0xfcd272fa00000000, 0xbf19d47d00000000, + 0x6a2a56bb00000000, 0x29e1f03c00000000, 0xadba6a6f00000000, + 0xee71cce800000000, 0xa50d5ec800000000, 0xe6c6f84f00000000, + 0x629d621c00000000, 0x2156c49b00000000, 0x89fc174a00000000, + 0xca37b1cd00000000, 0x4e6c2b9e00000000, 0x0da78d1900000000, + 0x46db1f3900000000, 0x0510b9be00000000, 0x814b23ed00000000, + 0xc280856a00000000, 0x17b307ac00000000, 0x5478a12b00000000, + 0xd0233b7800000000, 0x93e89dff00000000, 0xd8940fdf00000000, + 0x9b5fa95800000000, 0x1f04330b00000000, 0x5ccf958c00000000, + 0x0e57e57300000000, 0x4d9c43f400000000, 0xc9c7d9a700000000, + 0x8a0c7f2000000000, 0xc170ed0000000000, 0x82bb4b8700000000, + 0x06e0d1d400000000, 0x452b775300000000, 0x9018f59500000000, + 0xd3d3531200000000, 0x5788c94100000000, 0x14436fc600000000, + 0x5f3ffde600000000, 0x1cf45b6100000000, 0x98afc13200000000, + 0xdb6467b500000000, 0x73ceb46400000000, 0x300512e300000000, + 0xb45e88b000000000, 0xf7952e3700000000, 0xbce9bc1700000000, + 0xff221a9000000000, 0x7b7980c300000000, 0x38b2264400000000, + 0xed81a48200000000, 0xae4a020500000000, 0x2a11985600000000, + 0x69da3ed100000000, 0x22a6acf100000000, 0x616d0a7600000000, + 0xe536902500000000, 0xa6fd36a200000000, 0xe8cb8cba00000000, + 0xab002a3d00000000, 0x2f5bb06e00000000, 0x6c9016e900000000, + 0x27ec84c900000000, 0x6427224e00000000, 0xe07cb81d00000000, + 0xa3b71e9a00000000, 0x76849c5c00000000, 0x354f3adb00000000, + 0xb114a08800000000, 0xf2df060f00000000, 0xb9a3942f00000000, + 0xfa6832a800000000, 0x7e33a8fb00000000, 0x3df80e7c00000000, + 0x9552ddad00000000, 0xd6997b2a00000000, 0x52c2e17900000000, + 0x110947fe00000000, 0x5a75d5de00000000, 0x19be735900000000, + 0x9de5e90a00000000, 0xde2e4f8d00000000, 0x0b1dcd4b00000000, + 0x48d66bcc00000000, 0xcc8df19f00000000, 0x8f46571800000000, + 0xc43ac53800000000, 0x87f163bf00000000, 0x03aaf9ec00000000, + 0x40615f6b00000000, 0x12f92f9400000000, 0x5132891300000000, + 0xd569134000000000, 0x96a2b5c700000000, 0xddde27e700000000, + 0x9e15816000000000, 0x1a4e1b3300000000, 0x5985bdb400000000, + 0x8cb63f7200000000, 0xcf7d99f500000000, 0x4b2603a600000000, + 0x08eda52100000000, 0x4391370100000000, 0x005a918600000000, + 0x84010bd500000000, 0xc7caad5200000000, 0x6f607e8300000000, + 0x2cabd80400000000, 0xa8f0425700000000, 0xeb3be4d000000000, + 0xa04776f000000000, 0xe38cd07700000000, 0x67d74a2400000000, + 0x241ceca300000000, 0xf12f6e6500000000, 0xb2e4c8e200000000, + 0x36bf52b100000000, 0x7574f43600000000, 0x3e08661600000000, + 0x7dc3c09100000000, 0xf9985ac200000000, 0xba53fc4500000000, + 0x1caecae700000000, 0x5f656c6000000000, 0xdb3ef63300000000, + 0x98f550b400000000, 0xd389c29400000000, 0x9042641300000000, + 0x1419fe4000000000, 0x57d258c700000000, 0x82e1da0100000000, + 0xc12a7c8600000000, 0x4571e6d500000000, 0x06ba405200000000, + 0x4dc6d27200000000, 0x0e0d74f500000000, 0x8a56eea600000000, + 0xc99d482100000000, 0x61379bf000000000, 0x22fc3d7700000000, + 0xa6a7a72400000000, 0xe56c01a300000000, 0xae10938300000000, + 0xeddb350400000000, 0x6980af5700000000, 0x2a4b09d000000000, + 0xff788b1600000000, 0xbcb32d9100000000, 0x38e8b7c200000000, + 0x7b23114500000000, 0x305f836500000000, 0x739425e200000000, + 0xf7cfbfb100000000, 0xb404193600000000, 0xe69c69c900000000, + 0xa557cf4e00000000, 0x210c551d00000000, 0x62c7f39a00000000, + 0x29bb61ba00000000, 0x6a70c73d00000000, 0xee2b5d6e00000000, + 0xade0fbe900000000, 0x78d3792f00000000, 0x3b18dfa800000000, + 0xbf4345fb00000000, 0xfc88e37c00000000, 0xb7f4715c00000000, + 0xf43fd7db00000000, 0x70644d8800000000, 0x33afeb0f00000000, + 0x9b0538de00000000, 0xd8ce9e5900000000, 0x5c95040a00000000, + 0x1f5ea28d00000000, 0x542230ad00000000, 0x17e9962a00000000, + 0x93b20c7900000000, 0xd079aafe00000000, 0x054a283800000000, + 0x46818ebf00000000, 0xc2da14ec00000000, 0x8111b26b00000000, + 0xca6d204b00000000, 0x89a686cc00000000, 0x0dfd1c9f00000000, + 0x4e36ba1800000000}, + {0x0000000000000000, 0xe1b652ef00000000, 0x836bd40500000000, + 0x62dd86ea00000000, 0x06d7a80b00000000, 0xe761fae400000000, + 0x85bc7c0e00000000, 0x640a2ee100000000, 0x0cae511700000000, + 0xed1803f800000000, 0x8fc5851200000000, 0x6e73d7fd00000000, + 0x0a79f91c00000000, 0xebcfabf300000000, 0x89122d1900000000, + 0x68a47ff600000000, 0x185ca32e00000000, 0xf9eaf1c100000000, + 0x9b37772b00000000, 0x7a8125c400000000, 0x1e8b0b2500000000, + 0xff3d59ca00000000, 0x9de0df2000000000, 0x7c568dcf00000000, + 0x14f2f23900000000, 0xf544a0d600000000, 0x9799263c00000000, + 0x762f74d300000000, 0x12255a3200000000, 0xf39308dd00000000, + 0x914e8e3700000000, 0x70f8dcd800000000, 0x30b8465d00000000, + 0xd10e14b200000000, 0xb3d3925800000000, 0x5265c0b700000000, + 0x366fee5600000000, 0xd7d9bcb900000000, 0xb5043a5300000000, + 0x54b268bc00000000, 0x3c16174a00000000, 0xdda045a500000000, + 0xbf7dc34f00000000, 0x5ecb91a000000000, 0x3ac1bf4100000000, + 0xdb77edae00000000, 0xb9aa6b4400000000, 0x581c39ab00000000, + 0x28e4e57300000000, 0xc952b79c00000000, 0xab8f317600000000, + 0x4a39639900000000, 0x2e334d7800000000, 0xcf851f9700000000, + 0xad58997d00000000, 0x4ceecb9200000000, 0x244ab46400000000, + 0xc5fce68b00000000, 0xa721606100000000, 0x4697328e00000000, + 0x229d1c6f00000000, 0xc32b4e8000000000, 0xa1f6c86a00000000, + 0x40409a8500000000, 0x60708dba00000000, 0x81c6df5500000000, + 0xe31b59bf00000000, 0x02ad0b5000000000, 0x66a725b100000000, + 0x8711775e00000000, 0xe5ccf1b400000000, 0x047aa35b00000000, + 0x6cdedcad00000000, 0x8d688e4200000000, 0xefb508a800000000, + 0x0e035a4700000000, 0x6a0974a600000000, 0x8bbf264900000000, + 0xe962a0a300000000, 0x08d4f24c00000000, 0x782c2e9400000000, + 0x999a7c7b00000000, 0xfb47fa9100000000, 0x1af1a87e00000000, + 0x7efb869f00000000, 0x9f4dd47000000000, 0xfd90529a00000000, + 0x1c26007500000000, 0x74827f8300000000, 0x95342d6c00000000, + 0xf7e9ab8600000000, 0x165ff96900000000, 0x7255d78800000000, + 0x93e3856700000000, 0xf13e038d00000000, 0x1088516200000000, + 0x50c8cbe700000000, 0xb17e990800000000, 0xd3a31fe200000000, + 0x32154d0d00000000, 0x561f63ec00000000, 0xb7a9310300000000, + 0xd574b7e900000000, 0x34c2e50600000000, 0x5c669af000000000, + 0xbdd0c81f00000000, 0xdf0d4ef500000000, 0x3ebb1c1a00000000, + 0x5ab132fb00000000, 0xbb07601400000000, 0xd9dae6fe00000000, + 0x386cb41100000000, 0x489468c900000000, 0xa9223a2600000000, + 0xcbffbccc00000000, 0x2a49ee2300000000, 0x4e43c0c200000000, + 0xaff5922d00000000, 0xcd2814c700000000, 0x2c9e462800000000, + 0x443a39de00000000, 0xa58c6b3100000000, 0xc751eddb00000000, + 0x26e7bf3400000000, 0x42ed91d500000000, 0xa35bc33a00000000, + 0xc18645d000000000, 0x2030173f00000000, 0x81e66bae00000000, + 0x6050394100000000, 0x028dbfab00000000, 0xe33bed4400000000, + 0x8731c3a500000000, 0x6687914a00000000, 0x045a17a000000000, + 0xe5ec454f00000000, 0x8d483ab900000000, 0x6cfe685600000000, + 0x0e23eebc00000000, 0xef95bc5300000000, 0x8b9f92b200000000, + 0x6a29c05d00000000, 0x08f446b700000000, 0xe942145800000000, + 0x99bac88000000000, 0x780c9a6f00000000, 0x1ad11c8500000000, + 0xfb674e6a00000000, 0x9f6d608b00000000, 0x7edb326400000000, + 0x1c06b48e00000000, 0xfdb0e66100000000, 0x9514999700000000, + 0x74a2cb7800000000, 0x167f4d9200000000, 0xf7c91f7d00000000, + 0x93c3319c00000000, 0x7275637300000000, 0x10a8e59900000000, + 0xf11eb77600000000, 0xb15e2df300000000, 0x50e87f1c00000000, + 0x3235f9f600000000, 0xd383ab1900000000, 0xb78985f800000000, + 0x563fd71700000000, 0x34e251fd00000000, 0xd554031200000000, + 0xbdf07ce400000000, 0x5c462e0b00000000, 0x3e9ba8e100000000, + 0xdf2dfa0e00000000, 0xbb27d4ef00000000, 0x5a91860000000000, + 0x384c00ea00000000, 0xd9fa520500000000, 0xa9028edd00000000, + 0x48b4dc3200000000, 0x2a695ad800000000, 0xcbdf083700000000, + 0xafd526d600000000, 0x4e63743900000000, 0x2cbef2d300000000, + 0xcd08a03c00000000, 0xa5acdfca00000000, 0x441a8d2500000000, + 0x26c70bcf00000000, 0xc771592000000000, 0xa37b77c100000000, + 0x42cd252e00000000, 0x2010a3c400000000, 0xc1a6f12b00000000, + 0xe196e61400000000, 0x0020b4fb00000000, 0x62fd321100000000, + 0x834b60fe00000000, 0xe7414e1f00000000, 0x06f71cf000000000, + 0x642a9a1a00000000, 0x859cc8f500000000, 0xed38b70300000000, + 0x0c8ee5ec00000000, 0x6e53630600000000, 0x8fe531e900000000, + 0xebef1f0800000000, 0x0a594de700000000, 0x6884cb0d00000000, + 0x893299e200000000, 0xf9ca453a00000000, 0x187c17d500000000, + 0x7aa1913f00000000, 0x9b17c3d000000000, 0xff1ded3100000000, + 0x1eabbfde00000000, 0x7c76393400000000, 0x9dc06bdb00000000, + 0xf564142d00000000, 0x14d246c200000000, 0x760fc02800000000, + 0x97b992c700000000, 0xf3b3bc2600000000, 0x1205eec900000000, + 0x70d8682300000000, 0x916e3acc00000000, 0xd12ea04900000000, + 0x3098f2a600000000, 0x5245744c00000000, 0xb3f326a300000000, + 0xd7f9084200000000, 0x364f5aad00000000, 0x5492dc4700000000, + 0xb5248ea800000000, 0xdd80f15e00000000, 0x3c36a3b100000000, + 0x5eeb255b00000000, 0xbf5d77b400000000, 0xdb57595500000000, + 0x3ae10bba00000000, 0x583c8d5000000000, 0xb98adfbf00000000, + 0xc972036700000000, 0x28c4518800000000, 0x4a19d76200000000, + 0xabaf858d00000000, 0xcfa5ab6c00000000, 0x2e13f98300000000, + 0x4cce7f6900000000, 0xad782d8600000000, 0xc5dc527000000000, + 0x246a009f00000000, 0x46b7867500000000, 0xa701d49a00000000, + 0xc30bfa7b00000000, 0x22bda89400000000, 0x40602e7e00000000, + 0xa1d67c9100000000}, + {0x0000000000000000, 0x5880e2d700000000, 0xf106b47400000000, + 0xa98656a300000000, 0xe20d68e900000000, 0xba8d8a3e00000000, + 0x130bdc9d00000000, 0x4b8b3e4a00000000, 0x851da10900000000, + 0xdd9d43de00000000, 0x741b157d00000000, 0x2c9bf7aa00000000, + 0x6710c9e000000000, 0x3f902b3700000000, 0x96167d9400000000, + 0xce969f4300000000, 0x0a3b421300000000, 0x52bba0c400000000, + 0xfb3df66700000000, 0xa3bd14b000000000, 0xe8362afa00000000, + 0xb0b6c82d00000000, 0x19309e8e00000000, 0x41b07c5900000000, + 0x8f26e31a00000000, 0xd7a601cd00000000, 0x7e20576e00000000, + 0x26a0b5b900000000, 0x6d2b8bf300000000, 0x35ab692400000000, + 0x9c2d3f8700000000, 0xc4addd5000000000, 0x1476842600000000, + 0x4cf666f100000000, 0xe570305200000000, 0xbdf0d28500000000, + 0xf67beccf00000000, 0xaefb0e1800000000, 0x077d58bb00000000, + 0x5ffdba6c00000000, 0x916b252f00000000, 0xc9ebc7f800000000, + 0x606d915b00000000, 0x38ed738c00000000, 0x73664dc600000000, + 0x2be6af1100000000, 0x8260f9b200000000, 0xdae01b6500000000, + 0x1e4dc63500000000, 0x46cd24e200000000, 0xef4b724100000000, + 0xb7cb909600000000, 0xfc40aedc00000000, 0xa4c04c0b00000000, + 0x0d461aa800000000, 0x55c6f87f00000000, 0x9b50673c00000000, + 0xc3d085eb00000000, 0x6a56d34800000000, 0x32d6319f00000000, + 0x795d0fd500000000, 0x21dded0200000000, 0x885bbba100000000, + 0xd0db597600000000, 0x28ec084d00000000, 0x706cea9a00000000, + 0xd9eabc3900000000, 0x816a5eee00000000, 0xcae160a400000000, + 0x9261827300000000, 0x3be7d4d000000000, 0x6367360700000000, + 0xadf1a94400000000, 0xf5714b9300000000, 0x5cf71d3000000000, + 0x0477ffe700000000, 0x4ffcc1ad00000000, 0x177c237a00000000, + 0xbefa75d900000000, 0xe67a970e00000000, 0x22d74a5e00000000, + 0x7a57a88900000000, 0xd3d1fe2a00000000, 0x8b511cfd00000000, + 0xc0da22b700000000, 0x985ac06000000000, 0x31dc96c300000000, + 0x695c741400000000, 0xa7caeb5700000000, 0xff4a098000000000, + 0x56cc5f2300000000, 0x0e4cbdf400000000, 0x45c783be00000000, + 0x1d47616900000000, 0xb4c137ca00000000, 0xec41d51d00000000, + 0x3c9a8c6b00000000, 0x641a6ebc00000000, 0xcd9c381f00000000, + 0x951cdac800000000, 0xde97e48200000000, 0x8617065500000000, + 0x2f9150f600000000, 0x7711b22100000000, 0xb9872d6200000000, + 0xe107cfb500000000, 0x4881991600000000, 0x10017bc100000000, + 0x5b8a458b00000000, 0x030aa75c00000000, 0xaa8cf1ff00000000, + 0xf20c132800000000, 0x36a1ce7800000000, 0x6e212caf00000000, + 0xc7a77a0c00000000, 0x9f2798db00000000, 0xd4aca69100000000, + 0x8c2c444600000000, 0x25aa12e500000000, 0x7d2af03200000000, + 0xb3bc6f7100000000, 0xeb3c8da600000000, 0x42badb0500000000, + 0x1a3a39d200000000, 0x51b1079800000000, 0x0931e54f00000000, + 0xa0b7b3ec00000000, 0xf837513b00000000, 0x50d8119a00000000, + 0x0858f34d00000000, 0xa1dea5ee00000000, 0xf95e473900000000, + 0xb2d5797300000000, 0xea559ba400000000, 0x43d3cd0700000000, + 0x1b532fd000000000, 0xd5c5b09300000000, 0x8d45524400000000, + 0x24c304e700000000, 0x7c43e63000000000, 0x37c8d87a00000000, + 0x6f483aad00000000, 0xc6ce6c0e00000000, 0x9e4e8ed900000000, + 0x5ae3538900000000, 0x0263b15e00000000, 0xabe5e7fd00000000, + 0xf365052a00000000, 0xb8ee3b6000000000, 0xe06ed9b700000000, + 0x49e88f1400000000, 0x11686dc300000000, 0xdffef28000000000, + 0x877e105700000000, 0x2ef846f400000000, 0x7678a42300000000, + 0x3df39a6900000000, 0x657378be00000000, 0xccf52e1d00000000, + 0x9475ccca00000000, 0x44ae95bc00000000, 0x1c2e776b00000000, + 0xb5a821c800000000, 0xed28c31f00000000, 0xa6a3fd5500000000, + 0xfe231f8200000000, 0x57a5492100000000, 0x0f25abf600000000, + 0xc1b334b500000000, 0x9933d66200000000, 0x30b580c100000000, + 0x6835621600000000, 0x23be5c5c00000000, 0x7b3ebe8b00000000, + 0xd2b8e82800000000, 0x8a380aff00000000, 0x4e95d7af00000000, + 0x1615357800000000, 0xbf9363db00000000, 0xe713810c00000000, + 0xac98bf4600000000, 0xf4185d9100000000, 0x5d9e0b3200000000, + 0x051ee9e500000000, 0xcb8876a600000000, 0x9308947100000000, + 0x3a8ec2d200000000, 0x620e200500000000, 0x29851e4f00000000, + 0x7105fc9800000000, 0xd883aa3b00000000, 0x800348ec00000000, + 0x783419d700000000, 0x20b4fb0000000000, 0x8932ada300000000, + 0xd1b24f7400000000, 0x9a39713e00000000, 0xc2b993e900000000, + 0x6b3fc54a00000000, 0x33bf279d00000000, 0xfd29b8de00000000, + 0xa5a95a0900000000, 0x0c2f0caa00000000, 0x54afee7d00000000, + 0x1f24d03700000000, 0x47a432e000000000, 0xee22644300000000, + 0xb6a2869400000000, 0x720f5bc400000000, 0x2a8fb91300000000, + 0x8309efb000000000, 0xdb890d6700000000, 0x9002332d00000000, + 0xc882d1fa00000000, 0x6104875900000000, 0x3984658e00000000, + 0xf712facd00000000, 0xaf92181a00000000, 0x06144eb900000000, + 0x5e94ac6e00000000, 0x151f922400000000, 0x4d9f70f300000000, + 0xe419265000000000, 0xbc99c48700000000, 0x6c429df100000000, + 0x34c27f2600000000, 0x9d44298500000000, 0xc5c4cb5200000000, + 0x8e4ff51800000000, 0xd6cf17cf00000000, 0x7f49416c00000000, + 0x27c9a3bb00000000, 0xe95f3cf800000000, 0xb1dfde2f00000000, + 0x1859888c00000000, 0x40d96a5b00000000, 0x0b52541100000000, + 0x53d2b6c600000000, 0xfa54e06500000000, 0xa2d402b200000000, + 0x6679dfe200000000, 0x3ef93d3500000000, 0x977f6b9600000000, + 0xcfff894100000000, 0x8474b70b00000000, 0xdcf455dc00000000, + 0x7572037f00000000, 0x2df2e1a800000000, 0xe3647eeb00000000, + 0xbbe49c3c00000000, 0x1262ca9f00000000, 0x4ae2284800000000, + 0x0169160200000000, 0x59e9f4d500000000, 0xf06fa27600000000, + 0xa8ef40a100000000}, + {0x0000000000000000, 0x463b676500000000, 0x8c76ceca00000000, + 0xca4da9af00000000, 0x59ebed4e00000000, 0x1fd08a2b00000000, + 0xd59d238400000000, 0x93a644e100000000, 0xb2d6db9d00000000, + 0xf4edbcf800000000, 0x3ea0155700000000, 0x789b723200000000, + 0xeb3d36d300000000, 0xad0651b600000000, 0x674bf81900000000, + 0x21709f7c00000000, 0x25abc6e000000000, 0x6390a18500000000, + 0xa9dd082a00000000, 0xefe66f4f00000000, 0x7c402bae00000000, + 0x3a7b4ccb00000000, 0xf036e56400000000, 0xb60d820100000000, + 0x977d1d7d00000000, 0xd1467a1800000000, 0x1b0bd3b700000000, + 0x5d30b4d200000000, 0xce96f03300000000, 0x88ad975600000000, + 0x42e03ef900000000, 0x04db599c00000000, 0x0b50fc1a00000000, + 0x4d6b9b7f00000000, 0x872632d000000000, 0xc11d55b500000000, + 0x52bb115400000000, 0x1480763100000000, 0xdecddf9e00000000, + 0x98f6b8fb00000000, 0xb986278700000000, 0xffbd40e200000000, + 0x35f0e94d00000000, 0x73cb8e2800000000, 0xe06dcac900000000, + 0xa656adac00000000, 0x6c1b040300000000, 0x2a20636600000000, + 0x2efb3afa00000000, 0x68c05d9f00000000, 0xa28df43000000000, + 0xe4b6935500000000, 0x7710d7b400000000, 0x312bb0d100000000, + 0xfb66197e00000000, 0xbd5d7e1b00000000, 0x9c2de16700000000, + 0xda16860200000000, 0x105b2fad00000000, 0x566048c800000000, + 0xc5c60c2900000000, 0x83fd6b4c00000000, 0x49b0c2e300000000, + 0x0f8ba58600000000, 0x16a0f83500000000, 0x509b9f5000000000, + 0x9ad636ff00000000, 0xdced519a00000000, 0x4f4b157b00000000, + 0x0970721e00000000, 0xc33ddbb100000000, 0x8506bcd400000000, + 0xa47623a800000000, 0xe24d44cd00000000, 0x2800ed6200000000, + 0x6e3b8a0700000000, 0xfd9dcee600000000, 0xbba6a98300000000, + 0x71eb002c00000000, 0x37d0674900000000, 0x330b3ed500000000, + 0x753059b000000000, 0xbf7df01f00000000, 0xf946977a00000000, + 0x6ae0d39b00000000, 0x2cdbb4fe00000000, 0xe6961d5100000000, + 0xa0ad7a3400000000, 0x81dde54800000000, 0xc7e6822d00000000, + 0x0dab2b8200000000, 0x4b904ce700000000, 0xd836080600000000, + 0x9e0d6f6300000000, 0x5440c6cc00000000, 0x127ba1a900000000, + 0x1df0042f00000000, 0x5bcb634a00000000, 0x9186cae500000000, + 0xd7bdad8000000000, 0x441be96100000000, 0x02208e0400000000, + 0xc86d27ab00000000, 0x8e5640ce00000000, 0xaf26dfb200000000, + 0xe91db8d700000000, 0x2350117800000000, 0x656b761d00000000, + 0xf6cd32fc00000000, 0xb0f6559900000000, 0x7abbfc3600000000, + 0x3c809b5300000000, 0x385bc2cf00000000, 0x7e60a5aa00000000, + 0xb42d0c0500000000, 0xf2166b6000000000, 0x61b02f8100000000, + 0x278b48e400000000, 0xedc6e14b00000000, 0xabfd862e00000000, + 0x8a8d195200000000, 0xccb67e3700000000, 0x06fbd79800000000, + 0x40c0b0fd00000000, 0xd366f41c00000000, 0x955d937900000000, + 0x5f103ad600000000, 0x192b5db300000000, 0x2c40f16b00000000, + 0x6a7b960e00000000, 0xa0363fa100000000, 0xe60d58c400000000, + 0x75ab1c2500000000, 0x33907b4000000000, 0xf9ddd2ef00000000, + 0xbfe6b58a00000000, 0x9e962af600000000, 0xd8ad4d9300000000, + 0x12e0e43c00000000, 0x54db835900000000, 0xc77dc7b800000000, + 0x8146a0dd00000000, 0x4b0b097200000000, 0x0d306e1700000000, + 0x09eb378b00000000, 0x4fd050ee00000000, 0x859df94100000000, + 0xc3a69e2400000000, 0x5000dac500000000, 0x163bbda000000000, + 0xdc76140f00000000, 0x9a4d736a00000000, 0xbb3dec1600000000, + 0xfd068b7300000000, 0x374b22dc00000000, 0x717045b900000000, + 0xe2d6015800000000, 0xa4ed663d00000000, 0x6ea0cf9200000000, + 0x289ba8f700000000, 0x27100d7100000000, 0x612b6a1400000000, + 0xab66c3bb00000000, 0xed5da4de00000000, 0x7efbe03f00000000, + 0x38c0875a00000000, 0xf28d2ef500000000, 0xb4b6499000000000, + 0x95c6d6ec00000000, 0xd3fdb18900000000, 0x19b0182600000000, + 0x5f8b7f4300000000, 0xcc2d3ba200000000, 0x8a165cc700000000, + 0x405bf56800000000, 0x0660920d00000000, 0x02bbcb9100000000, + 0x4480acf400000000, 0x8ecd055b00000000, 0xc8f6623e00000000, + 0x5b5026df00000000, 0x1d6b41ba00000000, 0xd726e81500000000, + 0x911d8f7000000000, 0xb06d100c00000000, 0xf656776900000000, + 0x3c1bdec600000000, 0x7a20b9a300000000, 0xe986fd4200000000, + 0xafbd9a2700000000, 0x65f0338800000000, 0x23cb54ed00000000, + 0x3ae0095e00000000, 0x7cdb6e3b00000000, 0xb696c79400000000, + 0xf0ada0f100000000, 0x630be41000000000, 0x2530837500000000, + 0xef7d2ada00000000, 0xa9464dbf00000000, 0x8836d2c300000000, + 0xce0db5a600000000, 0x04401c0900000000, 0x427b7b6c00000000, + 0xd1dd3f8d00000000, 0x97e658e800000000, 0x5dabf14700000000, + 0x1b90962200000000, 0x1f4bcfbe00000000, 0x5970a8db00000000, + 0x933d017400000000, 0xd506661100000000, 0x46a022f000000000, + 0x009b459500000000, 0xcad6ec3a00000000, 0x8ced8b5f00000000, + 0xad9d142300000000, 0xeba6734600000000, 0x21ebdae900000000, + 0x67d0bd8c00000000, 0xf476f96d00000000, 0xb24d9e0800000000, + 0x780037a700000000, 0x3e3b50c200000000, 0x31b0f54400000000, + 0x778b922100000000, 0xbdc63b8e00000000, 0xfbfd5ceb00000000, + 0x685b180a00000000, 0x2e607f6f00000000, 0xe42dd6c000000000, + 0xa216b1a500000000, 0x83662ed900000000, 0xc55d49bc00000000, + 0x0f10e01300000000, 0x492b877600000000, 0xda8dc39700000000, + 0x9cb6a4f200000000, 0x56fb0d5d00000000, 0x10c06a3800000000, + 0x141b33a400000000, 0x522054c100000000, 0x986dfd6e00000000, + 0xde569a0b00000000, 0x4df0deea00000000, 0x0bcbb98f00000000, + 0xc186102000000000, 0x87bd774500000000, 0xa6cde83900000000, + 0xe0f68f5c00000000, 0x2abb26f300000000, 0x6c80419600000000, + 0xff26057700000000, 0xb91d621200000000, 0x7350cbbd00000000, + 0x356bacd800000000}, + {0x0000000000000000, 0x9e83da9f00000000, 0x7d01c4e400000000, + 0xe3821e7b00000000, 0xbb04f91200000000, 0x2587238d00000000, + 0xc6053df600000000, 0x5886e76900000000, 0x7609f22500000000, + 0xe88a28ba00000000, 0x0b0836c100000000, 0x958bec5e00000000, + 0xcd0d0b3700000000, 0x538ed1a800000000, 0xb00ccfd300000000, + 0x2e8f154c00000000, 0xec12e44b00000000, 0x72913ed400000000, + 0x911320af00000000, 0x0f90fa3000000000, 0x57161d5900000000, + 0xc995c7c600000000, 0x2a17d9bd00000000, 0xb494032200000000, + 0x9a1b166e00000000, 0x0498ccf100000000, 0xe71ad28a00000000, + 0x7999081500000000, 0x211fef7c00000000, 0xbf9c35e300000000, + 0x5c1e2b9800000000, 0xc29df10700000000, 0xd825c89700000000, + 0x46a6120800000000, 0xa5240c7300000000, 0x3ba7d6ec00000000, + 0x6321318500000000, 0xfda2eb1a00000000, 0x1e20f56100000000, + 0x80a32ffe00000000, 0xae2c3ab200000000, 0x30afe02d00000000, + 0xd32dfe5600000000, 0x4dae24c900000000, 0x1528c3a000000000, + 0x8bab193f00000000, 0x6829074400000000, 0xf6aadddb00000000, + 0x34372cdc00000000, 0xaab4f64300000000, 0x4936e83800000000, + 0xd7b532a700000000, 0x8f33d5ce00000000, 0x11b00f5100000000, + 0xf232112a00000000, 0x6cb1cbb500000000, 0x423edef900000000, + 0xdcbd046600000000, 0x3f3f1a1d00000000, 0xa1bcc08200000000, + 0xf93a27eb00000000, 0x67b9fd7400000000, 0x843be30f00000000, + 0x1ab8399000000000, 0xf14de1f400000000, 0x6fce3b6b00000000, + 0x8c4c251000000000, 0x12cfff8f00000000, 0x4a4918e600000000, + 0xd4cac27900000000, 0x3748dc0200000000, 0xa9cb069d00000000, + 0x874413d100000000, 0x19c7c94e00000000, 0xfa45d73500000000, + 0x64c60daa00000000, 0x3c40eac300000000, 0xa2c3305c00000000, + 0x41412e2700000000, 0xdfc2f4b800000000, 0x1d5f05bf00000000, + 0x83dcdf2000000000, 0x605ec15b00000000, 0xfedd1bc400000000, + 0xa65bfcad00000000, 0x38d8263200000000, 0xdb5a384900000000, + 0x45d9e2d600000000, 0x6b56f79a00000000, 0xf5d52d0500000000, + 0x1657337e00000000, 0x88d4e9e100000000, 0xd0520e8800000000, + 0x4ed1d41700000000, 0xad53ca6c00000000, 0x33d010f300000000, + 0x2968296300000000, 0xb7ebf3fc00000000, 0x5469ed8700000000, + 0xcaea371800000000, 0x926cd07100000000, 0x0cef0aee00000000, + 0xef6d149500000000, 0x71eece0a00000000, 0x5f61db4600000000, + 0xc1e201d900000000, 0x22601fa200000000, 0xbce3c53d00000000, + 0xe465225400000000, 0x7ae6f8cb00000000, 0x9964e6b000000000, + 0x07e73c2f00000000, 0xc57acd2800000000, 0x5bf917b700000000, + 0xb87b09cc00000000, 0x26f8d35300000000, 0x7e7e343a00000000, + 0xe0fdeea500000000, 0x037ff0de00000000, 0x9dfc2a4100000000, + 0xb3733f0d00000000, 0x2df0e59200000000, 0xce72fbe900000000, + 0x50f1217600000000, 0x0877c61f00000000, 0x96f41c8000000000, + 0x757602fb00000000, 0xebf5d86400000000, 0xa39db33200000000, + 0x3d1e69ad00000000, 0xde9c77d600000000, 0x401fad4900000000, + 0x18994a2000000000, 0x861a90bf00000000, 0x65988ec400000000, + 0xfb1b545b00000000, 0xd594411700000000, 0x4b179b8800000000, + 0xa89585f300000000, 0x36165f6c00000000, 0x6e90b80500000000, + 0xf013629a00000000, 0x13917ce100000000, 0x8d12a67e00000000, + 0x4f8f577900000000, 0xd10c8de600000000, 0x328e939d00000000, + 0xac0d490200000000, 0xf48bae6b00000000, 0x6a0874f400000000, + 0x898a6a8f00000000, 0x1709b01000000000, 0x3986a55c00000000, + 0xa7057fc300000000, 0x448761b800000000, 0xda04bb2700000000, + 0x82825c4e00000000, 0x1c0186d100000000, 0xff8398aa00000000, + 0x6100423500000000, 0x7bb87ba500000000, 0xe53ba13a00000000, + 0x06b9bf4100000000, 0x983a65de00000000, 0xc0bc82b700000000, + 0x5e3f582800000000, 0xbdbd465300000000, 0x233e9ccc00000000, + 0x0db1898000000000, 0x9332531f00000000, 0x70b04d6400000000, + 0xee3397fb00000000, 0xb6b5709200000000, 0x2836aa0d00000000, + 0xcbb4b47600000000, 0x55376ee900000000, 0x97aa9fee00000000, + 0x0929457100000000, 0xeaab5b0a00000000, 0x7428819500000000, + 0x2cae66fc00000000, 0xb22dbc6300000000, 0x51afa21800000000, + 0xcf2c788700000000, 0xe1a36dcb00000000, 0x7f20b75400000000, + 0x9ca2a92f00000000, 0x022173b000000000, 0x5aa794d900000000, + 0xc4244e4600000000, 0x27a6503d00000000, 0xb9258aa200000000, + 0x52d052c600000000, 0xcc53885900000000, 0x2fd1962200000000, + 0xb1524cbd00000000, 0xe9d4abd400000000, 0x7757714b00000000, + 0x94d56f3000000000, 0x0a56b5af00000000, 0x24d9a0e300000000, + 0xba5a7a7c00000000, 0x59d8640700000000, 0xc75bbe9800000000, + 0x9fdd59f100000000, 0x015e836e00000000, 0xe2dc9d1500000000, + 0x7c5f478a00000000, 0xbec2b68d00000000, 0x20416c1200000000, + 0xc3c3726900000000, 0x5d40a8f600000000, 0x05c64f9f00000000, + 0x9b45950000000000, 0x78c78b7b00000000, 0xe64451e400000000, + 0xc8cb44a800000000, 0x56489e3700000000, 0xb5ca804c00000000, + 0x2b495ad300000000, 0x73cfbdba00000000, 0xed4c672500000000, + 0x0ece795e00000000, 0x904da3c100000000, 0x8af59a5100000000, + 0x147640ce00000000, 0xf7f45eb500000000, 0x6977842a00000000, + 0x31f1634300000000, 0xaf72b9dc00000000, 0x4cf0a7a700000000, + 0xd2737d3800000000, 0xfcfc687400000000, 0x627fb2eb00000000, + 0x81fdac9000000000, 0x1f7e760f00000000, 0x47f8916600000000, + 0xd97b4bf900000000, 0x3af9558200000000, 0xa47a8f1d00000000, + 0x66e77e1a00000000, 0xf864a48500000000, 0x1be6bafe00000000, + 0x8565606100000000, 0xdde3870800000000, 0x43605d9700000000, + 0xa0e243ec00000000, 0x3e61997300000000, 0x10ee8c3f00000000, + 0x8e6d56a000000000, 0x6def48db00000000, 0xf36c924400000000, + 0xabea752d00000000, 0x3569afb200000000, 0xd6ebb1c900000000, + 0x48686b5600000000}, + {0x0000000000000000, 0xc064281700000000, 0x80c9502e00000000, + 0x40ad783900000000, 0x0093a15c00000000, 0xc0f7894b00000000, + 0x805af17200000000, 0x403ed96500000000, 0x002643b900000000, + 0xc0426bae00000000, 0x80ef139700000000, 0x408b3b8000000000, + 0x00b5e2e500000000, 0xc0d1caf200000000, 0x807cb2cb00000000, + 0x40189adc00000000, 0x414af7a900000000, 0x812edfbe00000000, + 0xc183a78700000000, 0x01e78f9000000000, 0x41d956f500000000, + 0x81bd7ee200000000, 0xc11006db00000000, 0x01742ecc00000000, + 0x416cb41000000000, 0x81089c0700000000, 0xc1a5e43e00000000, + 0x01c1cc2900000000, 0x41ff154c00000000, 0x819b3d5b00000000, + 0xc136456200000000, 0x01526d7500000000, 0xc3929f8800000000, + 0x03f6b79f00000000, 0x435bcfa600000000, 0x833fe7b100000000, + 0xc3013ed400000000, 0x036516c300000000, 0x43c86efa00000000, + 0x83ac46ed00000000, 0xc3b4dc3100000000, 0x03d0f42600000000, + 0x437d8c1f00000000, 0x8319a40800000000, 0xc3277d6d00000000, + 0x0343557a00000000, 0x43ee2d4300000000, 0x838a055400000000, + 0x82d8682100000000, 0x42bc403600000000, 0x0211380f00000000, + 0xc275101800000000, 0x824bc97d00000000, 0x422fe16a00000000, + 0x0282995300000000, 0xc2e6b14400000000, 0x82fe2b9800000000, + 0x429a038f00000000, 0x02377bb600000000, 0xc25353a100000000, + 0x826d8ac400000000, 0x4209a2d300000000, 0x02a4daea00000000, + 0xc2c0f2fd00000000, 0xc7234eca00000000, 0x074766dd00000000, + 0x47ea1ee400000000, 0x878e36f300000000, 0xc7b0ef9600000000, + 0x07d4c78100000000, 0x4779bfb800000000, 0x871d97af00000000, + 0xc7050d7300000000, 0x0761256400000000, 0x47cc5d5d00000000, + 0x87a8754a00000000, 0xc796ac2f00000000, 0x07f2843800000000, + 0x475ffc0100000000, 0x873bd41600000000, 0x8669b96300000000, + 0x460d917400000000, 0x06a0e94d00000000, 0xc6c4c15a00000000, + 0x86fa183f00000000, 0x469e302800000000, 0x0633481100000000, + 0xc657600600000000, 0x864ffada00000000, 0x462bd2cd00000000, + 0x0686aaf400000000, 0xc6e282e300000000, 0x86dc5b8600000000, + 0x46b8739100000000, 0x06150ba800000000, 0xc67123bf00000000, + 0x04b1d14200000000, 0xc4d5f95500000000, 0x8478816c00000000, + 0x441ca97b00000000, 0x0422701e00000000, 0xc446580900000000, + 0x84eb203000000000, 0x448f082700000000, 0x049792fb00000000, + 0xc4f3baec00000000, 0x845ec2d500000000, 0x443aeac200000000, + 0x040433a700000000, 0xc4601bb000000000, 0x84cd638900000000, + 0x44a94b9e00000000, 0x45fb26eb00000000, 0x859f0efc00000000, + 0xc53276c500000000, 0x05565ed200000000, 0x456887b700000000, + 0x850cafa000000000, 0xc5a1d79900000000, 0x05c5ff8e00000000, + 0x45dd655200000000, 0x85b94d4500000000, 0xc514357c00000000, + 0x05701d6b00000000, 0x454ec40e00000000, 0x852aec1900000000, + 0xc587942000000000, 0x05e3bc3700000000, 0xcf41ed4f00000000, + 0x0f25c55800000000, 0x4f88bd6100000000, 0x8fec957600000000, + 0xcfd24c1300000000, 0x0fb6640400000000, 0x4f1b1c3d00000000, + 0x8f7f342a00000000, 0xcf67aef600000000, 0x0f0386e100000000, + 0x4faefed800000000, 0x8fcad6cf00000000, 0xcff40faa00000000, + 0x0f9027bd00000000, 0x4f3d5f8400000000, 0x8f59779300000000, + 0x8e0b1ae600000000, 0x4e6f32f100000000, 0x0ec24ac800000000, + 0xcea662df00000000, 0x8e98bbba00000000, 0x4efc93ad00000000, + 0x0e51eb9400000000, 0xce35c38300000000, 0x8e2d595f00000000, + 0x4e49714800000000, 0x0ee4097100000000, 0xce80216600000000, + 0x8ebef80300000000, 0x4edad01400000000, 0x0e77a82d00000000, + 0xce13803a00000000, 0x0cd372c700000000, 0xccb75ad000000000, + 0x8c1a22e900000000, 0x4c7e0afe00000000, 0x0c40d39b00000000, + 0xcc24fb8c00000000, 0x8c8983b500000000, 0x4cedaba200000000, + 0x0cf5317e00000000, 0xcc91196900000000, 0x8c3c615000000000, + 0x4c58494700000000, 0x0c66902200000000, 0xcc02b83500000000, + 0x8cafc00c00000000, 0x4ccbe81b00000000, 0x4d99856e00000000, + 0x8dfdad7900000000, 0xcd50d54000000000, 0x0d34fd5700000000, + 0x4d0a243200000000, 0x8d6e0c2500000000, 0xcdc3741c00000000, + 0x0da75c0b00000000, 0x4dbfc6d700000000, 0x8ddbeec000000000, + 0xcd7696f900000000, 0x0d12beee00000000, 0x4d2c678b00000000, + 0x8d484f9c00000000, 0xcde537a500000000, 0x0d811fb200000000, + 0x0862a38500000000, 0xc8068b9200000000, 0x88abf3ab00000000, + 0x48cfdbbc00000000, 0x08f102d900000000, 0xc8952ace00000000, + 0x883852f700000000, 0x485c7ae000000000, 0x0844e03c00000000, + 0xc820c82b00000000, 0x888db01200000000, 0x48e9980500000000, + 0x08d7416000000000, 0xc8b3697700000000, 0x881e114e00000000, + 0x487a395900000000, 0x4928542c00000000, 0x894c7c3b00000000, + 0xc9e1040200000000, 0x09852c1500000000, 0x49bbf57000000000, + 0x89dfdd6700000000, 0xc972a55e00000000, 0x09168d4900000000, + 0x490e179500000000, 0x896a3f8200000000, 0xc9c747bb00000000, + 0x09a36fac00000000, 0x499db6c900000000, 0x89f99ede00000000, + 0xc954e6e700000000, 0x0930cef000000000, 0xcbf03c0d00000000, + 0x0b94141a00000000, 0x4b396c2300000000, 0x8b5d443400000000, + 0xcb639d5100000000, 0x0b07b54600000000, 0x4baacd7f00000000, + 0x8bcee56800000000, 0xcbd67fb400000000, 0x0bb257a300000000, + 0x4b1f2f9a00000000, 0x8b7b078d00000000, 0xcb45dee800000000, + 0x0b21f6ff00000000, 0x4b8c8ec600000000, 0x8be8a6d100000000, + 0x8abacba400000000, 0x4adee3b300000000, 0x0a739b8a00000000, + 0xca17b39d00000000, 0x8a296af800000000, 0x4a4d42ef00000000, + 0x0ae03ad600000000, 0xca8412c100000000, 0x8a9c881d00000000, + 0x4af8a00a00000000, 0x0a55d83300000000, 0xca31f02400000000, + 0x8a0f294100000000, 0x4a6b015600000000, 0x0ac6796f00000000, + 0xcaa2517800000000}, + {0x0000000000000000, 0xd4ea739b00000000, 0xe9d396ed00000000, + 0x3d39e57600000000, 0x93a15c0000000000, 0x474b2f9b00000000, + 0x7a72caed00000000, 0xae98b97600000000, 0x2643b90000000000, + 0xf2a9ca9b00000000, 0xcf902fed00000000, 0x1b7a5c7600000000, + 0xb5e2e50000000000, 0x6108969b00000000, 0x5c3173ed00000000, + 0x88db007600000000, 0x4c86720100000000, 0x986c019a00000000, + 0xa555e4ec00000000, 0x71bf977700000000, 0xdf272e0100000000, + 0x0bcd5d9a00000000, 0x36f4b8ec00000000, 0xe21ecb7700000000, + 0x6ac5cb0100000000, 0xbe2fb89a00000000, 0x83165dec00000000, + 0x57fc2e7700000000, 0xf964970100000000, 0x2d8ee49a00000000, + 0x10b701ec00000000, 0xc45d727700000000, 0x980ce50200000000, + 0x4ce6969900000000, 0x71df73ef00000000, 0xa535007400000000, + 0x0badb90200000000, 0xdf47ca9900000000, 0xe27e2fef00000000, + 0x36945c7400000000, 0xbe4f5c0200000000, 0x6aa52f9900000000, + 0x579ccaef00000000, 0x8376b97400000000, 0x2dee000200000000, + 0xf904739900000000, 0xc43d96ef00000000, 0x10d7e57400000000, + 0xd48a970300000000, 0x0060e49800000000, 0x3d5901ee00000000, + 0xe9b3727500000000, 0x472bcb0300000000, 0x93c1b89800000000, + 0xaef85dee00000000, 0x7a122e7500000000, 0xf2c92e0300000000, + 0x26235d9800000000, 0x1b1ab8ee00000000, 0xcff0cb7500000000, + 0x6168720300000000, 0xb582019800000000, 0x88bbe4ee00000000, + 0x5c51977500000000, 0x3019ca0500000000, 0xe4f3b99e00000000, + 0xd9ca5ce800000000, 0x0d202f7300000000, 0xa3b8960500000000, + 0x7752e59e00000000, 0x4a6b00e800000000, 0x9e81737300000000, + 0x165a730500000000, 0xc2b0009e00000000, 0xff89e5e800000000, + 0x2b63967300000000, 0x85fb2f0500000000, 0x51115c9e00000000, + 0x6c28b9e800000000, 0xb8c2ca7300000000, 0x7c9fb80400000000, + 0xa875cb9f00000000, 0x954c2ee900000000, 0x41a65d7200000000, + 0xef3ee40400000000, 0x3bd4979f00000000, 0x06ed72e900000000, + 0xd207017200000000, 0x5adc010400000000, 0x8e36729f00000000, + 0xb30f97e900000000, 0x67e5e47200000000, 0xc97d5d0400000000, + 0x1d972e9f00000000, 0x20aecbe900000000, 0xf444b87200000000, + 0xa8152f0700000000, 0x7cff5c9c00000000, 0x41c6b9ea00000000, + 0x952cca7100000000, 0x3bb4730700000000, 0xef5e009c00000000, + 0xd267e5ea00000000, 0x068d967100000000, 0x8e56960700000000, + 0x5abce59c00000000, 0x678500ea00000000, 0xb36f737100000000, + 0x1df7ca0700000000, 0xc91db99c00000000, 0xf4245cea00000000, + 0x20ce2f7100000000, 0xe4935d0600000000, 0x30792e9d00000000, + 0x0d40cbeb00000000, 0xd9aab87000000000, 0x7732010600000000, + 0xa3d8729d00000000, 0x9ee197eb00000000, 0x4a0be47000000000, + 0xc2d0e40600000000, 0x163a979d00000000, 0x2b0372eb00000000, + 0xffe9017000000000, 0x5171b80600000000, 0x859bcb9d00000000, + 0xb8a22eeb00000000, 0x6c485d7000000000, 0x6032940b00000000, + 0xb4d8e79000000000, 0x89e102e600000000, 0x5d0b717d00000000, + 0xf393c80b00000000, 0x2779bb9000000000, 0x1a405ee600000000, + 0xceaa2d7d00000000, 0x46712d0b00000000, 0x929b5e9000000000, + 0xafa2bbe600000000, 0x7b48c87d00000000, 0xd5d0710b00000000, + 0x013a029000000000, 0x3c03e7e600000000, 0xe8e9947d00000000, + 0x2cb4e60a00000000, 0xf85e959100000000, 0xc56770e700000000, + 0x118d037c00000000, 0xbf15ba0a00000000, 0x6bffc99100000000, + 0x56c62ce700000000, 0x822c5f7c00000000, 0x0af75f0a00000000, + 0xde1d2c9100000000, 0xe324c9e700000000, 0x37ceba7c00000000, + 0x9956030a00000000, 0x4dbc709100000000, 0x708595e700000000, + 0xa46fe67c00000000, 0xf83e710900000000, 0x2cd4029200000000, + 0x11ede7e400000000, 0xc507947f00000000, 0x6b9f2d0900000000, + 0xbf755e9200000000, 0x824cbbe400000000, 0x56a6c87f00000000, + 0xde7dc80900000000, 0x0a97bb9200000000, 0x37ae5ee400000000, + 0xe3442d7f00000000, 0x4ddc940900000000, 0x9936e79200000000, + 0xa40f02e400000000, 0x70e5717f00000000, 0xb4b8030800000000, + 0x6052709300000000, 0x5d6b95e500000000, 0x8981e67e00000000, + 0x27195f0800000000, 0xf3f32c9300000000, 0xcecac9e500000000, + 0x1a20ba7e00000000, 0x92fbba0800000000, 0x4611c99300000000, + 0x7b282ce500000000, 0xafc25f7e00000000, 0x015ae60800000000, + 0xd5b0959300000000, 0xe88970e500000000, 0x3c63037e00000000, + 0x502b5e0e00000000, 0x84c12d9500000000, 0xb9f8c8e300000000, + 0x6d12bb7800000000, 0xc38a020e00000000, 0x1760719500000000, + 0x2a5994e300000000, 0xfeb3e77800000000, 0x7668e70e00000000, + 0xa282949500000000, 0x9fbb71e300000000, 0x4b51027800000000, + 0xe5c9bb0e00000000, 0x3123c89500000000, 0x0c1a2de300000000, + 0xd8f05e7800000000, 0x1cad2c0f00000000, 0xc8475f9400000000, + 0xf57ebae200000000, 0x2194c97900000000, 0x8f0c700f00000000, + 0x5be6039400000000, 0x66dfe6e200000000, 0xb235957900000000, + 0x3aee950f00000000, 0xee04e69400000000, 0xd33d03e200000000, + 0x07d7707900000000, 0xa94fc90f00000000, 0x7da5ba9400000000, + 0x409c5fe200000000, 0x94762c7900000000, 0xc827bb0c00000000, + 0x1ccdc89700000000, 0x21f42de100000000, 0xf51e5e7a00000000, + 0x5b86e70c00000000, 0x8f6c949700000000, 0xb25571e100000000, + 0x66bf027a00000000, 0xee64020c00000000, 0x3a8e719700000000, + 0x07b794e100000000, 0xd35de77a00000000, 0x7dc55e0c00000000, + 0xa92f2d9700000000, 0x9416c8e100000000, 0x40fcbb7a00000000, + 0x84a1c90d00000000, 0x504bba9600000000, 0x6d725fe000000000, + 0xb9982c7b00000000, 0x1700950d00000000, 0xc3eae69600000000, + 0xfed303e000000000, 0x2a39707b00000000, 0xa2e2700d00000000, + 0x7608039600000000, 0x4b31e6e000000000, 0x9fdb957b00000000, + 0x31432c0d00000000, 0xe5a95f9600000000, 0xd890bae000000000, + 0x0c7ac97b00000000}, + {0x0000000000000000, 0x2765258100000000, 0x0fcc3bd900000000, + 0x28a91e5800000000, 0x5f9e066900000000, 0x78fb23e800000000, + 0x50523db000000000, 0x7737183100000000, 0xbe3c0dd200000000, + 0x9959285300000000, 0xb1f0360b00000000, 0x9695138a00000000, + 0xe1a20bbb00000000, 0xc6c72e3a00000000, 0xee6e306200000000, + 0xc90b15e300000000, 0x3d7f6b7f00000000, 0x1a1a4efe00000000, + 0x32b350a600000000, 0x15d6752700000000, 0x62e16d1600000000, + 0x4584489700000000, 0x6d2d56cf00000000, 0x4a48734e00000000, + 0x834366ad00000000, 0xa426432c00000000, 0x8c8f5d7400000000, + 0xabea78f500000000, 0xdcdd60c400000000, 0xfbb8454500000000, + 0xd3115b1d00000000, 0xf4747e9c00000000, 0x7afed6fe00000000, + 0x5d9bf37f00000000, 0x7532ed2700000000, 0x5257c8a600000000, + 0x2560d09700000000, 0x0205f51600000000, 0x2aaceb4e00000000, + 0x0dc9cecf00000000, 0xc4c2db2c00000000, 0xe3a7fead00000000, + 0xcb0ee0f500000000, 0xec6bc57400000000, 0x9b5cdd4500000000, + 0xbc39f8c400000000, 0x9490e69c00000000, 0xb3f5c31d00000000, + 0x4781bd8100000000, 0x60e4980000000000, 0x484d865800000000, + 0x6f28a3d900000000, 0x181fbbe800000000, 0x3f7a9e6900000000, + 0x17d3803100000000, 0x30b6a5b000000000, 0xf9bdb05300000000, + 0xded895d200000000, 0xf6718b8a00000000, 0xd114ae0b00000000, + 0xa623b63a00000000, 0x814693bb00000000, 0xa9ef8de300000000, + 0x8e8aa86200000000, 0xb5fadc2600000000, 0x929ff9a700000000, + 0xba36e7ff00000000, 0x9d53c27e00000000, 0xea64da4f00000000, + 0xcd01ffce00000000, 0xe5a8e19600000000, 0xc2cdc41700000000, + 0x0bc6d1f400000000, 0x2ca3f47500000000, 0x040aea2d00000000, + 0x236fcfac00000000, 0x5458d79d00000000, 0x733df21c00000000, + 0x5b94ec4400000000, 0x7cf1c9c500000000, 0x8885b75900000000, + 0xafe092d800000000, 0x87498c8000000000, 0xa02ca90100000000, + 0xd71bb13000000000, 0xf07e94b100000000, 0xd8d78ae900000000, + 0xffb2af6800000000, 0x36b9ba8b00000000, 0x11dc9f0a00000000, + 0x3975815200000000, 0x1e10a4d300000000, 0x6927bce200000000, + 0x4e42996300000000, 0x66eb873b00000000, 0x418ea2ba00000000, + 0xcf040ad800000000, 0xe8612f5900000000, 0xc0c8310100000000, + 0xe7ad148000000000, 0x909a0cb100000000, 0xb7ff293000000000, + 0x9f56376800000000, 0xb83312e900000000, 0x7138070a00000000, + 0x565d228b00000000, 0x7ef43cd300000000, 0x5991195200000000, + 0x2ea6016300000000, 0x09c324e200000000, 0x216a3aba00000000, + 0x060f1f3b00000000, 0xf27b61a700000000, 0xd51e442600000000, + 0xfdb75a7e00000000, 0xdad27fff00000000, 0xade567ce00000000, + 0x8a80424f00000000, 0xa2295c1700000000, 0x854c799600000000, + 0x4c476c7500000000, 0x6b2249f400000000, 0x438b57ac00000000, + 0x64ee722d00000000, 0x13d96a1c00000000, 0x34bc4f9d00000000, + 0x1c1551c500000000, 0x3b70744400000000, 0x6af5b94d00000000, + 0x4d909ccc00000000, 0x6539829400000000, 0x425ca71500000000, + 0x356bbf2400000000, 0x120e9aa500000000, 0x3aa784fd00000000, + 0x1dc2a17c00000000, 0xd4c9b49f00000000, 0xf3ac911e00000000, + 0xdb058f4600000000, 0xfc60aac700000000, 0x8b57b2f600000000, + 0xac32977700000000, 0x849b892f00000000, 0xa3feacae00000000, + 0x578ad23200000000, 0x70eff7b300000000, 0x5846e9eb00000000, + 0x7f23cc6a00000000, 0x0814d45b00000000, 0x2f71f1da00000000, + 0x07d8ef8200000000, 0x20bdca0300000000, 0xe9b6dfe000000000, + 0xced3fa6100000000, 0xe67ae43900000000, 0xc11fc1b800000000, + 0xb628d98900000000, 0x914dfc0800000000, 0xb9e4e25000000000, + 0x9e81c7d100000000, 0x100b6fb300000000, 0x376e4a3200000000, + 0x1fc7546a00000000, 0x38a271eb00000000, 0x4f9569da00000000, + 0x68f04c5b00000000, 0x4059520300000000, 0x673c778200000000, + 0xae37626100000000, 0x895247e000000000, 0xa1fb59b800000000, + 0x869e7c3900000000, 0xf1a9640800000000, 0xd6cc418900000000, + 0xfe655fd100000000, 0xd9007a5000000000, 0x2d7404cc00000000, + 0x0a11214d00000000, 0x22b83f1500000000, 0x05dd1a9400000000, + 0x72ea02a500000000, 0x558f272400000000, 0x7d26397c00000000, + 0x5a431cfd00000000, 0x9348091e00000000, 0xb42d2c9f00000000, + 0x9c8432c700000000, 0xbbe1174600000000, 0xccd60f7700000000, + 0xebb32af600000000, 0xc31a34ae00000000, 0xe47f112f00000000, + 0xdf0f656b00000000, 0xf86a40ea00000000, 0xd0c35eb200000000, + 0xf7a67b3300000000, 0x8091630200000000, 0xa7f4468300000000, + 0x8f5d58db00000000, 0xa8387d5a00000000, 0x613368b900000000, + 0x46564d3800000000, 0x6eff536000000000, 0x499a76e100000000, + 0x3ead6ed000000000, 0x19c84b5100000000, 0x3161550900000000, + 0x1604708800000000, 0xe2700e1400000000, 0xc5152b9500000000, + 0xedbc35cd00000000, 0xcad9104c00000000, 0xbdee087d00000000, + 0x9a8b2dfc00000000, 0xb22233a400000000, 0x9547162500000000, + 0x5c4c03c600000000, 0x7b29264700000000, 0x5380381f00000000, + 0x74e51d9e00000000, 0x03d205af00000000, 0x24b7202e00000000, + 0x0c1e3e7600000000, 0x2b7b1bf700000000, 0xa5f1b39500000000, + 0x8294961400000000, 0xaa3d884c00000000, 0x8d58adcd00000000, + 0xfa6fb5fc00000000, 0xdd0a907d00000000, 0xf5a38e2500000000, + 0xd2c6aba400000000, 0x1bcdbe4700000000, 0x3ca89bc600000000, + 0x1401859e00000000, 0x3364a01f00000000, 0x4453b82e00000000, + 0x63369daf00000000, 0x4b9f83f700000000, 0x6cfaa67600000000, + 0x988ed8ea00000000, 0xbfebfd6b00000000, 0x9742e33300000000, + 0xb027c6b200000000, 0xc710de8300000000, 0xe075fb0200000000, + 0xc8dce55a00000000, 0xefb9c0db00000000, 0x26b2d53800000000, + 0x01d7f0b900000000, 0x297eeee100000000, 0x0e1bcb6000000000, + 0x792cd35100000000, 0x5e49f6d000000000, 0x76e0e88800000000, + 0x5185cd0900000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x9ba54c6f, 0xec3b9e9f, 0x779ed2f0, 0x03063b7f, + 0x98a37710, 0xef3da5e0, 0x7498e98f, 0x060c76fe, 0x9da93a91, + 0xea37e861, 0x7192a40e, 0x050a4d81, 0x9eaf01ee, 0xe931d31e, + 0x72949f71, 0x0c18edfc, 0x97bda193, 0xe0237363, 0x7b863f0c, + 0x0f1ed683, 0x94bb9aec, 0xe325481c, 0x78800473, 0x0a149b02, + 0x91b1d76d, 0xe62f059d, 0x7d8a49f2, 0x0912a07d, 0x92b7ec12, + 0xe5293ee2, 0x7e8c728d, 0x1831dbf8, 0x83949797, 0xf40a4567, + 0x6faf0908, 0x1b37e087, 0x8092ace8, 0xf70c7e18, 0x6ca93277, + 0x1e3dad06, 0x8598e169, 0xf2063399, 0x69a37ff6, 0x1d3b9679, + 0x869eda16, 0xf10008e6, 0x6aa54489, 0x14293604, 0x8f8c7a6b, + 0xf812a89b, 0x63b7e4f4, 0x172f0d7b, 0x8c8a4114, 0xfb1493e4, + 0x60b1df8b, 0x122540fa, 0x89800c95, 0xfe1ede65, 0x65bb920a, + 0x11237b85, 0x8a8637ea, 0xfd18e51a, 0x66bda975, 0x3063b7f0, + 0xabc6fb9f, 0xdc58296f, 0x47fd6500, 0x33658c8f, 0xa8c0c0e0, + 0xdf5e1210, 0x44fb5e7f, 0x366fc10e, 0xadca8d61, 0xda545f91, + 0x41f113fe, 0x3569fa71, 0xaeccb61e, 0xd95264ee, 0x42f72881, + 0x3c7b5a0c, 0xa7de1663, 0xd040c493, 0x4be588fc, 0x3f7d6173, + 0xa4d82d1c, 0xd346ffec, 0x48e3b383, 0x3a772cf2, 0xa1d2609d, + 0xd64cb26d, 0x4de9fe02, 0x3971178d, 0xa2d45be2, 0xd54a8912, + 0x4eefc57d, 0x28526c08, 0xb3f72067, 0xc469f297, 0x5fccbef8, + 0x2b545777, 0xb0f11b18, 0xc76fc9e8, 0x5cca8587, 0x2e5e1af6, + 0xb5fb5699, 0xc2658469, 0x59c0c806, 0x2d582189, 0xb6fd6de6, + 0xc163bf16, 0x5ac6f379, 0x244a81f4, 0xbfefcd9b, 0xc8711f6b, + 0x53d45304, 0x274cba8b, 0xbce9f6e4, 0xcb772414, 0x50d2687b, + 0x2246f70a, 0xb9e3bb65, 0xce7d6995, 0x55d825fa, 0x2140cc75, + 0xbae5801a, 0xcd7b52ea, 0x56de1e85, 0x60c76fe0, 0xfb62238f, + 0x8cfcf17f, 0x1759bd10, 0x63c1549f, 0xf86418f0, 0x8ffaca00, + 0x145f866f, 0x66cb191e, 0xfd6e5571, 0x8af08781, 0x1155cbee, + 0x65cd2261, 0xfe686e0e, 0x89f6bcfe, 0x1253f091, 0x6cdf821c, + 0xf77ace73, 0x80e41c83, 0x1b4150ec, 0x6fd9b963, 0xf47cf50c, + 0x83e227fc, 0x18476b93, 0x6ad3f4e2, 0xf176b88d, 0x86e86a7d, + 0x1d4d2612, 0x69d5cf9d, 0xf27083f2, 0x85ee5102, 0x1e4b1d6d, + 0x78f6b418, 0xe353f877, 0x94cd2a87, 0x0f6866e8, 0x7bf08f67, + 0xe055c308, 0x97cb11f8, 0x0c6e5d97, 0x7efac2e6, 0xe55f8e89, + 0x92c15c79, 0x09641016, 0x7dfcf999, 0xe659b5f6, 0x91c76706, + 0x0a622b69, 0x74ee59e4, 0xef4b158b, 0x98d5c77b, 0x03708b14, + 0x77e8629b, 0xec4d2ef4, 0x9bd3fc04, 0x0076b06b, 0x72e22f1a, + 0xe9476375, 0x9ed9b185, 0x057cfdea, 0x71e41465, 0xea41580a, + 0x9ddf8afa, 0x067ac695, 0x50a4d810, 0xcb01947f, 0xbc9f468f, + 0x273a0ae0, 0x53a2e36f, 0xc807af00, 0xbf997df0, 0x243c319f, + 0x56a8aeee, 0xcd0de281, 0xba933071, 0x21367c1e, 0x55ae9591, + 0xce0bd9fe, 0xb9950b0e, 0x22304761, 0x5cbc35ec, 0xc7197983, + 0xb087ab73, 0x2b22e71c, 0x5fba0e93, 0xc41f42fc, 0xb381900c, + 0x2824dc63, 0x5ab04312, 0xc1150f7d, 0xb68bdd8d, 0x2d2e91e2, + 0x59b6786d, 0xc2133402, 0xb58de6f2, 0x2e28aa9d, 0x489503e8, + 0xd3304f87, 0xa4ae9d77, 0x3f0bd118, 0x4b933897, 0xd03674f8, + 0xa7a8a608, 0x3c0dea67, 0x4e997516, 0xd53c3979, 0xa2a2eb89, + 0x3907a7e6, 0x4d9f4e69, 0xd63a0206, 0xa1a4d0f6, 0x3a019c99, + 0x448dee14, 0xdf28a27b, 0xa8b6708b, 0x33133ce4, 0x478bd56b, + 0xdc2e9904, 0xabb04bf4, 0x3015079b, 0x428198ea, 0xd924d485, + 0xaeba0675, 0x351f4a1a, 0x4187a395, 0xda22effa, 0xadbc3d0a, + 0x36197165}, + {0x00000000, 0xc18edfc0, 0x586cb9c1, 0x99e26601, 0xb0d97382, + 0x7157ac42, 0xe8b5ca43, 0x293b1583, 0xbac3e145, 0x7b4d3e85, + 0xe2af5884, 0x23218744, 0x0a1a92c7, 0xcb944d07, 0x52762b06, + 0x93f8f4c6, 0xaef6c4cb, 0x6f781b0b, 0xf69a7d0a, 0x3714a2ca, + 0x1e2fb749, 0xdfa16889, 0x46430e88, 0x87cdd148, 0x1435258e, + 0xd5bbfa4e, 0x4c599c4f, 0x8dd7438f, 0xa4ec560c, 0x656289cc, + 0xfc80efcd, 0x3d0e300d, 0x869c8fd7, 0x47125017, 0xdef03616, + 0x1f7ee9d6, 0x3645fc55, 0xf7cb2395, 0x6e294594, 0xafa79a54, + 0x3c5f6e92, 0xfdd1b152, 0x6433d753, 0xa5bd0893, 0x8c861d10, + 0x4d08c2d0, 0xd4eaa4d1, 0x15647b11, 0x286a4b1c, 0xe9e494dc, + 0x7006f2dd, 0xb1882d1d, 0x98b3389e, 0x593de75e, 0xc0df815f, + 0x01515e9f, 0x92a9aa59, 0x53277599, 0xcac51398, 0x0b4bcc58, + 0x2270d9db, 0xe3fe061b, 0x7a1c601a, 0xbb92bfda, 0xd64819ef, + 0x17c6c62f, 0x8e24a02e, 0x4faa7fee, 0x66916a6d, 0xa71fb5ad, + 0x3efdd3ac, 0xff730c6c, 0x6c8bf8aa, 0xad05276a, 0x34e7416b, + 0xf5699eab, 0xdc528b28, 0x1ddc54e8, 0x843e32e9, 0x45b0ed29, + 0x78bedd24, 0xb93002e4, 0x20d264e5, 0xe15cbb25, 0xc867aea6, + 0x09e97166, 0x900b1767, 0x5185c8a7, 0xc27d3c61, 0x03f3e3a1, + 0x9a1185a0, 0x5b9f5a60, 0x72a44fe3, 0xb32a9023, 0x2ac8f622, + 0xeb4629e2, 0x50d49638, 0x915a49f8, 0x08b82ff9, 0xc936f039, + 0xe00de5ba, 0x21833a7a, 0xb8615c7b, 0x79ef83bb, 0xea17777d, + 0x2b99a8bd, 0xb27bcebc, 0x73f5117c, 0x5ace04ff, 0x9b40db3f, + 0x02a2bd3e, 0xc32c62fe, 0xfe2252f3, 0x3fac8d33, 0xa64eeb32, + 0x67c034f2, 0x4efb2171, 0x8f75feb1, 0x169798b0, 0xd7194770, + 0x44e1b3b6, 0x856f6c76, 0x1c8d0a77, 0xdd03d5b7, 0xf438c034, + 0x35b61ff4, 0xac5479f5, 0x6ddaa635, 0x77e1359f, 0xb66fea5f, + 0x2f8d8c5e, 0xee03539e, 0xc738461d, 0x06b699dd, 0x9f54ffdc, + 0x5eda201c, 0xcd22d4da, 0x0cac0b1a, 0x954e6d1b, 0x54c0b2db, + 0x7dfba758, 0xbc757898, 0x25971e99, 0xe419c159, 0xd917f154, + 0x18992e94, 0x817b4895, 0x40f59755, 0x69ce82d6, 0xa8405d16, + 0x31a23b17, 0xf02ce4d7, 0x63d41011, 0xa25acfd1, 0x3bb8a9d0, + 0xfa367610, 0xd30d6393, 0x1283bc53, 0x8b61da52, 0x4aef0592, + 0xf17dba48, 0x30f36588, 0xa9110389, 0x689fdc49, 0x41a4c9ca, + 0x802a160a, 0x19c8700b, 0xd846afcb, 0x4bbe5b0d, 0x8a3084cd, + 0x13d2e2cc, 0xd25c3d0c, 0xfb67288f, 0x3ae9f74f, 0xa30b914e, + 0x62854e8e, 0x5f8b7e83, 0x9e05a143, 0x07e7c742, 0xc6691882, + 0xef520d01, 0x2edcd2c1, 0xb73eb4c0, 0x76b06b00, 0xe5489fc6, + 0x24c64006, 0xbd242607, 0x7caaf9c7, 0x5591ec44, 0x941f3384, + 0x0dfd5585, 0xcc738a45, 0xa1a92c70, 0x6027f3b0, 0xf9c595b1, + 0x384b4a71, 0x11705ff2, 0xd0fe8032, 0x491ce633, 0x889239f3, + 0x1b6acd35, 0xdae412f5, 0x430674f4, 0x8288ab34, 0xabb3beb7, + 0x6a3d6177, 0xf3df0776, 0x3251d8b6, 0x0f5fe8bb, 0xced1377b, + 0x5733517a, 0x96bd8eba, 0xbf869b39, 0x7e0844f9, 0xe7ea22f8, + 0x2664fd38, 0xb59c09fe, 0x7412d63e, 0xedf0b03f, 0x2c7e6fff, + 0x05457a7c, 0xc4cba5bc, 0x5d29c3bd, 0x9ca71c7d, 0x2735a3a7, + 0xe6bb7c67, 0x7f591a66, 0xbed7c5a6, 0x97ecd025, 0x56620fe5, + 0xcf8069e4, 0x0e0eb624, 0x9df642e2, 0x5c789d22, 0xc59afb23, + 0x041424e3, 0x2d2f3160, 0xeca1eea0, 0x754388a1, 0xb4cd5761, + 0x89c3676c, 0x484db8ac, 0xd1afdead, 0x1021016d, 0x391a14ee, + 0xf894cb2e, 0x6176ad2f, 0xa0f872ef, 0x33008629, 0xf28e59e9, + 0x6b6c3fe8, 0xaae2e028, 0x83d9f5ab, 0x42572a6b, 0xdbb54c6a, + 0x1a3b93aa}, + {0x00000000, 0xefc26b3e, 0x04f5d03d, 0xeb37bb03, 0x09eba07a, + 0xe629cb44, 0x0d1e7047, 0xe2dc1b79, 0x13d740f4, 0xfc152bca, + 0x172290c9, 0xf8e0fbf7, 0x1a3ce08e, 0xf5fe8bb0, 0x1ec930b3, + 0xf10b5b8d, 0x27ae81e8, 0xc86cead6, 0x235b51d5, 0xcc993aeb, + 0x2e452192, 0xc1874aac, 0x2ab0f1af, 0xc5729a91, 0x3479c11c, + 0xdbbbaa22, 0x308c1121, 0xdf4e7a1f, 0x3d926166, 0xd2500a58, + 0x3967b15b, 0xd6a5da65, 0x4f5d03d0, 0xa09f68ee, 0x4ba8d3ed, + 0xa46ab8d3, 0x46b6a3aa, 0xa974c894, 0x42437397, 0xad8118a9, + 0x5c8a4324, 0xb348281a, 0x587f9319, 0xb7bdf827, 0x5561e35e, + 0xbaa38860, 0x51943363, 0xbe56585d, 0x68f38238, 0x8731e906, + 0x6c065205, 0x83c4393b, 0x61182242, 0x8eda497c, 0x65edf27f, + 0x8a2f9941, 0x7b24c2cc, 0x94e6a9f2, 0x7fd112f1, 0x901379cf, + 0x72cf62b6, 0x9d0d0988, 0x763ab28b, 0x99f8d9b5, 0x9eba07a0, + 0x71786c9e, 0x9a4fd79d, 0x758dbca3, 0x9751a7da, 0x7893cce4, + 0x93a477e7, 0x7c661cd9, 0x8d6d4754, 0x62af2c6a, 0x89989769, + 0x665afc57, 0x8486e72e, 0x6b448c10, 0x80733713, 0x6fb15c2d, + 0xb9148648, 0x56d6ed76, 0xbde15675, 0x52233d4b, 0xb0ff2632, + 0x5f3d4d0c, 0xb40af60f, 0x5bc89d31, 0xaac3c6bc, 0x4501ad82, + 0xae361681, 0x41f47dbf, 0xa32866c6, 0x4cea0df8, 0xa7ddb6fb, + 0x481fddc5, 0xd1e70470, 0x3e256f4e, 0xd512d44d, 0x3ad0bf73, + 0xd80ca40a, 0x37cecf34, 0xdcf97437, 0x333b1f09, 0xc2304484, + 0x2df22fba, 0xc6c594b9, 0x2907ff87, 0xcbdbe4fe, 0x24198fc0, + 0xcf2e34c3, 0x20ec5ffd, 0xf6498598, 0x198beea6, 0xf2bc55a5, + 0x1d7e3e9b, 0xffa225e2, 0x10604edc, 0xfb57f5df, 0x14959ee1, + 0xe59ec56c, 0x0a5cae52, 0xe16b1551, 0x0ea97e6f, 0xec756516, + 0x03b70e28, 0xe880b52b, 0x0742de15, 0xe6050901, 0x09c7623f, + 0xe2f0d93c, 0x0d32b202, 0xefeea97b, 0x002cc245, 0xeb1b7946, + 0x04d91278, 0xf5d249f5, 0x1a1022cb, 0xf12799c8, 0x1ee5f2f6, + 0xfc39e98f, 0x13fb82b1, 0xf8cc39b2, 0x170e528c, 0xc1ab88e9, + 0x2e69e3d7, 0xc55e58d4, 0x2a9c33ea, 0xc8402893, 0x278243ad, + 0xccb5f8ae, 0x23779390, 0xd27cc81d, 0x3dbea323, 0xd6891820, + 0x394b731e, 0xdb976867, 0x34550359, 0xdf62b85a, 0x30a0d364, + 0xa9580ad1, 0x469a61ef, 0xadaddaec, 0x426fb1d2, 0xa0b3aaab, + 0x4f71c195, 0xa4467a96, 0x4b8411a8, 0xba8f4a25, 0x554d211b, + 0xbe7a9a18, 0x51b8f126, 0xb364ea5f, 0x5ca68161, 0xb7913a62, + 0x5853515c, 0x8ef68b39, 0x6134e007, 0x8a035b04, 0x65c1303a, + 0x871d2b43, 0x68df407d, 0x83e8fb7e, 0x6c2a9040, 0x9d21cbcd, + 0x72e3a0f3, 0x99d41bf0, 0x761670ce, 0x94ca6bb7, 0x7b080089, + 0x903fbb8a, 0x7ffdd0b4, 0x78bf0ea1, 0x977d659f, 0x7c4ade9c, + 0x9388b5a2, 0x7154aedb, 0x9e96c5e5, 0x75a17ee6, 0x9a6315d8, + 0x6b684e55, 0x84aa256b, 0x6f9d9e68, 0x805ff556, 0x6283ee2f, + 0x8d418511, 0x66763e12, 0x89b4552c, 0x5f118f49, 0xb0d3e477, + 0x5be45f74, 0xb426344a, 0x56fa2f33, 0xb938440d, 0x520fff0e, + 0xbdcd9430, 0x4cc6cfbd, 0xa304a483, 0x48331f80, 0xa7f174be, + 0x452d6fc7, 0xaaef04f9, 0x41d8bffa, 0xae1ad4c4, 0x37e20d71, + 0xd820664f, 0x3317dd4c, 0xdcd5b672, 0x3e09ad0b, 0xd1cbc635, + 0x3afc7d36, 0xd53e1608, 0x24354d85, 0xcbf726bb, 0x20c09db8, + 0xcf02f686, 0x2ddeedff, 0xc21c86c1, 0x292b3dc2, 0xc6e956fc, + 0x104c8c99, 0xff8ee7a7, 0x14b95ca4, 0xfb7b379a, 0x19a72ce3, + 0xf66547dd, 0x1d52fcde, 0xf29097e0, 0x039bcc6d, 0xec59a753, + 0x076e1c50, 0xe8ac776e, 0x0a706c17, 0xe5b20729, 0x0e85bc2a, + 0xe147d714}, + {0x00000000, 0x177b1443, 0x2ef62886, 0x398d3cc5, 0x5dec510c, + 0x4a97454f, 0x731a798a, 0x64616dc9, 0xbbd8a218, 0xaca3b65b, + 0x952e8a9e, 0x82559edd, 0xe634f314, 0xf14fe757, 0xc8c2db92, + 0xdfb9cfd1, 0xacc04271, 0xbbbb5632, 0x82366af7, 0x954d7eb4, + 0xf12c137d, 0xe657073e, 0xdfda3bfb, 0xc8a12fb8, 0x1718e069, + 0x0063f42a, 0x39eec8ef, 0x2e95dcac, 0x4af4b165, 0x5d8fa526, + 0x640299e3, 0x73798da0, 0x82f182a3, 0x958a96e0, 0xac07aa25, + 0xbb7cbe66, 0xdf1dd3af, 0xc866c7ec, 0xf1ebfb29, 0xe690ef6a, + 0x392920bb, 0x2e5234f8, 0x17df083d, 0x00a41c7e, 0x64c571b7, + 0x73be65f4, 0x4a335931, 0x5d484d72, 0x2e31c0d2, 0x394ad491, + 0x00c7e854, 0x17bcfc17, 0x73dd91de, 0x64a6859d, 0x5d2bb958, + 0x4a50ad1b, 0x95e962ca, 0x82927689, 0xbb1f4a4c, 0xac645e0f, + 0xc80533c6, 0xdf7e2785, 0xe6f31b40, 0xf1880f03, 0xde920307, + 0xc9e91744, 0xf0642b81, 0xe71f3fc2, 0x837e520b, 0x94054648, + 0xad887a8d, 0xbaf36ece, 0x654aa11f, 0x7231b55c, 0x4bbc8999, + 0x5cc79dda, 0x38a6f013, 0x2fdde450, 0x1650d895, 0x012bccd6, + 0x72524176, 0x65295535, 0x5ca469f0, 0x4bdf7db3, 0x2fbe107a, + 0x38c50439, 0x014838fc, 0x16332cbf, 0xc98ae36e, 0xdef1f72d, + 0xe77ccbe8, 0xf007dfab, 0x9466b262, 0x831da621, 0xba909ae4, + 0xadeb8ea7, 0x5c6381a4, 0x4b1895e7, 0x7295a922, 0x65eebd61, + 0x018fd0a8, 0x16f4c4eb, 0x2f79f82e, 0x3802ec6d, 0xe7bb23bc, + 0xf0c037ff, 0xc94d0b3a, 0xde361f79, 0xba5772b0, 0xad2c66f3, + 0x94a15a36, 0x83da4e75, 0xf0a3c3d5, 0xe7d8d796, 0xde55eb53, + 0xc92eff10, 0xad4f92d9, 0xba34869a, 0x83b9ba5f, 0x94c2ae1c, + 0x4b7b61cd, 0x5c00758e, 0x658d494b, 0x72f65d08, 0x169730c1, + 0x01ec2482, 0x38611847, 0x2f1a0c04, 0x6655004f, 0x712e140c, + 0x48a328c9, 0x5fd83c8a, 0x3bb95143, 0x2cc24500, 0x154f79c5, + 0x02346d86, 0xdd8da257, 0xcaf6b614, 0xf37b8ad1, 0xe4009e92, + 0x8061f35b, 0x971ae718, 0xae97dbdd, 0xb9eccf9e, 0xca95423e, + 0xddee567d, 0xe4636ab8, 0xf3187efb, 0x97791332, 0x80020771, + 0xb98f3bb4, 0xaef42ff7, 0x714de026, 0x6636f465, 0x5fbbc8a0, + 0x48c0dce3, 0x2ca1b12a, 0x3bdaa569, 0x025799ac, 0x152c8def, + 0xe4a482ec, 0xf3df96af, 0xca52aa6a, 0xdd29be29, 0xb948d3e0, + 0xae33c7a3, 0x97befb66, 0x80c5ef25, 0x5f7c20f4, 0x480734b7, + 0x718a0872, 0x66f11c31, 0x029071f8, 0x15eb65bb, 0x2c66597e, + 0x3b1d4d3d, 0x4864c09d, 0x5f1fd4de, 0x6692e81b, 0x71e9fc58, + 0x15889191, 0x02f385d2, 0x3b7eb917, 0x2c05ad54, 0xf3bc6285, + 0xe4c776c6, 0xdd4a4a03, 0xca315e40, 0xae503389, 0xb92b27ca, + 0x80a61b0f, 0x97dd0f4c, 0xb8c70348, 0xafbc170b, 0x96312bce, + 0x814a3f8d, 0xe52b5244, 0xf2504607, 0xcbdd7ac2, 0xdca66e81, + 0x031fa150, 0x1464b513, 0x2de989d6, 0x3a929d95, 0x5ef3f05c, + 0x4988e41f, 0x7005d8da, 0x677ecc99, 0x14074139, 0x037c557a, + 0x3af169bf, 0x2d8a7dfc, 0x49eb1035, 0x5e900476, 0x671d38b3, + 0x70662cf0, 0xafdfe321, 0xb8a4f762, 0x8129cba7, 0x9652dfe4, + 0xf233b22d, 0xe548a66e, 0xdcc59aab, 0xcbbe8ee8, 0x3a3681eb, + 0x2d4d95a8, 0x14c0a96d, 0x03bbbd2e, 0x67dad0e7, 0x70a1c4a4, + 0x492cf861, 0x5e57ec22, 0x81ee23f3, 0x969537b0, 0xaf180b75, + 0xb8631f36, 0xdc0272ff, 0xcb7966bc, 0xf2f45a79, 0xe58f4e3a, + 0x96f6c39a, 0x818dd7d9, 0xb800eb1c, 0xaf7bff5f, 0xcb1a9296, + 0xdc6186d5, 0xe5ecba10, 0xf297ae53, 0x2d2e6182, 0x3a5575c1, + 0x03d84904, 0x14a35d47, 0x70c2308e, 0x67b924cd, 0x5e341808, + 0x494f0c4b}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x43147b17, 0x8628f62e, 0xc53c8d39, 0x0c51ec5d, + 0x4f45974a, 0x8a791a73, 0xc96d6164, 0x18a2d8bb, 0x5bb6a3ac, + 0x9e8a2e95, 0xdd9e5582, 0x14f334e6, 0x57e74ff1, 0x92dbc2c8, + 0xd1cfb9df, 0x7142c0ac, 0x3256bbbb, 0xf76a3682, 0xb47e4d95, + 0x7d132cf1, 0x3e0757e6, 0xfb3bdadf, 0xb82fa1c8, 0x69e01817, + 0x2af46300, 0xefc8ee39, 0xacdc952e, 0x65b1f44a, 0x26a58f5d, + 0xe3990264, 0xa08d7973, 0xa382f182, 0xe0968a95, 0x25aa07ac, + 0x66be7cbb, 0xafd31ddf, 0xecc766c8, 0x29fbebf1, 0x6aef90e6, + 0xbb202939, 0xf834522e, 0x3d08df17, 0x7e1ca400, 0xb771c564, + 0xf465be73, 0x3159334a, 0x724d485d, 0xd2c0312e, 0x91d44a39, + 0x54e8c700, 0x17fcbc17, 0xde91dd73, 0x9d85a664, 0x58b92b5d, + 0x1bad504a, 0xca62e995, 0x89769282, 0x4c4a1fbb, 0x0f5e64ac, + 0xc63305c8, 0x85277edf, 0x401bf3e6, 0x030f88f1, 0x070392de, + 0x4417e9c9, 0x812b64f0, 0xc23f1fe7, 0x0b527e83, 0x48460594, + 0x8d7a88ad, 0xce6ef3ba, 0x1fa14a65, 0x5cb53172, 0x9989bc4b, + 0xda9dc75c, 0x13f0a638, 0x50e4dd2f, 0x95d85016, 0xd6cc2b01, + 0x76415272, 0x35552965, 0xf069a45c, 0xb37ddf4b, 0x7a10be2f, + 0x3904c538, 0xfc384801, 0xbf2c3316, 0x6ee38ac9, 0x2df7f1de, + 0xe8cb7ce7, 0xabdf07f0, 0x62b26694, 0x21a61d83, 0xe49a90ba, + 0xa78eebad, 0xa481635c, 0xe795184b, 0x22a99572, 0x61bdee65, + 0xa8d08f01, 0xebc4f416, 0x2ef8792f, 0x6dec0238, 0xbc23bbe7, + 0xff37c0f0, 0x3a0b4dc9, 0x791f36de, 0xb07257ba, 0xf3662cad, + 0x365aa194, 0x754eda83, 0xd5c3a3f0, 0x96d7d8e7, 0x53eb55de, + 0x10ff2ec9, 0xd9924fad, 0x9a8634ba, 0x5fbab983, 0x1caec294, + 0xcd617b4b, 0x8e75005c, 0x4b498d65, 0x085df672, 0xc1309716, + 0x8224ec01, 0x47186138, 0x040c1a2f, 0x4f005566, 0x0c142e71, + 0xc928a348, 0x8a3cd85f, 0x4351b93b, 0x0045c22c, 0xc5794f15, + 0x866d3402, 0x57a28ddd, 0x14b6f6ca, 0xd18a7bf3, 0x929e00e4, + 0x5bf36180, 0x18e71a97, 0xdddb97ae, 0x9ecfecb9, 0x3e4295ca, + 0x7d56eedd, 0xb86a63e4, 0xfb7e18f3, 0x32137997, 0x71070280, + 0xb43b8fb9, 0xf72ff4ae, 0x26e04d71, 0x65f43666, 0xa0c8bb5f, + 0xe3dcc048, 0x2ab1a12c, 0x69a5da3b, 0xac995702, 0xef8d2c15, + 0xec82a4e4, 0xaf96dff3, 0x6aaa52ca, 0x29be29dd, 0xe0d348b9, + 0xa3c733ae, 0x66fbbe97, 0x25efc580, 0xf4207c5f, 0xb7340748, + 0x72088a71, 0x311cf166, 0xf8719002, 0xbb65eb15, 0x7e59662c, + 0x3d4d1d3b, 0x9dc06448, 0xded41f5f, 0x1be89266, 0x58fce971, + 0x91918815, 0xd285f302, 0x17b97e3b, 0x54ad052c, 0x8562bcf3, + 0xc676c7e4, 0x034a4add, 0x405e31ca, 0x893350ae, 0xca272bb9, + 0x0f1ba680, 0x4c0fdd97, 0x4803c7b8, 0x0b17bcaf, 0xce2b3196, + 0x8d3f4a81, 0x44522be5, 0x074650f2, 0xc27addcb, 0x816ea6dc, + 0x50a11f03, 0x13b56414, 0xd689e92d, 0x959d923a, 0x5cf0f35e, + 0x1fe48849, 0xdad80570, 0x99cc7e67, 0x39410714, 0x7a557c03, + 0xbf69f13a, 0xfc7d8a2d, 0x3510eb49, 0x7604905e, 0xb3381d67, + 0xf02c6670, 0x21e3dfaf, 0x62f7a4b8, 0xa7cb2981, 0xe4df5296, + 0x2db233f2, 0x6ea648e5, 0xab9ac5dc, 0xe88ebecb, 0xeb81363a, + 0xa8954d2d, 0x6da9c014, 0x2ebdbb03, 0xe7d0da67, 0xa4c4a170, + 0x61f82c49, 0x22ec575e, 0xf323ee81, 0xb0379596, 0x750b18af, + 0x361f63b8, 0xff7202dc, 0xbc6679cb, 0x795af4f2, 0x3a4e8fe5, + 0x9ac3f696, 0xd9d78d81, 0x1ceb00b8, 0x5fff7baf, 0x96921acb, + 0xd58661dc, 0x10baece5, 0x53ae97f2, 0x82612e2d, 0xc175553a, + 0x0449d803, 0x475da314, 0x8e30c270, 0xcd24b967, 0x0818345e, + 0x4b0c4f49}, + {0x00000000, 0x3e6bc2ef, 0x3dd0f504, 0x03bb37eb, 0x7aa0eb09, + 0x44cb29e6, 0x47701e0d, 0x791bdce2, 0xf440d713, 0xca2b15fc, + 0xc9902217, 0xf7fbe0f8, 0x8ee03c1a, 0xb08bfef5, 0xb330c91e, + 0x8d5b0bf1, 0xe881ae27, 0xd6ea6cc8, 0xd5515b23, 0xeb3a99cc, + 0x9221452e, 0xac4a87c1, 0xaff1b02a, 0x919a72c5, 0x1cc17934, + 0x22aabbdb, 0x21118c30, 0x1f7a4edf, 0x6661923d, 0x580a50d2, + 0x5bb16739, 0x65daa5d6, 0xd0035d4f, 0xee689fa0, 0xedd3a84b, + 0xd3b86aa4, 0xaaa3b646, 0x94c874a9, 0x97734342, 0xa91881ad, + 0x24438a5c, 0x1a2848b3, 0x19937f58, 0x27f8bdb7, 0x5ee36155, + 0x6088a3ba, 0x63339451, 0x5d5856be, 0x3882f368, 0x06e93187, + 0x0552066c, 0x3b39c483, 0x42221861, 0x7c49da8e, 0x7ff2ed65, + 0x41992f8a, 0xccc2247b, 0xf2a9e694, 0xf112d17f, 0xcf791390, + 0xb662cf72, 0x88090d9d, 0x8bb23a76, 0xb5d9f899, 0xa007ba9e, + 0x9e6c7871, 0x9dd74f9a, 0xa3bc8d75, 0xdaa75197, 0xe4cc9378, + 0xe777a493, 0xd91c667c, 0x54476d8d, 0x6a2caf62, 0x69979889, + 0x57fc5a66, 0x2ee78684, 0x108c446b, 0x13377380, 0x2d5cb16f, + 0x488614b9, 0x76edd656, 0x7556e1bd, 0x4b3d2352, 0x3226ffb0, + 0x0c4d3d5f, 0x0ff60ab4, 0x319dc85b, 0xbcc6c3aa, 0x82ad0145, + 0x811636ae, 0xbf7df441, 0xc66628a3, 0xf80dea4c, 0xfbb6dda7, + 0xc5dd1f48, 0x7004e7d1, 0x4e6f253e, 0x4dd412d5, 0x73bfd03a, + 0x0aa40cd8, 0x34cfce37, 0x3774f9dc, 0x091f3b33, 0x844430c2, + 0xba2ff22d, 0xb994c5c6, 0x87ff0729, 0xfee4dbcb, 0xc08f1924, + 0xc3342ecf, 0xfd5fec20, 0x988549f6, 0xa6ee8b19, 0xa555bcf2, + 0x9b3e7e1d, 0xe225a2ff, 0xdc4e6010, 0xdff557fb, 0xe19e9514, + 0x6cc59ee5, 0x52ae5c0a, 0x51156be1, 0x6f7ea90e, 0x166575ec, + 0x280eb703, 0x2bb580e8, 0x15de4207, 0x010905e6, 0x3f62c709, + 0x3cd9f0e2, 0x02b2320d, 0x7ba9eeef, 0x45c22c00, 0x46791beb, + 0x7812d904, 0xf549d2f5, 0xcb22101a, 0xc89927f1, 0xf6f2e51e, + 0x8fe939fc, 0xb182fb13, 0xb239ccf8, 0x8c520e17, 0xe988abc1, + 0xd7e3692e, 0xd4585ec5, 0xea339c2a, 0x932840c8, 0xad438227, + 0xaef8b5cc, 0x90937723, 0x1dc87cd2, 0x23a3be3d, 0x201889d6, + 0x1e734b39, 0x676897db, 0x59035534, 0x5ab862df, 0x64d3a030, + 0xd10a58a9, 0xef619a46, 0xecdaadad, 0xd2b16f42, 0xabaab3a0, + 0x95c1714f, 0x967a46a4, 0xa811844b, 0x254a8fba, 0x1b214d55, + 0x189a7abe, 0x26f1b851, 0x5fea64b3, 0x6181a65c, 0x623a91b7, + 0x5c515358, 0x398bf68e, 0x07e03461, 0x045b038a, 0x3a30c165, + 0x432b1d87, 0x7d40df68, 0x7efbe883, 0x40902a6c, 0xcdcb219d, + 0xf3a0e372, 0xf01bd499, 0xce701676, 0xb76bca94, 0x8900087b, + 0x8abb3f90, 0xb4d0fd7f, 0xa10ebf78, 0x9f657d97, 0x9cde4a7c, + 0xa2b58893, 0xdbae5471, 0xe5c5969e, 0xe67ea175, 0xd815639a, + 0x554e686b, 0x6b25aa84, 0x689e9d6f, 0x56f55f80, 0x2fee8362, + 0x1185418d, 0x123e7666, 0x2c55b489, 0x498f115f, 0x77e4d3b0, + 0x745fe45b, 0x4a3426b4, 0x332ffa56, 0x0d4438b9, 0x0eff0f52, + 0x3094cdbd, 0xbdcfc64c, 0x83a404a3, 0x801f3348, 0xbe74f1a7, + 0xc76f2d45, 0xf904efaa, 0xfabfd841, 0xc4d41aae, 0x710de237, + 0x4f6620d8, 0x4cdd1733, 0x72b6d5dc, 0x0bad093e, 0x35c6cbd1, + 0x367dfc3a, 0x08163ed5, 0x854d3524, 0xbb26f7cb, 0xb89dc020, + 0x86f602cf, 0xffedde2d, 0xc1861cc2, 0xc23d2b29, 0xfc56e9c6, + 0x998c4c10, 0xa7e78eff, 0xa45cb914, 0x9a377bfb, 0xe32ca719, + 0xdd4765f6, 0xdefc521d, 0xe09790f2, 0x6dcc9b03, 0x53a759ec, + 0x501c6e07, 0x6e77ace8, 0x176c700a, 0x2907b2e5, 0x2abc850e, + 0x14d747e1}, + {0x00000000, 0xc0df8ec1, 0xc1b96c58, 0x0166e299, 0x8273d9b0, + 0x42ac5771, 0x43cab5e8, 0x83153b29, 0x45e1c3ba, 0x853e4d7b, + 0x8458afe2, 0x44872123, 0xc7921a0a, 0x074d94cb, 0x062b7652, + 0xc6f4f893, 0xcbc4f6ae, 0x0b1b786f, 0x0a7d9af6, 0xcaa21437, + 0x49b72f1e, 0x8968a1df, 0x880e4346, 0x48d1cd87, 0x8e253514, + 0x4efabbd5, 0x4f9c594c, 0x8f43d78d, 0x0c56eca4, 0xcc896265, + 0xcdef80fc, 0x0d300e3d, 0xd78f9c86, 0x17501247, 0x1636f0de, + 0xd6e97e1f, 0x55fc4536, 0x9523cbf7, 0x9445296e, 0x549aa7af, + 0x926e5f3c, 0x52b1d1fd, 0x53d73364, 0x9308bda5, 0x101d868c, + 0xd0c2084d, 0xd1a4ead4, 0x117b6415, 0x1c4b6a28, 0xdc94e4e9, + 0xddf20670, 0x1d2d88b1, 0x9e38b398, 0x5ee73d59, 0x5f81dfc0, + 0x9f5e5101, 0x59aaa992, 0x99752753, 0x9813c5ca, 0x58cc4b0b, + 0xdbd97022, 0x1b06fee3, 0x1a601c7a, 0xdabf92bb, 0xef1948d6, + 0x2fc6c617, 0x2ea0248e, 0xee7faa4f, 0x6d6a9166, 0xadb51fa7, + 0xacd3fd3e, 0x6c0c73ff, 0xaaf88b6c, 0x6a2705ad, 0x6b41e734, + 0xab9e69f5, 0x288b52dc, 0xe854dc1d, 0xe9323e84, 0x29edb045, + 0x24ddbe78, 0xe40230b9, 0xe564d220, 0x25bb5ce1, 0xa6ae67c8, + 0x6671e909, 0x67170b90, 0xa7c88551, 0x613c7dc2, 0xa1e3f303, + 0xa085119a, 0x605a9f5b, 0xe34fa472, 0x23902ab3, 0x22f6c82a, + 0xe22946eb, 0x3896d450, 0xf8495a91, 0xf92fb808, 0x39f036c9, + 0xbae50de0, 0x7a3a8321, 0x7b5c61b8, 0xbb83ef79, 0x7d7717ea, + 0xbda8992b, 0xbcce7bb2, 0x7c11f573, 0xff04ce5a, 0x3fdb409b, + 0x3ebda202, 0xfe622cc3, 0xf35222fe, 0x338dac3f, 0x32eb4ea6, + 0xf234c067, 0x7121fb4e, 0xb1fe758f, 0xb0989716, 0x704719d7, + 0xb6b3e144, 0x766c6f85, 0x770a8d1c, 0xb7d503dd, 0x34c038f4, + 0xf41fb635, 0xf57954ac, 0x35a6da6d, 0x9f35e177, 0x5fea6fb6, + 0x5e8c8d2f, 0x9e5303ee, 0x1d4638c7, 0xdd99b606, 0xdcff549f, + 0x1c20da5e, 0xdad422cd, 0x1a0bac0c, 0x1b6d4e95, 0xdbb2c054, + 0x58a7fb7d, 0x987875bc, 0x991e9725, 0x59c119e4, 0x54f117d9, + 0x942e9918, 0x95487b81, 0x5597f540, 0xd682ce69, 0x165d40a8, + 0x173ba231, 0xd7e42cf0, 0x1110d463, 0xd1cf5aa2, 0xd0a9b83b, + 0x107636fa, 0x93630dd3, 0x53bc8312, 0x52da618b, 0x9205ef4a, + 0x48ba7df1, 0x8865f330, 0x890311a9, 0x49dc9f68, 0xcac9a441, + 0x0a162a80, 0x0b70c819, 0xcbaf46d8, 0x0d5bbe4b, 0xcd84308a, + 0xcce2d213, 0x0c3d5cd2, 0x8f2867fb, 0x4ff7e93a, 0x4e910ba3, + 0x8e4e8562, 0x837e8b5f, 0x43a1059e, 0x42c7e707, 0x821869c6, + 0x010d52ef, 0xc1d2dc2e, 0xc0b43eb7, 0x006bb076, 0xc69f48e5, + 0x0640c624, 0x072624bd, 0xc7f9aa7c, 0x44ec9155, 0x84331f94, + 0x8555fd0d, 0x458a73cc, 0x702ca9a1, 0xb0f32760, 0xb195c5f9, + 0x714a4b38, 0xf25f7011, 0x3280fed0, 0x33e61c49, 0xf3399288, + 0x35cd6a1b, 0xf512e4da, 0xf4740643, 0x34ab8882, 0xb7beb3ab, + 0x77613d6a, 0x7607dff3, 0xb6d85132, 0xbbe85f0f, 0x7b37d1ce, + 0x7a513357, 0xba8ebd96, 0x399b86bf, 0xf944087e, 0xf822eae7, + 0x38fd6426, 0xfe099cb5, 0x3ed61274, 0x3fb0f0ed, 0xff6f7e2c, + 0x7c7a4505, 0xbca5cbc4, 0xbdc3295d, 0x7d1ca79c, 0xa7a33527, + 0x677cbbe6, 0x661a597f, 0xa6c5d7be, 0x25d0ec97, 0xe50f6256, + 0xe46980cf, 0x24b60e0e, 0xe242f69d, 0x229d785c, 0x23fb9ac5, + 0xe3241404, 0x60312f2d, 0xa0eea1ec, 0xa1884375, 0x6157cdb4, + 0x6c67c389, 0xacb84d48, 0xaddeafd1, 0x6d012110, 0xee141a39, + 0x2ecb94f8, 0x2fad7661, 0xef72f8a0, 0x29860033, 0xe9598ef2, + 0xe83f6c6b, 0x28e0e2aa, 0xabf5d983, 0x6b2a5742, 0x6a4cb5db, + 0xaa933b1a}, + {0x00000000, 0x6f4ca59b, 0x9f9e3bec, 0xf0d29e77, 0x7f3b0603, + 0x1077a398, 0xe0a53def, 0x8fe99874, 0xfe760c06, 0x913aa99d, + 0x61e837ea, 0x0ea49271, 0x814d0a05, 0xee01af9e, 0x1ed331e9, + 0x719f9472, 0xfced180c, 0x93a1bd97, 0x637323e0, 0x0c3f867b, + 0x83d61e0f, 0xec9abb94, 0x1c4825e3, 0x73048078, 0x029b140a, + 0x6dd7b191, 0x9d052fe6, 0xf2498a7d, 0x7da01209, 0x12ecb792, + 0xe23e29e5, 0x8d728c7e, 0xf8db3118, 0x97979483, 0x67450af4, + 0x0809af6f, 0x87e0371b, 0xe8ac9280, 0x187e0cf7, 0x7732a96c, + 0x06ad3d1e, 0x69e19885, 0x993306f2, 0xf67fa369, 0x79963b1d, + 0x16da9e86, 0xe60800f1, 0x8944a56a, 0x04362914, 0x6b7a8c8f, + 0x9ba812f8, 0xf4e4b763, 0x7b0d2f17, 0x14418a8c, 0xe49314fb, + 0x8bdfb160, 0xfa402512, 0x950c8089, 0x65de1efe, 0x0a92bb65, + 0x857b2311, 0xea37868a, 0x1ae518fd, 0x75a9bd66, 0xf0b76330, + 0x9ffbc6ab, 0x6f2958dc, 0x0065fd47, 0x8f8c6533, 0xe0c0c0a8, + 0x10125edf, 0x7f5efb44, 0x0ec16f36, 0x618dcaad, 0x915f54da, + 0xfe13f141, 0x71fa6935, 0x1eb6ccae, 0xee6452d9, 0x8128f742, + 0x0c5a7b3c, 0x6316dea7, 0x93c440d0, 0xfc88e54b, 0x73617d3f, + 0x1c2dd8a4, 0xecff46d3, 0x83b3e348, 0xf22c773a, 0x9d60d2a1, + 0x6db24cd6, 0x02fee94d, 0x8d177139, 0xe25bd4a2, 0x12894ad5, + 0x7dc5ef4e, 0x086c5228, 0x6720f7b3, 0x97f269c4, 0xf8becc5f, + 0x7757542b, 0x181bf1b0, 0xe8c96fc7, 0x8785ca5c, 0xf61a5e2e, + 0x9956fbb5, 0x698465c2, 0x06c8c059, 0x8921582d, 0xe66dfdb6, + 0x16bf63c1, 0x79f3c65a, 0xf4814a24, 0x9bcdefbf, 0x6b1f71c8, + 0x0453d453, 0x8bba4c27, 0xe4f6e9bc, 0x142477cb, 0x7b68d250, + 0x0af74622, 0x65bbe3b9, 0x95697dce, 0xfa25d855, 0x75cc4021, + 0x1a80e5ba, 0xea527bcd, 0x851ede56, 0xe06fc760, 0x8f2362fb, + 0x7ff1fc8c, 0x10bd5917, 0x9f54c163, 0xf01864f8, 0x00cafa8f, + 0x6f865f14, 0x1e19cb66, 0x71556efd, 0x8187f08a, 0xeecb5511, + 0x6122cd65, 0x0e6e68fe, 0xfebcf689, 0x91f05312, 0x1c82df6c, + 0x73ce7af7, 0x831ce480, 0xec50411b, 0x63b9d96f, 0x0cf57cf4, + 0xfc27e283, 0x936b4718, 0xe2f4d36a, 0x8db876f1, 0x7d6ae886, + 0x12264d1d, 0x9dcfd569, 0xf28370f2, 0x0251ee85, 0x6d1d4b1e, + 0x18b4f678, 0x77f853e3, 0x872acd94, 0xe866680f, 0x678ff07b, + 0x08c355e0, 0xf811cb97, 0x975d6e0c, 0xe6c2fa7e, 0x898e5fe5, + 0x795cc192, 0x16106409, 0x99f9fc7d, 0xf6b559e6, 0x0667c791, + 0x692b620a, 0xe459ee74, 0x8b154bef, 0x7bc7d598, 0x148b7003, + 0x9b62e877, 0xf42e4dec, 0x04fcd39b, 0x6bb07600, 0x1a2fe272, + 0x756347e9, 0x85b1d99e, 0xeafd7c05, 0x6514e471, 0x0a5841ea, + 0xfa8adf9d, 0x95c67a06, 0x10d8a450, 0x7f9401cb, 0x8f469fbc, + 0xe00a3a27, 0x6fe3a253, 0x00af07c8, 0xf07d99bf, 0x9f313c24, + 0xeeaea856, 0x81e20dcd, 0x713093ba, 0x1e7c3621, 0x9195ae55, + 0xfed90bce, 0x0e0b95b9, 0x61473022, 0xec35bc5c, 0x837919c7, + 0x73ab87b0, 0x1ce7222b, 0x930eba5f, 0xfc421fc4, 0x0c9081b3, + 0x63dc2428, 0x1243b05a, 0x7d0f15c1, 0x8ddd8bb6, 0xe2912e2d, + 0x6d78b659, 0x023413c2, 0xf2e68db5, 0x9daa282e, 0xe8039548, + 0x874f30d3, 0x779daea4, 0x18d10b3f, 0x9738934b, 0xf87436d0, + 0x08a6a8a7, 0x67ea0d3c, 0x1675994e, 0x79393cd5, 0x89eba2a2, + 0xe6a70739, 0x694e9f4d, 0x06023ad6, 0xf6d0a4a1, 0x999c013a, + 0x14ee8d44, 0x7ba228df, 0x8b70b6a8, 0xe43c1333, 0x6bd58b47, + 0x04992edc, 0xf44bb0ab, 0x9b071530, 0xea988142, 0x85d424d9, + 0x7506baae, 0x1a4a1f35, 0x95a38741, 0xfaef22da, 0x0a3dbcad, + 0x65711936}}; + +#endif + +#endif + +#if N == 4 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xf1da05aa, 0x38c50d15, 0xc91f08bf, 0x718a1a2a, + 0x80501f80, 0x494f173f, 0xb8951295, 0xe3143454, 0x12ce31fe, + 0xdbd13941, 0x2a0b3ceb, 0x929e2e7e, 0x63442bd4, 0xaa5b236b, + 0x5b8126c1, 0x1d596ee9, 0xec836b43, 0x259c63fc, 0xd4466656, + 0x6cd374c3, 0x9d097169, 0x541679d6, 0xa5cc7c7c, 0xfe4d5abd, + 0x0f975f17, 0xc68857a8, 0x37525202, 0x8fc74097, 0x7e1d453d, + 0xb7024d82, 0x46d84828, 0x3ab2ddd2, 0xcb68d878, 0x0277d0c7, + 0xf3add56d, 0x4b38c7f8, 0xbae2c252, 0x73fdcaed, 0x8227cf47, + 0xd9a6e986, 0x287cec2c, 0xe163e493, 0x10b9e139, 0xa82cf3ac, + 0x59f6f606, 0x90e9feb9, 0x6133fb13, 0x27ebb33b, 0xd631b691, + 0x1f2ebe2e, 0xeef4bb84, 0x5661a911, 0xa7bbacbb, 0x6ea4a404, + 0x9f7ea1ae, 0xc4ff876f, 0x352582c5, 0xfc3a8a7a, 0x0de08fd0, + 0xb5759d45, 0x44af98ef, 0x8db09050, 0x7c6a95fa, 0x7565bba4, + 0x84bfbe0e, 0x4da0b6b1, 0xbc7ab31b, 0x04efa18e, 0xf535a424, + 0x3c2aac9b, 0xcdf0a931, 0x96718ff0, 0x67ab8a5a, 0xaeb482e5, + 0x5f6e874f, 0xe7fb95da, 0x16219070, 0xdf3e98cf, 0x2ee49d65, + 0x683cd54d, 0x99e6d0e7, 0x50f9d858, 0xa123ddf2, 0x19b6cf67, + 0xe86ccacd, 0x2173c272, 0xd0a9c7d8, 0x8b28e119, 0x7af2e4b3, + 0xb3edec0c, 0x4237e9a6, 0xfaa2fb33, 0x0b78fe99, 0xc267f626, + 0x33bdf38c, 0x4fd76676, 0xbe0d63dc, 0x77126b63, 0x86c86ec9, + 0x3e5d7c5c, 0xcf8779f6, 0x06987149, 0xf74274e3, 0xacc35222, + 0x5d195788, 0x94065f37, 0x65dc5a9d, 0xdd494808, 0x2c934da2, + 0xe58c451d, 0x145640b7, 0x528e089f, 0xa3540d35, 0x6a4b058a, + 0x9b910020, 0x230412b5, 0xd2de171f, 0x1bc11fa0, 0xea1b1a0a, + 0xb19a3ccb, 0x40403961, 0x895f31de, 0x78853474, 0xc01026e1, + 0x31ca234b, 0xf8d52bf4, 0x090f2e5e, 0xeacb7748, 0x1b1172e2, + 0xd20e7a5d, 0x23d47ff7, 0x9b416d62, 0x6a9b68c8, 0xa3846077, + 0x525e65dd, 0x09df431c, 0xf80546b6, 0x311a4e09, 0xc0c04ba3, + 0x78555936, 0x898f5c9c, 0x40905423, 0xb14a5189, 0xf79219a1, + 0x06481c0b, 0xcf5714b4, 0x3e8d111e, 0x8618038b, 0x77c20621, + 0xbedd0e9e, 0x4f070b34, 0x14862df5, 0xe55c285f, 0x2c4320e0, + 0xdd99254a, 0x650c37df, 0x94d63275, 0x5dc93aca, 0xac133f60, + 0xd079aa9a, 0x21a3af30, 0xe8bca78f, 0x1966a225, 0xa1f3b0b0, + 0x5029b51a, 0x9936bda5, 0x68ecb80f, 0x336d9ece, 0xc2b79b64, + 0x0ba893db, 0xfa729671, 0x42e784e4, 0xb33d814e, 0x7a2289f1, + 0x8bf88c5b, 0xcd20c473, 0x3cfac1d9, 0xf5e5c966, 0x043fcccc, + 0xbcaade59, 0x4d70dbf3, 0x846fd34c, 0x75b5d6e6, 0x2e34f027, + 0xdfeef58d, 0x16f1fd32, 0xe72bf898, 0x5fbeea0d, 0xae64efa7, + 0x677be718, 0x96a1e2b2, 0x9faeccec, 0x6e74c946, 0xa76bc1f9, + 0x56b1c453, 0xee24d6c6, 0x1ffed36c, 0xd6e1dbd3, 0x273bde79, + 0x7cbaf8b8, 0x8d60fd12, 0x447ff5ad, 0xb5a5f007, 0x0d30e292, + 0xfceae738, 0x35f5ef87, 0xc42fea2d, 0x82f7a205, 0x732da7af, + 0xba32af10, 0x4be8aaba, 0xf37db82f, 0x02a7bd85, 0xcbb8b53a, + 0x3a62b090, 0x61e39651, 0x903993fb, 0x59269b44, 0xa8fc9eee, + 0x10698c7b, 0xe1b389d1, 0x28ac816e, 0xd97684c4, 0xa51c113e, + 0x54c61494, 0x9dd91c2b, 0x6c031981, 0xd4960b14, 0x254c0ebe, + 0xec530601, 0x1d8903ab, 0x4608256a, 0xb7d220c0, 0x7ecd287f, + 0x8f172dd5, 0x37823f40, 0xc6583aea, 0x0f473255, 0xfe9d37ff, + 0xb8457fd7, 0x499f7a7d, 0x808072c2, 0x715a7768, 0xc9cf65fd, + 0x38156057, 0xf10a68e8, 0x00d06d42, 0x5b514b83, 0xaa8b4e29, + 0x63944696, 0x924e433c, 0x2adb51a9, 0xdb015403, 0x121e5cbc, + 0xe3c45916}, + {0x00000000, 0x0ee7e8d1, 0x1dcfd1a2, 0x13283973, 0x3b9fa344, + 0x35784b95, 0x265072e6, 0x28b79a37, 0x773f4688, 0x79d8ae59, + 0x6af0972a, 0x64177ffb, 0x4ca0e5cc, 0x42470d1d, 0x516f346e, + 0x5f88dcbf, 0xee7e8d10, 0xe09965c1, 0xf3b15cb2, 0xfd56b463, + 0xd5e12e54, 0xdb06c685, 0xc82efff6, 0xc6c91727, 0x9941cb98, + 0x97a62349, 0x848e1a3a, 0x8a69f2eb, 0xa2de68dc, 0xac39800d, + 0xbf11b97e, 0xb1f651af, 0x078c1c61, 0x096bf4b0, 0x1a43cdc3, + 0x14a42512, 0x3c13bf25, 0x32f457f4, 0x21dc6e87, 0x2f3b8656, + 0x70b35ae9, 0x7e54b238, 0x6d7c8b4b, 0x639b639a, 0x4b2cf9ad, + 0x45cb117c, 0x56e3280f, 0x5804c0de, 0xe9f29171, 0xe71579a0, + 0xf43d40d3, 0xfadaa802, 0xd26d3235, 0xdc8adae4, 0xcfa2e397, + 0xc1450b46, 0x9ecdd7f9, 0x902a3f28, 0x8302065b, 0x8de5ee8a, + 0xa55274bd, 0xabb59c6c, 0xb89da51f, 0xb67a4dce, 0x0f1838c2, + 0x01ffd013, 0x12d7e960, 0x1c3001b1, 0x34879b86, 0x3a607357, + 0x29484a24, 0x27afa2f5, 0x78277e4a, 0x76c0969b, 0x65e8afe8, + 0x6b0f4739, 0x43b8dd0e, 0x4d5f35df, 0x5e770cac, 0x5090e47d, + 0xe166b5d2, 0xef815d03, 0xfca96470, 0xf24e8ca1, 0xdaf91696, + 0xd41efe47, 0xc736c734, 0xc9d12fe5, 0x9659f35a, 0x98be1b8b, + 0x8b9622f8, 0x8571ca29, 0xadc6501e, 0xa321b8cf, 0xb00981bc, + 0xbeee696d, 0x089424a3, 0x0673cc72, 0x155bf501, 0x1bbc1dd0, + 0x330b87e7, 0x3dec6f36, 0x2ec45645, 0x2023be94, 0x7fab622b, + 0x714c8afa, 0x6264b389, 0x6c835b58, 0x4434c16f, 0x4ad329be, + 0x59fb10cd, 0x571cf81c, 0xe6eaa9b3, 0xe80d4162, 0xfb257811, + 0xf5c290c0, 0xdd750af7, 0xd392e226, 0xc0badb55, 0xce5d3384, + 0x91d5ef3b, 0x9f3207ea, 0x8c1a3e99, 0x82fdd648, 0xaa4a4c7f, + 0xa4ada4ae, 0xb7859ddd, 0xb962750c, 0x1e307184, 0x10d79955, + 0x03ffa026, 0x0d1848f7, 0x25afd2c0, 0x2b483a11, 0x38600362, + 0x3687ebb3, 0x690f370c, 0x67e8dfdd, 0x74c0e6ae, 0x7a270e7f, + 0x52909448, 0x5c777c99, 0x4f5f45ea, 0x41b8ad3b, 0xf04efc94, + 0xfea91445, 0xed812d36, 0xe366c5e7, 0xcbd15fd0, 0xc536b701, + 0xd61e8e72, 0xd8f966a3, 0x8771ba1c, 0x899652cd, 0x9abe6bbe, + 0x9459836f, 0xbcee1958, 0xb209f189, 0xa121c8fa, 0xafc6202b, + 0x19bc6de5, 0x175b8534, 0x0473bc47, 0x0a945496, 0x2223cea1, + 0x2cc42670, 0x3fec1f03, 0x310bf7d2, 0x6e832b6d, 0x6064c3bc, + 0x734cfacf, 0x7dab121e, 0x551c8829, 0x5bfb60f8, 0x48d3598b, + 0x4634b15a, 0xf7c2e0f5, 0xf9250824, 0xea0d3157, 0xe4ead986, + 0xcc5d43b1, 0xc2baab60, 0xd1929213, 0xdf757ac2, 0x80fda67d, + 0x8e1a4eac, 0x9d3277df, 0x93d59f0e, 0xbb620539, 0xb585ede8, + 0xa6add49b, 0xa84a3c4a, 0x11284946, 0x1fcfa197, 0x0ce798e4, + 0x02007035, 0x2ab7ea02, 0x245002d3, 0x37783ba0, 0x399fd371, + 0x66170fce, 0x68f0e71f, 0x7bd8de6c, 0x753f36bd, 0x5d88ac8a, + 0x536f445b, 0x40477d28, 0x4ea095f9, 0xff56c456, 0xf1b12c87, + 0xe29915f4, 0xec7efd25, 0xc4c96712, 0xca2e8fc3, 0xd906b6b0, + 0xd7e15e61, 0x886982de, 0x868e6a0f, 0x95a6537c, 0x9b41bbad, + 0xb3f6219a, 0xbd11c94b, 0xae39f038, 0xa0de18e9, 0x16a45527, + 0x1843bdf6, 0x0b6b8485, 0x058c6c54, 0x2d3bf663, 0x23dc1eb2, + 0x30f427c1, 0x3e13cf10, 0x619b13af, 0x6f7cfb7e, 0x7c54c20d, + 0x72b32adc, 0x5a04b0eb, 0x54e3583a, 0x47cb6149, 0x492c8998, + 0xf8dad837, 0xf63d30e6, 0xe5150995, 0xebf2e144, 0xc3457b73, + 0xcda293a2, 0xde8aaad1, 0xd06d4200, 0x8fe59ebf, 0x8102766e, + 0x922a4f1d, 0x9ccda7cc, 0xb47a3dfb, 0xba9dd52a, 0xa9b5ec59, + 0xa7520488}, + {0x00000000, 0x3c60e308, 0x78c1c610, 0x44a12518, 0xf1838c20, + 0xcde36f28, 0x89424a30, 0xb522a938, 0x38761e01, 0x0416fd09, + 0x40b7d811, 0x7cd73b19, 0xc9f59221, 0xf5957129, 0xb1345431, + 0x8d54b739, 0x70ec3c02, 0x4c8cdf0a, 0x082dfa12, 0x344d191a, + 0x816fb022, 0xbd0f532a, 0xf9ae7632, 0xc5ce953a, 0x489a2203, + 0x74fac10b, 0x305be413, 0x0c3b071b, 0xb919ae23, 0x85794d2b, + 0xc1d86833, 0xfdb88b3b, 0xe1d87804, 0xddb89b0c, 0x9919be14, + 0xa5795d1c, 0x105bf424, 0x2c3b172c, 0x689a3234, 0x54fad13c, + 0xd9ae6605, 0xe5ce850d, 0xa16fa015, 0x9d0f431d, 0x282dea25, + 0x144d092d, 0x50ec2c35, 0x6c8ccf3d, 0x91344406, 0xad54a70e, + 0xe9f58216, 0xd595611e, 0x60b7c826, 0x5cd72b2e, 0x18760e36, + 0x2416ed3e, 0xa9425a07, 0x9522b90f, 0xd1839c17, 0xede37f1f, + 0x58c1d627, 0x64a1352f, 0x20001037, 0x1c60f33f, 0x18c1f649, + 0x24a11541, 0x60003059, 0x5c60d351, 0xe9427a69, 0xd5229961, + 0x9183bc79, 0xade35f71, 0x20b7e848, 0x1cd70b40, 0x58762e58, + 0x6416cd50, 0xd1346468, 0xed548760, 0xa9f5a278, 0x95954170, + 0x682dca4b, 0x544d2943, 0x10ec0c5b, 0x2c8cef53, 0x99ae466b, + 0xa5cea563, 0xe16f807b, 0xdd0f6373, 0x505bd44a, 0x6c3b3742, + 0x289a125a, 0x14faf152, 0xa1d8586a, 0x9db8bb62, 0xd9199e7a, + 0xe5797d72, 0xf9198e4d, 0xc5796d45, 0x81d8485d, 0xbdb8ab55, + 0x089a026d, 0x34fae165, 0x705bc47d, 0x4c3b2775, 0xc16f904c, + 0xfd0f7344, 0xb9ae565c, 0x85ceb554, 0x30ec1c6c, 0x0c8cff64, + 0x482dda7c, 0x744d3974, 0x89f5b24f, 0xb5955147, 0xf134745f, + 0xcd549757, 0x78763e6f, 0x4416dd67, 0x00b7f87f, 0x3cd71b77, + 0xb183ac4e, 0x8de34f46, 0xc9426a5e, 0xf5228956, 0x4000206e, + 0x7c60c366, 0x38c1e67e, 0x04a10576, 0x3183ec92, 0x0de30f9a, + 0x49422a82, 0x7522c98a, 0xc00060b2, 0xfc6083ba, 0xb8c1a6a2, + 0x84a145aa, 0x09f5f293, 0x3595119b, 0x71343483, 0x4d54d78b, + 0xf8767eb3, 0xc4169dbb, 0x80b7b8a3, 0xbcd75bab, 0x416fd090, + 0x7d0f3398, 0x39ae1680, 0x05cef588, 0xb0ec5cb0, 0x8c8cbfb8, + 0xc82d9aa0, 0xf44d79a8, 0x7919ce91, 0x45792d99, 0x01d80881, + 0x3db8eb89, 0x889a42b1, 0xb4faa1b9, 0xf05b84a1, 0xcc3b67a9, + 0xd05b9496, 0xec3b779e, 0xa89a5286, 0x94fab18e, 0x21d818b6, + 0x1db8fbbe, 0x5919dea6, 0x65793dae, 0xe82d8a97, 0xd44d699f, + 0x90ec4c87, 0xac8caf8f, 0x19ae06b7, 0x25cee5bf, 0x616fc0a7, + 0x5d0f23af, 0xa0b7a894, 0x9cd74b9c, 0xd8766e84, 0xe4168d8c, + 0x513424b4, 0x6d54c7bc, 0x29f5e2a4, 0x159501ac, 0x98c1b695, + 0xa4a1559d, 0xe0007085, 0xdc60938d, 0x69423ab5, 0x5522d9bd, + 0x1183fca5, 0x2de31fad, 0x29421adb, 0x1522f9d3, 0x5183dccb, + 0x6de33fc3, 0xd8c196fb, 0xe4a175f3, 0xa00050eb, 0x9c60b3e3, + 0x113404da, 0x2d54e7d2, 0x69f5c2ca, 0x559521c2, 0xe0b788fa, + 0xdcd76bf2, 0x98764eea, 0xa416ade2, 0x59ae26d9, 0x65cec5d1, + 0x216fe0c9, 0x1d0f03c1, 0xa82daaf9, 0x944d49f1, 0xd0ec6ce9, + 0xec8c8fe1, 0x61d838d8, 0x5db8dbd0, 0x1919fec8, 0x25791dc0, + 0x905bb4f8, 0xac3b57f0, 0xe89a72e8, 0xd4fa91e0, 0xc89a62df, + 0xf4fa81d7, 0xb05ba4cf, 0x8c3b47c7, 0x3919eeff, 0x05790df7, + 0x41d828ef, 0x7db8cbe7, 0xf0ec7cde, 0xcc8c9fd6, 0x882dbace, + 0xb44d59c6, 0x016ff0fe, 0x3d0f13f6, 0x79ae36ee, 0x45ced5e6, + 0xb8765edd, 0x8416bdd5, 0xc0b798cd, 0xfcd77bc5, 0x49f5d2fd, + 0x759531f5, 0x313414ed, 0x0d54f7e5, 0x800040dc, 0xbc60a3d4, + 0xf8c186cc, 0xc4a165c4, 0x7183ccfc, 0x4de32ff4, 0x09420aec, + 0x3522e9e4}, + {0x00000000, 0x6307d924, 0xc60fb248, 0xa5086b6c, 0x576e62d1, + 0x3469bbf5, 0x9161d099, 0xf26609bd, 0xaedcc5a2, 0xcddb1c86, + 0x68d377ea, 0x0bd4aece, 0xf9b2a773, 0x9ab57e57, 0x3fbd153b, + 0x5cbacc1f, 0x86c88d05, 0xe5cf5421, 0x40c73f4d, 0x23c0e669, + 0xd1a6efd4, 0xb2a136f0, 0x17a95d9c, 0x74ae84b8, 0x281448a7, + 0x4b139183, 0xee1bfaef, 0x8d1c23cb, 0x7f7a2a76, 0x1c7df352, + 0xb975983e, 0xda72411a, 0xd6e01c4b, 0xb5e7c56f, 0x10efae03, + 0x73e87727, 0x818e7e9a, 0xe289a7be, 0x4781ccd2, 0x248615f6, + 0x783cd9e9, 0x1b3b00cd, 0xbe336ba1, 0xdd34b285, 0x2f52bb38, + 0x4c55621c, 0xe95d0970, 0x8a5ad054, 0x5028914e, 0x332f486a, + 0x96272306, 0xf520fa22, 0x0746f39f, 0x64412abb, 0xc14941d7, + 0xa24e98f3, 0xfef454ec, 0x9df38dc8, 0x38fbe6a4, 0x5bfc3f80, + 0xa99a363d, 0xca9def19, 0x6f958475, 0x0c925d51, 0x76b13ed7, + 0x15b6e7f3, 0xb0be8c9f, 0xd3b955bb, 0x21df5c06, 0x42d88522, + 0xe7d0ee4e, 0x84d7376a, 0xd86dfb75, 0xbb6a2251, 0x1e62493d, + 0x7d659019, 0x8f0399a4, 0xec044080, 0x490c2bec, 0x2a0bf2c8, + 0xf079b3d2, 0x937e6af6, 0x3676019a, 0x5571d8be, 0xa717d103, + 0xc4100827, 0x6118634b, 0x021fba6f, 0x5ea57670, 0x3da2af54, + 0x98aac438, 0xfbad1d1c, 0x09cb14a1, 0x6acccd85, 0xcfc4a6e9, + 0xacc37fcd, 0xa051229c, 0xc356fbb8, 0x665e90d4, 0x055949f0, + 0xf73f404d, 0x94389969, 0x3130f205, 0x52372b21, 0x0e8de73e, + 0x6d8a3e1a, 0xc8825576, 0xab858c52, 0x59e385ef, 0x3ae45ccb, + 0x9fec37a7, 0xfcebee83, 0x2699af99, 0x459e76bd, 0xe0961dd1, + 0x8391c4f5, 0x71f7cd48, 0x12f0146c, 0xb7f87f00, 0xd4ffa624, + 0x88456a3b, 0xeb42b31f, 0x4e4ad873, 0x2d4d0157, 0xdf2b08ea, + 0xbc2cd1ce, 0x1924baa2, 0x7a236386, 0xed627dae, 0x8e65a48a, + 0x2b6dcfe6, 0x486a16c2, 0xba0c1f7f, 0xd90bc65b, 0x7c03ad37, + 0x1f047413, 0x43beb80c, 0x20b96128, 0x85b10a44, 0xe6b6d360, + 0x14d0dadd, 0x77d703f9, 0xd2df6895, 0xb1d8b1b1, 0x6baaf0ab, + 0x08ad298f, 0xada542e3, 0xcea29bc7, 0x3cc4927a, 0x5fc34b5e, + 0xfacb2032, 0x99ccf916, 0xc5763509, 0xa671ec2d, 0x03798741, + 0x607e5e65, 0x921857d8, 0xf11f8efc, 0x5417e590, 0x37103cb4, + 0x3b8261e5, 0x5885b8c1, 0xfd8dd3ad, 0x9e8a0a89, 0x6cec0334, + 0x0febda10, 0xaae3b17c, 0xc9e46858, 0x955ea447, 0xf6597d63, + 0x5351160f, 0x3056cf2b, 0xc230c696, 0xa1371fb2, 0x043f74de, + 0x6738adfa, 0xbd4aece0, 0xde4d35c4, 0x7b455ea8, 0x1842878c, + 0xea248e31, 0x89235715, 0x2c2b3c79, 0x4f2ce55d, 0x13962942, + 0x7091f066, 0xd5999b0a, 0xb69e422e, 0x44f84b93, 0x27ff92b7, + 0x82f7f9db, 0xe1f020ff, 0x9bd34379, 0xf8d49a5d, 0x5ddcf131, + 0x3edb2815, 0xccbd21a8, 0xafbaf88c, 0x0ab293e0, 0x69b54ac4, + 0x350f86db, 0x56085fff, 0xf3003493, 0x9007edb7, 0x6261e40a, + 0x01663d2e, 0xa46e5642, 0xc7698f66, 0x1d1bce7c, 0x7e1c1758, + 0xdb147c34, 0xb813a510, 0x4a75acad, 0x29727589, 0x8c7a1ee5, + 0xef7dc7c1, 0xb3c70bde, 0xd0c0d2fa, 0x75c8b996, 0x16cf60b2, + 0xe4a9690f, 0x87aeb02b, 0x22a6db47, 0x41a10263, 0x4d335f32, + 0x2e348616, 0x8b3ced7a, 0xe83b345e, 0x1a5d3de3, 0x795ae4c7, + 0xdc528fab, 0xbf55568f, 0xe3ef9a90, 0x80e843b4, 0x25e028d8, + 0x46e7f1fc, 0xb481f841, 0xd7862165, 0x728e4a09, 0x1189932d, + 0xcbfbd237, 0xa8fc0b13, 0x0df4607f, 0x6ef3b95b, 0x9c95b0e6, + 0xff9269c2, 0x5a9a02ae, 0x399ddb8a, 0x65271795, 0x0620ceb1, + 0xa328a5dd, 0xc02f7cf9, 0x32497544, 0x514eac60, 0xf446c70c, + 0x97411e28}, + {0x00000000, 0x01b5fd1d, 0x036bfa3a, 0x02de0727, 0x06d7f474, + 0x07620969, 0x05bc0e4e, 0x0409f353, 0x0dafe8e8, 0x0c1a15f5, + 0x0ec412d2, 0x0f71efcf, 0x0b781c9c, 0x0acde181, 0x0813e6a6, + 0x09a61bbb, 0x1b5fd1d0, 0x1aea2ccd, 0x18342bea, 0x1981d6f7, + 0x1d8825a4, 0x1c3dd8b9, 0x1ee3df9e, 0x1f562283, 0x16f03938, + 0x1745c425, 0x159bc302, 0x142e3e1f, 0x1027cd4c, 0x11923051, + 0x134c3776, 0x12f9ca6b, 0x36bfa3a0, 0x370a5ebd, 0x35d4599a, + 0x3461a487, 0x306857d4, 0x31ddaac9, 0x3303adee, 0x32b650f3, + 0x3b104b48, 0x3aa5b655, 0x387bb172, 0x39ce4c6f, 0x3dc7bf3c, + 0x3c724221, 0x3eac4506, 0x3f19b81b, 0x2de07270, 0x2c558f6d, + 0x2e8b884a, 0x2f3e7557, 0x2b378604, 0x2a827b19, 0x285c7c3e, + 0x29e98123, 0x204f9a98, 0x21fa6785, 0x232460a2, 0x22919dbf, + 0x26986eec, 0x272d93f1, 0x25f394d6, 0x244669cb, 0x6d7f4740, + 0x6ccaba5d, 0x6e14bd7a, 0x6fa14067, 0x6ba8b334, 0x6a1d4e29, + 0x68c3490e, 0x6976b413, 0x60d0afa8, 0x616552b5, 0x63bb5592, + 0x620ea88f, 0x66075bdc, 0x67b2a6c1, 0x656ca1e6, 0x64d95cfb, + 0x76209690, 0x77956b8d, 0x754b6caa, 0x74fe91b7, 0x70f762e4, + 0x71429ff9, 0x739c98de, 0x722965c3, 0x7b8f7e78, 0x7a3a8365, + 0x78e48442, 0x7951795f, 0x7d588a0c, 0x7ced7711, 0x7e337036, + 0x7f868d2b, 0x5bc0e4e0, 0x5a7519fd, 0x58ab1eda, 0x591ee3c7, + 0x5d171094, 0x5ca2ed89, 0x5e7ceaae, 0x5fc917b3, 0x566f0c08, + 0x57daf115, 0x5504f632, 0x54b10b2f, 0x50b8f87c, 0x510d0561, + 0x53d30246, 0x5266ff5b, 0x409f3530, 0x412ac82d, 0x43f4cf0a, + 0x42413217, 0x4648c144, 0x47fd3c59, 0x45233b7e, 0x4496c663, + 0x4d30ddd8, 0x4c8520c5, 0x4e5b27e2, 0x4feedaff, 0x4be729ac, + 0x4a52d4b1, 0x488cd396, 0x49392e8b, 0xdafe8e80, 0xdb4b739d, + 0xd99574ba, 0xd82089a7, 0xdc297af4, 0xdd9c87e9, 0xdf4280ce, + 0xdef77dd3, 0xd7516668, 0xd6e49b75, 0xd43a9c52, 0xd58f614f, + 0xd186921c, 0xd0336f01, 0xd2ed6826, 0xd358953b, 0xc1a15f50, + 0xc014a24d, 0xc2caa56a, 0xc37f5877, 0xc776ab24, 0xc6c35639, + 0xc41d511e, 0xc5a8ac03, 0xcc0eb7b8, 0xcdbb4aa5, 0xcf654d82, + 0xced0b09f, 0xcad943cc, 0xcb6cbed1, 0xc9b2b9f6, 0xc80744eb, + 0xec412d20, 0xedf4d03d, 0xef2ad71a, 0xee9f2a07, 0xea96d954, + 0xeb232449, 0xe9fd236e, 0xe848de73, 0xe1eec5c8, 0xe05b38d5, + 0xe2853ff2, 0xe330c2ef, 0xe73931bc, 0xe68ccca1, 0xe452cb86, + 0xe5e7369b, 0xf71efcf0, 0xf6ab01ed, 0xf47506ca, 0xf5c0fbd7, + 0xf1c90884, 0xf07cf599, 0xf2a2f2be, 0xf3170fa3, 0xfab11418, + 0xfb04e905, 0xf9daee22, 0xf86f133f, 0xfc66e06c, 0xfdd31d71, + 0xff0d1a56, 0xfeb8e74b, 0xb781c9c0, 0xb63434dd, 0xb4ea33fa, + 0xb55fcee7, 0xb1563db4, 0xb0e3c0a9, 0xb23dc78e, 0xb3883a93, + 0xba2e2128, 0xbb9bdc35, 0xb945db12, 0xb8f0260f, 0xbcf9d55c, + 0xbd4c2841, 0xbf922f66, 0xbe27d27b, 0xacde1810, 0xad6be50d, + 0xafb5e22a, 0xae001f37, 0xaa09ec64, 0xabbc1179, 0xa962165e, + 0xa8d7eb43, 0xa171f0f8, 0xa0c40de5, 0xa21a0ac2, 0xa3aff7df, + 0xa7a6048c, 0xa613f991, 0xa4cdfeb6, 0xa57803ab, 0x813e6a60, + 0x808b977d, 0x8255905a, 0x83e06d47, 0x87e99e14, 0x865c6309, + 0x8482642e, 0x85379933, 0x8c918288, 0x8d247f95, 0x8ffa78b2, + 0x8e4f85af, 0x8a4676fc, 0x8bf38be1, 0x892d8cc6, 0x889871db, + 0x9a61bbb0, 0x9bd446ad, 0x990a418a, 0x98bfbc97, 0x9cb64fc4, + 0x9d03b2d9, 0x9fddb5fe, 0x9e6848e3, 0x97ce5358, 0x967bae45, + 0x94a5a962, 0x9510547f, 0x9119a72c, 0x90ac5a31, 0x92725d16, + 0x93c7a00b}, + {0x00000000, 0x6e8c1b41, 0xdd183682, 0xb3942dc3, 0x61416b45, + 0x0fcd7004, 0xbc595dc7, 0xd2d54686, 0xc282d68a, 0xac0ecdcb, + 0x1f9ae008, 0x7116fb49, 0xa3c3bdcf, 0xcd4fa68e, 0x7edb8b4d, + 0x1057900c, 0x5e74ab55, 0x30f8b014, 0x836c9dd7, 0xede08696, + 0x3f35c010, 0x51b9db51, 0xe22df692, 0x8ca1edd3, 0x9cf67ddf, + 0xf27a669e, 0x41ee4b5d, 0x2f62501c, 0xfdb7169a, 0x933b0ddb, + 0x20af2018, 0x4e233b59, 0xbce956aa, 0xd2654deb, 0x61f16028, + 0x0f7d7b69, 0xdda83def, 0xb32426ae, 0x00b00b6d, 0x6e3c102c, + 0x7e6b8020, 0x10e79b61, 0xa373b6a2, 0xcdffade3, 0x1f2aeb65, + 0x71a6f024, 0xc232dde7, 0xacbec6a6, 0xe29dfdff, 0x8c11e6be, + 0x3f85cb7d, 0x5109d03c, 0x83dc96ba, 0xed508dfb, 0x5ec4a038, + 0x3048bb79, 0x201f2b75, 0x4e933034, 0xfd071df7, 0x938b06b6, + 0x415e4030, 0x2fd25b71, 0x9c4676b2, 0xf2ca6df3, 0xa2a3ab15, + 0xcc2fb054, 0x7fbb9d97, 0x113786d6, 0xc3e2c050, 0xad6edb11, + 0x1efaf6d2, 0x7076ed93, 0x60217d9f, 0x0ead66de, 0xbd394b1d, + 0xd3b5505c, 0x016016da, 0x6fec0d9b, 0xdc782058, 0xb2f43b19, + 0xfcd70040, 0x925b1b01, 0x21cf36c2, 0x4f432d83, 0x9d966b05, + 0xf31a7044, 0x408e5d87, 0x2e0246c6, 0x3e55d6ca, 0x50d9cd8b, + 0xe34de048, 0x8dc1fb09, 0x5f14bd8f, 0x3198a6ce, 0x820c8b0d, + 0xec80904c, 0x1e4afdbf, 0x70c6e6fe, 0xc352cb3d, 0xadded07c, + 0x7f0b96fa, 0x11878dbb, 0xa213a078, 0xcc9fbb39, 0xdcc82b35, + 0xb2443074, 0x01d01db7, 0x6f5c06f6, 0xbd894070, 0xd3055b31, + 0x609176f2, 0x0e1d6db3, 0x403e56ea, 0x2eb24dab, 0x9d266068, + 0xf3aa7b29, 0x217f3daf, 0x4ff326ee, 0xfc670b2d, 0x92eb106c, + 0x82bc8060, 0xec309b21, 0x5fa4b6e2, 0x3128ada3, 0xe3fdeb25, + 0x8d71f064, 0x3ee5dda7, 0x5069c6e6, 0x9e36506b, 0xf0ba4b2a, + 0x432e66e9, 0x2da27da8, 0xff773b2e, 0x91fb206f, 0x226f0dac, + 0x4ce316ed, 0x5cb486e1, 0x32389da0, 0x81acb063, 0xef20ab22, + 0x3df5eda4, 0x5379f6e5, 0xe0eddb26, 0x8e61c067, 0xc042fb3e, + 0xaecee07f, 0x1d5acdbc, 0x73d6d6fd, 0xa103907b, 0xcf8f8b3a, + 0x7c1ba6f9, 0x1297bdb8, 0x02c02db4, 0x6c4c36f5, 0xdfd81b36, + 0xb1540077, 0x638146f1, 0x0d0d5db0, 0xbe997073, 0xd0156b32, + 0x22df06c1, 0x4c531d80, 0xffc73043, 0x914b2b02, 0x439e6d84, + 0x2d1276c5, 0x9e865b06, 0xf00a4047, 0xe05dd04b, 0x8ed1cb0a, + 0x3d45e6c9, 0x53c9fd88, 0x811cbb0e, 0xef90a04f, 0x5c048d8c, + 0x328896cd, 0x7cabad94, 0x1227b6d5, 0xa1b39b16, 0xcf3f8057, + 0x1deac6d1, 0x7366dd90, 0xc0f2f053, 0xae7eeb12, 0xbe297b1e, + 0xd0a5605f, 0x63314d9c, 0x0dbd56dd, 0xdf68105b, 0xb1e40b1a, + 0x027026d9, 0x6cfc3d98, 0x3c95fb7e, 0x5219e03f, 0xe18dcdfc, + 0x8f01d6bd, 0x5dd4903b, 0x33588b7a, 0x80cca6b9, 0xee40bdf8, + 0xfe172df4, 0x909b36b5, 0x230f1b76, 0x4d830037, 0x9f5646b1, + 0xf1da5df0, 0x424e7033, 0x2cc26b72, 0x62e1502b, 0x0c6d4b6a, + 0xbff966a9, 0xd1757de8, 0x03a03b6e, 0x6d2c202f, 0xdeb80dec, + 0xb03416ad, 0xa06386a1, 0xceef9de0, 0x7d7bb023, 0x13f7ab62, + 0xc122ede4, 0xafaef6a5, 0x1c3adb66, 0x72b6c027, 0x807cadd4, + 0xeef0b695, 0x5d649b56, 0x33e88017, 0xe13dc691, 0x8fb1ddd0, + 0x3c25f013, 0x52a9eb52, 0x42fe7b5e, 0x2c72601f, 0x9fe64ddc, + 0xf16a569d, 0x23bf101b, 0x4d330b5a, 0xfea72699, 0x902b3dd8, + 0xde080681, 0xb0841dc0, 0x03103003, 0x6d9c2b42, 0xbf496dc4, + 0xd1c57685, 0x62515b46, 0x0cdd4007, 0x1c8ad00b, 0x7206cb4a, + 0xc192e689, 0xaf1efdc8, 0x7dcbbb4e, 0x1347a00f, 0xa0d38dcc, + 0xce5f968d}, + {0x00000000, 0xe71da697, 0x154a4b6f, 0xf257edf8, 0x2a9496de, + 0xcd893049, 0x3fdeddb1, 0xd8c37b26, 0x55292dbc, 0xb2348b2b, + 0x406366d3, 0xa77ec044, 0x7fbdbb62, 0x98a01df5, 0x6af7f00d, + 0x8dea569a, 0xaa525b78, 0x4d4ffdef, 0xbf181017, 0x5805b680, + 0x80c6cda6, 0x67db6b31, 0x958c86c9, 0x7291205e, 0xff7b76c4, + 0x1866d053, 0xea313dab, 0x0d2c9b3c, 0xd5efe01a, 0x32f2468d, + 0xc0a5ab75, 0x27b80de2, 0x8fd5b0b1, 0x68c81626, 0x9a9ffbde, + 0x7d825d49, 0xa541266f, 0x425c80f8, 0xb00b6d00, 0x5716cb97, + 0xdafc9d0d, 0x3de13b9a, 0xcfb6d662, 0x28ab70f5, 0xf0680bd3, + 0x1775ad44, 0xe52240bc, 0x023fe62b, 0x2587ebc9, 0xc29a4d5e, + 0x30cda0a6, 0xd7d00631, 0x0f137d17, 0xe80edb80, 0x1a593678, + 0xfd4490ef, 0x70aec675, 0x97b360e2, 0x65e48d1a, 0x82f92b8d, + 0x5a3a50ab, 0xbd27f63c, 0x4f701bc4, 0xa86dbd53, 0xc4da6723, + 0x23c7c1b4, 0xd1902c4c, 0x368d8adb, 0xee4ef1fd, 0x0953576a, + 0xfb04ba92, 0x1c191c05, 0x91f34a9f, 0x76eeec08, 0x84b901f0, + 0x63a4a767, 0xbb67dc41, 0x5c7a7ad6, 0xae2d972e, 0x493031b9, + 0x6e883c5b, 0x89959acc, 0x7bc27734, 0x9cdfd1a3, 0x441caa85, + 0xa3010c12, 0x5156e1ea, 0xb64b477d, 0x3ba111e7, 0xdcbcb770, + 0x2eeb5a88, 0xc9f6fc1f, 0x11358739, 0xf62821ae, 0x047fcc56, + 0xe3626ac1, 0x4b0fd792, 0xac127105, 0x5e459cfd, 0xb9583a6a, + 0x619b414c, 0x8686e7db, 0x74d10a23, 0x93ccacb4, 0x1e26fa2e, + 0xf93b5cb9, 0x0b6cb141, 0xec7117d6, 0x34b26cf0, 0xd3afca67, + 0x21f8279f, 0xc6e58108, 0xe15d8cea, 0x06402a7d, 0xf417c785, + 0x130a6112, 0xcbc91a34, 0x2cd4bca3, 0xde83515b, 0x399ef7cc, + 0xb474a156, 0x536907c1, 0xa13eea39, 0x46234cae, 0x9ee03788, + 0x79fd911f, 0x8baa7ce7, 0x6cb7da70, 0x52c5c807, 0xb5d86e90, + 0x478f8368, 0xa09225ff, 0x78515ed9, 0x9f4cf84e, 0x6d1b15b6, + 0x8a06b321, 0x07ece5bb, 0xe0f1432c, 0x12a6aed4, 0xf5bb0843, + 0x2d787365, 0xca65d5f2, 0x3832380a, 0xdf2f9e9d, 0xf897937f, + 0x1f8a35e8, 0xedddd810, 0x0ac07e87, 0xd20305a1, 0x351ea336, + 0xc7494ece, 0x2054e859, 0xadbebec3, 0x4aa31854, 0xb8f4f5ac, + 0x5fe9533b, 0x872a281d, 0x60378e8a, 0x92606372, 0x757dc5e5, + 0xdd1078b6, 0x3a0dde21, 0xc85a33d9, 0x2f47954e, 0xf784ee68, + 0x109948ff, 0xe2cea507, 0x05d30390, 0x8839550a, 0x6f24f39d, + 0x9d731e65, 0x7a6eb8f2, 0xa2adc3d4, 0x45b06543, 0xb7e788bb, + 0x50fa2e2c, 0x774223ce, 0x905f8559, 0x620868a1, 0x8515ce36, + 0x5dd6b510, 0xbacb1387, 0x489cfe7f, 0xaf8158e8, 0x226b0e72, + 0xc576a8e5, 0x3721451d, 0xd03ce38a, 0x08ff98ac, 0xefe23e3b, + 0x1db5d3c3, 0xfaa87554, 0x961faf24, 0x710209b3, 0x8355e44b, + 0x644842dc, 0xbc8b39fa, 0x5b969f6d, 0xa9c17295, 0x4edcd402, + 0xc3368298, 0x242b240f, 0xd67cc9f7, 0x31616f60, 0xe9a21446, + 0x0ebfb2d1, 0xfce85f29, 0x1bf5f9be, 0x3c4df45c, 0xdb5052cb, + 0x2907bf33, 0xce1a19a4, 0x16d96282, 0xf1c4c415, 0x039329ed, + 0xe48e8f7a, 0x6964d9e0, 0x8e797f77, 0x7c2e928f, 0x9b333418, + 0x43f04f3e, 0xa4ede9a9, 0x56ba0451, 0xb1a7a2c6, 0x19ca1f95, + 0xfed7b902, 0x0c8054fa, 0xeb9df26d, 0x335e894b, 0xd4432fdc, + 0x2614c224, 0xc10964b3, 0x4ce33229, 0xabfe94be, 0x59a97946, + 0xbeb4dfd1, 0x6677a4f7, 0x816a0260, 0x733def98, 0x9420490f, + 0xb39844ed, 0x5485e27a, 0xa6d20f82, 0x41cfa915, 0x990cd233, + 0x7e1174a4, 0x8c46995c, 0x6b5b3fcb, 0xe6b16951, 0x01accfc6, + 0xf3fb223e, 0x14e684a9, 0xcc25ff8f, 0x2b385918, 0xd96fb4e0, + 0x3e721277}, + {0x00000000, 0xa58b900e, 0x9066265d, 0x35edb653, 0xfbbd4afb, + 0x5e36daf5, 0x6bdb6ca6, 0xce50fca8, 0x2c0b93b7, 0x898003b9, + 0xbc6db5ea, 0x19e625e4, 0xd7b6d94c, 0x723d4942, 0x47d0ff11, + 0xe25b6f1f, 0x5817276e, 0xfd9cb760, 0xc8710133, 0x6dfa913d, + 0xa3aa6d95, 0x0621fd9b, 0x33cc4bc8, 0x9647dbc6, 0x741cb4d9, + 0xd19724d7, 0xe47a9284, 0x41f1028a, 0x8fa1fe22, 0x2a2a6e2c, + 0x1fc7d87f, 0xba4c4871, 0xb02e4edc, 0x15a5ded2, 0x20486881, + 0x85c3f88f, 0x4b930427, 0xee189429, 0xdbf5227a, 0x7e7eb274, + 0x9c25dd6b, 0x39ae4d65, 0x0c43fb36, 0xa9c86b38, 0x67989790, + 0xc213079e, 0xf7feb1cd, 0x527521c3, 0xe83969b2, 0x4db2f9bc, + 0x785f4fef, 0xddd4dfe1, 0x13842349, 0xb60fb347, 0x83e20514, + 0x2669951a, 0xc432fa05, 0x61b96a0b, 0x5454dc58, 0xf1df4c56, + 0x3f8fb0fe, 0x9a0420f0, 0xafe996a3, 0x0a6206ad, 0xbb2d9bf9, + 0x1ea60bf7, 0x2b4bbda4, 0x8ec02daa, 0x4090d102, 0xe51b410c, + 0xd0f6f75f, 0x757d6751, 0x9726084e, 0x32ad9840, 0x07402e13, + 0xa2cbbe1d, 0x6c9b42b5, 0xc910d2bb, 0xfcfd64e8, 0x5976f4e6, + 0xe33abc97, 0x46b12c99, 0x735c9aca, 0xd6d70ac4, 0x1887f66c, + 0xbd0c6662, 0x88e1d031, 0x2d6a403f, 0xcf312f20, 0x6ababf2e, + 0x5f57097d, 0xfadc9973, 0x348c65db, 0x9107f5d5, 0xa4ea4386, + 0x0161d388, 0x0b03d525, 0xae88452b, 0x9b65f378, 0x3eee6376, + 0xf0be9fde, 0x55350fd0, 0x60d8b983, 0xc553298d, 0x27084692, + 0x8283d69c, 0xb76e60cf, 0x12e5f0c1, 0xdcb50c69, 0x793e9c67, + 0x4cd32a34, 0xe958ba3a, 0x5314f24b, 0xf69f6245, 0xc372d416, + 0x66f94418, 0xa8a9b8b0, 0x0d2228be, 0x38cf9eed, 0x9d440ee3, + 0x7f1f61fc, 0xda94f1f2, 0xef7947a1, 0x4af2d7af, 0x84a22b07, + 0x2129bb09, 0x14c40d5a, 0xb14f9d54, 0xad2a31b3, 0x08a1a1bd, + 0x3d4c17ee, 0x98c787e0, 0x56977b48, 0xf31ceb46, 0xc6f15d15, + 0x637acd1b, 0x8121a204, 0x24aa320a, 0x11478459, 0xb4cc1457, + 0x7a9ce8ff, 0xdf1778f1, 0xeafacea2, 0x4f715eac, 0xf53d16dd, + 0x50b686d3, 0x655b3080, 0xc0d0a08e, 0x0e805c26, 0xab0bcc28, + 0x9ee67a7b, 0x3b6dea75, 0xd936856a, 0x7cbd1564, 0x4950a337, + 0xecdb3339, 0x228bcf91, 0x87005f9f, 0xb2ede9cc, 0x176679c2, + 0x1d047f6f, 0xb88fef61, 0x8d625932, 0x28e9c93c, 0xe6b93594, + 0x4332a59a, 0x76df13c9, 0xd35483c7, 0x310fecd8, 0x94847cd6, + 0xa169ca85, 0x04e25a8b, 0xcab2a623, 0x6f39362d, 0x5ad4807e, + 0xff5f1070, 0x45135801, 0xe098c80f, 0xd5757e5c, 0x70feee52, + 0xbeae12fa, 0x1b2582f4, 0x2ec834a7, 0x8b43a4a9, 0x6918cbb6, + 0xcc935bb8, 0xf97eedeb, 0x5cf57de5, 0x92a5814d, 0x372e1143, + 0x02c3a710, 0xa748371e, 0x1607aa4a, 0xb38c3a44, 0x86618c17, + 0x23ea1c19, 0xedbae0b1, 0x483170bf, 0x7ddcc6ec, 0xd85756e2, + 0x3a0c39fd, 0x9f87a9f3, 0xaa6a1fa0, 0x0fe18fae, 0xc1b17306, + 0x643ae308, 0x51d7555b, 0xf45cc555, 0x4e108d24, 0xeb9b1d2a, + 0xde76ab79, 0x7bfd3b77, 0xb5adc7df, 0x102657d1, 0x25cbe182, + 0x8040718c, 0x621b1e93, 0xc7908e9d, 0xf27d38ce, 0x57f6a8c0, + 0x99a65468, 0x3c2dc466, 0x09c07235, 0xac4be23b, 0xa629e496, + 0x03a27498, 0x364fc2cb, 0x93c452c5, 0x5d94ae6d, 0xf81f3e63, + 0xcdf28830, 0x6879183e, 0x8a227721, 0x2fa9e72f, 0x1a44517c, + 0xbfcfc172, 0x719f3dda, 0xd414add4, 0xe1f91b87, 0x44728b89, + 0xfe3ec3f8, 0x5bb553f6, 0x6e58e5a5, 0xcbd375ab, 0x05838903, + 0xa008190d, 0x95e5af5e, 0x306e3f50, 0xd235504f, 0x77bec041, + 0x42537612, 0xe7d8e61c, 0x29881ab4, 0x8c038aba, 0xb9ee3ce9, + 0x1c65ace7}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x0e908ba500000000, 0x5d26669000000000, + 0x53b6ed3500000000, 0xfb4abdfb00000000, 0xf5da365e00000000, + 0xa66cdb6b00000000, 0xa8fc50ce00000000, 0xb7930b2c00000000, + 0xb903808900000000, 0xeab56dbc00000000, 0xe425e61900000000, + 0x4cd9b6d700000000, 0x42493d7200000000, 0x11ffd04700000000, + 0x1f6f5be200000000, 0x6e27175800000000, 0x60b79cfd00000000, + 0x330171c800000000, 0x3d91fa6d00000000, 0x956daaa300000000, + 0x9bfd210600000000, 0xc84bcc3300000000, 0xc6db479600000000, + 0xd9b41c7400000000, 0xd72497d100000000, 0x84927ae400000000, + 0x8a02f14100000000, 0x22fea18f00000000, 0x2c6e2a2a00000000, + 0x7fd8c71f00000000, 0x71484cba00000000, 0xdc4e2eb000000000, + 0xd2dea51500000000, 0x8168482000000000, 0x8ff8c38500000000, + 0x2704934b00000000, 0x299418ee00000000, 0x7a22f5db00000000, + 0x74b27e7e00000000, 0x6bdd259c00000000, 0x654dae3900000000, + 0x36fb430c00000000, 0x386bc8a900000000, 0x9097986700000000, + 0x9e0713c200000000, 0xcdb1fef700000000, 0xc321755200000000, + 0xb26939e800000000, 0xbcf9b24d00000000, 0xef4f5f7800000000, + 0xe1dfd4dd00000000, 0x4923841300000000, 0x47b30fb600000000, + 0x1405e28300000000, 0x1a95692600000000, 0x05fa32c400000000, + 0x0b6ab96100000000, 0x58dc545400000000, 0x564cdff100000000, + 0xfeb08f3f00000000, 0xf020049a00000000, 0xa396e9af00000000, + 0xad06620a00000000, 0xf99b2dbb00000000, 0xf70ba61e00000000, + 0xa4bd4b2b00000000, 0xaa2dc08e00000000, 0x02d1904000000000, + 0x0c411be500000000, 0x5ff7f6d000000000, 0x51677d7500000000, + 0x4e08269700000000, 0x4098ad3200000000, 0x132e400700000000, + 0x1dbecba200000000, 0xb5429b6c00000000, 0xbbd210c900000000, + 0xe864fdfc00000000, 0xe6f4765900000000, 0x97bc3ae300000000, + 0x992cb14600000000, 0xca9a5c7300000000, 0xc40ad7d600000000, + 0x6cf6871800000000, 0x62660cbd00000000, 0x31d0e18800000000, + 0x3f406a2d00000000, 0x202f31cf00000000, 0x2ebfba6a00000000, + 0x7d09575f00000000, 0x7399dcfa00000000, 0xdb658c3400000000, + 0xd5f5079100000000, 0x8643eaa400000000, 0x88d3610100000000, + 0x25d5030b00000000, 0x2b4588ae00000000, 0x78f3659b00000000, + 0x7663ee3e00000000, 0xde9fbef000000000, 0xd00f355500000000, + 0x83b9d86000000000, 0x8d2953c500000000, 0x9246082700000000, + 0x9cd6838200000000, 0xcf606eb700000000, 0xc1f0e51200000000, + 0x690cb5dc00000000, 0x679c3e7900000000, 0x342ad34c00000000, + 0x3aba58e900000000, 0x4bf2145300000000, 0x45629ff600000000, + 0x16d472c300000000, 0x1844f96600000000, 0xb0b8a9a800000000, + 0xbe28220d00000000, 0xed9ecf3800000000, 0xe30e449d00000000, + 0xfc611f7f00000000, 0xf2f194da00000000, 0xa14779ef00000000, + 0xafd7f24a00000000, 0x072ba28400000000, 0x09bb292100000000, + 0x5a0dc41400000000, 0x549d4fb100000000, 0xb3312aad00000000, + 0xbda1a10800000000, 0xee174c3d00000000, 0xe087c79800000000, + 0x487b975600000000, 0x46eb1cf300000000, 0x155df1c600000000, + 0x1bcd7a6300000000, 0x04a2218100000000, 0x0a32aa2400000000, + 0x5984471100000000, 0x5714ccb400000000, 0xffe89c7a00000000, + 0xf17817df00000000, 0xa2cefaea00000000, 0xac5e714f00000000, + 0xdd163df500000000, 0xd386b65000000000, 0x80305b6500000000, + 0x8ea0d0c000000000, 0x265c800e00000000, 0x28cc0bab00000000, + 0x7b7ae69e00000000, 0x75ea6d3b00000000, 0x6a8536d900000000, + 0x6415bd7c00000000, 0x37a3504900000000, 0x3933dbec00000000, + 0x91cf8b2200000000, 0x9f5f008700000000, 0xcce9edb200000000, + 0xc279661700000000, 0x6f7f041d00000000, 0x61ef8fb800000000, + 0x3259628d00000000, 0x3cc9e92800000000, 0x9435b9e600000000, + 0x9aa5324300000000, 0xc913df7600000000, 0xc78354d300000000, + 0xd8ec0f3100000000, 0xd67c849400000000, 0x85ca69a100000000, + 0x8b5ae20400000000, 0x23a6b2ca00000000, 0x2d36396f00000000, + 0x7e80d45a00000000, 0x70105fff00000000, 0x0158134500000000, + 0x0fc898e000000000, 0x5c7e75d500000000, 0x52eefe7000000000, + 0xfa12aebe00000000, 0xf482251b00000000, 0xa734c82e00000000, + 0xa9a4438b00000000, 0xb6cb186900000000, 0xb85b93cc00000000, + 0xebed7ef900000000, 0xe57df55c00000000, 0x4d81a59200000000, + 0x43112e3700000000, 0x10a7c30200000000, 0x1e3748a700000000, + 0x4aaa071600000000, 0x443a8cb300000000, 0x178c618600000000, + 0x191cea2300000000, 0xb1e0baed00000000, 0xbf70314800000000, + 0xecc6dc7d00000000, 0xe25657d800000000, 0xfd390c3a00000000, + 0xf3a9879f00000000, 0xa01f6aaa00000000, 0xae8fe10f00000000, + 0x0673b1c100000000, 0x08e33a6400000000, 0x5b55d75100000000, + 0x55c55cf400000000, 0x248d104e00000000, 0x2a1d9beb00000000, + 0x79ab76de00000000, 0x773bfd7b00000000, 0xdfc7adb500000000, + 0xd157261000000000, 0x82e1cb2500000000, 0x8c71408000000000, + 0x931e1b6200000000, 0x9d8e90c700000000, 0xce387df200000000, + 0xc0a8f65700000000, 0x6854a69900000000, 0x66c42d3c00000000, + 0x3572c00900000000, 0x3be24bac00000000, 0x96e429a600000000, + 0x9874a20300000000, 0xcbc24f3600000000, 0xc552c49300000000, + 0x6dae945d00000000, 0x633e1ff800000000, 0x3088f2cd00000000, + 0x3e18796800000000, 0x2177228a00000000, 0x2fe7a92f00000000, + 0x7c51441a00000000, 0x72c1cfbf00000000, 0xda3d9f7100000000, + 0xd4ad14d400000000, 0x871bf9e100000000, 0x898b724400000000, + 0xf8c33efe00000000, 0xf653b55b00000000, 0xa5e5586e00000000, + 0xab75d3cb00000000, 0x0389830500000000, 0x0d1908a000000000, + 0x5eafe59500000000, 0x503f6e3000000000, 0x4f5035d200000000, + 0x41c0be7700000000, 0x1276534200000000, 0x1ce6d8e700000000, + 0xb41a882900000000, 0xba8a038c00000000, 0xe93ceeb900000000, + 0xe7ac651c00000000}, + {0x0000000000000000, 0x97a61de700000000, 0x6f4b4a1500000000, + 0xf8ed57f200000000, 0xde96942a00000000, 0x493089cd00000000, + 0xb1ddde3f00000000, 0x267bc3d800000000, 0xbc2d295500000000, + 0x2b8b34b200000000, 0xd366634000000000, 0x44c07ea700000000, + 0x62bbbd7f00000000, 0xf51da09800000000, 0x0df0f76a00000000, + 0x9a56ea8d00000000, 0x785b52aa00000000, 0xeffd4f4d00000000, + 0x171018bf00000000, 0x80b6055800000000, 0xa6cdc68000000000, + 0x316bdb6700000000, 0xc9868c9500000000, 0x5e20917200000000, + 0xc4767bff00000000, 0x53d0661800000000, 0xab3d31ea00000000, + 0x3c9b2c0d00000000, 0x1ae0efd500000000, 0x8d46f23200000000, + 0x75aba5c000000000, 0xe20db82700000000, 0xb1b0d58f00000000, + 0x2616c86800000000, 0xdefb9f9a00000000, 0x495d827d00000000, + 0x6f2641a500000000, 0xf8805c4200000000, 0x006d0bb000000000, + 0x97cb165700000000, 0x0d9dfcda00000000, 0x9a3be13d00000000, + 0x62d6b6cf00000000, 0xf570ab2800000000, 0xd30b68f000000000, + 0x44ad751700000000, 0xbc4022e500000000, 0x2be63f0200000000, + 0xc9eb872500000000, 0x5e4d9ac200000000, 0xa6a0cd3000000000, + 0x3106d0d700000000, 0x177d130f00000000, 0x80db0ee800000000, + 0x7836591a00000000, 0xef9044fd00000000, 0x75c6ae7000000000, + 0xe260b39700000000, 0x1a8de46500000000, 0x8d2bf98200000000, + 0xab503a5a00000000, 0x3cf627bd00000000, 0xc41b704f00000000, + 0x53bd6da800000000, 0x2367dac400000000, 0xb4c1c72300000000, + 0x4c2c90d100000000, 0xdb8a8d3600000000, 0xfdf14eee00000000, + 0x6a57530900000000, 0x92ba04fb00000000, 0x051c191c00000000, + 0x9f4af39100000000, 0x08ecee7600000000, 0xf001b98400000000, + 0x67a7a46300000000, 0x41dc67bb00000000, 0xd67a7a5c00000000, + 0x2e972dae00000000, 0xb931304900000000, 0x5b3c886e00000000, + 0xcc9a958900000000, 0x3477c27b00000000, 0xa3d1df9c00000000, + 0x85aa1c4400000000, 0x120c01a300000000, 0xeae1565100000000, + 0x7d474bb600000000, 0xe711a13b00000000, 0x70b7bcdc00000000, + 0x885aeb2e00000000, 0x1ffcf6c900000000, 0x3987351100000000, + 0xae2128f600000000, 0x56cc7f0400000000, 0xc16a62e300000000, + 0x92d70f4b00000000, 0x057112ac00000000, 0xfd9c455e00000000, + 0x6a3a58b900000000, 0x4c419b6100000000, 0xdbe7868600000000, + 0x230ad17400000000, 0xb4accc9300000000, 0x2efa261e00000000, + 0xb95c3bf900000000, 0x41b16c0b00000000, 0xd61771ec00000000, + 0xf06cb23400000000, 0x67caafd300000000, 0x9f27f82100000000, + 0x0881e5c600000000, 0xea8c5de100000000, 0x7d2a400600000000, + 0x85c717f400000000, 0x12610a1300000000, 0x341ac9cb00000000, + 0xa3bcd42c00000000, 0x5b5183de00000000, 0xccf79e3900000000, + 0x56a174b400000000, 0xc107695300000000, 0x39ea3ea100000000, + 0xae4c234600000000, 0x8837e09e00000000, 0x1f91fd7900000000, + 0xe77caa8b00000000, 0x70dab76c00000000, 0x07c8c55200000000, + 0x906ed8b500000000, 0x68838f4700000000, 0xff2592a000000000, + 0xd95e517800000000, 0x4ef84c9f00000000, 0xb6151b6d00000000, + 0x21b3068a00000000, 0xbbe5ec0700000000, 0x2c43f1e000000000, + 0xd4aea61200000000, 0x4308bbf500000000, 0x6573782d00000000, + 0xf2d565ca00000000, 0x0a38323800000000, 0x9d9e2fdf00000000, + 0x7f9397f800000000, 0xe8358a1f00000000, 0x10d8dded00000000, + 0x877ec00a00000000, 0xa10503d200000000, 0x36a31e3500000000, + 0xce4e49c700000000, 0x59e8542000000000, 0xc3bebead00000000, + 0x5418a34a00000000, 0xacf5f4b800000000, 0x3b53e95f00000000, + 0x1d282a8700000000, 0x8a8e376000000000, 0x7263609200000000, + 0xe5c57d7500000000, 0xb67810dd00000000, 0x21de0d3a00000000, + 0xd9335ac800000000, 0x4e95472f00000000, 0x68ee84f700000000, + 0xff48991000000000, 0x07a5cee200000000, 0x9003d30500000000, + 0x0a55398800000000, 0x9df3246f00000000, 0x651e739d00000000, + 0xf2b86e7a00000000, 0xd4c3ada200000000, 0x4365b04500000000, + 0xbb88e7b700000000, 0x2c2efa5000000000, 0xce23427700000000, + 0x59855f9000000000, 0xa168086200000000, 0x36ce158500000000, + 0x10b5d65d00000000, 0x8713cbba00000000, 0x7ffe9c4800000000, + 0xe85881af00000000, 0x720e6b2200000000, 0xe5a876c500000000, + 0x1d45213700000000, 0x8ae33cd000000000, 0xac98ff0800000000, + 0x3b3ee2ef00000000, 0xc3d3b51d00000000, 0x5475a8fa00000000, + 0x24af1f9600000000, 0xb309027100000000, 0x4be4558300000000, + 0xdc42486400000000, 0xfa398bbc00000000, 0x6d9f965b00000000, + 0x9572c1a900000000, 0x02d4dc4e00000000, 0x988236c300000000, + 0x0f242b2400000000, 0xf7c97cd600000000, 0x606f613100000000, + 0x4614a2e900000000, 0xd1b2bf0e00000000, 0x295fe8fc00000000, + 0xbef9f51b00000000, 0x5cf44d3c00000000, 0xcb5250db00000000, + 0x33bf072900000000, 0xa4191ace00000000, 0x8262d91600000000, + 0x15c4c4f100000000, 0xed29930300000000, 0x7a8f8ee400000000, + 0xe0d9646900000000, 0x777f798e00000000, 0x8f922e7c00000000, + 0x1834339b00000000, 0x3e4ff04300000000, 0xa9e9eda400000000, + 0x5104ba5600000000, 0xc6a2a7b100000000, 0x951fca1900000000, + 0x02b9d7fe00000000, 0xfa54800c00000000, 0x6df29deb00000000, + 0x4b895e3300000000, 0xdc2f43d400000000, 0x24c2142600000000, + 0xb36409c100000000, 0x2932e34c00000000, 0xbe94feab00000000, + 0x4679a95900000000, 0xd1dfb4be00000000, 0xf7a4776600000000, + 0x60026a8100000000, 0x98ef3d7300000000, 0x0f49209400000000, + 0xed4498b300000000, 0x7ae2855400000000, 0x820fd2a600000000, + 0x15a9cf4100000000, 0x33d20c9900000000, 0xa474117e00000000, + 0x5c99468c00000000, 0xcb3f5b6b00000000, 0x5169b1e600000000, + 0xc6cfac0100000000, 0x3e22fbf300000000, 0xa984e61400000000, + 0x8fff25cc00000000, 0x1859382b00000000, 0xe0b46fd900000000, + 0x7712723e00000000}, + {0x0000000000000000, 0x411b8c6e00000000, 0x823618dd00000000, + 0xc32d94b300000000, 0x456b416100000000, 0x0470cd0f00000000, + 0xc75d59bc00000000, 0x8646d5d200000000, 0x8ad682c200000000, + 0xcbcd0eac00000000, 0x08e09a1f00000000, 0x49fb167100000000, + 0xcfbdc3a300000000, 0x8ea64fcd00000000, 0x4d8bdb7e00000000, + 0x0c90571000000000, 0x55ab745e00000000, 0x14b0f83000000000, + 0xd79d6c8300000000, 0x9686e0ed00000000, 0x10c0353f00000000, + 0x51dbb95100000000, 0x92f62de200000000, 0xd3eda18c00000000, + 0xdf7df69c00000000, 0x9e667af200000000, 0x5d4bee4100000000, + 0x1c50622f00000000, 0x9a16b7fd00000000, 0xdb0d3b9300000000, + 0x1820af2000000000, 0x593b234e00000000, 0xaa56e9bc00000000, + 0xeb4d65d200000000, 0x2860f16100000000, 0x697b7d0f00000000, + 0xef3da8dd00000000, 0xae2624b300000000, 0x6d0bb00000000000, + 0x2c103c6e00000000, 0x20806b7e00000000, 0x619be71000000000, + 0xa2b673a300000000, 0xe3adffcd00000000, 0x65eb2a1f00000000, + 0x24f0a67100000000, 0xe7dd32c200000000, 0xa6c6beac00000000, + 0xfffd9de200000000, 0xbee6118c00000000, 0x7dcb853f00000000, + 0x3cd0095100000000, 0xba96dc8300000000, 0xfb8d50ed00000000, + 0x38a0c45e00000000, 0x79bb483000000000, 0x752b1f2000000000, + 0x3430934e00000000, 0xf71d07fd00000000, 0xb6068b9300000000, + 0x30405e4100000000, 0x715bd22f00000000, 0xb276469c00000000, + 0xf36dcaf200000000, 0x15aba3a200000000, 0x54b02fcc00000000, + 0x979dbb7f00000000, 0xd686371100000000, 0x50c0e2c300000000, + 0x11db6ead00000000, 0xd2f6fa1e00000000, 0x93ed767000000000, + 0x9f7d216000000000, 0xde66ad0e00000000, 0x1d4b39bd00000000, + 0x5c50b5d300000000, 0xda16600100000000, 0x9b0dec6f00000000, + 0x582078dc00000000, 0x193bf4b200000000, 0x4000d7fc00000000, + 0x011b5b9200000000, 0xc236cf2100000000, 0x832d434f00000000, + 0x056b969d00000000, 0x44701af300000000, 0x875d8e4000000000, + 0xc646022e00000000, 0xcad6553e00000000, 0x8bcdd95000000000, + 0x48e04de300000000, 0x09fbc18d00000000, 0x8fbd145f00000000, + 0xcea6983100000000, 0x0d8b0c8200000000, 0x4c9080ec00000000, + 0xbffd4a1e00000000, 0xfee6c67000000000, 0x3dcb52c300000000, + 0x7cd0dead00000000, 0xfa960b7f00000000, 0xbb8d871100000000, + 0x78a013a200000000, 0x39bb9fcc00000000, 0x352bc8dc00000000, + 0x743044b200000000, 0xb71dd00100000000, 0xf6065c6f00000000, + 0x704089bd00000000, 0x315b05d300000000, 0xf276916000000000, + 0xb36d1d0e00000000, 0xea563e4000000000, 0xab4db22e00000000, + 0x6860269d00000000, 0x297baaf300000000, 0xaf3d7f2100000000, + 0xee26f34f00000000, 0x2d0b67fc00000000, 0x6c10eb9200000000, + 0x6080bc8200000000, 0x219b30ec00000000, 0xe2b6a45f00000000, + 0xa3ad283100000000, 0x25ebfde300000000, 0x64f0718d00000000, + 0xa7dde53e00000000, 0xe6c6695000000000, 0x6b50369e00000000, + 0x2a4bbaf000000000, 0xe9662e4300000000, 0xa87da22d00000000, + 0x2e3b77ff00000000, 0x6f20fb9100000000, 0xac0d6f2200000000, + 0xed16e34c00000000, 0xe186b45c00000000, 0xa09d383200000000, + 0x63b0ac8100000000, 0x22ab20ef00000000, 0xa4edf53d00000000, + 0xe5f6795300000000, 0x26dbede000000000, 0x67c0618e00000000, + 0x3efb42c000000000, 0x7fe0ceae00000000, 0xbccd5a1d00000000, + 0xfdd6d67300000000, 0x7b9003a100000000, 0x3a8b8fcf00000000, + 0xf9a61b7c00000000, 0xb8bd971200000000, 0xb42dc00200000000, + 0xf5364c6c00000000, 0x361bd8df00000000, 0x770054b100000000, + 0xf146816300000000, 0xb05d0d0d00000000, 0x737099be00000000, + 0x326b15d000000000, 0xc106df2200000000, 0x801d534c00000000, + 0x4330c7ff00000000, 0x022b4b9100000000, 0x846d9e4300000000, + 0xc576122d00000000, 0x065b869e00000000, 0x47400af000000000, + 0x4bd05de000000000, 0x0acbd18e00000000, 0xc9e6453d00000000, + 0x88fdc95300000000, 0x0ebb1c8100000000, 0x4fa090ef00000000, + 0x8c8d045c00000000, 0xcd96883200000000, 0x94adab7c00000000, + 0xd5b6271200000000, 0x169bb3a100000000, 0x57803fcf00000000, + 0xd1c6ea1d00000000, 0x90dd667300000000, 0x53f0f2c000000000, + 0x12eb7eae00000000, 0x1e7b29be00000000, 0x5f60a5d000000000, + 0x9c4d316300000000, 0xdd56bd0d00000000, 0x5b1068df00000000, + 0x1a0be4b100000000, 0xd926700200000000, 0x983dfc6c00000000, + 0x7efb953c00000000, 0x3fe0195200000000, 0xfccd8de100000000, + 0xbdd6018f00000000, 0x3b90d45d00000000, 0x7a8b583300000000, + 0xb9a6cc8000000000, 0xf8bd40ee00000000, 0xf42d17fe00000000, + 0xb5369b9000000000, 0x761b0f2300000000, 0x3700834d00000000, + 0xb146569f00000000, 0xf05ddaf100000000, 0x33704e4200000000, + 0x726bc22c00000000, 0x2b50e16200000000, 0x6a4b6d0c00000000, + 0xa966f9bf00000000, 0xe87d75d100000000, 0x6e3ba00300000000, + 0x2f202c6d00000000, 0xec0db8de00000000, 0xad1634b000000000, + 0xa18663a000000000, 0xe09defce00000000, 0x23b07b7d00000000, + 0x62abf71300000000, 0xe4ed22c100000000, 0xa5f6aeaf00000000, + 0x66db3a1c00000000, 0x27c0b67200000000, 0xd4ad7c8000000000, + 0x95b6f0ee00000000, 0x569b645d00000000, 0x1780e83300000000, + 0x91c63de100000000, 0xd0ddb18f00000000, 0x13f0253c00000000, + 0x52eba95200000000, 0x5e7bfe4200000000, 0x1f60722c00000000, + 0xdc4de69f00000000, 0x9d566af100000000, 0x1b10bf2300000000, + 0x5a0b334d00000000, 0x9926a7fe00000000, 0xd83d2b9000000000, + 0x810608de00000000, 0xc01d84b000000000, 0x0330100300000000, + 0x422b9c6d00000000, 0xc46d49bf00000000, 0x8576c5d100000000, + 0x465b516200000000, 0x0740dd0c00000000, 0x0bd08a1c00000000, + 0x4acb067200000000, 0x89e692c100000000, 0xc8fd1eaf00000000, + 0x4ebbcb7d00000000, 0x0fa0471300000000, 0xcc8dd3a000000000, + 0x8d965fce00000000}, + {0x0000000000000000, 0x1dfdb50100000000, 0x3afa6b0300000000, + 0x2707de0200000000, 0x74f4d70600000000, 0x6909620700000000, + 0x4e0ebc0500000000, 0x53f3090400000000, 0xe8e8af0d00000000, + 0xf5151a0c00000000, 0xd212c40e00000000, 0xcfef710f00000000, + 0x9c1c780b00000000, 0x81e1cd0a00000000, 0xa6e6130800000000, + 0xbb1ba60900000000, 0xd0d15f1b00000000, 0xcd2cea1a00000000, + 0xea2b341800000000, 0xf7d6811900000000, 0xa425881d00000000, + 0xb9d83d1c00000000, 0x9edfe31e00000000, 0x8322561f00000000, + 0x3839f01600000000, 0x25c4451700000000, 0x02c39b1500000000, + 0x1f3e2e1400000000, 0x4ccd271000000000, 0x5130921100000000, + 0x76374c1300000000, 0x6bcaf91200000000, 0xa0a3bf3600000000, + 0xbd5e0a3700000000, 0x9a59d43500000000, 0x87a4613400000000, + 0xd457683000000000, 0xc9aadd3100000000, 0xeead033300000000, + 0xf350b63200000000, 0x484b103b00000000, 0x55b6a53a00000000, + 0x72b17b3800000000, 0x6f4cce3900000000, 0x3cbfc73d00000000, + 0x2142723c00000000, 0x0645ac3e00000000, 0x1bb8193f00000000, + 0x7072e02d00000000, 0x6d8f552c00000000, 0x4a888b2e00000000, + 0x57753e2f00000000, 0x0486372b00000000, 0x197b822a00000000, + 0x3e7c5c2800000000, 0x2381e92900000000, 0x989a4f2000000000, + 0x8567fa2100000000, 0xa260242300000000, 0xbf9d912200000000, + 0xec6e982600000000, 0xf1932d2700000000, 0xd694f32500000000, + 0xcb69462400000000, 0x40477f6d00000000, 0x5dbaca6c00000000, + 0x7abd146e00000000, 0x6740a16f00000000, 0x34b3a86b00000000, + 0x294e1d6a00000000, 0x0e49c36800000000, 0x13b4766900000000, + 0xa8afd06000000000, 0xb552656100000000, 0x9255bb6300000000, + 0x8fa80e6200000000, 0xdc5b076600000000, 0xc1a6b26700000000, + 0xe6a16c6500000000, 0xfb5cd96400000000, 0x9096207600000000, + 0x8d6b957700000000, 0xaa6c4b7500000000, 0xb791fe7400000000, + 0xe462f77000000000, 0xf99f427100000000, 0xde989c7300000000, + 0xc365297200000000, 0x787e8f7b00000000, 0x65833a7a00000000, + 0x4284e47800000000, 0x5f79517900000000, 0x0c8a587d00000000, + 0x1177ed7c00000000, 0x3670337e00000000, 0x2b8d867f00000000, + 0xe0e4c05b00000000, 0xfd19755a00000000, 0xda1eab5800000000, + 0xc7e31e5900000000, 0x9410175d00000000, 0x89eda25c00000000, + 0xaeea7c5e00000000, 0xb317c95f00000000, 0x080c6f5600000000, + 0x15f1da5700000000, 0x32f6045500000000, 0x2f0bb15400000000, + 0x7cf8b85000000000, 0x61050d5100000000, 0x4602d35300000000, + 0x5bff665200000000, 0x30359f4000000000, 0x2dc82a4100000000, + 0x0acff44300000000, 0x1732414200000000, 0x44c1484600000000, + 0x593cfd4700000000, 0x7e3b234500000000, 0x63c6964400000000, + 0xd8dd304d00000000, 0xc520854c00000000, 0xe2275b4e00000000, + 0xffdaee4f00000000, 0xac29e74b00000000, 0xb1d4524a00000000, + 0x96d38c4800000000, 0x8b2e394900000000, 0x808efeda00000000, + 0x9d734bdb00000000, 0xba7495d900000000, 0xa78920d800000000, + 0xf47a29dc00000000, 0xe9879cdd00000000, 0xce8042df00000000, + 0xd37df7de00000000, 0x686651d700000000, 0x759be4d600000000, + 0x529c3ad400000000, 0x4f618fd500000000, 0x1c9286d100000000, + 0x016f33d000000000, 0x2668edd200000000, 0x3b9558d300000000, + 0x505fa1c100000000, 0x4da214c000000000, 0x6aa5cac200000000, + 0x77587fc300000000, 0x24ab76c700000000, 0x3956c3c600000000, + 0x1e511dc400000000, 0x03aca8c500000000, 0xb8b70ecc00000000, + 0xa54abbcd00000000, 0x824d65cf00000000, 0x9fb0d0ce00000000, + 0xcc43d9ca00000000, 0xd1be6ccb00000000, 0xf6b9b2c900000000, + 0xeb4407c800000000, 0x202d41ec00000000, 0x3dd0f4ed00000000, + 0x1ad72aef00000000, 0x072a9fee00000000, 0x54d996ea00000000, + 0x492423eb00000000, 0x6e23fde900000000, 0x73de48e800000000, + 0xc8c5eee100000000, 0xd5385be000000000, 0xf23f85e200000000, + 0xefc230e300000000, 0xbc3139e700000000, 0xa1cc8ce600000000, + 0x86cb52e400000000, 0x9b36e7e500000000, 0xf0fc1ef700000000, + 0xed01abf600000000, 0xca0675f400000000, 0xd7fbc0f500000000, + 0x8408c9f100000000, 0x99f57cf000000000, 0xbef2a2f200000000, + 0xa30f17f300000000, 0x1814b1fa00000000, 0x05e904fb00000000, + 0x22eedaf900000000, 0x3f136ff800000000, 0x6ce066fc00000000, + 0x711dd3fd00000000, 0x561a0dff00000000, 0x4be7b8fe00000000, + 0xc0c981b700000000, 0xdd3434b600000000, 0xfa33eab400000000, + 0xe7ce5fb500000000, 0xb43d56b100000000, 0xa9c0e3b000000000, + 0x8ec73db200000000, 0x933a88b300000000, 0x28212eba00000000, + 0x35dc9bbb00000000, 0x12db45b900000000, 0x0f26f0b800000000, + 0x5cd5f9bc00000000, 0x41284cbd00000000, 0x662f92bf00000000, + 0x7bd227be00000000, 0x1018deac00000000, 0x0de56bad00000000, + 0x2ae2b5af00000000, 0x371f00ae00000000, 0x64ec09aa00000000, + 0x7911bcab00000000, 0x5e1662a900000000, 0x43ebd7a800000000, + 0xf8f071a100000000, 0xe50dc4a000000000, 0xc20a1aa200000000, + 0xdff7afa300000000, 0x8c04a6a700000000, 0x91f913a600000000, + 0xb6fecda400000000, 0xab0378a500000000, 0x606a3e8100000000, + 0x7d978b8000000000, 0x5a90558200000000, 0x476de08300000000, + 0x149ee98700000000, 0x09635c8600000000, 0x2e64828400000000, + 0x3399378500000000, 0x8882918c00000000, 0x957f248d00000000, + 0xb278fa8f00000000, 0xaf854f8e00000000, 0xfc76468a00000000, + 0xe18bf38b00000000, 0xc68c2d8900000000, 0xdb71988800000000, + 0xb0bb619a00000000, 0xad46d49b00000000, 0x8a410a9900000000, + 0x97bcbf9800000000, 0xc44fb69c00000000, 0xd9b2039d00000000, + 0xfeb5dd9f00000000, 0xe348689e00000000, 0x5853ce9700000000, + 0x45ae7b9600000000, 0x62a9a59400000000, 0x7f54109500000000, + 0x2ca7199100000000, 0x315aac9000000000, 0x165d729200000000, + 0x0ba0c79300000000}, + {0x0000000000000000, 0x24d9076300000000, 0x48b20fc600000000, + 0x6c6b08a500000000, 0xd1626e5700000000, 0xf5bb693400000000, + 0x99d0619100000000, 0xbd0966f200000000, 0xa2c5dcae00000000, + 0x861cdbcd00000000, 0xea77d36800000000, 0xceaed40b00000000, + 0x73a7b2f900000000, 0x577eb59a00000000, 0x3b15bd3f00000000, + 0x1fccba5c00000000, 0x058dc88600000000, 0x2154cfe500000000, + 0x4d3fc74000000000, 0x69e6c02300000000, 0xd4efa6d100000000, + 0xf036a1b200000000, 0x9c5da91700000000, 0xb884ae7400000000, + 0xa748142800000000, 0x8391134b00000000, 0xeffa1bee00000000, + 0xcb231c8d00000000, 0x762a7a7f00000000, 0x52f37d1c00000000, + 0x3e9875b900000000, 0x1a4172da00000000, 0x4b1ce0d600000000, + 0x6fc5e7b500000000, 0x03aeef1000000000, 0x2777e87300000000, + 0x9a7e8e8100000000, 0xbea789e200000000, 0xd2cc814700000000, + 0xf615862400000000, 0xe9d93c7800000000, 0xcd003b1b00000000, + 0xa16b33be00000000, 0x85b234dd00000000, 0x38bb522f00000000, + 0x1c62554c00000000, 0x70095de900000000, 0x54d05a8a00000000, + 0x4e91285000000000, 0x6a482f3300000000, 0x0623279600000000, + 0x22fa20f500000000, 0x9ff3460700000000, 0xbb2a416400000000, + 0xd74149c100000000, 0xf3984ea200000000, 0xec54f4fe00000000, + 0xc88df39d00000000, 0xa4e6fb3800000000, 0x803ffc5b00000000, + 0x3d369aa900000000, 0x19ef9dca00000000, 0x7584956f00000000, + 0x515d920c00000000, 0xd73eb17600000000, 0xf3e7b61500000000, + 0x9f8cbeb000000000, 0xbb55b9d300000000, 0x065cdf2100000000, + 0x2285d84200000000, 0x4eeed0e700000000, 0x6a37d78400000000, + 0x75fb6dd800000000, 0x51226abb00000000, 0x3d49621e00000000, + 0x1990657d00000000, 0xa499038f00000000, 0x804004ec00000000, + 0xec2b0c4900000000, 0xc8f20b2a00000000, 0xd2b379f000000000, + 0xf66a7e9300000000, 0x9a01763600000000, 0xbed8715500000000, + 0x03d117a700000000, 0x270810c400000000, 0x4b63186100000000, + 0x6fba1f0200000000, 0x7076a55e00000000, 0x54afa23d00000000, + 0x38c4aa9800000000, 0x1c1dadfb00000000, 0xa114cb0900000000, + 0x85cdcc6a00000000, 0xe9a6c4cf00000000, 0xcd7fc3ac00000000, + 0x9c2251a000000000, 0xb8fb56c300000000, 0xd4905e6600000000, + 0xf049590500000000, 0x4d403ff700000000, 0x6999389400000000, + 0x05f2303100000000, 0x212b375200000000, 0x3ee78d0e00000000, + 0x1a3e8a6d00000000, 0x765582c800000000, 0x528c85ab00000000, + 0xef85e35900000000, 0xcb5ce43a00000000, 0xa737ec9f00000000, + 0x83eeebfc00000000, 0x99af992600000000, 0xbd769e4500000000, + 0xd11d96e000000000, 0xf5c4918300000000, 0x48cdf77100000000, + 0x6c14f01200000000, 0x007ff8b700000000, 0x24a6ffd400000000, + 0x3b6a458800000000, 0x1fb342eb00000000, 0x73d84a4e00000000, + 0x57014d2d00000000, 0xea082bdf00000000, 0xced12cbc00000000, + 0xa2ba241900000000, 0x8663237a00000000, 0xae7d62ed00000000, + 0x8aa4658e00000000, 0xe6cf6d2b00000000, 0xc2166a4800000000, + 0x7f1f0cba00000000, 0x5bc60bd900000000, 0x37ad037c00000000, + 0x1374041f00000000, 0x0cb8be4300000000, 0x2861b92000000000, + 0x440ab18500000000, 0x60d3b6e600000000, 0xdddad01400000000, + 0xf903d77700000000, 0x9568dfd200000000, 0xb1b1d8b100000000, + 0xabf0aa6b00000000, 0x8f29ad0800000000, 0xe342a5ad00000000, + 0xc79ba2ce00000000, 0x7a92c43c00000000, 0x5e4bc35f00000000, + 0x3220cbfa00000000, 0x16f9cc9900000000, 0x093576c500000000, + 0x2dec71a600000000, 0x4187790300000000, 0x655e7e6000000000, + 0xd857189200000000, 0xfc8e1ff100000000, 0x90e5175400000000, + 0xb43c103700000000, 0xe561823b00000000, 0xc1b8855800000000, + 0xadd38dfd00000000, 0x890a8a9e00000000, 0x3403ec6c00000000, + 0x10daeb0f00000000, 0x7cb1e3aa00000000, 0x5868e4c900000000, + 0x47a45e9500000000, 0x637d59f600000000, 0x0f16515300000000, + 0x2bcf563000000000, 0x96c630c200000000, 0xb21f37a100000000, + 0xde743f0400000000, 0xfaad386700000000, 0xe0ec4abd00000000, + 0xc4354dde00000000, 0xa85e457b00000000, 0x8c87421800000000, + 0x318e24ea00000000, 0x1557238900000000, 0x793c2b2c00000000, + 0x5de52c4f00000000, 0x4229961300000000, 0x66f0917000000000, + 0x0a9b99d500000000, 0x2e429eb600000000, 0x934bf84400000000, + 0xb792ff2700000000, 0xdbf9f78200000000, 0xff20f0e100000000, + 0x7943d39b00000000, 0x5d9ad4f800000000, 0x31f1dc5d00000000, + 0x1528db3e00000000, 0xa821bdcc00000000, 0x8cf8baaf00000000, + 0xe093b20a00000000, 0xc44ab56900000000, 0xdb860f3500000000, + 0xff5f085600000000, 0x933400f300000000, 0xb7ed079000000000, + 0x0ae4616200000000, 0x2e3d660100000000, 0x42566ea400000000, + 0x668f69c700000000, 0x7cce1b1d00000000, 0x58171c7e00000000, + 0x347c14db00000000, 0x10a513b800000000, 0xadac754a00000000, + 0x8975722900000000, 0xe51e7a8c00000000, 0xc1c77def00000000, + 0xde0bc7b300000000, 0xfad2c0d000000000, 0x96b9c87500000000, + 0xb260cf1600000000, 0x0f69a9e400000000, 0x2bb0ae8700000000, + 0x47dba62200000000, 0x6302a14100000000, 0x325f334d00000000, + 0x1686342e00000000, 0x7aed3c8b00000000, 0x5e343be800000000, + 0xe33d5d1a00000000, 0xc7e45a7900000000, 0xab8f52dc00000000, + 0x8f5655bf00000000, 0x909aefe300000000, 0xb443e88000000000, + 0xd828e02500000000, 0xfcf1e74600000000, 0x41f881b400000000, + 0x652186d700000000, 0x094a8e7200000000, 0x2d93891100000000, + 0x37d2fbcb00000000, 0x130bfca800000000, 0x7f60f40d00000000, + 0x5bb9f36e00000000, 0xe6b0959c00000000, 0xc26992ff00000000, + 0xae029a5a00000000, 0x8adb9d3900000000, 0x9517276500000000, + 0xb1ce200600000000, 0xdda528a300000000, 0xf97c2fc000000000, + 0x4475493200000000, 0x60ac4e5100000000, 0x0cc746f400000000, + 0x281e419700000000}, + {0x0000000000000000, 0x08e3603c00000000, 0x10c6c17800000000, + 0x1825a14400000000, 0x208c83f100000000, 0x286fe3cd00000000, + 0x304a428900000000, 0x38a922b500000000, 0x011e763800000000, + 0x09fd160400000000, 0x11d8b74000000000, 0x193bd77c00000000, + 0x2192f5c900000000, 0x297195f500000000, 0x315434b100000000, + 0x39b7548d00000000, 0x023cec7000000000, 0x0adf8c4c00000000, + 0x12fa2d0800000000, 0x1a194d3400000000, 0x22b06f8100000000, + 0x2a530fbd00000000, 0x3276aef900000000, 0x3a95cec500000000, + 0x03229a4800000000, 0x0bc1fa7400000000, 0x13e45b3000000000, + 0x1b073b0c00000000, 0x23ae19b900000000, 0x2b4d798500000000, + 0x3368d8c100000000, 0x3b8bb8fd00000000, 0x0478d8e100000000, + 0x0c9bb8dd00000000, 0x14be199900000000, 0x1c5d79a500000000, + 0x24f45b1000000000, 0x2c173b2c00000000, 0x34329a6800000000, + 0x3cd1fa5400000000, 0x0566aed900000000, 0x0d85cee500000000, + 0x15a06fa100000000, 0x1d430f9d00000000, 0x25ea2d2800000000, + 0x2d094d1400000000, 0x352cec5000000000, 0x3dcf8c6c00000000, + 0x0644349100000000, 0x0ea754ad00000000, 0x1682f5e900000000, + 0x1e6195d500000000, 0x26c8b76000000000, 0x2e2bd75c00000000, + 0x360e761800000000, 0x3eed162400000000, 0x075a42a900000000, + 0x0fb9229500000000, 0x179c83d100000000, 0x1f7fe3ed00000000, + 0x27d6c15800000000, 0x2f35a16400000000, 0x3710002000000000, + 0x3ff3601c00000000, 0x49f6c11800000000, 0x4115a12400000000, + 0x5930006000000000, 0x51d3605c00000000, 0x697a42e900000000, + 0x619922d500000000, 0x79bc839100000000, 0x715fe3ad00000000, + 0x48e8b72000000000, 0x400bd71c00000000, 0x582e765800000000, + 0x50cd166400000000, 0x686434d100000000, 0x608754ed00000000, + 0x78a2f5a900000000, 0x7041959500000000, 0x4bca2d6800000000, + 0x43294d5400000000, 0x5b0cec1000000000, 0x53ef8c2c00000000, + 0x6b46ae9900000000, 0x63a5cea500000000, 0x7b806fe100000000, + 0x73630fdd00000000, 0x4ad45b5000000000, 0x42373b6c00000000, + 0x5a129a2800000000, 0x52f1fa1400000000, 0x6a58d8a100000000, + 0x62bbb89d00000000, 0x7a9e19d900000000, 0x727d79e500000000, + 0x4d8e19f900000000, 0x456d79c500000000, 0x5d48d88100000000, + 0x55abb8bd00000000, 0x6d029a0800000000, 0x65e1fa3400000000, + 0x7dc45b7000000000, 0x75273b4c00000000, 0x4c906fc100000000, + 0x44730ffd00000000, 0x5c56aeb900000000, 0x54b5ce8500000000, + 0x6c1cec3000000000, 0x64ff8c0c00000000, 0x7cda2d4800000000, + 0x74394d7400000000, 0x4fb2f58900000000, 0x475195b500000000, + 0x5f7434f100000000, 0x579754cd00000000, 0x6f3e767800000000, + 0x67dd164400000000, 0x7ff8b70000000000, 0x771bd73c00000000, + 0x4eac83b100000000, 0x464fe38d00000000, 0x5e6a42c900000000, + 0x568922f500000000, 0x6e20004000000000, 0x66c3607c00000000, + 0x7ee6c13800000000, 0x7605a10400000000, 0x92ec833100000000, + 0x9a0fe30d00000000, 0x822a424900000000, 0x8ac9227500000000, + 0xb26000c000000000, 0xba8360fc00000000, 0xa2a6c1b800000000, + 0xaa45a18400000000, 0x93f2f50900000000, 0x9b11953500000000, + 0x8334347100000000, 0x8bd7544d00000000, 0xb37e76f800000000, + 0xbb9d16c400000000, 0xa3b8b78000000000, 0xab5bd7bc00000000, + 0x90d06f4100000000, 0x98330f7d00000000, 0x8016ae3900000000, + 0x88f5ce0500000000, 0xb05cecb000000000, 0xb8bf8c8c00000000, + 0xa09a2dc800000000, 0xa8794df400000000, 0x91ce197900000000, + 0x992d794500000000, 0x8108d80100000000, 0x89ebb83d00000000, + 0xb1429a8800000000, 0xb9a1fab400000000, 0xa1845bf000000000, + 0xa9673bcc00000000, 0x96945bd000000000, 0x9e773bec00000000, + 0x86529aa800000000, 0x8eb1fa9400000000, 0xb618d82100000000, + 0xbefbb81d00000000, 0xa6de195900000000, 0xae3d796500000000, + 0x978a2de800000000, 0x9f694dd400000000, 0x874cec9000000000, + 0x8faf8cac00000000, 0xb706ae1900000000, 0xbfe5ce2500000000, + 0xa7c06f6100000000, 0xaf230f5d00000000, 0x94a8b7a000000000, + 0x9c4bd79c00000000, 0x846e76d800000000, 0x8c8d16e400000000, + 0xb424345100000000, 0xbcc7546d00000000, 0xa4e2f52900000000, + 0xac01951500000000, 0x95b6c19800000000, 0x9d55a1a400000000, + 0x857000e000000000, 0x8d9360dc00000000, 0xb53a426900000000, + 0xbdd9225500000000, 0xa5fc831100000000, 0xad1fe32d00000000, + 0xdb1a422900000000, 0xd3f9221500000000, 0xcbdc835100000000, + 0xc33fe36d00000000, 0xfb96c1d800000000, 0xf375a1e400000000, + 0xeb5000a000000000, 0xe3b3609c00000000, 0xda04341100000000, + 0xd2e7542d00000000, 0xcac2f56900000000, 0xc221955500000000, + 0xfa88b7e000000000, 0xf26bd7dc00000000, 0xea4e769800000000, + 0xe2ad16a400000000, 0xd926ae5900000000, 0xd1c5ce6500000000, + 0xc9e06f2100000000, 0xc1030f1d00000000, 0xf9aa2da800000000, + 0xf1494d9400000000, 0xe96cecd000000000, 0xe18f8cec00000000, + 0xd838d86100000000, 0xd0dbb85d00000000, 0xc8fe191900000000, + 0xc01d792500000000, 0xf8b45b9000000000, 0xf0573bac00000000, + 0xe8729ae800000000, 0xe091fad400000000, 0xdf629ac800000000, + 0xd781faf400000000, 0xcfa45bb000000000, 0xc7473b8c00000000, + 0xffee193900000000, 0xf70d790500000000, 0xef28d84100000000, + 0xe7cbb87d00000000, 0xde7cecf000000000, 0xd69f8ccc00000000, + 0xceba2d8800000000, 0xc6594db400000000, 0xfef06f0100000000, + 0xf6130f3d00000000, 0xee36ae7900000000, 0xe6d5ce4500000000, + 0xdd5e76b800000000, 0xd5bd168400000000, 0xcd98b7c000000000, + 0xc57bd7fc00000000, 0xfdd2f54900000000, 0xf531957500000000, + 0xed14343100000000, 0xe5f7540d00000000, 0xdc40008000000000, + 0xd4a360bc00000000, 0xcc86c1f800000000, 0xc465a1c400000000, + 0xfccc837100000000, 0xf42fe34d00000000, 0xec0a420900000000, + 0xe4e9223500000000}, + {0x0000000000000000, 0xd1e8e70e00000000, 0xa2d1cf1d00000000, + 0x7339281300000000, 0x44a39f3b00000000, 0x954b783500000000, + 0xe672502600000000, 0x379ab72800000000, 0x88463f7700000000, + 0x59aed87900000000, 0x2a97f06a00000000, 0xfb7f176400000000, + 0xcce5a04c00000000, 0x1d0d474200000000, 0x6e346f5100000000, + 0xbfdc885f00000000, 0x108d7eee00000000, 0xc16599e000000000, + 0xb25cb1f300000000, 0x63b456fd00000000, 0x542ee1d500000000, + 0x85c606db00000000, 0xf6ff2ec800000000, 0x2717c9c600000000, + 0x98cb419900000000, 0x4923a69700000000, 0x3a1a8e8400000000, + 0xebf2698a00000000, 0xdc68dea200000000, 0x0d8039ac00000000, + 0x7eb911bf00000000, 0xaf51f6b100000000, 0x611c8c0700000000, + 0xb0f46b0900000000, 0xc3cd431a00000000, 0x1225a41400000000, + 0x25bf133c00000000, 0xf457f43200000000, 0x876edc2100000000, + 0x56863b2f00000000, 0xe95ab37000000000, 0x38b2547e00000000, + 0x4b8b7c6d00000000, 0x9a639b6300000000, 0xadf92c4b00000000, + 0x7c11cb4500000000, 0x0f28e35600000000, 0xdec0045800000000, + 0x7191f2e900000000, 0xa07915e700000000, 0xd3403df400000000, + 0x02a8dafa00000000, 0x35326dd200000000, 0xe4da8adc00000000, + 0x97e3a2cf00000000, 0x460b45c100000000, 0xf9d7cd9e00000000, + 0x283f2a9000000000, 0x5b06028300000000, 0x8aeee58d00000000, + 0xbd7452a500000000, 0x6c9cb5ab00000000, 0x1fa59db800000000, + 0xce4d7ab600000000, 0xc238180f00000000, 0x13d0ff0100000000, + 0x60e9d71200000000, 0xb101301c00000000, 0x869b873400000000, + 0x5773603a00000000, 0x244a482900000000, 0xf5a2af2700000000, + 0x4a7e277800000000, 0x9b96c07600000000, 0xe8afe86500000000, + 0x39470f6b00000000, 0x0eddb84300000000, 0xdf355f4d00000000, + 0xac0c775e00000000, 0x7de4905000000000, 0xd2b566e100000000, + 0x035d81ef00000000, 0x7064a9fc00000000, 0xa18c4ef200000000, + 0x9616f9da00000000, 0x47fe1ed400000000, 0x34c736c700000000, + 0xe52fd1c900000000, 0x5af3599600000000, 0x8b1bbe9800000000, + 0xf822968b00000000, 0x29ca718500000000, 0x1e50c6ad00000000, + 0xcfb821a300000000, 0xbc8109b000000000, 0x6d69eebe00000000, + 0xa324940800000000, 0x72cc730600000000, 0x01f55b1500000000, + 0xd01dbc1b00000000, 0xe7870b3300000000, 0x366fec3d00000000, + 0x4556c42e00000000, 0x94be232000000000, 0x2b62ab7f00000000, + 0xfa8a4c7100000000, 0x89b3646200000000, 0x585b836c00000000, + 0x6fc1344400000000, 0xbe29d34a00000000, 0xcd10fb5900000000, + 0x1cf81c5700000000, 0xb3a9eae600000000, 0x62410de800000000, + 0x117825fb00000000, 0xc090c2f500000000, 0xf70a75dd00000000, + 0x26e292d300000000, 0x55dbbac000000000, 0x84335dce00000000, + 0x3befd59100000000, 0xea07329f00000000, 0x993e1a8c00000000, + 0x48d6fd8200000000, 0x7f4c4aaa00000000, 0xaea4ada400000000, + 0xdd9d85b700000000, 0x0c7562b900000000, 0x8471301e00000000, + 0x5599d71000000000, 0x26a0ff0300000000, 0xf748180d00000000, + 0xc0d2af2500000000, 0x113a482b00000000, 0x6203603800000000, + 0xb3eb873600000000, 0x0c370f6900000000, 0xdddfe86700000000, + 0xaee6c07400000000, 0x7f0e277a00000000, 0x4894905200000000, + 0x997c775c00000000, 0xea455f4f00000000, 0x3badb84100000000, + 0x94fc4ef000000000, 0x4514a9fe00000000, 0x362d81ed00000000, + 0xe7c566e300000000, 0xd05fd1cb00000000, 0x01b736c500000000, + 0x728e1ed600000000, 0xa366f9d800000000, 0x1cba718700000000, + 0xcd52968900000000, 0xbe6bbe9a00000000, 0x6f83599400000000, + 0x5819eebc00000000, 0x89f109b200000000, 0xfac821a100000000, + 0x2b20c6af00000000, 0xe56dbc1900000000, 0x34855b1700000000, + 0x47bc730400000000, 0x9654940a00000000, 0xa1ce232200000000, + 0x7026c42c00000000, 0x031fec3f00000000, 0xd2f70b3100000000, + 0x6d2b836e00000000, 0xbcc3646000000000, 0xcffa4c7300000000, + 0x1e12ab7d00000000, 0x29881c5500000000, 0xf860fb5b00000000, + 0x8b59d34800000000, 0x5ab1344600000000, 0xf5e0c2f700000000, + 0x240825f900000000, 0x57310dea00000000, 0x86d9eae400000000, + 0xb1435dcc00000000, 0x60abbac200000000, 0x139292d100000000, + 0xc27a75df00000000, 0x7da6fd8000000000, 0xac4e1a8e00000000, + 0xdf77329d00000000, 0x0e9fd59300000000, 0x390562bb00000000, + 0xe8ed85b500000000, 0x9bd4ada600000000, 0x4a3c4aa800000000, + 0x4649281100000000, 0x97a1cf1f00000000, 0xe498e70c00000000, + 0x3570000200000000, 0x02eab72a00000000, 0xd302502400000000, + 0xa03b783700000000, 0x71d39f3900000000, 0xce0f176600000000, + 0x1fe7f06800000000, 0x6cded87b00000000, 0xbd363f7500000000, + 0x8aac885d00000000, 0x5b446f5300000000, 0x287d474000000000, + 0xf995a04e00000000, 0x56c456ff00000000, 0x872cb1f100000000, + 0xf41599e200000000, 0x25fd7eec00000000, 0x1267c9c400000000, + 0xc38f2eca00000000, 0xb0b606d900000000, 0x615ee1d700000000, + 0xde82698800000000, 0x0f6a8e8600000000, 0x7c53a69500000000, + 0xadbb419b00000000, 0x9a21f6b300000000, 0x4bc911bd00000000, + 0x38f039ae00000000, 0xe918dea000000000, 0x2755a41600000000, + 0xf6bd431800000000, 0x85846b0b00000000, 0x546c8c0500000000, + 0x63f63b2d00000000, 0xb21edc2300000000, 0xc127f43000000000, + 0x10cf133e00000000, 0xaf139b6100000000, 0x7efb7c6f00000000, + 0x0dc2547c00000000, 0xdc2ab37200000000, 0xebb0045a00000000, + 0x3a58e35400000000, 0x4961cb4700000000, 0x98892c4900000000, + 0x37d8daf800000000, 0xe6303df600000000, 0x950915e500000000, + 0x44e1f2eb00000000, 0x737b45c300000000, 0xa293a2cd00000000, + 0xd1aa8ade00000000, 0x00426dd000000000, 0xbf9ee58f00000000, + 0x6e76028100000000, 0x1d4f2a9200000000, 0xcca7cd9c00000000, + 0xfb3d7ab400000000, 0x2ad59dba00000000, 0x59ecb5a900000000, + 0x880452a700000000}, + {0x0000000000000000, 0xaa05daf100000000, 0x150dc53800000000, + 0xbf081fc900000000, 0x2a1a8a7100000000, 0x801f508000000000, + 0x3f174f4900000000, 0x951295b800000000, 0x543414e300000000, + 0xfe31ce1200000000, 0x4139d1db00000000, 0xeb3c0b2a00000000, + 0x7e2e9e9200000000, 0xd42b446300000000, 0x6b235baa00000000, + 0xc126815b00000000, 0xe96e591d00000000, 0x436b83ec00000000, + 0xfc639c2500000000, 0x566646d400000000, 0xc374d36c00000000, + 0x6971099d00000000, 0xd679165400000000, 0x7c7ccca500000000, + 0xbd5a4dfe00000000, 0x175f970f00000000, 0xa85788c600000000, + 0x0252523700000000, 0x9740c78f00000000, 0x3d451d7e00000000, + 0x824d02b700000000, 0x2848d84600000000, 0xd2ddb23a00000000, + 0x78d868cb00000000, 0xc7d0770200000000, 0x6dd5adf300000000, + 0xf8c7384b00000000, 0x52c2e2ba00000000, 0xedcafd7300000000, + 0x47cf278200000000, 0x86e9a6d900000000, 0x2cec7c2800000000, + 0x93e463e100000000, 0x39e1b91000000000, 0xacf32ca800000000, + 0x06f6f65900000000, 0xb9fee99000000000, 0x13fb336100000000, + 0x3bb3eb2700000000, 0x91b631d600000000, 0x2ebe2e1f00000000, + 0x84bbf4ee00000000, 0x11a9615600000000, 0xbbacbba700000000, + 0x04a4a46e00000000, 0xaea17e9f00000000, 0x6f87ffc400000000, + 0xc582253500000000, 0x7a8a3afc00000000, 0xd08fe00d00000000, + 0x459d75b500000000, 0xef98af4400000000, 0x5090b08d00000000, + 0xfa956a7c00000000, 0xa4bb657500000000, 0x0ebebf8400000000, + 0xb1b6a04d00000000, 0x1bb37abc00000000, 0x8ea1ef0400000000, + 0x24a435f500000000, 0x9bac2a3c00000000, 0x31a9f0cd00000000, + 0xf08f719600000000, 0x5a8aab6700000000, 0xe582b4ae00000000, + 0x4f876e5f00000000, 0xda95fbe700000000, 0x7090211600000000, + 0xcf983edf00000000, 0x659de42e00000000, 0x4dd53c6800000000, + 0xe7d0e69900000000, 0x58d8f95000000000, 0xf2dd23a100000000, + 0x67cfb61900000000, 0xcdca6ce800000000, 0x72c2732100000000, + 0xd8c7a9d000000000, 0x19e1288b00000000, 0xb3e4f27a00000000, + 0x0cecedb300000000, 0xa6e9374200000000, 0x33fba2fa00000000, + 0x99fe780b00000000, 0x26f667c200000000, 0x8cf3bd3300000000, + 0x7666d74f00000000, 0xdc630dbe00000000, 0x636b127700000000, + 0xc96ec88600000000, 0x5c7c5d3e00000000, 0xf67987cf00000000, + 0x4971980600000000, 0xe37442f700000000, 0x2252c3ac00000000, + 0x8857195d00000000, 0x375f069400000000, 0x9d5adc6500000000, + 0x084849dd00000000, 0xa24d932c00000000, 0x1d458ce500000000, + 0xb740561400000000, 0x9f088e5200000000, 0x350d54a300000000, + 0x8a054b6a00000000, 0x2000919b00000000, 0xb512042300000000, + 0x1f17ded200000000, 0xa01fc11b00000000, 0x0a1a1bea00000000, + 0xcb3c9ab100000000, 0x6139404000000000, 0xde315f8900000000, + 0x7434857800000000, 0xe12610c000000000, 0x4b23ca3100000000, + 0xf42bd5f800000000, 0x5e2e0f0900000000, 0x4877cbea00000000, + 0xe272111b00000000, 0x5d7a0ed200000000, 0xf77fd42300000000, + 0x626d419b00000000, 0xc8689b6a00000000, 0x776084a300000000, + 0xdd655e5200000000, 0x1c43df0900000000, 0xb64605f800000000, + 0x094e1a3100000000, 0xa34bc0c000000000, 0x3659557800000000, + 0x9c5c8f8900000000, 0x2354904000000000, 0x89514ab100000000, + 0xa11992f700000000, 0x0b1c480600000000, 0xb41457cf00000000, + 0x1e118d3e00000000, 0x8b03188600000000, 0x2106c27700000000, + 0x9e0eddbe00000000, 0x340b074f00000000, 0xf52d861400000000, + 0x5f285ce500000000, 0xe020432c00000000, 0x4a2599dd00000000, + 0xdf370c6500000000, 0x7532d69400000000, 0xca3ac95d00000000, + 0x603f13ac00000000, 0x9aaa79d000000000, 0x30afa32100000000, + 0x8fa7bce800000000, 0x25a2661900000000, 0xb0b0f3a100000000, + 0x1ab5295000000000, 0xa5bd369900000000, 0x0fb8ec6800000000, + 0xce9e6d3300000000, 0x649bb7c200000000, 0xdb93a80b00000000, + 0x719672fa00000000, 0xe484e74200000000, 0x4e813db300000000, + 0xf189227a00000000, 0x5b8cf88b00000000, 0x73c420cd00000000, + 0xd9c1fa3c00000000, 0x66c9e5f500000000, 0xcccc3f0400000000, + 0x59deaabc00000000, 0xf3db704d00000000, 0x4cd36f8400000000, + 0xe6d6b57500000000, 0x27f0342e00000000, 0x8df5eedf00000000, + 0x32fdf11600000000, 0x98f82be700000000, 0x0deabe5f00000000, + 0xa7ef64ae00000000, 0x18e77b6700000000, 0xb2e2a19600000000, + 0xecccae9f00000000, 0x46c9746e00000000, 0xf9c16ba700000000, + 0x53c4b15600000000, 0xc6d624ee00000000, 0x6cd3fe1f00000000, + 0xd3dbe1d600000000, 0x79de3b2700000000, 0xb8f8ba7c00000000, + 0x12fd608d00000000, 0xadf57f4400000000, 0x07f0a5b500000000, + 0x92e2300d00000000, 0x38e7eafc00000000, 0x87eff53500000000, + 0x2dea2fc400000000, 0x05a2f78200000000, 0xafa72d7300000000, + 0x10af32ba00000000, 0xbaaae84b00000000, 0x2fb87df300000000, + 0x85bda70200000000, 0x3ab5b8cb00000000, 0x90b0623a00000000, + 0x5196e36100000000, 0xfb93399000000000, 0x449b265900000000, + 0xee9efca800000000, 0x7b8c691000000000, 0xd189b3e100000000, + 0x6e81ac2800000000, 0xc48476d900000000, 0x3e111ca500000000, + 0x9414c65400000000, 0x2b1cd99d00000000, 0x8119036c00000000, + 0x140b96d400000000, 0xbe0e4c2500000000, 0x010653ec00000000, + 0xab03891d00000000, 0x6a25084600000000, 0xc020d2b700000000, + 0x7f28cd7e00000000, 0xd52d178f00000000, 0x403f823700000000, + 0xea3a58c600000000, 0x5532470f00000000, 0xff379dfe00000000, + 0xd77f45b800000000, 0x7d7a9f4900000000, 0xc272808000000000, + 0x68775a7100000000, 0xfd65cfc900000000, 0x5760153800000000, + 0xe8680af100000000, 0x426dd00000000000, 0x834b515b00000000, + 0x294e8baa00000000, 0x9646946300000000, 0x3c434e9200000000, + 0xa951db2a00000000, 0x035401db00000000, 0xbc5c1e1200000000, + 0x1659c4e300000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xae689191, 0x87a02563, 0x29c8b4f2, 0xd4314c87, + 0x7a59dd16, 0x539169e4, 0xfdf9f875, 0x73139f4f, 0xdd7b0ede, + 0xf4b3ba2c, 0x5adb2bbd, 0xa722d3c8, 0x094a4259, 0x2082f6ab, + 0x8eea673a, 0xe6273e9e, 0x484faf0f, 0x61871bfd, 0xcfef8a6c, + 0x32167219, 0x9c7ee388, 0xb5b6577a, 0x1bdec6eb, 0x9534a1d1, + 0x3b5c3040, 0x129484b2, 0xbcfc1523, 0x4105ed56, 0xef6d7cc7, + 0xc6a5c835, 0x68cd59a4, 0x173f7b7d, 0xb957eaec, 0x909f5e1e, + 0x3ef7cf8f, 0xc30e37fa, 0x6d66a66b, 0x44ae1299, 0xeac68308, + 0x642ce432, 0xca4475a3, 0xe38cc151, 0x4de450c0, 0xb01da8b5, + 0x1e753924, 0x37bd8dd6, 0x99d51c47, 0xf11845e3, 0x5f70d472, + 0x76b86080, 0xd8d0f111, 0x25290964, 0x8b4198f5, 0xa2892c07, + 0x0ce1bd96, 0x820bdaac, 0x2c634b3d, 0x05abffcf, 0xabc36e5e, + 0x563a962b, 0xf85207ba, 0xd19ab348, 0x7ff222d9, 0x2e7ef6fa, + 0x8016676b, 0xa9ded399, 0x07b64208, 0xfa4fba7d, 0x54272bec, + 0x7def9f1e, 0xd3870e8f, 0x5d6d69b5, 0xf305f824, 0xdacd4cd6, + 0x74a5dd47, 0x895c2532, 0x2734b4a3, 0x0efc0051, 0xa09491c0, + 0xc859c864, 0x663159f5, 0x4ff9ed07, 0xe1917c96, 0x1c6884e3, + 0xb2001572, 0x9bc8a180, 0x35a03011, 0xbb4a572b, 0x1522c6ba, + 0x3cea7248, 0x9282e3d9, 0x6f7b1bac, 0xc1138a3d, 0xe8db3ecf, + 0x46b3af5e, 0x39418d87, 0x97291c16, 0xbee1a8e4, 0x10893975, + 0xed70c100, 0x43185091, 0x6ad0e463, 0xc4b875f2, 0x4a5212c8, + 0xe43a8359, 0xcdf237ab, 0x639aa63a, 0x9e635e4f, 0x300bcfde, + 0x19c37b2c, 0xb7abeabd, 0xdf66b319, 0x710e2288, 0x58c6967a, + 0xf6ae07eb, 0x0b57ff9e, 0xa53f6e0f, 0x8cf7dafd, 0x229f4b6c, + 0xac752c56, 0x021dbdc7, 0x2bd50935, 0x85bd98a4, 0x784460d1, + 0xd62cf140, 0xffe445b2, 0x518cd423, 0x5cfdedf4, 0xf2957c65, + 0xdb5dc897, 0x75355906, 0x88cca173, 0x26a430e2, 0x0f6c8410, + 0xa1041581, 0x2fee72bb, 0x8186e32a, 0xa84e57d8, 0x0626c649, + 0xfbdf3e3c, 0x55b7afad, 0x7c7f1b5f, 0xd2178ace, 0xbadad36a, + 0x14b242fb, 0x3d7af609, 0x93126798, 0x6eeb9fed, 0xc0830e7c, + 0xe94bba8e, 0x47232b1f, 0xc9c94c25, 0x67a1ddb4, 0x4e696946, + 0xe001f8d7, 0x1df800a2, 0xb3909133, 0x9a5825c1, 0x3430b450, + 0x4bc29689, 0xe5aa0718, 0xcc62b3ea, 0x620a227b, 0x9ff3da0e, + 0x319b4b9f, 0x1853ff6d, 0xb63b6efc, 0x38d109c6, 0x96b99857, + 0xbf712ca5, 0x1119bd34, 0xece04541, 0x4288d4d0, 0x6b406022, + 0xc528f1b3, 0xade5a817, 0x038d3986, 0x2a458d74, 0x842d1ce5, + 0x79d4e490, 0xd7bc7501, 0xfe74c1f3, 0x501c5062, 0xdef63758, + 0x709ea6c9, 0x5956123b, 0xf73e83aa, 0x0ac77bdf, 0xa4afea4e, + 0x8d675ebc, 0x230fcf2d, 0x72831b0e, 0xdceb8a9f, 0xf5233e6d, + 0x5b4baffc, 0xa6b25789, 0x08dac618, 0x211272ea, 0x8f7ae37b, + 0x01908441, 0xaff815d0, 0x8630a122, 0x285830b3, 0xd5a1c8c6, + 0x7bc95957, 0x5201eda5, 0xfc697c34, 0x94a42590, 0x3accb401, + 0x130400f3, 0xbd6c9162, 0x40956917, 0xeefdf886, 0xc7354c74, + 0x695ddde5, 0xe7b7badf, 0x49df2b4e, 0x60179fbc, 0xce7f0e2d, + 0x3386f658, 0x9dee67c9, 0xb426d33b, 0x1a4e42aa, 0x65bc6073, + 0xcbd4f1e2, 0xe21c4510, 0x4c74d481, 0xb18d2cf4, 0x1fe5bd65, + 0x362d0997, 0x98459806, 0x16afff3c, 0xb8c76ead, 0x910fda5f, + 0x3f674bce, 0xc29eb3bb, 0x6cf6222a, 0x453e96d8, 0xeb560749, + 0x839b5eed, 0x2df3cf7c, 0x043b7b8e, 0xaa53ea1f, 0x57aa126a, + 0xf9c283fb, 0xd00a3709, 0x7e62a698, 0xf088c1a2, 0x5ee05033, + 0x7728e4c1, 0xd9407550, 0x24b98d25, 0x8ad11cb4, 0xa319a846, + 0x0d7139d7}, + {0x00000000, 0xb9fbdbe8, 0xa886b191, 0x117d6a79, 0x8a7c6563, + 0x3387be8b, 0x22fad4f2, 0x9b010f1a, 0xcf89cc87, 0x7672176f, + 0x670f7d16, 0xdef4a6fe, 0x45f5a9e4, 0xfc0e720c, 0xed731875, + 0x5488c39d, 0x44629f4f, 0xfd9944a7, 0xece42ede, 0x551ff536, + 0xce1efa2c, 0x77e521c4, 0x66984bbd, 0xdf639055, 0x8beb53c8, + 0x32108820, 0x236de259, 0x9a9639b1, 0x019736ab, 0xb86ced43, + 0xa911873a, 0x10ea5cd2, 0x88c53e9e, 0x313ee576, 0x20438f0f, + 0x99b854e7, 0x02b95bfd, 0xbb428015, 0xaa3fea6c, 0x13c43184, + 0x474cf219, 0xfeb729f1, 0xefca4388, 0x56319860, 0xcd30977a, + 0x74cb4c92, 0x65b626eb, 0xdc4dfd03, 0xcca7a1d1, 0x755c7a39, + 0x64211040, 0xdddacba8, 0x46dbc4b2, 0xff201f5a, 0xee5d7523, + 0x57a6aecb, 0x032e6d56, 0xbad5b6be, 0xaba8dcc7, 0x1253072f, + 0x89520835, 0x30a9d3dd, 0x21d4b9a4, 0x982f624c, 0xcafb7b7d, + 0x7300a095, 0x627dcaec, 0xdb861104, 0x40871e1e, 0xf97cc5f6, + 0xe801af8f, 0x51fa7467, 0x0572b7fa, 0xbc896c12, 0xadf4066b, + 0x140fdd83, 0x8f0ed299, 0x36f50971, 0x27886308, 0x9e73b8e0, + 0x8e99e432, 0x37623fda, 0x261f55a3, 0x9fe48e4b, 0x04e58151, + 0xbd1e5ab9, 0xac6330c0, 0x1598eb28, 0x411028b5, 0xf8ebf35d, + 0xe9969924, 0x506d42cc, 0xcb6c4dd6, 0x7297963e, 0x63eafc47, + 0xda1127af, 0x423e45e3, 0xfbc59e0b, 0xeab8f472, 0x53432f9a, + 0xc8422080, 0x71b9fb68, 0x60c49111, 0xd93f4af9, 0x8db78964, + 0x344c528c, 0x253138f5, 0x9ccae31d, 0x07cbec07, 0xbe3037ef, + 0xaf4d5d96, 0x16b6867e, 0x065cdaac, 0xbfa70144, 0xaeda6b3d, + 0x1721b0d5, 0x8c20bfcf, 0x35db6427, 0x24a60e5e, 0x9d5dd5b6, + 0xc9d5162b, 0x702ecdc3, 0x6153a7ba, 0xd8a87c52, 0x43a97348, + 0xfa52a8a0, 0xeb2fc2d9, 0x52d41931, 0x4e87f0bb, 0xf77c2b53, + 0xe601412a, 0x5ffa9ac2, 0xc4fb95d8, 0x7d004e30, 0x6c7d2449, + 0xd586ffa1, 0x810e3c3c, 0x38f5e7d4, 0x29888dad, 0x90735645, + 0x0b72595f, 0xb28982b7, 0xa3f4e8ce, 0x1a0f3326, 0x0ae56ff4, + 0xb31eb41c, 0xa263de65, 0x1b98058d, 0x80990a97, 0x3962d17f, + 0x281fbb06, 0x91e460ee, 0xc56ca373, 0x7c97789b, 0x6dea12e2, + 0xd411c90a, 0x4f10c610, 0xf6eb1df8, 0xe7967781, 0x5e6dac69, + 0xc642ce25, 0x7fb915cd, 0x6ec47fb4, 0xd73fa45c, 0x4c3eab46, + 0xf5c570ae, 0xe4b81ad7, 0x5d43c13f, 0x09cb02a2, 0xb030d94a, + 0xa14db333, 0x18b668db, 0x83b767c1, 0x3a4cbc29, 0x2b31d650, + 0x92ca0db8, 0x8220516a, 0x3bdb8a82, 0x2aa6e0fb, 0x935d3b13, + 0x085c3409, 0xb1a7efe1, 0xa0da8598, 0x19215e70, 0x4da99ded, + 0xf4524605, 0xe52f2c7c, 0x5cd4f794, 0xc7d5f88e, 0x7e2e2366, + 0x6f53491f, 0xd6a892f7, 0x847c8bc6, 0x3d87502e, 0x2cfa3a57, + 0x9501e1bf, 0x0e00eea5, 0xb7fb354d, 0xa6865f34, 0x1f7d84dc, + 0x4bf54741, 0xf20e9ca9, 0xe373f6d0, 0x5a882d38, 0xc1892222, + 0x7872f9ca, 0x690f93b3, 0xd0f4485b, 0xc01e1489, 0x79e5cf61, + 0x6898a518, 0xd1637ef0, 0x4a6271ea, 0xf399aa02, 0xe2e4c07b, + 0x5b1f1b93, 0x0f97d80e, 0xb66c03e6, 0xa711699f, 0x1eeab277, + 0x85ebbd6d, 0x3c106685, 0x2d6d0cfc, 0x9496d714, 0x0cb9b558, + 0xb5426eb0, 0xa43f04c9, 0x1dc4df21, 0x86c5d03b, 0x3f3e0bd3, + 0x2e4361aa, 0x97b8ba42, 0xc33079df, 0x7acba237, 0x6bb6c84e, + 0xd24d13a6, 0x494c1cbc, 0xf0b7c754, 0xe1caad2d, 0x583176c5, + 0x48db2a17, 0xf120f1ff, 0xe05d9b86, 0x59a6406e, 0xc2a74f74, + 0x7b5c949c, 0x6a21fee5, 0xd3da250d, 0x8752e690, 0x3ea93d78, + 0x2fd45701, 0x962f8ce9, 0x0d2e83f3, 0xb4d5581b, 0xa5a83262, + 0x1c53e98a}, + {0x00000000, 0x9d0fe176, 0xe16ec4ad, 0x7c6125db, 0x19ac8f1b, + 0x84a36e6d, 0xf8c24bb6, 0x65cdaac0, 0x33591e36, 0xae56ff40, + 0xd237da9b, 0x4f383bed, 0x2af5912d, 0xb7fa705b, 0xcb9b5580, + 0x5694b4f6, 0x66b23c6c, 0xfbbddd1a, 0x87dcf8c1, 0x1ad319b7, + 0x7f1eb377, 0xe2115201, 0x9e7077da, 0x037f96ac, 0x55eb225a, + 0xc8e4c32c, 0xb485e6f7, 0x298a0781, 0x4c47ad41, 0xd1484c37, + 0xad2969ec, 0x3026889a, 0xcd6478d8, 0x506b99ae, 0x2c0abc75, + 0xb1055d03, 0xd4c8f7c3, 0x49c716b5, 0x35a6336e, 0xa8a9d218, + 0xfe3d66ee, 0x63328798, 0x1f53a243, 0x825c4335, 0xe791e9f5, + 0x7a9e0883, 0x06ff2d58, 0x9bf0cc2e, 0xabd644b4, 0x36d9a5c2, + 0x4ab88019, 0xd7b7616f, 0xb27acbaf, 0x2f752ad9, 0x53140f02, + 0xce1bee74, 0x988f5a82, 0x0580bbf4, 0x79e19e2f, 0xe4ee7f59, + 0x8123d599, 0x1c2c34ef, 0x604d1134, 0xfd42f042, 0x41b9f7f1, + 0xdcb61687, 0xa0d7335c, 0x3dd8d22a, 0x581578ea, 0xc51a999c, + 0xb97bbc47, 0x24745d31, 0x72e0e9c7, 0xefef08b1, 0x938e2d6a, + 0x0e81cc1c, 0x6b4c66dc, 0xf64387aa, 0x8a22a271, 0x172d4307, + 0x270bcb9d, 0xba042aeb, 0xc6650f30, 0x5b6aee46, 0x3ea74486, + 0xa3a8a5f0, 0xdfc9802b, 0x42c6615d, 0x1452d5ab, 0x895d34dd, + 0xf53c1106, 0x6833f070, 0x0dfe5ab0, 0x90f1bbc6, 0xec909e1d, + 0x719f7f6b, 0x8cdd8f29, 0x11d26e5f, 0x6db34b84, 0xf0bcaaf2, + 0x95710032, 0x087ee144, 0x741fc49f, 0xe91025e9, 0xbf84911f, + 0x228b7069, 0x5eea55b2, 0xc3e5b4c4, 0xa6281e04, 0x3b27ff72, + 0x4746daa9, 0xda493bdf, 0xea6fb345, 0x77605233, 0x0b0177e8, + 0x960e969e, 0xf3c33c5e, 0x6eccdd28, 0x12adf8f3, 0x8fa21985, + 0xd936ad73, 0x44394c05, 0x385869de, 0xa55788a8, 0xc09a2268, + 0x5d95c31e, 0x21f4e6c5, 0xbcfb07b3, 0x8373efe2, 0x1e7c0e94, + 0x621d2b4f, 0xff12ca39, 0x9adf60f9, 0x07d0818f, 0x7bb1a454, + 0xe6be4522, 0xb02af1d4, 0x2d2510a2, 0x51443579, 0xcc4bd40f, + 0xa9867ecf, 0x34899fb9, 0x48e8ba62, 0xd5e75b14, 0xe5c1d38e, + 0x78ce32f8, 0x04af1723, 0x99a0f655, 0xfc6d5c95, 0x6162bde3, + 0x1d039838, 0x800c794e, 0xd698cdb8, 0x4b972cce, 0x37f60915, + 0xaaf9e863, 0xcf3442a3, 0x523ba3d5, 0x2e5a860e, 0xb3556778, + 0x4e17973a, 0xd318764c, 0xaf795397, 0x3276b2e1, 0x57bb1821, + 0xcab4f957, 0xb6d5dc8c, 0x2bda3dfa, 0x7d4e890c, 0xe041687a, + 0x9c204da1, 0x012facd7, 0x64e20617, 0xf9ede761, 0x858cc2ba, + 0x188323cc, 0x28a5ab56, 0xb5aa4a20, 0xc9cb6ffb, 0x54c48e8d, + 0x3109244d, 0xac06c53b, 0xd067e0e0, 0x4d680196, 0x1bfcb560, + 0x86f35416, 0xfa9271cd, 0x679d90bb, 0x02503a7b, 0x9f5fdb0d, + 0xe33efed6, 0x7e311fa0, 0xc2ca1813, 0x5fc5f965, 0x23a4dcbe, + 0xbeab3dc8, 0xdb669708, 0x4669767e, 0x3a0853a5, 0xa707b2d3, + 0xf1930625, 0x6c9ce753, 0x10fdc288, 0x8df223fe, 0xe83f893e, + 0x75306848, 0x09514d93, 0x945eace5, 0xa478247f, 0x3977c509, + 0x4516e0d2, 0xd81901a4, 0xbdd4ab64, 0x20db4a12, 0x5cba6fc9, + 0xc1b58ebf, 0x97213a49, 0x0a2edb3f, 0x764ffee4, 0xeb401f92, + 0x8e8db552, 0x13825424, 0x6fe371ff, 0xf2ec9089, 0x0fae60cb, + 0x92a181bd, 0xeec0a466, 0x73cf4510, 0x1602efd0, 0x8b0d0ea6, + 0xf76c2b7d, 0x6a63ca0b, 0x3cf77efd, 0xa1f89f8b, 0xdd99ba50, + 0x40965b26, 0x255bf1e6, 0xb8541090, 0xc435354b, 0x593ad43d, + 0x691c5ca7, 0xf413bdd1, 0x8872980a, 0x157d797c, 0x70b0d3bc, + 0xedbf32ca, 0x91de1711, 0x0cd1f667, 0x5a454291, 0xc74aa3e7, + 0xbb2b863c, 0x2624674a, 0x43e9cd8a, 0xdee62cfc, 0xa2870927, + 0x3f88e851}, + {0x00000000, 0xdd96d985, 0x605cb54b, 0xbdca6cce, 0xc0b96a96, + 0x1d2fb313, 0xa0e5dfdd, 0x7d730658, 0x5a03d36d, 0x87950ae8, + 0x3a5f6626, 0xe7c9bfa3, 0x9abab9fb, 0x472c607e, 0xfae60cb0, + 0x2770d535, 0xb407a6da, 0x69917f5f, 0xd45b1391, 0x09cdca14, + 0x74becc4c, 0xa92815c9, 0x14e27907, 0xc974a082, 0xee0475b7, + 0x3392ac32, 0x8e58c0fc, 0x53ce1979, 0x2ebd1f21, 0xf32bc6a4, + 0x4ee1aa6a, 0x937773ef, 0xb37e4bf5, 0x6ee89270, 0xd322febe, + 0x0eb4273b, 0x73c72163, 0xae51f8e6, 0x139b9428, 0xce0d4dad, + 0xe97d9898, 0x34eb411d, 0x89212dd3, 0x54b7f456, 0x29c4f20e, + 0xf4522b8b, 0x49984745, 0x940e9ec0, 0x0779ed2f, 0xdaef34aa, + 0x67255864, 0xbab381e1, 0xc7c087b9, 0x1a565e3c, 0xa79c32f2, + 0x7a0aeb77, 0x5d7a3e42, 0x80ece7c7, 0x3d268b09, 0xe0b0528c, + 0x9dc354d4, 0x40558d51, 0xfd9fe19f, 0x2009381a, 0xbd8d91ab, + 0x601b482e, 0xddd124e0, 0x0047fd65, 0x7d34fb3d, 0xa0a222b8, + 0x1d684e76, 0xc0fe97f3, 0xe78e42c6, 0x3a189b43, 0x87d2f78d, + 0x5a442e08, 0x27372850, 0xfaa1f1d5, 0x476b9d1b, 0x9afd449e, + 0x098a3771, 0xd41ceef4, 0x69d6823a, 0xb4405bbf, 0xc9335de7, + 0x14a58462, 0xa96fe8ac, 0x74f93129, 0x5389e41c, 0x8e1f3d99, + 0x33d55157, 0xee4388d2, 0x93308e8a, 0x4ea6570f, 0xf36c3bc1, + 0x2efae244, 0x0ef3da5e, 0xd36503db, 0x6eaf6f15, 0xb339b690, + 0xce4ab0c8, 0x13dc694d, 0xae160583, 0x7380dc06, 0x54f00933, + 0x8966d0b6, 0x34acbc78, 0xe93a65fd, 0x944963a5, 0x49dfba20, + 0xf415d6ee, 0x29830f6b, 0xbaf47c84, 0x6762a501, 0xdaa8c9cf, + 0x073e104a, 0x7a4d1612, 0xa7dbcf97, 0x1a11a359, 0xc7877adc, + 0xe0f7afe9, 0x3d61766c, 0x80ab1aa2, 0x5d3dc327, 0x204ec57f, + 0xfdd81cfa, 0x40127034, 0x9d84a9b1, 0xa06a2517, 0x7dfcfc92, + 0xc036905c, 0x1da049d9, 0x60d34f81, 0xbd459604, 0x008ffaca, + 0xdd19234f, 0xfa69f67a, 0x27ff2fff, 0x9a354331, 0x47a39ab4, + 0x3ad09cec, 0xe7464569, 0x5a8c29a7, 0x871af022, 0x146d83cd, + 0xc9fb5a48, 0x74313686, 0xa9a7ef03, 0xd4d4e95b, 0x094230de, + 0xb4885c10, 0x691e8595, 0x4e6e50a0, 0x93f88925, 0x2e32e5eb, + 0xf3a43c6e, 0x8ed73a36, 0x5341e3b3, 0xee8b8f7d, 0x331d56f8, + 0x13146ee2, 0xce82b767, 0x7348dba9, 0xaede022c, 0xd3ad0474, + 0x0e3bddf1, 0xb3f1b13f, 0x6e6768ba, 0x4917bd8f, 0x9481640a, + 0x294b08c4, 0xf4ddd141, 0x89aed719, 0x54380e9c, 0xe9f26252, + 0x3464bbd7, 0xa713c838, 0x7a8511bd, 0xc74f7d73, 0x1ad9a4f6, + 0x67aaa2ae, 0xba3c7b2b, 0x07f617e5, 0xda60ce60, 0xfd101b55, + 0x2086c2d0, 0x9d4cae1e, 0x40da779b, 0x3da971c3, 0xe03fa846, + 0x5df5c488, 0x80631d0d, 0x1de7b4bc, 0xc0716d39, 0x7dbb01f7, + 0xa02dd872, 0xdd5ede2a, 0x00c807af, 0xbd026b61, 0x6094b2e4, + 0x47e467d1, 0x9a72be54, 0x27b8d29a, 0xfa2e0b1f, 0x875d0d47, + 0x5acbd4c2, 0xe701b80c, 0x3a976189, 0xa9e01266, 0x7476cbe3, + 0xc9bca72d, 0x142a7ea8, 0x695978f0, 0xb4cfa175, 0x0905cdbb, + 0xd493143e, 0xf3e3c10b, 0x2e75188e, 0x93bf7440, 0x4e29adc5, + 0x335aab9d, 0xeecc7218, 0x53061ed6, 0x8e90c753, 0xae99ff49, + 0x730f26cc, 0xcec54a02, 0x13539387, 0x6e2095df, 0xb3b64c5a, + 0x0e7c2094, 0xd3eaf911, 0xf49a2c24, 0x290cf5a1, 0x94c6996f, + 0x495040ea, 0x342346b2, 0xe9b59f37, 0x547ff3f9, 0x89e92a7c, + 0x1a9e5993, 0xc7088016, 0x7ac2ecd8, 0xa754355d, 0xda273305, + 0x07b1ea80, 0xba7b864e, 0x67ed5fcb, 0x409d8afe, 0x9d0b537b, + 0x20c13fb5, 0xfd57e630, 0x8024e068, 0x5db239ed, 0xe0785523, + 0x3dee8ca6}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x85d996dd, 0x4bb55c60, 0xce6ccabd, 0x966ab9c0, + 0x13b32f1d, 0xdddfe5a0, 0x5806737d, 0x6dd3035a, 0xe80a9587, + 0x26665f3a, 0xa3bfc9e7, 0xfbb9ba9a, 0x7e602c47, 0xb00ce6fa, + 0x35d57027, 0xdaa607b4, 0x5f7f9169, 0x91135bd4, 0x14cacd09, + 0x4cccbe74, 0xc91528a9, 0x0779e214, 0x82a074c9, 0xb77504ee, + 0x32ac9233, 0xfcc0588e, 0x7919ce53, 0x211fbd2e, 0xa4c62bf3, + 0x6aaae14e, 0xef737793, 0xf54b7eb3, 0x7092e86e, 0xbefe22d3, + 0x3b27b40e, 0x6321c773, 0xe6f851ae, 0x28949b13, 0xad4d0dce, + 0x98987de9, 0x1d41eb34, 0xd32d2189, 0x56f4b754, 0x0ef2c429, + 0x8b2b52f4, 0x45479849, 0xc09e0e94, 0x2fed7907, 0xaa34efda, + 0x64582567, 0xe181b3ba, 0xb987c0c7, 0x3c5e561a, 0xf2329ca7, + 0x77eb0a7a, 0x423e7a5d, 0xc7e7ec80, 0x098b263d, 0x8c52b0e0, + 0xd454c39d, 0x518d5540, 0x9fe19ffd, 0x1a380920, 0xab918dbd, + 0x2e481b60, 0xe024d1dd, 0x65fd4700, 0x3dfb347d, 0xb822a2a0, + 0x764e681d, 0xf397fec0, 0xc6428ee7, 0x439b183a, 0x8df7d287, + 0x082e445a, 0x50283727, 0xd5f1a1fa, 0x1b9d6b47, 0x9e44fd9a, + 0x71378a09, 0xf4ee1cd4, 0x3a82d669, 0xbf5b40b4, 0xe75d33c9, + 0x6284a514, 0xace86fa9, 0x2931f974, 0x1ce48953, 0x993d1f8e, + 0x5751d533, 0xd28843ee, 0x8a8e3093, 0x0f57a64e, 0xc13b6cf3, + 0x44e2fa2e, 0x5edaf30e, 0xdb0365d3, 0x156faf6e, 0x90b639b3, + 0xc8b04ace, 0x4d69dc13, 0x830516ae, 0x06dc8073, 0x3309f054, + 0xb6d06689, 0x78bcac34, 0xfd653ae9, 0xa5634994, 0x20badf49, + 0xeed615f4, 0x6b0f8329, 0x847cf4ba, 0x01a56267, 0xcfc9a8da, + 0x4a103e07, 0x12164d7a, 0x97cfdba7, 0x59a3111a, 0xdc7a87c7, + 0xe9aff7e0, 0x6c76613d, 0xa21aab80, 0x27c33d5d, 0x7fc54e20, + 0xfa1cd8fd, 0x34701240, 0xb1a9849d, 0x17256aa0, 0x92fcfc7d, + 0x5c9036c0, 0xd949a01d, 0x814fd360, 0x049645bd, 0xcafa8f00, + 0x4f2319dd, 0x7af669fa, 0xff2fff27, 0x3143359a, 0xb49aa347, + 0xec9cd03a, 0x694546e7, 0xa7298c5a, 0x22f01a87, 0xcd836d14, + 0x485afbc9, 0x86363174, 0x03efa7a9, 0x5be9d4d4, 0xde304209, + 0x105c88b4, 0x95851e69, 0xa0506e4e, 0x2589f893, 0xebe5322e, + 0x6e3ca4f3, 0x363ad78e, 0xb3e34153, 0x7d8f8bee, 0xf8561d33, + 0xe26e1413, 0x67b782ce, 0xa9db4873, 0x2c02deae, 0x7404add3, + 0xf1dd3b0e, 0x3fb1f1b3, 0xba68676e, 0x8fbd1749, 0x0a648194, + 0xc4084b29, 0x41d1ddf4, 0x19d7ae89, 0x9c0e3854, 0x5262f2e9, + 0xd7bb6434, 0x38c813a7, 0xbd11857a, 0x737d4fc7, 0xf6a4d91a, + 0xaea2aa67, 0x2b7b3cba, 0xe517f607, 0x60ce60da, 0x551b10fd, + 0xd0c28620, 0x1eae4c9d, 0x9b77da40, 0xc371a93d, 0x46a83fe0, + 0x88c4f55d, 0x0d1d6380, 0xbcb4e71d, 0x396d71c0, 0xf701bb7d, + 0x72d82da0, 0x2ade5edd, 0xaf07c800, 0x616b02bd, 0xe4b29460, + 0xd167e447, 0x54be729a, 0x9ad2b827, 0x1f0b2efa, 0x470d5d87, + 0xc2d4cb5a, 0x0cb801e7, 0x8961973a, 0x6612e0a9, 0xe3cb7674, + 0x2da7bcc9, 0xa87e2a14, 0xf0785969, 0x75a1cfb4, 0xbbcd0509, + 0x3e1493d4, 0x0bc1e3f3, 0x8e18752e, 0x4074bf93, 0xc5ad294e, + 0x9dab5a33, 0x1872ccee, 0xd61e0653, 0x53c7908e, 0x49ff99ae, + 0xcc260f73, 0x024ac5ce, 0x87935313, 0xdf95206e, 0x5a4cb6b3, + 0x94207c0e, 0x11f9ead3, 0x242c9af4, 0xa1f50c29, 0x6f99c694, + 0xea405049, 0xb2462334, 0x379fb5e9, 0xf9f37f54, 0x7c2ae989, + 0x93599e1a, 0x168008c7, 0xd8ecc27a, 0x5d3554a7, 0x053327da, + 0x80eab107, 0x4e867bba, 0xcb5fed67, 0xfe8a9d40, 0x7b530b9d, + 0xb53fc120, 0x30e657fd, 0x68e02480, 0xed39b25d, 0x235578e0, + 0xa68cee3d}, + {0x00000000, 0x76e10f9d, 0xadc46ee1, 0xdb25617c, 0x1b8fac19, + 0x6d6ea384, 0xb64bc2f8, 0xc0aacd65, 0x361e5933, 0x40ff56ae, + 0x9bda37d2, 0xed3b384f, 0x2d91f52a, 0x5b70fab7, 0x80559bcb, + 0xf6b49456, 0x6c3cb266, 0x1addbdfb, 0xc1f8dc87, 0xb719d31a, + 0x77b31e7f, 0x015211e2, 0xda77709e, 0xac967f03, 0x5a22eb55, + 0x2cc3e4c8, 0xf7e685b4, 0x81078a29, 0x41ad474c, 0x374c48d1, + 0xec6929ad, 0x9a882630, 0xd87864cd, 0xae996b50, 0x75bc0a2c, + 0x035d05b1, 0xc3f7c8d4, 0xb516c749, 0x6e33a635, 0x18d2a9a8, + 0xee663dfe, 0x98873263, 0x43a2531f, 0x35435c82, 0xf5e991e7, + 0x83089e7a, 0x582dff06, 0x2eccf09b, 0xb444d6ab, 0xc2a5d936, + 0x1980b84a, 0x6f61b7d7, 0xafcb7ab2, 0xd92a752f, 0x020f1453, + 0x74ee1bce, 0x825a8f98, 0xf4bb8005, 0x2f9ee179, 0x597feee4, + 0x99d52381, 0xef342c1c, 0x34114d60, 0x42f042fd, 0xf1f7b941, + 0x8716b6dc, 0x5c33d7a0, 0x2ad2d83d, 0xea781558, 0x9c991ac5, + 0x47bc7bb9, 0x315d7424, 0xc7e9e072, 0xb108efef, 0x6a2d8e93, + 0x1ccc810e, 0xdc664c6b, 0xaa8743f6, 0x71a2228a, 0x07432d17, + 0x9dcb0b27, 0xeb2a04ba, 0x300f65c6, 0x46ee6a5b, 0x8644a73e, + 0xf0a5a8a3, 0x2b80c9df, 0x5d61c642, 0xabd55214, 0xdd345d89, + 0x06113cf5, 0x70f03368, 0xb05afe0d, 0xc6bbf190, 0x1d9e90ec, + 0x6b7f9f71, 0x298fdd8c, 0x5f6ed211, 0x844bb36d, 0xf2aabcf0, + 0x32007195, 0x44e17e08, 0x9fc41f74, 0xe92510e9, 0x1f9184bf, + 0x69708b22, 0xb255ea5e, 0xc4b4e5c3, 0x041e28a6, 0x72ff273b, + 0xa9da4647, 0xdf3b49da, 0x45b36fea, 0x33526077, 0xe877010b, + 0x9e960e96, 0x5e3cc3f3, 0x28ddcc6e, 0xf3f8ad12, 0x8519a28f, + 0x73ad36d9, 0x054c3944, 0xde695838, 0xa88857a5, 0x68229ac0, + 0x1ec3955d, 0xc5e6f421, 0xb307fbbc, 0xe2ef7383, 0x940e7c1e, + 0x4f2b1d62, 0x39ca12ff, 0xf960df9a, 0x8f81d007, 0x54a4b17b, + 0x2245bee6, 0xd4f12ab0, 0xa210252d, 0x79354451, 0x0fd44bcc, + 0xcf7e86a9, 0xb99f8934, 0x62bae848, 0x145be7d5, 0x8ed3c1e5, + 0xf832ce78, 0x2317af04, 0x55f6a099, 0x955c6dfc, 0xe3bd6261, + 0x3898031d, 0x4e790c80, 0xb8cd98d6, 0xce2c974b, 0x1509f637, + 0x63e8f9aa, 0xa34234cf, 0xd5a33b52, 0x0e865a2e, 0x786755b3, + 0x3a97174e, 0x4c7618d3, 0x975379af, 0xe1b27632, 0x2118bb57, + 0x57f9b4ca, 0x8cdcd5b6, 0xfa3dda2b, 0x0c894e7d, 0x7a6841e0, + 0xa14d209c, 0xd7ac2f01, 0x1706e264, 0x61e7edf9, 0xbac28c85, + 0xcc238318, 0x56aba528, 0x204aaab5, 0xfb6fcbc9, 0x8d8ec454, + 0x4d240931, 0x3bc506ac, 0xe0e067d0, 0x9601684d, 0x60b5fc1b, + 0x1654f386, 0xcd7192fa, 0xbb909d67, 0x7b3a5002, 0x0ddb5f9f, + 0xd6fe3ee3, 0xa01f317e, 0x1318cac2, 0x65f9c55f, 0xbedca423, + 0xc83dabbe, 0x089766db, 0x7e766946, 0xa553083a, 0xd3b207a7, + 0x250693f1, 0x53e79c6c, 0x88c2fd10, 0xfe23f28d, 0x3e893fe8, + 0x48683075, 0x934d5109, 0xe5ac5e94, 0x7f2478a4, 0x09c57739, + 0xd2e01645, 0xa40119d8, 0x64abd4bd, 0x124adb20, 0xc96fba5c, + 0xbf8eb5c1, 0x493a2197, 0x3fdb2e0a, 0xe4fe4f76, 0x921f40eb, + 0x52b58d8e, 0x24548213, 0xff71e36f, 0x8990ecf2, 0xcb60ae0f, + 0xbd81a192, 0x66a4c0ee, 0x1045cf73, 0xd0ef0216, 0xa60e0d8b, + 0x7d2b6cf7, 0x0bca636a, 0xfd7ef73c, 0x8b9ff8a1, 0x50ba99dd, + 0x265b9640, 0xe6f15b25, 0x901054b8, 0x4b3535c4, 0x3dd43a59, + 0xa75c1c69, 0xd1bd13f4, 0x0a987288, 0x7c797d15, 0xbcd3b070, + 0xca32bfed, 0x1117de91, 0x67f6d10c, 0x9142455a, 0xe7a34ac7, + 0x3c862bbb, 0x4a672426, 0x8acde943, 0xfc2ce6de, 0x270987a2, + 0x51e8883f}, + {0x00000000, 0xe8dbfbb9, 0x91b186a8, 0x796a7d11, 0x63657c8a, + 0x8bbe8733, 0xf2d4fa22, 0x1a0f019b, 0x87cc89cf, 0x6f177276, + 0x167d0f67, 0xfea6f4de, 0xe4a9f545, 0x0c720efc, 0x751873ed, + 0x9dc38854, 0x4f9f6244, 0xa74499fd, 0xde2ee4ec, 0x36f51f55, + 0x2cfa1ece, 0xc421e577, 0xbd4b9866, 0x559063df, 0xc853eb8b, + 0x20881032, 0x59e26d23, 0xb139969a, 0xab369701, 0x43ed6cb8, + 0x3a8711a9, 0xd25cea10, 0x9e3ec588, 0x76e53e31, 0x0f8f4320, + 0xe754b899, 0xfd5bb902, 0x158042bb, 0x6cea3faa, 0x8431c413, + 0x19f24c47, 0xf129b7fe, 0x8843caef, 0x60983156, 0x7a9730cd, + 0x924ccb74, 0xeb26b665, 0x03fd4ddc, 0xd1a1a7cc, 0x397a5c75, + 0x40102164, 0xa8cbdadd, 0xb2c4db46, 0x5a1f20ff, 0x23755dee, + 0xcbaea657, 0x566d2e03, 0xbeb6d5ba, 0xc7dca8ab, 0x2f075312, + 0x35085289, 0xddd3a930, 0xa4b9d421, 0x4c622f98, 0x7d7bfbca, + 0x95a00073, 0xecca7d62, 0x041186db, 0x1e1e8740, 0xf6c57cf9, + 0x8faf01e8, 0x6774fa51, 0xfab77205, 0x126c89bc, 0x6b06f4ad, + 0x83dd0f14, 0x99d20e8f, 0x7109f536, 0x08638827, 0xe0b8739e, + 0x32e4998e, 0xda3f6237, 0xa3551f26, 0x4b8ee49f, 0x5181e504, + 0xb95a1ebd, 0xc03063ac, 0x28eb9815, 0xb5281041, 0x5df3ebf8, + 0x249996e9, 0xcc426d50, 0xd64d6ccb, 0x3e969772, 0x47fcea63, + 0xaf2711da, 0xe3453e42, 0x0b9ec5fb, 0x72f4b8ea, 0x9a2f4353, + 0x802042c8, 0x68fbb971, 0x1191c460, 0xf94a3fd9, 0x6489b78d, + 0x8c524c34, 0xf5383125, 0x1de3ca9c, 0x07eccb07, 0xef3730be, + 0x965d4daf, 0x7e86b616, 0xacda5c06, 0x4401a7bf, 0x3d6bdaae, + 0xd5b02117, 0xcfbf208c, 0x2764db35, 0x5e0ea624, 0xb6d55d9d, + 0x2b16d5c9, 0xc3cd2e70, 0xbaa75361, 0x527ca8d8, 0x4873a943, + 0xa0a852fa, 0xd9c22feb, 0x3119d452, 0xbbf0874e, 0x532b7cf7, + 0x2a4101e6, 0xc29afa5f, 0xd895fbc4, 0x304e007d, 0x49247d6c, + 0xa1ff86d5, 0x3c3c0e81, 0xd4e7f538, 0xad8d8829, 0x45567390, + 0x5f59720b, 0xb78289b2, 0xcee8f4a3, 0x26330f1a, 0xf46fe50a, + 0x1cb41eb3, 0x65de63a2, 0x8d05981b, 0x970a9980, 0x7fd16239, + 0x06bb1f28, 0xee60e491, 0x73a36cc5, 0x9b78977c, 0xe212ea6d, + 0x0ac911d4, 0x10c6104f, 0xf81debf6, 0x817796e7, 0x69ac6d5e, + 0x25ce42c6, 0xcd15b97f, 0xb47fc46e, 0x5ca43fd7, 0x46ab3e4c, + 0xae70c5f5, 0xd71ab8e4, 0x3fc1435d, 0xa202cb09, 0x4ad930b0, + 0x33b34da1, 0xdb68b618, 0xc167b783, 0x29bc4c3a, 0x50d6312b, + 0xb80dca92, 0x6a512082, 0x828adb3b, 0xfbe0a62a, 0x133b5d93, + 0x09345c08, 0xe1efa7b1, 0x9885daa0, 0x705e2119, 0xed9da94d, + 0x054652f4, 0x7c2c2fe5, 0x94f7d45c, 0x8ef8d5c7, 0x66232e7e, + 0x1f49536f, 0xf792a8d6, 0xc68b7c84, 0x2e50873d, 0x573afa2c, + 0xbfe10195, 0xa5ee000e, 0x4d35fbb7, 0x345f86a6, 0xdc847d1f, + 0x4147f54b, 0xa99c0ef2, 0xd0f673e3, 0x382d885a, 0x222289c1, + 0xcaf97278, 0xb3930f69, 0x5b48f4d0, 0x89141ec0, 0x61cfe579, + 0x18a59868, 0xf07e63d1, 0xea71624a, 0x02aa99f3, 0x7bc0e4e2, + 0x931b1f5b, 0x0ed8970f, 0xe6036cb6, 0x9f6911a7, 0x77b2ea1e, + 0x6dbdeb85, 0x8566103c, 0xfc0c6d2d, 0x14d79694, 0x58b5b90c, + 0xb06e42b5, 0xc9043fa4, 0x21dfc41d, 0x3bd0c586, 0xd30b3e3f, + 0xaa61432e, 0x42bab897, 0xdf7930c3, 0x37a2cb7a, 0x4ec8b66b, + 0xa6134dd2, 0xbc1c4c49, 0x54c7b7f0, 0x2dadcae1, 0xc5763158, + 0x172adb48, 0xfff120f1, 0x869b5de0, 0x6e40a659, 0x744fa7c2, + 0x9c945c7b, 0xe5fe216a, 0x0d25dad3, 0x90e65287, 0x783da93e, + 0x0157d42f, 0xe98c2f96, 0xf3832e0d, 0x1b58d5b4, 0x6232a8a5, + 0x8ae9531c}, + {0x00000000, 0x919168ae, 0x6325a087, 0xf2b4c829, 0x874c31d4, + 0x16dd597a, 0xe4699153, 0x75f8f9fd, 0x4f9f1373, 0xde0e7bdd, + 0x2cbab3f4, 0xbd2bdb5a, 0xc8d322a7, 0x59424a09, 0xabf68220, + 0x3a67ea8e, 0x9e3e27e6, 0x0faf4f48, 0xfd1b8761, 0x6c8aefcf, + 0x19721632, 0x88e37e9c, 0x7a57b6b5, 0xebc6de1b, 0xd1a13495, + 0x40305c3b, 0xb2849412, 0x2315fcbc, 0x56ed0541, 0xc77c6def, + 0x35c8a5c6, 0xa459cd68, 0x7d7b3f17, 0xecea57b9, 0x1e5e9f90, + 0x8fcff73e, 0xfa370ec3, 0x6ba6666d, 0x9912ae44, 0x0883c6ea, + 0x32e42c64, 0xa37544ca, 0x51c18ce3, 0xc050e44d, 0xb5a81db0, + 0x2439751e, 0xd68dbd37, 0x471cd599, 0xe34518f1, 0x72d4705f, + 0x8060b876, 0x11f1d0d8, 0x64092925, 0xf598418b, 0x072c89a2, + 0x96bde10c, 0xacda0b82, 0x3d4b632c, 0xcfffab05, 0x5e6ec3ab, + 0x2b963a56, 0xba0752f8, 0x48b39ad1, 0xd922f27f, 0xfaf67e2e, + 0x6b671680, 0x99d3dea9, 0x0842b607, 0x7dba4ffa, 0xec2b2754, + 0x1e9fef7d, 0x8f0e87d3, 0xb5696d5d, 0x24f805f3, 0xd64ccdda, + 0x47dda574, 0x32255c89, 0xa3b43427, 0x5100fc0e, 0xc09194a0, + 0x64c859c8, 0xf5593166, 0x07edf94f, 0x967c91e1, 0xe384681c, + 0x721500b2, 0x80a1c89b, 0x1130a035, 0x2b574abb, 0xbac62215, + 0x4872ea3c, 0xd9e38292, 0xac1b7b6f, 0x3d8a13c1, 0xcf3edbe8, + 0x5eafb346, 0x878d4139, 0x161c2997, 0xe4a8e1be, 0x75398910, + 0x00c170ed, 0x91501843, 0x63e4d06a, 0xf275b8c4, 0xc812524a, + 0x59833ae4, 0xab37f2cd, 0x3aa69a63, 0x4f5e639e, 0xdecf0b30, + 0x2c7bc319, 0xbdeaabb7, 0x19b366df, 0x88220e71, 0x7a96c658, + 0xeb07aef6, 0x9eff570b, 0x0f6e3fa5, 0xfddaf78c, 0x6c4b9f22, + 0x562c75ac, 0xc7bd1d02, 0x3509d52b, 0xa498bd85, 0xd1604478, + 0x40f12cd6, 0xb245e4ff, 0x23d48c51, 0xf4edfd5c, 0x657c95f2, + 0x97c85ddb, 0x06593575, 0x73a1cc88, 0xe230a426, 0x10846c0f, + 0x811504a1, 0xbb72ee2f, 0x2ae38681, 0xd8574ea8, 0x49c62606, + 0x3c3edffb, 0xadafb755, 0x5f1b7f7c, 0xce8a17d2, 0x6ad3daba, + 0xfb42b214, 0x09f67a3d, 0x98671293, 0xed9feb6e, 0x7c0e83c0, + 0x8eba4be9, 0x1f2b2347, 0x254cc9c9, 0xb4dda167, 0x4669694e, + 0xd7f801e0, 0xa200f81d, 0x339190b3, 0xc125589a, 0x50b43034, + 0x8996c24b, 0x1807aae5, 0xeab362cc, 0x7b220a62, 0x0edaf39f, + 0x9f4b9b31, 0x6dff5318, 0xfc6e3bb6, 0xc609d138, 0x5798b996, + 0xa52c71bf, 0x34bd1911, 0x4145e0ec, 0xd0d48842, 0x2260406b, + 0xb3f128c5, 0x17a8e5ad, 0x86398d03, 0x748d452a, 0xe51c2d84, + 0x90e4d479, 0x0175bcd7, 0xf3c174fe, 0x62501c50, 0x5837f6de, + 0xc9a69e70, 0x3b125659, 0xaa833ef7, 0xdf7bc70a, 0x4eeaafa4, + 0xbc5e678d, 0x2dcf0f23, 0x0e1b8372, 0x9f8aebdc, 0x6d3e23f5, + 0xfcaf4b5b, 0x8957b2a6, 0x18c6da08, 0xea721221, 0x7be37a8f, + 0x41849001, 0xd015f8af, 0x22a13086, 0xb3305828, 0xc6c8a1d5, + 0x5759c97b, 0xa5ed0152, 0x347c69fc, 0x9025a494, 0x01b4cc3a, + 0xf3000413, 0x62916cbd, 0x17699540, 0x86f8fdee, 0x744c35c7, + 0xe5dd5d69, 0xdfbab7e7, 0x4e2bdf49, 0xbc9f1760, 0x2d0e7fce, + 0x58f68633, 0xc967ee9d, 0x3bd326b4, 0xaa424e1a, 0x7360bc65, + 0xe2f1d4cb, 0x10451ce2, 0x81d4744c, 0xf42c8db1, 0x65bde51f, + 0x97092d36, 0x06984598, 0x3cffaf16, 0xad6ec7b8, 0x5fda0f91, + 0xce4b673f, 0xbbb39ec2, 0x2a22f66c, 0xd8963e45, 0x490756eb, + 0xed5e9b83, 0x7ccff32d, 0x8e7b3b04, 0x1fea53aa, 0x6a12aa57, + 0xfb83c2f9, 0x09370ad0, 0x98a6627e, 0xa2c188f0, 0x3350e05e, + 0xc1e42877, 0x507540d9, 0x258db924, 0xb41cd18a, 0x46a819a3, + 0xd739710d}}; + +#endif + +#endif + +#if N == 5 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xaf449247, 0x85f822cf, 0x2abcb088, 0xd08143df, + 0x7fc5d198, 0x55796110, 0xfa3df357, 0x7a7381ff, 0xd53713b8, + 0xff8ba330, 0x50cf3177, 0xaaf2c220, 0x05b65067, 0x2f0ae0ef, + 0x804e72a8, 0xf4e703fe, 0x5ba391b9, 0x711f2131, 0xde5bb376, + 0x24664021, 0x8b22d266, 0xa19e62ee, 0x0edaf0a9, 0x8e948201, + 0x21d01046, 0x0b6ca0ce, 0xa4283289, 0x5e15c1de, 0xf1515399, + 0xdbede311, 0x74a97156, 0x32bf01bd, 0x9dfb93fa, 0xb7472372, + 0x1803b135, 0xe23e4262, 0x4d7ad025, 0x67c660ad, 0xc882f2ea, + 0x48cc8042, 0xe7881205, 0xcd34a28d, 0x627030ca, 0x984dc39d, + 0x370951da, 0x1db5e152, 0xb2f17315, 0xc6580243, 0x691c9004, + 0x43a0208c, 0xece4b2cb, 0x16d9419c, 0xb99dd3db, 0x93216353, + 0x3c65f114, 0xbc2b83bc, 0x136f11fb, 0x39d3a173, 0x96973334, + 0x6caac063, 0xc3ee5224, 0xe952e2ac, 0x461670eb, 0x657e037a, + 0xca3a913d, 0xe08621b5, 0x4fc2b3f2, 0xb5ff40a5, 0x1abbd2e2, + 0x3007626a, 0x9f43f02d, 0x1f0d8285, 0xb04910c2, 0x9af5a04a, + 0x35b1320d, 0xcf8cc15a, 0x60c8531d, 0x4a74e395, 0xe53071d2, + 0x91990084, 0x3edd92c3, 0x1461224b, 0xbb25b00c, 0x4118435b, + 0xee5cd11c, 0xc4e06194, 0x6ba4f3d3, 0xebea817b, 0x44ae133c, + 0x6e12a3b4, 0xc15631f3, 0x3b6bc2a4, 0x942f50e3, 0xbe93e06b, + 0x11d7722c, 0x57c102c7, 0xf8859080, 0xd2392008, 0x7d7db24f, + 0x87404118, 0x2804d35f, 0x02b863d7, 0xadfcf190, 0x2db28338, + 0x82f6117f, 0xa84aa1f7, 0x070e33b0, 0xfd33c0e7, 0x527752a0, + 0x78cbe228, 0xd78f706f, 0xa3260139, 0x0c62937e, 0x26de23f6, + 0x899ab1b1, 0x73a742e6, 0xdce3d0a1, 0xf65f6029, 0x591bf26e, + 0xd95580c6, 0x76111281, 0x5cada209, 0xf3e9304e, 0x09d4c319, + 0xa690515e, 0x8c2ce1d6, 0x23687391, 0xcafc06f4, 0x65b894b3, + 0x4f04243b, 0xe040b67c, 0x1a7d452b, 0xb539d76c, 0x9f8567e4, + 0x30c1f5a3, 0xb08f870b, 0x1fcb154c, 0x3577a5c4, 0x9a333783, + 0x600ec4d4, 0xcf4a5693, 0xe5f6e61b, 0x4ab2745c, 0x3e1b050a, + 0x915f974d, 0xbbe327c5, 0x14a7b582, 0xee9a46d5, 0x41ded492, + 0x6b62641a, 0xc426f65d, 0x446884f5, 0xeb2c16b2, 0xc190a63a, + 0x6ed4347d, 0x94e9c72a, 0x3bad556d, 0x1111e5e5, 0xbe5577a2, + 0xf8430749, 0x5707950e, 0x7dbb2586, 0xd2ffb7c1, 0x28c24496, + 0x8786d6d1, 0xad3a6659, 0x027ef41e, 0x823086b6, 0x2d7414f1, + 0x07c8a479, 0xa88c363e, 0x52b1c569, 0xfdf5572e, 0xd749e7a6, + 0x780d75e1, 0x0ca404b7, 0xa3e096f0, 0x895c2678, 0x2618b43f, + 0xdc254768, 0x7361d52f, 0x59dd65a7, 0xf699f7e0, 0x76d78548, + 0xd993170f, 0xf32fa787, 0x5c6b35c0, 0xa656c697, 0x091254d0, + 0x23aee458, 0x8cea761f, 0xaf82058e, 0x00c697c9, 0x2a7a2741, + 0x853eb506, 0x7f034651, 0xd047d416, 0xfafb649e, 0x55bff6d9, + 0xd5f18471, 0x7ab51636, 0x5009a6be, 0xff4d34f9, 0x0570c7ae, + 0xaa3455e9, 0x8088e561, 0x2fcc7726, 0x5b650670, 0xf4219437, + 0xde9d24bf, 0x71d9b6f8, 0x8be445af, 0x24a0d7e8, 0x0e1c6760, + 0xa158f527, 0x2116878f, 0x8e5215c8, 0xa4eea540, 0x0baa3707, + 0xf197c450, 0x5ed35617, 0x746fe69f, 0xdb2b74d8, 0x9d3d0433, + 0x32799674, 0x18c526fc, 0xb781b4bb, 0x4dbc47ec, 0xe2f8d5ab, + 0xc8446523, 0x6700f764, 0xe74e85cc, 0x480a178b, 0x62b6a703, + 0xcdf23544, 0x37cfc613, 0x988b5454, 0xb237e4dc, 0x1d73769b, + 0x69da07cd, 0xc69e958a, 0xec222502, 0x4366b745, 0xb95b4412, + 0x161fd655, 0x3ca366dd, 0x93e7f49a, 0x13a98632, 0xbced1475, + 0x9651a4fd, 0x391536ba, 0xc328c5ed, 0x6c6c57aa, 0x46d0e722, + 0xe9947565}, + {0x00000000, 0x4e890ba9, 0x9d121752, 0xd39b1cfb, 0xe15528e5, + 0xafdc234c, 0x7c473fb7, 0x32ce341e, 0x19db578b, 0x57525c22, + 0x84c940d9, 0xca404b70, 0xf88e7f6e, 0xb60774c7, 0x659c683c, + 0x2b156395, 0x33b6af16, 0x7d3fa4bf, 0xaea4b844, 0xe02db3ed, + 0xd2e387f3, 0x9c6a8c5a, 0x4ff190a1, 0x01789b08, 0x2a6df89d, + 0x64e4f334, 0xb77fefcf, 0xf9f6e466, 0xcb38d078, 0x85b1dbd1, + 0x562ac72a, 0x18a3cc83, 0x676d5e2c, 0x29e45585, 0xfa7f497e, + 0xb4f642d7, 0x863876c9, 0xc8b17d60, 0x1b2a619b, 0x55a36a32, + 0x7eb609a7, 0x303f020e, 0xe3a41ef5, 0xad2d155c, 0x9fe32142, + 0xd16a2aeb, 0x02f13610, 0x4c783db9, 0x54dbf13a, 0x1a52fa93, + 0xc9c9e668, 0x8740edc1, 0xb58ed9df, 0xfb07d276, 0x289cce8d, + 0x6615c524, 0x4d00a6b1, 0x0389ad18, 0xd012b1e3, 0x9e9bba4a, + 0xac558e54, 0xe2dc85fd, 0x31479906, 0x7fce92af, 0xcedabc58, + 0x8053b7f1, 0x53c8ab0a, 0x1d41a0a3, 0x2f8f94bd, 0x61069f14, + 0xb29d83ef, 0xfc148846, 0xd701ebd3, 0x9988e07a, 0x4a13fc81, + 0x049af728, 0x3654c336, 0x78ddc89f, 0xab46d464, 0xe5cfdfcd, + 0xfd6c134e, 0xb3e518e7, 0x607e041c, 0x2ef70fb5, 0x1c393bab, + 0x52b03002, 0x812b2cf9, 0xcfa22750, 0xe4b744c5, 0xaa3e4f6c, + 0x79a55397, 0x372c583e, 0x05e26c20, 0x4b6b6789, 0x98f07b72, + 0xd67970db, 0xa9b7e274, 0xe73ee9dd, 0x34a5f526, 0x7a2cfe8f, + 0x48e2ca91, 0x066bc138, 0xd5f0ddc3, 0x9b79d66a, 0xb06cb5ff, + 0xfee5be56, 0x2d7ea2ad, 0x63f7a904, 0x51399d1a, 0x1fb096b3, + 0xcc2b8a48, 0x82a281e1, 0x9a014d62, 0xd48846cb, 0x07135a30, + 0x499a5199, 0x7b546587, 0x35dd6e2e, 0xe64672d5, 0xa8cf797c, + 0x83da1ae9, 0xcd531140, 0x1ec80dbb, 0x50410612, 0x628f320c, + 0x2c0639a5, 0xff9d255e, 0xb1142ef7, 0x46c47ef1, 0x084d7558, + 0xdbd669a3, 0x955f620a, 0xa7915614, 0xe9185dbd, 0x3a834146, + 0x740a4aef, 0x5f1f297a, 0x119622d3, 0xc20d3e28, 0x8c843581, + 0xbe4a019f, 0xf0c30a36, 0x235816cd, 0x6dd11d64, 0x7572d1e7, + 0x3bfbda4e, 0xe860c6b5, 0xa6e9cd1c, 0x9427f902, 0xdaaef2ab, + 0x0935ee50, 0x47bce5f9, 0x6ca9866c, 0x22208dc5, 0xf1bb913e, + 0xbf329a97, 0x8dfcae89, 0xc375a520, 0x10eeb9db, 0x5e67b272, + 0x21a920dd, 0x6f202b74, 0xbcbb378f, 0xf2323c26, 0xc0fc0838, + 0x8e750391, 0x5dee1f6a, 0x136714c3, 0x38727756, 0x76fb7cff, + 0xa5606004, 0xebe96bad, 0xd9275fb3, 0x97ae541a, 0x443548e1, + 0x0abc4348, 0x121f8fcb, 0x5c968462, 0x8f0d9899, 0xc1849330, + 0xf34aa72e, 0xbdc3ac87, 0x6e58b07c, 0x20d1bbd5, 0x0bc4d840, + 0x454dd3e9, 0x96d6cf12, 0xd85fc4bb, 0xea91f0a5, 0xa418fb0c, + 0x7783e7f7, 0x390aec5e, 0x881ec2a9, 0xc697c900, 0x150cd5fb, + 0x5b85de52, 0x694bea4c, 0x27c2e1e5, 0xf459fd1e, 0xbad0f6b7, + 0x91c59522, 0xdf4c9e8b, 0x0cd78270, 0x425e89d9, 0x7090bdc7, + 0x3e19b66e, 0xed82aa95, 0xa30ba13c, 0xbba86dbf, 0xf5216616, + 0x26ba7aed, 0x68337144, 0x5afd455a, 0x14744ef3, 0xc7ef5208, + 0x896659a1, 0xa2733a34, 0xecfa319d, 0x3f612d66, 0x71e826cf, + 0x432612d1, 0x0daf1978, 0xde340583, 0x90bd0e2a, 0xef739c85, + 0xa1fa972c, 0x72618bd7, 0x3ce8807e, 0x0e26b460, 0x40afbfc9, + 0x9334a332, 0xddbda89b, 0xf6a8cb0e, 0xb821c0a7, 0x6bbadc5c, + 0x2533d7f5, 0x17fde3eb, 0x5974e842, 0x8aeff4b9, 0xc466ff10, + 0xdcc53393, 0x924c383a, 0x41d724c1, 0x0f5e2f68, 0x3d901b76, + 0x731910df, 0xa0820c24, 0xee0b078d, 0xc51e6418, 0x8b976fb1, + 0x580c734a, 0x168578e3, 0x244b4cfd, 0x6ac24754, 0xb9595baf, + 0xf7d05006}, + {0x00000000, 0x8d88fde2, 0xc060fd85, 0x4de80067, 0x5bb0fd4b, + 0xd63800a9, 0x9bd000ce, 0x1658fd2c, 0xb761fa96, 0x3ae90774, + 0x77010713, 0xfa89faf1, 0xecd107dd, 0x6159fa3f, 0x2cb1fa58, + 0xa13907ba, 0xb5b2f36d, 0x383a0e8f, 0x75d20ee8, 0xf85af30a, + 0xee020e26, 0x638af3c4, 0x2e62f3a3, 0xa3ea0e41, 0x02d309fb, + 0x8f5bf419, 0xc2b3f47e, 0x4f3b099c, 0x5963f4b0, 0xd4eb0952, + 0x99030935, 0x148bf4d7, 0xb014e09b, 0x3d9c1d79, 0x70741d1e, + 0xfdfce0fc, 0xeba41dd0, 0x662ce032, 0x2bc4e055, 0xa64c1db7, + 0x07751a0d, 0x8afde7ef, 0xc715e788, 0x4a9d1a6a, 0x5cc5e746, + 0xd14d1aa4, 0x9ca51ac3, 0x112de721, 0x05a613f6, 0x882eee14, + 0xc5c6ee73, 0x484e1391, 0x5e16eebd, 0xd39e135f, 0x9e761338, + 0x13feeeda, 0xb2c7e960, 0x3f4f1482, 0x72a714e5, 0xff2fe907, + 0xe977142b, 0x64ffe9c9, 0x2917e9ae, 0xa49f144c, 0xbb58c777, + 0x36d03a95, 0x7b383af2, 0xf6b0c710, 0xe0e83a3c, 0x6d60c7de, + 0x2088c7b9, 0xad003a5b, 0x0c393de1, 0x81b1c003, 0xcc59c064, + 0x41d13d86, 0x5789c0aa, 0xda013d48, 0x97e93d2f, 0x1a61c0cd, + 0x0eea341a, 0x8362c9f8, 0xce8ac99f, 0x4302347d, 0x555ac951, + 0xd8d234b3, 0x953a34d4, 0x18b2c936, 0xb98bce8c, 0x3403336e, + 0x79eb3309, 0xf463ceeb, 0xe23b33c7, 0x6fb3ce25, 0x225bce42, + 0xafd333a0, 0x0b4c27ec, 0x86c4da0e, 0xcb2cda69, 0x46a4278b, + 0x50fcdaa7, 0xdd742745, 0x909c2722, 0x1d14dac0, 0xbc2ddd7a, + 0x31a52098, 0x7c4d20ff, 0xf1c5dd1d, 0xe79d2031, 0x6a15ddd3, + 0x27fdddb4, 0xaa752056, 0xbefed481, 0x33762963, 0x7e9e2904, + 0xf316d4e6, 0xe54e29ca, 0x68c6d428, 0x252ed44f, 0xa8a629ad, + 0x099f2e17, 0x8417d3f5, 0xc9ffd392, 0x44772e70, 0x522fd35c, + 0xdfa72ebe, 0x924f2ed9, 0x1fc7d33b, 0xadc088af, 0x2048754d, + 0x6da0752a, 0xe02888c8, 0xf67075e4, 0x7bf88806, 0x36108861, + 0xbb987583, 0x1aa17239, 0x97298fdb, 0xdac18fbc, 0x5749725e, + 0x41118f72, 0xcc997290, 0x817172f7, 0x0cf98f15, 0x18727bc2, + 0x95fa8620, 0xd8128647, 0x559a7ba5, 0x43c28689, 0xce4a7b6b, + 0x83a27b0c, 0x0e2a86ee, 0xaf138154, 0x229b7cb6, 0x6f737cd1, + 0xe2fb8133, 0xf4a37c1f, 0x792b81fd, 0x34c3819a, 0xb94b7c78, + 0x1dd46834, 0x905c95d6, 0xddb495b1, 0x503c6853, 0x4664957f, + 0xcbec689d, 0x860468fa, 0x0b8c9518, 0xaab592a2, 0x273d6f40, + 0x6ad56f27, 0xe75d92c5, 0xf1056fe9, 0x7c8d920b, 0x3165926c, + 0xbced6f8e, 0xa8669b59, 0x25ee66bb, 0x680666dc, 0xe58e9b3e, + 0xf3d66612, 0x7e5e9bf0, 0x33b69b97, 0xbe3e6675, 0x1f0761cf, + 0x928f9c2d, 0xdf679c4a, 0x52ef61a8, 0x44b79c84, 0xc93f6166, + 0x84d76101, 0x095f9ce3, 0x16984fd8, 0x9b10b23a, 0xd6f8b25d, + 0x5b704fbf, 0x4d28b293, 0xc0a04f71, 0x8d484f16, 0x00c0b2f4, + 0xa1f9b54e, 0x2c7148ac, 0x619948cb, 0xec11b529, 0xfa494805, + 0x77c1b5e7, 0x3a29b580, 0xb7a14862, 0xa32abcb5, 0x2ea24157, + 0x634a4130, 0xeec2bcd2, 0xf89a41fe, 0x7512bc1c, 0x38fabc7b, + 0xb5724199, 0x144b4623, 0x99c3bbc1, 0xd42bbba6, 0x59a34644, + 0x4ffbbb68, 0xc273468a, 0x8f9b46ed, 0x0213bb0f, 0xa68caf43, + 0x2b0452a1, 0x66ec52c6, 0xeb64af24, 0xfd3c5208, 0x70b4afea, + 0x3d5caf8d, 0xb0d4526f, 0x11ed55d5, 0x9c65a837, 0xd18da850, + 0x5c0555b2, 0x4a5da89e, 0xc7d5557c, 0x8a3d551b, 0x07b5a8f9, + 0x133e5c2e, 0x9eb6a1cc, 0xd35ea1ab, 0x5ed65c49, 0x488ea165, + 0xc5065c87, 0x88ee5ce0, 0x0566a102, 0xa45fa6b8, 0x29d75b5a, + 0x643f5b3d, 0xe9b7a6df, 0xffef5bf3, 0x7267a611, 0x3f8fa676, + 0xb2075b94}, + {0x00000000, 0x80f0171f, 0xda91287f, 0x5a613f60, 0x6e5356bf, + 0xeea341a0, 0xb4c27ec0, 0x343269df, 0xdca6ad7e, 0x5c56ba61, + 0x06378501, 0x86c7921e, 0xb2f5fbc1, 0x3205ecde, 0x6864d3be, + 0xe894c4a1, 0x623c5cbd, 0xe2cc4ba2, 0xb8ad74c2, 0x385d63dd, + 0x0c6f0a02, 0x8c9f1d1d, 0xd6fe227d, 0x560e3562, 0xbe9af1c3, + 0x3e6ae6dc, 0x640bd9bc, 0xe4fbcea3, 0xd0c9a77c, 0x5039b063, + 0x0a588f03, 0x8aa8981c, 0xc478b97a, 0x4488ae65, 0x1ee99105, + 0x9e19861a, 0xaa2befc5, 0x2adbf8da, 0x70bac7ba, 0xf04ad0a5, + 0x18de1404, 0x982e031b, 0xc24f3c7b, 0x42bf2b64, 0x768d42bb, + 0xf67d55a4, 0xac1c6ac4, 0x2cec7ddb, 0xa644e5c7, 0x26b4f2d8, + 0x7cd5cdb8, 0xfc25daa7, 0xc817b378, 0x48e7a467, 0x12869b07, + 0x92768c18, 0x7ae248b9, 0xfa125fa6, 0xa07360c6, 0x208377d9, + 0x14b11e06, 0x94410919, 0xce203679, 0x4ed02166, 0x538074b5, + 0xd37063aa, 0x89115cca, 0x09e14bd5, 0x3dd3220a, 0xbd233515, + 0xe7420a75, 0x67b21d6a, 0x8f26d9cb, 0x0fd6ced4, 0x55b7f1b4, + 0xd547e6ab, 0xe1758f74, 0x6185986b, 0x3be4a70b, 0xbb14b014, + 0x31bc2808, 0xb14c3f17, 0xeb2d0077, 0x6bdd1768, 0x5fef7eb7, + 0xdf1f69a8, 0x857e56c8, 0x058e41d7, 0xed1a8576, 0x6dea9269, + 0x378bad09, 0xb77bba16, 0x8349d3c9, 0x03b9c4d6, 0x59d8fbb6, + 0xd928eca9, 0x97f8cdcf, 0x1708dad0, 0x4d69e5b0, 0xcd99f2af, + 0xf9ab9b70, 0x795b8c6f, 0x233ab30f, 0xa3caa410, 0x4b5e60b1, + 0xcbae77ae, 0x91cf48ce, 0x113f5fd1, 0x250d360e, 0xa5fd2111, + 0xff9c1e71, 0x7f6c096e, 0xf5c49172, 0x7534866d, 0x2f55b90d, + 0xafa5ae12, 0x9b97c7cd, 0x1b67d0d2, 0x4106efb2, 0xc1f6f8ad, + 0x29623c0c, 0xa9922b13, 0xf3f31473, 0x7303036c, 0x47316ab3, + 0xc7c17dac, 0x9da042cc, 0x1d5055d3, 0xa700e96a, 0x27f0fe75, + 0x7d91c115, 0xfd61d60a, 0xc953bfd5, 0x49a3a8ca, 0x13c297aa, + 0x933280b5, 0x7ba64414, 0xfb56530b, 0xa1376c6b, 0x21c77b74, + 0x15f512ab, 0x950505b4, 0xcf643ad4, 0x4f942dcb, 0xc53cb5d7, + 0x45cca2c8, 0x1fad9da8, 0x9f5d8ab7, 0xab6fe368, 0x2b9ff477, + 0x71fecb17, 0xf10edc08, 0x199a18a9, 0x996a0fb6, 0xc30b30d6, + 0x43fb27c9, 0x77c94e16, 0xf7395909, 0xad586669, 0x2da87176, + 0x63785010, 0xe388470f, 0xb9e9786f, 0x39196f70, 0x0d2b06af, + 0x8ddb11b0, 0xd7ba2ed0, 0x574a39cf, 0xbfdefd6e, 0x3f2eea71, + 0x654fd511, 0xe5bfc20e, 0xd18dabd1, 0x517dbcce, 0x0b1c83ae, + 0x8bec94b1, 0x01440cad, 0x81b41bb2, 0xdbd524d2, 0x5b2533cd, + 0x6f175a12, 0xefe74d0d, 0xb586726d, 0x35766572, 0xdde2a1d3, + 0x5d12b6cc, 0x077389ac, 0x87839eb3, 0xb3b1f76c, 0x3341e073, + 0x6920df13, 0xe9d0c80c, 0xf4809ddf, 0x74708ac0, 0x2e11b5a0, + 0xaee1a2bf, 0x9ad3cb60, 0x1a23dc7f, 0x4042e31f, 0xc0b2f400, + 0x282630a1, 0xa8d627be, 0xf2b718de, 0x72470fc1, 0x4675661e, + 0xc6857101, 0x9ce44e61, 0x1c14597e, 0x96bcc162, 0x164cd67d, + 0x4c2de91d, 0xccddfe02, 0xf8ef97dd, 0x781f80c2, 0x227ebfa2, + 0xa28ea8bd, 0x4a1a6c1c, 0xcaea7b03, 0x908b4463, 0x107b537c, + 0x24493aa3, 0xa4b92dbc, 0xfed812dc, 0x7e2805c3, 0x30f824a5, + 0xb00833ba, 0xea690cda, 0x6a991bc5, 0x5eab721a, 0xde5b6505, + 0x843a5a65, 0x04ca4d7a, 0xec5e89db, 0x6cae9ec4, 0x36cfa1a4, + 0xb63fb6bb, 0x820ddf64, 0x02fdc87b, 0x589cf71b, 0xd86ce004, + 0x52c47818, 0xd2346f07, 0x88555067, 0x08a54778, 0x3c972ea7, + 0xbc6739b8, 0xe60606d8, 0x66f611c7, 0x8e62d566, 0x0e92c279, + 0x54f3fd19, 0xd403ea06, 0xe03183d9, 0x60c194c6, 0x3aa0aba6, + 0xba50bcb9}, + {0x00000000, 0x9570d495, 0xf190af6b, 0x64e07bfe, 0x38505897, + 0xad208c02, 0xc9c0f7fc, 0x5cb02369, 0x70a0b12e, 0xe5d065bb, + 0x81301e45, 0x1440cad0, 0x48f0e9b9, 0xdd803d2c, 0xb96046d2, + 0x2c109247, 0xe141625c, 0x7431b6c9, 0x10d1cd37, 0x85a119a2, + 0xd9113acb, 0x4c61ee5e, 0x288195a0, 0xbdf14135, 0x91e1d372, + 0x049107e7, 0x60717c19, 0xf501a88c, 0xa9b18be5, 0x3cc15f70, + 0x5821248e, 0xcd51f01b, 0x19f3c2f9, 0x8c83166c, 0xe8636d92, + 0x7d13b907, 0x21a39a6e, 0xb4d34efb, 0xd0333505, 0x4543e190, + 0x695373d7, 0xfc23a742, 0x98c3dcbc, 0x0db30829, 0x51032b40, + 0xc473ffd5, 0xa093842b, 0x35e350be, 0xf8b2a0a5, 0x6dc27430, + 0x09220fce, 0x9c52db5b, 0xc0e2f832, 0x55922ca7, 0x31725759, + 0xa40283cc, 0x8812118b, 0x1d62c51e, 0x7982bee0, 0xecf26a75, + 0xb042491c, 0x25329d89, 0x41d2e677, 0xd4a232e2, 0x33e785f2, + 0xa6975167, 0xc2772a99, 0x5707fe0c, 0x0bb7dd65, 0x9ec709f0, + 0xfa27720e, 0x6f57a69b, 0x434734dc, 0xd637e049, 0xb2d79bb7, + 0x27a74f22, 0x7b176c4b, 0xee67b8de, 0x8a87c320, 0x1ff717b5, + 0xd2a6e7ae, 0x47d6333b, 0x233648c5, 0xb6469c50, 0xeaf6bf39, + 0x7f866bac, 0x1b661052, 0x8e16c4c7, 0xa2065680, 0x37768215, + 0x5396f9eb, 0xc6e62d7e, 0x9a560e17, 0x0f26da82, 0x6bc6a17c, + 0xfeb675e9, 0x2a14470b, 0xbf64939e, 0xdb84e860, 0x4ef43cf5, + 0x12441f9c, 0x8734cb09, 0xe3d4b0f7, 0x76a46462, 0x5ab4f625, + 0xcfc422b0, 0xab24594e, 0x3e548ddb, 0x62e4aeb2, 0xf7947a27, + 0x937401d9, 0x0604d54c, 0xcb552557, 0x5e25f1c2, 0x3ac58a3c, + 0xafb55ea9, 0xf3057dc0, 0x6675a955, 0x0295d2ab, 0x97e5063e, + 0xbbf59479, 0x2e8540ec, 0x4a653b12, 0xdf15ef87, 0x83a5ccee, + 0x16d5187b, 0x72356385, 0xe745b710, 0x67cf0be4, 0xf2bfdf71, + 0x965fa48f, 0x032f701a, 0x5f9f5373, 0xcaef87e6, 0xae0ffc18, + 0x3b7f288d, 0x176fbaca, 0x821f6e5f, 0xe6ff15a1, 0x738fc134, + 0x2f3fe25d, 0xba4f36c8, 0xdeaf4d36, 0x4bdf99a3, 0x868e69b8, + 0x13febd2d, 0x771ec6d3, 0xe26e1246, 0xbede312f, 0x2baee5ba, + 0x4f4e9e44, 0xda3e4ad1, 0xf62ed896, 0x635e0c03, 0x07be77fd, + 0x92cea368, 0xce7e8001, 0x5b0e5494, 0x3fee2f6a, 0xaa9efbff, + 0x7e3cc91d, 0xeb4c1d88, 0x8fac6676, 0x1adcb2e3, 0x466c918a, + 0xd31c451f, 0xb7fc3ee1, 0x228cea74, 0x0e9c7833, 0x9becaca6, + 0xff0cd758, 0x6a7c03cd, 0x36cc20a4, 0xa3bcf431, 0xc75c8fcf, + 0x522c5b5a, 0x9f7dab41, 0x0a0d7fd4, 0x6eed042a, 0xfb9dd0bf, + 0xa72df3d6, 0x325d2743, 0x56bd5cbd, 0xc3cd8828, 0xefdd1a6f, + 0x7aadcefa, 0x1e4db504, 0x8b3d6191, 0xd78d42f8, 0x42fd966d, + 0x261ded93, 0xb36d3906, 0x54288e16, 0xc1585a83, 0xa5b8217d, + 0x30c8f5e8, 0x6c78d681, 0xf9080214, 0x9de879ea, 0x0898ad7f, + 0x24883f38, 0xb1f8ebad, 0xd5189053, 0x406844c6, 0x1cd867af, + 0x89a8b33a, 0xed48c8c4, 0x78381c51, 0xb569ec4a, 0x201938df, + 0x44f94321, 0xd18997b4, 0x8d39b4dd, 0x18496048, 0x7ca91bb6, + 0xe9d9cf23, 0xc5c95d64, 0x50b989f1, 0x3459f20f, 0xa129269a, + 0xfd9905f3, 0x68e9d166, 0x0c09aa98, 0x99797e0d, 0x4ddb4cef, + 0xd8ab987a, 0xbc4be384, 0x293b3711, 0x758b1478, 0xe0fbc0ed, + 0x841bbb13, 0x116b6f86, 0x3d7bfdc1, 0xa80b2954, 0xcceb52aa, + 0x599b863f, 0x052ba556, 0x905b71c3, 0xf4bb0a3d, 0x61cbdea8, + 0xac9a2eb3, 0x39eafa26, 0x5d0a81d8, 0xc87a554d, 0x94ca7624, + 0x01baa2b1, 0x655ad94f, 0xf02a0dda, 0xdc3a9f9d, 0x494a4b08, + 0x2daa30f6, 0xb8dae463, 0xe46ac70a, 0x711a139f, 0x15fa6861, + 0x808abcf4}, + {0x00000000, 0xcf9e17c8, 0x444d29d1, 0x8bd33e19, 0x889a53a2, + 0x4704446a, 0xccd77a73, 0x03496dbb, 0xca45a105, 0x05dbb6cd, + 0x8e0888d4, 0x41969f1c, 0x42dff2a7, 0x8d41e56f, 0x0692db76, + 0xc90cccbe, 0x4ffa444b, 0x80645383, 0x0bb76d9a, 0xc4297a52, + 0xc76017e9, 0x08fe0021, 0x832d3e38, 0x4cb329f0, 0x85bfe54e, + 0x4a21f286, 0xc1f2cc9f, 0x0e6cdb57, 0x0d25b6ec, 0xc2bba124, + 0x49689f3d, 0x86f688f5, 0x9ff48896, 0x506a9f5e, 0xdbb9a147, + 0x1427b68f, 0x176edb34, 0xd8f0ccfc, 0x5323f2e5, 0x9cbde52d, + 0x55b12993, 0x9a2f3e5b, 0x11fc0042, 0xde62178a, 0xdd2b7a31, + 0x12b56df9, 0x996653e0, 0x56f84428, 0xd00eccdd, 0x1f90db15, + 0x9443e50c, 0x5bddf2c4, 0x58949f7f, 0x970a88b7, 0x1cd9b6ae, + 0xd347a166, 0x1a4b6dd8, 0xd5d57a10, 0x5e064409, 0x919853c1, + 0x92d13e7a, 0x5d4f29b2, 0xd69c17ab, 0x19020063, 0xe498176d, + 0x2b0600a5, 0xa0d53ebc, 0x6f4b2974, 0x6c0244cf, 0xa39c5307, + 0x284f6d1e, 0xe7d17ad6, 0x2eddb668, 0xe143a1a0, 0x6a909fb9, + 0xa50e8871, 0xa647e5ca, 0x69d9f202, 0xe20acc1b, 0x2d94dbd3, + 0xab625326, 0x64fc44ee, 0xef2f7af7, 0x20b16d3f, 0x23f80084, + 0xec66174c, 0x67b52955, 0xa82b3e9d, 0x6127f223, 0xaeb9e5eb, + 0x256adbf2, 0xeaf4cc3a, 0xe9bda181, 0x2623b649, 0xadf08850, + 0x626e9f98, 0x7b6c9ffb, 0xb4f28833, 0x3f21b62a, 0xf0bfa1e2, + 0xf3f6cc59, 0x3c68db91, 0xb7bbe588, 0x7825f240, 0xb1293efe, + 0x7eb72936, 0xf564172f, 0x3afa00e7, 0x39b36d5c, 0xf62d7a94, + 0x7dfe448d, 0xb2605345, 0x3496dbb0, 0xfb08cc78, 0x70dbf261, + 0xbf45e5a9, 0xbc0c8812, 0x73929fda, 0xf841a1c3, 0x37dfb60b, + 0xfed37ab5, 0x314d6d7d, 0xba9e5364, 0x750044ac, 0x76492917, + 0xb9d73edf, 0x320400c6, 0xfd9a170e, 0x1241289b, 0xdddf3f53, + 0x560c014a, 0x99921682, 0x9adb7b39, 0x55456cf1, 0xde9652e8, + 0x11084520, 0xd804899e, 0x179a9e56, 0x9c49a04f, 0x53d7b787, + 0x509eda3c, 0x9f00cdf4, 0x14d3f3ed, 0xdb4de425, 0x5dbb6cd0, + 0x92257b18, 0x19f64501, 0xd66852c9, 0xd5213f72, 0x1abf28ba, + 0x916c16a3, 0x5ef2016b, 0x97fecdd5, 0x5860da1d, 0xd3b3e404, + 0x1c2df3cc, 0x1f649e77, 0xd0fa89bf, 0x5b29b7a6, 0x94b7a06e, + 0x8db5a00d, 0x422bb7c5, 0xc9f889dc, 0x06669e14, 0x052ff3af, + 0xcab1e467, 0x4162da7e, 0x8efccdb6, 0x47f00108, 0x886e16c0, + 0x03bd28d9, 0xcc233f11, 0xcf6a52aa, 0x00f44562, 0x8b277b7b, + 0x44b96cb3, 0xc24fe446, 0x0dd1f38e, 0x8602cd97, 0x499cda5f, + 0x4ad5b7e4, 0x854ba02c, 0x0e989e35, 0xc10689fd, 0x080a4543, + 0xc794528b, 0x4c476c92, 0x83d97b5a, 0x809016e1, 0x4f0e0129, + 0xc4dd3f30, 0x0b4328f8, 0xf6d93ff6, 0x3947283e, 0xb2941627, + 0x7d0a01ef, 0x7e436c54, 0xb1dd7b9c, 0x3a0e4585, 0xf590524d, + 0x3c9c9ef3, 0xf302893b, 0x78d1b722, 0xb74fa0ea, 0xb406cd51, + 0x7b98da99, 0xf04be480, 0x3fd5f348, 0xb9237bbd, 0x76bd6c75, + 0xfd6e526c, 0x32f045a4, 0x31b9281f, 0xfe273fd7, 0x75f401ce, + 0xba6a1606, 0x7366dab8, 0xbcf8cd70, 0x372bf369, 0xf8b5e4a1, + 0xfbfc891a, 0x34629ed2, 0xbfb1a0cb, 0x702fb703, 0x692db760, + 0xa6b3a0a8, 0x2d609eb1, 0xe2fe8979, 0xe1b7e4c2, 0x2e29f30a, + 0xa5facd13, 0x6a64dadb, 0xa3681665, 0x6cf601ad, 0xe7253fb4, + 0x28bb287c, 0x2bf245c7, 0xe46c520f, 0x6fbf6c16, 0xa0217bde, + 0x26d7f32b, 0xe949e4e3, 0x629adafa, 0xad04cd32, 0xae4da089, + 0x61d3b741, 0xea008958, 0x259e9e90, 0xec92522e, 0x230c45e6, + 0xa8df7bff, 0x67416c37, 0x6408018c, 0xab961644, 0x2045285d, + 0xefdb3f95}, + {0x00000000, 0x24825136, 0x4904a26c, 0x6d86f35a, 0x920944d8, + 0xb68b15ee, 0xdb0de6b4, 0xff8fb782, 0xff638ff1, 0xdbe1dec7, + 0xb6672d9d, 0x92e57cab, 0x6d6acb29, 0x49e89a1f, 0x246e6945, + 0x00ec3873, 0x25b619a3, 0x01344895, 0x6cb2bbcf, 0x4830eaf9, + 0xb7bf5d7b, 0x933d0c4d, 0xfebbff17, 0xda39ae21, 0xdad59652, + 0xfe57c764, 0x93d1343e, 0xb7536508, 0x48dcd28a, 0x6c5e83bc, + 0x01d870e6, 0x255a21d0, 0x4b6c3346, 0x6fee6270, 0x0268912a, + 0x26eac01c, 0xd965779e, 0xfde726a8, 0x9061d5f2, 0xb4e384c4, + 0xb40fbcb7, 0x908ded81, 0xfd0b1edb, 0xd9894fed, 0x2606f86f, + 0x0284a959, 0x6f025a03, 0x4b800b35, 0x6eda2ae5, 0x4a587bd3, + 0x27de8889, 0x035cd9bf, 0xfcd36e3d, 0xd8513f0b, 0xb5d7cc51, + 0x91559d67, 0x91b9a514, 0xb53bf422, 0xd8bd0778, 0xfc3f564e, + 0x03b0e1cc, 0x2732b0fa, 0x4ab443a0, 0x6e361296, 0x96d8668c, + 0xb25a37ba, 0xdfdcc4e0, 0xfb5e95d6, 0x04d12254, 0x20537362, + 0x4dd58038, 0x6957d10e, 0x69bbe97d, 0x4d39b84b, 0x20bf4b11, + 0x043d1a27, 0xfbb2ada5, 0xdf30fc93, 0xb2b60fc9, 0x96345eff, + 0xb36e7f2f, 0x97ec2e19, 0xfa6add43, 0xdee88c75, 0x21673bf7, + 0x05e56ac1, 0x6863999b, 0x4ce1c8ad, 0x4c0df0de, 0x688fa1e8, + 0x050952b2, 0x218b0384, 0xde04b406, 0xfa86e530, 0x9700166a, + 0xb382475c, 0xddb455ca, 0xf93604fc, 0x94b0f7a6, 0xb032a690, + 0x4fbd1112, 0x6b3f4024, 0x06b9b37e, 0x223be248, 0x22d7da3b, + 0x06558b0d, 0x6bd37857, 0x4f512961, 0xb0de9ee3, 0x945ccfd5, + 0xf9da3c8f, 0xdd586db9, 0xf8024c69, 0xdc801d5f, 0xb106ee05, + 0x9584bf33, 0x6a0b08b1, 0x4e895987, 0x230faadd, 0x078dfbeb, + 0x0761c398, 0x23e392ae, 0x4e6561f4, 0x6ae730c2, 0x95688740, + 0xb1ead676, 0xdc6c252c, 0xf8ee741a, 0xf6c1cb59, 0xd2439a6f, + 0xbfc56935, 0x9b473803, 0x64c88f81, 0x404adeb7, 0x2dcc2ded, + 0x094e7cdb, 0x09a244a8, 0x2d20159e, 0x40a6e6c4, 0x6424b7f2, + 0x9bab0070, 0xbf295146, 0xd2afa21c, 0xf62df32a, 0xd377d2fa, + 0xf7f583cc, 0x9a737096, 0xbef121a0, 0x417e9622, 0x65fcc714, + 0x087a344e, 0x2cf86578, 0x2c145d0b, 0x08960c3d, 0x6510ff67, + 0x4192ae51, 0xbe1d19d3, 0x9a9f48e5, 0xf719bbbf, 0xd39bea89, + 0xbdadf81f, 0x992fa929, 0xf4a95a73, 0xd02b0b45, 0x2fa4bcc7, + 0x0b26edf1, 0x66a01eab, 0x42224f9d, 0x42ce77ee, 0x664c26d8, + 0x0bcad582, 0x2f4884b4, 0xd0c73336, 0xf4456200, 0x99c3915a, + 0xbd41c06c, 0x981be1bc, 0xbc99b08a, 0xd11f43d0, 0xf59d12e6, + 0x0a12a564, 0x2e90f452, 0x43160708, 0x6794563e, 0x67786e4d, + 0x43fa3f7b, 0x2e7ccc21, 0x0afe9d17, 0xf5712a95, 0xd1f37ba3, + 0xbc7588f9, 0x98f7d9cf, 0x6019add5, 0x449bfce3, 0x291d0fb9, + 0x0d9f5e8f, 0xf210e90d, 0xd692b83b, 0xbb144b61, 0x9f961a57, + 0x9f7a2224, 0xbbf87312, 0xd67e8048, 0xf2fcd17e, 0x0d7366fc, + 0x29f137ca, 0x4477c490, 0x60f595a6, 0x45afb476, 0x612de540, + 0x0cab161a, 0x2829472c, 0xd7a6f0ae, 0xf324a198, 0x9ea252c2, + 0xba2003f4, 0xbacc3b87, 0x9e4e6ab1, 0xf3c899eb, 0xd74ac8dd, + 0x28c57f5f, 0x0c472e69, 0x61c1dd33, 0x45438c05, 0x2b759e93, + 0x0ff7cfa5, 0x62713cff, 0x46f36dc9, 0xb97cda4b, 0x9dfe8b7d, + 0xf0787827, 0xd4fa2911, 0xd4161162, 0xf0944054, 0x9d12b30e, + 0xb990e238, 0x461f55ba, 0x629d048c, 0x0f1bf7d6, 0x2b99a6e0, + 0x0ec38730, 0x2a41d606, 0x47c7255c, 0x6345746a, 0x9ccac3e8, + 0xb84892de, 0xd5ce6184, 0xf14c30b2, 0xf1a008c1, 0xd52259f7, + 0xb8a4aaad, 0x9c26fb9b, 0x63a94c19, 0x472b1d2f, 0x2aadee75, + 0x0e2fbf43}, + {0x00000000, 0x36f290f3, 0x6de521e6, 0x5b17b115, 0xdbca43cc, + 0xed38d33f, 0xb62f622a, 0x80ddf2d9, 0x6ce581d9, 0x5a17112a, + 0x0100a03f, 0x37f230cc, 0xb72fc215, 0x81dd52e6, 0xdacae3f3, + 0xec387300, 0xd9cb03b2, 0xef399341, 0xb42e2254, 0x82dcb2a7, + 0x0201407e, 0x34f3d08d, 0x6fe46198, 0x5916f16b, 0xb52e826b, + 0x83dc1298, 0xd8cba38d, 0xee39337e, 0x6ee4c1a7, 0x58165154, + 0x0301e041, 0x35f370b2, 0x68e70125, 0x5e1591d6, 0x050220c3, + 0x33f0b030, 0xb32d42e9, 0x85dfd21a, 0xdec8630f, 0xe83af3fc, + 0x040280fc, 0x32f0100f, 0x69e7a11a, 0x5f1531e9, 0xdfc8c330, + 0xe93a53c3, 0xb22de2d6, 0x84df7225, 0xb12c0297, 0x87de9264, + 0xdcc92371, 0xea3bb382, 0x6ae6415b, 0x5c14d1a8, 0x070360bd, + 0x31f1f04e, 0xddc9834e, 0xeb3b13bd, 0xb02ca2a8, 0x86de325b, + 0x0603c082, 0x30f15071, 0x6be6e164, 0x5d147197, 0xd1ce024a, + 0xe73c92b9, 0xbc2b23ac, 0x8ad9b35f, 0x0a044186, 0x3cf6d175, + 0x67e16060, 0x5113f093, 0xbd2b8393, 0x8bd91360, 0xd0cea275, + 0xe63c3286, 0x66e1c05f, 0x501350ac, 0x0b04e1b9, 0x3df6714a, + 0x080501f8, 0x3ef7910b, 0x65e0201e, 0x5312b0ed, 0xd3cf4234, + 0xe53dd2c7, 0xbe2a63d2, 0x88d8f321, 0x64e08021, 0x521210d2, + 0x0905a1c7, 0x3ff73134, 0xbf2ac3ed, 0x89d8531e, 0xd2cfe20b, + 0xe43d72f8, 0xb929036f, 0x8fdb939c, 0xd4cc2289, 0xe23eb27a, + 0x62e340a3, 0x5411d050, 0x0f066145, 0x39f4f1b6, 0xd5cc82b6, + 0xe33e1245, 0xb829a350, 0x8edb33a3, 0x0e06c17a, 0x38f45189, + 0x63e3e09c, 0x5511706f, 0x60e200dd, 0x5610902e, 0x0d07213b, + 0x3bf5b1c8, 0xbb284311, 0x8ddad3e2, 0xd6cd62f7, 0xe03ff204, + 0x0c078104, 0x3af511f7, 0x61e2a0e2, 0x57103011, 0xd7cdc2c8, + 0xe13f523b, 0xba28e32e, 0x8cda73dd, 0x78ed02d5, 0x4e1f9226, + 0x15082333, 0x23fab3c0, 0xa3274119, 0x95d5d1ea, 0xcec260ff, + 0xf830f00c, 0x1408830c, 0x22fa13ff, 0x79eda2ea, 0x4f1f3219, + 0xcfc2c0c0, 0xf9305033, 0xa227e126, 0x94d571d5, 0xa1260167, + 0x97d49194, 0xccc32081, 0xfa31b072, 0x7aec42ab, 0x4c1ed258, + 0x1709634d, 0x21fbf3be, 0xcdc380be, 0xfb31104d, 0xa026a158, + 0x96d431ab, 0x1609c372, 0x20fb5381, 0x7bece294, 0x4d1e7267, + 0x100a03f0, 0x26f89303, 0x7def2216, 0x4b1db2e5, 0xcbc0403c, + 0xfd32d0cf, 0xa62561da, 0x90d7f129, 0x7cef8229, 0x4a1d12da, + 0x110aa3cf, 0x27f8333c, 0xa725c1e5, 0x91d75116, 0xcac0e003, + 0xfc3270f0, 0xc9c10042, 0xff3390b1, 0xa42421a4, 0x92d6b157, + 0x120b438e, 0x24f9d37d, 0x7fee6268, 0x491cf29b, 0xa524819b, + 0x93d61168, 0xc8c1a07d, 0xfe33308e, 0x7eeec257, 0x481c52a4, + 0x130be3b1, 0x25f97342, 0xa923009f, 0x9fd1906c, 0xc4c62179, + 0xf234b18a, 0x72e94353, 0x441bd3a0, 0x1f0c62b5, 0x29fef246, + 0xc5c68146, 0xf33411b5, 0xa823a0a0, 0x9ed13053, 0x1e0cc28a, + 0x28fe5279, 0x73e9e36c, 0x451b739f, 0x70e8032d, 0x461a93de, + 0x1d0d22cb, 0x2bffb238, 0xab2240e1, 0x9dd0d012, 0xc6c76107, + 0xf035f1f4, 0x1c0d82f4, 0x2aff1207, 0x71e8a312, 0x471a33e1, + 0xc7c7c138, 0xf13551cb, 0xaa22e0de, 0x9cd0702d, 0xc1c401ba, + 0xf7369149, 0xac21205c, 0x9ad3b0af, 0x1a0e4276, 0x2cfcd285, + 0x77eb6390, 0x4119f363, 0xad218063, 0x9bd31090, 0xc0c4a185, + 0xf6363176, 0x76ebc3af, 0x4019535c, 0x1b0ee249, 0x2dfc72ba, + 0x180f0208, 0x2efd92fb, 0x75ea23ee, 0x4318b31d, 0xc3c541c4, + 0xf537d137, 0xae206022, 0x98d2f0d1, 0x74ea83d1, 0x42181322, + 0x190fa237, 0x2ffd32c4, 0xaf20c01d, 0x99d250ee, 0xc2c5e1fb, + 0xf4377108}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0xf390f23600000000, 0xe621e56d00000000, + 0x15b1175b00000000, 0xcc43cadb00000000, 0x3fd338ed00000000, + 0x2a622fb600000000, 0xd9f2dd8000000000, 0xd981e56c00000000, + 0x2a11175a00000000, 0x3fa0000100000000, 0xcc30f23700000000, + 0x15c22fb700000000, 0xe652dd8100000000, 0xf3e3cada00000000, + 0x007338ec00000000, 0xb203cbd900000000, 0x419339ef00000000, + 0x54222eb400000000, 0xa7b2dc8200000000, 0x7e40010200000000, + 0x8dd0f33400000000, 0x9861e46f00000000, 0x6bf1165900000000, + 0x6b822eb500000000, 0x9812dc8300000000, 0x8da3cbd800000000, + 0x7e3339ee00000000, 0xa7c1e46e00000000, 0x5451165800000000, + 0x41e0010300000000, 0xb270f33500000000, 0x2501e76800000000, + 0xd691155e00000000, 0xc320020500000000, 0x30b0f03300000000, + 0xe9422db300000000, 0x1ad2df8500000000, 0x0f63c8de00000000, + 0xfcf33ae800000000, 0xfc80020400000000, 0x0f10f03200000000, + 0x1aa1e76900000000, 0xe931155f00000000, 0x30c3c8df00000000, + 0xc3533ae900000000, 0xd6e22db200000000, 0x2572df8400000000, + 0x97022cb100000000, 0x6492de8700000000, 0x7123c9dc00000000, + 0x82b33bea00000000, 0x5b41e66a00000000, 0xa8d1145c00000000, + 0xbd60030700000000, 0x4ef0f13100000000, 0x4e83c9dd00000000, + 0xbd133beb00000000, 0xa8a22cb000000000, 0x5b32de8600000000, + 0x82c0030600000000, 0x7150f13000000000, 0x64e1e66b00000000, + 0x9771145d00000000, 0x4a02ced100000000, 0xb9923ce700000000, + 0xac232bbc00000000, 0x5fb3d98a00000000, 0x8641040a00000000, + 0x75d1f63c00000000, 0x6060e16700000000, 0x93f0135100000000, + 0x93832bbd00000000, 0x6013d98b00000000, 0x75a2ced000000000, + 0x86323ce600000000, 0x5fc0e16600000000, 0xac50135000000000, + 0xb9e1040b00000000, 0x4a71f63d00000000, 0xf801050800000000, + 0x0b91f73e00000000, 0x1e20e06500000000, 0xedb0125300000000, + 0x3442cfd300000000, 0xc7d23de500000000, 0xd2632abe00000000, + 0x21f3d88800000000, 0x2180e06400000000, 0xd210125200000000, + 0xc7a1050900000000, 0x3431f73f00000000, 0xedc32abf00000000, + 0x1e53d88900000000, 0x0be2cfd200000000, 0xf8723de400000000, + 0x6f0329b900000000, 0x9c93db8f00000000, 0x8922ccd400000000, + 0x7ab23ee200000000, 0xa340e36200000000, 0x50d0115400000000, + 0x4561060f00000000, 0xb6f1f43900000000, 0xb682ccd500000000, + 0x45123ee300000000, 0x50a329b800000000, 0xa333db8e00000000, + 0x7ac1060e00000000, 0x8951f43800000000, 0x9ce0e36300000000, + 0x6f70115500000000, 0xdd00e26000000000, 0x2e90105600000000, + 0x3b21070d00000000, 0xc8b1f53b00000000, 0x114328bb00000000, + 0xe2d3da8d00000000, 0xf762cdd600000000, 0x04f23fe000000000, + 0x0481070c00000000, 0xf711f53a00000000, 0xe2a0e26100000000, + 0x1130105700000000, 0xc8c2cdd700000000, 0x3b523fe100000000, + 0x2ee328ba00000000, 0xdd73da8c00000000, 0xd502ed7800000000, + 0x26921f4e00000000, 0x3323081500000000, 0xc0b3fa2300000000, + 0x194127a300000000, 0xead1d59500000000, 0xff60c2ce00000000, + 0x0cf030f800000000, 0x0c83081400000000, 0xff13fa2200000000, + 0xeaa2ed7900000000, 0x19321f4f00000000, 0xc0c0c2cf00000000, + 0x335030f900000000, 0x26e127a200000000, 0xd571d59400000000, + 0x670126a100000000, 0x9491d49700000000, 0x8120c3cc00000000, + 0x72b031fa00000000, 0xab42ec7a00000000, 0x58d21e4c00000000, + 0x4d63091700000000, 0xbef3fb2100000000, 0xbe80c3cd00000000, + 0x4d1031fb00000000, 0x58a126a000000000, 0xab31d49600000000, + 0x72c3091600000000, 0x8153fb2000000000, 0x94e2ec7b00000000, + 0x67721e4d00000000, 0xf0030a1000000000, 0x0393f82600000000, + 0x1622ef7d00000000, 0xe5b21d4b00000000, 0x3c40c0cb00000000, + 0xcfd032fd00000000, 0xda6125a600000000, 0x29f1d79000000000, + 0x2982ef7c00000000, 0xda121d4a00000000, 0xcfa30a1100000000, + 0x3c33f82700000000, 0xe5c125a700000000, 0x1651d79100000000, + 0x03e0c0ca00000000, 0xf07032fc00000000, 0x4200c1c900000000, + 0xb19033ff00000000, 0xa42124a400000000, 0x57b1d69200000000, + 0x8e430b1200000000, 0x7dd3f92400000000, 0x6862ee7f00000000, + 0x9bf21c4900000000, 0x9b8124a500000000, 0x6811d69300000000, + 0x7da0c1c800000000, 0x8e3033fe00000000, 0x57c2ee7e00000000, + 0xa4521c4800000000, 0xb1e30b1300000000, 0x4273f92500000000, + 0x9f0023a900000000, 0x6c90d19f00000000, 0x7921c6c400000000, + 0x8ab134f200000000, 0x5343e97200000000, 0xa0d31b4400000000, + 0xb5620c1f00000000, 0x46f2fe2900000000, 0x4681c6c500000000, + 0xb51134f300000000, 0xa0a023a800000000, 0x5330d19e00000000, + 0x8ac20c1e00000000, 0x7952fe2800000000, 0x6ce3e97300000000, + 0x9f731b4500000000, 0x2d03e87000000000, 0xde931a4600000000, + 0xcb220d1d00000000, 0x38b2ff2b00000000, 0xe14022ab00000000, + 0x12d0d09d00000000, 0x0761c7c600000000, 0xf4f135f000000000, + 0xf4820d1c00000000, 0x0712ff2a00000000, 0x12a3e87100000000, + 0xe1331a4700000000, 0x38c1c7c700000000, 0xcb5135f100000000, + 0xdee022aa00000000, 0x2d70d09c00000000, 0xba01c4c100000000, + 0x499136f700000000, 0x5c2021ac00000000, 0xafb0d39a00000000, + 0x76420e1a00000000, 0x85d2fc2c00000000, 0x9063eb7700000000, + 0x63f3194100000000, 0x638021ad00000000, 0x9010d39b00000000, + 0x85a1c4c000000000, 0x763136f600000000, 0xafc3eb7600000000, + 0x5c53194000000000, 0x49e20e1b00000000, 0xba72fc2d00000000, + 0x08020f1800000000, 0xfb92fd2e00000000, 0xee23ea7500000000, + 0x1db3184300000000, 0xc441c5c300000000, 0x37d137f500000000, + 0x226020ae00000000, 0xd1f0d29800000000, 0xd183ea7400000000, + 0x2213184200000000, 0x37a20f1900000000, 0xc432fd2f00000000, + 0x1dc020af00000000, 0xee50d29900000000, 0xfbe1c5c200000000, + 0x087137f400000000}, + {0x0000000000000000, 0x3651822400000000, 0x6ca2044900000000, + 0x5af3866d00000000, 0xd844099200000000, 0xee158bb600000000, + 0xb4e60ddb00000000, 0x82b78fff00000000, 0xf18f63ff00000000, + 0xc7dee1db00000000, 0x9d2d67b600000000, 0xab7ce59200000000, + 0x29cb6a6d00000000, 0x1f9ae84900000000, 0x45696e2400000000, + 0x7338ec0000000000, 0xa319b62500000000, 0x9548340100000000, + 0xcfbbb26c00000000, 0xf9ea304800000000, 0x7b5dbfb700000000, + 0x4d0c3d9300000000, 0x17ffbbfe00000000, 0x21ae39da00000000, + 0x5296d5da00000000, 0x64c757fe00000000, 0x3e34d19300000000, + 0x086553b700000000, 0x8ad2dc4800000000, 0xbc835e6c00000000, + 0xe670d80100000000, 0xd0215a2500000000, 0x46336c4b00000000, + 0x7062ee6f00000000, 0x2a91680200000000, 0x1cc0ea2600000000, + 0x9e7765d900000000, 0xa826e7fd00000000, 0xf2d5619000000000, + 0xc484e3b400000000, 0xb7bc0fb400000000, 0x81ed8d9000000000, + 0xdb1e0bfd00000000, 0xed4f89d900000000, 0x6ff8062600000000, + 0x59a9840200000000, 0x035a026f00000000, 0x350b804b00000000, + 0xe52ada6e00000000, 0xd37b584a00000000, 0x8988de2700000000, + 0xbfd95c0300000000, 0x3d6ed3fc00000000, 0x0b3f51d800000000, + 0x51ccd7b500000000, 0x679d559100000000, 0x14a5b99100000000, + 0x22f43bb500000000, 0x7807bdd800000000, 0x4e563ffc00000000, + 0xcce1b00300000000, 0xfab0322700000000, 0xa043b44a00000000, + 0x9612366e00000000, 0x8c66d89600000000, 0xba375ab200000000, + 0xe0c4dcdf00000000, 0xd6955efb00000000, 0x5422d10400000000, + 0x6273532000000000, 0x3880d54d00000000, 0x0ed1576900000000, + 0x7de9bb6900000000, 0x4bb8394d00000000, 0x114bbf2000000000, + 0x271a3d0400000000, 0xa5adb2fb00000000, 0x93fc30df00000000, + 0xc90fb6b200000000, 0xff5e349600000000, 0x2f7f6eb300000000, + 0x192eec9700000000, 0x43dd6afa00000000, 0x758ce8de00000000, + 0xf73b672100000000, 0xc16ae50500000000, 0x9b99636800000000, + 0xadc8e14c00000000, 0xdef00d4c00000000, 0xe8a18f6800000000, + 0xb252090500000000, 0x84038b2100000000, 0x06b404de00000000, + 0x30e586fa00000000, 0x6a16009700000000, 0x5c4782b300000000, + 0xca55b4dd00000000, 0xfc0436f900000000, 0xa6f7b09400000000, + 0x90a632b000000000, 0x1211bd4f00000000, 0x24403f6b00000000, + 0x7eb3b90600000000, 0x48e23b2200000000, 0x3bdad72200000000, + 0x0d8b550600000000, 0x5778d36b00000000, 0x6129514f00000000, + 0xe39edeb000000000, 0xd5cf5c9400000000, 0x8f3cdaf900000000, + 0xb96d58dd00000000, 0x694c02f800000000, 0x5f1d80dc00000000, + 0x05ee06b100000000, 0x33bf849500000000, 0xb1080b6a00000000, + 0x8759894e00000000, 0xddaa0f2300000000, 0xebfb8d0700000000, + 0x98c3610700000000, 0xae92e32300000000, 0xf461654e00000000, + 0xc230e76a00000000, 0x4087689500000000, 0x76d6eab100000000, + 0x2c256cdc00000000, 0x1a74eef800000000, 0x59cbc1f600000000, + 0x6f9a43d200000000, 0x3569c5bf00000000, 0x0338479b00000000, + 0x818fc86400000000, 0xb7de4a4000000000, 0xed2dcc2d00000000, + 0xdb7c4e0900000000, 0xa844a20900000000, 0x9e15202d00000000, + 0xc4e6a64000000000, 0xf2b7246400000000, 0x7000ab9b00000000, + 0x465129bf00000000, 0x1ca2afd200000000, 0x2af32df600000000, + 0xfad277d300000000, 0xcc83f5f700000000, 0x9670739a00000000, + 0xa021f1be00000000, 0x22967e4100000000, 0x14c7fc6500000000, + 0x4e347a0800000000, 0x7865f82c00000000, 0x0b5d142c00000000, + 0x3d0c960800000000, 0x67ff106500000000, 0x51ae924100000000, + 0xd3191dbe00000000, 0xe5489f9a00000000, 0xbfbb19f700000000, + 0x89ea9bd300000000, 0x1ff8adbd00000000, 0x29a92f9900000000, + 0x735aa9f400000000, 0x450b2bd000000000, 0xc7bca42f00000000, + 0xf1ed260b00000000, 0xab1ea06600000000, 0x9d4f224200000000, + 0xee77ce4200000000, 0xd8264c6600000000, 0x82d5ca0b00000000, + 0xb484482f00000000, 0x3633c7d000000000, 0x006245f400000000, + 0x5a91c39900000000, 0x6cc041bd00000000, 0xbce11b9800000000, + 0x8ab099bc00000000, 0xd0431fd100000000, 0xe6129df500000000, + 0x64a5120a00000000, 0x52f4902e00000000, 0x0807164300000000, + 0x3e56946700000000, 0x4d6e786700000000, 0x7b3ffa4300000000, + 0x21cc7c2e00000000, 0x179dfe0a00000000, 0x952a71f500000000, + 0xa37bf3d100000000, 0xf98875bc00000000, 0xcfd9f79800000000, + 0xd5ad196000000000, 0xe3fc9b4400000000, 0xb90f1d2900000000, + 0x8f5e9f0d00000000, 0x0de910f200000000, 0x3bb892d600000000, + 0x614b14bb00000000, 0x571a969f00000000, 0x24227a9f00000000, + 0x1273f8bb00000000, 0x48807ed600000000, 0x7ed1fcf200000000, + 0xfc66730d00000000, 0xca37f12900000000, 0x90c4774400000000, + 0xa695f56000000000, 0x76b4af4500000000, 0x40e52d6100000000, + 0x1a16ab0c00000000, 0x2c47292800000000, 0xaef0a6d700000000, + 0x98a124f300000000, 0xc252a29e00000000, 0xf40320ba00000000, + 0x873bccba00000000, 0xb16a4e9e00000000, 0xeb99c8f300000000, + 0xddc84ad700000000, 0x5f7fc52800000000, 0x692e470c00000000, + 0x33ddc16100000000, 0x058c434500000000, 0x939e752b00000000, + 0xa5cff70f00000000, 0xff3c716200000000, 0xc96df34600000000, + 0x4bda7cb900000000, 0x7d8bfe9d00000000, 0x277878f000000000, + 0x1129fad400000000, 0x621116d400000000, 0x544094f000000000, + 0x0eb3129d00000000, 0x38e290b900000000, 0xba551f4600000000, + 0x8c049d6200000000, 0xd6f71b0f00000000, 0xe0a6992b00000000, + 0x3087c30e00000000, 0x06d6412a00000000, 0x5c25c74700000000, + 0x6a74456300000000, 0xe8c3ca9c00000000, 0xde9248b800000000, + 0x8461ced500000000, 0xb2304cf100000000, 0xc108a0f100000000, + 0xf75922d500000000, 0xadaaa4b800000000, 0x9bfb269c00000000, + 0x194ca96300000000, 0x2f1d2b4700000000, 0x75eead2a00000000, + 0x43bf2f0e00000000}, + {0x0000000000000000, 0xc8179ecf00000000, 0xd1294d4400000000, + 0x193ed38b00000000, 0xa2539a8800000000, 0x6a44044700000000, + 0x737ad7cc00000000, 0xbb6d490300000000, 0x05a145ca00000000, + 0xcdb6db0500000000, 0xd488088e00000000, 0x1c9f964100000000, + 0xa7f2df4200000000, 0x6fe5418d00000000, 0x76db920600000000, + 0xbecc0cc900000000, 0x4b44fa4f00000000, 0x8353648000000000, + 0x9a6db70b00000000, 0x527a29c400000000, 0xe91760c700000000, + 0x2100fe0800000000, 0x383e2d8300000000, 0xf029b34c00000000, + 0x4ee5bf8500000000, 0x86f2214a00000000, 0x9fccf2c100000000, + 0x57db6c0e00000000, 0xecb6250d00000000, 0x24a1bbc200000000, + 0x3d9f684900000000, 0xf588f68600000000, 0x9688f49f00000000, + 0x5e9f6a5000000000, 0x47a1b9db00000000, 0x8fb6271400000000, + 0x34db6e1700000000, 0xfcccf0d800000000, 0xe5f2235300000000, + 0x2de5bd9c00000000, 0x9329b15500000000, 0x5b3e2f9a00000000, + 0x4200fc1100000000, 0x8a1762de00000000, 0x317a2bdd00000000, + 0xf96db51200000000, 0xe053669900000000, 0x2844f85600000000, + 0xddcc0ed000000000, 0x15db901f00000000, 0x0ce5439400000000, + 0xc4f2dd5b00000000, 0x7f9f945800000000, 0xb7880a9700000000, + 0xaeb6d91c00000000, 0x66a147d300000000, 0xd86d4b1a00000000, + 0x107ad5d500000000, 0x0944065e00000000, 0xc153989100000000, + 0x7a3ed19200000000, 0xb2294f5d00000000, 0xab179cd600000000, + 0x6300021900000000, 0x6d1798e400000000, 0xa500062b00000000, + 0xbc3ed5a000000000, 0x74294b6f00000000, 0xcf44026c00000000, + 0x07539ca300000000, 0x1e6d4f2800000000, 0xd67ad1e700000000, + 0x68b6dd2e00000000, 0xa0a143e100000000, 0xb99f906a00000000, + 0x71880ea500000000, 0xcae547a600000000, 0x02f2d96900000000, + 0x1bcc0ae200000000, 0xd3db942d00000000, 0x265362ab00000000, + 0xee44fc6400000000, 0xf77a2fef00000000, 0x3f6db12000000000, + 0x8400f82300000000, 0x4c1766ec00000000, 0x5529b56700000000, + 0x9d3e2ba800000000, 0x23f2276100000000, 0xebe5b9ae00000000, + 0xf2db6a2500000000, 0x3accf4ea00000000, 0x81a1bde900000000, + 0x49b6232600000000, 0x5088f0ad00000000, 0x989f6e6200000000, + 0xfb9f6c7b00000000, 0x3388f2b400000000, 0x2ab6213f00000000, + 0xe2a1bff000000000, 0x59ccf6f300000000, 0x91db683c00000000, + 0x88e5bbb700000000, 0x40f2257800000000, 0xfe3e29b100000000, + 0x3629b77e00000000, 0x2f1764f500000000, 0xe700fa3a00000000, + 0x5c6db33900000000, 0x947a2df600000000, 0x8d44fe7d00000000, + 0x455360b200000000, 0xb0db963400000000, 0x78cc08fb00000000, + 0x61f2db7000000000, 0xa9e545bf00000000, 0x12880cbc00000000, + 0xda9f927300000000, 0xc3a141f800000000, 0x0bb6df3700000000, + 0xb57ad3fe00000000, 0x7d6d4d3100000000, 0x64539eba00000000, + 0xac44007500000000, 0x1729497600000000, 0xdf3ed7b900000000, + 0xc600043200000000, 0x0e179afd00000000, 0x9b28411200000000, + 0x533fdfdd00000000, 0x4a010c5600000000, 0x8216929900000000, + 0x397bdb9a00000000, 0xf16c455500000000, 0xe85296de00000000, + 0x2045081100000000, 0x9e8904d800000000, 0x569e9a1700000000, + 0x4fa0499c00000000, 0x87b7d75300000000, 0x3cda9e5000000000, + 0xf4cd009f00000000, 0xedf3d31400000000, 0x25e44ddb00000000, + 0xd06cbb5d00000000, 0x187b259200000000, 0x0145f61900000000, + 0xc95268d600000000, 0x723f21d500000000, 0xba28bf1a00000000, + 0xa3166c9100000000, 0x6b01f25e00000000, 0xd5cdfe9700000000, + 0x1dda605800000000, 0x04e4b3d300000000, 0xccf32d1c00000000, + 0x779e641f00000000, 0xbf89fad000000000, 0xa6b7295b00000000, + 0x6ea0b79400000000, 0x0da0b58d00000000, 0xc5b72b4200000000, + 0xdc89f8c900000000, 0x149e660600000000, 0xaff32f0500000000, + 0x67e4b1ca00000000, 0x7eda624100000000, 0xb6cdfc8e00000000, + 0x0801f04700000000, 0xc0166e8800000000, 0xd928bd0300000000, + 0x113f23cc00000000, 0xaa526acf00000000, 0x6245f40000000000, + 0x7b7b278b00000000, 0xb36cb94400000000, 0x46e44fc200000000, + 0x8ef3d10d00000000, 0x97cd028600000000, 0x5fda9c4900000000, + 0xe4b7d54a00000000, 0x2ca04b8500000000, 0x359e980e00000000, + 0xfd8906c100000000, 0x43450a0800000000, 0x8b5294c700000000, + 0x926c474c00000000, 0x5a7bd98300000000, 0xe116908000000000, + 0x29010e4f00000000, 0x303fddc400000000, 0xf828430b00000000, + 0xf63fd9f600000000, 0x3e28473900000000, 0x271694b200000000, + 0xef010a7d00000000, 0x546c437e00000000, 0x9c7bddb100000000, + 0x85450e3a00000000, 0x4d5290f500000000, 0xf39e9c3c00000000, + 0x3b8902f300000000, 0x22b7d17800000000, 0xeaa04fb700000000, + 0x51cd06b400000000, 0x99da987b00000000, 0x80e44bf000000000, + 0x48f3d53f00000000, 0xbd7b23b900000000, 0x756cbd7600000000, + 0x6c526efd00000000, 0xa445f03200000000, 0x1f28b93100000000, + 0xd73f27fe00000000, 0xce01f47500000000, 0x06166aba00000000, + 0xb8da667300000000, 0x70cdf8bc00000000, 0x69f32b3700000000, + 0xa1e4b5f800000000, 0x1a89fcfb00000000, 0xd29e623400000000, + 0xcba0b1bf00000000, 0x03b72f7000000000, 0x60b72d6900000000, + 0xa8a0b3a600000000, 0xb19e602d00000000, 0x7989fee200000000, + 0xc2e4b7e100000000, 0x0af3292e00000000, 0x13cdfaa500000000, + 0xdbda646a00000000, 0x651668a300000000, 0xad01f66c00000000, + 0xb43f25e700000000, 0x7c28bb2800000000, 0xc745f22b00000000, + 0x0f526ce400000000, 0x166cbf6f00000000, 0xde7b21a000000000, + 0x2bf3d72600000000, 0xe3e449e900000000, 0xfada9a6200000000, + 0x32cd04ad00000000, 0x89a04dae00000000, 0x41b7d36100000000, + 0x588900ea00000000, 0x909e9e2500000000, 0x2e5292ec00000000, + 0xe6450c2300000000, 0xff7bdfa800000000, 0x376c416700000000, + 0x8c01086400000000, 0x441696ab00000000, 0x5d28452000000000, + 0x953fdbef00000000}, + {0x0000000000000000, 0x95d4709500000000, 0x6baf90f100000000, + 0xfe7be06400000000, 0x9758503800000000, 0x028c20ad00000000, + 0xfcf7c0c900000000, 0x6923b05c00000000, 0x2eb1a07000000000, + 0xbb65d0e500000000, 0x451e308100000000, 0xd0ca401400000000, + 0xb9e9f04800000000, 0x2c3d80dd00000000, 0xd24660b900000000, + 0x4792102c00000000, 0x5c6241e100000000, 0xc9b6317400000000, + 0x37cdd11000000000, 0xa219a18500000000, 0xcb3a11d900000000, + 0x5eee614c00000000, 0xa095812800000000, 0x3541f1bd00000000, + 0x72d3e19100000000, 0xe707910400000000, 0x197c716000000000, + 0x8ca801f500000000, 0xe58bb1a900000000, 0x705fc13c00000000, + 0x8e24215800000000, 0x1bf051cd00000000, 0xf9c2f31900000000, + 0x6c16838c00000000, 0x926d63e800000000, 0x07b9137d00000000, + 0x6e9aa32100000000, 0xfb4ed3b400000000, 0x053533d000000000, + 0x90e1434500000000, 0xd773536900000000, 0x42a723fc00000000, + 0xbcdcc39800000000, 0x2908b30d00000000, 0x402b035100000000, + 0xd5ff73c400000000, 0x2b8493a000000000, 0xbe50e33500000000, + 0xa5a0b2f800000000, 0x3074c26d00000000, 0xce0f220900000000, + 0x5bdb529c00000000, 0x32f8e2c000000000, 0xa72c925500000000, + 0x5957723100000000, 0xcc8302a400000000, 0x8b11128800000000, + 0x1ec5621d00000000, 0xe0be827900000000, 0x756af2ec00000000, + 0x1c4942b000000000, 0x899d322500000000, 0x77e6d24100000000, + 0xe232a2d400000000, 0xf285e73300000000, 0x675197a600000000, + 0x992a77c200000000, 0x0cfe075700000000, 0x65ddb70b00000000, + 0xf009c79e00000000, 0x0e7227fa00000000, 0x9ba6576f00000000, + 0xdc34474300000000, 0x49e037d600000000, 0xb79bd7b200000000, + 0x224fa72700000000, 0x4b6c177b00000000, 0xdeb867ee00000000, + 0x20c3878a00000000, 0xb517f71f00000000, 0xaee7a6d200000000, + 0x3b33d64700000000, 0xc548362300000000, 0x509c46b600000000, + 0x39bff6ea00000000, 0xac6b867f00000000, 0x5210661b00000000, + 0xc7c4168e00000000, 0x805606a200000000, 0x1582763700000000, + 0xebf9965300000000, 0x7e2de6c600000000, 0x170e569a00000000, + 0x82da260f00000000, 0x7ca1c66b00000000, 0xe975b6fe00000000, + 0x0b47142a00000000, 0x9e9364bf00000000, 0x60e884db00000000, + 0xf53cf44e00000000, 0x9c1f441200000000, 0x09cb348700000000, + 0xf7b0d4e300000000, 0x6264a47600000000, 0x25f6b45a00000000, + 0xb022c4cf00000000, 0x4e5924ab00000000, 0xdb8d543e00000000, + 0xb2aee46200000000, 0x277a94f700000000, 0xd901749300000000, + 0x4cd5040600000000, 0x572555cb00000000, 0xc2f1255e00000000, + 0x3c8ac53a00000000, 0xa95eb5af00000000, 0xc07d05f300000000, + 0x55a9756600000000, 0xabd2950200000000, 0x3e06e59700000000, + 0x7994f5bb00000000, 0xec40852e00000000, 0x123b654a00000000, + 0x87ef15df00000000, 0xeecca58300000000, 0x7b18d51600000000, + 0x8563357200000000, 0x10b745e700000000, 0xe40bcf6700000000, + 0x71dfbff200000000, 0x8fa45f9600000000, 0x1a702f0300000000, + 0x73539f5f00000000, 0xe687efca00000000, 0x18fc0fae00000000, + 0x8d287f3b00000000, 0xcaba6f1700000000, 0x5f6e1f8200000000, + 0xa115ffe600000000, 0x34c18f7300000000, 0x5de23f2f00000000, + 0xc8364fba00000000, 0x364dafde00000000, 0xa399df4b00000000, + 0xb8698e8600000000, 0x2dbdfe1300000000, 0xd3c61e7700000000, + 0x46126ee200000000, 0x2f31debe00000000, 0xbae5ae2b00000000, + 0x449e4e4f00000000, 0xd14a3eda00000000, 0x96d82ef600000000, + 0x030c5e6300000000, 0xfd77be0700000000, 0x68a3ce9200000000, + 0x01807ece00000000, 0x94540e5b00000000, 0x6a2fee3f00000000, + 0xfffb9eaa00000000, 0x1dc93c7e00000000, 0x881d4ceb00000000, + 0x7666ac8f00000000, 0xe3b2dc1a00000000, 0x8a916c4600000000, + 0x1f451cd300000000, 0xe13efcb700000000, 0x74ea8c2200000000, + 0x33789c0e00000000, 0xa6acec9b00000000, 0x58d70cff00000000, + 0xcd037c6a00000000, 0xa420cc3600000000, 0x31f4bca300000000, + 0xcf8f5cc700000000, 0x5a5b2c5200000000, 0x41ab7d9f00000000, + 0xd47f0d0a00000000, 0x2a04ed6e00000000, 0xbfd09dfb00000000, + 0xd6f32da700000000, 0x43275d3200000000, 0xbd5cbd5600000000, + 0x2888cdc300000000, 0x6f1addef00000000, 0xfacead7a00000000, + 0x04b54d1e00000000, 0x91613d8b00000000, 0xf8428dd700000000, + 0x6d96fd4200000000, 0x93ed1d2600000000, 0x06396db300000000, + 0x168e285400000000, 0x835a58c100000000, 0x7d21b8a500000000, + 0xe8f5c83000000000, 0x81d6786c00000000, 0x140208f900000000, + 0xea79e89d00000000, 0x7fad980800000000, 0x383f882400000000, + 0xadebf8b100000000, 0x539018d500000000, 0xc644684000000000, + 0xaf67d81c00000000, 0x3ab3a88900000000, 0xc4c848ed00000000, + 0x511c387800000000, 0x4aec69b500000000, 0xdf38192000000000, + 0x2143f94400000000, 0xb49789d100000000, 0xddb4398d00000000, + 0x4860491800000000, 0xb61ba97c00000000, 0x23cfd9e900000000, + 0x645dc9c500000000, 0xf189b95000000000, 0x0ff2593400000000, + 0x9a2629a100000000, 0xf30599fd00000000, 0x66d1e96800000000, + 0x98aa090c00000000, 0x0d7e799900000000, 0xef4cdb4d00000000, + 0x7a98abd800000000, 0x84e34bbc00000000, 0x11373b2900000000, + 0x78148b7500000000, 0xedc0fbe000000000, 0x13bb1b8400000000, + 0x866f6b1100000000, 0xc1fd7b3d00000000, 0x54290ba800000000, + 0xaa52ebcc00000000, 0x3f869b5900000000, 0x56a52b0500000000, + 0xc3715b9000000000, 0x3d0abbf400000000, 0xa8decb6100000000, + 0xb32e9aac00000000, 0x26faea3900000000, 0xd8810a5d00000000, + 0x4d557ac800000000, 0x2476ca9400000000, 0xb1a2ba0100000000, + 0x4fd95a6500000000, 0xda0d2af000000000, 0x9d9f3adc00000000, + 0x084b4a4900000000, 0xf630aa2d00000000, 0x63e4dab800000000, + 0x0ac76ae400000000, 0x9f131a7100000000, 0x6168fa1500000000, + 0xf4bc8a8000000000}, + {0x0000000000000000, 0x1f17f08000000000, 0x7f2891da00000000, + 0x603f615a00000000, 0xbf56536e00000000, 0xa041a3ee00000000, + 0xc07ec2b400000000, 0xdf69323400000000, 0x7eada6dc00000000, + 0x61ba565c00000000, 0x0185370600000000, 0x1e92c78600000000, + 0xc1fbf5b200000000, 0xdeec053200000000, 0xbed3646800000000, + 0xa1c494e800000000, 0xbd5c3c6200000000, 0xa24bcce200000000, + 0xc274adb800000000, 0xdd635d3800000000, 0x020a6f0c00000000, + 0x1d1d9f8c00000000, 0x7d22fed600000000, 0x62350e5600000000, + 0xc3f19abe00000000, 0xdce66a3e00000000, 0xbcd90b6400000000, + 0xa3cefbe400000000, 0x7ca7c9d000000000, 0x63b0395000000000, + 0x038f580a00000000, 0x1c98a88a00000000, 0x7ab978c400000000, + 0x65ae884400000000, 0x0591e91e00000000, 0x1a86199e00000000, + 0xc5ef2baa00000000, 0xdaf8db2a00000000, 0xbac7ba7000000000, + 0xa5d04af000000000, 0x0414de1800000000, 0x1b032e9800000000, + 0x7b3c4fc200000000, 0x642bbf4200000000, 0xbb428d7600000000, + 0xa4557df600000000, 0xc46a1cac00000000, 0xdb7dec2c00000000, + 0xc7e544a600000000, 0xd8f2b42600000000, 0xb8cdd57c00000000, + 0xa7da25fc00000000, 0x78b317c800000000, 0x67a4e74800000000, + 0x079b861200000000, 0x188c769200000000, 0xb948e27a00000000, + 0xa65f12fa00000000, 0xc66073a000000000, 0xd977832000000000, + 0x061eb11400000000, 0x1909419400000000, 0x793620ce00000000, + 0x6621d04e00000000, 0xb574805300000000, 0xaa6370d300000000, + 0xca5c118900000000, 0xd54be10900000000, 0x0a22d33d00000000, + 0x153523bd00000000, 0x750a42e700000000, 0x6a1db26700000000, + 0xcbd9268f00000000, 0xd4ced60f00000000, 0xb4f1b75500000000, + 0xabe647d500000000, 0x748f75e100000000, 0x6b98856100000000, + 0x0ba7e43b00000000, 0x14b014bb00000000, 0x0828bc3100000000, + 0x173f4cb100000000, 0x77002deb00000000, 0x6817dd6b00000000, + 0xb77eef5f00000000, 0xa8691fdf00000000, 0xc8567e8500000000, + 0xd7418e0500000000, 0x76851aed00000000, 0x6992ea6d00000000, + 0x09ad8b3700000000, 0x16ba7bb700000000, 0xc9d3498300000000, + 0xd6c4b90300000000, 0xb6fbd85900000000, 0xa9ec28d900000000, + 0xcfcdf89700000000, 0xd0da081700000000, 0xb0e5694d00000000, + 0xaff299cd00000000, 0x709babf900000000, 0x6f8c5b7900000000, + 0x0fb33a2300000000, 0x10a4caa300000000, 0xb1605e4b00000000, + 0xae77aecb00000000, 0xce48cf9100000000, 0xd15f3f1100000000, + 0x0e360d2500000000, 0x1121fda500000000, 0x711e9cff00000000, + 0x6e096c7f00000000, 0x7291c4f500000000, 0x6d86347500000000, + 0x0db9552f00000000, 0x12aea5af00000000, 0xcdc7979b00000000, + 0xd2d0671b00000000, 0xb2ef064100000000, 0xadf8f6c100000000, + 0x0c3c622900000000, 0x132b92a900000000, 0x7314f3f300000000, + 0x6c03037300000000, 0xb36a314700000000, 0xac7dc1c700000000, + 0xcc42a09d00000000, 0xd355501d00000000, 0x6ae900a700000000, + 0x75fef02700000000, 0x15c1917d00000000, 0x0ad661fd00000000, + 0xd5bf53c900000000, 0xcaa8a34900000000, 0xaa97c21300000000, + 0xb580329300000000, 0x1444a67b00000000, 0x0b5356fb00000000, + 0x6b6c37a100000000, 0x747bc72100000000, 0xab12f51500000000, + 0xb405059500000000, 0xd43a64cf00000000, 0xcb2d944f00000000, + 0xd7b53cc500000000, 0xc8a2cc4500000000, 0xa89dad1f00000000, + 0xb78a5d9f00000000, 0x68e36fab00000000, 0x77f49f2b00000000, + 0x17cbfe7100000000, 0x08dc0ef100000000, 0xa9189a1900000000, + 0xb60f6a9900000000, 0xd6300bc300000000, 0xc927fb4300000000, + 0x164ec97700000000, 0x095939f700000000, 0x696658ad00000000, + 0x7671a82d00000000, 0x1050786300000000, 0x0f4788e300000000, + 0x6f78e9b900000000, 0x706f193900000000, 0xaf062b0d00000000, + 0xb011db8d00000000, 0xd02ebad700000000, 0xcf394a5700000000, + 0x6efddebf00000000, 0x71ea2e3f00000000, 0x11d54f6500000000, + 0x0ec2bfe500000000, 0xd1ab8dd100000000, 0xcebc7d5100000000, + 0xae831c0b00000000, 0xb194ec8b00000000, 0xad0c440100000000, + 0xb21bb48100000000, 0xd224d5db00000000, 0xcd33255b00000000, + 0x125a176f00000000, 0x0d4de7ef00000000, 0x6d7286b500000000, + 0x7265763500000000, 0xd3a1e2dd00000000, 0xccb6125d00000000, + 0xac89730700000000, 0xb39e838700000000, 0x6cf7b1b300000000, + 0x73e0413300000000, 0x13df206900000000, 0x0cc8d0e900000000, + 0xdf9d80f400000000, 0xc08a707400000000, 0xa0b5112e00000000, + 0xbfa2e1ae00000000, 0x60cbd39a00000000, 0x7fdc231a00000000, + 0x1fe3424000000000, 0x00f4b2c000000000, 0xa130262800000000, + 0xbe27d6a800000000, 0xde18b7f200000000, 0xc10f477200000000, + 0x1e66754600000000, 0x017185c600000000, 0x614ee49c00000000, + 0x7e59141c00000000, 0x62c1bc9600000000, 0x7dd64c1600000000, + 0x1de92d4c00000000, 0x02feddcc00000000, 0xdd97eff800000000, + 0xc2801f7800000000, 0xa2bf7e2200000000, 0xbda88ea200000000, + 0x1c6c1a4a00000000, 0x037beaca00000000, 0x63448b9000000000, + 0x7c537b1000000000, 0xa33a492400000000, 0xbc2db9a400000000, + 0xdc12d8fe00000000, 0xc305287e00000000, 0xa524f83000000000, + 0xba3308b000000000, 0xda0c69ea00000000, 0xc51b996a00000000, + 0x1a72ab5e00000000, 0x05655bde00000000, 0x655a3a8400000000, + 0x7a4dca0400000000, 0xdb895eec00000000, 0xc49eae6c00000000, + 0xa4a1cf3600000000, 0xbbb63fb600000000, 0x64df0d8200000000, + 0x7bc8fd0200000000, 0x1bf79c5800000000, 0x04e06cd800000000, + 0x1878c45200000000, 0x076f34d200000000, 0x6750558800000000, + 0x7847a50800000000, 0xa72e973c00000000, 0xb83967bc00000000, + 0xd80606e600000000, 0xc711f66600000000, 0x66d5628e00000000, + 0x79c2920e00000000, 0x19fdf35400000000, 0x06ea03d400000000, + 0xd98331e000000000, 0xc694c16000000000, 0xa6aba03a00000000, + 0xb9bc50ba00000000}, + {0x0000000000000000, 0xe2fd888d00000000, 0x85fd60c000000000, + 0x6700e84d00000000, 0x4bfdb05b00000000, 0xa90038d600000000, + 0xce00d09b00000000, 0x2cfd581600000000, 0x96fa61b700000000, + 0x7407e93a00000000, 0x1307017700000000, 0xf1fa89fa00000000, + 0xdd07d1ec00000000, 0x3ffa596100000000, 0x58fab12c00000000, + 0xba0739a100000000, 0x6df3b2b500000000, 0x8f0e3a3800000000, + 0xe80ed27500000000, 0x0af35af800000000, 0x260e02ee00000000, + 0xc4f38a6300000000, 0xa3f3622e00000000, 0x410eeaa300000000, + 0xfb09d30200000000, 0x19f45b8f00000000, 0x7ef4b3c200000000, + 0x9c093b4f00000000, 0xb0f4635900000000, 0x5209ebd400000000, + 0x3509039900000000, 0xd7f48b1400000000, 0x9be014b000000000, + 0x791d9c3d00000000, 0x1e1d747000000000, 0xfce0fcfd00000000, + 0xd01da4eb00000000, 0x32e02c6600000000, 0x55e0c42b00000000, + 0xb71d4ca600000000, 0x0d1a750700000000, 0xefe7fd8a00000000, + 0x88e715c700000000, 0x6a1a9d4a00000000, 0x46e7c55c00000000, + 0xa41a4dd100000000, 0xc31aa59c00000000, 0x21e72d1100000000, + 0xf613a60500000000, 0x14ee2e8800000000, 0x73eec6c500000000, + 0x91134e4800000000, 0xbdee165e00000000, 0x5f139ed300000000, + 0x3813769e00000000, 0xdaeefe1300000000, 0x60e9c7b200000000, + 0x82144f3f00000000, 0xe514a77200000000, 0x07e92fff00000000, + 0x2b1477e900000000, 0xc9e9ff6400000000, 0xaee9172900000000, + 0x4c149fa400000000, 0x77c758bb00000000, 0x953ad03600000000, + 0xf23a387b00000000, 0x10c7b0f600000000, 0x3c3ae8e000000000, + 0xdec7606d00000000, 0xb9c7882000000000, 0x5b3a00ad00000000, + 0xe13d390c00000000, 0x03c0b18100000000, 0x64c059cc00000000, + 0x863dd14100000000, 0xaac0895700000000, 0x483d01da00000000, + 0x2f3de99700000000, 0xcdc0611a00000000, 0x1a34ea0e00000000, + 0xf8c9628300000000, 0x9fc98ace00000000, 0x7d34024300000000, + 0x51c95a5500000000, 0xb334d2d800000000, 0xd4343a9500000000, + 0x36c9b21800000000, 0x8cce8bb900000000, 0x6e33033400000000, + 0x0933eb7900000000, 0xebce63f400000000, 0xc7333be200000000, + 0x25ceb36f00000000, 0x42ce5b2200000000, 0xa033d3af00000000, + 0xec274c0b00000000, 0x0edac48600000000, 0x69da2ccb00000000, + 0x8b27a44600000000, 0xa7dafc5000000000, 0x452774dd00000000, + 0x22279c9000000000, 0xc0da141d00000000, 0x7add2dbc00000000, + 0x9820a53100000000, 0xff204d7c00000000, 0x1dddc5f100000000, + 0x31209de700000000, 0xd3dd156a00000000, 0xb4ddfd2700000000, + 0x562075aa00000000, 0x81d4febe00000000, 0x6329763300000000, + 0x04299e7e00000000, 0xe6d416f300000000, 0xca294ee500000000, + 0x28d4c66800000000, 0x4fd42e2500000000, 0xad29a6a800000000, + 0x172e9f0900000000, 0xf5d3178400000000, 0x92d3ffc900000000, + 0x702e774400000000, 0x5cd32f5200000000, 0xbe2ea7df00000000, + 0xd92e4f9200000000, 0x3bd3c71f00000000, 0xaf88c0ad00000000, + 0x4d75482000000000, 0x2a75a06d00000000, 0xc88828e000000000, + 0xe47570f600000000, 0x0688f87b00000000, 0x6188103600000000, + 0x837598bb00000000, 0x3972a11a00000000, 0xdb8f299700000000, + 0xbc8fc1da00000000, 0x5e72495700000000, 0x728f114100000000, + 0x907299cc00000000, 0xf772718100000000, 0x158ff90c00000000, + 0xc27b721800000000, 0x2086fa9500000000, 0x478612d800000000, + 0xa57b9a5500000000, 0x8986c24300000000, 0x6b7b4ace00000000, + 0x0c7ba28300000000, 0xee862a0e00000000, 0x548113af00000000, + 0xb67c9b2200000000, 0xd17c736f00000000, 0x3381fbe200000000, + 0x1f7ca3f400000000, 0xfd812b7900000000, 0x9a81c33400000000, + 0x787c4bb900000000, 0x3468d41d00000000, 0xd6955c9000000000, + 0xb195b4dd00000000, 0x53683c5000000000, 0x7f95644600000000, + 0x9d68eccb00000000, 0xfa68048600000000, 0x18958c0b00000000, + 0xa292b5aa00000000, 0x406f3d2700000000, 0x276fd56a00000000, + 0xc5925de700000000, 0xe96f05f100000000, 0x0b928d7c00000000, + 0x6c92653100000000, 0x8e6fedbc00000000, 0x599b66a800000000, + 0xbb66ee2500000000, 0xdc66066800000000, 0x3e9b8ee500000000, + 0x1266d6f300000000, 0xf09b5e7e00000000, 0x979bb63300000000, + 0x75663ebe00000000, 0xcf61071f00000000, 0x2d9c8f9200000000, + 0x4a9c67df00000000, 0xa861ef5200000000, 0x849cb74400000000, + 0x66613fc900000000, 0x0161d78400000000, 0xe39c5f0900000000, + 0xd84f981600000000, 0x3ab2109b00000000, 0x5db2f8d600000000, + 0xbf4f705b00000000, 0x93b2284d00000000, 0x714fa0c000000000, + 0x164f488d00000000, 0xf4b2c00000000000, 0x4eb5f9a100000000, + 0xac48712c00000000, 0xcb48996100000000, 0x29b511ec00000000, + 0x054849fa00000000, 0xe7b5c17700000000, 0x80b5293a00000000, + 0x6248a1b700000000, 0xb5bc2aa300000000, 0x5741a22e00000000, + 0x30414a6300000000, 0xd2bcc2ee00000000, 0xfe419af800000000, + 0x1cbc127500000000, 0x7bbcfa3800000000, 0x994172b500000000, + 0x23464b1400000000, 0xc1bbc39900000000, 0xa6bb2bd400000000, + 0x4446a35900000000, 0x68bbfb4f00000000, 0x8a4673c200000000, + 0xed469b8f00000000, 0x0fbb130200000000, 0x43af8ca600000000, + 0xa152042b00000000, 0xc652ec6600000000, 0x24af64eb00000000, + 0x08523cfd00000000, 0xeaafb47000000000, 0x8daf5c3d00000000, + 0x6f52d4b000000000, 0xd555ed1100000000, 0x37a8659c00000000, + 0x50a88dd100000000, 0xb255055c00000000, 0x9ea85d4a00000000, + 0x7c55d5c700000000, 0x1b553d8a00000000, 0xf9a8b50700000000, + 0x2e5c3e1300000000, 0xcca1b69e00000000, 0xaba15ed300000000, + 0x495cd65e00000000, 0x65a18e4800000000, 0x875c06c500000000, + 0xe05cee8800000000, 0x02a1660500000000, 0xb8a65fa400000000, + 0x5a5bd72900000000, 0x3d5b3f6400000000, 0xdfa6b7e900000000, + 0xf35befff00000000, 0x11a6677200000000, 0x76a68f3f00000000, + 0x945b07b200000000}, + {0x0000000000000000, 0xa90b894e00000000, 0x5217129d00000000, + 0xfb1c9bd300000000, 0xe52855e100000000, 0x4c23dcaf00000000, + 0xb73f477c00000000, 0x1e34ce3200000000, 0x8b57db1900000000, + 0x225c525700000000, 0xd940c98400000000, 0x704b40ca00000000, + 0x6e7f8ef800000000, 0xc77407b600000000, 0x3c689c6500000000, + 0x9563152b00000000, 0x16afb63300000000, 0xbfa43f7d00000000, + 0x44b8a4ae00000000, 0xedb32de000000000, 0xf387e3d200000000, + 0x5a8c6a9c00000000, 0xa190f14f00000000, 0x089b780100000000, + 0x9df86d2a00000000, 0x34f3e46400000000, 0xcfef7fb700000000, + 0x66e4f6f900000000, 0x78d038cb00000000, 0xd1dbb18500000000, + 0x2ac72a5600000000, 0x83cca31800000000, 0x2c5e6d6700000000, + 0x8555e42900000000, 0x7e497ffa00000000, 0xd742f6b400000000, + 0xc976388600000000, 0x607db1c800000000, 0x9b612a1b00000000, + 0x326aa35500000000, 0xa709b67e00000000, 0x0e023f3000000000, + 0xf51ea4e300000000, 0x5c152dad00000000, 0x4221e39f00000000, + 0xeb2a6ad100000000, 0x1036f10200000000, 0xb93d784c00000000, + 0x3af1db5400000000, 0x93fa521a00000000, 0x68e6c9c900000000, + 0xc1ed408700000000, 0xdfd98eb500000000, 0x76d207fb00000000, + 0x8dce9c2800000000, 0x24c5156600000000, 0xb1a6004d00000000, + 0x18ad890300000000, 0xe3b112d000000000, 0x4aba9b9e00000000, + 0x548e55ac00000000, 0xfd85dce200000000, 0x0699473100000000, + 0xaf92ce7f00000000, 0x58bcdace00000000, 0xf1b7538000000000, + 0x0aabc85300000000, 0xa3a0411d00000000, 0xbd948f2f00000000, + 0x149f066100000000, 0xef839db200000000, 0x468814fc00000000, + 0xd3eb01d700000000, 0x7ae0889900000000, 0x81fc134a00000000, + 0x28f79a0400000000, 0x36c3543600000000, 0x9fc8dd7800000000, + 0x64d446ab00000000, 0xcddfcfe500000000, 0x4e136cfd00000000, + 0xe718e5b300000000, 0x1c047e6000000000, 0xb50ff72e00000000, + 0xab3b391c00000000, 0x0230b05200000000, 0xf92c2b8100000000, + 0x5027a2cf00000000, 0xc544b7e400000000, 0x6c4f3eaa00000000, + 0x9753a57900000000, 0x3e582c3700000000, 0x206ce20500000000, + 0x89676b4b00000000, 0x727bf09800000000, 0xdb7079d600000000, + 0x74e2b7a900000000, 0xdde93ee700000000, 0x26f5a53400000000, + 0x8ffe2c7a00000000, 0x91cae24800000000, 0x38c16b0600000000, + 0xc3ddf0d500000000, 0x6ad6799b00000000, 0xffb56cb000000000, + 0x56bee5fe00000000, 0xada27e2d00000000, 0x04a9f76300000000, + 0x1a9d395100000000, 0xb396b01f00000000, 0x488a2bcc00000000, + 0xe181a28200000000, 0x624d019a00000000, 0xcb4688d400000000, + 0x305a130700000000, 0x99519a4900000000, 0x8765547b00000000, + 0x2e6edd3500000000, 0xd57246e600000000, 0x7c79cfa800000000, + 0xe91ada8300000000, 0x401153cd00000000, 0xbb0dc81e00000000, + 0x1206415000000000, 0x0c328f6200000000, 0xa539062c00000000, + 0x5e259dff00000000, 0xf72e14b100000000, 0xf17ec44600000000, + 0x58754d0800000000, 0xa369d6db00000000, 0x0a625f9500000000, + 0x145691a700000000, 0xbd5d18e900000000, 0x4641833a00000000, + 0xef4a0a7400000000, 0x7a291f5f00000000, 0xd322961100000000, + 0x283e0dc200000000, 0x8135848c00000000, 0x9f014abe00000000, + 0x360ac3f000000000, 0xcd16582300000000, 0x641dd16d00000000, + 0xe7d1727500000000, 0x4edafb3b00000000, 0xb5c660e800000000, + 0x1ccde9a600000000, 0x02f9279400000000, 0xabf2aeda00000000, + 0x50ee350900000000, 0xf9e5bc4700000000, 0x6c86a96c00000000, + 0xc58d202200000000, 0x3e91bbf100000000, 0x979a32bf00000000, + 0x89aefc8d00000000, 0x20a575c300000000, 0xdbb9ee1000000000, + 0x72b2675e00000000, 0xdd20a92100000000, 0x742b206f00000000, + 0x8f37bbbc00000000, 0x263c32f200000000, 0x3808fcc000000000, + 0x9103758e00000000, 0x6a1fee5d00000000, 0xc314671300000000, + 0x5677723800000000, 0xff7cfb7600000000, 0x046060a500000000, + 0xad6be9eb00000000, 0xb35f27d900000000, 0x1a54ae9700000000, + 0xe148354400000000, 0x4843bc0a00000000, 0xcb8f1f1200000000, + 0x6284965c00000000, 0x99980d8f00000000, 0x309384c100000000, + 0x2ea74af300000000, 0x87acc3bd00000000, 0x7cb0586e00000000, + 0xd5bbd12000000000, 0x40d8c40b00000000, 0xe9d34d4500000000, + 0x12cfd69600000000, 0xbbc45fd800000000, 0xa5f091ea00000000, + 0x0cfb18a400000000, 0xf7e7837700000000, 0x5eec0a3900000000, + 0xa9c21e8800000000, 0x00c997c600000000, 0xfbd50c1500000000, + 0x52de855b00000000, 0x4cea4b6900000000, 0xe5e1c22700000000, + 0x1efd59f400000000, 0xb7f6d0ba00000000, 0x2295c59100000000, + 0x8b9e4cdf00000000, 0x7082d70c00000000, 0xd9895e4200000000, + 0xc7bd907000000000, 0x6eb6193e00000000, 0x95aa82ed00000000, + 0x3ca10ba300000000, 0xbf6da8bb00000000, 0x166621f500000000, + 0xed7aba2600000000, 0x4471336800000000, 0x5a45fd5a00000000, + 0xf34e741400000000, 0x0852efc700000000, 0xa159668900000000, + 0x343a73a200000000, 0x9d31faec00000000, 0x662d613f00000000, + 0xcf26e87100000000, 0xd112264300000000, 0x7819af0d00000000, + 0x830534de00000000, 0x2a0ebd9000000000, 0x859c73ef00000000, + 0x2c97faa100000000, 0xd78b617200000000, 0x7e80e83c00000000, + 0x60b4260e00000000, 0xc9bfaf4000000000, 0x32a3349300000000, + 0x9ba8bddd00000000, 0x0ecba8f600000000, 0xa7c021b800000000, + 0x5cdcba6b00000000, 0xf5d7332500000000, 0xebe3fd1700000000, + 0x42e8745900000000, 0xb9f4ef8a00000000, 0x10ff66c400000000, + 0x9333c5dc00000000, 0x3a384c9200000000, 0xc124d74100000000, + 0x682f5e0f00000000, 0x761b903d00000000, 0xdf10197300000000, + 0x240c82a000000000, 0x8d070bee00000000, 0x18641ec500000000, + 0xb16f978b00000000, 0x4a730c5800000000, 0xe378851600000000, + 0xfd4c4b2400000000, 0x5447c26a00000000, 0xaf5b59b900000000, + 0x0650d0f700000000}, + {0x0000000000000000, 0x479244af00000000, 0xcf22f88500000000, + 0x88b0bc2a00000000, 0xdf4381d000000000, 0x98d1c57f00000000, + 0x1061795500000000, 0x57f33dfa00000000, 0xff81737a00000000, + 0xb81337d500000000, 0x30a38bff00000000, 0x7731cf5000000000, + 0x20c2f2aa00000000, 0x6750b60500000000, 0xefe00a2f00000000, + 0xa8724e8000000000, 0xfe03e7f400000000, 0xb991a35b00000000, + 0x31211f7100000000, 0x76b35bde00000000, 0x2140662400000000, + 0x66d2228b00000000, 0xee629ea100000000, 0xa9f0da0e00000000, + 0x0182948e00000000, 0x4610d02100000000, 0xcea06c0b00000000, + 0x893228a400000000, 0xdec1155e00000000, 0x995351f100000000, + 0x11e3eddb00000000, 0x5671a97400000000, 0xbd01bf3200000000, + 0xfa93fb9d00000000, 0x722347b700000000, 0x35b1031800000000, + 0x62423ee200000000, 0x25d07a4d00000000, 0xad60c66700000000, + 0xeaf282c800000000, 0x4280cc4800000000, 0x051288e700000000, + 0x8da234cd00000000, 0xca30706200000000, 0x9dc34d9800000000, + 0xda51093700000000, 0x52e1b51d00000000, 0x1573f1b200000000, + 0x430258c600000000, 0x04901c6900000000, 0x8c20a04300000000, + 0xcbb2e4ec00000000, 0x9c41d91600000000, 0xdbd39db900000000, + 0x5363219300000000, 0x14f1653c00000000, 0xbc832bbc00000000, + 0xfb116f1300000000, 0x73a1d33900000000, 0x3433979600000000, + 0x63c0aa6c00000000, 0x2452eec300000000, 0xace252e900000000, + 0xeb70164600000000, 0x7a037e6500000000, 0x3d913aca00000000, + 0xb52186e000000000, 0xf2b3c24f00000000, 0xa540ffb500000000, + 0xe2d2bb1a00000000, 0x6a62073000000000, 0x2df0439f00000000, + 0x85820d1f00000000, 0xc21049b000000000, 0x4aa0f59a00000000, + 0x0d32b13500000000, 0x5ac18ccf00000000, 0x1d53c86000000000, + 0x95e3744a00000000, 0xd27130e500000000, 0x8400999100000000, + 0xc392dd3e00000000, 0x4b22611400000000, 0x0cb025bb00000000, + 0x5b43184100000000, 0x1cd15cee00000000, 0x9461e0c400000000, + 0xd3f3a46b00000000, 0x7b81eaeb00000000, 0x3c13ae4400000000, + 0xb4a3126e00000000, 0xf33156c100000000, 0xa4c26b3b00000000, + 0xe3502f9400000000, 0x6be093be00000000, 0x2c72d71100000000, + 0xc702c15700000000, 0x809085f800000000, 0x082039d200000000, + 0x4fb27d7d00000000, 0x1841408700000000, 0x5fd3042800000000, + 0xd763b80200000000, 0x90f1fcad00000000, 0x3883b22d00000000, + 0x7f11f68200000000, 0xf7a14aa800000000, 0xb0330e0700000000, + 0xe7c033fd00000000, 0xa052775200000000, 0x28e2cb7800000000, + 0x6f708fd700000000, 0x390126a300000000, 0x7e93620c00000000, + 0xf623de2600000000, 0xb1b19a8900000000, 0xe642a77300000000, + 0xa1d0e3dc00000000, 0x29605ff600000000, 0x6ef21b5900000000, + 0xc68055d900000000, 0x8112117600000000, 0x09a2ad5c00000000, + 0x4e30e9f300000000, 0x19c3d40900000000, 0x5e5190a600000000, + 0xd6e12c8c00000000, 0x9173682300000000, 0xf406fcca00000000, + 0xb394b86500000000, 0x3b24044f00000000, 0x7cb640e000000000, + 0x2b457d1a00000000, 0x6cd739b500000000, 0xe467859f00000000, + 0xa3f5c13000000000, 0x0b878fb000000000, 0x4c15cb1f00000000, + 0xc4a5773500000000, 0x8337339a00000000, 0xd4c40e6000000000, + 0x93564acf00000000, 0x1be6f6e500000000, 0x5c74b24a00000000, + 0x0a051b3e00000000, 0x4d975f9100000000, 0xc527e3bb00000000, + 0x82b5a71400000000, 0xd5469aee00000000, 0x92d4de4100000000, + 0x1a64626b00000000, 0x5df626c400000000, 0xf584684400000000, + 0xb2162ceb00000000, 0x3aa690c100000000, 0x7d34d46e00000000, + 0x2ac7e99400000000, 0x6d55ad3b00000000, 0xe5e5111100000000, + 0xa27755be00000000, 0x490743f800000000, 0x0e95075700000000, + 0x8625bb7d00000000, 0xc1b7ffd200000000, 0x9644c22800000000, + 0xd1d6868700000000, 0x59663aad00000000, 0x1ef47e0200000000, + 0xb686308200000000, 0xf114742d00000000, 0x79a4c80700000000, + 0x3e368ca800000000, 0x69c5b15200000000, 0x2e57f5fd00000000, + 0xa6e749d700000000, 0xe1750d7800000000, 0xb704a40c00000000, + 0xf096e0a300000000, 0x78265c8900000000, 0x3fb4182600000000, + 0x684725dc00000000, 0x2fd5617300000000, 0xa765dd5900000000, + 0xe0f799f600000000, 0x4885d77600000000, 0x0f1793d900000000, + 0x87a72ff300000000, 0xc0356b5c00000000, 0x97c656a600000000, + 0xd054120900000000, 0x58e4ae2300000000, 0x1f76ea8c00000000, + 0x8e0582af00000000, 0xc997c60000000000, 0x41277a2a00000000, + 0x06b53e8500000000, 0x5146037f00000000, 0x16d447d000000000, + 0x9e64fbfa00000000, 0xd9f6bf5500000000, 0x7184f1d500000000, + 0x3616b57a00000000, 0xbea6095000000000, 0xf9344dff00000000, + 0xaec7700500000000, 0xe95534aa00000000, 0x61e5888000000000, + 0x2677cc2f00000000, 0x7006655b00000000, 0x379421f400000000, + 0xbf249dde00000000, 0xf8b6d97100000000, 0xaf45e48b00000000, + 0xe8d7a02400000000, 0x60671c0e00000000, 0x27f558a100000000, + 0x8f87162100000000, 0xc815528e00000000, 0x40a5eea400000000, + 0x0737aa0b00000000, 0x50c497f100000000, 0x1756d35e00000000, + 0x9fe66f7400000000, 0xd8742bdb00000000, 0x33043d9d00000000, + 0x7496793200000000, 0xfc26c51800000000, 0xbbb481b700000000, + 0xec47bc4d00000000, 0xabd5f8e200000000, 0x236544c800000000, + 0x64f7006700000000, 0xcc854ee700000000, 0x8b170a4800000000, + 0x03a7b66200000000, 0x4435f2cd00000000, 0x13c6cf3700000000, + 0x54548b9800000000, 0xdce437b200000000, 0x9b76731d00000000, + 0xcd07da6900000000, 0x8a959ec600000000, 0x022522ec00000000, + 0x45b7664300000000, 0x12445bb900000000, 0x55d61f1600000000, + 0xdd66a33c00000000, 0x9af4e79300000000, 0x3286a91300000000, + 0x7514edbc00000000, 0xfda4519600000000, 0xba36153900000000, + 0xedc528c300000000, 0xaa576c6c00000000, 0x22e7d04600000000, + 0x657594e900000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x65673b46, 0xcace768c, 0xafa94dca, 0x4eedeb59, + 0x2b8ad01f, 0x84239dd5, 0xe144a693, 0x9ddbd6b2, 0xf8bcedf4, + 0x5715a03e, 0x32729b78, 0xd3363deb, 0xb65106ad, 0x19f84b67, + 0x7c9f7021, 0xe0c6ab25, 0x85a19063, 0x2a08dda9, 0x4f6fe6ef, + 0xae2b407c, 0xcb4c7b3a, 0x64e536f0, 0x01820db6, 0x7d1d7d97, + 0x187a46d1, 0xb7d30b1b, 0xd2b4305d, 0x33f096ce, 0x5697ad88, + 0xf93ee042, 0x9c59db04, 0x1afc500b, 0x7f9b6b4d, 0xd0322687, + 0xb5551dc1, 0x5411bb52, 0x31768014, 0x9edfcdde, 0xfbb8f698, + 0x872786b9, 0xe240bdff, 0x4de9f035, 0x288ecb73, 0xc9ca6de0, + 0xacad56a6, 0x03041b6c, 0x6663202a, 0xfa3afb2e, 0x9f5dc068, + 0x30f48da2, 0x5593b6e4, 0xb4d71077, 0xd1b02b31, 0x7e1966fb, + 0x1b7e5dbd, 0x67e12d9c, 0x028616da, 0xad2f5b10, 0xc8486056, + 0x290cc6c5, 0x4c6bfd83, 0xe3c2b049, 0x86a58b0f, 0x35f8a016, + 0x509f9b50, 0xff36d69a, 0x9a51eddc, 0x7b154b4f, 0x1e727009, + 0xb1db3dc3, 0xd4bc0685, 0xa82376a4, 0xcd444de2, 0x62ed0028, + 0x078a3b6e, 0xe6ce9dfd, 0x83a9a6bb, 0x2c00eb71, 0x4967d037, + 0xd53e0b33, 0xb0593075, 0x1ff07dbf, 0x7a9746f9, 0x9bd3e06a, + 0xfeb4db2c, 0x511d96e6, 0x347aada0, 0x48e5dd81, 0x2d82e6c7, + 0x822bab0d, 0xe74c904b, 0x060836d8, 0x636f0d9e, 0xccc64054, + 0xa9a17b12, 0x2f04f01d, 0x4a63cb5b, 0xe5ca8691, 0x80adbdd7, + 0x61e91b44, 0x048e2002, 0xab276dc8, 0xce40568e, 0xb2df26af, + 0xd7b81de9, 0x78115023, 0x1d766b65, 0xfc32cdf6, 0x9955f6b0, + 0x36fcbb7a, 0x539b803c, 0xcfc25b38, 0xaaa5607e, 0x050c2db4, + 0x606b16f2, 0x812fb061, 0xe4488b27, 0x4be1c6ed, 0x2e86fdab, + 0x52198d8a, 0x377eb6cc, 0x98d7fb06, 0xfdb0c040, 0x1cf466d3, + 0x79935d95, 0xd63a105f, 0xb35d2b19, 0x6bf1402c, 0x0e967b6a, + 0xa13f36a0, 0xc4580de6, 0x251cab75, 0x407b9033, 0xefd2ddf9, + 0x8ab5e6bf, 0xf62a969e, 0x934dadd8, 0x3ce4e012, 0x5983db54, + 0xb8c77dc7, 0xdda04681, 0x72090b4b, 0x176e300d, 0x8b37eb09, + 0xee50d04f, 0x41f99d85, 0x249ea6c3, 0xc5da0050, 0xa0bd3b16, + 0x0f1476dc, 0x6a734d9a, 0x16ec3dbb, 0x738b06fd, 0xdc224b37, + 0xb9457071, 0x5801d6e2, 0x3d66eda4, 0x92cfa06e, 0xf7a89b28, + 0x710d1027, 0x146a2b61, 0xbbc366ab, 0xdea45ded, 0x3fe0fb7e, + 0x5a87c038, 0xf52e8df2, 0x9049b6b4, 0xecd6c695, 0x89b1fdd3, + 0x2618b019, 0x437f8b5f, 0xa23b2dcc, 0xc75c168a, 0x68f55b40, + 0x0d926006, 0x91cbbb02, 0xf4ac8044, 0x5b05cd8e, 0x3e62f6c8, + 0xdf26505b, 0xba416b1d, 0x15e826d7, 0x708f1d91, 0x0c106db0, + 0x697756f6, 0xc6de1b3c, 0xa3b9207a, 0x42fd86e9, 0x279abdaf, + 0x8833f065, 0xed54cb23, 0x5e09e03a, 0x3b6edb7c, 0x94c796b6, + 0xf1a0adf0, 0x10e40b63, 0x75833025, 0xda2a7def, 0xbf4d46a9, + 0xc3d23688, 0xa6b50dce, 0x091c4004, 0x6c7b7b42, 0x8d3fddd1, + 0xe858e697, 0x47f1ab5d, 0x2296901b, 0xbecf4b1f, 0xdba87059, + 0x74013d93, 0x116606d5, 0xf022a046, 0x95459b00, 0x3aecd6ca, + 0x5f8bed8c, 0x23149dad, 0x4673a6eb, 0xe9daeb21, 0x8cbdd067, + 0x6df976f4, 0x089e4db2, 0xa7370078, 0xc2503b3e, 0x44f5b031, + 0x21928b77, 0x8e3bc6bd, 0xeb5cfdfb, 0x0a185b68, 0x6f7f602e, + 0xc0d62de4, 0xa5b116a2, 0xd92e6683, 0xbc495dc5, 0x13e0100f, + 0x76872b49, 0x97c38dda, 0xf2a4b69c, 0x5d0dfb56, 0x386ac010, + 0xa4331b14, 0xc1542052, 0x6efd6d98, 0x0b9a56de, 0xeadef04d, + 0x8fb9cb0b, 0x201086c1, 0x4577bd87, 0x39e8cda6, 0x5c8ff6e0, + 0xf326bb2a, 0x9641806c, 0x770526ff, 0x12621db9, 0xbdcb5073, + 0xd8ac6b35}, + {0x00000000, 0xd7e28058, 0x74b406f1, 0xa35686a9, 0xe9680de2, + 0x3e8a8dba, 0x9ddc0b13, 0x4a3e8b4b, 0x09a11d85, 0xde439ddd, + 0x7d151b74, 0xaaf79b2c, 0xe0c91067, 0x372b903f, 0x947d1696, + 0x439f96ce, 0x13423b0a, 0xc4a0bb52, 0x67f63dfb, 0xb014bda3, + 0xfa2a36e8, 0x2dc8b6b0, 0x8e9e3019, 0x597cb041, 0x1ae3268f, + 0xcd01a6d7, 0x6e57207e, 0xb9b5a026, 0xf38b2b6d, 0x2469ab35, + 0x873f2d9c, 0x50ddadc4, 0x26847614, 0xf166f64c, 0x523070e5, + 0x85d2f0bd, 0xcfec7bf6, 0x180efbae, 0xbb587d07, 0x6cbafd5f, + 0x2f256b91, 0xf8c7ebc9, 0x5b916d60, 0x8c73ed38, 0xc64d6673, + 0x11afe62b, 0xb2f96082, 0x651be0da, 0x35c64d1e, 0xe224cd46, + 0x41724bef, 0x9690cbb7, 0xdcae40fc, 0x0b4cc0a4, 0xa81a460d, + 0x7ff8c655, 0x3c67509b, 0xeb85d0c3, 0x48d3566a, 0x9f31d632, + 0xd50f5d79, 0x02eddd21, 0xa1bb5b88, 0x7659dbd0, 0x4d08ec28, + 0x9aea6c70, 0x39bcead9, 0xee5e6a81, 0xa460e1ca, 0x73826192, + 0xd0d4e73b, 0x07366763, 0x44a9f1ad, 0x934b71f5, 0x301df75c, + 0xe7ff7704, 0xadc1fc4f, 0x7a237c17, 0xd975fabe, 0x0e977ae6, + 0x5e4ad722, 0x89a8577a, 0x2afed1d3, 0xfd1c518b, 0xb722dac0, + 0x60c05a98, 0xc396dc31, 0x14745c69, 0x57ebcaa7, 0x80094aff, + 0x235fcc56, 0xf4bd4c0e, 0xbe83c745, 0x6961471d, 0xca37c1b4, + 0x1dd541ec, 0x6b8c9a3c, 0xbc6e1a64, 0x1f389ccd, 0xc8da1c95, + 0x82e497de, 0x55061786, 0xf650912f, 0x21b21177, 0x622d87b9, + 0xb5cf07e1, 0x16998148, 0xc17b0110, 0x8b458a5b, 0x5ca70a03, + 0xfff18caa, 0x28130cf2, 0x78cea136, 0xaf2c216e, 0x0c7aa7c7, + 0xdb98279f, 0x91a6acd4, 0x46442c8c, 0xe512aa25, 0x32f02a7d, + 0x716fbcb3, 0xa68d3ceb, 0x05dbba42, 0xd2393a1a, 0x9807b151, + 0x4fe53109, 0xecb3b7a0, 0x3b5137f8, 0x9a11d850, 0x4df35808, + 0xeea5dea1, 0x39475ef9, 0x7379d5b2, 0xa49b55ea, 0x07cdd343, + 0xd02f531b, 0x93b0c5d5, 0x4452458d, 0xe704c324, 0x30e6437c, + 0x7ad8c837, 0xad3a486f, 0x0e6ccec6, 0xd98e4e9e, 0x8953e35a, + 0x5eb16302, 0xfde7e5ab, 0x2a0565f3, 0x603beeb8, 0xb7d96ee0, + 0x148fe849, 0xc36d6811, 0x80f2fedf, 0x57107e87, 0xf446f82e, + 0x23a47876, 0x699af33d, 0xbe787365, 0x1d2ef5cc, 0xcacc7594, + 0xbc95ae44, 0x6b772e1c, 0xc821a8b5, 0x1fc328ed, 0x55fda3a6, + 0x821f23fe, 0x2149a557, 0xf6ab250f, 0xb534b3c1, 0x62d63399, + 0xc180b530, 0x16623568, 0x5c5cbe23, 0x8bbe3e7b, 0x28e8b8d2, + 0xff0a388a, 0xafd7954e, 0x78351516, 0xdb6393bf, 0x0c8113e7, + 0x46bf98ac, 0x915d18f4, 0x320b9e5d, 0xe5e91e05, 0xa67688cb, + 0x71940893, 0xd2c28e3a, 0x05200e62, 0x4f1e8529, 0x98fc0571, + 0x3baa83d8, 0xec480380, 0xd7193478, 0x00fbb420, 0xa3ad3289, + 0x744fb2d1, 0x3e71399a, 0xe993b9c2, 0x4ac53f6b, 0x9d27bf33, + 0xdeb829fd, 0x095aa9a5, 0xaa0c2f0c, 0x7deeaf54, 0x37d0241f, + 0xe032a447, 0x436422ee, 0x9486a2b6, 0xc45b0f72, 0x13b98f2a, + 0xb0ef0983, 0x670d89db, 0x2d330290, 0xfad182c8, 0x59870461, + 0x8e658439, 0xcdfa12f7, 0x1a1892af, 0xb94e1406, 0x6eac945e, + 0x24921f15, 0xf3709f4d, 0x502619e4, 0x87c499bc, 0xf19d426c, + 0x267fc234, 0x8529449d, 0x52cbc4c5, 0x18f54f8e, 0xcf17cfd6, + 0x6c41497f, 0xbba3c927, 0xf83c5fe9, 0x2fdedfb1, 0x8c885918, + 0x5b6ad940, 0x1154520b, 0xc6b6d253, 0x65e054fa, 0xb202d4a2, + 0xe2df7966, 0x353df93e, 0x966b7f97, 0x4189ffcf, 0x0bb77484, + 0xdc55f4dc, 0x7f037275, 0xa8e1f22d, 0xeb7e64e3, 0x3c9ce4bb, + 0x9fca6212, 0x4828e24a, 0x02166901, 0xd5f4e959, 0x76a26ff0, + 0xa140efa8}, + {0x00000000, 0xef52b6e1, 0x05d46b83, 0xea86dd62, 0x0ba8d706, + 0xe4fa61e7, 0x0e7cbc85, 0xe12e0a64, 0x1751ae0c, 0xf80318ed, + 0x1285c58f, 0xfdd7736e, 0x1cf9790a, 0xf3abcfeb, 0x192d1289, + 0xf67fa468, 0x2ea35c18, 0xc1f1eaf9, 0x2b77379b, 0xc425817a, + 0x250b8b1e, 0xca593dff, 0x20dfe09d, 0xcf8d567c, 0x39f2f214, + 0xd6a044f5, 0x3c269997, 0xd3742f76, 0x325a2512, 0xdd0893f3, + 0x378e4e91, 0xd8dcf870, 0x5d46b830, 0xb2140ed1, 0x5892d3b3, + 0xb7c06552, 0x56ee6f36, 0xb9bcd9d7, 0x533a04b5, 0xbc68b254, + 0x4a17163c, 0xa545a0dd, 0x4fc37dbf, 0xa091cb5e, 0x41bfc13a, + 0xaeed77db, 0x446baab9, 0xab391c58, 0x73e5e428, 0x9cb752c9, + 0x76318fab, 0x9963394a, 0x784d332e, 0x971f85cf, 0x7d9958ad, + 0x92cbee4c, 0x64b44a24, 0x8be6fcc5, 0x616021a7, 0x8e329746, + 0x6f1c9d22, 0x804e2bc3, 0x6ac8f6a1, 0x859a4040, 0xba8d7060, + 0x55dfc681, 0xbf591be3, 0x500bad02, 0xb125a766, 0x5e771187, + 0xb4f1cce5, 0x5ba37a04, 0xaddcde6c, 0x428e688d, 0xa808b5ef, + 0x475a030e, 0xa674096a, 0x4926bf8b, 0xa3a062e9, 0x4cf2d408, + 0x942e2c78, 0x7b7c9a99, 0x91fa47fb, 0x7ea8f11a, 0x9f86fb7e, + 0x70d44d9f, 0x9a5290fd, 0x7500261c, 0x837f8274, 0x6c2d3495, + 0x86abe9f7, 0x69f95f16, 0x88d75572, 0x6785e393, 0x8d033ef1, + 0x62518810, 0xe7cbc850, 0x08997eb1, 0xe21fa3d3, 0x0d4d1532, + 0xec631f56, 0x0331a9b7, 0xe9b774d5, 0x06e5c234, 0xf09a665c, + 0x1fc8d0bd, 0xf54e0ddf, 0x1a1cbb3e, 0xfb32b15a, 0x146007bb, + 0xfee6dad9, 0x11b46c38, 0xc9689448, 0x263a22a9, 0xccbcffcb, + 0x23ee492a, 0xc2c0434e, 0x2d92f5af, 0xc71428cd, 0x28469e2c, + 0xde393a44, 0x316b8ca5, 0xdbed51c7, 0x34bfe726, 0xd591ed42, + 0x3ac35ba3, 0xd04586c1, 0x3f173020, 0xae6be681, 0x41395060, + 0xabbf8d02, 0x44ed3be3, 0xa5c33187, 0x4a918766, 0xa0175a04, + 0x4f45ece5, 0xb93a488d, 0x5668fe6c, 0xbcee230e, 0x53bc95ef, + 0xb2929f8b, 0x5dc0296a, 0xb746f408, 0x581442e9, 0x80c8ba99, + 0x6f9a0c78, 0x851cd11a, 0x6a4e67fb, 0x8b606d9f, 0x6432db7e, + 0x8eb4061c, 0x61e6b0fd, 0x97991495, 0x78cba274, 0x924d7f16, + 0x7d1fc9f7, 0x9c31c393, 0x73637572, 0x99e5a810, 0x76b71ef1, + 0xf32d5eb1, 0x1c7fe850, 0xf6f93532, 0x19ab83d3, 0xf88589b7, + 0x17d73f56, 0xfd51e234, 0x120354d5, 0xe47cf0bd, 0x0b2e465c, + 0xe1a89b3e, 0x0efa2ddf, 0xefd427bb, 0x0086915a, 0xea004c38, + 0x0552fad9, 0xdd8e02a9, 0x32dcb448, 0xd85a692a, 0x3708dfcb, + 0xd626d5af, 0x3974634e, 0xd3f2be2c, 0x3ca008cd, 0xcadfaca5, + 0x258d1a44, 0xcf0bc726, 0x205971c7, 0xc1777ba3, 0x2e25cd42, + 0xc4a31020, 0x2bf1a6c1, 0x14e696e1, 0xfbb42000, 0x1132fd62, + 0xfe604b83, 0x1f4e41e7, 0xf01cf706, 0x1a9a2a64, 0xf5c89c85, + 0x03b738ed, 0xece58e0c, 0x0663536e, 0xe931e58f, 0x081fefeb, + 0xe74d590a, 0x0dcb8468, 0xe2993289, 0x3a45caf9, 0xd5177c18, + 0x3f91a17a, 0xd0c3179b, 0x31ed1dff, 0xdebfab1e, 0x3439767c, + 0xdb6bc09d, 0x2d1464f5, 0xc246d214, 0x28c00f76, 0xc792b997, + 0x26bcb3f3, 0xc9ee0512, 0x2368d870, 0xcc3a6e91, 0x49a02ed1, + 0xa6f29830, 0x4c744552, 0xa326f3b3, 0x4208f9d7, 0xad5a4f36, + 0x47dc9254, 0xa88e24b5, 0x5ef180dd, 0xb1a3363c, 0x5b25eb5e, + 0xb4775dbf, 0x555957db, 0xba0be13a, 0x508d3c58, 0xbfdf8ab9, + 0x670372c9, 0x8851c428, 0x62d7194a, 0x8d85afab, 0x6caba5cf, + 0x83f9132e, 0x697fce4c, 0x862d78ad, 0x7052dcc5, 0x9f006a24, + 0x7586b746, 0x9ad401a7, 0x7bfa0bc3, 0x94a8bd22, 0x7e2e6040, + 0x917cd6a1}, + {0x00000000, 0x87a6cb43, 0xd43c90c7, 0x539a5b84, 0x730827cf, + 0xf4aeec8c, 0xa734b708, 0x20927c4b, 0xe6104f9e, 0x61b684dd, + 0x322cdf59, 0xb58a141a, 0x95186851, 0x12bea312, 0x4124f896, + 0xc68233d5, 0x1751997d, 0x90f7523e, 0xc36d09ba, 0x44cbc2f9, + 0x6459beb2, 0xe3ff75f1, 0xb0652e75, 0x37c3e536, 0xf141d6e3, + 0x76e71da0, 0x257d4624, 0xa2db8d67, 0x8249f12c, 0x05ef3a6f, + 0x567561eb, 0xd1d3aaa8, 0x2ea332fa, 0xa905f9b9, 0xfa9fa23d, + 0x7d39697e, 0x5dab1535, 0xda0dde76, 0x899785f2, 0x0e314eb1, + 0xc8b37d64, 0x4f15b627, 0x1c8feda3, 0x9b2926e0, 0xbbbb5aab, + 0x3c1d91e8, 0x6f87ca6c, 0xe821012f, 0x39f2ab87, 0xbe5460c4, + 0xedce3b40, 0x6a68f003, 0x4afa8c48, 0xcd5c470b, 0x9ec61c8f, + 0x1960d7cc, 0xdfe2e419, 0x58442f5a, 0x0bde74de, 0x8c78bf9d, + 0xaceac3d6, 0x2b4c0895, 0x78d65311, 0xff709852, 0x5d4665f4, + 0xdae0aeb7, 0x897af533, 0x0edc3e70, 0x2e4e423b, 0xa9e88978, + 0xfa72d2fc, 0x7dd419bf, 0xbb562a6a, 0x3cf0e129, 0x6f6abaad, + 0xe8cc71ee, 0xc85e0da5, 0x4ff8c6e6, 0x1c629d62, 0x9bc45621, + 0x4a17fc89, 0xcdb137ca, 0x9e2b6c4e, 0x198da70d, 0x391fdb46, + 0xbeb91005, 0xed234b81, 0x6a8580c2, 0xac07b317, 0x2ba17854, + 0x783b23d0, 0xff9de893, 0xdf0f94d8, 0x58a95f9b, 0x0b33041f, + 0x8c95cf5c, 0x73e5570e, 0xf4439c4d, 0xa7d9c7c9, 0x207f0c8a, + 0x00ed70c1, 0x874bbb82, 0xd4d1e006, 0x53772b45, 0x95f51890, + 0x1253d3d3, 0x41c98857, 0xc66f4314, 0xe6fd3f5f, 0x615bf41c, + 0x32c1af98, 0xb56764db, 0x64b4ce73, 0xe3120530, 0xb0885eb4, + 0x372e95f7, 0x17bce9bc, 0x901a22ff, 0xc380797b, 0x4426b238, + 0x82a481ed, 0x05024aae, 0x5698112a, 0xd13eda69, 0xf1aca622, + 0x760a6d61, 0x259036e5, 0xa236fda6, 0xba8ccbe8, 0x3d2a00ab, + 0x6eb05b2f, 0xe916906c, 0xc984ec27, 0x4e222764, 0x1db87ce0, + 0x9a1eb7a3, 0x5c9c8476, 0xdb3a4f35, 0x88a014b1, 0x0f06dff2, + 0x2f94a3b9, 0xa83268fa, 0xfba8337e, 0x7c0ef83d, 0xaddd5295, + 0x2a7b99d6, 0x79e1c252, 0xfe470911, 0xded5755a, 0x5973be19, + 0x0ae9e59d, 0x8d4f2ede, 0x4bcd1d0b, 0xcc6bd648, 0x9ff18dcc, + 0x1857468f, 0x38c53ac4, 0xbf63f187, 0xecf9aa03, 0x6b5f6140, + 0x942ff912, 0x13893251, 0x401369d5, 0xc7b5a296, 0xe727dedd, + 0x6081159e, 0x331b4e1a, 0xb4bd8559, 0x723fb68c, 0xf5997dcf, + 0xa603264b, 0x21a5ed08, 0x01379143, 0x86915a00, 0xd50b0184, + 0x52adcac7, 0x837e606f, 0x04d8ab2c, 0x5742f0a8, 0xd0e43beb, + 0xf07647a0, 0x77d08ce3, 0x244ad767, 0xa3ec1c24, 0x656e2ff1, + 0xe2c8e4b2, 0xb152bf36, 0x36f47475, 0x1666083e, 0x91c0c37d, + 0xc25a98f9, 0x45fc53ba, 0xe7caae1c, 0x606c655f, 0x33f63edb, + 0xb450f598, 0x94c289d3, 0x13644290, 0x40fe1914, 0xc758d257, + 0x01dae182, 0x867c2ac1, 0xd5e67145, 0x5240ba06, 0x72d2c64d, + 0xf5740d0e, 0xa6ee568a, 0x21489dc9, 0xf09b3761, 0x773dfc22, + 0x24a7a7a6, 0xa3016ce5, 0x839310ae, 0x0435dbed, 0x57af8069, + 0xd0094b2a, 0x168b78ff, 0x912db3bc, 0xc2b7e838, 0x4511237b, + 0x65835f30, 0xe2259473, 0xb1bfcff7, 0x361904b4, 0xc9699ce6, + 0x4ecf57a5, 0x1d550c21, 0x9af3c762, 0xba61bb29, 0x3dc7706a, + 0x6e5d2bee, 0xe9fbe0ad, 0x2f79d378, 0xa8df183b, 0xfb4543bf, + 0x7ce388fc, 0x5c71f4b7, 0xdbd73ff4, 0x884d6470, 0x0febaf33, + 0xde38059b, 0x599eced8, 0x0a04955c, 0x8da25e1f, 0xad302254, + 0x2a96e917, 0x790cb293, 0xfeaa79d0, 0x38284a05, 0xbf8e8146, + 0xec14dac2, 0x6bb21181, 0x4b206dca, 0xcc86a689, 0x9f1cfd0d, + 0x18ba364e}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x43cba687, 0xc7903cd4, 0x845b9a53, 0xcf270873, + 0x8cecaef4, 0x08b734a7, 0x4b7c9220, 0x9e4f10e6, 0xdd84b661, + 0x59df2c32, 0x1a148ab5, 0x51681895, 0x12a3be12, 0x96f82441, + 0xd53382c6, 0x7d995117, 0x3e52f790, 0xba096dc3, 0xf9c2cb44, + 0xb2be5964, 0xf175ffe3, 0x752e65b0, 0x36e5c337, 0xe3d641f1, + 0xa01de776, 0x24467d25, 0x678ddba2, 0x2cf14982, 0x6f3aef05, + 0xeb617556, 0xa8aad3d1, 0xfa32a32e, 0xb9f905a9, 0x3da29ffa, + 0x7e69397d, 0x3515ab5d, 0x76de0dda, 0xf2859789, 0xb14e310e, + 0x647db3c8, 0x27b6154f, 0xa3ed8f1c, 0xe026299b, 0xab5abbbb, + 0xe8911d3c, 0x6cca876f, 0x2f0121e8, 0x87abf239, 0xc46054be, + 0x403bceed, 0x03f0686a, 0x488cfa4a, 0x0b475ccd, 0x8f1cc69e, + 0xccd76019, 0x19e4e2df, 0x5a2f4458, 0xde74de0b, 0x9dbf788c, + 0xd6c3eaac, 0x95084c2b, 0x1153d678, 0x529870ff, 0xf465465d, + 0xb7aee0da, 0x33f57a89, 0x703edc0e, 0x3b424e2e, 0x7889e8a9, + 0xfcd272fa, 0xbf19d47d, 0x6a2a56bb, 0x29e1f03c, 0xadba6a6f, + 0xee71cce8, 0xa50d5ec8, 0xe6c6f84f, 0x629d621c, 0x2156c49b, + 0x89fc174a, 0xca37b1cd, 0x4e6c2b9e, 0x0da78d19, 0x46db1f39, + 0x0510b9be, 0x814b23ed, 0xc280856a, 0x17b307ac, 0x5478a12b, + 0xd0233b78, 0x93e89dff, 0xd8940fdf, 0x9b5fa958, 0x1f04330b, + 0x5ccf958c, 0x0e57e573, 0x4d9c43f4, 0xc9c7d9a7, 0x8a0c7f20, + 0xc170ed00, 0x82bb4b87, 0x06e0d1d4, 0x452b7753, 0x9018f595, + 0xd3d35312, 0x5788c941, 0x14436fc6, 0x5f3ffde6, 0x1cf45b61, + 0x98afc132, 0xdb6467b5, 0x73ceb464, 0x300512e3, 0xb45e88b0, + 0xf7952e37, 0xbce9bc17, 0xff221a90, 0x7b7980c3, 0x38b22644, + 0xed81a482, 0xae4a0205, 0x2a119856, 0x69da3ed1, 0x22a6acf1, + 0x616d0a76, 0xe5369025, 0xa6fd36a2, 0xe8cb8cba, 0xab002a3d, + 0x2f5bb06e, 0x6c9016e9, 0x27ec84c9, 0x6427224e, 0xe07cb81d, + 0xa3b71e9a, 0x76849c5c, 0x354f3adb, 0xb114a088, 0xf2df060f, + 0xb9a3942f, 0xfa6832a8, 0x7e33a8fb, 0x3df80e7c, 0x9552ddad, + 0xd6997b2a, 0x52c2e179, 0x110947fe, 0x5a75d5de, 0x19be7359, + 0x9de5e90a, 0xde2e4f8d, 0x0b1dcd4b, 0x48d66bcc, 0xcc8df19f, + 0x8f465718, 0xc43ac538, 0x87f163bf, 0x03aaf9ec, 0x40615f6b, + 0x12f92f94, 0x51328913, 0xd5691340, 0x96a2b5c7, 0xddde27e7, + 0x9e158160, 0x1a4e1b33, 0x5985bdb4, 0x8cb63f72, 0xcf7d99f5, + 0x4b2603a6, 0x08eda521, 0x43913701, 0x005a9186, 0x84010bd5, + 0xc7caad52, 0x6f607e83, 0x2cabd804, 0xa8f04257, 0xeb3be4d0, + 0xa04776f0, 0xe38cd077, 0x67d74a24, 0x241ceca3, 0xf12f6e65, + 0xb2e4c8e2, 0x36bf52b1, 0x7574f436, 0x3e086616, 0x7dc3c091, + 0xf9985ac2, 0xba53fc45, 0x1caecae7, 0x5f656c60, 0xdb3ef633, + 0x98f550b4, 0xd389c294, 0x90426413, 0x1419fe40, 0x57d258c7, + 0x82e1da01, 0xc12a7c86, 0x4571e6d5, 0x06ba4052, 0x4dc6d272, + 0x0e0d74f5, 0x8a56eea6, 0xc99d4821, 0x61379bf0, 0x22fc3d77, + 0xa6a7a724, 0xe56c01a3, 0xae109383, 0xeddb3504, 0x6980af57, + 0x2a4b09d0, 0xff788b16, 0xbcb32d91, 0x38e8b7c2, 0x7b231145, + 0x305f8365, 0x739425e2, 0xf7cfbfb1, 0xb4041936, 0xe69c69c9, + 0xa557cf4e, 0x210c551d, 0x62c7f39a, 0x29bb61ba, 0x6a70c73d, + 0xee2b5d6e, 0xade0fbe9, 0x78d3792f, 0x3b18dfa8, 0xbf4345fb, + 0xfc88e37c, 0xb7f4715c, 0xf43fd7db, 0x70644d88, 0x33afeb0f, + 0x9b0538de, 0xd8ce9e59, 0x5c95040a, 0x1f5ea28d, 0x542230ad, + 0x17e9962a, 0x93b20c79, 0xd079aafe, 0x054a2838, 0x46818ebf, + 0xc2da14ec, 0x8111b26b, 0xca6d204b, 0x89a686cc, 0x0dfd1c9f, + 0x4e36ba18}, + {0x00000000, 0xe1b652ef, 0x836bd405, 0x62dd86ea, 0x06d7a80b, + 0xe761fae4, 0x85bc7c0e, 0x640a2ee1, 0x0cae5117, 0xed1803f8, + 0x8fc58512, 0x6e73d7fd, 0x0a79f91c, 0xebcfabf3, 0x89122d19, + 0x68a47ff6, 0x185ca32e, 0xf9eaf1c1, 0x9b37772b, 0x7a8125c4, + 0x1e8b0b25, 0xff3d59ca, 0x9de0df20, 0x7c568dcf, 0x14f2f239, + 0xf544a0d6, 0x9799263c, 0x762f74d3, 0x12255a32, 0xf39308dd, + 0x914e8e37, 0x70f8dcd8, 0x30b8465d, 0xd10e14b2, 0xb3d39258, + 0x5265c0b7, 0x366fee56, 0xd7d9bcb9, 0xb5043a53, 0x54b268bc, + 0x3c16174a, 0xdda045a5, 0xbf7dc34f, 0x5ecb91a0, 0x3ac1bf41, + 0xdb77edae, 0xb9aa6b44, 0x581c39ab, 0x28e4e573, 0xc952b79c, + 0xab8f3176, 0x4a396399, 0x2e334d78, 0xcf851f97, 0xad58997d, + 0x4ceecb92, 0x244ab464, 0xc5fce68b, 0xa7216061, 0x4697328e, + 0x229d1c6f, 0xc32b4e80, 0xa1f6c86a, 0x40409a85, 0x60708dba, + 0x81c6df55, 0xe31b59bf, 0x02ad0b50, 0x66a725b1, 0x8711775e, + 0xe5ccf1b4, 0x047aa35b, 0x6cdedcad, 0x8d688e42, 0xefb508a8, + 0x0e035a47, 0x6a0974a6, 0x8bbf2649, 0xe962a0a3, 0x08d4f24c, + 0x782c2e94, 0x999a7c7b, 0xfb47fa91, 0x1af1a87e, 0x7efb869f, + 0x9f4dd470, 0xfd90529a, 0x1c260075, 0x74827f83, 0x95342d6c, + 0xf7e9ab86, 0x165ff969, 0x7255d788, 0x93e38567, 0xf13e038d, + 0x10885162, 0x50c8cbe7, 0xb17e9908, 0xd3a31fe2, 0x32154d0d, + 0x561f63ec, 0xb7a93103, 0xd574b7e9, 0x34c2e506, 0x5c669af0, + 0xbdd0c81f, 0xdf0d4ef5, 0x3ebb1c1a, 0x5ab132fb, 0xbb076014, + 0xd9dae6fe, 0x386cb411, 0x489468c9, 0xa9223a26, 0xcbffbccc, + 0x2a49ee23, 0x4e43c0c2, 0xaff5922d, 0xcd2814c7, 0x2c9e4628, + 0x443a39de, 0xa58c6b31, 0xc751eddb, 0x26e7bf34, 0x42ed91d5, + 0xa35bc33a, 0xc18645d0, 0x2030173f, 0x81e66bae, 0x60503941, + 0x028dbfab, 0xe33bed44, 0x8731c3a5, 0x6687914a, 0x045a17a0, + 0xe5ec454f, 0x8d483ab9, 0x6cfe6856, 0x0e23eebc, 0xef95bc53, + 0x8b9f92b2, 0x6a29c05d, 0x08f446b7, 0xe9421458, 0x99bac880, + 0x780c9a6f, 0x1ad11c85, 0xfb674e6a, 0x9f6d608b, 0x7edb3264, + 0x1c06b48e, 0xfdb0e661, 0x95149997, 0x74a2cb78, 0x167f4d92, + 0xf7c91f7d, 0x93c3319c, 0x72756373, 0x10a8e599, 0xf11eb776, + 0xb15e2df3, 0x50e87f1c, 0x3235f9f6, 0xd383ab19, 0xb78985f8, + 0x563fd717, 0x34e251fd, 0xd5540312, 0xbdf07ce4, 0x5c462e0b, + 0x3e9ba8e1, 0xdf2dfa0e, 0xbb27d4ef, 0x5a918600, 0x384c00ea, + 0xd9fa5205, 0xa9028edd, 0x48b4dc32, 0x2a695ad8, 0xcbdf0837, + 0xafd526d6, 0x4e637439, 0x2cbef2d3, 0xcd08a03c, 0xa5acdfca, + 0x441a8d25, 0x26c70bcf, 0xc7715920, 0xa37b77c1, 0x42cd252e, + 0x2010a3c4, 0xc1a6f12b, 0xe196e614, 0x0020b4fb, 0x62fd3211, + 0x834b60fe, 0xe7414e1f, 0x06f71cf0, 0x642a9a1a, 0x859cc8f5, + 0xed38b703, 0x0c8ee5ec, 0x6e536306, 0x8fe531e9, 0xebef1f08, + 0x0a594de7, 0x6884cb0d, 0x893299e2, 0xf9ca453a, 0x187c17d5, + 0x7aa1913f, 0x9b17c3d0, 0xff1ded31, 0x1eabbfde, 0x7c763934, + 0x9dc06bdb, 0xf564142d, 0x14d246c2, 0x760fc028, 0x97b992c7, + 0xf3b3bc26, 0x1205eec9, 0x70d86823, 0x916e3acc, 0xd12ea049, + 0x3098f2a6, 0x5245744c, 0xb3f326a3, 0xd7f90842, 0x364f5aad, + 0x5492dc47, 0xb5248ea8, 0xdd80f15e, 0x3c36a3b1, 0x5eeb255b, + 0xbf5d77b4, 0xdb575955, 0x3ae10bba, 0x583c8d50, 0xb98adfbf, + 0xc9720367, 0x28c45188, 0x4a19d762, 0xabaf858d, 0xcfa5ab6c, + 0x2e13f983, 0x4cce7f69, 0xad782d86, 0xc5dc5270, 0x246a009f, + 0x46b78675, 0xa701d49a, 0xc30bfa7b, 0x22bda894, 0x40602e7e, + 0xa1d67c91}, + {0x00000000, 0x5880e2d7, 0xf106b474, 0xa98656a3, 0xe20d68e9, + 0xba8d8a3e, 0x130bdc9d, 0x4b8b3e4a, 0x851da109, 0xdd9d43de, + 0x741b157d, 0x2c9bf7aa, 0x6710c9e0, 0x3f902b37, 0x96167d94, + 0xce969f43, 0x0a3b4213, 0x52bba0c4, 0xfb3df667, 0xa3bd14b0, + 0xe8362afa, 0xb0b6c82d, 0x19309e8e, 0x41b07c59, 0x8f26e31a, + 0xd7a601cd, 0x7e20576e, 0x26a0b5b9, 0x6d2b8bf3, 0x35ab6924, + 0x9c2d3f87, 0xc4addd50, 0x14768426, 0x4cf666f1, 0xe5703052, + 0xbdf0d285, 0xf67beccf, 0xaefb0e18, 0x077d58bb, 0x5ffdba6c, + 0x916b252f, 0xc9ebc7f8, 0x606d915b, 0x38ed738c, 0x73664dc6, + 0x2be6af11, 0x8260f9b2, 0xdae01b65, 0x1e4dc635, 0x46cd24e2, + 0xef4b7241, 0xb7cb9096, 0xfc40aedc, 0xa4c04c0b, 0x0d461aa8, + 0x55c6f87f, 0x9b50673c, 0xc3d085eb, 0x6a56d348, 0x32d6319f, + 0x795d0fd5, 0x21dded02, 0x885bbba1, 0xd0db5976, 0x28ec084d, + 0x706cea9a, 0xd9eabc39, 0x816a5eee, 0xcae160a4, 0x92618273, + 0x3be7d4d0, 0x63673607, 0xadf1a944, 0xf5714b93, 0x5cf71d30, + 0x0477ffe7, 0x4ffcc1ad, 0x177c237a, 0xbefa75d9, 0xe67a970e, + 0x22d74a5e, 0x7a57a889, 0xd3d1fe2a, 0x8b511cfd, 0xc0da22b7, + 0x985ac060, 0x31dc96c3, 0x695c7414, 0xa7caeb57, 0xff4a0980, + 0x56cc5f23, 0x0e4cbdf4, 0x45c783be, 0x1d476169, 0xb4c137ca, + 0xec41d51d, 0x3c9a8c6b, 0x641a6ebc, 0xcd9c381f, 0x951cdac8, + 0xde97e482, 0x86170655, 0x2f9150f6, 0x7711b221, 0xb9872d62, + 0xe107cfb5, 0x48819916, 0x10017bc1, 0x5b8a458b, 0x030aa75c, + 0xaa8cf1ff, 0xf20c1328, 0x36a1ce78, 0x6e212caf, 0xc7a77a0c, + 0x9f2798db, 0xd4aca691, 0x8c2c4446, 0x25aa12e5, 0x7d2af032, + 0xb3bc6f71, 0xeb3c8da6, 0x42badb05, 0x1a3a39d2, 0x51b10798, + 0x0931e54f, 0xa0b7b3ec, 0xf837513b, 0x50d8119a, 0x0858f34d, + 0xa1dea5ee, 0xf95e4739, 0xb2d57973, 0xea559ba4, 0x43d3cd07, + 0x1b532fd0, 0xd5c5b093, 0x8d455244, 0x24c304e7, 0x7c43e630, + 0x37c8d87a, 0x6f483aad, 0xc6ce6c0e, 0x9e4e8ed9, 0x5ae35389, + 0x0263b15e, 0xabe5e7fd, 0xf365052a, 0xb8ee3b60, 0xe06ed9b7, + 0x49e88f14, 0x11686dc3, 0xdffef280, 0x877e1057, 0x2ef846f4, + 0x7678a423, 0x3df39a69, 0x657378be, 0xccf52e1d, 0x9475ccca, + 0x44ae95bc, 0x1c2e776b, 0xb5a821c8, 0xed28c31f, 0xa6a3fd55, + 0xfe231f82, 0x57a54921, 0x0f25abf6, 0xc1b334b5, 0x9933d662, + 0x30b580c1, 0x68356216, 0x23be5c5c, 0x7b3ebe8b, 0xd2b8e828, + 0x8a380aff, 0x4e95d7af, 0x16153578, 0xbf9363db, 0xe713810c, + 0xac98bf46, 0xf4185d91, 0x5d9e0b32, 0x051ee9e5, 0xcb8876a6, + 0x93089471, 0x3a8ec2d2, 0x620e2005, 0x29851e4f, 0x7105fc98, + 0xd883aa3b, 0x800348ec, 0x783419d7, 0x20b4fb00, 0x8932ada3, + 0xd1b24f74, 0x9a39713e, 0xc2b993e9, 0x6b3fc54a, 0x33bf279d, + 0xfd29b8de, 0xa5a95a09, 0x0c2f0caa, 0x54afee7d, 0x1f24d037, + 0x47a432e0, 0xee226443, 0xb6a28694, 0x720f5bc4, 0x2a8fb913, + 0x8309efb0, 0xdb890d67, 0x9002332d, 0xc882d1fa, 0x61048759, + 0x3984658e, 0xf712facd, 0xaf92181a, 0x06144eb9, 0x5e94ac6e, + 0x151f9224, 0x4d9f70f3, 0xe4192650, 0xbc99c487, 0x6c429df1, + 0x34c27f26, 0x9d442985, 0xc5c4cb52, 0x8e4ff518, 0xd6cf17cf, + 0x7f49416c, 0x27c9a3bb, 0xe95f3cf8, 0xb1dfde2f, 0x1859888c, + 0x40d96a5b, 0x0b525411, 0x53d2b6c6, 0xfa54e065, 0xa2d402b2, + 0x6679dfe2, 0x3ef93d35, 0x977f6b96, 0xcfff8941, 0x8474b70b, + 0xdcf455dc, 0x7572037f, 0x2df2e1a8, 0xe3647eeb, 0xbbe49c3c, + 0x1262ca9f, 0x4ae22848, 0x01691602, 0x59e9f4d5, 0xf06fa276, + 0xa8ef40a1}, + {0x00000000, 0x463b6765, 0x8c76ceca, 0xca4da9af, 0x59ebed4e, + 0x1fd08a2b, 0xd59d2384, 0x93a644e1, 0xb2d6db9d, 0xf4edbcf8, + 0x3ea01557, 0x789b7232, 0xeb3d36d3, 0xad0651b6, 0x674bf819, + 0x21709f7c, 0x25abc6e0, 0x6390a185, 0xa9dd082a, 0xefe66f4f, + 0x7c402bae, 0x3a7b4ccb, 0xf036e564, 0xb60d8201, 0x977d1d7d, + 0xd1467a18, 0x1b0bd3b7, 0x5d30b4d2, 0xce96f033, 0x88ad9756, + 0x42e03ef9, 0x04db599c, 0x0b50fc1a, 0x4d6b9b7f, 0x872632d0, + 0xc11d55b5, 0x52bb1154, 0x14807631, 0xdecddf9e, 0x98f6b8fb, + 0xb9862787, 0xffbd40e2, 0x35f0e94d, 0x73cb8e28, 0xe06dcac9, + 0xa656adac, 0x6c1b0403, 0x2a206366, 0x2efb3afa, 0x68c05d9f, + 0xa28df430, 0xe4b69355, 0x7710d7b4, 0x312bb0d1, 0xfb66197e, + 0xbd5d7e1b, 0x9c2de167, 0xda168602, 0x105b2fad, 0x566048c8, + 0xc5c60c29, 0x83fd6b4c, 0x49b0c2e3, 0x0f8ba586, 0x16a0f835, + 0x509b9f50, 0x9ad636ff, 0xdced519a, 0x4f4b157b, 0x0970721e, + 0xc33ddbb1, 0x8506bcd4, 0xa47623a8, 0xe24d44cd, 0x2800ed62, + 0x6e3b8a07, 0xfd9dcee6, 0xbba6a983, 0x71eb002c, 0x37d06749, + 0x330b3ed5, 0x753059b0, 0xbf7df01f, 0xf946977a, 0x6ae0d39b, + 0x2cdbb4fe, 0xe6961d51, 0xa0ad7a34, 0x81dde548, 0xc7e6822d, + 0x0dab2b82, 0x4b904ce7, 0xd8360806, 0x9e0d6f63, 0x5440c6cc, + 0x127ba1a9, 0x1df0042f, 0x5bcb634a, 0x9186cae5, 0xd7bdad80, + 0x441be961, 0x02208e04, 0xc86d27ab, 0x8e5640ce, 0xaf26dfb2, + 0xe91db8d7, 0x23501178, 0x656b761d, 0xf6cd32fc, 0xb0f65599, + 0x7abbfc36, 0x3c809b53, 0x385bc2cf, 0x7e60a5aa, 0xb42d0c05, + 0xf2166b60, 0x61b02f81, 0x278b48e4, 0xedc6e14b, 0xabfd862e, + 0x8a8d1952, 0xccb67e37, 0x06fbd798, 0x40c0b0fd, 0xd366f41c, + 0x955d9379, 0x5f103ad6, 0x192b5db3, 0x2c40f16b, 0x6a7b960e, + 0xa0363fa1, 0xe60d58c4, 0x75ab1c25, 0x33907b40, 0xf9ddd2ef, + 0xbfe6b58a, 0x9e962af6, 0xd8ad4d93, 0x12e0e43c, 0x54db8359, + 0xc77dc7b8, 0x8146a0dd, 0x4b0b0972, 0x0d306e17, 0x09eb378b, + 0x4fd050ee, 0x859df941, 0xc3a69e24, 0x5000dac5, 0x163bbda0, + 0xdc76140f, 0x9a4d736a, 0xbb3dec16, 0xfd068b73, 0x374b22dc, + 0x717045b9, 0xe2d60158, 0xa4ed663d, 0x6ea0cf92, 0x289ba8f7, + 0x27100d71, 0x612b6a14, 0xab66c3bb, 0xed5da4de, 0x7efbe03f, + 0x38c0875a, 0xf28d2ef5, 0xb4b64990, 0x95c6d6ec, 0xd3fdb189, + 0x19b01826, 0x5f8b7f43, 0xcc2d3ba2, 0x8a165cc7, 0x405bf568, + 0x0660920d, 0x02bbcb91, 0x4480acf4, 0x8ecd055b, 0xc8f6623e, + 0x5b5026df, 0x1d6b41ba, 0xd726e815, 0x911d8f70, 0xb06d100c, + 0xf6567769, 0x3c1bdec6, 0x7a20b9a3, 0xe986fd42, 0xafbd9a27, + 0x65f03388, 0x23cb54ed, 0x3ae0095e, 0x7cdb6e3b, 0xb696c794, + 0xf0ada0f1, 0x630be410, 0x25308375, 0xef7d2ada, 0xa9464dbf, + 0x8836d2c3, 0xce0db5a6, 0x04401c09, 0x427b7b6c, 0xd1dd3f8d, + 0x97e658e8, 0x5dabf147, 0x1b909622, 0x1f4bcfbe, 0x5970a8db, + 0x933d0174, 0xd5066611, 0x46a022f0, 0x009b4595, 0xcad6ec3a, + 0x8ced8b5f, 0xad9d1423, 0xeba67346, 0x21ebdae9, 0x67d0bd8c, + 0xf476f96d, 0xb24d9e08, 0x780037a7, 0x3e3b50c2, 0x31b0f544, + 0x778b9221, 0xbdc63b8e, 0xfbfd5ceb, 0x685b180a, 0x2e607f6f, + 0xe42dd6c0, 0xa216b1a5, 0x83662ed9, 0xc55d49bc, 0x0f10e013, + 0x492b8776, 0xda8dc397, 0x9cb6a4f2, 0x56fb0d5d, 0x10c06a38, + 0x141b33a4, 0x522054c1, 0x986dfd6e, 0xde569a0b, 0x4df0deea, + 0x0bcbb98f, 0xc1861020, 0x87bd7745, 0xa6cde839, 0xe0f68f5c, + 0x2abb26f3, 0x6c804196, 0xff260577, 0xb91d6212, 0x7350cbbd, + 0x356bacd8}}; + +#endif + +#endif + +#if N == 6 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x3db1ecdc, 0x7b63d9b8, 0x46d23564, 0xf6c7b370, + 0xcb765fac, 0x8da46ac8, 0xb0158614, 0x36fe60a1, 0x0b4f8c7d, + 0x4d9db919, 0x702c55c5, 0xc039d3d1, 0xfd883f0d, 0xbb5a0a69, + 0x86ebe6b5, 0x6dfcc142, 0x504d2d9e, 0x169f18fa, 0x2b2ef426, + 0x9b3b7232, 0xa68a9eee, 0xe058ab8a, 0xdde94756, 0x5b02a1e3, + 0x66b34d3f, 0x2061785b, 0x1dd09487, 0xadc51293, 0x9074fe4f, + 0xd6a6cb2b, 0xeb1727f7, 0xdbf98284, 0xe6486e58, 0xa09a5b3c, + 0x9d2bb7e0, 0x2d3e31f4, 0x108fdd28, 0x565de84c, 0x6bec0490, + 0xed07e225, 0xd0b60ef9, 0x96643b9d, 0xabd5d741, 0x1bc05155, + 0x2671bd89, 0x60a388ed, 0x5d126431, 0xb60543c6, 0x8bb4af1a, + 0xcd669a7e, 0xf0d776a2, 0x40c2f0b6, 0x7d731c6a, 0x3ba1290e, + 0x0610c5d2, 0x80fb2367, 0xbd4acfbb, 0xfb98fadf, 0xc6291603, + 0x763c9017, 0x4b8d7ccb, 0x0d5f49af, 0x30eea573, 0x6c820349, + 0x5133ef95, 0x17e1daf1, 0x2a50362d, 0x9a45b039, 0xa7f45ce5, + 0xe1266981, 0xdc97855d, 0x5a7c63e8, 0x67cd8f34, 0x211fba50, + 0x1cae568c, 0xacbbd098, 0x910a3c44, 0xd7d80920, 0xea69e5fc, + 0x017ec20b, 0x3ccf2ed7, 0x7a1d1bb3, 0x47acf76f, 0xf7b9717b, + 0xca089da7, 0x8cdaa8c3, 0xb16b441f, 0x3780a2aa, 0x0a314e76, + 0x4ce37b12, 0x715297ce, 0xc14711da, 0xfcf6fd06, 0xba24c862, + 0x879524be, 0xb77b81cd, 0x8aca6d11, 0xcc185875, 0xf1a9b4a9, + 0x41bc32bd, 0x7c0dde61, 0x3adfeb05, 0x076e07d9, 0x8185e16c, + 0xbc340db0, 0xfae638d4, 0xc757d408, 0x7742521c, 0x4af3bec0, + 0x0c218ba4, 0x31906778, 0xda87408f, 0xe736ac53, 0xa1e49937, + 0x9c5575eb, 0x2c40f3ff, 0x11f11f23, 0x57232a47, 0x6a92c69b, + 0xec79202e, 0xd1c8ccf2, 0x971af996, 0xaaab154a, 0x1abe935e, + 0x270f7f82, 0x61dd4ae6, 0x5c6ca63a, 0xd9040692, 0xe4b5ea4e, + 0xa267df2a, 0x9fd633f6, 0x2fc3b5e2, 0x1272593e, 0x54a06c5a, + 0x69118086, 0xeffa6633, 0xd24b8aef, 0x9499bf8b, 0xa9285357, + 0x193dd543, 0x248c399f, 0x625e0cfb, 0x5fefe027, 0xb4f8c7d0, + 0x89492b0c, 0xcf9b1e68, 0xf22af2b4, 0x423f74a0, 0x7f8e987c, + 0x395cad18, 0x04ed41c4, 0x8206a771, 0xbfb74bad, 0xf9657ec9, + 0xc4d49215, 0x74c11401, 0x4970f8dd, 0x0fa2cdb9, 0x32132165, + 0x02fd8416, 0x3f4c68ca, 0x799e5dae, 0x442fb172, 0xf43a3766, + 0xc98bdbba, 0x8f59eede, 0xb2e80202, 0x3403e4b7, 0x09b2086b, + 0x4f603d0f, 0x72d1d1d3, 0xc2c457c7, 0xff75bb1b, 0xb9a78e7f, + 0x841662a3, 0x6f014554, 0x52b0a988, 0x14629cec, 0x29d37030, + 0x99c6f624, 0xa4771af8, 0xe2a52f9c, 0xdf14c340, 0x59ff25f5, + 0x644ec929, 0x229cfc4d, 0x1f2d1091, 0xaf389685, 0x92897a59, + 0xd45b4f3d, 0xe9eaa3e1, 0xb58605db, 0x8837e907, 0xcee5dc63, + 0xf35430bf, 0x4341b6ab, 0x7ef05a77, 0x38226f13, 0x059383cf, + 0x8378657a, 0xbec989a6, 0xf81bbcc2, 0xc5aa501e, 0x75bfd60a, + 0x480e3ad6, 0x0edc0fb2, 0x336de36e, 0xd87ac499, 0xe5cb2845, + 0xa3191d21, 0x9ea8f1fd, 0x2ebd77e9, 0x130c9b35, 0x55deae51, + 0x686f428d, 0xee84a438, 0xd33548e4, 0x95e77d80, 0xa856915c, + 0x18431748, 0x25f2fb94, 0x6320cef0, 0x5e91222c, 0x6e7f875f, + 0x53ce6b83, 0x151c5ee7, 0x28adb23b, 0x98b8342f, 0xa509d8f3, + 0xe3dbed97, 0xde6a014b, 0x5881e7fe, 0x65300b22, 0x23e23e46, + 0x1e53d29a, 0xae46548e, 0x93f7b852, 0xd5258d36, 0xe89461ea, + 0x0383461d, 0x3e32aac1, 0x78e09fa5, 0x45517379, 0xf544f56d, + 0xc8f519b1, 0x8e272cd5, 0xb396c009, 0x357d26bc, 0x08ccca60, + 0x4e1eff04, 0x73af13d8, 0xc3ba95cc, 0xfe0b7910, 0xb8d94c74, + 0x8568a0a8}, + {0x00000000, 0x69790b65, 0xd2f216ca, 0xbb8b1daf, 0x7e952bd5, + 0x17ec20b0, 0xac673d1f, 0xc51e367a, 0xfd2a57aa, 0x94535ccf, + 0x2fd84160, 0x46a14a05, 0x83bf7c7f, 0xeac6771a, 0x514d6ab5, + 0x383461d0, 0x2125a915, 0x485ca270, 0xf3d7bfdf, 0x9aaeb4ba, + 0x5fb082c0, 0x36c989a5, 0x8d42940a, 0xe43b9f6f, 0xdc0ffebf, + 0xb576f5da, 0x0efde875, 0x6784e310, 0xa29ad56a, 0xcbe3de0f, + 0x7068c3a0, 0x1911c8c5, 0x424b522a, 0x2b32594f, 0x90b944e0, + 0xf9c04f85, 0x3cde79ff, 0x55a7729a, 0xee2c6f35, 0x87556450, + 0xbf610580, 0xd6180ee5, 0x6d93134a, 0x04ea182f, 0xc1f42e55, + 0xa88d2530, 0x1306389f, 0x7a7f33fa, 0x636efb3f, 0x0a17f05a, + 0xb19cedf5, 0xd8e5e690, 0x1dfbd0ea, 0x7482db8f, 0xcf09c620, + 0xa670cd45, 0x9e44ac95, 0xf73da7f0, 0x4cb6ba5f, 0x25cfb13a, + 0xe0d18740, 0x89a88c25, 0x3223918a, 0x5b5a9aef, 0x8496a454, + 0xedefaf31, 0x5664b29e, 0x3f1db9fb, 0xfa038f81, 0x937a84e4, + 0x28f1994b, 0x4188922e, 0x79bcf3fe, 0x10c5f89b, 0xab4ee534, + 0xc237ee51, 0x0729d82b, 0x6e50d34e, 0xd5dbcee1, 0xbca2c584, + 0xa5b30d41, 0xccca0624, 0x77411b8b, 0x1e3810ee, 0xdb262694, + 0xb25f2df1, 0x09d4305e, 0x60ad3b3b, 0x58995aeb, 0x31e0518e, + 0x8a6b4c21, 0xe3124744, 0x260c713e, 0x4f757a5b, 0xf4fe67f4, + 0x9d876c91, 0xc6ddf67e, 0xafa4fd1b, 0x142fe0b4, 0x7d56ebd1, + 0xb848ddab, 0xd131d6ce, 0x6abacb61, 0x03c3c004, 0x3bf7a1d4, + 0x528eaab1, 0xe905b71e, 0x807cbc7b, 0x45628a01, 0x2c1b8164, + 0x97909ccb, 0xfee997ae, 0xe7f85f6b, 0x8e81540e, 0x350a49a1, + 0x5c7342c4, 0x996d74be, 0xf0147fdb, 0x4b9f6274, 0x22e66911, + 0x1ad208c1, 0x73ab03a4, 0xc8201e0b, 0xa159156e, 0x64472314, + 0x0d3e2871, 0xb6b535de, 0xdfcc3ebb, 0xd25c4ee9, 0xbb25458c, + 0x00ae5823, 0x69d75346, 0xacc9653c, 0xc5b06e59, 0x7e3b73f6, + 0x17427893, 0x2f761943, 0x460f1226, 0xfd840f89, 0x94fd04ec, + 0x51e33296, 0x389a39f3, 0x8311245c, 0xea682f39, 0xf379e7fc, + 0x9a00ec99, 0x218bf136, 0x48f2fa53, 0x8deccc29, 0xe495c74c, + 0x5f1edae3, 0x3667d186, 0x0e53b056, 0x672abb33, 0xdca1a69c, + 0xb5d8adf9, 0x70c69b83, 0x19bf90e6, 0xa2348d49, 0xcb4d862c, + 0x90171cc3, 0xf96e17a6, 0x42e50a09, 0x2b9c016c, 0xee823716, + 0x87fb3c73, 0x3c7021dc, 0x55092ab9, 0x6d3d4b69, 0x0444400c, + 0xbfcf5da3, 0xd6b656c6, 0x13a860bc, 0x7ad16bd9, 0xc15a7676, + 0xa8237d13, 0xb132b5d6, 0xd84bbeb3, 0x63c0a31c, 0x0ab9a879, + 0xcfa79e03, 0xa6de9566, 0x1d5588c9, 0x742c83ac, 0x4c18e27c, + 0x2561e919, 0x9eeaf4b6, 0xf793ffd3, 0x328dc9a9, 0x5bf4c2cc, + 0xe07fdf63, 0x8906d406, 0x56caeabd, 0x3fb3e1d8, 0x8438fc77, + 0xed41f712, 0x285fc168, 0x4126ca0d, 0xfaadd7a2, 0x93d4dcc7, + 0xabe0bd17, 0xc299b672, 0x7912abdd, 0x106ba0b8, 0xd57596c2, + 0xbc0c9da7, 0x07878008, 0x6efe8b6d, 0x77ef43a8, 0x1e9648cd, + 0xa51d5562, 0xcc645e07, 0x097a687d, 0x60036318, 0xdb887eb7, + 0xb2f175d2, 0x8ac51402, 0xe3bc1f67, 0x583702c8, 0x314e09ad, + 0xf4503fd7, 0x9d2934b2, 0x26a2291d, 0x4fdb2278, 0x1481b897, + 0x7df8b3f2, 0xc673ae5d, 0xaf0aa538, 0x6a149342, 0x036d9827, + 0xb8e68588, 0xd19f8eed, 0xe9abef3d, 0x80d2e458, 0x3b59f9f7, + 0x5220f292, 0x973ec4e8, 0xfe47cf8d, 0x45ccd222, 0x2cb5d947, + 0x35a41182, 0x5cdd1ae7, 0xe7560748, 0x8e2f0c2d, 0x4b313a57, + 0x22483132, 0x99c32c9d, 0xf0ba27f8, 0xc88e4628, 0xa1f74d4d, + 0x1a7c50e2, 0x73055b87, 0xb61b6dfd, 0xdf626698, 0x64e97b37, + 0x0d907052}, + {0x00000000, 0x7fc99b93, 0xff933726, 0x805aacb5, 0x2457680d, + 0x5b9ef39e, 0xdbc45f2b, 0xa40dc4b8, 0x48aed01a, 0x37674b89, + 0xb73de73c, 0xc8f47caf, 0x6cf9b817, 0x13302384, 0x936a8f31, + 0xeca314a2, 0x915da034, 0xee943ba7, 0x6ece9712, 0x11070c81, + 0xb50ac839, 0xcac353aa, 0x4a99ff1f, 0x3550648c, 0xd9f3702e, + 0xa63aebbd, 0x26604708, 0x59a9dc9b, 0xfda41823, 0x826d83b0, + 0x02372f05, 0x7dfeb496, 0xf9ca4629, 0x8603ddba, 0x0659710f, + 0x7990ea9c, 0xdd9d2e24, 0xa254b5b7, 0x220e1902, 0x5dc78291, + 0xb1649633, 0xcead0da0, 0x4ef7a115, 0x313e3a86, 0x9533fe3e, + 0xeafa65ad, 0x6aa0c918, 0x1569528b, 0x6897e61d, 0x175e7d8e, + 0x9704d13b, 0xe8cd4aa8, 0x4cc08e10, 0x33091583, 0xb353b936, + 0xcc9a22a5, 0x20393607, 0x5ff0ad94, 0xdfaa0121, 0xa0639ab2, + 0x046e5e0a, 0x7ba7c599, 0xfbfd692c, 0x8434f2bf, 0x28e58a13, + 0x572c1180, 0xd776bd35, 0xa8bf26a6, 0x0cb2e21e, 0x737b798d, + 0xf321d538, 0x8ce84eab, 0x604b5a09, 0x1f82c19a, 0x9fd86d2f, + 0xe011f6bc, 0x441c3204, 0x3bd5a997, 0xbb8f0522, 0xc4469eb1, + 0xb9b82a27, 0xc671b1b4, 0x462b1d01, 0x39e28692, 0x9def422a, + 0xe226d9b9, 0x627c750c, 0x1db5ee9f, 0xf116fa3d, 0x8edf61ae, + 0x0e85cd1b, 0x714c5688, 0xd5419230, 0xaa8809a3, 0x2ad2a516, + 0x551b3e85, 0xd12fcc3a, 0xaee657a9, 0x2ebcfb1c, 0x5175608f, + 0xf578a437, 0x8ab13fa4, 0x0aeb9311, 0x75220882, 0x99811c20, + 0xe64887b3, 0x66122b06, 0x19dbb095, 0xbdd6742d, 0xc21fefbe, + 0x4245430b, 0x3d8cd898, 0x40726c0e, 0x3fbbf79d, 0xbfe15b28, + 0xc028c0bb, 0x64250403, 0x1bec9f90, 0x9bb63325, 0xe47fa8b6, + 0x08dcbc14, 0x77152787, 0xf74f8b32, 0x888610a1, 0x2c8bd419, + 0x53424f8a, 0xd318e33f, 0xacd178ac, 0x51cb1426, 0x2e028fb5, + 0xae582300, 0xd191b893, 0x759c7c2b, 0x0a55e7b8, 0x8a0f4b0d, + 0xf5c6d09e, 0x1965c43c, 0x66ac5faf, 0xe6f6f31a, 0x993f6889, + 0x3d32ac31, 0x42fb37a2, 0xc2a19b17, 0xbd680084, 0xc096b412, + 0xbf5f2f81, 0x3f058334, 0x40cc18a7, 0xe4c1dc1f, 0x9b08478c, + 0x1b52eb39, 0x649b70aa, 0x88386408, 0xf7f1ff9b, 0x77ab532e, + 0x0862c8bd, 0xac6f0c05, 0xd3a69796, 0x53fc3b23, 0x2c35a0b0, + 0xa801520f, 0xd7c8c99c, 0x57926529, 0x285bfeba, 0x8c563a02, + 0xf39fa191, 0x73c50d24, 0x0c0c96b7, 0xe0af8215, 0x9f661986, + 0x1f3cb533, 0x60f52ea0, 0xc4f8ea18, 0xbb31718b, 0x3b6bdd3e, + 0x44a246ad, 0x395cf23b, 0x469569a8, 0xc6cfc51d, 0xb9065e8e, + 0x1d0b9a36, 0x62c201a5, 0xe298ad10, 0x9d513683, 0x71f22221, + 0x0e3bb9b2, 0x8e611507, 0xf1a88e94, 0x55a54a2c, 0x2a6cd1bf, + 0xaa367d0a, 0xd5ffe699, 0x792e9e35, 0x06e705a6, 0x86bda913, + 0xf9743280, 0x5d79f638, 0x22b06dab, 0xa2eac11e, 0xdd235a8d, + 0x31804e2f, 0x4e49d5bc, 0xce137909, 0xb1dae29a, 0x15d72622, + 0x6a1ebdb1, 0xea441104, 0x958d8a97, 0xe8733e01, 0x97baa592, + 0x17e00927, 0x682992b4, 0xcc24560c, 0xb3edcd9f, 0x33b7612a, + 0x4c7efab9, 0xa0ddee1b, 0xdf147588, 0x5f4ed93d, 0x208742ae, + 0x848a8616, 0xfb431d85, 0x7b19b130, 0x04d02aa3, 0x80e4d81c, + 0xff2d438f, 0x7f77ef3a, 0x00be74a9, 0xa4b3b011, 0xdb7a2b82, + 0x5b208737, 0x24e91ca4, 0xc84a0806, 0xb7839395, 0x37d93f20, + 0x4810a4b3, 0xec1d600b, 0x93d4fb98, 0x138e572d, 0x6c47ccbe, + 0x11b97828, 0x6e70e3bb, 0xee2a4f0e, 0x91e3d49d, 0x35ee1025, + 0x4a278bb6, 0xca7d2703, 0xb5b4bc90, 0x5917a832, 0x26de33a1, + 0xa6849f14, 0xd94d0487, 0x7d40c03f, 0x02895bac, 0x82d3f719, + 0xfd1a6c8a}, + {0x00000000, 0xa396284c, 0x9c5d56d9, 0x3fcb7e95, 0xe3cbabf3, + 0x405d83bf, 0x7f96fd2a, 0xdc00d566, 0x1ce651a7, 0xbf7079eb, + 0x80bb077e, 0x232d2f32, 0xff2dfa54, 0x5cbbd218, 0x6370ac8d, + 0xc0e684c1, 0x39cca34e, 0x9a5a8b02, 0xa591f597, 0x0607dddb, + 0xda0708bd, 0x799120f1, 0x465a5e64, 0xe5cc7628, 0x252af2e9, + 0x86bcdaa5, 0xb977a430, 0x1ae18c7c, 0xc6e1591a, 0x65777156, + 0x5abc0fc3, 0xf92a278f, 0x7399469c, 0xd00f6ed0, 0xefc41045, + 0x4c523809, 0x9052ed6f, 0x33c4c523, 0x0c0fbbb6, 0xaf9993fa, + 0x6f7f173b, 0xcce93f77, 0xf32241e2, 0x50b469ae, 0x8cb4bcc8, + 0x2f229484, 0x10e9ea11, 0xb37fc25d, 0x4a55e5d2, 0xe9c3cd9e, + 0xd608b30b, 0x759e9b47, 0xa99e4e21, 0x0a08666d, 0x35c318f8, + 0x965530b4, 0x56b3b475, 0xf5259c39, 0xcaeee2ac, 0x6978cae0, + 0xb5781f86, 0x16ee37ca, 0x2925495f, 0x8ab36113, 0xe7328d38, + 0x44a4a574, 0x7b6fdbe1, 0xd8f9f3ad, 0x04f926cb, 0xa76f0e87, + 0x98a47012, 0x3b32585e, 0xfbd4dc9f, 0x5842f4d3, 0x67898a46, + 0xc41fa20a, 0x181f776c, 0xbb895f20, 0x844221b5, 0x27d409f9, + 0xdefe2e76, 0x7d68063a, 0x42a378af, 0xe13550e3, 0x3d358585, + 0x9ea3adc9, 0xa168d35c, 0x02fefb10, 0xc2187fd1, 0x618e579d, + 0x5e452908, 0xfdd30144, 0x21d3d422, 0x8245fc6e, 0xbd8e82fb, + 0x1e18aab7, 0x94abcba4, 0x373de3e8, 0x08f69d7d, 0xab60b531, + 0x77606057, 0xd4f6481b, 0xeb3d368e, 0x48ab1ec2, 0x884d9a03, + 0x2bdbb24f, 0x1410ccda, 0xb786e496, 0x6b8631f0, 0xc81019bc, + 0xf7db6729, 0x544d4f65, 0xad6768ea, 0x0ef140a6, 0x313a3e33, + 0x92ac167f, 0x4eacc319, 0xed3aeb55, 0xd2f195c0, 0x7167bd8c, + 0xb181394d, 0x12171101, 0x2ddc6f94, 0x8e4a47d8, 0x524a92be, + 0xf1dcbaf2, 0xce17c467, 0x6d81ec2b, 0x15141c31, 0xb682347d, + 0x89494ae8, 0x2adf62a4, 0xf6dfb7c2, 0x55499f8e, 0x6a82e11b, + 0xc914c957, 0x09f24d96, 0xaa6465da, 0x95af1b4f, 0x36393303, + 0xea39e665, 0x49afce29, 0x7664b0bc, 0xd5f298f0, 0x2cd8bf7f, + 0x8f4e9733, 0xb085e9a6, 0x1313c1ea, 0xcf13148c, 0x6c853cc0, + 0x534e4255, 0xf0d86a19, 0x303eeed8, 0x93a8c694, 0xac63b801, + 0x0ff5904d, 0xd3f5452b, 0x70636d67, 0x4fa813f2, 0xec3e3bbe, + 0x668d5aad, 0xc51b72e1, 0xfad00c74, 0x59462438, 0x8546f15e, + 0x26d0d912, 0x191ba787, 0xba8d8fcb, 0x7a6b0b0a, 0xd9fd2346, + 0xe6365dd3, 0x45a0759f, 0x99a0a0f9, 0x3a3688b5, 0x05fdf620, + 0xa66bde6c, 0x5f41f9e3, 0xfcd7d1af, 0xc31caf3a, 0x608a8776, + 0xbc8a5210, 0x1f1c7a5c, 0x20d704c9, 0x83412c85, 0x43a7a844, + 0xe0318008, 0xdffafe9d, 0x7c6cd6d1, 0xa06c03b7, 0x03fa2bfb, + 0x3c31556e, 0x9fa77d22, 0xf2269109, 0x51b0b945, 0x6e7bc7d0, + 0xcdedef9c, 0x11ed3afa, 0xb27b12b6, 0x8db06c23, 0x2e26446f, + 0xeec0c0ae, 0x4d56e8e2, 0x729d9677, 0xd10bbe3b, 0x0d0b6b5d, + 0xae9d4311, 0x91563d84, 0x32c015c8, 0xcbea3247, 0x687c1a0b, + 0x57b7649e, 0xf4214cd2, 0x282199b4, 0x8bb7b1f8, 0xb47ccf6d, + 0x17eae721, 0xd70c63e0, 0x749a4bac, 0x4b513539, 0xe8c71d75, + 0x34c7c813, 0x9751e05f, 0xa89a9eca, 0x0b0cb686, 0x81bfd795, + 0x2229ffd9, 0x1de2814c, 0xbe74a900, 0x62747c66, 0xc1e2542a, + 0xfe292abf, 0x5dbf02f3, 0x9d598632, 0x3ecfae7e, 0x0104d0eb, + 0xa292f8a7, 0x7e922dc1, 0xdd04058d, 0xe2cf7b18, 0x41595354, + 0xb87374db, 0x1be55c97, 0x242e2202, 0x87b80a4e, 0x5bb8df28, + 0xf82ef764, 0xc7e589f1, 0x6473a1bd, 0xa495257c, 0x07030d30, + 0x38c873a5, 0x9b5e5be9, 0x475e8e8f, 0xe4c8a6c3, 0xdb03d856, + 0x7895f01a}, + {0x00000000, 0x2a283862, 0x545070c4, 0x7e7848a6, 0xa8a0e188, + 0x8288d9ea, 0xfcf0914c, 0xd6d8a92e, 0x8a30c551, 0xa018fd33, + 0xde60b595, 0xf4488df7, 0x229024d9, 0x08b81cbb, 0x76c0541d, + 0x5ce86c7f, 0xcf108ce3, 0xe538b481, 0x9b40fc27, 0xb168c445, + 0x67b06d6b, 0x4d985509, 0x33e01daf, 0x19c825cd, 0x452049b2, + 0x6f0871d0, 0x11703976, 0x3b580114, 0xed80a83a, 0xc7a89058, + 0xb9d0d8fe, 0x93f8e09c, 0x45501f87, 0x6f7827e5, 0x11006f43, + 0x3b285721, 0xedf0fe0f, 0xc7d8c66d, 0xb9a08ecb, 0x9388b6a9, + 0xcf60dad6, 0xe548e2b4, 0x9b30aa12, 0xb1189270, 0x67c03b5e, + 0x4de8033c, 0x33904b9a, 0x19b873f8, 0x8a409364, 0xa068ab06, + 0xde10e3a0, 0xf438dbc2, 0x22e072ec, 0x08c84a8e, 0x76b00228, + 0x5c983a4a, 0x00705635, 0x2a586e57, 0x542026f1, 0x7e081e93, + 0xa8d0b7bd, 0x82f88fdf, 0xfc80c779, 0xd6a8ff1b, 0x8aa03f0e, + 0xa088076c, 0xdef04fca, 0xf4d877a8, 0x2200de86, 0x0828e6e4, + 0x7650ae42, 0x5c789620, 0x0090fa5f, 0x2ab8c23d, 0x54c08a9b, + 0x7ee8b2f9, 0xa8301bd7, 0x821823b5, 0xfc606b13, 0xd6485371, + 0x45b0b3ed, 0x6f988b8f, 0x11e0c329, 0x3bc8fb4b, 0xed105265, + 0xc7386a07, 0xb94022a1, 0x93681ac3, 0xcf8076bc, 0xe5a84ede, + 0x9bd00678, 0xb1f83e1a, 0x67209734, 0x4d08af56, 0x3370e7f0, + 0x1958df92, 0xcff02089, 0xe5d818eb, 0x9ba0504d, 0xb188682f, + 0x6750c101, 0x4d78f963, 0x3300b1c5, 0x192889a7, 0x45c0e5d8, + 0x6fe8ddba, 0x1190951c, 0x3bb8ad7e, 0xed600450, 0xc7483c32, + 0xb9307494, 0x93184cf6, 0x00e0ac6a, 0x2ac89408, 0x54b0dcae, + 0x7e98e4cc, 0xa8404de2, 0x82687580, 0xfc103d26, 0xd6380544, + 0x8ad0693b, 0xa0f85159, 0xde8019ff, 0xf4a8219d, 0x227088b3, + 0x0858b0d1, 0x7620f877, 0x5c08c015, 0xce31785d, 0xe419403f, + 0x9a610899, 0xb04930fb, 0x669199d5, 0x4cb9a1b7, 0x32c1e911, + 0x18e9d173, 0x4401bd0c, 0x6e29856e, 0x1051cdc8, 0x3a79f5aa, + 0xeca15c84, 0xc68964e6, 0xb8f12c40, 0x92d91422, 0x0121f4be, + 0x2b09ccdc, 0x5571847a, 0x7f59bc18, 0xa9811536, 0x83a92d54, + 0xfdd165f2, 0xd7f95d90, 0x8b1131ef, 0xa139098d, 0xdf41412b, + 0xf5697949, 0x23b1d067, 0x0999e805, 0x77e1a0a3, 0x5dc998c1, + 0x8b6167da, 0xa1495fb8, 0xdf31171e, 0xf5192f7c, 0x23c18652, + 0x09e9be30, 0x7791f696, 0x5db9cef4, 0x0151a28b, 0x2b799ae9, + 0x5501d24f, 0x7f29ea2d, 0xa9f14303, 0x83d97b61, 0xfda133c7, + 0xd7890ba5, 0x4471eb39, 0x6e59d35b, 0x10219bfd, 0x3a09a39f, + 0xecd10ab1, 0xc6f932d3, 0xb8817a75, 0x92a94217, 0xce412e68, + 0xe469160a, 0x9a115eac, 0xb03966ce, 0x66e1cfe0, 0x4cc9f782, + 0x32b1bf24, 0x18998746, 0x44914753, 0x6eb97f31, 0x10c13797, + 0x3ae90ff5, 0xec31a6db, 0xc6199eb9, 0xb861d61f, 0x9249ee7d, + 0xcea18202, 0xe489ba60, 0x9af1f2c6, 0xb0d9caa4, 0x6601638a, + 0x4c295be8, 0x3251134e, 0x18792b2c, 0x8b81cbb0, 0xa1a9f3d2, + 0xdfd1bb74, 0xf5f98316, 0x23212a38, 0x0909125a, 0x77715afc, + 0x5d59629e, 0x01b10ee1, 0x2b993683, 0x55e17e25, 0x7fc94647, + 0xa911ef69, 0x8339d70b, 0xfd419fad, 0xd769a7cf, 0x01c158d4, + 0x2be960b6, 0x55912810, 0x7fb91072, 0xa961b95c, 0x8349813e, + 0xfd31c998, 0xd719f1fa, 0x8bf19d85, 0xa1d9a5e7, 0xdfa1ed41, + 0xf589d523, 0x23517c0d, 0x0979446f, 0x77010cc9, 0x5d2934ab, + 0xced1d437, 0xe4f9ec55, 0x9a81a4f3, 0xb0a99c91, 0x667135bf, + 0x4c590ddd, 0x3221457b, 0x18097d19, 0x44e11166, 0x6ec92904, + 0x10b161a2, 0x3a9959c0, 0xec41f0ee, 0xc669c88c, 0xb811802a, + 0x9239b848}, + {0x00000000, 0x4713f6fb, 0x8e27edf6, 0xc9341b0d, 0xc73eddad, + 0x802d2b56, 0x4919305b, 0x0e0ac6a0, 0x550cbd1b, 0x121f4be0, + 0xdb2b50ed, 0x9c38a616, 0x923260b6, 0xd521964d, 0x1c158d40, + 0x5b067bbb, 0xaa197a36, 0xed0a8ccd, 0x243e97c0, 0x632d613b, + 0x6d27a79b, 0x2a345160, 0xe3004a6d, 0xa413bc96, 0xff15c72d, + 0xb80631d6, 0x71322adb, 0x3621dc20, 0x382b1a80, 0x7f38ec7b, + 0xb60cf776, 0xf11f018d, 0x8f43f22d, 0xc85004d6, 0x01641fdb, + 0x4677e920, 0x487d2f80, 0x0f6ed97b, 0xc65ac276, 0x8149348d, + 0xda4f4f36, 0x9d5cb9cd, 0x5468a2c0, 0x137b543b, 0x1d71929b, + 0x5a626460, 0x93567f6d, 0xd4458996, 0x255a881b, 0x62497ee0, + 0xab7d65ed, 0xec6e9316, 0xe26455b6, 0xa577a34d, 0x6c43b840, + 0x2b504ebb, 0x70563500, 0x3745c3fb, 0xfe71d8f6, 0xb9622e0d, + 0xb768e8ad, 0xf07b1e56, 0x394f055b, 0x7e5cf3a0, 0xc5f6e21b, + 0x82e514e0, 0x4bd10fed, 0x0cc2f916, 0x02c83fb6, 0x45dbc94d, + 0x8cefd240, 0xcbfc24bb, 0x90fa5f00, 0xd7e9a9fb, 0x1eddb2f6, + 0x59ce440d, 0x57c482ad, 0x10d77456, 0xd9e36f5b, 0x9ef099a0, + 0x6fef982d, 0x28fc6ed6, 0xe1c875db, 0xa6db8320, 0xa8d14580, + 0xefc2b37b, 0x26f6a876, 0x61e55e8d, 0x3ae32536, 0x7df0d3cd, + 0xb4c4c8c0, 0xf3d73e3b, 0xfdddf89b, 0xbace0e60, 0x73fa156d, + 0x34e9e396, 0x4ab51036, 0x0da6e6cd, 0xc492fdc0, 0x83810b3b, + 0x8d8bcd9b, 0xca983b60, 0x03ac206d, 0x44bfd696, 0x1fb9ad2d, + 0x58aa5bd6, 0x919e40db, 0xd68db620, 0xd8877080, 0x9f94867b, + 0x56a09d76, 0x11b36b8d, 0xe0ac6a00, 0xa7bf9cfb, 0x6e8b87f6, + 0x2998710d, 0x2792b7ad, 0x60814156, 0xa9b55a5b, 0xeea6aca0, + 0xb5a0d71b, 0xf2b321e0, 0x3b873aed, 0x7c94cc16, 0x729e0ab6, + 0x358dfc4d, 0xfcb9e740, 0xbbaa11bb, 0x509cc277, 0x178f348c, + 0xdebb2f81, 0x99a8d97a, 0x97a21fda, 0xd0b1e921, 0x1985f22c, + 0x5e9604d7, 0x05907f6c, 0x42838997, 0x8bb7929a, 0xcca46461, + 0xc2aea2c1, 0x85bd543a, 0x4c894f37, 0x0b9ab9cc, 0xfa85b841, + 0xbd964eba, 0x74a255b7, 0x33b1a34c, 0x3dbb65ec, 0x7aa89317, + 0xb39c881a, 0xf48f7ee1, 0xaf89055a, 0xe89af3a1, 0x21aee8ac, + 0x66bd1e57, 0x68b7d8f7, 0x2fa42e0c, 0xe6903501, 0xa183c3fa, + 0xdfdf305a, 0x98ccc6a1, 0x51f8ddac, 0x16eb2b57, 0x18e1edf7, + 0x5ff21b0c, 0x96c60001, 0xd1d5f6fa, 0x8ad38d41, 0xcdc07bba, + 0x04f460b7, 0x43e7964c, 0x4ded50ec, 0x0afea617, 0xc3cabd1a, + 0x84d94be1, 0x75c64a6c, 0x32d5bc97, 0xfbe1a79a, 0xbcf25161, + 0xb2f897c1, 0xf5eb613a, 0x3cdf7a37, 0x7bcc8ccc, 0x20caf777, + 0x67d9018c, 0xaeed1a81, 0xe9feec7a, 0xe7f42ada, 0xa0e7dc21, + 0x69d3c72c, 0x2ec031d7, 0x956a206c, 0xd279d697, 0x1b4dcd9a, + 0x5c5e3b61, 0x5254fdc1, 0x15470b3a, 0xdc731037, 0x9b60e6cc, + 0xc0669d77, 0x87756b8c, 0x4e417081, 0x0952867a, 0x075840da, + 0x404bb621, 0x897fad2c, 0xce6c5bd7, 0x3f735a5a, 0x7860aca1, + 0xb154b7ac, 0xf6474157, 0xf84d87f7, 0xbf5e710c, 0x766a6a01, + 0x31799cfa, 0x6a7fe741, 0x2d6c11ba, 0xe4580ab7, 0xa34bfc4c, + 0xad413aec, 0xea52cc17, 0x2366d71a, 0x647521e1, 0x1a29d241, + 0x5d3a24ba, 0x940e3fb7, 0xd31dc94c, 0xdd170fec, 0x9a04f917, + 0x5330e21a, 0x142314e1, 0x4f256f5a, 0x083699a1, 0xc10282ac, + 0x86117457, 0x881bb2f7, 0xcf08440c, 0x063c5f01, 0x412fa9fa, + 0xb030a877, 0xf7235e8c, 0x3e174581, 0x7904b37a, 0x770e75da, + 0x301d8321, 0xf929982c, 0xbe3a6ed7, 0xe53c156c, 0xa22fe397, + 0x6b1bf89a, 0x2c080e61, 0x2202c8c1, 0x65113e3a, 0xac252537, + 0xeb36d3cc}, + {0x00000000, 0xa13984ee, 0x99020f9d, 0x383b8b73, 0xe975197b, + 0x484c9d95, 0x707716e6, 0xd14e9208, 0x099b34b7, 0xa8a2b059, + 0x90993b2a, 0x31a0bfc4, 0xe0ee2dcc, 0x41d7a922, 0x79ec2251, + 0xd8d5a6bf, 0x1336696e, 0xb20fed80, 0x8a3466f3, 0x2b0de21d, + 0xfa437015, 0x5b7af4fb, 0x63417f88, 0xc278fb66, 0x1aad5dd9, + 0xbb94d937, 0x83af5244, 0x2296d6aa, 0xf3d844a2, 0x52e1c04c, + 0x6ada4b3f, 0xcbe3cfd1, 0x266cd2dc, 0x87555632, 0xbf6edd41, + 0x1e5759af, 0xcf19cba7, 0x6e204f49, 0x561bc43a, 0xf72240d4, + 0x2ff7e66b, 0x8ece6285, 0xb6f5e9f6, 0x17cc6d18, 0xc682ff10, + 0x67bb7bfe, 0x5f80f08d, 0xfeb97463, 0x355abbb2, 0x94633f5c, + 0xac58b42f, 0x0d6130c1, 0xdc2fa2c9, 0x7d162627, 0x452dad54, + 0xe41429ba, 0x3cc18f05, 0x9df80beb, 0xa5c38098, 0x04fa0476, + 0xd5b4967e, 0x748d1290, 0x4cb699e3, 0xed8f1d0d, 0x4cd9a5b8, + 0xede02156, 0xd5dbaa25, 0x74e22ecb, 0xa5acbcc3, 0x0495382d, + 0x3caeb35e, 0x9d9737b0, 0x4542910f, 0xe47b15e1, 0xdc409e92, + 0x7d791a7c, 0xac378874, 0x0d0e0c9a, 0x353587e9, 0x940c0307, + 0x5fefccd6, 0xfed64838, 0xc6edc34b, 0x67d447a5, 0xb69ad5ad, + 0x17a35143, 0x2f98da30, 0x8ea15ede, 0x5674f861, 0xf74d7c8f, + 0xcf76f7fc, 0x6e4f7312, 0xbf01e11a, 0x1e3865f4, 0x2603ee87, + 0x873a6a69, 0x6ab57764, 0xcb8cf38a, 0xf3b778f9, 0x528efc17, + 0x83c06e1f, 0x22f9eaf1, 0x1ac26182, 0xbbfbe56c, 0x632e43d3, + 0xc217c73d, 0xfa2c4c4e, 0x5b15c8a0, 0x8a5b5aa8, 0x2b62de46, + 0x13595535, 0xb260d1db, 0x79831e0a, 0xd8ba9ae4, 0xe0811197, + 0x41b89579, 0x90f60771, 0x31cf839f, 0x09f408ec, 0xa8cd8c02, + 0x70182abd, 0xd121ae53, 0xe91a2520, 0x4823a1ce, 0x996d33c6, + 0x3854b728, 0x006f3c5b, 0xa156b8b5, 0x99b34b70, 0x388acf9e, + 0x00b144ed, 0xa188c003, 0x70c6520b, 0xd1ffd6e5, 0xe9c45d96, + 0x48fdd978, 0x90287fc7, 0x3111fb29, 0x092a705a, 0xa813f4b4, + 0x795d66bc, 0xd864e252, 0xe05f6921, 0x4166edcf, 0x8a85221e, + 0x2bbca6f0, 0x13872d83, 0xb2bea96d, 0x63f03b65, 0xc2c9bf8b, + 0xfaf234f8, 0x5bcbb016, 0x831e16a9, 0x22279247, 0x1a1c1934, + 0xbb259dda, 0x6a6b0fd2, 0xcb528b3c, 0xf369004f, 0x525084a1, + 0xbfdf99ac, 0x1ee61d42, 0x26dd9631, 0x87e412df, 0x56aa80d7, + 0xf7930439, 0xcfa88f4a, 0x6e910ba4, 0xb644ad1b, 0x177d29f5, + 0x2f46a286, 0x8e7f2668, 0x5f31b460, 0xfe08308e, 0xc633bbfd, + 0x670a3f13, 0xace9f0c2, 0x0dd0742c, 0x35ebff5f, 0x94d27bb1, + 0x459ce9b9, 0xe4a56d57, 0xdc9ee624, 0x7da762ca, 0xa572c475, + 0x044b409b, 0x3c70cbe8, 0x9d494f06, 0x4c07dd0e, 0xed3e59e0, + 0xd505d293, 0x743c567d, 0xd56aeec8, 0x74536a26, 0x4c68e155, + 0xed5165bb, 0x3c1ff7b3, 0x9d26735d, 0xa51df82e, 0x04247cc0, + 0xdcf1da7f, 0x7dc85e91, 0x45f3d5e2, 0xe4ca510c, 0x3584c304, + 0x94bd47ea, 0xac86cc99, 0x0dbf4877, 0xc65c87a6, 0x67650348, + 0x5f5e883b, 0xfe670cd5, 0x2f299edd, 0x8e101a33, 0xb62b9140, + 0x171215ae, 0xcfc7b311, 0x6efe37ff, 0x56c5bc8c, 0xf7fc3862, + 0x26b2aa6a, 0x878b2e84, 0xbfb0a5f7, 0x1e892119, 0xf3063c14, + 0x523fb8fa, 0x6a043389, 0xcb3db767, 0x1a73256f, 0xbb4aa181, + 0x83712af2, 0x2248ae1c, 0xfa9d08a3, 0x5ba48c4d, 0x639f073e, + 0xc2a683d0, 0x13e811d8, 0xb2d19536, 0x8aea1e45, 0x2bd39aab, + 0xe030557a, 0x4109d194, 0x79325ae7, 0xd80bde09, 0x09454c01, + 0xa87cc8ef, 0x9047439c, 0x317ec772, 0xe9ab61cd, 0x4892e523, + 0x70a96e50, 0xd190eabe, 0x00de78b6, 0xa1e7fc58, 0x99dc772b, + 0x38e5f3c5}, + {0x00000000, 0xe81790a1, 0x0b5e2703, 0xe349b7a2, 0x16bc4e06, + 0xfeabdea7, 0x1de26905, 0xf5f5f9a4, 0x2d789c0c, 0xc56f0cad, + 0x2626bb0f, 0xce312bae, 0x3bc4d20a, 0xd3d342ab, 0x309af509, + 0xd88d65a8, 0x5af13818, 0xb2e6a8b9, 0x51af1f1b, 0xb9b88fba, + 0x4c4d761e, 0xa45ae6bf, 0x4713511d, 0xaf04c1bc, 0x7789a414, + 0x9f9e34b5, 0x7cd78317, 0x94c013b6, 0x6135ea12, 0x89227ab3, + 0x6a6bcd11, 0x827c5db0, 0xb5e27030, 0x5df5e091, 0xbebc5733, + 0x56abc792, 0xa35e3e36, 0x4b49ae97, 0xa8001935, 0x40178994, + 0x989aec3c, 0x708d7c9d, 0x93c4cb3f, 0x7bd35b9e, 0x8e26a23a, + 0x6631329b, 0x85788539, 0x6d6f1598, 0xef134828, 0x0704d889, + 0xe44d6f2b, 0x0c5aff8a, 0xf9af062e, 0x11b8968f, 0xf2f1212d, + 0x1ae6b18c, 0xc26bd424, 0x2a7c4485, 0xc935f327, 0x21226386, + 0xd4d79a22, 0x3cc00a83, 0xdf89bd21, 0x379e2d80, 0xb0b5e621, + 0x58a27680, 0xbbebc122, 0x53fc5183, 0xa609a827, 0x4e1e3886, + 0xad578f24, 0x45401f85, 0x9dcd7a2d, 0x75daea8c, 0x96935d2e, + 0x7e84cd8f, 0x8b71342b, 0x6366a48a, 0x802f1328, 0x68388389, + 0xea44de39, 0x02534e98, 0xe11af93a, 0x090d699b, 0xfcf8903f, + 0x14ef009e, 0xf7a6b73c, 0x1fb1279d, 0xc73c4235, 0x2f2bd294, + 0xcc626536, 0x2475f597, 0xd1800c33, 0x39979c92, 0xdade2b30, + 0x32c9bb91, 0x05579611, 0xed4006b0, 0x0e09b112, 0xe61e21b3, + 0x13ebd817, 0xfbfc48b6, 0x18b5ff14, 0xf0a26fb5, 0x282f0a1d, + 0xc0389abc, 0x23712d1e, 0xcb66bdbf, 0x3e93441b, 0xd684d4ba, + 0x35cd6318, 0xdddaf3b9, 0x5fa6ae09, 0xb7b13ea8, 0x54f8890a, + 0xbcef19ab, 0x491ae00f, 0xa10d70ae, 0x4244c70c, 0xaa5357ad, + 0x72de3205, 0x9ac9a2a4, 0x79801506, 0x919785a7, 0x64627c03, + 0x8c75eca2, 0x6f3c5b00, 0x872bcba1, 0xba1aca03, 0x520d5aa2, + 0xb144ed00, 0x59537da1, 0xaca68405, 0x44b114a4, 0xa7f8a306, + 0x4fef33a7, 0x9762560f, 0x7f75c6ae, 0x9c3c710c, 0x742be1ad, + 0x81de1809, 0x69c988a8, 0x8a803f0a, 0x6297afab, 0xe0ebf21b, + 0x08fc62ba, 0xebb5d518, 0x03a245b9, 0xf657bc1d, 0x1e402cbc, + 0xfd099b1e, 0x151e0bbf, 0xcd936e17, 0x2584feb6, 0xc6cd4914, + 0x2edad9b5, 0xdb2f2011, 0x3338b0b0, 0xd0710712, 0x386697b3, + 0x0ff8ba33, 0xe7ef2a92, 0x04a69d30, 0xecb10d91, 0x1944f435, + 0xf1536494, 0x121ad336, 0xfa0d4397, 0x2280263f, 0xca97b69e, + 0x29de013c, 0xc1c9919d, 0x343c6839, 0xdc2bf898, 0x3f624f3a, + 0xd775df9b, 0x5509822b, 0xbd1e128a, 0x5e57a528, 0xb6403589, + 0x43b5cc2d, 0xaba25c8c, 0x48ebeb2e, 0xa0fc7b8f, 0x78711e27, + 0x90668e86, 0x732f3924, 0x9b38a985, 0x6ecd5021, 0x86dac080, + 0x65937722, 0x8d84e783, 0x0aaf2c22, 0xe2b8bc83, 0x01f10b21, + 0xe9e69b80, 0x1c136224, 0xf404f285, 0x174d4527, 0xff5ad586, + 0x27d7b02e, 0xcfc0208f, 0x2c89972d, 0xc49e078c, 0x316bfe28, + 0xd97c6e89, 0x3a35d92b, 0xd222498a, 0x505e143a, 0xb849849b, + 0x5b003339, 0xb317a398, 0x46e25a3c, 0xaef5ca9d, 0x4dbc7d3f, + 0xa5abed9e, 0x7d268836, 0x95311897, 0x7678af35, 0x9e6f3f94, + 0x6b9ac630, 0x838d5691, 0x60c4e133, 0x88d37192, 0xbf4d5c12, + 0x575accb3, 0xb4137b11, 0x5c04ebb0, 0xa9f11214, 0x41e682b5, + 0xa2af3517, 0x4ab8a5b6, 0x9235c01e, 0x7a2250bf, 0x996be71d, + 0x717c77bc, 0x84898e18, 0x6c9e1eb9, 0x8fd7a91b, 0x67c039ba, + 0xe5bc640a, 0x0dabf4ab, 0xeee24309, 0x06f5d3a8, 0xf3002a0c, + 0x1b17baad, 0xf85e0d0f, 0x10499dae, 0xc8c4f806, 0x20d368a7, + 0xc39adf05, 0x2b8d4fa4, 0xde78b600, 0x366f26a1, 0xd5269103, + 0x3d3101a2}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0xa19017e800000000, 0x03275e0b00000000, + 0xa2b749e300000000, 0x064ebc1600000000, 0xa7deabfe00000000, + 0x0569e21d00000000, 0xa4f9f5f500000000, 0x0c9c782d00000000, + 0xad0c6fc500000000, 0x0fbb262600000000, 0xae2b31ce00000000, + 0x0ad2c43b00000000, 0xab42d3d300000000, 0x09f59a3000000000, + 0xa8658dd800000000, 0x1838f15a00000000, 0xb9a8e6b200000000, + 0x1b1faf5100000000, 0xba8fb8b900000000, 0x1e764d4c00000000, + 0xbfe65aa400000000, 0x1d51134700000000, 0xbcc104af00000000, + 0x14a4897700000000, 0xb5349e9f00000000, 0x1783d77c00000000, + 0xb613c09400000000, 0x12ea356100000000, 0xb37a228900000000, + 0x11cd6b6a00000000, 0xb05d7c8200000000, 0x3070e2b500000000, + 0x91e0f55d00000000, 0x3357bcbe00000000, 0x92c7ab5600000000, + 0x363e5ea300000000, 0x97ae494b00000000, 0x351900a800000000, + 0x9489174000000000, 0x3cec9a9800000000, 0x9d7c8d7000000000, + 0x3fcbc49300000000, 0x9e5bd37b00000000, 0x3aa2268e00000000, + 0x9b32316600000000, 0x3985788500000000, 0x98156f6d00000000, + 0x284813ef00000000, 0x89d8040700000000, 0x2b6f4de400000000, + 0x8aff5a0c00000000, 0x2e06aff900000000, 0x8f96b81100000000, + 0x2d21f1f200000000, 0x8cb1e61a00000000, 0x24d46bc200000000, + 0x85447c2a00000000, 0x27f335c900000000, 0x8663222100000000, + 0x229ad7d400000000, 0x830ac03c00000000, 0x21bd89df00000000, + 0x802d9e3700000000, 0x21e6b5b000000000, 0x8076a25800000000, + 0x22c1ebbb00000000, 0x8351fc5300000000, 0x27a809a600000000, + 0x86381e4e00000000, 0x248f57ad00000000, 0x851f404500000000, + 0x2d7acd9d00000000, 0x8ceada7500000000, 0x2e5d939600000000, + 0x8fcd847e00000000, 0x2b34718b00000000, 0x8aa4666300000000, + 0x28132f8000000000, 0x8983386800000000, 0x39de44ea00000000, + 0x984e530200000000, 0x3af91ae100000000, 0x9b690d0900000000, + 0x3f90f8fc00000000, 0x9e00ef1400000000, 0x3cb7a6f700000000, + 0x9d27b11f00000000, 0x35423cc700000000, 0x94d22b2f00000000, + 0x366562cc00000000, 0x97f5752400000000, 0x330c80d100000000, + 0x929c973900000000, 0x302bdeda00000000, 0x91bbc93200000000, + 0x1196570500000000, 0xb00640ed00000000, 0x12b1090e00000000, + 0xb3211ee600000000, 0x17d8eb1300000000, 0xb648fcfb00000000, + 0x14ffb51800000000, 0xb56fa2f000000000, 0x1d0a2f2800000000, + 0xbc9a38c000000000, 0x1e2d712300000000, 0xbfbd66cb00000000, + 0x1b44933e00000000, 0xbad484d600000000, 0x1863cd3500000000, + 0xb9f3dadd00000000, 0x09aea65f00000000, 0xa83eb1b700000000, + 0x0a89f85400000000, 0xab19efbc00000000, 0x0fe01a4900000000, + 0xae700da100000000, 0x0cc7444200000000, 0xad5753aa00000000, + 0x0532de7200000000, 0xa4a2c99a00000000, 0x0615807900000000, + 0xa785979100000000, 0x037c626400000000, 0xa2ec758c00000000, + 0x005b3c6f00000000, 0xa1cb2b8700000000, 0x03ca1aba00000000, + 0xa25a0d5200000000, 0x00ed44b100000000, 0xa17d535900000000, + 0x0584a6ac00000000, 0xa414b14400000000, 0x06a3f8a700000000, + 0xa733ef4f00000000, 0x0f56629700000000, 0xaec6757f00000000, + 0x0c713c9c00000000, 0xade12b7400000000, 0x0918de8100000000, + 0xa888c96900000000, 0x0a3f808a00000000, 0xabaf976200000000, + 0x1bf2ebe000000000, 0xba62fc0800000000, 0x18d5b5eb00000000, + 0xb945a20300000000, 0x1dbc57f600000000, 0xbc2c401e00000000, + 0x1e9b09fd00000000, 0xbf0b1e1500000000, 0x176e93cd00000000, + 0xb6fe842500000000, 0x1449cdc600000000, 0xb5d9da2e00000000, + 0x11202fdb00000000, 0xb0b0383300000000, 0x120771d000000000, + 0xb397663800000000, 0x33baf80f00000000, 0x922aefe700000000, + 0x309da60400000000, 0x910db1ec00000000, 0x35f4441900000000, + 0x946453f100000000, 0x36d31a1200000000, 0x97430dfa00000000, + 0x3f26802200000000, 0x9eb697ca00000000, 0x3c01de2900000000, + 0x9d91c9c100000000, 0x39683c3400000000, 0x98f82bdc00000000, + 0x3a4f623f00000000, 0x9bdf75d700000000, 0x2b82095500000000, + 0x8a121ebd00000000, 0x28a5575e00000000, 0x893540b600000000, + 0x2dccb54300000000, 0x8c5ca2ab00000000, 0x2eebeb4800000000, + 0x8f7bfca000000000, 0x271e717800000000, 0x868e669000000000, + 0x24392f7300000000, 0x85a9389b00000000, 0x2150cd6e00000000, + 0x80c0da8600000000, 0x2277936500000000, 0x83e7848d00000000, + 0x222caf0a00000000, 0x83bcb8e200000000, 0x210bf10100000000, + 0x809be6e900000000, 0x2462131c00000000, 0x85f204f400000000, + 0x27454d1700000000, 0x86d55aff00000000, 0x2eb0d72700000000, + 0x8f20c0cf00000000, 0x2d97892c00000000, 0x8c079ec400000000, + 0x28fe6b3100000000, 0x896e7cd900000000, 0x2bd9353a00000000, + 0x8a4922d200000000, 0x3a145e5000000000, 0x9b8449b800000000, + 0x3933005b00000000, 0x98a317b300000000, 0x3c5ae24600000000, + 0x9dcaf5ae00000000, 0x3f7dbc4d00000000, 0x9eedaba500000000, + 0x3688267d00000000, 0x9718319500000000, 0x35af787600000000, + 0x943f6f9e00000000, 0x30c69a6b00000000, 0x91568d8300000000, + 0x33e1c46000000000, 0x9271d38800000000, 0x125c4dbf00000000, + 0xb3cc5a5700000000, 0x117b13b400000000, 0xb0eb045c00000000, + 0x1412f1a900000000, 0xb582e64100000000, 0x1735afa200000000, + 0xb6a5b84a00000000, 0x1ec0359200000000, 0xbf50227a00000000, + 0x1de76b9900000000, 0xbc777c7100000000, 0x188e898400000000, + 0xb91e9e6c00000000, 0x1ba9d78f00000000, 0xba39c06700000000, + 0x0a64bce500000000, 0xabf4ab0d00000000, 0x0943e2ee00000000, + 0xa8d3f50600000000, 0x0c2a00f300000000, 0xadba171b00000000, + 0x0f0d5ef800000000, 0xae9d491000000000, 0x06f8c4c800000000, + 0xa768d32000000000, 0x05df9ac300000000, 0xa44f8d2b00000000, + 0x00b678de00000000, 0xa1266f3600000000, 0x039126d500000000, + 0xa201313d00000000}, + {0x0000000000000000, 0xee8439a100000000, 0x9d0f029900000000, + 0x738b3b3800000000, 0x7b1975e900000000, 0x959d4c4800000000, + 0xe616777000000000, 0x08924ed100000000, 0xb7349b0900000000, + 0x59b0a2a800000000, 0x2a3b999000000000, 0xc4bfa03100000000, + 0xcc2deee000000000, 0x22a9d74100000000, 0x5122ec7900000000, + 0xbfa6d5d800000000, 0x6e69361300000000, 0x80ed0fb200000000, + 0xf366348a00000000, 0x1de20d2b00000000, 0x157043fa00000000, + 0xfbf47a5b00000000, 0x887f416300000000, 0x66fb78c200000000, + 0xd95dad1a00000000, 0x37d994bb00000000, 0x4452af8300000000, + 0xaad6962200000000, 0xa244d8f300000000, 0x4cc0e15200000000, + 0x3f4bda6a00000000, 0xd1cfe3cb00000000, 0xdcd26c2600000000, + 0x3256558700000000, 0x41dd6ebf00000000, 0xaf59571e00000000, + 0xa7cb19cf00000000, 0x494f206e00000000, 0x3ac41b5600000000, + 0xd44022f700000000, 0x6be6f72f00000000, 0x8562ce8e00000000, + 0xf6e9f5b600000000, 0x186dcc1700000000, 0x10ff82c600000000, + 0xfe7bbb6700000000, 0x8df0805f00000000, 0x6374b9fe00000000, + 0xb2bb5a3500000000, 0x5c3f639400000000, 0x2fb458ac00000000, + 0xc130610d00000000, 0xc9a22fdc00000000, 0x2726167d00000000, + 0x54ad2d4500000000, 0xba2914e400000000, 0x058fc13c00000000, + 0xeb0bf89d00000000, 0x9880c3a500000000, 0x7604fa0400000000, + 0x7e96b4d500000000, 0x90128d7400000000, 0xe399b64c00000000, + 0x0d1d8fed00000000, 0xb8a5d94c00000000, 0x5621e0ed00000000, + 0x25aadbd500000000, 0xcb2ee27400000000, 0xc3bcaca500000000, + 0x2d38950400000000, 0x5eb3ae3c00000000, 0xb037979d00000000, + 0x0f91424500000000, 0xe1157be400000000, 0x929e40dc00000000, + 0x7c1a797d00000000, 0x748837ac00000000, 0x9a0c0e0d00000000, + 0xe987353500000000, 0x07030c9400000000, 0xd6ccef5f00000000, + 0x3848d6fe00000000, 0x4bc3edc600000000, 0xa547d46700000000, + 0xadd59ab600000000, 0x4351a31700000000, 0x30da982f00000000, + 0xde5ea18e00000000, 0x61f8745600000000, 0x8f7c4df700000000, + 0xfcf776cf00000000, 0x12734f6e00000000, 0x1ae101bf00000000, + 0xf465381e00000000, 0x87ee032600000000, 0x696a3a8700000000, + 0x6477b56a00000000, 0x8af38ccb00000000, 0xf978b7f300000000, + 0x17fc8e5200000000, 0x1f6ec08300000000, 0xf1eaf92200000000, + 0x8261c21a00000000, 0x6ce5fbbb00000000, 0xd3432e6300000000, + 0x3dc717c200000000, 0x4e4c2cfa00000000, 0xa0c8155b00000000, + 0xa85a5b8a00000000, 0x46de622b00000000, 0x3555591300000000, + 0xdbd160b200000000, 0x0a1e837900000000, 0xe49abad800000000, + 0x971181e000000000, 0x7995b84100000000, 0x7107f69000000000, + 0x9f83cf3100000000, 0xec08f40900000000, 0x028ccda800000000, + 0xbd2a187000000000, 0x53ae21d100000000, 0x20251ae900000000, + 0xcea1234800000000, 0xc6336d9900000000, 0x28b7543800000000, + 0x5b3c6f0000000000, 0xb5b856a100000000, 0x704bb39900000000, + 0x9ecf8a3800000000, 0xed44b10000000000, 0x03c088a100000000, + 0x0b52c67000000000, 0xe5d6ffd100000000, 0x965dc4e900000000, + 0x78d9fd4800000000, 0xc77f289000000000, 0x29fb113100000000, + 0x5a702a0900000000, 0xb4f413a800000000, 0xbc665d7900000000, + 0x52e264d800000000, 0x21695fe000000000, 0xcfed664100000000, + 0x1e22858a00000000, 0xf0a6bc2b00000000, 0x832d871300000000, + 0x6da9beb200000000, 0x653bf06300000000, 0x8bbfc9c200000000, + 0xf834f2fa00000000, 0x16b0cb5b00000000, 0xa9161e8300000000, + 0x4792272200000000, 0x34191c1a00000000, 0xda9d25bb00000000, + 0xd20f6b6a00000000, 0x3c8b52cb00000000, 0x4f0069f300000000, + 0xa184505200000000, 0xac99dfbf00000000, 0x421de61e00000000, + 0x3196dd2600000000, 0xdf12e48700000000, 0xd780aa5600000000, + 0x390493f700000000, 0x4a8fa8cf00000000, 0xa40b916e00000000, + 0x1bad44b600000000, 0xf5297d1700000000, 0x86a2462f00000000, + 0x68267f8e00000000, 0x60b4315f00000000, 0x8e3008fe00000000, + 0xfdbb33c600000000, 0x133f0a6700000000, 0xc2f0e9ac00000000, + 0x2c74d00d00000000, 0x5fffeb3500000000, 0xb17bd29400000000, + 0xb9e99c4500000000, 0x576da5e400000000, 0x24e69edc00000000, + 0xca62a77d00000000, 0x75c472a500000000, 0x9b404b0400000000, + 0xe8cb703c00000000, 0x064f499d00000000, 0x0edd074c00000000, + 0xe0593eed00000000, 0x93d205d500000000, 0x7d563c7400000000, + 0xc8ee6ad500000000, 0x266a537400000000, 0x55e1684c00000000, + 0xbb6551ed00000000, 0xb3f71f3c00000000, 0x5d73269d00000000, + 0x2ef81da500000000, 0xc07c240400000000, 0x7fdaf1dc00000000, + 0x915ec87d00000000, 0xe2d5f34500000000, 0x0c51cae400000000, + 0x04c3843500000000, 0xea47bd9400000000, 0x99cc86ac00000000, + 0x7748bf0d00000000, 0xa6875cc600000000, 0x4803656700000000, + 0x3b885e5f00000000, 0xd50c67fe00000000, 0xdd9e292f00000000, + 0x331a108e00000000, 0x40912bb600000000, 0xae15121700000000, + 0x11b3c7cf00000000, 0xff37fe6e00000000, 0x8cbcc55600000000, + 0x6238fcf700000000, 0x6aaab22600000000, 0x842e8b8700000000, + 0xf7a5b0bf00000000, 0x1921891e00000000, 0x143c06f300000000, + 0xfab83f5200000000, 0x8933046a00000000, 0x67b73dcb00000000, + 0x6f25731a00000000, 0x81a14abb00000000, 0xf22a718300000000, + 0x1cae482200000000, 0xa3089dfa00000000, 0x4d8ca45b00000000, + 0x3e079f6300000000, 0xd083a6c200000000, 0xd811e81300000000, + 0x3695d1b200000000, 0x451eea8a00000000, 0xab9ad32b00000000, + 0x7a5530e000000000, 0x94d1094100000000, 0xe75a327900000000, + 0x09de0bd800000000, 0x014c450900000000, 0xefc87ca800000000, + 0x9c43479000000000, 0x72c77e3100000000, 0xcd61abe900000000, + 0x23e5924800000000, 0x506ea97000000000, 0xbeea90d100000000, + 0xb678de0000000000, 0x58fce7a100000000, 0x2b77dc9900000000, + 0xc5f3e53800000000}, + {0x0000000000000000, 0xfbf6134700000000, 0xf6ed278e00000000, + 0x0d1b34c900000000, 0xaddd3ec700000000, 0x562b2d8000000000, + 0x5b30194900000000, 0xa0c60a0e00000000, 0x1bbd0c5500000000, + 0xe04b1f1200000000, 0xed502bdb00000000, 0x16a6389c00000000, + 0xb660329200000000, 0x4d9621d500000000, 0x408d151c00000000, + 0xbb7b065b00000000, 0x367a19aa00000000, 0xcd8c0aed00000000, + 0xc0973e2400000000, 0x3b612d6300000000, 0x9ba7276d00000000, + 0x6051342a00000000, 0x6d4a00e300000000, 0x96bc13a400000000, + 0x2dc715ff00000000, 0xd63106b800000000, 0xdb2a327100000000, + 0x20dc213600000000, 0x801a2b3800000000, 0x7bec387f00000000, + 0x76f70cb600000000, 0x8d011ff100000000, 0x2df2438f00000000, + 0xd60450c800000000, 0xdb1f640100000000, 0x20e9774600000000, + 0x802f7d4800000000, 0x7bd96e0f00000000, 0x76c25ac600000000, + 0x8d34498100000000, 0x364f4fda00000000, 0xcdb95c9d00000000, + 0xc0a2685400000000, 0x3b547b1300000000, 0x9b92711d00000000, + 0x6064625a00000000, 0x6d7f569300000000, 0x968945d400000000, + 0x1b885a2500000000, 0xe07e496200000000, 0xed657dab00000000, + 0x16936eec00000000, 0xb65564e200000000, 0x4da377a500000000, + 0x40b8436c00000000, 0xbb4e502b00000000, 0x0035567000000000, + 0xfbc3453700000000, 0xf6d871fe00000000, 0x0d2e62b900000000, + 0xade868b700000000, 0x561e7bf000000000, 0x5b054f3900000000, + 0xa0f35c7e00000000, 0x1be2f6c500000000, 0xe014e58200000000, + 0xed0fd14b00000000, 0x16f9c20c00000000, 0xb63fc80200000000, + 0x4dc9db4500000000, 0x40d2ef8c00000000, 0xbb24fccb00000000, + 0x005ffa9000000000, 0xfba9e9d700000000, 0xf6b2dd1e00000000, + 0x0d44ce5900000000, 0xad82c45700000000, 0x5674d71000000000, + 0x5b6fe3d900000000, 0xa099f09e00000000, 0x2d98ef6f00000000, + 0xd66efc2800000000, 0xdb75c8e100000000, 0x2083dba600000000, + 0x8045d1a800000000, 0x7bb3c2ef00000000, 0x76a8f62600000000, + 0x8d5ee56100000000, 0x3625e33a00000000, 0xcdd3f07d00000000, + 0xc0c8c4b400000000, 0x3b3ed7f300000000, 0x9bf8ddfd00000000, + 0x600eceba00000000, 0x6d15fa7300000000, 0x96e3e93400000000, + 0x3610b54a00000000, 0xcde6a60d00000000, 0xc0fd92c400000000, + 0x3b0b818300000000, 0x9bcd8b8d00000000, 0x603b98ca00000000, + 0x6d20ac0300000000, 0x96d6bf4400000000, 0x2dadb91f00000000, + 0xd65baa5800000000, 0xdb409e9100000000, 0x20b68dd600000000, + 0x807087d800000000, 0x7b86949f00000000, 0x769da05600000000, + 0x8d6bb31100000000, 0x006aace000000000, 0xfb9cbfa700000000, + 0xf6878b6e00000000, 0x0d71982900000000, 0xadb7922700000000, + 0x5641816000000000, 0x5b5ab5a900000000, 0xa0aca6ee00000000, + 0x1bd7a0b500000000, 0xe021b3f200000000, 0xed3a873b00000000, + 0x16cc947c00000000, 0xb60a9e7200000000, 0x4dfc8d3500000000, + 0x40e7b9fc00000000, 0xbb11aabb00000000, 0x77c29c5000000000, + 0x8c348f1700000000, 0x812fbbde00000000, 0x7ad9a89900000000, + 0xda1fa29700000000, 0x21e9b1d000000000, 0x2cf2851900000000, + 0xd704965e00000000, 0x6c7f900500000000, 0x9789834200000000, + 0x9a92b78b00000000, 0x6164a4cc00000000, 0xc1a2aec200000000, + 0x3a54bd8500000000, 0x374f894c00000000, 0xccb99a0b00000000, + 0x41b885fa00000000, 0xba4e96bd00000000, 0xb755a27400000000, + 0x4ca3b13300000000, 0xec65bb3d00000000, 0x1793a87a00000000, + 0x1a889cb300000000, 0xe17e8ff400000000, 0x5a0589af00000000, + 0xa1f39ae800000000, 0xace8ae2100000000, 0x571ebd6600000000, + 0xf7d8b76800000000, 0x0c2ea42f00000000, 0x013590e600000000, + 0xfac383a100000000, 0x5a30dfdf00000000, 0xa1c6cc9800000000, + 0xacddf85100000000, 0x572beb1600000000, 0xf7ede11800000000, + 0x0c1bf25f00000000, 0x0100c69600000000, 0xfaf6d5d100000000, + 0x418dd38a00000000, 0xba7bc0cd00000000, 0xb760f40400000000, + 0x4c96e74300000000, 0xec50ed4d00000000, 0x17a6fe0a00000000, + 0x1abdcac300000000, 0xe14bd98400000000, 0x6c4ac67500000000, + 0x97bcd53200000000, 0x9aa7e1fb00000000, 0x6151f2bc00000000, + 0xc197f8b200000000, 0x3a61ebf500000000, 0x377adf3c00000000, + 0xcc8ccc7b00000000, 0x77f7ca2000000000, 0x8c01d96700000000, + 0x811aedae00000000, 0x7aecfee900000000, 0xda2af4e700000000, + 0x21dce7a000000000, 0x2cc7d36900000000, 0xd731c02e00000000, + 0x6c206a9500000000, 0x97d679d200000000, 0x9acd4d1b00000000, + 0x613b5e5c00000000, 0xc1fd545200000000, 0x3a0b471500000000, + 0x371073dc00000000, 0xcce6609b00000000, 0x779d66c000000000, + 0x8c6b758700000000, 0x8170414e00000000, 0x7a86520900000000, + 0xda40580700000000, 0x21b64b4000000000, 0x2cad7f8900000000, + 0xd75b6cce00000000, 0x5a5a733f00000000, 0xa1ac607800000000, + 0xacb754b100000000, 0x574147f600000000, 0xf7874df800000000, + 0x0c715ebf00000000, 0x016a6a7600000000, 0xfa9c793100000000, + 0x41e77f6a00000000, 0xba116c2d00000000, 0xb70a58e400000000, + 0x4cfc4ba300000000, 0xec3a41ad00000000, 0x17cc52ea00000000, + 0x1ad7662300000000, 0xe121756400000000, 0x41d2291a00000000, + 0xba243a5d00000000, 0xb73f0e9400000000, 0x4cc91dd300000000, + 0xec0f17dd00000000, 0x17f9049a00000000, 0x1ae2305300000000, + 0xe114231400000000, 0x5a6f254f00000000, 0xa199360800000000, + 0xac8202c100000000, 0x5774118600000000, 0xf7b21b8800000000, + 0x0c4408cf00000000, 0x015f3c0600000000, 0xfaa92f4100000000, + 0x77a830b000000000, 0x8c5e23f700000000, 0x8145173e00000000, + 0x7ab3047900000000, 0xda750e7700000000, 0x21831d3000000000, + 0x2c9829f900000000, 0xd76e3abe00000000, 0x6c153ce500000000, + 0x97e32fa200000000, 0x9af81b6b00000000, 0x610e082c00000000, + 0xc1c8022200000000, 0x3a3e116500000000, 0x372525ac00000000, + 0xccd336eb00000000}, + {0x0000000000000000, 0x6238282a00000000, 0xc470505400000000, + 0xa648787e00000000, 0x88e1a0a800000000, 0xead9888200000000, + 0x4c91f0fc00000000, 0x2ea9d8d600000000, 0x51c5308a00000000, + 0x33fd18a000000000, 0x95b560de00000000, 0xf78d48f400000000, + 0xd924902200000000, 0xbb1cb80800000000, 0x1d54c07600000000, + 0x7f6ce85c00000000, 0xe38c10cf00000000, 0x81b438e500000000, + 0x27fc409b00000000, 0x45c468b100000000, 0x6b6db06700000000, + 0x0955984d00000000, 0xaf1de03300000000, 0xcd25c81900000000, + 0xb249204500000000, 0xd071086f00000000, 0x7639701100000000, + 0x1401583b00000000, 0x3aa880ed00000000, 0x5890a8c700000000, + 0xfed8d0b900000000, 0x9ce0f89300000000, 0x871f504500000000, + 0xe527786f00000000, 0x436f001100000000, 0x2157283b00000000, + 0x0ffef0ed00000000, 0x6dc6d8c700000000, 0xcb8ea0b900000000, + 0xa9b6889300000000, 0xd6da60cf00000000, 0xb4e248e500000000, + 0x12aa309b00000000, 0x709218b100000000, 0x5e3bc06700000000, + 0x3c03e84d00000000, 0x9a4b903300000000, 0xf873b81900000000, + 0x6493408a00000000, 0x06ab68a000000000, 0xa0e310de00000000, + 0xc2db38f400000000, 0xec72e02200000000, 0x8e4ac80800000000, + 0x2802b07600000000, 0x4a3a985c00000000, 0x3556700000000000, + 0x576e582a00000000, 0xf126205400000000, 0x931e087e00000000, + 0xbdb7d0a800000000, 0xdf8ff88200000000, 0x79c780fc00000000, + 0x1bffa8d600000000, 0x0e3fa08a00000000, 0x6c0788a000000000, + 0xca4ff0de00000000, 0xa877d8f400000000, 0x86de002200000000, + 0xe4e6280800000000, 0x42ae507600000000, 0x2096785c00000000, + 0x5ffa900000000000, 0x3dc2b82a00000000, 0x9b8ac05400000000, + 0xf9b2e87e00000000, 0xd71b30a800000000, 0xb523188200000000, + 0x136b60fc00000000, 0x715348d600000000, 0xedb3b04500000000, + 0x8f8b986f00000000, 0x29c3e01100000000, 0x4bfbc83b00000000, + 0x655210ed00000000, 0x076a38c700000000, 0xa12240b900000000, + 0xc31a689300000000, 0xbc7680cf00000000, 0xde4ea8e500000000, + 0x7806d09b00000000, 0x1a3ef8b100000000, 0x3497206700000000, + 0x56af084d00000000, 0xf0e7703300000000, 0x92df581900000000, + 0x8920f0cf00000000, 0xeb18d8e500000000, 0x4d50a09b00000000, + 0x2f6888b100000000, 0x01c1506700000000, 0x63f9784d00000000, + 0xc5b1003300000000, 0xa789281900000000, 0xd8e5c04500000000, + 0xbadde86f00000000, 0x1c95901100000000, 0x7eadb83b00000000, + 0x500460ed00000000, 0x323c48c700000000, 0x947430b900000000, + 0xf64c189300000000, 0x6aace00000000000, 0x0894c82a00000000, + 0xaedcb05400000000, 0xcce4987e00000000, 0xe24d40a800000000, + 0x8075688200000000, 0x263d10fc00000000, 0x440538d600000000, + 0x3b69d08a00000000, 0x5951f8a000000000, 0xff1980de00000000, + 0x9d21a8f400000000, 0xb388702200000000, 0xd1b0580800000000, + 0x77f8207600000000, 0x15c0085c00000000, 0x5d7831ce00000000, + 0x3f4019e400000000, 0x9908619a00000000, 0xfb3049b000000000, + 0xd599916600000000, 0xb7a1b94c00000000, 0x11e9c13200000000, + 0x73d1e91800000000, 0x0cbd014400000000, 0x6e85296e00000000, + 0xc8cd511000000000, 0xaaf5793a00000000, 0x845ca1ec00000000, + 0xe66489c600000000, 0x402cf1b800000000, 0x2214d99200000000, + 0xbef4210100000000, 0xdccc092b00000000, 0x7a84715500000000, + 0x18bc597f00000000, 0x361581a900000000, 0x542da98300000000, + 0xf265d1fd00000000, 0x905df9d700000000, 0xef31118b00000000, + 0x8d0939a100000000, 0x2b4141df00000000, 0x497969f500000000, + 0x67d0b12300000000, 0x05e8990900000000, 0xa3a0e17700000000, + 0xc198c95d00000000, 0xda67618b00000000, 0xb85f49a100000000, + 0x1e1731df00000000, 0x7c2f19f500000000, 0x5286c12300000000, + 0x30bee90900000000, 0x96f6917700000000, 0xf4ceb95d00000000, + 0x8ba2510100000000, 0xe99a792b00000000, 0x4fd2015500000000, + 0x2dea297f00000000, 0x0343f1a900000000, 0x617bd98300000000, + 0xc733a1fd00000000, 0xa50b89d700000000, 0x39eb714400000000, + 0x5bd3596e00000000, 0xfd9b211000000000, 0x9fa3093a00000000, + 0xb10ad1ec00000000, 0xd332f9c600000000, 0x757a81b800000000, + 0x1742a99200000000, 0x682e41ce00000000, 0x0a1669e400000000, + 0xac5e119a00000000, 0xce6639b000000000, 0xe0cfe16600000000, + 0x82f7c94c00000000, 0x24bfb13200000000, 0x4687991800000000, + 0x5347914400000000, 0x317fb96e00000000, 0x9737c11000000000, + 0xf50fe93a00000000, 0xdba631ec00000000, 0xb99e19c600000000, + 0x1fd661b800000000, 0x7dee499200000000, 0x0282a1ce00000000, + 0x60ba89e400000000, 0xc6f2f19a00000000, 0xa4cad9b000000000, + 0x8a63016600000000, 0xe85b294c00000000, 0x4e13513200000000, + 0x2c2b791800000000, 0xb0cb818b00000000, 0xd2f3a9a100000000, + 0x74bbd1df00000000, 0x1683f9f500000000, 0x382a212300000000, + 0x5a12090900000000, 0xfc5a717700000000, 0x9e62595d00000000, + 0xe10eb10100000000, 0x8336992b00000000, 0x257ee15500000000, + 0x4746c97f00000000, 0x69ef11a900000000, 0x0bd7398300000000, + 0xad9f41fd00000000, 0xcfa769d700000000, 0xd458c10100000000, + 0xb660e92b00000000, 0x1028915500000000, 0x7210b97f00000000, + 0x5cb961a900000000, 0x3e81498300000000, 0x98c931fd00000000, + 0xfaf119d700000000, 0x859df18b00000000, 0xe7a5d9a100000000, + 0x41eda1df00000000, 0x23d589f500000000, 0x0d7c512300000000, + 0x6f44790900000000, 0xc90c017700000000, 0xab34295d00000000, + 0x37d4d1ce00000000, 0x55ecf9e400000000, 0xf3a4819a00000000, + 0x919ca9b000000000, 0xbf35716600000000, 0xdd0d594c00000000, + 0x7b45213200000000, 0x197d091800000000, 0x6611e14400000000, + 0x0429c96e00000000, 0xa261b11000000000, 0xc059993a00000000, + 0xeef041ec00000000, 0x8cc869c600000000, 0x2a8011b800000000, + 0x48b8399200000000}, + {0x0000000000000000, 0x4c2896a300000000, 0xd9565d9c00000000, + 0x957ecb3f00000000, 0xf3abcbe300000000, 0xbf835d4000000000, + 0x2afd967f00000000, 0x66d500dc00000000, 0xa751e61c00000000, + 0xeb7970bf00000000, 0x7e07bb8000000000, 0x322f2d2300000000, + 0x54fa2dff00000000, 0x18d2bb5c00000000, 0x8dac706300000000, + 0xc184e6c000000000, 0x4ea3cc3900000000, 0x028b5a9a00000000, + 0x97f591a500000000, 0xdbdd070600000000, 0xbd0807da00000000, + 0xf120917900000000, 0x645e5a4600000000, 0x2876cce500000000, + 0xe9f22a2500000000, 0xa5dabc8600000000, 0x30a477b900000000, + 0x7c8ce11a00000000, 0x1a59e1c600000000, 0x5671776500000000, + 0xc30fbc5a00000000, 0x8f272af900000000, 0x9c46997300000000, + 0xd06e0fd000000000, 0x4510c4ef00000000, 0x0938524c00000000, + 0x6fed529000000000, 0x23c5c43300000000, 0xb6bb0f0c00000000, + 0xfa9399af00000000, 0x3b177f6f00000000, 0x773fe9cc00000000, + 0xe24122f300000000, 0xae69b45000000000, 0xc8bcb48c00000000, + 0x8494222f00000000, 0x11eae91000000000, 0x5dc27fb300000000, + 0xd2e5554a00000000, 0x9ecdc3e900000000, 0x0bb308d600000000, + 0x479b9e7500000000, 0x214e9ea900000000, 0x6d66080a00000000, + 0xf818c33500000000, 0xb430559600000000, 0x75b4b35600000000, + 0x399c25f500000000, 0xace2eeca00000000, 0xe0ca786900000000, + 0x861f78b500000000, 0xca37ee1600000000, 0x5f49252900000000, + 0x1361b38a00000000, 0x388d32e700000000, 0x74a5a44400000000, + 0xe1db6f7b00000000, 0xadf3f9d800000000, 0xcb26f90400000000, + 0x870e6fa700000000, 0x1270a49800000000, 0x5e58323b00000000, + 0x9fdcd4fb00000000, 0xd3f4425800000000, 0x468a896700000000, + 0x0aa21fc400000000, 0x6c771f1800000000, 0x205f89bb00000000, + 0xb521428400000000, 0xf909d42700000000, 0x762efede00000000, + 0x3a06687d00000000, 0xaf78a34200000000, 0xe35035e100000000, + 0x8585353d00000000, 0xc9ada39e00000000, 0x5cd368a100000000, + 0x10fbfe0200000000, 0xd17f18c200000000, 0x9d578e6100000000, + 0x0829455e00000000, 0x4401d3fd00000000, 0x22d4d32100000000, + 0x6efc458200000000, 0xfb828ebd00000000, 0xb7aa181e00000000, + 0xa4cbab9400000000, 0xe8e33d3700000000, 0x7d9df60800000000, + 0x31b560ab00000000, 0x5760607700000000, 0x1b48f6d400000000, + 0x8e363deb00000000, 0xc21eab4800000000, 0x039a4d8800000000, + 0x4fb2db2b00000000, 0xdacc101400000000, 0x96e486b700000000, + 0xf031866b00000000, 0xbc1910c800000000, 0x2967dbf700000000, + 0x654f4d5400000000, 0xea6867ad00000000, 0xa640f10e00000000, + 0x333e3a3100000000, 0x7f16ac9200000000, 0x19c3ac4e00000000, + 0x55eb3aed00000000, 0xc095f1d200000000, 0x8cbd677100000000, + 0x4d3981b100000000, 0x0111171200000000, 0x946fdc2d00000000, + 0xd8474a8e00000000, 0xbe924a5200000000, 0xf2badcf100000000, + 0x67c417ce00000000, 0x2bec816d00000000, 0x311c141500000000, + 0x7d3482b600000000, 0xe84a498900000000, 0xa462df2a00000000, + 0xc2b7dff600000000, 0x8e9f495500000000, 0x1be1826a00000000, + 0x57c914c900000000, 0x964df20900000000, 0xda6564aa00000000, + 0x4f1baf9500000000, 0x0333393600000000, 0x65e639ea00000000, + 0x29ceaf4900000000, 0xbcb0647600000000, 0xf098f2d500000000, + 0x7fbfd82c00000000, 0x33974e8f00000000, 0xa6e985b000000000, + 0xeac1131300000000, 0x8c1413cf00000000, 0xc03c856c00000000, + 0x55424e5300000000, 0x196ad8f000000000, 0xd8ee3e3000000000, + 0x94c6a89300000000, 0x01b863ac00000000, 0x4d90f50f00000000, + 0x2b45f5d300000000, 0x676d637000000000, 0xf213a84f00000000, + 0xbe3b3eec00000000, 0xad5a8d6600000000, 0xe1721bc500000000, + 0x740cd0fa00000000, 0x3824465900000000, 0x5ef1468500000000, + 0x12d9d02600000000, 0x87a71b1900000000, 0xcb8f8dba00000000, + 0x0a0b6b7a00000000, 0x4623fdd900000000, 0xd35d36e600000000, + 0x9f75a04500000000, 0xf9a0a09900000000, 0xb588363a00000000, + 0x20f6fd0500000000, 0x6cde6ba600000000, 0xe3f9415f00000000, + 0xafd1d7fc00000000, 0x3aaf1cc300000000, 0x76878a6000000000, + 0x10528abc00000000, 0x5c7a1c1f00000000, 0xc904d72000000000, + 0x852c418300000000, 0x44a8a74300000000, 0x088031e000000000, + 0x9dfefadf00000000, 0xd1d66c7c00000000, 0xb7036ca000000000, + 0xfb2bfa0300000000, 0x6e55313c00000000, 0x227da79f00000000, + 0x099126f200000000, 0x45b9b05100000000, 0xd0c77b6e00000000, + 0x9cefedcd00000000, 0xfa3aed1100000000, 0xb6127bb200000000, + 0x236cb08d00000000, 0x6f44262e00000000, 0xaec0c0ee00000000, + 0xe2e8564d00000000, 0x77969d7200000000, 0x3bbe0bd100000000, + 0x5d6b0b0d00000000, 0x11439dae00000000, 0x843d569100000000, + 0xc815c03200000000, 0x4732eacb00000000, 0x0b1a7c6800000000, + 0x9e64b75700000000, 0xd24c21f400000000, 0xb499212800000000, + 0xf8b1b78b00000000, 0x6dcf7cb400000000, 0x21e7ea1700000000, + 0xe0630cd700000000, 0xac4b9a7400000000, 0x3935514b00000000, + 0x751dc7e800000000, 0x13c8c73400000000, 0x5fe0519700000000, + 0xca9e9aa800000000, 0x86b60c0b00000000, 0x95d7bf8100000000, + 0xd9ff292200000000, 0x4c81e21d00000000, 0x00a974be00000000, + 0x667c746200000000, 0x2a54e2c100000000, 0xbf2a29fe00000000, + 0xf302bf5d00000000, 0x3286599d00000000, 0x7eaecf3e00000000, + 0xebd0040100000000, 0xa7f892a200000000, 0xc12d927e00000000, + 0x8d0504dd00000000, 0x187bcfe200000000, 0x5453594100000000, + 0xdb7473b800000000, 0x975ce51b00000000, 0x02222e2400000000, + 0x4e0ab88700000000, 0x28dfb85b00000000, 0x64f72ef800000000, + 0xf189e5c700000000, 0xbda1736400000000, 0x7c2595a400000000, + 0x300d030700000000, 0xa573c83800000000, 0xe95b5e9b00000000, + 0x8f8e5e4700000000, 0xc3a6c8e400000000, 0x56d803db00000000, + 0x1af0957800000000}, + {0x0000000000000000, 0x939bc97f00000000, 0x263793ff00000000, + 0xb5ac5a8000000000, 0x0d68572400000000, 0x9ef39e5b00000000, + 0x2b5fc4db00000000, 0xb8c40da400000000, 0x1ad0ae4800000000, + 0x894b673700000000, 0x3ce73db700000000, 0xaf7cf4c800000000, + 0x17b8f96c00000000, 0x8423301300000000, 0x318f6a9300000000, + 0xa214a3ec00000000, 0x34a05d9100000000, 0xa73b94ee00000000, + 0x1297ce6e00000000, 0x810c071100000000, 0x39c80ab500000000, + 0xaa53c3ca00000000, 0x1fff994a00000000, 0x8c64503500000000, + 0x2e70f3d900000000, 0xbdeb3aa600000000, 0x0847602600000000, + 0x9bdca95900000000, 0x2318a4fd00000000, 0xb0836d8200000000, + 0x052f370200000000, 0x96b4fe7d00000000, 0x2946caf900000000, + 0xbadd038600000000, 0x0f71590600000000, 0x9cea907900000000, + 0x242e9ddd00000000, 0xb7b554a200000000, 0x02190e2200000000, + 0x9182c75d00000000, 0x339664b100000000, 0xa00dadce00000000, + 0x15a1f74e00000000, 0x863a3e3100000000, 0x3efe339500000000, + 0xad65faea00000000, 0x18c9a06a00000000, 0x8b52691500000000, + 0x1de6976800000000, 0x8e7d5e1700000000, 0x3bd1049700000000, + 0xa84acde800000000, 0x108ec04c00000000, 0x8315093300000000, + 0x36b953b300000000, 0xa5229acc00000000, 0x0736392000000000, + 0x94adf05f00000000, 0x2101aadf00000000, 0xb29a63a000000000, + 0x0a5e6e0400000000, 0x99c5a77b00000000, 0x2c69fdfb00000000, + 0xbff2348400000000, 0x138ae52800000000, 0x80112c5700000000, + 0x35bd76d700000000, 0xa626bfa800000000, 0x1ee2b20c00000000, + 0x8d797b7300000000, 0x38d521f300000000, 0xab4ee88c00000000, + 0x095a4b6000000000, 0x9ac1821f00000000, 0x2f6dd89f00000000, + 0xbcf611e000000000, 0x04321c4400000000, 0x97a9d53b00000000, + 0x22058fbb00000000, 0xb19e46c400000000, 0x272ab8b900000000, + 0xb4b171c600000000, 0x011d2b4600000000, 0x9286e23900000000, + 0x2a42ef9d00000000, 0xb9d926e200000000, 0x0c757c6200000000, + 0x9feeb51d00000000, 0x3dfa16f100000000, 0xae61df8e00000000, + 0x1bcd850e00000000, 0x88564c7100000000, 0x309241d500000000, + 0xa30988aa00000000, 0x16a5d22a00000000, 0x853e1b5500000000, + 0x3acc2fd100000000, 0xa957e6ae00000000, 0x1cfbbc2e00000000, + 0x8f60755100000000, 0x37a478f500000000, 0xa43fb18a00000000, + 0x1193eb0a00000000, 0x8208227500000000, 0x201c819900000000, + 0xb38748e600000000, 0x062b126600000000, 0x95b0db1900000000, + 0x2d74d6bd00000000, 0xbeef1fc200000000, 0x0b43454200000000, + 0x98d88c3d00000000, 0x0e6c724000000000, 0x9df7bb3f00000000, + 0x285be1bf00000000, 0xbbc028c000000000, 0x0304256400000000, + 0x909fec1b00000000, 0x2533b69b00000000, 0xb6a87fe400000000, + 0x14bcdc0800000000, 0x8727157700000000, 0x328b4ff700000000, + 0xa110868800000000, 0x19d48b2c00000000, 0x8a4f425300000000, + 0x3fe318d300000000, 0xac78d1ac00000000, 0x2614cb5100000000, + 0xb58f022e00000000, 0x002358ae00000000, 0x93b891d100000000, + 0x2b7c9c7500000000, 0xb8e7550a00000000, 0x0d4b0f8a00000000, + 0x9ed0c6f500000000, 0x3cc4651900000000, 0xaf5fac6600000000, + 0x1af3f6e600000000, 0x89683f9900000000, 0x31ac323d00000000, + 0xa237fb4200000000, 0x179ba1c200000000, 0x840068bd00000000, + 0x12b496c000000000, 0x812f5fbf00000000, 0x3483053f00000000, + 0xa718cc4000000000, 0x1fdcc1e400000000, 0x8c47089b00000000, + 0x39eb521b00000000, 0xaa709b6400000000, 0x0864388800000000, + 0x9bfff1f700000000, 0x2e53ab7700000000, 0xbdc8620800000000, + 0x050c6fac00000000, 0x9697a6d300000000, 0x233bfc5300000000, + 0xb0a0352c00000000, 0x0f5201a800000000, 0x9cc9c8d700000000, + 0x2965925700000000, 0xbafe5b2800000000, 0x023a568c00000000, + 0x91a19ff300000000, 0x240dc57300000000, 0xb7960c0c00000000, + 0x1582afe000000000, 0x8619669f00000000, 0x33b53c1f00000000, + 0xa02ef56000000000, 0x18eaf8c400000000, 0x8b7131bb00000000, + 0x3edd6b3b00000000, 0xad46a24400000000, 0x3bf25c3900000000, + 0xa869954600000000, 0x1dc5cfc600000000, 0x8e5e06b900000000, + 0x369a0b1d00000000, 0xa501c26200000000, 0x10ad98e200000000, + 0x8336519d00000000, 0x2122f27100000000, 0xb2b93b0e00000000, + 0x0715618e00000000, 0x948ea8f100000000, 0x2c4aa55500000000, + 0xbfd16c2a00000000, 0x0a7d36aa00000000, 0x99e6ffd500000000, + 0x359e2e7900000000, 0xa605e70600000000, 0x13a9bd8600000000, + 0x803274f900000000, 0x38f6795d00000000, 0xab6db02200000000, + 0x1ec1eaa200000000, 0x8d5a23dd00000000, 0x2f4e803100000000, + 0xbcd5494e00000000, 0x097913ce00000000, 0x9ae2dab100000000, + 0x2226d71500000000, 0xb1bd1e6a00000000, 0x041144ea00000000, + 0x978a8d9500000000, 0x013e73e800000000, 0x92a5ba9700000000, + 0x2709e01700000000, 0xb492296800000000, 0x0c5624cc00000000, + 0x9fcdedb300000000, 0x2a61b73300000000, 0xb9fa7e4c00000000, + 0x1beedda000000000, 0x887514df00000000, 0x3dd94e5f00000000, + 0xae42872000000000, 0x16868a8400000000, 0x851d43fb00000000, + 0x30b1197b00000000, 0xa32ad00400000000, 0x1cd8e48000000000, + 0x8f432dff00000000, 0x3aef777f00000000, 0xa974be0000000000, + 0x11b0b3a400000000, 0x822b7adb00000000, 0x3787205b00000000, + 0xa41ce92400000000, 0x06084ac800000000, 0x959383b700000000, + 0x203fd93700000000, 0xb3a4104800000000, 0x0b601dec00000000, + 0x98fbd49300000000, 0x2d578e1300000000, 0xbecc476c00000000, + 0x2878b91100000000, 0xbbe3706e00000000, 0x0e4f2aee00000000, + 0x9dd4e39100000000, 0x2510ee3500000000, 0xb68b274a00000000, + 0x03277dca00000000, 0x90bcb4b500000000, 0x32a8175900000000, + 0xa133de2600000000, 0x149f84a600000000, 0x87044dd900000000, + 0x3fc0407d00000000, 0xac5b890200000000, 0x19f7d38200000000, + 0x8a6c1afd00000000}, + {0x0000000000000000, 0x650b796900000000, 0xca16f2d200000000, + 0xaf1d8bbb00000000, 0xd52b957e00000000, 0xb020ec1700000000, + 0x1f3d67ac00000000, 0x7a361ec500000000, 0xaa572afd00000000, + 0xcf5c539400000000, 0x6041d82f00000000, 0x054aa14600000000, + 0x7f7cbf8300000000, 0x1a77c6ea00000000, 0xb56a4d5100000000, + 0xd061343800000000, 0x15a9252100000000, 0x70a25c4800000000, + 0xdfbfd7f300000000, 0xbab4ae9a00000000, 0xc082b05f00000000, + 0xa589c93600000000, 0x0a94428d00000000, 0x6f9f3be400000000, + 0xbffe0fdc00000000, 0xdaf576b500000000, 0x75e8fd0e00000000, + 0x10e3846700000000, 0x6ad59aa200000000, 0x0fdee3cb00000000, + 0xa0c3687000000000, 0xc5c8111900000000, 0x2a524b4200000000, + 0x4f59322b00000000, 0xe044b99000000000, 0x854fc0f900000000, + 0xff79de3c00000000, 0x9a72a75500000000, 0x356f2cee00000000, + 0x5064558700000000, 0x800561bf00000000, 0xe50e18d600000000, + 0x4a13936d00000000, 0x2f18ea0400000000, 0x552ef4c100000000, + 0x30258da800000000, 0x9f38061300000000, 0xfa337f7a00000000, + 0x3ffb6e6300000000, 0x5af0170a00000000, 0xf5ed9cb100000000, + 0x90e6e5d800000000, 0xead0fb1d00000000, 0x8fdb827400000000, + 0x20c609cf00000000, 0x45cd70a600000000, 0x95ac449e00000000, + 0xf0a73df700000000, 0x5fbab64c00000000, 0x3ab1cf2500000000, + 0x4087d1e000000000, 0x258ca88900000000, 0x8a91233200000000, + 0xef9a5a5b00000000, 0x54a4968400000000, 0x31afefed00000000, + 0x9eb2645600000000, 0xfbb91d3f00000000, 0x818f03fa00000000, + 0xe4847a9300000000, 0x4b99f12800000000, 0x2e92884100000000, + 0xfef3bc7900000000, 0x9bf8c51000000000, 0x34e54eab00000000, + 0x51ee37c200000000, 0x2bd8290700000000, 0x4ed3506e00000000, + 0xe1cedbd500000000, 0x84c5a2bc00000000, 0x410db3a500000000, + 0x2406cacc00000000, 0x8b1b417700000000, 0xee10381e00000000, + 0x942626db00000000, 0xf12d5fb200000000, 0x5e30d40900000000, + 0x3b3bad6000000000, 0xeb5a995800000000, 0x8e51e03100000000, + 0x214c6b8a00000000, 0x444712e300000000, 0x3e710c2600000000, + 0x5b7a754f00000000, 0xf467fef400000000, 0x916c879d00000000, + 0x7ef6ddc600000000, 0x1bfda4af00000000, 0xb4e02f1400000000, + 0xd1eb567d00000000, 0xabdd48b800000000, 0xced631d100000000, + 0x61cbba6a00000000, 0x04c0c30300000000, 0xd4a1f73b00000000, + 0xb1aa8e5200000000, 0x1eb705e900000000, 0x7bbc7c8000000000, + 0x018a624500000000, 0x64811b2c00000000, 0xcb9c909700000000, + 0xae97e9fe00000000, 0x6b5ff8e700000000, 0x0e54818e00000000, + 0xa1490a3500000000, 0xc442735c00000000, 0xbe746d9900000000, + 0xdb7f14f000000000, 0x74629f4b00000000, 0x1169e62200000000, + 0xc108d21a00000000, 0xa403ab7300000000, 0x0b1e20c800000000, + 0x6e1559a100000000, 0x1423476400000000, 0x71283e0d00000000, + 0xde35b5b600000000, 0xbb3eccdf00000000, 0xe94e5cd200000000, + 0x8c4525bb00000000, 0x2358ae0000000000, 0x4653d76900000000, + 0x3c65c9ac00000000, 0x596eb0c500000000, 0xf6733b7e00000000, + 0x9378421700000000, 0x4319762f00000000, 0x26120f4600000000, + 0x890f84fd00000000, 0xec04fd9400000000, 0x9632e35100000000, + 0xf3399a3800000000, 0x5c24118300000000, 0x392f68ea00000000, + 0xfce779f300000000, 0x99ec009a00000000, 0x36f18b2100000000, + 0x53faf24800000000, 0x29ccec8d00000000, 0x4cc795e400000000, + 0xe3da1e5f00000000, 0x86d1673600000000, 0x56b0530e00000000, + 0x33bb2a6700000000, 0x9ca6a1dc00000000, 0xf9add8b500000000, + 0x839bc67000000000, 0xe690bf1900000000, 0x498d34a200000000, + 0x2c864dcb00000000, 0xc31c179000000000, 0xa6176ef900000000, + 0x090ae54200000000, 0x6c019c2b00000000, 0x163782ee00000000, + 0x733cfb8700000000, 0xdc21703c00000000, 0xb92a095500000000, + 0x694b3d6d00000000, 0x0c40440400000000, 0xa35dcfbf00000000, + 0xc656b6d600000000, 0xbc60a81300000000, 0xd96bd17a00000000, + 0x76765ac100000000, 0x137d23a800000000, 0xd6b532b100000000, + 0xb3be4bd800000000, 0x1ca3c06300000000, 0x79a8b90a00000000, + 0x039ea7cf00000000, 0x6695dea600000000, 0xc988551d00000000, + 0xac832c7400000000, 0x7ce2184c00000000, 0x19e9612500000000, + 0xb6f4ea9e00000000, 0xd3ff93f700000000, 0xa9c98d3200000000, + 0xccc2f45b00000000, 0x63df7fe000000000, 0x06d4068900000000, + 0xbdeaca5600000000, 0xd8e1b33f00000000, 0x77fc388400000000, + 0x12f741ed00000000, 0x68c15f2800000000, 0x0dca264100000000, + 0xa2d7adfa00000000, 0xc7dcd49300000000, 0x17bde0ab00000000, + 0x72b699c200000000, 0xddab127900000000, 0xb8a06b1000000000, + 0xc29675d500000000, 0xa79d0cbc00000000, 0x0880870700000000, + 0x6d8bfe6e00000000, 0xa843ef7700000000, 0xcd48961e00000000, + 0x62551da500000000, 0x075e64cc00000000, 0x7d687a0900000000, + 0x1863036000000000, 0xb77e88db00000000, 0xd275f1b200000000, + 0x0214c58a00000000, 0x671fbce300000000, 0xc802375800000000, + 0xad094e3100000000, 0xd73f50f400000000, 0xb234299d00000000, + 0x1d29a22600000000, 0x7822db4f00000000, 0x97b8811400000000, + 0xf2b3f87d00000000, 0x5dae73c600000000, 0x38a50aaf00000000, + 0x4293146a00000000, 0x27986d0300000000, 0x8885e6b800000000, + 0xed8e9fd100000000, 0x3defabe900000000, 0x58e4d28000000000, + 0xf7f9593b00000000, 0x92f2205200000000, 0xe8c43e9700000000, + 0x8dcf47fe00000000, 0x22d2cc4500000000, 0x47d9b52c00000000, + 0x8211a43500000000, 0xe71add5c00000000, 0x480756e700000000, + 0x2d0c2f8e00000000, 0x573a314b00000000, 0x3231482200000000, + 0x9d2cc39900000000, 0xf827baf000000000, 0x28468ec800000000, + 0x4d4df7a100000000, 0xe2507c1a00000000, 0x875b057300000000, + 0xfd6d1bb600000000, 0x986662df00000000, 0x377be96400000000, + 0x5270900d00000000}, + {0x0000000000000000, 0xdcecb13d00000000, 0xb8d9637b00000000, + 0x6435d24600000000, 0x70b3c7f600000000, 0xac5f76cb00000000, + 0xc86aa48d00000000, 0x148615b000000000, 0xa160fe3600000000, + 0x7d8c4f0b00000000, 0x19b99d4d00000000, 0xc5552c7000000000, + 0xd1d339c000000000, 0x0d3f88fd00000000, 0x690a5abb00000000, + 0xb5e6eb8600000000, 0x42c1fc6d00000000, 0x9e2d4d5000000000, + 0xfa189f1600000000, 0x26f42e2b00000000, 0x32723b9b00000000, + 0xee9e8aa600000000, 0x8aab58e000000000, 0x5647e9dd00000000, + 0xe3a1025b00000000, 0x3f4db36600000000, 0x5b78612000000000, + 0x8794d01d00000000, 0x9312c5ad00000000, 0x4ffe749000000000, + 0x2bcba6d600000000, 0xf72717eb00000000, 0x8482f9db00000000, + 0x586e48e600000000, 0x3c5b9aa000000000, 0xe0b72b9d00000000, + 0xf4313e2d00000000, 0x28dd8f1000000000, 0x4ce85d5600000000, + 0x9004ec6b00000000, 0x25e207ed00000000, 0xf90eb6d000000000, + 0x9d3b649600000000, 0x41d7d5ab00000000, 0x5551c01b00000000, + 0x89bd712600000000, 0xed88a36000000000, 0x3164125d00000000, + 0xc64305b600000000, 0x1aafb48b00000000, 0x7e9a66cd00000000, + 0xa276d7f000000000, 0xb6f0c24000000000, 0x6a1c737d00000000, + 0x0e29a13b00000000, 0xd2c5100600000000, 0x6723fb8000000000, + 0xbbcf4abd00000000, 0xdffa98fb00000000, 0x031629c600000000, + 0x17903c7600000000, 0xcb7c8d4b00000000, 0xaf495f0d00000000, + 0x73a5ee3000000000, 0x4903826c00000000, 0x95ef335100000000, + 0xf1dae11700000000, 0x2d36502a00000000, 0x39b0459a00000000, + 0xe55cf4a700000000, 0x816926e100000000, 0x5d8597dc00000000, + 0xe8637c5a00000000, 0x348fcd6700000000, 0x50ba1f2100000000, + 0x8c56ae1c00000000, 0x98d0bbac00000000, 0x443c0a9100000000, + 0x2009d8d700000000, 0xfce569ea00000000, 0x0bc27e0100000000, + 0xd72ecf3c00000000, 0xb31b1d7a00000000, 0x6ff7ac4700000000, + 0x7b71b9f700000000, 0xa79d08ca00000000, 0xc3a8da8c00000000, + 0x1f446bb100000000, 0xaaa2803700000000, 0x764e310a00000000, + 0x127be34c00000000, 0xce97527100000000, 0xda1147c100000000, + 0x06fdf6fc00000000, 0x62c824ba00000000, 0xbe24958700000000, + 0xcd817bb700000000, 0x116dca8a00000000, 0x755818cc00000000, + 0xa9b4a9f100000000, 0xbd32bc4100000000, 0x61de0d7c00000000, + 0x05ebdf3a00000000, 0xd9076e0700000000, 0x6ce1858100000000, + 0xb00d34bc00000000, 0xd438e6fa00000000, 0x08d457c700000000, + 0x1c52427700000000, 0xc0bef34a00000000, 0xa48b210c00000000, + 0x7867903100000000, 0x8f4087da00000000, 0x53ac36e700000000, + 0x3799e4a100000000, 0xeb75559c00000000, 0xfff3402c00000000, + 0x231ff11100000000, 0x472a235700000000, 0x9bc6926a00000000, + 0x2e2079ec00000000, 0xf2ccc8d100000000, 0x96f91a9700000000, + 0x4a15abaa00000000, 0x5e93be1a00000000, 0x827f0f2700000000, + 0xe64add6100000000, 0x3aa66c5c00000000, 0x920604d900000000, + 0x4eeab5e400000000, 0x2adf67a200000000, 0xf633d69f00000000, + 0xe2b5c32f00000000, 0x3e59721200000000, 0x5a6ca05400000000, + 0x8680116900000000, 0x3366faef00000000, 0xef8a4bd200000000, + 0x8bbf999400000000, 0x575328a900000000, 0x43d53d1900000000, + 0x9f398c2400000000, 0xfb0c5e6200000000, 0x27e0ef5f00000000, + 0xd0c7f8b400000000, 0x0c2b498900000000, 0x681e9bcf00000000, + 0xb4f22af200000000, 0xa0743f4200000000, 0x7c988e7f00000000, + 0x18ad5c3900000000, 0xc441ed0400000000, 0x71a7068200000000, + 0xad4bb7bf00000000, 0xc97e65f900000000, 0x1592d4c400000000, + 0x0114c17400000000, 0xddf8704900000000, 0xb9cda20f00000000, + 0x6521133200000000, 0x1684fd0200000000, 0xca684c3f00000000, + 0xae5d9e7900000000, 0x72b12f4400000000, 0x66373af400000000, + 0xbadb8bc900000000, 0xdeee598f00000000, 0x0202e8b200000000, + 0xb7e4033400000000, 0x6b08b20900000000, 0x0f3d604f00000000, + 0xd3d1d17200000000, 0xc757c4c200000000, 0x1bbb75ff00000000, + 0x7f8ea7b900000000, 0xa362168400000000, 0x5445016f00000000, + 0x88a9b05200000000, 0xec9c621400000000, 0x3070d32900000000, + 0x24f6c69900000000, 0xf81a77a400000000, 0x9c2fa5e200000000, + 0x40c314df00000000, 0xf525ff5900000000, 0x29c94e6400000000, + 0x4dfc9c2200000000, 0x91102d1f00000000, 0x859638af00000000, + 0x597a899200000000, 0x3d4f5bd400000000, 0xe1a3eae900000000, + 0xdb0586b500000000, 0x07e9378800000000, 0x63dce5ce00000000, + 0xbf3054f300000000, 0xabb6414300000000, 0x775af07e00000000, + 0x136f223800000000, 0xcf83930500000000, 0x7a65788300000000, + 0xa689c9be00000000, 0xc2bc1bf800000000, 0x1e50aac500000000, + 0x0ad6bf7500000000, 0xd63a0e4800000000, 0xb20fdc0e00000000, + 0x6ee36d3300000000, 0x99c47ad800000000, 0x4528cbe500000000, + 0x211d19a300000000, 0xfdf1a89e00000000, 0xe977bd2e00000000, + 0x359b0c1300000000, 0x51aede5500000000, 0x8d426f6800000000, + 0x38a484ee00000000, 0xe44835d300000000, 0x807de79500000000, + 0x5c9156a800000000, 0x4817431800000000, 0x94fbf22500000000, + 0xf0ce206300000000, 0x2c22915e00000000, 0x5f877f6e00000000, + 0x836bce5300000000, 0xe75e1c1500000000, 0x3bb2ad2800000000, + 0x2f34b89800000000, 0xf3d809a500000000, 0x97eddbe300000000, + 0x4b016ade00000000, 0xfee7815800000000, 0x220b306500000000, + 0x463ee22300000000, 0x9ad2531e00000000, 0x8e5446ae00000000, + 0x52b8f79300000000, 0x368d25d500000000, 0xea6194e800000000, + 0x1d46830300000000, 0xc1aa323e00000000, 0xa59fe07800000000, + 0x7973514500000000, 0x6df544f500000000, 0xb119f5c800000000, + 0xd52c278e00000000, 0x09c096b300000000, 0xbc267d3500000000, + 0x60cacc0800000000, 0x04ff1e4e00000000, 0xd813af7300000000, + 0xcc95bac300000000, 0x10790bfe00000000, 0x744cd9b800000000, + 0xa8a0688500000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x81256527, 0xd93bcc0f, 0x581ea928, 0x69069e5f, + 0xe823fb78, 0xb03d5250, 0x31183777, 0xd20d3cbe, 0x53285999, + 0x0b36f0b1, 0x8a139596, 0xbb0ba2e1, 0x3a2ec7c6, 0x62306eee, + 0xe3150bc9, 0x7f6b7f3d, 0xfe4e1a1a, 0xa650b332, 0x2775d615, + 0x166de162, 0x97488445, 0xcf562d6d, 0x4e73484a, 0xad664383, + 0x2c4326a4, 0x745d8f8c, 0xf578eaab, 0xc460dddc, 0x4545b8fb, + 0x1d5b11d3, 0x9c7e74f4, 0xfed6fe7a, 0x7ff39b5d, 0x27ed3275, + 0xa6c85752, 0x97d06025, 0x16f50502, 0x4eebac2a, 0xcfcec90d, + 0x2cdbc2c4, 0xadfea7e3, 0xf5e00ecb, 0x74c56bec, 0x45dd5c9b, + 0xc4f839bc, 0x9ce69094, 0x1dc3f5b3, 0x81bd8147, 0x0098e460, + 0x58864d48, 0xd9a3286f, 0xe8bb1f18, 0x699e7a3f, 0x3180d317, + 0xb0a5b630, 0x53b0bdf9, 0xd295d8de, 0x8a8b71f6, 0x0bae14d1, + 0x3ab623a6, 0xbb934681, 0xe38defa9, 0x62a88a8e, 0x26dcfab5, + 0xa7f99f92, 0xffe736ba, 0x7ec2539d, 0x4fda64ea, 0xceff01cd, + 0x96e1a8e5, 0x17c4cdc2, 0xf4d1c60b, 0x75f4a32c, 0x2dea0a04, + 0xaccf6f23, 0x9dd75854, 0x1cf23d73, 0x44ec945b, 0xc5c9f17c, + 0x59b78588, 0xd892e0af, 0x808c4987, 0x01a92ca0, 0x30b11bd7, + 0xb1947ef0, 0xe98ad7d8, 0x68afb2ff, 0x8bbab936, 0x0a9fdc11, + 0x52817539, 0xd3a4101e, 0xe2bc2769, 0x6399424e, 0x3b87eb66, + 0xbaa28e41, 0xd80a04cf, 0x592f61e8, 0x0131c8c0, 0x8014ade7, + 0xb10c9a90, 0x3029ffb7, 0x6837569f, 0xe91233b8, 0x0a073871, + 0x8b225d56, 0xd33cf47e, 0x52199159, 0x6301a62e, 0xe224c309, + 0xba3a6a21, 0x3b1f0f06, 0xa7617bf2, 0x26441ed5, 0x7e5ab7fd, + 0xff7fd2da, 0xce67e5ad, 0x4f42808a, 0x175c29a2, 0x96794c85, + 0x756c474c, 0xf449226b, 0xac578b43, 0x2d72ee64, 0x1c6ad913, + 0x9d4fbc34, 0xc551151c, 0x4474703b, 0x4db9f56a, 0xcc9c904d, + 0x94823965, 0x15a75c42, 0x24bf6b35, 0xa59a0e12, 0xfd84a73a, + 0x7ca1c21d, 0x9fb4c9d4, 0x1e91acf3, 0x468f05db, 0xc7aa60fc, + 0xf6b2578b, 0x779732ac, 0x2f899b84, 0xaeacfea3, 0x32d28a57, + 0xb3f7ef70, 0xebe94658, 0x6acc237f, 0x5bd41408, 0xdaf1712f, + 0x82efd807, 0x03cabd20, 0xe0dfb6e9, 0x61fad3ce, 0x39e47ae6, + 0xb8c11fc1, 0x89d928b6, 0x08fc4d91, 0x50e2e4b9, 0xd1c7819e, + 0xb36f0b10, 0x324a6e37, 0x6a54c71f, 0xeb71a238, 0xda69954f, + 0x5b4cf068, 0x03525940, 0x82773c67, 0x616237ae, 0xe0475289, + 0xb859fba1, 0x397c9e86, 0x0864a9f1, 0x8941ccd6, 0xd15f65fe, + 0x507a00d9, 0xcc04742d, 0x4d21110a, 0x153fb822, 0x941add05, + 0xa502ea72, 0x24278f55, 0x7c39267d, 0xfd1c435a, 0x1e094893, + 0x9f2c2db4, 0xc732849c, 0x4617e1bb, 0x770fd6cc, 0xf62ab3eb, + 0xae341ac3, 0x2f117fe4, 0x6b650fdf, 0xea406af8, 0xb25ec3d0, + 0x337ba6f7, 0x02639180, 0x8346f4a7, 0xdb585d8f, 0x5a7d38a8, + 0xb9683361, 0x384d5646, 0x6053ff6e, 0xe1769a49, 0xd06ead3e, + 0x514bc819, 0x09556131, 0x88700416, 0x140e70e2, 0x952b15c5, + 0xcd35bced, 0x4c10d9ca, 0x7d08eebd, 0xfc2d8b9a, 0xa43322b2, + 0x25164795, 0xc6034c5c, 0x4726297b, 0x1f388053, 0x9e1de574, + 0xaf05d203, 0x2e20b724, 0x763e1e0c, 0xf71b7b2b, 0x95b3f1a5, + 0x14969482, 0x4c883daa, 0xcdad588d, 0xfcb56ffa, 0x7d900add, + 0x258ea3f5, 0xa4abc6d2, 0x47becd1b, 0xc69ba83c, 0x9e850114, + 0x1fa06433, 0x2eb85344, 0xaf9d3663, 0xf7839f4b, 0x76a6fa6c, + 0xead88e98, 0x6bfdebbf, 0x33e34297, 0xb2c627b0, 0x83de10c7, + 0x02fb75e0, 0x5ae5dcc8, 0xdbc0b9ef, 0x38d5b226, 0xb9f0d701, + 0xe1ee7e29, 0x60cb1b0e, 0x51d32c79, 0xd0f6495e, 0x88e8e076, + 0x09cd8551}, + {0x00000000, 0x9b73ead4, 0xed96d3e9, 0x76e5393d, 0x005ca193, + 0x9b2f4b47, 0xedca727a, 0x76b998ae, 0x00b94326, 0x9bcaa9f2, + 0xed2f90cf, 0x765c7a1b, 0x00e5e2b5, 0x9b960861, 0xed73315c, + 0x7600db88, 0x0172864c, 0x9a016c98, 0xece455a5, 0x7797bf71, + 0x012e27df, 0x9a5dcd0b, 0xecb8f436, 0x77cb1ee2, 0x01cbc56a, + 0x9ab82fbe, 0xec5d1683, 0x772efc57, 0x019764f9, 0x9ae48e2d, + 0xec01b710, 0x77725dc4, 0x02e50c98, 0x9996e64c, 0xef73df71, + 0x740035a5, 0x02b9ad0b, 0x99ca47df, 0xef2f7ee2, 0x745c9436, + 0x025c4fbe, 0x992fa56a, 0xefca9c57, 0x74b97683, 0x0200ee2d, + 0x997304f9, 0xef963dc4, 0x74e5d710, 0x03978ad4, 0x98e46000, + 0xee01593d, 0x7572b3e9, 0x03cb2b47, 0x98b8c193, 0xee5df8ae, + 0x752e127a, 0x032ec9f2, 0x985d2326, 0xeeb81a1b, 0x75cbf0cf, + 0x03726861, 0x980182b5, 0xeee4bb88, 0x7597515c, 0x05ca1930, + 0x9eb9f3e4, 0xe85ccad9, 0x732f200d, 0x0596b8a3, 0x9ee55277, + 0xe8006b4a, 0x7373819e, 0x05735a16, 0x9e00b0c2, 0xe8e589ff, + 0x7396632b, 0x052ffb85, 0x9e5c1151, 0xe8b9286c, 0x73cac2b8, + 0x04b89f7c, 0x9fcb75a8, 0xe92e4c95, 0x725da641, 0x04e43eef, + 0x9f97d43b, 0xe972ed06, 0x720107d2, 0x0401dc5a, 0x9f72368e, + 0xe9970fb3, 0x72e4e567, 0x045d7dc9, 0x9f2e971d, 0xe9cbae20, + 0x72b844f4, 0x072f15a8, 0x9c5cff7c, 0xeab9c641, 0x71ca2c95, + 0x0773b43b, 0x9c005eef, 0xeae567d2, 0x71968d06, 0x0796568e, + 0x9ce5bc5a, 0xea008567, 0x71736fb3, 0x07caf71d, 0x9cb91dc9, + 0xea5c24f4, 0x712fce20, 0x065d93e4, 0x9d2e7930, 0xebcb400d, + 0x70b8aad9, 0x06013277, 0x9d72d8a3, 0xeb97e19e, 0x70e40b4a, + 0x06e4d0c2, 0x9d973a16, 0xeb72032b, 0x7001e9ff, 0x06b87151, + 0x9dcb9b85, 0xeb2ea2b8, 0x705d486c, 0x0b943260, 0x90e7d8b4, + 0xe602e189, 0x7d710b5d, 0x0bc893f3, 0x90bb7927, 0xe65e401a, + 0x7d2daace, 0x0b2d7146, 0x905e9b92, 0xe6bba2af, 0x7dc8487b, + 0x0b71d0d5, 0x90023a01, 0xe6e7033c, 0x7d94e9e8, 0x0ae6b42c, + 0x91955ef8, 0xe77067c5, 0x7c038d11, 0x0aba15bf, 0x91c9ff6b, + 0xe72cc656, 0x7c5f2c82, 0x0a5ff70a, 0x912c1dde, 0xe7c924e3, + 0x7cbace37, 0x0a035699, 0x9170bc4d, 0xe7958570, 0x7ce66fa4, + 0x09713ef8, 0x9202d42c, 0xe4e7ed11, 0x7f9407c5, 0x092d9f6b, + 0x925e75bf, 0xe4bb4c82, 0x7fc8a656, 0x09c87dde, 0x92bb970a, + 0xe45eae37, 0x7f2d44e3, 0x0994dc4d, 0x92e73699, 0xe4020fa4, + 0x7f71e570, 0x0803b8b4, 0x93705260, 0xe5956b5d, 0x7ee68189, + 0x085f1927, 0x932cf3f3, 0xe5c9cace, 0x7eba201a, 0x08bafb92, + 0x93c91146, 0xe52c287b, 0x7e5fc2af, 0x08e65a01, 0x9395b0d5, + 0xe57089e8, 0x7e03633c, 0x0e5e2b50, 0x952dc184, 0xe3c8f8b9, + 0x78bb126d, 0x0e028ac3, 0x95716017, 0xe394592a, 0x78e7b3fe, + 0x0ee76876, 0x959482a2, 0xe371bb9f, 0x7802514b, 0x0ebbc9e5, + 0x95c82331, 0xe32d1a0c, 0x785ef0d8, 0x0f2cad1c, 0x945f47c8, + 0xe2ba7ef5, 0x79c99421, 0x0f700c8f, 0x9403e65b, 0xe2e6df66, + 0x799535b2, 0x0f95ee3a, 0x94e604ee, 0xe2033dd3, 0x7970d707, + 0x0fc94fa9, 0x94baa57d, 0xe25f9c40, 0x792c7694, 0x0cbb27c8, + 0x97c8cd1c, 0xe12df421, 0x7a5e1ef5, 0x0ce7865b, 0x97946c8f, + 0xe17155b2, 0x7a02bf66, 0x0c0264ee, 0x97718e3a, 0xe194b707, + 0x7ae75dd3, 0x0c5ec57d, 0x972d2fa9, 0xe1c81694, 0x7abbfc40, + 0x0dc9a184, 0x96ba4b50, 0xe05f726d, 0x7b2c98b9, 0x0d950017, + 0x96e6eac3, 0xe003d3fe, 0x7b70392a, 0x0d70e2a2, 0x96030876, + 0xe0e6314b, 0x7b95db9f, 0x0d2c4331, 0x965fa9e5, 0xe0ba90d8, + 0x7bc97a0c}, + {0x00000000, 0x172864c0, 0x2e50c980, 0x3978ad40, 0x5ca19300, + 0x4b89f7c0, 0x72f15a80, 0x65d93e40, 0xb9432600, 0xae6b42c0, + 0x9713ef80, 0x803b8b40, 0xe5e2b500, 0xf2cad1c0, 0xcbb27c80, + 0xdc9a1840, 0xa9f74a41, 0xbedf2e81, 0x87a783c1, 0x908fe701, + 0xf556d941, 0xe27ebd81, 0xdb0610c1, 0xcc2e7401, 0x10b46c41, + 0x079c0881, 0x3ee4a5c1, 0x29ccc101, 0x4c15ff41, 0x5b3d9b81, + 0x624536c1, 0x756d5201, 0x889f92c3, 0x9fb7f603, 0xa6cf5b43, + 0xb1e73f83, 0xd43e01c3, 0xc3166503, 0xfa6ec843, 0xed46ac83, + 0x31dcb4c3, 0x26f4d003, 0x1f8c7d43, 0x08a41983, 0x6d7d27c3, + 0x7a554303, 0x432dee43, 0x54058a83, 0x2168d882, 0x3640bc42, + 0x0f381102, 0x181075c2, 0x7dc94b82, 0x6ae12f42, 0x53998202, + 0x44b1e6c2, 0x982bfe82, 0x8f039a42, 0xb67b3702, 0xa15353c2, + 0xc48a6d82, 0xd3a20942, 0xeadaa402, 0xfdf2c0c2, 0xca4e23c7, + 0xdd664707, 0xe41eea47, 0xf3368e87, 0x96efb0c7, 0x81c7d407, + 0xb8bf7947, 0xaf971d87, 0x730d05c7, 0x64256107, 0x5d5dcc47, + 0x4a75a887, 0x2fac96c7, 0x3884f207, 0x01fc5f47, 0x16d43b87, + 0x63b96986, 0x74910d46, 0x4de9a006, 0x5ac1c4c6, 0x3f18fa86, + 0x28309e46, 0x11483306, 0x066057c6, 0xdafa4f86, 0xcdd22b46, + 0xf4aa8606, 0xe382e2c6, 0x865bdc86, 0x9173b846, 0xa80b1506, + 0xbf2371c6, 0x42d1b104, 0x55f9d5c4, 0x6c817884, 0x7ba91c44, + 0x1e702204, 0x095846c4, 0x3020eb84, 0x27088f44, 0xfb929704, + 0xecbaf3c4, 0xd5c25e84, 0xc2ea3a44, 0xa7330404, 0xb01b60c4, + 0x8963cd84, 0x9e4ba944, 0xeb26fb45, 0xfc0e9f85, 0xc57632c5, + 0xd25e5605, 0xb7876845, 0xa0af0c85, 0x99d7a1c5, 0x8effc505, + 0x5265dd45, 0x454db985, 0x7c3514c5, 0x6b1d7005, 0x0ec44e45, + 0x19ec2a85, 0x209487c5, 0x37bce305, 0x4fed41cf, 0x58c5250f, + 0x61bd884f, 0x7695ec8f, 0x134cd2cf, 0x0464b60f, 0x3d1c1b4f, + 0x2a347f8f, 0xf6ae67cf, 0xe186030f, 0xd8feae4f, 0xcfd6ca8f, + 0xaa0ff4cf, 0xbd27900f, 0x845f3d4f, 0x9377598f, 0xe61a0b8e, + 0xf1326f4e, 0xc84ac20e, 0xdf62a6ce, 0xbabb988e, 0xad93fc4e, + 0x94eb510e, 0x83c335ce, 0x5f592d8e, 0x4871494e, 0x7109e40e, + 0x662180ce, 0x03f8be8e, 0x14d0da4e, 0x2da8770e, 0x3a8013ce, + 0xc772d30c, 0xd05ab7cc, 0xe9221a8c, 0xfe0a7e4c, 0x9bd3400c, + 0x8cfb24cc, 0xb583898c, 0xa2abed4c, 0x7e31f50c, 0x691991cc, + 0x50613c8c, 0x4749584c, 0x2290660c, 0x35b802cc, 0x0cc0af8c, + 0x1be8cb4c, 0x6e85994d, 0x79adfd8d, 0x40d550cd, 0x57fd340d, + 0x32240a4d, 0x250c6e8d, 0x1c74c3cd, 0x0b5ca70d, 0xd7c6bf4d, + 0xc0eedb8d, 0xf99676cd, 0xeebe120d, 0x8b672c4d, 0x9c4f488d, + 0xa537e5cd, 0xb21f810d, 0x85a36208, 0x928b06c8, 0xabf3ab88, + 0xbcdbcf48, 0xd902f108, 0xce2a95c8, 0xf7523888, 0xe07a5c48, + 0x3ce04408, 0x2bc820c8, 0x12b08d88, 0x0598e948, 0x6041d708, + 0x7769b3c8, 0x4e111e88, 0x59397a48, 0x2c542849, 0x3b7c4c89, + 0x0204e1c9, 0x152c8509, 0x70f5bb49, 0x67dddf89, 0x5ea572c9, + 0x498d1609, 0x95170e49, 0x823f6a89, 0xbb47c7c9, 0xac6fa309, + 0xc9b69d49, 0xde9ef989, 0xe7e654c9, 0xf0ce3009, 0x0d3cf0cb, + 0x1a14940b, 0x236c394b, 0x34445d8b, 0x519d63cb, 0x46b5070b, + 0x7fcdaa4b, 0x68e5ce8b, 0xb47fd6cb, 0xa357b20b, 0x9a2f1f4b, + 0x8d077b8b, 0xe8de45cb, 0xfff6210b, 0xc68e8c4b, 0xd1a6e88b, + 0xa4cbba8a, 0xb3e3de4a, 0x8a9b730a, 0x9db317ca, 0xf86a298a, + 0xef424d4a, 0xd63ae00a, 0xc11284ca, 0x1d889c8a, 0x0aa0f84a, + 0x33d8550a, 0x24f031ca, 0x41290f8a, 0x56016b4a, 0x6f79c60a, + 0x7851a2ca}, + {0x00000000, 0x9fda839e, 0xe4c4017d, 0x7b1e82e3, 0x12f904bb, + 0x8d238725, 0xf63d05c6, 0x69e78658, 0x25f20976, 0xba288ae8, + 0xc136080b, 0x5eec8b95, 0x370b0dcd, 0xa8d18e53, 0xd3cf0cb0, + 0x4c158f2e, 0x4be412ec, 0xd43e9172, 0xaf201391, 0x30fa900f, + 0x591d1657, 0xc6c795c9, 0xbdd9172a, 0x220394b4, 0x6e161b9a, + 0xf1cc9804, 0x8ad21ae7, 0x15089979, 0x7cef1f21, 0xe3359cbf, + 0x982b1e5c, 0x07f19dc2, 0x97c825d8, 0x0812a646, 0x730c24a5, + 0xecd6a73b, 0x85312163, 0x1aeba2fd, 0x61f5201e, 0xfe2fa380, + 0xb23a2cae, 0x2de0af30, 0x56fe2dd3, 0xc924ae4d, 0xa0c32815, + 0x3f19ab8b, 0x44072968, 0xdbddaaf6, 0xdc2c3734, 0x43f6b4aa, + 0x38e83649, 0xa732b5d7, 0xced5338f, 0x510fb011, 0x2a1132f2, + 0xb5cbb16c, 0xf9de3e42, 0x6604bddc, 0x1d1a3f3f, 0x82c0bca1, + 0xeb273af9, 0x74fdb967, 0x0fe33b84, 0x9039b81a, 0xf4e14df1, + 0x6b3bce6f, 0x10254c8c, 0x8fffcf12, 0xe618494a, 0x79c2cad4, + 0x02dc4837, 0x9d06cba9, 0xd1134487, 0x4ec9c719, 0x35d745fa, + 0xaa0dc664, 0xc3ea403c, 0x5c30c3a2, 0x272e4141, 0xb8f4c2df, + 0xbf055f1d, 0x20dfdc83, 0x5bc15e60, 0xc41bddfe, 0xadfc5ba6, + 0x3226d838, 0x49385adb, 0xd6e2d945, 0x9af7566b, 0x052dd5f5, + 0x7e335716, 0xe1e9d488, 0x880e52d0, 0x17d4d14e, 0x6cca53ad, + 0xf310d033, 0x63296829, 0xfcf3ebb7, 0x87ed6954, 0x1837eaca, + 0x71d06c92, 0xee0aef0c, 0x95146def, 0x0aceee71, 0x46db615f, + 0xd901e2c1, 0xa21f6022, 0x3dc5e3bc, 0x542265e4, 0xcbf8e67a, + 0xb0e66499, 0x2f3ce707, 0x28cd7ac5, 0xb717f95b, 0xcc097bb8, + 0x53d3f826, 0x3a347e7e, 0xa5eefde0, 0xdef07f03, 0x412afc9d, + 0x0d3f73b3, 0x92e5f02d, 0xe9fb72ce, 0x7621f150, 0x1fc67708, + 0x801cf496, 0xfb027675, 0x64d8f5eb, 0x32b39da3, 0xad691e3d, + 0xd6779cde, 0x49ad1f40, 0x204a9918, 0xbf901a86, 0xc48e9865, + 0x5b541bfb, 0x174194d5, 0x889b174b, 0xf38595a8, 0x6c5f1636, + 0x05b8906e, 0x9a6213f0, 0xe17c9113, 0x7ea6128d, 0x79578f4f, + 0xe68d0cd1, 0x9d938e32, 0x02490dac, 0x6bae8bf4, 0xf474086a, + 0x8f6a8a89, 0x10b00917, 0x5ca58639, 0xc37f05a7, 0xb8618744, + 0x27bb04da, 0x4e5c8282, 0xd186011c, 0xaa9883ff, 0x35420061, + 0xa57bb87b, 0x3aa13be5, 0x41bfb906, 0xde653a98, 0xb782bcc0, + 0x28583f5e, 0x5346bdbd, 0xcc9c3e23, 0x8089b10d, 0x1f533293, + 0x644db070, 0xfb9733ee, 0x9270b5b6, 0x0daa3628, 0x76b4b4cb, + 0xe96e3755, 0xee9faa97, 0x71452909, 0x0a5babea, 0x95812874, + 0xfc66ae2c, 0x63bc2db2, 0x18a2af51, 0x87782ccf, 0xcb6da3e1, + 0x54b7207f, 0x2fa9a29c, 0xb0732102, 0xd994a75a, 0x464e24c4, + 0x3d50a627, 0xa28a25b9, 0xc652d052, 0x598853cc, 0x2296d12f, + 0xbd4c52b1, 0xd4abd4e9, 0x4b715777, 0x306fd594, 0xafb5560a, + 0xe3a0d924, 0x7c7a5aba, 0x0764d859, 0x98be5bc7, 0xf159dd9f, + 0x6e835e01, 0x159ddce2, 0x8a475f7c, 0x8db6c2be, 0x126c4120, + 0x6972c3c3, 0xf6a8405d, 0x9f4fc605, 0x0095459b, 0x7b8bc778, + 0xe45144e6, 0xa844cbc8, 0x379e4856, 0x4c80cab5, 0xd35a492b, + 0xbabdcf73, 0x25674ced, 0x5e79ce0e, 0xc1a34d90, 0x519af58a, + 0xce407614, 0xb55ef4f7, 0x2a847769, 0x4363f131, 0xdcb972af, + 0xa7a7f04c, 0x387d73d2, 0x7468fcfc, 0xebb27f62, 0x90acfd81, + 0x0f767e1f, 0x6691f847, 0xf94b7bd9, 0x8255f93a, 0x1d8f7aa4, + 0x1a7ee766, 0x85a464f8, 0xfebae61b, 0x61606585, 0x0887e3dd, + 0x975d6043, 0xec43e2a0, 0x7399613e, 0x3f8cee10, 0xa0566d8e, + 0xdb48ef6d, 0x44926cf3, 0x2d75eaab, 0xb2af6935, 0xc9b1ebd6, + 0x566b6848}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x9e83da9f, 0x7d01c4e4, 0xe3821e7b, 0xbb04f912, + 0x2587238d, 0xc6053df6, 0x5886e769, 0x7609f225, 0xe88a28ba, + 0x0b0836c1, 0x958bec5e, 0xcd0d0b37, 0x538ed1a8, 0xb00ccfd3, + 0x2e8f154c, 0xec12e44b, 0x72913ed4, 0x911320af, 0x0f90fa30, + 0x57161d59, 0xc995c7c6, 0x2a17d9bd, 0xb4940322, 0x9a1b166e, + 0x0498ccf1, 0xe71ad28a, 0x79990815, 0x211fef7c, 0xbf9c35e3, + 0x5c1e2b98, 0xc29df107, 0xd825c897, 0x46a61208, 0xa5240c73, + 0x3ba7d6ec, 0x63213185, 0xfda2eb1a, 0x1e20f561, 0x80a32ffe, + 0xae2c3ab2, 0x30afe02d, 0xd32dfe56, 0x4dae24c9, 0x1528c3a0, + 0x8bab193f, 0x68290744, 0xf6aadddb, 0x34372cdc, 0xaab4f643, + 0x4936e838, 0xd7b532a7, 0x8f33d5ce, 0x11b00f51, 0xf232112a, + 0x6cb1cbb5, 0x423edef9, 0xdcbd0466, 0x3f3f1a1d, 0xa1bcc082, + 0xf93a27eb, 0x67b9fd74, 0x843be30f, 0x1ab83990, 0xf14de1f4, + 0x6fce3b6b, 0x8c4c2510, 0x12cfff8f, 0x4a4918e6, 0xd4cac279, + 0x3748dc02, 0xa9cb069d, 0x874413d1, 0x19c7c94e, 0xfa45d735, + 0x64c60daa, 0x3c40eac3, 0xa2c3305c, 0x41412e27, 0xdfc2f4b8, + 0x1d5f05bf, 0x83dcdf20, 0x605ec15b, 0xfedd1bc4, 0xa65bfcad, + 0x38d82632, 0xdb5a3849, 0x45d9e2d6, 0x6b56f79a, 0xf5d52d05, + 0x1657337e, 0x88d4e9e1, 0xd0520e88, 0x4ed1d417, 0xad53ca6c, + 0x33d010f3, 0x29682963, 0xb7ebf3fc, 0x5469ed87, 0xcaea3718, + 0x926cd071, 0x0cef0aee, 0xef6d1495, 0x71eece0a, 0x5f61db46, + 0xc1e201d9, 0x22601fa2, 0xbce3c53d, 0xe4652254, 0x7ae6f8cb, + 0x9964e6b0, 0x07e73c2f, 0xc57acd28, 0x5bf917b7, 0xb87b09cc, + 0x26f8d353, 0x7e7e343a, 0xe0fdeea5, 0x037ff0de, 0x9dfc2a41, + 0xb3733f0d, 0x2df0e592, 0xce72fbe9, 0x50f12176, 0x0877c61f, + 0x96f41c80, 0x757602fb, 0xebf5d864, 0xa39db332, 0x3d1e69ad, + 0xde9c77d6, 0x401fad49, 0x18994a20, 0x861a90bf, 0x65988ec4, + 0xfb1b545b, 0xd5944117, 0x4b179b88, 0xa89585f3, 0x36165f6c, + 0x6e90b805, 0xf013629a, 0x13917ce1, 0x8d12a67e, 0x4f8f5779, + 0xd10c8de6, 0x328e939d, 0xac0d4902, 0xf48bae6b, 0x6a0874f4, + 0x898a6a8f, 0x1709b010, 0x3986a55c, 0xa7057fc3, 0x448761b8, + 0xda04bb27, 0x82825c4e, 0x1c0186d1, 0xff8398aa, 0x61004235, + 0x7bb87ba5, 0xe53ba13a, 0x06b9bf41, 0x983a65de, 0xc0bc82b7, + 0x5e3f5828, 0xbdbd4653, 0x233e9ccc, 0x0db18980, 0x9332531f, + 0x70b04d64, 0xee3397fb, 0xb6b57092, 0x2836aa0d, 0xcbb4b476, + 0x55376ee9, 0x97aa9fee, 0x09294571, 0xeaab5b0a, 0x74288195, + 0x2cae66fc, 0xb22dbc63, 0x51afa218, 0xcf2c7887, 0xe1a36dcb, + 0x7f20b754, 0x9ca2a92f, 0x022173b0, 0x5aa794d9, 0xc4244e46, + 0x27a6503d, 0xb9258aa2, 0x52d052c6, 0xcc538859, 0x2fd19622, + 0xb1524cbd, 0xe9d4abd4, 0x7757714b, 0x94d56f30, 0x0a56b5af, + 0x24d9a0e3, 0xba5a7a7c, 0x59d86407, 0xc75bbe98, 0x9fdd59f1, + 0x015e836e, 0xe2dc9d15, 0x7c5f478a, 0xbec2b68d, 0x20416c12, + 0xc3c37269, 0x5d40a8f6, 0x05c64f9f, 0x9b459500, 0x78c78b7b, + 0xe64451e4, 0xc8cb44a8, 0x56489e37, 0xb5ca804c, 0x2b495ad3, + 0x73cfbdba, 0xed4c6725, 0x0ece795e, 0x904da3c1, 0x8af59a51, + 0x147640ce, 0xf7f45eb5, 0x6977842a, 0x31f16343, 0xaf72b9dc, + 0x4cf0a7a7, 0xd2737d38, 0xfcfc6874, 0x627fb2eb, 0x81fdac90, + 0x1f7e760f, 0x47f89166, 0xd97b4bf9, 0x3af95582, 0xa47a8f1d, + 0x66e77e1a, 0xf864a485, 0x1be6bafe, 0x85656061, 0xdde38708, + 0x43605d97, 0xa0e243ec, 0x3e619973, 0x10ee8c3f, 0x8e6d56a0, + 0x6def48db, 0xf36c9244, 0xabea752d, 0x3569afb2, 0xd6ebb1c9, + 0x48686b56}, + {0x00000000, 0xc0642817, 0x80c9502e, 0x40ad7839, 0x0093a15c, + 0xc0f7894b, 0x805af172, 0x403ed965, 0x002643b9, 0xc0426bae, + 0x80ef1397, 0x408b3b80, 0x00b5e2e5, 0xc0d1caf2, 0x807cb2cb, + 0x40189adc, 0x414af7a9, 0x812edfbe, 0xc183a787, 0x01e78f90, + 0x41d956f5, 0x81bd7ee2, 0xc11006db, 0x01742ecc, 0x416cb410, + 0x81089c07, 0xc1a5e43e, 0x01c1cc29, 0x41ff154c, 0x819b3d5b, + 0xc1364562, 0x01526d75, 0xc3929f88, 0x03f6b79f, 0x435bcfa6, + 0x833fe7b1, 0xc3013ed4, 0x036516c3, 0x43c86efa, 0x83ac46ed, + 0xc3b4dc31, 0x03d0f426, 0x437d8c1f, 0x8319a408, 0xc3277d6d, + 0x0343557a, 0x43ee2d43, 0x838a0554, 0x82d86821, 0x42bc4036, + 0x0211380f, 0xc2751018, 0x824bc97d, 0x422fe16a, 0x02829953, + 0xc2e6b144, 0x82fe2b98, 0x429a038f, 0x02377bb6, 0xc25353a1, + 0x826d8ac4, 0x4209a2d3, 0x02a4daea, 0xc2c0f2fd, 0xc7234eca, + 0x074766dd, 0x47ea1ee4, 0x878e36f3, 0xc7b0ef96, 0x07d4c781, + 0x4779bfb8, 0x871d97af, 0xc7050d73, 0x07612564, 0x47cc5d5d, + 0x87a8754a, 0xc796ac2f, 0x07f28438, 0x475ffc01, 0x873bd416, + 0x8669b963, 0x460d9174, 0x06a0e94d, 0xc6c4c15a, 0x86fa183f, + 0x469e3028, 0x06334811, 0xc6576006, 0x864ffada, 0x462bd2cd, + 0x0686aaf4, 0xc6e282e3, 0x86dc5b86, 0x46b87391, 0x06150ba8, + 0xc67123bf, 0x04b1d142, 0xc4d5f955, 0x8478816c, 0x441ca97b, + 0x0422701e, 0xc4465809, 0x84eb2030, 0x448f0827, 0x049792fb, + 0xc4f3baec, 0x845ec2d5, 0x443aeac2, 0x040433a7, 0xc4601bb0, + 0x84cd6389, 0x44a94b9e, 0x45fb26eb, 0x859f0efc, 0xc53276c5, + 0x05565ed2, 0x456887b7, 0x850cafa0, 0xc5a1d799, 0x05c5ff8e, + 0x45dd6552, 0x85b94d45, 0xc514357c, 0x05701d6b, 0x454ec40e, + 0x852aec19, 0xc5879420, 0x05e3bc37, 0xcf41ed4f, 0x0f25c558, + 0x4f88bd61, 0x8fec9576, 0xcfd24c13, 0x0fb66404, 0x4f1b1c3d, + 0x8f7f342a, 0xcf67aef6, 0x0f0386e1, 0x4faefed8, 0x8fcad6cf, + 0xcff40faa, 0x0f9027bd, 0x4f3d5f84, 0x8f597793, 0x8e0b1ae6, + 0x4e6f32f1, 0x0ec24ac8, 0xcea662df, 0x8e98bbba, 0x4efc93ad, + 0x0e51eb94, 0xce35c383, 0x8e2d595f, 0x4e497148, 0x0ee40971, + 0xce802166, 0x8ebef803, 0x4edad014, 0x0e77a82d, 0xce13803a, + 0x0cd372c7, 0xccb75ad0, 0x8c1a22e9, 0x4c7e0afe, 0x0c40d39b, + 0xcc24fb8c, 0x8c8983b5, 0x4cedaba2, 0x0cf5317e, 0xcc911969, + 0x8c3c6150, 0x4c584947, 0x0c669022, 0xcc02b835, 0x8cafc00c, + 0x4ccbe81b, 0x4d99856e, 0x8dfdad79, 0xcd50d540, 0x0d34fd57, + 0x4d0a2432, 0x8d6e0c25, 0xcdc3741c, 0x0da75c0b, 0x4dbfc6d7, + 0x8ddbeec0, 0xcd7696f9, 0x0d12beee, 0x4d2c678b, 0x8d484f9c, + 0xcde537a5, 0x0d811fb2, 0x0862a385, 0xc8068b92, 0x88abf3ab, + 0x48cfdbbc, 0x08f102d9, 0xc8952ace, 0x883852f7, 0x485c7ae0, + 0x0844e03c, 0xc820c82b, 0x888db012, 0x48e99805, 0x08d74160, + 0xc8b36977, 0x881e114e, 0x487a3959, 0x4928542c, 0x894c7c3b, + 0xc9e10402, 0x09852c15, 0x49bbf570, 0x89dfdd67, 0xc972a55e, + 0x09168d49, 0x490e1795, 0x896a3f82, 0xc9c747bb, 0x09a36fac, + 0x499db6c9, 0x89f99ede, 0xc954e6e7, 0x0930cef0, 0xcbf03c0d, + 0x0b94141a, 0x4b396c23, 0x8b5d4434, 0xcb639d51, 0x0b07b546, + 0x4baacd7f, 0x8bcee568, 0xcbd67fb4, 0x0bb257a3, 0x4b1f2f9a, + 0x8b7b078d, 0xcb45dee8, 0x0b21f6ff, 0x4b8c8ec6, 0x8be8a6d1, + 0x8abacba4, 0x4adee3b3, 0x0a739b8a, 0xca17b39d, 0x8a296af8, + 0x4a4d42ef, 0x0ae03ad6, 0xca8412c1, 0x8a9c881d, 0x4af8a00a, + 0x0a55d833, 0xca31f024, 0x8a0f2941, 0x4a6b0156, 0x0ac6796f, + 0xcaa25178}, + {0x00000000, 0xd4ea739b, 0xe9d396ed, 0x3d39e576, 0x93a15c00, + 0x474b2f9b, 0x7a72caed, 0xae98b976, 0x2643b900, 0xf2a9ca9b, + 0xcf902fed, 0x1b7a5c76, 0xb5e2e500, 0x6108969b, 0x5c3173ed, + 0x88db0076, 0x4c867201, 0x986c019a, 0xa555e4ec, 0x71bf9777, + 0xdf272e01, 0x0bcd5d9a, 0x36f4b8ec, 0xe21ecb77, 0x6ac5cb01, + 0xbe2fb89a, 0x83165dec, 0x57fc2e77, 0xf9649701, 0x2d8ee49a, + 0x10b701ec, 0xc45d7277, 0x980ce502, 0x4ce69699, 0x71df73ef, + 0xa5350074, 0x0badb902, 0xdf47ca99, 0xe27e2fef, 0x36945c74, + 0xbe4f5c02, 0x6aa52f99, 0x579ccaef, 0x8376b974, 0x2dee0002, + 0xf9047399, 0xc43d96ef, 0x10d7e574, 0xd48a9703, 0x0060e498, + 0x3d5901ee, 0xe9b37275, 0x472bcb03, 0x93c1b898, 0xaef85dee, + 0x7a122e75, 0xf2c92e03, 0x26235d98, 0x1b1ab8ee, 0xcff0cb75, + 0x61687203, 0xb5820198, 0x88bbe4ee, 0x5c519775, 0x3019ca05, + 0xe4f3b99e, 0xd9ca5ce8, 0x0d202f73, 0xa3b89605, 0x7752e59e, + 0x4a6b00e8, 0x9e817373, 0x165a7305, 0xc2b0009e, 0xff89e5e8, + 0x2b639673, 0x85fb2f05, 0x51115c9e, 0x6c28b9e8, 0xb8c2ca73, + 0x7c9fb804, 0xa875cb9f, 0x954c2ee9, 0x41a65d72, 0xef3ee404, + 0x3bd4979f, 0x06ed72e9, 0xd2070172, 0x5adc0104, 0x8e36729f, + 0xb30f97e9, 0x67e5e472, 0xc97d5d04, 0x1d972e9f, 0x20aecbe9, + 0xf444b872, 0xa8152f07, 0x7cff5c9c, 0x41c6b9ea, 0x952cca71, + 0x3bb47307, 0xef5e009c, 0xd267e5ea, 0x068d9671, 0x8e569607, + 0x5abce59c, 0x678500ea, 0xb36f7371, 0x1df7ca07, 0xc91db99c, + 0xf4245cea, 0x20ce2f71, 0xe4935d06, 0x30792e9d, 0x0d40cbeb, + 0xd9aab870, 0x77320106, 0xa3d8729d, 0x9ee197eb, 0x4a0be470, + 0xc2d0e406, 0x163a979d, 0x2b0372eb, 0xffe90170, 0x5171b806, + 0x859bcb9d, 0xb8a22eeb, 0x6c485d70, 0x6032940b, 0xb4d8e790, + 0x89e102e6, 0x5d0b717d, 0xf393c80b, 0x2779bb90, 0x1a405ee6, + 0xceaa2d7d, 0x46712d0b, 0x929b5e90, 0xafa2bbe6, 0x7b48c87d, + 0xd5d0710b, 0x013a0290, 0x3c03e7e6, 0xe8e9947d, 0x2cb4e60a, + 0xf85e9591, 0xc56770e7, 0x118d037c, 0xbf15ba0a, 0x6bffc991, + 0x56c62ce7, 0x822c5f7c, 0x0af75f0a, 0xde1d2c91, 0xe324c9e7, + 0x37ceba7c, 0x9956030a, 0x4dbc7091, 0x708595e7, 0xa46fe67c, + 0xf83e7109, 0x2cd40292, 0x11ede7e4, 0xc507947f, 0x6b9f2d09, + 0xbf755e92, 0x824cbbe4, 0x56a6c87f, 0xde7dc809, 0x0a97bb92, + 0x37ae5ee4, 0xe3442d7f, 0x4ddc9409, 0x9936e792, 0xa40f02e4, + 0x70e5717f, 0xb4b80308, 0x60527093, 0x5d6b95e5, 0x8981e67e, + 0x27195f08, 0xf3f32c93, 0xcecac9e5, 0x1a20ba7e, 0x92fbba08, + 0x4611c993, 0x7b282ce5, 0xafc25f7e, 0x015ae608, 0xd5b09593, + 0xe88970e5, 0x3c63037e, 0x502b5e0e, 0x84c12d95, 0xb9f8c8e3, + 0x6d12bb78, 0xc38a020e, 0x17607195, 0x2a5994e3, 0xfeb3e778, + 0x7668e70e, 0xa2829495, 0x9fbb71e3, 0x4b510278, 0xe5c9bb0e, + 0x3123c895, 0x0c1a2de3, 0xd8f05e78, 0x1cad2c0f, 0xc8475f94, + 0xf57ebae2, 0x2194c979, 0x8f0c700f, 0x5be60394, 0x66dfe6e2, + 0xb2359579, 0x3aee950f, 0xee04e694, 0xd33d03e2, 0x07d77079, + 0xa94fc90f, 0x7da5ba94, 0x409c5fe2, 0x94762c79, 0xc827bb0c, + 0x1ccdc897, 0x21f42de1, 0xf51e5e7a, 0x5b86e70c, 0x8f6c9497, + 0xb25571e1, 0x66bf027a, 0xee64020c, 0x3a8e7197, 0x07b794e1, + 0xd35de77a, 0x7dc55e0c, 0xa92f2d97, 0x9416c8e1, 0x40fcbb7a, + 0x84a1c90d, 0x504bba96, 0x6d725fe0, 0xb9982c7b, 0x1700950d, + 0xc3eae696, 0xfed303e0, 0x2a39707b, 0xa2e2700d, 0x76080396, + 0x4b31e6e0, 0x9fdb957b, 0x31432c0d, 0xe5a95f96, 0xd890bae0, + 0x0c7ac97b}, + {0x00000000, 0x27652581, 0x0fcc3bd9, 0x28a91e58, 0x5f9e0669, + 0x78fb23e8, 0x50523db0, 0x77371831, 0xbe3c0dd2, 0x99592853, + 0xb1f0360b, 0x9695138a, 0xe1a20bbb, 0xc6c72e3a, 0xee6e3062, + 0xc90b15e3, 0x3d7f6b7f, 0x1a1a4efe, 0x32b350a6, 0x15d67527, + 0x62e16d16, 0x45844897, 0x6d2d56cf, 0x4a48734e, 0x834366ad, + 0xa426432c, 0x8c8f5d74, 0xabea78f5, 0xdcdd60c4, 0xfbb84545, + 0xd3115b1d, 0xf4747e9c, 0x7afed6fe, 0x5d9bf37f, 0x7532ed27, + 0x5257c8a6, 0x2560d097, 0x0205f516, 0x2aaceb4e, 0x0dc9cecf, + 0xc4c2db2c, 0xe3a7fead, 0xcb0ee0f5, 0xec6bc574, 0x9b5cdd45, + 0xbc39f8c4, 0x9490e69c, 0xb3f5c31d, 0x4781bd81, 0x60e49800, + 0x484d8658, 0x6f28a3d9, 0x181fbbe8, 0x3f7a9e69, 0x17d38031, + 0x30b6a5b0, 0xf9bdb053, 0xded895d2, 0xf6718b8a, 0xd114ae0b, + 0xa623b63a, 0x814693bb, 0xa9ef8de3, 0x8e8aa862, 0xb5fadc26, + 0x929ff9a7, 0xba36e7ff, 0x9d53c27e, 0xea64da4f, 0xcd01ffce, + 0xe5a8e196, 0xc2cdc417, 0x0bc6d1f4, 0x2ca3f475, 0x040aea2d, + 0x236fcfac, 0x5458d79d, 0x733df21c, 0x5b94ec44, 0x7cf1c9c5, + 0x8885b759, 0xafe092d8, 0x87498c80, 0xa02ca901, 0xd71bb130, + 0xf07e94b1, 0xd8d78ae9, 0xffb2af68, 0x36b9ba8b, 0x11dc9f0a, + 0x39758152, 0x1e10a4d3, 0x6927bce2, 0x4e429963, 0x66eb873b, + 0x418ea2ba, 0xcf040ad8, 0xe8612f59, 0xc0c83101, 0xe7ad1480, + 0x909a0cb1, 0xb7ff2930, 0x9f563768, 0xb83312e9, 0x7138070a, + 0x565d228b, 0x7ef43cd3, 0x59911952, 0x2ea60163, 0x09c324e2, + 0x216a3aba, 0x060f1f3b, 0xf27b61a7, 0xd51e4426, 0xfdb75a7e, + 0xdad27fff, 0xade567ce, 0x8a80424f, 0xa2295c17, 0x854c7996, + 0x4c476c75, 0x6b2249f4, 0x438b57ac, 0x64ee722d, 0x13d96a1c, + 0x34bc4f9d, 0x1c1551c5, 0x3b707444, 0x6af5b94d, 0x4d909ccc, + 0x65398294, 0x425ca715, 0x356bbf24, 0x120e9aa5, 0x3aa784fd, + 0x1dc2a17c, 0xd4c9b49f, 0xf3ac911e, 0xdb058f46, 0xfc60aac7, + 0x8b57b2f6, 0xac329777, 0x849b892f, 0xa3feacae, 0x578ad232, + 0x70eff7b3, 0x5846e9eb, 0x7f23cc6a, 0x0814d45b, 0x2f71f1da, + 0x07d8ef82, 0x20bdca03, 0xe9b6dfe0, 0xced3fa61, 0xe67ae439, + 0xc11fc1b8, 0xb628d989, 0x914dfc08, 0xb9e4e250, 0x9e81c7d1, + 0x100b6fb3, 0x376e4a32, 0x1fc7546a, 0x38a271eb, 0x4f9569da, + 0x68f04c5b, 0x40595203, 0x673c7782, 0xae376261, 0x895247e0, + 0xa1fb59b8, 0x869e7c39, 0xf1a96408, 0xd6cc4189, 0xfe655fd1, + 0xd9007a50, 0x2d7404cc, 0x0a11214d, 0x22b83f15, 0x05dd1a94, + 0x72ea02a5, 0x558f2724, 0x7d26397c, 0x5a431cfd, 0x9348091e, + 0xb42d2c9f, 0x9c8432c7, 0xbbe11746, 0xccd60f77, 0xebb32af6, + 0xc31a34ae, 0xe47f112f, 0xdf0f656b, 0xf86a40ea, 0xd0c35eb2, + 0xf7a67b33, 0x80916302, 0xa7f44683, 0x8f5d58db, 0xa8387d5a, + 0x613368b9, 0x46564d38, 0x6eff5360, 0x499a76e1, 0x3ead6ed0, + 0x19c84b51, 0x31615509, 0x16047088, 0xe2700e14, 0xc5152b95, + 0xedbc35cd, 0xcad9104c, 0xbdee087d, 0x9a8b2dfc, 0xb22233a4, + 0x95471625, 0x5c4c03c6, 0x7b292647, 0x5380381f, 0x74e51d9e, + 0x03d205af, 0x24b7202e, 0x0c1e3e76, 0x2b7b1bf7, 0xa5f1b395, + 0x82949614, 0xaa3d884c, 0x8d58adcd, 0xfa6fb5fc, 0xdd0a907d, + 0xf5a38e25, 0xd2c6aba4, 0x1bcdbe47, 0x3ca89bc6, 0x1401859e, + 0x3364a01f, 0x4453b82e, 0x63369daf, 0x4b9f83f7, 0x6cfaa676, + 0x988ed8ea, 0xbfebfd6b, 0x9742e333, 0xb027c6b2, 0xc710de83, + 0xe075fb02, 0xc8dce55a, 0xefb9c0db, 0x26b2d538, 0x01d7f0b9, + 0x297eeee1, 0x0e1bcb60, 0x792cd351, 0x5e49f6d0, 0x76e0e888, + 0x5185cd09}}; + +#endif + +#endif + +#endif + +local const z_crc_t FAR x2n_table[] = { + 0x40000000, 0x20000000, 0x08000000, 0x00800000, 0x00008000, + 0xedb88320, 0xb1e6b092, 0xa06a2517, 0xed627dae, 0x88d14467, + 0xd7bbfe6a, 0xec447f11, 0x8e7ea170, 0x6427800e, 0x4d47bae0, + 0x09fe548f, 0x83852d0f, 0x30362f1a, 0x7b5a9cc3, 0x31fec169, + 0x9fec022a, 0x6c8dedc4, 0x15d6874d, 0x5fde7a4e, 0xbad90e37, + 0x2e4e5eef, 0x4eaba214, 0xa8a472c0, 0x429a969e, 0x148d302a, + 0xc40ba6d0, 0xc4e22c3c}; diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc_folding.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc_folding.c index 4b7e954d3dce98..1bbbc642e13f07 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc_folding.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/crc_folding.c @@ -339,11 +339,8 @@ ZLIB_INTERNAL void crc_fold_copy(unsigned crc[4 * 5], xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t1); xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t2); - if (len == 0) - goto done; - + src += 48; dst += 48; - xmm_crc_part = _mm_load_si128((__m128i *)src + 3); } else if (len + 32 >= 0) { len += 32; @@ -358,11 +355,8 @@ ZLIB_INTERNAL void crc_fold_copy(unsigned crc[4 * 5], xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t0); xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t1); - if (len == 0) - goto done; - + src += 32; dst += 32; - xmm_crc_part = _mm_load_si128((__m128i *)src + 2); } else if (len + 48 >= 0) { len += 48; @@ -374,19 +368,17 @@ ZLIB_INTERNAL void crc_fold_copy(unsigned crc[4 * 5], xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t0); - if (len == 0) - goto done; - + src += 16; dst += 16; - xmm_crc_part = _mm_load_si128((__m128i *)src + 1); } else { len += 64; - if (len == 0) - goto done; - xmm_crc_part = _mm_load_si128((__m128i *)src); } - _mm_storeu_si128((__m128i *)partial_buf, xmm_crc_part); + if (len == 0) + goto done; + + memcpy(partial_buf, src, len); + xmm_crc_part = _mm_load_si128((__m128i *)partial_buf); memcpy(dst, partial_buf, len); partial: diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate.c index b5e7849d0023ca..bd5e95774a689a 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.11.1 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -88,6 +88,7 @@ local block_state deflate_huff OF((deflate_state *s, int flush)); local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +ZLIB_INTERNAL void fill_window(deflate_state *s); /* =========================================================================== @@ -154,6 +155,27 @@ local const config configuration_table[10] = { /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ #define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0)) +/* =========================================================================== + * Insert string str in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * If this file is compiled with -DFASTEST, the compression level is forced + * to 1, and no hash chains are maintained. + * IN assertion: all calls to INSERT_STRING are made with consecutive input + * characters and the first MIN_MATCH bytes of str are valid (except for + * the last MIN_MATCH-1 bytes of the input file). + */ +#ifdef FASTEST +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#else +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#endif /* =========================================================================== * Initialize the hash table (avoiding 64K overflow for 16 bit systems). @@ -161,9 +183,9 @@ local const config configuration_table[10] = { */ #define CLEAR_HASH(s) \ do { \ - s->head[s->hash_size-1] = NIL; \ + s->head[s->hash_size - 1] = NIL; \ zmemzero((Bytef *)s->head, \ - (unsigned)(s->hash_size-1)*sizeof(*s->head)); \ + (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \ } while (0) /* =========================================================================== @@ -237,11 +259,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, int wrap = 1; static const char my_version[] = ZLIB_VERSION; - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { return Z_VERSION_ERROR; @@ -276,6 +293,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; + if (windowBits < -15) + return Z_STREAM_ERROR; windowBits = -windowBits; } #ifdef GZIP @@ -310,7 +329,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->hash_bits = (uInt)memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH); #if defined(USE_PCLMUL_CRC) window_padding = 8; @@ -324,9 +343,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + /* We overlay pending_buf and sym_buf. This works since the average size + * for length/distance pairs over any compressed block is assured to be 31 + * bits or less. + * + * Analysis: The longest fixed codes are a length code of 8 bits plus 5 + * extra bits, for lengths 131 to 257. The longest fixed distance codes are + * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest + * possible fixed-codes length/distance pair is then 31 bits total. + * + * sym_buf starts one-fourth of the way into pending_buf. So there are + * three bytes in sym_buf for every four bytes in pending_buf. Each symbol + * in sym_buf is three bytes -- two for the distance and one for the + * literal/length. As each symbol is consumed, the pointer to the next + * sym_buf value to read moves forward three bytes. From that symbol, up to + * 31 bits are written to pending_buf. The closest the written pending_buf + * bits gets to the next sym_buf symbol to read is just before the last + * code is written. At that time, 31*(n - 2) bits have been written, just + * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at + * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1 + * symbols are written.) The closest the writing gets to what is unread is + * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and + * can range from 128 to 32768. + * + * Therefore, at a minimum, there are 142 bits of space between what is + * written and what is read in the overlain buffers, so the symbols cannot + * be overwritten by the compressed data. That space is actually 139 bits, + * due to the three-bit fixed-code block header. + * + * That covers the case where either Z_FIXED is specified, forcing fixed + * codes, or when the use of fixed codes is chosen, because that choice + * results in a smaller compressed block than dynamic codes. That latter + * condition then assures that the above analysis also covers all dynamic + * blocks. A dynamic-code block will only be chosen to be emitted if it has + * fewer bits than a fixed-code block would for the same set of symbols. + * Therefore its average symbol length is assured to be less than 31. So + * the compressed data for a dynamic block also cannot overwrite the + * symbols from which it is being constructed. + */ + + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { @@ -335,8 +392,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, deflateEnd (strm); return Z_MEM_ERROR; } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + s->sym_buf = s->pending_buf + s->lit_bufsize; + s->sym_end = (s->lit_bufsize - 1) * 3; + /* We avoid equality with lit_bufsize*3 because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ s->level = level; s->strategy = strategy; @@ -348,7 +409,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, /* ========================================================================= * Check for a valid deflate stream state. Return 0 if ok, 1 if not. */ -local int deflateStateCheck (strm) +local int deflateStateCheck(strm) z_streamp strm; { deflate_state *s; @@ -371,7 +432,7 @@ local int deflateStateCheck (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; @@ -440,7 +501,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength) z_streamp strm; Bytef *dictionary; uInt *dictLength; @@ -462,7 +523,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateResetKeep (strm) +int ZEXPORT deflateResetKeep(strm) z_streamp strm; { deflate_state *s; @@ -506,7 +567,7 @@ int ZEXPORT deflateResetKeep (strm) } /* ========================================================================= */ -int ZEXPORT deflateReset (strm) +int ZEXPORT deflateReset(strm) z_streamp strm; { int ret; @@ -518,7 +579,7 @@ int ZEXPORT deflateReset (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) +int ZEXPORT deflateSetHeader(strm, head) z_streamp strm; gz_headerp head; { @@ -529,7 +590,7 @@ int ZEXPORT deflateSetHeader (strm, head) } /* ========================================================================= */ -int ZEXPORT deflatePending (strm, pending, bits) +int ZEXPORT deflatePending(strm, pending, bits) unsigned *pending; int *bits; z_streamp strm; @@ -543,7 +604,7 @@ int ZEXPORT deflatePending (strm, pending, bits) } /* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) +int ZEXPORT deflatePrime(strm, bits, value) z_streamp strm; int bits; int value; @@ -553,7 +614,8 @@ int ZEXPORT deflatePrime (strm, bits, value) if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; - if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) + if (bits < 0 || bits > 16 || + s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; do { put = Buf_size - s->bi_valid; @@ -637,36 +699,50 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) } /* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. + * For the default windowBits of 15 and memLevel of 8, this function returns a + * close to exact, as well as small, upper bound on the compressed size. This + * is an expansion of ~0.03%, plus a small constant. + * + * For any setting other than those defaults for windowBits and memLevel, one + * of two worst case bounds is returned. This is at most an expansion of ~4% or + * ~13%, plus a small constant. * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. + * Both the 0.03% and 4% derive from the overhead of stored blocks. The first + * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second + * is for stored blocks of 127 bytes (the worst case memLevel == 1). The + * expansion results from five bytes of header for each stored block. * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. + * The larger expansion of 13% results from a window size less than or equal to + * the symbols buffer size (windowBits <= memLevel + 7). In that case some of + * the data being compressed may have slid out of the sliding window, impeding + * a stored block from being emitted. Then the only choice is a fixed or + * dynamic block, where a fixed block limits the maximum expansion to 9 bits + * per 8-bit byte, plus 10 bits for every block. The smallest block size for + * which this can occur is 255 (memLevel == 2). + * + * Shifts are used to approximate divisions, for speed. */ uLong ZEXPORT deflateBound(strm, sourceLen) z_streamp strm; uLong sourceLen; { deflate_state *s; - uLong complen, wraplen; + uLong fixedlen, storelen, wraplen; + + /* upper bound for fixed blocks with 9-bit literals and length 255 + (memLevel == 2, which is the lowest that may not use stored blocks) -- + ~13% overhead plus a small constant */ + fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) + + (sourceLen >> 9) + 4; - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + /* upper bound for stored blocks with length 127 (memLevel == 1) -- + ~4% overhead plus a small constant */ + storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) + + (sourceLen >> 11) + 7; - /* if can't get parameters, return conservative bound plus zlib wrapper */ + /* if can't get parameters, return larger bound plus a zlib wrapper */ if (deflateStateCheck(strm)) - return complen + 6; + return (fixedlen > storelen ? fixedlen : storelen) + 6; /* compute wrapper length */ s = strm->state; @@ -703,11 +779,12 @@ uLong ZEXPORT deflateBound(strm, sourceLen) wraplen = 6; } - /* if not default parameters, return conservative bound */ + /* if not default parameters, return one of the conservative bounds */ if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; + return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen; - /* default settings: return tight bound for that case */ + /* default settings: return tight bound for that case -- ~0.03% overhead + plus a small constant */ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; } @@ -717,7 +794,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ -local void putShortMSB (s, b) +local void putShortMSB(s, b) deflate_state *s; uInt b; { @@ -764,7 +841,7 @@ ZLIB_INTERNAL void flush_pending(strm) } while (0) /* ========================================================================= */ -int ZEXPORT deflate (strm, flush) +int ZEXPORT deflate(strm, flush) z_streamp strm; int flush; { @@ -819,7 +896,7 @@ int ZEXPORT deflate (strm, flush) s->status = BUSY_STATE; if (s->status == INIT_STATE) { /* zlib header */ - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) @@ -1090,7 +1167,7 @@ int ZEXPORT deflate (strm, flush) } /* ========================================================================= */ -int ZEXPORT deflateEnd (strm) +int ZEXPORT deflateEnd(strm) z_streamp strm; { int status; @@ -1116,7 +1193,7 @@ int ZEXPORT deflateEnd (strm) * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ -int ZEXPORT deflateCopy (dest, source) +int ZEXPORT deflateCopy(dest, source) z_streamp dest; z_streamp source; { @@ -1125,7 +1202,6 @@ int ZEXPORT deflateCopy (dest, source) #else deflate_state *ds; deflate_state *ss; - ushf *overlay; if (deflateStateCheck(source) || dest == Z_NULL) { @@ -1145,8 +1221,7 @@ int ZEXPORT deflateCopy (dest, source) ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1160,8 +1235,7 @@ int ZEXPORT deflateCopy (dest, source) zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + ds->sym_buf = ds->pending_buf + ds->lit_bufsize; ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1217,7 +1291,7 @@ local unsigned read_buf(strm, buf, size) /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ -local void lm_init (s) +local void lm_init(s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; @@ -1238,11 +1312,6 @@ local void lm_init (s) s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif } #ifdef ZLIB_DEBUG @@ -1269,7 +1338,7 @@ ZLIB_INTERNAL void check_match(s, start, match, length) z_error("invalid match"); } if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); + fprintf(stderr,"\\[%d,%d]", start - match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } @@ -1313,9 +1382,9 @@ ZLIB_INTERNAL void fill_window(s) /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ - if (s->strstart >= wsize+MAX_DIST(s)) { + if (s->strstart >= wsize + MAX_DIST(s)) { - zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more); + zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; @@ -1432,7 +1501,7 @@ ZLIB_INTERNAL void fill_window(s) * * deflate_stored() is written to minimize the number of times an input byte is * copied. It is most efficient with large input and output buffers, which - * maximizes the opportunites to have a single copy from next_in to next_out. + * maximizes the opportunities to have a single copy from next_in to next_out. */ local block_state deflate_stored(s, flush) deflate_state *s; @@ -1642,7 +1711,7 @@ local block_state deflate_fast(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1690,15 +1759,15 @@ local block_state deflate_fast(s, flush) s->strstart += s->match_length; s->match_length = 0; #ifdef USE_CRC_HASH - if (!x86_cpu_has_sse42) + if (!x86_cpu_has_sse42) #endif - { + { s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); + UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif - } + } /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ @@ -1706,7 +1775,7 @@ local block_state deflate_fast(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -1717,7 +1786,7 @@ local block_state deflate_fast(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -1750,7 +1819,7 @@ local block_state deflate_slow(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1792,17 +1861,17 @@ local block_state deflate_slow(s, flush) uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ - check_match(s, s->strstart-1, s->prev_match, s->prev_length); + check_match(s, s->strstart - 1, s->prev_match, s->prev_length); - _tr_tally_dist(s, s->strstart -1 - s->prev_match, + _tr_tally_dist(s, s->strstart - 1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not + * strstart - 1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ - s->lookahead -= s->prev_length-1; + s->lookahead -= s->prev_length - 1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { @@ -1820,8 +1889,8 @@ local block_state deflate_slow(s, flush) * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } @@ -1839,8 +1908,8 @@ local block_state deflate_slow(s, flush) } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); s->match_available = 0; } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; @@ -1848,7 +1917,7 @@ local block_state deflate_slow(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -1897,7 +1966,8 @@ local block_state deflate_rle(s, flush) if (s->match_length > s->lookahead) s->match_length = s->lookahead; } - Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (uInt)(s->window_size - 1), + "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ @@ -1912,7 +1982,7 @@ local block_state deflate_rle(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -1923,7 +1993,7 @@ local block_state deflate_rle(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -1952,7 +2022,7 @@ local block_state deflate_huff(s, flush) /* Output a literal byte */ s->match_length = 0; Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); @@ -1962,7 +2032,7 @@ local block_state deflate_huff(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate.h index 7f31b54252512a..7b1fb826a4f1d3 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate.h @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2016 Jean-loup Gailly + * Copyright (C) 1995-2018 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -230,7 +230,7 @@ typedef struct internal_state { /* Depth of each subtree used as tie breaker for trees of equal frequency */ - uchf *l_buf; /* buffer for literals or lengths */ + uchf *sym_buf; /* buffer for distances and literals/lengths */ uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -252,13 +252,8 @@ typedef struct internal_state { * - I can't count above 4 */ - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ + uInt sym_next; /* running index in sym_buf */ + uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ @@ -344,20 +339,22 @@ void ZLIB_INTERNAL bi_windup OF((deflate_state *s)); # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ + s->sym_buf[s->sym_next++] = 0; \ + s->sym_buf[s->sym_next++] = 0; \ + s->sym_buf[s->sym_next++] = cc; \ s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ + flush = (s->sym_next == s->sym_end); \ } # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (uch)(length); \ ush dist = (ush)(distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ + s->sym_buf[s->sym_next++] = (uch)dist; \ + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \ + s->sym_buf[s->sym_next++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ + flush = (s->sym_next == s->sym_end); \ } #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate_medium.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate_medium.c index 1b10b5fe5ae73f..0ad739a679e7a9 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate_medium.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate_medium.c @@ -164,6 +164,10 @@ static void fizzle_matches(deflate_state *s, struct match *current, struct match match--; orig--; changed ++; + + /* Make sure to avoid an out-of-bounds read on the next iteration */ + if (match < s->window || orig < s->window) + break; } if (!changed) @@ -249,7 +253,7 @@ block_state deflate_medium(deflate_state *s, int flush) insert_match(s, current_match); /* now, look ahead one */ - if (s->lookahead > MIN_LOOKAHEAD) { + if (s->lookahead - current_match.match_length > MIN_LOOKAHEAD) { s->strstart = current_match.strstart + current_match.match_length; INSERT_STRING(s, s->strstart, hash_head); @@ -305,7 +309,7 @@ block_state deflate_medium(deflate_state *s, int flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate_quick.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate_quick.c index 13815281bec8d8..1a6e4f89810bbb 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate_quick.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/deflate_quick.c @@ -44,7 +44,7 @@ local inline long compare258(z_const unsigned char *z_const src0, "cmp $256 + 16, %[ax]\n\t" "jb 1b\n\t" -#ifdef TARGET_X86 +#ifdef X86 "movzwl -16(%[src0], %[ax]), %[dx]\n\t" #else "movzwq -16(%[src0], %[ax]), %[dx]\n\t" diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/gzguts.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/gzguts.h index 6378d468a258b1..57faf37165a354 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/gzguts.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler + * Copyright (C) 2004-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -190,6 +190,7 @@ typedef struct { /* just for writing */ int level; /* compression level */ int strategy; /* compression strategy */ + int reset; /* true if a reset is pending after a Z_FINISH */ /* seek request */ z_off64_t skip; /* amount to skip (already rewound if backwards) */ int seek; /* true if seek request pending */ diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inflate.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inflate.c index 4a2a217a3e62a6..96306ef76570b7 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inflate.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inflate.c @@ -1,5 +1,5 @@ /* inflate.c -- zlib decompression - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -130,6 +130,7 @@ z_streamp strm; state->mode = HEAD; state->last = 0; state->havedict = 0; + state->flags = -1; state->dmax = 32768U; state->head = Z_NULL; state->hold = 0; @@ -166,6 +167,8 @@ int windowBits; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { + if (windowBits < -15) + return Z_STREAM_ERROR; wrap = 0; windowBits = -windowBits; } @@ -469,10 +472,10 @@ unsigned copy; /* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP -# define UPDATE(check, buf, len) \ +# define UPDATE_CHECK(check, buf, len) \ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) #else -# define UPDATE(check, buf, len) adler32(check, buf, len) +# define UPDATE_CHECK(check, buf, len) adler32(check, buf, len) #endif /* check macros for header crc */ @@ -692,7 +695,6 @@ int flush; state->mode = FLAGS; break; } - state->flags = 0; /* expect zlib header */ if (state->head != Z_NULL) state->head->done = -1; if (!(state->wrap & 1) || /* check if zlib header allowed */ @@ -730,6 +732,7 @@ int flush; LOAD(); } state->dmax = 1U << len; + state->flags = 0; /* indicate zlib header */ Tracev((stderr, "inflate: zlib header ok\n")); strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = hold & 0x200 ? DICTID : TYPE; @@ -755,6 +758,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = TIME; + /* fallthrough */ case TIME: NEEDBITS(32); if (state->head != Z_NULL) @@ -763,6 +767,7 @@ int flush; CRC4(state->check, hold); INITBITS(); state->mode = OS; + /* fallthrough */ case OS: NEEDBITS(16); if (state->head != Z_NULL) { @@ -773,6 +778,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; + /* fallthrough */ case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); @@ -786,14 +792,16 @@ int flush; else if (state->head != Z_NULL) state->head->extra = Z_NULL; state->mode = EXTRA; + /* fallthrough */ case EXTRA: if (state->flags & 0x0400) { copy = state->length; if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); @@ -808,6 +816,7 @@ int flush; } state->length = 0; state->mode = NAME; + /* fallthrough */ case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; @@ -829,6 +838,7 @@ int flush; state->head->name = Z_NULL; state->length = 0; state->mode = COMMENT; + /* fallthrough */ case COMMENT: if (state->flags & 0x1000) { if (have == 0) goto inf_leave; @@ -849,6 +859,7 @@ int flush; else if (state->head != Z_NULL) state->head->comment = Z_NULL; state->mode = HCRC; + /* fallthrough */ case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); @@ -876,6 +887,7 @@ int flush; strm->adler = state->check = ZSWAP32(hold); INITBITS(); state->mode = DICT; + /* fallthrough */ case DICT: if (state->havedict == 0) { RESTORE(); @@ -883,8 +895,10 @@ int flush; } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; + /* fallthrough */ case TYPE: if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + /* fallthrough */ case TYPEDO: if (state->last) { BYTEBITS(); @@ -935,8 +949,10 @@ int flush; INITBITS(); state->mode = COPY_; if (flush == Z_TREES) goto inf_leave; + /* fallthrough */ case COPY_: state->mode = COPY; + /* fallthrough */ case COPY: copy = state->length; if (copy) { @@ -982,6 +998,7 @@ int flush; Tracev((stderr, "inflate: table sizes ok\n")); state->have = 0; state->mode = LENLENS; + /* fallthrough */ case LENLENS: while (state->have < state->ncode) { NEEDBITS(3); @@ -1003,6 +1020,7 @@ int flush; Tracev((stderr, "inflate: code lengths ok\n")); state->have = 0; state->mode = CODELENS; + /* fallthrough */ case CODELENS: while (state->have < state->nlen + state->ndist) { for (;;) { @@ -1086,8 +1104,10 @@ int flush; Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN_; if (flush == Z_TREES) goto inf_leave; + /* fallthrough */ case LEN_: state->mode = LEN; + /* fallthrough */ case LEN: if (have >= 6 && left >= 258) { RESTORE(); @@ -1137,6 +1157,7 @@ int flush; } state->extra = (unsigned)(here.op) & 15; state->mode = LENEXT; + /* fallthrough */ case LENEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1147,6 +1168,7 @@ int flush; Tracevv((stderr, "inflate: length %u\n", state->length)); state->was = state->length; state->mode = DIST; + /* fallthrough */ case DIST: for (;;) { here = state->distcode[BITS(state->distbits)]; @@ -1174,6 +1196,7 @@ int flush; state->offset = (unsigned)here.val; state->extra = (unsigned)(here.op) & 15; state->mode = DISTEXT; + /* fallthrough */ case DISTEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1190,6 +1213,7 @@ int flush; #endif Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; + /* fallthrough */ case MATCH: { unsigned char *end = state->window + (state->wsize * 4); unsigned buf_left = (unsigned)(end - put); @@ -1203,7 +1227,7 @@ int flush; LOAD(); buf_left = (unsigned)(end - put); } - if (copy > buf_left) copy = buf_left; + if (copy > buf_left) copy = buf_left; } if (copy == 0) goto inf_leave; @@ -1261,7 +1285,7 @@ int flush; out = left; #ifdef USE_PCLMUL_CRC - if ((state->wrap) & 2 && x86_cpu_has_pclmul) + if (state->flags > 0 && x86_cpu_has_pclmul) strm->adler = state->check = crc_fold_512to32(state->crc); #endif @@ -1279,10 +1303,11 @@ int flush; } #ifdef GUNZIP state->mode = LENGTH; + /* fallthrough */ case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { + if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) { strm->msg = (char *)"incorrect length check"; state->mode = BAD; break; @@ -1292,6 +1317,7 @@ int flush; } #endif state->mode = DONE; + /* fallthrough */ case DONE: ret = Z_STREAM_END; goto inf_leave; @@ -1301,6 +1327,7 @@ int flush; case MEM: return Z_MEM_ERROR; case SYNC: + /* fallthrough */ default: return Z_STREAM_ERROR; } @@ -1474,6 +1501,7 @@ int ZEXPORT inflateSync(strm) z_streamp strm; { unsigned len; /* number of bytes to look at or looked at */ + int flags; /* temporary to save header status */ unsigned long in, out; /* temporary to save total_in and total_out */ unsigned char buf[4]; /* to restore bit buffer to byte string */ struct inflate_state FAR *state; @@ -1506,11 +1534,15 @@ z_streamp strm; /* return no joy or set up to restart inflate() on a new block */ if (state->have != 4) return Z_DATA_ERROR; - if (state->mode == HEAD) - state->wrap = 0; /* never processed header, so assume raw */ + if (state->flags == -1) + state->wrap = 0; /* if no header yet, treat as raw */ + else + state->wrap &= ~4; /* no point in computing a check value now */ + flags = state->flags; in = strm->total_in; out = strm->total_out; inflateReset(strm); strm->total_in = in; strm->total_out = out; + state->flags = flags; state->mode = TYPE; return Z_OK; } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inflate.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inflate.h index d961a3809f2d11..a7bc6246c77970 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inflate.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inflate.h @@ -1,5 +1,5 @@ /* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -89,7 +89,8 @@ struct inflate_state { int wrap; /* bit 0 true for zlib, bit 1 true for gzip, bit 2 true to validate check value */ int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ + int flags; /* gzip header method and flags, 0 if zlib, or + -1 if raw or no header yet */ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ unsigned long check; /* protected copy of check value */ unsigned long total; /* protected copy of output count */ @@ -137,7 +138,7 @@ static inline void inf_crc_copy(z_streamp strm, unsigned char FAR *const dst, struct inflate_state *const state = (struct inflate_state *const)strm->state; #if !defined(NO_GZIP) && defined(USE_PCLMUL_CRC) - if ((state->wrap & 2) && x86_cpu_has_pclmul) { + if (state->flags > 0 && x86_cpu_has_pclmul) { crc_fold_copy(state->crc, dst, src, len); return; } @@ -146,11 +147,11 @@ static inline void inf_crc_copy(z_streamp strm, unsigned char FAR *const dst, zmemcpy(dst, src, len); #if !defined(NO_GZIP) - if ((state->wrap & 2)) + if (state->flags > 0) strm->adler = state->check = crc32(state->check, dst, len); else #endif - if ((state->wrap & 1)) + if (state->flags == 0) strm->adler = state->check = adler32(state->check, dst, len); } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inftrees.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inftrees.c index cd583f5578c0c7..57d2793bec931f 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inftrees.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2017 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.11.1 Copyright 1995-2017 Mark Adler "; + " inflate 1.2.13 Copyright 1995-2022 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -62,7 +62,7 @@ unsigned short FAR *work; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 196}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, @@ -87,7 +87,7 @@ unsigned short FAR *work; This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that the + 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inftrees.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inftrees.h index baa53a0b1a199c..f53665311c1624 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inftrees.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/inftrees.h @@ -38,7 +38,7 @@ typedef struct { /* Maximum size of the dynamic table. The maximum number of code structures is 1444, which is the sum of 852 for literal/length codes and 592 for distance codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that + examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes returns returns 852, and "enough 30 6 15" for distance codes returns 592. diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/match.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/match.c index bd8603f8caa7e0..6205d35454b8f4 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/match.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/match.c @@ -26,7 +26,7 @@ uInt longest_match(deflate_state *z_const s, IPos cur_match) #endif } -local uInt std1_longest_match(deflate_state *z_const s, IPos cur_match) +local inline uInt std1_longest_match(deflate_state *z_const s, IPos cur_match) { unsigned chain_length = s->max_chain_length;/* max hash chain length */ register Bytef *scan = s->window + s->strstart; /* current string */ @@ -118,7 +118,7 @@ local uInt std1_longest_match(deflate_state *z_const s, IPos cur_match) return s->lookahead; } -local __forceinline uInt std2_longest_match(deflate_state *z_const s, IPos cur_match) +local zalways_inline uInt std2_longest_match(deflate_state *z_const s, IPos cur_match) { z_const Posf *prev = s->prev; z_const uInt wmask = s->w_mask; @@ -186,7 +186,7 @@ local __forceinline uInt std2_longest_match(deflate_state *z_const s, IPos cur_m * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); - if (scan[2] != match[2]) continue; + if (scan[2] != match[2]) continue; scan++, match++; do { } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && @@ -216,7 +216,7 @@ local __forceinline uInt std2_longest_match(deflate_state *z_const s, IPos cur_m return s->lookahead; } -local uInt fastest_longest_match(deflate_state *z_const s, IPos cur_match) +local inline uInt fastest_longest_match(deflate_state *z_const s, IPos cur_match) { register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/trees.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/trees.c index 7480efc694d331..35462a1313aa83 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/trees.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2017 Jean-loup Gailly + * Copyright (C) 1995-2021 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -153,6 +153,75 @@ local void bi_flush OF((deflate_state *s)); local void gen_trees_header OF((void)); #endif +#ifndef ZLIB_DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* !ZLIB_DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef ZLIB_DEBUG +local void send_bits OF((deflate_state *s, int value, int length)); + +local void send_bits(s, value, length) + deflate_state *s; + int value; /* value to send */ + int length; /* number of bits */ +{ + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16 - bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (ush)value << s->bi_valid; + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= (ush)value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !ZLIB_DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = (int)value;\ + s->bi_buf |= (ush)val << s->bi_valid;\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (ush)(value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* ZLIB_DEBUG */ + + +/* the arguments must not have side effects */ + /* =========================================================================== * Initialize the various 'constant' tables. */ @@ -183,7 +252,7 @@ local void tr_static_init() length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { _dist_code[256 + dist++] = (uch)code; } } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); + Assert (dist == 256, "tr_static_init: 256 + dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; @@ -239,7 +308,7 @@ local void tr_static_init() } /* =========================================================================== - * Genererate the file trees.h describing the static trees. + * Generate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H # ifndef ZLIB_DEBUG @@ -248,7 +317,7 @@ local void tr_static_init() # define SEPARATOR(i, last, width) \ ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) + ((i) % (width) == (width) - 1 ? ",\n" : ", ")) void gen_trees_header() { @@ -343,7 +412,7 @@ local void init_block(s) s->dyn_ltree[END_BLOCK].Freq = 1; s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; + s->sym_next = s->matches = 0; } #define SMALLEST 1 @@ -385,7 +454,7 @@ local void pqdownheap(s, tree, k) while (j <= s->heap_len) { /* Set j to the smallest of the two sons: */ if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) { j++; } /* Exit if v is smaller than both sons */ @@ -434,7 +503,7 @@ local void gen_bitlen(s, desc) */ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + for (h = s->heap_max + 1; h < HEAP_SIZE; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len + 1; if (bits > max_length) bits = max_length, overflow++; @@ -445,7 +514,7 @@ local void gen_bitlen(s, desc) s->bl_count[bits]++; xbits = 0; - if (n >= base) xbits = extra[n-base]; + if (n >= base) xbits = extra[n - base]; f = tree[n].Freq; s->opt_len += (ulg)f * (unsigned)(bits + xbits); if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits); @@ -457,10 +526,10 @@ local void gen_bitlen(s, desc) /* Find the first bit length which could increase: */ do { - bits = max_length-1; + bits = max_length - 1; while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */ s->bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] @@ -496,7 +565,7 @@ local void gen_bitlen(s, desc) * OUT assertion: the field code is set for all tree elements of non * zero code length. */ -local void gen_codes (tree, max_code, bl_count) +local void gen_codes(tree, max_code, bl_count) ct_data *tree; /* the tree to decorate */ int max_code; /* largest code with non zero frequency */ ushf *bl_count; /* number of codes at each bit length */ @@ -510,13 +579,13 @@ local void gen_codes (tree, max_code, bl_count) * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { - code = (code + bl_count[bits-1]) << 1; + code = (code + bl_count[bits - 1]) << 1; next_code[bits] = (ush)code; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ - Assert (code + bl_count[MAX_BITS]-1 == (1<heap_len = 0, s->heap_max = HEAP_SIZE; @@ -579,7 +648,7 @@ local void build_tree(s, desc) } desc->max_code = max_code; - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); @@ -627,7 +696,7 @@ local void build_tree(s, desc) * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ -local void scan_tree (s, tree, max_code) +local void scan_tree(s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ @@ -641,10 +710,10 @@ local void scan_tree (s, tree, max_code) int min_count = 4; /* min repeat count */ if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ + tree[max_code + 1].Len = (ush)0xffff; /* guard */ for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; + curlen = nextlen; nextlen = tree[n + 1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { @@ -672,7 +741,7 @@ local void scan_tree (s, tree, max_code) * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ -local void send_tree (s, tree, max_code) +local void send_tree(s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ @@ -685,11 +754,11 @@ local void send_tree (s, tree, max_code) int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ - /* tree[max_code+1].Len = -1; */ /* guard already set */ + /* tree[max_code + 1].Len = -1; */ /* guard already set */ if (nextlen == 0) max_count = 138, min_count = 3; for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; + curlen = nextlen; nextlen = tree[n + 1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { @@ -700,13 +769,13 @@ local void send_tree (s, tree, max_code) send_code(s, curlen, s->bl_tree); count--; } Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2); } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3); } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7); } count = 0; prevlen = curlen; if (nextlen == 0) { @@ -734,8 +803,8 @@ local int build_bl_tree(s) /* Build the bit length tree: */ build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + /* opt_len now includes the length of the tree representations, except the + * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format @@ -746,7 +815,7 @@ local int build_bl_tree(s) if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4; + s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", s->opt_len, s->static_len)); @@ -768,19 +837,19 @@ local void send_all_trees(s, lcodes, dcodes, blcodes) Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); } Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } @@ -793,7 +862,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) ulg stored_len; /* length of input block */ int last; /* one if this is the last block for a file */ { - send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ + send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */ bi_windup(s); /* align on byte boundary */ put_short(s, (ush)stored_len); put_short(s, (ush)~stored_len); @@ -804,7 +873,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; s->bits_sent += 2*16; - s->bits_sent += stored_len<<3; + s->bits_sent += stored_len << 3; #endif } @@ -870,14 +939,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; + opt_lenb = (s->opt_len + 3 + 7) >> 3; + static_lenb = (s->static_len + 3 + 7) >> 3; Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); + s->sym_next / 3)); - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; +#ifndef FORCE_STATIC + if (static_lenb <= opt_lenb || s->strategy == Z_FIXED) +#endif + opt_lenb = static_lenb; } else { Assert(buf != (char*)0, "lost buf"); @@ -887,7 +959,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) #ifdef FORCE_STORED if (buf != (char*)0) { /* force stored block */ #else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { + if (stored_len + 4 <= opt_lenb && buf != (char*)0) { /* 4: two words for the lengths */ #endif /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. @@ -898,21 +970,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) */ _tr_stored_block(s, buf, stored_len, last); -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+last, 3); + } else if (static_lenb == opt_lenb) { + send_bits(s, (STATIC_TREES<<1) + last, 3); compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree); #ifdef ZLIB_DEBUG s->compressed_len += 3 + s->static_len; #endif } else { - send_bits(s, (DYN_TREES<<1)+last, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); + send_bits(s, (DYN_TREES<<1) + last, 3); + send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1, + max_blindex + 1); compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree); #ifdef ZLIB_DEBUG @@ -931,21 +999,22 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) s->compressed_len += 7; /* align on byte boundary */ #endif } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*last)); + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3, + s->compressed_len - 7*last)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ -int ZLIB_INTERNAL _tr_tally (s, dist, lc) +int ZLIB_INTERNAL _tr_tally(s, dist, lc) deflate_state *s; unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ + unsigned lc; /* match length - MIN_MATCH or unmatched char (dist==0) */ { - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; + s->sym_buf[s->sym_next++] = (uch)dist; + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); + s->sym_buf[s->sym_next++] = (uch)lc; if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; @@ -957,33 +1026,10 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_ltree[_length_code[lc] + LITERALS + 1].Freq++; s->dyn_dtree[d_code(dist)].Freq++; } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ + return (s->sym_next == s->sym_end); } /* =========================================================================== @@ -996,20 +1042,21 @@ local void compress_block(s, ltree, dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ + unsigned sx = 0; /* running index in sym_buf */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; + if (s->sym_next != 0) do { + dist = s->sym_buf[sx++] & 0xff; + dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; + lc = s->sym_buf[sx++]; if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ + send_code(s, code + LITERALS + 1, ltree); /* send length code */ extra = extra_lbits[code]; if (extra != 0) { lc -= base_length[code]; @@ -1027,11 +1074,10 @@ local void compress_block(s, ltree, dtree) } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); + /* Check that the overlay between pending_buf and sym_buf is ok: */ + Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); - } while (lx < s->last_lit); + } while (sx < s->sym_next); send_code(s, END_BLOCK, ltree); } @@ -1040,9 +1086,9 @@ local void compress_block(s, ltree, dtree) * Check if the data type is TEXT or BINARY, using the following algorithm: * - TEXT if the two conditions below are satisfied: * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). + * "block list" (0..6, 14..25, 28..31). * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). * - BINARY otherwise. * - The following partially-portable control characters form a * "gray list" that is ignored in this detection algorithm: @@ -1052,19 +1098,19 @@ local void compress_block(s, ltree, dtree) local int detect_data_type(s) deflate_state *s; { - /* black_mask is the bit mask of black-listed bytes + /* block_mask is the bit mask of block-listed bytes * set bits 0..6, 14..25, and 28..31 * 0xf3ffc07f = binary 11110011111111111100000001111111 */ - unsigned long black_mask = 0xf3ffc07fUL; + unsigned long block_mask = 0xf3ffc07fUL; int n; - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>= 1) - if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + /* Check for non-textual ("block-listed") bytes. */ + for (n = 0; n <= 31; n++, block_mask >>= 1) + if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0)) return Z_BINARY; - /* Check for textual ("white-listed") bytes. */ + /* Check for textual ("allow-listed") bytes. */ if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0) return Z_TEXT; @@ -1072,7 +1118,7 @@ local int detect_data_type(s) if (s->dyn_ltree[n].Freq != 0) return Z_TEXT; - /* There are no "black-listed" or "white-listed" bytes: + /* There are no "block-listed" or "allow-listed" bytes: * this stream either is empty or has tolerated ("gray-listed") bytes only. */ return Z_BINARY; @@ -1126,6 +1172,6 @@ ZLIB_INTERNAL void bi_windup(s) s->bi_buf = 0; s->bi_valid = 0; #ifdef ZLIB_DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; + s->bits_sent = (s->bits_sent + 7) & ~7; #endif } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/x86.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/x86.h index 73c776aec395b0..09051a9d146685 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/x86.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/x86.h @@ -18,7 +18,6 @@ #define UNALIGNED_OK #define ADLER32_UNROLL_LESS -#define CRC32_UNROLL_LESS #define USE_SSE_SLIDE #define USE_CRC_HASH #define USE_PCLMUL_CRC diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zconf.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zconf.h index 5e1d68a004e974..bf977d3e70adef 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zconf.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zconf.h @@ -38,6 +38,9 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound @@ -349,6 +352,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -467,11 +473,18 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zlib.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zlib.h index ddd0b47b8d3b81..953cb5012dc203 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zlib.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11.1, January xxth, 2017 + version 1.2.13, October 13th, 2022 - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,12 +37,12 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.11.1-motley" -#define ZLIB_VERNUM 0x12b1 +#define ZLIB_VERSION "1.2.13" +#define ZLIB_VERNUM 0x12d0 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 11 -#define ZLIB_VER_SUBREVISION 1 +#define ZLIB_VER_REVISION 13 +#define ZLIB_VER_SUBREVISION 0 /* The 'zlib' compression library provides in-memory compression and @@ -276,7 +276,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more ouput + which can be used if desired to determine whether or not there is more output in that case. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to @@ -543,8 +543,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int strategy)); This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by the - caller. + fields zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. @@ -661,7 +660,7 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If deflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. deflateGetDictionary() may return a length less than the window size, even when more than the window size in input has been provided. It may return up @@ -866,9 +865,11 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see - below), inflate() will not automatically decode concatenated gzip streams. - inflate() will return Z_STREAM_END at the end of the gzip stream. The state - would need to be reset to continue decoding a subsequent gzip stream. + below), inflate() will *not* automatically decode concatenated gzip members. + inflate() will return Z_STREAM_END at the end of the gzip member. The state + would need to be reset to continue decoding a subsequent gzip member. This + *must* be done if there is more data after a gzip member, in order for the + decompression to be compliant with the gzip standard (RFC 1952). inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the @@ -914,7 +915,7 @@ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If inflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. @@ -1303,14 +1304,14 @@ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ /* ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); - Opens a gzip (.gz) file for reading or writing. The mode parameter is as - in fopen ("rb" or "wb") but can also include a compression level ("wb9") or - a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only - compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' - for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) 'T' will - request transparent writing or appending with no compression and not using - the gzip format. + Open the gzip (.gz) file at path for reading and decompressing, or + compressing and writing. The mode parameter is as in fopen ("rb" or "wb") + but can also include a compression level ("wb9") or a strategy: 'f' for + filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", + 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression + as in "wb9F". (See the description of deflateInit2 for more information + about the strategy parameter.) 'T' will request transparent writing or + appending with no compression and not using the gzip format. "a" can be used instead of "w" to request that the gzip stream that will be written be appended to the file. "+" will result in an error, since @@ -1340,9 +1341,9 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* - gzdopen associates a gzFile with the file descriptor fd. File descriptors - are obtained from calls like open, dup, creat, pipe or fileno (if the file - has been previously opened with fopen). The mode parameter is as in gzopen. + Associate a gzFile with the file descriptor fd. File descriptors are + obtained from calls like open, dup, creat, pipe or fileno (if the file has + been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor @@ -1363,13 +1364,13 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); /* - Set the internal buffer size used by this library's functions. The - default buffer size is 8192 bytes. This function must be called after - gzopen() or gzdopen(), and before any other calls that read or write the - file. The buffer memory allocation is always deferred to the first read or - write. Three times that size in buffer space is allocated. A larger buffer - size of, for example, 64K or 128K bytes will noticeably increase the speed - of decompression (reading). + Set the internal buffer size used by this library's functions for file to + size. The default buffer size is 8192 bytes. This function must be called + after gzopen() or gzdopen(), and before any other calls that read or write + the file. The buffer memory allocation is always deferred to the first read + or write. Three times that size in buffer space is allocated. A larger + buffer size of, for example, 64K or 128K bytes will noticeably increase the + speed of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). @@ -1379,9 +1380,9 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. Previously provided - data is flushed before the parameter change. + Dynamically update the compression level and strategy for file. See the + description of deflateInit2 for the meaning of these parameters. Previously + provided data is flushed before applying the parameter changes. gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not opened for writing, Z_ERRNO if there is an error writing the flushed data, @@ -1390,7 +1391,7 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* - Reads the given number of uncompressed bytes from the compressed file. If + Read and decompress up to len uncompressed bytes from file into buf. If the input file is not in gzip format, gzread copies the given number of bytes into the buffer directly from the file. @@ -1421,11 +1422,11 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, gzFile file)); /* - Read up to nitems items of size size from file to buf, otherwise operating - as gzread() does. This duplicates the interface of stdio's fread(), with - size_t request and return types. If the library defines size_t, then - z_size_t is identical to size_t. If not, then z_size_t is an unsigned - integer type that can contain a pointer. + Read and decompress up to nitems items of size size from file into buf, + otherwise operating as gzread() does. This duplicates the interface of + stdio's fread(), with size_t request and return types. If the library + defines size_t, then z_size_t is identical to size_t. If not, then z_size_t + is an unsigned integer type that can contain a pointer. gzfread() returns the number of full items read of size size, or zero if the end of the file was reached and a full item could not be read, or if @@ -1436,26 +1437,24 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, In the event that the end of file is reached and only a partial item is available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevetheless read into buf + multiple of size, then the final partial item is nevertheless read into buf and the end-of-file flag is set. The length of the partial item read is not provided, but could be inferred from the result of gztell(). This behavior is the same as the behavior of fread() implementations in common libraries, but it prevents the direct use of gzfread() to read a concurrently written - file, reseting and retrying on end-of-file, when size is not 1. + file, resetting and retrying on end-of-file, when size is not 1. */ -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); /* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes written or 0 in case of - error. + Compress and write the len uncompressed bytes at buf to file. gzwrite + returns the number of uncompressed bytes written or 0 in case of error. */ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, z_size_t nitems, gzFile file)); /* - gzfwrite() writes nitems items of size size from buf to file, duplicating + Compress and write nitems items of size size from buf to file, duplicating the interface of stdio's fwrite(), with size_t request and return types. If the library defines size_t, then z_size_t is identical to size_t. If not, then z_size_t is an unsigned integer type that can contain a pointer. @@ -1468,22 +1467,22 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); /* - Converts, formats, and writes the arguments to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of + Convert, format, compress, and write the arguments (...) to file under + control of the string format, as in fprintf. gzprintf returns the number of uncompressed bytes actually written, or a negative zlib error code in case of error. The number of uncompressed bytes written is limited to 8191, or one less than the buffer size given to gzbuffer(). The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() + zlib was compiled with the insecure functions sprintf() or vsprintf(), because the secure snprintf() or vsnprintf() functions were not available. This can be determined using zlibCompileFlags(). */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* - Writes the given null-terminated string to the compressed file, excluding + Compress and write the given null-terminated string s to file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. @@ -1491,11 +1490,12 @@ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* - Reads bytes from the compressed file until len-1 characters are read, or a - newline character is read and transferred to buf, or an end-of-file - condition is encountered. If any characters are read or if len == 1, the - string is terminated with a null character. If no characters are read due - to an end-of-file or len < 1, then the buffer is left untouched. + Read and decompress bytes from file into buf, until len-1 characters are + read, or until a newline character is read and transferred to buf, or an + end-of-file condition is encountered. If any characters are read or if len + is one, the string is terminated with a null character. If no characters + are read due to an end-of-file or len is less than one, then the buffer is + left untouched. gzgets returns buf which is a null-terminated string, or it returns NULL for end-of-file or in case of error. If there was an error, the contents at @@ -1504,13 +1504,13 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* - Writes c, converted to an unsigned char, into the compressed file. gzputc + Compress and write c, converted to an unsigned char, into file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* - Reads one byte from the compressed file. gzgetc returns this byte or -1 + Read and decompress one byte from file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. it does not check to see if file is NULL, nor whether the structure file @@ -1519,8 +1519,8 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); /* - Push one character back onto the stream to be read as the first character - on the next read. At least one character of push-back is allowed. + Push c back onto the stream for file to be read as the first character on + the next read. At least one character of push-back is always allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if c is -1, and may fail if a character has been pushed but not read yet. If gzungetc is used immediately after gzopen or gzdopen, at least the @@ -1531,9 +1531,9 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* - Flushes all pending output into the compressed file. The parameter flush - is as in the deflate() function. The return value is the zlib error number - (see function gzerror below). gzflush is only permitted when writing. + Flush all pending output to file. The parameter flush is as in the + deflate() function. The return value is the zlib error number (see function + gzerror below). gzflush is only permitted when writing. If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new @@ -1548,8 +1548,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the + Set the starting position to offset relative to whence for the next gzread + or gzwrite on file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. @@ -1566,18 +1566,18 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* - Rewinds the given file. This function is supported only for reading. + Rewind file. This function is supported only for reading. - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET). */ /* ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); - Returns the starting position for the next gzread or gzwrite on the given - compressed file. This position represents a number of bytes in the - uncompressed data stream, and is zero when starting, even if appending or - reading a gzip stream from the middle of a file using gzdopen(). + Return the starting position for the next gzread or gzwrite on file. + This position represents a number of bytes in the uncompressed data stream, + and is zero when starting, even if appending or reading a gzip stream from + the middle of a file using gzdopen(). gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ @@ -1585,22 +1585,22 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); /* ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); - Returns the current offset in the file being read or written. This offset - includes the count of bytes that precede the gzip stream, for example when - appending or when using gzdopen() for reading. When reading, the offset - does not include as yet unused buffered input. This information can be used - for a progress indicator. On error, gzoffset() returns -1. + Return the current compressed (actual) read or write offset of file. This + offset includes the count of bytes that precede the gzip stream, for example + when appending or when using gzdopen() for reading. When reading, the + offset does not include as yet unused buffered input. This information can + be used for a progress indicator. On error, gzoffset() returns -1. */ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* - Returns true (1) if the end-of-file indicator has been set while reading, - false (0) otherwise. Note that the end-of-file indicator is set only if the - read tried to go past the end of the input, but came up short. Therefore, - just like feof(), gzeof() may return false even if there is no more data to - read, in the event that the last read request was for the exact number of - bytes remaining in the input file. This will happen if the input file size - is an exact multiple of the buffer size. + Return true (1) if the end-of-file indicator for file has been set while + reading, false (0) otherwise. Note that the end-of-file indicator is set + only if the read tried to go past the end of the input, but came up short. + Therefore, just like feof(), gzeof() may return false even if there is no + more data to read, in the event that the last read request was for the exact + number of bytes remaining in the input file. This will happen if the input + file size is an exact multiple of the buffer size. If gzeof() returns true, then the read functions will return no more data, unless the end-of-file indicator is reset by gzclearerr() and the input file @@ -1609,7 +1609,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* - Returns true (1) if file is being copied directly while reading, or false + Return true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed. If the input file is empty, gzdirect() will return true, since the input @@ -1630,8 +1630,8 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* - Flushes all pending output if necessary, closes the compressed file and - deallocates the (de)compression state. Note that once file is closed, you + Flush all pending output for file, if necessary, close file and + deallocate the (de)compression state. Note that once file is closed, you cannot call gzerror with file, since its structures have been deallocated. gzclose must not be called more than once on the same file, just as free must not be called more than once on the same allocation. @@ -1655,10 +1655,10 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* - Returns the error message for the last error which occurred on the given - compressed file. errnum is set to zlib error number. If an error occurred - in the file system and not in the compression library, errnum is set to - Z_ERRNO and the application may consult errno to get the exact error code. + Return the error message for the last error which occurred on file. + errnum is set to zlib error number. If an error occurred in the file system + and not in the compression library, errnum is set to Z_ERRNO and the + application may consult errno to get the exact error code. The application must not modify the returned string. Future calls to this function may invalidate the previously returned string. If file is @@ -1671,7 +1671,7 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); /* - Clears the error and end-of-file flags for file. This is analogous to the + Clear the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ @@ -1689,8 +1689,9 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. + return the updated checksum. An Adler-32 value is in the range of a 32-bit + unsigned integer. If buf is Z_NULL, this function returns the required + initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed much faster. @@ -1723,12 +1724,13 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, negative, the result has no meaning or utility. */ -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. + updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. + If buf is Z_NULL, this function returns the required initial value for the + crc. Pre- and post-conditioning (one's complement) is performed within this + function so it shouldn't be done by the application. Usage example: @@ -1756,6 +1758,20 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); len2. */ +/* +ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2)); + + Return the operator corresponding to length len2, to be used with + crc32_combine_op(). +*/ + +ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op)); +/* + Give the same result as crc32_combine(), using op in place of len2. op is + is generated from len2 by crc32_combine_gen(). This will be faster than + crc32_combine() if the generated op is used more than once. +*/ + /* various hacks, don't look :) */ @@ -1843,6 +1859,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off64_t)); #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) @@ -1853,6 +1870,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define z_gzoffset z_gzoffset64 # define z_adler32_combine z_adler32_combine64 # define z_crc32_combine z_crc32_combine64 +# define z_crc32_combine_gen z_crc32_combine_gen64 # else # define gzopen gzopen64 # define gzseek gzseek64 @@ -1860,6 +1878,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 +# define crc32_combine_gen crc32_combine_gen64 # endif # ifndef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); @@ -1868,6 +1887,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t)); # endif #else ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); @@ -1876,12 +1896,14 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t)); #endif #else /* Z_SOLO */ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t)); #endif /* !Z_SOLO */ @@ -1891,7 +1913,7 @@ ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); -ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp)); ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); #if defined(_WIN32) && !defined(Z_SOLO) diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zutil.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zutil.c index dcab28a0d5177a..9543ae825e3250 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zutil.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zutil.c @@ -61,9 +61,11 @@ uLong ZEXPORT zlibCompileFlags() #ifdef ZLIB_DEBUG flags += 1 << 8; #endif + /* #if defined(ASMV) || defined(ASMINF) flags += 1 << 9; #endif + */ #ifdef ZLIB_WINAPI flags += 1 << 10; #endif @@ -119,7 +121,7 @@ uLong ZEXPORT zlibCompileFlags() # endif int ZLIB_INTERNAL z_verbose = verbose; -void ZLIB_INTERNAL z_error (m) +void ZLIB_INTERNAL z_error(m) char *m; { fprintf(stderr, "%s\n", m); @@ -214,7 +216,7 @@ local ptr_table table[MAX_PTR]; * a protected system like OS/2. Use Microsoft C instead. */ -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { voidpf buf; ulg bsize = (ulg)items*size; @@ -240,7 +242,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) return buf; } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { int n; @@ -277,13 +279,13 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) # define _hfree hfree #endif -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) { (void)opaque; return _halloc((long)items, size); } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { (void)opaque; _hfree(ptr); @@ -302,7 +304,7 @@ extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif -voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) +voidpf ZLIB_INTERNAL zcalloc(opaque, items, size) voidpf opaque; unsigned items; unsigned size; @@ -312,7 +314,7 @@ voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) (voidpf)calloc(items, size); } -void ZLIB_INTERNAL zcfree (opaque, ptr) +void ZLIB_INTERNAL zcfree(opaque, ptr) voidpf opaque; voidpf ptr; { diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zutil.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zutil.h index e6de74fc4b2f67..056a2b0c36063d 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zutil.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-intel/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -44,6 +44,17 @@ typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; +#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC) +# include +# if (ULONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long +# elif (ULLONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long long +# elif (UINT_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned +# endif +#endif + extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ @@ -193,11 +204,19 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #define zalign(x) __attribute__((aligned((x)))) #endif +#if defined(_MSC_VER) +#define zalways_inline __forceinline +#else +#define zalways_inline __attribute__((always_inline)) +#endif + + /* provide prototypes for these when building zlib without LFS */ #if !defined(_WIN32) && \ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t)); #endif /* common defaults */ diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-version.txt b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-version.txt new file mode 100644 index 00000000000000..5da9869df33f59 --- /dev/null +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib-version.txt @@ -0,0 +1,9 @@ +v1.3.1 +(51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf) + +https://github.com/madler/zlib/releases/tag/v1.3.1 + +We have removed zlib.3.pdf from our local copy, as it is a binary file which is +not needed for our compilation. + +We have also applied the custom patches under the patches/zlib folder. diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib.md b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib.md deleted file mode 100644 index 9c66be986001c9..00000000000000 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib.md +++ /dev/null @@ -1,6 +0,0 @@ - -.\zlib (for Arm/Arm64) -is from https://github.com/madler/zlib/releases/tag/v1.2.11 - -.\zlib-intel (for x64/x86) -is from https://github.com/jtkukunas/zlib/commit/bf103c626c6c0d80580748f6b814ec534614ca52 diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/CMakeLists.txt b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/CMakeLists.txt index 0fe939df689306..15ceebe787e7d9 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/CMakeLists.txt +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/CMakeLists.txt @@ -1,12 +1,11 @@ -cmake_minimum_required(VERSION 2.4.4) +cmake_minimum_required(VERSION 2.4.4...3.15.0) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) project(zlib C) -set(VERSION "1.2.11") +set(VERSION "1.3.1") -option(ASM686 "Enable building i686 assembly implementation") -option(AMD64 "Enable building amd64 assembly implementation") +option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON) set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -129,39 +128,6 @@ if(NOT MINGW) ) endif() -if(CMAKE_COMPILER_IS_GNUCC) - if(ASM686) - set(ZLIB_ASMS contrib/asm686/match.S) - elseif (AMD64) - set(ZLIB_ASMS contrib/amd64/amd64-match.S) - endif () - - if(ZLIB_ASMS) - add_definitions(-DASMV) - set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) - endif() -endif() - -if(MSVC) - if(ASM686) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx86/inffas32.asm - contrib/masmx86/match686.asm - ) - elseif (AMD64) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx64/gvmat64.asm - contrib/masmx64/inffasx64.asm - ) - endif() - - if(ZLIB_ASMS) - add_definitions(-DASMV -DASMINF) - endif() -endif() - # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" @@ -183,8 +149,10 @@ if(MINGW) set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) endif(MINGW) -add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) set_target_properties(zlib PROPERTIES SOVERSION 1) @@ -202,7 +170,7 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - if(NOT APPLE) + if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") endif() elseif(BUILD_SHARED_LIBS AND WIN32) @@ -229,21 +197,22 @@ endif() #============================================================================ # Example binaries #============================================================================ - -add_executable(example test/example.c) -target_link_libraries(example zlib) -add_test(example example) - -add_executable(minigzip test/minigzip.c) -target_link_libraries(minigzip zlib) - -if(HAVE_OFF64_T) - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - add_test(example64 example64) - - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") +if(ZLIB_BUILD_EXAMPLES) + add_executable(example test/example.c) + target_link_libraries(example zlib) + add_test(example example) + + add_executable(minigzip test/minigzip.c) + target_link_libraries(minigzip zlib) + + if(HAVE_OFF64_T) + add_executable(example64 test/example.c) + target_link_libraries(example64 zlib) + set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + add_test(example64 example64) + + add_executable(minigzip64 test/minigzip.c) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + endif() endif() diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/ChangeLog b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/ChangeLog index c3a6e4d1affc5f..b801a1031ec0f5 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/ChangeLog +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/ChangeLog @@ -1,6 +1,109 @@ ChangeLog file for zlib +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + +Changes in 1.3 (18 Aug 2023) +- Remove K&R function definitions and zlib2ansi +- Fix bug in deflateBound() for level 0 and memLevel 9 +- Fix bug when gzungetc() is used immediately after gzopen() +- Fix bug when using gzflush() with a very small buffer +- Fix crash when gzsetparams() attempted for transparent write +- Fix test/example.c to work with FORCE_STORED +- Rewrite of zran in examples (see zran.c version history) +- Fix minizip to allow it to open an empty zip file +- Fix reading disk number start on zip64 files in minizip +- Fix logic error in minizip argument processing +- Add minizip testing to Makefile +- Read multiple bytes instead of byte-by-byte in minizip unzip.c +- Add memory sanitizer to configure (--memory) +- Various portability improvements +- Various documentation improvements +- Various spelling and typo corrections + +Changes in 1.2.13 (13 Oct 2022) +- Fix configure issue that discarded provided CC definition +- Correct incorrect inputs provided to the CRC functions +- Repair prototypes and exporting of new CRC functions +- Fix inflateBack to detect invalid input with distances too far +- Have infback() deliver all of the available output up to any error +- Fix a bug when getting a gzip header extra field with inflate() +- Fix bug in block type selection when Z_FIXED used +- Tighten deflateBound bounds +- Remove deleted assembler code references +- Various portability and appearance improvements + +Changes in 1.2.12 (27 Mar 2022) +- Cygwin does not have _wopen(), so do not create gzopen_w() there +- Permit a deflateParams() parameter change as soon as possible +- Limit hash table inserts after switch from stored deflate +- Fix bug when window full in deflate_stored() +- Fix CLEAR_HASH macro to be usable as a single statement +- Avoid a conversion error in gzseek when off_t type too small +- Have Makefile return non-zero error code on test failure +- Avoid some conversion warnings in gzread.c and gzwrite.c +- Update use of errno for newer Windows CE versions +- Small speedup to inflate [psumbera] +- Return an error if the gzputs string length can't fit in an int +- Add address checking in clang to -w option of configure +- Don't compute check value for raw inflate if asked to validate +- Handle case where inflateSync used when header never processed +- Avoid the use of ptrdiff_t +- Avoid an undefined behavior of memcpy() in gzappend() +- Avoid undefined behaviors of memcpy() in gz*printf() +- Avoid an undefined behavior of memcpy() in _tr_stored_block() +- Make the names in functions declarations identical to definitions +- Remove old assembler code in which bugs have manifested +- Fix deflateEnd() to not report an error at start of raw deflate +- Add legal disclaimer to README +- Emphasize the need to continue decompressing gzip members +- Correct the initialization requirements for deflateInit2() +- Fix a bug that can crash deflate on some input when using Z_FIXED +- Assure that the number of bits for deflatePrime() is valid +- Use a structure to make globals in enough.c evident +- Use a macro for the printf format of big_t in enough.c +- Clean up code style in enough.c, update version +- Use inline function instead of macro for index in enough.c +- Clarify that prefix codes are counted in enough.c +- Show all the codes for the maximum tables size in enough.c +- Add gznorm.c example, which normalizes gzip files +- Fix the zran.c example to work on a multiple-member gzip file +- Add tables for crc32_combine(), to speed it up by a factor of 200 +- Add crc32_combine_gen() and crc32_combine_op() for fast combines +- Speed up software CRC-32 computation by a factor of 1.5 to 3 +- Use atomic test and set, if available, for dynamic CRC tables +- Don't bother computing check value after successful inflateSync() +- Correct comment in crc32.c +- Add use of the ARMv8 crc32 instructions when requested +- Use ARM crc32 instructions if the ARM architecture has them +- Explicitly note that the 32-bit check values are 32 bits +- Avoid adding empty gzip member after gzflush with Z_FINISH +- Fix memory leak on error in gzlog.c +- Fix error in comment on the polynomial representation of a byte +- Clarify gz* function interfaces, referring to parameter names +- Change macro name in inflate.c to avoid collision in VxWorks +- Correct typo in blast.c +- Improve portability of contrib/minizip +- Fix indentation in minizip's zip.c +- Replace black/white with allow/block. (theresa-m) +- minizip warning fix if MAXU32 already defined. (gvollant) +- Fix unztell64() in minizip to work past 4GB. (Daniël Hörchner) +- Clean up minizip to reduce warnings for testing +- Add fallthrough comments for gcc +- Eliminate use of ULL constants +- Separate out address sanitizing from warnings in configure +- Remove destructive aspects of make distclean +- Check for cc masquerading as gcc or clang in configure +- Fix crc32.c to compile local functions only if used + Changes in 1.2.11 (15 Jan 2017) - Fix deflate stored bug when pulling last block from window - Permit immediate deflateParams changes before any deflate input @@ -96,7 +199,7 @@ Changes in 1.2.7.1 (24 Mar 2013) - Fix types in contrib/minizip to match result of get_crc_table() - Simplify contrib/vstudio/vc10 with 'd' suffix - Add TOP support to win32/Makefile.msc -- Suport i686 and amd64 assembler builds in CMakeLists.txt +- Support i686 and amd64 assembler builds in CMakeLists.txt - Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h - Add vc11 and vc12 build files to contrib/vstudio - Add gzvprintf() as an undocumented function in zlib @@ -296,14 +399,14 @@ Changes in 1.2.5.1 (10 Sep 2011) - Use u4 type for crc_table to avoid conversion warnings - Apply casts in zlib.h to avoid conversion warnings - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] -- Improve inflateSync() documentation to note indeterminancy +- Improve inflateSync() documentation to note indeterminacy - Add deflatePending() function to return the amount of pending output - Correct the spelling of "specification" in FAQ [Randers-Pehrson] - Add a check in configure for stdarg.h, use for gzprintf() - Check that pointers fit in ints when gzprint() compiled old style - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] -- Add debug records in assmebler code [Londer] +- Add debug records in assembler code [Londer] - Update RFC references to use http://tools.ietf.org/html/... [Li] - Add --archs option, use of libtool to configure for Mac OS X [Borstel] @@ -511,7 +614,7 @@ Changes in 1.2.3.5 (8 Jan 2010) - Don't use _vsnprintf on later versions of MSVC [Lowman] - Add CMake build script and input file [Lowman] - Update contrib/minizip to 1.1 [Svensson, Vollant] -- Moved nintendods directory from contrib to . +- Moved nintendods directory from contrib to root - Replace gzio.c with a new set of routines with the same functionality - Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above - Update contrib/minizip to 1.1b @@ -685,7 +788,7 @@ Changes in 1.2.2.4 (11 July 2005) - Be more strict on incomplete code sets in inflate_table() and increase ENOUGH and MAXD -- this repairs a possible security vulnerability for invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for - discovering the vulnerability and providing test cases. + discovering the vulnerability and providing test cases - Add ia64 support to configure for HP-UX [Smith] - Add error return to gzread() for format or i/o error [Levin] - Use malloc.h for OS/2 [Necasek] @@ -721,7 +824,7 @@ Changes in 1.2.2.2 (30 December 2004) - Add Z_FIXED strategy option to deflateInit2() to force fixed trees - Add updated make_vms.com [Coghlan], update README - Create a new "examples" directory, move gzappend.c there, add zpipe.c, - fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. + fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html - Add FAQ entry and comments in deflate.c on uninitialized memory access - Add Solaris 9 make options in configure [Gilbert] - Allow strerror() usage in gzio.c for STDC @@ -792,7 +895,7 @@ Changes in 1.2.1.1 (9 January 2004) - Fix a big fat bug in inftrees.c that prevented decoding valid dynamic blocks with only literals and no distance codes -- Thanks to "Hot Emu" for the bug report and sample file -- Add a note to puff.c on no distance codes case. +- Add a note to puff.c on no distance codes case Changes in 1.2.1 (17 November 2003) - Remove a tab in contrib/gzappend/gzappend.c @@ -970,7 +1073,7 @@ Changes in 1.2.0.1 (17 March 2003) - Include additional header file on VMS for off_t typedef - Try to use _vsnprintf where it supplants vsprintf [Vollant] - Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to +- Enhance comments in zlib.h on what happens if gzprintf() tries to write more than 4095 bytes before compression - Remove unused state from inflateBackEnd() - Remove exit(0) from minigzip.c, example.c @@ -1036,14 +1139,14 @@ Changes in 1.2.0 (9 March 2003) - Add contrib/puff/ simple inflate for deflate format description Changes in 1.1.4 (11 March 2002) -- ZFREE was repeated on same allocation on some error conditions. +- ZFREE was repeated on same allocation on some error conditions This creates a security problem described in http://www.zlib.org/advisory-2002-03-11.txt - Returned incorrect error (Z_MEM_ERROR) on some invalid data - Avoid accesses before window for invalid distances with inflate window - less than 32K. + less than 32K - force windowBits > 8 to avoid a bug in the encoder for a window size - of 256 bytes. (A complete fix will be available in 1.1.5). + of 256 bytes. (A complete fix will be available in 1.1.5) Changes in 1.1.3 (9 July 1998) - fix "an inflate input buffer bug that shows up on rare but persistent @@ -1117,7 +1220,7 @@ Changes in 1.1.1 (27 Feb 98) - remove block truncation heuristic which had very marginal effect for zlib (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the compression ratio on some files. This also allows inlining _tr_tally for - matches in deflate_slow. + matches in deflate_slow - added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) Changes in 1.1.0 (24 Feb 98) @@ -1148,7 +1251,7 @@ Changes in 1.0.9 (17 Feb 1998) - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) + the declaration of FAR (Gilles Vollant) - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) - read_buf buf parameter of type Bytef* instead of charf* - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) @@ -1162,7 +1265,7 @@ Changes in 1.0.8 (27 Jan 1998) - include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) - use constant arrays for the static trees in trees.c instead of computing them at run time (thanks to Ken Raeburn for this suggestion). To create - trees.h, compile with GEN_TREES_H and run "make test". + trees.h, compile with GEN_TREES_H and run "make test" - check return code of example in "make test" and display result - pass minigzip command line options to file_compress - simplifying code of inflateSync to avoid gcc 2.8 bug @@ -1201,12 +1304,12 @@ Changes in 1.0.6 (19 Jan 1998) - add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) - Fix a deflate bug occurring only with compression level 0 (thanks to - Andy Buckler for finding this one). -- In minigzip, pass transparently also the first byte for .Z files. + Andy Buckler for finding this one) +- In minigzip, pass transparently also the first byte for .Z files - return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() - check Z_FINISH in inflate (thanks to Marc Schluper) - Implement deflateCopy (thanks to Adam Costello) -- make static libraries by default in configure, add --shared option. +- make static libraries by default in configure, add --shared option - move MSDOS or Windows specific files to directory msdos - suppress the notion of partial flush to simplify the interface (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) @@ -1218,7 +1321,7 @@ Changes in 1.0.6 (19 Jan 1998) - added Makefile.nt (thanks to Stephen Williams) - added the unsupported "contrib" directory: contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). + 386 asm code replacing longest_match() contrib/iostream/ by Kevin Ruland A C++ I/O streams interface to the zlib gz* functions contrib/iostream2/ by Tyge Løvset @@ -1226,7 +1329,7 @@ Changes in 1.0.6 (19 Jan 1998) contrib/untgz/ by "Pedro A. Aranda Guti\irrez" A very simple tar.gz file extractor using zlib contrib/visual-basic.txt by Carlos Rios - How to use compress(), uncompress() and the gz* functions from VB. + How to use compress(), uncompress() and the gz* functions from VB - pass params -f (filtered data), -h (huffman only), -1 to -9 (compression level) in minigzip (thanks to Tom Lane) @@ -1235,8 +1338,8 @@ Changes in 1.0.6 (19 Jan 1998) - add undocumented function inflateSyncPoint() (hack for Paul Mackerras) - add undocumented function zError to convert error code to string (for Tim Smithers) -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. -- Use default memcpy for Symantec MSDOS compiler. +- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code +- Use default memcpy for Symantec MSDOS compiler - Add EXPORT keyword for check_func (needed for Windows DLL) - add current directory to LD_LIBRARY_PATH for "make test" - create also a link for libz.so.1 @@ -1249,7 +1352,7 @@ Changes in 1.0.6 (19 Jan 1998) - allow compilation with ANSI keywords only enabled for TurboC in large model - avoid "versionString"[0] (Borland bug) - add NEED_DUMMY_RETURN for Borland -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). +- use variable z_verbose for tracing in debug mode (L. Peter Deutsch) - allow compilation with CC - defined STDC for OS/2 (David Charlap) - limit external names to 8 chars for MVS (Thomas Lund) @@ -1259,7 +1362,7 @@ Changes in 1.0.6 (19 Jan 1998) - use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) - added makelcc.bat for lcc-win32 (Tom St Denis) - in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) -- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. +- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion - check for unistd.h in configure (for off_t) - remove useless check parameter in inflate_blocks_free - avoid useless assignment of s->check to itself in inflate_blocks_new @@ -1280,7 +1383,7 @@ Changes in 1.0.5 (3 Jan 98) Changes in 1.0.4 (24 Jul 96) - In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF bit, so the decompressor could decompress all the correct data but went - on to attempt decompressing extra garbage data. This affected minigzip too. + on to attempt decompressing extra garbage data. This affected minigzip too - zlibVersion and gzerror return const char* (needed for DLL) - port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) - use z_error only for DEBUG (avoid problem with DLLs) @@ -1310,7 +1413,7 @@ Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] - fix array overlay in deflate.c which sometimes caused bad compressed data - fix inflate bug with empty stored block - fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generate bad compressed data. +- fix deflateParams() which could generate bad compressed data - Bytef is define'd instead of typedef'ed (work around Borland bug) - added an INDEX file - new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), @@ -1331,7 +1434,7 @@ Changes in 0.99 (27 Jan 96) - allow preset dictionary shared between compressor and decompressor - allow compression level 0 (no compression) - add deflateParams in zlib.h: allow dynamic change of compression level - and compression strategy. + and compression strategy - test large buffers and deflateParams in example.c - add optional "configure" to build zlib as a shared library - suppress Makefile.qnx, use configure instead @@ -1370,33 +1473,33 @@ Changes in 0.99 (27 Jan 96) - fix typo in Make_vms.com (f$trnlnm -> f$getsyi) - in fcalloc, normalize pointer if size > 65520 bytes - don't use special fcalloc for 32 bit Borland C++ -- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... +- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc. - use Z_BINARY instead of BINARY - document that gzclose after gzdopen will close the file -- allow "a" as mode in gzopen. +- allow "a" as mode in gzopen - fix error checking in gzread - allow skipping .gz extra-field on pipes - added reference to Perl interface in README - put the crc table in FAR data (I dislike more and more the medium model :) - added get_crc_table -- added a dimension to all arrays (Borland C can't count). +- added a dimension to all arrays (Borland C can't count) - workaround Borland C bug in declaration of inflate_codes_new & inflate_fast - guard against multiple inclusion of *.h (for precompiled header on Mac) -- Watcom C pretends to be Microsoft C small model even in 32 bit mode. +- Watcom C pretends to be Microsoft C small model even in 32 bit mode - don't use unsized arrays to avoid silly warnings by Visual C++: warning C4746: 'inflate_mask' : unsized array treated as '__far' - (what's wrong with far data in far model?). + (what's wrong with far data in far model?) - define enum out of inflate_blocks_state to allow compilation with C++ Changes in 0.95 (16 Aug 95) - fix MSDOS small and medium model (now easier to adapt to any compiler) - inlined send_bits - fix the final (:-) bug for deflate with flush (output was correct but - not completely flushed in rare occasions). + not completely flushed in rare occasions) - default window size is same for compression and decompression - (it's now sufficient to set MAX_WBITS in zconf.h). + (it's now sufficient to set MAX_WBITS in zconf.h) - voidp -> voidpf and voidnp -> voidp (for consistency with other - typedefs and because voidnp was not near in large model). + typedefs and because voidnp was not near in large model) Changes in 0.94 (13 Aug 95) - support MSDOS medium model @@ -1405,12 +1508,12 @@ Changes in 0.94 (13 Aug 95) - added support for VMS - allow a compression level in gzopen() - gzflush now calls fflush -- For deflate with flush, flush even if no more input is provided. +- For deflate with flush, flush even if no more input is provided - rename libgz.a as libz.a - avoid complex expression in infcodes.c triggering Turbo C bug - work around a problem with gcc on Alpha (in INSERT_STRING) - don't use inline functions (problem with some gcc versions) -- allow renaming of Byte, uInt, etc... with #define. +- allow renaming of Byte, uInt, etc... with #define - avoid warning about (unused) pointer before start of array in deflate.c - avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c - avoid reserved word 'new' in trees.c @@ -1429,7 +1532,7 @@ Changes in 0.92 (3 May 95) - no memcpy on Pyramid - suppressed inftest.c - optimized fill_window, put longest_match inline for gcc -- optimized inflate on stored blocks. +- optimized inflate on stored blocks - untabify all sources to simplify patches Changes in 0.91 (2 May 95) @@ -1447,7 +1550,7 @@ Changes in 0.9 (1 May 95) - let again gzread copy uncompressed data unchanged (was working in 0.71) - deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented - added a test of inflateSync in example.c -- moved MAX_WBITS to zconf.h because users might want to change that. +- moved MAX_WBITS to zconf.h because users might want to change that - document explicitly that zalloc(64K) on MSDOS must return a normalized pointer (zero offset) - added Makefiles for Microsoft C, Turbo C, Borland C++ @@ -1456,7 +1559,7 @@ Changes in 0.9 (1 May 95) Changes in 0.8 (29 April 95) - added fast inflate (inffast.c) - deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - is incompatible with previous versions of zlib which returned Z_OK. + is incompatible with previous versions of zlib which returned Z_OK - work around a TurboC compiler bug (bad code for b << 0, see infutil.h) (actually that was not a compiler bug, see 0.81 above) - gzread no longer reads one extra byte in certain cases @@ -1466,50 +1569,50 @@ Changes in 0.8 (29 April 95) Changes in 0.71 (14 April 95) - Fixed more MSDOS compilation problems :( There is still a bug with - TurboC large model. + TurboC large model Changes in 0.7 (14 April 95) -- Added full inflate support. +- Added full inflate support - Simplified the crc32() interface. The pre- and post-conditioning (one's complement) is now done inside crc32(). WARNING: this is - incompatible with previous versions; see zlib.h for the new usage. + incompatible with previous versions; see zlib.h for the new usage Changes in 0.61 (12 April 95) -- workaround for a bug in TurboC. example and minigzip now work on MSDOS. +- workaround for a bug in TurboC. example and minigzip now work on MSDOS Changes in 0.6 (11 April 95) - added minigzip.c - added gzdopen to reopen a file descriptor as gzFile -- added transparent reading of non-gziped files in gzread. +- added transparent reading of non-gziped files in gzread - fixed bug in gzread (don't read crc as data) -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). +- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose) - don't allocate big arrays in the stack (for MSDOS) - fix some MSDOS compilation problems Changes in 0.5: - do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - not yet Z_FULL_FLUSH. + not yet Z_FULL_FLUSH - support decompression but only in a single step (forced Z_FINISH) -- added opaque object for zalloc and zfree. +- added opaque object for zalloc and zfree - added deflateReset and inflateReset -- added a variable zlib_version for consistency checking. -- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - Added Z_FILTERED and Z_HUFFMAN_ONLY constants. +- added a variable zlib_version for consistency checking +- renamed the 'filter' parameter of deflateInit2 as 'strategy' + Added Z_FILTERED and Z_HUFFMAN_ONLY constants Changes in 0.4: -- avoid "zip" everywhere, use zlib instead of ziplib. +- avoid "zip" everywhere, use zlib instead of ziplib - suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - if compression method == 8. + if compression method == 8 - added adler32 and crc32 - renamed deflateOptions as deflateInit2, call one or the other but not both -- added the method parameter for deflateInit2. +- added the method parameter for deflateInit2 - added inflateInit2 - simplified considerably deflateInit and inflateInit by not supporting user-provided history buffer. This is supported only in deflateInit2 - and inflateInit2. + and inflateInit2 Changes in 0.3: - prefix all macro names with Z_ -- use Z_FINISH instead of deflateEnd to finish compression. +- use Z_FINISH instead of deflateEnd to finish compression - added Z_HUFFMAN_ONLY - added gzerror() diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/FAQ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/FAQ index 99b7cf92e45497..92f5d3e29fab46 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/FAQ +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/FAQ @@ -4,7 +4,7 @@ If your question is not there, please check the zlib home page http://zlib.net/ which may have more recent information. -The lastest zlib FAQ is at http://zlib.net/zlib_faq.html +The latest zlib FAQ is at http://zlib.net/zlib_faq.html 1. Is zlib Y2K-compliant? @@ -14,8 +14,7 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/LICENSE b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/LICENSE new file mode 100644 index 00000000000000..ab8ee6f71428c3 --- /dev/null +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/LICENSE @@ -0,0 +1,22 @@ +Copyright notice: + + (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/Makefile.in b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/Makefile.in index 5a77949ff06857..cb8b00a9b078fb 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/Makefile.in +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler +# Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: @@ -7,10 +7,6 @@ # Normally configure builds both a static and a shared library. # If you want to build just a static library, use: ./configure --static -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o - # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: # make install # To install in $HOME instead of /usr/local, use: @@ -26,13 +22,13 @@ CFLAGS=-O SFLAGS=-O LDFLAGS= -TEST_LDFLAGS=-L. libz.a +TEST_LIBS=-L. libz.a LDSHARED=$(CC) CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.11 +SHAREDLIBV=libz.so.1.3.1 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -87,12 +83,12 @@ test: all teststatic testshared teststatic: static @TMPST=tmpst_$$; \ - if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \ + if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \ echo ' *** zlib test OK ***'; \ else \ echo ' *** zlib test FAILED ***'; false; \ - fi; \ - rm -f $$TMPST + fi + @rm -f tmpst_$$ testshared: shared @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ @@ -100,21 +96,21 @@ testshared: shared DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ TMPSH=tmpsh_$$; \ - if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \ + if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \ echo ' *** zlib shared test OK ***'; \ else \ echo ' *** zlib shared test FAILED ***'; false; \ - fi; \ - rm -f $$TMPSH + fi + @rm -f tmpsh_$$ test64: all64 @TMP64=tmp64_$$; \ - if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \ + if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \ echo ' *** zlib 64-bit test OK ***'; \ else \ echo ' *** zlib 64-bit test FAILED ***'; false; \ - fi; \ - rm -f $$TMP64 + fi + @rm -f tmp64_$$ infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c @@ -124,7 +120,7 @@ infcover: infcover.o libz.a cover: infcover rm -f *.gcda - ./infcover + ${QEMU_RUN} ./infcover gcov inf*.c libz.a: $(OBJS) @@ -286,22 +282,22 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a -@rmdir objs example$(EXE): example.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS) minigzip$(EXE): minigzip.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS) examplesh$(EXE): example.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV) minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV) example64$(EXE): example64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS) minigzip64$(EXE): minigzip64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS) install-libs: $(LIBS) -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi @@ -363,8 +359,14 @@ zconf.h.cmakein: $(SRCDIR)zconf.h.in zconf: $(SRCDIR)zconf.h.in cp -p $(SRCDIR)zconf.h.in zconf.h +minizip-test: static + cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; } + +minizip-clean: + cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; } + mostlyclean: clean -clean: +clean: minizip-clean rm -f *.o *.lo *~ \ example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ example64$(EXE) minigzip64$(EXE) \ @@ -376,15 +378,13 @@ clean: rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov maintainer-clean: distclean -distclean: clean zconf zconf.h.cmakein docs +distclean: clean zconf zconf.h.cmakein rm -f Makefile zlib.pc configure.log -@rm -f .DS_Store @if [ -f Makefile.in ]; then \ printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \ printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \ touch -r $(SRCDIR)Makefile.in Makefile ; fi - @if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi - @if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi tags: etags $(SRCDIR)*.[ch] diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/README b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/README index 51106de4753292..c5f917540b6fd2 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/README +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.11 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -29,18 +29,17 @@ PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at -http://marknelson.us/1997/01/01/zlib-engine/ . +https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.2.11 are documented in the file ChangeLog. +The changes made in version 1.3.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . -zlib is available in Java using the java.util.zip package, documented at -http://java.sun.com/developer/technicalArticles/Programming/compression/ . +zlib is available in Java using the java.util.zip package. Follow the API +Documentation link at: https://docs.oracle.com/search/?q=java.util.zip . -A Perl interface to zlib written by Paul Marquess is available -at CPAN (Comprehensive Perl Archive Network) sites, including -http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . +A Perl interface to zlib and bzip2 written by Paul Marquess +can be found at https://github.com/pmqs/IO-Compress . A Python interface to zlib written by A.M. Kuchling is available in Python 1.5 and later versions, see @@ -64,7 +63,7 @@ Notes for some targets: - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works when compiled with cc. -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is +- On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is necessary to get gzprintf working correctly. This is done by configure. - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with @@ -84,7 +83,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2017 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -108,7 +107,10 @@ Copyright notice: If you use the zlib library in a product, we would appreciate *not* receiving lengthy legal documents to sign. The sources are provided for free but without warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. +Gailly and Mark Adler; it does not include third-party code. We make all +contributions to and distributions of this project solely in our personal +capacity, and are not conveying any rights to any intellectual property of +any third parties. If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/adler32.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/adler32.c index d0be4380a39c9c..04b81d29bad169 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/adler32.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/adler32.c @@ -7,8 +7,6 @@ #include "zutil.h" -local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); - #define BASE 65521U /* largest prime smaller than 65536 */ #define NMAX 5552 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ @@ -60,11 +58,7 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); #endif /* ========================================================================= */ -uLong ZEXPORT adler32_z(adler, buf, len) - uLong adler; - const Bytef *buf; - z_size_t len; -{ +uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) { unsigned long sum2; unsigned n; @@ -131,20 +125,12 @@ uLong ZEXPORT adler32_z(adler, buf, len) } /* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; - uInt len; -{ +uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) { return adler32_z(adler, buf, len); } /* ========================================================================= */ -local uLong adler32_combine_(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off64_t len2; -{ +local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) { unsigned long sum1; unsigned long sum2; unsigned rem; @@ -169,18 +155,10 @@ local uLong adler32_combine_(adler1, adler2, len2) } /* ========================================================================= */ -uLong ZEXPORT adler32_combine(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off_t len2; -{ +uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) { return adler32_combine_(adler1, adler2, len2); } -uLong ZEXPORT adler32_combine64(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off64_t len2; -{ +uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) { return adler32_combine_(adler1, adler2, len2); } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/compress.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/compress.c index e2db404abf888b..f43bacf7ab9707 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/compress.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/compress.c @@ -19,13 +19,8 @@ memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; - int level; -{ +int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source, + uLong sourceLen, int level) { z_stream stream; int err; const uInt max = (uInt)-1; @@ -65,12 +60,8 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) /* =========================================================================== */ -int ZEXPORT compress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ +int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, + uLong sourceLen) { return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); } @@ -78,9 +69,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ -uLong ZEXPORT compressBound (sourceLen) - uLong sourceLen; -{ +uLong ZEXPORT compressBound(uLong sourceLen) { return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13; } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/configure b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/configure index e974d1fd799fbc..c55098afc4ae52 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/configure +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/configure @@ -25,15 +25,18 @@ if test $SRCDIR = "."; then ZINCOUT="-I." SRCDIR="" else - ZINC='-include zconf.h' + ZINC='-I. -include zconf.h' ZINCOUT='-I. -I$(SRCDIR)' SRCDIR="$SRCDIR/" fi # set command prefix for cross-compilation if [ -n "${CHOST}" ]; then - uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" + uname=${CHOST} + mname=${CHOST} CROSS_PREFIX="${CHOST}-" +else + mname=`(uname -a || echo unknown) 2>/dev/null` fi # destination name for static library @@ -41,9 +44,8 @@ STATICLIB=libz.a # extract zlib version numbers from zlib.h VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h` -VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h` -VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` -VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` +VER3=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\(\\.[0-9]\{1,\}\)\{1,2\}\).*/\1/p'` +VER1=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\)\\..*/\1/p'` # establish commands for library building if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then @@ -87,6 +89,8 @@ build64=0 gcc=0 warn=0 debug=0 +address=0 +memory=0 old_cc="$CC" old_cflags="$CFLAGS" OBJC='$(OBJZ) $(OBJG)' @@ -98,7 +102,7 @@ leave() if test "$*" != "0"; then echo "** $0 aborting." | tee -a configure.log fi - rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version + rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version echo -------------------- >> configure.log echo >> configure.log echo >> configure.log @@ -137,6 +141,9 @@ case "$1" in -c* | --const) zconst=1; shift ;; -w* | --warn) warn=1; shift ;; -d* | --debug) debug=1; shift ;; + --sanitize) address=1; shift ;; + --address) address=1; shift ;; + --memory) memory=1; shift ;; *) echo "unknown option: $1" | tee -a configure.log echo "$0 --help for help" | tee -a configure.log @@ -165,10 +172,17 @@ extern int getchar(); int hello() {return getchar();} EOF -test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log -cc=${CC-${CROSS_PREFIX}gcc} -cflags=${CFLAGS-"-O3"} -# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure +if test -z "$CC"; then + echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log + if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then + cc=${CROSS_PREFIX}gcc + else + cc=${CROSS_PREFIX}cc + fi +else + cc=${CC} +fi + case "$cc" in *gcc*) gcc=1 ;; *clang*) gcc=1 ;; @@ -194,11 +208,17 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then fi if test "$warn" -eq 1; then if test "$zconst" -eq 1; then - CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" + CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST" else - CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" + CFLAGS="${CFLAGS} -Wall -Wextra" fi fi + if test $address -eq 1; then + CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer" + fi + if test $memory -eq 1; then + CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer" + fi if test $debug -eq 1; then CFLAGS="${CFLAGS} -DZLIB_DEBUG" SFLAGS="${SFLAGS} -DZLIB_DEBUG" @@ -207,47 +227,54 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then uname=`(uname -s || echo unknown) 2>/dev/null` fi case "$uname" in - Linux* | linux* | GNU | GNU/* | solaris*) + Linux* | linux* | *-linux* | GNU | GNU/* | solaris*) + case "$mname" in + *sparc*) + LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;; + esac LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;; *BSD | *bsd* | DragonFly) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} LDCONFIG="ldconfig -m" ;; - CYGWIN* | Cygwin* | cygwin* | OS/2*) + CYGWIN* | Cygwin* | cygwin* | *-cygwin* | OS/2*) EXE='.exe' ;; - MINGW* | mingw*) -# temporary bypass + MINGW* | mingw* | *-mingw*) rm -f $test.[co] $test $test$shared_ext - echo "Please use win32/Makefile.gcc instead." | tee -a configure.log - leave 1 + echo "If this doesn't work for you, try win32/Makefile.gcc." | tee -a configure.log LDSHARED=${LDSHARED-"$cc -shared"} LDSHAREDLIBC="" EXE='.exe' ;; - QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 - # (alain.bonnefoy@icbt.com) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; + QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 + # (alain.bonnefoy@icbt.com) + LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; HP-UX*) - LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so' ;; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl' ;; - esac ;; - Darwin* | darwin*) - shared_ext='.dylib' - SHAREDLIB=libz$shared_ext - SHAREDLIBV=libz.$VER$shared_ext - SHAREDLIBM=libz.$VER1$shared_ext - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} - if libtool -V 2>&1 | grep Apple > /dev/null; then - AR="libtool" - else - AR="/usr/bin/libtool" - fi - ARFLAGS="-o" ;; - *) LDSHARED=${LDSHARED-"$cc -shared"} ;; + LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} + case `(uname -m || echo unknown) 2>/dev/null` in + ia64) + shared_ext='.so' + SHAREDLIB='libz.so' ;; + *) + shared_ext='.sl' + SHAREDLIB='libz.sl' ;; + esac ;; + AIX*) + LDFLAGS="${LDFLAGS} -Wl,-brtl" ;; + Darwin* | darwin* | *-darwin*) + shared_ext='.dylib' + SHAREDLIB=libz$shared_ext + SHAREDLIBV=libz.$VER$shared_ext + SHAREDLIBM=libz.$VER1$shared_ext + LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} + if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then + AR="${CROSS_PREFIX}libtool" + elif libtool -V 2>&1 | grep Apple > /dev/null; then + AR="libtool" + else + AR="/usr/bin/libtool" + fi + ARFLAGS="-o" ;; + *) + LDSHARED=${LDSHARED-"$cc -shared"} ;; esac else # find system name and corresponding cc options @@ -367,8 +394,11 @@ else try() { show $* - ( $* ) >> configure.log 2>&1 + got=`( $* ) 2>&1` ret=$? + if test "$got" != ""; then + printf "%s\n" "$got" >> configure.log + fi if test $ret -ne 0; then echo "(exit code "$ret")" >> configure.log fi @@ -381,8 +411,11 @@ tryboth() show $* got=`( $* ) 2>&1` ret=$? - printf %s "$got" >> configure.log + if test "$got" != ""; then + printf "%s\n" "$got" >> configure.log + fi if test $ret -ne 0; then + echo "(exit code "$ret")" >> configure.log return $ret fi test "$got" = "" @@ -409,7 +442,7 @@ EOF if test $shared -eq 1; then echo Checking for shared library support... | tee -a configure.log # we must test in two steps (cc then ld), required at least on SunOS 4.x - if try $CC -w -c $SFLAGS $test.c && + if try $CC -c $SFLAGS $test.c && try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log elif test -z "$old_cc" -a -z "$old_cflags"; then @@ -433,20 +466,6 @@ else TEST="all teststatic testshared" fi -# check for underscores in external names for use by assembler code -CPP=${CPP-"$CC -E"} -case $CFLAGS in - *ASMV*) - echo >> configure.log - show "$NM $test.o | grep _hello" - if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then - CPP="$CPP -DNO_UNDERLINE" - echo Checking for underline in external names... No. | tee -a configure.log - else - echo Checking for underline in external names... Yes. | tee -a configure.log - fi ;; -esac - echo >> configure.log # check for size_t @@ -457,17 +476,11 @@ size_t dummy = 0; EOF if try $CC -c $CFLAGS $test.c; then echo "Checking for size_t... Yes." | tee -a configure.log - need_sizet=0 else echo "Checking for size_t... No." | tee -a configure.log - need_sizet=1 -fi - -echo >> configure.log - -# find the size_t integer type, if needed -if test $need_sizet -eq 1; then - cat > $test.c < $test.c << EOF long long dummy = 0; EOF if try $CC -c $CFLAGS $test.c; then @@ -495,17 +508,13 @@ EOF if try $CC $CFLAGS -o $test $test.c; then sizet=`./$test` echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log + CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" + SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}" else - echo "Failed to find a pointer-size integer type." | tee -a configure.log - leave 1 + echo "Checking for a pointer-size integer type... not found." | tee -a configure.log fi fi -if test $need_sizet -eq 1; then - CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" - SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}" -fi - echo >> configure.log # check for large file support, and if none, check for fseeko() @@ -849,7 +858,6 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log echo STATICLIB = $STATICLIB >> configure.log echo TEST = $TEST >> configure.log echo VER = $VER >> configure.log -echo Z_U4 = $Z_U4 >> configure.log echo SRCDIR = $SRCDIR >> configure.log echo exec_prefix = $exec_prefix >> configure.log echo includedir = $includedir >> configure.log @@ -859,7 +867,7 @@ echo prefix = $prefix >> configure.log echo sharedlibdir = $sharedlibdir >> configure.log echo uname = $uname >> configure.log -# udpate Makefile with the configure results +# update Makefile with the configure results sed < ${SRCDIR}Makefile.in " /^CC *=/s#=.*#=$CC# /^CFLAGS *=/s#=.*#=$CFLAGS# diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/crc32.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/crc32.c index cd67cb3682b5f7..6c38f5c04c6a87 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/crc32.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/crc32.c @@ -1,12 +1,10 @@ /* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + * This interleaved implementation of a CRC makes use of pipelined multiple + * arithmetic-logic units, commonly found in modern CPU cores. It is due to + * Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution. */ /* @(#) $Id$ */ @@ -14,11 +12,12 @@ /* Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore protection on the static variables used to control the first-use generation - of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should first call get_crc_table() to initialize the tables before allowing more than one thread to use crc32(). - DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. + MAKECRCH can be #defined to write out crc32.h. A main() routine is also + produced, so that this one source file can be compiled to an executable. */ #ifdef MAKECRCH @@ -28,415 +27,1023 @@ # endif /* !DYNAMIC_CRC_TABLE */ #endif /* MAKECRCH */ -#include "zutil.h" /* for STDC and FAR definitions */ +#include "zutil.h" /* for Z_U4, Z_U8, z_crc_t, and FAR definitions */ -/* Definitions for doing the crc four data bytes at a time. */ -#if !defined(NOBYFOUR) && defined(Z_U4) -# define BYFOUR + /* + A CRC of a message is computed on N braids of words in the message, where + each word consists of W bytes (4 or 8). If N is 3, for example, then three + running sparse CRCs are calculated respectively on each braid, at these + indices in the array of words: 0, 3, 6, ..., 1, 4, 7, ..., and 2, 5, 8, ... + This is done starting at a word boundary, and continues until as many blocks + of N * W bytes as are available have been processed. The results are combined + into a single CRC at the end. For this code, N must be in the range 1..6 and + W must be 4 or 8. The upper limit on N can be increased if desired by adding + more #if blocks, extending the patterns apparent in the code. In addition, + crc32.h would need to be regenerated, if the maximum N value is increased. + + N and W are chosen empirically by benchmarking the execution time on a given + processor. The choices for N and W below were based on testing on Intel Kaby + Lake i7, AMD Ryzen 7, ARM Cortex-A57, Sparc64-VII, PowerPC POWER9, and MIPS64 + Octeon II processors. The Intel, AMD, and ARM processors were all fastest + with N=5, W=8. The Sparc, PowerPC, and MIPS64 were all fastest at N=5, W=4. + They were all tested with either gcc or clang, all using the -O3 optimization + level. Your mileage may vary. + */ + +/* Define N */ +#ifdef Z_TESTN +# define N Z_TESTN +#else +# define N 5 +#endif +#if N < 1 || N > 6 +# error N must be in 1..6 #endif -#ifdef BYFOUR - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, z_size_t)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, z_size_t)); -# define TBLS 8 + +/* + z_crc_t must be at least 32 bits. z_word_t must be at least as long as + z_crc_t. It is assumed here that z_word_t is either 32 bits or 64 bits, and + that bytes are eight bits. + */ + +/* + Define W and the associated z_word_t type. If W is not defined, then a + braided calculation is not used, and the associated tables and code are not + compiled. + */ +#ifdef Z_TESTW +# if Z_TESTW-1 != -1 +# define W Z_TESTW +# endif #else -# define TBLS 1 -#endif /* BYFOUR */ +# ifdef MAKECRCH +# define W 8 /* required for MAKECRCH */ +# else +# if defined(__x86_64__) || defined(__aarch64__) +# define W 8 +# else +# define W 4 +# endif +# endif +#endif +#ifdef W +# if W == 8 && defined(Z_U8) + typedef Z_U8 z_word_t; +# elif defined(Z_U4) +# undef W +# define W 4 + typedef Z_U4 z_word_t; +# else +# undef W +# endif +#endif -/* Local functions for crc concatenation */ -local unsigned long gf2_matrix_times OF((unsigned long *mat, - unsigned long vec)); -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); -local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); +/* If available, use the ARM processor CRC32 instruction. */ +#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 +# define ARMCRC32 +#endif +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) +/* + Swap the bytes in a z_word_t to convert between little and big endian. Any + self-respecting compiler will optimize this to a single machine byte-swap + instruction, if one is available. This assumes that word_t is either 32 bits + or 64 bits. + */ +local z_word_t byte_swap(z_word_t word) { +# if W == 8 + return + (word & 0xff00000000000000) >> 56 | + (word & 0xff000000000000) >> 40 | + (word & 0xff0000000000) >> 24 | + (word & 0xff00000000) >> 8 | + (word & 0xff000000) << 8 | + (word & 0xff0000) << 24 | + (word & 0xff00) << 40 | + (word & 0xff) << 56; +# else /* W == 4 */ + return + (word & 0xff000000) >> 24 | + (word & 0xff0000) >> 8 | + (word & 0xff00) << 8 | + (word & 0xff) << 24; +# endif +} +#endif #ifdef DYNAMIC_CRC_TABLE +/* ========================================================================= + * Table of powers of x for combining CRC-32s, filled in by make_crc_table() + * below. + */ + local z_crc_t FAR x2n_table[32]; +#else +/* ========================================================================= + * Tables for byte-wise and braided CRC-32 calculations, and a table of powers + * of x for combining CRC-32s, all made by make_crc_table(). + */ +# include "crc32.h" +#endif + +/* CRC polynomial. */ +#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */ -local volatile int crc_table_empty = 1; -local z_crc_t FAR crc_table[TBLS][256]; -local void make_crc_table OF((void)); +/* + Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, + reflected. For speed, this requires that a not be zero. + */ +local z_crc_t multmodp(z_crc_t a, z_crc_t b) { + z_crc_t m, p; + + m = (z_crc_t)1 << 31; + p = 0; + for (;;) { + if (a & m) { + p ^= b; + if ((a & (m - 1)) == 0) + break; + } + m >>= 1; + b = b & 1 ? (b >> 1) ^ POLY : b >> 1; + } + return p; +} + +/* + Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been + initialized. + */ +local z_crc_t x2nmodp(z_off64_t n, unsigned k) { + z_crc_t p; + + p = (z_crc_t)1 << 31; /* x^0 == 1 */ + while (n) { + if (n & 1) + p = multmodp(x2n_table[k & 31], p); + n >>= 1; + k++; + } + return p; +} + +#ifdef DYNAMIC_CRC_TABLE +/* ========================================================================= + * Build the tables for byte-wise and braided CRC-32 calculations, and a table + * of powers of x for combining CRC-32s. + */ +local z_crc_t FAR crc_table[256]; +#ifdef W + local z_word_t FAR crc_big_table[256]; + local z_crc_t FAR crc_braid_table[W][256]; + local z_word_t FAR crc_braid_big_table[W][256]; + local void braid(z_crc_t [][256], z_word_t [][256], int, int); +#endif #ifdef MAKECRCH - local void write_table OF((FILE *, const z_crc_t FAR *)); + local void write_table(FILE *, const z_crc_t FAR *, int); + local void write_table32hi(FILE *, const z_word_t FAR *, int); + local void write_table64(FILE *, const z_word_t FAR *, int); #endif /* MAKECRCH */ + +/* + Define a once() function depending on the availability of atomics. If this is + compiled with DYNAMIC_CRC_TABLE defined, and if CRCs will be computed in + multiple threads, and if atomics are not available, then get_crc_table() must + be called to initialize the tables and must return before any threads are + allowed to compute or combine CRCs. + */ + +/* Definition of once functionality. */ +typedef struct once_s once_t; + +/* Check for the availability of atomics. */ +#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \ + !defined(__STDC_NO_ATOMICS__) + +#include + +/* Structure for once(), which must be initialized with ONCE_INIT. */ +struct once_s { + atomic_flag begun; + atomic_int done; +}; +#define ONCE_INIT {ATOMIC_FLAG_INIT, 0} + +/* + Run the provided init() function exactly once, even if multiple threads + invoke once() at the same time. The state must be a once_t initialized with + ONCE_INIT. + */ +local void once(once_t *state, void (*init)(void)) { + if (!atomic_load(&state->done)) { + if (atomic_flag_test_and_set(&state->begun)) + while (!atomic_load(&state->done)) + ; + else { + init(); + atomic_store(&state->done, 1); + } + } +} + +#else /* no atomics */ + +/* Structure for once(), which must be initialized with ONCE_INIT. */ +struct once_s { + volatile int begun; + volatile int done; +}; +#define ONCE_INIT {0, 0} + +/* Test and set. Alas, not atomic, but tries to minimize the period of + vulnerability. */ +local int test_and_set(int volatile *flag) { + int was; + + was = *flag; + *flag = 1; + return was; +} + +/* Run the provided init() function once. This is not thread-safe. */ +local void once(once_t *state, void (*init)(void)) { + if (!state->done) { + if (test_and_set(&state->begun)) + while (!state->done) + ; + else { + init(); + state->done = 1; + } + } +} + +#endif + +/* State for once(). */ +local once_t made = ONCE_INIT; + /* Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials + with the lowest powers in the most significant bit. Then adding polynomials is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the + one. If we call the above polynomial p, and represent a byte as the polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + byte 0xb1 is the polynomial x^7+x^3+x^2+1), then the CRC is (q*x^32) mod p, where a mod b means the remainder after dividing a by b. This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each + taking the remainder. The register is initialized to zero, and for each incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ -local void make_crc_table() -{ - z_crc_t c; - int n, k; - z_crc_t poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static volatile int first = 1; /* flag to limit concurrent making */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* See if another task is already doing this (not thread-safe, but better - than nothing -- significantly reduces duration of vulnerability in - case the advice about DYNAMIC_CRC_TABLE is ignored) */ - if (first) { - first = 0; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0; - for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) - poly |= (z_crc_t)1 << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (z_crc_t)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x + (which is shifting right by one and adding x^32 mod p if the bit shifted out + is a one). We start with the highest power (least significant bit) of q and + repeat for all eight bits of q. -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = ZSWAP32(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = ZSWAP32(c); - } - } -#endif /* BYFOUR */ + The table is simply the CRC of all possible eight bit values. This is all the + information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. + */ - crc_table_empty = 0; - } - else { /* not first */ - /* wait for the other task to finish (not efficient, but rare) */ - while (crc_table_empty) - ; +local void make_crc_table(void) { + unsigned i, j, n; + z_crc_t p; + + /* initialize the CRC of bytes tables */ + for (i = 0; i < 256; i++) { + p = i; + for (j = 0; j < 8; j++) + p = p & 1 ? (p >> 1) ^ POLY : p >> 1; + crc_table[i] = p; +#ifdef W + crc_big_table[i] = byte_swap(p); +#endif } + /* initialize the x^2^n mod p(x) table */ + p = (z_crc_t)1 << 30; /* x^1 */ + x2n_table[0] = p; + for (n = 1; n < 32; n++) + x2n_table[n] = p = multmodp(p, p); + +#ifdef W + /* initialize the braiding tables -- needs x2n_table[] */ + braid(crc_braid_table, crc_braid_big_table, N, W); +#endif + #ifdef MAKECRCH - /* write out CRC tables to crc32.h */ { + /* + The crc32.h header file contains tables for both 32-bit and 64-bit + z_word_t's, and so requires a 64-bit type be available. In that case, + z_word_t must be defined to be 64-bits. This code then also generates + and writes out the tables for the case that z_word_t is 32 bits. + */ +#if !defined(W) || W != 8 +# error Need a 64-bit integer type in order to generate crc32.h. +#endif FILE *out; + int k, n; + z_crc_t ltl[8][256]; + z_word_t big[8][256]; out = fopen("crc32.h", "w"); if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const z_crc_t FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); + + /* write out little-endian CRC table to crc32.h */ + fprintf(out, + "/* crc32.h -- tables for rapid CRC calculation\n" + " * Generated automatically by crc32.c\n */\n" + "\n" + "local const z_crc_t FAR crc_table[] = {\n" + " "); + write_table(out, crc_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#ifdef W\n" + "\n" + "#if W == 8\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table64(out, crc_big_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table32hi(out, crc_big_table, 256); + fprintf(out, + "};\n" + "\n" + "#endif\n"); + + /* write out braid tables for each value of N */ + for (n = 1; n <= 6; n++) { + fprintf(out, + "\n" + "#if N == %d\n", n); + + /* compute braid tables for this N and 64-bit word_t */ + braid(ltl, big, n, 8); + + /* write out braid tables for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#if W == 8\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table64(out, big[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n"); + + /* compute braid tables for this N and 32-bit word_t */ + braid(ltl, big, n, 4); + + /* write out braid tables for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table32hi(out, big[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "#endif\n" + "\n" + "#endif\n"); } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); + fprintf(out, + "\n" + "#endif\n"); + + /* write out zeros operator table to crc32.h */ + fprintf(out, + "\n" + "local const z_crc_t FAR x2n_table[] = {\n" + " "); + write_table(out, x2n_table, 32); + fprintf(out, + "};\n"); fclose(out); } #endif /* MAKECRCH */ } #ifdef MAKECRCH -local void write_table(out, table) - FILE *out; - const z_crc_t FAR *table; -{ + +/* + Write the 32-bit values in table[0..k-1] to out, five per line in + hexadecimal separated by commas. + */ +local void write_table(FILE *out, const z_crc_t FAR *table, int k) { int n; - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", (unsigned long)(table[n]), - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); +} + +/* + Write the high 32-bits of each value in table[0..k-1] to out, five per line + in hexadecimal separated by commas. + */ +local void write_table32hi(FILE *out, const z_word_t FAR *table, int k) { + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", + (unsigned long)(table[n] >> 32), + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); +} + +/* + Write the 64-bit values in table[0..k-1] to out, three per line in + hexadecimal separated by commas. This assumes that if there is a 64-bit + type, then there is also a long long integer type, and it is at least 64 + bits. If not, then the type cast and format string can be adjusted + accordingly. + */ +local void write_table64(FILE *out, const z_word_t FAR *table, int k) { + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%016llx%s", n == 0 || n % 3 ? "" : " ", + (unsigned long long)(table[n]), + n == k - 1 ? "" : (n % 3 == 2 ? ",\n" : ", ")); +} + +/* Actually do the deed. */ +int main(void) { + make_crc_table(); + return 0; } + #endif /* MAKECRCH */ -#else /* !DYNAMIC_CRC_TABLE */ -/* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). +#ifdef W +/* + Generate the little and big-endian braid tables for the given n and z_word_t + size w. Each array must have room for w blocks of 256 elements. */ -#include "crc32.h" +local void braid(z_crc_t ltl[][256], z_word_t big[][256], int n, int w) { + int k; + z_crc_t i, p, q; + for (k = 0; k < w; k++) { + p = x2nmodp((n * w + 3 - k) << 3, 0); + ltl[k][0] = 0; + big[w - 1 - k][0] = 0; + for (i = 1; i < 256; i++) { + ltl[k][i] = q = multmodp(i << 24, p); + big[w - 1 - k][i] = byte_swap(q); + } + } +} +#endif + #endif /* DYNAMIC_CRC_TABLE */ /* ========================================================================= - * This function can be used by asm versions of crc32() + * This function can be used by asm versions of crc32(), and to force the + * generation of the CRC tables in a threaded application. */ -const z_crc_t FAR * ZEXPORT get_crc_table() -{ +const z_crc_t FAR * ZEXPORT get_crc_table(void) { #ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); + once(&made, make_crc_table); #endif /* DYNAMIC_CRC_TABLE */ return (const z_crc_t FAR *)crc_table; } -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 +/* ========================================================================= + * Use ARM machine instructions if available. This will compute the CRC about + * ten times faster than the braided calculation. This code does not check for + * the presence of the CRC instruction at run time. __ARM_FEATURE_CRC32 will + * only be defined if the compilation specifies an ARM processor architecture + * that has the instructions. For example, compiling with -march=armv8.1-a or + * -march=armv8-a+crc, or -march=native if the compile machine has the crc32 + * instructions. + */ +#ifdef ARMCRC32 -/* ========================================================================= */ -unsigned long ZEXPORT crc32_z(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - if (buf == Z_NULL) return 0UL; +/* + Constants empirically determined to maximize speed. These values are from + measurements on a Cortex-A57. Your mileage may vary. + */ +#define Z_BATCH 3990 /* number of words in a batch */ +#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */ +#define Z_BATCH_MIN 800 /* fewest words in a final batch */ + +unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf, + z_size_t len) { + z_crc_t val; + z_word_t crc1, crc2; + const z_word_t *word; + z_word_t val0, val1, val2; + z_size_t last, last2, i; + z_size_t num; + + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; #ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); + once(&made, make_crc_table); #endif /* DYNAMIC_CRC_TABLE */ -#ifdef BYFOUR - if (sizeof(void *) == sizeof(ptrdiff_t)) { - z_crc_t endian; + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); + /* Compute the CRC up to a word boundary. */ + while (len && ((z_size_t)buf & 7) != 0) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; - while (len >= 8) { - DO8; - len -= 8; + + /* Prepare to compute the CRC on full 64-bit words word[0..num-1]. */ + word = (z_word_t const *)buf; + num = len >> 3; + len &= 7; + + /* Do three interleaved CRCs to realize the throughput of one crc32x + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ + while (num >= 3 * Z_BATCH) { + crc1 = 0; + crc2 = 0; + for (i = 0; i < Z_BATCH; i++) { + val0 = word[i]; + val1 = word[i + Z_BATCH]; + val2 = word[i + 2 * Z_BATCH]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * Z_BATCH; + num -= 3 * Z_BATCH; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc1; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc2; } - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - uInt len; -{ - return crc32_z(crc, buf, len); + /* Do one last smaller batch with the remaining words, if there are enough + to pay for the combination of CRCs. */ + last = num / 3; + if (last >= Z_BATCH_MIN) { + last2 = last << 1; + crc1 = 0; + crc2 = 0; + for (i = 0; i < last; i++) { + val0 = word[i]; + val1 = word[i + last]; + val2 = word[i + last2]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * last; + num -= 3 * last; + val = x2nmodp(last, 6); + crc = multmodp(val, crc) ^ crc1; + crc = multmodp(val, crc) ^ crc2; + } + + /* Compute the CRC on any remaining words. */ + for (i = 0; i < num; i++) { + val0 = word[i]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + } + word += num; + + /* Complete the CRC on any remaining bytes. */ + buf = (const unsigned char FAR *)word; + while (len) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); + } + + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; } -#ifdef BYFOUR +#else + +#ifdef W /* - This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit - integer pointer type. This violates the strict aliasing rule, where a - compiler can assume, for optimization purposes, that two pointers to - fundamentally different types won't ever point to the same memory. This can - manifest as a problem only if one of the pointers is written to. This code - only reads from those pointers. So long as this code remains isolated in - this compilation unit, there won't be a problem. For this reason, this code - should not be copied and pasted into a compilation unit in which other code - writes to the buffer that is passed to these routines. + Return the CRC of the W bytes in the word_t data, taking the + least-significant byte of the word as the first byte of data, without any pre + or post conditioning. This is used to combine the CRCs of each braid. */ +local z_crc_t crc_word(z_word_t data) { + int k; + for (k = 0; k < W; k++) + data = (data >> 8) ^ crc_table[data & 0xff]; + return (z_crc_t)data; +} -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 +local z_word_t crc_word_big(z_word_t data) { + int k; + for (k = 0; k < W; k++) + data = (data << 8) ^ + crc_big_table[(data >> ((W - 1) << 3)) & 0xff]; + return data; +} + +#endif /* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; - - c = (z_crc_t)crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } +unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf, + z_size_t len) { + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOLIT32; - len -= 32; - } - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; -/* ========================================================================= */ -#define DOBIG4 c ^= *buf4++; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 +#ifdef W -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; - - c = ZSWAP32((z_crc_t)crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; + /* If provided enough bytes, do a braided CRC calculation. */ + if (len >= N * W + W - 1) { + z_size_t blks; + z_word_t const *words; + unsigned endian; + int k; + + /* Compute the CRC up to a z_word_t boundary. */ + while (len && ((z_size_t)buf & (W - 1)) != 0) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + } + + /* Compute the CRC on as many N z_word_t blocks as are available. */ + blks = len / (N * W); + len -= blks * N * W; + words = (z_word_t const *)buf; + + /* Do endian check at execution time instead of compile time, since ARM + processors can change the endianness at execution time. If the + compiler knows what the endianness will be, it can optimize out the + check and the unused branch. */ + endian = 1; + if (*(unsigned char *)&endian) { + /* Little endian. */ + + z_crc_t crc0; + z_word_t word0; +#if N > 1 + z_crc_t crc1; + z_word_t word1; +#if N > 2 + z_crc_t crc2; + z_word_t word2; +#if N > 3 + z_crc_t crc3; + z_word_t word3; +#if N > 4 + z_crc_t crc4; + z_word_t word4; +#if N > 5 + z_crc_t crc5; + z_word_t word5; +#endif +#endif +#endif +#endif +#endif + + /* Initialize the CRC for each braid. */ + crc0 = crc; +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif + + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + crc = crc_word(crc0 ^ words[0]); +#if N > 1 + crc = crc_word(crc1 ^ words[1] ^ crc); +#if N > 2 + crc = crc_word(crc2 ^ words[2] ^ crc); +#if N > 3 + crc = crc_word(crc3 ^ words[3] ^ crc); +#if N > 4 + crc = crc_word(crc4 ^ words[4] ^ crc); +#if N > 5 + crc = crc_word(crc5 ^ words[5] ^ crc); +#endif +#endif +#endif +#endif +#endif + words += N; + } + else { + /* Big endian. */ + + z_word_t crc0, word0, comb; +#if N > 1 + z_word_t crc1, word1; +#if N > 2 + z_word_t crc2, word2; +#if N > 3 + z_word_t crc3, word3; +#if N > 4 + z_word_t crc4, word4; +#if N > 5 + z_word_t crc5, word5; +#endif +#endif +#endif +#endif +#endif + + /* Initialize the CRC for each braid. */ + crc0 = byte_swap(crc); +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif + + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_big_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_big_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_big_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_big_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_big_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_big_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_big_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_big_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_big_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_big_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_big_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_big_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + comb = crc_word_big(crc0 ^ words[0]); +#if N > 1 + comb = crc_word_big(crc1 ^ words[1] ^ comb); +#if N > 2 + comb = crc_word_big(crc2 ^ words[2] ^ comb); +#if N > 3 + comb = crc_word_big(crc3 ^ words[3] ^ comb); +#if N > 4 + comb = crc_word_big(crc4 ^ words[4] ^ comb); +#if N > 5 + comb = crc_word_big(crc5 ^ words[5] ^ comb); +#endif +#endif +#endif +#endif +#endif + words += N; + crc = byte_swap(comb); + } + + /* + Update the pointer to the remaining bytes to process. + */ + buf = (unsigned char const *)words; } - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOBIG32; - len -= 32; +#endif /* W */ + + /* Complete the computation of the CRC on any remaining bytes. */ + while (len >= 8) { + len -= 8; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; } - while (len >= 4) { - DOBIG4; - len -= 4; + while (len) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; } - buf = (const unsigned char FAR *)buf4; - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(ZSWAP32(c)); + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; } -#endif /* BYFOUR */ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ +#endif /* ========================================================================= */ -local unsigned long gf2_matrix_times(mat, vec) - unsigned long *mat; - unsigned long vec; -{ - unsigned long sum; - - sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; +unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, + uInt len) { + return crc32_z(crc, buf, len); } /* ========================================================================= */ -local void gf2_matrix_square(square, mat) - unsigned long *square; - unsigned long *mat; -{ - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); +uLong ZEXPORT crc32_combine64(uLong crc1, uLong crc2, z_off64_t len2) { +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff); } /* ========================================================================= */ -local uLong crc32_combine_(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - int n; - unsigned long row; - unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ - unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ - - /* degenerate case (also disallow negative lengths) */ - if (len2 <= 0) - return crc1; - - /* put operator for one zero bit in odd */ - odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ - row = 1; - for (n = 1; n < GF2_DIM; n++) { - odd[n] = row; - row <<= 1; - } +uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2) { + return crc32_combine64(crc1, crc2, (z_off64_t)len2); +} - /* put operator for two zero bits in even */ - gf2_matrix_square(even, odd); - - /* put operator for four zero bits in odd */ - gf2_matrix_square(odd, even); - - /* apply len2 zeros to crc1 (first square will put the operator for one - zero byte, eight zero bits, in even) */ - do { - /* apply zeros operator for this bit of len2 */ - gf2_matrix_square(even, odd); - if (len2 & 1) - crc1 = gf2_matrix_times(even, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - if (len2 == 0) - break; - - /* another iteration of the loop with odd and even swapped */ - gf2_matrix_square(odd, even); - if (len2 & 1) - crc1 = gf2_matrix_times(odd, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - } while (len2 != 0); - - /* return combined crc */ - crc1 ^= crc2; - return crc1; +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_gen64(z_off64_t len2) { +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return x2nmodp(len2, 3); } /* ========================================================================= */ -uLong ZEXPORT crc32_combine(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off_t len2; -{ - return crc32_combine_(crc1, crc2, len2); +uLong ZEXPORT crc32_combine_gen(z_off_t len2) { + return crc32_combine_gen64((z_off64_t)len2); } -uLong ZEXPORT crc32_combine64(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - return crc32_combine_(crc1, crc2, len2); +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op) { + return multmodp(op, crc1) ^ (crc2 & 0xffffffff); } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/crc32.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/crc32.h index 9e0c7781025148..137df68d616c5e 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/crc32.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/crc32.h @@ -2,440 +2,9445 @@ * Generated automatically by crc32.c */ -local const z_crc_t FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL +local const z_crc_t FAR crc_table[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}; + +#ifdef W + +#if W == 8 + +local const z_word_t FAR crc_big_table[] = { + 0x0000000000000000, 0x9630077700000000, 0x2c610eee00000000, + 0xba51099900000000, 0x19c46d0700000000, 0x8ff46a7000000000, + 0x35a563e900000000, 0xa395649e00000000, 0x3288db0e00000000, + 0xa4b8dc7900000000, 0x1ee9d5e000000000, 0x88d9d29700000000, + 0x2b4cb60900000000, 0xbd7cb17e00000000, 0x072db8e700000000, + 0x911dbf9000000000, 0x6410b71d00000000, 0xf220b06a00000000, + 0x4871b9f300000000, 0xde41be8400000000, 0x7dd4da1a00000000, + 0xebe4dd6d00000000, 0x51b5d4f400000000, 0xc785d38300000000, + 0x56986c1300000000, 0xc0a86b6400000000, 0x7af962fd00000000, + 0xecc9658a00000000, 0x4f5c011400000000, 0xd96c066300000000, + 0x633d0ffa00000000, 0xf50d088d00000000, 0xc8206e3b00000000, + 0x5e10694c00000000, 0xe44160d500000000, 0x727167a200000000, + 0xd1e4033c00000000, 0x47d4044b00000000, 0xfd850dd200000000, + 0x6bb50aa500000000, 0xfaa8b53500000000, 0x6c98b24200000000, + 0xd6c9bbdb00000000, 0x40f9bcac00000000, 0xe36cd83200000000, + 0x755cdf4500000000, 0xcf0dd6dc00000000, 0x593dd1ab00000000, + 0xac30d92600000000, 0x3a00de5100000000, 0x8051d7c800000000, + 0x1661d0bf00000000, 0xb5f4b42100000000, 0x23c4b35600000000, + 0x9995bacf00000000, 0x0fa5bdb800000000, 0x9eb8022800000000, + 0x0888055f00000000, 0xb2d90cc600000000, 0x24e90bb100000000, + 0x877c6f2f00000000, 0x114c685800000000, 0xab1d61c100000000, + 0x3d2d66b600000000, 0x9041dc7600000000, 0x0671db0100000000, + 0xbc20d29800000000, 0x2a10d5ef00000000, 0x8985b17100000000, + 0x1fb5b60600000000, 0xa5e4bf9f00000000, 0x33d4b8e800000000, + 0xa2c9077800000000, 0x34f9000f00000000, 0x8ea8099600000000, + 0x18980ee100000000, 0xbb0d6a7f00000000, 0x2d3d6d0800000000, + 0x976c649100000000, 0x015c63e600000000, 0xf4516b6b00000000, + 0x62616c1c00000000, 0xd830658500000000, 0x4e0062f200000000, + 0xed95066c00000000, 0x7ba5011b00000000, 0xc1f4088200000000, + 0x57c40ff500000000, 0xc6d9b06500000000, 0x50e9b71200000000, + 0xeab8be8b00000000, 0x7c88b9fc00000000, 0xdf1ddd6200000000, + 0x492dda1500000000, 0xf37cd38c00000000, 0x654cd4fb00000000, + 0x5861b24d00000000, 0xce51b53a00000000, 0x7400bca300000000, + 0xe230bbd400000000, 0x41a5df4a00000000, 0xd795d83d00000000, + 0x6dc4d1a400000000, 0xfbf4d6d300000000, 0x6ae9694300000000, + 0xfcd96e3400000000, 0x468867ad00000000, 0xd0b860da00000000, + 0x732d044400000000, 0xe51d033300000000, 0x5f4c0aaa00000000, + 0xc97c0ddd00000000, 0x3c71055000000000, 0xaa41022700000000, + 0x10100bbe00000000, 0x86200cc900000000, 0x25b5685700000000, + 0xb3856f2000000000, 0x09d466b900000000, 0x9fe461ce00000000, + 0x0ef9de5e00000000, 0x98c9d92900000000, 0x2298d0b000000000, + 0xb4a8d7c700000000, 0x173db35900000000, 0x810db42e00000000, + 0x3b5cbdb700000000, 0xad6cbac000000000, 0x2083b8ed00000000, + 0xb6b3bf9a00000000, 0x0ce2b60300000000, 0x9ad2b17400000000, + 0x3947d5ea00000000, 0xaf77d29d00000000, 0x1526db0400000000, + 0x8316dc7300000000, 0x120b63e300000000, 0x843b649400000000, + 0x3e6a6d0d00000000, 0xa85a6a7a00000000, 0x0bcf0ee400000000, + 0x9dff099300000000, 0x27ae000a00000000, 0xb19e077d00000000, + 0x44930ff000000000, 0xd2a3088700000000, 0x68f2011e00000000, + 0xfec2066900000000, 0x5d5762f700000000, 0xcb67658000000000, + 0x71366c1900000000, 0xe7066b6e00000000, 0x761bd4fe00000000, + 0xe02bd38900000000, 0x5a7ada1000000000, 0xcc4add6700000000, + 0x6fdfb9f900000000, 0xf9efbe8e00000000, 0x43beb71700000000, + 0xd58eb06000000000, 0xe8a3d6d600000000, 0x7e93d1a100000000, + 0xc4c2d83800000000, 0x52f2df4f00000000, 0xf167bbd100000000, + 0x6757bca600000000, 0xdd06b53f00000000, 0x4b36b24800000000, + 0xda2b0dd800000000, 0x4c1b0aaf00000000, 0xf64a033600000000, + 0x607a044100000000, 0xc3ef60df00000000, 0x55df67a800000000, + 0xef8e6e3100000000, 0x79be694600000000, 0x8cb361cb00000000, + 0x1a8366bc00000000, 0xa0d26f2500000000, 0x36e2685200000000, + 0x95770ccc00000000, 0x03470bbb00000000, 0xb916022200000000, + 0x2f26055500000000, 0xbe3bbac500000000, 0x280bbdb200000000, + 0x925ab42b00000000, 0x046ab35c00000000, 0xa7ffd7c200000000, + 0x31cfd0b500000000, 0x8b9ed92c00000000, 0x1daede5b00000000, + 0xb0c2649b00000000, 0x26f263ec00000000, 0x9ca36a7500000000, + 0x0a936d0200000000, 0xa906099c00000000, 0x3f360eeb00000000, + 0x8567077200000000, 0x1357000500000000, 0x824abf9500000000, + 0x147ab8e200000000, 0xae2bb17b00000000, 0x381bb60c00000000, + 0x9b8ed29200000000, 0x0dbed5e500000000, 0xb7efdc7c00000000, + 0x21dfdb0b00000000, 0xd4d2d38600000000, 0x42e2d4f100000000, + 0xf8b3dd6800000000, 0x6e83da1f00000000, 0xcd16be8100000000, + 0x5b26b9f600000000, 0xe177b06f00000000, 0x7747b71800000000, + 0xe65a088800000000, 0x706a0fff00000000, 0xca3b066600000000, + 0x5c0b011100000000, 0xff9e658f00000000, 0x69ae62f800000000, + 0xd3ff6b6100000000, 0x45cf6c1600000000, 0x78e20aa000000000, + 0xeed20dd700000000, 0x5483044e00000000, 0xc2b3033900000000, + 0x612667a700000000, 0xf71660d000000000, 0x4d47694900000000, + 0xdb776e3e00000000, 0x4a6ad1ae00000000, 0xdc5ad6d900000000, + 0x660bdf4000000000, 0xf03bd83700000000, 0x53aebca900000000, + 0xc59ebbde00000000, 0x7fcfb24700000000, 0xe9ffb53000000000, + 0x1cf2bdbd00000000, 0x8ac2baca00000000, 0x3093b35300000000, + 0xa6a3b42400000000, 0x0536d0ba00000000, 0x9306d7cd00000000, + 0x2957de5400000000, 0xbf67d92300000000, 0x2e7a66b300000000, + 0xb84a61c400000000, 0x021b685d00000000, 0x942b6f2a00000000, + 0x37be0bb400000000, 0xa18e0cc300000000, 0x1bdf055a00000000, + 0x8def022d00000000}; + +#else /* W == 4 */ + +local const z_word_t FAR crc_big_table[] = { + 0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, + 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, + 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, + 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, + 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, + 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, + 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, + 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, + 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, + 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, + 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, + 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, + 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, + 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, + 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, + 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, + 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, + 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, + 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, + 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, + 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, + 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, + 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, + 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, + 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, + 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, + 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, + 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, + 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, + 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, + 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, + 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, + 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, + 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, + 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, + 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, + 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, + 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, + 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, + 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, + 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, + 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, + 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, + 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, + 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, + 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, + 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, + 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, + 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, + 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, + 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, + 0x8def022d}; + +#endif + +#if N == 1 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xccaa009e, 0x4225077d, 0x8e8f07e3, 0x844a0efa, + 0x48e00e64, 0xc66f0987, 0x0ac50919, 0xd3e51bb5, 0x1f4f1b2b, + 0x91c01cc8, 0x5d6a1c56, 0x57af154f, 0x9b0515d1, 0x158a1232, + 0xd92012ac, 0x7cbb312b, 0xb01131b5, 0x3e9e3656, 0xf23436c8, + 0xf8f13fd1, 0x345b3f4f, 0xbad438ac, 0x767e3832, 0xaf5e2a9e, + 0x63f42a00, 0xed7b2de3, 0x21d12d7d, 0x2b142464, 0xe7be24fa, + 0x69312319, 0xa59b2387, 0xf9766256, 0x35dc62c8, 0xbb53652b, + 0x77f965b5, 0x7d3c6cac, 0xb1966c32, 0x3f196bd1, 0xf3b36b4f, + 0x2a9379e3, 0xe639797d, 0x68b67e9e, 0xa41c7e00, 0xaed97719, + 0x62737787, 0xecfc7064, 0x205670fa, 0x85cd537d, 0x496753e3, + 0xc7e85400, 0x0b42549e, 0x01875d87, 0xcd2d5d19, 0x43a25afa, + 0x8f085a64, 0x562848c8, 0x9a824856, 0x140d4fb5, 0xd8a74f2b, + 0xd2624632, 0x1ec846ac, 0x9047414f, 0x5ced41d1, 0x299dc2ed, + 0xe537c273, 0x6bb8c590, 0xa712c50e, 0xadd7cc17, 0x617dcc89, + 0xeff2cb6a, 0x2358cbf4, 0xfa78d958, 0x36d2d9c6, 0xb85dde25, + 0x74f7debb, 0x7e32d7a2, 0xb298d73c, 0x3c17d0df, 0xf0bdd041, + 0x5526f3c6, 0x998cf358, 0x1703f4bb, 0xdba9f425, 0xd16cfd3c, + 0x1dc6fda2, 0x9349fa41, 0x5fe3fadf, 0x86c3e873, 0x4a69e8ed, + 0xc4e6ef0e, 0x084cef90, 0x0289e689, 0xce23e617, 0x40ace1f4, + 0x8c06e16a, 0xd0eba0bb, 0x1c41a025, 0x92cea7c6, 0x5e64a758, + 0x54a1ae41, 0x980baedf, 0x1684a93c, 0xda2ea9a2, 0x030ebb0e, + 0xcfa4bb90, 0x412bbc73, 0x8d81bced, 0x8744b5f4, 0x4beeb56a, + 0xc561b289, 0x09cbb217, 0xac509190, 0x60fa910e, 0xee7596ed, + 0x22df9673, 0x281a9f6a, 0xe4b09ff4, 0x6a3f9817, 0xa6959889, + 0x7fb58a25, 0xb31f8abb, 0x3d908d58, 0xf13a8dc6, 0xfbff84df, + 0x37558441, 0xb9da83a2, 0x7570833c, 0x533b85da, 0x9f918544, + 0x111e82a7, 0xddb48239, 0xd7718b20, 0x1bdb8bbe, 0x95548c5d, + 0x59fe8cc3, 0x80de9e6f, 0x4c749ef1, 0xc2fb9912, 0x0e51998c, + 0x04949095, 0xc83e900b, 0x46b197e8, 0x8a1b9776, 0x2f80b4f1, + 0xe32ab46f, 0x6da5b38c, 0xa10fb312, 0xabcaba0b, 0x6760ba95, + 0xe9efbd76, 0x2545bde8, 0xfc65af44, 0x30cfafda, 0xbe40a839, + 0x72eaa8a7, 0x782fa1be, 0xb485a120, 0x3a0aa6c3, 0xf6a0a65d, + 0xaa4de78c, 0x66e7e712, 0xe868e0f1, 0x24c2e06f, 0x2e07e976, + 0xe2ade9e8, 0x6c22ee0b, 0xa088ee95, 0x79a8fc39, 0xb502fca7, + 0x3b8dfb44, 0xf727fbda, 0xfde2f2c3, 0x3148f25d, 0xbfc7f5be, + 0x736df520, 0xd6f6d6a7, 0x1a5cd639, 0x94d3d1da, 0x5879d144, + 0x52bcd85d, 0x9e16d8c3, 0x1099df20, 0xdc33dfbe, 0x0513cd12, + 0xc9b9cd8c, 0x4736ca6f, 0x8b9ccaf1, 0x8159c3e8, 0x4df3c376, + 0xc37cc495, 0x0fd6c40b, 0x7aa64737, 0xb60c47a9, 0x3883404a, + 0xf42940d4, 0xfeec49cd, 0x32464953, 0xbcc94eb0, 0x70634e2e, + 0xa9435c82, 0x65e95c1c, 0xeb665bff, 0x27cc5b61, 0x2d095278, + 0xe1a352e6, 0x6f2c5505, 0xa386559b, 0x061d761c, 0xcab77682, + 0x44387161, 0x889271ff, 0x825778e6, 0x4efd7878, 0xc0727f9b, + 0x0cd87f05, 0xd5f86da9, 0x19526d37, 0x97dd6ad4, 0x5b776a4a, + 0x51b26353, 0x9d1863cd, 0x1397642e, 0xdf3d64b0, 0x83d02561, + 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, + 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, + 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd, + 0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, + 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, + 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, + 0x264b06e6}, + {0x00000000, 0xa6770bb4, 0x979f1129, 0x31e81a9d, 0xf44f2413, + 0x52382fa7, 0x63d0353a, 0xc5a73e8e, 0x33ef4e67, 0x959845d3, + 0xa4705f4e, 0x020754fa, 0xc7a06a74, 0x61d761c0, 0x503f7b5d, + 0xf64870e9, 0x67de9cce, 0xc1a9977a, 0xf0418de7, 0x56368653, + 0x9391b8dd, 0x35e6b369, 0x040ea9f4, 0xa279a240, 0x5431d2a9, + 0xf246d91d, 0xc3aec380, 0x65d9c834, 0xa07ef6ba, 0x0609fd0e, + 0x37e1e793, 0x9196ec27, 0xcfbd399c, 0x69ca3228, 0x582228b5, + 0xfe552301, 0x3bf21d8f, 0x9d85163b, 0xac6d0ca6, 0x0a1a0712, + 0xfc5277fb, 0x5a257c4f, 0x6bcd66d2, 0xcdba6d66, 0x081d53e8, + 0xae6a585c, 0x9f8242c1, 0x39f54975, 0xa863a552, 0x0e14aee6, + 0x3ffcb47b, 0x998bbfcf, 0x5c2c8141, 0xfa5b8af5, 0xcbb39068, + 0x6dc49bdc, 0x9b8ceb35, 0x3dfbe081, 0x0c13fa1c, 0xaa64f1a8, + 0x6fc3cf26, 0xc9b4c492, 0xf85cde0f, 0x5e2bd5bb, 0x440b7579, + 0xe27c7ecd, 0xd3946450, 0x75e36fe4, 0xb044516a, 0x16335ade, + 0x27db4043, 0x81ac4bf7, 0x77e43b1e, 0xd19330aa, 0xe07b2a37, + 0x460c2183, 0x83ab1f0d, 0x25dc14b9, 0x14340e24, 0xb2430590, + 0x23d5e9b7, 0x85a2e203, 0xb44af89e, 0x123df32a, 0xd79acda4, + 0x71edc610, 0x4005dc8d, 0xe672d739, 0x103aa7d0, 0xb64dac64, + 0x87a5b6f9, 0x21d2bd4d, 0xe47583c3, 0x42028877, 0x73ea92ea, + 0xd59d995e, 0x8bb64ce5, 0x2dc14751, 0x1c295dcc, 0xba5e5678, + 0x7ff968f6, 0xd98e6342, 0xe86679df, 0x4e11726b, 0xb8590282, + 0x1e2e0936, 0x2fc613ab, 0x89b1181f, 0x4c162691, 0xea612d25, + 0xdb8937b8, 0x7dfe3c0c, 0xec68d02b, 0x4a1fdb9f, 0x7bf7c102, + 0xdd80cab6, 0x1827f438, 0xbe50ff8c, 0x8fb8e511, 0x29cfeea5, + 0xdf879e4c, 0x79f095f8, 0x48188f65, 0xee6f84d1, 0x2bc8ba5f, + 0x8dbfb1eb, 0xbc57ab76, 0x1a20a0c2, 0x8816eaf2, 0x2e61e146, + 0x1f89fbdb, 0xb9fef06f, 0x7c59cee1, 0xda2ec555, 0xebc6dfc8, + 0x4db1d47c, 0xbbf9a495, 0x1d8eaf21, 0x2c66b5bc, 0x8a11be08, + 0x4fb68086, 0xe9c18b32, 0xd82991af, 0x7e5e9a1b, 0xefc8763c, + 0x49bf7d88, 0x78576715, 0xde206ca1, 0x1b87522f, 0xbdf0599b, + 0x8c184306, 0x2a6f48b2, 0xdc27385b, 0x7a5033ef, 0x4bb82972, + 0xedcf22c6, 0x28681c48, 0x8e1f17fc, 0xbff70d61, 0x198006d5, + 0x47abd36e, 0xe1dcd8da, 0xd034c247, 0x7643c9f3, 0xb3e4f77d, + 0x1593fcc9, 0x247be654, 0x820cede0, 0x74449d09, 0xd23396bd, + 0xe3db8c20, 0x45ac8794, 0x800bb91a, 0x267cb2ae, 0x1794a833, + 0xb1e3a387, 0x20754fa0, 0x86024414, 0xb7ea5e89, 0x119d553d, + 0xd43a6bb3, 0x724d6007, 0x43a57a9a, 0xe5d2712e, 0x139a01c7, + 0xb5ed0a73, 0x840510ee, 0x22721b5a, 0xe7d525d4, 0x41a22e60, + 0x704a34fd, 0xd63d3f49, 0xcc1d9f8b, 0x6a6a943f, 0x5b828ea2, + 0xfdf58516, 0x3852bb98, 0x9e25b02c, 0xafcdaab1, 0x09baa105, + 0xfff2d1ec, 0x5985da58, 0x686dc0c5, 0xce1acb71, 0x0bbdf5ff, + 0xadcafe4b, 0x9c22e4d6, 0x3a55ef62, 0xabc30345, 0x0db408f1, + 0x3c5c126c, 0x9a2b19d8, 0x5f8c2756, 0xf9fb2ce2, 0xc813367f, + 0x6e643dcb, 0x982c4d22, 0x3e5b4696, 0x0fb35c0b, 0xa9c457bf, + 0x6c636931, 0xca146285, 0xfbfc7818, 0x5d8b73ac, 0x03a0a617, + 0xa5d7ada3, 0x943fb73e, 0x3248bc8a, 0xf7ef8204, 0x519889b0, + 0x6070932d, 0xc6079899, 0x304fe870, 0x9638e3c4, 0xa7d0f959, + 0x01a7f2ed, 0xc400cc63, 0x6277c7d7, 0x539fdd4a, 0xf5e8d6fe, + 0x647e3ad9, 0xc209316d, 0xf3e12bf0, 0x55962044, 0x90311eca, + 0x3646157e, 0x07ae0fe3, 0xa1d90457, 0x579174be, 0xf1e67f0a, + 0xc00e6597, 0x66796e23, 0xa3de50ad, 0x05a95b19, 0x34414184, + 0x92364a30}, + {0x00000000, 0xcb5cd3a5, 0x4dc8a10b, 0x869472ae, 0x9b914216, + 0x50cd91b3, 0xd659e31d, 0x1d0530b8, 0xec53826d, 0x270f51c8, + 0xa19b2366, 0x6ac7f0c3, 0x77c2c07b, 0xbc9e13de, 0x3a0a6170, + 0xf156b2d5, 0x03d6029b, 0xc88ad13e, 0x4e1ea390, 0x85427035, + 0x9847408d, 0x531b9328, 0xd58fe186, 0x1ed33223, 0xef8580f6, + 0x24d95353, 0xa24d21fd, 0x6911f258, 0x7414c2e0, 0xbf481145, + 0x39dc63eb, 0xf280b04e, 0x07ac0536, 0xccf0d693, 0x4a64a43d, + 0x81387798, 0x9c3d4720, 0x57619485, 0xd1f5e62b, 0x1aa9358e, + 0xebff875b, 0x20a354fe, 0xa6372650, 0x6d6bf5f5, 0x706ec54d, + 0xbb3216e8, 0x3da66446, 0xf6fab7e3, 0x047a07ad, 0xcf26d408, + 0x49b2a6a6, 0x82ee7503, 0x9feb45bb, 0x54b7961e, 0xd223e4b0, + 0x197f3715, 0xe82985c0, 0x23755665, 0xa5e124cb, 0x6ebdf76e, + 0x73b8c7d6, 0xb8e41473, 0x3e7066dd, 0xf52cb578, 0x0f580a6c, + 0xc404d9c9, 0x4290ab67, 0x89cc78c2, 0x94c9487a, 0x5f959bdf, + 0xd901e971, 0x125d3ad4, 0xe30b8801, 0x28575ba4, 0xaec3290a, + 0x659ffaaf, 0x789aca17, 0xb3c619b2, 0x35526b1c, 0xfe0eb8b9, + 0x0c8e08f7, 0xc7d2db52, 0x4146a9fc, 0x8a1a7a59, 0x971f4ae1, + 0x5c439944, 0xdad7ebea, 0x118b384f, 0xe0dd8a9a, 0x2b81593f, + 0xad152b91, 0x6649f834, 0x7b4cc88c, 0xb0101b29, 0x36846987, + 0xfdd8ba22, 0x08f40f5a, 0xc3a8dcff, 0x453cae51, 0x8e607df4, + 0x93654d4c, 0x58399ee9, 0xdeadec47, 0x15f13fe2, 0xe4a78d37, + 0x2ffb5e92, 0xa96f2c3c, 0x6233ff99, 0x7f36cf21, 0xb46a1c84, + 0x32fe6e2a, 0xf9a2bd8f, 0x0b220dc1, 0xc07ede64, 0x46eaacca, + 0x8db67f6f, 0x90b34fd7, 0x5bef9c72, 0xdd7beedc, 0x16273d79, + 0xe7718fac, 0x2c2d5c09, 0xaab92ea7, 0x61e5fd02, 0x7ce0cdba, + 0xb7bc1e1f, 0x31286cb1, 0xfa74bf14, 0x1eb014d8, 0xd5ecc77d, + 0x5378b5d3, 0x98246676, 0x852156ce, 0x4e7d856b, 0xc8e9f7c5, + 0x03b52460, 0xf2e396b5, 0x39bf4510, 0xbf2b37be, 0x7477e41b, + 0x6972d4a3, 0xa22e0706, 0x24ba75a8, 0xefe6a60d, 0x1d661643, + 0xd63ac5e6, 0x50aeb748, 0x9bf264ed, 0x86f75455, 0x4dab87f0, + 0xcb3ff55e, 0x006326fb, 0xf135942e, 0x3a69478b, 0xbcfd3525, + 0x77a1e680, 0x6aa4d638, 0xa1f8059d, 0x276c7733, 0xec30a496, + 0x191c11ee, 0xd240c24b, 0x54d4b0e5, 0x9f886340, 0x828d53f8, + 0x49d1805d, 0xcf45f2f3, 0x04192156, 0xf54f9383, 0x3e134026, + 0xb8873288, 0x73dbe12d, 0x6eded195, 0xa5820230, 0x2316709e, + 0xe84aa33b, 0x1aca1375, 0xd196c0d0, 0x5702b27e, 0x9c5e61db, + 0x815b5163, 0x4a0782c6, 0xcc93f068, 0x07cf23cd, 0xf6999118, + 0x3dc542bd, 0xbb513013, 0x700de3b6, 0x6d08d30e, 0xa65400ab, + 0x20c07205, 0xeb9ca1a0, 0x11e81eb4, 0xdab4cd11, 0x5c20bfbf, + 0x977c6c1a, 0x8a795ca2, 0x41258f07, 0xc7b1fda9, 0x0ced2e0c, + 0xfdbb9cd9, 0x36e74f7c, 0xb0733dd2, 0x7b2fee77, 0x662adecf, + 0xad760d6a, 0x2be27fc4, 0xe0beac61, 0x123e1c2f, 0xd962cf8a, + 0x5ff6bd24, 0x94aa6e81, 0x89af5e39, 0x42f38d9c, 0xc467ff32, + 0x0f3b2c97, 0xfe6d9e42, 0x35314de7, 0xb3a53f49, 0x78f9ecec, + 0x65fcdc54, 0xaea00ff1, 0x28347d5f, 0xe368aefa, 0x16441b82, + 0xdd18c827, 0x5b8cba89, 0x90d0692c, 0x8dd55994, 0x46898a31, + 0xc01df89f, 0x0b412b3a, 0xfa1799ef, 0x314b4a4a, 0xb7df38e4, + 0x7c83eb41, 0x6186dbf9, 0xaada085c, 0x2c4e7af2, 0xe712a957, + 0x15921919, 0xdececabc, 0x585ab812, 0x93066bb7, 0x8e035b0f, + 0x455f88aa, 0xc3cbfa04, 0x089729a1, 0xf9c19b74, 0x329d48d1, + 0xb4093a7f, 0x7f55e9da, 0x6250d962, 0xa90c0ac7, 0x2f987869, + 0xe4c4abcc}, + {0x00000000, 0x3d6029b0, 0x7ac05360, 0x47a07ad0, 0xf580a6c0, + 0xc8e08f70, 0x8f40f5a0, 0xb220dc10, 0x30704bc1, 0x0d106271, + 0x4ab018a1, 0x77d03111, 0xc5f0ed01, 0xf890c4b1, 0xbf30be61, + 0x825097d1, 0x60e09782, 0x5d80be32, 0x1a20c4e2, 0x2740ed52, + 0x95603142, 0xa80018f2, 0xefa06222, 0xd2c04b92, 0x5090dc43, + 0x6df0f5f3, 0x2a508f23, 0x1730a693, 0xa5107a83, 0x98705333, + 0xdfd029e3, 0xe2b00053, 0xc1c12f04, 0xfca106b4, 0xbb017c64, + 0x866155d4, 0x344189c4, 0x0921a074, 0x4e81daa4, 0x73e1f314, + 0xf1b164c5, 0xccd14d75, 0x8b7137a5, 0xb6111e15, 0x0431c205, + 0x3951ebb5, 0x7ef19165, 0x4391b8d5, 0xa121b886, 0x9c419136, + 0xdbe1ebe6, 0xe681c256, 0x54a11e46, 0x69c137f6, 0x2e614d26, + 0x13016496, 0x9151f347, 0xac31daf7, 0xeb91a027, 0xd6f18997, + 0x64d15587, 0x59b17c37, 0x1e1106e7, 0x23712f57, 0x58f35849, + 0x659371f9, 0x22330b29, 0x1f532299, 0xad73fe89, 0x9013d739, + 0xd7b3ade9, 0xead38459, 0x68831388, 0x55e33a38, 0x124340e8, + 0x2f236958, 0x9d03b548, 0xa0639cf8, 0xe7c3e628, 0xdaa3cf98, + 0x3813cfcb, 0x0573e67b, 0x42d39cab, 0x7fb3b51b, 0xcd93690b, + 0xf0f340bb, 0xb7533a6b, 0x8a3313db, 0x0863840a, 0x3503adba, + 0x72a3d76a, 0x4fc3feda, 0xfde322ca, 0xc0830b7a, 0x872371aa, + 0xba43581a, 0x9932774d, 0xa4525efd, 0xe3f2242d, 0xde920d9d, + 0x6cb2d18d, 0x51d2f83d, 0x167282ed, 0x2b12ab5d, 0xa9423c8c, + 0x9422153c, 0xd3826fec, 0xeee2465c, 0x5cc29a4c, 0x61a2b3fc, + 0x2602c92c, 0x1b62e09c, 0xf9d2e0cf, 0xc4b2c97f, 0x8312b3af, + 0xbe729a1f, 0x0c52460f, 0x31326fbf, 0x7692156f, 0x4bf23cdf, + 0xc9a2ab0e, 0xf4c282be, 0xb362f86e, 0x8e02d1de, 0x3c220dce, + 0x0142247e, 0x46e25eae, 0x7b82771e, 0xb1e6b092, 0x8c869922, + 0xcb26e3f2, 0xf646ca42, 0x44661652, 0x79063fe2, 0x3ea64532, + 0x03c66c82, 0x8196fb53, 0xbcf6d2e3, 0xfb56a833, 0xc6368183, + 0x74165d93, 0x49767423, 0x0ed60ef3, 0x33b62743, 0xd1062710, + 0xec660ea0, 0xabc67470, 0x96a65dc0, 0x248681d0, 0x19e6a860, + 0x5e46d2b0, 0x6326fb00, 0xe1766cd1, 0xdc164561, 0x9bb63fb1, + 0xa6d61601, 0x14f6ca11, 0x2996e3a1, 0x6e369971, 0x5356b0c1, + 0x70279f96, 0x4d47b626, 0x0ae7ccf6, 0x3787e546, 0x85a73956, + 0xb8c710e6, 0xff676a36, 0xc2074386, 0x4057d457, 0x7d37fde7, + 0x3a978737, 0x07f7ae87, 0xb5d77297, 0x88b75b27, 0xcf1721f7, + 0xf2770847, 0x10c70814, 0x2da721a4, 0x6a075b74, 0x576772c4, + 0xe547aed4, 0xd8278764, 0x9f87fdb4, 0xa2e7d404, 0x20b743d5, + 0x1dd76a65, 0x5a7710b5, 0x67173905, 0xd537e515, 0xe857cca5, + 0xaff7b675, 0x92979fc5, 0xe915e8db, 0xd475c16b, 0x93d5bbbb, + 0xaeb5920b, 0x1c954e1b, 0x21f567ab, 0x66551d7b, 0x5b3534cb, + 0xd965a31a, 0xe4058aaa, 0xa3a5f07a, 0x9ec5d9ca, 0x2ce505da, + 0x11852c6a, 0x562556ba, 0x6b457f0a, 0x89f57f59, 0xb49556e9, + 0xf3352c39, 0xce550589, 0x7c75d999, 0x4115f029, 0x06b58af9, + 0x3bd5a349, 0xb9853498, 0x84e51d28, 0xc34567f8, 0xfe254e48, + 0x4c059258, 0x7165bbe8, 0x36c5c138, 0x0ba5e888, 0x28d4c7df, + 0x15b4ee6f, 0x521494bf, 0x6f74bd0f, 0xdd54611f, 0xe03448af, + 0xa794327f, 0x9af41bcf, 0x18a48c1e, 0x25c4a5ae, 0x6264df7e, + 0x5f04f6ce, 0xed242ade, 0xd044036e, 0x97e479be, 0xaa84500e, + 0x4834505d, 0x755479ed, 0x32f4033d, 0x0f942a8d, 0xbdb4f69d, + 0x80d4df2d, 0xc774a5fd, 0xfa148c4d, 0x78441b9c, 0x4524322c, + 0x028448fc, 0x3fe4614c, 0x8dc4bd5c, 0xb0a494ec, 0xf704ee3c, + 0xca64c78c}, + {0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, + 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, + 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, + 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, + 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, + 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, + 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, + 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, + 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, + 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, + 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, + 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, + 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, + 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, + 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, + 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, + 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, + 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, + 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, + 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, + 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, + 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, + 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, + 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, + 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, + 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, + 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, + 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, + 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, + 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, + 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, + 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, + 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, + 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, + 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, + 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, + 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, + 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, + 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, + 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, + 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, + 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, + 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, + 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, + 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, + 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, + 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, + 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, + 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, + 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, + 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, + 0xde0506f1}, + {0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, + 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, + 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, + 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, + 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, + 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, + 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, + 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, + 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, + 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, + 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, + 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, + 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, + 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, + 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, + 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, + 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, + 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, + 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, + 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, + 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, + 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, + 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, + 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, + 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, + 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, + 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, + 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, + 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, + 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, + 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, + 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, + 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, + 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, + 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, + 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, + 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, + 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, + 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, + 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, + 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, + 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, + 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, + 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, + 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, + 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, + 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, + 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, + 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, + 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, + 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, + 0xbe9834ed}, + {0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, + 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, + 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, + 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, + 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, + 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, + 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, + 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, + 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, + 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, + 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, + 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, + 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, + 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, + 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, + 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, + 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, + 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, + 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, + 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, + 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, + 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, + 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, + 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, + 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, + 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, + 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, + 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, + 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, + 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, + 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, + 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, + 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, + 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, + 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, + 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, + 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, + 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, + 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, + 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, + 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, + 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, + 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, + 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, + 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, + 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, + 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, + 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, + 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, + 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, + 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, + 0x9324fd72}, + {0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x9630077700000000, 0x2c610eee00000000, + 0xba51099900000000, 0x19c46d0700000000, 0x8ff46a7000000000, + 0x35a563e900000000, 0xa395649e00000000, 0x3288db0e00000000, + 0xa4b8dc7900000000, 0x1ee9d5e000000000, 0x88d9d29700000000, + 0x2b4cb60900000000, 0xbd7cb17e00000000, 0x072db8e700000000, + 0x911dbf9000000000, 0x6410b71d00000000, 0xf220b06a00000000, + 0x4871b9f300000000, 0xde41be8400000000, 0x7dd4da1a00000000, + 0xebe4dd6d00000000, 0x51b5d4f400000000, 0xc785d38300000000, + 0x56986c1300000000, 0xc0a86b6400000000, 0x7af962fd00000000, + 0xecc9658a00000000, 0x4f5c011400000000, 0xd96c066300000000, + 0x633d0ffa00000000, 0xf50d088d00000000, 0xc8206e3b00000000, + 0x5e10694c00000000, 0xe44160d500000000, 0x727167a200000000, + 0xd1e4033c00000000, 0x47d4044b00000000, 0xfd850dd200000000, + 0x6bb50aa500000000, 0xfaa8b53500000000, 0x6c98b24200000000, + 0xd6c9bbdb00000000, 0x40f9bcac00000000, 0xe36cd83200000000, + 0x755cdf4500000000, 0xcf0dd6dc00000000, 0x593dd1ab00000000, + 0xac30d92600000000, 0x3a00de5100000000, 0x8051d7c800000000, + 0x1661d0bf00000000, 0xb5f4b42100000000, 0x23c4b35600000000, + 0x9995bacf00000000, 0x0fa5bdb800000000, 0x9eb8022800000000, + 0x0888055f00000000, 0xb2d90cc600000000, 0x24e90bb100000000, + 0x877c6f2f00000000, 0x114c685800000000, 0xab1d61c100000000, + 0x3d2d66b600000000, 0x9041dc7600000000, 0x0671db0100000000, + 0xbc20d29800000000, 0x2a10d5ef00000000, 0x8985b17100000000, + 0x1fb5b60600000000, 0xa5e4bf9f00000000, 0x33d4b8e800000000, + 0xa2c9077800000000, 0x34f9000f00000000, 0x8ea8099600000000, + 0x18980ee100000000, 0xbb0d6a7f00000000, 0x2d3d6d0800000000, + 0x976c649100000000, 0x015c63e600000000, 0xf4516b6b00000000, + 0x62616c1c00000000, 0xd830658500000000, 0x4e0062f200000000, + 0xed95066c00000000, 0x7ba5011b00000000, 0xc1f4088200000000, + 0x57c40ff500000000, 0xc6d9b06500000000, 0x50e9b71200000000, + 0xeab8be8b00000000, 0x7c88b9fc00000000, 0xdf1ddd6200000000, + 0x492dda1500000000, 0xf37cd38c00000000, 0x654cd4fb00000000, + 0x5861b24d00000000, 0xce51b53a00000000, 0x7400bca300000000, + 0xe230bbd400000000, 0x41a5df4a00000000, 0xd795d83d00000000, + 0x6dc4d1a400000000, 0xfbf4d6d300000000, 0x6ae9694300000000, + 0xfcd96e3400000000, 0x468867ad00000000, 0xd0b860da00000000, + 0x732d044400000000, 0xe51d033300000000, 0x5f4c0aaa00000000, + 0xc97c0ddd00000000, 0x3c71055000000000, 0xaa41022700000000, + 0x10100bbe00000000, 0x86200cc900000000, 0x25b5685700000000, + 0xb3856f2000000000, 0x09d466b900000000, 0x9fe461ce00000000, + 0x0ef9de5e00000000, 0x98c9d92900000000, 0x2298d0b000000000, + 0xb4a8d7c700000000, 0x173db35900000000, 0x810db42e00000000, + 0x3b5cbdb700000000, 0xad6cbac000000000, 0x2083b8ed00000000, + 0xb6b3bf9a00000000, 0x0ce2b60300000000, 0x9ad2b17400000000, + 0x3947d5ea00000000, 0xaf77d29d00000000, 0x1526db0400000000, + 0x8316dc7300000000, 0x120b63e300000000, 0x843b649400000000, + 0x3e6a6d0d00000000, 0xa85a6a7a00000000, 0x0bcf0ee400000000, + 0x9dff099300000000, 0x27ae000a00000000, 0xb19e077d00000000, + 0x44930ff000000000, 0xd2a3088700000000, 0x68f2011e00000000, + 0xfec2066900000000, 0x5d5762f700000000, 0xcb67658000000000, + 0x71366c1900000000, 0xe7066b6e00000000, 0x761bd4fe00000000, + 0xe02bd38900000000, 0x5a7ada1000000000, 0xcc4add6700000000, + 0x6fdfb9f900000000, 0xf9efbe8e00000000, 0x43beb71700000000, + 0xd58eb06000000000, 0xe8a3d6d600000000, 0x7e93d1a100000000, + 0xc4c2d83800000000, 0x52f2df4f00000000, 0xf167bbd100000000, + 0x6757bca600000000, 0xdd06b53f00000000, 0x4b36b24800000000, + 0xda2b0dd800000000, 0x4c1b0aaf00000000, 0xf64a033600000000, + 0x607a044100000000, 0xc3ef60df00000000, 0x55df67a800000000, + 0xef8e6e3100000000, 0x79be694600000000, 0x8cb361cb00000000, + 0x1a8366bc00000000, 0xa0d26f2500000000, 0x36e2685200000000, + 0x95770ccc00000000, 0x03470bbb00000000, 0xb916022200000000, + 0x2f26055500000000, 0xbe3bbac500000000, 0x280bbdb200000000, + 0x925ab42b00000000, 0x046ab35c00000000, 0xa7ffd7c200000000, + 0x31cfd0b500000000, 0x8b9ed92c00000000, 0x1daede5b00000000, + 0xb0c2649b00000000, 0x26f263ec00000000, 0x9ca36a7500000000, + 0x0a936d0200000000, 0xa906099c00000000, 0x3f360eeb00000000, + 0x8567077200000000, 0x1357000500000000, 0x824abf9500000000, + 0x147ab8e200000000, 0xae2bb17b00000000, 0x381bb60c00000000, + 0x9b8ed29200000000, 0x0dbed5e500000000, 0xb7efdc7c00000000, + 0x21dfdb0b00000000, 0xd4d2d38600000000, 0x42e2d4f100000000, + 0xf8b3dd6800000000, 0x6e83da1f00000000, 0xcd16be8100000000, + 0x5b26b9f600000000, 0xe177b06f00000000, 0x7747b71800000000, + 0xe65a088800000000, 0x706a0fff00000000, 0xca3b066600000000, + 0x5c0b011100000000, 0xff9e658f00000000, 0x69ae62f800000000, + 0xd3ff6b6100000000, 0x45cf6c1600000000, 0x78e20aa000000000, + 0xeed20dd700000000, 0x5483044e00000000, 0xc2b3033900000000, + 0x612667a700000000, 0xf71660d000000000, 0x4d47694900000000, + 0xdb776e3e00000000, 0x4a6ad1ae00000000, 0xdc5ad6d900000000, + 0x660bdf4000000000, 0xf03bd83700000000, 0x53aebca900000000, + 0xc59ebbde00000000, 0x7fcfb24700000000, 0xe9ffb53000000000, + 0x1cf2bdbd00000000, 0x8ac2baca00000000, 0x3093b35300000000, + 0xa6a3b42400000000, 0x0536d0ba00000000, 0x9306d7cd00000000, + 0x2957de5400000000, 0xbf67d92300000000, 0x2e7a66b300000000, + 0xb84a61c400000000, 0x021b685d00000000, 0x942b6f2a00000000, + 0x37be0bb400000000, 0xa18e0cc300000000, 0x1bdf055a00000000, + 0x8def022d00000000}, + {0x0000000000000000, 0x41311b1900000000, 0x8262363200000000, + 0xc3532d2b00000000, 0x04c56c6400000000, 0x45f4777d00000000, + 0x86a75a5600000000, 0xc796414f00000000, 0x088ad9c800000000, + 0x49bbc2d100000000, 0x8ae8effa00000000, 0xcbd9f4e300000000, + 0x0c4fb5ac00000000, 0x4d7eaeb500000000, 0x8e2d839e00000000, + 0xcf1c988700000000, 0x5112c24a00000000, 0x1023d95300000000, + 0xd370f47800000000, 0x9241ef6100000000, 0x55d7ae2e00000000, + 0x14e6b53700000000, 0xd7b5981c00000000, 0x9684830500000000, + 0x59981b8200000000, 0x18a9009b00000000, 0xdbfa2db000000000, + 0x9acb36a900000000, 0x5d5d77e600000000, 0x1c6c6cff00000000, + 0xdf3f41d400000000, 0x9e0e5acd00000000, 0xa224849500000000, + 0xe3159f8c00000000, 0x2046b2a700000000, 0x6177a9be00000000, + 0xa6e1e8f100000000, 0xe7d0f3e800000000, 0x2483dec300000000, + 0x65b2c5da00000000, 0xaaae5d5d00000000, 0xeb9f464400000000, + 0x28cc6b6f00000000, 0x69fd707600000000, 0xae6b313900000000, + 0xef5a2a2000000000, 0x2c09070b00000000, 0x6d381c1200000000, + 0xf33646df00000000, 0xb2075dc600000000, 0x715470ed00000000, + 0x30656bf400000000, 0xf7f32abb00000000, 0xb6c231a200000000, + 0x75911c8900000000, 0x34a0079000000000, 0xfbbc9f1700000000, + 0xba8d840e00000000, 0x79dea92500000000, 0x38efb23c00000000, + 0xff79f37300000000, 0xbe48e86a00000000, 0x7d1bc54100000000, + 0x3c2ade5800000000, 0x054f79f000000000, 0x447e62e900000000, + 0x872d4fc200000000, 0xc61c54db00000000, 0x018a159400000000, + 0x40bb0e8d00000000, 0x83e823a600000000, 0xc2d938bf00000000, + 0x0dc5a03800000000, 0x4cf4bb2100000000, 0x8fa7960a00000000, + 0xce968d1300000000, 0x0900cc5c00000000, 0x4831d74500000000, + 0x8b62fa6e00000000, 0xca53e17700000000, 0x545dbbba00000000, + 0x156ca0a300000000, 0xd63f8d8800000000, 0x970e969100000000, + 0x5098d7de00000000, 0x11a9ccc700000000, 0xd2fae1ec00000000, + 0x93cbfaf500000000, 0x5cd7627200000000, 0x1de6796b00000000, + 0xdeb5544000000000, 0x9f844f5900000000, 0x58120e1600000000, + 0x1923150f00000000, 0xda70382400000000, 0x9b41233d00000000, + 0xa76bfd6500000000, 0xe65ae67c00000000, 0x2509cb5700000000, + 0x6438d04e00000000, 0xa3ae910100000000, 0xe29f8a1800000000, + 0x21cca73300000000, 0x60fdbc2a00000000, 0xafe124ad00000000, + 0xeed03fb400000000, 0x2d83129f00000000, 0x6cb2098600000000, + 0xab2448c900000000, 0xea1553d000000000, 0x29467efb00000000, + 0x687765e200000000, 0xf6793f2f00000000, 0xb748243600000000, + 0x741b091d00000000, 0x352a120400000000, 0xf2bc534b00000000, + 0xb38d485200000000, 0x70de657900000000, 0x31ef7e6000000000, + 0xfef3e6e700000000, 0xbfc2fdfe00000000, 0x7c91d0d500000000, + 0x3da0cbcc00000000, 0xfa368a8300000000, 0xbb07919a00000000, + 0x7854bcb100000000, 0x3965a7a800000000, 0x4b98833b00000000, + 0x0aa9982200000000, 0xc9fab50900000000, 0x88cbae1000000000, + 0x4f5def5f00000000, 0x0e6cf44600000000, 0xcd3fd96d00000000, + 0x8c0ec27400000000, 0x43125af300000000, 0x022341ea00000000, + 0xc1706cc100000000, 0x804177d800000000, 0x47d7369700000000, + 0x06e62d8e00000000, 0xc5b500a500000000, 0x84841bbc00000000, + 0x1a8a417100000000, 0x5bbb5a6800000000, 0x98e8774300000000, + 0xd9d96c5a00000000, 0x1e4f2d1500000000, 0x5f7e360c00000000, + 0x9c2d1b2700000000, 0xdd1c003e00000000, 0x120098b900000000, + 0x533183a000000000, 0x9062ae8b00000000, 0xd153b59200000000, + 0x16c5f4dd00000000, 0x57f4efc400000000, 0x94a7c2ef00000000, + 0xd596d9f600000000, 0xe9bc07ae00000000, 0xa88d1cb700000000, + 0x6bde319c00000000, 0x2aef2a8500000000, 0xed796bca00000000, + 0xac4870d300000000, 0x6f1b5df800000000, 0x2e2a46e100000000, + 0xe136de6600000000, 0xa007c57f00000000, 0x6354e85400000000, + 0x2265f34d00000000, 0xe5f3b20200000000, 0xa4c2a91b00000000, + 0x6791843000000000, 0x26a09f2900000000, 0xb8aec5e400000000, + 0xf99fdefd00000000, 0x3accf3d600000000, 0x7bfde8cf00000000, + 0xbc6ba98000000000, 0xfd5ab29900000000, 0x3e099fb200000000, + 0x7f3884ab00000000, 0xb0241c2c00000000, 0xf115073500000000, + 0x32462a1e00000000, 0x7377310700000000, 0xb4e1704800000000, + 0xf5d06b5100000000, 0x3683467a00000000, 0x77b25d6300000000, + 0x4ed7facb00000000, 0x0fe6e1d200000000, 0xccb5ccf900000000, + 0x8d84d7e000000000, 0x4a1296af00000000, 0x0b238db600000000, + 0xc870a09d00000000, 0x8941bb8400000000, 0x465d230300000000, + 0x076c381a00000000, 0xc43f153100000000, 0x850e0e2800000000, + 0x42984f6700000000, 0x03a9547e00000000, 0xc0fa795500000000, + 0x81cb624c00000000, 0x1fc5388100000000, 0x5ef4239800000000, + 0x9da70eb300000000, 0xdc9615aa00000000, 0x1b0054e500000000, + 0x5a314ffc00000000, 0x996262d700000000, 0xd85379ce00000000, + 0x174fe14900000000, 0x567efa5000000000, 0x952dd77b00000000, + 0xd41ccc6200000000, 0x138a8d2d00000000, 0x52bb963400000000, + 0x91e8bb1f00000000, 0xd0d9a00600000000, 0xecf37e5e00000000, + 0xadc2654700000000, 0x6e91486c00000000, 0x2fa0537500000000, + 0xe836123a00000000, 0xa907092300000000, 0x6a54240800000000, + 0x2b653f1100000000, 0xe479a79600000000, 0xa548bc8f00000000, + 0x661b91a400000000, 0x272a8abd00000000, 0xe0bccbf200000000, + 0xa18dd0eb00000000, 0x62defdc000000000, 0x23efe6d900000000, + 0xbde1bc1400000000, 0xfcd0a70d00000000, 0x3f838a2600000000, + 0x7eb2913f00000000, 0xb924d07000000000, 0xf815cb6900000000, + 0x3b46e64200000000, 0x7a77fd5b00000000, 0xb56b65dc00000000, + 0xf45a7ec500000000, 0x370953ee00000000, 0x763848f700000000, + 0xb1ae09b800000000, 0xf09f12a100000000, 0x33cc3f8a00000000, + 0x72fd249300000000}, + {0x0000000000000000, 0x376ac20100000000, 0x6ed4840300000000, + 0x59be460200000000, 0xdca8090700000000, 0xebc2cb0600000000, + 0xb27c8d0400000000, 0x85164f0500000000, 0xb851130e00000000, + 0x8f3bd10f00000000, 0xd685970d00000000, 0xe1ef550c00000000, + 0x64f91a0900000000, 0x5393d80800000000, 0x0a2d9e0a00000000, + 0x3d475c0b00000000, 0x70a3261c00000000, 0x47c9e41d00000000, + 0x1e77a21f00000000, 0x291d601e00000000, 0xac0b2f1b00000000, + 0x9b61ed1a00000000, 0xc2dfab1800000000, 0xf5b5691900000000, + 0xc8f2351200000000, 0xff98f71300000000, 0xa626b11100000000, + 0x914c731000000000, 0x145a3c1500000000, 0x2330fe1400000000, + 0x7a8eb81600000000, 0x4de47a1700000000, 0xe0464d3800000000, + 0xd72c8f3900000000, 0x8e92c93b00000000, 0xb9f80b3a00000000, + 0x3cee443f00000000, 0x0b84863e00000000, 0x523ac03c00000000, + 0x6550023d00000000, 0x58175e3600000000, 0x6f7d9c3700000000, + 0x36c3da3500000000, 0x01a9183400000000, 0x84bf573100000000, + 0xb3d5953000000000, 0xea6bd33200000000, 0xdd01113300000000, + 0x90e56b2400000000, 0xa78fa92500000000, 0xfe31ef2700000000, + 0xc95b2d2600000000, 0x4c4d622300000000, 0x7b27a02200000000, + 0x2299e62000000000, 0x15f3242100000000, 0x28b4782a00000000, + 0x1fdeba2b00000000, 0x4660fc2900000000, 0x710a3e2800000000, + 0xf41c712d00000000, 0xc376b32c00000000, 0x9ac8f52e00000000, + 0xada2372f00000000, 0xc08d9a7000000000, 0xf7e7587100000000, + 0xae591e7300000000, 0x9933dc7200000000, 0x1c25937700000000, + 0x2b4f517600000000, 0x72f1177400000000, 0x459bd57500000000, + 0x78dc897e00000000, 0x4fb64b7f00000000, 0x16080d7d00000000, + 0x2162cf7c00000000, 0xa474807900000000, 0x931e427800000000, + 0xcaa0047a00000000, 0xfdcac67b00000000, 0xb02ebc6c00000000, + 0x87447e6d00000000, 0xdefa386f00000000, 0xe990fa6e00000000, + 0x6c86b56b00000000, 0x5bec776a00000000, 0x0252316800000000, + 0x3538f36900000000, 0x087faf6200000000, 0x3f156d6300000000, + 0x66ab2b6100000000, 0x51c1e96000000000, 0xd4d7a66500000000, + 0xe3bd646400000000, 0xba03226600000000, 0x8d69e06700000000, + 0x20cbd74800000000, 0x17a1154900000000, 0x4e1f534b00000000, + 0x7975914a00000000, 0xfc63de4f00000000, 0xcb091c4e00000000, + 0x92b75a4c00000000, 0xa5dd984d00000000, 0x989ac44600000000, + 0xaff0064700000000, 0xf64e404500000000, 0xc124824400000000, + 0x4432cd4100000000, 0x73580f4000000000, 0x2ae6494200000000, + 0x1d8c8b4300000000, 0x5068f15400000000, 0x6702335500000000, + 0x3ebc755700000000, 0x09d6b75600000000, 0x8cc0f85300000000, + 0xbbaa3a5200000000, 0xe2147c5000000000, 0xd57ebe5100000000, + 0xe839e25a00000000, 0xdf53205b00000000, 0x86ed665900000000, + 0xb187a45800000000, 0x3491eb5d00000000, 0x03fb295c00000000, + 0x5a456f5e00000000, 0x6d2fad5f00000000, 0x801b35e100000000, + 0xb771f7e000000000, 0xeecfb1e200000000, 0xd9a573e300000000, + 0x5cb33ce600000000, 0x6bd9fee700000000, 0x3267b8e500000000, + 0x050d7ae400000000, 0x384a26ef00000000, 0x0f20e4ee00000000, + 0x569ea2ec00000000, 0x61f460ed00000000, 0xe4e22fe800000000, + 0xd388ede900000000, 0x8a36abeb00000000, 0xbd5c69ea00000000, + 0xf0b813fd00000000, 0xc7d2d1fc00000000, 0x9e6c97fe00000000, + 0xa90655ff00000000, 0x2c101afa00000000, 0x1b7ad8fb00000000, + 0x42c49ef900000000, 0x75ae5cf800000000, 0x48e900f300000000, + 0x7f83c2f200000000, 0x263d84f000000000, 0x115746f100000000, + 0x944109f400000000, 0xa32bcbf500000000, 0xfa958df700000000, + 0xcdff4ff600000000, 0x605d78d900000000, 0x5737bad800000000, + 0x0e89fcda00000000, 0x39e33edb00000000, 0xbcf571de00000000, + 0x8b9fb3df00000000, 0xd221f5dd00000000, 0xe54b37dc00000000, + 0xd80c6bd700000000, 0xef66a9d600000000, 0xb6d8efd400000000, + 0x81b22dd500000000, 0x04a462d000000000, 0x33cea0d100000000, + 0x6a70e6d300000000, 0x5d1a24d200000000, 0x10fe5ec500000000, + 0x27949cc400000000, 0x7e2adac600000000, 0x494018c700000000, + 0xcc5657c200000000, 0xfb3c95c300000000, 0xa282d3c100000000, + 0x95e811c000000000, 0xa8af4dcb00000000, 0x9fc58fca00000000, + 0xc67bc9c800000000, 0xf1110bc900000000, 0x740744cc00000000, + 0x436d86cd00000000, 0x1ad3c0cf00000000, 0x2db902ce00000000, + 0x4096af9100000000, 0x77fc6d9000000000, 0x2e422b9200000000, + 0x1928e99300000000, 0x9c3ea69600000000, 0xab54649700000000, + 0xf2ea229500000000, 0xc580e09400000000, 0xf8c7bc9f00000000, + 0xcfad7e9e00000000, 0x9613389c00000000, 0xa179fa9d00000000, + 0x246fb59800000000, 0x1305779900000000, 0x4abb319b00000000, + 0x7dd1f39a00000000, 0x3035898d00000000, 0x075f4b8c00000000, + 0x5ee10d8e00000000, 0x698bcf8f00000000, 0xec9d808a00000000, + 0xdbf7428b00000000, 0x8249048900000000, 0xb523c68800000000, + 0x88649a8300000000, 0xbf0e588200000000, 0xe6b01e8000000000, + 0xd1dadc8100000000, 0x54cc938400000000, 0x63a6518500000000, + 0x3a18178700000000, 0x0d72d58600000000, 0xa0d0e2a900000000, + 0x97ba20a800000000, 0xce0466aa00000000, 0xf96ea4ab00000000, + 0x7c78ebae00000000, 0x4b1229af00000000, 0x12ac6fad00000000, + 0x25c6adac00000000, 0x1881f1a700000000, 0x2feb33a600000000, + 0x765575a400000000, 0x413fb7a500000000, 0xc429f8a000000000, + 0xf3433aa100000000, 0xaafd7ca300000000, 0x9d97bea200000000, + 0xd073c4b500000000, 0xe71906b400000000, 0xbea740b600000000, + 0x89cd82b700000000, 0x0cdbcdb200000000, 0x3bb10fb300000000, + 0x620f49b100000000, 0x55658bb000000000, 0x6822d7bb00000000, + 0x5f4815ba00000000, 0x06f653b800000000, 0x319c91b900000000, + 0xb48adebc00000000, 0x83e01cbd00000000, 0xda5e5abf00000000, + 0xed3498be00000000}, + {0x0000000000000000, 0x6567bcb800000000, 0x8bc809aa00000000, + 0xeeafb51200000000, 0x5797628f00000000, 0x32f0de3700000000, + 0xdc5f6b2500000000, 0xb938d79d00000000, 0xef28b4c500000000, + 0x8a4f087d00000000, 0x64e0bd6f00000000, 0x018701d700000000, + 0xb8bfd64a00000000, 0xddd86af200000000, 0x3377dfe000000000, + 0x5610635800000000, 0x9f57195000000000, 0xfa30a5e800000000, + 0x149f10fa00000000, 0x71f8ac4200000000, 0xc8c07bdf00000000, + 0xada7c76700000000, 0x4308727500000000, 0x266fcecd00000000, + 0x707fad9500000000, 0x1518112d00000000, 0xfbb7a43f00000000, + 0x9ed0188700000000, 0x27e8cf1a00000000, 0x428f73a200000000, + 0xac20c6b000000000, 0xc9477a0800000000, 0x3eaf32a000000000, + 0x5bc88e1800000000, 0xb5673b0a00000000, 0xd00087b200000000, + 0x6938502f00000000, 0x0c5fec9700000000, 0xe2f0598500000000, + 0x8797e53d00000000, 0xd187866500000000, 0xb4e03add00000000, + 0x5a4f8fcf00000000, 0x3f28337700000000, 0x8610e4ea00000000, + 0xe377585200000000, 0x0dd8ed4000000000, 0x68bf51f800000000, + 0xa1f82bf000000000, 0xc49f974800000000, 0x2a30225a00000000, + 0x4f579ee200000000, 0xf66f497f00000000, 0x9308f5c700000000, + 0x7da740d500000000, 0x18c0fc6d00000000, 0x4ed09f3500000000, + 0x2bb7238d00000000, 0xc518969f00000000, 0xa07f2a2700000000, + 0x1947fdba00000000, 0x7c20410200000000, 0x928ff41000000000, + 0xf7e848a800000000, 0x3d58149b00000000, 0x583fa82300000000, + 0xb6901d3100000000, 0xd3f7a18900000000, 0x6acf761400000000, + 0x0fa8caac00000000, 0xe1077fbe00000000, 0x8460c30600000000, + 0xd270a05e00000000, 0xb7171ce600000000, 0x59b8a9f400000000, + 0x3cdf154c00000000, 0x85e7c2d100000000, 0xe0807e6900000000, + 0x0e2fcb7b00000000, 0x6b4877c300000000, 0xa20f0dcb00000000, + 0xc768b17300000000, 0x29c7046100000000, 0x4ca0b8d900000000, + 0xf5986f4400000000, 0x90ffd3fc00000000, 0x7e5066ee00000000, + 0x1b37da5600000000, 0x4d27b90e00000000, 0x284005b600000000, + 0xc6efb0a400000000, 0xa3880c1c00000000, 0x1ab0db8100000000, + 0x7fd7673900000000, 0x9178d22b00000000, 0xf41f6e9300000000, + 0x03f7263b00000000, 0x66909a8300000000, 0x883f2f9100000000, + 0xed58932900000000, 0x546044b400000000, 0x3107f80c00000000, + 0xdfa84d1e00000000, 0xbacff1a600000000, 0xecdf92fe00000000, + 0x89b82e4600000000, 0x67179b5400000000, 0x027027ec00000000, + 0xbb48f07100000000, 0xde2f4cc900000000, 0x3080f9db00000000, + 0x55e7456300000000, 0x9ca03f6b00000000, 0xf9c783d300000000, + 0x176836c100000000, 0x720f8a7900000000, 0xcb375de400000000, + 0xae50e15c00000000, 0x40ff544e00000000, 0x2598e8f600000000, + 0x73888bae00000000, 0x16ef371600000000, 0xf840820400000000, + 0x9d273ebc00000000, 0x241fe92100000000, 0x4178559900000000, + 0xafd7e08b00000000, 0xcab05c3300000000, 0x3bb659ed00000000, + 0x5ed1e55500000000, 0xb07e504700000000, 0xd519ecff00000000, + 0x6c213b6200000000, 0x094687da00000000, 0xe7e932c800000000, + 0x828e8e7000000000, 0xd49eed2800000000, 0xb1f9519000000000, + 0x5f56e48200000000, 0x3a31583a00000000, 0x83098fa700000000, + 0xe66e331f00000000, 0x08c1860d00000000, 0x6da63ab500000000, + 0xa4e140bd00000000, 0xc186fc0500000000, 0x2f29491700000000, + 0x4a4ef5af00000000, 0xf376223200000000, 0x96119e8a00000000, + 0x78be2b9800000000, 0x1dd9972000000000, 0x4bc9f47800000000, + 0x2eae48c000000000, 0xc001fdd200000000, 0xa566416a00000000, + 0x1c5e96f700000000, 0x79392a4f00000000, 0x97969f5d00000000, + 0xf2f123e500000000, 0x05196b4d00000000, 0x607ed7f500000000, + 0x8ed162e700000000, 0xebb6de5f00000000, 0x528e09c200000000, + 0x37e9b57a00000000, 0xd946006800000000, 0xbc21bcd000000000, + 0xea31df8800000000, 0x8f56633000000000, 0x61f9d62200000000, + 0x049e6a9a00000000, 0xbda6bd0700000000, 0xd8c101bf00000000, + 0x366eb4ad00000000, 0x5309081500000000, 0x9a4e721d00000000, + 0xff29cea500000000, 0x11867bb700000000, 0x74e1c70f00000000, + 0xcdd9109200000000, 0xa8beac2a00000000, 0x4611193800000000, + 0x2376a58000000000, 0x7566c6d800000000, 0x10017a6000000000, + 0xfeaecf7200000000, 0x9bc973ca00000000, 0x22f1a45700000000, + 0x479618ef00000000, 0xa939adfd00000000, 0xcc5e114500000000, + 0x06ee4d7600000000, 0x6389f1ce00000000, 0x8d2644dc00000000, + 0xe841f86400000000, 0x51792ff900000000, 0x341e934100000000, + 0xdab1265300000000, 0xbfd69aeb00000000, 0xe9c6f9b300000000, + 0x8ca1450b00000000, 0x620ef01900000000, 0x07694ca100000000, + 0xbe519b3c00000000, 0xdb36278400000000, 0x3599929600000000, + 0x50fe2e2e00000000, 0x99b9542600000000, 0xfcdee89e00000000, + 0x12715d8c00000000, 0x7716e13400000000, 0xce2e36a900000000, + 0xab498a1100000000, 0x45e63f0300000000, 0x208183bb00000000, + 0x7691e0e300000000, 0x13f65c5b00000000, 0xfd59e94900000000, + 0x983e55f100000000, 0x2106826c00000000, 0x44613ed400000000, + 0xaace8bc600000000, 0xcfa9377e00000000, 0x38417fd600000000, + 0x5d26c36e00000000, 0xb389767c00000000, 0xd6eecac400000000, + 0x6fd61d5900000000, 0x0ab1a1e100000000, 0xe41e14f300000000, + 0x8179a84b00000000, 0xd769cb1300000000, 0xb20e77ab00000000, + 0x5ca1c2b900000000, 0x39c67e0100000000, 0x80fea99c00000000, + 0xe599152400000000, 0x0b36a03600000000, 0x6e511c8e00000000, + 0xa716668600000000, 0xc271da3e00000000, 0x2cde6f2c00000000, + 0x49b9d39400000000, 0xf081040900000000, 0x95e6b8b100000000, + 0x7b490da300000000, 0x1e2eb11b00000000, 0x483ed24300000000, + 0x2d596efb00000000, 0xc3f6dbe900000000, 0xa691675100000000, + 0x1fa9b0cc00000000, 0x7ace0c7400000000, 0x9461b96600000000, + 0xf10605de00000000}, + {0x0000000000000000, 0xb029603d00000000, 0x6053c07a00000000, + 0xd07aa04700000000, 0xc0a680f500000000, 0x708fe0c800000000, + 0xa0f5408f00000000, 0x10dc20b200000000, 0xc14b703000000000, + 0x7162100d00000000, 0xa118b04a00000000, 0x1131d07700000000, + 0x01edf0c500000000, 0xb1c490f800000000, 0x61be30bf00000000, + 0xd197508200000000, 0x8297e06000000000, 0x32be805d00000000, + 0xe2c4201a00000000, 0x52ed402700000000, 0x4231609500000000, + 0xf21800a800000000, 0x2262a0ef00000000, 0x924bc0d200000000, + 0x43dc905000000000, 0xf3f5f06d00000000, 0x238f502a00000000, + 0x93a6301700000000, 0x837a10a500000000, 0x3353709800000000, + 0xe329d0df00000000, 0x5300b0e200000000, 0x042fc1c100000000, + 0xb406a1fc00000000, 0x647c01bb00000000, 0xd455618600000000, + 0xc489413400000000, 0x74a0210900000000, 0xa4da814e00000000, + 0x14f3e17300000000, 0xc564b1f100000000, 0x754dd1cc00000000, + 0xa537718b00000000, 0x151e11b600000000, 0x05c2310400000000, + 0xb5eb513900000000, 0x6591f17e00000000, 0xd5b8914300000000, + 0x86b821a100000000, 0x3691419c00000000, 0xe6ebe1db00000000, + 0x56c281e600000000, 0x461ea15400000000, 0xf637c16900000000, + 0x264d612e00000000, 0x9664011300000000, 0x47f3519100000000, + 0xf7da31ac00000000, 0x27a091eb00000000, 0x9789f1d600000000, + 0x8755d16400000000, 0x377cb15900000000, 0xe706111e00000000, + 0x572f712300000000, 0x4958f35800000000, 0xf971936500000000, + 0x290b332200000000, 0x9922531f00000000, 0x89fe73ad00000000, + 0x39d7139000000000, 0xe9adb3d700000000, 0x5984d3ea00000000, + 0x8813836800000000, 0x383ae35500000000, 0xe840431200000000, + 0x5869232f00000000, 0x48b5039d00000000, 0xf89c63a000000000, + 0x28e6c3e700000000, 0x98cfa3da00000000, 0xcbcf133800000000, + 0x7be6730500000000, 0xab9cd34200000000, 0x1bb5b37f00000000, + 0x0b6993cd00000000, 0xbb40f3f000000000, 0x6b3a53b700000000, + 0xdb13338a00000000, 0x0a84630800000000, 0xbaad033500000000, + 0x6ad7a37200000000, 0xdafec34f00000000, 0xca22e3fd00000000, + 0x7a0b83c000000000, 0xaa71238700000000, 0x1a5843ba00000000, + 0x4d77329900000000, 0xfd5e52a400000000, 0x2d24f2e300000000, + 0x9d0d92de00000000, 0x8dd1b26c00000000, 0x3df8d25100000000, + 0xed82721600000000, 0x5dab122b00000000, 0x8c3c42a900000000, + 0x3c15229400000000, 0xec6f82d300000000, 0x5c46e2ee00000000, + 0x4c9ac25c00000000, 0xfcb3a26100000000, 0x2cc9022600000000, + 0x9ce0621b00000000, 0xcfe0d2f900000000, 0x7fc9b2c400000000, + 0xafb3128300000000, 0x1f9a72be00000000, 0x0f46520c00000000, + 0xbf6f323100000000, 0x6f15927600000000, 0xdf3cf24b00000000, + 0x0eaba2c900000000, 0xbe82c2f400000000, 0x6ef862b300000000, + 0xded1028e00000000, 0xce0d223c00000000, 0x7e24420100000000, + 0xae5ee24600000000, 0x1e77827b00000000, 0x92b0e6b100000000, + 0x2299868c00000000, 0xf2e326cb00000000, 0x42ca46f600000000, + 0x5216664400000000, 0xe23f067900000000, 0x3245a63e00000000, + 0x826cc60300000000, 0x53fb968100000000, 0xe3d2f6bc00000000, + 0x33a856fb00000000, 0x838136c600000000, 0x935d167400000000, + 0x2374764900000000, 0xf30ed60e00000000, 0x4327b63300000000, + 0x102706d100000000, 0xa00e66ec00000000, 0x7074c6ab00000000, + 0xc05da69600000000, 0xd081862400000000, 0x60a8e61900000000, + 0xb0d2465e00000000, 0x00fb266300000000, 0xd16c76e100000000, + 0x614516dc00000000, 0xb13fb69b00000000, 0x0116d6a600000000, + 0x11caf61400000000, 0xa1e3962900000000, 0x7199366e00000000, + 0xc1b0565300000000, 0x969f277000000000, 0x26b6474d00000000, + 0xf6cce70a00000000, 0x46e5873700000000, 0x5639a78500000000, + 0xe610c7b800000000, 0x366a67ff00000000, 0x864307c200000000, + 0x57d4574000000000, 0xe7fd377d00000000, 0x3787973a00000000, + 0x87aef70700000000, 0x9772d7b500000000, 0x275bb78800000000, + 0xf72117cf00000000, 0x470877f200000000, 0x1408c71000000000, + 0xa421a72d00000000, 0x745b076a00000000, 0xc472675700000000, + 0xd4ae47e500000000, 0x648727d800000000, 0xb4fd879f00000000, + 0x04d4e7a200000000, 0xd543b72000000000, 0x656ad71d00000000, + 0xb510775a00000000, 0x0539176700000000, 0x15e537d500000000, + 0xa5cc57e800000000, 0x75b6f7af00000000, 0xc59f979200000000, + 0xdbe815e900000000, 0x6bc175d400000000, 0xbbbbd59300000000, + 0x0b92b5ae00000000, 0x1b4e951c00000000, 0xab67f52100000000, + 0x7b1d556600000000, 0xcb34355b00000000, 0x1aa365d900000000, + 0xaa8a05e400000000, 0x7af0a5a300000000, 0xcad9c59e00000000, + 0xda05e52c00000000, 0x6a2c851100000000, 0xba56255600000000, + 0x0a7f456b00000000, 0x597ff58900000000, 0xe95695b400000000, + 0x392c35f300000000, 0x890555ce00000000, 0x99d9757c00000000, + 0x29f0154100000000, 0xf98ab50600000000, 0x49a3d53b00000000, + 0x983485b900000000, 0x281de58400000000, 0xf86745c300000000, + 0x484e25fe00000000, 0x5892054c00000000, 0xe8bb657100000000, + 0x38c1c53600000000, 0x88e8a50b00000000, 0xdfc7d42800000000, + 0x6feeb41500000000, 0xbf94145200000000, 0x0fbd746f00000000, + 0x1f6154dd00000000, 0xaf4834e000000000, 0x7f3294a700000000, + 0xcf1bf49a00000000, 0x1e8ca41800000000, 0xaea5c42500000000, + 0x7edf646200000000, 0xcef6045f00000000, 0xde2a24ed00000000, + 0x6e0344d000000000, 0xbe79e49700000000, 0x0e5084aa00000000, + 0x5d50344800000000, 0xed79547500000000, 0x3d03f43200000000, + 0x8d2a940f00000000, 0x9df6b4bd00000000, 0x2ddfd48000000000, + 0xfda574c700000000, 0x4d8c14fa00000000, 0x9c1b447800000000, + 0x2c32244500000000, 0xfc48840200000000, 0x4c61e43f00000000, + 0x5cbdc48d00000000, 0xec94a4b000000000, 0x3cee04f700000000, + 0x8cc764ca00000000}, + {0x0000000000000000, 0xa5d35ccb00000000, 0x0ba1c84d00000000, + 0xae72948600000000, 0x1642919b00000000, 0xb391cd5000000000, + 0x1de359d600000000, 0xb830051d00000000, 0x6d8253ec00000000, + 0xc8510f2700000000, 0x66239ba100000000, 0xc3f0c76a00000000, + 0x7bc0c27700000000, 0xde139ebc00000000, 0x70610a3a00000000, + 0xd5b256f100000000, 0x9b02d60300000000, 0x3ed18ac800000000, + 0x90a31e4e00000000, 0x3570428500000000, 0x8d40479800000000, + 0x28931b5300000000, 0x86e18fd500000000, 0x2332d31e00000000, + 0xf68085ef00000000, 0x5353d92400000000, 0xfd214da200000000, + 0x58f2116900000000, 0xe0c2147400000000, 0x451148bf00000000, + 0xeb63dc3900000000, 0x4eb080f200000000, 0x3605ac0700000000, + 0x93d6f0cc00000000, 0x3da4644a00000000, 0x9877388100000000, + 0x20473d9c00000000, 0x8594615700000000, 0x2be6f5d100000000, + 0x8e35a91a00000000, 0x5b87ffeb00000000, 0xfe54a32000000000, + 0x502637a600000000, 0xf5f56b6d00000000, 0x4dc56e7000000000, + 0xe81632bb00000000, 0x4664a63d00000000, 0xe3b7faf600000000, + 0xad077a0400000000, 0x08d426cf00000000, 0xa6a6b24900000000, + 0x0375ee8200000000, 0xbb45eb9f00000000, 0x1e96b75400000000, + 0xb0e423d200000000, 0x15377f1900000000, 0xc08529e800000000, + 0x6556752300000000, 0xcb24e1a500000000, 0x6ef7bd6e00000000, + 0xd6c7b87300000000, 0x7314e4b800000000, 0xdd66703e00000000, + 0x78b52cf500000000, 0x6c0a580f00000000, 0xc9d904c400000000, + 0x67ab904200000000, 0xc278cc8900000000, 0x7a48c99400000000, + 0xdf9b955f00000000, 0x71e901d900000000, 0xd43a5d1200000000, + 0x01880be300000000, 0xa45b572800000000, 0x0a29c3ae00000000, + 0xaffa9f6500000000, 0x17ca9a7800000000, 0xb219c6b300000000, + 0x1c6b523500000000, 0xb9b80efe00000000, 0xf7088e0c00000000, + 0x52dbd2c700000000, 0xfca9464100000000, 0x597a1a8a00000000, + 0xe14a1f9700000000, 0x4499435c00000000, 0xeaebd7da00000000, + 0x4f388b1100000000, 0x9a8adde000000000, 0x3f59812b00000000, + 0x912b15ad00000000, 0x34f8496600000000, 0x8cc84c7b00000000, + 0x291b10b000000000, 0x8769843600000000, 0x22bad8fd00000000, + 0x5a0ff40800000000, 0xffdca8c300000000, 0x51ae3c4500000000, + 0xf47d608e00000000, 0x4c4d659300000000, 0xe99e395800000000, + 0x47ecadde00000000, 0xe23ff11500000000, 0x378da7e400000000, + 0x925efb2f00000000, 0x3c2c6fa900000000, 0x99ff336200000000, + 0x21cf367f00000000, 0x841c6ab400000000, 0x2a6efe3200000000, + 0x8fbda2f900000000, 0xc10d220b00000000, 0x64de7ec000000000, + 0xcaacea4600000000, 0x6f7fb68d00000000, 0xd74fb39000000000, + 0x729cef5b00000000, 0xdcee7bdd00000000, 0x793d271600000000, + 0xac8f71e700000000, 0x095c2d2c00000000, 0xa72eb9aa00000000, + 0x02fde56100000000, 0xbacde07c00000000, 0x1f1ebcb700000000, + 0xb16c283100000000, 0x14bf74fa00000000, 0xd814b01e00000000, + 0x7dc7ecd500000000, 0xd3b5785300000000, 0x7666249800000000, + 0xce56218500000000, 0x6b857d4e00000000, 0xc5f7e9c800000000, + 0x6024b50300000000, 0xb596e3f200000000, 0x1045bf3900000000, + 0xbe372bbf00000000, 0x1be4777400000000, 0xa3d4726900000000, + 0x06072ea200000000, 0xa875ba2400000000, 0x0da6e6ef00000000, + 0x4316661d00000000, 0xe6c53ad600000000, 0x48b7ae5000000000, + 0xed64f29b00000000, 0x5554f78600000000, 0xf087ab4d00000000, + 0x5ef53fcb00000000, 0xfb26630000000000, 0x2e9435f100000000, + 0x8b47693a00000000, 0x2535fdbc00000000, 0x80e6a17700000000, + 0x38d6a46a00000000, 0x9d05f8a100000000, 0x33776c2700000000, + 0x96a430ec00000000, 0xee111c1900000000, 0x4bc240d200000000, + 0xe5b0d45400000000, 0x4063889f00000000, 0xf8538d8200000000, + 0x5d80d14900000000, 0xf3f245cf00000000, 0x5621190400000000, + 0x83934ff500000000, 0x2640133e00000000, 0x883287b800000000, + 0x2de1db7300000000, 0x95d1de6e00000000, 0x300282a500000000, + 0x9e70162300000000, 0x3ba34ae800000000, 0x7513ca1a00000000, + 0xd0c096d100000000, 0x7eb2025700000000, 0xdb615e9c00000000, + 0x63515b8100000000, 0xc682074a00000000, 0x68f093cc00000000, + 0xcd23cf0700000000, 0x189199f600000000, 0xbd42c53d00000000, + 0x133051bb00000000, 0xb6e30d7000000000, 0x0ed3086d00000000, + 0xab0054a600000000, 0x0572c02000000000, 0xa0a19ceb00000000, + 0xb41ee81100000000, 0x11cdb4da00000000, 0xbfbf205c00000000, + 0x1a6c7c9700000000, 0xa25c798a00000000, 0x078f254100000000, + 0xa9fdb1c700000000, 0x0c2eed0c00000000, 0xd99cbbfd00000000, + 0x7c4fe73600000000, 0xd23d73b000000000, 0x77ee2f7b00000000, + 0xcfde2a6600000000, 0x6a0d76ad00000000, 0xc47fe22b00000000, + 0x61acbee000000000, 0x2f1c3e1200000000, 0x8acf62d900000000, + 0x24bdf65f00000000, 0x816eaa9400000000, 0x395eaf8900000000, + 0x9c8df34200000000, 0x32ff67c400000000, 0x972c3b0f00000000, + 0x429e6dfe00000000, 0xe74d313500000000, 0x493fa5b300000000, + 0xececf97800000000, 0x54dcfc6500000000, 0xf10fa0ae00000000, + 0x5f7d342800000000, 0xfaae68e300000000, 0x821b441600000000, + 0x27c818dd00000000, 0x89ba8c5b00000000, 0x2c69d09000000000, + 0x9459d58d00000000, 0x318a894600000000, 0x9ff81dc000000000, + 0x3a2b410b00000000, 0xef9917fa00000000, 0x4a4a4b3100000000, + 0xe438dfb700000000, 0x41eb837c00000000, 0xf9db866100000000, + 0x5c08daaa00000000, 0xf27a4e2c00000000, 0x57a912e700000000, + 0x1919921500000000, 0xbccacede00000000, 0x12b85a5800000000, + 0xb76b069300000000, 0x0f5b038e00000000, 0xaa885f4500000000, + 0x04facbc300000000, 0xa129970800000000, 0x749bc1f900000000, + 0xd1489d3200000000, 0x7f3a09b400000000, 0xdae9557f00000000, + 0x62d9506200000000, 0xc70a0ca900000000, 0x6978982f00000000, + 0xccabc4e400000000}, + {0x0000000000000000, 0xb40b77a600000000, 0x29119f9700000000, + 0x9d1ae83100000000, 0x13244ff400000000, 0xa72f385200000000, + 0x3a35d06300000000, 0x8e3ea7c500000000, 0x674eef3300000000, + 0xd345989500000000, 0x4e5f70a400000000, 0xfa54070200000000, + 0x746aa0c700000000, 0xc061d76100000000, 0x5d7b3f5000000000, + 0xe97048f600000000, 0xce9cde6700000000, 0x7a97a9c100000000, + 0xe78d41f000000000, 0x5386365600000000, 0xddb8919300000000, + 0x69b3e63500000000, 0xf4a90e0400000000, 0x40a279a200000000, + 0xa9d2315400000000, 0x1dd946f200000000, 0x80c3aec300000000, + 0x34c8d96500000000, 0xbaf67ea000000000, 0x0efd090600000000, + 0x93e7e13700000000, 0x27ec969100000000, 0x9c39bdcf00000000, + 0x2832ca6900000000, 0xb528225800000000, 0x012355fe00000000, + 0x8f1df23b00000000, 0x3b16859d00000000, 0xa60c6dac00000000, + 0x12071a0a00000000, 0xfb7752fc00000000, 0x4f7c255a00000000, + 0xd266cd6b00000000, 0x666dbacd00000000, 0xe8531d0800000000, + 0x5c586aae00000000, 0xc142829f00000000, 0x7549f53900000000, + 0x52a563a800000000, 0xe6ae140e00000000, 0x7bb4fc3f00000000, + 0xcfbf8b9900000000, 0x41812c5c00000000, 0xf58a5bfa00000000, + 0x6890b3cb00000000, 0xdc9bc46d00000000, 0x35eb8c9b00000000, + 0x81e0fb3d00000000, 0x1cfa130c00000000, 0xa8f164aa00000000, + 0x26cfc36f00000000, 0x92c4b4c900000000, 0x0fde5cf800000000, + 0xbbd52b5e00000000, 0x79750b4400000000, 0xcd7e7ce200000000, + 0x506494d300000000, 0xe46fe37500000000, 0x6a5144b000000000, + 0xde5a331600000000, 0x4340db2700000000, 0xf74bac8100000000, + 0x1e3be47700000000, 0xaa3093d100000000, 0x372a7be000000000, + 0x83210c4600000000, 0x0d1fab8300000000, 0xb914dc2500000000, + 0x240e341400000000, 0x900543b200000000, 0xb7e9d52300000000, + 0x03e2a28500000000, 0x9ef84ab400000000, 0x2af33d1200000000, + 0xa4cd9ad700000000, 0x10c6ed7100000000, 0x8ddc054000000000, + 0x39d772e600000000, 0xd0a73a1000000000, 0x64ac4db600000000, + 0xf9b6a58700000000, 0x4dbdd22100000000, 0xc38375e400000000, + 0x7788024200000000, 0xea92ea7300000000, 0x5e999dd500000000, + 0xe54cb68b00000000, 0x5147c12d00000000, 0xcc5d291c00000000, + 0x78565eba00000000, 0xf668f97f00000000, 0x42638ed900000000, + 0xdf7966e800000000, 0x6b72114e00000000, 0x820259b800000000, + 0x36092e1e00000000, 0xab13c62f00000000, 0x1f18b18900000000, + 0x9126164c00000000, 0x252d61ea00000000, 0xb83789db00000000, + 0x0c3cfe7d00000000, 0x2bd068ec00000000, 0x9fdb1f4a00000000, + 0x02c1f77b00000000, 0xb6ca80dd00000000, 0x38f4271800000000, + 0x8cff50be00000000, 0x11e5b88f00000000, 0xa5eecf2900000000, + 0x4c9e87df00000000, 0xf895f07900000000, 0x658f184800000000, + 0xd1846fee00000000, 0x5fbac82b00000000, 0xebb1bf8d00000000, + 0x76ab57bc00000000, 0xc2a0201a00000000, 0xf2ea168800000000, + 0x46e1612e00000000, 0xdbfb891f00000000, 0x6ff0feb900000000, + 0xe1ce597c00000000, 0x55c52eda00000000, 0xc8dfc6eb00000000, + 0x7cd4b14d00000000, 0x95a4f9bb00000000, 0x21af8e1d00000000, + 0xbcb5662c00000000, 0x08be118a00000000, 0x8680b64f00000000, + 0x328bc1e900000000, 0xaf9129d800000000, 0x1b9a5e7e00000000, + 0x3c76c8ef00000000, 0x887dbf4900000000, 0x1567577800000000, + 0xa16c20de00000000, 0x2f52871b00000000, 0x9b59f0bd00000000, + 0x0643188c00000000, 0xb2486f2a00000000, 0x5b3827dc00000000, + 0xef33507a00000000, 0x7229b84b00000000, 0xc622cfed00000000, + 0x481c682800000000, 0xfc171f8e00000000, 0x610df7bf00000000, + 0xd506801900000000, 0x6ed3ab4700000000, 0xdad8dce100000000, + 0x47c234d000000000, 0xf3c9437600000000, 0x7df7e4b300000000, + 0xc9fc931500000000, 0x54e67b2400000000, 0xe0ed0c8200000000, + 0x099d447400000000, 0xbd9633d200000000, 0x208cdbe300000000, + 0x9487ac4500000000, 0x1ab90b8000000000, 0xaeb27c2600000000, + 0x33a8941700000000, 0x87a3e3b100000000, 0xa04f752000000000, + 0x1444028600000000, 0x895eeab700000000, 0x3d559d1100000000, + 0xb36b3ad400000000, 0x07604d7200000000, 0x9a7aa54300000000, + 0x2e71d2e500000000, 0xc7019a1300000000, 0x730aedb500000000, + 0xee10058400000000, 0x5a1b722200000000, 0xd425d5e700000000, + 0x602ea24100000000, 0xfd344a7000000000, 0x493f3dd600000000, + 0x8b9f1dcc00000000, 0x3f946a6a00000000, 0xa28e825b00000000, + 0x1685f5fd00000000, 0x98bb523800000000, 0x2cb0259e00000000, + 0xb1aacdaf00000000, 0x05a1ba0900000000, 0xecd1f2ff00000000, + 0x58da855900000000, 0xc5c06d6800000000, 0x71cb1ace00000000, + 0xfff5bd0b00000000, 0x4bfecaad00000000, 0xd6e4229c00000000, + 0x62ef553a00000000, 0x4503c3ab00000000, 0xf108b40d00000000, + 0x6c125c3c00000000, 0xd8192b9a00000000, 0x56278c5f00000000, + 0xe22cfbf900000000, 0x7f3613c800000000, 0xcb3d646e00000000, + 0x224d2c9800000000, 0x96465b3e00000000, 0x0b5cb30f00000000, + 0xbf57c4a900000000, 0x3169636c00000000, 0x856214ca00000000, + 0x1878fcfb00000000, 0xac738b5d00000000, 0x17a6a00300000000, + 0xa3add7a500000000, 0x3eb73f9400000000, 0x8abc483200000000, + 0x0482eff700000000, 0xb089985100000000, 0x2d93706000000000, + 0x999807c600000000, 0x70e84f3000000000, 0xc4e3389600000000, + 0x59f9d0a700000000, 0xedf2a70100000000, 0x63cc00c400000000, + 0xd7c7776200000000, 0x4add9f5300000000, 0xfed6e8f500000000, + 0xd93a7e6400000000, 0x6d3109c200000000, 0xf02be1f300000000, + 0x4420965500000000, 0xca1e319000000000, 0x7e15463600000000, + 0xe30fae0700000000, 0x5704d9a100000000, 0xbe74915700000000, + 0x0a7fe6f100000000, 0x97650ec000000000, 0x236e796600000000, + 0xad50dea300000000, 0x195ba90500000000, 0x8441413400000000, + 0x304a369200000000}, + {0x0000000000000000, 0x9e00aacc00000000, 0x7d07254200000000, + 0xe3078f8e00000000, 0xfa0e4a8400000000, 0x640ee04800000000, + 0x87096fc600000000, 0x1909c50a00000000, 0xb51be5d300000000, + 0x2b1b4f1f00000000, 0xc81cc09100000000, 0x561c6a5d00000000, + 0x4f15af5700000000, 0xd115059b00000000, 0x32128a1500000000, + 0xac1220d900000000, 0x2b31bb7c00000000, 0xb53111b000000000, + 0x56369e3e00000000, 0xc83634f200000000, 0xd13ff1f800000000, + 0x4f3f5b3400000000, 0xac38d4ba00000000, 0x32387e7600000000, + 0x9e2a5eaf00000000, 0x002af46300000000, 0xe32d7bed00000000, + 0x7d2dd12100000000, 0x6424142b00000000, 0xfa24bee700000000, + 0x1923316900000000, 0x87239ba500000000, 0x566276f900000000, + 0xc862dc3500000000, 0x2b6553bb00000000, 0xb565f97700000000, + 0xac6c3c7d00000000, 0x326c96b100000000, 0xd16b193f00000000, + 0x4f6bb3f300000000, 0xe379932a00000000, 0x7d7939e600000000, + 0x9e7eb66800000000, 0x007e1ca400000000, 0x1977d9ae00000000, + 0x8777736200000000, 0x6470fcec00000000, 0xfa70562000000000, + 0x7d53cd8500000000, 0xe353674900000000, 0x0054e8c700000000, + 0x9e54420b00000000, 0x875d870100000000, 0x195d2dcd00000000, + 0xfa5aa24300000000, 0x645a088f00000000, 0xc848285600000000, + 0x5648829a00000000, 0xb54f0d1400000000, 0x2b4fa7d800000000, + 0x324662d200000000, 0xac46c81e00000000, 0x4f41479000000000, + 0xd141ed5c00000000, 0xedc29d2900000000, 0x73c237e500000000, + 0x90c5b86b00000000, 0x0ec512a700000000, 0x17ccd7ad00000000, + 0x89cc7d6100000000, 0x6acbf2ef00000000, 0xf4cb582300000000, + 0x58d978fa00000000, 0xc6d9d23600000000, 0x25de5db800000000, + 0xbbdef77400000000, 0xa2d7327e00000000, 0x3cd798b200000000, + 0xdfd0173c00000000, 0x41d0bdf000000000, 0xc6f3265500000000, + 0x58f38c9900000000, 0xbbf4031700000000, 0x25f4a9db00000000, + 0x3cfd6cd100000000, 0xa2fdc61d00000000, 0x41fa499300000000, + 0xdffae35f00000000, 0x73e8c38600000000, 0xede8694a00000000, + 0x0eefe6c400000000, 0x90ef4c0800000000, 0x89e6890200000000, + 0x17e623ce00000000, 0xf4e1ac4000000000, 0x6ae1068c00000000, + 0xbba0ebd000000000, 0x25a0411c00000000, 0xc6a7ce9200000000, + 0x58a7645e00000000, 0x41aea15400000000, 0xdfae0b9800000000, + 0x3ca9841600000000, 0xa2a92eda00000000, 0x0ebb0e0300000000, + 0x90bba4cf00000000, 0x73bc2b4100000000, 0xedbc818d00000000, + 0xf4b5448700000000, 0x6ab5ee4b00000000, 0x89b261c500000000, + 0x17b2cb0900000000, 0x909150ac00000000, 0x0e91fa6000000000, + 0xed9675ee00000000, 0x7396df2200000000, 0x6a9f1a2800000000, + 0xf49fb0e400000000, 0x17983f6a00000000, 0x899895a600000000, + 0x258ab57f00000000, 0xbb8a1fb300000000, 0x588d903d00000000, + 0xc68d3af100000000, 0xdf84fffb00000000, 0x4184553700000000, + 0xa283dab900000000, 0x3c83707500000000, 0xda853b5300000000, + 0x4485919f00000000, 0xa7821e1100000000, 0x3982b4dd00000000, + 0x208b71d700000000, 0xbe8bdb1b00000000, 0x5d8c549500000000, + 0xc38cfe5900000000, 0x6f9ede8000000000, 0xf19e744c00000000, + 0x1299fbc200000000, 0x8c99510e00000000, 0x9590940400000000, + 0x0b903ec800000000, 0xe897b14600000000, 0x76971b8a00000000, + 0xf1b4802f00000000, 0x6fb42ae300000000, 0x8cb3a56d00000000, + 0x12b30fa100000000, 0x0bbacaab00000000, 0x95ba606700000000, + 0x76bdefe900000000, 0xe8bd452500000000, 0x44af65fc00000000, + 0xdaafcf3000000000, 0x39a840be00000000, 0xa7a8ea7200000000, + 0xbea12f7800000000, 0x20a185b400000000, 0xc3a60a3a00000000, + 0x5da6a0f600000000, 0x8ce74daa00000000, 0x12e7e76600000000, + 0xf1e068e800000000, 0x6fe0c22400000000, 0x76e9072e00000000, + 0xe8e9ade200000000, 0x0bee226c00000000, 0x95ee88a000000000, + 0x39fca87900000000, 0xa7fc02b500000000, 0x44fb8d3b00000000, + 0xdafb27f700000000, 0xc3f2e2fd00000000, 0x5df2483100000000, + 0xbef5c7bf00000000, 0x20f56d7300000000, 0xa7d6f6d600000000, + 0x39d65c1a00000000, 0xdad1d39400000000, 0x44d1795800000000, + 0x5dd8bc5200000000, 0xc3d8169e00000000, 0x20df991000000000, + 0xbedf33dc00000000, 0x12cd130500000000, 0x8ccdb9c900000000, + 0x6fca364700000000, 0xf1ca9c8b00000000, 0xe8c3598100000000, + 0x76c3f34d00000000, 0x95c47cc300000000, 0x0bc4d60f00000000, + 0x3747a67a00000000, 0xa9470cb600000000, 0x4a40833800000000, + 0xd44029f400000000, 0xcd49ecfe00000000, 0x5349463200000000, + 0xb04ec9bc00000000, 0x2e4e637000000000, 0x825c43a900000000, + 0x1c5ce96500000000, 0xff5b66eb00000000, 0x615bcc2700000000, + 0x7852092d00000000, 0xe652a3e100000000, 0x05552c6f00000000, + 0x9b5586a300000000, 0x1c761d0600000000, 0x8276b7ca00000000, + 0x6171384400000000, 0xff71928800000000, 0xe678578200000000, + 0x7878fd4e00000000, 0x9b7f72c000000000, 0x057fd80c00000000, + 0xa96df8d500000000, 0x376d521900000000, 0xd46add9700000000, + 0x4a6a775b00000000, 0x5363b25100000000, 0xcd63189d00000000, + 0x2e64971300000000, 0xb0643ddf00000000, 0x6125d08300000000, + 0xff257a4f00000000, 0x1c22f5c100000000, 0x82225f0d00000000, + 0x9b2b9a0700000000, 0x052b30cb00000000, 0xe62cbf4500000000, + 0x782c158900000000, 0xd43e355000000000, 0x4a3e9f9c00000000, + 0xa939101200000000, 0x3739bade00000000, 0x2e307fd400000000, + 0xb030d51800000000, 0x53375a9600000000, 0xcd37f05a00000000, + 0x4a146bff00000000, 0xd414c13300000000, 0x37134ebd00000000, + 0xa913e47100000000, 0xb01a217b00000000, 0x2e1a8bb700000000, + 0xcd1d043900000000, 0x531daef500000000, 0xff0f8e2c00000000, + 0x610f24e000000000, 0x8208ab6e00000000, 0x1c0801a200000000, + 0x0501c4a800000000, 0x9b016e6400000000, 0x7806e1ea00000000, + 0xe6064b2600000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, + 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, + 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, + 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, + 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, + 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, + 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, + 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, + 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, + 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, + 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, + 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, + 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, + 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, + 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, + 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, + 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, + 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, + 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, + 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, + 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, + 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, + 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, + 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, + 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, + 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, + 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, + 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, + 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, + 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, + 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, + 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, + 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, + 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, + 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, + 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, + 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, + 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, + 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, + 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, + 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, + 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, + 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, + 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, + 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, + 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, + 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, + 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, + 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, + 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, + 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, + 0xde0506f1}, + {0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, + 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, + 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, + 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, + 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, + 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, + 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, + 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, + 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, + 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, + 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, + 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, + 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, + 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, + 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, + 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, + 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, + 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, + 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, + 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, + 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, + 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, + 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, + 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, + 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, + 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, + 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, + 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, + 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, + 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, + 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, + 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, + 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, + 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, + 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, + 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, + 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, + 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, + 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, + 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, + 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, + 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, + 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, + 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, + 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, + 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, + 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, + 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, + 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, + 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, + 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, + 0xbe9834ed}, + {0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, + 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, + 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, + 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, + 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, + 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, + 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, + 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, + 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, + 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, + 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, + 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, + 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, + 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, + 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, + 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, + 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, + 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, + 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, + 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, + 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, + 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, + 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, + 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, + 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, + 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, + 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, + 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, + 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, + 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, + 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, + 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, + 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, + 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, + 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, + 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, + 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, + 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, + 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, + 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, + 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, + 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, + 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, + 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, + 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, + 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, + 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, + 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, + 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, + 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, + 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, + 0x9324fd72}, + {0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, + 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, + 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, + 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, + 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, + 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, + 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, + 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, + 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, + 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, + 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, + 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, + 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, + 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, + 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, + 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, + 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, + 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, + 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, + 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, + 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, + 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, + 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, + 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, + 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, + 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, + 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, + 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, + 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, + 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, + 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, + 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, + 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, + 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, + 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, + 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, + 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, + 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, + 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, + 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, + 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, + 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, + 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, + 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, + 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, + 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, + 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, + 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, + 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, + 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, + 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, + 0x8def022d}, + {0x00000000, 0x41311b19, 0x82623632, 0xc3532d2b, 0x04c56c64, + 0x45f4777d, 0x86a75a56, 0xc796414f, 0x088ad9c8, 0x49bbc2d1, + 0x8ae8effa, 0xcbd9f4e3, 0x0c4fb5ac, 0x4d7eaeb5, 0x8e2d839e, + 0xcf1c9887, 0x5112c24a, 0x1023d953, 0xd370f478, 0x9241ef61, + 0x55d7ae2e, 0x14e6b537, 0xd7b5981c, 0x96848305, 0x59981b82, + 0x18a9009b, 0xdbfa2db0, 0x9acb36a9, 0x5d5d77e6, 0x1c6c6cff, + 0xdf3f41d4, 0x9e0e5acd, 0xa2248495, 0xe3159f8c, 0x2046b2a7, + 0x6177a9be, 0xa6e1e8f1, 0xe7d0f3e8, 0x2483dec3, 0x65b2c5da, + 0xaaae5d5d, 0xeb9f4644, 0x28cc6b6f, 0x69fd7076, 0xae6b3139, + 0xef5a2a20, 0x2c09070b, 0x6d381c12, 0xf33646df, 0xb2075dc6, + 0x715470ed, 0x30656bf4, 0xf7f32abb, 0xb6c231a2, 0x75911c89, + 0x34a00790, 0xfbbc9f17, 0xba8d840e, 0x79dea925, 0x38efb23c, + 0xff79f373, 0xbe48e86a, 0x7d1bc541, 0x3c2ade58, 0x054f79f0, + 0x447e62e9, 0x872d4fc2, 0xc61c54db, 0x018a1594, 0x40bb0e8d, + 0x83e823a6, 0xc2d938bf, 0x0dc5a038, 0x4cf4bb21, 0x8fa7960a, + 0xce968d13, 0x0900cc5c, 0x4831d745, 0x8b62fa6e, 0xca53e177, + 0x545dbbba, 0x156ca0a3, 0xd63f8d88, 0x970e9691, 0x5098d7de, + 0x11a9ccc7, 0xd2fae1ec, 0x93cbfaf5, 0x5cd76272, 0x1de6796b, + 0xdeb55440, 0x9f844f59, 0x58120e16, 0x1923150f, 0xda703824, + 0x9b41233d, 0xa76bfd65, 0xe65ae67c, 0x2509cb57, 0x6438d04e, + 0xa3ae9101, 0xe29f8a18, 0x21cca733, 0x60fdbc2a, 0xafe124ad, + 0xeed03fb4, 0x2d83129f, 0x6cb20986, 0xab2448c9, 0xea1553d0, + 0x29467efb, 0x687765e2, 0xf6793f2f, 0xb7482436, 0x741b091d, + 0x352a1204, 0xf2bc534b, 0xb38d4852, 0x70de6579, 0x31ef7e60, + 0xfef3e6e7, 0xbfc2fdfe, 0x7c91d0d5, 0x3da0cbcc, 0xfa368a83, + 0xbb07919a, 0x7854bcb1, 0x3965a7a8, 0x4b98833b, 0x0aa99822, + 0xc9fab509, 0x88cbae10, 0x4f5def5f, 0x0e6cf446, 0xcd3fd96d, + 0x8c0ec274, 0x43125af3, 0x022341ea, 0xc1706cc1, 0x804177d8, + 0x47d73697, 0x06e62d8e, 0xc5b500a5, 0x84841bbc, 0x1a8a4171, + 0x5bbb5a68, 0x98e87743, 0xd9d96c5a, 0x1e4f2d15, 0x5f7e360c, + 0x9c2d1b27, 0xdd1c003e, 0x120098b9, 0x533183a0, 0x9062ae8b, + 0xd153b592, 0x16c5f4dd, 0x57f4efc4, 0x94a7c2ef, 0xd596d9f6, + 0xe9bc07ae, 0xa88d1cb7, 0x6bde319c, 0x2aef2a85, 0xed796bca, + 0xac4870d3, 0x6f1b5df8, 0x2e2a46e1, 0xe136de66, 0xa007c57f, + 0x6354e854, 0x2265f34d, 0xe5f3b202, 0xa4c2a91b, 0x67918430, + 0x26a09f29, 0xb8aec5e4, 0xf99fdefd, 0x3accf3d6, 0x7bfde8cf, + 0xbc6ba980, 0xfd5ab299, 0x3e099fb2, 0x7f3884ab, 0xb0241c2c, + 0xf1150735, 0x32462a1e, 0x73773107, 0xb4e17048, 0xf5d06b51, + 0x3683467a, 0x77b25d63, 0x4ed7facb, 0x0fe6e1d2, 0xccb5ccf9, + 0x8d84d7e0, 0x4a1296af, 0x0b238db6, 0xc870a09d, 0x8941bb84, + 0x465d2303, 0x076c381a, 0xc43f1531, 0x850e0e28, 0x42984f67, + 0x03a9547e, 0xc0fa7955, 0x81cb624c, 0x1fc53881, 0x5ef42398, + 0x9da70eb3, 0xdc9615aa, 0x1b0054e5, 0x5a314ffc, 0x996262d7, + 0xd85379ce, 0x174fe149, 0x567efa50, 0x952dd77b, 0xd41ccc62, + 0x138a8d2d, 0x52bb9634, 0x91e8bb1f, 0xd0d9a006, 0xecf37e5e, + 0xadc26547, 0x6e91486c, 0x2fa05375, 0xe836123a, 0xa9070923, + 0x6a542408, 0x2b653f11, 0xe479a796, 0xa548bc8f, 0x661b91a4, + 0x272a8abd, 0xe0bccbf2, 0xa18dd0eb, 0x62defdc0, 0x23efe6d9, + 0xbde1bc14, 0xfcd0a70d, 0x3f838a26, 0x7eb2913f, 0xb924d070, + 0xf815cb69, 0x3b46e642, 0x7a77fd5b, 0xb56b65dc, 0xf45a7ec5, + 0x370953ee, 0x763848f7, 0xb1ae09b8, 0xf09f12a1, 0x33cc3f8a, + 0x72fd2493}, + {0x00000000, 0x376ac201, 0x6ed48403, 0x59be4602, 0xdca80907, + 0xebc2cb06, 0xb27c8d04, 0x85164f05, 0xb851130e, 0x8f3bd10f, + 0xd685970d, 0xe1ef550c, 0x64f91a09, 0x5393d808, 0x0a2d9e0a, + 0x3d475c0b, 0x70a3261c, 0x47c9e41d, 0x1e77a21f, 0x291d601e, + 0xac0b2f1b, 0x9b61ed1a, 0xc2dfab18, 0xf5b56919, 0xc8f23512, + 0xff98f713, 0xa626b111, 0x914c7310, 0x145a3c15, 0x2330fe14, + 0x7a8eb816, 0x4de47a17, 0xe0464d38, 0xd72c8f39, 0x8e92c93b, + 0xb9f80b3a, 0x3cee443f, 0x0b84863e, 0x523ac03c, 0x6550023d, + 0x58175e36, 0x6f7d9c37, 0x36c3da35, 0x01a91834, 0x84bf5731, + 0xb3d59530, 0xea6bd332, 0xdd011133, 0x90e56b24, 0xa78fa925, + 0xfe31ef27, 0xc95b2d26, 0x4c4d6223, 0x7b27a022, 0x2299e620, + 0x15f32421, 0x28b4782a, 0x1fdeba2b, 0x4660fc29, 0x710a3e28, + 0xf41c712d, 0xc376b32c, 0x9ac8f52e, 0xada2372f, 0xc08d9a70, + 0xf7e75871, 0xae591e73, 0x9933dc72, 0x1c259377, 0x2b4f5176, + 0x72f11774, 0x459bd575, 0x78dc897e, 0x4fb64b7f, 0x16080d7d, + 0x2162cf7c, 0xa4748079, 0x931e4278, 0xcaa0047a, 0xfdcac67b, + 0xb02ebc6c, 0x87447e6d, 0xdefa386f, 0xe990fa6e, 0x6c86b56b, + 0x5bec776a, 0x02523168, 0x3538f369, 0x087faf62, 0x3f156d63, + 0x66ab2b61, 0x51c1e960, 0xd4d7a665, 0xe3bd6464, 0xba032266, + 0x8d69e067, 0x20cbd748, 0x17a11549, 0x4e1f534b, 0x7975914a, + 0xfc63de4f, 0xcb091c4e, 0x92b75a4c, 0xa5dd984d, 0x989ac446, + 0xaff00647, 0xf64e4045, 0xc1248244, 0x4432cd41, 0x73580f40, + 0x2ae64942, 0x1d8c8b43, 0x5068f154, 0x67023355, 0x3ebc7557, + 0x09d6b756, 0x8cc0f853, 0xbbaa3a52, 0xe2147c50, 0xd57ebe51, + 0xe839e25a, 0xdf53205b, 0x86ed6659, 0xb187a458, 0x3491eb5d, + 0x03fb295c, 0x5a456f5e, 0x6d2fad5f, 0x801b35e1, 0xb771f7e0, + 0xeecfb1e2, 0xd9a573e3, 0x5cb33ce6, 0x6bd9fee7, 0x3267b8e5, + 0x050d7ae4, 0x384a26ef, 0x0f20e4ee, 0x569ea2ec, 0x61f460ed, + 0xe4e22fe8, 0xd388ede9, 0x8a36abeb, 0xbd5c69ea, 0xf0b813fd, + 0xc7d2d1fc, 0x9e6c97fe, 0xa90655ff, 0x2c101afa, 0x1b7ad8fb, + 0x42c49ef9, 0x75ae5cf8, 0x48e900f3, 0x7f83c2f2, 0x263d84f0, + 0x115746f1, 0x944109f4, 0xa32bcbf5, 0xfa958df7, 0xcdff4ff6, + 0x605d78d9, 0x5737bad8, 0x0e89fcda, 0x39e33edb, 0xbcf571de, + 0x8b9fb3df, 0xd221f5dd, 0xe54b37dc, 0xd80c6bd7, 0xef66a9d6, + 0xb6d8efd4, 0x81b22dd5, 0x04a462d0, 0x33cea0d1, 0x6a70e6d3, + 0x5d1a24d2, 0x10fe5ec5, 0x27949cc4, 0x7e2adac6, 0x494018c7, + 0xcc5657c2, 0xfb3c95c3, 0xa282d3c1, 0x95e811c0, 0xa8af4dcb, + 0x9fc58fca, 0xc67bc9c8, 0xf1110bc9, 0x740744cc, 0x436d86cd, + 0x1ad3c0cf, 0x2db902ce, 0x4096af91, 0x77fc6d90, 0x2e422b92, + 0x1928e993, 0x9c3ea696, 0xab546497, 0xf2ea2295, 0xc580e094, + 0xf8c7bc9f, 0xcfad7e9e, 0x9613389c, 0xa179fa9d, 0x246fb598, + 0x13057799, 0x4abb319b, 0x7dd1f39a, 0x3035898d, 0x075f4b8c, + 0x5ee10d8e, 0x698bcf8f, 0xec9d808a, 0xdbf7428b, 0x82490489, + 0xb523c688, 0x88649a83, 0xbf0e5882, 0xe6b01e80, 0xd1dadc81, + 0x54cc9384, 0x63a65185, 0x3a181787, 0x0d72d586, 0xa0d0e2a9, + 0x97ba20a8, 0xce0466aa, 0xf96ea4ab, 0x7c78ebae, 0x4b1229af, + 0x12ac6fad, 0x25c6adac, 0x1881f1a7, 0x2feb33a6, 0x765575a4, + 0x413fb7a5, 0xc429f8a0, 0xf3433aa1, 0xaafd7ca3, 0x9d97bea2, + 0xd073c4b5, 0xe71906b4, 0xbea740b6, 0x89cd82b7, 0x0cdbcdb2, + 0x3bb10fb3, 0x620f49b1, 0x55658bb0, 0x6822d7bb, 0x5f4815ba, + 0x06f653b8, 0x319c91b9, 0xb48adebc, 0x83e01cbd, 0xda5e5abf, + 0xed3498be}, + {0x00000000, 0x6567bcb8, 0x8bc809aa, 0xeeafb512, 0x5797628f, + 0x32f0de37, 0xdc5f6b25, 0xb938d79d, 0xef28b4c5, 0x8a4f087d, + 0x64e0bd6f, 0x018701d7, 0xb8bfd64a, 0xddd86af2, 0x3377dfe0, + 0x56106358, 0x9f571950, 0xfa30a5e8, 0x149f10fa, 0x71f8ac42, + 0xc8c07bdf, 0xada7c767, 0x43087275, 0x266fcecd, 0x707fad95, + 0x1518112d, 0xfbb7a43f, 0x9ed01887, 0x27e8cf1a, 0x428f73a2, + 0xac20c6b0, 0xc9477a08, 0x3eaf32a0, 0x5bc88e18, 0xb5673b0a, + 0xd00087b2, 0x6938502f, 0x0c5fec97, 0xe2f05985, 0x8797e53d, + 0xd1878665, 0xb4e03add, 0x5a4f8fcf, 0x3f283377, 0x8610e4ea, + 0xe3775852, 0x0dd8ed40, 0x68bf51f8, 0xa1f82bf0, 0xc49f9748, + 0x2a30225a, 0x4f579ee2, 0xf66f497f, 0x9308f5c7, 0x7da740d5, + 0x18c0fc6d, 0x4ed09f35, 0x2bb7238d, 0xc518969f, 0xa07f2a27, + 0x1947fdba, 0x7c204102, 0x928ff410, 0xf7e848a8, 0x3d58149b, + 0x583fa823, 0xb6901d31, 0xd3f7a189, 0x6acf7614, 0x0fa8caac, + 0xe1077fbe, 0x8460c306, 0xd270a05e, 0xb7171ce6, 0x59b8a9f4, + 0x3cdf154c, 0x85e7c2d1, 0xe0807e69, 0x0e2fcb7b, 0x6b4877c3, + 0xa20f0dcb, 0xc768b173, 0x29c70461, 0x4ca0b8d9, 0xf5986f44, + 0x90ffd3fc, 0x7e5066ee, 0x1b37da56, 0x4d27b90e, 0x284005b6, + 0xc6efb0a4, 0xa3880c1c, 0x1ab0db81, 0x7fd76739, 0x9178d22b, + 0xf41f6e93, 0x03f7263b, 0x66909a83, 0x883f2f91, 0xed589329, + 0x546044b4, 0x3107f80c, 0xdfa84d1e, 0xbacff1a6, 0xecdf92fe, + 0x89b82e46, 0x67179b54, 0x027027ec, 0xbb48f071, 0xde2f4cc9, + 0x3080f9db, 0x55e74563, 0x9ca03f6b, 0xf9c783d3, 0x176836c1, + 0x720f8a79, 0xcb375de4, 0xae50e15c, 0x40ff544e, 0x2598e8f6, + 0x73888bae, 0x16ef3716, 0xf8408204, 0x9d273ebc, 0x241fe921, + 0x41785599, 0xafd7e08b, 0xcab05c33, 0x3bb659ed, 0x5ed1e555, + 0xb07e5047, 0xd519ecff, 0x6c213b62, 0x094687da, 0xe7e932c8, + 0x828e8e70, 0xd49eed28, 0xb1f95190, 0x5f56e482, 0x3a31583a, + 0x83098fa7, 0xe66e331f, 0x08c1860d, 0x6da63ab5, 0xa4e140bd, + 0xc186fc05, 0x2f294917, 0x4a4ef5af, 0xf3762232, 0x96119e8a, + 0x78be2b98, 0x1dd99720, 0x4bc9f478, 0x2eae48c0, 0xc001fdd2, + 0xa566416a, 0x1c5e96f7, 0x79392a4f, 0x97969f5d, 0xf2f123e5, + 0x05196b4d, 0x607ed7f5, 0x8ed162e7, 0xebb6de5f, 0x528e09c2, + 0x37e9b57a, 0xd9460068, 0xbc21bcd0, 0xea31df88, 0x8f566330, + 0x61f9d622, 0x049e6a9a, 0xbda6bd07, 0xd8c101bf, 0x366eb4ad, + 0x53090815, 0x9a4e721d, 0xff29cea5, 0x11867bb7, 0x74e1c70f, + 0xcdd91092, 0xa8beac2a, 0x46111938, 0x2376a580, 0x7566c6d8, + 0x10017a60, 0xfeaecf72, 0x9bc973ca, 0x22f1a457, 0x479618ef, + 0xa939adfd, 0xcc5e1145, 0x06ee4d76, 0x6389f1ce, 0x8d2644dc, + 0xe841f864, 0x51792ff9, 0x341e9341, 0xdab12653, 0xbfd69aeb, + 0xe9c6f9b3, 0x8ca1450b, 0x620ef019, 0x07694ca1, 0xbe519b3c, + 0xdb362784, 0x35999296, 0x50fe2e2e, 0x99b95426, 0xfcdee89e, + 0x12715d8c, 0x7716e134, 0xce2e36a9, 0xab498a11, 0x45e63f03, + 0x208183bb, 0x7691e0e3, 0x13f65c5b, 0xfd59e949, 0x983e55f1, + 0x2106826c, 0x44613ed4, 0xaace8bc6, 0xcfa9377e, 0x38417fd6, + 0x5d26c36e, 0xb389767c, 0xd6eecac4, 0x6fd61d59, 0x0ab1a1e1, + 0xe41e14f3, 0x8179a84b, 0xd769cb13, 0xb20e77ab, 0x5ca1c2b9, + 0x39c67e01, 0x80fea99c, 0xe5991524, 0x0b36a036, 0x6e511c8e, + 0xa7166686, 0xc271da3e, 0x2cde6f2c, 0x49b9d394, 0xf0810409, + 0x95e6b8b1, 0x7b490da3, 0x1e2eb11b, 0x483ed243, 0x2d596efb, + 0xc3f6dbe9, 0xa6916751, 0x1fa9b0cc, 0x7ace0c74, 0x9461b966, + 0xf10605de}}; + +#endif + +#endif + +#if N == 2 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xae689191, 0x87a02563, 0x29c8b4f2, 0xd4314c87, + 0x7a59dd16, 0x539169e4, 0xfdf9f875, 0x73139f4f, 0xdd7b0ede, + 0xf4b3ba2c, 0x5adb2bbd, 0xa722d3c8, 0x094a4259, 0x2082f6ab, + 0x8eea673a, 0xe6273e9e, 0x484faf0f, 0x61871bfd, 0xcfef8a6c, + 0x32167219, 0x9c7ee388, 0xb5b6577a, 0x1bdec6eb, 0x9534a1d1, + 0x3b5c3040, 0x129484b2, 0xbcfc1523, 0x4105ed56, 0xef6d7cc7, + 0xc6a5c835, 0x68cd59a4, 0x173f7b7d, 0xb957eaec, 0x909f5e1e, + 0x3ef7cf8f, 0xc30e37fa, 0x6d66a66b, 0x44ae1299, 0xeac68308, + 0x642ce432, 0xca4475a3, 0xe38cc151, 0x4de450c0, 0xb01da8b5, + 0x1e753924, 0x37bd8dd6, 0x99d51c47, 0xf11845e3, 0x5f70d472, + 0x76b86080, 0xd8d0f111, 0x25290964, 0x8b4198f5, 0xa2892c07, + 0x0ce1bd96, 0x820bdaac, 0x2c634b3d, 0x05abffcf, 0xabc36e5e, + 0x563a962b, 0xf85207ba, 0xd19ab348, 0x7ff222d9, 0x2e7ef6fa, + 0x8016676b, 0xa9ded399, 0x07b64208, 0xfa4fba7d, 0x54272bec, + 0x7def9f1e, 0xd3870e8f, 0x5d6d69b5, 0xf305f824, 0xdacd4cd6, + 0x74a5dd47, 0x895c2532, 0x2734b4a3, 0x0efc0051, 0xa09491c0, + 0xc859c864, 0x663159f5, 0x4ff9ed07, 0xe1917c96, 0x1c6884e3, + 0xb2001572, 0x9bc8a180, 0x35a03011, 0xbb4a572b, 0x1522c6ba, + 0x3cea7248, 0x9282e3d9, 0x6f7b1bac, 0xc1138a3d, 0xe8db3ecf, + 0x46b3af5e, 0x39418d87, 0x97291c16, 0xbee1a8e4, 0x10893975, + 0xed70c100, 0x43185091, 0x6ad0e463, 0xc4b875f2, 0x4a5212c8, + 0xe43a8359, 0xcdf237ab, 0x639aa63a, 0x9e635e4f, 0x300bcfde, + 0x19c37b2c, 0xb7abeabd, 0xdf66b319, 0x710e2288, 0x58c6967a, + 0xf6ae07eb, 0x0b57ff9e, 0xa53f6e0f, 0x8cf7dafd, 0x229f4b6c, + 0xac752c56, 0x021dbdc7, 0x2bd50935, 0x85bd98a4, 0x784460d1, + 0xd62cf140, 0xffe445b2, 0x518cd423, 0x5cfdedf4, 0xf2957c65, + 0xdb5dc897, 0x75355906, 0x88cca173, 0x26a430e2, 0x0f6c8410, + 0xa1041581, 0x2fee72bb, 0x8186e32a, 0xa84e57d8, 0x0626c649, + 0xfbdf3e3c, 0x55b7afad, 0x7c7f1b5f, 0xd2178ace, 0xbadad36a, + 0x14b242fb, 0x3d7af609, 0x93126798, 0x6eeb9fed, 0xc0830e7c, + 0xe94bba8e, 0x47232b1f, 0xc9c94c25, 0x67a1ddb4, 0x4e696946, + 0xe001f8d7, 0x1df800a2, 0xb3909133, 0x9a5825c1, 0x3430b450, + 0x4bc29689, 0xe5aa0718, 0xcc62b3ea, 0x620a227b, 0x9ff3da0e, + 0x319b4b9f, 0x1853ff6d, 0xb63b6efc, 0x38d109c6, 0x96b99857, + 0xbf712ca5, 0x1119bd34, 0xece04541, 0x4288d4d0, 0x6b406022, + 0xc528f1b3, 0xade5a817, 0x038d3986, 0x2a458d74, 0x842d1ce5, + 0x79d4e490, 0xd7bc7501, 0xfe74c1f3, 0x501c5062, 0xdef63758, + 0x709ea6c9, 0x5956123b, 0xf73e83aa, 0x0ac77bdf, 0xa4afea4e, + 0x8d675ebc, 0x230fcf2d, 0x72831b0e, 0xdceb8a9f, 0xf5233e6d, + 0x5b4baffc, 0xa6b25789, 0x08dac618, 0x211272ea, 0x8f7ae37b, + 0x01908441, 0xaff815d0, 0x8630a122, 0x285830b3, 0xd5a1c8c6, + 0x7bc95957, 0x5201eda5, 0xfc697c34, 0x94a42590, 0x3accb401, + 0x130400f3, 0xbd6c9162, 0x40956917, 0xeefdf886, 0xc7354c74, + 0x695ddde5, 0xe7b7badf, 0x49df2b4e, 0x60179fbc, 0xce7f0e2d, + 0x3386f658, 0x9dee67c9, 0xb426d33b, 0x1a4e42aa, 0x65bc6073, + 0xcbd4f1e2, 0xe21c4510, 0x4c74d481, 0xb18d2cf4, 0x1fe5bd65, + 0x362d0997, 0x98459806, 0x16afff3c, 0xb8c76ead, 0x910fda5f, + 0x3f674bce, 0xc29eb3bb, 0x6cf6222a, 0x453e96d8, 0xeb560749, + 0x839b5eed, 0x2df3cf7c, 0x043b7b8e, 0xaa53ea1f, 0x57aa126a, + 0xf9c283fb, 0xd00a3709, 0x7e62a698, 0xf088c1a2, 0x5ee05033, + 0x7728e4c1, 0xd9407550, 0x24b98d25, 0x8ad11cb4, 0xa319a846, + 0x0d7139d7}, + {0x00000000, 0xb9fbdbe8, 0xa886b191, 0x117d6a79, 0x8a7c6563, + 0x3387be8b, 0x22fad4f2, 0x9b010f1a, 0xcf89cc87, 0x7672176f, + 0x670f7d16, 0xdef4a6fe, 0x45f5a9e4, 0xfc0e720c, 0xed731875, + 0x5488c39d, 0x44629f4f, 0xfd9944a7, 0xece42ede, 0x551ff536, + 0xce1efa2c, 0x77e521c4, 0x66984bbd, 0xdf639055, 0x8beb53c8, + 0x32108820, 0x236de259, 0x9a9639b1, 0x019736ab, 0xb86ced43, + 0xa911873a, 0x10ea5cd2, 0x88c53e9e, 0x313ee576, 0x20438f0f, + 0x99b854e7, 0x02b95bfd, 0xbb428015, 0xaa3fea6c, 0x13c43184, + 0x474cf219, 0xfeb729f1, 0xefca4388, 0x56319860, 0xcd30977a, + 0x74cb4c92, 0x65b626eb, 0xdc4dfd03, 0xcca7a1d1, 0x755c7a39, + 0x64211040, 0xdddacba8, 0x46dbc4b2, 0xff201f5a, 0xee5d7523, + 0x57a6aecb, 0x032e6d56, 0xbad5b6be, 0xaba8dcc7, 0x1253072f, + 0x89520835, 0x30a9d3dd, 0x21d4b9a4, 0x982f624c, 0xcafb7b7d, + 0x7300a095, 0x627dcaec, 0xdb861104, 0x40871e1e, 0xf97cc5f6, + 0xe801af8f, 0x51fa7467, 0x0572b7fa, 0xbc896c12, 0xadf4066b, + 0x140fdd83, 0x8f0ed299, 0x36f50971, 0x27886308, 0x9e73b8e0, + 0x8e99e432, 0x37623fda, 0x261f55a3, 0x9fe48e4b, 0x04e58151, + 0xbd1e5ab9, 0xac6330c0, 0x1598eb28, 0x411028b5, 0xf8ebf35d, + 0xe9969924, 0x506d42cc, 0xcb6c4dd6, 0x7297963e, 0x63eafc47, + 0xda1127af, 0x423e45e3, 0xfbc59e0b, 0xeab8f472, 0x53432f9a, + 0xc8422080, 0x71b9fb68, 0x60c49111, 0xd93f4af9, 0x8db78964, + 0x344c528c, 0x253138f5, 0x9ccae31d, 0x07cbec07, 0xbe3037ef, + 0xaf4d5d96, 0x16b6867e, 0x065cdaac, 0xbfa70144, 0xaeda6b3d, + 0x1721b0d5, 0x8c20bfcf, 0x35db6427, 0x24a60e5e, 0x9d5dd5b6, + 0xc9d5162b, 0x702ecdc3, 0x6153a7ba, 0xd8a87c52, 0x43a97348, + 0xfa52a8a0, 0xeb2fc2d9, 0x52d41931, 0x4e87f0bb, 0xf77c2b53, + 0xe601412a, 0x5ffa9ac2, 0xc4fb95d8, 0x7d004e30, 0x6c7d2449, + 0xd586ffa1, 0x810e3c3c, 0x38f5e7d4, 0x29888dad, 0x90735645, + 0x0b72595f, 0xb28982b7, 0xa3f4e8ce, 0x1a0f3326, 0x0ae56ff4, + 0xb31eb41c, 0xa263de65, 0x1b98058d, 0x80990a97, 0x3962d17f, + 0x281fbb06, 0x91e460ee, 0xc56ca373, 0x7c97789b, 0x6dea12e2, + 0xd411c90a, 0x4f10c610, 0xf6eb1df8, 0xe7967781, 0x5e6dac69, + 0xc642ce25, 0x7fb915cd, 0x6ec47fb4, 0xd73fa45c, 0x4c3eab46, + 0xf5c570ae, 0xe4b81ad7, 0x5d43c13f, 0x09cb02a2, 0xb030d94a, + 0xa14db333, 0x18b668db, 0x83b767c1, 0x3a4cbc29, 0x2b31d650, + 0x92ca0db8, 0x8220516a, 0x3bdb8a82, 0x2aa6e0fb, 0x935d3b13, + 0x085c3409, 0xb1a7efe1, 0xa0da8598, 0x19215e70, 0x4da99ded, + 0xf4524605, 0xe52f2c7c, 0x5cd4f794, 0xc7d5f88e, 0x7e2e2366, + 0x6f53491f, 0xd6a892f7, 0x847c8bc6, 0x3d87502e, 0x2cfa3a57, + 0x9501e1bf, 0x0e00eea5, 0xb7fb354d, 0xa6865f34, 0x1f7d84dc, + 0x4bf54741, 0xf20e9ca9, 0xe373f6d0, 0x5a882d38, 0xc1892222, + 0x7872f9ca, 0x690f93b3, 0xd0f4485b, 0xc01e1489, 0x79e5cf61, + 0x6898a518, 0xd1637ef0, 0x4a6271ea, 0xf399aa02, 0xe2e4c07b, + 0x5b1f1b93, 0x0f97d80e, 0xb66c03e6, 0xa711699f, 0x1eeab277, + 0x85ebbd6d, 0x3c106685, 0x2d6d0cfc, 0x9496d714, 0x0cb9b558, + 0xb5426eb0, 0xa43f04c9, 0x1dc4df21, 0x86c5d03b, 0x3f3e0bd3, + 0x2e4361aa, 0x97b8ba42, 0xc33079df, 0x7acba237, 0x6bb6c84e, + 0xd24d13a6, 0x494c1cbc, 0xf0b7c754, 0xe1caad2d, 0x583176c5, + 0x48db2a17, 0xf120f1ff, 0xe05d9b86, 0x59a6406e, 0xc2a74f74, + 0x7b5c949c, 0x6a21fee5, 0xd3da250d, 0x8752e690, 0x3ea93d78, + 0x2fd45701, 0x962f8ce9, 0x0d2e83f3, 0xb4d5581b, 0xa5a83262, + 0x1c53e98a}, + {0x00000000, 0x9d0fe176, 0xe16ec4ad, 0x7c6125db, 0x19ac8f1b, + 0x84a36e6d, 0xf8c24bb6, 0x65cdaac0, 0x33591e36, 0xae56ff40, + 0xd237da9b, 0x4f383bed, 0x2af5912d, 0xb7fa705b, 0xcb9b5580, + 0x5694b4f6, 0x66b23c6c, 0xfbbddd1a, 0x87dcf8c1, 0x1ad319b7, + 0x7f1eb377, 0xe2115201, 0x9e7077da, 0x037f96ac, 0x55eb225a, + 0xc8e4c32c, 0xb485e6f7, 0x298a0781, 0x4c47ad41, 0xd1484c37, + 0xad2969ec, 0x3026889a, 0xcd6478d8, 0x506b99ae, 0x2c0abc75, + 0xb1055d03, 0xd4c8f7c3, 0x49c716b5, 0x35a6336e, 0xa8a9d218, + 0xfe3d66ee, 0x63328798, 0x1f53a243, 0x825c4335, 0xe791e9f5, + 0x7a9e0883, 0x06ff2d58, 0x9bf0cc2e, 0xabd644b4, 0x36d9a5c2, + 0x4ab88019, 0xd7b7616f, 0xb27acbaf, 0x2f752ad9, 0x53140f02, + 0xce1bee74, 0x988f5a82, 0x0580bbf4, 0x79e19e2f, 0xe4ee7f59, + 0x8123d599, 0x1c2c34ef, 0x604d1134, 0xfd42f042, 0x41b9f7f1, + 0xdcb61687, 0xa0d7335c, 0x3dd8d22a, 0x581578ea, 0xc51a999c, + 0xb97bbc47, 0x24745d31, 0x72e0e9c7, 0xefef08b1, 0x938e2d6a, + 0x0e81cc1c, 0x6b4c66dc, 0xf64387aa, 0x8a22a271, 0x172d4307, + 0x270bcb9d, 0xba042aeb, 0xc6650f30, 0x5b6aee46, 0x3ea74486, + 0xa3a8a5f0, 0xdfc9802b, 0x42c6615d, 0x1452d5ab, 0x895d34dd, + 0xf53c1106, 0x6833f070, 0x0dfe5ab0, 0x90f1bbc6, 0xec909e1d, + 0x719f7f6b, 0x8cdd8f29, 0x11d26e5f, 0x6db34b84, 0xf0bcaaf2, + 0x95710032, 0x087ee144, 0x741fc49f, 0xe91025e9, 0xbf84911f, + 0x228b7069, 0x5eea55b2, 0xc3e5b4c4, 0xa6281e04, 0x3b27ff72, + 0x4746daa9, 0xda493bdf, 0xea6fb345, 0x77605233, 0x0b0177e8, + 0x960e969e, 0xf3c33c5e, 0x6eccdd28, 0x12adf8f3, 0x8fa21985, + 0xd936ad73, 0x44394c05, 0x385869de, 0xa55788a8, 0xc09a2268, + 0x5d95c31e, 0x21f4e6c5, 0xbcfb07b3, 0x8373efe2, 0x1e7c0e94, + 0x621d2b4f, 0xff12ca39, 0x9adf60f9, 0x07d0818f, 0x7bb1a454, + 0xe6be4522, 0xb02af1d4, 0x2d2510a2, 0x51443579, 0xcc4bd40f, + 0xa9867ecf, 0x34899fb9, 0x48e8ba62, 0xd5e75b14, 0xe5c1d38e, + 0x78ce32f8, 0x04af1723, 0x99a0f655, 0xfc6d5c95, 0x6162bde3, + 0x1d039838, 0x800c794e, 0xd698cdb8, 0x4b972cce, 0x37f60915, + 0xaaf9e863, 0xcf3442a3, 0x523ba3d5, 0x2e5a860e, 0xb3556778, + 0x4e17973a, 0xd318764c, 0xaf795397, 0x3276b2e1, 0x57bb1821, + 0xcab4f957, 0xb6d5dc8c, 0x2bda3dfa, 0x7d4e890c, 0xe041687a, + 0x9c204da1, 0x012facd7, 0x64e20617, 0xf9ede761, 0x858cc2ba, + 0x188323cc, 0x28a5ab56, 0xb5aa4a20, 0xc9cb6ffb, 0x54c48e8d, + 0x3109244d, 0xac06c53b, 0xd067e0e0, 0x4d680196, 0x1bfcb560, + 0x86f35416, 0xfa9271cd, 0x679d90bb, 0x02503a7b, 0x9f5fdb0d, + 0xe33efed6, 0x7e311fa0, 0xc2ca1813, 0x5fc5f965, 0x23a4dcbe, + 0xbeab3dc8, 0xdb669708, 0x4669767e, 0x3a0853a5, 0xa707b2d3, + 0xf1930625, 0x6c9ce753, 0x10fdc288, 0x8df223fe, 0xe83f893e, + 0x75306848, 0x09514d93, 0x945eace5, 0xa478247f, 0x3977c509, + 0x4516e0d2, 0xd81901a4, 0xbdd4ab64, 0x20db4a12, 0x5cba6fc9, + 0xc1b58ebf, 0x97213a49, 0x0a2edb3f, 0x764ffee4, 0xeb401f92, + 0x8e8db552, 0x13825424, 0x6fe371ff, 0xf2ec9089, 0x0fae60cb, + 0x92a181bd, 0xeec0a466, 0x73cf4510, 0x1602efd0, 0x8b0d0ea6, + 0xf76c2b7d, 0x6a63ca0b, 0x3cf77efd, 0xa1f89f8b, 0xdd99ba50, + 0x40965b26, 0x255bf1e6, 0xb8541090, 0xc435354b, 0x593ad43d, + 0x691c5ca7, 0xf413bdd1, 0x8872980a, 0x157d797c, 0x70b0d3bc, + 0xedbf32ca, 0x91de1711, 0x0cd1f667, 0x5a454291, 0xc74aa3e7, + 0xbb2b863c, 0x2624674a, 0x43e9cd8a, 0xdee62cfc, 0xa2870927, + 0x3f88e851}, + {0x00000000, 0xdd96d985, 0x605cb54b, 0xbdca6cce, 0xc0b96a96, + 0x1d2fb313, 0xa0e5dfdd, 0x7d730658, 0x5a03d36d, 0x87950ae8, + 0x3a5f6626, 0xe7c9bfa3, 0x9abab9fb, 0x472c607e, 0xfae60cb0, + 0x2770d535, 0xb407a6da, 0x69917f5f, 0xd45b1391, 0x09cdca14, + 0x74becc4c, 0xa92815c9, 0x14e27907, 0xc974a082, 0xee0475b7, + 0x3392ac32, 0x8e58c0fc, 0x53ce1979, 0x2ebd1f21, 0xf32bc6a4, + 0x4ee1aa6a, 0x937773ef, 0xb37e4bf5, 0x6ee89270, 0xd322febe, + 0x0eb4273b, 0x73c72163, 0xae51f8e6, 0x139b9428, 0xce0d4dad, + 0xe97d9898, 0x34eb411d, 0x89212dd3, 0x54b7f456, 0x29c4f20e, + 0xf4522b8b, 0x49984745, 0x940e9ec0, 0x0779ed2f, 0xdaef34aa, + 0x67255864, 0xbab381e1, 0xc7c087b9, 0x1a565e3c, 0xa79c32f2, + 0x7a0aeb77, 0x5d7a3e42, 0x80ece7c7, 0x3d268b09, 0xe0b0528c, + 0x9dc354d4, 0x40558d51, 0xfd9fe19f, 0x2009381a, 0xbd8d91ab, + 0x601b482e, 0xddd124e0, 0x0047fd65, 0x7d34fb3d, 0xa0a222b8, + 0x1d684e76, 0xc0fe97f3, 0xe78e42c6, 0x3a189b43, 0x87d2f78d, + 0x5a442e08, 0x27372850, 0xfaa1f1d5, 0x476b9d1b, 0x9afd449e, + 0x098a3771, 0xd41ceef4, 0x69d6823a, 0xb4405bbf, 0xc9335de7, + 0x14a58462, 0xa96fe8ac, 0x74f93129, 0x5389e41c, 0x8e1f3d99, + 0x33d55157, 0xee4388d2, 0x93308e8a, 0x4ea6570f, 0xf36c3bc1, + 0x2efae244, 0x0ef3da5e, 0xd36503db, 0x6eaf6f15, 0xb339b690, + 0xce4ab0c8, 0x13dc694d, 0xae160583, 0x7380dc06, 0x54f00933, + 0x8966d0b6, 0x34acbc78, 0xe93a65fd, 0x944963a5, 0x49dfba20, + 0xf415d6ee, 0x29830f6b, 0xbaf47c84, 0x6762a501, 0xdaa8c9cf, + 0x073e104a, 0x7a4d1612, 0xa7dbcf97, 0x1a11a359, 0xc7877adc, + 0xe0f7afe9, 0x3d61766c, 0x80ab1aa2, 0x5d3dc327, 0x204ec57f, + 0xfdd81cfa, 0x40127034, 0x9d84a9b1, 0xa06a2517, 0x7dfcfc92, + 0xc036905c, 0x1da049d9, 0x60d34f81, 0xbd459604, 0x008ffaca, + 0xdd19234f, 0xfa69f67a, 0x27ff2fff, 0x9a354331, 0x47a39ab4, + 0x3ad09cec, 0xe7464569, 0x5a8c29a7, 0x871af022, 0x146d83cd, + 0xc9fb5a48, 0x74313686, 0xa9a7ef03, 0xd4d4e95b, 0x094230de, + 0xb4885c10, 0x691e8595, 0x4e6e50a0, 0x93f88925, 0x2e32e5eb, + 0xf3a43c6e, 0x8ed73a36, 0x5341e3b3, 0xee8b8f7d, 0x331d56f8, + 0x13146ee2, 0xce82b767, 0x7348dba9, 0xaede022c, 0xd3ad0474, + 0x0e3bddf1, 0xb3f1b13f, 0x6e6768ba, 0x4917bd8f, 0x9481640a, + 0x294b08c4, 0xf4ddd141, 0x89aed719, 0x54380e9c, 0xe9f26252, + 0x3464bbd7, 0xa713c838, 0x7a8511bd, 0xc74f7d73, 0x1ad9a4f6, + 0x67aaa2ae, 0xba3c7b2b, 0x07f617e5, 0xda60ce60, 0xfd101b55, + 0x2086c2d0, 0x9d4cae1e, 0x40da779b, 0x3da971c3, 0xe03fa846, + 0x5df5c488, 0x80631d0d, 0x1de7b4bc, 0xc0716d39, 0x7dbb01f7, + 0xa02dd872, 0xdd5ede2a, 0x00c807af, 0xbd026b61, 0x6094b2e4, + 0x47e467d1, 0x9a72be54, 0x27b8d29a, 0xfa2e0b1f, 0x875d0d47, + 0x5acbd4c2, 0xe701b80c, 0x3a976189, 0xa9e01266, 0x7476cbe3, + 0xc9bca72d, 0x142a7ea8, 0x695978f0, 0xb4cfa175, 0x0905cdbb, + 0xd493143e, 0xf3e3c10b, 0x2e75188e, 0x93bf7440, 0x4e29adc5, + 0x335aab9d, 0xeecc7218, 0x53061ed6, 0x8e90c753, 0xae99ff49, + 0x730f26cc, 0xcec54a02, 0x13539387, 0x6e2095df, 0xb3b64c5a, + 0x0e7c2094, 0xd3eaf911, 0xf49a2c24, 0x290cf5a1, 0x94c6996f, + 0x495040ea, 0x342346b2, 0xe9b59f37, 0x547ff3f9, 0x89e92a7c, + 0x1a9e5993, 0xc7088016, 0x7ac2ecd8, 0xa754355d, 0xda273305, + 0x07b1ea80, 0xba7b864e, 0x67ed5fcb, 0x409d8afe, 0x9d0b537b, + 0x20c13fb5, 0xfd57e630, 0x8024e068, 0x5db239ed, 0xe0785523, + 0x3dee8ca6}, + {0x00000000, 0x9ba54c6f, 0xec3b9e9f, 0x779ed2f0, 0x03063b7f, + 0x98a37710, 0xef3da5e0, 0x7498e98f, 0x060c76fe, 0x9da93a91, + 0xea37e861, 0x7192a40e, 0x050a4d81, 0x9eaf01ee, 0xe931d31e, + 0x72949f71, 0x0c18edfc, 0x97bda193, 0xe0237363, 0x7b863f0c, + 0x0f1ed683, 0x94bb9aec, 0xe325481c, 0x78800473, 0x0a149b02, + 0x91b1d76d, 0xe62f059d, 0x7d8a49f2, 0x0912a07d, 0x92b7ec12, + 0xe5293ee2, 0x7e8c728d, 0x1831dbf8, 0x83949797, 0xf40a4567, + 0x6faf0908, 0x1b37e087, 0x8092ace8, 0xf70c7e18, 0x6ca93277, + 0x1e3dad06, 0x8598e169, 0xf2063399, 0x69a37ff6, 0x1d3b9679, + 0x869eda16, 0xf10008e6, 0x6aa54489, 0x14293604, 0x8f8c7a6b, + 0xf812a89b, 0x63b7e4f4, 0x172f0d7b, 0x8c8a4114, 0xfb1493e4, + 0x60b1df8b, 0x122540fa, 0x89800c95, 0xfe1ede65, 0x65bb920a, + 0x11237b85, 0x8a8637ea, 0xfd18e51a, 0x66bda975, 0x3063b7f0, + 0xabc6fb9f, 0xdc58296f, 0x47fd6500, 0x33658c8f, 0xa8c0c0e0, + 0xdf5e1210, 0x44fb5e7f, 0x366fc10e, 0xadca8d61, 0xda545f91, + 0x41f113fe, 0x3569fa71, 0xaeccb61e, 0xd95264ee, 0x42f72881, + 0x3c7b5a0c, 0xa7de1663, 0xd040c493, 0x4be588fc, 0x3f7d6173, + 0xa4d82d1c, 0xd346ffec, 0x48e3b383, 0x3a772cf2, 0xa1d2609d, + 0xd64cb26d, 0x4de9fe02, 0x3971178d, 0xa2d45be2, 0xd54a8912, + 0x4eefc57d, 0x28526c08, 0xb3f72067, 0xc469f297, 0x5fccbef8, + 0x2b545777, 0xb0f11b18, 0xc76fc9e8, 0x5cca8587, 0x2e5e1af6, + 0xb5fb5699, 0xc2658469, 0x59c0c806, 0x2d582189, 0xb6fd6de6, + 0xc163bf16, 0x5ac6f379, 0x244a81f4, 0xbfefcd9b, 0xc8711f6b, + 0x53d45304, 0x274cba8b, 0xbce9f6e4, 0xcb772414, 0x50d2687b, + 0x2246f70a, 0xb9e3bb65, 0xce7d6995, 0x55d825fa, 0x2140cc75, + 0xbae5801a, 0xcd7b52ea, 0x56de1e85, 0x60c76fe0, 0xfb62238f, + 0x8cfcf17f, 0x1759bd10, 0x63c1549f, 0xf86418f0, 0x8ffaca00, + 0x145f866f, 0x66cb191e, 0xfd6e5571, 0x8af08781, 0x1155cbee, + 0x65cd2261, 0xfe686e0e, 0x89f6bcfe, 0x1253f091, 0x6cdf821c, + 0xf77ace73, 0x80e41c83, 0x1b4150ec, 0x6fd9b963, 0xf47cf50c, + 0x83e227fc, 0x18476b93, 0x6ad3f4e2, 0xf176b88d, 0x86e86a7d, + 0x1d4d2612, 0x69d5cf9d, 0xf27083f2, 0x85ee5102, 0x1e4b1d6d, + 0x78f6b418, 0xe353f877, 0x94cd2a87, 0x0f6866e8, 0x7bf08f67, + 0xe055c308, 0x97cb11f8, 0x0c6e5d97, 0x7efac2e6, 0xe55f8e89, + 0x92c15c79, 0x09641016, 0x7dfcf999, 0xe659b5f6, 0x91c76706, + 0x0a622b69, 0x74ee59e4, 0xef4b158b, 0x98d5c77b, 0x03708b14, + 0x77e8629b, 0xec4d2ef4, 0x9bd3fc04, 0x0076b06b, 0x72e22f1a, + 0xe9476375, 0x9ed9b185, 0x057cfdea, 0x71e41465, 0xea41580a, + 0x9ddf8afa, 0x067ac695, 0x50a4d810, 0xcb01947f, 0xbc9f468f, + 0x273a0ae0, 0x53a2e36f, 0xc807af00, 0xbf997df0, 0x243c319f, + 0x56a8aeee, 0xcd0de281, 0xba933071, 0x21367c1e, 0x55ae9591, + 0xce0bd9fe, 0xb9950b0e, 0x22304761, 0x5cbc35ec, 0xc7197983, + 0xb087ab73, 0x2b22e71c, 0x5fba0e93, 0xc41f42fc, 0xb381900c, + 0x2824dc63, 0x5ab04312, 0xc1150f7d, 0xb68bdd8d, 0x2d2e91e2, + 0x59b6786d, 0xc2133402, 0xb58de6f2, 0x2e28aa9d, 0x489503e8, + 0xd3304f87, 0xa4ae9d77, 0x3f0bd118, 0x4b933897, 0xd03674f8, + 0xa7a8a608, 0x3c0dea67, 0x4e997516, 0xd53c3979, 0xa2a2eb89, + 0x3907a7e6, 0x4d9f4e69, 0xd63a0206, 0xa1a4d0f6, 0x3a019c99, + 0x448dee14, 0xdf28a27b, 0xa8b6708b, 0x33133ce4, 0x478bd56b, + 0xdc2e9904, 0xabb04bf4, 0x3015079b, 0x428198ea, 0xd924d485, + 0xaeba0675, 0x351f4a1a, 0x4187a395, 0xda22effa, 0xadbc3d0a, + 0x36197165}, + {0x00000000, 0xc18edfc0, 0x586cb9c1, 0x99e26601, 0xb0d97382, + 0x7157ac42, 0xe8b5ca43, 0x293b1583, 0xbac3e145, 0x7b4d3e85, + 0xe2af5884, 0x23218744, 0x0a1a92c7, 0xcb944d07, 0x52762b06, + 0x93f8f4c6, 0xaef6c4cb, 0x6f781b0b, 0xf69a7d0a, 0x3714a2ca, + 0x1e2fb749, 0xdfa16889, 0x46430e88, 0x87cdd148, 0x1435258e, + 0xd5bbfa4e, 0x4c599c4f, 0x8dd7438f, 0xa4ec560c, 0x656289cc, + 0xfc80efcd, 0x3d0e300d, 0x869c8fd7, 0x47125017, 0xdef03616, + 0x1f7ee9d6, 0x3645fc55, 0xf7cb2395, 0x6e294594, 0xafa79a54, + 0x3c5f6e92, 0xfdd1b152, 0x6433d753, 0xa5bd0893, 0x8c861d10, + 0x4d08c2d0, 0xd4eaa4d1, 0x15647b11, 0x286a4b1c, 0xe9e494dc, + 0x7006f2dd, 0xb1882d1d, 0x98b3389e, 0x593de75e, 0xc0df815f, + 0x01515e9f, 0x92a9aa59, 0x53277599, 0xcac51398, 0x0b4bcc58, + 0x2270d9db, 0xe3fe061b, 0x7a1c601a, 0xbb92bfda, 0xd64819ef, + 0x17c6c62f, 0x8e24a02e, 0x4faa7fee, 0x66916a6d, 0xa71fb5ad, + 0x3efdd3ac, 0xff730c6c, 0x6c8bf8aa, 0xad05276a, 0x34e7416b, + 0xf5699eab, 0xdc528b28, 0x1ddc54e8, 0x843e32e9, 0x45b0ed29, + 0x78bedd24, 0xb93002e4, 0x20d264e5, 0xe15cbb25, 0xc867aea6, + 0x09e97166, 0x900b1767, 0x5185c8a7, 0xc27d3c61, 0x03f3e3a1, + 0x9a1185a0, 0x5b9f5a60, 0x72a44fe3, 0xb32a9023, 0x2ac8f622, + 0xeb4629e2, 0x50d49638, 0x915a49f8, 0x08b82ff9, 0xc936f039, + 0xe00de5ba, 0x21833a7a, 0xb8615c7b, 0x79ef83bb, 0xea17777d, + 0x2b99a8bd, 0xb27bcebc, 0x73f5117c, 0x5ace04ff, 0x9b40db3f, + 0x02a2bd3e, 0xc32c62fe, 0xfe2252f3, 0x3fac8d33, 0xa64eeb32, + 0x67c034f2, 0x4efb2171, 0x8f75feb1, 0x169798b0, 0xd7194770, + 0x44e1b3b6, 0x856f6c76, 0x1c8d0a77, 0xdd03d5b7, 0xf438c034, + 0x35b61ff4, 0xac5479f5, 0x6ddaa635, 0x77e1359f, 0xb66fea5f, + 0x2f8d8c5e, 0xee03539e, 0xc738461d, 0x06b699dd, 0x9f54ffdc, + 0x5eda201c, 0xcd22d4da, 0x0cac0b1a, 0x954e6d1b, 0x54c0b2db, + 0x7dfba758, 0xbc757898, 0x25971e99, 0xe419c159, 0xd917f154, + 0x18992e94, 0x817b4895, 0x40f59755, 0x69ce82d6, 0xa8405d16, + 0x31a23b17, 0xf02ce4d7, 0x63d41011, 0xa25acfd1, 0x3bb8a9d0, + 0xfa367610, 0xd30d6393, 0x1283bc53, 0x8b61da52, 0x4aef0592, + 0xf17dba48, 0x30f36588, 0xa9110389, 0x689fdc49, 0x41a4c9ca, + 0x802a160a, 0x19c8700b, 0xd846afcb, 0x4bbe5b0d, 0x8a3084cd, + 0x13d2e2cc, 0xd25c3d0c, 0xfb67288f, 0x3ae9f74f, 0xa30b914e, + 0x62854e8e, 0x5f8b7e83, 0x9e05a143, 0x07e7c742, 0xc6691882, + 0xef520d01, 0x2edcd2c1, 0xb73eb4c0, 0x76b06b00, 0xe5489fc6, + 0x24c64006, 0xbd242607, 0x7caaf9c7, 0x5591ec44, 0x941f3384, + 0x0dfd5585, 0xcc738a45, 0xa1a92c70, 0x6027f3b0, 0xf9c595b1, + 0x384b4a71, 0x11705ff2, 0xd0fe8032, 0x491ce633, 0x889239f3, + 0x1b6acd35, 0xdae412f5, 0x430674f4, 0x8288ab34, 0xabb3beb7, + 0x6a3d6177, 0xf3df0776, 0x3251d8b6, 0x0f5fe8bb, 0xced1377b, + 0x5733517a, 0x96bd8eba, 0xbf869b39, 0x7e0844f9, 0xe7ea22f8, + 0x2664fd38, 0xb59c09fe, 0x7412d63e, 0xedf0b03f, 0x2c7e6fff, + 0x05457a7c, 0xc4cba5bc, 0x5d29c3bd, 0x9ca71c7d, 0x2735a3a7, + 0xe6bb7c67, 0x7f591a66, 0xbed7c5a6, 0x97ecd025, 0x56620fe5, + 0xcf8069e4, 0x0e0eb624, 0x9df642e2, 0x5c789d22, 0xc59afb23, + 0x041424e3, 0x2d2f3160, 0xeca1eea0, 0x754388a1, 0xb4cd5761, + 0x89c3676c, 0x484db8ac, 0xd1afdead, 0x1021016d, 0x391a14ee, + 0xf894cb2e, 0x6176ad2f, 0xa0f872ef, 0x33008629, 0xf28e59e9, + 0x6b6c3fe8, 0xaae2e028, 0x83d9f5ab, 0x42572a6b, 0xdbb54c6a, + 0x1a3b93aa}, + {0x00000000, 0xefc26b3e, 0x04f5d03d, 0xeb37bb03, 0x09eba07a, + 0xe629cb44, 0x0d1e7047, 0xe2dc1b79, 0x13d740f4, 0xfc152bca, + 0x172290c9, 0xf8e0fbf7, 0x1a3ce08e, 0xf5fe8bb0, 0x1ec930b3, + 0xf10b5b8d, 0x27ae81e8, 0xc86cead6, 0x235b51d5, 0xcc993aeb, + 0x2e452192, 0xc1874aac, 0x2ab0f1af, 0xc5729a91, 0x3479c11c, + 0xdbbbaa22, 0x308c1121, 0xdf4e7a1f, 0x3d926166, 0xd2500a58, + 0x3967b15b, 0xd6a5da65, 0x4f5d03d0, 0xa09f68ee, 0x4ba8d3ed, + 0xa46ab8d3, 0x46b6a3aa, 0xa974c894, 0x42437397, 0xad8118a9, + 0x5c8a4324, 0xb348281a, 0x587f9319, 0xb7bdf827, 0x5561e35e, + 0xbaa38860, 0x51943363, 0xbe56585d, 0x68f38238, 0x8731e906, + 0x6c065205, 0x83c4393b, 0x61182242, 0x8eda497c, 0x65edf27f, + 0x8a2f9941, 0x7b24c2cc, 0x94e6a9f2, 0x7fd112f1, 0x901379cf, + 0x72cf62b6, 0x9d0d0988, 0x763ab28b, 0x99f8d9b5, 0x9eba07a0, + 0x71786c9e, 0x9a4fd79d, 0x758dbca3, 0x9751a7da, 0x7893cce4, + 0x93a477e7, 0x7c661cd9, 0x8d6d4754, 0x62af2c6a, 0x89989769, + 0x665afc57, 0x8486e72e, 0x6b448c10, 0x80733713, 0x6fb15c2d, + 0xb9148648, 0x56d6ed76, 0xbde15675, 0x52233d4b, 0xb0ff2632, + 0x5f3d4d0c, 0xb40af60f, 0x5bc89d31, 0xaac3c6bc, 0x4501ad82, + 0xae361681, 0x41f47dbf, 0xa32866c6, 0x4cea0df8, 0xa7ddb6fb, + 0x481fddc5, 0xd1e70470, 0x3e256f4e, 0xd512d44d, 0x3ad0bf73, + 0xd80ca40a, 0x37cecf34, 0xdcf97437, 0x333b1f09, 0xc2304484, + 0x2df22fba, 0xc6c594b9, 0x2907ff87, 0xcbdbe4fe, 0x24198fc0, + 0xcf2e34c3, 0x20ec5ffd, 0xf6498598, 0x198beea6, 0xf2bc55a5, + 0x1d7e3e9b, 0xffa225e2, 0x10604edc, 0xfb57f5df, 0x14959ee1, + 0xe59ec56c, 0x0a5cae52, 0xe16b1551, 0x0ea97e6f, 0xec756516, + 0x03b70e28, 0xe880b52b, 0x0742de15, 0xe6050901, 0x09c7623f, + 0xe2f0d93c, 0x0d32b202, 0xefeea97b, 0x002cc245, 0xeb1b7946, + 0x04d91278, 0xf5d249f5, 0x1a1022cb, 0xf12799c8, 0x1ee5f2f6, + 0xfc39e98f, 0x13fb82b1, 0xf8cc39b2, 0x170e528c, 0xc1ab88e9, + 0x2e69e3d7, 0xc55e58d4, 0x2a9c33ea, 0xc8402893, 0x278243ad, + 0xccb5f8ae, 0x23779390, 0xd27cc81d, 0x3dbea323, 0xd6891820, + 0x394b731e, 0xdb976867, 0x34550359, 0xdf62b85a, 0x30a0d364, + 0xa9580ad1, 0x469a61ef, 0xadaddaec, 0x426fb1d2, 0xa0b3aaab, + 0x4f71c195, 0xa4467a96, 0x4b8411a8, 0xba8f4a25, 0x554d211b, + 0xbe7a9a18, 0x51b8f126, 0xb364ea5f, 0x5ca68161, 0xb7913a62, + 0x5853515c, 0x8ef68b39, 0x6134e007, 0x8a035b04, 0x65c1303a, + 0x871d2b43, 0x68df407d, 0x83e8fb7e, 0x6c2a9040, 0x9d21cbcd, + 0x72e3a0f3, 0x99d41bf0, 0x761670ce, 0x94ca6bb7, 0x7b080089, + 0x903fbb8a, 0x7ffdd0b4, 0x78bf0ea1, 0x977d659f, 0x7c4ade9c, + 0x9388b5a2, 0x7154aedb, 0x9e96c5e5, 0x75a17ee6, 0x9a6315d8, + 0x6b684e55, 0x84aa256b, 0x6f9d9e68, 0x805ff556, 0x6283ee2f, + 0x8d418511, 0x66763e12, 0x89b4552c, 0x5f118f49, 0xb0d3e477, + 0x5be45f74, 0xb426344a, 0x56fa2f33, 0xb938440d, 0x520fff0e, + 0xbdcd9430, 0x4cc6cfbd, 0xa304a483, 0x48331f80, 0xa7f174be, + 0x452d6fc7, 0xaaef04f9, 0x41d8bffa, 0xae1ad4c4, 0x37e20d71, + 0xd820664f, 0x3317dd4c, 0xdcd5b672, 0x3e09ad0b, 0xd1cbc635, + 0x3afc7d36, 0xd53e1608, 0x24354d85, 0xcbf726bb, 0x20c09db8, + 0xcf02f686, 0x2ddeedff, 0xc21c86c1, 0x292b3dc2, 0xc6e956fc, + 0x104c8c99, 0xff8ee7a7, 0x14b95ca4, 0xfb7b379a, 0x19a72ce3, + 0xf66547dd, 0x1d52fcde, 0xf29097e0, 0x039bcc6d, 0xec59a753, + 0x076e1c50, 0xe8ac776e, 0x0a706c17, 0xe5b20729, 0x0e85bc2a, + 0xe147d714}, + {0x00000000, 0x177b1443, 0x2ef62886, 0x398d3cc5, 0x5dec510c, + 0x4a97454f, 0x731a798a, 0x64616dc9, 0xbbd8a218, 0xaca3b65b, + 0x952e8a9e, 0x82559edd, 0xe634f314, 0xf14fe757, 0xc8c2db92, + 0xdfb9cfd1, 0xacc04271, 0xbbbb5632, 0x82366af7, 0x954d7eb4, + 0xf12c137d, 0xe657073e, 0xdfda3bfb, 0xc8a12fb8, 0x1718e069, + 0x0063f42a, 0x39eec8ef, 0x2e95dcac, 0x4af4b165, 0x5d8fa526, + 0x640299e3, 0x73798da0, 0x82f182a3, 0x958a96e0, 0xac07aa25, + 0xbb7cbe66, 0xdf1dd3af, 0xc866c7ec, 0xf1ebfb29, 0xe690ef6a, + 0x392920bb, 0x2e5234f8, 0x17df083d, 0x00a41c7e, 0x64c571b7, + 0x73be65f4, 0x4a335931, 0x5d484d72, 0x2e31c0d2, 0x394ad491, + 0x00c7e854, 0x17bcfc17, 0x73dd91de, 0x64a6859d, 0x5d2bb958, + 0x4a50ad1b, 0x95e962ca, 0x82927689, 0xbb1f4a4c, 0xac645e0f, + 0xc80533c6, 0xdf7e2785, 0xe6f31b40, 0xf1880f03, 0xde920307, + 0xc9e91744, 0xf0642b81, 0xe71f3fc2, 0x837e520b, 0x94054648, + 0xad887a8d, 0xbaf36ece, 0x654aa11f, 0x7231b55c, 0x4bbc8999, + 0x5cc79dda, 0x38a6f013, 0x2fdde450, 0x1650d895, 0x012bccd6, + 0x72524176, 0x65295535, 0x5ca469f0, 0x4bdf7db3, 0x2fbe107a, + 0x38c50439, 0x014838fc, 0x16332cbf, 0xc98ae36e, 0xdef1f72d, + 0xe77ccbe8, 0xf007dfab, 0x9466b262, 0x831da621, 0xba909ae4, + 0xadeb8ea7, 0x5c6381a4, 0x4b1895e7, 0x7295a922, 0x65eebd61, + 0x018fd0a8, 0x16f4c4eb, 0x2f79f82e, 0x3802ec6d, 0xe7bb23bc, + 0xf0c037ff, 0xc94d0b3a, 0xde361f79, 0xba5772b0, 0xad2c66f3, + 0x94a15a36, 0x83da4e75, 0xf0a3c3d5, 0xe7d8d796, 0xde55eb53, + 0xc92eff10, 0xad4f92d9, 0xba34869a, 0x83b9ba5f, 0x94c2ae1c, + 0x4b7b61cd, 0x5c00758e, 0x658d494b, 0x72f65d08, 0x169730c1, + 0x01ec2482, 0x38611847, 0x2f1a0c04, 0x6655004f, 0x712e140c, + 0x48a328c9, 0x5fd83c8a, 0x3bb95143, 0x2cc24500, 0x154f79c5, + 0x02346d86, 0xdd8da257, 0xcaf6b614, 0xf37b8ad1, 0xe4009e92, + 0x8061f35b, 0x971ae718, 0xae97dbdd, 0xb9eccf9e, 0xca95423e, + 0xddee567d, 0xe4636ab8, 0xf3187efb, 0x97791332, 0x80020771, + 0xb98f3bb4, 0xaef42ff7, 0x714de026, 0x6636f465, 0x5fbbc8a0, + 0x48c0dce3, 0x2ca1b12a, 0x3bdaa569, 0x025799ac, 0x152c8def, + 0xe4a482ec, 0xf3df96af, 0xca52aa6a, 0xdd29be29, 0xb948d3e0, + 0xae33c7a3, 0x97befb66, 0x80c5ef25, 0x5f7c20f4, 0x480734b7, + 0x718a0872, 0x66f11c31, 0x029071f8, 0x15eb65bb, 0x2c66597e, + 0x3b1d4d3d, 0x4864c09d, 0x5f1fd4de, 0x6692e81b, 0x71e9fc58, + 0x15889191, 0x02f385d2, 0x3b7eb917, 0x2c05ad54, 0xf3bc6285, + 0xe4c776c6, 0xdd4a4a03, 0xca315e40, 0xae503389, 0xb92b27ca, + 0x80a61b0f, 0x97dd0f4c, 0xb8c70348, 0xafbc170b, 0x96312bce, + 0x814a3f8d, 0xe52b5244, 0xf2504607, 0xcbdd7ac2, 0xdca66e81, + 0x031fa150, 0x1464b513, 0x2de989d6, 0x3a929d95, 0x5ef3f05c, + 0x4988e41f, 0x7005d8da, 0x677ecc99, 0x14074139, 0x037c557a, + 0x3af169bf, 0x2d8a7dfc, 0x49eb1035, 0x5e900476, 0x671d38b3, + 0x70662cf0, 0xafdfe321, 0xb8a4f762, 0x8129cba7, 0x9652dfe4, + 0xf233b22d, 0xe548a66e, 0xdcc59aab, 0xcbbe8ee8, 0x3a3681eb, + 0x2d4d95a8, 0x14c0a96d, 0x03bbbd2e, 0x67dad0e7, 0x70a1c4a4, + 0x492cf861, 0x5e57ec22, 0x81ee23f3, 0x969537b0, 0xaf180b75, + 0xb8631f36, 0xdc0272ff, 0xcb7966bc, 0xf2f45a79, 0xe58f4e3a, + 0x96f6c39a, 0x818dd7d9, 0xb800eb1c, 0xaf7bff5f, 0xcb1a9296, + 0xdc6186d5, 0xe5ecba10, 0xf297ae53, 0x2d2e6182, 0x3a5575c1, + 0x03d84904, 0x14a35d47, 0x70c2308e, 0x67b924cd, 0x5e341808, + 0x494f0c4b}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x43147b1700000000, 0x8628f62e00000000, + 0xc53c8d3900000000, 0x0c51ec5d00000000, 0x4f45974a00000000, + 0x8a791a7300000000, 0xc96d616400000000, 0x18a2d8bb00000000, + 0x5bb6a3ac00000000, 0x9e8a2e9500000000, 0xdd9e558200000000, + 0x14f334e600000000, 0x57e74ff100000000, 0x92dbc2c800000000, + 0xd1cfb9df00000000, 0x7142c0ac00000000, 0x3256bbbb00000000, + 0xf76a368200000000, 0xb47e4d9500000000, 0x7d132cf100000000, + 0x3e0757e600000000, 0xfb3bdadf00000000, 0xb82fa1c800000000, + 0x69e0181700000000, 0x2af4630000000000, 0xefc8ee3900000000, + 0xacdc952e00000000, 0x65b1f44a00000000, 0x26a58f5d00000000, + 0xe399026400000000, 0xa08d797300000000, 0xa382f18200000000, + 0xe0968a9500000000, 0x25aa07ac00000000, 0x66be7cbb00000000, + 0xafd31ddf00000000, 0xecc766c800000000, 0x29fbebf100000000, + 0x6aef90e600000000, 0xbb20293900000000, 0xf834522e00000000, + 0x3d08df1700000000, 0x7e1ca40000000000, 0xb771c56400000000, + 0xf465be7300000000, 0x3159334a00000000, 0x724d485d00000000, + 0xd2c0312e00000000, 0x91d44a3900000000, 0x54e8c70000000000, + 0x17fcbc1700000000, 0xde91dd7300000000, 0x9d85a66400000000, + 0x58b92b5d00000000, 0x1bad504a00000000, 0xca62e99500000000, + 0x8976928200000000, 0x4c4a1fbb00000000, 0x0f5e64ac00000000, + 0xc63305c800000000, 0x85277edf00000000, 0x401bf3e600000000, + 0x030f88f100000000, 0x070392de00000000, 0x4417e9c900000000, + 0x812b64f000000000, 0xc23f1fe700000000, 0x0b527e8300000000, + 0x4846059400000000, 0x8d7a88ad00000000, 0xce6ef3ba00000000, + 0x1fa14a6500000000, 0x5cb5317200000000, 0x9989bc4b00000000, + 0xda9dc75c00000000, 0x13f0a63800000000, 0x50e4dd2f00000000, + 0x95d8501600000000, 0xd6cc2b0100000000, 0x7641527200000000, + 0x3555296500000000, 0xf069a45c00000000, 0xb37ddf4b00000000, + 0x7a10be2f00000000, 0x3904c53800000000, 0xfc38480100000000, + 0xbf2c331600000000, 0x6ee38ac900000000, 0x2df7f1de00000000, + 0xe8cb7ce700000000, 0xabdf07f000000000, 0x62b2669400000000, + 0x21a61d8300000000, 0xe49a90ba00000000, 0xa78eebad00000000, + 0xa481635c00000000, 0xe795184b00000000, 0x22a9957200000000, + 0x61bdee6500000000, 0xa8d08f0100000000, 0xebc4f41600000000, + 0x2ef8792f00000000, 0x6dec023800000000, 0xbc23bbe700000000, + 0xff37c0f000000000, 0x3a0b4dc900000000, 0x791f36de00000000, + 0xb07257ba00000000, 0xf3662cad00000000, 0x365aa19400000000, + 0x754eda8300000000, 0xd5c3a3f000000000, 0x96d7d8e700000000, + 0x53eb55de00000000, 0x10ff2ec900000000, 0xd9924fad00000000, + 0x9a8634ba00000000, 0x5fbab98300000000, 0x1caec29400000000, + 0xcd617b4b00000000, 0x8e75005c00000000, 0x4b498d6500000000, + 0x085df67200000000, 0xc130971600000000, 0x8224ec0100000000, + 0x4718613800000000, 0x040c1a2f00000000, 0x4f00556600000000, + 0x0c142e7100000000, 0xc928a34800000000, 0x8a3cd85f00000000, + 0x4351b93b00000000, 0x0045c22c00000000, 0xc5794f1500000000, + 0x866d340200000000, 0x57a28ddd00000000, 0x14b6f6ca00000000, + 0xd18a7bf300000000, 0x929e00e400000000, 0x5bf3618000000000, + 0x18e71a9700000000, 0xdddb97ae00000000, 0x9ecfecb900000000, + 0x3e4295ca00000000, 0x7d56eedd00000000, 0xb86a63e400000000, + 0xfb7e18f300000000, 0x3213799700000000, 0x7107028000000000, + 0xb43b8fb900000000, 0xf72ff4ae00000000, 0x26e04d7100000000, + 0x65f4366600000000, 0xa0c8bb5f00000000, 0xe3dcc04800000000, + 0x2ab1a12c00000000, 0x69a5da3b00000000, 0xac99570200000000, + 0xef8d2c1500000000, 0xec82a4e400000000, 0xaf96dff300000000, + 0x6aaa52ca00000000, 0x29be29dd00000000, 0xe0d348b900000000, + 0xa3c733ae00000000, 0x66fbbe9700000000, 0x25efc58000000000, + 0xf4207c5f00000000, 0xb734074800000000, 0x72088a7100000000, + 0x311cf16600000000, 0xf871900200000000, 0xbb65eb1500000000, + 0x7e59662c00000000, 0x3d4d1d3b00000000, 0x9dc0644800000000, + 0xded41f5f00000000, 0x1be8926600000000, 0x58fce97100000000, + 0x9191881500000000, 0xd285f30200000000, 0x17b97e3b00000000, + 0x54ad052c00000000, 0x8562bcf300000000, 0xc676c7e400000000, + 0x034a4add00000000, 0x405e31ca00000000, 0x893350ae00000000, + 0xca272bb900000000, 0x0f1ba68000000000, 0x4c0fdd9700000000, + 0x4803c7b800000000, 0x0b17bcaf00000000, 0xce2b319600000000, + 0x8d3f4a8100000000, 0x44522be500000000, 0x074650f200000000, + 0xc27addcb00000000, 0x816ea6dc00000000, 0x50a11f0300000000, + 0x13b5641400000000, 0xd689e92d00000000, 0x959d923a00000000, + 0x5cf0f35e00000000, 0x1fe4884900000000, 0xdad8057000000000, + 0x99cc7e6700000000, 0x3941071400000000, 0x7a557c0300000000, + 0xbf69f13a00000000, 0xfc7d8a2d00000000, 0x3510eb4900000000, + 0x7604905e00000000, 0xb3381d6700000000, 0xf02c667000000000, + 0x21e3dfaf00000000, 0x62f7a4b800000000, 0xa7cb298100000000, + 0xe4df529600000000, 0x2db233f200000000, 0x6ea648e500000000, + 0xab9ac5dc00000000, 0xe88ebecb00000000, 0xeb81363a00000000, + 0xa8954d2d00000000, 0x6da9c01400000000, 0x2ebdbb0300000000, + 0xe7d0da6700000000, 0xa4c4a17000000000, 0x61f82c4900000000, + 0x22ec575e00000000, 0xf323ee8100000000, 0xb037959600000000, + 0x750b18af00000000, 0x361f63b800000000, 0xff7202dc00000000, + 0xbc6679cb00000000, 0x795af4f200000000, 0x3a4e8fe500000000, + 0x9ac3f69600000000, 0xd9d78d8100000000, 0x1ceb00b800000000, + 0x5fff7baf00000000, 0x96921acb00000000, 0xd58661dc00000000, + 0x10baece500000000, 0x53ae97f200000000, 0x82612e2d00000000, + 0xc175553a00000000, 0x0449d80300000000, 0x475da31400000000, + 0x8e30c27000000000, 0xcd24b96700000000, 0x0818345e00000000, + 0x4b0c4f4900000000}, + {0x0000000000000000, 0x3e6bc2ef00000000, 0x3dd0f50400000000, + 0x03bb37eb00000000, 0x7aa0eb0900000000, 0x44cb29e600000000, + 0x47701e0d00000000, 0x791bdce200000000, 0xf440d71300000000, + 0xca2b15fc00000000, 0xc990221700000000, 0xf7fbe0f800000000, + 0x8ee03c1a00000000, 0xb08bfef500000000, 0xb330c91e00000000, + 0x8d5b0bf100000000, 0xe881ae2700000000, 0xd6ea6cc800000000, + 0xd5515b2300000000, 0xeb3a99cc00000000, 0x9221452e00000000, + 0xac4a87c100000000, 0xaff1b02a00000000, 0x919a72c500000000, + 0x1cc1793400000000, 0x22aabbdb00000000, 0x21118c3000000000, + 0x1f7a4edf00000000, 0x6661923d00000000, 0x580a50d200000000, + 0x5bb1673900000000, 0x65daa5d600000000, 0xd0035d4f00000000, + 0xee689fa000000000, 0xedd3a84b00000000, 0xd3b86aa400000000, + 0xaaa3b64600000000, 0x94c874a900000000, 0x9773434200000000, + 0xa91881ad00000000, 0x24438a5c00000000, 0x1a2848b300000000, + 0x19937f5800000000, 0x27f8bdb700000000, 0x5ee3615500000000, + 0x6088a3ba00000000, 0x6333945100000000, 0x5d5856be00000000, + 0x3882f36800000000, 0x06e9318700000000, 0x0552066c00000000, + 0x3b39c48300000000, 0x4222186100000000, 0x7c49da8e00000000, + 0x7ff2ed6500000000, 0x41992f8a00000000, 0xccc2247b00000000, + 0xf2a9e69400000000, 0xf112d17f00000000, 0xcf79139000000000, + 0xb662cf7200000000, 0x88090d9d00000000, 0x8bb23a7600000000, + 0xb5d9f89900000000, 0xa007ba9e00000000, 0x9e6c787100000000, + 0x9dd74f9a00000000, 0xa3bc8d7500000000, 0xdaa7519700000000, + 0xe4cc937800000000, 0xe777a49300000000, 0xd91c667c00000000, + 0x54476d8d00000000, 0x6a2caf6200000000, 0x6997988900000000, + 0x57fc5a6600000000, 0x2ee7868400000000, 0x108c446b00000000, + 0x1337738000000000, 0x2d5cb16f00000000, 0x488614b900000000, + 0x76edd65600000000, 0x7556e1bd00000000, 0x4b3d235200000000, + 0x3226ffb000000000, 0x0c4d3d5f00000000, 0x0ff60ab400000000, + 0x319dc85b00000000, 0xbcc6c3aa00000000, 0x82ad014500000000, + 0x811636ae00000000, 0xbf7df44100000000, 0xc66628a300000000, + 0xf80dea4c00000000, 0xfbb6dda700000000, 0xc5dd1f4800000000, + 0x7004e7d100000000, 0x4e6f253e00000000, 0x4dd412d500000000, + 0x73bfd03a00000000, 0x0aa40cd800000000, 0x34cfce3700000000, + 0x3774f9dc00000000, 0x091f3b3300000000, 0x844430c200000000, + 0xba2ff22d00000000, 0xb994c5c600000000, 0x87ff072900000000, + 0xfee4dbcb00000000, 0xc08f192400000000, 0xc3342ecf00000000, + 0xfd5fec2000000000, 0x988549f600000000, 0xa6ee8b1900000000, + 0xa555bcf200000000, 0x9b3e7e1d00000000, 0xe225a2ff00000000, + 0xdc4e601000000000, 0xdff557fb00000000, 0xe19e951400000000, + 0x6cc59ee500000000, 0x52ae5c0a00000000, 0x51156be100000000, + 0x6f7ea90e00000000, 0x166575ec00000000, 0x280eb70300000000, + 0x2bb580e800000000, 0x15de420700000000, 0x010905e600000000, + 0x3f62c70900000000, 0x3cd9f0e200000000, 0x02b2320d00000000, + 0x7ba9eeef00000000, 0x45c22c0000000000, 0x46791beb00000000, + 0x7812d90400000000, 0xf549d2f500000000, 0xcb22101a00000000, + 0xc89927f100000000, 0xf6f2e51e00000000, 0x8fe939fc00000000, + 0xb182fb1300000000, 0xb239ccf800000000, 0x8c520e1700000000, + 0xe988abc100000000, 0xd7e3692e00000000, 0xd4585ec500000000, + 0xea339c2a00000000, 0x932840c800000000, 0xad43822700000000, + 0xaef8b5cc00000000, 0x9093772300000000, 0x1dc87cd200000000, + 0x23a3be3d00000000, 0x201889d600000000, 0x1e734b3900000000, + 0x676897db00000000, 0x5903553400000000, 0x5ab862df00000000, + 0x64d3a03000000000, 0xd10a58a900000000, 0xef619a4600000000, + 0xecdaadad00000000, 0xd2b16f4200000000, 0xabaab3a000000000, + 0x95c1714f00000000, 0x967a46a400000000, 0xa811844b00000000, + 0x254a8fba00000000, 0x1b214d5500000000, 0x189a7abe00000000, + 0x26f1b85100000000, 0x5fea64b300000000, 0x6181a65c00000000, + 0x623a91b700000000, 0x5c51535800000000, 0x398bf68e00000000, + 0x07e0346100000000, 0x045b038a00000000, 0x3a30c16500000000, + 0x432b1d8700000000, 0x7d40df6800000000, 0x7efbe88300000000, + 0x40902a6c00000000, 0xcdcb219d00000000, 0xf3a0e37200000000, + 0xf01bd49900000000, 0xce70167600000000, 0xb76bca9400000000, + 0x8900087b00000000, 0x8abb3f9000000000, 0xb4d0fd7f00000000, + 0xa10ebf7800000000, 0x9f657d9700000000, 0x9cde4a7c00000000, + 0xa2b5889300000000, 0xdbae547100000000, 0xe5c5969e00000000, + 0xe67ea17500000000, 0xd815639a00000000, 0x554e686b00000000, + 0x6b25aa8400000000, 0x689e9d6f00000000, 0x56f55f8000000000, + 0x2fee836200000000, 0x1185418d00000000, 0x123e766600000000, + 0x2c55b48900000000, 0x498f115f00000000, 0x77e4d3b000000000, + 0x745fe45b00000000, 0x4a3426b400000000, 0x332ffa5600000000, + 0x0d4438b900000000, 0x0eff0f5200000000, 0x3094cdbd00000000, + 0xbdcfc64c00000000, 0x83a404a300000000, 0x801f334800000000, + 0xbe74f1a700000000, 0xc76f2d4500000000, 0xf904efaa00000000, + 0xfabfd84100000000, 0xc4d41aae00000000, 0x710de23700000000, + 0x4f6620d800000000, 0x4cdd173300000000, 0x72b6d5dc00000000, + 0x0bad093e00000000, 0x35c6cbd100000000, 0x367dfc3a00000000, + 0x08163ed500000000, 0x854d352400000000, 0xbb26f7cb00000000, + 0xb89dc02000000000, 0x86f602cf00000000, 0xffedde2d00000000, + 0xc1861cc200000000, 0xc23d2b2900000000, 0xfc56e9c600000000, + 0x998c4c1000000000, 0xa7e78eff00000000, 0xa45cb91400000000, + 0x9a377bfb00000000, 0xe32ca71900000000, 0xdd4765f600000000, + 0xdefc521d00000000, 0xe09790f200000000, 0x6dcc9b0300000000, + 0x53a759ec00000000, 0x501c6e0700000000, 0x6e77ace800000000, + 0x176c700a00000000, 0x2907b2e500000000, 0x2abc850e00000000, + 0x14d747e100000000}, + {0x0000000000000000, 0xc0df8ec100000000, 0xc1b96c5800000000, + 0x0166e29900000000, 0x8273d9b000000000, 0x42ac577100000000, + 0x43cab5e800000000, 0x83153b2900000000, 0x45e1c3ba00000000, + 0x853e4d7b00000000, 0x8458afe200000000, 0x4487212300000000, + 0xc7921a0a00000000, 0x074d94cb00000000, 0x062b765200000000, + 0xc6f4f89300000000, 0xcbc4f6ae00000000, 0x0b1b786f00000000, + 0x0a7d9af600000000, 0xcaa2143700000000, 0x49b72f1e00000000, + 0x8968a1df00000000, 0x880e434600000000, 0x48d1cd8700000000, + 0x8e25351400000000, 0x4efabbd500000000, 0x4f9c594c00000000, + 0x8f43d78d00000000, 0x0c56eca400000000, 0xcc89626500000000, + 0xcdef80fc00000000, 0x0d300e3d00000000, 0xd78f9c8600000000, + 0x1750124700000000, 0x1636f0de00000000, 0xd6e97e1f00000000, + 0x55fc453600000000, 0x9523cbf700000000, 0x9445296e00000000, + 0x549aa7af00000000, 0x926e5f3c00000000, 0x52b1d1fd00000000, + 0x53d7336400000000, 0x9308bda500000000, 0x101d868c00000000, + 0xd0c2084d00000000, 0xd1a4ead400000000, 0x117b641500000000, + 0x1c4b6a2800000000, 0xdc94e4e900000000, 0xddf2067000000000, + 0x1d2d88b100000000, 0x9e38b39800000000, 0x5ee73d5900000000, + 0x5f81dfc000000000, 0x9f5e510100000000, 0x59aaa99200000000, + 0x9975275300000000, 0x9813c5ca00000000, 0x58cc4b0b00000000, + 0xdbd9702200000000, 0x1b06fee300000000, 0x1a601c7a00000000, + 0xdabf92bb00000000, 0xef1948d600000000, 0x2fc6c61700000000, + 0x2ea0248e00000000, 0xee7faa4f00000000, 0x6d6a916600000000, + 0xadb51fa700000000, 0xacd3fd3e00000000, 0x6c0c73ff00000000, + 0xaaf88b6c00000000, 0x6a2705ad00000000, 0x6b41e73400000000, + 0xab9e69f500000000, 0x288b52dc00000000, 0xe854dc1d00000000, + 0xe9323e8400000000, 0x29edb04500000000, 0x24ddbe7800000000, + 0xe40230b900000000, 0xe564d22000000000, 0x25bb5ce100000000, + 0xa6ae67c800000000, 0x6671e90900000000, 0x67170b9000000000, + 0xa7c8855100000000, 0x613c7dc200000000, 0xa1e3f30300000000, + 0xa085119a00000000, 0x605a9f5b00000000, 0xe34fa47200000000, + 0x23902ab300000000, 0x22f6c82a00000000, 0xe22946eb00000000, + 0x3896d45000000000, 0xf8495a9100000000, 0xf92fb80800000000, + 0x39f036c900000000, 0xbae50de000000000, 0x7a3a832100000000, + 0x7b5c61b800000000, 0xbb83ef7900000000, 0x7d7717ea00000000, + 0xbda8992b00000000, 0xbcce7bb200000000, 0x7c11f57300000000, + 0xff04ce5a00000000, 0x3fdb409b00000000, 0x3ebda20200000000, + 0xfe622cc300000000, 0xf35222fe00000000, 0x338dac3f00000000, + 0x32eb4ea600000000, 0xf234c06700000000, 0x7121fb4e00000000, + 0xb1fe758f00000000, 0xb098971600000000, 0x704719d700000000, + 0xb6b3e14400000000, 0x766c6f8500000000, 0x770a8d1c00000000, + 0xb7d503dd00000000, 0x34c038f400000000, 0xf41fb63500000000, + 0xf57954ac00000000, 0x35a6da6d00000000, 0x9f35e17700000000, + 0x5fea6fb600000000, 0x5e8c8d2f00000000, 0x9e5303ee00000000, + 0x1d4638c700000000, 0xdd99b60600000000, 0xdcff549f00000000, + 0x1c20da5e00000000, 0xdad422cd00000000, 0x1a0bac0c00000000, + 0x1b6d4e9500000000, 0xdbb2c05400000000, 0x58a7fb7d00000000, + 0x987875bc00000000, 0x991e972500000000, 0x59c119e400000000, + 0x54f117d900000000, 0x942e991800000000, 0x95487b8100000000, + 0x5597f54000000000, 0xd682ce6900000000, 0x165d40a800000000, + 0x173ba23100000000, 0xd7e42cf000000000, 0x1110d46300000000, + 0xd1cf5aa200000000, 0xd0a9b83b00000000, 0x107636fa00000000, + 0x93630dd300000000, 0x53bc831200000000, 0x52da618b00000000, + 0x9205ef4a00000000, 0x48ba7df100000000, 0x8865f33000000000, + 0x890311a900000000, 0x49dc9f6800000000, 0xcac9a44100000000, + 0x0a162a8000000000, 0x0b70c81900000000, 0xcbaf46d800000000, + 0x0d5bbe4b00000000, 0xcd84308a00000000, 0xcce2d21300000000, + 0x0c3d5cd200000000, 0x8f2867fb00000000, 0x4ff7e93a00000000, + 0x4e910ba300000000, 0x8e4e856200000000, 0x837e8b5f00000000, + 0x43a1059e00000000, 0x42c7e70700000000, 0x821869c600000000, + 0x010d52ef00000000, 0xc1d2dc2e00000000, 0xc0b43eb700000000, + 0x006bb07600000000, 0xc69f48e500000000, 0x0640c62400000000, + 0x072624bd00000000, 0xc7f9aa7c00000000, 0x44ec915500000000, + 0x84331f9400000000, 0x8555fd0d00000000, 0x458a73cc00000000, + 0x702ca9a100000000, 0xb0f3276000000000, 0xb195c5f900000000, + 0x714a4b3800000000, 0xf25f701100000000, 0x3280fed000000000, + 0x33e61c4900000000, 0xf339928800000000, 0x35cd6a1b00000000, + 0xf512e4da00000000, 0xf474064300000000, 0x34ab888200000000, + 0xb7beb3ab00000000, 0x77613d6a00000000, 0x7607dff300000000, + 0xb6d8513200000000, 0xbbe85f0f00000000, 0x7b37d1ce00000000, + 0x7a51335700000000, 0xba8ebd9600000000, 0x399b86bf00000000, + 0xf944087e00000000, 0xf822eae700000000, 0x38fd642600000000, + 0xfe099cb500000000, 0x3ed6127400000000, 0x3fb0f0ed00000000, + 0xff6f7e2c00000000, 0x7c7a450500000000, 0xbca5cbc400000000, + 0xbdc3295d00000000, 0x7d1ca79c00000000, 0xa7a3352700000000, + 0x677cbbe600000000, 0x661a597f00000000, 0xa6c5d7be00000000, + 0x25d0ec9700000000, 0xe50f625600000000, 0xe46980cf00000000, + 0x24b60e0e00000000, 0xe242f69d00000000, 0x229d785c00000000, + 0x23fb9ac500000000, 0xe324140400000000, 0x60312f2d00000000, + 0xa0eea1ec00000000, 0xa188437500000000, 0x6157cdb400000000, + 0x6c67c38900000000, 0xacb84d4800000000, 0xaddeafd100000000, + 0x6d01211000000000, 0xee141a3900000000, 0x2ecb94f800000000, + 0x2fad766100000000, 0xef72f8a000000000, 0x2986003300000000, + 0xe9598ef200000000, 0xe83f6c6b00000000, 0x28e0e2aa00000000, + 0xabf5d98300000000, 0x6b2a574200000000, 0x6a4cb5db00000000, + 0xaa933b1a00000000}, + {0x0000000000000000, 0x6f4ca59b00000000, 0x9f9e3bec00000000, + 0xf0d29e7700000000, 0x7f3b060300000000, 0x1077a39800000000, + 0xe0a53def00000000, 0x8fe9987400000000, 0xfe760c0600000000, + 0x913aa99d00000000, 0x61e837ea00000000, 0x0ea4927100000000, + 0x814d0a0500000000, 0xee01af9e00000000, 0x1ed331e900000000, + 0x719f947200000000, 0xfced180c00000000, 0x93a1bd9700000000, + 0x637323e000000000, 0x0c3f867b00000000, 0x83d61e0f00000000, + 0xec9abb9400000000, 0x1c4825e300000000, 0x7304807800000000, + 0x029b140a00000000, 0x6dd7b19100000000, 0x9d052fe600000000, + 0xf2498a7d00000000, 0x7da0120900000000, 0x12ecb79200000000, + 0xe23e29e500000000, 0x8d728c7e00000000, 0xf8db311800000000, + 0x9797948300000000, 0x67450af400000000, 0x0809af6f00000000, + 0x87e0371b00000000, 0xe8ac928000000000, 0x187e0cf700000000, + 0x7732a96c00000000, 0x06ad3d1e00000000, 0x69e1988500000000, + 0x993306f200000000, 0xf67fa36900000000, 0x79963b1d00000000, + 0x16da9e8600000000, 0xe60800f100000000, 0x8944a56a00000000, + 0x0436291400000000, 0x6b7a8c8f00000000, 0x9ba812f800000000, + 0xf4e4b76300000000, 0x7b0d2f1700000000, 0x14418a8c00000000, + 0xe49314fb00000000, 0x8bdfb16000000000, 0xfa40251200000000, + 0x950c808900000000, 0x65de1efe00000000, 0x0a92bb6500000000, + 0x857b231100000000, 0xea37868a00000000, 0x1ae518fd00000000, + 0x75a9bd6600000000, 0xf0b7633000000000, 0x9ffbc6ab00000000, + 0x6f2958dc00000000, 0x0065fd4700000000, 0x8f8c653300000000, + 0xe0c0c0a800000000, 0x10125edf00000000, 0x7f5efb4400000000, + 0x0ec16f3600000000, 0x618dcaad00000000, 0x915f54da00000000, + 0xfe13f14100000000, 0x71fa693500000000, 0x1eb6ccae00000000, + 0xee6452d900000000, 0x8128f74200000000, 0x0c5a7b3c00000000, + 0x6316dea700000000, 0x93c440d000000000, 0xfc88e54b00000000, + 0x73617d3f00000000, 0x1c2dd8a400000000, 0xecff46d300000000, + 0x83b3e34800000000, 0xf22c773a00000000, 0x9d60d2a100000000, + 0x6db24cd600000000, 0x02fee94d00000000, 0x8d17713900000000, + 0xe25bd4a200000000, 0x12894ad500000000, 0x7dc5ef4e00000000, + 0x086c522800000000, 0x6720f7b300000000, 0x97f269c400000000, + 0xf8becc5f00000000, 0x7757542b00000000, 0x181bf1b000000000, + 0xe8c96fc700000000, 0x8785ca5c00000000, 0xf61a5e2e00000000, + 0x9956fbb500000000, 0x698465c200000000, 0x06c8c05900000000, + 0x8921582d00000000, 0xe66dfdb600000000, 0x16bf63c100000000, + 0x79f3c65a00000000, 0xf4814a2400000000, 0x9bcdefbf00000000, + 0x6b1f71c800000000, 0x0453d45300000000, 0x8bba4c2700000000, + 0xe4f6e9bc00000000, 0x142477cb00000000, 0x7b68d25000000000, + 0x0af7462200000000, 0x65bbe3b900000000, 0x95697dce00000000, + 0xfa25d85500000000, 0x75cc402100000000, 0x1a80e5ba00000000, + 0xea527bcd00000000, 0x851ede5600000000, 0xe06fc76000000000, + 0x8f2362fb00000000, 0x7ff1fc8c00000000, 0x10bd591700000000, + 0x9f54c16300000000, 0xf01864f800000000, 0x00cafa8f00000000, + 0x6f865f1400000000, 0x1e19cb6600000000, 0x71556efd00000000, + 0x8187f08a00000000, 0xeecb551100000000, 0x6122cd6500000000, + 0x0e6e68fe00000000, 0xfebcf68900000000, 0x91f0531200000000, + 0x1c82df6c00000000, 0x73ce7af700000000, 0x831ce48000000000, + 0xec50411b00000000, 0x63b9d96f00000000, 0x0cf57cf400000000, + 0xfc27e28300000000, 0x936b471800000000, 0xe2f4d36a00000000, + 0x8db876f100000000, 0x7d6ae88600000000, 0x12264d1d00000000, + 0x9dcfd56900000000, 0xf28370f200000000, 0x0251ee8500000000, + 0x6d1d4b1e00000000, 0x18b4f67800000000, 0x77f853e300000000, + 0x872acd9400000000, 0xe866680f00000000, 0x678ff07b00000000, + 0x08c355e000000000, 0xf811cb9700000000, 0x975d6e0c00000000, + 0xe6c2fa7e00000000, 0x898e5fe500000000, 0x795cc19200000000, + 0x1610640900000000, 0x99f9fc7d00000000, 0xf6b559e600000000, + 0x0667c79100000000, 0x692b620a00000000, 0xe459ee7400000000, + 0x8b154bef00000000, 0x7bc7d59800000000, 0x148b700300000000, + 0x9b62e87700000000, 0xf42e4dec00000000, 0x04fcd39b00000000, + 0x6bb0760000000000, 0x1a2fe27200000000, 0x756347e900000000, + 0x85b1d99e00000000, 0xeafd7c0500000000, 0x6514e47100000000, + 0x0a5841ea00000000, 0xfa8adf9d00000000, 0x95c67a0600000000, + 0x10d8a45000000000, 0x7f9401cb00000000, 0x8f469fbc00000000, + 0xe00a3a2700000000, 0x6fe3a25300000000, 0x00af07c800000000, + 0xf07d99bf00000000, 0x9f313c2400000000, 0xeeaea85600000000, + 0x81e20dcd00000000, 0x713093ba00000000, 0x1e7c362100000000, + 0x9195ae5500000000, 0xfed90bce00000000, 0x0e0b95b900000000, + 0x6147302200000000, 0xec35bc5c00000000, 0x837919c700000000, + 0x73ab87b000000000, 0x1ce7222b00000000, 0x930eba5f00000000, + 0xfc421fc400000000, 0x0c9081b300000000, 0x63dc242800000000, + 0x1243b05a00000000, 0x7d0f15c100000000, 0x8ddd8bb600000000, + 0xe2912e2d00000000, 0x6d78b65900000000, 0x023413c200000000, + 0xf2e68db500000000, 0x9daa282e00000000, 0xe803954800000000, + 0x874f30d300000000, 0x779daea400000000, 0x18d10b3f00000000, + 0x9738934b00000000, 0xf87436d000000000, 0x08a6a8a700000000, + 0x67ea0d3c00000000, 0x1675994e00000000, 0x79393cd500000000, + 0x89eba2a200000000, 0xe6a7073900000000, 0x694e9f4d00000000, + 0x06023ad600000000, 0xf6d0a4a100000000, 0x999c013a00000000, + 0x14ee8d4400000000, 0x7ba228df00000000, 0x8b70b6a800000000, + 0xe43c133300000000, 0x6bd58b4700000000, 0x04992edc00000000, + 0xf44bb0ab00000000, 0x9b07153000000000, 0xea98814200000000, + 0x85d424d900000000, 0x7506baae00000000, 0x1a4a1f3500000000, + 0x95a3874100000000, 0xfaef22da00000000, 0x0a3dbcad00000000, + 0x6571193600000000}, + {0x0000000000000000, 0x85d996dd00000000, 0x4bb55c6000000000, + 0xce6ccabd00000000, 0x966ab9c000000000, 0x13b32f1d00000000, + 0xdddfe5a000000000, 0x5806737d00000000, 0x6dd3035a00000000, + 0xe80a958700000000, 0x26665f3a00000000, 0xa3bfc9e700000000, + 0xfbb9ba9a00000000, 0x7e602c4700000000, 0xb00ce6fa00000000, + 0x35d5702700000000, 0xdaa607b400000000, 0x5f7f916900000000, + 0x91135bd400000000, 0x14cacd0900000000, 0x4cccbe7400000000, + 0xc91528a900000000, 0x0779e21400000000, 0x82a074c900000000, + 0xb77504ee00000000, 0x32ac923300000000, 0xfcc0588e00000000, + 0x7919ce5300000000, 0x211fbd2e00000000, 0xa4c62bf300000000, + 0x6aaae14e00000000, 0xef73779300000000, 0xf54b7eb300000000, + 0x7092e86e00000000, 0xbefe22d300000000, 0x3b27b40e00000000, + 0x6321c77300000000, 0xe6f851ae00000000, 0x28949b1300000000, + 0xad4d0dce00000000, 0x98987de900000000, 0x1d41eb3400000000, + 0xd32d218900000000, 0x56f4b75400000000, 0x0ef2c42900000000, + 0x8b2b52f400000000, 0x4547984900000000, 0xc09e0e9400000000, + 0x2fed790700000000, 0xaa34efda00000000, 0x6458256700000000, + 0xe181b3ba00000000, 0xb987c0c700000000, 0x3c5e561a00000000, + 0xf2329ca700000000, 0x77eb0a7a00000000, 0x423e7a5d00000000, + 0xc7e7ec8000000000, 0x098b263d00000000, 0x8c52b0e000000000, + 0xd454c39d00000000, 0x518d554000000000, 0x9fe19ffd00000000, + 0x1a38092000000000, 0xab918dbd00000000, 0x2e481b6000000000, + 0xe024d1dd00000000, 0x65fd470000000000, 0x3dfb347d00000000, + 0xb822a2a000000000, 0x764e681d00000000, 0xf397fec000000000, + 0xc6428ee700000000, 0x439b183a00000000, 0x8df7d28700000000, + 0x082e445a00000000, 0x5028372700000000, 0xd5f1a1fa00000000, + 0x1b9d6b4700000000, 0x9e44fd9a00000000, 0x71378a0900000000, + 0xf4ee1cd400000000, 0x3a82d66900000000, 0xbf5b40b400000000, + 0xe75d33c900000000, 0x6284a51400000000, 0xace86fa900000000, + 0x2931f97400000000, 0x1ce4895300000000, 0x993d1f8e00000000, + 0x5751d53300000000, 0xd28843ee00000000, 0x8a8e309300000000, + 0x0f57a64e00000000, 0xc13b6cf300000000, 0x44e2fa2e00000000, + 0x5edaf30e00000000, 0xdb0365d300000000, 0x156faf6e00000000, + 0x90b639b300000000, 0xc8b04ace00000000, 0x4d69dc1300000000, + 0x830516ae00000000, 0x06dc807300000000, 0x3309f05400000000, + 0xb6d0668900000000, 0x78bcac3400000000, 0xfd653ae900000000, + 0xa563499400000000, 0x20badf4900000000, 0xeed615f400000000, + 0x6b0f832900000000, 0x847cf4ba00000000, 0x01a5626700000000, + 0xcfc9a8da00000000, 0x4a103e0700000000, 0x12164d7a00000000, + 0x97cfdba700000000, 0x59a3111a00000000, 0xdc7a87c700000000, + 0xe9aff7e000000000, 0x6c76613d00000000, 0xa21aab8000000000, + 0x27c33d5d00000000, 0x7fc54e2000000000, 0xfa1cd8fd00000000, + 0x3470124000000000, 0xb1a9849d00000000, 0x17256aa000000000, + 0x92fcfc7d00000000, 0x5c9036c000000000, 0xd949a01d00000000, + 0x814fd36000000000, 0x049645bd00000000, 0xcafa8f0000000000, + 0x4f2319dd00000000, 0x7af669fa00000000, 0xff2fff2700000000, + 0x3143359a00000000, 0xb49aa34700000000, 0xec9cd03a00000000, + 0x694546e700000000, 0xa7298c5a00000000, 0x22f01a8700000000, + 0xcd836d1400000000, 0x485afbc900000000, 0x8636317400000000, + 0x03efa7a900000000, 0x5be9d4d400000000, 0xde30420900000000, + 0x105c88b400000000, 0x95851e6900000000, 0xa0506e4e00000000, + 0x2589f89300000000, 0xebe5322e00000000, 0x6e3ca4f300000000, + 0x363ad78e00000000, 0xb3e3415300000000, 0x7d8f8bee00000000, + 0xf8561d3300000000, 0xe26e141300000000, 0x67b782ce00000000, + 0xa9db487300000000, 0x2c02deae00000000, 0x7404add300000000, + 0xf1dd3b0e00000000, 0x3fb1f1b300000000, 0xba68676e00000000, + 0x8fbd174900000000, 0x0a64819400000000, 0xc4084b2900000000, + 0x41d1ddf400000000, 0x19d7ae8900000000, 0x9c0e385400000000, + 0x5262f2e900000000, 0xd7bb643400000000, 0x38c813a700000000, + 0xbd11857a00000000, 0x737d4fc700000000, 0xf6a4d91a00000000, + 0xaea2aa6700000000, 0x2b7b3cba00000000, 0xe517f60700000000, + 0x60ce60da00000000, 0x551b10fd00000000, 0xd0c2862000000000, + 0x1eae4c9d00000000, 0x9b77da4000000000, 0xc371a93d00000000, + 0x46a83fe000000000, 0x88c4f55d00000000, 0x0d1d638000000000, + 0xbcb4e71d00000000, 0x396d71c000000000, 0xf701bb7d00000000, + 0x72d82da000000000, 0x2ade5edd00000000, 0xaf07c80000000000, + 0x616b02bd00000000, 0xe4b2946000000000, 0xd167e44700000000, + 0x54be729a00000000, 0x9ad2b82700000000, 0x1f0b2efa00000000, + 0x470d5d8700000000, 0xc2d4cb5a00000000, 0x0cb801e700000000, + 0x8961973a00000000, 0x6612e0a900000000, 0xe3cb767400000000, + 0x2da7bcc900000000, 0xa87e2a1400000000, 0xf078596900000000, + 0x75a1cfb400000000, 0xbbcd050900000000, 0x3e1493d400000000, + 0x0bc1e3f300000000, 0x8e18752e00000000, 0x4074bf9300000000, + 0xc5ad294e00000000, 0x9dab5a3300000000, 0x1872ccee00000000, + 0xd61e065300000000, 0x53c7908e00000000, 0x49ff99ae00000000, + 0xcc260f7300000000, 0x024ac5ce00000000, 0x8793531300000000, + 0xdf95206e00000000, 0x5a4cb6b300000000, 0x94207c0e00000000, + 0x11f9ead300000000, 0x242c9af400000000, 0xa1f50c2900000000, + 0x6f99c69400000000, 0xea40504900000000, 0xb246233400000000, + 0x379fb5e900000000, 0xf9f37f5400000000, 0x7c2ae98900000000, + 0x93599e1a00000000, 0x168008c700000000, 0xd8ecc27a00000000, + 0x5d3554a700000000, 0x053327da00000000, 0x80eab10700000000, + 0x4e867bba00000000, 0xcb5fed6700000000, 0xfe8a9d4000000000, + 0x7b530b9d00000000, 0xb53fc12000000000, 0x30e657fd00000000, + 0x68e0248000000000, 0xed39b25d00000000, 0x235578e000000000, + 0xa68cee3d00000000}, + {0x0000000000000000, 0x76e10f9d00000000, 0xadc46ee100000000, + 0xdb25617c00000000, 0x1b8fac1900000000, 0x6d6ea38400000000, + 0xb64bc2f800000000, 0xc0aacd6500000000, 0x361e593300000000, + 0x40ff56ae00000000, 0x9bda37d200000000, 0xed3b384f00000000, + 0x2d91f52a00000000, 0x5b70fab700000000, 0x80559bcb00000000, + 0xf6b4945600000000, 0x6c3cb26600000000, 0x1addbdfb00000000, + 0xc1f8dc8700000000, 0xb719d31a00000000, 0x77b31e7f00000000, + 0x015211e200000000, 0xda77709e00000000, 0xac967f0300000000, + 0x5a22eb5500000000, 0x2cc3e4c800000000, 0xf7e685b400000000, + 0x81078a2900000000, 0x41ad474c00000000, 0x374c48d100000000, + 0xec6929ad00000000, 0x9a88263000000000, 0xd87864cd00000000, + 0xae996b5000000000, 0x75bc0a2c00000000, 0x035d05b100000000, + 0xc3f7c8d400000000, 0xb516c74900000000, 0x6e33a63500000000, + 0x18d2a9a800000000, 0xee663dfe00000000, 0x9887326300000000, + 0x43a2531f00000000, 0x35435c8200000000, 0xf5e991e700000000, + 0x83089e7a00000000, 0x582dff0600000000, 0x2eccf09b00000000, + 0xb444d6ab00000000, 0xc2a5d93600000000, 0x1980b84a00000000, + 0x6f61b7d700000000, 0xafcb7ab200000000, 0xd92a752f00000000, + 0x020f145300000000, 0x74ee1bce00000000, 0x825a8f9800000000, + 0xf4bb800500000000, 0x2f9ee17900000000, 0x597feee400000000, + 0x99d5238100000000, 0xef342c1c00000000, 0x34114d6000000000, + 0x42f042fd00000000, 0xf1f7b94100000000, 0x8716b6dc00000000, + 0x5c33d7a000000000, 0x2ad2d83d00000000, 0xea78155800000000, + 0x9c991ac500000000, 0x47bc7bb900000000, 0x315d742400000000, + 0xc7e9e07200000000, 0xb108efef00000000, 0x6a2d8e9300000000, + 0x1ccc810e00000000, 0xdc664c6b00000000, 0xaa8743f600000000, + 0x71a2228a00000000, 0x07432d1700000000, 0x9dcb0b2700000000, + 0xeb2a04ba00000000, 0x300f65c600000000, 0x46ee6a5b00000000, + 0x8644a73e00000000, 0xf0a5a8a300000000, 0x2b80c9df00000000, + 0x5d61c64200000000, 0xabd5521400000000, 0xdd345d8900000000, + 0x06113cf500000000, 0x70f0336800000000, 0xb05afe0d00000000, + 0xc6bbf19000000000, 0x1d9e90ec00000000, 0x6b7f9f7100000000, + 0x298fdd8c00000000, 0x5f6ed21100000000, 0x844bb36d00000000, + 0xf2aabcf000000000, 0x3200719500000000, 0x44e17e0800000000, + 0x9fc41f7400000000, 0xe92510e900000000, 0x1f9184bf00000000, + 0x69708b2200000000, 0xb255ea5e00000000, 0xc4b4e5c300000000, + 0x041e28a600000000, 0x72ff273b00000000, 0xa9da464700000000, + 0xdf3b49da00000000, 0x45b36fea00000000, 0x3352607700000000, + 0xe877010b00000000, 0x9e960e9600000000, 0x5e3cc3f300000000, + 0x28ddcc6e00000000, 0xf3f8ad1200000000, 0x8519a28f00000000, + 0x73ad36d900000000, 0x054c394400000000, 0xde69583800000000, + 0xa88857a500000000, 0x68229ac000000000, 0x1ec3955d00000000, + 0xc5e6f42100000000, 0xb307fbbc00000000, 0xe2ef738300000000, + 0x940e7c1e00000000, 0x4f2b1d6200000000, 0x39ca12ff00000000, + 0xf960df9a00000000, 0x8f81d00700000000, 0x54a4b17b00000000, + 0x2245bee600000000, 0xd4f12ab000000000, 0xa210252d00000000, + 0x7935445100000000, 0x0fd44bcc00000000, 0xcf7e86a900000000, + 0xb99f893400000000, 0x62bae84800000000, 0x145be7d500000000, + 0x8ed3c1e500000000, 0xf832ce7800000000, 0x2317af0400000000, + 0x55f6a09900000000, 0x955c6dfc00000000, 0xe3bd626100000000, + 0x3898031d00000000, 0x4e790c8000000000, 0xb8cd98d600000000, + 0xce2c974b00000000, 0x1509f63700000000, 0x63e8f9aa00000000, + 0xa34234cf00000000, 0xd5a33b5200000000, 0x0e865a2e00000000, + 0x786755b300000000, 0x3a97174e00000000, 0x4c7618d300000000, + 0x975379af00000000, 0xe1b2763200000000, 0x2118bb5700000000, + 0x57f9b4ca00000000, 0x8cdcd5b600000000, 0xfa3dda2b00000000, + 0x0c894e7d00000000, 0x7a6841e000000000, 0xa14d209c00000000, + 0xd7ac2f0100000000, 0x1706e26400000000, 0x61e7edf900000000, + 0xbac28c8500000000, 0xcc23831800000000, 0x56aba52800000000, + 0x204aaab500000000, 0xfb6fcbc900000000, 0x8d8ec45400000000, + 0x4d24093100000000, 0x3bc506ac00000000, 0xe0e067d000000000, + 0x9601684d00000000, 0x60b5fc1b00000000, 0x1654f38600000000, + 0xcd7192fa00000000, 0xbb909d6700000000, 0x7b3a500200000000, + 0x0ddb5f9f00000000, 0xd6fe3ee300000000, 0xa01f317e00000000, + 0x1318cac200000000, 0x65f9c55f00000000, 0xbedca42300000000, + 0xc83dabbe00000000, 0x089766db00000000, 0x7e76694600000000, + 0xa553083a00000000, 0xd3b207a700000000, 0x250693f100000000, + 0x53e79c6c00000000, 0x88c2fd1000000000, 0xfe23f28d00000000, + 0x3e893fe800000000, 0x4868307500000000, 0x934d510900000000, + 0xe5ac5e9400000000, 0x7f2478a400000000, 0x09c5773900000000, + 0xd2e0164500000000, 0xa40119d800000000, 0x64abd4bd00000000, + 0x124adb2000000000, 0xc96fba5c00000000, 0xbf8eb5c100000000, + 0x493a219700000000, 0x3fdb2e0a00000000, 0xe4fe4f7600000000, + 0x921f40eb00000000, 0x52b58d8e00000000, 0x2454821300000000, + 0xff71e36f00000000, 0x8990ecf200000000, 0xcb60ae0f00000000, + 0xbd81a19200000000, 0x66a4c0ee00000000, 0x1045cf7300000000, + 0xd0ef021600000000, 0xa60e0d8b00000000, 0x7d2b6cf700000000, + 0x0bca636a00000000, 0xfd7ef73c00000000, 0x8b9ff8a100000000, + 0x50ba99dd00000000, 0x265b964000000000, 0xe6f15b2500000000, + 0x901054b800000000, 0x4b3535c400000000, 0x3dd43a5900000000, + 0xa75c1c6900000000, 0xd1bd13f400000000, 0x0a98728800000000, + 0x7c797d1500000000, 0xbcd3b07000000000, 0xca32bfed00000000, + 0x1117de9100000000, 0x67f6d10c00000000, 0x9142455a00000000, + 0xe7a34ac700000000, 0x3c862bbb00000000, 0x4a67242600000000, + 0x8acde94300000000, 0xfc2ce6de00000000, 0x270987a200000000, + 0x51e8883f00000000}, + {0x0000000000000000, 0xe8dbfbb900000000, 0x91b186a800000000, + 0x796a7d1100000000, 0x63657c8a00000000, 0x8bbe873300000000, + 0xf2d4fa2200000000, 0x1a0f019b00000000, 0x87cc89cf00000000, + 0x6f17727600000000, 0x167d0f6700000000, 0xfea6f4de00000000, + 0xe4a9f54500000000, 0x0c720efc00000000, 0x751873ed00000000, + 0x9dc3885400000000, 0x4f9f624400000000, 0xa74499fd00000000, + 0xde2ee4ec00000000, 0x36f51f5500000000, 0x2cfa1ece00000000, + 0xc421e57700000000, 0xbd4b986600000000, 0x559063df00000000, + 0xc853eb8b00000000, 0x2088103200000000, 0x59e26d2300000000, + 0xb139969a00000000, 0xab36970100000000, 0x43ed6cb800000000, + 0x3a8711a900000000, 0xd25cea1000000000, 0x9e3ec58800000000, + 0x76e53e3100000000, 0x0f8f432000000000, 0xe754b89900000000, + 0xfd5bb90200000000, 0x158042bb00000000, 0x6cea3faa00000000, + 0x8431c41300000000, 0x19f24c4700000000, 0xf129b7fe00000000, + 0x8843caef00000000, 0x6098315600000000, 0x7a9730cd00000000, + 0x924ccb7400000000, 0xeb26b66500000000, 0x03fd4ddc00000000, + 0xd1a1a7cc00000000, 0x397a5c7500000000, 0x4010216400000000, + 0xa8cbdadd00000000, 0xb2c4db4600000000, 0x5a1f20ff00000000, + 0x23755dee00000000, 0xcbaea65700000000, 0x566d2e0300000000, + 0xbeb6d5ba00000000, 0xc7dca8ab00000000, 0x2f07531200000000, + 0x3508528900000000, 0xddd3a93000000000, 0xa4b9d42100000000, + 0x4c622f9800000000, 0x7d7bfbca00000000, 0x95a0007300000000, + 0xecca7d6200000000, 0x041186db00000000, 0x1e1e874000000000, + 0xf6c57cf900000000, 0x8faf01e800000000, 0x6774fa5100000000, + 0xfab7720500000000, 0x126c89bc00000000, 0x6b06f4ad00000000, + 0x83dd0f1400000000, 0x99d20e8f00000000, 0x7109f53600000000, + 0x0863882700000000, 0xe0b8739e00000000, 0x32e4998e00000000, + 0xda3f623700000000, 0xa3551f2600000000, 0x4b8ee49f00000000, + 0x5181e50400000000, 0xb95a1ebd00000000, 0xc03063ac00000000, + 0x28eb981500000000, 0xb528104100000000, 0x5df3ebf800000000, + 0x249996e900000000, 0xcc426d5000000000, 0xd64d6ccb00000000, + 0x3e96977200000000, 0x47fcea6300000000, 0xaf2711da00000000, + 0xe3453e4200000000, 0x0b9ec5fb00000000, 0x72f4b8ea00000000, + 0x9a2f435300000000, 0x802042c800000000, 0x68fbb97100000000, + 0x1191c46000000000, 0xf94a3fd900000000, 0x6489b78d00000000, + 0x8c524c3400000000, 0xf538312500000000, 0x1de3ca9c00000000, + 0x07eccb0700000000, 0xef3730be00000000, 0x965d4daf00000000, + 0x7e86b61600000000, 0xacda5c0600000000, 0x4401a7bf00000000, + 0x3d6bdaae00000000, 0xd5b0211700000000, 0xcfbf208c00000000, + 0x2764db3500000000, 0x5e0ea62400000000, 0xb6d55d9d00000000, + 0x2b16d5c900000000, 0xc3cd2e7000000000, 0xbaa7536100000000, + 0x527ca8d800000000, 0x4873a94300000000, 0xa0a852fa00000000, + 0xd9c22feb00000000, 0x3119d45200000000, 0xbbf0874e00000000, + 0x532b7cf700000000, 0x2a4101e600000000, 0xc29afa5f00000000, + 0xd895fbc400000000, 0x304e007d00000000, 0x49247d6c00000000, + 0xa1ff86d500000000, 0x3c3c0e8100000000, 0xd4e7f53800000000, + 0xad8d882900000000, 0x4556739000000000, 0x5f59720b00000000, + 0xb78289b200000000, 0xcee8f4a300000000, 0x26330f1a00000000, + 0xf46fe50a00000000, 0x1cb41eb300000000, 0x65de63a200000000, + 0x8d05981b00000000, 0x970a998000000000, 0x7fd1623900000000, + 0x06bb1f2800000000, 0xee60e49100000000, 0x73a36cc500000000, + 0x9b78977c00000000, 0xe212ea6d00000000, 0x0ac911d400000000, + 0x10c6104f00000000, 0xf81debf600000000, 0x817796e700000000, + 0x69ac6d5e00000000, 0x25ce42c600000000, 0xcd15b97f00000000, + 0xb47fc46e00000000, 0x5ca43fd700000000, 0x46ab3e4c00000000, + 0xae70c5f500000000, 0xd71ab8e400000000, 0x3fc1435d00000000, + 0xa202cb0900000000, 0x4ad930b000000000, 0x33b34da100000000, + 0xdb68b61800000000, 0xc167b78300000000, 0x29bc4c3a00000000, + 0x50d6312b00000000, 0xb80dca9200000000, 0x6a51208200000000, + 0x828adb3b00000000, 0xfbe0a62a00000000, 0x133b5d9300000000, + 0x09345c0800000000, 0xe1efa7b100000000, 0x9885daa000000000, + 0x705e211900000000, 0xed9da94d00000000, 0x054652f400000000, + 0x7c2c2fe500000000, 0x94f7d45c00000000, 0x8ef8d5c700000000, + 0x66232e7e00000000, 0x1f49536f00000000, 0xf792a8d600000000, + 0xc68b7c8400000000, 0x2e50873d00000000, 0x573afa2c00000000, + 0xbfe1019500000000, 0xa5ee000e00000000, 0x4d35fbb700000000, + 0x345f86a600000000, 0xdc847d1f00000000, 0x4147f54b00000000, + 0xa99c0ef200000000, 0xd0f673e300000000, 0x382d885a00000000, + 0x222289c100000000, 0xcaf9727800000000, 0xb3930f6900000000, + 0x5b48f4d000000000, 0x89141ec000000000, 0x61cfe57900000000, + 0x18a5986800000000, 0xf07e63d100000000, 0xea71624a00000000, + 0x02aa99f300000000, 0x7bc0e4e200000000, 0x931b1f5b00000000, + 0x0ed8970f00000000, 0xe6036cb600000000, 0x9f6911a700000000, + 0x77b2ea1e00000000, 0x6dbdeb8500000000, 0x8566103c00000000, + 0xfc0c6d2d00000000, 0x14d7969400000000, 0x58b5b90c00000000, + 0xb06e42b500000000, 0xc9043fa400000000, 0x21dfc41d00000000, + 0x3bd0c58600000000, 0xd30b3e3f00000000, 0xaa61432e00000000, + 0x42bab89700000000, 0xdf7930c300000000, 0x37a2cb7a00000000, + 0x4ec8b66b00000000, 0xa6134dd200000000, 0xbc1c4c4900000000, + 0x54c7b7f000000000, 0x2dadcae100000000, 0xc576315800000000, + 0x172adb4800000000, 0xfff120f100000000, 0x869b5de000000000, + 0x6e40a65900000000, 0x744fa7c200000000, 0x9c945c7b00000000, + 0xe5fe216a00000000, 0x0d25dad300000000, 0x90e6528700000000, + 0x783da93e00000000, 0x0157d42f00000000, 0xe98c2f9600000000, + 0xf3832e0d00000000, 0x1b58d5b400000000, 0x6232a8a500000000, + 0x8ae9531c00000000}, + {0x0000000000000000, 0x919168ae00000000, 0x6325a08700000000, + 0xf2b4c82900000000, 0x874c31d400000000, 0x16dd597a00000000, + 0xe469915300000000, 0x75f8f9fd00000000, 0x4f9f137300000000, + 0xde0e7bdd00000000, 0x2cbab3f400000000, 0xbd2bdb5a00000000, + 0xc8d322a700000000, 0x59424a0900000000, 0xabf6822000000000, + 0x3a67ea8e00000000, 0x9e3e27e600000000, 0x0faf4f4800000000, + 0xfd1b876100000000, 0x6c8aefcf00000000, 0x1972163200000000, + 0x88e37e9c00000000, 0x7a57b6b500000000, 0xebc6de1b00000000, + 0xd1a1349500000000, 0x40305c3b00000000, 0xb284941200000000, + 0x2315fcbc00000000, 0x56ed054100000000, 0xc77c6def00000000, + 0x35c8a5c600000000, 0xa459cd6800000000, 0x7d7b3f1700000000, + 0xecea57b900000000, 0x1e5e9f9000000000, 0x8fcff73e00000000, + 0xfa370ec300000000, 0x6ba6666d00000000, 0x9912ae4400000000, + 0x0883c6ea00000000, 0x32e42c6400000000, 0xa37544ca00000000, + 0x51c18ce300000000, 0xc050e44d00000000, 0xb5a81db000000000, + 0x2439751e00000000, 0xd68dbd3700000000, 0x471cd59900000000, + 0xe34518f100000000, 0x72d4705f00000000, 0x8060b87600000000, + 0x11f1d0d800000000, 0x6409292500000000, 0xf598418b00000000, + 0x072c89a200000000, 0x96bde10c00000000, 0xacda0b8200000000, + 0x3d4b632c00000000, 0xcfffab0500000000, 0x5e6ec3ab00000000, + 0x2b963a5600000000, 0xba0752f800000000, 0x48b39ad100000000, + 0xd922f27f00000000, 0xfaf67e2e00000000, 0x6b67168000000000, + 0x99d3dea900000000, 0x0842b60700000000, 0x7dba4ffa00000000, + 0xec2b275400000000, 0x1e9fef7d00000000, 0x8f0e87d300000000, + 0xb5696d5d00000000, 0x24f805f300000000, 0xd64ccdda00000000, + 0x47dda57400000000, 0x32255c8900000000, 0xa3b4342700000000, + 0x5100fc0e00000000, 0xc09194a000000000, 0x64c859c800000000, + 0xf559316600000000, 0x07edf94f00000000, 0x967c91e100000000, + 0xe384681c00000000, 0x721500b200000000, 0x80a1c89b00000000, + 0x1130a03500000000, 0x2b574abb00000000, 0xbac6221500000000, + 0x4872ea3c00000000, 0xd9e3829200000000, 0xac1b7b6f00000000, + 0x3d8a13c100000000, 0xcf3edbe800000000, 0x5eafb34600000000, + 0x878d413900000000, 0x161c299700000000, 0xe4a8e1be00000000, + 0x7539891000000000, 0x00c170ed00000000, 0x9150184300000000, + 0x63e4d06a00000000, 0xf275b8c400000000, 0xc812524a00000000, + 0x59833ae400000000, 0xab37f2cd00000000, 0x3aa69a6300000000, + 0x4f5e639e00000000, 0xdecf0b3000000000, 0x2c7bc31900000000, + 0xbdeaabb700000000, 0x19b366df00000000, 0x88220e7100000000, + 0x7a96c65800000000, 0xeb07aef600000000, 0x9eff570b00000000, + 0x0f6e3fa500000000, 0xfddaf78c00000000, 0x6c4b9f2200000000, + 0x562c75ac00000000, 0xc7bd1d0200000000, 0x3509d52b00000000, + 0xa498bd8500000000, 0xd160447800000000, 0x40f12cd600000000, + 0xb245e4ff00000000, 0x23d48c5100000000, 0xf4edfd5c00000000, + 0x657c95f200000000, 0x97c85ddb00000000, 0x0659357500000000, + 0x73a1cc8800000000, 0xe230a42600000000, 0x10846c0f00000000, + 0x811504a100000000, 0xbb72ee2f00000000, 0x2ae3868100000000, + 0xd8574ea800000000, 0x49c6260600000000, 0x3c3edffb00000000, + 0xadafb75500000000, 0x5f1b7f7c00000000, 0xce8a17d200000000, + 0x6ad3daba00000000, 0xfb42b21400000000, 0x09f67a3d00000000, + 0x9867129300000000, 0xed9feb6e00000000, 0x7c0e83c000000000, + 0x8eba4be900000000, 0x1f2b234700000000, 0x254cc9c900000000, + 0xb4dda16700000000, 0x4669694e00000000, 0xd7f801e000000000, + 0xa200f81d00000000, 0x339190b300000000, 0xc125589a00000000, + 0x50b4303400000000, 0x8996c24b00000000, 0x1807aae500000000, + 0xeab362cc00000000, 0x7b220a6200000000, 0x0edaf39f00000000, + 0x9f4b9b3100000000, 0x6dff531800000000, 0xfc6e3bb600000000, + 0xc609d13800000000, 0x5798b99600000000, 0xa52c71bf00000000, + 0x34bd191100000000, 0x4145e0ec00000000, 0xd0d4884200000000, + 0x2260406b00000000, 0xb3f128c500000000, 0x17a8e5ad00000000, + 0x86398d0300000000, 0x748d452a00000000, 0xe51c2d8400000000, + 0x90e4d47900000000, 0x0175bcd700000000, 0xf3c174fe00000000, + 0x62501c5000000000, 0x5837f6de00000000, 0xc9a69e7000000000, + 0x3b12565900000000, 0xaa833ef700000000, 0xdf7bc70a00000000, + 0x4eeaafa400000000, 0xbc5e678d00000000, 0x2dcf0f2300000000, + 0x0e1b837200000000, 0x9f8aebdc00000000, 0x6d3e23f500000000, + 0xfcaf4b5b00000000, 0x8957b2a600000000, 0x18c6da0800000000, + 0xea72122100000000, 0x7be37a8f00000000, 0x4184900100000000, + 0xd015f8af00000000, 0x22a1308600000000, 0xb330582800000000, + 0xc6c8a1d500000000, 0x5759c97b00000000, 0xa5ed015200000000, + 0x347c69fc00000000, 0x9025a49400000000, 0x01b4cc3a00000000, + 0xf300041300000000, 0x62916cbd00000000, 0x1769954000000000, + 0x86f8fdee00000000, 0x744c35c700000000, 0xe5dd5d6900000000, + 0xdfbab7e700000000, 0x4e2bdf4900000000, 0xbc9f176000000000, + 0x2d0e7fce00000000, 0x58f6863300000000, 0xc967ee9d00000000, + 0x3bd326b400000000, 0xaa424e1a00000000, 0x7360bc6500000000, + 0xe2f1d4cb00000000, 0x10451ce200000000, 0x81d4744c00000000, + 0xf42c8db100000000, 0x65bde51f00000000, 0x97092d3600000000, + 0x0698459800000000, 0x3cffaf1600000000, 0xad6ec7b800000000, + 0x5fda0f9100000000, 0xce4b673f00000000, 0xbbb39ec200000000, + 0x2a22f66c00000000, 0xd8963e4500000000, 0x490756eb00000000, + 0xed5e9b8300000000, 0x7ccff32d00000000, 0x8e7b3b0400000000, + 0x1fea53aa00000000, 0x6a12aa5700000000, 0xfb83c2f900000000, + 0x09370ad000000000, 0x98a6627e00000000, 0xa2c188f000000000, + 0x3350e05e00000000, 0xc1e4287700000000, 0x507540d900000000, + 0x258db92400000000, 0xb41cd18a00000000, 0x46a819a300000000, + 0xd739710d00000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xccaa009e, 0x4225077d, 0x8e8f07e3, 0x844a0efa, + 0x48e00e64, 0xc66f0987, 0x0ac50919, 0xd3e51bb5, 0x1f4f1b2b, + 0x91c01cc8, 0x5d6a1c56, 0x57af154f, 0x9b0515d1, 0x158a1232, + 0xd92012ac, 0x7cbb312b, 0xb01131b5, 0x3e9e3656, 0xf23436c8, + 0xf8f13fd1, 0x345b3f4f, 0xbad438ac, 0x767e3832, 0xaf5e2a9e, + 0x63f42a00, 0xed7b2de3, 0x21d12d7d, 0x2b142464, 0xe7be24fa, + 0x69312319, 0xa59b2387, 0xf9766256, 0x35dc62c8, 0xbb53652b, + 0x77f965b5, 0x7d3c6cac, 0xb1966c32, 0x3f196bd1, 0xf3b36b4f, + 0x2a9379e3, 0xe639797d, 0x68b67e9e, 0xa41c7e00, 0xaed97719, + 0x62737787, 0xecfc7064, 0x205670fa, 0x85cd537d, 0x496753e3, + 0xc7e85400, 0x0b42549e, 0x01875d87, 0xcd2d5d19, 0x43a25afa, + 0x8f085a64, 0x562848c8, 0x9a824856, 0x140d4fb5, 0xd8a74f2b, + 0xd2624632, 0x1ec846ac, 0x9047414f, 0x5ced41d1, 0x299dc2ed, + 0xe537c273, 0x6bb8c590, 0xa712c50e, 0xadd7cc17, 0x617dcc89, + 0xeff2cb6a, 0x2358cbf4, 0xfa78d958, 0x36d2d9c6, 0xb85dde25, + 0x74f7debb, 0x7e32d7a2, 0xb298d73c, 0x3c17d0df, 0xf0bdd041, + 0x5526f3c6, 0x998cf358, 0x1703f4bb, 0xdba9f425, 0xd16cfd3c, + 0x1dc6fda2, 0x9349fa41, 0x5fe3fadf, 0x86c3e873, 0x4a69e8ed, + 0xc4e6ef0e, 0x084cef90, 0x0289e689, 0xce23e617, 0x40ace1f4, + 0x8c06e16a, 0xd0eba0bb, 0x1c41a025, 0x92cea7c6, 0x5e64a758, + 0x54a1ae41, 0x980baedf, 0x1684a93c, 0xda2ea9a2, 0x030ebb0e, + 0xcfa4bb90, 0x412bbc73, 0x8d81bced, 0x8744b5f4, 0x4beeb56a, + 0xc561b289, 0x09cbb217, 0xac509190, 0x60fa910e, 0xee7596ed, + 0x22df9673, 0x281a9f6a, 0xe4b09ff4, 0x6a3f9817, 0xa6959889, + 0x7fb58a25, 0xb31f8abb, 0x3d908d58, 0xf13a8dc6, 0xfbff84df, + 0x37558441, 0xb9da83a2, 0x7570833c, 0x533b85da, 0x9f918544, + 0x111e82a7, 0xddb48239, 0xd7718b20, 0x1bdb8bbe, 0x95548c5d, + 0x59fe8cc3, 0x80de9e6f, 0x4c749ef1, 0xc2fb9912, 0x0e51998c, + 0x04949095, 0xc83e900b, 0x46b197e8, 0x8a1b9776, 0x2f80b4f1, + 0xe32ab46f, 0x6da5b38c, 0xa10fb312, 0xabcaba0b, 0x6760ba95, + 0xe9efbd76, 0x2545bde8, 0xfc65af44, 0x30cfafda, 0xbe40a839, + 0x72eaa8a7, 0x782fa1be, 0xb485a120, 0x3a0aa6c3, 0xf6a0a65d, + 0xaa4de78c, 0x66e7e712, 0xe868e0f1, 0x24c2e06f, 0x2e07e976, + 0xe2ade9e8, 0x6c22ee0b, 0xa088ee95, 0x79a8fc39, 0xb502fca7, + 0x3b8dfb44, 0xf727fbda, 0xfde2f2c3, 0x3148f25d, 0xbfc7f5be, + 0x736df520, 0xd6f6d6a7, 0x1a5cd639, 0x94d3d1da, 0x5879d144, + 0x52bcd85d, 0x9e16d8c3, 0x1099df20, 0xdc33dfbe, 0x0513cd12, + 0xc9b9cd8c, 0x4736ca6f, 0x8b9ccaf1, 0x8159c3e8, 0x4df3c376, + 0xc37cc495, 0x0fd6c40b, 0x7aa64737, 0xb60c47a9, 0x3883404a, + 0xf42940d4, 0xfeec49cd, 0x32464953, 0xbcc94eb0, 0x70634e2e, + 0xa9435c82, 0x65e95c1c, 0xeb665bff, 0x27cc5b61, 0x2d095278, + 0xe1a352e6, 0x6f2c5505, 0xa386559b, 0x061d761c, 0xcab77682, + 0x44387161, 0x889271ff, 0x825778e6, 0x4efd7878, 0xc0727f9b, + 0x0cd87f05, 0xd5f86da9, 0x19526d37, 0x97dd6ad4, 0x5b776a4a, + 0x51b26353, 0x9d1863cd, 0x1397642e, 0xdf3d64b0, 0x83d02561, + 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, + 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, + 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd, + 0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, + 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, + 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, + 0x264b06e6}, + {0x00000000, 0xa6770bb4, 0x979f1129, 0x31e81a9d, 0xf44f2413, + 0x52382fa7, 0x63d0353a, 0xc5a73e8e, 0x33ef4e67, 0x959845d3, + 0xa4705f4e, 0x020754fa, 0xc7a06a74, 0x61d761c0, 0x503f7b5d, + 0xf64870e9, 0x67de9cce, 0xc1a9977a, 0xf0418de7, 0x56368653, + 0x9391b8dd, 0x35e6b369, 0x040ea9f4, 0xa279a240, 0x5431d2a9, + 0xf246d91d, 0xc3aec380, 0x65d9c834, 0xa07ef6ba, 0x0609fd0e, + 0x37e1e793, 0x9196ec27, 0xcfbd399c, 0x69ca3228, 0x582228b5, + 0xfe552301, 0x3bf21d8f, 0x9d85163b, 0xac6d0ca6, 0x0a1a0712, + 0xfc5277fb, 0x5a257c4f, 0x6bcd66d2, 0xcdba6d66, 0x081d53e8, + 0xae6a585c, 0x9f8242c1, 0x39f54975, 0xa863a552, 0x0e14aee6, + 0x3ffcb47b, 0x998bbfcf, 0x5c2c8141, 0xfa5b8af5, 0xcbb39068, + 0x6dc49bdc, 0x9b8ceb35, 0x3dfbe081, 0x0c13fa1c, 0xaa64f1a8, + 0x6fc3cf26, 0xc9b4c492, 0xf85cde0f, 0x5e2bd5bb, 0x440b7579, + 0xe27c7ecd, 0xd3946450, 0x75e36fe4, 0xb044516a, 0x16335ade, + 0x27db4043, 0x81ac4bf7, 0x77e43b1e, 0xd19330aa, 0xe07b2a37, + 0x460c2183, 0x83ab1f0d, 0x25dc14b9, 0x14340e24, 0xb2430590, + 0x23d5e9b7, 0x85a2e203, 0xb44af89e, 0x123df32a, 0xd79acda4, + 0x71edc610, 0x4005dc8d, 0xe672d739, 0x103aa7d0, 0xb64dac64, + 0x87a5b6f9, 0x21d2bd4d, 0xe47583c3, 0x42028877, 0x73ea92ea, + 0xd59d995e, 0x8bb64ce5, 0x2dc14751, 0x1c295dcc, 0xba5e5678, + 0x7ff968f6, 0xd98e6342, 0xe86679df, 0x4e11726b, 0xb8590282, + 0x1e2e0936, 0x2fc613ab, 0x89b1181f, 0x4c162691, 0xea612d25, + 0xdb8937b8, 0x7dfe3c0c, 0xec68d02b, 0x4a1fdb9f, 0x7bf7c102, + 0xdd80cab6, 0x1827f438, 0xbe50ff8c, 0x8fb8e511, 0x29cfeea5, + 0xdf879e4c, 0x79f095f8, 0x48188f65, 0xee6f84d1, 0x2bc8ba5f, + 0x8dbfb1eb, 0xbc57ab76, 0x1a20a0c2, 0x8816eaf2, 0x2e61e146, + 0x1f89fbdb, 0xb9fef06f, 0x7c59cee1, 0xda2ec555, 0xebc6dfc8, + 0x4db1d47c, 0xbbf9a495, 0x1d8eaf21, 0x2c66b5bc, 0x8a11be08, + 0x4fb68086, 0xe9c18b32, 0xd82991af, 0x7e5e9a1b, 0xefc8763c, + 0x49bf7d88, 0x78576715, 0xde206ca1, 0x1b87522f, 0xbdf0599b, + 0x8c184306, 0x2a6f48b2, 0xdc27385b, 0x7a5033ef, 0x4bb82972, + 0xedcf22c6, 0x28681c48, 0x8e1f17fc, 0xbff70d61, 0x198006d5, + 0x47abd36e, 0xe1dcd8da, 0xd034c247, 0x7643c9f3, 0xb3e4f77d, + 0x1593fcc9, 0x247be654, 0x820cede0, 0x74449d09, 0xd23396bd, + 0xe3db8c20, 0x45ac8794, 0x800bb91a, 0x267cb2ae, 0x1794a833, + 0xb1e3a387, 0x20754fa0, 0x86024414, 0xb7ea5e89, 0x119d553d, + 0xd43a6bb3, 0x724d6007, 0x43a57a9a, 0xe5d2712e, 0x139a01c7, + 0xb5ed0a73, 0x840510ee, 0x22721b5a, 0xe7d525d4, 0x41a22e60, + 0x704a34fd, 0xd63d3f49, 0xcc1d9f8b, 0x6a6a943f, 0x5b828ea2, + 0xfdf58516, 0x3852bb98, 0x9e25b02c, 0xafcdaab1, 0x09baa105, + 0xfff2d1ec, 0x5985da58, 0x686dc0c5, 0xce1acb71, 0x0bbdf5ff, + 0xadcafe4b, 0x9c22e4d6, 0x3a55ef62, 0xabc30345, 0x0db408f1, + 0x3c5c126c, 0x9a2b19d8, 0x5f8c2756, 0xf9fb2ce2, 0xc813367f, + 0x6e643dcb, 0x982c4d22, 0x3e5b4696, 0x0fb35c0b, 0xa9c457bf, + 0x6c636931, 0xca146285, 0xfbfc7818, 0x5d8b73ac, 0x03a0a617, + 0xa5d7ada3, 0x943fb73e, 0x3248bc8a, 0xf7ef8204, 0x519889b0, + 0x6070932d, 0xc6079899, 0x304fe870, 0x9638e3c4, 0xa7d0f959, + 0x01a7f2ed, 0xc400cc63, 0x6277c7d7, 0x539fdd4a, 0xf5e8d6fe, + 0x647e3ad9, 0xc209316d, 0xf3e12bf0, 0x55962044, 0x90311eca, + 0x3646157e, 0x07ae0fe3, 0xa1d90457, 0x579174be, 0xf1e67f0a, + 0xc00e6597, 0x66796e23, 0xa3de50ad, 0x05a95b19, 0x34414184, + 0x92364a30}, + {0x00000000, 0xcb5cd3a5, 0x4dc8a10b, 0x869472ae, 0x9b914216, + 0x50cd91b3, 0xd659e31d, 0x1d0530b8, 0xec53826d, 0x270f51c8, + 0xa19b2366, 0x6ac7f0c3, 0x77c2c07b, 0xbc9e13de, 0x3a0a6170, + 0xf156b2d5, 0x03d6029b, 0xc88ad13e, 0x4e1ea390, 0x85427035, + 0x9847408d, 0x531b9328, 0xd58fe186, 0x1ed33223, 0xef8580f6, + 0x24d95353, 0xa24d21fd, 0x6911f258, 0x7414c2e0, 0xbf481145, + 0x39dc63eb, 0xf280b04e, 0x07ac0536, 0xccf0d693, 0x4a64a43d, + 0x81387798, 0x9c3d4720, 0x57619485, 0xd1f5e62b, 0x1aa9358e, + 0xebff875b, 0x20a354fe, 0xa6372650, 0x6d6bf5f5, 0x706ec54d, + 0xbb3216e8, 0x3da66446, 0xf6fab7e3, 0x047a07ad, 0xcf26d408, + 0x49b2a6a6, 0x82ee7503, 0x9feb45bb, 0x54b7961e, 0xd223e4b0, + 0x197f3715, 0xe82985c0, 0x23755665, 0xa5e124cb, 0x6ebdf76e, + 0x73b8c7d6, 0xb8e41473, 0x3e7066dd, 0xf52cb578, 0x0f580a6c, + 0xc404d9c9, 0x4290ab67, 0x89cc78c2, 0x94c9487a, 0x5f959bdf, + 0xd901e971, 0x125d3ad4, 0xe30b8801, 0x28575ba4, 0xaec3290a, + 0x659ffaaf, 0x789aca17, 0xb3c619b2, 0x35526b1c, 0xfe0eb8b9, + 0x0c8e08f7, 0xc7d2db52, 0x4146a9fc, 0x8a1a7a59, 0x971f4ae1, + 0x5c439944, 0xdad7ebea, 0x118b384f, 0xe0dd8a9a, 0x2b81593f, + 0xad152b91, 0x6649f834, 0x7b4cc88c, 0xb0101b29, 0x36846987, + 0xfdd8ba22, 0x08f40f5a, 0xc3a8dcff, 0x453cae51, 0x8e607df4, + 0x93654d4c, 0x58399ee9, 0xdeadec47, 0x15f13fe2, 0xe4a78d37, + 0x2ffb5e92, 0xa96f2c3c, 0x6233ff99, 0x7f36cf21, 0xb46a1c84, + 0x32fe6e2a, 0xf9a2bd8f, 0x0b220dc1, 0xc07ede64, 0x46eaacca, + 0x8db67f6f, 0x90b34fd7, 0x5bef9c72, 0xdd7beedc, 0x16273d79, + 0xe7718fac, 0x2c2d5c09, 0xaab92ea7, 0x61e5fd02, 0x7ce0cdba, + 0xb7bc1e1f, 0x31286cb1, 0xfa74bf14, 0x1eb014d8, 0xd5ecc77d, + 0x5378b5d3, 0x98246676, 0x852156ce, 0x4e7d856b, 0xc8e9f7c5, + 0x03b52460, 0xf2e396b5, 0x39bf4510, 0xbf2b37be, 0x7477e41b, + 0x6972d4a3, 0xa22e0706, 0x24ba75a8, 0xefe6a60d, 0x1d661643, + 0xd63ac5e6, 0x50aeb748, 0x9bf264ed, 0x86f75455, 0x4dab87f0, + 0xcb3ff55e, 0x006326fb, 0xf135942e, 0x3a69478b, 0xbcfd3525, + 0x77a1e680, 0x6aa4d638, 0xa1f8059d, 0x276c7733, 0xec30a496, + 0x191c11ee, 0xd240c24b, 0x54d4b0e5, 0x9f886340, 0x828d53f8, + 0x49d1805d, 0xcf45f2f3, 0x04192156, 0xf54f9383, 0x3e134026, + 0xb8873288, 0x73dbe12d, 0x6eded195, 0xa5820230, 0x2316709e, + 0xe84aa33b, 0x1aca1375, 0xd196c0d0, 0x5702b27e, 0x9c5e61db, + 0x815b5163, 0x4a0782c6, 0xcc93f068, 0x07cf23cd, 0xf6999118, + 0x3dc542bd, 0xbb513013, 0x700de3b6, 0x6d08d30e, 0xa65400ab, + 0x20c07205, 0xeb9ca1a0, 0x11e81eb4, 0xdab4cd11, 0x5c20bfbf, + 0x977c6c1a, 0x8a795ca2, 0x41258f07, 0xc7b1fda9, 0x0ced2e0c, + 0xfdbb9cd9, 0x36e74f7c, 0xb0733dd2, 0x7b2fee77, 0x662adecf, + 0xad760d6a, 0x2be27fc4, 0xe0beac61, 0x123e1c2f, 0xd962cf8a, + 0x5ff6bd24, 0x94aa6e81, 0x89af5e39, 0x42f38d9c, 0xc467ff32, + 0x0f3b2c97, 0xfe6d9e42, 0x35314de7, 0xb3a53f49, 0x78f9ecec, + 0x65fcdc54, 0xaea00ff1, 0x28347d5f, 0xe368aefa, 0x16441b82, + 0xdd18c827, 0x5b8cba89, 0x90d0692c, 0x8dd55994, 0x46898a31, + 0xc01df89f, 0x0b412b3a, 0xfa1799ef, 0x314b4a4a, 0xb7df38e4, + 0x7c83eb41, 0x6186dbf9, 0xaada085c, 0x2c4e7af2, 0xe712a957, + 0x15921919, 0xdececabc, 0x585ab812, 0x93066bb7, 0x8e035b0f, + 0x455f88aa, 0xc3cbfa04, 0x089729a1, 0xf9c19b74, 0x329d48d1, + 0xb4093a7f, 0x7f55e9da, 0x6250d962, 0xa90c0ac7, 0x2f987869, + 0xe4c4abcc}, + {0x00000000, 0x3d6029b0, 0x7ac05360, 0x47a07ad0, 0xf580a6c0, + 0xc8e08f70, 0x8f40f5a0, 0xb220dc10, 0x30704bc1, 0x0d106271, + 0x4ab018a1, 0x77d03111, 0xc5f0ed01, 0xf890c4b1, 0xbf30be61, + 0x825097d1, 0x60e09782, 0x5d80be32, 0x1a20c4e2, 0x2740ed52, + 0x95603142, 0xa80018f2, 0xefa06222, 0xd2c04b92, 0x5090dc43, + 0x6df0f5f3, 0x2a508f23, 0x1730a693, 0xa5107a83, 0x98705333, + 0xdfd029e3, 0xe2b00053, 0xc1c12f04, 0xfca106b4, 0xbb017c64, + 0x866155d4, 0x344189c4, 0x0921a074, 0x4e81daa4, 0x73e1f314, + 0xf1b164c5, 0xccd14d75, 0x8b7137a5, 0xb6111e15, 0x0431c205, + 0x3951ebb5, 0x7ef19165, 0x4391b8d5, 0xa121b886, 0x9c419136, + 0xdbe1ebe6, 0xe681c256, 0x54a11e46, 0x69c137f6, 0x2e614d26, + 0x13016496, 0x9151f347, 0xac31daf7, 0xeb91a027, 0xd6f18997, + 0x64d15587, 0x59b17c37, 0x1e1106e7, 0x23712f57, 0x58f35849, + 0x659371f9, 0x22330b29, 0x1f532299, 0xad73fe89, 0x9013d739, + 0xd7b3ade9, 0xead38459, 0x68831388, 0x55e33a38, 0x124340e8, + 0x2f236958, 0x9d03b548, 0xa0639cf8, 0xe7c3e628, 0xdaa3cf98, + 0x3813cfcb, 0x0573e67b, 0x42d39cab, 0x7fb3b51b, 0xcd93690b, + 0xf0f340bb, 0xb7533a6b, 0x8a3313db, 0x0863840a, 0x3503adba, + 0x72a3d76a, 0x4fc3feda, 0xfde322ca, 0xc0830b7a, 0x872371aa, + 0xba43581a, 0x9932774d, 0xa4525efd, 0xe3f2242d, 0xde920d9d, + 0x6cb2d18d, 0x51d2f83d, 0x167282ed, 0x2b12ab5d, 0xa9423c8c, + 0x9422153c, 0xd3826fec, 0xeee2465c, 0x5cc29a4c, 0x61a2b3fc, + 0x2602c92c, 0x1b62e09c, 0xf9d2e0cf, 0xc4b2c97f, 0x8312b3af, + 0xbe729a1f, 0x0c52460f, 0x31326fbf, 0x7692156f, 0x4bf23cdf, + 0xc9a2ab0e, 0xf4c282be, 0xb362f86e, 0x8e02d1de, 0x3c220dce, + 0x0142247e, 0x46e25eae, 0x7b82771e, 0xb1e6b092, 0x8c869922, + 0xcb26e3f2, 0xf646ca42, 0x44661652, 0x79063fe2, 0x3ea64532, + 0x03c66c82, 0x8196fb53, 0xbcf6d2e3, 0xfb56a833, 0xc6368183, + 0x74165d93, 0x49767423, 0x0ed60ef3, 0x33b62743, 0xd1062710, + 0xec660ea0, 0xabc67470, 0x96a65dc0, 0x248681d0, 0x19e6a860, + 0x5e46d2b0, 0x6326fb00, 0xe1766cd1, 0xdc164561, 0x9bb63fb1, + 0xa6d61601, 0x14f6ca11, 0x2996e3a1, 0x6e369971, 0x5356b0c1, + 0x70279f96, 0x4d47b626, 0x0ae7ccf6, 0x3787e546, 0x85a73956, + 0xb8c710e6, 0xff676a36, 0xc2074386, 0x4057d457, 0x7d37fde7, + 0x3a978737, 0x07f7ae87, 0xb5d77297, 0x88b75b27, 0xcf1721f7, + 0xf2770847, 0x10c70814, 0x2da721a4, 0x6a075b74, 0x576772c4, + 0xe547aed4, 0xd8278764, 0x9f87fdb4, 0xa2e7d404, 0x20b743d5, + 0x1dd76a65, 0x5a7710b5, 0x67173905, 0xd537e515, 0xe857cca5, + 0xaff7b675, 0x92979fc5, 0xe915e8db, 0xd475c16b, 0x93d5bbbb, + 0xaeb5920b, 0x1c954e1b, 0x21f567ab, 0x66551d7b, 0x5b3534cb, + 0xd965a31a, 0xe4058aaa, 0xa3a5f07a, 0x9ec5d9ca, 0x2ce505da, + 0x11852c6a, 0x562556ba, 0x6b457f0a, 0x89f57f59, 0xb49556e9, + 0xf3352c39, 0xce550589, 0x7c75d999, 0x4115f029, 0x06b58af9, + 0x3bd5a349, 0xb9853498, 0x84e51d28, 0xc34567f8, 0xfe254e48, + 0x4c059258, 0x7165bbe8, 0x36c5c138, 0x0ba5e888, 0x28d4c7df, + 0x15b4ee6f, 0x521494bf, 0x6f74bd0f, 0xdd54611f, 0xe03448af, + 0xa794327f, 0x9af41bcf, 0x18a48c1e, 0x25c4a5ae, 0x6264df7e, + 0x5f04f6ce, 0xed242ade, 0xd044036e, 0x97e479be, 0xaa84500e, + 0x4834505d, 0x755479ed, 0x32f4033d, 0x0f942a8d, 0xbdb4f69d, + 0x80d4df2d, 0xc774a5fd, 0xfa148c4d, 0x78441b9c, 0x4524322c, + 0x028448fc, 0x3fe4614c, 0x8dc4bd5c, 0xb0a494ec, 0xf704ee3c, + 0xca64c78c}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0xb029603d, 0x6053c07a, 0xd07aa047, 0xc0a680f5, + 0x708fe0c8, 0xa0f5408f, 0x10dc20b2, 0xc14b7030, 0x7162100d, + 0xa118b04a, 0x1131d077, 0x01edf0c5, 0xb1c490f8, 0x61be30bf, + 0xd1975082, 0x8297e060, 0x32be805d, 0xe2c4201a, 0x52ed4027, + 0x42316095, 0xf21800a8, 0x2262a0ef, 0x924bc0d2, 0x43dc9050, + 0xf3f5f06d, 0x238f502a, 0x93a63017, 0x837a10a5, 0x33537098, + 0xe329d0df, 0x5300b0e2, 0x042fc1c1, 0xb406a1fc, 0x647c01bb, + 0xd4556186, 0xc4894134, 0x74a02109, 0xa4da814e, 0x14f3e173, + 0xc564b1f1, 0x754dd1cc, 0xa537718b, 0x151e11b6, 0x05c23104, + 0xb5eb5139, 0x6591f17e, 0xd5b89143, 0x86b821a1, 0x3691419c, + 0xe6ebe1db, 0x56c281e6, 0x461ea154, 0xf637c169, 0x264d612e, + 0x96640113, 0x47f35191, 0xf7da31ac, 0x27a091eb, 0x9789f1d6, + 0x8755d164, 0x377cb159, 0xe706111e, 0x572f7123, 0x4958f358, + 0xf9719365, 0x290b3322, 0x9922531f, 0x89fe73ad, 0x39d71390, + 0xe9adb3d7, 0x5984d3ea, 0x88138368, 0x383ae355, 0xe8404312, + 0x5869232f, 0x48b5039d, 0xf89c63a0, 0x28e6c3e7, 0x98cfa3da, + 0xcbcf1338, 0x7be67305, 0xab9cd342, 0x1bb5b37f, 0x0b6993cd, + 0xbb40f3f0, 0x6b3a53b7, 0xdb13338a, 0x0a846308, 0xbaad0335, + 0x6ad7a372, 0xdafec34f, 0xca22e3fd, 0x7a0b83c0, 0xaa712387, + 0x1a5843ba, 0x4d773299, 0xfd5e52a4, 0x2d24f2e3, 0x9d0d92de, + 0x8dd1b26c, 0x3df8d251, 0xed827216, 0x5dab122b, 0x8c3c42a9, + 0x3c152294, 0xec6f82d3, 0x5c46e2ee, 0x4c9ac25c, 0xfcb3a261, + 0x2cc90226, 0x9ce0621b, 0xcfe0d2f9, 0x7fc9b2c4, 0xafb31283, + 0x1f9a72be, 0x0f46520c, 0xbf6f3231, 0x6f159276, 0xdf3cf24b, + 0x0eaba2c9, 0xbe82c2f4, 0x6ef862b3, 0xded1028e, 0xce0d223c, + 0x7e244201, 0xae5ee246, 0x1e77827b, 0x92b0e6b1, 0x2299868c, + 0xf2e326cb, 0x42ca46f6, 0x52166644, 0xe23f0679, 0x3245a63e, + 0x826cc603, 0x53fb9681, 0xe3d2f6bc, 0x33a856fb, 0x838136c6, + 0x935d1674, 0x23747649, 0xf30ed60e, 0x4327b633, 0x102706d1, + 0xa00e66ec, 0x7074c6ab, 0xc05da696, 0xd0818624, 0x60a8e619, + 0xb0d2465e, 0x00fb2663, 0xd16c76e1, 0x614516dc, 0xb13fb69b, + 0x0116d6a6, 0x11caf614, 0xa1e39629, 0x7199366e, 0xc1b05653, + 0x969f2770, 0x26b6474d, 0xf6cce70a, 0x46e58737, 0x5639a785, + 0xe610c7b8, 0x366a67ff, 0x864307c2, 0x57d45740, 0xe7fd377d, + 0x3787973a, 0x87aef707, 0x9772d7b5, 0x275bb788, 0xf72117cf, + 0x470877f2, 0x1408c710, 0xa421a72d, 0x745b076a, 0xc4726757, + 0xd4ae47e5, 0x648727d8, 0xb4fd879f, 0x04d4e7a2, 0xd543b720, + 0x656ad71d, 0xb510775a, 0x05391767, 0x15e537d5, 0xa5cc57e8, + 0x75b6f7af, 0xc59f9792, 0xdbe815e9, 0x6bc175d4, 0xbbbbd593, + 0x0b92b5ae, 0x1b4e951c, 0xab67f521, 0x7b1d5566, 0xcb34355b, + 0x1aa365d9, 0xaa8a05e4, 0x7af0a5a3, 0xcad9c59e, 0xda05e52c, + 0x6a2c8511, 0xba562556, 0x0a7f456b, 0x597ff589, 0xe95695b4, + 0x392c35f3, 0x890555ce, 0x99d9757c, 0x29f01541, 0xf98ab506, + 0x49a3d53b, 0x983485b9, 0x281de584, 0xf86745c3, 0x484e25fe, + 0x5892054c, 0xe8bb6571, 0x38c1c536, 0x88e8a50b, 0xdfc7d428, + 0x6feeb415, 0xbf941452, 0x0fbd746f, 0x1f6154dd, 0xaf4834e0, + 0x7f3294a7, 0xcf1bf49a, 0x1e8ca418, 0xaea5c425, 0x7edf6462, + 0xcef6045f, 0xde2a24ed, 0x6e0344d0, 0xbe79e497, 0x0e5084aa, + 0x5d503448, 0xed795475, 0x3d03f432, 0x8d2a940f, 0x9df6b4bd, + 0x2ddfd480, 0xfda574c7, 0x4d8c14fa, 0x9c1b4478, 0x2c322445, + 0xfc488402, 0x4c61e43f, 0x5cbdc48d, 0xec94a4b0, 0x3cee04f7, + 0x8cc764ca}, + {0x00000000, 0xa5d35ccb, 0x0ba1c84d, 0xae729486, 0x1642919b, + 0xb391cd50, 0x1de359d6, 0xb830051d, 0x6d8253ec, 0xc8510f27, + 0x66239ba1, 0xc3f0c76a, 0x7bc0c277, 0xde139ebc, 0x70610a3a, + 0xd5b256f1, 0x9b02d603, 0x3ed18ac8, 0x90a31e4e, 0x35704285, + 0x8d404798, 0x28931b53, 0x86e18fd5, 0x2332d31e, 0xf68085ef, + 0x5353d924, 0xfd214da2, 0x58f21169, 0xe0c21474, 0x451148bf, + 0xeb63dc39, 0x4eb080f2, 0x3605ac07, 0x93d6f0cc, 0x3da4644a, + 0x98773881, 0x20473d9c, 0x85946157, 0x2be6f5d1, 0x8e35a91a, + 0x5b87ffeb, 0xfe54a320, 0x502637a6, 0xf5f56b6d, 0x4dc56e70, + 0xe81632bb, 0x4664a63d, 0xe3b7faf6, 0xad077a04, 0x08d426cf, + 0xa6a6b249, 0x0375ee82, 0xbb45eb9f, 0x1e96b754, 0xb0e423d2, + 0x15377f19, 0xc08529e8, 0x65567523, 0xcb24e1a5, 0x6ef7bd6e, + 0xd6c7b873, 0x7314e4b8, 0xdd66703e, 0x78b52cf5, 0x6c0a580f, + 0xc9d904c4, 0x67ab9042, 0xc278cc89, 0x7a48c994, 0xdf9b955f, + 0x71e901d9, 0xd43a5d12, 0x01880be3, 0xa45b5728, 0x0a29c3ae, + 0xaffa9f65, 0x17ca9a78, 0xb219c6b3, 0x1c6b5235, 0xb9b80efe, + 0xf7088e0c, 0x52dbd2c7, 0xfca94641, 0x597a1a8a, 0xe14a1f97, + 0x4499435c, 0xeaebd7da, 0x4f388b11, 0x9a8adde0, 0x3f59812b, + 0x912b15ad, 0x34f84966, 0x8cc84c7b, 0x291b10b0, 0x87698436, + 0x22bad8fd, 0x5a0ff408, 0xffdca8c3, 0x51ae3c45, 0xf47d608e, + 0x4c4d6593, 0xe99e3958, 0x47ecadde, 0xe23ff115, 0x378da7e4, + 0x925efb2f, 0x3c2c6fa9, 0x99ff3362, 0x21cf367f, 0x841c6ab4, + 0x2a6efe32, 0x8fbda2f9, 0xc10d220b, 0x64de7ec0, 0xcaacea46, + 0x6f7fb68d, 0xd74fb390, 0x729cef5b, 0xdcee7bdd, 0x793d2716, + 0xac8f71e7, 0x095c2d2c, 0xa72eb9aa, 0x02fde561, 0xbacde07c, + 0x1f1ebcb7, 0xb16c2831, 0x14bf74fa, 0xd814b01e, 0x7dc7ecd5, + 0xd3b57853, 0x76662498, 0xce562185, 0x6b857d4e, 0xc5f7e9c8, + 0x6024b503, 0xb596e3f2, 0x1045bf39, 0xbe372bbf, 0x1be47774, + 0xa3d47269, 0x06072ea2, 0xa875ba24, 0x0da6e6ef, 0x4316661d, + 0xe6c53ad6, 0x48b7ae50, 0xed64f29b, 0x5554f786, 0xf087ab4d, + 0x5ef53fcb, 0xfb266300, 0x2e9435f1, 0x8b47693a, 0x2535fdbc, + 0x80e6a177, 0x38d6a46a, 0x9d05f8a1, 0x33776c27, 0x96a430ec, + 0xee111c19, 0x4bc240d2, 0xe5b0d454, 0x4063889f, 0xf8538d82, + 0x5d80d149, 0xf3f245cf, 0x56211904, 0x83934ff5, 0x2640133e, + 0x883287b8, 0x2de1db73, 0x95d1de6e, 0x300282a5, 0x9e701623, + 0x3ba34ae8, 0x7513ca1a, 0xd0c096d1, 0x7eb20257, 0xdb615e9c, + 0x63515b81, 0xc682074a, 0x68f093cc, 0xcd23cf07, 0x189199f6, + 0xbd42c53d, 0x133051bb, 0xb6e30d70, 0x0ed3086d, 0xab0054a6, + 0x0572c020, 0xa0a19ceb, 0xb41ee811, 0x11cdb4da, 0xbfbf205c, + 0x1a6c7c97, 0xa25c798a, 0x078f2541, 0xa9fdb1c7, 0x0c2eed0c, + 0xd99cbbfd, 0x7c4fe736, 0xd23d73b0, 0x77ee2f7b, 0xcfde2a66, + 0x6a0d76ad, 0xc47fe22b, 0x61acbee0, 0x2f1c3e12, 0x8acf62d9, + 0x24bdf65f, 0x816eaa94, 0x395eaf89, 0x9c8df342, 0x32ff67c4, + 0x972c3b0f, 0x429e6dfe, 0xe74d3135, 0x493fa5b3, 0xececf978, + 0x54dcfc65, 0xf10fa0ae, 0x5f7d3428, 0xfaae68e3, 0x821b4416, + 0x27c818dd, 0x89ba8c5b, 0x2c69d090, 0x9459d58d, 0x318a8946, + 0x9ff81dc0, 0x3a2b410b, 0xef9917fa, 0x4a4a4b31, 0xe438dfb7, + 0x41eb837c, 0xf9db8661, 0x5c08daaa, 0xf27a4e2c, 0x57a912e7, + 0x19199215, 0xbccacede, 0x12b85a58, 0xb76b0693, 0x0f5b038e, + 0xaa885f45, 0x04facbc3, 0xa1299708, 0x749bc1f9, 0xd1489d32, + 0x7f3a09b4, 0xdae9557f, 0x62d95062, 0xc70a0ca9, 0x6978982f, + 0xccabc4e4}, + {0x00000000, 0xb40b77a6, 0x29119f97, 0x9d1ae831, 0x13244ff4, + 0xa72f3852, 0x3a35d063, 0x8e3ea7c5, 0x674eef33, 0xd3459895, + 0x4e5f70a4, 0xfa540702, 0x746aa0c7, 0xc061d761, 0x5d7b3f50, + 0xe97048f6, 0xce9cde67, 0x7a97a9c1, 0xe78d41f0, 0x53863656, + 0xddb89193, 0x69b3e635, 0xf4a90e04, 0x40a279a2, 0xa9d23154, + 0x1dd946f2, 0x80c3aec3, 0x34c8d965, 0xbaf67ea0, 0x0efd0906, + 0x93e7e137, 0x27ec9691, 0x9c39bdcf, 0x2832ca69, 0xb5282258, + 0x012355fe, 0x8f1df23b, 0x3b16859d, 0xa60c6dac, 0x12071a0a, + 0xfb7752fc, 0x4f7c255a, 0xd266cd6b, 0x666dbacd, 0xe8531d08, + 0x5c586aae, 0xc142829f, 0x7549f539, 0x52a563a8, 0xe6ae140e, + 0x7bb4fc3f, 0xcfbf8b99, 0x41812c5c, 0xf58a5bfa, 0x6890b3cb, + 0xdc9bc46d, 0x35eb8c9b, 0x81e0fb3d, 0x1cfa130c, 0xa8f164aa, + 0x26cfc36f, 0x92c4b4c9, 0x0fde5cf8, 0xbbd52b5e, 0x79750b44, + 0xcd7e7ce2, 0x506494d3, 0xe46fe375, 0x6a5144b0, 0xde5a3316, + 0x4340db27, 0xf74bac81, 0x1e3be477, 0xaa3093d1, 0x372a7be0, + 0x83210c46, 0x0d1fab83, 0xb914dc25, 0x240e3414, 0x900543b2, + 0xb7e9d523, 0x03e2a285, 0x9ef84ab4, 0x2af33d12, 0xa4cd9ad7, + 0x10c6ed71, 0x8ddc0540, 0x39d772e6, 0xd0a73a10, 0x64ac4db6, + 0xf9b6a587, 0x4dbdd221, 0xc38375e4, 0x77880242, 0xea92ea73, + 0x5e999dd5, 0xe54cb68b, 0x5147c12d, 0xcc5d291c, 0x78565eba, + 0xf668f97f, 0x42638ed9, 0xdf7966e8, 0x6b72114e, 0x820259b8, + 0x36092e1e, 0xab13c62f, 0x1f18b189, 0x9126164c, 0x252d61ea, + 0xb83789db, 0x0c3cfe7d, 0x2bd068ec, 0x9fdb1f4a, 0x02c1f77b, + 0xb6ca80dd, 0x38f42718, 0x8cff50be, 0x11e5b88f, 0xa5eecf29, + 0x4c9e87df, 0xf895f079, 0x658f1848, 0xd1846fee, 0x5fbac82b, + 0xebb1bf8d, 0x76ab57bc, 0xc2a0201a, 0xf2ea1688, 0x46e1612e, + 0xdbfb891f, 0x6ff0feb9, 0xe1ce597c, 0x55c52eda, 0xc8dfc6eb, + 0x7cd4b14d, 0x95a4f9bb, 0x21af8e1d, 0xbcb5662c, 0x08be118a, + 0x8680b64f, 0x328bc1e9, 0xaf9129d8, 0x1b9a5e7e, 0x3c76c8ef, + 0x887dbf49, 0x15675778, 0xa16c20de, 0x2f52871b, 0x9b59f0bd, + 0x0643188c, 0xb2486f2a, 0x5b3827dc, 0xef33507a, 0x7229b84b, + 0xc622cfed, 0x481c6828, 0xfc171f8e, 0x610df7bf, 0xd5068019, + 0x6ed3ab47, 0xdad8dce1, 0x47c234d0, 0xf3c94376, 0x7df7e4b3, + 0xc9fc9315, 0x54e67b24, 0xe0ed0c82, 0x099d4474, 0xbd9633d2, + 0x208cdbe3, 0x9487ac45, 0x1ab90b80, 0xaeb27c26, 0x33a89417, + 0x87a3e3b1, 0xa04f7520, 0x14440286, 0x895eeab7, 0x3d559d11, + 0xb36b3ad4, 0x07604d72, 0x9a7aa543, 0x2e71d2e5, 0xc7019a13, + 0x730aedb5, 0xee100584, 0x5a1b7222, 0xd425d5e7, 0x602ea241, + 0xfd344a70, 0x493f3dd6, 0x8b9f1dcc, 0x3f946a6a, 0xa28e825b, + 0x1685f5fd, 0x98bb5238, 0x2cb0259e, 0xb1aacdaf, 0x05a1ba09, + 0xecd1f2ff, 0x58da8559, 0xc5c06d68, 0x71cb1ace, 0xfff5bd0b, + 0x4bfecaad, 0xd6e4229c, 0x62ef553a, 0x4503c3ab, 0xf108b40d, + 0x6c125c3c, 0xd8192b9a, 0x56278c5f, 0xe22cfbf9, 0x7f3613c8, + 0xcb3d646e, 0x224d2c98, 0x96465b3e, 0x0b5cb30f, 0xbf57c4a9, + 0x3169636c, 0x856214ca, 0x1878fcfb, 0xac738b5d, 0x17a6a003, + 0xa3add7a5, 0x3eb73f94, 0x8abc4832, 0x0482eff7, 0xb0899851, + 0x2d937060, 0x999807c6, 0x70e84f30, 0xc4e33896, 0x59f9d0a7, + 0xedf2a701, 0x63cc00c4, 0xd7c77762, 0x4add9f53, 0xfed6e8f5, + 0xd93a7e64, 0x6d3109c2, 0xf02be1f3, 0x44209655, 0xca1e3190, + 0x7e154636, 0xe30fae07, 0x5704d9a1, 0xbe749157, 0x0a7fe6f1, + 0x97650ec0, 0x236e7966, 0xad50dea3, 0x195ba905, 0x84414134, + 0x304a3692}, + {0x00000000, 0x9e00aacc, 0x7d072542, 0xe3078f8e, 0xfa0e4a84, + 0x640ee048, 0x87096fc6, 0x1909c50a, 0xb51be5d3, 0x2b1b4f1f, + 0xc81cc091, 0x561c6a5d, 0x4f15af57, 0xd115059b, 0x32128a15, + 0xac1220d9, 0x2b31bb7c, 0xb53111b0, 0x56369e3e, 0xc83634f2, + 0xd13ff1f8, 0x4f3f5b34, 0xac38d4ba, 0x32387e76, 0x9e2a5eaf, + 0x002af463, 0xe32d7bed, 0x7d2dd121, 0x6424142b, 0xfa24bee7, + 0x19233169, 0x87239ba5, 0x566276f9, 0xc862dc35, 0x2b6553bb, + 0xb565f977, 0xac6c3c7d, 0x326c96b1, 0xd16b193f, 0x4f6bb3f3, + 0xe379932a, 0x7d7939e6, 0x9e7eb668, 0x007e1ca4, 0x1977d9ae, + 0x87777362, 0x6470fcec, 0xfa705620, 0x7d53cd85, 0xe3536749, + 0x0054e8c7, 0x9e54420b, 0x875d8701, 0x195d2dcd, 0xfa5aa243, + 0x645a088f, 0xc8482856, 0x5648829a, 0xb54f0d14, 0x2b4fa7d8, + 0x324662d2, 0xac46c81e, 0x4f414790, 0xd141ed5c, 0xedc29d29, + 0x73c237e5, 0x90c5b86b, 0x0ec512a7, 0x17ccd7ad, 0x89cc7d61, + 0x6acbf2ef, 0xf4cb5823, 0x58d978fa, 0xc6d9d236, 0x25de5db8, + 0xbbdef774, 0xa2d7327e, 0x3cd798b2, 0xdfd0173c, 0x41d0bdf0, + 0xc6f32655, 0x58f38c99, 0xbbf40317, 0x25f4a9db, 0x3cfd6cd1, + 0xa2fdc61d, 0x41fa4993, 0xdffae35f, 0x73e8c386, 0xede8694a, + 0x0eefe6c4, 0x90ef4c08, 0x89e68902, 0x17e623ce, 0xf4e1ac40, + 0x6ae1068c, 0xbba0ebd0, 0x25a0411c, 0xc6a7ce92, 0x58a7645e, + 0x41aea154, 0xdfae0b98, 0x3ca98416, 0xa2a92eda, 0x0ebb0e03, + 0x90bba4cf, 0x73bc2b41, 0xedbc818d, 0xf4b54487, 0x6ab5ee4b, + 0x89b261c5, 0x17b2cb09, 0x909150ac, 0x0e91fa60, 0xed9675ee, + 0x7396df22, 0x6a9f1a28, 0xf49fb0e4, 0x17983f6a, 0x899895a6, + 0x258ab57f, 0xbb8a1fb3, 0x588d903d, 0xc68d3af1, 0xdf84fffb, + 0x41845537, 0xa283dab9, 0x3c837075, 0xda853b53, 0x4485919f, + 0xa7821e11, 0x3982b4dd, 0x208b71d7, 0xbe8bdb1b, 0x5d8c5495, + 0xc38cfe59, 0x6f9ede80, 0xf19e744c, 0x1299fbc2, 0x8c99510e, + 0x95909404, 0x0b903ec8, 0xe897b146, 0x76971b8a, 0xf1b4802f, + 0x6fb42ae3, 0x8cb3a56d, 0x12b30fa1, 0x0bbacaab, 0x95ba6067, + 0x76bdefe9, 0xe8bd4525, 0x44af65fc, 0xdaafcf30, 0x39a840be, + 0xa7a8ea72, 0xbea12f78, 0x20a185b4, 0xc3a60a3a, 0x5da6a0f6, + 0x8ce74daa, 0x12e7e766, 0xf1e068e8, 0x6fe0c224, 0x76e9072e, + 0xe8e9ade2, 0x0bee226c, 0x95ee88a0, 0x39fca879, 0xa7fc02b5, + 0x44fb8d3b, 0xdafb27f7, 0xc3f2e2fd, 0x5df24831, 0xbef5c7bf, + 0x20f56d73, 0xa7d6f6d6, 0x39d65c1a, 0xdad1d394, 0x44d17958, + 0x5dd8bc52, 0xc3d8169e, 0x20df9910, 0xbedf33dc, 0x12cd1305, + 0x8ccdb9c9, 0x6fca3647, 0xf1ca9c8b, 0xe8c35981, 0x76c3f34d, + 0x95c47cc3, 0x0bc4d60f, 0x3747a67a, 0xa9470cb6, 0x4a408338, + 0xd44029f4, 0xcd49ecfe, 0x53494632, 0xb04ec9bc, 0x2e4e6370, + 0x825c43a9, 0x1c5ce965, 0xff5b66eb, 0x615bcc27, 0x7852092d, + 0xe652a3e1, 0x05552c6f, 0x9b5586a3, 0x1c761d06, 0x8276b7ca, + 0x61713844, 0xff719288, 0xe6785782, 0x7878fd4e, 0x9b7f72c0, + 0x057fd80c, 0xa96df8d5, 0x376d5219, 0xd46add97, 0x4a6a775b, + 0x5363b251, 0xcd63189d, 0x2e649713, 0xb0643ddf, 0x6125d083, + 0xff257a4f, 0x1c22f5c1, 0x82225f0d, 0x9b2b9a07, 0x052b30cb, + 0xe62cbf45, 0x782c1589, 0xd43e3550, 0x4a3e9f9c, 0xa9391012, + 0x3739bade, 0x2e307fd4, 0xb030d518, 0x53375a96, 0xcd37f05a, + 0x4a146bff, 0xd414c133, 0x37134ebd, 0xa913e471, 0xb01a217b, + 0x2e1a8bb7, 0xcd1d0439, 0x531daef5, 0xff0f8e2c, 0x610f24e0, + 0x8208ab6e, 0x1c0801a2, 0x0501c4a8, 0x9b016e64, 0x7806e1ea, + 0xe6064b26}}; + #endif - } -}; + +#endif + +#if N == 3 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x81256527, 0xd93bcc0f, 0x581ea928, 0x69069e5f, + 0xe823fb78, 0xb03d5250, 0x31183777, 0xd20d3cbe, 0x53285999, + 0x0b36f0b1, 0x8a139596, 0xbb0ba2e1, 0x3a2ec7c6, 0x62306eee, + 0xe3150bc9, 0x7f6b7f3d, 0xfe4e1a1a, 0xa650b332, 0x2775d615, + 0x166de162, 0x97488445, 0xcf562d6d, 0x4e73484a, 0xad664383, + 0x2c4326a4, 0x745d8f8c, 0xf578eaab, 0xc460dddc, 0x4545b8fb, + 0x1d5b11d3, 0x9c7e74f4, 0xfed6fe7a, 0x7ff39b5d, 0x27ed3275, + 0xa6c85752, 0x97d06025, 0x16f50502, 0x4eebac2a, 0xcfcec90d, + 0x2cdbc2c4, 0xadfea7e3, 0xf5e00ecb, 0x74c56bec, 0x45dd5c9b, + 0xc4f839bc, 0x9ce69094, 0x1dc3f5b3, 0x81bd8147, 0x0098e460, + 0x58864d48, 0xd9a3286f, 0xe8bb1f18, 0x699e7a3f, 0x3180d317, + 0xb0a5b630, 0x53b0bdf9, 0xd295d8de, 0x8a8b71f6, 0x0bae14d1, + 0x3ab623a6, 0xbb934681, 0xe38defa9, 0x62a88a8e, 0x26dcfab5, + 0xa7f99f92, 0xffe736ba, 0x7ec2539d, 0x4fda64ea, 0xceff01cd, + 0x96e1a8e5, 0x17c4cdc2, 0xf4d1c60b, 0x75f4a32c, 0x2dea0a04, + 0xaccf6f23, 0x9dd75854, 0x1cf23d73, 0x44ec945b, 0xc5c9f17c, + 0x59b78588, 0xd892e0af, 0x808c4987, 0x01a92ca0, 0x30b11bd7, + 0xb1947ef0, 0xe98ad7d8, 0x68afb2ff, 0x8bbab936, 0x0a9fdc11, + 0x52817539, 0xd3a4101e, 0xe2bc2769, 0x6399424e, 0x3b87eb66, + 0xbaa28e41, 0xd80a04cf, 0x592f61e8, 0x0131c8c0, 0x8014ade7, + 0xb10c9a90, 0x3029ffb7, 0x6837569f, 0xe91233b8, 0x0a073871, + 0x8b225d56, 0xd33cf47e, 0x52199159, 0x6301a62e, 0xe224c309, + 0xba3a6a21, 0x3b1f0f06, 0xa7617bf2, 0x26441ed5, 0x7e5ab7fd, + 0xff7fd2da, 0xce67e5ad, 0x4f42808a, 0x175c29a2, 0x96794c85, + 0x756c474c, 0xf449226b, 0xac578b43, 0x2d72ee64, 0x1c6ad913, + 0x9d4fbc34, 0xc551151c, 0x4474703b, 0x4db9f56a, 0xcc9c904d, + 0x94823965, 0x15a75c42, 0x24bf6b35, 0xa59a0e12, 0xfd84a73a, + 0x7ca1c21d, 0x9fb4c9d4, 0x1e91acf3, 0x468f05db, 0xc7aa60fc, + 0xf6b2578b, 0x779732ac, 0x2f899b84, 0xaeacfea3, 0x32d28a57, + 0xb3f7ef70, 0xebe94658, 0x6acc237f, 0x5bd41408, 0xdaf1712f, + 0x82efd807, 0x03cabd20, 0xe0dfb6e9, 0x61fad3ce, 0x39e47ae6, + 0xb8c11fc1, 0x89d928b6, 0x08fc4d91, 0x50e2e4b9, 0xd1c7819e, + 0xb36f0b10, 0x324a6e37, 0x6a54c71f, 0xeb71a238, 0xda69954f, + 0x5b4cf068, 0x03525940, 0x82773c67, 0x616237ae, 0xe0475289, + 0xb859fba1, 0x397c9e86, 0x0864a9f1, 0x8941ccd6, 0xd15f65fe, + 0x507a00d9, 0xcc04742d, 0x4d21110a, 0x153fb822, 0x941add05, + 0xa502ea72, 0x24278f55, 0x7c39267d, 0xfd1c435a, 0x1e094893, + 0x9f2c2db4, 0xc732849c, 0x4617e1bb, 0x770fd6cc, 0xf62ab3eb, + 0xae341ac3, 0x2f117fe4, 0x6b650fdf, 0xea406af8, 0xb25ec3d0, + 0x337ba6f7, 0x02639180, 0x8346f4a7, 0xdb585d8f, 0x5a7d38a8, + 0xb9683361, 0x384d5646, 0x6053ff6e, 0xe1769a49, 0xd06ead3e, + 0x514bc819, 0x09556131, 0x88700416, 0x140e70e2, 0x952b15c5, + 0xcd35bced, 0x4c10d9ca, 0x7d08eebd, 0xfc2d8b9a, 0xa43322b2, + 0x25164795, 0xc6034c5c, 0x4726297b, 0x1f388053, 0x9e1de574, + 0xaf05d203, 0x2e20b724, 0x763e1e0c, 0xf71b7b2b, 0x95b3f1a5, + 0x14969482, 0x4c883daa, 0xcdad588d, 0xfcb56ffa, 0x7d900add, + 0x258ea3f5, 0xa4abc6d2, 0x47becd1b, 0xc69ba83c, 0x9e850114, + 0x1fa06433, 0x2eb85344, 0xaf9d3663, 0xf7839f4b, 0x76a6fa6c, + 0xead88e98, 0x6bfdebbf, 0x33e34297, 0xb2c627b0, 0x83de10c7, + 0x02fb75e0, 0x5ae5dcc8, 0xdbc0b9ef, 0x38d5b226, 0xb9f0d701, + 0xe1ee7e29, 0x60cb1b0e, 0x51d32c79, 0xd0f6495e, 0x88e8e076, + 0x09cd8551}, + {0x00000000, 0x9b73ead4, 0xed96d3e9, 0x76e5393d, 0x005ca193, + 0x9b2f4b47, 0xedca727a, 0x76b998ae, 0x00b94326, 0x9bcaa9f2, + 0xed2f90cf, 0x765c7a1b, 0x00e5e2b5, 0x9b960861, 0xed73315c, + 0x7600db88, 0x0172864c, 0x9a016c98, 0xece455a5, 0x7797bf71, + 0x012e27df, 0x9a5dcd0b, 0xecb8f436, 0x77cb1ee2, 0x01cbc56a, + 0x9ab82fbe, 0xec5d1683, 0x772efc57, 0x019764f9, 0x9ae48e2d, + 0xec01b710, 0x77725dc4, 0x02e50c98, 0x9996e64c, 0xef73df71, + 0x740035a5, 0x02b9ad0b, 0x99ca47df, 0xef2f7ee2, 0x745c9436, + 0x025c4fbe, 0x992fa56a, 0xefca9c57, 0x74b97683, 0x0200ee2d, + 0x997304f9, 0xef963dc4, 0x74e5d710, 0x03978ad4, 0x98e46000, + 0xee01593d, 0x7572b3e9, 0x03cb2b47, 0x98b8c193, 0xee5df8ae, + 0x752e127a, 0x032ec9f2, 0x985d2326, 0xeeb81a1b, 0x75cbf0cf, + 0x03726861, 0x980182b5, 0xeee4bb88, 0x7597515c, 0x05ca1930, + 0x9eb9f3e4, 0xe85ccad9, 0x732f200d, 0x0596b8a3, 0x9ee55277, + 0xe8006b4a, 0x7373819e, 0x05735a16, 0x9e00b0c2, 0xe8e589ff, + 0x7396632b, 0x052ffb85, 0x9e5c1151, 0xe8b9286c, 0x73cac2b8, + 0x04b89f7c, 0x9fcb75a8, 0xe92e4c95, 0x725da641, 0x04e43eef, + 0x9f97d43b, 0xe972ed06, 0x720107d2, 0x0401dc5a, 0x9f72368e, + 0xe9970fb3, 0x72e4e567, 0x045d7dc9, 0x9f2e971d, 0xe9cbae20, + 0x72b844f4, 0x072f15a8, 0x9c5cff7c, 0xeab9c641, 0x71ca2c95, + 0x0773b43b, 0x9c005eef, 0xeae567d2, 0x71968d06, 0x0796568e, + 0x9ce5bc5a, 0xea008567, 0x71736fb3, 0x07caf71d, 0x9cb91dc9, + 0xea5c24f4, 0x712fce20, 0x065d93e4, 0x9d2e7930, 0xebcb400d, + 0x70b8aad9, 0x06013277, 0x9d72d8a3, 0xeb97e19e, 0x70e40b4a, + 0x06e4d0c2, 0x9d973a16, 0xeb72032b, 0x7001e9ff, 0x06b87151, + 0x9dcb9b85, 0xeb2ea2b8, 0x705d486c, 0x0b943260, 0x90e7d8b4, + 0xe602e189, 0x7d710b5d, 0x0bc893f3, 0x90bb7927, 0xe65e401a, + 0x7d2daace, 0x0b2d7146, 0x905e9b92, 0xe6bba2af, 0x7dc8487b, + 0x0b71d0d5, 0x90023a01, 0xe6e7033c, 0x7d94e9e8, 0x0ae6b42c, + 0x91955ef8, 0xe77067c5, 0x7c038d11, 0x0aba15bf, 0x91c9ff6b, + 0xe72cc656, 0x7c5f2c82, 0x0a5ff70a, 0x912c1dde, 0xe7c924e3, + 0x7cbace37, 0x0a035699, 0x9170bc4d, 0xe7958570, 0x7ce66fa4, + 0x09713ef8, 0x9202d42c, 0xe4e7ed11, 0x7f9407c5, 0x092d9f6b, + 0x925e75bf, 0xe4bb4c82, 0x7fc8a656, 0x09c87dde, 0x92bb970a, + 0xe45eae37, 0x7f2d44e3, 0x0994dc4d, 0x92e73699, 0xe4020fa4, + 0x7f71e570, 0x0803b8b4, 0x93705260, 0xe5956b5d, 0x7ee68189, + 0x085f1927, 0x932cf3f3, 0xe5c9cace, 0x7eba201a, 0x08bafb92, + 0x93c91146, 0xe52c287b, 0x7e5fc2af, 0x08e65a01, 0x9395b0d5, + 0xe57089e8, 0x7e03633c, 0x0e5e2b50, 0x952dc184, 0xe3c8f8b9, + 0x78bb126d, 0x0e028ac3, 0x95716017, 0xe394592a, 0x78e7b3fe, + 0x0ee76876, 0x959482a2, 0xe371bb9f, 0x7802514b, 0x0ebbc9e5, + 0x95c82331, 0xe32d1a0c, 0x785ef0d8, 0x0f2cad1c, 0x945f47c8, + 0xe2ba7ef5, 0x79c99421, 0x0f700c8f, 0x9403e65b, 0xe2e6df66, + 0x799535b2, 0x0f95ee3a, 0x94e604ee, 0xe2033dd3, 0x7970d707, + 0x0fc94fa9, 0x94baa57d, 0xe25f9c40, 0x792c7694, 0x0cbb27c8, + 0x97c8cd1c, 0xe12df421, 0x7a5e1ef5, 0x0ce7865b, 0x97946c8f, + 0xe17155b2, 0x7a02bf66, 0x0c0264ee, 0x97718e3a, 0xe194b707, + 0x7ae75dd3, 0x0c5ec57d, 0x972d2fa9, 0xe1c81694, 0x7abbfc40, + 0x0dc9a184, 0x96ba4b50, 0xe05f726d, 0x7b2c98b9, 0x0d950017, + 0x96e6eac3, 0xe003d3fe, 0x7b70392a, 0x0d70e2a2, 0x96030876, + 0xe0e6314b, 0x7b95db9f, 0x0d2c4331, 0x965fa9e5, 0xe0ba90d8, + 0x7bc97a0c}, + {0x00000000, 0x172864c0, 0x2e50c980, 0x3978ad40, 0x5ca19300, + 0x4b89f7c0, 0x72f15a80, 0x65d93e40, 0xb9432600, 0xae6b42c0, + 0x9713ef80, 0x803b8b40, 0xe5e2b500, 0xf2cad1c0, 0xcbb27c80, + 0xdc9a1840, 0xa9f74a41, 0xbedf2e81, 0x87a783c1, 0x908fe701, + 0xf556d941, 0xe27ebd81, 0xdb0610c1, 0xcc2e7401, 0x10b46c41, + 0x079c0881, 0x3ee4a5c1, 0x29ccc101, 0x4c15ff41, 0x5b3d9b81, + 0x624536c1, 0x756d5201, 0x889f92c3, 0x9fb7f603, 0xa6cf5b43, + 0xb1e73f83, 0xd43e01c3, 0xc3166503, 0xfa6ec843, 0xed46ac83, + 0x31dcb4c3, 0x26f4d003, 0x1f8c7d43, 0x08a41983, 0x6d7d27c3, + 0x7a554303, 0x432dee43, 0x54058a83, 0x2168d882, 0x3640bc42, + 0x0f381102, 0x181075c2, 0x7dc94b82, 0x6ae12f42, 0x53998202, + 0x44b1e6c2, 0x982bfe82, 0x8f039a42, 0xb67b3702, 0xa15353c2, + 0xc48a6d82, 0xd3a20942, 0xeadaa402, 0xfdf2c0c2, 0xca4e23c7, + 0xdd664707, 0xe41eea47, 0xf3368e87, 0x96efb0c7, 0x81c7d407, + 0xb8bf7947, 0xaf971d87, 0x730d05c7, 0x64256107, 0x5d5dcc47, + 0x4a75a887, 0x2fac96c7, 0x3884f207, 0x01fc5f47, 0x16d43b87, + 0x63b96986, 0x74910d46, 0x4de9a006, 0x5ac1c4c6, 0x3f18fa86, + 0x28309e46, 0x11483306, 0x066057c6, 0xdafa4f86, 0xcdd22b46, + 0xf4aa8606, 0xe382e2c6, 0x865bdc86, 0x9173b846, 0xa80b1506, + 0xbf2371c6, 0x42d1b104, 0x55f9d5c4, 0x6c817884, 0x7ba91c44, + 0x1e702204, 0x095846c4, 0x3020eb84, 0x27088f44, 0xfb929704, + 0xecbaf3c4, 0xd5c25e84, 0xc2ea3a44, 0xa7330404, 0xb01b60c4, + 0x8963cd84, 0x9e4ba944, 0xeb26fb45, 0xfc0e9f85, 0xc57632c5, + 0xd25e5605, 0xb7876845, 0xa0af0c85, 0x99d7a1c5, 0x8effc505, + 0x5265dd45, 0x454db985, 0x7c3514c5, 0x6b1d7005, 0x0ec44e45, + 0x19ec2a85, 0x209487c5, 0x37bce305, 0x4fed41cf, 0x58c5250f, + 0x61bd884f, 0x7695ec8f, 0x134cd2cf, 0x0464b60f, 0x3d1c1b4f, + 0x2a347f8f, 0xf6ae67cf, 0xe186030f, 0xd8feae4f, 0xcfd6ca8f, + 0xaa0ff4cf, 0xbd27900f, 0x845f3d4f, 0x9377598f, 0xe61a0b8e, + 0xf1326f4e, 0xc84ac20e, 0xdf62a6ce, 0xbabb988e, 0xad93fc4e, + 0x94eb510e, 0x83c335ce, 0x5f592d8e, 0x4871494e, 0x7109e40e, + 0x662180ce, 0x03f8be8e, 0x14d0da4e, 0x2da8770e, 0x3a8013ce, + 0xc772d30c, 0xd05ab7cc, 0xe9221a8c, 0xfe0a7e4c, 0x9bd3400c, + 0x8cfb24cc, 0xb583898c, 0xa2abed4c, 0x7e31f50c, 0x691991cc, + 0x50613c8c, 0x4749584c, 0x2290660c, 0x35b802cc, 0x0cc0af8c, + 0x1be8cb4c, 0x6e85994d, 0x79adfd8d, 0x40d550cd, 0x57fd340d, + 0x32240a4d, 0x250c6e8d, 0x1c74c3cd, 0x0b5ca70d, 0xd7c6bf4d, + 0xc0eedb8d, 0xf99676cd, 0xeebe120d, 0x8b672c4d, 0x9c4f488d, + 0xa537e5cd, 0xb21f810d, 0x85a36208, 0x928b06c8, 0xabf3ab88, + 0xbcdbcf48, 0xd902f108, 0xce2a95c8, 0xf7523888, 0xe07a5c48, + 0x3ce04408, 0x2bc820c8, 0x12b08d88, 0x0598e948, 0x6041d708, + 0x7769b3c8, 0x4e111e88, 0x59397a48, 0x2c542849, 0x3b7c4c89, + 0x0204e1c9, 0x152c8509, 0x70f5bb49, 0x67dddf89, 0x5ea572c9, + 0x498d1609, 0x95170e49, 0x823f6a89, 0xbb47c7c9, 0xac6fa309, + 0xc9b69d49, 0xde9ef989, 0xe7e654c9, 0xf0ce3009, 0x0d3cf0cb, + 0x1a14940b, 0x236c394b, 0x34445d8b, 0x519d63cb, 0x46b5070b, + 0x7fcdaa4b, 0x68e5ce8b, 0xb47fd6cb, 0xa357b20b, 0x9a2f1f4b, + 0x8d077b8b, 0xe8de45cb, 0xfff6210b, 0xc68e8c4b, 0xd1a6e88b, + 0xa4cbba8a, 0xb3e3de4a, 0x8a9b730a, 0x9db317ca, 0xf86a298a, + 0xef424d4a, 0xd63ae00a, 0xc11284ca, 0x1d889c8a, 0x0aa0f84a, + 0x33d8550a, 0x24f031ca, 0x41290f8a, 0x56016b4a, 0x6f79c60a, + 0x7851a2ca}, + {0x00000000, 0x9fda839e, 0xe4c4017d, 0x7b1e82e3, 0x12f904bb, + 0x8d238725, 0xf63d05c6, 0x69e78658, 0x25f20976, 0xba288ae8, + 0xc136080b, 0x5eec8b95, 0x370b0dcd, 0xa8d18e53, 0xd3cf0cb0, + 0x4c158f2e, 0x4be412ec, 0xd43e9172, 0xaf201391, 0x30fa900f, + 0x591d1657, 0xc6c795c9, 0xbdd9172a, 0x220394b4, 0x6e161b9a, + 0xf1cc9804, 0x8ad21ae7, 0x15089979, 0x7cef1f21, 0xe3359cbf, + 0x982b1e5c, 0x07f19dc2, 0x97c825d8, 0x0812a646, 0x730c24a5, + 0xecd6a73b, 0x85312163, 0x1aeba2fd, 0x61f5201e, 0xfe2fa380, + 0xb23a2cae, 0x2de0af30, 0x56fe2dd3, 0xc924ae4d, 0xa0c32815, + 0x3f19ab8b, 0x44072968, 0xdbddaaf6, 0xdc2c3734, 0x43f6b4aa, + 0x38e83649, 0xa732b5d7, 0xced5338f, 0x510fb011, 0x2a1132f2, + 0xb5cbb16c, 0xf9de3e42, 0x6604bddc, 0x1d1a3f3f, 0x82c0bca1, + 0xeb273af9, 0x74fdb967, 0x0fe33b84, 0x9039b81a, 0xf4e14df1, + 0x6b3bce6f, 0x10254c8c, 0x8fffcf12, 0xe618494a, 0x79c2cad4, + 0x02dc4837, 0x9d06cba9, 0xd1134487, 0x4ec9c719, 0x35d745fa, + 0xaa0dc664, 0xc3ea403c, 0x5c30c3a2, 0x272e4141, 0xb8f4c2df, + 0xbf055f1d, 0x20dfdc83, 0x5bc15e60, 0xc41bddfe, 0xadfc5ba6, + 0x3226d838, 0x49385adb, 0xd6e2d945, 0x9af7566b, 0x052dd5f5, + 0x7e335716, 0xe1e9d488, 0x880e52d0, 0x17d4d14e, 0x6cca53ad, + 0xf310d033, 0x63296829, 0xfcf3ebb7, 0x87ed6954, 0x1837eaca, + 0x71d06c92, 0xee0aef0c, 0x95146def, 0x0aceee71, 0x46db615f, + 0xd901e2c1, 0xa21f6022, 0x3dc5e3bc, 0x542265e4, 0xcbf8e67a, + 0xb0e66499, 0x2f3ce707, 0x28cd7ac5, 0xb717f95b, 0xcc097bb8, + 0x53d3f826, 0x3a347e7e, 0xa5eefde0, 0xdef07f03, 0x412afc9d, + 0x0d3f73b3, 0x92e5f02d, 0xe9fb72ce, 0x7621f150, 0x1fc67708, + 0x801cf496, 0xfb027675, 0x64d8f5eb, 0x32b39da3, 0xad691e3d, + 0xd6779cde, 0x49ad1f40, 0x204a9918, 0xbf901a86, 0xc48e9865, + 0x5b541bfb, 0x174194d5, 0x889b174b, 0xf38595a8, 0x6c5f1636, + 0x05b8906e, 0x9a6213f0, 0xe17c9113, 0x7ea6128d, 0x79578f4f, + 0xe68d0cd1, 0x9d938e32, 0x02490dac, 0x6bae8bf4, 0xf474086a, + 0x8f6a8a89, 0x10b00917, 0x5ca58639, 0xc37f05a7, 0xb8618744, + 0x27bb04da, 0x4e5c8282, 0xd186011c, 0xaa9883ff, 0x35420061, + 0xa57bb87b, 0x3aa13be5, 0x41bfb906, 0xde653a98, 0xb782bcc0, + 0x28583f5e, 0x5346bdbd, 0xcc9c3e23, 0x8089b10d, 0x1f533293, + 0x644db070, 0xfb9733ee, 0x9270b5b6, 0x0daa3628, 0x76b4b4cb, + 0xe96e3755, 0xee9faa97, 0x71452909, 0x0a5babea, 0x95812874, + 0xfc66ae2c, 0x63bc2db2, 0x18a2af51, 0x87782ccf, 0xcb6da3e1, + 0x54b7207f, 0x2fa9a29c, 0xb0732102, 0xd994a75a, 0x464e24c4, + 0x3d50a627, 0xa28a25b9, 0xc652d052, 0x598853cc, 0x2296d12f, + 0xbd4c52b1, 0xd4abd4e9, 0x4b715777, 0x306fd594, 0xafb5560a, + 0xe3a0d924, 0x7c7a5aba, 0x0764d859, 0x98be5bc7, 0xf159dd9f, + 0x6e835e01, 0x159ddce2, 0x8a475f7c, 0x8db6c2be, 0x126c4120, + 0x6972c3c3, 0xf6a8405d, 0x9f4fc605, 0x0095459b, 0x7b8bc778, + 0xe45144e6, 0xa844cbc8, 0x379e4856, 0x4c80cab5, 0xd35a492b, + 0xbabdcf73, 0x25674ced, 0x5e79ce0e, 0xc1a34d90, 0x519af58a, + 0xce407614, 0xb55ef4f7, 0x2a847769, 0x4363f131, 0xdcb972af, + 0xa7a7f04c, 0x387d73d2, 0x7468fcfc, 0xebb27f62, 0x90acfd81, + 0x0f767e1f, 0x6691f847, 0xf94b7bd9, 0x8255f93a, 0x1d8f7aa4, + 0x1a7ee766, 0x85a464f8, 0xfebae61b, 0x61606585, 0x0887e3dd, + 0x975d6043, 0xec43e2a0, 0x7399613e, 0x3f8cee10, 0xa0566d8e, + 0xdb48ef6d, 0x44926cf3, 0x2d75eaab, 0xb2af6935, 0xc9b1ebd6, + 0x566b6848}, + {0x00000000, 0x65673b46, 0xcace768c, 0xafa94dca, 0x4eedeb59, + 0x2b8ad01f, 0x84239dd5, 0xe144a693, 0x9ddbd6b2, 0xf8bcedf4, + 0x5715a03e, 0x32729b78, 0xd3363deb, 0xb65106ad, 0x19f84b67, + 0x7c9f7021, 0xe0c6ab25, 0x85a19063, 0x2a08dda9, 0x4f6fe6ef, + 0xae2b407c, 0xcb4c7b3a, 0x64e536f0, 0x01820db6, 0x7d1d7d97, + 0x187a46d1, 0xb7d30b1b, 0xd2b4305d, 0x33f096ce, 0x5697ad88, + 0xf93ee042, 0x9c59db04, 0x1afc500b, 0x7f9b6b4d, 0xd0322687, + 0xb5551dc1, 0x5411bb52, 0x31768014, 0x9edfcdde, 0xfbb8f698, + 0x872786b9, 0xe240bdff, 0x4de9f035, 0x288ecb73, 0xc9ca6de0, + 0xacad56a6, 0x03041b6c, 0x6663202a, 0xfa3afb2e, 0x9f5dc068, + 0x30f48da2, 0x5593b6e4, 0xb4d71077, 0xd1b02b31, 0x7e1966fb, + 0x1b7e5dbd, 0x67e12d9c, 0x028616da, 0xad2f5b10, 0xc8486056, + 0x290cc6c5, 0x4c6bfd83, 0xe3c2b049, 0x86a58b0f, 0x35f8a016, + 0x509f9b50, 0xff36d69a, 0x9a51eddc, 0x7b154b4f, 0x1e727009, + 0xb1db3dc3, 0xd4bc0685, 0xa82376a4, 0xcd444de2, 0x62ed0028, + 0x078a3b6e, 0xe6ce9dfd, 0x83a9a6bb, 0x2c00eb71, 0x4967d037, + 0xd53e0b33, 0xb0593075, 0x1ff07dbf, 0x7a9746f9, 0x9bd3e06a, + 0xfeb4db2c, 0x511d96e6, 0x347aada0, 0x48e5dd81, 0x2d82e6c7, + 0x822bab0d, 0xe74c904b, 0x060836d8, 0x636f0d9e, 0xccc64054, + 0xa9a17b12, 0x2f04f01d, 0x4a63cb5b, 0xe5ca8691, 0x80adbdd7, + 0x61e91b44, 0x048e2002, 0xab276dc8, 0xce40568e, 0xb2df26af, + 0xd7b81de9, 0x78115023, 0x1d766b65, 0xfc32cdf6, 0x9955f6b0, + 0x36fcbb7a, 0x539b803c, 0xcfc25b38, 0xaaa5607e, 0x050c2db4, + 0x606b16f2, 0x812fb061, 0xe4488b27, 0x4be1c6ed, 0x2e86fdab, + 0x52198d8a, 0x377eb6cc, 0x98d7fb06, 0xfdb0c040, 0x1cf466d3, + 0x79935d95, 0xd63a105f, 0xb35d2b19, 0x6bf1402c, 0x0e967b6a, + 0xa13f36a0, 0xc4580de6, 0x251cab75, 0x407b9033, 0xefd2ddf9, + 0x8ab5e6bf, 0xf62a969e, 0x934dadd8, 0x3ce4e012, 0x5983db54, + 0xb8c77dc7, 0xdda04681, 0x72090b4b, 0x176e300d, 0x8b37eb09, + 0xee50d04f, 0x41f99d85, 0x249ea6c3, 0xc5da0050, 0xa0bd3b16, + 0x0f1476dc, 0x6a734d9a, 0x16ec3dbb, 0x738b06fd, 0xdc224b37, + 0xb9457071, 0x5801d6e2, 0x3d66eda4, 0x92cfa06e, 0xf7a89b28, + 0x710d1027, 0x146a2b61, 0xbbc366ab, 0xdea45ded, 0x3fe0fb7e, + 0x5a87c038, 0xf52e8df2, 0x9049b6b4, 0xecd6c695, 0x89b1fdd3, + 0x2618b019, 0x437f8b5f, 0xa23b2dcc, 0xc75c168a, 0x68f55b40, + 0x0d926006, 0x91cbbb02, 0xf4ac8044, 0x5b05cd8e, 0x3e62f6c8, + 0xdf26505b, 0xba416b1d, 0x15e826d7, 0x708f1d91, 0x0c106db0, + 0x697756f6, 0xc6de1b3c, 0xa3b9207a, 0x42fd86e9, 0x279abdaf, + 0x8833f065, 0xed54cb23, 0x5e09e03a, 0x3b6edb7c, 0x94c796b6, + 0xf1a0adf0, 0x10e40b63, 0x75833025, 0xda2a7def, 0xbf4d46a9, + 0xc3d23688, 0xa6b50dce, 0x091c4004, 0x6c7b7b42, 0x8d3fddd1, + 0xe858e697, 0x47f1ab5d, 0x2296901b, 0xbecf4b1f, 0xdba87059, + 0x74013d93, 0x116606d5, 0xf022a046, 0x95459b00, 0x3aecd6ca, + 0x5f8bed8c, 0x23149dad, 0x4673a6eb, 0xe9daeb21, 0x8cbdd067, + 0x6df976f4, 0x089e4db2, 0xa7370078, 0xc2503b3e, 0x44f5b031, + 0x21928b77, 0x8e3bc6bd, 0xeb5cfdfb, 0x0a185b68, 0x6f7f602e, + 0xc0d62de4, 0xa5b116a2, 0xd92e6683, 0xbc495dc5, 0x13e0100f, + 0x76872b49, 0x97c38dda, 0xf2a4b69c, 0x5d0dfb56, 0x386ac010, + 0xa4331b14, 0xc1542052, 0x6efd6d98, 0x0b9a56de, 0xeadef04d, + 0x8fb9cb0b, 0x201086c1, 0x4577bd87, 0x39e8cda6, 0x5c8ff6e0, + 0xf326bb2a, 0x9641806c, 0x770526ff, 0x12621db9, 0xbdcb5073, + 0xd8ac6b35}, + {0x00000000, 0xd7e28058, 0x74b406f1, 0xa35686a9, 0xe9680de2, + 0x3e8a8dba, 0x9ddc0b13, 0x4a3e8b4b, 0x09a11d85, 0xde439ddd, + 0x7d151b74, 0xaaf79b2c, 0xe0c91067, 0x372b903f, 0x947d1696, + 0x439f96ce, 0x13423b0a, 0xc4a0bb52, 0x67f63dfb, 0xb014bda3, + 0xfa2a36e8, 0x2dc8b6b0, 0x8e9e3019, 0x597cb041, 0x1ae3268f, + 0xcd01a6d7, 0x6e57207e, 0xb9b5a026, 0xf38b2b6d, 0x2469ab35, + 0x873f2d9c, 0x50ddadc4, 0x26847614, 0xf166f64c, 0x523070e5, + 0x85d2f0bd, 0xcfec7bf6, 0x180efbae, 0xbb587d07, 0x6cbafd5f, + 0x2f256b91, 0xf8c7ebc9, 0x5b916d60, 0x8c73ed38, 0xc64d6673, + 0x11afe62b, 0xb2f96082, 0x651be0da, 0x35c64d1e, 0xe224cd46, + 0x41724bef, 0x9690cbb7, 0xdcae40fc, 0x0b4cc0a4, 0xa81a460d, + 0x7ff8c655, 0x3c67509b, 0xeb85d0c3, 0x48d3566a, 0x9f31d632, + 0xd50f5d79, 0x02eddd21, 0xa1bb5b88, 0x7659dbd0, 0x4d08ec28, + 0x9aea6c70, 0x39bcead9, 0xee5e6a81, 0xa460e1ca, 0x73826192, + 0xd0d4e73b, 0x07366763, 0x44a9f1ad, 0x934b71f5, 0x301df75c, + 0xe7ff7704, 0xadc1fc4f, 0x7a237c17, 0xd975fabe, 0x0e977ae6, + 0x5e4ad722, 0x89a8577a, 0x2afed1d3, 0xfd1c518b, 0xb722dac0, + 0x60c05a98, 0xc396dc31, 0x14745c69, 0x57ebcaa7, 0x80094aff, + 0x235fcc56, 0xf4bd4c0e, 0xbe83c745, 0x6961471d, 0xca37c1b4, + 0x1dd541ec, 0x6b8c9a3c, 0xbc6e1a64, 0x1f389ccd, 0xc8da1c95, + 0x82e497de, 0x55061786, 0xf650912f, 0x21b21177, 0x622d87b9, + 0xb5cf07e1, 0x16998148, 0xc17b0110, 0x8b458a5b, 0x5ca70a03, + 0xfff18caa, 0x28130cf2, 0x78cea136, 0xaf2c216e, 0x0c7aa7c7, + 0xdb98279f, 0x91a6acd4, 0x46442c8c, 0xe512aa25, 0x32f02a7d, + 0x716fbcb3, 0xa68d3ceb, 0x05dbba42, 0xd2393a1a, 0x9807b151, + 0x4fe53109, 0xecb3b7a0, 0x3b5137f8, 0x9a11d850, 0x4df35808, + 0xeea5dea1, 0x39475ef9, 0x7379d5b2, 0xa49b55ea, 0x07cdd343, + 0xd02f531b, 0x93b0c5d5, 0x4452458d, 0xe704c324, 0x30e6437c, + 0x7ad8c837, 0xad3a486f, 0x0e6ccec6, 0xd98e4e9e, 0x8953e35a, + 0x5eb16302, 0xfde7e5ab, 0x2a0565f3, 0x603beeb8, 0xb7d96ee0, + 0x148fe849, 0xc36d6811, 0x80f2fedf, 0x57107e87, 0xf446f82e, + 0x23a47876, 0x699af33d, 0xbe787365, 0x1d2ef5cc, 0xcacc7594, + 0xbc95ae44, 0x6b772e1c, 0xc821a8b5, 0x1fc328ed, 0x55fda3a6, + 0x821f23fe, 0x2149a557, 0xf6ab250f, 0xb534b3c1, 0x62d63399, + 0xc180b530, 0x16623568, 0x5c5cbe23, 0x8bbe3e7b, 0x28e8b8d2, + 0xff0a388a, 0xafd7954e, 0x78351516, 0xdb6393bf, 0x0c8113e7, + 0x46bf98ac, 0x915d18f4, 0x320b9e5d, 0xe5e91e05, 0xa67688cb, + 0x71940893, 0xd2c28e3a, 0x05200e62, 0x4f1e8529, 0x98fc0571, + 0x3baa83d8, 0xec480380, 0xd7193478, 0x00fbb420, 0xa3ad3289, + 0x744fb2d1, 0x3e71399a, 0xe993b9c2, 0x4ac53f6b, 0x9d27bf33, + 0xdeb829fd, 0x095aa9a5, 0xaa0c2f0c, 0x7deeaf54, 0x37d0241f, + 0xe032a447, 0x436422ee, 0x9486a2b6, 0xc45b0f72, 0x13b98f2a, + 0xb0ef0983, 0x670d89db, 0x2d330290, 0xfad182c8, 0x59870461, + 0x8e658439, 0xcdfa12f7, 0x1a1892af, 0xb94e1406, 0x6eac945e, + 0x24921f15, 0xf3709f4d, 0x502619e4, 0x87c499bc, 0xf19d426c, + 0x267fc234, 0x8529449d, 0x52cbc4c5, 0x18f54f8e, 0xcf17cfd6, + 0x6c41497f, 0xbba3c927, 0xf83c5fe9, 0x2fdedfb1, 0x8c885918, + 0x5b6ad940, 0x1154520b, 0xc6b6d253, 0x65e054fa, 0xb202d4a2, + 0xe2df7966, 0x353df93e, 0x966b7f97, 0x4189ffcf, 0x0bb77484, + 0xdc55f4dc, 0x7f037275, 0xa8e1f22d, 0xeb7e64e3, 0x3c9ce4bb, + 0x9fca6212, 0x4828e24a, 0x02166901, 0xd5f4e959, 0x76a26ff0, + 0xa140efa8}, + {0x00000000, 0xef52b6e1, 0x05d46b83, 0xea86dd62, 0x0ba8d706, + 0xe4fa61e7, 0x0e7cbc85, 0xe12e0a64, 0x1751ae0c, 0xf80318ed, + 0x1285c58f, 0xfdd7736e, 0x1cf9790a, 0xf3abcfeb, 0x192d1289, + 0xf67fa468, 0x2ea35c18, 0xc1f1eaf9, 0x2b77379b, 0xc425817a, + 0x250b8b1e, 0xca593dff, 0x20dfe09d, 0xcf8d567c, 0x39f2f214, + 0xd6a044f5, 0x3c269997, 0xd3742f76, 0x325a2512, 0xdd0893f3, + 0x378e4e91, 0xd8dcf870, 0x5d46b830, 0xb2140ed1, 0x5892d3b3, + 0xb7c06552, 0x56ee6f36, 0xb9bcd9d7, 0x533a04b5, 0xbc68b254, + 0x4a17163c, 0xa545a0dd, 0x4fc37dbf, 0xa091cb5e, 0x41bfc13a, + 0xaeed77db, 0x446baab9, 0xab391c58, 0x73e5e428, 0x9cb752c9, + 0x76318fab, 0x9963394a, 0x784d332e, 0x971f85cf, 0x7d9958ad, + 0x92cbee4c, 0x64b44a24, 0x8be6fcc5, 0x616021a7, 0x8e329746, + 0x6f1c9d22, 0x804e2bc3, 0x6ac8f6a1, 0x859a4040, 0xba8d7060, + 0x55dfc681, 0xbf591be3, 0x500bad02, 0xb125a766, 0x5e771187, + 0xb4f1cce5, 0x5ba37a04, 0xaddcde6c, 0x428e688d, 0xa808b5ef, + 0x475a030e, 0xa674096a, 0x4926bf8b, 0xa3a062e9, 0x4cf2d408, + 0x942e2c78, 0x7b7c9a99, 0x91fa47fb, 0x7ea8f11a, 0x9f86fb7e, + 0x70d44d9f, 0x9a5290fd, 0x7500261c, 0x837f8274, 0x6c2d3495, + 0x86abe9f7, 0x69f95f16, 0x88d75572, 0x6785e393, 0x8d033ef1, + 0x62518810, 0xe7cbc850, 0x08997eb1, 0xe21fa3d3, 0x0d4d1532, + 0xec631f56, 0x0331a9b7, 0xe9b774d5, 0x06e5c234, 0xf09a665c, + 0x1fc8d0bd, 0xf54e0ddf, 0x1a1cbb3e, 0xfb32b15a, 0x146007bb, + 0xfee6dad9, 0x11b46c38, 0xc9689448, 0x263a22a9, 0xccbcffcb, + 0x23ee492a, 0xc2c0434e, 0x2d92f5af, 0xc71428cd, 0x28469e2c, + 0xde393a44, 0x316b8ca5, 0xdbed51c7, 0x34bfe726, 0xd591ed42, + 0x3ac35ba3, 0xd04586c1, 0x3f173020, 0xae6be681, 0x41395060, + 0xabbf8d02, 0x44ed3be3, 0xa5c33187, 0x4a918766, 0xa0175a04, + 0x4f45ece5, 0xb93a488d, 0x5668fe6c, 0xbcee230e, 0x53bc95ef, + 0xb2929f8b, 0x5dc0296a, 0xb746f408, 0x581442e9, 0x80c8ba99, + 0x6f9a0c78, 0x851cd11a, 0x6a4e67fb, 0x8b606d9f, 0x6432db7e, + 0x8eb4061c, 0x61e6b0fd, 0x97991495, 0x78cba274, 0x924d7f16, + 0x7d1fc9f7, 0x9c31c393, 0x73637572, 0x99e5a810, 0x76b71ef1, + 0xf32d5eb1, 0x1c7fe850, 0xf6f93532, 0x19ab83d3, 0xf88589b7, + 0x17d73f56, 0xfd51e234, 0x120354d5, 0xe47cf0bd, 0x0b2e465c, + 0xe1a89b3e, 0x0efa2ddf, 0xefd427bb, 0x0086915a, 0xea004c38, + 0x0552fad9, 0xdd8e02a9, 0x32dcb448, 0xd85a692a, 0x3708dfcb, + 0xd626d5af, 0x3974634e, 0xd3f2be2c, 0x3ca008cd, 0xcadfaca5, + 0x258d1a44, 0xcf0bc726, 0x205971c7, 0xc1777ba3, 0x2e25cd42, + 0xc4a31020, 0x2bf1a6c1, 0x14e696e1, 0xfbb42000, 0x1132fd62, + 0xfe604b83, 0x1f4e41e7, 0xf01cf706, 0x1a9a2a64, 0xf5c89c85, + 0x03b738ed, 0xece58e0c, 0x0663536e, 0xe931e58f, 0x081fefeb, + 0xe74d590a, 0x0dcb8468, 0xe2993289, 0x3a45caf9, 0xd5177c18, + 0x3f91a17a, 0xd0c3179b, 0x31ed1dff, 0xdebfab1e, 0x3439767c, + 0xdb6bc09d, 0x2d1464f5, 0xc246d214, 0x28c00f76, 0xc792b997, + 0x26bcb3f3, 0xc9ee0512, 0x2368d870, 0xcc3a6e91, 0x49a02ed1, + 0xa6f29830, 0x4c744552, 0xa326f3b3, 0x4208f9d7, 0xad5a4f36, + 0x47dc9254, 0xa88e24b5, 0x5ef180dd, 0xb1a3363c, 0x5b25eb5e, + 0xb4775dbf, 0x555957db, 0xba0be13a, 0x508d3c58, 0xbfdf8ab9, + 0x670372c9, 0x8851c428, 0x62d7194a, 0x8d85afab, 0x6caba5cf, + 0x83f9132e, 0x697fce4c, 0x862d78ad, 0x7052dcc5, 0x9f006a24, + 0x7586b746, 0x9ad401a7, 0x7bfa0bc3, 0x94a8bd22, 0x7e2e6040, + 0x917cd6a1}, + {0x00000000, 0x87a6cb43, 0xd43c90c7, 0x539a5b84, 0x730827cf, + 0xf4aeec8c, 0xa734b708, 0x20927c4b, 0xe6104f9e, 0x61b684dd, + 0x322cdf59, 0xb58a141a, 0x95186851, 0x12bea312, 0x4124f896, + 0xc68233d5, 0x1751997d, 0x90f7523e, 0xc36d09ba, 0x44cbc2f9, + 0x6459beb2, 0xe3ff75f1, 0xb0652e75, 0x37c3e536, 0xf141d6e3, + 0x76e71da0, 0x257d4624, 0xa2db8d67, 0x8249f12c, 0x05ef3a6f, + 0x567561eb, 0xd1d3aaa8, 0x2ea332fa, 0xa905f9b9, 0xfa9fa23d, + 0x7d39697e, 0x5dab1535, 0xda0dde76, 0x899785f2, 0x0e314eb1, + 0xc8b37d64, 0x4f15b627, 0x1c8feda3, 0x9b2926e0, 0xbbbb5aab, + 0x3c1d91e8, 0x6f87ca6c, 0xe821012f, 0x39f2ab87, 0xbe5460c4, + 0xedce3b40, 0x6a68f003, 0x4afa8c48, 0xcd5c470b, 0x9ec61c8f, + 0x1960d7cc, 0xdfe2e419, 0x58442f5a, 0x0bde74de, 0x8c78bf9d, + 0xaceac3d6, 0x2b4c0895, 0x78d65311, 0xff709852, 0x5d4665f4, + 0xdae0aeb7, 0x897af533, 0x0edc3e70, 0x2e4e423b, 0xa9e88978, + 0xfa72d2fc, 0x7dd419bf, 0xbb562a6a, 0x3cf0e129, 0x6f6abaad, + 0xe8cc71ee, 0xc85e0da5, 0x4ff8c6e6, 0x1c629d62, 0x9bc45621, + 0x4a17fc89, 0xcdb137ca, 0x9e2b6c4e, 0x198da70d, 0x391fdb46, + 0xbeb91005, 0xed234b81, 0x6a8580c2, 0xac07b317, 0x2ba17854, + 0x783b23d0, 0xff9de893, 0xdf0f94d8, 0x58a95f9b, 0x0b33041f, + 0x8c95cf5c, 0x73e5570e, 0xf4439c4d, 0xa7d9c7c9, 0x207f0c8a, + 0x00ed70c1, 0x874bbb82, 0xd4d1e006, 0x53772b45, 0x95f51890, + 0x1253d3d3, 0x41c98857, 0xc66f4314, 0xe6fd3f5f, 0x615bf41c, + 0x32c1af98, 0xb56764db, 0x64b4ce73, 0xe3120530, 0xb0885eb4, + 0x372e95f7, 0x17bce9bc, 0x901a22ff, 0xc380797b, 0x4426b238, + 0x82a481ed, 0x05024aae, 0x5698112a, 0xd13eda69, 0xf1aca622, + 0x760a6d61, 0x259036e5, 0xa236fda6, 0xba8ccbe8, 0x3d2a00ab, + 0x6eb05b2f, 0xe916906c, 0xc984ec27, 0x4e222764, 0x1db87ce0, + 0x9a1eb7a3, 0x5c9c8476, 0xdb3a4f35, 0x88a014b1, 0x0f06dff2, + 0x2f94a3b9, 0xa83268fa, 0xfba8337e, 0x7c0ef83d, 0xaddd5295, + 0x2a7b99d6, 0x79e1c252, 0xfe470911, 0xded5755a, 0x5973be19, + 0x0ae9e59d, 0x8d4f2ede, 0x4bcd1d0b, 0xcc6bd648, 0x9ff18dcc, + 0x1857468f, 0x38c53ac4, 0xbf63f187, 0xecf9aa03, 0x6b5f6140, + 0x942ff912, 0x13893251, 0x401369d5, 0xc7b5a296, 0xe727dedd, + 0x6081159e, 0x331b4e1a, 0xb4bd8559, 0x723fb68c, 0xf5997dcf, + 0xa603264b, 0x21a5ed08, 0x01379143, 0x86915a00, 0xd50b0184, + 0x52adcac7, 0x837e606f, 0x04d8ab2c, 0x5742f0a8, 0xd0e43beb, + 0xf07647a0, 0x77d08ce3, 0x244ad767, 0xa3ec1c24, 0x656e2ff1, + 0xe2c8e4b2, 0xb152bf36, 0x36f47475, 0x1666083e, 0x91c0c37d, + 0xc25a98f9, 0x45fc53ba, 0xe7caae1c, 0x606c655f, 0x33f63edb, + 0xb450f598, 0x94c289d3, 0x13644290, 0x40fe1914, 0xc758d257, + 0x01dae182, 0x867c2ac1, 0xd5e67145, 0x5240ba06, 0x72d2c64d, + 0xf5740d0e, 0xa6ee568a, 0x21489dc9, 0xf09b3761, 0x773dfc22, + 0x24a7a7a6, 0xa3016ce5, 0x839310ae, 0x0435dbed, 0x57af8069, + 0xd0094b2a, 0x168b78ff, 0x912db3bc, 0xc2b7e838, 0x4511237b, + 0x65835f30, 0xe2259473, 0xb1bfcff7, 0x361904b4, 0xc9699ce6, + 0x4ecf57a5, 0x1d550c21, 0x9af3c762, 0xba61bb29, 0x3dc7706a, + 0x6e5d2bee, 0xe9fbe0ad, 0x2f79d378, 0xa8df183b, 0xfb4543bf, + 0x7ce388fc, 0x5c71f4b7, 0xdbd73ff4, 0x884d6470, 0x0febaf33, + 0xde38059b, 0x599eced8, 0x0a04955c, 0x8da25e1f, 0xad302254, + 0x2a96e917, 0x790cb293, 0xfeaa79d0, 0x38284a05, 0xbf8e8146, + 0xec14dac2, 0x6bb21181, 0x4b206dca, 0xcc86a689, 0x9f1cfd0d, + 0x18ba364e}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x43cba68700000000, 0xc7903cd400000000, + 0x845b9a5300000000, 0xcf27087300000000, 0x8cecaef400000000, + 0x08b734a700000000, 0x4b7c922000000000, 0x9e4f10e600000000, + 0xdd84b66100000000, 0x59df2c3200000000, 0x1a148ab500000000, + 0x5168189500000000, 0x12a3be1200000000, 0x96f8244100000000, + 0xd53382c600000000, 0x7d99511700000000, 0x3e52f79000000000, + 0xba096dc300000000, 0xf9c2cb4400000000, 0xb2be596400000000, + 0xf175ffe300000000, 0x752e65b000000000, 0x36e5c33700000000, + 0xe3d641f100000000, 0xa01de77600000000, 0x24467d2500000000, + 0x678ddba200000000, 0x2cf1498200000000, 0x6f3aef0500000000, + 0xeb61755600000000, 0xa8aad3d100000000, 0xfa32a32e00000000, + 0xb9f905a900000000, 0x3da29ffa00000000, 0x7e69397d00000000, + 0x3515ab5d00000000, 0x76de0dda00000000, 0xf285978900000000, + 0xb14e310e00000000, 0x647db3c800000000, 0x27b6154f00000000, + 0xa3ed8f1c00000000, 0xe026299b00000000, 0xab5abbbb00000000, + 0xe8911d3c00000000, 0x6cca876f00000000, 0x2f0121e800000000, + 0x87abf23900000000, 0xc46054be00000000, 0x403bceed00000000, + 0x03f0686a00000000, 0x488cfa4a00000000, 0x0b475ccd00000000, + 0x8f1cc69e00000000, 0xccd7601900000000, 0x19e4e2df00000000, + 0x5a2f445800000000, 0xde74de0b00000000, 0x9dbf788c00000000, + 0xd6c3eaac00000000, 0x95084c2b00000000, 0x1153d67800000000, + 0x529870ff00000000, 0xf465465d00000000, 0xb7aee0da00000000, + 0x33f57a8900000000, 0x703edc0e00000000, 0x3b424e2e00000000, + 0x7889e8a900000000, 0xfcd272fa00000000, 0xbf19d47d00000000, + 0x6a2a56bb00000000, 0x29e1f03c00000000, 0xadba6a6f00000000, + 0xee71cce800000000, 0xa50d5ec800000000, 0xe6c6f84f00000000, + 0x629d621c00000000, 0x2156c49b00000000, 0x89fc174a00000000, + 0xca37b1cd00000000, 0x4e6c2b9e00000000, 0x0da78d1900000000, + 0x46db1f3900000000, 0x0510b9be00000000, 0x814b23ed00000000, + 0xc280856a00000000, 0x17b307ac00000000, 0x5478a12b00000000, + 0xd0233b7800000000, 0x93e89dff00000000, 0xd8940fdf00000000, + 0x9b5fa95800000000, 0x1f04330b00000000, 0x5ccf958c00000000, + 0x0e57e57300000000, 0x4d9c43f400000000, 0xc9c7d9a700000000, + 0x8a0c7f2000000000, 0xc170ed0000000000, 0x82bb4b8700000000, + 0x06e0d1d400000000, 0x452b775300000000, 0x9018f59500000000, + 0xd3d3531200000000, 0x5788c94100000000, 0x14436fc600000000, + 0x5f3ffde600000000, 0x1cf45b6100000000, 0x98afc13200000000, + 0xdb6467b500000000, 0x73ceb46400000000, 0x300512e300000000, + 0xb45e88b000000000, 0xf7952e3700000000, 0xbce9bc1700000000, + 0xff221a9000000000, 0x7b7980c300000000, 0x38b2264400000000, + 0xed81a48200000000, 0xae4a020500000000, 0x2a11985600000000, + 0x69da3ed100000000, 0x22a6acf100000000, 0x616d0a7600000000, + 0xe536902500000000, 0xa6fd36a200000000, 0xe8cb8cba00000000, + 0xab002a3d00000000, 0x2f5bb06e00000000, 0x6c9016e900000000, + 0x27ec84c900000000, 0x6427224e00000000, 0xe07cb81d00000000, + 0xa3b71e9a00000000, 0x76849c5c00000000, 0x354f3adb00000000, + 0xb114a08800000000, 0xf2df060f00000000, 0xb9a3942f00000000, + 0xfa6832a800000000, 0x7e33a8fb00000000, 0x3df80e7c00000000, + 0x9552ddad00000000, 0xd6997b2a00000000, 0x52c2e17900000000, + 0x110947fe00000000, 0x5a75d5de00000000, 0x19be735900000000, + 0x9de5e90a00000000, 0xde2e4f8d00000000, 0x0b1dcd4b00000000, + 0x48d66bcc00000000, 0xcc8df19f00000000, 0x8f46571800000000, + 0xc43ac53800000000, 0x87f163bf00000000, 0x03aaf9ec00000000, + 0x40615f6b00000000, 0x12f92f9400000000, 0x5132891300000000, + 0xd569134000000000, 0x96a2b5c700000000, 0xddde27e700000000, + 0x9e15816000000000, 0x1a4e1b3300000000, 0x5985bdb400000000, + 0x8cb63f7200000000, 0xcf7d99f500000000, 0x4b2603a600000000, + 0x08eda52100000000, 0x4391370100000000, 0x005a918600000000, + 0x84010bd500000000, 0xc7caad5200000000, 0x6f607e8300000000, + 0x2cabd80400000000, 0xa8f0425700000000, 0xeb3be4d000000000, + 0xa04776f000000000, 0xe38cd07700000000, 0x67d74a2400000000, + 0x241ceca300000000, 0xf12f6e6500000000, 0xb2e4c8e200000000, + 0x36bf52b100000000, 0x7574f43600000000, 0x3e08661600000000, + 0x7dc3c09100000000, 0xf9985ac200000000, 0xba53fc4500000000, + 0x1caecae700000000, 0x5f656c6000000000, 0xdb3ef63300000000, + 0x98f550b400000000, 0xd389c29400000000, 0x9042641300000000, + 0x1419fe4000000000, 0x57d258c700000000, 0x82e1da0100000000, + 0xc12a7c8600000000, 0x4571e6d500000000, 0x06ba405200000000, + 0x4dc6d27200000000, 0x0e0d74f500000000, 0x8a56eea600000000, + 0xc99d482100000000, 0x61379bf000000000, 0x22fc3d7700000000, + 0xa6a7a72400000000, 0xe56c01a300000000, 0xae10938300000000, + 0xeddb350400000000, 0x6980af5700000000, 0x2a4b09d000000000, + 0xff788b1600000000, 0xbcb32d9100000000, 0x38e8b7c200000000, + 0x7b23114500000000, 0x305f836500000000, 0x739425e200000000, + 0xf7cfbfb100000000, 0xb404193600000000, 0xe69c69c900000000, + 0xa557cf4e00000000, 0x210c551d00000000, 0x62c7f39a00000000, + 0x29bb61ba00000000, 0x6a70c73d00000000, 0xee2b5d6e00000000, + 0xade0fbe900000000, 0x78d3792f00000000, 0x3b18dfa800000000, + 0xbf4345fb00000000, 0xfc88e37c00000000, 0xb7f4715c00000000, + 0xf43fd7db00000000, 0x70644d8800000000, 0x33afeb0f00000000, + 0x9b0538de00000000, 0xd8ce9e5900000000, 0x5c95040a00000000, + 0x1f5ea28d00000000, 0x542230ad00000000, 0x17e9962a00000000, + 0x93b20c7900000000, 0xd079aafe00000000, 0x054a283800000000, + 0x46818ebf00000000, 0xc2da14ec00000000, 0x8111b26b00000000, + 0xca6d204b00000000, 0x89a686cc00000000, 0x0dfd1c9f00000000, + 0x4e36ba1800000000}, + {0x0000000000000000, 0xe1b652ef00000000, 0x836bd40500000000, + 0x62dd86ea00000000, 0x06d7a80b00000000, 0xe761fae400000000, + 0x85bc7c0e00000000, 0x640a2ee100000000, 0x0cae511700000000, + 0xed1803f800000000, 0x8fc5851200000000, 0x6e73d7fd00000000, + 0x0a79f91c00000000, 0xebcfabf300000000, 0x89122d1900000000, + 0x68a47ff600000000, 0x185ca32e00000000, 0xf9eaf1c100000000, + 0x9b37772b00000000, 0x7a8125c400000000, 0x1e8b0b2500000000, + 0xff3d59ca00000000, 0x9de0df2000000000, 0x7c568dcf00000000, + 0x14f2f23900000000, 0xf544a0d600000000, 0x9799263c00000000, + 0x762f74d300000000, 0x12255a3200000000, 0xf39308dd00000000, + 0x914e8e3700000000, 0x70f8dcd800000000, 0x30b8465d00000000, + 0xd10e14b200000000, 0xb3d3925800000000, 0x5265c0b700000000, + 0x366fee5600000000, 0xd7d9bcb900000000, 0xb5043a5300000000, + 0x54b268bc00000000, 0x3c16174a00000000, 0xdda045a500000000, + 0xbf7dc34f00000000, 0x5ecb91a000000000, 0x3ac1bf4100000000, + 0xdb77edae00000000, 0xb9aa6b4400000000, 0x581c39ab00000000, + 0x28e4e57300000000, 0xc952b79c00000000, 0xab8f317600000000, + 0x4a39639900000000, 0x2e334d7800000000, 0xcf851f9700000000, + 0xad58997d00000000, 0x4ceecb9200000000, 0x244ab46400000000, + 0xc5fce68b00000000, 0xa721606100000000, 0x4697328e00000000, + 0x229d1c6f00000000, 0xc32b4e8000000000, 0xa1f6c86a00000000, + 0x40409a8500000000, 0x60708dba00000000, 0x81c6df5500000000, + 0xe31b59bf00000000, 0x02ad0b5000000000, 0x66a725b100000000, + 0x8711775e00000000, 0xe5ccf1b400000000, 0x047aa35b00000000, + 0x6cdedcad00000000, 0x8d688e4200000000, 0xefb508a800000000, + 0x0e035a4700000000, 0x6a0974a600000000, 0x8bbf264900000000, + 0xe962a0a300000000, 0x08d4f24c00000000, 0x782c2e9400000000, + 0x999a7c7b00000000, 0xfb47fa9100000000, 0x1af1a87e00000000, + 0x7efb869f00000000, 0x9f4dd47000000000, 0xfd90529a00000000, + 0x1c26007500000000, 0x74827f8300000000, 0x95342d6c00000000, + 0xf7e9ab8600000000, 0x165ff96900000000, 0x7255d78800000000, + 0x93e3856700000000, 0xf13e038d00000000, 0x1088516200000000, + 0x50c8cbe700000000, 0xb17e990800000000, 0xd3a31fe200000000, + 0x32154d0d00000000, 0x561f63ec00000000, 0xb7a9310300000000, + 0xd574b7e900000000, 0x34c2e50600000000, 0x5c669af000000000, + 0xbdd0c81f00000000, 0xdf0d4ef500000000, 0x3ebb1c1a00000000, + 0x5ab132fb00000000, 0xbb07601400000000, 0xd9dae6fe00000000, + 0x386cb41100000000, 0x489468c900000000, 0xa9223a2600000000, + 0xcbffbccc00000000, 0x2a49ee2300000000, 0x4e43c0c200000000, + 0xaff5922d00000000, 0xcd2814c700000000, 0x2c9e462800000000, + 0x443a39de00000000, 0xa58c6b3100000000, 0xc751eddb00000000, + 0x26e7bf3400000000, 0x42ed91d500000000, 0xa35bc33a00000000, + 0xc18645d000000000, 0x2030173f00000000, 0x81e66bae00000000, + 0x6050394100000000, 0x028dbfab00000000, 0xe33bed4400000000, + 0x8731c3a500000000, 0x6687914a00000000, 0x045a17a000000000, + 0xe5ec454f00000000, 0x8d483ab900000000, 0x6cfe685600000000, + 0x0e23eebc00000000, 0xef95bc5300000000, 0x8b9f92b200000000, + 0x6a29c05d00000000, 0x08f446b700000000, 0xe942145800000000, + 0x99bac88000000000, 0x780c9a6f00000000, 0x1ad11c8500000000, + 0xfb674e6a00000000, 0x9f6d608b00000000, 0x7edb326400000000, + 0x1c06b48e00000000, 0xfdb0e66100000000, 0x9514999700000000, + 0x74a2cb7800000000, 0x167f4d9200000000, 0xf7c91f7d00000000, + 0x93c3319c00000000, 0x7275637300000000, 0x10a8e59900000000, + 0xf11eb77600000000, 0xb15e2df300000000, 0x50e87f1c00000000, + 0x3235f9f600000000, 0xd383ab1900000000, 0xb78985f800000000, + 0x563fd71700000000, 0x34e251fd00000000, 0xd554031200000000, + 0xbdf07ce400000000, 0x5c462e0b00000000, 0x3e9ba8e100000000, + 0xdf2dfa0e00000000, 0xbb27d4ef00000000, 0x5a91860000000000, + 0x384c00ea00000000, 0xd9fa520500000000, 0xa9028edd00000000, + 0x48b4dc3200000000, 0x2a695ad800000000, 0xcbdf083700000000, + 0xafd526d600000000, 0x4e63743900000000, 0x2cbef2d300000000, + 0xcd08a03c00000000, 0xa5acdfca00000000, 0x441a8d2500000000, + 0x26c70bcf00000000, 0xc771592000000000, 0xa37b77c100000000, + 0x42cd252e00000000, 0x2010a3c400000000, 0xc1a6f12b00000000, + 0xe196e61400000000, 0x0020b4fb00000000, 0x62fd321100000000, + 0x834b60fe00000000, 0xe7414e1f00000000, 0x06f71cf000000000, + 0x642a9a1a00000000, 0x859cc8f500000000, 0xed38b70300000000, + 0x0c8ee5ec00000000, 0x6e53630600000000, 0x8fe531e900000000, + 0xebef1f0800000000, 0x0a594de700000000, 0x6884cb0d00000000, + 0x893299e200000000, 0xf9ca453a00000000, 0x187c17d500000000, + 0x7aa1913f00000000, 0x9b17c3d000000000, 0xff1ded3100000000, + 0x1eabbfde00000000, 0x7c76393400000000, 0x9dc06bdb00000000, + 0xf564142d00000000, 0x14d246c200000000, 0x760fc02800000000, + 0x97b992c700000000, 0xf3b3bc2600000000, 0x1205eec900000000, + 0x70d8682300000000, 0x916e3acc00000000, 0xd12ea04900000000, + 0x3098f2a600000000, 0x5245744c00000000, 0xb3f326a300000000, + 0xd7f9084200000000, 0x364f5aad00000000, 0x5492dc4700000000, + 0xb5248ea800000000, 0xdd80f15e00000000, 0x3c36a3b100000000, + 0x5eeb255b00000000, 0xbf5d77b400000000, 0xdb57595500000000, + 0x3ae10bba00000000, 0x583c8d5000000000, 0xb98adfbf00000000, + 0xc972036700000000, 0x28c4518800000000, 0x4a19d76200000000, + 0xabaf858d00000000, 0xcfa5ab6c00000000, 0x2e13f98300000000, + 0x4cce7f6900000000, 0xad782d8600000000, 0xc5dc527000000000, + 0x246a009f00000000, 0x46b7867500000000, 0xa701d49a00000000, + 0xc30bfa7b00000000, 0x22bda89400000000, 0x40602e7e00000000, + 0xa1d67c9100000000}, + {0x0000000000000000, 0x5880e2d700000000, 0xf106b47400000000, + 0xa98656a300000000, 0xe20d68e900000000, 0xba8d8a3e00000000, + 0x130bdc9d00000000, 0x4b8b3e4a00000000, 0x851da10900000000, + 0xdd9d43de00000000, 0x741b157d00000000, 0x2c9bf7aa00000000, + 0x6710c9e000000000, 0x3f902b3700000000, 0x96167d9400000000, + 0xce969f4300000000, 0x0a3b421300000000, 0x52bba0c400000000, + 0xfb3df66700000000, 0xa3bd14b000000000, 0xe8362afa00000000, + 0xb0b6c82d00000000, 0x19309e8e00000000, 0x41b07c5900000000, + 0x8f26e31a00000000, 0xd7a601cd00000000, 0x7e20576e00000000, + 0x26a0b5b900000000, 0x6d2b8bf300000000, 0x35ab692400000000, + 0x9c2d3f8700000000, 0xc4addd5000000000, 0x1476842600000000, + 0x4cf666f100000000, 0xe570305200000000, 0xbdf0d28500000000, + 0xf67beccf00000000, 0xaefb0e1800000000, 0x077d58bb00000000, + 0x5ffdba6c00000000, 0x916b252f00000000, 0xc9ebc7f800000000, + 0x606d915b00000000, 0x38ed738c00000000, 0x73664dc600000000, + 0x2be6af1100000000, 0x8260f9b200000000, 0xdae01b6500000000, + 0x1e4dc63500000000, 0x46cd24e200000000, 0xef4b724100000000, + 0xb7cb909600000000, 0xfc40aedc00000000, 0xa4c04c0b00000000, + 0x0d461aa800000000, 0x55c6f87f00000000, 0x9b50673c00000000, + 0xc3d085eb00000000, 0x6a56d34800000000, 0x32d6319f00000000, + 0x795d0fd500000000, 0x21dded0200000000, 0x885bbba100000000, + 0xd0db597600000000, 0x28ec084d00000000, 0x706cea9a00000000, + 0xd9eabc3900000000, 0x816a5eee00000000, 0xcae160a400000000, + 0x9261827300000000, 0x3be7d4d000000000, 0x6367360700000000, + 0xadf1a94400000000, 0xf5714b9300000000, 0x5cf71d3000000000, + 0x0477ffe700000000, 0x4ffcc1ad00000000, 0x177c237a00000000, + 0xbefa75d900000000, 0xe67a970e00000000, 0x22d74a5e00000000, + 0x7a57a88900000000, 0xd3d1fe2a00000000, 0x8b511cfd00000000, + 0xc0da22b700000000, 0x985ac06000000000, 0x31dc96c300000000, + 0x695c741400000000, 0xa7caeb5700000000, 0xff4a098000000000, + 0x56cc5f2300000000, 0x0e4cbdf400000000, 0x45c783be00000000, + 0x1d47616900000000, 0xb4c137ca00000000, 0xec41d51d00000000, + 0x3c9a8c6b00000000, 0x641a6ebc00000000, 0xcd9c381f00000000, + 0x951cdac800000000, 0xde97e48200000000, 0x8617065500000000, + 0x2f9150f600000000, 0x7711b22100000000, 0xb9872d6200000000, + 0xe107cfb500000000, 0x4881991600000000, 0x10017bc100000000, + 0x5b8a458b00000000, 0x030aa75c00000000, 0xaa8cf1ff00000000, + 0xf20c132800000000, 0x36a1ce7800000000, 0x6e212caf00000000, + 0xc7a77a0c00000000, 0x9f2798db00000000, 0xd4aca69100000000, + 0x8c2c444600000000, 0x25aa12e500000000, 0x7d2af03200000000, + 0xb3bc6f7100000000, 0xeb3c8da600000000, 0x42badb0500000000, + 0x1a3a39d200000000, 0x51b1079800000000, 0x0931e54f00000000, + 0xa0b7b3ec00000000, 0xf837513b00000000, 0x50d8119a00000000, + 0x0858f34d00000000, 0xa1dea5ee00000000, 0xf95e473900000000, + 0xb2d5797300000000, 0xea559ba400000000, 0x43d3cd0700000000, + 0x1b532fd000000000, 0xd5c5b09300000000, 0x8d45524400000000, + 0x24c304e700000000, 0x7c43e63000000000, 0x37c8d87a00000000, + 0x6f483aad00000000, 0xc6ce6c0e00000000, 0x9e4e8ed900000000, + 0x5ae3538900000000, 0x0263b15e00000000, 0xabe5e7fd00000000, + 0xf365052a00000000, 0xb8ee3b6000000000, 0xe06ed9b700000000, + 0x49e88f1400000000, 0x11686dc300000000, 0xdffef28000000000, + 0x877e105700000000, 0x2ef846f400000000, 0x7678a42300000000, + 0x3df39a6900000000, 0x657378be00000000, 0xccf52e1d00000000, + 0x9475ccca00000000, 0x44ae95bc00000000, 0x1c2e776b00000000, + 0xb5a821c800000000, 0xed28c31f00000000, 0xa6a3fd5500000000, + 0xfe231f8200000000, 0x57a5492100000000, 0x0f25abf600000000, + 0xc1b334b500000000, 0x9933d66200000000, 0x30b580c100000000, + 0x6835621600000000, 0x23be5c5c00000000, 0x7b3ebe8b00000000, + 0xd2b8e82800000000, 0x8a380aff00000000, 0x4e95d7af00000000, + 0x1615357800000000, 0xbf9363db00000000, 0xe713810c00000000, + 0xac98bf4600000000, 0xf4185d9100000000, 0x5d9e0b3200000000, + 0x051ee9e500000000, 0xcb8876a600000000, 0x9308947100000000, + 0x3a8ec2d200000000, 0x620e200500000000, 0x29851e4f00000000, + 0x7105fc9800000000, 0xd883aa3b00000000, 0x800348ec00000000, + 0x783419d700000000, 0x20b4fb0000000000, 0x8932ada300000000, + 0xd1b24f7400000000, 0x9a39713e00000000, 0xc2b993e900000000, + 0x6b3fc54a00000000, 0x33bf279d00000000, 0xfd29b8de00000000, + 0xa5a95a0900000000, 0x0c2f0caa00000000, 0x54afee7d00000000, + 0x1f24d03700000000, 0x47a432e000000000, 0xee22644300000000, + 0xb6a2869400000000, 0x720f5bc400000000, 0x2a8fb91300000000, + 0x8309efb000000000, 0xdb890d6700000000, 0x9002332d00000000, + 0xc882d1fa00000000, 0x6104875900000000, 0x3984658e00000000, + 0xf712facd00000000, 0xaf92181a00000000, 0x06144eb900000000, + 0x5e94ac6e00000000, 0x151f922400000000, 0x4d9f70f300000000, + 0xe419265000000000, 0xbc99c48700000000, 0x6c429df100000000, + 0x34c27f2600000000, 0x9d44298500000000, 0xc5c4cb5200000000, + 0x8e4ff51800000000, 0xd6cf17cf00000000, 0x7f49416c00000000, + 0x27c9a3bb00000000, 0xe95f3cf800000000, 0xb1dfde2f00000000, + 0x1859888c00000000, 0x40d96a5b00000000, 0x0b52541100000000, + 0x53d2b6c600000000, 0xfa54e06500000000, 0xa2d402b200000000, + 0x6679dfe200000000, 0x3ef93d3500000000, 0x977f6b9600000000, + 0xcfff894100000000, 0x8474b70b00000000, 0xdcf455dc00000000, + 0x7572037f00000000, 0x2df2e1a800000000, 0xe3647eeb00000000, + 0xbbe49c3c00000000, 0x1262ca9f00000000, 0x4ae2284800000000, + 0x0169160200000000, 0x59e9f4d500000000, 0xf06fa27600000000, + 0xa8ef40a100000000}, + {0x0000000000000000, 0x463b676500000000, 0x8c76ceca00000000, + 0xca4da9af00000000, 0x59ebed4e00000000, 0x1fd08a2b00000000, + 0xd59d238400000000, 0x93a644e100000000, 0xb2d6db9d00000000, + 0xf4edbcf800000000, 0x3ea0155700000000, 0x789b723200000000, + 0xeb3d36d300000000, 0xad0651b600000000, 0x674bf81900000000, + 0x21709f7c00000000, 0x25abc6e000000000, 0x6390a18500000000, + 0xa9dd082a00000000, 0xefe66f4f00000000, 0x7c402bae00000000, + 0x3a7b4ccb00000000, 0xf036e56400000000, 0xb60d820100000000, + 0x977d1d7d00000000, 0xd1467a1800000000, 0x1b0bd3b700000000, + 0x5d30b4d200000000, 0xce96f03300000000, 0x88ad975600000000, + 0x42e03ef900000000, 0x04db599c00000000, 0x0b50fc1a00000000, + 0x4d6b9b7f00000000, 0x872632d000000000, 0xc11d55b500000000, + 0x52bb115400000000, 0x1480763100000000, 0xdecddf9e00000000, + 0x98f6b8fb00000000, 0xb986278700000000, 0xffbd40e200000000, + 0x35f0e94d00000000, 0x73cb8e2800000000, 0xe06dcac900000000, + 0xa656adac00000000, 0x6c1b040300000000, 0x2a20636600000000, + 0x2efb3afa00000000, 0x68c05d9f00000000, 0xa28df43000000000, + 0xe4b6935500000000, 0x7710d7b400000000, 0x312bb0d100000000, + 0xfb66197e00000000, 0xbd5d7e1b00000000, 0x9c2de16700000000, + 0xda16860200000000, 0x105b2fad00000000, 0x566048c800000000, + 0xc5c60c2900000000, 0x83fd6b4c00000000, 0x49b0c2e300000000, + 0x0f8ba58600000000, 0x16a0f83500000000, 0x509b9f5000000000, + 0x9ad636ff00000000, 0xdced519a00000000, 0x4f4b157b00000000, + 0x0970721e00000000, 0xc33ddbb100000000, 0x8506bcd400000000, + 0xa47623a800000000, 0xe24d44cd00000000, 0x2800ed6200000000, + 0x6e3b8a0700000000, 0xfd9dcee600000000, 0xbba6a98300000000, + 0x71eb002c00000000, 0x37d0674900000000, 0x330b3ed500000000, + 0x753059b000000000, 0xbf7df01f00000000, 0xf946977a00000000, + 0x6ae0d39b00000000, 0x2cdbb4fe00000000, 0xe6961d5100000000, + 0xa0ad7a3400000000, 0x81dde54800000000, 0xc7e6822d00000000, + 0x0dab2b8200000000, 0x4b904ce700000000, 0xd836080600000000, + 0x9e0d6f6300000000, 0x5440c6cc00000000, 0x127ba1a900000000, + 0x1df0042f00000000, 0x5bcb634a00000000, 0x9186cae500000000, + 0xd7bdad8000000000, 0x441be96100000000, 0x02208e0400000000, + 0xc86d27ab00000000, 0x8e5640ce00000000, 0xaf26dfb200000000, + 0xe91db8d700000000, 0x2350117800000000, 0x656b761d00000000, + 0xf6cd32fc00000000, 0xb0f6559900000000, 0x7abbfc3600000000, + 0x3c809b5300000000, 0x385bc2cf00000000, 0x7e60a5aa00000000, + 0xb42d0c0500000000, 0xf2166b6000000000, 0x61b02f8100000000, + 0x278b48e400000000, 0xedc6e14b00000000, 0xabfd862e00000000, + 0x8a8d195200000000, 0xccb67e3700000000, 0x06fbd79800000000, + 0x40c0b0fd00000000, 0xd366f41c00000000, 0x955d937900000000, + 0x5f103ad600000000, 0x192b5db300000000, 0x2c40f16b00000000, + 0x6a7b960e00000000, 0xa0363fa100000000, 0xe60d58c400000000, + 0x75ab1c2500000000, 0x33907b4000000000, 0xf9ddd2ef00000000, + 0xbfe6b58a00000000, 0x9e962af600000000, 0xd8ad4d9300000000, + 0x12e0e43c00000000, 0x54db835900000000, 0xc77dc7b800000000, + 0x8146a0dd00000000, 0x4b0b097200000000, 0x0d306e1700000000, + 0x09eb378b00000000, 0x4fd050ee00000000, 0x859df94100000000, + 0xc3a69e2400000000, 0x5000dac500000000, 0x163bbda000000000, + 0xdc76140f00000000, 0x9a4d736a00000000, 0xbb3dec1600000000, + 0xfd068b7300000000, 0x374b22dc00000000, 0x717045b900000000, + 0xe2d6015800000000, 0xa4ed663d00000000, 0x6ea0cf9200000000, + 0x289ba8f700000000, 0x27100d7100000000, 0x612b6a1400000000, + 0xab66c3bb00000000, 0xed5da4de00000000, 0x7efbe03f00000000, + 0x38c0875a00000000, 0xf28d2ef500000000, 0xb4b6499000000000, + 0x95c6d6ec00000000, 0xd3fdb18900000000, 0x19b0182600000000, + 0x5f8b7f4300000000, 0xcc2d3ba200000000, 0x8a165cc700000000, + 0x405bf56800000000, 0x0660920d00000000, 0x02bbcb9100000000, + 0x4480acf400000000, 0x8ecd055b00000000, 0xc8f6623e00000000, + 0x5b5026df00000000, 0x1d6b41ba00000000, 0xd726e81500000000, + 0x911d8f7000000000, 0xb06d100c00000000, 0xf656776900000000, + 0x3c1bdec600000000, 0x7a20b9a300000000, 0xe986fd4200000000, + 0xafbd9a2700000000, 0x65f0338800000000, 0x23cb54ed00000000, + 0x3ae0095e00000000, 0x7cdb6e3b00000000, 0xb696c79400000000, + 0xf0ada0f100000000, 0x630be41000000000, 0x2530837500000000, + 0xef7d2ada00000000, 0xa9464dbf00000000, 0x8836d2c300000000, + 0xce0db5a600000000, 0x04401c0900000000, 0x427b7b6c00000000, + 0xd1dd3f8d00000000, 0x97e658e800000000, 0x5dabf14700000000, + 0x1b90962200000000, 0x1f4bcfbe00000000, 0x5970a8db00000000, + 0x933d017400000000, 0xd506661100000000, 0x46a022f000000000, + 0x009b459500000000, 0xcad6ec3a00000000, 0x8ced8b5f00000000, + 0xad9d142300000000, 0xeba6734600000000, 0x21ebdae900000000, + 0x67d0bd8c00000000, 0xf476f96d00000000, 0xb24d9e0800000000, + 0x780037a700000000, 0x3e3b50c200000000, 0x31b0f54400000000, + 0x778b922100000000, 0xbdc63b8e00000000, 0xfbfd5ceb00000000, + 0x685b180a00000000, 0x2e607f6f00000000, 0xe42dd6c000000000, + 0xa216b1a500000000, 0x83662ed900000000, 0xc55d49bc00000000, + 0x0f10e01300000000, 0x492b877600000000, 0xda8dc39700000000, + 0x9cb6a4f200000000, 0x56fb0d5d00000000, 0x10c06a3800000000, + 0x141b33a400000000, 0x522054c100000000, 0x986dfd6e00000000, + 0xde569a0b00000000, 0x4df0deea00000000, 0x0bcbb98f00000000, + 0xc186102000000000, 0x87bd774500000000, 0xa6cde83900000000, + 0xe0f68f5c00000000, 0x2abb26f300000000, 0x6c80419600000000, + 0xff26057700000000, 0xb91d621200000000, 0x7350cbbd00000000, + 0x356bacd800000000}, + {0x0000000000000000, 0x9e83da9f00000000, 0x7d01c4e400000000, + 0xe3821e7b00000000, 0xbb04f91200000000, 0x2587238d00000000, + 0xc6053df600000000, 0x5886e76900000000, 0x7609f22500000000, + 0xe88a28ba00000000, 0x0b0836c100000000, 0x958bec5e00000000, + 0xcd0d0b3700000000, 0x538ed1a800000000, 0xb00ccfd300000000, + 0x2e8f154c00000000, 0xec12e44b00000000, 0x72913ed400000000, + 0x911320af00000000, 0x0f90fa3000000000, 0x57161d5900000000, + 0xc995c7c600000000, 0x2a17d9bd00000000, 0xb494032200000000, + 0x9a1b166e00000000, 0x0498ccf100000000, 0xe71ad28a00000000, + 0x7999081500000000, 0x211fef7c00000000, 0xbf9c35e300000000, + 0x5c1e2b9800000000, 0xc29df10700000000, 0xd825c89700000000, + 0x46a6120800000000, 0xa5240c7300000000, 0x3ba7d6ec00000000, + 0x6321318500000000, 0xfda2eb1a00000000, 0x1e20f56100000000, + 0x80a32ffe00000000, 0xae2c3ab200000000, 0x30afe02d00000000, + 0xd32dfe5600000000, 0x4dae24c900000000, 0x1528c3a000000000, + 0x8bab193f00000000, 0x6829074400000000, 0xf6aadddb00000000, + 0x34372cdc00000000, 0xaab4f64300000000, 0x4936e83800000000, + 0xd7b532a700000000, 0x8f33d5ce00000000, 0x11b00f5100000000, + 0xf232112a00000000, 0x6cb1cbb500000000, 0x423edef900000000, + 0xdcbd046600000000, 0x3f3f1a1d00000000, 0xa1bcc08200000000, + 0xf93a27eb00000000, 0x67b9fd7400000000, 0x843be30f00000000, + 0x1ab8399000000000, 0xf14de1f400000000, 0x6fce3b6b00000000, + 0x8c4c251000000000, 0x12cfff8f00000000, 0x4a4918e600000000, + 0xd4cac27900000000, 0x3748dc0200000000, 0xa9cb069d00000000, + 0x874413d100000000, 0x19c7c94e00000000, 0xfa45d73500000000, + 0x64c60daa00000000, 0x3c40eac300000000, 0xa2c3305c00000000, + 0x41412e2700000000, 0xdfc2f4b800000000, 0x1d5f05bf00000000, + 0x83dcdf2000000000, 0x605ec15b00000000, 0xfedd1bc400000000, + 0xa65bfcad00000000, 0x38d8263200000000, 0xdb5a384900000000, + 0x45d9e2d600000000, 0x6b56f79a00000000, 0xf5d52d0500000000, + 0x1657337e00000000, 0x88d4e9e100000000, 0xd0520e8800000000, + 0x4ed1d41700000000, 0xad53ca6c00000000, 0x33d010f300000000, + 0x2968296300000000, 0xb7ebf3fc00000000, 0x5469ed8700000000, + 0xcaea371800000000, 0x926cd07100000000, 0x0cef0aee00000000, + 0xef6d149500000000, 0x71eece0a00000000, 0x5f61db4600000000, + 0xc1e201d900000000, 0x22601fa200000000, 0xbce3c53d00000000, + 0xe465225400000000, 0x7ae6f8cb00000000, 0x9964e6b000000000, + 0x07e73c2f00000000, 0xc57acd2800000000, 0x5bf917b700000000, + 0xb87b09cc00000000, 0x26f8d35300000000, 0x7e7e343a00000000, + 0xe0fdeea500000000, 0x037ff0de00000000, 0x9dfc2a4100000000, + 0xb3733f0d00000000, 0x2df0e59200000000, 0xce72fbe900000000, + 0x50f1217600000000, 0x0877c61f00000000, 0x96f41c8000000000, + 0x757602fb00000000, 0xebf5d86400000000, 0xa39db33200000000, + 0x3d1e69ad00000000, 0xde9c77d600000000, 0x401fad4900000000, + 0x18994a2000000000, 0x861a90bf00000000, 0x65988ec400000000, + 0xfb1b545b00000000, 0xd594411700000000, 0x4b179b8800000000, + 0xa89585f300000000, 0x36165f6c00000000, 0x6e90b80500000000, + 0xf013629a00000000, 0x13917ce100000000, 0x8d12a67e00000000, + 0x4f8f577900000000, 0xd10c8de600000000, 0x328e939d00000000, + 0xac0d490200000000, 0xf48bae6b00000000, 0x6a0874f400000000, + 0x898a6a8f00000000, 0x1709b01000000000, 0x3986a55c00000000, + 0xa7057fc300000000, 0x448761b800000000, 0xda04bb2700000000, + 0x82825c4e00000000, 0x1c0186d100000000, 0xff8398aa00000000, + 0x6100423500000000, 0x7bb87ba500000000, 0xe53ba13a00000000, + 0x06b9bf4100000000, 0x983a65de00000000, 0xc0bc82b700000000, + 0x5e3f582800000000, 0xbdbd465300000000, 0x233e9ccc00000000, + 0x0db1898000000000, 0x9332531f00000000, 0x70b04d6400000000, + 0xee3397fb00000000, 0xb6b5709200000000, 0x2836aa0d00000000, + 0xcbb4b47600000000, 0x55376ee900000000, 0x97aa9fee00000000, + 0x0929457100000000, 0xeaab5b0a00000000, 0x7428819500000000, + 0x2cae66fc00000000, 0xb22dbc6300000000, 0x51afa21800000000, + 0xcf2c788700000000, 0xe1a36dcb00000000, 0x7f20b75400000000, + 0x9ca2a92f00000000, 0x022173b000000000, 0x5aa794d900000000, + 0xc4244e4600000000, 0x27a6503d00000000, 0xb9258aa200000000, + 0x52d052c600000000, 0xcc53885900000000, 0x2fd1962200000000, + 0xb1524cbd00000000, 0xe9d4abd400000000, 0x7757714b00000000, + 0x94d56f3000000000, 0x0a56b5af00000000, 0x24d9a0e300000000, + 0xba5a7a7c00000000, 0x59d8640700000000, 0xc75bbe9800000000, + 0x9fdd59f100000000, 0x015e836e00000000, 0xe2dc9d1500000000, + 0x7c5f478a00000000, 0xbec2b68d00000000, 0x20416c1200000000, + 0xc3c3726900000000, 0x5d40a8f600000000, 0x05c64f9f00000000, + 0x9b45950000000000, 0x78c78b7b00000000, 0xe64451e400000000, + 0xc8cb44a800000000, 0x56489e3700000000, 0xb5ca804c00000000, + 0x2b495ad300000000, 0x73cfbdba00000000, 0xed4c672500000000, + 0x0ece795e00000000, 0x904da3c100000000, 0x8af59a5100000000, + 0x147640ce00000000, 0xf7f45eb500000000, 0x6977842a00000000, + 0x31f1634300000000, 0xaf72b9dc00000000, 0x4cf0a7a700000000, + 0xd2737d3800000000, 0xfcfc687400000000, 0x627fb2eb00000000, + 0x81fdac9000000000, 0x1f7e760f00000000, 0x47f8916600000000, + 0xd97b4bf900000000, 0x3af9558200000000, 0xa47a8f1d00000000, + 0x66e77e1a00000000, 0xf864a48500000000, 0x1be6bafe00000000, + 0x8565606100000000, 0xdde3870800000000, 0x43605d9700000000, + 0xa0e243ec00000000, 0x3e61997300000000, 0x10ee8c3f00000000, + 0x8e6d56a000000000, 0x6def48db00000000, 0xf36c924400000000, + 0xabea752d00000000, 0x3569afb200000000, 0xd6ebb1c900000000, + 0x48686b5600000000}, + {0x0000000000000000, 0xc064281700000000, 0x80c9502e00000000, + 0x40ad783900000000, 0x0093a15c00000000, 0xc0f7894b00000000, + 0x805af17200000000, 0x403ed96500000000, 0x002643b900000000, + 0xc0426bae00000000, 0x80ef139700000000, 0x408b3b8000000000, + 0x00b5e2e500000000, 0xc0d1caf200000000, 0x807cb2cb00000000, + 0x40189adc00000000, 0x414af7a900000000, 0x812edfbe00000000, + 0xc183a78700000000, 0x01e78f9000000000, 0x41d956f500000000, + 0x81bd7ee200000000, 0xc11006db00000000, 0x01742ecc00000000, + 0x416cb41000000000, 0x81089c0700000000, 0xc1a5e43e00000000, + 0x01c1cc2900000000, 0x41ff154c00000000, 0x819b3d5b00000000, + 0xc136456200000000, 0x01526d7500000000, 0xc3929f8800000000, + 0x03f6b79f00000000, 0x435bcfa600000000, 0x833fe7b100000000, + 0xc3013ed400000000, 0x036516c300000000, 0x43c86efa00000000, + 0x83ac46ed00000000, 0xc3b4dc3100000000, 0x03d0f42600000000, + 0x437d8c1f00000000, 0x8319a40800000000, 0xc3277d6d00000000, + 0x0343557a00000000, 0x43ee2d4300000000, 0x838a055400000000, + 0x82d8682100000000, 0x42bc403600000000, 0x0211380f00000000, + 0xc275101800000000, 0x824bc97d00000000, 0x422fe16a00000000, + 0x0282995300000000, 0xc2e6b14400000000, 0x82fe2b9800000000, + 0x429a038f00000000, 0x02377bb600000000, 0xc25353a100000000, + 0x826d8ac400000000, 0x4209a2d300000000, 0x02a4daea00000000, + 0xc2c0f2fd00000000, 0xc7234eca00000000, 0x074766dd00000000, + 0x47ea1ee400000000, 0x878e36f300000000, 0xc7b0ef9600000000, + 0x07d4c78100000000, 0x4779bfb800000000, 0x871d97af00000000, + 0xc7050d7300000000, 0x0761256400000000, 0x47cc5d5d00000000, + 0x87a8754a00000000, 0xc796ac2f00000000, 0x07f2843800000000, + 0x475ffc0100000000, 0x873bd41600000000, 0x8669b96300000000, + 0x460d917400000000, 0x06a0e94d00000000, 0xc6c4c15a00000000, + 0x86fa183f00000000, 0x469e302800000000, 0x0633481100000000, + 0xc657600600000000, 0x864ffada00000000, 0x462bd2cd00000000, + 0x0686aaf400000000, 0xc6e282e300000000, 0x86dc5b8600000000, + 0x46b8739100000000, 0x06150ba800000000, 0xc67123bf00000000, + 0x04b1d14200000000, 0xc4d5f95500000000, 0x8478816c00000000, + 0x441ca97b00000000, 0x0422701e00000000, 0xc446580900000000, + 0x84eb203000000000, 0x448f082700000000, 0x049792fb00000000, + 0xc4f3baec00000000, 0x845ec2d500000000, 0x443aeac200000000, + 0x040433a700000000, 0xc4601bb000000000, 0x84cd638900000000, + 0x44a94b9e00000000, 0x45fb26eb00000000, 0x859f0efc00000000, + 0xc53276c500000000, 0x05565ed200000000, 0x456887b700000000, + 0x850cafa000000000, 0xc5a1d79900000000, 0x05c5ff8e00000000, + 0x45dd655200000000, 0x85b94d4500000000, 0xc514357c00000000, + 0x05701d6b00000000, 0x454ec40e00000000, 0x852aec1900000000, + 0xc587942000000000, 0x05e3bc3700000000, 0xcf41ed4f00000000, + 0x0f25c55800000000, 0x4f88bd6100000000, 0x8fec957600000000, + 0xcfd24c1300000000, 0x0fb6640400000000, 0x4f1b1c3d00000000, + 0x8f7f342a00000000, 0xcf67aef600000000, 0x0f0386e100000000, + 0x4faefed800000000, 0x8fcad6cf00000000, 0xcff40faa00000000, + 0x0f9027bd00000000, 0x4f3d5f8400000000, 0x8f59779300000000, + 0x8e0b1ae600000000, 0x4e6f32f100000000, 0x0ec24ac800000000, + 0xcea662df00000000, 0x8e98bbba00000000, 0x4efc93ad00000000, + 0x0e51eb9400000000, 0xce35c38300000000, 0x8e2d595f00000000, + 0x4e49714800000000, 0x0ee4097100000000, 0xce80216600000000, + 0x8ebef80300000000, 0x4edad01400000000, 0x0e77a82d00000000, + 0xce13803a00000000, 0x0cd372c700000000, 0xccb75ad000000000, + 0x8c1a22e900000000, 0x4c7e0afe00000000, 0x0c40d39b00000000, + 0xcc24fb8c00000000, 0x8c8983b500000000, 0x4cedaba200000000, + 0x0cf5317e00000000, 0xcc91196900000000, 0x8c3c615000000000, + 0x4c58494700000000, 0x0c66902200000000, 0xcc02b83500000000, + 0x8cafc00c00000000, 0x4ccbe81b00000000, 0x4d99856e00000000, + 0x8dfdad7900000000, 0xcd50d54000000000, 0x0d34fd5700000000, + 0x4d0a243200000000, 0x8d6e0c2500000000, 0xcdc3741c00000000, + 0x0da75c0b00000000, 0x4dbfc6d700000000, 0x8ddbeec000000000, + 0xcd7696f900000000, 0x0d12beee00000000, 0x4d2c678b00000000, + 0x8d484f9c00000000, 0xcde537a500000000, 0x0d811fb200000000, + 0x0862a38500000000, 0xc8068b9200000000, 0x88abf3ab00000000, + 0x48cfdbbc00000000, 0x08f102d900000000, 0xc8952ace00000000, + 0x883852f700000000, 0x485c7ae000000000, 0x0844e03c00000000, + 0xc820c82b00000000, 0x888db01200000000, 0x48e9980500000000, + 0x08d7416000000000, 0xc8b3697700000000, 0x881e114e00000000, + 0x487a395900000000, 0x4928542c00000000, 0x894c7c3b00000000, + 0xc9e1040200000000, 0x09852c1500000000, 0x49bbf57000000000, + 0x89dfdd6700000000, 0xc972a55e00000000, 0x09168d4900000000, + 0x490e179500000000, 0x896a3f8200000000, 0xc9c747bb00000000, + 0x09a36fac00000000, 0x499db6c900000000, 0x89f99ede00000000, + 0xc954e6e700000000, 0x0930cef000000000, 0xcbf03c0d00000000, + 0x0b94141a00000000, 0x4b396c2300000000, 0x8b5d443400000000, + 0xcb639d5100000000, 0x0b07b54600000000, 0x4baacd7f00000000, + 0x8bcee56800000000, 0xcbd67fb400000000, 0x0bb257a300000000, + 0x4b1f2f9a00000000, 0x8b7b078d00000000, 0xcb45dee800000000, + 0x0b21f6ff00000000, 0x4b8c8ec600000000, 0x8be8a6d100000000, + 0x8abacba400000000, 0x4adee3b300000000, 0x0a739b8a00000000, + 0xca17b39d00000000, 0x8a296af800000000, 0x4a4d42ef00000000, + 0x0ae03ad600000000, 0xca8412c100000000, 0x8a9c881d00000000, + 0x4af8a00a00000000, 0x0a55d83300000000, 0xca31f02400000000, + 0x8a0f294100000000, 0x4a6b015600000000, 0x0ac6796f00000000, + 0xcaa2517800000000}, + {0x0000000000000000, 0xd4ea739b00000000, 0xe9d396ed00000000, + 0x3d39e57600000000, 0x93a15c0000000000, 0x474b2f9b00000000, + 0x7a72caed00000000, 0xae98b97600000000, 0x2643b90000000000, + 0xf2a9ca9b00000000, 0xcf902fed00000000, 0x1b7a5c7600000000, + 0xb5e2e50000000000, 0x6108969b00000000, 0x5c3173ed00000000, + 0x88db007600000000, 0x4c86720100000000, 0x986c019a00000000, + 0xa555e4ec00000000, 0x71bf977700000000, 0xdf272e0100000000, + 0x0bcd5d9a00000000, 0x36f4b8ec00000000, 0xe21ecb7700000000, + 0x6ac5cb0100000000, 0xbe2fb89a00000000, 0x83165dec00000000, + 0x57fc2e7700000000, 0xf964970100000000, 0x2d8ee49a00000000, + 0x10b701ec00000000, 0xc45d727700000000, 0x980ce50200000000, + 0x4ce6969900000000, 0x71df73ef00000000, 0xa535007400000000, + 0x0badb90200000000, 0xdf47ca9900000000, 0xe27e2fef00000000, + 0x36945c7400000000, 0xbe4f5c0200000000, 0x6aa52f9900000000, + 0x579ccaef00000000, 0x8376b97400000000, 0x2dee000200000000, + 0xf904739900000000, 0xc43d96ef00000000, 0x10d7e57400000000, + 0xd48a970300000000, 0x0060e49800000000, 0x3d5901ee00000000, + 0xe9b3727500000000, 0x472bcb0300000000, 0x93c1b89800000000, + 0xaef85dee00000000, 0x7a122e7500000000, 0xf2c92e0300000000, + 0x26235d9800000000, 0x1b1ab8ee00000000, 0xcff0cb7500000000, + 0x6168720300000000, 0xb582019800000000, 0x88bbe4ee00000000, + 0x5c51977500000000, 0x3019ca0500000000, 0xe4f3b99e00000000, + 0xd9ca5ce800000000, 0x0d202f7300000000, 0xa3b8960500000000, + 0x7752e59e00000000, 0x4a6b00e800000000, 0x9e81737300000000, + 0x165a730500000000, 0xc2b0009e00000000, 0xff89e5e800000000, + 0x2b63967300000000, 0x85fb2f0500000000, 0x51115c9e00000000, + 0x6c28b9e800000000, 0xb8c2ca7300000000, 0x7c9fb80400000000, + 0xa875cb9f00000000, 0x954c2ee900000000, 0x41a65d7200000000, + 0xef3ee40400000000, 0x3bd4979f00000000, 0x06ed72e900000000, + 0xd207017200000000, 0x5adc010400000000, 0x8e36729f00000000, + 0xb30f97e900000000, 0x67e5e47200000000, 0xc97d5d0400000000, + 0x1d972e9f00000000, 0x20aecbe900000000, 0xf444b87200000000, + 0xa8152f0700000000, 0x7cff5c9c00000000, 0x41c6b9ea00000000, + 0x952cca7100000000, 0x3bb4730700000000, 0xef5e009c00000000, + 0xd267e5ea00000000, 0x068d967100000000, 0x8e56960700000000, + 0x5abce59c00000000, 0x678500ea00000000, 0xb36f737100000000, + 0x1df7ca0700000000, 0xc91db99c00000000, 0xf4245cea00000000, + 0x20ce2f7100000000, 0xe4935d0600000000, 0x30792e9d00000000, + 0x0d40cbeb00000000, 0xd9aab87000000000, 0x7732010600000000, + 0xa3d8729d00000000, 0x9ee197eb00000000, 0x4a0be47000000000, + 0xc2d0e40600000000, 0x163a979d00000000, 0x2b0372eb00000000, + 0xffe9017000000000, 0x5171b80600000000, 0x859bcb9d00000000, + 0xb8a22eeb00000000, 0x6c485d7000000000, 0x6032940b00000000, + 0xb4d8e79000000000, 0x89e102e600000000, 0x5d0b717d00000000, + 0xf393c80b00000000, 0x2779bb9000000000, 0x1a405ee600000000, + 0xceaa2d7d00000000, 0x46712d0b00000000, 0x929b5e9000000000, + 0xafa2bbe600000000, 0x7b48c87d00000000, 0xd5d0710b00000000, + 0x013a029000000000, 0x3c03e7e600000000, 0xe8e9947d00000000, + 0x2cb4e60a00000000, 0xf85e959100000000, 0xc56770e700000000, + 0x118d037c00000000, 0xbf15ba0a00000000, 0x6bffc99100000000, + 0x56c62ce700000000, 0x822c5f7c00000000, 0x0af75f0a00000000, + 0xde1d2c9100000000, 0xe324c9e700000000, 0x37ceba7c00000000, + 0x9956030a00000000, 0x4dbc709100000000, 0x708595e700000000, + 0xa46fe67c00000000, 0xf83e710900000000, 0x2cd4029200000000, + 0x11ede7e400000000, 0xc507947f00000000, 0x6b9f2d0900000000, + 0xbf755e9200000000, 0x824cbbe400000000, 0x56a6c87f00000000, + 0xde7dc80900000000, 0x0a97bb9200000000, 0x37ae5ee400000000, + 0xe3442d7f00000000, 0x4ddc940900000000, 0x9936e79200000000, + 0xa40f02e400000000, 0x70e5717f00000000, 0xb4b8030800000000, + 0x6052709300000000, 0x5d6b95e500000000, 0x8981e67e00000000, + 0x27195f0800000000, 0xf3f32c9300000000, 0xcecac9e500000000, + 0x1a20ba7e00000000, 0x92fbba0800000000, 0x4611c99300000000, + 0x7b282ce500000000, 0xafc25f7e00000000, 0x015ae60800000000, + 0xd5b0959300000000, 0xe88970e500000000, 0x3c63037e00000000, + 0x502b5e0e00000000, 0x84c12d9500000000, 0xb9f8c8e300000000, + 0x6d12bb7800000000, 0xc38a020e00000000, 0x1760719500000000, + 0x2a5994e300000000, 0xfeb3e77800000000, 0x7668e70e00000000, + 0xa282949500000000, 0x9fbb71e300000000, 0x4b51027800000000, + 0xe5c9bb0e00000000, 0x3123c89500000000, 0x0c1a2de300000000, + 0xd8f05e7800000000, 0x1cad2c0f00000000, 0xc8475f9400000000, + 0xf57ebae200000000, 0x2194c97900000000, 0x8f0c700f00000000, + 0x5be6039400000000, 0x66dfe6e200000000, 0xb235957900000000, + 0x3aee950f00000000, 0xee04e69400000000, 0xd33d03e200000000, + 0x07d7707900000000, 0xa94fc90f00000000, 0x7da5ba9400000000, + 0x409c5fe200000000, 0x94762c7900000000, 0xc827bb0c00000000, + 0x1ccdc89700000000, 0x21f42de100000000, 0xf51e5e7a00000000, + 0x5b86e70c00000000, 0x8f6c949700000000, 0xb25571e100000000, + 0x66bf027a00000000, 0xee64020c00000000, 0x3a8e719700000000, + 0x07b794e100000000, 0xd35de77a00000000, 0x7dc55e0c00000000, + 0xa92f2d9700000000, 0x9416c8e100000000, 0x40fcbb7a00000000, + 0x84a1c90d00000000, 0x504bba9600000000, 0x6d725fe000000000, + 0xb9982c7b00000000, 0x1700950d00000000, 0xc3eae69600000000, + 0xfed303e000000000, 0x2a39707b00000000, 0xa2e2700d00000000, + 0x7608039600000000, 0x4b31e6e000000000, 0x9fdb957b00000000, + 0x31432c0d00000000, 0xe5a95f9600000000, 0xd890bae000000000, + 0x0c7ac97b00000000}, + {0x0000000000000000, 0x2765258100000000, 0x0fcc3bd900000000, + 0x28a91e5800000000, 0x5f9e066900000000, 0x78fb23e800000000, + 0x50523db000000000, 0x7737183100000000, 0xbe3c0dd200000000, + 0x9959285300000000, 0xb1f0360b00000000, 0x9695138a00000000, + 0xe1a20bbb00000000, 0xc6c72e3a00000000, 0xee6e306200000000, + 0xc90b15e300000000, 0x3d7f6b7f00000000, 0x1a1a4efe00000000, + 0x32b350a600000000, 0x15d6752700000000, 0x62e16d1600000000, + 0x4584489700000000, 0x6d2d56cf00000000, 0x4a48734e00000000, + 0x834366ad00000000, 0xa426432c00000000, 0x8c8f5d7400000000, + 0xabea78f500000000, 0xdcdd60c400000000, 0xfbb8454500000000, + 0xd3115b1d00000000, 0xf4747e9c00000000, 0x7afed6fe00000000, + 0x5d9bf37f00000000, 0x7532ed2700000000, 0x5257c8a600000000, + 0x2560d09700000000, 0x0205f51600000000, 0x2aaceb4e00000000, + 0x0dc9cecf00000000, 0xc4c2db2c00000000, 0xe3a7fead00000000, + 0xcb0ee0f500000000, 0xec6bc57400000000, 0x9b5cdd4500000000, + 0xbc39f8c400000000, 0x9490e69c00000000, 0xb3f5c31d00000000, + 0x4781bd8100000000, 0x60e4980000000000, 0x484d865800000000, + 0x6f28a3d900000000, 0x181fbbe800000000, 0x3f7a9e6900000000, + 0x17d3803100000000, 0x30b6a5b000000000, 0xf9bdb05300000000, + 0xded895d200000000, 0xf6718b8a00000000, 0xd114ae0b00000000, + 0xa623b63a00000000, 0x814693bb00000000, 0xa9ef8de300000000, + 0x8e8aa86200000000, 0xb5fadc2600000000, 0x929ff9a700000000, + 0xba36e7ff00000000, 0x9d53c27e00000000, 0xea64da4f00000000, + 0xcd01ffce00000000, 0xe5a8e19600000000, 0xc2cdc41700000000, + 0x0bc6d1f400000000, 0x2ca3f47500000000, 0x040aea2d00000000, + 0x236fcfac00000000, 0x5458d79d00000000, 0x733df21c00000000, + 0x5b94ec4400000000, 0x7cf1c9c500000000, 0x8885b75900000000, + 0xafe092d800000000, 0x87498c8000000000, 0xa02ca90100000000, + 0xd71bb13000000000, 0xf07e94b100000000, 0xd8d78ae900000000, + 0xffb2af6800000000, 0x36b9ba8b00000000, 0x11dc9f0a00000000, + 0x3975815200000000, 0x1e10a4d300000000, 0x6927bce200000000, + 0x4e42996300000000, 0x66eb873b00000000, 0x418ea2ba00000000, + 0xcf040ad800000000, 0xe8612f5900000000, 0xc0c8310100000000, + 0xe7ad148000000000, 0x909a0cb100000000, 0xb7ff293000000000, + 0x9f56376800000000, 0xb83312e900000000, 0x7138070a00000000, + 0x565d228b00000000, 0x7ef43cd300000000, 0x5991195200000000, + 0x2ea6016300000000, 0x09c324e200000000, 0x216a3aba00000000, + 0x060f1f3b00000000, 0xf27b61a700000000, 0xd51e442600000000, + 0xfdb75a7e00000000, 0xdad27fff00000000, 0xade567ce00000000, + 0x8a80424f00000000, 0xa2295c1700000000, 0x854c799600000000, + 0x4c476c7500000000, 0x6b2249f400000000, 0x438b57ac00000000, + 0x64ee722d00000000, 0x13d96a1c00000000, 0x34bc4f9d00000000, + 0x1c1551c500000000, 0x3b70744400000000, 0x6af5b94d00000000, + 0x4d909ccc00000000, 0x6539829400000000, 0x425ca71500000000, + 0x356bbf2400000000, 0x120e9aa500000000, 0x3aa784fd00000000, + 0x1dc2a17c00000000, 0xd4c9b49f00000000, 0xf3ac911e00000000, + 0xdb058f4600000000, 0xfc60aac700000000, 0x8b57b2f600000000, + 0xac32977700000000, 0x849b892f00000000, 0xa3feacae00000000, + 0x578ad23200000000, 0x70eff7b300000000, 0x5846e9eb00000000, + 0x7f23cc6a00000000, 0x0814d45b00000000, 0x2f71f1da00000000, + 0x07d8ef8200000000, 0x20bdca0300000000, 0xe9b6dfe000000000, + 0xced3fa6100000000, 0xe67ae43900000000, 0xc11fc1b800000000, + 0xb628d98900000000, 0x914dfc0800000000, 0xb9e4e25000000000, + 0x9e81c7d100000000, 0x100b6fb300000000, 0x376e4a3200000000, + 0x1fc7546a00000000, 0x38a271eb00000000, 0x4f9569da00000000, + 0x68f04c5b00000000, 0x4059520300000000, 0x673c778200000000, + 0xae37626100000000, 0x895247e000000000, 0xa1fb59b800000000, + 0x869e7c3900000000, 0xf1a9640800000000, 0xd6cc418900000000, + 0xfe655fd100000000, 0xd9007a5000000000, 0x2d7404cc00000000, + 0x0a11214d00000000, 0x22b83f1500000000, 0x05dd1a9400000000, + 0x72ea02a500000000, 0x558f272400000000, 0x7d26397c00000000, + 0x5a431cfd00000000, 0x9348091e00000000, 0xb42d2c9f00000000, + 0x9c8432c700000000, 0xbbe1174600000000, 0xccd60f7700000000, + 0xebb32af600000000, 0xc31a34ae00000000, 0xe47f112f00000000, + 0xdf0f656b00000000, 0xf86a40ea00000000, 0xd0c35eb200000000, + 0xf7a67b3300000000, 0x8091630200000000, 0xa7f4468300000000, + 0x8f5d58db00000000, 0xa8387d5a00000000, 0x613368b900000000, + 0x46564d3800000000, 0x6eff536000000000, 0x499a76e100000000, + 0x3ead6ed000000000, 0x19c84b5100000000, 0x3161550900000000, + 0x1604708800000000, 0xe2700e1400000000, 0xc5152b9500000000, + 0xedbc35cd00000000, 0xcad9104c00000000, 0xbdee087d00000000, + 0x9a8b2dfc00000000, 0xb22233a400000000, 0x9547162500000000, + 0x5c4c03c600000000, 0x7b29264700000000, 0x5380381f00000000, + 0x74e51d9e00000000, 0x03d205af00000000, 0x24b7202e00000000, + 0x0c1e3e7600000000, 0x2b7b1bf700000000, 0xa5f1b39500000000, + 0x8294961400000000, 0xaa3d884c00000000, 0x8d58adcd00000000, + 0xfa6fb5fc00000000, 0xdd0a907d00000000, 0xf5a38e2500000000, + 0xd2c6aba400000000, 0x1bcdbe4700000000, 0x3ca89bc600000000, + 0x1401859e00000000, 0x3364a01f00000000, 0x4453b82e00000000, + 0x63369daf00000000, 0x4b9f83f700000000, 0x6cfaa67600000000, + 0x988ed8ea00000000, 0xbfebfd6b00000000, 0x9742e33300000000, + 0xb027c6b200000000, 0xc710de8300000000, 0xe075fb0200000000, + 0xc8dce55a00000000, 0xefb9c0db00000000, 0x26b2d53800000000, + 0x01d7f0b900000000, 0x297eeee100000000, 0x0e1bcb6000000000, + 0x792cd35100000000, 0x5e49f6d000000000, 0x76e0e88800000000, + 0x5185cd0900000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x9ba54c6f, 0xec3b9e9f, 0x779ed2f0, 0x03063b7f, + 0x98a37710, 0xef3da5e0, 0x7498e98f, 0x060c76fe, 0x9da93a91, + 0xea37e861, 0x7192a40e, 0x050a4d81, 0x9eaf01ee, 0xe931d31e, + 0x72949f71, 0x0c18edfc, 0x97bda193, 0xe0237363, 0x7b863f0c, + 0x0f1ed683, 0x94bb9aec, 0xe325481c, 0x78800473, 0x0a149b02, + 0x91b1d76d, 0xe62f059d, 0x7d8a49f2, 0x0912a07d, 0x92b7ec12, + 0xe5293ee2, 0x7e8c728d, 0x1831dbf8, 0x83949797, 0xf40a4567, + 0x6faf0908, 0x1b37e087, 0x8092ace8, 0xf70c7e18, 0x6ca93277, + 0x1e3dad06, 0x8598e169, 0xf2063399, 0x69a37ff6, 0x1d3b9679, + 0x869eda16, 0xf10008e6, 0x6aa54489, 0x14293604, 0x8f8c7a6b, + 0xf812a89b, 0x63b7e4f4, 0x172f0d7b, 0x8c8a4114, 0xfb1493e4, + 0x60b1df8b, 0x122540fa, 0x89800c95, 0xfe1ede65, 0x65bb920a, + 0x11237b85, 0x8a8637ea, 0xfd18e51a, 0x66bda975, 0x3063b7f0, + 0xabc6fb9f, 0xdc58296f, 0x47fd6500, 0x33658c8f, 0xa8c0c0e0, + 0xdf5e1210, 0x44fb5e7f, 0x366fc10e, 0xadca8d61, 0xda545f91, + 0x41f113fe, 0x3569fa71, 0xaeccb61e, 0xd95264ee, 0x42f72881, + 0x3c7b5a0c, 0xa7de1663, 0xd040c493, 0x4be588fc, 0x3f7d6173, + 0xa4d82d1c, 0xd346ffec, 0x48e3b383, 0x3a772cf2, 0xa1d2609d, + 0xd64cb26d, 0x4de9fe02, 0x3971178d, 0xa2d45be2, 0xd54a8912, + 0x4eefc57d, 0x28526c08, 0xb3f72067, 0xc469f297, 0x5fccbef8, + 0x2b545777, 0xb0f11b18, 0xc76fc9e8, 0x5cca8587, 0x2e5e1af6, + 0xb5fb5699, 0xc2658469, 0x59c0c806, 0x2d582189, 0xb6fd6de6, + 0xc163bf16, 0x5ac6f379, 0x244a81f4, 0xbfefcd9b, 0xc8711f6b, + 0x53d45304, 0x274cba8b, 0xbce9f6e4, 0xcb772414, 0x50d2687b, + 0x2246f70a, 0xb9e3bb65, 0xce7d6995, 0x55d825fa, 0x2140cc75, + 0xbae5801a, 0xcd7b52ea, 0x56de1e85, 0x60c76fe0, 0xfb62238f, + 0x8cfcf17f, 0x1759bd10, 0x63c1549f, 0xf86418f0, 0x8ffaca00, + 0x145f866f, 0x66cb191e, 0xfd6e5571, 0x8af08781, 0x1155cbee, + 0x65cd2261, 0xfe686e0e, 0x89f6bcfe, 0x1253f091, 0x6cdf821c, + 0xf77ace73, 0x80e41c83, 0x1b4150ec, 0x6fd9b963, 0xf47cf50c, + 0x83e227fc, 0x18476b93, 0x6ad3f4e2, 0xf176b88d, 0x86e86a7d, + 0x1d4d2612, 0x69d5cf9d, 0xf27083f2, 0x85ee5102, 0x1e4b1d6d, + 0x78f6b418, 0xe353f877, 0x94cd2a87, 0x0f6866e8, 0x7bf08f67, + 0xe055c308, 0x97cb11f8, 0x0c6e5d97, 0x7efac2e6, 0xe55f8e89, + 0x92c15c79, 0x09641016, 0x7dfcf999, 0xe659b5f6, 0x91c76706, + 0x0a622b69, 0x74ee59e4, 0xef4b158b, 0x98d5c77b, 0x03708b14, + 0x77e8629b, 0xec4d2ef4, 0x9bd3fc04, 0x0076b06b, 0x72e22f1a, + 0xe9476375, 0x9ed9b185, 0x057cfdea, 0x71e41465, 0xea41580a, + 0x9ddf8afa, 0x067ac695, 0x50a4d810, 0xcb01947f, 0xbc9f468f, + 0x273a0ae0, 0x53a2e36f, 0xc807af00, 0xbf997df0, 0x243c319f, + 0x56a8aeee, 0xcd0de281, 0xba933071, 0x21367c1e, 0x55ae9591, + 0xce0bd9fe, 0xb9950b0e, 0x22304761, 0x5cbc35ec, 0xc7197983, + 0xb087ab73, 0x2b22e71c, 0x5fba0e93, 0xc41f42fc, 0xb381900c, + 0x2824dc63, 0x5ab04312, 0xc1150f7d, 0xb68bdd8d, 0x2d2e91e2, + 0x59b6786d, 0xc2133402, 0xb58de6f2, 0x2e28aa9d, 0x489503e8, + 0xd3304f87, 0xa4ae9d77, 0x3f0bd118, 0x4b933897, 0xd03674f8, + 0xa7a8a608, 0x3c0dea67, 0x4e997516, 0xd53c3979, 0xa2a2eb89, + 0x3907a7e6, 0x4d9f4e69, 0xd63a0206, 0xa1a4d0f6, 0x3a019c99, + 0x448dee14, 0xdf28a27b, 0xa8b6708b, 0x33133ce4, 0x478bd56b, + 0xdc2e9904, 0xabb04bf4, 0x3015079b, 0x428198ea, 0xd924d485, + 0xaeba0675, 0x351f4a1a, 0x4187a395, 0xda22effa, 0xadbc3d0a, + 0x36197165}, + {0x00000000, 0xc18edfc0, 0x586cb9c1, 0x99e26601, 0xb0d97382, + 0x7157ac42, 0xe8b5ca43, 0x293b1583, 0xbac3e145, 0x7b4d3e85, + 0xe2af5884, 0x23218744, 0x0a1a92c7, 0xcb944d07, 0x52762b06, + 0x93f8f4c6, 0xaef6c4cb, 0x6f781b0b, 0xf69a7d0a, 0x3714a2ca, + 0x1e2fb749, 0xdfa16889, 0x46430e88, 0x87cdd148, 0x1435258e, + 0xd5bbfa4e, 0x4c599c4f, 0x8dd7438f, 0xa4ec560c, 0x656289cc, + 0xfc80efcd, 0x3d0e300d, 0x869c8fd7, 0x47125017, 0xdef03616, + 0x1f7ee9d6, 0x3645fc55, 0xf7cb2395, 0x6e294594, 0xafa79a54, + 0x3c5f6e92, 0xfdd1b152, 0x6433d753, 0xa5bd0893, 0x8c861d10, + 0x4d08c2d0, 0xd4eaa4d1, 0x15647b11, 0x286a4b1c, 0xe9e494dc, + 0x7006f2dd, 0xb1882d1d, 0x98b3389e, 0x593de75e, 0xc0df815f, + 0x01515e9f, 0x92a9aa59, 0x53277599, 0xcac51398, 0x0b4bcc58, + 0x2270d9db, 0xe3fe061b, 0x7a1c601a, 0xbb92bfda, 0xd64819ef, + 0x17c6c62f, 0x8e24a02e, 0x4faa7fee, 0x66916a6d, 0xa71fb5ad, + 0x3efdd3ac, 0xff730c6c, 0x6c8bf8aa, 0xad05276a, 0x34e7416b, + 0xf5699eab, 0xdc528b28, 0x1ddc54e8, 0x843e32e9, 0x45b0ed29, + 0x78bedd24, 0xb93002e4, 0x20d264e5, 0xe15cbb25, 0xc867aea6, + 0x09e97166, 0x900b1767, 0x5185c8a7, 0xc27d3c61, 0x03f3e3a1, + 0x9a1185a0, 0x5b9f5a60, 0x72a44fe3, 0xb32a9023, 0x2ac8f622, + 0xeb4629e2, 0x50d49638, 0x915a49f8, 0x08b82ff9, 0xc936f039, + 0xe00de5ba, 0x21833a7a, 0xb8615c7b, 0x79ef83bb, 0xea17777d, + 0x2b99a8bd, 0xb27bcebc, 0x73f5117c, 0x5ace04ff, 0x9b40db3f, + 0x02a2bd3e, 0xc32c62fe, 0xfe2252f3, 0x3fac8d33, 0xa64eeb32, + 0x67c034f2, 0x4efb2171, 0x8f75feb1, 0x169798b0, 0xd7194770, + 0x44e1b3b6, 0x856f6c76, 0x1c8d0a77, 0xdd03d5b7, 0xf438c034, + 0x35b61ff4, 0xac5479f5, 0x6ddaa635, 0x77e1359f, 0xb66fea5f, + 0x2f8d8c5e, 0xee03539e, 0xc738461d, 0x06b699dd, 0x9f54ffdc, + 0x5eda201c, 0xcd22d4da, 0x0cac0b1a, 0x954e6d1b, 0x54c0b2db, + 0x7dfba758, 0xbc757898, 0x25971e99, 0xe419c159, 0xd917f154, + 0x18992e94, 0x817b4895, 0x40f59755, 0x69ce82d6, 0xa8405d16, + 0x31a23b17, 0xf02ce4d7, 0x63d41011, 0xa25acfd1, 0x3bb8a9d0, + 0xfa367610, 0xd30d6393, 0x1283bc53, 0x8b61da52, 0x4aef0592, + 0xf17dba48, 0x30f36588, 0xa9110389, 0x689fdc49, 0x41a4c9ca, + 0x802a160a, 0x19c8700b, 0xd846afcb, 0x4bbe5b0d, 0x8a3084cd, + 0x13d2e2cc, 0xd25c3d0c, 0xfb67288f, 0x3ae9f74f, 0xa30b914e, + 0x62854e8e, 0x5f8b7e83, 0x9e05a143, 0x07e7c742, 0xc6691882, + 0xef520d01, 0x2edcd2c1, 0xb73eb4c0, 0x76b06b00, 0xe5489fc6, + 0x24c64006, 0xbd242607, 0x7caaf9c7, 0x5591ec44, 0x941f3384, + 0x0dfd5585, 0xcc738a45, 0xa1a92c70, 0x6027f3b0, 0xf9c595b1, + 0x384b4a71, 0x11705ff2, 0xd0fe8032, 0x491ce633, 0x889239f3, + 0x1b6acd35, 0xdae412f5, 0x430674f4, 0x8288ab34, 0xabb3beb7, + 0x6a3d6177, 0xf3df0776, 0x3251d8b6, 0x0f5fe8bb, 0xced1377b, + 0x5733517a, 0x96bd8eba, 0xbf869b39, 0x7e0844f9, 0xe7ea22f8, + 0x2664fd38, 0xb59c09fe, 0x7412d63e, 0xedf0b03f, 0x2c7e6fff, + 0x05457a7c, 0xc4cba5bc, 0x5d29c3bd, 0x9ca71c7d, 0x2735a3a7, + 0xe6bb7c67, 0x7f591a66, 0xbed7c5a6, 0x97ecd025, 0x56620fe5, + 0xcf8069e4, 0x0e0eb624, 0x9df642e2, 0x5c789d22, 0xc59afb23, + 0x041424e3, 0x2d2f3160, 0xeca1eea0, 0x754388a1, 0xb4cd5761, + 0x89c3676c, 0x484db8ac, 0xd1afdead, 0x1021016d, 0x391a14ee, + 0xf894cb2e, 0x6176ad2f, 0xa0f872ef, 0x33008629, 0xf28e59e9, + 0x6b6c3fe8, 0xaae2e028, 0x83d9f5ab, 0x42572a6b, 0xdbb54c6a, + 0x1a3b93aa}, + {0x00000000, 0xefc26b3e, 0x04f5d03d, 0xeb37bb03, 0x09eba07a, + 0xe629cb44, 0x0d1e7047, 0xe2dc1b79, 0x13d740f4, 0xfc152bca, + 0x172290c9, 0xf8e0fbf7, 0x1a3ce08e, 0xf5fe8bb0, 0x1ec930b3, + 0xf10b5b8d, 0x27ae81e8, 0xc86cead6, 0x235b51d5, 0xcc993aeb, + 0x2e452192, 0xc1874aac, 0x2ab0f1af, 0xc5729a91, 0x3479c11c, + 0xdbbbaa22, 0x308c1121, 0xdf4e7a1f, 0x3d926166, 0xd2500a58, + 0x3967b15b, 0xd6a5da65, 0x4f5d03d0, 0xa09f68ee, 0x4ba8d3ed, + 0xa46ab8d3, 0x46b6a3aa, 0xa974c894, 0x42437397, 0xad8118a9, + 0x5c8a4324, 0xb348281a, 0x587f9319, 0xb7bdf827, 0x5561e35e, + 0xbaa38860, 0x51943363, 0xbe56585d, 0x68f38238, 0x8731e906, + 0x6c065205, 0x83c4393b, 0x61182242, 0x8eda497c, 0x65edf27f, + 0x8a2f9941, 0x7b24c2cc, 0x94e6a9f2, 0x7fd112f1, 0x901379cf, + 0x72cf62b6, 0x9d0d0988, 0x763ab28b, 0x99f8d9b5, 0x9eba07a0, + 0x71786c9e, 0x9a4fd79d, 0x758dbca3, 0x9751a7da, 0x7893cce4, + 0x93a477e7, 0x7c661cd9, 0x8d6d4754, 0x62af2c6a, 0x89989769, + 0x665afc57, 0x8486e72e, 0x6b448c10, 0x80733713, 0x6fb15c2d, + 0xb9148648, 0x56d6ed76, 0xbde15675, 0x52233d4b, 0xb0ff2632, + 0x5f3d4d0c, 0xb40af60f, 0x5bc89d31, 0xaac3c6bc, 0x4501ad82, + 0xae361681, 0x41f47dbf, 0xa32866c6, 0x4cea0df8, 0xa7ddb6fb, + 0x481fddc5, 0xd1e70470, 0x3e256f4e, 0xd512d44d, 0x3ad0bf73, + 0xd80ca40a, 0x37cecf34, 0xdcf97437, 0x333b1f09, 0xc2304484, + 0x2df22fba, 0xc6c594b9, 0x2907ff87, 0xcbdbe4fe, 0x24198fc0, + 0xcf2e34c3, 0x20ec5ffd, 0xf6498598, 0x198beea6, 0xf2bc55a5, + 0x1d7e3e9b, 0xffa225e2, 0x10604edc, 0xfb57f5df, 0x14959ee1, + 0xe59ec56c, 0x0a5cae52, 0xe16b1551, 0x0ea97e6f, 0xec756516, + 0x03b70e28, 0xe880b52b, 0x0742de15, 0xe6050901, 0x09c7623f, + 0xe2f0d93c, 0x0d32b202, 0xefeea97b, 0x002cc245, 0xeb1b7946, + 0x04d91278, 0xf5d249f5, 0x1a1022cb, 0xf12799c8, 0x1ee5f2f6, + 0xfc39e98f, 0x13fb82b1, 0xf8cc39b2, 0x170e528c, 0xc1ab88e9, + 0x2e69e3d7, 0xc55e58d4, 0x2a9c33ea, 0xc8402893, 0x278243ad, + 0xccb5f8ae, 0x23779390, 0xd27cc81d, 0x3dbea323, 0xd6891820, + 0x394b731e, 0xdb976867, 0x34550359, 0xdf62b85a, 0x30a0d364, + 0xa9580ad1, 0x469a61ef, 0xadaddaec, 0x426fb1d2, 0xa0b3aaab, + 0x4f71c195, 0xa4467a96, 0x4b8411a8, 0xba8f4a25, 0x554d211b, + 0xbe7a9a18, 0x51b8f126, 0xb364ea5f, 0x5ca68161, 0xb7913a62, + 0x5853515c, 0x8ef68b39, 0x6134e007, 0x8a035b04, 0x65c1303a, + 0x871d2b43, 0x68df407d, 0x83e8fb7e, 0x6c2a9040, 0x9d21cbcd, + 0x72e3a0f3, 0x99d41bf0, 0x761670ce, 0x94ca6bb7, 0x7b080089, + 0x903fbb8a, 0x7ffdd0b4, 0x78bf0ea1, 0x977d659f, 0x7c4ade9c, + 0x9388b5a2, 0x7154aedb, 0x9e96c5e5, 0x75a17ee6, 0x9a6315d8, + 0x6b684e55, 0x84aa256b, 0x6f9d9e68, 0x805ff556, 0x6283ee2f, + 0x8d418511, 0x66763e12, 0x89b4552c, 0x5f118f49, 0xb0d3e477, + 0x5be45f74, 0xb426344a, 0x56fa2f33, 0xb938440d, 0x520fff0e, + 0xbdcd9430, 0x4cc6cfbd, 0xa304a483, 0x48331f80, 0xa7f174be, + 0x452d6fc7, 0xaaef04f9, 0x41d8bffa, 0xae1ad4c4, 0x37e20d71, + 0xd820664f, 0x3317dd4c, 0xdcd5b672, 0x3e09ad0b, 0xd1cbc635, + 0x3afc7d36, 0xd53e1608, 0x24354d85, 0xcbf726bb, 0x20c09db8, + 0xcf02f686, 0x2ddeedff, 0xc21c86c1, 0x292b3dc2, 0xc6e956fc, + 0x104c8c99, 0xff8ee7a7, 0x14b95ca4, 0xfb7b379a, 0x19a72ce3, + 0xf66547dd, 0x1d52fcde, 0xf29097e0, 0x039bcc6d, 0xec59a753, + 0x076e1c50, 0xe8ac776e, 0x0a706c17, 0xe5b20729, 0x0e85bc2a, + 0xe147d714}, + {0x00000000, 0x177b1443, 0x2ef62886, 0x398d3cc5, 0x5dec510c, + 0x4a97454f, 0x731a798a, 0x64616dc9, 0xbbd8a218, 0xaca3b65b, + 0x952e8a9e, 0x82559edd, 0xe634f314, 0xf14fe757, 0xc8c2db92, + 0xdfb9cfd1, 0xacc04271, 0xbbbb5632, 0x82366af7, 0x954d7eb4, + 0xf12c137d, 0xe657073e, 0xdfda3bfb, 0xc8a12fb8, 0x1718e069, + 0x0063f42a, 0x39eec8ef, 0x2e95dcac, 0x4af4b165, 0x5d8fa526, + 0x640299e3, 0x73798da0, 0x82f182a3, 0x958a96e0, 0xac07aa25, + 0xbb7cbe66, 0xdf1dd3af, 0xc866c7ec, 0xf1ebfb29, 0xe690ef6a, + 0x392920bb, 0x2e5234f8, 0x17df083d, 0x00a41c7e, 0x64c571b7, + 0x73be65f4, 0x4a335931, 0x5d484d72, 0x2e31c0d2, 0x394ad491, + 0x00c7e854, 0x17bcfc17, 0x73dd91de, 0x64a6859d, 0x5d2bb958, + 0x4a50ad1b, 0x95e962ca, 0x82927689, 0xbb1f4a4c, 0xac645e0f, + 0xc80533c6, 0xdf7e2785, 0xe6f31b40, 0xf1880f03, 0xde920307, + 0xc9e91744, 0xf0642b81, 0xe71f3fc2, 0x837e520b, 0x94054648, + 0xad887a8d, 0xbaf36ece, 0x654aa11f, 0x7231b55c, 0x4bbc8999, + 0x5cc79dda, 0x38a6f013, 0x2fdde450, 0x1650d895, 0x012bccd6, + 0x72524176, 0x65295535, 0x5ca469f0, 0x4bdf7db3, 0x2fbe107a, + 0x38c50439, 0x014838fc, 0x16332cbf, 0xc98ae36e, 0xdef1f72d, + 0xe77ccbe8, 0xf007dfab, 0x9466b262, 0x831da621, 0xba909ae4, + 0xadeb8ea7, 0x5c6381a4, 0x4b1895e7, 0x7295a922, 0x65eebd61, + 0x018fd0a8, 0x16f4c4eb, 0x2f79f82e, 0x3802ec6d, 0xe7bb23bc, + 0xf0c037ff, 0xc94d0b3a, 0xde361f79, 0xba5772b0, 0xad2c66f3, + 0x94a15a36, 0x83da4e75, 0xf0a3c3d5, 0xe7d8d796, 0xde55eb53, + 0xc92eff10, 0xad4f92d9, 0xba34869a, 0x83b9ba5f, 0x94c2ae1c, + 0x4b7b61cd, 0x5c00758e, 0x658d494b, 0x72f65d08, 0x169730c1, + 0x01ec2482, 0x38611847, 0x2f1a0c04, 0x6655004f, 0x712e140c, + 0x48a328c9, 0x5fd83c8a, 0x3bb95143, 0x2cc24500, 0x154f79c5, + 0x02346d86, 0xdd8da257, 0xcaf6b614, 0xf37b8ad1, 0xe4009e92, + 0x8061f35b, 0x971ae718, 0xae97dbdd, 0xb9eccf9e, 0xca95423e, + 0xddee567d, 0xe4636ab8, 0xf3187efb, 0x97791332, 0x80020771, + 0xb98f3bb4, 0xaef42ff7, 0x714de026, 0x6636f465, 0x5fbbc8a0, + 0x48c0dce3, 0x2ca1b12a, 0x3bdaa569, 0x025799ac, 0x152c8def, + 0xe4a482ec, 0xf3df96af, 0xca52aa6a, 0xdd29be29, 0xb948d3e0, + 0xae33c7a3, 0x97befb66, 0x80c5ef25, 0x5f7c20f4, 0x480734b7, + 0x718a0872, 0x66f11c31, 0x029071f8, 0x15eb65bb, 0x2c66597e, + 0x3b1d4d3d, 0x4864c09d, 0x5f1fd4de, 0x6692e81b, 0x71e9fc58, + 0x15889191, 0x02f385d2, 0x3b7eb917, 0x2c05ad54, 0xf3bc6285, + 0xe4c776c6, 0xdd4a4a03, 0xca315e40, 0xae503389, 0xb92b27ca, + 0x80a61b0f, 0x97dd0f4c, 0xb8c70348, 0xafbc170b, 0x96312bce, + 0x814a3f8d, 0xe52b5244, 0xf2504607, 0xcbdd7ac2, 0xdca66e81, + 0x031fa150, 0x1464b513, 0x2de989d6, 0x3a929d95, 0x5ef3f05c, + 0x4988e41f, 0x7005d8da, 0x677ecc99, 0x14074139, 0x037c557a, + 0x3af169bf, 0x2d8a7dfc, 0x49eb1035, 0x5e900476, 0x671d38b3, + 0x70662cf0, 0xafdfe321, 0xb8a4f762, 0x8129cba7, 0x9652dfe4, + 0xf233b22d, 0xe548a66e, 0xdcc59aab, 0xcbbe8ee8, 0x3a3681eb, + 0x2d4d95a8, 0x14c0a96d, 0x03bbbd2e, 0x67dad0e7, 0x70a1c4a4, + 0x492cf861, 0x5e57ec22, 0x81ee23f3, 0x969537b0, 0xaf180b75, + 0xb8631f36, 0xdc0272ff, 0xcb7966bc, 0xf2f45a79, 0xe58f4e3a, + 0x96f6c39a, 0x818dd7d9, 0xb800eb1c, 0xaf7bff5f, 0xcb1a9296, + 0xdc6186d5, 0xe5ecba10, 0xf297ae53, 0x2d2e6182, 0x3a5575c1, + 0x03d84904, 0x14a35d47, 0x70c2308e, 0x67b924cd, 0x5e341808, + 0x494f0c4b}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x43147b17, 0x8628f62e, 0xc53c8d39, 0x0c51ec5d, + 0x4f45974a, 0x8a791a73, 0xc96d6164, 0x18a2d8bb, 0x5bb6a3ac, + 0x9e8a2e95, 0xdd9e5582, 0x14f334e6, 0x57e74ff1, 0x92dbc2c8, + 0xd1cfb9df, 0x7142c0ac, 0x3256bbbb, 0xf76a3682, 0xb47e4d95, + 0x7d132cf1, 0x3e0757e6, 0xfb3bdadf, 0xb82fa1c8, 0x69e01817, + 0x2af46300, 0xefc8ee39, 0xacdc952e, 0x65b1f44a, 0x26a58f5d, + 0xe3990264, 0xa08d7973, 0xa382f182, 0xe0968a95, 0x25aa07ac, + 0x66be7cbb, 0xafd31ddf, 0xecc766c8, 0x29fbebf1, 0x6aef90e6, + 0xbb202939, 0xf834522e, 0x3d08df17, 0x7e1ca400, 0xb771c564, + 0xf465be73, 0x3159334a, 0x724d485d, 0xd2c0312e, 0x91d44a39, + 0x54e8c700, 0x17fcbc17, 0xde91dd73, 0x9d85a664, 0x58b92b5d, + 0x1bad504a, 0xca62e995, 0x89769282, 0x4c4a1fbb, 0x0f5e64ac, + 0xc63305c8, 0x85277edf, 0x401bf3e6, 0x030f88f1, 0x070392de, + 0x4417e9c9, 0x812b64f0, 0xc23f1fe7, 0x0b527e83, 0x48460594, + 0x8d7a88ad, 0xce6ef3ba, 0x1fa14a65, 0x5cb53172, 0x9989bc4b, + 0xda9dc75c, 0x13f0a638, 0x50e4dd2f, 0x95d85016, 0xd6cc2b01, + 0x76415272, 0x35552965, 0xf069a45c, 0xb37ddf4b, 0x7a10be2f, + 0x3904c538, 0xfc384801, 0xbf2c3316, 0x6ee38ac9, 0x2df7f1de, + 0xe8cb7ce7, 0xabdf07f0, 0x62b26694, 0x21a61d83, 0xe49a90ba, + 0xa78eebad, 0xa481635c, 0xe795184b, 0x22a99572, 0x61bdee65, + 0xa8d08f01, 0xebc4f416, 0x2ef8792f, 0x6dec0238, 0xbc23bbe7, + 0xff37c0f0, 0x3a0b4dc9, 0x791f36de, 0xb07257ba, 0xf3662cad, + 0x365aa194, 0x754eda83, 0xd5c3a3f0, 0x96d7d8e7, 0x53eb55de, + 0x10ff2ec9, 0xd9924fad, 0x9a8634ba, 0x5fbab983, 0x1caec294, + 0xcd617b4b, 0x8e75005c, 0x4b498d65, 0x085df672, 0xc1309716, + 0x8224ec01, 0x47186138, 0x040c1a2f, 0x4f005566, 0x0c142e71, + 0xc928a348, 0x8a3cd85f, 0x4351b93b, 0x0045c22c, 0xc5794f15, + 0x866d3402, 0x57a28ddd, 0x14b6f6ca, 0xd18a7bf3, 0x929e00e4, + 0x5bf36180, 0x18e71a97, 0xdddb97ae, 0x9ecfecb9, 0x3e4295ca, + 0x7d56eedd, 0xb86a63e4, 0xfb7e18f3, 0x32137997, 0x71070280, + 0xb43b8fb9, 0xf72ff4ae, 0x26e04d71, 0x65f43666, 0xa0c8bb5f, + 0xe3dcc048, 0x2ab1a12c, 0x69a5da3b, 0xac995702, 0xef8d2c15, + 0xec82a4e4, 0xaf96dff3, 0x6aaa52ca, 0x29be29dd, 0xe0d348b9, + 0xa3c733ae, 0x66fbbe97, 0x25efc580, 0xf4207c5f, 0xb7340748, + 0x72088a71, 0x311cf166, 0xf8719002, 0xbb65eb15, 0x7e59662c, + 0x3d4d1d3b, 0x9dc06448, 0xded41f5f, 0x1be89266, 0x58fce971, + 0x91918815, 0xd285f302, 0x17b97e3b, 0x54ad052c, 0x8562bcf3, + 0xc676c7e4, 0x034a4add, 0x405e31ca, 0x893350ae, 0xca272bb9, + 0x0f1ba680, 0x4c0fdd97, 0x4803c7b8, 0x0b17bcaf, 0xce2b3196, + 0x8d3f4a81, 0x44522be5, 0x074650f2, 0xc27addcb, 0x816ea6dc, + 0x50a11f03, 0x13b56414, 0xd689e92d, 0x959d923a, 0x5cf0f35e, + 0x1fe48849, 0xdad80570, 0x99cc7e67, 0x39410714, 0x7a557c03, + 0xbf69f13a, 0xfc7d8a2d, 0x3510eb49, 0x7604905e, 0xb3381d67, + 0xf02c6670, 0x21e3dfaf, 0x62f7a4b8, 0xa7cb2981, 0xe4df5296, + 0x2db233f2, 0x6ea648e5, 0xab9ac5dc, 0xe88ebecb, 0xeb81363a, + 0xa8954d2d, 0x6da9c014, 0x2ebdbb03, 0xe7d0da67, 0xa4c4a170, + 0x61f82c49, 0x22ec575e, 0xf323ee81, 0xb0379596, 0x750b18af, + 0x361f63b8, 0xff7202dc, 0xbc6679cb, 0x795af4f2, 0x3a4e8fe5, + 0x9ac3f696, 0xd9d78d81, 0x1ceb00b8, 0x5fff7baf, 0x96921acb, + 0xd58661dc, 0x10baece5, 0x53ae97f2, 0x82612e2d, 0xc175553a, + 0x0449d803, 0x475da314, 0x8e30c270, 0xcd24b967, 0x0818345e, + 0x4b0c4f49}, + {0x00000000, 0x3e6bc2ef, 0x3dd0f504, 0x03bb37eb, 0x7aa0eb09, + 0x44cb29e6, 0x47701e0d, 0x791bdce2, 0xf440d713, 0xca2b15fc, + 0xc9902217, 0xf7fbe0f8, 0x8ee03c1a, 0xb08bfef5, 0xb330c91e, + 0x8d5b0bf1, 0xe881ae27, 0xd6ea6cc8, 0xd5515b23, 0xeb3a99cc, + 0x9221452e, 0xac4a87c1, 0xaff1b02a, 0x919a72c5, 0x1cc17934, + 0x22aabbdb, 0x21118c30, 0x1f7a4edf, 0x6661923d, 0x580a50d2, + 0x5bb16739, 0x65daa5d6, 0xd0035d4f, 0xee689fa0, 0xedd3a84b, + 0xd3b86aa4, 0xaaa3b646, 0x94c874a9, 0x97734342, 0xa91881ad, + 0x24438a5c, 0x1a2848b3, 0x19937f58, 0x27f8bdb7, 0x5ee36155, + 0x6088a3ba, 0x63339451, 0x5d5856be, 0x3882f368, 0x06e93187, + 0x0552066c, 0x3b39c483, 0x42221861, 0x7c49da8e, 0x7ff2ed65, + 0x41992f8a, 0xccc2247b, 0xf2a9e694, 0xf112d17f, 0xcf791390, + 0xb662cf72, 0x88090d9d, 0x8bb23a76, 0xb5d9f899, 0xa007ba9e, + 0x9e6c7871, 0x9dd74f9a, 0xa3bc8d75, 0xdaa75197, 0xe4cc9378, + 0xe777a493, 0xd91c667c, 0x54476d8d, 0x6a2caf62, 0x69979889, + 0x57fc5a66, 0x2ee78684, 0x108c446b, 0x13377380, 0x2d5cb16f, + 0x488614b9, 0x76edd656, 0x7556e1bd, 0x4b3d2352, 0x3226ffb0, + 0x0c4d3d5f, 0x0ff60ab4, 0x319dc85b, 0xbcc6c3aa, 0x82ad0145, + 0x811636ae, 0xbf7df441, 0xc66628a3, 0xf80dea4c, 0xfbb6dda7, + 0xc5dd1f48, 0x7004e7d1, 0x4e6f253e, 0x4dd412d5, 0x73bfd03a, + 0x0aa40cd8, 0x34cfce37, 0x3774f9dc, 0x091f3b33, 0x844430c2, + 0xba2ff22d, 0xb994c5c6, 0x87ff0729, 0xfee4dbcb, 0xc08f1924, + 0xc3342ecf, 0xfd5fec20, 0x988549f6, 0xa6ee8b19, 0xa555bcf2, + 0x9b3e7e1d, 0xe225a2ff, 0xdc4e6010, 0xdff557fb, 0xe19e9514, + 0x6cc59ee5, 0x52ae5c0a, 0x51156be1, 0x6f7ea90e, 0x166575ec, + 0x280eb703, 0x2bb580e8, 0x15de4207, 0x010905e6, 0x3f62c709, + 0x3cd9f0e2, 0x02b2320d, 0x7ba9eeef, 0x45c22c00, 0x46791beb, + 0x7812d904, 0xf549d2f5, 0xcb22101a, 0xc89927f1, 0xf6f2e51e, + 0x8fe939fc, 0xb182fb13, 0xb239ccf8, 0x8c520e17, 0xe988abc1, + 0xd7e3692e, 0xd4585ec5, 0xea339c2a, 0x932840c8, 0xad438227, + 0xaef8b5cc, 0x90937723, 0x1dc87cd2, 0x23a3be3d, 0x201889d6, + 0x1e734b39, 0x676897db, 0x59035534, 0x5ab862df, 0x64d3a030, + 0xd10a58a9, 0xef619a46, 0xecdaadad, 0xd2b16f42, 0xabaab3a0, + 0x95c1714f, 0x967a46a4, 0xa811844b, 0x254a8fba, 0x1b214d55, + 0x189a7abe, 0x26f1b851, 0x5fea64b3, 0x6181a65c, 0x623a91b7, + 0x5c515358, 0x398bf68e, 0x07e03461, 0x045b038a, 0x3a30c165, + 0x432b1d87, 0x7d40df68, 0x7efbe883, 0x40902a6c, 0xcdcb219d, + 0xf3a0e372, 0xf01bd499, 0xce701676, 0xb76bca94, 0x8900087b, + 0x8abb3f90, 0xb4d0fd7f, 0xa10ebf78, 0x9f657d97, 0x9cde4a7c, + 0xa2b58893, 0xdbae5471, 0xe5c5969e, 0xe67ea175, 0xd815639a, + 0x554e686b, 0x6b25aa84, 0x689e9d6f, 0x56f55f80, 0x2fee8362, + 0x1185418d, 0x123e7666, 0x2c55b489, 0x498f115f, 0x77e4d3b0, + 0x745fe45b, 0x4a3426b4, 0x332ffa56, 0x0d4438b9, 0x0eff0f52, + 0x3094cdbd, 0xbdcfc64c, 0x83a404a3, 0x801f3348, 0xbe74f1a7, + 0xc76f2d45, 0xf904efaa, 0xfabfd841, 0xc4d41aae, 0x710de237, + 0x4f6620d8, 0x4cdd1733, 0x72b6d5dc, 0x0bad093e, 0x35c6cbd1, + 0x367dfc3a, 0x08163ed5, 0x854d3524, 0xbb26f7cb, 0xb89dc020, + 0x86f602cf, 0xffedde2d, 0xc1861cc2, 0xc23d2b29, 0xfc56e9c6, + 0x998c4c10, 0xa7e78eff, 0xa45cb914, 0x9a377bfb, 0xe32ca719, + 0xdd4765f6, 0xdefc521d, 0xe09790f2, 0x6dcc9b03, 0x53a759ec, + 0x501c6e07, 0x6e77ace8, 0x176c700a, 0x2907b2e5, 0x2abc850e, + 0x14d747e1}, + {0x00000000, 0xc0df8ec1, 0xc1b96c58, 0x0166e299, 0x8273d9b0, + 0x42ac5771, 0x43cab5e8, 0x83153b29, 0x45e1c3ba, 0x853e4d7b, + 0x8458afe2, 0x44872123, 0xc7921a0a, 0x074d94cb, 0x062b7652, + 0xc6f4f893, 0xcbc4f6ae, 0x0b1b786f, 0x0a7d9af6, 0xcaa21437, + 0x49b72f1e, 0x8968a1df, 0x880e4346, 0x48d1cd87, 0x8e253514, + 0x4efabbd5, 0x4f9c594c, 0x8f43d78d, 0x0c56eca4, 0xcc896265, + 0xcdef80fc, 0x0d300e3d, 0xd78f9c86, 0x17501247, 0x1636f0de, + 0xd6e97e1f, 0x55fc4536, 0x9523cbf7, 0x9445296e, 0x549aa7af, + 0x926e5f3c, 0x52b1d1fd, 0x53d73364, 0x9308bda5, 0x101d868c, + 0xd0c2084d, 0xd1a4ead4, 0x117b6415, 0x1c4b6a28, 0xdc94e4e9, + 0xddf20670, 0x1d2d88b1, 0x9e38b398, 0x5ee73d59, 0x5f81dfc0, + 0x9f5e5101, 0x59aaa992, 0x99752753, 0x9813c5ca, 0x58cc4b0b, + 0xdbd97022, 0x1b06fee3, 0x1a601c7a, 0xdabf92bb, 0xef1948d6, + 0x2fc6c617, 0x2ea0248e, 0xee7faa4f, 0x6d6a9166, 0xadb51fa7, + 0xacd3fd3e, 0x6c0c73ff, 0xaaf88b6c, 0x6a2705ad, 0x6b41e734, + 0xab9e69f5, 0x288b52dc, 0xe854dc1d, 0xe9323e84, 0x29edb045, + 0x24ddbe78, 0xe40230b9, 0xe564d220, 0x25bb5ce1, 0xa6ae67c8, + 0x6671e909, 0x67170b90, 0xa7c88551, 0x613c7dc2, 0xa1e3f303, + 0xa085119a, 0x605a9f5b, 0xe34fa472, 0x23902ab3, 0x22f6c82a, + 0xe22946eb, 0x3896d450, 0xf8495a91, 0xf92fb808, 0x39f036c9, + 0xbae50de0, 0x7a3a8321, 0x7b5c61b8, 0xbb83ef79, 0x7d7717ea, + 0xbda8992b, 0xbcce7bb2, 0x7c11f573, 0xff04ce5a, 0x3fdb409b, + 0x3ebda202, 0xfe622cc3, 0xf35222fe, 0x338dac3f, 0x32eb4ea6, + 0xf234c067, 0x7121fb4e, 0xb1fe758f, 0xb0989716, 0x704719d7, + 0xb6b3e144, 0x766c6f85, 0x770a8d1c, 0xb7d503dd, 0x34c038f4, + 0xf41fb635, 0xf57954ac, 0x35a6da6d, 0x9f35e177, 0x5fea6fb6, + 0x5e8c8d2f, 0x9e5303ee, 0x1d4638c7, 0xdd99b606, 0xdcff549f, + 0x1c20da5e, 0xdad422cd, 0x1a0bac0c, 0x1b6d4e95, 0xdbb2c054, + 0x58a7fb7d, 0x987875bc, 0x991e9725, 0x59c119e4, 0x54f117d9, + 0x942e9918, 0x95487b81, 0x5597f540, 0xd682ce69, 0x165d40a8, + 0x173ba231, 0xd7e42cf0, 0x1110d463, 0xd1cf5aa2, 0xd0a9b83b, + 0x107636fa, 0x93630dd3, 0x53bc8312, 0x52da618b, 0x9205ef4a, + 0x48ba7df1, 0x8865f330, 0x890311a9, 0x49dc9f68, 0xcac9a441, + 0x0a162a80, 0x0b70c819, 0xcbaf46d8, 0x0d5bbe4b, 0xcd84308a, + 0xcce2d213, 0x0c3d5cd2, 0x8f2867fb, 0x4ff7e93a, 0x4e910ba3, + 0x8e4e8562, 0x837e8b5f, 0x43a1059e, 0x42c7e707, 0x821869c6, + 0x010d52ef, 0xc1d2dc2e, 0xc0b43eb7, 0x006bb076, 0xc69f48e5, + 0x0640c624, 0x072624bd, 0xc7f9aa7c, 0x44ec9155, 0x84331f94, + 0x8555fd0d, 0x458a73cc, 0x702ca9a1, 0xb0f32760, 0xb195c5f9, + 0x714a4b38, 0xf25f7011, 0x3280fed0, 0x33e61c49, 0xf3399288, + 0x35cd6a1b, 0xf512e4da, 0xf4740643, 0x34ab8882, 0xb7beb3ab, + 0x77613d6a, 0x7607dff3, 0xb6d85132, 0xbbe85f0f, 0x7b37d1ce, + 0x7a513357, 0xba8ebd96, 0x399b86bf, 0xf944087e, 0xf822eae7, + 0x38fd6426, 0xfe099cb5, 0x3ed61274, 0x3fb0f0ed, 0xff6f7e2c, + 0x7c7a4505, 0xbca5cbc4, 0xbdc3295d, 0x7d1ca79c, 0xa7a33527, + 0x677cbbe6, 0x661a597f, 0xa6c5d7be, 0x25d0ec97, 0xe50f6256, + 0xe46980cf, 0x24b60e0e, 0xe242f69d, 0x229d785c, 0x23fb9ac5, + 0xe3241404, 0x60312f2d, 0xa0eea1ec, 0xa1884375, 0x6157cdb4, + 0x6c67c389, 0xacb84d48, 0xaddeafd1, 0x6d012110, 0xee141a39, + 0x2ecb94f8, 0x2fad7661, 0xef72f8a0, 0x29860033, 0xe9598ef2, + 0xe83f6c6b, 0x28e0e2aa, 0xabf5d983, 0x6b2a5742, 0x6a4cb5db, + 0xaa933b1a}, + {0x00000000, 0x6f4ca59b, 0x9f9e3bec, 0xf0d29e77, 0x7f3b0603, + 0x1077a398, 0xe0a53def, 0x8fe99874, 0xfe760c06, 0x913aa99d, + 0x61e837ea, 0x0ea49271, 0x814d0a05, 0xee01af9e, 0x1ed331e9, + 0x719f9472, 0xfced180c, 0x93a1bd97, 0x637323e0, 0x0c3f867b, + 0x83d61e0f, 0xec9abb94, 0x1c4825e3, 0x73048078, 0x029b140a, + 0x6dd7b191, 0x9d052fe6, 0xf2498a7d, 0x7da01209, 0x12ecb792, + 0xe23e29e5, 0x8d728c7e, 0xf8db3118, 0x97979483, 0x67450af4, + 0x0809af6f, 0x87e0371b, 0xe8ac9280, 0x187e0cf7, 0x7732a96c, + 0x06ad3d1e, 0x69e19885, 0x993306f2, 0xf67fa369, 0x79963b1d, + 0x16da9e86, 0xe60800f1, 0x8944a56a, 0x04362914, 0x6b7a8c8f, + 0x9ba812f8, 0xf4e4b763, 0x7b0d2f17, 0x14418a8c, 0xe49314fb, + 0x8bdfb160, 0xfa402512, 0x950c8089, 0x65de1efe, 0x0a92bb65, + 0x857b2311, 0xea37868a, 0x1ae518fd, 0x75a9bd66, 0xf0b76330, + 0x9ffbc6ab, 0x6f2958dc, 0x0065fd47, 0x8f8c6533, 0xe0c0c0a8, + 0x10125edf, 0x7f5efb44, 0x0ec16f36, 0x618dcaad, 0x915f54da, + 0xfe13f141, 0x71fa6935, 0x1eb6ccae, 0xee6452d9, 0x8128f742, + 0x0c5a7b3c, 0x6316dea7, 0x93c440d0, 0xfc88e54b, 0x73617d3f, + 0x1c2dd8a4, 0xecff46d3, 0x83b3e348, 0xf22c773a, 0x9d60d2a1, + 0x6db24cd6, 0x02fee94d, 0x8d177139, 0xe25bd4a2, 0x12894ad5, + 0x7dc5ef4e, 0x086c5228, 0x6720f7b3, 0x97f269c4, 0xf8becc5f, + 0x7757542b, 0x181bf1b0, 0xe8c96fc7, 0x8785ca5c, 0xf61a5e2e, + 0x9956fbb5, 0x698465c2, 0x06c8c059, 0x8921582d, 0xe66dfdb6, + 0x16bf63c1, 0x79f3c65a, 0xf4814a24, 0x9bcdefbf, 0x6b1f71c8, + 0x0453d453, 0x8bba4c27, 0xe4f6e9bc, 0x142477cb, 0x7b68d250, + 0x0af74622, 0x65bbe3b9, 0x95697dce, 0xfa25d855, 0x75cc4021, + 0x1a80e5ba, 0xea527bcd, 0x851ede56, 0xe06fc760, 0x8f2362fb, + 0x7ff1fc8c, 0x10bd5917, 0x9f54c163, 0xf01864f8, 0x00cafa8f, + 0x6f865f14, 0x1e19cb66, 0x71556efd, 0x8187f08a, 0xeecb5511, + 0x6122cd65, 0x0e6e68fe, 0xfebcf689, 0x91f05312, 0x1c82df6c, + 0x73ce7af7, 0x831ce480, 0xec50411b, 0x63b9d96f, 0x0cf57cf4, + 0xfc27e283, 0x936b4718, 0xe2f4d36a, 0x8db876f1, 0x7d6ae886, + 0x12264d1d, 0x9dcfd569, 0xf28370f2, 0x0251ee85, 0x6d1d4b1e, + 0x18b4f678, 0x77f853e3, 0x872acd94, 0xe866680f, 0x678ff07b, + 0x08c355e0, 0xf811cb97, 0x975d6e0c, 0xe6c2fa7e, 0x898e5fe5, + 0x795cc192, 0x16106409, 0x99f9fc7d, 0xf6b559e6, 0x0667c791, + 0x692b620a, 0xe459ee74, 0x8b154bef, 0x7bc7d598, 0x148b7003, + 0x9b62e877, 0xf42e4dec, 0x04fcd39b, 0x6bb07600, 0x1a2fe272, + 0x756347e9, 0x85b1d99e, 0xeafd7c05, 0x6514e471, 0x0a5841ea, + 0xfa8adf9d, 0x95c67a06, 0x10d8a450, 0x7f9401cb, 0x8f469fbc, + 0xe00a3a27, 0x6fe3a253, 0x00af07c8, 0xf07d99bf, 0x9f313c24, + 0xeeaea856, 0x81e20dcd, 0x713093ba, 0x1e7c3621, 0x9195ae55, + 0xfed90bce, 0x0e0b95b9, 0x61473022, 0xec35bc5c, 0x837919c7, + 0x73ab87b0, 0x1ce7222b, 0x930eba5f, 0xfc421fc4, 0x0c9081b3, + 0x63dc2428, 0x1243b05a, 0x7d0f15c1, 0x8ddd8bb6, 0xe2912e2d, + 0x6d78b659, 0x023413c2, 0xf2e68db5, 0x9daa282e, 0xe8039548, + 0x874f30d3, 0x779daea4, 0x18d10b3f, 0x9738934b, 0xf87436d0, + 0x08a6a8a7, 0x67ea0d3c, 0x1675994e, 0x79393cd5, 0x89eba2a2, + 0xe6a70739, 0x694e9f4d, 0x06023ad6, 0xf6d0a4a1, 0x999c013a, + 0x14ee8d44, 0x7ba228df, 0x8b70b6a8, 0xe43c1333, 0x6bd58b47, + 0x04992edc, 0xf44bb0ab, 0x9b071530, 0xea988142, 0x85d424d9, + 0x7506baae, 0x1a4a1f35, 0x95a38741, 0xfaef22da, 0x0a3dbcad, + 0x65711936}}; + +#endif + +#endif + +#if N == 4 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xf1da05aa, 0x38c50d15, 0xc91f08bf, 0x718a1a2a, + 0x80501f80, 0x494f173f, 0xb8951295, 0xe3143454, 0x12ce31fe, + 0xdbd13941, 0x2a0b3ceb, 0x929e2e7e, 0x63442bd4, 0xaa5b236b, + 0x5b8126c1, 0x1d596ee9, 0xec836b43, 0x259c63fc, 0xd4466656, + 0x6cd374c3, 0x9d097169, 0x541679d6, 0xa5cc7c7c, 0xfe4d5abd, + 0x0f975f17, 0xc68857a8, 0x37525202, 0x8fc74097, 0x7e1d453d, + 0xb7024d82, 0x46d84828, 0x3ab2ddd2, 0xcb68d878, 0x0277d0c7, + 0xf3add56d, 0x4b38c7f8, 0xbae2c252, 0x73fdcaed, 0x8227cf47, + 0xd9a6e986, 0x287cec2c, 0xe163e493, 0x10b9e139, 0xa82cf3ac, + 0x59f6f606, 0x90e9feb9, 0x6133fb13, 0x27ebb33b, 0xd631b691, + 0x1f2ebe2e, 0xeef4bb84, 0x5661a911, 0xa7bbacbb, 0x6ea4a404, + 0x9f7ea1ae, 0xc4ff876f, 0x352582c5, 0xfc3a8a7a, 0x0de08fd0, + 0xb5759d45, 0x44af98ef, 0x8db09050, 0x7c6a95fa, 0x7565bba4, + 0x84bfbe0e, 0x4da0b6b1, 0xbc7ab31b, 0x04efa18e, 0xf535a424, + 0x3c2aac9b, 0xcdf0a931, 0x96718ff0, 0x67ab8a5a, 0xaeb482e5, + 0x5f6e874f, 0xe7fb95da, 0x16219070, 0xdf3e98cf, 0x2ee49d65, + 0x683cd54d, 0x99e6d0e7, 0x50f9d858, 0xa123ddf2, 0x19b6cf67, + 0xe86ccacd, 0x2173c272, 0xd0a9c7d8, 0x8b28e119, 0x7af2e4b3, + 0xb3edec0c, 0x4237e9a6, 0xfaa2fb33, 0x0b78fe99, 0xc267f626, + 0x33bdf38c, 0x4fd76676, 0xbe0d63dc, 0x77126b63, 0x86c86ec9, + 0x3e5d7c5c, 0xcf8779f6, 0x06987149, 0xf74274e3, 0xacc35222, + 0x5d195788, 0x94065f37, 0x65dc5a9d, 0xdd494808, 0x2c934da2, + 0xe58c451d, 0x145640b7, 0x528e089f, 0xa3540d35, 0x6a4b058a, + 0x9b910020, 0x230412b5, 0xd2de171f, 0x1bc11fa0, 0xea1b1a0a, + 0xb19a3ccb, 0x40403961, 0x895f31de, 0x78853474, 0xc01026e1, + 0x31ca234b, 0xf8d52bf4, 0x090f2e5e, 0xeacb7748, 0x1b1172e2, + 0xd20e7a5d, 0x23d47ff7, 0x9b416d62, 0x6a9b68c8, 0xa3846077, + 0x525e65dd, 0x09df431c, 0xf80546b6, 0x311a4e09, 0xc0c04ba3, + 0x78555936, 0x898f5c9c, 0x40905423, 0xb14a5189, 0xf79219a1, + 0x06481c0b, 0xcf5714b4, 0x3e8d111e, 0x8618038b, 0x77c20621, + 0xbedd0e9e, 0x4f070b34, 0x14862df5, 0xe55c285f, 0x2c4320e0, + 0xdd99254a, 0x650c37df, 0x94d63275, 0x5dc93aca, 0xac133f60, + 0xd079aa9a, 0x21a3af30, 0xe8bca78f, 0x1966a225, 0xa1f3b0b0, + 0x5029b51a, 0x9936bda5, 0x68ecb80f, 0x336d9ece, 0xc2b79b64, + 0x0ba893db, 0xfa729671, 0x42e784e4, 0xb33d814e, 0x7a2289f1, + 0x8bf88c5b, 0xcd20c473, 0x3cfac1d9, 0xf5e5c966, 0x043fcccc, + 0xbcaade59, 0x4d70dbf3, 0x846fd34c, 0x75b5d6e6, 0x2e34f027, + 0xdfeef58d, 0x16f1fd32, 0xe72bf898, 0x5fbeea0d, 0xae64efa7, + 0x677be718, 0x96a1e2b2, 0x9faeccec, 0x6e74c946, 0xa76bc1f9, + 0x56b1c453, 0xee24d6c6, 0x1ffed36c, 0xd6e1dbd3, 0x273bde79, + 0x7cbaf8b8, 0x8d60fd12, 0x447ff5ad, 0xb5a5f007, 0x0d30e292, + 0xfceae738, 0x35f5ef87, 0xc42fea2d, 0x82f7a205, 0x732da7af, + 0xba32af10, 0x4be8aaba, 0xf37db82f, 0x02a7bd85, 0xcbb8b53a, + 0x3a62b090, 0x61e39651, 0x903993fb, 0x59269b44, 0xa8fc9eee, + 0x10698c7b, 0xe1b389d1, 0x28ac816e, 0xd97684c4, 0xa51c113e, + 0x54c61494, 0x9dd91c2b, 0x6c031981, 0xd4960b14, 0x254c0ebe, + 0xec530601, 0x1d8903ab, 0x4608256a, 0xb7d220c0, 0x7ecd287f, + 0x8f172dd5, 0x37823f40, 0xc6583aea, 0x0f473255, 0xfe9d37ff, + 0xb8457fd7, 0x499f7a7d, 0x808072c2, 0x715a7768, 0xc9cf65fd, + 0x38156057, 0xf10a68e8, 0x00d06d42, 0x5b514b83, 0xaa8b4e29, + 0x63944696, 0x924e433c, 0x2adb51a9, 0xdb015403, 0x121e5cbc, + 0xe3c45916}, + {0x00000000, 0x0ee7e8d1, 0x1dcfd1a2, 0x13283973, 0x3b9fa344, + 0x35784b95, 0x265072e6, 0x28b79a37, 0x773f4688, 0x79d8ae59, + 0x6af0972a, 0x64177ffb, 0x4ca0e5cc, 0x42470d1d, 0x516f346e, + 0x5f88dcbf, 0xee7e8d10, 0xe09965c1, 0xf3b15cb2, 0xfd56b463, + 0xd5e12e54, 0xdb06c685, 0xc82efff6, 0xc6c91727, 0x9941cb98, + 0x97a62349, 0x848e1a3a, 0x8a69f2eb, 0xa2de68dc, 0xac39800d, + 0xbf11b97e, 0xb1f651af, 0x078c1c61, 0x096bf4b0, 0x1a43cdc3, + 0x14a42512, 0x3c13bf25, 0x32f457f4, 0x21dc6e87, 0x2f3b8656, + 0x70b35ae9, 0x7e54b238, 0x6d7c8b4b, 0x639b639a, 0x4b2cf9ad, + 0x45cb117c, 0x56e3280f, 0x5804c0de, 0xe9f29171, 0xe71579a0, + 0xf43d40d3, 0xfadaa802, 0xd26d3235, 0xdc8adae4, 0xcfa2e397, + 0xc1450b46, 0x9ecdd7f9, 0x902a3f28, 0x8302065b, 0x8de5ee8a, + 0xa55274bd, 0xabb59c6c, 0xb89da51f, 0xb67a4dce, 0x0f1838c2, + 0x01ffd013, 0x12d7e960, 0x1c3001b1, 0x34879b86, 0x3a607357, + 0x29484a24, 0x27afa2f5, 0x78277e4a, 0x76c0969b, 0x65e8afe8, + 0x6b0f4739, 0x43b8dd0e, 0x4d5f35df, 0x5e770cac, 0x5090e47d, + 0xe166b5d2, 0xef815d03, 0xfca96470, 0xf24e8ca1, 0xdaf91696, + 0xd41efe47, 0xc736c734, 0xc9d12fe5, 0x9659f35a, 0x98be1b8b, + 0x8b9622f8, 0x8571ca29, 0xadc6501e, 0xa321b8cf, 0xb00981bc, + 0xbeee696d, 0x089424a3, 0x0673cc72, 0x155bf501, 0x1bbc1dd0, + 0x330b87e7, 0x3dec6f36, 0x2ec45645, 0x2023be94, 0x7fab622b, + 0x714c8afa, 0x6264b389, 0x6c835b58, 0x4434c16f, 0x4ad329be, + 0x59fb10cd, 0x571cf81c, 0xe6eaa9b3, 0xe80d4162, 0xfb257811, + 0xf5c290c0, 0xdd750af7, 0xd392e226, 0xc0badb55, 0xce5d3384, + 0x91d5ef3b, 0x9f3207ea, 0x8c1a3e99, 0x82fdd648, 0xaa4a4c7f, + 0xa4ada4ae, 0xb7859ddd, 0xb962750c, 0x1e307184, 0x10d79955, + 0x03ffa026, 0x0d1848f7, 0x25afd2c0, 0x2b483a11, 0x38600362, + 0x3687ebb3, 0x690f370c, 0x67e8dfdd, 0x74c0e6ae, 0x7a270e7f, + 0x52909448, 0x5c777c99, 0x4f5f45ea, 0x41b8ad3b, 0xf04efc94, + 0xfea91445, 0xed812d36, 0xe366c5e7, 0xcbd15fd0, 0xc536b701, + 0xd61e8e72, 0xd8f966a3, 0x8771ba1c, 0x899652cd, 0x9abe6bbe, + 0x9459836f, 0xbcee1958, 0xb209f189, 0xa121c8fa, 0xafc6202b, + 0x19bc6de5, 0x175b8534, 0x0473bc47, 0x0a945496, 0x2223cea1, + 0x2cc42670, 0x3fec1f03, 0x310bf7d2, 0x6e832b6d, 0x6064c3bc, + 0x734cfacf, 0x7dab121e, 0x551c8829, 0x5bfb60f8, 0x48d3598b, + 0x4634b15a, 0xf7c2e0f5, 0xf9250824, 0xea0d3157, 0xe4ead986, + 0xcc5d43b1, 0xc2baab60, 0xd1929213, 0xdf757ac2, 0x80fda67d, + 0x8e1a4eac, 0x9d3277df, 0x93d59f0e, 0xbb620539, 0xb585ede8, + 0xa6add49b, 0xa84a3c4a, 0x11284946, 0x1fcfa197, 0x0ce798e4, + 0x02007035, 0x2ab7ea02, 0x245002d3, 0x37783ba0, 0x399fd371, + 0x66170fce, 0x68f0e71f, 0x7bd8de6c, 0x753f36bd, 0x5d88ac8a, + 0x536f445b, 0x40477d28, 0x4ea095f9, 0xff56c456, 0xf1b12c87, + 0xe29915f4, 0xec7efd25, 0xc4c96712, 0xca2e8fc3, 0xd906b6b0, + 0xd7e15e61, 0x886982de, 0x868e6a0f, 0x95a6537c, 0x9b41bbad, + 0xb3f6219a, 0xbd11c94b, 0xae39f038, 0xa0de18e9, 0x16a45527, + 0x1843bdf6, 0x0b6b8485, 0x058c6c54, 0x2d3bf663, 0x23dc1eb2, + 0x30f427c1, 0x3e13cf10, 0x619b13af, 0x6f7cfb7e, 0x7c54c20d, + 0x72b32adc, 0x5a04b0eb, 0x54e3583a, 0x47cb6149, 0x492c8998, + 0xf8dad837, 0xf63d30e6, 0xe5150995, 0xebf2e144, 0xc3457b73, + 0xcda293a2, 0xde8aaad1, 0xd06d4200, 0x8fe59ebf, 0x8102766e, + 0x922a4f1d, 0x9ccda7cc, 0xb47a3dfb, 0xba9dd52a, 0xa9b5ec59, + 0xa7520488}, + {0x00000000, 0x3c60e308, 0x78c1c610, 0x44a12518, 0xf1838c20, + 0xcde36f28, 0x89424a30, 0xb522a938, 0x38761e01, 0x0416fd09, + 0x40b7d811, 0x7cd73b19, 0xc9f59221, 0xf5957129, 0xb1345431, + 0x8d54b739, 0x70ec3c02, 0x4c8cdf0a, 0x082dfa12, 0x344d191a, + 0x816fb022, 0xbd0f532a, 0xf9ae7632, 0xc5ce953a, 0x489a2203, + 0x74fac10b, 0x305be413, 0x0c3b071b, 0xb919ae23, 0x85794d2b, + 0xc1d86833, 0xfdb88b3b, 0xe1d87804, 0xddb89b0c, 0x9919be14, + 0xa5795d1c, 0x105bf424, 0x2c3b172c, 0x689a3234, 0x54fad13c, + 0xd9ae6605, 0xe5ce850d, 0xa16fa015, 0x9d0f431d, 0x282dea25, + 0x144d092d, 0x50ec2c35, 0x6c8ccf3d, 0x91344406, 0xad54a70e, + 0xe9f58216, 0xd595611e, 0x60b7c826, 0x5cd72b2e, 0x18760e36, + 0x2416ed3e, 0xa9425a07, 0x9522b90f, 0xd1839c17, 0xede37f1f, + 0x58c1d627, 0x64a1352f, 0x20001037, 0x1c60f33f, 0x18c1f649, + 0x24a11541, 0x60003059, 0x5c60d351, 0xe9427a69, 0xd5229961, + 0x9183bc79, 0xade35f71, 0x20b7e848, 0x1cd70b40, 0x58762e58, + 0x6416cd50, 0xd1346468, 0xed548760, 0xa9f5a278, 0x95954170, + 0x682dca4b, 0x544d2943, 0x10ec0c5b, 0x2c8cef53, 0x99ae466b, + 0xa5cea563, 0xe16f807b, 0xdd0f6373, 0x505bd44a, 0x6c3b3742, + 0x289a125a, 0x14faf152, 0xa1d8586a, 0x9db8bb62, 0xd9199e7a, + 0xe5797d72, 0xf9198e4d, 0xc5796d45, 0x81d8485d, 0xbdb8ab55, + 0x089a026d, 0x34fae165, 0x705bc47d, 0x4c3b2775, 0xc16f904c, + 0xfd0f7344, 0xb9ae565c, 0x85ceb554, 0x30ec1c6c, 0x0c8cff64, + 0x482dda7c, 0x744d3974, 0x89f5b24f, 0xb5955147, 0xf134745f, + 0xcd549757, 0x78763e6f, 0x4416dd67, 0x00b7f87f, 0x3cd71b77, + 0xb183ac4e, 0x8de34f46, 0xc9426a5e, 0xf5228956, 0x4000206e, + 0x7c60c366, 0x38c1e67e, 0x04a10576, 0x3183ec92, 0x0de30f9a, + 0x49422a82, 0x7522c98a, 0xc00060b2, 0xfc6083ba, 0xb8c1a6a2, + 0x84a145aa, 0x09f5f293, 0x3595119b, 0x71343483, 0x4d54d78b, + 0xf8767eb3, 0xc4169dbb, 0x80b7b8a3, 0xbcd75bab, 0x416fd090, + 0x7d0f3398, 0x39ae1680, 0x05cef588, 0xb0ec5cb0, 0x8c8cbfb8, + 0xc82d9aa0, 0xf44d79a8, 0x7919ce91, 0x45792d99, 0x01d80881, + 0x3db8eb89, 0x889a42b1, 0xb4faa1b9, 0xf05b84a1, 0xcc3b67a9, + 0xd05b9496, 0xec3b779e, 0xa89a5286, 0x94fab18e, 0x21d818b6, + 0x1db8fbbe, 0x5919dea6, 0x65793dae, 0xe82d8a97, 0xd44d699f, + 0x90ec4c87, 0xac8caf8f, 0x19ae06b7, 0x25cee5bf, 0x616fc0a7, + 0x5d0f23af, 0xa0b7a894, 0x9cd74b9c, 0xd8766e84, 0xe4168d8c, + 0x513424b4, 0x6d54c7bc, 0x29f5e2a4, 0x159501ac, 0x98c1b695, + 0xa4a1559d, 0xe0007085, 0xdc60938d, 0x69423ab5, 0x5522d9bd, + 0x1183fca5, 0x2de31fad, 0x29421adb, 0x1522f9d3, 0x5183dccb, + 0x6de33fc3, 0xd8c196fb, 0xe4a175f3, 0xa00050eb, 0x9c60b3e3, + 0x113404da, 0x2d54e7d2, 0x69f5c2ca, 0x559521c2, 0xe0b788fa, + 0xdcd76bf2, 0x98764eea, 0xa416ade2, 0x59ae26d9, 0x65cec5d1, + 0x216fe0c9, 0x1d0f03c1, 0xa82daaf9, 0x944d49f1, 0xd0ec6ce9, + 0xec8c8fe1, 0x61d838d8, 0x5db8dbd0, 0x1919fec8, 0x25791dc0, + 0x905bb4f8, 0xac3b57f0, 0xe89a72e8, 0xd4fa91e0, 0xc89a62df, + 0xf4fa81d7, 0xb05ba4cf, 0x8c3b47c7, 0x3919eeff, 0x05790df7, + 0x41d828ef, 0x7db8cbe7, 0xf0ec7cde, 0xcc8c9fd6, 0x882dbace, + 0xb44d59c6, 0x016ff0fe, 0x3d0f13f6, 0x79ae36ee, 0x45ced5e6, + 0xb8765edd, 0x8416bdd5, 0xc0b798cd, 0xfcd77bc5, 0x49f5d2fd, + 0x759531f5, 0x313414ed, 0x0d54f7e5, 0x800040dc, 0xbc60a3d4, + 0xf8c186cc, 0xc4a165c4, 0x7183ccfc, 0x4de32ff4, 0x09420aec, + 0x3522e9e4}, + {0x00000000, 0x6307d924, 0xc60fb248, 0xa5086b6c, 0x576e62d1, + 0x3469bbf5, 0x9161d099, 0xf26609bd, 0xaedcc5a2, 0xcddb1c86, + 0x68d377ea, 0x0bd4aece, 0xf9b2a773, 0x9ab57e57, 0x3fbd153b, + 0x5cbacc1f, 0x86c88d05, 0xe5cf5421, 0x40c73f4d, 0x23c0e669, + 0xd1a6efd4, 0xb2a136f0, 0x17a95d9c, 0x74ae84b8, 0x281448a7, + 0x4b139183, 0xee1bfaef, 0x8d1c23cb, 0x7f7a2a76, 0x1c7df352, + 0xb975983e, 0xda72411a, 0xd6e01c4b, 0xb5e7c56f, 0x10efae03, + 0x73e87727, 0x818e7e9a, 0xe289a7be, 0x4781ccd2, 0x248615f6, + 0x783cd9e9, 0x1b3b00cd, 0xbe336ba1, 0xdd34b285, 0x2f52bb38, + 0x4c55621c, 0xe95d0970, 0x8a5ad054, 0x5028914e, 0x332f486a, + 0x96272306, 0xf520fa22, 0x0746f39f, 0x64412abb, 0xc14941d7, + 0xa24e98f3, 0xfef454ec, 0x9df38dc8, 0x38fbe6a4, 0x5bfc3f80, + 0xa99a363d, 0xca9def19, 0x6f958475, 0x0c925d51, 0x76b13ed7, + 0x15b6e7f3, 0xb0be8c9f, 0xd3b955bb, 0x21df5c06, 0x42d88522, + 0xe7d0ee4e, 0x84d7376a, 0xd86dfb75, 0xbb6a2251, 0x1e62493d, + 0x7d659019, 0x8f0399a4, 0xec044080, 0x490c2bec, 0x2a0bf2c8, + 0xf079b3d2, 0x937e6af6, 0x3676019a, 0x5571d8be, 0xa717d103, + 0xc4100827, 0x6118634b, 0x021fba6f, 0x5ea57670, 0x3da2af54, + 0x98aac438, 0xfbad1d1c, 0x09cb14a1, 0x6acccd85, 0xcfc4a6e9, + 0xacc37fcd, 0xa051229c, 0xc356fbb8, 0x665e90d4, 0x055949f0, + 0xf73f404d, 0x94389969, 0x3130f205, 0x52372b21, 0x0e8de73e, + 0x6d8a3e1a, 0xc8825576, 0xab858c52, 0x59e385ef, 0x3ae45ccb, + 0x9fec37a7, 0xfcebee83, 0x2699af99, 0x459e76bd, 0xe0961dd1, + 0x8391c4f5, 0x71f7cd48, 0x12f0146c, 0xb7f87f00, 0xd4ffa624, + 0x88456a3b, 0xeb42b31f, 0x4e4ad873, 0x2d4d0157, 0xdf2b08ea, + 0xbc2cd1ce, 0x1924baa2, 0x7a236386, 0xed627dae, 0x8e65a48a, + 0x2b6dcfe6, 0x486a16c2, 0xba0c1f7f, 0xd90bc65b, 0x7c03ad37, + 0x1f047413, 0x43beb80c, 0x20b96128, 0x85b10a44, 0xe6b6d360, + 0x14d0dadd, 0x77d703f9, 0xd2df6895, 0xb1d8b1b1, 0x6baaf0ab, + 0x08ad298f, 0xada542e3, 0xcea29bc7, 0x3cc4927a, 0x5fc34b5e, + 0xfacb2032, 0x99ccf916, 0xc5763509, 0xa671ec2d, 0x03798741, + 0x607e5e65, 0x921857d8, 0xf11f8efc, 0x5417e590, 0x37103cb4, + 0x3b8261e5, 0x5885b8c1, 0xfd8dd3ad, 0x9e8a0a89, 0x6cec0334, + 0x0febda10, 0xaae3b17c, 0xc9e46858, 0x955ea447, 0xf6597d63, + 0x5351160f, 0x3056cf2b, 0xc230c696, 0xa1371fb2, 0x043f74de, + 0x6738adfa, 0xbd4aece0, 0xde4d35c4, 0x7b455ea8, 0x1842878c, + 0xea248e31, 0x89235715, 0x2c2b3c79, 0x4f2ce55d, 0x13962942, + 0x7091f066, 0xd5999b0a, 0xb69e422e, 0x44f84b93, 0x27ff92b7, + 0x82f7f9db, 0xe1f020ff, 0x9bd34379, 0xf8d49a5d, 0x5ddcf131, + 0x3edb2815, 0xccbd21a8, 0xafbaf88c, 0x0ab293e0, 0x69b54ac4, + 0x350f86db, 0x56085fff, 0xf3003493, 0x9007edb7, 0x6261e40a, + 0x01663d2e, 0xa46e5642, 0xc7698f66, 0x1d1bce7c, 0x7e1c1758, + 0xdb147c34, 0xb813a510, 0x4a75acad, 0x29727589, 0x8c7a1ee5, + 0xef7dc7c1, 0xb3c70bde, 0xd0c0d2fa, 0x75c8b996, 0x16cf60b2, + 0xe4a9690f, 0x87aeb02b, 0x22a6db47, 0x41a10263, 0x4d335f32, + 0x2e348616, 0x8b3ced7a, 0xe83b345e, 0x1a5d3de3, 0x795ae4c7, + 0xdc528fab, 0xbf55568f, 0xe3ef9a90, 0x80e843b4, 0x25e028d8, + 0x46e7f1fc, 0xb481f841, 0xd7862165, 0x728e4a09, 0x1189932d, + 0xcbfbd237, 0xa8fc0b13, 0x0df4607f, 0x6ef3b95b, 0x9c95b0e6, + 0xff9269c2, 0x5a9a02ae, 0x399ddb8a, 0x65271795, 0x0620ceb1, + 0xa328a5dd, 0xc02f7cf9, 0x32497544, 0x514eac60, 0xf446c70c, + 0x97411e28}, + {0x00000000, 0x01b5fd1d, 0x036bfa3a, 0x02de0727, 0x06d7f474, + 0x07620969, 0x05bc0e4e, 0x0409f353, 0x0dafe8e8, 0x0c1a15f5, + 0x0ec412d2, 0x0f71efcf, 0x0b781c9c, 0x0acde181, 0x0813e6a6, + 0x09a61bbb, 0x1b5fd1d0, 0x1aea2ccd, 0x18342bea, 0x1981d6f7, + 0x1d8825a4, 0x1c3dd8b9, 0x1ee3df9e, 0x1f562283, 0x16f03938, + 0x1745c425, 0x159bc302, 0x142e3e1f, 0x1027cd4c, 0x11923051, + 0x134c3776, 0x12f9ca6b, 0x36bfa3a0, 0x370a5ebd, 0x35d4599a, + 0x3461a487, 0x306857d4, 0x31ddaac9, 0x3303adee, 0x32b650f3, + 0x3b104b48, 0x3aa5b655, 0x387bb172, 0x39ce4c6f, 0x3dc7bf3c, + 0x3c724221, 0x3eac4506, 0x3f19b81b, 0x2de07270, 0x2c558f6d, + 0x2e8b884a, 0x2f3e7557, 0x2b378604, 0x2a827b19, 0x285c7c3e, + 0x29e98123, 0x204f9a98, 0x21fa6785, 0x232460a2, 0x22919dbf, + 0x26986eec, 0x272d93f1, 0x25f394d6, 0x244669cb, 0x6d7f4740, + 0x6ccaba5d, 0x6e14bd7a, 0x6fa14067, 0x6ba8b334, 0x6a1d4e29, + 0x68c3490e, 0x6976b413, 0x60d0afa8, 0x616552b5, 0x63bb5592, + 0x620ea88f, 0x66075bdc, 0x67b2a6c1, 0x656ca1e6, 0x64d95cfb, + 0x76209690, 0x77956b8d, 0x754b6caa, 0x74fe91b7, 0x70f762e4, + 0x71429ff9, 0x739c98de, 0x722965c3, 0x7b8f7e78, 0x7a3a8365, + 0x78e48442, 0x7951795f, 0x7d588a0c, 0x7ced7711, 0x7e337036, + 0x7f868d2b, 0x5bc0e4e0, 0x5a7519fd, 0x58ab1eda, 0x591ee3c7, + 0x5d171094, 0x5ca2ed89, 0x5e7ceaae, 0x5fc917b3, 0x566f0c08, + 0x57daf115, 0x5504f632, 0x54b10b2f, 0x50b8f87c, 0x510d0561, + 0x53d30246, 0x5266ff5b, 0x409f3530, 0x412ac82d, 0x43f4cf0a, + 0x42413217, 0x4648c144, 0x47fd3c59, 0x45233b7e, 0x4496c663, + 0x4d30ddd8, 0x4c8520c5, 0x4e5b27e2, 0x4feedaff, 0x4be729ac, + 0x4a52d4b1, 0x488cd396, 0x49392e8b, 0xdafe8e80, 0xdb4b739d, + 0xd99574ba, 0xd82089a7, 0xdc297af4, 0xdd9c87e9, 0xdf4280ce, + 0xdef77dd3, 0xd7516668, 0xd6e49b75, 0xd43a9c52, 0xd58f614f, + 0xd186921c, 0xd0336f01, 0xd2ed6826, 0xd358953b, 0xc1a15f50, + 0xc014a24d, 0xc2caa56a, 0xc37f5877, 0xc776ab24, 0xc6c35639, + 0xc41d511e, 0xc5a8ac03, 0xcc0eb7b8, 0xcdbb4aa5, 0xcf654d82, + 0xced0b09f, 0xcad943cc, 0xcb6cbed1, 0xc9b2b9f6, 0xc80744eb, + 0xec412d20, 0xedf4d03d, 0xef2ad71a, 0xee9f2a07, 0xea96d954, + 0xeb232449, 0xe9fd236e, 0xe848de73, 0xe1eec5c8, 0xe05b38d5, + 0xe2853ff2, 0xe330c2ef, 0xe73931bc, 0xe68ccca1, 0xe452cb86, + 0xe5e7369b, 0xf71efcf0, 0xf6ab01ed, 0xf47506ca, 0xf5c0fbd7, + 0xf1c90884, 0xf07cf599, 0xf2a2f2be, 0xf3170fa3, 0xfab11418, + 0xfb04e905, 0xf9daee22, 0xf86f133f, 0xfc66e06c, 0xfdd31d71, + 0xff0d1a56, 0xfeb8e74b, 0xb781c9c0, 0xb63434dd, 0xb4ea33fa, + 0xb55fcee7, 0xb1563db4, 0xb0e3c0a9, 0xb23dc78e, 0xb3883a93, + 0xba2e2128, 0xbb9bdc35, 0xb945db12, 0xb8f0260f, 0xbcf9d55c, + 0xbd4c2841, 0xbf922f66, 0xbe27d27b, 0xacde1810, 0xad6be50d, + 0xafb5e22a, 0xae001f37, 0xaa09ec64, 0xabbc1179, 0xa962165e, + 0xa8d7eb43, 0xa171f0f8, 0xa0c40de5, 0xa21a0ac2, 0xa3aff7df, + 0xa7a6048c, 0xa613f991, 0xa4cdfeb6, 0xa57803ab, 0x813e6a60, + 0x808b977d, 0x8255905a, 0x83e06d47, 0x87e99e14, 0x865c6309, + 0x8482642e, 0x85379933, 0x8c918288, 0x8d247f95, 0x8ffa78b2, + 0x8e4f85af, 0x8a4676fc, 0x8bf38be1, 0x892d8cc6, 0x889871db, + 0x9a61bbb0, 0x9bd446ad, 0x990a418a, 0x98bfbc97, 0x9cb64fc4, + 0x9d03b2d9, 0x9fddb5fe, 0x9e6848e3, 0x97ce5358, 0x967bae45, + 0x94a5a962, 0x9510547f, 0x9119a72c, 0x90ac5a31, 0x92725d16, + 0x93c7a00b}, + {0x00000000, 0x6e8c1b41, 0xdd183682, 0xb3942dc3, 0x61416b45, + 0x0fcd7004, 0xbc595dc7, 0xd2d54686, 0xc282d68a, 0xac0ecdcb, + 0x1f9ae008, 0x7116fb49, 0xa3c3bdcf, 0xcd4fa68e, 0x7edb8b4d, + 0x1057900c, 0x5e74ab55, 0x30f8b014, 0x836c9dd7, 0xede08696, + 0x3f35c010, 0x51b9db51, 0xe22df692, 0x8ca1edd3, 0x9cf67ddf, + 0xf27a669e, 0x41ee4b5d, 0x2f62501c, 0xfdb7169a, 0x933b0ddb, + 0x20af2018, 0x4e233b59, 0xbce956aa, 0xd2654deb, 0x61f16028, + 0x0f7d7b69, 0xdda83def, 0xb32426ae, 0x00b00b6d, 0x6e3c102c, + 0x7e6b8020, 0x10e79b61, 0xa373b6a2, 0xcdffade3, 0x1f2aeb65, + 0x71a6f024, 0xc232dde7, 0xacbec6a6, 0xe29dfdff, 0x8c11e6be, + 0x3f85cb7d, 0x5109d03c, 0x83dc96ba, 0xed508dfb, 0x5ec4a038, + 0x3048bb79, 0x201f2b75, 0x4e933034, 0xfd071df7, 0x938b06b6, + 0x415e4030, 0x2fd25b71, 0x9c4676b2, 0xf2ca6df3, 0xa2a3ab15, + 0xcc2fb054, 0x7fbb9d97, 0x113786d6, 0xc3e2c050, 0xad6edb11, + 0x1efaf6d2, 0x7076ed93, 0x60217d9f, 0x0ead66de, 0xbd394b1d, + 0xd3b5505c, 0x016016da, 0x6fec0d9b, 0xdc782058, 0xb2f43b19, + 0xfcd70040, 0x925b1b01, 0x21cf36c2, 0x4f432d83, 0x9d966b05, + 0xf31a7044, 0x408e5d87, 0x2e0246c6, 0x3e55d6ca, 0x50d9cd8b, + 0xe34de048, 0x8dc1fb09, 0x5f14bd8f, 0x3198a6ce, 0x820c8b0d, + 0xec80904c, 0x1e4afdbf, 0x70c6e6fe, 0xc352cb3d, 0xadded07c, + 0x7f0b96fa, 0x11878dbb, 0xa213a078, 0xcc9fbb39, 0xdcc82b35, + 0xb2443074, 0x01d01db7, 0x6f5c06f6, 0xbd894070, 0xd3055b31, + 0x609176f2, 0x0e1d6db3, 0x403e56ea, 0x2eb24dab, 0x9d266068, + 0xf3aa7b29, 0x217f3daf, 0x4ff326ee, 0xfc670b2d, 0x92eb106c, + 0x82bc8060, 0xec309b21, 0x5fa4b6e2, 0x3128ada3, 0xe3fdeb25, + 0x8d71f064, 0x3ee5dda7, 0x5069c6e6, 0x9e36506b, 0xf0ba4b2a, + 0x432e66e9, 0x2da27da8, 0xff773b2e, 0x91fb206f, 0x226f0dac, + 0x4ce316ed, 0x5cb486e1, 0x32389da0, 0x81acb063, 0xef20ab22, + 0x3df5eda4, 0x5379f6e5, 0xe0eddb26, 0x8e61c067, 0xc042fb3e, + 0xaecee07f, 0x1d5acdbc, 0x73d6d6fd, 0xa103907b, 0xcf8f8b3a, + 0x7c1ba6f9, 0x1297bdb8, 0x02c02db4, 0x6c4c36f5, 0xdfd81b36, + 0xb1540077, 0x638146f1, 0x0d0d5db0, 0xbe997073, 0xd0156b32, + 0x22df06c1, 0x4c531d80, 0xffc73043, 0x914b2b02, 0x439e6d84, + 0x2d1276c5, 0x9e865b06, 0xf00a4047, 0xe05dd04b, 0x8ed1cb0a, + 0x3d45e6c9, 0x53c9fd88, 0x811cbb0e, 0xef90a04f, 0x5c048d8c, + 0x328896cd, 0x7cabad94, 0x1227b6d5, 0xa1b39b16, 0xcf3f8057, + 0x1deac6d1, 0x7366dd90, 0xc0f2f053, 0xae7eeb12, 0xbe297b1e, + 0xd0a5605f, 0x63314d9c, 0x0dbd56dd, 0xdf68105b, 0xb1e40b1a, + 0x027026d9, 0x6cfc3d98, 0x3c95fb7e, 0x5219e03f, 0xe18dcdfc, + 0x8f01d6bd, 0x5dd4903b, 0x33588b7a, 0x80cca6b9, 0xee40bdf8, + 0xfe172df4, 0x909b36b5, 0x230f1b76, 0x4d830037, 0x9f5646b1, + 0xf1da5df0, 0x424e7033, 0x2cc26b72, 0x62e1502b, 0x0c6d4b6a, + 0xbff966a9, 0xd1757de8, 0x03a03b6e, 0x6d2c202f, 0xdeb80dec, + 0xb03416ad, 0xa06386a1, 0xceef9de0, 0x7d7bb023, 0x13f7ab62, + 0xc122ede4, 0xafaef6a5, 0x1c3adb66, 0x72b6c027, 0x807cadd4, + 0xeef0b695, 0x5d649b56, 0x33e88017, 0xe13dc691, 0x8fb1ddd0, + 0x3c25f013, 0x52a9eb52, 0x42fe7b5e, 0x2c72601f, 0x9fe64ddc, + 0xf16a569d, 0x23bf101b, 0x4d330b5a, 0xfea72699, 0x902b3dd8, + 0xde080681, 0xb0841dc0, 0x03103003, 0x6d9c2b42, 0xbf496dc4, + 0xd1c57685, 0x62515b46, 0x0cdd4007, 0x1c8ad00b, 0x7206cb4a, + 0xc192e689, 0xaf1efdc8, 0x7dcbbb4e, 0x1347a00f, 0xa0d38dcc, + 0xce5f968d}, + {0x00000000, 0xe71da697, 0x154a4b6f, 0xf257edf8, 0x2a9496de, + 0xcd893049, 0x3fdeddb1, 0xd8c37b26, 0x55292dbc, 0xb2348b2b, + 0x406366d3, 0xa77ec044, 0x7fbdbb62, 0x98a01df5, 0x6af7f00d, + 0x8dea569a, 0xaa525b78, 0x4d4ffdef, 0xbf181017, 0x5805b680, + 0x80c6cda6, 0x67db6b31, 0x958c86c9, 0x7291205e, 0xff7b76c4, + 0x1866d053, 0xea313dab, 0x0d2c9b3c, 0xd5efe01a, 0x32f2468d, + 0xc0a5ab75, 0x27b80de2, 0x8fd5b0b1, 0x68c81626, 0x9a9ffbde, + 0x7d825d49, 0xa541266f, 0x425c80f8, 0xb00b6d00, 0x5716cb97, + 0xdafc9d0d, 0x3de13b9a, 0xcfb6d662, 0x28ab70f5, 0xf0680bd3, + 0x1775ad44, 0xe52240bc, 0x023fe62b, 0x2587ebc9, 0xc29a4d5e, + 0x30cda0a6, 0xd7d00631, 0x0f137d17, 0xe80edb80, 0x1a593678, + 0xfd4490ef, 0x70aec675, 0x97b360e2, 0x65e48d1a, 0x82f92b8d, + 0x5a3a50ab, 0xbd27f63c, 0x4f701bc4, 0xa86dbd53, 0xc4da6723, + 0x23c7c1b4, 0xd1902c4c, 0x368d8adb, 0xee4ef1fd, 0x0953576a, + 0xfb04ba92, 0x1c191c05, 0x91f34a9f, 0x76eeec08, 0x84b901f0, + 0x63a4a767, 0xbb67dc41, 0x5c7a7ad6, 0xae2d972e, 0x493031b9, + 0x6e883c5b, 0x89959acc, 0x7bc27734, 0x9cdfd1a3, 0x441caa85, + 0xa3010c12, 0x5156e1ea, 0xb64b477d, 0x3ba111e7, 0xdcbcb770, + 0x2eeb5a88, 0xc9f6fc1f, 0x11358739, 0xf62821ae, 0x047fcc56, + 0xe3626ac1, 0x4b0fd792, 0xac127105, 0x5e459cfd, 0xb9583a6a, + 0x619b414c, 0x8686e7db, 0x74d10a23, 0x93ccacb4, 0x1e26fa2e, + 0xf93b5cb9, 0x0b6cb141, 0xec7117d6, 0x34b26cf0, 0xd3afca67, + 0x21f8279f, 0xc6e58108, 0xe15d8cea, 0x06402a7d, 0xf417c785, + 0x130a6112, 0xcbc91a34, 0x2cd4bca3, 0xde83515b, 0x399ef7cc, + 0xb474a156, 0x536907c1, 0xa13eea39, 0x46234cae, 0x9ee03788, + 0x79fd911f, 0x8baa7ce7, 0x6cb7da70, 0x52c5c807, 0xb5d86e90, + 0x478f8368, 0xa09225ff, 0x78515ed9, 0x9f4cf84e, 0x6d1b15b6, + 0x8a06b321, 0x07ece5bb, 0xe0f1432c, 0x12a6aed4, 0xf5bb0843, + 0x2d787365, 0xca65d5f2, 0x3832380a, 0xdf2f9e9d, 0xf897937f, + 0x1f8a35e8, 0xedddd810, 0x0ac07e87, 0xd20305a1, 0x351ea336, + 0xc7494ece, 0x2054e859, 0xadbebec3, 0x4aa31854, 0xb8f4f5ac, + 0x5fe9533b, 0x872a281d, 0x60378e8a, 0x92606372, 0x757dc5e5, + 0xdd1078b6, 0x3a0dde21, 0xc85a33d9, 0x2f47954e, 0xf784ee68, + 0x109948ff, 0xe2cea507, 0x05d30390, 0x8839550a, 0x6f24f39d, + 0x9d731e65, 0x7a6eb8f2, 0xa2adc3d4, 0x45b06543, 0xb7e788bb, + 0x50fa2e2c, 0x774223ce, 0x905f8559, 0x620868a1, 0x8515ce36, + 0x5dd6b510, 0xbacb1387, 0x489cfe7f, 0xaf8158e8, 0x226b0e72, + 0xc576a8e5, 0x3721451d, 0xd03ce38a, 0x08ff98ac, 0xefe23e3b, + 0x1db5d3c3, 0xfaa87554, 0x961faf24, 0x710209b3, 0x8355e44b, + 0x644842dc, 0xbc8b39fa, 0x5b969f6d, 0xa9c17295, 0x4edcd402, + 0xc3368298, 0x242b240f, 0xd67cc9f7, 0x31616f60, 0xe9a21446, + 0x0ebfb2d1, 0xfce85f29, 0x1bf5f9be, 0x3c4df45c, 0xdb5052cb, + 0x2907bf33, 0xce1a19a4, 0x16d96282, 0xf1c4c415, 0x039329ed, + 0xe48e8f7a, 0x6964d9e0, 0x8e797f77, 0x7c2e928f, 0x9b333418, + 0x43f04f3e, 0xa4ede9a9, 0x56ba0451, 0xb1a7a2c6, 0x19ca1f95, + 0xfed7b902, 0x0c8054fa, 0xeb9df26d, 0x335e894b, 0xd4432fdc, + 0x2614c224, 0xc10964b3, 0x4ce33229, 0xabfe94be, 0x59a97946, + 0xbeb4dfd1, 0x6677a4f7, 0x816a0260, 0x733def98, 0x9420490f, + 0xb39844ed, 0x5485e27a, 0xa6d20f82, 0x41cfa915, 0x990cd233, + 0x7e1174a4, 0x8c46995c, 0x6b5b3fcb, 0xe6b16951, 0x01accfc6, + 0xf3fb223e, 0x14e684a9, 0xcc25ff8f, 0x2b385918, 0xd96fb4e0, + 0x3e721277}, + {0x00000000, 0xa58b900e, 0x9066265d, 0x35edb653, 0xfbbd4afb, + 0x5e36daf5, 0x6bdb6ca6, 0xce50fca8, 0x2c0b93b7, 0x898003b9, + 0xbc6db5ea, 0x19e625e4, 0xd7b6d94c, 0x723d4942, 0x47d0ff11, + 0xe25b6f1f, 0x5817276e, 0xfd9cb760, 0xc8710133, 0x6dfa913d, + 0xa3aa6d95, 0x0621fd9b, 0x33cc4bc8, 0x9647dbc6, 0x741cb4d9, + 0xd19724d7, 0xe47a9284, 0x41f1028a, 0x8fa1fe22, 0x2a2a6e2c, + 0x1fc7d87f, 0xba4c4871, 0xb02e4edc, 0x15a5ded2, 0x20486881, + 0x85c3f88f, 0x4b930427, 0xee189429, 0xdbf5227a, 0x7e7eb274, + 0x9c25dd6b, 0x39ae4d65, 0x0c43fb36, 0xa9c86b38, 0x67989790, + 0xc213079e, 0xf7feb1cd, 0x527521c3, 0xe83969b2, 0x4db2f9bc, + 0x785f4fef, 0xddd4dfe1, 0x13842349, 0xb60fb347, 0x83e20514, + 0x2669951a, 0xc432fa05, 0x61b96a0b, 0x5454dc58, 0xf1df4c56, + 0x3f8fb0fe, 0x9a0420f0, 0xafe996a3, 0x0a6206ad, 0xbb2d9bf9, + 0x1ea60bf7, 0x2b4bbda4, 0x8ec02daa, 0x4090d102, 0xe51b410c, + 0xd0f6f75f, 0x757d6751, 0x9726084e, 0x32ad9840, 0x07402e13, + 0xa2cbbe1d, 0x6c9b42b5, 0xc910d2bb, 0xfcfd64e8, 0x5976f4e6, + 0xe33abc97, 0x46b12c99, 0x735c9aca, 0xd6d70ac4, 0x1887f66c, + 0xbd0c6662, 0x88e1d031, 0x2d6a403f, 0xcf312f20, 0x6ababf2e, + 0x5f57097d, 0xfadc9973, 0x348c65db, 0x9107f5d5, 0xa4ea4386, + 0x0161d388, 0x0b03d525, 0xae88452b, 0x9b65f378, 0x3eee6376, + 0xf0be9fde, 0x55350fd0, 0x60d8b983, 0xc553298d, 0x27084692, + 0x8283d69c, 0xb76e60cf, 0x12e5f0c1, 0xdcb50c69, 0x793e9c67, + 0x4cd32a34, 0xe958ba3a, 0x5314f24b, 0xf69f6245, 0xc372d416, + 0x66f94418, 0xa8a9b8b0, 0x0d2228be, 0x38cf9eed, 0x9d440ee3, + 0x7f1f61fc, 0xda94f1f2, 0xef7947a1, 0x4af2d7af, 0x84a22b07, + 0x2129bb09, 0x14c40d5a, 0xb14f9d54, 0xad2a31b3, 0x08a1a1bd, + 0x3d4c17ee, 0x98c787e0, 0x56977b48, 0xf31ceb46, 0xc6f15d15, + 0x637acd1b, 0x8121a204, 0x24aa320a, 0x11478459, 0xb4cc1457, + 0x7a9ce8ff, 0xdf1778f1, 0xeafacea2, 0x4f715eac, 0xf53d16dd, + 0x50b686d3, 0x655b3080, 0xc0d0a08e, 0x0e805c26, 0xab0bcc28, + 0x9ee67a7b, 0x3b6dea75, 0xd936856a, 0x7cbd1564, 0x4950a337, + 0xecdb3339, 0x228bcf91, 0x87005f9f, 0xb2ede9cc, 0x176679c2, + 0x1d047f6f, 0xb88fef61, 0x8d625932, 0x28e9c93c, 0xe6b93594, + 0x4332a59a, 0x76df13c9, 0xd35483c7, 0x310fecd8, 0x94847cd6, + 0xa169ca85, 0x04e25a8b, 0xcab2a623, 0x6f39362d, 0x5ad4807e, + 0xff5f1070, 0x45135801, 0xe098c80f, 0xd5757e5c, 0x70feee52, + 0xbeae12fa, 0x1b2582f4, 0x2ec834a7, 0x8b43a4a9, 0x6918cbb6, + 0xcc935bb8, 0xf97eedeb, 0x5cf57de5, 0x92a5814d, 0x372e1143, + 0x02c3a710, 0xa748371e, 0x1607aa4a, 0xb38c3a44, 0x86618c17, + 0x23ea1c19, 0xedbae0b1, 0x483170bf, 0x7ddcc6ec, 0xd85756e2, + 0x3a0c39fd, 0x9f87a9f3, 0xaa6a1fa0, 0x0fe18fae, 0xc1b17306, + 0x643ae308, 0x51d7555b, 0xf45cc555, 0x4e108d24, 0xeb9b1d2a, + 0xde76ab79, 0x7bfd3b77, 0xb5adc7df, 0x102657d1, 0x25cbe182, + 0x8040718c, 0x621b1e93, 0xc7908e9d, 0xf27d38ce, 0x57f6a8c0, + 0x99a65468, 0x3c2dc466, 0x09c07235, 0xac4be23b, 0xa629e496, + 0x03a27498, 0x364fc2cb, 0x93c452c5, 0x5d94ae6d, 0xf81f3e63, + 0xcdf28830, 0x6879183e, 0x8a227721, 0x2fa9e72f, 0x1a44517c, + 0xbfcfc172, 0x719f3dda, 0xd414add4, 0xe1f91b87, 0x44728b89, + 0xfe3ec3f8, 0x5bb553f6, 0x6e58e5a5, 0xcbd375ab, 0x05838903, + 0xa008190d, 0x95e5af5e, 0x306e3f50, 0xd235504f, 0x77bec041, + 0x42537612, 0xe7d8e61c, 0x29881ab4, 0x8c038aba, 0xb9ee3ce9, + 0x1c65ace7}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x0e908ba500000000, 0x5d26669000000000, + 0x53b6ed3500000000, 0xfb4abdfb00000000, 0xf5da365e00000000, + 0xa66cdb6b00000000, 0xa8fc50ce00000000, 0xb7930b2c00000000, + 0xb903808900000000, 0xeab56dbc00000000, 0xe425e61900000000, + 0x4cd9b6d700000000, 0x42493d7200000000, 0x11ffd04700000000, + 0x1f6f5be200000000, 0x6e27175800000000, 0x60b79cfd00000000, + 0x330171c800000000, 0x3d91fa6d00000000, 0x956daaa300000000, + 0x9bfd210600000000, 0xc84bcc3300000000, 0xc6db479600000000, + 0xd9b41c7400000000, 0xd72497d100000000, 0x84927ae400000000, + 0x8a02f14100000000, 0x22fea18f00000000, 0x2c6e2a2a00000000, + 0x7fd8c71f00000000, 0x71484cba00000000, 0xdc4e2eb000000000, + 0xd2dea51500000000, 0x8168482000000000, 0x8ff8c38500000000, + 0x2704934b00000000, 0x299418ee00000000, 0x7a22f5db00000000, + 0x74b27e7e00000000, 0x6bdd259c00000000, 0x654dae3900000000, + 0x36fb430c00000000, 0x386bc8a900000000, 0x9097986700000000, + 0x9e0713c200000000, 0xcdb1fef700000000, 0xc321755200000000, + 0xb26939e800000000, 0xbcf9b24d00000000, 0xef4f5f7800000000, + 0xe1dfd4dd00000000, 0x4923841300000000, 0x47b30fb600000000, + 0x1405e28300000000, 0x1a95692600000000, 0x05fa32c400000000, + 0x0b6ab96100000000, 0x58dc545400000000, 0x564cdff100000000, + 0xfeb08f3f00000000, 0xf020049a00000000, 0xa396e9af00000000, + 0xad06620a00000000, 0xf99b2dbb00000000, 0xf70ba61e00000000, + 0xa4bd4b2b00000000, 0xaa2dc08e00000000, 0x02d1904000000000, + 0x0c411be500000000, 0x5ff7f6d000000000, 0x51677d7500000000, + 0x4e08269700000000, 0x4098ad3200000000, 0x132e400700000000, + 0x1dbecba200000000, 0xb5429b6c00000000, 0xbbd210c900000000, + 0xe864fdfc00000000, 0xe6f4765900000000, 0x97bc3ae300000000, + 0x992cb14600000000, 0xca9a5c7300000000, 0xc40ad7d600000000, + 0x6cf6871800000000, 0x62660cbd00000000, 0x31d0e18800000000, + 0x3f406a2d00000000, 0x202f31cf00000000, 0x2ebfba6a00000000, + 0x7d09575f00000000, 0x7399dcfa00000000, 0xdb658c3400000000, + 0xd5f5079100000000, 0x8643eaa400000000, 0x88d3610100000000, + 0x25d5030b00000000, 0x2b4588ae00000000, 0x78f3659b00000000, + 0x7663ee3e00000000, 0xde9fbef000000000, 0xd00f355500000000, + 0x83b9d86000000000, 0x8d2953c500000000, 0x9246082700000000, + 0x9cd6838200000000, 0xcf606eb700000000, 0xc1f0e51200000000, + 0x690cb5dc00000000, 0x679c3e7900000000, 0x342ad34c00000000, + 0x3aba58e900000000, 0x4bf2145300000000, 0x45629ff600000000, + 0x16d472c300000000, 0x1844f96600000000, 0xb0b8a9a800000000, + 0xbe28220d00000000, 0xed9ecf3800000000, 0xe30e449d00000000, + 0xfc611f7f00000000, 0xf2f194da00000000, 0xa14779ef00000000, + 0xafd7f24a00000000, 0x072ba28400000000, 0x09bb292100000000, + 0x5a0dc41400000000, 0x549d4fb100000000, 0xb3312aad00000000, + 0xbda1a10800000000, 0xee174c3d00000000, 0xe087c79800000000, + 0x487b975600000000, 0x46eb1cf300000000, 0x155df1c600000000, + 0x1bcd7a6300000000, 0x04a2218100000000, 0x0a32aa2400000000, + 0x5984471100000000, 0x5714ccb400000000, 0xffe89c7a00000000, + 0xf17817df00000000, 0xa2cefaea00000000, 0xac5e714f00000000, + 0xdd163df500000000, 0xd386b65000000000, 0x80305b6500000000, + 0x8ea0d0c000000000, 0x265c800e00000000, 0x28cc0bab00000000, + 0x7b7ae69e00000000, 0x75ea6d3b00000000, 0x6a8536d900000000, + 0x6415bd7c00000000, 0x37a3504900000000, 0x3933dbec00000000, + 0x91cf8b2200000000, 0x9f5f008700000000, 0xcce9edb200000000, + 0xc279661700000000, 0x6f7f041d00000000, 0x61ef8fb800000000, + 0x3259628d00000000, 0x3cc9e92800000000, 0x9435b9e600000000, + 0x9aa5324300000000, 0xc913df7600000000, 0xc78354d300000000, + 0xd8ec0f3100000000, 0xd67c849400000000, 0x85ca69a100000000, + 0x8b5ae20400000000, 0x23a6b2ca00000000, 0x2d36396f00000000, + 0x7e80d45a00000000, 0x70105fff00000000, 0x0158134500000000, + 0x0fc898e000000000, 0x5c7e75d500000000, 0x52eefe7000000000, + 0xfa12aebe00000000, 0xf482251b00000000, 0xa734c82e00000000, + 0xa9a4438b00000000, 0xb6cb186900000000, 0xb85b93cc00000000, + 0xebed7ef900000000, 0xe57df55c00000000, 0x4d81a59200000000, + 0x43112e3700000000, 0x10a7c30200000000, 0x1e3748a700000000, + 0x4aaa071600000000, 0x443a8cb300000000, 0x178c618600000000, + 0x191cea2300000000, 0xb1e0baed00000000, 0xbf70314800000000, + 0xecc6dc7d00000000, 0xe25657d800000000, 0xfd390c3a00000000, + 0xf3a9879f00000000, 0xa01f6aaa00000000, 0xae8fe10f00000000, + 0x0673b1c100000000, 0x08e33a6400000000, 0x5b55d75100000000, + 0x55c55cf400000000, 0x248d104e00000000, 0x2a1d9beb00000000, + 0x79ab76de00000000, 0x773bfd7b00000000, 0xdfc7adb500000000, + 0xd157261000000000, 0x82e1cb2500000000, 0x8c71408000000000, + 0x931e1b6200000000, 0x9d8e90c700000000, 0xce387df200000000, + 0xc0a8f65700000000, 0x6854a69900000000, 0x66c42d3c00000000, + 0x3572c00900000000, 0x3be24bac00000000, 0x96e429a600000000, + 0x9874a20300000000, 0xcbc24f3600000000, 0xc552c49300000000, + 0x6dae945d00000000, 0x633e1ff800000000, 0x3088f2cd00000000, + 0x3e18796800000000, 0x2177228a00000000, 0x2fe7a92f00000000, + 0x7c51441a00000000, 0x72c1cfbf00000000, 0xda3d9f7100000000, + 0xd4ad14d400000000, 0x871bf9e100000000, 0x898b724400000000, + 0xf8c33efe00000000, 0xf653b55b00000000, 0xa5e5586e00000000, + 0xab75d3cb00000000, 0x0389830500000000, 0x0d1908a000000000, + 0x5eafe59500000000, 0x503f6e3000000000, 0x4f5035d200000000, + 0x41c0be7700000000, 0x1276534200000000, 0x1ce6d8e700000000, + 0xb41a882900000000, 0xba8a038c00000000, 0xe93ceeb900000000, + 0xe7ac651c00000000}, + {0x0000000000000000, 0x97a61de700000000, 0x6f4b4a1500000000, + 0xf8ed57f200000000, 0xde96942a00000000, 0x493089cd00000000, + 0xb1ddde3f00000000, 0x267bc3d800000000, 0xbc2d295500000000, + 0x2b8b34b200000000, 0xd366634000000000, 0x44c07ea700000000, + 0x62bbbd7f00000000, 0xf51da09800000000, 0x0df0f76a00000000, + 0x9a56ea8d00000000, 0x785b52aa00000000, 0xeffd4f4d00000000, + 0x171018bf00000000, 0x80b6055800000000, 0xa6cdc68000000000, + 0x316bdb6700000000, 0xc9868c9500000000, 0x5e20917200000000, + 0xc4767bff00000000, 0x53d0661800000000, 0xab3d31ea00000000, + 0x3c9b2c0d00000000, 0x1ae0efd500000000, 0x8d46f23200000000, + 0x75aba5c000000000, 0xe20db82700000000, 0xb1b0d58f00000000, + 0x2616c86800000000, 0xdefb9f9a00000000, 0x495d827d00000000, + 0x6f2641a500000000, 0xf8805c4200000000, 0x006d0bb000000000, + 0x97cb165700000000, 0x0d9dfcda00000000, 0x9a3be13d00000000, + 0x62d6b6cf00000000, 0xf570ab2800000000, 0xd30b68f000000000, + 0x44ad751700000000, 0xbc4022e500000000, 0x2be63f0200000000, + 0xc9eb872500000000, 0x5e4d9ac200000000, 0xa6a0cd3000000000, + 0x3106d0d700000000, 0x177d130f00000000, 0x80db0ee800000000, + 0x7836591a00000000, 0xef9044fd00000000, 0x75c6ae7000000000, + 0xe260b39700000000, 0x1a8de46500000000, 0x8d2bf98200000000, + 0xab503a5a00000000, 0x3cf627bd00000000, 0xc41b704f00000000, + 0x53bd6da800000000, 0x2367dac400000000, 0xb4c1c72300000000, + 0x4c2c90d100000000, 0xdb8a8d3600000000, 0xfdf14eee00000000, + 0x6a57530900000000, 0x92ba04fb00000000, 0x051c191c00000000, + 0x9f4af39100000000, 0x08ecee7600000000, 0xf001b98400000000, + 0x67a7a46300000000, 0x41dc67bb00000000, 0xd67a7a5c00000000, + 0x2e972dae00000000, 0xb931304900000000, 0x5b3c886e00000000, + 0xcc9a958900000000, 0x3477c27b00000000, 0xa3d1df9c00000000, + 0x85aa1c4400000000, 0x120c01a300000000, 0xeae1565100000000, + 0x7d474bb600000000, 0xe711a13b00000000, 0x70b7bcdc00000000, + 0x885aeb2e00000000, 0x1ffcf6c900000000, 0x3987351100000000, + 0xae2128f600000000, 0x56cc7f0400000000, 0xc16a62e300000000, + 0x92d70f4b00000000, 0x057112ac00000000, 0xfd9c455e00000000, + 0x6a3a58b900000000, 0x4c419b6100000000, 0xdbe7868600000000, + 0x230ad17400000000, 0xb4accc9300000000, 0x2efa261e00000000, + 0xb95c3bf900000000, 0x41b16c0b00000000, 0xd61771ec00000000, + 0xf06cb23400000000, 0x67caafd300000000, 0x9f27f82100000000, + 0x0881e5c600000000, 0xea8c5de100000000, 0x7d2a400600000000, + 0x85c717f400000000, 0x12610a1300000000, 0x341ac9cb00000000, + 0xa3bcd42c00000000, 0x5b5183de00000000, 0xccf79e3900000000, + 0x56a174b400000000, 0xc107695300000000, 0x39ea3ea100000000, + 0xae4c234600000000, 0x8837e09e00000000, 0x1f91fd7900000000, + 0xe77caa8b00000000, 0x70dab76c00000000, 0x07c8c55200000000, + 0x906ed8b500000000, 0x68838f4700000000, 0xff2592a000000000, + 0xd95e517800000000, 0x4ef84c9f00000000, 0xb6151b6d00000000, + 0x21b3068a00000000, 0xbbe5ec0700000000, 0x2c43f1e000000000, + 0xd4aea61200000000, 0x4308bbf500000000, 0x6573782d00000000, + 0xf2d565ca00000000, 0x0a38323800000000, 0x9d9e2fdf00000000, + 0x7f9397f800000000, 0xe8358a1f00000000, 0x10d8dded00000000, + 0x877ec00a00000000, 0xa10503d200000000, 0x36a31e3500000000, + 0xce4e49c700000000, 0x59e8542000000000, 0xc3bebead00000000, + 0x5418a34a00000000, 0xacf5f4b800000000, 0x3b53e95f00000000, + 0x1d282a8700000000, 0x8a8e376000000000, 0x7263609200000000, + 0xe5c57d7500000000, 0xb67810dd00000000, 0x21de0d3a00000000, + 0xd9335ac800000000, 0x4e95472f00000000, 0x68ee84f700000000, + 0xff48991000000000, 0x07a5cee200000000, 0x9003d30500000000, + 0x0a55398800000000, 0x9df3246f00000000, 0x651e739d00000000, + 0xf2b86e7a00000000, 0xd4c3ada200000000, 0x4365b04500000000, + 0xbb88e7b700000000, 0x2c2efa5000000000, 0xce23427700000000, + 0x59855f9000000000, 0xa168086200000000, 0x36ce158500000000, + 0x10b5d65d00000000, 0x8713cbba00000000, 0x7ffe9c4800000000, + 0xe85881af00000000, 0x720e6b2200000000, 0xe5a876c500000000, + 0x1d45213700000000, 0x8ae33cd000000000, 0xac98ff0800000000, + 0x3b3ee2ef00000000, 0xc3d3b51d00000000, 0x5475a8fa00000000, + 0x24af1f9600000000, 0xb309027100000000, 0x4be4558300000000, + 0xdc42486400000000, 0xfa398bbc00000000, 0x6d9f965b00000000, + 0x9572c1a900000000, 0x02d4dc4e00000000, 0x988236c300000000, + 0x0f242b2400000000, 0xf7c97cd600000000, 0x606f613100000000, + 0x4614a2e900000000, 0xd1b2bf0e00000000, 0x295fe8fc00000000, + 0xbef9f51b00000000, 0x5cf44d3c00000000, 0xcb5250db00000000, + 0x33bf072900000000, 0xa4191ace00000000, 0x8262d91600000000, + 0x15c4c4f100000000, 0xed29930300000000, 0x7a8f8ee400000000, + 0xe0d9646900000000, 0x777f798e00000000, 0x8f922e7c00000000, + 0x1834339b00000000, 0x3e4ff04300000000, 0xa9e9eda400000000, + 0x5104ba5600000000, 0xc6a2a7b100000000, 0x951fca1900000000, + 0x02b9d7fe00000000, 0xfa54800c00000000, 0x6df29deb00000000, + 0x4b895e3300000000, 0xdc2f43d400000000, 0x24c2142600000000, + 0xb36409c100000000, 0x2932e34c00000000, 0xbe94feab00000000, + 0x4679a95900000000, 0xd1dfb4be00000000, 0xf7a4776600000000, + 0x60026a8100000000, 0x98ef3d7300000000, 0x0f49209400000000, + 0xed4498b300000000, 0x7ae2855400000000, 0x820fd2a600000000, + 0x15a9cf4100000000, 0x33d20c9900000000, 0xa474117e00000000, + 0x5c99468c00000000, 0xcb3f5b6b00000000, 0x5169b1e600000000, + 0xc6cfac0100000000, 0x3e22fbf300000000, 0xa984e61400000000, + 0x8fff25cc00000000, 0x1859382b00000000, 0xe0b46fd900000000, + 0x7712723e00000000}, + {0x0000000000000000, 0x411b8c6e00000000, 0x823618dd00000000, + 0xc32d94b300000000, 0x456b416100000000, 0x0470cd0f00000000, + 0xc75d59bc00000000, 0x8646d5d200000000, 0x8ad682c200000000, + 0xcbcd0eac00000000, 0x08e09a1f00000000, 0x49fb167100000000, + 0xcfbdc3a300000000, 0x8ea64fcd00000000, 0x4d8bdb7e00000000, + 0x0c90571000000000, 0x55ab745e00000000, 0x14b0f83000000000, + 0xd79d6c8300000000, 0x9686e0ed00000000, 0x10c0353f00000000, + 0x51dbb95100000000, 0x92f62de200000000, 0xd3eda18c00000000, + 0xdf7df69c00000000, 0x9e667af200000000, 0x5d4bee4100000000, + 0x1c50622f00000000, 0x9a16b7fd00000000, 0xdb0d3b9300000000, + 0x1820af2000000000, 0x593b234e00000000, 0xaa56e9bc00000000, + 0xeb4d65d200000000, 0x2860f16100000000, 0x697b7d0f00000000, + 0xef3da8dd00000000, 0xae2624b300000000, 0x6d0bb00000000000, + 0x2c103c6e00000000, 0x20806b7e00000000, 0x619be71000000000, + 0xa2b673a300000000, 0xe3adffcd00000000, 0x65eb2a1f00000000, + 0x24f0a67100000000, 0xe7dd32c200000000, 0xa6c6beac00000000, + 0xfffd9de200000000, 0xbee6118c00000000, 0x7dcb853f00000000, + 0x3cd0095100000000, 0xba96dc8300000000, 0xfb8d50ed00000000, + 0x38a0c45e00000000, 0x79bb483000000000, 0x752b1f2000000000, + 0x3430934e00000000, 0xf71d07fd00000000, 0xb6068b9300000000, + 0x30405e4100000000, 0x715bd22f00000000, 0xb276469c00000000, + 0xf36dcaf200000000, 0x15aba3a200000000, 0x54b02fcc00000000, + 0x979dbb7f00000000, 0xd686371100000000, 0x50c0e2c300000000, + 0x11db6ead00000000, 0xd2f6fa1e00000000, 0x93ed767000000000, + 0x9f7d216000000000, 0xde66ad0e00000000, 0x1d4b39bd00000000, + 0x5c50b5d300000000, 0xda16600100000000, 0x9b0dec6f00000000, + 0x582078dc00000000, 0x193bf4b200000000, 0x4000d7fc00000000, + 0x011b5b9200000000, 0xc236cf2100000000, 0x832d434f00000000, + 0x056b969d00000000, 0x44701af300000000, 0x875d8e4000000000, + 0xc646022e00000000, 0xcad6553e00000000, 0x8bcdd95000000000, + 0x48e04de300000000, 0x09fbc18d00000000, 0x8fbd145f00000000, + 0xcea6983100000000, 0x0d8b0c8200000000, 0x4c9080ec00000000, + 0xbffd4a1e00000000, 0xfee6c67000000000, 0x3dcb52c300000000, + 0x7cd0dead00000000, 0xfa960b7f00000000, 0xbb8d871100000000, + 0x78a013a200000000, 0x39bb9fcc00000000, 0x352bc8dc00000000, + 0x743044b200000000, 0xb71dd00100000000, 0xf6065c6f00000000, + 0x704089bd00000000, 0x315b05d300000000, 0xf276916000000000, + 0xb36d1d0e00000000, 0xea563e4000000000, 0xab4db22e00000000, + 0x6860269d00000000, 0x297baaf300000000, 0xaf3d7f2100000000, + 0xee26f34f00000000, 0x2d0b67fc00000000, 0x6c10eb9200000000, + 0x6080bc8200000000, 0x219b30ec00000000, 0xe2b6a45f00000000, + 0xa3ad283100000000, 0x25ebfde300000000, 0x64f0718d00000000, + 0xa7dde53e00000000, 0xe6c6695000000000, 0x6b50369e00000000, + 0x2a4bbaf000000000, 0xe9662e4300000000, 0xa87da22d00000000, + 0x2e3b77ff00000000, 0x6f20fb9100000000, 0xac0d6f2200000000, + 0xed16e34c00000000, 0xe186b45c00000000, 0xa09d383200000000, + 0x63b0ac8100000000, 0x22ab20ef00000000, 0xa4edf53d00000000, + 0xe5f6795300000000, 0x26dbede000000000, 0x67c0618e00000000, + 0x3efb42c000000000, 0x7fe0ceae00000000, 0xbccd5a1d00000000, + 0xfdd6d67300000000, 0x7b9003a100000000, 0x3a8b8fcf00000000, + 0xf9a61b7c00000000, 0xb8bd971200000000, 0xb42dc00200000000, + 0xf5364c6c00000000, 0x361bd8df00000000, 0x770054b100000000, + 0xf146816300000000, 0xb05d0d0d00000000, 0x737099be00000000, + 0x326b15d000000000, 0xc106df2200000000, 0x801d534c00000000, + 0x4330c7ff00000000, 0x022b4b9100000000, 0x846d9e4300000000, + 0xc576122d00000000, 0x065b869e00000000, 0x47400af000000000, + 0x4bd05de000000000, 0x0acbd18e00000000, 0xc9e6453d00000000, + 0x88fdc95300000000, 0x0ebb1c8100000000, 0x4fa090ef00000000, + 0x8c8d045c00000000, 0xcd96883200000000, 0x94adab7c00000000, + 0xd5b6271200000000, 0x169bb3a100000000, 0x57803fcf00000000, + 0xd1c6ea1d00000000, 0x90dd667300000000, 0x53f0f2c000000000, + 0x12eb7eae00000000, 0x1e7b29be00000000, 0x5f60a5d000000000, + 0x9c4d316300000000, 0xdd56bd0d00000000, 0x5b1068df00000000, + 0x1a0be4b100000000, 0xd926700200000000, 0x983dfc6c00000000, + 0x7efb953c00000000, 0x3fe0195200000000, 0xfccd8de100000000, + 0xbdd6018f00000000, 0x3b90d45d00000000, 0x7a8b583300000000, + 0xb9a6cc8000000000, 0xf8bd40ee00000000, 0xf42d17fe00000000, + 0xb5369b9000000000, 0x761b0f2300000000, 0x3700834d00000000, + 0xb146569f00000000, 0xf05ddaf100000000, 0x33704e4200000000, + 0x726bc22c00000000, 0x2b50e16200000000, 0x6a4b6d0c00000000, + 0xa966f9bf00000000, 0xe87d75d100000000, 0x6e3ba00300000000, + 0x2f202c6d00000000, 0xec0db8de00000000, 0xad1634b000000000, + 0xa18663a000000000, 0xe09defce00000000, 0x23b07b7d00000000, + 0x62abf71300000000, 0xe4ed22c100000000, 0xa5f6aeaf00000000, + 0x66db3a1c00000000, 0x27c0b67200000000, 0xd4ad7c8000000000, + 0x95b6f0ee00000000, 0x569b645d00000000, 0x1780e83300000000, + 0x91c63de100000000, 0xd0ddb18f00000000, 0x13f0253c00000000, + 0x52eba95200000000, 0x5e7bfe4200000000, 0x1f60722c00000000, + 0xdc4de69f00000000, 0x9d566af100000000, 0x1b10bf2300000000, + 0x5a0b334d00000000, 0x9926a7fe00000000, 0xd83d2b9000000000, + 0x810608de00000000, 0xc01d84b000000000, 0x0330100300000000, + 0x422b9c6d00000000, 0xc46d49bf00000000, 0x8576c5d100000000, + 0x465b516200000000, 0x0740dd0c00000000, 0x0bd08a1c00000000, + 0x4acb067200000000, 0x89e692c100000000, 0xc8fd1eaf00000000, + 0x4ebbcb7d00000000, 0x0fa0471300000000, 0xcc8dd3a000000000, + 0x8d965fce00000000}, + {0x0000000000000000, 0x1dfdb50100000000, 0x3afa6b0300000000, + 0x2707de0200000000, 0x74f4d70600000000, 0x6909620700000000, + 0x4e0ebc0500000000, 0x53f3090400000000, 0xe8e8af0d00000000, + 0xf5151a0c00000000, 0xd212c40e00000000, 0xcfef710f00000000, + 0x9c1c780b00000000, 0x81e1cd0a00000000, 0xa6e6130800000000, + 0xbb1ba60900000000, 0xd0d15f1b00000000, 0xcd2cea1a00000000, + 0xea2b341800000000, 0xf7d6811900000000, 0xa425881d00000000, + 0xb9d83d1c00000000, 0x9edfe31e00000000, 0x8322561f00000000, + 0x3839f01600000000, 0x25c4451700000000, 0x02c39b1500000000, + 0x1f3e2e1400000000, 0x4ccd271000000000, 0x5130921100000000, + 0x76374c1300000000, 0x6bcaf91200000000, 0xa0a3bf3600000000, + 0xbd5e0a3700000000, 0x9a59d43500000000, 0x87a4613400000000, + 0xd457683000000000, 0xc9aadd3100000000, 0xeead033300000000, + 0xf350b63200000000, 0x484b103b00000000, 0x55b6a53a00000000, + 0x72b17b3800000000, 0x6f4cce3900000000, 0x3cbfc73d00000000, + 0x2142723c00000000, 0x0645ac3e00000000, 0x1bb8193f00000000, + 0x7072e02d00000000, 0x6d8f552c00000000, 0x4a888b2e00000000, + 0x57753e2f00000000, 0x0486372b00000000, 0x197b822a00000000, + 0x3e7c5c2800000000, 0x2381e92900000000, 0x989a4f2000000000, + 0x8567fa2100000000, 0xa260242300000000, 0xbf9d912200000000, + 0xec6e982600000000, 0xf1932d2700000000, 0xd694f32500000000, + 0xcb69462400000000, 0x40477f6d00000000, 0x5dbaca6c00000000, + 0x7abd146e00000000, 0x6740a16f00000000, 0x34b3a86b00000000, + 0x294e1d6a00000000, 0x0e49c36800000000, 0x13b4766900000000, + 0xa8afd06000000000, 0xb552656100000000, 0x9255bb6300000000, + 0x8fa80e6200000000, 0xdc5b076600000000, 0xc1a6b26700000000, + 0xe6a16c6500000000, 0xfb5cd96400000000, 0x9096207600000000, + 0x8d6b957700000000, 0xaa6c4b7500000000, 0xb791fe7400000000, + 0xe462f77000000000, 0xf99f427100000000, 0xde989c7300000000, + 0xc365297200000000, 0x787e8f7b00000000, 0x65833a7a00000000, + 0x4284e47800000000, 0x5f79517900000000, 0x0c8a587d00000000, + 0x1177ed7c00000000, 0x3670337e00000000, 0x2b8d867f00000000, + 0xe0e4c05b00000000, 0xfd19755a00000000, 0xda1eab5800000000, + 0xc7e31e5900000000, 0x9410175d00000000, 0x89eda25c00000000, + 0xaeea7c5e00000000, 0xb317c95f00000000, 0x080c6f5600000000, + 0x15f1da5700000000, 0x32f6045500000000, 0x2f0bb15400000000, + 0x7cf8b85000000000, 0x61050d5100000000, 0x4602d35300000000, + 0x5bff665200000000, 0x30359f4000000000, 0x2dc82a4100000000, + 0x0acff44300000000, 0x1732414200000000, 0x44c1484600000000, + 0x593cfd4700000000, 0x7e3b234500000000, 0x63c6964400000000, + 0xd8dd304d00000000, 0xc520854c00000000, 0xe2275b4e00000000, + 0xffdaee4f00000000, 0xac29e74b00000000, 0xb1d4524a00000000, + 0x96d38c4800000000, 0x8b2e394900000000, 0x808efeda00000000, + 0x9d734bdb00000000, 0xba7495d900000000, 0xa78920d800000000, + 0xf47a29dc00000000, 0xe9879cdd00000000, 0xce8042df00000000, + 0xd37df7de00000000, 0x686651d700000000, 0x759be4d600000000, + 0x529c3ad400000000, 0x4f618fd500000000, 0x1c9286d100000000, + 0x016f33d000000000, 0x2668edd200000000, 0x3b9558d300000000, + 0x505fa1c100000000, 0x4da214c000000000, 0x6aa5cac200000000, + 0x77587fc300000000, 0x24ab76c700000000, 0x3956c3c600000000, + 0x1e511dc400000000, 0x03aca8c500000000, 0xb8b70ecc00000000, + 0xa54abbcd00000000, 0x824d65cf00000000, 0x9fb0d0ce00000000, + 0xcc43d9ca00000000, 0xd1be6ccb00000000, 0xf6b9b2c900000000, + 0xeb4407c800000000, 0x202d41ec00000000, 0x3dd0f4ed00000000, + 0x1ad72aef00000000, 0x072a9fee00000000, 0x54d996ea00000000, + 0x492423eb00000000, 0x6e23fde900000000, 0x73de48e800000000, + 0xc8c5eee100000000, 0xd5385be000000000, 0xf23f85e200000000, + 0xefc230e300000000, 0xbc3139e700000000, 0xa1cc8ce600000000, + 0x86cb52e400000000, 0x9b36e7e500000000, 0xf0fc1ef700000000, + 0xed01abf600000000, 0xca0675f400000000, 0xd7fbc0f500000000, + 0x8408c9f100000000, 0x99f57cf000000000, 0xbef2a2f200000000, + 0xa30f17f300000000, 0x1814b1fa00000000, 0x05e904fb00000000, + 0x22eedaf900000000, 0x3f136ff800000000, 0x6ce066fc00000000, + 0x711dd3fd00000000, 0x561a0dff00000000, 0x4be7b8fe00000000, + 0xc0c981b700000000, 0xdd3434b600000000, 0xfa33eab400000000, + 0xe7ce5fb500000000, 0xb43d56b100000000, 0xa9c0e3b000000000, + 0x8ec73db200000000, 0x933a88b300000000, 0x28212eba00000000, + 0x35dc9bbb00000000, 0x12db45b900000000, 0x0f26f0b800000000, + 0x5cd5f9bc00000000, 0x41284cbd00000000, 0x662f92bf00000000, + 0x7bd227be00000000, 0x1018deac00000000, 0x0de56bad00000000, + 0x2ae2b5af00000000, 0x371f00ae00000000, 0x64ec09aa00000000, + 0x7911bcab00000000, 0x5e1662a900000000, 0x43ebd7a800000000, + 0xf8f071a100000000, 0xe50dc4a000000000, 0xc20a1aa200000000, + 0xdff7afa300000000, 0x8c04a6a700000000, 0x91f913a600000000, + 0xb6fecda400000000, 0xab0378a500000000, 0x606a3e8100000000, + 0x7d978b8000000000, 0x5a90558200000000, 0x476de08300000000, + 0x149ee98700000000, 0x09635c8600000000, 0x2e64828400000000, + 0x3399378500000000, 0x8882918c00000000, 0x957f248d00000000, + 0xb278fa8f00000000, 0xaf854f8e00000000, 0xfc76468a00000000, + 0xe18bf38b00000000, 0xc68c2d8900000000, 0xdb71988800000000, + 0xb0bb619a00000000, 0xad46d49b00000000, 0x8a410a9900000000, + 0x97bcbf9800000000, 0xc44fb69c00000000, 0xd9b2039d00000000, + 0xfeb5dd9f00000000, 0xe348689e00000000, 0x5853ce9700000000, + 0x45ae7b9600000000, 0x62a9a59400000000, 0x7f54109500000000, + 0x2ca7199100000000, 0x315aac9000000000, 0x165d729200000000, + 0x0ba0c79300000000}, + {0x0000000000000000, 0x24d9076300000000, 0x48b20fc600000000, + 0x6c6b08a500000000, 0xd1626e5700000000, 0xf5bb693400000000, + 0x99d0619100000000, 0xbd0966f200000000, 0xa2c5dcae00000000, + 0x861cdbcd00000000, 0xea77d36800000000, 0xceaed40b00000000, + 0x73a7b2f900000000, 0x577eb59a00000000, 0x3b15bd3f00000000, + 0x1fccba5c00000000, 0x058dc88600000000, 0x2154cfe500000000, + 0x4d3fc74000000000, 0x69e6c02300000000, 0xd4efa6d100000000, + 0xf036a1b200000000, 0x9c5da91700000000, 0xb884ae7400000000, + 0xa748142800000000, 0x8391134b00000000, 0xeffa1bee00000000, + 0xcb231c8d00000000, 0x762a7a7f00000000, 0x52f37d1c00000000, + 0x3e9875b900000000, 0x1a4172da00000000, 0x4b1ce0d600000000, + 0x6fc5e7b500000000, 0x03aeef1000000000, 0x2777e87300000000, + 0x9a7e8e8100000000, 0xbea789e200000000, 0xd2cc814700000000, + 0xf615862400000000, 0xe9d93c7800000000, 0xcd003b1b00000000, + 0xa16b33be00000000, 0x85b234dd00000000, 0x38bb522f00000000, + 0x1c62554c00000000, 0x70095de900000000, 0x54d05a8a00000000, + 0x4e91285000000000, 0x6a482f3300000000, 0x0623279600000000, + 0x22fa20f500000000, 0x9ff3460700000000, 0xbb2a416400000000, + 0xd74149c100000000, 0xf3984ea200000000, 0xec54f4fe00000000, + 0xc88df39d00000000, 0xa4e6fb3800000000, 0x803ffc5b00000000, + 0x3d369aa900000000, 0x19ef9dca00000000, 0x7584956f00000000, + 0x515d920c00000000, 0xd73eb17600000000, 0xf3e7b61500000000, + 0x9f8cbeb000000000, 0xbb55b9d300000000, 0x065cdf2100000000, + 0x2285d84200000000, 0x4eeed0e700000000, 0x6a37d78400000000, + 0x75fb6dd800000000, 0x51226abb00000000, 0x3d49621e00000000, + 0x1990657d00000000, 0xa499038f00000000, 0x804004ec00000000, + 0xec2b0c4900000000, 0xc8f20b2a00000000, 0xd2b379f000000000, + 0xf66a7e9300000000, 0x9a01763600000000, 0xbed8715500000000, + 0x03d117a700000000, 0x270810c400000000, 0x4b63186100000000, + 0x6fba1f0200000000, 0x7076a55e00000000, 0x54afa23d00000000, + 0x38c4aa9800000000, 0x1c1dadfb00000000, 0xa114cb0900000000, + 0x85cdcc6a00000000, 0xe9a6c4cf00000000, 0xcd7fc3ac00000000, + 0x9c2251a000000000, 0xb8fb56c300000000, 0xd4905e6600000000, + 0xf049590500000000, 0x4d403ff700000000, 0x6999389400000000, + 0x05f2303100000000, 0x212b375200000000, 0x3ee78d0e00000000, + 0x1a3e8a6d00000000, 0x765582c800000000, 0x528c85ab00000000, + 0xef85e35900000000, 0xcb5ce43a00000000, 0xa737ec9f00000000, + 0x83eeebfc00000000, 0x99af992600000000, 0xbd769e4500000000, + 0xd11d96e000000000, 0xf5c4918300000000, 0x48cdf77100000000, + 0x6c14f01200000000, 0x007ff8b700000000, 0x24a6ffd400000000, + 0x3b6a458800000000, 0x1fb342eb00000000, 0x73d84a4e00000000, + 0x57014d2d00000000, 0xea082bdf00000000, 0xced12cbc00000000, + 0xa2ba241900000000, 0x8663237a00000000, 0xae7d62ed00000000, + 0x8aa4658e00000000, 0xe6cf6d2b00000000, 0xc2166a4800000000, + 0x7f1f0cba00000000, 0x5bc60bd900000000, 0x37ad037c00000000, + 0x1374041f00000000, 0x0cb8be4300000000, 0x2861b92000000000, + 0x440ab18500000000, 0x60d3b6e600000000, 0xdddad01400000000, + 0xf903d77700000000, 0x9568dfd200000000, 0xb1b1d8b100000000, + 0xabf0aa6b00000000, 0x8f29ad0800000000, 0xe342a5ad00000000, + 0xc79ba2ce00000000, 0x7a92c43c00000000, 0x5e4bc35f00000000, + 0x3220cbfa00000000, 0x16f9cc9900000000, 0x093576c500000000, + 0x2dec71a600000000, 0x4187790300000000, 0x655e7e6000000000, + 0xd857189200000000, 0xfc8e1ff100000000, 0x90e5175400000000, + 0xb43c103700000000, 0xe561823b00000000, 0xc1b8855800000000, + 0xadd38dfd00000000, 0x890a8a9e00000000, 0x3403ec6c00000000, + 0x10daeb0f00000000, 0x7cb1e3aa00000000, 0x5868e4c900000000, + 0x47a45e9500000000, 0x637d59f600000000, 0x0f16515300000000, + 0x2bcf563000000000, 0x96c630c200000000, 0xb21f37a100000000, + 0xde743f0400000000, 0xfaad386700000000, 0xe0ec4abd00000000, + 0xc4354dde00000000, 0xa85e457b00000000, 0x8c87421800000000, + 0x318e24ea00000000, 0x1557238900000000, 0x793c2b2c00000000, + 0x5de52c4f00000000, 0x4229961300000000, 0x66f0917000000000, + 0x0a9b99d500000000, 0x2e429eb600000000, 0x934bf84400000000, + 0xb792ff2700000000, 0xdbf9f78200000000, 0xff20f0e100000000, + 0x7943d39b00000000, 0x5d9ad4f800000000, 0x31f1dc5d00000000, + 0x1528db3e00000000, 0xa821bdcc00000000, 0x8cf8baaf00000000, + 0xe093b20a00000000, 0xc44ab56900000000, 0xdb860f3500000000, + 0xff5f085600000000, 0x933400f300000000, 0xb7ed079000000000, + 0x0ae4616200000000, 0x2e3d660100000000, 0x42566ea400000000, + 0x668f69c700000000, 0x7cce1b1d00000000, 0x58171c7e00000000, + 0x347c14db00000000, 0x10a513b800000000, 0xadac754a00000000, + 0x8975722900000000, 0xe51e7a8c00000000, 0xc1c77def00000000, + 0xde0bc7b300000000, 0xfad2c0d000000000, 0x96b9c87500000000, + 0xb260cf1600000000, 0x0f69a9e400000000, 0x2bb0ae8700000000, + 0x47dba62200000000, 0x6302a14100000000, 0x325f334d00000000, + 0x1686342e00000000, 0x7aed3c8b00000000, 0x5e343be800000000, + 0xe33d5d1a00000000, 0xc7e45a7900000000, 0xab8f52dc00000000, + 0x8f5655bf00000000, 0x909aefe300000000, 0xb443e88000000000, + 0xd828e02500000000, 0xfcf1e74600000000, 0x41f881b400000000, + 0x652186d700000000, 0x094a8e7200000000, 0x2d93891100000000, + 0x37d2fbcb00000000, 0x130bfca800000000, 0x7f60f40d00000000, + 0x5bb9f36e00000000, 0xe6b0959c00000000, 0xc26992ff00000000, + 0xae029a5a00000000, 0x8adb9d3900000000, 0x9517276500000000, + 0xb1ce200600000000, 0xdda528a300000000, 0xf97c2fc000000000, + 0x4475493200000000, 0x60ac4e5100000000, 0x0cc746f400000000, + 0x281e419700000000}, + {0x0000000000000000, 0x08e3603c00000000, 0x10c6c17800000000, + 0x1825a14400000000, 0x208c83f100000000, 0x286fe3cd00000000, + 0x304a428900000000, 0x38a922b500000000, 0x011e763800000000, + 0x09fd160400000000, 0x11d8b74000000000, 0x193bd77c00000000, + 0x2192f5c900000000, 0x297195f500000000, 0x315434b100000000, + 0x39b7548d00000000, 0x023cec7000000000, 0x0adf8c4c00000000, + 0x12fa2d0800000000, 0x1a194d3400000000, 0x22b06f8100000000, + 0x2a530fbd00000000, 0x3276aef900000000, 0x3a95cec500000000, + 0x03229a4800000000, 0x0bc1fa7400000000, 0x13e45b3000000000, + 0x1b073b0c00000000, 0x23ae19b900000000, 0x2b4d798500000000, + 0x3368d8c100000000, 0x3b8bb8fd00000000, 0x0478d8e100000000, + 0x0c9bb8dd00000000, 0x14be199900000000, 0x1c5d79a500000000, + 0x24f45b1000000000, 0x2c173b2c00000000, 0x34329a6800000000, + 0x3cd1fa5400000000, 0x0566aed900000000, 0x0d85cee500000000, + 0x15a06fa100000000, 0x1d430f9d00000000, 0x25ea2d2800000000, + 0x2d094d1400000000, 0x352cec5000000000, 0x3dcf8c6c00000000, + 0x0644349100000000, 0x0ea754ad00000000, 0x1682f5e900000000, + 0x1e6195d500000000, 0x26c8b76000000000, 0x2e2bd75c00000000, + 0x360e761800000000, 0x3eed162400000000, 0x075a42a900000000, + 0x0fb9229500000000, 0x179c83d100000000, 0x1f7fe3ed00000000, + 0x27d6c15800000000, 0x2f35a16400000000, 0x3710002000000000, + 0x3ff3601c00000000, 0x49f6c11800000000, 0x4115a12400000000, + 0x5930006000000000, 0x51d3605c00000000, 0x697a42e900000000, + 0x619922d500000000, 0x79bc839100000000, 0x715fe3ad00000000, + 0x48e8b72000000000, 0x400bd71c00000000, 0x582e765800000000, + 0x50cd166400000000, 0x686434d100000000, 0x608754ed00000000, + 0x78a2f5a900000000, 0x7041959500000000, 0x4bca2d6800000000, + 0x43294d5400000000, 0x5b0cec1000000000, 0x53ef8c2c00000000, + 0x6b46ae9900000000, 0x63a5cea500000000, 0x7b806fe100000000, + 0x73630fdd00000000, 0x4ad45b5000000000, 0x42373b6c00000000, + 0x5a129a2800000000, 0x52f1fa1400000000, 0x6a58d8a100000000, + 0x62bbb89d00000000, 0x7a9e19d900000000, 0x727d79e500000000, + 0x4d8e19f900000000, 0x456d79c500000000, 0x5d48d88100000000, + 0x55abb8bd00000000, 0x6d029a0800000000, 0x65e1fa3400000000, + 0x7dc45b7000000000, 0x75273b4c00000000, 0x4c906fc100000000, + 0x44730ffd00000000, 0x5c56aeb900000000, 0x54b5ce8500000000, + 0x6c1cec3000000000, 0x64ff8c0c00000000, 0x7cda2d4800000000, + 0x74394d7400000000, 0x4fb2f58900000000, 0x475195b500000000, + 0x5f7434f100000000, 0x579754cd00000000, 0x6f3e767800000000, + 0x67dd164400000000, 0x7ff8b70000000000, 0x771bd73c00000000, + 0x4eac83b100000000, 0x464fe38d00000000, 0x5e6a42c900000000, + 0x568922f500000000, 0x6e20004000000000, 0x66c3607c00000000, + 0x7ee6c13800000000, 0x7605a10400000000, 0x92ec833100000000, + 0x9a0fe30d00000000, 0x822a424900000000, 0x8ac9227500000000, + 0xb26000c000000000, 0xba8360fc00000000, 0xa2a6c1b800000000, + 0xaa45a18400000000, 0x93f2f50900000000, 0x9b11953500000000, + 0x8334347100000000, 0x8bd7544d00000000, 0xb37e76f800000000, + 0xbb9d16c400000000, 0xa3b8b78000000000, 0xab5bd7bc00000000, + 0x90d06f4100000000, 0x98330f7d00000000, 0x8016ae3900000000, + 0x88f5ce0500000000, 0xb05cecb000000000, 0xb8bf8c8c00000000, + 0xa09a2dc800000000, 0xa8794df400000000, 0x91ce197900000000, + 0x992d794500000000, 0x8108d80100000000, 0x89ebb83d00000000, + 0xb1429a8800000000, 0xb9a1fab400000000, 0xa1845bf000000000, + 0xa9673bcc00000000, 0x96945bd000000000, 0x9e773bec00000000, + 0x86529aa800000000, 0x8eb1fa9400000000, 0xb618d82100000000, + 0xbefbb81d00000000, 0xa6de195900000000, 0xae3d796500000000, + 0x978a2de800000000, 0x9f694dd400000000, 0x874cec9000000000, + 0x8faf8cac00000000, 0xb706ae1900000000, 0xbfe5ce2500000000, + 0xa7c06f6100000000, 0xaf230f5d00000000, 0x94a8b7a000000000, + 0x9c4bd79c00000000, 0x846e76d800000000, 0x8c8d16e400000000, + 0xb424345100000000, 0xbcc7546d00000000, 0xa4e2f52900000000, + 0xac01951500000000, 0x95b6c19800000000, 0x9d55a1a400000000, + 0x857000e000000000, 0x8d9360dc00000000, 0xb53a426900000000, + 0xbdd9225500000000, 0xa5fc831100000000, 0xad1fe32d00000000, + 0xdb1a422900000000, 0xd3f9221500000000, 0xcbdc835100000000, + 0xc33fe36d00000000, 0xfb96c1d800000000, 0xf375a1e400000000, + 0xeb5000a000000000, 0xe3b3609c00000000, 0xda04341100000000, + 0xd2e7542d00000000, 0xcac2f56900000000, 0xc221955500000000, + 0xfa88b7e000000000, 0xf26bd7dc00000000, 0xea4e769800000000, + 0xe2ad16a400000000, 0xd926ae5900000000, 0xd1c5ce6500000000, + 0xc9e06f2100000000, 0xc1030f1d00000000, 0xf9aa2da800000000, + 0xf1494d9400000000, 0xe96cecd000000000, 0xe18f8cec00000000, + 0xd838d86100000000, 0xd0dbb85d00000000, 0xc8fe191900000000, + 0xc01d792500000000, 0xf8b45b9000000000, 0xf0573bac00000000, + 0xe8729ae800000000, 0xe091fad400000000, 0xdf629ac800000000, + 0xd781faf400000000, 0xcfa45bb000000000, 0xc7473b8c00000000, + 0xffee193900000000, 0xf70d790500000000, 0xef28d84100000000, + 0xe7cbb87d00000000, 0xde7cecf000000000, 0xd69f8ccc00000000, + 0xceba2d8800000000, 0xc6594db400000000, 0xfef06f0100000000, + 0xf6130f3d00000000, 0xee36ae7900000000, 0xe6d5ce4500000000, + 0xdd5e76b800000000, 0xd5bd168400000000, 0xcd98b7c000000000, + 0xc57bd7fc00000000, 0xfdd2f54900000000, 0xf531957500000000, + 0xed14343100000000, 0xe5f7540d00000000, 0xdc40008000000000, + 0xd4a360bc00000000, 0xcc86c1f800000000, 0xc465a1c400000000, + 0xfccc837100000000, 0xf42fe34d00000000, 0xec0a420900000000, + 0xe4e9223500000000}, + {0x0000000000000000, 0xd1e8e70e00000000, 0xa2d1cf1d00000000, + 0x7339281300000000, 0x44a39f3b00000000, 0x954b783500000000, + 0xe672502600000000, 0x379ab72800000000, 0x88463f7700000000, + 0x59aed87900000000, 0x2a97f06a00000000, 0xfb7f176400000000, + 0xcce5a04c00000000, 0x1d0d474200000000, 0x6e346f5100000000, + 0xbfdc885f00000000, 0x108d7eee00000000, 0xc16599e000000000, + 0xb25cb1f300000000, 0x63b456fd00000000, 0x542ee1d500000000, + 0x85c606db00000000, 0xf6ff2ec800000000, 0x2717c9c600000000, + 0x98cb419900000000, 0x4923a69700000000, 0x3a1a8e8400000000, + 0xebf2698a00000000, 0xdc68dea200000000, 0x0d8039ac00000000, + 0x7eb911bf00000000, 0xaf51f6b100000000, 0x611c8c0700000000, + 0xb0f46b0900000000, 0xc3cd431a00000000, 0x1225a41400000000, + 0x25bf133c00000000, 0xf457f43200000000, 0x876edc2100000000, + 0x56863b2f00000000, 0xe95ab37000000000, 0x38b2547e00000000, + 0x4b8b7c6d00000000, 0x9a639b6300000000, 0xadf92c4b00000000, + 0x7c11cb4500000000, 0x0f28e35600000000, 0xdec0045800000000, + 0x7191f2e900000000, 0xa07915e700000000, 0xd3403df400000000, + 0x02a8dafa00000000, 0x35326dd200000000, 0xe4da8adc00000000, + 0x97e3a2cf00000000, 0x460b45c100000000, 0xf9d7cd9e00000000, + 0x283f2a9000000000, 0x5b06028300000000, 0x8aeee58d00000000, + 0xbd7452a500000000, 0x6c9cb5ab00000000, 0x1fa59db800000000, + 0xce4d7ab600000000, 0xc238180f00000000, 0x13d0ff0100000000, + 0x60e9d71200000000, 0xb101301c00000000, 0x869b873400000000, + 0x5773603a00000000, 0x244a482900000000, 0xf5a2af2700000000, + 0x4a7e277800000000, 0x9b96c07600000000, 0xe8afe86500000000, + 0x39470f6b00000000, 0x0eddb84300000000, 0xdf355f4d00000000, + 0xac0c775e00000000, 0x7de4905000000000, 0xd2b566e100000000, + 0x035d81ef00000000, 0x7064a9fc00000000, 0xa18c4ef200000000, + 0x9616f9da00000000, 0x47fe1ed400000000, 0x34c736c700000000, + 0xe52fd1c900000000, 0x5af3599600000000, 0x8b1bbe9800000000, + 0xf822968b00000000, 0x29ca718500000000, 0x1e50c6ad00000000, + 0xcfb821a300000000, 0xbc8109b000000000, 0x6d69eebe00000000, + 0xa324940800000000, 0x72cc730600000000, 0x01f55b1500000000, + 0xd01dbc1b00000000, 0xe7870b3300000000, 0x366fec3d00000000, + 0x4556c42e00000000, 0x94be232000000000, 0x2b62ab7f00000000, + 0xfa8a4c7100000000, 0x89b3646200000000, 0x585b836c00000000, + 0x6fc1344400000000, 0xbe29d34a00000000, 0xcd10fb5900000000, + 0x1cf81c5700000000, 0xb3a9eae600000000, 0x62410de800000000, + 0x117825fb00000000, 0xc090c2f500000000, 0xf70a75dd00000000, + 0x26e292d300000000, 0x55dbbac000000000, 0x84335dce00000000, + 0x3befd59100000000, 0xea07329f00000000, 0x993e1a8c00000000, + 0x48d6fd8200000000, 0x7f4c4aaa00000000, 0xaea4ada400000000, + 0xdd9d85b700000000, 0x0c7562b900000000, 0x8471301e00000000, + 0x5599d71000000000, 0x26a0ff0300000000, 0xf748180d00000000, + 0xc0d2af2500000000, 0x113a482b00000000, 0x6203603800000000, + 0xb3eb873600000000, 0x0c370f6900000000, 0xdddfe86700000000, + 0xaee6c07400000000, 0x7f0e277a00000000, 0x4894905200000000, + 0x997c775c00000000, 0xea455f4f00000000, 0x3badb84100000000, + 0x94fc4ef000000000, 0x4514a9fe00000000, 0x362d81ed00000000, + 0xe7c566e300000000, 0xd05fd1cb00000000, 0x01b736c500000000, + 0x728e1ed600000000, 0xa366f9d800000000, 0x1cba718700000000, + 0xcd52968900000000, 0xbe6bbe9a00000000, 0x6f83599400000000, + 0x5819eebc00000000, 0x89f109b200000000, 0xfac821a100000000, + 0x2b20c6af00000000, 0xe56dbc1900000000, 0x34855b1700000000, + 0x47bc730400000000, 0x9654940a00000000, 0xa1ce232200000000, + 0x7026c42c00000000, 0x031fec3f00000000, 0xd2f70b3100000000, + 0x6d2b836e00000000, 0xbcc3646000000000, 0xcffa4c7300000000, + 0x1e12ab7d00000000, 0x29881c5500000000, 0xf860fb5b00000000, + 0x8b59d34800000000, 0x5ab1344600000000, 0xf5e0c2f700000000, + 0x240825f900000000, 0x57310dea00000000, 0x86d9eae400000000, + 0xb1435dcc00000000, 0x60abbac200000000, 0x139292d100000000, + 0xc27a75df00000000, 0x7da6fd8000000000, 0xac4e1a8e00000000, + 0xdf77329d00000000, 0x0e9fd59300000000, 0x390562bb00000000, + 0xe8ed85b500000000, 0x9bd4ada600000000, 0x4a3c4aa800000000, + 0x4649281100000000, 0x97a1cf1f00000000, 0xe498e70c00000000, + 0x3570000200000000, 0x02eab72a00000000, 0xd302502400000000, + 0xa03b783700000000, 0x71d39f3900000000, 0xce0f176600000000, + 0x1fe7f06800000000, 0x6cded87b00000000, 0xbd363f7500000000, + 0x8aac885d00000000, 0x5b446f5300000000, 0x287d474000000000, + 0xf995a04e00000000, 0x56c456ff00000000, 0x872cb1f100000000, + 0xf41599e200000000, 0x25fd7eec00000000, 0x1267c9c400000000, + 0xc38f2eca00000000, 0xb0b606d900000000, 0x615ee1d700000000, + 0xde82698800000000, 0x0f6a8e8600000000, 0x7c53a69500000000, + 0xadbb419b00000000, 0x9a21f6b300000000, 0x4bc911bd00000000, + 0x38f039ae00000000, 0xe918dea000000000, 0x2755a41600000000, + 0xf6bd431800000000, 0x85846b0b00000000, 0x546c8c0500000000, + 0x63f63b2d00000000, 0xb21edc2300000000, 0xc127f43000000000, + 0x10cf133e00000000, 0xaf139b6100000000, 0x7efb7c6f00000000, + 0x0dc2547c00000000, 0xdc2ab37200000000, 0xebb0045a00000000, + 0x3a58e35400000000, 0x4961cb4700000000, 0x98892c4900000000, + 0x37d8daf800000000, 0xe6303df600000000, 0x950915e500000000, + 0x44e1f2eb00000000, 0x737b45c300000000, 0xa293a2cd00000000, + 0xd1aa8ade00000000, 0x00426dd000000000, 0xbf9ee58f00000000, + 0x6e76028100000000, 0x1d4f2a9200000000, 0xcca7cd9c00000000, + 0xfb3d7ab400000000, 0x2ad59dba00000000, 0x59ecb5a900000000, + 0x880452a700000000}, + {0x0000000000000000, 0xaa05daf100000000, 0x150dc53800000000, + 0xbf081fc900000000, 0x2a1a8a7100000000, 0x801f508000000000, + 0x3f174f4900000000, 0x951295b800000000, 0x543414e300000000, + 0xfe31ce1200000000, 0x4139d1db00000000, 0xeb3c0b2a00000000, + 0x7e2e9e9200000000, 0xd42b446300000000, 0x6b235baa00000000, + 0xc126815b00000000, 0xe96e591d00000000, 0x436b83ec00000000, + 0xfc639c2500000000, 0x566646d400000000, 0xc374d36c00000000, + 0x6971099d00000000, 0xd679165400000000, 0x7c7ccca500000000, + 0xbd5a4dfe00000000, 0x175f970f00000000, 0xa85788c600000000, + 0x0252523700000000, 0x9740c78f00000000, 0x3d451d7e00000000, + 0x824d02b700000000, 0x2848d84600000000, 0xd2ddb23a00000000, + 0x78d868cb00000000, 0xc7d0770200000000, 0x6dd5adf300000000, + 0xf8c7384b00000000, 0x52c2e2ba00000000, 0xedcafd7300000000, + 0x47cf278200000000, 0x86e9a6d900000000, 0x2cec7c2800000000, + 0x93e463e100000000, 0x39e1b91000000000, 0xacf32ca800000000, + 0x06f6f65900000000, 0xb9fee99000000000, 0x13fb336100000000, + 0x3bb3eb2700000000, 0x91b631d600000000, 0x2ebe2e1f00000000, + 0x84bbf4ee00000000, 0x11a9615600000000, 0xbbacbba700000000, + 0x04a4a46e00000000, 0xaea17e9f00000000, 0x6f87ffc400000000, + 0xc582253500000000, 0x7a8a3afc00000000, 0xd08fe00d00000000, + 0x459d75b500000000, 0xef98af4400000000, 0x5090b08d00000000, + 0xfa956a7c00000000, 0xa4bb657500000000, 0x0ebebf8400000000, + 0xb1b6a04d00000000, 0x1bb37abc00000000, 0x8ea1ef0400000000, + 0x24a435f500000000, 0x9bac2a3c00000000, 0x31a9f0cd00000000, + 0xf08f719600000000, 0x5a8aab6700000000, 0xe582b4ae00000000, + 0x4f876e5f00000000, 0xda95fbe700000000, 0x7090211600000000, + 0xcf983edf00000000, 0x659de42e00000000, 0x4dd53c6800000000, + 0xe7d0e69900000000, 0x58d8f95000000000, 0xf2dd23a100000000, + 0x67cfb61900000000, 0xcdca6ce800000000, 0x72c2732100000000, + 0xd8c7a9d000000000, 0x19e1288b00000000, 0xb3e4f27a00000000, + 0x0cecedb300000000, 0xa6e9374200000000, 0x33fba2fa00000000, + 0x99fe780b00000000, 0x26f667c200000000, 0x8cf3bd3300000000, + 0x7666d74f00000000, 0xdc630dbe00000000, 0x636b127700000000, + 0xc96ec88600000000, 0x5c7c5d3e00000000, 0xf67987cf00000000, + 0x4971980600000000, 0xe37442f700000000, 0x2252c3ac00000000, + 0x8857195d00000000, 0x375f069400000000, 0x9d5adc6500000000, + 0x084849dd00000000, 0xa24d932c00000000, 0x1d458ce500000000, + 0xb740561400000000, 0x9f088e5200000000, 0x350d54a300000000, + 0x8a054b6a00000000, 0x2000919b00000000, 0xb512042300000000, + 0x1f17ded200000000, 0xa01fc11b00000000, 0x0a1a1bea00000000, + 0xcb3c9ab100000000, 0x6139404000000000, 0xde315f8900000000, + 0x7434857800000000, 0xe12610c000000000, 0x4b23ca3100000000, + 0xf42bd5f800000000, 0x5e2e0f0900000000, 0x4877cbea00000000, + 0xe272111b00000000, 0x5d7a0ed200000000, 0xf77fd42300000000, + 0x626d419b00000000, 0xc8689b6a00000000, 0x776084a300000000, + 0xdd655e5200000000, 0x1c43df0900000000, 0xb64605f800000000, + 0x094e1a3100000000, 0xa34bc0c000000000, 0x3659557800000000, + 0x9c5c8f8900000000, 0x2354904000000000, 0x89514ab100000000, + 0xa11992f700000000, 0x0b1c480600000000, 0xb41457cf00000000, + 0x1e118d3e00000000, 0x8b03188600000000, 0x2106c27700000000, + 0x9e0eddbe00000000, 0x340b074f00000000, 0xf52d861400000000, + 0x5f285ce500000000, 0xe020432c00000000, 0x4a2599dd00000000, + 0xdf370c6500000000, 0x7532d69400000000, 0xca3ac95d00000000, + 0x603f13ac00000000, 0x9aaa79d000000000, 0x30afa32100000000, + 0x8fa7bce800000000, 0x25a2661900000000, 0xb0b0f3a100000000, + 0x1ab5295000000000, 0xa5bd369900000000, 0x0fb8ec6800000000, + 0xce9e6d3300000000, 0x649bb7c200000000, 0xdb93a80b00000000, + 0x719672fa00000000, 0xe484e74200000000, 0x4e813db300000000, + 0xf189227a00000000, 0x5b8cf88b00000000, 0x73c420cd00000000, + 0xd9c1fa3c00000000, 0x66c9e5f500000000, 0xcccc3f0400000000, + 0x59deaabc00000000, 0xf3db704d00000000, 0x4cd36f8400000000, + 0xe6d6b57500000000, 0x27f0342e00000000, 0x8df5eedf00000000, + 0x32fdf11600000000, 0x98f82be700000000, 0x0deabe5f00000000, + 0xa7ef64ae00000000, 0x18e77b6700000000, 0xb2e2a19600000000, + 0xecccae9f00000000, 0x46c9746e00000000, 0xf9c16ba700000000, + 0x53c4b15600000000, 0xc6d624ee00000000, 0x6cd3fe1f00000000, + 0xd3dbe1d600000000, 0x79de3b2700000000, 0xb8f8ba7c00000000, + 0x12fd608d00000000, 0xadf57f4400000000, 0x07f0a5b500000000, + 0x92e2300d00000000, 0x38e7eafc00000000, 0x87eff53500000000, + 0x2dea2fc400000000, 0x05a2f78200000000, 0xafa72d7300000000, + 0x10af32ba00000000, 0xbaaae84b00000000, 0x2fb87df300000000, + 0x85bda70200000000, 0x3ab5b8cb00000000, 0x90b0623a00000000, + 0x5196e36100000000, 0xfb93399000000000, 0x449b265900000000, + 0xee9efca800000000, 0x7b8c691000000000, 0xd189b3e100000000, + 0x6e81ac2800000000, 0xc48476d900000000, 0x3e111ca500000000, + 0x9414c65400000000, 0x2b1cd99d00000000, 0x8119036c00000000, + 0x140b96d400000000, 0xbe0e4c2500000000, 0x010653ec00000000, + 0xab03891d00000000, 0x6a25084600000000, 0xc020d2b700000000, + 0x7f28cd7e00000000, 0xd52d178f00000000, 0x403f823700000000, + 0xea3a58c600000000, 0x5532470f00000000, 0xff379dfe00000000, + 0xd77f45b800000000, 0x7d7a9f4900000000, 0xc272808000000000, + 0x68775a7100000000, 0xfd65cfc900000000, 0x5760153800000000, + 0xe8680af100000000, 0x426dd00000000000, 0x834b515b00000000, + 0x294e8baa00000000, 0x9646946300000000, 0x3c434e9200000000, + 0xa951db2a00000000, 0x035401db00000000, 0xbc5c1e1200000000, + 0x1659c4e300000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xae689191, 0x87a02563, 0x29c8b4f2, 0xd4314c87, + 0x7a59dd16, 0x539169e4, 0xfdf9f875, 0x73139f4f, 0xdd7b0ede, + 0xf4b3ba2c, 0x5adb2bbd, 0xa722d3c8, 0x094a4259, 0x2082f6ab, + 0x8eea673a, 0xe6273e9e, 0x484faf0f, 0x61871bfd, 0xcfef8a6c, + 0x32167219, 0x9c7ee388, 0xb5b6577a, 0x1bdec6eb, 0x9534a1d1, + 0x3b5c3040, 0x129484b2, 0xbcfc1523, 0x4105ed56, 0xef6d7cc7, + 0xc6a5c835, 0x68cd59a4, 0x173f7b7d, 0xb957eaec, 0x909f5e1e, + 0x3ef7cf8f, 0xc30e37fa, 0x6d66a66b, 0x44ae1299, 0xeac68308, + 0x642ce432, 0xca4475a3, 0xe38cc151, 0x4de450c0, 0xb01da8b5, + 0x1e753924, 0x37bd8dd6, 0x99d51c47, 0xf11845e3, 0x5f70d472, + 0x76b86080, 0xd8d0f111, 0x25290964, 0x8b4198f5, 0xa2892c07, + 0x0ce1bd96, 0x820bdaac, 0x2c634b3d, 0x05abffcf, 0xabc36e5e, + 0x563a962b, 0xf85207ba, 0xd19ab348, 0x7ff222d9, 0x2e7ef6fa, + 0x8016676b, 0xa9ded399, 0x07b64208, 0xfa4fba7d, 0x54272bec, + 0x7def9f1e, 0xd3870e8f, 0x5d6d69b5, 0xf305f824, 0xdacd4cd6, + 0x74a5dd47, 0x895c2532, 0x2734b4a3, 0x0efc0051, 0xa09491c0, + 0xc859c864, 0x663159f5, 0x4ff9ed07, 0xe1917c96, 0x1c6884e3, + 0xb2001572, 0x9bc8a180, 0x35a03011, 0xbb4a572b, 0x1522c6ba, + 0x3cea7248, 0x9282e3d9, 0x6f7b1bac, 0xc1138a3d, 0xe8db3ecf, + 0x46b3af5e, 0x39418d87, 0x97291c16, 0xbee1a8e4, 0x10893975, + 0xed70c100, 0x43185091, 0x6ad0e463, 0xc4b875f2, 0x4a5212c8, + 0xe43a8359, 0xcdf237ab, 0x639aa63a, 0x9e635e4f, 0x300bcfde, + 0x19c37b2c, 0xb7abeabd, 0xdf66b319, 0x710e2288, 0x58c6967a, + 0xf6ae07eb, 0x0b57ff9e, 0xa53f6e0f, 0x8cf7dafd, 0x229f4b6c, + 0xac752c56, 0x021dbdc7, 0x2bd50935, 0x85bd98a4, 0x784460d1, + 0xd62cf140, 0xffe445b2, 0x518cd423, 0x5cfdedf4, 0xf2957c65, + 0xdb5dc897, 0x75355906, 0x88cca173, 0x26a430e2, 0x0f6c8410, + 0xa1041581, 0x2fee72bb, 0x8186e32a, 0xa84e57d8, 0x0626c649, + 0xfbdf3e3c, 0x55b7afad, 0x7c7f1b5f, 0xd2178ace, 0xbadad36a, + 0x14b242fb, 0x3d7af609, 0x93126798, 0x6eeb9fed, 0xc0830e7c, + 0xe94bba8e, 0x47232b1f, 0xc9c94c25, 0x67a1ddb4, 0x4e696946, + 0xe001f8d7, 0x1df800a2, 0xb3909133, 0x9a5825c1, 0x3430b450, + 0x4bc29689, 0xe5aa0718, 0xcc62b3ea, 0x620a227b, 0x9ff3da0e, + 0x319b4b9f, 0x1853ff6d, 0xb63b6efc, 0x38d109c6, 0x96b99857, + 0xbf712ca5, 0x1119bd34, 0xece04541, 0x4288d4d0, 0x6b406022, + 0xc528f1b3, 0xade5a817, 0x038d3986, 0x2a458d74, 0x842d1ce5, + 0x79d4e490, 0xd7bc7501, 0xfe74c1f3, 0x501c5062, 0xdef63758, + 0x709ea6c9, 0x5956123b, 0xf73e83aa, 0x0ac77bdf, 0xa4afea4e, + 0x8d675ebc, 0x230fcf2d, 0x72831b0e, 0xdceb8a9f, 0xf5233e6d, + 0x5b4baffc, 0xa6b25789, 0x08dac618, 0x211272ea, 0x8f7ae37b, + 0x01908441, 0xaff815d0, 0x8630a122, 0x285830b3, 0xd5a1c8c6, + 0x7bc95957, 0x5201eda5, 0xfc697c34, 0x94a42590, 0x3accb401, + 0x130400f3, 0xbd6c9162, 0x40956917, 0xeefdf886, 0xc7354c74, + 0x695ddde5, 0xe7b7badf, 0x49df2b4e, 0x60179fbc, 0xce7f0e2d, + 0x3386f658, 0x9dee67c9, 0xb426d33b, 0x1a4e42aa, 0x65bc6073, + 0xcbd4f1e2, 0xe21c4510, 0x4c74d481, 0xb18d2cf4, 0x1fe5bd65, + 0x362d0997, 0x98459806, 0x16afff3c, 0xb8c76ead, 0x910fda5f, + 0x3f674bce, 0xc29eb3bb, 0x6cf6222a, 0x453e96d8, 0xeb560749, + 0x839b5eed, 0x2df3cf7c, 0x043b7b8e, 0xaa53ea1f, 0x57aa126a, + 0xf9c283fb, 0xd00a3709, 0x7e62a698, 0xf088c1a2, 0x5ee05033, + 0x7728e4c1, 0xd9407550, 0x24b98d25, 0x8ad11cb4, 0xa319a846, + 0x0d7139d7}, + {0x00000000, 0xb9fbdbe8, 0xa886b191, 0x117d6a79, 0x8a7c6563, + 0x3387be8b, 0x22fad4f2, 0x9b010f1a, 0xcf89cc87, 0x7672176f, + 0x670f7d16, 0xdef4a6fe, 0x45f5a9e4, 0xfc0e720c, 0xed731875, + 0x5488c39d, 0x44629f4f, 0xfd9944a7, 0xece42ede, 0x551ff536, + 0xce1efa2c, 0x77e521c4, 0x66984bbd, 0xdf639055, 0x8beb53c8, + 0x32108820, 0x236de259, 0x9a9639b1, 0x019736ab, 0xb86ced43, + 0xa911873a, 0x10ea5cd2, 0x88c53e9e, 0x313ee576, 0x20438f0f, + 0x99b854e7, 0x02b95bfd, 0xbb428015, 0xaa3fea6c, 0x13c43184, + 0x474cf219, 0xfeb729f1, 0xefca4388, 0x56319860, 0xcd30977a, + 0x74cb4c92, 0x65b626eb, 0xdc4dfd03, 0xcca7a1d1, 0x755c7a39, + 0x64211040, 0xdddacba8, 0x46dbc4b2, 0xff201f5a, 0xee5d7523, + 0x57a6aecb, 0x032e6d56, 0xbad5b6be, 0xaba8dcc7, 0x1253072f, + 0x89520835, 0x30a9d3dd, 0x21d4b9a4, 0x982f624c, 0xcafb7b7d, + 0x7300a095, 0x627dcaec, 0xdb861104, 0x40871e1e, 0xf97cc5f6, + 0xe801af8f, 0x51fa7467, 0x0572b7fa, 0xbc896c12, 0xadf4066b, + 0x140fdd83, 0x8f0ed299, 0x36f50971, 0x27886308, 0x9e73b8e0, + 0x8e99e432, 0x37623fda, 0x261f55a3, 0x9fe48e4b, 0x04e58151, + 0xbd1e5ab9, 0xac6330c0, 0x1598eb28, 0x411028b5, 0xf8ebf35d, + 0xe9969924, 0x506d42cc, 0xcb6c4dd6, 0x7297963e, 0x63eafc47, + 0xda1127af, 0x423e45e3, 0xfbc59e0b, 0xeab8f472, 0x53432f9a, + 0xc8422080, 0x71b9fb68, 0x60c49111, 0xd93f4af9, 0x8db78964, + 0x344c528c, 0x253138f5, 0x9ccae31d, 0x07cbec07, 0xbe3037ef, + 0xaf4d5d96, 0x16b6867e, 0x065cdaac, 0xbfa70144, 0xaeda6b3d, + 0x1721b0d5, 0x8c20bfcf, 0x35db6427, 0x24a60e5e, 0x9d5dd5b6, + 0xc9d5162b, 0x702ecdc3, 0x6153a7ba, 0xd8a87c52, 0x43a97348, + 0xfa52a8a0, 0xeb2fc2d9, 0x52d41931, 0x4e87f0bb, 0xf77c2b53, + 0xe601412a, 0x5ffa9ac2, 0xc4fb95d8, 0x7d004e30, 0x6c7d2449, + 0xd586ffa1, 0x810e3c3c, 0x38f5e7d4, 0x29888dad, 0x90735645, + 0x0b72595f, 0xb28982b7, 0xa3f4e8ce, 0x1a0f3326, 0x0ae56ff4, + 0xb31eb41c, 0xa263de65, 0x1b98058d, 0x80990a97, 0x3962d17f, + 0x281fbb06, 0x91e460ee, 0xc56ca373, 0x7c97789b, 0x6dea12e2, + 0xd411c90a, 0x4f10c610, 0xf6eb1df8, 0xe7967781, 0x5e6dac69, + 0xc642ce25, 0x7fb915cd, 0x6ec47fb4, 0xd73fa45c, 0x4c3eab46, + 0xf5c570ae, 0xe4b81ad7, 0x5d43c13f, 0x09cb02a2, 0xb030d94a, + 0xa14db333, 0x18b668db, 0x83b767c1, 0x3a4cbc29, 0x2b31d650, + 0x92ca0db8, 0x8220516a, 0x3bdb8a82, 0x2aa6e0fb, 0x935d3b13, + 0x085c3409, 0xb1a7efe1, 0xa0da8598, 0x19215e70, 0x4da99ded, + 0xf4524605, 0xe52f2c7c, 0x5cd4f794, 0xc7d5f88e, 0x7e2e2366, + 0x6f53491f, 0xd6a892f7, 0x847c8bc6, 0x3d87502e, 0x2cfa3a57, + 0x9501e1bf, 0x0e00eea5, 0xb7fb354d, 0xa6865f34, 0x1f7d84dc, + 0x4bf54741, 0xf20e9ca9, 0xe373f6d0, 0x5a882d38, 0xc1892222, + 0x7872f9ca, 0x690f93b3, 0xd0f4485b, 0xc01e1489, 0x79e5cf61, + 0x6898a518, 0xd1637ef0, 0x4a6271ea, 0xf399aa02, 0xe2e4c07b, + 0x5b1f1b93, 0x0f97d80e, 0xb66c03e6, 0xa711699f, 0x1eeab277, + 0x85ebbd6d, 0x3c106685, 0x2d6d0cfc, 0x9496d714, 0x0cb9b558, + 0xb5426eb0, 0xa43f04c9, 0x1dc4df21, 0x86c5d03b, 0x3f3e0bd3, + 0x2e4361aa, 0x97b8ba42, 0xc33079df, 0x7acba237, 0x6bb6c84e, + 0xd24d13a6, 0x494c1cbc, 0xf0b7c754, 0xe1caad2d, 0x583176c5, + 0x48db2a17, 0xf120f1ff, 0xe05d9b86, 0x59a6406e, 0xc2a74f74, + 0x7b5c949c, 0x6a21fee5, 0xd3da250d, 0x8752e690, 0x3ea93d78, + 0x2fd45701, 0x962f8ce9, 0x0d2e83f3, 0xb4d5581b, 0xa5a83262, + 0x1c53e98a}, + {0x00000000, 0x9d0fe176, 0xe16ec4ad, 0x7c6125db, 0x19ac8f1b, + 0x84a36e6d, 0xf8c24bb6, 0x65cdaac0, 0x33591e36, 0xae56ff40, + 0xd237da9b, 0x4f383bed, 0x2af5912d, 0xb7fa705b, 0xcb9b5580, + 0x5694b4f6, 0x66b23c6c, 0xfbbddd1a, 0x87dcf8c1, 0x1ad319b7, + 0x7f1eb377, 0xe2115201, 0x9e7077da, 0x037f96ac, 0x55eb225a, + 0xc8e4c32c, 0xb485e6f7, 0x298a0781, 0x4c47ad41, 0xd1484c37, + 0xad2969ec, 0x3026889a, 0xcd6478d8, 0x506b99ae, 0x2c0abc75, + 0xb1055d03, 0xd4c8f7c3, 0x49c716b5, 0x35a6336e, 0xa8a9d218, + 0xfe3d66ee, 0x63328798, 0x1f53a243, 0x825c4335, 0xe791e9f5, + 0x7a9e0883, 0x06ff2d58, 0x9bf0cc2e, 0xabd644b4, 0x36d9a5c2, + 0x4ab88019, 0xd7b7616f, 0xb27acbaf, 0x2f752ad9, 0x53140f02, + 0xce1bee74, 0x988f5a82, 0x0580bbf4, 0x79e19e2f, 0xe4ee7f59, + 0x8123d599, 0x1c2c34ef, 0x604d1134, 0xfd42f042, 0x41b9f7f1, + 0xdcb61687, 0xa0d7335c, 0x3dd8d22a, 0x581578ea, 0xc51a999c, + 0xb97bbc47, 0x24745d31, 0x72e0e9c7, 0xefef08b1, 0x938e2d6a, + 0x0e81cc1c, 0x6b4c66dc, 0xf64387aa, 0x8a22a271, 0x172d4307, + 0x270bcb9d, 0xba042aeb, 0xc6650f30, 0x5b6aee46, 0x3ea74486, + 0xa3a8a5f0, 0xdfc9802b, 0x42c6615d, 0x1452d5ab, 0x895d34dd, + 0xf53c1106, 0x6833f070, 0x0dfe5ab0, 0x90f1bbc6, 0xec909e1d, + 0x719f7f6b, 0x8cdd8f29, 0x11d26e5f, 0x6db34b84, 0xf0bcaaf2, + 0x95710032, 0x087ee144, 0x741fc49f, 0xe91025e9, 0xbf84911f, + 0x228b7069, 0x5eea55b2, 0xc3e5b4c4, 0xa6281e04, 0x3b27ff72, + 0x4746daa9, 0xda493bdf, 0xea6fb345, 0x77605233, 0x0b0177e8, + 0x960e969e, 0xf3c33c5e, 0x6eccdd28, 0x12adf8f3, 0x8fa21985, + 0xd936ad73, 0x44394c05, 0x385869de, 0xa55788a8, 0xc09a2268, + 0x5d95c31e, 0x21f4e6c5, 0xbcfb07b3, 0x8373efe2, 0x1e7c0e94, + 0x621d2b4f, 0xff12ca39, 0x9adf60f9, 0x07d0818f, 0x7bb1a454, + 0xe6be4522, 0xb02af1d4, 0x2d2510a2, 0x51443579, 0xcc4bd40f, + 0xa9867ecf, 0x34899fb9, 0x48e8ba62, 0xd5e75b14, 0xe5c1d38e, + 0x78ce32f8, 0x04af1723, 0x99a0f655, 0xfc6d5c95, 0x6162bde3, + 0x1d039838, 0x800c794e, 0xd698cdb8, 0x4b972cce, 0x37f60915, + 0xaaf9e863, 0xcf3442a3, 0x523ba3d5, 0x2e5a860e, 0xb3556778, + 0x4e17973a, 0xd318764c, 0xaf795397, 0x3276b2e1, 0x57bb1821, + 0xcab4f957, 0xb6d5dc8c, 0x2bda3dfa, 0x7d4e890c, 0xe041687a, + 0x9c204da1, 0x012facd7, 0x64e20617, 0xf9ede761, 0x858cc2ba, + 0x188323cc, 0x28a5ab56, 0xb5aa4a20, 0xc9cb6ffb, 0x54c48e8d, + 0x3109244d, 0xac06c53b, 0xd067e0e0, 0x4d680196, 0x1bfcb560, + 0x86f35416, 0xfa9271cd, 0x679d90bb, 0x02503a7b, 0x9f5fdb0d, + 0xe33efed6, 0x7e311fa0, 0xc2ca1813, 0x5fc5f965, 0x23a4dcbe, + 0xbeab3dc8, 0xdb669708, 0x4669767e, 0x3a0853a5, 0xa707b2d3, + 0xf1930625, 0x6c9ce753, 0x10fdc288, 0x8df223fe, 0xe83f893e, + 0x75306848, 0x09514d93, 0x945eace5, 0xa478247f, 0x3977c509, + 0x4516e0d2, 0xd81901a4, 0xbdd4ab64, 0x20db4a12, 0x5cba6fc9, + 0xc1b58ebf, 0x97213a49, 0x0a2edb3f, 0x764ffee4, 0xeb401f92, + 0x8e8db552, 0x13825424, 0x6fe371ff, 0xf2ec9089, 0x0fae60cb, + 0x92a181bd, 0xeec0a466, 0x73cf4510, 0x1602efd0, 0x8b0d0ea6, + 0xf76c2b7d, 0x6a63ca0b, 0x3cf77efd, 0xa1f89f8b, 0xdd99ba50, + 0x40965b26, 0x255bf1e6, 0xb8541090, 0xc435354b, 0x593ad43d, + 0x691c5ca7, 0xf413bdd1, 0x8872980a, 0x157d797c, 0x70b0d3bc, + 0xedbf32ca, 0x91de1711, 0x0cd1f667, 0x5a454291, 0xc74aa3e7, + 0xbb2b863c, 0x2624674a, 0x43e9cd8a, 0xdee62cfc, 0xa2870927, + 0x3f88e851}, + {0x00000000, 0xdd96d985, 0x605cb54b, 0xbdca6cce, 0xc0b96a96, + 0x1d2fb313, 0xa0e5dfdd, 0x7d730658, 0x5a03d36d, 0x87950ae8, + 0x3a5f6626, 0xe7c9bfa3, 0x9abab9fb, 0x472c607e, 0xfae60cb0, + 0x2770d535, 0xb407a6da, 0x69917f5f, 0xd45b1391, 0x09cdca14, + 0x74becc4c, 0xa92815c9, 0x14e27907, 0xc974a082, 0xee0475b7, + 0x3392ac32, 0x8e58c0fc, 0x53ce1979, 0x2ebd1f21, 0xf32bc6a4, + 0x4ee1aa6a, 0x937773ef, 0xb37e4bf5, 0x6ee89270, 0xd322febe, + 0x0eb4273b, 0x73c72163, 0xae51f8e6, 0x139b9428, 0xce0d4dad, + 0xe97d9898, 0x34eb411d, 0x89212dd3, 0x54b7f456, 0x29c4f20e, + 0xf4522b8b, 0x49984745, 0x940e9ec0, 0x0779ed2f, 0xdaef34aa, + 0x67255864, 0xbab381e1, 0xc7c087b9, 0x1a565e3c, 0xa79c32f2, + 0x7a0aeb77, 0x5d7a3e42, 0x80ece7c7, 0x3d268b09, 0xe0b0528c, + 0x9dc354d4, 0x40558d51, 0xfd9fe19f, 0x2009381a, 0xbd8d91ab, + 0x601b482e, 0xddd124e0, 0x0047fd65, 0x7d34fb3d, 0xa0a222b8, + 0x1d684e76, 0xc0fe97f3, 0xe78e42c6, 0x3a189b43, 0x87d2f78d, + 0x5a442e08, 0x27372850, 0xfaa1f1d5, 0x476b9d1b, 0x9afd449e, + 0x098a3771, 0xd41ceef4, 0x69d6823a, 0xb4405bbf, 0xc9335de7, + 0x14a58462, 0xa96fe8ac, 0x74f93129, 0x5389e41c, 0x8e1f3d99, + 0x33d55157, 0xee4388d2, 0x93308e8a, 0x4ea6570f, 0xf36c3bc1, + 0x2efae244, 0x0ef3da5e, 0xd36503db, 0x6eaf6f15, 0xb339b690, + 0xce4ab0c8, 0x13dc694d, 0xae160583, 0x7380dc06, 0x54f00933, + 0x8966d0b6, 0x34acbc78, 0xe93a65fd, 0x944963a5, 0x49dfba20, + 0xf415d6ee, 0x29830f6b, 0xbaf47c84, 0x6762a501, 0xdaa8c9cf, + 0x073e104a, 0x7a4d1612, 0xa7dbcf97, 0x1a11a359, 0xc7877adc, + 0xe0f7afe9, 0x3d61766c, 0x80ab1aa2, 0x5d3dc327, 0x204ec57f, + 0xfdd81cfa, 0x40127034, 0x9d84a9b1, 0xa06a2517, 0x7dfcfc92, + 0xc036905c, 0x1da049d9, 0x60d34f81, 0xbd459604, 0x008ffaca, + 0xdd19234f, 0xfa69f67a, 0x27ff2fff, 0x9a354331, 0x47a39ab4, + 0x3ad09cec, 0xe7464569, 0x5a8c29a7, 0x871af022, 0x146d83cd, + 0xc9fb5a48, 0x74313686, 0xa9a7ef03, 0xd4d4e95b, 0x094230de, + 0xb4885c10, 0x691e8595, 0x4e6e50a0, 0x93f88925, 0x2e32e5eb, + 0xf3a43c6e, 0x8ed73a36, 0x5341e3b3, 0xee8b8f7d, 0x331d56f8, + 0x13146ee2, 0xce82b767, 0x7348dba9, 0xaede022c, 0xd3ad0474, + 0x0e3bddf1, 0xb3f1b13f, 0x6e6768ba, 0x4917bd8f, 0x9481640a, + 0x294b08c4, 0xf4ddd141, 0x89aed719, 0x54380e9c, 0xe9f26252, + 0x3464bbd7, 0xa713c838, 0x7a8511bd, 0xc74f7d73, 0x1ad9a4f6, + 0x67aaa2ae, 0xba3c7b2b, 0x07f617e5, 0xda60ce60, 0xfd101b55, + 0x2086c2d0, 0x9d4cae1e, 0x40da779b, 0x3da971c3, 0xe03fa846, + 0x5df5c488, 0x80631d0d, 0x1de7b4bc, 0xc0716d39, 0x7dbb01f7, + 0xa02dd872, 0xdd5ede2a, 0x00c807af, 0xbd026b61, 0x6094b2e4, + 0x47e467d1, 0x9a72be54, 0x27b8d29a, 0xfa2e0b1f, 0x875d0d47, + 0x5acbd4c2, 0xe701b80c, 0x3a976189, 0xa9e01266, 0x7476cbe3, + 0xc9bca72d, 0x142a7ea8, 0x695978f0, 0xb4cfa175, 0x0905cdbb, + 0xd493143e, 0xf3e3c10b, 0x2e75188e, 0x93bf7440, 0x4e29adc5, + 0x335aab9d, 0xeecc7218, 0x53061ed6, 0x8e90c753, 0xae99ff49, + 0x730f26cc, 0xcec54a02, 0x13539387, 0x6e2095df, 0xb3b64c5a, + 0x0e7c2094, 0xd3eaf911, 0xf49a2c24, 0x290cf5a1, 0x94c6996f, + 0x495040ea, 0x342346b2, 0xe9b59f37, 0x547ff3f9, 0x89e92a7c, + 0x1a9e5993, 0xc7088016, 0x7ac2ecd8, 0xa754355d, 0xda273305, + 0x07b1ea80, 0xba7b864e, 0x67ed5fcb, 0x409d8afe, 0x9d0b537b, + 0x20c13fb5, 0xfd57e630, 0x8024e068, 0x5db239ed, 0xe0785523, + 0x3dee8ca6}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x85d996dd, 0x4bb55c60, 0xce6ccabd, 0x966ab9c0, + 0x13b32f1d, 0xdddfe5a0, 0x5806737d, 0x6dd3035a, 0xe80a9587, + 0x26665f3a, 0xa3bfc9e7, 0xfbb9ba9a, 0x7e602c47, 0xb00ce6fa, + 0x35d57027, 0xdaa607b4, 0x5f7f9169, 0x91135bd4, 0x14cacd09, + 0x4cccbe74, 0xc91528a9, 0x0779e214, 0x82a074c9, 0xb77504ee, + 0x32ac9233, 0xfcc0588e, 0x7919ce53, 0x211fbd2e, 0xa4c62bf3, + 0x6aaae14e, 0xef737793, 0xf54b7eb3, 0x7092e86e, 0xbefe22d3, + 0x3b27b40e, 0x6321c773, 0xe6f851ae, 0x28949b13, 0xad4d0dce, + 0x98987de9, 0x1d41eb34, 0xd32d2189, 0x56f4b754, 0x0ef2c429, + 0x8b2b52f4, 0x45479849, 0xc09e0e94, 0x2fed7907, 0xaa34efda, + 0x64582567, 0xe181b3ba, 0xb987c0c7, 0x3c5e561a, 0xf2329ca7, + 0x77eb0a7a, 0x423e7a5d, 0xc7e7ec80, 0x098b263d, 0x8c52b0e0, + 0xd454c39d, 0x518d5540, 0x9fe19ffd, 0x1a380920, 0xab918dbd, + 0x2e481b60, 0xe024d1dd, 0x65fd4700, 0x3dfb347d, 0xb822a2a0, + 0x764e681d, 0xf397fec0, 0xc6428ee7, 0x439b183a, 0x8df7d287, + 0x082e445a, 0x50283727, 0xd5f1a1fa, 0x1b9d6b47, 0x9e44fd9a, + 0x71378a09, 0xf4ee1cd4, 0x3a82d669, 0xbf5b40b4, 0xe75d33c9, + 0x6284a514, 0xace86fa9, 0x2931f974, 0x1ce48953, 0x993d1f8e, + 0x5751d533, 0xd28843ee, 0x8a8e3093, 0x0f57a64e, 0xc13b6cf3, + 0x44e2fa2e, 0x5edaf30e, 0xdb0365d3, 0x156faf6e, 0x90b639b3, + 0xc8b04ace, 0x4d69dc13, 0x830516ae, 0x06dc8073, 0x3309f054, + 0xb6d06689, 0x78bcac34, 0xfd653ae9, 0xa5634994, 0x20badf49, + 0xeed615f4, 0x6b0f8329, 0x847cf4ba, 0x01a56267, 0xcfc9a8da, + 0x4a103e07, 0x12164d7a, 0x97cfdba7, 0x59a3111a, 0xdc7a87c7, + 0xe9aff7e0, 0x6c76613d, 0xa21aab80, 0x27c33d5d, 0x7fc54e20, + 0xfa1cd8fd, 0x34701240, 0xb1a9849d, 0x17256aa0, 0x92fcfc7d, + 0x5c9036c0, 0xd949a01d, 0x814fd360, 0x049645bd, 0xcafa8f00, + 0x4f2319dd, 0x7af669fa, 0xff2fff27, 0x3143359a, 0xb49aa347, + 0xec9cd03a, 0x694546e7, 0xa7298c5a, 0x22f01a87, 0xcd836d14, + 0x485afbc9, 0x86363174, 0x03efa7a9, 0x5be9d4d4, 0xde304209, + 0x105c88b4, 0x95851e69, 0xa0506e4e, 0x2589f893, 0xebe5322e, + 0x6e3ca4f3, 0x363ad78e, 0xb3e34153, 0x7d8f8bee, 0xf8561d33, + 0xe26e1413, 0x67b782ce, 0xa9db4873, 0x2c02deae, 0x7404add3, + 0xf1dd3b0e, 0x3fb1f1b3, 0xba68676e, 0x8fbd1749, 0x0a648194, + 0xc4084b29, 0x41d1ddf4, 0x19d7ae89, 0x9c0e3854, 0x5262f2e9, + 0xd7bb6434, 0x38c813a7, 0xbd11857a, 0x737d4fc7, 0xf6a4d91a, + 0xaea2aa67, 0x2b7b3cba, 0xe517f607, 0x60ce60da, 0x551b10fd, + 0xd0c28620, 0x1eae4c9d, 0x9b77da40, 0xc371a93d, 0x46a83fe0, + 0x88c4f55d, 0x0d1d6380, 0xbcb4e71d, 0x396d71c0, 0xf701bb7d, + 0x72d82da0, 0x2ade5edd, 0xaf07c800, 0x616b02bd, 0xe4b29460, + 0xd167e447, 0x54be729a, 0x9ad2b827, 0x1f0b2efa, 0x470d5d87, + 0xc2d4cb5a, 0x0cb801e7, 0x8961973a, 0x6612e0a9, 0xe3cb7674, + 0x2da7bcc9, 0xa87e2a14, 0xf0785969, 0x75a1cfb4, 0xbbcd0509, + 0x3e1493d4, 0x0bc1e3f3, 0x8e18752e, 0x4074bf93, 0xc5ad294e, + 0x9dab5a33, 0x1872ccee, 0xd61e0653, 0x53c7908e, 0x49ff99ae, + 0xcc260f73, 0x024ac5ce, 0x87935313, 0xdf95206e, 0x5a4cb6b3, + 0x94207c0e, 0x11f9ead3, 0x242c9af4, 0xa1f50c29, 0x6f99c694, + 0xea405049, 0xb2462334, 0x379fb5e9, 0xf9f37f54, 0x7c2ae989, + 0x93599e1a, 0x168008c7, 0xd8ecc27a, 0x5d3554a7, 0x053327da, + 0x80eab107, 0x4e867bba, 0xcb5fed67, 0xfe8a9d40, 0x7b530b9d, + 0xb53fc120, 0x30e657fd, 0x68e02480, 0xed39b25d, 0x235578e0, + 0xa68cee3d}, + {0x00000000, 0x76e10f9d, 0xadc46ee1, 0xdb25617c, 0x1b8fac19, + 0x6d6ea384, 0xb64bc2f8, 0xc0aacd65, 0x361e5933, 0x40ff56ae, + 0x9bda37d2, 0xed3b384f, 0x2d91f52a, 0x5b70fab7, 0x80559bcb, + 0xf6b49456, 0x6c3cb266, 0x1addbdfb, 0xc1f8dc87, 0xb719d31a, + 0x77b31e7f, 0x015211e2, 0xda77709e, 0xac967f03, 0x5a22eb55, + 0x2cc3e4c8, 0xf7e685b4, 0x81078a29, 0x41ad474c, 0x374c48d1, + 0xec6929ad, 0x9a882630, 0xd87864cd, 0xae996b50, 0x75bc0a2c, + 0x035d05b1, 0xc3f7c8d4, 0xb516c749, 0x6e33a635, 0x18d2a9a8, + 0xee663dfe, 0x98873263, 0x43a2531f, 0x35435c82, 0xf5e991e7, + 0x83089e7a, 0x582dff06, 0x2eccf09b, 0xb444d6ab, 0xc2a5d936, + 0x1980b84a, 0x6f61b7d7, 0xafcb7ab2, 0xd92a752f, 0x020f1453, + 0x74ee1bce, 0x825a8f98, 0xf4bb8005, 0x2f9ee179, 0x597feee4, + 0x99d52381, 0xef342c1c, 0x34114d60, 0x42f042fd, 0xf1f7b941, + 0x8716b6dc, 0x5c33d7a0, 0x2ad2d83d, 0xea781558, 0x9c991ac5, + 0x47bc7bb9, 0x315d7424, 0xc7e9e072, 0xb108efef, 0x6a2d8e93, + 0x1ccc810e, 0xdc664c6b, 0xaa8743f6, 0x71a2228a, 0x07432d17, + 0x9dcb0b27, 0xeb2a04ba, 0x300f65c6, 0x46ee6a5b, 0x8644a73e, + 0xf0a5a8a3, 0x2b80c9df, 0x5d61c642, 0xabd55214, 0xdd345d89, + 0x06113cf5, 0x70f03368, 0xb05afe0d, 0xc6bbf190, 0x1d9e90ec, + 0x6b7f9f71, 0x298fdd8c, 0x5f6ed211, 0x844bb36d, 0xf2aabcf0, + 0x32007195, 0x44e17e08, 0x9fc41f74, 0xe92510e9, 0x1f9184bf, + 0x69708b22, 0xb255ea5e, 0xc4b4e5c3, 0x041e28a6, 0x72ff273b, + 0xa9da4647, 0xdf3b49da, 0x45b36fea, 0x33526077, 0xe877010b, + 0x9e960e96, 0x5e3cc3f3, 0x28ddcc6e, 0xf3f8ad12, 0x8519a28f, + 0x73ad36d9, 0x054c3944, 0xde695838, 0xa88857a5, 0x68229ac0, + 0x1ec3955d, 0xc5e6f421, 0xb307fbbc, 0xe2ef7383, 0x940e7c1e, + 0x4f2b1d62, 0x39ca12ff, 0xf960df9a, 0x8f81d007, 0x54a4b17b, + 0x2245bee6, 0xd4f12ab0, 0xa210252d, 0x79354451, 0x0fd44bcc, + 0xcf7e86a9, 0xb99f8934, 0x62bae848, 0x145be7d5, 0x8ed3c1e5, + 0xf832ce78, 0x2317af04, 0x55f6a099, 0x955c6dfc, 0xe3bd6261, + 0x3898031d, 0x4e790c80, 0xb8cd98d6, 0xce2c974b, 0x1509f637, + 0x63e8f9aa, 0xa34234cf, 0xd5a33b52, 0x0e865a2e, 0x786755b3, + 0x3a97174e, 0x4c7618d3, 0x975379af, 0xe1b27632, 0x2118bb57, + 0x57f9b4ca, 0x8cdcd5b6, 0xfa3dda2b, 0x0c894e7d, 0x7a6841e0, + 0xa14d209c, 0xd7ac2f01, 0x1706e264, 0x61e7edf9, 0xbac28c85, + 0xcc238318, 0x56aba528, 0x204aaab5, 0xfb6fcbc9, 0x8d8ec454, + 0x4d240931, 0x3bc506ac, 0xe0e067d0, 0x9601684d, 0x60b5fc1b, + 0x1654f386, 0xcd7192fa, 0xbb909d67, 0x7b3a5002, 0x0ddb5f9f, + 0xd6fe3ee3, 0xa01f317e, 0x1318cac2, 0x65f9c55f, 0xbedca423, + 0xc83dabbe, 0x089766db, 0x7e766946, 0xa553083a, 0xd3b207a7, + 0x250693f1, 0x53e79c6c, 0x88c2fd10, 0xfe23f28d, 0x3e893fe8, + 0x48683075, 0x934d5109, 0xe5ac5e94, 0x7f2478a4, 0x09c57739, + 0xd2e01645, 0xa40119d8, 0x64abd4bd, 0x124adb20, 0xc96fba5c, + 0xbf8eb5c1, 0x493a2197, 0x3fdb2e0a, 0xe4fe4f76, 0x921f40eb, + 0x52b58d8e, 0x24548213, 0xff71e36f, 0x8990ecf2, 0xcb60ae0f, + 0xbd81a192, 0x66a4c0ee, 0x1045cf73, 0xd0ef0216, 0xa60e0d8b, + 0x7d2b6cf7, 0x0bca636a, 0xfd7ef73c, 0x8b9ff8a1, 0x50ba99dd, + 0x265b9640, 0xe6f15b25, 0x901054b8, 0x4b3535c4, 0x3dd43a59, + 0xa75c1c69, 0xd1bd13f4, 0x0a987288, 0x7c797d15, 0xbcd3b070, + 0xca32bfed, 0x1117de91, 0x67f6d10c, 0x9142455a, 0xe7a34ac7, + 0x3c862bbb, 0x4a672426, 0x8acde943, 0xfc2ce6de, 0x270987a2, + 0x51e8883f}, + {0x00000000, 0xe8dbfbb9, 0x91b186a8, 0x796a7d11, 0x63657c8a, + 0x8bbe8733, 0xf2d4fa22, 0x1a0f019b, 0x87cc89cf, 0x6f177276, + 0x167d0f67, 0xfea6f4de, 0xe4a9f545, 0x0c720efc, 0x751873ed, + 0x9dc38854, 0x4f9f6244, 0xa74499fd, 0xde2ee4ec, 0x36f51f55, + 0x2cfa1ece, 0xc421e577, 0xbd4b9866, 0x559063df, 0xc853eb8b, + 0x20881032, 0x59e26d23, 0xb139969a, 0xab369701, 0x43ed6cb8, + 0x3a8711a9, 0xd25cea10, 0x9e3ec588, 0x76e53e31, 0x0f8f4320, + 0xe754b899, 0xfd5bb902, 0x158042bb, 0x6cea3faa, 0x8431c413, + 0x19f24c47, 0xf129b7fe, 0x8843caef, 0x60983156, 0x7a9730cd, + 0x924ccb74, 0xeb26b665, 0x03fd4ddc, 0xd1a1a7cc, 0x397a5c75, + 0x40102164, 0xa8cbdadd, 0xb2c4db46, 0x5a1f20ff, 0x23755dee, + 0xcbaea657, 0x566d2e03, 0xbeb6d5ba, 0xc7dca8ab, 0x2f075312, + 0x35085289, 0xddd3a930, 0xa4b9d421, 0x4c622f98, 0x7d7bfbca, + 0x95a00073, 0xecca7d62, 0x041186db, 0x1e1e8740, 0xf6c57cf9, + 0x8faf01e8, 0x6774fa51, 0xfab77205, 0x126c89bc, 0x6b06f4ad, + 0x83dd0f14, 0x99d20e8f, 0x7109f536, 0x08638827, 0xe0b8739e, + 0x32e4998e, 0xda3f6237, 0xa3551f26, 0x4b8ee49f, 0x5181e504, + 0xb95a1ebd, 0xc03063ac, 0x28eb9815, 0xb5281041, 0x5df3ebf8, + 0x249996e9, 0xcc426d50, 0xd64d6ccb, 0x3e969772, 0x47fcea63, + 0xaf2711da, 0xe3453e42, 0x0b9ec5fb, 0x72f4b8ea, 0x9a2f4353, + 0x802042c8, 0x68fbb971, 0x1191c460, 0xf94a3fd9, 0x6489b78d, + 0x8c524c34, 0xf5383125, 0x1de3ca9c, 0x07eccb07, 0xef3730be, + 0x965d4daf, 0x7e86b616, 0xacda5c06, 0x4401a7bf, 0x3d6bdaae, + 0xd5b02117, 0xcfbf208c, 0x2764db35, 0x5e0ea624, 0xb6d55d9d, + 0x2b16d5c9, 0xc3cd2e70, 0xbaa75361, 0x527ca8d8, 0x4873a943, + 0xa0a852fa, 0xd9c22feb, 0x3119d452, 0xbbf0874e, 0x532b7cf7, + 0x2a4101e6, 0xc29afa5f, 0xd895fbc4, 0x304e007d, 0x49247d6c, + 0xa1ff86d5, 0x3c3c0e81, 0xd4e7f538, 0xad8d8829, 0x45567390, + 0x5f59720b, 0xb78289b2, 0xcee8f4a3, 0x26330f1a, 0xf46fe50a, + 0x1cb41eb3, 0x65de63a2, 0x8d05981b, 0x970a9980, 0x7fd16239, + 0x06bb1f28, 0xee60e491, 0x73a36cc5, 0x9b78977c, 0xe212ea6d, + 0x0ac911d4, 0x10c6104f, 0xf81debf6, 0x817796e7, 0x69ac6d5e, + 0x25ce42c6, 0xcd15b97f, 0xb47fc46e, 0x5ca43fd7, 0x46ab3e4c, + 0xae70c5f5, 0xd71ab8e4, 0x3fc1435d, 0xa202cb09, 0x4ad930b0, + 0x33b34da1, 0xdb68b618, 0xc167b783, 0x29bc4c3a, 0x50d6312b, + 0xb80dca92, 0x6a512082, 0x828adb3b, 0xfbe0a62a, 0x133b5d93, + 0x09345c08, 0xe1efa7b1, 0x9885daa0, 0x705e2119, 0xed9da94d, + 0x054652f4, 0x7c2c2fe5, 0x94f7d45c, 0x8ef8d5c7, 0x66232e7e, + 0x1f49536f, 0xf792a8d6, 0xc68b7c84, 0x2e50873d, 0x573afa2c, + 0xbfe10195, 0xa5ee000e, 0x4d35fbb7, 0x345f86a6, 0xdc847d1f, + 0x4147f54b, 0xa99c0ef2, 0xd0f673e3, 0x382d885a, 0x222289c1, + 0xcaf97278, 0xb3930f69, 0x5b48f4d0, 0x89141ec0, 0x61cfe579, + 0x18a59868, 0xf07e63d1, 0xea71624a, 0x02aa99f3, 0x7bc0e4e2, + 0x931b1f5b, 0x0ed8970f, 0xe6036cb6, 0x9f6911a7, 0x77b2ea1e, + 0x6dbdeb85, 0x8566103c, 0xfc0c6d2d, 0x14d79694, 0x58b5b90c, + 0xb06e42b5, 0xc9043fa4, 0x21dfc41d, 0x3bd0c586, 0xd30b3e3f, + 0xaa61432e, 0x42bab897, 0xdf7930c3, 0x37a2cb7a, 0x4ec8b66b, + 0xa6134dd2, 0xbc1c4c49, 0x54c7b7f0, 0x2dadcae1, 0xc5763158, + 0x172adb48, 0xfff120f1, 0x869b5de0, 0x6e40a659, 0x744fa7c2, + 0x9c945c7b, 0xe5fe216a, 0x0d25dad3, 0x90e65287, 0x783da93e, + 0x0157d42f, 0xe98c2f96, 0xf3832e0d, 0x1b58d5b4, 0x6232a8a5, + 0x8ae9531c}, + {0x00000000, 0x919168ae, 0x6325a087, 0xf2b4c829, 0x874c31d4, + 0x16dd597a, 0xe4699153, 0x75f8f9fd, 0x4f9f1373, 0xde0e7bdd, + 0x2cbab3f4, 0xbd2bdb5a, 0xc8d322a7, 0x59424a09, 0xabf68220, + 0x3a67ea8e, 0x9e3e27e6, 0x0faf4f48, 0xfd1b8761, 0x6c8aefcf, + 0x19721632, 0x88e37e9c, 0x7a57b6b5, 0xebc6de1b, 0xd1a13495, + 0x40305c3b, 0xb2849412, 0x2315fcbc, 0x56ed0541, 0xc77c6def, + 0x35c8a5c6, 0xa459cd68, 0x7d7b3f17, 0xecea57b9, 0x1e5e9f90, + 0x8fcff73e, 0xfa370ec3, 0x6ba6666d, 0x9912ae44, 0x0883c6ea, + 0x32e42c64, 0xa37544ca, 0x51c18ce3, 0xc050e44d, 0xb5a81db0, + 0x2439751e, 0xd68dbd37, 0x471cd599, 0xe34518f1, 0x72d4705f, + 0x8060b876, 0x11f1d0d8, 0x64092925, 0xf598418b, 0x072c89a2, + 0x96bde10c, 0xacda0b82, 0x3d4b632c, 0xcfffab05, 0x5e6ec3ab, + 0x2b963a56, 0xba0752f8, 0x48b39ad1, 0xd922f27f, 0xfaf67e2e, + 0x6b671680, 0x99d3dea9, 0x0842b607, 0x7dba4ffa, 0xec2b2754, + 0x1e9fef7d, 0x8f0e87d3, 0xb5696d5d, 0x24f805f3, 0xd64ccdda, + 0x47dda574, 0x32255c89, 0xa3b43427, 0x5100fc0e, 0xc09194a0, + 0x64c859c8, 0xf5593166, 0x07edf94f, 0x967c91e1, 0xe384681c, + 0x721500b2, 0x80a1c89b, 0x1130a035, 0x2b574abb, 0xbac62215, + 0x4872ea3c, 0xd9e38292, 0xac1b7b6f, 0x3d8a13c1, 0xcf3edbe8, + 0x5eafb346, 0x878d4139, 0x161c2997, 0xe4a8e1be, 0x75398910, + 0x00c170ed, 0x91501843, 0x63e4d06a, 0xf275b8c4, 0xc812524a, + 0x59833ae4, 0xab37f2cd, 0x3aa69a63, 0x4f5e639e, 0xdecf0b30, + 0x2c7bc319, 0xbdeaabb7, 0x19b366df, 0x88220e71, 0x7a96c658, + 0xeb07aef6, 0x9eff570b, 0x0f6e3fa5, 0xfddaf78c, 0x6c4b9f22, + 0x562c75ac, 0xc7bd1d02, 0x3509d52b, 0xa498bd85, 0xd1604478, + 0x40f12cd6, 0xb245e4ff, 0x23d48c51, 0xf4edfd5c, 0x657c95f2, + 0x97c85ddb, 0x06593575, 0x73a1cc88, 0xe230a426, 0x10846c0f, + 0x811504a1, 0xbb72ee2f, 0x2ae38681, 0xd8574ea8, 0x49c62606, + 0x3c3edffb, 0xadafb755, 0x5f1b7f7c, 0xce8a17d2, 0x6ad3daba, + 0xfb42b214, 0x09f67a3d, 0x98671293, 0xed9feb6e, 0x7c0e83c0, + 0x8eba4be9, 0x1f2b2347, 0x254cc9c9, 0xb4dda167, 0x4669694e, + 0xd7f801e0, 0xa200f81d, 0x339190b3, 0xc125589a, 0x50b43034, + 0x8996c24b, 0x1807aae5, 0xeab362cc, 0x7b220a62, 0x0edaf39f, + 0x9f4b9b31, 0x6dff5318, 0xfc6e3bb6, 0xc609d138, 0x5798b996, + 0xa52c71bf, 0x34bd1911, 0x4145e0ec, 0xd0d48842, 0x2260406b, + 0xb3f128c5, 0x17a8e5ad, 0x86398d03, 0x748d452a, 0xe51c2d84, + 0x90e4d479, 0x0175bcd7, 0xf3c174fe, 0x62501c50, 0x5837f6de, + 0xc9a69e70, 0x3b125659, 0xaa833ef7, 0xdf7bc70a, 0x4eeaafa4, + 0xbc5e678d, 0x2dcf0f23, 0x0e1b8372, 0x9f8aebdc, 0x6d3e23f5, + 0xfcaf4b5b, 0x8957b2a6, 0x18c6da08, 0xea721221, 0x7be37a8f, + 0x41849001, 0xd015f8af, 0x22a13086, 0xb3305828, 0xc6c8a1d5, + 0x5759c97b, 0xa5ed0152, 0x347c69fc, 0x9025a494, 0x01b4cc3a, + 0xf3000413, 0x62916cbd, 0x17699540, 0x86f8fdee, 0x744c35c7, + 0xe5dd5d69, 0xdfbab7e7, 0x4e2bdf49, 0xbc9f1760, 0x2d0e7fce, + 0x58f68633, 0xc967ee9d, 0x3bd326b4, 0xaa424e1a, 0x7360bc65, + 0xe2f1d4cb, 0x10451ce2, 0x81d4744c, 0xf42c8db1, 0x65bde51f, + 0x97092d36, 0x06984598, 0x3cffaf16, 0xad6ec7b8, 0x5fda0f91, + 0xce4b673f, 0xbbb39ec2, 0x2a22f66c, 0xd8963e45, 0x490756eb, + 0xed5e9b83, 0x7ccff32d, 0x8e7b3b04, 0x1fea53aa, 0x6a12aa57, + 0xfb83c2f9, 0x09370ad0, 0x98a6627e, 0xa2c188f0, 0x3350e05e, + 0xc1e42877, 0x507540d9, 0x258db924, 0xb41cd18a, 0x46a819a3, + 0xd739710d}}; + +#endif + +#endif + +#if N == 5 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xaf449247, 0x85f822cf, 0x2abcb088, 0xd08143df, + 0x7fc5d198, 0x55796110, 0xfa3df357, 0x7a7381ff, 0xd53713b8, + 0xff8ba330, 0x50cf3177, 0xaaf2c220, 0x05b65067, 0x2f0ae0ef, + 0x804e72a8, 0xf4e703fe, 0x5ba391b9, 0x711f2131, 0xde5bb376, + 0x24664021, 0x8b22d266, 0xa19e62ee, 0x0edaf0a9, 0x8e948201, + 0x21d01046, 0x0b6ca0ce, 0xa4283289, 0x5e15c1de, 0xf1515399, + 0xdbede311, 0x74a97156, 0x32bf01bd, 0x9dfb93fa, 0xb7472372, + 0x1803b135, 0xe23e4262, 0x4d7ad025, 0x67c660ad, 0xc882f2ea, + 0x48cc8042, 0xe7881205, 0xcd34a28d, 0x627030ca, 0x984dc39d, + 0x370951da, 0x1db5e152, 0xb2f17315, 0xc6580243, 0x691c9004, + 0x43a0208c, 0xece4b2cb, 0x16d9419c, 0xb99dd3db, 0x93216353, + 0x3c65f114, 0xbc2b83bc, 0x136f11fb, 0x39d3a173, 0x96973334, + 0x6caac063, 0xc3ee5224, 0xe952e2ac, 0x461670eb, 0x657e037a, + 0xca3a913d, 0xe08621b5, 0x4fc2b3f2, 0xb5ff40a5, 0x1abbd2e2, + 0x3007626a, 0x9f43f02d, 0x1f0d8285, 0xb04910c2, 0x9af5a04a, + 0x35b1320d, 0xcf8cc15a, 0x60c8531d, 0x4a74e395, 0xe53071d2, + 0x91990084, 0x3edd92c3, 0x1461224b, 0xbb25b00c, 0x4118435b, + 0xee5cd11c, 0xc4e06194, 0x6ba4f3d3, 0xebea817b, 0x44ae133c, + 0x6e12a3b4, 0xc15631f3, 0x3b6bc2a4, 0x942f50e3, 0xbe93e06b, + 0x11d7722c, 0x57c102c7, 0xf8859080, 0xd2392008, 0x7d7db24f, + 0x87404118, 0x2804d35f, 0x02b863d7, 0xadfcf190, 0x2db28338, + 0x82f6117f, 0xa84aa1f7, 0x070e33b0, 0xfd33c0e7, 0x527752a0, + 0x78cbe228, 0xd78f706f, 0xa3260139, 0x0c62937e, 0x26de23f6, + 0x899ab1b1, 0x73a742e6, 0xdce3d0a1, 0xf65f6029, 0x591bf26e, + 0xd95580c6, 0x76111281, 0x5cada209, 0xf3e9304e, 0x09d4c319, + 0xa690515e, 0x8c2ce1d6, 0x23687391, 0xcafc06f4, 0x65b894b3, + 0x4f04243b, 0xe040b67c, 0x1a7d452b, 0xb539d76c, 0x9f8567e4, + 0x30c1f5a3, 0xb08f870b, 0x1fcb154c, 0x3577a5c4, 0x9a333783, + 0x600ec4d4, 0xcf4a5693, 0xe5f6e61b, 0x4ab2745c, 0x3e1b050a, + 0x915f974d, 0xbbe327c5, 0x14a7b582, 0xee9a46d5, 0x41ded492, + 0x6b62641a, 0xc426f65d, 0x446884f5, 0xeb2c16b2, 0xc190a63a, + 0x6ed4347d, 0x94e9c72a, 0x3bad556d, 0x1111e5e5, 0xbe5577a2, + 0xf8430749, 0x5707950e, 0x7dbb2586, 0xd2ffb7c1, 0x28c24496, + 0x8786d6d1, 0xad3a6659, 0x027ef41e, 0x823086b6, 0x2d7414f1, + 0x07c8a479, 0xa88c363e, 0x52b1c569, 0xfdf5572e, 0xd749e7a6, + 0x780d75e1, 0x0ca404b7, 0xa3e096f0, 0x895c2678, 0x2618b43f, + 0xdc254768, 0x7361d52f, 0x59dd65a7, 0xf699f7e0, 0x76d78548, + 0xd993170f, 0xf32fa787, 0x5c6b35c0, 0xa656c697, 0x091254d0, + 0x23aee458, 0x8cea761f, 0xaf82058e, 0x00c697c9, 0x2a7a2741, + 0x853eb506, 0x7f034651, 0xd047d416, 0xfafb649e, 0x55bff6d9, + 0xd5f18471, 0x7ab51636, 0x5009a6be, 0xff4d34f9, 0x0570c7ae, + 0xaa3455e9, 0x8088e561, 0x2fcc7726, 0x5b650670, 0xf4219437, + 0xde9d24bf, 0x71d9b6f8, 0x8be445af, 0x24a0d7e8, 0x0e1c6760, + 0xa158f527, 0x2116878f, 0x8e5215c8, 0xa4eea540, 0x0baa3707, + 0xf197c450, 0x5ed35617, 0x746fe69f, 0xdb2b74d8, 0x9d3d0433, + 0x32799674, 0x18c526fc, 0xb781b4bb, 0x4dbc47ec, 0xe2f8d5ab, + 0xc8446523, 0x6700f764, 0xe74e85cc, 0x480a178b, 0x62b6a703, + 0xcdf23544, 0x37cfc613, 0x988b5454, 0xb237e4dc, 0x1d73769b, + 0x69da07cd, 0xc69e958a, 0xec222502, 0x4366b745, 0xb95b4412, + 0x161fd655, 0x3ca366dd, 0x93e7f49a, 0x13a98632, 0xbced1475, + 0x9651a4fd, 0x391536ba, 0xc328c5ed, 0x6c6c57aa, 0x46d0e722, + 0xe9947565}, + {0x00000000, 0x4e890ba9, 0x9d121752, 0xd39b1cfb, 0xe15528e5, + 0xafdc234c, 0x7c473fb7, 0x32ce341e, 0x19db578b, 0x57525c22, + 0x84c940d9, 0xca404b70, 0xf88e7f6e, 0xb60774c7, 0x659c683c, + 0x2b156395, 0x33b6af16, 0x7d3fa4bf, 0xaea4b844, 0xe02db3ed, + 0xd2e387f3, 0x9c6a8c5a, 0x4ff190a1, 0x01789b08, 0x2a6df89d, + 0x64e4f334, 0xb77fefcf, 0xf9f6e466, 0xcb38d078, 0x85b1dbd1, + 0x562ac72a, 0x18a3cc83, 0x676d5e2c, 0x29e45585, 0xfa7f497e, + 0xb4f642d7, 0x863876c9, 0xc8b17d60, 0x1b2a619b, 0x55a36a32, + 0x7eb609a7, 0x303f020e, 0xe3a41ef5, 0xad2d155c, 0x9fe32142, + 0xd16a2aeb, 0x02f13610, 0x4c783db9, 0x54dbf13a, 0x1a52fa93, + 0xc9c9e668, 0x8740edc1, 0xb58ed9df, 0xfb07d276, 0x289cce8d, + 0x6615c524, 0x4d00a6b1, 0x0389ad18, 0xd012b1e3, 0x9e9bba4a, + 0xac558e54, 0xe2dc85fd, 0x31479906, 0x7fce92af, 0xcedabc58, + 0x8053b7f1, 0x53c8ab0a, 0x1d41a0a3, 0x2f8f94bd, 0x61069f14, + 0xb29d83ef, 0xfc148846, 0xd701ebd3, 0x9988e07a, 0x4a13fc81, + 0x049af728, 0x3654c336, 0x78ddc89f, 0xab46d464, 0xe5cfdfcd, + 0xfd6c134e, 0xb3e518e7, 0x607e041c, 0x2ef70fb5, 0x1c393bab, + 0x52b03002, 0x812b2cf9, 0xcfa22750, 0xe4b744c5, 0xaa3e4f6c, + 0x79a55397, 0x372c583e, 0x05e26c20, 0x4b6b6789, 0x98f07b72, + 0xd67970db, 0xa9b7e274, 0xe73ee9dd, 0x34a5f526, 0x7a2cfe8f, + 0x48e2ca91, 0x066bc138, 0xd5f0ddc3, 0x9b79d66a, 0xb06cb5ff, + 0xfee5be56, 0x2d7ea2ad, 0x63f7a904, 0x51399d1a, 0x1fb096b3, + 0xcc2b8a48, 0x82a281e1, 0x9a014d62, 0xd48846cb, 0x07135a30, + 0x499a5199, 0x7b546587, 0x35dd6e2e, 0xe64672d5, 0xa8cf797c, + 0x83da1ae9, 0xcd531140, 0x1ec80dbb, 0x50410612, 0x628f320c, + 0x2c0639a5, 0xff9d255e, 0xb1142ef7, 0x46c47ef1, 0x084d7558, + 0xdbd669a3, 0x955f620a, 0xa7915614, 0xe9185dbd, 0x3a834146, + 0x740a4aef, 0x5f1f297a, 0x119622d3, 0xc20d3e28, 0x8c843581, + 0xbe4a019f, 0xf0c30a36, 0x235816cd, 0x6dd11d64, 0x7572d1e7, + 0x3bfbda4e, 0xe860c6b5, 0xa6e9cd1c, 0x9427f902, 0xdaaef2ab, + 0x0935ee50, 0x47bce5f9, 0x6ca9866c, 0x22208dc5, 0xf1bb913e, + 0xbf329a97, 0x8dfcae89, 0xc375a520, 0x10eeb9db, 0x5e67b272, + 0x21a920dd, 0x6f202b74, 0xbcbb378f, 0xf2323c26, 0xc0fc0838, + 0x8e750391, 0x5dee1f6a, 0x136714c3, 0x38727756, 0x76fb7cff, + 0xa5606004, 0xebe96bad, 0xd9275fb3, 0x97ae541a, 0x443548e1, + 0x0abc4348, 0x121f8fcb, 0x5c968462, 0x8f0d9899, 0xc1849330, + 0xf34aa72e, 0xbdc3ac87, 0x6e58b07c, 0x20d1bbd5, 0x0bc4d840, + 0x454dd3e9, 0x96d6cf12, 0xd85fc4bb, 0xea91f0a5, 0xa418fb0c, + 0x7783e7f7, 0x390aec5e, 0x881ec2a9, 0xc697c900, 0x150cd5fb, + 0x5b85de52, 0x694bea4c, 0x27c2e1e5, 0xf459fd1e, 0xbad0f6b7, + 0x91c59522, 0xdf4c9e8b, 0x0cd78270, 0x425e89d9, 0x7090bdc7, + 0x3e19b66e, 0xed82aa95, 0xa30ba13c, 0xbba86dbf, 0xf5216616, + 0x26ba7aed, 0x68337144, 0x5afd455a, 0x14744ef3, 0xc7ef5208, + 0x896659a1, 0xa2733a34, 0xecfa319d, 0x3f612d66, 0x71e826cf, + 0x432612d1, 0x0daf1978, 0xde340583, 0x90bd0e2a, 0xef739c85, + 0xa1fa972c, 0x72618bd7, 0x3ce8807e, 0x0e26b460, 0x40afbfc9, + 0x9334a332, 0xddbda89b, 0xf6a8cb0e, 0xb821c0a7, 0x6bbadc5c, + 0x2533d7f5, 0x17fde3eb, 0x5974e842, 0x8aeff4b9, 0xc466ff10, + 0xdcc53393, 0x924c383a, 0x41d724c1, 0x0f5e2f68, 0x3d901b76, + 0x731910df, 0xa0820c24, 0xee0b078d, 0xc51e6418, 0x8b976fb1, + 0x580c734a, 0x168578e3, 0x244b4cfd, 0x6ac24754, 0xb9595baf, + 0xf7d05006}, + {0x00000000, 0x8d88fde2, 0xc060fd85, 0x4de80067, 0x5bb0fd4b, + 0xd63800a9, 0x9bd000ce, 0x1658fd2c, 0xb761fa96, 0x3ae90774, + 0x77010713, 0xfa89faf1, 0xecd107dd, 0x6159fa3f, 0x2cb1fa58, + 0xa13907ba, 0xb5b2f36d, 0x383a0e8f, 0x75d20ee8, 0xf85af30a, + 0xee020e26, 0x638af3c4, 0x2e62f3a3, 0xa3ea0e41, 0x02d309fb, + 0x8f5bf419, 0xc2b3f47e, 0x4f3b099c, 0x5963f4b0, 0xd4eb0952, + 0x99030935, 0x148bf4d7, 0xb014e09b, 0x3d9c1d79, 0x70741d1e, + 0xfdfce0fc, 0xeba41dd0, 0x662ce032, 0x2bc4e055, 0xa64c1db7, + 0x07751a0d, 0x8afde7ef, 0xc715e788, 0x4a9d1a6a, 0x5cc5e746, + 0xd14d1aa4, 0x9ca51ac3, 0x112de721, 0x05a613f6, 0x882eee14, + 0xc5c6ee73, 0x484e1391, 0x5e16eebd, 0xd39e135f, 0x9e761338, + 0x13feeeda, 0xb2c7e960, 0x3f4f1482, 0x72a714e5, 0xff2fe907, + 0xe977142b, 0x64ffe9c9, 0x2917e9ae, 0xa49f144c, 0xbb58c777, + 0x36d03a95, 0x7b383af2, 0xf6b0c710, 0xe0e83a3c, 0x6d60c7de, + 0x2088c7b9, 0xad003a5b, 0x0c393de1, 0x81b1c003, 0xcc59c064, + 0x41d13d86, 0x5789c0aa, 0xda013d48, 0x97e93d2f, 0x1a61c0cd, + 0x0eea341a, 0x8362c9f8, 0xce8ac99f, 0x4302347d, 0x555ac951, + 0xd8d234b3, 0x953a34d4, 0x18b2c936, 0xb98bce8c, 0x3403336e, + 0x79eb3309, 0xf463ceeb, 0xe23b33c7, 0x6fb3ce25, 0x225bce42, + 0xafd333a0, 0x0b4c27ec, 0x86c4da0e, 0xcb2cda69, 0x46a4278b, + 0x50fcdaa7, 0xdd742745, 0x909c2722, 0x1d14dac0, 0xbc2ddd7a, + 0x31a52098, 0x7c4d20ff, 0xf1c5dd1d, 0xe79d2031, 0x6a15ddd3, + 0x27fdddb4, 0xaa752056, 0xbefed481, 0x33762963, 0x7e9e2904, + 0xf316d4e6, 0xe54e29ca, 0x68c6d428, 0x252ed44f, 0xa8a629ad, + 0x099f2e17, 0x8417d3f5, 0xc9ffd392, 0x44772e70, 0x522fd35c, + 0xdfa72ebe, 0x924f2ed9, 0x1fc7d33b, 0xadc088af, 0x2048754d, + 0x6da0752a, 0xe02888c8, 0xf67075e4, 0x7bf88806, 0x36108861, + 0xbb987583, 0x1aa17239, 0x97298fdb, 0xdac18fbc, 0x5749725e, + 0x41118f72, 0xcc997290, 0x817172f7, 0x0cf98f15, 0x18727bc2, + 0x95fa8620, 0xd8128647, 0x559a7ba5, 0x43c28689, 0xce4a7b6b, + 0x83a27b0c, 0x0e2a86ee, 0xaf138154, 0x229b7cb6, 0x6f737cd1, + 0xe2fb8133, 0xf4a37c1f, 0x792b81fd, 0x34c3819a, 0xb94b7c78, + 0x1dd46834, 0x905c95d6, 0xddb495b1, 0x503c6853, 0x4664957f, + 0xcbec689d, 0x860468fa, 0x0b8c9518, 0xaab592a2, 0x273d6f40, + 0x6ad56f27, 0xe75d92c5, 0xf1056fe9, 0x7c8d920b, 0x3165926c, + 0xbced6f8e, 0xa8669b59, 0x25ee66bb, 0x680666dc, 0xe58e9b3e, + 0xf3d66612, 0x7e5e9bf0, 0x33b69b97, 0xbe3e6675, 0x1f0761cf, + 0x928f9c2d, 0xdf679c4a, 0x52ef61a8, 0x44b79c84, 0xc93f6166, + 0x84d76101, 0x095f9ce3, 0x16984fd8, 0x9b10b23a, 0xd6f8b25d, + 0x5b704fbf, 0x4d28b293, 0xc0a04f71, 0x8d484f16, 0x00c0b2f4, + 0xa1f9b54e, 0x2c7148ac, 0x619948cb, 0xec11b529, 0xfa494805, + 0x77c1b5e7, 0x3a29b580, 0xb7a14862, 0xa32abcb5, 0x2ea24157, + 0x634a4130, 0xeec2bcd2, 0xf89a41fe, 0x7512bc1c, 0x38fabc7b, + 0xb5724199, 0x144b4623, 0x99c3bbc1, 0xd42bbba6, 0x59a34644, + 0x4ffbbb68, 0xc273468a, 0x8f9b46ed, 0x0213bb0f, 0xa68caf43, + 0x2b0452a1, 0x66ec52c6, 0xeb64af24, 0xfd3c5208, 0x70b4afea, + 0x3d5caf8d, 0xb0d4526f, 0x11ed55d5, 0x9c65a837, 0xd18da850, + 0x5c0555b2, 0x4a5da89e, 0xc7d5557c, 0x8a3d551b, 0x07b5a8f9, + 0x133e5c2e, 0x9eb6a1cc, 0xd35ea1ab, 0x5ed65c49, 0x488ea165, + 0xc5065c87, 0x88ee5ce0, 0x0566a102, 0xa45fa6b8, 0x29d75b5a, + 0x643f5b3d, 0xe9b7a6df, 0xffef5bf3, 0x7267a611, 0x3f8fa676, + 0xb2075b94}, + {0x00000000, 0x80f0171f, 0xda91287f, 0x5a613f60, 0x6e5356bf, + 0xeea341a0, 0xb4c27ec0, 0x343269df, 0xdca6ad7e, 0x5c56ba61, + 0x06378501, 0x86c7921e, 0xb2f5fbc1, 0x3205ecde, 0x6864d3be, + 0xe894c4a1, 0x623c5cbd, 0xe2cc4ba2, 0xb8ad74c2, 0x385d63dd, + 0x0c6f0a02, 0x8c9f1d1d, 0xd6fe227d, 0x560e3562, 0xbe9af1c3, + 0x3e6ae6dc, 0x640bd9bc, 0xe4fbcea3, 0xd0c9a77c, 0x5039b063, + 0x0a588f03, 0x8aa8981c, 0xc478b97a, 0x4488ae65, 0x1ee99105, + 0x9e19861a, 0xaa2befc5, 0x2adbf8da, 0x70bac7ba, 0xf04ad0a5, + 0x18de1404, 0x982e031b, 0xc24f3c7b, 0x42bf2b64, 0x768d42bb, + 0xf67d55a4, 0xac1c6ac4, 0x2cec7ddb, 0xa644e5c7, 0x26b4f2d8, + 0x7cd5cdb8, 0xfc25daa7, 0xc817b378, 0x48e7a467, 0x12869b07, + 0x92768c18, 0x7ae248b9, 0xfa125fa6, 0xa07360c6, 0x208377d9, + 0x14b11e06, 0x94410919, 0xce203679, 0x4ed02166, 0x538074b5, + 0xd37063aa, 0x89115cca, 0x09e14bd5, 0x3dd3220a, 0xbd233515, + 0xe7420a75, 0x67b21d6a, 0x8f26d9cb, 0x0fd6ced4, 0x55b7f1b4, + 0xd547e6ab, 0xe1758f74, 0x6185986b, 0x3be4a70b, 0xbb14b014, + 0x31bc2808, 0xb14c3f17, 0xeb2d0077, 0x6bdd1768, 0x5fef7eb7, + 0xdf1f69a8, 0x857e56c8, 0x058e41d7, 0xed1a8576, 0x6dea9269, + 0x378bad09, 0xb77bba16, 0x8349d3c9, 0x03b9c4d6, 0x59d8fbb6, + 0xd928eca9, 0x97f8cdcf, 0x1708dad0, 0x4d69e5b0, 0xcd99f2af, + 0xf9ab9b70, 0x795b8c6f, 0x233ab30f, 0xa3caa410, 0x4b5e60b1, + 0xcbae77ae, 0x91cf48ce, 0x113f5fd1, 0x250d360e, 0xa5fd2111, + 0xff9c1e71, 0x7f6c096e, 0xf5c49172, 0x7534866d, 0x2f55b90d, + 0xafa5ae12, 0x9b97c7cd, 0x1b67d0d2, 0x4106efb2, 0xc1f6f8ad, + 0x29623c0c, 0xa9922b13, 0xf3f31473, 0x7303036c, 0x47316ab3, + 0xc7c17dac, 0x9da042cc, 0x1d5055d3, 0xa700e96a, 0x27f0fe75, + 0x7d91c115, 0xfd61d60a, 0xc953bfd5, 0x49a3a8ca, 0x13c297aa, + 0x933280b5, 0x7ba64414, 0xfb56530b, 0xa1376c6b, 0x21c77b74, + 0x15f512ab, 0x950505b4, 0xcf643ad4, 0x4f942dcb, 0xc53cb5d7, + 0x45cca2c8, 0x1fad9da8, 0x9f5d8ab7, 0xab6fe368, 0x2b9ff477, + 0x71fecb17, 0xf10edc08, 0x199a18a9, 0x996a0fb6, 0xc30b30d6, + 0x43fb27c9, 0x77c94e16, 0xf7395909, 0xad586669, 0x2da87176, + 0x63785010, 0xe388470f, 0xb9e9786f, 0x39196f70, 0x0d2b06af, + 0x8ddb11b0, 0xd7ba2ed0, 0x574a39cf, 0xbfdefd6e, 0x3f2eea71, + 0x654fd511, 0xe5bfc20e, 0xd18dabd1, 0x517dbcce, 0x0b1c83ae, + 0x8bec94b1, 0x01440cad, 0x81b41bb2, 0xdbd524d2, 0x5b2533cd, + 0x6f175a12, 0xefe74d0d, 0xb586726d, 0x35766572, 0xdde2a1d3, + 0x5d12b6cc, 0x077389ac, 0x87839eb3, 0xb3b1f76c, 0x3341e073, + 0x6920df13, 0xe9d0c80c, 0xf4809ddf, 0x74708ac0, 0x2e11b5a0, + 0xaee1a2bf, 0x9ad3cb60, 0x1a23dc7f, 0x4042e31f, 0xc0b2f400, + 0x282630a1, 0xa8d627be, 0xf2b718de, 0x72470fc1, 0x4675661e, + 0xc6857101, 0x9ce44e61, 0x1c14597e, 0x96bcc162, 0x164cd67d, + 0x4c2de91d, 0xccddfe02, 0xf8ef97dd, 0x781f80c2, 0x227ebfa2, + 0xa28ea8bd, 0x4a1a6c1c, 0xcaea7b03, 0x908b4463, 0x107b537c, + 0x24493aa3, 0xa4b92dbc, 0xfed812dc, 0x7e2805c3, 0x30f824a5, + 0xb00833ba, 0xea690cda, 0x6a991bc5, 0x5eab721a, 0xde5b6505, + 0x843a5a65, 0x04ca4d7a, 0xec5e89db, 0x6cae9ec4, 0x36cfa1a4, + 0xb63fb6bb, 0x820ddf64, 0x02fdc87b, 0x589cf71b, 0xd86ce004, + 0x52c47818, 0xd2346f07, 0x88555067, 0x08a54778, 0x3c972ea7, + 0xbc6739b8, 0xe60606d8, 0x66f611c7, 0x8e62d566, 0x0e92c279, + 0x54f3fd19, 0xd403ea06, 0xe03183d9, 0x60c194c6, 0x3aa0aba6, + 0xba50bcb9}, + {0x00000000, 0x9570d495, 0xf190af6b, 0x64e07bfe, 0x38505897, + 0xad208c02, 0xc9c0f7fc, 0x5cb02369, 0x70a0b12e, 0xe5d065bb, + 0x81301e45, 0x1440cad0, 0x48f0e9b9, 0xdd803d2c, 0xb96046d2, + 0x2c109247, 0xe141625c, 0x7431b6c9, 0x10d1cd37, 0x85a119a2, + 0xd9113acb, 0x4c61ee5e, 0x288195a0, 0xbdf14135, 0x91e1d372, + 0x049107e7, 0x60717c19, 0xf501a88c, 0xa9b18be5, 0x3cc15f70, + 0x5821248e, 0xcd51f01b, 0x19f3c2f9, 0x8c83166c, 0xe8636d92, + 0x7d13b907, 0x21a39a6e, 0xb4d34efb, 0xd0333505, 0x4543e190, + 0x695373d7, 0xfc23a742, 0x98c3dcbc, 0x0db30829, 0x51032b40, + 0xc473ffd5, 0xa093842b, 0x35e350be, 0xf8b2a0a5, 0x6dc27430, + 0x09220fce, 0x9c52db5b, 0xc0e2f832, 0x55922ca7, 0x31725759, + 0xa40283cc, 0x8812118b, 0x1d62c51e, 0x7982bee0, 0xecf26a75, + 0xb042491c, 0x25329d89, 0x41d2e677, 0xd4a232e2, 0x33e785f2, + 0xa6975167, 0xc2772a99, 0x5707fe0c, 0x0bb7dd65, 0x9ec709f0, + 0xfa27720e, 0x6f57a69b, 0x434734dc, 0xd637e049, 0xb2d79bb7, + 0x27a74f22, 0x7b176c4b, 0xee67b8de, 0x8a87c320, 0x1ff717b5, + 0xd2a6e7ae, 0x47d6333b, 0x233648c5, 0xb6469c50, 0xeaf6bf39, + 0x7f866bac, 0x1b661052, 0x8e16c4c7, 0xa2065680, 0x37768215, + 0x5396f9eb, 0xc6e62d7e, 0x9a560e17, 0x0f26da82, 0x6bc6a17c, + 0xfeb675e9, 0x2a14470b, 0xbf64939e, 0xdb84e860, 0x4ef43cf5, + 0x12441f9c, 0x8734cb09, 0xe3d4b0f7, 0x76a46462, 0x5ab4f625, + 0xcfc422b0, 0xab24594e, 0x3e548ddb, 0x62e4aeb2, 0xf7947a27, + 0x937401d9, 0x0604d54c, 0xcb552557, 0x5e25f1c2, 0x3ac58a3c, + 0xafb55ea9, 0xf3057dc0, 0x6675a955, 0x0295d2ab, 0x97e5063e, + 0xbbf59479, 0x2e8540ec, 0x4a653b12, 0xdf15ef87, 0x83a5ccee, + 0x16d5187b, 0x72356385, 0xe745b710, 0x67cf0be4, 0xf2bfdf71, + 0x965fa48f, 0x032f701a, 0x5f9f5373, 0xcaef87e6, 0xae0ffc18, + 0x3b7f288d, 0x176fbaca, 0x821f6e5f, 0xe6ff15a1, 0x738fc134, + 0x2f3fe25d, 0xba4f36c8, 0xdeaf4d36, 0x4bdf99a3, 0x868e69b8, + 0x13febd2d, 0x771ec6d3, 0xe26e1246, 0xbede312f, 0x2baee5ba, + 0x4f4e9e44, 0xda3e4ad1, 0xf62ed896, 0x635e0c03, 0x07be77fd, + 0x92cea368, 0xce7e8001, 0x5b0e5494, 0x3fee2f6a, 0xaa9efbff, + 0x7e3cc91d, 0xeb4c1d88, 0x8fac6676, 0x1adcb2e3, 0x466c918a, + 0xd31c451f, 0xb7fc3ee1, 0x228cea74, 0x0e9c7833, 0x9becaca6, + 0xff0cd758, 0x6a7c03cd, 0x36cc20a4, 0xa3bcf431, 0xc75c8fcf, + 0x522c5b5a, 0x9f7dab41, 0x0a0d7fd4, 0x6eed042a, 0xfb9dd0bf, + 0xa72df3d6, 0x325d2743, 0x56bd5cbd, 0xc3cd8828, 0xefdd1a6f, + 0x7aadcefa, 0x1e4db504, 0x8b3d6191, 0xd78d42f8, 0x42fd966d, + 0x261ded93, 0xb36d3906, 0x54288e16, 0xc1585a83, 0xa5b8217d, + 0x30c8f5e8, 0x6c78d681, 0xf9080214, 0x9de879ea, 0x0898ad7f, + 0x24883f38, 0xb1f8ebad, 0xd5189053, 0x406844c6, 0x1cd867af, + 0x89a8b33a, 0xed48c8c4, 0x78381c51, 0xb569ec4a, 0x201938df, + 0x44f94321, 0xd18997b4, 0x8d39b4dd, 0x18496048, 0x7ca91bb6, + 0xe9d9cf23, 0xc5c95d64, 0x50b989f1, 0x3459f20f, 0xa129269a, + 0xfd9905f3, 0x68e9d166, 0x0c09aa98, 0x99797e0d, 0x4ddb4cef, + 0xd8ab987a, 0xbc4be384, 0x293b3711, 0x758b1478, 0xe0fbc0ed, + 0x841bbb13, 0x116b6f86, 0x3d7bfdc1, 0xa80b2954, 0xcceb52aa, + 0x599b863f, 0x052ba556, 0x905b71c3, 0xf4bb0a3d, 0x61cbdea8, + 0xac9a2eb3, 0x39eafa26, 0x5d0a81d8, 0xc87a554d, 0x94ca7624, + 0x01baa2b1, 0x655ad94f, 0xf02a0dda, 0xdc3a9f9d, 0x494a4b08, + 0x2daa30f6, 0xb8dae463, 0xe46ac70a, 0x711a139f, 0x15fa6861, + 0x808abcf4}, + {0x00000000, 0xcf9e17c8, 0x444d29d1, 0x8bd33e19, 0x889a53a2, + 0x4704446a, 0xccd77a73, 0x03496dbb, 0xca45a105, 0x05dbb6cd, + 0x8e0888d4, 0x41969f1c, 0x42dff2a7, 0x8d41e56f, 0x0692db76, + 0xc90cccbe, 0x4ffa444b, 0x80645383, 0x0bb76d9a, 0xc4297a52, + 0xc76017e9, 0x08fe0021, 0x832d3e38, 0x4cb329f0, 0x85bfe54e, + 0x4a21f286, 0xc1f2cc9f, 0x0e6cdb57, 0x0d25b6ec, 0xc2bba124, + 0x49689f3d, 0x86f688f5, 0x9ff48896, 0x506a9f5e, 0xdbb9a147, + 0x1427b68f, 0x176edb34, 0xd8f0ccfc, 0x5323f2e5, 0x9cbde52d, + 0x55b12993, 0x9a2f3e5b, 0x11fc0042, 0xde62178a, 0xdd2b7a31, + 0x12b56df9, 0x996653e0, 0x56f84428, 0xd00eccdd, 0x1f90db15, + 0x9443e50c, 0x5bddf2c4, 0x58949f7f, 0x970a88b7, 0x1cd9b6ae, + 0xd347a166, 0x1a4b6dd8, 0xd5d57a10, 0x5e064409, 0x919853c1, + 0x92d13e7a, 0x5d4f29b2, 0xd69c17ab, 0x19020063, 0xe498176d, + 0x2b0600a5, 0xa0d53ebc, 0x6f4b2974, 0x6c0244cf, 0xa39c5307, + 0x284f6d1e, 0xe7d17ad6, 0x2eddb668, 0xe143a1a0, 0x6a909fb9, + 0xa50e8871, 0xa647e5ca, 0x69d9f202, 0xe20acc1b, 0x2d94dbd3, + 0xab625326, 0x64fc44ee, 0xef2f7af7, 0x20b16d3f, 0x23f80084, + 0xec66174c, 0x67b52955, 0xa82b3e9d, 0x6127f223, 0xaeb9e5eb, + 0x256adbf2, 0xeaf4cc3a, 0xe9bda181, 0x2623b649, 0xadf08850, + 0x626e9f98, 0x7b6c9ffb, 0xb4f28833, 0x3f21b62a, 0xf0bfa1e2, + 0xf3f6cc59, 0x3c68db91, 0xb7bbe588, 0x7825f240, 0xb1293efe, + 0x7eb72936, 0xf564172f, 0x3afa00e7, 0x39b36d5c, 0xf62d7a94, + 0x7dfe448d, 0xb2605345, 0x3496dbb0, 0xfb08cc78, 0x70dbf261, + 0xbf45e5a9, 0xbc0c8812, 0x73929fda, 0xf841a1c3, 0x37dfb60b, + 0xfed37ab5, 0x314d6d7d, 0xba9e5364, 0x750044ac, 0x76492917, + 0xb9d73edf, 0x320400c6, 0xfd9a170e, 0x1241289b, 0xdddf3f53, + 0x560c014a, 0x99921682, 0x9adb7b39, 0x55456cf1, 0xde9652e8, + 0x11084520, 0xd804899e, 0x179a9e56, 0x9c49a04f, 0x53d7b787, + 0x509eda3c, 0x9f00cdf4, 0x14d3f3ed, 0xdb4de425, 0x5dbb6cd0, + 0x92257b18, 0x19f64501, 0xd66852c9, 0xd5213f72, 0x1abf28ba, + 0x916c16a3, 0x5ef2016b, 0x97fecdd5, 0x5860da1d, 0xd3b3e404, + 0x1c2df3cc, 0x1f649e77, 0xd0fa89bf, 0x5b29b7a6, 0x94b7a06e, + 0x8db5a00d, 0x422bb7c5, 0xc9f889dc, 0x06669e14, 0x052ff3af, + 0xcab1e467, 0x4162da7e, 0x8efccdb6, 0x47f00108, 0x886e16c0, + 0x03bd28d9, 0xcc233f11, 0xcf6a52aa, 0x00f44562, 0x8b277b7b, + 0x44b96cb3, 0xc24fe446, 0x0dd1f38e, 0x8602cd97, 0x499cda5f, + 0x4ad5b7e4, 0x854ba02c, 0x0e989e35, 0xc10689fd, 0x080a4543, + 0xc794528b, 0x4c476c92, 0x83d97b5a, 0x809016e1, 0x4f0e0129, + 0xc4dd3f30, 0x0b4328f8, 0xf6d93ff6, 0x3947283e, 0xb2941627, + 0x7d0a01ef, 0x7e436c54, 0xb1dd7b9c, 0x3a0e4585, 0xf590524d, + 0x3c9c9ef3, 0xf302893b, 0x78d1b722, 0xb74fa0ea, 0xb406cd51, + 0x7b98da99, 0xf04be480, 0x3fd5f348, 0xb9237bbd, 0x76bd6c75, + 0xfd6e526c, 0x32f045a4, 0x31b9281f, 0xfe273fd7, 0x75f401ce, + 0xba6a1606, 0x7366dab8, 0xbcf8cd70, 0x372bf369, 0xf8b5e4a1, + 0xfbfc891a, 0x34629ed2, 0xbfb1a0cb, 0x702fb703, 0x692db760, + 0xa6b3a0a8, 0x2d609eb1, 0xe2fe8979, 0xe1b7e4c2, 0x2e29f30a, + 0xa5facd13, 0x6a64dadb, 0xa3681665, 0x6cf601ad, 0xe7253fb4, + 0x28bb287c, 0x2bf245c7, 0xe46c520f, 0x6fbf6c16, 0xa0217bde, + 0x26d7f32b, 0xe949e4e3, 0x629adafa, 0xad04cd32, 0xae4da089, + 0x61d3b741, 0xea008958, 0x259e9e90, 0xec92522e, 0x230c45e6, + 0xa8df7bff, 0x67416c37, 0x6408018c, 0xab961644, 0x2045285d, + 0xefdb3f95}, + {0x00000000, 0x24825136, 0x4904a26c, 0x6d86f35a, 0x920944d8, + 0xb68b15ee, 0xdb0de6b4, 0xff8fb782, 0xff638ff1, 0xdbe1dec7, + 0xb6672d9d, 0x92e57cab, 0x6d6acb29, 0x49e89a1f, 0x246e6945, + 0x00ec3873, 0x25b619a3, 0x01344895, 0x6cb2bbcf, 0x4830eaf9, + 0xb7bf5d7b, 0x933d0c4d, 0xfebbff17, 0xda39ae21, 0xdad59652, + 0xfe57c764, 0x93d1343e, 0xb7536508, 0x48dcd28a, 0x6c5e83bc, + 0x01d870e6, 0x255a21d0, 0x4b6c3346, 0x6fee6270, 0x0268912a, + 0x26eac01c, 0xd965779e, 0xfde726a8, 0x9061d5f2, 0xb4e384c4, + 0xb40fbcb7, 0x908ded81, 0xfd0b1edb, 0xd9894fed, 0x2606f86f, + 0x0284a959, 0x6f025a03, 0x4b800b35, 0x6eda2ae5, 0x4a587bd3, + 0x27de8889, 0x035cd9bf, 0xfcd36e3d, 0xd8513f0b, 0xb5d7cc51, + 0x91559d67, 0x91b9a514, 0xb53bf422, 0xd8bd0778, 0xfc3f564e, + 0x03b0e1cc, 0x2732b0fa, 0x4ab443a0, 0x6e361296, 0x96d8668c, + 0xb25a37ba, 0xdfdcc4e0, 0xfb5e95d6, 0x04d12254, 0x20537362, + 0x4dd58038, 0x6957d10e, 0x69bbe97d, 0x4d39b84b, 0x20bf4b11, + 0x043d1a27, 0xfbb2ada5, 0xdf30fc93, 0xb2b60fc9, 0x96345eff, + 0xb36e7f2f, 0x97ec2e19, 0xfa6add43, 0xdee88c75, 0x21673bf7, + 0x05e56ac1, 0x6863999b, 0x4ce1c8ad, 0x4c0df0de, 0x688fa1e8, + 0x050952b2, 0x218b0384, 0xde04b406, 0xfa86e530, 0x9700166a, + 0xb382475c, 0xddb455ca, 0xf93604fc, 0x94b0f7a6, 0xb032a690, + 0x4fbd1112, 0x6b3f4024, 0x06b9b37e, 0x223be248, 0x22d7da3b, + 0x06558b0d, 0x6bd37857, 0x4f512961, 0xb0de9ee3, 0x945ccfd5, + 0xf9da3c8f, 0xdd586db9, 0xf8024c69, 0xdc801d5f, 0xb106ee05, + 0x9584bf33, 0x6a0b08b1, 0x4e895987, 0x230faadd, 0x078dfbeb, + 0x0761c398, 0x23e392ae, 0x4e6561f4, 0x6ae730c2, 0x95688740, + 0xb1ead676, 0xdc6c252c, 0xf8ee741a, 0xf6c1cb59, 0xd2439a6f, + 0xbfc56935, 0x9b473803, 0x64c88f81, 0x404adeb7, 0x2dcc2ded, + 0x094e7cdb, 0x09a244a8, 0x2d20159e, 0x40a6e6c4, 0x6424b7f2, + 0x9bab0070, 0xbf295146, 0xd2afa21c, 0xf62df32a, 0xd377d2fa, + 0xf7f583cc, 0x9a737096, 0xbef121a0, 0x417e9622, 0x65fcc714, + 0x087a344e, 0x2cf86578, 0x2c145d0b, 0x08960c3d, 0x6510ff67, + 0x4192ae51, 0xbe1d19d3, 0x9a9f48e5, 0xf719bbbf, 0xd39bea89, + 0xbdadf81f, 0x992fa929, 0xf4a95a73, 0xd02b0b45, 0x2fa4bcc7, + 0x0b26edf1, 0x66a01eab, 0x42224f9d, 0x42ce77ee, 0x664c26d8, + 0x0bcad582, 0x2f4884b4, 0xd0c73336, 0xf4456200, 0x99c3915a, + 0xbd41c06c, 0x981be1bc, 0xbc99b08a, 0xd11f43d0, 0xf59d12e6, + 0x0a12a564, 0x2e90f452, 0x43160708, 0x6794563e, 0x67786e4d, + 0x43fa3f7b, 0x2e7ccc21, 0x0afe9d17, 0xf5712a95, 0xd1f37ba3, + 0xbc7588f9, 0x98f7d9cf, 0x6019add5, 0x449bfce3, 0x291d0fb9, + 0x0d9f5e8f, 0xf210e90d, 0xd692b83b, 0xbb144b61, 0x9f961a57, + 0x9f7a2224, 0xbbf87312, 0xd67e8048, 0xf2fcd17e, 0x0d7366fc, + 0x29f137ca, 0x4477c490, 0x60f595a6, 0x45afb476, 0x612de540, + 0x0cab161a, 0x2829472c, 0xd7a6f0ae, 0xf324a198, 0x9ea252c2, + 0xba2003f4, 0xbacc3b87, 0x9e4e6ab1, 0xf3c899eb, 0xd74ac8dd, + 0x28c57f5f, 0x0c472e69, 0x61c1dd33, 0x45438c05, 0x2b759e93, + 0x0ff7cfa5, 0x62713cff, 0x46f36dc9, 0xb97cda4b, 0x9dfe8b7d, + 0xf0787827, 0xd4fa2911, 0xd4161162, 0xf0944054, 0x9d12b30e, + 0xb990e238, 0x461f55ba, 0x629d048c, 0x0f1bf7d6, 0x2b99a6e0, + 0x0ec38730, 0x2a41d606, 0x47c7255c, 0x6345746a, 0x9ccac3e8, + 0xb84892de, 0xd5ce6184, 0xf14c30b2, 0xf1a008c1, 0xd52259f7, + 0xb8a4aaad, 0x9c26fb9b, 0x63a94c19, 0x472b1d2f, 0x2aadee75, + 0x0e2fbf43}, + {0x00000000, 0x36f290f3, 0x6de521e6, 0x5b17b115, 0xdbca43cc, + 0xed38d33f, 0xb62f622a, 0x80ddf2d9, 0x6ce581d9, 0x5a17112a, + 0x0100a03f, 0x37f230cc, 0xb72fc215, 0x81dd52e6, 0xdacae3f3, + 0xec387300, 0xd9cb03b2, 0xef399341, 0xb42e2254, 0x82dcb2a7, + 0x0201407e, 0x34f3d08d, 0x6fe46198, 0x5916f16b, 0xb52e826b, + 0x83dc1298, 0xd8cba38d, 0xee39337e, 0x6ee4c1a7, 0x58165154, + 0x0301e041, 0x35f370b2, 0x68e70125, 0x5e1591d6, 0x050220c3, + 0x33f0b030, 0xb32d42e9, 0x85dfd21a, 0xdec8630f, 0xe83af3fc, + 0x040280fc, 0x32f0100f, 0x69e7a11a, 0x5f1531e9, 0xdfc8c330, + 0xe93a53c3, 0xb22de2d6, 0x84df7225, 0xb12c0297, 0x87de9264, + 0xdcc92371, 0xea3bb382, 0x6ae6415b, 0x5c14d1a8, 0x070360bd, + 0x31f1f04e, 0xddc9834e, 0xeb3b13bd, 0xb02ca2a8, 0x86de325b, + 0x0603c082, 0x30f15071, 0x6be6e164, 0x5d147197, 0xd1ce024a, + 0xe73c92b9, 0xbc2b23ac, 0x8ad9b35f, 0x0a044186, 0x3cf6d175, + 0x67e16060, 0x5113f093, 0xbd2b8393, 0x8bd91360, 0xd0cea275, + 0xe63c3286, 0x66e1c05f, 0x501350ac, 0x0b04e1b9, 0x3df6714a, + 0x080501f8, 0x3ef7910b, 0x65e0201e, 0x5312b0ed, 0xd3cf4234, + 0xe53dd2c7, 0xbe2a63d2, 0x88d8f321, 0x64e08021, 0x521210d2, + 0x0905a1c7, 0x3ff73134, 0xbf2ac3ed, 0x89d8531e, 0xd2cfe20b, + 0xe43d72f8, 0xb929036f, 0x8fdb939c, 0xd4cc2289, 0xe23eb27a, + 0x62e340a3, 0x5411d050, 0x0f066145, 0x39f4f1b6, 0xd5cc82b6, + 0xe33e1245, 0xb829a350, 0x8edb33a3, 0x0e06c17a, 0x38f45189, + 0x63e3e09c, 0x5511706f, 0x60e200dd, 0x5610902e, 0x0d07213b, + 0x3bf5b1c8, 0xbb284311, 0x8ddad3e2, 0xd6cd62f7, 0xe03ff204, + 0x0c078104, 0x3af511f7, 0x61e2a0e2, 0x57103011, 0xd7cdc2c8, + 0xe13f523b, 0xba28e32e, 0x8cda73dd, 0x78ed02d5, 0x4e1f9226, + 0x15082333, 0x23fab3c0, 0xa3274119, 0x95d5d1ea, 0xcec260ff, + 0xf830f00c, 0x1408830c, 0x22fa13ff, 0x79eda2ea, 0x4f1f3219, + 0xcfc2c0c0, 0xf9305033, 0xa227e126, 0x94d571d5, 0xa1260167, + 0x97d49194, 0xccc32081, 0xfa31b072, 0x7aec42ab, 0x4c1ed258, + 0x1709634d, 0x21fbf3be, 0xcdc380be, 0xfb31104d, 0xa026a158, + 0x96d431ab, 0x1609c372, 0x20fb5381, 0x7bece294, 0x4d1e7267, + 0x100a03f0, 0x26f89303, 0x7def2216, 0x4b1db2e5, 0xcbc0403c, + 0xfd32d0cf, 0xa62561da, 0x90d7f129, 0x7cef8229, 0x4a1d12da, + 0x110aa3cf, 0x27f8333c, 0xa725c1e5, 0x91d75116, 0xcac0e003, + 0xfc3270f0, 0xc9c10042, 0xff3390b1, 0xa42421a4, 0x92d6b157, + 0x120b438e, 0x24f9d37d, 0x7fee6268, 0x491cf29b, 0xa524819b, + 0x93d61168, 0xc8c1a07d, 0xfe33308e, 0x7eeec257, 0x481c52a4, + 0x130be3b1, 0x25f97342, 0xa923009f, 0x9fd1906c, 0xc4c62179, + 0xf234b18a, 0x72e94353, 0x441bd3a0, 0x1f0c62b5, 0x29fef246, + 0xc5c68146, 0xf33411b5, 0xa823a0a0, 0x9ed13053, 0x1e0cc28a, + 0x28fe5279, 0x73e9e36c, 0x451b739f, 0x70e8032d, 0x461a93de, + 0x1d0d22cb, 0x2bffb238, 0xab2240e1, 0x9dd0d012, 0xc6c76107, + 0xf035f1f4, 0x1c0d82f4, 0x2aff1207, 0x71e8a312, 0x471a33e1, + 0xc7c7c138, 0xf13551cb, 0xaa22e0de, 0x9cd0702d, 0xc1c401ba, + 0xf7369149, 0xac21205c, 0x9ad3b0af, 0x1a0e4276, 0x2cfcd285, + 0x77eb6390, 0x4119f363, 0xad218063, 0x9bd31090, 0xc0c4a185, + 0xf6363176, 0x76ebc3af, 0x4019535c, 0x1b0ee249, 0x2dfc72ba, + 0x180f0208, 0x2efd92fb, 0x75ea23ee, 0x4318b31d, 0xc3c541c4, + 0xf537d137, 0xae206022, 0x98d2f0d1, 0x74ea83d1, 0x42181322, + 0x190fa237, 0x2ffd32c4, 0xaf20c01d, 0x99d250ee, 0xc2c5e1fb, + 0xf4377108}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0xf390f23600000000, 0xe621e56d00000000, + 0x15b1175b00000000, 0xcc43cadb00000000, 0x3fd338ed00000000, + 0x2a622fb600000000, 0xd9f2dd8000000000, 0xd981e56c00000000, + 0x2a11175a00000000, 0x3fa0000100000000, 0xcc30f23700000000, + 0x15c22fb700000000, 0xe652dd8100000000, 0xf3e3cada00000000, + 0x007338ec00000000, 0xb203cbd900000000, 0x419339ef00000000, + 0x54222eb400000000, 0xa7b2dc8200000000, 0x7e40010200000000, + 0x8dd0f33400000000, 0x9861e46f00000000, 0x6bf1165900000000, + 0x6b822eb500000000, 0x9812dc8300000000, 0x8da3cbd800000000, + 0x7e3339ee00000000, 0xa7c1e46e00000000, 0x5451165800000000, + 0x41e0010300000000, 0xb270f33500000000, 0x2501e76800000000, + 0xd691155e00000000, 0xc320020500000000, 0x30b0f03300000000, + 0xe9422db300000000, 0x1ad2df8500000000, 0x0f63c8de00000000, + 0xfcf33ae800000000, 0xfc80020400000000, 0x0f10f03200000000, + 0x1aa1e76900000000, 0xe931155f00000000, 0x30c3c8df00000000, + 0xc3533ae900000000, 0xd6e22db200000000, 0x2572df8400000000, + 0x97022cb100000000, 0x6492de8700000000, 0x7123c9dc00000000, + 0x82b33bea00000000, 0x5b41e66a00000000, 0xa8d1145c00000000, + 0xbd60030700000000, 0x4ef0f13100000000, 0x4e83c9dd00000000, + 0xbd133beb00000000, 0xa8a22cb000000000, 0x5b32de8600000000, + 0x82c0030600000000, 0x7150f13000000000, 0x64e1e66b00000000, + 0x9771145d00000000, 0x4a02ced100000000, 0xb9923ce700000000, + 0xac232bbc00000000, 0x5fb3d98a00000000, 0x8641040a00000000, + 0x75d1f63c00000000, 0x6060e16700000000, 0x93f0135100000000, + 0x93832bbd00000000, 0x6013d98b00000000, 0x75a2ced000000000, + 0x86323ce600000000, 0x5fc0e16600000000, 0xac50135000000000, + 0xb9e1040b00000000, 0x4a71f63d00000000, 0xf801050800000000, + 0x0b91f73e00000000, 0x1e20e06500000000, 0xedb0125300000000, + 0x3442cfd300000000, 0xc7d23de500000000, 0xd2632abe00000000, + 0x21f3d88800000000, 0x2180e06400000000, 0xd210125200000000, + 0xc7a1050900000000, 0x3431f73f00000000, 0xedc32abf00000000, + 0x1e53d88900000000, 0x0be2cfd200000000, 0xf8723de400000000, + 0x6f0329b900000000, 0x9c93db8f00000000, 0x8922ccd400000000, + 0x7ab23ee200000000, 0xa340e36200000000, 0x50d0115400000000, + 0x4561060f00000000, 0xb6f1f43900000000, 0xb682ccd500000000, + 0x45123ee300000000, 0x50a329b800000000, 0xa333db8e00000000, + 0x7ac1060e00000000, 0x8951f43800000000, 0x9ce0e36300000000, + 0x6f70115500000000, 0xdd00e26000000000, 0x2e90105600000000, + 0x3b21070d00000000, 0xc8b1f53b00000000, 0x114328bb00000000, + 0xe2d3da8d00000000, 0xf762cdd600000000, 0x04f23fe000000000, + 0x0481070c00000000, 0xf711f53a00000000, 0xe2a0e26100000000, + 0x1130105700000000, 0xc8c2cdd700000000, 0x3b523fe100000000, + 0x2ee328ba00000000, 0xdd73da8c00000000, 0xd502ed7800000000, + 0x26921f4e00000000, 0x3323081500000000, 0xc0b3fa2300000000, + 0x194127a300000000, 0xead1d59500000000, 0xff60c2ce00000000, + 0x0cf030f800000000, 0x0c83081400000000, 0xff13fa2200000000, + 0xeaa2ed7900000000, 0x19321f4f00000000, 0xc0c0c2cf00000000, + 0x335030f900000000, 0x26e127a200000000, 0xd571d59400000000, + 0x670126a100000000, 0x9491d49700000000, 0x8120c3cc00000000, + 0x72b031fa00000000, 0xab42ec7a00000000, 0x58d21e4c00000000, + 0x4d63091700000000, 0xbef3fb2100000000, 0xbe80c3cd00000000, + 0x4d1031fb00000000, 0x58a126a000000000, 0xab31d49600000000, + 0x72c3091600000000, 0x8153fb2000000000, 0x94e2ec7b00000000, + 0x67721e4d00000000, 0xf0030a1000000000, 0x0393f82600000000, + 0x1622ef7d00000000, 0xe5b21d4b00000000, 0x3c40c0cb00000000, + 0xcfd032fd00000000, 0xda6125a600000000, 0x29f1d79000000000, + 0x2982ef7c00000000, 0xda121d4a00000000, 0xcfa30a1100000000, + 0x3c33f82700000000, 0xe5c125a700000000, 0x1651d79100000000, + 0x03e0c0ca00000000, 0xf07032fc00000000, 0x4200c1c900000000, + 0xb19033ff00000000, 0xa42124a400000000, 0x57b1d69200000000, + 0x8e430b1200000000, 0x7dd3f92400000000, 0x6862ee7f00000000, + 0x9bf21c4900000000, 0x9b8124a500000000, 0x6811d69300000000, + 0x7da0c1c800000000, 0x8e3033fe00000000, 0x57c2ee7e00000000, + 0xa4521c4800000000, 0xb1e30b1300000000, 0x4273f92500000000, + 0x9f0023a900000000, 0x6c90d19f00000000, 0x7921c6c400000000, + 0x8ab134f200000000, 0x5343e97200000000, 0xa0d31b4400000000, + 0xb5620c1f00000000, 0x46f2fe2900000000, 0x4681c6c500000000, + 0xb51134f300000000, 0xa0a023a800000000, 0x5330d19e00000000, + 0x8ac20c1e00000000, 0x7952fe2800000000, 0x6ce3e97300000000, + 0x9f731b4500000000, 0x2d03e87000000000, 0xde931a4600000000, + 0xcb220d1d00000000, 0x38b2ff2b00000000, 0xe14022ab00000000, + 0x12d0d09d00000000, 0x0761c7c600000000, 0xf4f135f000000000, + 0xf4820d1c00000000, 0x0712ff2a00000000, 0x12a3e87100000000, + 0xe1331a4700000000, 0x38c1c7c700000000, 0xcb5135f100000000, + 0xdee022aa00000000, 0x2d70d09c00000000, 0xba01c4c100000000, + 0x499136f700000000, 0x5c2021ac00000000, 0xafb0d39a00000000, + 0x76420e1a00000000, 0x85d2fc2c00000000, 0x9063eb7700000000, + 0x63f3194100000000, 0x638021ad00000000, 0x9010d39b00000000, + 0x85a1c4c000000000, 0x763136f600000000, 0xafc3eb7600000000, + 0x5c53194000000000, 0x49e20e1b00000000, 0xba72fc2d00000000, + 0x08020f1800000000, 0xfb92fd2e00000000, 0xee23ea7500000000, + 0x1db3184300000000, 0xc441c5c300000000, 0x37d137f500000000, + 0x226020ae00000000, 0xd1f0d29800000000, 0xd183ea7400000000, + 0x2213184200000000, 0x37a20f1900000000, 0xc432fd2f00000000, + 0x1dc020af00000000, 0xee50d29900000000, 0xfbe1c5c200000000, + 0x087137f400000000}, + {0x0000000000000000, 0x3651822400000000, 0x6ca2044900000000, + 0x5af3866d00000000, 0xd844099200000000, 0xee158bb600000000, + 0xb4e60ddb00000000, 0x82b78fff00000000, 0xf18f63ff00000000, + 0xc7dee1db00000000, 0x9d2d67b600000000, 0xab7ce59200000000, + 0x29cb6a6d00000000, 0x1f9ae84900000000, 0x45696e2400000000, + 0x7338ec0000000000, 0xa319b62500000000, 0x9548340100000000, + 0xcfbbb26c00000000, 0xf9ea304800000000, 0x7b5dbfb700000000, + 0x4d0c3d9300000000, 0x17ffbbfe00000000, 0x21ae39da00000000, + 0x5296d5da00000000, 0x64c757fe00000000, 0x3e34d19300000000, + 0x086553b700000000, 0x8ad2dc4800000000, 0xbc835e6c00000000, + 0xe670d80100000000, 0xd0215a2500000000, 0x46336c4b00000000, + 0x7062ee6f00000000, 0x2a91680200000000, 0x1cc0ea2600000000, + 0x9e7765d900000000, 0xa826e7fd00000000, 0xf2d5619000000000, + 0xc484e3b400000000, 0xb7bc0fb400000000, 0x81ed8d9000000000, + 0xdb1e0bfd00000000, 0xed4f89d900000000, 0x6ff8062600000000, + 0x59a9840200000000, 0x035a026f00000000, 0x350b804b00000000, + 0xe52ada6e00000000, 0xd37b584a00000000, 0x8988de2700000000, + 0xbfd95c0300000000, 0x3d6ed3fc00000000, 0x0b3f51d800000000, + 0x51ccd7b500000000, 0x679d559100000000, 0x14a5b99100000000, + 0x22f43bb500000000, 0x7807bdd800000000, 0x4e563ffc00000000, + 0xcce1b00300000000, 0xfab0322700000000, 0xa043b44a00000000, + 0x9612366e00000000, 0x8c66d89600000000, 0xba375ab200000000, + 0xe0c4dcdf00000000, 0xd6955efb00000000, 0x5422d10400000000, + 0x6273532000000000, 0x3880d54d00000000, 0x0ed1576900000000, + 0x7de9bb6900000000, 0x4bb8394d00000000, 0x114bbf2000000000, + 0x271a3d0400000000, 0xa5adb2fb00000000, 0x93fc30df00000000, + 0xc90fb6b200000000, 0xff5e349600000000, 0x2f7f6eb300000000, + 0x192eec9700000000, 0x43dd6afa00000000, 0x758ce8de00000000, + 0xf73b672100000000, 0xc16ae50500000000, 0x9b99636800000000, + 0xadc8e14c00000000, 0xdef00d4c00000000, 0xe8a18f6800000000, + 0xb252090500000000, 0x84038b2100000000, 0x06b404de00000000, + 0x30e586fa00000000, 0x6a16009700000000, 0x5c4782b300000000, + 0xca55b4dd00000000, 0xfc0436f900000000, 0xa6f7b09400000000, + 0x90a632b000000000, 0x1211bd4f00000000, 0x24403f6b00000000, + 0x7eb3b90600000000, 0x48e23b2200000000, 0x3bdad72200000000, + 0x0d8b550600000000, 0x5778d36b00000000, 0x6129514f00000000, + 0xe39edeb000000000, 0xd5cf5c9400000000, 0x8f3cdaf900000000, + 0xb96d58dd00000000, 0x694c02f800000000, 0x5f1d80dc00000000, + 0x05ee06b100000000, 0x33bf849500000000, 0xb1080b6a00000000, + 0x8759894e00000000, 0xddaa0f2300000000, 0xebfb8d0700000000, + 0x98c3610700000000, 0xae92e32300000000, 0xf461654e00000000, + 0xc230e76a00000000, 0x4087689500000000, 0x76d6eab100000000, + 0x2c256cdc00000000, 0x1a74eef800000000, 0x59cbc1f600000000, + 0x6f9a43d200000000, 0x3569c5bf00000000, 0x0338479b00000000, + 0x818fc86400000000, 0xb7de4a4000000000, 0xed2dcc2d00000000, + 0xdb7c4e0900000000, 0xa844a20900000000, 0x9e15202d00000000, + 0xc4e6a64000000000, 0xf2b7246400000000, 0x7000ab9b00000000, + 0x465129bf00000000, 0x1ca2afd200000000, 0x2af32df600000000, + 0xfad277d300000000, 0xcc83f5f700000000, 0x9670739a00000000, + 0xa021f1be00000000, 0x22967e4100000000, 0x14c7fc6500000000, + 0x4e347a0800000000, 0x7865f82c00000000, 0x0b5d142c00000000, + 0x3d0c960800000000, 0x67ff106500000000, 0x51ae924100000000, + 0xd3191dbe00000000, 0xe5489f9a00000000, 0xbfbb19f700000000, + 0x89ea9bd300000000, 0x1ff8adbd00000000, 0x29a92f9900000000, + 0x735aa9f400000000, 0x450b2bd000000000, 0xc7bca42f00000000, + 0xf1ed260b00000000, 0xab1ea06600000000, 0x9d4f224200000000, + 0xee77ce4200000000, 0xd8264c6600000000, 0x82d5ca0b00000000, + 0xb484482f00000000, 0x3633c7d000000000, 0x006245f400000000, + 0x5a91c39900000000, 0x6cc041bd00000000, 0xbce11b9800000000, + 0x8ab099bc00000000, 0xd0431fd100000000, 0xe6129df500000000, + 0x64a5120a00000000, 0x52f4902e00000000, 0x0807164300000000, + 0x3e56946700000000, 0x4d6e786700000000, 0x7b3ffa4300000000, + 0x21cc7c2e00000000, 0x179dfe0a00000000, 0x952a71f500000000, + 0xa37bf3d100000000, 0xf98875bc00000000, 0xcfd9f79800000000, + 0xd5ad196000000000, 0xe3fc9b4400000000, 0xb90f1d2900000000, + 0x8f5e9f0d00000000, 0x0de910f200000000, 0x3bb892d600000000, + 0x614b14bb00000000, 0x571a969f00000000, 0x24227a9f00000000, + 0x1273f8bb00000000, 0x48807ed600000000, 0x7ed1fcf200000000, + 0xfc66730d00000000, 0xca37f12900000000, 0x90c4774400000000, + 0xa695f56000000000, 0x76b4af4500000000, 0x40e52d6100000000, + 0x1a16ab0c00000000, 0x2c47292800000000, 0xaef0a6d700000000, + 0x98a124f300000000, 0xc252a29e00000000, 0xf40320ba00000000, + 0x873bccba00000000, 0xb16a4e9e00000000, 0xeb99c8f300000000, + 0xddc84ad700000000, 0x5f7fc52800000000, 0x692e470c00000000, + 0x33ddc16100000000, 0x058c434500000000, 0x939e752b00000000, + 0xa5cff70f00000000, 0xff3c716200000000, 0xc96df34600000000, + 0x4bda7cb900000000, 0x7d8bfe9d00000000, 0x277878f000000000, + 0x1129fad400000000, 0x621116d400000000, 0x544094f000000000, + 0x0eb3129d00000000, 0x38e290b900000000, 0xba551f4600000000, + 0x8c049d6200000000, 0xd6f71b0f00000000, 0xe0a6992b00000000, + 0x3087c30e00000000, 0x06d6412a00000000, 0x5c25c74700000000, + 0x6a74456300000000, 0xe8c3ca9c00000000, 0xde9248b800000000, + 0x8461ced500000000, 0xb2304cf100000000, 0xc108a0f100000000, + 0xf75922d500000000, 0xadaaa4b800000000, 0x9bfb269c00000000, + 0x194ca96300000000, 0x2f1d2b4700000000, 0x75eead2a00000000, + 0x43bf2f0e00000000}, + {0x0000000000000000, 0xc8179ecf00000000, 0xd1294d4400000000, + 0x193ed38b00000000, 0xa2539a8800000000, 0x6a44044700000000, + 0x737ad7cc00000000, 0xbb6d490300000000, 0x05a145ca00000000, + 0xcdb6db0500000000, 0xd488088e00000000, 0x1c9f964100000000, + 0xa7f2df4200000000, 0x6fe5418d00000000, 0x76db920600000000, + 0xbecc0cc900000000, 0x4b44fa4f00000000, 0x8353648000000000, + 0x9a6db70b00000000, 0x527a29c400000000, 0xe91760c700000000, + 0x2100fe0800000000, 0x383e2d8300000000, 0xf029b34c00000000, + 0x4ee5bf8500000000, 0x86f2214a00000000, 0x9fccf2c100000000, + 0x57db6c0e00000000, 0xecb6250d00000000, 0x24a1bbc200000000, + 0x3d9f684900000000, 0xf588f68600000000, 0x9688f49f00000000, + 0x5e9f6a5000000000, 0x47a1b9db00000000, 0x8fb6271400000000, + 0x34db6e1700000000, 0xfcccf0d800000000, 0xe5f2235300000000, + 0x2de5bd9c00000000, 0x9329b15500000000, 0x5b3e2f9a00000000, + 0x4200fc1100000000, 0x8a1762de00000000, 0x317a2bdd00000000, + 0xf96db51200000000, 0xe053669900000000, 0x2844f85600000000, + 0xddcc0ed000000000, 0x15db901f00000000, 0x0ce5439400000000, + 0xc4f2dd5b00000000, 0x7f9f945800000000, 0xb7880a9700000000, + 0xaeb6d91c00000000, 0x66a147d300000000, 0xd86d4b1a00000000, + 0x107ad5d500000000, 0x0944065e00000000, 0xc153989100000000, + 0x7a3ed19200000000, 0xb2294f5d00000000, 0xab179cd600000000, + 0x6300021900000000, 0x6d1798e400000000, 0xa500062b00000000, + 0xbc3ed5a000000000, 0x74294b6f00000000, 0xcf44026c00000000, + 0x07539ca300000000, 0x1e6d4f2800000000, 0xd67ad1e700000000, + 0x68b6dd2e00000000, 0xa0a143e100000000, 0xb99f906a00000000, + 0x71880ea500000000, 0xcae547a600000000, 0x02f2d96900000000, + 0x1bcc0ae200000000, 0xd3db942d00000000, 0x265362ab00000000, + 0xee44fc6400000000, 0xf77a2fef00000000, 0x3f6db12000000000, + 0x8400f82300000000, 0x4c1766ec00000000, 0x5529b56700000000, + 0x9d3e2ba800000000, 0x23f2276100000000, 0xebe5b9ae00000000, + 0xf2db6a2500000000, 0x3accf4ea00000000, 0x81a1bde900000000, + 0x49b6232600000000, 0x5088f0ad00000000, 0x989f6e6200000000, + 0xfb9f6c7b00000000, 0x3388f2b400000000, 0x2ab6213f00000000, + 0xe2a1bff000000000, 0x59ccf6f300000000, 0x91db683c00000000, + 0x88e5bbb700000000, 0x40f2257800000000, 0xfe3e29b100000000, + 0x3629b77e00000000, 0x2f1764f500000000, 0xe700fa3a00000000, + 0x5c6db33900000000, 0x947a2df600000000, 0x8d44fe7d00000000, + 0x455360b200000000, 0xb0db963400000000, 0x78cc08fb00000000, + 0x61f2db7000000000, 0xa9e545bf00000000, 0x12880cbc00000000, + 0xda9f927300000000, 0xc3a141f800000000, 0x0bb6df3700000000, + 0xb57ad3fe00000000, 0x7d6d4d3100000000, 0x64539eba00000000, + 0xac44007500000000, 0x1729497600000000, 0xdf3ed7b900000000, + 0xc600043200000000, 0x0e179afd00000000, 0x9b28411200000000, + 0x533fdfdd00000000, 0x4a010c5600000000, 0x8216929900000000, + 0x397bdb9a00000000, 0xf16c455500000000, 0xe85296de00000000, + 0x2045081100000000, 0x9e8904d800000000, 0x569e9a1700000000, + 0x4fa0499c00000000, 0x87b7d75300000000, 0x3cda9e5000000000, + 0xf4cd009f00000000, 0xedf3d31400000000, 0x25e44ddb00000000, + 0xd06cbb5d00000000, 0x187b259200000000, 0x0145f61900000000, + 0xc95268d600000000, 0x723f21d500000000, 0xba28bf1a00000000, + 0xa3166c9100000000, 0x6b01f25e00000000, 0xd5cdfe9700000000, + 0x1dda605800000000, 0x04e4b3d300000000, 0xccf32d1c00000000, + 0x779e641f00000000, 0xbf89fad000000000, 0xa6b7295b00000000, + 0x6ea0b79400000000, 0x0da0b58d00000000, 0xc5b72b4200000000, + 0xdc89f8c900000000, 0x149e660600000000, 0xaff32f0500000000, + 0x67e4b1ca00000000, 0x7eda624100000000, 0xb6cdfc8e00000000, + 0x0801f04700000000, 0xc0166e8800000000, 0xd928bd0300000000, + 0x113f23cc00000000, 0xaa526acf00000000, 0x6245f40000000000, + 0x7b7b278b00000000, 0xb36cb94400000000, 0x46e44fc200000000, + 0x8ef3d10d00000000, 0x97cd028600000000, 0x5fda9c4900000000, + 0xe4b7d54a00000000, 0x2ca04b8500000000, 0x359e980e00000000, + 0xfd8906c100000000, 0x43450a0800000000, 0x8b5294c700000000, + 0x926c474c00000000, 0x5a7bd98300000000, 0xe116908000000000, + 0x29010e4f00000000, 0x303fddc400000000, 0xf828430b00000000, + 0xf63fd9f600000000, 0x3e28473900000000, 0x271694b200000000, + 0xef010a7d00000000, 0x546c437e00000000, 0x9c7bddb100000000, + 0x85450e3a00000000, 0x4d5290f500000000, 0xf39e9c3c00000000, + 0x3b8902f300000000, 0x22b7d17800000000, 0xeaa04fb700000000, + 0x51cd06b400000000, 0x99da987b00000000, 0x80e44bf000000000, + 0x48f3d53f00000000, 0xbd7b23b900000000, 0x756cbd7600000000, + 0x6c526efd00000000, 0xa445f03200000000, 0x1f28b93100000000, + 0xd73f27fe00000000, 0xce01f47500000000, 0x06166aba00000000, + 0xb8da667300000000, 0x70cdf8bc00000000, 0x69f32b3700000000, + 0xa1e4b5f800000000, 0x1a89fcfb00000000, 0xd29e623400000000, + 0xcba0b1bf00000000, 0x03b72f7000000000, 0x60b72d6900000000, + 0xa8a0b3a600000000, 0xb19e602d00000000, 0x7989fee200000000, + 0xc2e4b7e100000000, 0x0af3292e00000000, 0x13cdfaa500000000, + 0xdbda646a00000000, 0x651668a300000000, 0xad01f66c00000000, + 0xb43f25e700000000, 0x7c28bb2800000000, 0xc745f22b00000000, + 0x0f526ce400000000, 0x166cbf6f00000000, 0xde7b21a000000000, + 0x2bf3d72600000000, 0xe3e449e900000000, 0xfada9a6200000000, + 0x32cd04ad00000000, 0x89a04dae00000000, 0x41b7d36100000000, + 0x588900ea00000000, 0x909e9e2500000000, 0x2e5292ec00000000, + 0xe6450c2300000000, 0xff7bdfa800000000, 0x376c416700000000, + 0x8c01086400000000, 0x441696ab00000000, 0x5d28452000000000, + 0x953fdbef00000000}, + {0x0000000000000000, 0x95d4709500000000, 0x6baf90f100000000, + 0xfe7be06400000000, 0x9758503800000000, 0x028c20ad00000000, + 0xfcf7c0c900000000, 0x6923b05c00000000, 0x2eb1a07000000000, + 0xbb65d0e500000000, 0x451e308100000000, 0xd0ca401400000000, + 0xb9e9f04800000000, 0x2c3d80dd00000000, 0xd24660b900000000, + 0x4792102c00000000, 0x5c6241e100000000, 0xc9b6317400000000, + 0x37cdd11000000000, 0xa219a18500000000, 0xcb3a11d900000000, + 0x5eee614c00000000, 0xa095812800000000, 0x3541f1bd00000000, + 0x72d3e19100000000, 0xe707910400000000, 0x197c716000000000, + 0x8ca801f500000000, 0xe58bb1a900000000, 0x705fc13c00000000, + 0x8e24215800000000, 0x1bf051cd00000000, 0xf9c2f31900000000, + 0x6c16838c00000000, 0x926d63e800000000, 0x07b9137d00000000, + 0x6e9aa32100000000, 0xfb4ed3b400000000, 0x053533d000000000, + 0x90e1434500000000, 0xd773536900000000, 0x42a723fc00000000, + 0xbcdcc39800000000, 0x2908b30d00000000, 0x402b035100000000, + 0xd5ff73c400000000, 0x2b8493a000000000, 0xbe50e33500000000, + 0xa5a0b2f800000000, 0x3074c26d00000000, 0xce0f220900000000, + 0x5bdb529c00000000, 0x32f8e2c000000000, 0xa72c925500000000, + 0x5957723100000000, 0xcc8302a400000000, 0x8b11128800000000, + 0x1ec5621d00000000, 0xe0be827900000000, 0x756af2ec00000000, + 0x1c4942b000000000, 0x899d322500000000, 0x77e6d24100000000, + 0xe232a2d400000000, 0xf285e73300000000, 0x675197a600000000, + 0x992a77c200000000, 0x0cfe075700000000, 0x65ddb70b00000000, + 0xf009c79e00000000, 0x0e7227fa00000000, 0x9ba6576f00000000, + 0xdc34474300000000, 0x49e037d600000000, 0xb79bd7b200000000, + 0x224fa72700000000, 0x4b6c177b00000000, 0xdeb867ee00000000, + 0x20c3878a00000000, 0xb517f71f00000000, 0xaee7a6d200000000, + 0x3b33d64700000000, 0xc548362300000000, 0x509c46b600000000, + 0x39bff6ea00000000, 0xac6b867f00000000, 0x5210661b00000000, + 0xc7c4168e00000000, 0x805606a200000000, 0x1582763700000000, + 0xebf9965300000000, 0x7e2de6c600000000, 0x170e569a00000000, + 0x82da260f00000000, 0x7ca1c66b00000000, 0xe975b6fe00000000, + 0x0b47142a00000000, 0x9e9364bf00000000, 0x60e884db00000000, + 0xf53cf44e00000000, 0x9c1f441200000000, 0x09cb348700000000, + 0xf7b0d4e300000000, 0x6264a47600000000, 0x25f6b45a00000000, + 0xb022c4cf00000000, 0x4e5924ab00000000, 0xdb8d543e00000000, + 0xb2aee46200000000, 0x277a94f700000000, 0xd901749300000000, + 0x4cd5040600000000, 0x572555cb00000000, 0xc2f1255e00000000, + 0x3c8ac53a00000000, 0xa95eb5af00000000, 0xc07d05f300000000, + 0x55a9756600000000, 0xabd2950200000000, 0x3e06e59700000000, + 0x7994f5bb00000000, 0xec40852e00000000, 0x123b654a00000000, + 0x87ef15df00000000, 0xeecca58300000000, 0x7b18d51600000000, + 0x8563357200000000, 0x10b745e700000000, 0xe40bcf6700000000, + 0x71dfbff200000000, 0x8fa45f9600000000, 0x1a702f0300000000, + 0x73539f5f00000000, 0xe687efca00000000, 0x18fc0fae00000000, + 0x8d287f3b00000000, 0xcaba6f1700000000, 0x5f6e1f8200000000, + 0xa115ffe600000000, 0x34c18f7300000000, 0x5de23f2f00000000, + 0xc8364fba00000000, 0x364dafde00000000, 0xa399df4b00000000, + 0xb8698e8600000000, 0x2dbdfe1300000000, 0xd3c61e7700000000, + 0x46126ee200000000, 0x2f31debe00000000, 0xbae5ae2b00000000, + 0x449e4e4f00000000, 0xd14a3eda00000000, 0x96d82ef600000000, + 0x030c5e6300000000, 0xfd77be0700000000, 0x68a3ce9200000000, + 0x01807ece00000000, 0x94540e5b00000000, 0x6a2fee3f00000000, + 0xfffb9eaa00000000, 0x1dc93c7e00000000, 0x881d4ceb00000000, + 0x7666ac8f00000000, 0xe3b2dc1a00000000, 0x8a916c4600000000, + 0x1f451cd300000000, 0xe13efcb700000000, 0x74ea8c2200000000, + 0x33789c0e00000000, 0xa6acec9b00000000, 0x58d70cff00000000, + 0xcd037c6a00000000, 0xa420cc3600000000, 0x31f4bca300000000, + 0xcf8f5cc700000000, 0x5a5b2c5200000000, 0x41ab7d9f00000000, + 0xd47f0d0a00000000, 0x2a04ed6e00000000, 0xbfd09dfb00000000, + 0xd6f32da700000000, 0x43275d3200000000, 0xbd5cbd5600000000, + 0x2888cdc300000000, 0x6f1addef00000000, 0xfacead7a00000000, + 0x04b54d1e00000000, 0x91613d8b00000000, 0xf8428dd700000000, + 0x6d96fd4200000000, 0x93ed1d2600000000, 0x06396db300000000, + 0x168e285400000000, 0x835a58c100000000, 0x7d21b8a500000000, + 0xe8f5c83000000000, 0x81d6786c00000000, 0x140208f900000000, + 0xea79e89d00000000, 0x7fad980800000000, 0x383f882400000000, + 0xadebf8b100000000, 0x539018d500000000, 0xc644684000000000, + 0xaf67d81c00000000, 0x3ab3a88900000000, 0xc4c848ed00000000, + 0x511c387800000000, 0x4aec69b500000000, 0xdf38192000000000, + 0x2143f94400000000, 0xb49789d100000000, 0xddb4398d00000000, + 0x4860491800000000, 0xb61ba97c00000000, 0x23cfd9e900000000, + 0x645dc9c500000000, 0xf189b95000000000, 0x0ff2593400000000, + 0x9a2629a100000000, 0xf30599fd00000000, 0x66d1e96800000000, + 0x98aa090c00000000, 0x0d7e799900000000, 0xef4cdb4d00000000, + 0x7a98abd800000000, 0x84e34bbc00000000, 0x11373b2900000000, + 0x78148b7500000000, 0xedc0fbe000000000, 0x13bb1b8400000000, + 0x866f6b1100000000, 0xc1fd7b3d00000000, 0x54290ba800000000, + 0xaa52ebcc00000000, 0x3f869b5900000000, 0x56a52b0500000000, + 0xc3715b9000000000, 0x3d0abbf400000000, 0xa8decb6100000000, + 0xb32e9aac00000000, 0x26faea3900000000, 0xd8810a5d00000000, + 0x4d557ac800000000, 0x2476ca9400000000, 0xb1a2ba0100000000, + 0x4fd95a6500000000, 0xda0d2af000000000, 0x9d9f3adc00000000, + 0x084b4a4900000000, 0xf630aa2d00000000, 0x63e4dab800000000, + 0x0ac76ae400000000, 0x9f131a7100000000, 0x6168fa1500000000, + 0xf4bc8a8000000000}, + {0x0000000000000000, 0x1f17f08000000000, 0x7f2891da00000000, + 0x603f615a00000000, 0xbf56536e00000000, 0xa041a3ee00000000, + 0xc07ec2b400000000, 0xdf69323400000000, 0x7eada6dc00000000, + 0x61ba565c00000000, 0x0185370600000000, 0x1e92c78600000000, + 0xc1fbf5b200000000, 0xdeec053200000000, 0xbed3646800000000, + 0xa1c494e800000000, 0xbd5c3c6200000000, 0xa24bcce200000000, + 0xc274adb800000000, 0xdd635d3800000000, 0x020a6f0c00000000, + 0x1d1d9f8c00000000, 0x7d22fed600000000, 0x62350e5600000000, + 0xc3f19abe00000000, 0xdce66a3e00000000, 0xbcd90b6400000000, + 0xa3cefbe400000000, 0x7ca7c9d000000000, 0x63b0395000000000, + 0x038f580a00000000, 0x1c98a88a00000000, 0x7ab978c400000000, + 0x65ae884400000000, 0x0591e91e00000000, 0x1a86199e00000000, + 0xc5ef2baa00000000, 0xdaf8db2a00000000, 0xbac7ba7000000000, + 0xa5d04af000000000, 0x0414de1800000000, 0x1b032e9800000000, + 0x7b3c4fc200000000, 0x642bbf4200000000, 0xbb428d7600000000, + 0xa4557df600000000, 0xc46a1cac00000000, 0xdb7dec2c00000000, + 0xc7e544a600000000, 0xd8f2b42600000000, 0xb8cdd57c00000000, + 0xa7da25fc00000000, 0x78b317c800000000, 0x67a4e74800000000, + 0x079b861200000000, 0x188c769200000000, 0xb948e27a00000000, + 0xa65f12fa00000000, 0xc66073a000000000, 0xd977832000000000, + 0x061eb11400000000, 0x1909419400000000, 0x793620ce00000000, + 0x6621d04e00000000, 0xb574805300000000, 0xaa6370d300000000, + 0xca5c118900000000, 0xd54be10900000000, 0x0a22d33d00000000, + 0x153523bd00000000, 0x750a42e700000000, 0x6a1db26700000000, + 0xcbd9268f00000000, 0xd4ced60f00000000, 0xb4f1b75500000000, + 0xabe647d500000000, 0x748f75e100000000, 0x6b98856100000000, + 0x0ba7e43b00000000, 0x14b014bb00000000, 0x0828bc3100000000, + 0x173f4cb100000000, 0x77002deb00000000, 0x6817dd6b00000000, + 0xb77eef5f00000000, 0xa8691fdf00000000, 0xc8567e8500000000, + 0xd7418e0500000000, 0x76851aed00000000, 0x6992ea6d00000000, + 0x09ad8b3700000000, 0x16ba7bb700000000, 0xc9d3498300000000, + 0xd6c4b90300000000, 0xb6fbd85900000000, 0xa9ec28d900000000, + 0xcfcdf89700000000, 0xd0da081700000000, 0xb0e5694d00000000, + 0xaff299cd00000000, 0x709babf900000000, 0x6f8c5b7900000000, + 0x0fb33a2300000000, 0x10a4caa300000000, 0xb1605e4b00000000, + 0xae77aecb00000000, 0xce48cf9100000000, 0xd15f3f1100000000, + 0x0e360d2500000000, 0x1121fda500000000, 0x711e9cff00000000, + 0x6e096c7f00000000, 0x7291c4f500000000, 0x6d86347500000000, + 0x0db9552f00000000, 0x12aea5af00000000, 0xcdc7979b00000000, + 0xd2d0671b00000000, 0xb2ef064100000000, 0xadf8f6c100000000, + 0x0c3c622900000000, 0x132b92a900000000, 0x7314f3f300000000, + 0x6c03037300000000, 0xb36a314700000000, 0xac7dc1c700000000, + 0xcc42a09d00000000, 0xd355501d00000000, 0x6ae900a700000000, + 0x75fef02700000000, 0x15c1917d00000000, 0x0ad661fd00000000, + 0xd5bf53c900000000, 0xcaa8a34900000000, 0xaa97c21300000000, + 0xb580329300000000, 0x1444a67b00000000, 0x0b5356fb00000000, + 0x6b6c37a100000000, 0x747bc72100000000, 0xab12f51500000000, + 0xb405059500000000, 0xd43a64cf00000000, 0xcb2d944f00000000, + 0xd7b53cc500000000, 0xc8a2cc4500000000, 0xa89dad1f00000000, + 0xb78a5d9f00000000, 0x68e36fab00000000, 0x77f49f2b00000000, + 0x17cbfe7100000000, 0x08dc0ef100000000, 0xa9189a1900000000, + 0xb60f6a9900000000, 0xd6300bc300000000, 0xc927fb4300000000, + 0x164ec97700000000, 0x095939f700000000, 0x696658ad00000000, + 0x7671a82d00000000, 0x1050786300000000, 0x0f4788e300000000, + 0x6f78e9b900000000, 0x706f193900000000, 0xaf062b0d00000000, + 0xb011db8d00000000, 0xd02ebad700000000, 0xcf394a5700000000, + 0x6efddebf00000000, 0x71ea2e3f00000000, 0x11d54f6500000000, + 0x0ec2bfe500000000, 0xd1ab8dd100000000, 0xcebc7d5100000000, + 0xae831c0b00000000, 0xb194ec8b00000000, 0xad0c440100000000, + 0xb21bb48100000000, 0xd224d5db00000000, 0xcd33255b00000000, + 0x125a176f00000000, 0x0d4de7ef00000000, 0x6d7286b500000000, + 0x7265763500000000, 0xd3a1e2dd00000000, 0xccb6125d00000000, + 0xac89730700000000, 0xb39e838700000000, 0x6cf7b1b300000000, + 0x73e0413300000000, 0x13df206900000000, 0x0cc8d0e900000000, + 0xdf9d80f400000000, 0xc08a707400000000, 0xa0b5112e00000000, + 0xbfa2e1ae00000000, 0x60cbd39a00000000, 0x7fdc231a00000000, + 0x1fe3424000000000, 0x00f4b2c000000000, 0xa130262800000000, + 0xbe27d6a800000000, 0xde18b7f200000000, 0xc10f477200000000, + 0x1e66754600000000, 0x017185c600000000, 0x614ee49c00000000, + 0x7e59141c00000000, 0x62c1bc9600000000, 0x7dd64c1600000000, + 0x1de92d4c00000000, 0x02feddcc00000000, 0xdd97eff800000000, + 0xc2801f7800000000, 0xa2bf7e2200000000, 0xbda88ea200000000, + 0x1c6c1a4a00000000, 0x037beaca00000000, 0x63448b9000000000, + 0x7c537b1000000000, 0xa33a492400000000, 0xbc2db9a400000000, + 0xdc12d8fe00000000, 0xc305287e00000000, 0xa524f83000000000, + 0xba3308b000000000, 0xda0c69ea00000000, 0xc51b996a00000000, + 0x1a72ab5e00000000, 0x05655bde00000000, 0x655a3a8400000000, + 0x7a4dca0400000000, 0xdb895eec00000000, 0xc49eae6c00000000, + 0xa4a1cf3600000000, 0xbbb63fb600000000, 0x64df0d8200000000, + 0x7bc8fd0200000000, 0x1bf79c5800000000, 0x04e06cd800000000, + 0x1878c45200000000, 0x076f34d200000000, 0x6750558800000000, + 0x7847a50800000000, 0xa72e973c00000000, 0xb83967bc00000000, + 0xd80606e600000000, 0xc711f66600000000, 0x66d5628e00000000, + 0x79c2920e00000000, 0x19fdf35400000000, 0x06ea03d400000000, + 0xd98331e000000000, 0xc694c16000000000, 0xa6aba03a00000000, + 0xb9bc50ba00000000}, + {0x0000000000000000, 0xe2fd888d00000000, 0x85fd60c000000000, + 0x6700e84d00000000, 0x4bfdb05b00000000, 0xa90038d600000000, + 0xce00d09b00000000, 0x2cfd581600000000, 0x96fa61b700000000, + 0x7407e93a00000000, 0x1307017700000000, 0xf1fa89fa00000000, + 0xdd07d1ec00000000, 0x3ffa596100000000, 0x58fab12c00000000, + 0xba0739a100000000, 0x6df3b2b500000000, 0x8f0e3a3800000000, + 0xe80ed27500000000, 0x0af35af800000000, 0x260e02ee00000000, + 0xc4f38a6300000000, 0xa3f3622e00000000, 0x410eeaa300000000, + 0xfb09d30200000000, 0x19f45b8f00000000, 0x7ef4b3c200000000, + 0x9c093b4f00000000, 0xb0f4635900000000, 0x5209ebd400000000, + 0x3509039900000000, 0xd7f48b1400000000, 0x9be014b000000000, + 0x791d9c3d00000000, 0x1e1d747000000000, 0xfce0fcfd00000000, + 0xd01da4eb00000000, 0x32e02c6600000000, 0x55e0c42b00000000, + 0xb71d4ca600000000, 0x0d1a750700000000, 0xefe7fd8a00000000, + 0x88e715c700000000, 0x6a1a9d4a00000000, 0x46e7c55c00000000, + 0xa41a4dd100000000, 0xc31aa59c00000000, 0x21e72d1100000000, + 0xf613a60500000000, 0x14ee2e8800000000, 0x73eec6c500000000, + 0x91134e4800000000, 0xbdee165e00000000, 0x5f139ed300000000, + 0x3813769e00000000, 0xdaeefe1300000000, 0x60e9c7b200000000, + 0x82144f3f00000000, 0xe514a77200000000, 0x07e92fff00000000, + 0x2b1477e900000000, 0xc9e9ff6400000000, 0xaee9172900000000, + 0x4c149fa400000000, 0x77c758bb00000000, 0x953ad03600000000, + 0xf23a387b00000000, 0x10c7b0f600000000, 0x3c3ae8e000000000, + 0xdec7606d00000000, 0xb9c7882000000000, 0x5b3a00ad00000000, + 0xe13d390c00000000, 0x03c0b18100000000, 0x64c059cc00000000, + 0x863dd14100000000, 0xaac0895700000000, 0x483d01da00000000, + 0x2f3de99700000000, 0xcdc0611a00000000, 0x1a34ea0e00000000, + 0xf8c9628300000000, 0x9fc98ace00000000, 0x7d34024300000000, + 0x51c95a5500000000, 0xb334d2d800000000, 0xd4343a9500000000, + 0x36c9b21800000000, 0x8cce8bb900000000, 0x6e33033400000000, + 0x0933eb7900000000, 0xebce63f400000000, 0xc7333be200000000, + 0x25ceb36f00000000, 0x42ce5b2200000000, 0xa033d3af00000000, + 0xec274c0b00000000, 0x0edac48600000000, 0x69da2ccb00000000, + 0x8b27a44600000000, 0xa7dafc5000000000, 0x452774dd00000000, + 0x22279c9000000000, 0xc0da141d00000000, 0x7add2dbc00000000, + 0x9820a53100000000, 0xff204d7c00000000, 0x1dddc5f100000000, + 0x31209de700000000, 0xd3dd156a00000000, 0xb4ddfd2700000000, + 0x562075aa00000000, 0x81d4febe00000000, 0x6329763300000000, + 0x04299e7e00000000, 0xe6d416f300000000, 0xca294ee500000000, + 0x28d4c66800000000, 0x4fd42e2500000000, 0xad29a6a800000000, + 0x172e9f0900000000, 0xf5d3178400000000, 0x92d3ffc900000000, + 0x702e774400000000, 0x5cd32f5200000000, 0xbe2ea7df00000000, + 0xd92e4f9200000000, 0x3bd3c71f00000000, 0xaf88c0ad00000000, + 0x4d75482000000000, 0x2a75a06d00000000, 0xc88828e000000000, + 0xe47570f600000000, 0x0688f87b00000000, 0x6188103600000000, + 0x837598bb00000000, 0x3972a11a00000000, 0xdb8f299700000000, + 0xbc8fc1da00000000, 0x5e72495700000000, 0x728f114100000000, + 0x907299cc00000000, 0xf772718100000000, 0x158ff90c00000000, + 0xc27b721800000000, 0x2086fa9500000000, 0x478612d800000000, + 0xa57b9a5500000000, 0x8986c24300000000, 0x6b7b4ace00000000, + 0x0c7ba28300000000, 0xee862a0e00000000, 0x548113af00000000, + 0xb67c9b2200000000, 0xd17c736f00000000, 0x3381fbe200000000, + 0x1f7ca3f400000000, 0xfd812b7900000000, 0x9a81c33400000000, + 0x787c4bb900000000, 0x3468d41d00000000, 0xd6955c9000000000, + 0xb195b4dd00000000, 0x53683c5000000000, 0x7f95644600000000, + 0x9d68eccb00000000, 0xfa68048600000000, 0x18958c0b00000000, + 0xa292b5aa00000000, 0x406f3d2700000000, 0x276fd56a00000000, + 0xc5925de700000000, 0xe96f05f100000000, 0x0b928d7c00000000, + 0x6c92653100000000, 0x8e6fedbc00000000, 0x599b66a800000000, + 0xbb66ee2500000000, 0xdc66066800000000, 0x3e9b8ee500000000, + 0x1266d6f300000000, 0xf09b5e7e00000000, 0x979bb63300000000, + 0x75663ebe00000000, 0xcf61071f00000000, 0x2d9c8f9200000000, + 0x4a9c67df00000000, 0xa861ef5200000000, 0x849cb74400000000, + 0x66613fc900000000, 0x0161d78400000000, 0xe39c5f0900000000, + 0xd84f981600000000, 0x3ab2109b00000000, 0x5db2f8d600000000, + 0xbf4f705b00000000, 0x93b2284d00000000, 0x714fa0c000000000, + 0x164f488d00000000, 0xf4b2c00000000000, 0x4eb5f9a100000000, + 0xac48712c00000000, 0xcb48996100000000, 0x29b511ec00000000, + 0x054849fa00000000, 0xe7b5c17700000000, 0x80b5293a00000000, + 0x6248a1b700000000, 0xb5bc2aa300000000, 0x5741a22e00000000, + 0x30414a6300000000, 0xd2bcc2ee00000000, 0xfe419af800000000, + 0x1cbc127500000000, 0x7bbcfa3800000000, 0x994172b500000000, + 0x23464b1400000000, 0xc1bbc39900000000, 0xa6bb2bd400000000, + 0x4446a35900000000, 0x68bbfb4f00000000, 0x8a4673c200000000, + 0xed469b8f00000000, 0x0fbb130200000000, 0x43af8ca600000000, + 0xa152042b00000000, 0xc652ec6600000000, 0x24af64eb00000000, + 0x08523cfd00000000, 0xeaafb47000000000, 0x8daf5c3d00000000, + 0x6f52d4b000000000, 0xd555ed1100000000, 0x37a8659c00000000, + 0x50a88dd100000000, 0xb255055c00000000, 0x9ea85d4a00000000, + 0x7c55d5c700000000, 0x1b553d8a00000000, 0xf9a8b50700000000, + 0x2e5c3e1300000000, 0xcca1b69e00000000, 0xaba15ed300000000, + 0x495cd65e00000000, 0x65a18e4800000000, 0x875c06c500000000, + 0xe05cee8800000000, 0x02a1660500000000, 0xb8a65fa400000000, + 0x5a5bd72900000000, 0x3d5b3f6400000000, 0xdfa6b7e900000000, + 0xf35befff00000000, 0x11a6677200000000, 0x76a68f3f00000000, + 0x945b07b200000000}, + {0x0000000000000000, 0xa90b894e00000000, 0x5217129d00000000, + 0xfb1c9bd300000000, 0xe52855e100000000, 0x4c23dcaf00000000, + 0xb73f477c00000000, 0x1e34ce3200000000, 0x8b57db1900000000, + 0x225c525700000000, 0xd940c98400000000, 0x704b40ca00000000, + 0x6e7f8ef800000000, 0xc77407b600000000, 0x3c689c6500000000, + 0x9563152b00000000, 0x16afb63300000000, 0xbfa43f7d00000000, + 0x44b8a4ae00000000, 0xedb32de000000000, 0xf387e3d200000000, + 0x5a8c6a9c00000000, 0xa190f14f00000000, 0x089b780100000000, + 0x9df86d2a00000000, 0x34f3e46400000000, 0xcfef7fb700000000, + 0x66e4f6f900000000, 0x78d038cb00000000, 0xd1dbb18500000000, + 0x2ac72a5600000000, 0x83cca31800000000, 0x2c5e6d6700000000, + 0x8555e42900000000, 0x7e497ffa00000000, 0xd742f6b400000000, + 0xc976388600000000, 0x607db1c800000000, 0x9b612a1b00000000, + 0x326aa35500000000, 0xa709b67e00000000, 0x0e023f3000000000, + 0xf51ea4e300000000, 0x5c152dad00000000, 0x4221e39f00000000, + 0xeb2a6ad100000000, 0x1036f10200000000, 0xb93d784c00000000, + 0x3af1db5400000000, 0x93fa521a00000000, 0x68e6c9c900000000, + 0xc1ed408700000000, 0xdfd98eb500000000, 0x76d207fb00000000, + 0x8dce9c2800000000, 0x24c5156600000000, 0xb1a6004d00000000, + 0x18ad890300000000, 0xe3b112d000000000, 0x4aba9b9e00000000, + 0x548e55ac00000000, 0xfd85dce200000000, 0x0699473100000000, + 0xaf92ce7f00000000, 0x58bcdace00000000, 0xf1b7538000000000, + 0x0aabc85300000000, 0xa3a0411d00000000, 0xbd948f2f00000000, + 0x149f066100000000, 0xef839db200000000, 0x468814fc00000000, + 0xd3eb01d700000000, 0x7ae0889900000000, 0x81fc134a00000000, + 0x28f79a0400000000, 0x36c3543600000000, 0x9fc8dd7800000000, + 0x64d446ab00000000, 0xcddfcfe500000000, 0x4e136cfd00000000, + 0xe718e5b300000000, 0x1c047e6000000000, 0xb50ff72e00000000, + 0xab3b391c00000000, 0x0230b05200000000, 0xf92c2b8100000000, + 0x5027a2cf00000000, 0xc544b7e400000000, 0x6c4f3eaa00000000, + 0x9753a57900000000, 0x3e582c3700000000, 0x206ce20500000000, + 0x89676b4b00000000, 0x727bf09800000000, 0xdb7079d600000000, + 0x74e2b7a900000000, 0xdde93ee700000000, 0x26f5a53400000000, + 0x8ffe2c7a00000000, 0x91cae24800000000, 0x38c16b0600000000, + 0xc3ddf0d500000000, 0x6ad6799b00000000, 0xffb56cb000000000, + 0x56bee5fe00000000, 0xada27e2d00000000, 0x04a9f76300000000, + 0x1a9d395100000000, 0xb396b01f00000000, 0x488a2bcc00000000, + 0xe181a28200000000, 0x624d019a00000000, 0xcb4688d400000000, + 0x305a130700000000, 0x99519a4900000000, 0x8765547b00000000, + 0x2e6edd3500000000, 0xd57246e600000000, 0x7c79cfa800000000, + 0xe91ada8300000000, 0x401153cd00000000, 0xbb0dc81e00000000, + 0x1206415000000000, 0x0c328f6200000000, 0xa539062c00000000, + 0x5e259dff00000000, 0xf72e14b100000000, 0xf17ec44600000000, + 0x58754d0800000000, 0xa369d6db00000000, 0x0a625f9500000000, + 0x145691a700000000, 0xbd5d18e900000000, 0x4641833a00000000, + 0xef4a0a7400000000, 0x7a291f5f00000000, 0xd322961100000000, + 0x283e0dc200000000, 0x8135848c00000000, 0x9f014abe00000000, + 0x360ac3f000000000, 0xcd16582300000000, 0x641dd16d00000000, + 0xe7d1727500000000, 0x4edafb3b00000000, 0xb5c660e800000000, + 0x1ccde9a600000000, 0x02f9279400000000, 0xabf2aeda00000000, + 0x50ee350900000000, 0xf9e5bc4700000000, 0x6c86a96c00000000, + 0xc58d202200000000, 0x3e91bbf100000000, 0x979a32bf00000000, + 0x89aefc8d00000000, 0x20a575c300000000, 0xdbb9ee1000000000, + 0x72b2675e00000000, 0xdd20a92100000000, 0x742b206f00000000, + 0x8f37bbbc00000000, 0x263c32f200000000, 0x3808fcc000000000, + 0x9103758e00000000, 0x6a1fee5d00000000, 0xc314671300000000, + 0x5677723800000000, 0xff7cfb7600000000, 0x046060a500000000, + 0xad6be9eb00000000, 0xb35f27d900000000, 0x1a54ae9700000000, + 0xe148354400000000, 0x4843bc0a00000000, 0xcb8f1f1200000000, + 0x6284965c00000000, 0x99980d8f00000000, 0x309384c100000000, + 0x2ea74af300000000, 0x87acc3bd00000000, 0x7cb0586e00000000, + 0xd5bbd12000000000, 0x40d8c40b00000000, 0xe9d34d4500000000, + 0x12cfd69600000000, 0xbbc45fd800000000, 0xa5f091ea00000000, + 0x0cfb18a400000000, 0xf7e7837700000000, 0x5eec0a3900000000, + 0xa9c21e8800000000, 0x00c997c600000000, 0xfbd50c1500000000, + 0x52de855b00000000, 0x4cea4b6900000000, 0xe5e1c22700000000, + 0x1efd59f400000000, 0xb7f6d0ba00000000, 0x2295c59100000000, + 0x8b9e4cdf00000000, 0x7082d70c00000000, 0xd9895e4200000000, + 0xc7bd907000000000, 0x6eb6193e00000000, 0x95aa82ed00000000, + 0x3ca10ba300000000, 0xbf6da8bb00000000, 0x166621f500000000, + 0xed7aba2600000000, 0x4471336800000000, 0x5a45fd5a00000000, + 0xf34e741400000000, 0x0852efc700000000, 0xa159668900000000, + 0x343a73a200000000, 0x9d31faec00000000, 0x662d613f00000000, + 0xcf26e87100000000, 0xd112264300000000, 0x7819af0d00000000, + 0x830534de00000000, 0x2a0ebd9000000000, 0x859c73ef00000000, + 0x2c97faa100000000, 0xd78b617200000000, 0x7e80e83c00000000, + 0x60b4260e00000000, 0xc9bfaf4000000000, 0x32a3349300000000, + 0x9ba8bddd00000000, 0x0ecba8f600000000, 0xa7c021b800000000, + 0x5cdcba6b00000000, 0xf5d7332500000000, 0xebe3fd1700000000, + 0x42e8745900000000, 0xb9f4ef8a00000000, 0x10ff66c400000000, + 0x9333c5dc00000000, 0x3a384c9200000000, 0xc124d74100000000, + 0x682f5e0f00000000, 0x761b903d00000000, 0xdf10197300000000, + 0x240c82a000000000, 0x8d070bee00000000, 0x18641ec500000000, + 0xb16f978b00000000, 0x4a730c5800000000, 0xe378851600000000, + 0xfd4c4b2400000000, 0x5447c26a00000000, 0xaf5b59b900000000, + 0x0650d0f700000000}, + {0x0000000000000000, 0x479244af00000000, 0xcf22f88500000000, + 0x88b0bc2a00000000, 0xdf4381d000000000, 0x98d1c57f00000000, + 0x1061795500000000, 0x57f33dfa00000000, 0xff81737a00000000, + 0xb81337d500000000, 0x30a38bff00000000, 0x7731cf5000000000, + 0x20c2f2aa00000000, 0x6750b60500000000, 0xefe00a2f00000000, + 0xa8724e8000000000, 0xfe03e7f400000000, 0xb991a35b00000000, + 0x31211f7100000000, 0x76b35bde00000000, 0x2140662400000000, + 0x66d2228b00000000, 0xee629ea100000000, 0xa9f0da0e00000000, + 0x0182948e00000000, 0x4610d02100000000, 0xcea06c0b00000000, + 0x893228a400000000, 0xdec1155e00000000, 0x995351f100000000, + 0x11e3eddb00000000, 0x5671a97400000000, 0xbd01bf3200000000, + 0xfa93fb9d00000000, 0x722347b700000000, 0x35b1031800000000, + 0x62423ee200000000, 0x25d07a4d00000000, 0xad60c66700000000, + 0xeaf282c800000000, 0x4280cc4800000000, 0x051288e700000000, + 0x8da234cd00000000, 0xca30706200000000, 0x9dc34d9800000000, + 0xda51093700000000, 0x52e1b51d00000000, 0x1573f1b200000000, + 0x430258c600000000, 0x04901c6900000000, 0x8c20a04300000000, + 0xcbb2e4ec00000000, 0x9c41d91600000000, 0xdbd39db900000000, + 0x5363219300000000, 0x14f1653c00000000, 0xbc832bbc00000000, + 0xfb116f1300000000, 0x73a1d33900000000, 0x3433979600000000, + 0x63c0aa6c00000000, 0x2452eec300000000, 0xace252e900000000, + 0xeb70164600000000, 0x7a037e6500000000, 0x3d913aca00000000, + 0xb52186e000000000, 0xf2b3c24f00000000, 0xa540ffb500000000, + 0xe2d2bb1a00000000, 0x6a62073000000000, 0x2df0439f00000000, + 0x85820d1f00000000, 0xc21049b000000000, 0x4aa0f59a00000000, + 0x0d32b13500000000, 0x5ac18ccf00000000, 0x1d53c86000000000, + 0x95e3744a00000000, 0xd27130e500000000, 0x8400999100000000, + 0xc392dd3e00000000, 0x4b22611400000000, 0x0cb025bb00000000, + 0x5b43184100000000, 0x1cd15cee00000000, 0x9461e0c400000000, + 0xd3f3a46b00000000, 0x7b81eaeb00000000, 0x3c13ae4400000000, + 0xb4a3126e00000000, 0xf33156c100000000, 0xa4c26b3b00000000, + 0xe3502f9400000000, 0x6be093be00000000, 0x2c72d71100000000, + 0xc702c15700000000, 0x809085f800000000, 0x082039d200000000, + 0x4fb27d7d00000000, 0x1841408700000000, 0x5fd3042800000000, + 0xd763b80200000000, 0x90f1fcad00000000, 0x3883b22d00000000, + 0x7f11f68200000000, 0xf7a14aa800000000, 0xb0330e0700000000, + 0xe7c033fd00000000, 0xa052775200000000, 0x28e2cb7800000000, + 0x6f708fd700000000, 0x390126a300000000, 0x7e93620c00000000, + 0xf623de2600000000, 0xb1b19a8900000000, 0xe642a77300000000, + 0xa1d0e3dc00000000, 0x29605ff600000000, 0x6ef21b5900000000, + 0xc68055d900000000, 0x8112117600000000, 0x09a2ad5c00000000, + 0x4e30e9f300000000, 0x19c3d40900000000, 0x5e5190a600000000, + 0xd6e12c8c00000000, 0x9173682300000000, 0xf406fcca00000000, + 0xb394b86500000000, 0x3b24044f00000000, 0x7cb640e000000000, + 0x2b457d1a00000000, 0x6cd739b500000000, 0xe467859f00000000, + 0xa3f5c13000000000, 0x0b878fb000000000, 0x4c15cb1f00000000, + 0xc4a5773500000000, 0x8337339a00000000, 0xd4c40e6000000000, + 0x93564acf00000000, 0x1be6f6e500000000, 0x5c74b24a00000000, + 0x0a051b3e00000000, 0x4d975f9100000000, 0xc527e3bb00000000, + 0x82b5a71400000000, 0xd5469aee00000000, 0x92d4de4100000000, + 0x1a64626b00000000, 0x5df626c400000000, 0xf584684400000000, + 0xb2162ceb00000000, 0x3aa690c100000000, 0x7d34d46e00000000, + 0x2ac7e99400000000, 0x6d55ad3b00000000, 0xe5e5111100000000, + 0xa27755be00000000, 0x490743f800000000, 0x0e95075700000000, + 0x8625bb7d00000000, 0xc1b7ffd200000000, 0x9644c22800000000, + 0xd1d6868700000000, 0x59663aad00000000, 0x1ef47e0200000000, + 0xb686308200000000, 0xf114742d00000000, 0x79a4c80700000000, + 0x3e368ca800000000, 0x69c5b15200000000, 0x2e57f5fd00000000, + 0xa6e749d700000000, 0xe1750d7800000000, 0xb704a40c00000000, + 0xf096e0a300000000, 0x78265c8900000000, 0x3fb4182600000000, + 0x684725dc00000000, 0x2fd5617300000000, 0xa765dd5900000000, + 0xe0f799f600000000, 0x4885d77600000000, 0x0f1793d900000000, + 0x87a72ff300000000, 0xc0356b5c00000000, 0x97c656a600000000, + 0xd054120900000000, 0x58e4ae2300000000, 0x1f76ea8c00000000, + 0x8e0582af00000000, 0xc997c60000000000, 0x41277a2a00000000, + 0x06b53e8500000000, 0x5146037f00000000, 0x16d447d000000000, + 0x9e64fbfa00000000, 0xd9f6bf5500000000, 0x7184f1d500000000, + 0x3616b57a00000000, 0xbea6095000000000, 0xf9344dff00000000, + 0xaec7700500000000, 0xe95534aa00000000, 0x61e5888000000000, + 0x2677cc2f00000000, 0x7006655b00000000, 0x379421f400000000, + 0xbf249dde00000000, 0xf8b6d97100000000, 0xaf45e48b00000000, + 0xe8d7a02400000000, 0x60671c0e00000000, 0x27f558a100000000, + 0x8f87162100000000, 0xc815528e00000000, 0x40a5eea400000000, + 0x0737aa0b00000000, 0x50c497f100000000, 0x1756d35e00000000, + 0x9fe66f7400000000, 0xd8742bdb00000000, 0x33043d9d00000000, + 0x7496793200000000, 0xfc26c51800000000, 0xbbb481b700000000, + 0xec47bc4d00000000, 0xabd5f8e200000000, 0x236544c800000000, + 0x64f7006700000000, 0xcc854ee700000000, 0x8b170a4800000000, + 0x03a7b66200000000, 0x4435f2cd00000000, 0x13c6cf3700000000, + 0x54548b9800000000, 0xdce437b200000000, 0x9b76731d00000000, + 0xcd07da6900000000, 0x8a959ec600000000, 0x022522ec00000000, + 0x45b7664300000000, 0x12445bb900000000, 0x55d61f1600000000, + 0xdd66a33c00000000, 0x9af4e79300000000, 0x3286a91300000000, + 0x7514edbc00000000, 0xfda4519600000000, 0xba36153900000000, + 0xedc528c300000000, 0xaa576c6c00000000, 0x22e7d04600000000, + 0x657594e900000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x65673b46, 0xcace768c, 0xafa94dca, 0x4eedeb59, + 0x2b8ad01f, 0x84239dd5, 0xe144a693, 0x9ddbd6b2, 0xf8bcedf4, + 0x5715a03e, 0x32729b78, 0xd3363deb, 0xb65106ad, 0x19f84b67, + 0x7c9f7021, 0xe0c6ab25, 0x85a19063, 0x2a08dda9, 0x4f6fe6ef, + 0xae2b407c, 0xcb4c7b3a, 0x64e536f0, 0x01820db6, 0x7d1d7d97, + 0x187a46d1, 0xb7d30b1b, 0xd2b4305d, 0x33f096ce, 0x5697ad88, + 0xf93ee042, 0x9c59db04, 0x1afc500b, 0x7f9b6b4d, 0xd0322687, + 0xb5551dc1, 0x5411bb52, 0x31768014, 0x9edfcdde, 0xfbb8f698, + 0x872786b9, 0xe240bdff, 0x4de9f035, 0x288ecb73, 0xc9ca6de0, + 0xacad56a6, 0x03041b6c, 0x6663202a, 0xfa3afb2e, 0x9f5dc068, + 0x30f48da2, 0x5593b6e4, 0xb4d71077, 0xd1b02b31, 0x7e1966fb, + 0x1b7e5dbd, 0x67e12d9c, 0x028616da, 0xad2f5b10, 0xc8486056, + 0x290cc6c5, 0x4c6bfd83, 0xe3c2b049, 0x86a58b0f, 0x35f8a016, + 0x509f9b50, 0xff36d69a, 0x9a51eddc, 0x7b154b4f, 0x1e727009, + 0xb1db3dc3, 0xd4bc0685, 0xa82376a4, 0xcd444de2, 0x62ed0028, + 0x078a3b6e, 0xe6ce9dfd, 0x83a9a6bb, 0x2c00eb71, 0x4967d037, + 0xd53e0b33, 0xb0593075, 0x1ff07dbf, 0x7a9746f9, 0x9bd3e06a, + 0xfeb4db2c, 0x511d96e6, 0x347aada0, 0x48e5dd81, 0x2d82e6c7, + 0x822bab0d, 0xe74c904b, 0x060836d8, 0x636f0d9e, 0xccc64054, + 0xa9a17b12, 0x2f04f01d, 0x4a63cb5b, 0xe5ca8691, 0x80adbdd7, + 0x61e91b44, 0x048e2002, 0xab276dc8, 0xce40568e, 0xb2df26af, + 0xd7b81de9, 0x78115023, 0x1d766b65, 0xfc32cdf6, 0x9955f6b0, + 0x36fcbb7a, 0x539b803c, 0xcfc25b38, 0xaaa5607e, 0x050c2db4, + 0x606b16f2, 0x812fb061, 0xe4488b27, 0x4be1c6ed, 0x2e86fdab, + 0x52198d8a, 0x377eb6cc, 0x98d7fb06, 0xfdb0c040, 0x1cf466d3, + 0x79935d95, 0xd63a105f, 0xb35d2b19, 0x6bf1402c, 0x0e967b6a, + 0xa13f36a0, 0xc4580de6, 0x251cab75, 0x407b9033, 0xefd2ddf9, + 0x8ab5e6bf, 0xf62a969e, 0x934dadd8, 0x3ce4e012, 0x5983db54, + 0xb8c77dc7, 0xdda04681, 0x72090b4b, 0x176e300d, 0x8b37eb09, + 0xee50d04f, 0x41f99d85, 0x249ea6c3, 0xc5da0050, 0xa0bd3b16, + 0x0f1476dc, 0x6a734d9a, 0x16ec3dbb, 0x738b06fd, 0xdc224b37, + 0xb9457071, 0x5801d6e2, 0x3d66eda4, 0x92cfa06e, 0xf7a89b28, + 0x710d1027, 0x146a2b61, 0xbbc366ab, 0xdea45ded, 0x3fe0fb7e, + 0x5a87c038, 0xf52e8df2, 0x9049b6b4, 0xecd6c695, 0x89b1fdd3, + 0x2618b019, 0x437f8b5f, 0xa23b2dcc, 0xc75c168a, 0x68f55b40, + 0x0d926006, 0x91cbbb02, 0xf4ac8044, 0x5b05cd8e, 0x3e62f6c8, + 0xdf26505b, 0xba416b1d, 0x15e826d7, 0x708f1d91, 0x0c106db0, + 0x697756f6, 0xc6de1b3c, 0xa3b9207a, 0x42fd86e9, 0x279abdaf, + 0x8833f065, 0xed54cb23, 0x5e09e03a, 0x3b6edb7c, 0x94c796b6, + 0xf1a0adf0, 0x10e40b63, 0x75833025, 0xda2a7def, 0xbf4d46a9, + 0xc3d23688, 0xa6b50dce, 0x091c4004, 0x6c7b7b42, 0x8d3fddd1, + 0xe858e697, 0x47f1ab5d, 0x2296901b, 0xbecf4b1f, 0xdba87059, + 0x74013d93, 0x116606d5, 0xf022a046, 0x95459b00, 0x3aecd6ca, + 0x5f8bed8c, 0x23149dad, 0x4673a6eb, 0xe9daeb21, 0x8cbdd067, + 0x6df976f4, 0x089e4db2, 0xa7370078, 0xc2503b3e, 0x44f5b031, + 0x21928b77, 0x8e3bc6bd, 0xeb5cfdfb, 0x0a185b68, 0x6f7f602e, + 0xc0d62de4, 0xa5b116a2, 0xd92e6683, 0xbc495dc5, 0x13e0100f, + 0x76872b49, 0x97c38dda, 0xf2a4b69c, 0x5d0dfb56, 0x386ac010, + 0xa4331b14, 0xc1542052, 0x6efd6d98, 0x0b9a56de, 0xeadef04d, + 0x8fb9cb0b, 0x201086c1, 0x4577bd87, 0x39e8cda6, 0x5c8ff6e0, + 0xf326bb2a, 0x9641806c, 0x770526ff, 0x12621db9, 0xbdcb5073, + 0xd8ac6b35}, + {0x00000000, 0xd7e28058, 0x74b406f1, 0xa35686a9, 0xe9680de2, + 0x3e8a8dba, 0x9ddc0b13, 0x4a3e8b4b, 0x09a11d85, 0xde439ddd, + 0x7d151b74, 0xaaf79b2c, 0xe0c91067, 0x372b903f, 0x947d1696, + 0x439f96ce, 0x13423b0a, 0xc4a0bb52, 0x67f63dfb, 0xb014bda3, + 0xfa2a36e8, 0x2dc8b6b0, 0x8e9e3019, 0x597cb041, 0x1ae3268f, + 0xcd01a6d7, 0x6e57207e, 0xb9b5a026, 0xf38b2b6d, 0x2469ab35, + 0x873f2d9c, 0x50ddadc4, 0x26847614, 0xf166f64c, 0x523070e5, + 0x85d2f0bd, 0xcfec7bf6, 0x180efbae, 0xbb587d07, 0x6cbafd5f, + 0x2f256b91, 0xf8c7ebc9, 0x5b916d60, 0x8c73ed38, 0xc64d6673, + 0x11afe62b, 0xb2f96082, 0x651be0da, 0x35c64d1e, 0xe224cd46, + 0x41724bef, 0x9690cbb7, 0xdcae40fc, 0x0b4cc0a4, 0xa81a460d, + 0x7ff8c655, 0x3c67509b, 0xeb85d0c3, 0x48d3566a, 0x9f31d632, + 0xd50f5d79, 0x02eddd21, 0xa1bb5b88, 0x7659dbd0, 0x4d08ec28, + 0x9aea6c70, 0x39bcead9, 0xee5e6a81, 0xa460e1ca, 0x73826192, + 0xd0d4e73b, 0x07366763, 0x44a9f1ad, 0x934b71f5, 0x301df75c, + 0xe7ff7704, 0xadc1fc4f, 0x7a237c17, 0xd975fabe, 0x0e977ae6, + 0x5e4ad722, 0x89a8577a, 0x2afed1d3, 0xfd1c518b, 0xb722dac0, + 0x60c05a98, 0xc396dc31, 0x14745c69, 0x57ebcaa7, 0x80094aff, + 0x235fcc56, 0xf4bd4c0e, 0xbe83c745, 0x6961471d, 0xca37c1b4, + 0x1dd541ec, 0x6b8c9a3c, 0xbc6e1a64, 0x1f389ccd, 0xc8da1c95, + 0x82e497de, 0x55061786, 0xf650912f, 0x21b21177, 0x622d87b9, + 0xb5cf07e1, 0x16998148, 0xc17b0110, 0x8b458a5b, 0x5ca70a03, + 0xfff18caa, 0x28130cf2, 0x78cea136, 0xaf2c216e, 0x0c7aa7c7, + 0xdb98279f, 0x91a6acd4, 0x46442c8c, 0xe512aa25, 0x32f02a7d, + 0x716fbcb3, 0xa68d3ceb, 0x05dbba42, 0xd2393a1a, 0x9807b151, + 0x4fe53109, 0xecb3b7a0, 0x3b5137f8, 0x9a11d850, 0x4df35808, + 0xeea5dea1, 0x39475ef9, 0x7379d5b2, 0xa49b55ea, 0x07cdd343, + 0xd02f531b, 0x93b0c5d5, 0x4452458d, 0xe704c324, 0x30e6437c, + 0x7ad8c837, 0xad3a486f, 0x0e6ccec6, 0xd98e4e9e, 0x8953e35a, + 0x5eb16302, 0xfde7e5ab, 0x2a0565f3, 0x603beeb8, 0xb7d96ee0, + 0x148fe849, 0xc36d6811, 0x80f2fedf, 0x57107e87, 0xf446f82e, + 0x23a47876, 0x699af33d, 0xbe787365, 0x1d2ef5cc, 0xcacc7594, + 0xbc95ae44, 0x6b772e1c, 0xc821a8b5, 0x1fc328ed, 0x55fda3a6, + 0x821f23fe, 0x2149a557, 0xf6ab250f, 0xb534b3c1, 0x62d63399, + 0xc180b530, 0x16623568, 0x5c5cbe23, 0x8bbe3e7b, 0x28e8b8d2, + 0xff0a388a, 0xafd7954e, 0x78351516, 0xdb6393bf, 0x0c8113e7, + 0x46bf98ac, 0x915d18f4, 0x320b9e5d, 0xe5e91e05, 0xa67688cb, + 0x71940893, 0xd2c28e3a, 0x05200e62, 0x4f1e8529, 0x98fc0571, + 0x3baa83d8, 0xec480380, 0xd7193478, 0x00fbb420, 0xa3ad3289, + 0x744fb2d1, 0x3e71399a, 0xe993b9c2, 0x4ac53f6b, 0x9d27bf33, + 0xdeb829fd, 0x095aa9a5, 0xaa0c2f0c, 0x7deeaf54, 0x37d0241f, + 0xe032a447, 0x436422ee, 0x9486a2b6, 0xc45b0f72, 0x13b98f2a, + 0xb0ef0983, 0x670d89db, 0x2d330290, 0xfad182c8, 0x59870461, + 0x8e658439, 0xcdfa12f7, 0x1a1892af, 0xb94e1406, 0x6eac945e, + 0x24921f15, 0xf3709f4d, 0x502619e4, 0x87c499bc, 0xf19d426c, + 0x267fc234, 0x8529449d, 0x52cbc4c5, 0x18f54f8e, 0xcf17cfd6, + 0x6c41497f, 0xbba3c927, 0xf83c5fe9, 0x2fdedfb1, 0x8c885918, + 0x5b6ad940, 0x1154520b, 0xc6b6d253, 0x65e054fa, 0xb202d4a2, + 0xe2df7966, 0x353df93e, 0x966b7f97, 0x4189ffcf, 0x0bb77484, + 0xdc55f4dc, 0x7f037275, 0xa8e1f22d, 0xeb7e64e3, 0x3c9ce4bb, + 0x9fca6212, 0x4828e24a, 0x02166901, 0xd5f4e959, 0x76a26ff0, + 0xa140efa8}, + {0x00000000, 0xef52b6e1, 0x05d46b83, 0xea86dd62, 0x0ba8d706, + 0xe4fa61e7, 0x0e7cbc85, 0xe12e0a64, 0x1751ae0c, 0xf80318ed, + 0x1285c58f, 0xfdd7736e, 0x1cf9790a, 0xf3abcfeb, 0x192d1289, + 0xf67fa468, 0x2ea35c18, 0xc1f1eaf9, 0x2b77379b, 0xc425817a, + 0x250b8b1e, 0xca593dff, 0x20dfe09d, 0xcf8d567c, 0x39f2f214, + 0xd6a044f5, 0x3c269997, 0xd3742f76, 0x325a2512, 0xdd0893f3, + 0x378e4e91, 0xd8dcf870, 0x5d46b830, 0xb2140ed1, 0x5892d3b3, + 0xb7c06552, 0x56ee6f36, 0xb9bcd9d7, 0x533a04b5, 0xbc68b254, + 0x4a17163c, 0xa545a0dd, 0x4fc37dbf, 0xa091cb5e, 0x41bfc13a, + 0xaeed77db, 0x446baab9, 0xab391c58, 0x73e5e428, 0x9cb752c9, + 0x76318fab, 0x9963394a, 0x784d332e, 0x971f85cf, 0x7d9958ad, + 0x92cbee4c, 0x64b44a24, 0x8be6fcc5, 0x616021a7, 0x8e329746, + 0x6f1c9d22, 0x804e2bc3, 0x6ac8f6a1, 0x859a4040, 0xba8d7060, + 0x55dfc681, 0xbf591be3, 0x500bad02, 0xb125a766, 0x5e771187, + 0xb4f1cce5, 0x5ba37a04, 0xaddcde6c, 0x428e688d, 0xa808b5ef, + 0x475a030e, 0xa674096a, 0x4926bf8b, 0xa3a062e9, 0x4cf2d408, + 0x942e2c78, 0x7b7c9a99, 0x91fa47fb, 0x7ea8f11a, 0x9f86fb7e, + 0x70d44d9f, 0x9a5290fd, 0x7500261c, 0x837f8274, 0x6c2d3495, + 0x86abe9f7, 0x69f95f16, 0x88d75572, 0x6785e393, 0x8d033ef1, + 0x62518810, 0xe7cbc850, 0x08997eb1, 0xe21fa3d3, 0x0d4d1532, + 0xec631f56, 0x0331a9b7, 0xe9b774d5, 0x06e5c234, 0xf09a665c, + 0x1fc8d0bd, 0xf54e0ddf, 0x1a1cbb3e, 0xfb32b15a, 0x146007bb, + 0xfee6dad9, 0x11b46c38, 0xc9689448, 0x263a22a9, 0xccbcffcb, + 0x23ee492a, 0xc2c0434e, 0x2d92f5af, 0xc71428cd, 0x28469e2c, + 0xde393a44, 0x316b8ca5, 0xdbed51c7, 0x34bfe726, 0xd591ed42, + 0x3ac35ba3, 0xd04586c1, 0x3f173020, 0xae6be681, 0x41395060, + 0xabbf8d02, 0x44ed3be3, 0xa5c33187, 0x4a918766, 0xa0175a04, + 0x4f45ece5, 0xb93a488d, 0x5668fe6c, 0xbcee230e, 0x53bc95ef, + 0xb2929f8b, 0x5dc0296a, 0xb746f408, 0x581442e9, 0x80c8ba99, + 0x6f9a0c78, 0x851cd11a, 0x6a4e67fb, 0x8b606d9f, 0x6432db7e, + 0x8eb4061c, 0x61e6b0fd, 0x97991495, 0x78cba274, 0x924d7f16, + 0x7d1fc9f7, 0x9c31c393, 0x73637572, 0x99e5a810, 0x76b71ef1, + 0xf32d5eb1, 0x1c7fe850, 0xf6f93532, 0x19ab83d3, 0xf88589b7, + 0x17d73f56, 0xfd51e234, 0x120354d5, 0xe47cf0bd, 0x0b2e465c, + 0xe1a89b3e, 0x0efa2ddf, 0xefd427bb, 0x0086915a, 0xea004c38, + 0x0552fad9, 0xdd8e02a9, 0x32dcb448, 0xd85a692a, 0x3708dfcb, + 0xd626d5af, 0x3974634e, 0xd3f2be2c, 0x3ca008cd, 0xcadfaca5, + 0x258d1a44, 0xcf0bc726, 0x205971c7, 0xc1777ba3, 0x2e25cd42, + 0xc4a31020, 0x2bf1a6c1, 0x14e696e1, 0xfbb42000, 0x1132fd62, + 0xfe604b83, 0x1f4e41e7, 0xf01cf706, 0x1a9a2a64, 0xf5c89c85, + 0x03b738ed, 0xece58e0c, 0x0663536e, 0xe931e58f, 0x081fefeb, + 0xe74d590a, 0x0dcb8468, 0xe2993289, 0x3a45caf9, 0xd5177c18, + 0x3f91a17a, 0xd0c3179b, 0x31ed1dff, 0xdebfab1e, 0x3439767c, + 0xdb6bc09d, 0x2d1464f5, 0xc246d214, 0x28c00f76, 0xc792b997, + 0x26bcb3f3, 0xc9ee0512, 0x2368d870, 0xcc3a6e91, 0x49a02ed1, + 0xa6f29830, 0x4c744552, 0xa326f3b3, 0x4208f9d7, 0xad5a4f36, + 0x47dc9254, 0xa88e24b5, 0x5ef180dd, 0xb1a3363c, 0x5b25eb5e, + 0xb4775dbf, 0x555957db, 0xba0be13a, 0x508d3c58, 0xbfdf8ab9, + 0x670372c9, 0x8851c428, 0x62d7194a, 0x8d85afab, 0x6caba5cf, + 0x83f9132e, 0x697fce4c, 0x862d78ad, 0x7052dcc5, 0x9f006a24, + 0x7586b746, 0x9ad401a7, 0x7bfa0bc3, 0x94a8bd22, 0x7e2e6040, + 0x917cd6a1}, + {0x00000000, 0x87a6cb43, 0xd43c90c7, 0x539a5b84, 0x730827cf, + 0xf4aeec8c, 0xa734b708, 0x20927c4b, 0xe6104f9e, 0x61b684dd, + 0x322cdf59, 0xb58a141a, 0x95186851, 0x12bea312, 0x4124f896, + 0xc68233d5, 0x1751997d, 0x90f7523e, 0xc36d09ba, 0x44cbc2f9, + 0x6459beb2, 0xe3ff75f1, 0xb0652e75, 0x37c3e536, 0xf141d6e3, + 0x76e71da0, 0x257d4624, 0xa2db8d67, 0x8249f12c, 0x05ef3a6f, + 0x567561eb, 0xd1d3aaa8, 0x2ea332fa, 0xa905f9b9, 0xfa9fa23d, + 0x7d39697e, 0x5dab1535, 0xda0dde76, 0x899785f2, 0x0e314eb1, + 0xc8b37d64, 0x4f15b627, 0x1c8feda3, 0x9b2926e0, 0xbbbb5aab, + 0x3c1d91e8, 0x6f87ca6c, 0xe821012f, 0x39f2ab87, 0xbe5460c4, + 0xedce3b40, 0x6a68f003, 0x4afa8c48, 0xcd5c470b, 0x9ec61c8f, + 0x1960d7cc, 0xdfe2e419, 0x58442f5a, 0x0bde74de, 0x8c78bf9d, + 0xaceac3d6, 0x2b4c0895, 0x78d65311, 0xff709852, 0x5d4665f4, + 0xdae0aeb7, 0x897af533, 0x0edc3e70, 0x2e4e423b, 0xa9e88978, + 0xfa72d2fc, 0x7dd419bf, 0xbb562a6a, 0x3cf0e129, 0x6f6abaad, + 0xe8cc71ee, 0xc85e0da5, 0x4ff8c6e6, 0x1c629d62, 0x9bc45621, + 0x4a17fc89, 0xcdb137ca, 0x9e2b6c4e, 0x198da70d, 0x391fdb46, + 0xbeb91005, 0xed234b81, 0x6a8580c2, 0xac07b317, 0x2ba17854, + 0x783b23d0, 0xff9de893, 0xdf0f94d8, 0x58a95f9b, 0x0b33041f, + 0x8c95cf5c, 0x73e5570e, 0xf4439c4d, 0xa7d9c7c9, 0x207f0c8a, + 0x00ed70c1, 0x874bbb82, 0xd4d1e006, 0x53772b45, 0x95f51890, + 0x1253d3d3, 0x41c98857, 0xc66f4314, 0xe6fd3f5f, 0x615bf41c, + 0x32c1af98, 0xb56764db, 0x64b4ce73, 0xe3120530, 0xb0885eb4, + 0x372e95f7, 0x17bce9bc, 0x901a22ff, 0xc380797b, 0x4426b238, + 0x82a481ed, 0x05024aae, 0x5698112a, 0xd13eda69, 0xf1aca622, + 0x760a6d61, 0x259036e5, 0xa236fda6, 0xba8ccbe8, 0x3d2a00ab, + 0x6eb05b2f, 0xe916906c, 0xc984ec27, 0x4e222764, 0x1db87ce0, + 0x9a1eb7a3, 0x5c9c8476, 0xdb3a4f35, 0x88a014b1, 0x0f06dff2, + 0x2f94a3b9, 0xa83268fa, 0xfba8337e, 0x7c0ef83d, 0xaddd5295, + 0x2a7b99d6, 0x79e1c252, 0xfe470911, 0xded5755a, 0x5973be19, + 0x0ae9e59d, 0x8d4f2ede, 0x4bcd1d0b, 0xcc6bd648, 0x9ff18dcc, + 0x1857468f, 0x38c53ac4, 0xbf63f187, 0xecf9aa03, 0x6b5f6140, + 0x942ff912, 0x13893251, 0x401369d5, 0xc7b5a296, 0xe727dedd, + 0x6081159e, 0x331b4e1a, 0xb4bd8559, 0x723fb68c, 0xf5997dcf, + 0xa603264b, 0x21a5ed08, 0x01379143, 0x86915a00, 0xd50b0184, + 0x52adcac7, 0x837e606f, 0x04d8ab2c, 0x5742f0a8, 0xd0e43beb, + 0xf07647a0, 0x77d08ce3, 0x244ad767, 0xa3ec1c24, 0x656e2ff1, + 0xe2c8e4b2, 0xb152bf36, 0x36f47475, 0x1666083e, 0x91c0c37d, + 0xc25a98f9, 0x45fc53ba, 0xe7caae1c, 0x606c655f, 0x33f63edb, + 0xb450f598, 0x94c289d3, 0x13644290, 0x40fe1914, 0xc758d257, + 0x01dae182, 0x867c2ac1, 0xd5e67145, 0x5240ba06, 0x72d2c64d, + 0xf5740d0e, 0xa6ee568a, 0x21489dc9, 0xf09b3761, 0x773dfc22, + 0x24a7a7a6, 0xa3016ce5, 0x839310ae, 0x0435dbed, 0x57af8069, + 0xd0094b2a, 0x168b78ff, 0x912db3bc, 0xc2b7e838, 0x4511237b, + 0x65835f30, 0xe2259473, 0xb1bfcff7, 0x361904b4, 0xc9699ce6, + 0x4ecf57a5, 0x1d550c21, 0x9af3c762, 0xba61bb29, 0x3dc7706a, + 0x6e5d2bee, 0xe9fbe0ad, 0x2f79d378, 0xa8df183b, 0xfb4543bf, + 0x7ce388fc, 0x5c71f4b7, 0xdbd73ff4, 0x884d6470, 0x0febaf33, + 0xde38059b, 0x599eced8, 0x0a04955c, 0x8da25e1f, 0xad302254, + 0x2a96e917, 0x790cb293, 0xfeaa79d0, 0x38284a05, 0xbf8e8146, + 0xec14dac2, 0x6bb21181, 0x4b206dca, 0xcc86a689, 0x9f1cfd0d, + 0x18ba364e}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x43cba687, 0xc7903cd4, 0x845b9a53, 0xcf270873, + 0x8cecaef4, 0x08b734a7, 0x4b7c9220, 0x9e4f10e6, 0xdd84b661, + 0x59df2c32, 0x1a148ab5, 0x51681895, 0x12a3be12, 0x96f82441, + 0xd53382c6, 0x7d995117, 0x3e52f790, 0xba096dc3, 0xf9c2cb44, + 0xb2be5964, 0xf175ffe3, 0x752e65b0, 0x36e5c337, 0xe3d641f1, + 0xa01de776, 0x24467d25, 0x678ddba2, 0x2cf14982, 0x6f3aef05, + 0xeb617556, 0xa8aad3d1, 0xfa32a32e, 0xb9f905a9, 0x3da29ffa, + 0x7e69397d, 0x3515ab5d, 0x76de0dda, 0xf2859789, 0xb14e310e, + 0x647db3c8, 0x27b6154f, 0xa3ed8f1c, 0xe026299b, 0xab5abbbb, + 0xe8911d3c, 0x6cca876f, 0x2f0121e8, 0x87abf239, 0xc46054be, + 0x403bceed, 0x03f0686a, 0x488cfa4a, 0x0b475ccd, 0x8f1cc69e, + 0xccd76019, 0x19e4e2df, 0x5a2f4458, 0xde74de0b, 0x9dbf788c, + 0xd6c3eaac, 0x95084c2b, 0x1153d678, 0x529870ff, 0xf465465d, + 0xb7aee0da, 0x33f57a89, 0x703edc0e, 0x3b424e2e, 0x7889e8a9, + 0xfcd272fa, 0xbf19d47d, 0x6a2a56bb, 0x29e1f03c, 0xadba6a6f, + 0xee71cce8, 0xa50d5ec8, 0xe6c6f84f, 0x629d621c, 0x2156c49b, + 0x89fc174a, 0xca37b1cd, 0x4e6c2b9e, 0x0da78d19, 0x46db1f39, + 0x0510b9be, 0x814b23ed, 0xc280856a, 0x17b307ac, 0x5478a12b, + 0xd0233b78, 0x93e89dff, 0xd8940fdf, 0x9b5fa958, 0x1f04330b, + 0x5ccf958c, 0x0e57e573, 0x4d9c43f4, 0xc9c7d9a7, 0x8a0c7f20, + 0xc170ed00, 0x82bb4b87, 0x06e0d1d4, 0x452b7753, 0x9018f595, + 0xd3d35312, 0x5788c941, 0x14436fc6, 0x5f3ffde6, 0x1cf45b61, + 0x98afc132, 0xdb6467b5, 0x73ceb464, 0x300512e3, 0xb45e88b0, + 0xf7952e37, 0xbce9bc17, 0xff221a90, 0x7b7980c3, 0x38b22644, + 0xed81a482, 0xae4a0205, 0x2a119856, 0x69da3ed1, 0x22a6acf1, + 0x616d0a76, 0xe5369025, 0xa6fd36a2, 0xe8cb8cba, 0xab002a3d, + 0x2f5bb06e, 0x6c9016e9, 0x27ec84c9, 0x6427224e, 0xe07cb81d, + 0xa3b71e9a, 0x76849c5c, 0x354f3adb, 0xb114a088, 0xf2df060f, + 0xb9a3942f, 0xfa6832a8, 0x7e33a8fb, 0x3df80e7c, 0x9552ddad, + 0xd6997b2a, 0x52c2e179, 0x110947fe, 0x5a75d5de, 0x19be7359, + 0x9de5e90a, 0xde2e4f8d, 0x0b1dcd4b, 0x48d66bcc, 0xcc8df19f, + 0x8f465718, 0xc43ac538, 0x87f163bf, 0x03aaf9ec, 0x40615f6b, + 0x12f92f94, 0x51328913, 0xd5691340, 0x96a2b5c7, 0xddde27e7, + 0x9e158160, 0x1a4e1b33, 0x5985bdb4, 0x8cb63f72, 0xcf7d99f5, + 0x4b2603a6, 0x08eda521, 0x43913701, 0x005a9186, 0x84010bd5, + 0xc7caad52, 0x6f607e83, 0x2cabd804, 0xa8f04257, 0xeb3be4d0, + 0xa04776f0, 0xe38cd077, 0x67d74a24, 0x241ceca3, 0xf12f6e65, + 0xb2e4c8e2, 0x36bf52b1, 0x7574f436, 0x3e086616, 0x7dc3c091, + 0xf9985ac2, 0xba53fc45, 0x1caecae7, 0x5f656c60, 0xdb3ef633, + 0x98f550b4, 0xd389c294, 0x90426413, 0x1419fe40, 0x57d258c7, + 0x82e1da01, 0xc12a7c86, 0x4571e6d5, 0x06ba4052, 0x4dc6d272, + 0x0e0d74f5, 0x8a56eea6, 0xc99d4821, 0x61379bf0, 0x22fc3d77, + 0xa6a7a724, 0xe56c01a3, 0xae109383, 0xeddb3504, 0x6980af57, + 0x2a4b09d0, 0xff788b16, 0xbcb32d91, 0x38e8b7c2, 0x7b231145, + 0x305f8365, 0x739425e2, 0xf7cfbfb1, 0xb4041936, 0xe69c69c9, + 0xa557cf4e, 0x210c551d, 0x62c7f39a, 0x29bb61ba, 0x6a70c73d, + 0xee2b5d6e, 0xade0fbe9, 0x78d3792f, 0x3b18dfa8, 0xbf4345fb, + 0xfc88e37c, 0xb7f4715c, 0xf43fd7db, 0x70644d88, 0x33afeb0f, + 0x9b0538de, 0xd8ce9e59, 0x5c95040a, 0x1f5ea28d, 0x542230ad, + 0x17e9962a, 0x93b20c79, 0xd079aafe, 0x054a2838, 0x46818ebf, + 0xc2da14ec, 0x8111b26b, 0xca6d204b, 0x89a686cc, 0x0dfd1c9f, + 0x4e36ba18}, + {0x00000000, 0xe1b652ef, 0x836bd405, 0x62dd86ea, 0x06d7a80b, + 0xe761fae4, 0x85bc7c0e, 0x640a2ee1, 0x0cae5117, 0xed1803f8, + 0x8fc58512, 0x6e73d7fd, 0x0a79f91c, 0xebcfabf3, 0x89122d19, + 0x68a47ff6, 0x185ca32e, 0xf9eaf1c1, 0x9b37772b, 0x7a8125c4, + 0x1e8b0b25, 0xff3d59ca, 0x9de0df20, 0x7c568dcf, 0x14f2f239, + 0xf544a0d6, 0x9799263c, 0x762f74d3, 0x12255a32, 0xf39308dd, + 0x914e8e37, 0x70f8dcd8, 0x30b8465d, 0xd10e14b2, 0xb3d39258, + 0x5265c0b7, 0x366fee56, 0xd7d9bcb9, 0xb5043a53, 0x54b268bc, + 0x3c16174a, 0xdda045a5, 0xbf7dc34f, 0x5ecb91a0, 0x3ac1bf41, + 0xdb77edae, 0xb9aa6b44, 0x581c39ab, 0x28e4e573, 0xc952b79c, + 0xab8f3176, 0x4a396399, 0x2e334d78, 0xcf851f97, 0xad58997d, + 0x4ceecb92, 0x244ab464, 0xc5fce68b, 0xa7216061, 0x4697328e, + 0x229d1c6f, 0xc32b4e80, 0xa1f6c86a, 0x40409a85, 0x60708dba, + 0x81c6df55, 0xe31b59bf, 0x02ad0b50, 0x66a725b1, 0x8711775e, + 0xe5ccf1b4, 0x047aa35b, 0x6cdedcad, 0x8d688e42, 0xefb508a8, + 0x0e035a47, 0x6a0974a6, 0x8bbf2649, 0xe962a0a3, 0x08d4f24c, + 0x782c2e94, 0x999a7c7b, 0xfb47fa91, 0x1af1a87e, 0x7efb869f, + 0x9f4dd470, 0xfd90529a, 0x1c260075, 0x74827f83, 0x95342d6c, + 0xf7e9ab86, 0x165ff969, 0x7255d788, 0x93e38567, 0xf13e038d, + 0x10885162, 0x50c8cbe7, 0xb17e9908, 0xd3a31fe2, 0x32154d0d, + 0x561f63ec, 0xb7a93103, 0xd574b7e9, 0x34c2e506, 0x5c669af0, + 0xbdd0c81f, 0xdf0d4ef5, 0x3ebb1c1a, 0x5ab132fb, 0xbb076014, + 0xd9dae6fe, 0x386cb411, 0x489468c9, 0xa9223a26, 0xcbffbccc, + 0x2a49ee23, 0x4e43c0c2, 0xaff5922d, 0xcd2814c7, 0x2c9e4628, + 0x443a39de, 0xa58c6b31, 0xc751eddb, 0x26e7bf34, 0x42ed91d5, + 0xa35bc33a, 0xc18645d0, 0x2030173f, 0x81e66bae, 0x60503941, + 0x028dbfab, 0xe33bed44, 0x8731c3a5, 0x6687914a, 0x045a17a0, + 0xe5ec454f, 0x8d483ab9, 0x6cfe6856, 0x0e23eebc, 0xef95bc53, + 0x8b9f92b2, 0x6a29c05d, 0x08f446b7, 0xe9421458, 0x99bac880, + 0x780c9a6f, 0x1ad11c85, 0xfb674e6a, 0x9f6d608b, 0x7edb3264, + 0x1c06b48e, 0xfdb0e661, 0x95149997, 0x74a2cb78, 0x167f4d92, + 0xf7c91f7d, 0x93c3319c, 0x72756373, 0x10a8e599, 0xf11eb776, + 0xb15e2df3, 0x50e87f1c, 0x3235f9f6, 0xd383ab19, 0xb78985f8, + 0x563fd717, 0x34e251fd, 0xd5540312, 0xbdf07ce4, 0x5c462e0b, + 0x3e9ba8e1, 0xdf2dfa0e, 0xbb27d4ef, 0x5a918600, 0x384c00ea, + 0xd9fa5205, 0xa9028edd, 0x48b4dc32, 0x2a695ad8, 0xcbdf0837, + 0xafd526d6, 0x4e637439, 0x2cbef2d3, 0xcd08a03c, 0xa5acdfca, + 0x441a8d25, 0x26c70bcf, 0xc7715920, 0xa37b77c1, 0x42cd252e, + 0x2010a3c4, 0xc1a6f12b, 0xe196e614, 0x0020b4fb, 0x62fd3211, + 0x834b60fe, 0xe7414e1f, 0x06f71cf0, 0x642a9a1a, 0x859cc8f5, + 0xed38b703, 0x0c8ee5ec, 0x6e536306, 0x8fe531e9, 0xebef1f08, + 0x0a594de7, 0x6884cb0d, 0x893299e2, 0xf9ca453a, 0x187c17d5, + 0x7aa1913f, 0x9b17c3d0, 0xff1ded31, 0x1eabbfde, 0x7c763934, + 0x9dc06bdb, 0xf564142d, 0x14d246c2, 0x760fc028, 0x97b992c7, + 0xf3b3bc26, 0x1205eec9, 0x70d86823, 0x916e3acc, 0xd12ea049, + 0x3098f2a6, 0x5245744c, 0xb3f326a3, 0xd7f90842, 0x364f5aad, + 0x5492dc47, 0xb5248ea8, 0xdd80f15e, 0x3c36a3b1, 0x5eeb255b, + 0xbf5d77b4, 0xdb575955, 0x3ae10bba, 0x583c8d50, 0xb98adfbf, + 0xc9720367, 0x28c45188, 0x4a19d762, 0xabaf858d, 0xcfa5ab6c, + 0x2e13f983, 0x4cce7f69, 0xad782d86, 0xc5dc5270, 0x246a009f, + 0x46b78675, 0xa701d49a, 0xc30bfa7b, 0x22bda894, 0x40602e7e, + 0xa1d67c91}, + {0x00000000, 0x5880e2d7, 0xf106b474, 0xa98656a3, 0xe20d68e9, + 0xba8d8a3e, 0x130bdc9d, 0x4b8b3e4a, 0x851da109, 0xdd9d43de, + 0x741b157d, 0x2c9bf7aa, 0x6710c9e0, 0x3f902b37, 0x96167d94, + 0xce969f43, 0x0a3b4213, 0x52bba0c4, 0xfb3df667, 0xa3bd14b0, + 0xe8362afa, 0xb0b6c82d, 0x19309e8e, 0x41b07c59, 0x8f26e31a, + 0xd7a601cd, 0x7e20576e, 0x26a0b5b9, 0x6d2b8bf3, 0x35ab6924, + 0x9c2d3f87, 0xc4addd50, 0x14768426, 0x4cf666f1, 0xe5703052, + 0xbdf0d285, 0xf67beccf, 0xaefb0e18, 0x077d58bb, 0x5ffdba6c, + 0x916b252f, 0xc9ebc7f8, 0x606d915b, 0x38ed738c, 0x73664dc6, + 0x2be6af11, 0x8260f9b2, 0xdae01b65, 0x1e4dc635, 0x46cd24e2, + 0xef4b7241, 0xb7cb9096, 0xfc40aedc, 0xa4c04c0b, 0x0d461aa8, + 0x55c6f87f, 0x9b50673c, 0xc3d085eb, 0x6a56d348, 0x32d6319f, + 0x795d0fd5, 0x21dded02, 0x885bbba1, 0xd0db5976, 0x28ec084d, + 0x706cea9a, 0xd9eabc39, 0x816a5eee, 0xcae160a4, 0x92618273, + 0x3be7d4d0, 0x63673607, 0xadf1a944, 0xf5714b93, 0x5cf71d30, + 0x0477ffe7, 0x4ffcc1ad, 0x177c237a, 0xbefa75d9, 0xe67a970e, + 0x22d74a5e, 0x7a57a889, 0xd3d1fe2a, 0x8b511cfd, 0xc0da22b7, + 0x985ac060, 0x31dc96c3, 0x695c7414, 0xa7caeb57, 0xff4a0980, + 0x56cc5f23, 0x0e4cbdf4, 0x45c783be, 0x1d476169, 0xb4c137ca, + 0xec41d51d, 0x3c9a8c6b, 0x641a6ebc, 0xcd9c381f, 0x951cdac8, + 0xde97e482, 0x86170655, 0x2f9150f6, 0x7711b221, 0xb9872d62, + 0xe107cfb5, 0x48819916, 0x10017bc1, 0x5b8a458b, 0x030aa75c, + 0xaa8cf1ff, 0xf20c1328, 0x36a1ce78, 0x6e212caf, 0xc7a77a0c, + 0x9f2798db, 0xd4aca691, 0x8c2c4446, 0x25aa12e5, 0x7d2af032, + 0xb3bc6f71, 0xeb3c8da6, 0x42badb05, 0x1a3a39d2, 0x51b10798, + 0x0931e54f, 0xa0b7b3ec, 0xf837513b, 0x50d8119a, 0x0858f34d, + 0xa1dea5ee, 0xf95e4739, 0xb2d57973, 0xea559ba4, 0x43d3cd07, + 0x1b532fd0, 0xd5c5b093, 0x8d455244, 0x24c304e7, 0x7c43e630, + 0x37c8d87a, 0x6f483aad, 0xc6ce6c0e, 0x9e4e8ed9, 0x5ae35389, + 0x0263b15e, 0xabe5e7fd, 0xf365052a, 0xb8ee3b60, 0xe06ed9b7, + 0x49e88f14, 0x11686dc3, 0xdffef280, 0x877e1057, 0x2ef846f4, + 0x7678a423, 0x3df39a69, 0x657378be, 0xccf52e1d, 0x9475ccca, + 0x44ae95bc, 0x1c2e776b, 0xb5a821c8, 0xed28c31f, 0xa6a3fd55, + 0xfe231f82, 0x57a54921, 0x0f25abf6, 0xc1b334b5, 0x9933d662, + 0x30b580c1, 0x68356216, 0x23be5c5c, 0x7b3ebe8b, 0xd2b8e828, + 0x8a380aff, 0x4e95d7af, 0x16153578, 0xbf9363db, 0xe713810c, + 0xac98bf46, 0xf4185d91, 0x5d9e0b32, 0x051ee9e5, 0xcb8876a6, + 0x93089471, 0x3a8ec2d2, 0x620e2005, 0x29851e4f, 0x7105fc98, + 0xd883aa3b, 0x800348ec, 0x783419d7, 0x20b4fb00, 0x8932ada3, + 0xd1b24f74, 0x9a39713e, 0xc2b993e9, 0x6b3fc54a, 0x33bf279d, + 0xfd29b8de, 0xa5a95a09, 0x0c2f0caa, 0x54afee7d, 0x1f24d037, + 0x47a432e0, 0xee226443, 0xb6a28694, 0x720f5bc4, 0x2a8fb913, + 0x8309efb0, 0xdb890d67, 0x9002332d, 0xc882d1fa, 0x61048759, + 0x3984658e, 0xf712facd, 0xaf92181a, 0x06144eb9, 0x5e94ac6e, + 0x151f9224, 0x4d9f70f3, 0xe4192650, 0xbc99c487, 0x6c429df1, + 0x34c27f26, 0x9d442985, 0xc5c4cb52, 0x8e4ff518, 0xd6cf17cf, + 0x7f49416c, 0x27c9a3bb, 0xe95f3cf8, 0xb1dfde2f, 0x1859888c, + 0x40d96a5b, 0x0b525411, 0x53d2b6c6, 0xfa54e065, 0xa2d402b2, + 0x6679dfe2, 0x3ef93d35, 0x977f6b96, 0xcfff8941, 0x8474b70b, + 0xdcf455dc, 0x7572037f, 0x2df2e1a8, 0xe3647eeb, 0xbbe49c3c, + 0x1262ca9f, 0x4ae22848, 0x01691602, 0x59e9f4d5, 0xf06fa276, + 0xa8ef40a1}, + {0x00000000, 0x463b6765, 0x8c76ceca, 0xca4da9af, 0x59ebed4e, + 0x1fd08a2b, 0xd59d2384, 0x93a644e1, 0xb2d6db9d, 0xf4edbcf8, + 0x3ea01557, 0x789b7232, 0xeb3d36d3, 0xad0651b6, 0x674bf819, + 0x21709f7c, 0x25abc6e0, 0x6390a185, 0xa9dd082a, 0xefe66f4f, + 0x7c402bae, 0x3a7b4ccb, 0xf036e564, 0xb60d8201, 0x977d1d7d, + 0xd1467a18, 0x1b0bd3b7, 0x5d30b4d2, 0xce96f033, 0x88ad9756, + 0x42e03ef9, 0x04db599c, 0x0b50fc1a, 0x4d6b9b7f, 0x872632d0, + 0xc11d55b5, 0x52bb1154, 0x14807631, 0xdecddf9e, 0x98f6b8fb, + 0xb9862787, 0xffbd40e2, 0x35f0e94d, 0x73cb8e28, 0xe06dcac9, + 0xa656adac, 0x6c1b0403, 0x2a206366, 0x2efb3afa, 0x68c05d9f, + 0xa28df430, 0xe4b69355, 0x7710d7b4, 0x312bb0d1, 0xfb66197e, + 0xbd5d7e1b, 0x9c2de167, 0xda168602, 0x105b2fad, 0x566048c8, + 0xc5c60c29, 0x83fd6b4c, 0x49b0c2e3, 0x0f8ba586, 0x16a0f835, + 0x509b9f50, 0x9ad636ff, 0xdced519a, 0x4f4b157b, 0x0970721e, + 0xc33ddbb1, 0x8506bcd4, 0xa47623a8, 0xe24d44cd, 0x2800ed62, + 0x6e3b8a07, 0xfd9dcee6, 0xbba6a983, 0x71eb002c, 0x37d06749, + 0x330b3ed5, 0x753059b0, 0xbf7df01f, 0xf946977a, 0x6ae0d39b, + 0x2cdbb4fe, 0xe6961d51, 0xa0ad7a34, 0x81dde548, 0xc7e6822d, + 0x0dab2b82, 0x4b904ce7, 0xd8360806, 0x9e0d6f63, 0x5440c6cc, + 0x127ba1a9, 0x1df0042f, 0x5bcb634a, 0x9186cae5, 0xd7bdad80, + 0x441be961, 0x02208e04, 0xc86d27ab, 0x8e5640ce, 0xaf26dfb2, + 0xe91db8d7, 0x23501178, 0x656b761d, 0xf6cd32fc, 0xb0f65599, + 0x7abbfc36, 0x3c809b53, 0x385bc2cf, 0x7e60a5aa, 0xb42d0c05, + 0xf2166b60, 0x61b02f81, 0x278b48e4, 0xedc6e14b, 0xabfd862e, + 0x8a8d1952, 0xccb67e37, 0x06fbd798, 0x40c0b0fd, 0xd366f41c, + 0x955d9379, 0x5f103ad6, 0x192b5db3, 0x2c40f16b, 0x6a7b960e, + 0xa0363fa1, 0xe60d58c4, 0x75ab1c25, 0x33907b40, 0xf9ddd2ef, + 0xbfe6b58a, 0x9e962af6, 0xd8ad4d93, 0x12e0e43c, 0x54db8359, + 0xc77dc7b8, 0x8146a0dd, 0x4b0b0972, 0x0d306e17, 0x09eb378b, + 0x4fd050ee, 0x859df941, 0xc3a69e24, 0x5000dac5, 0x163bbda0, + 0xdc76140f, 0x9a4d736a, 0xbb3dec16, 0xfd068b73, 0x374b22dc, + 0x717045b9, 0xe2d60158, 0xa4ed663d, 0x6ea0cf92, 0x289ba8f7, + 0x27100d71, 0x612b6a14, 0xab66c3bb, 0xed5da4de, 0x7efbe03f, + 0x38c0875a, 0xf28d2ef5, 0xb4b64990, 0x95c6d6ec, 0xd3fdb189, + 0x19b01826, 0x5f8b7f43, 0xcc2d3ba2, 0x8a165cc7, 0x405bf568, + 0x0660920d, 0x02bbcb91, 0x4480acf4, 0x8ecd055b, 0xc8f6623e, + 0x5b5026df, 0x1d6b41ba, 0xd726e815, 0x911d8f70, 0xb06d100c, + 0xf6567769, 0x3c1bdec6, 0x7a20b9a3, 0xe986fd42, 0xafbd9a27, + 0x65f03388, 0x23cb54ed, 0x3ae0095e, 0x7cdb6e3b, 0xb696c794, + 0xf0ada0f1, 0x630be410, 0x25308375, 0xef7d2ada, 0xa9464dbf, + 0x8836d2c3, 0xce0db5a6, 0x04401c09, 0x427b7b6c, 0xd1dd3f8d, + 0x97e658e8, 0x5dabf147, 0x1b909622, 0x1f4bcfbe, 0x5970a8db, + 0x933d0174, 0xd5066611, 0x46a022f0, 0x009b4595, 0xcad6ec3a, + 0x8ced8b5f, 0xad9d1423, 0xeba67346, 0x21ebdae9, 0x67d0bd8c, + 0xf476f96d, 0xb24d9e08, 0x780037a7, 0x3e3b50c2, 0x31b0f544, + 0x778b9221, 0xbdc63b8e, 0xfbfd5ceb, 0x685b180a, 0x2e607f6f, + 0xe42dd6c0, 0xa216b1a5, 0x83662ed9, 0xc55d49bc, 0x0f10e013, + 0x492b8776, 0xda8dc397, 0x9cb6a4f2, 0x56fb0d5d, 0x10c06a38, + 0x141b33a4, 0x522054c1, 0x986dfd6e, 0xde569a0b, 0x4df0deea, + 0x0bcbb98f, 0xc1861020, 0x87bd7745, 0xa6cde839, 0xe0f68f5c, + 0x2abb26f3, 0x6c804196, 0xff260577, 0xb91d6212, 0x7350cbbd, + 0x356bacd8}}; + +#endif + +#endif + +#if N == 6 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x3db1ecdc, 0x7b63d9b8, 0x46d23564, 0xf6c7b370, + 0xcb765fac, 0x8da46ac8, 0xb0158614, 0x36fe60a1, 0x0b4f8c7d, + 0x4d9db919, 0x702c55c5, 0xc039d3d1, 0xfd883f0d, 0xbb5a0a69, + 0x86ebe6b5, 0x6dfcc142, 0x504d2d9e, 0x169f18fa, 0x2b2ef426, + 0x9b3b7232, 0xa68a9eee, 0xe058ab8a, 0xdde94756, 0x5b02a1e3, + 0x66b34d3f, 0x2061785b, 0x1dd09487, 0xadc51293, 0x9074fe4f, + 0xd6a6cb2b, 0xeb1727f7, 0xdbf98284, 0xe6486e58, 0xa09a5b3c, + 0x9d2bb7e0, 0x2d3e31f4, 0x108fdd28, 0x565de84c, 0x6bec0490, + 0xed07e225, 0xd0b60ef9, 0x96643b9d, 0xabd5d741, 0x1bc05155, + 0x2671bd89, 0x60a388ed, 0x5d126431, 0xb60543c6, 0x8bb4af1a, + 0xcd669a7e, 0xf0d776a2, 0x40c2f0b6, 0x7d731c6a, 0x3ba1290e, + 0x0610c5d2, 0x80fb2367, 0xbd4acfbb, 0xfb98fadf, 0xc6291603, + 0x763c9017, 0x4b8d7ccb, 0x0d5f49af, 0x30eea573, 0x6c820349, + 0x5133ef95, 0x17e1daf1, 0x2a50362d, 0x9a45b039, 0xa7f45ce5, + 0xe1266981, 0xdc97855d, 0x5a7c63e8, 0x67cd8f34, 0x211fba50, + 0x1cae568c, 0xacbbd098, 0x910a3c44, 0xd7d80920, 0xea69e5fc, + 0x017ec20b, 0x3ccf2ed7, 0x7a1d1bb3, 0x47acf76f, 0xf7b9717b, + 0xca089da7, 0x8cdaa8c3, 0xb16b441f, 0x3780a2aa, 0x0a314e76, + 0x4ce37b12, 0x715297ce, 0xc14711da, 0xfcf6fd06, 0xba24c862, + 0x879524be, 0xb77b81cd, 0x8aca6d11, 0xcc185875, 0xf1a9b4a9, + 0x41bc32bd, 0x7c0dde61, 0x3adfeb05, 0x076e07d9, 0x8185e16c, + 0xbc340db0, 0xfae638d4, 0xc757d408, 0x7742521c, 0x4af3bec0, + 0x0c218ba4, 0x31906778, 0xda87408f, 0xe736ac53, 0xa1e49937, + 0x9c5575eb, 0x2c40f3ff, 0x11f11f23, 0x57232a47, 0x6a92c69b, + 0xec79202e, 0xd1c8ccf2, 0x971af996, 0xaaab154a, 0x1abe935e, + 0x270f7f82, 0x61dd4ae6, 0x5c6ca63a, 0xd9040692, 0xe4b5ea4e, + 0xa267df2a, 0x9fd633f6, 0x2fc3b5e2, 0x1272593e, 0x54a06c5a, + 0x69118086, 0xeffa6633, 0xd24b8aef, 0x9499bf8b, 0xa9285357, + 0x193dd543, 0x248c399f, 0x625e0cfb, 0x5fefe027, 0xb4f8c7d0, + 0x89492b0c, 0xcf9b1e68, 0xf22af2b4, 0x423f74a0, 0x7f8e987c, + 0x395cad18, 0x04ed41c4, 0x8206a771, 0xbfb74bad, 0xf9657ec9, + 0xc4d49215, 0x74c11401, 0x4970f8dd, 0x0fa2cdb9, 0x32132165, + 0x02fd8416, 0x3f4c68ca, 0x799e5dae, 0x442fb172, 0xf43a3766, + 0xc98bdbba, 0x8f59eede, 0xb2e80202, 0x3403e4b7, 0x09b2086b, + 0x4f603d0f, 0x72d1d1d3, 0xc2c457c7, 0xff75bb1b, 0xb9a78e7f, + 0x841662a3, 0x6f014554, 0x52b0a988, 0x14629cec, 0x29d37030, + 0x99c6f624, 0xa4771af8, 0xe2a52f9c, 0xdf14c340, 0x59ff25f5, + 0x644ec929, 0x229cfc4d, 0x1f2d1091, 0xaf389685, 0x92897a59, + 0xd45b4f3d, 0xe9eaa3e1, 0xb58605db, 0x8837e907, 0xcee5dc63, + 0xf35430bf, 0x4341b6ab, 0x7ef05a77, 0x38226f13, 0x059383cf, + 0x8378657a, 0xbec989a6, 0xf81bbcc2, 0xc5aa501e, 0x75bfd60a, + 0x480e3ad6, 0x0edc0fb2, 0x336de36e, 0xd87ac499, 0xe5cb2845, + 0xa3191d21, 0x9ea8f1fd, 0x2ebd77e9, 0x130c9b35, 0x55deae51, + 0x686f428d, 0xee84a438, 0xd33548e4, 0x95e77d80, 0xa856915c, + 0x18431748, 0x25f2fb94, 0x6320cef0, 0x5e91222c, 0x6e7f875f, + 0x53ce6b83, 0x151c5ee7, 0x28adb23b, 0x98b8342f, 0xa509d8f3, + 0xe3dbed97, 0xde6a014b, 0x5881e7fe, 0x65300b22, 0x23e23e46, + 0x1e53d29a, 0xae46548e, 0x93f7b852, 0xd5258d36, 0xe89461ea, + 0x0383461d, 0x3e32aac1, 0x78e09fa5, 0x45517379, 0xf544f56d, + 0xc8f519b1, 0x8e272cd5, 0xb396c009, 0x357d26bc, 0x08ccca60, + 0x4e1eff04, 0x73af13d8, 0xc3ba95cc, 0xfe0b7910, 0xb8d94c74, + 0x8568a0a8}, + {0x00000000, 0x69790b65, 0xd2f216ca, 0xbb8b1daf, 0x7e952bd5, + 0x17ec20b0, 0xac673d1f, 0xc51e367a, 0xfd2a57aa, 0x94535ccf, + 0x2fd84160, 0x46a14a05, 0x83bf7c7f, 0xeac6771a, 0x514d6ab5, + 0x383461d0, 0x2125a915, 0x485ca270, 0xf3d7bfdf, 0x9aaeb4ba, + 0x5fb082c0, 0x36c989a5, 0x8d42940a, 0xe43b9f6f, 0xdc0ffebf, + 0xb576f5da, 0x0efde875, 0x6784e310, 0xa29ad56a, 0xcbe3de0f, + 0x7068c3a0, 0x1911c8c5, 0x424b522a, 0x2b32594f, 0x90b944e0, + 0xf9c04f85, 0x3cde79ff, 0x55a7729a, 0xee2c6f35, 0x87556450, + 0xbf610580, 0xd6180ee5, 0x6d93134a, 0x04ea182f, 0xc1f42e55, + 0xa88d2530, 0x1306389f, 0x7a7f33fa, 0x636efb3f, 0x0a17f05a, + 0xb19cedf5, 0xd8e5e690, 0x1dfbd0ea, 0x7482db8f, 0xcf09c620, + 0xa670cd45, 0x9e44ac95, 0xf73da7f0, 0x4cb6ba5f, 0x25cfb13a, + 0xe0d18740, 0x89a88c25, 0x3223918a, 0x5b5a9aef, 0x8496a454, + 0xedefaf31, 0x5664b29e, 0x3f1db9fb, 0xfa038f81, 0x937a84e4, + 0x28f1994b, 0x4188922e, 0x79bcf3fe, 0x10c5f89b, 0xab4ee534, + 0xc237ee51, 0x0729d82b, 0x6e50d34e, 0xd5dbcee1, 0xbca2c584, + 0xa5b30d41, 0xccca0624, 0x77411b8b, 0x1e3810ee, 0xdb262694, + 0xb25f2df1, 0x09d4305e, 0x60ad3b3b, 0x58995aeb, 0x31e0518e, + 0x8a6b4c21, 0xe3124744, 0x260c713e, 0x4f757a5b, 0xf4fe67f4, + 0x9d876c91, 0xc6ddf67e, 0xafa4fd1b, 0x142fe0b4, 0x7d56ebd1, + 0xb848ddab, 0xd131d6ce, 0x6abacb61, 0x03c3c004, 0x3bf7a1d4, + 0x528eaab1, 0xe905b71e, 0x807cbc7b, 0x45628a01, 0x2c1b8164, + 0x97909ccb, 0xfee997ae, 0xe7f85f6b, 0x8e81540e, 0x350a49a1, + 0x5c7342c4, 0x996d74be, 0xf0147fdb, 0x4b9f6274, 0x22e66911, + 0x1ad208c1, 0x73ab03a4, 0xc8201e0b, 0xa159156e, 0x64472314, + 0x0d3e2871, 0xb6b535de, 0xdfcc3ebb, 0xd25c4ee9, 0xbb25458c, + 0x00ae5823, 0x69d75346, 0xacc9653c, 0xc5b06e59, 0x7e3b73f6, + 0x17427893, 0x2f761943, 0x460f1226, 0xfd840f89, 0x94fd04ec, + 0x51e33296, 0x389a39f3, 0x8311245c, 0xea682f39, 0xf379e7fc, + 0x9a00ec99, 0x218bf136, 0x48f2fa53, 0x8deccc29, 0xe495c74c, + 0x5f1edae3, 0x3667d186, 0x0e53b056, 0x672abb33, 0xdca1a69c, + 0xb5d8adf9, 0x70c69b83, 0x19bf90e6, 0xa2348d49, 0xcb4d862c, + 0x90171cc3, 0xf96e17a6, 0x42e50a09, 0x2b9c016c, 0xee823716, + 0x87fb3c73, 0x3c7021dc, 0x55092ab9, 0x6d3d4b69, 0x0444400c, + 0xbfcf5da3, 0xd6b656c6, 0x13a860bc, 0x7ad16bd9, 0xc15a7676, + 0xa8237d13, 0xb132b5d6, 0xd84bbeb3, 0x63c0a31c, 0x0ab9a879, + 0xcfa79e03, 0xa6de9566, 0x1d5588c9, 0x742c83ac, 0x4c18e27c, + 0x2561e919, 0x9eeaf4b6, 0xf793ffd3, 0x328dc9a9, 0x5bf4c2cc, + 0xe07fdf63, 0x8906d406, 0x56caeabd, 0x3fb3e1d8, 0x8438fc77, + 0xed41f712, 0x285fc168, 0x4126ca0d, 0xfaadd7a2, 0x93d4dcc7, + 0xabe0bd17, 0xc299b672, 0x7912abdd, 0x106ba0b8, 0xd57596c2, + 0xbc0c9da7, 0x07878008, 0x6efe8b6d, 0x77ef43a8, 0x1e9648cd, + 0xa51d5562, 0xcc645e07, 0x097a687d, 0x60036318, 0xdb887eb7, + 0xb2f175d2, 0x8ac51402, 0xe3bc1f67, 0x583702c8, 0x314e09ad, + 0xf4503fd7, 0x9d2934b2, 0x26a2291d, 0x4fdb2278, 0x1481b897, + 0x7df8b3f2, 0xc673ae5d, 0xaf0aa538, 0x6a149342, 0x036d9827, + 0xb8e68588, 0xd19f8eed, 0xe9abef3d, 0x80d2e458, 0x3b59f9f7, + 0x5220f292, 0x973ec4e8, 0xfe47cf8d, 0x45ccd222, 0x2cb5d947, + 0x35a41182, 0x5cdd1ae7, 0xe7560748, 0x8e2f0c2d, 0x4b313a57, + 0x22483132, 0x99c32c9d, 0xf0ba27f8, 0xc88e4628, 0xa1f74d4d, + 0x1a7c50e2, 0x73055b87, 0xb61b6dfd, 0xdf626698, 0x64e97b37, + 0x0d907052}, + {0x00000000, 0x7fc99b93, 0xff933726, 0x805aacb5, 0x2457680d, + 0x5b9ef39e, 0xdbc45f2b, 0xa40dc4b8, 0x48aed01a, 0x37674b89, + 0xb73de73c, 0xc8f47caf, 0x6cf9b817, 0x13302384, 0x936a8f31, + 0xeca314a2, 0x915da034, 0xee943ba7, 0x6ece9712, 0x11070c81, + 0xb50ac839, 0xcac353aa, 0x4a99ff1f, 0x3550648c, 0xd9f3702e, + 0xa63aebbd, 0x26604708, 0x59a9dc9b, 0xfda41823, 0x826d83b0, + 0x02372f05, 0x7dfeb496, 0xf9ca4629, 0x8603ddba, 0x0659710f, + 0x7990ea9c, 0xdd9d2e24, 0xa254b5b7, 0x220e1902, 0x5dc78291, + 0xb1649633, 0xcead0da0, 0x4ef7a115, 0x313e3a86, 0x9533fe3e, + 0xeafa65ad, 0x6aa0c918, 0x1569528b, 0x6897e61d, 0x175e7d8e, + 0x9704d13b, 0xe8cd4aa8, 0x4cc08e10, 0x33091583, 0xb353b936, + 0xcc9a22a5, 0x20393607, 0x5ff0ad94, 0xdfaa0121, 0xa0639ab2, + 0x046e5e0a, 0x7ba7c599, 0xfbfd692c, 0x8434f2bf, 0x28e58a13, + 0x572c1180, 0xd776bd35, 0xa8bf26a6, 0x0cb2e21e, 0x737b798d, + 0xf321d538, 0x8ce84eab, 0x604b5a09, 0x1f82c19a, 0x9fd86d2f, + 0xe011f6bc, 0x441c3204, 0x3bd5a997, 0xbb8f0522, 0xc4469eb1, + 0xb9b82a27, 0xc671b1b4, 0x462b1d01, 0x39e28692, 0x9def422a, + 0xe226d9b9, 0x627c750c, 0x1db5ee9f, 0xf116fa3d, 0x8edf61ae, + 0x0e85cd1b, 0x714c5688, 0xd5419230, 0xaa8809a3, 0x2ad2a516, + 0x551b3e85, 0xd12fcc3a, 0xaee657a9, 0x2ebcfb1c, 0x5175608f, + 0xf578a437, 0x8ab13fa4, 0x0aeb9311, 0x75220882, 0x99811c20, + 0xe64887b3, 0x66122b06, 0x19dbb095, 0xbdd6742d, 0xc21fefbe, + 0x4245430b, 0x3d8cd898, 0x40726c0e, 0x3fbbf79d, 0xbfe15b28, + 0xc028c0bb, 0x64250403, 0x1bec9f90, 0x9bb63325, 0xe47fa8b6, + 0x08dcbc14, 0x77152787, 0xf74f8b32, 0x888610a1, 0x2c8bd419, + 0x53424f8a, 0xd318e33f, 0xacd178ac, 0x51cb1426, 0x2e028fb5, + 0xae582300, 0xd191b893, 0x759c7c2b, 0x0a55e7b8, 0x8a0f4b0d, + 0xf5c6d09e, 0x1965c43c, 0x66ac5faf, 0xe6f6f31a, 0x993f6889, + 0x3d32ac31, 0x42fb37a2, 0xc2a19b17, 0xbd680084, 0xc096b412, + 0xbf5f2f81, 0x3f058334, 0x40cc18a7, 0xe4c1dc1f, 0x9b08478c, + 0x1b52eb39, 0x649b70aa, 0x88386408, 0xf7f1ff9b, 0x77ab532e, + 0x0862c8bd, 0xac6f0c05, 0xd3a69796, 0x53fc3b23, 0x2c35a0b0, + 0xa801520f, 0xd7c8c99c, 0x57926529, 0x285bfeba, 0x8c563a02, + 0xf39fa191, 0x73c50d24, 0x0c0c96b7, 0xe0af8215, 0x9f661986, + 0x1f3cb533, 0x60f52ea0, 0xc4f8ea18, 0xbb31718b, 0x3b6bdd3e, + 0x44a246ad, 0x395cf23b, 0x469569a8, 0xc6cfc51d, 0xb9065e8e, + 0x1d0b9a36, 0x62c201a5, 0xe298ad10, 0x9d513683, 0x71f22221, + 0x0e3bb9b2, 0x8e611507, 0xf1a88e94, 0x55a54a2c, 0x2a6cd1bf, + 0xaa367d0a, 0xd5ffe699, 0x792e9e35, 0x06e705a6, 0x86bda913, + 0xf9743280, 0x5d79f638, 0x22b06dab, 0xa2eac11e, 0xdd235a8d, + 0x31804e2f, 0x4e49d5bc, 0xce137909, 0xb1dae29a, 0x15d72622, + 0x6a1ebdb1, 0xea441104, 0x958d8a97, 0xe8733e01, 0x97baa592, + 0x17e00927, 0x682992b4, 0xcc24560c, 0xb3edcd9f, 0x33b7612a, + 0x4c7efab9, 0xa0ddee1b, 0xdf147588, 0x5f4ed93d, 0x208742ae, + 0x848a8616, 0xfb431d85, 0x7b19b130, 0x04d02aa3, 0x80e4d81c, + 0xff2d438f, 0x7f77ef3a, 0x00be74a9, 0xa4b3b011, 0xdb7a2b82, + 0x5b208737, 0x24e91ca4, 0xc84a0806, 0xb7839395, 0x37d93f20, + 0x4810a4b3, 0xec1d600b, 0x93d4fb98, 0x138e572d, 0x6c47ccbe, + 0x11b97828, 0x6e70e3bb, 0xee2a4f0e, 0x91e3d49d, 0x35ee1025, + 0x4a278bb6, 0xca7d2703, 0xb5b4bc90, 0x5917a832, 0x26de33a1, + 0xa6849f14, 0xd94d0487, 0x7d40c03f, 0x02895bac, 0x82d3f719, + 0xfd1a6c8a}, + {0x00000000, 0xa396284c, 0x9c5d56d9, 0x3fcb7e95, 0xe3cbabf3, + 0x405d83bf, 0x7f96fd2a, 0xdc00d566, 0x1ce651a7, 0xbf7079eb, + 0x80bb077e, 0x232d2f32, 0xff2dfa54, 0x5cbbd218, 0x6370ac8d, + 0xc0e684c1, 0x39cca34e, 0x9a5a8b02, 0xa591f597, 0x0607dddb, + 0xda0708bd, 0x799120f1, 0x465a5e64, 0xe5cc7628, 0x252af2e9, + 0x86bcdaa5, 0xb977a430, 0x1ae18c7c, 0xc6e1591a, 0x65777156, + 0x5abc0fc3, 0xf92a278f, 0x7399469c, 0xd00f6ed0, 0xefc41045, + 0x4c523809, 0x9052ed6f, 0x33c4c523, 0x0c0fbbb6, 0xaf9993fa, + 0x6f7f173b, 0xcce93f77, 0xf32241e2, 0x50b469ae, 0x8cb4bcc8, + 0x2f229484, 0x10e9ea11, 0xb37fc25d, 0x4a55e5d2, 0xe9c3cd9e, + 0xd608b30b, 0x759e9b47, 0xa99e4e21, 0x0a08666d, 0x35c318f8, + 0x965530b4, 0x56b3b475, 0xf5259c39, 0xcaeee2ac, 0x6978cae0, + 0xb5781f86, 0x16ee37ca, 0x2925495f, 0x8ab36113, 0xe7328d38, + 0x44a4a574, 0x7b6fdbe1, 0xd8f9f3ad, 0x04f926cb, 0xa76f0e87, + 0x98a47012, 0x3b32585e, 0xfbd4dc9f, 0x5842f4d3, 0x67898a46, + 0xc41fa20a, 0x181f776c, 0xbb895f20, 0x844221b5, 0x27d409f9, + 0xdefe2e76, 0x7d68063a, 0x42a378af, 0xe13550e3, 0x3d358585, + 0x9ea3adc9, 0xa168d35c, 0x02fefb10, 0xc2187fd1, 0x618e579d, + 0x5e452908, 0xfdd30144, 0x21d3d422, 0x8245fc6e, 0xbd8e82fb, + 0x1e18aab7, 0x94abcba4, 0x373de3e8, 0x08f69d7d, 0xab60b531, + 0x77606057, 0xd4f6481b, 0xeb3d368e, 0x48ab1ec2, 0x884d9a03, + 0x2bdbb24f, 0x1410ccda, 0xb786e496, 0x6b8631f0, 0xc81019bc, + 0xf7db6729, 0x544d4f65, 0xad6768ea, 0x0ef140a6, 0x313a3e33, + 0x92ac167f, 0x4eacc319, 0xed3aeb55, 0xd2f195c0, 0x7167bd8c, + 0xb181394d, 0x12171101, 0x2ddc6f94, 0x8e4a47d8, 0x524a92be, + 0xf1dcbaf2, 0xce17c467, 0x6d81ec2b, 0x15141c31, 0xb682347d, + 0x89494ae8, 0x2adf62a4, 0xf6dfb7c2, 0x55499f8e, 0x6a82e11b, + 0xc914c957, 0x09f24d96, 0xaa6465da, 0x95af1b4f, 0x36393303, + 0xea39e665, 0x49afce29, 0x7664b0bc, 0xd5f298f0, 0x2cd8bf7f, + 0x8f4e9733, 0xb085e9a6, 0x1313c1ea, 0xcf13148c, 0x6c853cc0, + 0x534e4255, 0xf0d86a19, 0x303eeed8, 0x93a8c694, 0xac63b801, + 0x0ff5904d, 0xd3f5452b, 0x70636d67, 0x4fa813f2, 0xec3e3bbe, + 0x668d5aad, 0xc51b72e1, 0xfad00c74, 0x59462438, 0x8546f15e, + 0x26d0d912, 0x191ba787, 0xba8d8fcb, 0x7a6b0b0a, 0xd9fd2346, + 0xe6365dd3, 0x45a0759f, 0x99a0a0f9, 0x3a3688b5, 0x05fdf620, + 0xa66bde6c, 0x5f41f9e3, 0xfcd7d1af, 0xc31caf3a, 0x608a8776, + 0xbc8a5210, 0x1f1c7a5c, 0x20d704c9, 0x83412c85, 0x43a7a844, + 0xe0318008, 0xdffafe9d, 0x7c6cd6d1, 0xa06c03b7, 0x03fa2bfb, + 0x3c31556e, 0x9fa77d22, 0xf2269109, 0x51b0b945, 0x6e7bc7d0, + 0xcdedef9c, 0x11ed3afa, 0xb27b12b6, 0x8db06c23, 0x2e26446f, + 0xeec0c0ae, 0x4d56e8e2, 0x729d9677, 0xd10bbe3b, 0x0d0b6b5d, + 0xae9d4311, 0x91563d84, 0x32c015c8, 0xcbea3247, 0x687c1a0b, + 0x57b7649e, 0xf4214cd2, 0x282199b4, 0x8bb7b1f8, 0xb47ccf6d, + 0x17eae721, 0xd70c63e0, 0x749a4bac, 0x4b513539, 0xe8c71d75, + 0x34c7c813, 0x9751e05f, 0xa89a9eca, 0x0b0cb686, 0x81bfd795, + 0x2229ffd9, 0x1de2814c, 0xbe74a900, 0x62747c66, 0xc1e2542a, + 0xfe292abf, 0x5dbf02f3, 0x9d598632, 0x3ecfae7e, 0x0104d0eb, + 0xa292f8a7, 0x7e922dc1, 0xdd04058d, 0xe2cf7b18, 0x41595354, + 0xb87374db, 0x1be55c97, 0x242e2202, 0x87b80a4e, 0x5bb8df28, + 0xf82ef764, 0xc7e589f1, 0x6473a1bd, 0xa495257c, 0x07030d30, + 0x38c873a5, 0x9b5e5be9, 0x475e8e8f, 0xe4c8a6c3, 0xdb03d856, + 0x7895f01a}, + {0x00000000, 0x2a283862, 0x545070c4, 0x7e7848a6, 0xa8a0e188, + 0x8288d9ea, 0xfcf0914c, 0xd6d8a92e, 0x8a30c551, 0xa018fd33, + 0xde60b595, 0xf4488df7, 0x229024d9, 0x08b81cbb, 0x76c0541d, + 0x5ce86c7f, 0xcf108ce3, 0xe538b481, 0x9b40fc27, 0xb168c445, + 0x67b06d6b, 0x4d985509, 0x33e01daf, 0x19c825cd, 0x452049b2, + 0x6f0871d0, 0x11703976, 0x3b580114, 0xed80a83a, 0xc7a89058, + 0xb9d0d8fe, 0x93f8e09c, 0x45501f87, 0x6f7827e5, 0x11006f43, + 0x3b285721, 0xedf0fe0f, 0xc7d8c66d, 0xb9a08ecb, 0x9388b6a9, + 0xcf60dad6, 0xe548e2b4, 0x9b30aa12, 0xb1189270, 0x67c03b5e, + 0x4de8033c, 0x33904b9a, 0x19b873f8, 0x8a409364, 0xa068ab06, + 0xde10e3a0, 0xf438dbc2, 0x22e072ec, 0x08c84a8e, 0x76b00228, + 0x5c983a4a, 0x00705635, 0x2a586e57, 0x542026f1, 0x7e081e93, + 0xa8d0b7bd, 0x82f88fdf, 0xfc80c779, 0xd6a8ff1b, 0x8aa03f0e, + 0xa088076c, 0xdef04fca, 0xf4d877a8, 0x2200de86, 0x0828e6e4, + 0x7650ae42, 0x5c789620, 0x0090fa5f, 0x2ab8c23d, 0x54c08a9b, + 0x7ee8b2f9, 0xa8301bd7, 0x821823b5, 0xfc606b13, 0xd6485371, + 0x45b0b3ed, 0x6f988b8f, 0x11e0c329, 0x3bc8fb4b, 0xed105265, + 0xc7386a07, 0xb94022a1, 0x93681ac3, 0xcf8076bc, 0xe5a84ede, + 0x9bd00678, 0xb1f83e1a, 0x67209734, 0x4d08af56, 0x3370e7f0, + 0x1958df92, 0xcff02089, 0xe5d818eb, 0x9ba0504d, 0xb188682f, + 0x6750c101, 0x4d78f963, 0x3300b1c5, 0x192889a7, 0x45c0e5d8, + 0x6fe8ddba, 0x1190951c, 0x3bb8ad7e, 0xed600450, 0xc7483c32, + 0xb9307494, 0x93184cf6, 0x00e0ac6a, 0x2ac89408, 0x54b0dcae, + 0x7e98e4cc, 0xa8404de2, 0x82687580, 0xfc103d26, 0xd6380544, + 0x8ad0693b, 0xa0f85159, 0xde8019ff, 0xf4a8219d, 0x227088b3, + 0x0858b0d1, 0x7620f877, 0x5c08c015, 0xce31785d, 0xe419403f, + 0x9a610899, 0xb04930fb, 0x669199d5, 0x4cb9a1b7, 0x32c1e911, + 0x18e9d173, 0x4401bd0c, 0x6e29856e, 0x1051cdc8, 0x3a79f5aa, + 0xeca15c84, 0xc68964e6, 0xb8f12c40, 0x92d91422, 0x0121f4be, + 0x2b09ccdc, 0x5571847a, 0x7f59bc18, 0xa9811536, 0x83a92d54, + 0xfdd165f2, 0xd7f95d90, 0x8b1131ef, 0xa139098d, 0xdf41412b, + 0xf5697949, 0x23b1d067, 0x0999e805, 0x77e1a0a3, 0x5dc998c1, + 0x8b6167da, 0xa1495fb8, 0xdf31171e, 0xf5192f7c, 0x23c18652, + 0x09e9be30, 0x7791f696, 0x5db9cef4, 0x0151a28b, 0x2b799ae9, + 0x5501d24f, 0x7f29ea2d, 0xa9f14303, 0x83d97b61, 0xfda133c7, + 0xd7890ba5, 0x4471eb39, 0x6e59d35b, 0x10219bfd, 0x3a09a39f, + 0xecd10ab1, 0xc6f932d3, 0xb8817a75, 0x92a94217, 0xce412e68, + 0xe469160a, 0x9a115eac, 0xb03966ce, 0x66e1cfe0, 0x4cc9f782, + 0x32b1bf24, 0x18998746, 0x44914753, 0x6eb97f31, 0x10c13797, + 0x3ae90ff5, 0xec31a6db, 0xc6199eb9, 0xb861d61f, 0x9249ee7d, + 0xcea18202, 0xe489ba60, 0x9af1f2c6, 0xb0d9caa4, 0x6601638a, + 0x4c295be8, 0x3251134e, 0x18792b2c, 0x8b81cbb0, 0xa1a9f3d2, + 0xdfd1bb74, 0xf5f98316, 0x23212a38, 0x0909125a, 0x77715afc, + 0x5d59629e, 0x01b10ee1, 0x2b993683, 0x55e17e25, 0x7fc94647, + 0xa911ef69, 0x8339d70b, 0xfd419fad, 0xd769a7cf, 0x01c158d4, + 0x2be960b6, 0x55912810, 0x7fb91072, 0xa961b95c, 0x8349813e, + 0xfd31c998, 0xd719f1fa, 0x8bf19d85, 0xa1d9a5e7, 0xdfa1ed41, + 0xf589d523, 0x23517c0d, 0x0979446f, 0x77010cc9, 0x5d2934ab, + 0xced1d437, 0xe4f9ec55, 0x9a81a4f3, 0xb0a99c91, 0x667135bf, + 0x4c590ddd, 0x3221457b, 0x18097d19, 0x44e11166, 0x6ec92904, + 0x10b161a2, 0x3a9959c0, 0xec41f0ee, 0xc669c88c, 0xb811802a, + 0x9239b848}, + {0x00000000, 0x4713f6fb, 0x8e27edf6, 0xc9341b0d, 0xc73eddad, + 0x802d2b56, 0x4919305b, 0x0e0ac6a0, 0x550cbd1b, 0x121f4be0, + 0xdb2b50ed, 0x9c38a616, 0x923260b6, 0xd521964d, 0x1c158d40, + 0x5b067bbb, 0xaa197a36, 0xed0a8ccd, 0x243e97c0, 0x632d613b, + 0x6d27a79b, 0x2a345160, 0xe3004a6d, 0xa413bc96, 0xff15c72d, + 0xb80631d6, 0x71322adb, 0x3621dc20, 0x382b1a80, 0x7f38ec7b, + 0xb60cf776, 0xf11f018d, 0x8f43f22d, 0xc85004d6, 0x01641fdb, + 0x4677e920, 0x487d2f80, 0x0f6ed97b, 0xc65ac276, 0x8149348d, + 0xda4f4f36, 0x9d5cb9cd, 0x5468a2c0, 0x137b543b, 0x1d71929b, + 0x5a626460, 0x93567f6d, 0xd4458996, 0x255a881b, 0x62497ee0, + 0xab7d65ed, 0xec6e9316, 0xe26455b6, 0xa577a34d, 0x6c43b840, + 0x2b504ebb, 0x70563500, 0x3745c3fb, 0xfe71d8f6, 0xb9622e0d, + 0xb768e8ad, 0xf07b1e56, 0x394f055b, 0x7e5cf3a0, 0xc5f6e21b, + 0x82e514e0, 0x4bd10fed, 0x0cc2f916, 0x02c83fb6, 0x45dbc94d, + 0x8cefd240, 0xcbfc24bb, 0x90fa5f00, 0xd7e9a9fb, 0x1eddb2f6, + 0x59ce440d, 0x57c482ad, 0x10d77456, 0xd9e36f5b, 0x9ef099a0, + 0x6fef982d, 0x28fc6ed6, 0xe1c875db, 0xa6db8320, 0xa8d14580, + 0xefc2b37b, 0x26f6a876, 0x61e55e8d, 0x3ae32536, 0x7df0d3cd, + 0xb4c4c8c0, 0xf3d73e3b, 0xfdddf89b, 0xbace0e60, 0x73fa156d, + 0x34e9e396, 0x4ab51036, 0x0da6e6cd, 0xc492fdc0, 0x83810b3b, + 0x8d8bcd9b, 0xca983b60, 0x03ac206d, 0x44bfd696, 0x1fb9ad2d, + 0x58aa5bd6, 0x919e40db, 0xd68db620, 0xd8877080, 0x9f94867b, + 0x56a09d76, 0x11b36b8d, 0xe0ac6a00, 0xa7bf9cfb, 0x6e8b87f6, + 0x2998710d, 0x2792b7ad, 0x60814156, 0xa9b55a5b, 0xeea6aca0, + 0xb5a0d71b, 0xf2b321e0, 0x3b873aed, 0x7c94cc16, 0x729e0ab6, + 0x358dfc4d, 0xfcb9e740, 0xbbaa11bb, 0x509cc277, 0x178f348c, + 0xdebb2f81, 0x99a8d97a, 0x97a21fda, 0xd0b1e921, 0x1985f22c, + 0x5e9604d7, 0x05907f6c, 0x42838997, 0x8bb7929a, 0xcca46461, + 0xc2aea2c1, 0x85bd543a, 0x4c894f37, 0x0b9ab9cc, 0xfa85b841, + 0xbd964eba, 0x74a255b7, 0x33b1a34c, 0x3dbb65ec, 0x7aa89317, + 0xb39c881a, 0xf48f7ee1, 0xaf89055a, 0xe89af3a1, 0x21aee8ac, + 0x66bd1e57, 0x68b7d8f7, 0x2fa42e0c, 0xe6903501, 0xa183c3fa, + 0xdfdf305a, 0x98ccc6a1, 0x51f8ddac, 0x16eb2b57, 0x18e1edf7, + 0x5ff21b0c, 0x96c60001, 0xd1d5f6fa, 0x8ad38d41, 0xcdc07bba, + 0x04f460b7, 0x43e7964c, 0x4ded50ec, 0x0afea617, 0xc3cabd1a, + 0x84d94be1, 0x75c64a6c, 0x32d5bc97, 0xfbe1a79a, 0xbcf25161, + 0xb2f897c1, 0xf5eb613a, 0x3cdf7a37, 0x7bcc8ccc, 0x20caf777, + 0x67d9018c, 0xaeed1a81, 0xe9feec7a, 0xe7f42ada, 0xa0e7dc21, + 0x69d3c72c, 0x2ec031d7, 0x956a206c, 0xd279d697, 0x1b4dcd9a, + 0x5c5e3b61, 0x5254fdc1, 0x15470b3a, 0xdc731037, 0x9b60e6cc, + 0xc0669d77, 0x87756b8c, 0x4e417081, 0x0952867a, 0x075840da, + 0x404bb621, 0x897fad2c, 0xce6c5bd7, 0x3f735a5a, 0x7860aca1, + 0xb154b7ac, 0xf6474157, 0xf84d87f7, 0xbf5e710c, 0x766a6a01, + 0x31799cfa, 0x6a7fe741, 0x2d6c11ba, 0xe4580ab7, 0xa34bfc4c, + 0xad413aec, 0xea52cc17, 0x2366d71a, 0x647521e1, 0x1a29d241, + 0x5d3a24ba, 0x940e3fb7, 0xd31dc94c, 0xdd170fec, 0x9a04f917, + 0x5330e21a, 0x142314e1, 0x4f256f5a, 0x083699a1, 0xc10282ac, + 0x86117457, 0x881bb2f7, 0xcf08440c, 0x063c5f01, 0x412fa9fa, + 0xb030a877, 0xf7235e8c, 0x3e174581, 0x7904b37a, 0x770e75da, + 0x301d8321, 0xf929982c, 0xbe3a6ed7, 0xe53c156c, 0xa22fe397, + 0x6b1bf89a, 0x2c080e61, 0x2202c8c1, 0x65113e3a, 0xac252537, + 0xeb36d3cc}, + {0x00000000, 0xa13984ee, 0x99020f9d, 0x383b8b73, 0xe975197b, + 0x484c9d95, 0x707716e6, 0xd14e9208, 0x099b34b7, 0xa8a2b059, + 0x90993b2a, 0x31a0bfc4, 0xe0ee2dcc, 0x41d7a922, 0x79ec2251, + 0xd8d5a6bf, 0x1336696e, 0xb20fed80, 0x8a3466f3, 0x2b0de21d, + 0xfa437015, 0x5b7af4fb, 0x63417f88, 0xc278fb66, 0x1aad5dd9, + 0xbb94d937, 0x83af5244, 0x2296d6aa, 0xf3d844a2, 0x52e1c04c, + 0x6ada4b3f, 0xcbe3cfd1, 0x266cd2dc, 0x87555632, 0xbf6edd41, + 0x1e5759af, 0xcf19cba7, 0x6e204f49, 0x561bc43a, 0xf72240d4, + 0x2ff7e66b, 0x8ece6285, 0xb6f5e9f6, 0x17cc6d18, 0xc682ff10, + 0x67bb7bfe, 0x5f80f08d, 0xfeb97463, 0x355abbb2, 0x94633f5c, + 0xac58b42f, 0x0d6130c1, 0xdc2fa2c9, 0x7d162627, 0x452dad54, + 0xe41429ba, 0x3cc18f05, 0x9df80beb, 0xa5c38098, 0x04fa0476, + 0xd5b4967e, 0x748d1290, 0x4cb699e3, 0xed8f1d0d, 0x4cd9a5b8, + 0xede02156, 0xd5dbaa25, 0x74e22ecb, 0xa5acbcc3, 0x0495382d, + 0x3caeb35e, 0x9d9737b0, 0x4542910f, 0xe47b15e1, 0xdc409e92, + 0x7d791a7c, 0xac378874, 0x0d0e0c9a, 0x353587e9, 0x940c0307, + 0x5fefccd6, 0xfed64838, 0xc6edc34b, 0x67d447a5, 0xb69ad5ad, + 0x17a35143, 0x2f98da30, 0x8ea15ede, 0x5674f861, 0xf74d7c8f, + 0xcf76f7fc, 0x6e4f7312, 0xbf01e11a, 0x1e3865f4, 0x2603ee87, + 0x873a6a69, 0x6ab57764, 0xcb8cf38a, 0xf3b778f9, 0x528efc17, + 0x83c06e1f, 0x22f9eaf1, 0x1ac26182, 0xbbfbe56c, 0x632e43d3, + 0xc217c73d, 0xfa2c4c4e, 0x5b15c8a0, 0x8a5b5aa8, 0x2b62de46, + 0x13595535, 0xb260d1db, 0x79831e0a, 0xd8ba9ae4, 0xe0811197, + 0x41b89579, 0x90f60771, 0x31cf839f, 0x09f408ec, 0xa8cd8c02, + 0x70182abd, 0xd121ae53, 0xe91a2520, 0x4823a1ce, 0x996d33c6, + 0x3854b728, 0x006f3c5b, 0xa156b8b5, 0x99b34b70, 0x388acf9e, + 0x00b144ed, 0xa188c003, 0x70c6520b, 0xd1ffd6e5, 0xe9c45d96, + 0x48fdd978, 0x90287fc7, 0x3111fb29, 0x092a705a, 0xa813f4b4, + 0x795d66bc, 0xd864e252, 0xe05f6921, 0x4166edcf, 0x8a85221e, + 0x2bbca6f0, 0x13872d83, 0xb2bea96d, 0x63f03b65, 0xc2c9bf8b, + 0xfaf234f8, 0x5bcbb016, 0x831e16a9, 0x22279247, 0x1a1c1934, + 0xbb259dda, 0x6a6b0fd2, 0xcb528b3c, 0xf369004f, 0x525084a1, + 0xbfdf99ac, 0x1ee61d42, 0x26dd9631, 0x87e412df, 0x56aa80d7, + 0xf7930439, 0xcfa88f4a, 0x6e910ba4, 0xb644ad1b, 0x177d29f5, + 0x2f46a286, 0x8e7f2668, 0x5f31b460, 0xfe08308e, 0xc633bbfd, + 0x670a3f13, 0xace9f0c2, 0x0dd0742c, 0x35ebff5f, 0x94d27bb1, + 0x459ce9b9, 0xe4a56d57, 0xdc9ee624, 0x7da762ca, 0xa572c475, + 0x044b409b, 0x3c70cbe8, 0x9d494f06, 0x4c07dd0e, 0xed3e59e0, + 0xd505d293, 0x743c567d, 0xd56aeec8, 0x74536a26, 0x4c68e155, + 0xed5165bb, 0x3c1ff7b3, 0x9d26735d, 0xa51df82e, 0x04247cc0, + 0xdcf1da7f, 0x7dc85e91, 0x45f3d5e2, 0xe4ca510c, 0x3584c304, + 0x94bd47ea, 0xac86cc99, 0x0dbf4877, 0xc65c87a6, 0x67650348, + 0x5f5e883b, 0xfe670cd5, 0x2f299edd, 0x8e101a33, 0xb62b9140, + 0x171215ae, 0xcfc7b311, 0x6efe37ff, 0x56c5bc8c, 0xf7fc3862, + 0x26b2aa6a, 0x878b2e84, 0xbfb0a5f7, 0x1e892119, 0xf3063c14, + 0x523fb8fa, 0x6a043389, 0xcb3db767, 0x1a73256f, 0xbb4aa181, + 0x83712af2, 0x2248ae1c, 0xfa9d08a3, 0x5ba48c4d, 0x639f073e, + 0xc2a683d0, 0x13e811d8, 0xb2d19536, 0x8aea1e45, 0x2bd39aab, + 0xe030557a, 0x4109d194, 0x79325ae7, 0xd80bde09, 0x09454c01, + 0xa87cc8ef, 0x9047439c, 0x317ec772, 0xe9ab61cd, 0x4892e523, + 0x70a96e50, 0xd190eabe, 0x00de78b6, 0xa1e7fc58, 0x99dc772b, + 0x38e5f3c5}, + {0x00000000, 0xe81790a1, 0x0b5e2703, 0xe349b7a2, 0x16bc4e06, + 0xfeabdea7, 0x1de26905, 0xf5f5f9a4, 0x2d789c0c, 0xc56f0cad, + 0x2626bb0f, 0xce312bae, 0x3bc4d20a, 0xd3d342ab, 0x309af509, + 0xd88d65a8, 0x5af13818, 0xb2e6a8b9, 0x51af1f1b, 0xb9b88fba, + 0x4c4d761e, 0xa45ae6bf, 0x4713511d, 0xaf04c1bc, 0x7789a414, + 0x9f9e34b5, 0x7cd78317, 0x94c013b6, 0x6135ea12, 0x89227ab3, + 0x6a6bcd11, 0x827c5db0, 0xb5e27030, 0x5df5e091, 0xbebc5733, + 0x56abc792, 0xa35e3e36, 0x4b49ae97, 0xa8001935, 0x40178994, + 0x989aec3c, 0x708d7c9d, 0x93c4cb3f, 0x7bd35b9e, 0x8e26a23a, + 0x6631329b, 0x85788539, 0x6d6f1598, 0xef134828, 0x0704d889, + 0xe44d6f2b, 0x0c5aff8a, 0xf9af062e, 0x11b8968f, 0xf2f1212d, + 0x1ae6b18c, 0xc26bd424, 0x2a7c4485, 0xc935f327, 0x21226386, + 0xd4d79a22, 0x3cc00a83, 0xdf89bd21, 0x379e2d80, 0xb0b5e621, + 0x58a27680, 0xbbebc122, 0x53fc5183, 0xa609a827, 0x4e1e3886, + 0xad578f24, 0x45401f85, 0x9dcd7a2d, 0x75daea8c, 0x96935d2e, + 0x7e84cd8f, 0x8b71342b, 0x6366a48a, 0x802f1328, 0x68388389, + 0xea44de39, 0x02534e98, 0xe11af93a, 0x090d699b, 0xfcf8903f, + 0x14ef009e, 0xf7a6b73c, 0x1fb1279d, 0xc73c4235, 0x2f2bd294, + 0xcc626536, 0x2475f597, 0xd1800c33, 0x39979c92, 0xdade2b30, + 0x32c9bb91, 0x05579611, 0xed4006b0, 0x0e09b112, 0xe61e21b3, + 0x13ebd817, 0xfbfc48b6, 0x18b5ff14, 0xf0a26fb5, 0x282f0a1d, + 0xc0389abc, 0x23712d1e, 0xcb66bdbf, 0x3e93441b, 0xd684d4ba, + 0x35cd6318, 0xdddaf3b9, 0x5fa6ae09, 0xb7b13ea8, 0x54f8890a, + 0xbcef19ab, 0x491ae00f, 0xa10d70ae, 0x4244c70c, 0xaa5357ad, + 0x72de3205, 0x9ac9a2a4, 0x79801506, 0x919785a7, 0x64627c03, + 0x8c75eca2, 0x6f3c5b00, 0x872bcba1, 0xba1aca03, 0x520d5aa2, + 0xb144ed00, 0x59537da1, 0xaca68405, 0x44b114a4, 0xa7f8a306, + 0x4fef33a7, 0x9762560f, 0x7f75c6ae, 0x9c3c710c, 0x742be1ad, + 0x81de1809, 0x69c988a8, 0x8a803f0a, 0x6297afab, 0xe0ebf21b, + 0x08fc62ba, 0xebb5d518, 0x03a245b9, 0xf657bc1d, 0x1e402cbc, + 0xfd099b1e, 0x151e0bbf, 0xcd936e17, 0x2584feb6, 0xc6cd4914, + 0x2edad9b5, 0xdb2f2011, 0x3338b0b0, 0xd0710712, 0x386697b3, + 0x0ff8ba33, 0xe7ef2a92, 0x04a69d30, 0xecb10d91, 0x1944f435, + 0xf1536494, 0x121ad336, 0xfa0d4397, 0x2280263f, 0xca97b69e, + 0x29de013c, 0xc1c9919d, 0x343c6839, 0xdc2bf898, 0x3f624f3a, + 0xd775df9b, 0x5509822b, 0xbd1e128a, 0x5e57a528, 0xb6403589, + 0x43b5cc2d, 0xaba25c8c, 0x48ebeb2e, 0xa0fc7b8f, 0x78711e27, + 0x90668e86, 0x732f3924, 0x9b38a985, 0x6ecd5021, 0x86dac080, + 0x65937722, 0x8d84e783, 0x0aaf2c22, 0xe2b8bc83, 0x01f10b21, + 0xe9e69b80, 0x1c136224, 0xf404f285, 0x174d4527, 0xff5ad586, + 0x27d7b02e, 0xcfc0208f, 0x2c89972d, 0xc49e078c, 0x316bfe28, + 0xd97c6e89, 0x3a35d92b, 0xd222498a, 0x505e143a, 0xb849849b, + 0x5b003339, 0xb317a398, 0x46e25a3c, 0xaef5ca9d, 0x4dbc7d3f, + 0xa5abed9e, 0x7d268836, 0x95311897, 0x7678af35, 0x9e6f3f94, + 0x6b9ac630, 0x838d5691, 0x60c4e133, 0x88d37192, 0xbf4d5c12, + 0x575accb3, 0xb4137b11, 0x5c04ebb0, 0xa9f11214, 0x41e682b5, + 0xa2af3517, 0x4ab8a5b6, 0x9235c01e, 0x7a2250bf, 0x996be71d, + 0x717c77bc, 0x84898e18, 0x6c9e1eb9, 0x8fd7a91b, 0x67c039ba, + 0xe5bc640a, 0x0dabf4ab, 0xeee24309, 0x06f5d3a8, 0xf3002a0c, + 0x1b17baad, 0xf85e0d0f, 0x10499dae, 0xc8c4f806, 0x20d368a7, + 0xc39adf05, 0x2b8d4fa4, 0xde78b600, 0x366f26a1, 0xd5269103, + 0x3d3101a2}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0xa19017e800000000, 0x03275e0b00000000, + 0xa2b749e300000000, 0x064ebc1600000000, 0xa7deabfe00000000, + 0x0569e21d00000000, 0xa4f9f5f500000000, 0x0c9c782d00000000, + 0xad0c6fc500000000, 0x0fbb262600000000, 0xae2b31ce00000000, + 0x0ad2c43b00000000, 0xab42d3d300000000, 0x09f59a3000000000, + 0xa8658dd800000000, 0x1838f15a00000000, 0xb9a8e6b200000000, + 0x1b1faf5100000000, 0xba8fb8b900000000, 0x1e764d4c00000000, + 0xbfe65aa400000000, 0x1d51134700000000, 0xbcc104af00000000, + 0x14a4897700000000, 0xb5349e9f00000000, 0x1783d77c00000000, + 0xb613c09400000000, 0x12ea356100000000, 0xb37a228900000000, + 0x11cd6b6a00000000, 0xb05d7c8200000000, 0x3070e2b500000000, + 0x91e0f55d00000000, 0x3357bcbe00000000, 0x92c7ab5600000000, + 0x363e5ea300000000, 0x97ae494b00000000, 0x351900a800000000, + 0x9489174000000000, 0x3cec9a9800000000, 0x9d7c8d7000000000, + 0x3fcbc49300000000, 0x9e5bd37b00000000, 0x3aa2268e00000000, + 0x9b32316600000000, 0x3985788500000000, 0x98156f6d00000000, + 0x284813ef00000000, 0x89d8040700000000, 0x2b6f4de400000000, + 0x8aff5a0c00000000, 0x2e06aff900000000, 0x8f96b81100000000, + 0x2d21f1f200000000, 0x8cb1e61a00000000, 0x24d46bc200000000, + 0x85447c2a00000000, 0x27f335c900000000, 0x8663222100000000, + 0x229ad7d400000000, 0x830ac03c00000000, 0x21bd89df00000000, + 0x802d9e3700000000, 0x21e6b5b000000000, 0x8076a25800000000, + 0x22c1ebbb00000000, 0x8351fc5300000000, 0x27a809a600000000, + 0x86381e4e00000000, 0x248f57ad00000000, 0x851f404500000000, + 0x2d7acd9d00000000, 0x8ceada7500000000, 0x2e5d939600000000, + 0x8fcd847e00000000, 0x2b34718b00000000, 0x8aa4666300000000, + 0x28132f8000000000, 0x8983386800000000, 0x39de44ea00000000, + 0x984e530200000000, 0x3af91ae100000000, 0x9b690d0900000000, + 0x3f90f8fc00000000, 0x9e00ef1400000000, 0x3cb7a6f700000000, + 0x9d27b11f00000000, 0x35423cc700000000, 0x94d22b2f00000000, + 0x366562cc00000000, 0x97f5752400000000, 0x330c80d100000000, + 0x929c973900000000, 0x302bdeda00000000, 0x91bbc93200000000, + 0x1196570500000000, 0xb00640ed00000000, 0x12b1090e00000000, + 0xb3211ee600000000, 0x17d8eb1300000000, 0xb648fcfb00000000, + 0x14ffb51800000000, 0xb56fa2f000000000, 0x1d0a2f2800000000, + 0xbc9a38c000000000, 0x1e2d712300000000, 0xbfbd66cb00000000, + 0x1b44933e00000000, 0xbad484d600000000, 0x1863cd3500000000, + 0xb9f3dadd00000000, 0x09aea65f00000000, 0xa83eb1b700000000, + 0x0a89f85400000000, 0xab19efbc00000000, 0x0fe01a4900000000, + 0xae700da100000000, 0x0cc7444200000000, 0xad5753aa00000000, + 0x0532de7200000000, 0xa4a2c99a00000000, 0x0615807900000000, + 0xa785979100000000, 0x037c626400000000, 0xa2ec758c00000000, + 0x005b3c6f00000000, 0xa1cb2b8700000000, 0x03ca1aba00000000, + 0xa25a0d5200000000, 0x00ed44b100000000, 0xa17d535900000000, + 0x0584a6ac00000000, 0xa414b14400000000, 0x06a3f8a700000000, + 0xa733ef4f00000000, 0x0f56629700000000, 0xaec6757f00000000, + 0x0c713c9c00000000, 0xade12b7400000000, 0x0918de8100000000, + 0xa888c96900000000, 0x0a3f808a00000000, 0xabaf976200000000, + 0x1bf2ebe000000000, 0xba62fc0800000000, 0x18d5b5eb00000000, + 0xb945a20300000000, 0x1dbc57f600000000, 0xbc2c401e00000000, + 0x1e9b09fd00000000, 0xbf0b1e1500000000, 0x176e93cd00000000, + 0xb6fe842500000000, 0x1449cdc600000000, 0xb5d9da2e00000000, + 0x11202fdb00000000, 0xb0b0383300000000, 0x120771d000000000, + 0xb397663800000000, 0x33baf80f00000000, 0x922aefe700000000, + 0x309da60400000000, 0x910db1ec00000000, 0x35f4441900000000, + 0x946453f100000000, 0x36d31a1200000000, 0x97430dfa00000000, + 0x3f26802200000000, 0x9eb697ca00000000, 0x3c01de2900000000, + 0x9d91c9c100000000, 0x39683c3400000000, 0x98f82bdc00000000, + 0x3a4f623f00000000, 0x9bdf75d700000000, 0x2b82095500000000, + 0x8a121ebd00000000, 0x28a5575e00000000, 0x893540b600000000, + 0x2dccb54300000000, 0x8c5ca2ab00000000, 0x2eebeb4800000000, + 0x8f7bfca000000000, 0x271e717800000000, 0x868e669000000000, + 0x24392f7300000000, 0x85a9389b00000000, 0x2150cd6e00000000, + 0x80c0da8600000000, 0x2277936500000000, 0x83e7848d00000000, + 0x222caf0a00000000, 0x83bcb8e200000000, 0x210bf10100000000, + 0x809be6e900000000, 0x2462131c00000000, 0x85f204f400000000, + 0x27454d1700000000, 0x86d55aff00000000, 0x2eb0d72700000000, + 0x8f20c0cf00000000, 0x2d97892c00000000, 0x8c079ec400000000, + 0x28fe6b3100000000, 0x896e7cd900000000, 0x2bd9353a00000000, + 0x8a4922d200000000, 0x3a145e5000000000, 0x9b8449b800000000, + 0x3933005b00000000, 0x98a317b300000000, 0x3c5ae24600000000, + 0x9dcaf5ae00000000, 0x3f7dbc4d00000000, 0x9eedaba500000000, + 0x3688267d00000000, 0x9718319500000000, 0x35af787600000000, + 0x943f6f9e00000000, 0x30c69a6b00000000, 0x91568d8300000000, + 0x33e1c46000000000, 0x9271d38800000000, 0x125c4dbf00000000, + 0xb3cc5a5700000000, 0x117b13b400000000, 0xb0eb045c00000000, + 0x1412f1a900000000, 0xb582e64100000000, 0x1735afa200000000, + 0xb6a5b84a00000000, 0x1ec0359200000000, 0xbf50227a00000000, + 0x1de76b9900000000, 0xbc777c7100000000, 0x188e898400000000, + 0xb91e9e6c00000000, 0x1ba9d78f00000000, 0xba39c06700000000, + 0x0a64bce500000000, 0xabf4ab0d00000000, 0x0943e2ee00000000, + 0xa8d3f50600000000, 0x0c2a00f300000000, 0xadba171b00000000, + 0x0f0d5ef800000000, 0xae9d491000000000, 0x06f8c4c800000000, + 0xa768d32000000000, 0x05df9ac300000000, 0xa44f8d2b00000000, + 0x00b678de00000000, 0xa1266f3600000000, 0x039126d500000000, + 0xa201313d00000000}, + {0x0000000000000000, 0xee8439a100000000, 0x9d0f029900000000, + 0x738b3b3800000000, 0x7b1975e900000000, 0x959d4c4800000000, + 0xe616777000000000, 0x08924ed100000000, 0xb7349b0900000000, + 0x59b0a2a800000000, 0x2a3b999000000000, 0xc4bfa03100000000, + 0xcc2deee000000000, 0x22a9d74100000000, 0x5122ec7900000000, + 0xbfa6d5d800000000, 0x6e69361300000000, 0x80ed0fb200000000, + 0xf366348a00000000, 0x1de20d2b00000000, 0x157043fa00000000, + 0xfbf47a5b00000000, 0x887f416300000000, 0x66fb78c200000000, + 0xd95dad1a00000000, 0x37d994bb00000000, 0x4452af8300000000, + 0xaad6962200000000, 0xa244d8f300000000, 0x4cc0e15200000000, + 0x3f4bda6a00000000, 0xd1cfe3cb00000000, 0xdcd26c2600000000, + 0x3256558700000000, 0x41dd6ebf00000000, 0xaf59571e00000000, + 0xa7cb19cf00000000, 0x494f206e00000000, 0x3ac41b5600000000, + 0xd44022f700000000, 0x6be6f72f00000000, 0x8562ce8e00000000, + 0xf6e9f5b600000000, 0x186dcc1700000000, 0x10ff82c600000000, + 0xfe7bbb6700000000, 0x8df0805f00000000, 0x6374b9fe00000000, + 0xb2bb5a3500000000, 0x5c3f639400000000, 0x2fb458ac00000000, + 0xc130610d00000000, 0xc9a22fdc00000000, 0x2726167d00000000, + 0x54ad2d4500000000, 0xba2914e400000000, 0x058fc13c00000000, + 0xeb0bf89d00000000, 0x9880c3a500000000, 0x7604fa0400000000, + 0x7e96b4d500000000, 0x90128d7400000000, 0xe399b64c00000000, + 0x0d1d8fed00000000, 0xb8a5d94c00000000, 0x5621e0ed00000000, + 0x25aadbd500000000, 0xcb2ee27400000000, 0xc3bcaca500000000, + 0x2d38950400000000, 0x5eb3ae3c00000000, 0xb037979d00000000, + 0x0f91424500000000, 0xe1157be400000000, 0x929e40dc00000000, + 0x7c1a797d00000000, 0x748837ac00000000, 0x9a0c0e0d00000000, + 0xe987353500000000, 0x07030c9400000000, 0xd6ccef5f00000000, + 0x3848d6fe00000000, 0x4bc3edc600000000, 0xa547d46700000000, + 0xadd59ab600000000, 0x4351a31700000000, 0x30da982f00000000, + 0xde5ea18e00000000, 0x61f8745600000000, 0x8f7c4df700000000, + 0xfcf776cf00000000, 0x12734f6e00000000, 0x1ae101bf00000000, + 0xf465381e00000000, 0x87ee032600000000, 0x696a3a8700000000, + 0x6477b56a00000000, 0x8af38ccb00000000, 0xf978b7f300000000, + 0x17fc8e5200000000, 0x1f6ec08300000000, 0xf1eaf92200000000, + 0x8261c21a00000000, 0x6ce5fbbb00000000, 0xd3432e6300000000, + 0x3dc717c200000000, 0x4e4c2cfa00000000, 0xa0c8155b00000000, + 0xa85a5b8a00000000, 0x46de622b00000000, 0x3555591300000000, + 0xdbd160b200000000, 0x0a1e837900000000, 0xe49abad800000000, + 0x971181e000000000, 0x7995b84100000000, 0x7107f69000000000, + 0x9f83cf3100000000, 0xec08f40900000000, 0x028ccda800000000, + 0xbd2a187000000000, 0x53ae21d100000000, 0x20251ae900000000, + 0xcea1234800000000, 0xc6336d9900000000, 0x28b7543800000000, + 0x5b3c6f0000000000, 0xb5b856a100000000, 0x704bb39900000000, + 0x9ecf8a3800000000, 0xed44b10000000000, 0x03c088a100000000, + 0x0b52c67000000000, 0xe5d6ffd100000000, 0x965dc4e900000000, + 0x78d9fd4800000000, 0xc77f289000000000, 0x29fb113100000000, + 0x5a702a0900000000, 0xb4f413a800000000, 0xbc665d7900000000, + 0x52e264d800000000, 0x21695fe000000000, 0xcfed664100000000, + 0x1e22858a00000000, 0xf0a6bc2b00000000, 0x832d871300000000, + 0x6da9beb200000000, 0x653bf06300000000, 0x8bbfc9c200000000, + 0xf834f2fa00000000, 0x16b0cb5b00000000, 0xa9161e8300000000, + 0x4792272200000000, 0x34191c1a00000000, 0xda9d25bb00000000, + 0xd20f6b6a00000000, 0x3c8b52cb00000000, 0x4f0069f300000000, + 0xa184505200000000, 0xac99dfbf00000000, 0x421de61e00000000, + 0x3196dd2600000000, 0xdf12e48700000000, 0xd780aa5600000000, + 0x390493f700000000, 0x4a8fa8cf00000000, 0xa40b916e00000000, + 0x1bad44b600000000, 0xf5297d1700000000, 0x86a2462f00000000, + 0x68267f8e00000000, 0x60b4315f00000000, 0x8e3008fe00000000, + 0xfdbb33c600000000, 0x133f0a6700000000, 0xc2f0e9ac00000000, + 0x2c74d00d00000000, 0x5fffeb3500000000, 0xb17bd29400000000, + 0xb9e99c4500000000, 0x576da5e400000000, 0x24e69edc00000000, + 0xca62a77d00000000, 0x75c472a500000000, 0x9b404b0400000000, + 0xe8cb703c00000000, 0x064f499d00000000, 0x0edd074c00000000, + 0xe0593eed00000000, 0x93d205d500000000, 0x7d563c7400000000, + 0xc8ee6ad500000000, 0x266a537400000000, 0x55e1684c00000000, + 0xbb6551ed00000000, 0xb3f71f3c00000000, 0x5d73269d00000000, + 0x2ef81da500000000, 0xc07c240400000000, 0x7fdaf1dc00000000, + 0x915ec87d00000000, 0xe2d5f34500000000, 0x0c51cae400000000, + 0x04c3843500000000, 0xea47bd9400000000, 0x99cc86ac00000000, + 0x7748bf0d00000000, 0xa6875cc600000000, 0x4803656700000000, + 0x3b885e5f00000000, 0xd50c67fe00000000, 0xdd9e292f00000000, + 0x331a108e00000000, 0x40912bb600000000, 0xae15121700000000, + 0x11b3c7cf00000000, 0xff37fe6e00000000, 0x8cbcc55600000000, + 0x6238fcf700000000, 0x6aaab22600000000, 0x842e8b8700000000, + 0xf7a5b0bf00000000, 0x1921891e00000000, 0x143c06f300000000, + 0xfab83f5200000000, 0x8933046a00000000, 0x67b73dcb00000000, + 0x6f25731a00000000, 0x81a14abb00000000, 0xf22a718300000000, + 0x1cae482200000000, 0xa3089dfa00000000, 0x4d8ca45b00000000, + 0x3e079f6300000000, 0xd083a6c200000000, 0xd811e81300000000, + 0x3695d1b200000000, 0x451eea8a00000000, 0xab9ad32b00000000, + 0x7a5530e000000000, 0x94d1094100000000, 0xe75a327900000000, + 0x09de0bd800000000, 0x014c450900000000, 0xefc87ca800000000, + 0x9c43479000000000, 0x72c77e3100000000, 0xcd61abe900000000, + 0x23e5924800000000, 0x506ea97000000000, 0xbeea90d100000000, + 0xb678de0000000000, 0x58fce7a100000000, 0x2b77dc9900000000, + 0xc5f3e53800000000}, + {0x0000000000000000, 0xfbf6134700000000, 0xf6ed278e00000000, + 0x0d1b34c900000000, 0xaddd3ec700000000, 0x562b2d8000000000, + 0x5b30194900000000, 0xa0c60a0e00000000, 0x1bbd0c5500000000, + 0xe04b1f1200000000, 0xed502bdb00000000, 0x16a6389c00000000, + 0xb660329200000000, 0x4d9621d500000000, 0x408d151c00000000, + 0xbb7b065b00000000, 0x367a19aa00000000, 0xcd8c0aed00000000, + 0xc0973e2400000000, 0x3b612d6300000000, 0x9ba7276d00000000, + 0x6051342a00000000, 0x6d4a00e300000000, 0x96bc13a400000000, + 0x2dc715ff00000000, 0xd63106b800000000, 0xdb2a327100000000, + 0x20dc213600000000, 0x801a2b3800000000, 0x7bec387f00000000, + 0x76f70cb600000000, 0x8d011ff100000000, 0x2df2438f00000000, + 0xd60450c800000000, 0xdb1f640100000000, 0x20e9774600000000, + 0x802f7d4800000000, 0x7bd96e0f00000000, 0x76c25ac600000000, + 0x8d34498100000000, 0x364f4fda00000000, 0xcdb95c9d00000000, + 0xc0a2685400000000, 0x3b547b1300000000, 0x9b92711d00000000, + 0x6064625a00000000, 0x6d7f569300000000, 0x968945d400000000, + 0x1b885a2500000000, 0xe07e496200000000, 0xed657dab00000000, + 0x16936eec00000000, 0xb65564e200000000, 0x4da377a500000000, + 0x40b8436c00000000, 0xbb4e502b00000000, 0x0035567000000000, + 0xfbc3453700000000, 0xf6d871fe00000000, 0x0d2e62b900000000, + 0xade868b700000000, 0x561e7bf000000000, 0x5b054f3900000000, + 0xa0f35c7e00000000, 0x1be2f6c500000000, 0xe014e58200000000, + 0xed0fd14b00000000, 0x16f9c20c00000000, 0xb63fc80200000000, + 0x4dc9db4500000000, 0x40d2ef8c00000000, 0xbb24fccb00000000, + 0x005ffa9000000000, 0xfba9e9d700000000, 0xf6b2dd1e00000000, + 0x0d44ce5900000000, 0xad82c45700000000, 0x5674d71000000000, + 0x5b6fe3d900000000, 0xa099f09e00000000, 0x2d98ef6f00000000, + 0xd66efc2800000000, 0xdb75c8e100000000, 0x2083dba600000000, + 0x8045d1a800000000, 0x7bb3c2ef00000000, 0x76a8f62600000000, + 0x8d5ee56100000000, 0x3625e33a00000000, 0xcdd3f07d00000000, + 0xc0c8c4b400000000, 0x3b3ed7f300000000, 0x9bf8ddfd00000000, + 0x600eceba00000000, 0x6d15fa7300000000, 0x96e3e93400000000, + 0x3610b54a00000000, 0xcde6a60d00000000, 0xc0fd92c400000000, + 0x3b0b818300000000, 0x9bcd8b8d00000000, 0x603b98ca00000000, + 0x6d20ac0300000000, 0x96d6bf4400000000, 0x2dadb91f00000000, + 0xd65baa5800000000, 0xdb409e9100000000, 0x20b68dd600000000, + 0x807087d800000000, 0x7b86949f00000000, 0x769da05600000000, + 0x8d6bb31100000000, 0x006aace000000000, 0xfb9cbfa700000000, + 0xf6878b6e00000000, 0x0d71982900000000, 0xadb7922700000000, + 0x5641816000000000, 0x5b5ab5a900000000, 0xa0aca6ee00000000, + 0x1bd7a0b500000000, 0xe021b3f200000000, 0xed3a873b00000000, + 0x16cc947c00000000, 0xb60a9e7200000000, 0x4dfc8d3500000000, + 0x40e7b9fc00000000, 0xbb11aabb00000000, 0x77c29c5000000000, + 0x8c348f1700000000, 0x812fbbde00000000, 0x7ad9a89900000000, + 0xda1fa29700000000, 0x21e9b1d000000000, 0x2cf2851900000000, + 0xd704965e00000000, 0x6c7f900500000000, 0x9789834200000000, + 0x9a92b78b00000000, 0x6164a4cc00000000, 0xc1a2aec200000000, + 0x3a54bd8500000000, 0x374f894c00000000, 0xccb99a0b00000000, + 0x41b885fa00000000, 0xba4e96bd00000000, 0xb755a27400000000, + 0x4ca3b13300000000, 0xec65bb3d00000000, 0x1793a87a00000000, + 0x1a889cb300000000, 0xe17e8ff400000000, 0x5a0589af00000000, + 0xa1f39ae800000000, 0xace8ae2100000000, 0x571ebd6600000000, + 0xf7d8b76800000000, 0x0c2ea42f00000000, 0x013590e600000000, + 0xfac383a100000000, 0x5a30dfdf00000000, 0xa1c6cc9800000000, + 0xacddf85100000000, 0x572beb1600000000, 0xf7ede11800000000, + 0x0c1bf25f00000000, 0x0100c69600000000, 0xfaf6d5d100000000, + 0x418dd38a00000000, 0xba7bc0cd00000000, 0xb760f40400000000, + 0x4c96e74300000000, 0xec50ed4d00000000, 0x17a6fe0a00000000, + 0x1abdcac300000000, 0xe14bd98400000000, 0x6c4ac67500000000, + 0x97bcd53200000000, 0x9aa7e1fb00000000, 0x6151f2bc00000000, + 0xc197f8b200000000, 0x3a61ebf500000000, 0x377adf3c00000000, + 0xcc8ccc7b00000000, 0x77f7ca2000000000, 0x8c01d96700000000, + 0x811aedae00000000, 0x7aecfee900000000, 0xda2af4e700000000, + 0x21dce7a000000000, 0x2cc7d36900000000, 0xd731c02e00000000, + 0x6c206a9500000000, 0x97d679d200000000, 0x9acd4d1b00000000, + 0x613b5e5c00000000, 0xc1fd545200000000, 0x3a0b471500000000, + 0x371073dc00000000, 0xcce6609b00000000, 0x779d66c000000000, + 0x8c6b758700000000, 0x8170414e00000000, 0x7a86520900000000, + 0xda40580700000000, 0x21b64b4000000000, 0x2cad7f8900000000, + 0xd75b6cce00000000, 0x5a5a733f00000000, 0xa1ac607800000000, + 0xacb754b100000000, 0x574147f600000000, 0xf7874df800000000, + 0x0c715ebf00000000, 0x016a6a7600000000, 0xfa9c793100000000, + 0x41e77f6a00000000, 0xba116c2d00000000, 0xb70a58e400000000, + 0x4cfc4ba300000000, 0xec3a41ad00000000, 0x17cc52ea00000000, + 0x1ad7662300000000, 0xe121756400000000, 0x41d2291a00000000, + 0xba243a5d00000000, 0xb73f0e9400000000, 0x4cc91dd300000000, + 0xec0f17dd00000000, 0x17f9049a00000000, 0x1ae2305300000000, + 0xe114231400000000, 0x5a6f254f00000000, 0xa199360800000000, + 0xac8202c100000000, 0x5774118600000000, 0xf7b21b8800000000, + 0x0c4408cf00000000, 0x015f3c0600000000, 0xfaa92f4100000000, + 0x77a830b000000000, 0x8c5e23f700000000, 0x8145173e00000000, + 0x7ab3047900000000, 0xda750e7700000000, 0x21831d3000000000, + 0x2c9829f900000000, 0xd76e3abe00000000, 0x6c153ce500000000, + 0x97e32fa200000000, 0x9af81b6b00000000, 0x610e082c00000000, + 0xc1c8022200000000, 0x3a3e116500000000, 0x372525ac00000000, + 0xccd336eb00000000}, + {0x0000000000000000, 0x6238282a00000000, 0xc470505400000000, + 0xa648787e00000000, 0x88e1a0a800000000, 0xead9888200000000, + 0x4c91f0fc00000000, 0x2ea9d8d600000000, 0x51c5308a00000000, + 0x33fd18a000000000, 0x95b560de00000000, 0xf78d48f400000000, + 0xd924902200000000, 0xbb1cb80800000000, 0x1d54c07600000000, + 0x7f6ce85c00000000, 0xe38c10cf00000000, 0x81b438e500000000, + 0x27fc409b00000000, 0x45c468b100000000, 0x6b6db06700000000, + 0x0955984d00000000, 0xaf1de03300000000, 0xcd25c81900000000, + 0xb249204500000000, 0xd071086f00000000, 0x7639701100000000, + 0x1401583b00000000, 0x3aa880ed00000000, 0x5890a8c700000000, + 0xfed8d0b900000000, 0x9ce0f89300000000, 0x871f504500000000, + 0xe527786f00000000, 0x436f001100000000, 0x2157283b00000000, + 0x0ffef0ed00000000, 0x6dc6d8c700000000, 0xcb8ea0b900000000, + 0xa9b6889300000000, 0xd6da60cf00000000, 0xb4e248e500000000, + 0x12aa309b00000000, 0x709218b100000000, 0x5e3bc06700000000, + 0x3c03e84d00000000, 0x9a4b903300000000, 0xf873b81900000000, + 0x6493408a00000000, 0x06ab68a000000000, 0xa0e310de00000000, + 0xc2db38f400000000, 0xec72e02200000000, 0x8e4ac80800000000, + 0x2802b07600000000, 0x4a3a985c00000000, 0x3556700000000000, + 0x576e582a00000000, 0xf126205400000000, 0x931e087e00000000, + 0xbdb7d0a800000000, 0xdf8ff88200000000, 0x79c780fc00000000, + 0x1bffa8d600000000, 0x0e3fa08a00000000, 0x6c0788a000000000, + 0xca4ff0de00000000, 0xa877d8f400000000, 0x86de002200000000, + 0xe4e6280800000000, 0x42ae507600000000, 0x2096785c00000000, + 0x5ffa900000000000, 0x3dc2b82a00000000, 0x9b8ac05400000000, + 0xf9b2e87e00000000, 0xd71b30a800000000, 0xb523188200000000, + 0x136b60fc00000000, 0x715348d600000000, 0xedb3b04500000000, + 0x8f8b986f00000000, 0x29c3e01100000000, 0x4bfbc83b00000000, + 0x655210ed00000000, 0x076a38c700000000, 0xa12240b900000000, + 0xc31a689300000000, 0xbc7680cf00000000, 0xde4ea8e500000000, + 0x7806d09b00000000, 0x1a3ef8b100000000, 0x3497206700000000, + 0x56af084d00000000, 0xf0e7703300000000, 0x92df581900000000, + 0x8920f0cf00000000, 0xeb18d8e500000000, 0x4d50a09b00000000, + 0x2f6888b100000000, 0x01c1506700000000, 0x63f9784d00000000, + 0xc5b1003300000000, 0xa789281900000000, 0xd8e5c04500000000, + 0xbadde86f00000000, 0x1c95901100000000, 0x7eadb83b00000000, + 0x500460ed00000000, 0x323c48c700000000, 0x947430b900000000, + 0xf64c189300000000, 0x6aace00000000000, 0x0894c82a00000000, + 0xaedcb05400000000, 0xcce4987e00000000, 0xe24d40a800000000, + 0x8075688200000000, 0x263d10fc00000000, 0x440538d600000000, + 0x3b69d08a00000000, 0x5951f8a000000000, 0xff1980de00000000, + 0x9d21a8f400000000, 0xb388702200000000, 0xd1b0580800000000, + 0x77f8207600000000, 0x15c0085c00000000, 0x5d7831ce00000000, + 0x3f4019e400000000, 0x9908619a00000000, 0xfb3049b000000000, + 0xd599916600000000, 0xb7a1b94c00000000, 0x11e9c13200000000, + 0x73d1e91800000000, 0x0cbd014400000000, 0x6e85296e00000000, + 0xc8cd511000000000, 0xaaf5793a00000000, 0x845ca1ec00000000, + 0xe66489c600000000, 0x402cf1b800000000, 0x2214d99200000000, + 0xbef4210100000000, 0xdccc092b00000000, 0x7a84715500000000, + 0x18bc597f00000000, 0x361581a900000000, 0x542da98300000000, + 0xf265d1fd00000000, 0x905df9d700000000, 0xef31118b00000000, + 0x8d0939a100000000, 0x2b4141df00000000, 0x497969f500000000, + 0x67d0b12300000000, 0x05e8990900000000, 0xa3a0e17700000000, + 0xc198c95d00000000, 0xda67618b00000000, 0xb85f49a100000000, + 0x1e1731df00000000, 0x7c2f19f500000000, 0x5286c12300000000, + 0x30bee90900000000, 0x96f6917700000000, 0xf4ceb95d00000000, + 0x8ba2510100000000, 0xe99a792b00000000, 0x4fd2015500000000, + 0x2dea297f00000000, 0x0343f1a900000000, 0x617bd98300000000, + 0xc733a1fd00000000, 0xa50b89d700000000, 0x39eb714400000000, + 0x5bd3596e00000000, 0xfd9b211000000000, 0x9fa3093a00000000, + 0xb10ad1ec00000000, 0xd332f9c600000000, 0x757a81b800000000, + 0x1742a99200000000, 0x682e41ce00000000, 0x0a1669e400000000, + 0xac5e119a00000000, 0xce6639b000000000, 0xe0cfe16600000000, + 0x82f7c94c00000000, 0x24bfb13200000000, 0x4687991800000000, + 0x5347914400000000, 0x317fb96e00000000, 0x9737c11000000000, + 0xf50fe93a00000000, 0xdba631ec00000000, 0xb99e19c600000000, + 0x1fd661b800000000, 0x7dee499200000000, 0x0282a1ce00000000, + 0x60ba89e400000000, 0xc6f2f19a00000000, 0xa4cad9b000000000, + 0x8a63016600000000, 0xe85b294c00000000, 0x4e13513200000000, + 0x2c2b791800000000, 0xb0cb818b00000000, 0xd2f3a9a100000000, + 0x74bbd1df00000000, 0x1683f9f500000000, 0x382a212300000000, + 0x5a12090900000000, 0xfc5a717700000000, 0x9e62595d00000000, + 0xe10eb10100000000, 0x8336992b00000000, 0x257ee15500000000, + 0x4746c97f00000000, 0x69ef11a900000000, 0x0bd7398300000000, + 0xad9f41fd00000000, 0xcfa769d700000000, 0xd458c10100000000, + 0xb660e92b00000000, 0x1028915500000000, 0x7210b97f00000000, + 0x5cb961a900000000, 0x3e81498300000000, 0x98c931fd00000000, + 0xfaf119d700000000, 0x859df18b00000000, 0xe7a5d9a100000000, + 0x41eda1df00000000, 0x23d589f500000000, 0x0d7c512300000000, + 0x6f44790900000000, 0xc90c017700000000, 0xab34295d00000000, + 0x37d4d1ce00000000, 0x55ecf9e400000000, 0xf3a4819a00000000, + 0x919ca9b000000000, 0xbf35716600000000, 0xdd0d594c00000000, + 0x7b45213200000000, 0x197d091800000000, 0x6611e14400000000, + 0x0429c96e00000000, 0xa261b11000000000, 0xc059993a00000000, + 0xeef041ec00000000, 0x8cc869c600000000, 0x2a8011b800000000, + 0x48b8399200000000}, + {0x0000000000000000, 0x4c2896a300000000, 0xd9565d9c00000000, + 0x957ecb3f00000000, 0xf3abcbe300000000, 0xbf835d4000000000, + 0x2afd967f00000000, 0x66d500dc00000000, 0xa751e61c00000000, + 0xeb7970bf00000000, 0x7e07bb8000000000, 0x322f2d2300000000, + 0x54fa2dff00000000, 0x18d2bb5c00000000, 0x8dac706300000000, + 0xc184e6c000000000, 0x4ea3cc3900000000, 0x028b5a9a00000000, + 0x97f591a500000000, 0xdbdd070600000000, 0xbd0807da00000000, + 0xf120917900000000, 0x645e5a4600000000, 0x2876cce500000000, + 0xe9f22a2500000000, 0xa5dabc8600000000, 0x30a477b900000000, + 0x7c8ce11a00000000, 0x1a59e1c600000000, 0x5671776500000000, + 0xc30fbc5a00000000, 0x8f272af900000000, 0x9c46997300000000, + 0xd06e0fd000000000, 0x4510c4ef00000000, 0x0938524c00000000, + 0x6fed529000000000, 0x23c5c43300000000, 0xb6bb0f0c00000000, + 0xfa9399af00000000, 0x3b177f6f00000000, 0x773fe9cc00000000, + 0xe24122f300000000, 0xae69b45000000000, 0xc8bcb48c00000000, + 0x8494222f00000000, 0x11eae91000000000, 0x5dc27fb300000000, + 0xd2e5554a00000000, 0x9ecdc3e900000000, 0x0bb308d600000000, + 0x479b9e7500000000, 0x214e9ea900000000, 0x6d66080a00000000, + 0xf818c33500000000, 0xb430559600000000, 0x75b4b35600000000, + 0x399c25f500000000, 0xace2eeca00000000, 0xe0ca786900000000, + 0x861f78b500000000, 0xca37ee1600000000, 0x5f49252900000000, + 0x1361b38a00000000, 0x388d32e700000000, 0x74a5a44400000000, + 0xe1db6f7b00000000, 0xadf3f9d800000000, 0xcb26f90400000000, + 0x870e6fa700000000, 0x1270a49800000000, 0x5e58323b00000000, + 0x9fdcd4fb00000000, 0xd3f4425800000000, 0x468a896700000000, + 0x0aa21fc400000000, 0x6c771f1800000000, 0x205f89bb00000000, + 0xb521428400000000, 0xf909d42700000000, 0x762efede00000000, + 0x3a06687d00000000, 0xaf78a34200000000, 0xe35035e100000000, + 0x8585353d00000000, 0xc9ada39e00000000, 0x5cd368a100000000, + 0x10fbfe0200000000, 0xd17f18c200000000, 0x9d578e6100000000, + 0x0829455e00000000, 0x4401d3fd00000000, 0x22d4d32100000000, + 0x6efc458200000000, 0xfb828ebd00000000, 0xb7aa181e00000000, + 0xa4cbab9400000000, 0xe8e33d3700000000, 0x7d9df60800000000, + 0x31b560ab00000000, 0x5760607700000000, 0x1b48f6d400000000, + 0x8e363deb00000000, 0xc21eab4800000000, 0x039a4d8800000000, + 0x4fb2db2b00000000, 0xdacc101400000000, 0x96e486b700000000, + 0xf031866b00000000, 0xbc1910c800000000, 0x2967dbf700000000, + 0x654f4d5400000000, 0xea6867ad00000000, 0xa640f10e00000000, + 0x333e3a3100000000, 0x7f16ac9200000000, 0x19c3ac4e00000000, + 0x55eb3aed00000000, 0xc095f1d200000000, 0x8cbd677100000000, + 0x4d3981b100000000, 0x0111171200000000, 0x946fdc2d00000000, + 0xd8474a8e00000000, 0xbe924a5200000000, 0xf2badcf100000000, + 0x67c417ce00000000, 0x2bec816d00000000, 0x311c141500000000, + 0x7d3482b600000000, 0xe84a498900000000, 0xa462df2a00000000, + 0xc2b7dff600000000, 0x8e9f495500000000, 0x1be1826a00000000, + 0x57c914c900000000, 0x964df20900000000, 0xda6564aa00000000, + 0x4f1baf9500000000, 0x0333393600000000, 0x65e639ea00000000, + 0x29ceaf4900000000, 0xbcb0647600000000, 0xf098f2d500000000, + 0x7fbfd82c00000000, 0x33974e8f00000000, 0xa6e985b000000000, + 0xeac1131300000000, 0x8c1413cf00000000, 0xc03c856c00000000, + 0x55424e5300000000, 0x196ad8f000000000, 0xd8ee3e3000000000, + 0x94c6a89300000000, 0x01b863ac00000000, 0x4d90f50f00000000, + 0x2b45f5d300000000, 0x676d637000000000, 0xf213a84f00000000, + 0xbe3b3eec00000000, 0xad5a8d6600000000, 0xe1721bc500000000, + 0x740cd0fa00000000, 0x3824465900000000, 0x5ef1468500000000, + 0x12d9d02600000000, 0x87a71b1900000000, 0xcb8f8dba00000000, + 0x0a0b6b7a00000000, 0x4623fdd900000000, 0xd35d36e600000000, + 0x9f75a04500000000, 0xf9a0a09900000000, 0xb588363a00000000, + 0x20f6fd0500000000, 0x6cde6ba600000000, 0xe3f9415f00000000, + 0xafd1d7fc00000000, 0x3aaf1cc300000000, 0x76878a6000000000, + 0x10528abc00000000, 0x5c7a1c1f00000000, 0xc904d72000000000, + 0x852c418300000000, 0x44a8a74300000000, 0x088031e000000000, + 0x9dfefadf00000000, 0xd1d66c7c00000000, 0xb7036ca000000000, + 0xfb2bfa0300000000, 0x6e55313c00000000, 0x227da79f00000000, + 0x099126f200000000, 0x45b9b05100000000, 0xd0c77b6e00000000, + 0x9cefedcd00000000, 0xfa3aed1100000000, 0xb6127bb200000000, + 0x236cb08d00000000, 0x6f44262e00000000, 0xaec0c0ee00000000, + 0xe2e8564d00000000, 0x77969d7200000000, 0x3bbe0bd100000000, + 0x5d6b0b0d00000000, 0x11439dae00000000, 0x843d569100000000, + 0xc815c03200000000, 0x4732eacb00000000, 0x0b1a7c6800000000, + 0x9e64b75700000000, 0xd24c21f400000000, 0xb499212800000000, + 0xf8b1b78b00000000, 0x6dcf7cb400000000, 0x21e7ea1700000000, + 0xe0630cd700000000, 0xac4b9a7400000000, 0x3935514b00000000, + 0x751dc7e800000000, 0x13c8c73400000000, 0x5fe0519700000000, + 0xca9e9aa800000000, 0x86b60c0b00000000, 0x95d7bf8100000000, + 0xd9ff292200000000, 0x4c81e21d00000000, 0x00a974be00000000, + 0x667c746200000000, 0x2a54e2c100000000, 0xbf2a29fe00000000, + 0xf302bf5d00000000, 0x3286599d00000000, 0x7eaecf3e00000000, + 0xebd0040100000000, 0xa7f892a200000000, 0xc12d927e00000000, + 0x8d0504dd00000000, 0x187bcfe200000000, 0x5453594100000000, + 0xdb7473b800000000, 0x975ce51b00000000, 0x02222e2400000000, + 0x4e0ab88700000000, 0x28dfb85b00000000, 0x64f72ef800000000, + 0xf189e5c700000000, 0xbda1736400000000, 0x7c2595a400000000, + 0x300d030700000000, 0xa573c83800000000, 0xe95b5e9b00000000, + 0x8f8e5e4700000000, 0xc3a6c8e400000000, 0x56d803db00000000, + 0x1af0957800000000}, + {0x0000000000000000, 0x939bc97f00000000, 0x263793ff00000000, + 0xb5ac5a8000000000, 0x0d68572400000000, 0x9ef39e5b00000000, + 0x2b5fc4db00000000, 0xb8c40da400000000, 0x1ad0ae4800000000, + 0x894b673700000000, 0x3ce73db700000000, 0xaf7cf4c800000000, + 0x17b8f96c00000000, 0x8423301300000000, 0x318f6a9300000000, + 0xa214a3ec00000000, 0x34a05d9100000000, 0xa73b94ee00000000, + 0x1297ce6e00000000, 0x810c071100000000, 0x39c80ab500000000, + 0xaa53c3ca00000000, 0x1fff994a00000000, 0x8c64503500000000, + 0x2e70f3d900000000, 0xbdeb3aa600000000, 0x0847602600000000, + 0x9bdca95900000000, 0x2318a4fd00000000, 0xb0836d8200000000, + 0x052f370200000000, 0x96b4fe7d00000000, 0x2946caf900000000, + 0xbadd038600000000, 0x0f71590600000000, 0x9cea907900000000, + 0x242e9ddd00000000, 0xb7b554a200000000, 0x02190e2200000000, + 0x9182c75d00000000, 0x339664b100000000, 0xa00dadce00000000, + 0x15a1f74e00000000, 0x863a3e3100000000, 0x3efe339500000000, + 0xad65faea00000000, 0x18c9a06a00000000, 0x8b52691500000000, + 0x1de6976800000000, 0x8e7d5e1700000000, 0x3bd1049700000000, + 0xa84acde800000000, 0x108ec04c00000000, 0x8315093300000000, + 0x36b953b300000000, 0xa5229acc00000000, 0x0736392000000000, + 0x94adf05f00000000, 0x2101aadf00000000, 0xb29a63a000000000, + 0x0a5e6e0400000000, 0x99c5a77b00000000, 0x2c69fdfb00000000, + 0xbff2348400000000, 0x138ae52800000000, 0x80112c5700000000, + 0x35bd76d700000000, 0xa626bfa800000000, 0x1ee2b20c00000000, + 0x8d797b7300000000, 0x38d521f300000000, 0xab4ee88c00000000, + 0x095a4b6000000000, 0x9ac1821f00000000, 0x2f6dd89f00000000, + 0xbcf611e000000000, 0x04321c4400000000, 0x97a9d53b00000000, + 0x22058fbb00000000, 0xb19e46c400000000, 0x272ab8b900000000, + 0xb4b171c600000000, 0x011d2b4600000000, 0x9286e23900000000, + 0x2a42ef9d00000000, 0xb9d926e200000000, 0x0c757c6200000000, + 0x9feeb51d00000000, 0x3dfa16f100000000, 0xae61df8e00000000, + 0x1bcd850e00000000, 0x88564c7100000000, 0x309241d500000000, + 0xa30988aa00000000, 0x16a5d22a00000000, 0x853e1b5500000000, + 0x3acc2fd100000000, 0xa957e6ae00000000, 0x1cfbbc2e00000000, + 0x8f60755100000000, 0x37a478f500000000, 0xa43fb18a00000000, + 0x1193eb0a00000000, 0x8208227500000000, 0x201c819900000000, + 0xb38748e600000000, 0x062b126600000000, 0x95b0db1900000000, + 0x2d74d6bd00000000, 0xbeef1fc200000000, 0x0b43454200000000, + 0x98d88c3d00000000, 0x0e6c724000000000, 0x9df7bb3f00000000, + 0x285be1bf00000000, 0xbbc028c000000000, 0x0304256400000000, + 0x909fec1b00000000, 0x2533b69b00000000, 0xb6a87fe400000000, + 0x14bcdc0800000000, 0x8727157700000000, 0x328b4ff700000000, + 0xa110868800000000, 0x19d48b2c00000000, 0x8a4f425300000000, + 0x3fe318d300000000, 0xac78d1ac00000000, 0x2614cb5100000000, + 0xb58f022e00000000, 0x002358ae00000000, 0x93b891d100000000, + 0x2b7c9c7500000000, 0xb8e7550a00000000, 0x0d4b0f8a00000000, + 0x9ed0c6f500000000, 0x3cc4651900000000, 0xaf5fac6600000000, + 0x1af3f6e600000000, 0x89683f9900000000, 0x31ac323d00000000, + 0xa237fb4200000000, 0x179ba1c200000000, 0x840068bd00000000, + 0x12b496c000000000, 0x812f5fbf00000000, 0x3483053f00000000, + 0xa718cc4000000000, 0x1fdcc1e400000000, 0x8c47089b00000000, + 0x39eb521b00000000, 0xaa709b6400000000, 0x0864388800000000, + 0x9bfff1f700000000, 0x2e53ab7700000000, 0xbdc8620800000000, + 0x050c6fac00000000, 0x9697a6d300000000, 0x233bfc5300000000, + 0xb0a0352c00000000, 0x0f5201a800000000, 0x9cc9c8d700000000, + 0x2965925700000000, 0xbafe5b2800000000, 0x023a568c00000000, + 0x91a19ff300000000, 0x240dc57300000000, 0xb7960c0c00000000, + 0x1582afe000000000, 0x8619669f00000000, 0x33b53c1f00000000, + 0xa02ef56000000000, 0x18eaf8c400000000, 0x8b7131bb00000000, + 0x3edd6b3b00000000, 0xad46a24400000000, 0x3bf25c3900000000, + 0xa869954600000000, 0x1dc5cfc600000000, 0x8e5e06b900000000, + 0x369a0b1d00000000, 0xa501c26200000000, 0x10ad98e200000000, + 0x8336519d00000000, 0x2122f27100000000, 0xb2b93b0e00000000, + 0x0715618e00000000, 0x948ea8f100000000, 0x2c4aa55500000000, + 0xbfd16c2a00000000, 0x0a7d36aa00000000, 0x99e6ffd500000000, + 0x359e2e7900000000, 0xa605e70600000000, 0x13a9bd8600000000, + 0x803274f900000000, 0x38f6795d00000000, 0xab6db02200000000, + 0x1ec1eaa200000000, 0x8d5a23dd00000000, 0x2f4e803100000000, + 0xbcd5494e00000000, 0x097913ce00000000, 0x9ae2dab100000000, + 0x2226d71500000000, 0xb1bd1e6a00000000, 0x041144ea00000000, + 0x978a8d9500000000, 0x013e73e800000000, 0x92a5ba9700000000, + 0x2709e01700000000, 0xb492296800000000, 0x0c5624cc00000000, + 0x9fcdedb300000000, 0x2a61b73300000000, 0xb9fa7e4c00000000, + 0x1beedda000000000, 0x887514df00000000, 0x3dd94e5f00000000, + 0xae42872000000000, 0x16868a8400000000, 0x851d43fb00000000, + 0x30b1197b00000000, 0xa32ad00400000000, 0x1cd8e48000000000, + 0x8f432dff00000000, 0x3aef777f00000000, 0xa974be0000000000, + 0x11b0b3a400000000, 0x822b7adb00000000, 0x3787205b00000000, + 0xa41ce92400000000, 0x06084ac800000000, 0x959383b700000000, + 0x203fd93700000000, 0xb3a4104800000000, 0x0b601dec00000000, + 0x98fbd49300000000, 0x2d578e1300000000, 0xbecc476c00000000, + 0x2878b91100000000, 0xbbe3706e00000000, 0x0e4f2aee00000000, + 0x9dd4e39100000000, 0x2510ee3500000000, 0xb68b274a00000000, + 0x03277dca00000000, 0x90bcb4b500000000, 0x32a8175900000000, + 0xa133de2600000000, 0x149f84a600000000, 0x87044dd900000000, + 0x3fc0407d00000000, 0xac5b890200000000, 0x19f7d38200000000, + 0x8a6c1afd00000000}, + {0x0000000000000000, 0x650b796900000000, 0xca16f2d200000000, + 0xaf1d8bbb00000000, 0xd52b957e00000000, 0xb020ec1700000000, + 0x1f3d67ac00000000, 0x7a361ec500000000, 0xaa572afd00000000, + 0xcf5c539400000000, 0x6041d82f00000000, 0x054aa14600000000, + 0x7f7cbf8300000000, 0x1a77c6ea00000000, 0xb56a4d5100000000, + 0xd061343800000000, 0x15a9252100000000, 0x70a25c4800000000, + 0xdfbfd7f300000000, 0xbab4ae9a00000000, 0xc082b05f00000000, + 0xa589c93600000000, 0x0a94428d00000000, 0x6f9f3be400000000, + 0xbffe0fdc00000000, 0xdaf576b500000000, 0x75e8fd0e00000000, + 0x10e3846700000000, 0x6ad59aa200000000, 0x0fdee3cb00000000, + 0xa0c3687000000000, 0xc5c8111900000000, 0x2a524b4200000000, + 0x4f59322b00000000, 0xe044b99000000000, 0x854fc0f900000000, + 0xff79de3c00000000, 0x9a72a75500000000, 0x356f2cee00000000, + 0x5064558700000000, 0x800561bf00000000, 0xe50e18d600000000, + 0x4a13936d00000000, 0x2f18ea0400000000, 0x552ef4c100000000, + 0x30258da800000000, 0x9f38061300000000, 0xfa337f7a00000000, + 0x3ffb6e6300000000, 0x5af0170a00000000, 0xf5ed9cb100000000, + 0x90e6e5d800000000, 0xead0fb1d00000000, 0x8fdb827400000000, + 0x20c609cf00000000, 0x45cd70a600000000, 0x95ac449e00000000, + 0xf0a73df700000000, 0x5fbab64c00000000, 0x3ab1cf2500000000, + 0x4087d1e000000000, 0x258ca88900000000, 0x8a91233200000000, + 0xef9a5a5b00000000, 0x54a4968400000000, 0x31afefed00000000, + 0x9eb2645600000000, 0xfbb91d3f00000000, 0x818f03fa00000000, + 0xe4847a9300000000, 0x4b99f12800000000, 0x2e92884100000000, + 0xfef3bc7900000000, 0x9bf8c51000000000, 0x34e54eab00000000, + 0x51ee37c200000000, 0x2bd8290700000000, 0x4ed3506e00000000, + 0xe1cedbd500000000, 0x84c5a2bc00000000, 0x410db3a500000000, + 0x2406cacc00000000, 0x8b1b417700000000, 0xee10381e00000000, + 0x942626db00000000, 0xf12d5fb200000000, 0x5e30d40900000000, + 0x3b3bad6000000000, 0xeb5a995800000000, 0x8e51e03100000000, + 0x214c6b8a00000000, 0x444712e300000000, 0x3e710c2600000000, + 0x5b7a754f00000000, 0xf467fef400000000, 0x916c879d00000000, + 0x7ef6ddc600000000, 0x1bfda4af00000000, 0xb4e02f1400000000, + 0xd1eb567d00000000, 0xabdd48b800000000, 0xced631d100000000, + 0x61cbba6a00000000, 0x04c0c30300000000, 0xd4a1f73b00000000, + 0xb1aa8e5200000000, 0x1eb705e900000000, 0x7bbc7c8000000000, + 0x018a624500000000, 0x64811b2c00000000, 0xcb9c909700000000, + 0xae97e9fe00000000, 0x6b5ff8e700000000, 0x0e54818e00000000, + 0xa1490a3500000000, 0xc442735c00000000, 0xbe746d9900000000, + 0xdb7f14f000000000, 0x74629f4b00000000, 0x1169e62200000000, + 0xc108d21a00000000, 0xa403ab7300000000, 0x0b1e20c800000000, + 0x6e1559a100000000, 0x1423476400000000, 0x71283e0d00000000, + 0xde35b5b600000000, 0xbb3eccdf00000000, 0xe94e5cd200000000, + 0x8c4525bb00000000, 0x2358ae0000000000, 0x4653d76900000000, + 0x3c65c9ac00000000, 0x596eb0c500000000, 0xf6733b7e00000000, + 0x9378421700000000, 0x4319762f00000000, 0x26120f4600000000, + 0x890f84fd00000000, 0xec04fd9400000000, 0x9632e35100000000, + 0xf3399a3800000000, 0x5c24118300000000, 0x392f68ea00000000, + 0xfce779f300000000, 0x99ec009a00000000, 0x36f18b2100000000, + 0x53faf24800000000, 0x29ccec8d00000000, 0x4cc795e400000000, + 0xe3da1e5f00000000, 0x86d1673600000000, 0x56b0530e00000000, + 0x33bb2a6700000000, 0x9ca6a1dc00000000, 0xf9add8b500000000, + 0x839bc67000000000, 0xe690bf1900000000, 0x498d34a200000000, + 0x2c864dcb00000000, 0xc31c179000000000, 0xa6176ef900000000, + 0x090ae54200000000, 0x6c019c2b00000000, 0x163782ee00000000, + 0x733cfb8700000000, 0xdc21703c00000000, 0xb92a095500000000, + 0x694b3d6d00000000, 0x0c40440400000000, 0xa35dcfbf00000000, + 0xc656b6d600000000, 0xbc60a81300000000, 0xd96bd17a00000000, + 0x76765ac100000000, 0x137d23a800000000, 0xd6b532b100000000, + 0xb3be4bd800000000, 0x1ca3c06300000000, 0x79a8b90a00000000, + 0x039ea7cf00000000, 0x6695dea600000000, 0xc988551d00000000, + 0xac832c7400000000, 0x7ce2184c00000000, 0x19e9612500000000, + 0xb6f4ea9e00000000, 0xd3ff93f700000000, 0xa9c98d3200000000, + 0xccc2f45b00000000, 0x63df7fe000000000, 0x06d4068900000000, + 0xbdeaca5600000000, 0xd8e1b33f00000000, 0x77fc388400000000, + 0x12f741ed00000000, 0x68c15f2800000000, 0x0dca264100000000, + 0xa2d7adfa00000000, 0xc7dcd49300000000, 0x17bde0ab00000000, + 0x72b699c200000000, 0xddab127900000000, 0xb8a06b1000000000, + 0xc29675d500000000, 0xa79d0cbc00000000, 0x0880870700000000, + 0x6d8bfe6e00000000, 0xa843ef7700000000, 0xcd48961e00000000, + 0x62551da500000000, 0x075e64cc00000000, 0x7d687a0900000000, + 0x1863036000000000, 0xb77e88db00000000, 0xd275f1b200000000, + 0x0214c58a00000000, 0x671fbce300000000, 0xc802375800000000, + 0xad094e3100000000, 0xd73f50f400000000, 0xb234299d00000000, + 0x1d29a22600000000, 0x7822db4f00000000, 0x97b8811400000000, + 0xf2b3f87d00000000, 0x5dae73c600000000, 0x38a50aaf00000000, + 0x4293146a00000000, 0x27986d0300000000, 0x8885e6b800000000, + 0xed8e9fd100000000, 0x3defabe900000000, 0x58e4d28000000000, + 0xf7f9593b00000000, 0x92f2205200000000, 0xe8c43e9700000000, + 0x8dcf47fe00000000, 0x22d2cc4500000000, 0x47d9b52c00000000, + 0x8211a43500000000, 0xe71add5c00000000, 0x480756e700000000, + 0x2d0c2f8e00000000, 0x573a314b00000000, 0x3231482200000000, + 0x9d2cc39900000000, 0xf827baf000000000, 0x28468ec800000000, + 0x4d4df7a100000000, 0xe2507c1a00000000, 0x875b057300000000, + 0xfd6d1bb600000000, 0x986662df00000000, 0x377be96400000000, + 0x5270900d00000000}, + {0x0000000000000000, 0xdcecb13d00000000, 0xb8d9637b00000000, + 0x6435d24600000000, 0x70b3c7f600000000, 0xac5f76cb00000000, + 0xc86aa48d00000000, 0x148615b000000000, 0xa160fe3600000000, + 0x7d8c4f0b00000000, 0x19b99d4d00000000, 0xc5552c7000000000, + 0xd1d339c000000000, 0x0d3f88fd00000000, 0x690a5abb00000000, + 0xb5e6eb8600000000, 0x42c1fc6d00000000, 0x9e2d4d5000000000, + 0xfa189f1600000000, 0x26f42e2b00000000, 0x32723b9b00000000, + 0xee9e8aa600000000, 0x8aab58e000000000, 0x5647e9dd00000000, + 0xe3a1025b00000000, 0x3f4db36600000000, 0x5b78612000000000, + 0x8794d01d00000000, 0x9312c5ad00000000, 0x4ffe749000000000, + 0x2bcba6d600000000, 0xf72717eb00000000, 0x8482f9db00000000, + 0x586e48e600000000, 0x3c5b9aa000000000, 0xe0b72b9d00000000, + 0xf4313e2d00000000, 0x28dd8f1000000000, 0x4ce85d5600000000, + 0x9004ec6b00000000, 0x25e207ed00000000, 0xf90eb6d000000000, + 0x9d3b649600000000, 0x41d7d5ab00000000, 0x5551c01b00000000, + 0x89bd712600000000, 0xed88a36000000000, 0x3164125d00000000, + 0xc64305b600000000, 0x1aafb48b00000000, 0x7e9a66cd00000000, + 0xa276d7f000000000, 0xb6f0c24000000000, 0x6a1c737d00000000, + 0x0e29a13b00000000, 0xd2c5100600000000, 0x6723fb8000000000, + 0xbbcf4abd00000000, 0xdffa98fb00000000, 0x031629c600000000, + 0x17903c7600000000, 0xcb7c8d4b00000000, 0xaf495f0d00000000, + 0x73a5ee3000000000, 0x4903826c00000000, 0x95ef335100000000, + 0xf1dae11700000000, 0x2d36502a00000000, 0x39b0459a00000000, + 0xe55cf4a700000000, 0x816926e100000000, 0x5d8597dc00000000, + 0xe8637c5a00000000, 0x348fcd6700000000, 0x50ba1f2100000000, + 0x8c56ae1c00000000, 0x98d0bbac00000000, 0x443c0a9100000000, + 0x2009d8d700000000, 0xfce569ea00000000, 0x0bc27e0100000000, + 0xd72ecf3c00000000, 0xb31b1d7a00000000, 0x6ff7ac4700000000, + 0x7b71b9f700000000, 0xa79d08ca00000000, 0xc3a8da8c00000000, + 0x1f446bb100000000, 0xaaa2803700000000, 0x764e310a00000000, + 0x127be34c00000000, 0xce97527100000000, 0xda1147c100000000, + 0x06fdf6fc00000000, 0x62c824ba00000000, 0xbe24958700000000, + 0xcd817bb700000000, 0x116dca8a00000000, 0x755818cc00000000, + 0xa9b4a9f100000000, 0xbd32bc4100000000, 0x61de0d7c00000000, + 0x05ebdf3a00000000, 0xd9076e0700000000, 0x6ce1858100000000, + 0xb00d34bc00000000, 0xd438e6fa00000000, 0x08d457c700000000, + 0x1c52427700000000, 0xc0bef34a00000000, 0xa48b210c00000000, + 0x7867903100000000, 0x8f4087da00000000, 0x53ac36e700000000, + 0x3799e4a100000000, 0xeb75559c00000000, 0xfff3402c00000000, + 0x231ff11100000000, 0x472a235700000000, 0x9bc6926a00000000, + 0x2e2079ec00000000, 0xf2ccc8d100000000, 0x96f91a9700000000, + 0x4a15abaa00000000, 0x5e93be1a00000000, 0x827f0f2700000000, + 0xe64add6100000000, 0x3aa66c5c00000000, 0x920604d900000000, + 0x4eeab5e400000000, 0x2adf67a200000000, 0xf633d69f00000000, + 0xe2b5c32f00000000, 0x3e59721200000000, 0x5a6ca05400000000, + 0x8680116900000000, 0x3366faef00000000, 0xef8a4bd200000000, + 0x8bbf999400000000, 0x575328a900000000, 0x43d53d1900000000, + 0x9f398c2400000000, 0xfb0c5e6200000000, 0x27e0ef5f00000000, + 0xd0c7f8b400000000, 0x0c2b498900000000, 0x681e9bcf00000000, + 0xb4f22af200000000, 0xa0743f4200000000, 0x7c988e7f00000000, + 0x18ad5c3900000000, 0xc441ed0400000000, 0x71a7068200000000, + 0xad4bb7bf00000000, 0xc97e65f900000000, 0x1592d4c400000000, + 0x0114c17400000000, 0xddf8704900000000, 0xb9cda20f00000000, + 0x6521133200000000, 0x1684fd0200000000, 0xca684c3f00000000, + 0xae5d9e7900000000, 0x72b12f4400000000, 0x66373af400000000, + 0xbadb8bc900000000, 0xdeee598f00000000, 0x0202e8b200000000, + 0xb7e4033400000000, 0x6b08b20900000000, 0x0f3d604f00000000, + 0xd3d1d17200000000, 0xc757c4c200000000, 0x1bbb75ff00000000, + 0x7f8ea7b900000000, 0xa362168400000000, 0x5445016f00000000, + 0x88a9b05200000000, 0xec9c621400000000, 0x3070d32900000000, + 0x24f6c69900000000, 0xf81a77a400000000, 0x9c2fa5e200000000, + 0x40c314df00000000, 0xf525ff5900000000, 0x29c94e6400000000, + 0x4dfc9c2200000000, 0x91102d1f00000000, 0x859638af00000000, + 0x597a899200000000, 0x3d4f5bd400000000, 0xe1a3eae900000000, + 0xdb0586b500000000, 0x07e9378800000000, 0x63dce5ce00000000, + 0xbf3054f300000000, 0xabb6414300000000, 0x775af07e00000000, + 0x136f223800000000, 0xcf83930500000000, 0x7a65788300000000, + 0xa689c9be00000000, 0xc2bc1bf800000000, 0x1e50aac500000000, + 0x0ad6bf7500000000, 0xd63a0e4800000000, 0xb20fdc0e00000000, + 0x6ee36d3300000000, 0x99c47ad800000000, 0x4528cbe500000000, + 0x211d19a300000000, 0xfdf1a89e00000000, 0xe977bd2e00000000, + 0x359b0c1300000000, 0x51aede5500000000, 0x8d426f6800000000, + 0x38a484ee00000000, 0xe44835d300000000, 0x807de79500000000, + 0x5c9156a800000000, 0x4817431800000000, 0x94fbf22500000000, + 0xf0ce206300000000, 0x2c22915e00000000, 0x5f877f6e00000000, + 0x836bce5300000000, 0xe75e1c1500000000, 0x3bb2ad2800000000, + 0x2f34b89800000000, 0xf3d809a500000000, 0x97eddbe300000000, + 0x4b016ade00000000, 0xfee7815800000000, 0x220b306500000000, + 0x463ee22300000000, 0x9ad2531e00000000, 0x8e5446ae00000000, + 0x52b8f79300000000, 0x368d25d500000000, 0xea6194e800000000, + 0x1d46830300000000, 0xc1aa323e00000000, 0xa59fe07800000000, + 0x7973514500000000, 0x6df544f500000000, 0xb119f5c800000000, + 0xd52c278e00000000, 0x09c096b300000000, 0xbc267d3500000000, + 0x60cacc0800000000, 0x04ff1e4e00000000, 0xd813af7300000000, + 0xcc95bac300000000, 0x10790bfe00000000, 0x744cd9b800000000, + 0xa8a0688500000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x81256527, 0xd93bcc0f, 0x581ea928, 0x69069e5f, + 0xe823fb78, 0xb03d5250, 0x31183777, 0xd20d3cbe, 0x53285999, + 0x0b36f0b1, 0x8a139596, 0xbb0ba2e1, 0x3a2ec7c6, 0x62306eee, + 0xe3150bc9, 0x7f6b7f3d, 0xfe4e1a1a, 0xa650b332, 0x2775d615, + 0x166de162, 0x97488445, 0xcf562d6d, 0x4e73484a, 0xad664383, + 0x2c4326a4, 0x745d8f8c, 0xf578eaab, 0xc460dddc, 0x4545b8fb, + 0x1d5b11d3, 0x9c7e74f4, 0xfed6fe7a, 0x7ff39b5d, 0x27ed3275, + 0xa6c85752, 0x97d06025, 0x16f50502, 0x4eebac2a, 0xcfcec90d, + 0x2cdbc2c4, 0xadfea7e3, 0xf5e00ecb, 0x74c56bec, 0x45dd5c9b, + 0xc4f839bc, 0x9ce69094, 0x1dc3f5b3, 0x81bd8147, 0x0098e460, + 0x58864d48, 0xd9a3286f, 0xe8bb1f18, 0x699e7a3f, 0x3180d317, + 0xb0a5b630, 0x53b0bdf9, 0xd295d8de, 0x8a8b71f6, 0x0bae14d1, + 0x3ab623a6, 0xbb934681, 0xe38defa9, 0x62a88a8e, 0x26dcfab5, + 0xa7f99f92, 0xffe736ba, 0x7ec2539d, 0x4fda64ea, 0xceff01cd, + 0x96e1a8e5, 0x17c4cdc2, 0xf4d1c60b, 0x75f4a32c, 0x2dea0a04, + 0xaccf6f23, 0x9dd75854, 0x1cf23d73, 0x44ec945b, 0xc5c9f17c, + 0x59b78588, 0xd892e0af, 0x808c4987, 0x01a92ca0, 0x30b11bd7, + 0xb1947ef0, 0xe98ad7d8, 0x68afb2ff, 0x8bbab936, 0x0a9fdc11, + 0x52817539, 0xd3a4101e, 0xe2bc2769, 0x6399424e, 0x3b87eb66, + 0xbaa28e41, 0xd80a04cf, 0x592f61e8, 0x0131c8c0, 0x8014ade7, + 0xb10c9a90, 0x3029ffb7, 0x6837569f, 0xe91233b8, 0x0a073871, + 0x8b225d56, 0xd33cf47e, 0x52199159, 0x6301a62e, 0xe224c309, + 0xba3a6a21, 0x3b1f0f06, 0xa7617bf2, 0x26441ed5, 0x7e5ab7fd, + 0xff7fd2da, 0xce67e5ad, 0x4f42808a, 0x175c29a2, 0x96794c85, + 0x756c474c, 0xf449226b, 0xac578b43, 0x2d72ee64, 0x1c6ad913, + 0x9d4fbc34, 0xc551151c, 0x4474703b, 0x4db9f56a, 0xcc9c904d, + 0x94823965, 0x15a75c42, 0x24bf6b35, 0xa59a0e12, 0xfd84a73a, + 0x7ca1c21d, 0x9fb4c9d4, 0x1e91acf3, 0x468f05db, 0xc7aa60fc, + 0xf6b2578b, 0x779732ac, 0x2f899b84, 0xaeacfea3, 0x32d28a57, + 0xb3f7ef70, 0xebe94658, 0x6acc237f, 0x5bd41408, 0xdaf1712f, + 0x82efd807, 0x03cabd20, 0xe0dfb6e9, 0x61fad3ce, 0x39e47ae6, + 0xb8c11fc1, 0x89d928b6, 0x08fc4d91, 0x50e2e4b9, 0xd1c7819e, + 0xb36f0b10, 0x324a6e37, 0x6a54c71f, 0xeb71a238, 0xda69954f, + 0x5b4cf068, 0x03525940, 0x82773c67, 0x616237ae, 0xe0475289, + 0xb859fba1, 0x397c9e86, 0x0864a9f1, 0x8941ccd6, 0xd15f65fe, + 0x507a00d9, 0xcc04742d, 0x4d21110a, 0x153fb822, 0x941add05, + 0xa502ea72, 0x24278f55, 0x7c39267d, 0xfd1c435a, 0x1e094893, + 0x9f2c2db4, 0xc732849c, 0x4617e1bb, 0x770fd6cc, 0xf62ab3eb, + 0xae341ac3, 0x2f117fe4, 0x6b650fdf, 0xea406af8, 0xb25ec3d0, + 0x337ba6f7, 0x02639180, 0x8346f4a7, 0xdb585d8f, 0x5a7d38a8, + 0xb9683361, 0x384d5646, 0x6053ff6e, 0xe1769a49, 0xd06ead3e, + 0x514bc819, 0x09556131, 0x88700416, 0x140e70e2, 0x952b15c5, + 0xcd35bced, 0x4c10d9ca, 0x7d08eebd, 0xfc2d8b9a, 0xa43322b2, + 0x25164795, 0xc6034c5c, 0x4726297b, 0x1f388053, 0x9e1de574, + 0xaf05d203, 0x2e20b724, 0x763e1e0c, 0xf71b7b2b, 0x95b3f1a5, + 0x14969482, 0x4c883daa, 0xcdad588d, 0xfcb56ffa, 0x7d900add, + 0x258ea3f5, 0xa4abc6d2, 0x47becd1b, 0xc69ba83c, 0x9e850114, + 0x1fa06433, 0x2eb85344, 0xaf9d3663, 0xf7839f4b, 0x76a6fa6c, + 0xead88e98, 0x6bfdebbf, 0x33e34297, 0xb2c627b0, 0x83de10c7, + 0x02fb75e0, 0x5ae5dcc8, 0xdbc0b9ef, 0x38d5b226, 0xb9f0d701, + 0xe1ee7e29, 0x60cb1b0e, 0x51d32c79, 0xd0f6495e, 0x88e8e076, + 0x09cd8551}, + {0x00000000, 0x9b73ead4, 0xed96d3e9, 0x76e5393d, 0x005ca193, + 0x9b2f4b47, 0xedca727a, 0x76b998ae, 0x00b94326, 0x9bcaa9f2, + 0xed2f90cf, 0x765c7a1b, 0x00e5e2b5, 0x9b960861, 0xed73315c, + 0x7600db88, 0x0172864c, 0x9a016c98, 0xece455a5, 0x7797bf71, + 0x012e27df, 0x9a5dcd0b, 0xecb8f436, 0x77cb1ee2, 0x01cbc56a, + 0x9ab82fbe, 0xec5d1683, 0x772efc57, 0x019764f9, 0x9ae48e2d, + 0xec01b710, 0x77725dc4, 0x02e50c98, 0x9996e64c, 0xef73df71, + 0x740035a5, 0x02b9ad0b, 0x99ca47df, 0xef2f7ee2, 0x745c9436, + 0x025c4fbe, 0x992fa56a, 0xefca9c57, 0x74b97683, 0x0200ee2d, + 0x997304f9, 0xef963dc4, 0x74e5d710, 0x03978ad4, 0x98e46000, + 0xee01593d, 0x7572b3e9, 0x03cb2b47, 0x98b8c193, 0xee5df8ae, + 0x752e127a, 0x032ec9f2, 0x985d2326, 0xeeb81a1b, 0x75cbf0cf, + 0x03726861, 0x980182b5, 0xeee4bb88, 0x7597515c, 0x05ca1930, + 0x9eb9f3e4, 0xe85ccad9, 0x732f200d, 0x0596b8a3, 0x9ee55277, + 0xe8006b4a, 0x7373819e, 0x05735a16, 0x9e00b0c2, 0xe8e589ff, + 0x7396632b, 0x052ffb85, 0x9e5c1151, 0xe8b9286c, 0x73cac2b8, + 0x04b89f7c, 0x9fcb75a8, 0xe92e4c95, 0x725da641, 0x04e43eef, + 0x9f97d43b, 0xe972ed06, 0x720107d2, 0x0401dc5a, 0x9f72368e, + 0xe9970fb3, 0x72e4e567, 0x045d7dc9, 0x9f2e971d, 0xe9cbae20, + 0x72b844f4, 0x072f15a8, 0x9c5cff7c, 0xeab9c641, 0x71ca2c95, + 0x0773b43b, 0x9c005eef, 0xeae567d2, 0x71968d06, 0x0796568e, + 0x9ce5bc5a, 0xea008567, 0x71736fb3, 0x07caf71d, 0x9cb91dc9, + 0xea5c24f4, 0x712fce20, 0x065d93e4, 0x9d2e7930, 0xebcb400d, + 0x70b8aad9, 0x06013277, 0x9d72d8a3, 0xeb97e19e, 0x70e40b4a, + 0x06e4d0c2, 0x9d973a16, 0xeb72032b, 0x7001e9ff, 0x06b87151, + 0x9dcb9b85, 0xeb2ea2b8, 0x705d486c, 0x0b943260, 0x90e7d8b4, + 0xe602e189, 0x7d710b5d, 0x0bc893f3, 0x90bb7927, 0xe65e401a, + 0x7d2daace, 0x0b2d7146, 0x905e9b92, 0xe6bba2af, 0x7dc8487b, + 0x0b71d0d5, 0x90023a01, 0xe6e7033c, 0x7d94e9e8, 0x0ae6b42c, + 0x91955ef8, 0xe77067c5, 0x7c038d11, 0x0aba15bf, 0x91c9ff6b, + 0xe72cc656, 0x7c5f2c82, 0x0a5ff70a, 0x912c1dde, 0xe7c924e3, + 0x7cbace37, 0x0a035699, 0x9170bc4d, 0xe7958570, 0x7ce66fa4, + 0x09713ef8, 0x9202d42c, 0xe4e7ed11, 0x7f9407c5, 0x092d9f6b, + 0x925e75bf, 0xe4bb4c82, 0x7fc8a656, 0x09c87dde, 0x92bb970a, + 0xe45eae37, 0x7f2d44e3, 0x0994dc4d, 0x92e73699, 0xe4020fa4, + 0x7f71e570, 0x0803b8b4, 0x93705260, 0xe5956b5d, 0x7ee68189, + 0x085f1927, 0x932cf3f3, 0xe5c9cace, 0x7eba201a, 0x08bafb92, + 0x93c91146, 0xe52c287b, 0x7e5fc2af, 0x08e65a01, 0x9395b0d5, + 0xe57089e8, 0x7e03633c, 0x0e5e2b50, 0x952dc184, 0xe3c8f8b9, + 0x78bb126d, 0x0e028ac3, 0x95716017, 0xe394592a, 0x78e7b3fe, + 0x0ee76876, 0x959482a2, 0xe371bb9f, 0x7802514b, 0x0ebbc9e5, + 0x95c82331, 0xe32d1a0c, 0x785ef0d8, 0x0f2cad1c, 0x945f47c8, + 0xe2ba7ef5, 0x79c99421, 0x0f700c8f, 0x9403e65b, 0xe2e6df66, + 0x799535b2, 0x0f95ee3a, 0x94e604ee, 0xe2033dd3, 0x7970d707, + 0x0fc94fa9, 0x94baa57d, 0xe25f9c40, 0x792c7694, 0x0cbb27c8, + 0x97c8cd1c, 0xe12df421, 0x7a5e1ef5, 0x0ce7865b, 0x97946c8f, + 0xe17155b2, 0x7a02bf66, 0x0c0264ee, 0x97718e3a, 0xe194b707, + 0x7ae75dd3, 0x0c5ec57d, 0x972d2fa9, 0xe1c81694, 0x7abbfc40, + 0x0dc9a184, 0x96ba4b50, 0xe05f726d, 0x7b2c98b9, 0x0d950017, + 0x96e6eac3, 0xe003d3fe, 0x7b70392a, 0x0d70e2a2, 0x96030876, + 0xe0e6314b, 0x7b95db9f, 0x0d2c4331, 0x965fa9e5, 0xe0ba90d8, + 0x7bc97a0c}, + {0x00000000, 0x172864c0, 0x2e50c980, 0x3978ad40, 0x5ca19300, + 0x4b89f7c0, 0x72f15a80, 0x65d93e40, 0xb9432600, 0xae6b42c0, + 0x9713ef80, 0x803b8b40, 0xe5e2b500, 0xf2cad1c0, 0xcbb27c80, + 0xdc9a1840, 0xa9f74a41, 0xbedf2e81, 0x87a783c1, 0x908fe701, + 0xf556d941, 0xe27ebd81, 0xdb0610c1, 0xcc2e7401, 0x10b46c41, + 0x079c0881, 0x3ee4a5c1, 0x29ccc101, 0x4c15ff41, 0x5b3d9b81, + 0x624536c1, 0x756d5201, 0x889f92c3, 0x9fb7f603, 0xa6cf5b43, + 0xb1e73f83, 0xd43e01c3, 0xc3166503, 0xfa6ec843, 0xed46ac83, + 0x31dcb4c3, 0x26f4d003, 0x1f8c7d43, 0x08a41983, 0x6d7d27c3, + 0x7a554303, 0x432dee43, 0x54058a83, 0x2168d882, 0x3640bc42, + 0x0f381102, 0x181075c2, 0x7dc94b82, 0x6ae12f42, 0x53998202, + 0x44b1e6c2, 0x982bfe82, 0x8f039a42, 0xb67b3702, 0xa15353c2, + 0xc48a6d82, 0xd3a20942, 0xeadaa402, 0xfdf2c0c2, 0xca4e23c7, + 0xdd664707, 0xe41eea47, 0xf3368e87, 0x96efb0c7, 0x81c7d407, + 0xb8bf7947, 0xaf971d87, 0x730d05c7, 0x64256107, 0x5d5dcc47, + 0x4a75a887, 0x2fac96c7, 0x3884f207, 0x01fc5f47, 0x16d43b87, + 0x63b96986, 0x74910d46, 0x4de9a006, 0x5ac1c4c6, 0x3f18fa86, + 0x28309e46, 0x11483306, 0x066057c6, 0xdafa4f86, 0xcdd22b46, + 0xf4aa8606, 0xe382e2c6, 0x865bdc86, 0x9173b846, 0xa80b1506, + 0xbf2371c6, 0x42d1b104, 0x55f9d5c4, 0x6c817884, 0x7ba91c44, + 0x1e702204, 0x095846c4, 0x3020eb84, 0x27088f44, 0xfb929704, + 0xecbaf3c4, 0xd5c25e84, 0xc2ea3a44, 0xa7330404, 0xb01b60c4, + 0x8963cd84, 0x9e4ba944, 0xeb26fb45, 0xfc0e9f85, 0xc57632c5, + 0xd25e5605, 0xb7876845, 0xa0af0c85, 0x99d7a1c5, 0x8effc505, + 0x5265dd45, 0x454db985, 0x7c3514c5, 0x6b1d7005, 0x0ec44e45, + 0x19ec2a85, 0x209487c5, 0x37bce305, 0x4fed41cf, 0x58c5250f, + 0x61bd884f, 0x7695ec8f, 0x134cd2cf, 0x0464b60f, 0x3d1c1b4f, + 0x2a347f8f, 0xf6ae67cf, 0xe186030f, 0xd8feae4f, 0xcfd6ca8f, + 0xaa0ff4cf, 0xbd27900f, 0x845f3d4f, 0x9377598f, 0xe61a0b8e, + 0xf1326f4e, 0xc84ac20e, 0xdf62a6ce, 0xbabb988e, 0xad93fc4e, + 0x94eb510e, 0x83c335ce, 0x5f592d8e, 0x4871494e, 0x7109e40e, + 0x662180ce, 0x03f8be8e, 0x14d0da4e, 0x2da8770e, 0x3a8013ce, + 0xc772d30c, 0xd05ab7cc, 0xe9221a8c, 0xfe0a7e4c, 0x9bd3400c, + 0x8cfb24cc, 0xb583898c, 0xa2abed4c, 0x7e31f50c, 0x691991cc, + 0x50613c8c, 0x4749584c, 0x2290660c, 0x35b802cc, 0x0cc0af8c, + 0x1be8cb4c, 0x6e85994d, 0x79adfd8d, 0x40d550cd, 0x57fd340d, + 0x32240a4d, 0x250c6e8d, 0x1c74c3cd, 0x0b5ca70d, 0xd7c6bf4d, + 0xc0eedb8d, 0xf99676cd, 0xeebe120d, 0x8b672c4d, 0x9c4f488d, + 0xa537e5cd, 0xb21f810d, 0x85a36208, 0x928b06c8, 0xabf3ab88, + 0xbcdbcf48, 0xd902f108, 0xce2a95c8, 0xf7523888, 0xe07a5c48, + 0x3ce04408, 0x2bc820c8, 0x12b08d88, 0x0598e948, 0x6041d708, + 0x7769b3c8, 0x4e111e88, 0x59397a48, 0x2c542849, 0x3b7c4c89, + 0x0204e1c9, 0x152c8509, 0x70f5bb49, 0x67dddf89, 0x5ea572c9, + 0x498d1609, 0x95170e49, 0x823f6a89, 0xbb47c7c9, 0xac6fa309, + 0xc9b69d49, 0xde9ef989, 0xe7e654c9, 0xf0ce3009, 0x0d3cf0cb, + 0x1a14940b, 0x236c394b, 0x34445d8b, 0x519d63cb, 0x46b5070b, + 0x7fcdaa4b, 0x68e5ce8b, 0xb47fd6cb, 0xa357b20b, 0x9a2f1f4b, + 0x8d077b8b, 0xe8de45cb, 0xfff6210b, 0xc68e8c4b, 0xd1a6e88b, + 0xa4cbba8a, 0xb3e3de4a, 0x8a9b730a, 0x9db317ca, 0xf86a298a, + 0xef424d4a, 0xd63ae00a, 0xc11284ca, 0x1d889c8a, 0x0aa0f84a, + 0x33d8550a, 0x24f031ca, 0x41290f8a, 0x56016b4a, 0x6f79c60a, + 0x7851a2ca}, + {0x00000000, 0x9fda839e, 0xe4c4017d, 0x7b1e82e3, 0x12f904bb, + 0x8d238725, 0xf63d05c6, 0x69e78658, 0x25f20976, 0xba288ae8, + 0xc136080b, 0x5eec8b95, 0x370b0dcd, 0xa8d18e53, 0xd3cf0cb0, + 0x4c158f2e, 0x4be412ec, 0xd43e9172, 0xaf201391, 0x30fa900f, + 0x591d1657, 0xc6c795c9, 0xbdd9172a, 0x220394b4, 0x6e161b9a, + 0xf1cc9804, 0x8ad21ae7, 0x15089979, 0x7cef1f21, 0xe3359cbf, + 0x982b1e5c, 0x07f19dc2, 0x97c825d8, 0x0812a646, 0x730c24a5, + 0xecd6a73b, 0x85312163, 0x1aeba2fd, 0x61f5201e, 0xfe2fa380, + 0xb23a2cae, 0x2de0af30, 0x56fe2dd3, 0xc924ae4d, 0xa0c32815, + 0x3f19ab8b, 0x44072968, 0xdbddaaf6, 0xdc2c3734, 0x43f6b4aa, + 0x38e83649, 0xa732b5d7, 0xced5338f, 0x510fb011, 0x2a1132f2, + 0xb5cbb16c, 0xf9de3e42, 0x6604bddc, 0x1d1a3f3f, 0x82c0bca1, + 0xeb273af9, 0x74fdb967, 0x0fe33b84, 0x9039b81a, 0xf4e14df1, + 0x6b3bce6f, 0x10254c8c, 0x8fffcf12, 0xe618494a, 0x79c2cad4, + 0x02dc4837, 0x9d06cba9, 0xd1134487, 0x4ec9c719, 0x35d745fa, + 0xaa0dc664, 0xc3ea403c, 0x5c30c3a2, 0x272e4141, 0xb8f4c2df, + 0xbf055f1d, 0x20dfdc83, 0x5bc15e60, 0xc41bddfe, 0xadfc5ba6, + 0x3226d838, 0x49385adb, 0xd6e2d945, 0x9af7566b, 0x052dd5f5, + 0x7e335716, 0xe1e9d488, 0x880e52d0, 0x17d4d14e, 0x6cca53ad, + 0xf310d033, 0x63296829, 0xfcf3ebb7, 0x87ed6954, 0x1837eaca, + 0x71d06c92, 0xee0aef0c, 0x95146def, 0x0aceee71, 0x46db615f, + 0xd901e2c1, 0xa21f6022, 0x3dc5e3bc, 0x542265e4, 0xcbf8e67a, + 0xb0e66499, 0x2f3ce707, 0x28cd7ac5, 0xb717f95b, 0xcc097bb8, + 0x53d3f826, 0x3a347e7e, 0xa5eefde0, 0xdef07f03, 0x412afc9d, + 0x0d3f73b3, 0x92e5f02d, 0xe9fb72ce, 0x7621f150, 0x1fc67708, + 0x801cf496, 0xfb027675, 0x64d8f5eb, 0x32b39da3, 0xad691e3d, + 0xd6779cde, 0x49ad1f40, 0x204a9918, 0xbf901a86, 0xc48e9865, + 0x5b541bfb, 0x174194d5, 0x889b174b, 0xf38595a8, 0x6c5f1636, + 0x05b8906e, 0x9a6213f0, 0xe17c9113, 0x7ea6128d, 0x79578f4f, + 0xe68d0cd1, 0x9d938e32, 0x02490dac, 0x6bae8bf4, 0xf474086a, + 0x8f6a8a89, 0x10b00917, 0x5ca58639, 0xc37f05a7, 0xb8618744, + 0x27bb04da, 0x4e5c8282, 0xd186011c, 0xaa9883ff, 0x35420061, + 0xa57bb87b, 0x3aa13be5, 0x41bfb906, 0xde653a98, 0xb782bcc0, + 0x28583f5e, 0x5346bdbd, 0xcc9c3e23, 0x8089b10d, 0x1f533293, + 0x644db070, 0xfb9733ee, 0x9270b5b6, 0x0daa3628, 0x76b4b4cb, + 0xe96e3755, 0xee9faa97, 0x71452909, 0x0a5babea, 0x95812874, + 0xfc66ae2c, 0x63bc2db2, 0x18a2af51, 0x87782ccf, 0xcb6da3e1, + 0x54b7207f, 0x2fa9a29c, 0xb0732102, 0xd994a75a, 0x464e24c4, + 0x3d50a627, 0xa28a25b9, 0xc652d052, 0x598853cc, 0x2296d12f, + 0xbd4c52b1, 0xd4abd4e9, 0x4b715777, 0x306fd594, 0xafb5560a, + 0xe3a0d924, 0x7c7a5aba, 0x0764d859, 0x98be5bc7, 0xf159dd9f, + 0x6e835e01, 0x159ddce2, 0x8a475f7c, 0x8db6c2be, 0x126c4120, + 0x6972c3c3, 0xf6a8405d, 0x9f4fc605, 0x0095459b, 0x7b8bc778, + 0xe45144e6, 0xa844cbc8, 0x379e4856, 0x4c80cab5, 0xd35a492b, + 0xbabdcf73, 0x25674ced, 0x5e79ce0e, 0xc1a34d90, 0x519af58a, + 0xce407614, 0xb55ef4f7, 0x2a847769, 0x4363f131, 0xdcb972af, + 0xa7a7f04c, 0x387d73d2, 0x7468fcfc, 0xebb27f62, 0x90acfd81, + 0x0f767e1f, 0x6691f847, 0xf94b7bd9, 0x8255f93a, 0x1d8f7aa4, + 0x1a7ee766, 0x85a464f8, 0xfebae61b, 0x61606585, 0x0887e3dd, + 0x975d6043, 0xec43e2a0, 0x7399613e, 0x3f8cee10, 0xa0566d8e, + 0xdb48ef6d, 0x44926cf3, 0x2d75eaab, 0xb2af6935, 0xc9b1ebd6, + 0x566b6848}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x9e83da9f, 0x7d01c4e4, 0xe3821e7b, 0xbb04f912, + 0x2587238d, 0xc6053df6, 0x5886e769, 0x7609f225, 0xe88a28ba, + 0x0b0836c1, 0x958bec5e, 0xcd0d0b37, 0x538ed1a8, 0xb00ccfd3, + 0x2e8f154c, 0xec12e44b, 0x72913ed4, 0x911320af, 0x0f90fa30, + 0x57161d59, 0xc995c7c6, 0x2a17d9bd, 0xb4940322, 0x9a1b166e, + 0x0498ccf1, 0xe71ad28a, 0x79990815, 0x211fef7c, 0xbf9c35e3, + 0x5c1e2b98, 0xc29df107, 0xd825c897, 0x46a61208, 0xa5240c73, + 0x3ba7d6ec, 0x63213185, 0xfda2eb1a, 0x1e20f561, 0x80a32ffe, + 0xae2c3ab2, 0x30afe02d, 0xd32dfe56, 0x4dae24c9, 0x1528c3a0, + 0x8bab193f, 0x68290744, 0xf6aadddb, 0x34372cdc, 0xaab4f643, + 0x4936e838, 0xd7b532a7, 0x8f33d5ce, 0x11b00f51, 0xf232112a, + 0x6cb1cbb5, 0x423edef9, 0xdcbd0466, 0x3f3f1a1d, 0xa1bcc082, + 0xf93a27eb, 0x67b9fd74, 0x843be30f, 0x1ab83990, 0xf14de1f4, + 0x6fce3b6b, 0x8c4c2510, 0x12cfff8f, 0x4a4918e6, 0xd4cac279, + 0x3748dc02, 0xa9cb069d, 0x874413d1, 0x19c7c94e, 0xfa45d735, + 0x64c60daa, 0x3c40eac3, 0xa2c3305c, 0x41412e27, 0xdfc2f4b8, + 0x1d5f05bf, 0x83dcdf20, 0x605ec15b, 0xfedd1bc4, 0xa65bfcad, + 0x38d82632, 0xdb5a3849, 0x45d9e2d6, 0x6b56f79a, 0xf5d52d05, + 0x1657337e, 0x88d4e9e1, 0xd0520e88, 0x4ed1d417, 0xad53ca6c, + 0x33d010f3, 0x29682963, 0xb7ebf3fc, 0x5469ed87, 0xcaea3718, + 0x926cd071, 0x0cef0aee, 0xef6d1495, 0x71eece0a, 0x5f61db46, + 0xc1e201d9, 0x22601fa2, 0xbce3c53d, 0xe4652254, 0x7ae6f8cb, + 0x9964e6b0, 0x07e73c2f, 0xc57acd28, 0x5bf917b7, 0xb87b09cc, + 0x26f8d353, 0x7e7e343a, 0xe0fdeea5, 0x037ff0de, 0x9dfc2a41, + 0xb3733f0d, 0x2df0e592, 0xce72fbe9, 0x50f12176, 0x0877c61f, + 0x96f41c80, 0x757602fb, 0xebf5d864, 0xa39db332, 0x3d1e69ad, + 0xde9c77d6, 0x401fad49, 0x18994a20, 0x861a90bf, 0x65988ec4, + 0xfb1b545b, 0xd5944117, 0x4b179b88, 0xa89585f3, 0x36165f6c, + 0x6e90b805, 0xf013629a, 0x13917ce1, 0x8d12a67e, 0x4f8f5779, + 0xd10c8de6, 0x328e939d, 0xac0d4902, 0xf48bae6b, 0x6a0874f4, + 0x898a6a8f, 0x1709b010, 0x3986a55c, 0xa7057fc3, 0x448761b8, + 0xda04bb27, 0x82825c4e, 0x1c0186d1, 0xff8398aa, 0x61004235, + 0x7bb87ba5, 0xe53ba13a, 0x06b9bf41, 0x983a65de, 0xc0bc82b7, + 0x5e3f5828, 0xbdbd4653, 0x233e9ccc, 0x0db18980, 0x9332531f, + 0x70b04d64, 0xee3397fb, 0xb6b57092, 0x2836aa0d, 0xcbb4b476, + 0x55376ee9, 0x97aa9fee, 0x09294571, 0xeaab5b0a, 0x74288195, + 0x2cae66fc, 0xb22dbc63, 0x51afa218, 0xcf2c7887, 0xe1a36dcb, + 0x7f20b754, 0x9ca2a92f, 0x022173b0, 0x5aa794d9, 0xc4244e46, + 0x27a6503d, 0xb9258aa2, 0x52d052c6, 0xcc538859, 0x2fd19622, + 0xb1524cbd, 0xe9d4abd4, 0x7757714b, 0x94d56f30, 0x0a56b5af, + 0x24d9a0e3, 0xba5a7a7c, 0x59d86407, 0xc75bbe98, 0x9fdd59f1, + 0x015e836e, 0xe2dc9d15, 0x7c5f478a, 0xbec2b68d, 0x20416c12, + 0xc3c37269, 0x5d40a8f6, 0x05c64f9f, 0x9b459500, 0x78c78b7b, + 0xe64451e4, 0xc8cb44a8, 0x56489e37, 0xb5ca804c, 0x2b495ad3, + 0x73cfbdba, 0xed4c6725, 0x0ece795e, 0x904da3c1, 0x8af59a51, + 0x147640ce, 0xf7f45eb5, 0x6977842a, 0x31f16343, 0xaf72b9dc, + 0x4cf0a7a7, 0xd2737d38, 0xfcfc6874, 0x627fb2eb, 0x81fdac90, + 0x1f7e760f, 0x47f89166, 0xd97b4bf9, 0x3af95582, 0xa47a8f1d, + 0x66e77e1a, 0xf864a485, 0x1be6bafe, 0x85656061, 0xdde38708, + 0x43605d97, 0xa0e243ec, 0x3e619973, 0x10ee8c3f, 0x8e6d56a0, + 0x6def48db, 0xf36c9244, 0xabea752d, 0x3569afb2, 0xd6ebb1c9, + 0x48686b56}, + {0x00000000, 0xc0642817, 0x80c9502e, 0x40ad7839, 0x0093a15c, + 0xc0f7894b, 0x805af172, 0x403ed965, 0x002643b9, 0xc0426bae, + 0x80ef1397, 0x408b3b80, 0x00b5e2e5, 0xc0d1caf2, 0x807cb2cb, + 0x40189adc, 0x414af7a9, 0x812edfbe, 0xc183a787, 0x01e78f90, + 0x41d956f5, 0x81bd7ee2, 0xc11006db, 0x01742ecc, 0x416cb410, + 0x81089c07, 0xc1a5e43e, 0x01c1cc29, 0x41ff154c, 0x819b3d5b, + 0xc1364562, 0x01526d75, 0xc3929f88, 0x03f6b79f, 0x435bcfa6, + 0x833fe7b1, 0xc3013ed4, 0x036516c3, 0x43c86efa, 0x83ac46ed, + 0xc3b4dc31, 0x03d0f426, 0x437d8c1f, 0x8319a408, 0xc3277d6d, + 0x0343557a, 0x43ee2d43, 0x838a0554, 0x82d86821, 0x42bc4036, + 0x0211380f, 0xc2751018, 0x824bc97d, 0x422fe16a, 0x02829953, + 0xc2e6b144, 0x82fe2b98, 0x429a038f, 0x02377bb6, 0xc25353a1, + 0x826d8ac4, 0x4209a2d3, 0x02a4daea, 0xc2c0f2fd, 0xc7234eca, + 0x074766dd, 0x47ea1ee4, 0x878e36f3, 0xc7b0ef96, 0x07d4c781, + 0x4779bfb8, 0x871d97af, 0xc7050d73, 0x07612564, 0x47cc5d5d, + 0x87a8754a, 0xc796ac2f, 0x07f28438, 0x475ffc01, 0x873bd416, + 0x8669b963, 0x460d9174, 0x06a0e94d, 0xc6c4c15a, 0x86fa183f, + 0x469e3028, 0x06334811, 0xc6576006, 0x864ffada, 0x462bd2cd, + 0x0686aaf4, 0xc6e282e3, 0x86dc5b86, 0x46b87391, 0x06150ba8, + 0xc67123bf, 0x04b1d142, 0xc4d5f955, 0x8478816c, 0x441ca97b, + 0x0422701e, 0xc4465809, 0x84eb2030, 0x448f0827, 0x049792fb, + 0xc4f3baec, 0x845ec2d5, 0x443aeac2, 0x040433a7, 0xc4601bb0, + 0x84cd6389, 0x44a94b9e, 0x45fb26eb, 0x859f0efc, 0xc53276c5, + 0x05565ed2, 0x456887b7, 0x850cafa0, 0xc5a1d799, 0x05c5ff8e, + 0x45dd6552, 0x85b94d45, 0xc514357c, 0x05701d6b, 0x454ec40e, + 0x852aec19, 0xc5879420, 0x05e3bc37, 0xcf41ed4f, 0x0f25c558, + 0x4f88bd61, 0x8fec9576, 0xcfd24c13, 0x0fb66404, 0x4f1b1c3d, + 0x8f7f342a, 0xcf67aef6, 0x0f0386e1, 0x4faefed8, 0x8fcad6cf, + 0xcff40faa, 0x0f9027bd, 0x4f3d5f84, 0x8f597793, 0x8e0b1ae6, + 0x4e6f32f1, 0x0ec24ac8, 0xcea662df, 0x8e98bbba, 0x4efc93ad, + 0x0e51eb94, 0xce35c383, 0x8e2d595f, 0x4e497148, 0x0ee40971, + 0xce802166, 0x8ebef803, 0x4edad014, 0x0e77a82d, 0xce13803a, + 0x0cd372c7, 0xccb75ad0, 0x8c1a22e9, 0x4c7e0afe, 0x0c40d39b, + 0xcc24fb8c, 0x8c8983b5, 0x4cedaba2, 0x0cf5317e, 0xcc911969, + 0x8c3c6150, 0x4c584947, 0x0c669022, 0xcc02b835, 0x8cafc00c, + 0x4ccbe81b, 0x4d99856e, 0x8dfdad79, 0xcd50d540, 0x0d34fd57, + 0x4d0a2432, 0x8d6e0c25, 0xcdc3741c, 0x0da75c0b, 0x4dbfc6d7, + 0x8ddbeec0, 0xcd7696f9, 0x0d12beee, 0x4d2c678b, 0x8d484f9c, + 0xcde537a5, 0x0d811fb2, 0x0862a385, 0xc8068b92, 0x88abf3ab, + 0x48cfdbbc, 0x08f102d9, 0xc8952ace, 0x883852f7, 0x485c7ae0, + 0x0844e03c, 0xc820c82b, 0x888db012, 0x48e99805, 0x08d74160, + 0xc8b36977, 0x881e114e, 0x487a3959, 0x4928542c, 0x894c7c3b, + 0xc9e10402, 0x09852c15, 0x49bbf570, 0x89dfdd67, 0xc972a55e, + 0x09168d49, 0x490e1795, 0x896a3f82, 0xc9c747bb, 0x09a36fac, + 0x499db6c9, 0x89f99ede, 0xc954e6e7, 0x0930cef0, 0xcbf03c0d, + 0x0b94141a, 0x4b396c23, 0x8b5d4434, 0xcb639d51, 0x0b07b546, + 0x4baacd7f, 0x8bcee568, 0xcbd67fb4, 0x0bb257a3, 0x4b1f2f9a, + 0x8b7b078d, 0xcb45dee8, 0x0b21f6ff, 0x4b8c8ec6, 0x8be8a6d1, + 0x8abacba4, 0x4adee3b3, 0x0a739b8a, 0xca17b39d, 0x8a296af8, + 0x4a4d42ef, 0x0ae03ad6, 0xca8412c1, 0x8a9c881d, 0x4af8a00a, + 0x0a55d833, 0xca31f024, 0x8a0f2941, 0x4a6b0156, 0x0ac6796f, + 0xcaa25178}, + {0x00000000, 0xd4ea739b, 0xe9d396ed, 0x3d39e576, 0x93a15c00, + 0x474b2f9b, 0x7a72caed, 0xae98b976, 0x2643b900, 0xf2a9ca9b, + 0xcf902fed, 0x1b7a5c76, 0xb5e2e500, 0x6108969b, 0x5c3173ed, + 0x88db0076, 0x4c867201, 0x986c019a, 0xa555e4ec, 0x71bf9777, + 0xdf272e01, 0x0bcd5d9a, 0x36f4b8ec, 0xe21ecb77, 0x6ac5cb01, + 0xbe2fb89a, 0x83165dec, 0x57fc2e77, 0xf9649701, 0x2d8ee49a, + 0x10b701ec, 0xc45d7277, 0x980ce502, 0x4ce69699, 0x71df73ef, + 0xa5350074, 0x0badb902, 0xdf47ca99, 0xe27e2fef, 0x36945c74, + 0xbe4f5c02, 0x6aa52f99, 0x579ccaef, 0x8376b974, 0x2dee0002, + 0xf9047399, 0xc43d96ef, 0x10d7e574, 0xd48a9703, 0x0060e498, + 0x3d5901ee, 0xe9b37275, 0x472bcb03, 0x93c1b898, 0xaef85dee, + 0x7a122e75, 0xf2c92e03, 0x26235d98, 0x1b1ab8ee, 0xcff0cb75, + 0x61687203, 0xb5820198, 0x88bbe4ee, 0x5c519775, 0x3019ca05, + 0xe4f3b99e, 0xd9ca5ce8, 0x0d202f73, 0xa3b89605, 0x7752e59e, + 0x4a6b00e8, 0x9e817373, 0x165a7305, 0xc2b0009e, 0xff89e5e8, + 0x2b639673, 0x85fb2f05, 0x51115c9e, 0x6c28b9e8, 0xb8c2ca73, + 0x7c9fb804, 0xa875cb9f, 0x954c2ee9, 0x41a65d72, 0xef3ee404, + 0x3bd4979f, 0x06ed72e9, 0xd2070172, 0x5adc0104, 0x8e36729f, + 0xb30f97e9, 0x67e5e472, 0xc97d5d04, 0x1d972e9f, 0x20aecbe9, + 0xf444b872, 0xa8152f07, 0x7cff5c9c, 0x41c6b9ea, 0x952cca71, + 0x3bb47307, 0xef5e009c, 0xd267e5ea, 0x068d9671, 0x8e569607, + 0x5abce59c, 0x678500ea, 0xb36f7371, 0x1df7ca07, 0xc91db99c, + 0xf4245cea, 0x20ce2f71, 0xe4935d06, 0x30792e9d, 0x0d40cbeb, + 0xd9aab870, 0x77320106, 0xa3d8729d, 0x9ee197eb, 0x4a0be470, + 0xc2d0e406, 0x163a979d, 0x2b0372eb, 0xffe90170, 0x5171b806, + 0x859bcb9d, 0xb8a22eeb, 0x6c485d70, 0x6032940b, 0xb4d8e790, + 0x89e102e6, 0x5d0b717d, 0xf393c80b, 0x2779bb90, 0x1a405ee6, + 0xceaa2d7d, 0x46712d0b, 0x929b5e90, 0xafa2bbe6, 0x7b48c87d, + 0xd5d0710b, 0x013a0290, 0x3c03e7e6, 0xe8e9947d, 0x2cb4e60a, + 0xf85e9591, 0xc56770e7, 0x118d037c, 0xbf15ba0a, 0x6bffc991, + 0x56c62ce7, 0x822c5f7c, 0x0af75f0a, 0xde1d2c91, 0xe324c9e7, + 0x37ceba7c, 0x9956030a, 0x4dbc7091, 0x708595e7, 0xa46fe67c, + 0xf83e7109, 0x2cd40292, 0x11ede7e4, 0xc507947f, 0x6b9f2d09, + 0xbf755e92, 0x824cbbe4, 0x56a6c87f, 0xde7dc809, 0x0a97bb92, + 0x37ae5ee4, 0xe3442d7f, 0x4ddc9409, 0x9936e792, 0xa40f02e4, + 0x70e5717f, 0xb4b80308, 0x60527093, 0x5d6b95e5, 0x8981e67e, + 0x27195f08, 0xf3f32c93, 0xcecac9e5, 0x1a20ba7e, 0x92fbba08, + 0x4611c993, 0x7b282ce5, 0xafc25f7e, 0x015ae608, 0xd5b09593, + 0xe88970e5, 0x3c63037e, 0x502b5e0e, 0x84c12d95, 0xb9f8c8e3, + 0x6d12bb78, 0xc38a020e, 0x17607195, 0x2a5994e3, 0xfeb3e778, + 0x7668e70e, 0xa2829495, 0x9fbb71e3, 0x4b510278, 0xe5c9bb0e, + 0x3123c895, 0x0c1a2de3, 0xd8f05e78, 0x1cad2c0f, 0xc8475f94, + 0xf57ebae2, 0x2194c979, 0x8f0c700f, 0x5be60394, 0x66dfe6e2, + 0xb2359579, 0x3aee950f, 0xee04e694, 0xd33d03e2, 0x07d77079, + 0xa94fc90f, 0x7da5ba94, 0x409c5fe2, 0x94762c79, 0xc827bb0c, + 0x1ccdc897, 0x21f42de1, 0xf51e5e7a, 0x5b86e70c, 0x8f6c9497, + 0xb25571e1, 0x66bf027a, 0xee64020c, 0x3a8e7197, 0x07b794e1, + 0xd35de77a, 0x7dc55e0c, 0xa92f2d97, 0x9416c8e1, 0x40fcbb7a, + 0x84a1c90d, 0x504bba96, 0x6d725fe0, 0xb9982c7b, 0x1700950d, + 0xc3eae696, 0xfed303e0, 0x2a39707b, 0xa2e2700d, 0x76080396, + 0x4b31e6e0, 0x9fdb957b, 0x31432c0d, 0xe5a95f96, 0xd890bae0, + 0x0c7ac97b}, + {0x00000000, 0x27652581, 0x0fcc3bd9, 0x28a91e58, 0x5f9e0669, + 0x78fb23e8, 0x50523db0, 0x77371831, 0xbe3c0dd2, 0x99592853, + 0xb1f0360b, 0x9695138a, 0xe1a20bbb, 0xc6c72e3a, 0xee6e3062, + 0xc90b15e3, 0x3d7f6b7f, 0x1a1a4efe, 0x32b350a6, 0x15d67527, + 0x62e16d16, 0x45844897, 0x6d2d56cf, 0x4a48734e, 0x834366ad, + 0xa426432c, 0x8c8f5d74, 0xabea78f5, 0xdcdd60c4, 0xfbb84545, + 0xd3115b1d, 0xf4747e9c, 0x7afed6fe, 0x5d9bf37f, 0x7532ed27, + 0x5257c8a6, 0x2560d097, 0x0205f516, 0x2aaceb4e, 0x0dc9cecf, + 0xc4c2db2c, 0xe3a7fead, 0xcb0ee0f5, 0xec6bc574, 0x9b5cdd45, + 0xbc39f8c4, 0x9490e69c, 0xb3f5c31d, 0x4781bd81, 0x60e49800, + 0x484d8658, 0x6f28a3d9, 0x181fbbe8, 0x3f7a9e69, 0x17d38031, + 0x30b6a5b0, 0xf9bdb053, 0xded895d2, 0xf6718b8a, 0xd114ae0b, + 0xa623b63a, 0x814693bb, 0xa9ef8de3, 0x8e8aa862, 0xb5fadc26, + 0x929ff9a7, 0xba36e7ff, 0x9d53c27e, 0xea64da4f, 0xcd01ffce, + 0xe5a8e196, 0xc2cdc417, 0x0bc6d1f4, 0x2ca3f475, 0x040aea2d, + 0x236fcfac, 0x5458d79d, 0x733df21c, 0x5b94ec44, 0x7cf1c9c5, + 0x8885b759, 0xafe092d8, 0x87498c80, 0xa02ca901, 0xd71bb130, + 0xf07e94b1, 0xd8d78ae9, 0xffb2af68, 0x36b9ba8b, 0x11dc9f0a, + 0x39758152, 0x1e10a4d3, 0x6927bce2, 0x4e429963, 0x66eb873b, + 0x418ea2ba, 0xcf040ad8, 0xe8612f59, 0xc0c83101, 0xe7ad1480, + 0x909a0cb1, 0xb7ff2930, 0x9f563768, 0xb83312e9, 0x7138070a, + 0x565d228b, 0x7ef43cd3, 0x59911952, 0x2ea60163, 0x09c324e2, + 0x216a3aba, 0x060f1f3b, 0xf27b61a7, 0xd51e4426, 0xfdb75a7e, + 0xdad27fff, 0xade567ce, 0x8a80424f, 0xa2295c17, 0x854c7996, + 0x4c476c75, 0x6b2249f4, 0x438b57ac, 0x64ee722d, 0x13d96a1c, + 0x34bc4f9d, 0x1c1551c5, 0x3b707444, 0x6af5b94d, 0x4d909ccc, + 0x65398294, 0x425ca715, 0x356bbf24, 0x120e9aa5, 0x3aa784fd, + 0x1dc2a17c, 0xd4c9b49f, 0xf3ac911e, 0xdb058f46, 0xfc60aac7, + 0x8b57b2f6, 0xac329777, 0x849b892f, 0xa3feacae, 0x578ad232, + 0x70eff7b3, 0x5846e9eb, 0x7f23cc6a, 0x0814d45b, 0x2f71f1da, + 0x07d8ef82, 0x20bdca03, 0xe9b6dfe0, 0xced3fa61, 0xe67ae439, + 0xc11fc1b8, 0xb628d989, 0x914dfc08, 0xb9e4e250, 0x9e81c7d1, + 0x100b6fb3, 0x376e4a32, 0x1fc7546a, 0x38a271eb, 0x4f9569da, + 0x68f04c5b, 0x40595203, 0x673c7782, 0xae376261, 0x895247e0, + 0xa1fb59b8, 0x869e7c39, 0xf1a96408, 0xd6cc4189, 0xfe655fd1, + 0xd9007a50, 0x2d7404cc, 0x0a11214d, 0x22b83f15, 0x05dd1a94, + 0x72ea02a5, 0x558f2724, 0x7d26397c, 0x5a431cfd, 0x9348091e, + 0xb42d2c9f, 0x9c8432c7, 0xbbe11746, 0xccd60f77, 0xebb32af6, + 0xc31a34ae, 0xe47f112f, 0xdf0f656b, 0xf86a40ea, 0xd0c35eb2, + 0xf7a67b33, 0x80916302, 0xa7f44683, 0x8f5d58db, 0xa8387d5a, + 0x613368b9, 0x46564d38, 0x6eff5360, 0x499a76e1, 0x3ead6ed0, + 0x19c84b51, 0x31615509, 0x16047088, 0xe2700e14, 0xc5152b95, + 0xedbc35cd, 0xcad9104c, 0xbdee087d, 0x9a8b2dfc, 0xb22233a4, + 0x95471625, 0x5c4c03c6, 0x7b292647, 0x5380381f, 0x74e51d9e, + 0x03d205af, 0x24b7202e, 0x0c1e3e76, 0x2b7b1bf7, 0xa5f1b395, + 0x82949614, 0xaa3d884c, 0x8d58adcd, 0xfa6fb5fc, 0xdd0a907d, + 0xf5a38e25, 0xd2c6aba4, 0x1bcdbe47, 0x3ca89bc6, 0x1401859e, + 0x3364a01f, 0x4453b82e, 0x63369daf, 0x4b9f83f7, 0x6cfaa676, + 0x988ed8ea, 0xbfebfd6b, 0x9742e333, 0xb027c6b2, 0xc710de83, + 0xe075fb02, 0xc8dce55a, 0xefb9c0db, 0x26b2d538, 0x01d7f0b9, + 0x297eeee1, 0x0e1bcb60, 0x792cd351, 0x5e49f6d0, 0x76e0e888, + 0x5185cd09}}; + +#endif + +#endif + +#endif + +local const z_crc_t FAR x2n_table[] = { + 0x40000000, 0x20000000, 0x08000000, 0x00800000, 0x00008000, + 0xedb88320, 0xb1e6b092, 0xa06a2517, 0xed627dae, 0x88d14467, + 0xd7bbfe6a, 0xec447f11, 0x8e7ea170, 0x6427800e, 0x4d47bae0, + 0x09fe548f, 0x83852d0f, 0x30362f1a, 0x7b5a9cc3, 0x31fec169, + 0x9fec022a, 0x6c8dedc4, 0x15d6874d, 0x5fde7a4e, 0xbad90e37, + 0x2e4e5eef, 0x4eaba214, 0xa8a472c0, 0x429a969e, 0x148d302a, + 0xc40ba6d0, 0xc4e22c3c}; diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.c index 1ec761448de926..ca2fc59a1b54a8 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; + " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -60,9 +60,6 @@ const char deflate_copyright[] = copyright string in the executable of your product. */ -/* =========================================================================== - * Function prototypes. - */ typedef enum { need_more, /* block not completed, need more input or more output */ block_done, /* block flush performed */ @@ -70,35 +67,16 @@ typedef enum { finish_done /* finish done, accept no more input or output */ } block_state; -typedef block_state (*compress_func) OF((deflate_state *s, int flush)); +typedef block_state (*compress_func)(deflate_state *s, int flush); /* Compression function. Returns the block state after the call. */ -local int deflateStateCheck OF((z_streamp strm)); -local void slide_hash OF((deflate_state *s)); -local void fill_window OF((deflate_state *s)); -local block_state deflate_stored OF((deflate_state *s, int flush)); -local block_state deflate_fast OF((deflate_state *s, int flush)); +local block_state deflate_stored(deflate_state *s, int flush); +local block_state deflate_fast(deflate_state *s, int flush); #ifndef FASTEST -local block_state deflate_slow OF((deflate_state *s, int flush)); -#endif -local block_state deflate_rle OF((deflate_state *s, int flush)); -local block_state deflate_huff OF((deflate_state *s, int flush)); -local void lm_init OF((deflate_state *s)); -local void putShortMSB OF((deflate_state *s, uInt b)); -local void flush_pending OF((z_streamp strm)); -local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifdef ASMV -# pragma message("Assembler code may have bugs -- use at your own risk") - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else -local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif - -#ifdef ZLIB_DEBUG -local void check_match OF((deflate_state *s, IPos start, IPos match, - int length)); +local block_state deflate_slow(deflate_state *s, int flush); #endif +local block_state deflate_rle(deflate_state *s, int flush); +local block_state deflate_huff(deflate_state *s, int flush); /* =========================================================================== * Local data @@ -160,7 +138,7 @@ local const config configuration_table[10] = { * characters, so that a running hash key can be computed from the previous * key instead of complete recalculation each time. */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) +#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== @@ -190,17 +168,23 @@ local const config configuration_table[10] = { * prev[] will be initialized on the fly. */ #define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + do { \ + s->head[s->hash_size - 1] = NIL; \ + zmemzero((Bytef *)s->head, \ + (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \ + } while (0) /* =========================================================================== * Slide the hash table when sliding the window down (could be avoided with 32 * bit values at the expense of memory usage). We slide even when level == 0 to * keep the hash table consistent if we switch back to level > 0 later. */ -local void slide_hash(s) - deflate_state *s; -{ +#if defined(__has_feature) +# if __has_feature(memory_sanitizer) + __attribute__((no_sanitize("memory"))) +# endif +#endif +local void slide_hash(deflate_state *s) { unsigned n, m; Posf *p; uInt wsize = s->w_size; @@ -224,39 +208,181 @@ local void slide_hash(s) #endif } +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->next_in buffer and copying from it. + * (See also flush_pending()). + */ +local unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size) { + unsigned len = strm->avail_in; + + if (len > size) len = size; + if (len == 0) return 0; + + strm->avail_in -= len; + + zmemcpy(buf, strm->next_in, len); + if (strm->state->wrap == 1) { + strm->adler = adler32(strm->adler, buf, len); + } +#ifdef GZIP + else if (strm->state->wrap == 2) { + strm->adler = crc32(strm->adler, buf, len); + } +#endif + strm->next_in += len; + strm->total_in += len; + + return len; +} + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +local void fill_window(deflate_state *s) { + unsigned n; + unsigned more; /* Amount of free space at the end of the window. */ + uInt wsize = s->w_size; + + Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + + do { + more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); + + /* Deal with !@#$% 64K limit: */ + if (sizeof(int) <= 2) { + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; + + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if + * strstart == 0 && lookahead == 1 (input done a byte at time) + */ + more--; + } + } + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s->strstart >= wsize + MAX_DIST(s)) { + + zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more); + s->match_start -= wsize; + s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ + s->block_start -= (long) wsize; + if (s->insert > s->strstart) + s->insert = s->strstart; + slide_hash(s); + more += wsize; + } + if (s->strm->avail_in == 0) break; + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + Assert(more >= 2, "more < 2"); + + n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); + s->lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s->lookahead + s->insert >= MIN_MATCH) { + uInt str = s->strstart - s->insert; + s->ins_h = s->window[str]; + UPDATE_HASH(s, s->ins_h, s->window[str + 1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + while (s->insert) { + UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); +#ifndef FASTEST + s->prev[str & s->w_mask] = s->head[s->ins_h]; +#endif + s->head[s->ins_h] = (Pos)str; + str++; + s->insert--; + if (s->lookahead + s->insert < MIN_MATCH) + break; + } + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ + if (s->high_water < s->window_size) { + ulg curr = s->strstart + (ulg)(s->lookahead); + ulg init; + + if (s->high_water < curr) { + /* Previous high water mark below current data -- zero WIN_INIT + * bytes or up to end of window, whichever is less. + */ + init = s->window_size - curr; + if (init > WIN_INIT) + init = WIN_INIT; + zmemzero(s->window + curr, (unsigned)init); + s->high_water = curr + init; + } + else if (s->high_water < (ulg)curr + WIN_INIT) { + /* High water mark at or above current data, but below current data + * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up + * to end of window, whichever is less. + */ + init = (ulg)curr + WIN_INIT - s->high_water; + if (init > s->window_size - s->high_water) + init = s->window_size - s->high_water; + zmemzero(s->window + s->high_water, (unsigned)init); + s->high_water += init; + } + } + + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "not enough room for search"); +} + /* ========================================================================= */ -int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; - int level; - const char *version; - int stream_size; -{ +int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, + int stream_size) { return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size); /* To do: ignore strm->next_in if we use it as window */ } /* ========================================================================= */ -int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) - z_streamp strm; - int level; - int method; - int windowBits; - int memLevel; - int strategy; - const char *version; - int stream_size; -{ +int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, + int windowBits, int memLevel, int strategy, + const char *version, int stream_size) { deflate_state *s; int wrap = 1; static const char my_version[] = ZLIB_VERSION; - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { return Z_VERSION_ERROR; @@ -287,6 +413,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; + if (windowBits < -15) + return Z_STREAM_ERROR; windowBits = -windowBits; } #ifdef GZIP @@ -316,7 +444,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->hash_bits = (uInt)memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); @@ -326,9 +454,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + /* We overlay pending_buf and sym_buf. This works since the average size + * for length/distance pairs over any compressed block is assured to be 31 + * bits or less. + * + * Analysis: The longest fixed codes are a length code of 8 bits plus 5 + * extra bits, for lengths 131 to 257. The longest fixed distance codes are + * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest + * possible fixed-codes length/distance pair is then 31 bits total. + * + * sym_buf starts one-fourth of the way into pending_buf. So there are + * three bytes in sym_buf for every four bytes in pending_buf. Each symbol + * in sym_buf is three bytes -- two for the distance and one for the + * literal/length. As each symbol is consumed, the pointer to the next + * sym_buf value to read moves forward three bytes. From that symbol, up to + * 31 bits are written to pending_buf. The closest the written pending_buf + * bits gets to the next sym_buf symbol to read is just before the last + * code is written. At that time, 31*(n - 2) bits have been written, just + * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at + * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1 + * symbols are written.) The closest the writing gets to what is unread is + * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and + * can range from 128 to 32768. + * + * Therefore, at a minimum, there are 142 bits of space between what is + * written and what is read in the overlain buffers, so the symbols cannot + * be overwritten by the compressed data. That space is actually 139 bits, + * due to the three-bit fixed-code block header. + * + * That covers the case where either Z_FIXED is specified, forcing fixed + * codes, or when the use of fixed codes is chosen, because that choice + * results in a smaller compressed block than dynamic codes. That latter + * condition then assures that the above analysis also covers all dynamic + * blocks. A dynamic-code block will only be chosen to be emitted if it has + * fewer bits than a fixed-code block would for the same set of symbols. + * Therefore its average symbol length is assured to be less than 31. So + * the compressed data for a dynamic block also cannot overwrite the + * symbols from which it is being constructed. + */ + + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS); + s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { @@ -337,8 +503,18 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, deflateEnd (strm); return Z_MEM_ERROR; } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; +#ifdef LIT_MEM + s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1)); + s->l_buf = s->pending_buf + (s->lit_bufsize << 2); + s->sym_end = s->lit_bufsize - 1; +#else + s->sym_buf = s->pending_buf + s->lit_bufsize; + s->sym_end = (s->lit_bufsize - 1) * 3; +#endif + /* We avoid equality with lit_bufsize*3 because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ s->level = level; s->strategy = strategy; @@ -350,9 +526,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, /* ========================================================================= * Check for a valid deflate stream state. Return 0 if ok, 1 if not. */ -local int deflateStateCheck (strm) - z_streamp strm; -{ +local int deflateStateCheck(z_streamp strm) { deflate_state *s; if (strm == Z_NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) @@ -373,11 +547,8 @@ local int deflateStateCheck (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) - z_streamp strm; - const Bytef *dictionary; - uInt dictLength; -{ +int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary, + uInt dictLength) { deflate_state *s; uInt str, n; int wrap; @@ -442,11 +613,8 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) - z_streamp strm; - Bytef *dictionary; - uInt *dictLength; -{ +int ZEXPORT deflateGetDictionary(z_streamp strm, Bytef *dictionary, + uInt *dictLength) { deflate_state *s; uInt len; @@ -464,9 +632,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateResetKeep (strm) - z_streamp strm; -{ +int ZEXPORT deflateResetKeep(z_streamp strm) { deflate_state *s; if (deflateStateCheck(strm)) { @@ -488,23 +654,45 @@ int ZEXPORT deflateResetKeep (strm) #ifdef GZIP s->wrap == 2 ? GZIP_STATE : #endif - s->wrap ? INIT_STATE : BUSY_STATE; + INIT_STATE; strm->adler = #ifdef GZIP s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; + s->last_flush = -2; _tr_init(s); return Z_OK; } +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +local void lm_init(deflate_state *s) { + s->window_size = (ulg)2L*s->w_size; + + CLEAR_HASH(s); + + /* Set the default configuration parameters: + */ + s->max_lazy_match = configuration_table[s->level].max_lazy; + s->good_match = configuration_table[s->level].good_length; + s->nice_match = configuration_table[s->level].nice_length; + s->max_chain_length = configuration_table[s->level].max_chain; + + s->strstart = 0; + s->block_start = 0L; + s->lookahead = 0; + s->insert = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + s->ins_h = 0; +} + /* ========================================================================= */ -int ZEXPORT deflateReset (strm) - z_streamp strm; -{ +int ZEXPORT deflateReset(z_streamp strm) { int ret; ret = deflateResetKeep(strm); @@ -514,10 +702,7 @@ int ZEXPORT deflateReset (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) - z_streamp strm; - gz_headerp head; -{ +int ZEXPORT deflateSetHeader(z_streamp strm, gz_headerp head) { if (deflateStateCheck(strm) || strm->state->wrap != 2) return Z_STREAM_ERROR; strm->state->gzhead = head; @@ -525,11 +710,7 @@ int ZEXPORT deflateSetHeader (strm, head) } /* ========================================================================= */ -int ZEXPORT deflatePending (strm, pending, bits) - unsigned *pending; - int *bits; - z_streamp strm; -{ +int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits) { if (deflateStateCheck(strm)) return Z_STREAM_ERROR; if (pending != Z_NULL) *pending = strm->state->pending; @@ -539,18 +720,21 @@ int ZEXPORT deflatePending (strm, pending, bits) } /* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) - z_streamp strm; - int bits; - int value; -{ +int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) { deflate_state *s; int put; if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; - if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) +#ifdef LIT_MEM + if (bits < 0 || bits > 16 || + (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; +#else + if (bits < 0 || bits > 16 || + s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; +#endif do { put = Buf_size - s->bi_valid; if (put > bits) @@ -565,11 +749,7 @@ int ZEXPORT deflatePrime (strm, bits, value) } /* ========================================================================= */ -int ZEXPORT deflateParams(strm, level, strategy) - z_streamp strm; - int level; - int strategy; -{ +int ZEXPORT deflateParams(z_streamp strm, int level, int strategy) { deflate_state *s; compress_func func; @@ -587,12 +767,12 @@ int ZEXPORT deflateParams(strm, level, strategy) func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && - s->high_water) { + s->last_flush != -2) { /* Flush the last buffer: */ int err = deflate(strm, Z_BLOCK); if (err == Z_STREAM_ERROR) return err; - if (strm->avail_out == 0) + if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead) return Z_BUF_ERROR; } if (s->level != level) { @@ -614,13 +794,8 @@ int ZEXPORT deflateParams(strm, level, strategy) } /* ========================================================================= */ -int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) - z_streamp strm; - int good_length; - int max_lazy; - int nice_length; - int max_chain; -{ +int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy, + int nice_length, int max_chain) { deflate_state *s; if (deflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -633,36 +808,47 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) } /* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. + * For the default windowBits of 15 and memLevel of 8, this function returns a + * close to exact, as well as small, upper bound on the compressed size. This + * is an expansion of ~0.03%, plus a small constant. + * + * For any setting other than those defaults for windowBits and memLevel, one + * of two worst case bounds is returned. This is at most an expansion of ~4% or + * ~13%, plus a small constant. + * + * Both the 0.03% and 4% derive from the overhead of stored blocks. The first + * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second + * is for stored blocks of 127 bytes (the worst case memLevel == 1). The + * expansion results from five bytes of header for each stored block. * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. + * The larger expansion of 13% results from a window size less than or equal to + * the symbols buffer size (windowBits <= memLevel + 7). In that case some of + * the data being compressed may have slid out of the sliding window, impeding + * a stored block from being emitted. Then the only choice is a fixed or + * dynamic block, where a fixed block limits the maximum expansion to 9 bits + * per 8-bit byte, plus 10 bits for every block. The smallest block size for + * which this can occur is 255 (memLevel == 2). * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. + * Shifts are used to approximate divisions, for speed. */ -uLong ZEXPORT deflateBound(strm, sourceLen) - z_streamp strm; - uLong sourceLen; -{ +uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen) { deflate_state *s; - uLong complen, wraplen; + uLong fixedlen, storelen, wraplen; - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + /* upper bound for fixed blocks with 9-bit literals and length 255 + (memLevel == 2, which is the lowest that may not use stored blocks) -- + ~13% overhead plus a small constant */ + fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) + + (sourceLen >> 9) + 4; - /* if can't get parameters, return conservative bound plus zlib wrapper */ + /* upper bound for stored blocks with length 127 (memLevel == 1) -- + ~4% overhead plus a small constant */ + storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) + + (sourceLen >> 11) + 7; + + /* if can't get parameters, return larger bound plus a zlib wrapper */ if (deflateStateCheck(strm)) - return complen + 6; + return (fixedlen > storelen ? fixedlen : storelen) + 6; /* compute wrapper length */ s = strm->state; @@ -699,11 +885,13 @@ uLong ZEXPORT deflateBound(strm, sourceLen) wraplen = 6; } - /* if not default parameters, return conservative bound */ + /* if not default parameters, return one of the conservative bounds */ if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; + return (s->w_bits <= s->hash_bits && s->level ? fixedlen : storelen) + + wraplen; - /* default settings: return tight bound for that case */ + /* default settings: return tight bound for that case -- ~0.03% overhead + plus a small constant */ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; } @@ -713,10 +901,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ -local void putShortMSB (s, b) - deflate_state *s; - uInt b; -{ +local void putShortMSB(deflate_state *s, uInt b) { put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b & 0xff)); } @@ -727,9 +912,7 @@ local void putShortMSB (s, b) * applications may wish to modify it to avoid allocating a large * strm->next_out buffer and copying into it. (See also read_buf()). */ -local void flush_pending(strm) - z_streamp strm; -{ +local void flush_pending(z_streamp strm) { unsigned len; deflate_state *s = strm->state; @@ -760,10 +943,7 @@ local void flush_pending(strm) } while (0) /* ========================================================================= */ -int ZEXPORT deflate (strm, flush) - z_streamp strm; - int flush; -{ +int ZEXPORT deflate(z_streamp strm, int flush) { int old_flush; /* value of flush param for previous deflate call */ deflate_state *s; @@ -811,9 +991,11 @@ int ZEXPORT deflate (strm, flush) } /* Write the header */ + if (s->status == INIT_STATE && s->wrap == 0) + s->status = BUSY_STATE; if (s->status == INIT_STATE) { /* zlib header */ - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) @@ -1073,9 +1255,7 @@ int ZEXPORT deflate (strm, flush) } /* ========================================================================= */ -int ZEXPORT deflateEnd (strm) - z_streamp strm; -{ +int ZEXPORT deflateEnd(z_streamp strm) { int status; if (deflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -1099,16 +1279,14 @@ int ZEXPORT deflateEnd (strm) * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ -int ZEXPORT deflateCopy (dest, source) - z_streamp dest; - z_streamp source; -{ +int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) { #ifdef MAXSEG_64K + (void)dest; + (void)source; return Z_STREAM_ERROR; #else deflate_state *ds; deflate_state *ss; - ushf *overlay; if (deflateStateCheck(source) || dest == Z_NULL) { @@ -1128,8 +1306,7 @@ int ZEXPORT deflateCopy (dest, source) ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1140,11 +1317,15 @@ int ZEXPORT deflateCopy (dest, source) zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; +#ifdef LIT_MEM + ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1)); + ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2); +#else + ds->sym_buf = ds->pending_buf + ds->lit_bufsize; +#endif ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1154,71 +1335,6 @@ int ZEXPORT deflateCopy (dest, source) #endif /* MAXSEG_64K */ } -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->next_in buffer and copying from it. - * (See also flush_pending()). - */ -local unsigned read_buf(strm, buf, size) - z_streamp strm; - Bytef *buf; - unsigned size; -{ - unsigned len = strm->avail_in; - - if (len > size) len = size; - if (len == 0) return 0; - - strm->avail_in -= len; - - zmemcpy(buf, strm->next_in, len); - if (strm->state->wrap == 1) { - strm->adler = adler32(strm->adler, buf, len); - } -#ifdef GZIP - else if (strm->state->wrap == 2) { - strm->adler = crc32(strm->adler, buf, len); - } -#endif - strm->next_in += len; - strm->total_in += len; - - return len; -} - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -local void lm_init (s) - deflate_state *s; -{ - s->window_size = (ulg)2L*s->w_size; - - CLEAR_HASH(s); - - /* Set the default configuration parameters: - */ - s->max_lazy_match = configuration_table[s->level].max_lazy; - s->good_match = configuration_table[s->level].good_length; - s->nice_match = configuration_table[s->level].nice_length; - s->max_chain_length = configuration_table[s->level].max_chain; - - s->strstart = 0; - s->block_start = 0L; - s->lookahead = 0; - s->insert = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif -} - #ifndef FASTEST /* =========================================================================== * Set match_start to the longest match starting at the given string and @@ -1229,14 +1345,7 @@ local void lm_init (s) * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ +local uInt longest_match(deflate_state *s, IPos cur_match) { unsigned chain_length = s->max_chain_length;/* max hash chain length */ register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ @@ -1257,10 +1366,10 @@ local uInt longest_match(s, cur_match) */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); + register ush scan_end = *(ushf*)(scan + best_len - 1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end1 = scan[best_len - 1]; register Byte scan_end = scan[best_len]; #endif @@ -1278,7 +1387,8 @@ local uInt longest_match(s, cur_match) */ if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead; - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); @@ -1296,43 +1406,44 @@ local uInt longest_match(s, cur_match) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ - if (*(ushf*)(match+best_len-1) != scan_end || + if (*(ushf*)(match + best_len - 1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient + * strstart + 3, + 5, up to strstart + 257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + } while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + /* Here, scan <= window + strstart + 257 */ + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); if (*scan == *match) scan++; - len = (MAX_MATCH - 1) - (int)(strend-scan); + len = (MAX_MATCH - 1) - (int)(strend - scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; + if (match[best_len] != scan_end || + match[best_len - 1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1342,7 +1453,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1351,7 +1462,8 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; @@ -1363,9 +1475,9 @@ local uInt longest_match(s, cur_match) best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); + scan_end = *(ushf*)(scan + best_len - 1); #else - scan_end1 = scan[best_len-1]; + scan_end1 = scan[best_len - 1]; scan_end = scan[best_len]; #endif } @@ -1375,17 +1487,13 @@ local uInt longest_match(s, cur_match) if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } -#endif /* ASMV */ #else /* FASTEST */ /* --------------------------------------------------------------------------- * Optimized version for FASTEST only */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ +local uInt longest_match(deflate_state *s, IPos cur_match) { register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ register int len; /* length of current match */ @@ -1396,7 +1504,8 @@ local uInt longest_match(s, cur_match) */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); Assert(cur_match < s->strstart, "no future"); @@ -1406,7 +1515,7 @@ local uInt longest_match(s, cur_match) */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1416,7 +1525,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1425,7 +1534,7 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); @@ -1445,23 +1554,27 @@ local uInt longest_match(s, cur_match) /* =========================================================================== * Check that the match at match_start is indeed a match. */ -local void check_match(s, start, match, length) - deflate_state *s; - IPos start, match; - int length; -{ +local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); + fprintf(stderr,"\\[%d,%d]", start - match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } @@ -1469,135 +1582,6 @@ local void check_match(s, start, match, length) # define check_match(s, start, match, length) #endif /* ZLIB_DEBUG */ -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -local void fill_window(s) - deflate_state *s; -{ - unsigned n; - unsigned more; /* Amount of free space at the end of the window. */ - uInt wsize = s->w_size; - - Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); - - /* Deal with !@#$% 64K limit: */ - if (sizeof(int) <= 2) { - if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - more = wsize; - - } else if (more == (unsigned)(-1)) { - /* Very unlikely, but possible on 16 bit machine if - * strstart == 0 && lookahead == 1 (input done a byte at time) - */ - more--; - } - } - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s->strstart >= wsize+MAX_DIST(s)) { - - zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more); - s->match_start -= wsize; - s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (long) wsize; - slide_hash(s); - more += wsize; - } - if (s->strm->avail_in == 0) break; - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - Assert(more >= 2, "more < 2"); - - n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); - s->lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s->lookahead + s->insert >= MIN_MATCH) { - uInt str = s->strstart - s->insert; - s->ins_h = s->window[str]; - UPDATE_HASH(s, s->ins_h, s->window[str + 1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - while (s->insert) { - UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); -#ifndef FASTEST - s->prev[str & s->w_mask] = s->head[s->ins_h]; -#endif - s->head[s->ins_h] = (Pos)str; - str++; - s->insert--; - if (s->lookahead + s->insert < MIN_MATCH) - break; - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ - if (s->high_water < s->window_size) { - ulg curr = s->strstart + (ulg)(s->lookahead); - ulg init; - - if (s->high_water < curr) { - /* Previous high water mark below current data -- zero WIN_INIT - * bytes or up to end of window, whichever is less. - */ - init = s->window_size - curr; - if (init > WIN_INIT) - init = WIN_INIT; - zmemzero(s->window + curr, (unsigned)init); - s->high_water = curr + init; - } - else if (s->high_water < (ulg)curr + WIN_INIT) { - /* High water mark at or above current data, but below current data - * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up - * to end of window, whichever is less. - */ - init = (ulg)curr + WIN_INIT - s->high_water; - if (init > s->window_size - s->high_water) - init = s->window_size - s->high_water; - zmemzero(s->window + s->high_water, (unsigned)init); - s->high_water += init; - } - } - - Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, - "not enough room for search"); -} - /* =========================================================================== * Flush the current block, with given end-of-file flag. * IN assertion: strstart is set to the end of the current match. @@ -1638,12 +1622,9 @@ local void fill_window(s) * * deflate_stored() is written to minimize the number of times an input byte is * copied. It is most efficient with large input and output buffers, which - * maximizes the opportunites to have a single copy from next_in to next_out. + * maximizes the opportunities to have a single copy from next_in to next_out. */ -local block_state deflate_stored(s, flush) - deflate_state *s; - int flush; -{ +local block_state deflate_stored(deflate_state *s, int flush) { /* Smallest worthy block size when not flushing or finishing. By default * this is 32K. This can be as small as 507 bytes for memLevel == 1. For * large input and output buffers, the stored block size will be larger. @@ -1690,10 +1671,10 @@ local block_state deflate_stored(s, flush) _tr_stored_block(s, (char *)0, 0L, last); /* Replace the lengths in the dummy stored block with len. */ - s->pending_buf[s->pending - 4] = len; - s->pending_buf[s->pending - 3] = len >> 8; - s->pending_buf[s->pending - 2] = ~len; - s->pending_buf[s->pending - 1] = ~len >> 8; + s->pending_buf[s->pending - 4] = (Bytef)len; + s->pending_buf[s->pending - 3] = (Bytef)(len >> 8); + s->pending_buf[s->pending - 2] = (Bytef)~len; + s->pending_buf[s->pending - 1] = (Bytef)(~len >> 8); /* Write the stored block header bytes. */ flush_pending(s->strm); @@ -1742,6 +1723,7 @@ local block_state deflate_stored(s, flush) s->matches = 2; /* clear hash */ zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size); s->strstart = s->w_size; + s->insert = s->strstart; } else { if (s->window_size - s->strstart <= used) { @@ -1750,12 +1732,14 @@ local block_state deflate_stored(s, flush) zmemcpy(s->window, s->window + s->w_size, s->strstart); if (s->matches < 2) s->matches++; /* add a pending slide_hash() */ + if (s->insert > s->strstart) + s->insert = s->strstart; } zmemcpy(s->window + s->strstart, s->strm->next_in - used, used); s->strstart += used; + s->insert += MIN(used, s->w_size - s->insert); } s->block_start = s->strstart; - s->insert += MIN(used, s->w_size - s->insert); } if (s->high_water < s->strstart) s->high_water = s->strstart; @@ -1770,7 +1754,7 @@ local block_state deflate_stored(s, flush) return block_done; /* Fill the window with any remaining input. */ - have = s->window_size - s->strstart - 1; + have = s->window_size - s->strstart; if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) { /* Slide the window down. */ s->block_start -= s->w_size; @@ -1779,12 +1763,15 @@ local block_state deflate_stored(s, flush) if (s->matches < 2) s->matches++; /* add a pending slide_hash() */ have += s->w_size; /* more space now */ + if (s->insert > s->strstart) + s->insert = s->strstart; } if (have > s->strm->avail_in) have = s->strm->avail_in; if (have) { read_buf(s->strm, s->window + s->strstart, have); s->strstart += have; + s->insert += MIN(have, s->w_size - s->insert); } if (s->high_water < s->strstart) s->high_water = s->strstart; @@ -1821,10 +1808,7 @@ local block_state deflate_stored(s, flush) * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ -local block_state deflate_fast(s, flush) - deflate_state *s; - int flush; -{ +local block_state deflate_fast(deflate_state *s, int flush) { IPos hash_head; /* head of the hash chain */ int bflush; /* set if current block must be flushed */ @@ -1842,7 +1826,7 @@ local block_state deflate_fast(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1890,7 +1874,7 @@ local block_state deflate_fast(s, flush) s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); + UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif @@ -1901,7 +1885,7 @@ local block_state deflate_fast(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -1912,7 +1896,7 @@ local block_state deflate_fast(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -1923,10 +1907,7 @@ local block_state deflate_fast(s, flush) * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ -local block_state deflate_slow(s, flush) - deflate_state *s; - int flush; -{ +local block_state deflate_slow(deflate_state *s, int flush) { IPos hash_head; /* head of hash chain */ int bflush; /* set if current block must be flushed */ @@ -1945,7 +1926,7 @@ local block_state deflate_slow(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1987,17 +1968,17 @@ local block_state deflate_slow(s, flush) uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ - check_match(s, s->strstart-1, s->prev_match, s->prev_length); + check_match(s, s->strstart - 1, s->prev_match, s->prev_length); - _tr_tally_dist(s, s->strstart -1 - s->prev_match, + _tr_tally_dist(s, s->strstart - 1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not + * strstart - 1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ - s->lookahead -= s->prev_length-1; + s->lookahead -= s->prev_length - 1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { @@ -2015,8 +1996,8 @@ local block_state deflate_slow(s, flush) * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } @@ -2034,8 +2015,8 @@ local block_state deflate_slow(s, flush) } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); s->match_available = 0; } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; @@ -2043,7 +2024,7 @@ local block_state deflate_slow(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -2054,10 +2035,7 @@ local block_state deflate_slow(s, flush) * one. Do not maintain a hash table. (It will be regenerated if this run of * deflate switches away from Z_RLE.) */ -local block_state deflate_rle(s, flush) - deflate_state *s; - int flush; -{ +local block_state deflate_rle(deflate_state *s, int flush) { int bflush; /* set if current block must be flushed */ uInt prev; /* byte at distance one to match */ Bytef *scan, *strend; /* scan goes up to strend for length of run */ @@ -2092,7 +2070,8 @@ local block_state deflate_rle(s, flush) if (s->match_length > s->lookahead) s->match_length = s->lookahead; } - Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (uInt)(s->window_size - 1), + "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ @@ -2107,7 +2086,7 @@ local block_state deflate_rle(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -2118,7 +2097,7 @@ local block_state deflate_rle(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -2127,10 +2106,7 @@ local block_state deflate_rle(s, flush) * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. * (It will be regenerated if this run of deflate switches away from Huffman.) */ -local block_state deflate_huff(s, flush) - deflate_state *s; - int flush; -{ +local block_state deflate_huff(deflate_state *s, int flush) { int bflush; /* set if current block must be flushed */ for (;;) { @@ -2147,7 +2123,7 @@ local block_state deflate_huff(s, flush) /* Output a literal byte */ s->match_length = 0; Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); @@ -2157,7 +2133,7 @@ local block_state deflate_huff(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.h index 23ecdd312bc06e..300c6ada62b82e 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/deflate.h @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2016 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,10 @@ # define GZIP #endif +/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at + the cost of a larger memory footprint */ +/* #define LIT_MEM */ + /* =========================================================================== * Internal compression state. */ @@ -217,7 +221,14 @@ typedef struct internal_state { /* Depth of each subtree used as tie breaker for trees of equal frequency */ - uchf *l_buf; /* buffer for literals or lengths */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + ushf *d_buf; /* buffer for distances */ + uchf *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 + uchf *sym_buf; /* buffer for distances and literals/lengths */ +#endif uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,13 +250,8 @@ typedef struct internal_state { * - I can't count above 4 */ - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ + uInt sym_next; /* running index in symbol buffer */ + uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ @@ -296,14 +302,14 @@ typedef struct internal_state { memory checker errors from longest match routines */ /* in trees.c */ -void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); -int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, - ulg stored_len, int last)); -void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); -void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); -void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, - ulg stored_len, int last)); +void ZLIB_INTERNAL _tr_init(deflate_state *s); +int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc); +void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, + ulg stored_len, int last); +void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s); +void ZLIB_INTERNAL _tr_align(deflate_state *s); +void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, + ulg stored_len, int last); #define d_code(dist) \ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) @@ -323,23 +329,45 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, extern const uch ZLIB_INTERNAL _dist_code[]; #endif +#ifdef LIT_MEM +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->sym_next] = 0; \ + s->l_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ + s->d_buf[s->sym_next] = dist; \ + s->l_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +#else # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ + s->sym_buf[s->sym_next++] = 0; \ + s->sym_buf[s->sym_next++] = 0; \ + s->sym_buf[s->sym_next++] = cc; \ s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ + flush = (s->sym_next == s->sym_end); \ } # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (uch)(length); \ ush dist = (ush)(distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ + s->sym_buf[s->sym_next++] = (uch)dist; \ + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \ + s->sym_buf[s->sym_next++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ + flush = (s->sym_next == s->sym_end); \ } +#endif #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzclose.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzclose.c index caeb99a3177f47..48d6a86f04b6ea 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzclose.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzclose.c @@ -8,9 +8,7 @@ /* gzclose() is in a separate file so that it is linked in only if it is used. That way the other gzclose functions can be used instead to avoid linking in unneeded compression or decompression routines. */ -int ZEXPORT gzclose(file) - gzFile file; -{ +int ZEXPORT gzclose(gzFile file) { #ifndef NO_GZCOMPRESS gz_statep state; diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzguts.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzguts.h index 990a4d25149337..eba72085bb756b 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzguts.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -7,9 +7,8 @@ # ifndef _LARGEFILE_SOURCE # define _LARGEFILE_SOURCE 1 # endif -# ifdef _FILE_OFFSET_BITS -# undef _FILE_OFFSET_BITS -# endif +# undef _FILE_OFFSET_BITS +# undef _TIME_BITS #endif #ifdef HAVE_HIDDEN @@ -39,7 +38,7 @@ # include #endif -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) # define WIDECHAR #endif @@ -119,8 +118,8 @@ /* gz* functions always use library allocation functions */ #ifndef STDC - extern voidp malloc OF((uInt size)); - extern void free OF((voidpf ptr)); + extern voidp malloc(uInt size); + extern void free(voidpf ptr); #endif /* get errno and strerror definition */ @@ -138,10 +137,10 @@ /* provide prototypes for these when building zlib without LFS */ #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int); + ZEXTERN z_off64_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile); #endif /* default memLevel */ @@ -190,6 +189,7 @@ typedef struct { /* just for writing */ int level; /* compression level */ int strategy; /* compression strategy */ + int reset; /* true if a reset is pending after a Z_FINISH */ /* seek request */ z_off64_t skip; /* amount to skip (already rewound if backwards) */ int seek; /* true if seek request pending */ @@ -202,17 +202,13 @@ typedef struct { typedef gz_state FAR *gz_statep; /* shared functions */ -void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); +void ZLIB_INTERNAL gz_error(gz_statep, int, const char *); #if defined UNDER_CE -char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); +char ZLIB_INTERNAL *gz_strwinerror(DWORD error); #endif /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else -unsigned ZLIB_INTERNAL gz_intmax OF((void)); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +unsigned ZLIB_INTERNAL gz_intmax(void); +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzlib.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzlib.c index 4105e6aff92594..983153cc8e4965 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzlib.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzlib.c @@ -1,11 +1,11 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2017 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" -#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__) +#if defined(_WIN32) && !defined(__BORLANDC__) # define LSEEK _lseeki64 #else #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 @@ -15,10 +15,6 @@ #endif #endif -/* Local functions */ -local void gz_reset OF((gz_statep)); -local gzFile gz_open OF((const void *, int, const char *)); - #if defined UNDER_CE /* Map the Windows error number in ERROR to a locale-dependent error message @@ -30,9 +26,7 @@ local gzFile gz_open OF((const void *, int, const char *)); The gz_strwinerror function does not change the current setting of GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (error) - DWORD error; -{ +char ZLIB_INTERNAL *gz_strwinerror(DWORD error) { static char buf[1024]; wchar_t *msgbuf; @@ -72,15 +66,15 @@ char ZLIB_INTERNAL *gz_strwinerror (error) #endif /* UNDER_CE */ /* Reset gzip file state */ -local void gz_reset(state) - gz_statep state; -{ +local void gz_reset(gz_statep state) { state->x.have = 0; /* no output data available */ if (state->mode == GZ_READ) { /* for reading ... */ state->eof = 0; /* not at end of file */ state->past = 0; /* have not read past end yet */ state->how = LOOK; /* look for gzip header */ } + else /* for writing ... */ + state->reset = 0; /* no deflateReset pending */ state->seek = 0; /* no seek request pending */ gz_error(state, Z_OK, NULL); /* clear error */ state->x.pos = 0; /* no uncompressed data yet */ @@ -88,11 +82,7 @@ local void gz_reset(state) } /* Open a gzip file either by name or file descriptor. */ -local gzFile gz_open(path, fd, mode) - const void *path; - int fd; - const char *mode; -{ +local gzFile gz_open(const void *path, int fd, const char *mode) { gz_statep state; z_size_t len; int oflag; @@ -267,26 +257,17 @@ local gzFile gz_open(path, fd, mode) } /* -- see zlib.h -- */ -gzFile ZEXPORT gzopen(path, mode) - const char *path; - const char *mode; -{ +gzFile ZEXPORT gzopen(const char *path, const char *mode) { return gz_open(path, -1, mode); } /* -- see zlib.h -- */ -gzFile ZEXPORT gzopen64(path, mode) - const char *path; - const char *mode; -{ +gzFile ZEXPORT gzopen64(const char *path, const char *mode) { return gz_open(path, -1, mode); } /* -- see zlib.h -- */ -gzFile ZEXPORT gzdopen(fd, mode) - int fd; - const char *mode; -{ +gzFile ZEXPORT gzdopen(int fd, const char *mode) { char *path; /* identifier for error messages */ gzFile gz; @@ -304,19 +285,13 @@ gzFile ZEXPORT gzdopen(fd, mode) /* -- see zlib.h -- */ #ifdef WIDECHAR -gzFile ZEXPORT gzopen_w(path, mode) - const wchar_t *path; - const char *mode; -{ +gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode) { return gz_open(path, -2, mode); } #endif /* -- see zlib.h -- */ -int ZEXPORT gzbuffer(file, size) - gzFile file; - unsigned size; -{ +int ZEXPORT gzbuffer(gzFile file, unsigned size) { gz_statep state; /* get internal structure and check integrity */ @@ -333,16 +308,14 @@ int ZEXPORT gzbuffer(file, size) /* check and set requested size */ if ((size << 1) < size) return -1; /* need to be able to double it */ - if (size < 2) - size = 2; /* need two bytes to check magic header */ + if (size < 8) + size = 8; /* needed to behave well with flushing */ state->want = size; return 0; } /* -- see zlib.h -- */ -int ZEXPORT gzrewind(file) - gzFile file; -{ +int ZEXPORT gzrewind(gzFile file) { gz_statep state; /* get internal structure */ @@ -363,11 +336,7 @@ int ZEXPORT gzrewind(file) } /* -- see zlib.h -- */ -z_off64_t ZEXPORT gzseek64(file, offset, whence) - gzFile file; - z_off64_t offset; - int whence; -{ +z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) { unsigned n; z_off64_t ret; gz_statep state; @@ -397,7 +366,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) /* if within raw area while reading, just go there */ if (state->mode == GZ_READ && state->how == COPY && state->x.pos + offset >= 0) { - ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); + ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR); if (ret == -1) return -1; state->x.have = 0; @@ -440,11 +409,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) } /* -- see zlib.h -- */ -z_off_t ZEXPORT gzseek(file, offset, whence) - gzFile file; - z_off_t offset; - int whence; -{ +z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) { z_off64_t ret; ret = gzseek64(file, (z_off64_t)offset, whence); @@ -452,9 +417,7 @@ z_off_t ZEXPORT gzseek(file, offset, whence) } /* -- see zlib.h -- */ -z_off64_t ZEXPORT gztell64(file) - gzFile file; -{ +z_off64_t ZEXPORT gztell64(gzFile file) { gz_statep state; /* get internal structure and check integrity */ @@ -469,9 +432,7 @@ z_off64_t ZEXPORT gztell64(file) } /* -- see zlib.h -- */ -z_off_t ZEXPORT gztell(file) - gzFile file; -{ +z_off_t ZEXPORT gztell(gzFile file) { z_off64_t ret; ret = gztell64(file); @@ -479,9 +440,7 @@ z_off_t ZEXPORT gztell(file) } /* -- see zlib.h -- */ -z_off64_t ZEXPORT gzoffset64(file) - gzFile file; -{ +z_off64_t ZEXPORT gzoffset64(gzFile file) { z_off64_t offset; gz_statep state; @@ -502,9 +461,7 @@ z_off64_t ZEXPORT gzoffset64(file) } /* -- see zlib.h -- */ -z_off_t ZEXPORT gzoffset(file) - gzFile file; -{ +z_off_t ZEXPORT gzoffset(gzFile file) { z_off64_t ret; ret = gzoffset64(file); @@ -512,9 +469,7 @@ z_off_t ZEXPORT gzoffset(file) } /* -- see zlib.h -- */ -int ZEXPORT gzeof(file) - gzFile file; -{ +int ZEXPORT gzeof(gzFile file) { gz_statep state; /* get internal structure and check integrity */ @@ -529,10 +484,7 @@ int ZEXPORT gzeof(file) } /* -- see zlib.h -- */ -const char * ZEXPORT gzerror(file, errnum) - gzFile file; - int *errnum; -{ +const char * ZEXPORT gzerror(gzFile file, int *errnum) { gz_statep state; /* get internal structure and check integrity */ @@ -550,9 +502,7 @@ const char * ZEXPORT gzerror(file, errnum) } /* -- see zlib.h -- */ -void ZEXPORT gzclearerr(file) - gzFile file; -{ +void ZEXPORT gzclearerr(gzFile file) { gz_statep state; /* get internal structure and check integrity */ @@ -576,11 +526,7 @@ void ZEXPORT gzclearerr(file) memory). Simply save the error message as a static string. If there is an allocation failure constructing the error message, then convert the error to out of memory. */ -void ZLIB_INTERNAL gz_error(state, err, msg) - gz_statep state; - int err; - const char *msg; -{ +void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) { /* free previously allocated message and clear */ if (state->msg != NULL) { if (state->err != Z_MEM_ERROR) @@ -617,21 +563,20 @@ void ZLIB_INTERNAL gz_error(state, err, msg) #endif } -#ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ -unsigned ZLIB_INTERNAL gz_intmax() -{ - unsigned p, q; - - p = 1; +unsigned ZLIB_INTERNAL gz_intmax(void) { +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzread.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzread.c index 956b91ea7d9e2a..4168cbc88752e1 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzread.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzread.c @@ -1,29 +1,16 @@ /* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler + * Copyright (C) 2004-2017 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" -/* Local functions */ -local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); -local int gz_avail OF((gz_statep)); -local int gz_look OF((gz_statep)); -local int gz_decomp OF((gz_statep)); -local int gz_fetch OF((gz_statep)); -local int gz_skip OF((gz_statep, z_off64_t)); -local z_size_t gz_read OF((gz_statep, voidp, z_size_t)); - /* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from state->fd, and update state->eof, state->err, and state->msg as appropriate. This function needs to loop on read(), since read() is not guaranteed to read the number of bytes requested, depending on the type of descriptor. */ -local int gz_load(state, buf, len, have) - gz_statep state; - unsigned char *buf; - unsigned len; - unsigned *have; -{ +local int gz_load(gz_statep state, unsigned char *buf, unsigned len, + unsigned *have) { int ret; unsigned get, max = ((unsigned)-1 >> 2) + 1; @@ -53,9 +40,7 @@ local int gz_load(state, buf, len, have) If strm->avail_in != 0, then the current data is moved to the beginning of the input buffer, and then the remainder of the buffer is loaded with the available data from the input file. */ -local int gz_avail(state) - gz_statep state; -{ +local int gz_avail(gz_statep state) { unsigned got; z_streamp strm = &(state->strm); @@ -88,9 +73,7 @@ local int gz_avail(state) case, all further file reads will be directly to either the output buffer or a user buffer. If decompressing, the inflate state will be initialized. gz_look() will return 0 on success or -1 on failure. */ -local int gz_look(state) - gz_statep state; -{ +local int gz_look(gz_statep state) { z_streamp strm = &(state->strm); /* allocate read buffers and inflate memory */ @@ -157,11 +140,9 @@ local int gz_look(state) the output buffer is larger than the input buffer, which also assures space for gzungetc() */ state->x.next = state->out; - if (strm->avail_in) { - memcpy(state->x.next, strm->next_in, strm->avail_in); - state->x.have = strm->avail_in; - strm->avail_in = 0; - } + memcpy(state->x.next, strm->next_in, strm->avail_in); + state->x.have = strm->avail_in; + strm->avail_in = 0; state->how = COPY; state->direct = 1; return 0; @@ -172,9 +153,7 @@ local int gz_look(state) data. If the gzip stream completes, state->how is reset to LOOK to look for the next gzip stream or raw data, once state->x.have is depleted. Returns 0 on success, -1 on failure. */ -local int gz_decomp(state) - gz_statep state; -{ +local int gz_decomp(gz_statep state) { int ret = Z_OK; unsigned had; z_streamp strm = &(state->strm); @@ -226,9 +205,7 @@ local int gz_decomp(state) looked for to determine whether to copy or decompress. Returns -1 on error, otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the end of the input file has been reached and all data has been processed. */ -local int gz_fetch(state) - gz_statep state; -{ +local int gz_fetch(gz_statep state) { z_streamp strm = &(state->strm); do { @@ -256,10 +233,7 @@ local int gz_fetch(state) } /* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ -local int gz_skip(state, len) - gz_statep state; - z_off64_t len; -{ +local int gz_skip(gz_statep state, z_off64_t len) { unsigned n; /* skip over len bytes or reach end-of-file, whichever comes first */ @@ -291,11 +265,7 @@ local int gz_skip(state, len) input. Return the number of bytes read. If zero is returned, either the end of file was reached, or there was an error. state->err must be consulted in that case to determine which. */ -local z_size_t gz_read(state, buf, len) - gz_statep state; - voidp buf; - z_size_t len; -{ +local z_size_t gz_read(gz_statep state, voidp buf, z_size_t len) { z_size_t got; unsigned n; @@ -314,9 +284,9 @@ local z_size_t gz_read(state, buf, len) got = 0; do { /* set n to the maximum amount of len that fits in an unsigned int */ - n = -1; + n = (unsigned)-1; if (n > len) - n = len; + n = (unsigned)len; /* first just try copying data from the output buffer */ if (state->x.have) { @@ -372,11 +342,7 @@ local z_size_t gz_read(state, buf, len) } /* -- see zlib.h -- */ -int ZEXPORT gzread(file, buf, len) - gzFile file; - voidp buf; - unsigned len; -{ +int ZEXPORT gzread(gzFile file, voidp buf, unsigned len) { gz_statep state; /* get internal structure */ @@ -397,7 +363,7 @@ int ZEXPORT gzread(file, buf, len) } /* read len or fewer bytes to buf */ - len = gz_read(state, buf, len); + len = (unsigned)gz_read(state, buf, len); /* check for an error */ if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR) @@ -408,12 +374,7 @@ int ZEXPORT gzread(file, buf, len) } /* -- see zlib.h -- */ -z_size_t ZEXPORT gzfread(buf, size, nitems, file) - voidp buf; - z_size_t size; - z_size_t nitems; - gzFile file; -{ +z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, gzFile file) { z_size_t len; gz_statep state; @@ -444,10 +405,7 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file) #else # undef gzgetc #endif -int ZEXPORT gzgetc(file) - gzFile file; -{ - int ret; +int ZEXPORT gzgetc(gzFile file) { unsigned char buf[1]; gz_statep state; @@ -469,21 +427,15 @@ int ZEXPORT gzgetc(file) } /* nothing there -- try gz_read() */ - ret = gz_read(state, buf, 1); - return ret < 1 ? -1 : buf[0]; + return gz_read(state, buf, 1) < 1 ? -1 : buf[0]; } -int ZEXPORT gzgetc_(file) -gzFile file; -{ +int ZEXPORT gzgetc_(gzFile file) { return gzgetc(file); } /* -- see zlib.h -- */ -int ZEXPORT gzungetc(c, file) - int c; - gzFile file; -{ +int ZEXPORT gzungetc(int c, gzFile file) { gz_statep state; /* get internal structure */ @@ -491,6 +443,10 @@ int ZEXPORT gzungetc(c, file) return -1; state = (gz_statep)file; + /* in case this was just opened, set up the input buffer */ + if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0) + (void)gz_look(state); + /* check that we're reading and that there's no (serious) error */ if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR)) @@ -540,11 +496,7 @@ int ZEXPORT gzungetc(c, file) } /* -- see zlib.h -- */ -char * ZEXPORT gzgets(file, buf, len) - gzFile file; - char *buf; - int len; -{ +char * ZEXPORT gzgets(gzFile file, char *buf, int len) { unsigned left, n; char *str; unsigned char *eol; @@ -604,9 +556,7 @@ char * ZEXPORT gzgets(file, buf, len) } /* -- see zlib.h -- */ -int ZEXPORT gzdirect(file) - gzFile file; -{ +int ZEXPORT gzdirect(gzFile file) { gz_statep state; /* get internal structure */ @@ -624,9 +574,7 @@ int ZEXPORT gzdirect(file) } /* -- see zlib.h -- */ -int ZEXPORT gzclose_r(file) - gzFile file; -{ +int ZEXPORT gzclose_r(gzFile file) { int ret, err; gz_statep state; diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzwrite.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzwrite.c index c7b5651d70b994..435b4621b5349f 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzwrite.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/gzwrite.c @@ -1,22 +1,14 @@ /* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004-2017 Mark Adler + * Copyright (C) 2004-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" -/* Local functions */ -local int gz_init OF((gz_statep)); -local int gz_comp OF((gz_statep, int)); -local int gz_zero OF((gz_statep, z_off64_t)); -local z_size_t gz_write OF((gz_statep, voidpc, z_size_t)); - /* Initialize state for writing a gzip file. Mark initialization by setting state->size to non-zero. Return -1 on a memory allocation failure, or 0 on success. */ -local int gz_init(state) - gz_statep state; -{ +local int gz_init(gz_statep state) { int ret; z_streamp strm = &(state->strm); @@ -70,10 +62,7 @@ local int gz_init(state) deflate() flush value. If flush is Z_FINISH, then the deflate() state is reset to start a new gzip stream. If gz->direct is true, then simply write to the output file without compressing, and ignore flush. */ -local int gz_comp(state, flush) - gz_statep state; - int flush; -{ +local int gz_comp(gz_statep state, int flush) { int ret, writ; unsigned have, put, max = ((unsigned)-1 >> 2) + 1; z_streamp strm = &(state->strm); @@ -97,6 +86,15 @@ local int gz_comp(state, flush) return 0; } + /* check for a pending reset */ + if (state->reset) { + /* don't start a new gzip member unless there is data to write */ + if (strm->avail_in == 0) + return 0; + deflateReset(strm); + state->reset = 0; + } + /* run deflate() on provided input until it produces no more output */ ret = Z_OK; do { @@ -134,7 +132,7 @@ local int gz_comp(state, flush) /* if that completed a deflate stream, allow another to start */ if (flush == Z_FINISH) - deflateReset(strm); + state->reset = 1; /* all done, no errors */ return 0; @@ -142,10 +140,7 @@ local int gz_comp(state, flush) /* Compress len zeros to output. Return -1 on a write error or memory allocation failure by gz_comp(), or 0 on success. */ -local int gz_zero(state, len) - gz_statep state; - z_off64_t len; -{ +local int gz_zero(gz_statep state, z_off64_t len) { int first; unsigned n; z_streamp strm = &(state->strm); @@ -175,11 +170,7 @@ local int gz_zero(state, len) /* Write len bytes from buf to file. Return the number of bytes written. If the returned value is less than len, then there was an error. */ -local z_size_t gz_write(state, buf, len) - gz_statep state; - voidpc buf; - z_size_t len; -{ +local z_size_t gz_write(gz_statep state, voidpc buf, z_size_t len) { z_size_t put = len; /* if len is zero, avoid unnecessary operations */ @@ -209,7 +200,7 @@ local z_size_t gz_write(state, buf, len) state->in); copy = state->size - have; if (copy > len) - copy = len; + copy = (unsigned)len; memcpy(state->in + have, buf, copy); state->strm.avail_in += copy; state->x.pos += copy; @@ -229,7 +220,7 @@ local z_size_t gz_write(state, buf, len) do { unsigned n = (unsigned)-1; if (n > len) - n = len; + n = (unsigned)len; state->strm.avail_in = n; state->x.pos += n; if (gz_comp(state, Z_NO_FLUSH) == -1) @@ -243,11 +234,7 @@ local z_size_t gz_write(state, buf, len) } /* -- see zlib.h -- */ -int ZEXPORT gzwrite(file, buf, len) - gzFile file; - voidpc buf; - unsigned len; -{ +int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len) { gz_statep state; /* get internal structure */ @@ -271,12 +258,8 @@ int ZEXPORT gzwrite(file, buf, len) } /* -- see zlib.h -- */ -z_size_t ZEXPORT gzfwrite(buf, size, nitems, file) - voidpc buf; - z_size_t size; - z_size_t nitems; - gzFile file; -{ +z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems, + gzFile file) { z_size_t len; gz_statep state; @@ -301,10 +284,7 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file) } /* -- see zlib.h -- */ -int ZEXPORT gzputc(file, c) - gzFile file; - int c; -{ +int ZEXPORT gzputc(gzFile file, int c) { unsigned have; unsigned char buf[1]; gz_statep state; @@ -349,12 +329,8 @@ int ZEXPORT gzputc(file, c) } /* -- see zlib.h -- */ -int ZEXPORT gzputs(file, str) - gzFile file; - const char *str; -{ - int ret; - z_size_t len; +int ZEXPORT gzputs(gzFile file, const char *s) { + z_size_t len, put; gz_statep state; /* get internal structure */ @@ -367,17 +343,20 @@ int ZEXPORT gzputs(file, str) return -1; /* write string */ - len = strlen(str); - ret = gz_write(state, str, len); - return ret == 0 && len != 0 ? -1 : ret; + len = strlen(s); + if ((int)len < 0 || (unsigned)len != len) { + gz_error(state, Z_STREAM_ERROR, "string length does not fit in int"); + return -1; + } + put = gz_write(state, s, len); + return put < len ? -1 : (int)len; } #if defined(STDC) || defined(Z_HAVE_STDARG_H) #include /* -- see zlib.h -- */ -int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) -{ +int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) { int len; unsigned left; char *next; @@ -441,15 +420,14 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) strm->avail_in = state->size; if (gz_comp(state, Z_NO_FLUSH) == -1) return state->err; - memcpy(state->in, state->in + state->size, left); + memmove(state->in, state->in + state->size, left); strm->next_in = state->in; strm->avail_in = left; } return len; } -int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) -{ +int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) { va_list va; int ret; @@ -462,13 +440,10 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) #else /* !STDC && !Z_HAVE_STDARG_H */ /* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) - gzFile file; - const char *format; - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; -{ +int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3, + int a4, int a5, int a6, int a7, int a8, int a9, int a10, + int a11, int a12, int a13, int a14, int a15, int a16, + int a17, int a18, int a19, int a20) { unsigned len, left; char *next; gz_statep state; @@ -540,7 +515,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, strm->avail_in = state->size; if (gz_comp(state, Z_NO_FLUSH) == -1) return state->err; - memcpy(state->in, state->in + state->size, left); + memmove(state->in, state->in + state->size, left); strm->next_in = state->in; strm->avail_in = left; } @@ -550,10 +525,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, #endif /* -- see zlib.h -- */ -int ZEXPORT gzflush(file, flush) - gzFile file; - int flush; -{ +int ZEXPORT gzflush(gzFile file, int flush) { gz_statep state; /* get internal structure */ @@ -582,11 +554,7 @@ int ZEXPORT gzflush(file, flush) } /* -- see zlib.h -- */ -int ZEXPORT gzsetparams(file, level, strategy) - gzFile file; - int level; - int strategy; -{ +int ZEXPORT gzsetparams(gzFile file, int level, int strategy) { gz_statep state; z_streamp strm; @@ -597,7 +565,7 @@ int ZEXPORT gzsetparams(file, level, strategy) strm = &(state->strm); /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) + if (state->mode != GZ_WRITE || state->err != Z_OK || state->direct) return Z_STREAM_ERROR; /* if no change is requested, then do nothing */ @@ -624,9 +592,7 @@ int ZEXPORT gzsetparams(file, level, strategy) } /* -- see zlib.h -- */ -int ZEXPORT gzclose_w(file) - gzFile file; -{ +int ZEXPORT gzclose_w(gzFile file) { int ret = Z_OK; gz_statep state; diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/infback.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/infback.c index 59679ecbfc5d77..e7b25b307a3072 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/infback.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/infback.c @@ -1,5 +1,5 @@ /* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -15,9 +15,6 @@ #include "inflate.h" #include "inffast.h" -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); - /* strm provides memory allocation functions in zalloc and zfree, or Z_NULL to use the library memory allocation functions. @@ -25,13 +22,9 @@ local void fixedtables OF((struct inflate_state FAR *state)); windowBits is in the range 8..15, and window is a user-supplied window and output buffer that is 2**windowBits bytes. */ -int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) -z_streamp strm; -int windowBits; -unsigned char FAR *window; -const char *version; -int stream_size; -{ +int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits, + unsigned char FAR *window, const char *version, + int stream_size) { struct inflate_state FAR *state; if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || @@ -66,6 +59,7 @@ int stream_size; state->window = window; state->wnext = 0; state->whave = 0; + state->sane = 1; return Z_OK; } @@ -79,9 +73,7 @@ int stream_size; used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ +local void fixedtables(struct inflate_state FAR *state) { #ifdef BUILDFIXED static int virgin = 1; static code *lenfix, *distfix; @@ -247,13 +239,8 @@ struct inflate_state FAR *state; inflateBack() can also return Z_STREAM_ERROR if the input parameters are not correct, i.e. strm is Z_NULL or the state was not initialized. */ -int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) -z_streamp strm; -in_func in; -void FAR *in_desc; -out_func out; -void FAR *out_desc; -{ +int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc) { struct inflate_state FAR *state; z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ @@ -477,6 +464,7 @@ void FAR *out_desc; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; + /* fallthrough */ case LEN: /* use inflate_fast() if we have enough input and output */ @@ -604,33 +592,33 @@ void FAR *out_desc; break; case DONE: - /* inflate stream terminated properly -- write leftover output */ + /* inflate stream terminated properly */ ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; - default: /* can't happen, but makes compilers happy */ + default: + /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } - /* Return unused input */ + /* Write leftover output and return unused input */ inf_leave: + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left) && + ret == Z_STREAM_END) + ret = Z_BUF_ERROR; + } strm->next_in = next; strm->avail_in = have; return ret; } -int ZEXPORT inflateBackEnd(strm) -z_streamp strm; -{ +int ZEXPORT inflateBackEnd(z_streamp strm) { if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) return Z_STREAM_ERROR; ZFREE(strm, strm->state); diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inffast.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inffast.c index 0dbd1dbc09f2f6..9354676e786ee7 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inffast.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inffast.c @@ -47,10 +47,7 @@ requires strm->avail_out >= 258 for each loop to avoid checking for output space. */ -void ZLIB_INTERNAL inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ +void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) { struct inflate_state FAR *state; z_const unsigned char FAR *in; /* local strm->next_in */ z_const unsigned char FAR *last; /* have enough input while in < last */ @@ -70,7 +67,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ code const FAR *dcode; /* local strm->distcode */ unsigned lmask; /* mask for first level of length codes */ unsigned dmask; /* mask for first level of distance codes */ - code here; /* retrieved table entry */ + code const *here; /* retrieved table entry */ unsigned op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ unsigned len; /* match length, unused bytes */ @@ -107,20 +104,20 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ hold += (unsigned long)(*in++) << bits; bits += 8; } - here = lcode[hold & lmask]; + here = lcode + (hold & lmask); dolen: - op = (unsigned)(here.bits); + op = (unsigned)(here->bits); hold >>= op; bits -= op; - op = (unsigned)(here.op); + op = (unsigned)(here->op); if (op == 0) { /* literal */ - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ? "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - *out++ = (unsigned char)(here.val); + "inflate: literal 0x%02x\n", here->val)); + *out++ = (unsigned char)(here->val); } else if (op & 16) { /* length base */ - len = (unsigned)(here.val); + len = (unsigned)(here->val); op &= 15; /* number of extra bits */ if (op) { if (bits < op) { @@ -138,14 +135,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ hold += (unsigned long)(*in++) << bits; bits += 8; } - here = dcode[hold & dmask]; + here = dcode + (hold & dmask); dodist: - op = (unsigned)(here.bits); + op = (unsigned)(here->bits); hold >>= op; bits -= op; - op = (unsigned)(here.op); + op = (unsigned)(here->op); if (op & 16) { /* distance base */ - dist = (unsigned)(here.val); + dist = (unsigned)(here->val); op &= 15; /* number of extra bits */ if (bits < op) { hold += (unsigned long)(*in++) << bits; @@ -264,7 +261,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ } } else if ((op & 64) == 0) { /* 2nd level distance code */ - here = dcode[here.val + (hold & ((1U << op) - 1))]; + here = dcode + here->val + (hold & ((1U << op) - 1)); goto dodist; } else { @@ -274,7 +271,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ } } else if ((op & 64) == 0) { /* 2nd level length code */ - here = lcode[here.val + (hold & ((1U << op) - 1))]; + here = lcode + here->val + (hold & ((1U << op) - 1)); goto dolen; } else if (op & 32) { /* end-of-block */ diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inffast.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inffast.h index e5c1aa4ca8cd52..49c6d156c5c652 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inffast.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inffast.h @@ -8,4 +8,4 @@ subject to change. Applications should only use zlib.h. */ -void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); +void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start); diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inflate.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inflate.c index ac333e8c2edae9..94ecff015a9be7 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inflate.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inflate.c @@ -1,5 +1,5 @@ /* inflate.c -- zlib decompression - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -91,20 +91,7 @@ # endif #endif -/* function prototypes */ -local int inflateStateCheck OF((z_streamp strm)); -local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, - unsigned copy)); -#ifdef BUILDFIXED - void makefixed OF((void)); -#endif -local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, - unsigned len)); - -local int inflateStateCheck(strm) -z_streamp strm; -{ +local int inflateStateCheck(z_streamp strm) { struct inflate_state FAR *state; if (strm == Z_NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) @@ -116,9 +103,7 @@ z_streamp strm; return 0; } -int ZEXPORT inflateResetKeep(strm) -z_streamp strm; -{ +int ZEXPORT inflateResetKeep(z_streamp strm) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -130,6 +115,7 @@ z_streamp strm; state->mode = HEAD; state->last = 0; state->havedict = 0; + state->flags = -1; state->dmax = 32768U; state->head = Z_NULL; state->hold = 0; @@ -141,9 +127,7 @@ z_streamp strm; return Z_OK; } -int ZEXPORT inflateReset(strm) -z_streamp strm; -{ +int ZEXPORT inflateReset(z_streamp strm) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -154,10 +138,7 @@ z_streamp strm; return inflateResetKeep(strm); } -int ZEXPORT inflateReset2(strm, windowBits) -z_streamp strm; -int windowBits; -{ +int ZEXPORT inflateReset2(z_streamp strm, int windowBits) { int wrap; struct inflate_state FAR *state; @@ -167,6 +148,8 @@ int windowBits; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { + if (windowBits < -15) + return Z_STREAM_ERROR; wrap = 0; windowBits = -windowBits; } @@ -192,12 +175,8 @@ int windowBits; return inflateReset(strm); } -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) -z_streamp strm; -int windowBits; -const char *version; -int stream_size; -{ +int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, + const char *version, int stream_size) { int ret; struct inflate_state FAR *state; @@ -236,22 +215,17 @@ int stream_size; return ret; } -int ZEXPORT inflateInit_(strm, version, stream_size) -z_streamp strm; -const char *version; -int stream_size; -{ +int ZEXPORT inflateInit_(z_streamp strm, const char *version, + int stream_size) { return inflateInit2_(strm, DEF_WBITS, version, stream_size); } -int ZEXPORT inflatePrime(strm, bits, value) -z_streamp strm; -int bits; -int value; -{ +int ZEXPORT inflatePrime(z_streamp strm, int bits, int value) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; + if (bits == 0) + return Z_OK; state = (struct inflate_state FAR *)strm->state; if (bits < 0) { state->hold = 0; @@ -275,9 +249,7 @@ int value; used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ +local void fixedtables(struct inflate_state FAR *state) { #ifdef BUILDFIXED static int virgin = 1; static code *lenfix, *distfix; @@ -339,7 +311,7 @@ struct inflate_state FAR *state; a.out > inffixed.h */ -void makefixed() +void makefixed(void) { unsigned low, size; struct inflate_state state; @@ -393,11 +365,7 @@ void makefixed() output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ -local int updatewindow(strm, end, copy) -z_streamp strm; -const Bytef *end; -unsigned copy; -{ +local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) { struct inflate_state FAR *state; unsigned dist; @@ -447,10 +415,10 @@ unsigned copy; /* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP -# define UPDATE(check, buf, len) \ +# define UPDATE_CHECK(check, buf, len) \ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) #else -# define UPDATE(check, buf, len) adler32(check, buf, len) +# define UPDATE_CHECK(check, buf, len) adler32(check, buf, len) #endif /* check macros for header crc */ @@ -619,10 +587,7 @@ unsigned copy; will return Z_BUF_ERROR if it has not reached the end of the stream. */ -int ZEXPORT inflate(strm, flush) -z_streamp strm; -int flush; -{ +int ZEXPORT inflate(z_streamp strm, int flush) { struct inflate_state FAR *state; z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ @@ -670,7 +635,6 @@ int flush; state->mode = FLAGS; break; } - state->flags = 0; /* expect zlib header */ if (state->head != Z_NULL) state->head->done = -1; if (!(state->wrap & 1) || /* check if zlib header allowed */ @@ -697,6 +661,7 @@ int flush; break; } state->dmax = 1U << len; + state->flags = 0; /* indicate zlib header */ Tracev((stderr, "inflate: zlib header ok\n")); strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = hold & 0x200 ? DICTID : TYPE; @@ -722,6 +687,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = TIME; + /* fallthrough */ case TIME: NEEDBITS(32); if (state->head != Z_NULL) @@ -730,6 +696,7 @@ int flush; CRC4(state->check, hold); INITBITS(); state->mode = OS; + /* fallthrough */ case OS: NEEDBITS(16); if (state->head != Z_NULL) { @@ -740,6 +707,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; + /* fallthrough */ case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); @@ -753,14 +721,16 @@ int flush; else if (state->head != Z_NULL) state->head->extra = Z_NULL; state->mode = EXTRA; + /* fallthrough */ case EXTRA: if (state->flags & 0x0400) { copy = state->length; if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); @@ -775,6 +745,7 @@ int flush; } state->length = 0; state->mode = NAME; + /* fallthrough */ case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; @@ -796,6 +767,7 @@ int flush; state->head->name = Z_NULL; state->length = 0; state->mode = COMMENT; + /* fallthrough */ case COMMENT: if (state->flags & 0x1000) { if (have == 0) goto inf_leave; @@ -816,6 +788,7 @@ int flush; else if (state->head != Z_NULL) state->head->comment = Z_NULL; state->mode = HCRC; + /* fallthrough */ case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); @@ -839,6 +812,7 @@ int flush; strm->adler = state->check = ZSWAP32(hold); INITBITS(); state->mode = DICT; + /* fallthrough */ case DICT: if (state->havedict == 0) { RESTORE(); @@ -846,8 +820,10 @@ int flush; } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; + /* fallthrough */ case TYPE: if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + /* fallthrough */ case TYPEDO: if (state->last) { BYTEBITS(); @@ -898,8 +874,10 @@ int flush; INITBITS(); state->mode = COPY_; if (flush == Z_TREES) goto inf_leave; + /* fallthrough */ case COPY_: state->mode = COPY; + /* fallthrough */ case COPY: copy = state->length; if (copy) { @@ -935,6 +913,7 @@ int flush; Tracev((stderr, "inflate: table sizes ok\n")); state->have = 0; state->mode = LENLENS; + /* fallthrough */ case LENLENS: while (state->have < state->ncode) { NEEDBITS(3); @@ -956,6 +935,7 @@ int flush; Tracev((stderr, "inflate: code lengths ok\n")); state->have = 0; state->mode = CODELENS; + /* fallthrough */ case CODELENS: while (state->have < state->nlen + state->ndist) { for (;;) { @@ -1039,8 +1019,10 @@ int flush; Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN_; if (flush == Z_TREES) goto inf_leave; + /* fallthrough */ case LEN_: state->mode = LEN; + /* fallthrough */ case LEN: if (have >= 6 && left >= 258) { RESTORE(); @@ -1090,6 +1072,7 @@ int flush; } state->extra = (unsigned)(here.op) & 15; state->mode = LENEXT; + /* fallthrough */ case LENEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1100,6 +1083,7 @@ int flush; Tracevv((stderr, "inflate: length %u\n", state->length)); state->was = state->length; state->mode = DIST; + /* fallthrough */ case DIST: for (;;) { here = state->distcode[BITS(state->distbits)]; @@ -1127,6 +1111,7 @@ int flush; state->offset = (unsigned)here.val; state->extra = (unsigned)(here.op) & 15; state->mode = DISTEXT; + /* fallthrough */ case DISTEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1143,6 +1128,7 @@ int flush; #endif Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; + /* fallthrough */ case MATCH: if (left == 0) goto inf_leave; copy = out - left; @@ -1202,7 +1188,7 @@ int flush; state->total += out; if ((state->wrap & 4) && out) strm->adler = state->check = - UPDATE(state->check, put - out, out); + UPDATE_CHECK(state->check, put - out, out); out = left; if ((state->wrap & 4) && ( #ifdef GUNZIP @@ -1218,10 +1204,11 @@ int flush; } #ifdef GUNZIP state->mode = LENGTH; + /* fallthrough */ case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { + if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) { strm->msg = (char *)"incorrect length check"; state->mode = BAD; break; @@ -1231,6 +1218,7 @@ int flush; } #endif state->mode = DONE; + /* fallthrough */ case DONE: ret = Z_STREAM_END; goto inf_leave; @@ -1240,6 +1228,7 @@ int flush; case MEM: return Z_MEM_ERROR; case SYNC: + /* fallthrough */ default: return Z_STREAM_ERROR; } @@ -1265,7 +1254,7 @@ int flush; state->total += out; if ((state->wrap & 4) && out) strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); + UPDATE_CHECK(state->check, strm->next_out - out, out); strm->data_type = (int)state->bits + (state->last ? 64 : 0) + (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); @@ -1274,9 +1263,7 @@ int flush; return ret; } -int ZEXPORT inflateEnd(strm) -z_streamp strm; -{ +int ZEXPORT inflateEnd(z_streamp strm) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -1288,11 +1275,8 @@ z_streamp strm; return Z_OK; } -int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) -z_streamp strm; -Bytef *dictionary; -uInt *dictLength; -{ +int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary, + uInt *dictLength) { struct inflate_state FAR *state; /* check state */ @@ -1311,11 +1295,8 @@ uInt *dictLength; return Z_OK; } -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) -z_streamp strm; -const Bytef *dictionary; -uInt dictLength; -{ +int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary, + uInt dictLength) { struct inflate_state FAR *state; unsigned long dictid; int ret; @@ -1346,10 +1327,7 @@ uInt dictLength; return Z_OK; } -int ZEXPORT inflateGetHeader(strm, head) -z_streamp strm; -gz_headerp head; -{ +int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head) { struct inflate_state FAR *state; /* check state */ @@ -1374,11 +1352,8 @@ gz_headerp head; called again with more data and the *have state. *have is initialized to zero for the first call. */ -local unsigned syncsearch(have, buf, len) -unsigned FAR *have; -const unsigned char FAR *buf; -unsigned len; -{ +local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf, + unsigned len) { unsigned got; unsigned next; @@ -1397,10 +1372,9 @@ unsigned len; return next; } -int ZEXPORT inflateSync(strm) -z_streamp strm; -{ +int ZEXPORT inflateSync(z_streamp strm) { unsigned len; /* number of bytes to look at or looked at */ + int flags; /* temporary to save header status */ unsigned long in, out; /* temporary to save total_in and total_out */ unsigned char buf[4]; /* to restore bit buffer to byte string */ struct inflate_state FAR *state; @@ -1413,7 +1387,7 @@ z_streamp strm; /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { @@ -1433,9 +1407,15 @@ z_streamp strm; /* return no joy or set up to restart inflate() on a new block */ if (state->have != 4) return Z_DATA_ERROR; + if (state->flags == -1) + state->wrap = 0; /* if no header yet, treat as raw */ + else + state->wrap &= ~4; /* no point in computing a check value now */ + flags = state->flags; in = strm->total_in; out = strm->total_out; inflateReset(strm); strm->total_in = in; strm->total_out = out; + state->flags = flags; state->mode = TYPE; return Z_OK; } @@ -1448,9 +1428,7 @@ z_streamp strm; block. When decompressing, PPP checks that at the end of input packet, inflate is waiting for these length bytes. */ -int ZEXPORT inflateSyncPoint(strm) -z_streamp strm; -{ +int ZEXPORT inflateSyncPoint(z_streamp strm) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -1458,10 +1436,7 @@ z_streamp strm; return state->mode == STORED && state->bits == 0; } -int ZEXPORT inflateCopy(dest, source) -z_streamp dest; -z_streamp source; -{ +int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) { struct inflate_state FAR *state; struct inflate_state FAR *copy; unsigned char FAR *window; @@ -1505,10 +1480,7 @@ z_streamp source; return Z_OK; } -int ZEXPORT inflateUndermine(strm, subvert) -z_streamp strm; -int subvert; -{ +int ZEXPORT inflateUndermine(z_streamp strm, int subvert) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; @@ -1523,24 +1495,19 @@ int subvert; #endif } -int ZEXPORT inflateValidate(strm, check) -z_streamp strm; -int check; -{ +int ZEXPORT inflateValidate(z_streamp strm, int check) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; - if (check) + if (check && state->wrap) state->wrap |= 4; else state->wrap &= ~4; return Z_OK; } -long ZEXPORT inflateMark(strm) -z_streamp strm; -{ +long ZEXPORT inflateMark(z_streamp strm) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) @@ -1551,9 +1518,7 @@ z_streamp strm; (state->mode == MATCH ? state->was - state->length : 0)); } -unsigned long ZEXPORT inflateCodesUsed(strm) -z_streamp strm; -{ +unsigned long ZEXPORT inflateCodesUsed(z_streamp strm) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) return (unsigned long)-1; state = (struct inflate_state FAR *)strm->state; diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inflate.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inflate.h index a46cce6b6d05ef..f127b6b1fa5f7d 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inflate.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inflate.h @@ -1,5 +1,5 @@ /* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -86,7 +86,8 @@ struct inflate_state { int wrap; /* bit 0 true for zlib, bit 1 true for gzip, bit 2 true to validate check value */ int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ + int flags; /* gzip header method and flags, 0 if zlib, or + -1 if raw or no header yet */ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ unsigned long check; /* protected copy of check value */ unsigned long total; /* protected copy of output count */ diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inftrees.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inftrees.c index 4237e985bee131..98cfe164458c40 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inftrees.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2017 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.11 Copyright 1995-2017 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -29,14 +29,9 @@ const char inflate_copyright[] = table index bits. It will differ if the request is greater than the longest code or if it is less than the shortest code. */ -int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) -codetype type; -unsigned short FAR *lens; -unsigned codes; -code FAR * FAR *table; -unsigned FAR *bits; -unsigned short FAR *work; -{ +int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work) { unsigned len; /* a code's length in bits */ unsigned sym; /* index of code symbols */ unsigned min, max; /* minimum and maximum code lengths */ @@ -62,7 +57,7 @@ unsigned short FAR *work; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, @@ -87,7 +82,7 @@ unsigned short FAR *work; This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that the + 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inftrees.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inftrees.h index baa53a0b1a199c..396f74b5da798a 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inftrees.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/inftrees.h @@ -38,11 +38,11 @@ typedef struct { /* Maximum size of the dynamic table. The maximum number of code structures is 1444, which is the sum of 852 for literal/length codes and 592 for distance codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that + examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ @@ -57,6 +57,6 @@ typedef enum { DISTS } codetype; -int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); +int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work); diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/make_vms.com b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/make_vms.com index 65e9d0cbc8e1dd..4dc8a891355980 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/make_vms.com +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/make_vms.com @@ -14,9 +14,9 @@ $! 0.02 20061008 Adapt to new Makefile.in $! 0.03 20091224 Add support for large file check $! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite $! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in -$! 0.06 20120111 Fix missing amiss_err, update zconf_h.in, fix new exmples +$! 0.06 20120111 Fix missing amiss_err, update zconf_h.in, fix new examples $! subdir path, update module search in makefile.in -$! 0.07 20120115 Triggered by work done by Alexey Chupahin completly redesigned +$! 0.07 20120115 Triggered by work done by Alexey Chupahin completely redesigned $! shared image creation $! 0.08 20120219 Make it work on VAX again, pre-load missing symbols to shared $! image diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/treebuild.xml b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/treebuild.xml index fd75525f99595d..930b00be4a853a 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/treebuild.xml +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/treebuild.xml @@ -1,6 +1,6 @@ - - + + zip compression library diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/trees.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/trees.c index 50cf4b4571cfec..979ae4100a02e0 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/trees.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2017 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -122,39 +122,116 @@ struct static_tree_desc_s { int max_length; /* max bit length for the codes */ }; -local const static_tree_desc static_l_desc = +#ifdef NO_INIT_GLOBAL_POINTERS +# define TCONST +#else +# define TCONST const +#endif + +local TCONST static_tree_desc static_l_desc = {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; -local const static_tree_desc static_d_desc = +local TCONST static_tree_desc static_d_desc = {static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; -local const static_tree_desc static_bl_desc = +local TCONST static_tree_desc static_bl_desc = {(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; /* =========================================================================== - * Local (static) routines in this file. + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 */ +local unsigned bi_reverse(unsigned code, int len) { + register unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} -local void tr_static_init OF((void)); -local void init_block OF((deflate_state *s)); -local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); -local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); -local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); -local void build_tree OF((deflate_state *s, tree_desc *desc)); -local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local int build_bl_tree OF((deflate_state *s)); -local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, - int blcodes)); -local void compress_block OF((deflate_state *s, const ct_data *ltree, - const ct_data *dtree)); -local int detect_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); -local void bi_windup OF((deflate_state *s)); -local void bi_flush OF((deflate_state *s)); +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(deflate_state *s) { + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(deflate_state *s) { + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef ZLIB_DEBUG + s->bits_sent = (s->bits_sent + 7) & ~7; +#endif +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes(ct_data *tree, int max_code, ushf *bl_count) { + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + unsigned code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + code = (code + bl_count[bits - 1]) << 1; + next_code[bits] = (ush)code; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1, + "inconsistent bit counts"); + Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); + + for (n = 0; n <= max_code; n++) { + int len = tree[n].Len; + if (len == 0) continue; + /* Now reverse the bits */ + tree[n].Code = (ush)bi_reverse(next_code[len]++, len); + + Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", + n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1)); + } +} #ifdef GEN_TREES_H -local void gen_trees_header OF((void)); +local void gen_trees_header(void); #endif #ifndef ZLIB_DEBUG @@ -167,33 +244,18 @@ local void gen_trees_header OF((void)); send_bits(s, tree[c].Code, tree[c].Len); } #endif -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -#define put_short(s, w) { \ - put_byte(s, (uch)((w) & 0xff)); \ - put_byte(s, (uch)((ush)(w) >> 8)); \ -} - /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ #ifdef ZLIB_DEBUG -local void send_bits OF((deflate_state *s, int value, int length)); - -local void send_bits(s, value, length) - deflate_state *s; - int value; /* value to send */ - int length; /* number of bits */ -{ +local void send_bits(deflate_state *s, int value, int length) { Tracevv((stderr," l %2d v %4x ", length, value)); Assert(length > 0 && length <= 15, "invalid length"); s->bits_sent += (ulg)length; /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * (16 - bi_valid) bits from value, leaving (width - (16 - bi_valid)) * unused bits in value. */ if (s->bi_valid > (int)Buf_size - length) { @@ -229,8 +291,7 @@ local void send_bits(s, value, length) /* =========================================================================== * Initialize the various 'constant' tables. */ -local void tr_static_init() -{ +local void tr_static_init(void) { #if defined(GEN_TREES_H) || !defined(STDC) static int static_init_done = 0; int n; /* iterates over tree elements */ @@ -256,7 +317,7 @@ local void tr_static_init() length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { _dist_code[256 + dist++] = (uch)code; } } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); + Assert (dist == 256, "tr_static_init: 256 + dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; @@ -312,7 +373,7 @@ local void tr_static_init() } /* =========================================================================== - * Genererate the file trees.h describing the static trees. + * Generate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H # ifndef ZLIB_DEBUG @@ -321,10 +382,9 @@ local void tr_static_init() # define SEPARATOR(i, last, width) \ ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) + ((i) % (width) == (width) - 1 ? ",\n" : ", ")) -void gen_trees_header() -{ +void gen_trees_header(void) { FILE *header = fopen("trees.h", "w"); int i; @@ -373,12 +433,26 @@ void gen_trees_header() } #endif /* GEN_TREES_H */ +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(deflate_state *s) { + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->sym_next = s->matches = 0; +} + /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ -void ZLIB_INTERNAL _tr_init(s) - deflate_state *s; -{ +void ZLIB_INTERNAL _tr_init(deflate_state *s) { tr_static_init(); s->l_desc.dyn_tree = s->dyn_ltree; @@ -401,24 +475,6 @@ void ZLIB_INTERNAL _tr_init(s) init_block(s); } -/* =========================================================================== - * Initialize a new block. - */ -local void init_block(s) - deflate_state *s; -{ - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; -} - #define SMALLEST 1 /* Index within the heap array of least frequent node in the Huffman tree */ @@ -448,17 +504,13 @@ local void init_block(s) * when the heap property is re-established (each father smaller than its * two sons). */ -local void pqdownheap(s, tree, k) - deflate_state *s; - ct_data *tree; /* the tree to restore */ - int k; /* node to move down */ -{ +local void pqdownheap(deflate_state *s, ct_data *tree, int k) { int v = s->heap[k]; int j = k << 1; /* left son of k */ while (j <= s->heap_len) { /* Set j to the smallest of the two sons: */ if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) { j++; } /* Exit if v is smaller than both sons */ @@ -483,10 +535,7 @@ local void pqdownheap(s, tree, k) * The length opt_len is updated; static_len is also updated if stree is * not null. */ -local void gen_bitlen(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ +local void gen_bitlen(deflate_state *s, tree_desc *desc) { ct_data *tree = desc->dyn_tree; int max_code = desc->max_code; const ct_data *stree = desc->stat_desc->static_tree; @@ -507,7 +556,7 @@ local void gen_bitlen(s, desc) */ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + for (h = s->heap_max + 1; h < HEAP_SIZE; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len + 1; if (bits > max_length) bits = max_length, overflow++; @@ -518,7 +567,7 @@ local void gen_bitlen(s, desc) s->bl_count[bits]++; xbits = 0; - if (n >= base) xbits = extra[n-base]; + if (n >= base) xbits = extra[n - base]; f = tree[n].Freq; s->opt_len += (ulg)f * (unsigned)(bits + xbits); if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits); @@ -530,10 +579,10 @@ local void gen_bitlen(s, desc) /* Find the first bit length which could increase: */ do { - bits = max_length-1; + bits = max_length - 1; while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */ s->bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] @@ -561,48 +610,9 @@ local void gen_bitlen(s, desc) } } -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -local void gen_codes (tree, max_code, bl_count) - ct_data *tree; /* the tree to decorate */ - int max_code; /* largest code with non zero frequency */ - ushf *bl_count; /* number of codes at each bit length */ -{ - ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - unsigned code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - code = (code + bl_count[bits-1]) << 1; - next_code[bits] = (ush)code; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - Assert (code + bl_count[MAX_BITS]-1 == (1< +#endif /* =========================================================================== * Construct one Huffman tree and assigns the code bit strings and lengths. @@ -612,10 +622,7 @@ local void gen_codes (tree, max_code, bl_count) * and corresponding code. The length opt_len is updated; static_len is * also updated if stree is not null. The field max_code is set. */ -local void build_tree(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ +local void build_tree(deflate_state *s, tree_desc *desc) { ct_data *tree = desc->dyn_tree; const ct_data *stree = desc->stat_desc->static_tree; int elems = desc->stat_desc->elems; @@ -624,7 +631,7 @@ local void build_tree(s, desc) int node; /* new node being created */ /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n + 1]. * heap[0] is not used. */ s->heap_len = 0, s->heap_max = HEAP_SIZE; @@ -652,7 +659,7 @@ local void build_tree(s, desc) } desc->max_code = max_code; - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); @@ -700,11 +707,7 @@ local void build_tree(s, desc) * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ -local void scan_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ +local void scan_tree(deflate_state *s, ct_data *tree, int max_code) { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ @@ -714,14 +717,14 @@ local void scan_tree (s, tree, max_code) int min_count = 4; /* min repeat count */ if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ + tree[max_code + 1].Len = (ush)0xffff; /* guard */ for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; + curlen = nextlen; nextlen = tree[n + 1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { - s->bl_tree[curlen].Freq += count; + s->bl_tree[curlen].Freq += (ush)count; } else if (curlen != 0) { if (curlen != prevlen) s->bl_tree[curlen].Freq++; s->bl_tree[REP_3_6].Freq++; @@ -745,11 +748,7 @@ local void scan_tree (s, tree, max_code) * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ -local void send_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ +local void send_tree(deflate_state *s, ct_data *tree, int max_code) { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ @@ -758,11 +757,11 @@ local void send_tree (s, tree, max_code) int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ - /* tree[max_code+1].Len = -1; */ /* guard already set */ + /* tree[max_code + 1].Len = -1; */ /* guard already set */ if (nextlen == 0) max_count = 138, min_count = 3; for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; + curlen = nextlen; nextlen = tree[n + 1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { @@ -773,13 +772,13 @@ local void send_tree (s, tree, max_code) send_code(s, curlen, s->bl_tree); count--; } Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2); } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3); } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7); } count = 0; prevlen = curlen; if (nextlen == 0) { @@ -796,9 +795,7 @@ local void send_tree (s, tree, max_code) * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ -local int build_bl_tree(s) - deflate_state *s; -{ +local int build_bl_tree(deflate_state *s) { int max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ @@ -807,8 +804,8 @@ local int build_bl_tree(s) /* Build the bit length tree: */ build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + /* opt_len now includes the length of the tree representations, except the + * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format @@ -819,7 +816,7 @@ local int build_bl_tree(s) if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4; + s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", s->opt_len, s->static_len)); @@ -831,61 +828,54 @@ local int build_bl_tree(s) * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ -local void send_all_trees(s, lcodes, dcodes, blcodes) - deflate_state *s; - int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ +local void send_all_trees(deflate_state *s, int lcodes, int dcodes, + int blcodes) { int rank; /* index in bl_order */ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); } Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } /* =========================================================================== * Send a stored block */ -void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ +void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, + ulg stored_len, int last) { + send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */ bi_windup(s); /* align on byte boundary */ put_short(s, (ush)stored_len); put_short(s, (ush)~stored_len); - zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); + if (stored_len) + zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); s->pending += stored_len; #ifdef ZLIB_DEBUG s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; s->bits_sent += 2*16; - s->bits_sent += stored_len<<3; + s->bits_sent += stored_len << 3; #endif } /* =========================================================================== * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) */ -void ZLIB_INTERNAL _tr_flush_bits(s) - deflate_state *s; -{ +void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) { bi_flush(s); } @@ -893,9 +883,7 @@ void ZLIB_INTERNAL _tr_flush_bits(s) * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. */ -void ZLIB_INTERNAL _tr_align(s) - deflate_state *s; -{ +void ZLIB_INTERNAL _tr_align(deflate_state *s) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); #ifdef ZLIB_DEBUG @@ -904,16 +892,108 @@ void ZLIB_INTERNAL _tr_align(s) bi_flush(s); } +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(deflate_state *s, const ct_data *ltree, + const ct_data *dtree) { + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned sx = 0; /* running index in symbol buffers */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else + dist = s->sym_buf[sx++] & 0xff; + dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; + lc = s->sym_buf[sx++]; +#endif + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code + LITERALS + 1, ltree); /* send length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= (unsigned)base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else + Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif + + } while (sx < s->sym_next); + + send_code(s, END_BLOCK, ltree); +} + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "block list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +local int detect_data_type(deflate_state *s) { + /* block_mask is the bit mask of block-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + unsigned long block_mask = 0xf3ffc07fUL; + int n; + + /* Check for non-textual ("block-listed") bytes. */ + for (n = 0; n <= 31; n++, block_mask >>= 1) + if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + return Z_BINARY; + + /* Check for textual ("allow-listed") bytes. */ + if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 + || s->dyn_ltree[13].Freq != 0) + return Z_TEXT; + for (n = 32; n < LITERALS; n++) + if (s->dyn_ltree[n].Freq != 0) + return Z_TEXT; + + /* There are no "block-listed" or "allow-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static * trees or store, and write out the encoded block. */ -void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block, or NULL if too old */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ -{ +void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, + ulg stored_len, int last) { ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ int max_blindex = 0; /* index of last bit length code of non zero freq */ @@ -942,14 +1022,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; + opt_lenb = (s->opt_len + 3 + 7) >> 3; + static_lenb = (s->static_len + 3 + 7) >> 3; Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); + s->sym_next / 3)); - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; +#ifndef FORCE_STATIC + if (static_lenb <= opt_lenb || s->strategy == Z_FIXED) +#endif + opt_lenb = static_lenb; } else { Assert(buf != (char*)0, "lost buf"); @@ -959,7 +1042,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) #ifdef FORCE_STORED if (buf != (char*)0) { /* force stored block */ #else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { + if (stored_len + 4 <= opt_lenb && buf != (char*)0) { /* 4: two words for the lengths */ #endif /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. @@ -970,21 +1053,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) */ _tr_stored_block(s, buf, stored_len, last); -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+last, 3); + } else if (static_lenb == opt_lenb) { + send_bits(s, (STATIC_TREES<<1) + last, 3); compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree); #ifdef ZLIB_DEBUG s->compressed_len += 3 + s->static_len; #endif } else { - send_bits(s, (DYN_TREES<<1)+last, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); + send_bits(s, (DYN_TREES<<1) + last, 3); + send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1, + max_blindex + 1); compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree); #ifdef ZLIB_DEBUG @@ -1003,21 +1082,23 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) s->compressed_len += 7; /* align on byte boundary */ #endif } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*last)); + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3, + s->compressed_len - 7*last)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ -int ZLIB_INTERNAL _tr_tally (s, dist, lc) - deflate_state *s; - unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; +int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else + s->sym_buf[s->sym_next++] = (uch)dist; + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); + s->sym_buf[s->sym_next++] = (uch)lc; +#endif if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; @@ -1029,175 +1110,8 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_ltree[_length_code[lc] + LITERALS + 1].Freq++; s->dyn_dtree[d_code(dist)].Freq++; } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -local void compress_block(s, ltree, dtree) - deflate_state *s; - const ct_data *ltree; /* literal tree */ - const ct_data *dtree; /* distance tree */ -{ - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ - unsigned code; /* the code to send */ - int extra; /* number of extra bits to send */ - - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; - if (dist == 0) { - send_code(s, lc, ltree); /* send a literal byte */ - Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra != 0) { - dist -= (unsigned)base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); - - } while (lx < s->last_lit); - - send_code(s, END_BLOCK, ltree); -} - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -local int detect_data_type(s) - deflate_state *s; -{ - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - unsigned long black_mask = 0xf3ffc07fUL; - int n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>= 1) - if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) - return Z_BINARY; - - /* Check for textual ("white-listed") bytes. */ - if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 - || s->dyn_ltree[13].Freq != 0) - return Z_TEXT; - for (n = 32; n < LITERALS; n++) - if (s->dyn_ltree[n].Freq != 0) - return Z_TEXT; - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -local unsigned bi_reverse(code, len) - unsigned code; /* the value to invert */ - int len; /* its bit length */ -{ - register unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -local void bi_flush(s) - deflate_state *s; -{ - if (s->bi_valid == 16) { - put_short(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else if (s->bi_valid >= 8) { - put_byte(s, (Byte)s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -local void bi_windup(s) - deflate_state *s; -{ - if (s->bi_valid > 8) { - put_short(s, s->bi_buf); - } else if (s->bi_valid > 0) { - put_byte(s, (Byte)s->bi_buf); - } - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef ZLIB_DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; -#endif + return (s->sym_next == s->sym_end); } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/uncompr.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/uncompr.c index f03a1a865e347d..5e256663b4511c 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/uncompr.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/uncompr.c @@ -24,12 +24,8 @@ Z_DATA_ERROR if the input data was corrupted, including if the input data is an incomplete zlib stream. */ -int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong *sourceLen; -{ +int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source, + uLong *sourceLen) { z_stream stream; int err; const uInt max = (uInt)-1; @@ -83,11 +79,7 @@ int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) err; } -int ZEXPORT uncompress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ +int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, + uLong sourceLen) { return uncompress2(dest, destLen, source, &sourceLen); } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h index 5e1d68a004e974..62adc8d8431f2f 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -38,6 +38,9 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound @@ -238,7 +241,11 @@ #endif #ifdef Z_SOLO - typedef unsigned long z_size_t; +# ifdef _WIN64 + typedef unsigned long long z_size_t; +# else + typedef unsigned long z_size_t; +# endif #else # define z_longlong long long # if defined(NO_SIZE_T) @@ -293,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have @@ -349,6 +348,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -467,11 +469,18 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ @@ -507,7 +516,7 @@ typedef uLong FAR uLongf; #if !defined(_WIN32) && defined(Z_LARGE64) # define z_off64_t off64_t #else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# if defined(_WIN32) && !defined(__GNUC__) # define z_off64_t __int64 # else # define z_off64_t z_off_t diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h.cmakein b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h.cmakein index a7f24cce60ff7a..0abe3bc9d8fa4e 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h.cmakein +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h.cmakein @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -40,6 +40,9 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound @@ -240,7 +243,11 @@ #endif #ifdef Z_SOLO - typedef unsigned long z_size_t; +# ifdef _WIN64 + typedef unsigned long long z_size_t; +# else + typedef unsigned long z_size_t; +# endif #else # define z_longlong long long # if defined(NO_SIZE_T) @@ -295,14 +302,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have @@ -351,6 +350,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -469,11 +471,18 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ @@ -509,7 +518,7 @@ typedef uLong FAR uLongf; #if !defined(_WIN32) && defined(Z_LARGE64) # define z_off64_t off64_t #else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# if defined(_WIN32) && !defined(__GNUC__) # define z_off64_t __int64 # else # define z_off64_t z_off_t diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h.in b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h.in index 5e1d68a004e974..62adc8d8431f2f 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h.in +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zconf.h.in @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -38,6 +38,9 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound @@ -238,7 +241,11 @@ #endif #ifdef Z_SOLO - typedef unsigned long z_size_t; +# ifdef _WIN64 + typedef unsigned long long z_size_t; +# else + typedef unsigned long z_size_t; +# endif #else # define z_longlong long long # if defined(NO_SIZE_T) @@ -293,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have @@ -349,6 +348,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -467,11 +469,18 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ @@ -507,7 +516,7 @@ typedef uLong FAR uLongf; #if !defined(_WIN32) && defined(Z_LARGE64) # define z_off64_t off64_t #else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# if defined(_WIN32) && !defined(__GNUC__) # define z_off64_t __int64 # else # define z_off64_t z_off_t diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.3 b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.3 index bda4eb0737090c..c716020ea9c420 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.3 +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.3 @@ -1,4 +1,4 @@ -.TH ZLIB 3 "15 Jan 2017" +.TH ZLIB 3 "22 Jan 2024" .SH NAME zlib \- compression/decompression library .SH SYNOPSIS @@ -105,9 +105,9 @@ before asking for help. Send questions and/or comments to zlib@gzip.org, or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). .SH AUTHORS AND LICENSE -Version 1.2.11 +Version 1.3.1 .LP -Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler +Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler .LP This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.3.pdf b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.3.pdf deleted file mode 100644 index 6fa519c5bdf5df..00000000000000 Binary files a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.3.pdf and /dev/null differ diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.h index f09cdaf1e0543d..8d4b932eaf6a0f 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11, January 15th, 2017 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.11" -#define ZLIB_VERNUM 0x12b0 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 -#define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 11 +#define ZLIB_VER_MINOR 3 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -78,8 +78,8 @@ extern "C" { even in the case of corrupted input. */ -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); +typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size); +typedef void (*free_func)(voidpf opaque, voidpf address); struct internal_state; @@ -217,7 +217,7 @@ typedef gz_header FAR *gz_headerp; /* basic functions */ -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +ZEXTERN const char * ZEXPORT zlibVersion(void); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. This check @@ -225,12 +225,12 @@ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); */ /* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); +ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level); Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default - allocation functions. + allocation functions. total_in, total_out, adler, and msg are initialized. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all @@ -247,7 +247,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); */ -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce @@ -276,7 +276,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more ouput + which can be used if desired to determine whether or not there is more output in that case. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to @@ -320,8 +320,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. + avail_out is greater than six when the flush marker begins, in order to avoid + repeated flush markers upon calling deflate() again when avail_out == 0. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was @@ -360,7 +360,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); */ -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +ZEXTERN int ZEXPORT deflateEnd(z_streamp strm); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending @@ -375,7 +375,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateInit(z_streamp strm); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by @@ -383,7 +383,8 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); read or consumed. The allocation of a sliding window will be deferred to the first call of inflate (if the decompression does not complete on the first call). If zalloc and zfree are set to Z_NULL, inflateInit updates - them to use default allocation functions. + them to use default allocation functions. total_in, total_out, adler, and + msg are initialized. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the @@ -397,7 +398,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); */ -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush); /* inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce @@ -517,7 +518,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); */ -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateEnd(z_streamp strm); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending @@ -535,16 +536,15 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); */ /* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); +ZEXTERN int ZEXPORT deflateInit2(z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy); This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by the - caller. + fields zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. @@ -608,9 +608,9 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, compression: this will be done by deflate(). */ -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); +ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. When using the zlib format, this @@ -652,16 +652,16 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, not perform any compression: this will be done by deflate(). */ -ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, - Bytef *dictionary, - uInt *dictLength)); +ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); /* Returns the sliding dictionary being maintained by deflate. dictLength is set to the number of bytes in the dictionary, and that many bytes are copied to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If deflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. deflateGetDictionary() may return a length less than the window size, even when more than the window size in input has been provided. It may return up @@ -674,8 +674,8 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, stream state is inconsistent. */ -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); +ZEXTERN int ZEXPORT deflateCopy(z_streamp dest, + z_streamp source); /* Sets the destination stream as a complete copy of the source stream. @@ -692,31 +692,32 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, destination. */ -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +ZEXTERN int ZEXPORT deflateReset(z_streamp strm); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate the internal compression state. The stream will leave the compression level and any other attributes that may have been - set unchanged. + set unchanged. total_in, total_out, adler, and msg are initialized. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); +ZEXTERN int ZEXPORT deflateParams(z_streamp strm, + int level, + int strategy); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2(). This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does not have enough output space to complete, then the parameter change will not @@ -729,7 +730,7 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, Then no more input data should be provided before the deflateParams() call. If this is done, the old level and strategy will be applied to the data compressed before deflateParams(), and the new level and strategy will be - applied to the the data compressed after deflateParams(). + applied to the data compressed after deflateParams(). deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if @@ -740,11 +741,11 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, retried with more output space. */ -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); +ZEXTERN int ZEXPORT deflateTune(z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain); /* Fine tune deflate's internal compression parameters. This should only be used by someone who understands the algorithm used by zlib's deflate for @@ -757,8 +758,8 @@ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. */ -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); +ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, + uLong sourceLen); /* deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or @@ -772,9 +773,9 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, than Z_FINISH or Z_NO_FLUSH are used. */ -ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, - unsigned *pending, - int *bits)); +ZEXTERN int ZEXPORT deflatePending(z_streamp strm, + unsigned *pending, + int *bits); /* deflatePending() returns the number of bytes and bits of output that have been generated, but not yet provided in the available output. The bytes not @@ -787,9 +788,9 @@ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, stream state was inconsistent. */ -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); +ZEXTERN int ZEXPORT deflatePrime(z_streamp strm, + int bits, + int value); /* deflatePrime() inserts bits in the deflate output stream. The intent is that this function is used to start off the deflate output with the bits @@ -804,8 +805,8 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, source stream state was inconsistent. */ -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); +ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm, + gz_headerp head); /* deflateSetHeader() provides gzip header information for when a gzip stream is requested by deflateInit2(). deflateSetHeader() may be called @@ -821,16 +822,17 @@ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gzip file" and give up. If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). + the time set to zero, and os set to the current operating system, with no + extra, name, or comment fields. The gzip header is returned to the default + state by deflateReset(). deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); +ZEXTERN int ZEXPORT inflateInit2(z_streamp strm, + int windowBits); This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized @@ -865,9 +867,11 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see - below), inflate() will not automatically decode concatenated gzip streams. - inflate() will return Z_STREAM_END at the end of the gzip stream. The state - would need to be reset to continue decoding a subsequent gzip stream. + below), inflate() will *not* automatically decode concatenated gzip members. + inflate() will return Z_STREAM_END at the end of the gzip member. The state + would need to be reset to continue decoding a subsequent gzip member. This + *must* be done if there is more data after a gzip member, in order for the + decompression to be compliant with the gzip standard (RFC 1952). inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the @@ -881,9 +885,9 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, deferred until inflate() is called. */ -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); +ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate, @@ -904,22 +908,22 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, inflate(). */ -ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, - Bytef *dictionary, - uInt *dictLength)); +ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); /* Returns the sliding dictionary being maintained by inflate. dictLength is set to the number of bytes in the dictionary, and that many bytes are copied to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If inflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. */ -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateSync(z_streamp strm); /* Skips invalid compressed data until a possible full flush point (see above for the description of deflate with Z_FULL_FLUSH) can be found, or until all @@ -932,14 +936,14 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); +ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, + z_streamp source); /* Sets the destination stream as a complete copy of the source stream. @@ -954,18 +958,19 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, destination. */ -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateReset(z_streamp strm); /* This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. + total_in, total_out, adler, and msg are initialized. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ -ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, - int windowBits)); +ZEXTERN int ZEXPORT inflateReset2(z_streamp strm, + int windowBits); /* This function is the same as inflateReset, but it also permits changing the wrap and window size requests. The windowBits parameter is interpreted @@ -978,9 +983,9 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, the windowBits parameter is invalid. */ -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); +ZEXTERN int ZEXPORT inflatePrime(z_streamp strm, + int bits, + int value); /* This function inserts bits in the inflate input stream. The intent is that this function is used to start inflating at a bit position in the @@ -999,7 +1004,7 @@ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, stream state was inconsistent. */ -ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +ZEXTERN long ZEXPORT inflateMark(z_streamp strm); /* This function returns two values, one in the lower 16 bits of the return value, and the other in the remaining upper bits, obtained by shifting the @@ -1027,8 +1032,8 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); source stream state was inconsistent. */ -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); +ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm, + gz_headerp head); /* inflateGetHeader() requests that gzip header information be stored in the provided gz_header structure. inflateGetHeader() may be called after @@ -1068,8 +1073,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, */ /* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); +ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits, + unsigned char FAR *window); Initialize the internal stream state for decompression using inflateBack() calls. The fields zalloc, zfree and opaque in strm must be initialized @@ -1089,13 +1094,13 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, the version of the header file. */ -typedef unsigned (*in_func) OF((void FAR *, - z_const unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); +typedef unsigned (*in_func)(void FAR *, + z_const unsigned char FAR * FAR *); +typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned); -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); +ZEXTERN int ZEXPORT inflateBack(z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc); /* inflateBack() does a raw inflate with a single call using a call-back interface for input and output. This is potentially more efficient than @@ -1163,7 +1168,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, cannot return Z_OK. */ -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm); /* All memory allocated by inflateBackInit() is freed. @@ -1171,7 +1176,7 @@ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); state was inconsistent. */ -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +ZEXTERN uLong ZEXPORT zlibCompileFlags(void); /* Return flags indicating compile-time options. Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: @@ -1224,8 +1229,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); you need special options. */ -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); +ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size @@ -1239,9 +1244,9 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, buffer. */ -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); +ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte @@ -1255,15 +1260,15 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, Z_STREAM_ERROR if the level parameter is invalid. */ -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen); /* compressBound() returns an upper bound on the compressed size after compress() or compress2() on sourceLen bytes. It would be used before a compress() or compress2() call to allocate the destination buffer. */ -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); +ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); /* Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size @@ -1280,8 +1285,8 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, buffer with the uncompressed data up to that point. */ -ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong *sourceLen)); +ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong *sourceLen); /* Same as uncompress, except that sourceLen is a pointer, where the length of the source is *sourceLen. On return, *sourceLen is the number of @@ -1300,16 +1305,16 @@ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ /* -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode); - Opens a gzip (.gz) file for reading or writing. The mode parameter is as - in fopen ("rb" or "wb") but can also include a compression level ("wb9") or - a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only - compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' - for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) 'T' will - request transparent writing or appending with no compression and not using - the gzip format. + Open the gzip (.gz) file at path for reading and decompressing, or + compressing and writing. The mode parameter is as in fopen ("rb" or "wb") + but can also include a compression level ("wb9") or a strategy: 'f' for + filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", + 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression + as in "wb9F". (See the description of deflateInit2 for more information + about the strategy parameter.) 'T' will request transparent writing or + appending with no compression and not using the gzip format. "a" can be used instead of "w" to request that the gzip stream that will be written be appended to the file. "+" will result in an error, since @@ -1337,11 +1342,11 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); file could not be opened. */ -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode); /* - gzdopen associates a gzFile with the file descriptor fd. File descriptors - are obtained from calls like open, dup, creat, pipe or fileno (if the file - has been previously opened with fopen). The mode parameter is as in gzopen. + Associate a gzFile with the file descriptor fd. File descriptors are + obtained from calls like open, dup, creat, pipe or fileno (if the file has + been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor @@ -1360,15 +1365,15 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); will not detect if fd is invalid (unless fd is -1). */ -ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size); /* - Set the internal buffer size used by this library's functions. The - default buffer size is 8192 bytes. This function must be called after - gzopen() or gzdopen(), and before any other calls that read or write the - file. The buffer memory allocation is always deferred to the first read or - write. Three times that size in buffer space is allocated. A larger buffer - size of, for example, 64K or 128K bytes will noticeably increase the speed - of decompression (reading). + Set the internal buffer size used by this library's functions for file to + size. The default buffer size is 8192 bytes. This function must be called + after gzopen() or gzdopen(), and before any other calls that read or write + the file. The buffer memory allocation is always deferred to the first read + or write. Three times that size in buffer space is allocated. A larger + buffer size of, for example, 64K or 128K bytes will noticeably increase the + speed of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). @@ -1376,20 +1381,20 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); too late. */ -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy); /* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. Previously provided - data is flushed before the parameter change. + Dynamically update the compression level and strategy for file. See the + description of deflateInit2 for the meaning of these parameters. Previously + provided data is flushed before applying the parameter changes. gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not opened for writing, Z_ERRNO if there is an error writing the flushed data, or Z_MEM_ERROR if there is a memory allocation error. */ -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len); /* - Reads the given number of uncompressed bytes from the compressed file. If + Read and decompress up to len uncompressed bytes from file into buf. If the input file is not in gzip format, gzread copies the given number of bytes into the buffer directly from the file. @@ -1417,14 +1422,14 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); Z_STREAM_ERROR. */ -ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, - gzFile file)); +ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, + gzFile file); /* - Read up to nitems items of size size from file to buf, otherwise operating - as gzread() does. This duplicates the interface of stdio's fread(), with - size_t request and return types. If the library defines size_t, then - z_size_t is identical to size_t. If not, then z_size_t is an unsigned - integer type that can contain a pointer. + Read and decompress up to nitems items of size size from file into buf, + otherwise operating as gzread() does. This duplicates the interface of + stdio's fread(), with size_t request and return types. If the library + defines size_t, then z_size_t is identical to size_t. If not, then z_size_t + is an unsigned integer type that can contain a pointer. gzfread() returns the number of full items read of size size, or zero if the end of the file was reached and a full item could not be read, or if @@ -1435,26 +1440,24 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, In the event that the end of file is reached and only a partial item is available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevetheless read into buf + multiple of size, then the final partial item is nevertheless read into buf and the end-of-file flag is set. The length of the partial item read is not provided, but could be inferred from the result of gztell(). This behavior is the same as the behavior of fread() implementations in common libraries, but it prevents the direct use of gzfread() to read a concurrently written - file, reseting and retrying on end-of-file, when size is not 1. + file, resetting and retrying on end-of-file, when size is not 1. */ -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); +ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len); /* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes written or 0 in case of - error. + Compress and write the len uncompressed bytes at buf to file. gzwrite + returns the number of uncompressed bytes written or 0 in case of error. */ -ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, - z_size_t nitems, gzFile file)); +ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, + z_size_t nitems, gzFile file); /* - gzfwrite() writes nitems items of size size from buf to file, duplicating + Compress and write nitems items of size size from buf to file, duplicating the interface of stdio's fwrite(), with size_t request and return types. If the library defines size_t, then z_size_t is identical to size_t. If not, then z_size_t is an unsigned integer type that can contain a pointer. @@ -1465,61 +1468,62 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, is returned, and the error state is set to Z_STREAM_ERROR. */ -ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); +ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...); /* - Converts, formats, and writes the arguments to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of + Convert, format, compress, and write the arguments (...) to file under + control of the string format, as in fprintf. gzprintf returns the number of uncompressed bytes actually written, or a negative zlib error code in case of error. The number of uncompressed bytes written is limited to 8191, or one less than the buffer size given to gzbuffer(). The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() + zlib was compiled with the insecure functions sprintf() or vsprintf(), because the secure snprintf() or vsnprintf() functions were not available. This can be determined using zlibCompileFlags(). */ -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s); /* - Writes the given null-terminated string to the compressed file, excluding + Compress and write the given null-terminated string s to file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len); /* - Reads bytes from the compressed file until len-1 characters are read, or a - newline character is read and transferred to buf, or an end-of-file - condition is encountered. If any characters are read or if len == 1, the - string is terminated with a null character. If no characters are read due - to an end-of-file or len < 1, then the buffer is left untouched. + Read and decompress bytes from file into buf, until len-1 characters are + read, or until a newline character is read and transferred to buf, or an + end-of-file condition is encountered. If any characters are read or if len + is one, the string is terminated with a null character. If no characters + are read due to an end-of-file or len is less than one, then the buffer is + left untouched. gzgets returns buf which is a null-terminated string, or it returns NULL for end-of-file or in case of error. If there was an error, the contents at buf are indeterminate. */ -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +ZEXTERN int ZEXPORT gzputc(gzFile file, int c); /* - Writes c, converted to an unsigned char, into the compressed file. gzputc + Compress and write c, converted to an unsigned char, into file. gzputc returns the value that was written, or -1 in case of error. */ -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +ZEXTERN int ZEXPORT gzgetc(gzFile file); /* - Reads one byte from the compressed file. gzgetc returns this byte or -1 + Read and decompress one byte from file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. it does not check to see if file is NULL, nor whether the structure file points to has been clobbered or not. */ -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +ZEXTERN int ZEXPORT gzungetc(int c, gzFile file); /* - Push one character back onto the stream to be read as the first character - on the next read. At least one character of push-back is allowed. + Push c back onto the stream for file to be read as the first character on + the next read. At least one character of push-back is always allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if c is -1, and may fail if a character has been pushed but not read yet. If gzungetc is used immediately after gzopen or gzdopen, at least the @@ -1528,11 +1532,11 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); gzseek() or gzrewind(). */ -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +ZEXTERN int ZEXPORT gzflush(gzFile file, int flush); /* - Flushes all pending output into the compressed file. The parameter flush - is as in the deflate() function. The return value is the zlib error number - (see function gzerror below). gzflush is only permitted when writing. + Flush all pending output to file. The parameter flush is as in the + deflate() function. The return value is the zlib error number (see function + gzerror below). gzflush is only permitted when writing. If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new @@ -1544,11 +1548,11 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); */ /* -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); +ZEXTERN z_off_t ZEXPORT gzseek(gzFile file, + z_off_t offset, int whence); - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the + Set the starting position to offset relative to whence for the next gzread + or gzwrite on file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. @@ -1563,52 +1567,52 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, would be before the current position. */ -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +ZEXTERN int ZEXPORT gzrewind(gzFile file); /* - Rewinds the given file. This function is supported only for reading. + Rewind file. This function is supported only for reading. - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET). */ /* -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +ZEXTERN z_off_t ZEXPORT gztell(gzFile file); - Returns the starting position for the next gzread or gzwrite on the given - compressed file. This position represents a number of bytes in the - uncompressed data stream, and is zero when starting, even if appending or - reading a gzip stream from the middle of a file using gzdopen(). + Return the starting position for the next gzread or gzwrite on file. + This position represents a number of bytes in the uncompressed data stream, + and is zero when starting, even if appending or reading a gzip stream from + the middle of a file using gzdopen(). gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ /* -ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); +ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file); - Returns the current offset in the file being read or written. This offset - includes the count of bytes that precede the gzip stream, for example when - appending or when using gzdopen() for reading. When reading, the offset - does not include as yet unused buffered input. This information can be used - for a progress indicator. On error, gzoffset() returns -1. + Return the current compressed (actual) read or write offset of file. This + offset includes the count of bytes that precede the gzip stream, for example + when appending or when using gzdopen() for reading. When reading, the + offset does not include as yet unused buffered input. This information can + be used for a progress indicator. On error, gzoffset() returns -1. */ -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +ZEXTERN int ZEXPORT gzeof(gzFile file); /* - Returns true (1) if the end-of-file indicator has been set while reading, - false (0) otherwise. Note that the end-of-file indicator is set only if the - read tried to go past the end of the input, but came up short. Therefore, - just like feof(), gzeof() may return false even if there is no more data to - read, in the event that the last read request was for the exact number of - bytes remaining in the input file. This will happen if the input file size - is an exact multiple of the buffer size. + Return true (1) if the end-of-file indicator for file has been set while + reading, false (0) otherwise. Note that the end-of-file indicator is set + only if the read tried to go past the end of the input, but came up short. + Therefore, just like feof(), gzeof() may return false even if there is no + more data to read, in the event that the last read request was for the exact + number of bytes remaining in the input file. This will happen if the input + file size is an exact multiple of the buffer size. If gzeof() returns true, then the read functions will return no more data, unless the end-of-file indicator is reset by gzclearerr() and the input file has grown since the previous end of file was detected. */ -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +ZEXTERN int ZEXPORT gzdirect(gzFile file); /* - Returns true (1) if file is being copied directly while reading, or false + Return true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed. If the input file is empty, gzdirect() will return true, since the input @@ -1627,10 +1631,10 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); gzip file reading and decompression, which may not be desired.) */ -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose(gzFile file); /* - Flushes all pending output if necessary, closes the compressed file and - deallocates the (de)compression state. Note that once file is closed, you + Flush all pending output for file, if necessary, close file and + deallocate the (de)compression state. Note that once file is closed, you cannot call gzerror with file, since its structures have been deallocated. gzclose must not be called more than once on the same file, just as free must not be called more than once on the same allocation. @@ -1640,8 +1644,8 @@ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); last read ended in the middle of a gzip stream, or Z_OK on success. */ -ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); -ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_r(gzFile file); +ZEXTERN int ZEXPORT gzclose_w(gzFile file); /* Same as gzclose(), but gzclose_r() is only for use when reading, and gzclose_w() is only for use when writing or appending. The advantage to @@ -1652,12 +1656,12 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); zlib library. */ -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum); /* - Returns the error message for the last error which occurred on the given - compressed file. errnum is set to zlib error number. If an error occurred - in the file system and not in the compression library, errnum is set to - Z_ERRNO and the application may consult errno to get the exact error code. + Return the error message for the last error which occurred on file. + errnum is set to zlib error number. If an error occurred in the file system + and not in the compression library, errnum is set to Z_ERRNO and the + application may consult errno to get the exact error code. The application must not modify the returned string. Future calls to this function may invalidate the previously returned string. If file is @@ -1668,9 +1672,9 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); functions above that do not distinguish those cases in their return values. */ -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +ZEXTERN void ZEXPORT gzclearerr(gzFile file); /* - Clears the error and end-of-file flags for file. This is analogous to the + Clear the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ @@ -1685,11 +1689,12 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); library. */ -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. + return the updated checksum. An Adler-32 value is in the range of a 32-bit + unsigned integer. If buf is Z_NULL, this function returns the required + initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed much faster. @@ -1704,15 +1709,15 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); if (adler != original_adler) error(); */ -ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, - z_size_t len)); +ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, + z_size_t len); /* Same as adler32(), but with a size_t length. */ /* -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); +ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, + z_off_t len2); Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for @@ -1722,12 +1727,13 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, negative, the result has no meaning or utility. */ -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. + updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. + If buf is Z_NULL, this function returns the required initial value for the + crc. Pre- and post-conditioning (one's complement) is performed within this + function so it shouldn't be done by the application. Usage example: @@ -1739,20 +1745,34 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); if (crc != original_crc) error(); */ -ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, - z_size_t len)); +ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf, + z_size_t len); /* Same as crc32(), but with a size_t length. */ /* -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); +ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); Combine two CRC-32 check values into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); + + Return the operator corresponding to length len2, to be used with + crc32_combine_op(). len2 must be non-negative. +*/ + +ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); +/* + Give the same result as crc32_combine(), using op in place of len2. op is + is generated from len2 by crc32_combine_gen(). This will be faster than + crc32_combine() if the generated op is used more than once. */ @@ -1761,20 +1781,20 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); +ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateInit_(z_streamp strm, + const char *version, int stream_size); +ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size); +ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size); #ifdef Z_PREFIX_SET # define z_deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) @@ -1819,7 +1839,7 @@ struct gzFile_s { unsigned char *next; z_off64_t pos; }; -ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */ #ifdef Z_PREFIX_SET # undef z_gzgetc # define z_gzgetc(g) \ @@ -1836,12 +1856,13 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ * without large file support, _LFS64_LARGEFILE must also be true */ #ifdef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int); + ZEXTERN z_off64_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) @@ -1852,6 +1873,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define z_gzoffset z_gzoffset64 # define z_adler32_combine z_adler32_combine64 # define z_crc32_combine z_crc32_combine64 +# define z_crc32_combine_gen z_crc32_combine_gen64 # else # define gzopen gzopen64 # define gzseek gzseek64 @@ -1859,49 +1881,53 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 +# define crc32_combine_gen crc32_combine_gen64 # endif # ifndef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t); # endif #else - ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); #endif #else /* Z_SOLO */ - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); #endif /* !Z_SOLO */ /* undocumented functions */ -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); -ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); -ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); -ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); -ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); -ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); -ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); -#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) -ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, - const char *mode)); +ZEXTERN const char * ZEXPORT zError(int); +ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void); +ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int); +ZEXTERN int ZEXPORT inflateValidate(z_streamp, int); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp); +ZEXTERN int ZEXPORT inflateResetKeep(z_streamp); +ZEXTERN int ZEXPORT deflateResetKeep(z_streamp); +#if defined(_WIN32) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, + const char *mode); #endif #if defined(STDC) || defined(Z_HAVE_STDARG_H) # ifndef Z_SOLO -ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, - const char *format, - va_list va)); +ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, + const char *format, + va_list va); # endif #endif diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.map b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.map index 82ce98cf7decc9..31544f2e93da1a 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.map +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib.map @@ -92,3 +92,9 @@ ZLIB_1.2.9 { adler32_z; crc32_z; } ZLIB_1.2.7.1; + +ZLIB_1.2.12 { + crc32_combine_gen; + crc32_combine_gen64; + crc32_combine_op; +} ZLIB_1.2.9; diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib2ansi b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib2ansi deleted file mode 100644 index 15e3e165f37dec..00000000000000 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zlib2ansi +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/perl - -# Transform K&R C function definitions into ANSI equivalent. -# -# Author: Paul Marquess -# Version: 1.0 -# Date: 3 October 2006 - -# TODO -# -# Asumes no function pointer parameters. unless they are typedefed. -# Assumes no literal strings that look like function definitions -# Assumes functions start at the beginning of a line - -use strict; -use warnings; - -local $/; -$_ = <>; - -my $sp = qr{ \s* (?: /\* .*? \*/ )? \s* }x; # assume no nested comments - -my $d1 = qr{ $sp (?: [\w\*\s]+ $sp)* $sp \w+ $sp [\[\]\s]* $sp }x ; -my $decl = qr{ $sp (?: \w+ $sp )+ $d1 }xo ; -my $dList = qr{ $sp $decl (?: $sp , $d1 )* $sp ; $sp }xo ; - - -while (s/^ - ( # Start $1 - ( # Start $2 - .*? # Minimal eat content - ( ^ \w [\w\s\*]+ ) # $3 -- function name - \s* # optional whitespace - ) # $2 - Matched up to before parameter list - - \( \s* # Literal "(" + optional whitespace - ( [^\)]+ ) # $4 - one or more anythings except ")" - \s* \) # optional whitespace surrounding a Literal ")" - - ( (?: $dList )+ ) # $5 - - $sp ^ { # literal "{" at start of line - ) # Remember to $1 - //xsom - ) -{ - my $all = $1 ; - my $prefix = $2; - my $param_list = $4 ; - my $params = $5; - - StripComments($params); - StripComments($param_list); - $param_list =~ s/^\s+//; - $param_list =~ s/\s+$//; - - my $i = 0 ; - my %pList = map { $_ => $i++ } - split /\s*,\s*/, $param_list; - my $pMatch = '(\b' . join('|', keys %pList) . '\b)\W*$' ; - - my @params = split /\s*;\s*/, $params; - my @outParams = (); - foreach my $p (@params) - { - if ($p =~ /,/) - { - my @bits = split /\s*,\s*/, $p; - my $first = shift @bits; - $first =~ s/^\s*//; - push @outParams, $first; - $first =~ /^(\w+\s*)/; - my $type = $1 ; - push @outParams, map { $type . $_ } @bits; - } - else - { - $p =~ s/^\s+//; - push @outParams, $p; - } - } - - - my %tmp = map { /$pMatch/; $_ => $pList{$1} } - @outParams ; - - @outParams = map { " $_" } - sort { $tmp{$a} <=> $tmp{$b} } - @outParams ; - - print $prefix ; - print "(\n" . join(",\n", @outParams) . ")\n"; - print "{" ; - -} - -# Output any trailing code. -print ; -exit 0; - - -sub StripComments -{ - - no warnings; - - # Strip C & C++ coments - # From the perlfaq - $_[0] =~ - - s{ - /\* ## Start of /* ... */ comment - [^*]*\*+ ## Non-* followed by 1-or-more *'s - ( - [^/*][^*]*\*+ - )* ## 0-or-more things which don't start with / - ## but do end with '*' - / ## End of /* ... */ comment - - | ## OR C++ Comment - // ## Start of C++ comment // - [^\n]* ## followed by 0-or-more non end of line characters - - | ## OR various things which aren't comments: - - ( - " ## Start of " ... " string - ( - \\. ## Escaped char - | ## OR - [^"\\] ## Non "\ - )* - " ## End of " ... " string - - | ## OR - - ' ## Start of ' ... ' string - ( - \\. ## Escaped char - | ## OR - [^'\\] ## Non '\ - )* - ' ## End of ' ... ' string - - | ## OR - - . ## Anything other char - [^/"'\\]* ## Chars which doesn't start a comment, string or escape - ) - }{$2}gxs; - -} diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zutil.c b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zutil.c index a76c6b0c7e557f..b1c5d2d3c6daf5 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zutil.c +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zutil.c @@ -24,13 +24,11 @@ z_const char * const z_errmsg[10] = { }; -const char * ZEXPORT zlibVersion() -{ +const char * ZEXPORT zlibVersion(void) { return ZLIB_VERSION; } -uLong ZEXPORT zlibCompileFlags() -{ +uLong ZEXPORT zlibCompileFlags(void) { uLong flags; flags = 0; @@ -61,9 +59,11 @@ uLong ZEXPORT zlibCompileFlags() #ifdef ZLIB_DEBUG flags += 1 << 8; #endif + /* #if defined(ASMV) || defined(ASMINF) flags += 1 << 9; #endif + */ #ifdef ZLIB_WINAPI flags += 1 << 10; #endif @@ -119,9 +119,7 @@ uLong ZEXPORT zlibCompileFlags() # endif int ZLIB_INTERNAL z_verbose = verbose; -void ZLIB_INTERNAL z_error (m) - char *m; -{ +void ZLIB_INTERNAL z_error(char *m) { fprintf(stderr, "%s\n", m); exit(1); } @@ -130,14 +128,12 @@ void ZLIB_INTERNAL z_error (m) /* exported to allow conversion of error code to string for compress() and * uncompress() */ -const char * ZEXPORT zError(err) - int err; -{ +const char * ZEXPORT zError(int err) { return ERR_MSG(err); } -#if defined(_WIN32_WCE) - /* The Microsoft C Run-Time Library for Windows CE doesn't have +#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 + /* The older Microsoft C Run-Time Library for Windows CE doesn't have * errno. We define it as a global variable to simplify porting. * Its value is always 0 and should not be used. */ @@ -146,22 +142,14 @@ const char * ZEXPORT zError(err) #ifndef HAVE_MEMCPY -void ZLIB_INTERNAL zmemcpy(dest, source, len) - Bytef* dest; - const Bytef* source; - uInt len; -{ +void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) { if (len == 0) return; do { *dest++ = *source++; /* ??? to be unrolled */ } while (--len != 0); } -int ZLIB_INTERNAL zmemcmp(s1, s2, len) - const Bytef* s1; - const Bytef* s2; - uInt len; -{ +int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) { uInt j; for (j = 0; j < len; j++) { @@ -170,10 +158,7 @@ int ZLIB_INTERNAL zmemcmp(s1, s2, len) return 0; } -void ZLIB_INTERNAL zmemzero(dest, len) - Bytef* dest; - uInt len; -{ +void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) { if (len == 0) return; do { *dest++ = 0; /* ??? to be unrolled */ @@ -214,8 +199,7 @@ local ptr_table table[MAX_PTR]; * a protected system like OS/2. Use Microsoft C instead. */ -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) -{ +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { voidpf buf; ulg bsize = (ulg)items*size; @@ -240,8 +224,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) return buf; } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) -{ +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { int n; (void)opaque; @@ -277,14 +260,12 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) # define _hfree hfree #endif -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) -{ +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) { (void)opaque; return _halloc((long)items, size); } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) -{ +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { (void)opaque; _hfree(ptr); } @@ -297,25 +278,18 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) #ifndef MY_ZCALLOC /* Any system without a special alloc function */ #ifndef STDC -extern voidp malloc OF((uInt size)); -extern voidp calloc OF((uInt items, uInt size)); -extern void free OF((voidpf ptr)); +extern voidp malloc(uInt size); +extern voidp calloc(uInt items, uInt size); +extern void free(voidpf ptr); #endif -voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { (void)opaque; return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : (voidpf)calloc(items, size); } -void ZLIB_INTERNAL zcfree (opaque, ptr) - voidpf opaque; - voidpf ptr; -{ +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { (void)opaque; free(ptr); } diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zutil.h b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zutil.h index b079ea6a80f5ab..48dd7febae65ee 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zutil.h +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/zlib/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -29,10 +29,6 @@ # include #endif -#ifdef Z_SOLO - typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ -#endif - #ifndef local # define local static #endif @@ -46,10 +42,21 @@ typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; +#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC) +# include +# if (ULONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long +# elif (ULLONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long long +# elif (UINT_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned +# endif +#endif + extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -130,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -163,22 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 @@ -188,8 +170,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* provide prototypes for these when building zlib without LFS */ #if !defined(_WIN32) && \ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t); #endif /* common defaults */ @@ -228,16 +211,16 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define zmemzero(dest, len) memset(dest, 0, len) # endif #else - void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); + void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len); + int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len); + void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len); #endif /* Diagnostic functions */ #ifdef ZLIB_DEBUG # include extern int ZLIB_INTERNAL z_verbose; - extern void ZLIB_INTERNAL z_error OF((char *m)); + extern void ZLIB_INTERNAL z_error(char *m); # define Assert(cond,msg) {if(!(cond)) z_error(msg);} # define Trace(x) {if (z_verbose>=0) fprintf x ;} # define Tracev(x) {if (z_verbose>0) fprintf x ;} @@ -254,9 +237,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #endif #ifndef Z_SOLO - voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, - unsigned size)); - void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); + voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, + unsigned size); + void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr); #endif #define ZALLOC(strm, items, size) \ diff --git a/src/libraries/System.CodeDom/src/CompatibilitySuppressions.xml b/src/libraries/System.CodeDom/src/CompatibilitySuppressions.xml deleted file mode 100644 index 292caf8b32fd1a..00000000000000 --- a/src/libraries/System.CodeDom/src/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - CP0001 - lib/netstandard2.0/System.CodeDom.dll - lib/net461/System.CodeDom.dll - - \ No newline at end of file diff --git a/src/libraries/System.CodeDom/src/System.CodeDom.csproj b/src/libraries/System.CodeDom/src/System.CodeDom.csproj index fa0494af60b781..a31948ffa9bc24 100644 --- a/src/libraries/System.CodeDom/src/System.CodeDom.csproj +++ b/src/libraries/System.CodeDom/src/System.CodeDom.csproj @@ -5,6 +5,9 @@ $(NetCoreAppCurrent);netstandard2.0;net461 false true + + false + 0 Provides types that can be used to model the structure of a source code document and to output source code for that model in a supported language. Commonly Used Types: diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CSharpCodeGeneratorTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CSharpCodeGeneratorTests.cs index 8b9f94b0dbc7b6..0256638f5f6a83 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CSharpCodeGeneratorTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CSharpCodeGeneratorTests.cs @@ -9,7 +9,6 @@ namespace System.CodeDom.Compiler.Tests { - [ActiveIssue("https://github.com/dotnet/runtime/issues/57363", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] public class CSharpCodeGeneratorTests { private static IEnumerable Identifier_TestData() diff --git a/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs b/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs index 4afe5340d39b4c..a19395ca8ef31f 100644 --- a/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs +++ b/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs @@ -6,6 +6,7 @@ namespace System.Collections.Concurrent { +#if !BUILDING_CORELIB_REFERENCE [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] public partial class BlockingCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.ICollection, System.Collections.IEnumerable, System.IDisposable { @@ -126,6 +127,7 @@ void System.Collections.IDictionary.Remove(object key) { } public bool TryRemove(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; } public bool TryUpdate(TKey key, TValue newValue, TValue comparisonValue) { throw null; } } +#endif public partial class ConcurrentQueue : System.Collections.Concurrent.IProducerConsumerCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.ICollection, System.Collections.IEnumerable { public ConcurrentQueue() { } @@ -146,6 +148,7 @@ void System.Collections.ICollection.CopyTo(System.Array array, int index) { } public bool TryDequeue([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T result) { throw null; } public bool TryPeek([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T result) { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial class ConcurrentStack : System.Collections.Concurrent.IProducerConsumerCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.ICollection, System.Collections.IEnumerable { public ConcurrentStack() { } @@ -176,6 +179,7 @@ public enum EnumerablePartitionerOptions None = 0, NoBuffering = 1, } +#endif public partial interface IProducerConsumerCollection : System.Collections.Generic.IEnumerable, System.Collections.ICollection, System.Collections.IEnumerable { void CopyTo(T[] array, int index); @@ -183,6 +187,7 @@ public partial interface IProducerConsumerCollection : System.Collections.Gen bool TryAdd(T item); bool TryTake([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T item); } +#if !BUILDING_CORELIB_REFERENCE public abstract partial class OrderablePartitioner : System.Collections.Concurrent.Partitioner { protected OrderablePartitioner(bool keysOrderedInEachPartition, bool keysOrderedAcrossPartitions, bool keysNormalized) { } @@ -212,4 +217,5 @@ protected Partitioner() { } public virtual System.Collections.Generic.IEnumerable GetDynamicPartitions() { throw null; } public abstract System.Collections.Generic.IList> GetPartitions(int partitionCount); } +#endif } diff --git a/src/libraries/System.Collections/ref/System.Collections.cs b/src/libraries/System.Collections/ref/System.Collections.cs index ceaadeb8ba6696..11cf4649326e18 100644 --- a/src/libraries/System.Collections/ref/System.Collections.cs +++ b/src/libraries/System.Collections/ref/System.Collections.cs @@ -6,6 +6,7 @@ namespace System.Collections { +#if !BUILDING_CORELIB_REFERENCE public sealed partial class BitArray : System.Collections.ICollection, System.Collections.IEnumerable, System.ICloneable { public BitArray(bool[] values) { } @@ -38,9 +39,12 @@ public static partial class StructuralComparisons public static System.Collections.IComparer StructuralComparer { get { throw null; } } public static System.Collections.IEqualityComparer StructuralEqualityComparer { get { throw null; } } } +#endif } + namespace System.Collections.Generic { +#if !BUILDING_CORELIB_REFERENCE public static partial class CollectionExtensions { public static TValue? GetValueOrDefault(this System.Collections.Generic.IReadOnlyDictionary dictionary, TKey key) { throw null; } @@ -48,6 +52,7 @@ public static partial class CollectionExtensions public static bool Remove(this System.Collections.Generic.IDictionary dictionary, TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; } public static bool TryAdd(this System.Collections.Generic.IDictionary dictionary, TKey key, TValue value) { throw null; } } +#endif public abstract partial class Comparer : System.Collections.Generic.IComparer, System.Collections.IComparer { protected Comparer() { } @@ -240,6 +245,7 @@ public void Dispose() { } void System.Collections.IEnumerator.Reset() { } } } +#if !BUILDING_CORELIB_REFERENCE public sealed partial class LinkedListNode { public LinkedListNode(T value) { } @@ -298,6 +304,7 @@ void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(obj void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } } } +#endif public partial class List : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList { public List() { } @@ -379,7 +386,7 @@ public void Dispose() { } void System.Collections.IEnumerator.Reset() { } } } - +#if !BUILDING_CORELIB_REFERENCE public partial class PriorityQueue { public PriorityQueue() { } @@ -423,7 +430,7 @@ void System.Collections.IEnumerator.Reset() { } } } } - +#endif public partial class Queue : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.ICollection, System.Collections.IEnumerable { public Queue() { } @@ -466,6 +473,7 @@ private ReferenceEqualityComparer() { } public new bool Equals(object? x, object? y) { throw null; } public int GetHashCode(object? obj) { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial class SortedDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.Generic.IReadOnlyCollection>, System.Collections.Generic.IReadOnlyDictionary, System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable where TKey : notnull { public SortedDictionary() { } @@ -718,4 +726,5 @@ public void Dispose() { } void System.Collections.IEnumerator.Reset() { } } } +#endif } diff --git a/src/libraries/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.cs b/src/libraries/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.cs index aa1912cdb0f9d7..c78333ddf64333 100644 --- a/src/libraries/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.cs +++ b/src/libraries/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.cs @@ -6,15 +6,12 @@ namespace System.ComponentModel.DataAnnotations { - // TODO-NULLABLE: Enable after System.ComponentModel.TypeDescriptionProvider is annotated -#nullable disable public partial class AssociatedMetadataTypeTypeDescriptionProvider : System.ComponentModel.TypeDescriptionProvider { public AssociatedMetadataTypeTypeDescriptionProvider(System.Type type) { } public AssociatedMetadataTypeTypeDescriptionProvider(System.Type type, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type associatedMetadataType) { } - public override System.ComponentModel.ICustomTypeDescriptor GetTypeDescriptor([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type objectType, object instance) { throw null; } + public override System.ComponentModel.ICustomTypeDescriptor GetTypeDescriptor([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type objectType, object? instance) { throw null; } } -#nullable enable [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)] [System.ObsoleteAttribute("AssociationAttribute has been deprecated and is not supported.")] public sealed partial class AssociationAttribute : System.Attribute diff --git a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs index a408e38342083e..fbfe36a6c888b8 100644 --- a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs +++ b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// TODO-NULLABLE: Enable after System.ComponentModel.TypeDescriptionProvider is annotated -#nullable disable - using System.Diagnostics.CodeAnalysis; namespace System.ComponentModel.DataAnnotations @@ -15,7 +12,7 @@ namespace System.ComponentModel.DataAnnotations public class AssociatedMetadataTypeTypeDescriptionProvider : TypeDescriptionProvider { [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] - private readonly Type _associatedMetadataType; + private readonly Type? _associatedMetadataType; /// /// Initializes a new instance of the System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptionProvider @@ -53,9 +50,9 @@ public AssociatedMetadataTypeTypeDescriptionProvider( /// The type of object to retrieve the type descriptor for. /// An instance of the type. /// The descriptor that provides metadata for the type. - public override ICustomTypeDescriptor GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object instance) + public override ICustomTypeDescriptor GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance) { - ICustomTypeDescriptor baseDescriptor = base.GetTypeDescriptor(objectType, instance); + ICustomTypeDescriptor? baseDescriptor = base.GetTypeDescriptor(objectType, instance); return new AssociatedMetadataTypeTypeDescriptor(baseDescriptor, objectType, _associatedMetadataType); } } diff --git a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs index 5c49bd6062f710..ab8b86b13161df 100644 --- a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs +++ b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// TODO-NULLABLE: Enable after System.ComponentModel.TypeDescriptionProvider is annotated -#nullable disable - using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -15,14 +12,14 @@ namespace System.ComponentModel.DataAnnotations internal sealed class AssociatedMetadataTypeTypeDescriptor : CustomTypeDescriptor { [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] - private Type AssociatedMetadataType { get; set; } + private Type? AssociatedMetadataType { get; set; } private bool IsSelfAssociated { get; set; } public AssociatedMetadataTypeTypeDescriptor( - ICustomTypeDescriptor parent, + ICustomTypeDescriptor? parent, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type type, - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type associatedMetadataType) + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? associatedMetadataType) : base(parent) { AssociatedMetadataType = associatedMetadataType ?? TypeDescriptorCache.GetAssociatedMetadataType(type); @@ -34,7 +31,7 @@ public AssociatedMetadataTypeTypeDescriptor( } [RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")] - public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) + public override PropertyDescriptorCollection GetProperties(Attribute[]? attributes) { return GetPropertiesWithMetadata(base.GetProperties(attributes)); } @@ -96,7 +93,7 @@ public override AttributeCollection GetAttributes() private static class TypeDescriptorCache { // Stores the associated metadata type for a type - private static readonly ConcurrentDictionary s_metadataTypeCache = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary s_metadataTypeCache = new ConcurrentDictionary(); // Stores the attributes for a member info private static readonly ConcurrentDictionary<(Type, string), Attribute[]> s_typeMemberCache = new ConcurrentDictionary<(Type, string), Attribute[]>(); @@ -117,16 +114,16 @@ public static void ValidateMetadataType( } [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] - public static Type GetAssociatedMetadataType(Type type) + public static Type? GetAssociatedMetadataType(Type type) { - Type associatedMetadataType = null; + Type? associatedMetadataType; if (s_metadataTypeCache.TryGetValue(type, out associatedMetadataType)) { return associatedMetadataType; } // Try association attribute - MetadataTypeAttribute attribute = (MetadataTypeAttribute)Attribute.GetCustomAttribute(type, typeof(MetadataTypeAttribute)); + MetadataTypeAttribute? attribute = (MetadataTypeAttribute?)Attribute.GetCustomAttribute(type, typeof(MetadataTypeAttribute)); if (attribute != null) { associatedMetadataType = attribute.MetadataClassType; @@ -164,7 +161,7 @@ public static Attribute[] GetAssociatedMetadata( string memberName) { (Type, string) memberTuple = (type, memberName); - Attribute[] attributes; + Attribute[]? attributes; if (s_typeMemberCache.TryGetValue(memberTuple, out attributes)) { return attributes; @@ -175,7 +172,7 @@ public static Attribute[] GetAssociatedMetadata( // Only public static/instance members BindingFlags searchFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static; // Try to find a matching member on type - MemberInfo matchingMember = type.GetMember(memberName, allowedMemberTypes, searchFlags).FirstOrDefault(); + MemberInfo? matchingMember = type.GetMember(memberName, allowedMemberTypes, searchFlags).FirstOrDefault(); if (matchingMember != null) { attributes = Attribute.GetCustomAttributes(matchingMember, true /* inherit */); diff --git a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs index 2e28b0cb6ac3df..de5a86a64ac8c0 100644 --- a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs +++ b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs @@ -7,6 +7,9 @@ namespace System.ComponentModel.DataAnnotations AllowMultiple = false)] public sealed class EmailAddressAttribute : DataTypeAttribute { + private static bool EnableFullDomainLiterals { get; } = + AppContext.TryGetSwitch("System.Net.AllowFullDomainLiterals", out bool enable) ? enable : false; + public EmailAddressAttribute() : base(DataType.EmailAddress) { @@ -27,6 +30,11 @@ public override bool IsValid(object? value) return false; } + if (!EnableFullDomainLiterals && (valueAsString.Contains('\r') || valueAsString.Contains('\n'))) + { + return false; + } + // only return true if there is only 1 '@' character // and it is neither the first nor the last character int index = valueAsString.IndexOf('@'); diff --git a/src/libraries/System.ComponentModel.Annotations/tests/System/ComponentModel/DataAnnotations/EmailAddressAttributeTests.cs b/src/libraries/System.ComponentModel.Annotations/tests/System/ComponentModel/DataAnnotations/EmailAddressAttributeTests.cs index a0c67ed7d2b92b..da80016608e402 100644 --- a/src/libraries/System.ComponentModel.Annotations/tests/System/ComponentModel/DataAnnotations/EmailAddressAttributeTests.cs +++ b/src/libraries/System.ComponentModel.Annotations/tests/System/ComponentModel/DataAnnotations/EmailAddressAttributeTests.cs @@ -29,6 +29,7 @@ protected override IEnumerable InvalidValues() yield return new TestCase(new EmailAddressAttribute(), 0); yield return new TestCase(new EmailAddressAttribute(), ""); yield return new TestCase(new EmailAddressAttribute(), " \r \t \n" ); + yield return new TestCase(new EmailAddressAttribute(), "someName@[\r\n\tsomeDomain]"); yield return new TestCase(new EmailAddressAttribute(), "@someDomain.com"); yield return new TestCase(new EmailAddressAttribute(), "@someDomain@abc.com"); yield return new TestCase(new EmailAddressAttribute(), "someName"); diff --git a/src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj b/src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj index 93d35759d7fafd..de08e54500f20c 100644 --- a/src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj +++ b/src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj @@ -3,6 +3,9 @@ $(NetCoreAppCurrent);netstandard2.1 false true + + false + 0 true true This namespace provides classes that constitute the core of the Managed Extensibility Framework, or MEF. diff --git a/src/libraries/System.ComponentModel.Composition/Directory.Build.props b/src/libraries/System.ComponentModel.Composition/Directory.Build.props index 7b1204a4c7202c..798ccfd363e813 100644 --- a/src/libraries/System.ComponentModel.Composition/Directory.Build.props +++ b/src/libraries/System.ComponentModel.Composition/Directory.Build.props @@ -1,7 +1,6 @@  - 4.0.0.0 ECMA diff --git a/src/libraries/System.ComponentModel.Composition/Directory.Build.targets b/src/libraries/System.ComponentModel.Composition/Directory.Build.targets new file mode 100644 index 00000000000000..e8aeeb47a8da9c --- /dev/null +++ b/src/libraries/System.ComponentModel.Composition/Directory.Build.targets @@ -0,0 +1,8 @@ + + + + + 4.0.0.0 + + diff --git a/src/libraries/System.ComponentModel.Composition/src/System.ComponentModel.Composition.csproj b/src/libraries/System.ComponentModel.Composition/src/System.ComponentModel.Composition.csproj index 303afd8efae80f..45146846e11e5f 100644 --- a/src/libraries/System.ComponentModel.Composition/src/System.ComponentModel.Composition.csproj +++ b/src/libraries/System.ComponentModel.Composition/src/System.ComponentModel.Composition.csproj @@ -4,6 +4,9 @@ enable false true + + false + 0 true true This namespace provides classes that constitute the core of the Managed Extensibility Framework, or MEF. diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs index 0747e7ff01e95e..4967187d006446 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs @@ -27,7 +27,12 @@ public sealed class TypeDescriptor // class load anyway. private static readonly WeakHashtable s_providerTable = new WeakHashtable(); // mapping of type or object hash to a provider list private static readonly Hashtable s_providerTypeTable = new Hashtable(); // A direct mapping from type to provider. - private static readonly Hashtable s_defaultProviders = new Hashtable(); // A table of type -> default provider to track DefaultTypeDescriptionProviderAttributes. + + private static readonly Hashtable s_defaultProviderInitialized = new Hashtable(); // A table of type -> object to track DefaultTypeDescriptionProviderAttributes. + // A value of `null` indicates initialization is in progress. + // A value of s_initializedDefaultProvider indicates the provider is initialized. + private static readonly object s_initializedDefaultProvider = new object(); + private static WeakHashtable? s_associationTable; private static int s_metadataVersion; // a version stamp for our metadata. Used by property descriptors to know when to rebuild attributes. @@ -74,8 +79,6 @@ public sealed class TypeDescriptor Guid.NewGuid() // events }; - private static readonly object s_internalSyncObject = new object(); - private TypeDescriptor() { } @@ -302,32 +305,43 @@ public static void AddProviderTransparent(TypeDescriptionProvider provider, obje /// private static void CheckDefaultProvider(Type type) { - if (s_defaultProviders.ContainsKey(type)) + if (s_defaultProviderInitialized[type] == s_initializedDefaultProvider) { return; } - lock (s_internalSyncObject) + // Lock on s_providerTable even though s_providerTable is not modified here. + // Using a single lock prevents deadlocks since other methods that call into or are called + // by this method also lock on s_providerTable and the ordering of the locks may be different. + lock (s_providerTable) { - if (s_defaultProviders.ContainsKey(type)) - { - return; - } + AddDefaultProvider(type); + } + } + + /// + /// Add the default provider, if it exists. + /// For threading, this is always called under a 'lock (s_providerTable)'. + /// + private static void AddDefaultProvider(Type type) + { + bool providerAdded = false; - // Immediately clear this. If we find a default provider - // and it starts messing around with type information, - // this could infinitely recurse. - s_defaultProviders[type] = null; + if (s_defaultProviderInitialized.ContainsKey(type)) + { + // Either another thread finished initializing for this type, or we are recursing on the same thread. + return; } - // Always use core reflection when checking for - // the default provider attribute. If there is a - // provider, we probably don't want to build up our - // own cache state against the type. There shouldn't be - // more than one of these, but walk anyway. Walk in - // reverse order so that the most derived takes precidence. + // Immediately set this to null to indicate we are in progress setting the default provider for a type. + // This prevents re-entrance to this method. + s_defaultProviderInitialized[type] = null; + + // Always use core reflection when checking for the default provider attribute. + // If there is a provider, we probably don't want to build up our own cache state against the type. + // There shouldn't be more than one of these, but walk anyway. + // Walk in reverse order so that the most derived takes precedence. object[] attrs = type.GetCustomAttributes(typeof(TypeDescriptionProviderAttribute), false); - bool providerAdded = false; for (int idx = attrs.Length - 1; idx >= 0; idx--) { TypeDescriptionProviderAttribute pa = (TypeDescriptionProviderAttribute)attrs[idx]; @@ -339,24 +353,25 @@ private static void CheckDefaultProvider(Type type) providerAdded = true; } } - // If we did not add a provider, check the base class. if (!providerAdded) { Type? baseType = type.BaseType; if (baseType != null && baseType != type) { - CheckDefaultProvider(baseType); + AddDefaultProvider(baseType); } } + + s_defaultProviderInitialized[type] = s_initializedDefaultProvider; } /// - /// The CreateAssocation method creates an association between two objects. + /// The CreateAssociation method creates an association between two objects. /// Once an association is created, a designer or other filtering mechanism /// can add properties that route to either object into the primary object's /// property set. When a property invocation is made against the primary - /// object, GetAssocation will be called to resolve the actual object + /// object, GetAssociation will be called to resolve the actual object /// instance that is related to its type parameter. /// [EditorBrowsable(EditorBrowsableState.Advanced)] diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.cs index a142fe5e5c7d0f..08dd7107ff82f1 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptorTests.cs @@ -5,6 +5,10 @@ using System.Collections.Generic; using System.ComponentModel.Design; using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.DotNet.RemoteExecutor; using Moq; using Xunit; @@ -61,7 +65,7 @@ public void AddProvider_InvokeObjectMultipleTimes_Refreshes() .Setup(p => p.GetCache(instance)) .Returns(new Dictionary()) .Verifiable(); - + int callCount = 0; RefreshEventHandler handler = (e) => { @@ -147,7 +151,7 @@ public void AddProvider_InvokeTypeMultipleTimes_Refreshes() .Setup(p => p.GetCache(type)) .Returns(new Dictionary()) .Verifiable(); - + int callCount = 0; RefreshEventHandler handler = (e) => { @@ -253,7 +257,7 @@ public void AddProviderTransparent_InvokeObjectMultipleTimes_Refreshes() .Setup(p => p.GetCache(instance)) .Returns(new Dictionary()) .Verifiable(); - + int callCount = 0; RefreshEventHandler handler = (e) => { @@ -338,7 +342,7 @@ public void AddProviderTransparent_InvokeTypeMultipleTimes_Refreshes() .Setup(p => p.GetCache(type)) .Returns(new Dictionary()) .Verifiable(); - + int callCount = 0; RefreshEventHandler handler = (e) => { @@ -1226,5 +1230,248 @@ protected DerivedCultureInfo() : base("hello") class TwiceDerivedCultureInfo : DerivedCultureInfo { } + + private long _concurrentError = 0; + private bool ConcurrentError + { + get => Interlocked.Read(ref _concurrentError) == 1; + set => Interlocked.Exchange(ref _concurrentError, value ? 1 : 0); + } + + private void ConcurrentTest(TypeWithProperty instance) + { + var properties = TypeDescriptor.GetProperties(instance); + Thread.Sleep(10); + if (properties.Count > 0) + { + ConcurrentError = true; + } + } + + [SkipOnPlatform(TestPlatforms.Browser, "Thread.Start is not supported on browsers.")] + [Fact] + public void ConcurrentGetProperties_ReturnsExpected() + { + const int Timeout = 60000; + int concurrentCount = Environment.ProcessorCount * 2; + + using var finished = new CountdownEvent(concurrentCount); + + var instances = new TypeWithProperty[concurrentCount]; + for (int i = 0; i < concurrentCount; i++) + { + instances[i] = new TypeWithProperty(); + } + + for (int i = 0; i < concurrentCount; i++) + { + int i2 = i; + new Thread(() => + { + ConcurrentTest(instances[i2]); + finished.Signal(); + }).Start(); + } + + finished.Wait(Timeout); + + if (finished.CurrentCount != 0) + { + Assert.True(false, "Timeout. Possible deadlock."); + } + else + { + Assert.False(ConcurrentError, "Fallback type descriptor is used. Possible race condition."); + } + } + + [SkipOnPlatform(TestPlatforms.Browser, "Thread.Start is not supported on browsers.")] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + public static void ConcurrentAddProviderAndGetProvider() + { + // Use a timeout value lower than RemoteExecutor in order to get a nice Fail message. + const int Timeout = 50000; + + RemoteInvokeOptions options = new() + { + TimeOut = 60000 + }; + + RemoteExecutor.Invoke(() => + { + using var finished = new CountdownEvent(2); + Thread t1 = new Thread(() => + { + ConcurrentAddProvider(); + finished.Signal(); + }); + Thread t2 = new Thread(() => + { + ConcurrentGetProvider(); + finished.Signal(); + }); + t1.Start(); + t2.Start(); + finished.Wait(Timeout); + if (finished.CurrentCount != 0) + { + Assert.True(false, "Timeout. Possible deadlock."); + } + }, options).Dispose(); + + static void ConcurrentAddProvider() + { + var provider = new EmptyPropertiesTypeProvider(); + TypeDescriptor.AddProvider(provider, typeof(MyClass)); + + // This test primarily verifies no deadlock, but verify the values anyway. + Assert.True(TypeDescriptor.GetProvider(typeof(MyClass)).IsSupportedType(typeof(MyClass))); + } + + static void ConcurrentGetProvider() + { + TypeDescriptionProvider provider = TypeDescriptor.GetProvider(typeof(TypeWithProperty)); + + // This test primarily verifies no deadlock, but verify the values anyway. + Assert.True(provider.IsSupportedType(typeof(TypeWithProperty))); + } + } + + public sealed class EmptyPropertiesTypeProvider : TypeDescriptionProvider + { + private sealed class EmptyPropertyListDescriptor : ICustomTypeDescriptor + { + public AttributeCollection GetAttributes() => AttributeCollection.Empty; + + public string? GetClassName() => null; + + public string? GetComponentName() => null; + + public TypeConverter? GetConverter() => new TypeConverter(); + + public EventDescriptor? GetDefaultEvent() => null; + + public PropertyDescriptor? GetDefaultProperty() => null; + + public object? GetEditor(Type editorBaseType) => null; + + public EventDescriptorCollection GetEvents() => EventDescriptorCollection.Empty; + + public EventDescriptorCollection GetEvents(Attribute[]? attributes) => GetEvents(); + + public PropertyDescriptorCollection GetProperties() => PropertyDescriptorCollection.Empty; + + public PropertyDescriptorCollection GetProperties(Attribute[]? attributes) => GetProperties(); + + public object? GetPropertyOwner(PropertyDescriptor? pd) => null; + } + public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object? instance) + { + return new EmptyPropertyListDescriptor(); + } + } + + [TypeDescriptionProvider(typeof(EmptyPropertiesTypeProvider))] + public sealed class TypeWithProperty + { + public int OneProperty { get; set; } + } + + public static IEnumerable GetConverter_ByMultithread_ReturnsExpected_TestData() + { + yield return new object[] { typeof(MyClass), typeof(MyTypeConverter) }; + yield return new object[] { typeof(MyInheritedClassWithCustomTypeDescriptionProvider), typeof(MyInheritedClassWithCustomTypeDescriptionProviderConverter) }; + yield return new object[] { typeof(MyInheritedClassWithInheritedTypeDescriptionProvider), typeof(MyTypeConverter) }; + } + + [Theory] + [MemberData(nameof(GetConverter_ByMultithread_ReturnsExpected_TestData))] + public async void GetConverter_ByMultithread_ReturnsExpected(Type typeForGetConverter, Type expectedConverterType) + { + TypeConverter[] actualConverters = await Task.WhenAll( + Enumerable.Range(0, 100).Select(_ => + Task.Run(() => TypeDescriptor.GetConverter(typeForGetConverter)))); + Assert.All(actualConverters, + currentConverter => Assert.IsType(expectedConverterType, currentConverter)); + } + + public static IEnumerable GetConverterWithAddProvider_ByMultithread_Success_TestData() + { + foreach (object[] currentTestCase in GetConverter_ByMultithread_ReturnsExpected_TestData()) + { + yield return currentTestCase; + } + } + + [Theory] + [MemberData(nameof(GetConverterWithAddProvider_ByMultithread_Success_TestData))] + public async void GetConverterWithAddProvider_ByMultithread_Success(Type typeForGetConverter, Type expectedConverterType) + { + TypeConverter[] actualConverters = await Task.WhenAll( + Enumerable.Range(0, 200).Select(_ => + Task.Run(() => + { + var mockProvider = new Mock(MockBehavior.Strict); + var someInstance = new object(); + TypeDescriptor.AddProvider(mockProvider.Object, someInstance); + return TypeDescriptor.GetConverter(typeForGetConverter); + }))); + Assert.All(actualConverters, + currentConverter => Assert.IsType(expectedConverterType, currentConverter)); + } + + [TypeDescriptionProvider(typeof(MyClassTypeDescriptionProvider))] + public class MyClass + { + } + + [TypeDescriptionProvider(typeof(MyInheritedClassWithCustomTypeDescriptionProviderTypeDescriptionProvider))] + public class MyInheritedClassWithCustomTypeDescriptionProvider : MyClass + { + } + + public class MyInheritedClassWithInheritedTypeDescriptionProvider : MyClass + { + } + + public class MyClassTypeDescriptionProvider : TypeDescriptionProvider + { + public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) + { + return new MyClassTypeDescriptor(); + } + } + + public class MyInheritedClassWithCustomTypeDescriptionProviderTypeDescriptionProvider : TypeDescriptionProvider + { + public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) + { + return new MyInheritedClassWithCustomTypeDescriptionProviderTypeDescriptor(); + } + } + + public class MyClassTypeDescriptor : CustomTypeDescriptor + { + public override TypeConverter GetConverter() + { + return new MyTypeConverter(); + } + } + + public class MyInheritedClassWithCustomTypeDescriptionProviderTypeDescriptor : CustomTypeDescriptor + { + public override TypeConverter GetConverter() + { + return new MyInheritedClassWithCustomTypeDescriptionProviderConverter(); + } + } + + public class MyTypeConverter : TypeConverter + { + } + + public class MyInheritedClassWithCustomTypeDescriptionProviderConverter : TypeConverter + { + } } } diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/CompatibilitySuppressions.xml b/src/libraries/System.Configuration.ConfigurationManager/src/CompatibilitySuppressions.xml index 5441f0c558b51a..f1cdac2f6519bb 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Configuration.ConfigurationManager/src/CompatibilitySuppressions.xml @@ -1,7 +1,38 @@  - CP0001 + CP0002 + M:System.Configuration.SettingsAttributeDictionary.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) + lib/netstandard2.0/System.Configuration.ConfigurationManager.dll + lib/net461/System.Configuration.ConfigurationManager.dll + + + CP0002 + M:System.Configuration.SettingsContext.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) + lib/netstandard2.0/System.Configuration.ConfigurationManager.dll + lib/net461/System.Configuration.ConfigurationManager.dll + + + CP0002 + M:System.Configuration.Internal.DelegatingConfigHost.RefreshConfigPaths + lib/netstandard2.0/System.Configuration.ConfigurationManager.dll + lib/net461/System.Configuration.ConfigurationManager.dll + + + CP0002 + M:System.Configuration.Internal.DelegatingConfigHost.get_HasLocalConfig + lib/netstandard2.0/System.Configuration.ConfigurationManager.dll + lib/net461/System.Configuration.ConfigurationManager.dll + + + CP0002 + M:System.Configuration.Internal.DelegatingConfigHost.get_HasRoamingConfig + lib/netstandard2.0/System.Configuration.ConfigurationManager.dll + lib/net461/System.Configuration.ConfigurationManager.dll + + + CP0002 + M:System.Configuration.Internal.DelegatingConfigHost.get_IsAppConfigHttp lib/netstandard2.0/System.Configuration.ConfigurationManager.dll lib/net461/System.Configuration.ConfigurationManager.dll diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj b/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj index 302b9688391665..3bbf8740e7c0b7 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj @@ -1,10 +1,13 @@ - + - $(NetCoreAppCurrent);netstandard2.0;net461 + $(NetCoreAppCurrent);netstandard2.0;net461-windows false $(NoWarn);CA1847 true + + false + 1 Provides types that support using configuration files. Commonly Used Types: diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs index 5d25b97588597a..a2a818b7a5150b 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs @@ -64,17 +64,7 @@ private ClientConfigPaths(string exePath, bool includeUserConfig) if (exeAssembly != null && !isSingleFile) { HasEntryAssembly = true; - - // The original .NET Framework code tried to get the local path without using Uri. - // If we ever find a need to do this again be careful with the logic. "file:///" is - // used for local paths and "file://" for UNCs. Simply removing the prefix will make - // local paths relative on Unix (e.g. "file:///home" will become "home" instead of - // "/home"). - string configBasePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exeAssembly.ManifestModule.Name); - Uri uri = new Uri(configBasePath); - - Debug.Assert(uri.IsFile); - ApplicationUri = uri.LocalPath; + ApplicationUri = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exeAssembly.ManifestModule.Name); } else { @@ -258,7 +248,6 @@ private static string GetTypeAndHashSuffix(string exePath, bool isSingleFile) if (assembly != null && !isSingleFile) { AssemblyName assemblyName = assembly.GetName(); - Uri codeBase = new Uri(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assembly.ManifestModule.Name)); try { @@ -271,7 +260,7 @@ private static string GetTypeAndHashSuffix(string exePath, bool isSingleFile) { typeName = StrongNameDesc; } - else + else if (Uri.TryCreate(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assembly.ManifestModule.Name), UriKind.Absolute, out Uri codeBase)) { try { diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj b/src/libraries/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj index 975159597c1bb9..4c5895f0a26c90 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent);net461 + $(NetCoreAppCurrent);net461-windows true diff --git a/src/libraries/System.Console/src/System.Console.csproj b/src/libraries/System.Console/src/System.Console.csproj index c464007dc95e95..6cbdc48890bb04 100644 --- a/src/libraries/System.Console/src/System.Console.csproj +++ b/src/libraries/System.Console/src/System.Console.csproj @@ -13,6 +13,7 @@ + buffer) => throw Error.GetReadNotSupported(); - - public override unsafe void Write(ReadOnlySpan buffer) + protected override void Print(ReadOnlySpan line) { - string log = ConsolePal.OutputEncoding.GetString(buffer); + string log = line.ToString(); Interop.Logcat.AndroidLogPrint(Interop.Logcat.LogLevel.Info, "DOTNET", log); } } @@ -26,9 +24,9 @@ internal static void EnsureConsoleInitialized() { } public static Stream OpenStandardInput() => throw new PlatformNotSupportedException(); - public static Stream OpenStandardOutput() => new LogcatStream(); + public static Stream OpenStandardOutput() => new LogcatStream(OutputEncoding); - public static Stream OpenStandardError() => new LogcatStream(); + public static Stream OpenStandardError() => new LogcatStream(OutputEncoding); public static Encoding InputEncoding => throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Console/src/System/ConsolePal.iOS.cs b/src/libraries/System.Console/src/System/ConsolePal.iOS.cs index 5279df26401d04..8794d55aeff86d 100644 --- a/src/libraries/System.Console/src/System/ConsolePal.iOS.cs +++ b/src/libraries/System.Console/src/System/ConsolePal.iOS.cs @@ -1,22 +1,22 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Buffers; +using System.Diagnostics; using System.IO; using System.Text; namespace System { - internal sealed class NSLogStream : ConsoleStream + internal sealed class NSLogStream : CachedConsoleStream { - public NSLogStream() : base(FileAccess.Write) {} + public NSLogStream(Encoding encoding) : base(encoding) {} - public override int Read(Span buffer) => throw Error.GetReadNotSupported(); - - public override unsafe void Write(ReadOnlySpan buffer) + protected override unsafe void Print(ReadOnlySpan line) { - fixed (byte* ptr = buffer) + fixed (char* ptr = line) { - Interop.Sys.Log(ptr, buffer.Length); + Interop.Sys.Log((byte*)ptr, line.Length * 2); } } } @@ -28,9 +28,9 @@ internal static void EnsureConsoleInitialized() public static Stream OpenStandardInput() => throw new PlatformNotSupportedException(); - public static Stream OpenStandardOutput() => new NSLogStream(); + public static Stream OpenStandardOutput() => new NSLogStream(OutputEncoding); - public static Stream OpenStandardError() => new NSLogStream(); + public static Stream OpenStandardError() => new NSLogStream(OutputEncoding); public static Encoding InputEncoding => throw new PlatformNotSupportedException(); diff --git a/src/libraries/System.Console/src/System/IO/CachedConsoleStream.cs b/src/libraries/System.Console/src/System/IO/CachedConsoleStream.cs new file mode 100644 index 00000000000000..6aacda65a082a3 --- /dev/null +++ b/src/libraries/System.Console/src/System/IO/CachedConsoleStream.cs @@ -0,0 +1,77 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Buffers; +using System.Diagnostics; +using System.IO; +using System.Text; + +namespace System.IO +{ + internal abstract class CachedConsoleStream : ConsoleStream + { + private readonly StringBuilder _buffer = new StringBuilder(); + private readonly Encoding _encoding; + private readonly Decoder _decoder; + + public CachedConsoleStream(Encoding encoding) : base(FileAccess.Write) + { + _encoding = encoding; + _decoder = _encoding.GetDecoder(); + } + + public override int Read(Span buffer) => throw Error.GetReadNotSupported(); + + public override void Write(ReadOnlySpan buffer) + { + int maxCharCount = _encoding.GetMaxCharCount(buffer.Length); + char[]? pooledBuffer = null; + Span charSpan = maxCharCount <= 512 ? stackalloc char[512] : (pooledBuffer = ArrayPool.Shared.Rent(maxCharCount)); + try + { + int count = _decoder.GetChars(buffer, charSpan, false); + if (count > 0) + { + WriteOrCache(this, _buffer, charSpan.Slice(0, count)); + } + } + finally + { + if (pooledBuffer != null) + { + ArrayPool.Shared.Return(pooledBuffer); + } + } + } + + protected abstract void Print(ReadOnlySpan line); + + private static void WriteOrCache(CachedConsoleStream stream, StringBuilder cache, Span charBuffer) + { + int lastNewLine = charBuffer.LastIndexOf('\n'); + if (lastNewLine != -1) + { + Span lineSpan = charBuffer.Slice(0, lastNewLine); + if (cache.Length > 0) + { + stream.Print(cache.Append(lineSpan).ToString()); + cache.Clear(); + } + else + { + stream.Print(lineSpan); + } + + if (lastNewLine + 1 < charBuffer.Length) + { + cache.Append(charBuffer.Slice(lastNewLine + 1)); + } + + return; + } + + // no newlines found, add the entire buffer to the cache + cache.Append(charBuffer); + } + } +} diff --git a/src/libraries/System.Console/src/System/TermInfo.cs b/src/libraries/System.Console/src/System/TermInfo.cs index 529ff7fcb7a3bf..665b11e73255b8 100644 --- a/src/libraries/System.Console/src/System/TermInfo.cs +++ b/src/libraries/System.Console/src/System/TermInfo.cs @@ -258,9 +258,8 @@ private static bool TryOpen(string filePath, [NotNullWhen(true)] out SafeFileHan // Read in all of the terminfo data long termInfoLength = Interop.CheckIo(Interop.Sys.LSeek(fd, 0, Interop.Sys.SeekWhence.SEEK_END)); // jump to the end to get the file length Interop.CheckIo(Interop.Sys.LSeek(fd, 0, Interop.Sys.SeekWhence.SEEK_SET)); // reset back to beginning - const int MaxTermInfoLength = 4096; // according to the term and tic man pages, 4096 is the terminfo file size max const int HeaderLength = 12; - if (termInfoLength <= HeaderLength || termInfoLength > MaxTermInfoLength) + if (termInfoLength <= HeaderLength) { throw new InvalidOperationException(SR.IO_TermInfoInvalid); } diff --git a/src/libraries/System.Console/tests/ReadAndWrite.cs b/src/libraries/System.Console/tests/ReadAndWrite.cs index 6fd77d6afa9918..c671e4f90313f0 100644 --- a/src/libraries/System.Console/tests/ReadAndWrite.cs +++ b/src/libraries/System.Console/tests/ReadAndWrite.cs @@ -194,6 +194,25 @@ public static async Task OutWriteAndWriteLineOverloads() } } + [Fact] + [PlatformSpecific(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS)] + public void TestConsoleWrite() + { + Stream s = new MemoryStream(); + TextWriter w = new StreamWriter(s); + ((StreamWriter)w).AutoFlush = true; + TextReader r = new StreamReader(s); + Console.SetOut(w); + + Console.Write("A"); + Console.Write("B"); + Console.Write("C"); + + s.Position = 0; + string line = r.ReadToEnd(); + Assert.Equal("ABC", line); + } + private static unsafe void ValidateConsoleEncoding(Encoding encoding) { Assert.NotNull(encoding); diff --git a/src/libraries/System.Data.Common/src/System/Data/Common/SqlUDTStorage.cs b/src/libraries/System.Data.Common/src/System/Data/Common/SqlUDTStorage.cs index b804c470ed02ec..be76c7da050734 100644 --- a/src/libraries/System.Data.Common/src/System/Data/Common/SqlUDTStorage.cs +++ b/src/libraries/System.Data.Common/src/System/Data/Common/SqlUDTStorage.cs @@ -187,6 +187,9 @@ public override object ConvertXmlToObject(XmlReader xmlReader, XmlRootAttribute? } } Type type = (typeName == null) ? _dataType : Type.GetType(typeName)!; + + TypeLimiter.EnsureTypeIsAllowed(type); + object Obj = System.Activator.CreateInstance(type, true)!; Debug.Assert(xmlReader is DataTextReader, "Invalid DataTextReader is being passed to customer"); ((IXmlSerializable)Obj).ReadXml(xmlReader); diff --git a/src/libraries/System.Data.Common/tests/System.Data.Common.Tests.csproj b/src/libraries/System.Data.Common/tests/System.Data.Common.Tests.csproj index 3eff311a0a4bf8..87979211c1f179 100644 --- a/src/libraries/System.Data.Common/tests/System.Data.Common.Tests.csproj +++ b/src/libraries/System.Data.Common/tests/System.Data.Common.Tests.csproj @@ -121,6 +121,7 @@ + diff --git a/src/libraries/System.Data.Common/tests/System/Data/RestrictedTypeHandlingTests.cs b/src/libraries/System.Data.Common/tests/System/Data/RestrictedTypeHandlingTests.cs index 54644b678a5bc2..b1bb652b1a0331 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/RestrictedTypeHandlingTests.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/RestrictedTypeHandlingTests.cs @@ -241,6 +241,59 @@ public void DataTable_HonorsGloballyDefinedAllowList() } } + [Fact] + public void DataTable_HonorsGloballyDefinedAllowListForSqlTypes() + { + // Arrange + + DataTable table = new DataTable("MyTable"); + table.Columns.Add("MyNullableColumn", typeof(MyCustomNullable1)); + table.Rows.Add(new MyCustomNullable1()); + table.AcceptChanges(); + + var asXml = @$" + + + + + + + + + + + + + + + + + + false + + +"; + + // Act & assert + // Deserialization should fail since MyCustomNullable2 is not on the allow list, + // even though MyCustomNullable1 is on the allow list. + + try + { + AppDomain.CurrentDomain.SetData(AppDomainDataSetDefaultAllowedTypesKey, new Type[] + { + typeof(MyCustomNullable1) + }); + + table = new DataTable(); + Assert.Throws(() => table.ReadXml(new StringReader(asXml))); + } + finally + { + AppDomain.CurrentDomain.SetData(AppDomainDataSetDefaultAllowedTypesKey, null); + } + } + [Fact] public void DataColumn_ConvertExpression_SubjectToAllowList_Success() { @@ -400,6 +453,20 @@ private sealed class MyCustomClass { } + public sealed class MyCustomNullable1 : INullable + { + public static MyCustomNullable1 Null { get; } = new MyCustomNullable1(); + + public bool IsNull => false; + } + + public sealed class MyCustomNullable2 : INullable + { + public static MyCustomNullable2 Null { get; } = new MyCustomNullable2(); + + public bool IsNull => false; + } + public sealed class MyXmlSerializableClass : IXmlSerializable { public XmlSchema GetSchema() diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlXmlTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlXmlTest.cs index bd49bed9f3e7d6..4504ded0de7ee6 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlXmlTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlXmlTest.cs @@ -1,28 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - +using System.Collections; +using System.Collections.Generic; using System.Data.SqlTypes; using System.IO; +using System.Linq; using System.Text; using System.Xml; @@ -32,10 +15,8 @@ namespace System.Data.Tests.SqlTypes { public class SqlXmlTest { - // Test constructor - [Fact] // .ctor (Stream) - //[Category ("NotDotNet")] // Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 2 - public void Constructor2_Stream_Unicode() + [Fact] + public void Constructor_Stream_Unicode() { string xmlStr = "VaradhanVeerapuram"; MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(xmlStr)); @@ -44,8 +25,8 @@ public void Constructor2_Stream_Unicode() Assert.Equal(xmlStr, xmlSql.Value); } - [Fact] // .ctor (Stream) - public void Constructor2_Stream_Empty() + [Fact] + public void Constructor_Stream_Empty() { MemoryStream ms = new MemoryStream(); SqlXml xmlSql = new SqlXml(ms); @@ -54,7 +35,7 @@ public void Constructor2_Stream_Empty() } [Fact] - public void Constructor2_Stream_Null() + public void Constructor_Stream_Null() { SqlXml xmlSql = new SqlXml((Stream)null); Assert.True(xmlSql.IsNull); @@ -62,8 +43,8 @@ public void Constructor2_Stream_Null() Assert.Throws(() => xmlSql.Value); } - [Fact] // .ctor (XmlReader) - public void Constructor3() + [Fact] + public void Constructor_StringReader() { string xmlStr = "VaradhanVeerapuram"; XmlReader xrdr = new XmlTextReader(new StringReader(xmlStr)); @@ -72,8 +53,8 @@ public void Constructor3() Assert.Equal(xmlStr, xmlSql.Value); } - [Fact] // .ctor (XmlReader) - public void Constructor3_XmlReader_Empty() + [Fact] + public void Constructor_XmlReader_Empty() { XmlReaderSettings xs = new XmlReaderSettings(); xs.ConformanceLevel = ConformanceLevel.Fragment; @@ -84,7 +65,7 @@ public void Constructor3_XmlReader_Empty() } [Fact] - public void Constructor3_XmlReader_Null() + public void Constructor_XmlReader_Null() { SqlXml xmlSql = new SqlXml((XmlReader)null); Assert.True(xmlSql.IsNull); @@ -93,7 +74,6 @@ public void Constructor3_XmlReader_Null() } [Fact] - //[Category ("NotDotNet")] // Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 2 public void CreateReader_Stream_Unicode() { string xmlStr = "VaradhanVeerapuram"; @@ -107,7 +87,7 @@ public void CreateReader_Stream_Unicode() } [Fact] - public void SqlXml_fromXmlReader_CreateReaderTest() + public void CreateReader_XmlTextReader_CanReadContent() { string xmlStr = "VaradhanVeerapuram"; XmlReader rdr = new XmlTextReader(new StringReader(xmlStr)); @@ -119,8 +99,82 @@ public void SqlXml_fromXmlReader_CreateReaderTest() Assert.Equal(xmlStr, xrdr.ReadOuterXml()); } + public static class CreateReader_TestFiles + { + private static TheoryData _filesAndBaselines; + + // The test files are made available through the System.Data.Common.TestData package included in dotnet/runtime-assets + private static void EnsureFileList() + { + if (_filesAndBaselines is null) + { + IEnumerable text = Directory.EnumerateFiles(Path.Combine("SqlXml.CreateReader", "Baseline-Text"), "*.xml"); + IEnumerable binary = Directory.EnumerateFiles(Path.Combine("SqlXml.CreateReader", "SqlBinaryXml"), "*.bmx"); + + // Make sure that we found our test files; otherwise the theories would succeed without validating anything + Assert.NotEmpty(text); + Assert.NotEmpty(binary); + + TheoryData filesAndBaselines = new TheoryData(); + + // Use the Text XML files as their own baselines + filesAndBaselines.Append(text.Select(f => new string[] { TextXmlFileName(f), TextXmlFileName(f) }).ToArray()); + + // Use the matching Text XML files as the baselines for the SQL Binary XML files + filesAndBaselines.Append(binary + .Select(Path.GetFileNameWithoutExtension) + .Intersect(text.Select(Path.GetFileNameWithoutExtension)) + .Select(f => new string[] { SqlBinaryXmlFileName(f), TextXmlFileName(f) }).ToArray()); + + _filesAndBaselines = filesAndBaselines; + + string TextXmlFileName(string name) => Path.Combine("SqlXml.CreateReader", "Baseline-Text", $"{name}.xml"); + string SqlBinaryXmlFileName(string name) => Path.Combine("SqlXml.CreateReader", "SqlBinaryXml", $"{name}.bmx"); + } + } + + public static TheoryData FilesAndBaselines + { + get + { + EnsureFileList(); + return _filesAndBaselines; + } + } + + public static string ReadAllXml(XmlReader reader) + { + using StringWriter writer = new StringWriter(); + using XmlWriter xmlWriter = new XmlTextWriter(writer); + + while (reader.Read()) xmlWriter.WriteNode(reader, false); + + return writer.ToString(); + } + } + + [Theory] + [MemberData(nameof(CreateReader_TestFiles.FilesAndBaselines), MemberType = typeof(CreateReader_TestFiles))] + public void CreateReader_TestAgainstBaseline(string testFile, string baselineFile) + { + // Get our expected output by using XmlReader directly + using XmlReader baselineReader = XmlReader.Create(baselineFile); + string expected = CreateReader_TestFiles.ReadAllXml(baselineReader); + + // Now produce the actual output through SqlXml.CreateReader + using FileStream xmlStream = new FileStream(testFile, FileMode.Open); + SqlXml sqlXml = new SqlXml(xmlStream); + + // When the input is text, an XmlTextReader will be returned + // When the input is SQL Binary XML, an XmlSqlBinaryReader will be returned + using XmlReader actualReader = sqlXml.CreateReader(); + string actual = CreateReader_TestFiles.ReadAllXml(actualReader); + + Assert.Equal(expected, actual); + } + [Fact] - public void SqlXml_fromZeroLengthStream_CreateReaderTest() + public void SqlXml_FromZeroLengthStream_CreateReaderTest() { MemoryStream stream = new MemoryStream(); SqlXml xmlSql = new SqlXml(stream); @@ -131,7 +185,7 @@ public void SqlXml_fromZeroLengthStream_CreateReaderTest() } [Fact] - public void SqlXml_fromZeroLengthXmlReader_CreateReaderTest_withFragment() + public void SqlXml_FromZeroLengthXmlReader_CreateReaderTest_withFragment() { XmlReaderSettings xs = new XmlReaderSettings(); xs.ConformanceLevel = ConformanceLevel.Fragment; @@ -145,7 +199,7 @@ public void SqlXml_fromZeroLengthXmlReader_CreateReaderTest_withFragment() } [Fact] - public void SqlXml_fromZeroLengthXmlReader_CreateReaderTest() + public void SqlXml_FromZeroLengthXmlReader_CreateReaderTest() { XmlReader rdr = new XmlTextReader(new StringReader(string.Empty)); diff --git a/src/libraries/System.Data.Odbc/src/CompatibilitySuppressions.xml b/src/libraries/System.Data.Odbc/src/CompatibilitySuppressions.xml index 627b6d1f8addb7..e20e47d1100c30 100644 --- a/src/libraries/System.Data.Odbc/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Data.Odbc/src/CompatibilitySuppressions.xml @@ -1,9 +1,16 @@  - CP0001 - lib/netstandard2.0/System.Data.Odbc.dll - lib/net461/System.Data.Odbc.dll + CP0002 + M:System.Data.Odbc.OdbcParameter.get_Offset + lib/net6.0/System.Data.Odbc.dll + runtimes/win/lib/net6.0/System.Data.Odbc.dll + + + CP0002 + M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) + lib/net6.0/System.Data.Odbc.dll + runtimes/win/lib/net6.0/System.Data.Odbc.dll CP0002 @@ -92,14 +99,14 @@ CP0002 M:System.Data.Odbc.OdbcParameter.get_Offset - lib/net6.0/System.Data.Odbc.dll - runtimes/win/lib/net6.0/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll + runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll CP0002 M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) - lib/net6.0/System.Data.Odbc.dll - runtimes/win/lib/net6.0/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll + runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll CP0002 @@ -140,97 +147,169 @@ CP0002 M:System.Data.Odbc.OdbcParameter.get_Offset - lib/netcoreapp3.1/System.Data.Odbc.dll - runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll + runtimes/freebsd/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true CP0002 M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) - lib/netcoreapp3.1/System.Data.Odbc.dll - runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll + runtimes/freebsd/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.get_Offset + runtimes/illumos/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) + runtimes/illumos/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.get_Offset + runtimes/ios/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) + runtimes/ios/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true - CP0001 - T:System.Data.Odbc.ODBC32 - runtimes/freebsd/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + CP0002 + M:System.Data.Odbc.OdbcParameter.get_Offset + runtimes/linux/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) + runtimes/linux/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll true CP0002 M:System.Data.Odbc.OdbcParameter.get_Offset - runtimes/freebsd/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + runtimes/osx/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll true CP0002 M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) - runtimes/freebsd/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + runtimes/osx/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll true - CP0001 - T:System.Data.Odbc.ODBC32 - runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + CP0002 + M:System.Data.Odbc.OdbcParameter.get_Offset + runtimes/solaris/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) + runtimes/solaris/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll true CP0002 M:System.Data.Odbc.OdbcParameter.get_Offset - runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + runtimes/tvos/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll true CP0002 M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) - runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + runtimes/tvos/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll true - CP0001 - T:System.Data.Odbc.ODBC32 - runtimes/osx/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + CP0002 + M:System.Data.Odbc.OdbcParameter.get_Offset + runtimes/win/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) + runtimes/win/lib/net6.0/System.Data.Odbc.dll + lib/net6.0/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.get_Offset + runtimes/freebsd/lib/netcoreapp3.1/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) + runtimes/freebsd/lib/netcoreapp3.1/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll true CP0002 M:System.Data.Odbc.OdbcParameter.get_Offset - runtimes/osx/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + runtimes/linux/lib/netcoreapp3.1/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll true CP0002 M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) - runtimes/osx/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + runtimes/linux/lib/netcoreapp3.1/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll + true + + + CP0002 + M:System.Data.Odbc.OdbcParameter.get_Offset + runtimes/osx/lib/netcoreapp3.1/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll true - CP0001 - T:System.Data.Odbc.ODBC32 - runtimes/win/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + CP0002 + M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) + runtimes/osx/lib/netcoreapp3.1/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll true CP0002 M:System.Data.Odbc.OdbcParameter.get_Offset - runtimes/win/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll true CP0002 M:System.Data.Odbc.OdbcParameter.set_Offset(System.Int32) - runtimes/win/lib/netcoreapp2.0/System.Data.Odbc.dll - lib/netstandard2.0/System.Data.Odbc.dll + runtimes/win/lib/netcoreapp3.1/System.Data.Odbc.dll + lib/netcoreapp3.1/System.Data.Odbc.dll true \ No newline at end of file diff --git a/src/libraries/System.Data.Odbc/src/Resources/Strings.resx b/src/libraries/System.Data.Odbc/src/Resources/Strings.resx index b6860f2dd50aa8..5332b0d1798eb9 100644 --- a/src/libraries/System.Data.Odbc/src/Resources/Strings.resx +++ b/src/libraries/System.Data.Odbc/src/Resources/Strings.resx @@ -392,9 +392,6 @@ The ODBC provider did not return results from SQLGETTYPEINFO. - - Connection string exceeds maximum allowed length of {0}. - Unknown SQL type - {0}. diff --git a/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj b/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj index 628b8d1e9e0452..44d67a9ba137b0 100644 --- a/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj +++ b/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj @@ -1,10 +1,13 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1-FreeBSD;netcoreapp3.1-Linux;netcoreapp3.1-OSX;netcoreapp3.1;netstandard2.0;net461 + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1-FreeBSD;netcoreapp3.1-Linux;netcoreapp3.1-OSX;netcoreapp3.1;netstandard2.0;net461-windows $(NoWarn);CA2249;CA1838 enable true + + false + 1 Provides a collection of classes used to access an ODBC data source in the managed space Commonly Used Types: diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs index 6c326926ba576e..9f2213056e9f6e 100644 --- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs +++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs @@ -24,18 +24,17 @@ internal static Exception UnknownSQLType(ODBC32.SQL_TYPE sqltype) { return ADP.Argument(SR.GetString(SR.Odbc_UnknownSQLType, sqltype.ToString())); } - internal static Exception ConnectionStringTooLong() - { - return ADP.Argument(SR.GetString(SR.OdbcConnection_ConnectionStringTooLong, ODBC32.MAX_CONNECTION_STRING_LENGTH)); - } + internal static ArgumentException GetSchemaRestrictionRequired() { return ADP.Argument(SR.GetString(SR.ODBC_GetSchemaRestrictionRequired)); } + internal static ArgumentOutOfRangeException NotSupportedEnumerationValue(Type type, int value) { return ADP.ArgumentOutOfRange(SR.GetString(SR.ODBC_NotSupportedEnumerationValue, type.Name, value.ToString(System.Globalization.CultureInfo.InvariantCulture)), type.Name); } + internal static ArgumentOutOfRangeException NotSupportedCommandType(CommandType value) { #if DEBUG @@ -664,12 +663,6 @@ internal enum SQL_DRIVER COMPLETE_REQUIRED = 3, } - // todo:move - // internal const. not odbc specific - // - // Connection string max length - internal const int MAX_CONNECTION_STRING_LENGTH = 1024; - // Column set for SQLPrimaryKeys internal enum SQL_PRIMARYKEYS : short { diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionString.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionString.cs index 74790e05ac1f2a..7efb675d68b5bb 100644 --- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionString.cs +++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionString.cs @@ -22,14 +22,6 @@ internal OdbcConnectionString(string connectionString, bool validate) : base(con int position = 0; _expandedConnectionString = ExpandDataDirectories(ref filename, ref position); } - if (validate || (null == _expandedConnectionString)) - { - // do not check string length if it was expanded because the final result may be shorter than the original - if ((null != connectionString) && (ODBC32.MAX_CONNECTION_STRING_LENGTH < connectionString.Length)) - { // MDAC 83536 - throw ODBC.ConnectionStringTooLong(); - } - } } } } diff --git a/src/libraries/System.Data.OleDb/ref/System.Data.OleDb.csproj b/src/libraries/System.Data.OleDb/ref/System.Data.OleDb.csproj index 4cc65fb4368cf9..370bfcc6896694 100644 --- a/src/libraries/System.Data.OleDb/ref/System.Data.OleDb.csproj +++ b/src/libraries/System.Data.OleDb/ref/System.Data.OleDb.csproj @@ -23,7 +23,6 @@ - diff --git a/src/libraries/System.Data.OleDb/src/CompatibilitySuppressions.xml b/src/libraries/System.Data.OleDb/src/CompatibilitySuppressions.xml deleted file mode 100644 index 3bdc38c1743f04..00000000000000 --- a/src/libraries/System.Data.OleDb/src/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - CP0001 - lib/netstandard2.0/System.Data.OleDb.dll - lib/net461/System.Data.OleDb.dll - - \ No newline at end of file diff --git a/src/libraries/System.Data.OleDb/src/System.Data.OleDb.csproj b/src/libraries/System.Data.OleDb/src/System.Data.OleDb.csproj index a5e9b248302241..3370a6f9deed38 100644 --- a/src/libraries/System.Data.OleDb/src/System.Data.OleDb.csproj +++ b/src/libraries/System.Data.OleDb/src/System.Data.OleDb.csproj @@ -11,6 +11,9 @@ $(NoWarn);CA1845 true + + false + 0 Provides a collection of classes for OLEDB. Commonly Used Types: @@ -152,8 +155,6 @@ System.Data.OleDb.OleDbTransaction - - diff --git a/src/libraries/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj b/src/libraries/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj index e842a465e60cdc..3071a3573d557f 100644 --- a/src/libraries/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj +++ b/src/libraries/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj @@ -1,17 +1,18 @@ System.Diagnostics.Tests - true - None $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix true + + false - + + diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj b/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj index bac2f7cbbb5182..6b7edb4fe62225 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj @@ -11,6 +11,8 @@ Commonly Used Types: System.Diagnostics.DiagnosticListener System.Diagnostics.DiagnosticSource + false + 1 diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs index c7b92ad12ff2de..b598a75fa85e81 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs @@ -1345,7 +1345,19 @@ public static PropertyFetch FetcherForProperty(Type? type, string propertyName) } else { - PropertyInfo? propertyInfo = typeInfo.GetProperty(propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static); + PropertyInfo? propertyInfo = typeInfo.GetDeclaredProperty(propertyName); + if (propertyInfo == null) + { + foreach (PropertyInfo pi in typeInfo.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static)) + { + if (pi.Name == propertyName) + { + propertyInfo = pi; + break; + } + } + } + if (propertyInfo == null) { Log.Message($"Property {propertyName} not found on {type}. Ensure the name is spelled correctly. If you published the application with PublishTrimmed=true, ensure the property was not trimmed away."); diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs index a785bf15e1c23e..74bd726c82eab7 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs @@ -7,6 +7,7 @@ using System.Globalization; using System.Runtime.Versioning; using System.Text; +using System.Threading; namespace System.Diagnostics.Metrics { @@ -60,13 +61,22 @@ public static class Keywords public const EventKeywords InstrumentPublishing = (EventKeywords)0x4; } - private CommandHandler _handler; + private CommandHandler? _handler; - private MetricsEventSource() + private CommandHandler Handler { - _handler = new CommandHandler(); + get + { + if (_handler == null) + { + Interlocked.CompareExchange(ref _handler, new CommandHandler(this), null); + } + return _handler; + } } + private MetricsEventSource() { } + /// /// Used to send ad-hoc diagnostics to humans. /// @@ -189,7 +199,7 @@ protected override void OnEventCommand(EventCommandEventArgs command) { lock (this) { - _handler.OnEventCommand(command); + Handler.OnEventCommand(command); } } @@ -202,6 +212,13 @@ private sealed class CommandHandler private AggregationManager? _aggregationManager; private string _sessionId = ""; + public CommandHandler(MetricsEventSource parent) + { + Parent = parent; + } + + public MetricsEventSource Parent { get; private set;} + public void OnEventCommand(EventCommandEventArgs command) { try @@ -215,7 +232,7 @@ public void OnEventCommand(EventCommandEventArgs command) // This limitation shouldn't really matter because browser also doesn't support out-of-proc EventSource communication // which is the intended scenario for this EventSource. If it matters in the future AggregationManager can be // modified to have some other fallback path that works for browser. - Log.Error("", "System.Diagnostics.Metrics EventSource not supported on browser"); + Parent.Error("", "System.Diagnostics.Metrics EventSource not supported on browser"); return; } #endif @@ -233,13 +250,13 @@ public void OnEventCommand(EventCommandEventArgs command) // one other listener is active. In the future we might be able to figure out how // to infer the changes from the info we do have or add a better API but for now // I am taking the simple route and not supporting it. - Log.MultipleSessionsNotSupportedError(_sessionId); + Parent.MultipleSessionsNotSupportedError(_sessionId); return; } _aggregationManager.Dispose(); _aggregationManager = null; - Log.Message($"Previous session with id {_sessionId} is stopped"); + Parent.Message($"Previous session with id {_sessionId} is stopped"); } _sessionId = ""; } @@ -249,12 +266,12 @@ public void OnEventCommand(EventCommandEventArgs command) if (command.Arguments!.TryGetValue("SessionId", out string? id)) { _sessionId = id!; - Log.Message($"SessionId argument received: {_sessionId}"); + Parent.Message($"SessionId argument received: {_sessionId}"); } else { _sessionId = System.Guid.NewGuid().ToString(); - Log.Message($"New session started. SessionId auto-generated: {_sessionId}"); + Parent.Message($"New session started. SessionId auto-generated: {_sessionId}"); } @@ -263,21 +280,21 @@ public void OnEventCommand(EventCommandEventArgs command) double refreshIntervalSecs = defaultIntervalSecs; if (command.Arguments!.TryGetValue("RefreshInterval", out string? refreshInterval)) { - Log.Message($"RefreshInterval argument received: {refreshInterval}"); + Parent.Message($"RefreshInterval argument received: {refreshInterval}"); if (!double.TryParse(refreshInterval, out refreshIntervalSecs)) { - Log.Message($"Failed to parse RefreshInterval. Using default {defaultIntervalSecs}s."); + Parent.Message($"Failed to parse RefreshInterval. Using default {defaultIntervalSecs}s."); refreshIntervalSecs = defaultIntervalSecs; } else if (refreshIntervalSecs < AggregationManager.MinCollectionTimeSecs) { - Log.Message($"RefreshInterval too small. Using minimum interval {AggregationManager.MinCollectionTimeSecs} seconds."); + Parent.Message($"RefreshInterval too small. Using minimum interval {AggregationManager.MinCollectionTimeSecs} seconds."); refreshIntervalSecs = AggregationManager.MinCollectionTimeSecs; } } else { - Log.Message($"No RefreshInterval argument received. Using default {defaultIntervalSecs}s."); + Parent.Message($"No RefreshInterval argument received. Using default {defaultIntervalSecs}s."); refreshIntervalSecs = defaultIntervalSecs; } @@ -285,16 +302,16 @@ public void OnEventCommand(EventCommandEventArgs command) int maxTimeSeries; if (command.Arguments!.TryGetValue("MaxTimeSeries", out string? maxTimeSeriesString)) { - Log.Message($"MaxTimeSeries argument received: {maxTimeSeriesString}"); + Parent.Message($"MaxTimeSeries argument received: {maxTimeSeriesString}"); if (!int.TryParse(maxTimeSeriesString, out maxTimeSeries)) { - Log.Message($"Failed to parse MaxTimeSeries. Using default {defaultMaxTimeSeries}"); + Parent.Message($"Failed to parse MaxTimeSeries. Using default {defaultMaxTimeSeries}"); maxTimeSeries = defaultMaxTimeSeries; } } else { - Log.Message($"No MaxTimeSeries argument received. Using default {defaultMaxTimeSeries}"); + Parent.Message($"No MaxTimeSeries argument received. Using default {defaultMaxTimeSeries}"); maxTimeSeries = defaultMaxTimeSeries; } @@ -302,16 +319,16 @@ public void OnEventCommand(EventCommandEventArgs command) int maxHistograms; if (command.Arguments!.TryGetValue("MaxHistograms", out string? maxHistogramsString)) { - Log.Message($"MaxHistograms argument received: {maxHistogramsString}"); + Parent.Message($"MaxHistograms argument received: {maxHistogramsString}"); if (!int.TryParse(maxHistogramsString, out maxHistograms)) { - Log.Message($"Failed to parse MaxHistograms. Using default {defaultMaxHistograms}"); + Parent.Message($"Failed to parse MaxHistograms. Using default {defaultMaxHistograms}"); maxHistograms = defaultMaxHistograms; } } else { - Log.Message($"No MaxHistogram argument received. Using default {defaultMaxHistograms}"); + Parent.Message($"No MaxHistogram argument received. Using default {defaultMaxHistograms}"); maxHistograms = defaultMaxHistograms; } @@ -320,27 +337,27 @@ public void OnEventCommand(EventCommandEventArgs command) maxTimeSeries, maxHistograms, (i, s) => TransmitMetricValue(i, s, sessionId), - (startIntervalTime, endIntervalTime) => Log.CollectionStart(sessionId, startIntervalTime, endIntervalTime), - (startIntervalTime, endIntervalTime) => Log.CollectionStop(sessionId, startIntervalTime, endIntervalTime), - i => Log.BeginInstrumentReporting(sessionId, i.Meter.Name, i.Meter.Version, i.Name, i.GetType().Name, i.Unit, i.Description), - i => Log.EndInstrumentReporting(sessionId, i.Meter.Name, i.Meter.Version, i.Name, i.GetType().Name, i.Unit, i.Description), - i => Log.InstrumentPublished(sessionId, i.Meter.Name, i.Meter.Version, i.Name, i.GetType().Name, i.Unit, i.Description), - () => Log.InitialInstrumentEnumerationComplete(sessionId), - e => Log.Error(sessionId, e.ToString()), - () => Log.TimeSeriesLimitReached(sessionId), - () => Log.HistogramLimitReached(sessionId), - e => Log.ObservableInstrumentCallbackError(sessionId, e.ToString())); + (startIntervalTime, endIntervalTime) => Parent.CollectionStart(sessionId, startIntervalTime, endIntervalTime), + (startIntervalTime, endIntervalTime) => Parent.CollectionStop(sessionId, startIntervalTime, endIntervalTime), + i => Parent.BeginInstrumentReporting(sessionId, i.Meter.Name, i.Meter.Version, i.Name, i.GetType().Name, i.Unit, i.Description), + i => Parent.EndInstrumentReporting(sessionId, i.Meter.Name, i.Meter.Version, i.Name, i.GetType().Name, i.Unit, i.Description), + i => Parent.InstrumentPublished(sessionId, i.Meter.Name, i.Meter.Version, i.Name, i.GetType().Name, i.Unit, i.Description), + () => Parent.InitialInstrumentEnumerationComplete(sessionId), + e => Parent.Error(sessionId, e.ToString()), + () => Parent.TimeSeriesLimitReached(sessionId), + () => Parent.HistogramLimitReached(sessionId), + e => Parent.ObservableInstrumentCallbackError(sessionId, e.ToString())); _aggregationManager.SetCollectionPeriod(TimeSpan.FromSeconds(refreshIntervalSecs)); if (command.Arguments!.TryGetValue("Metrics", out string? metricsSpecs)) { - Log.Message($"Metrics argument received: {metricsSpecs}"); + Parent.Message($"Metrics argument received: {metricsSpecs}"); ParseSpecs(metricsSpecs); } else { - Log.Message("No Metrics argument received"); + Parent.Message("No Metrics argument received"); } _aggregationManager.Start(); @@ -354,7 +371,7 @@ public void OnEventCommand(EventCommandEventArgs command) private bool LogError(Exception e) { - Log.Error(_sessionId, e.ToString()); + Parent.Error(_sessionId, e.ToString()); // this code runs as an exception filter // returning false ensures the catch handler isn't run return false; @@ -374,11 +391,11 @@ private void ParseSpecs(string? metricsSpecs) { if (!MetricSpec.TryParse(specString, out MetricSpec spec)) { - Log.Message("Failed to parse metric spec: {specString}"); + Parent.Message($"Failed to parse metric spec: {specString}"); } else { - Log.Message("Parsed metric: {spec}"); + Parent.Message($"Parsed metric: {spec}"); if (spec.InstrumentName != null) { _aggregationManager!.Include(spec.MeterName, spec.InstrumentName); diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs index c6f16f634022c5..b3fb43640498b9 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs @@ -524,6 +524,39 @@ public void TestBaseClassProperties() }).Dispose(); } + /// + /// Tests that DiagnosticSourceEventSource can read property values from base classes + /// + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + public void TestBaseClassDuplicateProperties() + { + RemoteExecutor.Invoke(() => + { + using (var eventSourceListener = new TestDiagnosticSourceEventListener()) + using (var diagnosticSourceListener = new DiagnosticListener("TestBaseClassProperties")) + { + Assert.Equal(0, eventSourceListener.EventCount); + eventSourceListener.Enable( + " TestBaseClassProperties/TestEvent1:Point_X=Point.X;Point_Y=Point.Y;Url=Url\r\n"); + + /***************************************************************************************/ + // Emit an event that matches the first pattern. + MyClass val = new MyOtherDerivedClass() { Url = "MyUrl", Point = new MyDerivedPoint() { X = 3, Y = 5 } }; + if (diagnosticSourceListener.IsEnabled("TestEvent1")) + diagnosticSourceListener.Write("TestEvent1", val); + + Assert.Equal(1, eventSourceListener.EventCount); // Exactly one more event has been emitted. + Assert.Equal("TestBaseClassProperties", eventSourceListener.LastEvent.SourceName); + Assert.Equal("TestEvent1", eventSourceListener.LastEvent.EventName); + Assert.Equal(4, eventSourceListener.LastEvent.Arguments.Count); + Assert.Equal("3", eventSourceListener.LastEvent.Arguments["Point_X"]); + Assert.Equal("5", eventSourceListener.LastEvent.Arguments["Point_Y"]); + Assert.Equal("MyUrl", eventSourceListener.LastEvent.Arguments["Url"]); + eventSourceListener.ResetEventCountAndLastEvent(); + } + }).Dispose(); + } + /// /// Test that things work properly for Linux newline conventions. /// @@ -1353,6 +1386,11 @@ internal class MyDerivedClass : MyClass public string AnotherString { get; set; } } + internal class MyOtherDerivedClass : MyClass + { + public new MyDerivedPoint Point { get; set; } + } + /// /// classes for test data. /// @@ -1362,6 +1400,9 @@ internal class MyPoint public int Y { get; set; } } + internal class MyDerivedPoint : MyPoint + { } + /// /// classes for test data /// diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/System.Diagnostics.DiagnosticSource.Tests.csproj b/src/libraries/System.Diagnostics.DiagnosticSource/tests/System.Diagnostics.DiagnosticSource.Tests.csproj index 00b5834146ecd7..d0d0eca5a9a872 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/System.Diagnostics.DiagnosticSource.Tests.csproj +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/System.Diagnostics.DiagnosticSource.Tests.csproj @@ -41,6 +41,6 @@ - + \ No newline at end of file diff --git a/src/libraries/System.Diagnostics.EventLog/src/CompatibilitySuppressions.xml b/src/libraries/System.Diagnostics.EventLog/src/CompatibilitySuppressions.xml deleted file mode 100644 index 751a9e77e891e3..00000000000000 --- a/src/libraries/System.Diagnostics.EventLog/src/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - CP0001 - lib/netstandard2.0/System.Diagnostics.EventLog.dll - lib/net461/System.Diagnostics.EventLog.dll - - \ No newline at end of file diff --git a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj index edaf849ba695b1..9f9d910ae21e25 100644 --- a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj +++ b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj @@ -4,6 +4,9 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0;net461 $(NoWarn);CA1838;CA1847 true + + false + 0 Provides the System.Diagnostics.EventLog class, which allows the applications to use the windows event log service. Commonly Used Types: diff --git a/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogRecordTests.cs b/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogRecordTests.cs index 6d4f252bdefb47..7808662bcb0201 100644 --- a/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogRecordTests.cs +++ b/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogRecordTests.cs @@ -90,7 +90,8 @@ public void ToXml() [ConditionalFact(typeof(Helpers), nameof(Helpers.SupportsEventLogs))] public void ExceptionOnce() { - if (PlatformDetection.IsWindows7) // Null events in PowerShell log + if (PlatformDetection.IsWindows7 || // Null events in PowerShell log + PlatformDetection.IsWindows10Version22000OrGreater) // ActiveIssue("https://github.com/dotnet/runtime/issues/58829") return; var query = new EventLogQuery("Application", PathType.LogName, "*[System]") { ReverseDirection = true }; var eventLog = new EventLogReader(query, Helpers.GetBookmark("Application", PathType.LogName)); diff --git a/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/ProviderMetadataTests.cs b/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/ProviderMetadataTests.cs index 0f7f4511022d65..4a82ff8b49d55b 100644 --- a/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/ProviderMetadataTests.cs +++ b/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/ProviderMetadataTests.cs @@ -23,6 +23,9 @@ public void SourceDoesNotExist_Throws() [InlineData(false)] public void ProviderNameTests(bool noProviderName) { + if (PlatformDetection.IsWindows10Version22000OrGreater) // ActiveIssue("https://github.com/dotnet/runtime/issues/58829") + return; + string log = "Application"; string source = "Source_" + nameof(ProviderNameTests); using (var session = new EventLogSession()) @@ -87,6 +90,7 @@ public void ProviderNameTests(bool noProviderName) } [ConditionalFact(typeof(Helpers), nameof(Helpers.SupportsEventLogs))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/80475")] public void GetProviderNames_AssertProperties() { const string Prefix = "win:"; diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/CompatibilitySuppressions.xml b/src/libraries/System.Diagnostics.PerformanceCounter/src/CompatibilitySuppressions.xml deleted file mode 100644 index 5dd8d50f606e67..00000000000000 --- a/src/libraries/System.Diagnostics.PerformanceCounter/src/CompatibilitySuppressions.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - CP0001 - lib/netstandard2.0/System.Diagnostics.PerformanceCounter.dll - lib/net461/System.Diagnostics.PerformanceCounter.dll - - \ No newline at end of file diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj b/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj index 5d99e220260f19..150710e9b74f93 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj +++ b/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj @@ -4,6 +4,9 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0;net461 $(NoWarn);CA1847 true + + false + 1 Provides the System.Diagnostics.PerformanceCounter class, which allows access to Windows performance counters. Commonly Used Types: diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs index bdd47b922779d8..567a8bf433f1f7 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs +++ b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs @@ -45,12 +45,12 @@ internal sealed class PerformanceCounterLib private const string LanguageKeyword = "language"; private const string DllName = "netfxperf.dll"; - private const int EnglishLCID = 0x009; - private static volatile string s_computerName; private static volatile string s_iniFilePath; private static volatile string s_symbolFilePath; + private static CultureInfo s_englishCulture; + private PerformanceMonitor _performanceMonitor; private readonly string _machineName; private readonly string _perfLcid; @@ -79,6 +79,25 @@ private static object InternalSyncObject } } + private static CultureInfo EnglishCulture + { + get + { + if (s_englishCulture is null) + { + try + { + s_englishCulture = CultureInfo.GetCultureInfo("en"); + } + catch + { + s_englishCulture = CultureInfo.InvariantCulture; + } + } + return s_englishCulture; + } + } + internal PerformanceCounterLib(string machineName, string lcid) { _machineName = machineName; @@ -277,11 +296,11 @@ private static string SymbolFilePath internal static bool CategoryExists(string machine, string category) { - PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + PerformanceCounterLib library = GetPerformanceCounterLib(machine, EnglishCulture); if (library.CategoryExists(category)) return true; - if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + if (CultureInfo.CurrentCulture.Parent.Name != EnglishCulture.Name) { CultureInfo culture = CultureInfo.CurrentCulture; while (culture != CultureInfo.InvariantCulture) @@ -349,11 +368,11 @@ internal void Close() internal static bool CounterExists(string machine, string category, string counter) { - PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + PerformanceCounterLib library = GetPerformanceCounterLib(machine, EnglishCulture); bool categoryExists = false; bool counterExists = library.CounterExists(category, counter, ref categoryExists); - if (!categoryExists && CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + if (!categoryExists && CultureInfo.CurrentCulture.Parent.Name != EnglishCulture.Name) { CultureInfo culture = CultureInfo.CurrentCulture; while (culture != CultureInfo.InvariantCulture) @@ -753,7 +772,7 @@ internal static string[] GetCategories(string machineName) culture = culture.Parent; } - library = GetPerformanceCounterLib(machineName, new CultureInfo(EnglishLCID)); + library = GetPerformanceCounterLib(machineName, EnglishCulture); return library.GetCategories(); } @@ -772,7 +791,7 @@ internal static string GetCategoryHelp(string machine, string category) //First check the current culture for the category. This will allow //PerformanceCounterCategory.CategoryHelp to return localized strings. - if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + if (CultureInfo.CurrentCulture.Parent.Name != EnglishCulture.Name) { CultureInfo culture = CultureInfo.CurrentCulture; @@ -788,7 +807,7 @@ internal static string GetCategoryHelp(string machine, string category) //We did not find the category walking up the culture hierarchy. Try looking // for the category in the default culture English. - library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + library = GetPerformanceCounterLib(machine, EnglishCulture); help = library.GetCategoryHelp(category); if (help == null) @@ -808,9 +827,9 @@ private string GetCategoryHelp(string category) internal static CategorySample GetCategorySample(string machine, string category) { - PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + PerformanceCounterLib library = GetPerformanceCounterLib(machine, EnglishCulture); CategorySample sample = library.GetCategorySample(category); - if (sample == null && CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + if (sample == null && CultureInfo.CurrentCulture.Parent.Name != EnglishCulture.Name) { CultureInfo culture = CultureInfo.CurrentCulture; while (culture != CultureInfo.InvariantCulture) @@ -845,11 +864,11 @@ private CategorySample GetCategorySample(string category) internal static string[] GetCounters(string machine, string category) { - PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + PerformanceCounterLib library = GetPerformanceCounterLib(machine, EnglishCulture); bool categoryExists = false; string[] counters = library.GetCounters(category, ref categoryExists); - if (!categoryExists && CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + if (!categoryExists && CultureInfo.CurrentCulture.Parent.Name != EnglishCulture.Name) { CultureInfo culture = CultureInfo.CurrentCulture; while (culture != CultureInfo.InvariantCulture) @@ -910,7 +929,7 @@ internal static string GetCounterHelp(string machine, string category, string co //First check the current culture for the counter. This will allow //PerformanceCounter.CounterHelp to return localized strings. - if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + if (CultureInfo.CurrentCulture.Parent.Name != EnglishCulture.Name) { CultureInfo culture = CultureInfo.CurrentCulture; while (culture != CultureInfo.InvariantCulture) @@ -925,7 +944,7 @@ internal static string GetCounterHelp(string machine, string category, string co //We did not find the counter walking up the culture hierarchy. Try looking // for the counter in the default culture English. - library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + library = GetPerformanceCounterLib(machine, EnglishCulture); help = library.GetCounterHelp(category, counter, ref categoryExists); if (!categoryExists) @@ -990,7 +1009,8 @@ private static string[] GetLanguageIds() internal static PerformanceCounterLib GetPerformanceCounterLib(string machineName, CultureInfo culture) { - string lcidString = culture.LCID.ToString("X3", CultureInfo.InvariantCulture); + // EnglishCulture.LCID == 9 will be false only if running with Globalization Invariant Mode. Use "009" at that time as default English language identifier. + string lcidString = EnglishCulture.LCID == 9 ? culture.LCID.ToString("X3", CultureInfo.InvariantCulture) : "009"; machineName = (machineName == "." ? ComputerName : machineName).ToLowerInvariant(); @@ -1135,11 +1155,11 @@ private Hashtable GetStringTable(bool isHelp) internal static bool IsCustomCategory(string machine, string category) { - PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + PerformanceCounterLib library = GetPerformanceCounterLib(machine, EnglishCulture); if (library.IsCustomCategory(category)) return true; - if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + if (CultureInfo.CurrentCulture.Parent.Name != EnglishCulture.Name) { CultureInfo culture = CultureInfo.CurrentCulture; while (culture != CultureInfo.InvariantCulture) @@ -1174,10 +1194,10 @@ internal static PerformanceCounterCategoryType GetCategoryType(string machine, s { PerformanceCounterCategoryType categoryType = PerformanceCounterCategoryType.Unknown; - PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + PerformanceCounterLib library = GetPerformanceCounterLib(machine, EnglishCulture); if (!library.FindCustomCategory(category, out categoryType)) { - if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + if (CultureInfo.CurrentCulture.Parent.Name != EnglishCulture.Name) { CultureInfo culture = CultureInfo.CurrentCulture; while (culture != CultureInfo.InvariantCulture) diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs b/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs index bfaf5fba64b3de..c8df93e8c267b4 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs +++ b/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs @@ -2,8 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Globalization; using System.Collections; using System.Collections.Specialized; +using Microsoft.DotNet.RemoteExecutor; using Xunit; namespace System.Diagnostics.Tests @@ -287,6 +289,32 @@ public static void PerformanceCounter_NextSample_MultiInstance() } } + private static bool CanRunInInvariantMode => RemoteExecutor.IsSupported && !PlatformDetection.IsNetFramework; + + [ConditionalTheory(nameof(CanRunInInvariantMode))] + [PlatformSpecific(TestPlatforms.Windows)] + [InlineData(true)] + [InlineData(false)] + public static void RunWithGlobalizationInvariantModeTest(bool predefinedCultures) + { + ProcessStartInfo psi = new ProcessStartInfo() { UseShellExecute = false }; + psi.Environment.Add("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1"); + psi.Environment.Add("DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY", predefinedCultures ? "1" : "0"); + RemoteExecutor.Invoke(() => + { + // Ensure we are running inside the Globalization invariant mode. + Assert.Equal("", CultureInfo.CurrentCulture.Name); + + // This test ensure creating PerformanceCounter object while we are running with Globalization Invariant Mode. + // PerformanceCounter used to create cultures using LCID's which fail in Globalization Invariant Mode. + // This test ensure no failure should be encountered in this case. + using (PerformanceCounter counterSample = new PerformanceCounter("Processor", "Interrupts/sec", "0", ".")) + { + Assert.Equal("Processor", counterSample.CategoryName); + } + }, new RemoteInvokeOptions { StartInfo = psi}).Dispose(); + } + public static PerformanceCounter CreateCounterWithCategory(string name, bool readOnly, PerformanceCounterCategoryType categoryType ) { var category = Helpers.CreateCategory(name, categoryType); diff --git a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs index 4c98a461f323e7..7e1f6d5d77adec 100644 --- a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs +++ b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs @@ -43,8 +43,8 @@ public Process() { } public System.Diagnostics.ProcessModule? MainModule { get { throw null; } } public System.IntPtr MainWindowHandle { get { throw null; } } public string MainWindowTitle { get { throw null; } } - public System.IntPtr MaxWorkingSet { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd"), System.Runtime.Versioning.SupportedOSPlatformAttribute("macos"), System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } - public System.IntPtr MinWorkingSet { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd"), System.Runtime.Versioning.SupportedOSPlatformAttribute("macos"), System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } + public System.IntPtr MaxWorkingSet { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos"), System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd"), System.Runtime.Versioning.SupportedOSPlatformAttribute("macos"), System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst"), System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } + public System.IntPtr MinWorkingSet { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos"), System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd"), System.Runtime.Versioning.SupportedOSPlatformAttribute("macos"), System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst"), System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } public System.Diagnostics.ProcessModuleCollection Modules { get { throw null; } } [System.ObsoleteAttribute("Process.NonpagedSystemMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.NonpagedSystemMemorySize64 instead.")] public int NonpagedSystemMemorySize { get { throw null; } } @@ -84,7 +84,13 @@ public Process() { } public System.DateTime StartTime { get { throw null; } } public System.ComponentModel.ISynchronizeInvoke? SynchronizingObject { get { throw null; } set { } } public System.Diagnostics.ProcessThreadCollection Threads { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public System.TimeSpan TotalProcessorTime { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public System.TimeSpan UserProcessorTime { get { throw null; } } [System.ObsoleteAttribute("Process.VirtualMemorySize has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.VirtualMemorySize64 instead.")] public int VirtualMemorySize { get { throw null; } } @@ -106,33 +112,52 @@ public static void EnterDebugMode() { } public static System.Diagnostics.Process GetCurrentProcess() { throw null; } public static System.Diagnostics.Process GetProcessById(int processId) { throw null; } public static System.Diagnostics.Process GetProcessById(int processId, string machineName) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public static System.Diagnostics.Process[] GetProcesses() { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public static System.Diagnostics.Process[] GetProcesses(string machineName) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public static System.Diagnostics.Process[] GetProcessesByName(string? processName) { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public static System.Diagnostics.Process[] GetProcessesByName(string? processName, string machineName) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public void Kill() { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public void Kill(bool entireProcessTree) { } public static void LeaveDebugMode() { } protected void OnExited() { } public void Refresh() { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public bool Start() { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public static System.Diagnostics.Process? Start(System.Diagnostics.ProcessStartInfo startInfo) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public static System.Diagnostics.Process Start(string fileName) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public static System.Diagnostics.Process Start(string fileName, string arguments) { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public static System.Diagnostics.Process Start(string fileName, System.Collections.Generic.IEnumerable arguments) { throw null; } [System.CLSCompliantAttribute(false)] [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] @@ -233,6 +258,9 @@ internal ProcessThread() { } public int IdealProcessor { set { } } public bool PriorityBoostEnabled { get { throw null; } set { } } public System.Diagnostics.ThreadPriorityLevel PriorityLevel { [System.Runtime.Versioning.SupportedOSPlatform("windows")] [System.Runtime.Versioning.SupportedOSPlatform("linux")] [System.Runtime.Versioning.SupportedOSPlatform("freebsd")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public System.TimeSpan PrivilegedProcessorTime { get { throw null; } } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public System.IntPtr ProcessorAffinity { set { } } @@ -241,7 +269,13 @@ public System.IntPtr ProcessorAffinity { set { } } [System.Runtime.Versioning.SupportedOSPlatform("linux")] public System.DateTime StartTime { get { throw null; } } public System.Diagnostics.ThreadState ThreadState { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public System.TimeSpan TotalProcessorTime { get { throw null; } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("maccatalyst")] public System.TimeSpan UserProcessorTime { get { throw null; } } public System.Diagnostics.ThreadWaitReason WaitReason { get { throw null; } } public void ResetIdealProcessor() { } diff --git a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj index 1bf0c43270e42e..b2600bc469c7a7 100644 --- a/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj +++ b/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj @@ -2,7 +2,7 @@ $(DefineConstants);FEATURE_REGISTRY true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS enable $(NoWarn);0649 @@ -306,10 +306,12 @@ Link="Common\Interop\Linux\Interop.ProcFsStat.ParseMapModules.cs" /> + - + @@ -329,7 +331,7 @@ - + @@ -345,6 +347,11 @@ + + + + + diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs index 02b7cce02263d6..70c408cea290bb 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.BSD.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.Versioning; namespace System.Diagnostics { @@ -12,6 +13,9 @@ public partial class Process /// Creates an array of components that are associated with process resources on a /// remote computer. These process resources share the specified process name. /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process[] GetProcessesByName(string? processName, string machineName) { if (processName == null) diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs index 6942d82d6d1595..cd9b0aa340c1bf 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs @@ -7,7 +7,9 @@ using System.ComponentModel; using System.Globalization; using System.IO; +using System.Runtime.Versioning; using System.Text; +using System.Threading; namespace System.Diagnostics { @@ -17,6 +19,9 @@ public partial class Process : IDisposable /// Creates an array of components that are associated with process resources on a /// remote computer. These process resources share the specified process name. /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process[] GetProcessesByName(string? processName, string machineName) { ProcessManager.ThrowIfRemoteMachine(machineName); @@ -71,33 +76,25 @@ internal static DateTime BootTimeToDateTime(TimeSpan timespanAfterBoot) return dt.ToLocalTime(); } + private static long s_bootTimeTicks; /// Gets the system boot time. private static DateTime BootTime { get { - // '/proc/stat -> btime' gets the boot time. - // btime is the time of system boot in seconds since the Unix epoch. - // It includes suspended time and is updated based on the system time (settimeofday). - const string StatFile = Interop.procfs.ProcStatFilePath; - string text = File.ReadAllText(StatFile); - int btimeLineStart = text.IndexOf("\nbtime ", StringComparison.Ordinal); - if (btimeLineStart >= 0) - { - int btimeStart = btimeLineStart + "\nbtime ".Length; - int btimeEnd = text.IndexOf('\n', btimeStart); - if (btimeEnd > btimeStart) + long bootTimeTicks = Interlocked.Read(ref s_bootTimeTicks); + if (bootTimeTicks == 0) + { + bootTimeTicks = Interop.Sys.GetBootTimeTicks(); + long oldValue = Interlocked.CompareExchange(ref s_bootTimeTicks, bootTimeTicks, 0); + if (oldValue != 0) // a different thread has managed to update the ticks first { - if (long.TryParse(text.AsSpan(btimeStart, btimeEnd - btimeStart), out long bootTimeSeconds)) - { - return DateTime.UnixEpoch + TimeSpan.FromSeconds(bootTimeSeconds); - } + bootTimeTicks = oldValue; // consistency } - } - - return DateTime.UtcNow; - } - } + } + return new DateTime(bootTimeTicks); + } + } /// Gets the parent process ID private int ParentProcessId => @@ -244,11 +241,8 @@ private void SetWorkingSetLimitsCore(IntPtr? newMin, IntPtr? newMax, out IntPtr /// The pid for the target process, or -1 for the current process. internal static string? GetExePath(int processId = -1) { - string exeFilePath = processId == -1 ? - Interop.procfs.SelfExeFilePath : - Interop.procfs.GetExeFilePathForProcess(processId); - - return Interop.Sys.ReadLink(exeFilePath); + return processId == -1 ? Environment.ProcessPath : + Interop.Sys.ReadLink(Interop.procfs.GetExeFilePathForProcess(processId)); } /// Gets the name that was used to start the process, or null if it could not be retrieved. diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs index 0dff87802214e9..2bad9c22c9b6d9 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs @@ -11,6 +11,7 @@ public partial class Process : IDisposable { [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public void Kill(bool entireProcessTree) { if (!entireProcessTree) diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs index 69b4481ae2087b..0cbb98891ab235 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs @@ -58,9 +58,10 @@ public static Process Start(string fileName, string arguments, string userName, /// Terminates the associated process immediately. [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public void Kill() { - if (OperatingSystem.IsIOS() || OperatingSystem.IsTvOS()) + if (PlatformDoesNotSupportProcessStartAndKill) { throw new PlatformNotSupportedException(); } @@ -372,7 +373,7 @@ private SafeProcessHandle GetProcessHandle() /// The start info with which to start the process. private bool StartCore(ProcessStartInfo startInfo) { - if (OperatingSystem.IsIOS() || OperatingSystem.IsTvOS()) + if (PlatformDoesNotSupportProcessStartAndKill) { throw new PlatformNotSupportedException(); } @@ -1105,5 +1106,8 @@ private static int OnSigChild(int reapAll, int configureConsole) s_processStartLock.ExitWriteLock(); } } + + private static bool PlatformDoesNotSupportProcessStartAndKill + => (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS(); } } diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.UnknownUnix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.UnknownUnix.cs index 46c652a7fb6a69..f56acfbbb5e0fa 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.UnknownUnix.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.UnknownUnix.cs @@ -9,7 +9,10 @@ public partial class Process : IDisposable /// Creates an array of components that are associated with process resources on a /// remote computer. These process resources share the specified process name. /// - public static Process[] GetProcessesByName(string processName, string machineName) + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] + public static Process[] GetProcessesByName(string? processName, string machineName) { throw new PlatformNotSupportedException(); } @@ -82,5 +85,6 @@ private string GetPathToOpenFile() throw new PlatformNotSupportedException(); } + private int ParentProcessId => throw new PlatformNotSupportedException(); } } diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs index 9c59f54333bf64..8935edc549ba98 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs @@ -21,6 +21,9 @@ public partial class Process : IDisposable /// Creates an array of components that are associated with process resources on a /// remote computer. These process resources share the specified process name. /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process[] GetProcessesByName(string? processName, string machineName) { if (processName == null) @@ -91,6 +94,7 @@ public static void LeaveDebugMode() /// Terminates the associated process immediately. [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public void Kill() { using (SafeProcessHandle handle = GetProcessHandle(Interop.Advapi32.ProcessOptions.PROCESS_TERMINATE | Interop.Advapi32.ProcessOptions.PROCESS_QUERY_LIMITED_INFORMATION, throwIfExited: false)) diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs index 0c5bf3a96542ae..a1796844b59810 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs @@ -193,6 +193,9 @@ public bool HasExited } /// Gets the time the associated process was started. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public DateTime StartTime { get @@ -262,14 +265,16 @@ public IntPtr MaxWorkingSet { [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] get { EnsureWorkingSetLimits(); return _maxWorkingSet; } - [SupportedOSPlatform("windows")] - [SupportedOSPlatform("macos")] [SupportedOSPlatform("freebsd")] + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("maccatalyst")] + [SupportedOSPlatform("windows")] set { SetWorkingSetLimits(null, value); @@ -284,14 +289,16 @@ public IntPtr MinWorkingSet { [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] get { EnsureWorkingSetLimits(); return _minWorkingSet; } - [SupportedOSPlatform("windows")] - [SupportedOSPlatform("macos")] [SupportedOSPlatform("freebsd")] + [SupportedOSPlatform("macos")] + [SupportedOSPlatform("maccatalyst")] + [SupportedOSPlatform("windows")] set { SetWorkingSetLimits(value, null); @@ -1039,6 +1046,9 @@ public static Process GetProcessById(int processId) /// local computer. These process resources share the specified process name. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process[] GetProcessesByName(string? processName) { return GetProcessesByName(processName, "."); @@ -1050,6 +1060,9 @@ public static Process[] GetProcessesByName(string? processName) /// component for each process resource on the local computer. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process[] GetProcesses() { return GetProcesses("."); @@ -1062,6 +1075,9 @@ public static Process[] GetProcesses() /// process resource on the specified computer. /// /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process[] GetProcesses(string machineName) { bool isRemoteMachine = ProcessManager.IsRemoteMachine(machineName); @@ -1205,6 +1221,7 @@ private void SetProcessId(int processId) /// [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public bool Start() { Close(); @@ -1248,6 +1265,7 @@ public bool Start() /// [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process Start(string fileName) { // the underlying Start method can only return null on Windows platforms, @@ -1266,6 +1284,7 @@ public static Process Start(string fileName) /// [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process Start(string fileName, string arguments) { // the underlying Start method can only return null on Windows platforms, @@ -1279,6 +1298,7 @@ public static Process Start(string fileName, string arguments) /// [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process Start(string fileName, IEnumerable arguments) { if (fileName == null) @@ -1305,6 +1325,7 @@ public static Process Start(string fileName, IEnumerable arguments) /// [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static Process? Start(ProcessStartInfo startInfo) { Process process = new Process(); diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs new file mode 100644 index 00000000000000..abbb712d4006ac --- /dev/null +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.iOS.cs @@ -0,0 +1,124 @@ +// 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.Generic; +using System.ComponentModel; +using System.Runtime.Versioning; + +namespace System.Diagnostics +{ + public partial class Process : IDisposable + { + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] + public void Kill(bool entireProcessTree) + { + throw new PlatformNotSupportedException(); + } + + /// + /// Creates an array of components that are associated with process resources on a + /// remote computer. These process resources share the specified process name. + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] + public static Process[] GetProcessesByName(string? processName, string machineName) + { + throw new PlatformNotSupportedException(); + } + + /// Gets the amount of time the process has spent running code inside the operating system core. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan PrivilegedProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + /// Gets the time the associated process was started. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + internal DateTime StartTimeCore + { + get { throw new PlatformNotSupportedException(); } + } + + /// + /// Gets the amount of time the associated process has spent utilizing the CPU. + /// It is the sum of the and + /// . + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan TotalProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + /// + /// Gets the amount of time the associated process has spent running code + /// inside the application portion of the process (not the operating system core). + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan UserProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + /// + /// Returns all immediate child processes. + /// + private IReadOnlyList GetChildProcesses(Process[]? processes = null) + { + throw new PlatformNotSupportedException(); + } + + /// Gets parent process ID + private int GetParentProcessId => + throw new PlatformNotSupportedException(); + + /// + /// Gets or sets which processors the threads in this process can be scheduled to run on. + /// + private IntPtr ProcessorAffinityCore + { + get { throw new PlatformNotSupportedException(); } + set { throw new PlatformNotSupportedException(); } + } + + /// + /// Make sure we have obtained the min and max working set limits. + /// + private void GetWorkingSetLimits(out IntPtr minWorkingSet, out IntPtr maxWorkingSet) + { + throw new PlatformNotSupportedException(); + } + + /// Sets one or both of the minimum and maximum working set limits. + /// The new minimum working set limit, or null not to change it. + /// The new maximum working set limit, or null not to change it. + /// The resulting minimum working set limit after any changes applied. + /// The resulting maximum working set limit after any changes applied. + private void SetWorkingSetLimitsCore(IntPtr? newMin, IntPtr? newMax, out IntPtr resultingMin, out IntPtr resultingMax) + { + throw new PlatformNotSupportedException(); + } + + /// Gets execution path + private string GetPathToOpenFile() + { + throw new PlatformNotSupportedException(); + } + + private int ParentProcessId => throw new PlatformNotSupportedException(); + + private static bool IsProcessInvalidException(Exception e) => + // InvalidOperationException signifies conditions such as the process already being dead. + // Win32Exception signifies issues such as insufficient permissions to get details on the process. + // In either case, the predicate couldn't be applied so return the fallback result. + e is InvalidOperationException || e is Win32Exception; + } +} diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Unix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Unix.cs index 5df7ece329e1d3..1ef579803c622f 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Unix.cs @@ -3,6 +3,7 @@ using Microsoft.Win32.SafeHandles; using System.Collections.Generic; +using System.Runtime.Versioning; using System.Text; namespace System.Diagnostics @@ -44,6 +45,9 @@ public static bool IsProcessRunning(int processId) /// Gets the IDs of all processes on the specified machine. /// The machine to examine. /// An array of process IDs from the specified machine. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] public static int[] GetProcessIds(string machineName) { ThrowIfRemoteMachine(machineName); diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs new file mode 100644 index 00000000000000..2fddb3b200e7e3 --- /dev/null +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.iOS.cs @@ -0,0 +1,39 @@ +// 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.Versioning; + +namespace System.Diagnostics +{ + internal static partial class ProcessManager + { + /// Gets the IDs of all processes on the current machine. + public static int[] GetProcessIds() + { + throw new PlatformNotSupportedException(); + } + + /// Gets process infos for each process on the specified machine. + /// The target machine. + /// An array of process infos, one per found process. + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public static ProcessInfo[] GetProcessInfos(string machineName) + { + throw new PlatformNotSupportedException(); + } + + /// Gets an array of module infos for the specified process. + /// The ID of the process whose modules should be enumerated. + /// The array of modules. + internal static ProcessModuleCollection GetModules(int processId) + { + return new ProcessModuleCollection(0); + } + + private static ProcessInfo CreateProcessInfo(int pid) + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs new file mode 100644 index 00000000000000..8faa430900aabf --- /dev/null +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessThread.iOS.cs @@ -0,0 +1,56 @@ +// 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.Versioning; + +namespace System.Diagnostics +{ + public partial class ProcessThread + { + /// + /// Returns or sets the priority level of the associated thread. The priority level is + /// not an absolute level, but instead contributes to the actual thread priority by + /// considering the priority class of the process. + /// + private ThreadPriorityLevel PriorityLevelCore + { + get { throw new PlatformNotSupportedException(); } + set { throw new PlatformNotSupportedException(); } + } + + /// + /// Returns the amount of time the thread has spent running code inside the operating + /// system core. + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan PrivilegedProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + private DateTime GetStartTime() => throw new PlatformNotSupportedException(); + /// + /// Returns the amount of time the associated thread has spent utilizing the CPU. + /// It is the sum of the System.Diagnostics.ProcessThread.UserProcessorTime and + /// System.Diagnostics.ProcessThread.PrivilegedProcessorTime. + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan TotalProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + + /// + /// Returns the amount of time the associated thread has spent running code + /// inside the application (not the operating system core). + /// + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + public TimeSpan UserProcessorTime + { + get { throw new PlatformNotSupportedException(); } + } + } +} diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ThreadInfo.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ThreadInfo.cs index c12c143e5a53a1..1205e732e67328 100644 --- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ThreadInfo.cs +++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ThreadInfo.cs @@ -12,6 +12,7 @@ namespace System.Diagnostics /// internal sealed class ThreadInfo { +#pragma warning disable CS0649 // The fields are unused on iOS/tvOS as the respective managed logic (mostly around libproc) is excluded. internal ulong _threadId; internal int _processId; internal int _basePriority; @@ -19,5 +20,6 @@ internal sealed class ThreadInfo internal IntPtr _startAddress; internal ThreadState _threadState; internal ThreadWaitReason _threadWaitReason; +#pragma warning restore CS0649 } } diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs index 33f84717da7198..fd4e9d2751753f 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs @@ -10,6 +10,7 @@ namespace System.Diagnostics.Tests public partial class ProcessModuleTests : ProcessTestBase { [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestModuleProperties() { ProcessModuleCollection modules = Process.GetCurrentProcess().Modules; @@ -29,6 +30,7 @@ public void TestModuleProperties() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void Modules_Get_ContainsHostFileName() { ProcessModuleCollection modules = Process.GetCurrentProcess().Modules; diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs index 38062773cb3671..6f304b08989f55 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs @@ -1318,7 +1318,7 @@ private void VerifyNotepadMainWindowTitle(Process process, string filename) string expected = Path.GetFileNameWithoutExtension(filename); process.WaitForInputIdle(); // Give the file a chance to load - Assert.Equal("notepad", process.ProcessName); + Assert.Equal("notepad", process.ProcessName.ToLower()); // Notepad calls CreateWindowEx with pWindowName of empty string, then calls SetWindowTextW // with "Untitled - Notepad" then finally if you're opening a file, calls SetWindowTextW diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs index 63d7f3d6d02b3c..e27e143f75b642 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs @@ -78,6 +78,7 @@ public void ProcessStart_UseShellExecute_OnLinux_ThrowsIfNoProgramInstalled() [Fact] [OuterLoop("Opens program")] + [SkipOnPlatform(TestPlatforms.MacCatalyst, "In App Sandbox mode, the process doesn't have read access to the binary.")] public void ProcessStart_DirectoryNameInCurDirectorySameAsFileNameInExecDirectory_Success() { string fileToOpen = "dotnet"; @@ -157,8 +158,8 @@ public void ProcessStart_UseShellExecute_OnUnix_SuccessWhenProgramInstalled(bool } [Fact] - [SkipOnPlatform(TestPlatforms.OSX, "On OSX, ProcessName returns the script interpreter.")] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS, MacCatalyst, or tvOS.")] + [SkipOnPlatform(TestPlatforms.OSX | TestPlatforms.MacCatalyst, "On OSX, ProcessName returns the script interpreter.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS or tvOS.")] public void ProcessNameMatchesScriptName() { string scriptName = GetTestFileName(); @@ -379,7 +380,7 @@ public void ProcessStart_OnLinux_UsesSpecifiedProgramUsingArgumentList() } [Theory, InlineData("/usr/bin/open"), InlineData("/usr/bin/nano")] - [PlatformSpecific(TestPlatforms.OSX)] + [PlatformSpecific(TestPlatforms.OSX | TestPlatforms.MacCatalyst)] [OuterLoop("Opens program")] public void ProcessStart_OpenFileOnOsx_UsesSpecifiedProgram(string programToOpenWith) { @@ -396,7 +397,7 @@ public void ProcessStart_OpenFileOnOsx_UsesSpecifiedProgram(string programToOpen } [Theory, InlineData("Safari"), InlineData("\"Google Chrome\"")] - [PlatformSpecific(TestPlatforms.OSX)] + [PlatformSpecific(TestPlatforms.OSX | TestPlatforms.MacCatalyst)] [OuterLoop("Opens browser")] public void ProcessStart_OpenUrl_UsesSpecifiedApplication(string applicationToOpenWith) { @@ -410,7 +411,7 @@ public void ProcessStart_OpenUrl_UsesSpecifiedApplication(string applicationToOp } [Theory, InlineData("-a Safari"), InlineData("-a \"Google Chrome\"")] - [PlatformSpecific(TestPlatforms.OSX)] + [PlatformSpecific(TestPlatforms.OSX | TestPlatforms.MacCatalyst)] [OuterLoop("Opens browser")] public void ProcessStart_UseShellExecuteTrue_OpenUrl_SuccessfullyReadsArgument(string arguments) { @@ -432,7 +433,7 @@ public void ProcessStart_UseShellExecuteTrue_OpenUrl_SuccessfullyReadsArgument(s [Theory, MemberData(nameof(StartOSXProcessWithArgumentList))] - [PlatformSpecific(TestPlatforms.OSX)] + [PlatformSpecific(TestPlatforms.OSX | TestPlatforms.MacCatalyst)] [OuterLoop("Opens browser")] public void ProcessStart_UseShellExecuteTrue_OpenUrl_SuccessfullyReadsArgumentArray(string[] argumentList) { @@ -502,7 +503,7 @@ public void TestBasePriorityOnUnix() } [Fact] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS, MacCatalyst, or tvOS.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS or tvOS.")] public void TestStartOnUnixWithBadPermissions() { string path = GetTestFilePath(); @@ -514,7 +515,7 @@ public void TestStartOnUnixWithBadPermissions() } [Fact] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS, MacCatalyst, or tvOS.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS or tvOS.")] public void TestStartOnUnixWithBadFormat() { string path = GetTestFilePath(); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs index 880da43a646539..e49dd958395d11 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs @@ -171,28 +171,28 @@ public void TestExited_SynchronizingObject(bool invokeRequired) } [Fact] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Not supported on iOS, tvOS, or MacCatalyst.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void ProcessStart_TryExitCommandAsFileName_ThrowsWin32Exception() { Assert.Throws(() => Process.Start(new ProcessStartInfo { UseShellExecute = false, FileName = "exit", Arguments = "42" })); } [Fact] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Not supported on iOS, tvOS, or MacCatalyst.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void ProcessStart_UseShellExecuteFalse_FilenameIsUrl_ThrowsWin32Exception() { Assert.Throws(() => Process.Start(new ProcessStartInfo { UseShellExecute = false, FileName = "https://www.github.com/corefx" })); } [Fact] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Not supported on iOS, tvOS, or MacCatalyst.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void ProcessStart_TryOpenFolder_UseShellExecuteIsFalse_ThrowsWin32Exception() { Assert.Throws(() => Process.Start(new ProcessStartInfo { UseShellExecute = false, FileName = Path.GetTempPath() })); } [Fact] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Not supported on iOS, tvOS, or MacCatalyst.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void TestStartWithBadWorkingDirectory() { string program; @@ -230,7 +230,7 @@ public void TestStartWithBadWorkingDirectory() [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasWindowsShell))] [OuterLoop("Launches File Explorer")] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Not supported on iOS, tvOS, or MacCatalyst.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void ProcessStart_UseShellExecute_OnWindows_OpenMissingFile_Throws() { string fileToOpen = Path.Combine(Environment.CurrentDirectory, "_no_such_file.TXT"); @@ -243,7 +243,7 @@ public void ProcessStart_UseShellExecute_OnWindows_OpenMissingFile_Throws() [InlineData(true)] [InlineData(false)] [OuterLoop("Launches File Explorer")] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Not supported on iOS, tvOS, or MacCatalyst.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void ProcessStart_UseShellExecute_OnWindows_DoesNotThrow(bool isFolder) { string fileToOpen; @@ -267,21 +267,27 @@ public void ProcessStart_UseShellExecute_OnWindows_DoesNotThrow(bool isFolder) { if (px != null) // sometimes process is null { - Assert.Equal("notepad", px.ProcessName); - - px.Kill(); - Assert.True(px.WaitForExit(WaitInMS)); - px.WaitForExit(); // wait for event handlers to complete + try + { + Assert.Equal("notepad", px.ProcessName.ToLower()); + } + finally + { + px.Kill(); + Assert.True(px.WaitForExit(WaitInMS)); + px.WaitForExit(); // wait for event handlers to complete + } } } } } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsServerCore), - nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotWindowsIoTCore))] + nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotWindowsIoTCore), + nameof(PlatformDetection.IsNotAppSandbox))] [ActiveIssue("https://github.com/dotnet/runtime/issues/34685", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] [InlineData(true), InlineData(false)] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS, MacCatalyst, or tvOS.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void ProcessStart_UseShellExecute_Executes(bool filenameAsUrl) { string filename = WriteScriptFile(TestDirectory, GetTestFileName(), returnValue: 42); @@ -304,7 +310,9 @@ public void ProcessStart_UseShellExecute_Executes(bool filenameAsUrl) PlatformDetection.IsNotWindowsIoTCore && RemoteExecutor.IsSupported; - [ConditionalFact(nameof(UseShellExecuteExecuteOrderIsRunnablePlatform))] + private static bool IsNotAppSandbox => PlatformDetection.IsNotAppSandbox; + + [ConditionalFact(nameof(UseShellExecuteExecuteOrderIsRunnablePlatform), nameof(IsNotAppSandbox))] [ActiveIssue("https://github.com/dotnet/runtime/issues/34685", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public void ProcessStart_UseShellExecute_ExecuteOrder() { @@ -348,9 +356,10 @@ public void ProcessStart_UseShellExecute_ExecuteOrder() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsServerCore), - nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotWindowsIoTCore))] + nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotWindowsIoTCore), + nameof(PlatformDetection.IsNotAppSandbox))] [ActiveIssue("https://github.com/dotnet/runtime/issues/34685", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS, MacCatalyst, or tvOS.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void ProcessStart_UseShellExecute_WorkingDirectory() { // Create a directory that will ProcessStartInfo.WorkingDirectory @@ -414,6 +423,7 @@ public void TestExitTime() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void StartTime_GetNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -501,7 +511,7 @@ public void HasExited_GetNotStarted_ThrowsInvalidOperationException() } [Fact] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst, "Not supported on iOS, tvOS, or MacCatalyst.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void Kill_NotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -525,6 +535,7 @@ public void MachineName_GetNotStarted_ThrowsInvalidOperationException() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestMainModule() { Process p = Process.GetCurrentProcess(); @@ -742,7 +753,25 @@ public void TestPeakWorkingSet64() { CreateDefaultProcess(); - AssertNonZeroAllZeroDarwin(_process.PeakWorkingSet64); + if (OperatingSystem.IsMacOS()) + { + Assert.Equal(0, _process.PeakWorkingSet64); + return; + } + + // On recent Linux kernels (6.2+) working set can be zero just after the process started. + ExecuteWithRetryOnLinux(() => + { + try + { + Assert.NotEqual(0, _process.PeakWorkingSet64); + } + catch + { + _process.Refresh(); + throw; + } + }); } [Fact] @@ -795,7 +824,19 @@ public void TestWorkingSet64() return; } - Assert.InRange(_process.WorkingSet64, 1, long.MaxValue); + // On recent Linux kernels (6.2+) working set can be zero just after the process started. + ExecuteWithRetryOnLinux(() => + { + try + { + Assert.InRange(_process.WorkingSet64, 1, long.MaxValue); + } + catch + { + _process.Refresh(); + throw; + } + }); } [Fact] @@ -854,6 +895,7 @@ public void TotalProcessorTime_PerformLoop_TotalProcessorTimeValid() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void UserProcessorTime_GetNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -861,6 +903,7 @@ public void UserProcessorTime_GetNotStarted_ThrowsInvalidOperationException() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void PriviledgedProcessorTime_GetNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -868,6 +911,7 @@ public void PriviledgedProcessorTime_GetNotStarted_ThrowsInvalidOperationExcepti } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TotalProcessorTime_GetNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -1105,19 +1149,20 @@ public void TestGetProcessById() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestGetProcesses() { Process currentProcess = Process.GetCurrentProcess(); // Get all the processes running on the machine, and check if the current process is one of them. var foundCurrentProcess = (from p in Process.GetProcesses() - where (p.Id == currentProcess.Id) && (p.ProcessName.Equals(currentProcess.ProcessName)) + where (p.Id == currentProcess.Id) && (p.ProcessName.Equals(currentProcess.ProcessName)) && (p.StartTime == currentProcess.StartTime) select p).Any(); Assert.True(foundCurrentProcess, "TestGetProcesses001 failed"); foundCurrentProcess = (from p in Process.GetProcesses(currentProcess.MachineName) - where (p.Id == currentProcess.Id) && (p.ProcessName.Equals(currentProcess.ProcessName)) + where (p.Id == currentProcess.Id) && (p.ProcessName.Equals(currentProcess.ProcessName)) && (p.StartTime == currentProcess.StartTime) select p).Any(); Assert.True(foundCurrentProcess, "TestGetProcesses002 failed"); @@ -1170,6 +1215,7 @@ public void GetProcesses_RemoteMachinePath_ReturnsExpected() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_ProcessName_ReturnsExpected() { // Get the current process using its name @@ -1229,6 +1275,7 @@ public static IEnumerable MachineName_Remote_TestData() [Theory] [MemberData(nameof(MachineName_TestData))] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_ProcessNameMachineName_ReturnsExpected(string machineName) { Process currentProcess = Process.GetCurrentProcess(); @@ -1255,6 +1302,7 @@ public void GetProcessesByName_RemoteMachineNameWindows_ReturnsExpected(string m } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_NoSuchProcess_ReturnsEmpty() { string processName = Guid.NewGuid().ToString("N"); @@ -1262,6 +1310,7 @@ public void GetProcessesByName_NoSuchProcess_ReturnsEmpty() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_NullMachineName_ThrowsArgumentNullException() { Process currentProcess = Process.GetCurrentProcess(); @@ -1269,6 +1318,7 @@ public void GetProcessesByName_NullMachineName_ThrowsArgumentNullException() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void GetProcessesByName_EmptyMachineName_ThrowsArgumentException() { Process currentProcess = Process.GetCurrentProcess(); @@ -1331,6 +1381,7 @@ public void StartInfo_SetOnRunningProcess_ThrowsInvalidOperationException() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void StartInfo_SetGet_ReturnsExpected() { var process = new Process() { StartInfo = new ProcessStartInfo(RemoteExecutor.HostRunner) }; @@ -1407,7 +1458,7 @@ public void CanBeFinalized() [Theory] [InlineData(false)] [InlineData(true)] - [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS, MacCatalyst, or tvOS.")] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS and tvOS.")] public void TestStartWithMissingFile(bool fullPath) { string path = Guid.NewGuid().ToString("N"); @@ -1715,6 +1766,7 @@ public void MainWindowTitle_GetWithGui_ShouldRefresh_Windows() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void RefreshResetsAllRefreshableFields() { // testing Process.Responding using a real unresponsive process would be very hard to do properly @@ -1946,9 +1998,29 @@ public void TestPeakWorkingSet() { CreateDefaultProcess(); + if (OperatingSystem.IsMacOS()) + { #pragma warning disable 0618 - AssertNonZeroAllZeroDarwin(_process.PeakWorkingSet); + Assert.Equal(0, _process.PeakWorkingSet); #pragma warning restore 0618 + return; + } + + // On recent Linux kernels (6.2+) working set can be zero just after the process started. + ExecuteWithRetryOnLinux(() => + { + try + { +#pragma warning disable 0618 + Assert.NotEqual(0, _process.PeakWorkingSet); +#pragma warning restore 0618 + } + catch + { + _process.Refresh(); + throw; + } + }); } [Fact] @@ -2012,9 +2084,21 @@ public void TestWorkingSet() return; } + // On recent Linux kernels (6.2+) working set can be zero just after the process started. + ExecuteWithRetryOnLinux(() => + { + try + { #pragma warning disable 0618 - Assert.InRange(_process.WorkingSet, 1, int.MaxValue); + Assert.InRange(_process.WorkingSet, 1, int.MaxValue); #pragma warning restore 0618 + } + catch + { + _process.Refresh(); + throw; + } + }); } [Fact] @@ -2271,6 +2355,7 @@ public void BothArgumentSetAndArgumentListSet() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void Kill_EntireProcessTree_True_ProcessNotStarted_ThrowsInvalidOperationException() { var process = new Process(); @@ -2300,6 +2385,7 @@ public void Kill_EntireProcessTree_True_CalledByNonLocalProcess_ThrowsInvalidOpe } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void Kill_EntireProcessTree_True_CalledOnCallingProcess_ThrowsInvalidOperationException() { var process = Process.GetCurrentProcess(); @@ -2563,5 +2649,17 @@ private SecureString AsSecureString(string str) return secureString; } + + private static void ExecuteWithRetryOnLinux(Action test) + { + if (OperatingSystem.IsLinux()) + { + RetryHelper.Execute(test, retryWhen: ex => ex is XunitException); + } + else + { + test(); + } + } } } diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs index 2266582ac5190f..6db4fd1a2cdeea 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessThreadTests.cs @@ -46,6 +46,7 @@ public void TestCommonPriorityAndTimeProperties() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestThreadCount() { int numOfThreads = 10; @@ -161,6 +162,7 @@ await Task.Factory.StartNew(() => } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public void TestStartAddressProperty() { using (Process p = Process.GetCurrentProcess()) diff --git a/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs b/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs index b3cb0bdb3b33e1..7ffb3a29459d05 100644 --- a/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs +++ b/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs @@ -52,6 +52,7 @@ public StackTrace(int skipFrames, bool fNeedFileInfo) { } } namespace System.Diagnostics.SymbolStore { +#if !BUILDING_CORELIB_REFERENCE public partial interface ISymbolBinder { [System.ObsoleteAttribute("ISymbolBinder.GetReader has been deprecated because it is not 64-bit compatible. Use ISymbolBinder1.GetReader instead. ISymbolBinder1.GetReader accepts the importer interface pointer as an IntPtr instead of an Int32, and thus works on both 32-bit and 64-bit architectures.")] @@ -74,11 +75,13 @@ public partial interface ISymbolDocument byte[] GetCheckSum(); byte[] GetSourceRange(int startLine, int startColumn, int endLine, int endColumn); } +#endif public partial interface ISymbolDocumentWriter { void SetCheckSum(System.Guid algorithmId, byte[] checkSum); void SetSource(byte[] source); } +#if !BUILDING_CORELIB_REFERENCE public partial interface ISymbolMethod { System.Diagnostics.SymbolStore.ISymbolScope RootScope { get; } @@ -205,4 +208,5 @@ public partial class SymLanguageVendor public static readonly System.Guid Microsoft; public SymLanguageVendor() { } } +#endif } diff --git a/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs b/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs index 418e7b04d952f0..d00e72ce7c12b7 100644 --- a/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs +++ b/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs @@ -12,6 +12,7 @@ namespace System.Diagnostics.TextWriterTraceListenerTests { + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] public class XmlWriterTraceListenerTests : FileCleanupTestBase { private readonly string _processName; diff --git a/src/libraries/System.Diagnostics.TraceSource/ref/System.Diagnostics.TraceSource.cs b/src/libraries/System.Diagnostics.TraceSource/ref/System.Diagnostics.TraceSource.cs index 62e82e3e09c3b1..e57585e4d8fd7f 100644 --- a/src/libraries/System.Diagnostics.TraceSource/ref/System.Diagnostics.TraceSource.cs +++ b/src/libraries/System.Diagnostics.TraceSource/ref/System.Diagnostics.TraceSource.cs @@ -69,7 +69,7 @@ protected override void OnValueChanged() { } public abstract partial class Switch { protected Switch(string displayName, string? description) { } - protected Switch(string displayName, string? description, string? defaultSwitchValue) { } + protected Switch(string displayName, string? description, string defaultSwitchValue) { } public System.Collections.Specialized.StringDictionary Attributes { get { throw null; } } public string Description { get { throw null; } } public string DisplayName { get { throw null; } } diff --git a/src/libraries/System.Diagnostics.TraceSource/src/System/Diagnostics/Switch.cs b/src/libraries/System.Diagnostics.TraceSource/src/System/Diagnostics/Switch.cs index 23b40732ea4b5a..583d4cc1c8a050 100644 --- a/src/libraries/System.Diagnostics.TraceSource/src/System/Diagnostics/Switch.cs +++ b/src/libraries/System.Diagnostics.TraceSource/src/System/Diagnostics/Switch.cs @@ -24,7 +24,7 @@ public abstract class Switch private volatile bool _initialized; private bool _initializing; private volatile string _switchValueString = string.Empty; - private readonly string? _defaultValue; + private readonly string _defaultValue; private object? _initializedLock; private static readonly List> s_switches = new List>(); @@ -53,7 +53,7 @@ protected Switch(string displayName, string? description) : this(displayName, de { } - protected Switch(string displayName, string? description, string? defaultSwitchValue) + protected Switch(string displayName, string? description, string defaultSwitchValue) { // displayName is used as a hashtable key, so it can never // be null. @@ -203,7 +203,7 @@ private bool InitializeWithStatus() // called again, we don't want to get caught in an infinite loop. _initializing = true; - _switchValueString = _defaultValue!; + _switchValueString = _defaultValue; OnValueChanged(); _initialized = true; _initializing = false; diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.cs index d7c7046ab693ed..97470a2ff4450e 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.cs @@ -452,6 +452,7 @@ public void Test_EventSourceCreatedEvents_AfterListener() [Theory] [InlineData(true)] [InlineData(false)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/51382", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void Test_EventListenerThrows_ExceptionIsNotRethrownToCaller(bool setThrowOnEventWriteErrorsFlag) { TestUtilities.CheckNoEventSourcesRunning("Start"); diff --git a/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.props b/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.props index 4cf151da3064fc..de81d80c303d7d 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.props +++ b/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.props @@ -1,10 +1,6 @@  - - 4.0.0.0 ECMA windows diff --git a/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.targets b/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.targets new file mode 100644 index 00000000000000..e8aeeb47a8da9c --- /dev/null +++ b/src/libraries/System.DirectoryServices.AccountManagement/Directory.Build.targets @@ -0,0 +1,8 @@ + + + + + 4.0.0.0 + + diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj b/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj index b994abfb5ee24b..907f821fc3b7cf 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj +++ b/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj @@ -6,6 +6,9 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0 $(NoWarn);CA2249 true + + false + 0 true true Provides uniform access and manipulation of user, computer, and group security principals across the multiple principal stores: Active Directory Domain Services (AD DS), Active Directory Lightweight Directory Services (AD LDS), and Machine SAM (MSAM). @@ -97,10 +100,10 @@ - + @@ -115,7 +118,6 @@ - diff --git a/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props b/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props index 525d9a0d12ab6f..831e8089e2459c 100644 --- a/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props +++ b/src/libraries/System.DirectoryServices.Protocols/Directory.Build.props @@ -1,10 +1,6 @@  - - 4.0.0.0 Microsoft true browser;android;ios;tvos diff --git a/src/libraries/System.DirectoryServices.Protocols/Directory.Build.targets b/src/libraries/System.DirectoryServices.Protocols/Directory.Build.targets new file mode 100644 index 00000000000000..69fc811d007beb --- /dev/null +++ b/src/libraries/System.DirectoryServices.Protocols/Directory.Build.targets @@ -0,0 +1,10 @@ + + + + + 4.0.0.0 + + diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj index d317292d1144a0..3589676cda4d52 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj +++ b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj @@ -1,9 +1,12 @@ - + true true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1-OSX;netcoreapp3.1-Linux;netcoreapp3.1;netstandard2.0 true + + false + 2 true true Provides the methods defined in the Lightweight Directory Access Protocol (LDAP) version 3 (V3) and Directory Services Markup Language (DSML) version 2.0 (V2) standards. @@ -67,7 +70,11 @@ + + + Common\System\LocalAppContextSwitches.Common.cs + Common\Interop\Linux\OpenLdap\Interop.Ldap.cs diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/LdapPal.Linux.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/LdapPal.Linux.cs index 701fae26108282..a2619871edecb4 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/LdapPal.Linux.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/LdapPal.Linux.cs @@ -111,7 +111,7 @@ internal static int BindToDirectory(ConnectionHandle ld, string who, string pass passwordPtr = LdapPal.StringToPtr(passwd); berval passwordBerval = new berval { - bv_len = passwd.Length, + bv_len = passwd?.Length ?? 0, bv_val = passwordPtr, }; @@ -123,7 +123,31 @@ internal static int BindToDirectory(ConnectionHandle ld, string who, string pass } } - internal static int StartTls(ConnectionHandle ldapHandle, ref int ServerReturnValue, ref IntPtr Message, IntPtr ServerControls, IntPtr ClientControls) => Interop.Ldap.ldap_start_tls(ldapHandle, ref ServerReturnValue, ref Message, ServerControls, ClientControls); + internal static int StartTls(ConnectionHandle ldapHandle, ref int serverReturnValue, ref IntPtr message, IntPtr serverControls, IntPtr clientControls) + { + // Windows and Linux have different signatures for ldap_start_tls_s. + // On Linux, we don't have a serverReturnValue or the message/result parameter. + // + // So in the PAL here, just emulate. + + int error = Interop.Ldap.ldap_start_tls(ldapHandle, serverControls, clientControls); + + // On Windows, serverReturnValue only has meaning if the result code is LDAP_OTHER. + // If OpenLDAP returns that, we don't have a better code, so assign that through. + // If we get any other error, assign serverReturnValue to 0 since it shouldn't be read. + if (error == (int)ResultCode.Other) + { + serverReturnValue = error; + } + else + { + serverReturnValue = 0; + } + + // We don't have a referrer/message/result value, so just set it to NULL. + message = IntPtr.Zero; + return error; + } // openldap doesn't have a ldap_stop_tls function. Returning true as no-op for Linux. internal static byte StopTls(ConnectionHandle ldapHandle) => 1; diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Linux.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Linux.cs index 2383e816e1ddb6..a7e43947e20314 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Linux.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Linux.cs @@ -16,6 +16,13 @@ public ConnectionHandle() _needDispose = true; } + internal ConnectionHandle(string uri) + :base(true) + { + Interop.Ldap.ldap_initialize(out handle, uri); + _needDispose = true; + } + internal ConnectionHandle(IntPtr value, bool disposeHandle) : base(true) { _needDispose = disposeHandle; diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.Linux.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.Linux.cs index 02c8f0c239587b..6adf1ebac982cd 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.Linux.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.Linux.cs @@ -20,7 +20,7 @@ private void InternalInitConnectionHandle(string hostname) throw new NullReferenceException(); } - _ldapHandle = new ConnectionHandle(); + _ldapHandle = new ConnectionHandle($"ldap://{hostname}:{((LdapDirectoryIdentifier)_directoryIdentifier).PortNumber}"); } private int InternalConnectToServer() @@ -79,13 +79,39 @@ private int InternalConnectToServer() private int InternalBind(NetworkCredential tempCredential, SEC_WINNT_AUTH_IDENTITY_EX cred, BindMethod method) { int error; - if (tempCredential == null && (AuthType == AuthType.External || AuthType == AuthType.Kerberos)) + + if (LocalAppContextSwitches.UseBasicAuthFallback) { - error = BindSasl(); + if (tempCredential == null && (AuthType == AuthType.External || AuthType == AuthType.Kerberos)) + { + error = BindSasl(); + } + else + { + error = LdapPal.BindToDirectory(_ldapHandle, cred.user, cred.password); + } } else { - error = LdapPal.BindToDirectory(_ldapHandle, cred.user, cred.password); + if (method == BindMethod.LDAP_AUTH_NEGOTIATE) + { + if (tempCredential == null) + { + error = BindSasl(); + } + else + { + // Explicit credentials were provided. If we call ldap_bind_s it will + // return LDAP_NOT_SUPPORTED, so just skip the P/Invoke. + error = (int)LdapError.NotSupported; + } + } + else + { + // Basic and Anonymous are handled elsewhere. + Debug.Assert(AuthType != AuthType.Anonymous && AuthType != AuthType.Basic); + error = (int)LdapError.AuthUnknown; + } } return error; diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs index 5b28020eed2fd2..9a200fc5ba218b 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs @@ -641,11 +641,14 @@ public unsafe void StartTransportLayerSecurity(DirectoryControlCollection contro response.ResponseName = "1.3.6.1.4.1.1466.20037"; throw new TlsOperationException(response); } - else if (LdapErrorMappings.IsLdapError(error)) + + if (LdapErrorMappings.IsLdapError(error)) { string errorMessage = LdapErrorMappings.MapResultCode(error); throw new LdapException(error, errorMessage); } + + throw new LdapException(error); } } finally diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LocalAppContextSwitches.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LocalAppContextSwitches.cs new file mode 100644 index 00000000000000..59ddfdf7f10ed3 --- /dev/null +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LocalAppContextSwitches.cs @@ -0,0 +1,18 @@ +// 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.CompilerServices; + +namespace System +{ + internal static partial class LocalAppContextSwitches + { + private static int s_useBasicAuthFallback; + + public static bool UseBasicAuthFallback + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => GetCachedSwitchValue("System.DirectoryServices.Protocols.UseBasicAuthFallback", ref s_useBasicAuthFallback); + } + } +} diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/LdapConnectionTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/LdapConnectionTests.cs index 9a8074bf5222ad..a0522a61abc182 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/LdapConnectionTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/LdapConnectionTests.cs @@ -112,6 +112,16 @@ public void AuthType_SetValid_GetReturnsExpected() Assert.Equal(AuthType.Basic, connection.AuthType); } + [Fact] + public void AuthType_Anonymous_DoesNotThrowNull() + { + var connection = new LdapConnection("server"); + connection.AuthType = AuthType.Anonymous; + // When calling Bind we make sure that the exception thrown is not that there was a NullReferenceException + // trying to retrive a null password's lenght, but instead an LdapException given the server cannot be reached. + Assert.Throws(() => connection.Bind()); + } + [Theory] [InlineData(AuthType.Anonymous - 1)] [InlineData(AuthType.Kerberos + 1)] diff --git a/src/libraries/System.DirectoryServices/Directory.Build.props b/src/libraries/System.DirectoryServices/Directory.Build.props index bfa544ca6f649e..7b8070be7d21e6 100644 --- a/src/libraries/System.DirectoryServices/Directory.Build.props +++ b/src/libraries/System.DirectoryServices/Directory.Build.props @@ -1,10 +1,9 @@  - - 4.0.0.0 + + true Microsoft windows diff --git a/src/libraries/System.DirectoryServices/Directory.Build.targets b/src/libraries/System.DirectoryServices/Directory.Build.targets new file mode 100644 index 00000000000000..e8aeeb47a8da9c --- /dev/null +++ b/src/libraries/System.DirectoryServices/Directory.Build.targets @@ -0,0 +1,8 @@ + + + + + 4.0.0.0 + + diff --git a/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.csproj b/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.csproj index a8259f7fffe83c..0da0155f6eaed4 100644 --- a/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.csproj +++ b/src/libraries/System.DirectoryServices/ref/System.DirectoryServices.csproj @@ -9,6 +9,7 @@ + @@ -16,7 +17,6 @@ - diff --git a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj index 6cbf2240119c76..d11b153aaf7f42 100644 --- a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj +++ b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj @@ -5,6 +5,9 @@ true enable true + + false + 1 true true Provides easy access to Active Directory Domain Services. @@ -156,11 +159,11 @@ System.DirectoryServices.ActiveDirectory.DomainController + - @@ -183,7 +186,6 @@ System.DirectoryServices.ActiveDirectory.DomainController - diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs index 619714bd477f49..def9e2a512a0a9 100644 --- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs +++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs @@ -618,6 +618,8 @@ public DirectoryVirtualListView? VirtualListView private SearchResultCollection FindAll(bool findMoreThanOne) { + searchResult = null; + DirectoryEntry clonedRoot = SearchRoot!.CloneBrowsable(); UnsafeNativeMethods.IAds adsObject = clonedRoot.AdsObject; @@ -661,7 +663,9 @@ private SearchResultCollection FindAll(bool findMoreThanOne) properties = Array.Empty(); } - return new SearchResultCollection(clonedRoot, resultsHandle, properties, this); + SearchResultCollection result = new SearchResultCollection(clonedRoot, resultsHandle, properties, this); + searchResult = result; + return result; } private unsafe void SetSearchPreferences(UnsafeNativeMethods.IDirectorySearch adsSearch, bool findMoreThanOne) diff --git a/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.cs b/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.cs index 2a6e2a49ef3636..ba1d25352fc237 100644 --- a/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.cs +++ b/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.cs @@ -596,12 +596,16 @@ public void Flush(System.Drawing.Drawing2D.FlushIntention intention) { } public static System.Drawing.Graphics FromImage(System.Drawing.Image image) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] +#if NETCOREAPP3_1_OR_GREATER [System.ObsoleteAttribute("Use the Graphics.GetContextInfo overloads that accept arguments for better performance and fewer allocations.", DiagnosticId = "SYSLIB0016", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] +#endif public object GetContextInfo() { throw null; } +#if NETCOREAPP3_1_OR_GREATER [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public void GetContextInfo(out PointF offset) { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public void GetContextInfo(out PointF offset, out Region? clip) { throw null; } +#endif public static System.IntPtr GetHalftonePalette() { throw null; } public System.IntPtr GetHdc() { throw null; } public System.Drawing.Color GetNearestColor(System.Drawing.Color color) { throw null; } diff --git a/src/libraries/System.Drawing.Common/src/CompatibilitySuppressions.xml b/src/libraries/System.Drawing.Common/src/CompatibilitySuppressions.xml index a7e39a278823c2..a623413023f20d 100644 --- a/src/libraries/System.Drawing.Common/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Drawing.Common/src/CompatibilitySuppressions.xml @@ -2,19 +2,56 @@ CP0001 + T:System.Drawing.FontConverter lib/netstandard2.0/System.Drawing.Common.dll lib/net461/System.Drawing.Common.dll CP0001 - T:System.Drawing.ColorTranslator + T:System.Drawing.IconConverter lib/netstandard2.0/System.Drawing.Common.dll - lib/netcoreapp3.1/System.Drawing.Common.dll + lib/net461/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.ImageConverter + lib/netstandard2.0/System.Drawing.Common.dll + lib/net461/System.Drawing.Common.dll + + + CP0001 + T:System.Drawing.ImageFormatConverter + lib/netstandard2.0/System.Drawing.Common.dll + lib/net461/System.Drawing.Common.dll CP0001 - T:System.Drawing.SystemColors + T:System.Drawing.Printing.MarginsConverter + lib/netstandard2.0/System.Drawing.Common.dll + lib/net461/System.Drawing.Common.dll + + + CP0002 + F:System.Drawing.Imaging.Encoder.ColorSpace + lib/netstandard2.0/System.Drawing.Common.dll + lib/net461/System.Drawing.Common.dll + + + CP0002 + F:System.Drawing.Imaging.Encoder.ImageItems + lib/netstandard2.0/System.Drawing.Common.dll + lib/net461/System.Drawing.Common.dll + + + CP0002 + F:System.Drawing.Imaging.Encoder.SaveAsCmyk lib/netstandard2.0/System.Drawing.Common.dll - lib/netcoreapp3.1/System.Drawing.Common.dll + lib/net461/System.Drawing.Common.dll + + + CP0002 + F:System.Drawing.Imaging.EncoderParameterValueType.ValueTypePointer + lib/netstandard2.0/System.Drawing.Common.dll + lib/net461/System.Drawing.Common.dll \ No newline at end of file diff --git a/src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj b/src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj index 96003e63638f52..162cebc3d05aab 100644 --- a/src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj +++ b/src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj @@ -8,6 +8,9 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1-Unix;netcoreapp3.1;netstandard2.0;net461 enable true + + false + 0 true Provides access to GDI+ graphics functionality. diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Windows.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Windows.cs index 3edf4a0e7b67ec..dbe2888361346e 100644 --- a/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Windows.cs +++ b/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Windows.cs @@ -269,13 +269,13 @@ private static void PlatformInitialize() [DllImport(LibraryName, ExactSpelling = true)] internal static extern IntPtr GdipCreateHalftonePalette(); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawBeziers(HandleRef graphics, HandleRef pen, PointF* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawBeziersI(HandleRef graphics, HandleRef pen, Point* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillPath(HandleRef graphics, HandleRef brush, HandleRef path); [DllImport(LibraryName, ExactSpelling = true)] diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.cs index 18619993c0d1d3..c9539e24a38761 100644 --- a/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.cs +++ b/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.cs @@ -835,7 +835,7 @@ internal static unsafe partial class Gdip [DllImport(LibraryName, ExactSpelling = true)] internal static extern int GdipDeleteRegion(HandleRef region); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillRegion(HandleRef graphics, HandleRef brush, HandleRef region); [DllImport(LibraryName, ExactSpelling = true)] @@ -1183,127 +1183,127 @@ internal static unsafe partial class Gdip [DllImport(LibraryName, ExactSpelling = true)] internal static extern int GdipSaveGraphics(HandleRef graphics, out int state); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawArc(HandleRef graphics, HandleRef pen, float x, float y, float width, float height, float startAngle, float sweepAngle); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawArcI(HandleRef graphics, HandleRef pen, int x, int y, int width, int height, float startAngle, float sweepAngle); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawLinesI(HandleRef graphics, HandleRef pen, Point* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawBezier(HandleRef graphics, HandleRef pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawEllipse(HandleRef graphics, HandleRef pen, float x, float y, float width, float height); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawEllipseI(HandleRef graphics, HandleRef pen, int x, int y, int width, int height); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawLine(HandleRef graphics, HandleRef pen, float x1, float y1, float x2, float y2); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawLineI(HandleRef graphics, HandleRef pen, int x1, int y1, int x2, int y2); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawLines(HandleRef graphics, HandleRef pen, PointF* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawPath(HandleRef graphics, HandleRef pen, HandleRef path); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawPie(HandleRef graphics, HandleRef pen, float x, float y, float width, float height, float startAngle, float sweepAngle); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawPieI(HandleRef graphics, HandleRef pen, int x, int y, int width, int height, float startAngle, float sweepAngle); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawPolygon(HandleRef graphics, HandleRef pen, PointF* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawPolygonI(HandleRef graphics, HandleRef pen, Point* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillEllipse(HandleRef graphics, HandleRef brush, float x, float y, float width, float height); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillEllipseI(HandleRef graphics, HandleRef brush, int x, int y, int width, int height); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillPolygon(HandleRef graphics, HandleRef brush, PointF* points, int count, FillMode brushMode); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillPolygonI(HandleRef graphics, HandleRef brush, Point* points, int count, FillMode brushMode); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillRectangle(HandleRef graphics, HandleRef brush, float x, float y, float width, float height); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillRectangleI(HandleRef graphics, HandleRef brush, int x, int y, int width, int height); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillRectangles(HandleRef graphics, HandleRef brush, RectangleF* rects, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillRectanglesI(HandleRef graphics, HandleRef brush, Rectangle* rects, int count); - [DllImport(LibraryName, ExactSpelling = true, CharSet = CharSet.Unicode)] + [DllImport(LibraryName, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)] internal static extern int GdipDrawString(HandleRef graphics, string textString, int length, HandleRef font, ref RectangleF layoutRect, HandleRef stringFormat, HandleRef brush); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImageRectI(HandleRef graphics, HandleRef image, int x, int y, int width, int height); [DllImport(LibraryName, ExactSpelling = true)] internal static extern int GdipGraphicsClear(HandleRef graphics, int argb); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawClosedCurve(HandleRef graphics, HandleRef pen, PointF* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawClosedCurveI(HandleRef graphics, HandleRef pen, Point* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawClosedCurve2(HandleRef graphics, HandleRef pen, PointF* points, int count, float tension); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawClosedCurve2I(HandleRef graphics, HandleRef pen, Point* points, int count, float tension); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawCurve(HandleRef graphics, HandleRef pen, PointF* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawCurveI(HandleRef graphics, HandleRef pen, Point* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawCurve2(HandleRef graphics, HandleRef pen, PointF* points, int count, float tension); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawCurve2I(HandleRef graphics, HandleRef pen, Point* points, int count, float tension); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawCurve3(HandleRef graphics, HandleRef pen, PointF* points, int count, int offset, int numberOfSegments, float tension); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawCurve3I(HandleRef graphics, HandleRef pen, Point* points, int count, int offset, int numberOfSegments, float tension); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillClosedCurve(HandleRef graphics, HandleRef brush, PointF* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillClosedCurveI(HandleRef graphics, HandleRef brush, Point* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillClosedCurve2(HandleRef graphics, HandleRef brush, PointF* points, int count, float tension, FillMode mode); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillClosedCurve2I(HandleRef graphics, HandleRef brush, Point* points, int count, float tension, FillMode mode); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillPie(HandleRef graphics, HandleRef brush, float x, float y, float width, float height, float startAngle, float sweepAngle); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipFillPieI(HandleRef graphics, HandleRef brush, int x, int y, int width, int height, float startAngle, float sweepAngle); [DllImport(LibraryName, ExactSpelling = true, CharSet = CharSet.Unicode)] @@ -1312,49 +1312,49 @@ internal static unsafe partial class Gdip [DllImport(LibraryName, ExactSpelling = true, CharSet = CharSet.Unicode)] internal static extern int GdipMeasureCharacterRanges(HandleRef graphics, string textString, int length, HandleRef font, ref RectangleF layoutRect, HandleRef stringFormat, int characterCount, [In] [Out] IntPtr[] region); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImageI(HandleRef graphics, HandleRef image, int x, int y); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImage(HandleRef graphics, HandleRef image, float x, float y); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImagePoints(HandleRef graphics, HandleRef image, PointF* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImagePointsI(HandleRef graphics, HandleRef image, Point* points, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImageRectRectI(HandleRef graphics, HandleRef image, int dstx, int dsty, int dstwidth, int dstheight, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcunit, HandleRef imageAttributes, Graphics.DrawImageAbort? callback, HandleRef callbackdata); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImagePointsRect(HandleRef graphics, HandleRef image, PointF* points, int count, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcunit, HandleRef imageAttributes, Graphics.DrawImageAbort? callback, HandleRef callbackdata); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImageRectRect(HandleRef graphics, HandleRef image, float dstx, float dsty, float dstwidth, float dstheight, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcunit, HandleRef imageAttributes, Graphics.DrawImageAbort? callback, HandleRef callbackdata); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImagePointsRectI(HandleRef graphics, HandleRef image, Point* points, int count, int srcx, int srcy, int srcwidth, int srcheight, GraphicsUnit srcunit, HandleRef imageAttributes, Graphics.DrawImageAbort? callback, HandleRef callbackdata); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImageRect(HandleRef graphics, HandleRef image, float x, float y, float width, float height); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImagePointRect(HandleRef graphics, HandleRef image, float x, float y, float srcx, float srcy, float srcwidth, float srcheight, int srcunit); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawImagePointRectI(HandleRef graphics, HandleRef image, int x, int y, int srcx, int srcy, int srcwidth, int srcheight, int srcunit); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawRectangle(HandleRef graphics, HandleRef pen, float x, float y, float width, float height); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawRectangleI(HandleRef graphics, HandleRef pen, int x, int y, int width, int height); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawRectangles(HandleRef graphics, HandleRef pen, RectangleF* rects, int count); - [DllImport(LibraryName, ExactSpelling = true)] + [DllImport(LibraryName, ExactSpelling = true, SetLastError = true)] internal static extern int GdipDrawRectanglesI(HandleRef graphics, HandleRef pen, Rectangle* rects, int count); [DllImport(LibraryName, ExactSpelling = true)] diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.Unix.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.Unix.cs index cba7e4aab0a55e..4baa41dad24499 100644 --- a/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.Unix.cs +++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.Unix.cs @@ -583,6 +583,7 @@ public object GetContextInfo() throw new NotImplementedException(); } +#if NETCOREAPP3_1_OR_GREATER [EditorBrowsable(EditorBrowsableState.Never)] [SupportedOSPlatform("windows")] public void GetContextInfo(out PointF offset) @@ -596,6 +597,7 @@ public void GetContextInfo(out PointF offset, out Region? clip) { throw new PlatformNotSupportedException(); } +#endif private void CheckErrorStatus(int status) { diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.Windows.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.Windows.cs index 8dd2ad15b22d52..475e35a176ceac 100644 --- a/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.Windows.cs +++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.Windows.cs @@ -684,7 +684,9 @@ public unsafe void EnumerateMetafile( /// WARNING: This method is for internal FX support only. /// [EditorBrowsable(EditorBrowsableState.Never)] +#if NETCOREAPP3_1_OR_GREATER [Obsolete(Obsoletions.GetContextInfoMessage, DiagnosticId = Obsoletions.GetContextInfoDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] +#endif [SupportedOSPlatform("windows")] public object GetContextInfo() { @@ -763,6 +765,7 @@ private void GetContextInfo(out Matrix3x2 cumulativeTransform, bool calculateCli } } +#if NETCOREAPP3_1_OR_GREATER /// /// Gets the cumulative offset. /// @@ -789,6 +792,7 @@ public void GetContextInfo(out PointF offset, out Region? clip) Vector2 translation = cumulativeTransform.Translation; offset = new PointF(translation.X, translation.Y); } +#endif public RectangleF VisibleClipBounds { diff --git a/src/libraries/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs b/src/libraries/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs index 6257a8219199b0..1322bd6e81d08b 100644 --- a/src/libraries/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs +++ b/src/libraries/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs @@ -61,6 +61,7 @@ public static WindowsGraphics FromGraphics(Graphics g, ApplyGraphicsProperties p { Region? clip = null; +#if NETCOREAPP3_1_OR_GREATER if (properties.HasFlag(ApplyGraphicsProperties.Clipping)) { g.GetContextInfo(out offset, out clip); @@ -69,6 +70,21 @@ public static WindowsGraphics FromGraphics(Graphics g, ApplyGraphicsProperties p { g.GetContextInfo(out offset); } +#else + Matrix? worldTransf = null; + if (g.GetContextInfo() is object[] data && data.Length == 2) + { + if (properties.HasFlag(ApplyGraphicsProperties.Clipping)) + { + clip = data[0] as Region; + } + worldTransf = data[1] as Matrix; + if (worldTransf != null) + { + offset = worldTransf.Offset; + } + } +#endif if (clip is not null) { diff --git a/src/libraries/System.Drawing.Common/tests/PenTests.cs b/src/libraries/System.Drawing.Common/tests/PenTests.cs index 3b413bc0f0b9dd..b5f39c4483855c 100644 --- a/src/libraries/System.Drawing.Common/tests/PenTests.cs +++ b/src/libraries/System.Drawing.Common/tests/PenTests.cs @@ -46,6 +46,7 @@ public static IEnumerable Ctor_Brush_Width_TestData() yield return new object[] { new SolidBrush(Color.Red), float.MaxValue, PenType.SolidColor }; } + [ActiveIssue("https://github.com/dotnet/runtime/issues/60731", TestPlatforms.Windows)] [ConditionalTheory(Helpers.IsDrawingSupported)] [MemberData(nameof(Ctor_Brush_Width_TestData))] public void Ctor_Brush_Width(T brush, float width, PenType expectedPenType) where T : Brush @@ -96,6 +97,7 @@ public void Ctor_Color() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/60731", TestPlatforms.Windows)] [ConditionalTheory(Helpers.IsDrawingSupported)] [InlineData(-1)] [InlineData(0)] diff --git a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.basic.cs b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.basic.cs index 480f6200208d30..9c4eb3000ae8b6 100644 --- a/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.basic.cs +++ b/src/libraries/System.Dynamic.Runtime/tests/Dynamic.DynamicType/Conformance.dynamic.dynamicType.basic.cs @@ -3392,7 +3392,7 @@ public static int MainMethod(string[] args) } ; - if (d.GetType() != typeof(dynamic[])) + if (d.GetType() != typeof(object[])) return 1; return 0; } @@ -3420,7 +3420,7 @@ public static int MainMethod(string[] args) } ; - if (d.GetType() != typeof(dynamic[])) + if (d.GetType() != typeof(object[])) return 1; return 0; } @@ -3456,7 +3456,7 @@ public static int MainMethod(string[] args) } ; - if (d.GetType() != typeof(dynamic[])) + if (d.GetType() != typeof(object[])) return 1; return 0; } diff --git a/src/libraries/System.Formats.Asn1/src/Resources/Strings.resx b/src/libraries/System.Formats.Asn1/src/Resources/Strings.resx index 10571924b9d2e7..90918d9e4ef5c1 100644 --- a/src/libraries/System.Formats.Asn1/src/Resources/Strings.resx +++ b/src/libraries/System.Formats.Asn1/src/Resources/Strings.resx @@ -141,6 +141,9 @@ The encoded named bit list value is larger than the value size of the '{0}' enum. + + The encoded object identifier (OID) exceeds the limits supported by this library. Supported OIDs are limited to 64 arcs and each subidentifier is limited to a 128-bit value. + The encoded value uses a constructed encoding, which is invalid for '{0}' values. diff --git a/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj b/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj index 6c8a6d9ed36c5f..255d3755622049 100644 --- a/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj +++ b/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj @@ -4,6 +4,8 @@ enable $(NetCoreAppCurrent);netstandard2.0;net461 true + true + 1 Provides classes that can read and write the ASN.1 BER, CER, and DER data formats. Commonly Used Types: @@ -11,6 +13,9 @@ System.Formats.Asn1.AsnReader System.Formats.Asn1.AsnWriter + + Common\System\LocalAppContextSwitches.Common.cs + Common\System\Security\Cryptography\CryptoPool.cs @@ -48,6 +53,7 @@ System.Formats.Asn1.AsnWriter + diff --git a/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnDecoder.Oid.cs b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnDecoder.Oid.cs index 44106332bf015f..67c04b7f1351ef 100644 --- a/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnDecoder.Oid.cs +++ b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnDecoder.Oid.cs @@ -71,15 +71,55 @@ private static void ReadSubIdentifier( throw new AsnContentException(); } + // Set semanticBits to a value such that on the first + // iteration of the loop it becomes the correct value. + // So each entry here is [real semantic bits for this value] - 7. + int semanticBits = source[0] switch + { + >= 0b1100_0000 => 0, + >= 0b1010_0000 => -1, + >= 0b1001_0000 => -2, + >= 0b1000_1000 => -3, + >= 0b1000_0100 => -4, + >= 0b1000_0010 => -5, + >= 0b1000_0001 => -6, + _ => 0, + }; + // First, see how long the segment is int end = -1; int idx; + // None of T-REC-X.660-201107, T-REC-X.680-201508, or T-REC-X.690-201508 + // have any recommendations for a minimum (or maximum) size of a + // sub-identifier. + // + // T-REC-X.667-201210 (and earlier versions) discuss the no-registration- + // required UUID space at 2.25.{UUID}, where UUIDs are defined as 128-bit + // values. This gives us a minimum lower bound of 128-bit. + // + // Windows Crypt32 has historically only supported 64-bit values, and + // the "size limitations" FAQ on oid-info.com says that the largest arc + // value is a 39-digit value that corresponds to a 2.25.UUID value. + // + // So, until something argues for a bigger number, our bit-limit is 128. + const int MaxAllowedBits = 128; + for (idx = 0; idx < source.Length; idx++) { // If the high bit isn't set this marks the end of the sub-identifier. bool endOfIdentifier = (source[idx] & 0x80) == 0; + if (!LocalAppContextSwitches.AllowAnySizeOid) + { + semanticBits += 7; + + if (semanticBits > MaxAllowedBits) + { + throw new AsnContentException(SR.ContentException_OidTooBig); + } + } + if (endOfIdentifier) { end = idx; @@ -258,8 +298,21 @@ private static string ReadObjectIdentifier( contents = contents.Slice(bytesRead); + const int MaxArcs = 64; + int remainingArcs = MaxArcs - 2; + while (!contents.IsEmpty) { + if (!LocalAppContextSwitches.AllowAnySizeOid) + { + if (remainingArcs <= 0) + { + throw new AsnContentException(SR.ContentException_OidTooBig); + } + + remainingArcs--; + } + ReadSubIdentifier(contents, out bytesRead, out smallValue, out largeValue); // Exactly one should be non-null. Debug.Assert((smallValue == null) != (largeValue == null)); diff --git a/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/LocalAppContextSwitches.cs b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/LocalAppContextSwitches.cs new file mode 100644 index 00000000000000..62722d7f4d0008 --- /dev/null +++ b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/LocalAppContextSwitches.cs @@ -0,0 +1,17 @@ +// 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.CompilerServices; + +namespace System +{ + internal static partial class LocalAppContextSwitches + { + private static int s_allowAnySizeOid; + public static bool AllowAnySizeOid + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => GetCachedSwitchValue("System.Formats.Asn1.AllowAnySizeOid", ref s_allowAnySizeOid); + } + } +} diff --git a/src/libraries/System.Formats.Asn1/tests/Reader/ReadObjectIdentifier.cs b/src/libraries/System.Formats.Asn1/tests/Reader/ReadObjectIdentifier.cs index c1add074220a06..6584fd47b8f6ba 100644 --- a/src/libraries/System.Formats.Asn1/tests/Reader/ReadObjectIdentifier.cs +++ b/src/libraries/System.Formats.Asn1/tests/Reader/ReadObjectIdentifier.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Text; +using Microsoft.DotNet.RemoteExecutor; using Test.Cryptography; using Xunit; @@ -198,70 +199,188 @@ public static void ExpectedTag_IgnoresConstructed( [InlineData(AsnEncodingRules.BER)] [InlineData(AsnEncodingRules.CER)] [InlineData(AsnEncodingRules.DER)] - public static void ReadVeryLongOid(AsnEncodingRules ruleSet) + public static void ReadMaximumArcOid(AsnEncodingRules ruleSet) { - byte[] inputData = new byte[100000]; - // 06 83 02 00 00 (OBJECT IDENTIFIER, 65536 bytes). - inputData[0] = 0x06; - inputData[1] = 0x83; - inputData[2] = 0x01; - inputData[3] = 0x00; - inputData[4] = 0x00; - // and the rest are all zero. - - // The first byte produces "0.0". Each of the remaining 65535 bytes produce - // another ".0". - const int ExpectedLength = 65536 * 2 + 1; - StringBuilder builder = new StringBuilder(ExpectedLength); - builder.Append('0'); - - for (int i = 0; i <= ushort.MaxValue; i++) + const int MaxArcs = 64; + // MaxArcs content bytes (all 0x7F) (which includes one for failure), plus one for the tag + // plus one for the encoded length. + byte[] input = new byte[MaxArcs + 2]; + input.AsSpan().Fill(0x7F); + input[0] = 0x06; + // The first two arcs are encoded in the first sub-identifier, so MaxArcs - 1. + input[1] = MaxArcs - 1; + + string decoded = AsnDecoder.ReadObjectIdentifier(input, ruleSet, out int consumed); + Assert.Equal(input.Length - 1, consumed); + + StringBuilder expected = new StringBuilder(4 * MaxArcs); + expected.Append("2.47"); + + for (int i = 2; i < MaxArcs; i++) { - builder.Append('.'); - builder.Append(0); + expected.Append(".127"); } - AsnReader reader = new AsnReader(inputData, ruleSet); - string oidString = reader.ReadObjectIdentifier(); + Assert.Equal(expected.ToString(), decoded); - Assert.Equal(ExpectedLength, oidString.Length); - Assert.Equal(builder.ToString(), oidString); + input[1] = MaxArcs; + AsnContentException ex = Assert.Throws( + () => AsnDecoder.ReadObjectIdentifier(input, ruleSet, out _)); + Assert.Contains("OID", ex.Message); } [Theory] [InlineData(AsnEncodingRules.BER)] [InlineData(AsnEncodingRules.CER)] [InlineData(AsnEncodingRules.DER)] - public static void ReadVeryLongOidArc(AsnEncodingRules ruleSet) + public static void ReadMaximumInitialSubIdentifier(AsnEncodingRules ruleSet) { - byte[] inputData = new byte[255]; - // 06 81 93 (OBJECT IDENTIFIER, 147 bytes). - inputData[0] = 0x06; - inputData[1] = 0x81; - inputData[2] = 0x93; - - // With 147 bytes we get 147*7 = 1029 value bits. - // The smallest legal number to encode would have a top byte of 0x81, - // leaving 1022 bits remaining. If they're all zero then we have 2^1022. - // - // Since it's our first sub-identifier it's really encoding "2.(2^1022 - 80)". - inputData[3] = 0x81; - // Leave the last byte as 0. - new Span(inputData, 4, 145).Fill(0x80); - - const string ExpectedOid = - "2." + - "449423283715578976932326297697256183404494244735576643183575" + - "202894331689513752407831771193306018840052800284699678483394" + - "146974422036041556232118576598685310944419733562163713190755" + - "549003115235298632707380212514422095376705856157203684782776" + - "352068092908376276711465745599868114846199290762088390824060" + - "56034224"; + // First sub-identifier is 2^128 - 1, second is 1 + byte[] valid = + { + 0x06, 0x14, 0x83, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x01, + }; - AsnReader reader = new AsnReader(inputData, ruleSet); + // First sub-identifier is 2^128, second is 1 + byte[] invalid = + { + 0x06, 0x14, 0x84, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x00, 0x01, + }; + + string oid = AsnDecoder.ReadObjectIdentifier(valid, ruleSet, out int consumed); + Assert.Equal(valid.Length, consumed); + Assert.Equal("2.340282366920938463463374607431768211375.1", oid); + + AsnContentException ex = Assert.Throws( + () => AsnDecoder.ReadObjectIdentifier(invalid, ruleSet, out _)); + Assert.Contains("OID", ex.Message); + } - string oidString = reader.ReadObjectIdentifier(); - Assert.Equal(ExpectedOid, oidString); + [Theory] + [InlineData(AsnEncodingRules.BER)] + [InlineData(AsnEncodingRules.CER)] + [InlineData(AsnEncodingRules.DER)] + public static void ReadMaximumNonInitialSubIdentifier(AsnEncodingRules ruleSet) + { + // First sub-identifier is 1, second is 2^128 - 1 + byte[] valid = + { + 0x06, 0x14, 0x01, 0x83, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, + }; + + // First sub-identifier is 1, second is 2^128 + byte[] invalid = new byte[] + { + 0x06, 0x14, 0x01, 0x84, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, + }; + + string oid = AsnDecoder.ReadObjectIdentifier(valid, ruleSet, out int consumed); + Assert.Equal(valid.Length, consumed); + Assert.Equal("0.1.340282366920938463463374607431768211455", oid); + + AsnContentException ex = Assert.Throws( + () => AsnDecoder.ReadObjectIdentifier(invalid, ruleSet, out _)); + Assert.Contains("OID", ex.Message); + } + + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + public static void ReadVeryLongOid_WithAppContext() + { + RemoteExecutor.Invoke( + static () => + { + AppContext.SetSwitch("System.Formats.Asn1.AllowAnySizeOid", true); + + byte[] inputData = new byte[100000]; + // 06 83 02 00 00 (OBJECT IDENTIFIER, 65536 bytes). + inputData[0] = 0x06; + inputData[1] = 0x83; + inputData[2] = 0x01; + inputData[3] = 0x00; + inputData[4] = 0x00; + // and the rest are all zero. + + // The first byte produces "0.0". Each of the remaining 65535 bytes produce + // another ".0". + const int ExpectedLength = 65536 * 2 + 1; + StringBuilder builder = new StringBuilder(ExpectedLength); + builder.Append('0'); + + for (int i = 0; i <= ushort.MaxValue; i++) + { + builder.Append('.'); + builder.Append(0); + } + + AsnEncodingRules[] ruleSets = + { + AsnEncodingRules.BER, + AsnEncodingRules.CER, + AsnEncodingRules.DER, + }; + + foreach (AsnEncodingRules ruleSet in ruleSets) + { + AsnReader reader = new AsnReader(inputData, ruleSet); + string oidString = reader.ReadObjectIdentifier(); + + Assert.Equal(ExpectedLength, oidString.Length); + Assert.Equal(builder.ToString(), oidString); + } + }).Dispose(); + } + + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + public static void ReadVeryLongOidArc_WithAppContext() + { + RemoteExecutor.Invoke( + static () => + { + AppContext.SetSwitch("System.Formats.Asn1.AllowAnySizeOid", true); + + byte[] inputData = new byte[255]; + // 06 81 93 (OBJECT IDENTIFIER, 147 bytes). + inputData[0] = 0x06; + inputData[1] = 0x81; + inputData[2] = 0x93; + + // With 147 bytes we get 147*7 = 1029 value bits. + // The smallest legal number to encode would have a top byte of 0x81, + // leaving 1022 bits remaining. If they're all zero then we have 2^1022. + // + // Since it's our first sub-identifier it's really encoding "2.(2^1022 - 80)". + inputData[3] = 0x81; + // Leave the last byte as 0. + new Span(inputData, 4, 145).Fill(0x80); + + const string ExpectedOid = + "2." + + "449423283715578976932326297697256183404494244735576643183575" + + "202894331689513752407831771193306018840052800284699678483394" + + "146974422036041556232118576598685310944419733562163713190755" + + "549003115235298632707380212514422095376705856157203684782776" + + "352068092908376276711465745599868114846199290762088390824060" + + "56034224"; + + AsnEncodingRules[] ruleSets = + { + AsnEncodingRules.BER, + AsnEncodingRules.CER, + AsnEncodingRules.DER, + }; + + foreach (AsnEncodingRules ruleSet in ruleSets) + { + AsnReader reader = new AsnReader(inputData, ruleSet); + + string oidString = reader.ReadObjectIdentifier(); + Assert.Equal(ExpectedOid, oidString); + } + }).Dispose(); } } } diff --git a/src/libraries/System.Formats.Asn1/tests/System.Formats.Asn1.Tests.csproj b/src/libraries/System.Formats.Asn1/tests/System.Formats.Asn1.Tests.csproj index 1c4965e48777ee..c4bfbf0a5ebc01 100644 --- a/src/libraries/System.Formats.Asn1/tests/System.Formats.Asn1.Tests.csproj +++ b/src/libraries/System.Formats.Asn1/tests/System.Formats.Asn1.Tests.csproj @@ -2,6 +2,7 @@ true $(NetCoreAppCurrent);net461 + true diff --git a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoAll.cs b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoAll.cs index c89088b7119b6d..dac3b98dc2cea9 100644 --- a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoAll.cs +++ b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoAll.cs @@ -667,12 +667,6 @@ public void LcidTest(int lcid, string[] cultureNames, string specificCultureName CultureInfo ci = new CultureInfo(lcid); Assert.Contains(ci.Name, cultureNames, StringComparer.OrdinalIgnoreCase); - if (ci.LCID == 0x1000) - { - // Unsupported culture. - return; - } - Assert.True(lcid == ci.LCID || (ushort)lcid == (ushort)ci.LCID); Assert.True(ci.UseUserOverride, "UseUserOverride for lcid created culture expected to be true"); Assert.False(ci.IsReadOnly, "IsReadOnly for lcid created culture expected to be false"); @@ -719,10 +713,14 @@ public void LcidTest(int lcid, string[] cultureNames, string specificCultureName ci = CultureInfo.CreateSpecificCulture(cultureNames[0]); TestCultureName(specificCultureName, ci.Name); - ci = CultureInfo.GetCultureInfoByIetfLanguageTag(cultureNames[0]); - Assert.Contains(ci.Name, cultureNames, StringComparer.OrdinalIgnoreCase); - TestCultureName(ci.Name, ci.IetfLanguageTag); - Assert.True(lcid == ci.KeyboardLayoutId || (ushort)lcid == (ushort)ci.KeyboardLayoutId); + // CultureInfo.GetCultureInfoByIetfLanguageTag doesn't support alternative sort LCID's. + if (lcid <= 0xffff && lcid != 0x040a) + { + ci = CultureInfo.GetCultureInfoByIetfLanguageTag(cultureNames[0]); + Assert.Contains(ci.Name, cultureNames, StringComparer.OrdinalIgnoreCase); + TestCultureName(ci.Name, ci.IetfLanguageTag); + Assert.True(lcid == ci.KeyboardLayoutId || (ushort)lcid == (ushort)ci.KeyboardLayoutId); + } if (ci.GetConsoleFallbackUICulture().Name != "") { @@ -733,8 +731,8 @@ public void LcidTest(int lcid, string[] cultureNames, string specificCultureName { AssertExtensions.Throws(() => new CultureInfo(lcid)); } - - } + + } private static string[] hans = new[] { "zh-CN", "zh-CHS", "zh-Hans" }; private static string[] hant = new[] { "zh-HK", "zh-CHT", "zh-Hant" }; diff --git a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs index 787f9e37f719db..493ab018fbc091 100644 --- a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs +++ b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.DotNet.RemoteExecutor; using System.Collections.Generic; using Xunit; @@ -253,8 +254,8 @@ public static IEnumerable Ctor_String_TestData() yield return new object[] { "pa-IN", new [] { "pa-IN" }, true }; yield return new object[] { "pl", new [] { "pl" } }; yield return new object[] { "pl-PL", new [] { "pl-PL" } }; - yield return new object[] { "prs", new [] { "prs" }, true }; - yield return new object[] { "prs-AF", new [] { "prs-AF" }, true }; + yield return new object[] { "prs", new [] { "prs", "fa" }, true }; + yield return new object[] { "prs-AF", new [] { "prs-AF", "fa-AF" }, true }; yield return new object[] { "ps", new [] { "ps" }, true }; yield return new object[] { "ps-AF", new [] { "ps-AF" }, true }; yield return new object[] { "pt", new [] { "pt" } }; @@ -439,5 +440,63 @@ public void TestCreationWithTemporaryLCID(int lcid) Assert.NotEqual(lcid, new CultureInfo(lcid).LCID); } + + private static bool NotWasmWithIcu => PlatformDetection.IsNotBrowser && PlatformDetection.IsIcuGlobalization && PlatformDetection.IsNotWindowsServerCore; + + [InlineData("zh-TW-u-co-zhuyin", "zh-TW", "zh-TW_zhuyin")] + [InlineData("de-DE-u-co-phonebk", "de-DE", "de-DE_phoneboo")] + [InlineData("de-DE-u-co-phonebk-u-xx", "de-DE-u-xx", "de-DE-u-xx_phoneboo")] + [InlineData("de-DE-u-xx-u-co-phonebk", "de-DE-u-xx-u-co-phonebk", "de-DE-u-xx-u-co-phonebk")] + [InlineData("de-DE-t-xx-u-co-phonebk", "de-DE-t-xx-u-co-phonebk", "de-DE-t-xx-u-co-phonebk_phoneboo")] + [InlineData("de-DE-u-co-phonebk-t-xx", "de-DE-t-xx", "de-DE-t-xx_phoneboo")] + [InlineData("de-DE-u-co-phonebk-t-xx-u-yy", "de-DE-t-xx-u-yy", "de-DE-t-xx-u-yy_phoneboo")] + [InlineData("de-DE", "de-DE", "de-DE")] + [ConditionalTheory(nameof(NotWasmWithIcu))] + public void TestCreationWithMangledSortName(string cultureName, string expectedCultureName, string expectedSortName) + { + CultureInfo ci = CultureInfo.GetCultureInfo(cultureName); + + Assert.Equal(expectedCultureName, ci.Name); + Assert.Equal(expectedSortName, ci.CompareInfo.Name); + } + + [InlineData("xx-u-XX", "xx-u-xx")] + [InlineData("xx-u-XX-u-yy", "xx-u-xx-u-yy")] + [InlineData("xx-t-ja-JP", "xx-t-ja-jp")] + [InlineData("qps-plocm", "qps-PLOCM")] // ICU normalize this name to "qps--plocm" which we normalize it back to "qps-plocm" + [InlineData("zh_CN", "zh_cn")] + [InlineData("km_KH", "km_kh")] + [ConditionalTheory(nameof(NotWasmWithIcu))] + public void TestCreationWithICUNormalizedNames(string cultureName, string expectedCultureName) + { + CultureInfo ci = CultureInfo.GetCultureInfo(cultureName); + Assert.Equal(expectedCultureName, ci.Name); + } + + private static bool SupportRemoteExecutionWithIcu => RemoteExecutor.IsSupported && PlatformDetection.IsIcuGlobalization; + + [InlineData("xx-u-XX")] + [InlineData("xx-u-XX-u-yy")] + [InlineData("xx-t-ja-JP")] + [InlineData("qps-plocm")] + [InlineData("zh-TW-u-co-zhuyin")] + [InlineData("de-DE-u-co-phonebk")] + [InlineData("de-DE-u-co-phonebk-u-xx")] + [InlineData("de-DE-u-xx-u-co-phonebk")] + [InlineData("de-DE-t-xx-u-co-phonebk")] + [InlineData("de-DE-u-co-phonebk-t-xx")] + [InlineData("de-DE-u-co-phonebk-t-xx-u-yy")] + [InlineData("de-DE")] + [ConditionalTheory(nameof(SupportRemoteExecutionWithIcu))] + public void TestWithResourceLookup(string cultureName) + { + RemoteExecutor.Invoke(name => { + CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo(name); + int Zero = 0; + + // This should go through the resource manager to get the localized exception message using the current UI culture + Assert.Throws(() => 1 / Zero); + }, cultureName).Dispose(); + } } } diff --git a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs index 9215095756e98d..44afccec6b9f85 100644 --- a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs +++ b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs @@ -33,6 +33,17 @@ public void CurrentCulture() } } + [Fact] + [PlatformSpecific(TestPlatforms.OSX | TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS)] + public void CurrentCulture_Default_Not_Invariant() + { + // On OSX-like platforms, it should default to what the default system culture is + // set to. Since we shouldn't assume en-US, we just test if it's not the invariant + // culture. + Assert.NotEqual(CultureInfo.CurrentCulture, CultureInfo.InvariantCulture); + Assert.NotEqual(CultureInfo.CurrentUICulture, CultureInfo.InvariantCulture); + } + [Fact] public void CurrentCulture_Set_Null_ThrowsArgumentNullException() { @@ -125,7 +136,7 @@ public void CurrentCulture_BasedOnLangEnvVar(string langEnvVar, string expectedC }, expectedCultureName, new RemoteInvokeOptions { StartInfo = psi }).Dispose(); } - [PlatformSpecific(TestPlatforms.AnyUnix)] // When LANG is empty or unset, should default to the invariant culture on Unix. + [PlatformSpecific(TestPlatforms.AnyUnix)] [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("")] [InlineData(null)] @@ -141,13 +152,28 @@ public void CurrentCulture_DefaultWithNoLang(string langEnvVar) psi.Environment["LANG"] = langEnvVar; } + // When LANG is empty or unset, on Unix it should default to the invariant culture. + // On OSX-like platforms, it should default to what the default system culture is + // set to. Since we shouldn't assume en-US, we just test if it's not the invariant + // culture. RemoteExecutor.Invoke(() => { Assert.NotNull(CultureInfo.CurrentCulture); Assert.NotNull(CultureInfo.CurrentUICulture); - Assert.Equal("", CultureInfo.CurrentCulture.Name); - Assert.Equal("", CultureInfo.CurrentUICulture.Name); + if (PlatformDetection.IsOSXLike) + { + Assert.NotEqual("", CultureInfo.CurrentCulture.Name); + Assert.NotEqual("", CultureInfo.CurrentUICulture.Name); + + Assert.NotEqual(CultureInfo.CurrentCulture, CultureInfo.InvariantCulture); + Assert.NotEqual(CultureInfo.CurrentUICulture, CultureInfo.InvariantCulture); + } + else + { + Assert.Equal("", CultureInfo.CurrentCulture.Name); + Assert.Equal("", CultureInfo.CurrentUICulture.Name); + } }, new RemoteInvokeOptions { StartInfo = psi }).Dispose(); } diff --git a/src/libraries/System.Globalization/tests/CultureInfo/GetCultureInfo.cs b/src/libraries/System.Globalization/tests/CultureInfo/GetCultureInfo.cs index e6399bb5cc6177..5a5e3dada218b1 100644 --- a/src/libraries/System.Globalization/tests/CultureInfo/GetCultureInfo.cs +++ b/src/libraries/System.Globalization/tests/CultureInfo/GetCultureInfo.cs @@ -32,12 +32,15 @@ public static IEnumerable GetCultureInfoTestData() if (PlatformDetection.IsIcuGlobalization) { - yield return new object[] { "x\u0000X-Yy", "x" }; // Null byte + if (PlatformDetection.IsNotWindows) + { + yield return new object[] { "x\u0000X-Yy", "x" }; // Null byte + yield return new object[] { "zh-cmn", "zh-CMN" }; + yield return new object[] { "zh-CMN-HANS" }; + yield return new object[] { "zh-cmn-Hant", "zh-CMN-HANT" }; + } yield return new object[] { "sgn-BE-FR" }; yield return new object[] { "zh-min-nan", "nan" }; - yield return new object[] { "zh-cmn", "zh-CMN" }; - yield return new object[] { "zh-CMN-HANS" }; - yield return new object[] { "zh-cmn-Hant", "zh-CMN-HANT" }; yield return new object[] { "zh-gan", "gan" }; yield return new object[] { "zh-Hans-CN" }; yield return new object[] { "zh-Hans-SG" }; @@ -58,6 +61,17 @@ public static IEnumerable GetCultureInfoTestData() } } + [Theory] + [PlatformSpecific(TestPlatforms.Windows)] // Windows specific behavior + [InlineData("x\u0000X-Yy")] + [InlineData("zh-cmn")] + [InlineData("zh-CMN-HANS")] + [InlineData("zh-cmn-Hant")] + public void TestIvalidCultureNames(string cultureName) + { + Assert.Throws(() => new CultureInfo(cultureName)); + } + [ConditionalTheory(nameof(PlatformSupportsFakeCulture))] [MemberData(nameof(GetCultureInfoTestData))] public void GetCultureInfo(string name, string expected = null) diff --git a/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.Tests.csproj b/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.Tests.csproj new file mode 100644 index 00000000000000..2030aa49789dbb --- /dev/null +++ b/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.Tests.csproj @@ -0,0 +1,25 @@ + + + $(NetCoreAppCurrent) + true + true + + + + + + + + + + + \ No newline at end of file diff --git a/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.cs b/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.cs new file mode 100644 index 00000000000000..aa0a0df938c407 --- /dev/null +++ b/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.DotNet.RemoteExecutor; +using System.Diagnostics; +using System.Reflection; +using Xunit; + +namespace System.Globalization.Tests +{ + public class IcuAppLocalTests + { + private static bool SupportsIcuPackageDownload => RemoteExecutor.IsSupported && + ((PlatformDetection.IsWindows && !PlatformDetection.IsArmProcess) || + (PlatformDetection.IsLinux && (PlatformDetection.IsX64Process || PlatformDetection.IsArm64Process) && + !PlatformDetection.IsAlpine && !PlatformDetection.IsLinuxBionic)); + + + [ConditionalFact(nameof(SupportsIcuPackageDownload))] + public void TestIcuAppLocal() + { + // We define this switch dynamically during the runtime using RemoteExecutor. + // The reason is, if we enable ICU app-local here, this test will compile and run + // on all supported OSs even the ICU NuGet package not have native bits support such OSs. + // Note, it doesn't matter if we have test case conditioned to not run on such OSs, because + // the test has to start running first before filtering the test cases and the globalization + // code will run and fail fast at that time. + + ProcessStartInfo psi = new ProcessStartInfo(); + psi.Environment.Add("DOTNET_SYSTEM_GLOBALIZATION_APPLOCALICU", "68.2.0.9"); + + RemoteExecutor.Invoke(() => + { + // Ensure initializing globalization code before checking the ICU version. + CultureInfo ci = CultureInfo.GetCultureInfo("en-US"); + + Type? interopGlobalization = Type.GetType("Interop+Globalization, System.Private.CoreLib"); + Assert.NotNull(interopGlobalization); + + MethodInfo? methodInfo = interopGlobalization.GetMethod("GetICUVersion", BindingFlags.NonPublic | BindingFlags.Static); + Assert.NotNull(methodInfo); + + // Assert the ICU version 0x44020009 is 68.2.0.9 + Assert.Equal(0x44020009, (int)methodInfo.Invoke(null, null)); + + // Now call globalization API to ensure the binding working without any problem. + Assert.Equal(-1, ci.CompareInfo.Compare("sample\u0000", "Sample\u0000", CompareOptions.IgnoreSymbols)); + }, new RemoteInvokeOptions { StartInfo = psi }).Dispose(); + } + } +} diff --git a/src/libraries/System.Globalization/tests/IcuTests.cs b/src/libraries/System.Globalization/tests/IcuTests.cs index 190da7f676c807..e28872759bea7f 100644 --- a/src/libraries/System.Globalization/tests/IcuTests.cs +++ b/src/libraries/System.Globalization/tests/IcuTests.cs @@ -10,7 +10,9 @@ namespace System.Globalization.Tests public class IcuTests { private static bool IsIcuCompatiblePlatform => PlatformDetection.IsNotWindows || - PlatformDetection.IsWindows10Version1903OrGreater; + PlatformDetection.IsWindows10Version1903OrGreater && + // Server core doesn't have icu.dll on SysWOW64 + !(PlatformDetection.IsWindowsServerCore && PlatformDetection.IsX86Process); [ConditionalFact(nameof(IsIcuCompatiblePlatform))] public static void IcuShouldBeUsedByDefault() diff --git a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs index 34fd7bc00cb2b7..741eb25c6a3a3a 100644 --- a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs +++ b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs @@ -10,20 +10,21 @@ public class NumberFormatInfoCurrencyGroupSizes { public static IEnumerable CurrencyGroupSizes_TestData() { - yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 } }; - yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 } }; + yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 }, null }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 }, null }; if (PlatformDetection.IsNotUsingLimitedCultures && !PlatformDetection.IsUbuntu && !PlatformDetection.IsWindows7 && !PlatformDetection.IsWindows8x && !PlatformDetection.IsFedora) { - yield return new object[] { CultureInfo.GetCultureInfo("ur-IN").NumberFormat, new int[] { 3, 2 } }; + yield return new object[] { CultureInfo.GetCultureInfo("ur-IN").NumberFormat, new int[] { 3, 2 }, new int[] { 3 }}; } } [Theory] [MemberData(nameof(CurrencyGroupSizes_TestData))] - public void CurrencyGroupSizes_Get_ReturnsExpected(NumberFormatInfo format, int[] expected) + public void CurrencyGroupSizes_Get_ReturnsExpected(NumberFormatInfo format, int[] expected, int[] expectedAlternative) { - Assert.Equal(expected, format.CurrencyGroupSizes); + Assert.True(format.CurrencyGroupSizes.AsSpan().SequenceEqual(expected.AsSpan()) || format.CurrencyGroupSizes.AsSpan().SequenceEqual(expectedAlternative.AsSpan()), + $"Expected {string.Join(", ", expected)} or {string.Join(", ", expectedAlternative ?? Array.Empty())}, got {string.Join(", ", format.CurrencyGroupSizes)}"); } [Theory] diff --git a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoData.cs b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoData.cs index ee007af28b6d0e..36ff2977b807d1 100644 --- a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoData.cs +++ b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoData.cs @@ -65,7 +65,11 @@ internal static int[] GetCurrencyNegativePatterns(string localeName) return PlatformDetection.IsNlsGlobalization ? new int[] { 12 } : new int[] { 9 }; case "es-BO": - return (PlatformDetection.IsNlsGlobalization && PlatformDetection.WindowsVersion < 10) ? new int[] { 14 } : new int[] { 1 }; + return (PlatformDetection.IsNlsGlobalization && PlatformDetection.WindowsVersion < 10) ? + new int[] { 14 } : + // Mac OSX used to return 1 which is the format "-$n". OSX Version 12 (Monterey) started + // to return a different value 12 "$ -n". + PlatformDetection.IsOSX ? new int[] { 1, 12 } : new int[] { 1 }; case "fr-CA": return PlatformDetection.IsNlsGlobalization ? new int[] { 15 } : new int[] { 8, 15 }; diff --git a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoTests.cs b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoTests.cs index 9ff172194fd786..c5abe421df1985 100644 --- a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoTests.cs +++ b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoTests.cs @@ -54,8 +54,6 @@ public static IEnumerable DigitSubstitution_TestData() yield return new object[] { "nqo-GN" , DigitShapes.NativeNational }; yield return new object[] { "pa-Arab" , DigitShapes.NativeNational }; yield return new object[] { "pa-Arab-PK", DigitShapes.NativeNational }; - yield return new object[] { "prs" , DigitShapes.NativeNational }; - yield return new object[] { "prs-AF" , DigitShapes.NativeNational }; yield return new object[] { "ps" , DigitShapes.NativeNational }; yield return new object[] { "ps-AF" , DigitShapes.NativeNational }; yield return new object[] { "sd" , DigitShapes.NativeNational }; @@ -115,5 +113,22 @@ public void DigitSubstitutionListTest(string cultureName, DigitShapes shape) } } + [Theory] + [InlineData("prs")] + [InlineData("prs-AF")] + public void PrsNativeDigitsTest(string cultureName) + { + try + { + CultureInfo ci = CultureInfo.GetCultureInfo(cultureName); + + // Some OS's set the DigitSubstitution to Context for the culture "prs" and "prs-AF". Majority of Os's set it to NativeNational. + Assert.True(ci.NumberFormat.DigitSubstitution == DigitShapes.Context || ci.NumberFormat.DigitSubstitution == DigitShapes.NativeNational); + } + catch (CultureNotFoundException) + { + // ignore the cultures that we cannot create as it is not supported on the platforms + } + } } } diff --git a/src/libraries/System.Globalization/tests/System/Globalization/TextInfoTests.cs b/src/libraries/System.Globalization/tests/System/Globalization/TextInfoTests.cs index eae275bc0b1a3e..c36ba960230ce6 100644 --- a/src/libraries/System.Globalization/tests/System/Globalization/TextInfoTests.cs +++ b/src/libraries/System.Globalization/tests/System/Globalization/TextInfoTests.cs @@ -287,7 +287,7 @@ public static IEnumerable ToLower_TestData() } yield return new object[] { cultureName, "\u0130", "i" }; yield return new object[] { cultureName, "i", "i" }; - + } // ICU has special tailoring for the en-US-POSIX locale which treats "i" and "I" as different letters @@ -478,5 +478,13 @@ public void ToStringTest(string name, string expected) { Assert.Equal(expected, new CultureInfo(name).TextInfo.ToString()); } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [InlineData("es-ES")] + [InlineData("es-ES_tradnl")] + public void TestAsciiCodePageWithCulturesWithAlternativeSortNames(string cultureName) + { + Assert.Equal(1252, CultureInfo.GetCultureInfo(cultureName).TextInfo.ANSICodePage); + } } } diff --git a/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs b/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs index 5d800c1f62ca71..fe725937441e24 100644 --- a/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs +++ b/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs @@ -83,7 +83,7 @@ public static void ExtractToFile(this ZipArchiveEntry source, string destination { File.SetLastWriteTime(destinationFileName, source.LastWriteTime.DateTime); } - catch (UnauthorizedAccessException) + catch { // some OSes like Android (#35374) might not support setting the last write time, the extraction should not fail because of that } diff --git a/src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Unix.cs b/src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Unix.cs index ab61ae92443d58..2b5312801d0688 100644 --- a/src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Unix.cs +++ b/src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Unix.cs @@ -9,6 +9,8 @@ namespace System.IO.Compression.Tests public class ZipFile_Unix : ZipFileTestBase { [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/68293", TestPlatforms.OSX)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/60581", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void UnixCreateSetsPermissionsInExternalAttributes() { // '7600' tests that S_ISUID, S_ISGID, and S_ISVTX bits get preserved in ExternalAttributes diff --git a/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props b/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props index ce244cbea56199..c581a9ef9e5a84 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props +++ b/src/libraries/System.IO.FileSystem.Watcher/Directory.Build.props @@ -3,6 +3,7 @@ Microsoft true - browser + browser;ios;tvos + maccatalyst \ No newline at end of file diff --git a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj index b6b0579e63026f..056431aa17e502 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj +++ b/src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-FreeBSD enable @@ -75,7 +75,7 @@ - + diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs index 94b42c5041cc9f..9659dd75903a73 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/AssemblyInfo.cs @@ -4,4 +4,4 @@ using System; using Xunit; -[assembly: SkipOnPlatform(TestPlatforms.Browser, "System.IO.FileSystem.Watcher is not supported on Browser")] +[assembly: SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")] diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs index aec8019cdceb9d..cce5f54469f2dd 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs @@ -111,6 +111,7 @@ public void NonZeroTimeout_NoEvents_TimesOut(bool enabledBeforeWait) [InlineData(WatcherChangeTypes.Changed, false)] [InlineData(WatcherChangeTypes.Renamed, true)] [InlineData(WatcherChangeTypes.All, true)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/58418", typeof(PlatformDetection), nameof(PlatformDetection.IsMacCatalyst), nameof(PlatformDetection.IsArm64Process))] public void NonZeroTimeout_NoActivity_TimesOut(WatcherChangeTypes changeType, bool enabledBeforeWait) { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj b/src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj index 67c502fa83412a..1139f2ecf2a0cd 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj @@ -1,8 +1,8 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD - true + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-FreeBSD + true diff --git a/src/libraries/System.IO.FileSystem/tests/Base/BaseGetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/Base/BaseGetSetTimes.cs index a959e317682f4e..d55171847a0b7d 100644 --- a/src/libraries/System.IO.FileSystem/tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/Base/BaseGetSetTimes.cs @@ -20,7 +20,9 @@ public abstract class BaseGetSetTimes : FileSystemTest protected static bool LowTemporalResolution => PlatformDetection.IsBrowser || isHFS; protected static bool HighTemporalResolution => !LowTemporalResolution; - protected abstract T GetExistingItem(); + protected abstract bool CanBeReadOnly { get; } + + protected abstract T GetExistingItem(bool readOnly = false); protected abstract T GetMissingItem(); protected abstract string GetItemPath(T item); @@ -42,11 +44,8 @@ public static TimeFunction Create(SetTime setter, GetTime getter, DateTimeKind k public DateTimeKind Kind => Item3; } - [Fact] - public void SettingUpdatesProperties() + private void SettingUpdatesPropertiesCore(T item) { - T item = GetExistingItem(); - Assert.All(TimeFunctions(requiresRoundtripping: true), (function) => { // Checking that milliseconds are not dropped after setter. @@ -70,6 +69,25 @@ public void SettingUpdatesProperties() }); } + [Fact] + public void SettingUpdatesProperties() + { + T item = GetExistingItem(); + SettingUpdatesPropertiesCore(item); + } + + [Fact] + public void SettingUpdatesPropertiesWhenReadOnly() + { + if (!CanBeReadOnly) + { + return; // directories can't be read only, so automatic pass + } + + T item = GetExistingItem(readOnly: true); + SettingUpdatesPropertiesCore(item); + } + [Fact] public void CanGetAllTimesAfterCreation() { diff --git a/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.FileSystem.cs b/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.FileSystem.cs index 0682f8ce16e5bb..ffecf938cb3df3 100644 --- a/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.FileSystem.cs +++ b/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.FileSystem.cs @@ -1,7 +1,8 @@ // 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.Generic; +using System.IO.Enumeration; +using System.Linq; using Xunit; namespace System.IO.Tests @@ -156,7 +157,7 @@ public void ResolveLinkTarget_ReturnsNull_NotALink(bool returnFinalTarget) } [Theory] - [MemberData(nameof(ResolveLinkTarget_PathToTarget_Data))] + [MemberData(nameof(SymbolicLink_ResolveLinkTarget_PathToTarget_Data))] public void ResolveLinkTarget_Succeeds(string pathToTarget, bool returnFinalTarget) { string linkPath = GetRandomLinkPath(); @@ -342,32 +343,6 @@ public void DetectLinkReferenceToSelf() Assert.Throws(() => ResolveLinkTarget(linkPath, returnFinalTarget: true)); } - [Fact] - public void CreateSymbolicLink_WrongTargetType_Throws() - { - // dirLink -> file - // fileLink -> dir - - string targetPath = GetRandomFilePath(); - CreateFileOrDirectory(targetPath, createOpposite: true); // The underlying file system entry needs to be different - Assert.Throws(() => CreateSymbolicLink(GetRandomFilePath(), targetPath)); - } - - [Fact] - public void CreateSymbolicLink_WrongTargetType_Indirect_Throws() - { - // link-2 (dir) -> link-1 (file) -> file - // link-2 (file) -> link-1 (dir) -> dir - string targetPath = GetRandomFilePath(); - string firstLinkPath = GetRandomFilePath(); - string secondLinkPath = GetRandomFilePath(); - - CreateFileOrDirectory(targetPath, createOpposite: true); - CreateSymbolicLink_Opposite(firstLinkPath, targetPath); - - Assert.Throws(() => CreateSymbolicLink(secondLinkPath, firstLinkPath)); - } - [Fact] public void CreateSymbolicLink_CorrectTargetType_Indirect_Succeeds() { @@ -427,14 +402,14 @@ private void ResolveLinkTarget_ReturnFinalTarget(string link1Path, string link1T Assert.True(link2Info.Exists); Assert.True(link2Info.Attributes.HasFlag(FileAttributes.ReparsePoint)); AssertIsCorrectTypeAndDirectoryAttribute(link2Info); - Assert.Equal(link2Target, link2Info.LinkTarget); + AssertPathEquals_RelativeSegments(link2Target, link2Info.LinkTarget); // link1 to link2 FileSystemInfo link1Info = CreateSymbolicLink(link1Path, link1Target); Assert.True(link1Info.Exists); Assert.True(link1Info.Attributes.HasFlag(FileAttributes.ReparsePoint)); AssertIsCorrectTypeAndDirectoryAttribute(link1Info); - Assert.Equal(link1Target, link1Info.LinkTarget); + AssertPathEquals_RelativeSegments(link1Target, link1Info.LinkTarget); // link1: do not follow symlinks FileSystemInfo link1TargetInfo = ResolveLinkTarget(link1Path, returnFinalTarget: false); @@ -442,7 +417,7 @@ private void ResolveLinkTarget_ReturnFinalTarget(string link1Path, string link1T AssertIsCorrectTypeAndDirectoryAttribute(link1TargetInfo); Assert.True(link1TargetInfo.Attributes.HasFlag(FileAttributes.ReparsePoint)); Assert.Equal(link2Path, link1TargetInfo.FullName); - Assert.Equal(link2Target, link1TargetInfo.LinkTarget); + AssertPathEquals_RelativeSegments(link2Target, link1TargetInfo.LinkTarget); // link2: do not follow symlinks FileSystemInfo link2TargetInfo = ResolveLinkTarget(link2Path, returnFinalTarget: false); @@ -458,13 +433,25 @@ private void ResolveLinkTarget_ReturnFinalTarget(string link1Path, string link1T AssertIsCorrectTypeAndDirectoryAttribute(finalTarget); Assert.False(finalTarget.Attributes.HasFlag(FileAttributes.ReparsePoint)); Assert.Equal(filePath, finalTarget.FullName); + + void AssertPathEquals_RelativeSegments(string expected, string actual) + { +#if WINDOWS + // DeviceIoControl canonicalizes the target path i.e: removes redundant segments. + int rootLength = PathInternal.GetRootLength(expected); + if (rootLength > 0) + { + expected = PathInternal.RemoveRelativeSegments(expected, rootLength); + } +#endif + Assert.Equal(expected, actual); + } } + // Must call inside a remote executor protected void CreateSymbolicLink_PathToTarget_RelativeToLinkPath_Internal(bool createOpposite) { - string tempCwd = GetRandomDirPath(); - Directory.CreateDirectory(tempCwd); - Directory.SetCurrentDirectory(tempCwd); + string tempCwd = ChangeCurrentDirectory(); // Create a dummy file or directory in cwd. string fileOrDirectoryInCwd = GetRandomFileName(); @@ -483,49 +470,32 @@ protected void CreateSymbolicLink_PathToTarget_RelativeToLinkPath_Internal(bool Assert.Equal(Path.GetDirectoryName(linkInfo.FullName), Path.GetDirectoryName(targetInfo.FullName)); } - public static IEnumerable ResolveLinkTarget_PathToTarget_Data + protected static string? GetAppExecLinkPath() { - get + string localAppDataPath = Environment.GetEnvironmentVariable("LOCALAPPDATA"); + if (localAppDataPath is null) { - foreach (string path in PathToTargetData) - { - yield return new object[] { path, false }; - yield return new object[] { path, true }; - } + return null; } - } - internal static IEnumerable PathToTargetData - { - get + string windowsAppsDir = Path.Join(localAppDataPath, "Microsoft", "WindowsApps"); + + if (!Directory.Exists(windowsAppsDir)) { - if (OperatingSystem.IsWindows()) - { - //Non-rooted relative - yield return "foo"; - yield return @".\foo"; - yield return @"..\foo"; - // Rooted relative - yield return @"\foo"; - // Rooted absolute - yield return Path.Combine(Path.GetTempPath(), "foo"); - // Extended DOS - yield return Path.Combine(@"\\?\", Path.GetTempPath(), "foo"); - // UNC - yield return @"\\LOCALHOST\share\path"; - } - else - { - //Non-rooted relative - yield return "foo"; - yield return "./foo"; - yield return "../foo"; - // Rooted relative - yield return "/foo"; - // Rooted absolute - Path.Combine(Path.GetTempPath(), "foo"); - } + return null; } + + var opts = new EnumerationOptions { RecurseSubdirectories = true }; + + return new FileSystemEnumerable( + windowsAppsDir, + (ref FileSystemEntry entry) => entry.ToFullPath(), + opts) + { + ShouldIncludePredicate = (ref FileSystemEntry entry) => + FileSystemName.MatchesWin32Expression("*.exe", entry.FileName) && + (entry.Attributes & FileAttributes.ReparsePoint) != 0 + }.FirstOrDefault(); } } } diff --git a/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.FileSystemInfo.cs b/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.FileSystemInfo.cs index e82864248eb434..05e18f14e9ecf2 100644 --- a/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.FileSystemInfo.cs +++ b/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.FileSystemInfo.cs @@ -1,8 +1,6 @@ // 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.Generic; -using System.Diagnostics; using Xunit; namespace System.IO.Tests @@ -54,7 +52,7 @@ public void LinkTarget_ReturnsNull_NotALink() } [Theory] - [MemberData(nameof(LinkTarget_PathToTarget_Data))] + [MemberData(nameof(SymbolicLink_LinkTarget_PathToTarget_Data))] public void LinkTarget_Succeeds(string pathToTarget) { FileSystemInfo linkInfo = CreateSymbolicLink(GetRandomLinkPath(), pathToTarget); @@ -86,16 +84,5 @@ public void LinkTarget_RefreshesCorrectly() Assert.Equal(newPathToTarget, linkInfo.LinkTarget); Assert.Equal(newLinkInfo.LinkTarget, linkInfo.LinkTarget); } - - public static IEnumerable LinkTarget_PathToTarget_Data - { - get - { - foreach (string path in PathToTargetData) - { - yield return new object[] { path }; - } - } - } } } diff --git a/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.cs b/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.cs index f120cdf10eba53..d506e7e5e9b2b2 100644 --- a/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.cs +++ b/src/libraries/System.IO.FileSystem/tests/Base/SymbolicLinks/BaseSymbolicLinks.cs @@ -1,10 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Buffers; -using System.Diagnostics; -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; +using System.Collections.Generic; +using System.Linq; using Xunit; namespace System.IO.Tests @@ -36,5 +34,108 @@ protected DirectoryInfo CreateSelfReferencingSymbolicLink() protected string GetRandomDirPath() => Path.Join(ActualTestDirectory.Value, GetRandomDirName()); private Lazy ActualTestDirectory => new Lazy(() => GetTestDirectoryActualCasing()); + + /// + /// Changes the current working directory path to a new temporary directory. + /// Important: Make sure to call this inside a remote executor to avoid changing the cwd for all tests in same process. + /// + /// The path of the new cwd. + protected string ChangeCurrentDirectory() + { + string tempCwd = GetRandomDirPath(); + Directory.CreateDirectory(tempCwd); + Directory.SetCurrentDirectory(tempCwd); + return tempCwd; + } + + public static IEnumerable SymbolicLink_LinkTarget_PathToTarget_Data + { + get + { + foreach (string path in PathToTargetData.Union(PathToTargetUncData)) + { + yield return new object[] { path }; + } + } + } + + public static IEnumerable SymbolicLink_ResolveLinkTarget_PathToTarget_Data + { + get + { + foreach (string path in PathToTargetData.Union(PathToTargetUncData)) + { + yield return new object[] { path, false }; + yield return new object[] { path, true }; + } + } + } + + // Junctions doesn't support remote shares. + public static IEnumerable Junction_LinkTarget_PathToTarget_Data + { + get + { + foreach (string path in PathToTargetData) + { + yield return new object[] { path }; + } + } + } + + public static IEnumerable Junction_ResolveLinkTarget_PathToTarget_Data + { + get + { + foreach (string path in PathToTargetData) + { + yield return new object[] { path, false }; + yield return new object[] { path, true }; + } + } + } + + internal static IEnumerable PathToTargetData + { + get + { + if (OperatingSystem.IsWindows()) + { + //Non-rooted relative + yield return "foo"; + yield return @".\foo"; + yield return @"..\foo"; + // Rooted relative + yield return @"\foo"; + // Rooted absolute + yield return Path.Combine(Path.GetTempPath(), "foo"); + // Extended DOS + yield return Path.Combine(@"\\?\", Path.GetTempPath(), "foo"); + } + else + { + //Non-rooted relative + yield return "foo"; + yield return "./foo"; + yield return "../foo"; + // Rooted relative + yield return "/foo"; + // Rooted absolute + Path.Combine(Path.GetTempPath(), "foo"); + } + } + } + + internal static IEnumerable PathToTargetUncData + { + get + { + if (OperatingSystem.IsWindows()) + { + // UNC/Remote Share + yield return @"\\LOCALHOST\share\path"; + } + } + } } } diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs b/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs index fb3a74305bca2c..4e53a93a4e03a9 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/CreateDirectory.cs @@ -270,8 +270,10 @@ public void DirectoryLongerThanMaxLongPathWithExtendedSyntax_ThrowsException() { var paths = IOInputs.GetPathsLongerThanMaxLongPath(GetTestFilePath(), useExtendedSyntax: true); + // Ideally this should be PathTooLongException or DirectoryNotFoundException but on some machines + // windows gives us ERROR_INVALID_NAME, producing IOException. Assert.All(paths, path => - AssertExtensions.ThrowsAny(() => Create(path))); + AssertExtensions.ThrowsAny(() => Create(path))); } [ConditionalFact(nameof(LongPathsAreNotBlocked), nameof(UsingNewNormalization))] diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/GetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/Directory/GetSetTimes.cs index 0a23d638c138af..1fc00ba74249d6 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/GetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/GetSetTimes.cs @@ -7,7 +7,9 @@ namespace System.IO.Tests { public class Directory_GetSetTimes : StaticGetSetTimes { - protected override string GetExistingItem() => Directory.CreateDirectory(GetTestFilePath()).FullName; + protected override bool CanBeReadOnly => false; + + protected override string GetExistingItem(bool _) => Directory.CreateDirectory(GetTestFilePath()).FullName; public override IEnumerable TimeFunctions(bool requiresRoundtripping = false) { diff --git a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetTimes.cs index 2dad268a79a460..c45c6169ada958 100644 --- a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetTimes.cs @@ -7,7 +7,9 @@ namespace System.IO.Tests { public class DirectoryInfo_GetSetTimes : InfoGetSetTimes { - protected override DirectoryInfo GetExistingItem() => Directory.CreateDirectory(GetTestFilePath()); + protected override bool CanBeReadOnly => false; + + protected override DirectoryInfo GetExistingItem(bool _) => Directory.CreateDirectory(GetTestFilePath()); protected override DirectoryInfo GetMissingItem() => new DirectoryInfo(GetTestFilePath()); diff --git a/src/libraries/System.IO.FileSystem/tests/Enumeration/SpecialDirectoryTests.cs b/src/libraries/System.IO.FileSystem/tests/Enumeration/SpecialDirectoryTests.cs index 39a747179481a8..dbf3eb3b8ad3d0 100644 --- a/src/libraries/System.IO.FileSystem/tests/Enumeration/SpecialDirectoryTests.cs +++ b/src/libraries/System.IO.FileSystem/tests/Enumeration/SpecialDirectoryTests.cs @@ -60,7 +60,14 @@ public void SkippingHiddenFiles() { // Files that begin with periods are considered hidden on Unix string[] paths = GetNames(TestDirectory, new EnumerationOptions { ReturnSpecialDirectories = true, AttributesToSkip = 0 }); - Assert.Contains(".", paths); + + if (!PlatformDetection.IsWindows10Version20348OrGreater) + { + // Sometimes this is not returned - presumably an OS bug. + // This occurs often on Windows 11, very rarely otherwise. + Assert.Contains(".", paths); + } + Assert.Contains("..", paths); } } diff --git a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.Windows.cs b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.Windows.cs new file mode 100644 index 00000000000000..015ba30b6ad7c1 --- /dev/null +++ b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.Windows.cs @@ -0,0 +1,85 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.DotNet.XUnitExtensions; +using System.Diagnostics; +using System.Diagnostics.Eventing.Reader; +using System.Linq; +using System.Security; +using System.ServiceProcess; +using Xunit; +using Xunit.Abstractions; + +namespace System.IO.Tests +{ + public partial class EncryptDecrypt + { + partial void EnsureEFSServiceStarted() + { + try + { + using var sc = new ServiceController("EFS"); + _output.WriteLine($"EFS service is: {sc.Status}"); + if (sc.Status != ServiceControllerStatus.Running) + { + _output.WriteLine("Trying to start EFS service"); + sc.Start(); + _output.WriteLine($"EFS service is now: {sc.Status}"); + } + } + catch (Exception e) + { + _output.WriteLine(e.ToString()); + } + } + + partial void LogEFSDiagnostics() + { + int hours = 1; // how many hours to look backwards + string query = @$" + + + + + + + *[System[TimeCreated[timediff(@SystemTime) >= {hours * 60 * 60 * 1000L}]]] + + + "; + + var eventQuery = new EventLogQuery("System", PathType.LogName, query); + + using var eventReader = new EventLogReader(eventQuery); + + EventRecord record = eventReader.ReadEvent(); + var garbage = new string[] { "Background Intelligent", "Intel", "Defender", "Intune", "BITS", "NetBT"}; + + _output.WriteLine("===== Dumping recent relevant events: ====="); + while (record != null) + { + string description = ""; + try + { + description = record.FormatDescription(); + } + catch (EventLogException) { } + + if (!garbage.Any(term => description.Contains(term, StringComparison.OrdinalIgnoreCase))) + { + _output.WriteLine($"{record.TimeCreated} {record.ProviderName} [{record.LevelDisplayName} {record.Id}] {description.Replace("\r\n", " ")}"); + } + + record = eventReader.ReadEvent(); + } + + _output.WriteLine("==== Finished dumping ====="); + } + } +} diff --git a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs index 984afef972bc41..1dbac453e48297 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs @@ -1,17 +1,28 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.DotNet.XUnitExtensions; using System.Diagnostics; +using System.Diagnostics.Eventing.Reader; using System.Security; +using System.ServiceProcess; using Xunit; +using Xunit.Abstractions; namespace System.IO.Tests { [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - public class EncryptDecrypt : FileSystemTest + public partial class EncryptDecrypt : FileSystemTest { + private readonly ITestOutputHelper _output; + + public EncryptDecrypt(ITestOutputHelper output) + { + _output = output; + } + [Fact] - public static void NullArg_ThrowsException() + public void NullArg_ThrowsException() { AssertExtensions.Throws("path", () => File.Encrypt(null)); AssertExtensions.Throws("path", () => File.Decrypt(null)); @@ -19,7 +30,7 @@ public static void NullArg_ThrowsException() [SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp)] [Fact] - public static void EncryptDecrypt_NotSupported() + public void EncryptDecrypt_NotSupported() { Assert.Throws(() => File.Encrypt("path")); Assert.Throws(() => File.Decrypt("path")); @@ -29,7 +40,8 @@ public static void EncryptDecrypt_NotSupported() // because EFS (Encrypted File System), its underlying technology, is not available on these operating systems. [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotWindowsHomeEdition))] [PlatformSpecific(TestPlatforms.Windows)] - public static void EncryptDecrypt_Read() + [OuterLoop] // Occasional failures: https://github.com/dotnet/runtime/issues/12339 + public void EncryptDecrypt_Read() { string tmpFileName = Path.GetTempFileName(); string textContentToEncrypt = "Content to encrypt"; @@ -39,14 +51,26 @@ public static void EncryptDecrypt_Read() string fileContentRead = File.ReadAllText(tmpFileName); Assert.Equal(textContentToEncrypt, fileContentRead); + EnsureEFSServiceStarted(); + try { File.Encrypt(tmpFileName); } - catch (IOException e) when (e.HResult == unchecked((int)0x80070490)) + catch (IOException e) when (e.HResult == unchecked((int)0x80070490) || + e.HResult == unchecked((int)0x80071776) || + e.HResult == unchecked((int)0x800701AE)) { // Ignore ERROR_NOT_FOUND 1168 (0x490). It is reported when EFS is disabled by domain policy. - return; + // Ignore ERROR_NO_USER_KEYS (0x1776). This occurs when no user key exists to encrypt with. + // Ignore ERROR_ENCRYPTION_DISABLED (0x1AE). This occurs when EFS is disabled by group policy on the volume. + throw new SkipTestException($"Encrypt not available. Error 0x{e.HResult:X}"); + } + catch (IOException e) + { + _output.WriteLine($"Encrypt failed with {e.Message} 0x{e.HResult:X}"); + LogEFSDiagnostics(); + throw; } Assert.Equal(fileContentRead, File.ReadAllText(tmpFileName)); @@ -61,5 +85,9 @@ public static void EncryptDecrypt_Read() File.Delete(tmpFileName); } } + + partial void EnsureEFSServiceStarted(); // no-op on Unix + + partial void LogEFSDiagnostics(); // no-op on Unix currently } } diff --git a/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs index 67a13bcf7df2b5..f27e79da3f565a 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs @@ -11,14 +11,22 @@ namespace System.IO.Tests { public class File_GetSetTimes : StaticGetSetTimes { + protected override bool CanBeReadOnly => true; + // OSX has the limitation of setting upto 2262-04-11T23:47:16 (long.Max) date. // 32bit Unix has time_t up to ~ 2038. private static bool SupportsLongMaxDateTime => PlatformDetection.IsWindows || (!PlatformDetection.Is32BitProcess && !PlatformDetection.IsOSXLike); - protected override string GetExistingItem() + protected override string GetExistingItem(bool readOnly = false) { string path = GetTestFilePath(); File.Create(path).Dispose(); + + if (readOnly) + { + File.SetAttributes(path, FileAttributes.ReadOnly); + } + return path; } diff --git a/src/libraries/System.IO.FileSystem/tests/File/Open.cs b/src/libraries/System.IO.FileSystem/tests/File/Open.cs index d014cf0efb94d8..bd9b38b121b886 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/Open.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/Open.cs @@ -42,15 +42,14 @@ protected override FileStream CreateFileStream(string path, FileMode mode, FileA } } - public class File_Open_str_options_as : FileStream_ctor_options_as + public class File_Open_str_options : FileStream_ctor_options { protected override FileStream CreateFileStream(string path, FileMode mode) { return File.Open(path, new FileStreamOptions { Mode = mode, - Access = mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite, - PreallocationSize = PreallocationSize + Access = mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite }); } @@ -59,12 +58,23 @@ protected override FileStream CreateFileStream(string path, FileMode mode, FileA return File.Open(path, new FileStreamOptions { Mode = mode, - Access = access, - PreallocationSize = PreallocationSize + Access = access }); } protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) + { + return File.Open(path, + new FileStreamOptions { + Mode = mode, + Access = access, + Share = share, + Options = options, + BufferSize = bufferSize + }); + } + + protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, long preallocationSize) { return File.Open(path, new FileStreamOptions { @@ -73,7 +83,7 @@ protected override FileStream CreateFileStream(string path, FileMode mode, FileA Share = share, Options = options, BufferSize = bufferSize, - PreallocationSize = PreallocationSize + PreallocationSize = preallocationSize }); } } diff --git a/src/libraries/System.IO.FileSystem/tests/File/OpenHandle.cs b/src/libraries/System.IO.FileSystem/tests/File/OpenHandle.cs index a8b3619fb51cf7..120ed9aec222ef 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/OpenHandle.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/OpenHandle.cs @@ -7,28 +7,24 @@ namespace System.IO.Tests { // to avoid a lot of code duplication, we reuse FileStream tests - public class File_OpenHandle : FileStream_ctor_options_as + public class File_OpenHandle : FileStream_ctor_options { protected override string GetExpectedParamName(string paramName) => paramName; protected override FileStream CreateFileStream(string path, FileMode mode) { FileAccess access = mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite; - return new FileStream(File.OpenHandle(path, mode, access, preallocationSize: PreallocationSize), access); + return new FileStream(File.OpenHandle(path, mode, access), access); } protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access) - => new FileStream(File.OpenHandle(path, mode, access, preallocationSize: PreallocationSize), access); + => new FileStream(File.OpenHandle(path, mode, access), access); protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) - => new FileStream(File.OpenHandle(path, mode, access, share, options, PreallocationSize), access, bufferSize, (options & FileOptions.Asynchronous) != 0); + => new FileStream(File.OpenHandle(path, mode, access, share, options), access, bufferSize, (options & FileOptions.Asynchronous) != 0); - [Fact] - public override void NegativePreallocationSizeThrows() - { - ArgumentOutOfRangeException ex = Assert.Throws( - () => File.OpenHandle("validPath", FileMode.CreateNew, FileAccess.Write, FileShare.None, FileOptions.None, preallocationSize: -1)); - } + protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, long preallocationSize) + => new FileStream(File.OpenHandle(path, mode, access, share, options, preallocationSize), access, bufferSize, (options & FileOptions.Asynchronous) != 0); [ActiveIssue("https://github.com/dotnet/runtime/issues/53432")] [Theory, MemberData(nameof(StreamSpecifiers))] diff --git a/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs b/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs index 54c76437663353..a7815dd40eb126 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs @@ -2,8 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Text; +using System.Threading; using System.Threading.Tasks; using Xunit; +using System.IO.Pipes; +using Microsoft.DotNet.XUnitExtensions; namespace System.IO.Tests { @@ -54,21 +57,6 @@ public void ValidWrite(int size) File.Delete(path); } - [Fact] - [OuterLoop] - [ActiveIssue("https://github.com/dotnet/runtime/issues/45954", TestPlatforms.Browser)] - public void ReadFileOver2GB() - { - string path = GetTestFilePath(); - using (FileStream fs = File.Create(path)) - { - fs.SetLength(int.MaxValue + 1L); - } - - // File is too large for ReadAllBytes at once - Assert.Throws(() => File.ReadAllBytes(path)); - } - [Fact] public void Overwrite() { @@ -172,5 +160,30 @@ public void ProcFs_NotEmpty(string path) { Assert.InRange(File.ReadAllBytes(path).Length, 1, int.MaxValue); } + + [Fact] + [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] + public async Task ReadAllBytes_NonSeekableFileStream_InUnix() + { + string fifoPath = GetTestFilePath(); + Assert.Equal(0, mkfifo(fifoPath, 438 /* 666 in octal */ )); + + var contentBytes = new byte[] { 1, 2, 3 }; + + await Task.WhenAll( + Task.Run(() => + { + byte[] readBytes = File.ReadAllBytes(fifoPath); + Assert.Equal(contentBytes, readBytes); + }), + Task.Run(() => + { + using var fs = new FileStream(fifoPath, FileMode.Open, FileAccess.Write, FileShare.Read); + foreach (byte content in contentBytes) + { + fs.WriteByte(content); + } + })); + } } } diff --git a/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs b/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs index 748c01dbffb8f6..c4f147cbb80092 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs @@ -5,6 +5,7 @@ using System.Threading; using System.Threading.Tasks; using Xunit; +using System.IO.Pipes; namespace System.IO.Tests { @@ -68,21 +69,6 @@ public Task AlreadyCanceledAsync() async () => await File.WriteAllBytesAsync(path, new byte[0], token)); } - [Fact] - [OuterLoop] - [ActiveIssue("https://github.com/dotnet/runtime/issues/45954", TestPlatforms.Browser)] - public Task ReadFileOver2GBAsync() - { - string path = GetTestFilePath(); - using (FileStream fs = File.Create(path)) - { - fs.SetLength(int.MaxValue + 1L); - } - - // File is too large for ReadAllBytes at once - return Assert.ThrowsAsync(async () => await File.ReadAllBytesAsync(path)); - } - [Fact] public async Task OverwriteAsync() { @@ -186,5 +172,61 @@ public async Task ProcFs_NotEmpty(string path) { Assert.InRange((await File.ReadAllBytesAsync(path)).Length, 1, int.MaxValue); } + + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] // DOS device paths (\\.\ and \\?\) are a Windows concept + public async Task ReadAllBytesAsync_NonSeekableFileStream_InWindows() + { + string pipeName = FileSystemTest.GetNamedPipeServerStreamName(); + string pipePath = Path.GetFullPath($@"\\.\pipe\{pipeName}"); + + var namedPipeWriterStream = new NamedPipeServerStream(pipeName, PipeDirection.Out); + var contentBytes = new byte[] { 1, 2, 3 }; + + using (var cts = new CancellationTokenSource()) + { + Task writingServerTask = WaitConnectionAndWritePipeStreamAsync(namedPipeWriterStream, contentBytes, cts.Token); + Task readTask = File.ReadAllBytesAsync(pipePath, cts.Token); + cts.CancelAfter(TimeSpan.FromSeconds(50)); + + await writingServerTask; + byte[] readBytes = await readTask; + Assert.Equal(contentBytes, readBytes); + } + + static async Task WaitConnectionAndWritePipeStreamAsync(NamedPipeServerStream namedPipeWriterStream, byte[] contentBytes, CancellationToken cancellationToken) + { + await using (namedPipeWriterStream) + { + await namedPipeWriterStream.WaitForConnectionAsync(cancellationToken); + await namedPipeWriterStream.WriteAsync(contentBytes, cancellationToken); + } + } + } + + [Fact] + [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] + public async Task ReadAllBytesAsync_NonSeekableFileStream_InUnix() + { + string fifoPath = GetTestFilePath(); + Assert.Equal(0, mkfifo(fifoPath, 438 /* 666 in octal */ )); + + var contentBytes = new byte[] { 1, 2, 3 }; + + await Task.WhenAll( + Task.Run(async () => + { + byte[] readBytes = await File.ReadAllBytesAsync(fifoPath); + Assert.Equal(contentBytes, readBytes); + }), + Task.Run(() => + { + using var fs = new FileStream(fifoPath, FileMode.Open, FileAccess.Write, FileShare.Read); + foreach (byte content in contentBytes) + { + fs.WriteByte(content); + } + })); + } } } diff --git a/src/libraries/System.IO.FileSystem/tests/File/SymbolicLinks.cs b/src/libraries/System.IO.FileSystem/tests/File/SymbolicLinks.cs index 4c41fa7bb16576..e879cb353af73d 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/SymbolicLinks.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/SymbolicLinks.cs @@ -45,6 +45,21 @@ protected override void AssertLinkExists(FileSystemInfo link) => public void ResolveLinkTarget_Throws_NotExists() => ResolveLinkTarget_Throws_NotExists_Internal(); + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] + public void UnsupportedLink_ReturnsNull() + { + string unsupportedLinkPath = GetAppExecLinkPath(); + if (unsupportedLinkPath is null) + { + return; + } + + Assert.Null(File.ResolveLinkTarget(unsupportedLinkPath, false)); + Assert.Null(File.ResolveLinkTarget(unsupportedLinkPath, true)); + } + + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CreateSymbolicLink_PathToTarget_RelativeToLinkPath() { diff --git a/src/libraries/System.IO.FileSystem/tests/FileInfo/GetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/FileInfo/GetSetTimes.cs index d3b9764951cbfd..1ca30617292ebd 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileInfo/GetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileInfo/GetSetTimes.cs @@ -10,10 +10,18 @@ namespace System.IO.Tests { public class FileInfo_GetSetTimes : InfoGetSetTimes { - protected override FileInfo GetExistingItem() + protected override bool CanBeReadOnly => true; + + protected override FileInfo GetExistingItem(bool readOnly = false) { string path = GetTestFilePath(); File.Create(path).Dispose(); + + if (readOnly) + { + File.SetAttributes(path, FileAttributes.ReadOnly); + } + return new FileInfo(path); } diff --git a/src/libraries/System.IO.FileSystem/tests/FileInfo/Open.cs b/src/libraries/System.IO.FileSystem/tests/FileInfo/Open.cs index 2324a92eafce4f..36fd39a6000564 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileInfo/Open.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileInfo/Open.cs @@ -74,15 +74,14 @@ protected override FileStream CreateFileStream(string path, FileMode mode, FileA } } - public class FileInfo_Open_options_as : FileStream_ctor_options_as + public class FileInfo_Open_options : FileStream_ctor_options { protected override FileStream CreateFileStream(string path, FileMode mode) { return new FileInfo(path).Open( new FileStreamOptions { Mode = mode, - Access = mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite, - PreallocationSize = PreallocationSize + Access = mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite }); } @@ -91,12 +90,23 @@ protected override FileStream CreateFileStream(string path, FileMode mode, FileA return new FileInfo(path).Open( new FileStreamOptions { Mode = mode, - Access = access, - PreallocationSize = PreallocationSize + Access = access }); } protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) + { + return new FileInfo(path).Open( + new FileStreamOptions { + Mode = mode, + Access = access, + Share = share, + Options = options, + BufferSize = bufferSize + }); + } + + protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, long preallocationSize) { return new FileInfo(path).Open( new FileStreamOptions { @@ -105,7 +115,7 @@ protected override FileStream CreateFileStream(string path, FileMode mode, FileA Share = share, Options = options, BufferSize = bufferSize, - PreallocationSize = PreallocationSize + PreallocationSize = preallocationSize }); } } diff --git a/src/libraries/System.IO.FileSystem/tests/FileInfo/SymbolicLinks.cs b/src/libraries/System.IO.FileSystem/tests/FileInfo/SymbolicLinks.cs index fa334dd1ca376d..914edd06a1ba65 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileInfo/SymbolicLinks.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileInfo/SymbolicLinks.cs @@ -41,6 +41,24 @@ protected override void AssertLinkExists(FileSystemInfo link) => public void ResolveLinkTarget_Throws_NotExists() => ResolveLinkTarget_Throws_NotExists_Internal(); + + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] + public void UnsupportedLink_ReturnsNull() + { + string unsupportedLinkPath = GetAppExecLinkPath(); + if (unsupportedLinkPath is null) + { + return; + } + + var info = new FileInfo(unsupportedLinkPath); + + Assert.Null(info.LinkTarget); + Assert.Null(info.ResolveLinkTarget(false)); + Assert.Null(info.ResolveLinkTarget(true)); + } + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void CreateSymbolicLink_PathToTarget_RelativeToLinkPath() { diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/DevicesPipesAndSockets.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/DevicesPipesAndSockets.cs new file mode 100644 index 00000000000000..ede852c7305b3f --- /dev/null +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/DevicesPipesAndSockets.cs @@ -0,0 +1,219 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.DotNet.XUnitExtensions; +using Microsoft.Win32.SafeHandles; +using System.Collections.Generic; +using System.IO.Pipes; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Tests +{ + [PlatformSpecific(TestPlatforms.AnyUnix)] + public class DevicesPipesAndSockets : FileSystemTest + { + [Theory] + [MemberData(nameof(DevicePath_FileOptions_TestData))] + public void CharacterDevice_FileStream_Write(string devicePath, FileOptions fileOptions) + { + FileStreamOptions options = new() { Options = fileOptions, Access = FileAccess.Write, Share = FileShare.Write }; + using FileStream fs = new(devicePath, options); + fs.Write(Encoding.UTF8.GetBytes("foo")); + } + + [Theory] + [MemberData(nameof(DevicePath_FileOptions_TestData))] + public async Task CharacterDevice_FileStream_WriteAsync(string devicePath, FileOptions fileOptions) + { + FileStreamOptions options = new() { Options = fileOptions, Access = FileAccess.Write, Share = FileShare.Write }; + using FileStream fs = new(devicePath, options); + await fs.WriteAsync(Encoding.UTF8.GetBytes("foo")); + } + + [Theory] + [MemberData(nameof(DevicePath_TestData))] + public void CharacterDevice_WriteAllBytes(string devicePath) + { + File.WriteAllBytes(devicePath, Encoding.UTF8.GetBytes("foo")); + } + + [Theory] + [MemberData(nameof(DevicePath_TestData))] + public async Task CharacterDevice_WriteAllBytesAsync(string devicePath) + { + await File.WriteAllBytesAsync(devicePath, Encoding.UTF8.GetBytes("foo")); + } + + [Theory] + [MemberData(nameof(DevicePath_TestData))] + public void CharacterDevice_WriteAllText(string devicePath) + { + File.WriteAllText(devicePath, "foo"); + } + + [Theory] + [MemberData(nameof(DevicePath_TestData))] + public async Task CharacterDevice_WriteAllTextAsync(string devicePath) + { + await File.WriteAllTextAsync(devicePath, "foo"); + } + + [Fact] + [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] + public async Task NamedPipe_ReadWrite() + { + string fifoPath = GetTestFilePath(); + Assert.Equal(0, mkfifo(fifoPath, 438 /* 666 in octal */ )); + + await Task.WhenAll( + Task.Run(() => + { + using var fs = new FileStream(fifoPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + ReadByte(fs, 42); + }), + Task.Run(() => + { + using var fs = new FileStream(fifoPath, FileMode.Open, FileAccess.Write, FileShare.Read); + WriteByte(fs, 42); + })); + } + + [Fact] + [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] + public async Task NamedPipe_ReadWrite_Async() + { + string fifoPath = GetTestFilePath(); + Assert.Equal(0, mkfifo(fifoPath, 438 /* 666 in octal */ )); + + await Task.WhenAll( + Task.Run(async () => { + using var fs = new FileStream(fifoPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + await ReadByteAsync(fs, 42); + }), + Task.Run(async () => + { + using var fs = new FileStream(fifoPath, FileMode.Open, FileAccess.Write, FileShare.Read); + await WriteByteAsync(fs, 42); + })); + } + + private const int AF_UNIX = 1; + private const int SOCK_STREAM = 1; + + [Fact] + [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] + public unsafe void SocketPair_ReadWrite() + { + int* ptr = stackalloc int[2]; + Assert.Equal(0, socketpair(AF_UNIX, SOCK_STREAM, 0, ptr)); + + using var readFileStream = new FileStream(new SafeFileHandle((IntPtr)ptr[0], ownsHandle: true), FileAccess.Read); + using var writeFileStream = new FileStream(new SafeFileHandle((IntPtr)ptr[1], ownsHandle: true), FileAccess.Write); + + Task.WhenAll( + Task.Run(() => ReadByte(readFileStream, 42)), + Task.Run(() => WriteByte(writeFileStream, 42))).GetAwaiter().GetResult(); + } + + [Fact] + [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] + public void SocketPair_ReadWrite_Async() + { + unsafe + { + int* ptr = stackalloc int[2]; + Assert.Equal(0, socketpair(AF_UNIX, SOCK_STREAM, 0, ptr)); + + using var readFileStream = new FileStream(new SafeFileHandle((IntPtr)ptr[0], ownsHandle: true), FileAccess.Read); + using var writeFileStream = new FileStream(new SafeFileHandle((IntPtr)ptr[1], ownsHandle: true), FileAccess.Write); + + Task.WhenAll( + ReadByteAsync(readFileStream, 42), + WriteByteAsync(writeFileStream, 42)).GetAwaiter().GetResult(); + } + } + + private static void ReadByte(FileStream fs, byte expected) + { + var buffer = new byte[1]; + Assert.Equal(1, fs.Read(buffer)); + Assert.Equal(expected, buffer[0]); + } + + private static void WriteByte(FileStream fs, byte value) + { + fs.Write(new byte[] { value }); + fs.Flush(); + } + + private static async Task ReadByteAsync(FileStream fs, byte expected) + { + var buffer = new byte[1]; + Assert.Equal(1, await fs.ReadAsync(buffer)); + Assert.Equal(expected, buffer[0]); + } + + private static async Task WriteByteAsync(FileStream fs, byte value) + { + await fs.WriteAsync(new byte[] { value }); + await fs.FlushAsync(); + } + + private static Lazy> AvailableDevicePaths = new Lazy>(() => + { + List paths = new(); + FileStreamOptions options = new() { Access = FileAccess.Write, Share = FileShare.Write }; + + foreach (string devicePath in new[] { "/dev/tty", "/dev/console", "/dev/null", "/dev/zero" }) + { + if (!File.Exists(devicePath)) + { + continue; + } + + try + { + File.Open(devicePath, options).Dispose(); + } + catch (Exception ex) + { + if (ex is IOException || ex is UnauthorizedAccessException) + { + continue; + } + + throw; + } + + paths.Add(devicePath); + } + + return paths; + }); + + public static IEnumerable DevicePath_FileOptions_TestData() + { + foreach (string devicePath in AvailableDevicePaths.Value) + { + foreach (FileOptions options in new[] { FileOptions.None, FileOptions.Asynchronous }) + { + yield return new object[] { devicePath, options}; + } + } + } + + public static IEnumerable DevicePath_TestData() + { + foreach (string devicePath in AvailableDevicePaths.Value) + { + yield return new object[] { devicePath }; + } + } + + [DllImport("libc")] + private static unsafe extern int socketpair(int domain, int type, int protocol, int* ptr); + } +} diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/Dispose.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/Dispose.cs index 2a94247dc04144..27cd858a1feba9 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/Dispose.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/Dispose.cs @@ -2,21 +2,21 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; -using System; -using System.Diagnostics; -using System.IO; using Microsoft.DotNet.RemoteExecutor; using Xunit; +using System.Collections.Generic; +using System.Threading.Tasks; namespace System.IO.Tests { + [Collection("NoParallelTests")] // make sure no other tests are calling GC.Collect() public class FileStream_Dispose : FileSystemTest { [Fact] public void DisposeClosesHandle() { SafeFileHandle handle; - using(FileStream fs = new FileStream(GetTestFilePath(), FileMode.Create)) + using (FileStream fs = new FileStream(GetTestFilePath(), FileMode.Create)) { handle = fs.SafeFileHandle; } @@ -199,7 +199,7 @@ public void Finalizer_CallsVirtualDispose_FalseArg() public void DisposeFlushesWriteBuffer() { string fileName = GetTestFilePath(); - using(FileStream fs = new FileStream(fileName, FileMode.Create)) + using (FileStream fs = new FileStream(fileName, FileMode.Create)) { fs.Write(TestBuffer, 0, TestBuffer.Length); } @@ -213,20 +213,143 @@ public void DisposeFlushesWriteBuffer() } } + public class DerivedFileStreamWithFinalizer : FileStream + { + public static int DisposeTrueCalled = 0; + public static int DisposeFalseCalled = 0; + + public DerivedFileStreamWithFinalizer(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) + : base(path, mode, access, share, bufferSize, options) + { + } + + public DerivedFileStreamWithFinalizer(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) + : base(handle, access, bufferSize, isAsync) + { + } + + public DerivedFileStreamWithFinalizer(IntPtr handle, FileAccess access, bool ownsHandle) +#pragma warning disable CS0618 // Type or member is obsolete + : base(handle, access, ownsHandle) +#pragma warning restore CS0618 // Type or member is obsolete + { + } + + ~DerivedFileStreamWithFinalizer() => Dispose(false); + + protected override void Dispose(bool disposing) + { + if (disposing) + { + DisposeTrueCalled++; + } + else + { + DisposeFalseCalled++; + } + + base.Dispose(disposing); + } + } + + public class DerivedFileStreamWithoutFinalizer : FileStream + { + public static int DisposeTrueCalled = 0; + public static int DisposeFalseCalled = 0; + + public DerivedFileStreamWithoutFinalizer(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) + : base(path, mode, access, share, bufferSize, options) + { + } + + public DerivedFileStreamWithoutFinalizer(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) + : base(handle, access, bufferSize, isAsync) + { + } + + public DerivedFileStreamWithoutFinalizer(IntPtr handle, FileAccess access, bool ownsHandle) +#pragma warning disable CS0618 // Type or member is obsolete + : base(handle, access, ownsHandle) +#pragma warning restore CS0618 // Type or member is obsolete + { + } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + DisposeTrueCalled++; + } + else + { + DisposeFalseCalled++; + } + + base.Dispose(disposing); + } + } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] public void FinalizeFlushesWriteBuffer() + => VerifyFlushedBufferOnFinalization( + filePath => new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete, bufferSize: 4096, useAsync: false)); + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + public void FinalizeFlushesWriteBufferForDerivedFileStreamWithFinalizerCreatedFromPath() + => VerifyFlushedBufferOnFinalization( + filePath => new DerivedFileStreamWithFinalizer(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete, bufferSize: 4096, FileOptions.None)); + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + public void FinalizeFlushesWriteBufferForDerivedFileStreamWithFinalizerCreatedFromSafeFileHandle() + => VerifyFlushedBufferOnFinalization( + filePath => new DerivedFileStreamWithFinalizer( + File.OpenHandle(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete, FileOptions.None), + FileAccess.Write, bufferSize: 4096, isAsync: false)); + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + public void FinalizeFlushesWriteBufferForDerivedFileStreamWithFinalizerCreatedFromIntPtr() + => VerifyFlushedBufferOnFinalization( + filePath => new DerivedFileStreamWithFinalizer( + File.OpenHandle(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete, FileOptions.None).DangerousGetHandle(), + FileAccess.Write, + ownsHandle: true)); + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + public void FinalizeFlushesWriteBufferForDerivedFileStreamWithoutFinalizerCreatedFromPath() + => VerifyFlushedBufferOnFinalization( + filePath => new DerivedFileStreamWithoutFinalizer(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete, bufferSize: 4096, FileOptions.None)); + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + public void FinalizeFlushesWriteBufferForDerivedFileStreamWithoutFinalizerCreatedFromSafeFileHandle() + => VerifyFlushedBufferOnFinalization( + filePath => new DerivedFileStreamWithoutFinalizer( + File.OpenHandle(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete, FileOptions.None), + FileAccess.Write, bufferSize: 4096, isAsync: false)); + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + public void FinalizeFlushesWriteBufferForDerivedFileStreamWithoutFinalizerCreatedFromIntPtr() + => VerifyFlushedBufferOnFinalization( + filePath => new DerivedFileStreamWithoutFinalizer( + File.OpenHandle(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete, FileOptions.None).DangerousGetHandle(), + FileAccess.Write, + ownsHandle: true)); + + private void VerifyFlushedBufferOnFinalization(Func factory) { string fileName = GetTestFilePath(); // use a separate method to be sure that fs isn't rooted at time of GC. - Action leakFs = () => + Func leakFs = filePath => { // we must specify useAsync:false, otherwise the finalizer just kicks off an async write. - FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete, bufferSize: 4096, useAsync: false); + FileStream fs = factory(filePath); fs.Write(TestBuffer, 0, TestBuffer.Length); - fs = null; + return fs.GetType(); }; - leakFs(); + + int beforeWithFinalizer = DerivedFileStreamWithFinalizer.DisposeFalseCalled; + int beforeWithoutFinalizer = DerivedFileStreamWithoutFinalizer.DisposeFalseCalled; + Type type = leakFs(fileName); GC.Collect(); GC.WaitForPendingFinalizers(); @@ -238,6 +361,97 @@ public void FinalizeFlushesWriteBuffer() fsr.Read(buffer, 0, buffer.Length); Assert.Equal(TestBuffer, buffer); } + + if (type == typeof(DerivedFileStreamWithFinalizer)) + { + // derived type finalizer implicitly calls base type finalizer, hence +2 + Assert.Equal(beforeWithFinalizer + 2, DerivedFileStreamWithFinalizer.DisposeFalseCalled); + Assert.Equal(0, DerivedFileStreamWithFinalizer.DisposeTrueCalled); + } + else if (type == typeof(DerivedFileStreamWithoutFinalizer)) + { + Assert.Equal(beforeWithoutFinalizer + 1, DerivedFileStreamWithoutFinalizer.DisposeFalseCalled); + Assert.Equal(0, DerivedFileStreamWithoutFinalizer.DisposeTrueCalled); + } + } + + // this type exists so DerivedFileStreamStrategy can be tested as well + public class DerivedFileStream : FileStream + { + public DerivedFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) + : base(path, mode, access, share, bufferSize, options) + { + } + } + + public static IEnumerable GetFileStreamDisposeSuppressesStrategyFinalizationArgs() + { + foreach (int bufferSize in new[] { 1, 4096 }) + { + foreach (FileOptions fileOptions in new[] { FileOptions.Asynchronous, FileOptions.None }) + { + yield return new object[] { bufferSize, fileOptions }; + } + } + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + [MemberData(nameof(GetFileStreamDisposeSuppressesStrategyFinalizationArgs))] + public Task DisposeSuppressesStrategyFinalization(int bufferSize, FileOptions options) + => VerifyStrategyFinalization( + () => new FileStream(GetTestFilePath(), FileMode.Create, FileAccess.Write, FileShare.None, bufferSize, options | FileOptions.DeleteOnClose), + false); + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + [MemberData(nameof(GetFileStreamDisposeSuppressesStrategyFinalizationArgs))] + public Task DisposeSuppressesStrategyFinalizationAsync(int bufferSize, FileOptions options) + => VerifyStrategyFinalization( + () => new FileStream(GetTestFilePath(), FileMode.Create, FileAccess.Write, FileShare.None, bufferSize, options | FileOptions.DeleteOnClose), + true); + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + [MemberData(nameof(GetFileStreamDisposeSuppressesStrategyFinalizationArgs))] + public Task DerivedFileStreamDisposeSuppressesStrategyFinalization(int bufferSize, FileOptions options) + => VerifyStrategyFinalization( + () => new DerivedFileStream(GetTestFilePath(), FileMode.Create, FileAccess.Write, FileShare.None, bufferSize, options | FileOptions.DeleteOnClose), + false); + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] + [MemberData(nameof(GetFileStreamDisposeSuppressesStrategyFinalizationArgs))] + public Task DerivedFileStreamDisposeSuppressesStrategyFinalizationAsync(int bufferSize, FileOptions options) + => VerifyStrategyFinalization( + () => new DerivedFileStream(GetTestFilePath(), FileMode.Create, FileAccess.Write, FileShare.None, bufferSize, options | FileOptions.DeleteOnClose), + true); + + private static async Task VerifyStrategyFinalization(Func factory, bool useAsync) + { + WeakReference weakReference = await EnsureFileStreamIsNotRooted(factory, useAsync); + Assert.True(weakReference.IsAlive); + GC.Collect(); + Assert.False(weakReference.IsAlive); + + // separate method to avoid JIT lifetime-extension issues + static async Task EnsureFileStreamIsNotRooted(Func factory, bool useAsync) + { + FileStream fs = factory(); + WeakReference weakReference = new WeakReference( + (Stream)typeof(FileStream) + .GetField("_strategy", Reflection.BindingFlags.NonPublic | Reflection.BindingFlags.Instance) + .GetValue(fs), + trackResurrection: true); + + Assert.True(weakReference.IsAlive); + + if (useAsync) + { + await fs.DisposeAsync(); + } + { + fs.Dispose(); + } + + return weakReference; + } } } } diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ReadAsync.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ReadAsync.cs index 4e2fb6fd2046e7..86dc85034bdf46 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/ReadAsync.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/ReadAsync.cs @@ -11,7 +11,7 @@ namespace System.IO.Tests { public abstract class FileStream_AsyncReads : FileSystemTest { - protected abstract Task ReadAsync(FileStream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken = default); + protected abstract Task ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken = default); [Fact] public async Task EmptyFileReadAsyncSucceedSynchronously() @@ -132,19 +132,74 @@ public async Task IncompleteReadCantSetPositionBeyondEndOfFile(FileShare fileSha Assert.Equal(fileSize, fs.Position); } } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [InlineData(true, true)] + [InlineData(true, false)] + [InlineData(false, false)] + [InlineData(false, true)] + public async Task BypassingCacheInvalidatesCachedData(bool fsIsAsync, bool asyncReads) + { + const int BufferSize = 4096; + const int FileSize = BufferSize * 4; + string filePath = GetTestFilePath(); + byte[] content = RandomNumberGenerator.GetBytes(FileSize); + File.WriteAllBytes(filePath, content); + + await Test(new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, BufferSize, fsIsAsync)); + await Test(new BufferedStream(new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 0, fsIsAsync), BufferSize)); + + async Task Test(Stream stream) + { + try + { + // 1. Populates the private stream buffer, leaves bufferSize - 1 bytes available for next read. + await ReadAndAssertAsync(stream, 1); + // 2. Consumes all available data from the buffer, reads another bufferSize-many bytes from the disk and copies the 1 missing byte. + await ReadAndAssertAsync(stream, BufferSize); + // 3. Seek back by the number of bytes consumed from the buffer, all buffered data is now available for next read. + stream.Position -= 1; + // 4. Consume all buffered data. + await ReadAndAssertAsync(stream, BufferSize); + // 5. Bypass the cache (all buffered data has been consumed and we need bufferSize-many bytes). + // The cache should get invalidated now!! + await ReadAndAssertAsync(stream,BufferSize); + // 6. Seek back by just a few bytes. + stream.Position -= 9; + // 7. Perform a read, which should not use outdated buffered data. + await ReadAndAssertAsync(stream,BufferSize); + } + finally + { + await stream.DisposeAsync(); + } + } + + async Task ReadAndAssertAsync(Stream stream, int size) + { + var initialPosition = stream.Position; + var buffer = new byte[size]; + + var count = asyncReads + ? await ReadAsync(stream, buffer, 0, size) + : stream.Read(buffer); + + Assert.Equal(content.Skip((int)initialPosition).Take(count), buffer.Take(count)); + } + } } [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public class FileStream_ReadAsync_AsyncReads : FileStream_AsyncReads { - protected override Task ReadAsync(FileStream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => + protected override Task ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => stream.ReadAsync(buffer, offset, count, cancellationToken); } [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] public class FileStream_BeginEndRead_AsyncReads : FileStream_AsyncReads { - protected override Task ReadAsync(FileStream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => + protected override Task ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => Task.Factory.FromAsync( (callback, state) => stream.BeginRead(buffer, offset, count, callback, state), iar => stream.EndRead(iar), diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/SafeFileHandle.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/SafeFileHandle.cs index 0740eed02f0d85..0c49a52abbcf1e 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/SafeFileHandle.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/SafeFileHandle.cs @@ -78,6 +78,18 @@ public async Task ThrowWhenHandlePositionIsChanged_async() await ThrowWhenHandlePositionIsChanged(useAsync: true); } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsFileLockingEnabled))] + public void DeleteOnClose_FailedShareDoesNotDeleteFile() + { + string fileName = GetTestFilePath(); + + using SafeFileHandle handle = File.OpenHandle(fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None); + + Assert.Throws(() => File.OpenHandle(fileName, FileMode.Open, FileAccess.Write, FileShare.None, FileOptions.DeleteOnClose)); + + Assert.True(File.Exists(fileName)); + } + private async Task ThrowWhenHandlePositionIsChanged(bool useAsync) { string fileName = GetTestFilePath(); diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Browser.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Browser.cs new file mode 100644 index 00000000000000..45326d885c455d --- /dev/null +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Browser.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.IO.Tests +{ + public partial class FileStream_ctor_options + { + private static long GetAllocatedSize(FileStream fileStream) + { + return 0; + } + + private static bool SupportsPreallocation => false; + + private static bool IsGetAllocatedSizeImplemented => false; + } +} diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Unix.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Unix.cs new file mode 100644 index 00000000000000..c33c56a1fa5706 --- /dev/null +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Unix.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace System.IO.Tests +{ + public partial class FileStream_ctor_options + { + private static long GetAllocatedSize(FileStream fileStream) + { + bool isOSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + // Call 'stat' to get the number of blocks, and size of blocks. + using var px = Process.Start(new ProcessStartInfo + { + FileName = "stat", + ArgumentList = { isOSX ? "-f" : "-c", + isOSX ? "%b %k" : "%b %B", + fileStream.Name }, + RedirectStandardOutput = true + }); + string stdout = px.StandardOutput.ReadToEnd(); + + string[] parts = stdout.Split(' '); + return long.Parse(parts[0]) * long.Parse(parts[1]); + } + + private static bool SupportsPreallocation => + RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || + RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + + // Mobile platforms don't support Process.Start. + private static bool IsGetAllocatedSizeImplemented => !PlatformDetection.IsMobile; + } +} diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.Windows.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Windows.cs similarity index 71% rename from src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.Windows.cs rename to src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Windows.cs index bde8cd5e4692a3..2dca6baf22bd07 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.Windows.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.Windows.cs @@ -1,21 +1,17 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.IO.Pipes; using System.Runtime.InteropServices; using System.Text; +using System.Threading.Tasks; using Xunit; namespace System.IO.Tests { - public partial class FileStream_ctor_options_as : FileStream_ctor_options_as_base + public partial class FileStream_ctor_options { - protected override long PreallocationSize => 10; - - protected override long InitialLength => 0; // Windows modifies AllocationSize, but not EndOfFile (file length) - - private long GetExpectedFileLength(long preallocationSize) => 0; // Windows modifies AllocationSize, but not EndOfFile (file length) - - private unsafe long GetActualPreallocationSize(FileStream fileStream) + private unsafe long GetAllocatedSize(FileStream fileStream) { Interop.Kernel32.FILE_STANDARD_INFO info; @@ -24,6 +20,10 @@ private unsafe long GetActualPreallocationSize(FileStream fileStream) return info.AllocationSize; } + private static bool SupportsPreallocation => true; + + private static bool IsGetAllocatedSizeImplemented => true; + [Theory] [InlineData(@"\\?\")] [InlineData(@"\??\")] @@ -32,26 +32,26 @@ public void ExtendedPathsAreSupported(string prefix) { const long preallocationSize = 123; - string filePath = prefix + Path.GetFullPath(GetPathToNonExistingFile()); + string filePath = prefix + Path.GetFullPath(GetTestFilePath()); - using (var fs = new FileStream(filePath, GetOptions(FileMode.CreateNew, FileAccess.Write, FileShare.None, FileOptions.None, preallocationSize))) + using (var fs = CreateFileStream(filePath, FileMode.CreateNew, FileAccess.Write, FileShare.None, bufferSize: 4096, FileOptions.None, preallocationSize)) { - Assert.True(GetActualPreallocationSize(fs) >= preallocationSize, $"Provided {preallocationSize}, actual: {GetActualPreallocationSize(fs)}"); + Assert.Equal(0, fs.Length); + Assert.True(GetAllocatedSize(fs) >= preallocationSize); } } [ConditionalTheory(nameof(IsFat32))] [InlineData(FileMode.Create)] [InlineData(FileMode.CreateNew)] - [InlineData(FileMode.OpenOrCreate)] public void WhenFileIsTooLargeTheErrorMessageContainsAllDetails(FileMode mode) { const long tooMuch = uint.MaxValue + 1L; // more than FAT32 max size - string filePath = GetPathToNonExistingFile(); + string filePath = GetTestFilePath(); Assert.StartsWith(Path.GetTempPath(), filePath); // this is what IsFat32 method relies on - IOException ex = Assert.Throws(() => new FileStream(filePath, GetOptions(mode, FileAccess.Write, FileShare.None, FileOptions.None, tooMuch))); + IOException ex = Assert.Throws(() => CreateFileStream(filePath, mode, FileAccess.Write, FileShare.None, bufferSize: 4096, FileOptions.None, tooMuch)); Assert.Contains(filePath, ex.Message); Assert.Contains(tooMuch.ToString(), ex.Message); diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.cs new file mode 100644 index 00000000000000..5209d5ef76d427 --- /dev/null +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options.cs @@ -0,0 +1,172 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; +using System.Security.Cryptography; +using Xunit; + +namespace System.IO.Tests +{ + // Don't run in parallel as the WhenDiskIsFullTheErrorMessageContainsAllDetails test + // consumes entire available free space on the disk (only on Linux, this is how fallocate works) + // and if we try to run other disk-writing test in the meantime we are going to get "No space left on device" exception. + [Collection("NoParallelTests")] + public partial class FileStream_ctor_options : FileStream_ctor_str_fm_fa_fs_buffer_fo + { + protected override string GetExpectedParamName(string paramName) => "value"; + + protected override FileStream CreateFileStream(string path, FileMode mode) + => new FileStream(path, + new FileStreamOptions + { + Mode = mode, + Access = mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite + }); + + protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access) + => new FileStream(path, + new FileStreamOptions + { + Mode = mode, + Access = access + }); + + protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) + => new FileStream(path, + new FileStreamOptions + { + Mode = mode, + Access = access, + Share = share, + BufferSize = bufferSize, + Options = options + }); + + protected virtual FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, long preallocationSize) + => new FileStream(path, + new FileStreamOptions + { + Mode = mode, + Access = access, + Share = share, + BufferSize = bufferSize, + Options = options, + PreallocationSize = preallocationSize + }); + + [Fact] + public virtual void NegativePreallocationSizeThrows() + { + string filePath = GetTestFilePath(); + ArgumentOutOfRangeException ex = Assert.Throws( + () => CreateFileStream(filePath, FileMode.CreateNew, FileAccess.Write, FileShare.None, bufferSize: 1, FileOptions.None, preallocationSize: -1)); + } + + [Theory] + [InlineData(FileMode.Append)] + [InlineData(FileMode.Open)] + [InlineData(FileMode.OpenOrCreate)] + [InlineData(FileMode.Truncate)] + public void PreallocationSizeThrowsForFileModesThatOpenExistingFiles(FileMode mode) + { + Assert.Throws( + () => CreateFileStream(GetTestFilePath(), mode, FileAccess.Write, FileShare.None, bufferSize: 1, FileOptions.None, preallocationSize: 20)); + } + + [Theory] + [InlineData(FileMode.Create)] + [InlineData(FileMode.CreateNew)] + public void PreallocationSizeThrowsForReadOnlyAccess(FileMode mode) + { + Assert.Throws( + () => CreateFileStream(GetTestFilePath(), mode, FileAccess.Read, FileShare.None, bufferSize: 1, FileOptions.None, preallocationSize: 20)); + } + + [Theory] + [InlineData(FileMode.Create, false)] + [InlineData(FileMode.Create, true)] + [InlineData(FileMode.CreateNew, false)] + [InlineData(FileMode.Append, false)] + [InlineData(FileMode.Append, true)] + [InlineData(FileMode.Open, true)] + [InlineData(FileMode.OpenOrCreate, true)] + [InlineData(FileMode.OpenOrCreate, false)] + [InlineData(FileMode.Truncate, true)] + public void ZeroPreallocationSizeDoesNotAllocate(FileMode mode, bool createFile) + { + string filename = GetTestFilePath(); + + if (createFile) + { + File.WriteAllText(filename, ""); + } + + using (FileStream fs = CreateFileStream(filename, mode, FileAccess.Write, FileShare.None, bufferSize: 1, FileOptions.None, preallocationSize: 0)) + { + Assert.Equal(0, fs.Length); + if (IsGetAllocatedSizeImplemented) + { + Assert.Equal(0, GetAllocatedSize(fs)); + } + Assert.Equal(0, fs.Position); + } + } + + [Theory] + [InlineData(FileAccess.Write, FileMode.Create)] + [InlineData(FileAccess.Write, FileMode.CreateNew)] + [InlineData(FileAccess.ReadWrite, FileMode.Create)] + [InlineData(FileAccess.ReadWrite, FileMode.CreateNew)] + public void PreallocationSize(FileAccess access, FileMode mode) + { + const long preallocationSize = 123; + + using (var fs = CreateFileStream(GetTestFilePath(), mode, access, FileShare.None, bufferSize: 1, FileOptions.None, preallocationSize)) + { + Assert.Equal(0, fs.Length); + if (IsGetAllocatedSizeImplemented) + { + if (SupportsPreallocation) + { + Assert.True(GetAllocatedSize(fs) >= preallocationSize); + } + else + { + Assert.Equal(0, GetAllocatedSize(fs)); + } + } + Assert.Equal(0, fs.Position); + } + } + + [OuterLoop("Might allocate 1 TB file if there is enough space on the disk")] + // macOS fcntl doc does not mention ENOSPC error: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html + // But depending on the OS version, it might actually return it. + // Since we don't want to have unstable tests, it's better to not run it on macOS at all. + [PlatformSpecific(TestPlatforms.Windows | TestPlatforms.Linux)] + [Theory] + [InlineData(FileMode.Create)] + [InlineData(FileMode.CreateNew)] + public void WhenDiskIsFullTheErrorMessageContainsAllDetails(FileMode mode) + { + const long TooMuch = 1024L * 1024L * 1024L * 1024L; // 1 TB + + string filePath = GetTestFilePath(); + + IOException ex = Assert.Throws(() => CreateFileStream(filePath, mode, FileAccess.Write, FileShare.None, bufferSize: 1, FileOptions.None, TooMuch)); + Assert.Contains(filePath, ex.Message); + Assert.Contains(TooMuch.ToString(), ex.Message); + + // ensure it was NOT created + bool exists = File.Exists(filePath); + if (exists) + { + File.Delete(filePath); + } + Assert.False(exists); + } + } + + [CollectionDefinition("NoParallelTests", DisableParallelization = true)] + public partial class NoParallelTests { } +} diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.Browser.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.Browser.cs deleted file mode 100644 index 3475c8999ca6f9..00000000000000 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.Browser.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 System.IO.Tests -{ - public partial class FileStream_ctor_options_as : FileStream_ctor_options_as_base - { - protected override long PreallocationSize => 10; - - protected override long InitialLength => 10; - - private long GetExpectedFileLength(long preallocationSize) => preallocationSize; - - private long GetActualPreallocationSize(FileStream fileStream) => fileStream.Length; - } -} diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.Unix.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.Unix.cs deleted file mode 100644 index 12e8f1641bac00..00000000000000 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.Unix.cs +++ /dev/null @@ -1,21 +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 System.IO.Tests -{ - public partial class FileStream_ctor_options_as : FileStream_ctor_options_as_base - { - protected override long PreallocationSize => 10; - - protected override long InitialLength => 10; - - private long GetExpectedFileLength(long preallocationSize) => preallocationSize; - - private long GetActualPreallocationSize(FileStream fileStream) - { - // On Unix posix_fallocate modifies file length and we are using fstat to get it for verificaiton - Interop.Sys.FStat(fileStream.SafeFileHandle, out Interop.Sys.FileStatus fileStatus); - return fileStatus.Size; - } - } -} diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.cs deleted file mode 100644 index f36e55ea16d2de..00000000000000 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_options_as.cs +++ /dev/null @@ -1,212 +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 Xunit; - -namespace System.IO.Tests -{ - public abstract class FileStream_ctor_options_as_base : FileStream_ctor_str_fm_fa_fs_buffer_fo - { - protected abstract long PreallocationSize { get; } - - protected override string GetExpectedParamName(string paramName) => "value"; - - protected override FileStream CreateFileStream(string path, FileMode mode) - => new FileStream(path, - new FileStreamOptions - { - Mode = mode, - Access = mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite, - PreallocationSize = PreallocationSize - }); - - protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access) - => new FileStream(path, - new FileStreamOptions - { - Mode = mode, - Access = access, - PreallocationSize = PreallocationSize - }); - - protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) - => new FileStream(path, - new FileStreamOptions - { - Mode = mode, - Access = access, - Share = share, - BufferSize = bufferSize, - Options = options, - PreallocationSize = PreallocationSize - }); - - protected FileStreamOptions GetOptions(FileMode mode, FileAccess access, FileShare share, FileOptions options, long preAllocationSize) - => new FileStreamOptions - { - Mode = mode, - Access = access, - Share = share, - Options = options, - PreallocationSize = preAllocationSize - }; - } - - public class FileStream_ctor_options_as_zero : FileStream_ctor_options_as_base - { - protected override long PreallocationSize => 0; // specifying 0 should have no effect - - protected override long InitialLength => 0; - } - - [CollectionDefinition("NoParallelTests", DisableParallelization = true)] - public partial class NoParallelTests { } - - // Don't run in parallel as the WhenDiskIsFullTheErrorMessageContainsAllDetails test - // consumes entire available free space on the disk (only on Linux, this is how posix_fallocate works) - // and if we try to run other disk-writing test in the meantime we are going to get "No space left on device" exception. - [Collection("NoParallelTests")] - public partial class FileStream_ctor_options_as : FileStream_ctor_options_as_base - { - [Fact] - public virtual void NegativePreallocationSizeThrows() - { - string filePath = GetPathToNonExistingFile(); - ArgumentOutOfRangeException ex = Assert.Throws( - () => new FileStream(filePath, GetOptions(FileMode.CreateNew, FileAccess.Write, FileShare.None, FileOptions.None, -1))); - } - - [Theory] - [InlineData(FileMode.Create, 0L)] - [InlineData(FileMode.CreateNew, 0L)] - [InlineData(FileMode.OpenOrCreate, 0L)] - public void WhenFileIsCreatedWithoutPreallocationSizeSpecifiedThePreallocationSizeIsNotSet(FileMode mode, long preallocationSize) - { - using (var fs = new FileStream(GetPathToNonExistingFile(), GetOptions(mode, FileAccess.Write, FileShare.None, FileOptions.None, preallocationSize))) - { - Assert.Equal(0, GetActualPreallocationSize(fs)); - Assert.Equal(0, fs.Length); - Assert.Equal(0, fs.Position); - } - } - - [Theory] - [InlineData(FileMode.Open, 0L)] - [InlineData(FileMode.Open, 1L)] - [InlineData(FileMode.OpenOrCreate, 0L)] - [InlineData(FileMode.OpenOrCreate, 1L)] - [InlineData(FileMode.Append, 0L)] - [InlineData(FileMode.Append, 1L)] - public void WhenExistingFileIsBeingOpenedWithPreallocationSizeSpecifiedThePreallocationSizeIsNotChanged(FileMode mode, long preallocationSize) - { - const int initialSize = 1; - string filePath = GetPathToNonExistingFile(); - File.WriteAllBytes(filePath, new byte[initialSize]); - long initialPreallocationSize; - - using (var fs = new FileStream(filePath, GetOptions(mode, FileAccess.Write, FileShare.None, FileOptions.None, 0))) // preallocationSize NOT provided - { - initialPreallocationSize = GetActualPreallocationSize(fs); // just read it to ensure it's not being changed - } - - using (var fs = new FileStream(filePath, GetOptions(mode, FileAccess.Write, FileShare.None, FileOptions.None, preallocationSize))) - { - Assert.Equal(initialPreallocationSize, GetActualPreallocationSize(fs)); // it has NOT been changed - Assert.Equal(initialSize, fs.Length); - Assert.Equal(mode == FileMode.Append ? initialSize : 0, fs.Position); - } - } - - [Theory] - [InlineData(FileMode.Create)] - [InlineData(FileMode.CreateNew)] - [InlineData(FileMode.OpenOrCreate)] - public void WhenFileIsCreatedWithPreallocationSizeSpecifiedThePreallocationSizeIsSet(FileMode mode) - { - const long preallocationSize = 123; - - using (var fs = new FileStream(GetPathToNonExistingFile(), GetOptions(mode, FileAccess.Write, FileShare.None, FileOptions.None, preallocationSize))) - { - // OS might allocate MORE than we have requested - Assert.True(GetActualPreallocationSize(fs) >= preallocationSize, $"Provided {preallocationSize}, actual: {GetActualPreallocationSize(fs)}"); - Assert.Equal(GetExpectedFileLength(preallocationSize), fs.Length); - Assert.Equal(0, fs.Position); - } - } - - [OuterLoop("Might allocate 1 TB file if there is enough space on the disk")] - // macOS fcntl doc does not mention ENOSPC error: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html - // But depending on the OS version, it might actually return it. - // Since we don't want to have unstable tests, it's better to not run it on macOS at all. - [PlatformSpecific(TestPlatforms.Windows | TestPlatforms.Linux)] - [Theory] - [InlineData(FileMode.Create)] - [InlineData(FileMode.CreateNew)] - [InlineData(FileMode.OpenOrCreate)] - public void WhenDiskIsFullTheErrorMessageContainsAllDetails(FileMode mode) - { - const long tooMuch = 1024L * 1024L * 1024L * 1024L; // 1 TB - - string filePath = GetPathToNonExistingFile(); - - IOException ex = Assert.Throws(() => new FileStream(filePath, GetOptions(mode, FileAccess.Write, FileShare.None, FileOptions.None, tooMuch))); - Assert.Contains(filePath, ex.Message); - Assert.Contains(tooMuch.ToString(), ex.Message); - - // ensure it was NOT created (provided OOTB by Windows, emulated on Unix) - bool exists = File.Exists(filePath); - if (exists) - { - File.Delete(filePath); - } - Assert.False(exists); - } - - [Fact] - public void WhenFileIsTruncatedWithoutPreallocationSizeSpecifiedThePreallocationSizeIsNotSet() - { - const int initialSize = 10_000; - - string filePath = GetPathToNonExistingFile(); - File.WriteAllBytes(filePath, new byte[initialSize]); - - using (var fs = new FileStream(filePath, GetOptions(FileMode.Truncate, FileAccess.Write, FileShare.None, FileOptions.None, 0))) - { - Assert.Equal(0, GetActualPreallocationSize(fs)); - Assert.Equal(0, fs.Length); - Assert.Equal(0, fs.Position); - } - } - - [Fact] - public void WhenFileIsTruncatedWithPreallocationSizeSpecifiedThePreallocationSizeIsSet() - { - const int initialSize = 10_000; // this must be more than 4kb which seems to be minimum allocation size on Windows - const long preallocationSize = 100; - - string filePath = GetPathToNonExistingFile(); - File.WriteAllBytes(filePath, new byte[initialSize]); - - using (var fs = new FileStream(filePath, GetOptions(FileMode.Truncate, FileAccess.Write, FileShare.None, FileOptions.None, preallocationSize))) - { - Assert.True(GetActualPreallocationSize(fs) >= preallocationSize, $"Provided {preallocationSize}, actual: {GetActualPreallocationSize(fs)}"); - // less than initial file size (file got truncated) - Assert.True(GetActualPreallocationSize(fs) < initialSize, $"initialSize {initialSize}, actual: {GetActualPreallocationSize(fs)}"); - Assert.Equal(GetExpectedFileLength(preallocationSize), fs.Length); - Assert.Equal(0, fs.Position); - } - } - - private string GetPathToNonExistingFile() - { - string filePath = GetTestFilePath(); - - if (File.Exists(filePath)) - { - File.Delete(filePath); - } - - return filePath; - } - } -} diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm.cs index 47e3b492373161..cd3b18da034228 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/ctor_str_fm.cs @@ -13,8 +13,6 @@ protected virtual FileStream CreateFileStream(string path, FileMode mode) return new FileStream(path, mode); } - protected virtual long InitialLength => 0; - protected virtual string GetExpectedParamName(string paramName) => paramName; [Fact] @@ -97,7 +95,7 @@ public void FileModeCreateExisting(string streamSpecifier) using (FileStream fs = CreateFileStream(fileName, FileMode.Create)) { // Ensure that the file was re-created - Assert.Equal(InitialLength, fs.Length); + Assert.Equal(0, fs.Length); Assert.Equal(0L, fs.Position); Assert.True(fs.CanRead); Assert.True(fs.CanWrite); @@ -148,7 +146,7 @@ public void FileModeOpenExisting(string streamSpecifier) using (FileStream fs = CreateFileStream(fileName, FileMode.Open)) { // Ensure that the file was re-opened - Assert.Equal(Math.Max(1L, InitialLength), fs.Length); + Assert.Equal(1, fs.Length); Assert.Equal(0L, fs.Position); Assert.True(fs.CanRead); Assert.True(fs.CanWrite); @@ -177,7 +175,7 @@ public void FileModeOpenOrCreateExisting(string streamSpecifier) using (FileStream fs = CreateFileStream(fileName, FileMode.OpenOrCreate)) { // Ensure that the file was re-opened - Assert.Equal(Math.Max(1L, InitialLength), fs.Length); + Assert.Equal(1, fs.Length); Assert.Equal(0L, fs.Position); Assert.True(fs.CanRead); Assert.True(fs.CanWrite); @@ -204,7 +202,7 @@ public void FileModeTruncateExisting(string streamSpecifier) using (FileStream fs = CreateFileStream(fileName, FileMode.Truncate)) { // Ensure that the file was re-opened and truncated - Assert.Equal(InitialLength, fs.Length); + Assert.Equal(0, fs.Length); Assert.Equal(0L, fs.Position); Assert.True(fs.CanRead); Assert.True(fs.CanWrite); @@ -246,7 +244,7 @@ public virtual void FileModeAppendExisting(string streamSpecifier) using (FileStream fs = CreateFileStream(fileName, FileMode.Append)) { // Ensure that the file was re-opened and position set to end - Assert.Equal(Math.Max(1L, InitialLength), fs.Length); + Assert.Equal(1, fs.Length); long position = fs.Position; Assert.Equal(fs.Length, position); diff --git a/src/libraries/System.IO.FileSystem/tests/Junctions.Windows.cs b/src/libraries/System.IO.FileSystem/tests/Junctions.Windows.cs new file mode 100644 index 00000000000000..c280008148977a --- /dev/null +++ b/src/libraries/System.IO.FileSystem/tests/Junctions.Windows.cs @@ -0,0 +1,107 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Xunit; + +namespace System.IO.Tests +{ + [PlatformSpecific(TestPlatforms.Windows)] + public class Junctions : BaseSymbolicLinks + { + private DirectoryInfo CreateJunction(string junctionPath, string targetPath) + { + Assert.True(MountHelper.CreateJunction(junctionPath, targetPath)); + DirectoryInfo junctionInfo = new(junctionPath); + return junctionInfo; + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void Junction_ResolveLinkTarget(bool returnFinalTarget) + { + string junctionPath = GetRandomLinkPath(); + string targetPath = GetRandomDirPath(); + + Directory.CreateDirectory(targetPath); + DirectoryInfo junctionInfo = CreateJunction(junctionPath, targetPath); + + FileSystemInfo? targetFromDirectoryInfo = junctionInfo.ResolveLinkTarget(returnFinalTarget); + FileSystemInfo? targetFromDirectory = Directory.ResolveLinkTarget(junctionPath, returnFinalTarget); + + Assert.True(targetFromDirectoryInfo is DirectoryInfo); + Assert.True(targetFromDirectory is DirectoryInfo); + + Assert.Equal(targetPath, junctionInfo.LinkTarget); + + Assert.Equal(targetPath, targetFromDirectoryInfo.FullName); + Assert.Equal(targetPath, targetFromDirectory.FullName); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void Junction_ResolveLinkTarget_WithIndirection(bool returnFinalTarget) + { + string firstJunctionPath = GetRandomLinkPath(); + string middleJunctionPath = GetRandomLinkPath(); + string targetPath = GetRandomDirPath(); + + Directory.CreateDirectory(targetPath); + CreateJunction(middleJunctionPath, targetPath); + DirectoryInfo firstJunctionInfo = CreateJunction(firstJunctionPath, middleJunctionPath); + + string expectedTargetPath = returnFinalTarget ? targetPath : middleJunctionPath; + + FileSystemInfo? targetFromDirectoryInfo = firstJunctionInfo.ResolveLinkTarget(returnFinalTarget); + FileSystemInfo? targetFromDirectory = Directory.ResolveLinkTarget(firstJunctionPath, returnFinalTarget); + + Assert.True(targetFromDirectoryInfo is DirectoryInfo); + Assert.True(targetFromDirectory is DirectoryInfo); + + // Always the immediate target + Assert.Equal(middleJunctionPath, firstJunctionInfo.LinkTarget); + + Assert.Equal(expectedTargetPath, targetFromDirectoryInfo.FullName); + Assert.Equal(expectedTargetPath, targetFromDirectory.FullName); + } + + [Theory] + [MemberData(nameof(Junction_ResolveLinkTarget_PathToTarget_Data))] + public void Junction_ResolveLinkTarget_Succeeds(string pathToTarget, bool returnFinalTarget) + { + string linkPath = GetRandomLinkPath(); + FileSystemInfo linkInfo = CreateJunction(linkPath, pathToTarget); + + // Junctions are always created with absolute targets, even if a relative path is passed. + string expectedTarget = Path.GetFullPath(pathToTarget); + + Assert.True(linkInfo.Exists); + Assert.IsType(linkInfo); + Assert.True(linkInfo.Attributes.HasFlag(FileAttributes.Directory)); + Assert.Equal(expectedTarget, linkInfo.LinkTarget); + + FileSystemInfo? targetFromDirectoryInfo = linkInfo.ResolveLinkTarget(returnFinalTarget); + FileSystemInfo? targetFromDirectory = Directory.ResolveLinkTarget(linkPath, returnFinalTarget); + + Assert.NotNull(targetFromDirectoryInfo); + Assert.NotNull(targetFromDirectory); + + Assert.False(targetFromDirectoryInfo.Exists); + Assert.False(targetFromDirectory.Exists); + + + Assert.Equal(expectedTarget, targetFromDirectoryInfo.FullName); + Assert.Equal(expectedTarget, targetFromDirectory.FullName); + } + + [Theory] + [MemberData(nameof(Junction_LinkTarget_PathToTarget_Data))] + public void Junction_LinkTarget_Succeeds(string pathToTarget) + { + FileSystemInfo linkInfo = CreateJunction(GetRandomLinkPath(), pathToTarget); + Assert.True(linkInfo.Exists); + Assert.Equal(Path.GetFullPath(pathToTarget), linkInfo.LinkTarget); + } + } +} diff --git a/src/libraries/System.IO.FileSystem/tests/LargeFileTests.cs b/src/libraries/System.IO.FileSystem/tests/LargeFileTests.cs new file mode 100644 index 00000000000000..c8158f8b97784a --- /dev/null +++ b/src/libraries/System.IO.FileSystem/tests/LargeFileTests.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO.Tests; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.FileSystem.Tests +{ + [OuterLoop] + [ActiveIssue("https://github.com/dotnet/runtime/issues/45954", TestPlatforms.Browser)] + [Collection(nameof(NoParallelTests))] // don't create multiple large files at the same time + public class LargeFileTests : FileSystemTest + { + [Fact] + public async Task ReadAllBytesOverLimit() + { + using FileStream fs = new (GetTestFilePath(), FileMode.Create, FileAccess.Write, FileShare.Read, 4096, FileOptions.DeleteOnClose); + + foreach (long lengthOverLimit in new long[] { int.MaxValue + 1L }) + { + fs.SetLength(lengthOverLimit); + + Assert.Throws(() => File.ReadAllBytes(fs.Name)); + await Assert.ThrowsAsync(async () => await File.ReadAllBytesAsync(fs.Name)); + } + } + + [Fact] + public void NoInt32OverflowInTheBufferingLogic() + { + const long position1 = 10; + const long position2 = (1L << 32) + position1; + + string filePath = GetTestFilePath(); + byte[] data1 = new byte[] { 1, 2, 3, 4, 5 }; + byte[] data2 = new byte[] { 6, 7, 8, 9, 10 }; + byte[] buffer = new byte[5]; + + using (FileStream stream = File.Create(filePath)) + { + stream.Seek(position1, SeekOrigin.Begin); + stream.Write(data1); + + stream.Seek(position2, SeekOrigin.Begin); + stream.Write(data2); + } + + using (FileStream stream = new (filePath, FileMode.Open, FileAccess.Read, FileShare.None, 4096, FileOptions.DeleteOnClose)) + { + stream.Seek(position1, SeekOrigin.Begin); + Assert.Equal(buffer.Length, stream.Read(buffer)); + Assert.Equal(data1, buffer); + + stream.Seek(position2, SeekOrigin.Begin); + Assert.Equal(buffer.Length, stream.Read(buffer)); + Assert.Equal(data2, buffer); + } + } + } + + [CollectionDefinition(nameof(NoParallelTests), DisableParallelization = true)] + public partial class NoParallelTests { } +} diff --git a/src/libraries/System.IO.FileSystem/tests/Net5CompatTests/System.IO.FileSystem.Net5Compat.Tests.csproj b/src/libraries/System.IO.FileSystem/tests/Net5CompatTests/System.IO.FileSystem.Net5Compat.Tests.csproj index 745ff60368b2ef..385c3afb569c49 100644 --- a/src/libraries/System.IO.FileSystem/tests/Net5CompatTests/System.IO.FileSystem.Net5Compat.Tests.csproj +++ b/src/libraries/System.IO.FileSystem/tests/Net5CompatTests/System.IO.FileSystem.Net5Compat.Tests.csproj @@ -1,4 +1,4 @@ - + true true @@ -14,7 +14,6 @@ - @@ -33,6 +32,7 @@ + diff --git a/src/libraries/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs b/src/libraries/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs index 5423bda6814b3b..8c7f3608d35ce2 100644 --- a/src/libraries/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs +++ b/src/libraries/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs @@ -10,14 +10,14 @@ #define DEBUG using System; -using System.IO; -using System.Text; -using System.Diagnostics; using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; using System.Runtime.InteropServices; -using System.ComponentModel; -using System.Threading; +using System.Text; using System.Threading.Tasks; + public static class MountHelper { [DllImport("kernel32.dll", EntryPoint = "GetVolumeNameForVolumeMountPointW", CharSet = CharSet.Unicode, BestFitMapping = false, SetLastError = true)] @@ -28,9 +28,7 @@ public static class MountHelper [DllImport("kernel32.dll", EntryPoint = "DeleteVolumeMountPointW", CharSet = CharSet.Unicode, BestFitMapping = false, SetLastError = true)] private static extern bool DeleteVolumeMountPoint(string mountPoint); - /// Creates a symbolic link using command line tools - /// The existing file - /// + /// Creates a symbolic link using command line tools. public static bool CreateSymbolicLink(string linkPath, string targetPath, bool isDirectory) { Process symLinkProcess = new Process(); @@ -48,20 +46,78 @@ public static bool CreateSymbolicLink(string linkPath, string targetPath, bool i symLinkProcess.StartInfo.RedirectStandardOutput = true; symLinkProcess.Start(); - if (symLinkProcess != null) + symLinkProcess.WaitForExit(); + return symLinkProcess.ExitCode == 0; + } + + /// On Windows, creates a junction using command line tools. + public static bool CreateJunction(string junctionPath, string targetPath) + { + if (!OperatingSystem.IsWindows()) { - symLinkProcess.WaitForExit(); - return (0 == symLinkProcess.ExitCode); + throw new PlatformNotSupportedException(); } - else + + return RunProcess(CreateProcessStartInfo("cmd", "/c", "mklink", "/J", junctionPath, targetPath)); + } + + /// + /// On Windows, mounts a folder to an assigned virtual drive letter using the subst command. + /// subst is not available in Windows Nano. + /// + public static char CreateVirtualDrive(string targetDir) + { + if (!OperatingSystem.IsWindows()) + { + throw new PlatformNotSupportedException(); + } + + char driveLetter = GetNextAvailableDriveLetter(); + bool success = RunProcess(CreateProcessStartInfo("cmd", "/c", SubstPath, $"{driveLetter}:", targetDir)); + if (!success || !DriveInfo.GetDrives().Any(x => x.Name[0] == driveLetter)) + { + throw new InvalidOperationException($"Could not create virtual drive {driveLetter}: with subst"); + } + return driveLetter; + + // Finds the next unused drive letter and returns it. + char GetNextAvailableDriveLetter() { - return false; + List existingDrives = DriveInfo.GetDrives().Select(x => x.Name[0]).ToList(); + + // A,B are reserved, C is usually reserved + IEnumerable range = Enumerable.Range('D', 'Z' - 'D'); + IEnumerable castRange = range.Select(x => Convert.ToChar(x)); + IEnumerable allDrivesLetters = castRange.Except(existingDrives); + + if (!allDrivesLetters.Any()) + { + throw new ArgumentOutOfRangeException("No drive letters available"); + } + + return allDrivesLetters.First(); } } - public static void Mount(string volumeName, string mountPoint) + /// + /// On Windows, unassigns the specified virtual drive letter from its mounted folder. + /// + public static void DeleteVirtualDrive(char driveLetter) { + if (!OperatingSystem.IsWindows()) + { + throw new PlatformNotSupportedException(); + } + bool success = RunProcess(CreateProcessStartInfo("cmd", "/c", SubstPath, "/d", $"{driveLetter}:")); + if (!success || DriveInfo.GetDrives().Any(x => x.Name[0] == driveLetter)) + { + throw new InvalidOperationException($"Could not delete virtual drive {driveLetter}: with subst"); + } + } + + public static void Mount(string volumeName, string mountPoint) + { if (volumeName[volumeName.Length - 1] != Path.DirectorySeparatorChar) volumeName += Path.DirectorySeparatorChar; if (mountPoint[mountPoint.Length - 1] != Path.DirectorySeparatorChar) @@ -93,8 +149,47 @@ public static void Unmount(string mountPoint) throw new Exception(string.Format("Win32 error: {0}", Marshal.GetLastPInvokeError())); } + private static ProcessStartInfo CreateProcessStartInfo(string fileName, params string[] arguments) + { + var info = new ProcessStartInfo + { + FileName = fileName, + UseShellExecute = false, + RedirectStandardOutput = true + }; + + foreach (var argument in arguments) + { + info.ArgumentList.Add(argument); + } + + return info; + } + + private static bool RunProcess(ProcessStartInfo startInfo) + { + var process = Process.Start(startInfo); + process.WaitForExit(); + return process.ExitCode == 0; + } + + private static string SubstPath + { + get + { + if (!OperatingSystem.IsWindows()) + { + throw new PlatformNotSupportedException(); + } + + string systemRoot = Environment.GetEnvironmentVariable("SystemRoot") ?? @"C:\Windows"; + string system32 = Path.Join(systemRoot, "System32"); + return Path.Join(system32, "subst.exe"); + } + } + /// For standalone debugging help. Change Main0 to Main - public static void Main0(string[] args) + public static void Main0(string[] args) { try { diff --git a/src/libraries/System.IO.FileSystem/tests/RandomAccess/NoBuffering.Windows.cs b/src/libraries/System.IO.FileSystem/tests/RandomAccess/NoBuffering.Windows.cs index d897cc7b8be25b..bde3863d5b1df9 100644 --- a/src/libraries/System.IO.FileSystem/tests/RandomAccess/NoBuffering.Windows.cs +++ b/src/libraries/System.IO.FileSystem/tests/RandomAccess/NoBuffering.Windows.cs @@ -176,5 +176,47 @@ public async Task WriteAsyncUsingMultipleBuffers(bool async) Assert.Equal(content, File.ReadAllBytes(filePath)); } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task ReadWriteAsyncUsingMultipleBuffers(bool memoryPageSized) + { + string filePath = GetTestFilePath(); + // We test with buffers both one and two memory pages long. In the former case, + // the I/O operations will issue one scatter/gather API call, and in the latter + // case they will issue multiple calls; one per buffer. The buffers must still + // be aligned to comply with FILE_FLAG_NO_BUFFERING's requirements. + int bufferSize = Environment.SystemPageSize * (memoryPageSized ? 1 : 2); + int fileSize = bufferSize * 2; + byte[] content = RandomNumberGenerator.GetBytes(fileSize); + + using (SafeFileHandle handle = File.OpenHandle(filePath, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None, FileOptions.Asynchronous | NoBuffering)) + using (SectorAlignedMemory buffer = SectorAlignedMemory.Allocate(fileSize)) + { + Memory firstHalf = buffer.Memory.Slice(0, bufferSize); + Memory secondHalf = buffer.Memory.Slice(bufferSize); + + content.AsSpan().CopyTo(buffer.GetSpan()); + await RandomAccess.WriteAsync(handle, new ReadOnlyMemory[] { firstHalf, secondHalf }, 0); + + buffer.GetSpan().Clear(); + long nRead = await RandomAccess.ReadAsync(handle, new Memory[] { firstHalf, secondHalf }, 0); + + Assert.Equal(buffer.GetSpan().Length, nRead); + AssertExtensions.SequenceEqual(buffer.GetSpan(), content.AsSpan()); + } + } + + [Fact] + public async Task ReadWriteAsyncUsingEmptyBuffers() + { + string filePath = GetTestFilePath(); + using SafeFileHandle handle = File.OpenHandle(filePath, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None, FileOptions.Asynchronous | NoBuffering); + + long nRead = await RandomAccess.ReadAsync(handle, Array.Empty>(), 0); + Assert.Equal(0, nRead); + await RandomAccess.WriteAsync(handle, Array.Empty>(), 0); + } } } diff --git a/src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj b/src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj index 736d3b1ee5654b..4c8fa1c23be5b8 100644 --- a/src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj +++ b/src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj @@ -1,4 +1,4 @@ - + true true @@ -24,7 +24,7 @@ - + @@ -55,6 +55,7 @@ + @@ -70,19 +71,21 @@ - - + + - + + + @@ -101,7 +104,7 @@ - + @@ -117,6 +120,7 @@ + @@ -211,8 +215,7 @@ - + diff --git a/src/libraries/System.IO.FileSystem/tests/VirtualDriveSymbolicLinks.Windows.cs b/src/libraries/System.IO.FileSystem/tests/VirtualDriveSymbolicLinks.Windows.cs new file mode 100644 index 00000000000000..d88425086b7024 --- /dev/null +++ b/src/libraries/System.IO.FileSystem/tests/VirtualDriveSymbolicLinks.Windows.cs @@ -0,0 +1,247 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Xunit; + +namespace System.IO.Tests +{ + // Need to reuse the same virtual drive for all the test methods. + // Creating and disposing one virtual drive per class achieves this. + [PlatformSpecific(TestPlatforms.Windows)] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsSubstAvailable))] + public class VirtualDrive_SymbolicLinks : BaseSymbolicLinks + { + protected override void Dispose(bool disposing) + { + try + { + if (VirtualDriveLetter != default) + { + MountHelper.DeleteVirtualDrive(VirtualDriveLetter); + Directory.Delete(VirtualDriveTargetDir, recursive: true); + } + } + catch { } // avoid exceptions on dispose + base.Dispose(disposing); + } + + [Theory] + // false, false, false, false // Target is not in virtual drive + // false, false, true, false // Target is not in virtual drive + [InlineData(false, true, false, true)] // Immediate target expected, target is in virtual drive + [InlineData(false, true, true, false)] // Final target expected, target is in virtual drive + // true, false, false, false // Target is not in virtual drive + // true, false, true, false // Target is not in virtual drive + [InlineData(true, true, false, true)] // Immediate target expected, target is in virtual drive + [InlineData(true, true, true, false)] // Final target expected, target is in virtual drive + public void VirtualDrive_SymbolicLinks_LinkAndTarget( + bool isLinkInVirtualDrive, + bool isTargetInVirtualDrive, + bool returnFinalTarget, + bool isExpectedTargetPathVirtual) + { + string linkExpectedFolderPath = GetVirtualOrRealPath(isLinkInVirtualDrive); + // File link + string fileLinkName = GetRandomLinkName(); + string fileLinkPath = Path.Join(linkExpectedFolderPath, fileLinkName); + // Directory link + string dirLinkName = GetRandomLinkName(); + string dirLinkPath = Path.Join(linkExpectedFolderPath, dirLinkName); + + string targetExpectedFolderPath = GetVirtualOrRealPath(isTargetInVirtualDrive); + // File target + string fileTargetFileName = GetRandomFileName(); + string fileTargetPath = Path.Join(targetExpectedFolderPath, fileTargetFileName); + // Directory target + string dirTargetFileName = GetRandomDirName(); + string dirTargetPath = Path.Join(targetExpectedFolderPath, dirTargetFileName); + + // Create targets + File.Create(fileTargetPath).Dispose(); + Directory.CreateDirectory(dirTargetPath); + + // Create links + FileInfo fileLinkInfo = new FileInfo(fileLinkPath); + fileLinkInfo.CreateAsSymbolicLink(fileTargetPath); + DirectoryInfo dirLinkInfo = new DirectoryInfo(dirLinkPath); + dirLinkInfo.CreateAsSymbolicLink(dirTargetPath); + + // The expected results depend on the target location and the value of returnFinalTarget + + // LinkTarget always retrieves the immediate target, so the expected value + // is always the path that was provided by the user for the target + + // Verify the LinkTarget values of the link infos + Assert.Equal(fileTargetPath, fileLinkInfo.LinkTarget); + Assert.Equal(dirTargetPath, dirLinkInfo.LinkTarget); + + // When the target is in a virtual drive, and returnFinalTarget is true, + // the expected target path is the real path, not the virtual path + string expectedTargetPath = GetVirtualOrRealPath(isExpectedTargetPathVirtual); + + string expectedTargetFileInfoFullName = Path.Join(expectedTargetPath, fileTargetFileName); + string expectedTargetDirectoryInfoFullName = Path.Join(expectedTargetPath, dirTargetFileName); + + // Verify target infos from link info instances + FileSystemInfo? targetFileInfoFromFileInfoLink = fileLinkInfo.ResolveLinkTarget(returnFinalTarget); + FileSystemInfo? targetDirInfoFromDirInfoLink = dirLinkInfo.ResolveLinkTarget(returnFinalTarget); + + Assert.True(targetFileInfoFromFileInfoLink is FileInfo); + Assert.True(targetDirInfoFromDirInfoLink is DirectoryInfo); + + Assert.Equal(expectedTargetFileInfoFullName, targetFileInfoFromFileInfoLink.FullName); + Assert.Equal(expectedTargetDirectoryInfoFullName, targetDirInfoFromDirInfoLink.FullName); + + // Verify targets infos via static methods + FileSystemInfo? targetFileInfoFromFile = File.ResolveLinkTarget(fileLinkPath, returnFinalTarget); + FileSystemInfo? targetFileInfoFromDirectory = Directory.ResolveLinkTarget(dirLinkPath, returnFinalTarget); + + Assert.True(targetFileInfoFromFile is FileInfo); + Assert.True(targetFileInfoFromDirectory is DirectoryInfo); + + Assert.Equal(expectedTargetFileInfoFullName, targetFileInfoFromFile.FullName); + Assert.Equal(expectedTargetDirectoryInfoFullName, targetFileInfoFromDirectory.FullName); + } + + + [Theory] + // false, false, false, false, false // Target is not in virtual drive + // false, false, false, true, false // Target is not in virtual drive + [InlineData(false, false, true, false, false)] // Immediate target expected, middle link is NOT in virtual drive + [InlineData(false, false, true, true, false)] // Final target expected, target is in virtual drive + // false, true, false, false, false // Target is not in virtual drive + // false, true, false, true, false // Target is not in virtual drive + [InlineData(false, true, true, false, true)] // Immediate target expected, target is in virtual drive + [InlineData(false, true, true, true, false)] // Final target expected, target is in virtual drive + // true, false, false, false, false // Target is not in virtual drive + // true, false, false, true, false // Target is not in virtual drive + [InlineData(true, false, true, false, false)] // Immediate target expected, middle link is NOT in virtual drive + [InlineData(true, false, true, true, false)] // Final target expected, target is in virtual drive + // true, true, false, false, false // Target is not in virtual drive + // true, true, false, true, false // Target is not in virtual drive + [InlineData(true, true, true, false, true)] // Immediate target expected, target is in virtual drive + [InlineData(true, true, true, true, false)] // Final target expected, target is in virtual drive + public void VirtualDrive_SymbolicLinks_WithIndirection( + bool isFirstLinkInVirtualDrive, + bool isMiddleLinkInVirtualDrive, + bool isTargetInVirtualDrive, + bool returnFinalTarget, + bool isExpectedTargetPathVirtual) + { + string firstLinkExpectedFolderPath = GetVirtualOrRealPath(isFirstLinkInVirtualDrive); + // File link + string fileLinkPath = Path.Join(firstLinkExpectedFolderPath, GetRandomLinkName()); + // Directory link + string dirLinkPath = Path.Join(firstLinkExpectedFolderPath, GetRandomLinkName()); + + string middleLinkExpectedFolderPath = GetVirtualOrRealPath(isMiddleLinkInVirtualDrive); + // File middle link + string fileMiddleLinkFileName = GetRandomLinkName(); + string fileMiddleLinkPath = Path.Join(middleLinkExpectedFolderPath, fileMiddleLinkFileName); + // Directory middle link + string dirMiddleLinkFileName = GetRandomLinkName(); + string dirMiddleLinkPath = Path.Join(middleLinkExpectedFolderPath, dirMiddleLinkFileName); + + string targetExpectedFolderPath = GetVirtualOrRealPath(isTargetInVirtualDrive); + // File final target + string fileFinalTargetFileName = GetRandomFileName(); + string fileFinalTargetPath = Path.Join(targetExpectedFolderPath, fileFinalTargetFileName); + // Directory final target + string dirFinalTargetFileName = GetRandomDirName(); + string dirFinalTargetPath = Path.Join(targetExpectedFolderPath, dirFinalTargetFileName); + + // Create targets + File.Create(fileFinalTargetPath).Dispose(); + Directory.CreateDirectory(dirFinalTargetPath); + + // Create initial links + FileInfo fileLinkInfo = new FileInfo(fileLinkPath); + fileLinkInfo.CreateAsSymbolicLink(fileMiddleLinkPath); + + DirectoryInfo dirLinkInfo = new DirectoryInfo(dirLinkPath); + dirLinkInfo.CreateAsSymbolicLink(dirMiddleLinkPath); + + // Create middle links + FileInfo fileMiddleLinkInfo = new FileInfo(fileMiddleLinkPath); + fileMiddleLinkInfo.CreateAsSymbolicLink(fileFinalTargetPath); + + DirectoryInfo dirMiddleLinkInfo = new DirectoryInfo(dirMiddleLinkPath); + dirMiddleLinkInfo.CreateAsSymbolicLink(dirFinalTargetPath); + + // The expected results depend on the target location and the value of returnFinalTarget + + // LinkTarget always retrieves the immediate target, so the expected value + // is always the path that was provided by the user for the middle link + + // Verify the LinkTarget values of the link infos + Assert.Equal(fileMiddleLinkPath, fileLinkInfo.LinkTarget); + Assert.Equal(dirMiddleLinkPath, dirLinkInfo.LinkTarget); + + // When the target is in a virtual drive, + // the expected target path is the real path, not the virtual path + // When returnFinalTarget is true, the expected target path is the + // resolved path from the final target in the chain of links + string expectedTargetPath = GetVirtualOrRealPath(isExpectedTargetPathVirtual); + + string expectedTargetFileInfoFullName = Path.Join(expectedTargetPath, + returnFinalTarget ? fileFinalTargetFileName : fileMiddleLinkFileName); + + string expectedTargetDirectoryInfoFullName = Path.Join(expectedTargetPath, + returnFinalTarget ? dirFinalTargetFileName : dirMiddleLinkFileName); + + // Verify target infos from link info instances + FileSystemInfo? targetFileInfoFromFileInfoLink = fileLinkInfo.ResolveLinkTarget(returnFinalTarget); + FileSystemInfo? targetDirInfoFromDirInfoLink = dirLinkInfo.ResolveLinkTarget(returnFinalTarget); + + Assert.True(targetFileInfoFromFileInfoLink is FileInfo); + Assert.True(targetDirInfoFromDirInfoLink is DirectoryInfo); + + Assert.Equal(expectedTargetFileInfoFullName, targetFileInfoFromFileInfoLink.FullName); + Assert.Equal(expectedTargetDirectoryInfoFullName, targetDirInfoFromDirInfoLink.FullName); + + // Verify targets infos via static methods + FileSystemInfo? targetFileInfoFromFile = File.ResolveLinkTarget(fileLinkPath, returnFinalTarget); + FileSystemInfo? targetFileInfoFromDirectory = Directory.ResolveLinkTarget(dirLinkPath, returnFinalTarget); + + Assert.True(targetFileInfoFromFile is FileInfo); + Assert.True(targetFileInfoFromDirectory is DirectoryInfo); + + Assert.Equal(expectedTargetFileInfoFullName, targetFileInfoFromFile.FullName); + Assert.Equal(expectedTargetDirectoryInfoFullName, targetFileInfoFromDirectory.FullName); + } + + private string GetVirtualOrRealPath(bool condition) => condition ? $"{VirtualDriveLetter}:" : VirtualDriveTargetDir; + + // Temporary Windows directory that can be mounted to a drive letter using the subst command + private string? _virtualDriveTargetDir = null; + private string VirtualDriveTargetDir + { + get + { + if (_virtualDriveTargetDir == null) + { + // Create a folder inside the temp directory so that it can be mounted to a drive letter with subst + _virtualDriveTargetDir = Path.Join(Path.GetTempPath(), GetRandomDirName()); + Directory.CreateDirectory(_virtualDriveTargetDir); + } + + return _virtualDriveTargetDir; + } + } + + // Windows drive letter that points to a mounted directory using the subst command + private char _virtualDriveLetter = default; + private char VirtualDriveLetter + { + get + { + if (_virtualDriveLetter == default) + { + // Mount the folder to a drive letter + _virtualDriveLetter = MountHelper.CreateVirtualDrive(VirtualDriveTargetDir); + } + return _virtualDriveLetter; + } + } + } +} diff --git a/src/libraries/System.IO.Hashing/src/System.IO.Hashing.csproj b/src/libraries/System.IO.Hashing/src/System.IO.Hashing.csproj index acfa86bb798d87..d08c938d902785 100644 --- a/src/libraries/System.IO.Hashing/src/System.IO.Hashing.csproj +++ b/src/libraries/System.IO.Hashing/src/System.IO.Hashing.csproj @@ -4,8 +4,8 @@ enable $(NetCoreAppCurrent);netstandard2.0;net461 true - - true + false + 2 Provides non-cryptographic hash algorithms, such as CRC-32. Commonly Used Types: diff --git a/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash32.cs b/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash32.cs index d6db9bae19b2e3..6be1ba46936f3e 100644 --- a/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash32.cs +++ b/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash32.cs @@ -73,7 +73,7 @@ public override void Append(ReadOnlySpan source) { int remain = StripeSize - held; - if (source.Length > remain) + if (source.Length >= remain) { source.Slice(0, remain).CopyTo(_holdback.AsSpan(held)); _state.ProcessStripe(_holdback); @@ -215,7 +215,7 @@ private static int StaticHash(ReadOnlySpan source, Span destination, int totalLength = source.Length; State state = new State((uint)seed); - while (source.Length > StripeSize) + while (source.Length >= StripeSize) { state.ProcessStripe(source); source = source.Slice(StripeSize); diff --git a/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash64.State.cs b/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash64.State.cs index ecb289a945c957..9c1493c629b904 100644 --- a/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash64.State.cs +++ b/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash64.State.cs @@ -90,7 +90,7 @@ private static ulong ApplyRound(ulong acc, ulong lane) return acc; } - internal readonly ulong Complete(int length, ReadOnlySpan remaining) + internal readonly ulong Complete(long length, ReadOnlySpan remaining) { ulong acc = _hadFullStripe ? Converge() : _smallAcc; diff --git a/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash64.cs b/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash64.cs index 990ed77d64de27..a19856ace8c521 100644 --- a/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash64.cs +++ b/src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash64.cs @@ -19,7 +19,7 @@ public sealed partial class XxHash64 : NonCryptographicHashAlgorithm private readonly ulong _seed; private State _state; private byte[]? _holdback; - private int _length; + private long _length; /// /// Initializes a new instance of the class. @@ -63,17 +63,17 @@ public override void Reset() /// The data to process. public override void Append(ReadOnlySpan source) { - // Every time we've read 16 bytes, process the stripe. - // Data that isn't perfectly mod-16 gets stored in a holdback + // Every time we've read 32 bytes, process the stripe. + // Data that isn't perfectly mod-32 gets stored in a holdback // buffer. - int held = _length & 0x1F; + int held = (int)_length & 0x1F; if (held != 0) { int remain = StripeSize - held; - if (source.Length > remain) + if (source.Length >= remain) { source.Slice(0, remain).CopyTo(_holdback.AsSpan(held)); _state.ProcessStripe(_holdback); @@ -110,7 +110,7 @@ public override void Append(ReadOnlySpan source) /// protected override void GetCurrentHashCore(Span destination) { - int remainingLength = _length & 0x1F; + int remainingLength = (int)_length & 0x1F; ReadOnlySpan remaining = ReadOnlySpan.Empty; if (remainingLength > 0) @@ -215,13 +215,13 @@ private static int StaticHash(ReadOnlySpan source, Span destination, int totalLength = source.Length; State state = new State((ulong)seed); - while (source.Length > StripeSize) + while (source.Length >= StripeSize) { state.ProcessStripe(source); source = source.Slice(StripeSize); } - ulong val = state.Complete(totalLength, source); + ulong val = state.Complete((uint)totalLength, source); BinaryPrimitives.WriteUInt64BigEndian(destination, val); return HashSize; } diff --git a/src/libraries/System.IO.Hashing/tests/NonCryptoHashTestDriver.cs b/src/libraries/System.IO.Hashing/tests/NonCryptoHashTestDriver.cs index 3cec2c09836219..74a05ac7eeb2be 100644 --- a/src/libraries/System.IO.Hashing/tests/NonCryptoHashTestDriver.cs +++ b/src/libraries/System.IO.Hashing/tests/NonCryptoHashTestDriver.cs @@ -48,7 +48,7 @@ public void TestsDefined() targetMethodName, BindingFlags.Instance | BindingFlags.Public); - if (info2 is null) + if (info2 is null && !info.IsDefined(typeof(OverrideOptionalAttribute))) { missingMethods ??= new List(); missingMethods.Add(targetMethodName); @@ -116,6 +116,20 @@ protected void InstanceMultiAppendGetCurrentHashDriver(TestCase testCase) testCase.VerifyResponse(answer); } + [OverrideOptional] + protected void InstanceMultiAppendLargeInputDriver(LargeTestCase testCase) + { + NonCryptographicHashAlgorithm hash = CreateInstance(); + + foreach (ReadOnlyMemory chunk in testCase.EnumerateDataChunks()) + { + hash.Append(chunk.Span); + } + + byte[] answer = hash.GetHashAndReset(); + testCase.VerifyResponse(answer); + } + protected void InstanceVerifyEmptyStateDriver(TestCase testCase) { Span buf = stackalloc byte[256]; @@ -280,46 +294,23 @@ private void VerifyEmptyResult(ReadOnlySpan result) } } - public sealed class TestCase + public abstract class TestCaseBase { - private byte[] _input; - private byte[] _output; - + private readonly byte[] _output; public string Name { get; } - public ReadOnlySpan Input => new ReadOnlySpan(_input); + public ReadOnlySpan OutputBytes => _output; public string OutputHex { get; } - public TestCase(string name, byte[] input, byte[] output) - { - Name = name; - _input = input; - OutputHex = ToHexString(output); - _output = FromHexString(OutputHex); - } - - public TestCase(string name, byte[] input, string outputHex) - { - Name = name; - _input = input; - OutputHex = outputHex.ToUpperInvariant(); - _output = FromHexString(OutputHex); - } - - public TestCase(string name, string inputHex, string outputHex) + protected TestCaseBase(string name, byte[] output) { - Name = name; - _input = FromHexString(inputHex); - OutputHex = outputHex.ToUpperInvariant(); - _output = FromHexString(OutputHex); - } - - internal void VerifyResponse(ReadOnlySpan response) - { - if (!response.SequenceEqual(_output)) + if (output is null || output.Length == 0) { - // We know this will fail, but it gives a nice presentation. - Assert.Equal(OutputHex, ToHexString(response)); + throw new ArgumentException("Argument should not be null or empty.", nameof(output)); } + + Name = name; + _output = output; + OutputHex = ToHexString(output); } internal static string ToHexString(ReadOnlySpan input) @@ -356,6 +347,80 @@ internal static byte[] FromHexString(string hexString) } public override string ToString() => Name; + + internal void VerifyResponse(ReadOnlySpan response) + { + if (!response.SequenceEqual(OutputBytes)) + { + // We know this will fail, but it gives a nice presentation. + Assert.Equal(OutputHex, ToHexString(response)); + } + } + } + + public sealed class TestCase : TestCaseBase + { + private readonly byte[] _input; + public ReadOnlySpan Input => new ReadOnlySpan(_input); + + public TestCase(string name, byte[] input, byte[] output) + : base(name, output) + { + _input = input; + } + + public TestCase(string name, byte[] input, string outputHex) + : base(name, FromHexString(outputHex)) + { + _input = input; + } + + public TestCase(string name, string inputHex, string outputHex) + : base(name, FromHexString(outputHex)) + { + _input = FromHexString(inputHex); + } + } + + public sealed class LargeTestCase : TestCaseBase + { + private readonly byte _data; + private readonly long _repeatCount; + + public LargeTestCase(string name, byte data, long repeatCount, string outputHex) + : base(name, FromHexString(outputHex)) + { + if (repeatCount < 0) + { + throw new ArgumentOutOfRangeException(nameof(repeatCount)); + } + + _data = data; + _repeatCount = repeatCount; + } + + public IEnumerable> EnumerateDataChunks() + { +#if NET5_0_OR_GREATER + byte[] chunk = GC.AllocateUninitializedArray(1024 * 1024); +#else + byte[] chunk = new byte[1024 * 1024]; +#endif + chunk.AsSpan().Fill(_data); + + long remaining = _repeatCount; + while (remaining > 0) + { + int thisChunkLength = (int)Math.Min(remaining, chunk.Length); + yield return chunk.AsMemory(0, thisChunkLength); + remaining -= thisChunkLength; + } + } + } + + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] + private sealed class OverrideOptionalAttribute : Attribute + { } } } diff --git a/src/libraries/System.IO.Hashing/tests/XxHash32Tests.007.cs b/src/libraries/System.IO.Hashing/tests/XxHash32Tests.007.cs index eed5aec365b3eb..4ccef977c4389e 100644 --- a/src/libraries/System.IO.Hashing/tests/XxHash32Tests.007.cs +++ b/src/libraries/System.IO.Hashing/tests/XxHash32Tests.007.cs @@ -36,6 +36,10 @@ public static IEnumerable TestCases private const string DotNetHashesThis3 = DotNetHashesThis + DotNetHashesThis + DotNetHashesThis; private const string DotNetNCHashing = ".NET now has non-crypto hashing"; private const string DotNetNCHashing3 = DotNetNCHashing + DotNetNCHashing + DotNetNCHashing; + private const string SixteenBytes = ".NET Hashes This"; + private const string SixteenBytes3 = SixteenBytes + SixteenBytes + SixteenBytes; + private const string EightBytes = "Hashing!"; + private const string EightBytes3 = EightBytes + EightBytes + EightBytes; protected static IEnumerable TestCaseDefinitions { get; } = new[] @@ -77,6 +81,40 @@ public static IEnumerable TestCases $"{DotNetNCHashing} (x3)", Encoding.ASCII.GetBytes(DotNetNCHashing3), "CABC8ABD"), + // stripe size + new TestCase( + $"{SixteenBytes} (x3)", + Encoding.ASCII.GetBytes(SixteenBytes3), + "AD98EBD3"), + new TestCase( + $"{EightBytes} (x3)", + Encoding.ASCII.GetBytes(EightBytes3), + "FC23CD03"), + }; + + public static IEnumerable LargeTestCases + { + get + { + object[] arr = new object[1]; + + foreach (LargeTestCase testCase in LargeTestCaseDefinitions) + { + arr[0] = testCase; + yield return arr; + } + } + } + + protected static IEnumerable LargeTestCaseDefinitions { get; } = + new[] + { + // Manually run against the xxHash32 reference implementation. + new LargeTestCase( + "EEEEE... (10GB)", + (byte)'E', + 10L * 1024 * 1024 * 1024, // 10 GB + "1C44F650"), }; protected override NonCryptographicHashAlgorithm CreateInstance() => new XxHash32(Seed); @@ -112,6 +150,14 @@ public void InstanceMultiAppendGetCurrentHash(TestCase testCase) InstanceMultiAppendGetCurrentHashDriver(testCase); } + [Theory] + [MemberData(nameof(LargeTestCases))] + [OuterLoop] + public void InstanceMultiAppendLargeInput(LargeTestCase testCase) + { + InstanceMultiAppendLargeInputDriver(testCase); + } + [Theory] [MemberData(nameof(TestCases))] public void InstanceVerifyEmptyState(TestCase testCase) diff --git a/src/libraries/System.IO.Hashing/tests/XxHash32Tests.cs b/src/libraries/System.IO.Hashing/tests/XxHash32Tests.cs index f9dccad0294028..8e68f52259ab2e 100644 --- a/src/libraries/System.IO.Hashing/tests/XxHash32Tests.cs +++ b/src/libraries/System.IO.Hashing/tests/XxHash32Tests.cs @@ -34,6 +34,10 @@ public static IEnumerable TestCases private const string DotNetHashesThis3 = DotNetHashesThis + DotNetHashesThis + DotNetHashesThis; private const string DotNetNCHashing = ".NET now has non-crypto hashing"; private const string DotNetNCHashing3 = DotNetNCHashing + DotNetNCHashing + DotNetNCHashing; + private const string SixteenBytes = ".NET Hashes This"; + private const string SixteenBytes3 = SixteenBytes + SixteenBytes + SixteenBytes; + private const string EightBytes = "Hashing!"; + private const string EightBytes3 = EightBytes + EightBytes + EightBytes; protected static IEnumerable TestCaseDefinitions { get; } = new[] @@ -90,6 +94,41 @@ public static IEnumerable TestCases $"{DotNetNCHashing} (x3)", Encoding.ASCII.GetBytes(DotNetNCHashing3), "65242024"), + // stripe size + new TestCase( + $"{SixteenBytes} (x3)", + Encoding.ASCII.GetBytes(SixteenBytes3), + "29DA7472"), + // 8 * 3 bytes, filling the holdback buffer exactly on the second Append call. + new TestCase( + $"{EightBytes} (x3)", + Encoding.ASCII.GetBytes(EightBytes3), + "5DF7D6C0"), + }; + + public static IEnumerable LargeTestCases + { + get + { + object[] arr = new object[1]; + + foreach (LargeTestCase testCase in LargeTestCaseDefinitions) + { + arr[0] = testCase; + yield return arr; + } + } + } + + protected static IEnumerable LargeTestCaseDefinitions { get; } = + new[] + { + // Manually run against the xxHash32 reference implementation. + new LargeTestCase( + "EEEEE... (10GB)", + (byte)'E', + 10L * 1024 * 1024 * 1024, // 10 GB + "22CBC3AA"), }; protected override NonCryptographicHashAlgorithm CreateInstance() => new XxHash32(); @@ -125,6 +164,14 @@ public void InstanceMultiAppendGetCurrentHash(TestCase testCase) InstanceMultiAppendGetCurrentHashDriver(testCase); } + [Theory] + [MemberData(nameof(LargeTestCases))] + [OuterLoop] + public void InstanceMultiAppendLargeInput(LargeTestCase testCase) + { + InstanceMultiAppendLargeInputDriver(testCase); + } + [Theory] [MemberData(nameof(TestCases))] public void InstanceVerifyEmptyState(TestCase testCase) diff --git a/src/libraries/System.IO.Hashing/tests/XxHash32Tests.f00d.cs b/src/libraries/System.IO.Hashing/tests/XxHash32Tests.f00d.cs index 5171e62f8ca562..b1efba3cd2fe23 100644 --- a/src/libraries/System.IO.Hashing/tests/XxHash32Tests.f00d.cs +++ b/src/libraries/System.IO.Hashing/tests/XxHash32Tests.f00d.cs @@ -36,6 +36,10 @@ public static IEnumerable TestCases private const string DotNetHashesThis3 = DotNetHashesThis + DotNetHashesThis + DotNetHashesThis; private const string DotNetNCHashing = ".NET now has non-crypto hashing"; private const string DotNetNCHashing3 = DotNetNCHashing + DotNetNCHashing + DotNetNCHashing; + private const string SixteenBytes = ".NET Hashes This"; + private const string SixteenBytes3 = SixteenBytes + SixteenBytes + SixteenBytes; + private const string EightBytes = "Hashing!"; + private const string EightBytes3 = EightBytes + EightBytes + EightBytes; protected static IEnumerable TestCaseDefinitions { get; } = new[] @@ -77,6 +81,40 @@ public static IEnumerable TestCases $"{DotNetNCHashing} (x3)", Encoding.ASCII.GetBytes(DotNetNCHashing3), "5A513E6D"), + // stripe size + new TestCase( + $"{SixteenBytes} (x3)", + Encoding.ASCII.GetBytes(SixteenBytes3), + "B38A9A45"), + new TestCase( + $"{EightBytes} (x3)", + Encoding.ASCII.GetBytes(EightBytes3), + "C7A3D1CB"), + }; + + public static IEnumerable LargeTestCases + { + get + { + object[] arr = new object[1]; + + foreach (LargeTestCase testCase in LargeTestCaseDefinitions) + { + arr[0] = testCase; + yield return arr; + } + } + } + + protected static IEnumerable LargeTestCaseDefinitions { get; } = + new[] + { + // Manually run against the xxHash32 reference implementation. + new LargeTestCase( + "EEEEE... (10GB)", + (byte)'E', + 10L * 1024 * 1024 * 1024, // 10 GB + "B19FAE15"), }; protected override NonCryptographicHashAlgorithm CreateInstance() => new XxHash32(Seed); @@ -112,6 +150,14 @@ public void InstanceMultiAppendGetCurrentHash(TestCase testCase) InstanceMultiAppendGetCurrentHashDriver(testCase); } + [Theory] + [MemberData(nameof(LargeTestCases))] + [OuterLoop] + public void InstanceMultiAppendLargeInput(LargeTestCase testCase) + { + InstanceMultiAppendLargeInputDriver(testCase); + } + [Theory] [MemberData(nameof(TestCases))] public void InstanceVerifyEmptyState(TestCase testCase) diff --git a/src/libraries/System.IO.Hashing/tests/XxHash64Tests.007.cs b/src/libraries/System.IO.Hashing/tests/XxHash64Tests.007.cs index 5c2e575377870d..fd5477c757d0b3 100644 --- a/src/libraries/System.IO.Hashing/tests/XxHash64Tests.007.cs +++ b/src/libraries/System.IO.Hashing/tests/XxHash64Tests.007.cs @@ -38,6 +38,10 @@ public static IEnumerable TestCases private const string DotNetNCHashing = ".NET now has non-crypto hashing"; private const string SixtyThreeBytes = "A sixty-three byte test input requires substantial forethought!"; private const string SixtyThreeBytes3 = SixtyThreeBytes + SixtyThreeBytes + SixtyThreeBytes; + private const string ThirtyTwoBytes = "This string has 32 ASCII bytes.."; + private const string ThirtyTwoBytes3 = ThirtyTwoBytes + ThirtyTwoBytes + ThirtyTwoBytes; + private const string SixteenBytes = "0123456789ABCDEF"; + private const string SixteenBytes3 = SixteenBytes + SixteenBytes + SixteenBytes; protected static IEnumerable TestCaseDefinitions { get; } = new[] @@ -87,6 +91,15 @@ public static IEnumerable TestCases $"{SixtyThreeBytes} (x3)", Encoding.ASCII.GetBytes(SixtyThreeBytes3), "D6095B93EB10BEDA"), + // stripe size + new TestCase( + $"{ThirtyTwoBytes} (x3)", + Encoding.ASCII.GetBytes(ThirtyTwoBytes3), + "45116421CF932B1F"), + new TestCase( + $"{SixteenBytes} (x3)", + Encoding.ASCII.GetBytes(SixteenBytes3), + "E4697CD5013DC0AF"), }; protected override NonCryptographicHashAlgorithm CreateInstance() => new XxHash64(Seed); @@ -101,6 +114,31 @@ protected override int StaticOneShot(ReadOnlySpan source, Span desti protected override bool TryStaticOneShot(ReadOnlySpan source, Span destination, out int bytesWritten) => XxHash64.TryHash(source, destination, out bytesWritten, Seed); + public static IEnumerable LargeTestCases + { + get + { + object[] arr = new object[1]; + + foreach (LargeTestCase testCase in LargeTestCaseDefinitions) + { + arr[0] = testCase; + yield return arr; + } + } + } + + protected static IEnumerable LargeTestCaseDefinitions { get; } = + new[] + { + // Manually run against the xxHash64 reference implementation. + new LargeTestCase( + "EEEEE... (10GB)", + (byte)'E', + 10L * 1024 * 1024 * 1024, // 10 GB + "DFBE10B17366232C"), + }; + [Theory] [MemberData(nameof(TestCases))] public void InstanceAppendAllocate(TestCase testCase) @@ -122,6 +160,14 @@ public void InstanceMultiAppendGetCurrentHash(TestCase testCase) InstanceMultiAppendGetCurrentHashDriver(testCase); } + [Theory] + [MemberData(nameof(LargeTestCases))] + [OuterLoop] + public void InstanceMultiAppendLargeInput(LargeTestCase testCase) + { + InstanceMultiAppendLargeInputDriver(testCase); + } + [Theory] [MemberData(nameof(TestCases))] public void InstanceVerifyEmptyState(TestCase testCase) diff --git a/src/libraries/System.IO.Hashing/tests/XxHash64Tests.cs b/src/libraries/System.IO.Hashing/tests/XxHash64Tests.cs index 973d108fc93778..d33be996495ca2 100644 --- a/src/libraries/System.IO.Hashing/tests/XxHash64Tests.cs +++ b/src/libraries/System.IO.Hashing/tests/XxHash64Tests.cs @@ -36,6 +36,10 @@ public static IEnumerable TestCases private const string DotNetNCHashing = ".NET now has non-crypto hashing"; private const string SixtyThreeBytes = "A sixty-three byte test input requires substantial forethought!"; private const string SixtyThreeBytes3 = SixtyThreeBytes + SixtyThreeBytes + SixtyThreeBytes; + private const string ThirtyTwoBytes = "This string has 32 ASCII bytes.."; + private const string ThirtyTwoBytes3 = ThirtyTwoBytes + ThirtyTwoBytes + ThirtyTwoBytes; + private const string SixteenBytes = "0123456789ABCDEF"; + private const string SixteenBytes3 = SixteenBytes + SixteenBytes + SixteenBytes; protected static IEnumerable TestCaseDefinitions { get; } = new[] @@ -103,6 +107,41 @@ public static IEnumerable TestCases $"{SixtyThreeBytes} (x3)", Encoding.ASCII.GetBytes(SixtyThreeBytes3), "239C7B3A85BD22B3"), + // stripe size + new TestCase( + $"{ThirtyTwoBytes} (x3)", + Encoding.ASCII.GetBytes(ThirtyTwoBytes3), + "975E3E6FE7E67FBC"), + // 16 * 3 bytes, filling the holdback buffer exactly on the second Append call. + new TestCase( + $"{SixteenBytes} (x3)", + Encoding.ASCII.GetBytes(SixteenBytes3), + "BDD40F0FAC166EAA"), + }; + + public static IEnumerable LargeTestCases + { + get + { + object[] arr = new object[1]; + + foreach (LargeTestCase testCase in LargeTestCaseDefinitions) + { + arr[0] = testCase; + yield return arr; + } + } + } + + protected static IEnumerable LargeTestCaseDefinitions { get; } = + new[] + { + // Manually run against the xxHash64 reference implementation. + new LargeTestCase( + "EEEEE... (10GB)", + (byte)'E', + 10L * 1024 * 1024 * 1024, // 10 GB + "F3CB8D45A8B695EF"), }; protected override NonCryptographicHashAlgorithm CreateInstance() => new XxHash64(); @@ -138,6 +177,14 @@ public void InstanceMultiAppendGetCurrentHash(TestCase testCase) InstanceMultiAppendGetCurrentHashDriver(testCase); } + [Theory] + [MemberData(nameof(LargeTestCases))] + [OuterLoop] + public void InstanceMultiAppendLargeInput(LargeTestCase testCase) + { + InstanceMultiAppendLargeInputDriver(testCase); + } + [Theory] [MemberData(nameof(TestCases))] public void InstanceVerifyEmptyState(TestCase testCase) diff --git a/src/libraries/System.IO.Hashing/tests/XxHash64Tests.f00d.cs b/src/libraries/System.IO.Hashing/tests/XxHash64Tests.f00d.cs index 23006a571627b3..4a020cb74c09b8 100644 --- a/src/libraries/System.IO.Hashing/tests/XxHash64Tests.f00d.cs +++ b/src/libraries/System.IO.Hashing/tests/XxHash64Tests.f00d.cs @@ -38,6 +38,10 @@ public static IEnumerable TestCases private const string DotNetNCHashing = ".NET now has non-crypto hashing"; private const string SixtyThreeBytes = "A sixty-three byte test input requires substantial forethought!"; private const string SixtyThreeBytes3 = SixtyThreeBytes + SixtyThreeBytes + SixtyThreeBytes; + private const string ThirtyTwoBytes = "This string has 32 ASCII bytes.."; + private const string ThirtyTwoBytes3 = ThirtyTwoBytes + ThirtyTwoBytes + ThirtyTwoBytes; + private const string SixteenBytes = "0123456789ABCDEF"; + private const string SixteenBytes3 = SixteenBytes + SixteenBytes + SixteenBytes; protected static IEnumerable TestCaseDefinitions { get; } = new[] @@ -87,6 +91,40 @@ public static IEnumerable TestCases $"{SixtyThreeBytes} (x3)", Encoding.ASCII.GetBytes(SixtyThreeBytes3), "6F1C62EB48EA2FEC"), + // stripe size + new TestCase( + $"{ThirtyTwoBytes} (x3)", + Encoding.ASCII.GetBytes(ThirtyTwoBytes3), + "B358EB96B8E3E7AD"), + new TestCase( + $"{SixteenBytes} (x3)", + Encoding.ASCII.GetBytes(SixteenBytes3), + "C9B96062B49FEC42"), + }; + + public static IEnumerable LargeTestCases + { + get + { + object[] arr = new object[1]; + + foreach (LargeTestCase testCase in LargeTestCaseDefinitions) + { + arr[0] = testCase; + yield return arr; + } + } + } + + protected static IEnumerable LargeTestCaseDefinitions { get; } = + new[] + { + // Manually run against the xxHash64 reference implementation. + new LargeTestCase( + "EEEEE... (10GB)", + (byte)'E', + 10L * 1024 * 1024 * 1024, // 10 GB + "CD7B3A954E199AE8"), }; protected override NonCryptographicHashAlgorithm CreateInstance() => new XxHash64(Seed); @@ -122,6 +160,14 @@ public void InstanceMultiAppendGetCurrentHash(TestCase testCase) InstanceMultiAppendGetCurrentHashDriver(testCase); } + [Theory] + [MemberData(nameof(LargeTestCases))] + [OuterLoop] + public void InstanceMultiAppendLargeInput(LargeTestCase testCase) + { + InstanceMultiAppendLargeInputDriver(testCase); + } + [Theory] [MemberData(nameof(TestCases))] public void InstanceVerifyEmptyState(TestCase testCase) diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs index 389ab072d9a6c9..6882527cecc8de 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics; using Microsoft.Win32.SafeHandles; namespace System.IO.MemoryMappedFiles @@ -173,9 +174,6 @@ private static FileStream CreateSharedBackingObject(Interop.Sys.MemoryMappedProt private static FileStream? CreateSharedBackingObjectUsingMemory( Interop.Sys.MemoryMappedProtections protections, long capacity, HandleInheritability inheritability) { - // The POSIX shared memory object name must begin with '/'. After that we just want something short and unique. - string mapName = string.Create(null, stackalloc char[128], $"/corefx_map_{Guid.NewGuid():N}"); - // Determine the flags to use when creating the shared memory object Interop.Sys.OpenFlags flags = (protections & Interop.Sys.MemoryMappedProtections.PROT_WRITE) != 0 ? Interop.Sys.OpenFlags.O_RDWR : @@ -191,22 +189,32 @@ private static FileStream CreateSharedBackingObject(Interop.Sys.MemoryMappedProt if ((protections & Interop.Sys.MemoryMappedProtections.PROT_EXEC) != 0) perms |= Interop.Sys.Permissions.S_IXUSR; - // Create the shared memory object. - SafeFileHandle fd = Interop.Sys.ShmOpen(mapName, flags, (int)perms); - if (fd.IsInvalid) + string mapName; + SafeFileHandle fd; + + do { - Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); - if (errorInfo.Error == Interop.Error.ENOTSUP) + mapName = GenerateMapName(); + fd = Interop.Sys.ShmOpen(mapName, flags, (int)perms); // Create the shared memory object. + + if (fd.IsInvalid) { - // If ShmOpen is not supported, fall back to file backing object. - // Note that the System.Native shim will force this failure on platforms where - // the result of native shm_open does not work well with our subsequent call - // to mmap. - return null; - } + Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); + fd.Dispose(); - throw Interop.GetExceptionForIoErrno(errorInfo); - } + if (errorInfo.Error == Interop.Error.ENOTSUP) + { + // If ShmOpen is not supported, fall back to file backing object. + // Note that the System.Native shim will force this failure on platforms where + // the result of native shm_open does not work well with our subsequent call to mmap. + return null; + } + else if (errorInfo.Error != Interop.Error.EEXIST) // map with same name already existed + { + throw Interop.GetExceptionForIoErrno(errorInfo); + } + } + } while (fd.IsInvalid); try { @@ -236,6 +244,18 @@ private static FileStream CreateSharedBackingObject(Interop.Sys.MemoryMappedProt fd.Dispose(); throw; } + + static string GenerateMapName() + { + const int MaxSharedMemoryObjectNameLength = 32; // SHM_NAME_MAX on OSX ARM64, on other systems it's equal PATH_MAX (250) + // The POSIX shared memory object name must begin with '/'. After that we just want something short (32) and unique. + return string.Create(MaxSharedMemoryObjectNameLength, 0, (span, state) => + { + Guid.NewGuid().TryFormat(span, out int charsWritten, "N"); + Debug.Assert(charsWritten == MaxSharedMemoryObjectNameLength); + "/dotnet_".CopyTo(span); + }); + } } private static FileStream CreateSharedBackingObjectUsingFile(Interop.Sys.MemoryMappedProtections protections, long capacity, HandleInheritability inheritability) diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs index e7c5ee2f80c3a6..70b82398301d56 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs @@ -11,7 +11,6 @@ namespace System.IO.MemoryMappedFiles.Tests /// /// Tests for MemoryMappedFile.CreateNew. /// - [ActiveIssue("https://github.com/dotnet/runtime/issues/49104", typeof(PlatformDetection), nameof(PlatformDetection.IsMacOsAppleSilicon))] public class MemoryMappedFileTests_CreateNew : MemoryMappedFilesTestBase { /// diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs index 8f7e2fae576eb0..8fe35396ae8044 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs @@ -11,7 +11,6 @@ namespace System.IO.MemoryMappedFiles.Tests /// /// Tests for MemoryMappedViewAccessor. /// - [ActiveIssue("https://github.com/dotnet/runtime/issues/49104", typeof(PlatformDetection), nameof(PlatformDetection.IsMacOsAppleSilicon))] public class MemoryMappedViewAccessorTests : MemoryMappedFilesTestBase { /// @@ -91,10 +90,10 @@ public void ValidAccessLevelCombinations(MemoryMappedFileAccess mapAccess, Memor } catch (UnauthorizedAccessException) { - if ((OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst() || PlatformDetection.IsInContainer) && + if ((OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst() || OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || PlatformDetection.IsInContainer) && (viewAccess == MemoryMappedFileAccess.ReadExecute || viewAccess == MemoryMappedFileAccess.ReadWriteExecute)) { - // Containers and OSX with SIP enabled do not have execute permissions by default. + // Containers and OSXlike platforms with SIP enabled do not have execute permissions by default. throw new SkipTestException("Insufficient execute permission."); } diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs index d77a24ae0ddfa6..f279b8c33f98f7 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs @@ -11,7 +11,6 @@ namespace System.IO.MemoryMappedFiles.Tests /// /// Tests for MemoryMappedViewStream. /// - [ActiveIssue("https://github.com/dotnet/runtime/issues/49104", typeof(PlatformDetection), nameof(PlatformDetection.IsMacOsAppleSilicon))] public class MemoryMappedViewStreamTests : MemoryMappedFilesTestBase { /// @@ -91,10 +90,10 @@ public void ValidAccessLevelCombinations(MemoryMappedFileAccess mapAccess, Memor } catch (UnauthorizedAccessException) { - if ((OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst() || PlatformDetection.IsInContainer) && + if ((OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst() || OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || PlatformDetection.IsInContainer) && (viewAccess == MemoryMappedFileAccess.ReadExecute || viewAccess == MemoryMappedFileAccess.ReadWriteExecute)) { - // Containers and OSX with SIP enabled do not have execute permissions by default. + // Containers and OSXlike platforms with SIP enabled do not have execute permissions by default. throw new SkipTestException("Insufficient execute permission."); } diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs index e84a86a91f20cc..c190d329a00fe6 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs @@ -45,7 +45,6 @@ private Task CreateStream(byte[] initialData, FileAccess access) } } - [ActiveIssue("https://github.com/dotnet/runtime/issues/49104", typeof(PlatformDetection), nameof(PlatformDetection.IsMacOsAppleSilicon))] public class AnonymousMemoryMappedViewStreamConformanceTests : MemoryMappedViewStreamConformanceTests { protected override MemoryMappedFile CreateFile(int length) => diff --git a/src/libraries/System.IO.Packaging/src/CompatibilitySuppressions.xml b/src/libraries/System.IO.Packaging/src/CompatibilitySuppressions.xml index ca7554cc926e6c..c4a6f07ed08c6a 100644 --- a/src/libraries/System.IO.Packaging/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.IO.Packaging/src/CompatibilitySuppressions.xml @@ -1,10 +1,5 @@  - - CP0001 - lib/netstandard2.0/System.IO.Packaging.dll - lib/net461/System.IO.Packaging.dll - PKV006 .NETFramework,Version=v4.6 diff --git a/src/libraries/System.IO.Packaging/src/System.IO.Packaging.csproj b/src/libraries/System.IO.Packaging/src/System.IO.Packaging.csproj index cc566e6515a1e1..3444e2515ce837 100644 --- a/src/libraries/System.IO.Packaging/src/System.IO.Packaging.csproj +++ b/src/libraries/System.IO.Packaging/src/System.IO.Packaging.csproj @@ -6,6 +6,9 @@ $(NoWarn);CA1847 true + + false + 0 Provides classes that support storage of multiple data objects in a single container. diff --git a/src/libraries/System.IO.Pipelines/src/System.IO.Pipelines.csproj b/src/libraries/System.IO.Pipelines/src/System.IO.Pipelines.csproj index 34f79827374acc..1d3ba746a5b84b 100644 --- a/src/libraries/System.IO.Pipelines/src/System.IO.Pipelines.csproj +++ b/src/libraries/System.IO.Pipelines/src/System.IO.Pipelines.csproj @@ -9,6 +9,7 @@ Commonly Used Types: System.IO.Pipelines.Pipe System.IO.Pipelines.PipeWriter System.IO.Pipelines.PipeReader + 3 FlushAsync(CancellationToken cancellationToken) ValueTask result; lock (SyncObj) { - PrepareFlush(out completionData, out result, cancellationToken); + PrepareFlushUnsynchronized(out completionData, out result, cancellationToken); } TrySchedule(ReaderScheduler, completionData); @@ -355,7 +355,7 @@ internal ValueTask FlushAsync(CancellationToken cancellationToken) return result; } - private void PrepareFlush(out CompletionData completionData, out ValueTask result, CancellationToken cancellationToken) + private void PrepareFlushUnsynchronized(out CompletionData completionData, out ValueTask result, CancellationToken cancellationToken) { var completeReader = CommitUnsynchronized(); @@ -691,6 +691,9 @@ internal ValueTask ReadAtLeastAsync(int minimumBytes, CancellationTo // We also need to flip the reading state off _operationState.EndRead(); + + // Begin read again to wire up cancellation token + _readerAwaitable.BeginOperation(token, s_signalReaderAwaitable, this); } // If the writer is currently paused and we are about the wait for more data then this would deadlock. @@ -1057,7 +1060,7 @@ internal ValueTask WriteAsync(ReadOnlyMemory source, Cancella WriteMultiSegment(source.Span); } - PrepareFlush(out completionData, out result, cancellationToken); + PrepareFlushUnsynchronized(out completionData, out result, cancellationToken); } TrySchedule(ReaderScheduler, completionData); @@ -1082,7 +1085,7 @@ private void WriteMultiSegment(ReadOnlySpan source) } // We filled the segment - _writingHead.End += writable; + _writingHead.End += _writingHeadBytesBuffered; _writingHeadBytesBuffered = 0; // This is optimized to use pooled memory. That's why we pass 0 instead of diff --git a/src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/PipeAwaitable.cs b/src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/PipeAwaitable.cs index fb25780a3fab46..aba52f13e96469 100644 --- a/src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/PipeAwaitable.cs +++ b/src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/PipeAwaitable.cs @@ -47,16 +47,33 @@ public void BeginOperation(CancellationToken cancellationToken, Action { cancellationToken.ThrowIfCancellationRequested(); - _awaitableState |= AwaitableState.Running; - // Don't register if already completed, we would immediately unregistered in ObserveCancellation if (cancellationToken.CanBeCanceled && !IsCompleted) { +#if DEBUG + var previousAwaitableState = _awaitableState; +#endif + + _cancellationTokenRegistration = cancellationToken.UnsafeRegister(callback, state); + + // If we get back the default CancellationTokenRegistration then it means the + // callback synchronously and we can throw inline. This is safe because we haven't changed + // the state of the awaitable as yet. + if (_cancellationTokenRegistration == default(CancellationTokenRegistration)) + { +#if DEBUG + Debug.Assert(previousAwaitableState == _awaitableState, "The awaitable state changed!"); +#endif + + cancellationToken.ThrowIfCancellationRequested(); + } + #if (NETSTANDARD2_0 || NETFRAMEWORK) _cancellationToken = cancellationToken; #endif - _cancellationTokenRegistration = cancellationToken.UnsafeRegister(callback, state); } + + _awaitableState |= AwaitableState.Running; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs b/src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs index 7b33539b540b33..cc457bf9bf2bff 100644 --- a/src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs +++ b/src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs @@ -383,11 +383,13 @@ public override async Task CopyToAsync(PipeWriter destination, CancellationToken try { BufferSegment? segment = _readHead; + int segmentIndex = _readIndex; + try { while (segment != null) { - FlushResult flushResult = await destination.WriteAsync(segment.Memory, tokenSource.Token).ConfigureAwait(false); + FlushResult flushResult = await destination.WriteAsync(segment.Memory.Slice(segmentIndex), tokenSource.Token).ConfigureAwait(false); if (flushResult.IsCanceled) { @@ -395,6 +397,7 @@ public override async Task CopyToAsync(PipeWriter destination, CancellationToken } segment = segment.NextSegment; + segmentIndex = 0; if (flushResult.IsCompleted) { @@ -451,13 +454,16 @@ public override async Task CopyToAsync(Stream destination, CancellationToken can try { BufferSegment? segment = _readHead; + int segmentIndex = _readIndex; + try { while (segment != null) { - await destination.WriteAsync(segment.Memory, tokenSource.Token).ConfigureAwait(false); + await destination.WriteAsync(segment.Memory.Slice(segmentIndex), tokenSource.Token).ConfigureAwait(false); segment = segment.NextSegment; + segmentIndex = 0; } } finally diff --git a/src/libraries/System.IO.Pipelines/tests/PipeLengthTests.cs b/src/libraries/System.IO.Pipelines/tests/PipeLengthTests.cs index fcf9d7af55b053..fd9fc83833a8b1 100644 --- a/src/libraries/System.IO.Pipelines/tests/PipeLengthTests.cs +++ b/src/libraries/System.IO.Pipelines/tests/PipeLengthTests.cs @@ -277,5 +277,19 @@ public async Task NullExaminedAndConsumedNoops() ReadResult result = await _pipe.Reader.ReadAsync(); _pipe.Reader.AdvanceTo(default, default); } + + [Fact] + public async Task AdvanceFollowedByWriteAsyncTest() + { + Memory buffer = new byte[26]; + Pipe pipe = new(new PipeOptions(minimumSegmentSize: 1)); + + var mem = pipe.Writer.GetMemory(14)[..14]; + buffer[..14].CopyTo(mem); + pipe.Writer.Advance(14); + await pipe.Writer.WriteAsync(buffer[14..]); + ReadResult res = await pipe.Reader.ReadAsync(); + Assert.Equal(res.Buffer.Length, buffer.Length); + } } } diff --git a/src/libraries/System.IO.Pipelines/tests/PipeReaderCopyToAsyncTests.cs b/src/libraries/System.IO.Pipelines/tests/PipeReaderCopyToAsyncTests.cs index e58e5af4e70598..adf547a3c452bf 100644 --- a/src/libraries/System.IO.Pipelines/tests/PipeReaderCopyToAsyncTests.cs +++ b/src/libraries/System.IO.Pipelines/tests/PipeReaderCopyToAsyncTests.cs @@ -286,5 +286,41 @@ public async Task ThrowingFromStreamCallsAdvanceToWithStartOfLastReadResult(int Assert.True(startPosition.Equals(wrappedPipeReader.LastConsumed)); Assert.True(startPosition.Equals(wrappedPipeReader.LastExamined)); } + + [Fact] + public async Task CopyToAsyncStreamCopiesRemainderAfterReadingSome() + { + var buffer = Encoding.UTF8.GetBytes("Hello World"); + await Pipe.Writer.WriteAsync(buffer); + Pipe.Writer.Complete(); + + var result = await PipeReader.ReadAsync(); + Assert.Equal(result.Buffer.ToArray(), buffer); + // Consume Hello + PipeReader.AdvanceTo(result.Buffer.GetPosition(5)); + + var ms = new MemoryStream(); + await PipeReader.CopyToAsync(ms); + + Assert.Equal(buffer.AsMemory(5).ToArray(), ms.ToArray()); + } + + [Fact] + public async Task CopyToAsyncPipeWriterCopiesRemainderAfterReadingSome() + { + var buffer = Encoding.UTF8.GetBytes("Hello World"); + await Pipe.Writer.WriteAsync(buffer); + Pipe.Writer.Complete(); + + var result = await PipeReader.ReadAsync(); + Assert.Equal(result.Buffer.ToArray(), buffer); + // Consume Hello + PipeReader.AdvanceTo(result.Buffer.GetPosition(5)); + + var ms = new MemoryStream(); + await PipeReader.CopyToAsync(PipeWriter.Create(ms)); + + Assert.Equal(buffer.AsMemory(5).ToArray(), ms.ToArray()); + } } } diff --git a/src/libraries/System.IO.Pipelines/tests/PipeReaderReadAtLeastAsyncTests.cs b/src/libraries/System.IO.Pipelines/tests/PipeReaderReadAtLeastAsyncTests.cs index c12d3b88253cfa..64762de5ec8cee 100644 --- a/src/libraries/System.IO.Pipelines/tests/PipeReaderReadAtLeastAsyncTests.cs +++ b/src/libraries/System.IO.Pipelines/tests/PipeReaderReadAtLeastAsyncTests.cs @@ -162,5 +162,36 @@ public async Task WriteAndCancellingPendingReadBeforeReadAtLeastAsync() Assert.True(result.IsCanceled); PipeReader.AdvanceTo(buffer.End); } + + [Fact] + public Task ReadAtLeastAsyncCancelableWhenWaitingForMoreData() + { + CancellationTokenSource cts = new CancellationTokenSource(); + ValueTask task = PipeReader.ReadAtLeastAsync(1, cts.Token); + cts.Cancel(); + return Assert.ThrowsAsync(async () => await task); + } + + [Fact] + public async Task ReadAtLeastAsyncCancelableAfterReadingSome() + { + CancellationTokenSource cts = new CancellationTokenSource(); + await Pipe.WriteAsync(new byte[10], default); + ValueTask task = PipeReader.ReadAtLeastAsync(11, cts.Token); + cts.Cancel(); + await Assert.ThrowsAsync(async () => await task); + } + + [Fact] + public async Task ReadAtLeastAsyncCancelableAfterReadingSomeAndWritingAfterStartingRead() + { + CancellationTokenSource cts = new CancellationTokenSource(); + await Pipe.WriteAsync(new byte[10], default); + ValueTask task = PipeReader.ReadAtLeastAsync(12, cts.Token); + // Write, but not enough to unblock ReadAtLeastAsync + await Pipe.WriteAsync(new byte[1], default); + cts.Cancel(); + await Assert.ThrowsAnyAsync(async () => await task); + } } } diff --git a/src/libraries/System.IO.Ports/pkg/runtime.native.System.IO.Ports.props b/src/libraries/System.IO.Ports/pkg/runtime.native.System.IO.Ports.props index 557c2231228086..dd4aff2fd0e456 100644 --- a/src/libraries/System.IO.Ports/pkg/runtime.native.System.IO.Ports.props +++ b/src/libraries/System.IO.Ports/pkg/runtime.native.System.IO.Ports.props @@ -8,7 +8,8 @@ none true $(SymbolsSuffix) - $(TargetsForTfmSpecificDebugSymbolsInPackage);AddRuntimeSpecificNativeSymbolToPackage + + $(TargetsForTfmSpecificDebugSymbolsInPackage);AddRuntimeSpecificNativeSymbolToPackage true $(NoWarn);NU5128 diff --git a/src/libraries/System.IO.Ports/pkg/runtime.osx-arm64.runtime.native.System.IO.Ports.proj b/src/libraries/System.IO.Ports/pkg/runtime.osx-arm64.runtime.native.System.IO.Ports.proj new file mode 100644 index 00000000000000..f93b313169e79c --- /dev/null +++ b/src/libraries/System.IO.Ports/pkg/runtime.osx-arm64.runtime.native.System.IO.Ports.proj @@ -0,0 +1,7 @@ + + + + + true + + \ No newline at end of file diff --git a/src/libraries/System.IO.Ports/src/CompatibilitySuppressions.xml b/src/libraries/System.IO.Ports/src/CompatibilitySuppressions.xml deleted file mode 100644 index 3d3afe95121eaa..00000000000000 --- a/src/libraries/System.IO.Ports/src/CompatibilitySuppressions.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - CP0001 - lib/netstandard2.0/System.IO.Ports.dll - lib/net461/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.Handshake - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.Parity - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialData - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialDataReceivedEventArgs - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialDataReceivedEventHandler - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialError - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialErrorReceivedEventArgs - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialErrorReceivedEventHandler - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialPinChange - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialPinChangedEventArgs - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialPinChangedEventHandler - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.SerialPort - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - - CP0001 - T:System.IO.Ports.StopBits - lib/net461/System.IO.Ports.dll - runtimes/unix/lib/netstandard2.0/System.IO.Ports.dll - - \ No newline at end of file diff --git a/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj b/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj index e017d4db8bf40a..5e1d0ab2217c65 100644 --- a/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj +++ b/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj @@ -6,6 +6,9 @@ annotations $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent);netstandard2.0-windows;netstandard2.0-Unix;netstandard2.0;net461-windows true + + false + 0 Provides classes for controlling serial ports. Commonly Used Types: diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/DosDevices.cs b/src/libraries/System.IO.Ports/tests/SerialPort/DosDevices.cs index 3fe9493c0a30e5..2d74327f97eb0d 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/DosDevices.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/DosDevices.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; +using System.ComponentModel; using System.Runtime.InteropServices; namespace System.IO.Ports.Tests @@ -127,14 +128,20 @@ private static char[] CallQueryDosDevice(string name, out int dataSize) buffer = new char[buffer.Length * 2]; dataSize = QueryDosDevice(null, buffer, buffer.Length); } + else if (lastError == ERROR_ACCESS_DENIED) // Access denied eg for "MSSECFLTSYS" - just skip + { + dataSize = 0; + break; + } else { - throw new Exception("Unknown Win32 Error: " + lastError); + throw new Exception($"Error {lastError} calling QueryDosDevice for '{name}' with buffer size {buffer.Length}. {new Win32Exception((int)lastError).Message}"); } } return buffer; } + public const int ERROR_ACCESS_DENIED = 5; public const int ERROR_INSUFFICIENT_BUFFER = 122; public const int ERROR_MORE_DATA = 234; diff --git a/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs b/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs index 08268755202054..8d11c80336711a 100644 --- a/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs +++ b/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs @@ -323,6 +323,40 @@ public async Task CopyToTest_ReadBeforeCopy_CopiesAllData(bool copyAsynchronousl Array.Copy(data, 1, expected, 0, expected.Length); Assert.Equal(expected, dst.ToArray()); } + + [Fact] + [OuterLoop] + [ActiveIssue("https://github.com/dotnet/runtime/issues/45954", TestPlatforms.Browser)] + public void NoInt32OverflowInTheBufferingLogic() + { + const long position1 = 10; + const long position2 = (1L << 32) + position1; + + string filePath = Path.GetTempFileName(); + byte[] data1 = new byte[] { 1, 2, 3, 4, 5 }; + byte[] data2 = new byte[] { 6, 7, 8, 9, 10 }; + byte[] buffer = new byte[5]; + + using (var stream = new FileStream(filePath, FileMode.Create, FileAccess.Write)) + { + stream.Seek(position1, SeekOrigin.Begin); + stream.Write(data1); + + stream.Seek(position2, SeekOrigin.Begin); + stream.Write(data2); + } + + using (var stream = new BufferedStream(new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.None, bufferSize: 0, FileOptions.DeleteOnClose))) + { + stream.Seek(position1, SeekOrigin.Begin); + Assert.Equal(buffer.Length, stream.Read(buffer)); + Assert.Equal(data1, buffer); + + stream.Seek(position2, SeekOrigin.Begin); + Assert.Equal(buffer.Length, stream.Read(buffer)); + Assert.Equal(data2, buffer); + } + } } public class BufferedStream_TestLeaveOpen : TestLeaveOpen diff --git a/src/libraries/System.IO/tests/Net5CompatTests/System.IO.Net5Compat.Tests.csproj b/src/libraries/System.IO/tests/Net5CompatTests/System.IO.Net5Compat.Tests.csproj index 321e2f485088b8..c07749abe26b08 100644 --- a/src/libraries/System.IO/tests/Net5CompatTests/System.IO.Net5Compat.Tests.csproj +++ b/src/libraries/System.IO/tests/Net5CompatTests/System.IO.Net5Compat.Tests.csproj @@ -4,8 +4,7 @@ true true true - - $(NetCoreAppCurrent)-windows + $(NetCoreAppCurrent) diff --git a/src/libraries/System.Linq.Queryable/src/System/Linq/EnumerableRewriter.cs b/src/libraries/System.Linq.Queryable/src/System/Linq/EnumerableRewriter.cs index ad489f768ec11c..faf127b5e3eb28 100644 --- a/src/libraries/System.Linq.Queryable/src/System/Linq/EnumerableRewriter.cs +++ b/src/libraries/System.Linq.Queryable/src/System/Linq/EnumerableRewriter.cs @@ -255,25 +255,86 @@ protected override Expression VisitConstant(ConstantExpression c) } private static ILookup? s_seqMethods; - [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060:MakeGenericMethod", - Justification = "Enumerable methods don't have trim annotations.")] private static MethodInfo FindEnumerableMethodForQueryable(string name, ReadOnlyCollection args, params Type[]? typeArgs) { - if (s_seqMethods == null) + s_seqMethods ??= GetEnumerableStaticMethods(typeof(Enumerable)).ToLookup(m => m.Name); + + MethodInfo[] matchingMethods = s_seqMethods[name] + .Where(m => ArgsMatch(m, args, typeArgs)) + .Select(ApplyTypeArgs) + .ToArray(); + + Debug.Assert(matchingMethods.Length > 0, "All static methods with arguments on Queryable have equivalents on Enumerable."); + + if (matchingMethods.Length > 1) { - s_seqMethods = GetEnumerableStaticMethods(typeof(Enumerable)).ToLookup(m => m.Name); + return DisambiguateMatches(matchingMethods); } - MethodInfo? mi = s_seqMethods[name].FirstOrDefault(m => ArgsMatch(m, args, typeArgs)); - Debug.Assert(mi != null, "All static methods with arguments on Queryable have equivalents on Enumerable."); - if (typeArgs != null) - return mi.MakeGenericMethod(typeArgs); - return mi; + + return matchingMethods[0]; [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern", Justification = "This method is intentionally hiding the Enumerable type from the trimmer so it doesn't preserve all Enumerable's methods. " + "This is safe because all Queryable methods have a DynamicDependency to the corresponding Enumerable method.")] static MethodInfo[] GetEnumerableStaticMethods(Type type) => type.GetMethods(BindingFlags.Public | BindingFlags.Static); + + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060:MakeGenericMethod", + Justification = "Enumerable methods don't have trim annotations.")] + MethodInfo ApplyTypeArgs(MethodInfo methodInfo) => typeArgs == null ? methodInfo : methodInfo.MakeGenericMethod(typeArgs); + + // In certain cases, there might be ambiguities when resolving matching overloads, for example between + // 1. FirstOrDefault(IEnumerable source, Func predicate) and + // 2. FirstOrDefault(IEnumerable source, object defaultvalue). + // In such cases we disambiguate by picking a method with the most derived signature. + static MethodInfo DisambiguateMatches(MethodInfo[] matchingMethods) + { + Debug.Assert(matchingMethods.Length > 1); + ParameterInfo[][] parameters = matchingMethods.Select(m => m.GetParameters()).ToArray(); + + // `AreAssignableFrom[Strict]` defines a partial order on method signatures; pick a maximal element using that order. + // It is assumed that `matchingMethods` is a small array, so a naive quadratic search is probably better than + // doing some variant of topological sorting. + + for (int i = 0; i < matchingMethods.Length; i++) + { + bool isMaximal = true; + for (int j = 0; j < matchingMethods.Length; j++) + { + if (i != j && AreAssignableFromStrict(parameters[i], parameters[j])) + { + // Found a matching method that contains strictly more specific parameter types. + isMaximal = false; + break; + } + } + + if (isMaximal) + { + return matchingMethods[i]; + } + } + + Debug.Fail("Search should have found a maximal element"); + throw new Exception(); + + static bool AreAssignableFromStrict(ParameterInfo[] left, ParameterInfo[] right) + { + Debug.Assert(left.Length == right.Length); + + bool areEqual = true; + bool areAssignableFrom = true; + for (int i = 0; i < left.Length; i++) + { + Type leftParam = left[i].ParameterType; + Type rightParam = right[i].ParameterType; + areEqual = areEqual && leftParam == rightParam; + areAssignableFrom = areAssignableFrom && leftParam.IsAssignableFrom(rightParam); + } + + return !areEqual && areAssignableFrom; + } + } } [RequiresUnreferencedCode(Queryable.InMemoryQueryableExtensionMethodsRequiresUnreferencedCode)] diff --git a/src/libraries/System.Linq.Queryable/tests/FirstOrDefaultTests.cs b/src/libraries/System.Linq.Queryable/tests/FirstOrDefaultTests.cs index ac74ca5bd68365..9d655177ef92db 100644 --- a/src/libraries/System.Linq.Queryable/tests/FirstOrDefaultTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/FirstOrDefaultTests.cs @@ -129,5 +129,16 @@ public void FirstOrDefault2() var val = (new int[] { 0, 1, 2 }).AsQueryable().FirstOrDefault(n => n > 1); Assert.Equal(2, val); } + + [Fact] + public void FirstOrDefault_OverloadResolution_Regression() + { + // Regression test for https://github.com/dotnet/runtime/issues/65419 + object? result = new object[] { 1, "" }.AsQueryable().FirstOrDefault(x => x is string); + Assert.IsType(result); + + result = Array.Empty().AsQueryable().FirstOrDefault(1); + Assert.IsType(result); + } } } diff --git a/src/libraries/System.Linq.Queryable/tests/LastOrDefaultTests.cs b/src/libraries/System.Linq.Queryable/tests/LastOrDefaultTests.cs index c66c42fce4a4fe..d65a9eb27d1e77 100644 --- a/src/libraries/System.Linq.Queryable/tests/LastOrDefaultTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/LastOrDefaultTests.cs @@ -96,5 +96,16 @@ public void LastOrDefault2() var val = (new int[] { 0, 1, 2 }).AsQueryable().LastOrDefault(n => n > 1); Assert.Equal(2, val); } + + [Fact] + public void LastOrDefault_OverloadResolution_Regression() + { + // Regression test for https://github.com/dotnet/runtime/issues/65419 + object? result = new object[] { 1, "" }.AsQueryable().LastOrDefault(x => x is int); + Assert.IsType(result); + + result = Array.Empty().AsQueryable().LastOrDefault(1); + Assert.IsType(result); + } } } diff --git a/src/libraries/System.Linq.Queryable/tests/SingleOrDefaultTests.cs b/src/libraries/System.Linq.Queryable/tests/SingleOrDefaultTests.cs index f34edae8b9f84d..991ac5106ba87a 100644 --- a/src/libraries/System.Linq.Queryable/tests/SingleOrDefaultTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/SingleOrDefaultTests.cs @@ -79,5 +79,16 @@ public void SingleOrDefault2() var val = (new int[] { 2 }).AsQueryable().SingleOrDefault(n => n > 1); Assert.Equal(2, val); } + + [Fact] + public void SingleOrDefault_OverloadResolution_Regression() + { + // Regression test for https://github.com/dotnet/runtime/issues/65419 + object? result = new object[] { 1, "" }.AsQueryable().SingleOrDefault(x => x is string); + Assert.IsType(result); + + result = Array.Empty().AsQueryable().SingleOrDefault(1); + Assert.IsType(result); + } } } diff --git a/src/libraries/System.Management/Directory.Build.props b/src/libraries/System.Management/Directory.Build.props index bfa544ca6f649e..709a22a7537088 100644 --- a/src/libraries/System.Management/Directory.Build.props +++ b/src/libraries/System.Management/Directory.Build.props @@ -1,10 +1,6 @@  - - 4.0.0.0 Microsoft windows diff --git a/src/libraries/System.Management/Directory.Build.targets b/src/libraries/System.Management/Directory.Build.targets new file mode 100644 index 00000000000000..69fc811d007beb --- /dev/null +++ b/src/libraries/System.Management/Directory.Build.targets @@ -0,0 +1,10 @@ + + + + + 4.0.0.0 + + diff --git a/src/libraries/System.Management/src/System.Management.csproj b/src/libraries/System.Management/src/System.Management.csproj index 516c38a9de6f21..041424b2b0bbaf 100644 --- a/src/libraries/System.Management/src/System.Management.csproj +++ b/src/libraries/System.Management/src/System.Management.csproj @@ -5,6 +5,9 @@ true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0 true + + false + 2 true true Provides access to a rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure. @@ -77,6 +80,7 @@ System.Management.SelectQuery + diff --git a/src/libraries/System.Management/src/System/Management/ManagementScope.cs b/src/libraries/System.Management/src/System/Management/ManagementScope.cs index a1b10722738e2d..9bfa3a0992b43b 100644 --- a/src/libraries/System.Management/src/System/Management/ManagementScope.cs +++ b/src/libraries/System.Management/src/System/Management/ManagementScope.cs @@ -293,7 +293,9 @@ internal enum APTTYPE static WmiNetUtilsHelper() { RegistryKey netFrameworkSubKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\.NETFramework\"); - string netFrameworkInstallRoot = (string)netFrameworkSubKey?.GetValue("InstallRoot"); + string netFrameworkInstallRoot = (string)netFrameworkSubKey?.GetValue(RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? + "InstallRootArm64" : + "InstallRoot"); if (netFrameworkInstallRoot == null) { diff --git a/src/libraries/System.Management/tests/WmiTestHelper.cs b/src/libraries/System.Management/tests/WmiTestHelper.cs index 0496626b5b1863..75460d826d125e 100644 --- a/src/libraries/System.Management/tests/WmiTestHelper.cs +++ b/src/libraries/System.Management/tests/WmiTestHelper.cs @@ -11,7 +11,7 @@ public static class WmiTestHelper private static readonly bool s_isElevated = AdminHelpers.IsProcessElevated(); private static readonly bool s_isWmiSupported = PlatformDetection.IsWindows && - PlatformDetection.IsNotArmNorArm64Process && + PlatformDetection.IsNotArmProcess && PlatformDetection.IsNotWindowsNanoServer && PlatformDetection.IsNotWindowsIoTCore && !PlatformDetection.IsInAppContainer; diff --git a/src/libraries/System.Memory.Data/System.Memory.Data.sln b/src/libraries/System.Memory.Data/System.Memory.Data.sln index 5878d08ab4271f..3c371f8d59a503 100644 --- a/src/libraries/System.Memory.Data/System.Memory.Data.sln +++ b/src/libraries/System.Memory.Data/System.Memory.Data.sln @@ -17,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{0DE5E7DA-0AE0-4CF2-95AB-1E476FD68C5C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{9F2EC2C8-6E28-404A-8087-7A0518624EC6}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{6A2B5C68-14C3-4989-8530-D51A138C72AE}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{2BD73108-47D7-40E6-BFCB-169E6AD42A81}" @@ -65,10 +63,6 @@ Global {B9162F6C-4CD1-4D33-BA4A-42830A1B1C66}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9162F6C-4CD1-4D33-BA4A-42830A1B1C66}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9162F6C-4CD1-4D33-BA4A-42830A1B1C66}.Release|Any CPU.Build.0 = Release|Any CPU - {9F2EC2C8-6E28-404A-8087-7A0518624EC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9F2EC2C8-6E28-404A-8087-7A0518624EC6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9F2EC2C8-6E28-404A-8087-7A0518624EC6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9F2EC2C8-6E28-404A-8087-7A0518624EC6}.Release|Any CPU.Build.0 = Release|Any CPU {0DE5E7DA-0AE0-4CF2-95AB-1E476FD68C5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0DE5E7DA-0AE0-4CF2-95AB-1E476FD68C5C}.Debug|Any CPU.Build.0 = Debug|Any CPU {0DE5E7DA-0AE0-4CF2-95AB-1E476FD68C5C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -90,7 +84,6 @@ Global {ACDB56AF-7B9F-4762-9764-D6FF09118D09} = {D908DCBE-EFA4-4CCA-9A1C-AEB48D59C504} {6A2B5C68-14C3-4989-8530-D51A138C72AE} = {D908DCBE-EFA4-4CCA-9A1C-AEB48D59C504} {E17B915A-81CA-44D8-818E-512B65609475} = {D908DCBE-EFA4-4CCA-9A1C-AEB48D59C504} - {9F2EC2C8-6E28-404A-8087-7A0518624EC6} = {D908DCBE-EFA4-4CCA-9A1C-AEB48D59C504} {0DE5E7DA-0AE0-4CF2-95AB-1E476FD68C5C} = {D908DCBE-EFA4-4CCA-9A1C-AEB48D59C504} {1D866ECD-FD46-4FCA-9408-D1E3E9CB1F43} = {D908DCBE-EFA4-4CCA-9A1C-AEB48D59C504} EndGlobalSection diff --git a/src/libraries/System.Memory/ref/System.Memory.cs b/src/libraries/System.Memory/ref/System.Memory.cs index 1ddd8df16a6b5a..636af7b7babd6c 100644 --- a/src/libraries/System.Memory/ref/System.Memory.cs +++ b/src/libraries/System.Memory/ref/System.Memory.cs @@ -165,6 +165,7 @@ public ref struct TryWriteInterpolatedStringHandler public bool AppendFormatted(string? value, int alignment = 0, string? format = null) { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE public readonly partial struct SequencePosition : System.IEquatable { private readonly object _dummy; @@ -180,9 +181,11 @@ public ref struct TryWriteInterpolatedStringHandler [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public object? GetObject() { throw null; } } +#endif } namespace System.Buffers { +#if !BUILDING_CORELIB_REFERENCE public sealed partial class ArrayBufferWriter : System.Buffers.IBufferWriter { public ArrayBufferWriter() { } @@ -315,6 +318,7 @@ public void Rewind(long count) { } public bool TryReadToAny(out System.Buffers.ReadOnlySequence sequence, System.ReadOnlySpan delimiters, bool advancePastDelimiter = true) { throw null; } public bool TryReadToAny(out System.ReadOnlySpan span, System.ReadOnlySpan delimiters, bool advancePastDelimiter = true) { throw null; } } +#endif public readonly partial struct StandardFormat : System.IEquatable { private readonly int _dummyPrimitive; @@ -541,6 +545,7 @@ public static partial class MemoryMarshal public static bool TryWrite(System.Span destination, ref T value) where T : struct { throw null; } public static void Write(System.Span destination, ref T value) where T : struct { } } +#if !BUILDING_CORELIB_REFERENCE public static partial class SequenceMarshal { public static bool TryGetArray(System.Buffers.ReadOnlySequence sequence, out System.ArraySegment segment) { throw null; } @@ -548,9 +553,11 @@ public static partial class SequenceMarshal public static bool TryGetReadOnlySequenceSegment(System.Buffers.ReadOnlySequence sequence, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Buffers.ReadOnlySequenceSegment? startSegment, out int startIndex, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Buffers.ReadOnlySequenceSegment? endSegment, out int endIndex) { throw null; } public static bool TryRead(ref System.Buffers.SequenceReader reader, out T value) where T : unmanaged { throw null; } } +#endif } namespace System.Text { +#if !BUILDING_CORELIB_REFERENCE public static partial class EncodingExtensions { public static void Convert(this System.Text.Decoder decoder, in System.Buffers.ReadOnlySequence bytes, System.Buffers.IBufferWriter writer, bool flush, out long charsUsed, out bool completed) { throw null; } @@ -566,6 +573,7 @@ public static partial class EncodingExtensions public static long GetChars(this System.Text.Encoding encoding, System.ReadOnlySpan bytes, System.Buffers.IBufferWriter writer) { throw null; } public static string GetString(this System.Text.Encoding encoding, in System.Buffers.ReadOnlySequence bytes) { throw null; } } +#endif public ref partial struct SpanLineEnumerator { private object _dummy; diff --git a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.T.cs b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.T.cs index 656918e5fe6e7d..b1a6c293aef32c 100644 --- a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.T.cs +++ b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.T.cs @@ -65,7 +65,6 @@ public void Clear() } [Fact] - [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/42517", RuntimeConfiguration.Checked)] public void Advance() { { diff --git a/src/libraries/System.Net.Http.Json/System.Net.Http.Json.sln b/src/libraries/System.Net.Http.Json/System.Net.Http.Json.sln index e7575d6b03568b..73280ee3f28c5c 100644 --- a/src/libraries/System.Net.Http.Json/System.Net.Http.Json.sln +++ b/src/libraries/System.Net.Http.Json/System.Net.Http.Json.sln @@ -21,8 +21,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{FEBE9C47-A00B-40B2-A85B-74ECE2F8B80A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{D120D5A7-69D9-44A2-B7F7-EE0E48CC0238}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{BC7D3412-DBCB-4863-8BF8-41899E32608C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{945B0700-C720-4775-B9E4-6A27DAA90190}" @@ -57,10 +55,6 @@ Global {3AD3D600-C391-492D-B3D6-0F6C03DA5C27}.Debug|Any CPU.Build.0 = Debug|Any CPU {3AD3D600-C391-492D-B3D6-0F6C03DA5C27}.Release|Any CPU.ActiveCfg = Release|Any CPU {3AD3D600-C391-492D-B3D6-0F6C03DA5C27}.Release|Any CPU.Build.0 = Release|Any CPU - {D120D5A7-69D9-44A2-B7F7-EE0E48CC0238}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D120D5A7-69D9-44A2-B7F7-EE0E48CC0238}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D120D5A7-69D9-44A2-B7F7-EE0E48CC0238}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D120D5A7-69D9-44A2-B7F7-EE0E48CC0238}.Release|Any CPU.Build.0 = Release|Any CPU {BC7D3412-DBCB-4863-8BF8-41899E32608C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BC7D3412-DBCB-4863-8BF8-41899E32608C}.Debug|Any CPU.Build.0 = Debug|Any CPU {BC7D3412-DBCB-4863-8BF8-41899E32608C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -102,7 +96,6 @@ Global {1D6F4698-E7FA-4AE3-A7A4-98939E40D08D} = {A75027EA-199E-4C86-A636-AE9AE0F0756C} {3AD3D600-C391-492D-B3D6-0F6C03DA5C27} = {A75027EA-199E-4C86-A636-AE9AE0F0756C} {7DC969DA-8BD3-4E64-88E8-26AFE65BFF7E} = {2A66925D-3658-46BE-A730-5BF70D8D5B90} - {D120D5A7-69D9-44A2-B7F7-EE0E48CC0238} = {2A66925D-3658-46BE-A730-5BF70D8D5B90} {BC7D3412-DBCB-4863-8BF8-41899E32608C} = {2A66925D-3658-46BE-A730-5BF70D8D5B90} {3EEB6FCC-2592-4879-ADDD-0FDC7AEB7BC1} = {2A66925D-3658-46BE-A730-5BF70D8D5B90} {4FB629CD-5FFC-47AC-9670-A2A8AFEE8926} = {2A66925D-3658-46BE-A730-5BF70D8D5B90} diff --git a/src/libraries/System.Net.Http.Json/src/System.Net.Http.Json.csproj b/src/libraries/System.Net.Http.Json/src/System.Net.Http.Json.csproj index 72024127132e8b..2c68126bad5e09 100644 --- a/src/libraries/System.Net.Http.Json/src/System.Net.Http.Json.csproj +++ b/src/libraries/System.Net.Http.Json/src/System.Net.Http.Json.csproj @@ -3,6 +3,8 @@ $(NetCoreAppCurrent);net5.0;netstandard2.0;net461 enable true + false + 1 Provides extension methods for System.Net.Http.HttpClient and System.Net.Http.HttpContent that perform automatic serialization and deserialization using System.Text.Json. Commonly Used Types: diff --git a/src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpClientJsonExtensions.Get.cs b/src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpClientJsonExtensions.Get.cs index 66924779bc73d5..1a7a527aaaede2 100644 --- a/src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpClientJsonExtensions.Get.cs +++ b/src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/HttpClientJsonExtensions.Get.cs @@ -23,7 +23,7 @@ public static partial class HttpClientJsonExtensions throw new ArgumentNullException(nameof(client)); } - Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken); + Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseContentRead, cancellationToken); return GetFromJsonAsyncCore(taskResponse, type, options, cancellationToken); } @@ -35,7 +35,7 @@ public static partial class HttpClientJsonExtensions throw new ArgumentNullException(nameof(client)); } - Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken); + Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseContentRead, cancellationToken); return GetFromJsonAsyncCore(taskResponse, type, options, cancellationToken); } @@ -47,7 +47,7 @@ public static partial class HttpClientJsonExtensions throw new ArgumentNullException(nameof(client)); } - Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken); + Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseContentRead, cancellationToken); return GetFromJsonAsyncCore(taskResponse, options, cancellationToken); } @@ -59,7 +59,7 @@ public static partial class HttpClientJsonExtensions throw new ArgumentNullException(nameof(client)); } - Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken); + Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseContentRead, cancellationToken); return GetFromJsonAsyncCore(taskResponse, options, cancellationToken); } @@ -70,7 +70,7 @@ public static partial class HttpClientJsonExtensions throw new ArgumentNullException(nameof(client)); } - Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken); + Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseContentRead, cancellationToken); return GetFromJsonAsyncCore(taskResponse, type, context, cancellationToken); } @@ -81,7 +81,7 @@ public static partial class HttpClientJsonExtensions throw new ArgumentNullException(nameof(client)); } - Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken); + Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseContentRead, cancellationToken); return GetFromJsonAsyncCore(taskResponse, type, context, cancellationToken); } @@ -92,7 +92,7 @@ public static partial class HttpClientJsonExtensions throw new ArgumentNullException(nameof(client)); } - Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken); + Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseContentRead, cancellationToken); return GetFromJsonAsyncCore(taskResponse, jsonTypeInfo, cancellationToken); } @@ -103,7 +103,7 @@ public static partial class HttpClientJsonExtensions throw new ArgumentNullException(nameof(client)); } - Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead, cancellationToken); + Task taskResponse = client.GetAsync(requestUri, HttpCompletionOption.ResponseContentRead, cancellationToken); return GetFromJsonAsyncCore(taskResponse, jsonTypeInfo, cancellationToken); } diff --git a/src/libraries/System.Net.Http.Json/tests/FunctionalTests/HttpClientJsonExtensionsTests.cs b/src/libraries/System.Net.Http.Json/tests/FunctionalTests/HttpClientJsonExtensionsTests.cs index 580806a40aac31..7d8d5602ae54c6 100644 --- a/src/libraries/System.Net.Http.Json/tests/FunctionalTests/HttpClientJsonExtensionsTests.cs +++ b/src/libraries/System.Net.Http.Json/tests/FunctionalTests/HttpClientJsonExtensionsTests.cs @@ -257,5 +257,89 @@ await HttpMessageHandlerLoopbackServer.CreateClientAndServerAsync( await server.HandleRequestAsync(content: json, headers: headers); }); } + + public static IEnumerable GetFromJsonAsync_EnforcesMaxResponseContentBufferSize_MemberData() => + from limit in new[] { 2, 100, 100000 } + from contentLength in new[] { limit, limit + 1 } + from chunked in new[] { true, false } + select new object[] { limit, contentLength, chunked }; + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] // No Socket support + [MemberData(nameof(GetFromJsonAsync_EnforcesMaxResponseContentBufferSize_MemberData))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + public async Task GetFromJsonAsync_EnforcesMaxResponseContentBufferSize(int limit, int contentLength, bool chunked) + { + await LoopbackServer.CreateClientAndServerAsync(async uri => + { + using var client = new HttpClient { MaxResponseContentBufferSize = limit }; + + Func testMethod = () => client.GetFromJsonAsync(uri); + + if (contentLength > limit) + { + Exception ex = await Assert.ThrowsAsync(testMethod); + Assert.Contains(limit.ToString(), ex.Message); + } + else + { + await testMethod(); + } + }, + async server => + { + List headers = new(); + string content = $"\"{new string('a', contentLength - 2)}\""; + + if (chunked) + { + headers.Add(new HttpHeaderData("Transfer-Encoding", "chunked")); + content = $"{Convert.ToString(contentLength, 16)}\r\n{content}\r\n0\r\n\r\n"; + } + + await server.HandleRequestAsync(headers: headers, content: content); + }); + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] // No Socket support + [InlineData(true)] + [InlineData(false)] + public async Task GetFromJsonAsync_EnforcesTimeout(bool slowHeaders) + { + TaskCompletionSource exceptionThrown = new(TaskCreationOptions.RunContinuationsAsynchronously); + + await LoopbackServer.CreateClientAndServerAsync(async uri => + { + using var client = new HttpClient { Timeout = TimeSpan.FromMilliseconds(100) }; + + Exception ex = await Assert.ThrowsAsync(() => client.GetFromJsonAsync(uri)); + +#if NETCORE + Assert.Contains("HttpClient.Timeout", ex.Message); + Assert.IsType(ex.InnerException); +#endif + + exceptionThrown.SetResult(0); + }, + async server => + { + // The client may timeout before even connecting the server + await Task.WhenAny(exceptionThrown.Task, Task.Run(async () => + { + try + { + await server.AcceptConnectionAsync(async connection => + { + if (!slowHeaders) + { + await connection.SendPartialResponseHeadersAsync(headers: new[] { new HttpHeaderData("Content-Length", "42") }); + } + + await exceptionThrown.Task; + }); + } + catch { } + })); + }); + } } } diff --git a/src/libraries/System.Net.Http.Json/tests/FunctionalTests/System.Net.Http.Json.Functional.Tests.csproj b/src/libraries/System.Net.Http.Json/tests/FunctionalTests/System.Net.Http.Json.Functional.Tests.csproj index 9fe7bbb28a73ba..fbf69a18785071 100644 --- a/src/libraries/System.Net.Http.Json/tests/FunctionalTests/System.Net.Http.Json.Functional.Tests.csproj +++ b/src/libraries/System.Net.Http.Json/tests/FunctionalTests/System.Net.Http.Json.Functional.Tests.csproj @@ -1,4 +1,4 @@ - + $(NetCoreAppCurrent);net48 @@ -19,6 +19,7 @@ + @@ -27,6 +28,6 @@ - + diff --git a/src/libraries/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.sln b/src/libraries/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.sln index d6d95c23aa12a0..7c181ccbde038f 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.sln +++ b/src/libraries/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.sln @@ -27,8 +27,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{BACC5257-6CA8-45C7-970F-C8D501DA59AB}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "..\System.Text.Json\gen\System.Text.Json.SourceGeneration.csproj", "{302F00AD-85F1-4DE9-B100-41F8EAB93B7C}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "..\System.Text.Json\src\System.Text.Json.csproj", "{E470810A-BAF2-4B3C-92CB-72007B7F1B6A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2F9A243D-B060-4BB2-A9E1-A9CB861328D9}" @@ -95,10 +93,6 @@ Global {BACC5257-6CA8-45C7-970F-C8D501DA59AB}.Debug|Any CPU.Build.0 = Debug|Any CPU {BACC5257-6CA8-45C7-970F-C8D501DA59AB}.Release|Any CPU.ActiveCfg = Release|Any CPU {BACC5257-6CA8-45C7-970F-C8D501DA59AB}.Release|Any CPU.Build.0 = Release|Any CPU - {302F00AD-85F1-4DE9-B100-41F8EAB93B7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {302F00AD-85F1-4DE9-B100-41F8EAB93B7C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {302F00AD-85F1-4DE9-B100-41F8EAB93B7C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {302F00AD-85F1-4DE9-B100-41F8EAB93B7C}.Release|Any CPU.Build.0 = Release|Any CPU {4BA25EC1-B76B-4410-AF2D-A54B90FAB404}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4BA25EC1-B76B-4410-AF2D-A54B90FAB404}.Debug|Any CPU.Build.0 = Debug|Any CPU {4BA25EC1-B76B-4410-AF2D-A54B90FAB404}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -123,7 +117,6 @@ Global {E6A8B90B-69CD-4B0D-8A33-F208A3169674} = {49E09973-383D-4AD6-9D88-B93A02031607} {E470810A-BAF2-4B3C-92CB-72007B7F1B6A} = {49E09973-383D-4AD6-9D88-B93A02031607} {BACC5257-6CA8-45C7-970F-C8D501DA59AB} = {49E09973-383D-4AD6-9D88-B93A02031607} - {302F00AD-85F1-4DE9-B100-41F8EAB93B7C} = {49E09973-383D-4AD6-9D88-B93A02031607} {4BA25EC1-B76B-4410-AF2D-A54B90FAB404} = {49E09973-383D-4AD6-9D88-B93A02031607} {090BA6CA-F661-4BDE-9663-65F8231DDB1D} = {6C66589E-2DB3-4635-BADA-9B6452327239} {E9D5AB56-2597-42E0-BE81-C00CC63D1FB3} = {6C66589E-2DB3-4635-BADA-9B6452327239} diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj index 250126a0d3d731..5f689d4f1372d7 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj @@ -9,6 +9,7 @@ Commonly Used Types: System.Net.Http.WinHttpHandler + 1 diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs index 8173084e53c5e3..07133b2667c229 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs @@ -44,6 +44,7 @@ public class WinHttpHandler : HttpMessageHandler private static readonly StringWithQualityHeaderValue s_gzipHeaderValue = new StringWithQualityHeaderValue("gzip"); private static readonly StringWithQualityHeaderValue s_deflateHeaderValue = new StringWithQualityHeaderValue("deflate"); + private static readonly Lazy s_supportsTls13 = new Lazy(() => CheckTls13Support()); [ThreadStatic] private static StringBuilder? t_requestHeadersBuilder; @@ -1119,6 +1120,7 @@ private void SetSessionHandleOptions(SafeWinHttpHandle sessionHandle) SetSessionHandleTimeoutOptions(sessionHandle); SetDisableHttp2StreamQueue(sessionHandle); SetTcpKeepalive(sessionHandle); + SetRequireStreamEnd(sessionHandle); } private unsafe void SetTcpKeepalive(SafeWinHttpHandle sessionHandle) @@ -1144,6 +1146,27 @@ private unsafe void SetTcpKeepalive(SafeWinHttpHandle sessionHandle) } } + private void SetRequireStreamEnd(SafeWinHttpHandle sessionHandle) + { + if (WinHttpTrailersHelper.OsSupportsTrailers) + { + // Setting WINHTTP_OPTION_REQUIRE_STREAM_END to TRUE is needed for WinHttp to read trailing headers + // in case the response has Content-Lenght defined. + // According to the WinHttp team, the feature-detection logic in WinHttpTrailersHelper.OsSupportsTrailers + // should also indicate the support of WINHTTP_OPTION_REQUIRE_STREAM_END. + // WINHTTP_OPTION_REQUIRE_STREAM_END doesn't have effect on HTTP 1.1 requests, therefore it's safe to set it on + // the session handle so it is inhereted by all request handles. + uint optionData = 1; + if (!Interop.WinHttp.WinHttpSetOption(sessionHandle, Interop.WinHttp.WINHTTP_OPTION_REQUIRE_STREAM_END, ref optionData)) + { + if (NetEventSource.Log.IsEnabled()) + { + NetEventSource.Info(this, "Failed to enable WINHTTP_OPTION_REQUIRE_STREAM_END error code: " + Marshal.GetLastWin32Error()); + } + } + } + } + private void SetSessionHandleConnectionOptions(SafeWinHttpHandle sessionHandle) { uint optionData = (uint)_maxConnectionsPerServer; @@ -1153,6 +1176,7 @@ private void SetSessionHandleConnectionOptions(SafeWinHttpHandle sessionHandle) private void SetSessionHandleTlsOptions(SafeWinHttpHandle sessionHandle) { + const SslProtocols Tls13 = (SslProtocols)12288; // enum is missing in .NET Standard uint optionData = 0; SslProtocols sslProtocols = (_sslProtocols == SslProtocols.None) ? SecurityProtocol.DefaultSecurityProtocols : _sslProtocols; @@ -1184,10 +1208,13 @@ private void SetSessionHandleTlsOptions(SafeWinHttpHandle sessionHandle) optionData |= Interop.WinHttp.WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2; } - // As of Win10RS5 there's no public constant for WinHTTP + TLS 1.3 - // This library builds against netstandard, which doesn't define the Tls13 enum field. + // Set this only if supported by WinHttp version. + if (s_supportsTls13.Value && (sslProtocols & Tls13) != 0) + { + optionData |= Interop.WinHttp.WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3; + } - // If only unknown values (e.g. TLS 1.3) were asked for, report ERROR_INVALID_PARAMETER. + // If only unknown values were asked for, report ERROR_INVALID_PARAMETER. if (optionData == 0) { throw WinHttpException.CreateExceptionUsingError( @@ -1198,6 +1225,30 @@ private void SetSessionHandleTlsOptions(SafeWinHttpHandle sessionHandle) SetWinHttpOption(sessionHandle, Interop.WinHttp.WINHTTP_OPTION_SECURE_PROTOCOLS, ref optionData); } + private static bool CheckTls13Support() + { + try + { + using (var handler = new WinHttpHandler()) + using (SafeWinHttpHandle sessionHandle = Interop.WinHttp.WinHttpOpen( + IntPtr.Zero, + Interop.WinHttp.WINHTTP_ACCESS_TYPE_NO_PROXY, + Interop.WinHttp.WINHTTP_NO_PROXY_NAME, + Interop.WinHttp.WINHTTP_NO_PROXY_BYPASS, + (int)Interop.WinHttp.WINHTTP_FLAG_ASYNC)) + { + uint optionData = Interop.WinHttp.WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3; + + handler.SetWinHttpOption(sessionHandle, Interop.WinHttp.WINHTTP_OPTION_SECURE_PROTOCOLS, ref optionData); + return true; + } + } + catch + { + return false; + } + } + private void SetSessionHandleTimeoutOptions(SafeWinHttpHandle sessionHandle) { if (!Interop.WinHttp.WinHttpSetTimeouts( diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ClientCertificateTest.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ClientCertificateTest.cs index 9a7d6616f5f566..c88b81f9886cef 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ClientCertificateTest.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ClientCertificateTest.cs @@ -54,7 +54,7 @@ await LoopbackServer.CreateClientAndServerAsync( // Disabling it for full .Net Framework due to a missing ALPN API which leads to a protocol downgrade #if !NETFRAMEWORK - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindows10Version2004Build19573OrGreater))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindows10Version19573OrGreater))] public async Task UseClientCertOnHttp2_OSSupportsIt_Success() { using X509Certificate2 clientCert = Test.Common.Configuration.Certificates.GetClientCertificate(); diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/TrailingHeadersTest.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/TrailingHeadersTest.cs index cef52465524dcf..5ac753c266ee0a 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/TrailingHeadersTest.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/TrailingHeadersTest.cs @@ -67,8 +67,10 @@ public async Task Http2GetAsync_NoTrailingHeaders_EmptyCollection() } } - [ConditionalFact(nameof(TestsEnabled))] - public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted() + [InlineData(false)] + [InlineData(true)] + [ConditionalTheory(nameof(TestsEnabled))] + public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted(bool responseHasContentLength) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) using (HttpClient client = CreateHttpClient()) @@ -80,7 +82,14 @@ public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted() int streamId = await connection.ReadRequestHeaderAsync(); // Response header. - await connection.SendDefaultResponseHeadersAsync(streamId); + if (responseHasContentLength) + { + await connection.SendResponseHeadersAsync(streamId, endStream: false, headers: new[] { new HttpHeaderData("Content-Length", DataBytes.Length.ToString()) }); + } + else + { + await connection.SendDefaultResponseHeadersAsync(streamId); + } // Response data, missing Trailers. await connection.WriteFrameAsync(MakeDataFrame(streamId, DataBytes)); @@ -98,8 +107,10 @@ public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted() } } - [ConditionalFact(nameof(TestsEnabled))] - public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Available() + [InlineData(false)] + [InlineData(true)] + [ConditionalTheory(nameof(TestsEnabled))] + public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Available(bool responseHasContentLength) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) using (HttpClient client = CreateHttpClient()) @@ -111,7 +122,14 @@ public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Availab int streamId = await connection.ReadRequestHeaderAsync(); // Response header. - await connection.SendDefaultResponseHeadersAsync(streamId); + if (responseHasContentLength) + { + await connection.SendResponseHeadersAsync(streamId, endStream: false, headers: new[] { new HttpHeaderData("Content-Length", DataBytes.Length.ToString()) }); + } + else + { + await connection.SendDefaultResponseHeadersAsync(streamId); + } // Response data, missing Trailers. await connection.WriteFrameAsync(MakeDataFrame(streamId, DataBytes)); diff --git a/src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.mobile.xml b/src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.mobile.xml index 5b705abeb24bda..208bba9a30af6c 100644 --- a/src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.mobile.xml +++ b/src/libraries/System.Net.Http/src/ILLink/ILLink.Substitutions.mobile.xml @@ -2,6 +2,7 @@ + diff --git a/src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.LibraryBuild.xml b/src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.Mobile.LibraryBuild.xml similarity index 96% rename from src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.LibraryBuild.xml rename to src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.Mobile.LibraryBuild.xml index a6af29a8085c3e..d6f428f20d4e6d 100644 --- a/src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.LibraryBuild.xml +++ b/src/libraries/System.Net.Http/src/ILLink/ILLink.Suppressions.Mobile.LibraryBuild.xml @@ -141,6 +141,18 @@ M:System.Net.Http.HttpClientHandler.SetMaxAutomaticRedirections(System.Int32) The Xamarin.iOS and Mono.Android libraries are not present when running the trimmer analysis during our build. A consuming application will get a warning if these libraries aren't present when trimming the full app. + + ILLink + IL2035 + member + M:System.Net.Http.HttpClientHandler.GetServerCertificateCustomValidationCallback + + + ILLink + IL2035 + member + M:System.Net.Http.HttpClientHandler.SetServerCertificateCustomValidationCallback(System.Func{System.Net.Http.HttpRequestMessage,System.Security.Cryptography.X509Certificates.X509Certificate2,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors,System.Boolean}) + ILLink IL2035 diff --git a/src/libraries/System.Net.Http/src/Resources/Strings.resx b/src/libraries/System.Net.Http/src/Resources/Strings.resx index a6972e36a6be5b..52a13542fe3dc6 100644 --- a/src/libraries/System.Net.Http/src/Resources/Strings.resx +++ b/src/libraries/System.Net.Http/src/Resources/Strings.resx @@ -360,6 +360,9 @@ The buffer was not long enough. + + The HTTP request headers length exceeded the server limit of {0} bytes. + The HTTP response headers length exceeded the set limit of {0} bytes. diff --git a/src/libraries/System.Net.Http/src/System.Net.Http.csproj b/src/libraries/System.Net.Http/src/System.Net.Http.csproj index 28de4bb4bb00d3..2897f5fb1505fc 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -12,6 +12,18 @@ $(DefineConstants);TARGET_MOBILE + + $(DefineConstants);TARGET_ANDROID + + + $(DefineConstants);TARGET_IOS + + + $(DefineConstants);TARGET_MACCATALYST + + + $(DefineConstants);TARGET_TVOS + $(DefineConstants);TARGET_BROWSER @@ -23,6 +35,7 @@ + @@ -41,10 +54,8 @@ - - - - + diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs b/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs index 664d296dcb6d19..a9f31ce7009c59 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/GlobalHttpSettings.cs @@ -8,6 +8,12 @@ namespace System.Net.Http /// internal static class GlobalHttpSettings { + // Switch to disable ignore-case matching for known header values. Enabled by default. + public static bool IgnoreCaseForKnownHeaderValues { get; } = RuntimeSettingParser.QueryRuntimeSettingSwitch( + "System.Net.Http.IgnoreCaseForKnownHeaderValues", + "DOTNET_SYSTEM_NET_HTTP_IGNORECASEFORKNOWNHEADERVALUES", + true); + internal static class DiagnosticsHandler { public static bool EnableActivityPropagation { get; } = RuntimeSettingParser.QueryRuntimeSettingSwitch( diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HeaderDescriptor.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HeaderDescriptor.cs index 229490b5432dd9..c570a32b05aaba 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HeaderDescriptor.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HeaderDescriptor.cs @@ -132,7 +132,9 @@ public string GetHeaderValue(ReadOnlySpan headerValue, Encoding? valueEnco { for (int i = 0; i < knownValues.Length; i++) { - if (ByteArrayHelpers.EqualsOrdinalAsciiIgnoreCase(knownValues[i], headerValue)) + if (GlobalHttpSettings.IgnoreCaseForKnownHeaderValues + ? ByteArrayHelpers.EqualsOrdinalAsciiIgnoreCase(knownValues[i], headerValue) + : ByteArrayHelpers.EqualsOrdinalAscii(knownValues[i], headerValue)) { return knownValues[i]; } @@ -239,9 +241,17 @@ public string GetHeaderValue(ReadOnlySpan headerValue, Encoding? valueEnco Debug.Assert(candidate is null || candidate.Length == contentTypeValue.Length); - return candidate != null && ByteArrayHelpers.EqualsOrdinalAsciiIgnoreCase(candidate, contentTypeValue) ? - candidate : - null; + if (candidate is not null) + { + if (GlobalHttpSettings.IgnoreCaseForKnownHeaderValues + ? ByteArrayHelpers.EqualsOrdinalAsciiIgnoreCase(candidate, contentTypeValue) + : ByteArrayHelpers.EqualsOrdinalAscii(candidate, contentTypeValue)) + { + return candidate; + } + } + + return null; } private static bool TryDecodeUtf8(ReadOnlySpan input, [NotNullWhen(true)] out string? decoded) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs index c31e628159db0e..ee53b9e626c751 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs @@ -1051,7 +1051,7 @@ private HeaderDescriptor GetHeaderDescriptor(string name) throw new InvalidOperationException(SR.Format(SR.net_http_headers_not_allowed_header_name, name)); } - private bool TryGetHeaderDescriptor(string name, out HeaderDescriptor descriptor) + internal bool TryGetHeaderDescriptor(string name, out HeaderDescriptor descriptor) { if (string.IsNullOrEmpty(name)) { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeadersNonValidated.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeadersNonValidated.cs index ad1a1850ea83c4..5e67476d116a99 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeadersNonValidated.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeadersNonValidated.cs @@ -32,7 +32,7 @@ namespace System.Net.Http.Headers /// true if the collection contains the header; otherwise, false. public bool Contains(string headerName) => _headers is HttpHeaders headers && - HeaderDescriptor.TryGet(headerName, out HeaderDescriptor descriptor) && + headers.TryGetHeaderDescriptor(headerName, out HeaderDescriptor descriptor) && headers.TryGetHeaderValue(descriptor, out _); /// Gets the values for the specified header name. @@ -62,7 +62,7 @@ public HeaderStringValues this[string headerName] public bool TryGetValues(string headerName, out HeaderStringValues values) { if (_headers is HttpHeaders headers && - HeaderDescriptor.TryGet(headerName, out HeaderDescriptor descriptor) && + headers.TryGetHeaderDescriptor(headerName, out HeaderDescriptor descriptor) && headers.TryGetHeaderValue(descriptor, out object? info)) { HttpHeaders.GetStoreValuesAsStringOrStringArray(descriptor, info, out string? singleValue, out string[]? multiValue); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ObjectCollection.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ObjectCollection.cs index e7b3c4e9522389..2486c55638697c 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ObjectCollection.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ObjectCollection.cs @@ -94,8 +94,9 @@ public void Clear() } public bool Contains(T item) => - ReferenceEquals(item, _items) || - (_size != 0 && _items is T[] items && Array.IndexOf(items, item, 0, _size) != -1); + _size <= 0 ? false : + _items is T o ? o.Equals(item) : + _items is T[] items && Array.IndexOf(items, item, 0, _size) != -1; public void CopyTo(T[] array, int arrayIndex) { @@ -120,14 +121,16 @@ public void CopyTo(T[] array, int arrayIndex) public bool Remove(T item) { - if (ReferenceEquals(_items, item)) + if (_items is T o) { - _items = null; - _size = 0; - return true; + if (o.Equals(item)) + { + _items = null; + _size = 0; + return true; + } } - - if (_items is T[] items) + else if (_items is T[] items) { int index = Array.IndexOf(items, item, 0, _size); if (index != -1) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs index 3b77aeafc0467b..9ef0b3bbf0e26c 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs @@ -224,7 +224,7 @@ private async Task GetStringAsyncCore(HttpRequestMessage request, Cancel } finally { - FinishSend(cts, disposeCts, telemetryStarted, responseContentTelemetryStarted); + FinishSend(response, cts, disposeCts, telemetryStarted, responseContentTelemetryStarted); } } @@ -303,7 +303,7 @@ private async Task GetByteArrayAsyncCore(HttpRequestMessage request, Can } finally { - FinishSend(cts, disposeCts, telemetryStarted, responseContentTelemetryStarted); + FinishSend(response, cts, disposeCts, telemetryStarted, responseContentTelemetryStarted); } } @@ -349,7 +349,7 @@ private async Task GetStreamAsyncCore(HttpRequestMessage request, Cancel } finally { - FinishSend(cts, disposeCts, telemetryStarted, responseContentTelemetryStarted: false); + FinishSend(response, cts, disposeCts, telemetryStarted, responseContentTelemetryStarted: false); } } @@ -493,7 +493,7 @@ public HttpResponseMessage Send(HttpRequestMessage request, HttpCompletionOption } finally { - FinishSend(cts, disposeCts, telemetryStarted, responseContentTelemetryStarted); + FinishSend(response, cts, disposeCts, telemetryStarted, responseContentTelemetryStarted); } } @@ -548,7 +548,7 @@ async Task Core( } finally { - FinishSend(cts, disposeCts, telemetryStarted, responseContentTelemetryStarted); + FinishSend(response, cts, disposeCts, telemetryStarted, responseContentTelemetryStarted); } } } @@ -583,8 +583,6 @@ private static bool ShouldBufferResponse(HttpCompletionOption completionOption, private void HandleFailure(Exception e, bool telemetryStarted, HttpResponseMessage? response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts) { - LogRequestFailed(telemetryStarted); - response?.Dispose(); Exception? toThrow = null; @@ -616,6 +614,8 @@ private void HandleFailure(Exception e, bool telemetryStarted, HttpResponseMessa e = toThrow = new OperationCanceledException(cancellationToken.IsCancellationRequested ? cancellationToken : cts.Token); } + LogRequestFailed(e, telemetryStarted); + if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, e); if (toThrow != null) @@ -635,7 +635,7 @@ private static bool StartSend(HttpRequestMessage request) return false; } - private static void FinishSend(CancellationTokenSource cts, bool disposeCts, bool telemetryStarted, bool responseContentTelemetryStarted) + private static void FinishSend(HttpResponseMessage? response, CancellationTokenSource cts, bool disposeCts, bool telemetryStarted, bool responseContentTelemetryStarted) { // Log completion. if (HttpTelemetry.Log.IsEnabled() && telemetryStarted) @@ -645,7 +645,7 @@ private static void FinishSend(CancellationTokenSource cts, bool disposeCts, boo HttpTelemetry.Log.ResponseContentStop(); } - HttpTelemetry.Log.RequestStop(); + HttpTelemetry.Log.RequestStop(response); } // Dispose of the CancellationTokenSource if it was created specially for this request diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.Android.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.Android.cs deleted file mode 100644 index 95face9fcdc1bb..00000000000000 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.Android.cs +++ /dev/null @@ -1,138 +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 System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Net.Security; -using System.Reflection; -using System.Runtime.Versioning; -using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; - -namespace System.Net.Http -{ - public partial class HttpClientHandler : HttpMessageHandler - { - private static MethodInfo? _nativeHandlerMethod; - - private const string NativeHandlerType = "Xamarin.Android.Net.AndroidMessageHandler"; - private const string AssemblyName = "Mono.Android"; - - [DynamicDependency("get_DefaultProxyCredentials", NativeHandlerType, AssemblyName)] - private ICredentials? GetDefaultProxyCredentials() => (ICredentials?)InvokeNativeHandlerMethod("get_DefaultProxyCredentials"); - - [DynamicDependency("set_DefaultProxyCredentials", NativeHandlerType, AssemblyName)] - private void SetDefaultProxyCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_DefaultProxyCredentials", value); - - [DynamicDependency("get_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)] - private int GetMaxConnectionsPerServer() => (int)InvokeNativeHandlerMethod("get_MaxConnectionsPerServer"); - - [DynamicDependency("set_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)] - private void SetMaxConnectionsPerServer(int value) => InvokeNativeHandlerMethod("set_MaxConnectionsPerServer", value); - - [DynamicDependency("get_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)] - private int GetMaxResponseHeadersLength() => (int)InvokeNativeHandlerMethod("get_MaxResponseHeadersLength"); - - [DynamicDependency("set_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)] - private void SetMaxResponseHeadersLength(int value) => InvokeNativeHandlerMethod("set_MaxResponseHeadersLength", value); - - [DynamicDependency("get_ClientCertificateOptions", NativeHandlerType, AssemblyName)] - private ClientCertificateOption GetClientCertificateOptions() => (ClientCertificateOption)InvokeNativeHandlerMethod("get_ClientCertificateOptions"); - - [DynamicDependency("set_ClientCertificateOptions", NativeHandlerType, AssemblyName)] - private void SetClientCertificateOptions(ClientCertificateOption value) => InvokeNativeHandlerMethod("set_ClientCertificateOptions", value); - - [DynamicDependency("get_ClientCertificates", NativeHandlerType, AssemblyName)] - private X509CertificateCollection GetClientCertificates() => (X509CertificateCollection)InvokeNativeHandlerMethod("get_ClientCertificates"); - - [DynamicDependency("get_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)] - private bool GetCheckCertificateRevocationList() => (bool)InvokeNativeHandlerMethod("get_CheckCertificateRevocationList"); - - [DynamicDependency("set_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)] - private void SetCheckCertificateRevocationList(bool value) => InvokeNativeHandlerMethod("set_CheckCertificateRevocationList", value); - - [DynamicDependency("get_SslProtocols", NativeHandlerType, AssemblyName)] - private SslProtocols GetSslProtocols() => (SslProtocols)InvokeNativeHandlerMethod("get_SslProtocols"); - - [DynamicDependency("set_SslProtocols", NativeHandlerType, AssemblyName)] - private void SetSslProtocols(SslProtocols value) => InvokeNativeHandlerMethod("set_SslProtocols", value); - - [DynamicDependency("get_Properties", NativeHandlerType, AssemblyName)] - private IDictionary GetProperties() => (IDictionary)InvokeNativeHandlerMethod("get_Properties"); - - [DynamicDependency("get_SupportsAutomaticDecompression", NativeHandlerType, AssemblyName)] - private bool GetSupportsAutomaticDecompression() => (bool)InvokeNativeHandlerMethod("get_SupportsAutomaticDecompression"); - - [DynamicDependency("get_SupportsProxy", NativeHandlerType, AssemblyName)] - private bool GetSupportsProxy() => (bool)InvokeNativeHandlerMethod("get_SupportsProxy"); - - [DynamicDependency("get_SupportsRedirectConfiguration", NativeHandlerType, AssemblyName)] - private bool GetSupportsRedirectConfiguration() => (bool)InvokeNativeHandlerMethod("get_SupportsRedirectConfiguration"); - - [DynamicDependency("get_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)] - private int GetMaxAutomaticRedirections() => (int)InvokeNativeHandlerMethod("get_MaxAutomaticRedirections"); - - [DynamicDependency("set_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)] - private void SetMaxAutomaticRedirections(int value) => InvokeNativeHandlerMethod("set_MaxAutomaticRedirections", value); - - [DynamicDependency("get_PreAuthenticate", NativeHandlerType, AssemblyName)] - private bool GetPreAuthenticate() => (bool)InvokeNativeHandlerMethod("get_PreAuthenticate"); - - [DynamicDependency("set_PreAuthenticate", NativeHandlerType, AssemblyName)] - private void SetPreAuthenticate(bool value) => InvokeNativeHandlerMethod("set_PreAuthenticate", value); - - [DynamicDependency("get_UseProxy", NativeHandlerType, AssemblyName)] - private bool GetUseProxy() => (bool)InvokeNativeHandlerMethod("get_UseProxy"); - - [DynamicDependency("set_UseProxy", NativeHandlerType, AssemblyName)] - private void SetUseProxy(bool value) => InvokeNativeHandlerMethod("set_UseProxy", value); - - [DynamicDependency("get_Proxy", NativeHandlerType, AssemblyName)] - private IWebProxy GetProxy() => (IWebProxy)InvokeNativeHandlerMethod("get_Proxy"); - - [DynamicDependency("set_Proxy", NativeHandlerType, AssemblyName)] - private void SetProxy(IWebProxy value) => InvokeNativeHandlerMethod("set_Proxy", value); - - [DynamicDependency("get_AutomaticDecompression", NativeHandlerType, AssemblyName)] - private DecompressionMethods GetAutomaticDecompression() => (DecompressionMethods)InvokeNativeHandlerMethod("get_AutomaticDecompression"); - - [DynamicDependency("set_AutomaticDecompression", NativeHandlerType, AssemblyName)] - private void SetAutomaticDecompression(DecompressionMethods value) => InvokeNativeHandlerMethod("set_AutomaticDecompression", value); - - [DynamicDependency("get_UseCookies", NativeHandlerType, AssemblyName)] - private bool GetUseCookies() => (bool)InvokeNativeHandlerMethod("get_UseCookies"); - - [DynamicDependency("set_UseCookies", NativeHandlerType, AssemblyName)] - private void SetUseCookies(bool value) => InvokeNativeHandlerMethod("set_UseCookies", value); - - [DynamicDependency("get_CookieContainer", NativeHandlerType, AssemblyName)] - private CookieContainer GetCookieContainer() => (CookieContainer)InvokeNativeHandlerMethod("get_CookieContainer"); - - [DynamicDependency("set_CookieContainer", NativeHandlerType, AssemblyName)] - private void SetCookieContainer(CookieContainer value) => InvokeNativeHandlerMethod("set_CookieContainer", value); - - [DynamicDependency("get_AllowAutoRedirect", NativeHandlerType, AssemblyName)] - private bool GetAllowAutoRedirect() => (bool)InvokeNativeHandlerMethod("get_AllowAutoRedirect"); - - [DynamicDependency("set_AllowAutoRedirect", NativeHandlerType, AssemblyName)] - private void SetAllowAutoRedirect(bool value) => InvokeNativeHandlerMethod("set_AllowAutoRedirect", value); - - [DynamicDependency("get_Credentials", NativeHandlerType, AssemblyName)] - private ICredentials GetCredentials() => (ICredentials)InvokeNativeHandlerMethod("get_Credentials"); - - [DynamicDependency("set_Credentials", NativeHandlerType, AssemblyName)] - private void SetCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_Credentials", value); - - private HttpMessageHandler CreateNativeHandler() - { - if (_nativeHandlerMethod == null) - { - Type? androidEnv = Type.GetType("Android.Runtime.AndroidEnvironment, Mono.Android"); - _nativeHandlerMethod = androidEnv!.GetMethod("GetHttpMessageHandler", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); - } - - return (HttpMessageHandler)_nativeHandlerMethod!.Invoke(null, null)!; - } - } -} \ No newline at end of file diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.MacCatalyst.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.InvokeNativeHandler.cs similarity index 81% rename from src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.MacCatalyst.cs rename to src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.InvokeNativeHandler.cs index 182c6b041ec909..d14bbbf2799cfa 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.MacCatalyst.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.InvokeNativeHandler.cs @@ -15,8 +15,25 @@ public partial class HttpClientHandler : HttpMessageHandler { private static MethodInfo? _nativeHandlerMethod; +#if TARGET_ANDROID + private const string NativeHandlerType = "Xamarin.Android.Net.AndroidMessageHandler"; + private const string AssemblyName = "Mono.Android"; + private const string GetHttpMessageHandlerType = "Android.Runtime.AndroidEnvironment, Mono.Android"; +#elif TARGET_IOS private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler"; - private const string AssemblyName = "Xamarin.MacCatalyst"; + private const string AssemblyName = "Microsoft.iOS"; + private const string GetHttpMessageHandlerType = "ObjCRuntime.RuntimeOptions, Microsoft.iOS"; +#elif TARGET_MACCATALYST + private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler"; + private const string AssemblyName = "Microsoft.MacCatalyst"; + private const string GetHttpMessageHandlerType = "ObjCRuntime.RuntimeOptions, Microsoft.MacCatalyst"; +#elif TARGET_TVOS + private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler"; + private const string AssemblyName = "Microsoft.tvOS"; + private const string GetHttpMessageHandlerType = "ObjCRuntime.RuntimeOptions, Microsoft.tvOS"; +#else +#error Unknown target +#endif [DynamicDependency("get_DefaultProxyCredentials", NativeHandlerType, AssemblyName)] private ICredentials? GetDefaultProxyCredentials() => (ICredentials?)InvokeNativeHandlerMethod("get_DefaultProxyCredentials"); @@ -45,6 +62,12 @@ public partial class HttpClientHandler : HttpMessageHandler [DynamicDependency("get_ClientCertificates", NativeHandlerType, AssemblyName)] private X509CertificateCollection GetClientCertificates() => (X509CertificateCollection)InvokeNativeHandlerMethod("get_ClientCertificates"); + [DynamicDependency("get_ServerCertificateCustomValidationCallback", NativeHandlerType, AssemblyName)] + private Func GetServerCertificateCustomValidationCallback() => (Func)InvokeNativeHandlerMethod("get_ServerCertificateCustomValidationCallback"); + + [DynamicDependency("set_ServerCertificateCustomValidationCallback", NativeHandlerType, AssemblyName)] + private void SetServerCertificateCustomValidationCallback(Func? value) => InvokeNativeHandlerMethod("set_ServerCertificateCustomValidationCallback", value); + [DynamicDependency("get_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)] private bool GetCheckCertificateRevocationList() => (bool)InvokeNativeHandlerMethod("get_CheckCertificateRevocationList"); @@ -127,7 +150,7 @@ private HttpMessageHandler CreateNativeHandler() { if (_nativeHandlerMethod == null) { - Type? runtimeOptions = Type.GetType("ObjCRuntime.RuntimeOptions, Xamarin.MacCatalyst"); + Type? runtimeOptions = Type.GetType(GetHttpMessageHandlerType); _nativeHandlerMethod = runtimeOptions!.GetMethod("GetHttpMessageHandler", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs index e6168b48190ba6..2284b33b80a719 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs @@ -426,7 +426,7 @@ public X509CertificateCollection ClientCertificates { if (IsNativeHandlerEnabled) { - throw new PlatformNotSupportedException(); + return GetServerCertificateCustomValidationCallback(); } else { @@ -437,7 +437,7 @@ public X509CertificateCollection ClientCertificates { if (IsNativeHandlerEnabled) { - throw new PlatformNotSupportedException(); + SetServerCertificateCustomValidationCallback(value); } else { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.iOS.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.iOS.cs deleted file mode 100644 index 915c1c99ec6104..00000000000000 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.iOS.cs +++ /dev/null @@ -1,137 +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 System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Net.Security; -using System.Reflection; -using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; - -namespace System.Net.Http -{ - public partial class HttpClientHandler : HttpMessageHandler - { - private static MethodInfo? _nativeHandlerMethod; - - private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler"; - private const string AssemblyName = "Xamarin.iOS"; - - [DynamicDependency("get_DefaultProxyCredentials", NativeHandlerType, AssemblyName)] - private ICredentials? GetDefaultProxyCredentials() => (ICredentials?)InvokeNativeHandlerMethod("get_DefaultProxyCredentials"); - - [DynamicDependency("set_DefaultProxyCredentials", NativeHandlerType, AssemblyName)] - private void SetDefaultProxyCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_DefaultProxyCredentials", value); - - [DynamicDependency("get_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)] - private int GetMaxConnectionsPerServer() => (int)InvokeNativeHandlerMethod("get_MaxConnectionsPerServer"); - - [DynamicDependency("set_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)] - private void SetMaxConnectionsPerServer(int value) => InvokeNativeHandlerMethod("set_MaxConnectionsPerServer", value); - - [DynamicDependency("get_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)] - private int GetMaxResponseHeadersLength() => (int)InvokeNativeHandlerMethod("get_MaxResponseHeadersLength"); - - [DynamicDependency("set_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)] - private void SetMaxResponseHeadersLength(int value) => InvokeNativeHandlerMethod("set_MaxResponseHeadersLength", value); - - [DynamicDependency("get_ClientCertificateOptions", NativeHandlerType, AssemblyName)] - private ClientCertificateOption GetClientCertificateOptions() => (ClientCertificateOption)InvokeNativeHandlerMethod("get_ClientCertificateOptions"); - - [DynamicDependency("set_ClientCertificateOptions", NativeHandlerType, AssemblyName)] - private void SetClientCertificateOptions(ClientCertificateOption value) => InvokeNativeHandlerMethod("set_ClientCertificateOptions", value); - - [DynamicDependency("get_ClientCertificates", NativeHandlerType, AssemblyName)] - private X509CertificateCollection GetClientCertificates() => (X509CertificateCollection)InvokeNativeHandlerMethod("get_ClientCertificates"); - - [DynamicDependency("get_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)] - private bool GetCheckCertificateRevocationList() => (bool)InvokeNativeHandlerMethod("get_CheckCertificateRevocationList"); - - [DynamicDependency("set_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)] - private void SetCheckCertificateRevocationList(bool value) => InvokeNativeHandlerMethod("set_CheckCertificateRevocationList", value); - - [DynamicDependency("get_SslProtocols", NativeHandlerType, AssemblyName)] - private SslProtocols GetSslProtocols() => (SslProtocols)InvokeNativeHandlerMethod("get_SslProtocols"); - - [DynamicDependency("set_SslProtocols", NativeHandlerType, AssemblyName)] - private void SetSslProtocols(SslProtocols value) => InvokeNativeHandlerMethod("set_SslProtocols", value); - - [DynamicDependency("get_Properties", NativeHandlerType, AssemblyName)] - private IDictionary GetProperties() => (IDictionary)InvokeNativeHandlerMethod("get_Properties"); - - [DynamicDependency("get_SupportsAutomaticDecompression", NativeHandlerType, AssemblyName)] - private bool GetSupportsAutomaticDecompression() => (bool)InvokeNativeHandlerMethod("get_SupportsAutomaticDecompression"); - - [DynamicDependency("get_SupportsProxy", NativeHandlerType, AssemblyName)] - private bool GetSupportsProxy() => (bool)InvokeNativeHandlerMethod("get_SupportsProxy"); - - [DynamicDependency("get_AutomaticDecompression", NativeHandlerType, AssemblyName)] - private DecompressionMethods GetAutomaticDecompression() => (DecompressionMethods)InvokeNativeHandlerMethod("get_AutomaticDecompression"); - - [DynamicDependency("set_AutomaticDecompression", NativeHandlerType, AssemblyName)] - private void SetAutomaticDecompression(DecompressionMethods value) => InvokeNativeHandlerMethod("set_AutomaticDecompression", value); - - [DynamicDependency("get_UseProxy", NativeHandlerType, AssemblyName)] - private bool GetUseProxy() => (bool)InvokeNativeHandlerMethod("get_UseProxy"); - - [DynamicDependency("set_UseProxy", NativeHandlerType, AssemblyName)] - private void SetUseProxy(bool value) => InvokeNativeHandlerMethod("set_UseProxy", value); - - [DynamicDependency("get_Proxy", NativeHandlerType, AssemblyName)] - private IWebProxy GetProxy() => (IWebProxy)InvokeNativeHandlerMethod("get_Proxy"); - - [DynamicDependency("set_Proxy", NativeHandlerType, AssemblyName)] - private void SetProxy(IWebProxy value) => InvokeNativeHandlerMethod("set_Proxy", value); - - [DynamicDependency("get_PreAuthenticate", NativeHandlerType, AssemblyName)] - private bool GetPreAuthenticate() => (bool)InvokeNativeHandlerMethod("get_PreAuthenticate"); - - [DynamicDependency("set_PreAuthenticate", NativeHandlerType, AssemblyName)] - private void SetPreAuthenticate(bool value) => InvokeNativeHandlerMethod("set_PreAuthenticate", value); - - [DynamicDependency("get_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)] - private int GetMaxAutomaticRedirections() => (int)InvokeNativeHandlerMethod("get_MaxAutomaticRedirections"); - - [DynamicDependency("set_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)] - private void SetMaxAutomaticRedirections(int value) => InvokeNativeHandlerMethod("set_MaxAutomaticRedirections", value); - - [DynamicDependency("get_UseCookies", NativeHandlerType, AssemblyName)] - private bool GetUseCookies() => (bool)InvokeNativeHandlerMethod("get_UseCookies"); - - [DynamicDependency("get_SupportsRedirectConfiguration", NativeHandlerType, AssemblyName)] - private bool GetSupportsRedirectConfiguration() => (bool)InvokeNativeHandlerMethod("get_SupportsRedirectConfiguration"); - - [DynamicDependency("set_UseCookies", NativeHandlerType, AssemblyName)] - private void SetUseCookies(bool value) => InvokeNativeHandlerMethod("set_UseCookies", value); - - [DynamicDependency("get_CookieContainer", NativeHandlerType, AssemblyName)] - private CookieContainer GetCookieContainer() => (CookieContainer)InvokeNativeHandlerMethod("get_CookieContainer"); - - [DynamicDependency("set_CookieContainer", NativeHandlerType, AssemblyName)] - private void SetCookieContainer(CookieContainer value) => InvokeNativeHandlerMethod("set_CookieContainer", value); - - [DynamicDependency("get_AllowAutoRedirect", NativeHandlerType, AssemblyName)] - private bool GetAllowAutoRedirect() => (bool)InvokeNativeHandlerMethod("get_AllowAutoRedirect"); - - [DynamicDependency("set_AllowAutoRedirect", NativeHandlerType, AssemblyName)] - private void SetAllowAutoRedirect(bool value) => InvokeNativeHandlerMethod("set_AllowAutoRedirect", value); - - [DynamicDependency("get_Credentials", NativeHandlerType, AssemblyName)] - private ICredentials GetCredentials() => (ICredentials)InvokeNativeHandlerMethod("get_Credentials"); - - [DynamicDependency("set_Credentials", NativeHandlerType, AssemblyName)] - private void SetCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_Credentials", value); - - private HttpMessageHandler CreateNativeHandler() - { - if (_nativeHandlerMethod == null) - { - Type? runtimeOptions = Type.GetType("ObjCRuntime.RuntimeOptions, Xamarin.iOS"); - _nativeHandlerMethod = runtimeOptions!.GetMethod("GetHttpMessageHandler", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); - } - - return (HttpMessageHandler)_nativeHandlerMethod!.Invoke(null, null)!; - } - } -} \ No newline at end of file diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.tvOS.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.tvOS.cs deleted file mode 100644 index 8add42ba9752ae..00000000000000 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.tvOS.cs +++ /dev/null @@ -1,137 +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 System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Net.Security; -using System.Reflection; -using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; - -namespace System.Net.Http -{ - public partial class HttpClientHandler : HttpMessageHandler - { - private static MethodInfo? _nativeHandlerMethod; - - private const string NativeHandlerType = "System.Net.Http.NSUrlSessionHandler"; - private const string AssemblyName = "Xamarin.TVOS"; - - [DynamicDependency("get_DefaultProxyCredentials", NativeHandlerType, AssemblyName)] - private ICredentials? GetDefaultProxyCredentials() => (ICredentials?)InvokeNativeHandlerMethod("get_DefaultProxyCredentials"); - - [DynamicDependency("set_DefaultProxyCredentials", NativeHandlerType, AssemblyName)] - private void SetDefaultProxyCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_DefaultProxyCredentials", value); - - [DynamicDependency("get_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)] - private int GetMaxConnectionsPerServer() => (int)InvokeNativeHandlerMethod("get_MaxConnectionsPerServer"); - - [DynamicDependency("set_MaxConnectionsPerServer", NativeHandlerType, AssemblyName)] - private void SetMaxConnectionsPerServer(int value) => InvokeNativeHandlerMethod("set_MaxConnectionsPerServer", value); - - [DynamicDependency("get_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)] - private int GetMaxResponseHeadersLength() => (int)InvokeNativeHandlerMethod("get_MaxResponseHeadersLength"); - - [DynamicDependency("set_MaxResponseHeadersLength", NativeHandlerType, AssemblyName)] - private void SetMaxResponseHeadersLength(int value) => InvokeNativeHandlerMethod("set_MaxResponseHeadersLength", value); - - [DynamicDependency("get_ClientCertificateOptions", NativeHandlerType, AssemblyName)] - private ClientCertificateOption GetClientCertificateOptions() => (ClientCertificateOption)InvokeNativeHandlerMethod("get_ClientCertificateOptions"); - - [DynamicDependency("set_ClientCertificateOptions", NativeHandlerType, AssemblyName)] - private void SetClientCertificateOptions(ClientCertificateOption value) => InvokeNativeHandlerMethod("set_ClientCertificateOptions", value); - - [DynamicDependency("get_ClientCertificates", NativeHandlerType, AssemblyName)] - private X509CertificateCollection GetClientCertificates() => (X509CertificateCollection)InvokeNativeHandlerMethod("get_ClientCertificates"); - - [DynamicDependency("get_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)] - private bool GetCheckCertificateRevocationList() => (bool)InvokeNativeHandlerMethod("get_CheckCertificateRevocationList"); - - [DynamicDependency("set_CheckCertificateRevocationList", NativeHandlerType, AssemblyName)] - private void SetCheckCertificateRevocationList(bool value) => InvokeNativeHandlerMethod("set_CheckCertificateRevocationList", value); - - [DynamicDependency("get_SslProtocols", NativeHandlerType, AssemblyName)] - private SslProtocols GetSslProtocols() => (SslProtocols)InvokeNativeHandlerMethod("get_SslProtocols"); - - [DynamicDependency("set_SslProtocols", NativeHandlerType, AssemblyName)] - private void SetSslProtocols(SslProtocols value) => InvokeNativeHandlerMethod("set_SslProtocols", value); - - [DynamicDependency("get_Properties", NativeHandlerType, AssemblyName)] - private IDictionary GetProperties() => (IDictionary)InvokeNativeHandlerMethod("get_Properties"); - - [DynamicDependency("get_SupportsAutomaticDecompression", NativeHandlerType, AssemblyName)] - private bool GetSupportsAutomaticDecompression() => (bool)InvokeNativeHandlerMethod("get_SupportsAutomaticDecompression"); - - [DynamicDependency("get_SupportsProxy", NativeHandlerType, AssemblyName)] - private bool GetSupportsProxy() => (bool)InvokeNativeHandlerMethod("get_SupportsProxy"); - - [DynamicDependency("get_SupportsRedirectConfiguration", NativeHandlerType, AssemblyName)] - private bool GetSupportsRedirectConfiguration() => (bool)InvokeNativeHandlerMethod("get_SupportsRedirectConfiguration"); - - [DynamicDependency("get_AutomaticDecompression", NativeHandlerType, AssemblyName)] - private DecompressionMethods GetAutomaticDecompression() => (DecompressionMethods)InvokeNativeHandlerMethod("get_AutomaticDecompression"); - - [DynamicDependency("set_AutomaticDecompression", NativeHandlerType, AssemblyName)] - private void SetAutomaticDecompression(DecompressionMethods value) => InvokeNativeHandlerMethod("set_AutomaticDecompression", value); - - [DynamicDependency("get_UseProxy", NativeHandlerType, AssemblyName)] - private bool GetUseProxy() => (bool)InvokeNativeHandlerMethod("get_UseProxy"); - - [DynamicDependency("set_UseProxy", NativeHandlerType, AssemblyName)] - private void SetUseProxy(bool value) => InvokeNativeHandlerMethod("set_UseProxy", value); - - [DynamicDependency("get_Proxy", NativeHandlerType, AssemblyName)] - private IWebProxy GetProxy() => (IWebProxy)InvokeNativeHandlerMethod("get_Proxy"); - - [DynamicDependency("set_Proxy", NativeHandlerType, AssemblyName)] - private void SetProxy(IWebProxy value) => InvokeNativeHandlerMethod("set_Proxy", value); - - [DynamicDependency("get_PreAuthenticate", NativeHandlerType, AssemblyName)] - private bool GetPreAuthenticate() => (bool)InvokeNativeHandlerMethod("get_PreAuthenticate"); - - [DynamicDependency("set_PreAuthenticate", NativeHandlerType, AssemblyName)] - private void SetPreAuthenticate(bool value) => InvokeNativeHandlerMethod("set_PreAuthenticate", value); - - [DynamicDependency("get_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)] - private int GetMaxAutomaticRedirections() => (int)InvokeNativeHandlerMethod("get_MaxAutomaticRedirections"); - - [DynamicDependency("set_MaxAutomaticRedirections", NativeHandlerType, AssemblyName)] - private void SetMaxAutomaticRedirections(int value) => InvokeNativeHandlerMethod("set_MaxAutomaticRedirections", value); - - [DynamicDependency("get_UseCookies", NativeHandlerType, AssemblyName)] - private bool GetUseCookies() => (bool)InvokeNativeHandlerMethod("get_UseCookies"); - - [DynamicDependency("set_UseCookies", NativeHandlerType, AssemblyName)] - private void SetUseCookies(bool value) => InvokeNativeHandlerMethod("set_UseCookies", value); - - [DynamicDependency("get_CookieContainer", NativeHandlerType, AssemblyName)] - private CookieContainer GetCookieContainer() => (CookieContainer)InvokeNativeHandlerMethod("get_CookieContainer"); - - [DynamicDependency("set_CookieContainer", NativeHandlerType, AssemblyName)] - private void SetCookieContainer(CookieContainer value) => InvokeNativeHandlerMethod("set_CookieContainer", value); - - [DynamicDependency("get_AllowAutoRedirect", NativeHandlerType, AssemblyName)] - private bool GetAllowAutoRedirect() => (bool)InvokeNativeHandlerMethod("get_AllowAutoRedirect"); - - [DynamicDependency("set_AllowAutoRedirect", NativeHandlerType, AssemblyName)] - private void SetAllowAutoRedirect(bool value) => InvokeNativeHandlerMethod("set_AllowAutoRedirect", value); - - [DynamicDependency("get_Credentials", NativeHandlerType, AssemblyName)] - private ICredentials GetCredentials() => (ICredentials)InvokeNativeHandlerMethod("get_Credentials"); - - [DynamicDependency("set_Credentials", NativeHandlerType, AssemblyName)] - private void SetCredentials(ICredentials? value) => InvokeNativeHandlerMethod("set_Credentials", value); - - private HttpMessageHandler CreateNativeHandler() - { - if (_nativeHandlerMethod == null) - { - Type? runtimeOptions = Type.GetType("ObjCRuntime.RuntimeOptions, Xamarin.TVOS"); - _nativeHandlerMethod = runtimeOptions!.GetMethod("GetHttpMessageHandler", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); - } - - return (HttpMessageHandler)_nativeHandlerMethod!.Invoke(null, null)!; - } - } -} \ No newline at end of file diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpMessageInvoker.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpMessageInvoker.cs index 9b33c75b4b22d4..a4a93e08b2bf96 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpMessageInvoker.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpMessageInvoker.cs @@ -46,18 +46,20 @@ public virtual HttpResponseMessage Send(HttpRequestMessage request, Cancellation { HttpTelemetry.Log.RequestStart(request); + HttpResponseMessage? response = null; try { - return _handler.Send(request, cancellationToken); + response = _handler.Send(request, cancellationToken); + return response; } - catch when (LogRequestFailed(telemetryStarted: true)) + catch (Exception ex) when (LogRequestFailed(ex, telemetryStarted: true)) { // Unreachable as LogRequestFailed will return false throw; } finally { - HttpTelemetry.Log.RequestStop(); + HttpTelemetry.Log.RequestStop(response); } } else @@ -85,18 +87,20 @@ static async Task SendAsyncWithTelemetry(HttpMessageHandler { HttpTelemetry.Log.RequestStart(request); + HttpResponseMessage? response = null; try { - return await handler.SendAsync(request, cancellationToken).ConfigureAwait(false); + response = await handler.SendAsync(request, cancellationToken).ConfigureAwait(false); + return response; } - catch when (LogRequestFailed(telemetryStarted: true)) + catch (Exception ex) when (LogRequestFailed(ex, telemetryStarted: true)) { // Unreachable as LogRequestFailed will return false throw; } finally { - HttpTelemetry.Log.RequestStop(); + HttpTelemetry.Log.RequestStop(response); } } } @@ -107,11 +111,11 @@ private static bool ShouldSendWithTelemetry(HttpRequestMessage request) => request.RequestUri is Uri requestUri && requestUri.IsAbsoluteUri; - internal static bool LogRequestFailed(bool telemetryStarted) + internal static bool LogRequestFailed(Exception exception, bool telemetryStarted) { if (HttpTelemetry.Log.IsEnabled() && telemetryStarted) { - HttpTelemetry.Log.RequestFailed(); + HttpTelemetry.Log.RequestFailed(exception); } return false; } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpTelemetry.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpTelemetry.cs index ae52766e081165..cb5015010db7eb 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpTelemetry.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpTelemetry.cs @@ -48,18 +48,34 @@ public void RequestStart(HttpRequestMessage request) request.VersionPolicy); } - [Event(2, Level = EventLevel.Informational)] - public void RequestStop() + [NonEvent] + public void RequestStop(HttpResponseMessage? response) + { + RequestStop(response is null ? -1 : (int)response.StatusCode); + } + + [Event(2, Level = EventLevel.Informational, Version = 1)] + private void RequestStop(int statusCode) { Interlocked.Increment(ref _stoppedRequests); - WriteEvent(eventId: 2); + WriteEvent(eventId: 2, statusCode); } - [Event(3, Level = EventLevel.Error)] - public void RequestFailed() + [NonEvent] + public void RequestFailed(Exception exception) { Interlocked.Increment(ref _failedRequests); - WriteEvent(eventId: 3); + + if (IsEnabled(EventLevel.Error, EventKeywords.None)) + { + RequestFailed(exceptionMessage: exception.Message); + } + } + + [Event(3, Level = EventLevel.Error, Version = 1)] + private void RequestFailed(string exceptionMessage) + { + WriteEvent(eventId: 3, exceptionMessage); } [Event(4, Level = EventLevel.Informational)] @@ -110,10 +126,10 @@ public void ResponseHeadersStart() WriteEvent(eventId: 11); } - [Event(12, Level = EventLevel.Informational)] - public void ResponseHeadersStop() + [Event(12, Level = EventLevel.Informational, Version = 1)] + public void ResponseHeadersStop(int statusCode) { - WriteEvent(eventId: 12); + WriteEvent(eventId: 12, statusCode); } [Event(13, Level = EventLevel.Informational)] diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.NtAuth.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.NtAuth.cs index 52edbb5a80cbac..ca9ab2dc705377 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.NtAuth.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.NtAuth.cs @@ -61,7 +61,7 @@ private static bool ProxySupportsConnectionAuth(HttpResponseMessage response) foreach (string v in values) { - if (v == "Session-Based-Authentication") + if (v.Equals("Session-Based-Authentication", StringComparison.OrdinalIgnoreCase)) { return true; } @@ -154,8 +154,19 @@ private static async Task SendWithNtAuthAsync(HttpRequestMe NetEventSource.Info(connection, $"Authentication: {challenge.AuthenticationType}, SPN: {spn}"); } + ContextFlagsPal contextFlags = ContextFlagsPal.Connection; + // When connecting to proxy server don't enforce the integrity to avoid + // compatibility issues. The assumption is that the proxy server comes + // from a trusted source. On macOS we always need to enforce the integrity + // to avoid the GSSAPI implementation generating corrupted authentication + // tokens. + if (!isProxyAuth || OperatingSystem.IsMacOS()) + { + contextFlags |= ContextFlagsPal.InitIntegrity; + } + ChannelBinding? channelBinding = connection.TransportContext?.GetChannelBinding(ChannelBindingKind.Endpoint); - NTAuthentication authContext = new NTAuthentication(isServer: false, challenge.SchemeName, challenge.Credential, spn, ContextFlagsPal.Connection | ContextFlagsPal.InitIntegrity, channelBinding); + NTAuthentication authContext = new NTAuthentication(isServer: false, challenge.SchemeName, challenge.Credential, spn, contextFlags, channelBinding); string? challengeData = challenge.ChallengeData; try { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.cs index 88b3f64d0ec7a9..639e0367ba5aa7 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.cs @@ -206,7 +206,7 @@ private static async ValueTask TrySetDigestAuthToken(HttpRequestMessage re private static ValueTask InnerSendAsync(HttpRequestMessage request, bool async, bool isProxyAuth, bool doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken) { return isProxyAuth ? - pool.SendWithRetryAsync(request, async, doRequestAuth, cancellationToken) : + pool.SendWithVersionDetectionAndRetryAsync(request, async, doRequestAuth, cancellationToken) : pool.SendWithProxyAuthAsync(request, async, doRequestAuth, cancellationToken); } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ChunkedEncodingReadStream.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ChunkedEncodingReadStream.cs index ff87d5a89f9432..f40650a470212e 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ChunkedEncodingReadStream.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ChunkedEncodingReadStream.cs @@ -21,8 +21,6 @@ private sealed class ChunkedEncodingReadStream : HttpContentReadStream /// infinite chunk length is sent. This value is arbitrary and can be changed as needed. /// private const int MaxChunkBytesAllowed = 16 * 1024; - /// How long a trailing header can be. This value is arbitrary and can be changed as needed. - private const int MaxTrailingHeaderLength = 16 * 1024; /// The number of bytes remaining in the chunk. private ulong _chunkBytesRemaining; /// The current state of the parsing state machine for the chunked response. @@ -297,6 +295,9 @@ private ReadOnlyMemory ReadChunkFromConnectionBuffer(int maxBytesToRead, C else { _state = ParsingState.ConsumeTrailers; + // Apply the MaxResponseHeadersLength limit to all trailing headers. + // The limit is applied to regular response headers and trailing headers separately. + _connection._allowedReadLineBytes = _connection.MaxResponseHeadersLength; goto case ParsingState.ConsumeTrailers; } @@ -343,7 +344,6 @@ private ReadOnlyMemory ReadChunkFromConnectionBuffer(int maxBytesToRead, C while (true) { - _connection._allowedReadLineBytes = MaxTrailingHeaderLength; if (!_connection.TryReadNextLine(out currentLine)) { break; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/DecompressionHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/DecompressionHandler.cs index 0e354ff30cb0f3..939a29e06f393e 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/DecompressionHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/DecompressionHandler.cs @@ -6,7 +6,6 @@ using System.IO; using System.IO.Compression; using System.Net.Http.Headers; -using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; @@ -224,12 +223,203 @@ public DeflateDecompressedContent(HttpContent originalContent) { } protected override Stream GetDecompressedStream(Stream originalStream) => - // As described in RFC 2616, the deflate content-coding is actually - // the "zlib" format (RFC 1950) in combination with the "deflate" - // compression algrithm (RFC 1951). So while potentially - // counterintuitive based on naming, this needs to use ZLibStream - // rather than DeflateStream. - new ZLibStream(originalStream, CompressionMode.Decompress); + new ZLibOrDeflateStream(originalStream); + + /// Stream that wraps either or for decompression. + private sealed class ZLibOrDeflateStream : HttpBaseStream + { + // As described in RFC 2616, the deflate content-coding is the "zlib" format (RFC 1950) in combination with + // the "deflate" compression algrithm (RFC 1951). Thus, the right stream to use here is ZLibStream. However, + // some servers incorrectly interpret "deflate" to mean the raw, unwrapped deflate protocol. To account for + // that, this switches between using ZLibStream (correct) and DeflateStream (incorrect) in order to maximize + // compatibility with servers. + + private readonly PeekFirstByteReadStream _stream; + private Stream? _decompressionStream; + + public ZLibOrDeflateStream(Stream stream) => _stream = new PeekFirstByteReadStream(stream); + + protected override void Dispose(bool disposing) + { + if (disposing) + { + _decompressionStream?.Dispose(); + _stream.Dispose(); + } + base.Dispose(disposing); + } + + public override bool CanRead => true; + public override bool CanWrite => false; + public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken) => throw new NotSupportedException(); + + // On the first read request, peek at the first nibble of the response. If it's an 8, use ZLibStream, otherwise + // use DeflateStream. This heuristic works because we're deciding only between raw deflate and zlib wrapped around + // deflate, in which case the first nibble will always be 8 for zlib and never be 8 for deflate. + // https://stackoverflow.com/a/37528114 provides an explanation for why. + + public override int Read(Span buffer) + { + if (_decompressionStream is null) + { + int firstByte = _stream.PeekFirstByte(); + _decompressionStream = CreateDecompressionStream(firstByte, _stream); + } + + return _decompressionStream.Read(buffer); + } + + public override ValueTask ReadAsync(Memory buffer, CancellationToken cancellationToken) + { + if (_decompressionStream is null) + { + return CreateAndReadAsync(this, buffer, cancellationToken); + + static async ValueTask CreateAndReadAsync(ZLibOrDeflateStream thisRef, Memory buffer, CancellationToken cancellationToken) + { + int firstByte = await thisRef._stream.PeekFirstByteAsync(cancellationToken).ConfigureAwait(false); + thisRef._decompressionStream = CreateDecompressionStream(firstByte, thisRef._stream); + return await thisRef._decompressionStream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false); + } + } + + return _decompressionStream.ReadAsync(buffer, cancellationToken); + } + + public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + ValidateCopyToArguments(destination, bufferSize); + return Core(destination, bufferSize, cancellationToken); + async Task Core(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + if (_decompressionStream is null) + { + int firstByte = await _stream.PeekFirstByteAsync(cancellationToken).ConfigureAwait(false); + _decompressionStream = CreateDecompressionStream(firstByte, _stream); + } + + await _decompressionStream.CopyToAsync(destination, bufferSize, cancellationToken).ConfigureAwait(false); + } + } + + private static Stream CreateDecompressionStream(int firstByte, Stream stream) => + (firstByte & 0xF) == 8 ? + new ZLibStream(stream, CompressionMode.Decompress) : + new DeflateStream(stream, CompressionMode.Decompress); + + private sealed class PeekFirstByteReadStream : HttpBaseStream + { + private readonly Stream _stream; + private byte _firstByte; + private FirstByteStatus _firstByteStatus; + + public PeekFirstByteReadStream(Stream stream) => _stream = stream; + + protected override void Dispose(bool disposing) + { + if (disposing) + { + _stream.Dispose(); + } + base.Dispose(disposing); + } + + public override bool CanRead => true; + public override bool CanWrite => false; + public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken) => throw new NotSupportedException(); + + public int PeekFirstByte() + { + Debug.Assert(_firstByteStatus == FirstByteStatus.None); + + int value = _stream.ReadByte(); + if (value == -1) + { + _firstByteStatus = FirstByteStatus.Consumed; + return -1; + } + + _firstByte = (byte)value; + _firstByteStatus = FirstByteStatus.Available; + return value; + } + + public async ValueTask PeekFirstByteAsync(CancellationToken cancellationToken) + { + Debug.Assert(_firstByteStatus == FirstByteStatus.None); + + var buffer = new byte[1]; + + int bytesRead = await _stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false); + if (bytesRead == 0) + { + _firstByteStatus = FirstByteStatus.Consumed; + return -1; + } + + _firstByte = buffer[0]; + _firstByteStatus = FirstByteStatus.Available; + return buffer[0]; + } + + public override int Read(Span buffer) + { + if (_firstByteStatus == FirstByteStatus.Available) + { + if (buffer.Length != 0) + { + buffer[0] = _firstByte; + _firstByteStatus = FirstByteStatus.Consumed; + return 1; + } + + return 0; + } + + Debug.Assert(_firstByteStatus == FirstByteStatus.Consumed); + return _stream.Read(buffer); + } + + public override ValueTask ReadAsync(Memory buffer, CancellationToken cancellationToken) + { + if (_firstByteStatus == FirstByteStatus.Available) + { + if (buffer.Length != 0) + { + buffer.Span[0] = _firstByte; + _firstByteStatus = FirstByteStatus.Consumed; + return new ValueTask(1); + } + + return new ValueTask(0); + } + + Debug.Assert(_firstByteStatus == FirstByteStatus.Consumed); + return _stream.ReadAsync(buffer, cancellationToken); + } + + public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + Debug.Assert(_firstByteStatus != FirstByteStatus.None); + + ValidateCopyToArguments(destination, bufferSize); + if (_firstByteStatus == FirstByteStatus.Available) + { + await destination.WriteAsync(new byte[] { _firstByte }, cancellationToken).ConfigureAwait(false); + _firstByteStatus = FirstByteStatus.Consumed; + } + + await _stream.CopyToAsync(destination, bufferSize, cancellationToken).ConfigureAwait(false); + } + + private enum FirstByteStatus : byte + { + None = 0, + Available = 1, + Consumed = 2 + } + } + } } private sealed class BrotliDecompressedContent : DecompressedContent diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs index b6a33b2f28012a..c90e315c6a13c2 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs @@ -50,6 +50,10 @@ internal sealed partial class Http2Connection : HttpConnectionBase private readonly Channel _writeChannel; private bool _lastPendingWriterShouldFlush; + // Server-advertised SETTINGS_MAX_HEADER_LIST_SIZE + // https://www.rfc-editor.org/rfc/rfc9113.html#section-6.5.2-2.12.1 + private uint _maxHeaderListSize = uint.MaxValue; // Defaults to infinite + // This flag indicates that the connection is shutting down and cannot accept new requests, because of one of the following conditions: // (1) We received a GOAWAY frame from the server // (2) We have exhaustead StreamIds (i.e. _nextStream == MaxStreamId) @@ -156,6 +160,14 @@ public Http2Connection(HttpConnectionPool pool, Stream stream) _nextPingRequestTimestamp = Environment.TickCount64 + _keepAlivePingDelay; _keepAlivePingPolicy = _pool.Settings._keepAlivePingPolicy; + uint maxHeaderListSize = _pool._lastSeenHttp2MaxHeaderListSize; + if (maxHeaderListSize > 0) + { + // Previous connections to the same host advertised a limit. + // Use this as an initial value before we receive the SETTINGS frame. + _maxHeaderListSize = maxHeaderListSize; + } + if (HttpTelemetry.Log.IsEnabled()) { HttpTelemetry.Log.Http20ConnectionEstablished(); @@ -734,12 +746,14 @@ private void ProcessDataFrame(FrameHeader frameHeader) // Just ignore the frame in this case. ReadOnlySpan frameData = GetFrameData(_incomingBuffer.ActiveSpan.Slice(0, frameHeader.PayloadLength), hasPad: frameHeader.PaddedFlag, hasPriority: false); - if (http2Stream != null) { bool endStream = frameHeader.EndStreamFlag; - http2Stream.OnResponseData(frameData, endStream); + if (frameData.Length > 0 || endStream) + { + http2Stream.OnResponseData(frameData, endStream); + } if (!endStream && frameData.Length > 0) { @@ -800,6 +814,8 @@ private void ProcessSettingsFrame(FrameHeader frameHeader, bool initialFrame = f uint settingValue = BinaryPrimitives.ReadUInt32BigEndian(settings); settings = settings.Slice(4); + if (NetEventSource.Log.IsEnabled()) Trace($"Applying setting {(SettingId)settingId}={settingValue}"); + switch ((SettingId)settingId) { case SettingId.MaxConcurrentStreams: @@ -825,6 +841,11 @@ private void ProcessSettingsFrame(FrameHeader frameHeader, bool initialFrame = f // We don't actually store this value; we always send frames of the minimum size (16K). break; + case SettingId.MaxHeaderListSize: + _maxHeaderListSize = settingValue; + _pool._lastSeenHttp2MaxHeaderListSize = _maxHeaderListSize; + break; + default: // All others are ignored because we don't care about them. // Note, per RFC, unknown settings IDs should be ignored. @@ -915,6 +936,8 @@ private void ProcessPingFrame(FrameHeader frameHeader) ReadOnlySpan pingContent = _incomingBuffer.ActiveSpan.Slice(0, FrameHeader.PingLength); long pingContentLong = BinaryPrimitives.ReadInt64BigEndian(pingContent); + if (NetEventSource.Log.IsEnabled()) Trace($"Received PING frame, content:{pingContentLong} ack: {frameHeader.AckFlag}"); + if (frameHeader.AckFlag) { ProcessPingAck(pingContentLong); @@ -1330,17 +1353,19 @@ private void WriteBytes(ReadOnlySpan bytes, ref ArrayBuffer headerBuffer) headerBuffer.Commit(bytes.Length); } - private void WriteHeaderCollection(HttpRequestMessage request, HttpHeaders headers, ref ArrayBuffer headerBuffer) + private int WriteHeaderCollection(HttpRequestMessage request, HttpHeaders headers, ref ArrayBuffer headerBuffer) { if (NetEventSource.Log.IsEnabled()) Trace(""); if (headers.HeaderStore is null) { - return; + return 0; } HeaderEncodingSelector? encodingSelector = _pool.Settings._requestHeaderEncodingSelector; + int headerListSize = headers.HeaderStore.Count * HeaderField.RfcOverhead; + ref string[]? tmpHeaderValuesArray = ref t_headerValues; foreach (KeyValuePair header in headers.HeaderStore) { @@ -1358,6 +1383,10 @@ private void WriteHeaderCollection(HttpRequestMessage request, HttpHeaders heade // The Connection, Upgrade and ProxyConnection headers are also not supported in HTTP2. if (knownHeader != KnownHeaders.Host && knownHeader != KnownHeaders.Connection && knownHeader != KnownHeaders.Upgrade && knownHeader != KnownHeaders.ProxyConnection) { + // The length of the encoded name may be shorter than the actual name. + // Ensure that headerListSize is always >= of the actual size. + headerListSize += knownHeader.Name.Length; + if (header.Key.KnownHeader == KnownHeaders.TE) { // HTTP/2 allows only 'trailers' TE header. rfc7540 8.1.2.2 @@ -1398,6 +1427,8 @@ private void WriteHeaderCollection(HttpRequestMessage request, HttpHeaders heade WriteLiteralHeader(header.Key.Name, headerValues, valueEncoding, ref headerBuffer); } } + + return headerListSize; } private void WriteHeaders(HttpRequestMessage request, ref ArrayBuffer headerBuffer) @@ -1428,9 +1459,9 @@ private void WriteHeaders(HttpRequestMessage request, ref ArrayBuffer headerBuff WriteIndexedHeader(_stream is SslStream ? H2StaticTable.SchemeHttps : H2StaticTable.SchemeHttp, ref headerBuffer); - if (request.HasHeaders && request.Headers.Host != null) + if (request.HasHeaders && request.Headers.Host is string host) { - WriteIndexedHeader(H2StaticTable.Authority, request.Headers.Host, ref headerBuffer); + WriteIndexedHeader(H2StaticTable.Authority, host, ref headerBuffer); } else { @@ -1448,9 +1479,11 @@ private void WriteHeaders(HttpRequestMessage request, ref ArrayBuffer headerBuff WriteIndexedHeader(H2StaticTable.PathSlash, pathAndQuery, ref headerBuffer); } + int headerListSize = 3 * HeaderField.RfcOverhead; // Method, Authority, Path + if (request.HasHeaders) { - WriteHeaderCollection(request, request.Headers, ref headerBuffer); + headerListSize += WriteHeaderCollection(request, request.Headers, ref headerBuffer); } // Determine cookies to send. @@ -1460,9 +1493,9 @@ private void WriteHeaders(HttpRequestMessage request, ref ArrayBuffer headerBuff if (cookiesFromContainer != string.Empty) { WriteBytes(KnownHeaders.Cookie.Http2EncodedName, ref headerBuffer); - Encoding? cookieEncoding = _pool.Settings._requestHeaderEncodingSelector?.Invoke(KnownHeaders.Cookie.Name, request); WriteLiteralHeaderValue(cookiesFromContainer, cookieEncoding, ref headerBuffer); + headerListSize += HttpKnownHeaderNames.Cookie.Length + HeaderField.RfcOverhead; } } @@ -1474,11 +1507,24 @@ private void WriteHeaders(HttpRequestMessage request, ref ArrayBuffer headerBuff { WriteBytes(KnownHeaders.ContentLength.Http2EncodedName, ref headerBuffer); WriteLiteralHeaderValue("0", valueEncoding: null, ref headerBuffer); + headerListSize += HttpKnownHeaderNames.ContentLength.Length + HeaderField.RfcOverhead; } } else { - WriteHeaderCollection(request, request.Content.Headers, ref headerBuffer); + headerListSize += WriteHeaderCollection(request, request.Content.Headers, ref headerBuffer); + } + + // The headerListSize is an approximation of the total header length. + // This is acceptable as long as the value is always >= the actual length. + // We must avoid ever sending more than the server allowed. + // This approach must be revisted if we ever support the dynamic table or compression when sending requests. + headerListSize += headerBuffer.ActiveLength; + + uint maxHeaderListSize = _maxHeaderListSize; + if ((uint)headerListSize > maxHeaderListSize) + { + throw new HttpRequestException(SR.Format(SR.net_http_request_headers_exceeded_length, maxHeaderListSize)); } } @@ -1551,10 +1597,10 @@ private async ValueTask SendHeadersAsync(HttpRequestMessage request // streams are created and started in order. await PerformWriteAsync(totalSize, (thisRef: this, http2Stream, headerBytes, endStream: (request.Content == null), mustFlush), static (s, writeBuffer) => { - if (NetEventSource.Log.IsEnabled()) s.thisRef.Trace(s.http2Stream.StreamId, $"Started writing. Total header bytes={s.headerBytes.Length}"); - s.thisRef.AddStream(s.http2Stream); + if (NetEventSource.Log.IsEnabled()) s.thisRef.Trace(s.http2Stream.StreamId, $"Started writing. Total header bytes={s.headerBytes.Length}"); + Span span = writeBuffer.Span; // Copy the HEADERS frame. diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs index aa31d88ee82520..5a880f78e30ef7 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs @@ -998,7 +998,8 @@ public async Task ReadResponseHeadersAsync(CancellationToken cancellationToken) Debug.Assert(!wait); } - if (HttpTelemetry.Log.IsEnabled()) HttpTelemetry.Log.ResponseHeadersStop(); + Debug.Assert(_response is not null); + if (HttpTelemetry.Log.IsEnabled()) HttpTelemetry.Log.ResponseHeadersStop((int)_response.StatusCode); } catch { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2StreamWindowManager.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2StreamWindowManager.cs index 4a1f7ee6b568a2..a9314d14ab174d 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2StreamWindowManager.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2StreamWindowManager.cs @@ -213,6 +213,7 @@ internal void OnDataOrHeadersReceived(Http2Connection connection) // Send a PING _pingCounter--; + if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Sending RTT PING with payload {_pingCounter}"); connection.LogExceptions(connection.SendPingAsync(_pingCounter, isAck: false)); _pingSentTimestamp = now; _state = State.PingSent; @@ -223,6 +224,7 @@ internal void OnPingAckReceived(long payload, Http2Connection connection) { if (_state != State.PingSent && _state != State.TerminatingMayReceivePingAck) { + if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Unexpected PING ACK in state {_state}"); ThrowProtocolError(); } @@ -236,7 +238,10 @@ internal void OnPingAckReceived(long payload, Http2Connection connection) Debug.Assert(payload < 0); if (_pingCounter != payload) + { + if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Unexpected RTT PING ACK payload {payload}, should be {_pingCounter}."); ThrowProtocolError(); + } RefreshRtt(connection); _state = State.Waiting; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3RequestStream.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3RequestStream.cs index aa5f7541ba841b..f2beed2030f2f5 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3RequestStream.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3RequestStream.cs @@ -84,6 +84,7 @@ public void Dispose() if (!_disposed) { _disposed = true; + AbortStream(); _stream.Dispose(); DisposeSyncHelper(); } @@ -94,6 +95,7 @@ public async ValueTask DisposeAsync() if (!_disposed) { _disposed = true; + AbortStream(); await _stream.DisposeAsync().ConfigureAwait(false); DisposeSyncHelper(); } @@ -365,6 +367,9 @@ private async Task SendContentAsync(HttpContent content, CancellationToken cance await content.CopyToAsync(writeStream, null, cancellationToken).ConfigureAwait(false); } + // Set to 0 to recognize that the whole request body has been sent and therefore there's no need to abort write side in case of a premature disposal. + _requestContentLengthRemaining = 0; + if (_sendBuffer.ActiveLength != 0) { // Our initial send buffer, which has our headers, is normally sent out on the first write to the Http3WriteStream. @@ -1046,6 +1051,14 @@ private int ReadResponseContent(HttpResponseMessage response, Span buffer) _responseDataPayloadRemaining -= copyLen; _recvBuffer.Discard(copyLen); buffer = buffer.Slice(copyLen); + + // Stop, if we've reached the end of a data frame and start of the next data frame is not buffered yet + // Waiting for the next data frame may cause a hang, e.g. in echo scenario + // TODO: this is inefficient if data is already available in transport + if (_responseDataPayloadRemaining == 0 && _recvBuffer.ActiveLength == 0) + { + break; + } } else { @@ -1063,10 +1076,9 @@ private int ReadResponseContent(HttpResponseMessage response, Span buffer) _responseDataPayloadRemaining -= bytesRead; buffer = buffer.Slice(bytesRead); - if (_responseDataPayloadRemaining == 0) - { - break; - } + // Stop, even if we are in the middle of a data frame. Waiting for the next data may cause a hang + // TODO: this is inefficient if data is already available in transport + break; } } @@ -1108,6 +1120,14 @@ private async ValueTask ReadResponseContentAsync(HttpResponseMessage respon _responseDataPayloadRemaining -= copyLen; _recvBuffer.Discard(copyLen); buffer = buffer.Slice(copyLen); + + // Stop, if we've reached the end of a data frame and start of the next data frame is not buffered yet + // Waiting for the next data frame may cause a hang, e.g. in echo scenario + // TODO: this is inefficient if data is already available in transport + if (_responseDataPayloadRemaining == 0 && _recvBuffer.ActiveLength == 0) + { + break; + } } else { @@ -1125,10 +1145,9 @@ private async ValueTask ReadResponseContentAsync(HttpResponseMessage respon _responseDataPayloadRemaining -= bytesRead; buffer = buffer.Slice(bytesRead); - if (_responseDataPayloadRemaining == 0) - { - break; - } + // Stop, even if we are in the middle of a data frame. Waiting for the next data may cause a hang + // TODO: this is inefficient if data is already available in transport + break; } } @@ -1217,6 +1236,20 @@ private async ValueTask ReadNextDataFrameAsync(HttpResponseMessage respons public void Trace(string message, [CallerMemberName] string? memberName = null) => _connection.Trace(StreamId, message, memberName); + private void AbortStream() + { + // If the request body isn't completed, cancel it now. + if (_requestContentLengthRemaining != 0) // 0 is used for the end of content writing, -1 is used for unknown Content-Length + { + _stream.AbortWrite((long)Http3ErrorCode.RequestCancelled); + } + // If the response body isn't completed, cancel it now. + if (_responseDataPayloadRemaining != -1) // -1 is used for EOF, 0 for consumed DATA frame payload before the next read + { + _stream.AbortRead((long)Http3ErrorCode.RequestCancelled); + } + } + // TODO: it may be possible for Http3RequestStream to implement Stream directly and avoid this allocation. private sealed class Http3ReadStream : HttpBaseStream { @@ -1240,36 +1273,42 @@ public Http3ReadStream(Http3RequestStream stream) protected override void Dispose(bool disposing) { - if (_stream != null) + Http3RequestStream? stream = Interlocked.Exchange(ref _stream, null); + if (stream is null) { - if (disposing) - { - // This will remove the stream from the connection properly. - _stream.Dispose(); - } - else - { - // We shouldn't be using a managed instance here, but don't have much choice -- we - // need to remove the stream from the connection's GOAWAY collection. - _stream._connection.RemoveStream(_stream._stream); - _stream._connection = null!; - } + return; + } - _stream = null; - _response = null; + if (disposing) + { + // This will remove the stream from the connection properly. + stream.Dispose(); + } + else + { + // We shouldn't be using a managed instance here, but don't have much choice -- we + // need to remove the stream from the connection's GOAWAY collection. + stream._connection.RemoveStream(stream._stream); + stream._connection = null!; } + _response = null; + base.Dispose(disposing); } public override async ValueTask DisposeAsync() { - if (_stream != null) + Http3RequestStream? stream = Interlocked.Exchange(ref _stream, null); + if (stream is null) { - await _stream.DisposeAsync().ConfigureAwait(false); - _stream = null!; + return; } + await stream.DisposeAsync().ConfigureAwait(false); + + _response = null; + await base.DisposeAsync().ConfigureAwait(false); } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs index c7814464a87f66..5efe3736b84105 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs @@ -62,6 +62,7 @@ internal sealed partial class HttpConnection : HttpConnectionBase private int _readLength; private long _idleSinceTickCount; + private int _keepAliveTimeoutSeconds; // 0 == no timeout private bool _inUse; private bool _detachedFromPool; private bool _canRetry; @@ -145,9 +146,14 @@ private void Dispose(bool disposing) /// Prepare an idle connection to be used for a new request. /// Indicates whether the coming request will be sync or async. - /// True if connection can be used, false if it is invalid due to receiving EOF or unexpected data. + /// True if connection can be used, false if it is invalid due to a timeout or receiving EOF or unexpected data. public bool PrepareForReuse(bool async) { + if (CheckKeepAliveTimeoutExceeded()) + { + return false; + } + // We may already have a read-ahead task if we did a previous scavenge and haven't used the connection since. // If the read-ahead task is completed, then we've received either EOF or erroneous data the connection, so it's not usable. if (_readAheadTask is not null) @@ -193,9 +199,14 @@ public bool PrepareForReuse(bool async) } /// Check whether a currently idle connection is still usable, or should be scavenged. - /// True if connection can be used, false if it is invalid due to receiving EOF or unexpected data. + /// True if connection can be used, false if it is invalid due to a timeout or receiving EOF or unexpected data. public override bool CheckUsabilityOnScavenge() { + if (CheckKeepAliveTimeoutExceeded()) + { + return false; + } + // We may already have a read-ahead task if we did a previous scavenge and haven't used the connection since. if (_readAheadTask is null) { @@ -223,6 +234,15 @@ async ValueTask ReadAheadWithZeroByteReadAsync() } } + private bool CheckKeepAliveTimeoutExceeded() + { + // We intentionally honor the Keep-Alive timeout on all HTTP/1.X versions, not just 1.0. This is to maximize compat with + // servers that use a lower idle timeout than the client, but give us a hint in the form of a Keep-Alive timeout parameter. + // If _keepAliveTimeoutSeconds is 0, no timeout has been set. + return _keepAliveTimeoutSeconds != 0 && + GetIdleTicks(Environment.TickCount64) >= _keepAliveTimeoutSeconds * 1000; + } + private ValueTask? ConsumeReadAheadTask() { if (Interlocked.CompareExchange(ref _readAheadTaskLock, 1, 0) == 0) @@ -244,6 +264,8 @@ async ValueTask ReadAheadWithZeroByteReadAsync() public HttpConnectionKind Kind => _pool.Kind; + private int MaxResponseHeadersLength => (int)Math.Min(int.MaxValue, _pool.Settings._maxResponseHeadersLength * 1024L); + private int ReadBufferSize => _readBuffer.Length; private ReadOnlyMemory RemainingBuffer => new ReadOnlyMemory(_readBuffer, _readOffset, _readLength - _readOffset); @@ -537,7 +559,7 @@ public async Task SendAsyncCore(HttpRequestMessage request, } // Start to read response. - _allowedReadLineBytes = (int)Math.Min(int.MaxValue, _pool.Settings._maxResponseHeadersLength * 1024L); + _allowedReadLineBytes = MaxResponseHeadersLength; // We should not have any buffered data here; if there was, it should have been treated as an error // by the previous request handling. (Note we do not support HTTP pipelining.) @@ -647,7 +669,7 @@ public async Task SendAsyncCore(HttpRequestMessage request, ParseHeaderNameValue(this, line.Span, response, isFromTrailer: false); } - if (HttpTelemetry.Log.IsEnabled()) HttpTelemetry.Log.ResponseHeadersStop(); + if (HttpTelemetry.Log.IsEnabled()) HttpTelemetry.Log.ResponseHeadersStop((int)response.StatusCode); if (allowExpect100ToContinue != null) { @@ -737,6 +759,10 @@ public async Task SendAsyncCore(HttpRequestMessage request, _pool.InvalidateHttp11Connection(this); _detachedFromPool = true; } + else if (response.Headers.TransferEncodingChunked == true) + { + responseStream = new ChunkedEncodingReadStream(this, response); + } else if (response.Content.Headers.ContentLength != null) { long contentLength = response.Content.Headers.ContentLength.GetValueOrDefault(); @@ -750,10 +776,6 @@ public async Task SendAsyncCore(HttpRequestMessage request, responseStream = new ContentLengthReadStream(this, (ulong)contentLength); } } - else if (response.Headers.TransferEncodingChunked == true) - { - responseStream = new ChunkedEncodingReadStream(this, response); - } else { responseStream = new ConnectionCloseReadStream(this); @@ -1101,14 +1123,62 @@ private static void ParseHeaderNameValue(HttpConnection connection, ReadOnlySpan } else { - // Request headers returned on the response must be treated as custom headers. string headerValue = connection.GetResponseHeaderValueWithCaching(descriptor, value, valueEncoding); + + if (ReferenceEquals(descriptor.KnownHeader, KnownHeaders.KeepAlive)) + { + // We are intentionally going against RFC to honor the Keep-Alive header even if + // we haven't received a Keep-Alive connection token to maximize compat with servers. + connection.ProcessKeepAliveHeader(headerValue); + } + + // Request headers returned on the response must be treated as custom headers. response.Headers.TryAddWithoutValidation( (descriptor.HeaderType & HttpHeaderType.Request) == HttpHeaderType.Request ? descriptor.AsCustomHeader() : descriptor, headerValue); } } + private void ProcessKeepAliveHeader(string keepAlive) + { + var parsedValues = new ObjectCollection(); + + if (NameValueHeaderValue.GetNameValueListLength(keepAlive, 0, ',', parsedValues) == keepAlive.Length) + { + foreach (NameValueHeaderValue nameValue in parsedValues) + { + // The HTTP/1.1 spec does not define any parameters for the Keep-Alive header, so we are using the de facto standard ones - timeout and max. + if (string.Equals(nameValue.Name, "timeout", StringComparison.OrdinalIgnoreCase)) + { + if (!string.IsNullOrEmpty(nameValue.Value) && + HeaderUtilities.TryParseInt32(nameValue.Value, out int timeout) && + timeout >= 0) + { + // Some servers are very strict with closing the connection exactly at the timeout. + // Avoid using the connection if it is about to exceed the timeout to avoid resulting request failures. + const int OffsetSeconds = 1; + + if (timeout <= OffsetSeconds) + { + _connectionClose = true; + } + else + { + _keepAliveTimeoutSeconds = timeout - OffsetSeconds; + } + } + } + else if (string.Equals(nameValue.Name, "max", StringComparison.OrdinalIgnoreCase)) + { + if (nameValue.Value == "0") + { + _connectionClose = true; + } + } + } + } + } + private void WriteToBuffer(ReadOnlySpan source) { Debug.Assert(source.Length <= _writeBuffer.Length - _writeOffset); @@ -1457,7 +1527,7 @@ private bool TryReadNextLine(out ReadOnlySpan line) { if (_allowedReadLineBytes < buffer.Length) { - throw new HttpRequestException(SR.Format(SR.net_http_response_headers_exceeded_length, _pool.Settings._maxResponseHeadersLength * 1024L)); + throw new HttpRequestException(SR.Format(SR.net_http_response_headers_exceeded_length, MaxResponseHeadersLength)); } line = default; @@ -1568,7 +1638,7 @@ private void ThrowIfExceededAllowedReadLineBytes() { if (_allowedReadLineBytes < 0) { - throw new HttpRequestException(SR.Format(SR.net_http_response_headers_exceeded_length, _pool.Settings._maxResponseHeadersLength * 1024L)); + throw new HttpRequestException(SR.Format(SR.net_http_response_headers_exceeded_length, MaxResponseHeadersLength)); } } @@ -1747,7 +1817,7 @@ private ValueTask ReadBufferedAsync(Memory destination) // If the caller provided buffer, and thus the amount of data desired to be read, // is larger than the internal buffer, there's no point going through the internal // buffer, so just do an unbuffered read. - return destination.Length >= _readBuffer.Length ? + return destination.Length == 0 || destination.Length >= _readBuffer.Length ? ReadAsync(destination) : ReadBufferedAsyncCore(destination); } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs index 787b89c8bd7a29..64a5911015292f 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs @@ -96,6 +96,14 @@ internal sealed class HttpConnectionPool : IDisposable private SemaphoreSlim? _http3ConnectionCreateLock; internal readonly byte[]? _http3EncodedAuthorityHostHeader; + // These settings are advertised by the server via SETTINGS_MAX_HEADER_LIST_SIZE. + // If we had previous connections to the same host in this pool, memorize the last value seen. + // This value is used as an initial value for new connections before they have a chance to observe the SETTINGS frame. + // Doing so avoids immediately exceeding the server limit on the first request, potentially causing the connection to be torn down. + // 0 means there were no previous connections, or they hadn't advertised this limit. + // There is no need to lock when updating these values - we're only interested in saving _a_ value, not necessarily the min/max/last. + internal uint _lastSeenHttp2MaxHeaderListSize; + /// For non-proxy connection pools, this is the host name in bytes; for proxies, null. private readonly byte[]? _hostHeaderValueBytes; /// Options specialized and cached for this pool and its key. @@ -413,11 +421,12 @@ private object SyncObj // we will remove it from the list of available connections, if it is present there. // If not, then it must be unavailable at the moment; we will detect this and ensure it is not added back to the available pool. - private static HttpRequestException GetVersionException(HttpRequestMessage request, int desiredVersion) + [DoesNotReturn] + private static void ThrowGetVersionException(HttpRequestMessage request, int desiredVersion) { Debug.Assert(desiredVersion == 2 || desiredVersion == 3); - return new HttpRequestException(SR.Format(SR.net_http_requested_version_cannot_establish, request.Version, request.VersionPolicy, desiredVersion)); + throw new HttpRequestException(SR.Format(SR.net_http_requested_version_cannot_establish, request.Version, request.VersionPolicy, desiredVersion)); } private bool CheckExpirationOnGet(HttpConnectionBase connection) @@ -472,11 +481,18 @@ private void CheckForHttp11ConnectionInjection() { Debug.Assert(HasSyncObjLock); - if (!_http11RequestQueue.TryPeekNextRequest(out HttpRequestMessage? request)) + if (!_http11RequestQueue.TryPeekUncanceledRequest(this, out HttpRequestMessage? request)) { return; } + if (NetEventSource.Log.IsEnabled()) + { + Trace($"Available HTTP/1.1 connections: {_availableHttp11Connections.Count}, Requests in the queue: {_http11RequestQueue.Count}, " + + $"Pending HTTP/1.1 connections: {_pendingHttp11ConnectionCount}, Total associated HTTP/1.1 connections: {_associatedHttp11ConnectionCount}, " + + $"Max HTTP/1.1 connection limit: {_maxHttp11Connections}."); + } + // Determine if we can and should add a new connection to the pool. if (_availableHttp11Connections.Count == 0 && // No available connections _http11RequestQueue.Count > _pendingHttp11ConnectionCount && // More requests queued than pending connections @@ -680,7 +696,7 @@ private void CheckForHttp2ConnectionInjection() { Debug.Assert(HasSyncObjLock); - if (!_http2RequestQueue.TryPeekNextRequest(out HttpRequestMessage? request)) + if (!_http2RequestQueue.TryPeekUncanceledRequest(this, out HttpRequestMessage? request)) { return; } @@ -851,8 +867,10 @@ private async ValueTask GetHttp3ConnectionAsync(HttpRequestMess { quicConnection = await ConnectHelper.ConnectQuicAsync(request, Settings._quicImplementationProvider ?? QuicImplementationProviders.Default, new DnsEndPoint(authority.IdnHost, authority.Port), _sslOptionsHttp3!, cancellationToken).ConfigureAwait(false); } - catch + catch (Exception e) { + if (NetEventSource.Log.IsEnabled()) Trace($"QUIC connection failed: {e}"); + // Disables HTTP/3 until server announces it can handle it via Alt-Svc. BlocklistAuthority(authority); throw; @@ -887,144 +905,118 @@ private async ValueTask GetHttp3ConnectionAsync(HttpRequestMess [SupportedOSPlatform("windows")] [SupportedOSPlatform("linux")] [SupportedOSPlatform("macos")] - private async ValueTask TrySendUsingHttp3Async(HttpRequestMessage request, bool async, bool doRequestAuth, CancellationToken cancellationToken) + private async ValueTask TrySendUsingHttp3Async(HttpRequestMessage request, bool async, CancellationToken cancellationToken) { - if (_http3Enabled && (request.Version.Major >= 3 || (request.VersionPolicy == HttpVersionPolicy.RequestVersionOrHigher && IsSecure))) + // Loop in case we get a 421 and need to send the request to a different authority. + while (true) { - // Loop in case we get a 421 and need to send the request to a different authority. - while (true) - { - HttpAuthority? authority = _http3Authority; - - // If H3 is explicitly requested, assume prenegotiated H3. - if (request.Version.Major >= 3 && request.VersionPolicy != HttpVersionPolicy.RequestVersionOrLower) - { - authority = authority ?? _originAuthority; - } - - if (authority == null) - { - break; - } - - if (IsAltSvcBlocked(authority)) - { - throw GetVersionException(request, 3); - } + HttpAuthority? authority = _http3Authority; - Http3Connection connection = await GetHttp3ConnectionAsync(request, authority, cancellationToken).ConfigureAwait(false); - HttpResponseMessage response = await connection.SendAsync(request, async, cancellationToken).ConfigureAwait(false); - - // If an Alt-Svc authority returns 421, it means it can't actually handle the request. - // An authority is supposed to be able to handle ALL requests to the origin, so this is a server bug. - // In this case, we blocklist the authority and retry the request at the origin. - if (response.StatusCode == HttpStatusCode.MisdirectedRequest && connection.Authority != _originAuthority) - { - response.Dispose(); - BlocklistAuthority(connection.Authority); - continue; - } - - return response; + // If H3 is explicitly requested, assume prenegotiated H3. + if (request.Version.Major >= 3 && request.VersionPolicy != HttpVersionPolicy.RequestVersionOrLower) + { + authority ??= _originAuthority; } - } - - return null; - } - // Returns null if HTTP2 cannot be used. - private async ValueTask TrySendUsingHttp2Async(HttpRequestMessage request, bool async, bool doRequestAuth, CancellationToken cancellationToken) - { - // Send using HTTP/2 if we can. - if (_http2Enabled && (request.Version.Major >= 2 || (request.VersionPolicy == HttpVersionPolicy.RequestVersionOrHigher && IsSecure)) && - // If the connection is not secured and downgrade is possible, prefer HTTP/1.1. - (request.VersionPolicy != HttpVersionPolicy.RequestVersionOrLower || IsSecure)) - { - Http2Connection? connection = await GetHttp2ConnectionAsync(request, async, cancellationToken).ConfigureAwait(false); - if (connection is null) + if (authority == null) { - Debug.Assert(!_http2Enabled); return null; } - return await connection.SendAsync(request, async, cancellationToken).ConfigureAwait(false); - } - - return null; - } - - private async ValueTask SendUsingHttp11Async(HttpRequestMessage request, bool async, bool doRequestAuth, CancellationToken cancellationToken) - { - HttpConnection connection = await GetHttp11ConnectionAsync(request, async, cancellationToken).ConfigureAwait(false); - - // In case we are doing Windows (i.e. connection-based) auth, we need to ensure that we hold on to this specific connection while auth is underway. - connection.Acquire(); - try - { - return await SendWithNtConnectionAuthAsync(connection, request, async, doRequestAuth, cancellationToken).ConfigureAwait(false); - } - finally - { - connection.Release(); - } - } + if (IsAltSvcBlocked(authority)) + { + ThrowGetVersionException(request, 3); + } - private async ValueTask DetermineVersionAndSendAsync(HttpRequestMessage request, bool async, bool doRequestAuth, CancellationToken cancellationToken) - { - HttpResponseMessage? response; + Http3Connection connection = await GetHttp3ConnectionAsync(request, authority, cancellationToken).ConfigureAwait(false); + HttpResponseMessage response = await connection.SendAsync(request, async, cancellationToken).ConfigureAwait(false); - if (IsHttp3Supported()) - { - response = await TrySendUsingHttp3Async(request, async, doRequestAuth, cancellationToken).ConfigureAwait(false); - if (response is not null) + // If an Alt-Svc authority returns 421, it means it can't actually handle the request. + // An authority is supposed to be able to handle ALL requests to the origin, so this is a server bug. + // In this case, we blocklist the authority and retry the request at the origin. + if (response.StatusCode == HttpStatusCode.MisdirectedRequest && connection.Authority != _originAuthority) { - return response; + response.Dispose(); + BlocklistAuthority(connection.Authority); + continue; } - } - - // We cannot use HTTP/3. Do not continue if downgrade is not allowed. - if (request.Version.Major >= 3 && request.VersionPolicy != HttpVersionPolicy.RequestVersionOrLower) - { - throw GetVersionException(request, 3); - } - response = await TrySendUsingHttp2Async(request, async, doRequestAuth, cancellationToken).ConfigureAwait(false); - if (response is not null) - { return response; } - - // We cannot use HTTP/2. Do not continue if downgrade is not allowed. - if (request.Version.Major >= 2 && request.VersionPolicy != HttpVersionPolicy.RequestVersionOrLower) - { - throw GetVersionException(request, 2); - } - - return await SendUsingHttp11Async(request, async, doRequestAuth, cancellationToken).ConfigureAwait(false); } - private async ValueTask SendAndProcessAltSvcAsync(HttpRequestMessage request, bool async, bool doRequestAuth, CancellationToken cancellationToken) + /// Check for the Alt-Svc header, to upgrade to HTTP/3. + private void ProcessAltSvc(HttpResponseMessage response) { - HttpResponseMessage response = await DetermineVersionAndSendAsync(request, async, doRequestAuth, cancellationToken).ConfigureAwait(false); - - // Check for the Alt-Svc header, to upgrade to HTTP/3. if (_altSvcEnabled && response.Headers.TryGetValues(KnownHeaders.AltSvc.Descriptor, out IEnumerable? altSvcHeaderValues)) { HandleAltSvc(altSvcHeaderValues, response.Headers.Age); } - - return response; } - public async ValueTask SendWithRetryAsync(HttpRequestMessage request, bool async, bool doRequestAuth, CancellationToken cancellationToken) + public async ValueTask SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, bool async, bool doRequestAuth, CancellationToken cancellationToken) { + // Loop on connection failures (or other problems like version downgrade) and retry if possible. int retryCount = 0; while (true) { - // Loop on connection failures (or other problems like version downgrade) and retry if possible. try { - return await SendAndProcessAltSvcAsync(request, async, doRequestAuth, cancellationToken).ConfigureAwait(false); + HttpResponseMessage? response = null; + + // Use HTTP/3 if possible. + if (IsHttp3Supported() && // guard to enable trimming HTTP/3 support + _http3Enabled && + (request.Version.Major >= 3 || (request.VersionPolicy == HttpVersionPolicy.RequestVersionOrHigher && IsSecure))) + { + response = await TrySendUsingHttp3Async(request, async, cancellationToken).ConfigureAwait(false); + } + + if (response is null) + { + // We could not use HTTP/3. Do not continue if downgrade is not allowed. + if (request.Version.Major >= 3 && request.VersionPolicy != HttpVersionPolicy.RequestVersionOrLower) + { + ThrowGetVersionException(request, 3); + } + + // Use HTTP/2 if possible. + if (_http2Enabled && + (request.Version.Major >= 2 || (request.VersionPolicy == HttpVersionPolicy.RequestVersionOrHigher && IsSecure)) && + (request.VersionPolicy != HttpVersionPolicy.RequestVersionOrLower || IsSecure)) // prefer HTTP/1.1 if connection is not secured and downgrade is possible + { + Http2Connection? connection = await GetHttp2ConnectionAsync(request, async, cancellationToken).ConfigureAwait(false); + Debug.Assert(connection is not null || !_http2Enabled); + if (connection is not null) + { + response = await connection.SendAsync(request, async, cancellationToken).ConfigureAwait(false); + } + } + + if (response is null) + { + // We could not use HTTP/2. Do not continue if downgrade is not allowed. + if (request.Version.Major >= 2 && request.VersionPolicy != HttpVersionPolicy.RequestVersionOrLower) + { + ThrowGetVersionException(request, 2); + } + + // Use HTTP/1.x. + HttpConnection connection = await GetHttp11ConnectionAsync(request, async, cancellationToken).ConfigureAwait(false); + connection.Acquire(); // In case we are doing Windows (i.e. connection-based) auth, we need to ensure that we hold on to this specific connection while auth is underway. + try + { + response = await SendWithNtConnectionAuthAsync(connection, request, async, doRequestAuth, cancellationToken).ConfigureAwait(false); + } + finally + { + connection.Release(); + } + } + } + + ProcessAltSvc(response); + return response; } catch (HttpRequestException e) when (e.AllowRetry == RequestRetryType.RetryOnConnectionFailure) { @@ -1332,7 +1324,7 @@ public ValueTask SendWithProxyAuthAsync(HttpRequestMessage return AuthenticationHelper.SendWithProxyAuthAsync(request, _proxyUri!, async, ProxyCredentials, doRequestAuth, this, cancellationToken); } - return SendWithRetryAsync(request, async, doRequestAuth, cancellationToken); + return SendWithVersionDetectionAndRetryAsync(request, async, doRequestAuth, cancellationToken); } public ValueTask SendAsync(HttpRequestMessage request, bool async, bool doRequestAuth, CancellationToken cancellationToken) @@ -1600,7 +1592,7 @@ private async ValueTask EstablishProxyTunnelAsync(bool async, HttpReques private void HandleHttp11ConnectionFailure(Exception e) { - if (NetEventSource.Log.IsEnabled()) Trace("HTTP/1.1 connection failed"); + if (NetEventSource.Log.IsEnabled()) Trace($"HTTP/1.1 connection failed: {e}"); lock (SyncObj) { @@ -1619,7 +1611,7 @@ private void HandleHttp11ConnectionFailure(Exception e) private void HandleHttp2ConnectionFailure(Exception e) { - if (NetEventSource.Log.IsEnabled()) Trace("HTTP2 connection failed"); + if (NetEventSource.Log.IsEnabled()) Trace($"HTTP2 connection failed: {e}"); lock (SyncObj) { @@ -2004,7 +1996,12 @@ public bool CleanCacheAndDisposeIfUnused() } // Dispose the stale connections outside the pool lock, to avoid holding the lock too long. - toDispose?.ForEach(c => c.Dispose()); + // Dispose them asynchronously to not to block the caller on closing the SslStream or NetworkStream. + if (toDispose is not null) + { + Task.Factory.StartNew(static s => ((List)s!).ForEach(c => c.Dispose()), toDispose, + CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); + } // Pool is active. Should not be removed. return false; @@ -2024,7 +2021,8 @@ static int ScavengeConnectionList(List list, ref List? if (freeIndex < list.Count) { // We know the connection at freeIndex is unusable, so dispose of it. - toDispose ??= new List { list[freeIndex] }; + toDispose ??= new List(); + toDispose.Add(list[freeIndex]); // Find the first item after the one to be removed that should be kept. int current = freeIndex + 1; @@ -2083,7 +2081,7 @@ static bool IsUsableConnection(HttpConnectionBase connection, long nowTicks, Tim if (!connection.CheckUsabilityOnScavenge()) { - if (NetEventSource.Log.IsEnabled()) connection.Trace($"Scavenging connection. Unexpected data or EOF received."); + if (NetEventSource.Log.IsEnabled()) connection.Trace($"Scavenging connection. Keep-Alive timeout exceeded, unexpected data or EOF received."); return false; } @@ -2205,14 +2203,22 @@ public bool TryDequeueNextRequest(T connection) return false; } - public bool TryPeekNextRequest([NotNullWhen(true)] out HttpRequestMessage? request) + public bool TryPeekUncanceledRequest(HttpConnectionPool pool, [MaybeNullWhen(false)] out HttpRequestMessage request) { if (_queue is not null) { - if (_queue.TryPeek(out QueueItem item)) + while (_queue.TryPeek(out QueueItem item)) { - request = item.Request; - return true; + if (item.Waiter.Task.IsCanceled) + { + if (NetEventSource.Log.IsEnabled()) pool.Trace("Discarding canceled request from queue."); + _queue.Dequeue(); + } + else + { + request = item.Request; + return true; + } } } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPoolManager.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPoolManager.cs index e257cb4c3e692f..f118d151c692ae 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPoolManager.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPoolManager.cs @@ -462,7 +462,7 @@ private void SetCleaningTimer(TimeSpan timeout) { try { - _cleaningTimer!.Change(timeout, timeout); + _cleaningTimer!.Change(timeout, Timeout.InfiniteTimeSpan); _timerIsRunning = timeout != Timeout.InfiniteTimeSpan; } catch (ObjectDisposedException) @@ -492,13 +492,10 @@ private void RemoveStalePools() } } - // Stop running the timer if we don't have any pools to clean up. + // Restart the timer if we have any pools to clean up. lock (SyncObj) { - if (_pools.IsEmpty) - { - SetCleaningTimer(Timeout.InfiniteTimeSpan); - } + SetCleaningTimer(!_pools.IsEmpty ? _cleanPoolTimeout : Timeout.InfiniteTimeSpan); } // NOTE: There is a possible race condition with regards to a pool getting cleaned up at the same diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionSettings.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionSettings.cs index 410acc16b69ad4..64476aa0286631 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionSettings.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionSettings.cs @@ -75,8 +75,6 @@ public HttpConnectionSettings() allowHttp3 && allowHttp2 ? HttpVersion.Version30 : allowHttp2 ? HttpVersion.Version20 : HttpVersion.Version11; - _defaultCredentialsUsedForProxy = _proxy != null && (_proxy.Credentials == CredentialCache.DefaultCredentials || _defaultProxyCredentials == CredentialCache.DefaultCredentials); - _defaultCredentialsUsedForServer = _credentials == CredentialCache.DefaultCredentials; } /// Creates a copy of the settings but with some values normalized to suit the implementation. @@ -96,8 +94,6 @@ public HttpConnectionSettings CloneAndNormalize() _connectTimeout = _connectTimeout, _credentials = _credentials, _defaultProxyCredentials = _defaultProxyCredentials, - _defaultCredentialsUsedForProxy = _defaultCredentialsUsedForProxy, - _defaultCredentialsUsedForServer = _defaultCredentialsUsedForServer, _expect100ContinueTimeout = _expect100ContinueTimeout, _maxAutomaticRedirections = _maxAutomaticRedirections, _maxConnectionsPerServer = _maxConnectionsPerServer, @@ -123,6 +119,8 @@ public HttpConnectionSettings CloneAndNormalize() _plaintextStreamFilter = _plaintextStreamFilter, _initialHttp2StreamWindowSize = _initialHttp2StreamWindowSize, _activityHeadersPropagator = _activityHeadersPropagator, + _defaultCredentialsUsedForProxy = _proxy != null && (_proxy.Credentials == CredentialCache.DefaultCredentials || _defaultProxyCredentials == CredentialCache.DefaultCredentials), + _defaultCredentialsUsedForServer = _credentials == CredentialCache.DefaultCredentials, }; // TODO: Remove if/when QuicImplementationProvider is removed from System.Net.Quic. diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RawConnectionStream.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RawConnectionStream.cs index 44376b01a95b23..0255adc776f4de 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RawConnectionStream.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RawConnectionStream.cs @@ -45,9 +45,9 @@ public override async ValueTask ReadAsync(Memory buffer, Cancellation CancellationHelper.ThrowIfCancellationRequested(cancellationToken); HttpConnection? connection = _connection; - if (connection == null || buffer.Length == 0) + if (connection == null) { - // Response body fully consumed or the caller didn't ask for any data + // Response body fully consumed return 0; } @@ -74,7 +74,7 @@ public override async ValueTask ReadAsync(Memory buffer, Cancellation } } - if (bytesRead == 0) + if (bytesRead == 0 && buffer.Length != 0) { // A cancellation request may have caused the EOF. CancellationHelper.ThrowIfCancellationRequested(cancellationToken); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs index 590d888dc69ed0..9b85d7fee2dd37 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Headers.cs @@ -561,5 +561,40 @@ await LoopbackServerFactory.CreateClientAndServerAsync( await server.HandleRequestAsync(headers: headerData); }); } + + [Fact] + public async Task SendAsync_ContentLengthAndTransferEncodingHeaders_IgnoreContentLength() + { + await LoopbackServer.CreateServerAsync(async (server, uri) => + { + HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, uri) + { + Version = UseVersion + }; + using HttpClient client = new HttpClient(); + Task getResponse = client.SendAsync(requestMessage); + await server.AcceptConnectionAsync(async connection => + { + await connection.SendResponseAsync(HttpStatusCode.OK, + new List + { + new HttpHeaderData("Content-Length", "33"), + new HttpHeaderData("Transfer-Encoding", "chunked") + }, "5\r\nhello\r\n5\r\nworld\r\n3\r\nyay\r\n0\r\n\r\n"); + + using (HttpResponseMessage response = await getResponse) + { + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + + Assert.True(response.Headers.Contains("Transfer-Encoding")); + Assert.Equal("chunked", Assert.Single(response.Headers.GetValues("Transfer-Encoding"))); + Assert.Equal(33, response.Content.Headers.ContentLength); + + string content = await response.Content.ReadAsStringAsync(); + Assert.Equal("helloworldyay", content); + } + }); + }); + } } } diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs index fc94b54bba975f..0dc69b0e4ccdc1 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs @@ -177,6 +177,82 @@ public async Task Http2_ZeroLengthResponseBody_Success() } } + [Fact] + public async Task Http2_DataFrameOnlyPadding_Success() + { + using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) + using (HttpClient client = CreateHttpClient()) + { + Task sendTask = client.GetAsync(server.Address, HttpCompletionOption.ResponseHeadersRead); + + Http2LoopbackConnection connection = await server.EstablishConnectionAsync(); + + int streamId = await connection.ReadRequestHeaderAsync(); + + await connection.SendDefaultResponseHeadersAsync(streamId); + + // Send zero-length DATA frame with padding + byte paddingLength = byte.MaxValue; + int dataLength = 1024; + DataFrame frame = new DataFrame(new byte[0], FrameFlags.Padded, paddingLength, streamId); + await connection.WriteFrameAsync(frame); + + HttpResponseMessage response = await sendTask; + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + + using var responseStream = response.Content.ReadAsStream(); + + // The read must pend because we havent received any data yet. + var buffer = new byte[dataLength]; + var readTask = ReadAtLeastAsync(responseStream, buffer, dataLength); + Assert.False(readTask.IsCompleted); + + // Send DATA frame with padding + frame = new DataFrame(new byte[dataLength], FrameFlags.Padded, paddingLength, streamId); + await connection.WriteFrameAsync(frame); + + Assert.Equal(dataLength, await readTask); + + // Send zero-length, end-stream DATA frame with padding + frame = new DataFrame(new byte[0], FrameFlags.Padded | FrameFlags.EndStream, paddingLength, streamId); + await connection.WriteFrameAsync(frame); + + Assert.Equal(0, await responseStream.ReadAsync(buffer)); + } + } + + private static async ValueTask ReadAtLeastAsync(Stream stream, Memory buffer, int minimumBytes, bool throwOnEndOfStream = true, CancellationToken cancellationToken = default) + { + if (minimumBytes < 0) + { + throw new ArgumentOutOfRangeException(nameof(minimumBytes)); + } + if (buffer.Length < minimumBytes) + { + throw new ArgumentOutOfRangeException($"{nameof(buffer)}.{nameof(buffer.Length)}"); + } + + int totalRead = 0; + while (totalRead < minimumBytes) + { + int read = await stream.ReadAsync(buffer.Slice(totalRead), cancellationToken).ConfigureAwait(false); + if (read == 0) + { + if (throwOnEndOfStream) + { + throw new EndOfStreamException(); + } + + return totalRead; + } + + totalRead += read; + } + + return totalRead; + } + + [Theory] [InlineData("Client content", null)] [InlineData("Client content", "Server content")] @@ -204,7 +280,7 @@ await Http2LoopbackServer.CreateClientAndServerAsync(async uri => Http2LoopbackConnection connection = await server.EstablishConnectionAsync(); Assert.IsNotType(connection.Stream); - HttpRequestData requestData = await connection.ReadRequestDataAsync(); + HttpRequestData requestData = await connection.ReadRequestDataAsync(); string requestContent = requestData.Body is null ? (string)null : Encoding.ASCII.GetString(requestData.Body); Assert.Equal(clientContent, requestContent); await connection.SendResponseAsync(HttpStatusCode.OK, content: serverContent); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs index 547f91d3e9143b..06f4dc63bd0272 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs @@ -319,6 +319,119 @@ public async Task ReservedFrameType_Throws() await new[] { clientTask, serverTask }.WhenAllOrAnyFailed(20_000); } + [Fact] + public async Task RequestSentResponseDisposed_ThrowsOnServer() + { + byte[] data = Encoding.UTF8.GetBytes(new string('a', 1024)); + + using Http3LoopbackServer server = CreateHttp3LoopbackServer(); + + Task serverTask = Task.Run(async () => + { + using Http3LoopbackConnection connection = (Http3LoopbackConnection)await server.EstablishGenericConnectionAsync(); + using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync(); + HttpRequestData request = await stream.ReadRequestDataAsync(); + await stream.SendResponseHeadersAsync(); + + Stopwatch sw = Stopwatch.StartNew(); + bool hasFailed = false; + while (sw.Elapsed < TimeSpan.FromSeconds(15)) + { + try + { + await stream.SendResponseBodyAsync(data, isFinal: false); + } + catch (QuicStreamAbortedException) + { + hasFailed = true; + break; + } + } + Assert.True(hasFailed, $"Expected {nameof(QuicStreamAbortedException)}, instead ran successfully for {sw.Elapsed}"); + }); + + Task clientTask = Task.Run(async () => + { + using HttpClient client = CreateHttpClient(); + using HttpRequestMessage request = new() + { + Method = HttpMethod.Get, + RequestUri = server.Address, + Version = HttpVersion30, + VersionPolicy = HttpVersionPolicy.RequestVersionExact + }; + + var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); + var stream = await response.Content.ReadAsStreamAsync(); + byte[] buffer = new byte[512]; + for (int i = 0; i < 5; ++i) + { + var count = await stream.ReadAsync(buffer); + } + + // We haven't finished reading the whole respose, but we're disposing it, which should turn into an exception on the server-side. + response.Dispose(); + await serverTask; + }); + + await new[] { clientTask, serverTask }.WhenAllOrAnyFailed(20_000); + } + + [Fact] + public async Task RequestSendingResponseDisposed_ThrowsOnServer() + { + byte[] data = Encoding.UTF8.GetBytes(new string('a', 1024)); + + using Http3LoopbackServer server = CreateHttp3LoopbackServer(); + + Task serverTask = Task.Run(async () => + { + using Http3LoopbackConnection connection = (Http3LoopbackConnection)await server.EstablishGenericConnectionAsync(); + using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync(); + HttpRequestData request = await stream.ReadRequestDataAsync(false); + await stream.SendResponseHeadersAsync(); + + Stopwatch sw = Stopwatch.StartNew(); + bool hasFailed = false; + while (sw.Elapsed < TimeSpan.FromSeconds(15)) + { + try + { + var (frameType, payload) = await stream.ReadFrameAsync(); + Assert.Equal(Http3LoopbackStream.DataFrame, frameType); + } + catch (QuicStreamAbortedException) + { + hasFailed = true; + break; + } + } + Assert.True(hasFailed, $"Expected {nameof(QuicStreamAbortedException)}, instead ran successfully for {sw.Elapsed}"); + }); + + Task clientTask = Task.Run(async () => + { + using HttpClient client = CreateHttpClient(); + using HttpRequestMessage request = new() + { + Method = HttpMethod.Get, + RequestUri = server.Address, + Version = HttpVersion30, + VersionPolicy = HttpVersionPolicy.RequestVersionExact, + Content = new ByteAtATimeContent(60*4, Task.CompletedTask, new TaskCompletionSource(), 250) + }; + + var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); + var stream = await response.Content.ReadAsStreamAsync(); + + // We haven't finished sending the whole request, but we're disposing the response, which should turn into an exception on the server-side. + response.Dispose(); + await serverTask; + }); + + await new[] { clientTask, serverTask }.WhenAllOrAnyFailed(20_000); + } + [Fact] public async Task ServerCertificateCustomValidationCallback_Succeeds() { @@ -885,7 +998,7 @@ public async Task StatusCodes_ReceiveSuccess(HttpStatusCode statusCode, bool qpa VersionPolicy = HttpVersionPolicy.RequestVersionExact }; HttpResponseMessage response = await client.SendAsync(request).WaitAsync(TimeSpan.FromSeconds(10)); - + Assert.Equal(statusCode, response.StatusCode); await serverTask; @@ -893,6 +1006,97 @@ public async Task StatusCodes_ReceiveSuccess(HttpStatusCode statusCode, bool qpa connection.Dispose(); } + [Theory] + [InlineData(1)] // frame fits into Http3RequestStream buffer + [InlineData(10)] + [InlineData(100)] // frame doesn't fit into Http3RequestStream buffer + [InlineData(1000)] + public async Task EchoServerStreaming_DifferentMessageSize_Success(int messageSize) + { + // Disable failing test in 6.0 branch, see https://github.com/dotnet/runtime/issues/95158 + // The mock tests don't exist in newer releases -> no need to keep an active issue. + if (this.UseQuicImplementationProvider == QuicImplementationProviders.Mock) + { + return; + } + + int iters = 5; + var message = new byte[messageSize]; + var readBuffer = new byte[5 * messageSize]; // bigger than message + var random = new Random(0); + + using Http3LoopbackServer server = CreateHttp3LoopbackServer(); + Http3LoopbackConnection connection = null; + Http3LoopbackStream serverStream = null; + + Task serverTask = Task.Run(async () => + { + connection = (Http3LoopbackConnection)await server.EstablishGenericConnectionAsync(); + serverStream = await connection.AcceptRequestStreamAsync(); + + HttpRequestData requestData = await serverStream.ReadRequestDataAsync(readBody: false).WaitAsync(TimeSpan.FromSeconds(30)); + + await serverStream.SendResponseHeadersAsync().ConfigureAwait(false); + + while (true) + { + (long? frameType, byte[] payload) = await serverStream.ReadFrameAsync(); + if (frameType == null) + { + // EOS + break; + } + // echo back + await serverStream.SendDataFrameAsync(payload).WaitAsync(TimeSpan.FromSeconds(30)); + } + // send FIN + await serverStream.SendResponseBodyAsync(Array.Empty(), isFinal: true); + }); + + StreamingHttpContent requestContent = new StreamingHttpContent(); + + using HttpClient client = CreateHttpClient(); + using HttpRequestMessage request = new() + { + Method = HttpMethod.Post, + RequestUri = server.Address, + Version = HttpVersion30, + VersionPolicy = HttpVersionPolicy.RequestVersionExact, + Content = requestContent + }; + + var responseTask = client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).WaitAsync(TimeSpan.FromSeconds(10)); + + Stream requestStream = await requestContent.GetStreamAsync(); + // Send headers + await requestStream.FlushAsync(); + + using HttpResponseMessage response = await responseTask; + + var responseStream = await response.Content.ReadAsStreamAsync(); + + for (int i = 0; i < iters; ++i) + { + random.NextBytes(message); + await requestStream.WriteAsync(message).AsTask().WaitAsync(TimeSpan.FromSeconds(10)); + await requestStream.FlushAsync(); + + int bytesRead = await responseStream.ReadAsync(readBuffer).AsTask().WaitAsync(TimeSpan.FromSeconds(10)); + Assert.Equal(bytesRead, messageSize); + Assert.Equal(message, readBuffer[..bytesRead]); + } + // Send FIN + requestContent.CompleteStream(); + // Receive FIN + Assert.Equal(0, await responseStream.ReadAsync(readBuffer).AsTask().WaitAsync(TimeSpan.FromSeconds(10))); + + await serverTask.WaitAsync(TimeSpan.FromSeconds(60)); + + serverStream.Dispose(); + Assert.NotNull(connection); + connection.Dispose(); + } + public static TheoryData StatusCodesTestData() { var statuses = Enum.GetValues(typeof(HttpStatusCode)).Cast().Where(s => s >= HttpStatusCode.OK); // exclude informational diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/ImpersonatedAuthTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/ImpersonatedAuthTests.cs new file mode 100644 index 00000000000000..32f44d5e00f705 --- /dev/null +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/ImpersonatedAuthTests.cs @@ -0,0 +1,93 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; +using System.Net.Security; +using System.Net.Test.Common; +using System.Security.Principal; +using System.Threading.Tasks; + +using Xunit; +using Xunit.Abstractions; + +namespace System.Net.Http.Functional.Tests +{ + public class ImpersonatedAuthTests: IClassFixture + { + private readonly WindowsIdentityFixture _fixture; + private readonly ITestOutputHelper _output; + + public ImpersonatedAuthTests(WindowsIdentityFixture windowsIdentityFixture, ITestOutputHelper output) + { + _output = output; + _fixture = windowsIdentityFixture; + + Assert.False(_fixture.TestAccount.AccountTokenHandle.IsInvalid); + Assert.False(string.IsNullOrEmpty(_fixture.TestAccount.AccountName)); + } + + [OuterLoop] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] + [InlineData(true)] + [InlineData(false)] + [PlatformSpecific(TestPlatforms.Windows)] + public async Task DefaultHandler_ImpersonatedUser_Success(bool useNtlm) + { + await LoopbackServer.CreateClientAndServerAsync( + async uri => + { + HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, uri); + requestMessage.Version = new Version(1, 1); + + var handler = new HttpClientHandler(); + handler.UseDefaultCredentials = true; + + using (var client = new HttpClient(handler)) + { + HttpResponseMessage response = await client.SendAsync(requestMessage); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.Equal("foo", await response.Content.ReadAsStringAsync()); + + string initialUser = response.Headers.GetValues(NtAuthTests.UserHeaderName).First(); + + _output.WriteLine($"Starting test as {WindowsIdentity.GetCurrent().Name}"); + + // get token and run another request as different user. + WindowsIdentity.RunImpersonated(_fixture.TestAccount.AccountTokenHandle, () => + { + _output.WriteLine($"Running test as {WindowsIdentity.GetCurrent().Name}"); + Assert.Equal(_fixture.TestAccount.AccountName, WindowsIdentity.GetCurrent().Name); + + requestMessage = new HttpRequestMessage(HttpMethod.Get, uri); + requestMessage.Version = new Version(1, 1); + + HttpResponseMessage response = client.SendAsync(requestMessage).GetAwaiter().GetResult(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.Equal("foo", response.Content.ReadAsStringAsync().GetAwaiter().GetResult()); + + string newUser = response.Headers.GetValues(NtAuthTests.UserHeaderName).First(); + Assert.Equal(_fixture.TestAccount.AccountName, newUser); + }); + } + }, + async server => + { + await server.AcceptConnectionAsync(async connection => + { + Task t = useNtlm ? NtAuthTests.HandleNtlmAuthenticationRequest(connection, closeConnection: false) : NtAuthTests.HandleNegotiateAuthenticationRequest(connection, closeConnection: false); + await t; + _output.WriteLine("Finished first request"); + + // Second request should use new connection as it runs as different user. + // We keep first connection open so HttpClient may be tempted top use it. + await server.AcceptConnectionAsync(async connection => + { + Task t = useNtlm ? NtAuthTests.HandleNtlmAuthenticationRequest(connection, closeConnection: false) : NtAuthTests.HandleNegotiateAuthenticationRequest(connection, closeConnection: false); + await t; + }).ConfigureAwait(false); + }).ConfigureAwait(false); + }); + + } + } +} diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.Windows.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.Windows.cs new file mode 100644 index 00000000000000..8bb4df5747efcd --- /dev/null +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.Windows.cs @@ -0,0 +1,153 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; +using System.Net.Security; +using System.Net.Test.Common; +using System.Security.Principal; +using System.Threading.Tasks; + +using Xunit; +using Xunit.Abstractions; + +namespace System.Net.Http.Functional.Tests +{ + public partial class NtAuthTests : IClassFixture + { + internal const string NtlmAuthHeader = "WWW-Authenticate: NTLM"; + internal const string NegotiateAuthHeader = "WWW-Authenticate: Negotiate"; + internal const string UserHeaderName = "X-User"; + + internal static Task HandleNtlmAuthenticationRequest(LoopbackServer.Connection connection, bool closeConnection = true) + { + return HandleAuthenticationRequest(connection, useNtlm: true, useNegotiate: false, closeConnection); + } + + internal static Task HandleNegotiateAuthenticationRequest(LoopbackServer.Connection connection, bool closeConnection = true) + { + return HandleAuthenticationRequest(connection, useNtlm: false, useNegotiate: true, closeConnection); + } + + internal static async Task HandleAuthenticationRequest(LoopbackServer.Connection connection, bool useNtlm, bool useNegotiate, bool closeConnection) + { + HttpRequestData request = await connection.ReadRequestDataAsync(); + NTAuthentication authContext = null; + string authHeader = null; + + foreach (HttpHeaderData header in request.Headers) + { + if (header.Name == "Authorization") + { + authHeader = header.Value; + break; + } + } + + if (string.IsNullOrEmpty(authHeader)) + { + // This is initial request, we reject with showing supported mechanisms. + authHeader = string.Empty; + if (useNtlm) + { + authHeader += NtlmAuthHeader + "\r\n"; + } + + if (useNegotiate) + { + authHeader += NegotiateAuthHeader + "\r\n"; + } + + await connection.SendResponseAsync(HttpStatusCode.Unauthorized, authHeader).ConfigureAwait(false); + connection.CompleteRequestProcessing(); + + // Read next requests and fall-back to loop bellow to process it. + request = await connection.ReadRequestDataAsync(); + } + + SecurityStatusPal statusCode; + do + { + foreach (HttpHeaderData header in request.Headers) + { + if (header.Name == "Authorization") + { + authHeader = header.Value; + break; + } + } + + Assert.NotNull(authHeader); + var tokens = authHeader.Split(' ', 2, StringSplitOptions.TrimEntries); + // Should be type and base64 encoded blob + Assert.Equal(2, tokens.Length); + + authContext ??= new NTAuthentication(isServer: true, tokens[0], CredentialCache.DefaultNetworkCredentials, null, ContextFlagsPal.Connection, null); + + byte[]? outBlob = authContext.GetOutgoingBlob(Convert.FromBase64String(tokens[1]), throwOnError: false, out statusCode); + + if (outBlob != null && statusCode.ErrorCode == SecurityStatusPalErrorCode.ContinueNeeded) + { + authHeader = $"WWW-Authenticate: {tokens[0]} {Convert.ToBase64String(outBlob)}\r\n"; + await connection.SendResponseAsync(HttpStatusCode.Unauthorized, authHeader); + connection.CompleteRequestProcessing(); + + request = await connection.ReadRequestDataAsync(); + } + } + while (statusCode.ErrorCode == SecurityStatusPalErrorCode.ContinueNeeded); + + if (statusCode.ErrorCode == SecurityStatusPalErrorCode.OK) + { + // If authentication succeeded ask Windows about the identity and send it back as custom header. + SecurityContextTokenHandle? userContext = null; + using SafeDeleteContext securityContext = authContext.GetContext(out SecurityStatusPal statusCodeNew)!; + SSPIWrapper.QuerySecurityContextToken(GlobalSSPI.SSPIAuth, securityContext, out userContext); + using WindowsIdentity identity = new WindowsIdentity(userContext.DangerousGetHandle(), authContext.ProtocolName); + + authHeader = $"{UserHeaderName}: {identity.Name}\r\n"; + if (closeConnection) + { + authHeader += "Connection: close\r\n"; + } + + await connection.SendResponseAsync(HttpStatusCode.OK, authHeader, "foo"); + userContext.Dispose(); + } + else + { + await connection.SendResponseAsync(HttpStatusCode.Forbidden, "Connection: close\r\n", "boo"); + } + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsWindows), nameof(PlatformDetection.IsNotWindowsNanoServer))] + [InlineData(true)] + [InlineData(false)] + [PlatformSpecific(TestPlatforms.Windows)] + public async Task DefaultHandler_DefaultCredentials_Success(bool useNtlm) + { + await LoopbackServer.CreateClientAndServerAsync( + async uri => + { + HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, uri); + requestMessage.Version = new Version(1, 1); + + var handler = new HttpClientHandler() { UseDefaultCredentials = true }; + using (var client = new HttpClient(handler)) + { + HttpResponseMessage response = await client.SendAsync(requestMessage); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + _output.WriteLine($"Authenticated as {response.Headers.GetValues(NtAuthTests.UserHeaderName).First()}"); + Assert.Equal("foo", await response.Content.ReadAsStringAsync()); + } + }, + async server => + { + await server.AcceptConnectionAsync(async connection => + { + Task t = useNtlm ? HandleNtlmAuthenticationRequest(connection) : HandleNegotiateAuthenticationRequest(connection); + await t; + }).ConfigureAwait(false); + }); + } + } +} diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs index 096c5af0b42651..5c5954fb3491d2 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs @@ -104,7 +104,7 @@ public void Dispose() } } - public class NtAuthTests : IClassFixture + public partial class NtAuthTests : IClassFixture { private readonly NtAuthServers _servers; private readonly ITestOutputHelper _output; diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs index e232ee94419897..5cade37f9118c1 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs @@ -11,6 +11,7 @@ namespace System.Net.Http.Functional.Tests { + [ConditionalClass(typeof(SocketsHttpHandler), nameof(SocketsHttpHandler.IsSupported))] public abstract class SocketsHttpHandler_Cancellation_Test : HttpClientHandler_Cancellation_Test { protected SocketsHttpHandler_Cancellation_Test(ITestOutputHelper output) : base(output) { } @@ -104,6 +105,70 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri => options: new GenericLoopbackOptions() { UseSsl = false }); } + [Fact] + public async Task RequestsCanceled_NoConnectionAttemptForCanceledRequests() + { + if (UseVersion == HttpVersion.Version30) + { + // HTTP3 does not support ConnectCallback + return; + } + + bool seenRequest1 = false; + bool seenRequest2 = false; + bool seenRequest3 = false; + + var uri = new Uri("https://example.com"); + HttpRequestMessage request1 = CreateRequest(HttpMethod.Get, uri, UseVersion, exactVersion: true); + HttpRequestMessage request2 = CreateRequest(HttpMethod.Get, uri, UseVersion, exactVersion: true); + HttpRequestMessage request3 = CreateRequest(HttpMethod.Get, uri, UseVersion, exactVersion: true); + + TaskCompletionSource connectCallbackEntered = new(TaskCreationOptions.RunContinuationsAsynchronously); + TaskCompletionSource connectCallbackGate = new(TaskCreationOptions.RunContinuationsAsynchronously); + + using HttpClientHandler handler = CreateHttpClientHandler(); + handler.MaxConnectionsPerServer = 1; + GetUnderlyingSocketsHttpHandler(handler).ConnectCallback = async (context, cancellation) => + { + if (context.InitialRequestMessage == request1) seenRequest1 = true; + if (context.InitialRequestMessage == request2) seenRequest2 = true; + if (context.InitialRequestMessage == request3) seenRequest3 = true; + + connectCallbackEntered.TrySetResult(); + + await connectCallbackGate.Task.WaitAsync(TestHelper.PassingTestTimeout); + + throw new Exception("No connection"); + }; + using HttpClient client = CreateHttpClient(handler); + + Task request1Task = client.SendAsync(TestAsync, request1); + await connectCallbackEntered.Task.WaitAsync(TestHelper.PassingTestTimeout); + Assert.True(seenRequest1); + + using var request2Cts = new CancellationTokenSource(); + Task request2Task = client.SendAsync(TestAsync, request2, request2Cts.Token); + Assert.False(seenRequest2); + + Task request3Task = client.SendAsync(TestAsync, request3); + Assert.False(seenRequest2); + Assert.False(seenRequest3); + + request2Cts.Cancel(); + + await Assert.ThrowsAsync(() => request2Task).WaitAsync(TestHelper.PassingTestTimeout); + Assert.False(seenRequest2); + Assert.False(seenRequest3); + + connectCallbackGate.SetResult(); + + await Assert.ThrowsAsync(() => request1Task).WaitAsync(TestHelper.PassingTestTimeout); + await Assert.ThrowsAsync(() => request3Task).WaitAsync(TestHelper.PassingTestTimeout); + + Assert.False(seenRequest2); + Assert.True(seenRequest3); + } + [OuterLoop("Incurs significant delay")] [Fact] public async Task Expect100Continue_WaitsExpectedPeriodOfTimeBeforeSendingContent() diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http1KeepAlive.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http1KeepAlive.cs new file mode 100644 index 00000000000000..db03b063d17f33 --- /dev/null +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http1KeepAlive.cs @@ -0,0 +1,124 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Net.Test.Common; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace System.Net.Http.Functional.Tests +{ + [ConditionalClass(typeof(SocketsHttpHandler), nameof(SocketsHttpHandler.IsSupported))] + public sealed class SocketsHttpHandler_Http1KeepAlive_Test : HttpClientHandlerTestBase + { + public SocketsHttpHandler_Http1KeepAlive_Test(ITestOutputHelper output) : base(output) { } + + [Fact] + public async Task Http10Response_ConnectionIsReusedFor10And11() + { + await LoopbackServer.CreateClientAndServerAsync(async uri => + { + using HttpClient client = CreateHttpClient(); + + await client.SendAsync(CreateRequest(HttpMethod.Get, uri, HttpVersion.Version10, exactVersion: true)); + await client.SendAsync(CreateRequest(HttpMethod.Get, uri, HttpVersion.Version11, exactVersion: true)); + await client.SendAsync(CreateRequest(HttpMethod.Get, uri, HttpVersion.Version10, exactVersion: true)); + }, + server => server.AcceptConnectionAsync(async connection => + { + HttpRequestData request = await connection.ReadRequestDataAsync(); + Assert.Equal(0, request.Version.Minor); + await connection.WriteStringAsync("HTTP/1.0 200 OK\r\nContent-Length: 1\r\n\r\n1"); + connection.CompleteRequestProcessing(); + + request = await connection.ReadRequestDataAsync(); + Assert.Equal(1, request.Version.Minor); + await connection.WriteStringAsync("HTTP/1.0 200 OK\r\nContent-Length: 1\r\n\r\n2"); + connection.CompleteRequestProcessing(); + + request = await connection.ReadRequestDataAsync(); + Assert.Equal(0, request.Version.Minor); + await connection.WriteStringAsync("HTTP/1.0 200 OK\r\nContent-Length: 1\r\n\r\n3"); + })); + } + + [OuterLoop("Uses Task.Delay")] + [Fact] + public async Task Http1ResponseWithKeepAliveTimeout_ConnectionRecycledAfterTimeout() + { + await LoopbackServer.CreateClientAndServerAsync(async uri => + { + using HttpClient client = CreateHttpClient(); + + await client.GetAsync(uri); + + await Task.Delay(2000); + await client.GetAsync(uri); + }, + async server => + { + await server.AcceptConnectionAsync(async connection => + { + await connection.ReadRequestDataAsync(); + await connection.WriteStringAsync("HTTP/1.1 200 OK\r\nKeep-Alive: timeout=2\r\nContent-Length: 1\r\n\r\n1"); + connection.CompleteRequestProcessing(); + + await Assert.ThrowsAnyAsync(() => connection.ReadRequestDataAsync()); + }); + + await server.AcceptConnectionSendResponseAndCloseAsync(); + }); + } + + [Theory] + [InlineData("timeout=1000", true)] + [InlineData("timeout=30", true)] + [InlineData("timeout=0", false)] + [InlineData("timeout=1", false)] + [InlineData("foo, bar=baz, timeout=30", true)] + [InlineData("foo, bar=baz, timeout=0", false)] + [InlineData("timeout=-1", true)] + [InlineData("timeout=abc", true)] + [InlineData("max=1", true)] + [InlineData("max=0", false)] + [InlineData("max=-1", true)] + [InlineData("max=abc", true)] + [InlineData("timeout=30, max=1", true)] + [InlineData("timeout=30, max=0", false)] + [InlineData("timeout=0, max=1", false)] + [InlineData("timeout=0, max=0", false)] + public async Task Http1ResponseWithKeepAlive_ConnectionNotReusedForShortTimeoutOrMax0(string keepAlive, bool shouldReuseConnection) + { + await LoopbackServer.CreateClientAndServerAsync(async uri => + { + using HttpClient client = CreateHttpClient(); + + await client.GetAsync(uri); + await client.GetAsync(uri); + }, + async server => + { + await server.AcceptConnectionAsync(async connection => + { + await connection.ReadRequestDataAsync(); + await connection.WriteStringAsync($"HTTP/1.{Random.Shared.Next(10)} 200 OK\r\nKeep-Alive: {keepAlive}\r\nContent-Length: 1\r\n\r\n1"); + connection.CompleteRequestProcessing(); + + if (shouldReuseConnection) + { + await connection.HandleRequestAsync(); + } + else + { + await Assert.ThrowsAnyAsync(() => connection.ReadRequestDataAsync()); + } + }); + + if (!shouldReuseConnection) + { + await server.AcceptConnectionSendResponseAndCloseAsync(); + } + }); + } + } +} diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs index 84ea142f933af6..f28491882ac3db 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs @@ -51,8 +51,10 @@ public async Task InitialHttp2StreamWindowSize_SentInSettingsFrame() Assert.Equal(WindowSize, (int)entry.Value); } - [Fact] - public Task InvalidRttPingResponse_RequestShouldFail() + [Theory] + [InlineData(0)] // Invalid PING payload + [InlineData(1)] // Unexpected PING response + public Task BadRttPingResponse_RequestShouldFail(int mode) { return Http2LoopbackServer.CreateClientAndServerAsync(async uri => { @@ -67,13 +69,24 @@ public Task InvalidRttPingResponse_RequestShouldFail() (int streamId, _) = await connection.ReadAndParseRequestHeaderAsync(); await connection.SendDefaultResponseHeadersAsync(streamId); PingFrame pingFrame = await connection.ReadPingAsync(); // expect an RTT PING - await connection.SendPingAckAsync(-6666); // send an invalid PING response + + if (mode == 0) + { + // Invalid PING payload + await connection.SendPingAckAsync(-6666); // send an invalid PING response + } + else + { + // Unexpected PING response + await connection.SendPingAckAsync(pingFrame.Data); // send an valid PING response + await connection.SendPingAckAsync(pingFrame.Data - 1); // send a second unexpected PING response + } + await connection.SendResponseDataAsync(streamId, new byte[] { 1, 2, 3 }, true); // otherwise fine response }, NoAutoPingResponseHttp2Options); } - [OuterLoop("Runs long")] [Fact] public async Task HighBandwidthDelayProduct_ClientStreamReceiveWindowWindowScalesUp() diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index 14f444b1935a60..8c1c53117038d3 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -803,6 +803,60 @@ await TestHelper.WhenAllCompletedOrAnyFailed( } }); } + + [Theory] + [InlineData(1024, 64, false)] + [InlineData(1024, 1024 - 2, false)] // we need at least 2 spare bytes for the next CRLF + [InlineData(1024, 1024 - 1, true)] + [InlineData(1024, 1024, true)] + [InlineData(1024, 1024 + 1, true)] + [InlineData(1024 * 1024, 1024 * 1024 - 2, false)] + [InlineData(1024 * 1024, 1024 * 1024 - 1, true)] + [InlineData(1024 * 1024, 1024 * 1024, true)] + public async Task GetAsync_MaxResponseHeadersLength_EnforcedOnTrailingHeaders(int maxResponseHeadersLength, int trailersLength, bool shouldThrow) + { + await LoopbackServer.CreateClientAndServerAsync( + async uri => + { + using HttpClientHandler handler = CreateHttpClientHandler(); + using HttpClient client = CreateHttpClient(handler); + + handler.MaxResponseHeadersLength = maxResponseHeadersLength / 1024; + + if (shouldThrow) + { + await Assert.ThrowsAsync(() => client.GetAsync(uri)); + } + else + { + (await client.GetAsync(uri)).Dispose(); + } + }, + async server => + { + try + { + const string TrailerName1 = "My-Trailer-1"; + const string TrailerName2 = "My-Trailer-2"; + + int trailerOneLength = trailersLength / 2; + int trailerTwoLength = trailersLength - trailerOneLength; + + await server.AcceptConnectionSendCustomResponseAndCloseAsync( + "HTTP/1.1 200 OK\r\n" + + "Connection: close\r\n" + + "Transfer-Encoding: chunked\r\n" + + "\r\n" + + "4\r\n" + + "data\r\n" + + "0\r\n" + + $"{TrailerName1}: {new string('a', trailerOneLength - TrailerName1.Length - 4)}\r\n" + + $"{TrailerName2}: {new string('b', trailerTwoLength - TrailerName2.Length - 4)}\r\n" + + "\r\n"); + } + catch { } + }); + } } // TODO: make generic to support HTTP/2 and HTTP/3. @@ -837,8 +891,10 @@ public async Task Http2GetAsync_NoTrailingHeaders_EmptyCollection() } } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted() + [InlineData(false)] + [InlineData(true)] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] + public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted(bool responseHasContentLength) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) using (HttpClient client = CreateHttpClient()) @@ -850,7 +906,14 @@ public async Task Http2GetAsync_MissingTrailer_TrailingHeadersAccepted() int streamId = await connection.ReadRequestHeaderAsync(); // Response header. - await connection.SendDefaultResponseHeadersAsync(streamId); + if (responseHasContentLength) + { + await connection.SendResponseHeadersAsync(streamId, endStream: false, headers: new[] { new HttpHeaderData("Content-Length", DataBytes.Length.ToString()) }); + } + else + { + await connection.SendDefaultResponseHeadersAsync(streamId); + } // Response data, missing Trailers. await connection.WriteFrameAsync(MakeDataFrame(streamId, DataBytes)); @@ -888,8 +951,10 @@ public async Task Http2GetAsync_TrailerHeaders_TrailingPseudoHeadersThrow() } } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] - public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Available() + [InlineData(false)] + [InlineData(true)] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.SupportsAlpn))] + public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Available(bool responseHasContentLength) { using (Http2LoopbackServer server = Http2LoopbackServer.CreateServer()) using (HttpClient client = CreateHttpClient()) @@ -901,7 +966,14 @@ public async Task Http2GetAsyncResponseHeadersReadOption_TrailingHeaders_Availab int streamId = await connection.ReadRequestHeaderAsync(); // Response header. - await connection.SendDefaultResponseHeadersAsync(streamId); + if (responseHasContentLength) + { + await connection.SendResponseHeadersAsync(streamId, endStream: false, headers: new[] { new HttpHeaderData("Content-Length", DataBytes.Length.ToString()) }); + } + else + { + await connection.SendDefaultResponseHeadersAsync(streamId); + } // Response data, missing Trailers. await connection.WriteFrameAsync(MakeDataFrame(streamId, DataBytes)); @@ -1026,7 +1098,7 @@ public sealed class SocketsHttpHandlerTest_Cookies_Http11 : HttpClientHandlerTes public SocketsHttpHandlerTest_Cookies_Http11(ITestOutputHelper output) : base(output) { } } - [SkipOnPlatform(TestPlatforms.Browser, "ConnectTimeout is not supported on Browser")] + [ConditionalClass(typeof(SocketsHttpHandler), nameof(SocketsHttpHandler.IsSupported))] public sealed class SocketsHttpHandler_HttpClientHandler_Http11_Cancellation_Test : SocketsHttpHandler_Cancellation_Test { public SocketsHttpHandler_HttpClientHandler_Http11_Cancellation_Test(ITestOutputHelper output) : base(output) { } @@ -1133,6 +1205,107 @@ public sealed class SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLengt public SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLength_Test(ITestOutputHelper output) : base(output) { } } + [ConditionalClass(typeof(SocketsHttpHandler), nameof(SocketsHttpHandler.IsSupported))] + public sealed class SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLength_Http2 : HttpClientHandlerTestBase + { + public SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLength_Http2(ITestOutputHelper output) : base(output) { } + protected override Version UseVersion => HttpVersion.Version20; + + [Fact] + public async Task ServerAdvertisedMaxHeaderListSize_IsHonoredByClient() + { + const int Limit = 10_000; + + using HttpClientHandler handler = CreateHttpClientHandler(); + using HttpClient client = CreateHttpClient(handler); + + // We want to test that the client remembered the setting it received from the previous connection. + // To do this, we trick the client into using the same HttpConnectionPool for both server connections. + Uri lastServerUri = null; + + GetUnderlyingSocketsHttpHandler(handler).ConnectCallback = async (context, ct) => + { + Assert.Equal("foo", context.DnsEndPoint.Host); + + Socket socket = new Socket(SocketType.Stream, ProtocolType.Tcp) { NoDelay = true }; + try + { + await socket.ConnectAsync(lastServerUri.IdnHost, lastServerUri.Port); + return new NetworkStream(socket, ownsSocket: true); + } + catch + { + socket.Dispose(); + throw; + } + }; + + TaskCompletionSource waitingForLastRequest = new(TaskCreationOptions.RunContinuationsAsynchronously); + + await LoopbackServerFactory.CreateClientAndServerAsync(async uri => + { + lastServerUri = uri; + uri = new UriBuilder(uri) { Host = "foo", Port = 42 }.Uri; + + // Send a dummy request to ensure the SETTINGS frame has been received. + Assert.Equal("Hello world", await client.GetStringAsync(uri)); + + HttpRequestMessage request = CreateRequest(HttpMethod.Get, uri, UseVersion, exactVersion: true); + request.Headers.Add("Foo", new string('a', Limit)); + + Exception ex = await Assert.ThrowsAsync(() => client.SendAsync(request)); + Assert.Contains(Limit.ToString(), ex.Message); + + request = CreateRequest(HttpMethod.Get, uri, UseVersion, exactVersion: true); + for (int i = 0; i < Limit / 40; i++) + { + request.Headers.Add($"Foo-{i}", ""); + } + + ex = await Assert.ThrowsAsync(() => client.SendAsync(request)); + Assert.Contains(Limit.ToString(), ex.Message); + + await waitingForLastRequest.Task.WaitAsync(TimeSpan.FromSeconds(10)); + + // Ensure that the connection is still usable for requests that don't hit the limit. + Assert.Equal("Hello world", await client.GetStringAsync(uri)); + }, + async server => + { + var setting = new SettingsEntry { SettingId = SettingId.MaxHeaderListSize, Value = Limit }; + + using GenericLoopbackConnection connection = await ((Http2LoopbackServer)server).EstablishConnectionAsync(setting); + + await connection.ReadRequestDataAsync(); + await connection.SendResponseAsync(content: "Hello world"); + + waitingForLastRequest.SetResult(); + + // HandleRequestAsync will close the connection + await connection.HandleRequestAsync(content: "Hello world"); + }); + + await LoopbackServerFactory.CreateClientAndServerAsync(async uri => + { + lastServerUri = uri; + uri = new UriBuilder(uri) { Host = "foo", Port = 42 }.Uri; + + HttpRequestMessage request = CreateRequest(HttpMethod.Get, uri, UseVersion, exactVersion: true); + request.Headers.Add("Foo", new string('a', Limit)); + + Exception ex = await Assert.ThrowsAsync(() => client.SendAsync(request)); + Assert.Contains(Limit.ToString(), ex.Message); + + // Ensure that the connection is still usable for requests that don't hit the limit. + Assert.Equal("Hello world", await client.GetStringAsync(uri)); + }, + async server => + { + await server.HandleRequestAsync(content: "Hello world"); + }); + } + } + [SkipOnPlatform(TestPlatforms.Browser, "Socket is not supported on Browser")] public sealed class SocketsHttpHandler_HttpClientHandler_Authentication_Test : HttpClientHandler_Authentication_Test { @@ -1257,6 +1430,39 @@ await server.AcceptConnectionAsync(async (LoopbackServer.Connection connection) } }); } + + [Fact] + public async Task UpgradeConnection_ResponseStreamSupportsZeroByteReads() + { + var zeroByteReadIssued = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + await LoopbackServer.CreateClientAndServerAsync(async uri => + { + using HttpClient client = CreateHttpClient(); + + using HttpResponseMessage response = await client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead); + using Stream responseStream = await response.Content.ReadAsStreamAsync(); + + ValueTask zeroByteReadTask = responseStream.ReadAsync(Memory.Empty); + + Assert.False(zeroByteReadTask.IsCompleted); + await Task.Delay(10); + Assert.False(zeroByteReadTask.IsCompleted); + + zeroByteReadIssued.SetResult(); + + Assert.Equal(0, await zeroByteReadTask); + Assert.Equal(1, await responseStream.ReadAsync(new byte[2])); + }, + server => server.AcceptConnectionAsync(async connection => + { + await connection.ReadRequestHeaderAndSendCustomResponseAsync($"HTTP/1.1 101 Switching Protocols\r\nDate: {DateTimeOffset.UtcNow:R}\r\n\r\n"); + + await zeroByteReadIssued.Task; + + await connection.Stream.WriteAsync(new byte[] { (byte)'A' }); + })); + } } [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj index 5c177598057214..a874b82b65daf8 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj @@ -1,4 +1,4 @@ - + ../../src/Resources/Strings.resx $(DefineConstants);TargetsWindows @@ -33,8 +33,8 @@ - + + @@ -206,6 +207,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs index 9cbba2ad0382fb..069c9c0e72a677 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs @@ -409,14 +409,25 @@ private static void ValidateStartFailedStopEvents(ConcurrentQueue<(EventWrittenE Assert.Equal(count, starts.Length); (EventWrittenEventArgs Event, Guid ActivityId)[] stops = events.Where(e => e.Event.EventName == "RequestStop").ToArray(); - Assert.All(stops, stopEvent => Assert.Empty(stopEvent.Event.Payload)); + foreach (EventWrittenEventArgs stopEvent in stops.Select(e => e.Event)) + { + object payload = Assert.Single(stopEvent.Payload); + int statusCode = Assert.IsType(payload); + Assert.Equal(shouldHaveFailures ? -1 : 200, statusCode); + } ValidateSameActivityIds(starts, stops); (EventWrittenEventArgs Event, Guid ActivityId)[] failures = events.Where(e => e.Event.EventName == "RequestFailed").ToArray(); - Assert.All(failures, failedEvent => Assert.Empty(failedEvent.Event.Payload)); if (shouldHaveFailures) { + foreach (EventWrittenEventArgs failedEvent in failures.Select(e => e.Event)) + { + object payload = Assert.Single(failedEvent.Payload); + string exceptionMessage = Assert.IsType(payload); + Assert.Equal(new OperationCanceledException().Message, exceptionMessage); + } + ValidateSameActivityIds(starts, failures); } else @@ -467,8 +478,8 @@ private static void ValidateRequestResponseStartStopEvents(ConcurrentQueue<(Even foreach (EventWrittenEventArgs requestContentStop in requestContentStops.Select(e => e.Event)) { object payload = Assert.Single(requestContentStop.Payload); - Assert.True(payload is long); - Assert.Equal(requestContentLength.Value, (long)payload); + long contentLength = Assert.IsType(payload); + Assert.Equal(requestContentLength.Value, contentLength); } ValidateSameActivityIds(requestContentStarts, requestContentStops); @@ -479,7 +490,12 @@ private static void ValidateRequestResponseStartStopEvents(ConcurrentQueue<(Even (EventWrittenEventArgs Event, Guid ActivityId)[] responseHeadersStops = events.Where(e => e.Event.EventName == "ResponseHeadersStop").ToArray(); Assert.Equal(count, responseHeadersStops.Length); - Assert.All(responseHeadersStops, r => Assert.Empty(r.Event.Payload)); + foreach (EventWrittenEventArgs responseHeadersStop in responseHeadersStops.Select(e => e.Event)) + { + object payload = Assert.Single(responseHeadersStop.Payload); + int statusCode = Assert.IsType(payload); + Assert.Equal(200, statusCode); + } ValidateSameActivityIds(responseHeadersStarts, responseHeadersStops); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs index f856652adb71fb..0f8a249a7665d7 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/ClientOperations.cs @@ -508,12 +508,6 @@ public static (string name, Func operation)[] Operations = private static void ValidateStatusCode(HttpResponseMessage m, HttpStatusCode expectedStatus = HttpStatusCode.OK) { - // [ActiveIssue("https://github.com/dotnet/runtime/issues/55261")] - if (m.StatusCode == HttpStatusCode.InternalServerError) - { - throw new Exception("IGNORE"); - } - if (m.StatusCode != expectedStatus) { throw new Exception($"Expected status code {expectedStatus}, got {m.StatusCode}"); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile index 28c10ddfa8a086..02378956718778 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile @@ -10,9 +10,9 @@ COPY . . # Pulling the msquic Debian package from msquic-ci public pipeline and from a hardcoded build. # Note that this is a temporary solution until we have properly published Linux packages. # Also note that in order to update to a newer msquic build, you have update this link. -ARG MSQUIC_PACKAGE=libmsquic_1.6.0_amd64.deb -ARG PACKAGES_DIR=LinuxPackages -RUN wget 'https://dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_apis/build/builds/1266893/artifacts?artifactName=LinuxPackages&api-version=6.0&%24format=zip' -O "$PACKAGES_DIR".zip +ARG MSQUIC_PACKAGE=libmsquic_1.9.0_amd64.deb +ARG PACKAGES_DIR=UnsignedUnixPackages +RUN wget 'https://dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_apis/build/builds/1426627/artifacts?artifactName=UnsignedUnixPackages&api-version=6.0&%24format=zip' -O "$PACKAGES_DIR".zip RUN apt-get update RUN apt-get install unzip RUN unzip $PACKAGES_DIR.zip diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj index 80b4aa21b108ba..770f3370a79ad4 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -5,6 +5,7 @@ net6.0 preview enable + True @@ -20,4 +21,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs index be0dd1c42b0636..fe0a13360fd410 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs @@ -209,11 +209,6 @@ async Task RunWorker(int taskNum) { _aggregator.RecordCancellation(opIndex, stopwatch.Elapsed); } - catch (Exception e) when (e.Message == "IGNORE") - { - // [ActiveIssue("https://github.com/dotnet/runtime/issues/55261")] - // See ClientOperations.ValidateStatusCode - } catch (Exception e) { _aggregator.RecordFailure(e, opIndex, stopwatch.Elapsed, requestContext.IsCancellationRequested, taskNum: taskNum, iteration: i); diff --git a/src/libraries/System.Net.Http/tests/UnitTests/Fakes/HttpTelemetry.cs b/src/libraries/System.Net.Http/tests/UnitTests/Fakes/HttpTelemetry.cs index 5667687e632e2f..26ac057e31bd8d 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/Fakes/HttpTelemetry.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/Fakes/HttpTelemetry.cs @@ -11,9 +11,9 @@ public class HttpTelemetry public void RequestStart(HttpRequestMessage request) { } - public void RequestStop() { } + public void RequestStop(HttpResponseMessage response) { } - public void RequestFailed() { } + public void RequestFailed(Exception exception) { } public void ResponseContentStart() { } diff --git a/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs index f56f85ac5bd0d4..139422163a95bc 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs @@ -2112,6 +2112,44 @@ public void AddHeaders_SourceHasInvalidHeaderValues_InvalidHeadersRemovedFromSou Assert.False(destination.Contains("custom"), "destination contains 'custom' header."); } + [Fact] + public void AddHeaders_ResponseHeaderToRequestHeaders_Success() + { + const string Name = "WWW-Authenticate"; + const string Value = "Basic realm=\"Access to the staging site\", charset=\"UTF-8\""; + + var request = new HttpRequestMessage(); + Assert.True(request.Headers.TryAddWithoutValidation(Name, Value)); + + Assert.True(request.Headers.Contains(Name)); + Assert.True(request.Headers.NonValidated.Contains(Name)); + + Assert.True(request.Headers.TryGetValues(Name, out IEnumerable values)); + Assert.Equal(Value, values.Single()); + + Assert.True(request.Headers.NonValidated.TryGetValues(Name, out HeaderStringValues nvValues)); + Assert.Equal(Value, nvValues.Single()); + } + + [Fact] + public void AddHeaders_RequestHeaderToResponseHeaders_Success() + { + const string Name = "Referer"; + const string Value = "https://dot.net"; + + var response = new HttpResponseMessage(); + Assert.True(response.Headers.TryAddWithoutValidation(Name, Value)); + + Assert.True(response.Headers.Contains(Name)); + Assert.True(response.Headers.NonValidated.Contains(Name)); + + Assert.True(response.Headers.TryGetValues(Name, out IEnumerable values)); + Assert.Equal(Value, values.Single()); + + Assert.True(response.Headers.NonValidated.TryGetValues(Name, out HeaderStringValues nvValues)); + Assert.Equal(Value, nvValues.Single()); + } + [Fact] public void HeaderStringValues_Default_Empty() { diff --git a/src/libraries/System.Net.Http/tests/UnitTests/Headers/KnownHeadersTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/Headers/KnownHeadersTest.cs index 78fada7218b4ac..e5ba053f756e0b 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/Headers/KnownHeadersTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/Headers/KnownHeadersTest.cs @@ -3,6 +3,8 @@ using System.Linq; using System.Net.Http.Headers; +using System.Text; +using Microsoft.DotNet.RemoteExecutor; using Xunit; namespace System.Net.Http.Tests @@ -245,5 +247,28 @@ public void GetKnownHeaderValue_Unknown_NotFound(string name, string value) Assert.Equal(value, v2); Assert.NotSame(v1, v2); } + + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [InlineData("Access-Control-Allow-Credentials", "true")] + [InlineData("Cache-Control", "no-cache")] + [InlineData("Content-Type", "text/plain")] + public void GetKnownHeaderValue_RespectsAppContextIgnoreCaseSwitch(string name, string value) + { + RemoteExecutor.Invoke(static (name, value) => + { + AppContext.SetSwitch("System.Net.Http.IgnoreCaseForKnownHeaderValues", false); + + KnownHeader knownHeader = KnownHeaders.TryGetKnownHeader(name); + Assert.NotNull(knownHeader); + + string sameCase = knownHeader.Descriptor.GetHeaderValue(Encoding.ASCII.GetBytes(value), valueEncoding: null); + Assert.NotNull(sameCase); + Assert.Equal(value, sameCase); + + string differentCase = knownHeader.Descriptor.GetHeaderValue(Encoding.ASCII.GetBytes(value.ToUpperInvariant()), valueEncoding: null); + Assert.NotNull(differentCase); + Assert.NotEqual(value, differentCase); + }, name, value).Dispose(); + } } } diff --git a/src/libraries/System.Net.Http/tests/UnitTests/Headers/ObjectCollectionTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/Headers/ObjectCollectionTest.cs index d8ffd2c4ee1c75..3a8f69d9a44386 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/Headers/ObjectCollectionTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/Headers/ObjectCollectionTest.cs @@ -36,9 +36,74 @@ public void Ctor_ExecuteBothOverloads_MatchExpectation() c.Add("value1"); Assert.Throws(() => { c.Add(null); }); + } + + [Fact] + public void ContainsAndRemove_UsesEqualitySemantics() + { + ObjectCollection c = new ObjectCollection(); + string val1 = "value1"; + string val1DifferentReference = "value" + 1; + Assert.NotSame(val1, val1DifferentReference); + Assert.Equal(val1, val1DifferentReference); + + string val2 = "value2"; + string val2DifferentReference = "value" + 2; + Assert.NotSame(val2, val2DifferentReference); + Assert.Equal(val2, val2DifferentReference); + + string val3 = "value3"; + + // Start empty + Assert.Equal(0, c.Count); + Assert.False(c.Contains(val1)); + + // Single item + c.Add(val1); Assert.Equal(1, c.Count); - Assert.True(c.Contains("value1")); + Assert.True(c.Contains(val1)); + Assert.True(c.Contains(val1DifferentReference)); + Assert.False(c.Contains(val2)); + + // Single item removal + Assert.True(c.Remove(val1)); + Assert.Equal(0, c.Count); + Assert.False(c.Contains(val1)); + + // Multi-value + c.Add(val1); + c.Add(val2); + Assert.Equal(2, c.Count); + Assert.True(c.Contains(val1)); + Assert.True(c.Contains(val1DifferentReference)); + Assert.True(c.Contains(val2)); + Assert.True(c.Contains(val1DifferentReference)); + Assert.False(c.Contains(val3)); + + // Removal when multiple exist, using different reference. + Assert.True(c.Remove(val1)); + Assert.False(c.Contains(val1)); + Assert.True(c.Contains(val2)); + Assert.Equal(1, c.Count); + + // Removal of non-existent + Assert.False(c.Remove(val3)); + Assert.False(c.Remove(val1DifferentReference)); + Assert.Equal(1, c.Count); + Assert.True(c.Contains(val2DifferentReference)); + + // Removal last item + Assert.True(c.Remove(val2DifferentReference)); + Assert.Equal(0, c.Count); + Assert.False(c.Contains(val2)); + Assert.False(c.Contains(val1)); + + // Remove from empty + Assert.False(c.Remove(val1)); + Assert.False(c.Remove(val2)); + Assert.False(c.Remove(val3)); + Assert.Equal(0, c.Count); } } } diff --git a/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj b/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj index 0a92e47df32eaf..ff05cb2600a927 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj +++ b/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj @@ -1,4 +1,4 @@ - + ../../src/Resources/Strings.resx true @@ -78,6 +78,8 @@ Link="ProductionCode\System\Net\Http\EmptyReadStream.cs" /> + private readonly Encoding _displayNameEncoding; @@ -219,6 +222,12 @@ private string GetHost(bool allowUnicode) throw new SmtpException(SR.Format(SR.SmtpInvalidHostName, Address), argEx); } } + + if (!EnableFullDomainLiterals && domain.AsSpan().IndexOfAny('\r', '\n') >= 0) + { + throw new SmtpException(SR.Format(SR.SmtpInvalidHostName, Address)); + } + return domain; } diff --git a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientTest.cs b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientTest.cs index bd0fb5298432d1..f635b0d67ac8e9 100644 --- a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientTest.cs +++ b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientTest.cs @@ -9,11 +9,15 @@ // (C) 2006 John Luke // +using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Net.NetworkInformation; using System.Net.Sockets; +using System.Reflection; using System.Threading; using System.Threading.Tasks; +using Microsoft.DotNet.RemoteExecutor; using Systen.Net.Mail.Tests; using Xunit; @@ -523,5 +527,60 @@ public async Task SendMail_SendQUITOnDispose(bool asyncSend) quitReceived.Wait(TimeSpan.FromSeconds(30)); Assert.True(quitMessageReceived, "QUIT message not received"); } + + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [InlineData("foo@[\r\n bar]")] + [InlineData("foo@[bar\r\n ]")] + [InlineData("foo@[bar\r\n baz]")] + public void MultiLineDomainLiterals_Enabled_Success(string input) + { + RemoteExecutor.Invoke(static (string @input) => + { + AppContext.SetSwitch("System.Net.AllowFullDomainLiterals", true); + + var address = new MailAddress(@input); + + // Using address with new line breaks the protocol so we cannot easily use LoopbackSmtpServer + // Instead we call internal method that does the extra validation. + string? host = (string?)typeof(MailAddress).InvokeMember("GetAddress", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, address, new object[] { true }); + Assert.Equal(input, host); + }, input).Dispose(); + } + + [Theory] + [MemberData(nameof(SendMail_MultiLineDomainLiterals_Data))] + public async Task SendMail_MultiLineDomainLiterals_Disabled_Throws(string from, string to, bool asyncSend) + { + using var server = new LoopbackSmtpServer(); + + using SmtpClient client = server.CreateClient(); + client.Credentials = new NetworkCredential("Foo", "Bar"); + + using var msg = new MailMessage(@from, @to, "subject", "body"); + + await Assert.ThrowsAsync(async () => + { + if (asyncSend) + { + await client.SendMailAsync(msg).WaitAsync(TimeSpan.FromSeconds(30)); + } + else + { + client.Send(msg); + } + }); + } + + public static IEnumerable SendMail_MultiLineDomainLiterals_Data() + { + foreach (bool async in new[] { true, false }) + { + foreach (string address in new[] { "foo@[\r\n bar]", "foo@[bar\r\n ]", "foo@[bar\r\n baz]" }) + { + yield return new object[] { address, "foo@example.com", async }; + yield return new object[] { "foo@example.com", address, async }; + } + } + } } } diff --git a/src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs b/src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs index 51c2314fde3669..d088a30d6f7445 100644 --- a/src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs +++ b/src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Tasks; using System.Diagnostics; +using Microsoft.Win32.SafeHandles; namespace System.Net { @@ -138,17 +139,14 @@ public static unsafe string GetHostName() { Interop.Winsock.EnsureInitialized(); - GetAddrInfoExContext* context = GetAddrInfoExContext.AllocateContext(); - - GetAddrInfoExState state; + GetAddrInfoExState? state = null; try { - state = new GetAddrInfoExState(context, hostName, justAddresses); - context->QueryStateHandle = state.CreateHandle(); + state = new GetAddrInfoExState(hostName, justAddresses); } catch { - GetAddrInfoExContext.FreeContext(context); + state?.Dispose(); throw; } @@ -158,6 +156,8 @@ public static unsafe string GetHostName() hints.ai_flags = AddressInfoHints.AI_CANONNAME; } + GetAddrInfoExContext* context = state.Context; + SocketError errorCode = (SocketError)Interop.Winsock.GetAddrInfoExW( hostName, null, Interop.Winsock.NS_ALL, IntPtr.Zero, &hints, &context->Result, IntPtr.Zero, &context->Overlapped, &GetAddressInfoExCallback, &context->CancelHandle); @@ -172,7 +172,7 @@ public static unsafe string GetHostName() // and final result would be posted via overlapped IO. // synchronous failure here may signal issue when GetAddrInfoExW does not work from // impersonated context. Windows 8 and Server 2012 fail for same reason with different errorCode. - GetAddrInfoExContext.FreeContext(context); + state.Dispose(); return null; } else @@ -194,10 +194,10 @@ private static unsafe void GetAddressInfoExCallback(int error, int bytes, Native private static unsafe void ProcessResult(SocketError errorCode, GetAddrInfoExContext* context) { + GetAddrInfoExState state = GetAddrInfoExState.FromHandleAndFree(context->QueryStateHandle); + try { - GetAddrInfoExState state = GetAddrInfoExState.FromHandleAndFree(context->QueryStateHandle); - CancellationToken cancellationToken = state.UnregisterAndGetCancellationToken(); if (errorCode == SocketError.Success) @@ -222,7 +222,7 @@ private static unsafe void ProcessResult(SocketError errorCode, GetAddrInfoExCon } finally { - GetAddrInfoExContext.FreeContext(context); + state.Dispose(); } } @@ -360,18 +360,21 @@ private static unsafe IPAddress CreateIPv6Address(ReadOnlySpan socketAddre return new IPAddress(address, scope); } - private sealed unsafe class GetAddrInfoExState : IThreadPoolWorkItem + // GetAddrInfoExState is a SafeHandle that manages the lifetime of GetAddrInfoExContext* + // to make sure GetAddrInfoExCancel always takes a valid memory address regardless of the race + // between cancellation and completion callbacks. + private sealed unsafe class GetAddrInfoExState : SafeHandleZeroOrMinusOneIsInvalid, IThreadPoolWorkItem { - private GetAddrInfoExContext* _cancellationContext; private CancellationTokenRegistration _cancellationRegistration; private AsyncTaskMethodBuilder IPHostEntryBuilder; private AsyncTaskMethodBuilder IPAddressArrayBuilder; private object? _result; + private volatile bool _completed; - public GetAddrInfoExState(GetAddrInfoExContext *context, string hostName, bool justAddresses) + public GetAddrInfoExState(string hostName, bool justAddresses) + : base(true) { - _cancellationContext = context; HostName = hostName; JustAddresses = justAddresses; if (justAddresses) @@ -384,6 +387,10 @@ public GetAddrInfoExState(GetAddrInfoExContext *context, string hostName, bool j IPHostEntryBuilder = AsyncTaskMethodBuilder.Create(); _ = IPHostEntryBuilder.Task; // force initialization } + + GetAddrInfoExContext* context = GetAddrInfoExContext.AllocateContext(); + context->QueryStateHandle = CreateHandle(); + SetHandle((IntPtr)context); } public string HostName { get; } @@ -392,52 +399,62 @@ public GetAddrInfoExState(GetAddrInfoExContext *context, string hostName, bool j public Task Task => JustAddresses ? (Task)IPAddressArrayBuilder.Task : IPHostEntryBuilder.Task; + internal GetAddrInfoExContext* Context => (GetAddrInfoExContext*)handle; + public void RegisterForCancellation(CancellationToken cancellationToken) { if (!cancellationToken.CanBeCanceled) return; - lock (this) + if (_completed) { - if (_cancellationContext == null) + // The operation completed before registration could be done. + return; + } + + _cancellationRegistration = cancellationToken.UnsafeRegister(static o => + { + var @this = (GetAddrInfoExState)o!; + if (@this._completed) { - // The operation completed before registration could be done. + // Escape early and avoid ObjectDisposedException in DangerousAddRef return; } - _cancellationRegistration = cancellationToken.UnsafeRegister(o => + bool needRelease = false; + try { - var @this = (GetAddrInfoExState)o!; - int cancelResult = 0; + @this.DangerousAddRef(ref needRelease); - lock (@this) - { - GetAddrInfoExContext* context = @this._cancellationContext; - - if (context != null) - { - // An outstanding operation will be completed with WSA_E_CANCELLED, and GetAddrInfoExCancel will return NO_ERROR. - // If this thread has lost the race between cancellation and completion, this will be a NOP - // with GetAddrInfoExCancel returning WSA_INVALID_HANDLE. - cancelResult = Interop.Winsock.GetAddrInfoExCancel(&context->CancelHandle); - } - } + // If DangerousAddRef didn't throw ODE, the handle should contain a valid pointer. + GetAddrInfoExContext* context = @this.Context; - if (cancelResult != 0 && cancelResult != Interop.Winsock.WSA_INVALID_HANDLE && NetEventSource.Log.IsEnabled()) + // An outstanding operation will be completed with WSA_E_CANCELLED, and GetAddrInfoExCancel will return NO_ERROR. + // If this thread has lost the race between cancellation and completion, this will be a NOP + // with GetAddrInfoExCancel returning WSA_INVALID_HANDLE. + int cancelResult = Interop.Winsock.GetAddrInfoExCancel(&context->CancelHandle); + if (cancelResult != Interop.Winsock.WSA_INVALID_HANDLE && NetEventSource.Log.IsEnabled()) { NetEventSource.Info(@this, $"GetAddrInfoExCancel returned error {cancelResult}"); } - }, this); - } + } + finally + { + if (needRelease) + { + @this.DangerousRelease(); + } + } + + }, this); } public CancellationToken UnregisterAndGetCancellationToken() { - lock (this) - { - _cancellationContext = null; - _cancellationRegistration.Unregister(); - } + _completed = true; + // We should not wait for pending cancellation callbacks with CTR.Dispose(), + // since we are in a completion routine and GetAddrInfoExCancel may get blocked until it's finished. + _cancellationRegistration.Unregister(); return _cancellationRegistration.Token; } @@ -479,8 +496,6 @@ void IThreadPoolWorkItem.Execute() } } - public IntPtr CreateHandle() => GCHandle.ToIntPtr(GCHandle.Alloc(this, GCHandleType.Normal)); - public static GetAddrInfoExState FromHandleAndFree(IntPtr handle) { GCHandle gcHandle = GCHandle.FromIntPtr(handle); @@ -488,6 +503,15 @@ public static GetAddrInfoExState FromHandleAndFree(IntPtr handle) gcHandle.Free(); return state; } + + protected override bool ReleaseHandle() + { + GetAddrInfoExContext.FreeContext(Context); + + return true; + } + + private IntPtr CreateHandle() => GCHandle.ToIntPtr(GCHandle.Alloc(this, GCHandleType.Normal)); } [StructLayout(LayoutKind.Sequential)] @@ -498,12 +522,7 @@ private unsafe struct GetAddrInfoExContext public IntPtr CancelHandle; public IntPtr QueryStateHandle; - public static GetAddrInfoExContext* AllocateContext() - { - var context = (GetAddrInfoExContext*)Marshal.AllocHGlobal(sizeof(GetAddrInfoExContext)); - *context = default; - return context; - } + public static GetAddrInfoExContext* AllocateContext() => (GetAddrInfoExContext*)NativeMemory.AllocZeroed((nuint)sizeof(GetAddrInfoExContext)); public static void FreeContext(GetAddrInfoExContext* context) { @@ -511,8 +530,7 @@ public static void FreeContext(GetAddrInfoExContext* context) { Interop.Winsock.FreeAddrInfoExW(context->Result); } - - Marshal.FreeHGlobal((IntPtr)context); + NativeMemory.Free(context); } } } diff --git a/src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostAddressesTest.cs b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostAddressesTest.cs index 450357c57a130b..10b588ebda6c8f 100644 --- a/src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostAddressesTest.cs +++ b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostAddressesTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Linq; using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; @@ -170,10 +171,13 @@ public async Task DnsGetHostAddresses_PreCancelledToken_Throws() OperationCanceledException oce = await Assert.ThrowsAnyAsync(() => Dns.GetHostAddressesAsync(TestSettings.LocalHost, cts.Token)); Assert.Equal(cts.Token, oce.CancellationToken); } + } - [OuterLoop] + // Cancellation tests are sequential to reduce the chance of timing issues. + [Collection(nameof(DisableParallelization))] + public class GetHostAddressesTest_Cancellation + { [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/43816")] // Race condition outlined below. [ActiveIssue("https://github.com/dotnet/runtime/issues/33378", TestPlatforms.AnyUnix)] // Cancellation of an outstanding getaddrinfo is not supported on *nix. public async Task DnsGetHostAddresses_PostCancelledToken_Throws() { @@ -188,5 +192,35 @@ public async Task DnsGetHostAddresses_PostCancelledToken_Throws() OperationCanceledException oce = await Assert.ThrowsAnyAsync(() => task); Assert.Equal(cts.Token, oce.CancellationToken); } + + // This is a regression test for https://github.com/dotnet/runtime/issues/63552 + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/33378", TestPlatforms.AnyUnix)] // Cancellation of an outstanding getaddrinfo is not supported on *nix. + public async Task DnsGetHostAddresses_ResolveParallelCancelOnFailure_AllCallsReturn() + { + string invalidAddress = TestSettings.UncachedHost; + await ResolveManyAsync(invalidAddress); + await ResolveManyAsync(invalidAddress, TestSettings.LocalHost) + .WaitAsync(TestSettings.PassingTestTimeout); + + static async Task ResolveManyAsync(params string[] addresses) + { + using CancellationTokenSource cts = new(); + Task[] resolveTasks = addresses.Select(a => ResolveOneAsync(a, cts)).ToArray(); + await Task.WhenAll(resolveTasks); + } + + static async Task ResolveOneAsync(string address, CancellationTokenSource cancellationTokenSource) + { + try + { + await Dns.GetHostAddressesAsync(address, cancellationTokenSource.Token); + } + catch (Exception) + { + cancellationTokenSource.Cancel(); + } + } + } } } diff --git a/src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs index 5a8b6d5d92f8f5..7d5338fcfe0194 100644 --- a/src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs +++ b/src/libraries/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs @@ -12,6 +12,9 @@ namespace System.Net.NameResolution.Tests { + [CollectionDefinition(nameof(DisableParallelization), DisableParallelization = true)] + public class DisableParallelization { } + public class GetHostEntryTest { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] @@ -81,7 +84,7 @@ public async Task Dns_GetHostEntry_HostString_Ok(string hostName) [ConditionalTheory(nameof(GetHostEntryWorks))] [InlineData("")] [InlineData(TestSettings.LocalHost)] - public async Task Dns_GetHostEntryAsync_HostString_Ok(string hostName) + public async Task Dns_GetHostEntryAsync_HostString_Ok(string hostName) { await TestGetHostEntryAsync(() => Dns.GetHostEntryAsync(hostName)); } @@ -122,7 +125,7 @@ static void RunTest(string hostnameInner) { Assert.NotEqual(AddressFamily.InterNetworkV6, address.AddressFamily); } - } + } } [ConditionalTheory(nameof(GetHostEntry_DisableIPv6_Condition))] @@ -309,13 +312,21 @@ public async Task DnsGetHostEntry_PreCancelledToken_Throws() OperationCanceledException oce = await Assert.ThrowsAnyAsync(() => Dns.GetHostEntryAsync(TestSettings.LocalHost, cts.Token)); Assert.Equal(cts.Token, oce.CancellationToken); } + } + // Cancellation tests are sequential to reduce the chance of timing issues. + [Collection(nameof(DisableParallelization))] + public class GetHostEntryTest_Cancellation + { [OuterLoop] - [ActiveIssue("https://github.com/dotnet/runtime/issues/43816")] // Race condition outlined below. [ActiveIssue("https://github.com/dotnet/runtime/issues/33378", TestPlatforms.AnyUnix)] // Cancellation of an outstanding getaddrinfo is not supported on *nix. [Fact] public async Task DnsGetHostEntry_PostCancelledToken_Throws() { + // Windows 7 name resolution is synchronous and does not respect cancellation. + if (PlatformDetection.IsWindows7) + return; + using var cts = new CancellationTokenSource(); Task task = Dns.GetHostEntryAsync(TestSettings.UncachedHost, cts.Token); diff --git a/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs b/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs index b8d331ba9918cd..66ab317a7d93de 100644 --- a/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs +++ b/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs @@ -123,9 +123,11 @@ public virtual void CopyTo(System.Net.NetworkInformation.IPAddressInformation[] public abstract partial class IPGlobalProperties { protected IPGlobalProperties() { } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract string DhcpScopeName { get; } public abstract string DomainName { get; } public abstract string HostName { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract bool IsWinsProxy { get; } public abstract System.Net.NetworkInformation.NetBiosNodeType NodeType { get; } public virtual System.IAsyncResult BeginGetUnicastAddresses(System.AsyncCallback? callback, object? state) { throw null; } @@ -136,16 +138,22 @@ protected IPGlobalProperties() { } public abstract System.Net.IPEndPoint[] GetActiveTcpListeners(); [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.IPEndPoint[] GetActiveUdpListeners(); + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.IcmpV4Statistics GetIcmpV4Statistics(); + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.IcmpV6Statistics GetIcmpV6Statistics(); [System.Runtime.Versioning.UnsupportedOSPlatform("illumos")] [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] public static System.Net.NetworkInformation.IPGlobalProperties GetIPGlobalProperties() { throw null; } public abstract System.Net.NetworkInformation.IPGlobalStatistics GetIPv4GlobalStatistics(); public abstract System.Net.NetworkInformation.IPGlobalStatistics GetIPv6GlobalStatistics(); + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.TcpStatistics GetTcpIPv4Statistics(); + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.TcpStatistics GetTcpIPv6Statistics(); + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.UdpStatistics GetUdpIPv4Statistics(); + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.UdpStatistics GetUdpIPv6Statistics(); public virtual System.Net.NetworkInformation.UnicastIPAddressInformationCollection GetUnicastAddresses() { throw null; } public virtual System.Threading.Tasks.Task GetUnicastAddressesAsync() { throw null; } @@ -153,41 +161,69 @@ protected IPGlobalProperties() { } public abstract partial class IPGlobalStatistics { protected IPGlobalStatistics() { } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract int DefaultTtl { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract bool ForwardingEnabled { get; } public abstract int NumberOfInterfaces { get; } public abstract int NumberOfIPAddresses { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract int NumberOfRoutes { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long OutputPacketRequests { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long OutputPacketRoutingDiscards { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long OutputPacketsDiscarded { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long OutputPacketsWithNoRoute { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long PacketFragmentFailures { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long PacketReassembliesRequired { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long PacketReassemblyFailures { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long PacketReassemblyTimeout { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long PacketsFragmented { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long PacketsReassembled { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long ReceivedPackets { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsDelivered { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsDiscarded { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsForwarded { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsWithAddressErrors { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsWithHeadersErrors { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsWithUnknownProtocol { get; } } public abstract partial class IPInterfaceProperties { protected IPInterfaceProperties() { } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.IPAddressInformationCollection AnycastAddresses { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.IPAddressCollection DhcpServerAddresses { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.IPAddressCollection DnsAddresses { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract string DnsSuffix { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.GatewayIPAddressInformationCollection GatewayAddresses { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract bool IsDnsEnabled { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract bool IsDynamicDnsEnabled { get; } public abstract System.Net.NetworkInformation.MulticastIPAddressInformationCollection MulticastAddresses { get; } public abstract System.Net.NetworkInformation.UnicastIPAddressInformationCollection UnicastAddresses { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract System.Net.NetworkInformation.IPAddressCollection WinsServersAddresses { get; } public abstract System.Net.NetworkInformation.IPv4InterfaceProperties GetIPv4Properties(); public abstract System.Net.NetworkInformation.IPv6InterfaceProperties GetIPv6Properties(); @@ -212,11 +248,16 @@ public abstract partial class IPv4InterfaceProperties { protected IPv4InterfaceProperties() { } public abstract int Index { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract bool IsAutomaticPrivateAddressingActive { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract bool IsAutomaticPrivateAddressingEnabled { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract bool IsDhcpEnabled { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract bool IsForwardingEnabled { get; } public abstract int Mtu { get; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public abstract bool UsesWins { get; } } public abstract partial class IPv4InterfaceStatistics @@ -316,7 +357,9 @@ protected NetworkInterface() { } [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] public static System.Net.NetworkInformation.NetworkInterface[] GetAllNetworkInterfaces() { throw null; } public virtual System.Net.NetworkInformation.IPInterfaceProperties GetIPProperties() { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public virtual System.Net.NetworkInformation.IPInterfaceStatistics GetIPStatistics() { throw null; } + [System.Runtime.Versioning.UnsupportedOSPlatform("android")] public virtual System.Net.NetworkInformation.IPv4InterfaceStatistics GetIPv4Statistics() { throw null; } [System.Runtime.Versioning.UnsupportedOSPlatform("illumos")] [System.Runtime.Versioning.UnsupportedOSPlatform("solaris")] diff --git a/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj b/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj index dc251f9c75dc41..7520e586642f23 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj +++ b/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent) enable @@ -118,8 +118,8 @@ - - + + @@ -144,6 +144,18 @@ + + + + + + + + + + + + @@ -176,7 +188,7 @@ - + diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalProperties.cs new file mode 100644 index 00000000000000..4cebb2c55efa9a --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalProperties.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Net.NetworkInformation +{ + internal sealed class AndroidIPGlobalProperties : UnixIPGlobalProperties + { + public override TcpConnectionInformation[] GetActiveTcpConnections() => throw new PlatformNotSupportedException(); + + public override IPEndPoint[] GetActiveTcpListeners() => throw new PlatformNotSupportedException(); + + public override IPEndPoint[] GetActiveUdpListeners() => throw new PlatformNotSupportedException(); + + public override IcmpV4Statistics GetIcmpV4Statistics() => throw new PlatformNotSupportedException(); + + public override IcmpV6Statistics GetIcmpV6Statistics() => throw new PlatformNotSupportedException(); + + public override IPGlobalStatistics GetIPv4GlobalStatistics() + => new AndroidIPGlobalStatistics(ipv4: true); + + public override IPGlobalStatistics GetIPv6GlobalStatistics() + => new AndroidIPGlobalStatistics(ipv4: false); + + public override TcpStatistics GetTcpIPv4Statistics() => throw new PlatformNotSupportedException(); + + public override TcpStatistics GetTcpIPv6Statistics() => throw new PlatformNotSupportedException(); + + public override UdpStatistics GetUdpIPv4Statistics() => throw new PlatformNotSupportedException(); + + public override UdpStatistics GetUdpIPv6Statistics() => throw new PlatformNotSupportedException(); + } +} diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalStatistics.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalStatistics.cs new file mode 100644 index 00000000000000..de57e068a1ddbf --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalStatistics.cs @@ -0,0 +1,73 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; +using System.Net.Sockets; + +namespace System.Net.NetworkInformation +{ + internal sealed class AndroidIPGlobalStatistics : IPGlobalStatistics + { + public AndroidIPGlobalStatistics(bool ipv4) + { + AndroidNetworkInterface[] networkInterfaces = NetworkInterfacePal.GetAndroidNetworkInterfaces(); + + foreach (var networkInterface in networkInterfaces) + { + var component = ipv4 ? NetworkInterfaceComponent.IPv4 : NetworkInterfaceComponent.IPv6; + if (networkInterface.Supports(component)) + { + NumberOfInterfaces++; + } + + foreach (UnixUnicastIPAddressInformation addressInformation in networkInterface.UnicastAddress) + { + bool isIPv4 = addressInformation.Address.AddressFamily == AddressFamily.InterNetwork; + if (isIPv4 == ipv4) + { + NumberOfIPAddresses++; + } + } + + if (networkInterface.MulticastAddresess != null) + { + foreach (IPAddress address in networkInterface.MulticastAddresess) + { + bool isIPv4 = address.AddressFamily == AddressFamily.InterNetwork; + if (isIPv4 == ipv4) + { + NumberOfIPAddresses++; + } + } + } + } + } + + public override int NumberOfInterfaces { get; } + public override int NumberOfIPAddresses { get; } + + public override int DefaultTtl => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override bool ForwardingEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override int NumberOfRoutes => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long OutputPacketRequests => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long OutputPacketRoutingDiscards => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long OutputPacketsDiscarded => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long OutputPacketsWithNoRoute => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long PacketFragmentFailures => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long PacketReassembliesRequired => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long PacketReassemblyFailures => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long PacketReassemblyTimeout => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long PacketsFragmented => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long PacketsReassembled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long ReceivedPackets => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long ReceivedPacketsDelivered => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long ReceivedPacketsDiscarded => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long ReceivedPacketsForwarded => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long ReceivedPacketsWithAddressErrors => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long ReceivedPacketsWithHeadersErrors => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override long ReceivedPacketsWithUnknownProtocol => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + } +} diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPInterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPInterfaceProperties.cs new file mode 100644 index 00000000000000..cee58c47d84475 --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPInterfaceProperties.cs @@ -0,0 +1,30 @@ +// 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.Generic; +using System.IO; + +namespace System.Net.NetworkInformation +{ + internal sealed class AndroidIPInterfaceProperties : UnixIPInterfaceProperties + { + private readonly AndroidIPv4InterfaceProperties _ipv4Properties; + private readonly AndroidIPv6InterfaceProperties _ipv6Properties; + + public AndroidIPInterfaceProperties(AndroidNetworkInterface ani) + : base(ani, globalConfig: true) + { + _ipv4Properties = new AndroidIPv4InterfaceProperties(ani); + _ipv6Properties = new AndroidIPv6InterfaceProperties(ani); + } + + public override IPv4InterfaceProperties GetIPv4Properties() => _ipv4Properties; + public override IPv6InterfaceProperties GetIPv6Properties() => _ipv6Properties; + + public override bool IsDynamicDnsEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override IPAddressInformationCollection AnycastAddresses => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override GatewayIPAddressInformationCollection GatewayAddresses => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override IPAddressCollection DhcpServerAddresses => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override IPAddressCollection WinsServersAddresses => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + } +} diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv4InterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv4InterfaceProperties.cs new file mode 100644 index 00000000000000..cc12cf7f357456 --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv4InterfaceProperties.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO; + +namespace System.Net.NetworkInformation +{ + internal sealed class AndroidIPv4InterfaceProperties : UnixIPv4InterfaceProperties + { + public AndroidIPv4InterfaceProperties(AndroidNetworkInterface androidNetworkInterface) + : base(androidNetworkInterface) + { + Mtu = androidNetworkInterface._mtu; + } + + public override int Mtu { get; } + + public override bool IsAutomaticPrivateAddressingActive => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override bool IsAutomaticPrivateAddressingEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override bool IsDhcpEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override bool IsForwardingEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override bool UsesWins => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + } +} diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv6InterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv6InterfaceProperties.cs new file mode 100644 index 00000000000000..9a5f872231efde --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv6InterfaceProperties.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.IO; + +namespace System.Net.NetworkInformation +{ + internal sealed class AndroidIPv6InterfaceProperties : UnixIPv6InterfaceProperties + { + private readonly AndroidNetworkInterface _androidNetworkInterface; + + public AndroidIPv6InterfaceProperties(AndroidNetworkInterface androidNetworkInterface) + : base(androidNetworkInterface) + { + _androidNetworkInterface = androidNetworkInterface; + } + + public override int Mtu => _androidNetworkInterface._mtu; + + public override long GetScopeId(ScopeLevel scopeLevel) + { + if (scopeLevel == ScopeLevel.None || scopeLevel == ScopeLevel.Interface || + scopeLevel == ScopeLevel.Link || scopeLevel == ScopeLevel.Subnet) + { + return _androidNetworkInterface.Index; + } + + return 0; + } + } +} diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidNetworkInterface.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidNetworkInterface.cs new file mode 100644 index 00000000000000..dcf66895aea7b1 --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidNetworkInterface.cs @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Net; + +namespace System.Net.NetworkInformation +{ + /// + /// Implements a NetworkInterface on Android. + /// + internal sealed class AndroidNetworkInterface : UnixNetworkInterface + { + internal readonly int _mtu; + private readonly AndroidIPInterfaceProperties _ipProperties; + + internal unsafe AndroidNetworkInterface(string name, Interop.Sys.NetworkInterfaceInfo *networkInterfaceInfo) + : base(name) + { + _index = networkInterfaceInfo->InterfaceIndex; + if (networkInterfaceInfo->NumAddressBytes > 0) + { + _physicalAddress = new PhysicalAddress(new ReadOnlySpan(networkInterfaceInfo->AddressBytes, networkInterfaceInfo->NumAddressBytes).ToArray()); + } + + _mtu = networkInterfaceInfo->Mtu; + _ipProperties = new AndroidIPInterfaceProperties(this); + + OperationalStatus = (OperationalStatus)networkInterfaceInfo->OperationalState; + Speed = networkInterfaceInfo->Speed; + SupportsMulticast = networkInterfaceInfo->SupportsMulticast != 0; + NetworkInterfaceType = (NetworkInterfaceType)networkInterfaceInfo->HardwareType; + } + + internal unsafe void AddAddress(Interop.Sys.IpAddressInfo *addressInfo) + { + var address = new IPAddress(new ReadOnlySpan(addressInfo->AddressBytes, addressInfo->NumAddressBytes)); + if (address.IsIPv6LinkLocal) + { + address.ScopeId = addressInfo->InterfaceIndex; + } + + AddAddress(address, addressInfo->PrefixLength); + } + + public override bool SupportsMulticast { get; } + public override IPInterfaceProperties GetIPProperties() => _ipProperties; + public override IPInterfaceStatistics GetIPStatistics() => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override IPv4InterfaceStatistics GetIPv4Statistics() => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); + public override OperationalStatus OperationalStatus { get; } + public override NetworkInterfaceType NetworkInterfaceType { get; } + public override long Speed { get; } + public override bool IsReceiveOnly => false; + } +} diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs index d835ce2ecd65ba..1371a47d3ed945 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs @@ -40,6 +40,7 @@ public static IPGlobalProperties GetIPGlobalProperties() /// /// Gets the Dynamic Host Configuration Protocol (DHCP) scope name. /// + [UnsupportedOSPlatform("android")] public abstract string DhcpScopeName { get; } /// @@ -55,6 +56,7 @@ public static IPGlobalProperties GetIPGlobalProperties() /// /// Gets a bool value that specifies whether the local computer is acting as a Windows Internet Name Service (WINS) proxy. /// + [UnsupportedOSPlatform("android")] public abstract bool IsWinsProxy { get; } /// @@ -72,25 +74,31 @@ public virtual UnicastIPAddressInformationCollection EndGetUnicastAddresses(IAsy throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException); } + [UnsupportedOSPlatform("android")] public abstract TcpStatistics GetTcpIPv4Statistics(); + [UnsupportedOSPlatform("android")] public abstract TcpStatistics GetTcpIPv6Statistics(); /// /// Provides User Datagram Protocol (UDP) statistical data for the local computer. /// + [UnsupportedOSPlatform("android")] public abstract UdpStatistics GetUdpIPv4Statistics(); + [UnsupportedOSPlatform("android")] public abstract UdpStatistics GetUdpIPv6Statistics(); /// /// Provides Internet Control Message Protocol (ICMP) version 4 statistical data for the local computer. /// + [UnsupportedOSPlatform("android")] public abstract IcmpV4Statistics GetIcmpV4Statistics(); /// /// Provides Internet Control Message Protocol (ICMP) version 6 statistical data for the local computer. /// + [UnsupportedOSPlatform("android")] public abstract IcmpV6Statistics GetIcmpV6Statistics(); /// diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalPropertiesPal.Android.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalPropertiesPal.Android.cs new file mode 100644 index 00000000000000..33e09ece17c696 --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalPropertiesPal.Android.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. + +namespace System.Net.NetworkInformation +{ + internal static class IPGlobalPropertiesPal + { + public static IPGlobalProperties GetIPGlobalProperties() + { + return new AndroidIPGlobalProperties(); + } + } +} diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalStatistics.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalStatistics.cs index a8103f867e83d4..04b9f14f1eab2b 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalStatistics.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalStatistics.cs @@ -1,6 +1,8 @@ // 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.Versioning; + namespace System.Net.NetworkInformation { /// @@ -11,11 +13,13 @@ public abstract class IPGlobalStatistics /// /// Gets the default time-to-live (TTL) value for Internet Protocol (IP) packets. /// + [UnsupportedOSPlatform("android")] public abstract int DefaultTtl { get; } /// /// Gets a bool value that specifies whether Internet Protocol (IP) packet forwarding is enabled. /// + [UnsupportedOSPlatform("android")] public abstract bool ForwardingEnabled { get; } /// @@ -31,91 +35,109 @@ public abstract class IPGlobalStatistics /// /// Gets the number of outbound Internet Protocol (IP) packets. /// + [UnsupportedOSPlatform("android")] public abstract long OutputPacketRequests { get; } /// /// Gets the number of routes in the routing table that have been discarded. /// + [UnsupportedOSPlatform("android")] public abstract long OutputPacketRoutingDiscards { get; } /// /// Gets the number of transmitted Internet Protocol (IP) packets that have been discarded. /// + [UnsupportedOSPlatform("android")] public abstract long OutputPacketsDiscarded { get; } /// /// Gets the number of Internet Protocol (IP) packets for which the local computer could not determine a route to the destination address. /// + [UnsupportedOSPlatform("android")] public abstract long OutputPacketsWithNoRoute { get; } /// /// Gets the number of Internet Protocol (IP) packets that could not be fragmented. /// + [UnsupportedOSPlatform("android")] public abstract long PacketFragmentFailures { get; } /// /// Gets the number of Internet Protocol (IP) packets that required reassembly. /// + [UnsupportedOSPlatform("android")] public abstract long PacketReassembliesRequired { get; } /// /// Gets the number of Internet Protocol (IP) packets that were not successfully reassembled. /// + [UnsupportedOSPlatform("android")] public abstract long PacketReassemblyFailures { get; } /// /// Gets the maximum amount of time within which all fragments of an Internet Protocol (IP) packet must arrive. /// + [UnsupportedOSPlatform("android")] public abstract long PacketReassemblyTimeout { get; } /// /// Gets the number of Internet Protocol (IP) packets fragmented. /// + [UnsupportedOSPlatform("android")] public abstract long PacketsFragmented { get; } /// /// Gets the number of Internet Protocol (IP) packets reassembled. /// + [UnsupportedOSPlatform("android")] public abstract long PacketsReassembled { get; } /// /// Gets the number of Internet Protocol (IP) packets received. /// + [UnsupportedOSPlatform("android")] public abstract long ReceivedPackets { get; } /// /// Gets the number of Internet Protocol(IP) packets received and delivered. /// + [UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsDelivered { get; } /// /// Gets the number of Internet Protocol (IP) packets that have been received and discarded. /// + [UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsDiscarded { get; } /// /// Gets the number of Internet Protocol (IP) packets forwarded. /// + [UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsForwarded { get; } /// /// Gets the number of Internet Protocol (IP) packets with address errors that were received. /// + [UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsWithAddressErrors { get; } /// /// Gets the number of Internet Protocol (IP) packets with header errors that were received. /// + [UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsWithHeadersErrors { get; } /// /// Gets the number of Internet Protocol (IP) packets received on the local machine with an unknown protocol in the header. /// + [UnsupportedOSPlatform("android")] public abstract long ReceivedPacketsWithUnknownProtocol { get; } /// /// Gets the number of routes in the Internet Protocol (IP) routing table. /// + [UnsupportedOSPlatform("android")] public abstract int NumberOfRoutes { get; } } } diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs index e659598f5e4f4c..863737ce18f6d3 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs @@ -1,6 +1,8 @@ // 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.Versioning; + namespace System.Net.NetworkInformation { /// @@ -12,16 +14,19 @@ public abstract class IPInterfaceProperties /// /// Gets a bool value that indicates whether this interface is configured to send name resolution queries to a Domain Name System (DNS) server. /// + [UnsupportedOSPlatform("android")] public abstract bool IsDnsEnabled { get; } /// /// Gets the Domain Name System (DNS) suffix associated with this interface. /// + [UnsupportedOSPlatform("android")] public abstract string DnsSuffix { get; } /// /// Gets a bool value that indicates whether this interface is configured to automatically register its IP address information with the Domain Name System (DNS). /// + [UnsupportedOSPlatform("android")] public abstract bool IsDynamicDnsEnabled { get; } /// @@ -37,26 +42,31 @@ public abstract class IPInterfaceProperties /// /// The address identifies multiple computers. Packets sent to an anycast address are sent to one of the computers identified by the address. /// + [UnsupportedOSPlatform("android")] public abstract IPAddressInformationCollection AnycastAddresses { get; } /// /// The address is that of a Domain Name Service (DNS) server for the local computer. /// + [UnsupportedOSPlatform("android")] public abstract IPAddressCollection DnsAddresses { get; } /// /// Gets the network gateway addresses. /// + [UnsupportedOSPlatform("android")] public abstract GatewayIPAddressInformationCollection GatewayAddresses { get; } /// /// Gets the addresses for Dynamic Host Configuration Protocol (DHCP) servers. /// + [UnsupportedOSPlatform("android")] public abstract IPAddressCollection DhcpServerAddresses { get; } /// /// Gets the list of Wins Servers registered with this interface /// + [UnsupportedOSPlatform("android")] public abstract IPAddressCollection WinsServersAddresses { get; } /// diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs index 0f104e3fce8fc3..9f9d0b1e3766dd 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs @@ -1,6 +1,8 @@ // 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.Versioning; + namespace System.Net.NetworkInformation { /// @@ -11,21 +13,25 @@ public abstract class IPv4InterfaceProperties /// /// Gets a bool value that indicates whether an interface uses Windows Internet Name Service (WINS). /// + [UnsupportedOSPlatform("android")] public abstract bool UsesWins { get; } /// /// Gets a bool value that indicates whether the interface is configured to use a dynamic host configuration protocol (DHCP) server to obtain an IP address. /// + [UnsupportedOSPlatform("android")] public abstract bool IsDhcpEnabled { get; } /// /// Gets a bool value that indicates whether this interface has an automatic private IP addressing (APIPA) address. /// + [UnsupportedOSPlatform("android")] public abstract bool IsAutomaticPrivateAddressingActive { get; } /// /// Gets a bool value that indicates whether this interface has automatic private IP addressing (APIPA) enabled. /// + [UnsupportedOSPlatform("android")] public abstract bool IsAutomaticPrivateAddressingEnabled { get; } /// @@ -36,6 +42,7 @@ public abstract class IPv4InterfaceProperties /// /// Gets a bool value that indicates whether this interface can route packets. /// + [UnsupportedOSPlatform("android")] public abstract bool IsForwardingEnabled { get; } /// diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Android.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Android.cs new file mode 100644 index 00000000000000..5f7833826408df --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.Android.cs @@ -0,0 +1,247 @@ +// 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.Generic; +using System.Diagnostics; +using System.Runtime.Versioning; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.NetworkInformation +{ + public partial class NetworkChange + { + private static readonly TimeSpan s_timerInterval = TimeSpan.FromSeconds(2); + private static readonly object s_lockObj = new(); + + private static Task? s_loopTask; + private static CancellationTokenSource? s_cancellationTokenSource; + private static IPAddress[]? s_lastIpAddresses; + + public static event NetworkAddressChangedEventHandler? NetworkAddressChanged + { + add + { + if (value != null) + { + lock (s_lockObj) + { + if (s_addressChangedSubscribers.Count == 0 && + s_availabilityChangedSubscribers.Count == 0) + { + CreateAndStartLoop(); + } + else + { + Debug.Assert(s_loopTask is not null); + } + + s_addressChangedSubscribers.TryAdd(value, ExecutionContext.Capture()); + } + } + } + remove + { + if (value != null) + { + lock (s_lockObj) + { + bool hadAddressChangedSubscribers = s_addressChangedSubscribers.Count != 0; + s_addressChangedSubscribers.Remove(value); + + if (hadAddressChangedSubscribers && s_addressChangedSubscribers.Count == 0 && + s_availabilityChangedSubscribers.Count == 0) + { + StopLoop(); + } + } + } + } + } + + public static event NetworkAvailabilityChangedEventHandler? NetworkAvailabilityChanged + { + add + { + if (value != null) + { + lock (s_lockObj) + { + if (s_addressChangedSubscribers.Count == 0 && + s_availabilityChangedSubscribers.Count == 0) + { + CreateAndStartLoop(); + } + else + { + Debug.Assert(s_loopTask is not null); + } + + s_availabilityChangedSubscribers.TryAdd(value, ExecutionContext.Capture()); + } + } + } + remove + { + if (value != null) + { + lock (s_lockObj) + { + bool hadSubscribers = s_addressChangedSubscribers.Count != 0 || + s_availabilityChangedSubscribers.Count != 0; + s_availabilityChangedSubscribers.Remove(value); + + if (hadSubscribers && s_addressChangedSubscribers.Count == 0 && + s_availabilityChangedSubscribers.Count == 0) + { + StopLoop(); + } + } + } + } + } + + private static void CreateAndStartLoop() + { + Debug.Assert(s_cancellationTokenSource is null); + Debug.Assert(s_loopTask is null); + + s_cancellationTokenSource = new CancellationTokenSource(); + s_loopTask = Task.Run(() => PeriodicallyCheckIfNetworkChanged(s_cancellationTokenSource.Token)); + } + + private static void StopLoop() + { + Debug.Assert(s_cancellationTokenSource is not null); + Debug.Assert(s_loopTask is not null); + + s_cancellationTokenSource.Cancel(); + + s_loopTask = null; + s_cancellationTokenSource = null; + s_lastIpAddresses = null; + } + + private static async Task PeriodicallyCheckIfNetworkChanged(CancellationToken cancellationToken) + { + using var timer = new PeriodicTimer(s_timerInterval); + + try + { + while (await timer.WaitForNextTickAsync(cancellationToken).ConfigureAwait(false) + && !cancellationToken.IsCancellationRequested) + { + CheckIfNetworkChanged(); + } + } + catch (OperationCanceledException) + { + } + } + + private static void CheckIfNetworkChanged() + { + var newAddresses = GetIPAddresses(); + if (s_lastIpAddresses is IPAddress[] oldAddresses && NetworkChanged(oldAddresses, newAddresses)) + { + OnNetworkChanged(); + } + + s_lastIpAddresses = newAddresses; + } + + private static IPAddress[] GetIPAddresses() + { + var addresses = new List(); + + var networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); + foreach (var networkInterface in networkInterfaces) + { + var properties = networkInterface.GetIPProperties(); + foreach (var addressInformation in properties.UnicastAddresses) + { + addresses.Add(addressInformation.Address); + } + } + + return addresses.ToArray(); + } + + private static bool NetworkChanged(IPAddress[] oldAddresses, IPAddress[] newAddresses) + { + if (oldAddresses.Length != newAddresses.Length) + { + return true; + } + + for (int i = 0; i < newAddresses.Length; i++) + { + if (Array.IndexOf(oldAddresses, newAddresses[i]) == -1) + { + return true; + } + } + + return false; + } + + private static void OnNetworkChanged() + { + Dictionary? addressChangedSubscribers = null; + Dictionary? availabilityChangedSubscribers = null; + + lock (s_lockObj) + { + if (s_addressChangedSubscribers.Count > 0) + { + addressChangedSubscribers = new Dictionary(s_addressChangedSubscribers); + } + if (s_availabilityChangedSubscribers.Count > 0) + { + availabilityChangedSubscribers = new Dictionary(s_availabilityChangedSubscribers); + } + } + + if (addressChangedSubscribers != null) + { + foreach (KeyValuePair + subscriber in addressChangedSubscribers) + { + NetworkAddressChangedEventHandler handler = subscriber.Key; + ExecutionContext? ec = subscriber.Value; + + if (ec == null) // Flow suppressed + { + handler(null, EventArgs.Empty); + } + else + { + ExecutionContext.Run(ec, s_runAddressChangedHandler, handler); + } + } + } + + if (availabilityChangedSubscribers != null) + { + bool isAvailable = NetworkInterface.GetIsNetworkAvailable(); + NetworkAvailabilityEventArgs args = isAvailable ? s_availableEventArgs : s_notAvailableEventArgs; + ContextCallback callbackContext = isAvailable ? s_runHandlerAvailable : s_runHandlerNotAvailable; + foreach (KeyValuePair + subscriber in availabilityChangedSubscribers) + { + NetworkAvailabilityChangedEventHandler handler = subscriber.Key; + ExecutionContext? ec = subscriber.Value; + + if (ec == null) // Flow suppressed + { + handler(null, args); + } + else + { + ExecutionContext.Run(ec, callbackContext, handler); + } + } + } + } + } +} diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterface.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterface.cs index 94cb8fb0b9d81c..24f02186c3dc3a 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterface.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterface.cs @@ -70,6 +70,7 @@ public virtual IPInterfaceProperties GetIPProperties() /// Provides Internet Protocol (IP) statistical data for this network interface. /// /// The interface's IP statistics. + [UnsupportedOSPlatform("android")] public virtual IPInterfaceStatistics GetIPStatistics() { throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException); @@ -81,6 +82,7 @@ public virtual IPInterfaceStatistics GetIPStatistics() /// Do not use this method, use GetIPStatistics instead. /// /// The interface's IP statistics. + [UnsupportedOSPlatform("android")] public virtual IPv4InterfaceStatistics GetIPv4Statistics() { throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException); diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterfacePal.Android.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterfacePal.Android.cs new file mode 100644 index 00000000000000..820e01f093b34c --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterfacePal.Android.cs @@ -0,0 +1,110 @@ +// 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; + +namespace System.Net.NetworkInformation +{ + internal static class NetworkInterfacePal + { + /// Returns objects that describe the network interfaces on the local computer. + public static NetworkInterface[] GetAllNetworkInterfaces() => GetAndroidNetworkInterfaces(); + public static bool GetIsNetworkAvailable() => TransformNetworkInterfacess(IsSomeNetworkUp); + public static int IPv6LoopbackInterfaceIndex => LoopbackInterfaceIndex; + public static int LoopbackInterfaceIndex => TransformNetworkInterfacess(FindLoopbackInterfaceIndex); + + internal static unsafe AndroidNetworkInterface[] GetAndroidNetworkInterfaces() + => TransformNetworkInterfacess(ToAndroidNetworkInterfaceArray); + + private static unsafe T TransformNetworkInterfacess(Func transform) + { + int interfaceCount = 0; + int addressCount = 0; + Interop.Sys.NetworkInterfaceInfo *networkInterfaceInfo = null; + Interop.Sys.IpAddressInfo *addressInfo = null; + + if (Interop.Sys.GetNetworkInterfaces(ref interfaceCount, ref networkInterfaceInfo, ref addressCount, ref addressInfo) != 0) + { + string message = Interop.Sys.GetLastErrorInfo().GetErrorMessage(); + throw new NetworkInformationException(message); + } + + // the native implementation of Interop.Sys.GetNetworkInterfaces allocates one block of memory + // for both networkInterfaceInfo and addressInfo so we only need to call free once pointing at + // the start of the network interfaces list + var globalMemory = (IntPtr)networkInterfaceInfo; + + try + { + return transform(interfaceCount, (IntPtr)networkInterfaceInfo, addressCount, (IntPtr)addressInfo); + } + finally + { + Marshal.FreeHGlobal(globalMemory); + } + } + + private static unsafe AndroidNetworkInterface[] ToAndroidNetworkInterfaceArray(int interfaceCount, IntPtr networkInterfacesPtr, int addressCount, IntPtr addressPtr) + { + var networkInterfaces = new AndroidNetworkInterface[interfaceCount]; + + var networkInterfaceInfo = (Interop.Sys.NetworkInterfaceInfo*)networkInterfacesPtr; + for (int i = 0; i < interfaceCount; i++, networkInterfaceInfo++) + { + var name = Marshal.PtrToStringAnsi((IntPtr)networkInterfaceInfo->Name); + networkInterfaces[i] = new AndroidNetworkInterface(name!, networkInterfaceInfo); + } + + var addressInfo = (Interop.Sys.IpAddressInfo*)addressPtr; + for (int i = 0; i < addressCount; i++, addressInfo++) + { + // there is usually just a handful of few network interfaces on Android devices + // and this linear search does not have any impact on performance + foreach (var networkInterface in networkInterfaces) + { + if (networkInterface.Index == addressInfo->InterfaceIndex) + { + networkInterface.AddAddress(addressInfo); + break; + } + } + } + + return networkInterfaces; + } + + private static unsafe int FindLoopbackInterfaceIndex(int interfaceCount, IntPtr networkInterfacesPtr, int addressCount, IntPtr addressPtr) + { + var networkInterfaceInfo = (Interop.Sys.NetworkInterfaceInfo*)networkInterfacesPtr; + for (int i = 0; i < interfaceCount; i++, networkInterfaceInfo++) + { + if (networkInterfaceInfo->HardwareType == (int)NetworkInterfaceType.Loopback) + { + return networkInterfaceInfo->InterfaceIndex; + } + } + + throw new NetworkInformationException(SR.net_NoLoopback); + } + + private static unsafe bool IsSomeNetworkUp(int interfaceCount, IntPtr networkInterfacesPtr, int addressCount, IntPtr addressPtr) + { + var networkInterfaceInfo = (Interop.Sys.NetworkInterfaceInfo*)networkInterfacesPtr; + for (int i = 0; i < interfaceCount; i++, networkInterfaceInfo++) + { + if (networkInterfaceInfo->HardwareType == (int)NetworkInterfaceType.Loopback + || networkInterfaceInfo->HardwareType == (int)NetworkInterfaceType.Tunnel) + { + continue; + } + + if (networkInterfaceInfo->OperationalState == (int)OperationalStatus.Up) + { + return true; + } + } + + return false; + } + } +} diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixIPGlobalProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixIPGlobalProperties.cs index cca949a317a6f8..eafa42ff3fec12 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixIPGlobalProperties.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixIPGlobalProperties.cs @@ -13,6 +13,7 @@ namespace System.Net.NetworkInformation internal abstract class UnixIPGlobalProperties : IPGlobalProperties { [UnsupportedOSPlatform("linux")] + [UnsupportedOSPlatform("android")] [UnsupportedOSPlatform("osx")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] @@ -26,6 +27,7 @@ internal abstract class UnixIPGlobalProperties : IPGlobalProperties public override string HostName { get { return HostInformation.HostName; } } [UnsupportedOSPlatform("linux")] + [UnsupportedOSPlatform("android")] [UnsupportedOSPlatform("osx")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixNetworkInterface.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixNetworkInterface.cs index d248c72b6930cf..00c5b3a9a3028c 100644 --- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixNetworkInterface.cs +++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixNetworkInterface.cs @@ -60,7 +60,7 @@ public override bool Supports(NetworkInterfaceComponent networkInterfaceComponen public List UnicastAddress { get { return _unicastAddresses; } } /// - /// Returns a list of all Unicast addresses of the interface's IP Addresses. + /// Returns a list of all Multicast addresses of the interface's IP Addresses. /// public List? MulticastAddresess { get { return _multicastAddresses; } } diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs index 860e64f216edbe..70804e19499e2f 100644 --- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs @@ -26,7 +26,7 @@ public IPGlobalPropertiesTest(ITestOutputHelper output) } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/36890", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] + [SkipOnPlatform(TestPlatforms.Android, "Expected behavior is different on Android")] public void IPGlobalProperties_AccessAllMethods_NoErrors() { IPGlobalProperties gp = IPGlobalProperties.GetIPGlobalProperties(); @@ -36,7 +36,7 @@ public void IPGlobalProperties_AccessAllMethods_NoErrors() Assert.NotNull(gp.GetActiveUdpListeners()); Assert.NotNull(gp.GetIPv4GlobalStatistics()); - if (!OperatingSystem.IsMacOS() && !OperatingSystem.IsFreeBSD()) + if (!OperatingSystem.IsMacOS() && !OperatingSystem.IsIOS() && !OperatingSystem.IsTvOS() && !OperatingSystem.IsFreeBSD()) { // OSX and FreeBSD do not provide IPv6 stats. Assert.NotNull(gp.GetIPv6GlobalStatistics()); @@ -50,9 +50,71 @@ public void IPGlobalProperties_AccessAllMethods_NoErrors() Assert.NotNull(gp.GetUdpIPv6Statistics()); } + [Fact] + [PlatformSpecific(TestPlatforms.Android)] + public void IPGlobalProperties_AccessAllMethods_NoErrors_Android() + { + IPGlobalProperties gp = IPGlobalProperties.GetIPGlobalProperties(); + + Assert.NotNull(gp.GetIPv4GlobalStatistics()); + Assert.NotNull(gp.GetIPv6GlobalStatistics()); + + Assert.Throws(() => gp.GetActiveTcpConnections()); + Assert.Throws(() => gp.GetActiveTcpListeners()); + Assert.Throws(() => gp.GetActiveUdpListeners()); + Assert.Throws(() => gp.GetIcmpV4Statistics()); + Assert.Throws(() => gp.GetIcmpV6Statistics()); + Assert.Throws(() => gp.GetTcpIPv4Statistics()); + Assert.Throws(() => gp.GetTcpIPv6Statistics()); + Assert.Throws(() => gp.GetUdpIPv4Statistics()); + Assert.Throws(() => gp.GetUdpIPv6Statistics()); + } + + [Theory] + [InlineData(4)] + [InlineData(6)] + [PlatformSpecific(TestPlatforms.Android)] + public void IPGlobalProperties_IPv4_IPv6_NoErrors_Android(int ipVersion) + { + IPGlobalProperties gp = IPGlobalProperties.GetIPGlobalProperties(); + IPGlobalStatistics statistics = ipVersion switch { + 4 => gp.GetIPv4GlobalStatistics(), + 6 => gp.GetIPv6GlobalStatistics(), + _ => throw new ArgumentOutOfRangeException() + }; + + _log.WriteLine($"- IPv{ipVersion} statistics: -"); + _log.WriteLine($"Number of interfaces: {statistics.NumberOfInterfaces}"); + _log.WriteLine($"Number of IP addresses: {statistics.NumberOfIPAddresses}"); + + Assert.InRange(statistics.NumberOfInterfaces, 1, int.MaxValue); + Assert.InRange(statistics.NumberOfIPAddresses, 1, int.MaxValue); + + Assert.Throws(() => statistics.DefaultTtl); + Assert.Throws(() => statistics.ForwardingEnabled); + Assert.Throws(() => statistics.OutputPacketRequests); + Assert.Throws(() => statistics.OutputPacketRoutingDiscards); + Assert.Throws(() => statistics.OutputPacketsDiscarded); + Assert.Throws(() => statistics.OutputPacketsWithNoRoute); + Assert.Throws(() => statistics.PacketFragmentFailures); + Assert.Throws(() => statistics.PacketReassembliesRequired); + Assert.Throws(() => statistics.PacketReassemblyFailures); + Assert.Throws(() => statistics.PacketReassemblyTimeout); + Assert.Throws(() => statistics.PacketsFragmented); + Assert.Throws(() => statistics.PacketsReassembled); + Assert.Throws(() => statistics.ReceivedPackets); + Assert.Throws(() => statistics.ReceivedPacketsDelivered); + Assert.Throws(() => statistics.ReceivedPacketsDiscarded); + Assert.Throws(() => statistics.ReceivedPacketsForwarded); + Assert.Throws(() => statistics.ReceivedPacketsWithAddressErrors); + Assert.Throws(() => statistics.ReceivedPacketsWithHeadersErrors); + Assert.Throws(() => statistics.ReceivedPacketsWithUnknownProtocol); + Assert.Throws(() => statistics.NumberOfRoutes); + } + [Theory] [MemberData(nameof(Loopbacks))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/36890", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] + [SkipOnPlatform(TestPlatforms.Android, "Unsupported on Android")] public void IPGlobalProperties_TcpListeners_Succeed(IPAddress address) { using (var server = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)) @@ -78,7 +140,7 @@ public void IPGlobalProperties_TcpListeners_Succeed(IPAddress address) [Theory] [ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/36890", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] + [PlatformSpecific(~(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android))] [MemberData(nameof(Loopbacks))] public async Task IPGlobalProperties_TcpActiveConnections_Succeed(IPAddress address) { @@ -109,6 +171,7 @@ public async Task IPGlobalProperties_TcpActiveConnections_Succeed(IPAddress addr } [Fact] + [SkipOnPlatform(TestPlatforms.Android, "Unsupported on Android")] public void IPGlobalProperties_TcpActiveConnections_NotListening() { TcpConnectionInformation[] tcpCconnections = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections(); @@ -119,7 +182,6 @@ public void IPGlobalProperties_TcpActiveConnections_NotListening() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)] public async Task GetUnicastAddresses_NotEmpty() { IPGlobalProperties props = IPGlobalProperties.GetIPGlobalProperties(); diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Android.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Android.cs new file mode 100644 index 00000000000000..61e57c854aa479 --- /dev/null +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Android.cs @@ -0,0 +1,221 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; +using System.Net.Http.Functional.Tests; +using System.Net.Sockets; +using System.Net.Test.Common; +using System.Threading.Tasks; + +using Xunit; +using Xunit.Abstractions; + +namespace System.Net.NetworkInformation.Tests +{ + [PlatformSpecific(TestPlatforms.Android)] + public class IPInterfacePropertiesTest_Android + { + private readonly ITestOutputHelper _log; + + public IPInterfacePropertiesTest_Android(ITestOutputHelper output) + { + _log = output; + } + + [Fact] + public async Task IPInfoTest_AccessAllProperties_NoErrors() + { + await Task.Run(() => + { + foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) + { + _log.WriteLine("Nic: " + nic.Name); + _log.WriteLine("- Speed:" + nic.Speed); + Assert.Equal(-1, nic.Speed); + _log.WriteLine("- Supports IPv4: " + nic.Supports(NetworkInterfaceComponent.IPv4)); + _log.WriteLine("- Supports IPv6: " + nic.Supports(NetworkInterfaceComponent.IPv6)); + Assert.False(nic.IsReceiveOnly); + + IPInterfaceProperties ipProperties = nic.GetIPProperties(); + + Assert.NotNull(ipProperties); + + Assert.Throws(() => ipProperties.AnycastAddresses); + Assert.Throws(() => ipProperties.DhcpServerAddresses); + Assert.Throws(() => ipProperties.DnsAddresses); + Assert.Throws(() => ipProperties.DnsSuffix); + Assert.Throws(() => ipProperties.GatewayAddresses); + Assert.Throws(() => ipProperties.IsDnsEnabled); + Assert.Throws(() => ipProperties.IsDynamicDnsEnabled); + + Assert.NotNull(ipProperties.MulticastAddresses); + _log.WriteLine("- Multicast Addresses: " + ipProperties.MulticastAddresses.Count); + foreach (IPAddressInformation multi in ipProperties.MulticastAddresses) + { + _log.WriteLine("-- " + multi.Address.ToString()); + Assert.Throws(() => multi.IsDnsEligible); + Assert.Throws(() => multi.IsTransient); + } + + Assert.NotNull(ipProperties.UnicastAddresses); + _log.WriteLine("- Unicast Addresses: " + ipProperties.UnicastAddresses.Count); + foreach (UnicastIPAddressInformation uni in ipProperties.UnicastAddresses) + { + _log.WriteLine("-- " + uni.Address.ToString()); + Assert.Throws(() => uni.AddressPreferredLifetime); + Assert.Throws(() => uni.AddressValidLifetime); + Assert.Throws(() => uni.DhcpLeaseLifetime); + Assert.Throws(() => uni.DuplicateAddressDetectionState); + + Assert.NotNull(uni.IPv4Mask); + _log.WriteLine("--- IPv4 Mask: " + uni.IPv4Mask); + Assert.Throws(() => uni.IsDnsEligible); + Assert.Throws(() => uni.IsTransient); + Assert.Throws(() => uni.PrefixOrigin); + Assert.Throws(() => uni.SuffixOrigin); + + // Prefix Length + _log.WriteLine("--- PrefixLength: " + uni.PrefixLength); + Assert.True(uni.PrefixLength > 0); + Assert.True((uni.Address.AddressFamily == AddressFamily.InterNetwork ? 33 : 129) > uni.PrefixLength); + } + + Assert.Throws(() => ipProperties.WinsServersAddresses); + } + }).WaitAsync(TestHelper.PassingTestTimeout); + } + + [Fact] + public async Task IPInfoTest_AccessAllIPv4Properties_NoErrors() + { + await Task.Run(() => + { + foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) + { + _log.WriteLine("Nic: " + nic.Name); + + IPInterfaceProperties ipProperties = nic.GetIPProperties(); + + _log.WriteLine("IPv4 Properties:"); + + IPv4InterfaceProperties ipv4Properties = ipProperties.GetIPv4Properties(); + + _log.WriteLine("Index: " + ipv4Properties.Index); + Assert.Throws(() => ipv4Properties.IsAutomaticPrivateAddressingActive); + Assert.Throws(() => ipv4Properties.IsAutomaticPrivateAddressingEnabled); + Assert.Throws(() => ipv4Properties.IsDhcpEnabled); + Assert.Throws(() => ipv4Properties.IsForwardingEnabled); + _log.WriteLine("Mtu: " + ipv4Properties.Mtu); + Assert.Throws(() => ipv4Properties.UsesWins); + } + }).WaitAsync(TestHelper.PassingTestTimeout); + } + + [Fact] + public async Task IPInfoTest_AccessAllIPv6Properties_NoErrors() + { + await Task.Run(() => + { + foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) + { + _log.WriteLine("Nic: " + nic.Name); + + IPInterfaceProperties ipProperties = nic.GetIPProperties(); + + _log.WriteLine("IPv6 Properties:"); + + IPv6InterfaceProperties ipv6Properties = ipProperties.GetIPv6Properties(); + + if (ipv6Properties == null) + { + _log.WriteLine("IPv6Properties is null"); + continue; + } + + _log.WriteLine("Index: " + ipv6Properties.Index); + _log.WriteLine("Mtu: " + ipv6Properties.Mtu); + _log.WriteLine("Scope: " + ipv6Properties.GetScopeId(ScopeLevel.Link)); + } + }).WaitAsync(TestHelper.PassingTestTimeout); + } + + [Fact] + [Trait("IPv6", "true")] + public async Task IPv6ScopeId_AccessAllValues_Success() + { + await Task.Run(() => + { + Assert.True(Capability.IPv6Support()); + + foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) + { + _log.WriteLine("Nic: " + nic.Name); + + if (!nic.Supports(NetworkInterfaceComponent.IPv6)) + { + continue; + } + + IPInterfaceProperties ipProperties = nic.GetIPProperties(); + + IPv6InterfaceProperties ipv6Properties = ipProperties.GetIPv6Properties(); + + Array values = Enum.GetValues(typeof(ScopeLevel)); + foreach (ScopeLevel level in values) + { + _log.WriteLine("-- Level: " + level + "; " + ipv6Properties.GetScopeId(level)); + } + } + }).WaitAsync(TestHelper.PassingTestTimeout); + } + + [Fact] + [Trait("IPv4", "true")] + public async Task IPInfoTest_IPv4Loopback_ProperAddress() + { + await Task.Run(() => + { + Assert.True(Capability.IPv4Support()); + + _log.WriteLine("Loopback IPv4 index: " + NetworkInterface.LoopbackInterfaceIndex); + + NetworkInterface loopback = NetworkInterface.GetAllNetworkInterfaces().First(ni => ni.Name == "lo"); + Assert.NotNull(loopback); + + foreach (UnicastIPAddressInformation unicast in loopback.GetIPProperties().UnicastAddresses) + { + if (unicast.Address.Equals(IPAddress.Loopback)) + { + Assert.Equal(IPAddress.Parse("255.0.0.0"), unicast.IPv4Mask); + Assert.Equal(8, unicast.PrefixLength); + break; + } + } + }).WaitAsync(TestHelper.PassingTestTimeout); + } + + [Fact] + [Trait("IPv6", "true")] + public async Task IPInfoTest_IPv6Loopback_ProperAddress() + { + await Task.Run(() => + { + Assert.True(Capability.IPv6Support()); + + _log.WriteLine("Loopback IPv6 index: " + NetworkInterface.IPv6LoopbackInterfaceIndex); + + NetworkInterface loopback = NetworkInterface.GetAllNetworkInterfaces().First(ni => ni.Name == "lo"); + Assert.NotNull(loopback); + + foreach (UnicastIPAddressInformation unicast in loopback.GetIPProperties().UnicastAddresses) + { + if (unicast.Address.Equals(IPAddress.IPv6Loopback)) + { + Assert.Equal(128, unicast.PrefixLength); + break; + } + } + }).WaitAsync(TestHelper.PassingTestTimeout); + } + } +} diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs index 3455f06297d793..c022f74b2c234c 100644 --- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs @@ -20,7 +20,6 @@ public NetworkInterfaceBasicTest(ITestOutputHelper output) } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)] public void BasicTest_GetNetworkInterfaces_AtLeastOne() { Assert.NotEqual(0, NetworkInterface.GetAllNetworkInterfaces().Length); @@ -57,7 +56,7 @@ public void BasicTest_AccessInstanceProperties_NoExceptions() } [Fact] - [PlatformSpecific(TestPlatforms.Linux)] // Some APIs are not supported on Linux + [PlatformSpecific(TestPlatforms.Linux|TestPlatforms.Android)] // Some APIs are not supported on Linux and Android public void BasicTest_AccessInstanceProperties_NoExceptions_Linux() { foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) @@ -132,7 +131,6 @@ public void BasicTest_AccessInstanceProperties_NoExceptions_Bsd() [Fact] [Trait("IPv4", "true")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)] public void BasicTest_StaticLoopbackIndex_MatchesLoopbackNetworkInterface() { Assert.True(Capability.IPv4Support()); @@ -156,7 +154,6 @@ public void BasicTest_StaticLoopbackIndex_MatchesLoopbackNetworkInterface() [Fact] [Trait("IPv4", "true")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)] public void BasicTest_StaticLoopbackIndex_ExceptionIfV4NotSupported() { Assert.True(Capability.IPv4Support()); @@ -166,7 +163,6 @@ public void BasicTest_StaticLoopbackIndex_ExceptionIfV4NotSupported() [Fact] [Trait("IPv6", "true")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)] public void BasicTest_StaticIPv6LoopbackIndex_MatchesLoopbackNetworkInterface() { Assert.True(Capability.IPv6Support()); @@ -191,7 +187,6 @@ public void BasicTest_StaticIPv6LoopbackIndex_MatchesLoopbackNetworkInterface() [Fact] [Trait("IPv6", "true")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)] public void BasicTest_StaticIPv6LoopbackIndex_ExceptionIfV6NotSupported() { Assert.True(Capability.IPv6Support()); @@ -272,8 +267,6 @@ public void BasicTest_GetIPInterfaceStatistics_Success_Bsd() [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/36890", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void BasicTest_GetIsNetworkAvailable_Success() { Assert.True(NetworkInterface.GetIsNetworkAvailable()); @@ -285,7 +278,6 @@ public void BasicTest_GetIsNetworkAvailable_Success() [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on Browser, iOS, MacCatalyst, or tvOS.")] [InlineData(false)] [InlineData(true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)] public async Task NetworkInterface_LoopbackInterfaceIndex_MatchesReceivedPackets(bool ipv6) { using (var client = new Socket(SocketType.Dgram, ProtocolType.Udp)) diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs index 52aceb0d3f9c14..9b73374e99b267 100644 --- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs @@ -69,6 +69,17 @@ public void BasicTest_GetIPv4InterfaceStatistics_Success_Linux() } } + [Fact] + [PlatformSpecific(TestPlatforms.Android)] // This API is not supported on Android + public void BasicTest_GetIPv4InterfaceStatistics_NotSupported_Android() + { + // This API is not actually IPv4 specific. + foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) + { + Assert.Throws(() => nic.GetIPv4Statistics()); + } + } + [Fact] [PlatformSpecific(TestPlatforms.OSX)] // Some APIs are not supported on OSX public void BasicTest_GetIPv4InterfaceStatistics_Success_OSX() diff --git a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.PingUtility.cs b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.PingUtility.cs index 74e85ca493a24e..78a2a4429fdc72 100644 --- a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.PingUtility.cs +++ b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.PingUtility.cs @@ -45,15 +45,15 @@ private PingReply SendWithPingUtility(IPAddress address, byte[] buffer, int time using (Process p = GetPingProcess(address, buffer, timeout, options)) { p.Start(); - if (!p.WaitForExit(timeout) || p.ExitCode == 1 || p.ExitCode == 2) + if (!p.WaitForExit(timeout)) { return CreatePingReply(IPStatus.TimedOut); } try { - string output = p.StandardOutput.ReadToEnd(); - return ParsePingUtilityOutput(address, output); + string stdout = p.StandardOutput.ReadToEnd(); + return ParsePingUtilityOutput(address, p.ExitCode, stdout); } catch (Exception) { @@ -82,16 +82,10 @@ private async Task SendWithPingUtilityAsync(IPAddress address, byte[] return CreatePingReply(IPStatus.TimedOut); } - if (p.ExitCode == 1 || p.ExitCode == 2) - { - // Throw timeout for known failure return codes from ping functions. - return CreatePingReply(IPStatus.TimedOut); - } - try { - string output = await p.StandardOutput.ReadToEndAsync().ConfigureAwait(false); - return ParsePingUtilityOutput(address, output); + string stdout = await p.StandardOutput.ReadToEndAsync().ConfigureAwait(false); + return ParsePingUtilityOutput(address, p.ExitCode, stdout); } catch (Exception) { @@ -101,15 +95,49 @@ private async Task SendWithPingUtilityAsync(IPAddress address, byte[] } } - private PingReply ParsePingUtilityOutput(IPAddress address, string output) + private static PingReply ParsePingUtilityOutput(IPAddress address, int exitCode, string stdout) { - long rtt = UnixCommandLinePing.ParseRoundTripTime(output); - return new PingReply( - address, - null, // Ping utility cannot accommodate these, return null to indicate they were ignored. - IPStatus.Success, - rtt, - Array.Empty()); // Ping utility doesn't deliver this info. + // Throw timeout for known failure return codes from ping functions. + if (exitCode == 1 || exitCode == 2) + { + // TTL exceeded may have occured + if (TryParseTtlExceeded(stdout, out PingReply? reply)) + { + return reply!; + } + + // otherwise assume timeout + return CreatePingReply(IPStatus.TimedOut); + } + + // On success, report RTT + long rtt = UnixCommandLinePing.ParseRoundTripTime(stdout); + return CreatePingReply(IPStatus.Success, address, rtt); + } + + private static bool TryParseTtlExceeded(string stdout, out PingReply? reply) + { + reply = null; + if (!stdout.Contains("Time to live exceeded", StringComparison.Ordinal)) + { + return false; + } + + // look for address in: + // - "From 172.21.64.1 icmp_seq=1 Time to live exceeded" + // - "From 172.21.64.1: icmp_seq=1 Time to live exceeded" + int addressStart = stdout.IndexOf("From ", StringComparison.Ordinal) + 5; + int addressLength = stdout.AsSpan(Math.Max(addressStart, 0)).IndexOfAny(' ', ':'); + IPAddress? address; + if (addressStart < 5 || addressLength <= 0 || !IPAddress.TryParse(stdout.AsSpan(addressStart, addressLength), out address)) + { + // failed to parse source address (which in case of TTL is different than the original + // destination address), fallback to all 0 + address = new IPAddress(0); + } + + reply = CreatePingReply(IPStatus.TimeExceeded, address); + return true; } } } diff --git a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs index 341c328265cbe0..107517aaab780d 100644 --- a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs +++ b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs @@ -29,8 +29,8 @@ private unsafe SocketConfig GetSocketConfig(IPAddress address, byte[] buffer, in bool ipv4 = address.AddressFamily == AddressFamily.InterNetwork; bool sendIpHeader = ipv4 && options != null && SendIpHeader; - if (sendIpHeader) - { + if (sendIpHeader) + { iph.VersionAndLength = 0x45; // On OSX this strangely must be host byte order. iph.TotalLength = (ushort)(sizeof(IpHeader) + checked(sizeof(IcmpHeader) + buffer.Length)); @@ -42,7 +42,7 @@ private unsafe SocketConfig GetSocketConfig(IPAddress address, byte[] buffer, in #pragma warning restore 618 // No need to fill in SourceAddress or checksum. // If left blank, kernel will fill it in - at least on OSX. - } + } return new SocketConfig( new IPEndPoint(address, 0), timeout, options, @@ -260,11 +260,11 @@ await socket.SendToAsync( } } - private static PingReply CreatePingReply(IPStatus status) + private static PingReply CreatePingReply(IPStatus status, IPAddress? address = null, long rtt = 0) { // Documentation indicates that you should only pay attention to the IPStatus value when // its value is not "Success", but the rest of these values match that of the Windows implementation. - return new PingReply(new IPAddress(0), null, status, 0, Array.Empty()); + return new PingReply(address ?? new IPAddress(0), null, status, rtt, Array.Empty()); } #if DEBUG diff --git a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs index b206e1e0f165d9..32ef250d8657eb 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs @@ -878,7 +878,9 @@ public async Task SendPingToExternalHostWithLowTtlTest() options.Ttl = 1; // This should always fail unless host is one IP hop away. pingReply = await ping.SendPingAsync(host, TestSettings.PingTimeout, TestSettings.PayloadAsBytesShort, options); - Assert.NotEqual(IPStatus.Success, pingReply.Status); + + Assert.True(pingReply.Status == IPStatus.TimeExceeded || pingReply.Status == IPStatus.TtlExpired); + Assert.NotEqual(IPAddress.Any, pingReply.Address); } [Fact] diff --git a/src/libraries/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs b/src/libraries/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs index 0d686f9a8ee4ad..b34f45bdd881f7 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Xunit; +using Microsoft.DotNet.XUnitExtensions; namespace System.Net.NetworkInformation.Tests { @@ -19,7 +20,7 @@ public class UnixPingUtilityTests { private const int IcmpHeaderLengthInBytes = 8; - [Theory] + [ConditionalTheory] [InlineData(0)] [InlineData(100)] [InlineData(1000)] @@ -32,13 +33,26 @@ public static void TimeoutIsRespected(int timeout) p.StartInfo.RedirectStandardError = true; p.StartInfo.RedirectStandardOutput = true; + bool destinationNetUnreachable = false; + p.OutputDataReceived += delegate (object sendingProcess, DataReceivedEventArgs outputLine) + { + if (outputLine.Data?.Contains("Destination Net Unreachable", StringComparison.OrdinalIgnoreCase) == true) + destinationNetUnreachable = true; + }; + Stopwatch stopWatch = Stopwatch.StartNew(); p.Start(); + p.BeginOutputReadLine(); p.WaitForExit(); - //ensure that the process takes longer than or equal to 'timeout' - Assert.True(stopWatch.ElapsedMilliseconds >= timeout); + if (destinationNetUnreachable) + { + throw new SkipTestException($"Network doesn't route {TestSettings.UnreachableAddress}, skipping test."); + } + + //ensure that the process takes longer than or within 10ms of 'timeout', with a 5s maximum + Assert.InRange(stopWatch.ElapsedMilliseconds, timeout - 10, 5000); } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] diff --git a/src/libraries/System.Net.Quic/ref/System.Net.Quic.cs b/src/libraries/System.Net.Quic/ref/System.Net.Quic.cs index 790ad3feb2939d..be0b43d4200f37 100644 --- a/src/libraries/System.Net.Quic/ref/System.Net.Quic.cs +++ b/src/libraries/System.Net.Quic/ref/System.Net.Quic.cs @@ -109,6 +109,7 @@ public override void Flush() { } public override void SetLength(long value) { } public void Shutdown() { } public System.Threading.Tasks.ValueTask ShutdownCompleted(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public System.Threading.Tasks.ValueTask WaitForWriteCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override void Write(byte[] buffer, int offset, int count) { } public override void Write(System.ReadOnlySpan buffer) { } public System.Threading.Tasks.ValueTask WriteAsync(System.Buffers.ReadOnlySequence buffers, bool endStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } diff --git a/src/libraries/System.Net.Quic/src/System.Net.Quic.csproj b/src/libraries/System.Net.Quic/src/System.Net.Quic.csproj index 4549842ee8e681..58f158d9a6cef5 100644 --- a/src/libraries/System.Net.Quic/src/System.Net.Quic.csproj +++ b/src/libraries/System.Net.Quic/src/System.Net.Quic.csproj @@ -100,7 +100,8 @@ + GeneratePathProperty="true" + Condition="'$(DotNetBuildFromSource)' != 'true'" /> @@ -128,7 +129,7 @@ + ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'x86') and '$(DotNetBuildFromSource)' != 'true'"> diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/Mock/MockConnection.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/Mock/MockConnection.cs index 7487a958db91f9..e409b962d0296e 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/Mock/MockConnection.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/Mock/MockConnection.cs @@ -8,6 +8,8 @@ using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; +using System.Collections.Concurrent; +using System.Collections.Generic; namespace System.Net.Quic.Implementations.Mock { @@ -244,6 +246,9 @@ internal MockStream OpenStream(long streamId, bool bidirectional) } MockStream.StreamState streamState = new MockStream.StreamState(streamId, bidirectional); + // TODO Streams are never removed from a connection. Consider cleaning up in the future. + state._streams[streamState._streamId] = streamState; + Channel streamChannel = _isClient ? state._clientInitiatedStreamChannel : state._serverInitiatedStreamChannel; streamChannel.Writer.TryWrite(streamState); @@ -320,6 +325,12 @@ internal override ValueTask CloseAsync(long errorCode, CancellationToken cancell state._serverErrorCode = errorCode; DrainAcceptQueue(errorCode, -1); } + + foreach (KeyValuePair kvp in state._streams) + { + kvp.Value._outboundWritesCompletedTcs.TrySetException(new QuicConnectionAbortedException(errorCode)); + kvp.Value._inboundWritesCompletedTcs.TrySetException(new QuicConnectionAbortedException(errorCode)); + } } Dispose(); @@ -474,8 +485,9 @@ public PeerStreamLimit(int maxUnidirectional, int maxBidirectional) internal sealed class ConnectionState { public readonly SslApplicationProtocol _applicationProtocol; - public Channel _clientInitiatedStreamChannel; - public Channel _serverInitiatedStreamChannel; + public readonly Channel _clientInitiatedStreamChannel; + public readonly Channel _serverInitiatedStreamChannel; + public readonly ConcurrentDictionary _streams; public PeerStreamLimit? _clientStreamLimit; public PeerStreamLimit? _serverStreamLimit; @@ -490,6 +502,7 @@ public ConnectionState(SslApplicationProtocol applicationProtocol) _clientInitiatedStreamChannel = Channel.CreateUnbounded(); _serverInitiatedStreamChannel = Channel.CreateUnbounded(); _clientErrorCode = _serverErrorCode = -1; + _streams = new ConcurrentDictionary(); } } } diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/Mock/MockStream.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/Mock/MockStream.cs index 588da85d32f420..fbace756f2fbda 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/Mock/MockStream.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/Mock/MockStream.cs @@ -164,6 +164,7 @@ internal override async ValueTask WriteAsync(ReadOnlyMemory buffer, bool e if (endStream) { streamBuffer.EndWrite(); + WritesCompletedTcs.TrySetResult(); } } @@ -206,10 +207,12 @@ internal override void AbortRead(long errorCode) if (_isInitiator) { _streamState._outboundWriteErrorCode = errorCode; + _streamState._inboundWritesCompletedTcs.TrySetException(new QuicStreamAbortedException(errorCode)); } else { _streamState._inboundWriteErrorCode = errorCode; + _streamState._outboundWritesCompletedTcs.TrySetException(new QuicOperationAbortedException()); } ReadStreamBuffer?.AbortRead(); @@ -220,10 +223,12 @@ internal override void AbortWrite(long errorCode) if (_isInitiator) { _streamState._outboundReadErrorCode = errorCode; + _streamState._outboundWritesCompletedTcs.TrySetException(new QuicStreamAbortedException(errorCode)); } else { _streamState._inboundReadErrorCode = errorCode; + _streamState._inboundWritesCompletedTcs.TrySetException(new QuicOperationAbortedException()); } WriteStreamBuffer?.EndWrite(); @@ -251,6 +256,8 @@ internal override void Shutdown() { _connection.LocalStreamLimit!.Bidirectional.Decrement(); } + + WritesCompletedTcs.TrySetResult(); } private void CheckDisposed() @@ -283,6 +290,17 @@ public override ValueTask DisposeAsync() return default; } + internal override ValueTask WaitForWriteCompletionAsync(CancellationToken cancellationToken = default) + { + CheckDisposed(); + + return new ValueTask(WritesCompletedTcs.Task); + } + + private TaskCompletionSource WritesCompletedTcs => _isInitiator + ? _streamState._outboundWritesCompletedTcs + : _streamState._inboundWritesCompletedTcs; + internal sealed class StreamState { public readonly long _streamId; @@ -292,6 +310,8 @@ internal sealed class StreamState public long _inboundReadErrorCode; public long _outboundWriteErrorCode; public long _inboundWriteErrorCode; + public TaskCompletionSource _outboundWritesCompletedTcs; + public TaskCompletionSource _inboundWritesCompletedTcs; private const int InitialBufferSize = #if DEBUG @@ -310,6 +330,8 @@ public StreamState(long streamId, bool bidirectional) _streamId = streamId; _outboundStreamBuffer = new StreamBuffer(initialBufferSize: InitialBufferSize, maxBufferSize: MaxBufferSize); _inboundStreamBuffer = (bidirectional ? new StreamBuffer() : null); + _outboundWritesCompletedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + _inboundWritesCompletedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); } } } diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs index e2b46f2bb89edb..bbad4f0d3dfc62 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Internal/MsQuicApi.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using static System.Net.Quic.Implementations.MsQuic.Internal.MsQuicNativeMethods; @@ -117,14 +118,28 @@ private MsQuicApi(NativeApi* vtable) Registration = handle; } - internal static MsQuicApi Api { get; } = null!; + private static readonly delegate* unmanaged[Cdecl] MsQuicOpenVersion; + private static readonly delegate* unmanaged[Cdecl] MsQuicClose; + + private static readonly Lazy s_api = new Lazy(AllocateMsQuicApi); + internal static MsQuicApi Api => s_api.Value; internal static bool IsQuicSupported { get; } private const int MsQuicVersion = 1; +#pragma warning disable CA1810 // Initialize all static fields in 'MsQuicApi' when those fields are declared and remove the explicit static constructor static MsQuicApi() { + // Completely disabled QUIC. + IsQuicSupported = false; + if (NetEventSource.Log.IsEnabled()) + { + NetEventSource.Info(null, $"QUIC is completely disabled in .NET 6 due to critical defects fixed in later versions."); + } + return; + +#pragma warning disable CS0162 // Unreachable code detected -- leaving the original code intact, instead of removing big chunks of code transitively if (OperatingSystem.IsWindows() && !IsWindowsVersionSupported()) { if (NetEventSource.Log.IsEnabled()) @@ -135,30 +150,61 @@ static MsQuicApi() return; } - if (NativeLibrary.TryLoad(Interop.Libraries.MsQuic, typeof(MsQuicApi).Assembly, DllImportSearchPath.AssemblyDirectory, out IntPtr msQuicHandle)) + // Windows ships msquic in the assembly directory. Non-Windows relies an the package being installed on the system. + DllImportSearchPath? searchPath = OperatingSystem.IsWindows() ? DllImportSearchPath.AssemblyDirectory : null; + if (!NativeLibrary.TryLoad(Interop.Libraries.MsQuic, typeof(MsQuicApi).Assembly, searchPath, out IntPtr msQuicHandle)) { - try - { - if (NativeLibrary.TryGetExport(msQuicHandle, "MsQuicOpenVersion", out IntPtr msQuicOpenVersionAddress)) - { - delegate* unmanaged[Cdecl] msQuicOpenVersion = - (delegate* unmanaged[Cdecl])msQuicOpenVersionAddress; - uint status = msQuicOpenVersion(MsQuicVersion, out NativeApi* vtable); - if (MsQuicStatusHelper.SuccessfulStatusCode(status)) - { - IsQuicSupported = true; - Api = new MsQuicApi(vtable); - } - } - } - finally + // MsQuic library not loaded + return; + } + + MsQuicOpenVersion = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(msQuicHandle, nameof(MsQuicOpenVersion)); + MsQuicClose = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(msQuicHandle, nameof(MsQuicClose)); + + if (!TryOpenMsQuic(out NativeApi* apiTable, out _)) + { + // Different version of the library. + return; + } + + IsQuicSupported = true; + + // Gracefully close the API table to free resources. The API table will be allocated lazily again if needed + MsQuicClose(apiTable); + } +#pragma warning restore CA1810, CS0162 + + private static MsQuicApi AllocateMsQuicApi() + { + Debug.Assert(IsQuicSupported); + + if (!TryOpenMsQuic(out NativeApi* apiTable, out uint openStatus)) + { + QuicExceptionHelpers.ThrowIfFailed(openStatus); + } + + return new MsQuicApi(apiTable); + } + + private static bool TryOpenMsQuic(out NativeApi* apiTable, out uint openStatus) + { + Debug.Assert(MsQuicOpenVersion != null); + + NativeApi* table = null; + openStatus = MsQuicOpenVersion((uint)MsQuicVersion, &table); + if (!MsQuicStatusHelper.SuccessfulStatusCode(openStatus)) + { + if (NetEventSource.Log.IsEnabled()) { - if (!IsQuicSupported) - { - NativeLibrary.Free(msQuicHandle); - } + NetEventSource.Info(null, $"MsQuicOpenVersion(version: {MsQuicVersion}) returned {MsQuicStatusCodes.GetError(openStatus)} status code."); } + + apiTable = null; + return false; } + + apiTable = table; + return true; } private static bool IsWindowsVersionSupported() => OperatingSystem.IsWindowsVersionAtLeast(MinWindowsVersion.Major, diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicConnection.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicConnection.cs index ddd002d59d2c2e..e67f2ee60846f3 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicConnection.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicConnection.cs @@ -283,6 +283,11 @@ private static uint HandleEventShutdownInitiatedByTransport(State state, ref Con state.ConnectTcs = null; } + // To throw QuicConnectionAbortedException (instead of QuicOperationAbortedException) out of AcceptStreamAsync() since + // it wasn't our side who shutdown the connection. + // We should rather keep the Status and propagate it either in a different exception or as a different field of QuicConnectionAbortedException. + // See: https://github.com/dotnet/runtime/issues/60133 + state.AbortErrorCode = 0; state.AcceptQueue.Writer.TryComplete(); return MsQuicStatusCodes.Success; } diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs index bbaf9c4ed41bb7..54f0ed3f4ec85b 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs @@ -69,6 +69,11 @@ private sealed class State // Resettable completions to be used for multiple calls to send. public readonly ResettableCompletionSource SendResettableCompletionSource = new ResettableCompletionSource(); + public ShutdownWriteState ShutdownWriteState; + + // Set once writes have been shutdown. + public readonly TaskCompletionSource ShutdownWriteCompletionSource = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + public ShutdownState ShutdownState; // The value makes sure that we release the handles only once. public int ShutdownDone; @@ -95,6 +100,14 @@ public void Cleanup() // inbound. internal MsQuicStream(MsQuicConnection.State connectionState, SafeMsQuicStreamHandle streamHandle, QUIC_STREAM_OPEN_FLAGS flags) { + if (!connectionState.TryAddStream(this)) + { + throw new ObjectDisposedException(nameof(QuicConnection)); + } + // this assignment should be done before SetCallbackHandlerDelegate to prevent NRE in HandleEventConnectionClose + // but after TryAddStream to prevent unnecessary RemoveStream in finalizer + _state.ConnectionState = connectionState; + _state.Handle = streamHandle; _canRead = true; _canWrite = !flags.HasFlag(QUIC_STREAM_OPEN_FLAGS.UNIDIRECTIONAL); @@ -117,14 +130,6 @@ internal MsQuicStream(MsQuicConnection.State connectionState, SafeMsQuicStreamHa throw; } - if (!connectionState.TryAddStream(this)) - { - _state.StateGCHandle.Free(); - throw new ObjectDisposedException(nameof(QuicConnection)); - } - - _state.ConnectionState = connectionState; - _state.TraceId = MsQuicTraceHelper.GetTraceId(_state.Handle); if (NetEventSource.Log.IsEnabled()) { @@ -140,6 +145,14 @@ internal MsQuicStream(MsQuicConnection.State connectionState, QUIC_STREAM_OPEN_F { Debug.Assert(connectionState.Handle != null); + if (!connectionState.TryAddStream(this)) + { + throw new ObjectDisposedException(nameof(QuicConnection)); + } + // this assignment should be done before StreamOpenDelegate to prevent NRE in HandleEventConnectionClose + // but after TryAddStream to prevent unnecessary RemoveStream in finalizer + _state.ConnectionState = connectionState; + _canRead = !flags.HasFlag(QUIC_STREAM_OPEN_FLAGS.UNIDIRECTIONAL); _canWrite = true; @@ -170,15 +183,6 @@ internal MsQuicStream(MsQuicConnection.State connectionState, QUIC_STREAM_OPEN_F throw; } - if (!connectionState.TryAddStream(this)) - { - _state.Handle?.Dispose(); - _state.StateGCHandle.Free(); - throw new ObjectDisposedException(nameof(QuicConnection)); - } - - _state.ConnectionState = connectionState; - _state.TraceId = MsQuicTraceHelper.GetTraceId(_state.Handle); if (NetEventSource.Log.IsEnabled()) { @@ -265,7 +269,7 @@ internal override async ValueTask WriteAsync(ReadOnlySequence buffers, boo { ThrowIfDisposed(); - using CancellationTokenRegistration registration = HandleWriteStartState(cancellationToken); + using CancellationTokenRegistration registration = HandleWriteStartState(buffers.IsEmpty, cancellationToken); await SendReadOnlySequenceAsync(buffers, endStream ? QUIC_SEND_FLAGS.FIN : QUIC_SEND_FLAGS.NONE).ConfigureAwait(false); @@ -281,7 +285,7 @@ internal override async ValueTask WriteAsync(ReadOnlyMemory { ThrowIfDisposed(); - using CancellationTokenRegistration registration = HandleWriteStartState(cancellationToken); + using CancellationTokenRegistration registration = HandleWriteStartState(buffers.IsEmpty, cancellationToken); await SendReadOnlyMemoryListAsync(buffers, endStream ? QUIC_SEND_FLAGS.FIN : QUIC_SEND_FLAGS.NONE).ConfigureAwait(false); @@ -292,20 +296,20 @@ internal override async ValueTask WriteAsync(ReadOnlyMemory buffer, bool e { ThrowIfDisposed(); - using CancellationTokenRegistration registration = HandleWriteStartState(cancellationToken); + using CancellationTokenRegistration registration = HandleWriteStartState(buffer.IsEmpty, cancellationToken); await SendReadOnlyMemoryAsync(buffer, endStream ? QUIC_SEND_FLAGS.FIN : QUIC_SEND_FLAGS.NONE).ConfigureAwait(false); HandleWriteCompletedState(); } - private CancellationTokenRegistration HandleWriteStartState(CancellationToken cancellationToken) + private CancellationTokenRegistration HandleWriteStartState(bool emptyBuffer, CancellationToken cancellationToken) { if (_state.SendState == SendState.Closed) { throw new InvalidOperationException(SR.net_quic_writing_notallowed); } - else if ( _state.SendState == SendState.Aborted) + if (_state.SendState == SendState.Aborted) { if (_state.SendErrorCode != -1) { @@ -363,10 +367,14 @@ private CancellationTokenRegistration HandleWriteStartState(CancellationToken ca throw new OperationCanceledException(SR.net_quic_sending_aborted); } - else if (_state.SendState == SendState.ConnectionClosed) + if (_state.SendState == SendState.ConnectionClosed) { throw GetConnectionAbortedException(_state); } + + // Change the state in the same lock where we check for final states to prevent coming back from Aborted/ConnectionClosed. + Debug.Assert(_state.SendState != SendState.Pending); + _state.SendState = emptyBuffer ? SendState.Finished : SendState.Pending; } return registration; @@ -574,12 +582,26 @@ internal override void AbortWrite(long errorCode) return; } + bool shouldComplete = false; + lock (_state) { if (_state.SendState < SendState.Aborted) { _state.SendState = SendState.Aborted; } + + if (_state.ShutdownWriteState == ShutdownWriteState.None) + { + _state.ShutdownWriteState = ShutdownWriteState.Canceled; + shouldComplete = true; + } + } + + if (shouldComplete) + { + _state.ShutdownWriteCompletionSource.SetException( + ExceptionDispatchInfo.SetCurrentStackTrace(new QuicOperationAbortedException("Write was aborted."))); } StartShutdown(QUIC_STREAM_SHUTDOWN_FLAGS.ABORT_SEND, errorCode); @@ -626,13 +648,33 @@ internal override async ValueTask ShutdownCompleted(CancellationToken cancellati await _state.ShutdownCompletionSource.Task.ConfigureAwait(false); } + internal override ValueTask WaitForWriteCompletionAsync(CancellationToken cancellationToken = default) + { + // TODO: What should happen if this is called for a unidirectional stream and there are no writes? + + ThrowIfDisposed(); + + lock (_state) + { + if (_state.ShutdownWriteState == ShutdownWriteState.ConnectionClosed) + { + throw GetConnectionAbortedException(_state); + } + } + + return new ValueTask(_state.ShutdownWriteCompletionSource.Task.WaitAsync(cancellationToken)); + } + internal override void Shutdown() { ThrowIfDisposed(); lock (_state) { - _state.SendState = SendState.Finished; + if (_state.SendState < SendState.Finished) + { + _state.SendState = SendState.Finished; + } } // it is ok to send shutdown several times, MsQuic will ignore it @@ -855,6 +897,11 @@ private static uint HandleEvent(State state, ref StreamEvent evt) // Peer has stopped receiving data, don't send anymore. case QUIC_STREAM_EVENT_TYPE.PEER_RECEIVE_ABORTED: return HandleEventPeerRecvAborted(state, ref evt); + // Occurs when shutdown is completed for the send side. + // This only happens for shutdown on sending, not receiving + // Receive shutdown can only be abortive. + case QUIC_STREAM_EVENT_TYPE.SEND_SHUTDOWN_COMPLETE: + return HandleEventSendShutdownComplete(state, ref evt); // Shutdown for both sending and receiving is completed. case QUIC_STREAM_EVENT_TYPE.SHUTDOWN_COMPLETE: return HandleEventShutdownComplete(state, ref evt); @@ -987,23 +1034,37 @@ private static unsafe uint HandleEventRecv(State state, ref StreamEvent evt) private static uint HandleEventPeerRecvAborted(State state, ref StreamEvent evt) { - bool shouldComplete = false; + bool shouldSendComplete = false; + bool shouldShutdownWriteComplete = false; lock (state) { if (state.SendState == SendState.None || state.SendState == SendState.Pending) { - shouldComplete = true; + shouldSendComplete = true; + } + + if (state.ShutdownWriteState == ShutdownWriteState.None) + { + state.ShutdownWriteState = ShutdownWriteState.Canceled; + shouldShutdownWriteComplete = true; } + state.SendState = SendState.Aborted; state.SendErrorCode = (long)evt.Data.PeerReceiveAborted.ErrorCode; } - if (shouldComplete) + if (shouldSendComplete) { state.SendResettableCompletionSource.CompleteException( ExceptionDispatchInfo.SetCurrentStackTrace(new QuicStreamAbortedException(state.SendErrorCode))); } + if (shouldShutdownWriteComplete) + { + state.ShutdownWriteCompletionSource.SetException( + ExceptionDispatchInfo.SetCurrentStackTrace(new QuicStreamAbortedException(state.SendErrorCode))); + } + return MsQuicStatusCodes.Success; } @@ -1015,6 +1076,38 @@ private static uint HandleEventStartComplete(State state, ref StreamEvent evt) return MsQuicStatusCodes.Success; } + private static uint HandleEventSendShutdownComplete(State state, ref StreamEvent evt) + { + // Graceful will be false in three situations: + // 1. The peer aborted reads and the PEER_RECEIVE_ABORTED event was raised. + // ShutdownWriteCompletionSource is already complete with an error. + // 2. We aborted writes. + // ShutdownWriteCompletionSource is already complete with an error. + // 3. The connection was closed. + // SHUTDOWN_COMPLETE event will be raised immediately after this event. It will handle completing with an error. + // + // Only use this event with sends gracefully completed. + if (evt.Data.SendShutdownComplete.Graceful != 0) + { + bool shouldComplete = false; + lock (state) + { + if (state.ShutdownWriteState == ShutdownWriteState.None) + { + state.ShutdownWriteState = ShutdownWriteState.Finished; + shouldComplete = true; + } + } + + if (shouldComplete) + { + state.ShutdownWriteCompletionSource.SetResult(); + } + } + + return MsQuicStatusCodes.Success; + } + private static uint HandleEventShutdownComplete(State state, ref StreamEvent evt) { StreamEventDataShutdownComplete shutdownCompleteEvent = evt.Data.ShutdownComplete; @@ -1025,6 +1118,7 @@ private static uint HandleEventShutdownComplete(State state, ref StreamEvent evt } bool shouldReadComplete = false; + bool shouldShutdownWriteComplete = false; bool shouldShutdownComplete = false; lock (state) @@ -1034,6 +1128,15 @@ private static uint HandleEventShutdownComplete(State state, ref StreamEvent evt shouldReadComplete = CleanupReadStateAndCheckPending(state, ReadState.ReadsCompleted); + if (state.ShutdownWriteState == ShutdownWriteState.None) + { + // TODO: We can get to this point if the stream is unidirectional and there are no writes. + // Consider what is the best behavior here with write shutdown and the read side of + // unidirecitonal streams in the future. + state.ShutdownWriteState = ShutdownWriteState.Finished; + shouldShutdownWriteComplete = true; + } + if (state.ShutdownState == ShutdownState.None) { state.ShutdownState = ShutdownState.Finished; @@ -1046,6 +1149,11 @@ private static uint HandleEventShutdownComplete(State state, ref StreamEvent evt state.ReceiveResettableCompletionSource.Complete(0); } + if (shouldShutdownWriteComplete) + { + state.ShutdownWriteCompletionSource.SetResult(); + } + if (shouldShutdownComplete) { state.ShutdownCompletionSource.SetResult(); @@ -1157,12 +1265,6 @@ private unsafe ValueTask SendReadOnlyMemoryAsync( ReadOnlyMemory buffer, QUIC_SEND_FLAGS flags) { - lock (_state) - { - Debug.Assert(_state.SendState != SendState.Pending); - _state.SendState = buffer.IsEmpty ? SendState.Finished : SendState.Pending; - } - if (buffer.IsEmpty) { if ((flags & QUIC_SEND_FLAGS.FIN) == QUIC_SEND_FLAGS.FIN) @@ -1211,13 +1313,6 @@ private unsafe ValueTask SendReadOnlySequenceAsync( ReadOnlySequence buffers, QUIC_SEND_FLAGS flags) { - - lock (_state) - { - Debug.Assert(_state.SendState != SendState.Pending); - _state.SendState = buffers.IsEmpty ? SendState.Finished : SendState.Pending; - } - if (buffers.IsEmpty) { if ((flags & QUIC_SEND_FLAGS.FIN) == QUIC_SEND_FLAGS.FIN) @@ -1281,12 +1376,6 @@ private unsafe ValueTask SendReadOnlyMemoryListAsync( ReadOnlyMemory> buffers, QUIC_SEND_FLAGS flags) { - lock (_state) - { - Debug.Assert(_state.SendState != SendState.Pending); - _state.SendState = buffers.IsEmpty ? SendState.Finished : SendState.Pending; - } - if (buffers.IsEmpty) { if ((flags & QUIC_SEND_FLAGS.FIN) == QUIC_SEND_FLAGS.FIN) @@ -1374,6 +1463,7 @@ private static uint HandleEventConnectionClose(State state) bool shouldCompleteRead = false; bool shouldCompleteSend = false; + bool shouldCompleteShutdownWrite = false; bool shouldCompleteShutdown = false; lock (state) @@ -1386,6 +1476,12 @@ private static uint HandleEventConnectionClose(State state) } state.SendState = SendState.ConnectionClosed; + if (state.ShutdownWriteState == ShutdownWriteState.None) + { + shouldCompleteShutdownWrite = true; + } + state.ShutdownWriteState = ShutdownWriteState.ConnectionClosed; + if (state.ShutdownState == ShutdownState.None) { shouldCompleteShutdown = true; @@ -1405,6 +1501,12 @@ private static uint HandleEventConnectionClose(State state) ExceptionDispatchInfo.SetCurrentStackTrace(GetConnectionAbortedException(state))); } + if (shouldCompleteShutdownWrite) + { + state.ShutdownWriteCompletionSource.SetException( + ExceptionDispatchInfo.SetCurrentStackTrace(GetConnectionAbortedException(state))); + } + if (shouldCompleteShutdown) { state.ShutdownCompletionSource.SetException( @@ -1506,6 +1608,14 @@ private enum ReadState Closed } + private enum ShutdownWriteState + { + None = 0, + Canceled, + Finished, + ConnectionClosed + } + private enum ShutdownState { None = 0, diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/QuicStreamProvider.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/QuicStreamProvider.cs index 66c9a8b6e51c2d..215ce1304c1a4d 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/QuicStreamProvider.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/QuicStreamProvider.cs @@ -47,6 +47,8 @@ internal abstract class QuicStreamProvider : IDisposable, IAsyncDisposable internal abstract ValueTask ShutdownCompleted(CancellationToken cancellationToken = default); + internal abstract ValueTask WaitForWriteCompletionAsync(CancellationToken cancellationToken = default); + internal abstract void Shutdown(); internal abstract void Flush(); diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs index 8a6dbe496ed4a4..912d32c9ad889c 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs @@ -117,6 +117,8 @@ public override int WriteTimeout public ValueTask ShutdownCompleted(CancellationToken cancellationToken = default) => _provider.ShutdownCompleted(cancellationToken); + public ValueTask WaitForWriteCompletionAsync(CancellationToken cancellationToken = default) => _provider.WaitForWriteCompletionAsync(cancellationToken); + public void Shutdown() => _provider.Shutdown(); protected override void Dispose(bool disposing) diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs index 9e3cc64cae132d..d66d9fd752abeb 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs @@ -104,7 +104,7 @@ public async Task ConnectWithCertificateChain() } [Fact] - [PlatformSpecific(TestPlatforms.Windows)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/64944", TestPlatforms.Windows)] public async Task UntrustedClientCertificateFails() { var listenerOptions = new QuicListenerOptions(); @@ -330,9 +330,9 @@ public async Task ConnectWithCertificateForLoopbackIP_IndicatesExpectedError(str } [Theory] - [PlatformSpecific(TestPlatforms.Windows)] [InlineData(true)] // [InlineData(false)] [ActiveIssue("https://github.com/dotnet/runtime/issues/57308")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/64944", TestPlatforms.Windows)] public async Task ConnectWithClientCertificate(bool sendCerttificate) { bool clientCertificateOK = false; diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs index 098bd4d2af1d2f..ed371262c924c2 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs @@ -769,6 +769,230 @@ await RunClientServer( } ); } + + [Fact] + public async Task WaitForWriteCompletionAsync_ClientReadAborted_Throws() + { + const int ExpectedErrorCode = 0xfffffff; + + TaskCompletionSource waitForAbortTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + SemaphoreSlim sem = new SemaphoreSlim(0); + + await RunBidirectionalClientServer( + async clientStream => + { + await clientStream.WriteAsync(new byte[1], endStream: true); + + // Wait for server to read data + await sem.WaitAsync(); + + clientStream.AbortRead(ExpectedErrorCode); + }, + async serverStream => + { + var writeCompletionTask = ReleaseOnWriteCompletionAsync(); + + int received = await serverStream.ReadAsync(new byte[1]); + Assert.Equal(1, received); + received = await serverStream.ReadAsync(new byte[1]); + Assert.Equal(0, received); + + Assert.False(writeCompletionTask.IsCompleted, "Server is still writing."); + + // Tell client that data has been read and it can abort its reads. + sem.Release(); + + long sendAbortErrorCode = await waitForAbortTcs.Task; + Assert.Equal(ExpectedErrorCode, sendAbortErrorCode); + + await writeCompletionTask; + + async ValueTask ReleaseOnWriteCompletionAsync() + { + try + { + await serverStream.WaitForWriteCompletionAsync(); + waitForAbortTcs.SetException(new Exception("WaitForWriteCompletionAsync didn't throw stream aborted.")); + } + catch (QuicStreamAbortedException ex) + { + waitForAbortTcs.SetResult(ex.ErrorCode); + } + catch (Exception ex) + { + waitForAbortTcs.SetException(ex); + } + }; + }); + } + + [Fact] + public async Task WaitForWriteCompletionAsync_ServerWriteAborted_Throws() + { + const int ExpectedErrorCode = 0xfffffff; + + TaskCompletionSource waitForAbortTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + await RunBidirectionalClientServer( + async clientStream => + { + await clientStream.WriteAsync(new byte[1], endStream: true); + }, + async serverStream => + { + var writeCompletionTask = ReleaseOnWriteCompletionAsync(); + + int received = await serverStream.ReadAsync(new byte[1]); + Assert.Equal(1, received); + received = await serverStream.ReadAsync(new byte[1]); + Assert.Equal(0, received); + + Assert.False(writeCompletionTask.IsCompleted, "Server is still writing."); + + serverStream.AbortWrite(ExpectedErrorCode); + + await waitForAbortTcs.Task; + await writeCompletionTask; + + async ValueTask ReleaseOnWriteCompletionAsync() + { + try + { + await serverStream.WaitForWriteCompletionAsync(); + waitForAbortTcs.SetException(new Exception("WaitForWriteCompletionAsync didn't throw stream aborted.")); + } + catch (QuicOperationAbortedException) + { + waitForAbortTcs.SetResult(); + } + catch (Exception ex) + { + waitForAbortTcs.SetException(ex); + } + }; + }); + } + + [Fact] + public async Task WaitForWriteCompletionAsync_ServerShutdown_Success() + { + await RunBidirectionalClientServer( + async clientStream => + { + await clientStream.WriteAsync(new byte[1], endStream: true); + + int readCount = await clientStream.ReadAsync(new byte[1]); + Assert.Equal(1, readCount); + + readCount = await clientStream.ReadAsync(new byte[1]); + Assert.Equal(0, readCount); + }, + async serverStream => + { + var writeCompletionTask = serverStream.WaitForWriteCompletionAsync(); + + int received = await serverStream.ReadAsync(new byte[1]); + Assert.Equal(1, received); + received = await serverStream.ReadAsync(new byte[1]); + Assert.Equal(0, received); + + await serverStream.WriteAsync(new byte[1]); + + Assert.False(writeCompletionTask.IsCompleted, "Server is still writing."); + + serverStream.Shutdown(); + + await writeCompletionTask; + }); + } + + [Fact] + public async Task WaitForWriteCompletionAsync_GracefulShutdown_Success() + { + await RunBidirectionalClientServer( + async clientStream => + { + await clientStream.WriteAsync(new byte[1], endStream: true); + + int readCount = await clientStream.ReadAsync(new byte[1]); + Assert.Equal(1, readCount); + + readCount = await clientStream.ReadAsync(new byte[1]); + Assert.Equal(0, readCount); + }, + async serverStream => + { + var writeCompletionTask = serverStream.WaitForWriteCompletionAsync(); + + int received = await serverStream.ReadAsync(new byte[1]); + Assert.Equal(1, received); + received = await serverStream.ReadAsync(new byte[1]); + Assert.Equal(0, received); + + Assert.False(writeCompletionTask.IsCompleted, "Server is still writing."); + + await serverStream.WriteAsync(new byte[1], endStream: true); + + await writeCompletionTask; + }); + } + + [Fact] + public async Task WaitForWriteCompletionAsync_ConnectionClosed_Throws() + { + const int ExpectedErrorCode = 0xfffffff; + + using SemaphoreSlim sem = new SemaphoreSlim(0); + TaskCompletionSource waitForAbortTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + await RunClientServer( + serverFunction: async connection => + { + await using QuicStream stream = await connection.AcceptStreamAsync(); + + var writeCompletionTask = ReleaseOnWriteCompletionAsync(); + + int received = await stream.ReadAsync(new byte[1]); + Assert.Equal(1, received); + received = await stream.ReadAsync(new byte[1]); + Assert.Equal(0, received); + + // Signal that the server has read data + sem.Release(); + + long closeErrorCode = await waitForAbortTcs.Task; + Assert.Equal(ExpectedErrorCode, closeErrorCode); + + await writeCompletionTask; + + async ValueTask ReleaseOnWriteCompletionAsync() + { + try + { + await stream.WaitForWriteCompletionAsync(); + waitForAbortTcs.SetException(new Exception("WaitForWriteCompletionAsync didn't throw connection aborted.")); + } + catch (QuicConnectionAbortedException ex) + { + waitForAbortTcs.SetResult(ex.ErrorCode); + } + }; + }, + clientFunction: async connection => + { + await using QuicStream stream = connection.OpenBidirectionalStream(); + + await stream.WriteAsync(new byte[1], endStream: true); + + await stream.WaitForWriteCompletionAsync(); + + // Wait for the server to read data before closing the connection + await sem.WaitAsync(); + + await connection.CloseAsync(ExpectedErrorCode); + } + ); + } } public sealed class QuicStreamTests_MockProvider : QuicStreamTests diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs index 7bf38b0812980b..39e6be421905a3 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs @@ -167,6 +167,7 @@ internal QuicListener CreateQuicListener(IPEndPoint endpoint) if (retry == 0) { Debug.Fail($"ConnectAsync to {clientConnection.RemoteEndPoint} failed with {ex.Message}"); + throw ex; } } } diff --git a/src/libraries/System.Net.Requests/src/Resources/Strings.resx b/src/libraries/System.Net.Requests/src/Resources/Strings.resx index 5240ec2908eec6..a618253369a93d 100644 --- a/src/libraries/System.Net.Requests/src/Resources/Strings.resx +++ b/src/libraries/System.Net.Requests/src/Resources/Strings.resx @@ -210,6 +210,9 @@ The underlying connection was closed: An unexpected error occurred on a receive + + CRLF character pair is not allowed in FtpWebRequest inputs. + The remote name could not be resolved diff --git a/src/libraries/System.Net.Requests/src/System/Net/FtpControlStream.cs b/src/libraries/System.Net.Requests/src/System/Net/FtpControlStream.cs index 51d8a0d657931f..8c89473beb9191 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/FtpControlStream.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/FtpControlStream.cs @@ -1120,6 +1120,11 @@ private string GetPortCommandLine(FtpWebRequest request) /// private string FormatFtpCommand(string command, string? parameter) { + if (parameter is not null && parameter.Contains("\r\n", StringComparison.Ordinal)) + { + throw new FormatException(SR.net_ftp_no_newlines); + } + return string.IsNullOrEmpty(parameter) ? command + "\r\n" : command + " " + parameter + "\r\n"; diff --git a/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs index 74dde855abe7e8..2bcb3765a36f55 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs @@ -497,6 +497,9 @@ internal FtpWebRequest(Uri uri) if ((object)uri.Scheme != (object)Uri.UriSchemeFtp) throw new ArgumentOutOfRangeException(nameof(uri)); + if (uri.OriginalString.Contains("\r\n", StringComparison.Ordinal)) + throw new FormatException(SR.net_ftp_no_newlines); + _timerCallback = new TimerThread.Callback(TimerCallback); _syncObject = new object(); diff --git a/src/libraries/System.Net.Requests/tests/FtpWebRequestTest.cs b/src/libraries/System.Net.Requests/tests/FtpWebRequestTest.cs index ff439513b116bb..95d38a82bbf50c 100644 --- a/src/libraries/System.Net.Requests/tests/FtpWebRequestTest.cs +++ b/src/libraries/System.Net.Requests/tests/FtpWebRequestTest.cs @@ -203,6 +203,27 @@ public void Ftp_RenameFileSubDir_Success(FtpExecutionMode mode) Assert.False(DirExists(mode, dir)); } + [Fact] + public void Ftp_Ignore_NewLine_Constructor_Throws_FormatException() + { + string uri = absoluteUri + Guid.NewGuid().ToString(); + + Assert.Throws(() => WebRequest.Create($"{uri}\r\n{WebRequestMethods.Ftp.AppendFile} {Guid.NewGuid().ToString()}")); + } + + [ConditionalFact(nameof(LocalServerAvailable))] + public void Ftp_Ignore_NewLine_GetRequestStream_And_GetResponse_Throws_FormatException_As_InnerException() + { + FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create(absoluteUri + Guid.NewGuid().ToString()); + ftpWebRequest.Method = "APPE"; + ftpWebRequest.Credentials = new NetworkCredential("test\r\ntest2", "test\r\ntest2"); + var requestException = Assert.Throws(() => ftpWebRequest.GetRequestStream()); + Assert.True(requestException.InnerException is FormatException); + + var responseException = Assert.Throws(() => ftpWebRequest.GetResponse()); + Assert.True(responseException.InnerException is FormatException); + } + private static async Task DoAsync(FtpWebRequest request, MemoryStream requestBody) { if (requestBody != null) diff --git a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Android.cs b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Android.cs index 778ecefdb26331..143310a8d3a0cd 100644 --- a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Android.cs +++ b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Android.cs @@ -105,6 +105,16 @@ internal static SslPolicyErrors VerifyCertificateProperties( return cert; } + // Check if the local certificate has been sent to the peer during the handshake. + internal static bool IsLocalCertificateUsed(SafeFreeCredentials? _, SafeDeleteContext? securityContext) + { + SafeSslHandle? sslContext = ((SafeDeleteSslContext?)securityContext)?.SslContext; + if (sslContext == null) + return false; + + return Interop.AndroidCrypto.SSLStreamIsLocalCertificateUsed(sslContext); + } + // // Used only by client SSL code, never returns null. // diff --git a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs index f1fef45e081264..f59bcd364c54ef 100644 --- a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs +++ b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs @@ -114,6 +114,11 @@ internal static SslPolicyErrors VerifyCertificateProperties( return result; } + // This is only called when we selected local client certificate. + // Currently this is only when Apple crypto asked for it. + internal static bool IsLocalCertificateUsed(SafeFreeCredentials? _1, SafeDeleteContext? _2) => true; + + // // Used only by client SSL code, never returns null. // diff --git a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Unix.cs b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Unix.cs index 040111c8042b05..00a7db7b6b0c46 100644 --- a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Unix.cs +++ b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Unix.cs @@ -110,6 +110,11 @@ internal static SslPolicyErrors VerifyCertificateProperties( return result; } + + // This is only called when we selected local client certificate. + // Currently this is only when OpenSSL needs it because peer asked. + internal static bool IsLocalCertificateUsed(SafeFreeCredentials? _1, SafeDeleteContext? _2) => true; + // // Used only by client SSL code, never returns null. // diff --git a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Windows.cs b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Windows.cs index 05ec3e1cce0975..08942abea25a87 100644 --- a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Windows.cs +++ b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Windows.cs @@ -8,6 +8,7 @@ using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Security.Principal; +using static Interop.SspiCli; namespace System.Net { @@ -48,7 +49,21 @@ internal static SslPolicyErrors VerifyCertificateProperties( SafeFreeCertContext? remoteContext = null; try { - remoteContext = SSPIWrapper.QueryContextAttributes_SECPKG_ATTR_REMOTE_CERT_CONTEXT(GlobalSSPI.SSPISecureChannel, securityContext); + // SECPKG_ATTR_REMOTE_CERT_CONTEXT will not succeed before TLS handshake completes. Inside the handshake, + // we need to use (more expensive) SECPKG_ATTR_REMOTE_CERT_CHAIN. That one may be unsupported on older + // versions of windows. In that case, we have no option than to return null. + // + // We can use retrieveCollection to distinguish between in-handshake and after-handshake calls, because + // the collection is retrieved for cert validation purposes after the handshake completes. + if (retrieveCollection) // handshake completed + { + SSPIWrapper.QueryContextAttributes_SECPKG_ATTR_REMOTE_CERT_CONTEXT(GlobalSSPI.SSPISecureChannel, securityContext, out remoteContext); + } + else // in handshake + { + SSPIWrapper.QueryContextAttributes_SECPKG_ATTR_REMOTE_CERT_CHAIN(GlobalSSPI.SSPISecureChannel, securityContext, out remoteContext); + } + if (remoteContext != null && !remoteContext.IsInvalid) { result = new X509Certificate2(remoteContext.DangerousGetHandle()); @@ -71,6 +86,43 @@ internal static SslPolicyErrors VerifyCertificateProperties( return result; } + // Check that local certificate was used by schannel. + internal static bool IsLocalCertificateUsed(SafeFreeCredentials? _credentialsHandle, SafeDeleteContext securityContext) + { + SecPkgContext_SessionInfo info = default; + // fails on Server 2008 and older. We will fall-back to probing LOCAL_CERT_CONTEXT in that case. + if (SSPIWrapper.QueryBlittableContextAttributes( + GlobalSSPI.SSPISecureChannel, + securityContext, + Interop.SspiCli.ContextAttribute.SECPKG_ATTR_SESSION_INFO, + ref info) && + ((SecPkgContext_SessionInfo.Flags)info.dwFlags).HasFlag(SecPkgContext_SessionInfo.Flags.SSL_SESSION_RECONNECT)) + { + // This is TLS Resumed session. Windows can fail to query the local cert bellow. + // Instead, we will determine the usage form used credentials. + SafeFreeCredential_SECURITY creds = (SafeFreeCredential_SECURITY)_credentialsHandle!; + return creds.HasLocalCertificate; + } + + SafeFreeCertContext? localContext = null; + try + { + if (SSPIWrapper.QueryContextAttributes_SECPKG_ATTR_LOCAL_CERT_CONTEXT(GlobalSSPI.SSPISecureChannel, securityContext, out localContext) && + localContext != null) + { + return !localContext.IsInvalid; + } + } + finally + { + localContext?.Dispose(); + } + + // Some older Windows do not support that. This is only called when client certificate was provided + // so assume it was for a reason. + return true; + } + // // Used only by client SSL code, never returns null. // diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/CipherSuitesPolicyPal.Linux.cs b/src/libraries/System.Net.Security/src/System/Net/Security/CipherSuitesPolicyPal.Linux.cs index 0ddef7980c836f..d59c76ce47228a 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/CipherSuitesPolicyPal.Linux.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/CipherSuitesPolicyPal.Linux.cs @@ -28,7 +28,7 @@ internal sealed class CipherSuitesPolicyPal internal CipherSuitesPolicyPal(IEnumerable allowedCipherSuites) { - if (!Interop.Ssl.Tls13Supported) + if (!Interop.Ssl.Capabilities.Tls13Supported) { throw new PlatformNotSupportedException(SR.net_ssl_ciphersuites_policy_not_supported); } diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/Pal.Android/SafeDeleteSslContext.cs b/src/libraries/System.Net.Security/src/System/Net/Security/Pal.Android/SafeDeleteSslContext.cs index 62f15599c8e08c..18dd4a2ff7dc15 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/Pal.Android/SafeDeleteSslContext.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/Pal.Android/SafeDeleteSslContext.cs @@ -221,7 +221,8 @@ private static void InitializeSslContext( throw new NotImplementedException(nameof(SafeDeleteSslContext)); } - Interop.AndroidCrypto.SSLStreamInitialize(handle, isServer, readCallback, writeCallback, InitialBufferSize); + string? peerHost = !isServer && !string.IsNullOrEmpty(authOptions.TargetHost) ? authOptions.TargetHost : null; + Interop.AndroidCrypto.SSLStreamInitialize(handle, isServer, readCallback, writeCallback, InitialBufferSize, peerHost); if (credential.Protocols != SslProtocols.None) {; diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SecureChannel.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SecureChannel.cs index 10dd32c0316519..288443bd90941a 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/SecureChannel.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/SecureChannel.cs @@ -76,7 +76,12 @@ internal X509Certificate? LocalClientCertificate { get { - return _selectedClientCertificate; + if (_selectedClientCertificate != null && CertificateValidationPal.IsLocalCertificateUsed(_credentialsHandle, _securityContext!)) + { + return _selectedClientCertificate; + } + + return null; } } @@ -332,7 +337,7 @@ This will not restart a session but helps minimizing the number of handles we cr --*/ - private bool AcquireClientCredentials(ref byte[]? thumbPrint) + private bool AcquireClientCredentials(ref byte[]? thumbPrint, bool newCredentialsRequested = false) { // Acquire possible Client Certificate information and set it on the handle. X509Certificate? clientCertificate = null; // This is a candidate that can come from the user callback or be guessed when targeting a session restart. @@ -604,7 +609,7 @@ private bool AcquireClientCredentials(ref byte[]? thumbPrint) } _credentialsHandle = SslStreamPal.AcquireCredentialsHandle(_sslAuthenticationOptions.CertificateContext, - _sslAuthenticationOptions.EnabledSslProtocols, _sslAuthenticationOptions.EncryptionPolicy, _sslAuthenticationOptions.IsServer); + _sslAuthenticationOptions.EnabledSslProtocols, _sslAuthenticationOptions.EncryptionPolicy, _sslAuthenticationOptions.IsServer, newCredentialsRequested); thumbPrint = guessedThumbPrint; // Delay until here in case something above threw. _selectedClientCertificate = clientCertificate; @@ -695,11 +700,13 @@ private bool AcquireServerCredentials(ref byte[]? thumbPrint) _sslAuthenticationOptions.CertificateContext = SslStreamCertificateContext.Create(selectedCert); } + Debug.Assert(_sslAuthenticationOptions.CertificateContext != null); // // Note selectedCert is a safe ref possibly cloned from the user passed Cert object // byte[] guessedThumbPrint = selectedCert.GetCertHash(); - SafeFreeCredentials? cachedCredentialHandle = SslSessionsCache.TryCachedCredential(guessedThumbPrint, _sslAuthenticationOptions.EnabledSslProtocols, _sslAuthenticationOptions.IsServer, _sslAuthenticationOptions.EncryptionPolicy); + bool sendTrustedList = _sslAuthenticationOptions.CertificateContext!.Trust?._sendTrustInHandshake ?? false; + SafeFreeCredentials? cachedCredentialHandle = SslSessionsCache.TryCachedCredential(guessedThumbPrint, _sslAuthenticationOptions.EnabledSslProtocols, _sslAuthenticationOptions.IsServer, _sslAuthenticationOptions.EncryptionPolicy, sendTrustedList); if (cachedCredentialHandle != null) { @@ -709,7 +716,7 @@ private bool AcquireServerCredentials(ref byte[]? thumbPrint) else { _credentialsHandle = SslStreamPal.AcquireCredentialsHandle(_sslAuthenticationOptions.CertificateContext, _sslAuthenticationOptions.EnabledSslProtocols, - _sslAuthenticationOptions.EncryptionPolicy, _sslAuthenticationOptions.IsServer); + _sslAuthenticationOptions.EncryptionPolicy, _sslAuthenticationOptions.IsServer, newCredentialsRequested: false); thumbPrint = guessedThumbPrint; } @@ -763,6 +770,7 @@ private SecurityStatusPal GenerateToken(ReadOnlySpan inputBuffer, ref byte byte[]? result = Array.Empty(); SecurityStatusPal status = default; bool cachedCreds = false; + bool sendTrustList = false; byte[]? thumbPrint = null; // @@ -783,6 +791,8 @@ private SecurityStatusPal GenerateToken(ReadOnlySpan inputBuffer, ref byte if (_sslAuthenticationOptions.IsServer) { + sendTrustList = _sslAuthenticationOptions.CertificateContext?.Trust?._sendTrustInHandshake ?? false; + status = SslStreamPal.AcceptSecurityContext( ref _credentialsHandle!, ref _securityContext, @@ -799,6 +809,23 @@ private SecurityStatusPal GenerateToken(ReadOnlySpan inputBuffer, ref byte inputBuffer, ref result, _sslAuthenticationOptions); + + if (status.ErrorCode == SecurityStatusPalErrorCode.CredentialsNeeded) + { + _refreshCredentialNeeded = true; + cachedCreds = AcquireClientCredentials(ref thumbPrint, newCredentialsRequested: true); + + if (NetEventSource.Log.IsEnabled()) + NetEventSource.Info(this, "InitializeSecurityContext() returned 'CredentialsNeeded'."); + + status = SslStreamPal.InitializeSecurityContext( + ref _credentialsHandle!, + ref _securityContext, + _sslAuthenticationOptions.TargetHost, + inputBuffer, + ref result, + _sslAuthenticationOptions); + } } } while (cachedCreds && _credentialsHandle == null); } @@ -820,7 +847,7 @@ private SecurityStatusPal GenerateToken(ReadOnlySpan inputBuffer, ref byte // if (!cachedCreds && _securityContext != null && !_securityContext.IsInvalid && _credentialsHandle != null && !_credentialsHandle.IsInvalid) { - SslSessionsCache.CacheCredential(_credentialsHandle, thumbPrint, _sslAuthenticationOptions.EnabledSslProtocols, _sslAuthenticationOptions.IsServer, _sslAuthenticationOptions.EncryptionPolicy); + SslSessionsCache.CacheCredential(_credentialsHandle, thumbPrint, _sslAuthenticationOptions.EnabledSslProtocols, _sslAuthenticationOptions.IsServer, _sslAuthenticationOptions.EncryptionPolicy, sendTrustList); } } } diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslSessionsCache.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslSessionsCache.cs index 13e4f772f6b3b9..35eb4ec534b83d 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/SslSessionsCache.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslSessionsCache.cs @@ -25,18 +25,20 @@ internal static class SslSessionsCache private readonly int _allowedProtocols; private readonly EncryptionPolicy _encryptionPolicy; private readonly bool _isServerMode; + private readonly bool _sendTrustList; // // SECURITY: X509Certificate.GetCertHash() is virtual hence before going here, // the caller of this ctor has to ensure that a user cert object was inspected and // optionally cloned. // - internal SslCredKey(byte[]? thumbPrint, int allowedProtocols, bool isServerMode, EncryptionPolicy encryptionPolicy) + internal SslCredKey(byte[]? thumbPrint, int allowedProtocols, bool isServerMode, EncryptionPolicy encryptionPolicy, bool sendTrustList) { _thumbPrint = thumbPrint ?? Array.Empty(); _allowedProtocols = allowedProtocols; _encryptionPolicy = encryptionPolicy; _isServerMode = isServerMode; + _sendTrustList = sendTrustList; } public override int GetHashCode() @@ -65,6 +67,7 @@ public override int GetHashCode() hashCode ^= _allowedProtocols; hashCode ^= (int)_encryptionPolicy; hashCode ^= _isServerMode ? 0x10000 : 0x20000; + hashCode ^= _sendTrustList ? 0x40000 : 0x80000; return hashCode; } @@ -96,6 +99,11 @@ public bool Equals(SslCredKey other) return false; } + if (_sendTrustList != other._sendTrustList) + { + return false; + } + for (int i = 0; i < thumbPrint.Length; ++i) { if (thumbPrint[i] != otherThumbPrint[i]) @@ -114,7 +122,7 @@ public bool Equals(SslCredKey other) // ATTN: The returned handle can be invalid, the callers of InitializeSecurityContext and AcceptSecurityContext // must be prepared to execute a back-out code if the call fails. // - internal static SafeFreeCredentials? TryCachedCredential(byte[]? thumbPrint, SslProtocols sslProtocols, bool isServer, EncryptionPolicy encryptionPolicy) + internal static SafeFreeCredentials? TryCachedCredential(byte[]? thumbPrint, SslProtocols sslProtocols, bool isServer, EncryptionPolicy encryptionPolicy, bool sendTrustList = false) { if (s_cachedCreds.IsEmpty) { @@ -122,7 +130,7 @@ public bool Equals(SslCredKey other) return null; } - var key = new SslCredKey(thumbPrint, (int)sslProtocols, isServer, encryptionPolicy); + var key = new SslCredKey(thumbPrint, (int)sslProtocols, isServer, encryptionPolicy, sendTrustList); //SafeCredentialReference? cached; SafeFreeCredentials? credentials = GetCachedCredential(key); @@ -147,7 +155,7 @@ public bool Equals(SslCredKey other) // // ATTN: The thumbPrint must be from inspected and possibly cloned user Cert object or we get a security hole in SslCredKey ctor. // - internal static void CacheCredential(SafeFreeCredentials creds, byte[]? thumbPrint, SslProtocols sslProtocols, bool isServer, EncryptionPolicy encryptionPolicy) + internal static void CacheCredential(SafeFreeCredentials creds, byte[]? thumbPrint, SslProtocols sslProtocols, bool isServer, EncryptionPolicy encryptionPolicy, bool sendTrustList = false) { Debug.Assert(creds != null, "creds == null"); @@ -157,7 +165,7 @@ internal static void CacheCredential(SafeFreeCredentials creds, byte[]? thumbPri return; } - SslCredKey key = new SslCredKey(thumbPrint, (int)sslProtocols, isServer, encryptionPolicy); + SslCredKey key = new SslCredKey(thumbPrint, (int)sslProtocols, isServer, encryptionPolicy, sendTrustList); SafeFreeCredentials? credentials = GetCachedCredential(key); diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs index add3a7ddfec47f..47342bea906af0 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs @@ -43,6 +43,8 @@ private enum Framing private const int FrameOverhead = 64; private const int ReadBufferSize = 4096 * 4 + FrameOverhead; // We read in 16K chunks + headers. private const int InitialHandshakeBufferSize = 4096 + FrameOverhead; // try to fit at least 4K ServerCertificate + private const int HandshakeTypeOffsetSsl2 = 2; // Offset of HelloType in Sslv2 and Unified frames + private const int HandshakeTypeOffsetTls = 5; // Offset of HelloType in Sslv3 and TLS frames private ArrayBuffer _handshakeBuffer; private bool _receivedEOF; @@ -475,6 +477,7 @@ private async ValueTask ReceiveBlobAsync(TIOAdapter a #pragma warning disable 0618 _lastFrame.Header.Version = SslProtocols.Ssl2; #pragma warning restore 0618 + _lastFrame.Header.Type = TlsContentType.Handshake; // Implied. We only call this during handshake and SSL2 does not have framing layer. _lastFrame.Header.Length = GetFrameSize(_handshakeBuffer.ActiveReadOnlySpan) - TlsFrameHelper.HeaderSize; } else @@ -506,9 +509,11 @@ private async ValueTask ReceiveBlobAsync(TIOAdapter a } break; case TlsContentType.Handshake: - if (!_isRenego && _handshakeBuffer.ActiveReadOnlySpan[TlsFrameHelper.HeaderSize] == (byte)TlsHandshakeType.ClientHello && - (_sslAuthenticationOptions!.ServerCertSelectionDelegate != null || - _sslAuthenticationOptions!.ServerOptionDelegate != null)) + byte handshakeType = _handshakeBuffer.ActiveReadOnlySpan[_framing == Framing.SinceSSL3 ? HandshakeTypeOffsetTls : HandshakeTypeOffsetSsl2]; + + if (!_isRenego && + (_sslAuthenticationOptions!.ServerCertSelectionDelegate != null || _sslAuthenticationOptions!.ServerOptionDelegate != null) && + (handshakeType == (byte)TlsHandshakeType.ClientHello)) { TlsFrameHelper.ProcessingOptions options = NetEventSource.Log.IsEnabled() ? TlsFrameHelper.ProcessingOptions.All : diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Android.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Android.cs index 27c854c99168e7..d5155b2cfa3964 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Android.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Android.cs @@ -54,7 +54,8 @@ public static SafeFreeCredentials AcquireCredentialsHandle( SslStreamCertificateContext? certificateContext, SslProtocols protocols, EncryptionPolicy policy, - bool isServer) + bool isServer, + bool newCredentialsRequested = false) { return new SafeFreeSslCredentials(certificateContext, protocols, policy); } diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs index 0414082781c1e8..455ee4b5bb3985 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs @@ -61,7 +61,8 @@ public static SafeFreeCredentials AcquireCredentialsHandle( SslStreamCertificateContext? certificateContext, SslProtocols protocols, EncryptionPolicy policy, - bool isServer) + bool isServer, + bool newCredentialsRequested = false) { return new SafeFreeSslCredentials(certificateContext, protocols, policy); } diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs index c3b2e7e291e89f..acf1f11fa3040b 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs @@ -37,7 +37,7 @@ public static SecurityStatusPal InitializeSecurityContext(ref SafeFreeCredential } public static SafeFreeCredentials AcquireCredentialsHandle(SslStreamCertificateContext? certificateContext, - SslProtocols protocols, EncryptionPolicy policy, bool isServer) + SslProtocols protocols, EncryptionPolicy policy, bool isServer, bool newCredentialsRequested = false) { return new SafeFreeSslCredentials(certificateContext?.Certificate, protocols, policy); } diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs index 29ab3bed0ee8c6..069ef9b7d4d5de 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs @@ -112,26 +112,42 @@ public static SecurityStatusPal InitializeSecurityContext(ref SafeFreeCredential return SecurityStatusAdapterPal.GetSecurityStatusPalFromNativeInt(errorCode); } - public static SecurityStatusPal Renegotiate(ref SafeFreeCredentials? credentialsHandle, ref SafeDeleteSslContext? context, SslAuthenticationOptions sslAuthenticationOptions, out byte[]? outputBuffer ) + public static SecurityStatusPal Renegotiate(ref SafeFreeCredentials? credentialsHandle, ref SafeDeleteSslContext? context, SslAuthenticationOptions sslAuthenticationOptions, out byte[]? outputBuffer) { byte[]? output = Array.Empty(); - SecurityStatusPal status = AcceptSecurityContext(ref credentialsHandle, ref context, Span.Empty, ref output, sslAuthenticationOptions); + SecurityStatusPal status = AcceptSecurityContext(ref credentialsHandle, ref context, Span.Empty, ref output, sslAuthenticationOptions); outputBuffer = output; return status; } - public static SafeFreeCredentials AcquireCredentialsHandle(SslStreamCertificateContext? certificateContext, SslProtocols protocols, EncryptionPolicy policy, bool isServer) + public static SafeFreeCredentials AcquireCredentialsHandle(SslStreamCertificateContext? certificateContext, SslProtocols protocols, EncryptionPolicy policy, bool isServer, bool newCredentialsRequested) { - // New crypto API supports TLS1.3 but it does not allow to force NULL encryption. - SafeFreeCredentials cred = !UseNewCryptoApi || policy == EncryptionPolicy.NoEncryption ? - AcquireCredentialsHandleSchannelCred(certificateContext?.Certificate, protocols, policy, isServer) : - AcquireCredentialsHandleSchCredentials(certificateContext?.Certificate, protocols, policy, isServer); - if (certificateContext != null && certificateContext.Trust != null && certificateContext.Trust._sendTrustInHandshake) + try { - AttachCertificateStore(cred, certificateContext.Trust._store!); - } + // New crypto API supports TLS1.3 but it does not allow to force NULL encryption. + SafeFreeCredentials cred = !UseNewCryptoApi || policy == EncryptionPolicy.NoEncryption ? + AcquireCredentialsHandleSchannelCred(certificateContext, protocols, policy, isServer) : + AcquireCredentialsHandleSchCredentials(certificateContext, protocols, policy, isServer); + if (certificateContext != null && certificateContext.Trust != null && certificateContext.Trust._sendTrustInHandshake) + { + AttachCertificateStore(cred, certificateContext.Trust._store!); + } - return cred; + // Windows can fail to get local credentials in case of TLS Resume. + // We will store associated certificate in credentials and use it in case + // of TLS resume. It will be disposed when the credentials are. + if (newCredentialsRequested && certificateContext != null) + { + SafeFreeCredential_SECURITY handle = (SafeFreeCredential_SECURITY)cred; + handle.HasLocalCertificate = true; + } + + return cred; + } + catch (Win32Exception e) + { + throw new AuthenticationException(SR.net_auth_SSPI, e); + } } private static unsafe void AttachCertificateStore(SafeFreeCredentials cred, X509Store store) @@ -157,8 +173,9 @@ private static unsafe void AttachCertificateStore(SafeFreeCredentials cred, X509 // This is legacy crypto API used on .NET Framework and older Windows versions. // It only supports TLS up to 1.2 - public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchannelCred(X509Certificate2? certificate, SslProtocols protocols, EncryptionPolicy policy, bool isServer) + public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchannelCred(SslStreamCertificateContext? certificateContext, SslProtocols protocols, EncryptionPolicy policy, bool isServer) { + X509Certificate2? certificate = certificateContext?.Certificate; int protocolFlags = GetProtocolFlagsFromSslProtocols(protocols, isServer); Interop.SspiCli.SCHANNEL_CRED.Flags flags; Interop.SspiCli.CredentialUse direction; @@ -183,6 +200,10 @@ public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchannelCred(X5 { direction = Interop.SspiCli.CredentialUse.SECPKG_CRED_INBOUND; flags = Interop.SspiCli.SCHANNEL_CRED.Flags.SCH_SEND_AUX_RECORD; + if (certificateContext?.Trust?._sendTrustInHandshake == true) + { + flags |= Interop.SspiCli.SCHANNEL_CRED.Flags.SCH_CRED_NO_SYSTEM_MAPPER; + } } if (NetEventSource.Log.IsEnabled()) NetEventSource.Info($"flags=({flags}), ProtocolFlags=({protocolFlags}), EncryptionPolicy={policy}"); @@ -203,8 +224,9 @@ public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchannelCred(X5 } // This function uses new crypto API to support TLS 1.3 and beyond. - public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchCredentials(X509Certificate2? certificate, SslProtocols protocols, EncryptionPolicy policy, bool isServer) + public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchCredentials(SslStreamCertificateContext? certificateContext, SslProtocols protocols, EncryptionPolicy policy, bool isServer) { + X509Certificate2? certificate = certificateContext?.Certificate; int protocolFlags = GetProtocolFlagsFromSslProtocols(protocols, isServer); Interop.SspiCli.SCH_CREDENTIALS.Flags flags; Interop.SspiCli.CredentialUse direction; @@ -212,6 +234,10 @@ public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchCredentials( { direction = Interop.SspiCli.CredentialUse.SECPKG_CRED_INBOUND; flags = Interop.SspiCli.SCH_CREDENTIALS.Flags.SCH_SEND_AUX_RECORD; + if (certificateContext?.Trust?._sendTrustInHandshake == true) + { + flags |= Interop.SspiCli.SCH_CREDENTIALS.Flags.SCH_CRED_NO_SYSTEM_MAPPER; + } } else { @@ -243,11 +269,11 @@ public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchCredentials( Interop.SspiCli.SCH_CREDENTIALS credential = default; credential.dwVersion = Interop.SspiCli.SCH_CREDENTIALS.CurrentVersion; credential.dwFlags = flags; - Interop.Crypt32.CERT_CONTEXT *certificateHandle = null; + Interop.Crypt32.CERT_CONTEXT* certificateHandle = null; if (certificate != null) { credential.cCreds = 1; - certificateHandle = (Interop.Crypt32.CERT_CONTEXT *)certificate.Handle; + certificateHandle = (Interop.Crypt32.CERT_CONTEXT*)certificate.Handle; credential.paCred = &certificateHandle; } diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/TlsFrameHelper.cs b/src/libraries/System.Net.Security/src/System/Net/Security/TlsFrameHelper.cs index 8f5b5ed2a07c53..0057b757d632a8 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/TlsFrameHelper.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/TlsFrameHelper.cs @@ -173,33 +173,41 @@ public override string ToString() public static bool TryGetFrameHeader(ReadOnlySpan frame, ref TlsFrameHeader header) { - bool result = frame.Length > 4; - - if (frame.Length >= 1) + header.Type = (TlsContentType)(frame.Length >= 1 ? frame[0] : 0); + if (frame.Length < TlsFrameHelper.HeaderSize) { - header.Type = (TlsContentType)frame[0]; - - if (frame.Length >= 3) - { - // SSLv3, TLS or later - if (frame[1] == 3) - { - if (frame.Length > 4) - { - header.Length = ((frame[3] << 8) | frame[4]); - } + header.Length = -1; + header.Version = SslProtocols.None; + return false; + } - header.Version = TlsMinorVersionToProtocol(frame[2]); - } - else - { - header.Length = -1; - header.Version = SslProtocols.None; - } - } + // SSLv3, TLS or later + if (frame[1] == ProtocolVersionTlsMajorValue) + { + header.Length = ((frame[3] << 8) | frame[4]); + header.Version = TlsMinorVersionToProtocol(frame[2]); + } + // Sslv2 or Unified + else if (frame[2] == (byte)TlsHandshakeType.ClientHello && + frame[3] == ProtocolVersionTlsMajorValue) // SSL3 or above + { + header.Length = (frame[0] & 0x80) != 0 ? + (((frame[0] & 0x7f) << 8) | frame[1]) + 2 : // two bytes + (((frame[0] & 0x3f) << 8) | frame[1]) + 3; // three bytes +#pragma warning disable CS0618 // Ssl2 and Ssl3 are obsolete + header.Version = SslProtocols.Ssl2; +#pragma warning restore CS0618 + header.Type = TlsContentType.Handshake; + } + else + { + // neither looks like TLS nor Ssl2 Hello + header.Length = -1; + header.Version = SslProtocols.None; + return false; } - return result; + return true; } // Returns frame size e.g. header + content @@ -252,6 +260,18 @@ public static bool TryGetFrameInfo(ReadOnlySpan frame, ref TlsFrameInfo in } info.HandshakeType = (TlsHandshakeType)frame[HandshakeTypeOffset]; +#pragma warning disable CS0618 // Ssl2 and Ssl3 are obsolete + if (info.Header.Version == SslProtocols.Ssl2) + { + // This is safe. We would not get here if the length is too small. + info.SupportedVersions |= TlsMinorVersionToProtocol(frame[4]); + // We only recognize Unified ClientHello at the moment. + // This is needed to trigger certificate selection callback in SslStream. + info.HandshakeType = TlsHandshakeType.ClientHello; + // There is no more parsing for old protocols. + return true; + } +#pragma warning restore CS0618 // Check if we have full frame. bool isComplete = frame.Length >= HeaderSize + info.Header.Length; @@ -404,10 +424,10 @@ private static bool TryParseClientHello(ReadOnlySpan clientHello, ref TlsF // Skip compression methods (max size 2^8-1 => size fits in 1 byte) p = SkipOpaqueType1(p); - // is invalid structure or no extensions? + // no extensions if (p.IsEmpty) { - return false; + return true; } // client_hello_extension_list (max size 2^16-1 => size fits in 2 bytes) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs index 50dd158345ff77..7acf2415a3607e 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs @@ -69,11 +69,11 @@ public async Task ClientAsyncAuthenticate_Ssl2WithSelf_Success() [Theory] [MemberData(nameof(ProtocolMismatchData))] public async Task ClientAsyncAuthenticate_MismatchProtocols_Fails( - SslProtocols serverProtocol, SslProtocols clientProtocol, + SslProtocols serverProtocol, Type expectedException) { - Exception e = await Record.ExceptionAsync(() => ClientAsyncSslHelper(serverProtocol, clientProtocol)); + Exception e = await Record.ExceptionAsync(() => ClientAsyncSslHelper(clientProtocol, serverProtocol)); Assert.NotNull(e); Assert.IsAssignableFrom(expectedException, e); } @@ -106,17 +106,19 @@ public async Task ClientAsyncAuthenticate_IndividualServerVsAllClientSupportedPr public static IEnumerable ProtocolMismatchData() { -#pragma warning disable 0618 - yield return new object[] { SslProtocols.Ssl2, SslProtocols.Ssl3, typeof(Exception) }; - yield return new object[] { SslProtocols.Ssl2, SslProtocols.Tls12, typeof(Exception) }; - yield return new object[] { SslProtocols.Ssl3, SslProtocols.Tls12, typeof(Exception) }; -#pragma warning restore 0618 - yield return new object[] { SslProtocols.Tls, SslProtocols.Tls11, typeof(AuthenticationException) }; - yield return new object[] { SslProtocols.Tls, SslProtocols.Tls12, typeof(AuthenticationException) }; - yield return new object[] { SslProtocols.Tls11, SslProtocols.Tls, typeof(AuthenticationException) }; - yield return new object[] { SslProtocols.Tls12, SslProtocols.Tls, typeof(AuthenticationException) }; - yield return new object[] { SslProtocols.Tls12, SslProtocols.Tls11, typeof(AuthenticationException) }; - yield return new object[] { SslProtocols.Tls11, SslProtocols.Tls12, typeof(AuthenticationException) }; + var supportedProtocols = new SslProtocolSupport.SupportedSslProtocolsTestData(); + + foreach (var serverProtocols in supportedProtocols) + foreach (var clientProtocols in supportedProtocols) + { + SslProtocols serverProtocol = (SslProtocols)serverProtocols[0]; + SslProtocols clientProtocol = (SslProtocols)clientProtocols[0]; + + if (clientProtocol != serverProtocol) + { + yield return new object[] { clientProtocol, serverProtocol, typeof(AuthenticationException) }; + } + } } #region Helpers diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/LoggingTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/LoggingTest.cs index 60320d78a0ce2e..87de0e09dc2783 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/LoggingTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/LoggingTest.cs @@ -2,9 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Concurrent; -using System.Diagnostics; using System.Diagnostics.Tracing; using Microsoft.DotNet.RemoteExecutor; +using Microsoft.DotNet.XUnitExtensions; using Xunit; namespace System.Net.Security.Tests @@ -24,22 +24,28 @@ public void EventSource_ExistsWithCorrectId() } [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] // Match SslStream_StreamToStream_Authentication_Success public void EventSource_EventsRaisedAsExpected() { - RemoteExecutor.Invoke(() => + RemoteExecutor.Invoke(async () => { - using (var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.Security", EventLevel.Verbose)) + try { + using var listener = new TestEventListener("Private.InternalDiagnostics.System.Net.Security", EventLevel.Verbose); var events = new ConcurrentQueue(); - listener.RunWithCallback(events.Enqueue, () => + await listener.RunWithCallbackAsync(events.Enqueue, async () => { // Invoke tests that'll cause some events to be generated var test = new SslStreamStreamToStreamTest_Async(); - test.SslStream_StreamToStream_Authentication_Success().GetAwaiter().GetResult(); + await test.SslStream_StreamToStream_Authentication_Success(); }); Assert.DoesNotContain(events, ev => ev.EventId == 0); // errors from the EventSource itself Assert.InRange(events.Count, 1, int.MaxValue); } + catch (SkipTestException) + { + // Don't throw inside RemoteExecutor if SslStream_StreamToStream_Authentication_Success chose to skip the test + } }).Dispose(); } } diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs index 73d480a3048588..4a277a2e844212 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs @@ -46,8 +46,8 @@ public async Task ServerAsyncAuthenticate_EachSupportedProtocol_Success(SslProto [Theory] [MemberData(nameof(ProtocolMismatchData))] public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( - SslProtocols serverProtocol, SslProtocols clientProtocol, + SslProtocols serverProtocol, Type expectedException) { Exception e = await Record.ExceptionAsync( @@ -236,7 +236,7 @@ public async Task ServerAsyncAuthenticate_ConstructorVerificationDelegate_Succes (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams(); var client = new SslStream(clientStream); - var server = new SslStream(serverStream, false, (sender, certificate, chain, sslPolicyErrors) => { validationCallbackCalled = true; return true;}); + var server = new SslStream(serverStream, false, (sender, certificate, chain, sslPolicyErrors) => { validationCallbackCalled = true; return true; }); using (client) using (server) @@ -287,37 +287,18 @@ public async Task ServerAsyncAuthenticate_NoCertificate_Throws(bool useAsync) public static IEnumerable ProtocolMismatchData() { - if (PlatformDetection.SupportsSsl3) - { -#pragma warning disable 0618 - yield return new object[] { SslProtocols.Ssl3, SslProtocols.Tls12, typeof(Exception) }; - if (PlatformDetection.SupportsSsl2) - { - yield return new object[] { SslProtocols.Ssl2, SslProtocols.Ssl3, typeof(Exception) }; - yield return new object[] { SslProtocols.Ssl2, SslProtocols.Tls12, typeof(Exception) }; - } -#pragma warning restore 0618 - } - - // It is OK if server does not support given protocol. It should still fail. - // But if client does not support it, it will simply fail without sending out any data. - - if (PlatformDetection.SupportsTls10) - { - yield return new object[] { SslProtocols.Tls11, SslProtocols.Tls, typeof(AuthenticationException) }; - yield return new object[] { SslProtocols.Tls12, SslProtocols.Tls, typeof(AuthenticationException) }; - } + var supportedProtocols = new SslProtocolSupport.SupportedSslProtocolsTestData(); - if (PlatformDetection.SupportsTls11) + foreach (var serverProtocols in supportedProtocols) + foreach (var clientProtocols in supportedProtocols) { - yield return new object[] { SslProtocols.Tls, SslProtocols.Tls11, typeof(AuthenticationException) }; - yield return new object[] { SslProtocols.Tls12, SslProtocols.Tls11, typeof(AuthenticationException) }; - } + SslProtocols serverProtocol = (SslProtocols)serverProtocols[0]; + SslProtocols clientProtocol = (SslProtocols)clientProtocols[0]; - if (PlatformDetection.SupportsTls12) - { - yield return new object[] { SslProtocols.Tls, SslProtocols.Tls12, typeof(AuthenticationException) }; - yield return new object[] { SslProtocols.Tls11, SslProtocols.Tls12, typeof(AuthenticationException) }; + if (clientProtocol != serverProtocol) + { + yield return new object[] { clientProtocol, serverProtocol, typeof(AuthenticationException) }; + } } } @@ -387,7 +368,7 @@ private async Task ServerAsyncSslHelper( await clientAuthentication.WaitAsync(TestConfiguration.PassingTestTimeout); _logVerbose.WriteLine("ServerAsyncAuthenticateTest.clientAuthentication complete."); } - catch (Exception ex) + catch (AuthenticationException ex) { // Ignore client-side errors: we're only interested in server-side behavior. _log.WriteLine("Client exception : " + ex); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerNoEncryptionTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerNoEncryptionTest.cs index 4515f15843004b..6d43dc8f320172 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/ServerNoEncryptionTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/ServerNoEncryptionTest.cs @@ -96,7 +96,10 @@ public async Task ServerNoEncryption_ClientNoEncryption_ConnectWithNoEncryption( else { var ae = await Assert.ThrowsAsync(() => sslStream.AuthenticateAsClientAsync("localhost", null, SslProtocolSupport.DefaultSslProtocols, false)); - Assert.IsType(ae.InnerException); + if (!OperatingSystem.IsWindows()) + { + Assert.IsType(ae.InnerException); + } } } } diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs new file mode 100644 index 00000000000000..bb753a9c8bbe86 --- /dev/null +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamMutualAuthenticationTest.cs @@ -0,0 +1,400 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO; +using System.Threading.Tasks; +using System.Net.Test.Common; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; + +using Xunit; +using System.Runtime.InteropServices; + +namespace System.Net.Security.Tests +{ + using Configuration = System.Net.Test.Common.Configuration; + + [PlatformSpecific(TestPlatforms.Windows)] + public class SslStreamMutualAuthenticationTest : IDisposable + { + private readonly X509Certificate2 _clientCertificate; + private readonly X509Certificate2 _serverCertificate; + private readonly X509Certificate2 _selfSignedCertificate; + + public SslStreamMutualAuthenticationTest() + { + _serverCertificate = Configuration.Certificates.GetServerCertificate(); + _clientCertificate = Configuration.Certificates.GetClientCertificate(); + _selfSignedCertificate = Configuration.Certificates.GetSelfSignedServerCertificate(); + } + + public void Dispose() + { + _serverCertificate.Dispose(); + _clientCertificate.Dispose(); + } + + public enum ClientCertSource + { + ClientCertificate, + SelectionCallback, + } + + public static TheoryData CertSourceData() + { + TheoryData data = new(); + + foreach (var source in Enum.GetValues()) + { + data.Add(source); + } + + return data; + } + + + public static TheoryData BoolAndCertSourceData() + { + TheoryData data = new(); + + foreach (var source in Enum.GetValues()) + { + data.Add(true, source); + data.Add(false, source); + } + + return data; + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))] + [MemberData(nameof(BoolAndCertSourceData))] + public async Task SslStream_RequireClientCert_IsMutuallyAuthenticated_ReturnsTrue(bool clientCertificateRequired, ClientCertSource certSource) + { + (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); + using (var client = new SslStream(stream1, false, AllowAnyCertificate)) + using (var server = new SslStream(stream2, false, AllowAnyCertificate)) + { + var clientOptions = new SslClientAuthenticationOptions + { + TargetHost = Guid.NewGuid().ToString("N") + }; + + switch (certSource) + { + case ClientCertSource.ClientCertificate: + clientOptions.ClientCertificates = new X509CertificateCollection() { _clientCertificate }; + break; + case ClientCertSource.SelectionCallback: + clientOptions.LocalCertificateSelectionCallback = ClientCertSelectionCallback; + break; + } + + Task t2 = client.AuthenticateAsClientAsync(clientOptions); + Task t1 = server.AuthenticateAsServerAsync(new SslServerAuthenticationOptions + { + ServerCertificate = _serverCertificate, + ClientCertificateRequired = clientCertificateRequired + }); + + await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); + + if (clientCertificateRequired) + { + Assert.True(client.IsMutuallyAuthenticated, "client.IsMutuallyAuthenticated"); + Assert.True(server.IsMutuallyAuthenticated, "server.IsMutuallyAuthenticated"); + } + else + { + // Even though the certificate was provided, it was not requested by the server and thus the client + // was not authenticated. + Assert.False(client.IsMutuallyAuthenticated, "client.IsMutuallyAuthenticated"); + Assert.False(server.IsMutuallyAuthenticated, "server.IsMutuallyAuthenticated"); + } + } + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))] + [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] + public async Task SslStream_CachedCredentials_IsMutuallyAuthenticatedCorrect( + SslProtocols protocol) + { + var clientOptions = new SslClientAuthenticationOptions + { + ClientCertificates = new X509CertificateCollection() { _clientCertificate }, + EnabledSslProtocols = protocol, + RemoteCertificateValidationCallback = delegate { return true; }, + TargetHost = Guid.NewGuid().ToString("N") + }; + + for (int i = 0; i < 5; i++) + { + (SslStream client, SslStream server) = TestHelper.GetConnectedSslStreams(); + using (client) + using (server) + { + bool expectMutualAuthentication = (i % 2) == 0; + + var serverOptions = new SslServerAuthenticationOptions + { + ClientCertificateRequired = expectMutualAuthentication, + ServerCertificate = expectMutualAuthentication ? _serverCertificate : _selfSignedCertificate, + RemoteCertificateValidationCallback = delegate { return true; }, + EnabledSslProtocols = protocol + }; + + await TestConfiguration.WhenAllOrAnyFailedWithTimeout( + client.AuthenticateAsClientAsync(clientOptions), + server.AuthenticateAsServerAsync(serverOptions)); + + // mutual authentication should only be set if server required client cert + Assert.Equal(expectMutualAuthentication, server.IsMutuallyAuthenticated); + Assert.Equal(expectMutualAuthentication, client.IsMutuallyAuthenticated); + }; + } + } + + [ConditionalTheory(typeof(TestConfiguration), nameof(TestConfiguration.SupportsRenegotiation))] + [MemberData(nameof(CertSourceData))] + [PlatformSpecific(TestPlatforms.Windows | TestPlatforms.Linux)] + public async Task SslStream_NegotiateClientCertificate_IsMutuallyAuthenticatedCorrect(ClientCertSource certSource) + { + SslStreamCertificateContext context = SslStreamCertificateContext.Create(_serverCertificate, null); + var clientOptions = new SslClientAuthenticationOptions + { + TargetHost = Guid.NewGuid().ToString("N") + }; + + for (int round = 0; round < 3; round++) + { + (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); + using (var client = new SslStream(stream1, false, AllowAnyCertificate)) + using (var server = new SslStream(stream2, false, AllowAnyCertificate)) + { + + switch (certSource) + { + case ClientCertSource.ClientCertificate: + clientOptions.ClientCertificates = new X509CertificateCollection() { _clientCertificate }; + break; + case ClientCertSource.SelectionCallback: + clientOptions.LocalCertificateSelectionCallback = ClientCertSelectionCallback; + break; + } + + Task t2 = client.AuthenticateAsClientAsync(clientOptions); + Task t1 = server.AuthenticateAsServerAsync(new SslServerAuthenticationOptions + { + ServerCertificateContext = context, + ClientCertificateRequired = false, + EnabledSslProtocols = SslProtocols.Tls12, + + }); + + await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); + + if (round >= 0 && server.RemoteCertificate != null) + { + // TLS resumed + Assert.True(client.IsMutuallyAuthenticated, "client.IsMutuallyAuthenticated"); + Assert.True(server.IsMutuallyAuthenticated, "server.IsMutuallyAuthenticated"); + continue; + } + + Assert.False(client.IsMutuallyAuthenticated, "client.IsMutuallyAuthenticated"); + Assert.False(server.IsMutuallyAuthenticated, "server.IsMutuallyAuthenticated"); + + var t = client.ReadAsync(new byte[1]); + await server.NegotiateClientCertificateAsync(); + Assert.NotNull(server.RemoteCertificate); + await server.WriteAsync(new byte[1]); + await t; + + Assert.NotNull(server.RemoteCertificate); + Assert.True(client.IsMutuallyAuthenticated, "client.IsMutuallyAuthenticated"); + Assert.True(server.IsMutuallyAuthenticated, "server.IsMutuallyAuthenticated"); + } + } + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))] + [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] + public async Task SslStream_ResumedSessionsClientCollection_IsMutuallyAuthenticatedCorrect( + SslProtocols protocol) + { + var clientOptions = new SslClientAuthenticationOptions + { + EnabledSslProtocols = protocol, + RemoteCertificateValidationCallback = delegate { return true; }, + TargetHost = Guid.NewGuid().ToString("N") + }; + + // Create options with certificate context so TLS resume is possible on Linux + var serverOptions = new SslServerAuthenticationOptions + { + ClientCertificateRequired = true, + ServerCertificateContext = SslStreamCertificateContext.Create(_serverCertificate, null), + RemoteCertificateValidationCallback = delegate { return true; }, + EnabledSslProtocols = protocol + }; + + for (int i = 0; i < 5; i++) + { + (SslStream client, SslStream server) = TestHelper.GetConnectedSslStreams(); + using (client) + using (server) + { + bool expectMutualAuthentication = (i % 2) == 0; + + clientOptions.ClientCertificates = expectMutualAuthentication ? new X509CertificateCollection() { _clientCertificate } : null; + await TestConfiguration.WhenAllOrAnyFailedWithTimeout( + client.AuthenticateAsClientAsync(clientOptions), + server.AuthenticateAsServerAsync(serverOptions)); + + // mutual authentication should only be set if client set certificate + Assert.Equal(expectMutualAuthentication, server.IsMutuallyAuthenticated); + Assert.Equal(expectMutualAuthentication, client.IsMutuallyAuthenticated); + + if (expectMutualAuthentication) + { + Assert.NotNull(server.RemoteCertificate); + } + else + { + Assert.Null(server.RemoteCertificate); + } + }; + } + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))] + [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] + public async Task SslStream_ResumedSessionsCallbackSet_IsMutuallyAuthenticatedCorrect( + SslProtocols protocol) + { + var clientOptions = new SslClientAuthenticationOptions + { + EnabledSslProtocols = protocol, + RemoteCertificateValidationCallback = delegate { return true; }, + TargetHost = Guid.NewGuid().ToString("N") + }; + + // Create options with certificate context so TLS resume is possible on Linux + var serverOptions = new SslServerAuthenticationOptions + { + ClientCertificateRequired = true, + ServerCertificateContext = SslStreamCertificateContext.Create(_serverCertificate, null), + RemoteCertificateValidationCallback = delegate { return true; }, + EnabledSslProtocols = protocol + }; + + for (int i = 0; i < 5; i++) + { + (SslStream client, SslStream server) = TestHelper.GetConnectedSslStreams(); + using (client) + using (server) + { + bool expectMutualAuthentication = (i % 2) == 0; + + clientOptions.LocalCertificateSelectionCallback = (s, t, l, r, a) => + { + return expectMutualAuthentication ? _clientCertificate : null; + }; + + await TestConfiguration.WhenAllOrAnyFailedWithTimeout( + client.AuthenticateAsClientAsync(clientOptions), + server.AuthenticateAsServerAsync(serverOptions)); + + // mutual authentication should only be set if client set certificate + Assert.Equal(expectMutualAuthentication, server.IsMutuallyAuthenticated); + Assert.Equal(expectMutualAuthentication, client.IsMutuallyAuthenticated); + + if (expectMutualAuthentication) + { + Assert.NotNull(server.RemoteCertificate); + } + else + { + Assert.Null(server.RemoteCertificate); + } + }; + } + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))] + [ClassData(typeof(SslProtocolSupport.SupportedSslProtocolsTestData))] + public async Task SslStream_ResumedSessionsCallbackMaybeSet_IsMutuallyAuthenticatedCorrect( + SslProtocols protocol) + { + var clientOptions = new SslClientAuthenticationOptions + { + EnabledSslProtocols = protocol, + RemoteCertificateValidationCallback = delegate { return true; }, + TargetHost = Guid.NewGuid().ToString("N") + }; + + // Create options with certificate context so TLS resume is possible on Linux + var serverOptions = new SslServerAuthenticationOptions + { + ClientCertificateRequired = true, + ServerCertificateContext = SslStreamCertificateContext.Create(_serverCertificate, null), + RemoteCertificateValidationCallback = delegate { return true; }, + EnabledSslProtocols = protocol + }; + + for (int i = 0; i < 5; i++) + { + (SslStream client, SslStream server) = TestHelper.GetConnectedSslStreams(); + using (client) + using (server) + { + bool expectMutualAuthentication = (i % 2) == 0; + + if (expectMutualAuthentication) + { + clientOptions.LocalCertificateSelectionCallback = (s, t, l, r, a) => _clientCertificate; + } + else + { + clientOptions.LocalCertificateSelectionCallback = null; + } + + await TestConfiguration.WhenAllOrAnyFailedWithTimeout( + client.AuthenticateAsClientAsync(clientOptions), + server.AuthenticateAsServerAsync(serverOptions)); + + // mutual authentication should only be set if client set certificate + Assert.Equal(expectMutualAuthentication, server.IsMutuallyAuthenticated); + Assert.Equal(expectMutualAuthentication, client.IsMutuallyAuthenticated); + + if (expectMutualAuthentication) + { + Assert.NotNull(server.RemoteCertificate); + } + else + { + Assert.Null(server.RemoteCertificate); + } + }; + } + } + + private static bool AllowAnyCertificate( + object sender, + X509Certificate certificate, + X509Chain chain, + SslPolicyErrors sslPolicyErrors) + { + return true; + } + + private X509Certificate ClientCertSelectionCallback( + object sender, + string targetHost, + X509CertificateCollection localCertificates, + X509Certificate remoteCertificate, + string[] acceptableIssuers) + { + return _clientCertificate; + } + } +} diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs index 3428ba78845d48..ba678145161841 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamNetworkStreamTest.cs @@ -408,6 +408,7 @@ await Assert.ThrowsAsync(()=> [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.SupportsTls13))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/58927", TestPlatforms.Windows)] [InlineData(true)] [InlineData(false)] [PlatformSpecific(TestPlatforms.Windows)] diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs index 3ecfbc4e92493f..f2b6bb575bd6c7 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs @@ -11,6 +11,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.DotNet.XUnitExtensions; using Xunit; namespace System.Net.Security.Tests @@ -62,11 +63,11 @@ public static IEnumerable SslStream_StreamToStream_Authentication_Succ using (X509Certificate2 clientCert = Configuration.Certificates.GetClientCertificate()) { yield return new object[] { new X509Certificate2(serverCert), new X509Certificate2(clientCert) }; - yield return new object[] { new X509Certificate(serverCert.Export(X509ContentType.Pfx)), new X509Certificate(clientCert.Export(X509ContentType.Pfx)) }; + yield return new object[] { new X509Certificate(serverCert.Export(X509ContentType.Pfx), (string)null, X509KeyStorageFlags.DefaultKeySet), new X509Certificate(clientCert.Export(X509ContentType.Pfx), (string)null, X509KeyStorageFlags.DefaultKeySet) }; } } - [Theory] + [ConditionalTheory] [MemberData(nameof(SslStream_StreamToStream_Authentication_Success_MemberData))] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] public async Task SslStream_StreamToStream_Authentication_Success(X509Certificate serverCert = null, X509Certificate clientCert = null) diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs index 5380b4027a6f76..b7f70fcecd57c5 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs @@ -8,7 +8,7 @@ using System.Security.Cryptography.X509Certificates; using System.Security.Authentication; using System.Threading.Tasks; - +using Microsoft.DotNet.XUnitExtensions; using Xunit; namespace System.Net.Security.Tests diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj index 3dc537ad91deb9..f92663083b5271 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj @@ -27,6 +27,7 @@ + diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/TelemetryTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/TelemetryTest.cs index 48a9b61fa1fb01..67188c1c3bbf39 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/TelemetryTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/TelemetryTest.cs @@ -8,6 +8,7 @@ using System.Security.Authentication; using System.Threading.Tasks; using Microsoft.DotNet.RemoteExecutor; +using Microsoft.DotNet.XUnitExtensions; using Xunit; namespace System.Net.Security.Tests @@ -28,61 +29,69 @@ public static void EventSource_ExistsWithCorrectId() [OuterLoop] [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] // Match SslStream_StreamToStream_Authentication_Success public static void EventSource_SuccessfulHandshake_LogsStartStop() { RemoteExecutor.Invoke(async () => { - using var listener = new TestEventListener("System.Net.Security", EventLevel.Verbose, eventCounterInterval: 0.1d); - listener.AddActivityTracking(); - - var events = new ConcurrentQueue<(EventWrittenEventArgs Event, Guid ActivityId)>(); - await listener.RunWithCallbackAsync(e => + try { - events.Enqueue((e, e.ActivityId)); + using var listener = new TestEventListener("System.Net.Security", EventLevel.Verbose, eventCounterInterval: 0.1d); + listener.AddActivityTracking(); - if (e.EventName == "HandshakeStart") + var events = new ConcurrentQueue<(EventWrittenEventArgs Event, Guid ActivityId)>(); + await listener.RunWithCallbackAsync(e => { - // Wait for a new counter group so that current-tls-handshakes is guaranteed a non-zero value - WaitForEventCountersAsync(events).GetAwaiter().GetResult(); - } - }, - async () => - { - // Invoke tests that'll cause some events to be generated - var test = new SslStreamStreamToStreamTest_Async(); - await test.SslStream_StreamToStream_Authentication_Success(); - await WaitForEventCountersAsync(events); - }); - Assert.DoesNotContain(events, ev => ev.Event.EventId == 0); // errors from the EventSource itself + events.Enqueue((e, e.ActivityId)); + + if (e.EventName == "HandshakeStart") + { + // Wait for a new counter group so that current-tls-handshakes is guaranteed a non-zero value + WaitForEventCountersAsync(events).GetAwaiter().GetResult(); + } + }, + async () => + { + // Invoke tests that'll cause some events to be generated + var test = new SslStreamStreamToStreamTest_Async(); + await test.SslStream_StreamToStream_Authentication_Success(); + await WaitForEventCountersAsync(events); + }); + Assert.DoesNotContain(events, ev => ev.Event.EventId == 0); // errors from the EventSource itself - (EventWrittenEventArgs Event, Guid ActivityId)[] starts = events.Where(e => e.Event.EventName == "HandshakeStart").ToArray(); - Assert.Equal(2, starts.Length); - Assert.All(starts, s => Assert.Equal(2, s.Event.Payload.Count)); - Assert.All(starts, s => Assert.NotEqual(Guid.Empty, s.ActivityId)); + (EventWrittenEventArgs Event, Guid ActivityId)[] starts = events.Where(e => e.Event.EventName == "HandshakeStart").ToArray(); + Assert.Equal(2, starts.Length); + Assert.All(starts, s => Assert.Equal(2, s.Event.Payload.Count)); + Assert.All(starts, s => Assert.NotEqual(Guid.Empty, s.ActivityId)); - // isServer - (EventWrittenEventArgs Event, Guid ActivityId) serverStart = Assert.Single(starts, s => (bool)s.Event.Payload[0]); - (EventWrittenEventArgs Event, Guid ActivityId) clientStart = Assert.Single(starts, s => !(bool)s.Event.Payload[0]); + // isServer + (EventWrittenEventArgs Event, Guid ActivityId) serverStart = Assert.Single(starts, s => (bool)s.Event.Payload[0]); + (EventWrittenEventArgs Event, Guid ActivityId) clientStart = Assert.Single(starts, s => !(bool)s.Event.Payload[0]); - // targetHost - Assert.Empty(Assert.IsType(serverStart.Event.Payload[1])); - Assert.NotEmpty(Assert.IsType(clientStart.Event.Payload[1])); + // targetHost + Assert.Empty(Assert.IsType(serverStart.Event.Payload[1])); + Assert.NotEmpty(Assert.IsType(clientStart.Event.Payload[1])); - Assert.NotEqual(serverStart.ActivityId, clientStart.ActivityId); + Assert.NotEqual(serverStart.ActivityId, clientStart.ActivityId); - (EventWrittenEventArgs Event, Guid ActivityId)[] stops = events.Where(e => e.Event.EventName == "HandshakeStop").ToArray(); - Assert.Equal(2, stops.Length); + (EventWrittenEventArgs Event, Guid ActivityId)[] stops = events.Where(e => e.Event.EventName == "HandshakeStop").ToArray(); + Assert.Equal(2, stops.Length); - EventWrittenEventArgs serverStop = Assert.Single(stops, s => s.ActivityId == serverStart.ActivityId).Event; - EventWrittenEventArgs clientStop = Assert.Single(stops, s => s.ActivityId == clientStart.ActivityId).Event; + EventWrittenEventArgs serverStop = Assert.Single(stops, s => s.ActivityId == serverStart.ActivityId).Event; + EventWrittenEventArgs clientStop = Assert.Single(stops, s => s.ActivityId == clientStart.ActivityId).Event; - SslProtocols serverProtocol = ValidateHandshakeStopEventPayload(serverStop); - SslProtocols clientProtocol = ValidateHandshakeStopEventPayload(clientStop); - Assert.Equal(serverProtocol, clientProtocol); + SslProtocols serverProtocol = ValidateHandshakeStopEventPayload(serverStop); + SslProtocols clientProtocol = ValidateHandshakeStopEventPayload(clientStop); + Assert.Equal(serverProtocol, clientProtocol); - Assert.DoesNotContain(events, e => e.Event.EventName == "HandshakeFailed"); + Assert.DoesNotContain(events, e => e.Event.EventName == "HandshakeFailed"); - VerifyEventCounters(events, shouldHaveFailures: false); + VerifyEventCounters(events, shouldHaveFailures: false); + } + catch (SkipTestException) + { + // Don't throw inside RemoteExecutor if SslStream_StreamToStream_Authentication_Success chose to skip the test + } }).Dispose(); } diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs index 4bd1b0ee30f9a2..dba86c761a3cc2 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs @@ -13,7 +13,7 @@ namespace System.Net.Security.Tests { internal static class TestConfiguration { - public const int PassingTestTimeoutMilliseconds = 4 * 60 * 1000; + public const int PassingTestTimeoutMilliseconds = 1 * 60 * 1000; public static TimeSpan PassingTestTimeout => TimeSpan.FromMilliseconds(PassingTestTimeoutMilliseconds); public const string Realm = "TEST.COREFX.NET"; @@ -38,7 +38,21 @@ public static Task WhenAllOrAnyFailedWithTimeout(params Task[] tasks) // On Windows, null ciphers (no encryption) are supported. if (OperatingSystem.IsWindows()) { - return true; + if (!PlatformDetection.IsWindows10OrLater) + { + // All old versions support null encryption + return true; + } + + try + { + // New Windows can support null but it may be disabled in Azure images + using (Process p = Process.Start(new ProcessStartInfo("powershell", "-Command Get-TlsCipherSuite") { RedirectStandardOutput = true, RedirectStandardError = true })) + { + return p.StandardOutput.ReadToEnd().Contains("WITH_NULL"); + } + } + catch { return true; } // assume availability } // On macOS and Android, the null cipher (no encryption) is not supported. diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/TestHelper.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/TestHelper.cs index 68b66a1af51fd4..e7f4761cd6d425 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/TestHelper.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/TestHelper.cs @@ -169,7 +169,7 @@ internal static (X509Certificate2 certificate, X509Certificate2Collection) Gener if (PlatformDetection.IsWindows) { X509Certificate2 ephemeral = endEntity; - endEntity = new X509Certificate2(endEntity.Export(X509ContentType.Pfx)); + endEntity = new X509Certificate2(endEntity.Export(X509ContentType.Pfx), (string)null, X509KeyStorageFlags.DefaultKeySet); ephemeral.Dispose(); } diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs index 46fecd795ecd3c..d6ce3b64a2cc51 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs @@ -857,7 +857,7 @@ internal sealed class AwaitableSocketAsyncEventArgs : SocketAsyncEventArgs, IVal /// if it has completed. Another delegate if OnCompleted was called before the operation could complete, /// in which case it's the delegate to invoke when the operation does complete. /// - private Action? _continuation; + private volatile Action? _continuation; private ExecutionContext? _executionContext; private object? _scheduler; /// Current token value given to a ValueTask and then verified against the value it passes back to us. @@ -930,7 +930,7 @@ protected override void OnCompleted(SocketAsyncEventArgs _) /// This instance. public ValueTask AcceptAsync(Socket socket, CancellationToken cancellationToken) { - Debug.Assert(Volatile.Read(ref _continuation) == null, "Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, "Expected null continuation to indicate reserved for use"); if (socket.AcceptAsync(this, cancellationToken)) { @@ -952,7 +952,7 @@ public ValueTask AcceptAsync(Socket socket, CancellationToken cancellati /// This instance. public ValueTask ReceiveAsync(Socket socket, CancellationToken cancellationToken) { - Debug.Assert(Volatile.Read(ref _continuation) == null, "Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, "Expected null continuation to indicate reserved for use"); if (socket.ReceiveAsync(this, cancellationToken)) { @@ -972,7 +972,7 @@ public ValueTask ReceiveAsync(Socket socket, CancellationToken cancellation public ValueTask ReceiveFromAsync(Socket socket, CancellationToken cancellationToken) { - Debug.Assert(Volatile.Read(ref _continuation) == null, "Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, "Expected null continuation to indicate reserved for use"); if (socket.ReceiveFromAsync(this, cancellationToken)) { @@ -993,7 +993,7 @@ public ValueTask ReceiveFromAsync(Socket socket, Cancel public ValueTask ReceiveMessageFromAsync(Socket socket, CancellationToken cancellationToken) { - Debug.Assert(Volatile.Read(ref _continuation) == null, "Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, "Expected null continuation to indicate reserved for use"); if (socket.ReceiveMessageFromAsync(this, cancellationToken)) { @@ -1018,7 +1018,7 @@ public ValueTask ReceiveMessageFromAsync(Socket /// This instance. public ValueTask SendAsync(Socket socket, CancellationToken cancellationToken) { - Debug.Assert(Volatile.Read(ref _continuation) == null, "Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, "Expected null continuation to indicate reserved for use"); if (socket.SendAsync(this, cancellationToken)) { @@ -1038,7 +1038,7 @@ public ValueTask SendAsync(Socket socket, CancellationToken cancellationTok public ValueTask SendAsyncForNetworkStream(Socket socket, CancellationToken cancellationToken) { - Debug.Assert(Volatile.Read(ref _continuation) == null, "Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, "Expected null continuation to indicate reserved for use"); if (socket.SendAsync(this, cancellationToken)) { @@ -1057,7 +1057,7 @@ public ValueTask SendAsyncForNetworkStream(Socket socket, CancellationToken canc public ValueTask SendPacketsAsync(Socket socket, CancellationToken cancellationToken) { - Debug.Assert(Volatile.Read(ref _continuation) == null, "Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, "Expected null continuation to indicate reserved for use"); if (socket.SendPacketsAsync(this, cancellationToken)) { @@ -1076,7 +1076,7 @@ public ValueTask SendPacketsAsync(Socket socket, CancellationToken cancellationT public ValueTask SendToAsync(Socket socket, CancellationToken cancellationToken) { - Debug.Assert(Volatile.Read(ref _continuation) == null, "Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, "Expected null continuation to indicate reserved for use"); if (socket.SendToAsync(this, cancellationToken)) { @@ -1096,7 +1096,7 @@ public ValueTask SendToAsync(Socket socket, CancellationToken cancellationT public ValueTask ConnectAsync(Socket socket) { - Debug.Assert(Volatile.Read(ref _continuation) == null, "Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, "Expected null continuation to indicate reserved for use"); try { @@ -1122,7 +1122,7 @@ public ValueTask ConnectAsync(Socket socket) public ValueTask DisconnectAsync(Socket socket, CancellationToken cancellationToken) { - Debug.Assert(Volatile.Read(ref _continuation) == null, $"Expected null continuation to indicate reserved for use"); + Debug.Assert(_continuation == null, $"Expected null continuation to indicate reserved for use"); if (socket.DisconnectAsync(this, cancellationToken)) { diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.cs index 3299fa5982e030..6b478bb58d45a3 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.cs @@ -131,6 +131,12 @@ public async Task Connect_AfterDisconnect_Fails() [InlineData("[::ffff:1.1.1.1]", true)] public async Task ConnectGetsCanceledByDispose(string addressString, bool useDns) { + if (UsesSync && PlatformDetection.IsLinux) + { + // [ActiveIssue("https://github.com/dotnet/runtime/issues/94149", TestPlatforms.Linux)] + return; + } + IPAddress address = IPAddress.Parse(addressString); // We try this a couple of times to deal with a timing race: if the Dispose happens diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DnsEndPointTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DnsEndPointTest.cs index 1e362a04819c0f..f23a1e835b7be3 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DnsEndPointTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DnsEndPointTest.cs @@ -272,7 +272,7 @@ public void Socket_ConnectAsyncDnsEndPoint_HostNotFound() bool willRaiseEvent = sock.ConnectAsync(args); if (willRaiseEvent) { - Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection"); + Assert.True(complete.WaitOne(TestSettings.PassingTestLongTimeout), "Timed out while waiting for connection"); complete.Dispose(); // only dispose on success as we know we're done with the instance } @@ -332,7 +332,7 @@ public void Socket_StaticConnectAsync_Success(SocketImplementationType type) if (Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, args)) { - Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection"); + Assert.True(complete.WaitOne(TestSettings.PassingTestLongTimeout), "Timed out while waiting for connection"); } Assert.Equal(SocketError.Success, args.SocketError); @@ -348,7 +348,7 @@ public void Socket_StaticConnectAsync_Success(SocketImplementationType type) if (Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, args)) { - Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection"); + Assert.True(complete.WaitOne(TestSettings.PassingTestLongTimeout), "Timed out while waiting for connection"); } complete.Dispose(); // only dispose on success as we know we're done with the instance @@ -404,7 +404,7 @@ public void Socket_StaticConnectAsync_HostNotFound() OnConnectAsyncCompleted(null, args); } - Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "Timed out while waiting for connection"); + Assert.True(complete.WaitOne(TestSettings.PassingTestLongTimeout), "Timed out while waiting for connection"); complete.Dispose(); // only dispose on success as we know we're done with the instance AssertHostNotFoundOrNoData(args); diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs index cda5d75b48c303..aa0d967e9f783d 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendFile.cs @@ -235,45 +235,6 @@ public async Task SliceBuffers_Success() } } - [ActiveIssue("https://github.com/dotnet/runtime/issues/42534", TestPlatforms.Windows)] - [OuterLoop("Creates and sends a file several gigabytes long")] - [Fact] - public async Task GreaterThan2GBFile_SendsAllBytes() - { - const long FileLength = 100L + int.MaxValue; - - using var tmpFile = TempFile.Create(); - using (FileStream fs = File.Create(tmpFile.Path)) - { - fs.SetLength(FileLength); - } - - using var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - using var listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - listener.BindToAnonymousPort(IPAddress.Loopback); - listener.Listen(1); - - client.Connect(listener.LocalEndPoint); - using Socket server = listener.Accept(); - - await new Task[] - { - SendFileAsync(server, tmpFile.Path), - Task.Run(() => - { - byte[] buffer = new byte[100_000]; - long count = 0; - while (count < FileLength) - { - int received = client.Receive(buffer); - Assert.NotEqual(0, received); - count += received; - } - Assert.Equal(0, client.Available); - }) - }.WhenAllOrAnyFailed(); - } - [Fact] public async Task SendFileGetsCanceledByDispose() { @@ -503,4 +464,78 @@ public void EndSendFile_NullAsyncResult_Throws() Assert.Throws(() => s.EndSendFile(null)); } } + + // Running all cases of GreaterThan2GBFile_SendsAllBytes in parallel may attempt to allocate Min(ProcessorCount, Subclass_Count) * 2GB of disk space + // in extreme cases. Some CI machines may run out of disk space if this happens. + [Collection(nameof(NoParallelTests))] + public abstract class SendFile_NonParallel : SocketTestHelperBase where T : SocketHelperBase, new() + { + protected SendFile_NonParallel(ITestOutputHelper output) : base(output) + { + } + + [ActiveIssue("https://github.com/dotnet/runtime/issues/42534", TestPlatforms.Windows)] + [OuterLoop("Creates and sends a file several gigabytes long")] + [Fact] + public async Task GreaterThan2GBFile_SendsAllBytes() + { + const long FileLength = 100L + int.MaxValue; + + using var tmpFile = TempFile.Create(); + using (FileStream fs = File.Create(tmpFile.Path)) + { + fs.SetLength(FileLength); + } + + using var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + using var listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + listener.BindToAnonymousPort(IPAddress.Loopback); + listener.Listen(1); + + client.Connect(listener.LocalEndPoint); + using Socket server = listener.Accept(); + + await new Task[] + { + SendFileAsync(server, tmpFile.Path), + Task.Run(() => + { + byte[] buffer = new byte[100_000]; + long count = 0; + while (count < FileLength) + { + int received = client.Receive(buffer); + Assert.NotEqual(0, received); + count += received; + } + Assert.Equal(0, client.Available); + }) + }.WhenAllOrAnyFailed(); + } + } + + public sealed class SendFile_NonParallel_SyncSpan : SendFile_NonParallel + { + public SendFile_NonParallel_SyncSpan(ITestOutputHelper output) : base(output) { } + } + + public sealed class SendFile_NonParallel_SyncSpanForceNonBlocking : SendFile_NonParallel + { + public SendFile_NonParallel_SyncSpanForceNonBlocking(ITestOutputHelper output) : base(output) { } + } + + public sealed class SendFile_NonParallel_ArraySync : SendFile_NonParallel + { + public SendFile_NonParallel_ArraySync(ITestOutputHelper output) : base(output) { } + } + + public sealed class SendFile_NonParallel_Task : SendFile_NonParallel + { + public SendFile_NonParallel_Task(ITestOutputHelper output) : base(output) { } + } + + public sealed class SendFile_NonParallel_Apm : SendFile_NonParallel + { + public SendFile_NonParallel_Apm(ITestOutputHelper output) : base(output) { } + } } diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendPacketsAsync.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendPacketsAsync.cs index 29c24352c1a76c..10ebc472f93be2 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendPacketsAsync.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendPacketsAsync.cs @@ -6,11 +6,14 @@ using System.Net.Test.Common; using System.Threading; +using Microsoft.DotNet.XUnitExtensions; + using Xunit; using Xunit.Abstractions; namespace System.Net.Sockets.Tests { + [Collection(nameof(NoParallelTests))] public class SendPacketsAsync { private readonly ITestOutputHelper _log; @@ -525,7 +528,10 @@ public void SendPacketsElement_FileStreamMultiPart_Success() } } - [Fact] + public static bool IsNotWindows11 = !PlatformDetection.IsWindows10Version22000OrGreater; + + [ActiveIssue("https://github.com/dotnet/runtime/issues/58898")] + [ConditionalFact(nameof(IsNotWindows11))] public void SendPacketsElement_FileStreamLargeOffset_Throws() { using (var stream = new FileStream(TestFileName, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, useAsync: true)) @@ -548,7 +554,8 @@ public void SendPacketsElement_FileStreamLargeCount_Throws() } } - [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/58898")] + [ConditionalFact(nameof(IsNotWindows11))] public void SendPacketsElement_FileStreamWithOptions_Success() { using (var stream = new FileStream(TestFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 4096, FileOptions.Asynchronous | FileOptions.SequentialScan)) { var element = new SendPacketsElement(stream, 0, s_testFileSize); @@ -579,7 +586,8 @@ public void SendPacketsElement_FileStreamMultiPartMixed_Success() { } } - [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/58898")] + [ConditionalFact(nameof(IsNotWindows11))] public void SendPacketsElement_FileStreamMultiPartMixed_MultipleFileStreams_Success() { using (var stream = new FileStream(TestFileName, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.Asynchronous)) using (var stream2 = new FileStream(TestFileName, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.Asynchronous)) { diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceive.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceive.cs index 4d43977fa2b3cf..9e6d4cf7fc6f7b 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceive.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendReceive/SendReceive.cs @@ -1002,11 +1002,12 @@ await Task.WhenAny(disposeTask, receiveTask) [ActiveIssue("https://github.com/dotnet/runtime/issues/50568", TestPlatforms.Android)] public async Task TcpReceiveSendGetsCanceledByDispose(bool receiveOrSend, bool ipv6Server, bool dualModeClient) { - // RHEL7 kernel has a bug preventing close(AF_UNKNOWN) to succeed with IPv6 sockets. - // In this case Dispose will trigger a graceful shutdown, which means that receive will succeed on socket2. - // This bug is fixed in kernel 3.10.0-1160.25+. - // TODO: Remove this, once CI machines are updated to a newer kernel. - bool mayShutdownGraceful = UsesSync && PlatformDetection.IsRedHatFamily7 && receiveOrSend && (ipv6Server || dualModeClient); + // .NET uses connect(AF_UNSPEC) to abort on-going operations on Linux. + // Linux 6.4+ introduced a change (4faeee0cf8a5d88d63cdbc3bab124fb0e6aed08c) which disallows + // this operation while operations are on-going. + // When the connect fails, .NET falls back to use shutdown(SHUT_RDWR). + // This causes the receive on socket2 to succeed instead of failing with ConnectionReset. + bool mayShutdownGraceful = UsesSync && PlatformDetection.IsLinux && receiveOrSend; // We try this a couple of times to deal with a timing race: if the Dispose happens // before the operation is started, the peer won't see a ConnectionReset SocketException and we won't diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/TelemetryTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/TelemetryTest.cs index c8047e05d5f8fd..4f54f5457e83ec 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/TelemetryTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/TelemetryTest.cs @@ -158,6 +158,12 @@ await listener.RunWithCallbackAsync(e => events.Enqueue((e, e.ActivityId)), asyn [MemberData(nameof(SocketMethods_WithBools_MemberData))] public void EventSource_SocketConnectFailure_LogsConnectFailed(string connectMethod, bool useDnsEndPoint) { + if (connectMethod == "Sync" && PlatformDetection.IsLinux) + { + // [ActiveIssue("https://github.com/dotnet/runtime/issues/94149", TestPlatforms.Linux)] + return; + } + RemoteExecutor.Invoke(async (connectMethod, useDnsEndPointString) => { EndPoint endPoint = await GetRemoteEndPointAsync(useDnsEndPointString, port: 12345); diff --git a/src/libraries/System.Net.WebSockets.Client/System.Net.WebSockets.Client.sln b/src/libraries/System.Net.WebSockets.Client/System.Net.WebSockets.Client.sln index 6c64c7da37d5f8..a0efb293da7af1 100644 --- a/src/libraries/System.Net.WebSockets.Client/System.Net.WebSockets.Client.sln +++ b/src/libraries/System.Net.WebSockets.Client/System.Net.WebSockets.Client.sln @@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{A0314AC5-E49 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6F9A42A0-A04B-4CD0-B8C9-9A728274C851}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Net.WebSockets.Client.Wasm.Tests", "tests\wasm\System.Net.WebSockets.Client.Wasm.Tests.csproj", "{CA20532A-33B3-4DC0-92D2-EA6D7987D59F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -53,6 +55,10 @@ Global {6B9721B2-00D0-41EC-96B9-6428CF1830CF}.Debug|Any CPU.Build.0 = Debug|Any CPU {6B9721B2-00D0-41EC-96B9-6428CF1830CF}.Release|Any CPU.ActiveCfg = Release|Any CPU {6B9721B2-00D0-41EC-96B9-6428CF1830CF}.Release|Any CPU.Build.0 = Release|Any CPU + {CA20532A-33B3-4DC0-92D2-EA6D7987D59F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CA20532A-33B3-4DC0-92D2-EA6D7987D59F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CA20532A-33B3-4DC0-92D2-EA6D7987D59F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CA20532A-33B3-4DC0-92D2-EA6D7987D59F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -65,6 +71,7 @@ Global {0CD4C24D-7746-46F0-8D47-A396882B5468} = {6F9A42A0-A04B-4CD0-B8C9-9A728274C851} {8CD4D190-F656-4970-9AE9-4A9F8B30A2F8} = {6F9A42A0-A04B-4CD0-B8C9-9A728274C851} {59A23CAB-D098-495F-A467-74C7553FF5BB} = {6F9A42A0-A04B-4CD0-B8C9-9A728274C851} + {CA20532A-33B3-4DC0-92D2-EA6D7987D59F} = {BEE2F256-0489-4809-AB20-27ADB2D0E10C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D91D7DC5-24CC-4716-A357-8170C4EB1C32} diff --git a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs index 7159283212d601..01cc8c06603307 100644 --- a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs +++ b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocket.cs @@ -109,6 +109,9 @@ public override Task SendAsync(ArraySegment buffer, WebSocketMessageType m public override ValueTask SendAsync(ReadOnlyMemory buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) => ConnectedWebSocket.SendAsync(buffer, messageType, endOfMessage, cancellationToken); + public override ValueTask SendAsync(ReadOnlyMemory buffer, WebSocketMessageType messageType, WebSocketMessageFlags messageFlags, CancellationToken cancellationToken) => + ConnectedWebSocket.SendAsync(buffer, messageType, messageFlags, cancellationToken); + public override Task ReceiveAsync(ArraySegment buffer, CancellationToken cancellationToken) => ConnectedWebSocket.ReceiveAsync(buffer, cancellationToken); diff --git a/src/libraries/System.Net.WebSockets.Client/tests/DeflateTests.cs b/src/libraries/System.Net.WebSockets.Client/tests/DeflateTests.cs index e0a0e1e59fd846..f65f93a5664967 100644 --- a/src/libraries/System.Net.WebSockets.Client/tests/DeflateTests.cs +++ b/src/libraries/System.Net.WebSockets.Client/tests/DeflateTests.cs @@ -72,6 +72,100 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => }), new LoopbackServer.Options { WebSocketEndpoint = true }); } + [ConditionalFact(nameof(WebSocketsSupported))] + public async Task ThrowsWhenContinuationHasDifferentCompressionFlags() + { + var deflateOpt = new WebSocketDeflateOptions + { + ClientMaxWindowBits = 14, + ClientContextTakeover = true, + ServerMaxWindowBits = 14, + ServerContextTakeover = true + }; + await LoopbackServer.CreateClientAndServerAsync(async uri => + { + using var cws = new ClientWebSocket(); + using var cts = new CancellationTokenSource(TimeOutMilliseconds); + + cws.Options.DangerousDeflateOptions = deflateOpt; + await cws.ConnectAsync(uri, cts.Token); + + await cws.SendAsync(Memory.Empty, WebSocketMessageType.Text, WebSocketMessageFlags.DisableCompression, default); + Assert.Throws("messageFlags", () => + cws.SendAsync(Memory.Empty, WebSocketMessageType.Binary, WebSocketMessageFlags.EndOfMessage, default)); + }, server => server.AcceptConnectionAsync(async connection => + { + string extensionsReply = CreateDeflateOptionsHeader(deflateOpt); + await LoopbackHelper.WebSocketHandshakeAsync(connection, extensionsReply); + }), new LoopbackServer.Options { WebSocketEndpoint = true }); + } + + [ConditionalFact(nameof(WebSocketsSupported))] + public async Task SendHelloWithDisableCompression() + { + byte[] bytes = Encoding.ASCII.GetBytes("Hello"); + + int prefixLength = 2; + byte[] rawPrefix = new byte[] { 0x81, 0x85 }; // fin=1, rsv=0, opcode=text; mask=1, len=5 + int rawRemainingBytes = 9; // mask bytes (4) + payload bytes (5) + byte[] compressedPrefix = new byte[] { 0xc1, 0x87 }; // fin=1, rsv=compressed, opcode=text; mask=1, len=7 + int compressedRemainingBytes = 11; // mask bytes (4) + payload bytes (7) + + var deflateOpt = new WebSocketDeflateOptions + { + ClientMaxWindowBits = 14, + ClientContextTakeover = true, + ServerMaxWindowBits = 14, + ServerContextTakeover = true + }; + + await LoopbackServer.CreateClientAndServerAsync(async uri => + { + using var cws = new ClientWebSocket(); + using var cts = new CancellationTokenSource(TimeOutMilliseconds); + + cws.Options.DangerousDeflateOptions = deflateOpt; + await cws.ConnectAsync(uri, cts.Token); + + await cws.SendAsync(bytes, WebSocketMessageType.Text, true, cts.Token); + + WebSocketMessageFlags flags = WebSocketMessageFlags.DisableCompression | WebSocketMessageFlags.EndOfMessage; + await cws.SendAsync(bytes, WebSocketMessageType.Text, flags, cts.Token); + }, server => server.AcceptConnectionAsync(async connection => + { + var buffer = new byte[compressedRemainingBytes]; + string extensionsReply = CreateDeflateOptionsHeader(deflateOpt); + await LoopbackHelper.WebSocketHandshakeAsync(connection, extensionsReply); + + // first message is compressed + await ReadExactAsync(buffer, prefixLength); + Assert.Equal(compressedPrefix, buffer[..prefixLength]); + // read rest of the frame + await ReadExactAsync(buffer, compressedRemainingBytes); + + // second message is not compressed + await ReadExactAsync(buffer, prefixLength); + Assert.Equal(rawPrefix, buffer[..prefixLength]); + // read rest of the frame + await ReadExactAsync(buffer, rawRemainingBytes); + + async Task ReadExactAsync(byte[] buf, int n) + { + var mem = buf.AsMemory(0, n); + int totalRead = 0; + while (totalRead < n) + { + int read = await connection.Stream.ReadAsync(mem.Slice(totalRead)).ConfigureAwait(false); + if (read == 0) + { + throw new Exception("Unexpected end of stream"); + } + totalRead += read; + } + } + }), new LoopbackServer.Options { WebSocketEndpoint = true }); + } + private static string CreateDeflateOptionsHeader(WebSocketDeflateOptions options) { var builder = new StringBuilder(); diff --git a/src/libraries/System.Net.WebSockets.Client/tests/SendReceiveTest.cs b/src/libraries/System.Net.WebSockets.Client/tests/SendReceiveTest.cs index f5d86dfff25ba8..b8b4159e2db52d 100644 --- a/src/libraries/System.Net.WebSockets.Client/tests/SendReceiveTest.cs +++ b/src/libraries/System.Net.WebSockets.Client/tests/SendReceiveTest.cs @@ -255,12 +255,12 @@ await SendAsync( "ReceiveAsync"), ex.Message); - Assert.Equal(WebSocketState.Aborted, cws.State); + Assert.True(WebSocketState.Aborted == cws.State, cws.State+" state when InvalidOperationException"); } else if (ex is WebSocketException) { // Multiple cases. - Assert.Equal(WebSocketState.Aborted, cws.State); + Assert.True(WebSocketState.Aborted == cws.State, cws.State + " state when WebSocketException"); WebSocketError errCode = (ex as WebSocketException).WebSocketErrorCode; Assert.True( @@ -269,7 +269,7 @@ await SendAsync( } else if (ex is OperationCanceledException) { - Assert.Equal(WebSocketState.Aborted, cws.State); + Assert.True(WebSocketState.Aborted == cws.State, cws.State + " state when OperationCanceledException"); } else { diff --git a/src/libraries/System.Net.WebSockets.Client/tests/wasm/BrowserTimerThrottlingTest.cs b/src/libraries/System.Net.WebSockets.Client/tests/wasm/BrowserTimerThrottlingTest.cs new file mode 100644 index 00000000000000..bd44afd52fab56 --- /dev/null +++ b/src/libraries/System.Net.WebSockets.Client/tests/wasm/BrowserTimerThrottlingTest.cs @@ -0,0 +1,181 @@ +// 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.Generic; +using System.Linq; +using System.Net.WebSockets.Client.Tests; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace System.Net.WebSockets.Client.Wasm.Tests +{ + // https://developer.chrome.com/blog/timer-throttling-in-chrome-88/ + // https://docs.google.com/document/d/11FhKHRcABGS4SWPFGwoL6g0ALMqrFKapCk5ZTKKupEk/view + // requires chromium based browser + // requires minimized browser or browser tab out of focus, browser can't be headless + // requires --enable-features=IntensiveWakeUpThrottling:grace_period_seconds/1 chromeDriver flags + // doesn't work with --disable-background-timer-throttling + [TestCaseOrderer("System.Net.WebSockets.Client.Wasm.Tests.AlphabeticalOrderer", "System.Net.WebSockets.Client.Wasm.Tests")] + public class BrowserTimerThrottlingTest : ClientWebSocketTestBase + { + public static bool IsBrowser => RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")); + const double moreThanLightThrottlingThreshold = 1900; + const double detectLightThrottlingThreshold = 900; + const double webSocketMessageFrequency = 45000; + const double fastTimeoutFrequency = 100; + + public BrowserTimerThrottlingTest(ITestOutputHelper output) : base(output) { } + + [ConditionalFact(nameof(PlatformDetection.IsBrowser))] + [OuterLoop] // involves long delay + // this test is influenced by usage of WS on the same browser tab in previous unit tests. we may need to wait long time for it to fizzle down + public async Task DotnetTimersAreHeavilyThrottledWithoutWebSocket() + { + double maxDelayMs = 0; + double maxLightDelayMs = 0; + DateTime start = DateTime.Now; + CancellationTokenSource cts = new CancellationTokenSource(); + + using (var timer = new Timers.Timer(fastTimeoutFrequency)) + { + DateTime last = DateTime.Now; + timer.AutoReset = true; + timer.Enabled = true; + timer.Elapsed += (object? source, Timers.ElapsedEventArgs? e) => + { + var ms = (e.SignalTime - last).TotalMilliseconds; + if (maxDelayMs < ms) + { + maxDelayMs = ms; + } + if (ms > moreThanLightThrottlingThreshold) + { +#if DEBUG + Console.WriteLine("Too slow tick " + ms); +#endif + // stop, we are throttled heavily, this is what we are looking for + cts.Cancel(); + } + else if (ms > detectLightThrottlingThreshold) + { + maxLightDelayMs = ms; + // we are lightly throttled +#if DEBUG + Console.WriteLine("Slow tick NO-WS " + ms); +#endif + } + last = e.SignalTime; + }; + + // test it for 10 minutes + try { await Task.Delay(10 * 60 * 1000, cts.Token); } catch (Exception) { } + timer.Close(); + } + Assert.True(maxDelayMs > detectLightThrottlingThreshold, "Expect that it throttled lightly " + maxDelayMs); + Assert.True(maxDelayMs > moreThanLightThrottlingThreshold, "Expect that it was heavily throttled " + maxDelayMs); + } + + [ConditionalFact(nameof(WebSocketsSupported), nameof(PlatformDetection.IsBrowser))] + [OuterLoop] // involves long delay + public async Task WebSocketKeepsDotnetTimersOnlyLightlyThrottled() + { + double maxDelayMs = 0; + double maxLightDelayMs = 0; + DateTime start = DateTime.Now; + CancellationTokenSource cts = new CancellationTokenSource(); + + using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(Test.Common.Configuration.WebSockets.RemoteEchoServer, TimeOutMilliseconds, _output)) + { + await SendAndReceive(cws, "test"); + using (var timer = new Timers.Timer(fastTimeoutFrequency)) + { + DateTime last = DateTime.Now; + DateTime lastSent = DateTime.MinValue; + timer.AutoReset = true; + timer.Enabled = true; + timer.Elapsed += async (object? source, Timers.ElapsedEventArgs? e) => + { + var ms = (e.SignalTime - last).TotalMilliseconds; + var msSent = (e.SignalTime - lastSent).TotalMilliseconds; + if (maxDelayMs < ms) + { + maxDelayMs = ms; + } + if (ms > moreThanLightThrottlingThreshold) + { + // fail fast, we are throttled heavily +#if DEBUG + Console.WriteLine("Too slow tick " + ms); +#endif + cts.Cancel(); + } + else if (ms > detectLightThrottlingThreshold) + { + maxLightDelayMs = ms; + // we are lightly throttled +#if DEBUG + Console.WriteLine("Slow tick WS " + ms); +#endif + } + if (msSent > webSocketMessageFrequency) + { + await SendAndReceive(cws, "test"); + lastSent = DateTime.Now; + } + last = e.SignalTime; + }; + + // test it for 10 minutes + try { await Task.Delay(10 * 60 * 1000, cts.Token); } catch (Exception) { } + timer.Close(); + } + await cws.CloseAsync(WebSocketCloseStatus.NormalClosure, "WebSocketKeepsDotnetTimersOnlyLightlyThrottled", CancellationToken.None); + } + Assert.True(maxDelayMs > detectLightThrottlingThreshold, "Expect that it throttled lightly " + maxDelayMs); + Assert.True(maxDelayMs < moreThanLightThrottlingThreshold, "Expect that it wasn't heavily throttled " + maxDelayMs); + } + + private async static Task SendAndReceive(ClientWebSocket cws, string message) + { + try + { + byte[] buffer = Encoding.UTF8.GetBytes(message); + await cws.SendAsync(new ArraySegment(buffer), WebSocketMessageType.Text, true, CancellationToken.None); + + var receiveBuffer = new byte[100]; + var receiveSegment = new ArraySegment(receiveBuffer); + WebSocketReceiveResult recvRet = await cws.ReceiveAsync(receiveSegment, CancellationToken.None); +#if DEBUG + Console.WriteLine("SendAndReceive"); +#endif + } + catch (OperationCanceledException) + { + } +#if DEBUG + catch (Exception ex) + { + Console.WriteLine("SendAndReceive fail:" + ex); + } +#endif + } + } + + // this is just for convinience, as the second test has side-effect to running page, the first test would take longer if they are in another order + public class AlphabeticalOrderer : ITestCaseOrderer + { + public IEnumerable OrderTestCases(IEnumerable testCases) + where TTestCase : ITestCase + { + List result = testCases.ToList(); + result.Sort((x, y) => StringComparer.Ordinal.Compare(x.TestMethod.Method.Name, y.TestMethod.Method.Name)); + return result; + } + } +} diff --git a/src/libraries/System.Net.WebSockets.Client/tests/wasm/System.Net.WebSockets.Client.Wasm.Tests.csproj b/src/libraries/System.Net.WebSockets.Client/tests/wasm/System.Net.WebSockets.Client.Wasm.Tests.csproj new file mode 100644 index 00000000000000..754539cfe25eaa --- /dev/null +++ b/src/libraries/System.Net.WebSockets.Client/tests/wasm/System.Net.WebSockets.Client.Wasm.Tests.csproj @@ -0,0 +1,66 @@ + + + ../../src/Resources/Strings.resx + $(NetCoreAppCurrent)-Browser + $(DefineConstants);NETSTANDARD + + + + --background-throttling + WasmTestOnBrowser + $(TestArchiveRoot)browseronly/ + $(TestArchiveTestsRoot)$(OSPlatformConfig)/ + $(DefineConstants);TARGET_BROWSER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Net.WebSockets.Client/tests/wasm/System.Net.WebSockets.Client.Wasm.Tests.sln b/src/libraries/System.Net.WebSockets.Client/tests/wasm/System.Net.WebSockets.Client.Wasm.Tests.sln new file mode 100644 index 00000000000000..11f24affd5e1c1 --- /dev/null +++ b/src/libraries/System.Net.WebSockets.Client/tests/wasm/System.Net.WebSockets.Client.Wasm.Tests.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31521.260 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Net.WebSockets.Client.Wasm.Tests", "System.Net.WebSockets.Client.Wasm.Tests.csproj", "{DA6DF153-169E-485D-90A4-EDBDA54B32A6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DA6DF153-169E-485D-90A4-EDBDA54B32A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA6DF153-169E-485D-90A4-EDBDA54B32A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA6DF153-169E-485D-90A4-EDBDA54B32A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA6DF153-169E-485D-90A4-EDBDA54B32A6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {627DB5DF-DE31-44B4-B5FD-E5666467145E} + EndGlobalSection +EndGlobal diff --git a/src/libraries/System.Net.WebSockets/src/Resources/Strings.resx b/src/libraries/System.Net.WebSockets/src/Resources/Strings.resx index 693f8d3863fd7f..e96ac19e3f8ef4 100644 --- a/src/libraries/System.Net.WebSockets/src/Resources/Strings.resx +++ b/src/libraries/System.Net.WebSockets/src/Resources/Strings.resx @@ -165,4 +165,7 @@ The compression options for a continuation cannot be different than the options used to send the first fragment of the message. - \ No newline at end of file + + The WebSocket received a frame with an invalid payload length. + + diff --git a/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/Compression/WebSocketDeflater.cs b/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/Compression/WebSocketDeflater.cs index 7d8eb832c2e2ad..7c8db8eedcc871 100644 --- a/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/Compression/WebSocketDeflater.cs +++ b/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/Compression/WebSocketDeflater.cs @@ -144,7 +144,13 @@ private unsafe void UnsafeDeflate(ReadOnlySpan input, Span output, o consumed = input.Length - (int)_stream.AvailIn; written = output.Length - (int)_stream.AvailOut; - needsMoreBuffer = errorCode == ErrorCode.BufError || _stream.AvailIn > 0; + // It is important here to also check that we haven't + // exhausted the output buffer because after deflating we're + // always going to issue a flush and a flush with empty output + // is going to throw. + needsMoreBuffer = errorCode == ErrorCode.BufError + || _stream.AvailIn > 0 + || written == output.Length; } } @@ -152,6 +158,7 @@ private unsafe int UnsafeFlush(Span output, out bool needsMoreBuffer) { Debug.Assert(_stream is not null); Debug.Assert(_stream.AvailIn == 0); + Debug.Assert(output.Length > 0); fixed (byte* fixedOutput = output) { diff --git a/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs b/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs index 05b171cf94ed72..ec62d92ac11a9a 100644 --- a/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs +++ b/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs @@ -1116,6 +1116,14 @@ private async ValueTask CloseWithReceiveErrorAndThrowAsync( return SR.net_Websockets_ReservedBitsSet; } + if (header.PayloadLength < 0) + { + // as per RFC, if payload length is a 64-bit integer, the most significant bit MUST be 0 + // frame-payload-length-63 = %x0000000000000000-7FFFFFFFFFFFFFFF; 64 bits in length + resultHeader = default; + return SR.net_Websockets_InvalidPayloadLength; + } + if (header.Compressed && _inflater is null) { resultHeader = default; diff --git a/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs b/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs index f940df0add3aee..f9fd4e3c564e57 100644 --- a/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs +++ b/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs @@ -149,6 +149,37 @@ public async Task ReceiveAsync_InvalidFrameHeader_AbortsAndThrowsException(byte } } + [Theory] + [InlineData(new byte[] { 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, false)] // max allowed value + [InlineData(new byte[] { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, true)] + public async Task ReceiveAsync_InvalidPayloadLength_AbortsAndThrowsException(byte[] lenBytes, bool shouldFail) + { + var frame = new byte[11]; + frame[0] = 0b1_000_0010; // FIN, RSV, OPCODE + frame[1] = 0b0_1111111; // MASK, PAYLOAD_LEN + Assert.Equal(8, lenBytes.Length); + Array.Copy(lenBytes, 0, frame, 2, lenBytes.Length); // EXTENDED_PAYLOAD_LEN + frame[10] = (byte)'a'; + + using var stream = new MemoryStream(frame, writable: true); + using WebSocket websocket = CreateFromStream(stream, false, null, Timeout.InfiniteTimeSpan); + + var buffer = new byte[1]; + Task t = websocket.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None); + if (shouldFail) + { + var exc = await Assert.ThrowsAsync(() => t); + Assert.Equal(WebSocketState.Aborted, websocket.State); + } + else + { + WebSocketReceiveResult result = await t; + Assert.False(result.EndOfMessage); + Assert.Equal(1, result.Count); + Assert.Equal('a', (char)buffer[0]); + } + } + [Fact] [SkipOnPlatform(TestPlatforms.Browser, "System.Net.Sockets is not supported on this platform.")] [ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] diff --git a/src/libraries/System.Private.CoreLib/generators/EventSourceGenerator.Parser.cs b/src/libraries/System.Private.CoreLib/generators/EventSourceGenerator.Parser.cs index be971bb185f0b8..2b28b46e03335b 100644 --- a/src/libraries/System.Private.CoreLib/generators/EventSourceGenerator.Parser.cs +++ b/src/libraries/System.Private.CoreLib/generators/EventSourceGenerator.Parser.cs @@ -7,10 +7,10 @@ using System.Security.Cryptography; using System.Text; using System.Threading; - using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.DotnetRuntime.Extensions; namespace Generators { @@ -31,14 +31,14 @@ public Parser(Compilation compilation, Action reportDiagnostic, Canc public EventSourceClass[] GetEventSourceClasses(List classDeclarations) { - INamedTypeSymbol? autogenerateAttribute = _compilation.GetTypeByMetadataName("System.Diagnostics.Tracing.EventSourceAutoGenerateAttribute"); + INamedTypeSymbol? autogenerateAttribute = _compilation.GetBestTypeByMetadataName("System.Diagnostics.Tracing.EventSourceAutoGenerateAttribute"); if (autogenerateAttribute is null) { // No EventSourceAutoGenerateAttribute return Array.Empty(); } - INamedTypeSymbol? eventSourceAttribute = _compilation.GetTypeByMetadataName("System.Diagnostics.Tracing.EventSourceAttribute"); + INamedTypeSymbol? eventSourceAttribute = _compilation.GetBestTypeByMetadataName("System.Diagnostics.Tracing.EventSourceAttribute"); if (eventSourceAttribute is null) { // No EventSourceAttribute diff --git a/src/libraries/System.Private.CoreLib/generators/System.Private.CoreLib.Generators.csproj b/src/libraries/System.Private.CoreLib/generators/System.Private.CoreLib.Generators.csproj index bf6c663b56432f..451bb520f66ead 100644 --- a/src/libraries/System.Private.CoreLib/generators/System.Private.CoreLib.Generators.csproj +++ b/src/libraries/System.Private.CoreLib/generators/System.Private.CoreLib.Generators.csproj @@ -15,6 +15,7 @@ + diff --git a/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ExtraApis.cs b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ExtraApis.cs new file mode 100644 index 00000000000000..14b395cf4c868f --- /dev/null +++ b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ExtraApis.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// NOTE: Types/members which are not publicly exposed in System.Runtime.dll but still used internally by libraries. +// Manually maintained, keep in sync with System.Private.CoreLib.ExtraApis.txt + +namespace System.Runtime.Serialization +{ + public readonly partial struct DeserializationToken : System.IDisposable + { +#pragma warning disable CS0414 + private readonly object _dummy = null; + private readonly int _dummyPrimitive = 0; +#pragma warning restore CS0414 + internal DeserializationToken(object tracker) { } + public void Dispose() { } + } + public sealed partial class SerializationInfo + { + public static System.Runtime.Serialization.DeserializationToken StartDeserialization() { throw null; } + } +} +namespace System.Diagnostics +{ + public partial class DebugProvider + { + public DebugProvider() { } + [System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute] + public virtual void Fail(string? message, string? detailMessage) { throw null; } + public static void FailCore(string stackTrace, string? message, string? detailMessage, string errorSource) { } + public virtual void OnIndentLevelChanged(int indentLevel) { } + public virtual void OnIndentSizeChanged(int indentSize) { } + public virtual void Write(string? message) { } + public static void WriteCore(string message) { } + public virtual void WriteLine(string? message) { } + } + public static partial class Debug + { + public static System.Diagnostics.DebugProvider SetProvider(System.Diagnostics.DebugProvider provider) { throw null; } + } +} diff --git a/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ManualShimTypeForwards.cs b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ManualShimTypeForwards.cs new file mode 100644 index 00000000000000..504e6898bb2f91 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ManualShimTypeForwards.cs @@ -0,0 +1,153 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// NOTE: Types/members which are not publicly exposed in System.Runtime.dll but are forwarded from the mscorlib.dll shim. +// Manually maintained. + +namespace System +{ + public sealed partial class CultureAwareComparer : System.StringComparer, System.Runtime.Serialization.ISerializable + { + internal CultureAwareComparer() { } + public override int Compare(string? x, string? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(string? x, string? y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(string obj) { throw null; } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public partial class OrdinalComparer : System.StringComparer + { + internal OrdinalComparer() { } + public override int Compare(string? x, string? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(string? x, string? y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(string obj) { throw null; } + } + public sealed partial class UnitySerializationHolder : System.Runtime.Serialization.IObjectReference, System.Runtime.Serialization.ISerializable + { + public UnitySerializationHolder(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public object GetRealObject(System.Runtime.Serialization.StreamingContext context) { throw null; } + } +} +namespace System.Collections +{ + public partial class ListDictionaryInternal : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable + { + public ListDictionaryInternal() { } + public int Count { get { throw null; } } + public bool IsFixedSize { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public object? this[object key] { get { throw null; } set { } } + public System.Collections.ICollection Keys { get { throw null; } } + public object SyncRoot { get { throw null; } } + public System.Collections.ICollection Values { get { throw null; } } + public void Add(object key, object? value) { } + public void Clear() { } + public bool Contains(object key) { throw null; } + public void CopyTo(System.Array array, int index) { } + public System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; } + public void Remove(object key) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } +} +namespace System.Collections.Generic +{ + public sealed partial class ByteEqualityComparer : System.Collections.Generic.EqualityComparer + { + public ByteEqualityComparer() { } + public override bool Equals(byte x, byte y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(byte b) { throw null; } + } + public sealed partial class EnumEqualityComparer : System.Collections.Generic.EqualityComparer, System.Runtime.Serialization.ISerializable where T : struct + { + public EnumEqualityComparer() { } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(T x, T y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(T obj) { throw null; } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class GenericComparer : System.Collections.Generic.Comparer where T : System.IComparable + { + public GenericComparer() { } + public override int Compare(T? x, T? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + } + public sealed partial class GenericEqualityComparer : System.Collections.Generic.EqualityComparer where T : System.IEquatable + { + public GenericEqualityComparer() { } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(T? x, T? y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode([System.Diagnostics.CodeAnalysis.DisallowNullAttribute] T obj) { throw null; } + } + public partial class NonRandomizedStringEqualityComparer : System.Collections.Generic.IEqualityComparer, System.Runtime.Serialization.ISerializable + { + protected NonRandomizedStringEqualityComparer(System.Runtime.Serialization.SerializationInfo information, System.Runtime.Serialization.StreamingContext context) { } + public virtual bool Equals(string? x, string? y) { throw null; } + public virtual int GetHashCode(string? obj) { throw null; } + public static System.Collections.Generic.IEqualityComparer? GetStringComparer(object? comparer) { throw null; } + public virtual System.Collections.Generic.IEqualityComparer GetUnderlyingEqualityComparer() { throw null; } + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class NullableComparer : System.Collections.Generic.Comparer, System.Runtime.Serialization.ISerializable where T : struct + { + public NullableComparer() { } + public override int Compare(T? x, T? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class NullableEqualityComparer : System.Collections.Generic.EqualityComparer, System.Runtime.Serialization.ISerializable where T : struct + { + public NullableEqualityComparer() { } + public override bool Equals(T? x, T? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(T? obj) { throw null; } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class ObjectComparer : System.Collections.Generic.Comparer + { + public ObjectComparer() { } + public override int Compare(T? x, T? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + } + public sealed partial class ObjectEqualityComparer : System.Collections.Generic.EqualityComparer + { + public ObjectEqualityComparer() { } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(T? x, T? y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode([System.Diagnostics.CodeAnalysis.DisallowNullAttribute] T obj) { throw null; } + } +} +namespace System.Diagnostics.Contracts +{ + public sealed partial class ContractException : System.Exception + { + public ContractException(System.Diagnostics.Contracts.ContractFailureKind kind, string? failure, string? userMessage, string? condition, System.Exception? innerException) { } + public string? Condition { get { throw null; } } + public string Failure { get { throw null; } } + public System.Diagnostics.Contracts.ContractFailureKind Kind { get { throw null; } } + public string? UserMessage { get { throw null; } } + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } +} +namespace System.Reflection.Emit +{ + public enum PEFileKinds + { + Dll = 1, + ConsoleApplication = 2, + WindowApplication = 3, + } +} diff --git a/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.csproj b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.csproj new file mode 100644 index 00000000000000..e8787e79c478f2 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.csproj @@ -0,0 +1,51 @@ + + + $(NetCoreAppCurrent) + true + enable + + v4.0.30319 + + $(NoWarn);0809;0618;CS8614;CS3015 + SilverlightPlatform + true + $(DefineConstants);BUILDING_CORELIB_REFERENCE + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml index 53a41aff8c935a..ee28b6e38cfe61 100644 --- a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml +++ b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml @@ -4,5 +4,9 @@ + + + + diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.OverlappedValueTaskSource.Windows.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.OverlappedValueTaskSource.Windows.cs index 9f689b161bbd00..c2eab851bd60e2 100644 --- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.OverlappedValueTaskSource.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.OverlappedValueTaskSource.Windows.cs @@ -86,8 +86,11 @@ internal static Exception GetIOError(int errorCode, string? path) _bufferSize = memory.Length; _memoryHandle = memory.Pin(); _overlapped = _fileHandle.ThreadPoolBinding!.AllocateNativeOverlapped(_preallocatedOverlapped); - _overlapped->OffsetLow = (int)fileOffset; - _overlapped->OffsetHigh = (int)(fileOffset >> 32); + if (_fileHandle.CanSeek) + { + _overlapped->OffsetLow = (int)fileOffset; + _overlapped->OffsetHigh = (int)(fileOffset >> 32); + } return _overlapped; } diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs index ee1def85b9e024..266fd93e5082da 100644 --- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs @@ -16,6 +16,7 @@ public sealed partial class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid // not using bool? as it's not thread safe private volatile NullableBool _canSeek = NullableBool.Undefined; + private volatile NullableBool _supportsRandomAccess = NullableBool.Undefined; private bool _deleteOnClose; private bool _isLocked; @@ -33,6 +34,25 @@ private SafeFileHandle(bool ownsHandle) internal bool CanSeek => !IsClosed && GetCanSeek(); + internal bool SupportsRandomAccess + { + get + { + NullableBool supportsRandomAccess = _supportsRandomAccess; + if (supportsRandomAccess == NullableBool.Undefined) + { + _supportsRandomAccess = supportsRandomAccess = GetCanSeek() ? NullableBool.True : NullableBool.False; + } + + return supportsRandomAccess == NullableBool.True; + } + set + { + Debug.Assert(value == false); // We should only use the setter to disable random access. + _supportsRandomAccess = value ? NullableBool.True : NullableBool.False; + } + } + internal ThreadPoolBoundHandle? ThreadPoolBinding => null; internal void EnsureThreadPoolBindingInitialized() { /* nop */ } @@ -121,17 +141,6 @@ private static bool DirectoryExists(string fullPath) protected override bool ReleaseHandle() { - // When the SafeFileHandle was opened, we likely issued an flock on the created descriptor in order to add - // an advisory lock. This lock should be removed via closing the file descriptor, but close can be - // interrupted, and we don't retry closes. As such, we could end up leaving the file locked, - // which could prevent subsequent usage of the file until this process dies. To avoid that, we proactively - // try to release the lock before we close the handle. - if (_isLocked) - { - Interop.Sys.FLock(handle, Interop.Sys.LockOperations.LOCK_UN); // ignore any errors - _isLocked = false; - } - // If DeleteOnClose was requested when constructed, delete the file now. // (Unix doesn't directly support DeleteOnClose, so we mimic it here.) if (_deleteOnClose) @@ -143,6 +152,17 @@ protected override bool ReleaseHandle() Interop.Sys.Unlink(_path); // ignore errors; it's valid that the path may no longer exist } + // When the SafeFileHandle was opened, we likely issued an flock on the created descriptor in order to add + // an advisory lock. This lock should be removed via closing the file descriptor, but close can be + // interrupted, and we don't retry closes. As such, we could end up leaving the file locked, + // which could prevent subsequent usage of the file until this process dies. To avoid that, we proactively + // try to release the lock before we close the handle. + if (_isLocked) + { + Interop.Sys.FLock(handle, Interop.Sys.LockOperations.LOCK_UN); // ignore any errors + _isLocked = false; + } + // Close the descriptor. Although close is documented to potentially fail with EINTR, we never want // to retry, as the descriptor could actually have been closed, been subsequently reassigned, and // be in use elsewhere in the process. Instead, we simply check whether the call was successful. @@ -274,7 +294,6 @@ private static Interop.Sys.OpenFlags PreOpenConfigurationFromOptions(FileMode mo private void Init(string path, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize) { IsAsync = (options & FileOptions.Asynchronous) != 0; - _deleteOnClose = (options & FileOptions.DeleteOnClose) != 0; // Lock the file if requested via FileShare. This is only advisory locking. FileShare.None implies an exclusive // lock on the file and all other modes use a shared lock. While this is not as granular as Windows, not mandatory, @@ -293,6 +312,10 @@ private void Init(string path, FileMode mode, FileAccess access, FileShare share } } + // Enable DeleteOnClose when we've succesfully locked the file. + // On Windows, the locking happens atomically as part of opening the file. + _deleteOnClose = (options & FileOptions.DeleteOnClose) != 0; + // These provide hints around how the file will be accessed. Specifying both RandomAccess // and Sequential together doesn't make sense as they are two competing options on the same spectrum, // so if both are specified, we prefer RandomAccess (behavior on Windows is unspecified if both are provided). @@ -323,20 +346,24 @@ private void Init(string path, FileMode mode, FileAccess access, FileShare share } } - // If preallocationSize has been provided for a creatable and writeable file - if (FileStreamHelpers.ShouldPreallocate(preallocationSize, access, mode)) + if (preallocationSize > 0 && Interop.Sys.FAllocate(this, 0, preallocationSize) < 0) { - int fallocateResult = Interop.Sys.PosixFAllocate(this, 0, preallocationSize); - if (fallocateResult != 0) + Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); + + // Only throw for errors that indicate there is not enough space. + if (errorInfo.Error == Interop.Error.EFBIG || + errorInfo.Error == Interop.Error.ENOSPC) { Dispose(); - Interop.Sys.Unlink(path!); // remove the file to mimic Windows behaviour (atomic operation) - Debug.Assert(fallocateResult == -1 || fallocateResult == -2); - throw new IOException(SR.Format( - fallocateResult == -1 ? SR.IO_DiskFull_Path_AllocationSize : SR.IO_FileTooLarge_Path_AllocationSize, - path, - preallocationSize)); + // Delete the file we've created. + Debug.Assert(mode == FileMode.Create || mode == FileMode.CreateNew); + Interop.Sys.Unlink(path!); + + throw new IOException(SR.Format(errorInfo.Error == Interop.Error.EFBIG + ? SR.IO_FileTooLarge_Path_AllocationSize + : SR.IO_DiskFull_Path_AllocationSize, + path, preallocationSize)); } } } diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs index a7c4751a094786..3352f0194e73b9 100644 --- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs @@ -34,7 +34,7 @@ internal static unsafe SafeFileHandle Open(string fullPath, FileMode mode, FileA // of converting DOS to NT file paths (RtlDosPathNameToRelativeNtPathName_U_WithStatus is not documented) SafeFileHandle fileHandle = CreateFile(fullPath, mode, access, share, options); - if (FileStreamHelpers.ShouldPreallocate(preallocationSize, access, mode)) + if (preallocationSize > 0) { Preallocate(fullPath, preallocationSize, fileHandle); } @@ -121,19 +121,19 @@ private static unsafe void Preallocate(string fullPath, long preallocationSize, { int errorCode = Marshal.GetLastPInvokeError(); - // we try to mimic the atomic NtCreateFile here: - // if preallocation fails, close the handle and delete the file - fileHandle.Dispose(); - Interop.Kernel32.DeleteFile(fullPath); - - switch (errorCode) + // Only throw for errors that indicate there is not enough space. + if (errorCode == Interop.Errors.ERROR_DISK_FULL || + errorCode == Interop.Errors.ERROR_FILE_TOO_LARGE) { - case Interop.Errors.ERROR_DISK_FULL: - throw new IOException(SR.Format(SR.IO_DiskFull_Path_AllocationSize, fullPath, preallocationSize)); - case Interop.Errors.ERROR_FILE_TOO_LARGE: - throw new IOException(SR.Format(SR.IO_FileTooLarge_Path_AllocationSize, fullPath, preallocationSize)); - default: - throw Win32Marshal.GetExceptionForWin32Error(errorCode, fullPath); + fileHandle.Dispose(); + + // Delete the file we've created. + Interop.Kernel32.DeleteFile(fullPath); + + throw new IOException(SR.Format(errorCode == Interop.Errors.ERROR_DISK_FULL + ? SR.IO_DiskFull_Path_AllocationSize + : SR.IO_FileTooLarge_Path_AllocationSize, + fullPath, preallocationSize)); } } } diff --git a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx index 6cd99cac9c9531..51a88bdb625cd0 100644 --- a/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx +++ b/src/libraries/System.Private.CoreLib/src/Resources/Strings.resx @@ -528,6 +528,9 @@ Type passed must be an interface. + + Object must be of type NFloat. + Type must be a Pointer. @@ -1092,6 +1095,12 @@ Append access can be requested only in write-only mode. + + Preallocation size can be requested only in write mode. + + + Preallocation size can be requested only for new files. + Type of argument is not compatible with the generic comparer. @@ -2608,6 +2617,9 @@ Common Language Runtime detected an invalid program. + + The time zone ID '{0}' is invalid. + The time zone ID '{0}' was found on the local computer, but the file at '{1}' was corrupt. @@ -2632,6 +2644,9 @@ This assembly does not have a file table because it was loaded from memory. + + Unsupported unseekable file. + Unable to read beyond the end of the stream. @@ -2659,9 +2674,6 @@ BindHandle for ThreadPool failed on this handle. - - The link's file system entry type is inconsistent with that of its target: {0} - The file '{0}' already exists. diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 5a1593f032c69a..21af116b5c8a0b 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -761,7 +761,7 @@ - + @@ -1567,9 +1567,6 @@ Common\Interop\Windows\Kernel32\Interop.GetTempFileNameW.cs - - Common\Interop\Windows\Kernel32\Interop.GetTempPathW.cs - Common\Interop\Windows\Kernel32\Interop.GetVolumeInformation.cs @@ -1684,6 +1681,9 @@ Common\Interop\Windows\Kernel32\Interop.SystemTimeToFileTime.cs + + Common\Interop\Windows\Kernel32\Interop.Threading.cs + Common\Interop\Windows\Kernel32\Interop.TimeZone.cs @@ -1954,8 +1954,8 @@ Common\Interop\Unix\System.Native\Interop.GetCwd.cs - - Common\Interop\Unix\System.Native\Interop.GetDefaultTimeZone.Android.cs + + Common\Interop\Unix\System.Native\Interop.GetDefaultTimeZone.AnyMobile.cs Common\Interop\Unix\System.Native\Interop.GetEGid.cs @@ -2029,8 +2029,8 @@ Common\Interop\Unix\System.Native\Interop.PosixFAdvise.cs - - Common\Interop\Unix\System.Native\Interop.PosixFAllocate.cs + + Common\Interop\Unix\System.Native\Interop.FAllocate.cs Common\Interop\Unix\System.Native\Interop.PRead.cs @@ -2098,7 +2098,7 @@ - + @@ -2112,6 +2112,8 @@ + + @@ -2155,14 +2157,15 @@ Link="Common\Interop\Linux\Interop.ProcFsStat.TryReadStatusFile.cs" /> - - + + @@ -2265,8 +2268,8 @@ - - + + @@ -2298,9 +2301,6 @@ - - Interop\Windows\Kernel32\Interop.Threading.cs - @@ -2325,4 +2325,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Private.CoreLib/src/System/AppContext.AnyOS.cs b/src/libraries/System.Private.CoreLib/src/System/AppContext.AnyOS.cs index c8b5fcba415f5e..94760aa0ef991c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/AppContext.AnyOS.cs +++ b/src/libraries/System.Private.CoreLib/src/System/AppContext.AnyOS.cs @@ -1,7 +1,10 @@ // 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.Generic; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.Tracing; using System.IO; using System.Reflection; @@ -30,5 +33,52 @@ private static string GetBaseDirectoryCore() return directory; } + + internal static void LogSwitchValues(RuntimeEventSource ev) + { + if (s_switches is not null) + { + lock (s_switches) + { + foreach (KeyValuePair kvp in s_switches) + { + // Convert bool to int because it's cheaper to log (no boxing) + ev.LogAppContextSwitch(kvp.Key, kvp.Value ? 1 : 0); + } + } + } + + if (s_dataStore is not null) + { + lock (s_dataStore) + { + if (s_switches is not null) + { + lock (s_switches) + { + LogDataStore(ev, s_switches); + } + } + else + { + LogDataStore(ev, null); + } + + static void LogDataStore(RuntimeEventSource ev, Dictionary? switches) + { + Debug.Assert(s_dataStore is not null); + foreach (KeyValuePair kvp in s_dataStore) + { + if (kvp.Value is string s && + bool.TryParse(s, out bool isEnabled) && + switches?.ContainsKey(kvp.Key) != true) + { + ev.LogAppContextSwitch(kvp.Key, isEnabled ? 1 : 0); + } + } + } + } + } + } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/AppContext.cs b/src/libraries/System.Private.CoreLib/src/System/AppContext.cs index 35e45f472bb8b1..b8e3b93f167a20 100644 --- a/src/libraries/System.Private.CoreLib/src/System/AppContext.cs +++ b/src/libraries/System.Private.CoreLib/src/System/AppContext.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Tracing; using System.Reflection; using System.Runtime.ExceptionServices; @@ -62,8 +63,10 @@ public static void SetData(string name, object? data) } #pragma warning disable CS0067 // events raised by the VM + [field: DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(UnhandledExceptionEventArgs))] public static event UnhandledExceptionEventHandler? UnhandledException; + [field: DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(FirstChanceExceptionEventArgs))] public static event EventHandler? FirstChanceException; #pragma warning restore CS0067 diff --git a/src/libraries/System.Private.CoreLib/src/System/Byte.cs b/src/libraries/System.Private.CoreLib/src/System/Byte.cs index 3d5b448159a63d..cbf21d307d636e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Byte.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Byte.cs @@ -285,11 +285,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IAdditionOperators.operator +(byte left, byte right) => (byte)(left + right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked byte IAdditionOperators.operator +(byte left, byte right) // => checked((byte)(left + right)); @@ -297,30 +297,30 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBinaryInteger.LeadingZeroCount(byte value) => (byte)(BitOperations.LeadingZeroCount(value) - 24); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBinaryInteger.PopCount(byte value) => (byte)BitOperations.PopCount(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBinaryInteger.RotateLeft(byte value, int rotateAmount) => (byte)((value << (rotateAmount & 7)) | (value >> ((8 - rotateAmount) & 7))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBinaryInteger.RotateRight(byte value, int rotateAmount) => (byte)((value >> (rotateAmount & 7)) | (value << ((8 - rotateAmount) & 7))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBinaryInteger.TrailingZeroCount(byte value) => (byte)(BitOperations.TrailingZeroCount(value << 24) - 24); @@ -328,11 +328,11 @@ static byte IBinaryInteger.TrailingZeroCount(byte value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(byte value) => BitOperations.IsPow2((uint)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBinaryNumber.Log2(byte value) => (byte)BitOperations.Log2(value); @@ -340,19 +340,19 @@ static byte IBinaryNumber.Log2(byte value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBitwiseOperators.operator &(byte left, byte right) => (byte)(left & right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBitwiseOperators.operator |(byte left, byte right) => (byte)(left | right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBitwiseOperators.operator ^(byte left, byte right) => (byte)(left ^ right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IBitwiseOperators.operator ~(byte value) => (byte)(~value); @@ -360,19 +360,19 @@ static byte IBinaryNumber.Log2(byte value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(byte left, byte right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(byte left, byte right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(byte left, byte right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(byte left, byte right) => left >= right; @@ -380,11 +380,11 @@ static byte IBinaryNumber.Log2(byte value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IDecrementOperators.operator --(byte value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked byte IDecrementOperators.operator --(byte value) // => checked(--value); @@ -392,11 +392,11 @@ static byte IBinaryNumber.Log2(byte value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IDivisionOperators.operator /(byte left, byte right) => (byte)(left / right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked byte IDivisionOperators.operator /(byte left, byte right) // => checked((byte)(left / right)); @@ -404,11 +404,11 @@ static byte IBinaryNumber.Log2(byte value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(byte left, byte right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(byte left, byte right) => left != right; @@ -416,11 +416,11 @@ static byte IBinaryNumber.Log2(byte value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IIncrementOperators.operator ++(byte value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked byte IIncrementOperators.operator ++(byte value) // => checked(++value); @@ -428,21 +428,21 @@ static byte IBinaryNumber.Log2(byte value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IModulusOperators.operator %(byte left, byte right) => (byte)(left % right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked byte IModulusOperators.operator %(byte left, byte right) // => checked((byte)(left % right)); @@ -450,18 +450,18 @@ static byte IBinaryNumber.Log2(byte value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IMultiplyOperators.operator *(byte left, byte right) => (byte)(left * right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked byte IMultiplyOperators.operator *(byte left, byte right) // => checked((byte)(left * right)); @@ -469,21 +469,21 @@ static byte IBinaryNumber.Log2(byte value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte INumber.Abs(byte value) => value; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte INumber.Clamp(byte value, byte min, byte max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static byte INumber.Create(TOther value) { @@ -550,7 +550,7 @@ static byte INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static byte INumber.CreateSaturating(TOther value) { @@ -637,7 +637,7 @@ static byte INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static byte INumber.CreateTruncating(TOther value) { @@ -704,31 +704,31 @@ static byte INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (byte Quotient, byte Remainder) INumber.DivRem(byte left, byte right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte INumber.Max(byte x, byte y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte INumber.Min(byte x, byte y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte INumber.Sign(byte value) => (byte)((value == 0) ? 0 : 1); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out byte result) { @@ -914,11 +914,11 @@ static bool INumber.TryCreate(TOther value, out byte result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out byte result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out byte result) => TryParse(s, style, provider, out result); @@ -926,11 +926,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFo // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out byte result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -938,15 +938,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IShiftOperators.operator <<(byte value, int shiftAmount) => (byte)(value << shiftAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IShiftOperators.operator >>(byte value, int shiftAmount) => (byte)(value >> shiftAmount); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static byte IShiftOperators.operator >>>(byte value, int shiftAmount) // => (byte)(value >> shiftAmount); @@ -954,11 +954,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out byte result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -966,11 +966,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte ISubtractionOperators.operator -(byte left, byte right) => (byte)(left - right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked byte ISubtractionOperators.operator -(byte left, byte right) // => checked((byte)(left - right)); @@ -978,11 +978,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IUnaryNegationOperators.operator -(byte value) => (byte)(-value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked byte IUnaryNegationOperators.operator -(byte value) // => checked((byte)(-value)); @@ -990,11 +990,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static byte IUnaryPlusOperators.operator +(byte value) => (byte)(+value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked byte IUnaryPlusOperators.operator +(byte value) // => checked((byte)(+value)); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/Char.cs b/src/libraries/System.Private.CoreLib/src/System/Char.cs index 26ff3399fe10ed..497b60b5d3449b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Char.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Char.cs @@ -1065,11 +1065,11 @@ public static int ConvertToUtf32(string s, int index) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IAdditionOperators.operator +(char left, char right) => (char)(left + right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked char IAdditionOperators.operator +(char left, char right) // => checked((char)(left + right)); @@ -1077,30 +1077,30 @@ public static int ConvertToUtf32(string s, int index) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IAdditiveIdentity.AdditiveIdentity => (char)0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBinaryInteger.LeadingZeroCount(char value) => (char)(BitOperations.LeadingZeroCount(value) - 16); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBinaryInteger.PopCount(char value) => (char)BitOperations.PopCount(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBinaryInteger.RotateLeft(char value, int rotateAmount) => (char)((value << (rotateAmount & 15)) | (value >> ((16 - rotateAmount) & 15))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBinaryInteger.RotateRight(char value, int rotateAmount) => (char)((value >> (rotateAmount & 15)) | (value << ((16 - rotateAmount) & 15))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBinaryInteger.TrailingZeroCount(char value) => (char)(BitOperations.TrailingZeroCount(value << 16) - 16); @@ -1108,11 +1108,11 @@ static char IBinaryInteger.TrailingZeroCount(char value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(char value) => BitOperations.IsPow2((uint)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBinaryNumber.Log2(char value) => (char)BitOperations.Log2(value); @@ -1120,19 +1120,19 @@ static char IBinaryNumber.Log2(char value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBitwiseOperators.operator &(char left, char right) => (char)(left & right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBitwiseOperators.operator |(char left, char right) => (char)(left | right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBitwiseOperators.operator ^(char left, char right) => (char)(left ^ right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IBitwiseOperators.operator ~(char value) => (char)(~value); @@ -1140,19 +1140,19 @@ static char IBinaryNumber.Log2(char value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(char left, char right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(char left, char right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(char left, char right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(char left, char right) => left >= right; @@ -1160,11 +1160,11 @@ static char IBinaryNumber.Log2(char value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IDecrementOperators.operator --(char value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked char IDecrementOperators.operator --(char value) // => checked(--value); @@ -1172,11 +1172,11 @@ static char IBinaryNumber.Log2(char value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IDivisionOperators.operator /(char left, char right) => (char)(left / right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked char IDivisionOperators.operator /(char left, char right) // => checked((char)(left / right)); @@ -1184,11 +1184,11 @@ static char IBinaryNumber.Log2(char value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(char left, char right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(char left, char right) => left != right; @@ -1196,11 +1196,11 @@ static char IBinaryNumber.Log2(char value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IIncrementOperators.operator ++(char value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked char IIncrementOperators.operator ++(char value) // => checked(++value); @@ -1208,21 +1208,21 @@ static char IBinaryNumber.Log2(char value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IModulusOperators.operator %(char left, char right) => (char)(left % right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked char IModulusOperators.operator %(char left, char right) // => checked((char)(left % right)); @@ -1230,18 +1230,18 @@ static char IBinaryNumber.Log2(char value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IMultiplicativeIdentity.MultiplicativeIdentity => (char)1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IMultiplyOperators.operator *(char left, char right) => (char)(left * right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked char IMultiplyOperators.operator *(char left, char right) // => checked((char)(left * right)); @@ -1249,21 +1249,21 @@ static char IBinaryNumber.Log2(char value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char INumber.One => (char)1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char INumber.Zero => (char)0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char INumber.Abs(char value) => value; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char INumber.Clamp(char value, char min, char max) => (char)Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static char INumber.Create(TOther value) { @@ -1330,7 +1330,7 @@ static char INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static char INumber.CreateSaturating(TOther value) { @@ -1414,7 +1414,7 @@ static char INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static char INumber.CreateTruncating(TOther value) { @@ -1481,23 +1481,23 @@ static char INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (char Quotient, char Remainder) INumber.DivRem(char left, char right) => ((char, char))Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char INumber.Max(char x, char y) => (char)Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char INumber.Min(char x, char y) => (char)Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) { if (s.Length != 1) @@ -1507,11 +1507,11 @@ static char INumber.Parse(ReadOnlySpan s, NumberStyles style, IForma return s[0]; } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char INumber.Sign(char value) => (char)((value == 0) ? 0 : 1); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out char result) { @@ -1689,11 +1689,11 @@ static bool INumber.TryCreate(TOther value, out char result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out char result) => TryParse(s, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out char result) { if (s.Length != 1) @@ -1709,11 +1709,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFo // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IParseable.Parse(string s, IFormatProvider? provider) => Parse(s); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out char result) => TryParse(s, out result); @@ -1721,15 +1721,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IShiftOperators.operator <<(char value, int shiftAmount) => (char)(value << shiftAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IShiftOperators.operator >>(char value, int shiftAmount) => (char)(value >> shiftAmount); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static char IShiftOperators.operator >>>(char value, int shiftAmount) // => (char)(value >> shiftAmount); @@ -1737,7 +1737,7 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) { if (s.Length != 1) @@ -1747,7 +1747,7 @@ static char ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? pr return s[0]; } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out char result) { if (s.Length != 1) @@ -1763,11 +1763,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char ISubtractionOperators.operator -(char left, char right) => (char)(left - right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked char ISubtractionOperators.operator -(char left, char right) // => checked((char)(left - right)); @@ -1775,11 +1775,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IUnaryNegationOperators.operator -(char value) => (char)(-value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked char IUnaryNegationOperators.operator -(char value) // => checked((char)(-value)); @@ -1787,11 +1787,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static char IUnaryPlusOperators.operator +(char value) => (char)(+value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked char IUnaryPlusOperators.operator +(char value) // => checked((char)(+value)); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Collections/Generic/ValueListBuilder.Pop.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ValueListBuilder.Pop.cs similarity index 100% rename from src/libraries/System.Text.RegularExpressions/src/System/Collections/Generic/ValueListBuilder.Pop.cs rename to src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ValueListBuilder.Pop.cs diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ValueListBuilder.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ValueListBuilder.cs index a82372b92b34db..d29b59bd4a8aac 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ValueListBuilder.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/ValueListBuilder.cs @@ -69,10 +69,25 @@ public void Dispose() private void Grow() { - T[] array = ArrayPool.Shared.Rent(_span.Length * 2); + const int ArrayMaxLength = 0x7FFFFFC7; // same as Array.MaxLength - bool success = _span.TryCopyTo(array); - Debug.Assert(success); + // Double the size of the span. If it's currently empty, default to size 4, + // although it'll be increased in Rent to the pool's minimum bucket size. + int nextCapacity = _span.Length != 0 ? _span.Length * 2 : 4; + + // If the computed doubled capacity exceeds the possible length of an array, then we + // want to downgrade to either the maximum array length if that's large enough to hold + // an additional item, or the current length + 1 if it's larger than the max length, in + // which case it'll result in an OOM when calling Rent below. In the exceedingly rare + // case where _span.Length is already int.MaxValue (in which case it couldn't be a managed + // array), just use that same value again and let it OOM in Rent as well. + if ((uint)nextCapacity > ArrayMaxLength) + { + nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length); + } + + T[] array = ArrayPool.Shared.Rent(nextCapacity); + _span.CopyTo(array); T[]? toReturn = _arrayFromPool; _span = _arrayFromPool = array; diff --git a/src/libraries/System.Private.CoreLib/src/System/DateOnly.cs b/src/libraries/System.Private.CoreLib/src/System/DateOnly.cs index 7e64638fa51031..955ecb17b79c34 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DateOnly.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DateOnly.cs @@ -817,15 +817,13 @@ public string ToString(string? format, IFormatProvider? provider) return DateTimeFormat.TryFormat(GetEquivalentDateTime(), destination, out charsWritten, format, provider); default: - charsWritten = 0; - return false; + throw new FormatException(SR.Argument_BadFormatSpecifier); } } if (!DateTimeFormat.IsValidCustomDateFormat(format, throwOnError: false)) { - charsWritten = 0; - return false; + throw new FormatException(SR.Format(SR.Format_DateTimeOnlyContainsNoneDateParts, format.ToString(), nameof(DateOnly))); } return DateTimeFormat.TryFormat(GetEquivalentDateTime(), destination, out charsWritten, format, provider); @@ -836,19 +834,19 @@ public string ToString(string? format, IFormatProvider? provider) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(DateOnly left, DateOnly right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(DateOnly left, DateOnly right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(DateOnly left, DateOnly right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(DateOnly left, DateOnly right) => left >= right; @@ -856,11 +854,11 @@ public string ToString(string? format, IFormatProvider? provider) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(DateOnly left, DateOnly right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(DateOnly left, DateOnly right) => left != right; @@ -868,21 +866,21 @@ public string ToString(string? format, IFormatProvider? provider) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateOnly IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateOnly IMinMaxValue.MaxValue => MaxValue; // // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateOnly IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out DateOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); @@ -890,11 +888,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormat // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateOnly ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out DateOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/DateTime.cs b/src/libraries/System.Private.CoreLib/src/System/DateTime.cs index 1d0235268a14ec..5017c7c49cceca 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DateTime.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DateTime.cs @@ -1521,11 +1521,11 @@ internal static bool TryCreate(int year, int month, int day, int hour, int minut // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTime IAdditionOperators.operator +(DateTime left, TimeSpan right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked DateTime IAdditionOperators.operator +(DateTime left, TimeSpan right) // => checked(left + right); @@ -1533,7 +1533,7 @@ internal static bool TryCreate(int year, int month, int day, int hour, int minut // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IAdditiveIdentity.AdditiveIdentity => default; @@ -1541,19 +1541,19 @@ static TimeSpan IAdditiveIdentity.AdditiveIdentity // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(DateTime left, DateTime right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(DateTime left, DateTime right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(DateTime left, DateTime right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(DateTime left, DateTime right) => left >= right; @@ -1561,11 +1561,11 @@ static TimeSpan IAdditiveIdentity.AdditiveIdentity // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(DateTime left, DateTime right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(DateTime left, DateTime right) => left != right; @@ -1573,21 +1573,21 @@ static TimeSpan IAdditiveIdentity.AdditiveIdentity // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTime IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTime IMinMaxValue.MaxValue => MaxValue; // // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTime IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out DateTime result) => TryParse(s, provider, DateTimeStyles.None, out result); @@ -1595,11 +1595,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormat // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTime ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out DateTime result) => TryParse(s, provider, DateTimeStyles.None, out result); @@ -1607,19 +1607,19 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvi // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTime ISubtractionOperators.operator -(DateTime left, TimeSpan right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked DateTime ISubtractionOperators.operator -(DateTime left, TimeSpan right) // => checked(left - right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan ISubtractionOperators.operator -(DateTime left, DateTime right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked TimeSpan ISubtractionOperators.operator -(DateTime left, DateTime right) // => checked(left - right); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/DateTimeOffset.cs b/src/libraries/System.Private.CoreLib/src/System/DateTimeOffset.cs index f9fcc33b9a0cfe..f2c9a77df524ca 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DateTimeOffset.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DateTimeOffset.cs @@ -870,11 +870,11 @@ public static implicit operator DateTimeOffset(DateTime dateTime) => // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTimeOffset IAdditionOperators.operator +(DateTimeOffset left, TimeSpan right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked DateTimeOffset IAdditionOperators.operator +(DateTimeOffset left, TimeSpan right) // => checked(left + right); @@ -882,26 +882,26 @@ public static implicit operator DateTimeOffset(DateTime dateTime) => // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IAdditiveIdentity.AdditiveIdentity => default; // // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(DateTimeOffset left, DateTimeOffset right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(DateTimeOffset left, DateTimeOffset right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(DateTimeOffset left, DateTimeOffset right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(DateTimeOffset left, DateTimeOffset right) => left >= right; @@ -909,11 +909,11 @@ public static implicit operator DateTimeOffset(DateTime dateTime) => // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(DateTimeOffset left, DateTimeOffset right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(DateTimeOffset left, DateTimeOffset right) => left != right; @@ -921,21 +921,21 @@ public static implicit operator DateTimeOffset(DateTime dateTime) => // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTimeOffset IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTimeOffset IMinMaxValue.MaxValue => MaxValue; // // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTimeOffset IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out DateTimeOffset result) => TryParse(s, provider, DateTimeStyles.None, out result); @@ -943,11 +943,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, I // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTimeOffset ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out DateTimeOffset result) => TryParse(s, provider, DateTimeStyles.None, out result); @@ -955,19 +955,19 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IForma // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static DateTimeOffset ISubtractionOperators.operator -(DateTimeOffset left, TimeSpan right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked DateTimeOffset ISubtractionOperators.operator -(DateTimeOffset left, TimeSpan right) // => checked(left - right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan ISubtractionOperators.operator -(DateTimeOffset left, DateTimeOffset right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked TimeSpan ISubtractionOperators.operator -(DateTimeOffset left, DateTimeOffset right) // => checked(left - right); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/Decimal.cs b/src/libraries/System.Private.CoreLib/src/System/Decimal.cs index 5c4f30795cd6da..6c5d654abf0ec1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Decimal.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Decimal.cs @@ -1085,11 +1085,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IAdditionOperators.operator +(decimal left, decimal right) => checked(left + right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked decimal IAdditionOperators.operator +(decimal left, decimal right) // => checked(left + right); @@ -1097,26 +1097,26 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IAdditiveIdentity.AdditiveIdentity => 0.0m; // // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(decimal left, decimal right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(decimal left, decimal right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(decimal left, decimal right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(decimal left, decimal right) => left >= right; @@ -1124,11 +1124,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IDecrementOperators.operator --(decimal value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked decimal IDecrementOperators.operator --(decimal value) // => checked(--value); @@ -1136,11 +1136,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IDivisionOperators.operator /(decimal left, decimal right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked decimal IDivisionOperators.operator /(decimal left, decimal right) // => checked(left / right); @@ -1148,11 +1148,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(decimal left, decimal right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(decimal left, decimal right) => left != right; @@ -1160,11 +1160,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IIncrementOperators.operator ++(decimal value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked decimal IIncrementOperators.operator ++(decimal value) // => checked(++value); @@ -1172,21 +1172,21 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IModulusOperators.operator %(decimal left, decimal right) => left % right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked decimal IModulusOperators.operator %(decimal left, decimal right) // => checked(left % right); @@ -1194,18 +1194,18 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IMultiplicativeIdentity.MultiplicativeIdentity => 1.0m; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IMultiplyOperators.operator *(decimal left, decimal right) => left * right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked decimal IMultiplyOperators.operator *(decimal left, decimal right) // => checked(left * right); @@ -1213,17 +1213,17 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal INumber.One => 1.0m; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal INumber.Zero => 0.0m; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal INumber.Abs(decimal value) => Math.Abs(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static decimal INumber.Create(TOther value) { @@ -1290,7 +1290,7 @@ static decimal INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static decimal INumber.CreateSaturating(TOther value) { @@ -1357,7 +1357,7 @@ static decimal INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static decimal INumber.CreateTruncating(TOther value) { @@ -1424,35 +1424,35 @@ static decimal INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal INumber.Clamp(decimal value, decimal min, decimal max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (decimal Quotient, decimal Remainder) INumber.DivRem(decimal left, decimal right) => (left / right, left % right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal INumber.Max(decimal x, decimal y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal INumber.Min(decimal x, decimal y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal INumber.Sign(decimal value) => Math.Sign(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out decimal result) { @@ -1534,11 +1534,11 @@ static bool INumber.TryCreate(TOther value, out decimal result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out decimal result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out decimal result) => TryParse(s, style, provider, out result); @@ -1546,11 +1546,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out decimal result) => TryParse(s, NumberStyles.Number, provider, out result); @@ -1558,18 +1558,18 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatP // ISignedNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal ISignedNumber.NegativeOne => -1; // // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Number, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out decimal result) => TryParse(s, NumberStyles.Number, provider, out result); @@ -1577,11 +1577,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvid // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal ISubtractionOperators.operator -(decimal left, decimal right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked decimal ISubtractionOperators.operator -(decimal left, decimal right) // => checked(left - right); @@ -1589,11 +1589,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvid // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IUnaryNegationOperators.operator -(decimal value) => -value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked decimal IUnaryNegationOperators.operator -(decimal value) // => checked(-value); @@ -1601,11 +1601,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvid // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static decimal IUnaryPlusOperators.operator +(decimal value) => +value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked decimal IUnaryPlusOperators.operator +(decimal value) // => checked(+value); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/CounterGroup.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/CounterGroup.cs index aec84922437a36..77c29cf159801d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/CounterGroup.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/CounterGroup.cs @@ -52,24 +52,46 @@ private void RegisterCommandCallback() private void OnEventSourceCommand(object? sender, EventCommandEventArgs e) { - if (e.Command == EventCommand.Enable || e.Command == EventCommand.Update) - { - Debug.Assert(e.Arguments != null); + // Should only be enable or disable + Debug.Assert(e.Command == EventCommand.Enable || e.Command == EventCommand.Disable); - if (e.Arguments.TryGetValue("EventCounterIntervalSec", out string? valueStr) && float.TryParse(valueStr, out float value)) + lock (s_counterGroupLock) // Lock the CounterGroup + { + if (e.Command == EventCommand.Enable || e.Command == EventCommand.Update) { - lock (s_counterGroupLock) // Lock the CounterGroup + Debug.Assert(e.Arguments != null); + + if (!e.Arguments.TryGetValue("EventCounterIntervalSec", out string? valueStr) + || !float.TryParse(valueStr, out float intervalValue)) { - EnableTimer(value); + // Command is Enable but no EventCounterIntervalSec arg so ignore + return; } + + EnableTimer(intervalValue); } - } - else if (e.Command == EventCommand.Disable) - { - lock (s_counterGroupLock) + else if (e.Command == EventCommand.Disable) { - DisableTimer(); + // Since we allow sessions to send multiple Enable commands to update the interval, we cannot + // rely on ref counting to determine when to enable and disable counters. You will get an arbitrary + // number of Enables and one Disable per session. + // + // Previously we would turn off counters when we received any Disable command, but that meant that any + // session could turn off counters for all other sessions. To get to a good place we now will only + // turn off counters once the EventSource that provides the counters is disabled. We can then end up + // keeping counters on too long in certain circumstances - if one session enables counters, then a second + // session enables the EventSource but not counters we will stay on until both sessions terminate, even + // if the first session terminates first. + if (!_eventSource.IsEnabled()) + { + DisableTimer(); + } } + + Debug.Assert((s_counterGroupEnabledList == null && !_eventSource.IsEnabled()) + || (_eventSource.IsEnabled() && s_counterGroupEnabledList!.Contains(this)) + || (_pollingIntervalInMilliseconds == 0 && !s_counterGroupEnabledList!.Contains(this)) + || (!_eventSource.IsEnabled() && !s_counterGroupEnabledList!.Contains(this))); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs index f8d6e9c6ff114d..f5fe93b02a0aba 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs @@ -1839,7 +1839,7 @@ private static unsafe void DecodeObjects(object?[] decodedObjects, Type[] parame } else if (typeCode == TypeCode.DateTime) { - decoded = *(DateTime*)dataPointer; + decoded = DateTime.FromFileTimeUtc(*(long*)dataPointer); } else if (IntPtr.Size == 8 && dataType == typeof(IntPtr)) { @@ -2733,9 +2733,6 @@ internal void DoCommand(EventCommandEventArgs commandArgs) m_eventSourceEnabled = true; } - this.OnEventCommand(commandArgs); - this.m_eventCommandExecuted?.Invoke(this, commandArgs); - if (!commandArgs.enable) { // If we are disabling, maybe we can turn on 'quick checks' to filter @@ -2767,6 +2764,9 @@ internal void DoCommand(EventCommandEventArgs commandArgs) m_eventSourceEnabled = false; } } + + this.OnEventCommand(commandArgs); + this.m_eventCommandExecuted?.Invoke(this, commandArgs); } else { @@ -2897,8 +2897,13 @@ private void EnsureDescriptorsInitialized() // Today, we only send the manifest to ETW, custom listeners don't get it. private unsafe void SendManifest(byte[]? rawManifest) { - if (rawManifest == null) + if (rawManifest == null + // Don't send the manifest for NativeRuntimeEventSource, it is conceptually + // an extension of the native coreclr provider + || m_name.Equals("Microsoft-Windows-DotNETRuntime")) + { return; + } Debug.Assert(!SelfDescribingEvents); diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/RuntimeEventSource.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/RuntimeEventSource.cs index 6d57c82ef6cc40..3b3ac30c10aa9a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/RuntimeEventSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/RuntimeEventSource.cs @@ -14,6 +14,11 @@ internal sealed partial class RuntimeEventSource : EventSource { internal const string EventSourceName = "System.Runtime"; + public static class Keywords + { + public const EventKeywords AppContext = (EventKeywords)0x1; + } + private static RuntimeEventSource? s_RuntimeEventSource; private PollingCounter? _gcHeapSizeCounter; private IncrementingPollingCounter? _gen0GCCounter; @@ -50,6 +55,17 @@ public static void Initialize() // as you can't make a constructor partial. private RuntimeEventSource(int _) { } + private enum EventId : int + { + AppContextSwitch = 1 + } + + [Event((int)EventId.AppContextSwitch, Level = EventLevel.Informational, Keywords = Keywords.AppContext)] + internal void LogAppContextSwitch(string switchName, int value) + { + base.WriteEvent((int)EventId.AppContextSwitch, switchName, value); + } + protected override void OnEventCommand(EventCommandEventArgs command) { if (command.Command == EventCommand.Enable) @@ -87,6 +103,8 @@ protected override void OnEventCommand(EventCommandEventArgs command) _ilBytesJittedCounter ??= new PollingCounter("il-bytes-jitted", this, () => System.Runtime.JitInfo.GetCompiledILBytes()) { DisplayName = "IL Bytes Jitted", DisplayUnits = "B" }; _methodsJittedCounter ??= new PollingCounter("methods-jitted-count", this, () => System.Runtime.JitInfo.GetCompiledMethodCount()) { DisplayName = "Number of Methods Jitted" }; _jitTimeCounter ??= new IncrementingPollingCounter("time-in-jit", this, () => System.Runtime.JitInfo.GetCompilationTime().TotalMilliseconds) { DisplayName = "Time spent in JIT", DisplayUnits = "ms", DisplayRateTimeScale = new TimeSpan(0, 0, 1) }; + + AppContext.LogSwitchValues(this); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Double.cs b/src/libraries/System.Private.CoreLib/src/System/Double.cs index 3165535dd15b4f..23143143c1dfce 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Double.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Double.cs @@ -455,11 +455,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IAdditionOperators.operator +(double left, double right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double IAdditionOperators.operator +(double left, double right) // => checked(left + right); @@ -467,14 +467,14 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IAdditiveIdentity.AdditiveIdentity => 0.0; // // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(double value) { ulong bits = BitConverter.DoubleToUInt64Bits(value); @@ -487,7 +487,7 @@ static bool IBinaryNumber.IsPow2(double value) && (significand == MinSignificand); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IBinaryNumber.Log2(double value) => Math.Log2(value); @@ -495,28 +495,28 @@ static double IBinaryNumber.Log2(double value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IBitwiseOperators.operator &(double left, double right) { ulong bits = BitConverter.DoubleToUInt64Bits(left) & BitConverter.DoubleToUInt64Bits(right); return BitConverter.UInt64BitsToDouble(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IBitwiseOperators.operator |(double left, double right) { ulong bits = BitConverter.DoubleToUInt64Bits(left) | BitConverter.DoubleToUInt64Bits(right); return BitConverter.UInt64BitsToDouble(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IBitwiseOperators.operator ^(double left, double right) { ulong bits = BitConverter.DoubleToUInt64Bits(left) ^ BitConverter.DoubleToUInt64Bits(right); return BitConverter.UInt64BitsToDouble(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IBitwiseOperators.operator ~(double value) { ulong bits = ~BitConverter.DoubleToUInt64Bits(value); @@ -527,19 +527,19 @@ static double IBinaryNumber.Log2(double value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(double left, double right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(double left, double right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(double left, double right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(double left, double right) => left >= right; @@ -547,11 +547,11 @@ static double IBinaryNumber.Log2(double value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IDecrementOperators.operator --(double value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double IDecrementOperators.operator --(double value) // => checked(--value); @@ -559,11 +559,11 @@ static double IBinaryNumber.Log2(double value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IDivisionOperators.operator /(double left, double right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double IDivisionOperators.operator /(double left, double right) // => checked(left / right); @@ -571,11 +571,11 @@ static double IBinaryNumber.Log2(double value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(double left, double right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(double left, double right) => left != right; @@ -583,178 +583,202 @@ static double IBinaryNumber.Log2(double value) // IFloatingPoint // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.E => Math.E; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Epsilon => Epsilon; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.NaN => NaN; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.NegativeInfinity => NegativeInfinity; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.NegativeZero => -0.0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Pi => Math.PI; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.PositiveInfinity => PositiveInfinity; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Tau => Math.Tau; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Acos(double x) => Math.Acos(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Acosh(double x) => Math.Acosh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Asin(double x) => Math.Asin(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Asinh(double x) => Math.Asinh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Atan(double x) => Math.Atan(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Atan2(double y, double x) => Math.Atan2(y, x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Atanh(double x) => Math.Atanh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.BitIncrement(double x) => Math.BitIncrement(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.BitDecrement(double x) => Math.BitDecrement(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Cbrt(double x) => Math.Cbrt(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Ceiling(double x) => Math.Ceiling(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.CopySign(double x, double y) => Math.CopySign(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Cos(double x) => Math.Cos(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Cosh(double x) => Math.Cosh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Exp(double x) => Math.Exp(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Floor(double x) => Math.Floor(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.FusedMultiplyAdd(double left, double right, double addend) => Math.FusedMultiplyAdd(left, right, addend); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.IEEERemainder(double left, double right) => Math.IEEERemainder(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TInteger IFloatingPoint.ILogB(double x) => TInteger.Create(Math.ILogB(x)); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Log(double x) => Math.Log(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Log(double x, double newBase) => Math.Log(x, newBase); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Log2(double x) => Math.Log2(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Log10(double x) => Math.Log10(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.MaxMagnitude(double x, double y) => Math.MaxMagnitude(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.MinMagnitude(double x, double y) => Math.MinMagnitude(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Pow(double x, double y) => Math.Pow(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Round(double x) => Math.Round(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Round(double x, TInteger digits) => Math.Round(x, int.Create(digits)); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Round(double x, MidpointRounding mode) => Math.Round(x, mode); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Round(double x, TInteger digits, MidpointRounding mode) => Math.Round(x, int.Create(digits), mode); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.ScaleB(double x, TInteger n) => Math.ScaleB(x, int.Create(n)); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Sin(double x) => Math.Sin(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Sinh(double x) => Math.Sinh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Sqrt(double x) => Math.Sqrt(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Tan(double x) => Math.Tan(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Tanh(double x) => Math.Tanh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IFloatingPoint.Truncate(double x) => Math.Truncate(x); + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsFinite(double d) => IsFinite(d); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsInfinity(double d) => IsInfinity(d); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNaN(double d) => IsNaN(d); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNegative(double d) => IsNegative(d); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNegativeInfinity(double d) => IsNegativeInfinity(d); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNormal(double d) => IsNormal(d); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsPositiveInfinity(double d) => IsPositiveInfinity(d); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsSubnormal(double d) => IsSubnormal(d); + // static double IFloatingPoint.AcosPi(double x) // => Math.AcosPi(x); // @@ -825,11 +849,11 @@ static double IFloatingPoint.Truncate(double x) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IIncrementOperators.operator ++(double value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double IIncrementOperators.operator ++(double value) // => checked(++value); @@ -837,21 +861,21 @@ static double IFloatingPoint.Truncate(double x) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IModulusOperators.operator %(double left, double right) => left % right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double IModulusOperators.operator %(double left, double right) // => checked(left % right); @@ -859,18 +883,18 @@ static double IFloatingPoint.Truncate(double x) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IMultiplicativeIdentity.MultiplicativeIdentity => 1.0; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IMultiplyOperators.operator *(double left, double right) => (double)(left * right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double IMultiplyOperators.operator *(double left, double right) // => checked((double)(left * right)); @@ -878,21 +902,21 @@ static double IFloatingPoint.Truncate(double x) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double INumber.One => 1.0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double INumber.Zero => 0.0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double INumber.Abs(double value) => Math.Abs(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double INumber.Clamp(double value, double min, double max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static double INumber.Create(TOther value) { @@ -959,7 +983,7 @@ static double INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static double INumber.CreateSaturating(TOther value) { @@ -1026,7 +1050,7 @@ static double INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static double INumber.CreateTruncating(TOther value) { @@ -1093,31 +1117,31 @@ static double INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (double Quotient, double Remainder) INumber.DivRem(double left, double right) => (left / right, left % right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double INumber.Max(double x, double y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double INumber.Min(double x, double y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double INumber.Sign(double value) => Math.Sign(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out double result) { @@ -1199,11 +1223,11 @@ static bool INumber.TryCreate(TOther value, out double result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out double result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out double result) => TryParse(s, style, provider, out result); @@ -1211,42 +1235,42 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, I // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out double result) - => TryParse(s, NumberStyles.Integer, provider, out result); + => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider, out result); // // ISignedNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double ISignedNumber.NegativeOne => -1; // // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) - => Parse(s, NumberStyles.Integer, provider); + => Parse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out double result) - => TryParse(s, NumberStyles.Integer, provider, out result); + => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider, out result); // // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double ISubtractionOperators.operator -(double left, double right) => (double)(left - right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double ISubtractionOperators.operator -(double left, double right) // => checked((double)(left - right)); @@ -1254,11 +1278,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvide // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IUnaryNegationOperators.operator -(double value) => (double)(-value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double IUnaryNegationOperators.operator -(double value) // => checked((double)(-value)); @@ -1266,11 +1290,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvide // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IUnaryPlusOperators.operator +(double value) => (double)(+value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double IUnaryPlusOperators.operator +(double value) // => checked((double)(+value)); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/Enum.cs b/src/libraries/System.Private.CoreLib/src/System/Enum.cs index ad0a6847d9c94c..62742587b69959 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Enum.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Enum.cs @@ -879,6 +879,8 @@ private static bool TryParseRareEnum(RuntimeType enumType, ReadOnlySpan va private static bool TryParseByName(RuntimeType enumType, ReadOnlySpan value, bool ignoreCase, bool throwOnFailure, out ulong result) { + ReadOnlySpan originalValue = value; + // Find the field. Let's assume that these are always static classes because the class is an enum. EnumInfo enumInfo = GetEnumInfo(enumType); string[] enumNames = enumInfo.Names; @@ -952,7 +954,7 @@ private static bool TryParseByName(RuntimeType enumType, ReadOnlySpan valu if (throwOnFailure) { - throw new ArgumentException(SR.Format(SR.Arg_EnumValueNotFound, value.ToString())); + throw new ArgumentException(SR.Format(SR.Arg_EnumValueNotFound, originalValue.ToString())); } result = 0; diff --git a/src/libraries/System.Private.CoreLib/src/System/Environment.iOS.cs b/src/libraries/System.Private.CoreLib/src/System/Environment.iOS.cs new file mode 100644 index 00000000000000..90512ca598bd81 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Environment.iOS.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; + +namespace System +{ + public static partial class Environment + { + // iOS/tvOS aren't allowed to call libproc APIs so return 0 here, this also matches what we returned in earlier releases + public static long WorkingSet => 0; + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Icu.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Icu.cs index a9b9274952ae0a..02c846c457beea 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Icu.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Icu.cs @@ -14,7 +14,7 @@ public partial class CompareInfo [NonSerialized] private bool _isAsciiEqualityOrdinal; - private void IcuInitSortHandle() + private void IcuInitSortHandle(string interopCultureName) { if (GlobalizationMode.Invariant) { @@ -23,6 +23,7 @@ private void IcuInitSortHandle() else { Debug.Assert(!GlobalizationMode.UseNls); + Debug.Assert(interopCultureName != null); // Inline the following condition to avoid potential implementation cycles within globalization // @@ -31,7 +32,7 @@ private void IcuInitSortHandle() _isAsciiEqualityOrdinal = _sortName.Length == 0 || (_sortName.Length >= 2 && _sortName[0] == 'e' && _sortName[1] == 'n' && (_sortName.Length == 2 || _sortName[2] == '-')); - _sortHandle = SortHandleCache.GetCachedSortHandle(_sortName); + _sortHandle = SortHandleCache.GetCachedSortHandle(interopCultureName); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs index b8e7d60a24ed18..bf68d1214d3616 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs @@ -191,7 +191,7 @@ private void InitSort(CultureInfo culture) } else { - IcuInitSortHandle(); + IcuInitSortHandle(culture.InteropName!); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Icu.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Icu.cs index 0d2035b9b40e14..76898ae5e35b6c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Icu.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Icu.cs @@ -12,6 +12,88 @@ internal sealed partial class CultureData // ICU constants private const int ICU_ULOC_KEYWORD_AND_VALUES_CAPACITY = 100; // max size of keyword or value private const int ICU_ULOC_FULLNAME_CAPACITY = 157; // max size of locale name + private const int WINDOWS_MAX_COLLATION_NAME_LENGTH = 8; // max collation name length in the culture name + + /// + /// Process the locale name that ICU returns and convert it to the format that .NET expects. + /// + /// The locale name that ICU returns. + /// The extension part in the original culture name. + /// The index of the collation in the name. + /// + /// BCP 47 specifications allow for extensions in the locale name, following the format language-script-region-extensions-collation. However, + /// not all extensions supported by ICU are supported in .NET. In the locale name, extensions are separated from the rest of the name using '-u-' or '-t-'. + /// In .NET, only the collation extension is supported. If the name includes a collation extension, it will be prefixed with '-u-co-'. + /// For example, en-US-u-co-search would be converted to the ICU name en_US@collation=search, which would then be translated to the .NET name en-US_search. + /// All extensions in the ICU names start with @. When normalizing the name to the .NET format, we retain the extensions in the name to ensure differentiation + /// between names with extensions and those without. For example, we may have a name like en-US and en-US-u-xx. Although .NET doesn't support the extension xx, + /// we still include it in the name to distinguish it from the name without the extension. + /// + private static string NormalizeCultureName(string name, ReadOnlySpan extension, out int collationStart) + { + Debug.Assert(name is not null); + Debug.Assert(name.Length <= ICU_ULOC_FULLNAME_CAPACITY); + + collationStart = -1; + bool changed = false; + Span buffer = stackalloc char[ICU_ULOC_FULLNAME_CAPACITY]; + int bufferIndex = 0; + + for (int i = 0; i < name.Length && bufferIndex < ICU_ULOC_FULLNAME_CAPACITY; i++) + { + char c = name[i]; + if (c == '-' && i < name.Length - 1 && name[i + 1] == '-') + { + // ICU changes names like `qps_plocm` (one underscore) to `qps__plocm` (two underscores) + // The reason this occurs is because, while ICU canonicalizing, ulocimp_getCountry returns an empty string since the country code value is > 3 (rightly so). + // But append an extra '_' thinking that country code was in-fact appended (for the empty string value as well). + // Before processing, the name qps__plocm will be converted to its .NET name equivalent, which is qps--plocm. + changed = true; + buffer[bufferIndex++] = '-'; + i++; + } + else if (c == '@') + { + changed = true; + + if (!extension.IsEmpty && extension.TryCopyTo(buffer.Slice(bufferIndex))) + { + bufferIndex += extension.Length; + } + + int collationIndex = name.IndexOf("collation=", i + 1, StringComparison.Ordinal); + if (collationIndex > 0) + { + collationIndex += "collation=".Length; + + // format of the locale properties is @key=value;collation=collationName;key=value;key=value + int endOfCollation = name.IndexOf(';', collationIndex); + if (endOfCollation < 0) + { + endOfCollation = name.Length; + } + + int length = Math.Min(WINDOWS_MAX_COLLATION_NAME_LENGTH, endOfCollation - collationIndex); // Windows doesn't allow collation names longer than 8 characters + if (buffer.Length - bufferIndex >= length + 1) + { + collationStart = bufferIndex; + buffer[bufferIndex++] = '_'; + name.AsSpan(collationIndex, length).CopyTo(buffer.Slice(bufferIndex)); + bufferIndex += length; + } + } + + // done getting all parts can be supported in the .NET culture names. + break; + } + else + { + buffer[bufferIndex++] = name[i]; + } + } + + return changed ? new string(buffer.Slice(0, bufferIndex)) : name; + } /// /// This method uses the sRealName field (which is initialized by the constructor before this is called) to @@ -26,16 +108,15 @@ private bool InitIcuCultureDataCore() string realNameBuffer = _sRealName; // Basic validation - if (!IsValidCultureName(realNameBuffer, out var index)) + if (!IsValidCultureName(realNameBuffer, out var index, out int indexOfExtensions)) { return false; } // Replace _ (alternate sort) with @collation= for ICU - ReadOnlySpan alternateSortName = default; if (index > 0) { - alternateSortName = realNameBuffer.AsSpan(index + 1); + ReadOnlySpan alternateSortName = realNameBuffer.AsSpan(index + 1); realNameBuffer = string.Concat(realNameBuffer.AsSpan(0, index), ICU_COLLATION_KEYWORD, alternateSortName); } @@ -47,16 +128,8 @@ private bool InitIcuCultureDataCore() // Replace the ICU collation keyword with an _ Debug.Assert(_sWindowsName != null); - index = _sWindowsName.IndexOf(ICU_COLLATION_KEYWORD, StringComparison.Ordinal); - if (index >= 0) - { - _sName = string.Concat(_sWindowsName.AsSpan(0, index), "_", alternateSortName); - } - else - { - _sName = _sWindowsName; - } - _sRealName = _sName; + + _sRealName = NormalizeCultureName(_sWindowsName, indexOfExtensions > 0 ? _sRealName.AsSpan(indexOfExtensions) : ReadOnlySpan.Empty, out int collationStart); _iLanguage = LCID; if (_iLanguage == 0) @@ -65,11 +138,11 @@ private bool InitIcuCultureDataCore() } _bNeutral = TwoLetterISOCountryName.Length == 0; _sSpecificCulture = _bNeutral ? IcuLocaleData.GetSpecificCultureName(_sRealName) : _sRealName; + // Remove the sort from sName unless custom culture - if (index > 0 && !_bNeutral && !IsCustomCultureId(_iLanguage)) - { - _sName = _sWindowsName.Substring(0, index); - } + // To ensure compatibility, it is necessary to allow the creation of cultures like zh_CN (using ICU notation) in the case of _bNeutral. + _sName = collationStart < 0 || _bNeutral ? _sRealName : _sRealName.Substring(0, collationStart); + return true; } @@ -414,10 +487,14 @@ private static string IcuGetConsoleFallbackName(string cultureName) /// * Disallow input that starts or ends with '-' or '_'. /// * Disallow input that has any combination of consecutive '-' or '_'. /// * Disallow input that has multiple '_'. + /// + /// The IsValidCultureName method also identifies the presence of any extensions in the name (such as -u- or -t-) and returns the index of the extension. + /// This is necessary because we need to append the extensions to the name when normalizing it to the .NET format. /// - private static bool IsValidCultureName(string subject, out int indexOfUnderscore) + private static bool IsValidCultureName(string subject, out int indexOfUnderscore, out int indexOfExtensions) { indexOfUnderscore = -1; + indexOfExtensions = -1; if (subject.Length == 0) return true; // Invariant Culture if (subject.Length == 1 || subject.Length > LocaleNameMaxLength) return false; @@ -442,6 +519,16 @@ private static bool IsValidCultureName(string subject, out int indexOfUnderscore seenUnderscore = true; indexOfUnderscore = i; } + else + { + if (indexOfExtensions < 0 && i < subject.Length - 2 && (subject[i + 1] is 'u' or 't') && subject[i + 2] == '-') // we have -u- or -t- which is an extension + { + if (subject[i + 1] == 't' || i >= subject.Length - 6 || subject[i + 3] != 'c' || subject[i + 4] != 'o' || subject[i + 5] != '-' ) // not -u-co- collation extension + { + indexOfExtensions = i; + } + } + } } else { diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Nls.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Nls.cs index be1b108e4e05c3..12f289c3beaef9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Nls.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Nls.cs @@ -47,8 +47,8 @@ internal static unsafe int GetLocaleInfoEx(string lpLocaleName, uint lcType, cha private string NlsGetLocaleInfo(LocaleStringData type) { Debug.Assert(ShouldUseUserOverrideNlsData); - Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfo] Expected _sWindowsName to be populated by already"); - return NlsGetLocaleInfo(_sWindowsName, type); + Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfo] Expected _sRealName to be populated by already"); + return NlsGetLocaleInfo(_sRealName, type); } // For LOCALE_SPARENT we need the option of using the "real" name (forcing neutral names) instead of the @@ -74,15 +74,15 @@ private int NlsGetLocaleInfo(LocaleNumberData type) // Ask OS for data, note that we presume it returns success, so we have to know that // sWindowsName is valid before calling. - Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already"); - return GetLocaleInfoExInt(_sWindowsName, lctype); + Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sRealName to be populated already"); + return GetLocaleInfoExInt(_sRealName, lctype); } private int[] NlsGetLocaleInfo(LocaleGroupingData type) { Debug.Assert(ShouldUseUserOverrideNlsData); - Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already"); - return ConvertWin32GroupString(GetLocaleInfoFromLCType(_sWindowsName, (uint)type, _bUseOverrides)); + Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sRealName to be populated by already"); + return ConvertWin32GroupString(GetLocaleInfoFromLCType(_sRealName, (uint)type, _bUseOverrides)); } internal static bool NlsIsEnsurePredefinedLocaleName(string name) @@ -94,16 +94,16 @@ internal static bool NlsIsEnsurePredefinedLocaleName(string name) private string? NlsGetTimeFormatString() { Debug.Assert(ShouldUseUserOverrideNlsData); - Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already"); - return ReescapeWin32String(GetLocaleInfoFromLCType(_sWindowsName, Interop.Kernel32.LOCALE_STIMEFORMAT, _bUseOverrides)); + Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sRealName to be populated by already"); + return ReescapeWin32String(GetLocaleInfoFromLCType(_sRealName, Interop.Kernel32.LOCALE_STIMEFORMAT, _bUseOverrides)); } private int NlsGetFirstDayOfWeek() { Debug.Assert(ShouldUseUserOverrideNlsData); - Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already"); + Debug.Assert(_sRealName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sRealName to be populated by already"); - int result = GetLocaleInfoExInt(_sWindowsName, Interop.Kernel32.LOCALE_IFIRSTDAYOFWEEK | (!_bUseOverrides ? Interop.Kernel32.LOCALE_NOUSEROVERRIDE : 0)); + int result = GetLocaleInfoExInt(_sRealName, Interop.Kernel32.LOCALE_IFIRSTDAYOFWEEK | (!_bUseOverrides ? Interop.Kernel32.LOCALE_NOUSEROVERRIDE : 0)); // Win32 and .NET disagree on the numbering for days of the week, so we have to convert. return ConvertFirstDayOfWeekMonToSun(result); @@ -529,7 +529,7 @@ internal bool NlsIsReplacementCulture for (int i = 0; i < context.strings.Count; i++) { - if (string.Equals(context.strings[i], _sWindowsName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(context.strings[i], _sRealName, StringComparison.OrdinalIgnoreCase)) return true; } diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Windows.cs index 74854c3fd0b4ad..69de37e304589a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Windows.cs @@ -42,16 +42,17 @@ internal sealed partial class CultureData /// private unsafe bool InitCultureDataCore() { - if (!ShouldUseUserOverrideNlsData) + char* pBuffer = stackalloc char[Interop.Kernel32.LOCALE_NAME_MAX_LENGTH]; + if (!GlobalizationMode.UseNls) { - return InitIcuCultureDataCore(); + return InitIcuCultureDataCore() && + GetLocaleInfoEx(_sRealName, Interop.Kernel32.LOCALE_SNAME, pBuffer, Interop.Kernel32.LOCALE_NAME_MAX_LENGTH) != 0; // Ensure the culture name is supported by Windows. } Debug.Assert(!GlobalizationMode.Invariant); int result; string realNameBuffer = _sRealName; - char* pBuffer = stackalloc char[Interop.Kernel32.LOCALE_NAME_MAX_LENGTH]; result = GetLocaleInfoEx(realNameBuffer, Interop.Kernel32.LOCALE_SNAME, pBuffer, Interop.Kernel32.LOCALE_NAME_MAX_LENGTH); @@ -120,7 +121,7 @@ private unsafe bool InitCultureDataCore() // We need the IETF name (sname) // If we aren't an alt sort locale then this is the same as the windows name. // If we are an alt sort locale then this is the same as the part before the _ in the windows name - // This is for like de-DE_phoneb and es-ES_tradnl that hsouldn't have the _ part + // This is for like de-DE_phoneb and es-ES_tradnl that shouldn't have the _ part result = GetLocaleInfoEx(realNameBuffer, Interop.Kernel32.LOCALE_ILANGUAGE | Interop.Kernel32.LOCALE_RETURN_NUMBER, pBuffer, sizeof(int) / sizeof(char)); if (result == 0) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs index 5766096c8c5781..9c4abfba9a90a3 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs @@ -413,6 +413,12 @@ internal sealed partial class CultureData private static volatile Dictionary? s_cachedRegions; private static volatile Dictionary? s_regionNames; + /// + /// The culture name to use to interop with the underlying native globalization libraries like ICU or Windows NLS APIs. + /// For example, we can have the name de_DE@collation=phonebook when using ICU for the German culture de-DE with the phonebook sorting behavior. + /// + internal string? InteropName => _sWindowsName; + internal static CultureData? GetCultureDataForRegion(string? cultureName, bool useUserOverride) { // First do a shortcut for Invariant diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs index c0870e1f7a863e..baf1e6dd215017 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs @@ -580,6 +580,12 @@ public static CultureInfo[] GetCultures(CultureTypes types) /// internal string SortName => _sortName ??= _cultureData.SortName; + /// + /// The culture name to use to interop with the underlying native globalization libraries like ICU or Windows NLS APIs. + /// For example, we can have the name de_DE@collation=phonebook when using ICU for the German culture de-DE with the phonebook sorting behavior. + /// + internal string? InteropName => _cultureData.InteropName; + public string IetfLanguageTag => // special case the compatibility cultures Name switch diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeFormat.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeFormat.cs index e72e7885566401..f8c1745c1e4994 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeFormat.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/DateTimeFormat.cs @@ -62,8 +62,8 @@ Patterns Format Description Example "M" "0" month w/o leading zero 2 "MM" "00" month with leading zero 02 "MMM" short month name (abbreviation) Feb - "MMMM" full month name Febuary - "MMMM*" full month name Febuary + "MMMM" full month name February + "MMMM*" full month name February "y" "0" two digit year (year % 100) w/o leading zero 0 "yy" "00" two digit year (year % 100) with leading zero 00 @@ -734,7 +734,7 @@ private static StringBuilder FormatCustomized( break; case '\\': // Escaped character. Can be used to insert a character into the format string. - // For exmple, "\d" will insert the character 'd' into the string. + // For example, "\d" will insert the character 'd' into the string. // // NOTENOTE : we can remove this format character if we enforce the enforced quote // character rule. @@ -966,7 +966,7 @@ private static string ExpandPredefinedFormat(ReadOnlySpan format, ref Date // This format is not supported by DateTimeOffset throw new FormatException(SR.Format_InvalidString); } - // Universal time is always in Greogrian calendar. + // Universal time is always in Gregorian calendar. // // Change the Calendar to be Gregorian Calendar. // diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/IcuLocaleData.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/IcuLocaleData.cs index 1ed01badbf09ad..370e4589ad4d78 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/IcuLocaleData.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/IcuLocaleData.cs @@ -3806,7 +3806,7 @@ internal static string GetConsoleUICulture(string cultureName) return GetLocaleDataMappedCulture(cultureName, IcuLocaleDataParts.ConsoleLocaleIndex); } - // Returns index of the culture or -1 if it fail finding any match + // Returns index of the culture or less than 0 if it fail finding any match private static int SearchCultureName(string name) { if (name.Length > LocaleLongestName) @@ -3816,10 +3816,9 @@ private static int SearchCultureName(string name) for (int i = 0; i < name.Length; ++i) { char ch = name[i]; - if (ch > 'z') - return -1; - lower_case[i] = (byte)(ch | 0x20); + Debug.Assert(ch <= 'z'); + lower_case[i] = ((uint)(ch - 'A') <= 'Z' - 'A') ? (byte)(ch | 0x20) : (byte)ch; } ReadOnlySpan lname = lower_case; diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/NumberFormatInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/NumberFormatInfo.cs index ee7c38e7777cfd..931e4b62e5a178 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/NumberFormatInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/NumberFormatInfo.cs @@ -733,9 +733,9 @@ internal static void ValidateParseStyleInteger(NumberStyles style) if ((style & (InvalidNumberStyles | NumberStyles.AllowHexSpecifier)) != 0 && (style & ~NumberStyles.HexNumber) != 0) { - throwInvalid(style); + ThrowInvalid(style); - void throwInvalid(NumberStyles value) + static void ThrowInvalid(NumberStyles value) { if ((value & InvalidNumberStyles) != 0) { @@ -752,9 +752,9 @@ internal static void ValidateParseStyleFloatingPoint(NumberStyles style) // Check for undefined flags or hex number if ((style & (InvalidNumberStyles | NumberStyles.AllowHexSpecifier)) != 0) { - throwInvalid(style); + ThrowInvalid(style); - void throwInvalid(NumberStyles value) + static void ThrowInvalid(NumberStyles value) { if ((value & InvalidNumberStyles) != 0) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs index 3e104cba04488f..2ace6b3540f7e4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs @@ -232,7 +232,7 @@ internal static int CompareStringIgnoreCase(ref char strA, int lengthA, ref char continue; } - return a - b; + return aUpper - bUpper; } // diff --git a/src/libraries/System.Private.CoreLib/src/System/Guid.cs b/src/libraries/System.Private.CoreLib/src/System/Guid.cs index 1495d2a4ccfaf3..2abf1113eee083 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Guid.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Guid.cs @@ -1234,7 +1234,7 @@ bool ISpanFormattable.TryFormat(Span destination, out int charsWritten, Re // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(Guid left, Guid right) { if (left._a != right._a) @@ -1295,7 +1295,7 @@ bool ISpanFormattable.TryFormat(Span destination, out int charsWritten, Re return false; } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(Guid left, Guid right) { if (left._a != right._a) @@ -1356,7 +1356,7 @@ bool ISpanFormattable.TryFormat(Span destination, out int charsWritten, Re return true; } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(Guid left, Guid right) { if (left._a != right._a) @@ -1417,7 +1417,7 @@ bool ISpanFormattable.TryFormat(Span destination, out int charsWritten, Re return false; } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(Guid left, Guid right) { if (left._a != right._a) @@ -1482,11 +1482,11 @@ bool ISpanFormattable.TryFormat(Span destination, out int charsWritten, Re // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(Guid left, Guid right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(Guid left, Guid right) => left != right; @@ -1494,11 +1494,11 @@ bool ISpanFormattable.TryFormat(Span destination, out int charsWritten, Re // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Guid IParseable.Parse(string s, IFormatProvider? provider) => Parse(s); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Guid result) => TryParse(s, out result); @@ -1506,11 +1506,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Guid ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out Guid result) => TryParse(s, out result); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/Half.cs b/src/libraries/System.Private.CoreLib/src/System/Half.cs index c42d7a4374e52f..9881cc8e48efa7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Half.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Half.cs @@ -241,7 +241,7 @@ public static bool IsSubnormal(Half value) public static Half Parse(string s) { if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); - return Number.ParseHalf(s, NumberStyles.Float | NumberStyles.AllowThousands, NumberFormatInfo.CurrentInfo); + return Number.ParseHalf(s, DefaultParseStyle, NumberFormatInfo.CurrentInfo); } /// @@ -266,7 +266,7 @@ public static Half Parse(string s, NumberStyles style) public static Half Parse(string s, IFormatProvider? provider) { if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); - return Number.ParseHalf(s, NumberStyles.Float | NumberStyles.AllowThousands, NumberFormatInfo.GetInstance(provider)); + return Number.ParseHalf(s, DefaultParseStyle, NumberFormatInfo.GetInstance(provider)); } /// @@ -707,11 +707,11 @@ private static double CreateDouble(bool sign, ushort exp, ulong sig) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IAdditionOperators.operator +(Half left, Half right) => (Half)((float)left + (float)right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked Half IAdditionOperators.operator +(Half left, Half right) // => checked((Half)((float)left + (float)right)); @@ -719,14 +719,14 @@ private static double CreateDouble(bool sign, ushort exp, ulong sig) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IAdditiveIdentity.AdditiveIdentity => PositiveZero; // // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(Half value) { uint bits = BitConverter.HalfToUInt16Bits(value); @@ -739,7 +739,7 @@ static bool IBinaryNumber.IsPow2(Half value) && (significand == MinSignificand); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IBinaryNumber.Log2(Half value) => (Half)MathF.Log2((float)value); @@ -747,28 +747,28 @@ static Half IBinaryNumber.Log2(Half value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IBitwiseOperators.operator &(Half left, Half right) { ushort bits = (ushort)(BitConverter.HalfToUInt16Bits(left) & BitConverter.HalfToUInt16Bits(right)); return BitConverter.UInt16BitsToHalf(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IBitwiseOperators.operator |(Half left, Half right) { ushort bits = (ushort)(BitConverter.HalfToUInt16Bits(left) | BitConverter.HalfToUInt16Bits(right)); return BitConverter.UInt16BitsToHalf(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IBitwiseOperators.operator ^(Half left, Half right) { ushort bits = (ushort)(BitConverter.HalfToUInt16Bits(left) ^ BitConverter.HalfToUInt16Bits(right)); return BitConverter.UInt16BitsToHalf(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IBitwiseOperators.operator ~(Half value) { ushort bits = (ushort)(~BitConverter.HalfToUInt16Bits(value)); @@ -779,19 +779,19 @@ static Half IBinaryNumber.Log2(Half value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(Half left, Half right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(Half left, Half right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(Half left, Half right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(Half left, Half right) => left >= right; @@ -799,7 +799,7 @@ static Half IBinaryNumber.Log2(Half value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IDecrementOperators.operator --(Half value) { var tmp = (float)value; @@ -807,7 +807,7 @@ static Half IBinaryNumber.Log2(Half value) return (Half)tmp; } - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked Half IDecrementOperators.operator --(Half value) // { // var tmp = (float)value; @@ -819,11 +819,11 @@ static Half IBinaryNumber.Log2(Half value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(Half left, Half right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(Half left, Half right) => left != right; @@ -831,11 +831,11 @@ static Half IBinaryNumber.Log2(Half value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IDivisionOperators.operator /(Half left, Half right) => (Half)((float)left / (float)right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked Half IDivisionOperators.operator /(Half left, Half right) // => checked((Half)((float)left / (float)right)); @@ -843,59 +843,59 @@ static Half IBinaryNumber.Log2(Half value) // IFloatingPoint // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.E => (Half)MathF.E; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Epsilon => Epsilon; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.NaN => NaN; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.NegativeInfinity => NegativeInfinity; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.NegativeZero => NegativeZero; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Pi => (Half)MathF.PI; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.PositiveInfinity => PositiveInfinity; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Tau => (Half)MathF.Tau; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Acos(Half x) => (Half)MathF.Acos((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Acosh(Half x) => (Half)MathF.Acosh((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Asin(Half x) => (Half)MathF.Asin((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Asinh(Half x) => (Half)MathF.Asinh((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Atan(Half x) => (Half)MathF.Atan((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Atan2(Half y, Half x) => (Half)MathF.Atan2((float)y, (float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Atanh(Half x) => (Half)MathF.Atanh((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.BitIncrement(Half x) { ushort bits = BitConverter.HalfToUInt16Bits(x); @@ -921,7 +921,7 @@ static Half IFloatingPoint.BitIncrement(Half x) return BitConverter.UInt16BitsToHalf(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.BitDecrement(Half x) { ushort bits = BitConverter.HalfToUInt16Bits(x); @@ -947,118 +947,143 @@ static Half IFloatingPoint.BitDecrement(Half x) return BitConverter.UInt16BitsToHalf(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Cbrt(Half x) => (Half)MathF.Cbrt((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Ceiling(Half x) => (Half)MathF.Ceiling((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.CopySign(Half x, Half y) => (Half)MathF.CopySign((float)x, (float)y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Cos(Half x) => (Half)MathF.Cos((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Cosh(Half x) => (Half)MathF.Cosh((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Exp(Half x) => (Half)MathF.Exp((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Floor(Half x) => (Half)MathF.Floor((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.FusedMultiplyAdd(Half left, Half right, Half addend) => (Half)MathF.FusedMultiplyAdd((float)left, (float)right, (float)addend); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.IEEERemainder(Half left, Half right) => (Half)MathF.IEEERemainder((float)left, (float)right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TInteger IFloatingPoint.ILogB(Half x) => TInteger.Create(MathF.ILogB((float)x)); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Log(Half x) => (Half)MathF.Log((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Log(Half x, Half newBase) => (Half)MathF.Log((float)x, (float)newBase); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Log2(Half x) => (Half)MathF.Log2((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Log10(Half x) => (Half)MathF.Log10((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.MaxMagnitude(Half x, Half y) => (Half)MathF.MaxMagnitude((float)x, (float)y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.MinMagnitude(Half x, Half y) => (Half)MathF.MinMagnitude((float)x, (float)y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Pow(Half x, Half y) => (Half)MathF.Pow((float)x, (float)y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Round(Half x) => (Half)MathF.Round((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Round(Half x, TInteger digits) => (Half)MathF.Round((float)x, int.Create(digits)); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Round(Half x, MidpointRounding mode) => (Half)MathF.Round((float)x, mode); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Round(Half x, TInteger digits, MidpointRounding mode) => (Half)MathF.Round((float)x, int.Create(digits), mode); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.ScaleB(Half x, TInteger n) => (Half)MathF.ScaleB((float)x, int.Create(n)); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Sin(Half x) => (Half)MathF.Sin((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Sinh(Half x) => (Half)MathF.Sinh((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Sqrt(Half x) => (Half)MathF.Sqrt((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Tan(Half x) => (Half)MathF.Tan((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Tanh(Half x) => (Half)MathF.Tanh((float)x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IFloatingPoint.Truncate(Half x) => (Half)MathF.Truncate((float)x); + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsFinite(Half x) => IsFinite(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsInfinity(Half x) => IsInfinity(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNaN(Half x) => IsNaN(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNegative(Half x) => IsNegative(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNegativeInfinity(Half x) => IsNegativeInfinity(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNormal(Half x) => IsNormal(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsPositiveInfinity(Half x) => IsPositiveInfinity(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsSubnormal(Half x) => IsSubnormal(x); + + // static Half IFloatingPoint.AcosPi(Half x) // => (Half)MathF.AcosPi((float)x); // @@ -1129,7 +1154,7 @@ static Half IFloatingPoint.Truncate(Half x) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IIncrementOperators.operator ++(Half value) { var tmp = (float)value; @@ -1137,7 +1162,7 @@ static Half IFloatingPoint.Truncate(Half x) return (Half)tmp; } - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked Half IIncrementOperators.operator ++(Half value) // { // var tmp = (float)value; @@ -1149,21 +1174,21 @@ static Half IFloatingPoint.Truncate(Half x) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IModulusOperators.operator %(Half left, Half right) => (Half)((float)left % (float)right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked Half IModulusOperators.operator %(Half left, Half right) // => checked((Half)((float)left % (float)right)); @@ -1171,18 +1196,18 @@ static Half IFloatingPoint.Truncate(Half x) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IMultiplicativeIdentity.MultiplicativeIdentity => (Half)1.0f; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IMultiplyOperators.operator *(Half left, Half right) => (Half)((float)left * (float)right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked Half IMultiplyOperators.operator *(Half left, Half right) // => checked((Half)((float)left * (float)right)); @@ -1190,21 +1215,21 @@ static Half IFloatingPoint.Truncate(Half x) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half INumber.One => (Half)1.0f; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half INumber.Zero => PositiveZero; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half INumber.Abs(Half value) => (Half)MathF.Abs((float)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half INumber.Clamp(Half value, Half min, Half max) => (Half)Math.Clamp((float)value, (float)min, (float)max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static Half INumber.Create(TOther value) { @@ -1271,7 +1296,7 @@ static Half INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static Half INumber.CreateSaturating(TOther value) { @@ -1338,7 +1363,7 @@ static Half INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static Half INumber.CreateTruncating(TOther value) { @@ -1405,31 +1430,31 @@ static Half INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (Half Quotient, Half Remainder) INumber.DivRem(Half left, Half right) => ((Half, Half))((float)left / (float)right, (float)left % (float)right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half INumber.Max(Half x, Half y) => (Half)MathF.Max((float)x, (float)y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half INumber.Min(Half x, Half y) => (Half)MathF.Min((float)x, (float)y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half INumber.Sign(Half value) => (Half)MathF.Sign((float)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out Half result) { @@ -1511,11 +1536,11 @@ static bool INumber.TryCreate(TOther value, out Half result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out Half result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out Half result) => TryParse(s, style, provider, out result); @@ -1523,42 +1548,42 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFo // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Half result) - => TryParse(s, NumberStyles.Integer, provider, out result); + => TryParse(s, DefaultParseStyle, provider, out result); // // ISignedNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half ISignedNumber.NegativeOne => (Half)(-1.0f); // // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) - => Parse(s, NumberStyles.Integer, provider); + => Parse(s, DefaultParseStyle, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out Half result) - => TryParse(s, NumberStyles.Integer, provider, out result); + => TryParse(s, DefaultParseStyle, provider, out result); // // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half ISubtractionOperators.operator -(Half left, Half right) => (Half)((float)left - (float)right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked Half ISubtractionOperators.operator -(Half left, Half right) // => checked((Half)((float)left - (float)right)); @@ -1566,11 +1591,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IUnaryNegationOperators.operator -(Half value) => (Half)(-(float)value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked Half IUnaryNegationOperators.operator -(Half value) // => checked((Half)(-(float)value)); @@ -1578,11 +1603,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Half IUnaryPlusOperators.operator +(Half value) => value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked Half IUnaryPlusOperators.operator +(Half value) // => checked(value); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/IAdditionOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IAdditionOperators.cs index fb09cfac334c88..3b800fb629f668 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IAdditionOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IAdditionOperators.cs @@ -13,7 +13,7 @@ namespace System /// The type that implements this interface. /// The type that will be added to . /// The type that contains the sum of and . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IAdditionOperators where TSelf : IAdditionOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/IAdditiveIdentity.cs b/src/libraries/System.Private.CoreLib/src/System/IAdditiveIdentity.cs index 5b07145c328370..deecaa3273b694 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IAdditiveIdentity.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IAdditiveIdentity.cs @@ -12,7 +12,7 @@ namespace System /// Defines a mechanism for getting the additive identity of a given type. /// The type that implements this interface. /// The type that contains the additive identify of . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IAdditiveIdentity where TSelf : IAdditiveIdentity { diff --git a/src/libraries/System.Private.CoreLib/src/System/IBitwiseOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IBitwiseOperators.cs index d4d1a35d0e66f5..b811f83745c968 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IBitwiseOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IBitwiseOperators.cs @@ -13,7 +13,7 @@ namespace System /// The type that implements this interface. /// The type that will is used in the operation with . /// The type that contains the result of op . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IBitwiseOperators where TSelf : IBitwiseOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/IComparisonOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IComparisonOperators.cs index 5bd4a22e28c96c..7576c9777b427c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IComparisonOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IComparisonOperators.cs @@ -12,7 +12,7 @@ namespace System /// Defines a mechanism for comparing two values to determine relative order. /// The type that implements this interface. /// The type that will be compared with . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IComparisonOperators : IComparable, IComparable, diff --git a/src/libraries/System.Private.CoreLib/src/System/IDecrementOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IDecrementOperators.cs index 9a240b14a9614d..aa61af7af8f4c6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IDecrementOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IDecrementOperators.cs @@ -11,7 +11,7 @@ namespace System { /// Defines a mechanism for decrementing a given value. /// The type that implements this interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IDecrementOperators where TSelf : IDecrementOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/IDivisionOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IDivisionOperators.cs index 4beba8cddbddf6..f8b7aaa72e97a8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IDivisionOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IDivisionOperators.cs @@ -13,7 +13,7 @@ namespace System /// The type that implements this interface. /// The type that will divide . /// The type that contains the quotient of and . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IDivisionOperators where TSelf : IDivisionOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/IEqualityOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IEqualityOperators.cs index f6f8fa5050a970..b9695757447949 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IEqualityOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IEqualityOperators.cs @@ -12,7 +12,7 @@ namespace System /// Defines a mechanism for comparing two values to determine equality. /// The type that implements this interface. /// The type that will be compared with . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IEqualityOperators : IEquatable where TSelf : IEqualityOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/IFloatingPoint.cs b/src/libraries/System.Private.CoreLib/src/System/IFloatingPoint.cs index cb69e03fd771fa..0b9a2f5da83bd2 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IFloatingPoint.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IFloatingPoint.cs @@ -11,7 +11,7 @@ namespace System { /// Defines a floating-point type. /// The type that implements the interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IFloatingPoint : ISignedNumber where TSelf : IFloatingPoint @@ -332,7 +332,7 @@ static abstract TSelf ScaleB(TSelf x, TInteger n) /// Defines a floating-point type that is represented in a base-2 format. /// The type that implements the interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IBinaryFloatingPoint : IBinaryNumber, IFloatingPoint diff --git a/src/libraries/System.Private.CoreLib/src/System/IIncrementOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IIncrementOperators.cs index 5b4986a5fc22a6..ca036a24c75331 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IIncrementOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IIncrementOperators.cs @@ -11,7 +11,7 @@ namespace System { /// Defines a mechanism for incrementing a given value. /// The type that implements this interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IIncrementOperators where TSelf : IIncrementOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/IInteger.cs b/src/libraries/System.Private.CoreLib/src/System/IInteger.cs index 89ec036bb147a5..16b2079f3ae667 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IInteger.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IInteger.cs @@ -11,7 +11,7 @@ namespace System { /// Defines an integer type that is represented in a base-2 format. /// The type that implements the interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IBinaryInteger : IBinaryNumber, IShiftOperators diff --git a/src/libraries/System.Private.CoreLib/src/System/IMinMaxValue.cs b/src/libraries/System.Private.CoreLib/src/System/IMinMaxValue.cs index cc1eae37873940..38e2c534d1cf32 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IMinMaxValue.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IMinMaxValue.cs @@ -11,7 +11,7 @@ namespace System { /// Defines a mechanism for getting the minimum and maximum value of a type. /// The type that implements this interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IMinMaxValue where TSelf : IMinMaxValue { diff --git a/src/libraries/System.Private.CoreLib/src/System/IModulusOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IModulusOperators.cs index 24b5beae107e24..9ecebb4f79eae0 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IModulusOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IModulusOperators.cs @@ -14,7 +14,7 @@ namespace System /// The type that will divide . /// The type that contains the modulus or remainder of and . /// This type represents the % in C# which is often used to compute the remainder and may differ from an actual modulo operation depending on the type that implements the interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IModulusOperators where TSelf : IModulusOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/IMultiplicativeIdentity.cs b/src/libraries/System.Private.CoreLib/src/System/IMultiplicativeIdentity.cs index 9560071ae51c91..86ba9371f71842 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IMultiplicativeIdentity.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IMultiplicativeIdentity.cs @@ -12,7 +12,7 @@ namespace System /// Defines a mechanism for getting the multiplicative identity of a given type. /// The type that implements this interface. /// The type that contains the multiplicative identify of . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IMultiplicativeIdentity where TSelf : IMultiplicativeIdentity { diff --git a/src/libraries/System.Private.CoreLib/src/System/IMultiplyOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IMultiplyOperators.cs index e9fc0fc1c1943c..1be00979235957 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IMultiplyOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IMultiplyOperators.cs @@ -13,7 +13,7 @@ namespace System /// The type that implements this interface. /// The type that will multiply . /// The type that contains the product of and . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IMultiplyOperators where TSelf : IMultiplyOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/INumber.cs b/src/libraries/System.Private.CoreLib/src/System/INumber.cs index c1a4f8b109c348..8ffa8429fd1a9d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/INumber.cs +++ b/src/libraries/System.Private.CoreLib/src/System/INumber.cs @@ -13,7 +13,7 @@ namespace System { /// Defines a number type. /// The type that implements the interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface INumber : IAdditionOperators, IAdditiveIdentity, @@ -153,7 +153,7 @@ static abstract bool TryCreate(TOther value, out TSelf result) /// Defines a number that is represented in a base-2 format. /// The type that implements the interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IBinaryNumber : IBitwiseOperators, INumber @@ -172,7 +172,7 @@ public interface IBinaryNumber /// Defines a number type which can represent both positive and negative values. /// The type that implements the interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface ISignedNumber : INumber where TSelf : ISignedNumber @@ -183,7 +183,7 @@ public interface ISignedNumber /// Defines a number type which can only represent positive values, that is it cannot represent negative values. /// The type that implements the interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IUnsignedNumber : INumber where TSelf : IUnsignedNumber diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/BufferedStream.cs b/src/libraries/System.Private.CoreLib/src/System/IO/BufferedStream.cs index bcdbc292ab415b..c7c1434d69cbae 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/BufferedStream.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/BufferedStream.cs @@ -1222,11 +1222,12 @@ public override long Seek(long offset, SeekOrigin origin) // Otherwise we will throw away the buffer. This can only happen on read, as we flushed write data above. // The offset of the new/updated seek pointer within _buffer: - _readPos = (int)(newPos - (oldPos - _readPos)); + long readPos = (newPos - (oldPos - _readPos)); // If the offset of the updated seek pointer in the buffer is still legal, then we can keep using the buffer: - if (0 <= _readPos && _readPos < _readLen) + if (0 <= readPos && readPos < _readLen) { + _readPos = (int)readPos; // Adjust the seek pointer of the underlying stream to reflect the amount of useful bytes in the read buffer: _stream.Seek(_readLen - _readPos, SeekOrigin.Current); } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/File.cs b/src/libraries/System.Private.CoreLib/src/System/IO/File.cs index ff2a7bd9ef6286..0d614a2e9c9a7e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/File.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/File.cs @@ -333,15 +333,15 @@ public static byte[] ReadAllBytes(string path) // bufferSize == 1 used to avoid unnecessary buffer in FileStream using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 1, FileOptions.SequentialScan)) { - long fileLength = fs.Length; - if (fileLength > int.MaxValue) + long fileLength = 0; + if (fs.CanSeek && (fileLength = fs.Length) > int.MaxValue) { throw new IOException(SR.IO_FileTooLong2GB); } - else if (fileLength == 0) + if (fileLength == 0) { #if !MS_IO_REDIST - // Some file systems (e.g. procfs on Linux) return 0 for length even when there's content. + // Some file systems (e.g. procfs on Linux) return 0 for length even when there's content; also there is non-seekable file stream. // Thus we need to assume 0 doesn't mean empty. return ReadAllBytesUnknownLength(fs); #endif @@ -729,8 +729,8 @@ private static async Task InternalReadAllTextAsync(string path, Encoding bool returningInternalTask = false; try { - long fileLength = fs.Length; - if (fileLength > int.MaxValue) + long fileLength = 0L; + if (fs.CanSeek && (fileLength = fs.Length) > int.MaxValue) { var e = new IOException(SR.IO_FileTooLong2GB); #if !MS_IO_REDIST diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.cs index b60bb9d79e3a08..c3cba6b6c2b57a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileStream.cs @@ -147,6 +147,14 @@ public FileStream(string path, FileMode mode, FileAccess access, FileShare share { } + ~FileStream() + { + // Preserved for compatibility since FileStream has defined a + // finalizer in past releases and derived classes may depend + // on Dispose(false) call. + Dispose(false); + } + /// /// Initializes a new instance of the class with the specified path, creation mode, read/write and sharing permission, the access other FileStreams can have to the same file, the buffer size, additional file options and the allocation size. /// @@ -197,6 +205,11 @@ public FileStream(string path, FileStreamOptions options) } } + if (options.PreallocationSize > 0) + { + FileStreamHelpers.ValidateArgumentsForPreallocation(options.Mode, options.Access); + } + FileStreamHelpers.SerializationGuard(options.Access); _strategy = FileStreamHelpers.ChooseStrategy( @@ -491,11 +504,15 @@ public override long Position /// The byte to write to the stream. public override void WriteByte(byte value) => _strategy.WriteByte(value); - protected override void Dispose(bool disposing) => _strategy.DisposeInternal(disposing); - - internal void DisposeInternal(bool disposing) => Dispose(disposing); + // _strategy can be null only when ctor has thrown + protected override void Dispose(bool disposing) => _strategy?.DisposeInternal(disposing); - public override ValueTask DisposeAsync() => _strategy.DisposeAsync(); + public async override ValueTask DisposeAsync() + { + await _strategy.DisposeAsync().ConfigureAwait(false); + Dispose(false); + GC.SuppressFinalize(this); + } public override void CopyTo(Stream destination, int bufferSize) { @@ -584,8 +601,6 @@ internal Task BaseWriteAsync(byte[] buffer, int offset, int count, CancellationT internal ValueTask BaseWriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default) => base.WriteAsync(buffer, cancellationToken); - internal ValueTask BaseDisposeAsync() => base.DisposeAsync(); - internal Task BaseCopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) => base.CopyToAsync(destination, bufferSize, cancellationToken); diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs index aab00ededadfe7..fc4b2fec8dde10 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Unix.cs @@ -571,16 +571,6 @@ public static string[] GetLogicalDrives() internal static void CreateSymbolicLink(string path, string pathToTarget, bool isDirectory) { string pathToTargetFullPath = PathInternal.GetLinkTargetFullPath(path, pathToTarget); - - // Fail if the target exists but is not consistent with the expected filesystem entry type - if (Interop.Sys.Stat(pathToTargetFullPath, out Interop.Sys.FileStatus targetInfo) == 0) - { - if (isDirectory != ((targetInfo.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR)) - { - throw new IOException(SR.Format(SR.IO_InconsistentLinkType, path)); - } - } - Interop.CheckIo(Interop.Sys.SymLink(pathToTarget, path), path, isDirectory); } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs index b92de0ad38ae9b..b1ba36322ad367 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs @@ -145,10 +145,9 @@ public static void MoveFile(string sourceFullPath, string destFullPath, bool ove } } - private static SafeFileHandle OpenHandle(string fullPath, bool asDirectory) + private static SafeFileHandle OpenHandleToWriteAttributes(string fullPath, bool asDirectory) { - string root = fullPath.Substring(0, PathInternal.GetRootLength(fullPath.AsSpan())); - if (root == fullPath && root[1] == Path.VolumeSeparatorChar) + if (fullPath.Length == PathInternal.GetRootLength(fullPath.AsSpan()) && fullPath[1] == Path.VolumeSeparatorChar) { // intentionally not fullpath, most upstack public APIs expose this as path. throw new ArgumentException(SR.Arg_PathIsVolume, "path"); @@ -156,7 +155,7 @@ private static SafeFileHandle OpenHandle(string fullPath, bool asDirectory) SafeFileHandle handle = Interop.Kernel32.CreateFile( fullPath, - Interop.Kernel32.GenericOperations.GENERIC_WRITE, + Interop.Kernel32.FileOperations.FILE_WRITE_ATTRIBUTES, FileShare.ReadWrite | FileShare.Delete, FileMode.Open, asDirectory ? Interop.Kernel32.FileOperations.FILE_FLAG_BACKUP_SEMANTICS : 0); @@ -382,7 +381,7 @@ private static unsafe void SetFileTime( long changeTime = -1, uint fileAttributes = 0) { - using (SafeFileHandle handle = OpenHandle(fullPath, asDirectory)) + using (SafeFileHandle handle = OpenHandleToWriteAttributes(fullPath, asDirectory)) { var basicInfo = new Interop.Kernel32.FILE_BASIC_INFO() { @@ -415,16 +414,6 @@ public static string[] GetLogicalDrives() internal static void CreateSymbolicLink(string path, string pathToTarget, bool isDirectory) { string pathToTargetFullPath = PathInternal.GetLinkTargetFullPath(path, pathToTarget); - - Interop.Kernel32.WIN32_FILE_ATTRIBUTE_DATA data = default; - int errorCode = FillAttributeInfo(pathToTargetFullPath, ref data, returnErrorOnNotFound: true); - if (errorCode == Interop.Errors.ERROR_SUCCESS && - data.dwFileAttributes != -1 && - isDirectory != ((data.dwFileAttributes & Interop.Kernel32.FileAttributes.FILE_ATTRIBUTE_DIRECTORY) != 0)) - { - throw new IOException(SR.Format(SR.IO_InconsistentLinkType, path)); - } - Interop.Kernel32.CreateSymbolicLink(path, pathToTarget, isDirectory); } @@ -499,37 +488,69 @@ internal static void CreateSymbolicLink(string path, string pathToTarget, bool i } Span bufferSpan = new(buffer); - success = MemoryMarshal.TryRead(bufferSpan, out Interop.Kernel32.REPARSE_DATA_BUFFER rdb); + success = MemoryMarshal.TryRead(bufferSpan, out Interop.Kernel32.SymbolicLinkReparseBuffer rbSymlink); Debug.Assert(success); - // Only symbolic links are supported at the moment. - if ((rdb.ReparseTag & Interop.Kernel32.IOReparseOptions.IO_REPARSE_TAG_SYMLINK) == 0) + // We always use SubstituteName(Offset|Length) instead of PrintName(Offset|Length), + // the latter is just the display name of the reparse point and it can show something completely unrelated to the target. + + if (rbSymlink.ReparseTag == Interop.Kernel32.IOReparseOptions.IO_REPARSE_TAG_SYMLINK) { - return null; - } + int offset = sizeof(Interop.Kernel32.SymbolicLinkReparseBuffer) + rbSymlink.SubstituteNameOffset; + int length = rbSymlink.SubstituteNameLength; - // We use PrintName instead of SubstitutneName given that we don't want to return a NT path when the link wasn't created with such NT path. - // Unlike SubstituteName and GetFinalPathNameByHandle(), PrintName doesn't start with a prefix. - // Another nuance is that SubstituteName does not contain redundant path segments while PrintName does. - // PrintName can ONLY return a NT path if the link was created explicitly targeting a file/folder in such way. e.g: mklink /D linkName \??\C:\path\to\target. - int printNameNameOffset = sizeof(Interop.Kernel32.REPARSE_DATA_BUFFER) + rdb.ReparseBufferSymbolicLink.PrintNameOffset; - int printNameNameLength = rdb.ReparseBufferSymbolicLink.PrintNameLength; + Span targetPath = MemoryMarshal.Cast(bufferSpan.Slice(offset, length)); - Span targetPath = MemoryMarshal.Cast(bufferSpan.Slice(printNameNameOffset, printNameNameLength)); - Debug.Assert((rdb.ReparseBufferSymbolicLink.Flags & Interop.Kernel32.SYMLINK_FLAG_RELATIVE) == 0 || !PathInternal.IsExtended(targetPath)); + bool isRelative = (rbSymlink.Flags & Interop.Kernel32.SYMLINK_FLAG_RELATIVE) != 0; + if (!isRelative) + { + // Absolute target is in NT format and we need to clean it up before return it to the user. + if (targetPath.StartsWith(PathInternal.UncNTPathPrefix.AsSpan())) + { + // We need to prepend the Win32 equivalent of UNC NT prefix. + return Path.Join(PathInternal.UncPathPrefix.AsSpan(), targetPath.Slice(PathInternal.UncNTPathPrefix.Length)); + } - if (returnFullPath && (rdb.ReparseBufferSymbolicLink.Flags & Interop.Kernel32.SYMLINK_FLAG_RELATIVE) != 0) + return GetTargetPathWithoutNTPrefix(targetPath); + } + else if (returnFullPath) + { + return Path.Join(Path.GetDirectoryName(linkPath.AsSpan()), targetPath); + } + else + { + return targetPath.ToString(); + } + } + else if (rbSymlink.ReparseTag == Interop.Kernel32.IOReparseOptions.IO_REPARSE_TAG_MOUNT_POINT) { - // Target path is relative and is for ResolveLinkTarget(), we need to append the link directory. - return Path.Join(Path.GetDirectoryName(linkPath.AsSpan()), targetPath); + success = MemoryMarshal.TryRead(bufferSpan, out Interop.Kernel32.MountPointReparseBuffer rbMountPoint); + Debug.Assert(success); + + int offset = sizeof(Interop.Kernel32.MountPointReparseBuffer) + rbMountPoint.SubstituteNameOffset; + int length = rbMountPoint.SubstituteNameLength; + + Span targetPath = MemoryMarshal.Cast(bufferSpan.Slice(offset, length)); + + // Unlike symbolic links, mount point paths cannot be relative. + Debug.Assert(!PathInternal.IsPartiallyQualified(targetPath)); + // Mount points cannot point to a remote location. + Debug.Assert(!targetPath.StartsWith(PathInternal.UncNTPathPrefix.AsSpan())); + return GetTargetPathWithoutNTPrefix(targetPath); } - return targetPath.ToString(); + return null; } finally { ArrayPool.Shared.Return(buffer); } + + static string GetTargetPathWithoutNTPrefix(ReadOnlySpan targetPath) + { + Debug.Assert(targetPath.StartsWith(PathInternal.NTPathPrefix.AsSpan())); + return targetPath.Slice(PathInternal.NTPathPrefix.Length).ToString(); + } } private static unsafe string? GetFinalLinkTarget(string linkPath, bool isDirectory) @@ -539,8 +560,9 @@ internal static void CreateSymbolicLink(string path, string pathToTarget, bool i // The file or directory is not a reparse point. if ((data.dwFileAttributes & (uint)FileAttributes.ReparsePoint) == 0 || - // Only symbolic links are supported at the moment. - (data.dwReserved0 & Interop.Kernel32.IOReparseOptions.IO_REPARSE_TAG_SYMLINK) == 0) + // Only symbolic links and mount points are supported at the moment. + (data.dwReserved0 != Interop.Kernel32.IOReparseOptions.IO_REPARSE_TAG_SYMLINK && + data.dwReserved0 != Interop.Kernel32.IOReparseOptions.IO_REPARSE_TAG_MOUNT_POINT)) { return null; } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.NoniOS.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.NoniOS.cs new file mode 100644 index 00000000000000..b2a9a4b06a083e --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.NoniOS.cs @@ -0,0 +1,10 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.IO +{ + public static partial class Path + { + private static string DefaultTempPath => "/tmp/"; + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs index 61786ad757a434..f3ec19941c21b2 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.cs @@ -80,7 +80,6 @@ private static string RemoveLongPathPrefix(string path) public static string GetTempPath() { const string TempEnvVar = "TMPDIR"; - const string DefaultTempPath = "/tmp/"; // Get the temp path from the TMPDIR environment variable. // If it's not set, just return the default path. diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.iOS.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.iOS.cs new file mode 100644 index 00000000000000..c1c4a7047eec5e --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.iOS.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; + +namespace System.IO +{ + public static partial class Path + { + private static string? s_defaultTempPath; + + private static string DefaultTempPath => + s_defaultTempPath ?? (s_defaultTempPath = Interop.Sys.SearchPathTempDirectory()) ?? + throw new InvalidOperationException(); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs index e0ad5c0c26af29..7c66f82316fe68 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; using System.Text; #if MS_IO_REDIST @@ -14,8 +15,14 @@ namespace Microsoft.IO namespace System.IO #endif { - public static partial class Path + public static unsafe partial class Path { +#if MS_IO_REDIST + private static volatile int s_GetTempPathVersion; +#else + private static volatile delegate* unmanaged s_GetTempPathWFunc; +#endif + public static char[] GetInvalidFileNameChars() => new char[] { '\"', '<', '>', '|', '\0', @@ -152,10 +159,37 @@ public static string GetTempPath() return path; } - private static void GetTempPath(ref ValueStringBuilder builder) +#if MS_IO_REDIST + private static int GetGetTempPathVersion() + { + IntPtr kernel32 = Interop.Kernel32.GetModuleHandle(Interop.Libraries.Kernel32); + if (kernel32 != IntPtr.Zero) + { + if (Interop.Kernel32.GetProcAddress(kernel32, "GetTempPath2W") != IntPtr.Zero) + { + return 2; + } + } + return 1; + } +#else + private static unsafe delegate* unmanaged GetGetTempPathWFunc() + { + IntPtr kernel32 = Interop.Kernel32.LoadLibraryEx(Interop.Libraries.Kernel32, IntPtr.Zero, Interop.Kernel32.LOAD_LIBRARY_SEARCH_SYSTEM32); + + if (!NativeLibrary.TryGetExport(kernel32, "GetTempPath2W", out IntPtr func)) + { + func = NativeLibrary.GetExport(kernel32, "GetTempPathW"); + } + + return (delegate* unmanaged)func; + } +#endif + + internal static void GetTempPath(ref ValueStringBuilder builder) { uint result; - while ((result = Interop.Kernel32.GetTempPathW(builder.Capacity, ref builder.GetPinnableReference())) > builder.Capacity) + while ((result = GetTempPathW(builder.Capacity, ref builder.GetPinnableReference())) > builder.Capacity) { // Reported size is greater than the buffer size. Increase the capacity. builder.EnsureCapacity(checked((int)result)); @@ -165,6 +199,38 @@ private static void GetTempPath(ref ValueStringBuilder builder) throw Win32Marshal.GetExceptionForLastWin32Error(); builder.Length = (int)result; + + static uint GetTempPathW(int bufferLen, ref char buffer) + { +#if MS_IO_REDIST + int getTempPathVersion = s_GetTempPathVersion; + if (getTempPathVersion == 0) + { + s_GetTempPathVersion = getTempPathVersion = GetGetTempPathVersion(); + } + return getTempPathVersion == 2 + ? Interop.Kernel32.GetTempPath2W(bufferLen, ref buffer) + : Interop.Kernel32.GetTempPathW(bufferLen, ref buffer); +#else + delegate* unmanaged func = s_GetTempPathWFunc; + if (func == null) + { + func = s_GetTempPathWFunc = GetGetTempPathWFunc(); + } + + int lastError; + uint retVal; + fixed (char* ptr = &buffer) + { + Marshal.SetLastSystemError(0); + retVal = func(bufferLen, ptr); + lastError = Marshal.GetLastSystemError(); + } + + Marshal.SetLastPInvokeError(lastError); + return retVal; +#endif + } } // Returns a unique temporary file name, and creates a 0-byte file by that diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/PathInternal.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/PathInternal.Windows.cs index b1767b35adea5a..48fb35304cd7d4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/PathInternal.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/PathInternal.Windows.cs @@ -46,10 +46,12 @@ internal static partial class PathInternal internal const string DirectorySeparatorCharAsString = "\\"; + internal const string NTPathPrefix = @"\??\"; internal const string ExtendedPathPrefix = @"\\?\"; internal const string UncPathPrefix = @"\\"; internal const string UncExtendedPrefixToInsert = @"?\UNC\"; internal const string UncExtendedPathPrefix = @"\\?\UNC\"; + internal const string UncNTPathPrefix = @"\??\UNC\"; internal const string DevicePathPrefix = @"\\.\"; internal const string ParentDirectoryPrefix = @"..\"; diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs index 992dcc54f5be58..d922e89c13de5b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs @@ -33,9 +33,30 @@ internal static unsafe int ReadAtOffset(SafeFileHandle handle, Span buffer // The Windows implementation uses ReadFile, which ignores the offset if the handle // isn't seekable. We do the same manually with PRead vs Read, in order to enable // the function to be used by FileStream for all the same situations. - int result = handle.CanSeek ? - Interop.Sys.PRead(handle, bufPtr, buffer.Length, fileOffset) : - Interop.Sys.Read(handle, bufPtr, buffer.Length); + int result; + if (handle.SupportsRandomAccess) + { + // Try pread for seekable files. + result = Interop.Sys.PRead(handle, bufPtr, buffer.Length, fileOffset); + if (result == -1) + { + // We need to fallback to the non-offset version for certain file types + // e.g: character devices (such as /dev/tty), pipes, and sockets. + Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); + + if (errorInfo.Error == Interop.Error.ENXIO || + errorInfo.Error == Interop.Error.ESPIPE) + { + handle.SupportsRandomAccess = false; + result = Interop.Sys.Read(handle, bufPtr, buffer.Length); + } + } + } + else + { + result = Interop.Sys.Read(handle, bufPtr, buffer.Length); + } + FileStreamHelpers.CheckFileCall(result, handle.Path); return result; } @@ -90,9 +111,29 @@ internal static unsafe void WriteAtOffset(SafeFileHandle handle, ReadOnlySpan ReadScatterAtOffsetAsync(SafeFileHandle handle, IReadOnlyList> buffers, - long fileOffset, CancellationToken cancellationToken) + // From https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfilescatter: + // "The file handle must be created with [...] the FILE_FLAG_OVERLAPPED and FILE_FLAG_NO_BUFFERING flags." + private static bool CanUseScatterGatherWindowsAPIs(SafeFileHandle handle) + => handle.IsAsync && ((handle.GetFileOptions() & SafeFileHandle.NoBuffering) != 0); + + // From the same source: + // "Each buffer must be at least the size of a system memory page and must be aligned on a system + // memory page size boundary. The system reads/writes one system memory page of data into/from each buffer." + // This method returns true if the buffers can be used by + // the Windows scatter/gather API, which happens when they are: + // 1. aligned at page size boundaries + // 2. exactly one page long each (our own requirement to prevent partial reads) + // 3. not bigger than 2^32 - 1 in total + // This function is also responsible for pinning the buffers if they + // are suitable and they must be unpinned after the I/O operation completes. + // It also returns a pointer with the segments to be passed to the + // Windows API, and the total size of the buffers that is needed as well. + // The pinned MemoryHandles and the pointer to the segments must be cleaned-up + // with the CleanupScatterGatherBuffers method. + private static unsafe bool TryPrepareScatterGatherBuffers(IReadOnlyList buffers, + THandler handler, [NotNullWhen(true)] out MemoryHandle[]? handlesToDispose, out IntPtr segmentsPtr, out int totalBytes) + where THandler : struct, IMemoryHandler { - if (!handle.IsAsync) - { - return ScheduleSyncReadScatterAtOffsetAsync(handle, buffers, fileOffset, cancellationToken); - } + int pageSize = s_cachedPageSize; + Debug.Assert(BitOperations.IsPow2(pageSize), "Page size is not a power of two."); + // We take advantage of the fact that the page size is + // a power of two to avoid an expensive modulo operation. + long alignedAtPageSizeMask = pageSize - 1; + + int buffersCount = buffers.Count; + handlesToDispose = null; + segmentsPtr = IntPtr.Zero; + totalBytes = 0; - if (CanUseScatterGatherWindowsAPIs(handle)) + long* segments = null; + + bool success = false; + try { - long totalBytes = 0; - int buffersCount = buffers.Count; + long totalBytes64 = 0; for (int i = 0; i < buffersCount; i++) { - totalBytes += buffers[i].Length; + T buffer = buffers[i]; + int length = handler.GetLength(in buffer); + totalBytes64 += length; + if (length != pageSize || totalBytes64 > int.MaxValue) + { + return false; + } + + MemoryHandle handle = handler.Pin(in buffer); + long ptr = (long)handle.Pointer; + if ((ptr & alignedAtPageSizeMask) != 0) + { + handle.Dispose(); + return false; + } + + // We avoid allocations if there are no + // buffers or the first one is unacceptable. + (handlesToDispose ??= new MemoryHandle[buffersCount])[i] = handle; + if (segments == null) + { + // "The array must contain enough elements to store nNumberOfBytesToWrite + // bytes of data, and one element for the terminating NULL." + segments = (long*)NativeMemory.Alloc((nuint)buffersCount + 1, sizeof(long)); + segments[buffersCount] = 0; + } + segments[i] = ptr; } - if (totalBytes <= int.MaxValue) // the ReadFileScatter API uses int, not long + segmentsPtr = (IntPtr)segments; + totalBytes = (int)totalBytes64; + success = true; + return handlesToDispose != null; + } + finally + { + if (!success) { - return ReadScatterAtOffsetSingleSyscallAsync(handle, buffers, fileOffset, (int)totalBytes, cancellationToken); + CleanupScatterGatherBuffers(handlesToDispose, (IntPtr)segments); } } - - return ReadScatterAtOffsetMultipleSyscallsAsync(handle, buffers, fileOffset, cancellationToken); } - // From https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-readfilescatter: - // "The file handle must be created with the GENERIC_READ right, and the FILE_FLAG_OVERLAPPED and FILE_FLAG_NO_BUFFERING flags." - private static bool CanUseScatterGatherWindowsAPIs(SafeFileHandle handle) - => handle.IsAsync && ((handle.GetFileOptions() & SafeFileHandle.NoBuffering) != 0); - - private static async ValueTask ReadScatterAtOffsetSingleSyscallAsync(SafeFileHandle handle, IReadOnlyList> buffers, long fileOffset, int totalBytes, CancellationToken cancellationToken) + private static unsafe void CleanupScatterGatherBuffers(MemoryHandle[]? handlesToDispose, IntPtr segmentsPtr) { - int buffersCount = buffers.Count; - if (buffersCount == 1) + if (handlesToDispose != null) { - // we have to await it because we can't cast a VT to VT - return await ReadAtOffsetAsync(handle, buffers[0], fileOffset, cancellationToken).ConfigureAwait(false); + foreach (MemoryHandle handle in handlesToDispose) + { + handle.Dispose(); + } } - // "The array must contain enough elements to store nNumberOfBytesToWrite bytes of data, and one element for the terminating NULL. " - long[] fileSegments = new long[buffersCount + 1]; - fileSegments[buffersCount] = 0; + if (segmentsPtr != IntPtr.Zero) + { + NativeMemory.Free((void*)segmentsPtr); + } + } - MemoryHandle[] memoryHandles = new MemoryHandle[buffersCount]; - MemoryHandle pinnedSegments = fileSegments.AsMemory().Pin(); + private static ValueTask ReadScatterAtOffsetAsync(SafeFileHandle handle, IReadOnlyList> buffers, + long fileOffset, CancellationToken cancellationToken) + { + if (!handle.IsAsync) + { + return ScheduleSyncReadScatterAtOffsetAsync(handle, buffers, fileOffset, cancellationToken); + } - try + if (CanUseScatterGatherWindowsAPIs(handle) + && TryPrepareScatterGatherBuffers(buffers, default(MemoryHandler), out MemoryHandle[]? handlesToDispose, out IntPtr segmentsPtr, out int totalBytes)) { - for (int i = 0; i < buffersCount; i++) - { - Memory buffer = buffers[i]; - MemoryHandle memoryHandle = buffer.Pin(); - memoryHandles[i] = memoryHandle; + return ReadScatterAtOffsetSingleSyscallAsync(handle, handlesToDispose, segmentsPtr, fileOffset, totalBytes, cancellationToken); + } - unsafe // awaits can't be in an unsafe context - { - fileSegments[i] = new IntPtr(memoryHandle.Pointer).ToInt64(); - } - } + return ReadScatterAtOffsetMultipleSyscallsAsync(handle, buffers, fileOffset, cancellationToken); + } - return await ReadFileScatterAsync(handle, pinnedSegments, totalBytes, fileOffset, cancellationToken).ConfigureAwait(false); + private static async ValueTask ReadScatterAtOffsetSingleSyscallAsync(SafeFileHandle handle, MemoryHandle[] handlesToDispose, IntPtr segmentsPtr, long fileOffset, int totalBytes, CancellationToken cancellationToken) + { + try + { + return await ReadFileScatterAsync(handle, segmentsPtr, totalBytes, fileOffset, cancellationToken).ConfigureAwait(false); } finally { - foreach (MemoryHandle memoryHandle in memoryHandles) - { - memoryHandle.Dispose(); - } - pinnedSegments.Dispose(); + CleanupScatterGatherBuffers(handlesToDispose, segmentsPtr); } } - private static unsafe ValueTask ReadFileScatterAsync(SafeFileHandle handle, MemoryHandle pinnedSegments, int bytesToRead, long fileOffset, CancellationToken cancellationToken) + private static unsafe ValueTask ReadFileScatterAsync(SafeFileHandle handle, IntPtr segmentsPtr, int bytesToRead, long fileOffset, CancellationToken cancellationToken) { handle.EnsureThreadPoolBindingInitialized(); @@ -494,9 +572,9 @@ private static unsafe ValueTask ReadFileScatterAsync(SafeFileHandle handle, try { NativeOverlapped* nativeOverlapped = vts.PrepareForOperation(Memory.Empty, fileOffset); - Debug.Assert(pinnedSegments.Pointer != null); + Debug.Assert(segmentsPtr != IntPtr.Zero); - if (Interop.Kernel32.ReadFileScatter(handle, (long*)pinnedSegments.Pointer, bytesToRead, IntPtr.Zero, nativeOverlapped) == 0) + if (Interop.Kernel32.ReadFileScatter(handle, (long*)segmentsPtr, bytesToRead, IntPtr.Zero, nativeOverlapped) == 0) { // The operation failed, or it's pending. int errorCode = FileStreamHelpers.GetLastWin32ErrorAndDisposeHandleIfInvalid(handle); @@ -562,82 +640,28 @@ private static ValueTask WriteGatherAtOffsetAsync(SafeFileHandle handle, IReadOn return ScheduleSyncWriteGatherAtOffsetAsync(handle, buffers, fileOffset, cancellationToken); } - if (CanUseScatterGatherWindowsAPIs(handle)) + if (CanUseScatterGatherWindowsAPIs(handle) + && TryPrepareScatterGatherBuffers(buffers, default(ReadOnlyMemoryHandler), out MemoryHandle[]? handlesToDispose, out IntPtr segmentsPtr, out int totalBytes)) { - long totalBytes = 0; - for (int i = 0; i < buffers.Count; i++) - { - totalBytes += buffers[i].Length; - } - - if (totalBytes <= int.MaxValue) // the ReadFileScatter API uses int, not long - { - return WriteGatherAtOffsetSingleSyscallAsync(handle, buffers, fileOffset, (int)totalBytes, cancellationToken); - } + return WriteGatherAtOffsetSingleSyscallAsync(handle, handlesToDispose, segmentsPtr, fileOffset, totalBytes, cancellationToken); } return WriteGatherAtOffsetMultipleSyscallsAsync(handle, buffers, fileOffset, cancellationToken); } - private static async ValueTask WriteGatherAtOffsetMultipleSyscallsAsync(SafeFileHandle handle, IReadOnlyList> buffers, long fileOffset, CancellationToken cancellationToken) + private static async ValueTask WriteGatherAtOffsetSingleSyscallAsync(SafeFileHandle handle, MemoryHandle[] handlesToDispose, IntPtr segmentsPtr, long fileOffset, int totalBytes, CancellationToken cancellationToken) { - long bytesWritten = 0; - int buffersCount = buffers.Count; - for (int i = 0; i < buffersCount; i++) + try { - ReadOnlyMemory rom = buffers[i]; - await WriteAtOffsetAsync(handle, rom, fileOffset + bytesWritten, cancellationToken).ConfigureAwait(false); - bytesWritten += rom.Length; + await WriteFileGatherAsync(handle, segmentsPtr, totalBytes, fileOffset, cancellationToken).ConfigureAwait(false); } - } - - private static ValueTask WriteGatherAtOffsetSingleSyscallAsync(SafeFileHandle handle, IReadOnlyList> buffers, long fileOffset, int totalBytes, CancellationToken cancellationToken) - { - if (buffers.Count == 1) + finally { - return WriteAtOffsetAsync(handle, buffers[0], fileOffset, cancellationToken); - } - - return Core(handle, buffers, fileOffset, totalBytes, cancellationToken); - - static async ValueTask Core(SafeFileHandle handle, IReadOnlyList> buffers, long fileOffset, int totalBytes, CancellationToken cancellationToken) - { - // "The array must contain enough elements to store nNumberOfBytesToWrite bytes of data, and one element for the terminating NULL. " - int buffersCount = buffers.Count; - long[] fileSegments = new long[buffersCount + 1]; - fileSegments[buffersCount] = 0; - - MemoryHandle[] memoryHandles = new MemoryHandle[buffersCount]; - MemoryHandle pinnedSegments = fileSegments.AsMemory().Pin(); - - try - { - for (int i = 0; i < buffersCount; i++) - { - ReadOnlyMemory buffer = buffers[i]; - MemoryHandle memoryHandle = buffer.Pin(); - memoryHandles[i] = memoryHandle; - - unsafe // awaits can't be in an unsafe context - { - fileSegments[i] = new IntPtr(memoryHandle.Pointer).ToInt64(); - } - } - - await WriteFileGatherAsync(handle, pinnedSegments, totalBytes, fileOffset, cancellationToken).ConfigureAwait(false); - } - finally - { - foreach (MemoryHandle memoryHandle in memoryHandles) - { - memoryHandle.Dispose(); - } - pinnedSegments.Dispose(); - } + CleanupScatterGatherBuffers(handlesToDispose, segmentsPtr); } } - private static unsafe ValueTask WriteFileGatherAsync(SafeFileHandle handle, MemoryHandle pinnedSegments, int bytesToWrite, long fileOffset, CancellationToken cancellationToken) + private static unsafe ValueTask WriteFileGatherAsync(SafeFileHandle handle, IntPtr segmentsPtr, int bytesToWrite, long fileOffset, CancellationToken cancellationToken) { handle.EnsureThreadPoolBindingInitialized(); @@ -645,10 +669,10 @@ private static unsafe ValueTask WriteFileGatherAsync(SafeFileHandle handle, Memo try { NativeOverlapped* nativeOverlapped = vts.PrepareForOperation(ReadOnlyMemory.Empty, fileOffset); - Debug.Assert(pinnedSegments.Pointer != null); + Debug.Assert(segmentsPtr != IntPtr.Zero); // Queue an async WriteFile operation. - if (Interop.Kernel32.WriteFileGather(handle, (long*)pinnedSegments.Pointer, bytesToWrite, IntPtr.Zero, nativeOverlapped) == 0) + if (Interop.Kernel32.WriteFileGather(handle, (long*)segmentsPtr, bytesToWrite, IntPtr.Zero, nativeOverlapped) == 0) { // The operation failed, or it's pending. int errorCode = FileStreamHelpers.GetLastWin32ErrorAndDisposeHandleIfInvalid(handle); @@ -679,15 +703,28 @@ private static unsafe ValueTask WriteFileGatherAsync(SafeFileHandle handle, Memo return new ValueTask(vts, vts.Version); } - private static unsafe NativeOverlapped* GetNativeOverlappedForAsyncHandle(ThreadPoolBoundHandle threadPoolBinding, long fileOffset, CallbackResetEvent resetEvent) + private static async ValueTask WriteGatherAtOffsetMultipleSyscallsAsync(SafeFileHandle handle, IReadOnlyList> buffers, long fileOffset, CancellationToken cancellationToken) + { + int buffersCount = buffers.Count; + for (int i = 0; i < buffersCount; i++) + { + ReadOnlyMemory rom = buffers[i]; + await WriteAtOffsetAsync(handle, rom, fileOffset, cancellationToken).ConfigureAwait(false); + fileOffset += rom.Length; + } + } + + private static unsafe NativeOverlapped* GetNativeOverlappedForAsyncHandle(SafeFileHandle handle, long fileOffset, CallbackResetEvent resetEvent) { // After SafeFileHandle is bound to ThreadPool, we need to use ThreadPoolBinding // to allocate a native overlapped and provide a valid callback. - NativeOverlapped* result = threadPoolBinding.AllocateNativeOverlapped(s_callback, resetEvent, null); + NativeOverlapped* result = handle.ThreadPoolBinding!.UnsafeAllocateNativeOverlapped(s_callback, resetEvent, null); - // For pipes the offsets are ignored by the OS - result->OffsetLow = unchecked((int)fileOffset); - result->OffsetHigh = (int)(fileOffset >> 32); + if (handle.CanSeek) + { + result->OffsetLow = unchecked((int)fileOffset); + result->OffsetHigh = (int)(fileOffset >> 32); + } // From https://docs.microsoft.com/en-us/windows/win32/api/ioapiset/nf-ioapiset-getoverlappedresult: // "If the hEvent member of the OVERLAPPED structure is NULL, the system uses the state of the hFile handle to signal when the operation has been completed. @@ -721,11 +758,11 @@ private static unsafe IOCompletionCallback AllocateCallback() static unsafe void Callback(uint errorCode, uint numBytes, NativeOverlapped* pOverlapped) { CallbackResetEvent state = (CallbackResetEvent)ThreadPoolBoundHandle.GetNativeOverlappedState(pOverlapped)!; - state.FreeNativeOverlapped(pOverlapped); + state.ReleaseRefCount(pOverlapped); } } - // We need to store the reference count (see the comment in FreeNativeOverlappedIfItIsSafe) and an EventHandle to signal the completion. + // We need to store the reference count (see the comment in ReleaseRefCount) and an EventHandle to signal the completion. // We could keep these two things separate, but since ManualResetEvent is sealed and we want to avoid any extra allocations, this type has been created. // It's basically ManualResetEvent with reference count. private sealed class CallbackResetEvent : EventWaitHandle @@ -738,7 +775,7 @@ internal CallbackResetEvent(ThreadPoolBoundHandle threadPoolBoundHandle) : base( _threadPoolBoundHandle = threadPoolBoundHandle; } - internal unsafe void FreeNativeOverlapped(NativeOverlapped* pOverlapped) + internal unsafe void ReleaseRefCount(NativeOverlapped* pOverlapped) { // Each SafeFileHandle opened for async IO is bound to ThreadPool. // It requires us to provide a callback even if we want to use EventHandle and use GetOverlappedResult to obtain the result. @@ -750,5 +787,25 @@ internal unsafe void FreeNativeOverlapped(NativeOverlapped* pOverlapped) } } } + + // Abstracts away the type signature incompatibility between Memory and ReadOnlyMemory. + // TODO: Use abstract static methods when they become stable. + private interface IMemoryHandler + { + int GetLength(in T memory); + MemoryHandle Pin(in T memory); + } + + private readonly struct MemoryHandler : IMemoryHandler> + { + public int GetLength(in Memory memory) => memory.Length; + public MemoryHandle Pin(in Memory memory) => memory.Pin(); + } + + private readonly struct ReadOnlyMemoryHandler : IMemoryHandler> + { + public int GetLength(in ReadOnlyMemory memory) => memory.Length; + public MemoryHandle Pin(in ReadOnlyMemory memory) => memory.Pin(); + } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs index 00d0d2a59b9a6a..8dfda1fa6db2b7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/BufferedFileStreamStrategy.cs @@ -31,21 +31,6 @@ internal BufferedFileStreamStrategy(FileStreamStrategy strategy, int bufferSize) _bufferSize = bufferSize; } - ~BufferedFileStreamStrategy() - { - try - { - // the finalizer must at least try to flush the write buffer - // so we enforce it by passing always true - Dispose(true); - } - catch (Exception e) when (FileStreamHelpers.IsIoRelatedException(e)) - { - // On finalization, ignore failures from trying to flush the write buffer, - // e.g. if this stream is wrapping a pipe and the pipe is now broken. - } - } - public override bool CanRead => _strategy.CanRead; public override bool CanWrite => _strategy.CanWrite; @@ -137,23 +122,21 @@ public override async ValueTask DisposeAsync() } } - internal override void DisposeInternal(bool disposing) => Dispose(disposing); - - protected override void Dispose(bool disposing) + protected sealed override void Dispose(bool disposing) { + if (_strategy.IsClosed) + { + return; + } + try { - if (disposing && !_strategy.IsClosed) - { - try - { - Flush(); - } - finally - { - _strategy.Dispose(); - } - } + Flush(); + } + catch (Exception e) when (!disposing && FileStreamHelpers.IsIoRelatedException(e)) + { + // On finalization, ignore failures from trying to flush the write buffer, + // e.g. if this stream is wrapping a pipe and the pipe is now broken. } finally { @@ -161,10 +144,10 @@ protected override void Dispose(bool disposing) // when users have a race condition in their code (i.e. they call // FileStream.Close when calling another method on FileStream like Read). - // Call base.Dispose(bool) to cleanup async IO resources - base.Dispose(disposing); - + // There is no need to call base.Dispose as it's empty _writePos = 0; + + _strategy.DisposeInternal(disposing); } } @@ -356,6 +339,8 @@ public override ValueTask ReadAsync(Memory buffer, CancellationToken { if (_readLen == _readPos && buffer.Length >= _bufferSize) { + // invalidate the buffered data, otherwise certain Seek operation followed by a ReadAsync could try to re-use data from _buffer + _readPos = _readLen = 0; // hot path #1: the read buffer is empty and buffering would not be beneficial // To find out why we are bypassing cache here, please see WriteAsync comments. return _strategy.ReadAsync(buffer, cancellationToken); @@ -974,11 +959,12 @@ public override long Seek(long offset, SeekOrigin origin) // Otherwise we will throw away the buffer. This can only happen on read, as we flushed write data above. // The offset of the new/updated seek pointer within _buffer: - _readPos = (int)(newPos - (oldPos - _readPos)); + long readPos = (newPos - (oldPos - _readPos)); // If the offset of the updated seek pointer in the buffer is still legal, then we can keep using the buffer: - if (0 <= _readPos && _readPos < _readLen) + if (0 <= readPos && readPos < _readLen) { + _readPos = (int)readPos; // Adjust the seek pointer of the underlying stream to reflect the amount of useful bytes in the read buffer: _strategy.Seek(_readLen - _readPos, SeekOrigin.Current); } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/DerivedFileStreamStrategy.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/DerivedFileStreamStrategy.cs index e6c63246d0a19e..a68ff794f394cb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/DerivedFileStreamStrategy.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/DerivedFileStreamStrategy.cs @@ -23,14 +23,6 @@ internal DerivedFileStreamStrategy(FileStream fileStream, FileStreamStrategy str _strategy = strategy; } - ~DerivedFileStreamStrategy() - { - // Preserved for compatibility since FileStream has defined a - // finalizer in past releases and derived classes may depend - // on Dispose(false) call. - _fileStream.DisposeInternal(false); - } - public override bool CanRead => _strategy.CanRead; public override bool CanWrite => _strategy.CanWrite; @@ -154,16 +146,8 @@ public override Task FlushAsync(CancellationToken cancellationToken) public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) => _fileStream.BaseCopyToAsync(destination, bufferSize, cancellationToken); - public override ValueTask DisposeAsync() => _fileStream.BaseDisposeAsync(); - - internal override void DisposeInternal(bool disposing) - { - _strategy.DisposeInternal(disposing); + public override ValueTask DisposeAsync() => _strategy.DisposeAsync(); - if (disposing) - { - GC.SuppressFinalize(this); - } - } + protected sealed override void Dispose(bool disposing) => _strategy.DisposeInternal(disposing); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Windows.cs index 779acce9373717..5ba493ca9ca215 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Windows.cs @@ -123,6 +123,16 @@ internal static void Unlock(SafeFileHandle handle, long position, long length) } internal static unsafe void SetFileLength(SafeFileHandle handle, long length) + { + if (!TrySetFileLength(handle, length, out int errorCode)) + { + throw errorCode == Interop.Errors.ERROR_INVALID_PARAMETER + ? new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_FileLengthTooBig) + : Win32Marshal.GetExceptionForWin32Error(errorCode, handle.Path); + } + } + + internal static unsafe bool TrySetFileLength(SafeFileHandle handle, long length, out int errorCode) { var eofInfo = new Interop.Kernel32.FILE_END_OF_FILE_INFO { @@ -135,11 +145,12 @@ internal static unsafe void SetFileLength(SafeFileHandle handle, long length) &eofInfo, (uint)sizeof(Interop.Kernel32.FILE_END_OF_FILE_INFO))) { - int errorCode = Marshal.GetLastPInvokeError(); - if (errorCode == Interop.Errors.ERROR_INVALID_PARAMETER) - throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_FileLengthTooBig); - throw Win32Marshal.GetExceptionForWin32Error(errorCode, handle.Path); + errorCode = Marshal.GetLastPInvokeError(); + return false; } + + errorCode = Interop.Errors.ERROR_SUCCESS; + return true; } internal static unsafe int ReadFileNative(SafeFileHandle handle, Span bytes, NativeOverlapped* overlapped, out int errorCode) diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.cs index d86c70a621ca1a..3db2174d3fbd14 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.cs @@ -58,11 +58,6 @@ e is UnauthorizedAccessException || e is NotSupportedException || (e is ArgumentException && !(e is ArgumentNullException)); - internal static bool ShouldPreallocate(long preallocationSize, FileAccess access, FileMode mode) - => preallocationSize > 0 - && (access & FileAccess.Write) != 0 - && mode != FileMode.Open && mode != FileMode.Append; - internal static void ValidateArguments(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, long preallocationSize) { if (path == null) @@ -125,9 +120,31 @@ internal static void ValidateArguments(string path, FileMode mode, FileAccess ac throw new ArgumentException(SR.Argument_InvalidAppendMode, nameof(access)); } + if (preallocationSize > 0) + { + ValidateArgumentsForPreallocation(mode, access); + } + SerializationGuard(access); } + internal static void ValidateArgumentsForPreallocation(FileMode mode, FileAccess access) + { + // The user will be writing into the preallocated space. + if ((access & FileAccess.Write) == 0) + { + throw new ArgumentException(SR.Argument_InvalidPreallocateAccess, nameof(access)); + } + + // Only allow preallocation for newly created/overwritten files. + // When we fail to preallocate, we'll remove the file. + if (mode != FileMode.Create && + mode != FileMode.CreateNew) + { + throw new ArgumentException(SR.Argument_InvalidPreallocateMode, nameof(mode)); + } + } + internal static void SerializationGuard(FileAccess access) { if ((access & FileAccess.Write) == FileAccess.Write) diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamStrategy.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamStrategy.cs index 6cec66e7ac89b0..de021bc67b368b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamStrategy.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamStrategy.cs @@ -23,6 +23,6 @@ internal abstract class FileStreamStrategy : Stream internal abstract void Flush(bool flushToDisk); - internal abstract void DisposeInternal(bool disposing); + internal void DisposeInternal(bool disposing) => Dispose(disposing); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/Net5CompatFileStreamStrategy.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/Net5CompatFileStreamStrategy.cs index 797f6f5e9c0ce8..8a233144094e0b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/Net5CompatFileStreamStrategy.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/Net5CompatFileStreamStrategy.cs @@ -101,10 +101,6 @@ internal Net5CompatFileStreamStrategy(string path, FileMode mode, FileAccess acc } } - ~Net5CompatFileStreamStrategy() => Dispose(false); // mandatory to Flush the write buffer - - internal override void DisposeInternal(bool disposing) => Dispose(disposing); - public override Task FlushAsync(CancellationToken cancellationToken) { // TODO: https://github.com/dotnet/runtime/issues/27643 (stop doing this synchronous work!!). diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/OSFileStreamStrategy.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/OSFileStreamStrategy.cs index 0386dfa78d5631..62ac07f545355b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/OSFileStreamStrategy.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/OSFileStreamStrategy.cs @@ -148,8 +148,6 @@ public sealed override ValueTask DisposeAsync() return ValueTask.CompletedTask; } - internal sealed override void DisposeInternal(bool disposing) => Dispose(disposing); - // this method just disposes everything (no buffer, no need to flush) protected sealed override void Dispose(bool disposing) { diff --git a/src/libraries/System.Private.CoreLib/src/System/IParseable.cs b/src/libraries/System.Private.CoreLib/src/System/IParseable.cs index 77064639e368ac..5a715cab0831af 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IParseable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IParseable.cs @@ -12,7 +12,7 @@ namespace System { /// Defines a mechanism for parsing a string to a value. /// The type that implements this interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IParseable where TSelf : IParseable { diff --git a/src/libraries/System.Private.CoreLib/src/System/IShiftOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IShiftOperators.cs index 8ba4d810233dc6..ad0af7155d4fb0 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IShiftOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IShiftOperators.cs @@ -12,7 +12,7 @@ namespace System /// Defines a mechanism for shifting a value by another value. /// The type that implements this interface. /// The type that contains the result of shifting by . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IShiftOperators where TSelf : IShiftOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/ISpanFormattable.cs b/src/libraries/System.Private.CoreLib/src/System/ISpanFormattable.cs index 0998785f780ba3..15e7717435d960 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ISpanFormattable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ISpanFormattable.cs @@ -15,6 +15,7 @@ public interface ISpanFormattable : IFormattable /// /// An implementation of this interface should produce the same string of characters as an implementation of /// on the same type. + /// TryFormat should return false only if there is not enough space in the destination buffer. Any other failures should throw an exception. /// bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format, IFormatProvider? provider); } diff --git a/src/libraries/System.Private.CoreLib/src/System/ISpanParseable.cs b/src/libraries/System.Private.CoreLib/src/System/ISpanParseable.cs index 6264fe15802926..34dad1427db4af 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ISpanParseable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ISpanParseable.cs @@ -11,7 +11,7 @@ namespace System { /// Defines a mechanism for parsing a span of characters to a value. /// The type that implements this interface. - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface ISpanParseable : IParseable where TSelf : ISpanParseable { diff --git a/src/libraries/System.Private.CoreLib/src/System/ISubtractionOperators.cs b/src/libraries/System.Private.CoreLib/src/System/ISubtractionOperators.cs index f11da9d2f98125..5cbe1a634477f3 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ISubtractionOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ISubtractionOperators.cs @@ -13,7 +13,7 @@ namespace System /// The type that implements this interface. /// The type that will be subtracted from . /// The type that contains the difference of subtracted from . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface ISubtractionOperators where TSelf : ISubtractionOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/IUnaryNegationOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IUnaryNegationOperators.cs index 686887ce9c8fd8..5ccede089fe2c6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IUnaryNegationOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IUnaryNegationOperators.cs @@ -12,7 +12,7 @@ namespace System /// Defines a mechanism for computing the unary negation of a value. /// The type that implements this interface. /// The type that contains the result of negating . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IUnaryNegationOperators where TSelf : IUnaryNegationOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/IUnaryPlusOperators.cs b/src/libraries/System.Private.CoreLib/src/System/IUnaryPlusOperators.cs index a719ff5d0b11e8..2d4dd964136d08 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IUnaryPlusOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IUnaryPlusOperators.cs @@ -12,7 +12,7 @@ namespace System /// Defines a mechanism for computing the unary plus of a value. /// The type that implements this interface. /// The type that contains the result of negating . - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public interface IUnaryPlusOperators where TSelf : IUnaryPlusOperators { diff --git a/src/libraries/System.Private.CoreLib/src/System/Int16.cs b/src/libraries/System.Private.CoreLib/src/System/Int16.cs index 909b37f77b340b..c99007c0afca37 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Int16.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Int16.cs @@ -288,11 +288,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IAdditionOperators.operator +(short left, short right) => (short)(left + right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked short IAdditionOperators.operator +(short left, short right) // => checked((short)(left + right)); @@ -300,30 +300,30 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBinaryInteger.LeadingZeroCount(short value) => (short)(BitOperations.LeadingZeroCount((ushort)value) - 16); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBinaryInteger.PopCount(short value) => (short)BitOperations.PopCount((ushort)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBinaryInteger.RotateLeft(short value, int rotateAmount) => (short)((value << (rotateAmount & 15)) | ((ushort)value >> ((16 - rotateAmount) & 15))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBinaryInteger.RotateRight(short value, int rotateAmount) => (short)(((ushort)value >> (rotateAmount & 15)) | (value << ((16 - rotateAmount) & 15))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBinaryInteger.TrailingZeroCount(short value) => (byte)(BitOperations.TrailingZeroCount(value << 16) - 16); @@ -331,11 +331,11 @@ static short IBinaryInteger.TrailingZeroCount(short value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(short value) => BitOperations.IsPow2(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBinaryNumber.Log2(short value) { if (value < 0) @@ -349,19 +349,19 @@ static short IBinaryNumber.Log2(short value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBitwiseOperators.operator &(short left, short right) => (short)(left & right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBitwiseOperators.operator |(short left, short right) => (short)(left | right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBitwiseOperators.operator ^(short left, short right) => (short)(left ^ right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IBitwiseOperators.operator ~(short value) => (short)(~value); @@ -369,19 +369,19 @@ static short IBinaryNumber.Log2(short value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(short left, short right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(short left, short right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(short left, short right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(short left, short right) => left >= right; @@ -389,11 +389,11 @@ static short IBinaryNumber.Log2(short value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IDecrementOperators.operator --(short value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked short IDecrementOperators.operator --(short value) // => checked(--value); @@ -401,11 +401,11 @@ static short IBinaryNumber.Log2(short value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IDivisionOperators.operator /(short left, short right) => (short)(left / right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked short IDivisionOperators.operator /(short left, short right) // => checked((short)(left / right)); @@ -413,11 +413,11 @@ static short IBinaryNumber.Log2(short value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(short left, short right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(short left, short right) => left != right; @@ -425,11 +425,11 @@ static short IBinaryNumber.Log2(short value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IIncrementOperators.operator ++(short value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked short IIncrementOperators.operator ++(short value) // => checked(++value); @@ -437,21 +437,21 @@ static short IBinaryNumber.Log2(short value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IModulusOperators.operator %(short left, short right) => (short)(left % right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked short IModulusOperators.operator %(short left, short right) // => checked((short)(left % right)); @@ -459,18 +459,18 @@ static short IBinaryNumber.Log2(short value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IMultiplyOperators.operator *(short left, short right) => (short)(left * right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked short IMultiplyOperators.operator *(short left, short right) // => checked((short)(left * right)); @@ -478,21 +478,21 @@ static short IBinaryNumber.Log2(short value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short INumber.Abs(short value) => Math.Abs(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short INumber.Clamp(short value, short min, short max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static short INumber.Create(TOther value) { @@ -559,7 +559,7 @@ static short INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static short INumber.CreateSaturating(TOther value) { @@ -643,7 +643,7 @@ static short INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static short INumber.CreateTruncating(TOther value) { @@ -710,31 +710,31 @@ static short INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (short Quotient, short Remainder) INumber.DivRem(short left, short right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short INumber.Max(short x, short y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short INumber.Min(short x, short y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short INumber.Sign(short value) => (short)Math.Sign(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out short result) { @@ -904,11 +904,11 @@ static bool INumber.TryCreate(TOther value, out short result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out short result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out short result) => TryParse(s, style, provider, out result); @@ -916,11 +916,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IF // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out short result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -928,15 +928,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPro // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IShiftOperators.operator <<(short value, int shiftAmount) => (short)(value << shiftAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IShiftOperators.operator >>(short value, int shiftAmount) => (short)(value >> shiftAmount); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static short IShiftOperators.operator >>>(short value, int shiftAmount) // => (short)((ushort)value >> shiftAmount); @@ -944,18 +944,18 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPro // ISignedNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short ISignedNumber.NegativeOne => -1; // // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out short result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -963,11 +963,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short ISubtractionOperators.operator -(short left, short right) => (short)(left - right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked short ISubtractionOperators.operator -(short left, short right) // => checked((short)(left - right)); @@ -975,11 +975,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IUnaryNegationOperators.operator -(short value) => (short)(-value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked short IUnaryNegationOperators.operator -(short value) // => checked((short)(-value)); @@ -987,11 +987,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static short IUnaryPlusOperators.operator +(short value) => (short)(+value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked short IUnaryPlusOperators.operator +(short value) // => checked((short)(+value)); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/Int32.cs b/src/libraries/System.Private.CoreLib/src/System/Int32.cs index 68c6a70cdb0438..5443b6fe289d68 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Int32.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Int32.cs @@ -280,11 +280,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IAdditionOperators.operator +(int left, int right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked int IAdditionOperators.operator +(int left, int right) // => checked(left + right); @@ -292,30 +292,30 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBinaryInteger.LeadingZeroCount(int value) => BitOperations.LeadingZeroCount((uint)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBinaryInteger.PopCount(int value) => BitOperations.PopCount((uint)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBinaryInteger.RotateLeft(int value, int rotateAmount) => (int)BitOperations.RotateLeft((uint)value, rotateAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBinaryInteger.RotateRight(int value, int rotateAmount) => (int)BitOperations.RotateRight((uint)value, rotateAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBinaryInteger.TrailingZeroCount(int value) => BitOperations.TrailingZeroCount(value); @@ -323,11 +323,11 @@ static int IBinaryInteger.TrailingZeroCount(int value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(int value) => BitOperations.IsPow2(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBinaryNumber.Log2(int value) { if (value < 0) @@ -341,19 +341,19 @@ static int IBinaryNumber.Log2(int value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBitwiseOperators.operator &(int left, int right) => left & right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBitwiseOperators.operator |(int left, int right) => left | right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBitwiseOperators.operator ^(int left, int right) => left ^ right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IBitwiseOperators.operator ~(int value) => ~value; @@ -361,19 +361,19 @@ static int IBinaryNumber.Log2(int value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(int left, int right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(int left, int right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(int left, int right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(int left, int right) => left >= right; @@ -381,11 +381,11 @@ static int IBinaryNumber.Log2(int value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IDecrementOperators.operator --(int value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked int IDecrementOperators.operator --(int value) // => checked(--value); @@ -393,11 +393,11 @@ static int IBinaryNumber.Log2(int value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IDivisionOperators.operator /(int left, int right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked int IDivisionOperators.operator /(int left, int right) // => checked(left / right); @@ -405,11 +405,11 @@ static int IBinaryNumber.Log2(int value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(int left, int right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(int left, int right) => left != right; @@ -417,11 +417,11 @@ static int IBinaryNumber.Log2(int value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IIncrementOperators.operator ++(int value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked int IIncrementOperators.operator ++(int value) // => checked(++value); @@ -429,21 +429,21 @@ static int IBinaryNumber.Log2(int value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IModulusOperators.operator %(int left, int right) => left % right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked int IModulusOperators.operator %(int left, int right) // => checked(left % right); @@ -451,18 +451,18 @@ static int IBinaryNumber.Log2(int value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IMultiplyOperators.operator *(int left, int right) => left * right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked int IMultiplyOperators.operator *(int left, int right) // => checked(left * right); @@ -470,21 +470,21 @@ static int IBinaryNumber.Log2(int value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int INumber.Abs(int value) => Math.Abs(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int INumber.Clamp(int value, int min, int max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] internal static int Create(TOther value) where TOther : INumber { @@ -551,12 +551,12 @@ internal static int Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static int INumber.Create(TOther value) => Create(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static int INumber.CreateSaturating(TOther value) { @@ -636,7 +636,7 @@ static int INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static int INumber.CreateTruncating(TOther value) { @@ -703,31 +703,31 @@ static int INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (int Quotient, int Remainder) INumber.DivRem(int left, int right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int INumber.Max(int x, int y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int INumber.Min(int x, int y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int INumber.Sign(int value) => Math.Sign(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out int result) { @@ -873,11 +873,11 @@ static bool INumber.TryCreate(TOther value, out int result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out int result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out int result) => TryParse(s, style, provider, out result); @@ -885,11 +885,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFor // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out int result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -897,15 +897,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvi // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IShiftOperators.operator <<(int value, int shiftAmount) => value << shiftAmount; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IShiftOperators.operator >>(int value, int shiftAmount) => value >> shiftAmount; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static int IShiftOperators.operator >>>(int value, int shiftAmount) // => (int)((uint)value >> shiftAmount); @@ -913,18 +913,18 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvi // ISignedNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int ISignedNumber.NegativeOne => -1; // // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out int result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -932,11 +932,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int ISubtractionOperators.operator -(int left, int right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked int ISubtractionOperators.operator -(int left, int right) // => checked(left - right); @@ -944,11 +944,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IUnaryNegationOperators.operator -(int value) => -value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked int IUnaryNegationOperators.operator -(int value) // => checked(-value); @@ -956,11 +956,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static int IUnaryPlusOperators.operator +(int value) => +value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked int IUnaryPlusOperators.operator +(int value) // => checked(+value); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/Int64.cs b/src/libraries/System.Private.CoreLib/src/System/Int64.cs index 1646cf96457eff..7839b8c1235947 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Int64.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Int64.cs @@ -267,11 +267,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IAdditionOperators.operator +(long left, long right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked long IAdditionOperators.operator +(long left, long right) // => checked(left + right); @@ -279,30 +279,30 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBinaryInteger.LeadingZeroCount(long value) => BitOperations.LeadingZeroCount((ulong)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBinaryInteger.PopCount(long value) => BitOperations.PopCount((ulong)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBinaryInteger.RotateLeft(long value, int rotateAmount) => (long)BitOperations.RotateLeft((ulong)value, rotateAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBinaryInteger.RotateRight(long value, int rotateAmount) => (long)BitOperations.RotateRight((ulong)value, rotateAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBinaryInteger.TrailingZeroCount(long value) => BitOperations.TrailingZeroCount(value); @@ -310,11 +310,11 @@ static long IBinaryInteger.TrailingZeroCount(long value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(long value) => BitOperations.IsPow2(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBinaryNumber.Log2(long value) { if (value < 0) @@ -328,19 +328,19 @@ static long IBinaryNumber.Log2(long value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBitwiseOperators.operator &(long left, long right) => left & right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBitwiseOperators.operator |(long left, long right) => left | right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBitwiseOperators.operator ^(long left, long right) => left ^ right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IBitwiseOperators.operator ~(long value) => ~value; @@ -348,19 +348,19 @@ static long IBinaryNumber.Log2(long value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(long left, long right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(long left, long right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(long left, long right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(long left, long right) => left >= right; @@ -368,11 +368,11 @@ static long IBinaryNumber.Log2(long value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IDecrementOperators.operator --(long value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked long IDecrementOperators.operator --(long value) // => checked(--value); @@ -380,11 +380,11 @@ static long IBinaryNumber.Log2(long value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IDivisionOperators.operator /(long left, long right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked long IDivisionOperators.operator /(long left, long right) // => checked(left / right); @@ -392,11 +392,11 @@ static long IBinaryNumber.Log2(long value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(long left, long right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(long left, long right) => left != right; @@ -404,11 +404,11 @@ static long IBinaryNumber.Log2(long value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IIncrementOperators.operator ++(long value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked long IIncrementOperators.operator ++(long value) // => checked(++value); @@ -416,21 +416,21 @@ static long IBinaryNumber.Log2(long value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IModulusOperators.operator %(long left, long right) => left % right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked long IModulusOperators.operator %(long left, long right) // => checked(left % right); @@ -438,18 +438,18 @@ static long IBinaryNumber.Log2(long value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IMultiplyOperators.operator *(long left, long right) => left * right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked long IMultiplyOperators.operator *(long left, long right) // => checked(left * right); @@ -457,21 +457,21 @@ static long IBinaryNumber.Log2(long value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long INumber.Abs(long value) => Math.Abs(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long INumber.Clamp(long value, long min, long max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static long INumber.Create(TOther value) { @@ -538,7 +538,7 @@ static long INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static long INumber.CreateSaturating(TOther value) { @@ -613,7 +613,7 @@ static long INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static long INumber.CreateTruncating(TOther value) { @@ -680,31 +680,31 @@ static long INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (long Quotient, long Remainder) INumber.DivRem(long left, long right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long INumber.Max(long x, long y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long INumber.Min(long x, long y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long INumber.Sign(long value) => Math.Sign(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out long result) { @@ -826,11 +826,11 @@ static bool INumber.TryCreate(TOther value, out long result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out long result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out long result) => TryParse(s, style, provider, out result); @@ -838,11 +838,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFo // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out long result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -850,15 +850,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IShiftOperators.operator <<(long value, int shiftAmount) => value << (int)shiftAmount; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IShiftOperators.operator >>(long value, int shiftAmount) => value >> (int)shiftAmount; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static long IShiftOperators.operator >>>(long value, int shiftAmount) // => (long)((ulong)value >> (int)shiftAmount); @@ -866,18 +866,18 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // ISignedNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long ISignedNumber.NegativeOne => -1; // // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out long result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -885,11 +885,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long ISubtractionOperators.operator -(long left, long right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked long ISubtractionOperators.operator -(long left, long right) // => checked(left - right); @@ -897,11 +897,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IUnaryNegationOperators.operator -(long value) => -value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked long IUnaryNegationOperators.operator -(long value) // => checked(-value); @@ -909,11 +909,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static long IUnaryPlusOperators.operator +(long value) => +value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked long IUnaryPlusOperators.operator +(long value) // => checked(+value); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs b/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs index a9592617b2eb25..a5c01b9781f2c6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs @@ -254,11 +254,11 @@ public static bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatPro // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IAdditionOperators.operator +(nint left, nint right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nint IAdditionOperators.operator +(nint left, nint right) // => checked(left + right); @@ -266,14 +266,14 @@ public static bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatPro // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBinaryInteger.LeadingZeroCount(nint value) { if (Environment.Is64BitProcess) @@ -286,7 +286,7 @@ static nint IBinaryInteger.LeadingZeroCount(nint value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBinaryInteger.PopCount(nint value) { if (Environment.Is64BitProcess) @@ -299,7 +299,7 @@ static nint IBinaryInteger.PopCount(nint value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBinaryInteger.RotateLeft(nint value, int rotateAmount) { if (Environment.Is64BitProcess) @@ -312,7 +312,7 @@ static nint IBinaryInteger.RotateLeft(nint value, int rotateAmount) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBinaryInteger.RotateRight(nint value, int rotateAmount) { @@ -326,7 +326,7 @@ static nint IBinaryInteger.RotateRight(nint value, int rotateAmount) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBinaryInteger.TrailingZeroCount(nint value) { if (Environment.Is64BitProcess) @@ -343,11 +343,11 @@ static nint IBinaryInteger.TrailingZeroCount(nint value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(nint value) => BitOperations.IsPow2(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBinaryNumber.Log2(nint value) { if (value < 0) @@ -369,19 +369,19 @@ static nint IBinaryNumber.Log2(nint value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBitwiseOperators.operator &(nint left, nint right) => left & right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBitwiseOperators.operator |(nint left, nint right) => left | right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBitwiseOperators.operator ^(nint left, nint right) => left ^ right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IBitwiseOperators.operator ~(nint value) => ~value; @@ -389,19 +389,19 @@ static nint IBinaryNumber.Log2(nint value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(nint left, nint right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(nint left, nint right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(nint left, nint right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(nint left, nint right) => left >= right; @@ -409,11 +409,11 @@ static nint IBinaryNumber.Log2(nint value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IDecrementOperators.operator --(nint value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nint IDecrementOperators.operator --(nint value) // => checked(--value); @@ -421,11 +421,11 @@ static nint IBinaryNumber.Log2(nint value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IDivisionOperators.operator /(nint left, nint right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nint IDivisionOperators.operator /(nint left, nint right) // => checked(left / right); @@ -433,11 +433,11 @@ static nint IBinaryNumber.Log2(nint value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(nint left, nint right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(nint left, nint right) => left != right; @@ -445,11 +445,11 @@ static nint IBinaryNumber.Log2(nint value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IIncrementOperators.operator ++(nint value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nint IIncrementOperators.operator ++(nint value) // => checked(++value); @@ -457,21 +457,21 @@ static nint IBinaryNumber.Log2(nint value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IModulusOperators.operator %(nint left, nint right) => left % right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nint IModulusOperators.operator %(nint left, nint right) // => checked(left % right); @@ -479,18 +479,18 @@ static nint IBinaryNumber.Log2(nint value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IMultiplyOperators.operator *(nint left, nint right) => left * right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nint IMultiplyOperators.operator *(nint left, nint right) // => checked(left * right); @@ -498,21 +498,21 @@ static nint IBinaryNumber.Log2(nint value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint INumber.Abs(nint value) => Math.Abs(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint INumber.Clamp(nint value, nint min, nint max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static nint INumber.Create(TOther value) { @@ -579,7 +579,7 @@ static nint INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static nint INumber.CreateSaturating(TOther value) { @@ -657,7 +657,7 @@ static nint INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static nint INumber.CreateTruncating(TOther value) { @@ -724,31 +724,31 @@ static nint INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (nint Quotient, nint Remainder) INumber.DivRem(nint left, nint right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint INumber.Max(nint x, nint y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint INumber.Min(nint x, nint y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint INumber.Sign(nint value) => Math.Sign(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out nint result) { @@ -886,11 +886,11 @@ static bool INumber.TryCreate(TOther value, out nint result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out nint result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out nint result) => TryParse(s, style, provider, out result); @@ -898,11 +898,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFo // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out nint result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -910,15 +910,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IShiftOperators.operator <<(nint value, int shiftAmount) => value << (int)shiftAmount; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IShiftOperators.operator >>(nint value, int shiftAmount) => value >> (int)shiftAmount; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static nint IShiftOperators.operator >>>(nint value, int shiftAmount) // => (nint)((nuint)value >> (int)shiftAmount); @@ -926,18 +926,18 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // ISignedNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint ISignedNumber.NegativeOne => -1; // // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out nint result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -945,11 +945,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint ISubtractionOperators.operator -(nint left, nint right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nint ISubtractionOperators.operator -(nint left, nint right) // => checked(left - right); @@ -957,11 +957,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IUnaryNegationOperators.operator -(nint value) => -value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nint IUnaryNegationOperators.operator -(nint value) // => checked(-value); @@ -969,11 +969,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nint IUnaryPlusOperators.operator +(nint value) => +value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nint IUnaryPlusOperators.operator +(nint value) // => checked(+value); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/Math.cs b/src/libraries/System.Private.CoreLib/src/System/Math.cs index bb7fa0d4d3c8bb..d47895203fa051 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Math.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Math.cs @@ -831,8 +831,8 @@ public static double Max(double val1, double val2) // This matches the IEEE 754:2019 `maximum` function // // It propagates NaN inputs back to the caller and - // otherwise returns the larger of the inputs. It - // treats +0 as larger than -0 as per the specification. + // otherwise returns the greater of the inputs. It + // treats +0 as greater than -0 as per the specification. if (val1 != val2) { @@ -888,8 +888,8 @@ public static float Max(float val1, float val2) // This matches the IEEE 754:2019 `maximum` function // // It propagates NaN inputs back to the caller and - // otherwise returns the larger of the inputs. It - // treats +0 as larger than -0 as per the specification. + // otherwise returns the greater of the inputs. It + // treats +0 as greater than -0 as per the specification. if (val1 != val2) { @@ -941,8 +941,8 @@ public static double MaxMagnitude(double x, double y) // This matches the IEEE 754:2019 `maximumMagnitude` function // // It propagates NaN inputs back to the caller and - // otherwise returns the input with a larger magnitude. - // It treats +0 as larger than -0 as per the specification. + // otherwise returns the input with a greater magnitude. + // It treats +0 as greater than -0 as per the specification. double ax = Abs(x); double ay = Abs(y); @@ -978,12 +978,17 @@ public static double Min(double val1, double val2) // This matches the IEEE 754:2019 `minimum` function // // It propagates NaN inputs back to the caller and - // otherwise returns the larger of the inputs. It - // treats +0 as larger than -0 as per the specification. + // otherwise returns the lesser of the inputs. It + // treats -0 as lesser than +0 as per the specification. - if (val1 != val2 && !double.IsNaN(val1)) + if (val1 != val2) { - return val1 < val2 ? val1 : val2; + if (!double.IsNaN(val1)) + { + return val1 < val2 ? val1 : val2; + } + + return val1; } return double.IsNegative(val1) ? val1 : val2; @@ -1030,12 +1035,17 @@ public static float Min(float val1, float val2) // This matches the IEEE 754:2019 `minimum` function // // It propagates NaN inputs back to the caller and - // otherwise returns the larger of the inputs. It - // treats +0 as larger than -0 as per the specification. + // otherwise returns the lesser of the inputs. It + // treats -0 as lesser than +0 as per the specification. - if (val1 != val2 && !float.IsNaN(val1)) + if (val1 != val2) { - return val1 < val2 ? val1 : val2; + if (!float.IsNaN(val1)) + { + return val1 < val2 ? val1 : val2; + } + + return val1; } return float.IsNegative(val1) ? val1 : val2; @@ -1078,8 +1088,8 @@ public static double MinMagnitude(double x, double y) // This matches the IEEE 754:2019 `minimumMagnitude` function // // It propagates NaN inputs back to the caller and - // otherwise returns the input with a larger magnitude. - // It treats +0 as larger than -0 as per the specification. + // otherwise returns the input with a lesser magnitude. + // It treats -0 as lesser than +0 as per the specification. double ax = Abs(x); double ay = Abs(y); diff --git a/src/libraries/System.Private.CoreLib/src/System/MathF.cs b/src/libraries/System.Private.CoreLib/src/System/MathF.cs index 9d1b75c8b16172..3e03a6360d22c5 100644 --- a/src/libraries/System.Private.CoreLib/src/System/MathF.cs +++ b/src/libraries/System.Private.CoreLib/src/System/MathF.cs @@ -216,8 +216,8 @@ public static float MaxMagnitude(float x, float y) // This matches the IEEE 754:2019 `maximumMagnitude` function // // It propagates NaN inputs back to the caller and - // otherwise returns the input with a larger magnitude. - // It treats +0 as larger than -0 as per the specification. + // otherwise returns the input with a greater magnitude. + // It treats +0 as greater than -0 as per the specification. float ax = Abs(x); float ay = Abs(y); @@ -246,8 +246,8 @@ public static float MinMagnitude(float x, float y) // This matches the IEEE 754:2019 `minimumMagnitude` function // // It propagates NaN inputs back to the caller and - // otherwise returns the input with a larger magnitude. - // It treats +0 as larger than -0 as per the specification. + // otherwise returns the input with a lesser magnitude. + // It treats -0 as lesser than +0 as per the specification. float ax = Abs(x); float ay = Abs(y); diff --git a/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs b/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs index 48305c4aaa2378..9ea4431a78303d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs @@ -31,7 +31,9 @@ internal unsafe ref struct BigInteger private const int MaxBits = BitsForLongestBinaryMantissa + BitsForLongestDigitSequence + BitsPerBlock; private const int BitsPerBlock = sizeof(int) * 8; - private const int MaxBlockCount = (MaxBits + (BitsPerBlock - 1)) / BitsPerBlock; + + // We need one extra block to make our shift left algorithm significantly simpler + private const int MaxBlockCount = ((MaxBits + (BitsPerBlock - 1)) / BitsPerBlock) + 1; private static readonly uint[] s_Pow10UInt32Table = new uint[] { @@ -302,7 +304,8 @@ internal unsafe ref struct BigInteger 0xD9D61A05, 0x00000325, - // 9 Trailing blocks to ensure MaxBlockCount + // 10 Trailing blocks to ensure MaxBlockCount + 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -358,11 +361,24 @@ public static void Add(ref BigInteger lhs, ref BigInteger rhs, out BigInteger re resultIndex++; } + int resultLength = largeLength; + // If there's still a carry, append a new block if (carry != 0) { Debug.Assert(carry == 1); - Debug.Assert((resultIndex == largeLength) && (largeLength < MaxBlockCount)); + Debug.Assert(resultIndex == resultLength); + Debug.Assert(unchecked((uint)(resultLength)) < MaxBlockCount); + + if (unchecked((uint)(resultLength)) >= MaxBlockCount) + { + // We shouldn't reach here, and the above assert will help flag this + // during testing, but we'll ensure that we return a safe value of + // zero in the case we end up overflowing in any way. + + SetZero(out result); + return; + } result._blocks[resultIndex] = 1; result._length++; @@ -722,16 +738,27 @@ public static void Multiply(ref BigInteger lhs, uint value, out BigInteger resul index++; } + int resultLength = lhsLength; + if (carry != 0) { - Debug.Assert(unchecked((uint)(lhsLength)) + 1 <= MaxBlockCount); + Debug.Assert(unchecked((uint)(resultLength)) < MaxBlockCount); + + if (unchecked((uint)(resultLength)) >= MaxBlockCount) + { + // We shouldn't reach here, and the above assert will help flag this + // during testing, but we'll ensure that we return a safe value of + // zero in the case we end up overflowing in any way. + + SetZero(out result); + return; + } + result._blocks[index] = carry; - result._length = (lhsLength + 1); - } - else - { - result._length = lhsLength; + resultLength += 1; } + + result._length = resultLength; } public static void Multiply(ref BigInteger lhs, ref BigInteger rhs, out BigInteger result) @@ -766,6 +793,16 @@ public static void Multiply(ref BigInteger lhs, ref BigInteger rhs, out BigInteg int maxResultLength = smallLength + largeLength; Debug.Assert(unchecked((uint)(maxResultLength)) <= MaxBlockCount); + if (unchecked((uint)(maxResultLength)) > MaxBlockCount) + { + // We shouldn't reach here, and the above assert will help flag this + // during testing, but we'll ensure that we return a safe value of + // zero in the case we end up overflowing in any way. + + SetZero(out result); + return; + } + // Zero out result internal blocks. result._length = maxResultLength; result.Clear((uint)maxResultLength); @@ -811,7 +848,19 @@ public static void Pow2(uint exponent, out BigInteger result) { uint blocksToShift = DivRem32(exponent, out uint remainingBitsToShift); result._length = (int)blocksToShift + 1; + Debug.Assert(unchecked((uint)result._length) <= MaxBlockCount); + + if (unchecked((uint)result._length) > MaxBlockCount) + { + // We shouldn't reach here, and the above assert will help flag this + // during testing, but we'll ensure that we return a safe value of + // zero in the case we end up overflowing in any way. + + SetZero(out result); + return; + } + if (blocksToShift > 0) { result.Clear(blocksToShift); @@ -1001,7 +1050,18 @@ public void Add(uint value) } } - Debug.Assert(unchecked((uint)(length)) + 1 <= MaxBlockCount); + Debug.Assert(unchecked((uint)(length)) < MaxBlockCount); + + if (unchecked((uint)(length)) >= MaxBlockCount) + { + // We shouldn't reach here, and the above assert will help flag this + // during testing, but we'll ensure that we return a safe value of + // zero in the case we end up overflowing in any way. + + SetZero(out this); + return; + } + _blocks[length] = 1; _length = length + 1; } @@ -1063,9 +1123,20 @@ public void Multiply10() if (carry != 0) { - Debug.Assert(unchecked((uint)(_length)) + 1 <= MaxBlockCount); + Debug.Assert(unchecked((uint)(length)) < MaxBlockCount); + + if (unchecked((uint)(length)) >= MaxBlockCount) + { + // We shouldn't reach here, and the above assert will help flag this + // during testing, but we'll ensure that we return a safe value of + // zero in the case we end up overflowing in any way. + + SetZero(out this); + return; + } + _blocks[index] = (uint)carry; - _length++; + _length = length + 1; } } @@ -1141,7 +1212,17 @@ public void ShiftLeft(uint shift) // Check if the shift is block aligned if (remainingBitsToShift == 0) { - Debug.Assert(writeIndex < MaxBlockCount); + Debug.Assert(unchecked((uint)(length)) < MaxBlockCount); + + if (unchecked((uint)(length)) >= MaxBlockCount) + { + // We shouldn't reach here, and the above assert will help flag this + // during testing, but we'll ensure that we return a safe value of + // zero in the case we end up overflowing in any way. + + SetZero(out this); + return; + } while (readIndex >= 0) { @@ -1158,8 +1239,19 @@ public void ShiftLeft(uint shift) else { // We need an extra block for the partial shift + writeIndex++; - Debug.Assert(writeIndex < MaxBlockCount); + Debug.Assert(unchecked((uint)(length)) < MaxBlockCount); + + if (unchecked((uint)(length)) >= MaxBlockCount) + { + // We shouldn't reach here, and the above assert will help flag this + // during testing, but we'll ensure that we return a safe value of + // zero in the case we end up overflowing in any way. + + SetZero(out this); + return; + } // Set the length to hold the shifted blocks _length = writeIndex + 1; diff --git a/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs b/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs index 408c83cb050585..f722e028106556 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs @@ -242,6 +242,8 @@ namespace System internal static partial class Number { internal const int DecimalPrecision = 29; // Decimal.DecCalc also uses this value + internal const string PreviewFeatureMessage = "Generic Math is in preview."; + internal const string PreviewFeatureUrl = "https://aka.ms/dotnet-warnings/generic-math-preview"; // SinglePrecision and DoublePrecision represent the maximum number of digits required // to guarantee that any given Single or Double can roundtrip. Some numbers may require diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs index 3612e751aee285..7582a343438093 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/Assembly.cs @@ -292,10 +292,12 @@ public static Assembly LoadFile(string path) // Get the path where requesting assembly lives and check if it is in the list // of assemblies for which LoadFrom was invoked. - string requestorPath = Path.GetFullPath(requestingAssembly.Location); + string requestorPath = requestingAssembly.Location; if (string.IsNullOrEmpty(requestorPath)) return null; + requestorPath = Path.GetFullPath(requestorPath); + lock (s_loadFromAssemblyList) { // If the requestor assembly was not loaded using LoadFrom, exit. diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs index 18d033b5c4394d..3198e9fd458027 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs @@ -66,7 +66,7 @@ internal string ToString(bool typed) result.Append('['); int count = array.Count; result.Append(count.ToString()); - result.Append(']'); + result.Append("] { "); for (int i = 0; i < count; i++) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/NullabilityInfoContext.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/NullabilityInfoContext.cs index 203bafd4d66c72..e8807720537606 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/NullabilityInfoContext.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/NullabilityInfoContext.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; namespace System.Reflection { @@ -27,7 +28,7 @@ private enum NotAnnotatedStatus Internal = 0x2 // internal members not annotated } - private NullabilityState GetNullableContext(MemberInfo? memberInfo) + private NullabilityState? GetNullableContext(MemberInfo? memberInfo) { while (memberInfo != null) { @@ -51,7 +52,7 @@ private NullabilityState GetNullableContext(MemberInfo? memberInfo) memberInfo = memberInfo.DeclaringType; } - return NullabilityState.Unknown; + return null; } /// @@ -71,13 +72,11 @@ public NullabilityInfo Create(ParameterInfo parameterInfo) EnsureIsSupported(); - if (parameterInfo.Member is MethodInfo method && IsPrivateOrInternalMethodAndAnnotationDisabled(method)) - { - return new NullabilityInfo(parameterInfo.ParameterType, NullabilityState.Unknown, NullabilityState.Unknown, null, Array.Empty()); - } - IList attributes = parameterInfo.GetCustomAttributesData(); - NullabilityInfo nullability = GetNullabilityInfo(parameterInfo.Member, parameterInfo.ParameterType, attributes); + NullableAttributeStateParser parser = parameterInfo.Member is MethodBase method && IsPrivateOrInternalMethodAndAnnotationDisabled(method) + ? NullableAttributeStateParser.Unknown + : CreateParser(attributes); + NullabilityInfo nullability = GetNullabilityInfo(parameterInfo.Member, parameterInfo.ParameterType, parser); if (nullability.ReadState != NullabilityState.Unknown) { @@ -114,7 +113,7 @@ private void CheckParameterMetadataType(ParameterInfo parameter, NullabilityInfo if (metaParameter != null) { - CheckGenericParameters(nullability, metaMethod, metaParameter.ParameterType); + CheckGenericParameters(nullability, metaMethod, metaParameter.ParameterType, parameter.Member.ReflectedType); } } } @@ -131,40 +130,45 @@ private static MethodInfo GetMethodMetadataDefinition(MethodInfo method) private void CheckNullabilityAttributes(NullabilityInfo nullability, IList attributes) { + var codeAnalysisReadState = NullabilityState.Unknown; + var codeAnalysisWriteState = NullabilityState.Unknown; + foreach (CustomAttributeData attribute in attributes) { if (attribute.AttributeType.Namespace == "System.Diagnostics.CodeAnalysis") { - if (attribute.AttributeType.Name == "NotNullAttribute" && - nullability.ReadState == NullabilityState.Nullable) + if (attribute.AttributeType.Name == "NotNullAttribute") { - nullability.ReadState = NullabilityState.NotNull; - break; + codeAnalysisReadState = NullabilityState.NotNull; } else if ((attribute.AttributeType.Name == "MaybeNullAttribute" || attribute.AttributeType.Name == "MaybeNullWhenAttribute") && - nullability.ReadState == NullabilityState.NotNull && + codeAnalysisReadState == NullabilityState.Unknown && !nullability.Type.IsValueType) { - nullability.ReadState = NullabilityState.Nullable; - break; + codeAnalysisReadState = NullabilityState.Nullable; } - - if (attribute.AttributeType.Name == "DisallowNullAttribute" && - nullability.WriteState == NullabilityState.Nullable) + else if (attribute.AttributeType.Name == "DisallowNullAttribute") { - nullability.WriteState = NullabilityState.NotNull; - break; + codeAnalysisWriteState = NullabilityState.NotNull; } else if (attribute.AttributeType.Name == "AllowNullAttribute" && - nullability.WriteState == NullabilityState.NotNull && + codeAnalysisWriteState == NullabilityState.Unknown && !nullability.Type.IsValueType) { - nullability.WriteState = NullabilityState.Nullable; - break; + codeAnalysisWriteState = NullabilityState.Nullable; } } } + + if (codeAnalysisReadState != NullabilityState.Unknown) + { + nullability.ReadState = codeAnalysisReadState; + } + if (codeAnalysisWriteState != NullabilityState.Unknown) + { + nullability.WriteState = codeAnalysisWriteState; + } } /// @@ -184,17 +188,15 @@ public NullabilityInfo Create(PropertyInfo propertyInfo) EnsureIsSupported(); - NullabilityInfo nullability = GetNullabilityInfo(propertyInfo, propertyInfo.PropertyType, propertyInfo.GetCustomAttributesData()); MethodInfo? getter = propertyInfo.GetGetMethod(true); MethodInfo? setter = propertyInfo.GetSetMethod(true); + bool annotationsDisabled = (getter == null || IsPrivateOrInternalMethodAndAnnotationDisabled(getter)) + && (setter == null || IsPrivateOrInternalMethodAndAnnotationDisabled(setter)); + NullableAttributeStateParser parser = annotationsDisabled ? NullableAttributeStateParser.Unknown : CreateParser(propertyInfo.GetCustomAttributesData()); + NullabilityInfo nullability = GetNullabilityInfo(propertyInfo, propertyInfo.PropertyType, parser); if (getter != null) { - if (IsPrivateOrInternalMethodAndAnnotationDisabled(getter)) - { - nullability.ReadState = NullabilityState.Unknown; - } - CheckNullabilityAttributes(nullability, getter.ReturnParameter.GetCustomAttributesData()); } else @@ -204,12 +206,7 @@ public NullabilityInfo Create(PropertyInfo propertyInfo) if (setter != null) { - if (IsPrivateOrInternalMethodAndAnnotationDisabled(setter)) - { - nullability.WriteState = NullabilityState.Unknown; - } - - CheckNullabilityAttributes(nullability, setter.GetParameters()[0].GetCustomAttributesData()); + CheckNullabilityAttributes(nullability, setter.GetParameters()[^1].GetCustomAttributesData()); } else { @@ -219,7 +216,7 @@ public NullabilityInfo Create(PropertyInfo propertyInfo) return nullability; } - private bool IsPrivateOrInternalMethodAndAnnotationDisabled(MethodInfo method) + private bool IsPrivateOrInternalMethodAndAnnotationDisabled(MethodBase method) { if ((method.IsPrivate || method.IsFamilyAndAssembly || method.IsAssembly) && IsPublicOnly(method.IsPrivate, method.IsFamilyAndAssembly, method.IsAssembly, method.Module)) @@ -247,7 +244,7 @@ public NullabilityInfo Create(EventInfo eventInfo) EnsureIsSupported(); - return GetNullabilityInfo(eventInfo, eventInfo.EventHandlerType!, eventInfo.GetCustomAttributesData()); + return GetNullabilityInfo(eventInfo, eventInfo.EventHandlerType!, CreateParser(eventInfo.GetCustomAttributesData())); } /// @@ -267,13 +264,9 @@ public NullabilityInfo Create(FieldInfo fieldInfo) EnsureIsSupported(); - if (IsPrivateOrInternalFieldAndAnnotationDisabled(fieldInfo)) - { - return new NullabilityInfo(fieldInfo.FieldType, NullabilityState.Unknown, NullabilityState.Unknown, null, Array.Empty()); - } - IList attributes = fieldInfo.GetCustomAttributesData(); - NullabilityInfo nullability = GetNullabilityInfo(fieldInfo, fieldInfo.FieldType, attributes); + NullableAttributeStateParser parser = IsPrivateOrInternalFieldAndAnnotationDisabled(fieldInfo) ? NullableAttributeStateParser.Unknown : CreateParser(attributes); + NullabilityInfo nullability = GetNullabilityInfo(fieldInfo, fieldInfo.FieldType, parser); CheckNullabilityAttributes(nullability, attributes); return nullability; } @@ -341,62 +334,74 @@ private NotAnnotatedStatus PopulateAnnotationInfo(IList cus return NotAnnotatedStatus.None; } - private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, IList customAttributes) => - GetNullabilityInfo(memberInfo, type, customAttributes, 0); + private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser) + { + int index = 0; + NullabilityInfo nullability = GetNullabilityInfo(memberInfo, type, parser, ref index); + + if (!type.IsValueType && nullability.ReadState != NullabilityState.Unknown) + { + TryLoadGenericMetaTypeNullability(memberInfo, nullability); + } - private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, IList customAttributes, int index) + return nullability; + } + + private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser, ref int index) { NullabilityState state = NullabilityState.Unknown; + NullabilityInfo? elementState = null; + NullabilityInfo[] genericArgumentsState = Array.Empty(); + Type? underlyingType = type; if (type.IsValueType) { - if (Nullable.GetUnderlyingType(type) != null) + underlyingType = Nullable.GetUnderlyingType(type); + + if (underlyingType != null) { state = NullabilityState.Nullable; } else { + underlyingType = type; state = NullabilityState.NotNull; } - return new NullabilityInfo(type, state, state, null, Array.Empty()); + if (underlyingType.IsGenericType) + { + ++index; + } } else { - if (!ParseNullableState(customAttributes, index, ref state)) + if (!parser.ParseNullableState(index++, ref state) + && GetNullableContext(memberInfo) is { } contextState) { - state = GetNullableContext(memberInfo); + state = contextState; } - NullabilityInfo? elementState = null; - NullabilityInfo[]? genericArgumentsState = null; - if (type.IsArray) { - elementState = GetNullabilityInfo(memberInfo, type.GetElementType()!, customAttributes, index + 1); + elementState = GetNullabilityInfo(memberInfo, type.GetElementType()!, parser, ref index); } - else if (type.IsGenericType) - { - Type[] genericArguments = type.GetGenericArguments(); - genericArgumentsState = new NullabilityInfo[genericArguments.Length]; + } - for (int i = 0; i < genericArguments.Length; i++) - { - genericArgumentsState[i] = GetNullabilityInfo(memberInfo, genericArguments[i], customAttributes, i + 1); - } - } + if (underlyingType.IsGenericType) + { + Type[] genericArguments = underlyingType.GetGenericArguments(); + genericArgumentsState = new NullabilityInfo[genericArguments.Length]; - NullabilityInfo nullability = new NullabilityInfo(type, state, state, elementState, genericArgumentsState ?? Array.Empty()); - if (state != NullabilityState.Unknown) + for (int i = 0; i < genericArguments.Length; i++) { - TryLoadGenericMetaTypeNullability(memberInfo, nullability); + genericArgumentsState[i] = GetNullabilityInfo(memberInfo, genericArguments[i], parser, ref index); } - - return nullability; } + + return new NullabilityInfo(type, state, state, elementState, genericArgumentsState); } - private static bool ParseNullableState(IList customAttributes, int index, ref NullabilityState state) + private static NullableAttributeStateParser CreateParser(IList customAttributes) { foreach (CustomAttributeData attribute in customAttributes) { @@ -404,26 +409,11 @@ private static bool ParseNullableState(IList customAttribut attribute.AttributeType.Namespace == CompilerServicesNameSpace && attribute.ConstructorArguments.Count == 1) { - object? o = attribute.ConstructorArguments[0].Value; - - if (o is byte b) - { - state = TranslateByte(b); - return true; - } - else if (o is ReadOnlyCollection args && - index < args.Count && - args[index].Value is byte elementB) - { - state = TranslateByte(elementB); - return true; - } - - break; + return new(attribute.ConstructorArguments[0].Value); } } - return false; + return new(null); } private void TryLoadGenericMetaTypeNullability(MemberInfo memberInfo, NullabilityInfo nullability) @@ -441,7 +431,7 @@ private void TryLoadGenericMetaTypeNullability(MemberInfo memberInfo, Nullabilit if (metaType != null) { - CheckGenericParameters(nullability, metaMember!, metaType); + CheckGenericParameters(nullability, metaMember!, metaType, memberInfo.ReflectedType); } } @@ -466,19 +456,14 @@ private static Type GetPropertyMetaType(PropertyInfo property) return property.GetSetMethod(true)!.GetParameters()[0].ParameterType; } - private void CheckGenericParameters(NullabilityInfo nullability, MemberInfo metaMember, Type metaType) + private void CheckGenericParameters(NullabilityInfo nullability, MemberInfo metaMember, Type metaType, Type? reflectedType) { if (metaType.IsGenericParameter) { - NullabilityState state = nullability.ReadState; - - if (!ParseNullableState(metaType.GetCustomAttributesData(), 0, ref state)) + if (nullability.ReadState == NullabilityState.NotNull) { - state = GetNullableContext(metaType); + TryUpdateGenericParameterNullability(nullability, metaType, reflectedType); } - - nullability.ReadState = state; - nullability.WriteState = state; } else if (metaType.ContainsGenericParameters) { @@ -488,35 +473,136 @@ private void CheckGenericParameters(NullabilityInfo nullability, MemberInfo meta for (int i = 0; i < genericArguments.Length; i++) { - if (genericArguments[i].IsGenericParameter) - { - NullabilityInfo n = GetNullabilityInfo(metaMember, genericArguments[i], genericArguments[i].GetCustomAttributesData(), i + 1); - nullability.GenericTypeArguments[i].ReadState = n.ReadState; - nullability.GenericTypeArguments[i].WriteState = n.WriteState; - } - else - { - UpdateGenericArrayElements(nullability.GenericTypeArguments[i].ElementType, metaMember, genericArguments[i]); - } + CheckGenericParameters(nullability.GenericTypeArguments[i], metaMember, genericArguments[i], reflectedType); } } - else + else if (nullability.ElementType is { } elementNullability && metaType.IsArray) + { + CheckGenericParameters(elementNullability, metaMember, metaType.GetElementType()!, reflectedType); + } + } + } + + private bool TryUpdateGenericParameterNullability(NullabilityInfo nullability, Type genericParameter, Type? reflectedType) + { + Debug.Assert(genericParameter.IsGenericParameter); + + if (reflectedType is not null + && !genericParameter.IsGenericMethodParameter + && TryUpdateGenericTypeParameterNullabilityFromReflectedType(nullability, genericParameter, reflectedType, reflectedType)) + { + return true; + } + + var state = NullabilityState.Unknown; + if (CreateParser(genericParameter.GetCustomAttributesData()).ParseNullableState(0, ref state)) + { + nullability.ReadState = state; + nullability.WriteState = state; + return true; + } + + if (GetNullableContext(genericParameter) is { } contextState) + { + nullability.ReadState = contextState; + nullability.WriteState = contextState; + return true; + } + + return false; + } + + private bool TryUpdateGenericTypeParameterNullabilityFromReflectedType(NullabilityInfo nullability, Type genericParameter, Type context, Type reflectedType) + { + Debug.Assert(genericParameter.IsGenericParameter && !genericParameter.IsGenericMethodParameter); + + Type contextTypeDefinition = context.IsGenericType && !context.IsGenericTypeDefinition ? context.GetGenericTypeDefinition() : context; + if (genericParameter.DeclaringType == contextTypeDefinition) + { + return false; + } + + Type? baseType = contextTypeDefinition.BaseType; + if (baseType is null) + { + return false; + } + + if (!baseType.IsGenericType + || (baseType.IsGenericTypeDefinition ? baseType : baseType.GetGenericTypeDefinition()) != genericParameter.DeclaringType) + { + return TryUpdateGenericTypeParameterNullabilityFromReflectedType(nullability, genericParameter, baseType, reflectedType); + } + + Type[] genericArguments = baseType.GetGenericArguments(); + Type genericArgument = genericArguments[genericParameter.GenericParameterPosition]; + if (genericArgument.IsGenericParameter) + { + return TryUpdateGenericParameterNullability(nullability, genericArgument, reflectedType); + } + + NullableAttributeStateParser parser = CreateParser(contextTypeDefinition.GetCustomAttributesData()); + int nullabilityStateIndex = 1; // start at 1 since index 0 is the type itself + for (int i = 0; i < genericParameter.GenericParameterPosition; i++) + { + nullabilityStateIndex += CountNullabilityStates(genericArguments[i]); + } + return TryPopulateNullabilityInfo(nullability, parser, ref nullabilityStateIndex); + + static int CountNullabilityStates(Type type) + { + Type underlyingType = Nullable.GetUnderlyingType(type) ?? type; + if (underlyingType.IsGenericType) { - UpdateGenericArrayElements(nullability.ElementType, metaMember, metaType); + int count = 1; + foreach (Type genericArgument in underlyingType.GetGenericArguments()) + { + count += CountNullabilityStates(genericArgument); + } + return count; } + if (underlyingType.IsArray) + { + return 1 + CountNullabilityStates(underlyingType.GetElementType()!); + } + + return type.IsValueType ? 0 : 1; } } - private void UpdateGenericArrayElements(NullabilityInfo? elementState, MemberInfo metaMember, Type metaType) + private bool TryPopulateNullabilityInfo(NullabilityInfo nullability, NullableAttributeStateParser parser, ref int index) { - if (metaType.IsArray && elementState != null - && metaType.GetElementType()!.IsGenericParameter) + bool isValueType = nullability.Type.IsValueType; + if (!isValueType) + { + var state = NullabilityState.Unknown; + if (!parser.ParseNullableState(index, ref state)) + { + return false; + } + + nullability.ReadState = state; + nullability.WriteState = state; + } + + if (!isValueType || (Nullable.GetUnderlyingType(nullability.Type) ?? nullability.Type).IsGenericType) + { + index++; + } + + if (nullability.GenericTypeArguments.Length > 0) + { + foreach (NullabilityInfo genericTypeArgumentNullability in nullability.GenericTypeArguments) + { + TryPopulateNullabilityInfo(genericTypeArgumentNullability, parser, ref index); + } + } + else if (nullability.ElementType is { } elementTypeNullability) { - Type elementType = metaType.GetElementType()!; - NullabilityInfo n = GetNullabilityInfo(metaMember, elementType, elementType.GetCustomAttributesData(), 0); - elementState.ReadState = n.ReadState; - elementState.WriteState = n.WriteState; + TryPopulateNullabilityInfo(elementTypeNullability, parser, ref index); } + + return true; } private static NullabilityState TranslateByte(object? value) @@ -531,5 +617,35 @@ private static NullabilityState TranslateByte(byte b) => 2 => NullabilityState.Nullable, _ => NullabilityState.Unknown }; + + private readonly struct NullableAttributeStateParser + { + private static readonly object UnknownByte = (byte)0; + + private readonly object? _nullableAttributeArgument; + + public NullableAttributeStateParser(object? nullableAttributeArgument) + { + this._nullableAttributeArgument = nullableAttributeArgument; + } + + public static NullableAttributeStateParser Unknown => new(UnknownByte); + + public bool ParseNullableState(int index, ref NullabilityState state) + { + switch (this._nullableAttributeArgument) + { + case byte b: + state = TranslateByte(b); + return true; + case ReadOnlyCollection args + when index < args.Count && args[index].Value is byte elementB: + state = TranslateByte(elementB); + return true; + default: + return false; + } + } + } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceReader.cs b/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceReader.cs index 16e2b161fc0dbf..e47dd90ade8bcc 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceReader.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceReader.cs @@ -9,6 +9,7 @@ using System.IO; using System.Runtime.CompilerServices; using System.Text; +using System.Threading; namespace System.Resources #if RESOURCES_EXTENSIONS @@ -58,10 +59,11 @@ public sealed partial class // it make sense to use anything less than one page? private const int DefaultFileStreamBufferSize = 4096; - private BinaryReader _store; // backing store we're reading from. - // Used by RuntimeResourceSet and this class's enumerator. Maps - // resource name to a value, a ResourceLocator, or a - // LooselyLinkedManifestResource. + // Backing store we're reading from. Usages outside of constructor + // initialization must be protected by lock (this). + private BinaryReader _store; + // Used by RuntimeResourceSet and this class's enumerator. + // Accesses must be protected by lock(_resCache). internal Dictionary? _resCache; private long _nameSectionOffset; // Offset to name section of file. private long _dataSectionOffset; // Offset to Data section of file. @@ -86,7 +88,6 @@ public sealed partial class // Version number of .resources file, for compatibility private int _version; - public #if RESOURCES_EXTENSIONS DeserializingResourceReader(string fileName) @@ -163,13 +164,16 @@ private unsafe void Dispose(bool disposing) } } - internal static unsafe int ReadUnalignedI4(int* p) + private static unsafe int ReadUnalignedI4(int* p) { return BinaryPrimitives.ReadInt32LittleEndian(new ReadOnlySpan(p, sizeof(int))); } private void SkipString() { + // Note: this method assumes that it is called either during object + // construction or within another method that locks on this. + int stringLength = _store.Read7BitEncodedInt(); if (stringLength < 0) { @@ -228,6 +232,7 @@ public IDictionaryEnumerator GetEnumerator() return new ResourceEnumerator(this); } + // Called from RuntimeResourceSet internal ResourceEnumerator GetEnumeratorInternal() { return new ResourceEnumerator(this); @@ -237,6 +242,7 @@ internal ResourceEnumerator GetEnumeratorInternal() // To read the data, seek to _dataSectionOffset + dataPos, then // read the resource type & data. // This does a binary search through the names. + // Called from RuntimeResourceSet internal int FindPosForResource(string name) { Debug.Assert(_store != null, "ResourceReader is closed!"); @@ -321,6 +327,8 @@ internal int FindPosForResource(string name) private unsafe bool CompareStringEqualsName(string name) { Debug.Assert(_store != null, "ResourceReader is closed!"); + Debug.Assert(Monitor.IsEntered(this)); // uses _store + int byteLen = _store.Read7BitEncodedInt(); if (byteLen < 0) { @@ -453,68 +461,74 @@ private unsafe string AllocateStringForNameIndex(int index, out int dataOffset) } // This takes a virtual offset into the data section and reads a String - // from that location. - // Anyone who calls LoadObject should make sure they take a lock so - // no one can cause us to do a seek in here. + // from that location. Called from RuntimeResourceSet internal string? LoadString(int pos) { Debug.Assert(_store != null, "ResourceReader is closed!"); - _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); - string? s = null; - int typeIndex = _store.Read7BitEncodedInt(); - if (_version == 1) - { - if (typeIndex == -1) - return null; - if (FindType(typeIndex) != typeof(string)) - throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotString_Type, FindType(typeIndex).FullName)); - s = _store.ReadString(); - } - else + + lock (this) { - ResourceTypeCode typeCode = (ResourceTypeCode)typeIndex; - if (typeCode != ResourceTypeCode.String && typeCode != ResourceTypeCode.Null) + _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); + string? s = null; + int typeIndex = _store.Read7BitEncodedInt(); + if (_version == 1) { - string? typeString; - if (typeCode < ResourceTypeCode.StartOfUserTypes) - typeString = typeCode.ToString(); - else - typeString = FindType(typeCode - ResourceTypeCode.StartOfUserTypes).FullName; - throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotString_Type, typeString)); - } - if (typeCode == ResourceTypeCode.String) // ignore Null + if (typeIndex == -1) + return null; + if (FindType(typeIndex) != typeof(string)) + throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotString_Type, FindType(typeIndex).FullName)); s = _store.ReadString(); + } + else + { + ResourceTypeCode typeCode = (ResourceTypeCode)typeIndex; + if (typeCode != ResourceTypeCode.String && typeCode != ResourceTypeCode.Null) + { + string? typeString; + if (typeCode < ResourceTypeCode.StartOfUserTypes) + typeString = typeCode.ToString(); + else + typeString = FindType(typeCode - ResourceTypeCode.StartOfUserTypes).FullName; + throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotString_Type, typeString)); + } + if (typeCode == ResourceTypeCode.String) // ignore Null + s = _store.ReadString(); + } + return s; } - return s; } // Called from RuntimeResourceSet internal object? LoadObject(int pos) { - if (_version == 1) - return LoadObjectV1(pos); - return LoadObjectV2(pos, out _); + lock (this) + { + return _version == 1 ? LoadObjectV1(pos) : LoadObjectV2(pos, out _); + } } + // Called from RuntimeResourceSet internal object? LoadObject(int pos, out ResourceTypeCode typeCode) { - if (_version == 1) + lock (this) { - object? o = LoadObjectV1(pos); - typeCode = (o is string) ? ResourceTypeCode.String : ResourceTypeCode.StartOfUserTypes; - return o; + if (_version == 1) + { + object? o = LoadObjectV1(pos); + typeCode = (o is string) ? ResourceTypeCode.String : ResourceTypeCode.StartOfUserTypes; + return o; + } + return LoadObjectV2(pos, out typeCode); } - return LoadObjectV2(pos, out typeCode); } // This takes a virtual offset into the data section and reads an Object // from that location. - // Anyone who calls LoadObject should make sure they take a lock so - // no one can cause us to do a seek in here. - internal object? LoadObjectV1(int pos) + private object? LoadObjectV1(int pos) { Debug.Assert(_store != null, "ResourceReader is closed!"); Debug.Assert(_version == 1, ".resources file was not a V1 .resources file!"); + Debug.Assert(Monitor.IsEntered(this)); // uses _store try { @@ -534,6 +548,8 @@ private unsafe string AllocateStringForNameIndex(int index, out int dataOffset) private object? _LoadObjectV1(int pos) { + Debug.Assert(Monitor.IsEntered(this)); // uses _store + _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); int typeIndex = _store.Read7BitEncodedInt(); if (typeIndex == -1) @@ -586,10 +602,11 @@ private unsafe string AllocateStringForNameIndex(int index, out int dataOffset) } } - internal object? LoadObjectV2(int pos, out ResourceTypeCode typeCode) + private object? LoadObjectV2(int pos, out ResourceTypeCode typeCode) { Debug.Assert(_store != null, "ResourceReader is closed!"); Debug.Assert(_version >= 2, ".resources file was not a V2 (or higher) .resources file!"); + Debug.Assert(Monitor.IsEntered(this)); // uses _store try { @@ -609,6 +626,8 @@ private unsafe string AllocateStringForNameIndex(int index, out int dataOffset) private object? _LoadObjectV2(int pos, out ResourceTypeCode typeCode) { + Debug.Assert(Monitor.IsEntered(this)); // uses _store + _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); typeCode = (ResourceTypeCode)_store.Read7BitEncodedInt(); @@ -745,6 +764,7 @@ private unsafe string AllocateStringForNameIndex(int index, out int dataOffset) [MemberNotNull(nameof(_typeNamePositions))] private void ReadResources() { + Debug.Assert(!Monitor.IsEntered(this)); // only called during init Debug.Assert(_store != null, "ResourceReader is closed!"); try @@ -767,6 +787,8 @@ private void ReadResources() [MemberNotNull(nameof(_typeNamePositions))] private void _ReadResources() { + Debug.Assert(!Monitor.IsEntered(this)); // only called during init + // Read ResourceManager header // Check for magic number int magicNum = _store.ReadInt32(); @@ -952,6 +974,8 @@ private Type FindType(int typeIndex) "Custom readers as well as custom objects on the resources file are not observable by the trimmer and so required assemblies, types and members may be removed.")] private Type UseReflectionToGetType(int typeIndex) { + Debug.Assert(Monitor.IsEntered(this)); // uses _store + long oldPos = _store.BaseStream.Position; try { @@ -984,6 +1008,8 @@ private Type UseReflectionToGetType(int typeIndex) private string TypeNameFromTypeCode(ResourceTypeCode typeCode) { Debug.Assert(typeCode >= 0, "can't be negative"); + Debug.Assert(Monitor.IsEntered(this)); // uses _store + if (typeCode < ResourceTypeCode.StartOfUserTypes) { Debug.Assert(!string.Equals(typeCode.ToString(), "LastPrimitive"), "Change ResourceTypeCode metadata order so LastPrimitive isn't what Enum.ToString prefers."); @@ -1061,31 +1087,31 @@ public DictionaryEntry Entry if (!_currentIsValid) throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); if (_reader._resCache == null) throw new InvalidOperationException(SR.ResourceReaderIsClosed); - string key; + string key = _reader.AllocateStringForNameIndex(_currentName, out _dataPosition); // AllocateStringForNameIndex could lock on _reader + object? value = null; - lock (_reader) - { // locks should be taken in the same order as in RuntimeResourceSet.GetObject to avoid deadlock - lock (_reader._resCache) + // Lock the cache first, then the reader (in this case, we don't actually need to lock the reader and cache at the same time). + // Lock order MUST match RuntimeResourceSet.GetObject to avoid deadlock. + Debug.Assert(!Monitor.IsEntered(_reader)); + lock (_reader._resCache) + { + if (_reader._resCache.TryGetValue(key, out ResourceLocator locator)) { - key = _reader.AllocateStringForNameIndex(_currentName, out _dataPosition); // AllocateStringForNameIndex could lock on _reader - if (_reader._resCache.TryGetValue(key, out ResourceLocator locator)) - { - value = locator.Value; - } - if (value == null) - { - if (_dataPosition == -1) - value = _reader.GetValueForNameIndex(_currentName); - else - value = _reader.LoadObject(_dataPosition); - // If enumeration and subsequent lookups happen very - // frequently in the same process, add a ResourceLocator - // to _resCache here. But WinForms enumerates and - // just about everyone else does lookups. So caching - // here may bloat working set. - } + value = locator.Value; } } + if (value is null) + { + if (_dataPosition == -1) + value = _reader.GetValueForNameIndex(_currentName); + else + value = _reader.LoadObject(_dataPosition); + // If enumeration and subsequent lookups happen very + // frequently in the same process, add a ResourceLocator + // to _resCache here (we'll also need to extend the lock block!). + // But WinForms enumerates and just about everyone else does lookups. + // So caching here may bloat working set. + } return new DictionaryEntry(key, value); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs b/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs index 90c55d9f304067..246686f506f9b9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Threading; namespace System.Resources #if RESOURCES_EXTENSIONS @@ -276,6 +277,9 @@ private IDictionaryEnumerator GetEnumeratorHelper() object? value; ResourceLocator resEntry; + // Lock the cache first, then the reader (reader locks implicitly through its methods). + // Lock order MUST match ResourceReader.ResourceEnumerator.Entry to avoid deadlock. + Debug.Assert(!Monitor.IsEntered(reader)); lock (cache) { // Find the offset within the data section @@ -288,7 +292,7 @@ private IDictionaryEnumerator GetEnumeratorHelper() // When data type cannot be cached dataPos = resEntry.DataPosition; - return isString ? reader.LoadString(dataPos) : reader.LoadObject(dataPos, out _); + return isString ? reader.LoadString(dataPos) : reader.LoadObject(dataPos); } dataPos = reader.FindPosForResource(key); @@ -346,14 +350,11 @@ private IDictionaryEnumerator GetEnumeratorHelper() return value; } - private static object? ReadValue (ResourceReader reader, int dataPos, bool isString, out ResourceLocator locator) + private static object? ReadValue(ResourceReader reader, int dataPos, bool isString, out ResourceLocator locator) { object? value; ResourceTypeCode typeCode; - // Normally calling LoadString or LoadObject requires - // taking a lock. Note that in this case, we took a - // lock before calling this method. if (isString) { value = reader.LoadString(dataPos); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs index 2630e0f2c1b7b0..a3820ba6d69b9e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.cs @@ -30,7 +30,7 @@ public static partial class RuntimeFeature /// /// Indicates that this version of runtime supports virtual static members of interfaces. /// - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] public const string VirtualStaticsInInterfaces = nameof(VirtualStaticsInInterfaces); /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/SkipLocalsInitAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/SkipLocalsInitAttribute.cs index e1f88f2af98512..17b15436642892 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/SkipLocalsInitAttribute.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/SkipLocalsInitAttribute.cs @@ -25,7 +25,12 @@ namespace System.Runtime.CompilerServices | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event, Inherited = false)] - public sealed class SkipLocalsInitAttribute : Attribute +#if SYSTEM_PRIVATE_CORELIB + public +#else + internal +#endif + sealed class SkipLocalsInitAttribute : Attribute { public SkipLocalsInitAttribute() { diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/FirstChanceExceptionEventArgs.cs similarity index 100% rename from src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs rename to src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/FirstChanceExceptionEventArgs.cs diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NFloat.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NFloat.cs index e3cb842f2a5294..62d9a8d30e1a33 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NFloat.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/NFloat.cs @@ -2,7 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; +using System.Globalization; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; +using Internal.Runtime.CompilerServices; #pragma warning disable SA1121 // We use our own aliases since they differ per platform #if TARGET_32BIT @@ -13,65 +17,691 @@ namespace System.Runtime.InteropServices { - /// - /// is an immutable value type that represents a floating type that has the same size - /// as the native integer size. - /// It is meant to be used as an exchange type at the managed/unmanaged boundary to accurately represent - /// in managed code unmanaged APIs that use a type alias for C or C++'s float on 32-bit platforms - /// or double on 64-bit platforms, such as the CGFloat type in libraries provided by Apple. - /// + /// Defines an immutable value type that represents a floating type that has the same size as the native integer size. + /// It is meant to be used as an exchange type at the managed/unmanaged boundary to accurately represent in managed code unmanaged APIs that use a type alias for C or C++'s float on 32-bit platforms or double on 64-bit platforms, such as the CGFloat type in libraries provided by Apple. [Intrinsic] - public readonly struct NFloat : IEquatable + public readonly struct NFloat + : IComparable, + IComparable, + IEquatable, + ISpanFormattable { + private const NumberStyles DefaultNumberStyles = NumberStyles.Float | NumberStyles.AllowThousands; + private readonly NativeType _value; - /// - /// Constructs an instance from a 32-bit floating point value. - /// - /// The floating-point vaule. + /// Constructs an instance from a 32-bit floating point value. + /// The floating-point value. + [NonVersionable] public NFloat(float value) { _value = value; } - /// - /// Constructs an instance from a 64-bit floating point value. - /// - /// The floating-point vaule. + /// Constructs an instance from a 64-bit floating point value. + /// The floating-point value. + [NonVersionable] public NFloat(double value) { _value = (NativeType)value; } - /// - /// The underlying floating-point value of this instance. - /// - public double Value => _value; + /// Represents the smallest positive NFloat value that is greater than zero. + public static NFloat Epsilon + { + [NonVersionable] + get => new NFloat(NativeType.Epsilon); + } + + /// Represents the largest finite value of a NFloat. + public static NFloat MaxValue + { + [NonVersionable] + get => new NFloat(NativeType.MaxValue); + } + + /// Represents the smallest finite value of a NFloat. + public static NFloat MinValue + { + [NonVersionable] + get => new NFloat(NativeType.MinValue); + } + + /// Represents a value that is not a number (NaN). + public static NFloat NaN + { + [NonVersionable] + get => new NFloat(NativeType.NaN); + } + + /// Represents negative infinity. + public static NFloat NegativeInfinity + { + [NonVersionable] + get => new NFloat(NativeType.NegativeInfinity); + } + + /// Represents positive infinity. + public static NFloat PositiveInfinity + { + [NonVersionable] + get => new NFloat(NativeType.PositiveInfinity); + } + + /// Gets the size, in bytes, of an NFloat. + public static int Size + { + [NonVersionable] + get => sizeof(NativeType); + } + + /// The underlying floating-point value of this instance. + public double Value + { + [NonVersionable] + get => _value; + } + + // + // Unary Arithmetic + // + + /// Computes the unary plus of a value. + /// The value for which to compute its unary plus. + /// The unary plus of . + [NonVersionable] + public static NFloat operator +(NFloat value) => value; + + /// Computes the unary negation of a value. + /// The value for which to compute its unary negation. + /// The unary negation of . + [NonVersionable] + public static NFloat operator -(NFloat value) => new NFloat(-value._value); + + /// Increments a value. + /// The value to increment. + /// The result of incrementing . + [NonVersionable] + public static NFloat operator ++(NFloat value) => new NFloat(value._value + 1); + + /// Decrements a value. + /// The value to decrement. + /// The result of decrementing . + [NonVersionable] + public static NFloat operator --(NFloat value) => new NFloat(value._value - 1); + + // + // Binary Arithmetic + // + + /// Adds two values together to compute their sum. + /// The value to which is added. + /// The value which is added to . + /// The sum of and . + [NonVersionable] + public static NFloat operator +(NFloat left, NFloat right) => new NFloat(left._value + right._value); + + /// Subtracts two values to compute their difference. + /// The value from which is subtracted. + /// The value which is subtracted from . + /// The difference of subtracted from . + [NonVersionable] + public static NFloat operator -(NFloat left, NFloat right) => new NFloat(left._value - right._value); + + /// Multiplies two values together to compute their product. + /// The value which multiplies. + /// The value which multiplies . + /// The product of divided-by . + [NonVersionable] + public static NFloat operator *(NFloat left, NFloat right) => new NFloat(left._value * right._value); + + /// Divides two values together to compute their quotient. + /// The value which divides. + /// The value which divides . + /// The quotient of divided-by . + [NonVersionable] + public static NFloat operator /(NFloat left, NFloat right) => new NFloat(left._value / right._value); + + /// Divides two values together to compute their remainder. + /// The value which divides. + /// The value which divides . + /// The remainder of divided-by . + [NonVersionable] + public static NFloat operator %(NFloat left, NFloat right) => new NFloat(left._value % right._value); + + // + // Comparisons + // + + /// Compares two values to determine equality. + /// The value to compare with . + /// The value to compare with . + /// true if is equal to ; otherwise, false. + [NonVersionable] + public static bool operator ==(NFloat left, NFloat right) => left._value == right._value; + + /// Compares two values to determine inequality. + /// The value to compare with . + /// The value to compare with . + /// true if is not equal to ; otherwise, false. + [NonVersionable] + public static bool operator !=(NFloat left, NFloat right) => left._value != right._value; + + /// Compares two values to determine which is less. + /// The value to compare with . + /// The value to compare with . + /// true if is less than ; otherwise, false. + [NonVersionable] + public static bool operator <(NFloat left, NFloat right) => left._value < right._value; + + /// Compares two values to determine which is less or equal. + /// The value to compare with . + /// The value to compare with . + /// true if is less than or equal to ; otherwise, false. + [NonVersionable] + public static bool operator <=(NFloat left, NFloat right) => left._value <= right._value; + + /// Compares two values to determine which is greater. + /// The value to compare with . + /// The value to compare with . + /// true if is greater than ; otherwise, false. + [NonVersionable] + public static bool operator >(NFloat left, NFloat right) => left._value > right._value; + + /// Compares two values to determine which is greater or equal. + /// The value to compare with . + /// The value to compare with . + /// true if is greater than or equal to ; otherwise, false. + [NonVersionable] + public static bool operator >=(NFloat left, NFloat right) => left._value >= right._value; + + // + // Explicit Convert To NFloat + // + + /// Explicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + public static explicit operator NFloat(decimal value) => new NFloat((NativeType)value); + + /// Explicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + public static explicit operator NFloat(double value) => new NFloat((NativeType)value); + + // + // Explicit Convert From NFloat + // + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + public static explicit operator byte(NFloat value) => (byte)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + public static explicit operator char(NFloat value) => (char)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + public static explicit operator decimal(NFloat value) => (decimal)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + public static explicit operator short(NFloat value) => (short)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + public static explicit operator int(NFloat value) => (int)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + public static explicit operator long(NFloat value) => (long)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + public static explicit operator nint(NFloat value) => (nint)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator sbyte(NFloat value) => (sbyte)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + public static explicit operator float(NFloat value) => (float)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator ushort(NFloat value) => (ushort)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator uint(NFloat value) => (uint)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator ulong(NFloat value) => (ulong)(value._value); + + /// Explicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + [NonVersionable] + [CLSCompliant(false)] + public static explicit operator nuint(NFloat value) => (nuint)(value._value); + + // + // Implicit Convert To NFloat + // - /// - /// Returns a value indicating whether this instance is equal to a specified object. - /// - /// An object to compare with this instance. - /// true if is an instance of and equals the value of this instance; otherwise, false. - public override bool Equals([NotNullWhen(true)] object? o) => o is NFloat other && Equals(other); + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + public static implicit operator NFloat(byte value) => new NFloat((NativeType)value); - /// - /// Returns a value indicating whether this instance is equal to a specified value. - /// + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + public static implicit operator NFloat(char value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + public static implicit operator NFloat(short value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + public static implicit operator NFloat(int value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + public static implicit operator NFloat(long value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + public static implicit operator NFloat(nint value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(sbyte value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + public static implicit operator NFloat(float value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(ushort value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(uint value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(ulong value) => new NFloat((NativeType)value); + + /// Implicitly converts a value to its nearest representable native-sized floating-point value. + /// The value to convert. + /// converted to its nearest representable native-sized floating-point value. + [NonVersionable] + [CLSCompliant(false)] + public static implicit operator NFloat(nuint value) => new NFloat((NativeType)value); + + // + // Implicit Convert From NFloat + // + + /// Implicitly converts a native-sized floating-point value to its nearest representable value. + /// The value to convert. + /// converted to its nearest representable value. + public static implicit operator double(NFloat value) => (double)(value._value); + + /// Determines whether the specified value is finite (zero, subnormal, or normal). + /// The floating-point value. + /// true if the value is finite (zero, subnormal or normal); false otherwise. + [NonVersionable] + public static bool IsFinite(NFloat value) => NativeType.IsFinite(value._value); + + /// Determines whether the specified value is infinite (positive or negative infinity). + /// The floating-point value. + /// true if the value is infinite (positive or negative infinity); false otherwise. + [NonVersionable] + public static bool IsInfinity(NFloat value) => NativeType.IsInfinity(value._value); + + /// Determines whether the specified value is NaN (not a number). + /// The floating-point value. + /// true if the value is NaN (not a number); false otherwise. + [NonVersionable] + public static bool IsNaN(NFloat value) => NativeType.IsNaN(value._value); + + /// Determines whether the specified value is negative. + /// The floating-point value. + /// true if the value is negative; false otherwise. + [NonVersionable] + public static bool IsNegative(NFloat value) => NativeType.IsNegative(value._value); + + /// Determines whether the specified value is negative infinity. + /// The floating-point value. + /// true if the value is negative infinity; false otherwise. + [NonVersionable] + public static bool IsNegativeInfinity(NFloat value) => NativeType.IsNegativeInfinity(value._value); + + /// Determines whether the specified value is normal. + /// The floating-point value. + /// true if the value is normal; false otherwise. + [NonVersionable] + public static bool IsNormal(NFloat value) => NativeType.IsNormal(value._value); + + /// Determines whether the specified value is positive infinity. + /// The floating-point value. + /// true if the value is positive infinity; false otherwise. + [NonVersionable] + public static bool IsPositiveInfinity(NFloat value) => NativeType.IsPositiveInfinity(value._value); + + /// Determines whether the specified value is subnormal. + /// The floating-point value. + /// true if the value is subnormal; false otherwise. + [NonVersionable] + public static bool IsSubnormal(NFloat value) => NativeType.IsSubnormal(value._value); + + /// Converts the string representation of a number to its floating-point number equivalent. + /// A string that contains the number to convert. + /// A floating-point number that is equivalent to the numeric value or symbol specified in . + /// is null. + /// does not represent a number in a valid format. + public static NFloat Parse(string s) + { + var result = NativeType.Parse(s); + return new NFloat(result); + } + + /// Converts the string representation of a number in a specified style to its floating-point number equivalent. + /// A string that contains the number to convert. + /// A bitwise combination of enumeration values that indicate the style elements that can be present in . + /// A floating-point number that is equivalent to the numeric value or symbol specified in . + /// + /// is not a value. + /// -or- + /// includes the value. + /// + /// is null. + /// does not represent a number in a valid format. + public static NFloat Parse(string s, NumberStyles style) + { + var result = NativeType.Parse(s, style); + return new NFloat(result); + } + + /// Converts the string representation of a number in a specified culture-specific format to its floating-point number equivalent. + /// A string that contains the number to convert. + /// An object that supplies culture-specific formatting information about . + /// A floating-point number that is equivalent to the numeric value or symbol specified in . + /// is null. + /// does not represent a number in a valid format. + public static NFloat Parse(string s, IFormatProvider? provider) + { + var result = NativeType.Parse(s, provider); + return new NFloat(result); + } + + /// Converts the string representation of a number in a specified style and culture-specific format to its floating-point number equivalent. + /// A string that contains the number to convert. + /// A bitwise combination of enumeration values that indicate the style elements that can be present in . + /// An object that supplies culture-specific formatting information about . + /// A floating-point number that is equivalent to the numeric value or symbol specified in . + /// + /// is not a value. + /// -or- + /// includes the value. + /// + /// is null. + /// does not represent a number in a valid format. + public static NFloat Parse(string s, NumberStyles style, IFormatProvider? provider) + { + var result = NativeType.Parse(s, style, provider); + return new NFloat(result); + } + + /// Converts a character span that contains the string representation of a number in a specified style and culture-specific format to its floating-point number equivalent. + /// A character span that contains the number to convert. + /// A bitwise combination of enumeration values that indicate the style elements that can be present in . + /// An object that supplies culture-specific formatting information about . + /// A floating-point number that is equivalent to the numeric value or symbol specified in . + /// + /// is not a value. + /// -or- + /// includes the value. + /// + /// does not represent a number in a valid format. + public static NFloat Parse(ReadOnlySpan s, NumberStyles style = DefaultNumberStyles, IFormatProvider? provider = null) + { + var result = NativeType.Parse(s, style, provider); + return new NFloat(result); + } + + /// Tries to convert the string representation of a number to its floating-point number equivalent. + /// A read-only character span that contains the number to convert. + /// When this method returns, contains a floating-point number equivalent of the numeric value or symbol contained in if the conversion succeeded or zero if the conversion failed. The conversion fails if the is null, , or is not in a valid format. This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// true if was converted successfully; otherwise, false. + public static bool TryParse([NotNullWhen(true)] string? s, out NFloat result) + { + Unsafe.SkipInit(out result); + return NativeType.TryParse(s, out Unsafe.As(ref result)); + } + + /// Tries to convert a character span containing the string representation of a number to its floating-point number equivalent. + /// A read-only character span that contains the number to convert. + /// When this method returns, contains a floating-point number equivalent of the numeric value or symbol contained in if the conversion succeeded or zero if the conversion failed. The conversion fails if the is or is not in a valid format. This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// true if was converted successfully; otherwise, false. + public static bool TryParse(ReadOnlySpan s, out NFloat result) + { + Unsafe.SkipInit(out result); + return NativeType.TryParse(s, out Unsafe.As(ref result)); + } + + /// Tries to convert the string representation of a number in a specified style and culture-specific format to its floating-point number equivalent. + /// A read-only character span that contains the number to convert. + /// A bitwise combination of enumeration values that indicate the style elements that can be present in . + /// An object that supplies culture-specific formatting information about . + /// When this method returns, contains a floating-point number equivalent of the numeric value or symbol contained in if the conversion succeeded or zero if the conversion failed. The conversion fails if the is null, , or is not in a format compliant with , or if is not a valid combination of enumeration constants. This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// true if was converted successfully; otherwise, false. + /// + /// is not a value. + /// -or- + /// includes the value. + /// + public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out NFloat result) + { + Unsafe.SkipInit(out result); + return NativeType.TryParse(s, style, provider, out Unsafe.As(ref result)); + } + + /// Tries to convert a character span containing the string representation of a number in a specified style and culture-specific format to its floating-point number equivalent. + /// A read-only character span that contains the number to convert. + /// A bitwise combination of enumeration values that indicate the style elements that can be present in . + /// An object that supplies culture-specific formatting information about . + /// When this method returns, contains a floating-point number equivalent of the numeric value or symbol contained in if the conversion succeeded or zero if the conversion failed. The conversion fails if the is or is not in a format compliant with , or if is not a valid combination of enumeration constants. This parameter is passed uninitialized; any value originally supplied in result will be overwritten. + /// true if was converted successfully; otherwise, false. + /// + /// is not a value. + /// -or- + /// includes the value. + /// + public static bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out NFloat result) + { + Unsafe.SkipInit(out result); + return NativeType.TryParse(s, style, provider, out Unsafe.As(ref result)); + } + + /// Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object. + /// An object to compare, or null. + /// + /// A signed number indicating the relative values of this instance and . + /// + /// + /// Return Value + /// Description + /// + /// + /// Less than zero + /// This instance is less than , or this instance is not a number and is a number. + /// + /// + /// Zero + /// This instance is equal to , or both this instance and are not a number. + /// + /// + /// Greater than zero + /// This instance is greater than , or this instance is a number and is not a number or is null. + /// + /// + /// + /// is not a . + public int CompareTo(object? obj) + { + if (obj is NFloat other) + { + if (_value < other._value) return -1; + if (_value > other._value) return 1; + if (_value == other._value) return 0; + + // At least one of the values is NaN. + if (NativeType.IsNaN(_value)) + { + return NativeType.IsNaN(other._value) ? 0 : -1; + } + else + { + return 1; + } + } + else if (obj is null) + { + return 1; + } + + throw new ArgumentException(SR.Arg_MustBeNFloat); + } + + /// Compares this instance to a specified floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified floating-point number. + /// A floating-point number to compare. + /// + /// A signed number indicating the relative values of this instance and . + /// + /// + /// Return Value + /// Description + /// + /// + /// Less than zero + /// This instance is less than , or this instance is not a number and is a number. + /// + /// + /// Zero + /// This instance is equal to , or both this instance and are not a number. + /// + /// + /// Greater than zero + /// This instance is greater than , or this instance is a number and is not a number. + /// + /// + /// + public int CompareTo(NFloat other) => _value.CompareTo(other._value); + + /// Returns a value indicating whether this instance is equal to a specified object. + /// An object to compare with this instance. + /// true if is an instance of and equals the value of this instance; otherwise, false. + public override bool Equals([NotNullWhen(true)] object? obj) => (obj is NFloat other) && Equals(other); + + /// Returns a value indicating whether this instance is equal to a specified value. /// An value to compare to this instance. /// true if has the same value as this instance; otherwise, false. public bool Equals(NFloat other) => _value.Equals(other._value); - /// - /// Returns the hash code for this instance. - /// + /// Returns the hash code for this instance. /// A 32-bit signed integer hash code. public override int GetHashCode() => _value.GetHashCode(); - /// - /// Converts the numeric value of this instance to its equivalent string representation. - /// + /// Converts the numeric value of this instance to its equivalent string representation. /// The string representation of the value of this instance. public override string ToString() => _value.ToString(); + + /// Converts the numeric value of this instance to its equivalent string representation using the specified format. + /// A numeric format string. + /// The string representation of the value of this instance as specified by . + /// is invalid. + public string ToString(string? format) => _value.ToString(format); + + /// Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information. + /// An object that supplies culture-specific formatting information. + /// The string representation of the value of this instance as specified by . + public string ToString(IFormatProvider? provider)=> _value.ToString(provider); + + /// Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information. + /// A numeric format string. + /// An object that supplies culture-specific formatting information. + /// The string representation of the value of this instance as specified by and . + /// is invalid. + public string ToString(string? format, IFormatProvider? provider) => _value.ToString(format, provider); + + /// Tries to format the value of the current instance into the provided span of characters. + /// The span in which to write this instance's value formatted as a span of characters. + /// When this method returns, contains the number of characters that were written in . + /// A span containing the characters that represent a standard or custom format string that defines the acceptable format for . + /// An optional object that supplies culture-specific formatting information for . + /// true if the formatting was successful; otherwise, false. + public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format = default, IFormatProvider? provider = null) => _value.TryFormat(destination, out charsWritten, format, provider); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/AvxVnni.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/AvxVnni.PlatformNotSupported.cs index 2edfd97a518ada..626ea6d189dee7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/AvxVnni.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/AvxVnni.PlatformNotSupported.cs @@ -7,7 +7,7 @@ namespace System.Runtime.Intrinsics.X86 { [CLSCompliant(false)] - [RequiresPreviewFeatures] + [RequiresPreviewFeatures("AvxVnni is in preview.")] public abstract class AvxVnni : Avx2 { internal AvxVnni() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/AvxVnni.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/AvxVnni.cs index d6bb750ebc89a6..fcefbeac02122f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/AvxVnni.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/X86/AvxVnni.cs @@ -8,7 +8,7 @@ namespace System.Runtime.Intrinsics.X86 { [Intrinsic] [CLSCompliant(false)] - [RequiresPreviewFeatures] + [RequiresPreviewFeatures("AvxVnni is in preview.")] public abstract class AvxVnni : Avx2 { internal AvxVnni() { } diff --git a/src/libraries/System.Private.CoreLib/src/System/SByte.cs b/src/libraries/System.Private.CoreLib/src/System/SByte.cs index ce811d0cffd933..66167365219748 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SByte.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SByte.cs @@ -297,11 +297,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IAdditionOperators.operator +(sbyte left, sbyte right) => (sbyte)(left + right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked sbyte IAdditionOperators.operator +(sbyte left, sbyte right) // => checked((sbyte)(left + right)); @@ -309,30 +309,30 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBinaryInteger.LeadingZeroCount(sbyte value) => (sbyte)(BitOperations.LeadingZeroCount((byte)value) - 24); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBinaryInteger.PopCount(sbyte value) => (sbyte)BitOperations.PopCount((byte)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBinaryInteger.RotateLeft(sbyte value, int rotateAmount) => (sbyte)((value << (rotateAmount & 7)) | ((byte)value >> ((8 - rotateAmount) & 7))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBinaryInteger.RotateRight(sbyte value, int rotateAmount) => (sbyte)(((byte)value >> (rotateAmount & 7)) | (value << ((8 - rotateAmount) & 7))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBinaryInteger.TrailingZeroCount(sbyte value) => (sbyte)(BitOperations.TrailingZeroCount(value << 24) - 24); @@ -340,11 +340,11 @@ static sbyte IBinaryInteger.TrailingZeroCount(sbyte value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(sbyte value) => BitOperations.IsPow2(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBinaryNumber.Log2(sbyte value) { if (value < 0) @@ -358,19 +358,19 @@ static sbyte IBinaryNumber.Log2(sbyte value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBitwiseOperators.operator &(sbyte left, sbyte right) => (sbyte)(left & right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBitwiseOperators.operator |(sbyte left, sbyte right) => (sbyte)(left | right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBitwiseOperators.operator ^(sbyte left, sbyte right) => (sbyte)(left ^ right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IBitwiseOperators.operator ~(sbyte value) => (sbyte)(~value); @@ -378,19 +378,19 @@ static sbyte IBinaryNumber.Log2(sbyte value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(sbyte left, sbyte right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(sbyte left, sbyte right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(sbyte left, sbyte right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(sbyte left, sbyte right) => left >= right; @@ -398,11 +398,11 @@ static sbyte IBinaryNumber.Log2(sbyte value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IDecrementOperators.operator --(sbyte value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked sbyte IDecrementOperators.operator --(sbyte value) // => checked(--value); @@ -410,11 +410,11 @@ static sbyte IBinaryNumber.Log2(sbyte value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IDivisionOperators.operator /(sbyte left, sbyte right) => (sbyte)(left / right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked sbyte IDivisionOperators.operator /(sbyte left, sbyte right) // => checked((sbyte)(left / right)); @@ -422,11 +422,11 @@ static sbyte IBinaryNumber.Log2(sbyte value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(sbyte left, sbyte right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(sbyte left, sbyte right) => left != right; @@ -434,11 +434,11 @@ static sbyte IBinaryNumber.Log2(sbyte value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IIncrementOperators.operator ++(sbyte value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked sbyte IIncrementOperators.operator ++(sbyte value) // => checked(++value); @@ -446,21 +446,21 @@ static sbyte IBinaryNumber.Log2(sbyte value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IModulusOperators.operator %(sbyte left, sbyte right) => (sbyte)(left % right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked sbyte IModulusOperators.operator %(sbyte left, sbyte right) // => checked((sbyte)(left % right)); @@ -468,18 +468,18 @@ static sbyte IBinaryNumber.Log2(sbyte value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IMultiplyOperators.operator *(sbyte left, sbyte right) => (sbyte)(left * right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked sbyte IMultiplyOperators.operator *(sbyte left, sbyte right) // => checked((sbyte)(left * right)); @@ -487,21 +487,21 @@ static sbyte IBinaryNumber.Log2(sbyte value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte INumber.Abs(sbyte value) => Math.Abs(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte INumber.Clamp(sbyte value, sbyte min, sbyte max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static sbyte INumber.Create(TOther value) { @@ -568,7 +568,7 @@ static sbyte INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static sbyte INumber.CreateSaturating(TOther value) { @@ -655,7 +655,7 @@ static sbyte INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static sbyte INumber.CreateTruncating(TOther value) { @@ -722,31 +722,31 @@ static sbyte INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (sbyte Quotient, sbyte Remainder) INumber.DivRem(sbyte left, sbyte right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte INumber.Max(sbyte x, sbyte y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte INumber.Min(sbyte x, sbyte y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte INumber.Sign(sbyte value) => (sbyte)Math.Sign(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out sbyte result) { @@ -932,11 +932,11 @@ static bool INumber.TryCreate(TOther value, out sbyte result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out sbyte result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out sbyte result) => TryParse(s, style, provider, out result); @@ -944,11 +944,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IF // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out sbyte result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -956,15 +956,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPro // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IShiftOperators.operator <<(sbyte value, int shiftAmount) => (sbyte)(value << shiftAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IShiftOperators.operator >>(sbyte value, int shiftAmount) => (sbyte)(value >> shiftAmount); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static sbyte IShiftOperators.operator >>>(sbyte value, int shiftAmount) // => (sbyte)((byte)value >> shiftAmount); @@ -972,18 +972,18 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPro // ISignedNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte ISignedNumber.NegativeOne => -1; // // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out sbyte result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -991,11 +991,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte ISubtractionOperators.operator -(sbyte left, sbyte right) => (sbyte)(left - right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked sbyte ISubtractionOperators.operator -(sbyte left, sbyte right) // => checked((sbyte)(left - right)); @@ -1003,11 +1003,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IUnaryNegationOperators.operator -(sbyte value) => (sbyte)(-value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked sbyte IUnaryNegationOperators.operator -(sbyte value) // => checked((sbyte)(-value)); @@ -1015,11 +1015,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static sbyte IUnaryPlusOperators.operator +(sbyte value) => (sbyte)(+value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked sbyte IUnaryPlusOperators.operator +(sbyte value) // => checked((sbyte)(+value)); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/Single.cs b/src/libraries/System.Private.CoreLib/src/System/Single.cs index 24150edb87230f..37abe72cd6bb2f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Single.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Single.cs @@ -447,11 +447,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IAdditionOperators.operator +(float left, float right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked float IAdditionOperators.operator +(float left, float right) // => checked(left + right); @@ -459,14 +459,14 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IAdditiveIdentity.AdditiveIdentity => 0.0f; // // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(float value) { uint bits = BitConverter.SingleToUInt32Bits(value); @@ -479,7 +479,7 @@ static bool IBinaryNumber.IsPow2(float value) && (significand == MinSignificand); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IBinaryNumber.Log2(float value) => MathF.Log2(value); @@ -487,28 +487,28 @@ static float IBinaryNumber.Log2(float value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IBitwiseOperators.operator &(float left, float right) { uint bits = BitConverter.SingleToUInt32Bits(left) & BitConverter.SingleToUInt32Bits(right); return BitConverter.UInt32BitsToSingle(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IBitwiseOperators.operator |(float left, float right) { uint bits = BitConverter.SingleToUInt32Bits(left) | BitConverter.SingleToUInt32Bits(right); return BitConverter.UInt32BitsToSingle(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IBitwiseOperators.operator ^(float left, float right) { uint bits = BitConverter.SingleToUInt32Bits(left) ^ BitConverter.SingleToUInt32Bits(right); return BitConverter.UInt32BitsToSingle(bits); } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IBitwiseOperators.operator ~(float value) { uint bits = ~BitConverter.SingleToUInt32Bits(value); @@ -519,19 +519,19 @@ static float IBinaryNumber.Log2(float value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(float left, float right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(float left, float right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(float left, float right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(float left, float right) => left >= right; @@ -539,11 +539,11 @@ static float IBinaryNumber.Log2(float value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IDecrementOperators.operator --(float value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked float IDecrementOperators.operator --(float value) // => checked(--value); @@ -551,11 +551,11 @@ static float IBinaryNumber.Log2(float value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IDivisionOperators.operator /(float left, float right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked float IDivisionOperators.operator /(float left, float right) // => checked(left / right); @@ -563,11 +563,11 @@ static float IBinaryNumber.Log2(float value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(float left, float right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(float left, float right) => left != right; @@ -575,178 +575,202 @@ static float IBinaryNumber.Log2(float value) // IFloatingPoint // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.E => MathF.E; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Epsilon => Epsilon; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.NaN => NaN; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.NegativeInfinity => NegativeInfinity; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.NegativeZero => -0.0f; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Pi => MathF.PI; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.PositiveInfinity => PositiveInfinity; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Tau => MathF.Tau; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Acos(float x) => MathF.Acos(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Acosh(float x) => MathF.Acosh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Asin(float x) => MathF.Asin(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Asinh(float x) => MathF.Asinh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Atan(float x) => MathF.Atan(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Atan2(float y, float x) => MathF.Atan2(y, x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Atanh(float x) => MathF.Atanh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.BitIncrement(float x) => MathF.BitIncrement(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.BitDecrement(float x) => MathF.BitDecrement(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Cbrt(float x) => MathF.Cbrt(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Ceiling(float x) => MathF.Ceiling(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.CopySign(float x, float y) => MathF.CopySign(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Cos(float x) => MathF.Cos(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Cosh(float x) => MathF.Cosh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Exp(float x) => MathF.Exp(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Floor(float x) => MathF.Floor(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.FusedMultiplyAdd(float left, float right, float addend) => MathF.FusedMultiplyAdd(left, right, addend); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.IEEERemainder(float left, float right) => MathF.IEEERemainder(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TInteger IFloatingPoint.ILogB(float x) => TInteger.Create(MathF.ILogB(x)); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Log(float x) => MathF.Log(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Log(float x, float newBase) => MathF.Log(x, newBase); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Log2(float x) => MathF.Log2(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Log10(float x) => MathF.Log10(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.MaxMagnitude(float x, float y) => MathF.MaxMagnitude(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.MinMagnitude(float x, float y) => MathF.MinMagnitude(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Pow(float x, float y) => MathF.Pow(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Round(float x) => MathF.Round(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Round(float x, TInteger digits) => MathF.Round(x, int.Create(digits)); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Round(float x, MidpointRounding mode) => MathF.Round(x, mode); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Round(float x, TInteger digits, MidpointRounding mode) => MathF.Round(x, int.Create(digits), mode); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.ScaleB(float x, TInteger n) => MathF.ScaleB(x, int.Create(n)); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Sin(float x) => MathF.Sin(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Sinh(float x) => MathF.Sinh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Sqrt(float x) => MathF.Sqrt(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Tan(float x) => MathF.Tan(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Tanh(float x) => MathF.Tanh(x); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IFloatingPoint.Truncate(float x) => MathF.Truncate(x); + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsFinite(float x) => IsFinite(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsInfinity(float x) => IsInfinity(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNaN(float x) => IsNaN(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNegative(float x) => IsNegative(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNegativeInfinity(float x) => IsNegativeInfinity(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsNormal(float x) => IsNormal(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsPositiveInfinity(float x) => IsPositiveInfinity(x); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static bool IFloatingPoint.IsSubnormal(float x) => IsSubnormal(x); + // static float IFloatingPoint.AcosPi(float x) // => MathF.AcosPi(x); // @@ -817,11 +841,11 @@ static float IFloatingPoint.Truncate(float x) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IIncrementOperators.operator ++(float value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked float IIncrementOperators.operator ++(float value) // => checked(++value); @@ -829,21 +853,21 @@ static float IFloatingPoint.Truncate(float x) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IModulusOperators.operator %(float left, float right) => left % right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked float IModulusOperators.operator %(float left, float right) // => checked(left % right); @@ -851,18 +875,18 @@ static float IFloatingPoint.Truncate(float x) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IMultiplicativeIdentity.MultiplicativeIdentity => 1.0f; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IMultiplyOperators.operator *(float left, float right) => (float)(left * right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked float IMultiplyOperators.operator *(float left, float right) // => checked((float)(left * right)); @@ -870,21 +894,21 @@ static float IFloatingPoint.Truncate(float x) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float INumber.One => 1.0f; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float INumber.Zero => 0.0f; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float INumber.Abs(float value) => MathF.Abs(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float INumber.Clamp(float value, float min, float max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static float INumber.Create(TOther value) { @@ -951,7 +975,7 @@ static float INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static float INumber.CreateSaturating(TOther value) { @@ -1018,7 +1042,7 @@ static float INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static float INumber.CreateTruncating(TOther value) { @@ -1085,31 +1109,31 @@ static float INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (float Quotient, float Remainder) INumber.DivRem(float left, float right) => (left / right, left % right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float INumber.Max(float x, float y) => MathF.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float INumber.Min(float x, float y) => MathF.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float INumber.Sign(float value) => MathF.Sign(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out float result) { @@ -1191,11 +1215,11 @@ static bool INumber.TryCreate(TOther value, out float result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out float result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out float result) => TryParse(s, style, provider, out result); @@ -1203,42 +1227,42 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IF // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out float result) - => TryParse(s, NumberStyles.Integer, provider, out result); + => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider, out result); // // ISignedNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float ISignedNumber.NegativeOne => -1; // // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) - => Parse(s, NumberStyles.Integer, provider); + => Parse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out float result) - => TryParse(s, NumberStyles.Integer, provider, out result); + => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider, out result); // // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float ISubtractionOperators.operator -(float left, float right) => (float)(left - right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked float ISubtractionOperators.operator -(float left, float right) // => checked((float)(left - right)); @@ -1246,20 +1270,20 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IUnaryNegationOperators.operator -(float value) => (float)(-value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked float IUnaryNegationOperators.operator -(float value) => checked((float)(-value)); // // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static float IUnaryPlusOperators.operator +(float value) => (float)(+value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked float IUnaryPlusOperators.operator +(float value) => checked((float)(+value)); #endif // FEATURE_GENERIC_MATH } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs index 54a7dc691cc0c8..3f60a1cd7ff7c7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs @@ -392,13 +392,24 @@ public bool TryReset() // to transition from canceled to non-canceled. if (_state == NotCanceledState) { - // If there is no timer, then we're free to reset. If there is a timer, then we need to first try - // to reset it to be infinite so that it won't fire, and then recognize that it could have already - // fired by the time we successfully changed it, and so check to see whether that's possibly the case. - // If we successfully reset it and it never fired, then we can be sure it won't trigger cancellation. - bool reset = - _timer is not TimerQueueTimer timer || - (timer.Change(Timeout.UnsignedInfinite, Timeout.UnsignedInfinite) && !timer._everQueued); + bool reset = false; + + try + { + // If there is no timer, then we're free to reset. If there is a timer, then we need to first try + // to reset it to be infinite so that it won't fire, and then recognize that it could have already + // fired by the time we successfully changed it, and so check to see whether that's possibly the case. + // If we successfully reset it and it never fired, then we can be sure it won't trigger cancellation. + reset = _timer is not TimerQueueTimer timer || + (timer.Change(Timeout.UnsignedInfinite, Timeout.UnsignedInfinite) && !timer._everQueued); + } + catch (ObjectDisposedException) + { + // Just eat the exception. There is no other way to tell that + // the timer has been disposed, and even if there were, there + // would not be a good way to deal with the observe/dispose + // race condition. + } if (reset) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs index 6ce99198c9c156..0bf6a82d1bc369 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs @@ -49,6 +49,7 @@ private static class Messages { public const EventOpcode IOEnqueue = (EventOpcode)13; public const EventOpcode IODequeue = (EventOpcode)14; + public const EventOpcode IOPack = (EventOpcode)15; public const EventOpcode Wait = (EventOpcode)90; public const EventOpcode Sample = (EventOpcode)100; public const EventOpcode Adjustment = (EventOpcode)101; @@ -204,5 +205,17 @@ public unsafe void ThreadPoolWorkingThreadCount(uint Count, ushort ClrInstanceID } LogThreadPoolWorkingThreadCount(Count, ClrInstanceID); } + + [Event(65, Level = EventLevel.Verbose, Message = Messages.IO, Task = Tasks.ThreadPool, Opcode = Opcodes.IOPack, Version = 0, Keywords = Keywords.ThreadingKeyword)] + private unsafe void ThreadPoolIOPack( + IntPtr NativeOverlapped, + IntPtr Overlapped, + ushort ClrInstanceID = DefaultClrInstanceId) + { + // In .NET 6, this event is exclusively fired in CoreCLR from a QCALL. + // This function only needs to exist for the EventSource to generate metadata + // for in-process EventListeners. It will not be called. + throw new NotImplementedException(); + } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.cs index 785000089bdaaf..0c731b73643216 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/NativeRuntimeEventSource.PortableThreadPool.cs @@ -51,6 +51,7 @@ private static class Messages { public const EventOpcode IOEnqueue = (EventOpcode)13; public const EventOpcode IODequeue = (EventOpcode)14; + public const EventOpcode IOPack = (EventOpcode)15; public const EventOpcode Wait = (EventOpcode)90; public const EventOpcode Sample = (EventOpcode)100; public const EventOpcode Adjustment = (EventOpcode)101; diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.ThreadCounts.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.ThreadCounts.cs index 43aa0fcf7102cb..b3747c0061c1dd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.ThreadCounts.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.ThreadCounts.cs @@ -31,61 +31,52 @@ private void SetInt16Value(short value, byte shift) => /// public short NumProcessingWork { - get => GetInt16Value(NumProcessingWorkShift); + get + { + short value = GetInt16Value(NumProcessingWorkShift); + Debug.Assert(value >= 0); + return value; + } set { Debug.Assert(value >= 0); - SetInt16Value(value, NumProcessingWorkShift); + SetInt16Value(Math.Max((short)0, value), NumProcessingWorkShift); } } - public void SubtractNumProcessingWork(short value) - { - Debug.Assert(value >= 0); - Debug.Assert(value <= NumProcessingWork); - - _data -= (ulong)(ushort)value << NumProcessingWorkShift; - } - - public void InterlockedDecrementNumProcessingWork() - { - Debug.Assert(NumProcessingWorkShift == 0); - - ThreadCounts counts = new ThreadCounts(Interlocked.Decrement(ref _data)); - Debug.Assert(counts.NumProcessingWork >= 0); - } - /// /// Number of thread pool threads that currently exist. /// public short NumExistingThreads { - get => GetInt16Value(NumExistingThreadsShift); + get + { + short value = GetInt16Value(NumExistingThreadsShift); + Debug.Assert(value >= 0); + return value; + } set { Debug.Assert(value >= 0); - SetInt16Value(value, NumExistingThreadsShift); + SetInt16Value(Math.Max((short)0, value), NumExistingThreadsShift); } } - public void SubtractNumExistingThreads(short value) - { - Debug.Assert(value >= 0); - Debug.Assert(value <= NumExistingThreads); - - _data -= (ulong)(ushort)value << NumExistingThreadsShift; - } - /// /// Max possible thread pool threads we want to have. /// public short NumThreadsGoal { - get => GetInt16Value(NumThreadsGoalShift); + get + { + short value = GetInt16Value(NumThreadsGoalShift); + Debug.Assert(value > 0); + return value; + } set { Debug.Assert(value > 0); - SetInt16Value(value, NumThreadsGoalShift); + SetInt16Value(Math.Max((short)1, value), NumThreadsGoalShift); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.CpuUtilizationReader.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.Unix.cs similarity index 79% rename from src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.CpuUtilizationReader.Unix.cs rename to src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.Unix.cs index fe1eaa37d7577b..7363e7034febc7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.CpuUtilizationReader.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.Unix.cs @@ -5,6 +5,11 @@ namespace System.Threading { internal sealed partial class PortableThreadPool { + private static partial class WorkerThread + { + private static bool IsIOPending => false; + } + private struct CpuUtilizationReader { private Interop.Sys.ProcessCpuInformation _cpuInfo; diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.CpuUtilizationReader.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.Windows.cs similarity index 75% rename from src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.CpuUtilizationReader.Windows.cs rename to src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.Windows.cs index 4818512ba8183a..6f5d7eff9d96c9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.CpuUtilizationReader.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.Windows.cs @@ -8,6 +8,20 @@ namespace System.Threading { internal sealed partial class PortableThreadPool { + private static partial class WorkerThread + { + private static bool IsIOPending + { + get + { + bool success = + Interop.Kernel32.GetThreadIOPendingFlag(Interop.Kernel32.GetCurrentThread(), out Interop.BOOL isIOPending); + Debug.Assert(success); + return !success || isIOPending != Interop.BOOL.FALSE; + } + } + } + private struct CpuUtilizationReader { public long _idleTime; diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs index 1298d1be4121d9..24f1f033595020 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs @@ -7,16 +7,34 @@ namespace System.Threading { internal sealed partial class PortableThreadPool { + private int _numThreadsBeingKeptAlive; + /// /// The worker thread infastructure for the CLR thread pool. /// - private static class WorkerThread + private static partial class WorkerThread { // This value represents an assumption of how much uncommited stack space a worker thread may use in the future. // Used in calculations to estimate when to throttle the rate of thread injection to reduce the possibility of // preexisting threads from running out of memory when using new stack space in low-memory situations. public const int EstimatedAdditionalStackUsagePerThreadBytes = 64 << 10; // 64 KB + private static readonly short ThreadsToKeepAlive = DetermineThreadsToKeepAlive(); + + private static short DetermineThreadsToKeepAlive() + { + const short DefaultThreadsToKeepAlive = 0; + + // The number of worker threads to keep alive after they are created. Set to -1 to keep all created worker + // threads alive. When the ThreadTimeoutMs config value is also set, for worker threads the timeout applies to + // worker threads that are in excess of the number configured for ThreadsToKeepAlive. + short threadsToKeepAlive = + AppContextConfigHelper.GetInt16Config( + "System.Threading.ThreadPool.ThreadsToKeepAlive", + DefaultThreadsToKeepAlive); + return threadsToKeepAlive >= -1 ? threadsToKeepAlive : DefaultThreadsToKeepAlive; + } + /// /// Semaphore for controlling how many threads are currently working. /// @@ -51,10 +69,36 @@ private static void WorkerThreadStart() LowLevelLock threadAdjustmentLock = threadPoolInstance._threadAdjustmentLock; LowLevelLifoSemaphore semaphore = s_semaphore; + // Determine the idle timeout to use for this thread. Some threads may always be kept alive based on config. + int timeoutMs = ThreadPoolThreadTimeoutMs; + if (ThreadsToKeepAlive != 0) + { + if (ThreadsToKeepAlive < 0) + { + timeoutMs = Timeout.Infinite; + } + else + { + int count = threadPoolInstance._numThreadsBeingKeptAlive; + while (count < ThreadsToKeepAlive) + { + int countBeforeUpdate = + Interlocked.CompareExchange(ref threadPoolInstance._numThreadsBeingKeptAlive, count + 1, count); + if (countBeforeUpdate == count) + { + timeoutMs = Timeout.Infinite; + break; + } + + count = countBeforeUpdate; + } + } + } + while (true) { bool spinWait = true; - while (semaphore.Wait(ThreadPoolThreadTimeoutMs, spinWait)) + while (semaphore.Wait(timeoutMs, spinWait)) { bool alreadyRemovedWorkingWorker = false; while (TakeActiveRequest(threadPoolInstance)) @@ -101,6 +145,12 @@ private static void WorkerThreadStart() } } + // The thread cannot exit if it has IO pending, otherwise the IO may be canceled + if (IsIOPending) + { + continue; + } + threadAdjustmentLock.Acquire(); try { @@ -114,16 +164,14 @@ private static void WorkerThreadStart() // Since this thread is currently registered as an existing thread, if more work comes in meanwhile, // this thread would be expected to satisfy the new work. Ensure that NumExistingThreads is not // decreased below NumProcessingWork, as that would be indicative of such a case. - short numExistingThreads = counts.NumExistingThreads; - if (numExistingThreads <= counts.NumProcessingWork) + if (counts.NumExistingThreads <= counts.NumProcessingWork) { // In this case, enough work came in that this thread should not time out and should go back to work. break; } ThreadCounts newCounts = counts; - newCounts.SubtractNumExistingThreads(1); - short newNumExistingThreads = (short)(numExistingThreads - 1); + short newNumExistingThreads = --newCounts.NumExistingThreads; short newNumThreadsGoal = Math.Max( threadPoolInstance.MinThreadsGoal, @@ -159,7 +207,23 @@ private static void WorkerThreadStart() /// private static void RemoveWorkingWorker(PortableThreadPool threadPoolInstance) { - threadPoolInstance._separated.counts.InterlockedDecrementNumProcessingWork(); + // A compare-exchange loop is used instead of Interlocked.Decrement or Interlocked.Add to defensively prevent + // NumProcessingWork from underflowing. See the setter for NumProcessingWork. + ThreadCounts counts = threadPoolInstance._separated.counts; + while (true) + { + ThreadCounts newCounts = counts; + newCounts.NumProcessingWork--; + + ThreadCounts countsBeforeUpdate = + threadPoolInstance._separated.counts.InterlockedCompareExchange(newCounts, counts); + if (countsBeforeUpdate == counts) + { + break; + } + + counts = countsBeforeUpdate; + } // It's possible that we decided we had thread requests just before a request came in, // but reduced the worker count *after* the request came in. In this case, we might @@ -221,8 +285,8 @@ internal static void MaybeAddWorkingWorker(PortableThreadPool threadPoolInstance while (true) { ThreadCounts newCounts = counts; - newCounts.SubtractNumProcessingWork((short)toCreate); - newCounts.SubtractNumExistingThreads((short)toCreate); + newCounts.NumProcessingWork -= (short)toCreate; + newCounts.NumExistingThreads -= (short)toCreate; ThreadCounts oldCounts = threadPoolInstance._separated.counts.InterlockedCompareExchange(newCounts, counts); if (oldCounts == counts) @@ -259,7 +323,7 @@ internal static bool ShouldStopProcessingWorkNow(PortableThreadPool threadPoolIn } ThreadCounts newCounts = counts; - newCounts.SubtractNumProcessingWork(1); + newCounts.NumProcessingWork--; ThreadCounts oldCounts = threadPoolInstance._separated.counts.InterlockedCompareExchange(newCounts, counts); diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.cs index a425298cacd8e8..5dd945b013448c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.cs @@ -12,7 +12,6 @@ namespace System.Threading /// internal sealed partial class PortableThreadPool { - private const int ThreadPoolThreadTimeoutMs = 20 * 1000; // If you change this make sure to change the timeout times in the tests. private const int SmallStackSizeBytes = 256 * 1024; private const short MaxPossibleThreadCount = short.MaxValue; @@ -33,6 +32,22 @@ internal sealed partial class PortableThreadPool private static readonly short ForcedMaxWorkerThreads = AppContextConfigHelper.GetInt16Config("System.Threading.ThreadPool.MaxThreads", 0, false); + private static readonly int ThreadPoolThreadTimeoutMs = DetermineThreadPoolThreadTimeoutMs(); + + private static int DetermineThreadPoolThreadTimeoutMs() + { + const int DefaultThreadPoolThreadTimeoutMs = 20 * 1000; // If you change this make sure to change the timeout times in the tests. + + // The amount of time in milliseconds a thread pool thread waits without having done any work before timing out and + // exiting. Set to -1 to disable the timeout. Applies to worker threads and wait threads. Also see the + // ThreadsToKeepAlive config value for relevant information. + int timeoutMs = + AppContextConfigHelper.GetInt32Config( + "System.Threading.ThreadPool.ThreadTimeoutMs", + DefaultThreadPoolThreadTimeoutMs); + return timeoutMs >= -1 ? timeoutMs : DefaultThreadPoolThreadTimeoutMs; + } + [ThreadStatic] private static object? t_completionCountObject; diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs index bfa8ccd86802cd..246ed5b92f85a0 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs @@ -745,7 +745,7 @@ private async Task WaitUntilCountOrTimeoutAsync(TaskNode asyncWaiter, int public ConfiguredNoThrowAwaiter(Task task) => _task = task; public ConfiguredNoThrowAwaiter GetAwaiter() => this; public bool IsCompleted => _task.IsCompleted; - public void GetResult() { } + public void GetResult() => _task.MarkExceptionsAsHandled(); public void UnsafeOnCompleted(Action continuation) => _task.ConfigureAwait(false).GetAwaiter().UnsafeOnCompleted(continuation); public void OnCompleted(Action continuation) => _task.ConfigureAwait(false).GetAwaiter().OnCompleted(continuation); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs index 458c914773cbcd..8a21b34ddb01c9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @@ -1863,6 +1863,12 @@ internal List GetExceptionDispatchInfos() return Volatile.Read(ref m_contingentProperties)?.m_exceptionsHolder?.GetCancellationExceptionDispatchInfo(); // may be null } + /// Marks any exceptions stored in the Task as having been handled. + internal void MarkExceptionsAsHandled() + { + Volatile.Read(ref m_contingentProperties)?.m_exceptionsHolder?.MarkAsHandled(calledFromFinalizer: false); + } + /// /// Throws an aggregate exception if the task contains exceptions. /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs index 9b4fc5df0395ad..549147bacd9f3a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs @@ -389,6 +389,7 @@ public int Count } internal bool loggingEnabled; + private bool _dispatchTimeSensitiveWorkFirst; internal readonly ConcurrentQueue workItems = new ConcurrentQueue(); // SOS's ThreadPool command depends on this name internal readonly ConcurrentQueue? timeSensitiveWorkQueue = ThreadPool.SupportsTimeSensitiveWorkItems ? new ConcurrentQueue() : null; @@ -650,6 +651,21 @@ internal static bool Dispatch() int startTickCount = Environment.TickCount; object? workItem = null; +#pragma warning disable CS0162 // Unreachable code detected. SupportsTimeSensitiveWorkItems may be a constant in some runtimes. + if (ThreadPool.SupportsTimeSensitiveWorkItems) + { + // Alternate between checking for time-sensitive work or other work first, that way both sets of work items + // get a chance to run in situations where worker threads are starved and work items that run also take over + // the thread, sustaining starvation. For example, if time-sensitive work is always checked last here, timer + // callbacks may not run when worker threads are continually starved. + bool dispatchTimeSensitiveWorkFirst = workQueue._dispatchTimeSensitiveWorkFirst; + workQueue._dispatchTimeSensitiveWorkFirst = !dispatchTimeSensitiveWorkFirst; + if (dispatchTimeSensitiveWorkFirst) + { + workItem = workQueue.TryDequeueTimeSensitiveWorkItem(); + } + } +#pragma warning restore CS0162 // // Loop until our quantum expires or there is no work. diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeOnly.cs b/src/libraries/System.Private.CoreLib/src/System/TimeOnly.cs index d89c04fb675601..9fb102f3990ac8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeOnly.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeOnly.cs @@ -892,15 +892,13 @@ public string ToString(string? format, IFormatProvider? provider) return DateTimeFormat.TryFormat(ToDateTime(), destination, out charsWritten, format, provider); default: - charsWritten = 0; - return false; + throw new FormatException(SR.Argument_BadFormatSpecifier); } } if (!DateTimeFormat.IsValidCustomTimeFormat(format, throwOnError: false)) { - charsWritten = 0; - return false; + throw new FormatException(SR.Format(SR.Format_DateTimeOnlyContainsNoneDateParts, format.ToString(), nameof(TimeOnly))); } return DateTimeFormat.TryFormat(ToDateTime(), destination, out charsWritten, format, provider); @@ -911,19 +909,19 @@ public string ToString(string? format, IFormatProvider? provider) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(TimeOnly left, TimeOnly right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(TimeOnly left, TimeOnly right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(TimeOnly left, TimeOnly right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(TimeOnly left, TimeOnly right) => left >= right; @@ -931,11 +929,11 @@ public string ToString(string? format, IFormatProvider? provider) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(TimeOnly left, TimeOnly right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(TimeOnly left, TimeOnly right) => left != right; @@ -943,11 +941,11 @@ public string ToString(string? format, IFormatProvider? provider) // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeOnly IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TimeOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); @@ -955,11 +953,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormat // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeOnly ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out TimeOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); @@ -967,13 +965,20 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvi // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan ISubtractionOperators.operator -(TimeOnly left, TimeOnly right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked TimeSpan ISubtractionOperators.operator -(TimeOnly left, TimeOnly right) // => checked(left - right); + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static TimeOnly IMinMaxValue.MinValue => MinValue; + + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] + static TimeOnly IMinMaxValue.MaxValue => MaxValue; + #endif // FEATURE_GENERIC_MATH } } diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeSpan.cs b/src/libraries/System.Private.CoreLib/src/System/TimeSpan.cs index 6bc5341c8cc945..af9d162861febf 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeSpan.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeSpan.cs @@ -510,11 +510,11 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IAdditionOperators.operator +(TimeSpan left, TimeSpan right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked TimeSpan IAdditionOperators.operator +(TimeSpan left, TimeSpan right) // => checked(left + right); @@ -522,26 +522,26 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IAdditiveIdentity.AdditiveIdentity => default; // // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(TimeSpan left, TimeSpan right) => left.operator <=(TimeSpan left, TimeSpan right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(TimeSpan left, TimeSpan right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(TimeSpan left, TimeSpan right) => left >= right; @@ -549,19 +549,19 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IDivisionOperators.operator /(TimeSpan left, double right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked TimeSpan IDivisionOperators.operator /(TimeSpan left, double right) // => checked(left / right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IDivisionOperators.operator /(TimeSpan left, TimeSpan right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked double IDivisionOperators.operator /(TimeSpan left, TimeSpan right) // => checked(left / right); @@ -569,11 +569,11 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(TimeSpan left, TimeSpan right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(TimeSpan left, TimeSpan right) => left != right; @@ -581,28 +581,28 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IMinMaxValue.MaxValue => MaxValue; // // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static double IMultiplicativeIdentity.MultiplicativeIdentity => 1.0; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IMultiplyOperators.operator *(TimeSpan left, double right) => left * right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked TimeSpan IMultiplyOperators.operator *(TimeSpan left, double right) // => checked(left * right); @@ -610,11 +610,11 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TimeSpan result) => TryParse(s, provider, out result); @@ -622,11 +622,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormat // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out TimeSpan result) => TryParse(s, provider, out result); @@ -634,11 +634,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvi // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan ISubtractionOperators.operator -(TimeSpan left, TimeSpan right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked TimeSpan ISubtractionOperators.operator -(TimeSpan left, TimeSpan right) // => checked(left - right); @@ -646,11 +646,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvi // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IUnaryNegationOperators.operator -(TimeSpan value) => -value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked TimeSpan IUnaryNegationOperators.operator -(TimeSpan value) // => checked(-value); @@ -658,11 +658,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvi // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static TimeSpan IUnaryPlusOperators.operator +(TimeSpan value) => +value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked TimeSpan IUnaryPlusOperators.operator +(TimeSpan value) // => checked(+value); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.FullGlobalizationData.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.FullGlobalizationData.Unix.cs index 5a80d7b448649d..e0c284b6c53522 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.FullGlobalizationData.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.FullGlobalizationData.Unix.cs @@ -24,6 +24,11 @@ public sealed partial class TimeZoneInfo // Main function that is called during construction to populate the three display names private static void TryPopulateTimeZoneDisplayNamesFromGlobalizationData(string timeZoneId, TimeSpan baseUtcOffset, ref string? standardDisplayName, ref string? daylightDisplayName, ref string? displayName) { + if (GlobalizationMode.Invariant) + { + return; + } + // Determine the culture to use CultureInfo uiCulture = CultureInfo.CurrentUICulture; if (uiCulture.Name.Length == 0) diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.Android.cs b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.Android.cs index 53baf4eb65111f..23c1044e1983cd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.Android.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.Android.cs @@ -193,6 +193,7 @@ private sealed class AndroidTzData private string[] _ids; private int[] _byteOffsets; private int[] _lengths; + private bool[] _isBackwards; private string _tzFileDir; private string _tzFilePath; @@ -230,7 +231,7 @@ public AndroidTzData() foreach (var tzFileDir in tzFileDirList) { string tzFilePath = Path.Combine(tzFileDir, TimeZoneFileName); - if (LoadData(tzFilePath)) + if (LoadData(tzFileDir, tzFilePath)) { _tzFileDir = tzFileDir; _tzFilePath = tzFilePath; @@ -241,10 +242,62 @@ public AndroidTzData() throw new TimeZoneNotFoundException(SR.TimeZoneNotFound_ValidTimeZoneFileMissing); } + // On some versions of Android, the tzdata file may still contain backward timezone ids. + // We attempt to use tzlookup.xml, which is available on some versions of Android to help + // validate non-backward timezone ids + // tzlookup.xml is an autogenerated file that contains timezone ids in this form: + // + // + // + // + // Australia/Sydney + // ... + // ... + // Australia/Eucla + // + // + // ... + // ... + // ... + // + // + // + // + // Once the timezone cache is populated with the IDs, we reference tzlookup id tags + // to determine if an id is backwards and label it as such if they are. + private void FilterBackwardIDs(string tzFileDir, out HashSet tzLookupIDs) + { + tzLookupIDs = new HashSet(); + try + { + using (StreamReader sr = File.OpenText(Path.Combine(tzFileDir, "tzlookup.xml"))) + { + string? tzLookupLine; + while (sr.Peek() >= 0) + { + if (!(tzLookupLine = sr.ReadLine())!.AsSpan().TrimStart().StartsWith("') + 1; + int idLength = tzLookupLine.LastIndexOf(" or the end tag are not found + continue; + } + string id = tzLookupLine.Substring(idStart, idLength); + tzLookupIDs.Add(id); + } + } + } + catch {} + } + [MemberNotNullWhen(true, nameof(_ids))] [MemberNotNullWhen(true, nameof(_byteOffsets))] [MemberNotNullWhen(true, nameof(_lengths))] - private bool LoadData(string path) + [MemberNotNullWhen(true, nameof(_isBackwards))] + private bool LoadData(string tzFileDir, string path) { if (!File.Exists(path)) { @@ -254,7 +307,7 @@ private bool LoadData(string path) { using (FileStream fs = File.OpenRead(path)) { - LoadTzFile(fs); + LoadTzFile(tzFileDir, fs); } return true; } @@ -266,7 +319,8 @@ private bool LoadData(string path) [MemberNotNull(nameof(_ids))] [MemberNotNull(nameof(_byteOffsets))] [MemberNotNull(nameof(_lengths))] - private void LoadTzFile(Stream fs) + [MemberNotNull(nameof(_isBackwards))] + private void LoadTzFile(string tzFileDir, Stream fs) { const int HeaderSize = 24; Span buffer = stackalloc byte[HeaderSize]; @@ -274,7 +328,7 @@ private void LoadTzFile(Stream fs) ReadTzDataIntoBuffer(fs, 0, buffer); LoadHeader(buffer, out int indexOffset, out int dataOffset); - ReadIndex(fs, indexOffset, dataOffset); + ReadIndex(tzFileDir, fs, indexOffset, dataOffset); } private void LoadHeader(Span buffer, out int indexOffset, out int dataOffset) @@ -303,16 +357,17 @@ private void LoadHeader(Span buffer, out int indexOffset, out int dataOffs [MemberNotNull(nameof(_ids))] [MemberNotNull(nameof(_byteOffsets))] [MemberNotNull(nameof(_lengths))] - private void ReadIndex(Stream fs, int indexOffset, int dataOffset) + [MemberNotNull(nameof(_isBackwards))] + private void ReadIndex(string tzFileDir, Stream fs, int indexOffset, int dataOffset) { int indexSize = dataOffset - indexOffset; const int entrySize = 52; // Data entry size int entryCount = indexSize / entrySize; - _byteOffsets = new int[entryCount]; _ids = new string[entryCount]; _lengths = new int[entryCount]; - + _isBackwards = new bool[entryCount]; + FilterBackwardIDs(tzFileDir, out HashSet tzLookupIDs); for (int i = 0; i < entryCount; ++i) { LoadEntryAt(fs, indexOffset + (entrySize*i), out string id, out int byteOffset, out int length); @@ -320,6 +375,7 @@ private void ReadIndex(Stream fs, int indexOffset, int dataOffset) _byteOffsets[i] = byteOffset + dataOffset; _ids[i] = id; _lengths[i] = length; + _isBackwards[i] = !tzLookupIDs.Contains(id); if (length < 24) // Header Size { @@ -372,7 +428,25 @@ private void LoadEntryAt(Stream fs, long position, out string id, out int byteOf public string[] GetTimeZoneIds() { - return _ids; + int numTimeZoneIDs = 0; + for (int i = 0; i < _ids.Length; i++) + { + if (!_isBackwards[i]) + { + numTimeZoneIDs++; + } + } + string[] nonBackwardsTZIDs = new string[numTimeZoneIDs]; + var index = 0; + for (int i = 0; i < _ids.Length; i++) + { + if (!_isBackwards[i]) + { + nonBackwardsTZIDs[index] = _ids[i]; + index++; + } + } + return nonBackwardsTZIDs; } public string GetTimeZoneDirectory() diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.NonAndroid.cs b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.NonAndroid.cs index d7e54e1ebab2ea..dcf589b79d8b2d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.NonAndroid.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.NonAndroid.cs @@ -5,8 +5,9 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; -using System.Text; +using System.Runtime.InteropServices; using System.Security; +using System.Text; using Microsoft.Win32.SafeHandles; namespace System @@ -23,17 +24,83 @@ private static TimeZoneInfo GetLocalTimeZoneCore() return GetLocalTimeZoneFromTzFile(); } + internal static byte[] ReadAllBytesFromSeekableNonZeroSizeFile(string path, int maxFileSize) + { + using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 1, FileOptions.SequentialScan)) + { + if (!fs.CanSeek) + { + throw new IOException(SR.IO_UnseekableFile); + } + + long fileLength = fs.Length; + if (fileLength > maxFileSize) + { + throw new IOException(SR.IO_FileTooLong); + } + + if (fileLength == 0) + { + throw new IOException(SR.IO_InvalidReadLength); + } + + int index = 0; + int count = (int)fileLength; + byte[] bytes = new byte[count]; + while (count > 0) + { + int n = fs.Read(bytes, index, count); + if (n == 0) + { + ThrowHelper.ThrowEndOfFileException(); + } + index += n; + count -= n; + } + return bytes; + } + } + + // Bitmap covering the ASCII range. The bits is set for the characters [a-z], [A-Z], [0-9], '/', '-', and '_'. + private static byte[] asciiBitmap = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0xFF, 0x03, 0xFE, 0xFF, 0xFF, 0x87, 0xFE, 0xFF, 0xFF, 0x07 }; + + private static bool IdContainsAnyDisallowedChars(string zoneId) + { + for (int i = 0; i < zoneId.Length; i++) + { + int c = zoneId[i]; + if (c > 0x7F) + { + return true; + } + + int value = c >> 3; + if ((asciiBitmap[value] & (ulong)(1UL << (c - (value << 3)))) == 0) + { + return true; + } + } + + return false; + } + private static TimeZoneInfoResult TryGetTimeZoneFromLocalMachineCore(string id, out TimeZoneInfo? value, out Exception? e) { value = null; e = null; + if (Path.IsPathRooted(id) || IdContainsAnyDisallowedChars(id)) + { + e = new TimeZoneNotFoundException(SR.Format(SR.InvalidTimeZone_InvalidId, id)); + return TimeZoneInfoResult.TimeZoneNotFoundException; + } + string timeZoneDirectory = GetTimeZoneDirectory(); string timeZoneFilePath = Path.Combine(timeZoneDirectory, id); byte[] rawData; try { - rawData = File.ReadAllBytes(timeZoneFilePath); + rawData = ReadAllBytesFromSeekableNonZeroSizeFile(timeZoneFilePath, maxFileSize: 20 * 1024 * 1024 /* 20 MB */); // timezone files usually less than 1 MB. } catch (UnauthorizedAccessException ex) { @@ -50,7 +117,7 @@ private static TimeZoneInfoResult TryGetTimeZoneFromLocalMachineCore(string id, e = ex; return TimeZoneInfoResult.TimeZoneNotFoundException; } - catch (IOException ex) + catch (Exception ex) when (ex is IOException || ex is OutOfMemoryException) { e = new InvalidTimeZoneException(SR.Format(SR.InvalidTimeZone_InvalidFileData, id, timeZoneFilePath), ex); return TimeZoneInfoResult.InvalidTimeZoneException; @@ -382,6 +449,13 @@ private static bool TryLoadTzFile(string tzFilePath, [NotNullWhen(true)] ref byt /// /// Gets the tzfile raw data for the current 'local' time zone using the following rules. + /// + /// On iOS / tvOS + /// 1. Read the TZ environment variable. If it is set, use it. + /// 2. Get the default TZ from the device + /// 3. Use UTC if all else fails. + /// + /// On all other platforms /// 1. Read the TZ environment variable. If it is set, use it. /// 2. Look for the data in /etc/localtime. /// 3. Look for the data in GetTimeZoneDirectory()/localtime. @@ -393,16 +467,21 @@ private static bool TryGetLocalTzFile([NotNullWhen(true)] out byte[]? rawData, [ id = null; string? tzVariable = GetTzEnvironmentVariable(); - // If the env var is null, use the localtime file + // If the env var is null, on iOS/tvOS, grab the default tz from the device. + // On all other platforms, use the localtime file. if (tzVariable == null) { +#if TARGET_IOS || TARGET_TVOS + tzVariable = Interop.Sys.GetDefaultTimeZone(); +#else return TryLoadTzFile("/etc/localtime", ref rawData, ref id) || TryLoadTzFile(Path.Combine(GetTimeZoneDirectory(), "localtime"), ref rawData, ref id); +#endif } // If it's empty, use UTC (TryGetLocalTzFile() should return false). - if (tzVariable.Length == 0) + if (string.IsNullOrEmpty(tzVariable)) { return false; } diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.cs b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.cs index ee0baa1e7ec805..c1e1b2e1025576 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.cs @@ -85,7 +85,8 @@ private TimeZoneInfo CreateLocal() timeZone._standardDisplayName, timeZone._daylightDisplayName, timeZone._adjustmentRules, - disableDaylightSavingTime: false); + disableDaylightSavingTime: false, + timeZone.HasIanaId); _localTimeZone = timeZone; } @@ -1954,7 +1955,7 @@ private static TimeZoneInfoResult TryGetTimeZoneFromLocalMachine(string id, bool else { value = new TimeZoneInfo(match!._id, match._baseUtcOffset, match._displayName, match._standardDisplayName, - match._daylightDisplayName, match._adjustmentRules, disableDaylightSavingTime: false); + match._daylightDisplayName, match._adjustmentRules, disableDaylightSavingTime: false, match.HasIanaId); } } else diff --git a/src/libraries/System.Private.CoreLib/src/System/UInt16.cs b/src/libraries/System.Private.CoreLib/src/System/UInt16.cs index 49c08cc99fab3c..839e31b64b366c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UInt16.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UInt16.cs @@ -279,11 +279,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IAdditionOperators.operator +(ushort left, ushort right) => (ushort)(left + right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ushort IAdditionOperators.operator +(ushort left, ushort right) // => checked((ushort)(left + right)); @@ -291,30 +291,30 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBinaryInteger.LeadingZeroCount(ushort value) => (ushort)(BitOperations.LeadingZeroCount(value) - 16); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBinaryInteger.PopCount(ushort value) => (ushort)BitOperations.PopCount(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBinaryInteger.RotateLeft(ushort value, int rotateAmount) => (ushort)((value << (rotateAmount & 15)) | (value >> ((16 - rotateAmount) & 15))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBinaryInteger.RotateRight(ushort value, int rotateAmount) => (ushort)((value >> (rotateAmount & 15)) | (value << ((16 - rotateAmount) & 15))); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBinaryInteger.TrailingZeroCount(ushort value) => (ushort)(BitOperations.TrailingZeroCount(value << 16) - 16); @@ -322,11 +322,11 @@ static ushort IBinaryInteger.TrailingZeroCount(ushort value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(ushort value) => BitOperations.IsPow2((uint)value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBinaryNumber.Log2(ushort value) => (ushort)BitOperations.Log2(value); @@ -334,19 +334,19 @@ static ushort IBinaryNumber.Log2(ushort value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBitwiseOperators.operator &(ushort left, ushort right) => (ushort)(left & right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBitwiseOperators.operator |(ushort left, ushort right) => (ushort)(left | right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBitwiseOperators.operator ^(ushort left, ushort right) => (ushort)(left ^ right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IBitwiseOperators.operator ~(ushort value) => (ushort)(~value); @@ -354,19 +354,19 @@ static ushort IBinaryNumber.Log2(ushort value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(ushort left, ushort right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(ushort left, ushort right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(ushort left, ushort right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(ushort left, ushort right) => left >= right; @@ -374,11 +374,11 @@ static ushort IBinaryNumber.Log2(ushort value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IDecrementOperators.operator --(ushort value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ushort IDecrementOperators.operator --(ushort value) // => checked(--value); @@ -386,11 +386,11 @@ static ushort IBinaryNumber.Log2(ushort value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IDivisionOperators.operator /(ushort left, ushort right) => (ushort)(left / right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ushort IDivisionOperators.operator /(ushort left, ushort right) // => checked((ushort)(left / right)); @@ -398,11 +398,11 @@ static ushort IBinaryNumber.Log2(ushort value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(ushort left, ushort right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(ushort left, ushort right) => left != right; @@ -410,11 +410,11 @@ static ushort IBinaryNumber.Log2(ushort value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IIncrementOperators.operator ++(ushort value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ushort IIncrementOperators.operator ++(ushort value) // => checked(++value); @@ -422,21 +422,21 @@ static ushort IBinaryNumber.Log2(ushort value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IModulusOperators.operator %(ushort left, ushort right) => (ushort)(left % right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ushort IModulusOperators.operator %(ushort left, ushort right) // => checked((ushort)(left % right)); @@ -444,18 +444,18 @@ static ushort IBinaryNumber.Log2(ushort value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IMultiplyOperators.operator *(ushort left, ushort right) => (ushort)(left * right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ushort IMultiplyOperators.operator *(ushort left, ushort right) // => checked((ushort)(left * right)); @@ -463,21 +463,21 @@ static ushort IBinaryNumber.Log2(ushort value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort INumber.Abs(ushort value) => value; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort INumber.Clamp(ushort value, ushort min, ushort max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static ushort INumber.Create(TOther value) { @@ -544,7 +544,7 @@ static ushort INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static ushort INumber.CreateSaturating(TOther value) { @@ -628,7 +628,7 @@ static ushort INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static ushort INumber.CreateTruncating(TOther value) { @@ -695,31 +695,31 @@ static ushort INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (ushort Quotient, ushort Remainder) INumber.DivRem(ushort left, ushort right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort INumber.Max(ushort x, ushort y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort INumber.Min(ushort x, ushort y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort INumber.Sign(ushort value) => (ushort)((value == 0) ? 0 : 1); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out ushort result) { @@ -889,11 +889,11 @@ static bool INumber.TryCreate(TOther value, out ushort result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out ushort result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out ushort result) => TryParse(s, style, provider, out result); @@ -901,11 +901,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, I // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out ushort result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -913,15 +913,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPr // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IShiftOperators.operator <<(ushort value, int shiftAmount) => (ushort)(value << shiftAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IShiftOperators.operator >>(ushort value, int shiftAmount) => (ushort)(value >> shiftAmount); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static ushort IShiftOperators.operator >>>(ushort value, int shiftAmount) // => (ushort)(value >> shiftAmount); @@ -929,11 +929,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPr // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out ushort result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -941,11 +941,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvide // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort ISubtractionOperators.operator -(ushort left, ushort right) => (ushort)(left - right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ushort ISubtractionOperators.operator -(ushort left, ushort right) // => checked((ushort)(left - right)); @@ -953,11 +953,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvide // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IUnaryNegationOperators.operator -(ushort value) => (ushort)(-value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ushort IUnaryNegationOperators.operator -(ushort value) // => checked((ushort)(-value)); @@ -965,11 +965,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvide // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ushort IUnaryPlusOperators.operator +(ushort value) => (ushort)(+value); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ushort IUnaryPlusOperators.operator +(ushort value) // => checked((ushort)(+value)); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/UInt32.cs b/src/libraries/System.Private.CoreLib/src/System/UInt32.cs index 70f073b1e15bf5..29fc05a976d71d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UInt32.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UInt32.cs @@ -265,11 +265,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IAdditionOperators.operator +(uint left, uint right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked uint IAdditionOperators.operator +(uint left, uint right) // => checked(left + right); @@ -277,30 +277,30 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBinaryInteger.LeadingZeroCount(uint value) => (uint)BitOperations.LeadingZeroCount(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBinaryInteger.PopCount(uint value) => (uint)BitOperations.PopCount(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBinaryInteger.RotateLeft(uint value, int rotateAmount) => BitOperations.RotateLeft(value, rotateAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBinaryInteger.RotateRight(uint value, int rotateAmount) => BitOperations.RotateRight(value, rotateAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBinaryInteger.TrailingZeroCount(uint value) => (uint)BitOperations.TrailingZeroCount(value); @@ -308,11 +308,11 @@ static uint IBinaryInteger.TrailingZeroCount(uint value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(uint value) => BitOperations.IsPow2(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBinaryNumber.Log2(uint value) => (uint)BitOperations.Log2(value); @@ -320,19 +320,19 @@ static uint IBinaryNumber.Log2(uint value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBitwiseOperators.operator &(uint left, uint right) => left & right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBitwiseOperators.operator |(uint left, uint right) => left | right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBitwiseOperators.operator ^(uint left, uint right) => left ^ right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IBitwiseOperators.operator ~(uint value) => ~value; @@ -340,19 +340,19 @@ static uint IBinaryNumber.Log2(uint value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(uint left, uint right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(uint left, uint right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(uint left, uint right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(uint left, uint right) => left >= right; @@ -360,11 +360,11 @@ static uint IBinaryNumber.Log2(uint value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IDecrementOperators.operator --(uint value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked uint IDecrementOperators.operator --(uint value) // => checked(--value); @@ -372,11 +372,11 @@ static uint IBinaryNumber.Log2(uint value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IDivisionOperators.operator /(uint left, uint right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked uint IDivisionOperators.operator /(uint left, uint right) // => checked(left / right); @@ -384,11 +384,11 @@ static uint IBinaryNumber.Log2(uint value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(uint left, uint right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(uint left, uint right) => left != right; @@ -396,11 +396,11 @@ static uint IBinaryNumber.Log2(uint value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IIncrementOperators.operator ++(uint value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked uint IIncrementOperators.operator ++(uint value) // => checked(++value); @@ -408,21 +408,21 @@ static uint IBinaryNumber.Log2(uint value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IModulusOperators.operator %(uint left, uint right) => left % right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked uint IModulusOperators.operator %(uint left, uint right) // => checked(left % right); @@ -430,18 +430,18 @@ static uint IBinaryNumber.Log2(uint value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IMultiplyOperators.operator *(uint left, uint right) => left * right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked uint IMultiplyOperators.operator *(uint left, uint right) // => checked(left * right); @@ -449,21 +449,21 @@ static uint IBinaryNumber.Log2(uint value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint INumber.Abs(uint value) => value; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint INumber.Clamp(uint value, uint min, uint max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static uint INumber.Create(TOther value) { @@ -530,7 +530,7 @@ static uint INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static uint INumber.CreateSaturating(TOther value) { @@ -612,7 +612,7 @@ static uint INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static uint INumber.CreateTruncating(TOther value) { @@ -679,31 +679,31 @@ static uint INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (uint Quotient, uint Remainder) INumber.DivRem(uint left, uint right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint INumber.Max(uint x, uint y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint INumber.Min(uint x, uint y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint INumber.Sign(uint value) => (uint)((value == 0) ? 0 : 1); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out uint result) { @@ -865,11 +865,11 @@ static bool INumber.TryCreate(TOther value, out uint result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out uint result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out uint result) => TryParse(s, style, provider, out result); @@ -877,11 +877,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFo // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out uint result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -889,15 +889,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IShiftOperators.operator <<(uint value, int shiftAmount) => value << (int)shiftAmount; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IShiftOperators.operator >>(uint value, int shiftAmount) => value >> (int)shiftAmount; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static uint IShiftOperators.operator >>>(uint value, int shiftAmount) // => value >> (int)shiftAmount; @@ -905,11 +905,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProv // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out uint result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -917,11 +917,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint ISubtractionOperators.operator -(uint left, uint right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked uint ISubtractionOperators.operator -(uint left, uint right) // => checked(left - right); @@ -929,11 +929,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IUnaryNegationOperators.operator -(uint value) => 0u - value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked uint IUnaryNegationOperators.operator -(uint value) // => checked(0u - value); @@ -941,11 +941,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static uint IUnaryPlusOperators.operator +(uint value) => +value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked uint IUnaryPlusOperators.operator +(uint value) // => checked(+value); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/UInt64.cs b/src/libraries/System.Private.CoreLib/src/System/UInt64.cs index 6b2a45f1a8ebec..7c5628bfebaeb8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UInt64.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UInt64.cs @@ -264,11 +264,11 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IAdditionOperators.operator +(ulong left, ulong right) => left + right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ulong IAdditionOperators.operator +(ulong left, ulong right) // => checked(left + right); @@ -276,30 +276,30 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBinaryInteger.LeadingZeroCount(ulong value) => (ulong)BitOperations.LeadingZeroCount(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBinaryInteger.PopCount(ulong value) => (ulong)BitOperations.PopCount(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBinaryInteger.RotateLeft(ulong value, int rotateAmount) => BitOperations.RotateLeft(value, rotateAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBinaryInteger.RotateRight(ulong value, int rotateAmount) => BitOperations.RotateRight(value, rotateAmount); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBinaryInteger.TrailingZeroCount(ulong value) => (ulong)BitOperations.TrailingZeroCount(value); @@ -307,11 +307,11 @@ static ulong IBinaryInteger.TrailingZeroCount(ulong value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(ulong value) => BitOperations.IsPow2(value); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBinaryNumber.Log2(ulong value) => (ulong)BitOperations.Log2(value); @@ -319,19 +319,19 @@ static ulong IBinaryNumber.Log2(ulong value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBitwiseOperators.operator &(ulong left, ulong right) => left & right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBitwiseOperators.operator |(ulong left, ulong right) => left | right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBitwiseOperators.operator ^(ulong left, ulong right) => left ^ right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IBitwiseOperators.operator ~(ulong value) => ~value; @@ -339,19 +339,19 @@ static ulong IBinaryNumber.Log2(ulong value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(ulong left, ulong right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(ulong left, ulong right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(ulong left, ulong right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(ulong left, ulong right) => left >= right; @@ -359,11 +359,11 @@ static ulong IBinaryNumber.Log2(ulong value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IDecrementOperators.operator --(ulong value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ulong IDecrementOperators.operator --(ulong value) // => checked(--value); @@ -371,11 +371,11 @@ static ulong IBinaryNumber.Log2(ulong value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IDivisionOperators.operator /(ulong left, ulong right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ulong IDivisionOperators.operator /(ulong left, ulong right) // => checked(left / right); @@ -383,11 +383,11 @@ static ulong IBinaryNumber.Log2(ulong value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(ulong left, ulong right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(ulong left, ulong right) => left != right; @@ -395,11 +395,11 @@ static ulong IBinaryNumber.Log2(ulong value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IIncrementOperators.operator ++(ulong value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ulong IIncrementOperators.operator ++(ulong value) // => checked(++value); @@ -407,21 +407,21 @@ static ulong IBinaryNumber.Log2(ulong value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IModulusOperators.operator %(ulong left, ulong right) => left % right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ulong IModulusOperators.operator %(ulong left, ulong right) // => checked(left % right); @@ -429,18 +429,18 @@ static ulong IBinaryNumber.Log2(ulong value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IMultiplyOperators.operator *(ulong left, ulong right) => left * right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ulong IMultiplyOperators.operator *(ulong left, ulong right) // => checked(left * right); @@ -448,21 +448,21 @@ static ulong IBinaryNumber.Log2(ulong value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong INumber.Abs(ulong value) => value; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong INumber.Clamp(ulong value, ulong min, ulong max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static ulong INumber.Create(TOther value) { @@ -529,7 +529,7 @@ static ulong INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static ulong INumber.CreateSaturating(TOther value) { @@ -607,7 +607,7 @@ static ulong INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static ulong INumber.CreateTruncating(TOther value) { @@ -674,31 +674,31 @@ static ulong INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (ulong Quotient, ulong Remainder) INumber.DivRem(ulong left, ulong right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong INumber.Max(ulong x, ulong y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong INumber.Min(ulong x, ulong y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong INumber.Sign(ulong value) => (ulong)((value == 0) ? 0 : 1); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out ulong result) { @@ -844,11 +844,11 @@ static bool INumber.TryCreate(TOther value, out ulong result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out ulong result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out ulong result) => TryParse(s, style, provider, out result); @@ -856,11 +856,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IF // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out ulong result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -868,15 +868,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPro // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IShiftOperators.operator <<(ulong value, int shiftAmount) => value << (int)shiftAmount; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IShiftOperators.operator >>(ulong value, int shiftAmount) => value >> (int)shiftAmount; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static ulong IShiftOperators.operator >>>(ulong value, int shiftAmount) // => value >> (int)shiftAmount; @@ -884,11 +884,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPro // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out ulong result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -896,11 +896,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong ISubtractionOperators.operator -(ulong left, ulong right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ulong ISubtractionOperators.operator -(ulong left, ulong right) // => checked(left - right); @@ -908,11 +908,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IUnaryNegationOperators.operator -(ulong value) => 0UL - value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ulong IUnaryNegationOperators.operator -(ulong value) // => checked(0UL - value); @@ -920,11 +920,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static ulong IUnaryPlusOperators.operator +(ulong value) => +value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked ulong IUnaryPlusOperators.operator +(ulong value) // => checked(+value); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs b/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs index b413125474f556..39e8609e8da070 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs @@ -246,11 +246,11 @@ public static bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatPro // IAdditionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IAdditionOperators.operator +(nuint left, nuint right) => (nuint)(left + right); - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nuint IAdditionOperators.operator +(nuint left, nuint right) // => checked((nuint)(left + right)); @@ -258,14 +258,14 @@ public static bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatPro // IAdditiveIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IAdditiveIdentity.AdditiveIdentity => 0; // // IBinaryInteger // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBinaryInteger.LeadingZeroCount(nuint value) { if (Environment.Is64BitProcess) @@ -278,7 +278,7 @@ static nuint IBinaryInteger.LeadingZeroCount(nuint value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBinaryInteger.PopCount(nuint value) { if (Environment.Is64BitProcess) @@ -291,7 +291,7 @@ static nuint IBinaryInteger.PopCount(nuint value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBinaryInteger.RotateLeft(nuint value, int rotateAmount) { if (Environment.Is64BitProcess) @@ -304,7 +304,7 @@ static nuint IBinaryInteger.RotateLeft(nuint value, int rotateAmount) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBinaryInteger.RotateRight(nuint value, int rotateAmount) { if (Environment.Is64BitProcess) @@ -317,7 +317,7 @@ static nuint IBinaryInteger.RotateRight(nuint value, int rotateAmount) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBinaryInteger.TrailingZeroCount(nuint value) { if (Environment.Is64BitProcess) @@ -334,7 +334,7 @@ static nuint IBinaryInteger.TrailingZeroCount(nuint value) // IBinaryNumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IBinaryNumber.IsPow2(nuint value) { if (Environment.Is64BitProcess) @@ -347,7 +347,7 @@ static bool IBinaryNumber.IsPow2(nuint value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBinaryNumber.Log2(nuint value) { if (Environment.Is64BitProcess) @@ -364,19 +364,19 @@ static nuint IBinaryNumber.Log2(nuint value) // IBitwiseOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBitwiseOperators.operator &(nuint left, nuint right) => left & right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBitwiseOperators.operator |(nuint left, nuint right) => left | right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBitwiseOperators.operator ^(nuint left, nuint right) => left ^ right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IBitwiseOperators.operator ~(nuint value) => ~value; @@ -384,19 +384,19 @@ static nuint IBinaryNumber.Log2(nuint value) // IComparisonOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <(nuint left, nuint right) => left < right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator <=(nuint left, nuint right) => left <= right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >(nuint left, nuint right) => left > right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators.operator >=(nuint left, nuint right) => left >= right; @@ -404,11 +404,11 @@ static nuint IBinaryNumber.Log2(nuint value) // IDecrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IDecrementOperators.operator --(nuint value) => --value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nuint IDecrementOperators.operator --(nuint value) // => checked(--value); @@ -416,11 +416,11 @@ static nuint IBinaryNumber.Log2(nuint value) // IDivisionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IDivisionOperators.operator /(nuint left, nuint right) => left / right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nuint IDivisionOperators.operator /(nuint left, nuint right) // => checked(left / right); @@ -428,11 +428,11 @@ static nuint IBinaryNumber.Log2(nuint value) // IEqualityOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator ==(nuint left, nuint right) => left == right; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators.operator !=(nuint left, nuint right) => left != right; @@ -440,11 +440,11 @@ static nuint IBinaryNumber.Log2(nuint value) // IIncrementOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IIncrementOperators.operator ++(nuint value) => ++value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nuint IIncrementOperators.operator ++(nuint value) // => checked(++value); @@ -452,21 +452,21 @@ static nuint IBinaryNumber.Log2(nuint value) // IMinMaxValue // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IMinMaxValue.MinValue => MinValue; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IMinMaxValue.MaxValue => MaxValue; // // IModulusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IModulusOperators.operator %(nuint left, nuint right) => left % right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nuint IModulusOperators.operator %(nuint left, nuint right) // => checked(left % right); @@ -474,18 +474,18 @@ static nuint IBinaryNumber.Log2(nuint value) // IMultiplicativeIdentity // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IMultiplicativeIdentity.MultiplicativeIdentity => 1; // // IMultiplyOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IMultiplyOperators.operator *(nuint left, nuint right) => left * right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nuint IMultiplyOperators.operator *(nuint left, nuint right) // => checked(left * right); @@ -493,21 +493,21 @@ static nuint IBinaryNumber.Log2(nuint value) // INumber // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint INumber.One => 1; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint INumber.Zero => 0; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint INumber.Abs(nuint value) => value; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint INumber.Clamp(nuint value, nuint min, nuint max) => Math.Clamp(value, min, max); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static nuint INumber.Create(TOther value) { @@ -574,7 +574,7 @@ static nuint INumber.Create(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static nuint INumber.CreateSaturating(TOther value) { @@ -655,7 +655,7 @@ static nuint INumber.CreateSaturating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static nuint INumber.CreateTruncating(TOther value) { @@ -722,31 +722,31 @@ static nuint INumber.CreateTruncating(TOther value) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static (nuint Quotient, nuint Remainder) INumber.DivRem(nuint left, nuint right) => Math.DivRem(left, right); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint INumber.Max(nuint x, nuint y) => Math.Max(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint INumber.Min(nuint x, nuint y) => Math.Min(x, y); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint INumber.Parse(string s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint INumber.Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider) => Parse(s, style, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint INumber.Sign(nuint value) => (nuint)((value == 0) ? 0 : 1); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool INumber.TryCreate(TOther value, out nuint result) { @@ -900,11 +900,11 @@ static bool INumber.TryCreate(TOther value, out nuint result) } } - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out nuint result) => TryParse(s, style, provider, out result); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out nuint result) => TryParse(s, style, provider, out result); @@ -912,11 +912,11 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IF // IParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IParseable.Parse(string s, IFormatProvider? provider) => Parse(s, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out nuint result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -924,15 +924,15 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPro // IShiftOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IShiftOperators.operator <<(nuint value, int shiftAmount) => value << (int)shiftAmount; - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IShiftOperators.operator >>(nuint value, int shiftAmount) => value >> (int)shiftAmount; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static nuint IShiftOperators.operator >>>(nuint value, int shiftAmount) // => value >> (int)shiftAmount; @@ -940,11 +940,11 @@ static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatPro // ISpanParseable // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out nuint result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -952,11 +952,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // ISubtractionOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint ISubtractionOperators.operator -(nuint left, nuint right) => left - right; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nuint ISubtractionOperators.operator -(nuint left, nuint right) // => checked(left - right); @@ -964,11 +964,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // IUnaryNegationOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IUnaryNegationOperators.operator -(nuint value) => (nuint)0 - value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nuint IUnaryNegationOperators.operator -(nuint value) // => checked((nuint)0 - value); @@ -976,11 +976,11 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider // IUnaryPlusOperators // - [RequiresPreviewFeatures] + [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static nuint IUnaryPlusOperators.operator +(nuint value) => +value; - // [RequiresPreviewFeatures] + // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] // static checked nuint IUnaryPlusOperators.operator +(nuint value) // => checked(+value); #endif // FEATURE_GENERIC_MATH diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs index df131bf1a14d04..72ceee0221fc59 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs @@ -18,6 +18,7 @@ namespace System.Runtime.Serialization using System.Collections.Concurrent; using System.Diagnostics.CodeAnalysis; using System.Diagnostics; + using System.Xml.Linq; internal abstract class DataContract { @@ -1248,9 +1249,34 @@ private static void ValidatePreviousCollectionTypes(Type collectionType, Type it { itemType = itemType.GetElementType()!; } - if (previousCollectionTypes.Contains(itemType)) + + // Do a breadth first traversal of the generic type tree to + // produce the closure of all generic argument types and + // check that none of these is in the previousCollectionTypes + List itemTypeClosure = new List(); + Queue itemTypeQueue = new Queue(); + + itemTypeQueue.Enqueue(itemType); + itemTypeClosure.Add(itemType); + + while (itemTypeQueue.Count > 0) { - throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.RecursiveCollectionType, GetClrTypeFullName(itemType)))); + itemType = itemTypeQueue.Dequeue(); + if (previousCollectionTypes.Contains(itemType)) + { + throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.RecursiveCollectionType, GetClrTypeFullName(itemType)))); + } + if (itemType.IsGenericType) + { + foreach (Type argType in itemType.GetGenericArguments()) + { + if (!itemTypeClosure.Contains(argType)) + { + itemTypeQueue.Enqueue(argType); + itemTypeClosure.Add(argType); + } + } + } } } @@ -1334,10 +1360,16 @@ internal static XmlQualifiedName GetStableName(Type type) [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] internal static XmlQualifiedName GetStableName(Type type, out bool hasDataContract) + { + return GetStableName(type, new HashSet(), out hasDataContract); + } + + [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] + internal static XmlQualifiedName GetStableName(Type type, HashSet previousCollectionTypes, out bool hasDataContract) { type = UnwrapRedundantNullableType(type); XmlQualifiedName? stableName; - if (TryGetBuiltInXmlAndArrayTypeStableName(type, out stableName)) + if (TryGetBuiltInXmlAndArrayTypeStableName(type, previousCollectionTypes, out stableName)) { hasDataContract = false; } @@ -1351,7 +1383,7 @@ internal static XmlQualifiedName GetStableName(Type type, out bool hasDataContra } else { - stableName = GetNonDCTypeStableName(type); + stableName = GetNonDCTypeStableName(type, previousCollectionTypes); hasDataContract = false; } } @@ -1389,14 +1421,17 @@ private static XmlQualifiedName GetDCTypeStableName(Type type, DataContractAttri } [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - private static XmlQualifiedName GetNonDCTypeStableName(Type type) + private static XmlQualifiedName GetNonDCTypeStableName(Type type, HashSet previousCollectionTypes) { string? name = null, ns = null; Type? itemType; CollectionDataContractAttribute? collectionContractAttribute; if (CollectionDataContract.IsCollection(type, out itemType)) - return GetCollectionStableName(type, itemType, out collectionContractAttribute); + { + ValidatePreviousCollectionTypes(type, itemType, previousCollectionTypes); + return GetCollectionStableName(type, itemType, previousCollectionTypes, out collectionContractAttribute); + } name = GetDefaultStableLocalName(type); // ensures that ContractNamespaceAttribute is honored when used with non-attributed types @@ -1412,7 +1447,7 @@ private static XmlQualifiedName GetNonDCTypeStableName(Type type) } [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - private static bool TryGetBuiltInXmlAndArrayTypeStableName(Type type, [NotNullWhen(true)] out XmlQualifiedName? stableName) + private static bool TryGetBuiltInXmlAndArrayTypeStableName(Type type, HashSet previousCollectionTypes, [NotNullWhen(true)] out XmlQualifiedName? stableName) { stableName = null; @@ -1431,8 +1466,9 @@ private static bool TryGetBuiltInXmlAndArrayTypeStableName(Type type, [NotNullWh } else if (type.IsArray) { - CollectionDataContractAttribute? collectionContractAttribute; - stableName = GetCollectionStableName(type, type.GetElementType()!, out collectionContractAttribute); + Type itemType = type.GetElementType()!; + ValidatePreviousCollectionTypes(type, itemType, previousCollectionTypes); + stableName = GetCollectionStableName(type, itemType, previousCollectionTypes, out _); } return stableName != null; } @@ -1456,6 +1492,12 @@ internal static bool TryGetDCAttribute(Type type, [NotNullWhen(true)] out DataCo [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] internal static XmlQualifiedName GetCollectionStableName(Type type, Type itemType, out CollectionDataContractAttribute? collectionContractAttribute) + { + return GetCollectionStableName(type, itemType, new HashSet(), out collectionContractAttribute); + } + + [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] + internal static XmlQualifiedName GetCollectionStableName(Type type, Type itemType, HashSet previousCollectionTypes, out CollectionDataContractAttribute? collectionContractAttribute) { string? name, ns; object[] collectionContractAttributes = type.GetCustomAttributes(Globals.TypeOfCollectionDataContractAttribute, false).ToArray(); @@ -1492,7 +1534,7 @@ internal static XmlQualifiedName GetCollectionStableName(Type type, Type itemTyp { collectionContractAttribute = null; string arrayOfPrefix = Globals.ArrayPrefix + GetArrayPrefix(ref itemType); - XmlQualifiedName elementStableName = GetStableName(itemType); + XmlQualifiedName elementStableName = GetStableName(itemType, previousCollectionTypes, out _); name = arrayOfPrefix + elementStableName.Name; ns = GetCollectionNamespace(elementStableName.Namespace); } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/DataContractJsonSerializer.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/DataContractJsonSerializer.cs index 74f4d0c0e0930c..30d2deda9e19d8 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/DataContractJsonSerializer.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/DataContractJsonSerializer.cs @@ -20,30 +20,25 @@ namespace System.Runtime.Serialization.Json public sealed class DataContractJsonSerializer : XmlObjectSerializer { - private const char BACK_SLASH = '\\'; - private const char FORWARD_SLASH = '/'; - private const char HIGH_SURROGATE_START = (char)0xd800; - private const char LOW_SURROGATE_END = (char)0xdfff; - private const char MAX_CHAR = (char)0xfffe; - private const char WHITESPACE = ' '; - - internal IList? knownTypeList; internal DataContractDictionary? knownDataContracts; - private readonly EmitTypeInformation _emitTypeInformation; + private EmitTypeInformation _emitTypeInformation; private ReadOnlyCollection? _knownTypeCollection; - private readonly int _maxItemsInObjectGraph; - private readonly bool _serializeReadOnlyTypes; - private readonly DateTimeFormat? _dateTimeFormat; - private readonly bool _useSimpleDictionaryFormat; + private int _maxItemsInObjectGraph; + private bool _serializeReadOnlyTypes; + private DateTimeFormat? _dateTimeFormat; + private bool _useSimpleDictionaryFormat; + private bool _ignoreExtensionDataObject; + private DataContract? _rootContract; // post-surrogate + private XmlDictionaryString? _rootName; + private bool _rootNameRequiresMapping; + private Type _rootType; - private readonly DataContractJsonSerializerImpl _serializer; - private readonly bool _ignoreExtensionDataObject; [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] public DataContractJsonSerializer(Type type) + : this(type, (IEnumerable?)null) { - _serializer = new DataContractJsonSerializerImpl(type); } [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] @@ -60,8 +55,8 @@ public DataContractJsonSerializer(Type type, XmlDictionaryString? rootName) [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] public DataContractJsonSerializer(Type type, IEnumerable? knownTypes) + : this(type, null, knownTypes, int.MaxValue, false, false) { - _serializer = new DataContractJsonSerializerImpl(type, knownTypes); } [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] @@ -72,478 +67,25 @@ public DataContractJsonSerializer(Type type, string? rootName, IEnumerable [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] public DataContractJsonSerializer(Type type, XmlDictionaryString? rootName, IEnumerable? knownTypes) + : this(type, rootName, knownTypes, int.MaxValue, false, false) { - _serializer = new DataContractJsonSerializerImpl(type, rootName, knownTypes); } [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] public DataContractJsonSerializer(Type type, DataContractJsonSerializerSettings? settings) { - _serializer = new DataContractJsonSerializerImpl(type, settings); - } - - public bool IgnoreExtensionDataObject - { - get { return _ignoreExtensionDataObject; } - } - - public ReadOnlyCollection KnownTypes - { - get - { - if (_knownTypeCollection == null) - { - if (knownTypeList != null) - { - _knownTypeCollection = new ReadOnlyCollection(knownTypeList); - } - else - { - _knownTypeCollection = new ReadOnlyCollection(Type.EmptyTypes); - } - } - return _knownTypeCollection; - } - } - - internal override DataContractDictionary? KnownDataContracts - { - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - get - { - if (this.knownDataContracts == null && this.knownTypeList != null) - { - // This assignment may be performed concurrently and thus is a race condition. - // It's safe, however, because at worse a new (and identical) dictionary of - // data contracts will be created and re-assigned to this field. Introduction - // of a lock here could lead to deadlocks. - this.knownDataContracts = XmlObjectSerializerContext.GetDataContractsForKnownTypes(this.knownTypeList); - } - return this.knownDataContracts; - } - } - - public int MaxItemsInObjectGraph - { - get { return _maxItemsInObjectGraph; } - } - - public DateTimeFormat? DateTimeFormat - { - get - { - return _dateTimeFormat; - } - } - - public EmitTypeInformation EmitTypeInformation - { - get - { - return _emitTypeInformation; - } - } - - public bool SerializeReadOnlyTypes - { - get - { - return _serializeReadOnlyTypes; - } - } - - - public bool UseSimpleDictionaryFormat - { - get - { - return _useSimpleDictionaryFormat; - } - } - - internal static void CheckIfTypeIsReference(DataContract dataContract) - { - if (dataContract.IsReference) - { - throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( - XmlObjectSerializer.CreateSerializationException(SR.Format( - SR.JsonUnsupportedForIsReference, - DataContract.GetClrTypeFullName(dataContract.UnderlyingType), - dataContract.IsReference))); - } - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - internal static DataContract GetDataContract(DataContract declaredTypeContract, Type declaredType, Type objectType) - { - DataContract contract = DataContractSerializer.GetDataContract(declaredTypeContract, declaredType, objectType); - CheckIfTypeIsReference(contract); - return contract; - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override void WriteObject(Stream stream, object? graph) - { - _serializer.WriteObject(stream, graph); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override void WriteObject(XmlWriter writer, object? graph) - { - _serializer.WriteObject(writer, graph); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override void WriteObject(XmlDictionaryWriter writer, object? graph) - { - _serializer.WriteObject(writer, graph); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override object? ReadObject(Stream stream) - { - return _serializer.ReadObject(stream); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override object? ReadObject(XmlReader reader) - { - return _serializer.ReadObject(reader); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override object? ReadObject(XmlReader reader, bool verifyObjectName) - { - return _serializer.ReadObject(reader, verifyObjectName); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override object? ReadObject(XmlDictionaryReader reader) - { - return _serializer.ReadObject(reader); - } - - private List GetKnownTypesFromContext(XmlObjectSerializerContext context, IList? serializerKnownTypeList) - { - List knownTypesList = new List(); - if (context != null) - { - List stableNames = new List(); - Dictionary[] entries = context.scopedKnownTypes.dataContractDictionaries; - if (entries != null) - { - for (int i = 0; i < entries.Length; i++) - { - Dictionary entry = entries[i]; - if (entry != null) - { - foreach (KeyValuePair pair in entry) - { - if (!stableNames.Contains(pair.Key)) - { - stableNames.Add(pair.Key); - knownTypesList.Add(pair.Value.UnderlyingType); - } - } - } - } - } - if (serializerKnownTypeList != null) - { - knownTypesList.AddRange(serializerKnownTypeList); - } - } - return knownTypesList; - } - - internal static void InvokeOnSerializing(object value, DataContract contract, XmlObjectSerializerWriteContextComplexJson context) - { - if (contract is ClassDataContract classContract) - { - if (classContract.BaseContract != null) - InvokeOnSerializing(value, classContract.BaseContract, context); - if (classContract.OnSerializing != null) - { - bool memberAccessFlag = classContract.RequiresMemberAccessForWrite(null); - try - { - classContract.OnSerializing.Invoke(value, new object[] { context.GetStreamingContext() }); - } - catch (SecurityException securityException) - { - if (memberAccessFlag) - { - classContract.RequiresMemberAccessForWrite(securityException); - } - else - { - throw; - } - } - catch (TargetInvocationException targetInvocationException) - { - if (targetInvocationException.InnerException == null) - throw; - //We are catching the TIE here and throws the inner exception only, - //this is needed to have a consistent exception story in all serializers - throw targetInvocationException.InnerException; - } - } - } - } - - internal static void InvokeOnSerialized(object value, DataContract contract, XmlObjectSerializerWriteContextComplexJson context) - { - if (contract is ClassDataContract classContract) - { - if (classContract.BaseContract != null) - InvokeOnSerialized(value, classContract.BaseContract, context); - if (classContract.OnSerialized != null) - { - bool memberAccessFlag = classContract.RequiresMemberAccessForWrite(null); - try - { - classContract.OnSerialized.Invoke(value, new object[] { context.GetStreamingContext() }); - } - catch (SecurityException securityException) - { - if (memberAccessFlag) - { - classContract.RequiresMemberAccessForWrite(securityException); - } - else - { - throw; - } - } - catch (TargetInvocationException targetInvocationException) - { - if (targetInvocationException.InnerException == null) - throw; - //We are catching the TIE here and throws the inner exception only, - //this is needed to have a consistent exception story in all serializers - throw targetInvocationException.InnerException; - } - } - } - } - - internal static void InvokeOnDeserializing(object value, DataContract contract, XmlObjectSerializerReadContextComplexJson context) - { - if (contract is ClassDataContract classContract) - { - if (classContract.BaseContract != null) - InvokeOnDeserializing(value, classContract.BaseContract, context); - if (classContract.OnDeserializing != null) - { - bool memberAccessFlag = classContract.RequiresMemberAccessForRead(null); - try - { - classContract.OnDeserializing.Invoke(value, new object[] { context.GetStreamingContext() }); - } - catch (SecurityException securityException) - { - if (memberAccessFlag) - { - classContract.RequiresMemberAccessForRead(securityException); - } - else - { - throw; - } - } - catch (TargetInvocationException targetInvocationException) - { - if (targetInvocationException.InnerException == null) - throw; - //We are catching the TIE here and throws the inner exception only, - //this is needed to have a consistent exception story in all serializers - throw targetInvocationException.InnerException; - } - } - } - } - - internal static void InvokeOnDeserialized(object value, DataContract contract, XmlObjectSerializerReadContextComplexJson context) - { - if (contract is ClassDataContract classContract) - { - if (classContract.BaseContract != null) - InvokeOnDeserialized(value, classContract.BaseContract, context); - if (classContract.OnDeserialized != null) - { - bool memberAccessFlag = classContract.RequiresMemberAccessForRead(null); - try - { - classContract.OnDeserialized.Invoke(value, new object[] { context.GetStreamingContext() }); - } - catch (SecurityException securityException) - { - if (memberAccessFlag) - { - classContract.RequiresMemberAccessForRead(securityException); - } - else - { - throw; - } - } - catch (TargetInvocationException targetInvocationException) - { - if (targetInvocationException.InnerException == null) - throw; - //We are catching the TIE here and throws the inner exception only, - //this is needed to have a consistent exception story in all serializers - throw targetInvocationException.InnerException; - } - } - } - } - - internal static bool CharacterNeedsEscaping(char ch) - { - return (ch == FORWARD_SLASH || ch == JsonGlobals.QuoteChar || ch < WHITESPACE || ch == BACK_SLASH - || (ch >= HIGH_SURROGATE_START && (ch <= LOW_SURROGATE_END || ch >= MAX_CHAR))); - } - - internal static bool CheckIfJsonNameRequiresMapping(string jsonName) - { - if (jsonName != null) + if (settings == null) { - if (!DataContract.IsValidNCName(jsonName)) - { - return true; - } - - for (int i = 0; i < jsonName.Length; i++) - { - if (CharacterNeedsEscaping(jsonName[i])) - { - return true; - } - } + settings = new DataContractJsonSerializerSettings(); } - return false; - } - - internal static bool CheckIfJsonNameRequiresMapping(XmlDictionaryString jsonName) - { - return (jsonName == null) ? false : CheckIfJsonNameRequiresMapping(jsonName.Value); - } - internal static string ConvertXmlNameToJsonName(string xmlName) - { - return XmlConvert.DecodeName(xmlName); - } - - internal static XmlDictionaryString? ConvertXmlNameToJsonName(XmlDictionaryString? xmlName) - { - return (xmlName == null) ? null : new XmlDictionary().Add(ConvertXmlNameToJsonName(xmlName.Value)); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - internal static object? ReadJsonValue(DataContract contract, XmlReaderDelegator reader, XmlObjectSerializerReadContextComplexJson context) - { - return JsonDataContract.GetJsonDataContract(contract).ReadJsonValue(reader, context); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - internal static void WriteJsonValue(JsonDataContract contract, XmlWriterDelegator writer, object graph, XmlObjectSerializerWriteContextComplexJson context, RuntimeTypeHandle declaredTypeHandle) - { - contract.WriteJsonValue(writer, graph, context, declaredTypeHandle); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override void WriteStartObject(XmlWriter writer, object? graph) - { - _serializer.WriteStartObject(writer, graph); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override void WriteStartObject(XmlDictionaryWriter writer, object? graph) - { - _serializer.WriteStartObject(writer, graph); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override void WriteObjectContent(XmlWriter writer, object? graph) - { - _serializer.WriteObjectContent(writer, graph); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override void WriteObjectContent(XmlDictionaryWriter writer, object? graph) - { - _serializer.WriteObjectContent(writer, graph); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override void WriteEndObject(XmlWriter writer) - { - _serializer.WriteEndObject(writer); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override void WriteEndObject(XmlDictionaryWriter writer) - { - _serializer.WriteEndObject(writer); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override object? ReadObject(XmlDictionaryReader reader, bool verifyObjectName) - { - return _serializer.ReadObject(reader, verifyObjectName); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override bool IsStartObject(XmlReader reader) - { - return _serializer.IsStartObject(reader); - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public override bool IsStartObject(XmlDictionaryReader reader) - { - return _serializer.IsStartObject(reader); - } - } - - internal sealed class DataContractJsonSerializerImpl : XmlObjectSerializer - { - internal IList? knownTypeList; - internal DataContractDictionary? knownDataContracts; - private EmitTypeInformation _emitTypeInformation; - private bool _ignoreExtensionDataObject; - private ReadOnlyCollection? _knownTypeCollection; - private int _maxItemsInObjectGraph; - private DataContract? _rootContract; // post-surrogate - private XmlDictionaryString? _rootName; - private bool _rootNameRequiresMapping; - private Type _rootType; - private bool _serializeReadOnlyTypes; - private DateTimeFormat? _dateTimeFormat; - private bool _useSimpleDictionaryFormat; - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public DataContractJsonSerializerImpl(Type type) - : this(type, (IEnumerable?)null) - { - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public DataContractJsonSerializerImpl(Type type, IEnumerable? knownTypes) - : this(type, null, knownTypes, int.MaxValue, false, false) - { - } - - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public DataContractJsonSerializerImpl(Type type, XmlDictionaryString? rootName, IEnumerable? knownTypes) - : this(type, rootName, knownTypes, int.MaxValue, false, false) - { + XmlDictionaryString? rootName = (settings.RootName == null) ? null : new XmlDictionary(1).Add(settings.RootName); + Initialize(type, rootName, settings.KnownTypes, settings.MaxItemsInObjectGraph, settings.IgnoreExtensionDataObject, + settings.EmitTypeInformation, settings.SerializeReadOnlyTypes, settings.DateTimeFormat, settings.UseSimpleDictionaryFormat); } [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - internal DataContractJsonSerializerImpl(Type type, + internal DataContractJsonSerializer(Type type, XmlDictionaryString? rootName, IEnumerable? knownTypes, int maxItemsInObjectGraph, @@ -554,17 +96,9 @@ internal DataContractJsonSerializerImpl(Type type, Initialize(type, rootName, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, emitTypeInformation, false, null, false); } - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - public DataContractJsonSerializerImpl(Type type, DataContractJsonSerializerSettings? settings) + public bool IgnoreExtensionDataObject { - if (settings == null) - { - settings = new DataContractJsonSerializerSettings(); - } - - XmlDictionaryString? rootName = (settings.RootName == null) ? null : new XmlDictionary(1).Add(settings.RootName); - Initialize(type, rootName, settings.KnownTypes, settings.MaxItemsInObjectGraph, settings.IgnoreExtensionDataObject, - settings.EmitTypeInformation, settings.SerializeReadOnlyTypes, settings.DateTimeFormat, settings.UseSimpleDictionaryFormat); + get { return _ignoreExtensionDataObject; } } public ReadOnlyCollection KnownTypes @@ -603,16 +137,16 @@ internal override DataContractDictionary? KnownDataContracts } } - internal int MaxItemsInObjectGraph + public int MaxItemsInObjectGraph { get { return _maxItemsInObjectGraph; } } - internal bool AlwaysEmitTypeInformation + public DateTimeFormat? DateTimeFormat { get { - return _emitTypeInformation == EmitTypeInformation.Always; + return _dateTimeFormat; } } @@ -632,13 +166,6 @@ public bool SerializeReadOnlyTypes } } - public DateTimeFormat? DateTimeFormat - { - get - { - return _dateTimeFormat; - } - } public bool UseSimpleDictionaryFormat { @@ -893,7 +420,7 @@ internal override bool InternalIsStartObject(XmlReaderDelegator reader) DataContract contract = RootContract; if (contract.IsPrimitive && object.ReferenceEquals(contract.UnderlyingType, _rootType))// handle Nullable differently { - return DataContractJsonSerializerImpl.ReadJsonValue(contract, xmlReader, null); + return DataContractJsonSerializer.ReadJsonValue(contract, xmlReader, null); } XmlObjectSerializerReadContextComplexJson context = XmlObjectSerializerReadContextComplexJson.CreateContext(this, contract); @@ -926,11 +453,6 @@ internal override void InternalWriteObjectContent(XmlWriterDelegator writer, obj Type declaredType = contract.UnderlyingType; Type graphType = (graph == null) ? declaredType : graph.GetType(); - //if (dataContractSurrogate != null) - //{ - // graph = DataContractSerializer.SurrogateToDataContractType(dataContractSurrogate, graph, declaredType, ref graphType); - //} - if (graph == null) { WriteJsonNull(writer); @@ -947,13 +469,13 @@ internal override void InternalWriteObjectContent(XmlWriterDelegator writer, obj } else { - DataContractJsonSerializerImpl.WriteJsonValue(JsonDataContract.GetJsonDataContract(contract), writer, graph, null, declaredType.TypeHandle); // XmlObjectSerializerWriteContextComplexJson + DataContractJsonSerializer.WriteJsonValue(JsonDataContract.GetJsonDataContract(contract), writer, graph, null, declaredType.TypeHandle); // XmlObjectSerializerWriteContextComplexJson } } else { XmlObjectSerializerWriteContextComplexJson context = XmlObjectSerializerWriteContextComplexJson.CreateContext(this, RootContract); - contract = DataContractJsonSerializerImpl.GetDataContract(contract, declaredType, graphType); + contract = DataContractJsonSerializer.GetDataContract(contract, declaredType, graphType); if (contract.CanContainReferences) { context.OnHandleReference(writer, graph, true); // canContainCyclicReference @@ -1057,7 +579,11 @@ internal static void CheckIfTypeIsReference(DataContract dataContract) { if (dataContract.IsReference) { - throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.JsonUnsupportedForIsReference, DataContract.GetClrTypeFullName(dataContract.UnderlyingType), dataContract.IsReference)); + throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( + XmlObjectSerializer.CreateSerializationException(SR.Format( + SR.JsonUnsupportedForIsReference, + DataContract.GetClrTypeFullName(dataContract.UnderlyingType), + dataContract.IsReference))); } } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonClassDataContract.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonClassDataContract.cs index 148b3eebd7d2b1..6ff59d9eaa7f2b 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonClassDataContract.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonClassDataContract.cs @@ -21,12 +21,6 @@ public JsonClassDataContract(ClassDataContract traditionalDataContract) _helper = (base.Helper as JsonClassDataContractCriticalHelper)!; } - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - private JsonFormatClassReaderDelegate CreateJsonFormatReaderDelegate() - { - return new ReflectionJsonClassReader(TraditionalClassDataContract).ReflectionReadClass; - } - internal JsonFormatClassReaderDelegate JsonFormatReaderDelegate { [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] @@ -41,7 +35,7 @@ internal JsonFormatClassReaderDelegate JsonFormatReaderDelegate JsonFormatClassReaderDelegate tempDelegate; if (DataContractSerializer.Option == SerializationOption.ReflectionOnly) { - tempDelegate = CreateJsonFormatReaderDelegate(); + tempDelegate = new ReflectionJsonClassReader(TraditionalClassDataContract).ReflectionReadClass; } else { @@ -57,12 +51,6 @@ internal JsonFormatClassReaderDelegate JsonFormatReaderDelegate } } - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - private JsonFormatClassWriterDelegate CreateJsonFormatWriterDelegate() - { - return new ReflectionJsonFormatWriter().ReflectionWriteClass; - } - internal JsonFormatClassWriterDelegate JsonFormatWriterDelegate { [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] @@ -77,7 +65,7 @@ internal JsonFormatClassWriterDelegate JsonFormatWriterDelegate JsonFormatClassWriterDelegate tempDelegate; if (DataContractSerializer.Option == SerializationOption.ReflectionOnly) { - tempDelegate = CreateJsonFormatWriterDelegate(); + tempDelegate = new ReflectionJsonFormatWriter().ReflectionWriteClass; } else { @@ -171,7 +159,7 @@ private void CopyMembersAndCheckDuplicateNames() else { memberTable.Add(_traditionalClassDataContract.MemberNames[i].Value, null); - decodedMemberNames[i] = DataContractJsonSerializerImpl.ConvertXmlNameToJsonName(_traditionalClassDataContract.MemberNames[i]); + decodedMemberNames[i] = DataContractJsonSerializer.ConvertXmlNameToJsonName(_traditionalClassDataContract.MemberNames[i]); } } _memberNames = decodedMemberNames; diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonCollectionDataContract.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonCollectionDataContract.cs index 8fe2e96c10c4a6..0ed183e05624d4 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonCollectionDataContract.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonCollectionDataContract.cs @@ -21,12 +21,6 @@ public JsonCollectionDataContract(CollectionDataContract traditionalDataContract _helper = (base.Helper as JsonCollectionDataContractCriticalHelper)!; } - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - private JsonFormatCollectionReaderDelegate CreateJsonFormatReaderDelegate() - { - return new ReflectionJsonCollectionReader().ReflectionReadCollection; - } - internal JsonFormatCollectionReaderDelegate JsonFormatReaderDelegate { [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] @@ -41,7 +35,7 @@ internal JsonFormatCollectionReaderDelegate JsonFormatReaderDelegate JsonFormatCollectionReaderDelegate tempDelegate; if (DataContractSerializer.Option == SerializationOption.ReflectionOnly) { - tempDelegate = CreateJsonFormatReaderDelegate(); + tempDelegate = new ReflectionJsonCollectionReader().ReflectionReadCollection; } else { @@ -57,12 +51,6 @@ internal JsonFormatCollectionReaderDelegate JsonFormatReaderDelegate } } - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - private JsonFormatGetOnlyCollectionReaderDelegate CreateJsonFormatGetOnlyReaderDelegate() - { - return new ReflectionJsonCollectionReader().ReflectionReadGetOnlyCollection; - } - internal JsonFormatGetOnlyCollectionReaderDelegate JsonFormatGetOnlyReaderDelegate { [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] @@ -83,7 +71,7 @@ internal JsonFormatGetOnlyCollectionReaderDelegate JsonFormatGetOnlyReaderDelega JsonFormatGetOnlyCollectionReaderDelegate tempDelegate; if (DataContractSerializer.Option == SerializationOption.ReflectionOnly) { - tempDelegate = CreateJsonFormatGetOnlyReaderDelegate(); + tempDelegate = new ReflectionJsonCollectionReader().ReflectionReadGetOnlyCollection; } else { @@ -99,13 +87,6 @@ internal JsonFormatGetOnlyCollectionReaderDelegate JsonFormatGetOnlyReaderDelega } } - [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] - private JsonFormatCollectionWriterDelegate CreateJsonFormatWriterDelegate() - { - return new ReflectionJsonFormatWriter().ReflectionWriteCollection; - } - - internal JsonFormatCollectionWriterDelegate JsonFormatWriterDelegate { [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] @@ -120,7 +101,7 @@ internal JsonFormatCollectionWriterDelegate JsonFormatWriterDelegate JsonFormatCollectionWriterDelegate tempDelegate; if (DataContractSerializer.Option == SerializationOption.ReflectionOnly) { - tempDelegate = CreateJsonFormatWriterDelegate(); + tempDelegate = new ReflectionJsonFormatWriter().ReflectionWriteCollection; } else { diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonEncodingStreamWrapper.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonEncodingStreamWrapper.cs index fa2b5ae042a800..44b0bda31e9942 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonEncodingStreamWrapper.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonEncodingStreamWrapper.cs @@ -439,8 +439,7 @@ private void InitForReading(Stream inputStream, Encoding? expectedEncoding) { try { - //this.stream = new BufferedStream(inputStream); - _stream = inputStream; + _stream = new BufferedStream(inputStream); SupportedEncoding expectedEnc = GetSupportedEncoding(expectedEncoding); SupportedEncoding dataEnc = ReadEncoding(); @@ -472,8 +471,7 @@ private void InitForReading(Stream inputStream, Encoding? expectedEncoding) private void InitForWriting(Stream outputStream, Encoding writeEncoding) { _encoding = writeEncoding; - //this.stream = new BufferedStream(outputStream); - _stream = outputStream; + _stream = new BufferedStream(outputStream); // Set the encoding code _encodingCode = GetSupportedEncoding(writeEncoding); diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatGeneratorStatics.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatGeneratorStatics.cs index d7f05cd947be5b..fa3a0fea90b17c 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatGeneratorStatics.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatGeneratorStatics.cs @@ -13,6 +13,8 @@ namespace System.Runtime.Serialization { public static class JsonFormatGeneratorStatics { + private static MethodInfo? s_boxPointer; + private static PropertyInfo? s_collectionItemNameProperty; private static ConstructorInfo? s_extensionDataObjectCtor; @@ -59,6 +61,8 @@ public static class JsonFormatGeneratorStatics private static PropertyInfo? s_typeHandleProperty; + private static MethodInfo? s_unboxPointer; + private static PropertyInfo? s_useSimpleDictionaryFormatReadProperty; private static PropertyInfo? s_useSimpleDictionaryFormatWriteProperty; @@ -81,6 +85,19 @@ public static class JsonFormatGeneratorStatics private static MethodInfo? s_getJsonMemberNameMethod; + public static MethodInfo BoxPointer + { + get + { + if (s_boxPointer == null) + { + s_boxPointer = typeof(Pointer).GetMethod("Box"); + Debug.Assert(s_boxPointer != null); + } + return s_boxPointer; + } + } + public static PropertyInfo CollectionItemNameProperty { get @@ -349,6 +366,18 @@ public static PropertyInfo TypeHandleProperty return s_typeHandleProperty; } } + public static MethodInfo UnboxPointer + { + get + { + if (s_unboxPointer == null) + { + s_unboxPointer = typeof(Pointer).GetMethod("Unbox"); + Debug.Assert(s_unboxPointer != null); + } + return s_unboxPointer; + } + } public static PropertyInfo UseSimpleDictionaryFormatReadProperty { get diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatReaderGenerator.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatReaderGenerator.cs index 9f2bad8787fb11..13be22414a5cb9 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatReaderGenerator.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatReaderGenerator.cs @@ -563,7 +563,14 @@ private void InternalDeserialize(LocalBuilder value, Type type, string name) _ilg.Load(string.Empty); _ilg.Call(XmlFormatGeneratorStatics.InternalDeserializeMethod); - _ilg.ConvertValue(Globals.TypeOfObject, type); + if (type.IsPointer) + { + _ilg.Call(JsonFormatGeneratorStatics.UnboxPointer); + } + else + { + _ilg.ConvertValue(Globals.TypeOfObject, type); + } _ilg.Stloc(value); } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs index a76f91878baa0a..94089b749f4c3f 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs @@ -107,6 +107,10 @@ internal JsonFormatCollectionWriterDelegate GenerateCollectionWriter(CollectionD } } InitArgs(collectionContract.UnderlyingType); + if (collectionContract.IsReadOnlyContract) + { + ThrowIfCannotSerializeReadOnlyTypes(collectionContract); + } WriteCollection(collectionContract); return (JsonFormatCollectionWriterDelegate)_ilg.EndMethod(); } @@ -162,6 +166,23 @@ private void InitArgs(Type objType) _ilg.Stloc(_objectLocal); } + private void ThrowIfCannotSerializeReadOnlyTypes(CollectionDataContract classContract) + { + ThrowIfCannotSerializeReadOnlyTypes(XmlFormatGeneratorStatics.CollectionSerializationExceptionMessageProperty); + } + + private void ThrowIfCannotSerializeReadOnlyTypes(PropertyInfo serializationExceptionMessageProperty) + { + _ilg.Load(_contextArg); + _ilg.LoadMember(XmlFormatGeneratorStatics.SerializeReadOnlyTypesProperty); + _ilg.IfNot(); + _ilg.Load(_dataContractArg); + _ilg.LoadMember(serializationExceptionMessageProperty); + _ilg.Load(null); + _ilg.Call(XmlFormatGeneratorStatics.ThrowInvalidDataContractExceptionMethod); + _ilg.EndIf(); + } + private void InvokeOnSerializing(ClassDataContract classContract) { if (classContract.BaseContract != null) @@ -243,7 +264,7 @@ private int WriteMembers(ClassDataContract classContract, LocalBuilder? extensio _ilg.IfNotDefaultValue(memberValue); } - bool requiresNameAttribute = DataContractJsonSerializerImpl.CheckIfXmlNameRequiresMapping(classContract.MemberNames![i]); + bool requiresNameAttribute = DataContractJsonSerializer.CheckIfXmlNameRequiresMapping(classContract.MemberNames![i]); if (requiresNameAttribute || !TryWritePrimitive(memberType, memberValue, member.MemberInfo, arrayItemIndex: null, name: null, nameIndex: i + _childElementIndex)) { // Note: DataContractSerializer has member-conflict logic here to deal with the schema export @@ -554,7 +575,7 @@ private bool TryWritePrimitiveArray(Type type, Type itemType, LocalBuilder value return false; string? writeArrayMethod = null; - switch (itemType.GetTypeCode()) + switch (Type.GetTypeCode(itemType)) { case TypeCode.Boolean: writeArrayMethod = "WriteJsonBooleanArray"; @@ -616,6 +637,15 @@ private void WriteObjectAttribute() private void WriteValue(LocalBuilder memberValue) { Type memberType = memberValue.LocalType; + if (memberType.IsPointer) + { + _ilg.Load(memberValue); + _ilg.Load(memberType); + _ilg.Call(JsonFormatGeneratorStatics.BoxPointer); + memberType = typeof(System.Reflection.Pointer); + memberValue = _ilg.DeclareLocal(memberType, "memberValueRefPointer"); + _ilg.Store(memberValue); + } bool isNullableOfT = (memberType.IsGenericType && memberType.GetGenericTypeDefinition() == Globals.TypeOfNullable); if (memberType.IsValueType && !isNullableOfT) @@ -739,7 +769,7 @@ private void WriteStartElement(LocalBuilder? nameLocal, int nameIndex) // namespace _ilg.Load(null); - if (nameLocal != null && nameLocal.LocalType == Globals.TypeOfString) + if (nameLocal != null && nameLocal.LocalType == typeof(string)) { _ilg.Call(JsonFormatGeneratorStatics.WriteStartElementStringMethod); } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonObjectDataContract.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonObjectDataContract.cs index 40e34203e1559a..d7e72a18d01c63 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonObjectDataContract.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonObjectDataContract.cs @@ -44,7 +44,7 @@ public JsonObjectDataContract(DataContract traditionalDataContract) break; case JsonGlobals.arrayString: // Read as object array - return DataContractJsonSerializerImpl.ReadJsonValue(DataContract.GetDataContract(Globals.TypeOfObjectArray), jsonReader, context); + return DataContractJsonSerializer.ReadJsonValue(DataContract.GetDataContract(Globals.TypeOfObjectArray), jsonReader, context); default: throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.JsonUnexpectedAttributeValue, contentMode)); } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/ReflectionJsonFormatWriter.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/ReflectionJsonFormatWriter.cs index 10aff105f6b92f..aea41cb1bdf6fa 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/ReflectionJsonFormatWriter.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/ReflectionJsonFormatWriter.cs @@ -243,7 +243,7 @@ protected override int ReflectionWriteMembers(XmlWriterDelegator xmlWriter, obje { memberValue = ReflectionGetMemberValue(obj, member); } - bool requiresNameAttribute = DataContractJsonSerializerImpl.CheckIfXmlNameRequiresMapping(classContract.MemberNames![i]); + bool requiresNameAttribute = DataContractJsonSerializer.CheckIfXmlNameRequiresMapping(classContract.MemberNames![i]); PrimitiveDataContract? primitiveContract = member.MemberPrimitiveContract; if (requiresNameAttribute || !ReflectionTryWritePrimitive(xmlWriter, context, memberType, memberValue, memberNames[i + childElementIndex] /*name*/, null/*ns*/, primitiveContract)) { diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonReader.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonReader.cs index 21c65485619221..a4faf4835350ce 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonReader.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonReader.cs @@ -337,7 +337,7 @@ private bool IsReadingComplexText } } - protected override void Dispose(bool disposing) + public override void Close() { OnXmlDictionaryReaderClose? onClose = _onReaderClose; _onReaderClose = null; @@ -353,7 +353,8 @@ protected override void Dispose(bool disposing) throw new InvalidOperationException(SR.GenericCallbackException, e); } } - base.Dispose(disposing); + + base.Close(); } public override void EndCanonicalization() diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonWriter.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonWriter.cs index d52d1fabaf4a34..8ce76f7b50f282 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonWriter.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonWriter.cs @@ -193,7 +193,7 @@ private static BinHexEncoding BinHexEncoding private bool WrittenNameWithMapping => (_nameState & NameState.WrittenNameWithMapping) == NameState.WrittenNameWithMapping; - protected override void Dispose(bool disposing) + public override void Close() { if (!IsClosed) { @@ -219,7 +219,7 @@ protected override void Dispose(bool disposing) } } - base.Dispose(disposing); + base.Close(); } public override void Flush() @@ -262,21 +262,20 @@ public void SetOutput(Stream stream, Encoding encoding, bool ownsStream) { throw new ArgumentNullException(nameof(encoding)); } - Encoding? tempEncoding = encoding; - if (tempEncoding.WebName != Encoding.UTF8.WebName) + if (encoding.WebName != Encoding.UTF8.WebName) { - stream = new JsonEncodingStreamWrapper(stream, tempEncoding, false); + stream = new JsonEncodingStreamWrapper(stream, encoding, false); } else { - tempEncoding = null; + encoding = null!; } if (_nodeWriter == null) { _nodeWriter = new JsonNodeWriter(); } - _nodeWriter.SetOutput(stream, ownsStream, tempEncoding); + _nodeWriter.SetOutput(stream, ownsStream, encoding); InitializeWriter(); } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlObjectSerializerReadContextComplexJson.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlObjectSerializerReadContextComplexJson.cs index d571c7325c48c6..a43cb274d4cdad 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlObjectSerializerReadContextComplexJson.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlObjectSerializerReadContextComplexJson.cs @@ -7,8 +7,6 @@ using System.Reflection; using System.Xml; using System.Runtime.Serialization; -using DataContractDictionary = System.Collections.Generic.Dictionary; -using System.Diagnostics; using System.Diagnostics.CodeAnalysis; namespace System.Runtime.Serialization.Json @@ -19,8 +17,8 @@ internal sealed class XmlObjectSerializerReadContextComplexJson : XmlObjectSeria private readonly DateTimeFormat? _dateTimeFormat; private readonly bool _useSimpleDictionaryFormat; - internal XmlObjectSerializerReadContextComplexJson(DataContractJsonSerializerImpl serializer, DataContract rootTypeDataContract) - : base(serializer, serializer.MaxItemsInObjectGraph, default(StreamingContext), false) + internal XmlObjectSerializerReadContextComplexJson(DataContractJsonSerializer serializer, DataContract rootTypeDataContract) + : base(serializer, serializer.MaxItemsInObjectGraph, new StreamingContext(StreamingContextStates.All), serializer.IgnoreExtensionDataObject) { this.rootTypeDataContract = rootTypeDataContract; this.serializerKnownTypeList = serializer.knownTypeList; @@ -28,7 +26,7 @@ internal XmlObjectSerializerReadContextComplexJson(DataContractJsonSerializerImp _useSimpleDictionaryFormat = serializer.UseSimpleDictionaryFormat; } - internal static XmlObjectSerializerReadContextComplexJson CreateContext(DataContractJsonSerializerImpl serializer, DataContract rootTypeDataContract) + internal static XmlObjectSerializerReadContextComplexJson CreateContext(DataContractJsonSerializer serializer, DataContract rootTypeDataContract) { return new XmlObjectSerializerReadContextComplexJson(serializer, rootTypeDataContract); } @@ -36,7 +34,7 @@ internal static XmlObjectSerializerReadContextComplexJson CreateContext(DataCont [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] protected override object? ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader) { - return DataContractJsonSerializerImpl.ReadJsonValue(dataContract, reader, this); + return DataContractJsonSerializer.ReadJsonValue(dataContract, reader, this); } [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] @@ -135,6 +133,11 @@ private IDataNode ReadNumericalPrimitiveExtensionDataValue(XmlReaderDelegator xm }; } + internal override int GetArraySize() + { + return -1; + } + internal override void ReadAttributes(XmlReaderDelegator xmlReader) { if (attributes == null) @@ -238,6 +241,21 @@ internal static XmlQualifiedName ParseQualifiedName(string qname) return new XmlQualifiedName(name, ns); } + protected override bool IsReadingCollectionExtensionData(XmlReaderDelegator xmlReader) + { + return xmlReader.GetAttribute(JsonGlobals.typeString) == JsonGlobals.arrayString; + } + + protected override bool IsReadingClassExtensionData(XmlReaderDelegator xmlReader) + { + return xmlReader.GetAttribute(JsonGlobals.typeString) == JsonGlobals.objectString; + } + + protected override XmlReaderDelegator CreateReaderDelegatorForReader(XmlReader xmlReader) + { + return new JsonReaderDelegator(xmlReader, this._dateTimeFormat); + } + [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] internal override DataContract GetDataContract(RuntimeTypeHandle typeHandle, Type? type) { @@ -323,5 +341,11 @@ private static bool IsBitSet(byte[] bytes, int bitIndex) { return BitFlagsGenerator.IsBitSet(bytes, bitIndex); } + + [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] + protected override DataContract? ResolveDataContractFromRootDataContract(XmlQualifiedName typeQName) + { + return XmlObjectSerializerWriteContextComplexJson.ResolveJsonDataContractFromRootDataContract(this, typeQName, rootTypeDataContract!); + } } } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlObjectSerializerWriteContextComplexJson.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlObjectSerializerWriteContextComplexJson.cs index 6519fba2a7b89d..f107c5b7c56d3b 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlObjectSerializerWriteContextComplexJson.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlObjectSerializerWriteContextComplexJson.cs @@ -8,7 +8,6 @@ using System.Reflection; using System.Collections; using System.IO; -using DataContractDictionary = System.Collections.Generic.Dictionary; using System.Diagnostics.CodeAnalysis; namespace System.Runtime.Serialization.Json @@ -19,13 +18,13 @@ internal sealed class XmlObjectSerializerWriteContextComplexJson : XmlObjectSeri private bool _perCallXsiTypeAlreadyEmitted; private readonly bool _useSimpleDictionaryFormat; - internal static XmlObjectSerializerWriteContextComplexJson CreateContext(DataContractJsonSerializerImpl serializer, DataContract rootTypeDataContract) + internal static XmlObjectSerializerWriteContextComplexJson CreateContext(DataContractJsonSerializer serializer, DataContract rootTypeDataContract) { return new XmlObjectSerializerWriteContextComplexJson(serializer, rootTypeDataContract); } - internal XmlObjectSerializerWriteContextComplexJson(DataContractJsonSerializerImpl serializer, DataContract rootTypeDataContract) - : base(serializer, serializer.MaxItemsInObjectGraph, default(StreamingContext), false) + internal XmlObjectSerializerWriteContextComplexJson(DataContractJsonSerializer serializer, DataContract rootTypeDataContract) + : base(serializer, serializer.MaxItemsInObjectGraph, new StreamingContext(StreamingContextStates.All), serializer.IgnoreExtensionDataObject) { _emitXsiType = serializer.EmitTypeInformation; this.rootTypeDataContract = rootTypeDataContract; @@ -50,16 +49,6 @@ public bool UseSimpleDictionaryFormat } } - internal override bool WriteClrTypeInfo(XmlWriterDelegator xmlWriter, string clrTypeName, string clrAssemblyName) - { - return false; - } - - internal override bool WriteClrTypeInfo(XmlWriterDelegator xmlWriter, DataContract dataContract) - { - return false; - } - internal override void WriteArraySize(XmlWriterDelegator xmlWriter, int size) { //Noop @@ -161,12 +150,12 @@ protected override void WriteDataContractValue(DataContract dataContract, XmlWri WriteTypeInfo(xmlWriter, jsonDataContract.TypeName!); } _perCallXsiTypeAlreadyEmitted = false; - DataContractJsonSerializerImpl.WriteJsonValue(jsonDataContract, xmlWriter, obj, this, declaredTypeHandle); + DataContractJsonSerializer.WriteJsonValue(jsonDataContract, xmlWriter, obj, this, declaredTypeHandle); } protected override void WriteNull(XmlWriterDelegator xmlWriter) { - DataContractJsonSerializerImpl.WriteJsonNull(xmlWriter); + DataContractJsonSerializer.WriteJsonNull(xmlWriter); } internal XmlDictionaryString CollectionItemName @@ -384,5 +373,39 @@ internal override DataContract GetDataContract(int id, RuntimeTypeHandle typeHan DataContractJsonSerializer.CheckIfTypeIsReference(dataContract); return dataContract; } + + [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] + protected override DataContract? ResolveDataContractFromRootDataContract(XmlQualifiedName typeQName) + { + return XmlObjectSerializerWriteContextComplexJson.ResolveJsonDataContractFromRootDataContract(this, typeQName, rootTypeDataContract!); + } + + [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] + internal static DataContract? ResolveJsonDataContractFromRootDataContract(XmlObjectSerializerContext context, XmlQualifiedName typeQName, DataContract rootTypeDataContract) + { + if (rootTypeDataContract.StableName == typeQName) + return rootTypeDataContract; + + CollectionDataContract? collectionContract = rootTypeDataContract as CollectionDataContract; + while (collectionContract != null) + { + DataContract itemContract; + if (collectionContract.ItemType.IsGenericType + && collectionContract.ItemType.GetGenericTypeDefinition() == typeof(KeyValue<,>)) + { + itemContract = context.GetDataContract(Globals.TypeOfKeyValuePair.MakeGenericType(collectionContract.ItemType.GetGenericArguments())); + } + else + { + itemContract = context.GetDataContract(context.GetSurrogatedType(collectionContract.ItemType)); + } + if (itemContract.StableName == typeQName) + { + return itemContract; + } + collectionContract = itemContract as CollectionDataContract; + } + return null; + } } } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerContext.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerContext.cs index 9323ae87acaa25..4ef27435c85afe 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerContext.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerContext.cs @@ -281,24 +281,28 @@ internal bool IsKnownType(DataContract dataContract, Type? declaredType) if (rootTypeDataContract.StableName == qname) dataContract = rootTypeDataContract; else - { - CollectionDataContract? collectionContract = rootTypeDataContract as CollectionDataContract; - while (collectionContract != null) - { - DataContract itemContract = GetDataContract(GetSurrogatedType(collectionContract.ItemType)); - if (itemContract.StableName == qname) - { - dataContract = itemContract; - break; - } - collectionContract = itemContract as CollectionDataContract; - } - } + dataContract = ResolveDataContractFromRootDataContract(qname); } } return dataContract; } + [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] + protected virtual DataContract? ResolveDataContractFromRootDataContract(XmlQualifiedName typeQName) + { + CollectionDataContract? collectionContract = rootTypeDataContract as CollectionDataContract; + while (collectionContract != null) + { + DataContract itemContract = GetDataContract(GetSurrogatedType(collectionContract.ItemType)); + if (itemContract.StableName == typeQName) + { + return itemContract; + } + collectionContract = itemContract as CollectionDataContract; + } + return null; + } + [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] internal void PushKnownTypes(DataContract dc) { diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlWriterDelegator.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlWriterDelegator.cs index f0be0f4e66f5c9..6eb6e62287ea88 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlWriterDelegator.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlWriterDelegator.cs @@ -452,7 +452,7 @@ internal void WriteBoolean(bool value, XmlDictionaryString name, XmlDictionarySt internal virtual void WriteDateTime(DateTime value) { - WriteString(XmlConvert.ToString(value, XmlDateTimeSerializationMode.RoundtripKind)); + writer.WriteValue(value); } internal void WriteDateTime(DateTime value, XmlDictionaryString name, XmlDictionaryString? ns) diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBinaryReader.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBinaryReader.cs index 4505fb2d23612e..f81d5cfa08591e 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBinaryReader.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBinaryReader.cs @@ -1346,14 +1346,14 @@ private unsafe int ReadArray(float[] array, int offset, int count) public override int ReadArray(string localName, string namespaceUri, float[] array, int offset, int count) { - if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement)) + if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement) && BitConverter.IsLittleEndian) return ReadArray(array, offset, count); return base.ReadArray(localName, namespaceUri, array, offset, count); } public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, float[] array, int offset, int count) { - if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement)) + if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement) && BitConverter.IsLittleEndian) return ReadArray(array, offset, count); return base.ReadArray(localName, namespaceUri, array, offset, count); } @@ -1372,14 +1372,14 @@ private unsafe int ReadArray(double[] array, int offset, int count) public override int ReadArray(string localName, string namespaceUri, double[] array, int offset, int count) { - if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement)) + if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement) && BitConverter.IsLittleEndian) return ReadArray(array, offset, count); return base.ReadArray(localName, namespaceUri, array, offset, count); } public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, double[] array, int offset, int count) { - if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement)) + if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement) && BitConverter.IsLittleEndian) return ReadArray(array, offset, count); return base.ReadArray(localName, namespaceUri, array, offset, count); } @@ -1398,14 +1398,14 @@ private unsafe int ReadArray(decimal[] array, int offset, int count) public override int ReadArray(string localName, string namespaceUri, decimal[] array, int offset, int count) { - if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement)) + if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement) && BitConverter.IsLittleEndian) return ReadArray(array, offset, count); return base.ReadArray(localName, namespaceUri, array, offset, count); } public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, decimal[] array, int offset, int count) { - if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement)) + if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement) && BitConverter.IsLittleEndian) return ReadArray(array, offset, count); return base.ReadArray(localName, namespaceUri, array, offset, count); } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBinaryWriter.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBinaryWriter.cs index 53a9d45ffce18f..3255cb4dd06e6e 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBinaryWriter.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBinaryWriter.cs @@ -12,6 +12,7 @@ using System.Runtime.Serialization; using System.Globalization; using System.Collections.Generic; +using System.Buffers.Binary; namespace System.Xml { @@ -757,12 +758,8 @@ public unsafe override void WriteFloatText(float f) { int offset; byte[] buffer = GetTextNodeBuffer(1 + sizeof(float), out offset); - byte* bytes = (byte*)&f; - buffer[offset + 0] = (byte)XmlBinaryNodeType.FloatText; - buffer[offset + 1] = bytes[0]; - buffer[offset + 2] = bytes[1]; - buffer[offset + 3] = bytes[2]; - buffer[offset + 4] = bytes[3]; + buffer[offset] = (byte)XmlBinaryNodeType.FloatText; + BinaryPrimitives.WriteSingleLittleEndian(buffer.AsSpan(offset + 1, sizeof(float)), f); Advance(1 + sizeof(float)); } } @@ -778,16 +775,8 @@ public unsafe override void WriteDoubleText(double d) { int offset; byte[] buffer = GetTextNodeBuffer(1 + sizeof(double), out offset); - byte* bytes = (byte*)&d; - buffer[offset + 0] = (byte)XmlBinaryNodeType.DoubleText; - buffer[offset + 1] = bytes[0]; - buffer[offset + 2] = bytes[1]; - buffer[offset + 3] = bytes[2]; - buffer[offset + 4] = bytes[3]; - buffer[offset + 5] = bytes[4]; - buffer[offset + 6] = bytes[5]; - buffer[offset + 7] = bytes[6]; - buffer[offset + 8] = bytes[7]; + buffer[offset] = (byte)XmlBinaryNodeType.DoubleText; + BinaryPrimitives.WriteDoubleLittleEndian(buffer.AsSpan(offset + 1, sizeof(double)), d); Advance(1 + sizeof(double)); } } @@ -798,9 +787,24 @@ public unsafe override void WriteDecimalText(decimal d) byte[] buffer = GetTextNodeBuffer(1 + sizeof(decimal), out offset); byte* bytes = (byte*)&d; buffer[offset++] = (byte)XmlBinaryNodeType.DecimalText; - for (int i = 0; i < sizeof(decimal); i++) + if (BitConverter.IsLittleEndian) { - buffer[offset++] = bytes[i]; + for (int i = 0; i < sizeof(decimal); i++) + { + buffer[offset++] = bytes[i]; + } + } + else + { + Span bits = stackalloc int[4]; + decimal.TryGetBits(d, bits, out int intsWritten); + Debug.Assert(intsWritten == 4); + + Span span = buffer.AsSpan(offset, sizeof(decimal)); + BinaryPrimitives.WriteInt32LittleEndian(span, bits[3]); + BinaryPrimitives.WriteInt32LittleEndian(span.Slice(4), bits[2]); + BinaryPrimitives.WriteInt32LittleEndian(span.Slice(8), bits[0]); + BinaryPrimitives.WriteInt32LittleEndian(span.Slice(12), bits[1]); } Advance(1 + sizeof(decimal)); } @@ -890,15 +894,146 @@ private void WriteArrayInfo(XmlBinaryNodeType nodeType, int count) WriteMultiByteInt32(count); } - public unsafe void UnsafeWriteArray(XmlBinaryNodeType nodeType, int count, byte* array, byte* arrayMax) + public unsafe void UnsafeWriteBoolArray(bool[] array, int offset, int count) + { + WriteArrayInfo(XmlBinaryNodeType.BoolTextWithEndElement, count); + fixed (bool* items = &array[offset]) + { + base.UnsafeWriteBytes((byte*)items, count); + } + } + + public unsafe void UnsafeWriteInt16Array(short[] array, int offset, int count) + { + WriteArrayInfo(XmlBinaryNodeType.Int16TextWithEndElement, count); + if (BitConverter.IsLittleEndian) + { + fixed (short* items = &array[offset]) + { + base.UnsafeWriteBytes((byte*)items, sizeof(short) * count); + } + } + else + { + for (int i = 0; i < count; i++) + { + Span span = GetBuffer(sizeof(short), out int bufferOffset).AsSpan(bufferOffset, sizeof(short)); + BinaryPrimitives.WriteInt16LittleEndian(span, array[offset + i]); + Advance(sizeof(short)); + } + } + } + + public unsafe void UnsafeWriteInt32Array(int[] array, int offset, int count) + { + WriteArrayInfo(XmlBinaryNodeType.Int32TextWithEndElement, count); + if (BitConverter.IsLittleEndian) + { + fixed (int* items = &array[offset]) + { + base.UnsafeWriteBytes((byte*)items, sizeof(int) * count); + } + } + else + { + for (int i = 0; i < count; i++) + { + Span span = GetBuffer(sizeof(int), out int bufferOffset).AsSpan(bufferOffset, sizeof(int)); + BinaryPrimitives.WriteInt32LittleEndian(span, array[offset + i]); + Advance(sizeof(int)); + } + } + } + + public unsafe void UnsafeWriteInt64Array(long[] array, int offset, int count) { - WriteArrayInfo(nodeType, count); - UnsafeWriteArray(array, (int)(arrayMax - array)); + WriteArrayInfo(XmlBinaryNodeType.Int64TextWithEndElement, count); + if (BitConverter.IsLittleEndian) + { + fixed (long* items = &array[offset]) + { + base.UnsafeWriteBytes((byte*)items, sizeof(long) * count); + } + } + else + { + for (int i = 0; i < count; i++) + { + Span span = GetBuffer(sizeof(long), out int bufferOffset).AsSpan(bufferOffset, sizeof(long)); + BinaryPrimitives.WriteInt64LittleEndian(span, array[offset + i]); + Advance(sizeof(long)); + } + } } - private unsafe void UnsafeWriteArray(byte* array, int byteCount) + public unsafe void UnsafeWriteFloatArray(float[] array, int offset, int count) { - base.UnsafeWriteBytes(array, byteCount); + WriteArrayInfo(XmlBinaryNodeType.FloatTextWithEndElement, count); + if (BitConverter.IsLittleEndian) + { + fixed (float* items = &array[offset]) + { + base.UnsafeWriteBytes((byte*)items, sizeof(float) * count); + } + } + else + { + for (int i = 0; i < count; i++) + { + Span span = GetBuffer(sizeof(float), out int bufferOffset).AsSpan(bufferOffset, sizeof(float)); + BinaryPrimitives.WriteSingleLittleEndian(span, array[offset + i]); + Advance(sizeof(float)); + } + } + } + + public unsafe void UnsafeWriteDoubleArray(double[] array, int offset, int count) + { + WriteArrayInfo(XmlBinaryNodeType.DoubleTextWithEndElement, count); + if (BitConverter.IsLittleEndian) + { + fixed (double* items = &array[offset]) + { + base.UnsafeWriteBytes((byte*)items, sizeof(double) * count); + } + } + else + { + for (int i = 0; i < count; i++) + { + Span span = GetBuffer(sizeof(double), out int bufferOffset).AsSpan(bufferOffset, sizeof(double)); + BinaryPrimitives.WriteDoubleLittleEndian(span, array[offset + i]); + Advance(sizeof(double)); + } + } + } + + public unsafe void UnsafeWriteDecimalArray(decimal[] array, int offset, int count) + { + WriteArrayInfo(XmlBinaryNodeType.DecimalTextWithEndElement, count); + if (BitConverter.IsLittleEndian) + { + fixed (decimal* items = &array[offset]) + { + base.UnsafeWriteBytes((byte*)items, sizeof(decimal) * count); + } + } + else + { + Span bits = stackalloc int[4]; + for (int i = 0; i < count; i++) + { + decimal.TryGetBits(array[offset + i], bits, out int intsWritten); + Debug.Assert(intsWritten == 4); + + Span span = GetBuffer(16, out int bufferOffset).AsSpan(bufferOffset, 16); + BinaryPrimitives.WriteInt32LittleEndian(span, bits[3]); + BinaryPrimitives.WriteInt32LittleEndian(span.Slice(4), bits[2]); + BinaryPrimitives.WriteInt32LittleEndian(span.Slice(8), bits[0]); + BinaryPrimitives.WriteInt32LittleEndian(span.Slice(12), bits[1]); + Advance(16); + } + } } public void WriteDateTimeArray(DateTime[] array, int offset, int count) @@ -1193,22 +1328,6 @@ private void WriteEndArray() EndArray(); } - private unsafe void UnsafeWriteArray(string? prefix, string localName, string? namespaceUri, - XmlBinaryNodeType nodeType, int count, byte* array, byte* arrayMax) - { - WriteStartArray(prefix, localName, namespaceUri, count); - _writer.UnsafeWriteArray(nodeType, count, array, arrayMax); - WriteEndArray(); - } - - private unsafe void UnsafeWriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, - XmlBinaryNodeType nodeType, int count, byte* array, byte* arrayMax) - { - WriteStartArray(prefix, localName, namespaceUri, count); - _writer.UnsafeWriteArray(nodeType, count, array, arrayMax); - WriteEndArray(); - } - private void CheckArray(Array array, int offset, int count) { if (array == null) @@ -1229,10 +1348,9 @@ public unsafe override void WriteArray(string? prefix, string localName, string? CheckArray(array, offset, count); if (count > 0) { - fixed (bool* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.BoolTextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteBoolArray(array, offset, count); + WriteEndArray(); } } } @@ -1243,10 +1361,9 @@ public unsafe override void WriteArray(string? prefix, XmlDictionaryString local CheckArray(array, offset, count); if (count > 0) { - fixed (bool* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.BoolTextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteBoolArray(array, offset, count); + WriteEndArray(); } } } @@ -1257,10 +1374,9 @@ public unsafe override void WriteArray(string? prefix, string localName, string? CheckArray(array, offset, count); if (count > 0) { - fixed (short* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.Int16TextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteInt16Array(array, offset, count); + WriteEndArray(); } } } @@ -1271,10 +1387,9 @@ public unsafe override void WriteArray(string? prefix, XmlDictionaryString local CheckArray(array, offset, count); if (count > 0) { - fixed (short* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.Int16TextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteInt16Array(array, offset, count); + WriteEndArray(); } } } @@ -1285,10 +1400,9 @@ public unsafe override void WriteArray(string? prefix, string localName, string? CheckArray(array, offset, count); if (count > 0) { - fixed (int* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.Int32TextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteInt32Array(array, offset, count); + WriteEndArray(); } } } @@ -1299,10 +1413,9 @@ public unsafe override void WriteArray(string? prefix, XmlDictionaryString local CheckArray(array, offset, count); if (count > 0) { - fixed (int* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.Int32TextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteInt32Array(array, offset, count); + WriteEndArray(); } } } @@ -1313,10 +1426,9 @@ public unsafe override void WriteArray(string? prefix, string localName, string? CheckArray(array, offset, count); if (count > 0) { - fixed (long* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.Int64TextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteInt64Array(array, offset, count); + WriteEndArray(); } } } @@ -1327,10 +1439,9 @@ public unsafe override void WriteArray(string? prefix, XmlDictionaryString local CheckArray(array, offset, count); if (count > 0) { - fixed (long* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.Int64TextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteInt64Array(array, offset, count); + WriteEndArray(); } } } @@ -1341,10 +1452,9 @@ public unsafe override void WriteArray(string? prefix, string localName, string? CheckArray(array, offset, count); if (count > 0) { - fixed (float* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteFloatArray(array, offset, count); + WriteEndArray(); } } } @@ -1355,10 +1465,9 @@ public unsafe override void WriteArray(string? prefix, XmlDictionaryString local CheckArray(array, offset, count); if (count > 0) { - fixed (float* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteFloatArray(array, offset, count); + WriteEndArray(); } } } @@ -1369,10 +1478,9 @@ public unsafe override void WriteArray(string? prefix, string localName, string? CheckArray(array, offset, count); if (count > 0) { - fixed (double* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteDoubleArray(array, offset, count); + WriteEndArray(); } } } @@ -1383,10 +1491,9 @@ public unsafe override void WriteArray(string? prefix, XmlDictionaryString local CheckArray(array, offset, count); if (count > 0) { - fixed (double* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteDoubleArray(array, offset, count); + WriteEndArray(); } } } @@ -1397,10 +1504,9 @@ public unsafe override void WriteArray(string? prefix, string localName, string? CheckArray(array, offset, count); if (count > 0) { - fixed (decimal* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteDecimalArray(array, offset, count); + WriteEndArray(); } } } @@ -1411,10 +1517,9 @@ public unsafe override void WriteArray(string? prefix, XmlDictionaryString local CheckArray(array, offset, count); if (count > 0) { - fixed (decimal* items = &array[offset]) - { - UnsafeWriteArray(prefix, localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement, count, (byte*)items, (byte*)&items[count]); - } + WriteStartArray(prefix, localName, namespaceUri, count); + _writer.UnsafeWriteDecimalArray(array, offset, count); + WriteEndArray(); } } } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBufferReader.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBufferReader.cs index dc124955be3bd8..a7c7827c4b03b0 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBufferReader.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlBufferReader.cs @@ -12,6 +12,7 @@ using System.Runtime.Serialization; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Buffers.Binary; namespace System.Xml { @@ -401,13 +402,8 @@ public unsafe float ReadSingle() { int offset; byte[] buffer = GetBuffer(ValueHandleLength.Single, out offset); - float value; - byte* pb = (byte*)&value; + float value = BinaryPrimitives.ReadSingleLittleEndian(buffer.AsSpan(offset, 4)); DiagnosticUtility.DebugAssert(sizeof(float) == 4, ""); - pb[0] = buffer[offset + 0]; - pb[1] = buffer[offset + 1]; - pb[2] = buffer[offset + 2]; - pb[3] = buffer[offset + 3]; Advance(ValueHandleLength.Single); return value; } @@ -416,17 +412,8 @@ public unsafe double ReadDouble() { int offset; byte[] buffer = GetBuffer(ValueHandleLength.Double, out offset); - double value; - byte* pb = (byte*)&value; + double value = BinaryPrimitives.ReadDoubleLittleEndian(buffer.AsSpan(offset, 8)); DiagnosticUtility.DebugAssert(sizeof(double) == 8, ""); - pb[0] = buffer[offset + 0]; - pb[1] = buffer[offset + 1]; - pb[2] = buffer[offset + 2]; - pb[3] = buffer[offset + 3]; - pb[4] = buffer[offset + 4]; - pb[5] = buffer[offset + 5]; - pb[6] = buffer[offset + 6]; - pb[7] = buffer[offset + 7]; Advance(ValueHandleLength.Double); return value; } @@ -436,9 +423,24 @@ public unsafe decimal ReadDecimal() int offset; byte[] buffer = GetBuffer(ValueHandleLength.Decimal, out offset); decimal value; - byte* pb = (byte*)&value; - for (int i = 0; i < sizeof(decimal); i++) - pb[i] = buffer[offset + i]; + if (BitConverter.IsLittleEndian) + { + byte* pb = (byte*)&value; + for (int i = 0; i < sizeof(decimal); i++) + pb[i] = buffer[offset + i]; + } + else + { + ReadOnlySpan bytes = buffer.AsSpan(offset, sizeof(decimal)); + ReadOnlySpan span = stackalloc int[4] + { + BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(8, 4)), + BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(12, 4)), + BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(4, 4)), + BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(0, 4)) + }; + value = new decimal(span); + } Advance(ValueHandleLength.Decimal); return value; } @@ -1035,31 +1037,15 @@ public ulong GetUInt64(int offset) public unsafe float GetSingle(int offset) { - byte[] buffer = _buffer; - float value; - byte* pb = (byte*)&value; + float value = BinaryPrimitives.ReadSingleLittleEndian(_buffer.AsSpan(offset, 4)); DiagnosticUtility.DebugAssert(sizeof(float) == 4, ""); - pb[0] = buffer[offset + 0]; - pb[1] = buffer[offset + 1]; - pb[2] = buffer[offset + 2]; - pb[3] = buffer[offset + 3]; return value; } public unsafe double GetDouble(int offset) { - byte[] buffer = _buffer; - double value; - byte* pb = (byte*)&value; + double value = BinaryPrimitives.ReadDoubleLittleEndian(_buffer.AsSpan(offset, 8)); DiagnosticUtility.DebugAssert(sizeof(double) == 8, ""); - pb[0] = buffer[offset + 0]; - pb[1] = buffer[offset + 1]; - pb[2] = buffer[offset + 2]; - pb[3] = buffer[offset + 3]; - pb[4] = buffer[offset + 4]; - pb[5] = buffer[offset + 5]; - pb[6] = buffer[offset + 6]; - pb[7] = buffer[offset + 7]; return value; } @@ -1067,9 +1053,26 @@ public unsafe decimal GetDecimal(int offset) { byte[] buffer = _buffer; decimal value; - byte* pb = (byte*)&value; - for (int i = 0; i < sizeof(decimal); i++) - pb[i] = buffer[offset + i]; + + if (BitConverter.IsLittleEndian) + { + byte* pb = (byte*)&value; + for (int i = 0; i < sizeof(decimal); i++) + pb[i] = buffer[offset + i]; + } + else + { + ReadOnlySpan bytes = buffer.AsSpan(offset, sizeof(decimal)); + ReadOnlySpan span = stackalloc int[4] + { + BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(8, 4)), + BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(12, 4)), + BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(4, 4)), + BinaryPrimitives.ReadInt32LittleEndian(bytes.Slice(0, 4)) + }; + value = new decimal(span); + } + return value; } diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlConverter.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlConverter.cs index f58260cb559a80..6d91bd1c5fbdf3 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlConverter.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlConverter.cs @@ -640,7 +640,7 @@ private static bool TryParseSingle(byte[] chars, int offset, int count, out floa if (count == 10) return false; if (negative) - result = -value; + result = -(float)value; else result = value; return true; @@ -692,7 +692,7 @@ private static bool TryParseDouble(byte[] chars, int offset, int count, out doub if (count == 10) return false; if (negative) - result = -value; + result = -(double)value; else result = value; return true; diff --git a/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System.Private.Runtime.InteropServices.JavaScript.Tests.csproj b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System.Private.Runtime.InteropServices.JavaScript.Tests.csproj index fe9348f4678320..8c552fccec58c0 100644 --- a/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System.Private.Runtime.InteropServices.JavaScript.Tests.csproj +++ b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System.Private.Runtime.InteropServices.JavaScript.Tests.csproj @@ -17,6 +17,14 @@ + + + + + + + + diff --git a/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/Simple/SimpleTest.cs b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/Simple/SimpleTest.cs new file mode 100644 index 00000000000000..18318330ffcf67 --- /dev/null +++ b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/Simple/SimpleTest.cs @@ -0,0 +1,66 @@ +// 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.Generic; +using System.Threading.Tasks; + +namespace System.Runtime.InteropServices.JavaScript.Tests +{ + public static class SimpleTest + { + public static async Task Test() + { + var tests = new List>(); + tests.Add(TimerTests.T0_NoTimer); + tests.Add(TimerTests.T1_OneTimer); + tests.Add(TimerTests.T2_SecondTimerEarlier); + tests.Add(TimerTests.T3_SecondTimerLater); + tests.Add(TimerTests.T5_FiveTimers); + + try + { + Console.WriteLine("SimpleMain start test!"); + var failures = 0; + var failureNames = new List(); + foreach (var test in tests) + { + var failed = await RunTest(test); + if (failed != null) + { + failureNames.Add(failed); + failures++; + } + } + + foreach (var failure in failureNames) + { + Console.WriteLine(failure); + } + Console.WriteLine($"{Environment.NewLine}=== TEST EXECUTION SUMMARY ==={Environment.NewLine}Total: {tests.Count}, Failed: {failures}"); + return failures; + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return -1; + } + } + + private static async Task RunTest(Func action) + { + try + { + Console.WriteLine("[STRT] " + action.Method.Name); + await action(); + Console.WriteLine("[DONE] " + action.Method.Name); + return null; + } + catch (Exception ex) + { + var message="[FAIL] "+action.Method.Name + " " + ex.Message; + Console.WriteLine(message); + return message; + } + } + } +} diff --git a/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/Simple/TimerTests.cs b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/Simple/TimerTests.cs new file mode 100644 index 00000000000000..3f7f7ac8add77c --- /dev/null +++ b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/System/Runtime/InteropServices/JavaScript/Simple/TimerTests.cs @@ -0,0 +1,192 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.Runtime.InteropServices.JavaScript.Tests +{ + public static class TimerTests + { + static JSObject _timersHelper = (JSObject)Runtime.GetGlobalObject("timersHelper"); + static Function _installWrapper = (Function)_timersHelper.GetObjectProperty("install"); + static Function _getRegisterCount = (Function)_timersHelper.GetObjectProperty("getRegisterCount"); + static Function _getHitCount = (Function)_timersHelper.GetObjectProperty("getHitCount"); + static Function _cleanupWrapper = (Function)_timersHelper.GetObjectProperty("cleanup"); + + static public async Task T0_NoTimer() + { + try + { + _installWrapper.Call(); + + var setCounter = (int)_getRegisterCount.Call(); + Assert.Equal(0, setCounter); + } + finally + { + await WaitForCleanup(); + } + } + + static public async Task T1_OneTimer() + { + int wasCalled = 0; + Timer? timer = null; + try + { + _installWrapper.Call(); + + timer = new Timer((_) => + { + Console.WriteLine("In timer"); + wasCalled++; + }, null, 10, 0); + + var setCounter = (int)_getRegisterCount.Call(); + Assert.True(0 == wasCalled, $"wasCalled: {wasCalled}"); + Assert.True(1 == setCounter, $"setCounter: {setCounter}"); + } + finally + { + await WaitForCleanup(); + Assert.True(1 == wasCalled, $"wasCalled: {wasCalled}"); + timer?.Dispose(); + } + } + + static public async Task T2_SecondTimerEarlier() + { + int wasCalled = 0; + Timer? timer1 = null; + Timer? timer2 = null; + try + { + _installWrapper.Call(); + + timer1 = new Timer((_) => + { + Console.WriteLine("In timer1"); + wasCalled++; + }, null, 10, 0); + timer2 = new Timer((_) => + { + Console.WriteLine("In timer2"); + wasCalled++; + }, null, 5, 0); + + var setCounter = (int)_getRegisterCount.Call(); + Assert.True(2 == setCounter, $"setCounter: {setCounter}"); + Assert.True(0 == wasCalled, $"wasCalled: {wasCalled}"); + + } + finally + { + await WaitForCleanup(); + Assert.True(2 == wasCalled, $"wasCalled: {wasCalled}"); + timer1?.Dispose(); + timer2?.Dispose(); + } + } + + static public async Task T3_SecondTimerLater() + { + int wasCalled = 0; + Timer? timer1 = null; + Timer? timer2 = null; + try + { + _installWrapper.Call(); + + timer1 = new Timer((_) => + { + Console.WriteLine("In timer1"); + wasCalled++; + }, null, 10, 0); + timer2 = new Timer((_) => + { + Console.WriteLine("In timer2"); + wasCalled++; + }, null, 20, 0); + + var setCounter = (int)_getRegisterCount.Call(); + Assert.True(0 == wasCalled, $"wasCalled: {wasCalled}"); + Assert.True(1 == setCounter, $"setCounter: {setCounter}"); + } + finally + { + await WaitForCleanup(); + Assert.True(2 == wasCalled, $"wasCalled: {wasCalled}"); + timer1?.Dispose(); + timer2?.Dispose(); + } + } + + static public async Task T5_FiveTimers() + { + int wasCalled = 0; + Timer? timer1 = null; + Timer? timer2 = null; + Timer? timer3 = null; + Timer? timer4 = null; + Timer? timer5 = null; + try + { + _installWrapper.Call(); + + timer1 = new Timer((_) => + { + Console.WriteLine("In timer1"); + wasCalled++; + }, null, 800, 0); + timer2 = new Timer((_) => + { + Console.WriteLine("In timer2"); + wasCalled++; + }, null, 600, 0); + timer3 = new Timer((_) => + { + Console.WriteLine("In timer3"); + wasCalled++; + }, null, 400, 0); + timer4 = new Timer((_) => + { + Console.WriteLine("In timer4"); + wasCalled++; + }, null, 200, 0); + timer5 = new Timer((_) => + { + Console.WriteLine("In timer5"); + wasCalled++; + }, null, 000, 0); + + var setCounter = (int)_getRegisterCount.Call(); + Assert.True(0 == wasCalled, $"wasCalled: {wasCalled}"); + Assert.True(5 == setCounter, $"setCounter: {setCounter}"); + } + finally + { + await WaitForCleanup(); + var hitCounter = (int)_getHitCount.Call(); + var setCounter = (int)_getRegisterCount.Call(); + Assert.True(5 == wasCalled, $"wasCalled: {wasCalled}"); + Assert.True(8 == hitCounter, $"hitCounter: {hitCounter}"); + Assert.True(12 == setCounter, $"setCounter: {setCounter}"); + timer1?.Dispose(); + timer2?.Dispose(); + timer3?.Dispose(); + timer4?.Dispose(); + timer5?.Dispose(); + } + } + + static private async Task WaitForCleanup() + { + Console.WriteLine("wait for cleanup begin"); + await Task.Delay(1000); + _cleanupWrapper.Call(); + Console.WriteLine("wait for cleanup end"); + } + } +} diff --git a/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/simple.html b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/simple.html new file mode 100644 index 00000000000000..59acbcfcd1cd1e --- /dev/null +++ b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/simple.html @@ -0,0 +1,14 @@ + + + + + + TESTS + + + + + + + + \ No newline at end of file diff --git a/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/simple.js b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/simple.js new file mode 100644 index 00000000000000..bd9f900aafebf6 --- /dev/null +++ b/src/libraries/System.Private.Runtime.InteropServices.JavaScript/tests/simple.js @@ -0,0 +1,79 @@ +class TimersHelper { + install() { + const measuredCallbackName = "mono_wasm_set_timeout_exec"; + globalThis.registerCounter = 0; + globalThis.hitCounter = 0; + console.log("install") + if (!globalThis.originalSetTimeout) { + globalThis.originalSetTimeout = globalThis.setTimeout; + } + globalThis.setTimeout = (cb, time) => { + var start = Date.now().valueOf(); + if (cb.name === measuredCallbackName) { + globalThis.registerCounter++; + console.log(`registerCounter: ${globalThis.registerCounter} now:${start} delay:${time}`) + } + return globalThis.originalSetTimeout(() => { + if (cb.name === measuredCallbackName) { + var hit = Date.now().valueOf(); + globalThis.hitCounter++; + var delta = hit - start; + console.log(`hitCounter: ${globalThis.hitCounter} now:${hit} delay:${time} delta:${delta}`) + } + cb(); + }, time); + }; + } + + getRegisterCount() { + console.log(`registerCounter: ${globalThis.registerCounter} `) + return globalThis.registerCounter; + } + + getHitCount() { + console.log(`hitCounter: ${globalThis.hitCounter} `) + return globalThis.hitCounter; + } + + cleanup() { + console.log(`cleanup registerCounter: ${globalThis.registerCounter} hitCounter: ${globalThis.hitCounter} `) + globalThis.setTimeout = globalThis.originalSetTimeout; + } +} + +globalThis.timersHelper = new TimersHelper(); + +var Module = { + + config: null, + + preInit: async function() { + await MONO.mono_wasm_load_config("./mono-config.json"); // sets Module.config implicitly + }, + + // Called when the runtime is initialized and wasm is ready + onRuntimeInitialized: function () { + if (!Module.config || Module.config.error) { + console.log("No config found"); + return; + } + + Module.config.loaded_cb = function () { + try { + BINDING.call_static_method("[System.Private.Runtime.InteropServices.JavaScript.Tests] System.Runtime.InteropServices.JavaScript.Tests.SimpleTest:Test", []); + } catch (error) { + throw (error); + } + }; + Module.config.fetch_file_cb = function (asset) { + return fetch (asset, { credentials: 'same-origin' }); + } + + try + { + MONO.mono_load_runtime_and_bcl_args (Module.config); + } catch (error) { + throw(error); + } + }, +}; diff --git a/src/libraries/System.Private.Uri/src/Resources/Strings.resx b/src/libraries/System.Private.Uri/src/Resources/Strings.resx index 92a87cd44ccaa1..9975314e3d97c3 100644 --- a/src/libraries/System.Private.Uri/src/Resources/Strings.resx +++ b/src/libraries/System.Private.Uri/src/Resources/Strings.resx @@ -198,4 +198,7 @@ UriParser's base InitializeAndValidate may only be called once on a single Uri instance and only from an override of InitializeAndValidate. + + GetComponents() may not be used for Path/Query on a Uri instance created with UriCreationOptions.DangerousDisablePathAndQueryCanonicalization. + \ No newline at end of file diff --git a/src/libraries/System.Private.Uri/src/System.Private.Uri.csproj b/src/libraries/System.Private.Uri/src/System.Private.Uri.csproj index 4b63c5b3cb3061..ce5a97d87051bf 100644 --- a/src/libraries/System.Private.Uri/src/System.Private.Uri.csproj +++ b/src/libraries/System.Private.Uri/src/System.Private.Uri.csproj @@ -24,6 +24,7 @@ + diff --git a/src/libraries/System.Private.Uri/src/System/Uri.cs b/src/libraries/System.Private.Uri/src/System/Uri.cs index ad6efdba8540d1..7d1b4d72201a38 100644 --- a/src/libraries/System.Private.Uri/src/System/Uri.cs +++ b/src/libraries/System.Private.Uri/src/System/Uri.cs @@ -121,6 +121,11 @@ internal enum Flags : ulong IriCanonical = 0x78000000000, UnixPath = 0x100000000000, + /// + /// Disables any validation/normalization past the authority. Fragments will always be empty. GetComponents will throw for Path/Query. + /// + DisablePathAndQueryCanonicalization = 0x200000000000, + /// /// Used to ensure that InitializeAndValidate is only called once per Uri instance and only from an override of InitializeAndValidate /// @@ -267,6 +272,8 @@ internal static bool IriParsingStatic(UriParser? syntax) return syntax is null || syntax.InFact(UriSyntaxFlags.AllowIriParsing); } + internal bool DisablePathAndQueryCanonicalization => (_flags & Flags.DisablePathAndQueryCanonicalization) != 0; + internal bool UserDrivenParsing { get @@ -410,6 +417,20 @@ public Uri(string uriString, UriKind uriKind) DebugSetLeftCtor(); } + /// + /// Initializes a new instance of the class with the specified URI and additional . + /// + /// A string that identifies the resource to be represented by the instance. + /// Options that control how the is created and behaves. + public Uri(string uriString, in UriCreationOptions creationOptions) + { + if (uriString is null) + throw new ArgumentNullException(nameof(uriString)); + + CreateThis(uriString, false, UriKind.Absolute, in creationOptions); + DebugSetLeftCtor(); + } + // // Uri(Uri, string) // @@ -1639,6 +1660,9 @@ public override bool Equals([NotNullWhen(true)] object? comparand) // canonicalize the comparand, making comparison possible if (obj is null) { + if (DisablePathAndQueryCanonicalization) + return false; + if (!(comparand is string s)) return false; @@ -1649,6 +1673,9 @@ public override bool Equals([NotNullWhen(true)] object? comparand) return false; } + if (DisablePathAndQueryCanonicalization != obj.DisablePathAndQueryCanonicalization) + return false; + if (ReferenceEquals(OriginalString, obj.OriginalString)) { return true; @@ -2553,7 +2580,7 @@ private unsafe void GetHostViaCustomSyntax() // internal string GetParts(UriComponents uriParts, UriFormat formatAs) { - return GetComponents(uriParts, formatAs); + return InternalGetComponents(uriParts, formatAs); } private string GetEscapedParts(UriComponents uriParts) @@ -3158,9 +3185,6 @@ private unsafe void ParseRemaining() idx = _info.Offset.Path; origIdx = _info.Offset.Path; - //Some uris do not have a query - // When '?' is passed as delimiter, then it's special case - // so both '?' and '#' will work as delimiters if (buildIriStringFromPath) { DebugAssertInCtor(); @@ -3180,6 +3204,45 @@ private unsafe void ParseRemaining() _info.Offset.Path = (ushort)_string.Length; idx = _info.Offset.Path; + } + + // If the user explicitly disabled canonicalization, only figure out the offsets + if (DisablePathAndQueryCanonicalization) + { + if (buildIriStringFromPath) + { + DebugAssertInCtor(); + _string += _originalUnicodeString.Substring(origIdx); + } + + string str = _string; + + if (IsImplicitFile || (syntaxFlags & UriSyntaxFlags.MayHaveQuery) == 0) + { + idx = str.Length; + } + else + { + idx = str.IndexOf('?'); + if (idx == -1) + { + idx = str.Length; + } + } + + _info.Offset.Query = (ushort)idx; + _info.Offset.Fragment = (ushort)str.Length; // There is no fragment in UseRawTarget mode + _info.Offset.End = (ushort)str.Length; + + goto Done; + } + + //Some uris do not have a query + // When '?' is passed as delimiter, then it's special case + // so both '?' and '#' will work as delimiters + if (buildIriStringFromPath) + { + DebugAssertInCtor(); int offset = origIdx; if (IsImplicitFile || ((syntaxFlags & (UriSyntaxFlags.MayHaveQuery | UriSyntaxFlags.MayHaveFragment)) == 0)) diff --git a/src/libraries/System.Private.Uri/src/System/UriCreationOptions.cs b/src/libraries/System.Private.Uri/src/System/UriCreationOptions.cs new file mode 100644 index 00000000000000..2d0ee84d08b218 --- /dev/null +++ b/src/libraries/System.Private.Uri/src/System/UriCreationOptions.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System +{ + /// + /// Options that control how a is created and behaves. + /// + public struct UriCreationOptions + { + private bool _disablePathAndQueryCanonicalization; + + /// + /// Disables validation and normalization of the Path and Query. + /// No transformations of the URI past the Authority will take place. + /// instances created with this option do not support s. + /// may not be used for or . + /// Be aware that disabling canonicalization also means that reserved characters will not be escaped, + /// which may corrupt the HTTP request and makes the application subject to request smuggling. + /// Only set this option if you have ensured that the URI string is already sanitized. + /// + public bool DangerousDisablePathAndQueryCanonicalization + { + readonly get => _disablePathAndQueryCanonicalization; + set => _disablePathAndQueryCanonicalization = value; + } + } +} diff --git a/src/libraries/System.Private.Uri/src/System/UriExt.cs b/src/libraries/System.Private.Uri/src/System/UriExt.cs index a644dfa566699a..070e11a7f987f3 100644 --- a/src/libraries/System.Private.Uri/src/System/UriExt.cs +++ b/src/libraries/System.Private.Uri/src/System/UriExt.cs @@ -13,7 +13,7 @@ public partial class Uri // // All public ctors go through here // - private void CreateThis(string? uri, bool dontEscape, UriKind uriKind) + private void CreateThis(string? uri, bool dontEscape, UriKind uriKind, in UriCreationOptions creationOptions = default) { DebugAssertInCtor(); @@ -31,6 +31,9 @@ private void CreateThis(string? uri, bool dontEscape, UriKind uriKind) if (dontEscape) _flags |= Flags.UserEscaped; + if (creationOptions.DangerousDisablePathAndQueryCanonicalization) + _flags |= Flags.DisablePathAndQueryCanonicalization; + ParsingError err = ParseScheme(_string, ref _flags, ref _syntax!); InitializeUri(err, uriKind, out UriFormatException? e); @@ -259,6 +262,26 @@ public static bool TryCreate([NotNullWhen(true)] string? uriString, UriKind uriK return e is null && result != null; } + /// + /// Creates a new using the specified instance and . + /// + /// The string representation of the . + /// Options that control how the is created and behaves. + /// The constructed . + /// if the was successfully created; otherwise, . + public static bool TryCreate([NotNullWhen(true)] string? uriString, in UriCreationOptions creationOptions, [NotNullWhen(true)] out Uri? result) + { + if (uriString is null) + { + result = null; + return false; + } + UriFormatException? e = null; + result = CreateHelper(uriString, false, UriKind.Absolute, ref e, in creationOptions); + result?.DebugSetLeftCtor(); + return e is null && result != null; + } + public static bool TryCreate(Uri? baseUri, string? relativeUri, [NotNullWhen(true)] out Uri? result) { if (TryCreate(relativeUri, UriKind.RelativeOrAbsolute, out Uri? relativeLink)) @@ -309,6 +332,16 @@ public static bool TryCreate(Uri? baseUri, Uri? relativeUri, [NotNullWhen(true)] } public string GetComponents(UriComponents components, UriFormat format) + { + if (DisablePathAndQueryCanonicalization && (components & (UriComponents.Path | UriComponents.Query)) != 0) + { + throw new InvalidOperationException(SR.net_uri_GetComponentsCalledWhenCanonicalizationDisabled); + } + + return InternalGetComponents(components, format); + } + + private string InternalGetComponents(UriComponents components, UriFormat format) { if (((components & UriComponents.SerializationInfoString) != 0) && components != UriComponents.SerializationInfoString) throw new ArgumentOutOfRangeException(nameof(components), components, SR.net_uri_NotJustSerialization); @@ -590,7 +623,7 @@ private Uri(Flags flags, UriParser? uriParser, string uri) // // a Uri.TryCreate() method goes through here. // - internal static Uri? CreateHelper(string uriString, bool dontEscape, UriKind uriKind, ref UriFormatException? e) + internal static Uri? CreateHelper(string uriString, bool dontEscape, UriKind uriKind, ref UriFormatException? e, in UriCreationOptions creationOptions = default) { // if (!Enum.IsDefined(typeof(UriKind), uriKind)) -- We currently believe that Enum.IsDefined() is too slow // to be used here. @@ -606,6 +639,9 @@ private Uri(Flags flags, UriParser? uriParser, string uri) if (dontEscape) flags |= Flags.UserEscaped; + if (creationOptions.DangerousDisablePathAndQueryCanonicalization) + flags |= Flags.DisablePathAndQueryCanonicalization; + // We won't use User factory for these errors if (err != ParsingError.None) { diff --git a/src/libraries/System.Private.Uri/src/System/UriHelper.cs b/src/libraries/System.Private.Uri/src/System/UriHelper.cs index 660d15d49ade4f..0165a4926d80e5 100644 --- a/src/libraries/System.Private.Uri/src/System/UriHelper.cs +++ b/src/libraries/System.Private.Uri/src/System/UriHelper.cs @@ -4,15 +4,11 @@ using System.Text; using System.Diagnostics; using System.Runtime.InteropServices; -using System.Buffers; namespace System { internal static class UriHelper { - internal static readonly Encoding s_noFallbackCharUTF8 = Encoding.GetEncoding( - Encoding.UTF8.CodePage, new EncoderReplacementFallback(""), new DecoderReplacementFallback("")); - // http://host/Path/Path/File?Query is the base of // - http://host/Path/Path/File/ ... (those "File" words may be different in semantic but anyway) // - http://host/Path/Path/#Fragment diff --git a/src/libraries/System.Private.Uri/src/System/UriScheme.cs b/src/libraries/System.Private.Uri/src/System/UriScheme.cs index d9d96ab59ea3cb..7c39a6c44a336e 100644 --- a/src/libraries/System.Private.Uri/src/System/UriScheme.cs +++ b/src/libraries/System.Private.Uri/src/System/UriScheme.cs @@ -146,6 +146,9 @@ protected virtual string GetComponents(Uri uri, UriComponents components, UriFor if (!uri.IsAbsoluteUri) throw new InvalidOperationException(SR.net_uri_NotAbsolute); + if (uri.DisablePathAndQueryCanonicalization && (components & (UriComponents.Path | UriComponents.Query)) != 0) + throw new InvalidOperationException(SR.net_uri_GetComponentsCalledWhenCanonicalizationDisabled); + return uri.GetComponentsHelper(components, format); } diff --git a/src/libraries/System.Private.Uri/tests/FunctionalTests/System.Private.Uri.Functional.Tests.csproj b/src/libraries/System.Private.Uri/tests/FunctionalTests/System.Private.Uri.Functional.Tests.csproj index 8f07bb90af1ffe..21bb5200471aa1 100644 --- a/src/libraries/System.Private.Uri/tests/FunctionalTests/System.Private.Uri.Functional.Tests.csproj +++ b/src/libraries/System.Private.Uri/tests/FunctionalTests/System.Private.Uri.Functional.Tests.csproj @@ -17,6 +17,7 @@ + diff --git a/src/libraries/System.Private.Uri/tests/FunctionalTests/UriCreationOptionsTest.cs b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriCreationOptionsTest.cs new file mode 100644 index 00000000000000..3f7438738f0bf9 --- /dev/null +++ b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriCreationOptionsTest.cs @@ -0,0 +1,294 @@ +// 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.Generic; +using System.Linq; +using Xunit; + +namespace System.PrivateUri.Tests +{ + public class UriCreationOptionsTest + { + [Fact] + public void UriCreationOptions_HasReasonableDefaults() + { + UriCreationOptions options = default; + + Assert.False(options.DangerousDisablePathAndQueryCanonicalization); + } + + [Fact] + public void UriCreationOptions_StoresCorrectValues() + { + var options = new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = true }; + Assert.True(options.DangerousDisablePathAndQueryCanonicalization); + + options = new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = false }; + Assert.False(options.DangerousDisablePathAndQueryCanonicalization); + } + + public static IEnumerable DisableCanonicalization_TestData() + { + var schemes = new string[] { "http", "hTTp", " http", "https" }; + var hosts = new string[] { "foo", "f\u00F6\u00F6.com" }; + var ports = new string[] { ":80", ":443", ":0123", ":", "" }; + + var pathAndQueries = new string[] + { + "", + " ", + "a b", + "a%20b", + "?a b", + "?a%20b", + "foo/./", + "foo/../", + "//\\//", + "%41", + "A?%41=%42", + "?%41=%42", + "? ", + }; + + var fragments = new string[] { "", "#", "#/foo ? %20%41/..//\\a" }; + var unicodeInPathModes = new int[] { 0, 1, 2, 3 }; + var pathDelimiters = new string[] { "", "/" }; + + // Get various combinations of paths with unicode characters and delimiters + string[] rawTargets = pathAndQueries + .SelectMany(pq => fragments.Select(fragment => pq + fragment)) + .SelectMany(pqf => unicodeInPathModes.Select(unicodeMode => unicodeMode switch + { + 0 => pqf, + 1 => "\u00F6" + pqf, + 2 => pqf + "\u00F6", + _ => pqf.Insert(pqf.Length / 2, "\u00F6") + })) + .ToHashSet() + .SelectMany(pqf => pathDelimiters.Select(delimiter => delimiter + pqf)) + .Where(target => target.StartsWith('/') || target.StartsWith('?')) // Can't see where the authority ends and the path starts otherwise + .ToArray(); + + foreach (string scheme in schemes) + { + foreach (string host in hosts) + { + foreach (string port in ports) + { + foreach (string rawTarget in rawTargets) + { + string uriString = $"{scheme}://{host}{port}{rawTarget}"; + + int expectedPort = port.Length > 1 ? int.Parse(port.AsSpan(1)) : new Uri($"{scheme}://foo").Port; + + string expectedQuery = rawTarget.Contains('?') ? rawTarget.Substring(rawTarget.IndexOf('?')) : ""; + + string expectedPath = rawTarget.Substring(0, rawTarget.Length - expectedQuery.Length); + + yield return new object[] { uriString, host, expectedPort, expectedPath, expectedQuery }; + } + } + } + } + } + + [Theory] + [MemberData(nameof(DisableCanonicalization_TestData))] + public void DisableCanonicalization_IsRespected(string uriString, string expectedHost, int expectedPort, string expectedPath, string expectedQuery) + { + var options = new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = true }; + + var uri = new Uri(uriString, options); + DoAsserts(uri); + + Assert.True(Uri.TryCreate(uriString, options, out uri)); + DoAsserts(uri); + + void DoAsserts(Uri uri) + { + Assert.Equal(new Uri($"http://{expectedHost}").Host, uri.Host); + Assert.Equal(new Uri($"http://{expectedHost}").IdnHost, uri.IdnHost); + + Assert.Equal(expectedPort, uri.Port); + + Assert.Same(uri.AbsolutePath, uri.AbsolutePath); + Assert.Equal(expectedPath, uri.AbsolutePath); + + Assert.Same(uri.Query, uri.Query); + Assert.Equal(expectedQuery, uri.Query); + + string expectedPathAndQuery = expectedPath + expectedQuery; + Assert.Same(uri.PathAndQuery, uri.PathAndQuery); + Assert.Equal(expectedPathAndQuery, uri.PathAndQuery); + + Assert.Same(uri.Fragment, uri.Fragment); + Assert.Empty(uri.Fragment); // Fragment is always empty if DisableCanonicalization is set + } + } + + [Fact] + public void DisableCanonicalization_OnlyEqualToUrisWithMatchingFlag() + { + const string AbsoluteUri = "http://host"; + const string Path = "/foo"; + + var absolute = new Uri(AbsoluteUri + Path, new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = false }); + var absoluteRaw = new Uri(AbsoluteUri + Path, new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = true }); + NotEqual(absolute, absoluteRaw); + Equal(absolute, absolute); + Equal(absoluteRaw, absoluteRaw); + + var absoluteRawCopy = new Uri(AbsoluteUri + Path, new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = true }); + Equal(absoluteRaw, absoluteRawCopy); + + var absoluteRawDifferentPath = new Uri(AbsoluteUri + "/bar", new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = true }); + NotEqual(absoluteRaw, absoluteRawDifferentPath); + + var absoluteRawSameAuthority = new Uri(AbsoluteUri + ":80" + Path, new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = true }); + Equal(absoluteRaw, absoluteRawSameAuthority); + + static void Equal(Uri left, Uri right) + { + Assert.True(left.Equals(right)); + Assert.True(right.Equals(left)); + Assert.Equal(left.GetHashCode(), right.GetHashCode()); + } + + static void NotEqual(Uri left, Uri right) + { + Assert.False(left.Equals(right)); + Assert.False(right.Equals(left)); + } + } + + private const string FilePathRawData = "//\\A%41 %20\u00F6/.././%5C%2F#%42?%43#%44"; + + public static IEnumerable ImplicitFilePaths_TestData() + { + yield return Entry("C:/"); + yield return Entry("C|/"); + + yield return Entry(@"//foo"); + yield return Entry(@"\/foo"); + yield return Entry(@"/\foo"); + yield return Entry(@"\\foo"); + + if (!PlatformDetection.IsWindows) + { + yield return Entry("/foo"); + } + + static object[] Entry(string filePath) => new object[] { $"{filePath}/{FilePathRawData}" }; + } + + [Theory] + [MemberData(nameof(ImplicitFilePaths_TestData))] + public void DisableCanonicalization_WorksWithFileUris(string implicitFilePath) + { + var options = new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = true }; + + var uri = new Uri(implicitFilePath, options); + DoAsserts(uri); + + Assert.True(Uri.TryCreate(implicitFilePath, options, out uri)); + DoAsserts(uri); + + static void DoAsserts(Uri uri) + { + Assert.True(uri.IsAbsoluteUri); + Assert.True(uri.IsFile); + Assert.Contains(FilePathRawData, uri.AbsolutePath); + Assert.Contains(FilePathRawData, uri.AbsoluteUri); + Assert.Contains(FilePathRawData, uri.ToString()); + } + } + + [Theory] + [InlineData("http")] + [InlineData("https")] + [InlineData("ftp")] + [InlineData("file")] + [InlineData("custom-unknown")] + [InlineData("custom-registered")] + public void DisableCanonicalization_WorksWithDifferentSchemes(string scheme) + { + if (scheme == "custom-registered") + { + scheme += "DisableCanonicalization"; + UriParser.Register(new HttpStyleUriParser(), scheme, defaultPort: Random.Shared.Next(-1, 65536)); + } + + string uriString = $"{scheme}://host/p%41th?a=%42#fragm%45nt"; + var options = new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = true }; + + var referenceUri = new Uri(uriString); + + var uri = new Uri(uriString, options); + DoAsserts(uri); + + Assert.True(Uri.TryCreate(uriString, options, out uri)); + DoAsserts(uri); + + void DoAsserts(Uri uri) + { + Assert.Same(referenceUri.Scheme, uri.Scheme); + Assert.Equal(referenceUri.Host, uri.Host); + Assert.Equal(referenceUri.IdnHost, uri.IdnHost); + Assert.Equal(referenceUri.Authority, uri.Authority); + Assert.Equal(referenceUri.Port, uri.Port); + Assert.Equal(referenceUri.IsDefaultPort, uri.IsDefaultPort); + + string referencePath = "/pAth"; + string referenceQuery = "?a=B"; + string path = "/p%41th"; + string query = "?a=%42#fragm%45nt"; + + if (scheme == "ftp") // No query + { + referencePath += referenceQuery.Replace("?", "%3F"); + path += query; + + referenceQuery = string.Empty; + query = string.Empty; + } + + Assert.Equal(referencePath, referenceUri.AbsolutePath); + Assert.Equal(path, uri.AbsolutePath); + + Assert.Equal(referenceQuery, referenceUri.Query); + Assert.Equal(query, uri.Query); + + Assert.Equal(referencePath + referenceQuery, referenceUri.PathAndQuery); + Assert.Equal(path + query, uri.PathAndQuery); + + Assert.Equal("#fragmEnt", referenceUri.Fragment); + Assert.Empty(uri.Fragment); + + _ = referenceUri.GetComponents(UriComponents.AbsoluteUri, UriFormat.UriEscaped); + Assert.Throws(() => uri.GetComponents(UriComponents.Path, UriFormat.UriEscaped)); + } + } + + [Theory] + [InlineData(UriFormat.UriEscaped)] + [InlineData(UriFormat.Unescaped)] + [InlineData(UriFormat.SafeUnescaped)] + public void DisableCanonicalization_GetComponentsThrowsForPathAndQuery(UriFormat format) + { + var uri = new Uri("http://host/foo?bar=abc#fragment", new UriCreationOptions { DangerousDisablePathAndQueryCanonicalization = true }); + + Assert.Equal("http", uri.GetComponents(UriComponents.Scheme, format)); + Assert.Equal("host", uri.GetComponents(UriComponents.Host, format)); + Assert.Equal("80", uri.GetComponents(UriComponents.StrongPort, format)); + Assert.Empty(uri.GetComponents(UriComponents.Fragment, format)); + + Assert.Throws(() => uri.GetComponents(UriComponents.Path, format)); + Assert.Throws(() => uri.GetComponents(UriComponents.Query, format)); + Assert.Throws(() => uri.GetComponents(UriComponents.PathAndQuery, format)); + Assert.Throws(() => uri.GetComponents(UriComponents.AbsoluteUri, format)); + } + + + private sealed class CustomUriParser : UriParser { } + } +} diff --git a/src/libraries/System.Private.Xml/src/Resources/Strings.resx b/src/libraries/System.Private.Xml/src/Resources/Strings.resx index d19dc6ec4eb314..112359dfecba8c 100644 --- a/src/libraries/System.Private.Xml/src/Resources/Strings.resx +++ b/src/libraries/System.Private.Xml/src/Resources/Strings.resx @@ -2787,6 +2787,9 @@ Type '{0}' is not serializable. + + Type '{0}' is from an AssemblyLoadContext which is incompatible with that which contains this XmlSerializer. + Invalid XmlSerializerAssemblyAttribute usage. Please use {0} property or {1} property. diff --git a/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj b/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj index 2afc279cf5f805..648245cdb49703 100644 --- a/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj +++ b/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj @@ -446,6 +446,7 @@ + @@ -565,6 +566,7 @@ + diff --git a/src/libraries/System.Private.Xml/src/System/Xml/BinaryXml/XmlBinaryReader.cs b/src/libraries/System.Private.Xml/src/System/Xml/BinaryXml/XmlBinaryReader.cs index f2c53a5ca2209c..560157a9d7aab2 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/BinaryXml/XmlBinaryReader.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/BinaryXml/XmlBinaryReader.cs @@ -3519,7 +3519,9 @@ private XmlNodeType CheckText(bool attr) Debug.Assert(_checkCharacters, "this.checkCharacters"); // grab local copy (perf) - ReadOnlySpan data = _data.AsSpan(_tokDataPos, _end - _tokDataPos); + // Get the bytes for the current token. _tokDataPos is the beginning position, + // and _pos has advanced to the next token (1 past the end of this token). + ReadOnlySpan data = _data.AsSpan(_tokDataPos, _pos - _tokDataPos); Debug.Assert(data.Length % 2 == 0, "Data size should not be odd"); if (!attr) diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Core/LocalAppContextSwitches.cs b/src/libraries/System.Private.Xml/src/System/Xml/Core/LocalAppContextSwitches.cs index 8bc1f54dc8b50b..c1b604c887c57e 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Core/LocalAppContextSwitches.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Core/LocalAppContextSwitches.cs @@ -56,5 +56,15 @@ public static bool AllowDefaultResolver return GetCachedSwitchValue("Switch.System.Xml.AllowDefaultResolver", ref s_allowDefaultResolver); } } + + private static int s_serializationUseDefaultXmlWriterSettings; + public static bool SerializationUseDefaultXmlWriterSettings + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + return GetCachedSwitchValue("Switch.System.Xml.Serialization.UseDefaultXmlWriterSettings", ref s_serializationUseDefaultXmlWriterSettings); + } + } } } diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs index 8fdeed7b60b770..c3df77a5a2bc3f 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs @@ -11,6 +11,8 @@ using System.Globalization; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; +using System.Runtime.Loader; namespace System.Xml.Serialization { @@ -149,79 +151,82 @@ internal void InitAssemblyMethods(XmlMapping[] xmlMappings) contract = null; string? serializerName = null; - // check to see if we loading explicit pre-generated assembly - object[] attrs = type.GetCustomAttributes(typeof(System.Xml.Serialization.XmlSerializerAssemblyAttribute), false); - if (attrs.Length == 0) + using (AssemblyLoadContext.EnterContextualReflection(type.Assembly)) { - // Guess serializer name: if parent assembly signed use strong name - AssemblyName name = type.Assembly.GetName(); - serializerName = Compiler.GetTempAssemblyName(name, defaultNamespace); - // use strong name - name.Name = serializerName; - name.CodeBase = null; - name.CultureInfo = CultureInfo.InvariantCulture; - - try - { - serializer = Assembly.Load(name); - } - catch (Exception e) - { - if (e is OutOfMemoryException) + // check to see if we loading explicit pre-generated assembly + object[] attrs = type.GetCustomAttributes(typeof(System.Xml.Serialization.XmlSerializerAssemblyAttribute), false); + if (attrs.Length == 0) + { + // Guess serializer name: if parent assembly signed use strong name + AssemblyName name = type.Assembly.GetName(); + serializerName = Compiler.GetTempAssemblyName(name, defaultNamespace); + // use strong name + name.Name = serializerName; + name.CodeBase = null; + name.CultureInfo = CultureInfo.InvariantCulture; + + try { - throw; + serializer = Assembly.Load(name); } - } - - serializer ??= LoadAssemblyByPath(type, serializerName); - - if (serializer == null) - { - if (XmlSerializer.Mode == SerializationMode.PreGenOnly) + catch (Exception e) { - throw new Exception(SR.Format(SR.FailLoadAssemblyUnderPregenMode, serializerName)); + if (e is OutOfMemoryException) + { + throw; + } } - return null; - } + serializer ??= LoadAssemblyByPath(type, serializerName); - if (!IsSerializerVersionMatch(serializer, type, defaultNamespace)) - { - XmlSerializationEventSource.Log.XmlSerializerExpired(serializerName, type.FullName!); - return null; - } - } - else - { - System.Xml.Serialization.XmlSerializerAssemblyAttribute assemblyAttribute = (System.Xml.Serialization.XmlSerializerAssemblyAttribute)attrs[0]; - if (assemblyAttribute.AssemblyName != null && assemblyAttribute.CodeBase != null) - throw new InvalidOperationException(SR.Format(SR.XmlPregenInvalidXmlSerializerAssemblyAttribute, "AssemblyName", "CodeBase")); + if (serializer == null) + { + if (XmlSerializer.Mode == SerializationMode.PreGenOnly) + { + throw new Exception(SR.Format(SR.FailLoadAssemblyUnderPregenMode, serializerName)); + } - // found XmlSerializerAssemblyAttribute attribute, it should have all needed information to load the pre-generated serializer - if (assemblyAttribute.AssemblyName != null) - { - serializerName = assemblyAttribute.AssemblyName; - serializer = Assembly.Load(serializerName); // LoadWithPartialName just does this in .Net Core; changing the obsolete call. - } - else if (assemblyAttribute.CodeBase != null && assemblyAttribute.CodeBase.Length > 0) - { - serializerName = assemblyAttribute.CodeBase; - serializer = Assembly.LoadFrom(serializerName); + return null; + } + + if (!IsSerializerVersionMatch(serializer, type, defaultNamespace)) + { + XmlSerializationEventSource.Log.XmlSerializerExpired(serializerName, type.FullName!); + return null; + } } else { - serializerName = type.Assembly.FullName; - serializer = type.Assembly; - } - if (serializer == null) - { - throw new FileNotFoundException(null, serializerName); + System.Xml.Serialization.XmlSerializerAssemblyAttribute assemblyAttribute = (System.Xml.Serialization.XmlSerializerAssemblyAttribute)attrs[0]; + if (assemblyAttribute.AssemblyName != null && assemblyAttribute.CodeBase != null) + throw new InvalidOperationException(SR.Format(SR.XmlPregenInvalidXmlSerializerAssemblyAttribute, "AssemblyName", "CodeBase")); + + // found XmlSerializerAssemblyAttribute attribute, it should have all needed information to load the pre-generated serializer + if (assemblyAttribute.AssemblyName != null) + { + serializerName = assemblyAttribute.AssemblyName; + serializer = Assembly.Load(serializerName); // LoadWithPartialName just does this in .Net Core; changing the obsolete call. + } + else if (assemblyAttribute.CodeBase != null && assemblyAttribute.CodeBase.Length > 0) + { + serializerName = assemblyAttribute.CodeBase; + serializer = Assembly.LoadFrom(serializerName); + } + else + { + serializerName = type.Assembly.FullName; + serializer = type.Assembly; + } + if (serializer == null) + { + throw new FileNotFoundException(null, serializerName); + } } + Type contractType = GetTypeFromAssembly(serializer, "XmlSerializerContract"); + contract = (XmlSerializerImplementation)Activator.CreateInstance(contractType)!; + if (contract.CanSerialize(type)) + return serializer; } - Type contractType = GetTypeFromAssembly(serializer, "XmlSerializerContract"); - contract = (XmlSerializerImplementation)Activator.CreateInstance(contractType)!; - if (contract.CanSerialize(type)) - return serializer; return null; } @@ -449,81 +454,93 @@ internal static bool GenerateSerializerToStream(XmlMapping[] xmlMappings, Type?[ } [RequiresUnreferencedCode("calls GenerateElement")] - internal static Assembly GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type?[]? types, string? defaultNamespace) + internal static Assembly GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type?[] types, string? defaultNamespace) { + var mainType = (types.Length > 0) ? types[0] : null; + Assembly? mainAssembly = mainType?.Assembly; var scopeTable = new Dictionary(); foreach (XmlMapping mapping in xmlMappings) scopeTable[mapping.Scope!] = mapping; TypeScope[] scopes = new TypeScope[scopeTable.Keys.Count]; scopeTable.Keys.CopyTo(scopes, 0); - string assemblyName = "Microsoft.GeneratedCode"; - AssemblyBuilder assemblyBuilder = CodeGenerator.CreateAssemblyBuilder(assemblyName); - // Add AssemblyVersion attribute to match parent assembly version - if (types != null && types.Length > 0 && types[0] != null) + using (AssemblyLoadContext.EnterContextualReflection(mainAssembly)) { - ConstructorInfo AssemblyVersionAttribute_ctor = typeof(AssemblyVersionAttribute).GetConstructor( - new Type[] { typeof(string) } - )!; - string assemblyVersion = types[0]!.Assembly.GetName().Version!.ToString(); - assemblyBuilder.SetCustomAttribute(new CustomAttributeBuilder(AssemblyVersionAttribute_ctor, new object[] { assemblyVersion })); - } - CodeIdentifiers classes = new CodeIdentifiers(); - classes.AddUnique("XmlSerializationWriter", "XmlSerializationWriter"); - classes.AddUnique("XmlSerializationReader", "XmlSerializationReader"); - string? suffix = null; - if (types != null && types.Length == 1 && types[0] != null) - { - suffix = CodeIdentifier.MakeValid(types[0]!.Name); - if (types[0]!.IsArray) + // Before generating any IL, check each mapping and supported type to make sure + // they are compatible with the current ALC + for (int i = 0; i < types.Length; i++) + VerifyLoadContext(types[i], mainAssembly); + foreach (var mapping in xmlMappings) + VerifyLoadContext(mapping.Accessor.Mapping?.TypeDesc?.Type, mainAssembly); + + string assemblyName = "Microsoft.GeneratedCode"; + AssemblyBuilder assemblyBuilder = CodeGenerator.CreateAssemblyBuilder(assemblyName); + // Add AssemblyVersion attribute to match parent assembly version + if (mainType != null) + { + ConstructorInfo AssemblyVersionAttribute_ctor = typeof(AssemblyVersionAttribute).GetConstructor( + new Type[] { typeof(string) } + )!; + string assemblyVersion = mainType.Assembly.GetName().Version!.ToString(); + assemblyBuilder.SetCustomAttribute(new CustomAttributeBuilder(AssemblyVersionAttribute_ctor, new object[] { assemblyVersion })); + } + CodeIdentifiers classes = new CodeIdentifiers(); + classes.AddUnique("XmlSerializationWriter", "XmlSerializationWriter"); + classes.AddUnique("XmlSerializationReader", "XmlSerializationReader"); + string? suffix = null; + if (mainType != null) { - suffix += "Array"; + suffix = CodeIdentifier.MakeValid(mainType.Name); + if (mainType.IsArray) + { + suffix += "Array"; + } } - } - ModuleBuilder moduleBuilder = CodeGenerator.CreateModuleBuilder(assemblyBuilder, assemblyName); + ModuleBuilder moduleBuilder = CodeGenerator.CreateModuleBuilder(assemblyBuilder, assemblyName); - string writerClass = "XmlSerializationWriter" + suffix; - writerClass = classes.AddUnique(writerClass, writerClass); - XmlSerializationWriterILGen writerCodeGen = new XmlSerializationWriterILGen(scopes, "public", writerClass); - writerCodeGen.ModuleBuilder = moduleBuilder; + string writerClass = "XmlSerializationWriter" + suffix; + writerClass = classes.AddUnique(writerClass, writerClass); + XmlSerializationWriterILGen writerCodeGen = new XmlSerializationWriterILGen(scopes, "public", writerClass); + writerCodeGen.ModuleBuilder = moduleBuilder; - writerCodeGen.GenerateBegin(); - string[] writeMethodNames = new string[xmlMappings.Length]; + writerCodeGen.GenerateBegin(); + string[] writeMethodNames = new string[xmlMappings.Length]; - for (int i = 0; i < xmlMappings.Length; i++) - { - writeMethodNames[i] = writerCodeGen.GenerateElement(xmlMappings[i])!; - } - Type writerType = writerCodeGen.GenerateEnd(); + for (int i = 0; i < xmlMappings.Length; i++) + { + writeMethodNames[i] = writerCodeGen.GenerateElement(xmlMappings[i])!; + } + Type writerType = writerCodeGen.GenerateEnd(); - string readerClass = "XmlSerializationReader" + suffix; - readerClass = classes.AddUnique(readerClass, readerClass); - XmlSerializationReaderILGen readerCodeGen = new XmlSerializationReaderILGen(scopes, "public", readerClass); + string readerClass = "XmlSerializationReader" + suffix; + readerClass = classes.AddUnique(readerClass, readerClass); + XmlSerializationReaderILGen readerCodeGen = new XmlSerializationReaderILGen(scopes, "public", readerClass); - readerCodeGen.ModuleBuilder = moduleBuilder; - readerCodeGen.CreatedTypes.Add(writerType.Name, writerType); + readerCodeGen.ModuleBuilder = moduleBuilder; + readerCodeGen.CreatedTypes.Add(writerType.Name, writerType); - readerCodeGen.GenerateBegin(); - string[] readMethodNames = new string[xmlMappings.Length]; - for (int i = 0; i < xmlMappings.Length; i++) - { - readMethodNames[i] = readerCodeGen.GenerateElement(xmlMappings[i])!; - } - readerCodeGen.GenerateEnd(readMethodNames, xmlMappings, types!); + readerCodeGen.GenerateBegin(); + string[] readMethodNames = new string[xmlMappings.Length]; + for (int i = 0; i < xmlMappings.Length; i++) + { + readMethodNames[i] = readerCodeGen.GenerateElement(xmlMappings[i])!; + } + readerCodeGen.GenerateEnd(readMethodNames, xmlMappings, types!); - string baseSerializer = readerCodeGen.GenerateBaseSerializer("XmlSerializer1", readerClass, writerClass, classes); - var serializers = new Dictionary(); - for (int i = 0; i < xmlMappings.Length; i++) - { - if (!serializers.ContainsKey(xmlMappings[i].Key!)) + string baseSerializer = readerCodeGen.GenerateBaseSerializer("XmlSerializer1", readerClass, writerClass, classes); + var serializers = new Dictionary(); + for (int i = 0; i < xmlMappings.Length; i++) { - serializers[xmlMappings[i].Key!] = readerCodeGen.GenerateTypedSerializer(readMethodNames[i], writeMethodNames[i], xmlMappings[i], classes, baseSerializer, readerClass, writerClass); + if (!serializers.ContainsKey(xmlMappings[i].Key!)) + { + serializers[xmlMappings[i].Key!] = readerCodeGen.GenerateTypedSerializer(readMethodNames[i], writeMethodNames[i], xmlMappings[i], classes, baseSerializer, readerClass, writerClass); + } } - } - readerCodeGen.GenerateSerializerContract("XmlSerializerContract", xmlMappings, types!, readerClass, readMethodNames, writerClass, writeMethodNames, serializers); + readerCodeGen.GenerateSerializerContract("XmlSerializerContract", xmlMappings, types!, readerClass, readMethodNames, writerClass, writeMethodNames, serializers); - return writerType.Assembly; + return writerType.Assembly; + } } private static MethodInfo GetMethodFromType( @@ -588,6 +605,23 @@ internal bool CanRead(XmlMapping mapping, XmlReader xmlReader) return encodingStyle; } + internal static void VerifyLoadContext(Type? t, Assembly? assembly) + { + // The quick case, t is null or in the same assembly + if (t == null || assembly == null || t.Assembly == assembly) + return; + + // No worries if the type is not collectible + var typeALC = AssemblyLoadContext.GetLoadContext(t.Assembly); + if (typeALC == null || !typeALC.IsCollectible) + return; + + // Collectible types should be in the same collectible context + var baseALC = AssemblyLoadContext.GetLoadContext(assembly) ?? AssemblyLoadContext.CurrentContextualReflectionContext; + if (typeALC != baseALC) + throw new InvalidOperationException(SR.Format(SR.XmlTypeInBadLoadContext, t.FullName)); + } + [RequiresUnreferencedCode("calls Contract")] internal object? InvokeReader(XmlMapping mapping, XmlReader xmlReader, XmlDeserializationEvents events, string? encodingStyle) { @@ -666,9 +700,9 @@ internal sealed class TempMethodDictionary : Dictionary internal sealed class TempAssemblyCacheKey { private readonly string? _ns; - private readonly object _type; + private readonly Type _type; - internal TempAssemblyCacheKey(string? ns, object type) + internal TempAssemblyCacheKey(string? ns, Type type) { _type = type; _ns = ns; @@ -690,29 +724,52 @@ public override int GetHashCode() internal sealed class TempAssemblyCache { - private Dictionary _cache = new Dictionary(); + private Dictionary _fastCache = new Dictionary(); + private ConditionalWeakTable> _collectibleCaches = new ConditionalWeakTable>(); - internal TempAssembly? this[string? ns, object o] + internal TempAssembly? this[string? ns, Type t] { get { TempAssembly? tempAssembly; - _cache.TryGetValue(new TempAssemblyCacheKey(ns, o), out tempAssembly); + TempAssemblyCacheKey key = new TempAssemblyCacheKey(ns, t); + + if (_fastCache.TryGetValue(key, out tempAssembly)) + return tempAssembly; + + if (_collectibleCaches.TryGetValue(t.Assembly, out var cCache)) + cCache.TryGetValue(key, out tempAssembly); + return tempAssembly; } } - internal void Add(string? ns, object o, TempAssembly assembly) + internal void Add(string? ns, Type t, TempAssembly assembly) { - TempAssemblyCacheKey key = new TempAssemblyCacheKey(ns, o); lock (this) { - TempAssembly? tempAssembly; - if (_cache.TryGetValue(key, out tempAssembly) && tempAssembly == assembly) + TempAssembly? tempAssembly = this[ns, t]; + if (tempAssembly == assembly) return; - Dictionary _copy = new Dictionary(_cache); // clone - _copy[key] = assembly; - _cache = _copy; + + AssemblyLoadContext? alc = AssemblyLoadContext.GetLoadContext(t.Assembly); + TempAssemblyCacheKey key = new TempAssemblyCacheKey(ns, t); + Dictionary? cache; + + if (alc != null && alc.IsCollectible) + { + cache = _collectibleCaches.TryGetValue(t.Assembly, out var c) // Clone or create + ? new Dictionary(c) + : new Dictionary(); + cache[key] = assembly; + _collectibleCaches.AddOrUpdate(t.Assembly, cache); + } + else + { + cache = new Dictionary(_fastCache); // Clone + cache[key] = assembly; + _fastCache = cache; + } } } } diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ContextAwareTables.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ContextAwareTables.cs new file mode 100644 index 00000000000000..64e09bbc063b2c --- /dev/null +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ContextAwareTables.cs @@ -0,0 +1,66 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Xml.Serialization +{ + using System; + using System.Collections; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.CompilerServices; + using System.Runtime.Loader; + + internal class ContextAwareTables<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]T> where T : class? + { + private Hashtable _defaultTable; + private ConditionalWeakTable _collectibleTable; + + public ContextAwareTables() + { + _defaultTable = new Hashtable(); + _collectibleTable = new ConditionalWeakTable(); + } + + internal T GetOrCreateValue(Type t, Func f) + { + // The fast and most common default case + T? ret = (T?)_defaultTable[t]; + if (ret != null) + return ret; + + // Common case for collectible contexts + if (_collectibleTable.TryGetValue(t, out ret)) + return ret; + + // Not found. Do the slower work of creating the value in the correct collection. + AssemblyLoadContext? alc = AssemblyLoadContext.GetLoadContext(t.Assembly); + + // Null and non-collectible load contexts use the default table + if (alc == null || !alc.IsCollectible) + { + lock (_defaultTable) + { + if ((ret = (T?)_defaultTable[t]) == null) + { + ret = f(); + _defaultTable[t] = ret; + } + } + } + + // Collectible load contexts should use the ConditionalWeakTable so they can be unloaded + else + { + lock (_collectibleTable) + { + if (!_collectibleTable.TryGetValue(t, out ret)) + { + ret = f(); + _collectibleTable.AddOrUpdate(t, ret); + } + } + } + + return ret; + } + } +} diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs index 0c55638a27a66a..2477f283b01f16 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs @@ -627,40 +627,48 @@ private static void AddObjectsIntoTargetCollection(object targetCollection, List } } - private static readonly ConcurrentDictionary<(Type, string), ReflectionXmlSerializationReaderHelper.SetMemberValueDelegate> s_setMemberValueDelegateCache = new ConcurrentDictionary<(Type, string), ReflectionXmlSerializationReaderHelper.SetMemberValueDelegate>(); + private static readonly ContextAwareTables s_setMemberValueDelegateCache = new ContextAwareTables(); [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] private static ReflectionXmlSerializationReaderHelper.SetMemberValueDelegate GetSetMemberValueDelegate(object o, string memberName) { Debug.Assert(o != null, "Object o should not be null"); Debug.Assert(!string.IsNullOrEmpty(memberName), "memberName must have a value"); - (Type, string) typeMemberNameTuple = (o.GetType(), memberName); - if (!s_setMemberValueDelegateCache.TryGetValue(typeMemberNameTuple, out ReflectionXmlSerializationReaderHelper.SetMemberValueDelegate? result)) + Type type = o.GetType(); + var delegateCacheForType = s_setMemberValueDelegateCache.GetOrCreateValue(type, () => new Hashtable()); + var result = delegateCacheForType[memberName]; + if (result == null) { - MemberInfo memberInfo = ReflectionXmlSerializationHelper.GetEffectiveSetInfo(o.GetType(), memberName); - Debug.Assert(memberInfo != null, "memberInfo could not be retrieved"); - Type memberType; - if (memberInfo is PropertyInfo propInfo) - { - memberType = propInfo.PropertyType; - } - else if (memberInfo is FieldInfo fieldInfo) - { - memberType = fieldInfo.FieldType; - } - else + lock (delegateCacheForType) { - throw new InvalidOperationException(SR.XmlInternalError); - } + if ((result = delegateCacheForType[memberName]) == null) + { + MemberInfo memberInfo = ReflectionXmlSerializationHelper.GetEffectiveSetInfo(o.GetType(), memberName); + Debug.Assert(memberInfo != null, "memberInfo could not be retrieved"); + Type memberType; + if (memberInfo is PropertyInfo propInfo) + { + memberType = propInfo.PropertyType; + } + else if (memberInfo is FieldInfo fieldInfo) + { + memberType = fieldInfo.FieldType; + } + else + { + throw new InvalidOperationException(SR.XmlInternalError); + } - MethodInfo getSetMemberValueDelegateWithTypeGenericMi = typeof(ReflectionXmlSerializationReaderHelper).GetMethod("GetSetMemberValueDelegateWithType", BindingFlags.Static | BindingFlags.Public)!; - MethodInfo getSetMemberValueDelegateWithTypeMi = getSetMemberValueDelegateWithTypeGenericMi.MakeGenericMethod(o.GetType(), memberType); - var getSetMemberValueDelegateWithType = (Func)getSetMemberValueDelegateWithTypeMi.CreateDelegate(typeof(Func)); - result = getSetMemberValueDelegateWithType(memberInfo); - s_setMemberValueDelegateCache.TryAdd(typeMemberNameTuple, result); + MethodInfo getSetMemberValueDelegateWithTypeGenericMi = typeof(ReflectionXmlSerializationReaderHelper).GetMethod("GetSetMemberValueDelegateWithType", BindingFlags.Static | BindingFlags.Public)!; + MethodInfo getSetMemberValueDelegateWithTypeMi = getSetMemberValueDelegateWithTypeGenericMi.MakeGenericMethod(o.GetType(), memberType); + var getSetMemberValueDelegateWithType = (Func)getSetMemberValueDelegateWithTypeMi.CreateDelegate(typeof(Func)); + result = getSetMemberValueDelegateWithType(memberInfo); + delegateCacheForType[memberName] = result; + } + } } - return result; + return (ReflectionXmlSerializationReaderHelper.SetMemberValueDelegate)result; } private object? GetMemberValue(object o, MemberInfo memberInfo) diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs index 46877f900e9028..7ebc4462dfb7a6 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs @@ -19,6 +19,7 @@ namespace System.Xml.Serialization using System.Xml.Serialization; using System.Xml; using System.Diagnostics.CodeAnalysis; + using System.Runtime.CompilerServices; /// public abstract class XmlSerializationWriter : XmlSerializationGeneratedCode @@ -1465,14 +1466,13 @@ internal static class DynamicAssemblies { private static readonly Hashtable s_nameToAssemblyMap = new Hashtable(); private static readonly Hashtable s_assemblyToNameMap = new Hashtable(); - private static readonly Hashtable s_tableIsTypeDynamic = Hashtable.Synchronized(new Hashtable()); + private static readonly ContextAwareTables s_tableIsTypeDynamic = new ContextAwareTables(); // SxS: This method does not take any resource name and does not expose any resources to the caller. // It's OK to suppress the SxS warning. internal static bool IsTypeDynamic(Type type) { - object? oIsTypeDynamic = s_tableIsTypeDynamic[type]; - if (oIsTypeDynamic == null) + object oIsTypeDynamic = s_tableIsTypeDynamic.GetOrCreateValue(type, () => { Assembly assembly = type.Assembly; bool isTypeDynamic = assembly.IsDynamic /*|| string.IsNullOrEmpty(assembly.Location)*/; @@ -1500,8 +1500,8 @@ internal static bool IsTypeDynamic(Type type) } } } - s_tableIsTypeDynamic[type] = oIsTypeDynamic = isTypeDynamic; - } + return isTypeDynamic; + }); return (bool)oIsTypeDynamic; } diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs index 15d78f2896ae62..8b7de3968f1bd8 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs @@ -10,6 +10,7 @@ using System.IO; using System.Reflection; using System.Runtime.CompilerServices; +using System.Runtime.Loader; using System.Runtime.Versioning; using System.Security; using System.Text; @@ -139,6 +140,8 @@ private static bool ReflectionMethodEnabled private static readonly TempAssemblyCache s_cache = new TempAssemblyCache(); private static volatile XmlSerializerNamespaces? s_defaultNamespaces; + private static readonly XmlWriterSettings s_writerSettings = new XmlWriterSettings() { Encoding = new UTF8Encoding(false), Indent = true }; + private static XmlSerializerNamespaces DefaultNamespaces { get @@ -161,8 +164,7 @@ private static XmlSerializerNamespaces DefaultNamespaces internal const string TrimSerializationWarning = "Members from serialized types may be trimmed if not referenced directly"; private const string TrimDeserializationWarning = "Members from deserialized types may be trimmed if not referenced directly"; - private static readonly Dictionary> s_xmlSerializerTable = new Dictionary>(); - + private static readonly ContextAwareTables> s_xmlSerializerTable = new ContextAwareTables>(); protected XmlSerializer() { } @@ -194,7 +196,10 @@ public XmlSerializer(XmlTypeMapping xmlTypeMapping) if (xmlTypeMapping == null) throw new ArgumentNullException(nameof(xmlTypeMapping)); - _tempAssembly = GenerateTempAssembly(xmlTypeMapping); + if (Mode != SerializationMode.ReflectionOnly) + { + _tempAssembly = GenerateTempAssembly(xmlTypeMapping); + } _mapping = xmlTypeMapping; } @@ -218,6 +223,12 @@ public XmlSerializer(Type type, string? defaultNamespace) _primitiveType = type; return; } + + if (Mode == SerializationMode.ReflectionOnly) + { + return; + } + _tempAssembly = s_cache[defaultNamespace, type]; if (_tempAssembly == null) { @@ -226,30 +237,28 @@ public XmlSerializer(Type type, string? defaultNamespace) _tempAssembly = s_cache[defaultNamespace, type]; if (_tempAssembly == null) { + XmlSerializerImplementation? contract = null; + Assembly? assembly = TempAssembly.LoadGeneratedAssembly(type, defaultNamespace, out contract); + if (assembly == null) { - XmlSerializerImplementation? contract = null; - Assembly? assembly = TempAssembly.LoadGeneratedAssembly(type, defaultNamespace, out contract); - if (assembly == null) - { - if (Mode == SerializationMode.PreGenOnly) - { - AssemblyName name = type.Assembly.GetName(); - var serializerName = Compiler.GetTempAssemblyName(name, defaultNamespace); - throw new FileLoadException(SR.Format(SR.FailLoadAssemblyUnderPregenMode, serializerName)); - } - - // need to reflect and generate new serialization assembly - XmlReflectionImporter importer = new XmlReflectionImporter(defaultNamespace); - _mapping = importer.ImportTypeMapping(type, null, defaultNamespace); - _tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace)!; - } - else + if (Mode == SerializationMode.PreGenOnly) { - // we found the pre-generated assembly, now make sure that the assembly has the right serializer - // try to avoid the reflection step, need to get ElementName, namespace and the Key form the type - _mapping = XmlReflectionImporter.GetTopLevelMapping(type, defaultNamespace); - _tempAssembly = new TempAssembly(new XmlMapping[] { _mapping }, assembly, contract); + AssemblyName name = type.Assembly.GetName(); + var serializerName = Compiler.GetTempAssemblyName(name, defaultNamespace); + throw new FileLoadException(SR.Format(SR.FailLoadAssemblyUnderPregenMode, serializerName)); } + + // need to reflect and generate new serialization assembly + XmlReflectionImporter importer = new XmlReflectionImporter(defaultNamespace); + _mapping = importer.ImportTypeMapping(type, null, defaultNamespace); + _tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace)!; + } + else + { + // we found the pre-generated assembly, now make sure that the assembly has the right serializer + // try to avoid the reflection step, need to get ElementName, namespace and the Key form the type + _mapping = XmlReflectionImporter.GetTopLevelMapping(type, defaultNamespace); + _tempAssembly = new TempAssembly(new XmlMapping[] { _mapping }, assembly, contract); } } s_cache.Add(defaultNamespace, type, _tempAssembly); @@ -270,7 +279,10 @@ public XmlSerializer(Type type, XmlAttributeOverrides? overrides, Type[]? extraT DefaultNamespace = defaultNamespace; _rootType = type; _mapping = GenerateXmlTypeMapping(type, overrides, extraTypes, root, defaultNamespace); - _tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace, location); + if (Mode != SerializationMode.ReflectionOnly) + { + _tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace, location); + } } [RequiresUnreferencedCode("calls ImportTypeMapping")] @@ -324,7 +336,7 @@ public void Serialize(TextWriter textWriter, object? o) [RequiresUnreferencedCode(TrimSerializationWarning)] public void Serialize(TextWriter textWriter, object? o, XmlSerializerNamespaces? namespaces) { - XmlWriter xmlWriter = XmlWriter.Create(textWriter); + XmlWriter xmlWriter = LocalAppContextSwitches.SerializationUseDefaultXmlWriterSettings ? XmlWriter.Create(textWriter) : XmlWriter.Create(textWriter, s_writerSettings); Serialize(xmlWriter, o, namespaces); } @@ -337,7 +349,7 @@ public void Serialize(Stream stream, object? o) [RequiresUnreferencedCode(TrimSerializationWarning)] public void Serialize(Stream stream, object? o, XmlSerializerNamespaces? namespaces) { - XmlWriter xmlWriter = XmlWriter.Create(stream); + XmlWriter xmlWriter = XmlWriter.Create(stream, s_writerSettings); Serialize(xmlWriter, o, namespaces); } @@ -391,7 +403,9 @@ public void Serialize(XmlWriter xmlWriter, object? o, XmlSerializerNamespaces? n } } else + { _tempAssembly.InvokeWriter(_mapping, xmlWriter, o, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id); + } } catch (Exception? e) { @@ -530,6 +544,14 @@ public virtual bool CanDeserialize(XmlReader xmlReader) TypeDesc typeDesc = (TypeDesc)TypeScope.PrimtiveTypes[_primitiveType]!; return xmlReader.IsStartElement(typeDesc.DataType!.Name!, string.Empty); } + else if (ShouldUseReflectionBasedSerialization(_mapping) || _isReflectionBasedSerializer) + { + // If we should use reflection, we will try to do reflection-based deserialization, without fallback. + // Don't check xmlReader.IsStartElement to avoid having to duplicate SOAP deserialization logic here. + // It is better to return an incorrect 'true', which will throw during Deserialize than to return an + // incorrect 'false', and the caller won't even try to Deserialize when it would succeed. + return true; + } else if (_tempAssembly != null) { return _tempAssembly.CanRead(_mapping, xmlReader); @@ -541,13 +563,13 @@ public virtual bool CanDeserialize(XmlReader xmlReader) } [RequiresUnreferencedCode(TrimSerializationWarning)] - public static XmlSerializer[] FromMappings(XmlMapping[]? mappings) + public static XmlSerializer?[] FromMappings(XmlMapping[]? mappings) { return FromMappings(mappings, (Type?)null); } [RequiresUnreferencedCode(TrimSerializationWarning)] - public static XmlSerializer[] FromMappings(XmlMapping[]? mappings, Type? type) + public static XmlSerializer?[] FromMappings(XmlMapping[]? mappings, Type? type) { if (mappings == null || mappings.Length == 0) return Array.Empty(); bool anySoapMapping = false; @@ -607,9 +629,13 @@ public static XmlSerializer[] FromMappings(XmlMapping[]? mappings, Type? type) } else { - XmlSerializer[] serializers = new XmlSerializer[mappings.Length]; + XmlSerializer?[] serializers = new XmlSerializer?[mappings.Length]; for (int i = 0; i < serializers.Length; i++) - serializers[i] = (XmlSerializer)contract!.TypedSerializers[mappings[i].Key!]!; + { + serializers[i] = contract!.TypedSerializers[mappings[i].Key!] as XmlSerializer; + if (serializers[i] != null) + TempAssembly.VerifyLoadContext(serializers[i]!._rootType, type!.Assembly); + } return serializers; } } @@ -676,16 +702,9 @@ internal static bool GenerateSerializer(Type[]? types, XmlMapping[] mappings, St private static XmlSerializer[] GetSerializersFromCache(XmlMapping[] mappings, Type type) { XmlSerializer?[] serializers = new XmlSerializer?[mappings.Length]; - Dictionary? typedMappingTable = null; - lock (s_xmlSerializerTable) - { - if (!s_xmlSerializerTable.TryGetValue(type, out typedMappingTable)) - { - typedMappingTable = new Dictionary(); - s_xmlSerializerTable[type] = typedMappingTable; - } - } + + typedMappingTable = s_xmlSerializerTable.GetOrCreateValue(type, () => new Dictionary()); lock (typedMappingTable) { @@ -726,7 +745,7 @@ private static XmlSerializer[] GetSerializersFromCache(XmlMapping[] mappings, Ty } [RequiresUnreferencedCode(TrimSerializationWarning)] - public static XmlSerializer[] FromTypes(Type[]? types) + public static XmlSerializer?[] FromTypes(Type[]? types) { if (types == null) return Array.Empty(); diff --git a/src/libraries/System.Private.Xml/tests/TrimmingTests/System.Private.Xml.TrimmingTests.proj b/src/libraries/System.Private.Xml/tests/TrimmingTests/System.Private.Xml.TrimmingTests.proj index d7a0e73f68f5b8..181be44826a6a6 100644 --- a/src/libraries/System.Private.Xml/tests/TrimmingTests/System.Private.Xml.TrimmingTests.proj +++ b/src/libraries/System.Private.Xml/tests/TrimmingTests/System.Private.Xml.TrimmingTests.proj @@ -4,6 +4,8 @@ + diff --git a/src/libraries/System.Private.Xml/tests/TrimmingTests/XmlSerializer.Deserialize.SealerOpt.cs b/src/libraries/System.Private.Xml/tests/TrimmingTests/XmlSerializer.Deserialize.SealerOpt.cs new file mode 100644 index 00000000000000..11a5b5e91827f4 --- /dev/null +++ b/src/libraries/System.Private.Xml/tests/TrimmingTests/XmlSerializer.Deserialize.SealerOpt.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Reflection; + +namespace System.Xml.Serialization.TrimmingTests +{ + /// + /// Tests that using XmlSerializer with linker option '--enable-opt sealer' works + /// when IsDynamicCodeSupported==false. + /// + internal class Program + { + // Preserve these types until XmlSerializer is fully trim-safe. + // see https://github.com/dotnet/runtime/issues/44768 + [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Response))] + public static int Main() + { + // simulate IsDynamicCodeSupported==false by setting the SerializationMode to ReflectionOnly + const int ReflectionOnly = 1; + typeof(XmlSerializer).GetField("s_mode", BindingFlags.NonPublic | BindingFlags.Static) + .SetValue(null, ReflectionOnly); + + using StringReader stringReader = new StringReader(@" + + "); + + Response obj = (Response)new XmlSerializer(typeof(Response)).Deserialize(stringReader); + if (obj.DataType == "Data") + { + return 100; + } + + return -1; + } + } + + [Serializable] + [XmlType(AnonymousType = true)] + [XmlRoot(Namespace = "", IsNullable = false)] + public class Response + { + [XmlAttribute] + public string DataType { get; set; } + } +} diff --git a/src/libraries/System.Private.Xml/tests/XmlSerializer/ReflectionOnly/System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj b/src/libraries/System.Private.Xml/tests/XmlSerializer/ReflectionOnly/System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj index 53abcbd3957022..d7d1f3af3bb87f 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSerializer/ReflectionOnly/System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj +++ b/src/libraries/System.Private.Xml/tests/XmlSerializer/ReflectionOnly/System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj @@ -3,9 +3,13 @@ $(DefineConstants);ReflectionOnly $(NetCoreAppCurrent) + + + + - + diff --git a/src/libraries/System.Private.Xml/tests/XmlSerializer/System.Xml.XmlSerializer.Tests.csproj b/src/libraries/System.Private.Xml/tests/XmlSerializer/System.Xml.XmlSerializer.Tests.csproj index dbc8447b87c1cb..7818cd132825c4 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSerializer/System.Xml.XmlSerializer.Tests.csproj +++ b/src/libraries/System.Private.Xml/tests/XmlSerializer/System.Xml.XmlSerializer.Tests.csproj @@ -2,10 +2,14 @@ $(NetCoreAppCurrent) + + + + - + diff --git a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs index c918520a19c8ff..e20498c563266e 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs @@ -8,6 +8,8 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.Loader; using System.Text; using System.Threading; using System.Xml; @@ -713,7 +715,7 @@ public static void Xml_TypeWithTimeSpanProperty() { var obj = new TypeWithTimeSpanProperty { TimeSpanProperty = TimeSpan.FromMilliseconds(1) }; var deserializedObj = SerializeAndDeserialize(obj, -@" +@" PT0.001S "); @@ -947,7 +949,7 @@ public static void Xml_SimpleType() { var obj = new SimpleType { P1 = "foo", P2 = 1 }; var deserializedObj = SerializeAndDeserialize(obj, -@" +@" foo 1 @@ -957,6 +959,31 @@ public static void Xml_SimpleType() Assert.StrictEqual(obj.P2, deserializedObj.P2); } + [Fact] + public static void Xml_SerializedFormat() + { + var obj = new SimpleType { P1 = "foo", P2 = 1 }; + XmlSerializer serializer = new XmlSerializer(typeof(SimpleType)); + using (MemoryStream ms = new MemoryStream()) + { + serializer.Serialize(ms, obj); + + // No BOM? + byte[] expectedBytes = new byte[] { (byte)'<', (byte)'?', (byte)'x', (byte)'m', (byte)'l' }; + byte[] firstBytes = new byte[5]; + ms.Position = 0; + ms.Read(firstBytes, 0, firstBytes.Length); + Assert.Equal(expectedBytes, firstBytes); + + // Human readable? + ms.Position = 0; + string nl = Environment.NewLine; + string actualFormatting = new StreamReader(ms).ReadToEnd(); + string expectedFormatting = $"{nl}{nl} foo{nl} 1{ nl}"; + Assert.Equal(expectedFormatting, actualFormatting); + } + } + [Fact] public static void Xml_BaseClassAndDerivedClass2WithSameProperty() { @@ -1960,6 +1987,52 @@ public static void Xml_TypeWithSpecialCharacterInStringMember() Assert.Equal(x.Name, y.Name); } + [Fact] +#if XMLSERIALIZERGENERATORTESTS + // Lack of AssemblyDependencyResolver results in assemblies that are not loaded by path to get + // loaded in the default ALC, which causes problems for this test. + [SkipOnPlatform(TestPlatforms.Browser, "AssemblyDependencyResolver not supported in wasm")] +#endif + [ActiveIssue("34072", TestRuntimes.Mono)] + public static void Xml_TypeInCollectibleALC() + { + ExecuteAndUnload("SerializableAssembly.dll", "SerializationTypes.SimpleType", out var weakRef); + + for (int i = 0; weakRef.IsAlive && i < 10; i++) + { + GC.Collect(); + GC.WaitForPendingFinalizers(); + } + Assert.True(!weakRef.IsAlive); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static void ExecuteAndUnload(string assemblyfile, string typename, out WeakReference wref) + { + var fullPath = Path.GetFullPath(assemblyfile); + var alc = new TestAssemblyLoadContext("XmlSerializerTests", true, fullPath); + wref = new WeakReference(alc); + + // Load assembly by path. By name, and it gets loaded in the default ALC. + var asm = alc.LoadFromAssemblyPath(fullPath); + + // Ensure the type loaded in the intended non-Default ALC + var type = asm.GetType(typename); + Assert.Equal(AssemblyLoadContext.GetLoadContext(type.Assembly), alc); + Assert.NotEqual(alc, AssemblyLoadContext.Default); + + // Round-Trip the instance + XmlSerializer serializer = new XmlSerializer(type); + var obj = Activator.CreateInstance(type); + var rtobj = SerializeAndDeserialize(obj, null, () => serializer, true); + Assert.NotNull(rtobj); + Assert.True(rtobj.Equals(obj)); + Assert.Equal(AssemblyLoadContext.GetLoadContext(rtobj.GetType().Assembly), alc); + + alc.Unload(); + } + + private static readonly string s_defaultNs = "http://tempuri.org/"; private static T RoundTripWithXmlMembersMapping(object requestBodyValue, string memberName, string baseline, bool skipStringCompare = false, string wrapperName = null) { @@ -2080,11 +2153,7 @@ private static Stream GenerateStreamFromString(string s) private static T SerializeAndDeserialize(T value, string baseline, Func serializerFactory = null, bool skipStringCompare = false, XmlSerializerNamespaces xns = null) { - XmlSerializer serializer = new XmlSerializer(typeof(T)); - if (serializerFactory != null) - { - serializer = serializerFactory(); - } + XmlSerializer serializer = (serializerFactory != null) ? serializerFactory() : new XmlSerializer(typeof(T)); using (MemoryStream ms = new MemoryStream()) { diff --git a/src/libraries/System.Reflection.Context/Directory.Build.props b/src/libraries/System.Reflection.Context/Directory.Build.props index ed15ad04f46183..798ccfd363e813 100644 --- a/src/libraries/System.Reflection.Context/Directory.Build.props +++ b/src/libraries/System.Reflection.Context/Directory.Build.props @@ -1,7 +1,6 @@  - 4.0.3.0 ECMA diff --git a/src/libraries/System.Reflection.Context/Directory.Build.targets b/src/libraries/System.Reflection.Context/Directory.Build.targets new file mode 100644 index 00000000000000..0d1f58eb0e89d0 --- /dev/null +++ b/src/libraries/System.Reflection.Context/Directory.Build.targets @@ -0,0 +1,9 @@ + + + + + 4.0.3.0 + + diff --git a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj index 41aa629316561f..b88133ba460e41 100644 --- a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj +++ b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj @@ -3,6 +3,9 @@ $(NetCoreAppCurrent);netstandard2.1;netstandard2.0 enable true + + false + 0 true true Provides classes that enable customized reflection contexts. diff --git a/src/libraries/System.Reflection.Emit.ILGeneration/tests/CustomAttributeBuilderTests.cs b/src/libraries/System.Reflection.Emit.ILGeneration/tests/CustomAttributeBuilderTests.cs index 9c2df4249b3836..0b536e51a9447b 100644 --- a/src/libraries/System.Reflection.Emit.ILGeneration/tests/CustomAttributeBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit.ILGeneration/tests/CustomAttributeBuilderTests.cs @@ -255,7 +255,6 @@ private static void VerifyCustomAttributeBuilder(CustomAttributeBuilder builder, } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/2383", TestRuntimes.Mono)] public static void Ctor_AllPrimitives() { ConstructorInfo con = typeof(Primitives).GetConstructors()[0]; diff --git a/src/libraries/System.Reflection.Emit/tests/AssemblyBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/AssemblyBuilderTests.cs index fb86151fdfcbc1..d968a6c8491ce7 100644 --- a/src/libraries/System.Reflection.Emit/tests/AssemblyBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/AssemblyBuilderTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Runtime.InteropServices; using Xunit; @@ -24,6 +25,21 @@ public class IntClassAttribute : Attribute public class AssemblyTests { + // The ECMA replacement key for the Microsoft implementation of the CLR. + private static readonly byte[] TheKey = + { + 0x00,0x24,0x00,0x00,0x04,0x80,0x00,0x00,0x94,0x00,0x00,0x00,0x06,0x02,0x00,0x00, + 0x00,0x24,0x00,0x00,0x52,0x53,0x41,0x31,0x00,0x04,0x00,0x00,0x01,0x00,0x01,0x00, + 0x07,0xd1,0xfa,0x57,0xc4,0xae,0xd9,0xf0,0xa3,0x2e,0x84,0xaa,0x0f,0xae,0xfd,0x0d, + 0xe9,0xe8,0xfd,0x6a,0xec,0x8f,0x87,0xfb,0x03,0x76,0x6c,0x83,0x4c,0x99,0x92,0x1e, + 0xb2,0x3b,0xe7,0x9a,0xd9,0xd5,0xdc,0xc1,0xdd,0x9a,0xd2,0x36,0x13,0x21,0x02,0x90, + 0x0b,0x72,0x3c,0xf9,0x80,0x95,0x7f,0xc4,0xe1,0x77,0x10,0x8f,0xc6,0x07,0x77,0x4f, + 0x29,0xe8,0x32,0x0e,0x92,0xea,0x05,0xec,0xe4,0xe8,0x21,0xc0,0xa5,0xef,0xe8,0xf1, + 0x64,0x5c,0x4c,0x0c,0x93,0xc1,0xab,0x99,0x28,0x5d,0x62,0x2c,0xaa,0x65,0x2c,0x1d, + 0xfa,0xd6,0x3d,0x74,0x5d,0x6f,0x2d,0xe5,0xf1,0x7e,0x5e,0xaf,0x0f,0xc4,0x96,0x3d, + 0x26,0x1c,0x8a,0x12,0x43,0x65,0x18,0x20,0x6d,0xc0,0x93,0x34,0x4d,0x5a,0xd2,0x93 + }; + public static IEnumerable DefineDynamicAssembly_TestData() { foreach (AssemblyBuilderAccess access in new AssemblyBuilderAccess[] { AssemblyBuilderAccess.Run, AssemblyBuilderAccess.RunAndCollect }) @@ -32,11 +48,15 @@ public static IEnumerable DefineDynamicAssembly_TestData() yield return new object[] { new AssemblyName("testname") { Version = new Version(1, 2, 3, 4) }, access }; yield return new object[] { new AssemblyName("class") { Version = new Version(0, 0, 0, 0) }, access }; yield return new object[] { new AssemblyName("\uD800\uDC00") { Version = new Version(0, 0, 0, 0) }, access }; + + AssemblyName testPublicKey = new AssemblyName("TestPublicKey") { Version = new Version(0, 0, 0, 0) }; + testPublicKey.CultureInfo = CultureInfo.InvariantCulture; + testPublicKey.SetPublicKey(TheKey); + yield return new object[] { testPublicKey, access }; } } [Theory] - [ActiveIssue("https://github.com/dotnet/runtime/issues/2389", TestRuntimes.Mono)] [MemberData(nameof(DefineDynamicAssembly_TestData))] public void DefineDynamicAssembly_AssemblyName_AssemblyBuilderAccess(AssemblyName name, AssemblyBuilderAccess access) { @@ -57,7 +77,6 @@ public static IEnumerable DefineDynamicAssembly_CustomAttributes_TestD } [Theory] - [ActiveIssue("https://github.com/dotnet/runtime/issues/2389", TestRuntimes.Mono)] [MemberData(nameof(DefineDynamicAssembly_CustomAttributes_TestData))] public void DefineDynamicAssembly_AssemblyName_AssemblyBuilderAccess_CustomAttributeBuilder(AssemblyName name, AssemblyBuilderAccess access, IEnumerable attributes) { diff --git a/src/libraries/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj b/src/libraries/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj index 4b183a58768914..340692c15f7b9b 100644 --- a/src/libraries/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj +++ b/src/libraries/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj @@ -6,6 +6,7 @@ $(NetCoreAppCurrent);netstandard2.0;net461 enable true + 1 This packages provides a low-level .NET (ECMA-335) metadata reader and writer. It's geared for performance and is the ideal choice for building higher-level libraries that intend to provide their own object model, such as compilers. Commonly Used Types: diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/ManagedTextSection.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/ManagedTextSection.cs index 33bd80dec21f75..1762b12d928ba0 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/ManagedTextSection.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/ManagedTextSection.cs @@ -121,7 +121,7 @@ public ManagedTextSection( public const int MappedFieldDataAlignment = 8; - public int CalculateOffsetToMappedFieldDataStream() + internal int CalculateOffsetToMappedFieldDataStreamUnaligned() { int result = ComputeOffsetToImportTable(); @@ -135,6 +135,16 @@ public int CalculateOffsetToMappedFieldDataStream() return result; } + public int CalculateOffsetToMappedFieldDataStream() + { + int result = CalculateOffsetToMappedFieldDataStreamUnaligned(); + if (MappedFieldDataSize != 0) + { + result = BitArithmetic.Align(result, MappedFieldDataAlignment); + } + return result; + } + internal int ComputeOffsetToDebugDirectory() { Debug.Assert(MetadataSize % 4 == 0); @@ -185,7 +195,7 @@ public int GetEntryPointAddress(int rva) { // TODO: constants return RequiresStartupStub ? - rva + CalculateOffsetToMappedFieldDataStream() - (Is32Bit ? 6 : 10) : + rva + CalculateOffsetToMappedFieldDataStreamUnaligned() - (Is32Bit ? 6 : 10) : 0; } @@ -293,6 +303,8 @@ public void Serialize( // mapped field data: if (mappedFieldDataBuilderOpt != null) { + if (mappedFieldDataBuilderOpt.Count != 0) + builder.Align(MappedFieldDataAlignment); builder.LinkSuffix(mappedFieldDataBuilderOpt); } diff --git a/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs b/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs index 763e26dbc1811c..c3dab37bbd3590 100644 --- a/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs +++ b/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs @@ -64,7 +64,8 @@ private static void WritePEImage( Blob mvidFixup = default(Blob), byte[] privateKeyOpt = null, bool publicSigned = false, - Machine machine = 0) + Machine machine = 0, + BlobBuilder? mappedFieldData = null) { var peHeaderBuilder = new PEHeaderBuilder(imageCharacteristics: entryPointHandle.IsNil ? Characteristics.Dll : Characteristics.ExecutableImage, machine: machine); @@ -75,7 +76,8 @@ private static void WritePEImage( ilBuilder, entryPoint: entryPointHandle, flags: CorFlags.ILOnly | (privateKeyOpt != null || publicSigned ? CorFlags.StrongNameSigned : 0), - deterministicIdProvider: content => s_contentId); + deterministicIdProvider: content => s_contentId, + mappedFieldData: mappedFieldData); var peBlob = new BlobBuilder(); @@ -487,6 +489,98 @@ private static MethodDefinitionHandle ComplexEmit(MetadataBuilder metadata, Blob return default(MethodDefinitionHandle); } + [Theory] // Validate FieldRVA alignment on common machine types + [MemberData(nameof(AllMachineTypes))] + public void FieldRVAAlignmentVerify(Machine machine) + { + using (var peStream = new MemoryStream()) + { + var ilBuilder = new BlobBuilder(); + var mappedRVADataBuilder = new BlobBuilder(); + var metadataBuilder = new MetadataBuilder(); + double validationNumber = 0.100001; + var fieldDef = FieldRVAValidationEmit(metadataBuilder, mappedRVADataBuilder, validationNumber); + + WritePEImage(peStream, metadataBuilder, ilBuilder, default(MethodDefinitionHandle), + mappedFieldData: mappedRVADataBuilder, + machine: machine); + + // Validate FieldRVA is aligned as ManagedPEBuilder.MappedFieldDataAlignemnt + peStream.Position = 0; + using (var peReader = new PEReader(peStream, PEStreamOptions.LeaveOpen)) + { + var mdReader = peReader.GetMetadataReader(); + + // Validate that there is only 1 field rva entry + Assert.Equal(1, mdReader.FieldRvaTable.NumberOfRows); + + // Validate that the RVA is aligned properly (which should be at least an 8 byte alignment + Assert.Equal(0, mdReader.FieldRvaTable.GetRva(1) % ManagedPEBuilder.MappedFieldDataAlignment); + + // Validate that the correct data is at the RVA + var fieldRVAData = peReader.GetSectionData(mdReader.FieldRvaTable.GetRva(1)); + Assert.Equal(validationNumber, fieldRVAData.GetReader().ReadDouble()); + } + + VerifyPE(peStream, machine); + } + } + + private static FieldDefinitionHandle FieldRVAValidationEmit(MetadataBuilder metadata, BlobBuilder mappedRVAData, double doubleToWriteAsData) + { + metadata.AddModule( + 0, + metadata.GetOrAddString("ConsoleApplication.exe"), + metadata.GetOrAddGuid(s_guid), + default(GuidHandle), + default(GuidHandle)); + + metadata.AddAssembly( + metadata.GetOrAddString("ConsoleApplication"), + version: new Version(1, 0, 0, 0), + culture: default(StringHandle), + publicKey: metadata.GetOrAddBlob(ImmutableArray.Create(Misc.KeyPair_PublicKey)), + flags: AssemblyFlags.PublicKey, + hashAlgorithm: AssemblyHashAlgorithm.Sha1); + + var mscorlibAssemblyRef = metadata.AddAssemblyReference( + name: metadata.GetOrAddString("mscorlib"), + version: new Version(4, 0, 0, 0), + culture: default(StringHandle), + publicKeyOrToken: metadata.GetOrAddBlob(ImmutableArray.Create(0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89)), + flags: default(AssemblyFlags), + hashValue: default(BlobHandle)); + + var systemObjectTypeRef = metadata.AddTypeReference( + mscorlibAssemblyRef, + metadata.GetOrAddString("System"), + metadata.GetOrAddString("Object")); + + mappedRVAData.WriteDouble(doubleToWriteAsData); + + var rvaFieldSignature = new BlobBuilder(); + + new BlobEncoder(rvaFieldSignature). + FieldSignature().Double(); + + var fieldRVADef = metadata.AddFieldDefinition( + FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.HasFieldRVA, + metadata.GetOrAddString("RvaField"), + metadata.GetOrAddBlob(rvaFieldSignature)); + + metadata.AddFieldRelativeVirtualAddress(fieldRVADef, 0); + + metadata.AddTypeDefinition( + TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.AutoLayout | TypeAttributes.BeforeFieldInit, + metadata.GetOrAddString("ConsoleApplication"), + metadata.GetOrAddString("Program"), + systemObjectTypeRef, + fieldList: fieldRVADef, + methodList: MetadataTokens.MethodDefinitionHandle(1)); + + return fieldRVADef; + } + private class TestResourceSectionBuilder : ResourceSectionBuilder { public TestResourceSectionBuilder() diff --git a/src/libraries/System.Reflection/tests/CustomAttributeTests.cs b/src/libraries/System.Reflection/tests/CustomAttributeTests.cs index bb9c928b542203..6b102884c0d2ca 100644 --- a/src/libraries/System.Reflection/tests/CustomAttributeTests.cs +++ b/src/libraries/System.Reflection/tests/CustomAttributeTests.cs @@ -76,5 +76,58 @@ public void AttributeWithDifferentPropertyTypes() Assert.Equal(1, attr.ObjectArray.Length); Assert.Null(attr.StringArray); } + + public class StringValuedAttribute : Attribute + { + public StringValuedAttribute (string s) + { + NamedField = s; + } + public StringValuedAttribute () {} + public string NamedProperty + { + get => NamedField; + set { NamedField = value; } + } + public string NamedField; + } + + internal class ClassWithAttrs + { + [StringValuedAttribute("")] + public void M1() {} + + [StringValuedAttribute(NamedProperty = "")] + public void M2() {} + + [StringValuedAttribute(NamedField = "")] + public void M3() {} + } + + [Fact] + public void StringAttributeValueRefEqualsStringEmpty () { + StringValuedAttribute attr; + attr = typeof (ClassWithAttrs).GetMethod("M1") + .GetCustomAttributes(typeof(StringValuedAttribute), true) + .Cast() + .Single(); + + Assert.Same(string.Empty, attr.NamedField); + + attr = typeof (ClassWithAttrs).GetMethod("M2") + .GetCustomAttributes(typeof(StringValuedAttribute), true) + .Cast() + .Single(); + + Assert.Same(string.Empty, attr.NamedField); + + + attr = typeof (ClassWithAttrs).GetMethod("M3") + .GetCustomAttributes(typeof(StringValuedAttribute), true) + .Cast() + .Single(); + + Assert.Same(string.Empty, attr.NamedField); + } } } diff --git a/src/libraries/System.Resources.Extensions/tests/BinaryResourceWriterUnitTest.cs b/src/libraries/System.Resources.Extensions/tests/BinaryResourceWriterUnitTest.cs index 378a416210d620..14aa23e28815bb 100644 --- a/src/libraries/System.Resources.Extensions/tests/BinaryResourceWriterUnitTest.cs +++ b/src/libraries/System.Resources.Extensions/tests/BinaryResourceWriterUnitTest.cs @@ -10,6 +10,8 @@ using System.Linq; using System.Reflection; using System.Runtime.Serialization.Formatters.Binary; +using System.Threading; +using System.Threading.Tasks; using Xunit; namespace System.Resources.Extensions.Tests @@ -149,7 +151,6 @@ public static void EmptyResources() Assert.Equal(writerBuffer, binaryWriterBuffer); } - [Fact] public static void PrimitiveResources() { @@ -498,6 +499,50 @@ public static void EmbeddedResourcesAreUpToDate() } } + /// + /// This test has multiple threads simultaneously loop over the keys of a moderately-sized resx using + /// and call for each key. + /// This has historically been prone to thread-safety bugs because of the shared cache state and internal + /// method calls between RuntimeResourceSet and . + /// + /// Running with TRUE replicates https://github.com/dotnet/runtime/issues/74868, + /// while running with FALSE replicates the error from https://github.com/dotnet/runtime/issues/74052. + /// + /// + /// Whether to use vs. when enumerating; + /// these follow fairly different code paths. + /// ] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBinaryFormatterSupported))] + [InlineData(false)] + [InlineData(true)] + public static void TestResourceManagerIsSafeForConcurrentAccessAndEnumeration(bool useEnumeratorEntry) + { + ResourceManager manager = new( + typeof(TestData).FullName, + typeof(TestData).Assembly, + typeof(DeserializingResourceReader).Assembly.GetType("System.Resources.Extensions.RuntimeResourceSet", throwOnError: true)); + + const int Threads = 10; + using Barrier barrier = new(Threads); + Task task = Task.WhenAll(Enumerable.Range(0, Threads).Select(_ => Task.Run(WaitForBarrierThenEnumerateResources))); + + Assert.True(task.Wait(TimeSpan.FromSeconds(30))); + + void WaitForBarrierThenEnumerateResources() + { + barrier.SignalAndWait(); + + ResourceSet set = manager.GetResourceSet(CultureInfo.InvariantCulture, createIfNotExists: true, tryParents: true); + IDictionaryEnumerator enumerator = set.GetEnumerator(); + while (enumerator.MoveNext()) + { + object key = useEnumeratorEntry ? enumerator.Entry.Key : enumerator.Key; + manager.GetObject((string)key); + Thread.Sleep(1); + } + } + } + private static void ResourceValueEquals(object expected, object actual) { if (actual is Bitmap bitmap) @@ -535,5 +580,4 @@ private static void BitmapEquals(Bitmap left, Bitmap right) } } } - } diff --git a/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs b/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs index a7ab855896769a..ea288f9186e4e4 100644 --- a/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs +++ b/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs @@ -12,6 +12,9 @@ using System.Diagnostics; using Microsoft.DotNet.RemoteExecutor; using Xunit; +using System.Threading; +using System.Threading.Tasks; +using System.Collections; [assembly:NeutralResourcesLanguage("en")] @@ -218,6 +221,52 @@ public static void IgnoreCase(string key, string expectedValue) Assert.Equal(expectedValue, manager.GetString(key.ToLower(), culture)); } + /// + /// This test has multiple threads simultaneously loop over the keys of a moderately-sized resx using + /// and call for each key. + /// This has historically been prone to thread-safety bugs because of the shared cache state and internal + /// method calls between RuntimeResourceSet and . + /// + /// Running with TRUE replicates https://github.com/dotnet/runtime/issues/74868, + /// while running with FALSE replicates the error from https://github.com/dotnet/runtime/issues/74052. + /// + /// + /// Whether to use vs. when enumerating; + /// these follow fairly different code paths. + /// + [Theory] + [InlineData(false)] + [InlineData(true)] + public static void TestResourceManagerIsSafeForConcurrentAccessAndEnumeration(bool useEnumeratorEntry) + { + ResourceManager manager = new("System.Resources.Tests.Resources.AToZResx", typeof(ResourceManagerTests).GetTypeInfo().Assembly); + + const int Threads = 10; + using Barrier barrier = new(Threads); + Task[] tasks = Enumerable.Range(0, Threads) + .Select(_ => Task.Factory.StartNew( + WaitForBarrierThenEnumerateResources, + CancellationToken.None, + TaskCreationOptions.LongRunning, + TaskScheduler.Default)) + .ToArray(); + + Assert.True(Task.WaitAll(tasks, TimeSpan.FromSeconds(30))); + + void WaitForBarrierThenEnumerateResources() + { + barrier.SignalAndWait(); + + ResourceSet set = manager.GetResourceSet(CultureInfo.InvariantCulture, createIfNotExists: true, tryParents: true); + IDictionaryEnumerator enumerator = set.GetEnumerator(); + while (enumerator.MoveNext()) + { + object key = useEnumeratorEntry ? enumerator.Entry.Key : enumerator.Key; + manager.GetObject((string)key); + Thread.Sleep(1); + } + } + } public static IEnumerable EnglishNonStringResourceData() { diff --git a/src/libraries/System.Resources.ResourceManager/tests/Resources/AToZResx.Designer.cs b/src/libraries/System.Resources.ResourceManager/tests/Resources/AToZResx.Designer.cs new file mode 100644 index 00000000000000..047939cdc644a9 --- /dev/null +++ b/src/libraries/System.Resources.ResourceManager/tests/Resources/AToZResx.Designer.cs @@ -0,0 +1,297 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace System.Resources.Tests.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class AToZResx { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal AToZResx() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Resources.Tests.Resources.AToZResx", typeof(AToZResx).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to a. + /// + internal static string A { + get { + return ResourceManager.GetString("A", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to b. + /// + internal static string B { + get { + return ResourceManager.GetString("B", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to c. + /// + internal static string C { + get { + return ResourceManager.GetString("C", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to d. + /// + internal static string D { + get { + return ResourceManager.GetString("D", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to e. + /// + internal static string E { + get { + return ResourceManager.GetString("E", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to f. + /// + internal static string F { + get { + return ResourceManager.GetString("F", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to g. + /// + internal static string G { + get { + return ResourceManager.GetString("G", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to h. + /// + internal static string H { + get { + return ResourceManager.GetString("H", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to i. + /// + internal static string I { + get { + return ResourceManager.GetString("I", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to j. + /// + internal static string J { + get { + return ResourceManager.GetString("J", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to k. + /// + internal static string K { + get { + return ResourceManager.GetString("K", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to l. + /// + internal static string L { + get { + return ResourceManager.GetString("L", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to m. + /// + internal static string M { + get { + return ResourceManager.GetString("M", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to n. + /// + internal static string N { + get { + return ResourceManager.GetString("N", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to o. + /// + internal static string O { + get { + return ResourceManager.GetString("O", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to p. + /// + internal static string P { + get { + return ResourceManager.GetString("P", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to q. + /// + internal static string Q { + get { + return ResourceManager.GetString("Q", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to r. + /// + internal static string R { + get { + return ResourceManager.GetString("R", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to s. + /// + internal static string S { + get { + return ResourceManager.GetString("S", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to t. + /// + internal static string T { + get { + return ResourceManager.GetString("T", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to u. + /// + internal static string U { + get { + return ResourceManager.GetString("U", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to v. + /// + internal static string V { + get { + return ResourceManager.GetString("V", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to w. + /// + internal static string W { + get { + return ResourceManager.GetString("W", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to x. + /// + internal static string X { + get { + return ResourceManager.GetString("X", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to y. + /// + internal static string Y { + get { + return ResourceManager.GetString("Y", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to z. + /// + internal static string Z { + get { + return ResourceManager.GetString("Z", resourceCulture); + } + } + } +} diff --git a/src/libraries/System.Resources.ResourceManager/tests/Resources/AToZResx.resx b/src/libraries/System.Resources.ResourceManager/tests/Resources/AToZResx.resx new file mode 100644 index 00000000000000..e1c5ddaba7ed80 --- /dev/null +++ b/src/libraries/System.Resources.ResourceManager/tests/Resources/AToZResx.resx @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + a + + + b + + + c + + + d + + + e + + + f + + + g + + + h + + + i + + + j + + + k + + + l + + + m + + + n + + + o + + + p + + + q + + + r + + + s + + + t + + + u + + + v + + + w + + + x + + + y + + + z + + \ No newline at end of file diff --git a/src/libraries/System.Resources.ResourceManager/tests/System.Resources.ResourceManager.Tests.csproj b/src/libraries/System.Resources.ResourceManager/tests/System.Resources.ResourceManager.Tests.csproj index 66cb937a3d1e20..f5ee7f0c22b59b 100644 --- a/src/libraries/System.Resources.ResourceManager/tests/System.Resources.ResourceManager.Tests.csproj +++ b/src/libraries/System.Resources.ResourceManager/tests/System.Resources.ResourceManager.Tests.csproj @@ -8,6 +8,11 @@ + + True + True + AToZResx.resx + @@ -19,10 +24,13 @@ - + + + ResXFileCodeGenerator + AToZResx.Designer.cs + false Non-Resx @@ -40,23 +48,14 @@ ResXFileCodeGenerator TestResx.Designer.cs - - - - + + + + - - - + + + diff --git a/src/libraries/System.Runtime.Caching/Directory.Build.props b/src/libraries/System.Runtime.Caching/Directory.Build.props index 30af6959a0707b..d68d22c1b917f8 100644 --- a/src/libraries/System.Runtime.Caching/Directory.Build.props +++ b/src/libraries/System.Runtime.Caching/Directory.Build.props @@ -1,10 +1,6 @@  - - 4.0.0.0 Microsoft true diff --git a/src/libraries/System.Runtime.Caching/Directory.Build.targets b/src/libraries/System.Runtime.Caching/Directory.Build.targets new file mode 100644 index 00000000000000..e8aeeb47a8da9c --- /dev/null +++ b/src/libraries/System.Runtime.Caching/Directory.Build.targets @@ -0,0 +1,8 @@ + + + + + 4.0.0.0 + + diff --git a/src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj b/src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj index 8d7d5ba2071e42..3f8f859c4f45d9 100644 --- a/src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj +++ b/src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj @@ -3,6 +3,9 @@ true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0-windows;netstandard2.0 true + + false + 0 true true true diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/FileChangeNotificationSystem.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/FileChangeNotificationSystem.cs index 497017c14e7352..750a0e037493b7 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/FileChangeNotificationSystem.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/FileChangeNotificationSystem.cs @@ -13,6 +13,9 @@ namespace System.Runtime.Caching { #if NET5_0_OR_GREATER [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] + [SupportedOSPlatform("maccatalyst")] #endif internal sealed class FileChangeNotificationSystem : IFileChangeNotificationSystem { diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.cs index 9d3cb73564bf40..ecd228c35d5ba4 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/HostFileChangeMonitor.cs @@ -98,7 +98,7 @@ private static void InitFCN() if (fcn == null) { #if NET5_0_OR_GREATER - if (OperatingSystem.IsBrowser()) + if (OperatingSystem.IsBrowser() || (OperatingSystem.IsIOS() && !OperatingSystem.IsMacCatalyst()) || OperatingSystem.IsTvOS()) { throw new PlatformNotSupportedException(); } diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs index 72d92119acd795..0b55c536adcfdc 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCache.cs @@ -39,6 +39,7 @@ public class MemoryCache : ObjectCache, IEnumerable, IDisposable private bool _useMemoryCacheManager = true; private EventHandler _onAppDomainUnload; private UnhandledExceptionEventHandler _onUnhandledException; + private int _inUnhandledExceptionHandler; #if NET5_0_OR_GREATER [UnsupportedOSPlatformGuard("browser")] private static bool _countersSupported => !OperatingSystem.IsBrowser(); @@ -240,14 +241,19 @@ private void OnAppDomainUnload(object unusedObject, EventArgs unusedEventArgs) Dispose(); } + internal bool InUnhandledExceptionHandler => _inUnhandledExceptionHandler > 0; private void OnUnhandledException(object sender, UnhandledExceptionEventArgs eventArgs) { + Interlocked.Increment(ref _inUnhandledExceptionHandler); + // if the CLR is terminating, dispose the cache. // This will dispose the perf counters if (eventArgs.IsTerminating) { Dispose(); } + + Interlocked.Decrement(ref _inUnhandledExceptionHandler); } private void ValidatePolicy(CacheItemPolicy policy) diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs index 107c46f0158c9c..1ad5d6c2ff65a4 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryCacheStatistics.cs @@ -334,8 +334,19 @@ public void Dispose() GCHandleRef timerHandleRef = _timerHandleRef; if (timerHandleRef != null && Interlocked.CompareExchange(ref _timerHandleRef, null, timerHandleRef) == timerHandleRef) { - timerHandleRef.Dispose(); - Dbg.Trace("MemoryCacheStats", "Stopped CacheMemoryTimers"); + // If inside an unhandled exception handler, Timers may be succeptible to deadlocks. Use a safer approach. + if (_memoryCache.InUnhandledExceptionHandler) + { + // This does not stop/dispose the timer. But the callback on the timer is protected by _disposed, which we have already + // set above. + timerHandleRef.FreeHandle(); + Dbg.Trace("MemoryCacheStats", "Freed CacheMemoryTimers"); + } + else + { + timerHandleRef.Dispose(); + Dbg.Trace("MemoryCacheStats", "Stopped CacheMemoryTimers"); + } } } while (_inCacheManagerThread != 0) diff --git a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/SRef.cs b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/SRef.cs index b0027403163355..5d7eaa6a96fdc1 100644 --- a/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/SRef.cs +++ b/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/SRef.cs @@ -56,6 +56,11 @@ public T Target public void Dispose() { Target.Dispose(); + FreeHandle(); + } + + internal void FreeHandle() + { // Safe to call Dispose more than once but not thread-safe if (_handle.IsAllocated) { diff --git a/src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/HostFileChangeMonitorTest.cs b/src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/HostFileChangeMonitorTest.cs index 6d629139436289..c9d83355d6c1a6 100644 --- a/src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/HostFileChangeMonitorTest.cs +++ b/src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/HostFileChangeMonitorTest.cs @@ -41,7 +41,7 @@ namespace MonoTests.System.Runtime.Caching { - [SkipOnPlatform(TestPlatforms.Browser, "HostFileChangeMonitor is not supported on Browser")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "HostFileChangeMonitor is not supported on Browser/iOS/tvOS")] public class HostFileChangeMonitorTest { [Fact] diff --git a/src/libraries/System.Runtime.Experimental/ref/System.Runtime.Experimental.csproj b/src/libraries/System.Runtime.Experimental/ref/System.Runtime.Experimental.csproj index 0ec6e1e5a1e891..f5a3d2eea0b49a 100644 --- a/src/libraries/System.Runtime.Experimental/ref/System.Runtime.Experimental.csproj +++ b/src/libraries/System.Runtime.Experimental/ref/System.Runtime.Experimental.csproj @@ -17,6 +17,7 @@ ref $(DefineConstants);FEATURE_GENERIC_MATH true + 2 Exposes new experimental APIs from System.Runtime $(MSBuildProjectName) @@ -32,7 +33,7 @@ <_FileVersionMin>$(FileVersion.Split('.')[1]) <_FileVersionBld>$(FileVersion.Split('.')[2]) <_FileVersionRev>$(FileVersion.Split('.')[3]) - $(_FileVersionMaj).$(_FileVersionMin).$([MSBuild]::Add($(_FileVersionBld), 100)).$(_FileVersionRev) + $(_FileVersionMaj).$([MSBuild]::Add($(_FileVersionMin), 100)).$(_FileVersionBld).$(_FileVersionRev) diff --git a/src/libraries/System.Runtime.Experimental/tests/System.Runtime.Experimental.Tests.csproj b/src/libraries/System.Runtime.Experimental/tests/System.Runtime.Experimental.Tests.csproj index 0001351ba031ab..d8ed841331b0f3 100644 --- a/src/libraries/System.Runtime.Experimental/tests/System.Runtime.Experimental.Tests.csproj +++ b/src/libraries/System.Runtime.Experimental/tests/System.Runtime.Experimental.Tests.csproj @@ -16,11 +16,14 @@ + + + @@ -29,18 +32,22 @@ + + + + diff --git a/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs index e9fe758b834f7b..8c9e00887b1ad3 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs @@ -379,7 +379,7 @@ public void ReflectionOnlyGetAssemblies() } [Fact] - [SkipOnPlatform(TestPlatforms.Browser, "Throws PNSE")] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "Throws PNSE")] public void MonitoringIsEnabled() { Assert.True(AppDomain.MonitoringIsEnabled); diff --git a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs index f019b1eb11a02f..7ec508517e01cb 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs @@ -96,6 +96,7 @@ public void ProcessPath_Idempotent() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Throws PNSE")] public void ProcessPath_MatchesExpectedValue() { string expectedProcessPath = PlatformDetection.IsBrowser ? null : Process.GetCurrentProcess().MainModule.FileName; @@ -189,7 +190,8 @@ public void OSVersion_ValidVersion_OSX() Version version = Environment.OSVersion.Version; // verify that the Environment.OSVersion.Version matches the current RID - Assert.Contains(version.ToString(2), RuntimeInformation.RuntimeIdentifier); + // As of 12.0, only major version numbers are included in the RID + Assert.Contains(version.ToString(1), RuntimeInformation.RuntimeIdentifier); Assert.True(version.Build >= 0, "OSVersion Build should be non-negative"); Assert.Equal(-1, version.Revision); // Revision is never set on OSX @@ -235,7 +237,7 @@ public void Version_Valid() [Fact] public void WorkingSet_Valid() { - if (PlatformDetection.IsBrowser) + if (PlatformDetection.IsBrowser || (PlatformDetection.IsiOS && !PlatformDetection.IsMacCatalyst) || PlatformDetection.IstvOS) Assert.Equal(0, Environment.WorkingSet); else Assert.True(Environment.WorkingSet > 0, "Expected positive WorkingSet value"); @@ -330,6 +332,13 @@ public void FailFast_ExceptionStackTrace_InnerException() } } + [Fact] + [PlatformSpecific(TestPlatforms.AnyUnix | TestPlatforms.Browser)] + public void GetFolderPath_Unix_PersonalExists() + { + Assert.True(Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Personal))); + } + [Fact] [PlatformSpecific(TestPlatforms.AnyUnix | TestPlatforms.Browser)] // Tests OS-specific environment public void GetFolderPath_Unix_PersonalIsHomeAndUserProfile() @@ -339,6 +348,7 @@ public void GetFolderPath_Unix_PersonalIsHomeAndUserProfile() Assert.Equal(Environment.GetEnvironmentVariable("HOME"), Environment.GetFolderPath(Environment.SpecialFolder.Personal)); Assert.Equal(Environment.GetEnvironmentVariable("HOME"), Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); } + Assert.Equal(Environment.GetEnvironmentVariable("HOME"), Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)); } diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Math.cs b/src/libraries/System.Runtime.Extensions/tests/System/Math.cs index 44f4bf6d282ebd..b8b16c78e28962 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Math.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Math.cs @@ -1103,6 +1103,29 @@ public static void Max_Decimal() public static void Max_Double_NotNetFramework(double x, double y, double expectedResult) { AssertEqual(expectedResult, Math.Max(x, y), 0.0); + + if (double.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + ulong bits = BitConverter.DoubleToUInt64Bits(x); + bits ^= BitConverter.DoubleToUInt64Bits(-0.0); + x = BitConverter.UInt64BitsToDouble(bits); + + AssertEqual(expectedResult, Math.Max(x, y), 0.0); + } + + if (double.IsNaN(y)) + { + ulong bits = BitConverter.DoubleToUInt64Bits(y); + bits ^= BitConverter.DoubleToUInt64Bits(-0.0); + y = BitConverter.UInt64BitsToDouble(bits); + + AssertEqual(expectedResult, Math.Max(x, y), 0.0); + } } [Fact] @@ -1161,6 +1184,29 @@ public static void Max_SByte() public static void Max_Single_NotNetFramework(float x, float y, float expectedResult) { AssertEqual(expectedResult, Math.Max(x, y), 0.0f); + + if (float.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + uint bits = BitConverter.SingleToUInt32Bits(x); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + x = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, Math.Max(x, y), 0.0f); + } + + if (float.IsNaN(y)) + { + uint bits = BitConverter.SingleToUInt32Bits(y); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + y = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, Math.Max(x, y), 0.0f); + } } [Fact] @@ -1226,6 +1272,29 @@ public static void Min_Decimal() public static void Min_Double_NotNetFramework(double x, double y, double expectedResult) { AssertEqual(expectedResult, Math.Min(x, y), 0.0); + + if (double.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + ulong bits = BitConverter.DoubleToUInt64Bits(x); + bits ^= BitConverter.DoubleToUInt64Bits(-0.0); + x = BitConverter.UInt64BitsToDouble(bits); + + AssertEqual(expectedResult, Math.Min(x, y), 0.0); + } + + if (double.IsNaN(y)) + { + ulong bits = BitConverter.DoubleToUInt64Bits(y); + bits ^= BitConverter.DoubleToUInt64Bits(-0.0); + y = BitConverter.UInt64BitsToDouble(bits); + + AssertEqual(expectedResult, Math.Min(x, y), 0.0); + } } [Fact] @@ -1284,6 +1353,29 @@ public static void Min_SByte() public static void Min_Single_NotNetFramework(float x, float y, float expectedResult) { AssertEqual(expectedResult, Math.Min(x, y), 0.0f); + + if (float.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + uint bits = BitConverter.SingleToUInt32Bits(x); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + x = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, Math.Min(x, y), 0.0f); + } + + if (float.IsNaN(y)) + { + uint bits = BitConverter.SingleToUInt32Bits(y); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + y = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, Math.Min(x, y), 0.0f); + } } [Fact] @@ -2853,6 +2945,29 @@ public static void Log2(double value, double expectedResult, double allowedVaria public static void MaxMagnitude(double x, double y, double expectedResult) { AssertEqual(expectedResult, Math.MaxMagnitude(x, y), 0.0); + + if (double.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + ulong bits = BitConverter.DoubleToUInt64Bits(x); + bits ^= BitConverter.DoubleToUInt64Bits(-0.0); + x = BitConverter.UInt64BitsToDouble(bits); + + AssertEqual(expectedResult, Math.MaxMagnitude(x, y), 0.0); + } + + if (double.IsNaN(y)) + { + ulong bits = BitConverter.DoubleToUInt64Bits(y); + bits ^= BitConverter.DoubleToUInt64Bits(-0.0); + y = BitConverter.UInt64BitsToDouble(bits); + + AssertEqual(expectedResult, Math.MaxMagnitude(x, y), 0.0); + } } [Theory] @@ -2866,6 +2981,29 @@ public static void MaxMagnitude(double x, double y, double expectedResult) public static void MinMagnitude(double x, double y, double expectedResult) { AssertEqual(expectedResult, Math.MinMagnitude(x, y), 0.0); + + if (double.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + ulong bits = BitConverter.DoubleToUInt64Bits(x); + bits ^= BitConverter.DoubleToUInt64Bits(-0.0); + x = BitConverter.UInt64BitsToDouble(bits); + + AssertEqual(expectedResult, Math.MinMagnitude(x, y), 0.0); + } + + if (double.IsNaN(y)) + { + ulong bits = BitConverter.DoubleToUInt64Bits(y); + bits ^= BitConverter.DoubleToUInt64Bits(-0.0); + y = BitConverter.UInt64BitsToDouble(bits); + + AssertEqual(expectedResult, Math.MinMagnitude(x, y), 0.0); + } } [Theory] @@ -2934,7 +3072,7 @@ public static void MinMagnitude(double x, double y, double expectedResult) [InlineData( 9.267056966972586, 2, 37.06822786789034, CrossPlatformMachineEpsilon * 100)] [InlineData( 0.5617597462207241, 5, 17.97631187906317, CrossPlatformMachineEpsilon * 100)] [InlineData( 0.7741522965913037, 6, 49.545746981843436, CrossPlatformMachineEpsilon * 100)] - [InlineData( -0.6787637026394024, 7, -86.88175393784351, CrossPlatformMachineEpsilon * 100)] + [InlineData( -0.6787637026394024, 7, -86.88175393784351, CrossPlatformMachineEpsilon * 100)] [InlineData( -6.531673581913484, 1, -13.063347163826968, CrossPlatformMachineEpsilon * 100)] [InlineData( 9.267056966972586, 2, 37.06822786789034, CrossPlatformMachineEpsilon * 100)] [InlineData( 0.5617597462207241, 5, 17.97631187906317, CrossPlatformMachineEpsilon * 100)] diff --git a/src/libraries/System.Runtime.Extensions/tests/System/MathF.cs b/src/libraries/System.Runtime.Extensions/tests/System/MathF.cs index 562d101b1b1b00..f6aeae46c77b40 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/MathF.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/MathF.cs @@ -1224,6 +1224,29 @@ public static void Log10(float value, float expectedResult, float allowedVarianc public static void Max(float x, float y, float expectedResult) { AssertEqual(expectedResult, MathF.Max(x, y), 0.0f); + + if (float.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + uint bits = BitConverter.SingleToUInt32Bits(x); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + x = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, MathF.Max(x, y), 0.0f); + } + + if (float.IsNaN(y)) + { + uint bits = BitConverter.SingleToUInt32Bits(y); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + y = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, MathF.Max(x, y), 0.0f); + } } [Theory] @@ -1237,6 +1260,29 @@ public static void Max(float x, float y, float expectedResult) public static void MaxMagnitude(float x, float y, float expectedResult) { AssertEqual(expectedResult, MathF.MaxMagnitude(x, y), 0.0f); + + if (float.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + uint bits = BitConverter.SingleToUInt32Bits(x); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + x = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, MathF.MaxMagnitude(x, y), 0.0f); + } + + if (float.IsNaN(y)) + { + uint bits = BitConverter.SingleToUInt32Bits(y); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + y = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, MathF.MaxMagnitude(x, y), 0.0f); + } } [Theory] @@ -1250,6 +1296,29 @@ public static void MaxMagnitude(float x, float y, float expectedResult) public static void Min(float x, float y, float expectedResult) { AssertEqual(expectedResult, MathF.Min(x, y), 0.0f); + + if (float.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + uint bits = BitConverter.SingleToUInt32Bits(x); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + x = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, MathF.Min(x, y), 0.0f); + } + + if (float.IsNaN(y)) + { + uint bits = BitConverter.SingleToUInt32Bits(y); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + y = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, MathF.Min(x, y), 0.0f); + } } [Theory] @@ -1263,6 +1332,29 @@ public static void Min(float x, float y, float expectedResult) public static void MinMagnitude(float x, float y, float expectedResult) { AssertEqual(expectedResult, MathF.MinMagnitude(x, y), 0.0f); + + if (float.IsNaN(x)) + { + // Toggle the sign of the NaN to validate both +NaN and -NaN behave the same. + // Negate should work as well but the JIT may constant fold or do other tricks + // and normalize to a single NaN form so we do bitwise tricks to ensure we test + // the right thing. + + uint bits = BitConverter.SingleToUInt32Bits(x); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + x = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, MathF.MinMagnitude(x, y), 0.0f); + } + + if (float.IsNaN(y)) + { + uint bits = BitConverter.SingleToUInt32Bits(y); + bits ^= BitConverter.SingleToUInt32Bits(-0.0f); + y = BitConverter.UInt32BitsToSingle(bits); + + AssertEqual(expectedResult, MathF.MinMagnitude(x, y), 0.0f); + } } [Theory] diff --git a/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs index 40fea32233194e..3a7e5aaa60f25e 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs @@ -102,11 +102,9 @@ public static void IsOSPlatformVersionAtLeast_InvalidArgs_Throws() public static void TestIsOSVersionAtLeast_Android_21() => Assert.True(OperatingSystem.IsAndroidVersionAtLeast(21)); // 21 is our min supported version [Fact, PlatformSpecific(TestPlatforms.iOS)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void TestIsOSPlatform_IOS() => TestIsOSPlatform("iOS", OperatingSystem.IsIOS); [Fact, PlatformSpecific(TestPlatforms.iOS)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void TestIsOSVersionAtLeast_IOS() => TestIsOSVersionAtLeast("iOS"); [Fact, PlatformSpecific(TestPlatforms.OSX)] @@ -129,11 +127,9 @@ public static void OSX_Is_Treated_as_macOS() } [Fact, PlatformSpecific(TestPlatforms.MacCatalyst)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void TestIsOSPlatform_MacCatalyst() => TestIsOSPlatform("MacCatalyst", OperatingSystem.IsMacCatalyst); [Fact, PlatformSpecific(TestPlatforms.MacCatalyst)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void TestIsOSVersionAtLeast_MacCatalyst() => TestIsOSVersionAtLeast("MacCatalyst"); [Fact, PlatformSpecific(TestPlatforms.MacCatalyst)] @@ -147,7 +143,6 @@ public static void MacCatalyst_Is_Also_iOS() } [Fact, PlatformSpecific(TestPlatforms.iOS)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void IOS_Is_Not_Also_MacCatalyst() { Assert.False(OperatingSystem.IsOSPlatform("MacCatalyst")); @@ -172,6 +167,12 @@ private static void TestIsOSPlatform(string currentOSName, Func currentOSC { bool expected = currentOSName.Equals(platformName, StringComparison.OrdinalIgnoreCase); + // MacCatalyst is a special case since it also returns true for iOS + if (currentOSName == "MacCatalyst" && platformName == "iOS") + { + expected = true; + } + Assert.Equal(expected, OperatingSystem.IsOSPlatform(platformName)); Assert.Equal(expected, OperatingSystem.IsOSPlatform(platformName.ToUpper())); Assert.Equal(expected, OperatingSystem.IsOSPlatform(platformName.ToLower())); @@ -186,14 +187,32 @@ private static void TestIsOSPlatform(string currentOSName, Func currentOSC OperatingSystem.IsFreeBSD(), OperatingSystem.IsAndroid(), OperatingSystem.IsIOS(), - OperatingSystem.IsMacOS(), OperatingSystem.IsMacCatalyst(), + OperatingSystem.IsMacOS(), OperatingSystem.IsTvOS(), OperatingSystem.IsWatchOS(), OperatingSystem.IsWindows() }; - Assert.Single(allResults, true); + // MacCatalyst is a special case since it also returns true for iOS + if (currentOSName == "MacCatalyst") + { + Assert.Equal(10, allResults.Length); + Assert.False(allResults[0]); // IsBrowser() + Assert.False(allResults[1]); // IsLinux() + Assert.False(allResults[2]); // IsFreeBSD() + Assert.False(allResults[3]); // IsAndroid() + Assert.True(allResults[4]); // IsIOS() + Assert.True(allResults[5]); // IsMacCatalyst() + Assert.False(allResults[6]); // IsMacOS() + Assert.False(allResults[7]); // IsTvOS() + Assert.False(allResults[8]); // IsWatchOS() + Assert.False(allResults[9]); // IsWindows() + } + else + { + Assert.Single(allResults, true); + } } private static void TestIsOSVersionAtLeast(string currentOSName) @@ -202,13 +221,19 @@ private static void TestIsOSVersionAtLeast(string currentOSName) { bool isCurrentOS = currentOSName.Equals(platformName, StringComparison.OrdinalIgnoreCase); + // MacCatalyst is a special case since it also returns true for iOS + if (currentOSName == "MacCatalyst" && platformName == "iOS") + { + isCurrentOS = true; + } + AssertVersionChecks(isCurrentOS, (major, minor, build, revision) => OperatingSystem.IsOSPlatformVersionAtLeast(platformName, major, minor, build, revision)); AssertVersionChecks(isCurrentOS, (major, minor, build, revision) => OperatingSystem.IsOSPlatformVersionAtLeast(platformName.ToLower(), major, minor, build, revision)); AssertVersionChecks(isCurrentOS, (major, minor, build, revision) => OperatingSystem.IsOSPlatformVersionAtLeast(platformName.ToUpper(), major, minor, build, revision)); } AssertVersionChecks(currentOSName.Equals("Android", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsAndroidVersionAtLeast); - AssertVersionChecks(currentOSName.Equals("iOS", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsIOSVersionAtLeast); + AssertVersionChecks(currentOSName == "MacCatalyst" || currentOSName.Equals("iOS", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsIOSVersionAtLeast); AssertVersionChecks(currentOSName.Equals("macOS", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsMacOSVersionAtLeast); AssertVersionChecks(currentOSName.Equals("MacCatalyst", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsMacCatalystVersionAtLeast); AssertVersionChecks(currentOSName.Equals("tvOS", StringComparison.OrdinalIgnoreCase), OperatingSystem.IsTvOSVersionAtLeast); diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/Directory.Build.props b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/Directory.Build.props new file mode 100644 index 00000000000000..a2b7f43d8786fd --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/Directory.Build.props @@ -0,0 +1,9 @@ + + + + + false + Microsoft + true + + diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/System.Runtime.InteropServices.NFloat.Internal.sln b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/System.Runtime.InteropServices.NFloat.Internal.sln new file mode 100644 index 00000000000000..a74a031810bfd2 --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/System.Runtime.InteropServices.NFloat.Internal.sln @@ -0,0 +1,198 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Private.CoreLib", "..\..\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj", "{94B59BA0-491F-4B59-ADFF-A057EC3EC835}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "..\Common\tests\TestUtilities\TestUtilities.csproj", "{1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServices.Unsafe", "..\System.Runtime.CompilerServices.Unsafe\ref\System.Runtime.CompilerServices.Unsafe.csproj", "{5BB5F99F-1052-4EB4-B12E-7863805661F3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServices.Unsafe", "..\System.Runtime.CompilerServices.Unsafe\src\System.Runtime.CompilerServices.Unsafe.ilproj", "{04BA3E3C-6979-4792-B19E-C797AD607F42}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices.NFloat.Internal", "ref\System.Runtime.InteropServices.NFloat.Internal.csproj", "{8671F164-F78C-44FA-93B7-A310F67890FE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices.NFloat.Internal", "src\System.Runtime.InteropServices.NFloat.Internal.csproj", "{4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices.ComDisabled.Tests", "tests\ComDisabled\System.Runtime.InteropServices.ComDisabled.Tests.csproj", "{6D2197E6-D3DF-43AE-9BEE-3573018639F9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices.NFloat.Internal.Tests", "tests\System.Runtime.InteropServices.NFloat.Internal.Tests.csproj", "{E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{FB99AC59-1744-4F12-A4B0-0D54FCA048BF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B1678CCD-95C8-4419-B9F9-14A03061BE4B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{D893B9AA-57C5-49E3-97B1-12CC62D84307}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + Checked|Any CPU = Checked|Any CPU + Checked|x64 = Checked|x64 + Checked|x86 = Checked|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|x64.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|x64.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|x86.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Debug|x86.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|Any CPU.Build.0 = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|x64.ActiveCfg = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|x64.Build.0 = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|x86.ActiveCfg = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Release|x86.Build.0 = Release|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|Any CPU.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|x64.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|x64.Build.0 = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|x86.ActiveCfg = Debug|Any CPU + {6D2197E6-D3DF-43AE-9BEE-3573018639F9}.Checked|x86.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|x64.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|x64.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|x86.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Debug|x86.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|Any CPU.Build.0 = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|x64.ActiveCfg = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|x64.Build.0 = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|x86.ActiveCfg = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Release|x86.Build.0 = Release|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|Any CPU.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|x64.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|x64.Build.0 = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|x86.ActiveCfg = Debug|Any CPU + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1}.Checked|x86.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|x64.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|x64.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|x86.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Debug|x86.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|Any CPU.Build.0 = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|x64.ActiveCfg = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|x64.Build.0 = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|x86.ActiveCfg = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Release|x86.Build.0 = Release|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|Any CPU.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|x64.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|x64.Build.0 = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|x86.ActiveCfg = Debug|Any CPU + {8671F164-F78C-44FA-93B7-A310F67890FE}.Checked|x86.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|x64.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|x64.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|x86.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Debug|x86.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|Any CPU.Build.0 = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|x64.ActiveCfg = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|x64.Build.0 = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|x86.ActiveCfg = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Release|x86.Build.0 = Release|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|Any CPU.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|x64.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|x64.Build.0 = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|x86.ActiveCfg = Debug|Any CPU + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664}.Checked|x86.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|x64.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|x64.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|x86.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Debug|x86.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|Any CPU.Build.0 = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|x64.ActiveCfg = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|x64.Build.0 = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|x86.ActiveCfg = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Release|x86.Build.0 = Release|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|Any CPU.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|x64.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|x64.Build.0 = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|x86.ActiveCfg = Debug|Any CPU + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA}.Checked|x86.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|x64.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|x64.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|x86.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|x86.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|Any CPU.Build.0 = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|x64.ActiveCfg = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|x64.Build.0 = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|x86.ActiveCfg = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|x86.Build.0 = Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|Any CPU.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|x64.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|x64.Build.0 = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|x86.ActiveCfg = Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Checked|x86.Build.0 = Debug|Any CPU + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|Any CPU.ActiveCfg = Debug|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|Any CPU.Build.0 = Debug|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|x64.ActiveCfg = Debug|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|x64.Build.0 = Debug|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|x86.ActiveCfg = Debug|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Debug|x86.Build.0 = Debug|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|Any CPU.ActiveCfg = Release|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|Any CPU.Build.0 = Release|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|x64.ActiveCfg = Release|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|x64.Build.0 = Release|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|x86.ActiveCfg = Release|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Release|x86.Build.0 = Release|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|Any CPU.ActiveCfg = Checked|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|Any CPU.Build.0 = Checked|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|x64.ActiveCfg = Checked|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|x64.Build.0 = Checked|x64 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|x86.ActiveCfg = Checked|x86 + {94B59BA0-491F-4B59-ADFF-A057EC3EC835}.Checked|x86.Build.0 = Checked|x86 + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|x64.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|x64.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|x86.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Debug|x86.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|Any CPU.Build.0 = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|x64.ActiveCfg = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|x64.Build.0 = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|x86.ActiveCfg = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Release|x86.Build.0 = Release|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|Any CPU.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|x64.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|x64.Build.0 = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|x86.ActiveCfg = Debug|Any CPU + {5BB5F99F-1052-4EB4-B12E-7863805661F3}.Checked|x86.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6D2197E6-D3DF-43AE-9BEE-3573018639F9} = {FB99AC59-1744-4F12-A4B0-0D54FCA048BF} + {E249BD6A-85DB-4CE4-BD82-8D67EBAC5664} = {FB99AC59-1744-4F12-A4B0-0D54FCA048BF} + {1FF4CC8E-49C3-42A0-A6E0-2E5908455FBA} = {FB99AC59-1744-4F12-A4B0-0D54FCA048BF} + {4FC33B9B-1BCF-4D16-B886-DCA8F2B823C1} = {B1678CCD-95C8-4419-B9F9-14A03061BE4B} + {04BA3E3C-6979-4792-B19E-C797AD607F42} = {B1678CCD-95C8-4419-B9F9-14A03061BE4B} + {94B59BA0-491F-4B59-ADFF-A057EC3EC835} = {B1678CCD-95C8-4419-B9F9-14A03061BE4B} + {8671F164-F78C-44FA-93B7-A310F67890FE} = {D893B9AA-57C5-49E3-97B1-12CC62D84307} + {5BB5F99F-1052-4EB4-B12E-7863805661F3} = {D893B9AA-57C5-49E3-97B1-12CC62D84307} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D4031401-FEB5-4CCF-91C1-38F5646B2BFD} + EndGlobalSection +EndGlobal diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/ref/System.Runtime.InteropServices.NFloat.Internal.csproj b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/ref/System.Runtime.InteropServices.NFloat.Internal.csproj new file mode 100644 index 00000000000000..43d7d54eb89374 --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/ref/System.Runtime.InteropServices.NFloat.Internal.csproj @@ -0,0 +1,43 @@ + + + System.Runtime.InteropServices + true + + + $(NoWarn);0809;0618;CS8614;CS8765;CS3015;NU5131 + true + $(NetCoreAppCurrent) + enable + + + + ref + $(DefineConstants);FEATURE_NFLOAT + true + 1 + Exposes additional NFloat APIs for Xamarin/Maui APIs from System.Runtime.InteropServices + $(MSBuildProjectName) + + true + + + + + + + + + + + + <_FileVersionMaj>$(FileVersion.Split('.')[0]) + <_FileVersionMin>$(FileVersion.Split('.')[1]) + <_FileVersionBld>$(FileVersion.Split('.')[2]) + <_FileVersionRev>$(FileVersion.Split('.')[3]) + $(_FileVersionMaj).$([MSBuild]::Add($(_FileVersionMin), 100)).$(_FileVersionBld).$(_FileVersionRev) + + + diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/src/System.Runtime.InteropServices.NFloat.Internal.proj b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/src/System.Runtime.InteropServices.NFloat.Internal.proj new file mode 100644 index 00000000000000..304633a1911a7f --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/src/System.Runtime.InteropServices.NFloat.Internal.proj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/libraries/System.Runtime.InteropServices.NFloat.Internal/tests/System.Runtime.InteropServices.NFloat.Internal.Tests.csproj b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/tests/System.Runtime.InteropServices.NFloat.Internal.Tests.csproj new file mode 100644 index 00000000000000..a8499d3dde85dd --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices.NFloat.Internal/tests/System.Runtime.InteropServices.NFloat.Internal.Tests.csproj @@ -0,0 +1,19 @@ + + + true + true + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser + true + true + + + $(DefineConstants);FEATURE_NFLOAT + + + + + + + + + diff --git a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs index 6fa5eb10ea0d4f..cd44980db97bcd 100644 --- a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs +++ b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs @@ -76,6 +76,7 @@ public void Write(long position, ref T structure) where T : struct { } } namespace System.Runtime.CompilerServices { +#if !BUILDING_CORELIB_REFERENCE [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter, Inherited=false)] public sealed partial class IDispatchConstantAttribute : System.Runtime.CompilerServices.CustomConstantAttribute @@ -89,6 +90,7 @@ public sealed partial class IUnknownConstantAttribute : System.Runtime.CompilerS public IUnknownConstantAttribute() { } public override object Value { get { throw null; } } } +#endif } namespace System.Runtime.InteropServices { @@ -111,12 +113,14 @@ public readonly partial struct ArrayWithOffset public static bool operator ==(System.Runtime.InteropServices.ArrayWithOffset a, System.Runtime.InteropServices.ArrayWithOffset b) { throw null; } public static bool operator !=(System.Runtime.InteropServices.ArrayWithOffset a, System.Runtime.InteropServices.ArrayWithOffset b) { throw null; } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Interface, Inherited=false)] public sealed partial class AutomationProxyAttribute : System.Attribute { public AutomationProxyAttribute(bool val) { } public bool Value { get { throw null; } } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)] public sealed partial class BestFitMappingAttribute : System.Attribute { @@ -157,13 +161,14 @@ public enum ClassInterfaceType AutoDual = 2, } [System.CLSCompliantAttribute(false)] - public readonly struct CLong : IEquatable + public readonly partial struct CLong : System.IEquatable { - public CLong(int value) { } - public CLong(nint value) { } + private readonly int _dummyPrimitive; + public CLong(int value) { throw null; } + public CLong(nint value) { throw null; } public nint Value { get { throw null; } } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; } - public bool Equals(CLong other) { throw null; } + public bool Equals(System.Runtime.InteropServices.CLong other) { throw null; } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } } @@ -179,6 +184,7 @@ public static partial class CollectionsMarshal public static ref TValue GetValueRefOrNullRef(System.Collections.Generic.Dictionary dictionary, TKey key) where TKey : notnull { throw null; } public static ref TValue? GetValueRefOrAddDefault(System.Collections.Generic.Dictionary dictionary, TKey key, out bool exists) where TKey : notnull { throw null; } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)] public sealed partial class ComAliasNameAttribute : System.Attribute { @@ -222,6 +228,7 @@ public sealed partial class ComConversionLossAttribute : System.Attribute { public ComConversionLossAttribute() { } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Class, Inherited=false)] public sealed partial class ComDefaultInterfaceAttribute : System.Attribute { @@ -272,11 +279,13 @@ public enum ComMemberType PropGet = 1, PropSet = 2, } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)] public sealed partial class ComRegisterFunctionAttribute : System.Attribute { public ComRegisterFunctionAttribute() { } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Class, Inherited=true)] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class ComSourceInterfacesAttribute : System.Attribute @@ -288,19 +297,22 @@ public ComSourceInterfacesAttribute(System.Type sourceInterface1, System.Type so public ComSourceInterfacesAttribute(System.Type sourceInterface1, System.Type sourceInterface2, System.Type sourceInterface3, System.Type sourceInterface4) { } public string Value { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)] public sealed partial class ComUnregisterFunctionAttribute : System.Attribute { public ComUnregisterFunctionAttribute() { } } +#endif [System.CLSCompliantAttribute(false)] - public readonly struct CULong : IEquatable + public readonly partial struct CULong : System.IEquatable { - public CULong(uint value) { } - public CULong(nuint value) { } + private readonly int _dummyPrimitive; + public CULong(uint value) { throw null; } + public CULong(nuint value) { throw null; } public nuint Value { get { throw null; } } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; } - public bool Equals(CULong other) { throw null; } + public bool Equals(System.Runtime.InteropServices.CULong other) { throw null; } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } } @@ -401,6 +413,7 @@ public sealed partial class GuidAttribute : System.Attribute public GuidAttribute(string guid) { } public string Value { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE public sealed partial class HandleCollector { public HandleCollector(string? name, int initialThreshold) { } @@ -412,6 +425,7 @@ public HandleCollector(string? name, int initialThreshold, int maximumThreshold) public void Add() { } public void Remove() { } } +#endif public readonly partial struct HandleRef { private readonly object _dummy; @@ -449,12 +463,14 @@ public partial interface IDynamicInterfaceCastable bool IsInterfaceImplemented(System.RuntimeTypeHandle interfaceType, bool throwIfNotImplemented); System.RuntimeTypeHandle GetInterfaceImplementation(System.RuntimeTypeHandle interfaceType); } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)] public sealed partial class ImportedFromTypeLibAttribute : System.Attribute { public ImportedFromTypeLibAttribute(string tlbFile) { } public string Value { get { throw null; } } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Interface, Inherited=false)] public sealed partial class InterfaceTypeAttribute : System.Attribute { @@ -482,6 +498,7 @@ public sealed partial class LCIDConversionAttribute : System.Attribute public LCIDConversionAttribute(int lcid) { } public int Value { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)] public sealed partial class ManagedToNativeComInteropStubAttribute : System.Attribute { @@ -489,6 +506,7 @@ public ManagedToNativeComInteropStubAttribute(System.Type classType, string meth public System.Type ClassType { get { throw null; } } public string MethodName { get { throw null; } } } +#endif public static partial class Marshal { public static readonly int SystemDefaultCharSize; @@ -782,15 +800,109 @@ public static void Free(void* ptr) { } [System.CLSCompliantAttribute(false)] public static void* Realloc(void* ptr, nuint byteCount) { throw null; } } - public readonly struct NFloat : IEquatable + public readonly partial struct NFloat : System.IEquatable +#if FEATURE_NFLOAT +#pragma warning disable SA1001 + , System.IComparable, + System.IComparable, + System.IFormattable, + System.ISpanFormattable +#pragma warning restore SA1001 +#endif // FEATURE_NFLOAT { - public NFloat(float value) { } - public NFloat(double value) { } + private readonly int _dummyPrimitive; + public NFloat(double value) { throw null; } + public NFloat(float value) { throw null; } public double Value { get { throw null; } } - public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; } - public bool Equals(NFloat other) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public bool Equals(System.Runtime.InteropServices.NFloat other) { throw null; } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } +#if FEATURE_NFLOAT + public static System.Runtime.InteropServices.NFloat Epsilon { get { throw null; } } + public static System.Runtime.InteropServices.NFloat MaxValue { get { throw null; } } + public static System.Runtime.InteropServices.NFloat MinValue { get { throw null; } } + public static System.Runtime.InteropServices.NFloat NaN { get { throw null; } } + public static System.Runtime.InteropServices.NFloat NegativeInfinity { get { throw null; } } + public static System.Runtime.InteropServices.NFloat PositiveInfinity { get { throw null; } } + public static int Size { get { throw null; } } + public int CompareTo(object? obj) { throw null; } + public int CompareTo(System.Runtime.InteropServices.NFloat other) { throw null; } + public static bool IsFinite(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsInfinity(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsNaN(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsNegative(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsNegativeInfinity(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsNormal(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsPositiveInfinity(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool IsSubnormal(System.Runtime.InteropServices.NFloat value) { throw null; } + public static System.Runtime.InteropServices.NFloat operator +(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator --(System.Runtime.InteropServices.NFloat value) { throw null; } + public static System.Runtime.InteropServices.NFloat operator /(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static bool operator ==(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static explicit operator System.Runtime.InteropServices.NFloat (decimal value) { throw null; } + public static explicit operator System.Runtime.InteropServices.NFloat (double value) { throw null; } + public static explicit operator byte (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator char (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator decimal (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator short (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator int (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator long (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator nint (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator sbyte (System.Runtime.InteropServices.NFloat value) { throw null; } + public static explicit operator float (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ushort (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator uint (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ulong (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator nuint (System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool operator >(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static bool operator >=(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (byte value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (char value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (short value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (int value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (long value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (nint value) { throw null; } + public static implicit operator double (System.Runtime.InteropServices.NFloat value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (sbyte value) { throw null; } + public static implicit operator System.Runtime.InteropServices.NFloat (float value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (ushort value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (uint value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (ulong value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Runtime.InteropServices.NFloat (nuint value) { throw null; } + public static System.Runtime.InteropServices.NFloat operator ++(System.Runtime.InteropServices.NFloat value) { throw null; } + public static bool operator !=(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static bool operator <(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static bool operator <=(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator %(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator *(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator -(System.Runtime.InteropServices.NFloat left, System.Runtime.InteropServices.NFloat right) { throw null; } + public static System.Runtime.InteropServices.NFloat operator -(System.Runtime.InteropServices.NFloat value) { throw null; } + public static System.Runtime.InteropServices.NFloat operator +(System.Runtime.InteropServices.NFloat value) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(string s) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(string s, System.Globalization.NumberStyles style) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } + public static System.Runtime.InteropServices.NFloat Parse(string s, System.IFormatProvider? provider) { throw null; } + public string ToString(System.IFormatProvider? provider) { throw null; } + public string ToString(string? format) { throw null; } + public string ToString(string? format, System.IFormatProvider? provider) { throw null; } + public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } + public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Runtime.InteropServices.NFloat result) { throw null; } + public static bool TryParse(System.ReadOnlySpan s, out System.Runtime.InteropServices.NFloat result) { throw null; } + public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Runtime.InteropServices.NFloat result) { throw null; } + public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Runtime.InteropServices.NFloat result) { throw null; } +#endif // FEATURE_NFLOAT } [System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)] public sealed partial class OptionalAttribute : System.Attribute @@ -838,6 +950,7 @@ public sealed partial class PreserveSigAttribute : System.Attribute { public PreserveSigAttribute() { } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false, AllowMultiple=true)] public sealed partial class PrimaryInteropAssemblyAttribute : System.Attribute { @@ -845,12 +958,14 @@ public PrimaryInteropAssemblyAttribute(int major, int minor) { } public int MajorVersion { get { throw null; } } public int MinorVersion { get { throw null; } } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Class, Inherited=false)] public sealed partial class ProgIdAttribute : System.Attribute { public ProgIdAttribute(string progId) { } public string Value { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE public static partial class RuntimeEnvironment { [System.ObsoleteAttribute("RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.", DiagnosticId = "SYSLIB0019", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] @@ -863,6 +978,7 @@ public static partial class RuntimeEnvironment public static object GetRuntimeInterfaceAsObject(System.Guid clsid, System.Guid riid) { throw null; } public static string GetSystemVersion() { throw null; } } +#endif public partial class SafeArrayRankMismatchException : System.SystemException { public SafeArrayRankMismatchException() { } @@ -897,6 +1013,7 @@ public TypeIdentifierAttribute(string? scope, string? identifier) { } public string? Identifier { get { throw null; } } public string? Scope { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)] public sealed partial class TypeLibFuncAttribute : System.Attribute { @@ -983,6 +1100,7 @@ public TypeLibVersionAttribute(int major, int minor) { } public int MajorVersion { get { throw null; } } public int MinorVersion { get { throw null; } } } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class UnknownWrapper { @@ -1108,6 +1226,7 @@ public sealed partial class VariantWrapper public VariantWrapper(object? obj) { } public object? WrappedObject { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE [System.FlagsAttribute] public enum CreateComInterfaceFlags { @@ -1166,9 +1285,11 @@ public UnmanagedCallersOnlyAttribute() { } public System.Type[]? CallConvs; public string? EntryPoint; } +#endif } namespace System.Runtime.InteropServices.ComTypes { +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.FlagsAttribute] public enum ADVF @@ -1181,6 +1302,7 @@ public enum ADVF ADVFCACHE_ONSAVE = 32, ADVF_DATAONSTOP = 64, } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Explicit)] public partial struct BINDPTR @@ -1222,12 +1344,14 @@ public partial struct CONNECTDATA public int dwCookie; public object pUnk; } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public enum DATADIR { DATADIR_GET = 1, DATADIR_SET = 2, } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public enum DESCKIND { @@ -1247,6 +1371,7 @@ public partial struct DISPPARAMS public System.IntPtr rgdispidNamedArgs; public System.IntPtr rgvarg; } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.FlagsAttribute] public enum DVASPECT @@ -1256,6 +1381,7 @@ public enum DVASPECT DVASPECT_ICON = 4, DVASPECT_DOCPRINT = 8, } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct ELEMDESC @@ -1292,6 +1418,7 @@ public partial struct FILETIME public int dwHighDateTime; public int dwLowDateTime; } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct FORMATETC @@ -1302,6 +1429,7 @@ public partial struct FORMATETC public System.IntPtr ptd; public System.Runtime.InteropServices.ComTypes.TYMED tymed; } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct FUNCDESC @@ -1346,6 +1474,7 @@ public enum FUNCKIND FUNC_STATIC = 3, FUNC_DISPATCH = 4, } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IAdviseSink @@ -1356,6 +1485,7 @@ public partial interface IAdviseSink void OnSave(); void OnViewChange(int aspect, int index); } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IBindCtx @@ -1388,6 +1518,7 @@ public partial interface IConnectionPointContainer void EnumConnectionPoints(out System.Runtime.InteropServices.ComTypes.IEnumConnectionPoints ppEnum); void FindConnectionPoint(ref System.Guid riid, out System.Runtime.InteropServices.ComTypes.IConnectionPoint? ppCP); } +#if !BUILDING_CORELIB_REFERENCE [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IDataObject { @@ -1401,6 +1532,7 @@ public partial interface IDataObject int QueryGetData(ref System.Runtime.InteropServices.ComTypes.FORMATETC format); void SetData(ref System.Runtime.InteropServices.ComTypes.FORMATETC formatIn, ref System.Runtime.InteropServices.ComTypes.STGMEDIUM medium, bool release); } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct IDLDESC @@ -1436,6 +1568,7 @@ public partial interface IEnumConnections void Reset(); int Skip(int celt); } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IEnumFORMATETC @@ -1445,6 +1578,7 @@ public partial interface IEnumFORMATETC int Reset(); int Skip(int celt); } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IEnumMoniker @@ -1454,6 +1588,7 @@ public partial interface IEnumMoniker void Reset(); int Skip(int celt); } +#if !BUILDING_CORELIB_REFERENCE [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IEnumSTATDATA { @@ -1462,6 +1597,7 @@ public partial interface IEnumSTATDATA int Reset(); int Skip(int celt); } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IEnumString @@ -1695,6 +1831,7 @@ public enum PARAMFLAG : short PARAMFLAG_FHASDEFAULT = (short)32, PARAMFLAG_FHASCUSTDATA = (short)64, } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct STATDATA @@ -1704,6 +1841,7 @@ public partial struct STATDATA public int connection; public System.Runtime.InteropServices.ComTypes.FORMATETC formatetc; } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct STATSTG @@ -1720,6 +1858,7 @@ public partial struct STATSTG public int reserved; public int type; } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct STGMEDIUM @@ -1728,6 +1867,7 @@ public partial struct STGMEDIUM public System.Runtime.InteropServices.ComTypes.TYMED tymed; public System.IntPtr unionmember; } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public enum SYSKIND { @@ -1736,6 +1876,7 @@ public enum SYSKIND SYS_MAC = 2, SYS_WIN64 = 3, } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.FlagsAttribute] public enum TYMED @@ -1749,6 +1890,7 @@ public enum TYMED TYMED_MFPICT = 32, TYMED_ENHMF = 64, } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct TYPEATTR @@ -1925,6 +2067,7 @@ public void MakeReadOnly() { } public void RemoveAt(int index) { } public void SetAt(int index, char c) { } } +#if !BUILDING_CORELIB_REFERENCE public static partial class SecureStringMarshal { public static System.IntPtr SecureStringToCoTaskMemAnsi(System.Security.SecureString s) { throw null; } @@ -1932,4 +2075,5 @@ public static partial class SecureStringMarshal public static System.IntPtr SecureStringToGlobalAllocAnsi(System.Security.SecureString s) { throw null; } public static System.IntPtr SecureStringToGlobalAllocUnicode(System.Security.SecureString s) { throw null; } } +#endif } diff --git a/src/libraries/System.Runtime.InteropServices/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.Runtime.InteropServices/src/MatchingRefApiCompatBaseline.txt index dd2e06b69c3c29..7f9c02ebeff296 100644 --- a/src/libraries/System.Runtime.InteropServices/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.Runtime.InteropServices/src/MatchingRefApiCompatBaseline.txt @@ -8,4 +8,80 @@ TypesMustExist : Type 'System.Runtime.InteropServices.RegistrationClassContext' TypesMustExist : Type 'System.Runtime.InteropServices.RegistrationConnectionType' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Runtime.InteropServices.SetWin32ContextInIDispatchAttribute' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'public void System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute..ctor()' does not exist in the reference but it does exist in the implementation. -Total Issues: 9 +CannotRemoveBaseTypeOrInterface : Type 'System.Runtime.InteropServices.NFloat' does not implement interface 'System.IComparable' in the reference but it does in the implementation. +MembersMustExist : Member 'public System.Int32 System.Runtime.InteropServices.NFloat.CompareTo(System.Object)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int32 System.Runtime.InteropServices.NFloat.CompareTo(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Epsilon.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsFinite(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsInfinity(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsNaN(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsNegative(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsNegativeInfinity(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsNormal(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsPositiveInfinity(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.IsSubnormal(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.MaxValue.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.MinValue.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.NaN.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.NegativeInfinity.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Addition(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Decrement(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Division(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_Equality(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation.C:\Users\tagoo\.nuget\packages\microsoft.dotnet.apicompat\6.0.0-beta.21614.2\build\Microsoft.DotNet.ApiCompat.targets(145,5): error : MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Explicit(System.Decimal)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Explicit(System.Double)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Byte System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Char System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Decimal System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int16 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int32 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int64 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.IntPtr System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.SByte System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Single System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.UInt16 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.UInt32 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.UInt64 System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.UIntPtr System.Runtime.InteropServices.NFloat.op_Explicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_GreaterThan(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_GreaterThanOrEqual(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Byte)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Char)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Int16)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Int32)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Int64)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.IntPtr)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Double System.Runtime.InteropServices.NFloat.op_Implicit(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.SByte)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.Single)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.UInt16)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.UInt32)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.UInt64)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Implicit(System.UIntPtr)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Increment(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_Inequality(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_LessThan(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation.C:\Users\tagoo\.nuget\packages\microsoft.dotnet.apicompat\6.0.0-beta.21614.2\build\Microsoft.DotNet.ApiCompat.targets(145,5): error : MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_LessThanOrEqual(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Modulus(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Multiply(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Subtraction(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_UnaryNegation(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_UnaryPlus(System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.String)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.String, System.Globalization.NumberStyles)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.Parse(System.String, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.PositiveInfinity.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Int32 System.Runtime.InteropServices.NFloat.Size.get()' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.String System.Runtime.InteropServices.NFloat.ToString(System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.String System.Runtime.InteropServices.NFloat.ToString(System.String)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.String System.Runtime.InteropServices.NFloat.ToString(System.String, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryFormat(System.Span, System.Int32, System.ReadOnlySpan, System.IFormatProvider)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryParse(System.ReadOnlySpan, System.Globalization.NumberStyles, System.IFormatProvider, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryParse(System.ReadOnlySpan, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryParse(System.String, System.Globalization.NumberStyles, System.IFormatProvider, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.TryParse(System.String, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_Equality(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Runtime.InteropServices.NFloat System.Runtime.InteropServices.NFloat.op_Explicit(System.Decimal)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_LessThan(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'public System.Boolean System.Runtime.InteropServices.NFloat.op_LessThanOrEqual(System.Runtime.InteropServices.NFloat, System.Runtime.InteropServices.NFloat)' does not exist in the reference but it does exist in the implementation. +Total Issues: 85 diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/OffsetOfTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/OffsetOfTests.cs index 3781d521678c86..4d1353ffd6546b 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/OffsetOfTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/OffsetOfTests.cs @@ -34,11 +34,10 @@ public void OffsetOf_ClassWithSequentialLayout_ReturnsExpected() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/49872", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroid), nameof(PlatformDetection.Is32BitProcess))] public void OffsetOf_ExplicitLayout_ReturnsExpected() { Type t = typeof(ExplicitLayoutTest); - Assert.Equal(56, Marshal.SizeOf(t)); + Assert.Equal(OperatingSystem.IsAndroid() && RuntimeInformation.ProcessArchitecture == Architecture.X86 ? 52 : 56, Marshal.SizeOf(t)); Assert.Equal(new IntPtr(0), Marshal.OffsetOf(t, nameof(ExplicitLayoutTest.m_short1))); Assert.Equal(new IntPtr(2), Marshal.OffsetOf(t, nameof(ExplicitLayoutTest.m_short2))); @@ -107,27 +106,34 @@ public void OffsetOf_ValidField_ReturnsExpected() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/49872", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroid), nameof(PlatformDetection.Is32BitProcess))] public void OffsetOf_Decimal_ReturnsExpected() { Type t = typeof(FieldAlignmentTest_Decimal); - if (OperatingSystem.IsWindows() || (RuntimeInformation.ProcessArchitecture != Architecture.X86 && RuntimeInformation.ProcessArchitecture != Architecture.Wasm)) + if (OperatingSystem.IsWindows() || (RuntimeInformation.ProcessArchitecture != Architecture.X86)) { Assert.Equal(96, Marshal.SizeOf(t)); } + else if (OperatingSystem.IsAndroid()) + { + Assert.Equal(72, Marshal.SizeOf(t)); + } else { Assert.Equal(88, Marshal.SizeOf(t)); } Assert.Equal(new IntPtr(0), Marshal.OffsetOf(t, nameof(FieldAlignmentTest_Decimal.b))); - Assert.Equal(new IntPtr(8), Marshal.OffsetOf(t, nameof(FieldAlignmentTest_Decimal.p))); + Assert.Equal(OperatingSystem.IsAndroid() && RuntimeInformation.ProcessArchitecture == Architecture.X86 ? new IntPtr(4) : new IntPtr(8), Marshal.OffsetOf(t, nameof(FieldAlignmentTest_Decimal.p))); - if (OperatingSystem.IsWindows() || (RuntimeInformation.ProcessArchitecture != Architecture.X86 && RuntimeInformation.ProcessArchitecture != Architecture.Wasm)) + if (OperatingSystem.IsWindows() || (RuntimeInformation.ProcessArchitecture != Architecture.X86)) { Assert.Equal(new IntPtr(88), Marshal.OffsetOf(t, nameof(FieldAlignmentTest_Decimal.s))); } + else if (OperatingSystem.IsAndroid()) + { + Assert.Equal(new IntPtr(68), Marshal.OffsetOf(t, nameof(FieldAlignmentTest_Decimal.s))); + } else { Assert.Equal(new IntPtr(80), Marshal.OffsetOf(t, nameof(FieldAlignmentTest_Decimal.s))); @@ -478,26 +484,26 @@ internal struct FieldAlignmentTest public double m_double2; // 8 bytes public byte m_byte3; // 1 byte public byte m_byte4; // 1 byte - // 6 bytes of padding + // 6 bytes of padding (2 bytes on Linux x86) public decimal m_decimal1; // 16 bytes public char m_char4; // 1 byte - // 7 bytes of padding + // 7 bytes of padding (3 bytes on Linux x86) } struct FieldAlignmentTest_Decimal { public byte b; // 1 byte - // 7 bytes of padding + // 7 bytes of padding (3 bytes on Linux x86) // The largest field in below struct is decimal (16 bytes wide). // However, alignment requirement for the below struct should be only 8 bytes (not 16). // This is because unlike fields of other types well known to mcg (like long, char etc.) // which need to be aligned according to their byte size, decimal is really a struct // with 8 byte alignment requirement. - public FieldAlignmentTest p; // 80 bytes (72 bytes on x86/Unix) + public FieldAlignmentTest p; // 80 bytes (72 bytes on Win x86/Unix) (64 bytes on Linux x86) public short s; // 2 bytes - // 6 bytes of padding + // 6 bytes of padding (2 bytes on Linux x86) } struct FieldAlignmentTest_Guid diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/StructureToPtrTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/StructureToPtrTests.cs index f174ab1cb03f62..ea55d5c177c54e 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/StructureToPtrTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/StructureToPtrTests.cs @@ -256,6 +256,30 @@ public unsafe void StructureToPtr_OpaqueStruct_In_NonBlittableStructure_Success( Assert.Equal(*opaqueData, *marshaledOpaqueData); } + [Fact] + public void StructureToPtr_Flat_And_Nested_NonBlittableStructure_Success() + { + MarshalAndDestroy(new NonBlittableStruct_Flat + { + del = null, + b = 0x55, + }); + + MarshalAndDestroy(new NonBlittableStruct_Nested + { + s = { del = null }, + b = 0x55, + }); + + static unsafe void MarshalAndDestroy(T value) where T : struct + { + int sizeof_T = Marshal.SizeOf(); + void* ptr = stackalloc byte[sizeof_T]; + Marshal.StructureToPtr(value, (IntPtr)ptr, false); + Marshal.DestroyStructure((IntPtr)ptr); + } + } + public struct StructWithIntField { public int value; @@ -318,5 +342,22 @@ public struct NonBlittableWithOpaque public OpaqueStruct opaque; public string str; } + + public struct NonBlittableStruct_Flat + { + public Delegate del; + public byte b; + } + + public struct NonBlittableStruct_Nested + { + public struct InnerStruct + { + public Delegate del; + } + + public InnerStruct s; + public byte b; + } } } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/NFloatTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/NFloatTests.cs index c2311afae708d1..db4e15655abfd8 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/NFloatTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/NFloatTests.cs @@ -15,36 +15,36 @@ public class NFloatTests [Fact] public void Ctor_Empty() { - NFloat value = new NFloat(); - Assert.Equal(0, value.Value); + NFloat result = new NFloat(); + Assert.Equal(0, result.Value); } [Fact] public void Ctor_Float() { - NFloat value = new NFloat(42.0f); - Assert.Equal(42.0, value.Value); + NFloat result = new NFloat(42.0f); + Assert.Equal(42.0, result.Value); } [Fact] public void Ctor_Double() { - NFloat value = new NFloat(42.0); - Assert.Equal(42.0, value.Value); + NFloat result = new NFloat(42.0); + Assert.Equal(42.0, result.Value); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is32BitProcess))] public void Ctor_Double_OutOfRange() { - NFloat value = new NFloat(double.MaxValue); - Assert.Equal((double)(float)double.MaxValue, value.Value); + NFloat result = new NFloat(double.MaxValue); + Assert.Equal(float.PositiveInfinity, result.Value); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] public void Ctor_Double_LargeValue() { - NFloat value = new NFloat(double.MaxValue); - Assert.Equal(double.MaxValue, value.Value); + NFloat result = new NFloat(double.MaxValue); + Assert.Equal(double.MaxValue, result.Value); } public static IEnumerable EqualsData() @@ -83,7 +83,6 @@ public void NaNEqualsTest() [InlineData(0.0f)] [InlineData(4567.0f)] [InlineData(4567.89101f)] - [InlineData(float.NaN)] public static void ToStringTest64(float value) { @@ -116,5 +115,809 @@ public unsafe void Size() #pragma warning restore xUnit2000 Assert.Equal(size, Marshal.SizeOf()); } + +#if FEATURE_NFLOAT + [Fact] + public void Epsilon() + { + NFloat result = NFloat.Epsilon; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.Epsilon, result.Value); + } + else + { + Assert.Equal(float.Epsilon, result.Value); + } + } + + [Fact] + public void MaxValue() + { + NFloat result = NFloat.MaxValue; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.MaxValue, result.Value); + } + else + { + Assert.Equal(float.MaxValue, result.Value); + } + } + + [Fact] + public void MinValue() + { + NFloat result = NFloat.MinValue; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.MinValue, result.Value); + } + else + { + Assert.Equal(float.MinValue, result.Value); + } + } + + [Fact] + public void NaN() + { + NFloat result = NFloat.NaN; + Assert.True(double.IsNaN(result.Value)); + } + + [Fact] + public void NegativeInfinity() + { + NFloat result = NFloat.NegativeInfinity; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.NegativeInfinity, result.Value); + } + else + { + Assert.Equal(float.NegativeInfinity, result.Value); + } + } + + [Fact] + public void PositiveInfinity() + { + NFloat result = NFloat.PositiveInfinity; + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.PositiveInfinity, result.Value); + } + else + { + Assert.Equal(float.PositiveInfinity, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public static void op_UnaryPlus(float value) + { + NFloat result = +(new NFloat(value)); + Assert.Equal(+value, result.Value); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public static void op_UnaryNegation(float value) + { + NFloat result = -(new NFloat(value)); + Assert.Equal(-value, result.Value); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public static void op_Decrement(float value) + { + NFloat result = new NFloat(value); + --result; + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)value - 1, result.Value); + } + else + { + Assert.Equal(value - 1, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public static void op_Increment(float value) + { + NFloat result = new NFloat(value); + ++result; + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)value + 1, result.Value); + } + else + { + Assert.Equal(value + 1, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/65557", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroid), nameof(PlatformDetection.Is32BitProcess))] + public static void op_Addition(float left, float right) + { + NFloat result = new NFloat(left) + new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left + right, result.Value); + } + else + { + Assert.Equal(left + right, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/65557", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroid), nameof(PlatformDetection.Is32BitProcess))] + public static void op_Subtraction(float left, float right) + { + NFloat result = new NFloat(left) - new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left - right, result.Value); + } + else + { + Assert.Equal(left - right, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/65557", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroid), nameof(PlatformDetection.Is32BitProcess))] + public static void op_Multiply(float left, float right) + { + NFloat result = new NFloat(left) * new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left * right, result.Value); + } + else + { + Assert.Equal(left * right, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/65557", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroid), nameof(PlatformDetection.Is32BitProcess))] + public static void op_Division(float left, float right) + { + NFloat result = new NFloat(left) / new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left / right, result.Value); + } + else + { + Assert.Equal(left / right, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f, 3.14f)] + [InlineData(-4567.89101f, 3.14569f)] + [InlineData(0.0f, 3.14f)] + [InlineData(4567.0f, -3.14f)] + [InlineData(4567.89101f, -3.14569f)] + public static void op_Modulus(float left, float right) + { + NFloat result = new NFloat(left) % new NFloat(right); + + if (Environment.Is64BitProcess) + { + Assert.Equal((double)left % right, result.Value); + } + else + { + Assert.Equal(left % right, result.Value); + } + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_Equality(float left, float right) + { + bool result = new NFloat(left) == new NFloat(right); + Assert.Equal(left == right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_Inequality(float left, float right) + { + bool result = new NFloat(left) != new NFloat(right); + Assert.Equal(left != right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_GreaterThan(float left, float right) + { + bool result = new NFloat(left) > new NFloat(right); + Assert.Equal(left > right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_GreaterThanOrEqual(float left, float right) + { + bool result = new NFloat(left) >= new NFloat(right); + Assert.Equal(left >= right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_LessThan(float left, float right) + { + bool result = new NFloat(left) < new NFloat(right); + Assert.Equal(left < right, result); + } + + [Theory] + [InlineData(789.0f, 789.0f)] + [InlineData(789.0f, -789.0f)] + [InlineData(789.0f, 0.0f)] + [InlineData(789.0f, 1000.0f)] + public void op_LessThanOrEqual(float left, float right) + { + bool result = new NFloat(left) <= new NFloat(right); + Assert.Equal(left <= right, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void DoubleToNFloat(float value) + { + NFloat result = (NFloat)(double)value; + + if (Environment.Is64BitProcess) + { + Assert.Equal(value, result.Value); + } + else + { + Assert.Equal((float)value, result.Value); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToByte(float value) + { + byte result = (byte)new NFloat(value); + Assert.Equal((byte)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToChar(float value) + { + char result = (char)new NFloat(value); + Assert.Equal((char)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToDecimal(float value) + { + decimal result = (decimal)new NFloat(value); + + if (Environment.Is64BitProcess) + { + Assert.Equal((decimal)(double)value, result); + } + else + { + Assert.Equal((decimal)value, result); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToInt16(float value) + { + short result = (short)new NFloat(value); + Assert.Equal((short)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToInt32(float value) + { + int result = (int)new NFloat(value); + Assert.Equal((int)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToInt64(float value) + { + long result = (long)new NFloat(value); + Assert.Equal((long)value, result); + } + + [Theory] + [InlineData(-4567.0f, Skip = "https://github.com/dotnet/runtime/issues/64386")] + [InlineData(-4567.89101f, Skip = "https://github.com/dotnet/runtime/issues/64386")] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToIntPtr(float value) + { + nint result = (nint)new NFloat(value); + Assert.Equal((nint)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToSByte(float value) + { + sbyte result = (sbyte)new NFloat(value); + Assert.Equal((sbyte)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToSingle(float value) + { + float result = (float)new NFloat(value); + Assert.Equal(value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToUInt16(float value) + { + ushort result = (ushort)new NFloat(value); + Assert.Equal((ushort)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToUInt32(float value) + { + uint result = (uint)new NFloat(value); + Assert.Equal((uint)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToUInt64(float value) + { + ulong result = (ulong)new NFloat(value); + Assert.Equal((ulong)value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToUIntPtr(float value) + { + nuint result = (nuint)new NFloat(value); + Assert.Equal((nuint)value, result); + } + + [Theory] + [InlineData((byte)0)] + [InlineData((byte)5)] + [InlineData((byte)42)] + [InlineData((byte)127)] + [InlineData((byte)255)] + public void ByteToNFloat(byte value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData('A')] + [InlineData('B')] + [InlineData('C')] + [InlineData('D')] + [InlineData('E')] + public void CharToNFloat(char value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((short)-255)] + [InlineData((short)-127)] + [InlineData((short)0)] + [InlineData((short)127)] + [InlineData((short)255)] + public void Int16ToNFloat(short value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData(-255)] + [InlineData(-127)] + [InlineData(0)] + [InlineData(127)] + [InlineData(255)] + public void Int32ToNFloat(int value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((long)-255)] + [InlineData((long)-127)] + [InlineData((long)0)] + [InlineData((long)127)] + [InlineData((long)255)] + public void Int64ToNFloat(long value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((int)-255)] + [InlineData((int)-127)] + [InlineData((int)0)] + [InlineData((int)127)] + [InlineData((int)255)] + public void IntPtrToNFloat(int value) + { + NFloat result = (nint)value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((sbyte)-127)] + [InlineData((sbyte)-63)] + [InlineData((sbyte)0)] + [InlineData((sbyte)63)] + [InlineData((sbyte)127)] + public void SByteToNFloat(sbyte value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void SingleToNFloat(float value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((ushort)0)] + [InlineData((ushort)5)] + [InlineData((ushort)42)] + [InlineData((ushort)127)] + [InlineData((ushort)255)] + public void UInt16ToNFloat(ushort value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((uint)0)] + [InlineData((uint)5)] + [InlineData((uint)42)] + [InlineData((uint)127)] + [InlineData((uint)255)] + public void UInt32ToNFloat(uint value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((ulong)0)] + [InlineData((ulong)5)] + [InlineData((ulong)42)] + [InlineData((ulong)127)] + [InlineData((ulong)255)] + public void UInt64ToNFloat(ulong value) + { + NFloat result = value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData((uint)0)] + [InlineData((uint)5)] + [InlineData((uint)42)] + [InlineData((uint)127)] + [InlineData((uint)255)] + public void UIntPtrToNFloat(uint value) + { + NFloat result = (nuint)value; + Assert.Equal(value, result.Value); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + public void NFloatToDouble(float value) + { + double result = new NFloat(value); + Assert.Equal(value, result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsFinite(float value) + { + bool result = NFloat.IsFinite(value); + Assert.Equal(float.IsFinite(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsInfinity(float value) + { + bool result = NFloat.IsInfinity(value); + Assert.Equal(float.IsInfinity(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsNaN(float value) + { + bool result = NFloat.IsNaN(value); + Assert.Equal(float.IsNaN(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsNegative(float value) + { + bool result = NFloat.IsNegative(value); + Assert.Equal(float.IsNegative(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsNegativeInfinity(float value) + { + bool result = NFloat.IsNegativeInfinity(value); + Assert.Equal(float.IsNegativeInfinity(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsNormal(float value) + { + bool result = NFloat.IsNormal(value); + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.IsNormal(value), result); + } + else + { + Assert.Equal(float.IsNormal(value), result); + } + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsPositiveInfinity(float value) + { + bool result = NFloat.IsPositiveInfinity(value); + Assert.Equal(float.IsPositiveInfinity(value), result); + } + + [Theory] + [InlineData(-4567.0f)] + [InlineData(-4567.89101f)] + [InlineData(0.0f)] + [InlineData(4567.0f)] + [InlineData(4567.89101f)] + [InlineData(float.Epsilon)] + [InlineData(float.NegativeInfinity)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NaN)] + public void IsSubnormal(float value) + { + bool result = NFloat.IsSubnormal(value); + + if (Environment.Is64BitProcess) + { + Assert.Equal(double.IsSubnormal(value), result); + } + else + { + Assert.Equal(float.IsSubnormal(value), result); + } + } +#endif // FEATURE_NFLOAT } } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs index 4b0c9fc01dea3a..f844b4d160a884 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/PosixSignalRegistrationTests.Unix.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using Xunit; +using System.Diagnostics; +using System.Globalization; using System.Threading; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; @@ -57,7 +59,16 @@ public void SignalHandlerCalledForKnownSignals(PosixSignal s) semaphore.Release(); }); - kill(signal); + // Use 'kill' command with signal name to validate the signal pal mapping. + string sigArg = signalStr.StartsWith("SIG") ? signalStr.Substring(3) : signalStr; + using var process = Process.Start(new ProcessStartInfo + { + FileName = "/bin/sh", // Use a shell because not all platforms include a 'kill' executable. + ArgumentList = { "-c", $"kill -s {sigArg} {Environment.ProcessId.ToString()}" } + }); + process.WaitForExit(); + Assert.Equal(0, process.ExitCode); + bool entered = semaphore.Wait(SuccessTimeout); Assert.True(entered); }, s.ToString()).Dispose(); diff --git a/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs b/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs index 6ad7fc3eb9842b..4391b94b5ccb25 100644 --- a/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs +++ b/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs @@ -3,7 +3,6 @@ // ------------------------------------------------------------------------------ // Changes to this file must follow the https://aka.ms/api-review process. // ------------------------------------------------------------------------------ -using System.Runtime.Versioning; namespace System.Runtime.Intrinsics { @@ -3371,7 +3370,7 @@ internal X64() { } } [System.CLSCompliantAttribute(false)] - [RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("AvxVnni is in preview.")] public abstract class AvxVnni : System.Runtime.Intrinsics.X86.Avx2 { internal AvxVnni() { } diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate.cs b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate.cs new file mode 100644 index 00000000000000..47bbcd171ad3b4 --- /dev/null +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Reflection.Metadata.ApplyUpdate.Test +{ + public class FirstCallAfterUpdate { + public FirstCallAfterUpdate() {} + public string Method1 (string s) { + return s + " STRING"; + } + } +} diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate_v1.cs b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate_v1.cs new file mode 100644 index 00000000000000..66d1d336e6baa3 --- /dev/null +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate_v1.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Reflection.Metadata.ApplyUpdate.Test +{ + public class FirstCallAfterUpdate { + public FirstCallAfterUpdate() {} + public string Method1(string s) { + return "NEW " + s; + } + } +} diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate_v2.cs b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate_v2.cs new file mode 100644 index 00000000000000..9ea687752b8026 --- /dev/null +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/FirstCallAfterUpdate_v2.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Reflection.Metadata.ApplyUpdate.Test +{ + public class FirstCallAfterUpdate { + public FirstCallAfterUpdate() {} + public string Method1(string s) { + return s + "EST STRING"; + } + } +} diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate.csproj b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate.csproj new file mode 100644 index 00000000000000..1cd197f92264de --- /dev/null +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate.csproj @@ -0,0 +1,12 @@ + + + System.Runtime.Loader.Tests + $(NetCoreAppCurrent) + true + deltascript.json + true + + + + + diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/deltascript.json b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/deltascript.json new file mode 100644 index 00000000000000..64d533be6b7560 --- /dev/null +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.FirstCallAfterUpdate/deltascript.json @@ -0,0 +1,7 @@ +{ + "changes": [ + {"document": "FirstCallAfterUpdate.cs", "update": "FirstCallAfterUpdate_v1.cs"}, + {"document": "FirstCallAfterUpdate.cs", "update": "FirstCallAfterUpdate_v2.cs"}, + ] +} + diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs index 794ace67148c94..3e240e65caabf8 100644 --- a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs @@ -94,6 +94,26 @@ void LambdaCapturesThis() }); } + [ConditionalFact(typeof(ApplyUpdateUtil), nameof (ApplyUpdateUtil.IsSupported))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/54617", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))] + void FirstCallAfterUpdate() + { + /* Tests that updating a method that has not been called before works correctly and that + * the JIT/interpreter doesn't have to rely on cached baseline data. */ + ApplyUpdateUtil.TestCase(static () => + { + var assm = typeof (ApplyUpdate.Test.FirstCallAfterUpdate).Assembly; + + var o = new ApplyUpdate.Test.FirstCallAfterUpdate (); + + ApplyUpdateUtil.ApplyUpdate(assm); + ApplyUpdateUtil.ApplyUpdate(assm); + + string r = o.Method1("NEW"); + + Assert.Equal("NEWEST STRING", r); + }); + } [ConditionalFact(typeof(ApplyUpdateUtil), nameof (ApplyUpdateUtil.IsSupported))] [ActiveIssue("https://github.com/dotnet/runtime/issues/52993", TestRuntimes.Mono)] diff --git a/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj b/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj index f893446f21d0e2..8b946a20828d2e 100644 --- a/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj +++ b/src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj @@ -38,6 +38,7 @@ + @@ -54,6 +55,7 @@ + diff --git a/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs b/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs index 18374c12c775f2..d27244837a0899 100644 --- a/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs +++ b/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs @@ -2021,10 +2021,14 @@ public static explicit operator decimal(BigInteger value) } NumericsHelpers.DangerousMakeTwosComplement(xd); // Mutates xd - if (xd[^1] == 0) - { - trackSignBit = true; - } + + // For a shift of N x 32 bit, + // We check for a special case where its sign bit could be outside the uint array after 2's complement conversion. + // For example given [0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF], its 2's complement is [0x01, 0x00, 0x00] + // After a 32 bit right shift, it becomes [0x00, 0x00] which is [0x00, 0x00] when converted back. + // The expected result is [0x00, 0x00, 0xFFFFFFFF] (2's complement) or [0x00, 0x00, 0x01] when converted back + // If the 2's component's last element is a 0, we will track the sign externally + trackSignBit = smallShift == 0 && xd[^1] == 0; } int zl = xd.Length - digitShift + (trackSignBit ? 1: 0); @@ -2061,12 +2065,12 @@ stackalloc uint[StackallocUInt32Limit].Slice(0, zl) : } if (negx) { - NumericsHelpers.DangerousMakeTwosComplement(zd); // Mutates zd - + // Set the tracked sign to the last element if (trackSignBit) { - zd[^1] = 1; + zd[^1] = 0xFFFFFFFF; } + NumericsHelpers.DangerousMakeTwosComplement(zd); // Mutates zd } return new BigInteger(zd, zdArray, negx); diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_rightshift.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_rightshift.cs index 0e7fbf1e30ebab..2f65e779c0430f 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_rightshift.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/op_rightshift.cs @@ -63,6 +63,14 @@ public static void RunRightShiftTests() VerifyRightShiftString(Print(tempByteArray2) + Print(tempByteArray1) + "b>>"); } + // RightShift Method - Uint 0xffffffff 0x8000000 ... Large BigIntegers - 32 bit Shift + for (int i = 0; i < s_samples; i++) + { + tempByteArray1 = GetRandomLengthFirstUIntMaxSecondUIntMSBMaxArray(s_random); + tempByteArray2 = new byte[] { (byte)32 }; + VerifyRightShiftString(Print(tempByteArray2) + Print(tempByteArray1) + "b>>"); + } + // RightShift Method - Large BigIntegers - large - Shift for (int i = 0; i < s_samples; i++) { @@ -229,6 +237,15 @@ private static byte[] GetRandomLengthAllOnesUIntByteArray(Random random) array[^1] = 0xFF; return array; } + private static byte[] GetRandomLengthFirstUIntMaxSecondUIntMSBMaxArray(Random random) + { + int gap = random.Next(0, 128); + int byteLength = 4 + gap * 4 + 1; + byte[] array = new byte[byteLength]; + array[^6] = 0x80; + array[^1] = 0xFF; + return array; + } private static string Print(byte[] bytes) { diff --git a/src/libraries/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectWriter.cs b/src/libraries/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectWriter.cs index cf57a01929bb1b..deb70255935061 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectWriter.cs +++ b/src/libraries/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectWriter.cs @@ -375,7 +375,7 @@ private void WriteMembers(NameInfo memberNameInfo, return; } - if (!WriteKnownValueClass(memberNameInfo, memberTypeNameInfo, memberData!)) + if (!WriteKnownValueClass(memberNameInfo, memberTypeNameInfo, memberData!, ref assignUniqueIdToValueType)) { if (outType == null) { @@ -624,10 +624,10 @@ private void WriteArrayMember(WriteObjectInfo objectInfo, NameInfo arrayElemType actualTypeInfo._isArrayItem = true; } - if (!WriteKnownValueClass(arrayElemTypeNameInfo, actualTypeInfo, data!)) + bool assignUniqueIdForValueTypes = false; + if (!WriteKnownValueClass(arrayElemTypeNameInfo, actualTypeInfo, data!, ref assignUniqueIdForValueTypes)) { object obj = data!; - bool assignUniqueIdForValueTypes = false; if (ReferenceEquals(arrayElemTypeNameInfo._type, Converter.s_typeofObject)) { assignUniqueIdForValueTypes = true; @@ -807,11 +807,12 @@ private long Schedule(object obj, bool assignUniqueIdToValueType, Type? type, Wr } // Determines if a type is a primitive type, if it is it is written - private bool WriteKnownValueClass(NameInfo memberNameInfo, NameInfo typeNameInfo, object data) + private bool WriteKnownValueClass(NameInfo memberNameInfo, NameInfo typeNameInfo, object data, ref bool assignUniqueIdToValueType) { if (ReferenceEquals(typeNameInfo._type, Converter.s_typeofString)) { WriteString(memberNameInfo, typeNameInfo, data); + return true; } else { @@ -825,18 +826,22 @@ private bool WriteKnownValueClass(NameInfo memberNameInfo, NameInfo typeNameInfo if (typeNameInfo._isArray) // null if an array { _serWriter.WriteItem(memberNameInfo, typeNameInfo, data); + return true; } - else + else if (memberNameInfo._type == typeNameInfo._type + || memberNameInfo._type == typeof(object) + || (memberNameInfo._type != null && Nullable.GetUnderlyingType(memberNameInfo._type) != null)) { _serWriter.WriteMember(memberNameInfo, typeNameInfo, data); + return true; } } } - return true; + assignUniqueIdToValueType = true; + return false; } - // Writes an object reference to the stream. private void WriteObjectRef(NameInfo nameInfo, long objectId) => _serWriter!.WriteMemberObjectRef(nameInfo, (int)objectId); diff --git a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs index 7bd5ede42c51b9..5baa570e8621e8 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs +++ b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs @@ -535,6 +535,25 @@ public void Roundtrip_ArrayContainingArrayAtNonZeroLowerBound() BinaryFormatterHelpers.Clone(Array.CreateInstance(typeof(uint[]), new[] { 5 }, new[] { 1 })); } + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Framework has not been patched yet.")] + public void BypassingSerializationBinders() + { + Tuple tuple = new Tuple(42, new byte[] { 1, 2, 3, 4 }); + BinaryFormatter formatter = new BinaryFormatter(); + + using (MemoryStream stream = new MemoryStream()) + { + formatter.Serialize(stream, tuple); + + stream.Position = 0; + + Tuple deserialized = (Tuple)formatter.Deserialize(stream); + Assert.Equal(tuple.Item1, deserialized.Item1); + Assert.Equal(tuple.Item2, deserialized.Item2); + } + } + private static void ValidateEqualityComparer(object obj) { Type objType = obj.GetType(); diff --git a/src/libraries/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs b/src/libraries/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs index 87cd3085c99e3f..93fbe543fb168f 100644 --- a/src/libraries/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs +++ b/src/libraries/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs @@ -139,26 +139,30 @@ public static void DCJS_DecimalAsRoot() [Fact] public static void DCJS_DoubleAsRoot() { - Assert.StrictEqual(SerializeAndDeserialize(-1.2, "-1.2"), -1.2); - Assert.StrictEqual(0, SerializeAndDeserialize(0, "0")); + Assert.StrictEqual(-1.2, SerializeAndDeserialize(-1.2, "-1.2")); + Assert.StrictEqual(0.0, SerializeAndDeserialize(0.0, "0")); + Assert.StrictEqual(0.0, SerializeAndDeserialize(-0.0, "-0")); + Assert.Equal("-0", SerializeAndDeserialize(-0.0, "-0").ToString()); Assert.StrictEqual(2.3, SerializeAndDeserialize(2.3, "2.3")); - Assert.StrictEqual(SerializeAndDeserialize(double.MinValue, "-1.7976931348623157E+308"), double.MinValue); - Assert.StrictEqual(SerializeAndDeserialize(double.MaxValue, "1.7976931348623157E+308"), double.MaxValue); + Assert.StrictEqual(double.MinValue, SerializeAndDeserialize(double.MinValue, "-1.7976931348623157E+308")); + Assert.StrictEqual(double.MaxValue, SerializeAndDeserialize(double.MaxValue, "1.7976931348623157E+308")); } [Fact] public static void DCJS_FloatAsRoot() { - Assert.StrictEqual(SerializeAndDeserialize((float)-1.2, "-1.2"), (float)-1.2); - Assert.StrictEqual(SerializeAndDeserialize((float)0, "0"), (float)0); - Assert.StrictEqual(SerializeAndDeserialize((float)2.3, "2.3"), (float)2.3); + Assert.StrictEqual((float)-1.2, SerializeAndDeserialize((float)-1.2, "-1.2")); + Assert.StrictEqual((float)0.0, SerializeAndDeserialize((float)0.0, "0")); + Assert.StrictEqual((float)0.0, SerializeAndDeserialize((float)-0.0, "-0")); + Assert.Equal("-0", SerializeAndDeserialize((float)-0.0, "-0").ToString()); + Assert.StrictEqual((float)2.3, SerializeAndDeserialize((float)2.3, "2.3")); } [Fact] public static void DCJS_FloatAsRoot_NotNetFramework() { - Assert.StrictEqual(SerializeAndDeserialize(float.MinValue, "-3.4028235E+38"), float.MinValue); - Assert.StrictEqual(SerializeAndDeserialize(float.MaxValue, "3.4028235E+38"), float.MaxValue); + Assert.StrictEqual(float.MinValue, SerializeAndDeserialize(float.MinValue, "-3.4028235E+38")); + Assert.StrictEqual(float.MaxValue, SerializeAndDeserialize(float.MaxValue, "3.4028235E+38")); } [Fact] @@ -2384,6 +2388,38 @@ public static void DCJS_ExtensionDataObjectTest() } } + [Fact] + public static void DCJS_ExtensionDataObjectTest2() + { + SerializeThenDeserialize(new ContractExtended { Item = new Item { Id = 1, Code = 2 } }); + SerializeThenDeserialize(new ContractExtended { Item = new Item { Id = 1 } }); + } + + private static void SerializeThenDeserialize(ContractExtended extendedData) + { + string extendedContractJson; + using (var memoryStream = new MemoryStream()) + { + new DataContractJsonSerializer(typeof(ContractExtended)).WriteObject(memoryStream, extendedData); + extendedContractJson = Encoding.UTF8.GetString(memoryStream.ToArray()); + } + + ContractGeneric reducedData; + using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(extendedContractJson))) + { + reducedData = (ContractGeneric)new DataContractJsonSerializer(typeof(ContractGeneric)).ReadObject(memoryStream); + } + + string reducedContractJson; + using (var memoryStream = new MemoryStream()) + { + new DataContractJsonSerializer(typeof(ContractGeneric)).WriteObject(memoryStream, reducedData); + reducedContractJson = Encoding.UTF8.GetString(memoryStream.ToArray()); + } + + Assert.Equal(extendedContractJson, reducedContractJson); + } + private static string ConstructorWithRootNameTestHelper(TypeForRootNameTest value, DataContractJsonSerializer serializer) { using (var ms = new MemoryStream()) diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs index 038b9130d4dc8b..0f5cdcb4e0d1e5 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs @@ -111,6 +111,19 @@ public static void DCS_DateTimeAsRoot() Assert.StrictEqual(DataContractSerializerHelper.SerializeAndDeserialize(DateTime.SpecifyKind(DateTime.MaxValue, DateTimeKind.Utc), @"9999-12-31T23:59:59.9999999Z"), DateTime.SpecifyKind(DateTime.MaxValue, DateTimeKind.Utc)); } + + [Fact] + public static void DCS_BinarySerializationOfDateTime() + { + DateTime dateTime = DateTime.Parse("2021-01-01"); + MemoryStream ms = new(); + DataContractSerializer dcs = new(dateTime.GetType()); + using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter(ms, null, null)) + dcs.WriteObject(writer, dateTime); + var serializedBytes = ms.ToArray(); + Assert.Equal(72, serializedBytes.Length); + } + [Fact] public static void DCS_DecimalAsRoot() { @@ -792,7 +805,7 @@ public static void DCS_EnumerableMembers() Assert.True(y.RO1.Count == 1); Assert.True((char)y.RO1[0] == 'x'); } - + [Fact] public static void DCS_EnumerableMemberConcreteTypeWithoutDefaultContructor() { @@ -2138,7 +2151,21 @@ public static void DCS_RecursiveCollection() { Assert.Throws(() => { - (new DataContractSerializer(typeof (RecursiveCollection))).WriteObject(new MemoryStream(), new RecursiveCollection()); + (new DataContractSerializer(typeof(RecursiveCollection))).WriteObject(new MemoryStream(), new RecursiveCollection()); + }); + + Assert.Throws(() => + { + (new DataContractSerializer(typeof(RecursiveEnumerable))).WriteObject(new MemoryStream(), new RecursiveEnumerable()); + }); + + // When constructing an element name, we seem to ignore recursion for types marked with [CollectionDataContract]. + var name = new XsdDataContractExporter().GetRootElementName(typeof(RecursiveCollection)); + + // But 'RecursiveEnumerable' is not marked with the attribute. So it takes a code path that looks for this. + Assert.Throws(() => + { + new XsdDataContractExporter().GetRootElementName(typeof(RecursiveEnumerable)); }); } diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj b/src/libraries/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj index d6c214bbf85807..8ccac5a36c24bd 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj @@ -44,6 +44,8 @@ Link="SerializationTestTypes\SampleTypes.cs" /> + diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs index 95d51d43c89197..df25788bcaae7f 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs @@ -2580,6 +2580,23 @@ public TypeWithEnumerableInterfaceGetOnlyCollection(List items) } } +// RecursiveEnumerable +// ============================= +// IEnumerable<> +// Not-explicit [CollectionDataContract] +// Direct recursion +// +// RecursiveCollection +// ============================= +// List<> +// Explicit [CollectionDataContract] +// Indirect recursion +public class RecursiveEnumerable : IEnumerable +{ + public IEnumerator GetEnumerator() => null; + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); +} + [CollectionDataContract] public class RecursiveCollection : List { @@ -4347,6 +4364,29 @@ public NativeJsonTestData(Type type, Func instantiate) public Func Instantiate { get; set; } } +[DataContract] +public class ContractGeneric : IExtensibleDataObject +{ + public ExtensionDataObject ExtensionData { get; set; } +} + +[DataContract(Name = "ContractGeneric")] +public class ContractExtended +{ + [DataMember(Name = "item", Order = 1)] + public Item Item; +} + +[DataContract] +public class Item +{ + [DataMember(Name = "id", Order = 1, EmitDefaultValue = false)] + public long? Id; + + [DataMember(Name = "code", Order = 2, EmitDefaultValue = false)] + public long? Code; +} + public class TypeWithCollectionAndDateTimeOffset { public TypeWithCollectionAndDateTimeOffset() diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs index bc10a370b033cd..747f661129a94a 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs @@ -47,6 +47,16 @@ public static bool AreEqual(SimpleType x, SimpleType y) return (x.P1 == y.P1) && (x.P2 == y.P2); } } + + public override bool Equals(object? obj) + { + if (obj is SimpleType st) + return AreEqual(this, st); + + return base.Equals(obj); + } + + public override int GetHashCode() => base.GetHashCode(); } public class TypeWithGetSetArrayMembers diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj b/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj index b7878a37204498..3fd9aa5f5afd21 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj @@ -28,6 +28,8 @@ + diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryReaderTests.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryReaderTests.cs index cd34fceb0fb4f6..ce13750d56388e 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryReaderTests.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryReaderTests.cs @@ -1,8 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Buffers.Binary; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using System.Xml; using Xunit; @@ -161,6 +163,129 @@ public static void ReadStringTest() Assert.Equal(value, s); } } + + [Fact] + public static void BinaryXml_ReadPrimitiveTypes() + { + float f = 1.23456788f; + ReadOnlySpan floatBytes = new byte[] { 0x52, 0x06, 0x9e, 0x3f }; + Guid guid = new Guid(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }); + + AssertReadContentFromBinary(long.MaxValue, XmlBinaryNodeType.Int64TextWithEndElement, new byte[] { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }); + + AssertReadContentFromBinary((byte)0x78, XmlBinaryNodeType.Int8Text, new byte[] { 0x78 }); + AssertReadContentFromBinary((short)0x1234, XmlBinaryNodeType.Int16Text, new byte[] { 0x34, 0x12 }); + AssertReadContentFromBinary(unchecked((short)0xf234), XmlBinaryNodeType.Int16Text, new byte[] { 0x34, 0xf2 }); + AssertReadContentFromBinary((int)0x12345678, XmlBinaryNodeType.Int32Text, new byte[] { 0x78, 0x56, 0x34, 0x12 }); + AssertReadContentFromBinary((long)0x0102030412345678, XmlBinaryNodeType.Int64Text, new byte[] { 0x78, 0x56, 0x34, 0x12, 04, 03, 02, 01 }); + + // Integer values should be represented using smalles possible type + AssertReadContentFromBinary((long)0, XmlBinaryNodeType.ZeroText, ReadOnlySpan.Empty); + AssertReadContentFromBinary((long)1, XmlBinaryNodeType.OneText, ReadOnlySpan.Empty); + AssertReadContentFromBinary((int)0x00000078, XmlBinaryNodeType.Int8Text, new byte[] { 0x78 }); + AssertReadContentFromBinary(unchecked((int)0xfffffff0), XmlBinaryNodeType.Int8Text, new byte[] { 0xf0 }); + AssertReadContentFromBinary((int)0x00001234, XmlBinaryNodeType.Int16Text, new byte[] { 0x34, 0x12 }); + AssertReadContentFromBinary(unchecked((int)0xfffff234), XmlBinaryNodeType.Int16Text, new byte[] { 0x34, 0xf2 }); + AssertReadContentFromBinary((long)0x12345678, XmlBinaryNodeType.Int32Text, new byte[] { 0x78, 0x56, 0x34, 0x12 }); + AssertReadContentFromBinary(unchecked((long)0xfffffffff2345678), XmlBinaryNodeType.Int32Text, new byte[] { 0x78, 0x56, 0x34, 0xf2 }); + + AssertReadContentFromBinary(f, XmlBinaryNodeType.FloatText, floatBytes); + AssertReadContentFromBinary(8.20788039913184E-304, XmlBinaryNodeType.DoubleText, new byte[] { 8, 7, 6, 5, 4, 3, 2, 1 }); + AssertReadContentFromBinary(guid, XmlBinaryNodeType.GuidText, guid.ToByteArray()); + AssertReadContentFromBinary(new TimeSpan(0x0807060504030201), XmlBinaryNodeType.TimeSpanText, new byte[] { 01, 02, 03, 04, 05, 06, 07, 08 }); + AssertReadContentFromBinary(new decimal(0x20212223, 0x10111213, 0x01020304, true, scale: 0x1b), XmlBinaryNodeType.DecimalText, + new byte[] { 0x0, 0x0, 0x1b, 0x80, 0x4, 0x3, 0x2, 0x1, 0x23, 0x22, 0x21, 0x20, 0x13, 0x12, 0x11, 0x10 }); + AssertReadContentFromBinary(new DateTime(2022, 8, 26, 12, 34, 56, DateTimeKind.Utc), XmlBinaryNodeType.DateTimeText, + new byte[] { 0x00, 0x18, 0xdf, 0x61, 0x5f, 0x87, 0xda, 0x48 }); + + // Double can be represented as float or inte as long as no detail is lost + AssertReadContentFromBinary((double)0x0100, XmlBinaryNodeType.Int16Text, new byte[] { 0x00, 0x01 }); + AssertReadContentFromBinary((double)f, XmlBinaryNodeType.FloatText, floatBytes); + } + + [Fact] + public static void BinaryXml_Array_RoundTrip() + { + int[] ints = new int[] { -1, 0x01020304, 0x11223344, -1 }; + float[] floats = new float[] { 1.2345f, 2.3456f }; + double[] doubles = new double[] { 1.2345678901, 2.3456789012 }; + decimal[] decimals = new[] { + new decimal(0x20212223, 0x10111213, 0x01020304, true, scale: 0x1b), + new decimal(0x50515253, 0x40414243, 0x31323334, false, scale: 0x1c) + }; + DateTime[] datetimes = new[] { + new DateTime(2022, 8, 26, 12, 34, 56, DateTimeKind.Utc), + new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local) + }; + TimeSpan[] timespans = new[] { TimeSpan.FromTicks(0x0102030405060708), TimeSpan.FromTicks(0x1011121314151617) }; + // Write more than 4 kb in a single call to ensure we hit path for reading (and writing happens on 512b) large arrays + long[] longs = Enumerable.Range(0x01020304, 513).Select(i => (long)i | (long)(~i << 32)).ToArray(); + Guid[] guids = new[] { + new Guid(new ReadOnlySpan(new byte[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 })), + new Guid(new ReadOnlySpan(new byte[] {10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160 })) + }; + + using var ms = new MemoryStream(); + using var writer = XmlDictionaryWriter.CreateBinaryWriter(ms); + writer.WriteStartElement("root"); + writer.WriteArray(null, "ints", null, ints, 1, 2); + writer.WriteArray(null, "floats", null, floats, 0, floats.Length); + writer.WriteArray(null, "doubles", null, doubles, 0, doubles.Length); + writer.WriteArray(null, "decimals", null, decimals, 0, decimals.Length); + writer.WriteArray(null, "datetimes", null, datetimes, 0, datetimes.Length); + writer.WriteArray(null, "timespans", null, timespans, 0, timespans.Length); + writer.WriteArray(null, "longs", null, longs, 0, longs.Length); + writer.WriteArray(null, "guids", null, guids, 0, guids.Length); + writer.WriteEndElement(); + writer.WriteEndDocument(); + writer.Flush(); + ms.Seek(0, SeekOrigin.Begin); + + int[] actualInts = new int[] { -1, -1, -1, -1 }; + + using var reader = XmlDictionaryReader.CreateBinaryReader(ms, XmlDictionaryReaderQuotas.Max); + reader.ReadStartElement("root"); + int intsRead = reader.ReadArray("ints", string.Empty, actualInts, 1, 3); + float[] actualFloats = reader.ReadSingleArray("floats", string.Empty); + double[] actualDoubles = reader.ReadDoubleArray("doubles", string.Empty); + decimal[] actualDecimals = reader.ReadDecimalArray("decimals", string.Empty); + DateTime[] actualDateTimes = reader.ReadDateTimeArray("datetimes", string.Empty); + TimeSpan[] actualTimeSpans = reader.ReadTimeSpanArray("timespans", string.Empty); + long[] actualLongs = reader.ReadInt64Array("longs", string.Empty); + Guid[] actualGuids = reader.ReadGuidArray("guids", string.Empty); + reader.ReadEndElement(); + + Assert.Equal(XmlNodeType.None, reader.NodeType); // Should be at end + + Assert.Equal(2, intsRead); + AssertExtensions.SequenceEqual(ints, actualInts); + AssertExtensions.SequenceEqual(actualLongs, longs); + AssertExtensions.SequenceEqual(actualFloats, floats); + AssertExtensions.SequenceEqual(actualDoubles, doubles); + AssertExtensions.SequenceEqual(actualDecimals, decimals); + AssertExtensions.SequenceEqual(actualDateTimes, datetimes); + AssertExtensions.SequenceEqual(actualTimeSpans, timespans); + AssertExtensions.SequenceEqual(actualGuids, guids); + } + + private static void AssertReadContentFromBinary(T expected, XmlBinaryNodeType nodeType, ReadOnlySpan bytes) + { + ReadOnlySpan documentStart = new byte[] { 0x40, 0x1, 0x61 }; // start node "a" + MemoryStream ms = new MemoryStream(documentStart.Length + 1 + bytes.Length); + ms.Write(documentStart); + ms.WriteByte((byte)(nodeType | XmlBinaryNodeType.EndElement)); // With EndElement + ms.Write(bytes); + ms.Seek(0, SeekOrigin.Begin); + XmlDictionaryReader reader = XmlDictionaryReader.CreateBinaryReader(ms, XmlDictionaryReaderQuotas.Max); + reader.ReadStartElement("a"); + T result = (T)reader.ReadContentAs(typeof(T), null); + reader.ReadEndElement(); + + Assert.True(ms.Position == ms.Length, "whole buffer should have been consumed"); + Assert.True(XmlNodeType.None == reader.NodeType, "XmlDictionaryReader should be at end of document"); + Assert.Equal(expected, result); + } + private static Stream GenerateStreamFromString(string s) { var stream = new MemoryStream(); diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryWriterTest.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryWriterTest.cs index 719a06d6e48cf9..3ad4d32400e371 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryWriterTest.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryWriterTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Buffers.Binary; using System.Collections.Generic; using System.IO; using System.Linq; @@ -320,6 +321,179 @@ public static void FragmentTest() Assert.False(FragmentHelper.CanFragment(writer)); } + [Fact] + public static void BinaryWriter_PrimitiveTypes() + { + using MemoryStream ms = new(); + using XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter(ms); + writer.WriteStartElement("root"); + + AssertBytesWritten(x => x.WriteValue((byte)0x78), XmlBinaryNodeType.Int8Text, new byte[] { 0x78 }); + AssertBytesWritten(x => x.WriteValue((short)0x1234), XmlBinaryNodeType.Int16Text, new byte[] { 0x34, 0x12 }); + AssertBytesWritten(x => x.WriteValue(unchecked((short)0xf234)), XmlBinaryNodeType.Int16Text, new byte[] { 0x34, 0xf2 }); + AssertBytesWritten(x => x.WriteValue((int)0x12345678), XmlBinaryNodeType.Int32Text, new byte[] { 0x78, 0x56, 0x34, 0x12 }); + AssertBytesWritten(x => x.WriteValue((long)0x0102030412345678), XmlBinaryNodeType.Int64Text, new byte[] { 0x78, 0x56, 0x34, 0x12, 04, 03, 02, 01 }); + + // Integer values should be represented using smalles possible type + AssertBytesWritten(x => x.WriteValue((long)0), XmlBinaryNodeType.ZeroText, Span.Empty); + AssertBytesWritten(x => x.WriteValue((long)1), XmlBinaryNodeType.OneText, Span.Empty); + AssertBytesWritten(x => x.WriteValue((int)0x00000078), XmlBinaryNodeType.Int8Text, new byte[] { 0x78 }); + AssertBytesWritten(x => x.WriteValue(unchecked((int)0xfffffff0)), XmlBinaryNodeType.Int8Text, new byte[] { 0xf0 }); + AssertBytesWritten(x => x.WriteValue((int)0x00001234), XmlBinaryNodeType.Int16Text, new byte[] { 0x34, 0x12 }); + AssertBytesWritten(x => x.WriteValue(unchecked((int)0xfffff234)), XmlBinaryNodeType.Int16Text, new byte[] { 0x34, 0xf2 }); + AssertBytesWritten(x => x.WriteValue((long)0x12345678), XmlBinaryNodeType.Int32Text, new byte[] { 0x78, 0x56, 0x34, 0x12 }); + AssertBytesWritten(x => x.WriteValue(unchecked((long)0xfffffffff2345678)), XmlBinaryNodeType.Int32Text, new byte[] { 0x78, 0x56, 0x34, 0xf2 }); + + float f = 1.23456788f; + ReadOnlySpan floatBytes = new byte[] { 0x52, 0x06, 0x9e, 0x3f }; + double d = 1.0 / 3.0; + ReadOnlySpan doubleBytes = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xd5, 0x3f }; + Guid guid = new Guid(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }); + DateTime datetime = new DateTime(2022, 8, 26, 12, 34, 56, DateTimeKind.Utc); + Span datetimeBytes = stackalloc byte[8]; + BinaryPrimitives.WriteInt64LittleEndian(datetimeBytes, datetime.ToBinary()); + + AssertBytesWritten(x => x.WriteValue(f), XmlBinaryNodeType.FloatText, floatBytes); + AssertBytesWritten(x => x.WriteValue(new decimal(0x20212223, 0x10111213, 0x01020304, true, scale: 0x1b)), XmlBinaryNodeType.DecimalText, + new byte[] { 0x0, 0x0, 0x1b, 0x80, 0x4, 0x3, 0x2, 0x1, 0x23, 0x22, 0x21, 0x20, 0x13, 0x12, 0x11, 0x10 }); + AssertBytesWritten(x => x.WriteValue(guid), XmlBinaryNodeType.GuidText, guid.ToByteArray()); + AssertBytesWritten(x => x.WriteValue(new TimeSpan(0x0807060504030201)), XmlBinaryNodeType.TimeSpanText, new byte[] { 01, 02, 03, 04, 05, 06, 07, 08 }); + AssertBytesWritten(x => x.WriteValue(datetime), XmlBinaryNodeType.DateTimeText, datetimeBytes); + + // Double can be represented as float or int as long as no detail is lost + AssertBytesWritten(x => x.WriteValue((double)f), XmlBinaryNodeType.FloatText, floatBytes); + AssertBytesWritten(x => x.WriteValue((double)0x0100), XmlBinaryNodeType.Int16Text, new byte[] { 0x00, 0x01 }); + AssertBytesWritten(x => x.WriteValue(d), XmlBinaryNodeType.DoubleText, doubleBytes); + + + void AssertBytesWritten(Action action, XmlBinaryNodeType nodeType, ReadOnlySpan expected) + { + writer.WriteStartElement("a"); + + // Reset stream so we only compare the actual value written (including end element) + writer.Flush(); + ms.Position = 0; + ms.SetLength(0); + + action(writer); + + writer.Flush(); + ms.TryGetBuffer(out ArraySegment segement); + Assert.Equal(nodeType, (XmlBinaryNodeType)segement[0]); + AssertExtensions.SequenceEqual(expected, segement.AsSpan(1)); + writer.WriteEndElement(); + } + } + + + [Fact] + public static void BinaryWriter_Arrays() + { + using var ms = new MemoryStream(); + using var writer = XmlDictionaryWriter.CreateBinaryWriter(ms); + writer.WriteStartElement("root"); + int offset = 1; + int count = 2; + + bool[] bools = new bool[] { false, true, false, true }; + AssertBytesWritten(x => x.WriteArray(null, "a", null, bools, offset, count), XmlBinaryNodeType.BoolTextWithEndElement, + count, new byte[] { 1, 0 }); + + short[] shorts = new short[] { -1, 0x0102, 0x1122, -1 }; + AssertBytesWritten(x => x.WriteArray(null, "a", null, shorts, offset, count), XmlBinaryNodeType.Int16TextWithEndElement, + count, new byte[] { 2, 1, 0x22, 0x11 }); + + int[] ints = new int[] { -1, 0x01020304, 0x11223344, -1 }; + AssertBytesWritten(x => x.WriteArray(null, "a", null, ints, offset, count), XmlBinaryNodeType.Int32TextWithEndElement, + count, new byte[] { 4, 3, 2, 1, 0x44, 0x33, 0x22, 0x11 }); + + long[] longs = new long[] { -1, 0x0102030405060708, 0x1122334455667788, -1 }; + AssertBytesWritten(x => x.WriteArray(null, "a", null, longs, offset, count), XmlBinaryNodeType.Int64TextWithEndElement, + count, new byte[] { 8, 7, 6, 5, 4, 3, 2, 1, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 }); + + float[] floats = new float[] { -1.0f, 1.23456788f, 1.23456788f, -1.0f }; + AssertBytesWritten(x => x.WriteArray(null, "a", null, floats, offset, count), XmlBinaryNodeType.FloatTextWithEndElement, + count, new byte[] { 0x52, 0x06, 0x9e, 0x3f, 0x52, 0x06, 0x9e, 0x3f }); + + double[] doubles = new double[] { -1.0, 1.0 / 3.0, 1.0 / 3.0, -1.0 }; + AssertBytesWritten(x => x.WriteArray(null, "a", null, doubles, offset, count), XmlBinaryNodeType.DoubleTextWithEndElement, + count, new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xd5, 0x3f, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xd5, 0x3f }); + + decimal[] decimals = new[] { + new decimal(0x20212223, 0x10111213, 0x01020304, true, scale: 0x1b), + new decimal(0x50515253, 0x40414243, 0x31323334, false, scale: 0x1c) + }; + AssertBytesWritten(x => x.WriteArray(null, "a", null, decimals, 0, decimals.Length), XmlBinaryNodeType.DecimalTextWithEndElement, + decimals.Length, new byte[] { 0x0, 0x0, 0x1b, 0x80, 0x4, 0x3, 0x2, 0x1, + 0x23, 0x22, 0x21, 0x20, 0x13, 0x12, 0x11, 0x10, + 0x0, 0x0, 0x1c, 0x00, 0x34, 0x33, 0x32, 0x31, + 0x53, 0x52, 0x51, 0x50, 0x43, 0x42, 0x41, 0x40 }); + + DateTime[] datetimes = new[] { + new DateTime(2022, 8, 26, 12, 34, 56, DateTimeKind.Utc), + new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local) + }; + Span datetimeBytes = stackalloc byte[8 * datetimes.Length]; + for (int i = 0; i < datetimes.Length; i++) + { + BinaryPrimitives.WriteInt64LittleEndian(datetimeBytes.Slice(8 * i), datetimes[i].ToBinary()); + } + AssertBytesWritten(x => x.WriteArray(null, "a", null, datetimes, 0, datetimes.Length), XmlBinaryNodeType.DateTimeTextWithEndElement, + datetimes.Length, datetimeBytes); + + TimeSpan[] timespans = new[] { new TimeSpan(0x0807060504030201), new TimeSpan(0x1817161514131211) }; + AssertBytesWritten(x => x.WriteArray(null, "a", null, timespans, 0, timespans.Length), XmlBinaryNodeType.TimeSpanTextWithEndElement, + timespans.Length, new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18 }); + + Guid[] guids = new Guid[] + { + new Guid(new ReadOnlySpan(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 })), + new Guid(new ReadOnlySpan(new byte[] { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160 })) + }; + AssertBytesWritten(x => x.WriteArray(null, "a", null, guids, 0, guids.Length), XmlBinaryNodeType.GuidTextWithEndElement, + guids.Length, new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160 }); + + // Write more than 512 bytes in a single call to trigger different writing logic in XmlStreamNodeWriter.WriteBytes + long[] many_longs = Enumerable.Range(0x01020304, 127).Select(i => (long)i | (long)(~i << 32)).ToArray(); + Span many_longBytes = stackalloc byte[8 * many_longs.Length]; + for (int i = 0; i < many_longs.Length; i++) + { + BinaryPrimitives.WriteInt64LittleEndian(many_longBytes.Slice(8 * i), many_longs[i]); + } + AssertBytesWritten(x => x.WriteArray(null, "a", null, many_longs, 0, many_longs.Length), XmlBinaryNodeType.Int64TextWithEndElement, + many_longs.Length, many_longBytes); + + void AssertBytesWritten(Action action, XmlBinaryNodeType nodeType, int count, ReadOnlySpan expected) + { + // Reset stream so we only compare the actual value written (including end element) + writer.Flush(); + ms.Position = 0; + ms.SetLength(0); + + action(writer); + + writer.Flush(); + ms.TryGetBuffer(out ArraySegment segement); + + var actual = segement.AsSpan(); + Assert.Equal(XmlBinaryNodeType.Array, (XmlBinaryNodeType)actual[0]); + Assert.Equal(XmlBinaryNodeType.ShortElement, (XmlBinaryNodeType)actual[1]); + int elementLength = actual[2]; + Assert.InRange(elementLength, 0, 0x8f); // verify count is single byte + Assert.Equal(XmlBinaryNodeType.EndElement, (XmlBinaryNodeType)actual[3 + elementLength]); + + actual = actual.Slice(4 + elementLength); + // nodetype and count + Assert.Equal(nodeType, (XmlBinaryNodeType)actual[0]); + Assert.Equal(checked((sbyte)count), (sbyte)actual[1]); + + AssertExtensions.SequenceEqual(expected, actual.Slice(2)); + } + } + private static bool ReadTest(MemoryStream ms, Encoding encoding, ReaderWriterFactory.ReaderWriterType rwType, byte[] byteArray) { ms.Position = 0; diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index 5de2f8d1c1605d..66aa431bb4861f 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -754,130 +754,130 @@ public static void SetByte(System.Array array, int index, byte value) { } public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Byte result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IAdditionOperators.operator +(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBinaryInteger.LeadingZeroCount(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBinaryInteger.PopCount(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBinaryInteger.RotateLeft(byte value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBinaryInteger.RotateRight(byte value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBinaryInteger.TrailingZeroCount(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBinaryNumber.Log2(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBitwiseOperators.operator &(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBitwiseOperators.operator |(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBitwiseOperators.operator ^(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IBitwiseOperators.operator ~(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IDecrementOperators.operator --(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IDivisionOperators.operator /(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IIncrementOperators.operator ++(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IModulusOperators.operator %(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IMultiplyOperators.operator *(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.Abs(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.Clamp(byte value, byte min, byte max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (byte Quotient, byte Remainder) INumber.DivRem(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.Max(byte x, byte y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.Min(byte x, byte y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte INumber.Sign(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out byte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out byte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out byte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out byte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IShiftOperators.operator <<(byte value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IShiftOperators.operator >>(byte value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out byte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte ISubtractionOperators.operator -(byte left, byte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IUnaryNegationOperators.operator -(byte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static byte IUnaryPlusOperators.operator +(byte value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -974,130 +974,130 @@ public CannotUnloadAppDomainException(string? message, System.Exception? innerEx string System.IFormattable.ToString(string? format, IFormatProvider? formatProvider) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IAdditionOperators.operator +(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBinaryInteger.LeadingZeroCount(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBinaryInteger.PopCount(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBinaryInteger.RotateLeft(char value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBinaryInteger.RotateRight(char value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBinaryInteger.TrailingZeroCount(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBinaryNumber.Log2(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBitwiseOperators.operator &(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBitwiseOperators.operator |(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBitwiseOperators.operator ^(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IBitwiseOperators.operator ~(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IDecrementOperators.operator --(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IDivisionOperators.operator /(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IIncrementOperators.operator ++(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IModulusOperators.operator %(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IMultiplyOperators.operator *(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.Abs(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.Clamp(char value, char min, char max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (char Quotient, char Remainder) INumber.DivRem(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.Max(char x, char y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.Min(char x, char y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char INumber.Sign(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out char result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out char result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out char result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out char result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IShiftOperators.operator <<(char value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures, System.Runtime.CompilerServices.SpecialNameAttribute] + [System.Runtime.Versioning.RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview"), System.Runtime.CompilerServices.SpecialNameAttribute] static char IShiftOperators.operator >>(char value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out char result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char ISubtractionOperators.operator -(char left, char right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IUnaryNegationOperators.operator -(char value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static char IUnaryPlusOperators.operator +(char value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -1656,33 +1656,33 @@ public static partial class Convert public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateOnly IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateOnly IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(System.DateOnly left, System.DateOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(System.DateOnly left, System.DateOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(System.DateOnly left, System.DateOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(System.DateOnly left, System.DateOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(System.DateOnly left, System.DateOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(System.DateOnly left, System.DateOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateOnly IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.DateOnly result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateOnly ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.DateOnly result) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -1820,44 +1820,44 @@ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Ser public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTime IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTime IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTime IAdditionOperators.operator +(System.DateTime left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(System.DateTime left, System.DateTime right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(System.DateTime left, System.DateTime right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(System.DateTime left, System.DateTime right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(System.DateTime left, System.DateTime right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(System.DateTime left, System.DateTime right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(System.DateTime left, System.DateTime right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTime IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.DateTime result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTime ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.DateTime result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTime ISubtractionOperators.operator -(System.DateTime left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan ISubtractionOperators.operator -(System.DateTime left, System.DateTime right) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -1972,44 +1972,44 @@ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Ser public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTimeOffset IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTimeOffset IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTimeOffset IAdditionOperators.operator +(System.DateTimeOffset left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTimeOffset IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.DateTimeOffset result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTimeOffset ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.DateTimeOffset result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.DateTimeOffset ISubtractionOperators.operator -(System.DateTimeOffset left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan ISubtractionOperators.operator -(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -2195,103 +2195,103 @@ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Ser public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Decimal result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IAdditionOperators.operator +(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IDecrementOperators.operator --(decimal value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IDivisionOperators.operator /(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IIncrementOperators.operator ++(decimal value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IModulusOperators.operator %(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IMultiplyOperators.operator *(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.Abs(decimal value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.Clamp(decimal value, decimal min, decimal max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (decimal Quotient, decimal Remainder) INumber.DivRem(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.Max(decimal x, decimal y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.Min(decimal x, decimal y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal INumber.Sign(decimal value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out decimal result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out decimal result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out decimal result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out decimal result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal ISignedNumber.NegativeOne { get; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out decimal result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal ISubtractionOperators.operator -(decimal left, decimal right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IUnaryNegationOperators.operator -(decimal value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static decimal IUnaryPlusOperators.operator +(decimal value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -2407,209 +2407,226 @@ public DivideByZeroException(string? message, System.Exception? innerException) public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Double result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.E { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Epsilon { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.NaN { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.NegativeInfinity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.NegativeZero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Pi { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.PositiveInfinity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Tau { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IAdditionOperators.operator +(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(double value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IBinaryNumber.Log2(double value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IBitwiseOperators.operator &(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IBitwiseOperators.operator |(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IBitwiseOperators.operator ^(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IBitwiseOperators.operator ~(double value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IDecrementOperators.operator --(double value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IDivisionOperators.operator /(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Acos(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Acosh(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Asin(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Asinh(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Atan(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Atan2(double y, double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Atanh(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.BitIncrement(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.BitDecrement(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Cbrt(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Ceiling(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.CopySign(double x, double y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Cos(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Cosh(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Exp(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Floor(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.FusedMultiplyAdd(double left, double right, double addend) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.IEEERemainder(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static TInteger IFloatingPoint.ILogB(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Log(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Log(double x, double newBase) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Log2(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Log10(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.MaxMagnitude(double x, double y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.MinMagnitude(double x, double y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Pow(double x, double y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Round(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Round(double x, TInteger digits) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Round(double x, System.MidpointRounding mode) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Round(double x, TInteger digits, System.MidpointRounding mode) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.ScaleB(double x, TInteger n) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Sin(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Sinh(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Sqrt(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Tan(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Tanh(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IFloatingPoint.Truncate(double x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsFinite(double d) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsInfinity(double d) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNaN(double d) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNegative(double d) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNegativeInfinity(double d) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNormal(double d) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsPositiveInfinity(double d) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsSubnormal(double d) { throw null; } + + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IIncrementOperators.operator ++(double value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IModulusOperators.operator %(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IMultiplyOperators.operator *(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.Abs(double value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.Clamp(double value, double min, double max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (double Quotient, double Remainder) INumber.DivRem(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.Max(double x, double y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.Min(double x, double y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double INumber.Sign(double value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out double result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out double result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out double result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out double result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double ISignedNumber.NegativeOne { get; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out double result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double ISubtractionOperators.operator -(double left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IUnaryNegationOperators.operator -(double value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IUnaryPlusOperators.operator +(double value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -2844,10 +2861,12 @@ protected FieldAccessException(System.Runtime.Serialization.SerializationInfo in public FieldAccessException(string? message) { } public FieldAccessException(string? message, System.Exception? inner) { } } +#if !BUILDING_CORELIB_REFERENCE public partial class FileStyleUriParser : System.UriParser { public FileStyleUriParser() { } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Enum, Inherited=false)] public partial class FlagsAttribute : System.Attribute { @@ -2873,10 +2892,12 @@ protected FormattableString() { } public override string ToString() { throw null; } public abstract string ToString(System.IFormatProvider? formatProvider); } +#if !BUILDING_CORELIB_REFERENCE public partial class FtpStyleUriParser : System.UriParser { public FtpStyleUriParser() { } } +#endif public delegate TResult Func(); public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9); public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10); @@ -2979,6 +3000,7 @@ public enum GCNotificationStatus Timeout = 3, NotApplicable = 4, } +#if !BUILDING_CORELIB_REFERENCE public partial class GenericUriParser : System.UriParser { public GenericUriParser(System.GenericUriParserOptions options) { } @@ -3003,6 +3025,7 @@ public partial class GopherStyleUriParser : System.UriParser { public GopherStyleUriParser() { } } +#endif public readonly partial struct Guid : System.IComparable, System.IComparable, System.IEquatable, System.ISpanFormattable #if FEATURE_GENERIC_MATH #pragma warning disable SA1001 @@ -3045,28 +3068,28 @@ public GopherStyleUriParser() { } bool System.ISpanFormattable.TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format, System.IFormatProvider? provider) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(System.Guid left, System.Guid right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(System.Guid left, System.Guid right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(System.Guid left, System.Guid right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(System.Guid left, System.Guid right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(System.Guid left, System.Guid right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(System.Guid left, System.Guid right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Guid IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Guid result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Guid ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Guid result) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -3124,209 +3147,226 @@ public GopherStyleUriParser() { } public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Half result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.E { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Epsilon { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.NaN { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.NegativeInfinity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.NegativeZero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Pi { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.PositiveInfinity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Tau { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IAdditionOperators.operator +(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(System.Half value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IBinaryNumber.Log2(System.Half value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IBitwiseOperators.operator &(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IBitwiseOperators.operator |(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IBitwiseOperators.operator ^(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IBitwiseOperators.operator ~(System.Half value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IDecrementOperators.operator --(System.Half value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IDivisionOperators.operator /(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Acos(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Acosh(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Asin(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Asinh(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Atan(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Atan2(System.Half y, System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Atanh(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.BitIncrement(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.BitDecrement(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Cbrt(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Ceiling(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.CopySign(System.Half x, System.Half y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Cos(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Cosh(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Exp(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Floor(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.FusedMultiplyAdd(System.Half left, System.Half right, System.Half addend) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.IEEERemainder(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static TInteger IFloatingPoint.ILogB(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Log(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Log(System.Half x, System.Half newBase) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Log2(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Log10(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.MaxMagnitude(System.Half x, System.Half y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.MinMagnitude(System.Half x, System.Half y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Pow(System.Half x, System.Half y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Round(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Round(System.Half x, TInteger digits) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Round(System.Half x, System.MidpointRounding mode) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Round(System.Half x, TInteger digits, System.MidpointRounding mode) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.ScaleB(System.Half x, TInteger n) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Sin(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Sinh(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Sqrt(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Tan(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Tanh(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IFloatingPoint.Truncate(System.Half x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsFinite(System.Half x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsInfinity(System.Half x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNaN(System.Half x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNegative(System.Half x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNegativeInfinity(System.Half x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNormal(System.Half x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsPositiveInfinity(System.Half x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsSubnormal(System.Half x) { throw null; } + + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IIncrementOperators.operator ++(System.Half value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IModulusOperators.operator %(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IMultiplyOperators.operator *(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.Abs(System.Half value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.Clamp(System.Half value, System.Half min, System.Half max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (System.Half Quotient, System.Half Remainder) INumber.DivRem(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.Max(System.Half x, System.Half y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.Min(System.Half x, System.Half y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half INumber.Sign(System.Half value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out System.Half result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Half result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half ISignedNumber.NegativeOne { get; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Half result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half ISubtractionOperators.operator -(System.Half left, System.Half right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IUnaryNegationOperators.operator -(System.Half value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.Half IUnaryPlusOperators.operator +(System.Half value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -3352,29 +3392,31 @@ public void AddBytes(System.ReadOnlySpan value) { } public override int GetHashCode() { throw null; } public int ToHashCode() { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial class HttpStyleUriParser : System.UriParser { public HttpStyleUriParser() { } } +#endif #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IAdditionOperators where TSelf : System.IAdditionOperators { static abstract TResult operator +(TSelf left, TOther right); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IAdditiveIdentity where TSelf : System.IAdditiveIdentity { static abstract TResult AdditiveIdentity { get; } } -[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] +[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IBinaryFloatingPoint : System.IBinaryNumber, System.IFloatingPoint where TSelf : IBinaryFloatingPoint { } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IBinaryInteger : System.IBinaryNumber, System.IShiftOperators where TSelf : IBinaryInteger { @@ -3384,14 +3426,14 @@ public partial interface IBinaryInteger : System.IBinaryNumber, Sy static abstract TSelf RotateRight(TSelf value, int rotateAmount); static abstract TSelf TrailingZeroCount(TSelf value); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IBinaryNumber : System.IBitwiseOperators, System.INumber where TSelf : IBinaryNumber { static abstract bool IsPow2(TSelf value); static abstract TSelf Log2(TSelf value); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IBitwiseOperators where TSelf : System.IBitwiseOperators { @@ -3400,7 +3442,7 @@ public partial interface IBitwiseOperators static abstract TResult operator ^(TSelf left, TOther right); static abstract TResult operator ~(TSelf value); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IComparisonOperators : System.IComparable, System.IComparable, System.IEqualityOperators where TSelf : IComparisonOperators { @@ -3409,26 +3451,26 @@ public partial interface IComparisonOperators : System.IComparabl static abstract bool operator >(TSelf left, TOther right); static abstract bool operator >=(TSelf left, TOther right); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IDecrementOperators where TSelf : System.IDecrementOperators { static abstract TSelf operator --(TSelf value); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IDivisionOperators where TSelf : System.IDivisionOperators { static abstract TResult operator /(TSelf left, TOther right); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IEqualityOperators : IEquatable where TSelf : System.IEqualityOperators { static abstract bool operator ==(TSelf left, TOther right); static abstract bool operator !=(TSelf left, TOther right); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IFloatingPoint : System.ISignedNumber where TSelf : System.IFloatingPoint { @@ -3486,38 +3528,38 @@ public partial interface IFloatingPoint : System.ISignedNumber static abstract TSelf Tanh(TSelf x); static abstract TSelf Truncate(TSelf x); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IIncrementOperators where TSelf : System.IIncrementOperators { static abstract TSelf operator ++(TSelf value); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IMinMaxValue where TSelf : System.IMinMaxValue { static abstract TSelf MinValue { get; } static abstract TSelf MaxValue { get; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IModulusOperators where TSelf : System.IModulusOperators { static abstract TResult operator %(TSelf left, TOther right); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IMultiplicativeIdentity where TSelf : System.IMultiplicativeIdentity { static abstract TResult MultiplicativeIdentity { get; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IMultiplyOperators where TSelf : System.IMultiplyOperators { static abstract TResult operator *(TSelf left, TOther right); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface INumber : System.IAdditionOperators, System.IAdditiveIdentity, System.IComparable, System.IComparable, System.IComparisonOperators, System.IDecrementOperators, System.IDivisionOperators, System.IEquatable, System.IEqualityOperators, System.IFormattable, System.IIncrementOperators, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.IParseable, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators where TSelf : System.INumber { @@ -3538,52 +3580,52 @@ public partial interface INumber : System.IAdditionOperators s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IParseable where TSelf : System.IParseable { static abstract TSelf Parse(string s, System.IFormatProvider? provider); static abstract bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out TSelf result); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IShiftOperators where TSelf : System.IShiftOperators { static abstract TResult operator <<(TSelf value, int shiftAmount); static abstract TResult operator >>(TSelf value, int shiftAmount); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface ISignedNumber : System.INumber, System.IUnaryNegationOperators where TSelf : System.ISignedNumber { static abstract TSelf NegativeOne { get; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface ISpanParseable : System.IParseable where TSelf : System.ISpanParseable { static abstract TSelf Parse(System.ReadOnlySpan s, System.IFormatProvider? provider); static abstract bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out TSelf result); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface ISubtractionOperators where TSelf : System.ISubtractionOperators { static abstract TResult operator -(TSelf left, TOther right); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IUnaryNegationOperators where TSelf : System.IUnaryNegationOperators { static abstract TResult operator -(TSelf value); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IUnaryPlusOperators where TSelf : System.IUnaryPlusOperators { static abstract TResult operator +(TSelf value); } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IUnsignedNumber : System.INumber where TSelf : IUnsignedNumber { @@ -3737,133 +3779,133 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int16 result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IAdditionOperators.operator +(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBinaryInteger.LeadingZeroCount(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBinaryInteger.PopCount(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBinaryInteger.RotateLeft(short value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBinaryInteger.RotateRight(short value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBinaryInteger.TrailingZeroCount(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBinaryNumber.Log2(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBitwiseOperators.operator &(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBitwiseOperators.operator |(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBitwiseOperators.operator ^(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IBitwiseOperators.operator ~(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IDecrementOperators.operator --(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IDivisionOperators.operator /(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IIncrementOperators.operator ++(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IModulusOperators.operator %(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IMultiplyOperators.operator *(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.Abs(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.Clamp(short value, short min, short max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (short Quotient, short Remainder) INumber.DivRem(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.Max(short x, short y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.Min(short x, short y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short INumber.Sign(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out short result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out short result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out short result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out short result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IShiftOperators.operator <<(short value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IShiftOperators.operator >>(short value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short ISignedNumber.NegativeOne { get; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out short result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short ISubtractionOperators.operator -(short left, short right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IUnaryNegationOperators.operator -(short value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static short IUnaryPlusOperators.operator +(short value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -3916,133 +3958,133 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int32 result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IAdditionOperators.operator +(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBinaryInteger.LeadingZeroCount(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBinaryInteger.PopCount(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBinaryInteger.RotateLeft(int value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBinaryInteger.RotateRight(int value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBinaryInteger.TrailingZeroCount(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBinaryNumber.Log2(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBitwiseOperators.operator &(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBitwiseOperators.operator |(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBitwiseOperators.operator ^(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IBitwiseOperators.operator ~(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IDecrementOperators.operator --(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IDivisionOperators.operator /(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IIncrementOperators.operator ++(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IModulusOperators.operator %(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IMultiplyOperators.operator *(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.Abs(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.Clamp(int value, int min, int max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (int Quotient, int Remainder) INumber.DivRem(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.Max(int x, int y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.Min(int x, int y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int INumber.Sign(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out int result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out int result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out int result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out int result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IShiftOperators.operator <<(int value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IShiftOperators.operator >>(int value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int ISignedNumber.NegativeOne { get; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out int result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int ISubtractionOperators.operator -(int left, int right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IUnaryNegationOperators.operator -(int value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static int IUnaryPlusOperators.operator +(int value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -4095,133 +4137,133 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int64 result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IAdditionOperators.operator +(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBinaryInteger.LeadingZeroCount(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBinaryInteger.PopCount(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBinaryInteger.RotateLeft(long value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBinaryInteger.RotateRight(long value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBinaryInteger.TrailingZeroCount(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBinaryNumber.Log2(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBitwiseOperators.operator &(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBitwiseOperators.operator |(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBitwiseOperators.operator ^(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IBitwiseOperators.operator ~(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IDecrementOperators.operator --(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IDivisionOperators.operator /(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IIncrementOperators.operator ++(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IModulusOperators.operator %(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IMultiplyOperators.operator *(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.Abs(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.Clamp(long value, long min, long max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (long Quotient, long Remainder) INumber.DivRem(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.Max(long x, long y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.Min(long x, long y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long INumber.Sign(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out long result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out long result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out long result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out long result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IShiftOperators.operator <<(long value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IShiftOperators.operator >>(long value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long ISignedNumber.NegativeOne { get; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out long result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long ISubtractionOperators.operator -(long left, long right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IUnaryNegationOperators.operator -(long value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static long IUnaryPlusOperators.operator +(long value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -4283,133 +4325,133 @@ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Ser public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.IntPtr result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IAdditionOperators.operator +(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBinaryInteger.LeadingZeroCount(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBinaryInteger.PopCount(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBinaryInteger.RotateLeft(nint value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBinaryInteger.RotateRight(nint value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBinaryInteger.TrailingZeroCount(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBinaryNumber.Log2(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBitwiseOperators.operator &(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBitwiseOperators.operator |(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBitwiseOperators.operator ^(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IBitwiseOperators.operator ~(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IDecrementOperators.operator --(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IDivisionOperators.operator /(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IIncrementOperators.operator ++(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IModulusOperators.operator %(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IMultiplyOperators.operator *(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.Abs(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.Clamp(nint value, nint min, nint max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (nint Quotient, nint Remainder) INumber.DivRem(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.Max(nint x, nint y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.Min(nint x, nint y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint INumber.Sign(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out nint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out nint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IShiftOperators.operator <<(nint value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IShiftOperators.operator >>(nint value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint ISignedNumber.NegativeOne { get; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out nint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint ISubtractionOperators.operator -(nint left, nint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IUnaryNegationOperators.operator -(nint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nint IUnaryPlusOperators.operator +(nint value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -4482,10 +4524,12 @@ public Lazy(TMetadata metadata, bool isThreadSafe) { } public Lazy(TMetadata metadata, System.Threading.LazyThreadSafetyMode mode) { } public TMetadata Metadata { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE public partial class LdapStyleUriParser : System.UriParser { public LdapStyleUriParser() { } } +#endif public enum LoaderOptimization { NotSpecified = 0, @@ -4844,6 +4888,7 @@ public MulticastNotSupportedException() { } public MulticastNotSupportedException(string? message) { } public MulticastNotSupportedException(string? message, System.Exception? inner) { } } +#if !BUILDING_CORELIB_REFERENCE public partial class NetPipeStyleUriParser : System.UriParser { public NetPipeStyleUriParser() { } @@ -4856,6 +4901,7 @@ public partial class NewsStyleUriParser : System.UriParser { public NewsStyleUriParser() { } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)] public sealed partial class NonSerializedAttribute : System.Attribute { @@ -5248,133 +5294,133 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.SByte result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IAdditionOperators.operator +(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBinaryInteger.LeadingZeroCount(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBinaryInteger.PopCount(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBinaryInteger.RotateLeft(sbyte value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBinaryInteger.RotateRight(sbyte value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBinaryInteger.TrailingZeroCount(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBinaryNumber.Log2(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBitwiseOperators.operator &(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBitwiseOperators.operator |(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBitwiseOperators.operator ^(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IBitwiseOperators.operator ~(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IDecrementOperators.operator --(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IDivisionOperators.operator /(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IIncrementOperators.operator ++(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IModulusOperators.operator %(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IMultiplyOperators.operator *(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.Abs(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.Clamp(sbyte value, sbyte min, sbyte max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (sbyte Quotient, sbyte Remainder) INumber.DivRem(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.Max(sbyte x, sbyte y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.Min(sbyte x, sbyte y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte INumber.Sign(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out sbyte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out sbyte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out sbyte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out sbyte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IShiftOperators.operator <<(sbyte value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IShiftOperators.operator >>(sbyte value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte ISignedNumber.NegativeOne { get; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out sbyte result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte ISubtractionOperators.operator -(sbyte left, sbyte right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IUnaryNegationOperators.operator -(sbyte value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static sbyte IUnaryPlusOperators.operator +(sbyte value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -5449,209 +5495,226 @@ public SerializableAttribute() { } public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Single result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.E { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Epsilon { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.NaN { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.NegativeInfinity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.NegativeZero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Pi { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.PositiveInfinity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Tau { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IAdditionOperators.operator +(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(float value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IBinaryNumber.Log2(float value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IBitwiseOperators.operator &(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IBitwiseOperators.operator |(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IBitwiseOperators.operator ^(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IBitwiseOperators.operator ~(float value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IDecrementOperators.operator --(float value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IDivisionOperators.operator /(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Acos(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Acosh(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Asin(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Asinh(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Atan(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Atan2(float y, float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Atanh(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.BitIncrement(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.BitDecrement(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Cbrt(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Ceiling(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.CopySign(float x, float y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Cos(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Cosh(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Exp(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Floor(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.FusedMultiplyAdd(float left, float right, float addend) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.IEEERemainder(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static TInteger IFloatingPoint.ILogB(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Log(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Log(float x, float newBase) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Log2(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Log10(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.MaxMagnitude(float x, float y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.MinMagnitude(float x, float y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Pow(float x, float y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Round(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Round(float x, TInteger digits) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Round(float x, System.MidpointRounding mode) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Round(float x, TInteger digits, System.MidpointRounding mode) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.ScaleB(float x, TInteger n) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Sin(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Sinh(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Sqrt(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Tan(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Tanh(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IFloatingPoint.Truncate(float x) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsFinite(float x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsInfinity(float x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNaN(float x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNegative(float x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNegativeInfinity(float x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsNormal(float x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsPositiveInfinity(float x) { throw null; } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static bool IFloatingPoint.IsSubnormal(float x) { throw null; } + + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IIncrementOperators.operator ++(float value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IModulusOperators.operator %(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IMultiplyOperators.operator *(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.Abs(float value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.Clamp(float value, float min, float max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (float Quotient, float Remainder) INumber.DivRem(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.Max(float x, float y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.Min(float x, float y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float INumber.Sign(float value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out float result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out float result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out float result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out float result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float ISignedNumber.NegativeOne { get; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out float result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float ISubtractionOperators.operator -(float left, float right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IUnaryNegationOperators.operator -(float value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static float IUnaryPlusOperators.operator +(float value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -6036,32 +6099,37 @@ public ThreadStaticAttribute() { } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(System.TimeOnly left, System.TimeOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(System.TimeOnly left, System.TimeOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(System.TimeOnly left, System.TimeOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(System.TimeOnly left, System.TimeOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(System.TimeOnly left, System.TimeOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(System.TimeOnly left, System.TimeOnly right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeOnly IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.TimeOnly result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeOnly ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.TimeOnly result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan ISubtractionOperators.operator -(System.TimeOnly left, System.TimeOnly right) { throw null; } + + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static System.TimeOnly IMinMaxValue.MinValue { get { throw null; } } + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static System.TimeOnly IMinMaxValue.MaxValue { get { throw null; } } #endif // FEATURE_GENERIC_MATH } public partial class TimeoutException : System.SystemException @@ -6174,59 +6242,59 @@ public TimeoutException(string? message, System.Exception? innerException) { } public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IAdditionOperators.operator +(System.TimeSpan left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(System.TimeSpan left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(System.TimeSpan left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(System.TimeSpan left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(System.TimeSpan left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IDivisionOperators.operator /(System.TimeSpan left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static double IDivisionOperators.operator /(System.TimeSpan left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(System.TimeSpan left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(System.TimeSpan left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IMultiplyOperators.operator *(System.TimeSpan left, double right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.TimeSpan result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.TimeSpan result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan ISubtractionOperators.operator -(System.TimeSpan left, System.TimeSpan right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IUnaryNegationOperators.operator -(System.TimeSpan value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static System.TimeSpan IUnaryPlusOperators.operator +(System.TimeSpan value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -6961,130 +7029,130 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt16 result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IAdditionOperators.operator +(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBinaryInteger.LeadingZeroCount(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBinaryInteger.PopCount(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBinaryInteger.RotateLeft(ushort value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBinaryInteger.RotateRight(ushort value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBinaryInteger.TrailingZeroCount(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBinaryNumber.Log2(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBitwiseOperators.operator &(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBitwiseOperators.operator |(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBitwiseOperators.operator ^(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IBitwiseOperators.operator ~(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IDecrementOperators.operator --(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IDivisionOperators.operator /(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IIncrementOperators.operator ++(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IModulusOperators.operator %(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IMultiplyOperators.operator *(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.Abs(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.Clamp(ushort value, ushort min, ushort max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (ushort Quotient, ushort Remainder) INumber.DivRem(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.Max(ushort x, ushort y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.Min(ushort x, ushort y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort INumber.Sign(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out ushort result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ushort result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ushort result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out ushort result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IShiftOperators.operator <<(ushort value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IShiftOperators.operator >>(ushort value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out ushort result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort ISubtractionOperators.operator -(ushort left, ushort right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IUnaryNegationOperators.operator -(ushort value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ushort IUnaryPlusOperators.operator +(ushort value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -7138,130 +7206,130 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt32 result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IAdditionOperators.operator +(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBinaryInteger.LeadingZeroCount(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBinaryInteger.PopCount(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBinaryInteger.RotateLeft(uint value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBinaryInteger.RotateRight(uint value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBinaryInteger.TrailingZeroCount(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBinaryNumber.Log2(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBitwiseOperators.operator &(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBitwiseOperators.operator |(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBitwiseOperators.operator ^(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IBitwiseOperators.operator ~(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IDecrementOperators.operator --(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IDivisionOperators.operator /(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IIncrementOperators.operator ++(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IModulusOperators.operator %(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IMultiplyOperators.operator *(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.Abs(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.Clamp(uint value, uint min, uint max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (uint Quotient, uint Remainder) INumber.DivRem(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.Max(uint x, uint y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.Min(uint x, uint y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint INumber.Sign(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out uint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out uint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out uint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out uint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IShiftOperators.operator <<(uint value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IShiftOperators.operator >>(uint value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out uint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint ISubtractionOperators.operator -(uint left, uint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IUnaryNegationOperators.operator -(uint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static uint IUnaryPlusOperators.operator +(uint value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -7315,130 +7383,130 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt64 result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IAdditionOperators.operator +(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBinaryInteger.LeadingZeroCount(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBinaryInteger.PopCount(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBinaryInteger.RotateLeft(ulong value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBinaryInteger.RotateRight(ulong value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBinaryInteger.TrailingZeroCount(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBinaryNumber.Log2(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBitwiseOperators.operator &(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBitwiseOperators.operator |(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBitwiseOperators.operator ^(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IBitwiseOperators.operator ~(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IDecrementOperators.operator --(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IDivisionOperators.operator /(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IIncrementOperators.operator ++(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IModulusOperators.operator %(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IMultiplyOperators.operator *(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.Abs(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.Clamp(ulong value, ulong min, ulong max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (ulong Quotient, ulong Remainder) INumber.DivRem(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.Max(ulong x, ulong y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.Min(ulong x, ulong y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong INumber.Sign(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out ulong result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ulong result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ulong result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out ulong result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IShiftOperators.operator <<(ulong value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IShiftOperators.operator >>(ulong value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out ulong result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong ISubtractionOperators.operator -(ulong left, ulong right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IUnaryNegationOperators.operator -(ulong value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static ulong IUnaryPlusOperators.operator +(ulong value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -7497,129 +7565,129 @@ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Ser public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UIntPtr result) { throw null; } #if FEATURE_GENERIC_MATH - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IMinMaxValue.MinValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IMinMaxValue.MaxValue { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.One { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.Zero { get { throw null; } } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IAdditionOperators.operator +(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBinaryInteger.LeadingZeroCount(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBinaryInteger.PopCount(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBinaryInteger.RotateLeft(nuint value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBinaryInteger.RotateRight(nuint value, int rotateAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBinaryInteger.TrailingZeroCount(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IBinaryNumber.IsPow2(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBinaryNumber.Log2(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBitwiseOperators.operator &(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBitwiseOperators.operator |(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBitwiseOperators.operator ^(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IBitwiseOperators.operator ~(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator <=(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IComparisonOperators.operator >=(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IDecrementOperators.operator --(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IDivisionOperators.operator /(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator ==(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IEqualityOperators.operator !=(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IIncrementOperators.operator ++(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IModulusOperators.operator %(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IMultiplyOperators.operator *(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.Abs(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.Clamp(nuint value, nuint min, nuint max) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.Create(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.CreateSaturating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.CreateTruncating(TOther value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static (nuint Quotient, nuint Remainder) INumber.DivRem(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.Max(nuint x, nuint y) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] - static nuint INumber.Min(nuint x, nuint y) { throw null; }[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] + static nuint INumber.Min(nuint x, nuint y) { throw null; }[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint INumber.Sign(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryCreate(TOther value, out nuint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nuint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nuint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out nuint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IShiftOperators.operator <<(nuint value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeatures] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IShiftOperators.operator >>(nuint value, int shiftAmount) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint ISpanParseable.Parse(System.ReadOnlySpan s, IFormatProvider? provider) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static bool ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out nuint result) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint ISubtractionOperators.operator -(nuint left, nuint right) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IUnaryNegationOperators.operator -(nuint value) { throw null; } - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] static nuint IUnaryPlusOperators.operator +(nuint value) { throw null; } #endif // FEATURE_GENERIC_MATH } @@ -7637,6 +7705,7 @@ public UnhandledExceptionEventArgs(object exception, bool isTerminating) { } public bool IsTerminating { get { throw null; } } } public delegate void UnhandledExceptionEventHandler(object sender, System.UnhandledExceptionEventArgs e); +#if !BUILDING_CORELIB_REFERENCE public partial class Uri : System.Runtime.Serialization.ISerializable { public static readonly string SchemeDelimiter; @@ -7660,6 +7729,7 @@ protected Uri(System.Runtime.Serialization.SerializationInfo serializationInfo, public Uri(string uriString) { } [System.ObsoleteAttribute("This constructor has been deprecated; the dontEscape parameter is always false. Use Uri(string) instead.")] public Uri(string uriString, bool dontEscape) { } + public Uri(string uriString, in System.UriCreationOptions creationOptions) { } public Uri(string uriString, System.UriKind uriKind) { } public Uri(System.Uri baseUri, string? relativeUri) { } [System.ObsoleteAttribute("This constructor has been deprecated; the dontEscape parameter is always false. Use Uri(Uri, string) instead.")] @@ -7729,6 +7799,7 @@ protected void GetObjectData(System.Runtime.Serialization.SerializationInfo seri protected virtual void Parse() { } void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } public override string ToString() { throw null; } + public static bool TryCreate([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? uriString, in System.UriCreationOptions creationOptions, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; } public static bool TryCreate([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? uriString, System.UriKind uriKind, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; } public static bool TryCreate(System.Uri? baseUri, string? relativeUri, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; } public static bool TryCreate(System.Uri? baseUri, System.Uri? relativeUri, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; } @@ -7765,6 +7836,10 @@ public UriBuilder(System.Uri uri) { } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } } + public partial struct UriCreationOptions + { + public bool DangerousDisablePathAndQueryCanonicalization { readonly get { throw null; } set { } } + } [System.FlagsAttribute] public enum UriComponents { @@ -7834,6 +7909,7 @@ public enum UriPartial Path = 2, Query = 3, } +#endif public partial struct ValueTuple : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable, System.IEquatable, System.Runtime.CompilerServices.ITuple { object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } } @@ -13016,7 +13092,7 @@ public static partial class RuntimeFeature public const string DefaultImplementationsOfInterfaces = "DefaultImplementationsOfInterfaces"; public const string UnmanagedSignatureCallingConvention = "UnmanagedSignatureCallingConvention"; public const string PortablePdb = "PortablePdb"; - [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] + [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public const string VirtualStaticsInInterfaces = "VirtualStaticsInInterfaces"; public static bool IsDynamicCodeCompiled { get { throw null; } } public static bool IsDynamicCodeSupported { get { throw null; } } diff --git a/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt index cbe8cabdbb2956..542d29445b645c 100644 --- a/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.Runtime/src/MatchingRefApiCompatBaseline.txt @@ -24,4 +24,5 @@ CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInf CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name.get()' is abstract in the reference but is not abstract in the implementation. # C# generates backing fields for fixed buffers as public. TypesMustExist : Type 'System.IO.Enumeration.FileSystemEntry.<_fileNameBuffer>e__FixedBuffer' does not exist in the reference but it does exist in the implementation. - +# This API only exists on servicing builds after the commit that introduce it +MembersMustExist : Member 'public System.TimeSpan System.GC.GetTotalPauseDuration()' does not exist in the reference but it does exist in the implementation. \ No newline at end of file diff --git a/src/libraries/System.Runtime/src/System.Runtime.csproj b/src/libraries/System.Runtime/src/System.Runtime.csproj index 38cdb0e8526dc3..3fc27869c3381b 100644 --- a/src/libraries/System.Runtime/src/System.Runtime.csproj +++ b/src/libraries/System.Runtime/src/System.Runtime.csproj @@ -15,6 +15,6 @@ - + diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj b/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj index 6d888e344bc80e..913da87c5b2845 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj @@ -14,32 +14,19 @@ $(DefineConstants);FEATURE_GENERIC_MATH - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -248,8 +235,7 @@ - + @@ -257,12 +243,15 @@ + + + @@ -283,31 +272,27 @@ - + - + - + System.Reflection.Tests.EmbeddedImage.png System.Reflection.Tests.EmbeddedTextFile.txt - + - + diff --git a/src/libraries/System.Runtime/tests/System/ArrayTests.cs b/src/libraries/System.Runtime/tests/System/ArrayTests.cs index b7bdc5fab35834..7917c4e8d2bda8 100644 --- a/src/libraries/System.Runtime/tests/System/ArrayTests.cs +++ b/src/libraries/System.Runtime/tests/System/ArrayTests.cs @@ -1275,6 +1275,9 @@ public static IEnumerable Copy_SZArray_UnreliableConversion_CanPerform // Interface[] -> Class[] yield return new object[] { new NonGenericInterface1[10], 0, new NonGenericClass1[10], 0, 10, new NonGenericClass1[10] }; + + // object[] -> Int32Enum[] when values are all Int32Enum + yield return new object[] { new object[] { Int32Enum.Case3 }, 0, new Int32Enum[1], 0, 1, new Int32Enum[] { Int32Enum.Case3 } }; } public static IEnumerable Copy_Array_UnreliableConversion_CanPerform_TestData() diff --git a/src/libraries/System.Runtime/tests/System/DateOnlyTests.cs b/src/libraries/System.Runtime/tests/System/DateOnlyTests.cs index 935c75e01bb7c3..624b9b508a868e 100644 --- a/src/libraries/System.Runtime/tests/System/DateOnlyTests.cs +++ b/src/libraries/System.Runtime/tests/System/DateOnlyTests.cs @@ -513,6 +513,16 @@ public static void TryFormatTest() Assert.False(dateOnly.TryFormat(buffer.Slice(0, 3), out charsWritten)); Assert.False(dateOnly.TryFormat(buffer.Slice(0, 3), out charsWritten, "r")); Assert.False(dateOnly.TryFormat(buffer.Slice(0, 3), out charsWritten, "O")); + Assert.Throws(() => { + Span buff = stackalloc char[100]; + dateOnly.TryFormat(buff, out charsWritten, "u"); + }); + Assert.Throws(() => { + Span buff = stackalloc char[100]; + dateOnly.TryFormat(buff, out charsWritten, "hh-ss"); + }); + Assert.Throws(() => $"{dateOnly:u}"); + Assert.Throws(() => $"{dateOnly:hh-ss}"); } } } diff --git a/src/libraries/System.Runtime/tests/System/DoubleTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/DoubleTests.GenericMath.cs new file mode 100644 index 00000000000000..60a20053823ec2 --- /dev/null +++ b/src/libraries/System.Runtime/tests/System/DoubleTests.GenericMath.cs @@ -0,0 +1,127 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Globalization; +using System.Runtime.Versioning; +using Xunit; + +namespace System.Tests +{ + [ActiveIssue("https://github.com/dotnet/runtime/issues/54910", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))] + [RequiresPreviewFeaturesAttribute] + public class DoubleTests_GenericMath + { + [Theory] + [MemberData(nameof(DoubleTests.Parse_Valid_TestData), MemberType = typeof(DoubleTests))] + public static void ParseValidStringTest(string value, NumberStyles style, IFormatProvider provider, double expected) + { + bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo; + double result; + if ((style & ~(NumberStyles.Float | NumberStyles.AllowThousands)) == 0 && style != NumberStyles.None) + { + // Use Parse(string) or Parse(string, IFormatProvider) + if (isDefaultProvider) + { + Assert.True(NumberHelper.TryParse(value, null, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value, null)); + } + + Assert.Equal(expected, NumberHelper.Parse(value, provider)); + } + + // Use Parse(string, NumberStyles, IFormatProvider) + Assert.True(NumberHelper.TryParse(value, style, provider, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value, style, provider)); + + if (isDefaultProvider) + { + // Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider) + Assert.True(NumberHelper.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value, style, null)); + Assert.Equal(expected, NumberHelper.Parse(value, style, NumberFormatInfo.CurrentInfo)); + } + } + + [Theory] + [MemberData(nameof(DoubleTests.Parse_Invalid_TestData), MemberType = typeof(DoubleTests))] + public static void ParseInvalidStringTest(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo; + double result; + if ((style & ~(NumberStyles.Float | NumberStyles.AllowThousands)) == 0 && style != NumberStyles.None && (style & NumberStyles.AllowLeadingWhite) == (style & NumberStyles.AllowTrailingWhite)) + { + // Use Parse(string) or Parse(string, IFormatProvider) + if (isDefaultProvider) + { + Assert.False(NumberHelper.TryParse(value, null, out result)); + Assert.Equal(default(double), result); + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, null)); + } + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, provider)); + } + + // Use Parse(string, NumberStyles, IFormatProvider) + Assert.False(NumberHelper.TryParse(value, style, provider, out result)); + Assert.Equal(default(double), result); + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, style, provider)); + + if (isDefaultProvider) + { + // Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider) + Assert.False(NumberHelper.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result)); + Assert.Equal(default(double), result); + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, style, null)); + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, style, NumberFormatInfo.CurrentInfo)); + } + } + + [Theory] + [MemberData(nameof(DoubleTests.Parse_ValidWithOffsetCount_TestData), MemberType = typeof(DoubleTests))] + public static void ParseValidSpanTest(string value, int offset, int count, NumberStyles style, IFormatProvider provider, double expected) + { + bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo; + double result; + if ((style & ~(NumberStyles.Float | NumberStyles.AllowThousands)) == 0 && style != NumberStyles.None) + { + // Use Parse(string) or Parse(string, IFormatProvider) + if (isDefaultProvider) + { + Assert.True(NumberHelper.TryParse(value.AsSpan(offset, count), null, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value.AsSpan(offset, count), null)); + } + + Assert.Equal(expected, NumberHelper.Parse(value.AsSpan(offset, count), provider: provider)); + } + + Assert.Equal(expected, NumberHelper.Parse(value.AsSpan(offset, count), style, provider)); + + Assert.True(NumberHelper.TryParse(value.AsSpan(offset, count), style, provider, out result)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(DoubleTests.Parse_Invalid_TestData), MemberType = typeof(DoubleTests))] + public static void ParseInvalidSpanTest(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => NumberHelper.Parse(value.AsSpan(), style, provider)); + + Assert.False(NumberHelper.TryParse(value.AsSpan(), style, provider, out double result)); + Assert.Equal(0, result); + } + } + } +} diff --git a/src/libraries/System.Runtime/tests/System/EnumTests.cs b/src/libraries/System.Runtime/tests/System/EnumTests.cs index f718e6e4c24429..a764555bd93fd8 100644 --- a/src/libraries/System.Runtime/tests/System/EnumTests.cs +++ b/src/libraries/System.Runtime/tests/System/EnumTests.cs @@ -287,6 +287,15 @@ private static void Parse_Generic_Invalid(Type enumType, string value, bool i } } + [Theory] + [InlineData("Yellow")] + [InlineData("Yellow,Orange")] + public static void Parse_NonExistentValue_IncludedInErrorMessage(string value) + { + ArgumentException e = Assert.Throws(() => Enum.Parse(typeof(SimpleEnum), value)); + Assert.Contains(value, e.Message); + } + [Theory] [InlineData(SByteEnum.Min, "Min")] [InlineData(SByteEnum.One, "One")] diff --git a/src/libraries/System.Runtime/tests/System/GenericMathHelpers.cs b/src/libraries/System.Runtime/tests/System/GenericMathHelpers.cs index 2895dd8841962e..e1d4659db229be 100644 --- a/src/libraries/System.Runtime/tests/System/GenericMathHelpers.cs +++ b/src/libraries/System.Runtime/tests/System/GenericMathHelpers.cs @@ -157,8 +157,12 @@ public static TSelf CreateTruncating(TOther value) public static TSelf Min(TSelf x, TSelf y) => TSelf.Min(x, y); + public static TSelf Parse(string s, IFormatProvider provider) => TSelf.Parse(s, provider); + public static TSelf Parse(string s, NumberStyles style, IFormatProvider provider) => TSelf.Parse(s, style, provider); + public static TSelf Parse(ReadOnlySpan s, IFormatProvider provider) => TSelf.Parse(s, provider); + public static TSelf Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider provider) => TSelf.Parse(s, style, provider); public static TSelf Sign(TSelf value) => TSelf.Sign(value); @@ -166,8 +170,12 @@ public static TSelf CreateTruncating(TOther value) public static bool TryCreate(TOther value, out TSelf result) where TOther : INumber => TSelf.TryCreate(value, out result); + public static bool TryParse(string s, IFormatProvider provider, out TSelf result) => TSelf.TryParse(s, provider, out result); + public static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out TSelf result) => TSelf.TryParse(s, style, provider, out result); + public static bool TryParse(ReadOnlySpan s, IFormatProvider provider, out TSelf result) => TSelf.TryParse(s, provider, out result); + public static bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider provider, out TSelf result) => TSelf.TryParse(s, style, provider, out result); } diff --git a/src/libraries/System.Runtime/tests/System/HalfTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/HalfTests.GenericMath.cs new file mode 100644 index 00000000000000..c9fe77c9154a98 --- /dev/null +++ b/src/libraries/System.Runtime/tests/System/HalfTests.GenericMath.cs @@ -0,0 +1,127 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Globalization; +using System.Runtime.Versioning; +using Xunit; + +namespace System.Tests +{ + [ActiveIssue("https://github.com/dotnet/runtime/issues/54910", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))] + [RequiresPreviewFeaturesAttribute] + public class HalfTests_GenericMath + { + [Theory] + [MemberData(nameof(HalfTests.Parse_Valid_TestData), MemberType = typeof(HalfTests))] + public static void ParseValidStringTest(string value, NumberStyles style, IFormatProvider provider, Half expected) + { + bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo; + Half result; + if ((style & ~(NumberStyles.Float | NumberStyles.AllowThousands)) == 0 && style != NumberStyles.None) + { + // Use Parse(string) or Parse(string, IFormatProvider) + if (isDefaultProvider) + { + Assert.True(NumberHelper.TryParse(value, null, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value, null)); + } + + Assert.Equal(expected, NumberHelper.Parse(value, provider)); + } + + // Use Parse(string, NumberStyles, IFormatProvider) + Assert.True(NumberHelper.TryParse(value, style, provider, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value, style, provider)); + + if (isDefaultProvider) + { + // Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider) + Assert.True(NumberHelper.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value, style, null)); + Assert.Equal(expected, NumberHelper.Parse(value, style, NumberFormatInfo.CurrentInfo)); + } + } + + [Theory] + [MemberData(nameof(HalfTests.Parse_Invalid_TestData), MemberType = typeof(HalfTests))] + public static void ParseInvalidStringTest(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo; + Half result; + if ((style & ~(NumberStyles.Float | NumberStyles.AllowThousands)) == 0 && style != NumberStyles.None && (style & NumberStyles.AllowLeadingWhite) == (style & NumberStyles.AllowTrailingWhite)) + { + // Use Parse(string) or Parse(string, IFormatProvider) + if (isDefaultProvider) + { + Assert.False(NumberHelper.TryParse(value, null, out result)); + Assert.Equal(default(Half), result); + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, null)); + } + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, provider)); + } + + // Use Parse(string, NumberStyles, IFormatProvider) + Assert.False(NumberHelper.TryParse(value, style, provider, out result)); + Assert.Equal(default(Half), result); + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, style, provider)); + + if (isDefaultProvider) + { + // Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider) + Assert.False(NumberHelper.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result)); + Assert.Equal(default(Half), result); + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, style, null)); + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, style, NumberFormatInfo.CurrentInfo)); + } + } + + [Theory] + [MemberData(nameof(HalfTests.Parse_ValidWithOffsetCount_TestData), MemberType = typeof(HalfTests))] + public static void ParseValidSpanTest(string value, int offset, int count, NumberStyles style, IFormatProvider provider, Half expected) + { + bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo; + Half result; + if ((style & ~(NumberStyles.Float | NumberStyles.AllowThousands)) == 0 && style != NumberStyles.None) + { + // Use Parse(string) or Parse(string, IFormatProvider) + if (isDefaultProvider) + { + Assert.True(NumberHelper.TryParse(value.AsSpan(offset, count), null, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value.AsSpan(offset, count), null)); + } + + Assert.Equal(expected, NumberHelper.Parse(value.AsSpan(offset, count), provider: provider)); + } + + Assert.Equal(expected, NumberHelper.Parse(value.AsSpan(offset, count), style, provider)); + + Assert.True(NumberHelper.TryParse(value.AsSpan(offset, count), style, provider, out result)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(HalfTests.Parse_Invalid_TestData), MemberType = typeof(HalfTests))] + public static void ParseInvalidSpanTest(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => NumberHelper.Parse(value.AsSpan(), style, provider)); + + Assert.False(NumberHelper.TryParse(value.AsSpan(), style, provider, out Half result)); + Assert.Equal((Half)0, result); + } + } + } +} diff --git a/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs index d016e53c75e299..4460797182c873 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs @@ -52,6 +52,14 @@ public static void Test_CustomAttributeTypedArgument_Constructor() Assert.True(false, "Expected to find MyAttr Attribute"); } + [Fact] + public static void Test_CustomAttributeTypedArgument_ToString() + { + var argument = new CustomAttributeTypedArgument(new [] { new CustomAttributeTypedArgument(0) }); + + Assert.Equal("new CustomAttributeTypedArgument[1] { 0 }", argument.ToString()); + } + [MyAttr(MyKinds.First, Desc = "This is a description on a method")] private static void MyMethod() { } } diff --git a/src/libraries/System.Runtime/tests/System/Reflection/NullabilityInfoContextTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/NullabilityInfoContextTests.cs index 1651b1817a4ab7..b8de14f4dae20c 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/NullabilityInfoContextTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/NullabilityInfoContextTests.cs @@ -5,6 +5,7 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO.Enumeration; +using System.Runtime.Serialization; using System.Text.RegularExpressions; using Microsoft.DotNet.RemoteExecutor; using Xunit; @@ -30,10 +31,10 @@ public static IEnumerable FieldTestData() yield return new object[] { "FieldDisallowNull", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; yield return new object[] { "FieldAllowNull", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; yield return new object[] { "FieldDisallowNull2", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; - yield return new object[] { "FieldAllowNull2", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; + yield return new object[] { "FieldAllowNull2", NullabilityState.NotNull, NullabilityState.NotNull, typeof(string) }; yield return new object[] { "FieldNotNull", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; yield return new object[] { "FieldMaybeNull", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; - yield return new object[] { "FieldMaybeNull", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; + yield return new object[] { "FieldMaybeNull2", NullabilityState.NotNull, NullabilityState.NotNull, typeof(string) }; yield return new object[] { "FieldNotNull2", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; } @@ -86,11 +87,12 @@ public static IEnumerable PropertyTestData() yield return new object[] { "PropertyDisallowNull", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; yield return new object[] { "PropertyAllowNull", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; yield return new object[] { "PropertyDisallowNull2", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; - yield return new object[] { "PropertyAllowNull2", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; + yield return new object[] { "PropertyAllowNull2", NullabilityState.NotNull, NullabilityState.NotNull, typeof(string) }; yield return new object[] { "PropertyNotNull", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; yield return new object[] { "PropertyMaybeNull", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; - yield return new object[] { "PropertyMaybeNull2", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; + yield return new object[] { "PropertyMaybeNull2", NullabilityState.NotNull, NullabilityState.NotNull, typeof(string) }; yield return new object[] { "PropertyNotNull2", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; + yield return new object[] { "Item", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; } [Theory] @@ -121,7 +123,7 @@ public static IEnumerable ArrayPropertyTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(ArrayPropertyTestData))] public void ArrayPropertyTest(string propertyName, NullabilityState elementState, NullabilityState propertyState) { @@ -143,7 +145,7 @@ public static IEnumerable GenericArrayPropertyTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(GenericArrayPropertyTestData))] public void GenericArrayPropertyTest(string propertyName, NullabilityState elementState, NullabilityState propertyState) { @@ -167,7 +169,7 @@ public static IEnumerable JaggedArrayPropertyTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(JaggedArrayPropertyTestData))] public void JaggedArrayPropertyTest(string propertyName, NullabilityState innermodtElementState, NullabilityState elementState, NullabilityState propertyState) { @@ -192,7 +194,7 @@ public static IEnumerable TuplePropertyTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(TuplePropertyTestData))] public void TuplePropertyTest(string propertyName, NullabilityState genericParam1, NullabilityState genericParam2, NullabilityState genericParam3, NullabilityState propertyState) { @@ -217,7 +219,7 @@ public static IEnumerable GenericTuplePropertyTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(GenericTuplePropertyTestData))] public void GenericTuplePropertyTest(string propertyName, NullabilityState genericParam1, NullabilityState genericParam2, NullabilityState genericParam3, NullabilityState propertyState) { @@ -243,7 +245,7 @@ public static IEnumerable DictionaryPropertyTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(DictionaryPropertyTestData))] public void DictionaryPropertyTest(string propertyName, NullabilityState keyState, NullabilityState valueElement, NullabilityState valueState, NullabilityState propertyState) { @@ -269,7 +271,7 @@ public static IEnumerable GenericDictionaryPropertyTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(GenericDictionaryPropertyTestData))] public void GenericDictionaryPropertyTest(string propertyName, NullabilityState keyState, NullabilityState valueElement, NullabilityState valueState, NullabilityState propertyState) { @@ -433,16 +435,16 @@ public void GenericFieldNullableValueTypeTest(string fieldName, NullabilityState Assert.Equal(type, nullability.Type); } - public static IEnumerable GenericNotnullConstraintTestData() + public static IEnumerable GenericNotNullConstraintFieldsTestData() { - yield return new object[] { "FieldNullable", NullabilityState.NotNull, NullabilityState.NotNull, typeof(string) }; + yield return new object[] { "FieldNullable", NullabilityState.Nullable, NullabilityState.Nullable, typeof(string) }; yield return new object[] { "FieldUnknown", NullabilityState.Unknown, NullabilityState.Unknown, typeof(string) }; yield return new object[] { "FieldNullableEnabled", NullabilityState.NotNull, NullabilityState.NotNull, typeof(string) }; } [Theory] - [MemberData(nameof(GenericNotnullConstraintTestData))] - public void GenericNotNullConstraintTest(string fieldName, NullabilityState readState, NullabilityState writeState, Type type) + [MemberData(nameof(GenericNotNullConstraintFieldsTestData))] + public void GenericNotNullConstraintFieldsTest(string fieldName, NullabilityState readState, NullabilityState writeState, Type type) { FieldInfo field = typeof(GenericTestConstrainedNotNull).GetField(fieldName, flags)!; NullabilityInfo nullability = nullabilityContext.Create(field); @@ -451,7 +453,25 @@ public void GenericNotNullConstraintTest(string fieldName, NullabilityState read Assert.Equal(type, nullability.Type); } - public static IEnumerable GenericStructConstraintTestData() + public static IEnumerable GenericNotnullConstraintPropertiesTestData() + { + yield return new object[] { "PropertyNullable", NullabilityState.Nullable, NullabilityState.Nullable, typeof(string) }; + yield return new object[] { "PropertyUnknown", NullabilityState.Unknown, NullabilityState.Unknown, typeof(string) }; + yield return new object[] { "PropertyNullableEnabled", NullabilityState.NotNull, NullabilityState.NotNull, typeof(string) }; + } + + [Theory] + [MemberData(nameof(GenericNotnullConstraintPropertiesTestData))] + public void GenericNotNullConstraintPropertiesTest(string propertyName, NullabilityState readState, NullabilityState writeState, Type type) + { + PropertyInfo property = typeof(GenericTestConstrainedNotNull).GetProperty(propertyName, flags)!; + NullabilityInfo nullability = nullabilityContext.Create(property); + Assert.Equal(readState, nullability.ReadState); + Assert.Equal(writeState, nullability.WriteState); + Assert.Equal(type, nullability.Type); + } + + public static IEnumerable GenericStructConstraintFieldsTestData() { yield return new object[] { "FieldNullable", NullabilityState.Nullable, NullabilityState.Nullable, typeof(int?) }; yield return new object[] { "FieldUnknown", NullabilityState.NotNull, NullabilityState.NotNull, typeof(int) }; @@ -459,8 +479,8 @@ public static IEnumerable GenericStructConstraintTestData() } [Theory] - [MemberData(nameof(GenericStructConstraintTestData))] - public void GenericStructConstraintTest(string fieldName, NullabilityState readState, NullabilityState writeState, Type type) + [MemberData(nameof(GenericStructConstraintFieldsTestData))] + public void GenericStructConstraintFieldsTest(string fieldName, NullabilityState readState, NullabilityState writeState, Type type) { FieldInfo field = typeof(GenericTestConstrainedStruct).GetField(fieldName, flags)!; NullabilityInfo nullability = nullabilityContext.Create(field); @@ -469,6 +489,24 @@ public void GenericStructConstraintTest(string fieldName, NullabilityState readS Assert.Equal(type, nullability.Type); } + public static IEnumerable GenericStructConstraintPropertiesTestData() + { + yield return new object[] { "PropertyNullable", NullabilityState.Nullable, NullabilityState.Nullable, typeof(int?) }; + yield return new object[] { "PropertyUnknown", NullabilityState.NotNull, NullabilityState.NotNull, typeof(int) }; + yield return new object[] { "PropertyNullableEnabled", NullabilityState.NotNull, NullabilityState.NotNull, typeof(int) }; + } + + [Theory] + [MemberData(nameof(GenericStructConstraintPropertiesTestData))] + public void GenericStructConstraintPropertiesTest(string propertyName, NullabilityState readState, NullabilityState writeState, Type type) + { + PropertyInfo property = typeof(GenericTestConstrainedStruct).GetProperty(propertyName, flags)!; + NullabilityInfo nullability = nullabilityContext.Create(property); + Assert.Equal(readState, nullability.ReadState); + Assert.Equal(writeState, nullability.WriteState); + Assert.Equal(type, nullability.Type); + } + [Fact] [SkipOnMono("Nullability attributes trimmed on Mono")] public void GenericListTest() @@ -480,8 +518,8 @@ public void GenericListTest() Assert.Equal(NullabilityState.Nullable, nullability.WriteState); Assert.Equal(typeof(string), nullability.Type); - Type lisNontNull = typeof(List); - MethodInfo addNotNull = lisNontNull.GetMethod("Add")!; + Type listNotNull = typeof(List); + MethodInfo addNotNull = listNotNull.GetMethod("Add")!; nullability = nullabilityContext.Create(addNotNull.GetParameters()[0]); Assert.Equal(NullabilityState.Nullable, nullability.ReadState); Assert.Equal(typeof(string), nullability.Type); @@ -534,7 +572,7 @@ public void GenericListAndDictionaryFieldTest() public static IEnumerable MethodReturnParameterTestData() { - yield return new object[] { "MethodReturnsUnknown", NullabilityState.Unknown, NullabilityState.Unknown}; + yield return new object[] { "MethodReturnsUnknown", NullabilityState.Unknown, NullabilityState.Unknown }; yield return new object[] { "MethodReturnsNullNon", NullabilityState.Nullable, NullabilityState.NotNull }; yield return new object[] { "MethodReturnsNullNull", NullabilityState.Nullable, NullabilityState.Nullable }; yield return new object[] { "MethodReturnsNonNull", NullabilityState.NotNull, NullabilityState.Nullable }; @@ -544,7 +582,7 @@ public static IEnumerable MethodReturnParameterTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(MethodReturnParameterTestData))] public void MethodReturnParameterTest(string methodName, NullabilityState elementState, NullabilityState readState) { @@ -557,6 +595,31 @@ public void MethodReturnParameterTest(string methodName, NullabilityState elemen Assert.Empty(nullability.GenericTypeArguments); } + public static IEnumerable MethodReturnsTupleTestData() + { + // public Tuple? MethodReturnsTupleNullNonNull() => null; + yield return new object[] { "MethodReturnsTupleNullNonNull", NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable }; + // public Tuple MethodReturnsTupleNullNonNot() => null! + yield return new object[] { "MethodReturnsTupleNullNonNot", NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.NotNull }; + // public (int?, string)? MethodReturnsValueTupleNullNonNull() => null; + yield return new object[] { "MethodReturnsValueTupleNullNonNull", NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable }; + // public (string?, string) MethodReturnsValueTupleNullNonNon() => (null, string.Empty); + yield return new object[] { "MethodReturnsValueTupleNullNonNon", NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.NotNull }; + } + + [Theory] + [SkipOnMono("Nullability attributes trimmed on Mono")] + [MemberData(nameof(MethodReturnsTupleTestData))] + public void MethodReturnsTupleTest(string methodName, NullabilityState param1, NullabilityState param2, NullabilityState readState) + { + MethodInfo method = testType.GetMethod(methodName, flags)!; + NullabilityInfo nullability = nullabilityContext.Create(method.ReturnParameter); + Assert.Equal(readState, nullability.ReadState); + Assert.Null(nullability.ElementType); + Assert.Equal(param1, nullability.GenericTypeArguments[0].ReadState); + Assert.Equal(param2, nullability.GenericTypeArguments[1].ReadState); + } + public static IEnumerable MethodGenericReturnParameterTestData() { yield return new object[] { "MethodReturnsUnknown", NullabilityState.Unknown, NullabilityState.Unknown }; @@ -569,7 +632,7 @@ public static IEnumerable MethodGenericReturnParameterTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(MethodGenericReturnParameterTestData))] public void MethodGenericReturnParameterTest(string methodName, NullabilityState readState, NullabilityState elementState) { @@ -592,7 +655,7 @@ public static IEnumerable MethodParametersTestData() } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(MethodParametersTestData))] public void MethodParametersTest(string methodName, NullabilityState stringState, NullabilityState dictKey, NullabilityState dictValueElement, NullabilityState dictValue, NullabilityState dictionaryState) { @@ -610,13 +673,13 @@ public void MethodParametersTest(string methodName, NullabilityState stringState public static IEnumerable MethodGenericParametersTestData() { - yield return new object[] { "MethodParametersUnknown", NullabilityState.Unknown, NullabilityState.Unknown, NullabilityState.Unknown, NullabilityState.Unknown}; + yield return new object[] { "MethodParametersUnknown", NullabilityState.Unknown, NullabilityState.Unknown, NullabilityState.Unknown, NullabilityState.Unknown }; yield return new object[] { "MethodArgsNullGenericNullDictValueGeneric", NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.Nullable }; yield return new object[] { "MethodArgsGenericDictValueNullGeneric", NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.NotNull }; } [Theory] - [SkipOnMono("Disabling NullablePublicOnly feature not work for Mono tests")] + [SkipOnMono("Nullability attributes trimmed on Mono")] [MemberData(nameof(MethodGenericParametersTestData))] public void MethodGenericParametersTest(string methodName, NullabilityState param1State, NullabilityState dictKey, NullabilityState dictValue, NullabilityState dictionaryState) { @@ -649,7 +712,7 @@ public void NullablePublicOnlyStringTypeTest(string methodName, NullabilityState Assert.Equal(param1State, param1.ReadState); Assert.Equal(param2State, param2.ReadState); Assert.Equal(param3State, param3.ReadState); - if (param2.ElementType != null) + if (param2.ElementType != null) { Assert.Equal(NullabilityState.Nullable, param2.ElementType.ReadState); } @@ -678,7 +741,7 @@ public void NullablePublicOnlyOtherTypesTest() PropertyInfo publicGetPrivateSetNullableProperty = typeof(FileSystemEntry).GetProperty("Directory", flags)!; info = nullabilityContext.Create(publicGetPrivateSetNullableProperty); Assert.Equal(NullabilityState.NotNull, info.ReadState); - Assert.Equal(NullabilityState.Unknown, info.WriteState); + Assert.Equal(NullabilityState.NotNull, info.WriteState); MethodInfo protectedNullableReturnMethod = type.GetMethod("GetPropertyImpl", flags)!; info = nullabilityContext.Create(protectedNullableReturnMethod.ReturnParameter); @@ -687,8 +750,8 @@ public void NullablePublicOnlyOtherTypesTest() MethodInfo privateValueTypeReturnMethod = type.GetMethod("BinarySearch", flags)!; info = nullabilityContext.Create(privateValueTypeReturnMethod.ReturnParameter); - Assert.Equal(NullabilityState.Unknown, info.ReadState); - Assert.Equal(NullabilityState.Unknown, info.WriteState); + Assert.Equal(NullabilityState.NotNull, info.ReadState); + Assert.Equal(NullabilityState.NotNull, info.WriteState); Type regexType = typeof(Regex); FieldInfo protectedInternalNullableField = regexType.GetField("pattern", flags)!; @@ -700,11 +763,18 @@ public void NullablePublicOnlyOtherTypesTest() info = nullabilityContext.Create(privateNullableField); Assert.Equal(NullabilityState.Unknown, info.ReadState); Assert.Equal(NullabilityState.Unknown, info.WriteState); + + ConstructorInfo privateConstructor = typeof(IndexOutOfRangeException) + .GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, new[] { typeof(SerializationInfo), typeof(StreamingContext) })!; + info = nullabilityContext.Create(privateConstructor.GetParameters()[0]); + Assert.Equal(NullabilityState.Unknown, info.WriteState); } public static IEnumerable DifferentContextTestData() { yield return new object[] { "PropertyDisabled", NullabilityState.Unknown, NullabilityState.Unknown, typeof(string) }; + yield return new object[] { "PropertyDisabledAllowNull", NullabilityState.Unknown, NullabilityState.Nullable, typeof(string) }; + yield return new object[] { "PropertyDisabledMaybeNull", NullabilityState.Nullable, NullabilityState.Unknown, typeof(string) }; yield return new object[] { "PropertyEnabledAllowNull", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; yield return new object[] { "PropertyEnabledNotNull", NullabilityState.NotNull, NullabilityState.Nullable, typeof(string) }; yield return new object[] { "PropertyEnabledMaybeNull", NullabilityState.Nullable, NullabilityState.NotNull, typeof(string) }; @@ -766,15 +836,15 @@ public void AttributedParametersTest() Assert.Equal(NullabilityState.Nullable, notNullIfNotNull.WriteState); Assert.Equal(NullabilityState.Nullable, nullabilityContext.Create(allowNullParameter[1]).ReadState); - // [return: NotNullIfNotNull("nullable")] public string? NullablNotNullIfNotNullReturn(string? nullable, [NotNull] ref string? readNotNull) - ParameterInfo[] nullablNotNullIfNotNullReturn = type.GetMethod("NullablNotNullIfNotNullReturn", flags)!.GetParameters(); - NullabilityInfo returnNotNullIfNotNull = nullabilityContext.Create(type.GetMethod("NullablNotNullIfNotNullReturn", flags)!.ReturnParameter); - NullabilityInfo readNotNull = nullabilityContext.Create(nullablNotNullIfNotNullReturn[1]); + // [return: NotNullIfNotNull("nullable")] public string? NullableNotNullIfNotNullReturn(string? nullable, [NotNull] ref string? readNotNull) + ParameterInfo[] nullableNotNullIfNotNullReturn = type.GetMethod("NullableNotNullIfNotNullReturn", flags)!.GetParameters(); + NullabilityInfo returnNotNullIfNotNull = nullabilityContext.Create(type.GetMethod("NullableNotNullIfNotNullReturn", flags)!.ReturnParameter); + NullabilityInfo readNotNull = nullabilityContext.Create(nullableNotNullIfNotNullReturn[1]); Assert.Equal(NullabilityState.Nullable, returnNotNullIfNotNull.ReadState); Assert.Equal(NullabilityState.Nullable, returnNotNullIfNotNull.WriteState); Assert.Equal(NullabilityState.NotNull, readNotNull.ReadState); Assert.Equal(NullabilityState.Nullable, readNotNull.WriteState); - Assert.Equal(NullabilityState.Nullable, nullabilityContext.Create(nullablNotNullIfNotNullReturn[0]).ReadState); + Assert.Equal(NullabilityState.Nullable, nullabilityContext.Create(nullableNotNullIfNotNullReturn[0]).ReadState); // public bool TryGetOutParameters(string id, [NotNullWhen(true)] out string? value, [MaybeNullWhen(false)] out string value2) ParameterInfo[] tryGetOutParameters = type.GetMethod("TryGetOutParameters", flags)!.GetParameters(); @@ -787,6 +857,51 @@ public void AttributedParametersTest() Assert.Equal(NullabilityState.NotNull, nullabilityContext.Create(tryGetOutParameters[0]).ReadState); } + public static IEnumerable NestedGenericsReturnParameterData() + { + // public IEnumerable?> MethodReturnsEnumerableNonTupleNonNonNullValueTupleNonNullNon() => null!; + yield return new object[] { "MethodReturnsEnumerableNonTupleNonNonNullValueTupleNonNullNon", + NullabilityState.NotNull, NullabilityState.NotNull, NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable }; + + // public IEnumerable?>? MethodReturnsEnumerableNullTupleNullNonNullValueTupleNullNonNull() => null!; + yield return new object[] { "MethodReturnsEnumerableNullTupleNullNonNullValueTupleNullNonNull", + NullabilityState.Nullable, NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.Nullable, NullabilityState.NotNull }; + + // public IEnumerable, int>?> MethodReturnsEnumerableNonTupleNonNonNullTupleNonNullNon() => null!; + yield return new object[] { "MethodReturnsEnumerableNonTupleNonNonNullTupleNonNullNon", + NullabilityState.NotNull, NullabilityState.NotNull, NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable }; + + // public IEnumerable?, int>?>? MethodReturnsEnumerableNullStructNullNonNonTupleNonNullNull() => null; + yield return new object[] { "MethodReturnsEnumerableNullStructNullNonNullTupleNonNullNull", + NullabilityState.Nullable, NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable }; + + // public IEnumerable?, int>?>? MethodReturnsEnumerableNullTupleNullNonNullStructNonNullNull() => null; + yield return new object[] { "MethodReturnsEnumerableNullTupleNullNonNullStructNonNullNull", + NullabilityState.Nullable, NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable }; + + // public IEnumerable<(GenericStruct str, int? count)> MethodReturnsEnumerableNonValueTupleNonNullNonTupleNonNullNon() => null!; + yield return new object[] { "MethodReturnsEnumerableNonValueTupleNonNullNonStructNonNullNon", + NullabilityState.NotNull, NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.NotNull, NullabilityState.Nullable }; + } + + [Theory] + [MemberData(nameof(NestedGenericsReturnParameterData))] + [SkipOnMono("Nullability attributes trimmed on Mono")] + public void NestedGenericsReturnParameterTest(string methodName, NullabilityState enumState, NullabilityState innerTupleState, + NullabilityState intState, NullabilityState outerTupleState, NullabilityState stringState, NullabilityState objectState) + { + NullabilityInfo enumerabeNullability = nullabilityContext.Create(typeof(TypeWithNotNullContext).GetMethod(methodName, flags)!.ReturnParameter); + Assert.Equal(enumState, enumerabeNullability.ReadState); + NullabilityInfo tupleNullability = enumerabeNullability.GenericTypeArguments[0]; + Assert.Equal(outerTupleState, tupleNullability.ReadState); + Assert.Equal(innerTupleState, tupleNullability.GenericTypeArguments[0].ReadState); + Assert.Equal(intState, tupleNullability.GenericTypeArguments[1].ReadState); + NullabilityInfo valueTupleNullability = tupleNullability.GenericTypeArguments[0]; + Assert.Equal(innerTupleState, valueTupleNullability.ReadState); + Assert.Equal(stringState, valueTupleNullability.GenericTypeArguments[0].ReadState); + Assert.Equal(objectState, valueTupleNullability.GenericTypeArguments[1].ReadState); + } + public static IEnumerable RefReturnData() { yield return new object[] { "RefReturnUnknown", NullabilityState.Unknown, NullabilityState.Unknown, NullabilityState.Unknown, NullabilityState.Unknown }; @@ -812,12 +927,202 @@ public void RefReturnTestTest(string methodName, NullabilityState retReadState, Assert.Equal(paramReadState, paramNullability.ReadState); Assert.Equal(paramWriteState, paramNullability.WriteState); } + + public static IEnumerable ValueTupleTestData() + { + // public (int, string) UnknownValueTuple; [0] + yield return new object[] { "UnknownValueTuple", NullabilityState.NotNull, NullabilityState.Unknown, NullabilityState.NotNull }; + // public (string?, object) NullNonNonValueTuple; [0, 2, 1] + yield return new object[] { "Null_Non_Non_ValueTuple", NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.NotNull }; + // public (string?, object)? Null_Non_Null_ValueTuple; [0, 2, 1] + yield return new object[] { "Null_Non_Null_ValueTuple", NullabilityState.Nullable, NullabilityState.NotNull, NullabilityState.Nullable }; + // public (int, int?)? Non_Null_Null_ValueTuple; [0] + yield return new object[] { "Non_Null_Null_ValueTuple", NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.Nullable }; + // public (int, string) Non_Non_Non_ValueTuple; [0, 1] + yield return new object[] { "Non_Non_Non_ValueTuple", NullabilityState.NotNull, NullabilityState.NotNull, NullabilityState.NotNull }; + // public (int, string?) Non_Null_Non_ValueTuple; [0, 2] + yield return new object[] { "Non_Null_Non_ValueTuple", NullabilityState.NotNull, NullabilityState.Nullable, NullabilityState.NotNull }; + } + + [Theory] + [MemberData(nameof(ValueTupleTestData))] + [SkipOnMono("Nullability attributes trimmed on Mono")] + public void TestValueTupleGenericTypeParameters(string fieldName, NullabilityState param1, NullabilityState param2, NullabilityState fieldState) + { + var tupleInfo = nullabilityContext.Create(testType.GetField(fieldName)!); + + Assert.Equal(fieldState, tupleInfo.ReadState); + Assert.Equal(param1, tupleInfo.GenericTypeArguments[0].ReadState); + Assert.Equal(param2, tupleInfo.GenericTypeArguments[1].ReadState); + } + + public static IEnumerable GenericInheritanceTestData() + { + yield return new object?[] { typeof(ListOfUnconstrained), NullabilityState.Nullable, null }; + yield return new object?[] { typeof(ListUnconstrainedOfNullable), NullabilityState.Nullable, null }; + yield return new object?[] { typeof(ListUnconstrainedOfNullableOfObject<>), NullabilityState.NotNull, null }; + yield return new object?[] { typeof(ListOfArrayOfNullableString), NullabilityState.NotNull, NullabilityState.Nullable }; + yield return new object?[] { typeof(ListOfNotNull>), NullabilityState.NotNull, NullabilityState.NotNull }; + yield return new object?[] { typeof(ListOfListOfObject), NullabilityState.NotNull, NullabilityState.NotNull }; + yield return new object?[] { typeof(ListMultiGenericOfNotNull), NullabilityState.NotNull, null }; + } + + [Theory] + [MemberData(nameof(GenericInheritanceTestData))] + [SkipOnMono("Nullability attributes trimmed on Mono")] + public void TestGenericInheritance(Type listType, NullabilityState parameterState, NullabilityState? subState) + { + var addParameterInfo = nullabilityContext.Create(listType.GetMethod("Add")!.GetParameters()[0]); + Validate(addParameterInfo); + + var copyToParameterInfo = nullabilityContext.Create( + listType.GetMethod("CopyTo", new[] { addParameterInfo.Type.MakeArrayType() })! + .GetParameters()[0]); + Assert.Equal(NullabilityState.NotNull, copyToParameterInfo.ReadState); + Assert.Equal(NullabilityState.NotNull, copyToParameterInfo.WriteState); + Assert.NotNull(copyToParameterInfo.ElementType); + Validate(copyToParameterInfo.ElementType!); + + void Validate(NullabilityInfo info) + { + Assert.Equal(parameterState, info.ReadState); + Assert.Equal(parameterState, info.WriteState); + if (subState != null) + { + NullabilityInfo subInfo = info.ElementType ?? info.GenericTypeArguments[0]; + Assert.Equal(subState, subInfo.ReadState); + Assert.Equal(subState, subInfo.WriteState); + Assert.True(info.GenericTypeArguments.Length <= 1); + } + else + { + Assert.Null(info.ElementType); + Assert.Empty(info.GenericTypeArguments); + } + } + } + + [Fact] + [SkipOnMono("Nullability attributes trimmed on Mono")] + public void TestDeeplyNestedGenericInheritance() + { + var copyToMethodInfo = nullabilityContext.Create( + typeof(ListOfTupleOfDictionaryOfStringNullableBoolIntNullableObject).GetMethod("CopyTo", new[] { typeof((Dictionary, int, object?)[]) })! + .GetParameters()[0]); + + Validate(copyToMethodInfo, typeof((Dictionary, int, object?)[]), NullabilityState.NotNull); + Assert.NotNull(copyToMethodInfo.ElementType); + + var tupleInfo = copyToMethodInfo.ElementType!; + Validate(tupleInfo, typeof((Dictionary, int, object?)), NullabilityState.NotNull); + + var dictionaryInfo = tupleInfo.GenericTypeArguments[0]; + Validate(dictionaryInfo, typeof(Dictionary), NullabilityState.NotNull); + + var stringInfo = dictionaryInfo.GenericTypeArguments[0]; + Validate(stringInfo, typeof(string), NullabilityState.NotNull); + + var nullableBoolInfo = dictionaryInfo.GenericTypeArguments[1]; + Validate(nullableBoolInfo, typeof(bool?), NullabilityState.Nullable); + + var intInfo = tupleInfo.GenericTypeArguments[1]; + Validate(intInfo, typeof(int), NullabilityState.NotNull); + + var objectInfo = tupleInfo.GenericTypeArguments[2]; + Validate(objectInfo, typeof(object), NullabilityState.Nullable); + + void Validate(NullabilityInfo info, Type type, NullabilityState state) + { + Assert.Equal(type, info.Type); + Assert.Equal(state, info.ReadState); + Assert.Equal(state, info.WriteState); + Assert.Equal(type.IsGenericType && type.GetGenericTypeDefinition() != typeof(Nullable<>) ? type.GetGenericArguments().Length : 0, info.GenericTypeArguments.Length); + Assert.Equal(type.IsArray, info.ElementType is not null); + } + } + + [Fact] + [SkipOnMono("Nullability attributes trimmed on Mono")] + public void TestNestedGenericInheritanceWithMultipleParameters() + { + var item3Info = nullabilityContext.Create(typeof(DerivesFromTupleOfNestedGenerics).GetProperty("Item3")!); + + Assert.Equal(typeof(IDisposable[]), item3Info.Type); + Assert.Equal(NullabilityState.Nullable, item3Info.ReadState); + Assert.Equal(NullabilityState.Unknown, item3Info.WriteState); // read-only property + + Assert.Equal(NullabilityState.NotNull, item3Info.ElementType!.ReadState); + Assert.Equal(NullabilityState.NotNull, item3Info.ElementType.WriteState); + } + + [Fact] + [SkipOnMono("Nullability attributes trimmed on Mono")] + public void TestNullabilityInfoCreationOnPropertiesWithNestedGenericTypeArguments() + { + Type type = typeof(TypeWithPropertiesNestingItsGenericTypeArgument); + + NullabilityInfo shallow1Info = nullabilityContext.Create(type.GetProperty("Shallow1")!); + NullabilityInfo deep1Info = nullabilityContext.Create(type.GetProperty("Deep1")!); + NullabilityInfo deep2Info = nullabilityContext.Create(type.GetProperty("Deep2")!); + NullabilityInfo deep3Info = nullabilityContext.Create(type.GetProperty("Deep3")!); + NullabilityInfo deep4Info = nullabilityContext.Create(type.GetProperty("Deep4")!); + NullabilityInfo deep5Info = nullabilityContext.Create(type.GetProperty("Deep5")!); + + //public Tuple? Shallow1 { get; set; } + NullabilityInfo info = shallow1Info; + Assert.Equal(1, info.GenericTypeArguments.Length); + Assert.Equal(NullabilityState.Nullable, info.GenericTypeArguments[0].ReadState); + + //public Tuple>? Deep1 { get; set; } + info = deep1Info; + Assert.Equal(1, info.GenericTypeArguments.Length); + Assert.Equal(1, info.GenericTypeArguments[0].GenericTypeArguments.Length); + Assert.Equal(NullabilityState.NotNull, info.GenericTypeArguments[0].ReadState); + Assert.Equal(NullabilityState.Nullable, info.GenericTypeArguments[0].GenericTypeArguments[0].ReadState); + + //public Tuple, int>? Deep2 { get; set; } + info = deep2Info; + Assert.Equal(2, info.GenericTypeArguments.Length); + Assert.Equal(1, info.GenericTypeArguments[0].GenericTypeArguments.Length); + Assert.Equal(NullabilityState.NotNull, info.GenericTypeArguments[0].ReadState); + Assert.Equal(NullabilityState.NotNull, info.GenericTypeArguments[1].ReadState); + Assert.Equal(NullabilityState.Nullable, info.GenericTypeArguments[0].GenericTypeArguments[0].ReadState); + + //public Tuple>? Deep3 { get; set; } + info = deep3Info; + Assert.Equal(2, info.GenericTypeArguments.Length); + Assert.Equal(1, info.GenericTypeArguments[1].GenericTypeArguments.Length); + Assert.Equal(NullabilityState.Nullable, info.GenericTypeArguments[0].ReadState); + Assert.Equal(NullabilityState.NotNull, info.GenericTypeArguments[1].ReadState); + Assert.Equal(NullabilityState.Nullable, info.GenericTypeArguments[1].GenericTypeArguments[0].ReadState); + + //public Tuple>? Deep4 { get; set; } + info = deep4Info; + Assert.Equal(3, info.GenericTypeArguments.Length); + Assert.Equal(1, info.GenericTypeArguments[2].GenericTypeArguments.Length); + Assert.Equal(NullabilityState.NotNull, info.GenericTypeArguments[0].ReadState); + Assert.Equal(NullabilityState.Nullable, info.GenericTypeArguments[1].ReadState); + Assert.Equal(NullabilityState.NotNull, info.GenericTypeArguments[2].ReadState); + Assert.Equal(NullabilityState.Nullable, info.GenericTypeArguments[2].GenericTypeArguments[0].ReadState); + + //public Tuple?>? Deep5 { get; set; } + info = deep5Info; + Assert.Equal(3, info.GenericTypeArguments.Length); + Assert.Equal(2, info.GenericTypeArguments[2].GenericTypeArguments.Length); + Assert.Equal(NullabilityState.NotNull, info.GenericTypeArguments[0].ReadState); + Assert.Equal(NullabilityState.NotNull, info.GenericTypeArguments[1].ReadState); + Assert.Equal(NullabilityState.Nullable, info.GenericTypeArguments[2].ReadState); + Assert.Equal(NullabilityState.Nullable, info.GenericTypeArguments[2].GenericTypeArguments[0].ReadState); + Assert.Equal(NullabilityState.NotNull, info.GenericTypeArguments[2].GenericTypeArguments[1].ReadState); + } } #pragma warning disable CS0649, CS0067, CS0414 public class TypeWithNullableContext { #nullable disable + [AllowNull] public string PropertyDisabledAllowNull { get; set; } + [MaybeNull] public string PropertyDisabledMaybeNull { get; set; } public string PropertyDisabled { get; set; } public ref string RefReturnUnknown(ref string id) { return ref id; } #nullable enable @@ -830,12 +1135,13 @@ public class TypeWithNullableContext bool NotNullWhenParameter([DisallowNull] string? disallowNull, [NotNullWhen(true)] ref string? notNullWhen, Type? nullableType) { return false; } public bool MaybeNullParameters([MaybeNull] string maybeNull, [MaybeNullWhen(false)] out string maybeNullWhen, Type? nullableType) { maybeNullWhen = null; return false; } public string? AllowNullParameter([AllowNull] string allowNull, [NotNullIfNotNull("allowNull")] string? notNullIfNotNull) { return null; } - [return: NotNullIfNotNull("nullable")] public string? NullablNotNullIfNotNullReturn(string? nullable, [NotNull] ref string? readNotNull) { readNotNull = string.Empty; return null!; } + [return: NotNullIfNotNull("nullable")] public string? NullableNotNullIfNotNullReturn(string? nullable, [NotNull] ref string? readNotNull) { readNotNull = string.Empty; return null!; } public ref string? RefReturnNullable([AllowNull] ref string id) { return ref id!; } [return: MaybeNull] public ref string RefReturnMaybeNull([DisallowNull] ref string? id) { return ref id; } [return: NotNull] public ref string? RefReturnNotNull([NotNull] ref string? id) { id = string.Empty; return ref id!; } public ref string RefReturnNotNullable([MaybeNull] ref string id) { return ref id; } public bool TryGetOutParameters(string id, [NotNullWhen(true)] out string? value, [MaybeNullWhen(false)] out string value2) { value = null; value2 = null; return false; } + public IEnumerable?> MethodReturnsEnumerableNonTupleNonNonNullValueTupleNonNullNon() => null!; } public class TypeWithNoContext @@ -848,12 +1154,10 @@ public class TypeWithNoContext [AllowNull] public string PropertyEnabledAllowNull { get; set; } [NotNull] public string? PropertyEnabledNotNull { get; set; } = null!; [DisallowNull] public string? PropertyEnabledDisallowNull { get; set; } = null!; - [MaybeNull] public string PropertyEnabledMaybeNull { get; set; } + [MaybeNull] public string PropertyEnabledMaybeNull { get; set; } public string? PropertyEnabledNullable { get; set; } public string PropertyEnabledNonNullable { get; set; } = null!; #nullable disable - [return: NotNull, MaybeNull] - public string MethodNullableDisabled([AllowNull] string value, string ret) { return null; } } public class TypeWithNotNullContext @@ -865,6 +1169,7 @@ public class TypeWithNotNullContext protected Tuple PropertyTupleUnknown { get; set; } protected internal IDictionary PropertyDictionaryUnknown { get; set; } + public (int, string) UnknownValueTuple; internal TypeWithNotNullContext FieldUnknown; public int FieldValueTypeUnknown; @@ -885,14 +1190,15 @@ public void MethodParametersUnknown(string s, IDictionary dict) [AllowNull] public string PropertyAllowNull { get; set; } [NotNull] public string? PropertyNotNull { get; set; } [MaybeNull] public string PropertyMaybeNull { get; set; } - // only AllowNull matter + // only DisallowNull matters [AllowNull, DisallowNull] public string PropertyAllowNull2 { get; set; } - // only DisallowNull matter + // only AllowNull matters [AllowNull, DisallowNull] public string? PropertyDisallowNull2 { get; set; } - // only NotNull matter + // only NotNull matters [NotNull, MaybeNull] public string? PropertyNotNull2 { get; set; } - // only MaybeNull matter + // only NotNull matters [NotNull, MaybeNull] public string PropertyMaybeNull2 { get; set; } + [DisallowNull] public string? this[int i] { get => null; set { } } private protected string?[]?[]? PropertyJaggedArrayNullNullNull { get; set; } public static string?[]?[] PropertyJaggedArrayNullNullNon { get; set; } = null!; public string?[][]? PropertyJaggedArrayNullNonNull { get; set; } @@ -915,6 +1221,11 @@ public void MethodParametersUnknown(string s, IDictionary dict) private IDictionary? PropertyDictionaryNonNonNonNull { get; set; } public IDictionary PropertyDictionaryNonNonNonNon { get; set; } = null!; + public (string?, object) Null_Non_Non_ValueTuple; + public (string?, object)? Null_Non_Null_ValueTuple; + public (int, int?)? Non_Null_Null_ValueTuple; + public (int, string) Non_Non_Non_ValueTuple; + public (int, string?) Non_Null_Non_ValueTuple; private const string? FieldNullable = null; protected static NullabilityInfoContextTests FieldNonNullable = null!; public static double FieldValueTypeNotNull; @@ -936,14 +1247,24 @@ public void MethodParametersUnknown(string s, IDictionary dict) [return: NotNull, MaybeNull] public string[]? MethodReturnsNonNotNull() => null!; // only NotNull is applicable [return: MaybeNull] public string[] MethodReturnsNonMaybeNull() => null; public string[] MethodReturnsNonNon() => null!; - public Tuple? MethodTupleNullNonNull() => null; - public IEnumerable?> MethodEnumerableNonNonNullUnknownNullNonNullNon() => null!; + public Tuple? MethodReturnsTupleNullNonNull() => null; + public Tuple MethodReturnsTupleNullNonNot() => null!; + public (int?, string)? MethodReturnsValueTupleNullNonNull() => null; + public (string?, string) MethodReturnsValueTupleNullNonNon() => (null, string.Empty); + public IEnumerable?> MethodReturnsEnumerableNonTupleNonNonNullValueTupleNonNullNon() => null!; + public IEnumerable?>? MethodReturnsEnumerableNullTupleNullNonNullValueTupleNullNonNull() => null!; + public IEnumerable, int>?> MethodReturnsEnumerableNonTupleNonNonNullTupleNonNullNon() => null!; + public IEnumerable?, int>?>? MethodReturnsEnumerableNullStructNullNonNullTupleNonNullNull() => null; + public IEnumerable?, int>?>? MethodReturnsEnumerableNullTupleNullNonNullStructNonNullNull() => null; + public IEnumerable<(GenericStruct str, int? count)> MethodReturnsEnumerableNonValueTupleNonNullNonStructNonNullNon() => null!; public void MethodNullNonNullNonNon(string? s, IDictionary dict) { } public void MethodNonNullNonNullNotNull(string s, [NotNull] IDictionary? dict) { dict = new Dictionary(); } public void MethodNullNonNullNullNon(string? s, IDictionary dict) { } public void MethodAllowNullNonNonNonNull([AllowNull] string s, IDictionary? dict) { } } + public struct GenericStruct { } + internal class GenericTest { #nullable disable @@ -969,21 +1290,21 @@ public void MethodParametersUnknown(T s, IDictionary dict) { } public Tuple? PropertyTupleNullNullNullNull { get; set; } public Tuple PropertyTupleNonNullNonNon { get; set; } = null!; Tuple? PropertyTupleNullNonNullNull { get; set; } - public Tuple? PropertyTupleNonNullNonNull { get; set; } - public Tuple PropertyTupleNonNonNonNon { get; set; } = null!; + public Tuple? PropertyTupleNonNullNonNull { get; set; } + public Tuple PropertyTupleNonNonNonNon { get; set; } = null!; private IDictionary PropertyDictionaryNullNullNullNon { get; set; } = null!; static IDictionary? PropertyDictionaryNonNullNonNull { get; set; } public static IDictionary? PropertyDictionaryNullNonNonNull { get; set; } public IDictionary PropertyDictionaryNonNullNonNon { get; set; } = null!; protected IDictionary? PropertyDictionaryNonNonNonNull { get; set; } - public IDictionary PropertyDictionaryNonNonNonNon { get; set; } = null!; + public IDictionary PropertyDictionaryNonNonNonNon { get; set; } = null!; static T? FieldNullable = default; public T FieldNonNullable = default!; [DisallowNull] public T? FieldDisallowNull; [AllowNull] protected T FieldAllowNull; [NotNull] public T? FieldNotNull = default; - [MaybeNull] protected internal T FieldMaybeNull = default!; + [MaybeNull] protected internal T FieldMaybeNull = default!; public List FieldListOfT = default!; public Dictionary FieldDictionaryStringToT = default!; @@ -1007,6 +1328,7 @@ internal class GenericTestConstrainedNotNull where T : notnull public T FieldNullableEnabled = default!; public T? FieldNullable; public T PropertyNullableEnabled { get; set; } = default!; + public T? PropertyNullable { get; set; } = default!; } internal class GenericTestConstrainedStruct where T : struct @@ -1019,5 +1341,45 @@ internal class GenericTestConstrainedStruct where T : struct public T FieldNullableEnabled; public T? FieldNullable; public T PropertyNullableEnabled { get; set; } + public T? PropertyNullable { get; set; } + } + + public class ListOfUnconstrained : List { } + + public class ListUnconstrainedOfNullable : ListOfUnconstrained where T : class? { } + + public class ListUnconstrainedOfNullableOfObject : ListUnconstrainedOfNullable { } + + public class ListOfArrayOfNullableString : List { } + + public class ListOfNotNull : List where T : notnull { } + + public class ListOfListOfObject : List> { } + + public class ListMultiGenericOfNotNull : List + where T : class? + where U : class + where V : class? + { + } + + public class ListOfTupleOfDictionaryOfStringNullableBoolIntNullableObject : List<(Dictionary, int, object?)> { } + + public class DerivesFromTupleOfNestedGenerics : Tuple, Dictionary>, IDisposable[]?> + { + public DerivesFromTupleOfNestedGenerics(List item1, Dictionary> item2, IDisposable[]? item3) + : base(item1, item2, item3) + { + } + } + + public class TypeWithPropertiesNestingItsGenericTypeArgument + { + public Tuple? Shallow1 { get; set; } + public Tuple>? Deep1 { get; set; } + public Tuple, int>? Deep2 { get; set; } + public Tuple>? Deep3 { get; set; } + public Tuple>? Deep4 { get; set; } + public Tuple?>? Deep5 { get; set; } } } diff --git a/src/libraries/System.Runtime/tests/System/SingleTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/SingleTests.GenericMath.cs new file mode 100644 index 00000000000000..8e7c3e8a1c6908 --- /dev/null +++ b/src/libraries/System.Runtime/tests/System/SingleTests.GenericMath.cs @@ -0,0 +1,127 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Globalization; +using System.Runtime.Versioning; +using Xunit; + +namespace System.Tests +{ + [ActiveIssue("https://github.com/dotnet/runtime/issues/54910", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))] + [RequiresPreviewFeaturesAttribute] + public class SingleTests_GenericMath + { + [Theory] + [MemberData(nameof(SingleTests.Parse_Valid_TestData), MemberType = typeof(SingleTests))] + public static void ParseValidStringTest(string value, NumberStyles style, IFormatProvider provider, float expected) + { + bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo; + float result; + if ((style & ~(NumberStyles.Float | NumberStyles.AllowThousands)) == 0 && style != NumberStyles.None) + { + // Use Parse(string) or Parse(string, IFormatProvider) + if (isDefaultProvider) + { + Assert.True(NumberHelper.TryParse(value, null, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value, null)); + } + + Assert.Equal(expected, NumberHelper.Parse(value, provider)); + } + + // Use Parse(string, NumberStyles, IFormatProvider) + Assert.True(NumberHelper.TryParse(value, style, provider, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value, style, provider)); + + if (isDefaultProvider) + { + // Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider) + Assert.True(NumberHelper.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value, style, null)); + Assert.Equal(expected, NumberHelper.Parse(value, style, NumberFormatInfo.CurrentInfo)); + } + } + + [Theory] + [MemberData(nameof(SingleTests.Parse_Invalid_TestData), MemberType = typeof(SingleTests))] + public static void ParseInvalidStringTest(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo; + float result; + if ((style & ~(NumberStyles.Float | NumberStyles.AllowThousands)) == 0 && style != NumberStyles.None && (style & NumberStyles.AllowLeadingWhite) == (style & NumberStyles.AllowTrailingWhite)) + { + // Use Parse(string) or Parse(string, IFormatProvider) + if (isDefaultProvider) + { + Assert.False(NumberHelper.TryParse(value, null, out result)); + Assert.Equal(default(float), result); + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, null)); + } + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, provider)); + } + + // Use Parse(string, NumberStyles, IFormatProvider) + Assert.False(NumberHelper.TryParse(value, style, provider, out result)); + Assert.Equal(default(float), result); + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, style, provider)); + + if (isDefaultProvider) + { + // Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider) + Assert.False(NumberHelper.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result)); + Assert.Equal(default(float), result); + + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, style, null)); + Assert.Throws(exceptionType, () => NumberHelper.Parse(value, style, NumberFormatInfo.CurrentInfo)); + } + } + + [Theory] + [MemberData(nameof(SingleTests.Parse_ValidWithOffsetCount_TestData), MemberType = typeof(SingleTests))] + public static void ParseValidSpanTest(string value, int offset, int count, NumberStyles style, IFormatProvider provider, float expected) + { + bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo; + float result; + if ((style & ~(NumberStyles.Float | NumberStyles.AllowThousands)) == 0 && style != NumberStyles.None) + { + // Use Parse(string) or Parse(string, IFormatProvider) + if (isDefaultProvider) + { + Assert.True(NumberHelper.TryParse(value.AsSpan(offset, count), null, out result)); + Assert.Equal(expected, result); + + Assert.Equal(expected, NumberHelper.Parse(value.AsSpan(offset, count), null)); + } + + Assert.Equal(expected, NumberHelper.Parse(value.AsSpan(offset, count), provider: provider)); + } + + Assert.Equal(expected, NumberHelper.Parse(value.AsSpan(offset, count), style, provider)); + + Assert.True(NumberHelper.TryParse(value.AsSpan(offset, count), style, provider, out result)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(SingleTests.Parse_Invalid_TestData), MemberType = typeof(SingleTests))] + public static void ParseInvalidSpanTest(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => NumberHelper.Parse(value.AsSpan(), style, provider)); + + Assert.False(NumberHelper.TryParse(value.AsSpan(), style, provider, out float result)); + Assert.Equal(0, result); + } + } + } +} diff --git a/src/libraries/System.Runtime/tests/System/StringTests.cs b/src/libraries/System.Runtime/tests/System/StringTests.cs index b0786bb2370fb5..acf8ae0f9c46aa 100644 --- a/src/libraries/System.Runtime/tests/System/StringTests.cs +++ b/src/libraries/System.Runtime/tests/System/StringTests.cs @@ -1960,5 +1960,22 @@ public static void EqualityTests_AsciiOptimizations() } } } + + [Theory] + [InlineData("a", "A", 0)] + [InlineData("A", "a", 0)] + [InlineData("Ab", "aB", 0)] + [InlineData("aB", "Ab", 0)] + [InlineData("aB", "Aa", 1)] + [InlineData("aa", "aB", -1)] + [InlineData("\u0160a", "\u0160A", 0)] + [InlineData("\u0160a", "\u0160B", -1)] + [InlineData("\u0160b", "\u0160A", 1)] + [InlineData("\u0160b\u0160\u0160\u0160", "\u0160A\u0160\u0160\u0160", 1)] + [InlineData("\u0160A\u0160\u0160\u0160", "\u0160b\u0160\u0160\u0160", -1)] + public static void TestCompareOrdinalIgnoreCase(string a, string b, int sign) + { + Assert.Equal(sign, Math.Sign(string.Compare(a, b, StringComparison.OrdinalIgnoreCase))); + } } } diff --git a/src/libraries/System.Runtime/tests/System/TimeOnlyTests.cs b/src/libraries/System.Runtime/tests/System/TimeOnlyTests.cs index b39e94e00d1dc9..f74a4012747489 100644 --- a/src/libraries/System.Runtime/tests/System/TimeOnlyTests.cs +++ b/src/libraries/System.Runtime/tests/System/TimeOnlyTests.cs @@ -483,6 +483,17 @@ public static void TryFormatTest() Assert.False(timeOnly.TryFormat(buffer.Slice(0, 3), out charsWritten)); Assert.False(timeOnly.TryFormat(buffer.Slice(0, 3), out charsWritten, "r")); Assert.False(timeOnly.TryFormat(buffer.Slice(0, 3), out charsWritten, "O")); + + Assert.Throws(() => { + Span buff = stackalloc char[100]; + timeOnly.TryFormat(buff, out charsWritten, "u"); + }); + Assert.Throws(() => { + Span buff = stackalloc char[100]; + timeOnly.TryFormat(buff, out charsWritten, "dd-yyyy"); + }); + Assert.Throws(() => $"{timeOnly:u}"); + Assert.Throws(() => $"{timeOnly:dd-yyyy}"); } } } diff --git a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs index 38c8bd8c3393a0..f9139160f19975 100644 --- a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs @@ -87,46 +87,44 @@ public static void Names() // Name abbreviations, if available, are used instead public static IEnumerable Platform_TimeZoneNamesTestData() { - if (PlatformDetection.IsBrowser) - return new TheoryData + if (PlatformDetection.IsBrowser || PlatformDetection.IsiOS || PlatformDetection.IstvOS) + return new TheoryData { - { TimeZoneInfo.FindSystemTimeZoneById(s_strPacific), "(UTC-08:00) America/Los_Angeles", "PST", "PDT" }, - { TimeZoneInfo.FindSystemTimeZoneById(s_strSydney), "(UTC+10:00) Australia/Sydney", "AEST", "AEDT" }, - { TimeZoneInfo.FindSystemTimeZoneById(s_strPerth), "(UTC+08:00) Australia/Perth", "AWST", "AWDT" }, - { TimeZoneInfo.FindSystemTimeZoneById(s_strIran), "(UTC+03:30) Asia/Tehran", "+0330", "+0430" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strPacific), "(UTC-08:00) America/Los_Angeles", null, "PST", "PDT" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strSydney), "(UTC+10:00) Australia/Sydney", null, "AEST", "AEDT" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strPerth), "(UTC+08:00) Australia/Perth", null, "AWST", "AWDT" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strIran), "(UTC+03:30) Asia/Tehran", null, "+0330", "+0430" }, - { s_NewfoundlandTz, "(UTC-03:30) America/St_Johns", "NST", "NDT" }, - { s_catamarcaTz, "(UTC-03:00) America/Argentina/Catamarca", "-03", "-02" } + { s_NewfoundlandTz, "(UTC-03:30) America/St_Johns", null, "NST", "NDT" }, + { s_catamarcaTz, "(UTC-03:00) America/Argentina/Catamarca", null, "-03", "-02" } }; else if (PlatformDetection.IsWindows) - return new TheoryData + return new TheoryData { - { TimeZoneInfo.FindSystemTimeZoneById(s_strPacific), "(UTC-08:00) Pacific Time (US & Canada)", "Pacific Standard Time", "Pacific Daylight Time" }, - { TimeZoneInfo.FindSystemTimeZoneById(s_strSydney), "(UTC+10:00) Canberra, Melbourne, Sydney", "AUS Eastern Standard Time", "AUS Eastern Daylight Time" }, - { TimeZoneInfo.FindSystemTimeZoneById(s_strPerth), "(UTC+08:00) Perth", "W. Australia Standard Time", "W. Australia Daylight Time" }, - { TimeZoneInfo.FindSystemTimeZoneById(s_strIran), "(UTC+03:30) Tehran", "Iran Standard Time", "Iran Daylight Time" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strPacific), "(UTC-08:00) Pacific Time (US & Canada)", null, "Pacific Standard Time", "Pacific Daylight Time" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strSydney), "(UTC+10:00) Canberra, Melbourne, Sydney", null, "AUS Eastern Standard Time", "AUS Eastern Daylight Time" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strPerth), "(UTC+08:00) Perth", null, "W. Australia Standard Time", "W. Australia Daylight Time" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strIran), "(UTC+03:30) Tehran", null, "Iran Standard Time", "Iran Daylight Time" }, - { s_NewfoundlandTz, "(UTC-03:30) Newfoundland", "Newfoundland Standard Time", "Newfoundland Daylight Time" }, - { s_catamarcaTz, "(UTC-03:00) City of Buenos Aires", "Argentina Standard Time", "Argentina Daylight Time" } + { s_NewfoundlandTz, "(UTC-03:30) Newfoundland", null, "Newfoundland Standard Time", "Newfoundland Daylight Time" }, + { s_catamarcaTz, "(UTC-03:00) City of Buenos Aires", null, "Argentina Standard Time", "Argentina Daylight Time" } }; else - return new TheoryData + return new TheoryData { - { TimeZoneInfo.FindSystemTimeZoneById(s_strPacific), "(UTC-08:00) Pacific Time (Los Angeles)", "Pacific Standard Time", "Pacific Daylight Time" }, - { TimeZoneInfo.FindSystemTimeZoneById(s_strSydney), "(UTC+10:00) Eastern Australia Time (Sydney)", "Australian Eastern Standard Time", "Australian Eastern Daylight Time" }, - { TimeZoneInfo.FindSystemTimeZoneById(s_strPerth), "(UTC+08:00) Australian Western Standard Time (Perth)", "Australian Western Standard Time", "Australian Western Daylight Time" }, - { TimeZoneInfo.FindSystemTimeZoneById(s_strIran), "(UTC+03:30) Iran Time", "Iran Standard Time", "Iran Daylight Time" }, - - { s_NewfoundlandTz, "(UTC-03:30) Newfoundland Time (St. John’s)", "Newfoundland Standard Time", "Newfoundland Daylight Time" }, - { s_catamarcaTz, "(UTC-03:00) Argentina Standard Time (Catamarca)", "Argentina Standard Time", "Argentina Summer Time" } + { TimeZoneInfo.FindSystemTimeZoneById(s_strPacific), "(UTC-08:00) Pacific Time (Los Angeles)", null, "Pacific Standard Time", "Pacific Daylight Time" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strSydney), "(UTC+10:00) Eastern Australia Time (Sydney)", null, "Australian Eastern Standard Time", "Australian Eastern Daylight Time" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strPerth), "(UTC+08:00) Australian Western Standard Time (Perth)", null, "Australian Western Standard Time", "Australian Western Daylight Time" }, + { TimeZoneInfo.FindSystemTimeZoneById(s_strIran), "(UTC+03:30) Iran Time", "(UTC+03:30) Iran Standard Time (Tehran)", "Iran Standard Time", "Iran Daylight Time" }, + { s_NewfoundlandTz, "(UTC-03:30) Newfoundland Time (St. John’s)", null, "Newfoundland Standard Time", "Newfoundland Daylight Time" }, + { s_catamarcaTz, "(UTC-03:00) Argentina Standard Time (Catamarca)", null, "Argentina Standard Time", "Argentina Summer Time" } }; } // We test the existence of a specific English time zone name to avoid failures on non-English platforms. [ConditionalTheory(nameof(IsEnglishUILanguage))] [MemberData(nameof(Platform_TimeZoneNamesTestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] - public static void Platform_TimeZoneNames(TimeZoneInfo tzi, string displayName, string standardName, string daylightName) + public static void Platform_TimeZoneNames(TimeZoneInfo tzi, string displayName, string alternativeDisplayName, string standardName, string daylightName) { // Edge case - Optionally allow some characters to be absent in the display name. const string chars = ".’"; @@ -138,8 +136,10 @@ public static void Platform_TimeZoneNames(TimeZoneInfo tzi, string displayName, } } - Assert.Equal($"DisplayName: \"{displayName}\", StandardName: {standardName}\", DaylightName: {daylightName}\"", - $"DisplayName: \"{tzi.DisplayName}\", StandardName: {tzi.StandardName}\", DaylightName: {tzi.DaylightName}\""); + Assert.True(displayName == tzi.DisplayName || alternativeDisplayName == tzi.DisplayName, + $"Display Name: Neither '{displayName}' nor '{alternativeDisplayName}' equal to '{tzi.DisplayName}'"); + Assert.Equal(standardName, tzi.StandardName); + Assert.Equal(daylightName, tzi.DaylightName); } [Fact] @@ -2092,6 +2092,11 @@ public static IEnumerable ConvertTime_DateTimeOffset_InvalidDestinatio yield return new object[] { s_strPacific + "\\Display" }; yield return new object[] { s_strPacific + "\n" }; // no trailing newline yield return new object[] { new string('a', 100) }; // long string + yield return new object[] { "/dev/random" }; + yield return new object[] { "Invalid Id" }; + yield return new object[] { "Invalid/Invalid" }; + yield return new object[] { $"./{s_strPacific}" }; + yield return new object[] { $"{s_strPacific}/../{s_strPacific}" }; } [Theory] @@ -2099,7 +2104,8 @@ public static IEnumerable ConvertTime_DateTimeOffset_InvalidDestinatio public static void ConvertTime_DateTimeOffset_InvalidDestination_TimeZoneNotFoundException(string destinationId) { DateTimeOffset time1 = new DateTimeOffset(2006, 5, 12, 0, 0, 0, TimeSpan.Zero); - VerifyConvertException(time1, destinationId); + Exception ex = Record.Exception(() => TimeZoneInfo.ConvertTime(time1, TimeZoneInfo.FindSystemTimeZoneById(destinationId))); + Assert.True(ex is InvalidTimeZoneException || ex is TimeZoneNotFoundException); } [Fact] @@ -2542,6 +2548,30 @@ public static void NJulianRuleTest(string posixRule, int dayNumber, int monthNum } } + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + public static void TimeZoneInfo_LocalZoneWithInvariantMode() + { + string hostTZId = TimeZoneInfo.Local.Id; + + ProcessStartInfo psi = new ProcessStartInfo() { UseShellExecute = false }; + psi.Environment.Add("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", PlatformDetection.IsInvariantGlobalization ? "0" : "1"); + + RemoteExecutor.Invoke((tzId, hostIsRunningInInvariantMode) => + { + bool hostInvariantMode = bool.Parse(hostIsRunningInInvariantMode); + + if (!hostInvariantMode) + { + // If hostInvariantMode is false, means the child process should enable the globalization invariant mode. + // We validate here that by trying to create a culture which should throws in such mode. + Assert.Throws(() => CultureInfo.GetCultureInfo("en-US")); + } + + Assert.Equal(tzId, TimeZoneInfo.Local.Id); + + }, hostTZId, PlatformDetection.IsInvariantGlobalization.ToString(), new RemoteInvokeOptions { StartInfo = psi}).Dispose(); + } + [Fact] public static void TimeZoneInfo_DaylightDeltaIsNoMoreThan12Hours() { @@ -2623,10 +2653,9 @@ public static void EnsureUtcObjectSingleton() [InlineData("Argentina Standard Time", "America/Argentina/Catamarca")] [InlineData("Newfoundland Standard Time", "America/St_Johns")] [InlineData("Iran Standard Time", "Asia/Tehran")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public static void UsingAlternativeTimeZoneIdsTest(string windowsId, string ianaId) { - if (PlatformDetection.ICUVersion.Major >= 52) + if (PlatformDetection.ICUVersion.Major >= 52 && !PlatformDetection.IsiOS && !PlatformDetection.IstvOS) { TimeZoneInfo tzi1 = TimeZoneInfo.FindSystemTimeZoneById(ianaId); TimeZoneInfo tzi2 = TimeZoneInfo.FindSystemTimeZoneById(windowsId); @@ -2641,14 +2670,33 @@ public static void UsingAlternativeTimeZoneIdsTest(string windowsId, string iana } } - public static bool SupportIanaNamesConversion => PlatformDetection.IsNotBrowser && PlatformDetection.ICUVersion.Major >= 52; + public static bool SupportIanaNamesConversion => PlatformDetection.IsNotMobile && PlatformDetection.ICUVersion.Major >= 52; + public static bool SupportIanaNamesConversionAndRemoteExecution => SupportIanaNamesConversion && RemoteExecutor.IsSupported; + + // This test is executed using the remote execution because it needs to run before creating the time zone cache to ensure testing with that state. + // There are already other tests that test after creating the cache. + [ConditionalFact(nameof(SupportIanaNamesConversionAndRemoteExecution))] + public static void IsIanaIdWithNotCacheTest() + { + RemoteExecutor.Invoke(() => + { + Assert.Equal(!s_isWindows || TimeZoneInfo.Local.Id.Equals("Utc", StringComparison.OrdinalIgnoreCase), TimeZoneInfo.Local.HasIanaId); + + TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"); + Assert.False(tzi.HasIanaId); + + tzi = TimeZoneInfo.FindSystemTimeZoneById("Europe/Berlin"); + Assert.True(tzi.HasIanaId); + }).Dispose(); + } [ConditionalFact(nameof(SupportIanaNamesConversion))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public static void IsIanaIdTest() { bool expected = !s_isWindows; + Assert.Equal((expected || TimeZoneInfo.Local.Id.Equals("Utc", StringComparison.OrdinalIgnoreCase)), TimeZoneInfo.Local.HasIanaId); + foreach (TimeZoneInfo tzi in TimeZoneInfo.GetSystemTimeZones()) { Assert.True((expected || tzi.Id.Equals("Utc", StringComparison.OrdinalIgnoreCase)) == tzi.HasIanaId, $"`{tzi.Id}` has wrong IANA Id indicator"); @@ -2674,7 +2722,6 @@ public static void IsIanaIdTest() [InlineData("Argentina Standard Time", "America/Buenos_Aires")] [InlineData("Newfoundland Standard Time", "America/St_Johns")] [InlineData("Iran Standard Time", "Asia/Tehran")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public static void IdsConversionsTest(string windowsId, string ianaId) { Assert.True(TimeZoneInfo.TryConvertIanaIdToWindowsId(ianaId, out string winId)); @@ -2709,7 +2756,6 @@ public static void IdsConversionsTest(string windowsId, string ianaId) [InlineData("GMT Standard Time", "Europe/Dublin", "ie")] [InlineData("W. Europe Standard Time", "Europe/Rome", "it")] [InlineData("New Zealand Standard Time", "Pacific/Auckland", "nz")] - [ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public static void IdsConversionsWithRegionTest(string windowsId, string ianaId, string region) { Assert.True(TimeZoneInfo.TryConvertWindowsIdToIanaId(windowsId, region, out string ianaConvertedId)); @@ -2834,6 +2880,27 @@ public static void AdjustmentRuleBaseUtcOffsetDeltaTest() Assert.Equal(new TimeSpan(2, 0, 0), customTimeZone.GetUtcOffset(new DateTime(2021, 3, 10, 2, 0, 0))); } + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/64111", TestPlatforms.Linux)] + public static void NoBackwardTimeZones() + { + ReadOnlyCollection tzCollection = TimeZoneInfo.GetSystemTimeZones(); + HashSet tzDisplayNames = new HashSet(); + + foreach (TimeZoneInfo timezone in tzCollection) + { + tzDisplayNames.Add(timezone.DisplayName); + } + Assert.Equal(tzCollection.Count, tzDisplayNames.Count); + } + + [Fact] + [PlatformSpecific(TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS)] + public static void LocalTzIsNotUtc() + { + Assert.NotEqual(TimeZoneInfo.Utc.StandardName, TimeZoneInfo.Local.StandardName); + } + private static bool IsEnglishUILanguage => CultureInfo.CurrentUICulture.Name.Length == 0 || CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "en"; private static bool IsEnglishUILanguageAndRemoteExecutorSupported => IsEnglishUILanguage && RemoteExecutor.IsSupported; @@ -3062,6 +3129,14 @@ private static unsafe int EnumUiLanguagesCallback(char* lpUiLanguageString, IntP // native string is null terminated var cultureName = new string(lpUiLanguageString); + string tzResourceFilePath = Path.Join(Environment.SystemDirectory, cultureName, "tzres.dll.mui"); + if (!File.Exists(tzResourceFilePath)) + { + // If Windows installed a UI language but did not include the time zone resources DLL for that language, + // then skip this language as .NET will not be able to get the localized resources for that language. + return 1; + } + try { var handle = GCHandle.FromIntPtr(lParam); diff --git a/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs b/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs index f8816f13a62ab7..a749e939d226e3 100644 --- a/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs +++ b/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs @@ -923,6 +923,16 @@ public void IsContextful() Assert.True(!typeof(ContextBoundClass).IsContextful); } + [Fact] + public void MakeGenericType_NonRuntimeType() + { + foreach (Type nonRuntimeType in Helpers.NonRuntimeTypes) + { + Type t = typeof(List<>).MakeGenericType(nonRuntimeType); + Assert.NotNull(t); + } + } + #region GetInterfaceMap tests public static IEnumerable GetInterfaceMap_TestData() { diff --git a/src/libraries/System.Security.AccessControl/NuGet.config b/src/libraries/System.Security.AccessControl/NuGet.config new file mode 100644 index 00000000000000..a66b7f9b013241 --- /dev/null +++ b/src/libraries/System.Security.AccessControl/NuGet.config @@ -0,0 +1,12 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.Evidence.cs b/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.Evidence.cs deleted file mode 100644 index 9c42db1a8f5189..00000000000000 --- a/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.Evidence.cs +++ /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. -// ------------------------------------------------------------------------------ -// Changes to this file must follow the https://aka.ms/api-review process. -// ------------------------------------------------------------------------------ - -#nullable enable - -namespace System.Security.Policy -{ - public sealed partial class Evidence : System.Collections.ICollection, System.Collections.IEnumerable - { - public Evidence() { } - [System.ObsoleteAttribute("This constructor is obsolete. Use the constructor which accepts arrays of EvidenceBase instead.")] - public Evidence(object[] hostEvidence, object[] assemblyEvidence) { } - public Evidence(System.Security.Policy.Evidence evidence) { } - public Evidence(System.Security.Policy.EvidenceBase[] hostEvidence, System.Security.Policy.EvidenceBase[] assemblyEvidence) { } - [System.ObsoleteAttribute("Evidence should not be treated as an ICollection. Use GetHostEnumerator and GetAssemblyEnumerator to iterate over the evidence to collect a count.")] - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public bool IsSynchronized { get { throw null; } } - public bool Locked { get { throw null; } set { } } - public object SyncRoot { get { throw null; } } - [System.ObsoleteAttribute("Evidence.AddAssembly has been deprecated. Use AddAssemblyEvidence instead.")] - public void AddAssembly(object id) { } - public void AddAssemblyEvidence(T evidence) where T : System.Security.Policy.EvidenceBase { } - [System.ObsoleteAttribute("Evidence.AddHost has been deprecated. Use AddHostEvidence instead.")] - public void AddHost(object id) { } - public void AddHostEvidence(T evidence) where T : System.Security.Policy.EvidenceBase { } - public void Clear() { } - public System.Security.Policy.Evidence? Clone() { throw null; } - [System.ObsoleteAttribute("Evidence should not be treated as an ICollection. Use the GetHostEnumerator and GetAssemblyEnumerator methods rather than using CopyTo.")] - public void CopyTo(System.Array array, int index) { } - public System.Collections.IEnumerator GetAssemblyEnumerator() { throw null; } - public T? GetAssemblyEvidence() where T : System.Security.Policy.EvidenceBase { throw null; } - [System.ObsoleteAttribute("GetEnumerator is obsolete. Use GetAssemblyEnumerator and GetHostEnumerator instead.")] - public System.Collections.IEnumerator GetEnumerator() { throw null; } - public System.Collections.IEnumerator GetHostEnumerator() { throw null; } - public T? GetHostEvidence() where T : System.Security.Policy.EvidenceBase { throw null; } - public void Merge(System.Security.Policy.Evidence evidence) { } - public void RemoveType(System.Type t) { } - } - public abstract partial class EvidenceBase - { - protected EvidenceBase() { } - public virtual System.Security.Policy.EvidenceBase? Clone() { throw null; } - } -} diff --git a/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.cs b/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.cs index b47ecfdc101652..e7007ca46d5046 100644 --- a/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.cs +++ b/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.cs @@ -530,3 +530,44 @@ public void SetAudit(System.Security.AccessControl.AuditFlags auditFlags, System public void SetAudit(System.Security.Principal.SecurityIdentifier sid, System.Security.AccessControl.ObjectAuditRule rule) { } } } + +namespace System.Security.Policy +{ + public sealed partial class Evidence : System.Collections.ICollection, System.Collections.IEnumerable + { + public Evidence() { } + [System.ObsoleteAttribute("This constructor is obsolete. Please use the constructor which takes arrays of EvidenceBase instead.")] + public Evidence(object[] hostEvidence, object[] assemblyEvidence) { } + public Evidence(System.Security.Policy.Evidence evidence) { } + public Evidence(System.Security.Policy.EvidenceBase[] hostEvidence, System.Security.Policy.EvidenceBase[] assemblyEvidence) { } + [System.ObsoleteAttribute("Evidence should not be treated as an ICollection. Please use GetHostEnumerator and GetAssemblyEnumerator to iterate over the evidence to collect a count.")] + public int Count { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public bool Locked { get { throw null; } set { } } + public object SyncRoot { get { throw null; } } + [System.ObsoleteAttribute("This method is obsolete. Please use AddAssemblyEvidence instead.")] + public void AddAssembly(object id) { } + public void AddAssemblyEvidence(T evidence) where T : System.Security.Policy.EvidenceBase { } + [System.ObsoleteAttribute("This method is obsolete. Please use AddHostEvidence instead.")] + public void AddHost(object id) { } + public void AddHostEvidence(T evidence) where T : System.Security.Policy.EvidenceBase { } + public void Clear() { } + public System.Security.Policy.Evidence? Clone() { throw null; } + [System.ObsoleteAttribute("Evidence should not be treated as an ICollection. Please use the GetHostEnumerator and GetAssemblyEnumerator methods rather than using CopyTo.")] + public void CopyTo(System.Array array, int index) { } + public System.Collections.IEnumerator GetAssemblyEnumerator() { throw null; } + public T? GetAssemblyEvidence() where T : System.Security.Policy.EvidenceBase { throw null; } + [System.ObsoleteAttribute("GetEnumerator is obsolete. Please use GetAssemblyEnumerator and GetHostEnumerator instead.")] + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public System.Collections.IEnumerator GetHostEnumerator() { throw null; } + public T? GetHostEvidence() where T : System.Security.Policy.EvidenceBase { throw null; } + public void Merge(System.Security.Policy.Evidence evidence) { } + public void RemoveType(System.Type t) { } + } + public abstract partial class EvidenceBase + { + protected EvidenceBase() { } + public virtual System.Security.Policy.EvidenceBase? Clone() { throw null; } + } +} diff --git a/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.csproj b/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.csproj index 348ff2fe1971ed..d2f2a11fc11313 100644 --- a/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.csproj +++ b/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.csproj @@ -1,13 +1,16 @@ - $(NetCoreAppCurrent) + $(NetCoreAppCurrent);netstandard2.0;net461 enable - - + + - + + + + \ No newline at end of file diff --git a/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.net461.cs b/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.net461.cs new file mode 100644 index 00000000000000..ff36e7ac841258 --- /dev/null +++ b/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.net461.cs @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// ------------------------------------------------------------------------------ +// Changes to this file must follow the https://aka.ms/api-review process. +// ------------------------------------------------------------------------------ + +using System.Runtime.CompilerServices; + +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AccessControlActions))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AccessControlModification))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AccessControlSections))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AccessControlType))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AccessRule))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AccessRule<>))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AceEnumerator))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AceFlags))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AceQualifier))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AceType))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AuditFlags))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AuditRule))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AuditRule<>))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AuthorizationRule))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.AuthorizationRuleCollection))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.CommonAce))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.CommonAcl))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.CommonObjectSecurity))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.CommonSecurityDescriptor))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.CompoundAce))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.CompoundAceType))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.ControlFlags))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.CustomAce))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.DiscretionaryAcl))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.GenericAce))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.GenericAcl))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.GenericSecurityDescriptor))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.InheritanceFlags))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.KnownAce))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.NativeObjectSecurity))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.ObjectAccessRule))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.ObjectAce))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.ObjectAceFlags))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.ObjectAuditRule))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.ObjectSecurity))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.ObjectSecurity<>))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.PrivilegeNotHeldException))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.PropagationFlags))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.QualifiedAce))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RawAcl))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RawSecurityDescriptor))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.ResourceType))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.SecurityInfos))] +[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.SystemAcl))] +[assembly: TypeForwardedTo(typeof(System.Security.Policy.Evidence))] +[assembly: TypeForwardedTo(typeof(System.Security.Policy.EvidenceBase))] diff --git a/src/libraries/System.Security.AccessControl/src/CompatibilitySuppressions.xml b/src/libraries/System.Security.AccessControl/src/CompatibilitySuppressions.xml new file mode 100644 index 00000000000000..6cb765819a0e14 --- /dev/null +++ b/src/libraries/System.Security.AccessControl/src/CompatibilitySuppressions.xml @@ -0,0 +1,37 @@ + + + + CP0001 + T:System.Security.Policy.Evidence + lib/netstandard2.0/System.Security.AccessControl.dll + lib/net461/System.Security.AccessControl.dll + + + CP0001 + T:System.Security.Policy.EvidenceBase + lib/netstandard2.0/System.Security.AccessControl.dll + lib/net461/System.Security.AccessControl.dll + + + CP0002 + M:System.Security.AccessControl.ObjectSecurity.get_SecurityDescriptor + lib/netstandard2.0/System.Security.AccessControl.dll + lib/net461/System.Security.AccessControl.dll + + + PKV006 + .NETFramework,Version=v4.6 + + + PKV006 + .NETStandard,Version=v1.3 + + + PKV007 + .NETFramework,Version=v4.6-win + + + PKV007 + .NETStandard,Version=v1.3-win + + \ No newline at end of file diff --git a/src/libraries/System.Security.AccessControl/src/ILLink/ILLink.Descriptors.LibraryBuild.xml b/src/libraries/System.Security.AccessControl/src/ILLink/ILLink.Descriptors.LibraryBuild.xml new file mode 100644 index 00000000000000..881d8ee5fd369b --- /dev/null +++ b/src/libraries/System.Security.AccessControl/src/ILLink/ILLink.Descriptors.LibraryBuild.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/libraries/System.Security.AccessControl/src/System.Security.AccessControl.csproj b/src/libraries/System.Security.AccessControl/src/System.Security.AccessControl.csproj index ae2bd9f64570a4..3798a017853477 100644 --- a/src/libraries/System.Security.AccessControl/src/System.Security.AccessControl.csproj +++ b/src/libraries/System.Security.AccessControl/src/System.Security.AccessControl.csproj @@ -1,14 +1,27 @@ true - $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent) + $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netstandard2.0-windows;netstandard2.0;net461-windows + true + + false + 1 + Provides base classes that enable managing access and audit control lists on securable objects. + +Commonly Used Types: +System.Security.AccessControl.AccessRule +System.Security.AccessControl.AuditRule +System.Security.AccessControl.ObjectAccessRule +System.Security.AccessControl.ObjectAuditRule +System.Security.AccessControl.ObjectSecurity enable + true SR.PlatformNotSupported_AccessControl - + @@ -78,8 +91,7 @@ - - + @@ -87,8 +99,12 @@ + + + + diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs index 3a7b7974455df4..9a145e6ced5f25 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs @@ -94,6 +94,11 @@ public EvpHashProvider(IntPtr algorithmEvp) public override void AppendHashData(ReadOnlySpan data) { + if (data.IsEmpty) + { + return; + } + _running = true; Check(Interop.Crypto.EvpDigestUpdate(_ctx, data, data.Length)); } @@ -166,6 +171,11 @@ public HmacHashProvider(IntPtr algorithmEvp, ReadOnlySpan key) public override void AppendHashData(ReadOnlySpan data) { + if (data.IsEmpty) + { + return; + } + _running = true; Check(Interop.Crypto.HmacUpdate(_hmacCtx, data, data.Length)); } diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs index c72dcb4c932499..e9275bc28ae3cc 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Pbkdf2Implementation.Windows.cs @@ -16,9 +16,9 @@ namespace Internal.Cryptography { internal static partial class Pbkdf2Implementation { - // For Windows 7 we will use BCryptDeriveKeyPBKDF2. For Windows 8+ we will use BCryptKeyDerivation - // since it has better performance. - private static readonly bool s_useKeyDerivation = OperatingSystem.IsWindowsVersionAtLeast(8, 0, 0); + // For Windows 7 we will use BCryptDeriveKeyPBKDF2. For Windows 8+ (seen as version 6.2.0) we will + // use BCryptKeyDerivation since it has better performance. + private static readonly bool s_useKeyDerivation = OperatingSystem.IsWindowsVersionAtLeast(6, 2); // A cached instance of PBKDF2 for Windows 8, where pseudo handles are not supported. private static SafeBCryptAlgorithmHandle? s_pbkdf2AlgorithmHandle; diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj index 754b2e38861435..827f8cb469209b 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj +++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj @@ -1,4 +1,4 @@ - + true $(DefineConstants);INTERNAL_ASYMMETRIC_IMPLEMENTATIONS @@ -132,6 +132,8 @@ Link="Common\System\Security\Cryptography\KeyFormatHelper.cs" /> + (), 0, 0); + hash.Initialize(); + hash.TransformFinalBlock(hashInput, 0, hashInput.Length); + + Assert.Equal(expectedDigest, hash.Hash); + } + } + protected class DataRepeatingStream : Stream { private int _remaining; diff --git a/src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj b/src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj index fb654f6698bfef..a5d3de98c3b837 100644 --- a/src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj +++ b/src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj @@ -212,6 +212,8 @@ Link="Common\System\Security\Cryptography\KeyFormatHelper.cs" /> + s_lateBoundOidToFriendlyName = new ConcurrentDictionary(); - private static readonly ConcurrentDictionary s_lateBoundFriendlyNameToOid = - new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); + private static readonly ConcurrentDictionary s_lateBoundFriendlyNameToOid = + new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); // // Attempts to map a friendly name to an OID. Returns null if not a known name. @@ -80,19 +80,13 @@ internal static partial class OidLookup mappedOid = NativeFriendlyNameToOid(friendlyName, oidGroup, fallBackToAllGroups); - if (shouldUseCache) + if (shouldUseCache && mappedOid != null) { s_lateBoundFriendlyNameToOid.TryAdd(friendlyName, mappedOid); // Don't add the reverse here. Friendly Name => OID is a case insensitive search, // so the casing provided as input here may not be the 'correct' one. Just let // ToFriendlyName capture the response and cache it itself. - - // Also, mappedOid could be null here if the lookup failed. Allowing storing null - // means we're able to cache that a lookup failed so we don't repeat it. It's - // theoretically possible, however, the failure could have been intermittent, e.g. - // if the call was forced to follow an AD fallback path and the relevant servers - // were offline. } return mappedOid; diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs index 0f63a74998dd43..bb1b734a8e5311 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs @@ -101,11 +101,12 @@ public static void TestSubjectAlternativeName_Unix() sanExtension); string s = asnData.Format(false); + bool isOpenSsl3 = PlatformDetection.IsOpenSsl3; string expected = string.Join( ", ", // Choice[0]: OtherName - "othername:", + isOpenSsl3 ? "othername: UPN::subjectupn1@example.org" : "othername:", // Choice[1]: Rfc822Name (EmailAddress) "email:sanemail1@example.org", // Choice[2]: DnsName @@ -123,7 +124,7 @@ public static void TestSubjectAlternativeName_Unix() // Choice[7]: IPAddress (IPv6) "IP Address:2001:DB8:AC10:FE01:0:0:0:0", // Choice[7]: IPAddress (unknown type) - "IP Address:", + isOpenSsl3 ? "IP Address:" : "IP Address:", // Choice[7]: IPAddress (IPv4, longer string) "IP Address:255.255.255.255", // Choice[7]: IPAddress (IPv4, medium string) diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/CompatibilitySuppressions.xml b/src/libraries/System.Security.Cryptography.Pkcs/src/CompatibilitySuppressions.xml index 59a3d702ec042e..b56749eac2c275 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/CompatibilitySuppressions.xml @@ -1,7 +1,86 @@ - + - CP0001 + CP0002 + M:System.Security.Cryptography.Pkcs.CmsSigner.get_PrivateKey + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.CmsSigner.set_PrivateKey(System.Security.Cryptography.AsymmetricAlgorithm) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.CmsSigner.#ctor(System.Security.Cryptography.Pkcs.SubjectIdentifierType,System.Security.Cryptography.X509Certificates.X509Certificate2,System.Security.Cryptography.AsymmetricAlgorithm) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.ContentInfo.GetContentType(System.ReadOnlySpan{System.Byte}) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.EnvelopedCms.Decode(System.ReadOnlySpan{System.Byte}) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.EnvelopedCms.Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo,System.Security.Cryptography.AsymmetricAlgorithm) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.SignedCms.Decode(System.ReadOnlySpan{System.Byte}) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.SignedCms.AddCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.SignedCms.RemoveCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.SignerInfo.GetSignature + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.SignerInfo.get_SignatureAlgorithm + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.SignerInfo.AddUnsignedAttribute(System.Security.Cryptography.AsnEncodedData) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.SignerInfo.RemoveUnsignedAttribute(System.Security.Cryptography.AsnEncodedData) + lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll + lib/net461/System.Security.Cryptography.Pkcs.dll + + + CP0002 + M:System.Security.Cryptography.Pkcs.SubjectIdentifier.MatchesCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2) lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll lib/net461/System.Security.Cryptography.Pkcs.dll diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj b/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj index 035c881a0064b1..3bb3f45e43cd3d 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj @@ -6,6 +6,9 @@ enable $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.1-windows;netstandard2.1;netstandard2.0-windows;netstandard2.0;net461-windows true + + false + 4 Provides support for PKCS and CMS algorithms. Commonly Used Types: @@ -490,6 +493,10 @@ System.Security.Cryptography.Pkcs.EnvelopedCms System\Security\Cryptography\Pkcs\Asn1\MessageImprint.xml + + + System\Security\Cryptography\Pkcs\Asn1\OtherCertificateFormat.xml + @@ -606,6 +613,8 @@ System.Security.Cryptography.Pkcs.EnvelopedCms Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedDataAsn.xml.cs Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedDataAsn.xml + - + diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.xml b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.xml index d9b497ab9d0009..9bc76b343264dc 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.xml +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.xml @@ -15,12 +15,10 @@ other[3] IMPLICIT OtherCertificateFormat } - OtherCertificateFormat ::= SEQUENCE { - otherCertFormat OBJECT IDENTIFIER, - otherCert ANY DEFINED BY otherCertFormat - } - - Except we only support public key certificates, so just trim the choice here. --> + + + + diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.xml.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.xml.cs index c9107fa3d9c286..0b602a0aa55d59 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.xml.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.xml.cs @@ -12,6 +12,10 @@ namespace System.Security.Cryptography.Pkcs.Asn1 internal partial struct CertificateChoiceAsn { internal ReadOnlyMemory? Certificate; + internal ReadOnlyMemory? ExtendedCertificate; + internal ReadOnlyMemory? AttributeCertificateV1; + internal ReadOnlyMemory? AttributeCertificateV2; + internal System.Security.Cryptography.Pkcs.Asn1.OtherCertificateFormat? OtherCertificateFormat; #if DEBUG static CertificateChoiceAsn() @@ -28,6 +32,10 @@ static CertificateChoiceAsn() }; ensureUniqueTag(new Asn1Tag((UniversalTagNumber)16), "Certificate"); + ensureUniqueTag(new Asn1Tag(TagClass.ContextSpecific, 0), "ExtendedCertificate"); + ensureUniqueTag(new Asn1Tag(TagClass.ContextSpecific, 1), "AttributeCertificateV1"); + ensureUniqueTag(new Asn1Tag(TagClass.ContextSpecific, 2), "AttributeCertificateV2"); + ensureUniqueTag(new Asn1Tag(TagClass.ContextSpecific, 3), "OtherCertificateFormat"); } #endif @@ -60,6 +68,90 @@ internal void Encode(AsnWriter writer) wroteValue = true; } + if (ExtendedCertificate.HasValue) + { + if (wroteValue) + throw new CryptographicException(); + + // Validator for tag constraint for ExtendedCertificate + { + if (!Asn1Tag.TryDecode(ExtendedCertificate.Value.Span, out Asn1Tag validateTag, out _) || + !validateTag.HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 0))) + { + throw new CryptographicException(); + } + } + + try + { + writer.WriteEncodedValue(ExtendedCertificate.Value.Span); + } + catch (ArgumentException e) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); + } + wroteValue = true; + } + + if (AttributeCertificateV1.HasValue) + { + if (wroteValue) + throw new CryptographicException(); + + // Validator for tag constraint for AttributeCertificateV1 + { + if (!Asn1Tag.TryDecode(AttributeCertificateV1.Value.Span, out Asn1Tag validateTag, out _) || + !validateTag.HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1))) + { + throw new CryptographicException(); + } + } + + try + { + writer.WriteEncodedValue(AttributeCertificateV1.Value.Span); + } + catch (ArgumentException e) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); + } + wroteValue = true; + } + + if (AttributeCertificateV2.HasValue) + { + if (wroteValue) + throw new CryptographicException(); + + // Validator for tag constraint for AttributeCertificateV2 + { + if (!Asn1Tag.TryDecode(AttributeCertificateV2.Value.Span, out Asn1Tag validateTag, out _) || + !validateTag.HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2))) + { + throw new CryptographicException(); + } + } + + try + { + writer.WriteEncodedValue(AttributeCertificateV2.Value.Span); + } + catch (ArgumentException e) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); + } + wroteValue = true; + } + + if (OtherCertificateFormat.HasValue) + { + if (wroteValue) + throw new CryptographicException(); + + OtherCertificateFormat.Value.Encode(writer, new Asn1Tag(TagClass.ContextSpecific, 3)); + wroteValue = true; + } + if (!wroteValue) { throw new CryptographicException(); @@ -107,6 +199,28 @@ private static void DecodeCore(ref AsnValueReader reader, ReadOnlyMemory r tmpSpan = reader.ReadEncodedValue(); decoded.Certificate = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); } + else if (tag.HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 0))) + { + tmpSpan = reader.ReadEncodedValue(); + decoded.ExtendedCertificate = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); + } + else if (tag.HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1))) + { + tmpSpan = reader.ReadEncodedValue(); + decoded.AttributeCertificateV1 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); + } + else if (tag.HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 2))) + { + tmpSpan = reader.ReadEncodedValue(); + decoded.AttributeCertificateV2 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); + } + else if (tag.HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 3))) + { + System.Security.Cryptography.Pkcs.Asn1.OtherCertificateFormat tmpOtherCertificateFormat; + System.Security.Cryptography.Pkcs.Asn1.OtherCertificateFormat.Decode(ref reader, new Asn1Tag(TagClass.ContextSpecific, 3), rebind, out tmpOtherCertificateFormat); + decoded.OtherCertificateFormat = tmpOtherCertificateFormat; + + } else { throw new CryptographicException(); diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OtherCertificateFormat.xml b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OtherCertificateFormat.xml new file mode 100644 index 00000000000000..704a42f6d64b85 --- /dev/null +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OtherCertificateFormat.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OtherCertificateFormat.xml.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OtherCertificateFormat.xml.cs new file mode 100644 index 00000000000000..aeb18133756af6 --- /dev/null +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OtherCertificateFormat.xml.cs @@ -0,0 +1,98 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#pragma warning disable SA1028 // ignore whitespace warnings for generated code +using System; +using System.Formats.Asn1; +using System.Runtime.InteropServices; + +namespace System.Security.Cryptography.Pkcs.Asn1 +{ + [StructLayout(LayoutKind.Sequential)] + internal partial struct OtherCertificateFormat + { + internal string OtherCertFormat; + internal ReadOnlyMemory OtherCert; + + internal void Encode(AsnWriter writer) + { + Encode(writer, Asn1Tag.Sequence); + } + + internal void Encode(AsnWriter writer, Asn1Tag tag) + { + writer.PushSequence(tag); + + try + { + writer.WriteObjectIdentifier(OtherCertFormat); + } + catch (ArgumentException e) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); + } + try + { + writer.WriteEncodedValue(OtherCert.Span); + } + catch (ArgumentException e) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); + } + writer.PopSequence(tag); + } + + internal static OtherCertificateFormat Decode(ReadOnlyMemory encoded, AsnEncodingRules ruleSet) + { + return Decode(Asn1Tag.Sequence, encoded, ruleSet); + } + + internal static OtherCertificateFormat Decode(Asn1Tag expectedTag, ReadOnlyMemory encoded, AsnEncodingRules ruleSet) + { + try + { + AsnValueReader reader = new AsnValueReader(encoded.Span, ruleSet); + + DecodeCore(ref reader, expectedTag, encoded, out OtherCertificateFormat decoded); + reader.ThrowIfNotEmpty(); + return decoded; + } + catch (AsnContentException e) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); + } + } + + internal static void Decode(ref AsnValueReader reader, ReadOnlyMemory rebind, out OtherCertificateFormat decoded) + { + Decode(ref reader, Asn1Tag.Sequence, rebind, out decoded); + } + + internal static void Decode(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory rebind, out OtherCertificateFormat decoded) + { + try + { + DecodeCore(ref reader, expectedTag, rebind, out decoded); + } + catch (AsnContentException e) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); + } + } + + private static void DecodeCore(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory rebind, out OtherCertificateFormat decoded) + { + decoded = default; + AsnValueReader sequenceReader = reader.ReadSequence(expectedTag); + ReadOnlySpan rebindSpan = rebind.Span; + int offset; + ReadOnlySpan tmpSpan; + + decoded.OtherCertFormat = sequenceReader.ReadObjectIdentifier(); + tmpSpan = sequenceReader.ReadEncodedValue(); + decoded.OtherCert = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); + + sequenceReader.ThrowIfNotEmpty(); + } + } +} diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignedCms.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignedCms.cs index 188ca0039a3c96..07f7f8df07d2ee 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignedCms.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignedCms.cs @@ -89,8 +89,16 @@ public X509Certificate2Collection Certificates foreach (CertificateChoiceAsn choice in certChoices) { - Debug.Assert(choice.Certificate.HasValue); - coll.Add(new X509Certificate2(choice.Certificate.Value.ToArray())); + if (choice.Certificate.HasValue) + { + coll.Add(new X509Certificate2(choice.Certificate.Value +#if NET5_0_OR_GREATER + .Span +#else + .ToArray() +#endif + )); + } } return coll; @@ -669,7 +677,7 @@ public void AddCertificate(X509Certificate2 certificate) { foreach (CertificateChoiceAsn cert in _signedData.CertificateSet!) { - if (cert.Certificate!.Value.Span.SequenceEqual(rawData)) + if (cert.Certificate is not null && cert.Certificate.Value.Span.SequenceEqual(rawData)) { throw new CryptographicException(SR.Cryptography_Cms_CertificateAlreadyInCollection); } @@ -704,7 +712,7 @@ public void RemoveCertificate(X509Certificate2 certificate) foreach (CertificateChoiceAsn cert in _signedData.CertificateSet!) { - if (cert.Certificate!.Value.Span.SequenceEqual(rawData)) + if (cert.Certificate is not null && cert.Certificate.Value.Span.SequenceEqual(rawData)) { PkcsHelpers.RemoveAt(ref _signedData.CertificateSet, idx); Reencode(); diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs index c53e966a72d9e5..c89cfa54bb8c27 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs @@ -1602,6 +1602,15 @@ public static void CheckNoSignature_FromCoreFx_TamperIssuerName() signers[0].CheckHash(); } + [Fact] + public static void Decode_CanDecodeWithAttributeCertificate() + { + SignedCms cms = new SignedCms(); + cms.Decode(SignedDocuments.TstWithAttributeCertificate); + Assert.Equal(2, cms.Certificates.Count); + cms.CheckSignature(verifySignatureOnly: true); + } + private static void CheckNoSignature(byte[] encoded, bool badOid=false) { SignedCms cms = new SignedCms(); diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.netcoreapp.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.netcoreapp.cs index 9d90fe7905550f..8ac10b6bc5aaab 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.netcoreapp.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.netcoreapp.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Formats.Asn1; using System.Linq; using System.Security.Cryptography.X509Certificates; using Test.Cryptography; @@ -377,6 +378,7 @@ public static void AddAttributeToIndefiniteLengthContent() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public static void AddSigner_RSA_EphemeralKey() { using (RSA rsa = RSA.Create()) @@ -397,7 +399,10 @@ public static void AddSigner_RSA_EphemeralKey() { ContentInfo content = new ContentInfo(new byte[] { 1, 2, 3 }); SignedCms cms = new SignedCms(content, false); - CmsSigner signer = new CmsSigner(certWithEphemeralKey); + CmsSigner signer = new CmsSigner(certWithEphemeralKey) + { + IncludeOption = X509IncludeOption.EndCertOnly + }; cms.ComputeSignature(signer); } } @@ -427,7 +432,8 @@ public static void AddSigner_DSA_EphemeralKey() SignedCms cms = new SignedCms(content, false); CmsSigner signer = new CmsSigner(certWithEphemeralKey) { - DigestAlgorithm = new Oid(Oids.Sha1, Oids.Sha1) + DigestAlgorithm = new Oid(Oids.Sha1, Oids.Sha1), + IncludeOption = X509IncludeOption.EndCertOnly }; cms.ComputeSignature(signer); } @@ -435,6 +441,7 @@ public static void AddSigner_DSA_EphemeralKey() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public static void AddSigner_ECDSA_EphemeralKey() { using (ECDsa ecdsa = ECDsa.Create()) @@ -455,7 +462,10 @@ public static void AddSigner_ECDSA_EphemeralKey() { ContentInfo content = new ContentInfo(new byte[] { 1, 2, 3 }); SignedCms cms = new SignedCms(content, false); - CmsSigner signer = new CmsSigner(certWithEphemeralKey); + CmsSigner signer = new CmsSigner(certWithEphemeralKey) + { + IncludeOption = X509IncludeOption.EndCertOnly + }; cms.ComputeSignature(signer); } } @@ -477,6 +487,92 @@ public static void CreateSignature_DigestAlgorithmWithSignatureOid_Prohibited() } } + [Fact] + public static void AddCertificate_CollectionContainsAttributeCertificate() + { + SignedCms signedCms = new SignedCms(); + signedCms.Decode(SignedDocuments.TstWithAttributeCertificate); + signedCms.CheckSignature(true); + + int countBefore = CountCertificateChoices(SignedDocuments.TstWithAttributeCertificate); + + using (X509Certificate2 cert = Certificates.RSA2048SignatureOnly.GetCertificate()) + { + signedCms.AddCertificate(cert); + byte[] reEncoded = signedCms.Encode(); + int countAfter = CountCertificateChoices(reEncoded); + Assert.Equal(countBefore + 1, countAfter); + + signedCms = new SignedCms(); + signedCms.Decode(reEncoded); + signedCms.CheckSignature(true); + } + } + + [Fact] + public static void RemoveCertificate_Existing_CollectionContainsAttributeCertificate() + { + SignedCms signedCms = new SignedCms(); + signedCms.Decode(SignedDocuments.TstWithAttributeCertificate); + int countBefore = CountCertificateChoices(SignedDocuments.TstWithAttributeCertificate); + + signedCms.RemoveCertificate(signedCms.Certificates[0]); + byte[] reEncoded = signedCms.Encode(); + int countAfter = CountCertificateChoices(reEncoded); + Assert.Equal(countBefore - 1, countAfter); + } + + [Fact] + public static void RemoveCertificate_NonExisting_CollectionContainsAttributeCertificate() + { + SignedCms signedCms = new SignedCms(); + signedCms.Decode(SignedDocuments.TstWithAttributeCertificate); + + using (X509Certificate2 cert = Certificates.RSA2048SignatureOnly.GetCertificate()) + { + // Remove a non-existing certificate so that we are forced to enumerate the entire 'certificates[0]' + // collection (including attribute certificates) looking for it. + Assert.Throws(() => signedCms.RemoveCertificate(cert)); + } + } + + [Fact] + public static void ComputeCounterSignature_PreservesAttributeCertificate() + { + SignedCms signedCms = new SignedCms(); + signedCms.Decode(SignedDocuments.TstWithAttributeCertificate); + int countBefore = CountCertificateChoices(SignedDocuments.TstWithAttributeCertificate); + + using (X509Certificate2 cert = Certificates.RSA2048SignatureOnly.TryGetCertificateWithPrivateKey()) + { + CmsSigner signer = new CmsSigner(cert); + SignerInfo info = signedCms.SignerInfos[0]; + info.ComputeCounterSignature(signer); + } + + byte[] encoded = signedCms.Encode(); + int countAfter = CountCertificateChoices(encoded); + Assert.Equal(countBefore + 1, countAfter); + } + + [Fact] + public static void ComputeSignature_PreservesAttributeCertificate() + { + SignedCms signedCms = new SignedCms(); + signedCms.Decode(SignedDocuments.TstWithAttributeCertificate); + int countBefore = CountCertificateChoices(SignedDocuments.TstWithAttributeCertificate); + + using (X509Certificate2 cert = Certificates.RSA2048SignatureOnly.TryGetCertificateWithPrivateKey()) + { + CmsSigner signer = new CmsSigner(cert); + signedCms.ComputeSignature(signer); + } + + byte[] encoded = signedCms.Encode(); + int countAfter = CountCertificateChoices(encoded); + Assert.Equal(countBefore + 1, countAfter); + } + private static void VerifyWithExplicitPrivateKey(X509Certificate2 cert, AsymmetricAlgorithm key) { using (var pubCert = new X509Certificate2(cert.RawData)) @@ -537,5 +633,36 @@ private static void VerifyCounterSignatureWithExplicitPrivateKey(X509Certificate Assert.Equal(counterSignerPubCert, cms.SignerInfos[0].CounterSignerInfos[0].Certificate); } } + + private static int CountCertificateChoices(byte[] encoded) + { + AsnReader reader = new AsnReader(encoded, AsnEncodingRules.BER); + reader = reader.ReadSequence(); + reader.ReadObjectIdentifier(); + reader = reader.ReadSequence(new Asn1Tag(TagClass.ContextSpecific, 0)); + reader = reader.ReadSequence(); + + reader.ReadInteger(); // version + reader.ReadSetOf(); // digestAlgorithms + reader.ReadSequence(); // encapsulatedContentInfo + + Asn1Tag expectedTag = new Asn1Tag(TagClass.ContextSpecific, 0, true); // certificates[0] + + if (reader.PeekTag() == expectedTag) + { + AsnReader certs = reader.ReadSetOf(expectedTag); + int count = 0; + + while (certs.HasData) + { + certs.ReadEncodedValue(); + count++; + } + + return count; + } + + return 0; + } } } diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedDocuments.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedDocuments.cs index 55d42f6b02ee88..cce3114824794e 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedDocuments.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedDocuments.cs @@ -1472,5 +1472,159 @@ internal static class SignedDocuments "2B78166BDB1612848B535ADC3F0E7BE52991A17F48AFDCCC1698A236BA338930" + "50EBAAC4460DAA35185C16670F597E0E6E0CB0AA83F51AAEF452F3367DD9350A" + "8A49A5A8F79DF8E921303AB5D6646A482F0F59D9980310E1AE3EE8D77CB857").HexToByteArray(); + + internal static readonly byte[] TstWithAttributeCertificate = ( + "308212E306092A864886F70D010702A08212D4308212D0020103310F300D0609" + + "608648016503040201050030820159060B2A864886F70D0109100104A0820148" + + "0482014430820140020101060A2B0601040184590A03013031300D0609608648" + + "01650304020105000420C61245B435391DCDD1EFF021681FA2A46E69410A9E23" + + "09F1B1736BB7C2BB504402066148B8B838B11813323032313130303730343230" + + "30372E3037345A3004800201F4A081D8A481D53081D2310B3009060355040613" + + "025553311330110603550408130A57617368696E67746F6E3110300E06035504" + + "0713075265646D6F6E64311E301C060355040A13154D6963726F736F66742043" + + "6F72706F726174696F6E312D302B060355040B13244D6963726F736F66742049" + + "72656C616E64204F7065726174696F6E73204C696D6974656431263024060355" + + "040B131D5468616C6573205453532045534E3A303834322D344245362D433239" + + "41312530230603550403131C4D6963726F736F66742054696D652D5374616D70" + + "2053657276696365A0820E4A308204F9308203E1A00302010202133300000139" + + "CCE8E8438BF034E1000000000139300D06092A864886F70D01010B0500307C31" + + "0B3009060355040613025553311330110603550408130A57617368696E67746F" + + "6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D69" + + "63726F736F667420436F72706F726174696F6E312630240603550403131D4D69" + + "63726F736F66742054696D652D5374616D70205043412032303130301E170D32" + + "30313031353137323832315A170D3232303131323137323832315A3081D2310B" + + "3009060355040613025553311330110603550408130A57617368696E67746F6E" + + "3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963" + + "726F736F667420436F72706F726174696F6E312D302B060355040B13244D6963" + + "726F736F6674204972656C616E64204F7065726174696F6E73204C696D697465" + + "6431263024060355040B131D5468616C6573205453532045534E3A303834322D" + + "344245362D43323941312530230603550403131C4D6963726F736F6674205469" + + "6D652D5374616D70205365727669636530820122300D06092A864886F70D0101" + + "0105000382010F003082010A0282010100DA13F98CE3259325A18EB32A06FCA2" + + "78F85A1F98374F7F50C1DBBA1EA02759C2E5CFDFD92A80BF405CF8E606F469DD" + + "7822FA856859B627AA3EBE185B7F8A1024E1C34DC8D95C12904DB413FF0E8B09" + + "6BDD0979C5425D9AF2711DE3612613BAF145598ABA66C7A04295F90C1874673B" + + "D2AE4EF0CD9892A27F4AD72B16116D9A117172F559FA08386B3CEF13CEFEB282" + + "33615EB3A8CD8A58EFD34B2F597A88B95F84286D5E802AEC091F4F32499DA540" + + "15F39DDF2BC03CF2EBE058A895E29BE6FE57EEC4DFBE356FA710F5F98E340A47" + + "2E1906AA8D3BFC1D783641AAA8EF7BF210235ED5684292A32AEEB2C57CECB294" + + "278F4AE57EC57F1F2496FE5FA2CF1ECA4F0203010001A382011B30820117301D" + + "0603551D0E04160414999E9B867254C299DA928AB19F46F6502D060CE9301F06" + + "03551D23041830168014D5633A5C8A3190F3437B7C461BC533685A856D553056" + + "0603551D1F044F304D304BA049A0478645687474703A2F2F63726C2E6D696372" + + "6F736F66742E636F6D2F706B692F63726C2F70726F64756374732F4D69635469" + + "6D5374615043415F323031302D30372D30312E63726C305A06082B0601050507" + + "0101044E304C304A06082B06010505073002863E687474703A2F2F7777772E6D" + + "6963726F736F66742E636F6D2F706B692F63657274732F4D696354696D537461" + + "5043415F323031302D30372D30312E637274300C0603551D130101FF04023000" + + "30130603551D25040C300A06082B06010505070308300D06092A864886F70D01" + + "010B05000382010100585C286AF3FF371A85CDC15AED438288BF100DB126FBBA" + + "F6118893A16D20F1D758C8AE566B514077FCA7243D6AC9CFD9C71F473FDD32A9" + + "7293FABCF8835C08B1049694A09BDD71B821586C584084B26DA28CDFDFC687E6" + + "B63667158DF5BB831249C97E21A22BA43EF2490235699B5A3D83C51C0417C21F" + + "0708C5EC43E160381D8A52B3E3CEAEC21828B28AF51AE0D68A56231A830DAB79" + + "6BC0322463FF37294A49868AE5A6205D908344B159027F3C842E67BD0B7B5A99" + + "9B4C497C6B519C17E96ADFDDD498100AB2DFA3C9649AE2C13C21BF38C87AA0FC" + + "78ACD4521DEE7C4DBF1231006DA6C1842A36FAD528CA74FA4C026D8DD8AF6B88" + + "3B3FBDFF550AD270C73082067130820459A003020102020A6109812A00000000" + + "0002300D06092A864886F70D01010B0500308188310B30090603550406130255" + + "53311330110603550408130A57617368696E67746F6E3110300E060355040713" + + "075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72" + + "706F726174696F6E31323030060355040313294D6963726F736F667420526F6F" + + "7420436572746966696361746520417574686F726974792032303130301E170D" + + "3130303730313231333635355A170D3235303730313231343635355A307C310B" + + "3009060355040613025553311330110603550408130A57617368696E67746F6E" + + "3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963" + + "726F736F667420436F72706F726174696F6E312630240603550403131D4D6963" + + "726F736F66742054696D652D5374616D7020504341203230313030820122300D" + + "06092A864886F70D01010105000382010F003082010A0282010100A91D0DBC77" + + "118A3A20ECFC1397F5FA7F69946B745410D5A50A008285FBED7C684B2C5FC5C3" + + "E561C276B73E662B5BF015532704311F411B1A951DCE09138E7C613059B13044" + + "0FF160888454430CD74DB83808B342DD93ACD67330572682A3450DD0EAF54781" + + "CDBF246032586046F258478632841E746167915F8154B1CF934C92C1C4A65DD1" + + "61136E28C61AF98680BBDF61FC46C1271D246712721A218AAF4B64895062B15D" + + "FD771F3DF05775ACBD8A424D4051D10F9C063E677FF566C00396447EEFD04BFD" + + "6EE59ACAB1A8F27A2A0A31F0DA4E0691B6880835E8781CB0E999CD3CE72F44BA" + + "A7F4DC64BDA401C120099378CDFCBCC0C9445D5E169C01054F224D0203010001" + + "A38201E6308201E2301006092B06010401823715010403020100301D0603551D" + + "0E04160414D5633A5C8A3190F3437B7C461BC533685A856D55301906092B0601" + + "040182371402040C1E0A00530075006200430041300B0603551D0F0404030201" + + "86300F0603551D130101FF040530030101FF301F0603551D23041830168014D5" + + "F656CB8FE8A25C6268D13D94905BD7CE9A18C430560603551D1F044F304D304B" + + "A049A0478645687474703A2F2F63726C2E6D6963726F736F66742E636F6D2F70" + + "6B692F63726C2F70726F64756374732F4D6963526F6F4365724175745F323031" + + "302D30362D32332E63726C305A06082B06010505070101044E304C304A06082B" + + "06010505073002863E687474703A2F2F7777772E6D6963726F736F66742E636F" + + "6D2F706B692F63657274732F4D6963526F6F4365724175745F323031302D3036" + + "2D32332E6372743081A00603551D200101FF04819530819230818F06092B0601" + + "040182372E03308181303D06082B060105050702011631687474703A2F2F7777" + + "772E6D6963726F736F66742E636F6D2F504B492F646F63732F4350532F646566" + + "61756C742E68746D304006082B0601050507020230341E32201D004C00650067" + + "0061006C005F0050006F006C006900630079005F00530074006100740065006D" + + "0065006E0074002E201D300D06092A864886F70D01010B0500038202010007E6" + + "88510DE2C6E0983F8171033D9DA3A1216FB3EBA6CCF531BECF05E2A9FEFA576D" + + "1930B3C2C566C96ADFF5E7F078BDC7A89E25E3F9BCED6B5457082B51824412FB" + + "B9538CCCF460128A76CC4040419BDC5C17FF5CF95E17359824564B74EF4210C8" + + "AFBF7FC67FF2377D5A3F1CF299794A915200AF380F17F52F798165D9A9B56BE4" + + "C7CEF6CA7A006F4B304424223CCFED03A5968F5929BCB6FD04E1709F324A27FD" + + "55AF2FFEB6E58E33BB625F9ADB5740E9F1CE9966908CFF6A627FDDC54A0B9126" + + "E239EC194A71639D7B216DC39CA3A23CFA7F7D966A9078A66DD2E19CF91DFC38" + + "D894F4C6A50A9686A4BD9E1AAE044283B8B5809B223820B525E564ECF7F4BF7E" + + "6359250F7A2E395776A271AA068A0F8916BA61A711CB9AD80E479A80C5D0CDA7" + + "D0EF7D83F0E13B7109DF5D7498220861DAB0501E6FBDF1E100DFE73107A4933A" + + "F7654778E8F8A848ABF7DE727E616B6F77A981CBA709AC39BBECC6CBD882B472" + + "CD1DF4B885011E80FB1B892A5439B25BDAC80D55997A87733B08E6982DEA8DE0" + + "332E1229F5C02F542721F7C8AC4EDA28B8B1A9DB96B2A742A2C9CF19414DE086" + + "F92A9AA3116630D3BB74324BDF637BF5998A2F1BC721AF59B5AEDC443C975071" + + "D7A1D2C555E369DE57C1D1DE30C0FDCCE64DFB0DBF5D4FE99D1E19382FBCCF58" + + "052EEF0DA05035DAEF09271CD5B37E351E08BADA36DBD35F8FDE74884912A182" + + "02D43082023D02010130820100A181D8A481D53081D2310B3009060355040613" + + "025553311330110603550408130A57617368696E67746F6E3110300E06035504" + + "0713075265646D6F6E64311E301C060355040A13154D6963726F736F66742043" + + "6F72706F726174696F6E312D302B060355040B13244D6963726F736F66742049" + + "72656C616E64204F7065726174696F6E73204C696D6974656431263024060355" + + "040B131D5468616C6573205453532045534E3A303834322D344245362D433239" + + "41312530230603550403131C4D6963726F736F66742054696D652D5374616D70" + + "2053657276696365A2230A0101300706052B0E03021A0315000D4D94FE1BDE96" + + "848D743F1DEE4A04C6B3658C07A08183308180A47E307C310B30090603550406" + + "13025553311330110603550408130A57617368696E67746F6E3110300E060355" + + "040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420" + + "436F72706F726174696F6E312630240603550403131D4D6963726F736F667420" + + "54696D652D5374616D70205043412032303130300D06092A864886F70D010105" + + "0500020500E5084E973022180F32303231313030373030333433315A180F3230" + + "3231313030383030333433315A3074303A060A2B0601040184590A0401312C30" + + "2A300A020500E5084E97020100300702010002021DE630070201000202113630" + + "0A020500E509A0170201003036060A2B0601040184590A040231283026300C06" + + "0A2B0601040184590A0302A00A3008020100020307A120A10A30080201000203" + + "0186A0300D06092A864886F70D0101050500038181002AE0DF2A01AAE13A86C0" + + "2DD8ECA787327C8F04A7C13D47256E65C60676B8372EE46362CD35391B6B898E" + + "DC1884082AAA7CF9B1CF40BE2C30146D0080ACB225C50B7C1FE94694732EDEEB" + + "9EDE73DB7D8C0762CBDFABD3ACCC82DD3858AA16C3ED185A40A39E9676772099" + + "346E3362621286651B06D9AD26D574F967F6C7EC335A3182030D308203090201" + + "01308193307C310B3009060355040613025553311330110603550408130A5761" + + "7368696E67746F6E3110300E060355040713075265646D6F6E64311E301C0603" + + "55040A13154D6963726F736F667420436F72706F726174696F6E312630240603" + + "550403131D4D6963726F736F66742054696D652D5374616D7020504341203230" + + "313002133300000139CCE8E8438BF034E1000000000139300D06096086480165" + + "030402010500A082014A301A06092A864886F70D010903310D060B2A864886F7" + + "0D0109100104302F06092A864886F70D01090431220420EA37C01965AB5A8B08" + + "C2A59F8EF2008C2B60F78E7F0385E2DD18A07C63433EF43081FA060B2A864886" + + "F70D010910022F3181EA3081E73081E43081BD04203CA18EE438A3D7247B3142" + + "B1E28105AE7C6A5527F39A7A9F26A6D4A0070FFC9F308198308180A47E307C31" + + "0B3009060355040613025553311330110603550408130A57617368696E67746F" + + "6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D69" + + "63726F736F667420436F72706F726174696F6E312630240603550403131D4D69" + + "63726F736F66742054696D652D5374616D702050434120323031300213330000" + + "0139CCE8E8438BF034E1000000000139302204204A6E54AC16FAF6985726E0CB" + + "5480381C41888386AB1D1BECC241E6BCFCBDD45B300D06092A864886F70D0101" + + "0B0500048201006957F018A5C13CC539EB266EC2725998F4AC0ED50CE1CAA696" + + "CAE377977F45FB8030136A4038B49F7E5A6ADCF72FA3901C26B52815621F52A2" + + "EB2ACFC423087ECD954F34C341342E31BDF30443CAC4F1297AB0181467B90604" + + "DDCF11F9F8930290614E8AA9D868E56971E4F83427819F8A1A11ED87AD1D5469" + + "7AFFE60A8D7B7877CBB1D09F46397769B9D0F8EB605DBFE8F05C47A3F8BC1F65" + + "F9F63553F187194B35E971FEFFB00C9127BDFD0F7FCF2424BE2A108AC5C532EA" + + "6AB46C76047604BA7DF071EE0137B73F4D9DF616095C8F1CA9EB925B6D4C6ABC" + + "FFEB73A81903169C6B487B316AFC951F696831A4B29B9ABCEA7EBCD243A553D2" + + "F8B44FDA1B0AC0").HexToByteArray(); } } diff --git a/src/libraries/System.Security.Cryptography.ProtectedData/src/CompatibilitySuppressions.xml b/src/libraries/System.Security.Cryptography.ProtectedData/src/CompatibilitySuppressions.xml index 40864690636e2e..1fabb2d07af7b1 100644 --- a/src/libraries/System.Security.Cryptography.ProtectedData/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Security.Cryptography.ProtectedData/src/CompatibilitySuppressions.xml @@ -1,17 +1,5 @@ - + - - CP0001 - T:System.Security.Cryptography.DataProtectionScope - lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll - lib/net461/System.Security.Cryptography.ProtectedData.dll - - - CP0001 - T:System.Security.Cryptography.ProtectedData - lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll - lib/net461/System.Security.Cryptography.ProtectedData.dll - PKV006 .NETFramework,Version=v4.6 diff --git a/src/libraries/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj b/src/libraries/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj index c2b3a7ee6cdb10..71167093886d0f 100644 --- a/src/libraries/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj +++ b/src/libraries/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj @@ -4,6 +4,9 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netstandard2.0-windows;netstandard2.0;net461-windows enable true + + false + 0 true Provides access to Windows Data Protection Api. diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/AndroidCertificatePal.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/AndroidCertificatePal.cs index d765cd0b56a4da..0110d34ac09e1b 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/AndroidCertificatePal.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/AndroidCertificatePal.cs @@ -48,7 +48,7 @@ public static ICertificatePal FromOtherCert(X509Certificate cert) return new AndroidCertificatePal(handle); } - public static ICertificatePal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + private static ICertificatePal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, bool readingFromFile, X509KeyStorageFlags keyStorageFlags) { Debug.Assert(password != null); @@ -68,6 +68,8 @@ public static ICertificatePal FromBlob(ReadOnlySpan rawData, SafePasswordH throw new PlatformNotSupportedException(SR.Cryptography_X509_PKCS12_PersistKeySetNotSupported); } + X509Certificate.EnforceIterationCountLimit(rawData, readingFromFile, password.PasswordProvided); + return ReadPkcs12(rawData, password, ephemeralSpecified); case X509ContentType.Cert: default: @@ -86,10 +88,15 @@ public static ICertificatePal FromBlob(ReadOnlySpan rawData, SafePasswordH throw new CryptographicException(); } + public static ICertificatePal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + return FromBlob(rawData, password, readingFromFile: false, keyStorageFlags); + } + public static ICertificatePal FromFile(string fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) { byte[] fileBytes = System.IO.File.ReadAllBytes(fileName); - return FromBlob(fileBytes, password, keyStorageFlags); + return FromBlob(fileBytes, password, readingFromFile: true, keyStorageFlags); } // Handles both DER and PEM diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/StorePal.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/StorePal.cs index 6187979d905f87..d976ff167cc937 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/StorePal.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/StorePal.cs @@ -18,7 +18,7 @@ public static IStorePal FromHandle(IntPtr storeHandle) throw new NotImplementedException($"{nameof(StorePal)}.{nameof(FromHandle)}"); } - public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + private static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, bool readingFromFile, X509KeyStorageFlags keyStorageFlags) { Debug.Assert(password != null); @@ -27,6 +27,7 @@ public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle if (contentType == X509ContentType.Pkcs12) { + X509Certificate.EnforceIterationCountLimit(rawData, readingFromFile, password.PasswordProvided); ICertificatePal[] certPals = ReadPkcs12Collection(rawData, password, ephemeralSpecified); return new AndroidCertLoader(certPals); } @@ -37,10 +38,15 @@ public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle } } + public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + return FromBlob(rawData, password, readingFromFile: false, keyStorageFlags: keyStorageFlags); + } + public static ILoaderPal FromFile(string fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) { byte[] fileBytes = File.ReadAllBytes(fileName); - return FromBlob(fileBytes, password, keyStorageFlags); + return FromBlob(fileBytes, password, readingFromFile: true, keyStorageFlags: keyStorageFlags); } public static IExportPal FromCertificate(ICertificatePalCore cert) diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/AppleCertificatePal.ImportExport.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/AppleCertificatePal.ImportExport.cs index f6b19f9bb03946..ad1aed066bf936 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/AppleCertificatePal.ImportExport.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/AppleCertificatePal.ImportExport.cs @@ -23,6 +23,15 @@ public static ICertificatePal FromBlob( ReadOnlySpan rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + return FromBlob(rawData, password, readingFromFile: false, keyStorageFlags); + } + + private static ICertificatePal FromBlob( + ReadOnlySpan rawData, + SafePasswordHandle password, + bool readingFromFile, + X509KeyStorageFlags keyStorageFlags) { Debug.Assert(password != null); @@ -47,6 +56,7 @@ public static ICertificatePal FromBlob( throw new PlatformNotSupportedException(SR.Cryptography_X509_NoEphemeralPfx); } + X509Certificate.EnforceIterationCountLimit(rawData, readingFromFile, password.PasswordProvided); bool exportable = (keyStorageFlags & X509KeyStorageFlags.Exportable) == X509KeyStorageFlags.Exportable; bool persist = diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/AppleCertificatePal.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/AppleCertificatePal.cs index 5334d9eb31a0bf..045e03003478f3 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/AppleCertificatePal.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/AppleCertificatePal.cs @@ -76,7 +76,7 @@ public static ICertificatePal FromFile(string fileName, SafePasswordHandle passw Debug.Assert(password != null); byte[] fileBytes = System.IO.File.ReadAllBytes(fileName); - return FromBlob(fileBytes, password, keyStorageFlags); + return FromBlob(fileBytes, password, readingFromFile: true, keyStorageFlags); } internal AppleCertificatePal(SafeSecCertificateHandle certHandle) diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/StorePal.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/StorePal.cs index e7cbefeb5b4d52..ded349280b43d3 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/StorePal.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/StorePal.cs @@ -26,6 +26,11 @@ public static IStorePal FromHandle(IntPtr storeHandle) } public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + return FromBlob(rawData, password, readingFromFile: false, keyStorageFlags); + } + + private static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, bool readingFromFile, X509KeyStorageFlags keyStorageFlags) { Debug.Assert(password != null); @@ -38,6 +43,7 @@ public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle throw new PlatformNotSupportedException(SR.Cryptography_X509_NoEphemeralPfx); } + X509Certificate.EnforceIterationCountLimit(rawData, readingFromFile, password.PasswordProvided); bool exportable = (keyStorageFlags & X509KeyStorageFlags.Exportable) == X509KeyStorageFlags.Exportable; bool persist = @@ -87,7 +93,7 @@ public static ILoaderPal FromFile(string fileName, SafePasswordHandle password, Debug.Assert(password != null); byte[] fileBytes = File.ReadAllBytes(fileName); - return FromBlob(fileBytes, password, keyStorageFlags); + return FromBlob(fileBytes, password, readingFromFile: true, keyStorageFlags); } public static IExportPal FromCertificate(ICertificatePalCore cert) diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/X509Pal.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/X509Pal.cs index 2b654b2b3b9c2f..7c17e4d7963077 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/X509Pal.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/X509Pal.cs @@ -123,7 +123,7 @@ public X509ContentType GetCertContentType(ReadOnlySpan rawData) X509ContentType contentType = Interop.AppleCrypto.X509GetContentType(rawData); - // Apple doesn't seem to recognize PFX files with no MAC, so try a quick maybe-it's-a-PFX test + // Apple's native check can't check for PKCS12, so do a quick decode test to see if it is PKCS12 / PFX. if (contentType == X509ContentType.Unknown) { try @@ -132,9 +132,11 @@ public X509ContentType GetCertContentType(ReadOnlySpan rawData) { fixed (byte* pin = rawData) { + AsnValueReader reader = new AsnValueReader(rawData, AsnEncodingRules.BER); + using (var manager = new PointerMemoryManager(pin, rawData.Length)) { - PfxAsn.Decode(manager.Memory, AsnEncodingRules.BER); + PfxAsn.Decode(ref reader, manager.Memory, out _); } contentType = X509ContentType.Pkcs12; diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/CertificateAssetDownloader.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/CertificateAssetDownloader.cs index cd7ef4b84858a5..7a932398cc418c 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/CertificateAssetDownloader.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/CertificateAssetDownloader.cs @@ -15,6 +15,9 @@ namespace Internal.Cryptography.Pal { internal static class CertificateAssetDownloader { + private const long DefaultAiaDownloadLimit = 100 * 1024 * 1024; + + private static long AiaDownloadLimit { get; } = GetValue("System.Security.Cryptography.AiaDownloadLimit", DefaultAiaDownloadLimit); private static readonly Func? s_downloadBytes = CreateDownloadBytesFunc(); internal static X509Certificate2? DownloadCertificate(string uri, TimeSpan downloadTimeout) @@ -28,6 +31,16 @@ internal static class CertificateAssetDownloader try { + X509ContentType contentType = X509Certificate2.GetCertContentType(data); + switch (contentType) + { + case X509ContentType.Cert: + case X509ContentType.Pkcs7: + break; + default: + return null; + } + X509Certificate2 certificate = new X509Certificate2(data); certificate.ThrowIfInvalid(); return certificate; @@ -151,6 +164,7 @@ internal static class CertificateAssetDownloader PropertyInfo? requestUriProp = httpRequestMessageType.GetProperty("RequestUri"); ConstructorInfo? httpRequestMessageCtor = httpRequestMessageType.GetConstructor(Type.EmptyTypes); MethodInfo? sendMethod = httpClientType.GetMethod("Send", new Type[] { httpRequestMessageType, typeof(CancellationToken) }); + PropertyInfo? maxResponseContentBufferSizeProp = httpClientType.GetProperty("MaxResponseContentBufferSize"); PropertyInfo? responseContentProp = httpResponseMessageType.GetProperty("Content"); PropertyInfo? responseStatusCodeProp = httpResponseMessageType.GetProperty("StatusCode"); PropertyInfo? responseHeadersProp = httpResponseMessageType.GetProperty("Headers"); @@ -159,7 +173,7 @@ internal static class CertificateAssetDownloader if (socketsHttpHandlerCtor == null || pooledConnectionIdleTimeoutProp == null || allowAutoRedirectProp == null || httpClientCtor == null || requestUriProp == null || httpRequestMessageCtor == null || sendMethod == null || responseContentProp == null || responseStatusCodeProp == null || - responseHeadersProp == null || responseHeadersLocationProp == null || readAsStreamMethod == null) + responseHeadersProp == null || responseHeadersLocationProp == null || readAsStreamMethod == null || maxResponseContentBufferSizeProp == null) { Debug.Fail("Unable to load required member."); return null; @@ -180,6 +194,7 @@ internal static class CertificateAssetDownloader pooledConnectionIdleTimeoutProp.SetValue(socketsHttpHandler, TimeSpan.FromSeconds(PooledConnectionIdleTimeoutSeconds)); allowAutoRedirectProp.SetValue(socketsHttpHandler, false); object? httpClient = httpClientCtor.Invoke(new object?[] { socketsHttpHandler }); + maxResponseContentBufferSizeProp.SetValue(httpClient, AiaDownloadLimit); return (string uriString, CancellationToken cancellationToken) => { @@ -303,5 +318,24 @@ private static bool IsAllowedScheme(string scheme) { return string.Equals(scheme, "http", StringComparison.OrdinalIgnoreCase); } + + private static long GetValue(string name, long defaultValue) + { + object? data = AppContext.GetData(name); + + if (data is null) + { + return defaultValue; + } + + try + { + return Convert.ToInt64(data); + } + catch + { + return defaultValue; + } + } } } diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509CertificateReader.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509CertificateReader.cs index 27f1df388e7f15..bc8137d0bcc623 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509CertificateReader.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509CertificateReader.cs @@ -55,7 +55,7 @@ public static ICertificatePal FromBlob(ReadOnlySpan rawData, SafePasswordH TryReadX509Pem(rawData, out cert) || PkcsFormatReader.TryReadPkcs7Der(rawData, out cert) || PkcsFormatReader.TryReadPkcs7Pem(rawData, out cert) || - PkcsFormatReader.TryReadPkcs12(rawData, password, ephemeralSpecified, out cert, out openSslException)) + PkcsFormatReader.TryReadPkcs12(rawData, password, ephemeralSpecified, readingFromFile: false, out cert, out openSslException)) { if (cert == null) { @@ -90,6 +90,7 @@ public static ICertificatePal FromFile(string fileName, SafePasswordHandle passw File.ReadAllBytes(fileName), password, ephemeralSpecified, + readingFromFile: true, out pal, out Exception? exception); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs index 7ec3e6f8f28ba4..d7adc5a283f378 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs @@ -823,6 +823,7 @@ private X509ChainElement[] BuildChainElements( List? statusBuilder = null; + bool overallHasNotSignatureValid = false; using (SafeX509StackHandle chainStack = Interop.Crypto.X509StoreCtxGetChain(_storeCtx)) { int chainSize = Interop.Crypto.GetX509StackFieldCount(chainStack); @@ -839,7 +840,20 @@ private X509ChainElement[] BuildChainElements( statusBuilder ??= new List(); overallStatus ??= new List(); - AddElementStatus(elementErrors.Value, statusBuilder, overallStatus); + bool hadSignatureNotValid = overallHasNotSignatureValid; + AddElementStatus(elementErrors.Value, statusBuilder, overallStatus, ref overallHasNotSignatureValid); + + // Clear NotSignatureValid for the last element when overall chain is not PartialChain or UntrustedRoot. + bool isLastElement = i == chainSize - 1; + if (isLastElement && !hadSignatureNotValid && overallHasNotSignatureValid) + { + if (!ContainsStatus(overallStatus, X509ChainStatusFlags.PartialChain) && + !ContainsStatus(overallStatus, X509ChainStatusFlags.UntrustedRoot)) + { + RemoveStatus(statusBuilder, X509ChainStatusFlags.NotSignatureValid); + RemoveStatus(overallStatus, X509ChainStatusFlags.NotSignatureValid); + } + } status = statusBuilder.ToArray(); statusBuilder.Clear(); } @@ -931,11 +945,12 @@ private static void ProcessPolicy( private static void AddElementStatus( ErrorCollection errorCodes, List elementStatus, - List overallStatus) + List overallStatus, + ref bool overallHasNotSignatureValid) { - foreach (var errorCode in errorCodes) + foreach (Interop.Crypto.X509VerifyStatusCode errorCode in errorCodes) { - AddElementStatus(errorCode, elementStatus, overallStatus); + AddElementStatus(errorCode, elementStatus, overallStatus, ref overallHasNotSignatureValid); } foreach (X509ChainStatus element in elementStatus) @@ -960,7 +975,8 @@ private static void AddElementStatus( private static void AddElementStatus( Interop.Crypto.X509VerifyStatusCode errorCode, List elementStatus, - List overallStatus) + List overallStatus, + ref bool overallHasNotSignatureValid) { X509ChainStatusFlags statusFlag = MapVerifyErrorToChainStatus(errorCode); @@ -987,6 +1003,36 @@ private static void AddElementStatus( elementStatus.Add(chainStatus); AddUniqueStatus(overallStatus, ref chainStatus); + + if (statusFlag == X509ChainStatusFlags.NotSignatureValid) + { + overallHasNotSignatureValid = true; + } + } + + private static bool ContainsStatus(List list, X509ChainStatusFlags statusCode) + { + for (int i = 0; i < list.Count; i++) + { + if (list[i].Status == statusCode) + { + return true; + } + } + + return false; + } + + private static void RemoveStatus(List list, X509ChainStatusFlags statusCode) + { + for (int i = 0; i < list.Count; i++) + { + if (list[i].Status == statusCode) + { + list.RemoveAt(i); + return; + } + } } private static void AddUniqueStatus(List list, ref X509ChainStatus status) diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/PkcsFormatReader.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/PkcsFormatReader.cs index f73b59373233de..75c8029cb2e09f 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/PkcsFormatReader.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/PkcsFormatReader.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; using Microsoft.Win32.SafeHandles; namespace Internal.Cryptography.Pal @@ -257,6 +258,7 @@ internal static bool TryReadPkcs12( ReadOnlySpan rawData, SafePasswordHandle password, bool ephemeralSpecified, + bool readingFromFile, [NotNullWhen(true)] out ICertificatePal? certPal, out Exception? openSslException) { @@ -267,6 +269,7 @@ internal static bool TryReadPkcs12( password, single: true, ephemeralSpecified, + readingFromFile, out certPal!, out ignored, out openSslException); @@ -276,6 +279,7 @@ internal static bool TryReadPkcs12( ReadOnlySpan rawData, SafePasswordHandle password, bool ephemeralSpecified, + bool readingFromFile, [NotNullWhen(true)] out List? certPals, out Exception? openSslException) { @@ -286,6 +290,7 @@ internal static bool TryReadPkcs12( password, single: false, ephemeralSpecified, + readingFromFile, out ignored, out certPals!, out openSslException); @@ -296,6 +301,7 @@ private static bool TryReadPkcs12( SafePasswordHandle password, bool single, bool ephemeralSpecified, + bool readingFromFile, out ICertificatePal? readPal, out List? readCerts, out Exception? openSslException) @@ -312,18 +318,21 @@ private static bool TryReadPkcs12( using (pfx) { - return TryReadPkcs12(pfx, password, single, ephemeralSpecified, out readPal, out readCerts); + return TryReadPkcs12(rawData, pfx, password, single, ephemeralSpecified, readingFromFile, out readPal, out readCerts); } } private static bool TryReadPkcs12( + ReadOnlySpan rawData, OpenSslPkcs12Reader pfx, SafePasswordHandle password, bool single, bool ephemeralSpecified, + bool readingFromFile, out ICertificatePal? readPal, out List? readCerts) { + X509Certificate.EnforceIterationCountLimit(rawData, readingFromFile, password.PasswordProvided); pfx.Decrypt(password, ephemeralSpecified); if (single) diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/StorePal.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/StorePal.cs index bef72007c383a1..576e9b1a8dc230 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/StorePal.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/StorePal.cs @@ -40,7 +40,7 @@ public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle if (PkcsFormatReader.TryReadPkcs7Der(rawData, out certPals) || PkcsFormatReader.TryReadPkcs7Pem(rawData, out certPals) || - PkcsFormatReader.TryReadPkcs12(rawData, password, ephemeralSpecified, out certPals, out openSslException)) + PkcsFormatReader.TryReadPkcs12(rawData, password, ephemeralSpecified, readingFromFile: false, out certPals, out openSslException)) { Debug.Assert(certPals != null); @@ -111,7 +111,7 @@ private static ILoaderPal FromBio( // Capture the exception so in case of failure, the call to BioSeek does not override it. Exception? openSslException; byte[] data = File.ReadAllBytes(fileName); - if (PkcsFormatReader.TryReadPkcs12(data, password, ephemeralSpecified, out certPals, out openSslException)) + if (PkcsFormatReader.TryReadPkcs12(data, password, ephemeralSpecified, readingFromFile: true, out certPals, out openSslException)) { return ListToLoaderPal(certPals); } diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/UnixPkcs12Reader.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/UnixPkcs12Reader.cs index 8cd7abe0660a88..d28c645c938311 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/UnixPkcs12Reader.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/UnixPkcs12Reader.cs @@ -25,7 +25,7 @@ internal abstract class UnixPkcs12Reader : IDisposable private ContentInfoAsn[]? _safeContentsValues; private CertAndKey[]? _certs; private int _certCount; - private PointerMemoryManager? _tmpManager; + private Memory _tmpMemory; private bool _allowDoubleBind; protected abstract ICertificatePalCore ReadX509Der(ReadOnlyMemory data); @@ -40,19 +40,13 @@ protected void ParsePkcs12(ReadOnlySpan data) // Windows compatibility: Ignore trailing data. ReadOnlySpan encodedData = reader.PeekEncodedValue(); + byte[] dataWithoutTrailing = GC.AllocateUninitializedArray(encodedData.Length, pinned: true); + encodedData.CopyTo(dataWithoutTrailing); + _tmpMemory = MemoryMarshal.CreateFromPinnedArray(dataWithoutTrailing, 0, dataWithoutTrailing.Length); - unsafe - { - IntPtr tmpPtr = Marshal.AllocHGlobal(encodedData.Length); - Span tmpSpan = new Span((byte*)tmpPtr, encodedData.Length); - encodedData.CopyTo(tmpSpan); - _tmpManager = new PointerMemoryManager((void*)tmpPtr, encodedData.Length); - } - - ReadOnlyMemory tmpMemory = _tmpManager.Memory; - reader = new AsnValueReader(tmpMemory.Span, AsnEncodingRules.BER); + reader = new AsnValueReader(_tmpMemory.Span, AsnEncodingRules.BER); - PfxAsn.Decode(ref reader, tmpMemory, out PfxAsn pfxAsn); + PfxAsn.Decode(ref reader, _tmpMemory, out PfxAsn pfxAsn); if (pfxAsn.AuthSafe.ContentType != Oids.Pkcs7Data) { @@ -113,26 +107,8 @@ internal IEnumerable EnumerateAll() public void Dispose() { - // Generally, having a MemoryManager cleaned up in a Dispose is a bad practice. - // In this case, the UnixPkcs12Reader is only ever created in a using statement, - // never accessed by a second thread, and there isn't a manual call to Dispose - // mixed in anywhere. - if (_tmpManager != null) - { - unsafe - { - Span tmp = _tmpManager.GetSpan(); - CryptographicOperations.ZeroMemory(tmp); - - fixed (byte* ptr = tmp) - { - Marshal.FreeHGlobal((IntPtr)ptr); - } - } - - ((IDisposable)_tmpManager).Dispose(); - _tmpManager = null; - } + CryptographicOperations.ZeroMemory(_tmpMemory.Span); + _tmpMemory = Memory.Empty; ContentInfoAsn[]? rentedContents = Interlocked.Exchange(ref _safeContentsValues, null); CertAndKey[]? rentedCerts = Interlocked.Exchange(ref _certs, null); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/CertificatePal.Import.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/CertificatePal.Import.cs index 72b4d63f2bc433..9fe6922f5c5038 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/CertificatePal.Import.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/CertificatePal.Import.cs @@ -83,7 +83,14 @@ out pCertContext else if (contentType == ContentType.CERT_QUERY_CONTENT_PFX) { if (loadFromFile) + { rawData = File.ReadAllBytes(fileName!); + } + else + { + X509Certificate.EnforceIterationCountLimit(rawData, readingFromFile: false, password.PasswordProvided); + } + pCertContext = FilterPFXStore(rawData, password, pfxCertStoreFlags); // If PersistKeySet is set we don't delete the key, so that it persists. diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/StorePal.Import.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/StorePal.Import.cs index d81149e93e3af0..c522278538e91b 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/StorePal.Import.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/StorePal.Import.cs @@ -6,6 +6,7 @@ using System; using System.IO; using System.Runtime.InteropServices; +using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Diagnostics; @@ -68,6 +69,11 @@ private static StorePal FromBlobOrFile(ReadOnlySpan rawData, string? fileN { rawData = File.ReadAllBytes(fileName!); } + else + { + X509Certificate.EnforceIterationCountLimit(rawData, readingFromFile: false, password.PasswordProvided); + } + fixed (byte* pRawData2 = rawData) { CRYPTOAPI_BLOB blob2 = new CRYPTOAPI_BLOB(rawData!.Length, pRawData2); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/AppleCertificatePal.ImportExport.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/AppleCertificatePal.ImportExport.cs index dd8fb2ac2ddafd..8e8594ded228ef 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/AppleCertificatePal.ImportExport.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/AppleCertificatePal.ImportExport.cs @@ -99,6 +99,7 @@ internal static ICertificatePal FromDerBlob( ReadOnlySpan rawData, X509ContentType contentType, SafePasswordHandle password, + bool readingFromFile, X509KeyStorageFlags keyStorageFlags) { Debug.Assert(password != null); @@ -124,6 +125,7 @@ internal static ICertificatePal FromDerBlob( throw new PlatformNotSupportedException(SR.Cryptography_X509_PKCS12_PersistKeySetNotSupported); } + X509Certificate.EnforceIterationCountLimit(rawData, readingFromFile, password.PasswordProvided); return ImportPkcs12(rawData, password, ephemeralSpecified); } @@ -151,6 +153,15 @@ public static ICertificatePal FromBlob( ReadOnlySpan rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + return FromBlob(rawData, password, readingFromFile: false, keyStorageFlags); + } + + public static ICertificatePal FromBlob( + ReadOnlySpan rawData, + SafePasswordHandle password, + bool readingFromFile, + X509KeyStorageFlags keyStorageFlags) { Debug.Assert(password != null); @@ -159,11 +170,11 @@ public static ICertificatePal FromBlob( rawData, (derData, contentType) => { - result = FromDerBlob(derData, contentType, password, keyStorageFlags); + result = FromDerBlob(derData, contentType, password, readingFromFile, keyStorageFlags); return false; }); - return result ?? FromDerBlob(rawData, GetDerCertContentType(rawData), password, keyStorageFlags); + return result ?? FromDerBlob(rawData, GetDerCertContentType(rawData), password, readingFromFile, keyStorageFlags); } public void DisposeTempKeychain() diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/AppleCertificatePal.Pkcs12.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/AppleCertificatePal.Pkcs12.cs index 8ff5988f557d23..d151d65a54b8e6 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/AppleCertificatePal.Pkcs12.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/AppleCertificatePal.Pkcs12.cs @@ -18,7 +18,7 @@ namespace Internal.Cryptography.Pal { internal sealed partial class AppleCertificatePal : ICertificatePal { - private static SafePasswordHandle s_passwordExportHandle = new SafePasswordHandle("DotnetExportPassphrase"); + private static SafePasswordHandle s_passwordExportHandle = new SafePasswordHandle("DotnetExportPassphrase", passwordProvided: true); private static AppleCertificatePal ImportPkcs12( ReadOnlySpan rawData, diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/StorePal.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/StorePal.cs index 47d7485c0f9847..e6b6dce07a7537 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/StorePal.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.iOS/StorePal.cs @@ -19,7 +19,7 @@ public static IStorePal FromHandle(IntPtr storeHandle) throw new PlatformNotSupportedException($"{nameof(StorePal)}.{nameof(FromHandle)}"); } - public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + private static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, bool readingFromFile, X509KeyStorageFlags keyStorageFlags) { List? certificateList = null; @@ -28,7 +28,7 @@ public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle (derData, contentType) => { certificateList = certificateList ?? new List(); - certificateList.Add(AppleCertificatePal.FromDerBlob(derData, contentType, password, keyStorageFlags)); + certificateList.Add(AppleCertificatePal.FromDerBlob(derData, contentType, password, readingFromFile, keyStorageFlags)); return true; }); @@ -49,6 +49,7 @@ public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle if (contentType == X509ContentType.Pkcs12) { + X509Certificate.EnforceIterationCountLimit(rawData, readingFromFile, password.PasswordProvided); ApplePkcs12Reader reader = new ApplePkcs12Reader(rawData); try @@ -98,12 +99,17 @@ public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle return new CertCollectionLoader(certificateList); } + public static ILoaderPal FromBlob(ReadOnlySpan rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + return FromBlob(rawData, password, readingFromFile: false, keyStorageFlags); + } + public static ILoaderPal FromFile(string fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) { Debug.Assert(password != null); byte[] fileBytes = File.ReadAllBytes(fileName); - return FromBlob(fileBytes, password, keyStorageFlags); + return FromBlob(fileBytes, password, readingFromFile: true, keyStorageFlags); } public static IExportPal FromCertificate(ICertificatePalCore cert) diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafePasswordHandle.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafePasswordHandle.cs index f528eae37b0f8b..5bba8da007059e 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafePasswordHandle.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafePasswordHandle.cs @@ -16,7 +16,13 @@ internal sealed partial class SafePasswordHandle : SafeHandleZeroOrMinusOneIsInv { internal int Length { get; private set; } - public SafePasswordHandle(string? password) + /// + /// This is used to track if a password was explicitly provided. + /// A null/empty password is a valid password. + /// + internal bool PasswordProvided { get; } + + public SafePasswordHandle(string? password, bool passwordProvided) : base(ownsHandle: true) { if (password != null) @@ -24,9 +30,11 @@ public SafePasswordHandle(string? password) handle = Marshal.StringToHGlobalUni(password); Length = password.Length; } + + PasswordProvided = passwordProvided; } - public SafePasswordHandle(ReadOnlySpan password) + public SafePasswordHandle(ReadOnlySpan password, bool passwordProvided) : base(ownsHandle: true) { // "".AsSpan() is not default, so this is compat for "null tries NULL first". @@ -49,9 +57,11 @@ public SafePasswordHandle(ReadOnlySpan password) Length = password.Length; } + + PasswordProvided = passwordProvided; } - public SafePasswordHandle(SecureString? password) + public SafePasswordHandle(SecureString? password, bool passwordProvided) : base(ownsHandle: true) { if (password != null) @@ -59,6 +69,8 @@ public SafePasswordHandle(SecureString? password) handle = Marshal.SecureStringToGlobalAllocUnicode(password); Length = password.Length; } + + PasswordProvided = passwordProvided; } protected override bool ReleaseHandle() @@ -96,7 +108,7 @@ internal ReadOnlySpan DangerousGetSpan() SafeHandleCache.GetInvalidHandle( () => { - var handle = new SafePasswordHandle((string?)null); + var handle = new SafePasswordHandle((string?)null, false); handle.handle = (IntPtr)(-1); return handle; }); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Resources/Strings.resx b/src/libraries/System.Security.Cryptography.X509Certificates/src/Resources/Strings.resx index b7e39a57646cf4..f16b13441fbf24 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Resources/Strings.resx +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Resources/Strings.resx @@ -1,4 +1,4 @@ - + @@ -193,6 +193,9 @@ Object identifier (OID) is unknown. + + Padding is invalid and cannot be removed. + Specified padding mode is not valid for this algorithm. @@ -490,4 +493,10 @@ The certificate content type could not be determined. + + PKCS12 (PFX) without a supplied password has exceeded maximum allowed iterations. See https://go.microsoft.com/fwlink/?linkid=2233907 for more information. + + + An unknown chain building error occurred. + diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj b/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj index 3b1071dd9124bb..57abeec36ad831 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj @@ -30,14 +30,20 @@ Link="Common\System\Security\Cryptography\Oids.cs" /> + + + Common\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.xml @@ -60,6 +66,20 @@ Common\System\Security\Cryptography\Asn1\AttributeAsn.manual.cs Common\System\Security\Cryptography\Asn1\AttributeAsn.xml + + Common\System\Security\Cryptography\Asn1\Pkcs7\ContentInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs7\ContentInfoAsn.xml.cs + Common\System\Security\Cryptography\Asn1\Pkcs7\ContentInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\DigestInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\DigestInfoAsn.xml.cs + Common\System\Security\Cryptography\Asn1\DigestInfoAsn.xml + Common\System\Security\Cryptography\Asn1\DirectoryStringAsn.xml @@ -74,6 +94,27 @@ Common\System\Security\Cryptography\Asn1\EdiPartyNameAsn.xml.cs Common\System\Security\Cryptography\Asn1\EdiPartyNameAsn.xml + + Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedContentInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedContentInfoAsn.xml.cs + Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedContentInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedDataAsn.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedDataAsn.xml.cs + Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedDataAsn.xml + + + Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml + + + Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml.cs + Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml + Common\System\Security\Cryptography\Asn1\GeneralNameAsn.xml @@ -81,6 +122,10 @@ Common\System\Security\Cryptography\Asn1\GeneralNameAsn.xml.cs Common\System\Security\Cryptography\Asn1\GeneralNameAsn.xml + + Common\System\Security\Cryptography\Asn1\Pkcs12\MacData.xml.cs + Common\System\Security\Cryptography\Asn1\Pkcs12\MacData.xml + Common\System\Security\Cryptography\Asn1\OtherNameAsn.xml @@ -88,6 +133,48 @@ Common\System\Security\Cryptography\Asn1\OtherNameAsn.xml.cs Common\System\Security\Cryptography\Asn1\OtherNameAsn.xml + + Common\System\Security\Cryptography\Asn1\PBEParameter.xml + + + Common\System\Security\Cryptography\Asn1\PBEParameter.xml.cs + Common\System\Security\Cryptography\Asn1\PBEParameter.xml + + + Common\System\Security\Cryptography\Asn1\PBES2Params.xml + + + Common\System\Security\Cryptography\Asn1\PBES2Params.xml.cs + Common\System\Security\Cryptography\Asn1\PBES2Params.xml + + + Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml + + + Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml.cs + Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml + + + Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml + + + Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml.cs + Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs12\MacData.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.manual.cs + Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.xml.cs + Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.xml + Common\System\Security\Cryptography\Asn1\PssParamsAsn.xml @@ -95,6 +182,24 @@ Common\System\Security\Cryptography\Asn1\PssParamsAsn.xml.cs Common\System\Security\Cryptography\Asn1\PssParamsAsn.xml + + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml + + + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml.cs + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml + + + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.manual.cs + Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs12\SafeBagAsn.xml + + + Common\System\Security\Cryptography\Asn1\Pkcs12\SafeBagAsn.xml.cs + Common\System\Security\Cryptography\Asn1\Pkcs12\SafeBagAsn.xml + Common\System\Security\Cryptography\Asn1\SubjectPublicKeyInfoAsn.xml @@ -135,6 +240,9 @@ + + @@ -198,6 +306,7 @@ System\Security\Cryptography\X509Certificates\Asn1\CertificationRequestInfoAsn.xml + System\Security\Cryptography\X509Certificates\Asn1\TbsCertificateAsn.xml @@ -411,7 +520,7 @@ + Link="Common\Internal\Cryptography\AsymmetricAlgorithmHelpers.Hash.cs" /> - - - - Common\System\Security\Cryptography\Asn1\DigestInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\DigestInfoAsn.xml.cs - Common\System\Security\Cryptography\Asn1\DigestInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml.cs - Common\System\Security\Cryptography\Asn1\EncryptedPrivateKeyInfoAsn.xml - Common\System\Security\Cryptography\Asn1\Pkcs12\CertBagAsn.xml @@ -671,80 +762,6 @@ Common\System\Security\Cryptography\Asn1\Pkcs12\CertBagAsn.xml.cs Common\System\Security\Cryptography\Asn1\Pkcs12\CertBagAsn.xml - - Common\System\Security\Cryptography\Asn1\Pkcs12\MacData.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs12\MacData.xml.cs - Common\System\Security\Cryptography\Asn1\Pkcs12\MacData.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.manual.cs - Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.xml.cs - Common\System\Security\Cryptography\Asn1\Pkcs12\PfxAsn.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs12\SafeBagAsn.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs12\SafeBagAsn.xml.cs - Common\System\Security\Cryptography\Asn1\Pkcs12\SafeBagAsn.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs7\ContentInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs7\ContentInfoAsn.xml.cs - Common\System\Security\Cryptography\Asn1\Pkcs7\ContentInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\PBEParameter.xml - - - Common\System\Security\Cryptography\Asn1\PBEParameter.xml.cs - Common\System\Security\Cryptography\Asn1\PBEParameter.xml - - - Common\System\Security\Cryptography\Asn1\PBES2Params.xml - - - Common\System\Security\Cryptography\Asn1\PBES2Params.xml.cs - Common\System\Security\Cryptography\Asn1\PBES2Params.xml - - - Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml - - - Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml.cs - Common\System\Security\Cryptography\Asn1\Pbkdf2Params.xml - - - Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml - - - Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml.cs - Common\System\Security\Cryptography\Asn1\Pbkdf2SaltChoice.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedContentInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedContentInfoAsn.xml.cs - Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedContentInfoAsn.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedDataAsn.xml - - - Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedDataAsn.xml.cs - Common\System\Security\Cryptography\Asn1\Pkcs7\EncryptedDataAsn.xml - Common\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml @@ -752,17 +769,6 @@ Common\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml.cs Common\System\Security\Cryptography\Asn1\PrivateKeyInfoAsn.xml - - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml - - - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml.cs - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml - - - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.manual.cs - Common\System\Security\Cryptography\Asn1\Rc2CbcParameters.xml - diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/Asn1/PfxAsn.manual.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/Asn1/PfxAsn.manual.cs new file mode 100644 index 00000000000000..66173ae838cc70 --- /dev/null +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/Asn1/PfxAsn.manual.cs @@ -0,0 +1,270 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Internal.Cryptography; +using System.Diagnostics; +using System.Formats.Asn1; +using System.Security.Cryptography.Asn1.Pkcs7; +using System.Security.Cryptography.Asn1.Pkcs12; + +namespace System.Security.Cryptography.Asn1.Pkcs12 +{ + internal partial struct PfxAsn + { + private const int MaxIterationWork = 300_000; + private static ReadOnlySpan EmptyPassword => ""; // don't use ReadOnlySpan.Empty because it will get confused with default. + private static ReadOnlySpan NullPassword => default; + + internal ulong CountTotalIterations() + { + checked + { + ulong count = 0; + + // RFC 7292 section 4.1: + // the contentType field of authSafe shall be of type data + // or signedData. The content field of the authSafe shall, either + // directly (data case) or indirectly (signedData case), contain a BER- + // encoded value of type AuthenticatedSafe. + // We don't support authSafe that is signedData, so enforce that it's just data. + if (AuthSafe.ContentType != Oids.Pkcs7Data) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + ReadOnlyMemory authSafeContents = Helpers.DecodeOctetStringAsMemory(AuthSafe.Content); + AsnValueReader outerAuthSafe = new AsnValueReader(authSafeContents.Span, AsnEncodingRules.BER); // RFC 7292 PDU says BER + AsnValueReader authSafeReader = outerAuthSafe.ReadSequence(); + outerAuthSafe.ThrowIfNotEmpty(); + + bool hasSeenEncryptedInfo = false; + + while (authSafeReader.HasData) + { + ContentInfoAsn.Decode(ref authSafeReader, authSafeContents, out ContentInfoAsn contentInfo); + + ReadOnlyMemory contentData; + ArraySegment? rentedData = null; + + try + { + if (contentInfo.ContentType != Oids.Pkcs7Data) + { + if (contentInfo.ContentType == Oids.Pkcs7Encrypted) + { + if (hasSeenEncryptedInfo) + { + // We will process at most one encryptedData ContentInfo. This is the most typical scenario where + // certificates are stored in an encryptedData ContentInfo, and keys are shrouded in a data ContentInfo. + throw new CryptographicException(SR.Cryptography_X509_PfxWithoutPassword); + } + + ArraySegment content = DecryptContentInfo(contentInfo, out uint iterations); + contentData = content; + rentedData = content; + hasSeenEncryptedInfo = true; + count += iterations; + } + else + { + // Not a common scenario. It's not data or encryptedData, so they need to go through the + // regular PKCS12 loader. + throw new CryptographicException(SR.Cryptography_X509_PfxWithoutPassword); + } + } + else + { + contentData = Helpers.DecodeOctetStringAsMemory(contentInfo.Content); + } + + AsnValueReader outerSafeBag = new AsnValueReader(contentData.Span, AsnEncodingRules.BER); + AsnValueReader safeBagReader = outerSafeBag.ReadSequence(); + outerSafeBag.ThrowIfNotEmpty(); + + while (safeBagReader.HasData) + { + SafeBagAsn.Decode(ref safeBagReader, contentData, out SafeBagAsn bag); + + // We only need to count iterations on PKCS8ShroudedKeyBag. + // * KeyBag is PKCS#8 PrivateKeyInfo and doesn't do iterations. + // * CertBag, either for x509Certificate or sdsiCertificate don't do iterations. + // * CRLBag doesn't do iterations. + // * SecretBag doesn't do iteations. + // * Nested SafeContents _can_ do iterations, but Windows ignores it. So we will ignore it too. + if (bag.BagId == Oids.Pkcs12ShroudedKeyBag) + { + AsnValueReader pkcs8ShroudedKeyReader = new AsnValueReader(bag.BagValue.Span, AsnEncodingRules.BER); + EncryptedPrivateKeyInfoAsn.Decode( + ref pkcs8ShroudedKeyReader, + bag.BagValue, + out EncryptedPrivateKeyInfoAsn epki); + + count += IterationsFromParameters(epki.EncryptionAlgorithm); + } + } + } + finally + { + if (rentedData.HasValue) + { + CryptoPool.Return(rentedData.Value); + } + } + } + + if (MacData.HasValue) + { + if (MacData.Value.IterationCount < 0) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + count += (uint)MacData.Value.IterationCount; + } + + return count; + } + } + + private static ArraySegment DecryptContentInfo(ContentInfoAsn contentInfo, out uint iterations) + { + EncryptedDataAsn encryptedData = EncryptedDataAsn.Decode(contentInfo.Content, AsnEncodingRules.BER); + + if (encryptedData.Version != 0 && encryptedData.Version != 2) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + // The encrypted contentInfo can only wrap a PKCS7 data. + if (encryptedData.EncryptedContentInfo.ContentType != Oids.Pkcs7Data) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + if (!encryptedData.EncryptedContentInfo.EncryptedContent.HasValue) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + iterations = IterationsFromParameters(encryptedData.EncryptedContentInfo.ContentEncryptionAlgorithm); + + // This encryptData is encrypted with more rounds than we are willing to process. Bail out of the whole thing. + if (iterations > MaxIterationWork) + { + throw new CryptographicException(SR.Cryptography_X509_PfxWithoutPassword); + } + + int encryptedValueLength = encryptedData.EncryptedContentInfo.EncryptedContent.Value.Length; + byte[] destination = CryptoPool.Rent(encryptedValueLength); + int written = 0; + + try + { + try + { + written = PasswordBasedEncryption.Decrypt( + in encryptedData.EncryptedContentInfo.ContentEncryptionAlgorithm, + EmptyPassword, + default, + encryptedData.EncryptedContentInfo.EncryptedContent.Value.Span, + destination); + + // When padding happens to be as expected (false-positive), we can detect gibberish and prevent unexpected failures later + // This extra check makes it so it's very unlikely we'll end up with false positive. + AsnValueReader outerSafeBag = new AsnValueReader(destination.AsSpan(0, written), AsnEncodingRules.BER); + AsnValueReader safeBagReader = outerSafeBag.ReadSequence(); + outerSafeBag.ThrowIfNotEmpty(); + } + catch + { + // If empty password didn't work, try null password. + written = PasswordBasedEncryption.Decrypt( + in encryptedData.EncryptedContentInfo.ContentEncryptionAlgorithm, + NullPassword, + default, + encryptedData.EncryptedContentInfo.EncryptedContent.Value.Span, + destination); + + // When padding happens to be as expected (false-positive), we can detect gibberish and prevent unexpected failures later + // This extra check makes it so it's very unlikely we'll end up with false positive. + AsnValueReader outerSafeBag = new AsnValueReader(destination.AsSpan(0, written), AsnEncodingRules.BER); + AsnValueReader safeBagReader = outerSafeBag.ReadSequence(); + outerSafeBag.ThrowIfNotEmpty(); + } + } + finally + { + if (written == 0) + { + // This means the decryption operation failed and destination could contain + // partial data. Clear it to be hygienic. + CryptographicOperations.ZeroMemory(destination); + } + } + + return new ArraySegment(destination, 0, written); + } + + private static uint IterationsFromParameters(in AlgorithmIdentifierAsn algorithmIdentifier) + { + switch (algorithmIdentifier.Algorithm) + { + case Oids.PasswordBasedEncryptionScheme2: + if (!algorithmIdentifier.Parameters.HasValue) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + PBES2Params pbes2Params = PBES2Params.Decode(algorithmIdentifier.Parameters.Value, AsnEncodingRules.BER); + + // PBES2 only defines PKBDF2 for now. See RFC 8018 A.4 + if (pbes2Params.KeyDerivationFunc.Algorithm != Oids.Pbkdf2) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + if (!pbes2Params.KeyDerivationFunc.Parameters.HasValue) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + Pbkdf2Params pbkdf2Params = Pbkdf2Params.Decode(pbes2Params.KeyDerivationFunc.Parameters.Value, AsnEncodingRules.BER); + + if (pbkdf2Params.IterationCount < 0) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + return (uint)pbkdf2Params.IterationCount; + + // PBES1 + case Oids.PbeWithMD5AndDESCBC: + case Oids.PbeWithMD5AndRC2CBC: + case Oids.PbeWithSha1AndDESCBC: + case Oids.PbeWithSha1AndRC2CBC: + case Oids.Pkcs12PbeWithShaAnd3Key3Des: + case Oids.Pkcs12PbeWithShaAnd2Key3Des: + case Oids.Pkcs12PbeWithShaAnd128BitRC2: + case Oids.Pkcs12PbeWithShaAnd40BitRC2: + if (!algorithmIdentifier.Parameters.HasValue) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + PBEParameter pbeParameters = PBEParameter.Decode( + algorithmIdentifier.Parameters.Value, + AsnEncodingRules.BER); + + if (pbeParameters.IterationCount < 0) + { + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + + return (uint)pbeParameters.IterationCount; + + default: + throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding); + } + } + } +} diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/LocalAppContextSwitches.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/LocalAppContextSwitches.cs new file mode 100644 index 00000000000000..342a7ce9eab43b --- /dev/null +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/LocalAppContextSwitches.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System +{ + internal static partial class LocalAppContextSwitches + { + internal const long DefaultPkcs12UnspecifiedPasswordIterationLimit = 600_000; + + internal static long Pkcs12UnspecifiedPasswordIterationLimit { get; } = InitializePkcs12UnspecifiedPasswordIterationLimit(); + + internal static bool X509ChainBuildThrowOnInternalError { get; } = InitializeX509ChainBuildThrowOnInternalError(); + + private static long InitializePkcs12UnspecifiedPasswordIterationLimit() + { + object? data = AppContext.GetData("System.Security.Cryptography.Pkcs12UnspecifiedPasswordIterationLimit"); + + if (data is null) + { + return DefaultPkcs12UnspecifiedPasswordIterationLimit; + } + + try + { + return Convert.ToInt64(data); + } + catch + { + return DefaultPkcs12UnspecifiedPasswordIterationLimit; + } + } + + private static bool InitializeX509ChainBuildThrowOnInternalError() + { + // n.b. the switch defaults to TRUE if it has not been explicitly set. + return AppContext.TryGetSwitch("System.Security.Cryptography.ThrowOnX509ChainBuildInternalError", out bool isEnabled) + ? isEnabled : true; + } + } +} diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs index 1913afa2af2306..c1b773db7844f2 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs @@ -5,10 +5,13 @@ using Internal.Cryptography.Pal; using Microsoft.Win32.SafeHandles; using System; +using System.Buffers; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Formats.Asn1; using System.Globalization; using System.Runtime.Serialization; +using System.Security.Cryptography.Asn1.Pkcs12; using System.Text; namespace System.Security.Cryptography.X509Certificates @@ -61,7 +64,7 @@ private protected X509Certificate(ReadOnlySpan data) if (!data.IsEmpty) { // For compat reasons, this constructor treats passing a null or empty data set as the same as calling the nullary constructor. - using (var safePasswordHandle = new SafePasswordHandle((string?)null)) + using (var safePasswordHandle = new SafePasswordHandle((string?)null, passwordProvided: false)) { Pal = CertificatePal.FromBlob(data, safePasswordHandle, X509KeyStorageFlags.DefaultKeySet); } @@ -86,7 +89,7 @@ public X509Certificate(byte[] rawData, string? password, X509KeyStorageFlags key ValidateKeyStorageFlags(keyStorageFlags); - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) { Pal = CertificatePal.FromBlob(rawData, safePasswordHandle, keyStorageFlags); } @@ -100,7 +103,7 @@ public X509Certificate(byte[] rawData, SecureString? password, X509KeyStorageFla ValidateKeyStorageFlags(keyStorageFlags); - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) { Pal = CertificatePal.FromBlob(rawData, safePasswordHandle, keyStorageFlags); } @@ -113,7 +116,7 @@ private protected X509Certificate(ReadOnlySpan rawData, ReadOnlySpan ValidateKeyStorageFlags(keyStorageFlags); - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) { Pal = CertificatePal.FromBlob(rawData, safePasswordHandle, keyStorageFlags); } @@ -153,7 +156,7 @@ public X509Certificate(string fileName, string? password, X509KeyStorageFlags ke ValidateKeyStorageFlags(keyStorageFlags); - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) { Pal = CertificatePal.FromFile(fileName, safePasswordHandle, keyStorageFlags); } @@ -166,7 +169,7 @@ private protected X509Certificate(string fileName, ReadOnlySpan password, ValidateKeyStorageFlags(keyStorageFlags); - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) { Pal = CertificatePal.FromFile(fileName, safePasswordHandle, keyStorageFlags); } @@ -182,7 +185,7 @@ public X509Certificate(string fileName, SecureString? password, X509KeyStorageFl ValidateKeyStorageFlags(keyStorageFlags); - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) { Pal = CertificatePal.FromFile(fileName, safePasswordHandle, keyStorageFlags); } @@ -321,7 +324,7 @@ public virtual byte[] Export(X509ContentType contentType, string? password) if (Pal == null) throw new CryptographicException(ErrorCode.E_POINTER); // Not the greatest error, but needed for backward compat. - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) { return Pal.Export(contentType, safePasswordHandle); } @@ -335,7 +338,7 @@ public virtual byte[] Export(X509ContentType contentType, SecureString? password if (Pal == null) throw new CryptographicException(ErrorCode.E_POINTER); // Not the greatest error, but needed for backward compat. - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) { return Pal.Export(contentType, safePasswordHandle); } @@ -694,6 +697,88 @@ private void VerifyContentType(X509ContentType contentType) throw new CryptographicException(SR.Cryptography_X509_InvalidContentType); } + internal static void EnforceIterationCountLimit(ReadOnlySpan pkcs12, bool readingFromFile, bool passwordProvided) + { + if (readingFromFile || passwordProvided) + { + return; + } + + long pkcs12UnspecifiedPasswordIterationLimit = LocalAppContextSwitches.Pkcs12UnspecifiedPasswordIterationLimit; + + // -1 = no limit + if (LocalAppContextSwitches.Pkcs12UnspecifiedPasswordIterationLimit == -1) + { + return; + } + + // any other negative number means use default limits + if (pkcs12UnspecifiedPasswordIterationLimit < 0) + { + pkcs12UnspecifiedPasswordIterationLimit = LocalAppContextSwitches.DefaultPkcs12UnspecifiedPasswordIterationLimit; + } + + try + { + try + { + checked + { + KdfWorkLimiter.SetIterationLimit((ulong)pkcs12UnspecifiedPasswordIterationLimit); + ulong observedIterationCount = GetIterationCount(pkcs12); + + // Check both conditions: we want a KDF-exceeded failure anywhere in the system to produce a failure here. + // There are some places within the GetIterationCount method where we optimistically try processing the + // PFX in one manner, and if we see failures we'll swallow any exceptions and try a different manner + // instead. The problem with this is that when we swallow failures, we don't have the ability to add the + // so-far-observed iteration count back to the running total returned by GetIterationCount. This + // potentially allows a clever adversary a window through which to squeeze in work beyond our configured + // limits. To mitigate this risk, we'll fail now if we observed *any* KDF-exceeded failure while processing + // this PFX. + if (observedIterationCount > (ulong)pkcs12UnspecifiedPasswordIterationLimit || KdfWorkLimiter.WasWorkLimitExceeded()) + { + throw new CryptographicException(); // iteration count exceeded + } + } + } + finally + { + KdfWorkLimiter.ResetIterationLimit(); + } + } + catch (Exception ex) + { + // It's important for this catch-all block to be *outside* the inner try/finally + // so that we can prevent exception filters from running before we've had a chance + // to clean up the threadstatic. + throw new CryptographicException(SR.Cryptography_X509_PfxWithoutPassword, ex); + } + } + + internal static ulong GetIterationCount(ReadOnlySpan pkcs12) + { + ulong iterations; + + unsafe + { + fixed (byte* pin = pkcs12) + { + using (var manager = new PointerMemoryManager(pin, pkcs12.Length)) + { + AsnValueReader reader = new AsnValueReader(pkcs12, AsnEncodingRules.BER); + PfxAsn.Decode(ref reader, manager.Memory, out PfxAsn pfx); + + // Don't throw when trailing data is present. + // Windows doesn't have such enforcement as well. + + iterations = pfx.CountTotalIterations(); + } + } + } + + return iterations; + } + internal const X509KeyStorageFlags KeyStorageFlagsAll = X509KeyStorageFlags.UserKeySet | X509KeyStorageFlags.MachineKeySet | diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2Collection.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2Collection.cs index c0b695d17dad4a..b7f06862bb1ccd 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2Collection.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2Collection.cs @@ -109,12 +109,16 @@ public bool Contains(X509Certificate2 certificate) public byte[]? Export(X509ContentType contentType) { - return Export(contentType, password: null); + using (var safePasswordHandle = new SafePasswordHandle((string?)null, passwordProvided: false)) + using (IExportPal storePal = StorePal.LinkFromCertificateCollection(this)) + { + return storePal.Export(contentType, safePasswordHandle); + } } public byte[]? Export(X509ContentType contentType, string? password) { - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) using (IExportPal storePal = StorePal.LinkFromCertificateCollection(this)) { return storePal.Export(contentType, safePasswordHandle); @@ -152,7 +156,11 @@ public void Import(byte[] rawData) /// public void Import(ReadOnlySpan rawData) { - Import(rawData, password: null, keyStorageFlags: X509KeyStorageFlags.DefaultKeySet); + using (var safePasswordHandle = new SafePasswordHandle((string?)null, passwordProvided: false)) + using (ILoaderPal storePal = StorePal.FromBlob(rawData, safePasswordHandle, X509KeyStorageFlags.DefaultKeySet)) + { + storePal.MoveTo(this); + } } public void Import(byte[] rawData, string? password, X509KeyStorageFlags keyStorageFlags = 0) @@ -199,7 +207,7 @@ public void Import(ReadOnlySpan rawData, ReadOnlySpan password, X509 X509Certificate.ValidateKeyStorageFlags(keyStorageFlags); - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) using (ILoaderPal storePal = StorePal.FromBlob(rawData, safePasswordHandle, keyStorageFlags)) { storePal.MoveTo(this); @@ -208,7 +216,14 @@ public void Import(ReadOnlySpan rawData, ReadOnlySpan password, X509 public void Import(string fileName) { - Import(fileName, password: null, keyStorageFlags: X509KeyStorageFlags.DefaultKeySet); + if (fileName == null) + throw new ArgumentNullException(nameof(fileName)); + + using (var safePasswordHandle = new SafePasswordHandle((string?)null, passwordProvided: false)) + using (ILoaderPal storePal = StorePal.FromFile(fileName, safePasswordHandle, X509KeyStorageFlags.DefaultKeySet)) + { + storePal.MoveTo(this); + } } public void Import(string fileName, string? password, X509KeyStorageFlags keyStorageFlags = 0) @@ -218,7 +233,7 @@ public void Import(string fileName, string? password, X509KeyStorageFlags keySto X509Certificate.ValidateKeyStorageFlags(keyStorageFlags); - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) using (ILoaderPal storePal = StorePal.FromFile(fileName, safePasswordHandle, keyStorageFlags)) { storePal.MoveTo(this); @@ -244,7 +259,7 @@ public void Import(string fileName, ReadOnlySpan password, X509KeyStorageF X509Certificate.ValidateKeyStorageFlags(keyStorageFlags); - using (var safePasswordHandle = new SafePasswordHandle(password)) + using (var safePasswordHandle = new SafePasswordHandle(password, passwordProvided: true)) using (ILoaderPal storePal = StorePal.FromFile(fileName, safePasswordHandle, keyStorageFlags)) { storePal.MoveTo(this); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs index dbefadab573347..4a92f86bea824f 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Chain.cs @@ -145,26 +145,62 @@ internal bool Build(X509Certificate2 certificate, bool throwOnException) chainPolicy.UrlRetrievalTimeout, chainPolicy.DisableCertificateDownloads); - if (_pal == null) - return false; - - _chainElements = new X509ChainElementCollection(_pal.ChainElements!); - - Exception? verificationException; - bool? verified = _pal.Verify(chainPolicy.VerificationFlags, out verificationException); - if (!verified.HasValue) + bool success = false; + if (_pal is not null) { - if (throwOnException) - { - throw verificationException!; - } - else + _chainElements = new X509ChainElementCollection(_pal.ChainElements!); + + Exception? verificationException; + bool? verified = _pal.Verify(chainPolicy.VerificationFlags, out verificationException); + if (!verified.HasValue) { - verified = false; + if (throwOnException) + { + throw verificationException!; + } + else + { + verified = false; + } } + + success = verified.Value; + } + + // There are two reasons success might be false here. + // + // The most common reason is that we built the chain but the chain appears to run + // afoul of policy. This is represented by BuildChain returning a non-null object + // and storing potential policy violations in the chain structure. The public Build + // method returns false to the caller, and the caller can inspect the ChainStatus + // and ChainElements properties and evaluate the failure reason against app-level + // policies. If the caller does not care about these policy violations, they can + // choose to ignore them and to treat chain building as successful. + // + // The other type of failure is that BuildChain simply can't build the chain at all. + // Perhaps something within the certificate is not valid or is unsupported, or perhaps + // there's an internal failure within the OS layer we're invoking, etc. Whatever the + // reason, we're not meaningfully able to initialize the ChainStatus property, which + // means callers may observe a non-empty list of policy violations. Depending on the + // caller's logic, they might incorrectly interpret this as there being no policy + // violations at all, which means they might treat this condition as success. + // + // To avoid callers misinterpeting this latter condition as success, we'll throw an + // exception, which matches general .NET API behavior when a method cannot complete + // its objective. A compat switch is provided to normalize this back to a 'false' + // return value for callers who cannot handle an exception here. If throwOnException + // is false, it means the caller explicitly wants to suppress exceptions and normalize + // them to a false return value. + + if (!success + && throwOnException + && _pal?.ChainStatus is not { Length: > 0 } + && LocalAppContextSwitches.X509ChainBuildThrowOnInternalError) + { + throw new CryptographicException(SR.Cryptography_X509_ChainBuildingFailed); } - return verified.Value; + return success; } } diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/CertTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/CertTests.cs index 41b8084ae5564f..3f18fb2abd3ed8 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/CertTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/CertTests.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; +using System.Security.Cryptography.X509Certificates.Tests.CertificateCreation; using System.Threading; using Microsoft.DotNet.XUnitExtensions; using Test.Cryptography; @@ -24,6 +25,108 @@ public CertTests(ITestOutputHelper output) _log = output; } + [Fact] + public static void PrivateKey_FromCertificate_CanExportPrivate_ECDsa() + { + using (ECDsa ca = ECDsa.Create(ECCurve.NamedCurves.nistP256)) + { + CertificateRequest req = new("CN=potatos", ca, HashAlgorithmName.SHA256); + + using (X509Certificate2 cert = req.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddDays(3))) + using (ECDsa certKey = cert.GetECDsaPrivateKey()) + { + ECParameters certParameters = certKey.ExportParameters(true); + ECParameters originalParameters = ca.ExportParameters(true); + AssertExtensions.SequenceEqual(originalParameters.D, certParameters.D); + } + } + } + + [Fact] + public static void PrivateKey_FromCertificate_CanExportPrivate_RSA() + { + using (RSA ca = RSA.Create(2048)) + { + CertificateRequest req = new("CN=potatos", ca, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); + + using (X509Certificate2 cert = req.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddDays(3))) + using (RSA certKey = cert.GetRSAPrivateKey()) + { + RSAParameters certParameters = certKey.ExportParameters(true); + RSAParameters originalParameters = ca.ExportParameters(true); + AssertExtensions.SequenceEqual(originalParameters.P, certParameters.P); + AssertExtensions.SequenceEqual(originalParameters.Q, certParameters.Q); + } + } + } + + [Fact] + [SkipOnPlatform(PlatformSupport.MobileAppleCrypto, "DSA is not available")] + public static void PrivateKey_FromCertificate_CanExportPrivate_DSA() + { + DSAParameters originalParameters = TestData.GetDSA1024Params(); + + using (DSA ca = DSA.Create()) + { + ca.ImportParameters(originalParameters); + DSAX509SignatureGenerator gen = new DSAX509SignatureGenerator(ca); + X500DistinguishedName dn = new X500DistinguishedName("CN=potatos"); + + CertificateRequest req = new CertificateRequest( + dn, + gen.PublicKey, + HashAlgorithmName.SHA1); + + using (X509Certificate2 cert = req.Create(dn, gen, DateTimeOffset.Now, DateTimeOffset.Now.AddDays(3), new byte[] { 1, 2, 3 })) + using (X509Certificate2 certWithKey = cert.CopyWithPrivateKey(ca)) + using (DSA certKey = certWithKey.GetDSAPrivateKey()) + { + DSAParameters certParameters = certKey.ExportParameters(true); + AssertExtensions.SequenceEqual(originalParameters.X, certParameters.X); + } + } + } + + [Fact] + public static void PrivateKey_FromCertificate_CanExportPrivate_ECDiffieHellman() + { + using (ECDsa ca = ECDsa.Create(ECCurve.NamedCurves.nistP256)) + using (ECDiffieHellman ecdh = ECDiffieHellman.Create(ECCurve.NamedCurves.nistP256)) + { + CertificateRequest issuerRequest = new CertificateRequest( + new X500DistinguishedName("CN=root"), + ca, + HashAlgorithmName.SHA256); + + issuerRequest.CertificateExtensions.Add( + new X509BasicConstraintsExtension(true, false, 0, true)); + + CertificateRequest request = new CertificateRequest( + new X500DistinguishedName("CN=potato"), + new PublicKey(ecdh), + HashAlgorithmName.SHA256); + + request.CertificateExtensions.Add( + new X509BasicConstraintsExtension(false, false, 0, true)); + request.CertificateExtensions.Add( + new X509KeyUsageExtension(X509KeyUsageFlags.KeyAgreement, true)); + + DateTimeOffset notBefore = DateTimeOffset.UtcNow; + DateTimeOffset notAfter = notBefore.AddDays(30); + byte[] serial = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }; + + using (X509Certificate2 issuer = issuerRequest.CreateSelfSigned(notBefore, notAfter)) + using (X509Certificate2 cert = request.Create(issuer, notBefore, notAfter, serial)) + using (X509Certificate2 certWithKey = cert.CopyWithPrivateKey(ecdh)) + using (ECDiffieHellman certKey = certWithKey.GetECDiffieHellmanPrivateKey()) + { + ECParameters certParameters = certKey.ExportParameters(true); + ECParameters originalParameters = ecdh.ExportParameters(true); + AssertExtensions.SequenceEqual(originalParameters.D, certParameters.D); + } + } + } + [Fact] public static void RaceUseAndDisposeDoesNotCrash() { @@ -399,6 +502,12 @@ public static void UseAfterDispose() } } + [Fact] + public static void EmptyPkcs7ThrowsException() + { + Assert.ThrowsAny(() => new X509Certificate2(TestData.EmptyPkcs7)); + } + [Fact] public static void ExportPublicKeyAsPkcs12() { @@ -411,7 +520,7 @@ public static void ExportPublicKeyAsPkcs12() // Read it back as a collection, there should be only one cert, and it should // be equal to the one we started with. - using (ImportedCollection ic = Cert.Import(pkcs12Bytes)) + using (ImportedCollection ic = Cert.Import(pkcs12Bytes, (string?)null, X509KeyStorageFlags.DefaultKeySet)) { X509Certificate2Collection fromPfx = ic.Collection; diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs index 614ae070496cc6..9c3cdcc781bf3f 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs @@ -1248,6 +1248,58 @@ public static void BuildChainForCertificateWithMD5Signature() } } + [Fact] + public static void BuildChainForSelfSignedCertificate_WithSha256RsaSignature() + { + using (ChainHolder chainHolder = new ChainHolder()) + using (X509Certificate2 cert = new X509Certificate2(TestData.SelfSignedCertSha256RsaBytes)) + { + X509Chain chain = chainHolder.Chain; + chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; + chain.ChainPolicy.VerificationTime = cert.NotBefore.AddHours(2); + + // No custom root of trust store means that this self-signed cert will at + // minimum be marked UntrustedRoot. + + Assert.False(chain.Build(cert)); + AssertExtensions.HasFlag(X509ChainStatusFlags.UntrustedRoot, chain.AllStatusFlags()); + } + } + + [Fact] + public static void BuildChainForSelfSignedCertificate_WithUnknownOidSignature() + { + using (ChainHolder chainHolder = new ChainHolder()) + using (X509Certificate2 cert = new X509Certificate2(TestData.SelfSignedCertDummyOidBytes)) + { + X509Chain chain = chainHolder.Chain; + chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; + chain.ChainPolicy.VerificationTime = cert.NotBefore.AddHours(2); + + // This tests a self-signed cert whose signature block contains a garbage signing alg OID. + // Some platforms return NotSignatureValid to indicate that they cannot understand the + // signature block. Other platforms return PartialChain to indicate that they think the + // bad signature block might correspond to some unknown, untrusted signer. Yet other + // platforms simply fail the operation; e.g., Windows's CertGetCertificateChain API returns + // NTE_BAD_ALGID, which we bubble up as CryptographicException. + + if (PlatformDetection.UsesAppleCrypto) + { + Assert.False(chain.Build(cert)); + AssertExtensions.HasFlag(X509ChainStatusFlags.PartialChain, chain.AllStatusFlags()); + } + else if (PlatformDetection.IsOpenSslSupported) + { + Assert.False(chain.Build(cert)); + AssertExtensions.HasFlag(X509ChainStatusFlags.NotSignatureValid, chain.AllStatusFlags()); + } + else + { + Assert.ThrowsAny(() => chain.Build(cert)); + } + } + } + internal static X509ChainStatusFlags AllStatusFlags(this X509Chain chain) { return chain.ChainStatus.Aggregate( diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionImportTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionImportTests.cs index d46d734b5cefbb..a292d8e4828af5 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionImportTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionImportTests.cs @@ -22,7 +22,7 @@ public static void ImportNull() [Fact] public static void ImportEmpty_Pkcs12() { - using (ImportedCollection ic = Cert.Import(TestData.EmptyPfx)) + using (ImportedCollection ic = Cert.Import(TestData.EmptyPfx, (string?)null, X509KeyStorageFlags.DefaultKeySet)) { X509Certificate2Collection collection = ic.Collection; Assert.Equal(0, collection.Count); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs index e31f2c3a84a0cf..e20cd08198dddd 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs @@ -635,7 +635,7 @@ public static void ImportFromFileTests(X509KeyStorageFlags storageFlags) [Fact] public static void ImportMultiplePrivateKeysPfx() { - using (ImportedCollection ic = Cert.Import(TestData.MultiPrivateKeyPfx)) + using (ImportedCollection ic = Cert.Import(TestData.MultiPrivateKeyPfx, (string?)null, X509KeyStorageFlags.DefaultKeySet)) { X509Certificate2Collection collection = ic.Collection; @@ -751,7 +751,7 @@ public static void ExportUnrelatedPfx() byte[] exported = collection.Export(X509ContentType.Pkcs12); - using (ImportedCollection ic = Cert.Import(exported)) + using (ImportedCollection ic = Cert.Import(exported, (string?)null, X509KeyStorageFlags.DefaultKeySet)) { X509Certificate2Collection importedCollection = ic.Collection; @@ -813,7 +813,7 @@ public static void ExportMultiplePrivateKeys() byte[] exported = collection.Export(X509ContentType.Pkcs12); - using (ImportedCollection ic = Cert.Import(exported)) + using (ImportedCollection ic = Cert.Import(exported, (string?)null, X509KeyStorageFlags.DefaultKeySet)) { X509Certificate2Collection importedCollection = ic.Collection; @@ -833,6 +833,7 @@ public static void ExportMultiplePrivateKeys() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public static void CanAddMultipleCertsWithSinglePrivateKey() { using (var oneWithKey = new X509Certificate2(TestData.PfxData, TestData.PfxDataPassword, X509KeyStorageFlags.Exportable | Cert.EphemeralIfPossible)) @@ -851,7 +852,7 @@ public static void CanAddMultipleCertsWithSinglePrivateKey() byte[] buffer = col.Export(X509ContentType.Pfx); - using (ImportedCollection newCollection = Cert.Import(buffer)) + using (ImportedCollection newCollection = Cert.Import(buffer, (string?)null, X509KeyStorageFlags.DefaultKeySet)) { Assert.Equal(2, newCollection.Collection.Count); } @@ -899,7 +900,13 @@ public static void X509ChainElementCollection_CopyTo_NonZeroLowerBound_ThrowsInd chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllFlags; - chain.Build(microsoftDotCom); + // Halfway between microsoftDotCom's NotBefore and NotAfter + // This isn't a boundary condition test. + chain.ChainPolicy.VerificationTime = new DateTime(2021, 02, 26, 12, 01, 01, DateTimeKind.Local); + + bool valid = chain.Build(microsoftDotCom); + Assert.True(valid, "Precondition: Chain built validly"); + ICollection collection = chain.ChainElements; Array array = Array.CreateInstance(typeof(object), new int[] { 10 }, new int[] { 10 }); Assert.Throws(() => collection.CopyTo(array, 0)); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/DynamicChainTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/DynamicChainTests.cs index 32d0ac6501d34b..c90b43d52435bd 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/DynamicChainTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/DynamicChainTests.cs @@ -1,7 +1,9 @@ // 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.Generic; using System.Formats.Asn1; +using System.IO; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -832,6 +834,91 @@ public static void PolicyConstraints_Mapped() } } + public enum BuildChainWithNotSignatureValidTest : int + { + TrustedRoot, + UntrustedRoot, + PartialChain, + TrustedRootEndCertNotSignatureValid, + PartialChainEndCertNotSignatureValid + } + + public static IEnumerable BuildChainWithNotSignatureValidData() + { + yield return new object[] { true, X509ChainStatusFlags.NoError, BuildChainWithNotSignatureValidTest.TrustedRoot }; + yield return new object[] { false, X509ChainStatusFlags.UntrustedRoot | X509ChainStatusFlags.NotSignatureValid, BuildChainWithNotSignatureValidTest.UntrustedRoot }; + yield return new object[] { false, X509ChainStatusFlags.PartialChain, BuildChainWithNotSignatureValidTest.PartialChain }; + yield return new object[] { false, X509ChainStatusFlags.NotSignatureValid, BuildChainWithNotSignatureValidTest.TrustedRootEndCertNotSignatureValid }; + yield return new object[] { false, X509ChainStatusFlags.PartialChain | X509ChainStatusFlags.NotSignatureValid, BuildChainWithNotSignatureValidTest.PartialChainEndCertNotSignatureValid }; + } + + [Theory] + [MemberData(nameof(BuildChainWithNotSignatureValidData))] + [PlatformSpecific(TestPlatforms.Linux)] // NotSignatureValid gets ignored on the root certificate. + public static void BuildChainWithNotSignatureValid( + bool chainBuildsSuccessfully, + X509ChainStatusFlags chainFlags, + BuildChainWithNotSignatureValidTest test) + { + TestDataGenerator.MakeTestChain3( + out X509Certificate2 endCert, + out X509Certificate2 intermediateCert, + out X509Certificate2 rootCert, + testName: test.ToString()); + + X509Certificate2 tampered; + switch (test) + { + case BuildChainWithNotSignatureValidTest.TrustedRootEndCertNotSignatureValid: + case BuildChainWithNotSignatureValidTest.PartialChainEndCertNotSignatureValid: + tampered = TamperSignature(endCert); + endCert.Dispose(); + endCert = tampered; + break; + default: + // Make root cert signature invalid. + tampered = TamperSignature(rootCert); + rootCert.Dispose(); + rootCert = tampered; + break; + } + + using (endCert) + using (intermediateCert) + using (rootCert) + using (ChainHolder chainHolder = new ChainHolder()) + { + X509Chain chainTest = chainHolder.Chain; + chainTest.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; + chainTest.ChainPolicy.VerificationTime = endCert.NotBefore.AddSeconds(1); + chainTest.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust; + + switch (test) + { + case BuildChainWithNotSignatureValidTest.TrustedRoot: + case BuildChainWithNotSignatureValidTest.TrustedRootEndCertNotSignatureValid: + chainTest.ChainPolicy.ExtraStore.Add(intermediateCert); + chainTest.ChainPolicy.CustomTrustStore.Add(rootCert); + break; + case BuildChainWithNotSignatureValidTest.PartialChain: + chainTest.ChainPolicy.CustomTrustStore.Add(rootCert); + break; + case BuildChainWithNotSignatureValidTest.PartialChainEndCertNotSignatureValid: + chainTest.ChainPolicy.ExtraStore.Add(intermediateCert); + break; + case BuildChainWithNotSignatureValidTest.UntrustedRoot: + chainTest.ChainPolicy.ExtraStore.Add(intermediateCert); + chainTest.ChainPolicy.ExtraStore.Add(rootCert); + break; + default: + throw new InvalidDataException(); + } + + Assert.Equal(chainBuildsSuccessfully, chainTest.Build(endCert)); + Assert.Equal(chainFlags, chainTest.AllStatusFlags()); + } + } + private static X509ChainStatusFlags PlatformBasicConstraints(X509ChainStatusFlags flags) { if (OperatingSystem.IsAndroid()) diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/ExportTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/ExportTests.cs index 0051bc4da70e67..0799f496327e97 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/ExportTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/ExportTests.cs @@ -65,7 +65,7 @@ public static void ExportAsPfx() byte[] pfx = c1.Export(X509ContentType.Pkcs12); Assert.Equal(X509ContentType.Pkcs12, X509Certificate2.GetCertContentType(pfx)); - using (X509Certificate2 c2 = new X509Certificate2(pfx)) + using (X509Certificate2 c2 = new X509Certificate2(pfx, (string?)null)) { byte[] rawData = c2.Export(X509ContentType.Cert); Assert.Equal(TestData.MsCertificate, rawData); @@ -104,6 +104,7 @@ public static void ExportAsPfxVerifyPassword() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public static void ExportAsPfxWithPrivateKeyVerifyPassword() { using (var cert = new X509Certificate2(TestData.PfxData, TestData.PfxDataPassword, X509KeyStorageFlags.Exportable)) @@ -124,6 +125,7 @@ public static void ExportAsPfxWithPrivateKeyVerifyPassword() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public static void ExportAsPfxWithPrivateKey() { using (X509Certificate2 cert = new X509Certificate2(TestData.PfxData, TestData.PfxDataPassword, X509KeyStorageFlags.Exportable)) @@ -132,7 +134,7 @@ public static void ExportAsPfxWithPrivateKey() byte[] pfxBytes = cert.Export(X509ContentType.Pkcs12); - using (X509Certificate2 fromPfx = new X509Certificate2(pfxBytes)) + using (X509Certificate2 fromPfx = new X509Certificate2(pfxBytes, (string?)null)) { Assert.Equal(cert, fromPfx); Assert.True(fromPfx.HasPrivateKey, "fromPfx.HasPrivateKey"); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxFormatTests.SingleCertGenerator.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxFormatTests.SingleCertGenerator.cs index de3a5f18004e4e..3fad2b9d3beb08 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxFormatTests.SingleCertGenerator.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxFormatTests.SingleCertGenerator.cs @@ -62,6 +62,7 @@ public static IEnumerable AllSingleCertVariations [Theory] [MemberData(nameof(AllSingleCertVariations))] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCertWithOneKey(SingleCertOptions options) { bool sameContainer = (options & SingleCertOptions.KeyAndCertInSameContents) != 0; diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxFormatTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxFormatTests.cs index 3b83ac201e5097..c73af1ac3173a7 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxFormatTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxFormatTests.cs @@ -158,6 +158,7 @@ public void EmptyPfx_BadPassword() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCert_NoKeys_EncryptedNullPassword_NoMac() { using (X509Certificate2 cert = new X509Certificate2(TestData.MsCertificate)) @@ -175,6 +176,7 @@ public void OneCert_NoKeys_EncryptedNullPassword_NoMac() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCert_NoKeys_EncryptedEmptyPassword_NoMac() { using (X509Certificate2 cert = new X509Certificate2(TestData.MsCertificate)) @@ -196,6 +198,7 @@ public void OneCert_NoKeys_EncryptedEmptyPassword_NoMac() [InlineData(false, true)] [InlineData(true, false)] [InlineData(true, true)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCert_EncryptedEmptyPassword_OneKey_EncryptedNullPassword_NoMac(bool encryptKeySafe, bool associateKey) { // This test shows that while a null or empty password will result in both @@ -237,6 +240,7 @@ public void OneCert_EncryptedEmptyPassword_OneKey_EncryptedNullPassword_NoMac(bo } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCert_MismatchedKey() { string pw = nameof(OneCert_MismatchedKey); @@ -285,6 +289,7 @@ public void OneCert_MismatchedKey() [Theory] [InlineData(false)] [InlineData(true)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCert_TwoKeys_FirstWins(bool correctKeyFirst) { string pw = nameof(OneCert_TwoKeys_FirstWins); @@ -356,6 +361,7 @@ public void OneCert_TwoKeys_FirstWins(bool correctKeyFirst) [Theory] [InlineData(false)] [InlineData(true)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void TwoCerts_OneKey(bool certWithKeyFirst) { string pw = nameof(TwoCerts_OneKey); @@ -400,6 +406,7 @@ public void TwoCerts_OneKey(bool certWithKeyFirst) } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCert_ExtraKeyWithUnknownAlgorithm() { string pw = nameof(OneCert_ExtraKeyWithUnknownAlgorithm); @@ -445,6 +452,7 @@ public void OneCert_ExtraKeyWithUnknownAlgorithm() [Theory] [InlineData(true)] [InlineData(false)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCert_ExtraKeyBadEncoding(bool badTag) { string pw = nameof(OneCert_ExtraKeyBadEncoding); @@ -503,6 +511,7 @@ public void OneCert_ExtraKeyBadEncoding(bool badTag) } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCert_NoKey_WithLocalKeyId() { string pw = nameof(OneCert_NoKey_WithLocalKeyId); @@ -524,6 +533,7 @@ public void OneCert_NoKey_WithLocalKeyId() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void OneCert_TwentyKeys_NoMatches() { string pw = nameof(OneCert_NoKey_WithLocalKeyId); @@ -562,6 +572,7 @@ public void OneCert_TwentyKeys_NoMatches() [Theory] [InlineData(true)] [InlineData(false)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void TwoCerts_TwentyKeys_NoMatches(bool msCertFirst) { string pw = nameof(OneCert_NoKey_WithLocalKeyId); @@ -635,6 +646,7 @@ public void OneCorruptCert() } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void CertAndKey_NoLocalKeyId() { string pw = nameof(CertAndKey_NoLocalKeyId); @@ -661,6 +673,7 @@ public void CertAndKey_NoLocalKeyId() [Theory] [InlineData(false)] [InlineData(true)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void SameCertTwice_NoKeys(bool addLocalKeyId) { string pw = nameof(SameCertTwice_NoKeys); @@ -692,6 +705,7 @@ public void SameCertTwice_NoKeys(bool addLocalKeyId) } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void TwoCerts_CrossedKeys() { string pw = nameof(TwoCerts_CrossedKeys); @@ -766,6 +780,7 @@ public void TwoCerts_CrossedKeys() [InlineData(false, false)] [InlineData(true, false)] [InlineData(true, true)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void CertAndKeyTwice(bool addLocalKeyId, bool crossIdentifiers) { string pw = nameof(CertAndKeyTwice); @@ -821,6 +836,7 @@ public void CertAndKeyTwice(bool addLocalKeyId, bool crossIdentifiers) } [Fact] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void CertAndKeyTwice_KeysUntagged() { string pw = nameof(CertAndKeyTwice); @@ -873,6 +889,7 @@ public void CertAndKeyTwice_KeysUntagged() [Theory] [InlineData(false)] [InlineData(true)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void CertTwice_KeyOnce(bool addLocalKeyId) { string pw = nameof(CertTwice_KeyOnce); @@ -930,6 +947,7 @@ public void CertTwice_KeyOnce(bool addLocalKeyId) [Theory] [InlineData(false)] [InlineData(true)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void CertTwice_KeyOnce_OtherCertBetter(bool addLocalKeyId) { string pw = nameof(CertTwice_KeyOnce); @@ -990,6 +1008,7 @@ public void CertTwice_KeyOnce_OtherCertBetter(bool addLocalKeyId) [InlineData(false, true)] [InlineData(true, false)] [InlineData(true, true)] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public void TwoCerts_TwoKeys_ManySafeContentsValues(bool invertCertOrder, bool invertKeyOrder) { string pw = nameof(TwoCerts_TwoKeys_ManySafeContentsValues); diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.CustomAppDomainDataLimit.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.CustomAppDomainDataLimit.cs new file mode 100644 index 00000000000000..e61ba53f9359b3 --- /dev/null +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.CustomAppDomainDataLimit.cs @@ -0,0 +1,160 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.DotNet.RemoteExecutor; +using Microsoft.DotNet.XUnitExtensions; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using Test.Cryptography; +using Xunit; + +namespace System.Security.Cryptography.X509Certificates.Tests +{ + // AppContext and AppDomain are the same in this context. + public class PfxIterationCountTests_CustomAppDomainDataLimit + { + // We need to use virtual in a non-abstract class because RemoteExecutor can't work on abstract classes. + internal virtual X509Certificate Import(byte[] blob) => new X509Certificate(blob); + + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountNotExceedingDefaultLimit_AndNullOrEmptyPassword_MemberData), MemberType = typeof(PfxIterationCountTests))] + public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountNotExceedingDefaultLimit(string name, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) + { + _ = iterationCount; + _ = blob; + + if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) + { + throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); + } + + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + + RemoteExecutor.Invoke((certName) => + { + AppDomain.CurrentDomain.SetData("System.Security.Cryptography.Pkcs12UnspecifiedPasswordIterationLimit", -2); + + PfxInfo pfxInfo = s_certificatesDictionary[certName]; + + X509Certificate cert = Import(pfxInfo.Blob); + Assert.True(cert.Subject == "CN=test" || cert.Subject == "CN=potato"); + }, name).Dispose(); + } + + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountExceedingDefaultLimit_MemberData), MemberType = typeof(PfxIterationCountTests))] + public void Import_AppDomainDataWithValueTwo_ActsAsDefaultLimit_IterationCountLimitExceeded_Throws(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) + { + _ = password; + _ = iterationCount; + _ = blob; + + if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) + { + throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); + } + + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + + RemoteExecutor.Invoke((certName) => + { + AppDomain.CurrentDomain.SetData("System.Security.Cryptography.Pkcs12UnspecifiedPasswordIterationLimit", -2); + + PfxInfo pfxInfo = s_certificatesDictionary[certName]; + + CryptographicException ce = Assert.Throws(() => Import(pfxInfo.Blob)); + Assert.Contains("2233907", ce.Message); + }, name).Dispose(); + } + + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountNotExceedingDefaultLimit_AndNullOrEmptyPassword_MemberData), MemberType = typeof(PfxIterationCountTests))] + public void Import_AppDomainDataWithValueZero_IterationCountNotExceedingDefaultLimit_Throws(string name, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) + { + _ = iterationCount; + _ = blob; + + if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) + { + throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); + } + + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + + RemoteExecutor.Invoke((certName) => + { + AppDomain.CurrentDomain.SetData("System.Security.Cryptography.Pkcs12UnspecifiedPasswordIterationLimit", 0); + + PfxInfo pfxInfo = s_certificatesDictionary[certName]; + + CryptographicException ce = Assert.Throws(() => Import(pfxInfo.Blob)); + Assert.Contains("2233907", ce.Message); + }, name).Dispose(); + } + + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountExceedingDefaultLimit_MemberData), MemberType = typeof(PfxIterationCountTests))] + public void Import_AppDomainDataWithValueMinusOne_IterationCountExceedingDefaultLimit(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) + { + _ = password; + _ = blob; + _ = iterationCount; + + if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) + { + throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); + } + + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + + RemoteExecutor.Invoke((certName) => + { + AppDomain.CurrentDomain.SetData("System.Security.Cryptography.Pkcs12UnspecifiedPasswordIterationLimit", -1); + + PfxInfo pfxInfo = s_certificatesDictionary[certName]; + + if (OperatingSystem.IsWindows()) + { + // Opting-out with AppDomain data value -1 will still give us error because cert is beyond Windows limit. + // But we will get the CryptoThrowHelper+WindowsCryptographicException. + PfxIterationCountTests.VerifyThrowsCryptoExButDoesNotThrowPfxWithoutPassword(() => Import(pfxInfo.Blob)); + } + else + { + Assert.NotNull(Import(pfxInfo.Blob)); + } + }, name).Dispose(); + } + + public static readonly Dictionary s_certificatesDictionary + = PfxIterationCountTests.s_Certificates.ToDictionary((c) => c.Name); + } + + public class PfxIterationCountTests_CustomLimit_X509Certificate2 : PfxIterationCountTests_CustomAppDomainDataLimit + { + internal override X509Certificate Import(byte[] blob) => new X509Certificate2(blob); + } + + public class PfxIterationCountTests_CustomLimit_X509Certificate2Collection : PfxIterationCountTests_CustomAppDomainDataLimit + { + internal override X509Certificate Import(byte[] blob) + { + X509Certificate2Collection collection = new X509Certificate2Collection(); + collection.Import(blob); + return collection[0]; + } + } +} diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.X509Certificate.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.X509Certificate.cs new file mode 100644 index 00000000000000..15a39d05755b3d --- /dev/null +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.X509Certificate.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Security.Cryptography.X509Certificates.Tests +{ + public class PfxIterationCountTests_X509Certificate : PfxIterationCountTests + { + internal override X509Certificate Import(byte[] blob) + => new X509Certificate(blob); + + internal override X509Certificate Import(byte[] blob, string password) + => new X509Certificate(blob, password); + + internal override X509Certificate Import(byte[] blob, SecureString password) + => new X509Certificate(blob, password); + + internal override X509Certificate Import(string fileName) + => new X509Certificate(fileName); + + internal override X509Certificate Import(string fileName, string password) + => new X509Certificate(fileName, password); + + internal override X509Certificate Import(string fileName, SecureString password) + => new X509Certificate(fileName, password); + } +} diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.X509Certificate2.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.X509Certificate2.cs new file mode 100644 index 00000000000000..4aa403e6666b51 --- /dev/null +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.X509Certificate2.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.DotNet.RemoteExecutor; +using Microsoft.DotNet.XUnitExtensions; +using Xunit; + +namespace System.Security.Cryptography.X509Certificates.Tests +{ + [SkipOnPlatform(TestPlatforms.Browser, "Browser doesn't support X.509 certificates")] + public class PfxIterationCountTests_X509Certificate2 : PfxIterationCountTests + { + internal override X509Certificate Import(byte[] blob) + => new X509Certificate2(blob); + + internal override X509Certificate Import(byte[] blob, string password) + => new X509Certificate2(blob, password); + + internal override X509Certificate Import(byte[] blob, SecureString password) + => new X509Certificate2(blob, password); + + internal override X509Certificate Import(string fileName) + => new X509Certificate2(fileName); + + internal override X509Certificate Import(string fileName, string password) + => new X509Certificate2(fileName, password); + + internal override X509Certificate Import(string fileName, SecureString password) + => new X509Certificate2(fileName, password); + + + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + public static void Import_IterationCountLimitExceeded_ThrowsInAllottedTime() + { + const int AllottedTime = 5000; + + if (!PfxTests.Pkcs12PBES2Supported) + { + throw new SkipTestException("Pkcs12NoPassword100MRounds uses PBES2, which is not supported on this version."); + } + + RemoteInvokeOptions options = new() + { + TimeOut = AllottedTime + }; + + RemoteExecutor.Invoke(static () => + { + byte[] blob = TestData.Pkcs12NoPassword100MRounds; + CryptographicException ce = Assert.Throws(() => new X509Certificate2(blob)); + Assert.Contains("2233907", ce.Message); + }, options).Dispose(); + } + } +} diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.X509Certificate2Collection.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.X509Certificate2Collection.cs new file mode 100644 index 00000000000000..40b8ac11da8f43 --- /dev/null +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.X509Certificate2Collection.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Security.Cryptography.X509Certificates.Tests +{ + public class PfxIterationCountTests_X509Certificate2Collection : PfxIterationCountTests + { + internal override X509Certificate Import(byte[] blob) + { + X509Certificate2Collection collection = new X509Certificate2Collection(); + collection.Import(blob); + return collection[0]; + } + + internal override X509Certificate Import(byte[] blob, string password) + { + X509Certificate2Collection collection = new X509Certificate2Collection(); + collection.Import(blob, password, X509KeyStorageFlags.DefaultKeySet); + return collection[0]; + } + + // X509Certificate2Collection.Import does not support SecureString so we just make this work. + internal override X509Certificate Import(byte[] blob, SecureString password) + => new X509Certificate2(blob, password); + + internal override X509Certificate Import(string fileName) + { + X509Certificate2Collection collection = new X509Certificate2Collection(); + collection.Import(fileName); + return collection[0]; + } + + internal override X509Certificate Import(string fileName, string password) + { + X509Certificate2Collection collection = new X509Certificate2Collection(); + collection.Import(fileName, password, X509KeyStorageFlags.DefaultKeySet); + return collection[0]; + } + + // X509Certificate2Collection.Import does not support SecureString so we just make this work. + internal override X509Certificate Import(string fileName, SecureString password) + => new X509Certificate2(fileName, password); + } +} diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.cs new file mode 100644 index 00000000000000..234ec5bf3e6224 --- /dev/null +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxIterationCountTests.cs @@ -0,0 +1,225 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.DotNet.XUnitExtensions; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using Test.Cryptography; +using Xunit; + +namespace System.Security.Cryptography.X509Certificates.Tests +{ + public abstract partial class PfxIterationCountTests + { + private const long DefaultIterationLimit = 600_000; + internal abstract X509Certificate Import(byte[] blob); + internal abstract X509Certificate Import(byte[] blob, string password); + internal abstract X509Certificate Import(byte[] blob, SecureString password); + internal abstract X509Certificate Import(string fileName); + internal abstract X509Certificate Import(string fileName, string password); + internal abstract X509Certificate Import(string fileName, SecureString password); + + [ConditionalTheory] + [MemberData(nameof(GetCertsWith_IterationCountNotExceedingDefaultLimit_AndNullOrEmptyPassword_MemberData))] + public void Import_IterationCounLimitNotExceeded_Succeeds(string name, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) + { + if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) + { + throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); + } + + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + + if (PfxTests.IsPkcs12IterationCountAllowed(iterationCount, PfxTests.DefaultIterations)) + { + X509Certificate cert = Import(blob); + Assert.True(cert.Subject == "CN=test" || cert.Subject == "CN=potato"); + } + } + + [ConditionalTheory] + [MemberData(nameof(GetCertsWith_IterationCountExceedingDefaultLimit_MemberData))] + public void Import_IterationCountLimitExceeded_Throws(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) + { + _ = password; + _ = iterationCount; + + if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) + { + throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); + } + + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + + CryptographicException ce = Assert.Throws(() => Import(blob)); + Assert.Contains("2233907", ce.Message); + } + + [ConditionalTheory] + [MemberData(nameof(GetCertsWith_IterationCountExceedingDefaultLimit_MemberData))] + public void ImportWithPasswordOrFileName_IterationCountLimitExceeded(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) + { + if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) + { + throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); + } + + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + + using (TempFileHolder tempFile = new TempFileHolder(blob)) + { + string fileName = tempFile.FilePath; + if (PfxTests.IsPkcs12IterationCountAllowed(iterationCount, PfxTests.DefaultIterations)) + { + Assert.NotNull(Import(blob, password)); + Assert.NotNull(Import(blob, PfxTests.GetSecureString(password))); + + Assert.NotNull(Import(fileName)); + Assert.NotNull(Import(fileName, password)); + Assert.NotNull(Import(fileName, PfxTests.GetSecureString(password))); + } + else + { + if (OperatingSystem.IsWindows()) + { + // Specifying password or importing from file will still give us error because cert is beyond Windows limit. + // But we will get the CryptoThrowHelper+WindowsCryptographicException. + VerifyThrowsCryptoExButDoesNotThrowPfxWithoutPassword(() => Import(blob, password)); + VerifyThrowsCryptoExButDoesNotThrowPfxWithoutPassword(() => Import(blob, PfxTests.GetSecureString(password))); + + // Using a file will do as above as well. + VerifyThrowsCryptoExButDoesNotThrowPfxWithoutPassword(() => Import(fileName)); + VerifyThrowsCryptoExButDoesNotThrowPfxWithoutPassword(() => Import(fileName, password)); + VerifyThrowsCryptoExButDoesNotThrowPfxWithoutPassword(() => Import(fileName, PfxTests.GetSecureString(password))); + } + } + } + } + + internal static void VerifyThrowsCryptoExButDoesNotThrowPfxWithoutPassword(Action action) + { + CryptographicException ce = Assert.ThrowsAny(action); + Assert.DoesNotContain("2233907", ce.Message); + } + + [ConditionalTheory] + [MemberData(nameof(GetCertsWith_NonNullOrEmptyPassword_MemberData))] + public void Import_NonNullOrEmptyPasswordExpected_Throws(string name, string password, bool usesPbes2, byte[] blob, long iterationCount, bool usesRC2) + { + if (usesPbes2 && !PfxTests.Pkcs12PBES2Supported) + { + throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); + } + + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + + CryptographicException ce = Assert.ThrowsAny(() => Import(blob)); + + if (PfxTests.IsPkcs12IterationCountAllowed(iterationCount, PfxTests.DefaultIterations)) + { + Assert.NotNull(Import(blob, password)); + Assert.NotNull(Import(blob, PfxTests.GetSecureString(password))); + + + using (TempFileHolder tempFile = new TempFileHolder(blob)) + { + string fileName = tempFile.FilePath; + Assert.NotNull(Import(fileName, password)); + Assert.NotNull(Import(fileName, PfxTests.GetSecureString(password))); + } + } + } + + internal static readonly List s_Certificates = GetCertificates(); + + internal static List GetCertificates() + { + List certificates = new List(); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12NoPassword2048RoundsHex), null, 2048 * 3, true, TestData.Pkcs12NoPassword2048RoundsHex.HexToByteArray())); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12OpenSslOneCertDefaultEmptyPassword), "", 2048 * 3, true, TestData.Pkcs12OpenSslOneCertDefaultEmptyPassword.HexToByteArray())); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12OpenSslOneCertDefaultNoMac), null, 2048, true, TestData.Pkcs12OpenSslOneCertDefaultNoMac.HexToByteArray())); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12NoPasswordRandomCounts), null, 938, true, TestData.Pkcs12NoPasswordRandomCounts)); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12WindowsDotnetExportEmptyPassword), "", 6000, false, TestData.Pkcs12WindowsDotnetExportEmptyPassword.HexToByteArray())); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12MacosKeychainCreated), null, 4097, false, TestData.Pkcs12MacosKeychainCreated.HexToByteArray(), usesRC2: true)); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12BuilderSaltWithMacNullPassword), null, 120000, true, TestData.Pkcs12BuilderSaltWithMacNullPassword.HexToByteArray())); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12Builder3DESCBCWithNullPassword), null, 30000, false, TestData.Pkcs12Builder3DESCBCWithNullPassword.HexToByteArray())); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12Builder3DESCBCWithEmptyPassword), "", 30000, false, TestData.Pkcs12Builder3DESCBCWithEmptyPassword.HexToByteArray())); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12WindowsWithCertPrivacyPasswordIsOne), "1", 4000, false, TestData.Pkcs12WindowsWithCertPrivacyPasswordIsOne.HexToByteArray())); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12WindowsWithoutCertPrivacyPasswordIsOne), "1", 4000, false, TestData.Pkcs12WindowsWithoutCertPrivacyPasswordIsOne.HexToByteArray())); + certificates.Add(new PfxInfo( + nameof(TestData.Pkcs12NoPassword600KPlusOneRoundsHex), null, 600_001 * 3, true, TestData.Pkcs12NoPassword600KPlusOneRoundsHex.HexToByteArray())); + + return certificates; + } + + public static IEnumerable GetCertsWith_IterationCountNotExceedingDefaultLimit_AndNullOrEmptyPassword_MemberData() + { + foreach (PfxInfo p in s_Certificates.Where( + c => c.IterationCount <= DefaultIterationLimit && + string.IsNullOrEmpty(c.Password))) + { + yield return new object[] { p.Name, p.UsesPbes2, p.Blob, p.IterationCount, p.UsesRC2 }; + } + } + + public static IEnumerable GetCertsWith_IterationCountExceedingDefaultLimit_MemberData() + { + foreach (PfxInfo p in s_Certificates.Where(c => c.IterationCount > DefaultIterationLimit)) + { + yield return new object[] { p.Name, p.Password, p.UsesPbes2, p.Blob, p.IterationCount, p.UsesRC2 }; + } + } + + public static IEnumerable GetCertsWith_NonNullOrEmptyPassword_MemberData() + { + foreach(PfxInfo p in s_Certificates.Where(c => !string.IsNullOrEmpty(c.Password))) + { + yield return new object[] { p.Name, p.Password, p.UsesPbes2, p.Blob, p.IterationCount, p.UsesRC2 }; + } + } + } + + public class PfxInfo + { + internal string Name { get; set; } + internal string? Password { get; set; } + internal long IterationCount { get; set; } + internal bool UsesPbes2 { get; set; } + internal byte[] Blob { get; set; } + internal bool UsesRC2 { get; set; } + + internal PfxInfo(string name, string password, long iterationCount, bool usesPbes2, byte[] blob, bool usesRC2 = false) + { + Name = name; + Password = password; + IterationCount = iterationCount; + UsesPbes2 = usesPbes2; + Blob = blob; + UsesRC2 = usesRC2; + } + } +} diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs index bd853f1e098be6..3c1669aa36573b 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs @@ -1,14 +1,28 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.DotNet.XUnitExtensions; using System.Collections.Generic; +using System.Reflection; +using System.Text; using Test.Cryptography; +using Microsoft.DotNet.RemoteExecutor; using Xunit; +using System.Linq; namespace System.Security.Cryptography.X509Certificates.Tests { public static class PfxTests { + private const long UnspecifiedIterations = -2; + private const long UnlimitedIterations = -1; + internal const long DefaultIterations = 600_000; + private const long DefaultIterationsWindows = 600_000; + + // We don't know for sure this is a correct Windows version when this support was added but + // we know for a fact lower versions don't support it. + public static bool Pkcs12PBES2Supported => !PlatformDetection.IsWindows || PlatformDetection.IsWindows10Version1703OrGreater; + public static IEnumerable BrainpoolCurvesPfx { get @@ -141,6 +155,7 @@ private static void VerifyPrivateKey(RSA rsa) [Theory] [MemberData(nameof(StorageFlags))] + [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "The PKCS#12 Exportable flag is not supported on iOS/MacCatalyst/tvOS")] public static void ExportWithPrivateKey(X509KeyStorageFlags keyStorageFlags) { using (var cert = new X509Certificate2(TestData.PfxData, TestData.PfxDataPassword, X509KeyStorageFlags.Exportable | keyStorageFlags)) @@ -447,6 +462,70 @@ public static void CollectionPerphemeralImport_HasKeyName() } } + + [ConditionalTheory] + [MemberData(memberName: nameof(PfxIterationCountTests.GetCertsWith_IterationCountNotExceedingDefaultLimit_AndNullOrEmptyPassword_MemberData), MemberType = typeof(PfxIterationCountTests))] + public static void TestIterationCounter(string name, bool usesPbes2, byte[] blob, int iterationCount, bool usesRC2) + { + _ = iterationCount; + + MethodInfo method = typeof(X509Certificate).GetMethod("GetIterationCount", BindingFlags.Static | BindingFlags.NonPublic); + GetIterationCountDelegate target = method.CreateDelegate(); + + if (usesPbes2 && !Pkcs12PBES2Supported) + { + throw new SkipTestException(name + " uses PBES2 which is not supported on this version."); + } + + if (usesRC2 && !PlatformSupport.IsRC2Supported) + { + throw new SkipTestException(name + " uses RC2, which is not supported on this platform."); + } + + try + { + long count = (long)target(blob); + Assert.Equal(iterationCount, count); + } + catch (Exception e) + { + throw new Exception($"There's an error on certificate {name}, see inner exception for details", e); + } + } + + internal static bool IsPkcs12IterationCountAllowed(long iterationCount, long allowedIterations) + { + if (allowedIterations == UnlimitedIterations) + { + return true; + } + + if (allowedIterations == UnspecifiedIterations) + { + allowedIterations = DefaultIterations; + } + + Assert.True(allowedIterations >= 0); + + return iterationCount <= allowedIterations; + } + + // This is a horrible way to produce SecureString. SecureString is deprecated and should not be used. + // This is only reasonable because it is a test driver. + internal static SecureString? GetSecureString(string password) + { + if (password == null) + return null; + + SecureString secureString = new SecureString(); + foreach (char c in password) + { + secureString.AppendChar(c); + } + + return secureString; + } + // Keep the ECDsaCng-ness contained within this helper method so that it doesn't trigger a // FileNotFoundException on Unix. private static void AssertEccAlgorithm(ECDsa ecdsa, string algorithmId) @@ -475,5 +554,7 @@ private static X509Certificate2 Rewrap(this X509Certificate2 c) c.Dispose(); return newC; } + + internal delegate ulong GetIterationCountDelegate(ReadOnlySpan pkcs12); } } diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PropsTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PropsTests.cs index 4a78718b91be33..a2759f5126dd46 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/PropsTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/PropsTests.cs @@ -389,6 +389,20 @@ public static void TestGetNameInfo() } } + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void GetNameInfo_HandlesUtf8Encoding(bool issuer) + { + using (X509Certificate2 c = new X509Certificate2(TestData.CertificateWithUtf8)) + { + // Russian word for "potato" in Cyrillic, kartoshka. + string expected = "\u043A\u0430\u0440\u0442\u043E\u0448\u043A\u0430"; + string cn = c.GetNameInfo(X509NameType.SimpleName, issuer); + Assert.Equal(expected, cn); + } + } + [Fact] public static void ComplexGetNameInfo_SimpleName_Cert() { diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/AiaTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/AiaTests.cs index 89882f4de5a33c..753bec3b88b6bd 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/AiaTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/RevocationTests/AiaTests.cs @@ -53,6 +53,41 @@ public static void EmptyAiaResponseIsIgnored() } } + [Theory] + [InlineData(AiaResponseKind.Pkcs12, true)] + [InlineData(AiaResponseKind.Cert, false)] + public static void AiaAcceptsCertTypesAndIgnoresNonCertTypes(AiaResponseKind aiaResponseKind, bool mustIgnore) + { + CertificateAuthority.BuildPrivatePki( + PkiOptions.AllRevocation, + out RevocationResponder responder, + out CertificateAuthority root, + out CertificateAuthority intermediate, + out X509Certificate2 endEntity, + pkiOptionsInSubject: false, + testName: Guid.NewGuid().ToString()); + + using (responder) + using (root) + using (intermediate) + using (endEntity) + using (X509Certificate2 rootCert = root.CloneIssuerCert()) + { + responder.AiaResponseKind = aiaResponseKind; + + using (ChainHolder holder = new ChainHolder()) + { + X509Chain chain = holder.Chain; + chain.ChainPolicy.CustomTrustStore.Add(rootCert); + chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust; + chain.ChainPolicy.VerificationTime = endEntity.NotBefore.AddMinutes(1); + chain.ChainPolicy.UrlRetrievalTimeout = DynamicRevocationTests.s_urlRetrievalLimit; + + Assert.NotEqual(mustIgnore, chain.Build(endEntity)); + } + } + } + [Fact] [SkipOnPlatform(PlatformSupport.MobileAppleCrypto, "CA store is not available")] public static void DisableAiaOptionWorks() diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj b/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj index 18b91ea847238f..07c332c411e2f8 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj @@ -35,6 +35,11 @@ + + + + + diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/TempFileHolder.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/TempFileHolder.cs index 4ce70ccbf4412b..a6efa3a1f19173 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/TempFileHolder.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/TempFileHolder.cs @@ -20,6 +20,13 @@ public TempFileHolder(ReadOnlySpan content) } } + public TempFileHolder(byte[] content) + { + FilePath = Path.GetTempFileName(); + + File.WriteAllBytes(FilePath, content); + } + public void Dispose() { try diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/TestData.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/TestData.cs index a738e45375ecab..93f2b74d05a960 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/TestData.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/TestData.cs @@ -2463,6 +2463,33 @@ internal struct ECDsaCngKeyValues "028bedeefab9a2be80466fe278fdc50db1b9530e1796b23271b4df2cddd9" + "4769c8a21a8f66c6d4bc181713").HexToByteArray(); + internal static byte[] CertificateWithUtf8 = ( + "30820315308201fda003020102020900e48b784d93645921300d06092a864886" + + "f70d01010b0500301b3119301706035504030c10d0bad0b0d180d182d0bed188" + + "d0bad0b0301e170d3231303931343230353635365a170d333230383237323035" + + "3635365a301b3119301706035504030c10d0bad0b0d180d182d0bed188d0bad0" + + "b030820122300d06092a864886f70d01010105000382010f003082010a028201" + + "0100c394711b3839a612aaadafde855ccc3479bc1dbe253a29e508cc46464efb" + + "ab09b16b85fb67e4be0ab8b09fa6ff73cb3ec5d8f8b7d2869a79c414d025a43e" + + "4c158c9711638dbfb070ef92b3633037d5e633a870ed024ab9017c97e26f02de" + + "2273dd92c0837a95ff12229981cd661b140afd841671d3397fd44aea05878dd0" + + "9362bd2de8da17225dd3caf0181aadf2c9e13faefbbce3ce80ef355dcc15c1b9" + + "c6e86bb1cddf32b3113e7a72ad3799cc67f64ea34c0518c22727972802084801" + + "e6565b2323e87fd20019a9db151e87b2b1db004583e15dd64c5393439a0ba5ed" + + "3b9fd262c8d8bf0263dcba092ca5591d4d34f990daa9ee41811cec6229f2121b" + + "582f0203010001a35c305a301b0603551d11041430128210786e2d2d38306161" + + "326162746c6f3363301d0603551d250416301406082b0601050507030106082b" + + "06010505070302300f0603551d130101ff040530030101ff300b0603551d0f04" + + "040302028c300d06092a864886f70d01010b050003820101001c0512d3d99267" + + "4ca3a1fdf942052064ffbda824aaeff07d9869eefa86e592102afca0dba4e267" + + "e54753552fc23da97b18f739ea437794aac5bb2ae7413ae54ce921b4b96fe420" + + "f3fd86f922adcab202589823c4095fc6e7904e61be1716faec7e09ce2d1bf431" + + "fa9fc2d7284689d2c940f7d027e16b9c3305f9cd6d5dc6bfee9089d85d342f5b" + + "d07920c51899288674a1732708a7e3a39fb11c152417d50a3bb9b09975852baa" + + "39767c289baea9330902ea38388932964c410cd22049415712223fb5710a21ef" + + "153ac22391a1603547ffb3f9b328c59e59b5d64568b9c451df233fe9a581116f" + + "05be8c67b92bc7df9984f30535ad53817cb4abcd77cb521856").HexToByteArray(); + internal static byte[] ConcatenatedPemFile = ByteUtils.AsciiBytes( @"-----BEGIN CERTIFICATE----- MIIFcDCCBFigAwIBAgIQB6krbZc11OZ5l2/FnU3CpTANBgkqhkiG9w0BAQsFADBG @@ -2883,5 +2910,1292 @@ internal static DSAParameters GetDSA1024Params() yJpx+jD1MsjIEXIn5jtjXdUHd0JJmHWAyHdNzmhXrXC7JLnj4ri7xMAV3GZGDpAn YvvL0LiXzFyomg== -----END PUBLIC KEY-----"; + + public static readonly byte[] PfxWithNoPassword = ( + "308205DB0201033082059706092A864886F70D010701A0820588048205843082" + + "0580308202F106092A864886F70D010701A08202E2048202DE308202DA308202" + + "D6060B2A864886F70D010C0A0102A08202AE308202AA3024060A2A864886F70D" + + "010C010330160410286B4EFF0202AFE16583E50C3EB8F38F020207D004820280" + + "C3452B3850AE69FCC0AC426FF3A0421477813259C128D643452219EEF71EBCAB" + + "5E7054B7A195E3F945222864CA37D8F67DDFA9136A93CD7FEAD86F00D4179F1C" + + "557253253C6235295499729C564DE2CE30E131C0D9B3E1BDBB211F8FA9E78B7B" + + "088C63137DF44CF50C293E082E7C57A8D0CB0404D1F5B9D1491F4EF9045181D3" + + "8D528C61F49EB3F1CF11ABB60270CBC10AC4BAF115A5AB52EA22FE4406743695" + + "7DDC1BFEE0C6BDC097BDF092AC6D11CABAE497FC10564E7E7797BC6028CBD75B" + + "1A2339329D439F6557B3CEB77489467FC8990EE832D48E2FF65A7BCB20E2DBBD" + + "F81C762F688E2EE43822CF9DEDE11914DD982FAB2AC141496D912396F6F67E3C" + + "D04D0617F8EC2BE6D35AF9860C384DB8C21FD0B00494FA3188983E6200DE90B3" + + "E6E662C5B07AB202A1B9C3F10F03B88E677EC7BDC2873AA4DFF873DCD714AD39" + + "42C33E63442A855C709F58063D836F8CA77DB9D208F3DB2552D7AC611409E8BA" + + "942BE520D9B4951AB844892D123DF550BA4F22D255069AD77E6C14D730128FAD" + + "3736551CDBEED2022417A948B1BD2567C39DFB561F251C45D2F4B5711B4AC82A" + + "09226403432FEEEEAC5F54590CC2EC7925768651ACF42C32A114ED133718FB1A" + + "9FB0DCC35C10640226F7587BD4EA67C10EF963113D03988C82B3A0B43B1B60ED" + + "BE0A7CBCB6422CD9695BF206A190E8EA6F87E2FABB33549081EFA7A8B04CA044" + + "9DF52E133556781511CDFCBDC55B487DA51C8D476FB635896FD0C71754B2EEE9" + + "A395F355F4A56CCB8CE75D65F73AE8DE80215EA7CA9129FD90EC48ECF26828A6" + + "0E471FA5F34471AD1C21AD200E16C4E4E99FA55B5CF75BC4BF68D1A975E8276F" + + "5EBD47EEB21DB06092F51AEE6BDAA2CDBC9387620A2B3983247E9AA93252D49A" + + "3115301306092A864886F70D01091531060404000000003082028706092A8648" + + "86F70D010706A0820278308202740201003082026D06092A864886F70D010701" + + "3024060A2A864886F70D010C010330160410127070F8C0D10011CBE0CC8489A3" + + "0C71020207D080820238C151B340B678AE8CAD6C6B11E0661E91FD1F4107F0DB" + + "687F039362D88AFF382E3557A75157D8A6D93F0777AD41D7520D32916677699A" + + "EC3DAEE462344BF18410EE07E83811EC26569FF9CD8D13A77F387D6E7C5C21C1" + + "6BC9936DB1B8AB614A8B4B6F9975E4A0A5DFCE29EF14E833FB2526805901A782" + + "724AF6BA2A80E93A4C4BA07B1C1319169E200A4B7AB100AE2CA135512919120A" + + "1D1AB57EF6DED00144F87D051391676D205196ABB4B211698BF137436D6E39D6" + + "719737B66AD2E76D5766D36E87108D79145021C77328A9F2ADDF44EC2A95EEA3" + + "86DCA32FB53D0AA92FB5C5BB7B49CB1F1755ABF195C7274702681C616C21BB05" + + "817B5FD344FC25CC6145A4FFE36F4D5BC131434E6C44BD14769EB08FBDA0D1A0" + + "6DCF2D061FA4A2FCC45A30125680507AACEE7903ABA0C1D36395925A82741797" + + "CF93A11F249D7E7D8228F8F6AFD03FB317D1F2BDB319C0AEF15E19E9DB1067B1" + + "A6CC12CA458C33BAB31C3F275C45A956F71CFF939F393EC7D20E13B397E64263" + + "702B54DD228D0E1275B39A77B3B1A28EFD5C7DF2643CAF7AAF8574988CDF4112" + + "E057F715331F6E75462E6C948BFB92C5BC81B84FBB47FB97AEB3D8C228388B94" + + "CDFA0E2A48F05A32EA9F2CDFAE2B0CEFF815531B148C358ECE1D23F7B793A1FF" + + "ECE491E990BDF231756600B87FA2F7F3AD2C2AA2F6DB42FC6D62766F28F60436" + + "FFA4993C87BE6631D7CE6C06C5B7AE7218450C504ADB401B9FBA5FB2FC6A8289" + + "B42D51B4E1AF159AE7F3A63BA8644C8C5A99F108FC25A27DE54E268AF8A259D9" + + "F6E3303B301F300706052B0E03021A0414AF311074EBABE699402460BFFFE14E" + + "4D7314FCB4041469835268466D1390373566F7034C4736346CD17D020207D0").HexToByteArray(); + + internal static readonly byte[] Pkcs12NoPasswordRandomCounts = + Convert.FromBase64String(@" + MIIvdAIBAzCCLtQGCSqGSIb3DQEHAaCCLsUEgi7BMIIuvTCCLrkGCSqGSIb3DQEHAaCCLqoEgi6m + MIIuojCCAvkGCyqGSIb3DQEMCgECoIIC6DCCAuQwXgYJKoZIhvcNAQUNMFEwMAYJKoZIhvcNAQUM + MCMEELD+7LV5Y9tyUiJnNeZVLwQCASowDAYIKoZIhvcNAgsFADAdBglghkgBZQMEASoEEBzHfelA + 4f5vP3LmQVtFodcEggKAfy/+/5lLpe/Ti1qZB1kbVrY1nheb2TVTfqLyjqUxsQlo4ElbAdgvlkJi + NpmGu//pniqKxODkZujRMTty8VfdnLpe8gVGCltSiDSXF3ttcsv7yKYkJiU5GN4cWwz8qud6P6cn + zEHtnJJ4AkNJT/Lkjy7ktTbww+ha/1IbteKWFW7tarKkjrx2PxqiizLKhydPvLrr7v0tqgv9K2/G + mFvJF9i/ynVHS2NtD11kHysBj3DjMTSEddBp7th1gXNevQ4NcxNL9hG0g4tCYS/Tq6WRMJip5PSb + 7tsYxtWJU4vb3JYKbadVnOwiP7VAUOEU8YJUiF6lBtWvNTwpmRg8S/Jg4EWqOX32DjSl5jx/E+q6 + ljMANkInnAI7uPa87GACaaCfKI7sPtlwjz2JQtj5HUrjGu5ff0yY2fl98FneuO5n6atD1X7460vc + KdeDAhXsWh/oBGrmREYvPFI/9vE8Lm8i5FKzZZTY+XiTsQMeLeFLmzikqCubfcQhtYOJLCZUb3LD + HALSKFdtKpBJAp0rrh6NkR5ss3jFQmclctJeYYFGPfHhM6g75jqR/3X8JUucduJ8+2k25B5qqiQ2 + xMVYwLdCTU8bW2KIt3VCROEO1n+kLM94Byju1f57vn0ZkRhKtVS2AvmxdxAD2mrVE6Mj6Hw2VWHi + Bnqer8BrmOhVOoKuRj49Nz5PFGoncdayJJe6h9/HDB+RofLe8tKPbLDHbDm1jmJaZoBHbypESW5f + KUKHhjsH1awzNMs180o71hsiL4NuUqUk9nEAvx3QqolHIuGe2YnLlRBWzOB0lCqmMBV2D91O1SIX + RfZ0T+0AA87jGvjK+sCxVNQvqwgEYZTQAn11HDCCAcsGCyqGSIb3DQEMCgEDoIIBujCCAbYGCiqG + SIb3DQEJFgGgggGmBIIBojCCAZ4wggEHoAMCAQICCQDG4/UcO7qKXjANBgkqhkiG9w0BAQsFADAR + MQ8wDQYDVQQDEwZwb3RhdG8wHhcNMjMwNDE4MjAyNTA4WhcNMjMwNDE4MjAyNTA4WjARMQ8wDQYD + VQQDEwZwb3RhdG8wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAL3Hf+x7UDSJ6CzFBJ+riwvJ + TepV4Zjy/NY+09FbR9L6rmzF8fp6IyT9c5osmCK/Q81e3fptYFeSowcm4v628tM8Aw9L8+H8OO+w + xfwiQeyRXCFCwl+rRgKVuvkvtupejL6aZdaZmvF1GP/Jho13zY1ILBMzgtw+MXnZVsWi4iYxAgMB + AAEwDQYJKoZIhvcNAQELBQADgYEAE8FaAa0klFrcONIsUk6A9M45lo/iXZjnxuq/X05tDlUd/nDW + Am6bYrSxTC/o3LcYkRg+GVy8Gs1AaeeG/MFXe2zm9N7DuOqKtslKvmjt8L0L1E3zygUc4DUl87y8 + p0tn8bKI/RoflMNU/mHr8U3pKg9SaENLZq0TlBXLrr8IGyQwggL5BgsqhkiG9w0BDAoBAqCCAugw + ggLkMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBB6JnCtAnPpOcMgsMFOBUggAgE9MAwG + CCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBAFove+QNh2kcK4jBcdRQZqBIICgEZS8QJsHwDdktJ6 + 4TalaTiYmQ734FJDwHA8v0qhMEh7gWGf/0X2dRi2s27lU78g0C3YtJNnEFRtICTpco6mJu1r/+nq + 9QG6OTdwfiB8vKPpkQaLVQr4bl9rA0lAOP9Lqyv9cjFg97GLJCrsPkeykV0FafBRyeQdMjDR60yO + X2AcV3XFPrzphibsAazyC0IymSfUvytHK54PI4z9RWGwFncBZjItkbNPxfVoMRnfBpLOYpz/nfFu + eky6qItXtXkz0rfC4qNPEpPEd4E2ecoRWJxCK6ItS2R5zfrTeQ0LqlkptBvcxC2k3TfSl+TVTee7 + g0+z8bc9JypL9qr/M4Ir8qLbdGT4aAigRrS8+s336p3J4qJkdFreS+FtHHlmms6E28g2h6HwynCG + Mc/z8TikKm/ltJ4+FiB6g+NywPgJbMFBjsaNF+wPlGMRO83M+3zysQCPrhtdo2gsjnJEqBN2kXu8 + 4k05UAHTpsrZn7FmAG7Kt553y/xJqY8U0rwswlcy402CKtS26kQ7Vv0Ic3YfsaNypNwYo1h5b/tl + t/8c0Sws8JoEj4RW/dflaMmZ5qDdZ1Smiwgx3l4VC9lpm2AmTlvV3MBdsnAKMfQuilqK14rOftaG + lzKIEI34F/Z7qUKCTL6LgTsHxt6L/aHxeraXSMplLb7E6rRlau7BYZBNbtZ6hHRzqBIui9m7iQ23 + 3wYxpK7etlFz6fAHyFFxsawMrjgFq24L3dugCa2wuUPesNwcSn2Zte6FS+JUOgaOqWAsSwhDPn+u + Fws/t23vpKm1cBtNAE4kl6IWI4/QBfxnAHabNE66LZfFUSFXsk+wKJO8PKsfSLZ6oVZSkRcOHQ4W + EN4wggL5BgsqhkiG9w0BDAoBAqCCAugwggLkMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAj + BBDJY4TwjOXIl9C20wMX0JQSAgE9MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBBegG+K9bCn + WqkCVKlZOYRrBIICgO1ic3SIALh0ujMqyrqazrx+E53ShenbUAx5fgSka7pINpFjtFikScuN6bAc + fs2lQTgH0+alWGr+HLoHa0GsO4Z/TPYZqswD8NFoVFKz5gK2zXMfFrObp/0HVj8hLMfOKiMH6tWo + yL0gDDn3t1kz9v2eglf8ifjS1jFANpX4s/hpEFdCfzqjsQwy7ToZdn2BB2CbUy9A3GFoi/z1O+7N + angPPr4r6PE1jOH63TFIRwxmH6kLGGc253UxQI4P+v5g/hh19dRByjIQvk2TyWYRugkAx/B4RNzD + NAWYFvae79uWhKQrfzUWhGhtfmWxqcZnwDb69aCdzBBXOKz7n2ZCK6Ex8qK2gm29foqjMQnX8YQZ + EB5dRX1r+jIBHwBQFyz4fofByVdjb4SA7g7RAmoCRYsJYupz9Gnesg0De3iADbTx97oco60PXdjL + OHhGqjrMpgAKSVS+tULc33CSUHq+Zsevs/hSB0Aqh6YH+3kWp/LdRB72FUHQSpt5/aFm84M8guc7 + lD11Fcgpj/y1zUmyFlyvRgvGMeFhkGTJPkkSpFXq+M09xAuljtQ+QCTF1Q/jx9cI9glconr+umd2 + VB0Mq/ppRrbiCGFNLOOfHk6na1Z2FAv8bywZ701WyMaZRvgaYca8ueKEh77MQsymG/5A1kKueiRW + 9Gx6tP0OJDWUCaOeGMJQFdP/e52FC+EdKkAZajngWThSX/ZO2Mp8oxufHRGcGHIdzFCzh5iaVxb9 + 7pG3rV6NS9wSz8eAMixmEmf44P8rOhiHbyxoaCB+6iYluHtQuw2fU7JlIPFrK/o++rGtDq+GHQw2 + zXUIbrpw1MzbtUgW/hTRlqjasXtlrgDzSZYwggL5BgsqhkiG9w0BDAoBAqCCAugwggLkMF4GCSqG + SIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBAQSmfTMz55MV7GR5lEF9SXAgE9MAwGCCqGSIb3DQIL + BQAwHQYJYIZIAWUDBAEqBBDLBwbNgTYNIoSJTI9zbdvuBIICgHux5dOkqx9pQCQ8nDYiqUJAkfl3 + SEF+FRJb2xUErUshDNwFeC8NHkJ6R/KkBAtqRtak44/EuN8/RPrZa4huIFxu71hABETWit+fyirU + HnqAS/mz66pe3IxRr5qFY5/WxUCsYj3lYjfVyLKrCwBZhtYyrXQJg+0qWYs6+16ij7pifosDb90e + UgD5U9jqwMIwAdjiTxQ6BSq9AeIlhdI9Y1z13kfcXXhWpNu6EWlcYB2VNPZ4r32CRJe+fR9AWXCb + iajbIItWjhiwRlVLao8KcFMAq5N5CaDEZj3RwVb7Cf24Pb6j+dF+EotSW2Wem3ZAPeKOTI0Ykk2f + MtZPD5znGZBJtbBM6iuoqm3+axrnK6f8XAyKdKEHnA3lqGtQR8GimqwCFkBv/gUVk9eVCvL6yErp + zoJpA6r0fLo1NQGSW17TR0NMyfyPThqRrUtTZlDCWzgJbfNWs/oaAplX63naXsUtS3duYQSTHO95 + 4e89OrrSa/eXSYn30j767GEkIUGBFaPcFqV86FMBiVbDOmvEYBK6ORdBqYrjLAD88EYX9e/pcmgn + svWLwWlYe+uMAGMOxsuvQcp3vqlyPCxuYrh6LdKVBrK4m9wQAIyF3niDrGOJpmVztKdDaB51jDav + nK16vc5JpG3BlnnpjBEEYJGUS18ms6RTH4iLpk/Ui4A32sdhM44P/nnUoEtaDrKoUxMNS6UcDaEf + 5N7eJ+ccEDGym3tGxVCT7i6uKrQKEyKf7FI0mf9NgPk1Lz/DBCyvnRVgx7qEdhmbhEUZgQ7ccmBj + V4cFR7+NfnxUABCyJyZu+gLFqaDfALhQvwmCIrAgOgx8FyeMw8MWdFFUk0WV7K0nUh4wggL5Bgsq + hkiG9w0BDAoBAqCCAugwggLkMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBA8NwJFoLrq + bxCmSinxHNnGAgE9MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBB3zPuXtX75pJJA2Rvq+DyC + BIICgF/qdMfgy4cf03s8T2UbLt1bsLvsJgptXjgrGYWfc6lgidaWxGPf+66HwqaCA4sTPH/U98jO + Ok8ljcVApAAlAONsQKlOYm1G/V8AxgF1RD02GQo148+kHq4swNcdXoAcowuvEihsGKk1jszXH2L0 + iahiAMwRimEglTaGBJd1cJLhVe45A7RHPl8hKZECvvSx2kB1h26pqBIYRoGSamAwABRKYc43YlBG + eczB8Ry+sZUwrhntjSFeGa61TGM9jWr04GjnnTWN+IxRXz9Epe0NWFPMcOXg+gIPFf6RyULYdSO0 + kNb3jolrz7nYKO4qTHwuqYrQGJC/3sfqc+s2SCNZnIhrQf3Q2L3jhqxnc/u7gdxqXGwFCxkeG/q+ + TW8Yt4ncqETFqmQs8J6IMPncuoRHmYT+9JZjBnCakFjsrwOBQD69K1VMJ1ZbfZY66YAA+tLUuDB5 + khn5zmeqbyjRDaG+sZZtvHYhob+Hbz0o1Uv9vXQ3t2mVENHPj2LI6Fk+AGNKp5O4DYBVsrak8huL + hc7W9Z9/SAAUFfkf8P4fp18WgTnWr8Wv7UBSHmwTWwzjEERCI+KENH/zODdlwQH2I8/bsS8vNC91 + WWXrBIF1BU1jsHSYbqkDvOugll8bY9LB04isZfcUucdIJH9U7FRbAR3hXeC47C9C6kZvKVqwW5ag + KcFKE212LRK19NQ8UBNwQdxL3WIlT/32AHVVzkBfL5mUqkwTQWaZrD+6+wrVKsG28ECrJvYUQlQg + L4+uErK5RWgfTOJHgrlWB0bd+AJ7oZ2agys9eL8Nh9/pzR8vp3xrrwofFRZxc+8rzHRvcJhjpUAQ + uWK1DJtx8SBLWXJh6QLXiGIwggL5BgsqhkiG9w0BDAoBAqCCAugwggLkMF4GCSqGSIb3DQEFDTBR + MDAGCSqGSIb3DQEFDDAjBBCRnVLg3B7r7n0iuf43dPAcAgE9MAwGCCqGSIb3DQILBQAwHQYJYIZI + AWUDBAEqBBCNlDLKYmIdyzfRqK8rUN3IBIICgGM4XE2PVGrFipIfzqKwU17TmIDKKPPBbk24RCo9 + 0Q9yRIH3yyLoV8rd3xONA9eUU5JePhwDEgDS3z1Vl6E4qAVXZ86E+APODs2ZyhYO3IA7NmUjvlH1 + s01OjmVIQdn/GHhfbYl5vseuedFtYmKGMmyUxCOVtYBro1P5RKZF0boeA4Dq+9tl6awVptEN18yL + a24HmWKfleY9uYQZ26sX3LFmzhCZI6gSpdcg9Fv+WzoFZn/XbhY9g4IK7OMzEYnqw9JGBQRl/kNR + 1sSkxPiB8CHWfeNkQz6hfUrubFI9+rZCzMn+j1LC7ERFKff4bX+qBU766+jB7DK0vL2Q6QqLYvGR + IrYGn6B2X2X7sOA8CYIvFKVawy7Ec9ZLi3cxriFgZMdmkB9mzzenq+wB8gkFqnnbw+CjTWQTwB4P + SZEUsls1uHgoClg+UMvpNXJ0YosdfmrOswSwG82kPF8R6ZT89o7E/+8SGKz7khF0U9Tdn+ZygoL6 + OxuMln0Jwg//hp0QejHYxVxRy9D5GHVH4FuLpei8Jwpisz3Rvb5+59SUU3VKlkxuPD2R7OJuQVkL + N+GXeEOJ59gOI38FKef7p/AJU8PdTt4nxCTjLpbBsNkG9NcY9ORpEY3FCjEJK6jLiid04FE94A1F + 0Xbsr6fWFIbCrYG+pZiashoiboAyUTEiwFuNoI0ao1sNaOkEkFiEDjxvlGZ7KH8Cv+wxZ8qDpcUR + Uhd2VEmpN1/RbWlXfqgGANFo/jipLgNXOCCMrBCpkkPnscoKoWAQNVSbEjcelAslXiCqumR+EBr6 + Hx3W0prA2SyGlhHDjJGA1c3a9oPpJ2oDX7+RNThRAnhiQ7xNeGPHgHowggL5BgsqhkiG9w0BDAoB + AqCCAugwggLkMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBDYU4dscAnvUzG7FUBYdA2c + AgE9MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBAwsNB30zk+oAIl92c/+T0cBIICgA3tpZTk + auJrxGyE7auf2lrpB1nCtHGHsxHpm0TOj+7ovX8/TZcR/j/JTQrAs85/MHRmZu9MZ/PNRTMpgcP/ + 9qtZQ451OaRtiamanzKXklZdCQYEKsgT18PlLDLtmGJu7vlDJqwwCRTl9hix7seVXpM7f3zeh2eA + z941NN7MREVEtGgvTP0SL9w6S8V3KhU0h35roH81A8dh7TLjisAMKkfMePLg7AzGX++npX5Q59zm + Pf+eZCk7oqhGpZNCruLXgF363h94MoTweifZjtZp2kBD/V3258Ix3f6Z+SiGvTqxyhSYiVUAFHDP + zmLsj/lJw8Rwk7GcGjgbeF+hrkvvl95mtNCl29ocbKn+eJjmkF2g5YGUtdk+JZd0vZ6f1DhvpO0b + ONq96Do5ltTUM0YmyFUilAJx+vYXtG1t2iXjN+ASGfYGI81jbksK8HPB7Bg80ILREl7D0EsKgB1o + cUfPT7FqW56EJQpTyaDarKSkHXMNu7g1SQCe4X55qOJPpXgJb6mNaa1Kf2f8y1n0qtd6FYNHBpcF + 3dFxcDV/WLQRqpgIRk8EB1nEoT+yEJfMfQn/KCMM2IfW7+yrsfS/KUSKnN5B6JUBO2+OzlpJDQ2u + rB9oKFXN4Jx/x8wJHgmQRf6R111w7166mddBgJfwKs/1hphyoCefr9nuemyP0RE0ukU5r+aOv2mR + CS2DmPpPT6VufeeruhxsL2+fcuVfF7hjX5HUbMhbgIyiDnzIrkEZxU0qqJSwbLSzHrmLqWuSIkXI + AKbQXVBhZoIxnMIafNVJ+SXfaqyl8O/xn8hi1XcZbNs46cSOfbtGdzfqxwmPfwRewVaXN4UisOeM + xMA0jalkD8wwggL5BgsqhkiG9w0BDAoBAqCCAugwggLkMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3 + DQEFDDAjBBDJYnZTe7lgNIfACZNNAJX2AgE9MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBDN + DMvGFo4NtfB+zBihcVVXBIICgP0SMgHhWsdkjRny48Ha7ji8ysQ1KZKU6umNfjMZ5A78Ic8Zsk0K + AXHHtX1zDwFOkx+/laRpYlNH8lMYyo4elf8oBfsXzvYfF9ROz08L0EqHIL0gWm4XTShkHGyrB5RW + XurVNRKIy6lA/OAB2lf1rFGxEAgOGvoROc3pIJGH/KQa9XRUhD/NK1U3CmhoF5GcHOUoxsW5zmxT + CHR8gZIG+U3W7kF9H87ZFuM9VNk9zbQr9pBKzPWr8JxrA7MikjTZli+rIyOgeuuMeE+pDw7d2pS7 + /rbnUY/X2l4LvR3vjaGCTxctx/0inpyY5gmN1DSybq1sypTz0QpqFUJY9kAKI+7BA+KsCmWPjFpo + HrUfjQ2vqmbcSFyKItGBMEXT5tJb9+rL5HNvFmxTt8LCfa7/0KAONLCe6+iaY/rLwA5a71RC7WKp + oYyedIMkZi6Bv097gXJa+H9l7VPVJCsO71PPKWHZEbm/F4xXiaf7s91/abt2kHGGq5IfFx6mtuJE + 0+RqoyZwBL2tOob+BBUTW8p9/nBmGkTjY9Eqt9Kp8tZrPcFOwrD2PqSN93n8KmFDE9/B5Aq3ejis + ctNf+aq6gAw7/QmvM6VFIZJbq3b38xax4W/e+uUb4xgpi4hsj/w0xh7yxBjYv8HtW8+mBJzUpArj + BoRsnyn/SHJHpnEOM+nCi+p2/qF1lvHDCNfoW+/6utwX95ic1ogMeH3TCvGUmGf+uc3L79OC5HlD + yCkA/yCd7YD65T8EmjZhwa2RPx4DTErQ1jJPkJPhM+k5kSxcXUQjF2A7jo6Av6FGFESmu1N22fTH + 2yK9osG4vbvhKYEBtYAzi9GFZPqwIh2uG6YTdhbNfKAwggL5BgsqhkiG9w0BDAoBAqCCAugwggLk + MF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBA8SVWRj2wPS4KfI+loUA3XAgE9MAwGCCqG + SIb3DQILBQAwHQYJYIZIAWUDBAEqBBBr5TnL/rG4n7kGGunNQWOWBIICgIu2UuhmU1gAQGAXvgcJ + zPa8FhjQE1OoGfh5oySL2uqn6VH4PTc87/j/p+yGwFVFe5hfe0YwqhSiDrLEXYMNb8PisHILlQzW + fDHCwLSYX6oUPLGjUOnuf9uGv9/WwzxjHVPt0lKawYNLTTSZ2blURC4TxIFSBLauUVEAsfQRHghf + vcNcMQr1kUlIsRS1mTc7qiOsJTG9I2HAxEakp0+O6uxRS27QHxRHthFnXV5ebfpvTuuFIUOBUl+i + lBr7p6xsTJ7waFUrMFIFoFFZv1iJwzW90ldW2KEzuR1duv3WWUrlHrsmXKA3wT9bHNF4bhLHseXg + lyw5rVF5+/2DicQWHYa2e7oRsw0NtMbZLscW5NhMh1BShFMP85k2LFY9D9K47UxXX0oPQ2D4bMSR + YuiYTERKgvCFgjZSIW9FKttkpJdL3MixJHSrNo8pdVcR/CZMc30d/JKp/BPT4DNmpL2K3iTYnYL4 + LckgbBcKGa4y3wkyQxfZNwcD0fIk75s/snSuYrZOgbeHznfVprrf9T9/Zo3nDYBGcMGg+p3lwB9F + +/cCtJLGdxIusy+ZVrqwuWvPRRG71mvh1DHbkBF9k60ms2ihSc1eJjmwC/HETa443k57RBYoLUqb + flPpxRVUIjJu6Foyz1TO2d8b/RMKivhJp4CjFMYnX5iPYy4prICTS9vDFfuGukmlF3AReoD93WYl + 4O+tT4X5bnJTAGe/uh1I1WmdnZwQ01+O/xqHMFKIFmJcvKN7wyHyydPkSdoVKf8+h6xZamm9WptR + oTcExFwUxR9JUqKjCwcomFIZkaqh7ZSP3FExj6tbPur4h1v52DwCHVK0cDotkn3di4qR6PYX0kMw + ggL5BgsqhkiG9w0BDAoBAqCCAugwggLkMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBCd + Z1J37v5rAgCtcJsxya59AgE9MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBCYWX5/999vcvvu + FZE5J2JWBIICgOtuuzHGjQYlFZ0O5cG8Xytr7DuLa/wJBtwRTFMpwNVsRAjp0L/vZkG+Fi6QpQDd + 4dXqItfgHPdOjmvNbA2UPbvuYQ4kMKfCP1ELxTbDVunTWfu4agPfjKvJ25eGR+Sn8ny+sEluE6n1 + MPu92QKuTGKvBTwoXIY3NJwA2V6Hg3EEGH10jHAn1xvvboHgOvZ7XYqE+ZSVlL+g+L6Yjkk3UyrF + NXaCnqWP3rn6IV48KIj3d/iR6Q7RFkNmzhF2prmJuhlGz56kpoIbdVUvRGmPccSq8iMALMtZolaN + JFD3zH7e0Af4xkOqEaw3Y91g/u3NxdaGBVnOecPqyVv7uMBw3k+v6xRn7gNpS9USR6cAgrvm+fo7 + KHVy/M8c0WrsyS1dHCYohe1OPONbKZfVdoABu9qFVoj/O2rawMtKSMyVlGLSPNrTFmz0K2ka40w6 + 7xnvoRGHcHtRVSRnJXqPfpfgZlZzdcddbe0hQd7nmx2XPshAFr11Oxv295Ew+6RJYtSouyq10vY+ + a7qWlAsN0NVufk1Ych8ltxe9b/EpnjfPh1vKh9g9DjrhIbSIjGvH3NxAT7I87BfbWb+NqiEJd9Lf + 89nSM0ynXCq5ALYesO/s+OIFJ1npLEr0cE+yyejX+Io/CvMoV1W5loYF5k8FiHdKxCCRabP/biLF + +oeaOCyPWlDNIpYywqRtZca4C/WDYxS/ukQmrerH6UR4GQ3+oOBQpYglworiu6dZ081vmxzRhE5E + 5vJRD1ymIo6GvocOA0i9MyC2NlTf3M0b/byn43n1LrEkrHZgVb0ZqCF3WkIjnsosfkNwmbtICKD4 + vykU+kaBy58/lrqw95+/4QEhjN8cU14wggL5BgsqhkiG9w0BDAoBAqCCAugwggLkMF4GCSqGSIb3 + DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBASEnWW6rKuQyZM2kxWjR1YAgE9MAwGCCqGSIb3DQILBQAw + HQYJYIZIAWUDBAEqBBAGLCV0XI3bVBD6CZSK/AfBBIICgJsaPg9gul3iekO8dPhzuiaC2h65zsxb + RPYjMF+gAGn4MzjCTqZcy6pscUOa/efe4KsvRFw0rpmHWW0CN9bXqnim0h5TtWkivwlzJBNjlZ1+ + Yrnj90sj+rpASQXJNdS1+61zBrRpRFwC/WJYsNj5NLh4la6hDipYET9dQY2pNDwUhULTfjmNTkZB + Hp2Ju2Pxh/8p1+usfCpcxpEQ+byWswibPr17ggfYtmel1fxDHKPlfgqwfU3bK2t43hl3QfVz4Y9u + ceU4VM0owGyyMbEXMjb8D6sd/at/XrASRFH3aieJQbA87ffj281/NYn1k1OVt6ZqvpOkyX0tu2nk + 4CrgY97gn+CMgZrEskvrXHqD8lA8y4NGv/YUGjRwoqgepZETnt7FxGZXAVdrvukxExAtFJSnmaV0 + VEzlkfYzzDFOqGJDkBLCLTrc5yJ6BBTwIlFzYuxSb2YE88hinhoKuMdJZFQ0KXVI0iddL5xoWEpl + aa7BI4B2v/r7n2uo8RtHRBhjhBQ5TmGsNog5yJt0Y2XStfEgD75po8jS4/SjTPaxuMlsBdiK9ZQ8 + kjEiIDqx1V+zGNjsgQC4wSbApCoo8OYiwbeP1HE7Mi9s/XXWwyJDA7uZxN8So0F2+yniyH6rYAnk + 50vJGEZX2QoTw99kz0dSvBhgxACzP4fq5olI3700f2wvHojlG2qkaaGHAeqpLKD65613hOCkgJfT + nVHPcONbbU4ECi60003krVSazYNPJghR+7PdPKl0wajVzdiYvGBa6mbgN1gkG0jqA26yeP60oUR+ + YWXjcTCpAnQHoksnuyvESjKdZZJRhFt3HgyFwtcXl2dJ/AU0Mn343guo8ZlAUCAwggL5BgsqhkiG + 9w0BDAoBAqCCAugwggLkMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBCMQWIRFEXSbPX/ + jRCzhjGwAgE9MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBCHQ5CNps6DXhgk/tC17MpGBIIC + gAERI1Hgiu8K+df+O7pKcw3oaWWdIVECK5mLSIDMEFg/bPvcwTYtQeC49VhOtFVlYGlAfDmGsISX + f0PRGGOPz3Cc2obMhA8UtPJkt/LV0Mzkyf4+apaW9DSfQFI9dEZzdVGym7oxjPoHatc7nCuAcFN+ + GMP9SMMSXx7swabccBmfDCRMBrsp2F3RuYsd2w5Cvq8BrrnczXZIFgUlztM2UxOJT35cGjIHnNEP + fpZYftLjbB+uLuFfMfd3zzqwdNtwGfCQ15YAaXF88/klN5gWr+8btcOlRNfsEFv8gvZ9mjm8AmmK + biGVPPaFvDQG5WlRu1XdK2LnRG1hfzIZ7fO2w/lVJIUj6a+pzzzT+lCSZILztOcfAJOar6qYYN5F + 10fNISl8/AZ8YdiwEOEwS+Z/AKoYe0XdFAhs6YMC+3aqtFTM/523bjCIqrjM9S9khS8yL0oZXCBK + du+YN2tZbslVpWc80R4n+JZXAMWjp+0KKW5tg0VdURBs6ftqpPCk7ZohMD8TGmh8PRG3Z2hVohL3 + aXTLfE0HrPzjYjwJHYuD/kR4UARp7B4D2en2RLmsUFu/dG+/G8kZ0yDRgCYqx4tfMjfIShDCzKk7 + u9ccX/HOyWNc4VYlILTkYepIPU1qezHTBbZvXlcZIUwqKoT8Joz2uJ3Dsx1f/9tXSTjGOIFHYq8A + QFtp/edOC3gwX4W/Ep4F2DKlmh80rrAy3a59wxsZzPINXWRCk5u8i1DaGDVW0jaJt9uRrv3GJPFD + ZzO+EI7lK8C/aH9Vj7JE6isz3JjW5ml39vk4BQyUi9h3Y86ZjUMqKtY+bPm6gge4ET0qmAU2VBIw + nj9l3Cejjdp7E2NjZOswggL5BgsqhkiG9w0BDAoBAqCCAugwggLkMF4GCSqGSIb3DQEFDTBRMDAG + CSqGSIb3DQEFDDAjBBDwOs7VEjNL2wOWOEByveYiAgE9MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUD + BAEqBBANcxniDlBevXtVGETyVpalBIICgAzqfhOnh6utR+5JQa+onB5DQWQCwC9xgE728LO4zrIg + NGGBtA1Yv+tvMIzAmwppYyyUeJebANC8xICh1R/Jw1zVxildGsDe+CcIqCSV9XzwLiORQU9uq8El + 8hOSKp+jxQU41NhK70CqUCT2icOjDikUGzDGxXsY8VnKZyddWb10Mrnyafqp5PORkC3KL1cAsfnN + 2hJEVbVFwAezurxYShMsPnhrCUzq+RBMxds7KWn6+kcgkKN4tjbqHOCGv8ufljrl3I44LfVb8tsB + ymKdYnqYV0q2Bn72DYWAHYzn791J5sCWcPBPd1VMmYi7U+ERkmmY8fyfCF7tNSS3jjj6r++FJ5DS + nsfVjmiuZrFNstZkINL814fgt59qGy0LpdWCNkiR00Ntv6CQG7S5qaHxTOEmbs4E3H53x+QO/FCa + 7UtI01zSV8FmBtZDgOmXTkAX8mgNqfCEqMs9ezyZ8P/5K9KnspmVVZs4hpdmimp2Cnuf7ASD3TN7 + iNGgk/RNu6F1tniyhUqPIiMLe+DZDnNewmPaf55JaD5KTHUt4V13M790HvBtjFA39KfuZF0YsKsl + CdRW4h4/r9FO7gOflakBrqlOfhcaz/SdV9+nO9nIe/IhMe73r6dcOsd2tKX1dqpQaD6FDQE5/eR5 + gcFsUxoCAy0XWTg1H+Y+nspAyMjIAQ5ai9ymLsclIoeA2upO3nlY3xSMF1fngOngTJcSCPTklVkE + SKvIoebknFgBTpBgSwYf5752UmrnyylqXdajPjG5tfOuRSe2evoEJAsLy0WZzuanJ6AJizXP4Aqc + wHXpI+ZTW4SXCekbiGOK/69D2DO0VamzljGRsu+v6oiaEgpsIjYwggL5BgsqhkiG9w0BDAoBAqCC + AugwggLkMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBB2L1pvvp0GM+oyvQaukcrRAgE9 + MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBC1LDhdsGRaHR0kgO37xDl8BIICgPuaW4/Gr5d3 + ZHHkh9VKu8ETi5zscFLAtTcFpb4MJ2c3UnKQG+RjFMezp0svRSW84//X0pvzlfoKxng8VoNBCUwR + N/aJsEqC5UnBqiHWKL2wkiVl4gziRUZu+eosgm/9Gk1xd1Qxs7nwyTdMYfgnvfXof+MCs8IjSfB9 + //RJLPqVRu9mK1ZHXY7sb1iiXxoVjPhOvDF2L2uUt47ADSQSNp1iYhAA7g++mXiSDBTRa3Vy83cd + Tvq0bVx4NHgKUXss+b9kA1cM23DqQaqpouqDlXxTW2mC9490rCUQLyRTCj4xfrdgPypntFfBHuQJ + Uj891OEHiHzTnptw2anXjk8DfSkdAy3q38MxHCSxHKy/m8FgUUBkGGoL7wb7MD+vV6Mi1lyziNCD + mCPKIwaJe3+JEhdCO7GVZfVz/lsfhSZBHHkomfXe0LFwGFbvRxSyb9xiAF8NpIkFyazTc0odsaZ7 + JsfO4QWkVudzbTM1ByFCNetvZJPtfy2jZhSwXrKnF/tTEBFh5VA6UOkGEpvKmUXW+Kkisg8rZ/95 + G186Nc7BC7Y7OIlNG7ZBeVwjOUi9yD3YawQ/w4OC0TxKM+CtcJuepV2fCu6oMRueT7wxR4k/sl/k + XZr3AREf6s/JAtUJ4DtGcHnlOKuEnSxrwrAgChjxIjkf6IjSpgp9cUHg5NpTRAk9isnkYYlHK2bf + xPoiJ9Z7hosT56xRuFf9RRvNLjw0IiVKY/SnZILvMK5Vj/IAONgeDTXMGPaxn6/JCDghD0Hq4i/C + lciZ54XoyrbJLUd78TSsf8OA1RyNpoAFl00NidyjaNjvJfHtlWE+6nNXt3pQ7CpxPA4bKH3rnJ+V + qm+41t8wggL5BgsqhkiG9w0BDAoBAqCCAugwggLkMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEF + DDAjBBD4bw4y5yha/aU2REAUVi1HAgE9MAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBBSBk3R + ONt1SqljlDVYuUrlBIICgM1rgQ9V7mZSMAk8fCCpVgWmsRIsAIBkqrFfInr4sDQgg6XZSXBySVXD + Jx6cKY4UR6z4731n9Up+7FLA+wC74W+fyPjWTuJPZcR0YGtbj1N3RKf9mOuNxqir/mamf8EMW0ix + zX53l3DWn26U8F5nwE2DsJh894I9/BSCRNwMpJF4d4G4nf52oAe04/iD21/1a4TShmnlt4+wwccX + 9em8Z71ZUE2FAQyTOQVBburLKFLCxGHZnFlZ7ZL9APuXPuvcOXwq3aa/K7Eq+fqliVqZORnWrfo2 + ORKzU3rNkobgFiyJCNDV+YRswoIdqjI+P/RlQJvJUBko7CJEWgRzTwi2PkYbxrmYxdBK4EV6O2Ws + DBmmY8zDfOqDMyzUn1Z56kZZqyg2O0fRFWBB+ouleLaX2QqbXfBEkjZYDcLfT7X7iaqWSMQK+S4u + 1BhkjoJuoHF3zP7BYLomcNBINVz7ZpP5cPLYwhKnC167cywc6OBOQ5PwGbSWcbM/HIvSxZvX/Djc + iinyo9BaxJXXfjX2yW2uDovMATlcNiQQO/jjCuTcfQXtLarQNDBjztsuhTkErEiUpKU+GD1cuqzV + Nlf47d/Nz++9xix9A9NPbCw4LZ2ZWPbelC2cfnok+o4kiwFg/iLul/rwIa291OwCW5WsAH8XbGtg + FjYsfGZ7WwnAw5T/Qkmxh0kWPMSsWWbpHJsxT+RzRbRbDWx/0ky3AjHbr75KQqCIOw06vHxBrf/U + wPLUVabMq7+InwPmKu7aHn+lQVulbLF0WbctOhgftsKnh8etipi1Fvbxn1hhqcv5ZRk8wHf0ZKEe + zK6jiI9f/ZOwmYk/nWxdcdmywxIP3+mgJAB+YaowgZYwTzALBglghkgBZQMEAgMEQAnxDpUZgkDr + nJ5wJc7Dkwj4LYOne2DnHpz/51y7BYiWx/Ib2Nq07pRd6KcOv5bCLtRg1LtASYZwGVwnrK3Agx8E + QEjnyQlMNis7fiLOs+ZthpmtwptebOMdcoB5JdmK4Q1QsnkVetK04cL1hh87unT4vAbwn02BSg47 + mSdzI1U6Td0CASo="); + + internal const string Pkcs12NoPassword2048RoundsHex = + "308209CF0201033082098506092A864886F70D010701A0820976048209723082" + + "096E308203E206092A864886F70D010706A08203D3308203CF020100308203C8" + + "06092A864886F70D010701305706092A864886F70D01050D304A302906092A86" + + "4886F70D01050C301C040887A8C4D7DB154CC402020800300C06082A864886F7" + + "0D02090500301D060960864801650304012A041028529AA9F7079F5031C52A23" + + "8A23CD4780820360ED47A5097F8A6C7B6EDD1989CD19C67B8A59DBF6CD22F7B8" + + "36A4B8D9BAAD54666FA9F022CDF366BC1B4A47604C4A0B67C09F2DBB8F75D185" + + "B62DF310817E24FE71A47246831C58670A27A5693CAFC52EB730B7BC0CF00145" + + "A9E4D6784D3A49C524546415EA6448D991C5C83FACAA4C1FECF198DA5B8CA9B1" + + "09346B723238359CC18D1CC28B185AA3860B082086F9FD909F3BA3D94C9238BB" + + "CF8AF18C0A56E6A88E7E0F4F15675770C812F805604743B1E8E683FFEB3FA4C9" + + "9D2C6B00A858050DCFE12C0DB3471B678657C7E28C074277165D714FC4A6E193" + + "C118C676FD2B2F97B36D8EDAFC3332609F192EF98D3ACAF1EDBCB03A2DBB9B0C" + + "8AEF748A5BF66F1EDD9C7C8A81638D644F9ADC99DDD6BC7FA7FDEDFF044D47C1" + + "6F62280D80526D05F17D5DBB44209A3F27CF88B881227D5685DB6BAA22914D0C" + + "E0B01D9997F9A429B4294940BA75FBB08C7C7EEFCD77B7BAD0DBF3E418F4B551" + + "ACAEC537DDA914DD0BE933181A86B433640C1E10609D96D093544D119727D1F8" + + "49060303189EA33B8FF8950493909B0963EA4BC8999BE78D2D2F1315F96B24C1" + + "DE6A925C0DE3C862788B2AFC56BF343E63E1274D0B8652C6C49033E1B21AA283" + + "0AB2A1406291D215B799D8CB5CB6CA0D3B0458C51EBFB01207E96DA04FDE7C24" + + "F32E48A0B4E48EDE150B13D8B2B1D3B736BC4BA54F800DA9F980F7CB9F23B7DF" + + "8C343F980ADB0752E2978D4C1069337A631E15D945D8EB858FA6D1548C230269" + + "21D0413F13FD4C94A1BB8897040AC3CBF13DF42FFCA7D0CF76FF08C68893E45A" + + "061700E4BC3B005FDF4E8A04323B98D07ED037E4A341E49E43F2D2BABB0CE6B9" + + "4D260BF720A7B864DFB12B22D28F4992C91A16E30346252191EB60A06C23BB6E" + + "1FEAABFFCCD57C0A2516E8015E9B329C97D99704E653EBE04BBF26199B11A2B7" + + "E30FCBCD2C57A1389B0747E1B9896C6CED2C86D721DEE424120E0347A05B57F9" + + "19FA1FA334512C1EA43205E5B1A56BD1F490C5EC3CFEA17CF1E8EC4686DD6150" + + "0C420D03E6E807491B24ECB6E64F210BC8029399C153E62705E80FF358E1A705" + + "DE3EC20DD3AB6651EB51E7F7F2729ECB9BEF94B9E1A685555DC075453072AA06" + + "5C8C821033DB91D1DE64CB085E09721580FB01AEE2C105E62177D88E25B4EA54" + + "4605636CA3261107DF7CB8FB2661CBA0B855726F8F3F087B95EB257B523B007B" + + "45B9C71E030FBDCF3082058406092A864886F70D010701A08205750482057130" + + "82056D30820569060B2A864886F70D010C0A0102A08205313082052D30570609" + + "2A864886F70D01050D304A302906092A864886F70D01050C301C04083D689F19" + + "C613307C02020800300C06082A864886F70D02090500301D0609608648016503" + + "04012A04107F45F9CB7E9F7A54479C6B260310BF0E048204D0C37C420A86E386" + + "22F3EA79EFDA069F9A0542207ACC6EC2B7D497D06C2F0E20FC362F637C032D86" + + "72B9A0A393F0DE872B19668D37C35CBA4DA6407D80A1A61998BEDBB01713D41D" + + "741C5D4A03B877B2CB6F66295B3C7E3955AEE9F8BA250086355CA8D340850825" + + "28F3544F9DFFD19D764DA15E6D178E7D8D843E0E8FB0FBF5CD9D6203644FD6D7" + + "88754AF0372BEC11938406A27D76EFEC6974F92982F2F2D212256DF3122CE631" + + "7C079B14D9B14D8E8AE31EBFB76754DB6D5497DC3F7DEDB73DC2E65F722BB3DE" + + "D1D217628DDC42EFD646501B8B8E085996D87F11E3B29B85FBAD0AADF71A391D" + + "92F11DA38286F7C57D12F3923D334D3EE186098B88A77869514DE08FF1D09675" + + "4D6FB2978CDFCE051F7A0AF5E27BC8B0DDFD9230FB292EDF4F8893BA7C1CF8C1" + + "B91B527E13B93D0B32E7A130D829D928281655FF93A60220194777EA4903B577" + + "EE7D12FD585D69ECBE52192BC9A0731444122C13ACD45926DFE13E7F151BBC71" + + "2787DE41A1319B974DF20F0E28A2B8C247553C6A98B52F545723ED67F36DB626" + + "7BEDBE8198AEADF2AE0B177F3F2B61A53AD5EBD99F10BBF8F578AEBC780EF766" + + "F512118263A7775BBAB8D1E7D2B8E55892A59BA4E4DA74C63A90319589096AED" + + "516AC29F6DD666BE867C6E411F0A63D8EBF0A4F8F591D8E16F106DE0A63F001D" + + "373B0A72B3BFBFE27B1463F8A01CF5A4BC81988DCEE84A76ACFF3F27BB205708" + + "848F0555686E0A650280EFC7517BB433742961DE1E0B08D43EC64BBB6B2847A0" + + "01FAA219D470E553A8BA05479DDB4B3C0FE50BE45C7126084AD249B521733477" + + "473B687BBB75D47C3AEF41C72BF7612FB4ED8D9EF51CBEAD26279AE07C3A8151" + + "7E65FC8A77712D8EEE8994F1632157C3F1403DB0FD2A95C0A89D323BD9205AF0" + + "E228DABEA7EEA182B8D257BEF9D704CA0E9FAB1027F49BCB8D75C2969447EC4D" + + "59EE74B762092664AB68DB5390C8E76AD91399DA5473222DF32C96D519FDB21E" + + "3D2EB1C6D98B3A3525D1E92504E29A0DFCE59B0B982D0A8EB845A8BA4DF22CEF" + + "CEEED25773E51C5C1FC0F96A697E24995342FF82D7573479D342B7E41AD2FBEC" + + "BB6F728F8D3D964C09F9FD39239B58AA91269DEA87755C6CAF9F6F876A1EBCBF" + + "9983DF2D6BBFF81D180435B65DE95C7BD41062F123B7CCF31897CC7028F6DDED" + + "EA747F069AECA55637B9848674AB1CC4A61944C274B500E37924F7E394DCCECB" + + "93052BCA45AD66851E9CDD4194470BC2F91667C6E1F696B89A219C45CDAF1752" + + "CC8D95875EF343E90765CA366CDFC55F6D72D2590FBC47BFFA9F45BAD5C4D50B" + + "A89F117F20A934D84C972A15AC4DE8F7D105B1E0AE214BFCA16BC44C4D4A096E" + + "699057ECB1E3D9D6933CC8AB9D9E93A5194BB39FE289E6FC121A564FC049C99D" + + "6B6BFE5B11E8292CEF1E4E80453F805D5BA49BB26EBD84847F1CF238335005FE" + + "2552A972DF84618E59201798DC1FAB60188DCBF18C6B30CEC921D40B76B9BBD7" + + "458819427D0444A2421D69CE1E23D335EB6C327F8145DD3FF25EE740F7896A24" + + "AEAB3E65FA9209C18BCE8A1D28EEF053611170E3B1CB43F583D6084AD40C0035" + + "E053CC6133E67B18F12D508BA43B79E1B2D1EA0CC2B91002BFA2D286DB6CDEB3" + + "796449B33D6DA4E47CD326B8C123228E68D822DF1B8A50520EAB8A2319227415" + + "4F4EA2C604A2274AB881D6B4EC36E0C3F5104A0BBE51E061E4F09A425F797BA7" + + "545D45CB4567A39D923125302306092A864886F70D0109153116041444BBC698" + + "3FD4DB3AD40E15D39784227F2A2E60A330413031300D06096086480165030402" + + "010500042053B736831F5398BCA4DD020714A2E9B46FA9BE273F81DB5A13D27F" + + "482282DE4B04089ECC39D621BAA9ED02020800"; + + internal const string Pkcs12NoPassword600KPlusOneRoundsHex = + "308209D20201033082098706092A864886F70D010701A0820978048209743082" + + "0970308203E306092A864886F70D010706A08203D4308203D0020100308203C9" + + "06092A864886F70D010701305806092A864886F70D01050D304B302A06092A86" + + "4886F70D01050C301D04082BF1679DE99B425702030927C1300C06082A864886" + + "F70D02090500301D060960864801650304012A0410E60AE5FBE308F1D6E6820E" + + "18F85D357380820360E334B918A3971F37CFCEAAEFC215BD0773462CEF830E5F" + + "73D28190E78FA023A2EB377952BEE5927A0FBAF841C96059E4B0111880DCD6CE" + + "619B4B07DCE651642F29AE978AFD15EABE55D5E2AC94439294F15F4E4A304D88" + + "54B04555E30D251D7BD6B53F0584C5293E78F9427861EBF90BA0E41C00A4210D" + + "5208DD27C45E5C964988F00206399AA256D19103E391765F0E4E89319AA8FDAA" + + "F79856ECF1E6F5DDC9629E778446A0DB25FCF541D4815E66967124BB751ADF2F" + + "10DD658BCD76CD7854561E161FDF4300F84C5E04B91B3FE52436BBE2D7DFA2D1" + + "5D9C6E853D4F221F833FF85A985DA2010050FDC17B6013DF16B71B1FE181401B" + + "447A7CD78ADB894F310119600EBD79872CEE05254F141FF4AE317B4B19089943" + + "1FF692246DDC9D042C517FBD389EE2AC9A8DDD7214BBC010FD7A90A325DE4224" + + "D833A55B8118C5BBB003304956C98A4CC1A91EEF29BBE6DCC4F5353EE53065B4" + + "2B0011E291B81C9A8D43CF436F2A47DEB40C21547CA2E416A61740E9DC5107A0" + + "1913612DB720770788894EC2531BE2676F3CB9AE5C73D5AF35261F41D474A565" + + "0DCCE0A9A63EA6A4BE80E0726EF4C1A5805DC8888330D2973402BD0BB4017BA9" + + "D83355DB97A9EDD04D727A1A3FF796267E56494E2A89B0705EEF88805BB23D98" + + "05207982C2B43CD3FB83E8C65EAAB0DA8E5FB85D9821CACA20BD21311BF0E3EC" + + "4F309375D7AC89E9B32B1B2EFB51D45FD5F88AA066A05A775311857A192B7DFB" + + "200FF7F276C284655E30164543A53B3463BF6F8B037452544BA86764B4ACE00D" + + "F2C26B18D9F457153585432201F578F74BFE9A4F8010C3B4973C865CE175485A" + + "3EEE47538C73EDF5E3DB34D814B6525351D03648948561760CCE3F4DFE423ACA" + + "78E1F82C78476528BD35C8D02C17AD41E9796F048BFC4CCC15FE11139C1A104E" + + "469368C654FEFE69139014ED6B30E6CAB30DC7FCF1490BC91C50F1716CF348FA" + + "7EED577F7AE25219163BC1BF378271F9E676CB99227BBAE64FF8D9BBA2FBA69C" + + "6A045CD70675809F9C3EC1DD30A4542C36E4B5B52F982E8369300C7D036144E8" + + "004804F186F2F54385BBD5ADE939F2CEABA8D785DF62D54348CA76D94669C350" + + "07BE6C9A9A9CB263A9A098157B39C6B8E1368D9D7F9D9524D5CD3B9FA1EFEB9D" + + "44AFA24F2536C3A70E19DF07B7B0A68385D8572753A251648534B953717CAEBE" + + "19EABF8E36F039A2503082058506092A864886F70D010701A082057604820572" + + "3082056E3082056A060B2A864886F70D010C0A0102A08205323082052E305806" + + "092A864886F70D01050D304B302A06092A864886F70D01050C301D04088064D4" + + "32AC75560902030927C1300C06082A864886F70D02090500301D060960864801" + + "650304012A041028618CDEA80BF226578A2DA0DEFB48F9048204D070F86CDE3E" + + "25FB88321EB1D0B9E8BA8736C1954E7EC2AD3BB3B4DBFAF6ECE268FF693008CA" + + "DF785473709F6ECE9AA8F93019C5EEF6E557DD5587C3B3A85B77A3FB1871F58B" + + "0316B4A4210BC2856E5B4AF46B3BFD114AD8FEC7195CAA4D8FF578EC0A945A63" + + "1000981A56525F8AFC6F140F5DEE2193C7DE62579890ACAAF056A32CC6E7CCFE" + + "2839DAF60FD881C0D34BC450DD7F0F9378A695F27F547A73044444163670294E" + + "578FEAF5627865F297147ECBD16E45C128697063D16FF4A773ECFE2978124C06" + + "A7728C6495CC35C957A635F213D237C8D64B425ECEE868CD1B901CCBC3AADC1D" + + "CDFBB433195EDA5CBC6C11D048D7DB7C5A0443828483DADA0C63FC4FB3234A3A" + + "6F749428F371121389BE52DD5F9532B8CB86E096ABAEF67865ED7A6D9AA0AFB3" + + "98361237819188AE5592D65B450A9F99191D1E4007FA4C7067E55B495A224435" + + "E6FBB891D5CC84D929166B807C8114E26D6125C7B19B0ECAF55676F61127A75B" + + "56740D00BA582A4412301E3220EE58FC1A55B578EFB90F398B9940CC23581A29" + + "804244A0C37D4661113DF6B43FD77CE00B0E9C4AACB28292FB20DCB12FA461B1" + + "07E853C057867C5ADC6C8D21A812B05A20ADD09F6E6ABEFDC45DD1CF7C64D7AA" + + "0408CA24D1B7014F2C960E8ADD356FD13B75448287677B23F48F7B527380709D" + + "4ABB09A5EB3100068F55CC4A194166BE75F32C52F3031F69EECD36A5400C0769" + + "E5C5DFAB81F1480C916872169EC34B49646C9AAC76909EB8B49CFB9ADF07ACB7" + + "5B051AFF623955F1CB0D5E11154576497306D92CF1A19C02D0B10D219C956DBB" + + "47DA7F24C554D0AA6D71C5DB4E966606B863445F39DD955AA062DF78BCD0C509" + + "000BA379A4BA1FEAB5A9D3EB5FF40B3C85C9450B1E06F79A2670DE7EA799B741" + + "28B67A2B1062391F78B00958497948F8F1133096EEE10E761080CC55928D1F13" + + "AF835DC7098181CA2D27DEEC292C40CB969AF15BC8F82E31A224BB24F04BDDD1" + + "49C57688FC1867E6CA995A4D8B2D72FEA76ADB9E36775EC6994EC346150B26F7" + + "40491EA804C176D9C8852308AF4849A88F2D1C93E948C848D22B0122CFB5C7C7" + + "E848DE044480DCBB6E282285BD00CC8445E6992190B13764337CD226613F2CF5" + + "EB5750A7FBE079B68FD3950E8D3CAC9E579BAC61AA7D52F9F4194C4DA59F07BE" + + "40EAB8F3104D0C70E92AA0273DD3C0CE1901BC9780B5762C833974D193539627" + + "61AD01E3BF23C6C7941372CD042BB05A897E18519C497236DF21ADBFD5507414" + + "E50725AAE16A5078464719FA61C426BA4DF9B42EC2D84824F2505E5745446BF4" + + "CDD8444FEC1E505665C46339054D8CFD6A54CA9C1275C96BBFAF456BEB77491F" + + "71D2D002B2F7805D44DFDAE37C0C4FAD680A7B0DB89AD006208FE01284050AE3" + + "3A21CF566FD2627B1A86A1C2402658083B08998D37234B00CAD3C1F91A54CDA8" + + "57A777BCE878E9902297E4A8128AA2D7D58AD5F491717F9B3C10775F55783641" + + "D052BBF2B69B15D5CB78488731C091E5B7D3EF768D8CA1F2089F30ACBE014566" + + "F566A69CDC09268F2D25B9E9E60FF08742EDE0E85735FB4D4FAD8464B163542F" + + "CE3BBEA4F6DC2869F48B8212013226BDC8B520F74349E85244C7DE0D84F9C4AC" + + "DF8B7C5929267A2CF2AAB77FA7C46BC6A983FC70991002EDCBCDC647ECF289E1" + + "BA930216325D5919290260BA192E8F3E1EF136D4BA18DABF7F2A6F87701EEF98" + + "B66CEF645CA90BF8B75AEC3125302306092A864886F70D010915311604143809" + + "23C6F251CF50C47C7670DEE626FD1708A70E30423031300D0609608648016503" + + "04020105000420AD0EB570ACFB8357A8E99B17672353CFBA69C76FFE5B6BC113" + + "05577F12AE24040408D04E60444B79672302030927C1"; + + internal static readonly byte[] Pkcs12NoPassword100MRounds = Convert.FromBase64String( + "MIIDygIBAzCCA4QGCSqGSIb3DQEHAaCCA3UEggNxMIIDbTCCA2kGCSqGSIb3DQEHBqCCA1owggNW" + + "AgEAMIIDTwYJKoZIhvcNAQcBMF4GCSqGSIb3DQEFDTBRMDAGCSqGSIb3DQEFDDAjBBCNparJkj/3" + + "Uk8N7n0KCMeQAgEBMAwGCCqGSIb3DQILBQAwHQYJYIZIAWUDBAEqBBAcqpBrSDFcXYAWVWKcsEi9" + + "gIIC4P/ANdPYWI1vBH1U5sZGMIwLjY96pYaBelyZd0ZfKA8QfGHVNP9+E9hplBKGvRfIMiqmFutj" + + "RO4v7Ls8HZEk0hwBt9+6zXPWDJLxBDfSMHUd08+ZAH1yzEqq8aBMyIRVHOQkJFuFuCQJ9Ke5HzVi" + + "39S1rgHpnKYFvy+xZAhgI9OO1YxuFt4P9nhlEV/JCoyEQ/2iY99kKc3z7ArrV7BBFhfYGKhWQCBu" + + "kAmNBKweRldNWgDuW21WJEl5sByOmyDwpiK55Zxy1K1aIY8DYJTtIzzcX4CILaj6tClMH1G9w4jW" + + "BkQI2CG4vCsMl/28BbIP9EyH2C+gBAxvc1N32y3NSvO0/GPVenmQFF9KBMc4FVy4Z21syMKzUkBi" + + "PtIbDkcQbGAfyPgFk4SXCgn8OpIIvOOGI50/r+Hj14qex9VIrlwAAWCH8Y+YjwqFAQJYHQpb47zp" + + "B1fTwJFOrsXrBgLUzJLZKLR43yW2E9u6b8RsTuFHjh985naCHLuWPYOXS1zduBpHKpwoPUyCwD2r" + + "DAokCvA7RCsSXroUkpJarN4CAqsEB8COnzV1Dl2xcAYMerJxrTCKX6WIQUYo0/qeCoqTT38lDAlE" + + "7Ydjyx12iVM6eWejAdjORvlVtCQQtCxz8fZpdFGbMP8rf35A8hu++e4u0CLHnhTx38zPIm6H6YfN" + + "qj5h1Kz0xLzqnRfa7EGfDEERSHOy/DqNY4nUNG2DTjGOHy1QJelToG7Vo2L7CCZV+leX0nwLNExf" + + "hKEp+uQCiYSJe9iDm9fS9VymED79OJbr2bxdq3MggEGksLZv/H0ZT8Wsue0vq9jQ6J6YIEM+DKYr" + + "Zt2l4WgTBEKbpqmRvOqYRh9O8Sp+3IRNPzMC2ehzlYXqoPbtG4vxpoRsAMCM/W2x61jbsBSaNSFA" + + "eaUwcnKswRg30UonHUAIOJkqtadI57WE/Rat5eHVyya9f7ZN8bTFZjx0BQs6Bo8PK9yfqoidSN8w" + + "PTAfMAcGBSsOAwIaBBTt8zpgzygINykjoAwr2GKEywYFwgQUA+L1vfCVASwiE++gTfRgIScMGycC" + + "BAX14QA="); + + internal const string Pkcs12OpenSslOneCertDefaultEmptyPassword = + "308209CF0201033082098506092A864886F70D010701A0820976048209723082" + + "096E308203E206092A864886F70D010706A08203D3308203CF020100308203C8" + + "06092A864886F70D010701305706092A864886F70D01050D304A302906092A86" + + "4886F70D01050C301C04088FC6C10979E6D39802020800300C06082A864886F7" + + "0D02090500301D060960864801650304012A04109EF63F4518B8635FE54FA2D5" + + "2EC0C19880820360B9DEB42B1F8B8F4E58C9CB35F871A99821775275D604A14B" + + "498689CCFA1D8855C1BCB7C07528145C3D77903BCC27E9133041782018D6C1DE" + + "F094328772836DB17E5271F0A0B7D8A9BAAFA1086E95483DA5CE8519B4B911ED" + + "88FF0FC47AEB5924180D8B35083C5B3B44D2C8B7DBB2ECF5FAC710862B090D5F" + + "801932A0E56286DF0CAA10D7CB8243B88D7C2F619D06B233DF6D16060D392F28" + + "2C564ED685ED8227619694ED34050B76C8E28ED38B69C0AF9672060545C81B99" + + "EB6463BA8A786422322180C31D64FCEA249DB78C51CA5B84DBD8522A8AF531EC" + + "930A0A03BFA5CC7F84EE9F98819784D8E22237D524369F02D620B5AAD9C336C4" + + "737285305DC53A8C383453E0D278450CAE3DB2807DE4B0D5C6BAE4BE40370ACC" + + "5CB8D03644E553B0E98FDAAAAC00FDFDD102CF8ED916E22E686F30B575660B4B" + + "3C5BE7A1D3CC1D5217A8614F3BC80727671B13E5776988F7784A7E886C23C733" + + "A0C6A633D7FE8D7EC9ED9B2706B40373940BA8F9BD1BB7F8CD700384D06EC809" + + "21EE29DC45CD7D6EBFA1BBDECFAAA26AFDACB9E8C86450EF404BD3B60716E2E5" + + "1E943E1E1E595113C0EE3687493F252110ADCD4A44562BB3E2A6C682500C6591" + + "F72542BF6953BDB94CA977925B636DCEA6A6BA634CE8E4A44387CD20566DD120" + + "E3096E99ABF83D88D12F6CC4117E422460414DD0F89982A080FBCA7669568865" + + "0E9A07087EAC27753AA5E0AB126093CC9391B7510541820C6DBFF07B790F6DD9" + + "699530BCF5286C9537A9024C0778BBB854EA5A9034B293A78F4FBD2F3C572538" + + "2C703E8CCDFC7C54CB28005E4C511F8C8EEE84E65415CD46680547A7B7BB72BE" + + "CE5432EB1C6EFEF308092C35667BEB7509594F75A6D06D35C5C12FBF1C331E59" + + "6A5BC1E4DA753E319254068B7EC7824BD8389E5379773D14BF664D1A75991CD3" + + "E4AD815CC9A131FA66765530E55362983D4AC316D055BE68E8052101EB36980F" + + "2E72F5A3442BC1302F1E9A721C7A8D7B56A6DB36477712FAB04F1C17F073F8B5" + + "279B441E35BBC7986E67C1D9C8AB6DB30AC045ADDEBACC29BE1AB6FC57EA41C0" + + "5F7CC21BD1AACC1D7B9F2B5155893CC11D512A6DFA5FCE72BEA259D381B57019" + + "6ABE1C186B1B445B1B0B03DA596C3A5AC0252D026CB3F5DE42C06E81AA7A7029" + + "F249EFDA7581862AA29FE1F4E8ECD9F1BFB673119ADB0D369A28A2E3962BC265" + + "3BB1453BBDDE09CF3082058406092A864886F70D010701A08205750482057130" + + "82056D30820569060B2A864886F70D010C0A0102A08205313082052D30570609" + + "2A864886F70D01050D304A302906092A864886F70D01050C301C0408CB7AC3CE" + + "BA6EA01002020800300C06082A864886F70D02090500301D0609608648016503" + + "04012A04100E253ECAD79E0856D73A2CE9A3D48101048204D0D617F9EFF71270" + + "B09B3287BD6014E3DE6C8AD23BA19156ADE125B0324CA30B758DB8EEA9689A25" + + "1586E6E50A0C3A5DD975A2BAA6B571FF1C9C78E361F0ADBF4E9B4F7BB57B2728" + + "621E3B113C5ED339ABB89AD31F803AE2C976C1F0B96ADD7D2FD54E27C490D3AE" + + "220202531960B57B029379188C3613D6B1AD6F03526E1BB23AEC273C8F6E017C" + + "01358356EEB8D1273B5B114129DBAD60E367D70C92B65D38D0EB56130864F708" + + "3A43B7E3118362D21CD032D21CE94E6266809A69087313767E0D9BE736333AB2" + + "9D737E313302C6BEC5124023A22C395EF4A0AD165D344B329A09E5E4593F4848" + + "323FAE51B283EF0DBDFB951BDE62A0C7FC2E6419A412E86680F6414E154DA560" + + "2B4B46B836AABB3DEA03B1FB12110DCC6BA1C0FFE902CA892E4827955E1488B7" + + "AACA0FA0EBE8B8ADDF425CD9AA65B407503D0089D74B809310C737923386B86D" + + "DA357654C4A60285C31BF9C2BA22862D7774EE2FD8AA92008F678CBA8260F04A" + + "561081FA8818CC384307AD0AB4C3BFF86D1BEECC136D0595CC6E816B51C0888D" + + "EB4251FDFA5C02FC6D9EE0C60114406FB7391A149756497A2D88207075E2A528" + + "E021B68820F68F89F4F6A5709A18D440E09B5BF239D4ED36E8C3358DC7890033" + + "D9A0761A0A062734B709144A5B1CE9296480E66E0800B62FAA881F70AB89823C" + + "D513BAC42346758EB3EC982B7F8B4808DCCEB64CF854A18FB0E2D0D3B29FDF63" + + "B60C21A614621183F643BA56BBD0713AA5444EABD1415FF9CC2ACA80B70256CA" + + "CB059949760257128AFCAD51E8B9F574DCEA9BBA42344BACA4D96F7EFAA5AF64" + + "EF01119D34E971D4837C3633C202FA47892C59B37A88310F9CD2C523F0A4F952" + + "BF925A80F2DF0A813283739416DA1885EB3DE5AF04FE6C828C1AEEACBBDA7B82" + + "A00F3505A56C88FBA0537B1B4F7B7F54C1551A5F5279DEB9DFCA2C2EEEBF1D75" + + "F60DE8777703B7AB67411E5DD4478E7430E34CF1D0E0FBA7AFB124D40FA3E04E" + + "5D737D9C1CFF0F8B1CE7E2D4F99C340BB4360FCC285610A44247021BF1CD338A" + + "DBD4C9CFE0C1685AED1A4EE01CD34A9BD446F0E69F16EB395A6AF8E4710A13A2" + + "75D2B102AE38DC0204A6331155E70A0B73440759FCB89CC5E0A2012082696A16" + + "7B97FD90FFE53349D9883FACECC2B7237B28468C6637ABDC47EB595B82662703" + + "C9A8BB3AD8B7DEFFA323EBA092C8BEC5CCE3C5BDD10AABAA872A7620B4888351" + + "EDAC82D0E7DB5585C5B8119E300F8CF8B24C62EB397B9069038AFD69FBF1305D" + + "83FF499E203873F45559868DCFD813A5FB5BF4EC695A7463C6B0A2A8487B09FE" + + "B58BDC0BBBAA377909DC88F03FC3E058D80E22E54840E8803BCB78440C44E6E0" + + "1A17519F78C2C89D965C9B984C96FCFE5DB22ABE51241F88A15BF0DF20936072" + + "EBCDFA465182F41A0025E877A308045D09FF988F122AE2639EC14601ACA00E59" + + "81C3E1B6C8123B8EBB2CF9936D9CF3C4A0A8A694E26E9FF6EED0B0544BEA6F08" + + "EEF5FFA27DC0FA3D169F51C42DCBC65C3BA935F6EEF2D78DD352206C0F5E0F92" + + "AB8A4284D67088C0587443242035C23786BD0A3C48452ECB44F4E07422DDC849" + + "099587763991C299C5BFE8BD14D6904516B31254C1176F191962B81FB5BF16AF" + + "B0E25980A0D069D9FABB11A053FA5D8CC71F7F825A2C96A87D7A6F21FC6D8DA5" + + "059F848F6AB5B85A04D1257218EE480444148F4B0A1BEA8CB4622A96EB9B4EE2" + + "A76F14B1CE25EDCFA23125302306092A864886F70D01091531160414B524C1AA" + + "CC976B19833DCC9739FEE5B240AD3A0030413031300D06096086480165030402" + + "010500042029A4ACD27A78AA6BF3B9114E19D1315E76BD450EDFDFE88F4E5E98" + + "2DDBFC734B0408D154718FB757EF5102020800"; + + internal const string Pkcs12OpenSslOneCertDefaultNoMac = + "308209180201033082091106092A864886F70D010701A0820902048208FE3082" + + "08FA3082036E06092A864886F70D010701A082035F0482035B30820357308203" + + "53060B2A864886F70D010C0A0103A082031B30820317060A2A864886F70D0109" + + "1601A082030704820303308202FF308201E7A00302010202146543F3FA4FA3B8" + + "75A1BFDDB3CC23ECBFEA736A00300D06092A864886F70D01010B0500300F310D" + + "300B06035504030C0474657374301E170D3233303432303137323530385A170D" + + "3234303431393137323530385A300F310D300B06035504030C04746573743082" + + "0122300D06092A864886F70D01010105000382010F003082010A0282010100D6" + + "C77692CB15D98788AF8C00AA0C626AE45015C8300364C0303F09A1D48DFF5599" + + "A3B8DEC49365E28274E2E33288ECE042322CF8B2697E760D0FB4E8894C209859" + + "9D7BCB39DE74596638D11C87F8245EB245AA0FFDDABC45F804158776B6A1980F" + + "13F4C87F2BDFADEFDA91C3628544BF5F328E5F1215B5F277F6C7B89413720B22" + + "9FA9DFD132A7CC187F88154D6C091841461D2E7C35F75C1A40BB99EDC3C3873D" + + "51C2F68F804F58C0A4FCBA8001F6B92825581B4A9391C6A770614F6BD82B39AF" + + "13094EE7E49DCAB7FA2C751533B358C874148BAB88B915FC99BB8C8F907A4317" + + "3FA14F3B26EF4FE5B014D107DF73E5A2FC0E9ED651CB376A78CB1177E5D83B02" + + "03010001A3533051301D0603551D0E0416041479B60678BEFC1E3784E8A780B2" + + "30A7E826DFD627301F0603551D2304183016801479B60678BEFC1E3784E8A780" + + "B230A7E826DFD627300F0603551D130101FF040530030101FF300D06092A8648" + + "86F70D01010B050003820101000ED62D8DCEF486F04C6047AB0C2CB25FDF1923" + + "7E46D1AD9C16139B8C0A0236EDB46582AE45EDF2E242947A81AEE2AF4BA9AA9B" + + "3297FDD76B1C7F235288802DA590213B4A5E7986B828E072665D2855860B86F8" + + "F625F2BF6111938C54563DBE8AAD21DA2A883F901CC2D7CD08DB113F3468384C" + + "388A6B07E4C301839D4F0E8BD38920FEEA4DCAC3ED817BE1D0F3BBAC45E772C5" + + "41B0819DA4F0EBAFB952C082A57714758394C07416EAB0B53ACBEFD2F2E2138E" + + "B91CE02F4F8E008C976CDBED10340B79B9F9FF8CC94C65EAC274C4A08E1347B0" + + "21268E581CDF1730AE9DF3B959508262DED10B040A1D8346F0F544A2BBBA7454" + + "C2B2A7218B21B64D82B8C04A0F3125302306092A864886F70D01091531160414" + + "D222A8E9C8CF876416F9A2132202326C1AE63C203082058406092A864886F70D" + + "010701A0820575048205713082056D30820569060B2A864886F70D010C0A0102" + + "A08205313082052D305706092A864886F70D01050D304A302906092A864886F7" + + "0D01050C301C0408E0AF915D08BBD72002020800300C06082A864886F70D0209" + + "0500301D060960864801650304012A04100CA536131D2DDA95F84830C4E47E84" + + "4A048204D0075FAF61AAE642CAE276A7AED857DEB08094880EA949F763F54DA3" + + "B1C0CED0D383B3B305F5D4C033B33BCFA08385F58BE862048F739B59C30AB3C2" + + "1B8C877D2056D27CD1A015AB8EAF86725CB5F2892C667CC02DE0AB215D4859F4" + + "A4DFF4C6B8187B4DB5DD2BE8217482148D0135E1B6B7784E7C8515FF4155D662" + + "5E742D45D3DDDA357BB7FAA90601773C96468F2E023242CD6B087CD0C504C124" + + "8D747BF0465F33EA2904682678CFE57B4FC9DD8162230F7C6980B399D793B796" + + "08668B7FEF17430E128AADFAF37F7610924845327A631F51B4AFDBA3D08C2408" + + "8C6059FE0495003E210F53E616CAAD669954A7E517DFF203746DA1A6693BD23F" + + "3DFF096DF050DB68AF7E4213F2A40D03C274C3E1F224B66A3481001C445E99DF" + + "F5EAE97A9E7C34D035A89DDAAF982794E2BAB630EB61F96399B891F460463052" + + "CD6176E6561DDC60C9FE476D125758AD3EAF9747818A4F963181928E79FC667D" + + "396EFFD95CFF25DEAC00E0B1A4092E0F0AF9132116A78C75B3306469F64B536B" + + "FD6130B756899A7FBC79EB11BB0F124A8BF08AD818923ED9D1F93A79C1C1DEC6" + + "58B8859794A3C02F9299901F4303CFFBECD354BB77FB5BF63146B8F85C4C0F81" + + "85A7A6C8A28C51C33340DBB2204AFC70D4D79AD2C35514E4BEB413D519A12288" + + "29E7195A730A1A65FF9585E32F91F232DA23BDEB2DFDBEA5377AB9E053198899" + + "B140F816979D53F738601782C7CC24E881CF337F5CF50C24EBE2ADAD74FCD523" + + "2E620B8F144252BEE0B0FCC08AB239526B1DBE7F6C3D1FC8184F60B8B30C64F9" + + "B42F5B674C475A4D088C81C8D9102118273C6DB632CF7E127E037D6B317DE6FA" + + "C7B2752F1173851E3C099F40F207B0EF57BF80C73C224B70D0D975C15A8A2193" + + "2E34EF1113C48EB8258968B37D2358216E6302192C6FB6A68B325D7B731CDABC" + + "4D1FE7A4EA25AF60F5B224FB8BC0A3DB8ABED63FC1B91FB43AA4ACCDB32B46F8" + + "1441CBE62B1C38A4FC1E76E2419579890A10906044E18CC1D06A1866EAE98B78" + + "2BC5503BE5E24638C79FD804809F69D8019B77F498A36CEAF1582DAE245CE949" + + "BE493751FDD232A02AEF72DAF9B527AA29BF8C0B0384DB29BECE1A1E3B81E681" + + "00C047A22E73ADD5ED5B19BD922279BF8E0D4834B69408B5A9844B8421D6420B" + + "3BA243BEFBC2AFA74DA94D34B58BD827D59025438EF4E982E0BFA133F5EDB181" + + "FB5E3723CAF8BF0AFDDF20DF75A433850DFBBDAAB3FA7B61962A66A0AEEC1476" + + "B12A016CCC2B12C16AA8547D46B33F3B6008A65C165125BAD61345D9777E40DF" + + "232190FB47934E3B935B963DDE4717F4F4D1E932D1D7020226C0A2472327E16A" + + "F8E16DCEF37C52E58A65FA44842E5A323DD768322DD0F22BA1CDF9E54A3C3ABB" + + "7010A9E4C3D856719CD025C1EC7AE2DBCB8DE8ED68AC542797978C47310BB3B4" + + "D34A4244B3D0D01338A2EF8A43DF1180C01BA03AB9A382C888912BBBE541F8A8" + + "7C0CDE2EC2405F67AC22049410E2AFD9A8E4B8A836055C399A5422DB375A7520" + + "99A947C933DEFFC26532F399D08978443C6D040FD29C5842B6E0A8235D44012C" + + "6783AA66ACA31FCCA155AD6429BEDCABA71398B287AFFCE96AC8ECC36CD222C6" + + "7140E144656A0D8FCBDDBF5E96390DBB7C7C093EEBD8DFF0BDB68568BFE77D7A" + + "A7A3B6C94CD9737B8FF3C4F9684062E175AE9EB8DAB5B8956EAFB3A5EC84C9C7" + + "376F5F4B588E60875F3654A15899FD3734455366083125302306092A864886F7" + + "0D01091531160414D222A8E9C8CF876416F9A2132202326C1AE63C20"; + + internal const string Pkcs12WindowsDotnetExportEmptyPassword = + "30820A06020103308209C206092A864886F70D010701A08209B3048209AF3082" + + "09AB3082060C06092A864886F70D010701A08205FD048205F9308205F5308205" + + "F1060B2A864886F70D010C0A0102A08204FE308204FA301C060A2A864886F70D" + + "010C0103300E0408865AFCE404C9F4C7020207D0048204D89F814ACB055451B7" + + "7FF858162304D57C3B3393283C3DE8F81B4A2264501B47665EDF7A830B064DA5" + + "DBCBB95A1DE88E07E50681AA732A800FC006617317B0D461450EB0A8CAF73F7A" + + "26B96510A47BE05034301B33954B6DC2E581D00369DACC98C189FE2ABCDEF057" + + "3E5A04D0199EC35F0D401CF314F714D6720220315E13ACE3B982258A94642407" + + "88BF9899E4B631B577293E8C8BA288D459DD6B158AB1C8C585D8ECAD23E3F49A" + + "99EE4B64027DB0A5E5241EC4F2B7D614A2F213F50CB97BCC8C64E1194CE6103E" + + "E21CEB1F83C8A8C4D3CB4F0E76CC8482F34AB8F3D42386E061C72C4A9D040076" + + "09C86331483F0E19A3C94BD2848E708C4B6D07DFF70F839BD7D39A269B4985C2" + + "025FC6230D08999B5121C71FD9E11E5CDB694C6C5C1EEC5D92E9296A8BA59902" + + "82666A494BDFA916EE9FDA34EA64A0877868DDB61A5F63E3EFC54DE52629A2E3" + + "FEB9D302331C4693711AA3B3C8DBEC5E44F4EF28E40C6B2C6F3C6861F270C87A" + + "210F5BAD2C05E43D2D93D5D349D7A60A5002E11F78E402294E77C946DA9F8F59" + + "F51E6BFFD1E322D95E3E49CEC25FE338F579B910B70268EAE76763A368125663" + + "E0B14F84C502A70EDF05D9C4A2257742E2F52C80E01A6A9FFC21E2E231DD94A0" + + "93D2819AF8261C7A2DB6659CC3FB237B8992FDA7242836A9F549555FDF55208D" + + "1E5E2B13B18D776A606941C9DE54B560101289141BD864160EB2C382DEC0AF28" + + "B9037FF80ECBD0189F1A2D22CC395637AF046D62E90220EE6630957422EFAD6F" + + "2F6FDF425B8B9F713368CCA5D3CE9C12DD6EF61B12074FAFAF87F3E59A42D8FF" + + "41BC8CAF09B5E79E3AFAD9832DED992F7A8441307379DA4225EBA0ED9E357664" + + "615FB53B349EB5AB1C2EF450B6338442D938A0D9C52CE38862015F11F1F805C5" + + "426E4AA33E6FF964A4E7F39F8088DB8A98821E737D1D974A70E3CEEC960B733F" + + "68A8C1A243F438DD6D4DD25924251242711343E6767359AF38655455D3058110" + + "73CC04DC656DFDDF7C3E30614D994C315E2CFAF63307C0327753817BDAA08C92" + + "5307B136DAC0BB5FA128AC7879501D00269E7C7B779DD5624F81C28040A2FE42" + + "0FED94C6086AB945D4A81F6F9547B73BF03A0F6E8E36FA629B7730A42D574EA1" + + "D6DD37AD7624AED6A5667500A3CC2CA45333A8E2872B390950EEBAFA7D98C3DC" + + "D16CD6F932C21D3C302DE8B161B85AC67A524855664A3473A541EAA9336E2FF6" + + "B4978BCCBE0C4D7D874EC424AA450B5C2802BD1DA7FF07493F947D2F0E202D3D" + + "6D43F57DA836EAED898B280BB374A23AD10E0F4399F549A76B166F80D0CF4ACA" + + "AEA53B7A7A13E85162FB48F54A7930D564E99F6345B030106D625FF92EC96E89" + + "921442A0F248C1681757D1C8638EEA75A1A5A2CA74F4DD8EE1EF114A56E040FD" + + "6DB11B4C6B542D8294C08B0C65B02DB59D883F52B3A5F0165E37EEA7999BBEF3" + + "669510A206A533F5A82DC52D4F6B54977D5F8AE493AE49BA10663862CF1B8675" + + "D42F8DC6BA3D748CFAF4DD75C870D782CC00F4D463EAF06E2BAFED47748225F5" + + "1756D089EDD71C090CD87225EE9D501848E4682460A23ABE5A4D0589ADA5105B" + + "14439ECAA937517FCDB35CA6BCEBD1190E71A793979F070B37A9AB2D003A00CD" + + "38D8EF194207FE53FD95D7C43F7C58718F0CE80588DB13B6828A1984D9DEBF0C" + + "1072FD2171AF46156A1685CD841830212B7C78CC1A40C9F92DB0017DCE853E1A" + + "83A9FDF792AD2935750D74298EC8051C3181DF301306092A864886F70D010915" + + "3106040401000000305B06092A864886F70D010914314E1E4C007B0037003000" + + "4200410033004500340036002D0033004200410036002D003400360033003000" + + "2D0039004200380043002D003200410039004200380034003300390041004200" + + "320032007D306B06092B0601040182371101315E1E5C004D006900630072006F" + + "0073006F0066007400200045006E00680061006E006300650064002000430072" + + "007900700074006F0067007200610070006800690063002000500072006F0076" + + "0069006400650072002000760031002E00303082039706092A864886F70D0107" + + "06A0820388308203840201003082037D06092A864886F70D010701301C060A2A" + + "864886F70D010C0103300E0408196DD4C6F976C7AE020207D08082035049FA3E" + + "9C159024F1821379145C29EFEE5AFEADC5F364CD86547A125BF22CDD99010BD6" + + "FD3A5CF0F028DC3E37E1DD509F83F2C13F59AFE2D3908B33EDC93488DBC0D091" + + "6A209039CC4A9B8E37F614FA6E877969796EE55B58699A65A98449F8F0ABA078" + + "50497075821CEA2BAE375092254407B1CAB99E8AC3AB1F582D13217E651E328A" + + "DBE6054A3FA4E0A6911B57A5F2651FC772D5A180FDA6846C089C6F0CFF7D3EFD" + + "22D04551B59F58BB605D9F6B99EF7F027082E200052A19AB9606DCD522386A98" + + "BF17FB599252052A69440DAC7D57187000D58E8902911A51422DE3BE79001A42" + + "0EBEE4D263A265D49D41432D6040D4D28734DD38288DD84ED32EBE281C361400" + + "7DA2D4751F423538EF6608F017C3E2B0A0E143ED066AA65A933D62F5872EC26B" + + "1C5CF29E264146DD6EC4A2A90DA88FCCC9E0E20F27373CAF09E9CBFB0D057094" + + "A9FB914BC194941A873D03139FFCA79405300FB46CBEA0070115271268C2196F" + + "C39DE444E483D6E36A973DC95775AAB3C81F766065A76EDDEA274C38F103B218" + + "5B57FBBB82F1316A6C023A51BF873DFE71E62259AA2FB6A5C4E4152D45D70284" + + "E08927B559F1706505277EC088BF91D3ACCC4E541AF1B7701DE69483B1CB64F5" + + "DFDCF259761E080D5C58ACD1BA8E3E13C52E4346D4743F4D7C5FC9FD1BD64D52" + + "0539B7E627A33ED2F5840A9D878AF88B32C5D5B8A8279662895A6DD129E8E511" + + "C5123885514D3E3FFC61C000DABC1648BC816746B3FCD00F967BF8F12B1FB18A" + + "E87A9972DD2B9D83A69E06FCACC37EF3CB6CEFE37D6EC68C40ABCDCFF9A91716" + + "6BFFFA54A54016089E4C008B0FCB9EDDBF2F426E6232D04FBA7C41F0BD044D52" + + "70B4B82D865D75BF8475970459E1BC28E9207189586944D84D1CDBB74EF25773" + + "9A2F070A9871B1072822A6614732A9D90B36E6B1F8B9DB190E0B65059601AFF2" + + "D19BF35C1C900E6D575DDBC1DA505FFBC19CE98E90741A898A207D254E236A89" + + "1826B66AB6E1D26AFAE6F59A70477F17D490DD1CD5673FEB65BB4C52CAAB02BC" + + "ADFDE6E483DB58C24BC3E596E451BB70FB425CD2010861D60CE726F9067659CA" + + "907134542C069E52AD359E2C300FE19AB08E343614AEBE1B5584D258F1713927" + + "4FB671EBCBA8B11CD4E35564B518A840D0DE69B54E39F762F3821E5C6EF5C2FE" + + "9CD9D62EB1031AD5D191B95F2B303B301F300706052B0E03021A04144BB56BD6" + + "06B405745EC53A2F4AE4598F557ABFF60414C984B699CDE84E8ADC55A7291E5D" + + "FF09EAAD2394020207D0"; + + internal const string Pkcs12WindowsWithCertPrivacyPasswordIsOne = + "30820A06020103308209C206092A864886F70D010701A08209B3048209AF3082" + + "09AB3082060C06092A864886F70D010701A08205FD048205F9308205F5308205" + + "F1060B2A864886F70D010C0A0102A08204FE308204FA301C060A2A864886F70D" + + "010C0103300E0408D10B4BC509135A33020207D0048204D8BC69D1EFA1BFF345" + + "14685D3FD6F4407BA4106DDBAD150E899E2C6BAE0B291797542F07376E797891" + + "16D8124259D24C3E753781187F3CF49FCF1994554A28E12A2AA76046692D3673" + + "00A6FA70D09BD1A0299FF481A2060879A4B34FD35ABA4C1EE87AADD95A42CA75" + + "50433F2BCF46548580AE0FBF839AC5C6BA984C9ED00EE8C164F701985B116C3D" + + "4771CFBC95B41CE2C61EA951A0B2B8297ED1A10E94F80640E3BC49AB004DD110" + + "7DB967921976B49AE1DC70AC7F3F1D85A4AD84D911E63BAC9DA9A620EE4CD74C" + + "512D240DD4937AD6718432C1CC39B00354945F80BC59B3A9C3A2CE80D17E4388" + + "88BD9A0C6665E1C4D31C676DB4135386704366E1650E457803E784C37658BEBD" + + "64C23338E6D5416587FD8460E2B04B2F9C884845481B93B6E3A829DA9C364ED8" + + "FCFE8DDF2053B8F8A6A3978B6F1760758C0124C87F04BF9D411DC3478E0A45CF" + + "A0BF342255F798D34C059B401B29962DCA862577C43D7BDD41A69BA220FD58E9" + + "5CD79B0F6FC43730E59E7C8709732B88C68F5BCD7156A75359D7AE38A71AC69A" + + "605BEC35038DEB4167EB989FA4D1B4ECBD25981C0C4D5D3109CF8C12863DF59E" + + "904DA26B0B03AF0CCB1D83F07A02338F413B6177DFAFBB4ABEC97FCF7804655C" + + "0697FAD4182358064A55AAC998B035D559C4496575676413152A38F079568272" + + "2E80AA090D9D974F8CCB59159F184B448ADCC3FE9E3032D64DFEC9405ED27030" + + "09A5BA3AA1A6A9D190DE7D068BBBE5F5A9220788B8052A81C1AE4343E1E17FE0" + + "0B8EB2D4537A97A9726E901FCC8F5B660AE84FF7EF1D2633FCE243DE56053C64" + + "52B1B0C8E73112B34C4DEDF9ADE21BFF9217B341017945D73B6B2670926AA4C0" + + "FF1EEE23EE56C8650CF0861A338F645B4859DB37281B4D655BE084D5FEAD1B8D" + + "15C77FF3EA96CBBD098C4E05F718FA81BBD8D423D491DA5A42C7919D14BC0C66" + + "D7F2FFF8102F2207D7866B3952A15B3EF96E59B8B0AFE59668AE4BBF8A75C0F4" + + "39F3096C3B9B172074C37CE8C0335BA90CED4C78A35EAE6BEC26FCEC69AA6470" + + "518A9131E0BDCE14604CF7C1DFB7C6CBC90C0147EC64417418F877045F0C947E" + + "16168035DC404E2EBD1C6B9BA0347F011AFAF908FF0A1D8FEB85DE87BA2F8CC5" + + "BBE29F4AD3FA4F2F16BB282DC801B817DBA5D00A71A83ADCD228DC03DDC477C1" + + "1693D7C9F179D1ACB1C13F6CFFBFBF7504A31BDF719B35E7A25B116EFAE68F96" + + "6AF7A9B545DCD3C9FE9FDA171E28E46A5FA749F81FD8D87FD52D4795F4E28554" + + "3B3C2289264EA9F5B1DBF0797F7795638E2BEA075F3AAF04C119329F43D9788A" + + "98E22784CE45D3F0659CFF73C55379156A56F75D3CE6BBA7F11F949CD61F9ED6" + + "9D84ADC7A41D67E64C2FCF532CFE4BA2D31400A8DBE70C4344790FFB9F353245" + + "8967D45FE4C6BAA588534AB8A43BB1417DE16D7413DB778698BDB75906BA8E22" + + "7C9221B2B44D358908BBE0C0F2F004BBCA5EA8986169C1EB59B6C8C9C254037F" + + "D44375DF38AE1AF5BC23485CB6FDCEC1C0CF0B8692B4E0A00EA549D4E4697924" + + "0CF5A90137D4E12ECC7F1966E6817CB1F06673EA7D51F462289E08B080257281" + + "30D738CAABFDA23821DCD9CF25452857E3EF237B661338E44A0C8C474944F265" + + "0FE693A3B677EC99A647CAD574E85605800B1BF305B779DF5ACFE21329E1B4D8" + + "09B9CC96363574E387403DE8B57A636D731108EF9501075547E412D22475C053" + + "AC21B74B24ED7AE7C23E1235E93F58D73181DF301306092A864886F70D010915" + + "3106040401000000305B06092A864886F70D010914314E1E4C007B0037003900" + + "4100300039004200300036002D0044003100440030002D003400430046003600" + + "2D0041003800460044002D003800420046003100360043004400320039003700" + + "340032007D306B06092B0601040182371101315E1E5C004D006900630072006F" + + "0073006F0066007400200045006E00680061006E006300650064002000430072" + + "007900700074006F0067007200610070006800690063002000500072006F0076" + + "0069006400650072002000760031002E00303082039706092A864886F70D0107" + + "06A0820388308203840201003082037D06092A864886F70D010701301C060A2A" + + "864886F70D010C0103300E0408CC0493121813F19A020207D08082035041716C" + + "8BF56E445181DCC9560D5AE27F850E9F87928D642B9C3264C2991F3BC05818FF" + + "30EF2D88C20F7E8F3453BF925BBCBBDE8273F5EDAA719D979B468DB9A02B38FA" + + "FB3A852F1CB828B69AD64B92DB29B0275255E0E9E2A1D82208B9388ED4075E7F" + + "18EFB6FEE20A3F1A440245BBC01C71DEA4AEC041C6BC2B7B108E85C1636F8C98" + + "2D2F860EF6B87C8C2705C14F4EBD351A36112BB26EF542EB4CD89DAEA112817D" + + "667B44AC99FBCEFC2164AC9D15A5CE589A61E0AD01F5C4467BD0835E23B41D48" + + "8122061A2E547CFCF38ACBEAEC0DA94290BB0CD52EFE15F5E0AAA89000E04437" + + "2B63787DC5C88392258C58C12BA1E63EB6A8D69ACF662BABF63714D99410C419" + + "D167820182988F5EE810A4C3F76D95057F0772F80E4E6B5F69CC58226DAC747A" + + "34311F509FC06F8055A83895E08520A88F74AC118C8F5FFA94DD6DDA74FAF779" + + "2B2A9B105079654A209D981E4C9954B3EC64E45681629DFC08E03B3D5FDF9461" + + "2A82365F2B959FADC808244ECC80A31C931E0E74DB4AF6864BD7AA90C33EE7E3" + + "432C41C756479927E1D80E241C59CF7BD5F1C2C3ED3376B2C1595C8C28A30937" + + "4E092FC99863A02D3C88E55AE43C3DDF83D8729D5CCAD761AF84C16E44F575AA" + + "67AE08CE9F8BC09C0A67C4C53B964A747C2505BDCF20690D8094F5AD58667CE4" + + "23BEE3383D9FCCC522F17304EF55B27B2DFF3CC4347537B7FCA30ADC16274EF2" + + "2DB9BFDECD5F44D55F8246D21EB64BBCA141BC5A8B62F999CBF06553490B6265" + + "68C3F61B060B0A04AA7A758D5C33155AA453564BA9CABE511C6D4C351A49F914" + + "3B80877542D9E65DEE2DE4AC2BC7A4997EE657FA4B885E3606D1F84D6977E758" + + "EFA84F7097A18330A3A222E7EAE434AD8D472127C7457CEC10602C4E0A4F0B72" + + "1968D8E0019EB5D77EF5B1EFF02D4A6CEE9BB28EDDD72D623FE9295126082631" + + "BE3A95DB414758B414448CB401EF0763BCCE74C83D93D45C2512977C35DEE3E9" + + "8A9D7AB96CAA0EFE7DDB8BB7AA77427151B88087FC97579A39D8A2AEF93741A6" + + "2C02E951ED1C3A172FC366253000AD457CE3194DCAC4DE13297D138A2EB007D3" + + "667F72FD0CE169799D85B85E474D06A28EBFB4C166911EAD43A70DB60A7FEC30" + + "4A6931591F13F3D029409548002D873551ABB2873BA3E16411E7E55CB693088C" + + "2B5DBB5F6861679BD1C2817A73303B301F300706052B0E03021A04145FA3D2F2" + + "D00A66EA4DFB51D5DE4D316276BCCDC00414FDBF473E8C4EEE8CC4D8DF166E6F" + + "6409A8F0EEDE020207D0"; + + internal const string Pkcs12WindowsWithoutCertPrivacyPasswordIsOne = + "308209CD0201033082098906092A864886F70D010701A082097A048209763082" + + "09723082060C06092A864886F70D010701A08205FD048205F9308205F5308205" + + "F1060B2A864886F70D010C0A0102A08204FE308204FA301C060A2A864886F70D" + + "010C0103300E04083EE6D2E1BADA3F12020207D0048204D8B84EA7E2CF71A281" + + "7828C34AA3005FEE52146EA713B5C3AA7958278B35FDF64AE8B998E3D87EA25B" + + "54B5319CF4390C812F7EE71D10CD3C70851AD81C690DE0326D0FAD71FF3D5038" + + "223988DAE31EC0060B6C2C5C9C74B08BE8EE3B78FED2A04AF83D38AD11AE8DF7" + + "8F7E5E1E447CDDDD0D9DF2AB10C4B8A90AF6E1152B6A7BE2BEDFFB4BCD8FDF3B" + + "D100114E75760396304BBA8C2AA19C430C9913028B422D5A74AE1429940D9B55" + + "DB9225604C5C4FD9B162A921E62BBCBC268470B84BC3BBB383A2C9BE7E178C0B" + + "2593D617D1466B95E57E90E30ADB7E08F6B0753B8B9981C49537B9B80D98BEFF" + + "350017130F360095156BD5F2F8963572F1B78A9B08B67642BB09FAEE48877259" + + "3383A830F3EB080210F39F5C28EA7892B8E6D8D6831A1DB33EE2B7A5BE758C65" + + "8837A6D1CB4383B47FDE181BB1F043C403567EDB66EFD95F585BC8DB248CD0B1" + + "909763DC9E3F46203C6FC61004962FA6799248E5E7F5B7A131D720F24056BD42" + + "30D1F5E6827B3025A66DF97436A02D441678797BAEB5135931B02A182C045B16" + + "9E8F86CB5871FD3DFC3FB573392230B70414A18BC792AC988993AE9AA2DAC5DE" + + "E09C87F60AA13637EC006ACA2525078E353497E1B242A5FA4BE57C764B24C4B0" + + "F5956D6067CD150ACEC57D4CAE982E782449588D5184961952A2871EC6FBCEB7" + + "E38DAED63C897808D7C2D499428E1EE04BDA40A287552493954A45941E684028" + + "2C964AB94D5A81E833EF28B3B7DF3698CE84595415001DE52ED85A6DB49D4329" + + "562C73F2AD51118A9E409FF96677C117B0528E725F55433798DB598F2B5B558D" + + "77F7703D1BFE6C24CBBD1CDC5961FFC45C139FE9855F93BA52A0183FF1C18742" + + "73CEBA04CDFD3270ADF3E20590E65E019DD6DE4FBD7C62DCEFDEC21103DC1C65" + + "078B76E9CC1DE6D33C4C6688A14CE938ACFEB25C8CD134C1BE439BFFCF8B9399" + + "8E8DBD7CFBD86D6CED0E1D1D8712913EABB7DD493209C61C39B757B329130562" + + "0E38EFC575C2FFC43A86300D5665C0B56DEE483762A623DFDEFF4627BCBD00CD" + + "3DC181AB22CBD3D602DFD379A223F6AC2134E47507501EEEAF33B06001C45B67" + + "C6DE14026B88CA0BBD44F941729FD3B9A078D801B98AAEC83A2431C1A7A1EB7B" + + "99051B4447256B2EC42A4E2917D6E7BE65FAB7866EB797F6ED4A988C57D4DCB9" + + "8C9236348A45BA717796E7715E734E2B585176100C5FFF37778EF76EE952CCE1" + + "5540E9DEC3E84E740694BCBE6E4108414319DC8E760852313C86B4EE03B8DF16" + + "8D00615FE20442C4687400E2436135C938E9167027799ED8890CC08788BD2A28" + + "41F0F2C1CF8CC2CB2950D3B2C93394017300C714BA941D356F8FA95FB5F82262" + + "B703F77A48E6EBE95DB2E7325F9248758578735EEE3BC0CC169FDA777A9FB591" + + "9A0007E0C191668F65714C359A872C14527B1A455305CE275135C7EB9F2E6AFA" + + "5F7FBB4994D0C2E8BF42EA9BC3581A7D70D3829B7D8204F2BC5AD9D24D7F3A09" + + "E0A0933D6532ADF03C500E11865C3138834AC110C513239E83606921929853F8" + + "D87FD51EEF9288178891AA5BC8A496E9BE44D4BFB83A3D435625DF3FF752E7FE" + + "FB8509D28E3A5E8BD5115FF0BBC2AB54DFB9DC8250478CC7E7A0624060B446A6" + + "4777501DBE0FF81EAAAC1F108BDD7E122FAE1CE7F326EBC697A016CDD1E364AC" + + "39FE901DF5D9E7A49225017DEA5374091232A47BE1147753CD60199268C70CA5" + + "ACFF5023B35FE76C92738BEBB1533FCB3181DF301306092A864886F70D010915" + + "3106040401000000305B06092A864886F70D010914314E1E4C007B0037003900" + + "4100300039004200300036002D0044003100440030002D003400430046003600" + + "2D0041003800460044002D003800420046003100360043004400320039003700" + + "340032007D306B06092B0601040182371101315E1E5C004D006900630072006F" + + "0073006F0066007400200045006E00680061006E006300650064002000430072" + + "007900700074006F0067007200610070006800690063002000500072006F0076" + + "0069006400650072002000760031002E00303082035E06092A864886F70D0107" + + "01A082034F0482034B3082034730820343060B2A864886F70D010C0A0103A082" + + "031B30820317060A2A864886F70D01091601A082030704820303308202FF3082" + + "01E7A00302010202140A49BFCB1DA91FFFDDECE6FBEA3EE7098A4FE4B6300D06" + + "092A864886F70D01010B0500300F310D300B06035504030C0474657374301E17" + + "0D3233303432303137323434315A170D3234303431393137323434315A300F31" + + "0D300B06035504030C047465737430820122300D06092A864886F70D01010105" + + "000382010F003082010A0282010100C53F2D0A6732510BD381F04F9EBFA1914E" + + "197754762CB256EB13B690D5F9A89E27D32FB92F706CB2615285BAECE16C93E1" + + "B6E2E205818A69EE99C2FF456F6EF117F1B414E43F71C0E78BEA69565683C9B6" + + "1CBB1247055FB88C758288CD70B22A1FC72E0B0EDE8A8A7B7AD50271B915DB06" + + "F2F7F6AC149439FA12049CFED26C916A80FA53E8DFCFFD7F2FD4FBF8A70B2BEC" + + "11342C977636C40EEB88F56B07337B2174EF51AD505B4283B876E98B93E8DEAF" + + "5CF4415BC828CDF39C34340921E16437BC7E19EEA44B73B26B594CBDA5729601" + + "C758F3476A221AE043E74975BD90D154643E319F9C253DCA9263A1C2526F7096" + + "A75C524A24B02F6DB13ECA5C43F9370203010001A3533051301D0603551D0E04" + + "1604143939D5CBE561A3E16AF98C385C4DE21C7745A7DB301F0603551D230418" + + "301680143939D5CBE561A3E16AF98C385C4DE21C7745A7DB300F0603551D1301" + + "01FF040530030101FF300D06092A864886F70D01010B05000382010100B4CA91" + + "1663AA6EB8B55B8BDEDDD4A07B1B0D0C79A819035BCAC086A01C5DFC64D2749C" + + "49FD67B20095288E1C54BC3A74FB7384DA4EF82CF5E66114373093DF1729DFF5" + + "95520975BE15C319B747F2209623245113C39B4A61909A6962A4CDDE832F6EE7" + + "DE15308DACAC4A6CFB1C0B0DA61AA9FCEE70441DC554F14A170BEFAD2BFDE032" + + "99C781BC115305E56E0BFF667B518DB0F16FCFA0B730B61EE01CF65EFE499C6A" + + "F5A67F9E20F7DFCD96A4B86ECA84F3E60AE94931B7A06C238BDE733BFAF131A0" + + "BD7D69D92AC75A4FA2EE300C1119DD05BF44BA05BDF1923DCAC9E372E5F2C155" + + "9EADDD2DB07B9BE2A984D2463E12262F058170C60BFC2646713C347D04311530" + + "1306092A864886F70D0109153106040401000000303B301F300706052B0E0302" + + "1A0414B7DC97F46A80902C720E8D237F10ED6FCC44ADB90414695EB196470870" + + "037CD616FBE42CC7469BA795DC020207D0"; + + internal const string Pkcs12MacosKeychainCreated = + "308209B60201033082097D06092A864886F70D010701A082096E0482096A3082" + + "0966308203BF06092A864886F70D010706A08203B0308203AC020100308203A5" + + "06092A864886F70D010701301C060A2A864886F70D010C0106300E0408365868" + + "CD387F42DB0202080080820378CB4B33E06FC54306174EC0AEB21E7DAB66B368" + + "4BFD1E6A2A01F894F38EAE1899CA23205BCD50A9525B125AD532084E6BD4AB4A" + + "5F80AD6FAFADF47AEDB18C9533E527833B972D8F8719141F9982E47AF3E7560E" + + "C34A3F248393659197480475AFE35DC804DA34C14043C67E0EB969FCEE09A933" + + "AC1DC8407F667744C395AB4FFCAFBE4E5553204228B32340692C68BEB99C4519" + + "DDF88D30E8CEF133AAFA77BE355A333C1BC395DFA9581B7F78A59B2089289CF1" + + "207266F8B237141013CA65EEF7DB2681ADC4FA7E36ABFAB2D424AAF83FED6039" + + "FB74BAA00D7D743E6DE29184656754EF99E927960717B414EA3390D62E3773E5" + + "BC82D8B0477ABB2338685951CB6471665E6EF8A7AF869F7A204DB5DAA1C34153" + + "EE9BEFADDE03082ECC0496EB245FE6DAD783F286AE114BAFC0DE20D435F1833C" + + "1FEE5021161D327127198D3BF568297C302DC2C37769DE8E7A499AE6CEF5186B" + + "168544996F5F4159676A2B9B887A335FDEDB14699C03629E204DF1FB5396B00B" + + "B40E20F8898BFCC46E400E32085C827346FC8E69F463938C9224E16EF2E892AD" + + "C37488389501A79A35EB573E915D62ADB2897543989D5105594A3CF3C38E0472" + + "FE8A66FB507498C09FE2BB191935C46A00C9DAAD4FC842DC3218182548D36B0E" + + "EA4114E5997F7FF6210352FE8FA2B0E5D0871DB8B65AF97F3748BD413FC55DD3" + + "B522BBA38113801D03577200126F18868314C11A0F2FB1BD5A4C60A7DAE49FBB" + + "B14A4B256B367289FAA891A1CABD58951531224B5BCDA6B61A17C7033BAB3D80" + + "E08CC0385C98E7B388E072060030B60796BF56A71B31163AB9827F3E3ED043F4" + + "F3DA619D8AB27E7887983152AF110EE552B5BC722FF0F021CEC1206A5C6D2B12" + + "3C5DF369DCC5A1C3C722B3A6767881F5142EE63D0A67866E8ED447884BD4A349" + + "A6DD2641AAE38624CE400E3D71A6420C0685F22422608FA143921EF661252626" + + "F54D743214531AD1F8D91B547E0EC24B9B01A97FD7FB2FF8DCBA530C221DE1F2" + + "0067196F2C1FAFF892E8E49803B33BAA291FC516E3FD5933E5DD0D2016F724EE" + + "E4E8644D7D93D80C9A6BDA84A10F79F50B52E6F76EA9274BCCE40D09A85F6072" + + "654645F4FA044719BEE24A04C2380A6596E17F1DF7213AD98019561E21DBC14A" + + "64D4AF49676113FBBAB9DF2C51E71048B505D1741B325B7AD2D202DC19D541B6" + + "DEDC7B57279C08EBFF5F588086295CE78840D8504D91577C35E9B49F164DAC31" + + "90704B2A7E3082059F06092A864886F70D010701A08205900482058C30820588" + + "30820584060B2A864886F70D010C0A0102A08204EE308204EA301C060A2A8648" + + "86F70D010C0103300E040814D5FF817FE6B0EE02020800048204C8E933D4E9FE" + + "25B62F989659649395ABCA2E20D6784D7F60A36074EFF5E6BB6C319D7E595E1A" + + "F676D24709D8C0A2DB9BB5AD2A0FC0342C77F098C2BA51CB4A1E1B3E26CBC64D" + + "6655704BAF173EA6C38740A9DEDCCF378D7C95588F3F767A9BFF8B0B6DFE668F" + + "1475A860F86E782469F21486C001BFF476319C6E5F9FEDFF8BCBFB4F7012A68D" + + "C85EE96590FC71DD8ABB0C967724564082533DADE23522D73D56707E22211A71" + + "EDD5F62041A79500840D808C61644B1746865D84A6021C20A0818DC173B16263" + + "01F462E54115E15726C1C897CEC39466117AE2AB5C15EAAD645F04E59E7F5E4D" + + "360AC5B4CE7F06C197C3FE699CDAF1B27A197897F97D0FD62D5F9F8FD3CD0D66" + + "13D01CD2DE930C147A7CFE4787763DC0BD864185F9DD9D50A231079B92ED32A4" + + "D290B85142FACCFBC2FE1A9823FDB1E4D5AAE57826F39DBEA82E2A8D7BC8D6CD" + + "B9FC1407BE84447ED48EB17FD3529091FB78398D56CB8C797CFB2574ECDD9732" + + "023315A77D3BCE8EA9DC29FA97F23A09BD5C546A524BDB3C7F4870AC7CACE935" + + "F13C1466ADEF7E66A405B28F4A59589149524A429E03854E62297CE26A4DB720" + + "9BFA48AB52F3646FB5421494C287C30EA2E2311EAF42C561CA144A5C7C592004" + + "88C8D85E9A89EB36C94CB18A2AC306ADC55197C21106137CBBA023DEB14561C8" + + "B6C2B789BB542816CE48F98CC68D65B1DFC406E2E99A80816D069EA1BF2117DB" + + "50D4ACA51B19AFF8669347DCAFB227D827137E633AD37727C352E1CFE184EC5F" + + "D567B865C63BDDC66D16BDAAB053EDD9210EE167F28D9E885262DD8B142A0143" + + "1356A942FE56D9B49E343F9459597C02E2EEEC4F59BBAA06BD9D6E9906ACC2AF" + + "85129F72F78FF97D2FCD0B6A6CC6DD6E2A5A92903B5A35C04DE62259A128CD8E" + + "A162057FE51667D2AA4D661AE36728A424D359409678956EFF604CB254E0A1C6" + + "822C1CC349AA77541D101FC5A0D487C33FBBC318E14FB1B13B74F6C41E9C53EA" + + "ABCFF7FBEF0D370E85A5918BC170AD62BFEFB8B46273901FB9615A808B912183" + + "25E79F666DCBF60B2FFEA25680E1AF19EDC0768AB6C1BAA67304F2FD25AED2B4" + + "BBFEB8BD4FABE09AC3B1298B4CAED0772C5B8EDE2063E0A65C424AE2BA344B56" + + "9E8DAA789B5799480E293EFBD625F8C3482F81C25ED9A44B41DE951D3B0565C7" + + "4889C29C101B9921952D2D7776212AF33C6F60C55A3BCA457C2045C6F4B0ADE9" + + "F4B63CE3148F16153C4425373A335EC789BF3EACAB052BA091A75ABDF4E01B7C" + + "F33805702A53A11E5FFD0752E2B6E14CE2840B94FFE53405EE0EE5C43C19D001" + + "7147891D4FC5DE5B949A8C602481D8C1F9F8B2CC3BF2271BB12B306452EC55BE" + + "EE81E13710746EEA3534F106F14DBE9FBD4E00C2FA2A331D2C8FC54607F6A772" + + "D8EE0B3E349448B7AB4E5CC783E72C3A3AC82AAD33F7CBB24403CE167A14798C" + + "E23284BC8A3F90BEBECDC4FB142037CBFD0BE595A6DCB2FEB4B80CDD4136374A" + + "6347898251859BEE1DBF18F3972493474E1DA9B60943D49978A8F4A73470BEB6" + + "E534D3E74726CD08BB6E9A04594FC8AD7F586F52AF8313D41D4DF45826A300CE" + + "2E6225CC0FD912F6D56A46A6BE4DB2CFCFB16CBDAEF928F6ABFCC212B12E3A51" + + "33864B1280EDA8E003F9FDB30A06058B35B31B133D67743C934C9CBF3CBDC06B" + + "959340EBACF1D7A781AC1318635697C2D27C00EDCF067A6CCBCADEEFD2CEF3C6" + + "B4E750318182305B06092A864886F70D010914314E1E4C007B00370039004100" + + "300039004200300036002D0044003100440030002D0034004300460036002D00" + + "41003800460044002D0038004200460031003600430044003200390037003400" + + "32007D302306092A864886F70D010915311604143939D5CBE561A3E16AF98C38" + + "5C4DE21C7745A7DB30303021300906052B0E03021A05000414AABF612B1D42C9" + + "7B2A777B2B544302FDEE1129EF0408B1FF31BA6E2D1A2D020101"; + + internal const string Pkcs12BuilderSaltWithMacNullPassword = + "308214060201033082136506092A864886F70D010701A0821356048213523082" + + "134E3082134A06092A864886F70D010706A082133B3082133702010030821330" + + "06092A864886F70D010701305F06092A864886F70D01050D3052303106092A86" + + "4886F70D01050C30240410978E6F227D033AAB5C51682EFFBA56570202271030" + + "0C06082A864886F70D020B0500301D060960864801650304012A0410905BE763" + + "FCE5DCA6ADF7F8E1261A5237808212C059073968AE0766D615903AA16B242ED1" + + "765D4776FCBCAD0EBB59DB954E9D0365C5183E758854B80D5CCBEFD131264AF3" + + "D864832A2C25B8B93DFEB8EF2D4CD204B2ADA80B2B41C4C58E5B48B55EC65DA0" + + "FB083D61288687A896374B6C851B6251C0E661751F7EDF47478B9041EC7F5B54" + + "DB9FB6FB8F4FA58CB9F8AF80D7E33B4D0F36880E2D348B5A84BBEBA738B3A10C" + + "7CF9026327A1D47E695515D2EF2B73ECB46B42DA27917607E3504D7DFA40A000" + + "CB265E4FD9C9DA026104220E3ED100EBCD434AAE29FF89A883B25111DAE8501F" + + "68AE219BA7725B7EA2600841F879E9D57664940D74C36FB25E29ED104DFDDF2A" + + "3F104B6A89A878A85C50133B68C22C00FD9791170287828EE50CDA25EC656C83" + + "7932D5904090337F092B24853D7F4E27108654C5764F04817D8205F661527326" + + "9E7DA0B4982108A91E5344B54A0FC07056326483B0D6D445601888D84B22C8CC" + + "589338DED377ECC841B08B02FA5ED7A1E8841B5BB2E0C5C3CB750EEB49D1BDFE" + + "D10516924049FDB0FDE9B20768ADF2DA0425AC8B4DE6EF89CD6AE5270513D7D6" + + "B78B97FBFFDFC2CAEFC428DEDAB3D44C9917AE8F688F7E3EED875A5203821E22" + + "DBBD45A12E6B3C296F8B37B7782AAE09CE48837E772BAFB0B6063644FF3B3DBD" + + "861115C3B91C14669E5E92CCA38879F6260D387B6884C368F7246DC74387C404" + + "7086ABA92BE2D3783106C3B6BBDAFB7F9788E1315751E411A5DCCFCBB58B67E8" + + "ED207FB88B5E92302B97256C3CCA280D3670A7DEE71639EEFC0546D651F2F400" + + "A45C8B7643DCD814349CA3099A6CF5384CDAB9A9668FED88C40EC7ABD1E0079A" + + "F4CFAC8799506D5330A5A97B2988073893A98611327B9806D5B7E0B2BB46FB0E" + + "A2304A2F6A21357D0A3282A149E6303B8A06D9ABEB0518EE665D05DFD1207CE2" + + "4AAF471334D61524FEB2BCAF02D09C400E6EF7748BC71DC7F2098E82EB18A367" + + "1061F2BDFDB063D1823791C182B22AC24E7128287C036CBFD5998B2BA25B1601" + + "937EF2403AAF3B582662D50558D12F3BFE0C4A4174EE2856171FAAB8DD94A065" + + "8D5016CD4F6224B06E9E7A179BECA8FA90F9419982CB5799AA024F8CD4C33CB4" + + "2BD2BAD207D8EE12F739028B04D7015DA37DEDE30A2855FA99A5D33F68460E36" + + "C7E28CF4C87A13B2E92EA349D394ABE6A9C0BD0A2E9BFBDF8961DAAD2F5BB547" + + "7E088EEDFE2858E816815594DF0D6DF581E41F8E758089344CBF536FCAAE2859" + + "2E170F4A11455DB0D3D7D2D5B8E2D951603B9FAF3AA1F76F9CEB0A4988D0EE6C" + + "F0A6FC537C74F6F1A66C38790BBDEF0DE139DD931F1DA04806474931CE5F5F3B" + + "6B419D2DE5B390F94BB1EBCEBAD49E56A7333C6803C0B30FE9A354B81112A93A" + + "57CA90CE91E9FB92163E87A223D02C917A85F7AED5B4074750B79ECD116D86F0" + + "0C7E053C1D113B3281423F8A3CA78FE67E3DE3E6CD7D6BDAE0E4A69EE3B3EA76" + + "7EB2A9AB24124AE29B00CFA484B8CF26E6C7228CB95261F96E6EB8A0B0EB153D" + + "B6BF8B5D1352CEC2C7FA6C4F5DB10AE2023F85C6A6225127E769205B047AF02C" + + "3F6F18F1B1A590B26F29F1632E47B8231BD40C9BA6AC7140B5493CF3CE58F85B" + + "0ACD857B8EE850B82522757FC12B142C1C8A9E76F68C38C779593207B146D598" + + "64C676CDAA4FE83A3FE6B2974B89D4D04CE9E1ED3A95A1402C1242422A6782E4" + + "EC846091719BAB4A4BA6DF294B3E35764D3E41F2057061354694AB5432B02470" + + "EF92768C838B8E472B5CD48E4BDCACC08157AE2BAFC50C309C30A9B52E12B221" + + "961F251E84C8A69342D14B23AAE57E5295EEDB55A2B3AEE0494CD59CB9B392DD" + + "A1EC7C72282336385561505B1F772BF592C7A3ED6FCE4CCB8249EF83960B841C" + + "9664ECA0409D1DFDB9D926D331011B3FC906968B364CD0C6D0B8523C24204234" + + "CAB129D1A1CF17FAFF85E16B215052E886EFE988813DF5AEF7A525798023021D" + + "D821D867427BB605D7DBB4A522078EC9E3D6E863CB54EFD79B291058EE264945" + + "6D61B5A93ED32B507F0DDFD60BEB3258BBB8577FAA4763E06F77F135C8C62DE4" + + "CCB766EF06DC5A7AAA3E8AC42008DEBE1F70901FAF8B6937FD18FFA9B9DD856D" + + "2136E0814817DE4CC48B129CA09C5A58D7FFCF8C1978C54DFEE521DF01AD683F" + + "682066B142B86CF8BAF94E42369BFC4A5842D9E68C3CB2DF69AD0595D60D998F" + + "DD26984428BEEFB4EF36376D4EA6940CA9A286A7AC285F00FD2AE8740E7BA3E2" + + "1E85CF48F03231CBF7CBA3836A5ACAB14FDDD15F0F90EA21C593FF6E134721E3" + + "FA2704E4473CDBB58A00F88535D5668F9B30A2C11FF44AAA4715BCF6DBC85676" + + "345435564F43A10C1D8BD14434C06A1A75FEC14F77A9102337443EAD5494F2C7" + + "96D8A940F000C78269BC362A08948324057D448966AE0BF05D980DA1C8C8390E" + + "94C56145A62AA07392006B7D36DB3C0541387E826DA682BBAA5436A5DF631653" + + "78D3A1DA28E2B525DAA104457C02A9E2CCCAD37537396478C0441B426197767B" + + "4A37A45D2B31C76DD2DEBB9940D61065F1488DC371B6388BC59054AFEDD80D07" + + "3BF1DC05F10BCD1A519743258CC9354EC43AE806CE9133EE3CD78E2695E0D7EE" + + "017D16A839C66011536EE17C4FF635739828BB6617DC1C74E57702C4BD91B362" + + "2E1DB8D94AD98682B3A07CE713B0C3392081D028E3E28A66DC949513F4CA5028" + + "6A9169A2CE5B16B541440399BA50A98434D62A0C19FD40CF2D6859DC6673EE85" + + "60B7BADADAB9C61B7A7A0CE3CFD261C572B8D6C3C4FAE1B426E8B6CEBECF6D5F" + + "8FB9DF07DA90D0250606B6924363AB365E081C89898C84881965AB4D897FEA21" + + "EFF53408F637A844618288404F251009BEE40D1FBA009AA5F30489FBE4E51467" + + "9346544A82001365FE1F45C5332225F2CDCF9859CF286A0D3C41BF20E421CDAE" + + "96723EBDDD5C7431CA0CADEB4550857DD2828C054F757AC2D62921A7DD6A8FC3" + + "1EFB1E64440FC33DE646AFAE0050CA5BC2799E24CF0C9493396B0EB011393CC3" + + "B8C07AF714B3EAD4FD85959177DF63E84CEC40A449EDE23C3670492E9CE28AFA" + + "4FE4F5AA916E4EA3CCDC2A381EC5675FEB06B541AE428A913CC9EB2C4ED70B04" + + "CB7B0A03776B313326C7698E6EED937C81653421D500D66B70545671C4D0FF62" + + "01B6E6318B177C4FA29B408CAA3776D57B4C0424F7DD0350FBFB60CE27FE8A41" + + "6FB5F61E43DF1538617B993D4229643B7AF9F2F8DB8F5197FBDACBFC8B228019" + + "2A12AC4053B05CF307DCDEC654A0C795A11BFF7E8386F057FEE687C97A2476D8" + + "BF1A7850D8A97FCCF8DB5BCA0818813A05F68B84D5EE3583F8D57E5C919F2F86" + + "800AA4A6A4DDA2A4C6F7028CD9205B7B3A0105CA5394D9B02D74EAE6EC792534" + + "247201A00C32C1C732F863E6538C810D046025CE81B6E7DE5F721F609A3EDBE0" + + "FF0EB459309BEAEF029907C7F16CDB809937057BE54D1FB1DB18B289765F6863" + + "FD398ECECA0524C20709306BE27CC94B3D2C705F7D676BA7CF00DFCFC170F0C0" + + "2EC263AFE2EFC0E6B1B1E7ADA062B2D6DA2D067833B31BE50120351B3EDF8CBF" + + "7BAAA08AFE2A2C3914A1A1AC537AAF4061507066426270E98E6CFBB877BC2AA4" + + "BD3C60EBB630F9788A960BBECE743AC1AE7FCFF28FDE43F7AB14C8216217353A" + + "E25FCB031C2DF336FB09C22D118FF9751323AC9C82A352447F1E6C7AB1E39547" + + "868A5CF5CB44C8108298620E8524A04310EB5C4463D3A50E25AF1ACA506FC1AC" + + "C642C5D5DE0536EC82C8DB9CB17FC612275AD03BF8FF030DD34C3B0B9BC24929" + + "CABC0249DA09CA034A9280CBC3EF09D4C4EB09924F569728499587A1DDA9B185" + + "7FD8B5CB61BE96047A4A5A28C8B7EE4F9F976E0A3CF25620EE783F6BA53719E3" + + "69C3EBF94BC8B229251C34388B01657F0EA45B5FDF1B0EDC25C3F08463ED559A" + + "392820F79CA86CBC0CA7034BF996E98E4FC0255DEE55EC693BD7E20FA123EEB1" + + "BD5FF110E8D85348036342A3330573C03E9F3949ACEB03AB5010173871BF1DAB" + + "AF12D10596AC8E22C48B45CE0E69C6881A4CD268401993631F47A1BEA6C90DF0" + + "CD26D86D32CAC9307FD864CF44841095F636D38233CA73812E9AB12DFCADF391" + + "D9D8733A6D039399871B479B734DCE9A358F5FAFCB39AB43215F8A0635EBC0A0" + + "943EEBA6E7726E57E2F041467FED30D543785B47476DFC0A1BB36C61C726C4B7" + + "1720428889B9F8CA2A82168469EF7E1EEC52E61B8676FCEBFE49E1DBF13761DA" + + "A66DD693BA7E311B042E3BB978DFC50F7177244F8AA32CC09234B7F83367967D" + + "17856EDF91D1D1357B1B4BAC1191BD692AD06BF215CE76B9530B4993E5613D7A" + + "D7FD354D89FAFF2D397E0AEDC3A21D1DA8965CD2C39CA833D218F1B7BFD02643" + + "885881BF15C24916ED1979DFFAAD9B9B6F4A6F4D03C84588CAE47AC7EE9CB9C8" + + "6DCA2DF1D2F92AF46CD5F20E3F7D262C8996FE0CF224FD8D7F848FC2D03E1BFF" + + "01E23DAC01A2A27575CEACD93DB8B330EC4047B82F303177233BFA8094E8861E" + + "0637C9ED617CEFCF60938B78354E80F7E405474BDC35548553D8AF005DE611BD" + + "B52425A99CA1475C63ED881AC909F9B35C83B8572F4A0B51E4E6A66D0381F1D0" + + "09D71577B22D58314023FC3DAD9E10D95D3E340B77A962B93B13E4F595B4BA82" + + "FEF8CB6A7E3F92FBF811CC41D75AD49FBAC4EEA9066F2DACF868CDA63851E1E8" + + "8C939CA85A70D0375D4C9788AFAF31150DEC9AA7401577239C094A8A6F242103" + + "06FF01F613E50249E7CB850109A8CC7FF8A07B8DDA5EE2FB964779F7EB7FD093" + + "47CB0065F2A6B473B974BAFC40A3733D13FECF8C1F4DCCE5FD1FE8791A3B0979" + + "3B84F5A05A80A8B8A7F37197CF4CE48152D052431636863AF42F3240D5B8D4F8" + + "4BB2027B756B54CE93C0902A2DABE8758D118D5E6DD5F60AA44BEE1150ED7551" + + "4610402F58FFAB5C2E6FA177E7C250D8409F6917A5C37A7C051FF62A74EB03CC" + + "74017451A96CF9356E08C75DE4C86AFBF6D2A170BB09251EA914D65FBE1686E3" + + "82F96A7A21840E7AB172D611704D7E32B0C2F4829C8E7576E9BE3332112868A0" + + "1479B6C114ED7983FB9F30B44F299F58AE2925587BCD66F5B9F3E221CE1DF9DA" + + "749D6397854FE5D972805C693FB18943BAA8FBC55B8CF24747217F803F74B2C5" + + "E7637AC7D576E23F644E3E6CF24113E64E1CCFABC56C4BA104BA69A14A9A69F8" + + "B6B1DA8AFD9C8F6730F5BADD3F63F557E63B7BF98DC3DA725AF8485047F61559" + + "03BAD87ED8CDA9EC21BE96B60326F9465119E3F069FA147A25FC11343D531954" + + "CE81C15B31838B8EE1CD25B11AE4A8A7FFC68DA57A828318BBED76596A550C68" + + "72982E099C070812E20C099EBF882B86AB722F02F0EFEAE73CD885E6C36F02F8" + + "1C8DF15AE3C01F0370B02706B0BF4AB292E1488450CE70EDA02292323979415C" + + "91DD1391FEFD5EF4EA539BBFAF1E361826454A2E6CC32324D6C3A5F5D7D88372" + + "3258E59706A650F19B5A6A1C2EDACD23EE3CCCB1F09B9910DC3256DA7A851B8E" + + "A110319F11CCFE7EAD2DAD4D73312A64D6A15D9EBC5DDC912562FB494194B5C7" + + "72290595529184953D1DB67035CE1DBC6C05E15131E2F4114A6D6A0B54866DD4" + + "DCFC00475FCC5C44B3494D23A703388314E20EAFF4C4A034EEA686D589A7E128" + + "CF12599CE46BF7F6E1415CCEB27E3DCCD6715949DED6C4CAC4479F442D4554D0" + + "D0181F637098C9F72B0751F508394C06682A22BE7D587788D010D24786C5E156" + + "A07785A78F737D924580CEA11B845548711310D9D29B04364965252CBCC68A99" + + "B0E8FF248B8F706CC61EB5F0B1142F17FA96E3DC4F43449419ED9C348EBE07AE" + + "66ED2CF037AB4C7B814C73C9F7E7A0B82BB4CA5D301AEE6D1B82858568EA263D" + + "3E5536614A7C77F3AECDF941424B09792246A9738AAFED3939EC319569ED4875" + + "A1B09FDD2167950BF95DAD59F8DCE0FE450E765D0B703FFEB330D032884071B2" + + "F3DE1FF0F5E43C7F180E3F0B45744802E8113311E58C2776A4484A8643CF2567" + + "2638C63B40DCCF80F767D26A5E4A830E15397787FA550FFB0D07872EDD38BBCB" + + "7555C9D7637A503C26E4DA6BB41052C0E1DA2A7B7F33C74EFCC529EFEE43977B" + + "8373A2210EBDB9A7126AD0A6742D7AAA7A73E9BE546344FB35043209E3C8BFB0" + + "527AB4456E6D9F873B4C238DA0491D930EA654F71910ACD69973F01713817B0C" + + "1165F22BDFDA789DBE3D01A3375DEC8C40A0A6EB977B10929CEF89B61274D332" + + "ABFBDA987CFCF14EA59C3FA5D7138AA8C32E1CCAEC3D229E1B4A46A2A9F02EBE" + + "5EEAA9D88122BF053F142E42E8A0E1268A19B77CD4B2A45F68B74EE644D3CCBE" + + "FA586076CA0F8FEDAAC1CA11058E4B9896ED529F613E246F2A4CE29ACE49F0D8" + + "FF6C04150DD03F526DFB7AE7DD751FA746C378AB0D658BB4A808955C9C8C3B36" + + "79426C1941F15835D5FD179BAB3D658D4A0462F617DDF5FCD23EF2C899A52D46" + + "60144C01A542DCBB5C15A8086B6E97262090127E5DB9FB999E45B869833E9641" + + "A7795DC55B0D7971A0EA423F306475E80561384169333D7D26299100FCD24B3B" + + "5AD6A215B8323CAD902A6C1B97A19863F4DDF460780D188391FEFDF013EB4693" + + "D3CFA097C480A10502F21CF5C1C2C45E9CDA63604008EAE8C11112167F539F16" + + "236A4B50D76E8C143AF38ECB60CE07572E9F31C5517D1CCC20AD644B3361EF25" + + "84ED7840AB11F901556CEA40435FD9B491EAD820DBC283D4BFBA3B00A8CF2F0B" + + "99627225326C9C7DF70C89E112CF06C9B9B968E28A148B61BE10B7C8670925EE" + + "77EBEC504F822614D0B0F3F0CDCA3EA9308197304F300B060960864801650304" + + "02030440699B89444D5AB2D939E849803579B6C1651E206FB208C67F879AFFD6" + + "32E080D8D15BDD48651241FF03180ADE528193DB946145CFAA069790AF3405E7" + + "81BA7445044055FC4F56A8FA8F63539E4AD754A11A1CE1BCF972388D24023EB4" + + "0E8B8907D86A9F4715D3591307E9DFC832B7756EB214BDADAB09F9E1E61AB184" + + "3EC3297C0D4302022710"; + + internal const string Pkcs12Builder3DESCBCWithNullPassword = + "3082088E0201033082084A06092A864886F70D010701A082083B048208373082" + + "08333082082F06092A864886F70D010706A08208203082081C02010030820815" + + "06092A864886F70D0107013024060A2A864886F70D010C010330160410F19120" + + "18896CFBB4653C4B7C06E67C7F02022710808207E02D736F0AE772F48FF976AE" + + "91E8614648678AB5A318CF7D577713881F80B0D6FBF645446359584803814B99" + + "1A8BFF573CBD1D52AC5237EC7A42ED303474221F91529FDE33DDC2126EB4AAD7" + + "65CCAC633209A0AD43DCDB5C1D4ECFEA856EFFF607F03D66B29D433F268C7E74" + + "993F5F2384F9E0D08C6657CC7AD32549CB8D893A1EE37A24E398A44987D23E79" + + "B3E4F3F48B106FD6193812634F999CDEB1E5E3485D642B4DA850BE1C210F9321" + + "3BB1E01AB38465C5B23FB80AAA6E1421A2F20BE775F658BB52F57B4CAB79197D" + + "E65860D656CE8135E235A3C7E06B511F1BE398C03416BC137E063DC8CF8B7100" + + "628DC62B87A70A282C11BA08A08AB0E03814A9B1940145AC0EC3327396AD6984" + + "4BE0B4883DAFC5A611804FB628B598DD006ACC039A86B23100B102E1F4B3CCFF" + + "06FA1E9841DBA8913B9D1D15D6A16330A94F55B04D9779A90EDC91230A664C41" + + "9AC825594D9F3F39A08074E06E5B671469E3AC9D20D906FA9B99CDAB6696A952" + + "49F7B3CCBB8EC1BB2714C248AE0C3D0934F949D68995A785F782910BB8457B66" + + "1B4EADA3724023BE1DE63144C3661055986A2E4D2F59A2DC018EB8E6178E9DAE" + + "14027352738A4D3579C55F48D0C373C9280689DC509EF602C69EF10566043EF9" + + "F1A0852A618103B6C2039574696D64C8492963B54C5BCBD4B124FF5F93B04DF2" + + "F5C1FB577A2BF8D24D29D7C6630071EAB5A3CCBF7DA9B4F7CC39673CDD25ABB8" + + "9A805838B32A002CEEC02404A78BEC048DE5D8AD470FAAF89F31EA7E42ED1DD1" + + "20B66246AAB7BA1FEA3DCAF7A78BCF679A3FAD5029318D69EDA8F081FC7216A3" + + "EB610BA3F6EEFE78660CDB365055110446F73D0FB468D4F4FFF01C394C9FDD20" + + "47792192AD9A46458E3BB63BA4703A7D8D4E56776D48312C5033497795A396B8" + + "60115AA3FCEB1E3CAED4FE9211787A8B4B0BC1671A3104DA4A7925A1E3D661B4" + + "35760FD3DDF71A5902269288512C637C94DD1DB6B8551EE951019294342A50BC" + + "4310BACBEF7313D82CE7D351FC2E9114BA421FF1EC206BFE1DCA5E772E90BB92" + + "E7DEB1CE899CD9328C09BF299F7ADFC9D43AE4721FD36BAA93E50EA6B8B6DA5C" + + "7A188AEC11EAC6EE755D60BA5FE98ED8B8D2360972C114DB4A17CEB5BF8EC1DE" + + "8EA0D6A4B26F40376B2C5D66657DCE4A2A2F3E519C65035E51981A6A74415AFA" + + "9BEDB27B2A6B175DAA953919580EB1ABF52D15E2CCC725AB0BE5F09864FBD0E3" + + "6EB76E8ECCA70C1A850197BA84698A00EE1AE2EB95DD79F002EC2401DF3AE3F8" + + "1C68FAD724C59E51AB60AB22C60A2E6E0CCE2E9BA5F9E2E503946CFA77CF6713" + + "E9B98253C42F3A68A6487D2CA4ADF6D0CC8A13962F5569AAE34C3500414CB363" + + "DDED7F3D3BD5BF6A0E1B229136F23362FD016595AD0F825E30BEEB9E2F95124A" + + "6033D3BF9CE8758AFD964B10437DEFD03FB28BD46D3153FACF19D6405D260B1B" + + "257B138D0BDF3AC006CE3C22D1626BE10E8613F6912536D07EBC6142D3EE8A3B" + + "9D7321D35DB2A78A1C3376894D5C2A1C3E41BD7BD8190007327505E76247C6D7" + + "3B7E78E098F4504B205D35EC50987B601F76FE6363AC0E2FDC89853CEEF2BFC1" + + "08E4CD798C20AA7B326A81736B5FDB9365B5272DDF0CB692230A5C69A37DA5A4" + + "7241213B95C44B9733700A7D4216043860C649E979E9B8C304C1C02E7981A502" + + "60233E8539A01A361FDE3B83A8B42259FCDAD89FA279CEFBA6F769C562E75E9F" + + "58FCE65C6D11A7F701161092E78DDBAD9D3FD407DDF675A46348DF53E9EF7CD5" + + "FB7CE0A3C1B7EA0138529D061CD3CE3A76FB40138ECCD2A29BED34E27E2494D2" + + "D3787326C11AAE5933BAE7FFA6F5F21D33FED6CDDCDF5CEE3C1D7A8FADCD8EB2" + + "E77A75D01A50B38E445D91A986F8D1C1100E37A9AA5E83823280236482425DEC" + + "F49EE6D898E9D8FA3E0F502B50EF968AA14220E926D1ABDD225624E81AB0DACA" + + "A781857C260B9E712F644A87D5AFE0EB3D73C9999073F3C3835473C3C4716990" + + "DD57540B5A0A2D433F3A7F6CA74D046658FF85A9AFCE68DF76ADFC9CB682F80F" + + "29F1A15257A9ABA43641C68A405A88F499ED3B29D097BBA995F1D29616CC47CD" + + "D8FAAC992A8E88D7A4E033E1D37B5DB2F38DB1E37B2A6B1A094A621BBDB70B67" + + "EB35E63425BEE4C0549D2B30FC9207FFE0BA8C3B39EC8562AB61D0A77F78CAD9" + + "D5C6227C7EDD91316D5202D6AC8CB5503F4FA01BB76A47C59FBEAEF8064709A6" + + "CC2DD5BFAF4C96535A1F699AAC58C213BC1DA0043252C5C2E2852F3B0326D428" + + "A3EB3CEB1372D65271F23935DA069CDB2E2446B26BB98EE04516548482EF7D9E" + + "2A855266521BED66156D491E7FA20D723054F55930D0E02A356659B7513CED09" + + "8666D05B6C3EC9281048F57031992620BB3F582F5963AA167BC7F8C8DB07644B" + + "8AE5984CBA7122A67275E024B3790178C8DE7F260D0D2FCB643B990FDC514F5F" + + "88B9EE89D16B20E26FBB2FE315347E972A25B6DE4DED8D69526C506004C46918" + + "13567486B8CD40E4D710069F137ED0E5EC4A493ACA9545F395935E145CB63354" + + "4D436F9FB5BDF0B154E72867FCD9A2F8675D38FAD9CBD2B1A4EC01B78C229445" + + "FD2B4232DA613A5BD9847CC2F19E624F6B1223E82F6F12CD97740E938C34FEE2" + + "54F775437183BD93D52F96C4C1ACE5ECE2D70F1C42DAA699BB76AEEA5693C7C4" + + "0B5DCB4E6D61E648E5335B06B2E0BFB55F2F338033DF38D8A2C8AD9760F0B21E" + + "8DB0DF9AF8E682E6F62F0C70A9E921FA86A7C9EFFFF2A4302F94604D1F991AA4" + + "F6B1D3B7E46BBE4126C874583281746CDEA73337A904110E94B333CB6BFFF28E" + + "1D0A0516EA5F72876614328AD34B4C1148B0930A2E303B301F300706052B0E03" + + "021A0414C1F4E43998F3594C85C97FC9C5777848189A67420414104FBC73DE62" + + "EFB93E15B5A39DE7E0C1B46E20E102022710"; + + internal const string Pkcs12Builder3DESCBCWithEmptyPassword = + "3082088E0201033082084A06092A864886F70D010701A082083B048208373082" + + "08333082082F06092A864886F70D010706A08208203082081C02010030820815" + + "06092A864886F70D0107013024060A2A864886F70D010C01033016041039A75E" + + "DA3FFCB2391E25BF504AC4BBAA02022710808207E0A9EFBDBE9CCF94EBD69A0A" + + "22DAD13EE5036E45C5A28F2C15888DE9A6E357D3A35E9C466E3101DD33B08AE3" + + "B17103506D371A69D230C1F00DE33487E0B9DE8318DB88397D13A6B8B172CB2D" + + "C57CE7D3D273878ACDEEA06F6D49D06757B7CED3F6958D98620AD7FB303D9CE7" + + "5F0B0880C9F3D2762157B946963FCA3E4C7DD3CF1BD359CA27CEDEF45613D8C4" + + "2ADD13B133997B508A53C56C1581A87C03F0A946C33226D6F40F523B7F920985" + + "470B0B5E5EDD5401C4BE78072D3333CEDF47FEBF83EEFBC7E6F9D9D02AE95384" + + "B68DF04EF7BA859B6D5AFC6FD9C918BEF427C49D5097E7645FC3BBFD9CA29EDB" + + "09F89908937E2B51FFA2F806CA0EE6E09A1CDC9F73D3E8393F1B9DE437709FF9" + + "59E4AEB2524C15269A871A4F6201D15846CA40F7F052AF72909878945894016F" + + "6BFF0B966338D371BAEE16EF7E3151FEE91F3EB6AA48E91B7580FC1ADB3456B5" + + "2382EBAB36548CA3521A583647CAEB75C50EBF485AECD50EDF6DF6B630031A5C" + + "FBDB9340C05F5F94B2622B8A0DB23B2D658D6F5733DD65328B1EDB4779D318E7" + + "CC704C7B7B78B950DEFAE77872CAE2BB1E25BA7BCAB8C04ED12F6EAF48808C79" + + "7E9C04FE4F7444A7B58D7E8A6E5445729C44E9118158C62E2760BA6D014EF026" + + "8EFD70AE83E45FC1EF05B9043C55E5AC4393508CAF2A36932ECDF77495C35036" + + "4F4C92AE4DEF9475A7F274F946EAF3347D05BF49725C86CFF72579006636F096" + + "FA49D5183100271F94C19D292DE0A7C78A8D2AA347396ACAFF36A123135FDB45" + + "604E3B829C00DF082B7010B41DBD62416315C2AC384E7D700779C592487F69F3" + + "917B391246A24F8E76258F8D3219A3A6D1313443CF78BEF667FBFDC507191625" + + "1913B729E11E895B1840635882997E5C428DB006A875E561AC0758F80F702E33" + + "DD985319B2D6BDB1EA0D403A761968494BC77CAAF4CE42B6E9124083134989A2" + + "877077CAB2F8EDFC8EC13C255022C3AF77A40A3BB5CE1B76A57DC5648234346C" + + "A072852934F310D3446CBD129858D00A64462E89E3C61D128F1C9590CE9A6284" + + "CF29EC375DB56B79F13CB404AC4320BF491472FB0FB1D530D68C82E2029C7CE1" + + "2AF38F419C163454EFFC7FE6EE590BCC3543E2B48AE9A43358E76C4B2D90AEC8" + + "CFC82BFFCCE4DEAAA23E4944C3034B4C1341FCA68246F328B65341442571FEC6" + + "F3671DA0284FF6789452C081DA021CDD3FDBAA34E82FE0C68B75321488018EBB" + + "FE787787A89058696E4F92E23211085EADF706462391F1F631CD87CAD48D72FF" + + "1EDE98CAE24DA0C776F342FECE74B1EEBCA4B8FCDEF4BC9AB952C04F79D5B235" + + "680782399746091BFC93577B863CCF499D93736CAB5500A4C45DE78FAD5E57D2" + + "E22D1A5F7C85FDEBE52F0431F980E90B44C0250079BCB09D4C2E3CCFB6E9930E" + + "B9EA497E7035FDF826600F795E3CC9EB0CE66DC84131B8EE3D55829DF48F6739" + + "0BD11F92B92D20C86B93FC9F9DDEE2C0D7DFF25275BFD25D7C2FF5BED8B4789E" + + "BC5AE940D802C0A86BC0CBE2958BC93B7D80C3272945032AC9B0FAD174A636CD" + + "68500BAB5A53A399A9630F8B523A1639A7B313F3F0517708EFD57E4E57319955" + + "48887831D86087F6D4B5180559CBC461C29327D5161518DD88E0761BF0CE05A2" + + "7FE504C84F6ACBA1C87A1284ACF18D5EE2B17B63549C35951CCC582BB8975EA7" + + "B49E7C061933B53724D25EE9F8F04F2A36B8B1F293A1A76B822C3BB0546C029B" + + "91F3FE656778236EA95B978DAF9987AD80757696DE2393149A260B5EF0C6437D" + + "DA8A63B8A486E14F42B8D1A69725CDE49E68C867B5F87D9E3CBDB4D64045C0CC" + + "50ED426A5F78CA1216AD394F3A4CD33FF6AC219AF8ED4555079511E49C288E96" + + "1165A20134EC21A5100FA597133B2B81646E245E5C94C26247112982667CE49A" + + "5633663629BC8280A4115100F2A3B4384469D3A0A7DE8D35D2FB984EE0190A0F" + + "C70CE790CF27CD3F4D261F941BEA6478CE155C5A409204F1298FCA20B1D3F095" + + "ADE129236F101BBE9D766DAFFD9D12296AAA618FE1FA8E0EB0B4D873AF67B1DC" + + "A3AC63D935952FF833621D1E7E06AE0C5749E60941D9B29D3E68968DF21E31AF" + + "DAC972B604CE613E98BBFB40BBEADA6AE85F716BD655066B1CCBEB11CB48C5A7" + + "56B4B7C96BE9DCD3DC8B74CAADC4CA7038DA00B867B35185355EB0D2C2FC76D4" + + "2842B307D92B707CB61F9BC8BF6AB1FC9EE8D0F5A8C3A1EECED5D6FB1D13A38F" + + "B2D17E0513AA4F126B5D5FC9029E574179C447D04D5A22063B60E88C48A4F52C" + + "949F49841DBF73A2F884239F18BBE35453BF67611036781876920157358303B2" + + "BF9D17473EBAD888D5A612BDE9AC41778B33F660C7C2922B654CAB899F16F017" + + "ABDE8660ABF43652ED8AB2B9177CB407E79B3B94FDD61407618B77FE980A727B" + + "BBC8B3034B0FF138C6B32B0AC9B0A851FEA1A8383EE1C571A55E0ABBD63B55BC" + + "3A5F87A3ABC9D69BFAC4FE5AFF937F536A66D9EECC8CEB491BFD3505564AA8DB" + + "0EB624817F7D6E848E505C320349697F13026A024F8D5C74E0DE9065974CD0C1" + + "D8D6D7C55C0721EFF5A960C6A44F7FCFC432998859C397C33171A3E539BB2FB3" + + "C0939BFC3D63BA3D03EF18F11CCFD4F95AB2C99AC69CCFAB692659193FF81FB6" + + "5A2A4ED12C75E2B3E12C5B76420FCB34C94CB5140AAE2F96F5CE0C6C2784CF30" + + "88F10B7DE2B2FE8F486E7A5A8858891A98DC460C51730909688BC9E1DB92DD3E" + + "B6BED869FC7D708FEA4BA6FC5DEADAF86DEBECC75A4FB0FB61FD19C05F371EBC" + + "EA880808ABAA83CE2B447F7DE021900D6777A7377FB990B85DDCFE64A36C8FD5" + + "09463C6E50BCA36EB3F8BCB00D8A415D2D0DB5AE08303B301F300706052B0E03" + + "021A0414A57105D833610A6D07EBFBE51E5486CD3F8BCE0D0414DB32290CC077" + + "37E9D9446E37F104FA876C861C0102022710"; + + // Used for chain building tests (CN=Test chain building) + internal static readonly byte[] SelfSignedCertSha256RsaBytes = ( + "308202BD308201A5A003020102020900EF79C10DFD657168300D06092A864886F70D0101" + + "0B0500301E311C301A060355040313135465737420636861696E206275696C64696E6730" + + "1E170D3231313031333231353735335A170D3232313031333231353735335A301E311C30" + + "1A060355040313135465737420636861696E206275696C64696E6730820122300D06092A" + + "864886F70D01010105000382010F003082010A0282010100E3B5BBF862313DEAA9172788" + + "278B26A3EAB61B9B0326F5CEA91B1A6C6DFD156836A2363BFAC5B0F4A78F4CFF5A11F35A" + + "831C6D7935D1DFD13DD81DA29AA0645CBA9F4D20BF991C625E6D61CF396C15914DEE41F6" + + "1190E97B52BFF7AE52B79FD0E2EEE3319EC23C30D27A52A2E8A963557B12BEC0664ADEF9" + + "3C520B587EC5DABFBC70980DB7473414B4B6BF982EA9AA0969F2A76AA085464AE78DFB2B" + + "F04BDE7192874679193119C2AABEC04D360F61925921660BF09A0489B7C53464F5FC35B8" + + "612F5B993D544475C20AC46CD350A34551FEA0ACBD138D8B72F79052BF0EB3BD794A426C" + + "0117CB77B4F311FFD1C628F8E438E5474509AD51FA035558771546310203010001300D06" + + "092A864886F70D01010B050003820101000A12CE2FC3DC854113D179725E9D9ADD013A42" + + "D66340CEA7A465D54EC357AD8FED1828862D8B5C32EB3D21FC8B26A7CFA9D9FB36F593CC" + + "6AD30C25C96E8100C3F07B1B51430245EE995864749C53B409260B4040705654710C236F" + + "D9B7DE3F3BE5E6E5047712C5E506419106A57C5290BB206A97F6A3FCC4B4C83E25C3FC6D" + + "2BAB03B941374086265EE08A90A8C72A63A4053044B9FA3ABD5ED5785CFDDB15A6A327BD" + + "C0CC2B115B9D33BD6E528E35670E5A6A8D9CF52199F8D693315C60D9ADAD54EF7FDCED36" + + "0C8C79E84D42AB5CB6355A70951B1ABF1F2B3FB8BEB7E3A8D6BA2293C0DB8C86B0BB060F" + + "0D6DB9939E88B998662A27F092634BBF21F58EEAAA").HexToByteArray(); + + // This is nearly identical to the cert in Pkcs7SelfSignedCertSha256RsaBytes, + // but we've replaced the OID (1.2.840.113549.1.1.11 sha256RSA) with a dummy OID + // 1.3.9999.1234.5678.1234. The cert should load properly into an X509Certificate2 + // object but will cause chain building to fail. + internal static readonly byte[] SelfSignedCertDummyOidBytes = ( + "308202BD308201A5A003020102020900EF79C10DFD657168300D06092A864886F70D0101" + + "0B0500301E311C301A060355040313135465737420636861696E206275696C64696E6730" + + "1E170D3231313031333231353735335A170D3232313031333231353735335A301E311C30" + + "1A060355040313135465737420636861696E206275696C64696E6730820122300D06092A" + + "864886F70D01010105000382010F003082010A0282010100E3B5BBF862313DEAA9172788" + + "278B26A3EAB61B9B0326F5CEA91B1A6C6DFD156836A2363BFAC5B0F4A78F4CFF5A11F35A" + + "831C6D7935D1DFD13DD81DA29AA0645CBA9F4D20BF991C625E6D61CF396C15914DEE41F6" + + "1190E97B52BFF7AE52B79FD0E2EEE3319EC23C30D27A52A2E8A963557B12BEC0664ADEF9" + + "3C520B587EC5DABFBC70980DB7473414B4B6BF982EA9AA0969F2A76AA085464AE78DFB2B" + + "F04BDE7192874679193119C2AABEC04D360F61925921660BF09A0489B7C53464F5FC35B8" + + "612F5B993D544475C20AC46CD350A34551FEA0ACBD138D8B72F79052BF0EB3BD794A426C" + + "0117CB77B4F311FFD1C628F8E438E5474509AD51FA035558771546310203010001300D06" + + "092BCE0F8952AC2E8952050003820101000A12CE2FC3DC854113D179725E9D9ADD013A42" + + "D66340CEA7A465D54EC357AD8FED1828862D8B5C32EB3D21FC8B26A7CFA9D9FB36F593CC" + + "6AD30C25C96E8100C3F07B1B51430245EE995864749C53B409260B4040705654710C236F" + + "D9B7DE3F3BE5E6E5047712C5E506419106A57C5290BB206A97F6A3FCC4B4C83E25C3FC6D" + + "2BAB03B941374086265EE08A90A8C72A63A4053044B9FA3ABD5ED5785CFDDB15A6A327BD" + + "C0CC2B115B9D33BD6E528E35670E5A6A8D9CF52199F8D693315C60D9ADAD54EF7FDCED36" + + "0C8C79E84D42AB5CB6355A70951B1ABF1F2B3FB8BEB7E3A8D6BA2293C0DB8C86B0BB060F" + + "0D6DB9939E88B998662A27F092634BBF21F58EEAAA").HexToByteArray(); + + internal static readonly byte[] EmptyPkcs7 = "300B06092A864886F70D010702".HexToByteArray(); } } diff --git a/src/libraries/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj b/src/libraries/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj index dca38dde22bf8b..b59549e50afa2c 100644 --- a/src/libraries/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj +++ b/src/libraries/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/libraries/System.Security.Cryptography.Xml/src/CompatibilitySuppressions.xml b/src/libraries/System.Security.Cryptography.Xml/src/CompatibilitySuppressions.xml index 174055d48008ee..dd6795c03dbeae 100644 --- a/src/libraries/System.Security.Cryptography.Xml/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Security.Cryptography.Xml/src/CompatibilitySuppressions.xml @@ -1,7 +1,44 @@ - + + + CP0002 + F:System.Security.Cryptography.Xml.SignedXml.XmlDsigSHA256Url + lib/netstandard2.0/System.Security.Cryptography.Xml.dll + lib/net461/System.Security.Cryptography.Xml.dll + + + CP0002 + F:System.Security.Cryptography.Xml.SignedXml.XmlDsigRSASHA256Url + lib/netstandard2.0/System.Security.Cryptography.Xml.dll + lib/net461/System.Security.Cryptography.Xml.dll + + + CP0002 + F:System.Security.Cryptography.Xml.SignedXml.XmlDsigSHA384Url + lib/netstandard2.0/System.Security.Cryptography.Xml.dll + lib/net461/System.Security.Cryptography.Xml.dll + + + CP0002 + F:System.Security.Cryptography.Xml.SignedXml.XmlDsigRSASHA384Url + lib/netstandard2.0/System.Security.Cryptography.Xml.dll + lib/net461/System.Security.Cryptography.Xml.dll + + + CP0002 + F:System.Security.Cryptography.Xml.SignedXml.XmlDsigSHA512Url + lib/netstandard2.0/System.Security.Cryptography.Xml.dll + lib/net461/System.Security.Cryptography.Xml.dll + + + CP0002 + F:System.Security.Cryptography.Xml.SignedXml.XmlDsigRSASHA512Url + lib/netstandard2.0/System.Security.Cryptography.Xml.dll + lib/net461/System.Security.Cryptography.Xml.dll + CP0001 + T:System.Security.Cryptography.Xml.CryptoSignedXmlRecursionException lib/netstandard2.0/System.Security.Cryptography.Xml.dll lib/net461/System.Security.Cryptography.Xml.dll diff --git a/src/libraries/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj b/src/libraries/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj index 2417c752edc4b7..82c9d7a307cc8f 100644 --- a/src/libraries/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj +++ b/src/libraries/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj @@ -1,8 +1,11 @@ true - $(NetCoreAppCurrent);netstandard2.0;net461 + $(NetCoreAppCurrent);netstandard2.0;net461-windows true + + false + 1 Provides classes to support the creation and validation of XML digital signatures. The classes in this namespace implement the World Wide Web Consortium Recommendation, "XML-Signature Syntax and Processing", described at http://www.w3.org/TR/xmldsig-core/. Commonly Used Types: @@ -121,6 +124,7 @@ System.Security.Cryptography.Xml.XmlLicenseTransform + @@ -131,7 +135,7 @@ System.Security.Cryptography.Xml.XmlLicenseTransform Link="Common\System\HexConverter.cs" /> - + @@ -143,7 +147,6 @@ System.Security.Cryptography.Xml.XmlLicenseTransform - diff --git a/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlSecureResolver.cs b/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlSecureResolver.cs new file mode 100644 index 00000000000000..5b1e5919202322 --- /dev/null +++ b/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlSecureResolver.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Xml; + +namespace System.Security.Cryptography.Xml +{ + // This type masks out System.Xml.XmlSecureResolver by being in the local namespace. + internal sealed class XmlSecureResolver : XmlResolver + { + internal XmlSecureResolver(XmlResolver resolver, string securityUrl) + { + } + + // Simulate .NET Framework's CAS behavior by throwing SecurityException. + // Unlike .NET Framework's implementation, the securityUrl ctor parameter has no effect. + public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn) => + throw new SecurityException(); + } +} diff --git a/src/libraries/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs b/src/libraries/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs index c85f82b12ec9ce..89c3c8e907ac2e 100644 --- a/src/libraries/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs +++ b/src/libraries/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs @@ -11,8 +11,11 @@ using System.Globalization; using System.IO; +using System.Net; using System.Security.Cryptography.X509Certificates; using System.Text; +using System.Threading; +using System.Threading.Tasks; using System.Xml; using System.Xml.XPath; using Test.Cryptography; @@ -1588,6 +1591,129 @@ public void VerifyHMAC_HMACOutputLength_Invalid() Assert.Throws(() => sign.CheckSignature(new HMACSHA1(Encoding.ASCII.GetBytes("no clue")))); } + [Theory] + [InlineData(false)] + [InlineData(true)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] + public void VerifyXmlResolver(bool provideResolver) + { + HttpListener listener; + int port = 9000; + + while (true) + { + listener = new HttpListener(); + listener.Prefixes.Add($"http://127.0.0.1:{port}/"); + listener.IgnoreWriteExceptions = true; + + try + { + listener.Start(); + break; + } + catch + { + } + + port++; + + if (port > 10000) + { + throw new InvalidOperationException("Could not find an open port"); + } + } + + string xml = $@"]> +Example doc to be signed.&xxe; + + + + + + + + + CLUSJx4H4EwydAT/CtNWYu/l6R8uZe0tO2rlM/o0iM4= + + + o0IAVyovNUYKs5CCIRpZVy6noLpdJBp8LwWrqzzhKPg= + +"; + + bool listenerContacted = false; + CancellationTokenSource tokenSource = new CancellationTokenSource(); + Task listenerTask = ProcessRequests(listener, req => listenerContacted = true, tokenSource.Token); + + XmlDocument doc = new XmlDocument(); + doc.LoadXml(xml); + + SignedXml signedXml = new SignedXml(doc); + signedXml.LoadXml((XmlElement)doc.GetElementsByTagName("Signature")[0]); + + try + { + using (HMAC key = new HMACSHA256(Encoding.UTF8.GetBytes("sample"))) + { + if (provideResolver) + { + signedXml.Resolver = new XmlUrlResolver(); + Assert.True(signedXml.CheckSignature(key), "signedXml.CheckSignature(key)"); + Assert.True(listenerContacted, "listenerContacted"); + } + else + { + XmlException ex = Assert.Throws(() => signedXml.CheckSignature(key)); + Assert.IsType(ex.InnerException); + Assert.False(listenerContacted, "listenerContacted"); + } + } + } + finally + { + tokenSource.Cancel(); + + try + { + listener.Stop(); + } + catch + { + } + + ((IDisposable)listener).Dispose(); + } + + static async Task ProcessRequests( + HttpListener listener, + Action requestReceived, + CancellationToken cancellationToken) + { + while (!cancellationToken.IsCancellationRequested) + { + HttpListenerContext ctx; + + try + { + ctx = await listener.GetContextAsync(); + } + catch + { + break; + } + + HttpListenerRequest req = ctx.Request; + requestReceived(req); + + using (HttpListenerResponse resp = ctx.Response) + { + resp.ContentType = "text/plain"; + resp.ContentEncoding = Encoding.UTF8; + resp.ContentLength64 = 0; + } + } + } + } + [Fact] public void CoreFxSignedXmlUsesSha256ByDefault() { diff --git a/src/libraries/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj b/src/libraries/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj index cd32ff9c8c4e14..c219bf3e947640 100644 --- a/src/libraries/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj @@ -1,6 +1,6 @@ - $(NetCoreAppCurrent);net461 + $(NetCoreAppCurrent);net461-windows GetSymmetricAlgorithms(bool private static readonly byte[] SampleDsaPfx = Convert.FromBase64String( // [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Suppression approved. Unit test dummy certificate.")] "MIIF+QIBAzCCBb8GCSqGSIb3DQEHAaCCBbAEggWsMIIFqDCCA9cGCSqGSIb3DQEH" + - "BqCCA8gwggPEAgEAMIIDvQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQMwDgQIbzDq" + - "jr8PwpMCAggAgIIDkJrcDboxMkMgEusycJ0w7QdbskZ7SBvnziqhQ0e2DohHjhrm" + - "p19VRk8nyw0TuHgIVK39KhFbGrfOLWxAE2xvnDVOeWWMLcxDn2zoxPdM202HvXVB" + - "SFE0zAmVOVHD7NMa0pcXeCblqpihGnVgSW5RYHc3hJFaXkBmLe/GLX7rNl+LCXzb" + - "cScJfYw0CMqZHYnpcCG3M6n6aAUb79madtN7UHuVtyaCjStaPfcAUGetlacT79cV" + - "qR57yPG+5Rpb38d5oOE/Jeh/wzB/L2QOq6LWxeWHiXMmXlOJ8xCK64YvfASoIpiQ" + - "xTqtgY2SKA0bOqUcerr4945MAdjR93qLeaEOQAeR+EweSYgasGWyi5ZwDh5ul3bJ" + - "SX2OdK9IkdBnktekbnPvo1necVuN6OjLKLlXyyDLn5KEVTjsAUonLk1nXZ/aL3ZH" + - "iTHWEUB0HyvRN9sQB3Y49ggp6DwLSmKfiglPYMj95k1tAOpi/MD9LnfpTV5ur3q0" + - "sqgIgQgMctaHIUV6vVQ2Ngu8dmOObUgqgDR5Us3Hf1u71Lu2AJBGRoDm7V1hhbgv" + - "Ob4oRlJUdgssi79id5IHog1nnO7VDxxtkKujzUUbSBnrAnxc27/lNQ9jwmUYZnHH" + - "xg9lEI2HNK/3k6FZd6Tiy8hzNN1+fo8hNkwjorsnNPd/nWbVeM/Oti5jEiVoeMfV" + - "/uw1/cGj6KaTvCe3h/xgX9y0/sWZ7WqILXZ+3vAouemvmBRe531IWA1djz//hgSI" + - "VOK+OprshAeU0Pce7qXMbMlOD7CUKBDecn0L7xxWW8sg8ZWgwqZuJEcOjvUKezgK" + - "URivBV1lavevLYyLsBO8W0qLiOLYYOgQkavkz42DYvkDeCJfeE2DuY6tqRr7xBJ5" + - "qGxDWGZ4+oBZYmXkMa63A/VC/EF6ZSVooLxI8QsobyPaB7spKv+YP+LjQgJ7F7dR" + - "3YXxKivW0QuZ2cAkfWpy8CaTGUhucaay8dqBEm7i3aAXSUzWMOayYu2xieu9+2Gl" + - "UuBlr2ic63si37rYemztVcIfSg2Rrtb/ggLT5a22LYBH109LosbR1kMfk7r9Eaz+" + - "TSH3TBaKoN7L56en1I56CvikEmzCbXW9N9bih9+HL7IgHcBN0c/TLkcvTvj2Xm4l" + - "cKpITTGg+KBS7BRNT8DA9Zqpa9aPIaNMrhPPTWEPRYyiMwhFwJw+Of3YLUwmlkhf" + - "gCVpngUFmnJE19pydjCCAckGCSqGSIb3DQEHAaCCAboEggG2MIIBsjCCAa4GCyqG" + - "SIb3DQEMCgECoIIBdjCCAXIwHAYKKoZIhvcNAQwBAzAOBAjknYMUAVMMGwICCAAE" + - "ggFQ4yI0v5ZS62IfP9l1I3llZ1l8SyW8r0F6v/BXBYitXKHoCsK4WbDl6Z4enb/0" + - "DZ8/RyepbiD1S9bqJ5ICXaFEKaBpVSvkVK1EWJF6pM9qx9VzECxVMTFxewdg2UwB" + - "2JkuUAD4tXxmjwp0LQpgJdKHpq7cH0SdoEdNzTsypZnaPBXUIDHS+NfiqPScueqv" + - "W2MoIg8egHIM4qnwLy0/hSc0iMfOgAPVbDktnoq7wzPVG8L+esS84/bABOl9o/e9" + - "Cq8OjK1aVBNMLnktdt0e4I3K7yQFgEJTkq8PpHmpnesv8l7Lvjd9Mri9W8eHilOp" + - "ZICybwoK3A0APG1lswubo0ii/56+MA3DnE0irn1rn6bkpOMGJ8JZBeuGzbV14ah/" + - "4l4MMPjnIf3Cu6TGd2/YLnPdr5fE6vyJtVa1sBpawIAK7cDUJ+OOD8gs1uoMfOML" + - "k5VpMSUwIwYJKoZIhvcNAQkVMRYEFDdYxa4ZJsCeAQZDzHLZ+cdpC2z5MDEwITAJ" + - "BgUrDgMCGgUABBTv022RKjlx16b3xrtvZELrNDdQIAQIaYfksM5jcN8CAggA"); + "BqCCA8gwggPEAgEAMIIDvQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQMwDgQIOSCt" + + "zaujK/MCAggAgIIDkEQdcESXtxlkTEwicjcfUahzjrHb8uWLi4AAGKqrchbiUJsj" + + "cAwATdijQhwffUAmQ7+i52P46MViik+aKDw2Otb0Tu5+MzUEQiV+x7ZCzgAinxkE" + + "TlH3Njk6Hfccy+TtITzFwaNXyJMIQS6LdZ1XweV0FdFXCfo9eN2OVM6JrUNhhH6h" + + "io2aujcedtM0iNIaNujgYcRALDVwnozCPj8eeUqlo0vftMPmbAN/y4lIFLj/cXbr" + + "2pSU0QOcB/i/7eMWN12H+E4jA/IXw8sPT0ADKERaDNcRTzeLRTyMTPuuySOiDHkk" + + "t7g8fQ6BXUtVw44TnK/es1BgNZRJvAiNJXrG228anPEXcVM4hiMQ6+/tHyDUaPBm" + + "TZ+bVI0ZD/14VxDicS7KjE7/4aHWY3DHCmtZAS5u4LXOjwEip82gRXcvyuhszbtU" + + "xc9lSptUriraKYj80bTHC4iK+1GJI+qo4cZiuH+qARXez1aT9IjyVlRog/uacrHx" + + "ycbl2fvo81VUyCPmUph93Zr9PWvKmO4BmW3mQeJVqgTZrHfQpkY+SelcyaheniMu" + + "+pdOwmoYWqE2bOg9uSPhlvh+duDBmOr4X+m1YDLb/3sRQcbhDFPANAlss39lLzpl" + + "QS/emRTuiyRpMixl3XHbGz1GF5nJo1OwEysWb5EbaV5w+FM5JzUqc8JAegBcp0Zf" + + "G3uTaC4Wc9Q3703jqV1bhGQK3clR2/O+p6fKwr/POOT/qFxws8o85QEGOYn5GFtz" + + "57gRxpXWWmpsm5QFu6LTWQ4kyMJ4m3CzU54ULjuaFTP63nRLDDCk5iQOvADP4UhH" + + "nfKNI5w7UMQEULTQeLPLz4bsbY0CfsVISaKtqrmyQQHB38YDEs5kdx+Xy6oNSVVh" + + "eIkW2ktgJiSgC8jsjXFDUKsj9rsk8xcCu41YZoWSEs1+lOo7qyReZZQl5AOzxHaZ" + + "3AGXQg8vzbPkUG6oRJLKTcncewUglCI9hMIN3JbgBnmQj0Vdtr4ou6qaxT96hrFJ" + + "mGKTqrOimKUOc0pAsQraIRfVbiezFFH0/fjgJuek+mwPpWIR0/jmye+uTK6kF1uX" + + "cQIIETfZHblJ7GmXm83uk/6hieM+47JhN4dEMfTnoqtilu5QR+NAXnVhmEKJp2Dx" + + "OLSKQ41uHxdguLHgaKMKXR1RYwnSsLrX0TXKDefX38dAxs0rdkTZb4wfT1y8JYhJ" + + "NWJGksBCZnOf9pL5IzCCAckGCSqGSIb3DQEHAaCCAboEggG2MIIBsjCCAa4GCyqG" + + "SIb3DQEMCgECoIIBdjCCAXIwHAYKKoZIhvcNAQwBAzAOBAiE35N4ijeQpwICCAAE" + + "ggFQ27yZqvji6lI03S0HBGRfGukbymgoKKV4k+dMaVt3cd+KGPzQMcwUjuNQiR32" + + "CzoElYvqaHo4KIhDukElLUxHQ+0ti5yaIabCRF2FRMtswhEVVRFvi0YZiBz7jzge" + + "Z0nqDtEKoDFBvbb34yVk51gDaNn2Is5AFBGZKY+Tas4qzJbe2ELbEosXBDk0Jvv6" + + "X13gDJfk67/J/8AE8IH2FY7/XDoG6luOxDG4Ebe68Qm+TY85vGiDMelvAaWyxGeY" + + "xndylDVyQSUGFoJHfvA4AgwaukR1rqc9/IZ/eJgz2ptMPZq2p+hsB1/IYaKzud1/" + + "QYpYtCkBfsT1DSRwvmJ6CingwEIL+NwrcdaD0F3C55BWzXRzbRE8XR754qq77gSv" + + "xk6gRR0kcO175AFeTDqwjmPPylaQ/okiSQ9a4yRFxHUnxigNRgD7tcVR6LuKGDBE" + + "v02cMSUwIwYJKoZIhvcNAQkVMRYEFDdYxa4ZJsCeAQZDzHLZ+cdpC2z5MDEwITAJ" + + "BgUrDgMCGgUABBS0CMJuJYzpHkxOFI+r0PA67eJbzQQI4yGr4jgshqECAggA"); public static X509Certificate2 GetSampleX509Certificate() { @@ -232,7 +232,7 @@ public static X509Certificate2 GetSampleX509Certificate() public static X509Certificate2 GetSampleDSAX509Certificate() { - return new X509Certificate2(SampleDsaPfx, "velleity"); + return new X509Certificate2(SampleDsaPfx, "PLACEHOLDER"); } public static Stream LoadResourceStream(string resourceName) diff --git a/src/libraries/System.Security.Permissions/ref/System.Security.Permissions.Forwards.cs b/src/libraries/System.Security.Permissions/ref/System.Security.Permissions.Forwards.cs index ef7cb3ac3f7348..4d9a824761f533 100644 --- a/src/libraries/System.Security.Permissions/ref/System.Security.Permissions.Forwards.cs +++ b/src/libraries/System.Security.Permissions/ref/System.Security.Permissions.Forwards.cs @@ -13,10 +13,8 @@ [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.SecurityAttribute))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.SecurityPermissionAttribute))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.SecurityPermissionFlag))] -#if NET6_0_OR_GREATER [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Policy.Evidence))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Policy.EvidenceBase))] -#endif #if NETCOREAPP [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.IStackWalk))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.PermissionSet))] diff --git a/src/libraries/System.Security.Permissions/ref/System.Security.Permissions.csproj b/src/libraries/System.Security.Permissions/ref/System.Security.Permissions.csproj index 8c77b3223cb0c7..23b70b96d36aab 100644 --- a/src/libraries/System.Security.Permissions/ref/System.Security.Permissions.csproj +++ b/src/libraries/System.Security.Permissions/ref/System.Security.Permissions.csproj @@ -6,7 +6,6 @@ - @@ -19,17 +18,14 @@ - - - - + + - diff --git a/src/libraries/System.Security.Permissions/src/CompatibilitySuppressions.xml b/src/libraries/System.Security.Permissions/src/CompatibilitySuppressions.xml index 40fce05b9e31bb..43191ba6888bed 100644 --- a/src/libraries/System.Security.Permissions/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Security.Permissions/src/CompatibilitySuppressions.xml @@ -1,47 +1,86 @@  - CP0001 + CP0002 + M:System.Security.Permissions.KeyContainerPermissionAccessEntryCollection.CopyTo(System.Array,System.Int32) + lib/netstandard2.0/System.Security.Permissions.dll + lib/net461/System.Security.Permissions.dll + + + CP0002 + M:System.Security.Permissions.KeyContainerPermissionAccessEntryCollection.#ctor + lib/netstandard2.0/System.Security.Permissions.dll + lib/net461/System.Security.Permissions.dll + + + CP0002 + M:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator.#ctor lib/netstandard2.0/System.Security.Permissions.dll lib/net461/System.Security.Permissions.dll CP0001 T:System.Security.Policy.Evidence - lib/net5.0/System.Security.Permissions.dll - lib/net6.0/System.Security.Permissions.dll + ref/net5.0/System.Security.Permissions.dll + lib/net5.0/System.Security.Permissions.dll + true CP0001 T:System.Security.Policy.EvidenceBase - lib/net5.0/System.Security.Permissions.dll - lib/net6.0/System.Security.Permissions.dll + ref/net5.0/System.Security.Permissions.dll + lib/net5.0/System.Security.Permissions.dll + true CP0001 - T:System.Security.IStackWalk - lib/netstandard2.0/System.Security.Permissions.dll - lib/netcoreapp3.1/System.Security.Permissions.dll + T:System.Xaml.Permissions.XamlLoadPermission + ref/netcoreapp3.0/System.Security.Permissions.dll + lib/netstandard2.0/System.Security.Permissions.dll + true CP0001 - T:System.Security.PermissionSet - lib/netstandard2.0/System.Security.Permissions.dll - lib/netcoreapp3.1/System.Security.Permissions.dll + T:System.Security.Policy.Evidence + ref/netcoreapp3.0/System.Security.Permissions.dll + lib/netstandard2.0/System.Security.Permissions.dll + true CP0001 - T:System.Security.Permissions.PermissionState - lib/netstandard2.0/System.Security.Permissions.dll - lib/netcoreapp3.1/System.Security.Permissions.dll + T:System.Security.Policy.EvidenceBase + ref/netcoreapp3.0/System.Security.Permissions.dll + lib/netstandard2.0/System.Security.Permissions.dll + true CP0001 - T:System.Xaml.Permissions.XamlLoadPermission - ref/netcoreapp3.0/System.Security.Permissions.dll + T:System.Security.Policy.Evidence + ref/netstandard2.0/System.Security.Permissions.dll + lib/netstandard2.0/System.Security.Permissions.dll + true + + + CP0001 + T:System.Security.Policy.EvidenceBase + ref/netstandard2.0/System.Security.Permissions.dll lib/netstandard2.0/System.Security.Permissions.dll true + + CP0001 + T:System.Security.Policy.Evidence + lib/net5.0/System.Security.Permissions.dll + lib/net5.0/System.Security.Permissions.dll + true + + + CP0001 + T:System.Security.Policy.EvidenceBase + lib/net5.0/System.Security.Permissions.dll + lib/net5.0/System.Security.Permissions.dll + true + CP0001 T:System.Xaml.Permissions.XamlLoadPermission @@ -50,9 +89,31 @@ true - CP0008 - T:System.Security.NamedPermissionSet + CP0001 + T:System.Security.Policy.Evidence + lib/netcoreapp3.0/System.Security.Permissions.dll + lib/netstandard2.0/System.Security.Permissions.dll + true + + + CP0001 + T:System.Security.Policy.EvidenceBase + lib/netcoreapp3.0/System.Security.Permissions.dll + lib/netstandard2.0/System.Security.Permissions.dll + true + + + CP0001 + T:System.Security.Policy.Evidence lib/netstandard2.0/System.Security.Permissions.dll - lib/netcoreapp3.1/System.Security.Permissions.dll + lib/netstandard2.0/System.Security.Permissions.dll + true + + + CP0001 + T:System.Security.Policy.EvidenceBase + lib/netstandard2.0/System.Security.Permissions.dll + lib/netstandard2.0/System.Security.Permissions.dll + true \ No newline at end of file diff --git a/src/libraries/System.Security.Permissions/src/System.Security.Permissions.csproj b/src/libraries/System.Security.Permissions/src/System.Security.Permissions.csproj index 19be1eaf34dd8d..852a69c96d2aae 100644 --- a/src/libraries/System.Security.Permissions/src/System.Security.Permissions.csproj +++ b/src/libraries/System.Security.Permissions/src/System.Security.Permissions.csproj @@ -1,11 +1,14 @@ true - $(NetCoreAppCurrent);net5.0;netcoreapp3.1;netstandard2.0;net461 + $(NetCoreAppCurrent);net5.0;netcoreapp3.1;netstandard2.0;net461-windows true + + false + 0 Provides types supporting Code Access Security (CAS). - + @@ -132,8 +135,6 @@ - - @@ -191,8 +192,8 @@ - - + + @@ -204,7 +205,6 @@ - diff --git a/src/libraries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs b/src/libraries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs index 868afcc8c1a4f5..0a7c1745ed9f42 100644 --- a/src/libraries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs +++ b/src/libraries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs @@ -26,7 +26,7 @@ public WindowsIdentityImpersonatedTests(WindowsIdentityFixture windowsIdentityFi Assert.False(string.IsNullOrEmpty(_fixture.TestAccount.AccountName)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] [OuterLoop] public async Task RunImpersonatedAsync_TaskAndTaskOfT() { @@ -60,7 +60,7 @@ void Asserts(WindowsIdentity currentWindowsIdentity) } } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] [OuterLoop] public void RunImpersonated_NameResolution() { @@ -78,12 +78,15 @@ public void RunImpersonated_NameResolution() }); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] [OuterLoop] public async Task RunImpersonatedAsync_NameResolution() { WindowsIdentity currentWindowsIdentity = WindowsIdentity.GetCurrent(); + // make sure the assembly is loaded. + _ = Dns.GetHostAddresses(""); + await WindowsIdentity.RunImpersonatedAsync(_fixture.TestAccount.AccountTokenHandle, async () => { Assert.Equal(_fixture.TestAccount.AccountName, WindowsIdentity.GetCurrent().Name); @@ -96,129 +99,3 @@ await WindowsIdentity.RunImpersonatedAsync(_fixture.TestAccount.AccountTokenHand }); } } - -public class WindowsIdentityFixture : IDisposable -{ - public WindowsTestAccount TestAccount { get; private set; } - - public WindowsIdentityFixture() - { - TestAccount = new WindowsTestAccount("CorFxTstWiIde01kiu"); - } - - public void Dispose() - { - TestAccount.Dispose(); - } -} - -public sealed class WindowsTestAccount : IDisposable -{ - private readonly string _userName; - private SafeAccessTokenHandle _accountTokenHandle; - public SafeAccessTokenHandle AccountTokenHandle => _accountTokenHandle; - public string AccountName { get; private set; } - - public WindowsTestAccount(string userName) - { - _userName = userName; - CreateUser(); - } - - private void CreateUser() - { - string testAccountPassword; - using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) - { - byte[] randomBytes = new byte[33]; - rng.GetBytes(randomBytes); - - // Add special chars to ensure it satisfies password requirements. - testAccountPassword = Convert.ToBase64String(randomBytes) + "_-As@!%*(1)4#2"; - - USER_INFO_1 userInfo = new USER_INFO_1 - { - usri1_name = _userName, - usri1_password = testAccountPassword, - usri1_priv = 1 - }; - - // Create user and remove/create if already exists - uint result = NetUserAdd(null, 1, ref userInfo, out uint param_err); - - // error codes https://docs.microsoft.com/en-us/windows/desktop/netmgmt/network-management-error-codes - // 0 == NERR_Success - if (result == 2224) // NERR_UserExists - { - result = NetUserDel(null, userInfo.usri1_name); - if (result != 0) - { - throw new Win32Exception((int)result); - } - result = NetUserAdd(null, 1, ref userInfo, out param_err); - if (result != 0) - { - throw new Win32Exception((int)result); - } - } - - const int LOGON32_PROVIDER_DEFAULT = 0; - const int LOGON32_LOGON_INTERACTIVE = 2; - - if (!LogonUser(_userName, ".", testAccountPassword, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, out _accountTokenHandle)) - { - _accountTokenHandle = null; - throw new Exception($"Failed to get SafeAccessTokenHandle for test account {_userName}", new Win32Exception()); - } - - bool gotRef = false; - try - { - _accountTokenHandle.DangerousAddRef(ref gotRef); - IntPtr logonToken = _accountTokenHandle.DangerousGetHandle(); - AccountName = new WindowsIdentity(logonToken).Name; - } - finally - { - if (gotRef) - _accountTokenHandle.DangerousRelease(); - } - } - } - - [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - private static extern bool LogonUser(string userName, string domain, string password, int logonType, int logonProvider, out SafeAccessTokenHandle safeAccessTokenHandle); - - [DllImport("netapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern uint NetUserAdd([MarshalAs(UnmanagedType.LPWStr)]string servername, uint level, ref USER_INFO_1 buf, out uint parm_err); - - [DllImport("netapi32.dll")] - internal static extern uint NetUserDel([MarshalAs(UnmanagedType.LPWStr)]string servername, [MarshalAs(UnmanagedType.LPWStr)]string username); - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal struct USER_INFO_1 - { - public string usri1_name; - public string usri1_password; - public uint usri1_password_age; - public uint usri1_priv; - public string usri1_home_dir; - public string usri1_comment; - public uint usri1_flags; - public string usri1_script_path; - } - - public void Dispose() - { - _accountTokenHandle?.Dispose(); - - uint result = NetUserDel(null, _userName); - - // 2221= NERR_UserNotFound - if (result != 0 && result != 2221) - { - throw new Win32Exception((int)result); - } - } -} - diff --git a/src/libraries/System.ServiceModel.Syndication/src/CompatibilitySuppressions.xml b/src/libraries/System.ServiceModel.Syndication/src/CompatibilitySuppressions.xml index 5cdd695b8805e5..8e2822b21ebb27 100644 --- a/src/libraries/System.ServiceModel.Syndication/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.ServiceModel.Syndication/src/CompatibilitySuppressions.xml @@ -1,7 +1,104 @@ - + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeed.get_Documentation + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeed.set_Documentation(System.ServiceModel.Syndication.SyndicationLink) + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeed.get_TimeToLive + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeed.set_TimeToLive(System.Nullable{System.TimeSpan}) + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeed.get_SkipHours + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeed.get_SkipDays + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeed.get_TextInput + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeed.set_TextInput(System.ServiceModel.Syndication.SyndicationTextInput) + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeedFormatter.get_UriParser + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeedFormatter.set_UriParser(System.ServiceModel.Syndication.TryParseUriCallback) + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeedFormatter.get_DateTimeParser + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0002 + M:System.ServiceModel.Syndication.SyndicationFeedFormatter.set_DateTimeParser(System.ServiceModel.Syndication.TryParseDateTimeCallback) + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0001 + T:System.ServiceModel.Syndication.TryParseDateTimeCallback + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0001 + T:System.ServiceModel.Syndication.TryParseUriCallback + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0001 + T:System.ServiceModel.Syndication.SyndicationTextInput + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + + + CP0001 + T:System.ServiceModel.Syndication.XmlDateTimeData + lib/netstandard2.0/System.ServiceModel.Syndication.dll + lib/net461/System.ServiceModel.Syndication.dll + CP0001 + T:System.ServiceModel.Syndication.XmlUriData lib/netstandard2.0/System.ServiceModel.Syndication.dll lib/net461/System.ServiceModel.Syndication.dll diff --git a/src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj b/src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj index 8adc81696720e9..247c9402fd91f7 100644 --- a/src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj +++ b/src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj @@ -3,6 +3,9 @@ $(NetCoreAppCurrent);netcoreapp3.1;netstandard2.0;net461 true true + + false + 0 Provides classes related to service model syndication. diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System.ServiceModel.Syndication.Tests.csproj b/src/libraries/System.ServiceModel.Syndication/tests/System.ServiceModel.Syndication.Tests.csproj index 037fe58d8b95c3..368d45236e1617 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System.ServiceModel.Syndication.Tests.csproj +++ b/src/libraries/System.ServiceModel.Syndication/tests/System.ServiceModel.Syndication.Tests.csproj @@ -1,6 +1,6 @@ - $(NetCoreAppCurrent);net461-windows + $(NetCoreAppCurrent);net461 diff --git a/src/libraries/System.ServiceProcess.ServiceController/src/CompatibilitySuppressions.xml b/src/libraries/System.ServiceProcess.ServiceController/src/CompatibilitySuppressions.xml index d26132f552badf..b8d2693f9cf6c9 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.ServiceProcess.ServiceController/src/CompatibilitySuppressions.xml @@ -1,10 +1,5 @@ - + - - CP0001 - lib/netstandard2.0/System.ServiceProcess.ServiceController.dll - lib/net461/System.ServiceProcess.ServiceController.dll - PKV006 .NETStandard,Version=v1.4 diff --git a/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj b/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj index 7a3f433ead3074..0402a8aae9cd3a 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj +++ b/src/libraries/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj @@ -5,6 +5,9 @@ $(NoWarn);CA2249 enable true + + false + 1 Provides the System.ServiceProcess.ServiceContainer class, which allows you to connect to a running or stopped service, manipulate it, or get information about it. Commonly Used Types: diff --git a/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs b/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs index c8dcaa55b8936c..782c228a4bb8ea 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs +++ b/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs @@ -31,6 +31,7 @@ public class ServiceBase : Component private bool _commandPropsFrozen; // set to true once we've use the Can... properties. private bool _disposed; private bool _initialized; + private object _stopLock = new object(); private EventLog? _eventLog; /// @@ -505,27 +506,34 @@ private void DeferredSessionChange(int eventType, int sessionId) // This is a problem when multiple services are hosted in a single process. private unsafe void DeferredStop() { - fixed (SERVICE_STATUS* pStatus = &_status) + lock (_stopLock) { - int previousState = _status.currentState; - - _status.checkPoint = 0; - _status.waitHint = 0; - _status.currentState = ServiceControlStatus.STATE_STOP_PENDING; - SetServiceStatus(_statusHandle, pStatus); - try + // never call SetServiceStatus again after STATE_STOPPED is set. + if (_status.currentState != ServiceControlStatus.STATE_STOPPED) { - OnStop(); - WriteLogEntry(SR.StopSuccessful); - _status.currentState = ServiceControlStatus.STATE_STOPPED; - SetServiceStatus(_statusHandle, pStatus); - } - catch (Exception e) - { - _status.currentState = previousState; - SetServiceStatus(_statusHandle, pStatus); - WriteLogEntry(SR.Format(SR.StopFailed, e), EventLogEntryType.Error); - throw; + fixed (SERVICE_STATUS* pStatus = &_status) + { + int previousState = _status.currentState; + + _status.checkPoint = 0; + _status.waitHint = 0; + _status.currentState = ServiceControlStatus.STATE_STOP_PENDING; + SetServiceStatus(_statusHandle, pStatus); + try + { + OnStop(); + WriteLogEntry(SR.StopSuccessful); + _status.currentState = ServiceControlStatus.STATE_STOPPED; + SetServiceStatus(_statusHandle, pStatus); + } + catch (Exception e) + { + _status.currentState = previousState; + SetServiceStatus(_statusHandle, pStatus); + WriteLogEntry(SR.Format(SR.StopFailed, e), EventLogEntryType.Error); + throw; + } + } } } } @@ -537,14 +545,17 @@ private unsafe void DeferredShutdown() OnShutdown(); WriteLogEntry(SR.ShutdownOK); - if (_status.currentState == ServiceControlStatus.STATE_PAUSED || _status.currentState == ServiceControlStatus.STATE_RUNNING) + lock (_stopLock) { - fixed (SERVICE_STATUS* pStatus = &_status) + if (_status.currentState == ServiceControlStatus.STATE_PAUSED || _status.currentState == ServiceControlStatus.STATE_RUNNING) { - _status.checkPoint = 0; - _status.waitHint = 0; - _status.currentState = ServiceControlStatus.STATE_STOPPED; - SetServiceStatus(_statusHandle, pStatus); + fixed (SERVICE_STATUS* pStatus = &_status) + { + _status.checkPoint = 0; + _status.waitHint = 0; + _status.currentState = ServiceControlStatus.STATE_STOPPED; + SetServiceStatus(_statusHandle, pStatus); + } } } } @@ -672,7 +683,7 @@ private void Initialize(bool multipleServices) { if (!_initialized) { - //Cannot register the service with NT service manatger if the object has been disposed, since finalization has been suppressed. + //Cannot register the service with NT service manager if the object has been disposed, since finalization has been suppressed. if (_disposed) throw new ObjectDisposedException(GetType().Name); @@ -935,8 +946,14 @@ public unsafe void ServiceMainCallback(int argCount, IntPtr argPointer) if (!statusOK) { WriteLogEntry(SR.Format(SR.StartFailed, new Win32Exception().Message), EventLogEntryType.Error); - _status.currentState = ServiceControlStatus.STATE_STOPPED; - SetServiceStatus(_statusHandle, pStatus); + lock (_stopLock) + { + if (_status.currentState != ServiceControlStatus.STATE_STOPPED) + { + _status.currentState = ServiceControlStatus.STATE_STOPPED; + SetServiceStatus(_statusHandle, pStatus); + } + } } } } diff --git a/src/libraries/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.csproj b/src/libraries/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.csproj index 8886ffe02e9c85..a0300f8a838e9d 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.csproj +++ b/src/libraries/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.csproj @@ -2,7 +2,7 @@ true Exe - $(NetCoreAppCurrent);net461 + $(NetCoreAppCurrent);net461-windows annotations @@ -40,4 +40,7 @@ + + + \ No newline at end of file diff --git a/src/libraries/System.Speech/Directory.Build.props b/src/libraries/System.Speech/Directory.Build.props index db2f816d5af405..d43c87c09cb684 100644 --- a/src/libraries/System.Speech/Directory.Build.props +++ b/src/libraries/System.Speech/Directory.Build.props @@ -1,10 +1,6 @@  - - 4.0.0.0 MicrosoftShared windows diff --git a/src/libraries/System.Speech/Directory.Build.targets b/src/libraries/System.Speech/Directory.Build.targets new file mode 100644 index 00000000000000..e8aeeb47a8da9c --- /dev/null +++ b/src/libraries/System.Speech/Directory.Build.targets @@ -0,0 +1,8 @@ + + + + + 4.0.0.0 + + diff --git a/src/libraries/System.Speech/src/System.Speech.csproj b/src/libraries/System.Speech/src/System.Speech.csproj index 6d6dc95987327e..435df81fe91fdd 100644 --- a/src/libraries/System.Speech/src/System.Speech.csproj +++ b/src/libraries/System.Speech/src/System.Speech.csproj @@ -7,6 +7,9 @@ $(NoWarn);CS0649;SA1129;CA1847 false true + + false + 0 true true Provides types to perform speech synthesis and speech recognition. diff --git a/src/libraries/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj b/src/libraries/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj index 635eb8239901a5..28ed126161f263 100644 --- a/src/libraries/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj +++ b/src/libraries/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj @@ -5,6 +5,9 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0-windows;netstandard2.0;net461-windows true true + + false + 0 true Provides support for code-page based encodings, including Windows-1252, Shift-JIS, and GB2312. diff --git a/src/libraries/System.Text.Json/Common/JsonConstants.cs b/src/libraries/System.Text.Json/Common/JsonConstants.cs index a97b11cf15bf2d..0d121d9c6ffbc8 100644 --- a/src/libraries/System.Text.Json/Common/JsonConstants.cs +++ b/src/libraries/System.Text.Json/Common/JsonConstants.cs @@ -7,5 +7,9 @@ internal static partial class JsonConstants { // The maximum number of parameters a constructor can have where it can be supported by the serializer. public const int MaxParameterCount = 64; + + // Standard format for double and single on non-inbox frameworks. + public const string DoubleFormatString = "G17"; + public const string SingleFormatString = "G9"; } } diff --git a/src/libraries/System.Text.Json/Common/JsonSourceGenerationOptionsAttribute.cs b/src/libraries/System.Text.Json/Common/JsonSourceGenerationOptionsAttribute.cs index 84ffc3d5414b34..45f11a41063ccb 100644 --- a/src/libraries/System.Text.Json/Common/JsonSourceGenerationOptionsAttribute.cs +++ b/src/libraries/System.Text.Json/Common/JsonSourceGenerationOptionsAttribute.cs @@ -30,11 +30,6 @@ sealed class JsonSourceGenerationOptionsAttribute : JsonAttribute /// public bool IgnoreReadOnlyProperties { get; set; } - /// - /// Specifies whether to ignore custom converters provided at run time. - /// - public bool IgnoreRuntimeCustomConverters { get; set; } - /// /// Specifies whether to include fields for serialization and deserialization. /// diff --git a/src/libraries/System.Text.Json/Common/ReflectionExtensions.cs b/src/libraries/System.Text.Json/Common/ReflectionExtensions.cs index 8a1a58a97a2cba..09ecc45077fe06 100644 --- a/src/libraries/System.Text.Json/Common/ReflectionExtensions.cs +++ b/src/libraries/System.Text.Json/Common/ReflectionExtensions.cs @@ -310,5 +310,18 @@ public static bool TryGetDeserializationConstructor( deserializationCtor = ctorWithAttribute ?? publicParameterlessCtor ?? lonePublicCtor; return true; } + + public static object? GetDefaultValue(this ParameterInfo parameterInfo) + { + object? defaultValue = parameterInfo.DefaultValue; + + // DBNull.Value is sometimes used as the default value (returned by reflection) of nullable params in place of null. + if (defaultValue == DBNull.Value && parameterInfo.ParameterType != typeof(DBNull)) + { + return null; + } + + return defaultValue; + } } } diff --git a/src/libraries/System.Text.Json/System.Text.Json.sln b/src/libraries/System.Text.Json/System.Text.Json.sln index b8309363a7b30a..5c21cd8805632e 100644 --- a/src/libraries/System.Text.Json/System.Text.Json.sln +++ b/src/libraries/System.Text.Json/System.Text.Json.sln @@ -21,7 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.CompilerServ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", "..\System.Text.Encodings.Web\src\System.Text.Encodings.Web.csproj", "{9BCCDA15-8907-4AE3-8871-2F17775DDE4C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration", "gen\System.Text.Json.SourceGeneration.csproj", "{6485EED4-C313-4551-9865-8ADCED603629}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration.Roslyn4.0", "gen\System.Text.Json.SourceGeneration.Roslyn4.0.csproj", "{6485EED4-C313-4551-9865-8ADCED603629}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "ref\System.Text.Json.csproj", "{7015E94D-D20D-48C8-86D7-6A996BE99E0E}" EndProject @@ -29,7 +29,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json", "src\Sys EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "System.Text.Json.FSharp.Tests", "tests\System.Text.Json.FSharp.Tests\System.Text.Json.FSharp.Tests.fsproj", "{5720BF06-2031-4AD8-B9B4-31A01E27ABB8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration.Tests", "tests\System.Text.Json.SourceGeneration.Tests\System.Text.Json.SourceGeneration.Tests.csproj", "{33599A6C-F340-4E1B-9B4D-CB8946C22140}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration.Roslyn4.0.Tests", "tests\System.Text.Json.SourceGeneration.Tests\System.Text.Json.SourceGeneration.Roslyn4.0.Tests.csproj", "{33599A6C-F340-4E1B-9B4D-CB8946C22140}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests", "tests\System.Text.Json.SourceGeneration.Unit.Tests\System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests.csproj", "{F6A18EB5-A8CC-4A39-9E85-5FA226019C3D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.Tests", "tests\System.Text.Json.Tests\System.Text.Json.Tests.csproj", "{A0178BAA-A1AF-4C69-8E4A-A700A2723DDC}" EndProject @@ -43,7 +45,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Encodings.Web", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Collections.Immutable", "..\System.Collections.Immutable\ref\System.Collections.Immutable.csproj", "{BE27618A-2916-4269-9AD5-6BC5EDC32B30}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Text.Json.SourceGeneration.UnitTests", "tests\System.Text.Json.SourceGeneration.UnitTests\System.Text.Json.SourceGeneration.UnitTests.csproj", "{F6A18EB5-A8CC-4A39-9E85-5FA226019C3D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration.Roslyn3.11", "gen\System.Text.Json.SourceGeneration.Roslyn3.11.csproj", "{04AEB008-EE4F-44DE-A361-2DBD2D0FD6A4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests", "tests\System.Text.Json.SourceGeneration.Unit.Tests\System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests.csproj", "{256A4653-4287-44B3-BDEF-67FC1522ED2F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Text.Json.SourceGeneration.Roslyn3.11.Tests", "tests\System.Text.Json.SourceGeneration.Tests\System.Text.Json.SourceGeneration.Roslyn3.11.Tests.csproj", "{66AD4B7E-CF15-4A8F-8BF8-7E1BC6176D07}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -123,6 +129,18 @@ Global {F6A18EB5-A8CC-4A39-9E85-5FA226019C3D}.Debug|Any CPU.Build.0 = Debug|Any CPU {F6A18EB5-A8CC-4A39-9E85-5FA226019C3D}.Release|Any CPU.ActiveCfg = Release|Any CPU {F6A18EB5-A8CC-4A39-9E85-5FA226019C3D}.Release|Any CPU.Build.0 = Release|Any CPU + {04AEB008-EE4F-44DE-A361-2DBD2D0FD6A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04AEB008-EE4F-44DE-A361-2DBD2D0FD6A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04AEB008-EE4F-44DE-A361-2DBD2D0FD6A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04AEB008-EE4F-44DE-A361-2DBD2D0FD6A4}.Release|Any CPU.Build.0 = Release|Any CPU + {256A4653-4287-44B3-BDEF-67FC1522ED2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {256A4653-4287-44B3-BDEF-67FC1522ED2F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {256A4653-4287-44B3-BDEF-67FC1522ED2F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {256A4653-4287-44B3-BDEF-67FC1522ED2F}.Release|Any CPU.Build.0 = Release|Any CPU + {66AD4B7E-CF15-4A8F-8BF8-7E1BC6176D07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66AD4B7E-CF15-4A8F-8BF8-7E1BC6176D07}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66AD4B7E-CF15-4A8F-8BF8-7E1BC6176D07}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66AD4B7E-CF15-4A8F-8BF8-7E1BC6176D07}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -131,11 +149,13 @@ Global {102945CA-3736-4B2C-8E68-242A0B247F2B} = {E07C6980-EB71-4D19-A80A-7BEB80B635B1} {73D5739C-E382-4E22-A7D3-B82705C58C74} = {0371C5D8-D5F5-4747-9810-D91D71D8C0E4} {E9AA0AEB-AEAE-4B28-8D4D-17A6D7C89D17} = {E49881A9-09F6-442F-9E1D-6D87F5F837F1} + {BE27618A-2916-4269-9AD5-6BC5EDC32B30} = {0371C5D8-D5F5-4747-9810-D91D71D8C0E4} {1C8262DB-7355-40A8-A2EC-4EED7363134A} = {E49881A9-09F6-442F-9E1D-6D87F5F837F1} {4774F56D-16A8-4ABB-8C73-5F57609F1773} = {0371C5D8-D5F5-4747-9810-D91D71D8C0E4} {D05FD93A-BC51-466E-BD56-3F3D6BBE6B06} = {E49881A9-09F6-442F-9E1D-6D87F5F837F1} {E2077991-EB83-471C-B17F-72F569FFCE6D} = {0371C5D8-D5F5-4747-9810-D91D71D8C0E4} {7909EB27-0D6E-46E6-B9F9-8A1EFD557018} = {E49881A9-09F6-442F-9E1D-6D87F5F837F1} + {C56337BB-8CBC-4EE5-AB4D-8BB0A922813E} = {0371C5D8-D5F5-4747-9810-D91D71D8C0E4} {9BCCDA15-8907-4AE3-8871-2F17775DDE4C} = {E49881A9-09F6-442F-9E1D-6D87F5F837F1} {6485EED4-C313-4551-9865-8ADCED603629} = {E49881A9-09F6-442F-9E1D-6D87F5F837F1} {7015E94D-D20D-48C8-86D7-6A996BE99E0E} = {0371C5D8-D5F5-4747-9810-D91D71D8C0E4} @@ -146,6 +166,10 @@ Global {C56337BB-8CBC-4EE5-AB4D-8BB0A922813E} = {0371C5D8-D5F5-4747-9810-D91D71D8C0E4} {BE27618A-2916-4269-9AD5-6BC5EDC32B30} = {0371C5D8-D5F5-4747-9810-D91D71D8C0E4} {F6A18EB5-A8CC-4A39-9E85-5FA226019C3D} = {E07C6980-EB71-4D19-A80A-7BEB80B635B1} + {A0178BAA-A1AF-4C69-8E4A-A700A2723DDC} = {E07C6980-EB71-4D19-A80A-7BEB80B635B1} + {04AEB008-EE4F-44DE-A361-2DBD2D0FD6A4} = {E49881A9-09F6-442F-9E1D-6D87F5F837F1} + {256A4653-4287-44B3-BDEF-67FC1522ED2F} = {E07C6980-EB71-4D19-A80A-7BEB80B635B1} + {66AD4B7E-CF15-4A8F-8BF8-7E1BC6176D07} = {E07C6980-EB71-4D19-A80A-7BEB80B635B1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {5868B757-D821-41FC-952E-2113A0519506} diff --git a/src/libraries/System.Text.Json/gen/ClassType.cs b/src/libraries/System.Text.Json/gen/ClassType.cs index d0df94330ec8e0..80029b5792d4ff 100644 --- a/src/libraries/System.Text.Json/gen/ClassType.cs +++ b/src/libraries/System.Text.Json/gen/ClassType.cs @@ -9,13 +9,20 @@ namespace System.Text.Json.SourceGeneration { internal enum ClassType { + /// + /// Types that are not supported yet by source gen including types with constructor parameters. + /// TypeUnsupportedBySourceGen = 0, Object = 1, KnownType = 2, - TypeWithDesignTimeProvidedCustomConverter = 3, - Enumerable = 4, - Dictionary = 5, - Nullable = 6, - Enum = 7 + /// + /// Known types such as System.Type and System.IntPtr that throw NotSupportedException. + /// + KnownUnsupportedType = 3, + TypeWithDesignTimeProvidedCustomConverter = 4, + Enumerable = 5, + Dictionary = 6, + Nullable = 7, + Enum = 8 } } diff --git a/src/libraries/System.Text.Json/gen/ContextGenerationSpec.cs b/src/libraries/System.Text.Json/gen/ContextGenerationSpec.cs index 545d5628297b81..b88bd918672004 100644 --- a/src/libraries/System.Text.Json/gen/ContextGenerationSpec.cs +++ b/src/libraries/System.Text.Json/gen/ContextGenerationSpec.cs @@ -5,6 +5,7 @@ using System.Text.Json.Serialization; using System.Text.Json.Reflection; using System.Diagnostics; +using Microsoft.CodeAnalysis; namespace System.Text.Json.SourceGeneration { @@ -15,6 +16,8 @@ namespace System.Text.Json.SourceGeneration [DebuggerDisplay("ContextTypeRef={ContextTypeRef}")] internal sealed class ContextGenerationSpec { + public Location Location { get; init; } + public JsonSourceGenerationOptionsAttribute GenerationOptions { get; init; } public Type ContextType { get; init; } @@ -32,9 +35,11 @@ internal sealed class ContextGenerationSpec public HashSet TypesWithMetadataGenerated { get; } = new(); /// - /// Cache of runtime property names (statically determined) found accross the object graph of the JsonSerializerContext. + /// Cache of runtime property names (statically determined) found across the object graph of the JsonSerializerContext. + /// The dictionary Key is the JSON property name, and the Value is the variable name which is the same as the property + /// name except for cases where special characters are used with [JsonPropertyName]. /// - public HashSet RuntimePropertyNames { get; } = new(); + public Dictionary RuntimePropertyNames { get; } = new(); public string ContextTypeRef => ContextType.GetCompilableName(); } diff --git a/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.ExceptionMessages.cs b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.ExceptionMessages.cs new file mode 100644 index 00000000000000..faa8529cfd73b8 --- /dev/null +++ b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.ExceptionMessages.cs @@ -0,0 +1,36 @@ +// 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.Text; + +namespace System.Text.Json.SourceGeneration +{ + public sealed partial class JsonSourceGenerator + { + private sealed partial class Emitter + { + /// + /// Unlike sourcegen warnings, exception messages should not be localized so we keep them in source. + /// + private static class ExceptionMessages + { + public const string InaccessibleJsonIncludePropertiesNotSupported = + "The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator."; + + public const string IncompatibleConverterType = + "The converter '{0}' is not compatible with the type '{1}'."; + + public const string InitOnlyPropertyDeserializationNotSupported = + "Deserialization of init-only properties is currently not supported in source generation mode."; + + public const string InvalidJsonConverterFactoryOutput = + "The converter '{0}' cannot return null or a JsonConverterFactory instance."; + + public const string InvalidSerializablePropertyConfiguration = + "Invalid serializable-property configuration specified for type '{0}'. For more information, see 'JsonSourceGenerationMode.Serialization'."; + }; + } + } +} diff --git a/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs index 75d8cdd978171c..0df820dcecf22e 100644 --- a/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs +++ b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs @@ -4,11 +4,14 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Globalization; using System.Reflection; +using System.Reflection.Metadata; using System.Text.Json; using System.Text.Json.Reflection; using System.Text.Json.Serialization; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Text; namespace System.Text.Json.SourceGeneration @@ -18,17 +21,24 @@ public sealed partial class JsonSourceGenerator private sealed partial class Emitter { // Literals in generated source - private const string RuntimeCustomConverterFetchingMethodName = "GetRuntimeProvidedCustomConverter"; - private const string OptionsInstanceVariableName = "Options"; - private const string PropInitMethodNameSuffix = "PropInit"; - private const string CtorParamInitMethodNameSuffix = "CtorParamInit"; - private const string SerializeMethodNameSuffix = "Serialize"; private const string CreateValueInfoMethodName = "CreateValueInfo"; + private const string CtorParamInitMethodNameSuffix = "CtorParamInit"; private const string DefaultOptionsStaticVarName = "s_defaultOptions"; private const string DefaultContextBackingStaticVarName = "s_defaultContext"; - private const string WriterVarName = "writer"; - private const string ValueVarName = "value"; + private const string ElementInfoPropName = "ElementInfo"; + internal const string GetConverterFromFactoryMethodName = "GetConverterFromFactory"; + private const string InfoVarName = "info"; private const string JsonSerializerContextName = "JsonSerializerContext"; + internal const string JsonContextVarName = "jsonContext"; + private const string KeyInfoPropName = "KeyInfo"; + private const string NumberHandlingPropName = "NumberHandling"; + private const string ObjectCreatorPropName = "ObjectCreator"; + private const string OptionsInstanceVariableName = "Options"; + private const string PropInitMethodNameSuffix = "PropInit"; + private const string RuntimeCustomConverterFetchingMethodName = "GetRuntimeProvidedCustomConverter"; + private const string SerializeHandlerPropName = "SerializeHandler"; + private const string ValueVarName = "value"; + private const string WriterVarName = "writer"; private static AssemblyName _assemblyName = typeof(Emitter).Assembly.GetName(); private static readonly string s_generatedCodeAttributeSource = $@" @@ -45,7 +55,6 @@ private sealed partial class Emitter private const string IListTypeRef = "global::System.Collections.Generic.IList"; private const string KeyValuePairTypeRef = "global::System.Collections.Generic.KeyValuePair"; private const string ListTypeRef = "global::System.Collections.Generic.List"; - private const string DictionaryTypeRef = "global::System.Collections.Generic.Dictionary"; private const string JsonEncodedTextTypeRef = "global::System.Text.Json.JsonEncodedText"; private const string JsonNamingPolicyTypeRef = "global::System.Text.Json.JsonNamingPolicy"; private const string JsonSerializerTypeRef = "global::System.Text.Json.JsonSerializer"; @@ -53,6 +62,7 @@ private sealed partial class Emitter private const string Utf8JsonWriterTypeRef = "global::System.Text.Json.Utf8JsonWriter"; private const string JsonConverterTypeRef = "global::System.Text.Json.Serialization.JsonConverter"; private const string JsonConverterFactoryTypeRef = "global::System.Text.Json.Serialization.JsonConverterFactory"; + private const string JsonCollectionInfoValuesTypeRef = "global::System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues"; private const string JsonIgnoreConditionTypeRef = "global::System.Text.Json.Serialization.JsonIgnoreCondition"; private const string JsonNumberHandlingTypeRef = "global::System.Text.Json.Serialization.JsonNumberHandling"; private const string JsonSerializerContextTypeRef = "global::System.Text.Json.Serialization.JsonSerializerContext"; @@ -60,7 +70,9 @@ private sealed partial class Emitter private const string JsonObjectInfoValuesTypeRef = "global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues"; private const string JsonParameterInfoValuesTypeRef = "global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues"; private const string JsonPropertyInfoTypeRef = "global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo"; + private const string JsonPropertyInfoValuesTypeRef = "global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues"; private const string JsonTypeInfoTypeRef = "global::System.Text.Json.Serialization.Metadata.JsonTypeInfo"; + private const string NotSupportedExceptionTypeRef = "global::System.NotSupportedException"; private static DiagnosticDescriptor TypeNotSupported { get; } = new DiagnosticDescriptor( id: "SYSLIB1030", @@ -78,15 +90,20 @@ private sealed partial class Emitter defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true); - private readonly GeneratorExecutionContext _executionContext; + private readonly JsonSourceGenerationContext _sourceGenerationContext; private ContextGenerationSpec _currentContext = null!; - private readonly SourceGenerationSpec _generationSpec = null!; + private readonly SourceGenerationSpec _generationSpec; - public Emitter(in GeneratorExecutionContext executionContext, SourceGenerationSpec generationSpec) + private readonly HashSet _emittedPropertyFileNames = new(); + + private bool _generateGetConverterMethodForTypes = false; + private bool _generateGetConverterMethodForProperties = false; + + public Emitter(in JsonSourceGenerationContext sourceGenerationContext, SourceGenerationSpec generationSpec) { - _executionContext = executionContext; + _sourceGenerationContext = sourceGenerationContext; _generationSpec = generationSpec; } @@ -95,6 +112,8 @@ public void Emit() foreach (ContextGenerationSpec contextGenerationSpec in _generationSpec.ContextGenerationSpecList) { _currentContext = contextGenerationSpec; + _generateGetConverterMethodForTypes = false; + _generateGetConverterMethodForProperties = false; foreach (TypeGenerationSpec typeGenerationSpec in _currentContext.RootSerializableTypes) { @@ -104,7 +123,10 @@ public void Emit() string contextName = _currentContext.ContextType.Name; // Add root context implementation. - AddSource($"{contextName}.g.cs", GetRootJsonContextImplementation(), isRootContextDef: true); + AddSource( + $"{contextName}.g.cs", + GetRootJsonContextImplementation(), + isRootContextDef: true); // Add GetJsonTypeInfo override implementation. AddSource($"{contextName}.GetJsonTypeInfo.g.cs", GetGetTypeInfoImplementation()); @@ -126,7 +148,10 @@ private void AddSource(string fileName, string source, bool isRootContextDef = f bool isInGlobalNamespace = @namespace == JsonConstants.GlobalNamespaceValue; StringBuilder sb = new(@"// -#nullable enable"); +#nullable enable + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0618"); if (!isInGlobalNamespace) { @@ -165,7 +190,7 @@ namespace {@namespace} sb.AppendLine("}"); } - _executionContext.AddSource(fileName, SourceText.From(sb.ToString(), Encoding.UTF8)); + _sourceGenerationContext.AddSource(fileName, SourceText.From(sb.ToString(), Encoding.UTF8)); } private void GenerateTypeInfo(TypeGenerationSpec typeGenerationSpec) @@ -238,12 +263,24 @@ private void GenerateTypeInfo(TypeGenerationSpec typeGenerationSpec) GenerateTypeInfo(spec.TypeGenerationSpec); } } + + TypeGenerationSpec? extPropTypeSpec = typeGenerationSpec.ExtensionDataPropertyTypeSpec; + if (extPropTypeSpec != null) + { + GenerateTypeInfo(extPropTypeSpec); + } + } + break; + case ClassType.KnownUnsupportedType: + { + source = GenerateForUnsupportedType(typeGenerationSpec); } break; case ClassType.TypeUnsupportedBySourceGen: { - _executionContext.ReportDiagnostic( - Diagnostic.Create(TypeNotSupported, Location.None, new string[] { typeGenerationSpec.TypeRef })); + Location location = typeGenerationSpec.Type.GetDiagnosticLocation() ?? typeGenerationSpec.AttributeLocation ?? _currentContext.Location; + _sourceGenerationContext.ReportDiagnostic( + Diagnostic.Create(TypeNotSupported, location, new string[] { typeGenerationSpec.TypeRef })); return; } default: @@ -252,14 +289,21 @@ private void GenerateTypeInfo(TypeGenerationSpec typeGenerationSpec) } } - try + // Don't add a duplicate file, but instead raise a diagnostic to say the duplicate has been skipped. + // Workaround https://github.com/dotnet/roslyn/issues/54185 by keeping track of the file names we've used. + string propertyFileName = $"{_currentContext.ContextType.Name}.{typeGenerationSpec.TypeInfoPropertyName}.g.cs"; + if (_emittedPropertyFileNames.Add(propertyFileName)) { - AddSource($"{_currentContext.ContextType.Name}.{typeGenerationSpec.TypeInfoPropertyName}.g.cs", source); + AddSource(propertyFileName, source); } - catch (ArgumentException) + else { - _executionContext.ReportDiagnostic(Diagnostic.Create(DuplicateTypeName, Location.None, new string[] { typeGenerationSpec.TypeInfoPropertyName })); + Location location = typeGenerationSpec.AttributeLocation ?? _currentContext.Location; + _sourceGenerationContext.ReportDiagnostic(Diagnostic.Create(DuplicateTypeName, location, new string[] { typeGenerationSpec.TypeInfoPropertyName })); } + + _generateGetConverterMethodForTypes |= typeGenerationSpec.HasTypeFactoryConverter; + _generateGetConverterMethodForProperties |= typeGenerationSpec.HasPropertyFactoryConverters; } private string GenerateForTypeWithKnownConverter(TypeGenerationSpec typeMetadata) @@ -277,40 +321,42 @@ private string GenerateForTypeWithUnknownConverter(TypeGenerationSpec typeMetada string typeCompilableName = typeMetadata.TypeRef; string typeFriendlyName = typeMetadata.TypeInfoPropertyName; - StringBuilder sb = new(); - // TODO (https://github.com/dotnet/runtime/issues/52218): consider moving this verification source to common helper. - string metadataInitSource = $@"{JsonConverterTypeRef} converter = {typeMetadata.ConverterInstantiationLogic}; - {TypeTypeRef} typeToConvert = typeof({typeCompilableName}); - if (!converter.CanConvert(typeToConvert)) - {{ - {TypeTypeRef}? underlyingType = {NullableTypeRef}.GetUnderlyingType(typeToConvert); - if (underlyingType != null && converter.CanConvert(underlyingType)) - {{ - {JsonConverterTypeRef}? actualConverter = converter; + StringBuilder metadataInitSource = new( + $@"{JsonConverterTypeRef} converter = {typeMetadata.ConverterInstantiationLogic}; + {TypeTypeRef} typeToConvert = typeof({typeCompilableName});"); - if (converter is {JsonConverterFactoryTypeRef} converterFactory) + if (typeMetadata.IsValueType) + { + metadataInitSource.Append($@" + if (!converter.CanConvert(typeToConvert)) + {{ + {TypeTypeRef}? underlyingType = {NullableTypeRef}.GetUnderlyingType(typeToConvert); + if (underlyingType != null && converter.CanConvert(underlyingType)) {{ - actualConverter = converterFactory.CreateConverter(underlyingType, {OptionsInstanceVariableName}); - - if (actualConverter == null || actualConverter is {JsonConverterFactoryTypeRef}) - {{ - throw new {InvalidOperationExceptionTypeRef}($""JsonConverterFactory '{{converter}} cannot return a 'null' or 'JsonConverterFactory' value.""); - }} + // Allow nullable handling to forward to the underlying type's converter. + converter = {JsonMetadataServicesTypeRef}.GetNullableConverter<{typeCompilableName}>(this.{typeFriendlyName})!; + converter = (({ JsonConverterFactoryTypeRef })converter).CreateConverter(typeToConvert, { OptionsInstanceVariableName })!; }} - - // Allow nullable handling to forward to the underlying type's converter. - converter = {JsonMetadataServicesTypeRef}.GetNullableConverter<{typeCompilableName}>(this.{typeFriendlyName}); - }} - else + else + {{ + throw new {InvalidOperationExceptionTypeRef}(string.Format(""{ExceptionMessages.IncompatibleConverterType}"", converter.GetType(), typeToConvert)); + }} + }}"); + } + else + { + metadataInitSource.Append($@" + if (!converter.CanConvert(typeToConvert)) {{ - throw new {InvalidOperationExceptionTypeRef}($""The converter '{{converter.GetType()}}' is not compatible with the type '{{typeToConvert}}'.""); - }} - }} + throw new {InvalidOperationExceptionTypeRef}(string.Format(""{ExceptionMessages.IncompatibleConverterType}"", converter.GetType(), typeToConvert)); + }}"); + } - _{typeFriendlyName} = {JsonMetadataServicesTypeRef}.{GetCreateValueInfoMethodRef(typeCompilableName)}({OptionsInstanceVariableName}, converter);"; + metadataInitSource.Append($@" + _{typeFriendlyName} = { JsonMetadataServicesTypeRef }.{ GetCreateValueInfoMethodRef(typeCompilableName)} ({ OptionsInstanceVariableName}, converter); "); - return GenerateForType(typeMetadata, metadataInitSource); + return GenerateForType(typeMetadata, metadataInitSource.ToString()); } private string GenerateForNullable(TypeGenerationSpec typeMetadata) @@ -334,6 +380,16 @@ private string GenerateForNullable(TypeGenerationSpec typeMetadata) return GenerateForType(typeMetadata, metadataInitSource); } + private string GenerateForUnsupportedType(TypeGenerationSpec typeMetadata) + { + string typeCompilableName = typeMetadata.TypeRef; + string typeFriendlyName = typeMetadata.TypeInfoPropertyName; + + string metadataInitSource = $"_{typeFriendlyName} = {JsonMetadataServicesTypeRef}.{GetCreateValueInfoMethodRef(typeCompilableName)}({OptionsInstanceVariableName}, {JsonMetadataServicesTypeRef}.GetUnsupportedTypeConverter<{typeCompilableName}>());"; + + return GenerateForType(typeMetadata, metadataInitSource); + } + private string GenerateForEnum(TypeGenerationSpec typeMetadata) { string typeCompilableName = typeMetadata.TypeRef; @@ -376,29 +432,38 @@ private string GenerateForCollection(TypeGenerationSpec typeGenerationSpec) string numberHandlingArg = $"{GetNumberHandlingAsStr(typeGenerationSpec.NumberHandling)}"; - string serializeFuncNamedArg; + string serializeHandlerValue; - string? serializeFuncSource; + string? serializeHandlerSource; if (!typeGenerationSpec.GenerateSerializationLogic) { - serializeFuncSource = null; - serializeFuncNamedArg = "serializeFunc: null"; + serializeHandlerSource = null; + serializeHandlerValue = "null"; } else { - serializeFuncSource = typeGenerationSpec.ClassType == ClassType.Enumerable + serializeHandlerSource = typeGenerationSpec.ClassType == ClassType.Enumerable ? GenerateFastPathFuncForEnumerable(typeGenerationSpec) : GenerateFastPathFuncForDictionary(typeGenerationSpec); - serializeFuncNamedArg = $"serializeFunc: {typeGenerationSpec.FastPathSerializeMethodName}"; + serializeHandlerValue = $"{typeGenerationSpec.TypeInfoPropertyName}{SerializeHandlerPropName}"; } CollectionType collectionType = typeGenerationSpec.CollectionType; string typeRef = typeGenerationSpec.TypeRef; - string createObjectFuncArg = typeGenerationSpec.ConstructionStrategy == ObjectConstructionStrategy.ParameterlessConstructor - ? $"createObjectFunc: () => new {typeRef}()" - : "createObjectFunc: null"; + + string objectCreatorValue; + if (typeGenerationSpec.RuntimeTypeRef != null) + { + objectCreatorValue = $"() => new {typeGenerationSpec.RuntimeTypeRef}()"; + } + else + { + objectCreatorValue = typeGenerationSpec.ConstructionStrategy == ObjectConstructionStrategy.ParameterlessConstructor + ? $"() => new {typeRef}()" + : "null"; + } string collectionInfoCreationPrefix = collectionType switch { @@ -406,15 +471,15 @@ private string GenerateForCollection(TypeGenerationSpec typeGenerationSpec) CollectionType.ICollectionOfT => $"{JsonMetadataServicesTypeRef}.CreateICollectionInfo<", CollectionType.StackOfT => $"{JsonMetadataServicesTypeRef}.CreateStackInfo<", CollectionType.QueueOfT => $"{JsonMetadataServicesTypeRef}.CreateQueueInfo<", - CollectionType.Stack => $"{JsonMetadataServicesTypeRef}.CreateStackOrQueueInfo<", - CollectionType.Queue => $"{JsonMetadataServicesTypeRef}.CreateStackOrQueueInfo<", + CollectionType.Stack => $"{JsonMetadataServicesTypeRef}.CreateStackInfo<", + CollectionType.Queue => $"{JsonMetadataServicesTypeRef}.CreateQueueInfo<", CollectionType.IEnumerableOfT => $"{JsonMetadataServicesTypeRef}.CreateIEnumerableInfo<", CollectionType.IDictionaryOfTKeyTValue => $"{JsonMetadataServicesTypeRef}.CreateIDictionaryInfo<", _ => $"{JsonMetadataServicesTypeRef}.Create{collectionType}Info<" }; - string dictInfoCreationPrefix = $"{collectionInfoCreationPrefix}{typeRef}, {keyTypeCompilableName!}, {valueTypeCompilableName}>({OptionsInstanceVariableName}, {createObjectFuncArg}, {keyTypeMetadataPropertyName!}, {valueTypeMetadataPropertyName}, {numberHandlingArg}, {serializeFuncNamedArg}"; - string enumerableInfoCreationPrefix = $"{collectionInfoCreationPrefix}{typeRef}, {valueTypeCompilableName}>({OptionsInstanceVariableName}, {createObjectFuncArg}, {valueTypeMetadataPropertyName}, {numberHandlingArg}, {serializeFuncNamedArg}"; + string dictInfoCreationPrefix = $"{collectionInfoCreationPrefix}{typeRef}, {keyTypeCompilableName!}, {valueTypeCompilableName}>({OptionsInstanceVariableName}, {InfoVarName}"; + string enumerableInfoCreationPrefix = $"{collectionInfoCreationPrefix}{typeRef}, {valueTypeCompilableName}>({OptionsInstanceVariableName}, {InfoVarName}"; string immutableCollectionCreationSuffix = $"createRangeFunc: {typeGenerationSpec.ImmutableCollectionBuilderName}"; string collectionTypeInfoValue; @@ -422,23 +487,23 @@ private string GenerateForCollection(TypeGenerationSpec typeGenerationSpec) switch (collectionType) { case CollectionType.Array: - collectionTypeInfoValue = $"{collectionInfoCreationPrefix}{valueTypeCompilableName}>({OptionsInstanceVariableName}, {valueTypeMetadataPropertyName}, {numberHandlingArg}, {serializeFuncNamedArg})"; + collectionTypeInfoValue = $"{collectionInfoCreationPrefix}{valueTypeCompilableName}>({OptionsInstanceVariableName}, {InfoVarName})"; break; case CollectionType.IEnumerable: case CollectionType.IList: - collectionTypeInfoValue = $"{collectionInfoCreationPrefix}{typeRef}>({OptionsInstanceVariableName}, {createObjectFuncArg}, {valueTypeMetadataPropertyName}, {numberHandlingArg}, {serializeFuncNamedArg})"; + collectionTypeInfoValue = $"{collectionInfoCreationPrefix}{typeRef}>({OptionsInstanceVariableName}, {InfoVarName})"; break; case CollectionType.Stack: case CollectionType.Queue: string addMethod = collectionType == CollectionType.Stack ? "Push" : "Enqueue"; string addFuncNamedArg = $"addFunc: (collection, {ValueVarName}) => collection.{addMethod}({ValueVarName})"; - collectionTypeInfoValue = $"{collectionInfoCreationPrefix}{typeRef}>({OptionsInstanceVariableName}, {createObjectFuncArg}, {valueTypeMetadataPropertyName}, {numberHandlingArg}, {serializeFuncNamedArg}, {addFuncNamedArg})"; + collectionTypeInfoValue = $"{collectionInfoCreationPrefix}{typeRef}>({OptionsInstanceVariableName}, {InfoVarName}, {addFuncNamedArg})"; break; case CollectionType.ImmutableEnumerable: collectionTypeInfoValue = $"{enumerableInfoCreationPrefix}, {immutableCollectionCreationSuffix})"; break; case CollectionType.IDictionary: - collectionTypeInfoValue = $"{collectionInfoCreationPrefix}{typeRef}>({OptionsInstanceVariableName}, {createObjectFuncArg}, {keyTypeMetadataPropertyName!}, {valueTypeMetadataPropertyName}, {numberHandlingArg}, {serializeFuncNamedArg})"; + collectionTypeInfoValue = $"{collectionInfoCreationPrefix}{typeRef}>({OptionsInstanceVariableName}, {InfoVarName})"; break; case CollectionType.Dictionary: case CollectionType.IDictionaryOfTKeyTValue: @@ -453,9 +518,19 @@ private string GenerateForCollection(TypeGenerationSpec typeGenerationSpec) break; } - string metadataInitSource = @$"_{typeGenerationSpec.TypeInfoPropertyName} = {collectionTypeInfoValue};"; + string metadataInitSource = @$"{JsonCollectionInfoValuesTypeRef}<{typeRef}> {InfoVarName} = new {JsonCollectionInfoValuesTypeRef}<{typeRef}>() + {{ + {ObjectCreatorPropName} = {objectCreatorValue}, + {KeyInfoPropName} = {keyTypeMetadataPropertyName!}, + {ElementInfoPropName} = {valueTypeMetadataPropertyName}, + {NumberHandlingPropName} = {numberHandlingArg}, + {SerializeHandlerPropName} = {serializeHandlerValue} + }}; - return GenerateForType(typeGenerationSpec, metadataInitSource, serializeFuncSource); + _{typeGenerationSpec.TypeInfoPropertyName} = {collectionTypeInfoValue}; +"; + + return GenerateForType(typeGenerationSpec, metadataInitSource, serializeHandlerSource); } private string GenerateFastPathFuncForEnumerable(TypeGenerationSpec typeGenerationSpec) @@ -464,7 +539,7 @@ private string GenerateFastPathFuncForEnumerable(TypeGenerationSpec typeGenerati Type elementType = valueTypeGenerationSpec.Type; string? writerMethodToCall = GetWriterMethod(elementType); - + string iterationLogic; string valueToWrite; @@ -493,7 +568,7 @@ private string GenerateFastPathFuncForEnumerable(TypeGenerationSpec typeGenerati } string elementSerializationLogic = writerMethodToCall == null - ? GetSerializeLogicForNonPrimitiveType(valueTypeGenerationSpec.TypeInfoPropertyName, valueToWrite, valueTypeGenerationSpec.GenerateSerializationLogic) + ? GetSerializeLogicForNonPrimitiveType(valueTypeGenerationSpec, valueToWrite) : $"{writerMethodToCall}Value({valueToWrite});"; string serializationLogic = $@"{WriterVarName}.WriteStartArray(); @@ -505,11 +580,7 @@ private string GenerateFastPathFuncForEnumerable(TypeGenerationSpec typeGenerati {WriterVarName}.WriteEndArray();"; - return GenerateFastPathFuncForType( - typeGenerationSpec.FastPathSerializeMethodName, - typeGenerationSpec.TypeRef, - serializationLogic, - typeGenerationSpec.CanBeNull); + return GenerateFastPathFuncForType(typeGenerationSpec, serializationLogic, emitNullCheck: typeGenerationSpec.CanBeNull); } private string GenerateFastPathFuncForDictionary(TypeGenerationSpec typeGenerationSpec) @@ -537,7 +608,7 @@ private string GenerateFastPathFuncForDictionary(TypeGenerationSpec typeGenerati else { elementSerializationLogic = $@"{WriterVarName}.WritePropertyName({keyToWrite}); - {GetSerializeLogicForNonPrimitiveType(valueTypeGenerationSpec.TypeInfoPropertyName, valueToWrite, valueTypeGenerationSpec.GenerateSerializationLogic)}"; + {GetSerializeLogicForNonPrimitiveType(valueTypeGenerationSpec, valueToWrite)}"; } string serializationLogic = $@"{WriterVarName}.WriteStartObject(); @@ -549,11 +620,7 @@ private string GenerateFastPathFuncForDictionary(TypeGenerationSpec typeGenerati {WriterVarName}.WriteEndObject();"; - return GenerateFastPathFuncForType( - typeGenerationSpec.FastPathSerializeMethodName, - typeGenerationSpec.TypeRef, - serializationLogic, - typeGenerationSpec.CanBeNull); + return GenerateFastPathFuncForType(typeGenerationSpec, serializationLogic, emitNullCheck: typeGenerationSpec.CanBeNull); } private string GenerateForObject(TypeGenerationSpec typeMetadata) @@ -592,23 +659,23 @@ private string GenerateForObject(TypeGenerationSpec typeMetadata) if (typeMetadata.GenerateSerializationLogic) { serializeFuncSource = GenerateFastPathFuncForObject(typeMetadata); - serializeMethodName = $"{typeFriendlyName}{SerializeMethodNameSuffix}"; + serializeMethodName = $"{typeFriendlyName}{SerializeHandlerPropName}"; } const string ObjectInfoVarName = "objectInfo"; string genericArg = typeMetadata.TypeRef; string objectInfoInitSource = $@"{JsonObjectInfoValuesTypeRef}<{genericArg}> {ObjectInfoVarName} = new {JsonObjectInfoValuesTypeRef}<{genericArg}>() - {{ - ObjectCreator = {creatorInvocation}, - ObjectWithParameterizedConstructorCreator = {parameterizedCreatorInvocation}, - PropertyMetadataInitializer = {propInitMethodName}, - ConstructorParameterMetadataInitializer = {ctorParamMetadataInitMethodName}, - NumberHandling = {GetNumberHandlingAsStr(typeMetadata.NumberHandling)}, - SerializeHandler = {serializeMethodName} - }}; + {{ + {ObjectCreatorPropName} = {creatorInvocation}, + ObjectWithParameterizedConstructorCreator = {parameterizedCreatorInvocation}, + PropertyMetadataInitializer = {propInitMethodName}, + ConstructorParameterMetadataInitializer = {ctorParamMetadataInitMethodName}, + {NumberHandlingPropName} = {GetNumberHandlingAsStr(typeMetadata.NumberHandling)}, + {SerializeHandlerPropName} = {serializeMethodName} + }}; - _{typeFriendlyName} = {JsonMetadataServicesTypeRef}.CreateObjectInfo<{typeMetadata.TypeRef}>({OptionsInstanceVariableName}, {ObjectInfoVarName});"; + _{typeFriendlyName} = {JsonMetadataServicesTypeRef}.CreateObjectInfo<{typeMetadata.TypeRef}>({OptionsInstanceVariableName}, {ObjectInfoVarName});"; string additionalSource = @$"{propMetadataInitFuncSource}{serializeFuncSource}{ctorParamMetadataInitFuncSource}"; @@ -618,7 +685,6 @@ private string GenerateForObject(TypeGenerationSpec typeMetadata) private string GeneratePropMetadataInitFunc(TypeGenerationSpec typeGenerationSpec) { const string PropVarName = "properties"; - const string JsonContextVarName = "jsonContext"; List properties = typeGenerationSpec.PropertyGenSpecList!; @@ -657,57 +723,66 @@ private string GeneratePropMetadataInitFunc(TypeGenerationSpec typeGenerationSpe ? "null" : $"{JsonContextVarName}.{memberTypeMetadata.TypeInfoPropertyName}"; - string typeTypeInfoNamedArg = $"propertyTypeInfo: {memberTypeFriendlyName}"; - - string jsonPropertyNameNamedArg = memberMetadata.JsonPropertyName != null - ? @$"jsonPropertyName: ""{memberMetadata.JsonPropertyName}""" - : "jsonPropertyName: null"; - - string getterNamedArg = memberMetadata.CanUseGetter - ? $"getter: static (obj) => (({declaringTypeCompilableName})obj).{clrPropertyName}" - : "getter: null"; + string jsonPropertyNameValue = memberMetadata.JsonPropertyName != null + ? @$"""{memberMetadata.JsonPropertyName}""" + : "null"; - string setterNamedArg; - if (memberMetadata.CanUseSetter) + string getterValue = memberMetadata switch { - string propMutation = typeGenerationSpec.IsValueType - ? @$"{UnsafeTypeRef}.Unbox<{declaringTypeCompilableName}>(obj).{clrPropertyName} = value!" - : $@"(({declaringTypeCompilableName})obj).{clrPropertyName} = value!"; - - setterNamedArg = $"setter: static (obj, value) => {propMutation}"; - } - else + { DefaultIgnoreCondition: JsonIgnoreCondition.Always } => "null", + { CanUseGetter: true } => $"static (obj) => (({declaringTypeCompilableName})obj).{clrPropertyName}{(memberMetadata.TypeGenerationSpec.CanContainNullableReferenceAnnotations ? "!" : "")}", + { CanUseGetter: false, HasJsonInclude: true } + => @$"static (obj) => throw new {InvalidOperationExceptionTypeRef}(""{string.Format(ExceptionMessages.InaccessibleJsonIncludePropertiesNotSupported, typeGenerationSpec.Type.Name, memberMetadata.ClrName)}"")", + _ => "null" + }; + + string setterValue = memberMetadata switch { - setterNamedArg = "setter: null"; - } + { DefaultIgnoreCondition: JsonIgnoreCondition.Always } => "null", + { CanUseSetter: true, IsInitOnlySetter: true } + => @$"static (obj, value) => throw new {InvalidOperationExceptionTypeRef}(""{ExceptionMessages.InitOnlyPropertyDeserializationNotSupported}"")", + { CanUseSetter: true } when typeGenerationSpec.IsValueType + => $@"static (obj, value) => {UnsafeTypeRef}.Unbox<{declaringTypeCompilableName}>(obj).{clrPropertyName} = value!", + { CanUseSetter: true } + => @$"static (obj, value) => (({declaringTypeCompilableName})obj).{clrPropertyName} = value!", + { CanUseSetter: false, HasJsonInclude: true } + => @$"static (obj, value) => throw new {InvalidOperationExceptionTypeRef}(""{string.Format(ExceptionMessages.InaccessibleJsonIncludePropertiesNotSupported, typeGenerationSpec.Type.Name, memberMetadata.ClrName)}"")", + _ => "null", + }; JsonIgnoreCondition? ignoreCondition = memberMetadata.DefaultIgnoreCondition; string ignoreConditionNamedArg = ignoreCondition.HasValue - ? $"ignoreCondition: {JsonIgnoreConditionTypeRef}.{ignoreCondition.Value}" - : "ignoreCondition: null"; + ? $"{JsonIgnoreConditionTypeRef}.{ignoreCondition.Value}" + : "null"; - string converterNamedArg = memberMetadata.ConverterInstantiationLogic == null - ? "converter: null" - : $"converter: {memberMetadata.ConverterInstantiationLogic}"; + string converterValue = memberMetadata.ConverterInstantiationLogic == null + ? "null" + : $"{memberMetadata.ConverterInstantiationLogic}"; string memberTypeCompilableName = memberTypeMetadata.TypeRef; + string infoVarName = $"{InfoVarName}{i}"; + sb.Append($@" - {PropVarName}[{i}] = {JsonMetadataServicesTypeRef}.CreatePropertyInfo<{memberTypeCompilableName}>( - options, - isProperty: {ToCSharpKeyword(memberMetadata.IsProperty)}, - isPublic: {ToCSharpKeyword(memberMetadata.IsPublic)}, - isVirtual: {ToCSharpKeyword(memberMetadata.IsVirtual)}, - declaringType: typeof({memberMetadata.DeclaringTypeRef}), - {typeTypeInfoNamedArg}, - {converterNamedArg}, - {getterNamedArg}, - {setterNamedArg}, - {ignoreConditionNamedArg}, - hasJsonInclude: {ToCSharpKeyword(memberMetadata.HasJsonInclude)}, - numberHandling: {GetNumberHandlingAsStr(memberMetadata.NumberHandling)}, - propertyName: ""{clrPropertyName}"", - {jsonPropertyNameNamedArg}); + {JsonPropertyInfoValuesTypeRef}<{memberTypeCompilableName}> {infoVarName} = new {JsonPropertyInfoValuesTypeRef}<{memberTypeCompilableName}>() + {{ + IsProperty = {FormatBool(memberMetadata.IsProperty)}, + IsPublic = {FormatBool(memberMetadata.IsPublic)}, + IsVirtual = {FormatBool(memberMetadata.IsVirtual)}, + DeclaringType = typeof({memberMetadata.DeclaringTypeRef}), + PropertyTypeInfo = {memberTypeFriendlyName}, + Converter = {converterValue}, + Getter = {getterValue}, + Setter = {setterValue}, + IgnoreCondition = {ignoreConditionNamedArg}, + HasJsonInclude = {FormatBool(memberMetadata.HasJsonInclude)}, + IsExtensionData = {FormatBool(memberMetadata.IsExtensionData)}, + NumberHandling = {GetNumberHandlingAsStr(memberMetadata.NumberHandling)}, + PropertyName = ""{clrPropertyName}"", + JsonPropertyName = {jsonPropertyNameValue} + }}; + + {PropVarName}[{i}] = {JsonMetadataServicesTypeRef}.CreatePropertyInfo<{memberTypeCompilableName}>(options, {infoVarName}); "); } @@ -721,7 +796,6 @@ private string GeneratePropMetadataInitFunc(TypeGenerationSpec typeGenerationSpe private string GenerateCtorParamMetadataInitFunc(TypeGenerationSpec typeGenerationSpec) { const string parametersVarName = "parameters"; - const string infoVarName = "info"; ParameterGenerationSpec[] parameters = typeGenerationSpec.CtorParamGenSpecArray; int paramCount = parameters.Length; @@ -738,17 +812,22 @@ private string GenerateCtorParamMetadataInitFunc(TypeGenerationSpec typeGenerati for (int i = 0; i < paramCount; i++) { ParameterInfo reflectionInfo = parameters[i].ParameterInfo; + Type parameterType = reflectionInfo.ParameterType; + string parameterTypeRef = parameterType.GetCompilableName(); + + object? defaultValue = reflectionInfo.GetDefaultValue(); + string defaultValueAsStr = GetParamDefaultValueAsString(defaultValue, parameterType, parameterTypeRef); sb.Append(@$" - {infoVarName} = new() + {InfoVarName} = new() {{ Name = ""{reflectionInfo.Name!}"", - ParameterType = typeof({reflectionInfo.ParameterType.GetCompilableName()}), + ParameterType = typeof({parameterTypeRef}), Position = {reflectionInfo.Position}, - HasDefaultValue = {ToCSharpKeyword(reflectionInfo.HasDefaultValue)}, - DefaultValue = {GetParamDefaultValueAsString(reflectionInfo.DefaultValue)} + HasDefaultValue = {FormatBool(reflectionInfo.HasDefaultValue)}, + DefaultValue = {defaultValueAsStr} }}; - {parametersVarName}[{i}] = {infoVarName}; + {parametersVarName}[{i}] = {InfoVarName}; "); } @@ -763,20 +842,17 @@ private string GenerateFastPathFuncForObject(TypeGenerationSpec typeGenSpec) { JsonSourceGenerationOptionsAttribute options = _currentContext.GenerationOptions; string typeRef = typeGenSpec.TypeRef; - string serializeMethodName = $"{typeGenSpec.TypeInfoPropertyName}{SerializeMethodNameSuffix}"; if (!typeGenSpec.TryFilterSerializableProps( options, out Dictionary? serializableProperties, out bool castingRequiredForProps)) { - string exceptionMessage = @$"""Invalid serializable-property configuration specified for type '{typeRef}'. For more information, use 'JsonSourceGenerationMode.Serialization'."""; + string exceptionMessage = string.Format(ExceptionMessages.InvalidSerializablePropertyConfiguration, typeRef); - return GenerateFastPathFuncForType( - serializeMethodName, - typeRef, - $@"throw new {InvalidOperationExceptionTypeRef}({exceptionMessage});", - canBeNull: false); // Skip null check since we want to throw an exception straightaway. + return GenerateFastPathFuncForType(typeGenSpec, + $@"throw new {InvalidOperationExceptionTypeRef}(""{exceptionMessage}"");", + emitNullCheck: false); // Skip null check since we want to throw an exception straightaway. } StringBuilder sb = new(); @@ -803,15 +879,16 @@ private string GenerateFastPathFuncForObject(TypeGenerationSpec typeGenSpec) TypeGenerationSpec propertyTypeSpec = propertyGenSpec.TypeGenerationSpec; string runtimePropName = propertyGenSpec.RuntimePropertyName; + string propVarName = propertyGenSpec.PropertyNameVarName; // Add the property names to the context-wide cache; we'll generate the source to initialize them at the end of generation. - _currentContext.RuntimePropertyNames.Add(runtimePropName); + Debug.Assert(!_currentContext.RuntimePropertyNames.TryGetValue(runtimePropName, out string? existingName) || existingName == propVarName); + _currentContext.RuntimePropertyNames.TryAdd(runtimePropName, propVarName); Type propertyType = propertyTypeSpec.Type; - string propName = $"{runtimePropName}PropName"; string? objectRef = castingRequiredForProps ? $"(({propertyGenSpec.DeclaringTypeRef}){ValueVarName})" : ValueVarName; string propValue = $"{objectRef}.{propertyGenSpec.ClrName}"; - string methodArgs = $"{propName}, {propValue}"; + string methodArgs = $"{propVarName}, {propValue}"; string? methodToCall = GetWriterMethod(propertyType); @@ -830,8 +907,8 @@ private string GenerateFastPathFuncForObject(TypeGenerationSpec typeGenSpec) else { serializationLogic = $@" - {WriterVarName}.WritePropertyName({propName}); - {GetSerializeLogicForNonPrimitiveType(propertyTypeSpec.TypeInfoPropertyName, propValue, propertyTypeSpec.GenerateSerializationLogic)}"; + {WriterVarName}.WritePropertyName({propVarName}); + {GetSerializeLogicForNonPrimitiveType(propertyTypeSpec, propValue)}"; } JsonIgnoreCondition ignoreCondition = propertyGenSpec.DefaultIgnoreCondition ?? options.DefaultIgnoreCondition; @@ -865,7 +942,7 @@ private string GenerateFastPathFuncForObject(TypeGenerationSpec typeGenSpec) sb.Append($@"((global::{JsonConstants.IJsonOnSerializedFullName}){ValueVarName}).OnSerialized();"); }; - return GenerateFastPathFuncForType(serializeMethodName, typeRef, sb.ToString(), typeGenSpec.CanBeNull); + return GenerateFastPathFuncForType(typeGenSpec, sb.ToString(), emitNullCheck: typeGenSpec.CanBeNull); } private static bool ShouldIncludePropertyForFastPath(PropertyGenerationSpec propertyGenSpec, JsonSourceGenerationOptionsAttribute options) @@ -965,14 +1042,20 @@ static string GetParamUnboxing(ParameterGenerationSpec spec, int index) return method; } - private string GenerateFastPathFuncForType(string serializeMethodName, string typeInfoTypeRef, string serializationLogic, bool canBeNull) + private string GenerateFastPathFuncForType(TypeGenerationSpec typeGenSpec, string serializeMethodBody, bool emitNullCheck) { + Debug.Assert(!emitNullCheck || typeGenSpec.CanBeNull); + + string serializeMethodName = $"{typeGenSpec.TypeInfoPropertyName}{SerializeHandlerPropName}"; + // fast path serializers for reference types always support null inputs. + string valueTypeRef = $"{typeGenSpec.TypeRef}{(typeGenSpec.IsValueType ? "" : "?")}"; + return $@" -private static void {serializeMethodName}({Utf8JsonWriterTypeRef} {WriterVarName}, {typeInfoTypeRef} {ValueVarName}) +private static void {serializeMethodName}({Utf8JsonWriterTypeRef} {WriterVarName}, {valueTypeRef} {ValueVarName}) {{ - {GetEarlyNullCheckSource(canBeNull)} - {serializationLogic} + {GetEarlyNullCheckSource(emitNullCheck)} + {serializeMethodBody} }}"; } @@ -988,16 +1071,17 @@ private string GetEarlyNullCheckSource(bool canBeNull) : null; } - private string GetSerializeLogicForNonPrimitiveType(string typeInfoPropertyName, string valueToWrite, bool serializationLogicGenerated) + private string GetSerializeLogicForNonPrimitiveType(TypeGenerationSpec typeGenerationSpec, string valueExpr) { - string typeInfoRef = $"{_currentContext.ContextTypeRef}.Default.{typeInfoPropertyName}"; + string valueExprSuffix = typeGenerationSpec.CanContainNullableReferenceAnnotations ? "!" : ""; - if (serializationLogicGenerated) + if (typeGenerationSpec.GenerateSerializationLogic) { - return $"{typeInfoPropertyName}{SerializeMethodNameSuffix}({WriterVarName}, {valueToWrite});"; + return $"{typeGenerationSpec.TypeInfoPropertyName}{SerializeHandlerPropName}({WriterVarName}, {valueExpr}{valueExprSuffix});"; } - return $"{JsonSerializerTypeRef}.Serialize({WriterVarName}, {valueToWrite}, {typeInfoRef});"; + string typeInfoRef = $"{_currentContext.ContextTypeRef}.Default.{typeGenerationSpec.TypeInfoPropertyName}!"; + return $"{JsonSerializerTypeRef}.Serialize({WriterVarName}, {valueExpr}{valueExprSuffix}, {typeInfoRef});"; } private enum DefaultCheckType @@ -1044,7 +1128,7 @@ private string GenerateForType(TypeGenerationSpec typeMetadata, string metadataI {{ if (_{typeFriendlyName} == null) {{ - {WrapWithCheckForCustomConverterIfRequired(metadataInitSource, typeCompilableName, typeFriendlyName, GetNumberHandlingAsStr(typeMetadata.NumberHandling))} + {WrapWithCheckForCustomConverter(metadataInitSource, typeCompilableName, typeFriendlyName, GetNumberHandlingAsStr(typeMetadata.NumberHandling))} }} return _{typeFriendlyName}; @@ -1052,23 +1136,16 @@ private string GenerateForType(TypeGenerationSpec typeMetadata, string metadataI }}{additionalSource}"; } - private string WrapWithCheckForCustomConverterIfRequired(string source, string typeCompilableName, string typeFriendlyName, string numberHandlingNamedArg) - { - if (_currentContext.GenerationOptions.IgnoreRuntimeCustomConverters) - { - return source; - } - - return @$"{JsonConverterTypeRef}? customConverter; - if ({OptionsInstanceVariableName}.Converters.Count > 0 && (customConverter = {RuntimeCustomConverterFetchingMethodName}(typeof({typeCompilableName}))) != null) - {{ - _{typeFriendlyName} = {JsonMetadataServicesTypeRef}.{GetCreateValueInfoMethodRef(typeCompilableName)}({OptionsInstanceVariableName}, customConverter); - }} - else - {{ - {IndentSource(source, numIndentations: 1)} - }}"; - } + private string WrapWithCheckForCustomConverter(string source, string typeCompilableName, string typeFriendlyName, string numberHandlingNamedArg) + => @$"{JsonConverterTypeRef}? customConverter; + if ({OptionsInstanceVariableName}.Converters.Count > 0 && (customConverter = {RuntimeCustomConverterFetchingMethodName}(typeof({typeCompilableName}))) != null) + {{ + _{typeFriendlyName} = {JsonMetadataServicesTypeRef}.{GetCreateValueInfoMethodRef(typeCompilableName)}({OptionsInstanceVariableName}, customConverter); + }} + else + {{ + {IndentSource(source, numIndentations: 1)} + }}"; private string GetRootJsonContextImplementation() { @@ -1082,16 +1159,28 @@ private string GetRootJsonContextImplementation() private static {contextTypeRef}? {DefaultContextBackingStaticVarName}; public static {contextTypeRef} Default => {DefaultContextBackingStaticVarName} ??= new {contextTypeRef}(new {JsonSerializerOptionsTypeRef}({DefaultOptionsStaticVarName})); -public {contextTypeName}() : base(null, {DefaultOptionsStaticVarName}) +protected override {JsonSerializerOptionsTypeRef}? GeneratedSerializerOptions {{ get; }} = {DefaultOptionsStaticVarName}; + +public {contextTypeName}() : base(null) {{ }} -public {contextTypeName}({JsonSerializerOptionsTypeRef} options) : base(options, {DefaultOptionsStaticVarName}) +public {contextTypeName}({JsonSerializerOptionsTypeRef} options) : base(options) {{ }} {GetFetchLogicForRuntimeSpecifiedCustomConverter()}"); + if (_generateGetConverterMethodForProperties) + { + sb.Append(GetFetchLogicForGetCustomConverter_PropertiesWithFactories()); + } + + if (_generateGetConverterMethodForProperties || _generateGetConverterMethodForTypes) + { + sb.Append(GetFetchLogicForGetCustomConverter_TypesWithFactories()); + } + return sb.ToString(); } @@ -1108,20 +1197,15 @@ private string GetLogicForDefaultSerializerOptionsInit() private static {JsonSerializerOptionsTypeRef} {DefaultOptionsStaticVarName} {{ get; }} = new {JsonSerializerOptionsTypeRef}() {{ DefaultIgnoreCondition = {JsonIgnoreConditionTypeRef}.{options.DefaultIgnoreCondition}, - IgnoreReadOnlyFields = {ToCSharpKeyword(options.IgnoreReadOnlyFields)}, - IgnoreReadOnlyProperties = {ToCSharpKeyword(options.IgnoreReadOnlyProperties)}, - IncludeFields = {ToCSharpKeyword(options.IncludeFields)}, - WriteIndented = {ToCSharpKeyword(options.WriteIndented)},{namingPolicyInit} + IgnoreReadOnlyFields = {FormatBool(options.IgnoreReadOnlyFields)}, + IgnoreReadOnlyProperties = {FormatBool(options.IgnoreReadOnlyProperties)}, + IncludeFields = {FormatBool(options.IncludeFields)}, + WriteIndented = {FormatBool(options.WriteIndented)},{namingPolicyInit} }};"; } private string GetFetchLogicForRuntimeSpecifiedCustomConverter() { - if (_currentContext.GenerationOptions.IgnoreRuntimeCustomConverters) - { - return ""; - } - // TODO (https://github.com/dotnet/runtime/issues/52218): use a dictionary if count > ~15. return @$"private {JsonConverterTypeRef}? {RuntimeCustomConverterFetchingMethodName}({TypeTypeRef} type) {{ @@ -1138,7 +1222,7 @@ private string GetFetchLogicForRuntimeSpecifiedCustomConverter() converter = factory.CreateConverter(type, {OptionsInstanceVariableName}); if (converter == null || converter is {JsonConverterFactoryTypeRef}) {{ - throw new {InvalidOperationExceptionTypeRef}($""The converter '{{factory.GetType()}}' cannot return null or a JsonConverterFactory instance.""); + throw new {InvalidOperationExceptionTypeRef}(string.Format(""{ExceptionMessages.InvalidJsonConverterFactoryOutput}"", factory.GetType())); }} }} @@ -1150,6 +1234,32 @@ private string GetFetchLogicForRuntimeSpecifiedCustomConverter() }}"; } + private string GetFetchLogicForGetCustomConverter_PropertiesWithFactories() + { + return @$" + +private {JsonConverterTypeRef} {GetConverterFromFactoryMethodName}({JsonConverterFactoryTypeRef} factory) +{{ + return ({JsonConverterTypeRef}) {GetConverterFromFactoryMethodName}(typeof(T), factory); +}}"; + } + + private string GetFetchLogicForGetCustomConverter_TypesWithFactories() + { + return @$" + +private {JsonConverterTypeRef} {GetConverterFromFactoryMethodName}({TypeTypeRef} type, {JsonConverterFactoryTypeRef} factory) +{{ + {JsonConverterTypeRef}? converter = factory.CreateConverter(type, {Emitter.OptionsInstanceVariableName}); + if (converter == null || converter is {JsonConverterFactoryTypeRef}) + {{ + throw new {InvalidOperationExceptionTypeRef}(string.Format(""{ExceptionMessages.InvalidJsonConverterFactoryOutput}"", factory.GetType())); + }} + + return converter; +}}"; + } + private string GetGetTypeInfoImplementation() { StringBuilder sb = new(); @@ -1190,10 +1300,10 @@ private string GetPropertyNameInitialization() StringBuilder sb = new(); - foreach (string propName in _currentContext.RuntimePropertyNames) + foreach (KeyValuePair name_varName_pair in _currentContext.RuntimePropertyNames) { sb.Append($@" -private static {JsonEncodedTextTypeRef} {propName}PropName = {JsonEncodedTextTypeRef}.Encode(""{propName}"");"); +private static readonly {JsonEncodedTextTypeRef} {name_varName_pair.Value} = {JsonEncodedTextTypeRef}.Encode(""{name_varName_pair.Key}"");"); } return sb.ToString(); @@ -1211,20 +1321,64 @@ private static string GetNumberHandlingAsStr(JsonNumberHandling? numberHandling) : "default"; private static string GetCreateValueInfoMethodRef(string typeCompilableName) => $"{CreateValueInfoMethodName}<{typeCompilableName}>"; - } - private static string ToCSharpKeyword(bool value) => value.ToString().ToLowerInvariant(); + private static string FormatBool(bool value) => value ? "true" : "false"; - private static string GetParamDefaultValueAsString(object? value) - { - switch (value) + private string GetParamDefaultValueAsString(object? value, Type type, string typeRef) { - case null: - return "null"; - case bool boolVal: - return ToCSharpKeyword(boolVal); - default: - return value!.ToString(); + if (value == null) + { + return $"default({typeRef})"; + } + + if (type.IsEnum) + { + // Roslyn gives us an instance of the underlying type, which is numerical. +#if DEBUG + Type runtimeType = _generationSpec.MetadataLoadContext.Resolve(value.GetType()); + Debug.Assert(_generationSpec.IsNumberType(runtimeType)); +#endif + + // Return the numeric value. + return FormatNumber(); + } + + switch (value) + { + case string @string: + return SymbolDisplay.FormatLiteral(@string, quote: true); ; + case char @char: + return SymbolDisplay.FormatLiteral(@char, quote: true); + case double.NegativeInfinity: + return "double.NegativeInfinity"; + case double.PositiveInfinity: + return "double.PositiveInfinity"; + case double.NaN: + return "double.NaN"; + case double @double: + return $"({typeRef})({@double.ToString(JsonConstants.DoubleFormatString, CultureInfo.InvariantCulture)})"; + case float.NegativeInfinity: + return "float.NegativeInfinity"; + case float.PositiveInfinity: + return "float.PositiveInfinity"; + case float.NaN: + return "float.NaN"; + case float @float: + return $"({typeRef})({@float.ToString(JsonConstants.SingleFormatString, CultureInfo.InvariantCulture)})"; + case decimal.MaxValue: + return "decimal.MaxValue"; + case decimal.MinValue: + return "decimal.MinValue"; + case decimal @decimal: + return @decimal.ToString(CultureInfo.InvariantCulture); + case bool @bool: + return FormatBool(@bool); + default: + // Assume this is a number. + return FormatNumber(); + } + + string FormatNumber() => $"({typeRef})({Convert.ToString(value, CultureInfo.InvariantCulture)})"; } } } diff --git a/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs index 33a60562a3a10e..93675141412cef 100644 --- a/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs +++ b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs @@ -4,6 +4,7 @@ using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -13,6 +14,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.DotnetRuntime.Extensions; using Microsoft.CodeAnalysis.Text; namespace System.Text.Json.SourceGeneration @@ -23,15 +25,33 @@ private sealed class Parser { private const string SystemTextJsonNamespace = "System.Text.Json"; private const string JsonConverterAttributeFullName = "System.Text.Json.Serialization.JsonConverterAttribute"; + private const string JsonConverterFactoryFullName = "System.Text.Json.Serialization.JsonConverterFactory"; + private const string JsonConverterOfTFullName = "System.Text.Json.Serialization.JsonConverter`1"; + private const string JsonArrayFullName = "System.Text.Json.Nodes.JsonArray"; private const string JsonElementFullName = "System.Text.Json.JsonElement"; + private const string JsonExtensionDataAttributeFullName = "System.Text.Json.Serialization.JsonExtensionDataAttribute"; + private const string JsonNodeFullName = "System.Text.Json.Nodes.JsonNode"; + private const string JsonObjectFullName = "System.Text.Json.Nodes.JsonObject"; + private const string JsonValueFullName = "System.Text.Json.Nodes.JsonValue"; private const string JsonIgnoreAttributeFullName = "System.Text.Json.Serialization.JsonIgnoreAttribute"; private const string JsonIgnoreConditionFullName = "System.Text.Json.Serialization.JsonIgnoreCondition"; private const string JsonIncludeAttributeFullName = "System.Text.Json.Serialization.JsonIncludeAttribute"; private const string JsonNumberHandlingAttributeFullName = "System.Text.Json.Serialization.JsonNumberHandlingAttribute"; private const string JsonPropertyNameAttributeFullName = "System.Text.Json.Serialization.JsonPropertyNameAttribute"; private const string JsonPropertyOrderAttributeFullName = "System.Text.Json.Serialization.JsonPropertyOrderAttribute"; + private const string JsonSerializerContextFullName = "System.Text.Json.Serialization.JsonSerializerContext"; + private const string JsonSourceGenerationOptionsAttributeFullName = "System.Text.Json.Serialization.JsonSourceGenerationOptionsAttribute"; - private readonly GeneratorExecutionContext _executionContext; + internal const string JsonSerializableAttributeFullName = "System.Text.Json.Serialization.JsonSerializableAttribute"; + + private const string DateOnlyFullName = "System.DateOnly"; + private const string TimeOnlyFullName = "System.TimeOnly"; + private const string IAsyncEnumerableFullName = "System.Collections.Generic.IAsyncEnumerable`1"; + + private const string DictionaryTypeRef = "global::System.Collections.Generic.Dictionary"; + + private readonly Compilation _compilation; + private readonly JsonSourceGenerationContext _sourceGenerationContext; private readonly MetadataLoadContextInternal _metadataLoadContext; private readonly Type _ilistOfTType; @@ -43,7 +63,7 @@ private sealed class Parser private readonly Type? _dictionaryType; private readonly Type? _idictionaryOfTKeyTValueType; private readonly Type? _ireadonlyDictionaryType; - private readonly Type? _isetType; + private readonly Type? _isetType; private readonly Type? _stackOfTType; private readonly Type? _queueOfTType; private readonly Type? _concurrentStackType; @@ -61,15 +81,36 @@ private sealed class Parser private readonly Type _objectType; private readonly Type _stringType; + private readonly Type? _timeSpanType; private readonly Type? _dateTimeOffsetType; private readonly Type? _byteArrayType; private readonly Type? _guidType; private readonly Type? _uriType; private readonly Type? _versionType; + private readonly Type? _jsonArrayType; private readonly Type? _jsonElementType; + private readonly Type? _jsonNodeType; + private readonly Type? _jsonObjectType; + private readonly Type? _jsonValueType; + + // Unsupported types + private readonly Type _delegateType; + private readonly Type _typeType; + private readonly Type _serializationInfoType; + private readonly Type _intPtrType; + private readonly Type _uIntPtrType; + + // Unsupported types that may not resolve + private readonly Type? _iAsyncEnumerableGenericType; + private readonly Type? _dateOnlyType; + private readonly Type? _timeOnlyType; + + // Needed for converter validation + private readonly Type _jsonConverterOfTType; private readonly HashSet _numberTypes = new(); private readonly HashSet _knownTypes = new(); + private readonly HashSet _knownUnsupportedTypes = new(); /// /// Type information for member types in input object graphs. @@ -78,6 +119,14 @@ private sealed class Parser private readonly HashSet _implicitlyRegisteredTypes = new(); + /// + /// A list of diagnostics emitted at the type level. This is cached and emitted between the processing of context types + /// in order to properly retrieve [JsonSerializable] attribute applications for top-level types (since a type might occur + /// both at top-level and in nested object graphs, with no guarantee of the order that we will see the type). + /// The element tuple types specifies the serializable type, the kind of diagnostic to emit, and the diagnostic message. + /// + private readonly List<(Type, DiagnosticDescriptor, string[])> _typeLevelDiagnostics = new(); + private JsonKnownNamingPolicy _currentContextNamingPolicy; private static DiagnosticDescriptor ContextClassesMustBePartial { get; } = new DiagnosticDescriptor( @@ -96,10 +145,43 @@ private sealed class Parser defaultSeverity: DiagnosticSeverity.Error, isEnabledByDefault: true); - public Parser(in GeneratorExecutionContext executionContext) + private static DiagnosticDescriptor MultipleJsonExtensionDataAttribute { get; } = new DiagnosticDescriptor( + id: "SYSLIB1035", + title: new LocalizableResourceString(nameof(SR.MultipleJsonExtensionDataAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.Json.SourceGeneration.SR)), + messageFormat: new LocalizableResourceString(nameof(SR.MultipleJsonExtensionDataAttributeFormat), SR.ResourceManager, typeof(FxResources.System.Text.Json.SourceGeneration.SR)), + category: JsonConstants.SystemTextJsonSourceGenerationName, + defaultSeverity: DiagnosticSeverity.Error, + isEnabledByDefault: true); + + private static DiagnosticDescriptor DataExtensionPropertyInvalid { get; } = new DiagnosticDescriptor( + id: "SYSLIB1036", + title: new LocalizableResourceString(nameof(SR.DataExtensionPropertyInvalidTitle), SR.ResourceManager, typeof(FxResources.System.Text.Json.SourceGeneration.SR)), + messageFormat: new LocalizableResourceString(nameof(SR.DataExtensionPropertyInvalidFormat), SR.ResourceManager, typeof(FxResources.System.Text.Json.SourceGeneration.SR)), + category: JsonConstants.SystemTextJsonSourceGenerationName, + defaultSeverity: DiagnosticSeverity.Error, + isEnabledByDefault: true); + + private static DiagnosticDescriptor InitOnlyPropertyDeserializationNotSupported { get; } = new DiagnosticDescriptor( + id: "SYSLIB1037", + title: new LocalizableResourceString(nameof(SR.InitOnlyPropertyDeserializationNotSupportedTitle), SR.ResourceManager, typeof(FxResources.System.Text.Json.SourceGeneration.SR)), + messageFormat: new LocalizableResourceString(nameof(SR.InitOnlyPropertyDeserializationNotSupportedFormat), SR.ResourceManager, typeof(FxResources.System.Text.Json.SourceGeneration.SR)), + category: JsonConstants.SystemTextJsonSourceGenerationName, + defaultSeverity: DiagnosticSeverity.Warning, + isEnabledByDefault: true); + + private static DiagnosticDescriptor InaccessibleJsonIncludePropertiesNotSupported { get; } = new DiagnosticDescriptor( + id: "SYSLIB1038", + title: new LocalizableResourceString(nameof(SR.InaccessibleJsonIncludePropertiesNotSupportedTitle), SR.ResourceManager, typeof(FxResources.System.Text.Json.SourceGeneration.SR)), + messageFormat: new LocalizableResourceString(nameof(SR.InaccessibleJsonIncludePropertiesNotSupportedFormat), SR.ResourceManager, typeof(FxResources.System.Text.Json.SourceGeneration.SR)), + category: JsonConstants.SystemTextJsonSourceGenerationName, + defaultSeverity: DiagnosticSeverity.Warning, + isEnabledByDefault: true); + + public Parser(Compilation compilation, in JsonSourceGenerationContext sourceGenerationContext) { - _executionContext = executionContext; - _metadataLoadContext = new MetadataLoadContextInternal(executionContext.Compilation); + _compilation = compilation; + _sourceGenerationContext = sourceGenerationContext; + _metadataLoadContext = new MetadataLoadContextInternal(_compilation); _ilistOfTType = _metadataLoadContext.Resolve(SpecialType.System_Collections_Generic_IList_T); _icollectionOfTType = _metadataLoadContext.Resolve(SpecialType.System_Collections_Generic_ICollection_T); @@ -123,29 +205,50 @@ public Parser(in GeneratorExecutionContext executionContext) _booleanType = _metadataLoadContext.Resolve(SpecialType.System_Boolean); _charType = _metadataLoadContext.Resolve(SpecialType.System_Char); + _timeSpanType = _metadataLoadContext.Resolve(typeof(TimeSpan)); _dateTimeType = _metadataLoadContext.Resolve(SpecialType.System_DateTime); _nullableOfTType = _metadataLoadContext.Resolve(SpecialType.System_Nullable_T); _objectType = _metadataLoadContext.Resolve(SpecialType.System_Object); _stringType = _metadataLoadContext.Resolve(SpecialType.System_String); _dateTimeOffsetType = _metadataLoadContext.Resolve(typeof(DateTimeOffset)); - _byteArrayType = _metadataLoadContext.Resolve(typeof(byte[])); + _byteArrayType = _metadataLoadContext.Resolve(typeof(byte)).MakeArrayType(); _guidType = _metadataLoadContext.Resolve(typeof(Guid)); _uriType = _metadataLoadContext.Resolve(typeof(Uri)); _versionType = _metadataLoadContext.Resolve(typeof(Version)); + _jsonArrayType = _metadataLoadContext.Resolve(JsonArrayFullName); _jsonElementType = _metadataLoadContext.Resolve(JsonElementFullName); + _jsonNodeType = _metadataLoadContext.Resolve(JsonNodeFullName); + _jsonObjectType = _metadataLoadContext.Resolve(JsonObjectFullName); + _jsonValueType = _metadataLoadContext.Resolve(JsonValueFullName); + + // Unsupported types. + _delegateType = _metadataLoadContext.Resolve(SpecialType.System_Delegate); + _typeType = _metadataLoadContext.Resolve(typeof(Type)); + _serializationInfoType = _metadataLoadContext.Resolve(typeof(Runtime.Serialization.SerializationInfo)); + _intPtrType = _metadataLoadContext.Resolve(typeof(IntPtr)); + _uIntPtrType = _metadataLoadContext.Resolve(typeof(UIntPtr)); + _iAsyncEnumerableGenericType = _metadataLoadContext.Resolve(IAsyncEnumerableFullName); + _dateOnlyType = _metadataLoadContext.Resolve(DateOnlyFullName); + _timeOnlyType = _metadataLoadContext.Resolve(TimeOnlyFullName); + + _jsonConverterOfTType = _metadataLoadContext.Resolve(JsonConverterOfTFullName); PopulateKnownTypes(); } - public SourceGenerationSpec? GetGenerationSpec(List classDeclarationSyntaxList) + public SourceGenerationSpec? GetGenerationSpec(IEnumerable classDeclarationSyntaxList) { - Compilation compilation = _executionContext.Compilation; - INamedTypeSymbol jsonSerializerContextSymbol = compilation.GetTypeByMetadataName("System.Text.Json.Serialization.JsonSerializerContext"); - INamedTypeSymbol jsonSerializableAttributeSymbol = compilation.GetTypeByMetadataName("System.Text.Json.Serialization.JsonSerializableAttribute"); - INamedTypeSymbol jsonSourceGenerationOptionsAttributeSymbol = compilation.GetTypeByMetadataName("System.Text.Json.Serialization.JsonSourceGenerationOptionsAttribute"); - - if (jsonSerializerContextSymbol == null || jsonSerializableAttributeSymbol == null || jsonSourceGenerationOptionsAttributeSymbol == null) + Compilation compilation = _compilation; + INamedTypeSymbol jsonSerializerContextSymbol = compilation.GetBestTypeByMetadataName(JsonSerializerContextFullName); + INamedTypeSymbol jsonSerializableAttributeSymbol = compilation.GetBestTypeByMetadataName(JsonSerializableAttributeFullName); + INamedTypeSymbol jsonSourceGenerationOptionsAttributeSymbol = compilation.GetBestTypeByMetadataName(JsonSourceGenerationOptionsAttributeFullName); + INamedTypeSymbol jsonConverterOfTAttributeSymbol = compilation.GetBestTypeByMetadataName(JsonConverterOfTFullName); + + if (jsonSerializerContextSymbol == null || + jsonSerializableAttributeSymbol == null || + jsonSourceGenerationOptionsAttributeSymbol == null || + jsonConverterOfTAttributeSymbol == null) { return null; } @@ -154,6 +257,11 @@ public Parser(in GeneratorExecutionContext executionContext) foreach (ClassDeclarationSyntax classDeclarationSyntax in classDeclarationSyntaxList) { + // Ensure context-scoped metadata caches are empty. + Debug.Assert(_typeGenerationSpecCache.Count == 0); + Debug.Assert(_implicitlyRegisteredTypes.Count == 0); + Debug.Assert(_typeLevelDiagnostics.Count == 0); + CompilationUnitSyntax compilationUnitSyntax = classDeclarationSyntax.FirstAncestorOrSelf(); SemanticModel compilationSemanticModel = compilation.GetSemanticModel(compilationUnitSyntax.SyntaxTree); @@ -195,15 +303,18 @@ public Parser(in GeneratorExecutionContext executionContext) INamedTypeSymbol contextTypeSymbol = (INamedTypeSymbol)compilationSemanticModel.GetDeclaredSymbol(classDeclarationSyntax); Debug.Assert(contextTypeSymbol != null); + Location contextLocation = contextTypeSymbol.Locations.Length > 0 ? contextTypeSymbol.Locations[0] : Location.None; + if (!TryGetClassDeclarationList(contextTypeSymbol, out List classDeclarationList)) { // Class or one of its containing types is not partial so we can't add to it. - _executionContext.ReportDiagnostic(Diagnostic.Create(ContextClassesMustBePartial, Location.None, new string[] { contextTypeSymbol.Name })); + _sourceGenerationContext.ReportDiagnostic(Diagnostic.Create(ContextClassesMustBePartial, contextLocation, new string[] { contextTypeSymbol.Name })); continue; } ContextGenerationSpec contextGenSpec = new() { + Location = contextLocation, GenerationOptions = options ?? new JsonSourceGenerationOptionsAttribute(), ContextType = contextTypeSymbol.AsType(_metadataLoadContext), ContextClassDeclarationList = classDeclarationList @@ -226,14 +337,31 @@ public Parser(in GeneratorExecutionContext executionContext) continue; } + // Emit type-level diagnostics + foreach ((Type Type, DiagnosticDescriptor Descriptor, string[] MessageArgs) diagnostic in _typeLevelDiagnostics) + { + Type type = diagnostic.Type; + Location location = type.GetDiagnosticLocation(); + + if (location == null) + { + TypeGenerationSpec spec = _typeGenerationSpecCache[type]; + location = spec.AttributeLocation; + } + + location ??= contextLocation; + _sourceGenerationContext.ReportDiagnostic(Diagnostic.Create(diagnostic.Descriptor, location, diagnostic.MessageArgs)); + } + contextGenSpec.ImplicitlyRegisteredTypes.UnionWith(_implicitlyRegisteredTypes); contextGenSpecList ??= new List(); contextGenSpecList.Add(contextGenSpec); - // Clear the cache of generated metadata between the processing of context classes. + // Clear the caches of generated metadata between the processing of context classes. _typeGenerationSpecCache.Clear(); _implicitlyRegisteredTypes.Clear(); + _typeLevelDiagnostics.Clear(); } if (contextGenSpecList == null) @@ -252,6 +380,9 @@ public Parser(in GeneratorExecutionContext executionContext) GuidType = _guidType, StringType = _stringType, NumberTypes = _numberTypes, +#if DEBUG + MetadataLoadContext = _metadataLoadContext, +#endif }; } @@ -397,9 +528,41 @@ private static bool TryGetClassDeclarationList(INamedTypeSymbol typeSymbol, [Not typeGenerationSpec.GenerationMode = generationMode; } + typeGenerationSpec.AttributeLocation = attributeSyntax.GetLocation(); + return typeGenerationSpec; } + internal static bool IsSyntaxTargetForGeneration(SyntaxNode node) => node is ClassDeclarationSyntax { AttributeLists: { Count: > 0 }, BaseList: { Types : {Count : > 0 } } }; + + internal static ClassDeclarationSyntax? GetSemanticTargetForGeneration(GeneratorSyntaxContext context) + { + var classDeclarationSyntax = (ClassDeclarationSyntax)context.Node; + + foreach (AttributeListSyntax attributeListSyntax in classDeclarationSyntax.AttributeLists) + { + foreach (AttributeSyntax attributeSyntax in attributeListSyntax.Attributes) + { + IMethodSymbol attributeSymbol = context.SemanticModel.GetSymbolInfo(attributeSyntax).Symbol as IMethodSymbol; + if (attributeSymbol == null) + { + continue; + } + + INamedTypeSymbol attributeContainingTypeSymbol = attributeSymbol.ContainingType; + string fullName = attributeContainingTypeSymbol.ToDisplayString(); + + if (fullName == "System.Text.Json.Serialization.JsonSerializableAttribute") + { + return classDeclarationSyntax; + } + } + + } + + return null; + } + private static JsonSourceGenerationMode? GetJsonSourceGenerationModeEnumVal(SyntaxNode propertyValueMode) { IEnumerable enumTokens = propertyValueMode @@ -465,14 +628,6 @@ private static bool TryGetClassDeclarationList(INamedTypeSymbol typeSymbol, [Not } } break; - case nameof(JsonSourceGenerationOptionsAttribute.IgnoreRuntimeCustomConverters): - { - if (bool.TryParse(propertyValueStr, out bool value)) - { - options.IgnoreRuntimeCustomConverters = value; - } - } - break; case nameof(JsonSourceGenerationOptionsAttribute.IncludeFields): { if (bool.TryParse(propertyValueStr, out bool value)) @@ -526,9 +681,11 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener _typeGenerationSpecCache[type] = typeMetadata; ClassType classType; - Type? collectionKeyType = null; - Type? collectionValueType = null; + TypeGenerationSpec? collectionKeyTypeSpec = null; + TypeGenerationSpec? collectionValueTypeSpec = null; TypeGenerationSpec? nullableUnderlyingTypeGenSpec = null; + TypeGenerationSpec? dataExtensionPropGenSpec = null; + string? runtimeTypeRef = null; List? propGenSpecList = null; ObjectConstructionStrategy constructionStrategy = default; ParameterGenerationSpec[]? paramGenSpecArray = null; @@ -538,6 +695,10 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener string? converterInstatiationLogic = null; bool implementsIJsonOnSerialized = false; bool implementsIJsonOnSerializing = false; + bool hasInitOnlyProperties = false; + bool hasTypeFactoryConverter = false; + bool hasPropertyFactoryConverters = false; + bool canContainNullableReferenceAnnotations = type.CanContainNullableReferenceTypeAnnotations(); IList attributeDataList = CustomAttributeData.GetCustomAttributes(type); foreach (CustomAttributeData attributeData in attributeDataList) @@ -552,7 +713,11 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener else if (!foundDesignTimeCustomConverter && attributeType.GetCompatibleBaseClass(JsonConverterAttributeFullName) != null) { foundDesignTimeCustomConverter = true; - converterInstatiationLogic = GetConverterInstantiationLogic(attributeData); + converterInstatiationLogic = GetConverterInstantiationLogic( + type, + attributeData, + forType: true, + ref hasTypeFactoryConverter); } } @@ -585,6 +750,9 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener } Type actualTypeToConvert; + Type? keyType = null; + Type valueType; + bool needsRuntimeType = false; if (type.IsArray) { @@ -592,13 +760,13 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener ? ClassType.TypeUnsupportedBySourceGen // Multi-dimentional arrays are not supported in STJ. : ClassType.Enumerable; collectionType = CollectionType.Array; - collectionValueType = type.GetElementType(); + valueType = type.GetElementType(); } else if ((actualTypeToConvert = GetCompatibleGenericBaseClass(type, _listOfTType)) != null) { classType = ClassType.Enumerable; collectionType = CollectionType.List; - collectionValueType = actualTypeToConvert.GetGenericArguments()[0]; + valueType = actualTypeToConvert.GetGenericArguments()[0]; } else if ((actualTypeToConvert = GetCompatibleGenericBaseClass(type, _dictionaryType)) != null) { @@ -606,8 +774,8 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener collectionType = CollectionType.Dictionary; Type[] genericArgs = actualTypeToConvert.GetGenericArguments(); - collectionKeyType = genericArgs[0]; - collectionValueType = genericArgs[1]; + keyType = genericArgs[0]; + valueType = genericArgs[1]; } else if (type.IsImmutableDictionaryType(sourceGenType: true)) { @@ -615,8 +783,8 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener collectionType = CollectionType.ImmutableDictionary; Type[] genericArgs = type.GetGenericArguments(); - collectionKeyType = genericArgs[0]; - collectionValueType = genericArgs[1]; + keyType = genericArgs[0]; + valueType = genericArgs[1]; } else if ((actualTypeToConvert = type.GetCompatibleGenericInterface(_idictionaryOfTKeyTValueType)) != null) { @@ -624,8 +792,10 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener collectionType = CollectionType.IDictionaryOfTKeyTValue; Type[] genericArgs = actualTypeToConvert.GetGenericArguments(); - collectionKeyType = genericArgs[0]; - collectionValueType = genericArgs[1]; + keyType = genericArgs[0]; + valueType = genericArgs[1]; + + needsRuntimeType = type == actualTypeToConvert; } else if ((actualTypeToConvert = type.GetCompatibleGenericInterface(_ireadonlyDictionaryType)) != null) { @@ -633,95 +803,117 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener collectionType = CollectionType.IReadOnlyDictionary; Type[] genericArgs = actualTypeToConvert.GetGenericArguments(); - collectionKeyType = genericArgs[0]; - collectionValueType = genericArgs[1]; + keyType = genericArgs[0]; + valueType = genericArgs[1]; + + needsRuntimeType = type == actualTypeToConvert; } else if (type.IsImmutableEnumerableType(sourceGenType: true)) { classType = ClassType.Enumerable; collectionType = CollectionType.ImmutableEnumerable; - collectionValueType = type.GetGenericArguments()[0]; + valueType = type.GetGenericArguments()[0]; } else if ((actualTypeToConvert = type.GetCompatibleGenericInterface(_ilistOfTType)) != null) { classType = ClassType.Enumerable; collectionType = CollectionType.IListOfT; - collectionValueType = actualTypeToConvert.GetGenericArguments()[0]; + valueType = actualTypeToConvert.GetGenericArguments()[0]; } else if ((actualTypeToConvert = type.GetCompatibleGenericInterface(_isetType)) != null) { classType = ClassType.Enumerable; collectionType = CollectionType.ISet; - collectionValueType = actualTypeToConvert.GetGenericArguments()[0]; + valueType = actualTypeToConvert.GetGenericArguments()[0]; } else if ((actualTypeToConvert = type.GetCompatibleGenericInterface(_icollectionOfTType)) != null) { classType = ClassType.Enumerable; collectionType = CollectionType.ICollectionOfT; - collectionValueType = actualTypeToConvert.GetGenericArguments()[0]; + valueType = actualTypeToConvert.GetGenericArguments()[0]; } else if ((actualTypeToConvert = GetCompatibleGenericBaseClass(type, _stackOfTType)) != null) { classType = ClassType.Enumerable; collectionType = CollectionType.StackOfT; - collectionValueType = actualTypeToConvert.GetGenericArguments()[0]; + valueType = actualTypeToConvert.GetGenericArguments()[0]; } else if ((actualTypeToConvert = GetCompatibleGenericBaseClass(type, _queueOfTType)) != null) { classType = ClassType.Enumerable; collectionType = CollectionType.QueueOfT; - collectionValueType = actualTypeToConvert.GetGenericArguments()[0]; + valueType = actualTypeToConvert.GetGenericArguments()[0]; } else if ((actualTypeToConvert = type.GetCompatibleGenericBaseClass(_concurrentStackType, _objectType, sourceGenType: true)) != null) { classType = ClassType.Enumerable; collectionType = CollectionType.ConcurrentStack; - collectionValueType = actualTypeToConvert.GetGenericArguments()[0]; + valueType = actualTypeToConvert.GetGenericArguments()[0]; } else if ((actualTypeToConvert = type.GetCompatibleGenericBaseClass(_concurrentQueueType, _objectType, sourceGenType: true)) != null) { classType = ClassType.Enumerable; collectionType = CollectionType.ConcurrentQueue; - collectionValueType = actualTypeToConvert.GetGenericArguments()[0]; + valueType = actualTypeToConvert.GetGenericArguments()[0]; } else if ((actualTypeToConvert = type.GetCompatibleGenericInterface(_ienumerableOfTType)) != null) { classType = ClassType.Enumerable; collectionType = CollectionType.IEnumerableOfT; - collectionValueType = actualTypeToConvert.GetGenericArguments()[0]; + valueType = actualTypeToConvert.GetGenericArguments()[0]; } else if (_idictionaryType.IsAssignableFrom(type)) { classType = ClassType.Dictionary; collectionType = CollectionType.IDictionary; - collectionKeyType = _stringType; - collectionValueType = _objectType; + keyType = _stringType; + valueType = _objectType; + + needsRuntimeType = type == actualTypeToConvert; } else if (_ilistType.IsAssignableFrom(type)) { classType = ClassType.Enumerable; collectionType = CollectionType.IList; - collectionValueType = _objectType; + valueType = _objectType; } else if (_stackType.IsAssignableFrom(type)) { classType = ClassType.Enumerable; collectionType = CollectionType.Stack; - collectionValueType = _objectType; + valueType = _objectType; } else if (_queueType.IsAssignableFrom(type)) { classType = ClassType.Enumerable; collectionType = CollectionType.Queue; - collectionValueType = _objectType; + valueType = _objectType; } else { classType = ClassType.Enumerable; collectionType = CollectionType.IEnumerable; - collectionValueType = _objectType; + valueType = _objectType; + } + + collectionValueTypeSpec = GetOrAddTypeGenerationSpec(valueType, generationMode); + + if (keyType != null) + { + collectionKeyTypeSpec = GetOrAddTypeGenerationSpec(keyType, generationMode); + + if (needsRuntimeType) + { + runtimeTypeRef = GetDictionaryTypeRef(collectionKeyTypeSpec, collectionValueTypeSpec); + } } } + else if (_knownUnsupportedTypes.Contains(type) || + ImplementsIAsyncEnumerableInterface(type) || + _delegateType.IsAssignableFrom(type)) + { + classType = ClassType.KnownUnsupportedType; + } else { bool useDefaultCtorInAnnotatedStructs = !type.IsKeyValuePair(_keyValuePair); @@ -729,7 +921,7 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener if (!type.TryGetDeserializationConstructor(useDefaultCtorInAnnotatedStructs, out ConstructorInfo? constructor)) { classType = ClassType.TypeUnsupportedBySourceGen; - _executionContext.ReportDiagnostic(Diagnostic.Create(MultipleJsonConstructorAttribute, Location.None, new string[] { $"{type}" })); + _typeLevelDiagnostics.Add((type, MultipleJsonConstructorAttribute, new string[] { $"{type}" })); } else { @@ -783,6 +975,8 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener for (Type? currentType = type; currentType != null; currentType = currentType.BaseType) { + PropertyGenerationSpec spec; + foreach (PropertyInfo propertyInfo in currentType.GetProperties(bindingFlags)) { bool isVirtual = propertyInfo.IsVirtual(); @@ -793,9 +987,8 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener continue; } - PropertyGenerationSpec spec = GetPropertyGenerationSpec(propertyInfo, isVirtual, generationMode); - CacheMember(spec, ref propGenSpecList, ref ignoredMembers); - propertyOrderSpecified |= spec.Order != 0; + spec = GetPropertyGenerationSpec(propertyInfo, isVirtual, generationMode); + CacheMemberHelper(propertyInfo.GetDiagnosticLocation()); } foreach (FieldInfo fieldInfo in currentType.GetFields(bindingFlags)) @@ -805,9 +998,47 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener continue; } - PropertyGenerationSpec spec = GetPropertyGenerationSpec(fieldInfo, isVirtual: false, generationMode); + spec = GetPropertyGenerationSpec(fieldInfo, isVirtual: false, generationMode); + CacheMemberHelper(fieldInfo.GetDiagnosticLocation()); + } + + void CacheMemberHelper(Location memberLocation) + { CacheMember(spec, ref propGenSpecList, ref ignoredMembers); + propertyOrderSpecified |= spec.Order != 0; + hasPropertyFactoryConverters |= spec.HasFactoryConverter; + + // The property type may be implicitly in the context, so add that as well. + hasTypeFactoryConverter |= spec.TypeGenerationSpec.HasTypeFactoryConverter; + + if (spec.IsExtensionData) + { + if (dataExtensionPropGenSpec != null) + { + _typeLevelDiagnostics.Add((type, MultipleJsonExtensionDataAttribute, new string[] { type.Name })); + } + + Type propType = spec.TypeGenerationSpec.Type; + if (!IsValidDataExtensionPropertyType(propType)) + { + _sourceGenerationContext.ReportDiagnostic(Diagnostic.Create(DataExtensionPropertyInvalid, memberLocation, new string[] { type.Name, spec.ClrName })); + } + + dataExtensionPropGenSpec = GetOrAddTypeGenerationSpec(propType, generationMode); + _implicitlyRegisteredTypes.Add(dataExtensionPropGenSpec); + } + + if (!hasInitOnlyProperties && spec.CanUseSetter && spec.IsInitOnlySetter) + { + _sourceGenerationContext.ReportDiagnostic(Diagnostic.Create(InitOnlyPropertyDeserializationNotSupported, memberLocation, new string[] { type.Name })); + hasInitOnlyProperties = true; + } + + if (spec.HasJsonInclude && (!spec.CanUseGetter || !spec.CanUseSetter || !spec.IsPublic)) + { + _sourceGenerationContext.ReportDiagnostic(Diagnostic.Create(InaccessibleJsonIncludePropertiesNotSupported, memberLocation, new string[] { type.Name, spec.ClrName })); + } } } @@ -826,17 +1057,52 @@ private TypeGenerationSpec GetOrAddTypeGenerationSpec(Type type, JsonSourceGener propGenSpecList, paramGenSpecArray, collectionType, - collectionKeyTypeMetadata: collectionKeyType != null ? GetOrAddTypeGenerationSpec(collectionKeyType, generationMode) : null, - collectionValueTypeMetadata: collectionValueType != null ? GetOrAddTypeGenerationSpec(collectionValueType, generationMode) : null, + collectionKeyTypeSpec, + collectionValueTypeSpec, constructionStrategy, nullableUnderlyingTypeMetadata: nullableUnderlyingTypeGenSpec, + runtimeTypeRef, + dataExtensionPropGenSpec, converterInstatiationLogic, - implementsIJsonOnSerialized, - implementsIJsonOnSerializing); + implementsIJsonOnSerialized : implementsIJsonOnSerialized, + implementsIJsonOnSerializing : implementsIJsonOnSerializing, + canContainNullableReferenceAnnotations: canContainNullableReferenceAnnotations, + hasTypeFactoryConverter : hasTypeFactoryConverter, + hasPropertyFactoryConverters : hasPropertyFactoryConverters); return typeMetadata; } + private bool ImplementsIAsyncEnumerableInterface(Type type) + { + if (_iAsyncEnumerableGenericType == null) + { + return false; + } + + return type.GetCompatibleGenericInterface(_iAsyncEnumerableGenericType) is not null; + } + + private static string GetDictionaryTypeRef(TypeGenerationSpec keyType, TypeGenerationSpec valueType) + => $"{DictionaryTypeRef}<{keyType.TypeRef}, {valueType.TypeRef}>"; + + private bool IsValidDataExtensionPropertyType(Type type) + { + if (type == _jsonObjectType) + { + return true; + } + + Type? actualDictionaryType = type.GetCompatibleGenericInterface(_idictionaryOfTKeyTValueType); + if (actualDictionaryType == null) + { + return false; + } + + Type[] genericArguments = actualDictionaryType.GetGenericArguments(); + return genericArguments[0] == _stringType && (genericArguments[1] == _objectType || genericArguments[1] == _jsonElementType); + } + private Type GetCompatibleGenericBaseClass(Type type, Type baseType) => type.GetCompatibleGenericBaseClass(baseType, _objectType); @@ -870,18 +1136,106 @@ private static bool PropertyIsOverridenAndIgnored( ignoredMember.IsVirtual; } - private PropertyGenerationSpec GetPropertyGenerationSpec(MemberInfo memberInfo, bool isVirtual, JsonSourceGenerationMode generationMode) + private PropertyGenerationSpec GetPropertyGenerationSpec( + MemberInfo memberInfo, + bool isVirtual, + JsonSourceGenerationMode generationMode) { + Type memberCLRType = GetMemberClrType(memberInfo); IList attributeDataList = CustomAttributeData.GetCustomAttributes(memberInfo); - bool hasJsonInclude = false; - JsonIgnoreCondition? ignoreCondition = null; - JsonNumberHandling? numberHandling = null; - string? jsonPropertyName = null; + ProcessMemberCustomAttributes( + attributeDataList, + memberCLRType, + out bool hasJsonInclude, + out string? jsonPropertyName, + out JsonIgnoreCondition? ignoreCondition, + out JsonNumberHandling? numberHandling, + out string? converterInstantiationLogic, + out int order, + out bool hasFactoryConverter, + out bool isExtensionData); + + ProcessMember( + memberInfo, + memberCLRType, + hasJsonInclude, + out bool isReadOnly, + out bool isPublic, + out bool canUseGetter, + out bool canUseSetter, + out bool getterIsVirtual, + out bool setterIsVirtual, + out bool setterIsInitOnly); + + string clrName = memberInfo.Name; + string runtimePropertyName = DetermineRuntimePropName(clrName, jsonPropertyName, _currentContextNamingPolicy); + string propertyNameVarName = DeterminePropNameIdentifier(runtimePropertyName); + + return new PropertyGenerationSpec + { + ClrName = clrName, + IsProperty = memberInfo.MemberType == MemberTypes.Property, + IsPublic = isPublic, + IsVirtual = isVirtual, + JsonPropertyName = jsonPropertyName, + RuntimePropertyName = runtimePropertyName, + PropertyNameVarName = propertyNameVarName, + IsReadOnly = isReadOnly, + IsInitOnlySetter = setterIsInitOnly, + CanUseGetter = canUseGetter, + CanUseSetter = canUseSetter, + GetterIsVirtual = getterIsVirtual, + SetterIsVirtual = setterIsVirtual, + DefaultIgnoreCondition = ignoreCondition, + NumberHandling = numberHandling, + Order = order, + HasJsonInclude = hasJsonInclude, + IsExtensionData = isExtensionData, + TypeGenerationSpec = GetOrAddTypeGenerationSpec(memberCLRType, generationMode), + DeclaringTypeRef = memberInfo.DeclaringType.GetCompilableName(), + ConverterInstantiationLogic = converterInstantiationLogic, + HasFactoryConverter = hasFactoryConverter + }; + } + + private Type GetMemberClrType(MemberInfo memberInfo) + { + if (memberInfo is PropertyInfo propertyInfo) + { + return propertyInfo.PropertyType; + } + + if (memberInfo is FieldInfo fieldInfo) + { + return fieldInfo.FieldType; + } + + throw new InvalidOperationException(); + } + + private void ProcessMemberCustomAttributes( + IList attributeDataList, + Type memberCLRType, + out bool hasJsonInclude, + out string? jsonPropertyName, + out JsonIgnoreCondition? ignoreCondition, + out JsonNumberHandling? numberHandling, + out string? converterInstantiationLogic, + out int order, + out bool hasFactoryConverter, + out bool isExtensionData) + { + hasJsonInclude = false; + jsonPropertyName = null; + ignoreCondition = default; + numberHandling = default; + converterInstantiationLogic = null; + order = 0; + isExtensionData = false; bool foundDesignTimeCustomConverter = false; - string? converterInstantiationLogic = null; - int order = 0; + hasFactoryConverter = false; foreach (CustomAttributeData attributeData in attributeDataList) { @@ -890,7 +1244,11 @@ private PropertyGenerationSpec GetPropertyGenerationSpec(MemberInfo memberInfo, if (!foundDesignTimeCustomConverter && attributeType.GetCompatibleBaseClass(JsonConverterAttributeFullName) != null) { foundDesignTimeCustomConverter = true; - converterInstantiationLogic = GetConverterInstantiationLogic(attributeData); + converterInstantiationLogic = GetConverterInstantiationLogic( + memberCLRType, + attributeData, + forType: false, + ref hasFactoryConverter); } else if (attributeType.Assembly.FullName == SystemTextJsonNamespace) { @@ -936,26 +1294,41 @@ private PropertyGenerationSpec GetPropertyGenerationSpec(MemberInfo memberInfo, order = (int)ctorArgs[0].Value; } break; + case JsonExtensionDataAttributeFullName: + { + isExtensionData = true; + } + break; default: break; } } } + } - Type memberCLRType; - bool isReadOnly; - bool isPublic = false; - bool canUseGetter = false; - bool canUseSetter = false; - bool getterIsVirtual = false; - bool setterIsVirtual = false; + private static void ProcessMember( + MemberInfo memberInfo, + Type memberClrType, + bool hasJsonInclude, + out bool isReadOnly, + out bool isPublic, + out bool canUseGetter, + out bool canUseSetter, + out bool getterIsVirtual, + out bool setterIsVirtual, + out bool setterIsInitOnly) + { + isPublic = false; + canUseGetter = false; + canUseSetter = false; + getterIsVirtual = false; + setterIsVirtual = false; + setterIsInitOnly = false; switch (memberInfo) { case PropertyInfo propertyInfo: { - memberCLRType = propertyInfo.PropertyType; - MethodInfo? getMethod = propertyInfo.GetMethod; MethodInfo? setMethod = propertyInfo.SetMethod; @@ -977,15 +1350,16 @@ private PropertyGenerationSpec GetPropertyGenerationSpec(MemberInfo memberInfo, if (setMethod != null) { isReadOnly = false; + setterIsInitOnly = setMethod.IsInitOnly(); if (setMethod.IsPublic) { isPublic = true; - canUseSetter = !setMethod.IsInitOnly(); + canUseSetter = true; } else if (setMethod.IsAssembly) { - canUseSetter = hasJsonInclude && !setMethod.IsInitOnly(); + canUseSetter = hasJsonInclude; } setterIsVirtual = setMethod.IsVirtual; @@ -998,7 +1372,6 @@ private PropertyGenerationSpec GetPropertyGenerationSpec(MemberInfo memberInfo, break; case FieldInfo fieldInfo: { - memberCLRType = fieldInfo.FieldType; isPublic = fieldInfo.IsPublic; isReadOnly = fieldInfo.IsInitOnly; @@ -1012,36 +1385,15 @@ private PropertyGenerationSpec GetPropertyGenerationSpec(MemberInfo memberInfo, default: throw new InvalidOperationException(); } - - string clrName = memberInfo.Name; - - return new PropertyGenerationSpec - { - ClrName = clrName, - IsProperty = memberInfo.MemberType == MemberTypes.Property, - IsPublic = isPublic, - IsVirtual = isVirtual, - JsonPropertyName = jsonPropertyName, - RuntimePropertyName = DetermineRuntimePropName(clrName, jsonPropertyName, _currentContextNamingPolicy), - IsReadOnly = isReadOnly, - CanUseGetter = canUseGetter, - CanUseSetter = canUseSetter, - GetterIsVirtual = getterIsVirtual, - SetterIsVirtual = setterIsVirtual, - DefaultIgnoreCondition = ignoreCondition, - NumberHandling = numberHandling, - Order = order, - HasJsonInclude = hasJsonInclude, - TypeGenerationSpec = GetOrAddTypeGenerationSpec(memberCLRType, generationMode), - DeclaringTypeRef = memberInfo.DeclaringType.GetCompilableName(), - ConverterInstantiationLogic = converterInstantiationLogic - }; } private static bool PropertyAccessorCanBeReferenced(MethodInfo? accessor) => accessor != null && (accessor.IsPublic || accessor.IsAssembly); - private string? GetConverterInstantiationLogic(CustomAttributeData attributeData) + private string? GetConverterInstantiationLogic( + Type type, CustomAttributeData attributeData, + bool forType, // whether for a type or a property + ref bool hasFactoryConverter) { if (attributeData.AttributeType.FullName != JsonConverterAttributeFullName) { @@ -1056,7 +1408,28 @@ private static bool PropertyAccessorCanBeReferenced(MethodInfo? accessor) return null; } - return $"new {converterType.GetCompilableName()}()"; + // Validated when creating the source generation spec. + Debug.Assert(_jsonConverterOfTType != null); + + if (converterType.GetCompatibleGenericBaseClass(_jsonConverterOfTType) != null) + { + return $"new {converterType.GetCompilableName()}()"; + } + else if (converterType.GetCompatibleBaseClass(JsonConverterFactoryFullName) != null) + { + hasFactoryConverter = true; + + if (forType) + { + return $"{Emitter.GetConverterFromFactoryMethodName}(typeof({type.GetCompilableName()}), new {converterType.GetCompilableName()}())"; + } + else + { + return $"{Emitter.JsonContextVarName}.{Emitter.GetConverterFromFactoryMethodName}<{type.GetCompilableName()}>(new {converterType.GetCompilableName()}())"; + } + } + + return null; } private static string DetermineRuntimePropName(string clrPropName, string? jsonPropName, JsonKnownNamingPolicy namingPolicy) @@ -1079,6 +1452,37 @@ private static string DetermineRuntimePropName(string clrPropName, string? jsonP return runtimePropName; } + private static string DeterminePropNameIdentifier(string runtimePropName) + { + const string PropName = "PropName_"; + + // Use a different prefix to avoid possible collisions with "PropName_" in + // the rare case there is a C# property in a hex format. + const string EncodedPropName = "EncodedPropName_"; + + if (SyntaxFacts.IsValidIdentifier(runtimePropName)) + { + return PropName + runtimePropName; + } + + // Encode the string to a byte[] and then convert to hexadecimal. + // To make the generated code more readable, we could use a different strategy in the future + // such as including the full class name + the CLR property name when there are duplicates, + // but that will create unnecessary JsonEncodedText properties. + byte[] utf8Json = Encoding.UTF8.GetBytes(runtimePropName); + + StringBuilder sb = new StringBuilder( + EncodedPropName, + capacity: EncodedPropName.Length + utf8Json.Length * 2); + + for (int i = 0; i < utf8Json.Length; i++) + { + sb.Append(utf8Json[i].ToString("X2")); // X2 is hex format + } + + return sb.ToString(); + } + private void PopulateNumberTypes() { Debug.Assert(_numberTypes != null); @@ -1098,21 +1502,45 @@ private void PopulateNumberTypes() private void PopulateKnownTypes() { PopulateNumberTypes(); + Debug.Assert(_knownTypes != null); Debug.Assert(_numberTypes != null); + Debug.Assert(_knownUnsupportedTypes != null); _knownTypes.UnionWith(_numberTypes); _knownTypes.Add(_booleanType); - _knownTypes.Add(_byteArrayType); _knownTypes.Add(_charType); _knownTypes.Add(_dateTimeType); - _knownTypes.Add(_dateTimeOffsetType); - _knownTypes.Add(_guidType); _knownTypes.Add(_objectType); _knownTypes.Add(_stringType); - _knownTypes.Add(_uriType); - _knownTypes.Add(_versionType); - _knownTypes.Add(_jsonElementType); + + AddTypeIfNotNull(_knownTypes, _byteArrayType); + AddTypeIfNotNull(_knownTypes, _timeSpanType); + AddTypeIfNotNull(_knownTypes, _dateTimeOffsetType); + AddTypeIfNotNull(_knownTypes, _guidType); + AddTypeIfNotNull(_knownTypes, _uriType); + AddTypeIfNotNull(_knownTypes, _versionType); + AddTypeIfNotNull(_knownTypes, _jsonArrayType); + AddTypeIfNotNull(_knownTypes, _jsonElementType); + AddTypeIfNotNull(_knownTypes, _jsonNodeType); + AddTypeIfNotNull(_knownTypes, _jsonObjectType); + AddTypeIfNotNull(_knownTypes, _jsonValueType); + + _knownUnsupportedTypes.Add(_typeType); + _knownUnsupportedTypes.Add(_serializationInfoType); + _knownUnsupportedTypes.Add(_intPtrType); + _knownUnsupportedTypes.Add(_uIntPtrType); + + AddTypeIfNotNull(_knownUnsupportedTypes, _dateOnlyType); + AddTypeIfNotNull(_knownUnsupportedTypes, _timeOnlyType); + + static void AddTypeIfNotNull(HashSet types, Type? type) + { + if (type != null) + { + types.Add(type); + } + } } } } diff --git a/src/libraries/System.Text.Json/gen/JsonSourceGenerator.cs b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Roslyn3.11.cs similarity index 58% rename from src/libraries/System.Text.Json/gen/JsonSourceGenerator.cs rename to src/libraries/System.Text.Json/gen/JsonSourceGenerator.Roslyn3.11.cs index 51b548e57892ba..6fd0dedabb8ab8 100644 --- a/src/libraries/System.Text.Json/gen/JsonSourceGenerator.cs +++ b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Roslyn3.11.cs @@ -1,7 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +//#define LAUNCH_DEBUGGER using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Reflection; @@ -9,6 +11,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Text; namespace System.Text.Json.SourceGeneration { @@ -24,7 +27,7 @@ public sealed partial class JsonSourceGenerator : ISourceGenerator /// public void Initialize(GeneratorInitializationContext context) { - context.RegisterForSyntaxNotifications(() => new SyntaxReceiver()); + context.RegisterForSyntaxNotifications(() => new SyntaxContextReceiver()); } /// @@ -39,33 +42,37 @@ public void Execute(GeneratorExecutionContext executionContext) Diagnostics.Debugger.Launch(); } #endif - SyntaxReceiver receiver = (SyntaxReceiver)executionContext.SyntaxReceiver; - List? contextClasses = receiver.ClassDeclarationSyntaxList; - if (contextClasses == null) + if (executionContext.SyntaxContextReceiver is not SyntaxContextReceiver receiver || receiver.ClassDeclarationSyntaxList == null) { + // nothing to do yet return; } - Parser parser = new(executionContext); + JsonSourceGenerationContext context = new JsonSourceGenerationContext(executionContext); + Parser parser = new(executionContext.Compilation, context); SourceGenerationSpec? spec = parser.GetGenerationSpec(receiver.ClassDeclarationSyntaxList); if (spec != null) { _rootTypes = spec.ContextGenerationSpecList[0].RootSerializableTypes; - Emitter emitter = new(executionContext, spec); + Emitter emitter = new(context, spec); emitter.Emit(); } } - private sealed class SyntaxReceiver : ISyntaxReceiver + private sealed class SyntaxContextReceiver : ISyntaxContextReceiver { public List? ClassDeclarationSyntaxList { get; private set; } - public void OnVisitSyntaxNode(SyntaxNode syntaxNode) + public void OnVisitSyntaxNode(GeneratorSyntaxContext context) { - if (syntaxNode is ClassDeclarationSyntax cds) + if (Parser.IsSyntaxTargetForGeneration(context.Node)) { - (ClassDeclarationSyntaxList ??= new List()).Add(cds); + ClassDeclarationSyntax classSyntax = Parser.GetSemanticTargetForGeneration(context); + if (classSyntax != null) + { + (ClassDeclarationSyntaxList ??= new List()).Add(classSyntax); + } } } } @@ -76,4 +83,24 @@ public void OnVisitSyntaxNode(SyntaxNode syntaxNode) public Dictionary? GetSerializableTypes() => _rootTypes?.ToDictionary(p => p.Type.FullName, p => p.Type); private List? _rootTypes; } + + internal readonly struct JsonSourceGenerationContext + { + private readonly GeneratorExecutionContext _context; + + public JsonSourceGenerationContext(GeneratorExecutionContext context) + { + _context = context; + } + + public void ReportDiagnostic(Diagnostic diagnostic) + { + _context.ReportDiagnostic(diagnostic); + } + + public void AddSource(string hintName, SourceText sourceText) + { + _context.AddSource(hintName, sourceText); + } + } } diff --git a/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Roslyn4.0.cs b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Roslyn4.0.cs new file mode 100644 index 00000000000000..00ceb2af04c36d --- /dev/null +++ b/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Roslyn4.0.cs @@ -0,0 +1,91 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +//#define LAUNCH_DEBUGGER +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Text.Json.Reflection; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.DotnetRuntime.Extensions; +using Microsoft.CodeAnalysis.Text; + +namespace System.Text.Json.SourceGeneration +{ + /// + /// Generates source code to optimize serialization and deserialization with JsonSerializer. + /// + [Generator] + public sealed partial class JsonSourceGenerator : IIncrementalGenerator + { + public void Initialize(IncrementalGeneratorInitializationContext context) + { + IncrementalValuesProvider classDeclarations = context.SyntaxProvider + .ForAttributeWithMetadataName( + context, + Parser.JsonSerializableAttributeFullName, + (node, _) => node is ClassDeclarationSyntax, + (context, _) => (ClassDeclarationSyntax)context.TargetNode); + + IncrementalValueProvider<(Compilation, ImmutableArray)> compilationAndClasses = + context.CompilationProvider.Combine(classDeclarations.Collect()); + + context.RegisterSourceOutput(compilationAndClasses, (spc, source) => Execute(source.Item1, source.Item2, spc)); + } + + private void Execute(Compilation compilation, ImmutableArray contextClasses, SourceProductionContext sourceProductionContext) + { +#if LAUNCH_DEBUGGER + if (!Diagnostics.Debugger.IsAttached) + { + Diagnostics.Debugger.Launch(); + } +#endif + if (contextClasses.IsDefaultOrEmpty) + { + return; + } + + JsonSourceGenerationContext context = new JsonSourceGenerationContext(sourceProductionContext); + Parser parser = new(compilation, context); + SourceGenerationSpec? spec = parser.GetGenerationSpec(contextClasses); + if (spec != null) + { + _rootTypes = spec.ContextGenerationSpecList[0].RootSerializableTypes; + + Emitter emitter = new(context, spec); + emitter.Emit(); + } + } + + /// + /// Helper for unit tests. + /// + public Dictionary? GetSerializableTypes() => _rootTypes?.ToDictionary(p => p.Type.FullName, p => p.Type); + private List? _rootTypes; + } + + internal readonly struct JsonSourceGenerationContext + { + private readonly SourceProductionContext _context; + + public JsonSourceGenerationContext(SourceProductionContext context) + { + _context = context; + } + + public void ReportDiagnostic(Diagnostic diagnostic) + { + _context.ReportDiagnostic(diagnostic); + } + + public void AddSource(string hintName, SourceText sourceText) + { + _context.AddSource(hintName, sourceText); + } + } +} diff --git a/src/libraries/System.Text.Json/gen/PropertyGenerationSpec.cs b/src/libraries/System.Text.Json/gen/PropertyGenerationSpec.cs index 9d05fdf297cddc..c9c4cbd3ddc516 100644 --- a/src/libraries/System.Text.Json/gen/PropertyGenerationSpec.cs +++ b/src/libraries/System.Text.Json/gen/PropertyGenerationSpec.cs @@ -16,6 +16,9 @@ internal sealed class PropertyGenerationSpec /// public bool IsProperty { get; init; } + /// + /// If representing a property, returns true if either the getter or setter are public. + /// public bool IsPublic { get; init; } public bool IsVirtual { get; init; } @@ -32,11 +35,18 @@ internal sealed class PropertyGenerationSpec /// public string RuntimePropertyName { get; init; } + public string PropertyNameVarName { get; init; } + /// /// Whether the property has a set method. /// public bool IsReadOnly { get; init; } + /// + /// Whether the property has an init-only set method. + /// + public bool IsInitOnlySetter { get; init; } + /// /// Whether the property has a public or internal (only usable when JsonIncludeAttribute is specified) /// getter that can be referenced in generated source code. @@ -73,6 +83,11 @@ internal sealed class PropertyGenerationSpec /// public bool HasJsonInclude { get; init; } + /// + /// Whether the property has the JsonExtensionDataAttribute. + /// + public bool IsExtensionData { get; init; } + /// /// Generation specification for the property's type. /// @@ -87,5 +102,7 @@ internal sealed class PropertyGenerationSpec /// Source code to instantiate design-time specified custom converter. /// public string? ConverterInstantiationLogic { get; init; } + + public bool HasFactoryConverter { get; init; } } } diff --git a/src/libraries/System.Text.Json/gen/Reflection/FieldInfoWrapper.cs b/src/libraries/System.Text.Json/gen/Reflection/FieldInfoWrapper.cs index 66e00c0de20bb7..d06c264ab04563 100644 --- a/src/libraries/System.Text.Json/gen/Reflection/FieldInfoWrapper.cs +++ b/src/libraries/System.Text.Json/gen/Reflection/FieldInfoWrapper.cs @@ -100,5 +100,7 @@ public override void SetValue(object obj, object value, BindingFlags invokeAttr, { throw new NotImplementedException(); } + + public Location? Location => _field.Locations.Length > 0 ? _field.Locations[0] : null; } } diff --git a/src/libraries/System.Text.Json/gen/Reflection/MetadataLoadContextInternal.cs b/src/libraries/System.Text.Json/gen/Reflection/MetadataLoadContextInternal.cs index c088cc6d7e1cbf..e04adf3c21c308 100644 --- a/src/libraries/System.Text.Json/gen/Reflection/MetadataLoadContextInternal.cs +++ b/src/libraries/System.Text.Json/gen/Reflection/MetadataLoadContextInternal.cs @@ -3,10 +3,12 @@ using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.DotnetRuntime.Extensions; namespace System.Text.Json.Reflection { @@ -19,11 +21,17 @@ public MetadataLoadContextInternal(Compilation compilation) _compilation = compilation; } - public Type? Resolve(Type type) => Resolve(type.FullName!); + public Compilation Compilation => _compilation; + + public Type? Resolve(Type type) + { + Debug.Assert(!type.IsArray, "Resolution logic only capable of handling named types."); + return Resolve(type.FullName!); + } public Type? Resolve(string fullyQualifiedMetadataName) { - INamedTypeSymbol? typeSymbol = _compilation.GetTypeByMetadataName(fullyQualifiedMetadataName); + INamedTypeSymbol? typeSymbol = _compilation.GetBestTypeByMetadataName(fullyQualifiedMetadataName); return typeSymbol.AsType(this); } diff --git a/src/libraries/System.Text.Json/gen/Reflection/PropertyInfoWrapper.cs b/src/libraries/System.Text.Json/gen/Reflection/PropertyInfoWrapper.cs index bfb593f992fbd0..d7eea3323416ba 100644 --- a/src/libraries/System.Text.Json/gen/Reflection/PropertyInfoWrapper.cs +++ b/src/libraries/System.Text.Json/gen/Reflection/PropertyInfoWrapper.cs @@ -92,5 +92,7 @@ public override void SetValue(object obj, object value, BindingFlags invokeAttr, { throw new NotSupportedException(); } + + public Location? Location => _property.Locations.Length > 0 ? _property.Locations[0] : null; } } diff --git a/src/libraries/System.Text.Json/gen/Reflection/ReflectionExtensions.cs b/src/libraries/System.Text.Json/gen/Reflection/ReflectionExtensions.cs index 101f3e48fbfb7e..d0bc8e59b147c2 100644 --- a/src/libraries/System.Text.Json/gen/Reflection/ReflectionExtensions.cs +++ b/src/libraries/System.Text.Json/gen/Reflection/ReflectionExtensions.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Linq; using System.Reflection; +using Microsoft.CodeAnalysis; namespace System.Text.Json.Reflection { @@ -45,5 +46,23 @@ private static bool HasJsonConstructorAttribute(ConstructorInfo constructorInfo) return false; } + + public static Location? GetDiagnosticLocation(this Type type) + { + Debug.Assert(type is TypeWrapper); + return ((TypeWrapper)type).Location; + } + + public static Location? GetDiagnosticLocation(this PropertyInfo propertyInfo) + { + Debug.Assert(propertyInfo is PropertyInfoWrapper); + return ((PropertyInfoWrapper)propertyInfo).Location; + } + + public static Location? GetDiagnosticLocation(this FieldInfo fieldInfo) + { + Debug.Assert(fieldInfo is FieldInfoWrapper); + return ((FieldInfoWrapper)fieldInfo).Location; + } } } diff --git a/src/libraries/System.Text.Json/gen/Reflection/RoslynExtensions.cs b/src/libraries/System.Text.Json/gen/Reflection/RoslynExtensions.cs index 4e2479784de13e..37c7217a919cc7 100644 --- a/src/libraries/System.Text.Json/gen/Reflection/RoslynExtensions.cs +++ b/src/libraries/System.Text.Json/gen/Reflection/RoslynExtensions.cs @@ -37,7 +37,7 @@ public static MethodAttributes GetMethodAttributes(this IMethodSymbol methodSymb if (methodSymbol.IsAbstract) { - attributes |= MethodAttributes.Abstract; + attributes |= MethodAttributes.Abstract | MethodAttributes.Virtual; } if (methodSymbol.IsStatic) @@ -67,3 +67,4 @@ public static MethodAttributes GetMethodAttributes(this IMethodSymbol methodSymb } } } + diff --git a/src/libraries/System.Text.Json/gen/Reflection/TypeExtensions.cs b/src/libraries/System.Text.Json/gen/Reflection/TypeExtensions.cs index ba20339565cbf9..b5b02c4f7d6556 100644 --- a/src/libraries/System.Text.Json/gen/Reflection/TypeExtensions.cs +++ b/src/libraries/System.Text.Json/gen/Reflection/TypeExtensions.cs @@ -109,6 +109,30 @@ public static bool IsNullableValueType(this Type type, out Type? underlyingType) return false; } + public static bool CanContainNullableReferenceTypeAnnotations(this Type type) + { + // Returns true iff Type instance has potential for receiving nullable reference type annotations, + // i.e. the type is a reference type or contains generic parameters that are reference types. + + if (!type.IsValueType) + { + return true; + } + + if (type.IsGenericType) + { + foreach (Type genericParam in type.GetGenericArguments()) + { + if (CanContainNullableReferenceTypeAnnotations(genericParam)) + { + return true; + } + } + } + + return false; + } + public static bool IsObjectType(this Type type) => type.FullName == "System.Object"; public static bool IsStringType(this Type type) => type.FullName == "System.String"; diff --git a/src/libraries/System.Text.Json/gen/Reflection/TypeWrapper.cs b/src/libraries/System.Text.Json/gen/Reflection/TypeWrapper.cs index 50d76bf0e2878e..c084c6f614823c 100644 --- a/src/libraries/System.Text.Json/gen/Reflection/TypeWrapper.cs +++ b/src/libraries/System.Text.Json/gen/Reflection/TypeWrapper.cs @@ -281,6 +281,11 @@ public override Type GetElementType() return _elementType; } + public override Type MakeArrayType() + { + return _metadataLoadContext.Compilation.CreateArrayTypeSymbol(_typeSymbol).AsType(_metadataLoadContext); + } + public override EventInfo GetEvent(string name, BindingFlags bindingAttr) { throw new NotImplementedException(); @@ -311,7 +316,9 @@ public override FieldInfo[] GetFields(BindingFlags bindingAttr) // we want a static field and this is not static (BindingFlags.Static & bindingAttr) != 0 && !fieldSymbol.IsStatic || // we want an instance field and this is static or a constant - (BindingFlags.Instance & bindingAttr) != 0 && (fieldSymbol.IsStatic || fieldSymbol.IsConst)) + (BindingFlags.Instance & bindingAttr) != 0 && (fieldSymbol.IsStatic || fieldSymbol.IsConst) || + // symbol represents an explicitly named tuple element + fieldSymbol.IsExplicitlyNamedTupleElement) { continue; } @@ -389,12 +396,6 @@ public override PropertyInfo[] GetProperties(BindingFlags bindingAttr) { if (item is IPropertySymbol propertySymbol) { - // Skip auto-generated properties on records. - if (_typeSymbol.IsRecord && propertySymbol.DeclaringSyntaxReferences.Length == 0) - { - continue; - } - // Skip if: if ( // we want a static property and this is not static @@ -593,5 +594,7 @@ public override bool Equals(Type o) } return base.Equals(o); } + + public Location? Location => _typeSymbol.Locations.Length > 0 ? _typeSymbol.Locations[0] : null; } } diff --git a/src/libraries/System.Text.Json/gen/Resources/Strings.resx b/src/libraries/System.Text.Json/gen/Resources/Strings.resx index 5e60f5e377c5d6..1074f0eb468179 100644 --- a/src/libraries/System.Text.Json/gen/Resources/Strings.resx +++ b/src/libraries/System.Text.Json/gen/Resources/Strings.resx @@ -141,4 +141,28 @@ Type has multiple constructors annotated with JsonConstructorAttribute. - \ No newline at end of file + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + Type has multiple members annotated with JsonExtensionDataAttribute. + + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + Data extension property type invalid. + + + Deserialization of init-only properties is currently not supported in source generation mode. + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.cs.xlf index 4bde155b650b24..3b613f37f21660 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.cs.xlf @@ -12,6 +12,16 @@ Odvozené typy JsonSerializerContext a všechny obsahující typy musí být částečné. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. Existuje několik typů s názvem {0}. Zdroj se vygeneroval pro první zjištěný typ. Tuto kolizi vyřešíte pomocí JsonSerializableAttribute.TypeInfoPropertyName. @@ -22,6 +32,26 @@ Duplicitní název typu + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. Typ {0} má více konstruktorů anotovaných s JsonConstructorAttribute. @@ -32,6 +62,16 @@ Typ obsahuje více konstruktorů anotovaných s JsonConstructorAttribute. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. Nevygenerovala se metadata serializace pro typ {0}. diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.de.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.de.xlf index 093d8a6cdb4715..80ee5a4c3927c9 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.de.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.de.xlf @@ -12,6 +12,16 @@ Abgeleitete JsonSerializerContext-Typen und alle enthaltenden Typen müssen partiell sein. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. Es sind mehrere Typen namens "{0}" vorhanden. Die Quelle wurde für den ersten festgestellten Typ generiert. Verwenden Sie "JsonSerializableAttribute.TypeInfoPropertyName", um diesen Konflikt zu beheben. @@ -22,6 +32,26 @@ Doppelter Typname + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. Typ "{0}" weist mehrere Konstruktoren mit dem Kommentar "JsonConstructorAttribute" auf. @@ -32,6 +62,16 @@ Der Typ weist mehrere Konstruktoren mit dem Kommentar JsonConstructorAttribute auf. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. Die Serialisierungsmetadaten für den Typ "{0}" wurden nicht generiert. diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.es.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.es.xlf index ed12d993f5c5a6..383c9b6e1cd3ce 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.es.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.es.xlf @@ -12,6 +12,16 @@ Los tipos derivados "JsonSerializerContext" y todos los tipos que contienen deben ser parciales. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. Hay varios tipos denominados {0}. El origen se generó para el primero detectado. Use "JsonSerializableAttribute.TypeInfoPropertyName" para resolver esta colisión. @@ -22,6 +32,26 @@ Nombre de tipo duplicado. + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. El tipo '{0}' tiene varios constructores anotados con 'JsonConstructorAttribute'. @@ -32,6 +62,16 @@ El tipo tiene varios constructores anotados con JsonConstructorAttribute. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. No generó metadatos de serialización para el tipo '{0}". diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.fr.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.fr.xlf index ddea910bd05ba9..abf9fecd62cf1e 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.fr.xlf @@ -12,6 +12,16 @@ Les types dérivés 'JsonSerializerContext' et tous les types conteneurs doivent être partiels. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. Plusieurs types nommés {0}. La source a été générée pour la première détection détectée. Utilisez « JsonSerializableAttribute.TypeInfoPropertyName » pour résoudre cette collision. @@ -22,6 +32,26 @@ Nom de type dupliqué. + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. Le type' {0} 'a plusieurs constructeurs annotés avec’JsonConstructorAttribute'. @@ -32,6 +62,16 @@ Le type a plusieurs constructeurs annotés avec JsonConstructorAttribute. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. Les métadonnées de sérialisation pour le type « {0} » n’ont pas été générées. diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.it.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.it.xlf index d26aba1c84f9b9..9edb25fc978211 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.it.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.it.xlf @@ -12,6 +12,16 @@ I tipi derivati 'JsonSerializerContext' e tutti i tipi contenenti devono essere parziali. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. Sono presenti più tipi denominati {0}. L'origine è stata generata per il primo tipo rilevato. Per risolvere questa collisione, usare 'JsonSerializableAttribute.TypeInfoPropertyName'. @@ -22,6 +32,26 @@ Nome di tipo duplicato. + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. Il tipo '{0}' contiene più costruttori che presentano l'annotazione 'JsonConstructorAttribute'. @@ -32,6 +62,16 @@ Il tipo contiene più costruttori che presentano l'annotazione JsonConstructorAttribute. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. Non sono stati generati metadati di serializzazione per il tipo '{0}'. diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ja.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ja.xlf index 50270d6c4d401d..b3312d606a2dbd 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ja.xlf @@ -12,6 +12,16 @@ 派生した 'JsonSerializerContext' 型と含まれているすべての型は部分的である必要があります。 + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. {0} と名前が付けられた種類が複数あります。最初に検出されたものに対してソースが生成されました。この問題を解決するには、'JsonSerializableAttribute.TypeInfoPropertyName' を使用します。 @@ -22,6 +32,26 @@ 重複した種類名。 + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. 型 '{0}' には、'JsonConstructorAttribute' で注釈が付けられた複数のコンストラクターがあります。 @@ -32,6 +62,16 @@ 型には、JsonConstructorAttribute で注釈が付けられた複数のコンストラクターがあります。 + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. '{0}'型 のシリアル化メタデータを生成ませんでした。 diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ko.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ko.xlf index a1fd856af18575..1214ae9ffa70c2 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ko.xlf @@ -12,6 +12,16 @@ 파생된 'JsonSerializerContext' 형식과 포함하는 모든 형식은 부분이어야 합니다. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. 이름이 {0}인 형식이 여러 개 있습니다. 처음 검색한 원본에 대해 원본이 생성되었습니다. 이 충돌을 해결하려면 'JsonSerializableAttribute.TypeInfoPropertyName'을 사용하세요. @@ -22,6 +32,26 @@ 중복된 형식 이름입니다. + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. '{0}' 형식에 'JsonConstructorAttribute'로 주석이 추가된 여러 생성자가 있습니다. @@ -32,6 +62,16 @@ 해당 형식에 JsonConstructorAttribute로 주석이 추가된 여러 생성자가 있습니다. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. '{0}' 형식에 대한 직렬화 메타데이터가 생성되지 않았습니다. diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.pl.xlf index e04db80de054be..257006c2b352e0 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.pl.xlf @@ -12,6 +12,16 @@ Pochodne typy "JsonSerializerContext" i wszystkich zawierające typy muszą być częściowe. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. Istnieje wiele typów o nazwie {0}. Wygenerowano źródło dla pierwszego wykrytego elementu. Aby rozwiązać tę kolizję, użyj „JsonSerializableAttribute. TypeInfoPropertyName”. @@ -22,6 +32,26 @@ Zduplikowana nazwa typu. + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. Typ "{0}" ma wiele konstruktorów z adnotacją "JsonConstructorAttribute". @@ -32,6 +62,16 @@ Typ ma wiele konstruktorów z adnotacją JsonConstructorAttribute. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. Nie wygenerowano metadanych serializacji dla typu „{0}”. diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.pt-BR.xlf index bd08c889d012fd..11492c23762969 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.pt-BR.xlf @@ -12,6 +12,16 @@ Os tipos derivados de 'JsonSerializerContext' e todos os tipos contidos devem ser parciais. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. Existem vários tipos chamados {0}. A fonte foi gerada para o primeiro detectado. Use 'JsonSerializableAttribute.TypeInfoPropertyName' para resolver esta colisão. @@ -22,6 +32,26 @@ Nome de tipo duplicado. + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. O tipo '{0}' tem vários construtores anotados com 'JsonConstructorAttribute'. @@ -32,6 +62,16 @@ O tipo tem vários construtores anotados com JsonConstructorAttribute. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. Não gerou metadados de serialização para o tipo '{0}'. diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ru.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ru.xlf index fdd7824a1f54eb..f1bb2a252c0438 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.ru.xlf @@ -12,6 +12,16 @@ Производные типы "JsonSerializerContext" и все содержащие типы должны быть частичными. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. Существует несколько типов с именем {0}. Исходный код сформирован для первого обнаруженного типа. Используйте JsonSerializableAttribute.TypeInfoPropertyName для устранения этого конфликта. @@ -22,6 +32,26 @@ Дублирующееся имя типа. + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. Тип "{0}" имеет несколько конструкторов, аннотированных с использованием JsonConstructorAttribute. @@ -32,6 +62,16 @@ Тип имеет несколько конструкторов, аннотированных с использованием JsonConstructorAttribute. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. Метаданные сериализации для типа "{0}" не сформированы. diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.tr.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.tr.xlf index 7844892dcbb498..3d5e138aebe4cb 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.tr.xlf @@ -12,6 +12,16 @@ Türetilmiş 'JsonSerializerContext' türleri ve bunları içeren tüm türler kısmi olmalıdır. + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. {0} adını taşıyan birden çok tür var. Kaynak, algılanan ilk tür için oluşturuldu. Bu çarpışmayı çözmek için 'JsonSerializableAttribute.TypeInfoPropertyName' özelliğini kullanın. @@ -22,6 +32,26 @@ Yinelenen tür adı. + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. '{0}' türünün 'JsonConstructorAttribute' ile açıklanan birden çok oluşturucusu var. @@ -32,6 +62,16 @@ Türün JsonConstructorAttribute ile açıklanan birden çok oluşturucusu var. + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. '{0}' türü için serileştirme meta verileri oluşturulmadı. diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.zh-Hans.xlf index 10e68c87ede68d..a934f5c4d315f1 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.zh-Hans.xlf @@ -12,6 +12,16 @@ 派生的 “JsonSerializerContext” 类型以及所有包含类型必须是部分。 + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. 有多个名为 {0} 的类型。已为第一个检测到类型的生成源。请使用 'JsonSerializableAttribute.TypeInfoPropertyName' 以解决此冲突。 @@ -22,6 +32,26 @@ 重复的类型名称。 + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. 类型“{0}”具有用 “JsonConstructorAttribute” 批注的多个构造函数。 @@ -32,6 +62,16 @@ 类型具有用 JsonConstructorAttribute 批注的多个构造函数。 + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. 未生成类型 '{0}' 的序列化元数据。 diff --git a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.zh-Hant.xlf index 2b5a59991a12a7..4e236ab87e0030 100644 --- a/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/System.Text.Json/gen/Resources/xlf/Strings.zh-Hant.xlf @@ -12,6 +12,16 @@ 衍生的 'JsonSerializerContext' 類型和所有包含類型必須是部份。 + + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. + + + + Data extension property type invalid. + Data extension property type invalid. + + There are multiple types named {0}. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision. 有多個名為 {0} 的類型。已為偵測到的第一個項目產生來源。請使用 'JsonSerializableAttribute.TypeInfoPropertyName' 解決此衝突。 @@ -22,6 +32,26 @@ 重複類型名稱。 + + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + The member '{0}.{1}' has been annotated with the JsonIncludeAttribute but is not visible to the source generator. + + + + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + Inaccessible properties annotated with the JsonIncludeAttribute are not supported in source generation mode. + + + + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + The type '{0}' defines init-only properties, deserialization of which is currently not supported in source generation mode. + + + + Deserialization of init-only properties is currently not supported in source generation mode. + Deserialization of init-only properties is currently not supported in source generation mode. + + Type '{0}' has multiple constructors annotated with 'JsonConstructorAttribute'. 類型 '{0}' 包含多個以 'JsonConstructorAttribute' 註解的建構函式。 @@ -32,6 +62,16 @@ 類型包含多個以 JsonConstructorAttribute 註解的建構函式。 + + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + Type '{0}' has multiple members annotated with 'JsonExtensionDataAttribute'. + + + + Type has multiple members annotated with JsonExtensionDataAttribute. + Type has multiple members annotated with JsonExtensionDataAttribute. + + Did not generate serialization metadata for type '{0}'. 未產生類型 '{0}' 的序列化中繼資料。 diff --git a/src/libraries/System.Text.Json/gen/SourceGenerationSpec.cs b/src/libraries/System.Text.Json/gen/SourceGenerationSpec.cs index 0019dc524955aa..09865cd403c5fa 100644 --- a/src/libraries/System.Text.Json/gen/SourceGenerationSpec.cs +++ b/src/libraries/System.Text.Json/gen/SourceGenerationSpec.cs @@ -4,6 +4,8 @@ using System; using System.Collections.Generic; using System.Text; +using System.Text.Json.Reflection; +using Microsoft.CodeAnalysis; namespace System.Text.Json.SourceGeneration { @@ -11,6 +13,9 @@ internal sealed class SourceGenerationSpec { public List ContextGenerationSpecList { get; init; } +#if DEBUG + public MetadataLoadContextInternal MetadataLoadContext { get; init; } +#endif public Type BooleanType { get; init; } public Type ByteArrayType { get; init; } public Type CharType { get; init; } diff --git a/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn3.11.csproj b/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn3.11.csproj new file mode 100644 index 00000000000000..5168388eb18916 --- /dev/null +++ b/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn3.11.csproj @@ -0,0 +1,14 @@ + + + + 3.11 + $(MicrosoftCodeAnalysisCSharpWorkspacesVersion_3_11) + + + + + + + + + \ No newline at end of file diff --git a/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.0.csproj b/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.0.csproj new file mode 100644 index 00000000000000..5dd33e6ab2af20 --- /dev/null +++ b/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.Roslyn4.0.csproj @@ -0,0 +1,30 @@ + + + + true + 4.0 + $(MicrosoftCodeAnalysisCSharpWorkspacesVersion) + $(DefineConstants);ROSLYN4_0_OR_GREATER + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.csproj b/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.targets similarity index 87% rename from src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.csproj rename to src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.targets index de7b135a86f188..97d78152396485 100644 --- a/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.csproj +++ b/src/libraries/System.Text.Json/gen/System.Text.Json.SourceGeneration.targets @@ -1,13 +1,16 @@ - + netstandard2.0 + $(MSBuildThisFileName) + $(MSBuildThisFileName) + SR + FxResources.$(RootNamespace).$(StringResourcesClassName) false enable CS1574 false true - true cs @@ -17,10 +20,8 @@ - + - - @@ -37,11 +38,12 @@ + - + diff --git a/src/libraries/System.Text.Json/gen/TypeGenerationSpec.cs b/src/libraries/System.Text.Json/gen/TypeGenerationSpec.cs index 4c2eb61e27d669..e2a391990c8a06 100644 --- a/src/libraries/System.Text.Json/gen/TypeGenerationSpec.cs +++ b/src/libraries/System.Text.Json/gen/TypeGenerationSpec.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Text.Json.Reflection; using System.Text.Json.Serialization; +using Microsoft.CodeAnalysis; namespace System.Text.Json.SourceGeneration { @@ -18,6 +19,11 @@ internal class TypeGenerationSpec /// public string TypeRef { get; private set; } + /// + /// If specified as a root type via JsonSerializableAttribute, specifies the location of the attribute application. + /// + public Location? AttributeLocation { get; set; } + /// /// The name of the public JsonTypeInfo property for this type on the generated context class. /// For example, if the context class is named MyJsonContext, and the value of this property is JsonMessage; @@ -58,16 +64,24 @@ internal class TypeGenerationSpec public TypeGenerationSpec? NullableUnderlyingTypeMetadata { get; private set; } + /// + /// Supports deserialization of extension data dictionaries typed as I[ReadOnly]Dictionary. + /// Specifies a concrete type to instanciate, which would be Dictionary. + /// + public string? RuntimeTypeRef { get; private set; } + + public TypeGenerationSpec? ExtensionDataPropertyTypeSpec { get; private set; } + public string? ConverterInstantiationLogic { get; private set; } - public string FastPathSerializeMethodName - { - get - { - Debug.Assert(GenerateSerializationLogic); - return $"{TypeInfoPropertyName}Serialize"; - } - } + // Only generate certain helper methods if necessary. + public bool HasPropertyFactoryConverters { get; private set; } + public bool HasTypeFactoryConverter { get; private set; } + + // The spec is derived from cached `System.Type` instances, which are generally annotation-agnostic. + // Hence we can only record the potential for nullable annotations being possible for the runtime type. + // TODO: consider deriving the generation spec from the Roslyn symbols directly. + public bool CanContainNullableReferenceAnnotations { get; private set; } public string? ImmutableCollectionBuilderName { @@ -105,9 +119,14 @@ public void Initialize( TypeGenerationSpec? collectionValueTypeMetadata, ObjectConstructionStrategy constructionStrategy, TypeGenerationSpec? nullableUnderlyingTypeMetadata, + string? runtimeTypeRef, + TypeGenerationSpec? extensionDataPropertyTypeSpec, string? converterInstantiationLogic, bool implementsIJsonOnSerialized, - bool implementsIJsonOnSerializing) + bool implementsIJsonOnSerializing, + bool hasTypeFactoryConverter, + bool canContainNullableReferenceAnnotations, + bool hasPropertyFactoryConverters) { GenerationMode = generationMode; TypeRef = type.GetCompilableName(); @@ -124,9 +143,14 @@ public void Initialize( CollectionValueTypeMetadata = collectionValueTypeMetadata; ConstructionStrategy = constructionStrategy; NullableUnderlyingTypeMetadata = nullableUnderlyingTypeMetadata; + RuntimeTypeRef = runtimeTypeRef; + ExtensionDataPropertyTypeSpec = extensionDataPropertyTypeSpec; ConverterInstantiationLogic = converterInstantiationLogic; ImplementsIJsonOnSerialized = implementsIJsonOnSerialized; ImplementsIJsonOnSerializing = implementsIJsonOnSerializing; + CanContainNullableReferenceAnnotations = canContainNullableReferenceAnnotations; + HasTypeFactoryConverter = hasTypeFactoryConverter; + HasPropertyFactoryConverters = hasPropertyFactoryConverters; } public bool TryFilterSerializableProps( @@ -140,7 +164,6 @@ public bool TryFilterSerializableProps( for (int i = 0; i < PropertyGenSpecList.Count; i++) { PropertyGenerationSpec propGenSpec = PropertyGenSpecList[i]; - bool hasJsonInclude = propGenSpec.HasJsonInclude; JsonIgnoreCondition? ignoreCondition = propGenSpec.DefaultIgnoreCondition; if (ignoreCondition == JsonIgnoreCondition.WhenWritingNull && !propGenSpec.TypeGenerationSpec.CanBeNull) @@ -148,17 +171,21 @@ public bool TryFilterSerializableProps( goto ReturnFalse; } - if (!propGenSpec.IsPublic) + // In case of JsonInclude fail if either: + // 1. the getter is not accessible by the source generator or + // 2. neither getter or setter methods are public. + if (propGenSpec.HasJsonInclude && (!propGenSpec.CanUseGetter || !propGenSpec.IsPublic)) { - if (hasJsonInclude) - { - goto ReturnFalse; - } + goto ReturnFalse; + } + // Discard any getters not accessible by the source generator. + if (!propGenSpec.CanUseGetter) + { continue; } - if (!propGenSpec.IsProperty && !hasJsonInclude && !options.IncludeFields) + if (!propGenSpec.IsProperty && !propGenSpec.HasJsonInclude && !options.IncludeFields) { continue; } @@ -203,7 +230,7 @@ public bool TryFilterSerializableProps( castingRequiredForProps = PropertyGenSpecList.Count > serializableProperties.Count; return true; -ReturnFalse: + ReturnFalse: serializableProperties = null; castingRequiredForProps = false; return false; @@ -213,11 +240,17 @@ private bool FastPathIsSupported() { if (ClassType == ClassType.Object) { + if (ExtensionDataPropertyTypeSpec != null) + { + return false; + } + foreach (PropertyGenerationSpec property in PropertyGenSpecList) { if (property.TypeGenerationSpec.Type.IsObjectType() || property.NumberHandling == JsonNumberHandling.AllowNamedFloatingPointLiterals || - property.NumberHandling == JsonNumberHandling.WriteAsString) + property.NumberHandling == JsonNumberHandling.WriteAsString || + property.ConverterInstantiationLogic is not null) { return false; } diff --git a/src/libraries/System.Text.Json/ref/System.Text.Json.Typeforwards.netcoreapp.cs b/src/libraries/System.Text.Json/ref/System.Text.Json.Typeforwards.netcoreapp.cs new file mode 100644 index 00000000000000..81030616268c3d --- /dev/null +++ b/src/libraries/System.Text.Json/ref/System.Text.Json.Typeforwards.netcoreapp.cs @@ -0,0 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// The compiler emits a reference to the internal copy of this type in our non-NETCoreApp assembly +// so we must include a forward to be compatible with libraries compiled against non-NETCoreApp System.Text.Json +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsExternalInit))] diff --git a/src/libraries/System.Text.Json/ref/System.Text.Json.cs b/src/libraries/System.Text.Json/ref/System.Text.Json.cs index d4b05c6ea9f677..77d6c85b4376fe 100644 --- a/src/libraries/System.Text.Json/ref/System.Text.Json.cs +++ b/src/libraries/System.Text.Json/ref/System.Text.Json.cs @@ -798,7 +798,7 @@ public abstract partial class JsonConverter internal JsonConverter() { } public abstract bool CanConvert(System.Type typeToConvert); } - [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false)] + [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple = false)] public partial class JsonConverterAttribute : System.Text.Json.Serialization.JsonAttribute { protected JsonConverterAttribute() { } @@ -890,7 +890,8 @@ public JsonSerializableAttribute(System.Type type) { } } public abstract partial class JsonSerializerContext { - protected JsonSerializerContext(System.Text.Json.JsonSerializerOptions? instanceOptions, System.Text.Json.JsonSerializerOptions? defaultOptions) { } + protected JsonSerializerContext(System.Text.Json.JsonSerializerOptions? options) { } + protected abstract System.Text.Json.JsonSerializerOptions? GeneratedSerializerOptions { get; } public System.Text.Json.JsonSerializerOptions Options { get { throw null; } } public abstract System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(System.Type type); } @@ -901,11 +902,10 @@ public JsonSourceGenerationOptionsAttribute() { } public System.Text.Json.Serialization.JsonIgnoreCondition DefaultIgnoreCondition { get { throw null; } set { } } public bool IgnoreReadOnlyFields { get { throw null; } set { } } public bool IgnoreReadOnlyProperties { get { throw null; } set { } } - public bool IgnoreRuntimeCustomConverters { get { throw null; } set { } } public bool IncludeFields { get { throw null; } set { } } public System.Text.Json.Serialization.JsonKnownNamingPolicy PropertyNamingPolicy { get { throw null; } set { } } public bool WriteIndented { get { throw null; } set { } } - public JsonSourceGenerationMode GenerationMode { get { throw null; } set { } } + public System.Text.Json.Serialization.JsonSourceGenerationMode GenerationMode { get { throw null; } set { } } } [System.FlagsAttribute] public enum JsonSourceGenerationMode @@ -948,6 +948,15 @@ protected ReferenceResolver() { } } namespace System.Text.Json.Serialization.Metadata { + public sealed partial class JsonCollectionInfoValues + { + public JsonCollectionInfoValues() { } + public System.Func? ObjectCreator { get { throw null; } init { } } + public System.Text.Json.Serialization.Metadata.JsonTypeInfo ElementInfo { get { throw null; } init { } } + public System.Text.Json.Serialization.Metadata.JsonTypeInfo? KeyInfo { get { throw null; } init { } } + public System.Text.Json.Serialization.JsonNumberHandling NumberHandling { get { throw null; } init { } } + public System.Action? SerializeHandler { get { throw null; } init { } } + } public static partial class JsonMetadataServices { public static System.Text.Json.Serialization.JsonConverter BooleanConverter { get { throw null; } } @@ -962,7 +971,11 @@ public static partial class JsonMetadataServices public static System.Text.Json.Serialization.JsonConverter Int16Converter { get { throw null; } } public static System.Text.Json.Serialization.JsonConverter Int32Converter { get { throw null; } } public static System.Text.Json.Serialization.JsonConverter Int64Converter { get { throw null; } } + public static System.Text.Json.Serialization.JsonConverter JsonArrayConverter { get { throw null; } } public static System.Text.Json.Serialization.JsonConverter JsonElementConverter { get { throw null; } } + public static System.Text.Json.Serialization.JsonConverter JsonNodeConverter { get { throw null; } } + public static System.Text.Json.Serialization.JsonConverter JsonObjectConverter { get { throw null; } } + public static System.Text.Json.Serialization.JsonConverter JsonValueConverter { get { throw null; } } public static System.Text.Json.Serialization.JsonConverter ObjectConverter { get { throw null; } } [System.CLSCompliantAttribute(false)] public static System.Text.Json.Serialization.JsonConverter SByteConverter { get { throw null; } } @@ -977,42 +990,46 @@ public static partial class JsonMetadataServices public static System.Text.Json.Serialization.JsonConverter UInt64Converter { get { throw null; } } public static System.Text.Json.Serialization.JsonConverter UriConverter { get { throw null; } } public static System.Text.Json.Serialization.JsonConverter VersionConverter { get { throw null; } } - public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateArrayInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) { throw null; } - public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateConcurrentQueueInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Concurrent.ConcurrentQueue { throw null; } - public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateConcurrentStackInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Concurrent.ConcurrentStack { throw null; } - public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo keyInfo, System.Text.Json.Serialization.Metadata.JsonTypeInfo valueInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.Dictionary where TKey : notnull { throw null; } - public static JsonTypeInfo CreateICollectionInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.ICollection { throw null; } - public static JsonTypeInfo CreateIDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, JsonTypeInfo stringInfo, JsonTypeInfo objectInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.IDictionary { throw null; } - public static JsonTypeInfo CreateIDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, JsonTypeInfo keyInfo, JsonTypeInfo valueInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.IDictionary where TKey : notnull { throw null; } - public static JsonTypeInfo CreateIEnumerableInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.IEnumerable { throw null; } - public static JsonTypeInfo CreateIEnumerableInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.IEnumerable { throw null; } - public static JsonTypeInfo CreateIListInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo objectInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.IList { throw null; } - public static JsonTypeInfo CreateIListInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.IList { throw null; } - public static JsonTypeInfo CreateImmutableDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, JsonTypeInfo keyInfo, JsonTypeInfo valueInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc, System.Func>, TCollection> createRangeFunc) where TCollection : System.Collections.Generic.IReadOnlyDictionary where TKey : notnull { throw null; } - public static JsonTypeInfo CreateImmutableEnumerableInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc, System.Func, TCollection> createRangeFunc) where TCollection : System.Collections.Generic.IEnumerable { throw null; } - public static JsonTypeInfo CreateIReadOnlyDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, JsonTypeInfo keyInfo, JsonTypeInfo valueInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.IReadOnlyDictionary where TKey : notnull { throw null; } - public static JsonTypeInfo CreateISetInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.ISet { throw null; } - public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateListInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.List { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateArrayInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateConcurrentQueueInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Concurrent.ConcurrentQueue { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateConcurrentStackInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Concurrent.ConcurrentStack { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.Dictionary where TKey : notnull { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateICollectionInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.ICollection { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateIDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.IDictionary { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateIDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.IDictionary where TKey : notnull { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateIEnumerableInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.IEnumerable { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateIEnumerableInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.IEnumerable { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateIListInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.IList { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateIListInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.IList { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateImmutableDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo, System.Func>, TCollection> createRangeFunc) where TCollection : System.Collections.Generic.IReadOnlyDictionary where TKey : notnull { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateImmutableEnumerableInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo, System.Func, TCollection> createRangeFunc) where TCollection : System.Collections.Generic.IEnumerable { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateIReadOnlyDictionaryInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.IReadOnlyDictionary where TKey : notnull { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateISetInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.ISet { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateListInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.List { throw null; } public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateObjectInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonObjectInfoValues objectInfo) where T : notnull { throw null; } - public static System.Text.Json.Serialization.Metadata.JsonPropertyInfo CreatePropertyInfo(System.Text.Json.JsonSerializerOptions options, bool isProperty, bool isPublic, bool isVirtual, System.Type declaringType, System.Text.Json.Serialization.Metadata.JsonTypeInfo propertyTypeInfo, System.Text.Json.Serialization.JsonConverter? converter, System.Func? getter, System.Action? setter, System.Text.Json.Serialization.JsonIgnoreCondition? ignoreCondition, bool hasJsonInclude, System.Text.Json.Serialization.JsonNumberHandling? numberHandling, string propertyName, string? jsonPropertyName) { throw null; } - public static JsonTypeInfo CreateQueueInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.Queue { throw null; } - public static JsonTypeInfo CreateStackInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc) where TCollection : System.Collections.Generic.Stack { throw null; } - public static JsonTypeInfo CreateStackOrQueueInfo(System.Text.Json.JsonSerializerOptions options, System.Func? createObjectFunc, System.Text.Json.Serialization.Metadata.JsonTypeInfo elementInfo, System.Text.Json.Serialization.JsonNumberHandling numberHandling, System.Action? serializeFunc, System.Action addFunc) where TCollection : System.Collections.IEnumerable { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonPropertyInfo CreatePropertyInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues propertyInfo) { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateQueueInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo, System.Action addFunc) where TCollection : System.Collections.IEnumerable { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateQueueInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.Queue { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateStackInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo, System.Action addFunc) where TCollection : System.Collections.IEnumerable { throw null; } + public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateStackInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues collectionInfo) where TCollection : System.Collections.Generic.Stack { throw null; } public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateValueInfo(System.Text.Json.JsonSerializerOptions options, System.Text.Json.Serialization.JsonConverter converter) { throw null; } + public static System.Text.Json.Serialization.JsonConverter GetUnsupportedTypeConverter() { throw null; } public static System.Text.Json.Serialization.JsonConverter GetEnumConverter(System.Text.Json.JsonSerializerOptions options) where T : struct { throw null; } public static System.Text.Json.Serialization.JsonConverter GetNullableConverter(System.Text.Json.Serialization.Metadata.JsonTypeInfo underlyingTypeInfo) where T : struct { throw null; } } public sealed partial class JsonObjectInfoValues { - public System.Func? ConstructorParameterMetadataInitializer { get; init; } - public System.Text.Json.Serialization.JsonNumberHandling NumberHandling { get; init; } - public System.Func? ObjectCreator { get; init; } - public System.Func? ObjectWithParameterizedConstructorCreator { get; init; } - public System.Func? PropertyMetadataInitializer { get; init; } - public System.Action? SerializeHandler { get; init; } + public JsonObjectInfoValues() { } + public System.Func? ConstructorParameterMetadataInitializer { get { throw null; } init { } } + public System.Text.Json.Serialization.JsonNumberHandling NumberHandling { get { throw null; } init { } } + public System.Func? ObjectCreator { get { throw null; } init { } } + public System.Func? ObjectWithParameterizedConstructorCreator { get { throw null; } init { } } + public System.Func? PropertyMetadataInitializer { get { throw null; } init { } } + public System.Action? SerializeHandler { get { throw null; } init { } } } - public sealed class JsonParameterInfoValues + public sealed partial class JsonParameterInfoValues { + public JsonParameterInfoValues() { } public object? DefaultValue { get { throw null; } init { } } public bool HasDefaultValue { get { throw null; } init { } } public string Name { get { throw null; } init { } } @@ -1023,6 +1040,24 @@ public abstract partial class JsonPropertyInfo { internal JsonPropertyInfo() { } } + public sealed partial class JsonPropertyInfoValues + { + public JsonPropertyInfoValues() { } + public System.Text.Json.Serialization.JsonConverter? Converter { get { throw null; } init { } } + public System.Type DeclaringType { get { throw null; } init { } } + public System.Func? Getter { get { throw null; } init { } } + public System.Text.Json.Serialization.JsonIgnoreCondition? IgnoreCondition { get { throw null; } init { } } + public bool HasJsonInclude { get { throw null; } init { } } + public bool IsExtensionData { get { throw null; } init { } } + public bool IsProperty { get { throw null; } init { } } + public bool IsPublic { get { throw null; } init { } } + public bool IsVirtual { get { throw null; } init { } } + public string? JsonPropertyName { get { throw null; } init { } } + public System.Text.Json.Serialization.JsonNumberHandling? NumberHandling { get { throw null; } init { } } + public string PropertyName { get { throw null; } init { } } + public System.Text.Json.Serialization.Metadata.JsonTypeInfo PropertyTypeInfo { get { throw null; } init { } } + public System.Action? Setter { get { throw null; } init { } } + } public partial class JsonTypeInfo { internal JsonTypeInfo() { } @@ -1030,6 +1065,6 @@ internal JsonTypeInfo() { } public abstract partial class JsonTypeInfo : System.Text.Json.Serialization.Metadata.JsonTypeInfo { internal JsonTypeInfo() { } - public System.Action? Serialize { get { throw null; } } + public System.Action? SerializeHandler { get { throw null; } } } } diff --git a/src/libraries/System.Text.Json/ref/System.Text.Json.csproj b/src/libraries/System.Text.Json/ref/System.Text.Json.csproj index 6ef8f2ad1f044c..aa194d3641829b 100644 --- a/src/libraries/System.Text.Json/ref/System.Text.Json.csproj +++ b/src/libraries/System.Text.Json/ref/System.Text.Json.csproj @@ -7,6 +7,11 @@ + + + + + diff --git a/src/libraries/System.Text.Json/src/Resources/Strings.resx b/src/libraries/System.Text.Json/src/Resources/Strings.resx index 7fc1bd8096676a..6485157058f537 100644 --- a/src/libraries/System.Text.Json/src/Resources/Strings.resx +++ b/src/libraries/System.Text.Json/src/Resources/Strings.resx @@ -349,7 +349,7 @@ The JSON property name for '{0}.{1}' cannot be null. - The data extension property '{0}.{1}' does not match the required signature of 'IDictionary<string, JsonElement>', 'IDictionary<string, object>' or 'JsonObject'. + The data extension property '{0}.{1}' is invalid. It must implement 'IDictionary<string, JsonElement>' or 'IDictionary<string, object>', or be 'JsonObject'. The type '{0}' cannot have more than one member that has the attribute '{1}'. @@ -492,7 +492,7 @@ The type '{0}' is invalid for serialization or deserialization because it is a pointer type, is a ref struct, or contains generic parameters that have not been replaced by specific types. - Serialization and deserialization of '{0}' instances are not supported and should be avoided since they can lead to security issues. + Serialization and deserialization of '{0}' instances are not supported. The non-public property '{0}' on type '{1}' is annotated with 'JsonIncludeAttribute' which is invalid. diff --git a/src/libraries/System.Text.Json/src/System.Text.Json.Typeforwards.netcoreapp.cs b/src/libraries/System.Text.Json/src/System.Text.Json.Typeforwards.netcoreapp.cs new file mode 100644 index 00000000000000..81030616268c3d --- /dev/null +++ b/src/libraries/System.Text.Json/src/System.Text.Json.Typeforwards.netcoreapp.cs @@ -0,0 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// The compiler emits a reference to the internal copy of this type in our non-NETCoreApp assembly +// so we must include a forward to be compatible with libraries compiled against non-NETCoreApp System.Text.Json +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsExternalInit))] diff --git a/src/libraries/System.Text.Json/src/System.Text.Json.csproj b/src/libraries/System.Text.Json/src/System.Text.Json.csproj index 3a363de469a909..f478aabb427fdd 100644 --- a/src/libraries/System.Text.Json/src/System.Text.Json.csproj +++ b/src/libraries/System.Text.Json/src/System.Text.Json.csproj @@ -5,10 +5,12 @@ - + CS8969 enable true true + false + 9 Provides high-performance and low-allocating types that serialize objects to JavaScript Object Notation (JSON) text and deserialize JSON text to objects, with UTF-8 support built-in. Also provides types to read and write JSON text encoded as UTF-8, and to create an in-memory document object model (DOM), that is read-only, for random access of the JSON elements within a structured view of the data. Commonly Used Types: @@ -117,13 +119,6 @@ System.Text.Json.Utf8JsonReader - - - - - - - @@ -179,8 +174,6 @@ System.Text.Json.Utf8JsonReader - - @@ -201,6 +194,8 @@ System.Text.Json.Utf8JsonReader + + @@ -230,14 +225,23 @@ System.Text.Json.Utf8JsonReader + + + + + + - + + + + @@ -308,6 +312,7 @@ System.Text.Json.Utf8JsonReader + @@ -349,6 +354,8 @@ System.Text.Json.Utf8JsonReader - + + diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.cs index 2cb13212373b4d..7e7bec82f2c406 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.cs @@ -30,8 +30,6 @@ public sealed partial class JsonDocument : IDisposable private PooledByteBufferWriter? _extraPooledByteBufferWriter; private bool _hasExtraPooledByteBufferWriter; - private (int, string?) _lastIndexAndString = (-1, null); - internal bool IsDisposable { get; } /// @@ -54,7 +52,7 @@ private JsonDocument( _utf8Json = utf8Json; _parsedData = parsedData; - if (_extraRentedArrayPoolBytes != null) + if (extraRentedArrayPoolBytes != null) { _hasExtraRentedArrayPoolBytes = true; _extraRentedArrayPoolBytes = extraRentedArrayPoolBytes; @@ -278,14 +276,6 @@ private ReadOnlyMemory GetPropertyRawValue(int valueIndex) { CheckNotDisposed(); - (int lastIdx, string? lastString) = _lastIndexAndString; - - if (lastIdx == index) - { - Debug.Assert(lastString != null); - return lastString; - } - DbRow row = _parsedData.Get(index); JsonTokenType tokenType = row.TokenType; @@ -300,6 +290,7 @@ private ReadOnlyMemory GetPropertyRawValue(int valueIndex) ReadOnlySpan data = _utf8Json.Span; ReadOnlySpan segment = data.Slice(row.Location, row.SizeOrLength); + string lastString; if (row.HasComplexChildren) { int backslash = segment.IndexOf(JsonConstants.BackSlash); @@ -311,7 +302,6 @@ private ReadOnlyMemory GetPropertyRawValue(int valueIndex) } Debug.Assert(lastString != null); - _lastIndexAndString = (index, lastString); return lastString; } @@ -321,13 +311,6 @@ internal bool TextEquals(int index, ReadOnlySpan otherText, bool isPropert int matchIndex = isPropertyName ? index - DbRow.Size : index; - (int lastIdx, string? lastString) = _lastIndexAndString; - - if (lastIdx == matchIndex) - { - return otherText.SequenceEqual(lastString.AsSpan()); - } - byte[]? otherUtf8TextArray = null; int length = checked(otherText.Length * JsonConstants.MaxExpansionFactorWhileTranscoding); diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.Unescaping.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.Unescaping.cs index b539d6d82bb74a..4c4b4e076a92e0 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.Unescaping.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.Unescaping.cs @@ -372,7 +372,7 @@ internal static void Unescape(ReadOnlySpan source, Span destination, else if (currentByte == 'u') { // The source is known to be valid JSON, and hence if we see a \u, it is guaranteed to have 4 hex digits following it - // Otherwise, the Utf8JsonReader would have alreayd thrown an exception. + // Otherwise, the Utf8JsonReader would have already thrown an exception. Debug.Assert(source.Length >= idx + 5); bool result = Utf8Parser.TryParse(source.Slice(idx + 1, 4), out int scalar, out int bytesConsumed, 'x'); @@ -399,7 +399,7 @@ internal static void Unescape(ReadOnlySpan source, Span destination, } // The source is known to be valid JSON, and hence if we see a \u, it is guaranteed to have 4 hex digits following it - // Otherwise, the Utf8JsonReader would have alreayd thrown an exception. + // Otherwise, the Utf8JsonReader would have already thrown an exception. result = Utf8Parser.TryParse(source.Slice(idx, 4), out int lowSurrogate, out bytesConsumed, 'x'); Debug.Assert(result); Debug.Assert(bytesConsumed == 4); diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/IAsyncEnumerableOfTConverter.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/IAsyncEnumerableOfTConverter.cs index 20dcedf4dbd321..7466fbeb78e302 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/IAsyncEnumerableOfTConverter.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/IAsyncEnumerableOfTConverter.cs @@ -59,6 +59,16 @@ protected override bool OnWriteResume(Utf8JsonWriter writer, TAsyncEnumerable va // ensure the enumerator already is stored // in the WriteStack for proper disposal. moveNextTask = enumerator.MoveNextAsync(); + + if (!moveNextTask.IsCompleted) + { + // It is common for first-time MoveNextAsync() calls to return pending tasks, + // since typically that is when underlying network connections are being established. + // For this case only, suppress flushing the current buffer contents (e.g. the leading '[' token of the written array) + // to give the stream owner the ability to recover in case of a connection error. + state.SuppressFlush = true; + goto SuspendDueToPendingTask; + } } else { @@ -81,10 +91,11 @@ protected override bool OnWriteResume(Utf8JsonWriter writer, TAsyncEnumerable va } } + Debug.Assert(moveNextTask.IsCompleted); JsonConverter converter = GetElementConverter(ref state); // iterate through the enumerator while elements are being returned synchronously - for (; moveNextTask.IsCompleted; moveNextTask = enumerator.MoveNextAsync()) + do { if (!moveNextTask.Result) { @@ -105,8 +116,11 @@ protected override bool OnWriteResume(Utf8JsonWriter writer, TAsyncEnumerable va { return false; } - } + moveNextTask = enumerator.MoveNextAsync(); + } while (moveNextTask.IsCompleted); + + SuspendDueToPendingTask: // we have a pending MoveNextAsync() call; // wrap inside a regular task so that it can be awaited multiple times; // mark the current stackframe as pending completion. diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonMetadataServicesConverter.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonMetadataServicesConverter.cs index 88b93f95d1c487..5ee913f18d9482 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonMetadataServicesConverter.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonMetadataServicesConverter.cs @@ -8,7 +8,7 @@ namespace System.Text.Json.Serialization.Converters { /// /// Provides a mechanism to invoke "fast-path" serialization logic via - /// . This type holds an optional + /// . This type holds an optional /// reference to an actual for the type /// , to provide a fallback when the fast path cannot be used. /// @@ -22,7 +22,7 @@ internal sealed class JsonMetadataServicesConverter : JsonResumableConverter< private JsonConverter? _converter; // A backing converter for when fast-path logic cannot be used. - private JsonConverter Converter + internal JsonConverter Converter { get { @@ -75,10 +75,10 @@ internal override bool OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializer if (!state.SupportContinuation && jsonTypeInfo is JsonTypeInfo info && - info.Serialize != null && + info.SerializeHandler != null && info.Options._context?.CanUseSerializationLogic == true) { - info.Serialize(writer, value); + info.SerializeHandler(writer, value); return true; } diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Node/JsonNodeConverter.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Node/JsonNodeConverter.cs index 8d0f7bb437f10d..5dd032cc743e03 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Node/JsonNodeConverter.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Node/JsonNodeConverter.cs @@ -11,7 +11,7 @@ namespace System.Text.Json.Serialization.Converters /// Converter for JsonNode-derived types. The {T} value must be Object and not JsonNode /// since we allow Object-declared members\variables to deserialize as {JsonNode}. /// - internal sealed class JsonNodeConverter : JsonConverter + internal sealed class JsonNodeConverter : JsonConverter { private static JsonNodeConverter? s_nodeConverter; private static JsonArrayConverter? s_arrayConverter; diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectDefaultConverter.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectDefaultConverter.cs index 60708ae8eee52f..c12debeb618560 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectDefaultConverter.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectDefaultConverter.cs @@ -16,9 +16,6 @@ internal class ObjectDefaultConverter : JsonObjectConverter where T : notn { internal override bool CanHaveIdMetadata => true; -#if NET6_0_OR_GREATER - [MethodImpl(MethodImplOptions.AggressiveOptimization)] -#endif internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, ref ReadStack state, [MaybeNullWhen(false)] out T value) { JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo; @@ -249,9 +246,6 @@ internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, return true; } -#if NET6_0_OR_GREATER - [MethodImpl(MethodImplOptions.AggressiveOptimization)] -#endif internal sealed override bool OnTryWrite( Utf8JsonWriter writer, T value, diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Large.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Large.cs index 3e25b10c13a237..f820ffbfe3a858 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Large.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Large.cs @@ -67,10 +67,7 @@ protected sealed override void InitializeConstructorArgumentCaches(ref ReadStack { JsonParameterInfo? parameterInfo = cache[i].Value; Debug.Assert(parameterInfo != null); - - arguments[parameterInfo.ClrInfo.Position] = parameterInfo.ShouldDeserialize - ? parameterInfo.DefaultValue - : parameterInfo.ClrDefaultValue; + arguments[parameterInfo.ClrInfo.Position] = parameterInfo.DefaultValue; } state.Current.CtorArgumentState!.Arguments = arguments; diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/ObjectConverter.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/ObjectConverter.cs index ddb2a899947b64..7ce4a2cb706b55 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/ObjectConverter.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/ObjectConverter.cs @@ -7,11 +7,6 @@ namespace System.Text.Json.Serialization.Converters { internal sealed class ObjectConverter : JsonConverter { - public ObjectConverter() - { - IsInternalConverterForNumberType = true; - } - public override object? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (options.UnknownTypeHandling == JsonUnknownTypeHandling.JsonElement) @@ -50,15 +45,5 @@ internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer, object? va runtimeConverter.WriteAsPropertyNameCoreAsObject(writer, value, options, isWritingExtensionDataProperty); } - - internal override object? ReadNumberWithCustomHandling(ref Utf8JsonReader reader, JsonNumberHandling handling, JsonSerializerOptions options) - { - if (options.UnknownTypeHandling == JsonUnknownTypeHandling.JsonElement) - { - return JsonElement.ParseValue(ref reader); - } - - return JsonNodeConverter.Instance.Read(ref reader, typeof(object), options); - } } } diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DisallowedTypeConverter.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/UnsupportedTypeConverter.cs similarity index 89% rename from src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DisallowedTypeConverter.cs rename to src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/UnsupportedTypeConverter.cs index 27ed644b1ba3f1..d4a432e9b95c47 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DisallowedTypeConverter.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/UnsupportedTypeConverter.cs @@ -3,7 +3,7 @@ namespace System.Text.Json.Serialization.Converters { - internal sealed class DisallowedTypeConverter : JsonConverter + internal sealed class UnsupportedTypeConverter : JsonConverter { public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => throw new NotSupportedException(SR.Format(SR.SerializeTypeInstanceNotSupported, typeof(T).FullName)); diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DisallowedTypeConverterFactory.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/UnsupportedTypeConverterFactory.cs similarity index 86% rename from src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DisallowedTypeConverterFactory.cs rename to src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/UnsupportedTypeConverterFactory.cs index e771889bc46316..f211939119505b 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DisallowedTypeConverterFactory.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/UnsupportedTypeConverterFactory.cs @@ -6,12 +6,11 @@ namespace System.Text.Json.Serialization.Converters { - internal sealed class DisallowedTypeConverterFactory : JsonConverterFactory + internal sealed class UnsupportedTypeConverterFactory : JsonConverterFactory { public override bool CanConvert(Type type) { - // If a value type is added, also add a test that - // shows NSE is thrown when Nullable is (de)serialized. + // If a type is added, also add to the SourceGeneration project. return // There's no safe way to construct a Type from untrusted user input. @@ -24,6 +23,8 @@ public override bool CanConvert(Type type) type == typeof(SerializationInfo) || type == typeof(IntPtr) || type == typeof(UIntPtr) || + // Exlude delegates. + typeof(Delegate).IsAssignableFrom(type) || // DateOnly/TimeOnly support to be added in future releases; // guard against invalid object-based serializations for now. // cf. https://github.com/dotnet/runtime/issues/53539 @@ -42,7 +43,7 @@ public override bool CanConvert(Type type) public override JsonConverter CreateConverter(Type type, JsonSerializerOptions options) { JsonConverter converter = (JsonConverter)Activator.CreateInstance( - typeof(DisallowedTypeConverter<>).MakeGenericType(type), + typeof(UnsupportedTypeConverter<>).MakeGenericType(type), BindingFlags.Instance | BindingFlags.Public, binder: null, args: null, diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs index e15200546851d7..3deefaf77a6edc 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; +using System.Text.Json.Serialization.Converters; using System.Text.Json.Serialization.Metadata; namespace System.Text.Json.Serialization @@ -144,9 +145,6 @@ internal virtual bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, J /// Note that the value of determines if the converter handles null JSON tokens. public abstract T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options); -#if NET6_0_OR_GREATER - [MethodImpl(MethodImplOptions.AggressiveOptimization)] -#endif internal bool TryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, ref ReadStack state, out T? value) { if (ConverterStrategy == ConverterStrategy.Value) @@ -320,9 +318,6 @@ internal override sealed bool TryReadAsObject(ref Utf8JsonReader reader, JsonSer /// private static bool IsNull(T value) => value is null; -#if NET6_0_OR_GREATER - [MethodImpl(MethodImplOptions.AggressiveOptimization)] -#endif internal bool TryWrite(Utf8JsonWriter writer, in T value, JsonSerializerOptions options, ref WriteStack state) { if (writer.CurrentDepth >= options.EffectiveMaxDepth) @@ -504,7 +499,10 @@ internal bool TryWriteDataExtensionProperty(Utf8JsonWriter writer, T value, Json return TryWrite(writer, value, options, ref state); } - if (this is not JsonDictionaryConverter dictionaryConverter) + JsonDictionaryConverter? dictionaryConverter = this as JsonDictionaryConverter + ?? (this as JsonMetadataServicesConverter)?.Converter as JsonDictionaryConverter; + + if (dictionaryConverter == null) { // If not JsonDictionaryConverter then we are JsonObject. // Avoid a type reference to JsonObject and its converter to support trimming. diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Write.Helpers.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Write.Helpers.cs index 4f100523bf486c..761798f14d921d 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Write.Helpers.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Write.Helpers.cs @@ -43,8 +43,8 @@ private static void WriteUsingGeneratedSerializer(Utf8JsonWriter writer, jsonTypeInfo is JsonTypeInfo typedInfo && typedInfo.Options._context?.CanUseSerializationLogic == true) { - Debug.Assert(typedInfo.Serialize != null); - typedInfo.Serialize(writer, value); + Debug.Assert(typedInfo.SerializeHandler != null); + typedInfo.SerializeHandler(writer, value); writer.Flush(); } else diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Write.Stream.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Write.Stream.cs index 04b7b108a0d9b0..6351ef0ebd6c08 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Write.Stream.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Write.Stream.cs @@ -18,8 +18,8 @@ public static partial class JsonSerializer // needs to be expanded\doubled because it is not large enough to write the current property or element. // We check for flush after each JSON property and element is written to the buffer. // Once the buffer is expanded to contain the largest single element\property, a 90% thresold - // means the buffer may be expanded a maximum of 4 times: 1-(1\(2^4))==.9375. - private const float FlushThreshold = .9f; + // means the buffer may be expanded a maximum of 4 times: 1-(1/(2^4))==.9375. + private const float FlushThreshold = .90f; /// /// Converts the provided value to UTF-8 encoded JSON text and write it to the . @@ -325,8 +325,18 @@ private static async Task WriteStreamAsync( try { isFinalBlock = WriteCore(converter, writer, value, options, ref state); - await bufferWriter.WriteToStreamAsync(utf8Json, cancellationToken).ConfigureAwait(false); - bufferWriter.Clear(); + + if (state.SuppressFlush) + { + Debug.Assert(!isFinalBlock); + Debug.Assert(state.PendingTask is not null); + state.SuppressFlush = false; + } + else + { + await bufferWriter.WriteToStreamAsync(utf8Json, cancellationToken).ConfigureAwait(false); + bufferWriter.Clear(); + } } finally { diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerContext.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerContext.cs index 688fd91a3b91cb..0ce18180072c9e 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerContext.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerContext.cs @@ -13,10 +13,30 @@ namespace System.Text.Json.Serialization public abstract partial class JsonSerializerContext { private bool? _canUseSerializationLogic; - private JsonSerializerOptions? _defaultOptions; internal JsonSerializerOptions? _options; + /// + /// Gets the run time specified options of the context. If no options were passed + /// when instanciating the context, then a new instance is bound and returned. + /// + /// + /// The instance cannot be mutated once it is bound with the context instance. + /// + public JsonSerializerOptions Options + { + get + { + if (_options == null) + { + _options = new JsonSerializerOptions(); + _options._context = this; + } + + return _options; + } + } + /// /// Indicates whether pre-generated serialization logic for types in the context /// is compatible with the run time specified . @@ -27,7 +47,7 @@ internal bool CanUseSerializationLogic { if (!_canUseSerializationLogic.HasValue) { - if (_defaultOptions == null) + if (GeneratedSerializerOptions == null) { _canUseSerializationLogic = false; } @@ -46,13 +66,13 @@ internal bool CanUseSerializationLogic #pragma warning restore SYSLIB0020 // Ensure options values are consistent with expected defaults. - Options.DefaultIgnoreCondition == _defaultOptions.DefaultIgnoreCondition && - Options.IgnoreReadOnlyFields == _defaultOptions.IgnoreReadOnlyFields && - Options.IgnoreReadOnlyProperties == _defaultOptions.IgnoreReadOnlyProperties && - Options.IncludeFields == _defaultOptions.IncludeFields && - Options.PropertyNamingPolicy == _defaultOptions.PropertyNamingPolicy && - Options.DictionaryKeyPolicy == _defaultOptions.DictionaryKeyPolicy && - Options.WriteIndented == _defaultOptions.WriteIndented; + Options.DefaultIgnoreCondition == GeneratedSerializerOptions.DefaultIgnoreCondition && + Options.IgnoreReadOnlyFields == GeneratedSerializerOptions.IgnoreReadOnlyFields && + Options.IgnoreReadOnlyProperties == GeneratedSerializerOptions.IgnoreReadOnlyProperties && + Options.IncludeFields == GeneratedSerializerOptions.IncludeFields && + Options.PropertyNamingPolicy == GeneratedSerializerOptions.PropertyNamingPolicy && + Options.DictionaryKeyPolicy == GeneratedSerializerOptions.DictionaryKeyPolicy && + Options.WriteIndented == GeneratedSerializerOptions.WriteIndented; } } @@ -61,49 +81,30 @@ internal bool CanUseSerializationLogic } /// - /// Gets the run time specified options of the context. If no options were passed - /// when instanciating the context, then a new instance is bound and returned. + /// The default run time options for the context. Its values are defined at design-time via . /// - /// - /// The instance cannot be mutated once it is bound with the context instance. - /// - public JsonSerializerOptions Options - { - get - { - if (_options == null) - { - _options = new JsonSerializerOptions(); - _options._context = this; - } - - return _options; - } - } + protected abstract JsonSerializerOptions? GeneratedSerializerOptions { get; } /// /// Creates an instance of and binds it with the indicated . /// - /// The run time provided options for the context instance. - /// The default run time options for the context. Its values are defined at design-time via . + /// The run time provided options for the context instance. /// /// If no instance options are passed, then no options are set until the context is bound using , /// or until is called, where a new options instance is created and bound. /// - protected JsonSerializerContext(JsonSerializerOptions? instanceOptions, JsonSerializerOptions? defaultOptions) + protected JsonSerializerContext(JsonSerializerOptions? options) { - if (instanceOptions != null) + if (options != null) { - if (instanceOptions._context != null) + if (options._context != null) { ThrowHelper.ThrowInvalidOperationException_JsonSerializerOptionsAlreadyBoundToContext(); } - _options = instanceOptions; - instanceOptions._context = this; + _options = options; + options._context = this; } - - _defaultOptions = defaultOptions; } /// diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Converters.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Converters.cs index 912cabef9e69ba..2563794dcc55c2 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Converters.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Converters.cs @@ -10,6 +10,7 @@ using System.Text.Json.Serialization; using System.Text.Json.Serialization.Converters; using System.Text.Json.Serialization.Metadata; +using System.Threading; namespace System.Text.Json { @@ -30,23 +31,26 @@ public sealed partial class JsonSerializerOptions [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)] private void RootBuiltInConverters() { - s_defaultSimpleConverters = GetDefaultSimpleConverters(); - s_defaultFactoryConverters = new JsonConverter[] + if (Volatile.Read(ref s_defaultFactoryConverters) is null) { - // Check for disallowed types. - new DisallowedTypeConverterFactory(), - // Nullable converter should always be next since it forwards to any nullable type. - new NullableConverterFactory(), - new EnumConverterFactory(), - new JsonNodeConverterFactory(), - new FSharpTypeConverterFactory(), - // IAsyncEnumerable takes precedence over IEnumerable. - new IAsyncEnumerableConverterFactory(), - // IEnumerable should always be second to last since they can convert any IEnumerable. - new IEnumerableConverterFactory(), - // Object should always be last since it converts any type. - new ObjectConverterFactory() - }; + s_defaultSimpleConverters = GetDefaultSimpleConverters(); + Volatile.Write(ref s_defaultFactoryConverters, new JsonConverter[] + { + // Check for disallowed types. + new UnsupportedTypeConverterFactory(), + // Nullable converter should always be next since it forwards to any nullable type. + new NullableConverterFactory(), + new EnumConverterFactory(), + new JsonNodeConverterFactory(), + new FSharpTypeConverterFactory(), + // IAsyncEnumerable takes precedence over IEnumerable. + new IAsyncEnumerableConverterFactory(), + // IEnumerable should always be second to last since they can convert any IEnumerable. + new IEnumerableConverterFactory(), + // Object should always be last since it converts any type. + new ObjectConverterFactory() + }); + } } private static Dictionary GetDefaultSimpleConverters() diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs index 2d23e7c5c9200b..f81025bbc460e5 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs @@ -600,9 +600,7 @@ internal JsonTypeInfo GetOrAddClass(Type type) { _haveTypesBeenCreated = true; - // todo: for performance and reduced instances, consider using the converters and JsonTypeInfo from s_defaultOptions by cloning (or reference directly if no changes). - // https://github.com/dotnet/runtime/issues/32357 - if (!_classes.TryGetValue(type, out JsonTypeInfo? result)) + if (!TryGetClass(type, out JsonTypeInfo? result)) { result = _classes.GetOrAdd(type, GetClassFromContextOrCreate(type)); } @@ -644,6 +642,20 @@ internal JsonTypeInfo GetOrAddClassForRootType(Type type) return jsonTypeInfo; } + internal bool TryGetClass(Type type, [NotNullWhen(true)] out JsonTypeInfo? jsonTypeInfo) + { + // todo: for performance and reduced instances, consider using the converters and JsonTypeInfo from s_defaultOptions by cloning (or reference directly if no changes). + // https://github.com/dotnet/runtime/issues/32357 + if (!_classes.TryGetValue(type, out JsonTypeInfo? result)) + { + jsonTypeInfo = null; + return false; + } + + jsonTypeInfo = result; + return true; + } + internal bool TypeIsCached(Type type) { return _classes.ContainsKey(type); diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/GenericMethodHolder.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/GenericMethodHolder.cs index a144c11d398c9d..2c143f95e59cc9 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/GenericMethodHolder.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/GenericMethodHolder.cs @@ -1,6 +1,7 @@ // 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.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Text.Json.Reflection; @@ -12,10 +13,24 @@ namespace System.Text.Json.Serialization.Metadata /// internal abstract class GenericMethodHolder { + /// + /// Returns the default value for the specified type. + /// + public abstract object? DefaultValue { get; } + /// /// Returns true if contains only default values. /// public abstract bool IsDefaultValue(object value); + + /// + /// Creates a holder instance representing a type. + /// + public static GenericMethodHolder CreateHolder(Type type) + { + Type holderType = typeof(GenericMethodHolder<>).MakeGenericType(type); + return (GenericMethodHolder)Activator.CreateInstance(holderType)!; + } } /// @@ -23,6 +38,8 @@ internal abstract class GenericMethodHolder /// internal sealed class GenericMethodHolder : GenericMethodHolder { + public override object? DefaultValue => default(T); + public override bool IsDefaultValue(object value) { // For performance, we only want to call this method for non-nullable value types. diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonCollectionInfoValuesOfTCollection.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonCollectionInfoValuesOfTCollection.cs new file mode 100644 index 00000000000000..b1fef6a4c934f2 --- /dev/null +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonCollectionInfoValuesOfTCollection.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Text.Json.Serialization.Metadata +{ + /// + /// Provides serialization metadata about a collection type. + /// + /// The collection type. + public sealed class JsonCollectionInfoValues + { + /// + /// A to create an instance of the collection when deserializing. + /// + public Func? ObjectCreator { get; init; } + + /// + /// If a dictionary type, the instance representing the key type. + /// + public JsonTypeInfo? KeyInfo { get; init; } + + /// + /// A instance representing the element type. + /// + public JsonTypeInfo ElementInfo { get; init; } = null!; + + /// + /// The option to apply to number collection elements. + /// + public JsonNumberHandling NumberHandling { get; init; } + + /// + /// An optimized serialization implementation assuming pre-determined defaults. + /// + public Action? SerializeHandler { get; init; } + } +} diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Collections.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Collections.cs index 71f48ad41b0eff..4b1708652961cf 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Collections.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Collections.cs @@ -11,552 +11,368 @@ namespace System.Text.Json.Serialization.Metadata public static partial class JsonMetadataServices { /// - /// Creates metadata for an array. + /// Creates serialization metadata for an array. /// /// The generic definition of the element type. /// The to use. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// - public static JsonTypeInfo CreateArrayInfo( - JsonSerializerOptions options, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. + public static JsonTypeInfo CreateArrayInfo(JsonSerializerOptions options, JsonCollectionInfoValues collectionInfo) => new JsonTypeInfoInternal( options, - createObjectFunc: null, - () => new ArrayConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new ArrayConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the element type. - /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// The to use. + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateListInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : List => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new ListOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new ListOfTConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the key type. /// The generic definition of the value type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the key type. - /// A instance representing the value type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateDictionaryInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo keyInfo, - JsonTypeInfo valueInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : Dictionary where TKey : notnull => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new DictionaryOfTKeyTValueConverter(), - keyInfo, - valueInfo, - numberHandling, - serializeFunc, - typeof(TKey), - typeof(TValue)); + collectionInfo, + () => new DictionaryOfTKeyTValueConverter()); #pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved /// - /// Creates metadata for and + /// Creates serialization metadata for and /// types assignable to . /// /// The generic definition of the type. /// The generic definition of the key type. /// The generic definition of the value type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the key type. - /// A instance representing the value type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. + /// Provides serialization metadata about the collection type. /// A method to create an immutable dictionary instance. - /// + /// Serialization metadata for the given type. #pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved public static JsonTypeInfo CreateImmutableDictionaryInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo keyInfo, - JsonTypeInfo valueInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc, + JsonCollectionInfoValues collectionInfo, Func>, TCollection> createRangeFunc) where TCollection : IReadOnlyDictionary where TKey : notnull => new JsonTypeInfoInternal( options, - createObjectFunc, + collectionInfo, () => new ImmutableDictionaryOfTKeyTValueConverter(), - keyInfo, - valueInfo, - numberHandling, - serializeFunc, - typeof(TKey), - typeof(TValue), - createRangeFunc ?? throw new ArgumentNullException(nameof(createRangeFunc))); + createObjectWithArgs: createRangeFunc ?? throw new ArgumentNullException(nameof(createRangeFunc))); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the key type. /// The generic definition of the value type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the key type. - /// A instance representing the value type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateIDictionaryInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo keyInfo, - JsonTypeInfo valueInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : IDictionary where TKey : notnull => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new IDictionaryOfTKeyTValueConverter(), - keyInfo, - valueInfo, - numberHandling, - serializeFunc, - typeof(TKey), - typeof(TValue)); + collectionInfo, + () => new IDictionaryOfTKeyTValueConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the key type. /// The generic definition of the value type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the key type. - /// A instance representing the value type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateIReadOnlyDictionaryInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo keyInfo, - JsonTypeInfo valueInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : IReadOnlyDictionary where TKey : notnull => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new IReadOnlyDictionaryOfTKeyTValueConverter(), - keyInfo, - valueInfo, - numberHandling, - serializeFunc, - typeof(TKey), - typeof(TValue)); + collectionInfo, + () => new IReadOnlyDictionaryOfTKeyTValueConverter()); #pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved /// - /// Creates metadata for non-dictionary immutable collection types. + /// Creates serialization metadata for non-dictionary immutable collection types. /// /// The generic definition of the type. /// The generic definition of the element type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. + /// Provides serialization metadata about the collection type. /// A method to create an immutable dictionary instance. - /// + /// Serialization metadata for the given type. #pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved public static JsonTypeInfo CreateImmutableEnumerableInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc, + JsonCollectionInfoValues collectionInfo, Func, TCollection> createRangeFunc) where TCollection : IEnumerable => new JsonTypeInfoInternal( options, - createObjectFunc, + collectionInfo, () => new ImmutableEnumerableOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement), - createRangeFunc ?? throw new ArgumentNullException(nameof(createRangeFunc))); + createObjectWithArgs: createRangeFunc ?? throw new ArgumentNullException(nameof(createRangeFunc))); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateIListInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo objectInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : IList => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new IListConverter(), - objectInfo, - numberHandling, - serializeFunc, - typeof(object)); + collectionInfo, + () => new IListConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the element type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateIListInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : IList => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new IListOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new IListOfTConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the element type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateISetInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : ISet => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new ISetOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new ISetOfTConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the element type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateICollectionInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : ICollection => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new ICollectionOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new ICollectionOfTConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the element type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateStackInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : Stack => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new StackOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new StackOfTConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the element type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateQueueInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : Queue => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new QueueOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new QueueOfTConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the element type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateConcurrentStackInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : ConcurrentStack => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new ConcurrentStackOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new ConcurrentStackOfTConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the element type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateConcurrentQueueInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : ConcurrentQueue => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new ConcurrentQueueOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new ConcurrentQueueOfTConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// The generic definition of the element type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateIEnumerableInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : IEnumerable => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new IEnumerableOfTConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(TElement)); + collectionInfo, + () => new IEnumerableOfTConverter()); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing instances. - /// A instance representing instances. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateIDictionaryInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo stringInfo, - JsonTypeInfo objectInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : IDictionary => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new IDictionaryConverter(), - keyInfo: stringInfo, - valueInfo: objectInfo, - numberHandling, - serializeFunc, - typeof(string), - typeof(object)); + collectionInfo, + () => new IDictionaryConverter()); + +#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved + /// + /// Creates serialization metadata for types. + /// + /// The generic definition of the type. + /// + /// Provides serialization metadata about the collection type. + /// A method for adding elements to the collection when using the serializer's code-paths. + /// Serialization metadata for the given type. +#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved + public static JsonTypeInfo CreateStackInfo( + JsonSerializerOptions options, + JsonCollectionInfoValues collectionInfo, + Action addFunc) + where TCollection : IEnumerable + => CreateStackOrQueueInfo(options, collectionInfo, addFunc); +#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types. /// /// The generic definition of the type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. + /// Provides serialization metadata about the collection type. /// A method for adding elements to the collection when using the serializer's code-paths. - /// - public static JsonTypeInfo CreateStackOrQueueInfo( + /// Serialization metadata for the given type. +#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved + public static JsonTypeInfo CreateQueueInfo( + JsonSerializerOptions options, + JsonCollectionInfoValues collectionInfo, + Action addFunc) + where TCollection : IEnumerable + => CreateStackOrQueueInfo(options, collectionInfo, addFunc); + + private static JsonTypeInfo CreateStackOrQueueInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc, + JsonCollectionInfoValues collectionInfo, Action addFunc) where TCollection : IEnumerable => new JsonTypeInfoInternal( options, - createObjectFunc, + collectionInfo, () => new StackOrQueueConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(object), createObjectWithArgs: null, addFunc: addFunc ?? throw new ArgumentNullException(nameof(addFunc))); /// - /// Creates metadata for types assignable to . + /// Creates serialization metadata for types assignable to . /// /// The generic definition of the type. /// - /// A to create an instance of the list when deserializing. - /// A instance representing the element type. - /// The option to apply to number collection elements. - /// An optimized serialization implementation assuming pre-determined defaults. - /// + /// Provides serialization metadata about the collection type. + /// Serialization metadata for the given type. public static JsonTypeInfo CreateIEnumerableInfo( JsonSerializerOptions options, - Func? createObjectFunc, - JsonTypeInfo elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc) + JsonCollectionInfoValues collectionInfo) where TCollection : IEnumerable => new JsonTypeInfoInternal( options, - createObjectFunc, - () => new IEnumerableConverter(), - elementInfo, - numberHandling, - serializeFunc, - typeof(object)); + collectionInfo, + () => new IEnumerableConverter()); } } diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Converters.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Converters.cs index 39ad153d48da1d..5cf7292e2b4551 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Converters.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.Converters.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Text.Json.Nodes; using System.Text.Json.Serialization.Converters; namespace System.Text.Json.Serialization.Metadata @@ -80,12 +81,36 @@ public static partial class JsonMetadataServices public static JsonConverter Int64Converter => s_int64Converter ??= new Int64Converter(); private static JsonConverter? s_int64Converter; + /// + /// Returns a instance that converts values. + /// + public static JsonConverter JsonArrayConverter => s_jsonArrayConverter ??= new JsonArrayConverter(); + private static JsonConverter? s_jsonArrayConverter; + /// /// Returns a instance that converts values. /// public static JsonConverter JsonElementConverter => s_jsonElementConverter ??= new JsonElementConverter(); private static JsonConverter? s_jsonElementConverter; + /// + /// Returns a instance that converts values. + /// + public static JsonConverter JsonNodeConverter => s_jsonNodeConverter ??= new JsonNodeConverter(); + private static JsonConverter? s_jsonNodeConverter; + + /// + /// Returns a instance that converts values. + /// + public static JsonConverter JsonObjectConverter => s_jsonObjectConverter ??= new JsonObjectConverter(); + private static JsonConverter? s_jsonObjectConverter; + + /// + /// Returns a instance that converts values. + /// + public static JsonConverter JsonValueConverter => s_jsonValueConverter ??= new JsonValueConverter(); + private static JsonConverter? s_jsonValueConverter; + /// /// Returns a instance that converts values. /// @@ -150,12 +175,20 @@ public static partial class JsonMetadataServices public static JsonConverter VersionConverter => s_versionConverter ??= new VersionConverter(); private static JsonConverter? s_versionConverter; + /// + /// Creates a instance that throws . + /// + /// The generic definition for the type. + /// A instance that throws + public static JsonConverter GetUnsupportedTypeConverter() + => new UnsupportedTypeConverter(); + /// /// Creates a instance that converts values. /// /// The generic definition for the enum type. /// The to use for serialization and deserialization. - /// + /// A instance that converts values. public static JsonConverter GetEnumConverter(JsonSerializerOptions options) where T : struct, Enum => new EnumConverter(EnumConverterOptions.AllowNumbers, options ?? throw new ArgumentNullException(nameof(options))); @@ -164,7 +197,7 @@ public static JsonConverter GetEnumConverter(JsonSerializerOptions options /// /// The generic definition for the underlying nullable type. /// Serialization metadata for the underlying nullable type. - /// + /// A instance that converts values public static JsonConverter GetNullableConverter(JsonTypeInfo underlyingTypeInfo) where T : struct { if (underlyingTypeInfo == null) diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.cs index 20b33ac2e28761..e9b0578b863d92 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonMetadataServices.cs @@ -1,7 +1,6 @@ // 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.Generic; using System.ComponentModel; namespace System.Text.Json.Serialization.Metadata @@ -17,56 +16,39 @@ public static partial class JsonMetadataServices /// /// The type that the converter for the property returns or accepts when converting JSON data. /// The to initialize the metadata with. - /// Whether the CLR member is a property or field. - /// Whether the CLR member is public. - /// Whether the CLR member is a virtual property. - /// The declaring type of the property or field. - /// The info for the property or field's type. - /// A for the property or field, specified by . - /// Provides a mechanism to get the property or field's value. - /// Provides a mechanism to set the property or field's value. - /// Specifies a condition for the property to be ignored. - /// If the property or field is a number, specifies how it should processed when serializing and deserializing. - /// Whether the property was annotated with . - /// The CLR name of the property or field. - /// The name to be used when processing the property or field, specified by . + /// Provides serialization metadata about the property or field. /// A instance intialized with the provided metadata. - public static JsonPropertyInfo CreatePropertyInfo( - JsonSerializerOptions options, - bool isProperty, - bool isPublic, - bool isVirtual, - Type declaringType, - JsonTypeInfo propertyTypeInfo, - JsonConverter? converter, - Func? getter, - Action? setter, - JsonIgnoreCondition? ignoreCondition, - bool hasJsonInclude, - JsonNumberHandling? numberHandling, - string propertyName, - string? jsonPropertyName) + public static JsonPropertyInfo CreatePropertyInfo(JsonSerializerOptions options, JsonPropertyInfoValues propertyInfo) { if (options == null) { throw new ArgumentNullException(nameof(options)); } + if (propertyInfo == null) + { + throw new ArgumentNullException(nameof(propertyInfo)); + } + + Type? declaringType = propertyInfo.DeclaringType; if (declaringType == null) { - throw new ArgumentNullException(nameof(declaringType)); + throw new ArgumentException(nameof(propertyInfo.DeclaringType)); } + JsonTypeInfo? propertyTypeInfo = propertyInfo.PropertyTypeInfo; if (propertyTypeInfo == null) { - throw new ArgumentNullException(nameof(propertyTypeInfo)); + throw new ArgumentException(nameof(propertyInfo.PropertyTypeInfo)); } + string? propertyName = propertyInfo.PropertyName; if (propertyName == null) { - throw new ArgumentNullException(nameof(propertyName)); + throw new ArgumentException(nameof(propertyInfo.PropertyName)); } + JsonConverter? converter = propertyInfo.Converter; if (converter == null) { converter = propertyTypeInfo.PropertyInfoForTypeInfo.ConverterBase as JsonConverter; @@ -76,27 +58,13 @@ public static JsonPropertyInfo CreatePropertyInfo( } } - if (!isProperty && isVirtual) + if (!propertyInfo.IsProperty && propertyInfo.IsVirtual) { - throw new InvalidOperationException(SR.Format(SR.FieldCannotBeVirtual, nameof(isProperty), nameof(isVirtual))); + throw new InvalidOperationException(SR.Format(SR.FieldCannotBeVirtual, nameof(propertyInfo.IsProperty), nameof(propertyInfo.IsVirtual))); } JsonPropertyInfo jsonPropertyInfo = new JsonPropertyInfo(); - jsonPropertyInfo.InitializeForSourceGen( - options, - isProperty, - isPublic, - declaringType, - propertyTypeInfo, - converter, - getter, - setter, - ignoreCondition, - hasJsonInclude, - numberHandling, - propertyName, - jsonPropertyName); - + jsonPropertyInfo.InitializeForSourceGen(options, propertyInfo); return jsonPropertyInfo; } @@ -120,7 +88,7 @@ public static JsonTypeInfo CreateObjectInfo(JsonSerializerOptions options, /// A instance representing the type. public static JsonTypeInfo CreateValueInfo(JsonSerializerOptions options, JsonConverter converter) { - JsonTypeInfo info = new JsonTypeInfoInternal(options, ConverterStrategy.Value); + JsonTypeInfo info = new JsonTypeInfoInternal(options); info.PropertyInfoForTypeInfo = CreateJsonPropertyInfoForClassInfo(typeof(T), info, converter, options); return info; } diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonObjectInfoValues.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonObjectInfoValuesOfT.cs similarity index 100% rename from src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonObjectInfoValues.cs rename to src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonObjectInfoValuesOfT.cs diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonParameterInfo.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonParameterInfo.cs index ae2768ae0f5343..8aee3b75f34415 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonParameterInfo.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonParameterInfo.cs @@ -18,8 +18,6 @@ internal abstract class JsonParameterInfo private protected bool MatchingPropertyCanBeNull { get; private set; } - internal abstract object? ClrDefaultValue { get; } - // The default value of the parameter. This is `DefaultValue` of the `ParameterInfo`, if specified, or the CLR `default` for the `ParameterType`. public object? DefaultValue { get; private protected set; } @@ -75,18 +73,49 @@ public virtual void Initialize(JsonParameterInfoValues parameterInfo, JsonProper MatchingPropertyCanBeNull = matchingProperty.PropertyTypeCanBeNull; } - // Create a parameter that is ignored at run time. It uses the same type (typeof(sbyte)) to help - // prevent issues with unsupported types and helps ensure we don't accidently (de)serialize it. - public static JsonParameterInfo CreateIgnoredParameterPlaceholder(JsonParameterInfoValues parameterInfo, JsonPropertyInfo matchingProperty) + /// + /// Create a parameter that is ignored at run time. It uses the same type (typeof(sbyte)) to help + /// prevent issues with unsupported types and helps ensure we don't accidently (de)serialize it. + /// + public static JsonParameterInfo CreateIgnoredParameterPlaceholder( + JsonParameterInfoValues parameterInfo, + JsonPropertyInfo matchingProperty, + bool sourceGenMode) { - JsonParameterInfo jsonParameterInfo = matchingProperty.ConverterBase.CreateJsonParameterInfo(); + JsonParameterInfo jsonParameterInfo = new JsonParameterInfo(); jsonParameterInfo.ClrInfo = parameterInfo; jsonParameterInfo.RuntimePropertyType = matchingProperty.RuntimePropertyType!; jsonParameterInfo.NameAsUtf8Bytes = matchingProperty.NameAsUtf8Bytes!; - jsonParameterInfo.InitializeDefaultValue(matchingProperty); + + // TODO: https://github.com/dotnet/runtime/issues/60082. + // Default value initialization for params mapping to ignored properties doesn't + // account for the default value of optional parameters. This should be fixed. + + if (sourceGenMode) + { + // The value in the matching JsonPropertyInfo instance matches the parameter type. + jsonParameterInfo.DefaultValue = matchingProperty.DefaultValue; + } + else + { + // The value in the created JsonPropertyInfo instance (sbyte) + // doesn't match the parameter type, use reflection to get the default value. + Type parameterType = parameterInfo.ParameterType; + + GenericMethodHolder holder; + if (matchingProperty.Options.TryGetClass(parameterType, out JsonTypeInfo? typeInfo)) + { + holder = typeInfo.GenericMethods; + } + else + { + holder = GenericMethodHolder.CreateHolder(parameterInfo.ParameterType); + } + + jsonParameterInfo.DefaultValue = holder.DefaultValue; + } + return jsonParameterInfo; } - - protected abstract void InitializeDefaultValue(JsonPropertyInfo matchingProperty); } } diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonParameterInfoOfT.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonParameterInfoOfT.cs index 2195426a551edf..b275f01acd0952 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonParameterInfoOfT.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonParameterInfoOfT.cs @@ -11,8 +11,6 @@ namespace System.Text.Json.Serialization.Metadata /// internal sealed class JsonParameterInfo : JsonParameterInfo { - internal override object? ClrDefaultValue => default(T); - public T TypedDefaultValue { get; private set; } = default!; public override void Initialize(JsonParameterInfoValues parameterInfo, JsonPropertyInfo matchingProperty, JsonSerializerOptions options) @@ -21,7 +19,7 @@ public override void Initialize(JsonParameterInfoValues parameterInfo, JsonPrope InitializeDefaultValue(matchingProperty); } - protected override void InitializeDefaultValue(JsonPropertyInfo matchingProperty) + private void InitializeDefaultValue(JsonPropertyInfo matchingProperty) { Debug.Assert(ClrInfo.ParameterType == matchingProperty.DeclaredPropertyType); diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs index 0ae3d8126d931c..5e2258ec6dde83 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs @@ -42,16 +42,14 @@ internal static JsonPropertyInfo GetPropertyPlaceholder() // Create a property that is ignored at run-time. internal static JsonPropertyInfo CreateIgnoredPropertyPlaceholder( - JsonConverter converter, MemberInfo memberInfo, Type memberType, bool isVirtual, JsonSerializerOptions options) { - JsonPropertyInfo jsonPropertyInfo = converter.CreateJsonPropertyInfo(); + JsonPropertyInfo jsonPropertyInfo = new JsonPropertyInfo(); jsonPropertyInfo.Options = options; - jsonPropertyInfo.ConverterBase = converter; jsonPropertyInfo.MemberInfo = memberInfo; jsonPropertyInfo.IsIgnored = true; jsonPropertyInfo.DeclaredPropertyType = memberType; @@ -503,6 +501,11 @@ internal JsonTypeInfo RuntimeTypeInfo /// internal bool SrcGen_HasJsonInclude { get; set; } + /// + /// Relevant to source generated metadata: did the property have the ? + /// + internal bool SrcGen_IsExtensionData { get; set; } + /// /// Relevant to source generated metadata: is the property public? /// @@ -520,5 +523,10 @@ internal JsonTypeInfo RuntimeTypeInfo internal string? ClrName { get; set; } internal bool IsVirtual { get; set; } + + /// + /// Default value used for parameterized ctor invocation. + /// + internal abstract object? DefaultValue { get; } } } diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfoOfT.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfoOfT.cs index 6111f46117c347..e98f08dd54cdcd 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfoOfT.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfoOfT.cs @@ -28,8 +28,11 @@ internal sealed class JsonPropertyInfo : JsonPropertyInfo private bool _propertyTypeEqualsTypeToConvert; internal Func? Get { get; set; } + internal Action? Set { get; set; } + internal override object? DefaultValue => default(T); + public JsonConverter Converter { get; internal set; } = null!; internal override void Initialize( @@ -116,28 +119,15 @@ internal override void Initialize( GetPolicies(ignoreCondition, parentTypeNumberHandling); } - internal void InitializeForSourceGen( - JsonSerializerOptions options, - bool isProperty, - bool isPublic, - Type declaringType, - JsonTypeInfo typeInfo, - JsonConverter converter, - Func? getter, - Action? setter, - JsonIgnoreCondition? ignoreCondition, - bool hasJsonInclude, - JsonNumberHandling? numberHandling, - string propertyName, - string? jsonPropertyName) + internal void InitializeForSourceGen(JsonSerializerOptions options, JsonPropertyInfoValues propertyInfo) { Options = options; - ClrName = propertyName; + ClrName = propertyInfo.PropertyName; // Property name settings. - if (jsonPropertyName != null) + if (propertyInfo.JsonPropertyName != null) { - NameAsString = jsonPropertyName; + NameAsString = propertyInfo.JsonPropertyName; } else if (options.PropertyNamingPolicy == null) { @@ -154,13 +144,27 @@ internal void InitializeForSourceGen( NameAsUtf8Bytes ??= Encoding.UTF8.GetBytes(NameAsString!); EscapedNameSection ??= JsonHelpers.GetEscapedPropertyNameSection(NameAsUtf8Bytes, Options.Encoder); - - SrcGen_IsPublic = isPublic; - SrcGen_HasJsonInclude = hasJsonInclude; + SrcGen_IsPublic = propertyInfo.IsPublic; + SrcGen_HasJsonInclude = propertyInfo.HasJsonInclude; + SrcGen_IsExtensionData = propertyInfo.IsExtensionData; DeclaredPropertyType = typeof(T); + + JsonTypeInfo propertyTypeInfo = propertyInfo.PropertyTypeInfo; + Type declaringType = propertyInfo.DeclaringType; + + JsonConverter? converter = propertyInfo.Converter; + if (converter == null) + { + converter = propertyTypeInfo.PropertyInfoForTypeInfo.ConverterBase as JsonConverter; + if (converter == null) + { + throw new InvalidOperationException(SR.Format(SR.ConverterForPropertyMustBeValid, declaringType, ClrName, typeof(T))); + } + } + ConverterBase = converter; - if (ignoreCondition == JsonIgnoreCondition.Always) + if (propertyInfo.IgnoreCondition == JsonIgnoreCondition.Always) { IsIgnored = true; Debug.Assert(!ShouldSerialize); @@ -168,23 +172,23 @@ internal void InitializeForSourceGen( } else { - Get = getter!; - Set = setter; + Get = propertyInfo.Getter!; + Set = propertyInfo.Setter; HasGetter = Get != null; HasSetter = Set != null; - RuntimeTypeInfo = typeInfo; + RuntimeTypeInfo = propertyTypeInfo; DeclaringType = declaringType; - IgnoreCondition = ignoreCondition; - MemberType = isProperty ? MemberTypes.Property : MemberTypes.Field; + IgnoreCondition = propertyInfo.IgnoreCondition; + MemberType = propertyInfo.IsProperty ? MemberTypes.Property : MemberTypes.Field; - _converterIsExternalAndPolymorphic = !converter.IsInternalConverter && DeclaredPropertyType != converter.TypeToConvert; + _converterIsExternalAndPolymorphic = !ConverterBase.IsInternalConverter && DeclaredPropertyType != ConverterBase.TypeToConvert; PropertyTypeCanBeNull = typeof(T).CanBeNull(); - _propertyTypeEqualsTypeToConvert = converter.TypeToConvert == typeof(T); + _propertyTypeEqualsTypeToConvert = ConverterBase.TypeToConvert == typeof(T); ConverterStrategy = Converter!.ConverterStrategy; RuntimePropertyType = DeclaredPropertyType; DetermineIgnoreCondition(IgnoreCondition); // TODO: this method needs to also take the number handling option for the declaring type. - DetermineNumberHandlingForProperty(numberHandling, declaringTypeNumberHandling: null); + DetermineNumberHandlingForProperty(propertyInfo.NumberHandling, declaringTypeNumberHandling: null); DetermineSerializationCapabilities(IgnoreCondition); } } diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfoValuesOfT.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfoValuesOfT.cs new file mode 100644 index 00000000000000..ed7fffe7124c7b --- /dev/null +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfoValuesOfT.cs @@ -0,0 +1,82 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Text.Json.Serialization.Metadata +{ + /// + /// Provides serialization metadata about a property or field. + /// + /// The type to convert of the for the property. + public sealed class JsonPropertyInfoValues + { + /// + /// If , indicates that the member is a property, otherwise indicates the member is a field. + /// + public bool IsProperty { get; init; } + + /// + /// Whether the property or field is public. + /// + public bool IsPublic { get; init; } + + /// + /// Whether the property or field is a virtual property. + /// + public bool IsVirtual { get; init; } + + /// + /// The declaring type of the property or field. + /// + public Type DeclaringType { get; init; } = null!; + + /// + /// The info for the property or field's type. + /// + public JsonTypeInfo PropertyTypeInfo { get; init; } = null!; + + /// + /// A for the property or field, specified by . + /// + public JsonConverter? Converter { get; init; } + + /// + /// Provides a mechanism to get the property or field's value. + /// + public Func? Getter { get; init; } + + /// + /// Provides a mechanism to set the property or field's value. + /// + public Action? Setter { get; init; } + + /// + /// Specifies a condition for the member to be ignored. + /// + public JsonIgnoreCondition? IgnoreCondition { get; init; } + + /// + /// Whether the property was annotated with . + /// + public bool HasJsonInclude { get; init; } + + /// + /// Whether the property was annotated with . + /// + public bool IsExtensionData { get; init; } + + /// + /// If the property or field is a number, specifies how it should processed when serializing and deserializing. + /// + public JsonNumberHandling? NumberHandling { get; init; } + + /// + /// The name of the property or field. + /// + public string PropertyName { get; init; } = null!; + + /// + /// The name to be used when processing the property or field, specified by . + /// + public string? JsonPropertyName { get; init; } + } +} diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.Cache.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.Cache.cs index 00911d756bdefb..f696cefe8f21cd 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.Cache.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.Cache.cs @@ -58,6 +58,12 @@ internal static JsonPropertyInfo AddProperty( JsonNumberHandling? parentTypeNumberHandling, JsonSerializerOptions options) { + JsonIgnoreCondition? ignoreCondition = JsonPropertyInfo.GetAttribute(memberInfo)?.Condition; + if (ignoreCondition == JsonIgnoreCondition.Always) + { + return JsonPropertyInfo.CreateIgnoredPropertyPlaceholder(memberInfo, memberType, isVirtual, options); + } + JsonConverter converter = GetConverter( memberType, parentClassType, @@ -65,12 +71,6 @@ internal static JsonPropertyInfo AddProperty( out Type runtimeType, options); - JsonIgnoreCondition? ignoreCondition = JsonPropertyInfo.GetAttribute(memberInfo)?.Condition; - if (ignoreCondition == JsonIgnoreCondition.Always) - { - return JsonPropertyInfo.CreateIgnoredPropertyPlaceholder(converter, memberInfo, memberType, isVirtual, options); - } - return CreateProperty( declaredPropertyType: memberType, runtimePropertyType: runtimeType, @@ -613,6 +613,16 @@ internal void InitializePropCache() continue; } + if (jsonPropertyInfo.SrcGen_IsExtensionData) + { + // Source generator compile-time type inspection has performed this validation for us. + Debug.Assert(DataExtensionProperty == null); + Debug.Assert(IsValidDataExtensionProperty(jsonPropertyInfo)); + + DataExtensionProperty = jsonPropertyInfo; + continue; + } + CacheMember(jsonPropertyInfo, propertyCache, ref ignoredMembers); } @@ -636,7 +646,7 @@ internal void InitializeParameterCache() return; } - InitializeConstructorParameters(array); + InitializeConstructorParameters(array, sourceGenMode: true); Debug.Assert(ParameterCache != null); } } diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.cs index 28fb27669139e6..b7e11501e60459 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.cs @@ -130,12 +130,7 @@ internal GenericMethodHolder GenericMethods { get { - if (_genericMethods == null) - { - Type runtimePropertyClass = typeof(GenericMethodHolder<>).MakeGenericType(new Type[] { Type })!; - _genericMethods = (GenericMethodHolder)Activator.CreateInstance(runtimePropertyClass)!; - } - + _genericMethods ??= GenericMethodHolder.CreateHolder(Type); return _genericMethods; } } @@ -147,7 +142,7 @@ internal JsonTypeInfo() Debug.Assert(false, "This constructor should not be called."); } - internal JsonTypeInfo(Type type, JsonSerializerOptions options, ConverterStrategy converterStrategy) + internal JsonTypeInfo(Type type, JsonSerializerOptions options, bool dummy) { Type = type; Options = options ?? throw new ArgumentNullException(nameof(options)); @@ -451,7 +446,7 @@ public ParameterLookupValue(JsonPropertyInfo jsonPropertyInfo) public JsonPropertyInfo JsonPropertyInfo { get; } } - private void InitializeConstructorParameters(JsonParameterInfoValues[] jsonParameters) + private void InitializeConstructorParameters(JsonParameterInfoValues[] jsonParameters, bool sourceGenMode = false) { var parameterCache = new JsonPropertyDictionary(Options.PropertyNameCaseInsensitive, jsonParameters.Length); @@ -497,14 +492,14 @@ private void InitializeConstructorParameters(JsonParameterInfoValues[] jsonParam Debug.Assert(matchingEntry.JsonPropertyInfo != null); JsonPropertyInfo jsonPropertyInfo = matchingEntry.JsonPropertyInfo; - JsonParameterInfo jsonParameterInfo = CreateConstructorParameter(parameterInfo, jsonPropertyInfo, Options); + JsonParameterInfo jsonParameterInfo = CreateConstructorParameter(parameterInfo, jsonPropertyInfo, sourceGenMode, Options); parameterCache.Add(jsonPropertyInfo.NameAsString, jsonParameterInfo); } // It is invalid for the extension data property to bind with a constructor argument. else if (DataExtensionProperty != null && StringComparer.OrdinalIgnoreCase.Equals(paramToCheck.Name, DataExtensionProperty.NameAsString)) { - ThrowHelper.ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(DataExtensionProperty.MemberInfo!, Type); + ThrowHelper.ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(DataExtensionProperty); } } @@ -527,7 +522,7 @@ private static JsonParameterInfoValues[] GetParameterInfoArray(ParameterInfo[] p ParameterType = reflectionInfo.ParameterType, Position = reflectionInfo.Position, HasDefaultValue = reflectionInfo.HasDefaultValue, - DefaultValue = reflectionInfo.DefaultValue + DefaultValue = reflectionInfo.GetDefaultValue() }; jsonParameters[i] = jsonInfo; @@ -554,17 +549,7 @@ private static bool PropertyIsOverridenAndIgnored( private void ValidateAndAssignDataExtensionProperty(JsonPropertyInfo jsonPropertyInfo) { - Type memberType = jsonPropertyInfo.DeclaredPropertyType; - JsonConverter? converter = null; - if (typeof(IDictionary).IsAssignableFrom(memberType) || - typeof(IDictionary).IsAssignableFrom(memberType) || - // Avoid a reference to typeof(JsonNode) to support trimming. - (memberType.FullName == JsonObjectTypeName && ReferenceEquals(memberType.Assembly, GetType().Assembly))) - { - converter = Options.GetConverterInternal(memberType); - } - - if (converter == null) + if (!IsValidDataExtensionProperty(jsonPropertyInfo)) { ThrowHelper.ThrowInvalidOperationException_SerializationDataExtensionPropertyInvalid(Type, jsonPropertyInfo); } @@ -572,14 +557,27 @@ private void ValidateAndAssignDataExtensionProperty(JsonPropertyInfo jsonPropert DataExtensionProperty = jsonPropertyInfo; } + private bool IsValidDataExtensionProperty(JsonPropertyInfo jsonPropertyInfo) + { + Type memberType = jsonPropertyInfo.DeclaredPropertyType; + + bool typeIsValid = typeof(IDictionary).IsAssignableFrom(memberType) || + typeof(IDictionary).IsAssignableFrom(memberType) || + // Avoid a reference to typeof(JsonNode) to support trimming. + (memberType.FullName == JsonObjectTypeName && ReferenceEquals(memberType.Assembly, GetType().Assembly)); + + return typeIsValid && Options.GetConverterInternal(memberType) != null; + } + private static JsonParameterInfo CreateConstructorParameter( JsonParameterInfoValues parameterInfo, JsonPropertyInfo jsonPropertyInfo, + bool sourceGenMode, JsonSerializerOptions options) { if (jsonPropertyInfo.IsIgnored) { - return JsonParameterInfo.CreateIgnoredParameterPlaceholder(parameterInfo, jsonPropertyInfo); + return JsonParameterInfo.CreateIgnoredParameterPlaceholder(parameterInfo, jsonPropertyInfo, sourceGenMode); } JsonConverter converter = jsonPropertyInfo.ConverterBase; diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoInternalOfT.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoInternalOfT.cs index e7e5dc7067bf52..552b49658dddd2 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoInternalOfT.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoInternalOfT.cs @@ -1,7 +1,6 @@ // 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.Generic; using System.Text.Json.Serialization.Converters; namespace System.Text.Json.Serialization.Metadata @@ -13,17 +12,17 @@ namespace System.Text.Json.Serialization.Metadata internal sealed class JsonTypeInfoInternal : JsonTypeInfo { /// - /// Creates serialization metadata given JsonSerializerOptions and a ConverterStrategy. + /// Creates serialization metadata for a type using a simple converter. /// - public JsonTypeInfoInternal(JsonSerializerOptions options, ConverterStrategy converterStrategy) - : base(typeof(T), options, converterStrategy) + public JsonTypeInfoInternal(JsonSerializerOptions options) + : base(typeof(T), options) { } /// /// Creates serialization metadata for an object. /// - public JsonTypeInfoInternal(JsonSerializerOptions options, JsonObjectInfoValues objectInfo) : base(typeof(T), options, ConverterStrategy.Object) + public JsonTypeInfoInternal(JsonSerializerOptions options, JsonObjectInfoValues objectInfo) : base(typeof(T), options) { #pragma warning disable CS8714 // The type cannot be used as type parameter in the generic type or method. @@ -46,66 +45,40 @@ public JsonTypeInfoInternal(JsonSerializerOptions options, JsonObjectInfoValues< #pragma warning restore CS8714 PropInitFunc = objectInfo.PropertyMetadataInitializer; - Serialize = objectInfo.SerializeHandler; + SerializeHandler = objectInfo.SerializeHandler; PropertyInfoForTypeInfo = JsonMetadataServices.CreateJsonPropertyInfoForClassInfo(typeof(T), this, converter, Options); NumberHandling = objectInfo.NumberHandling; } /// - /// Creates serialization metadata for a . + /// Creates serialization metadata for a collection. /// public JsonTypeInfoInternal( JsonSerializerOptions options, - Func? createObjectFunc, + JsonCollectionInfoValues collectionInfo, Func> converterCreator, - JsonTypeInfo? elementInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc, - Type elementType, object? createObjectWithArgs = null, object? addFunc = null) - : base(typeof(T), options, ConverterStrategy.Enumerable) + : base(typeof(T), options) { - JsonConverter converter = new JsonMetadataServicesConverter(converterCreator, ConverterStrategy.Enumerable); - - ElementType = converter.ElementType; - ElementTypeInfo = elementInfo ?? throw new ArgumentNullException(nameof(elementInfo)); - NumberHandling = numberHandling; - PropertyInfoForTypeInfo = JsonMetadataServices.CreateJsonPropertyInfoForClassInfo(typeof(T), this, converter, options); - Serialize = serializeFunc; - CreateObjectWithArgs = createObjectWithArgs; - AddMethodDelegate = addFunc; - SetCreateObjectFunc(createObjectFunc); - } + if (collectionInfo == null) + { + throw new ArgumentNullException(nameof(collectionInfo)); + } - /// - /// Creates serialization metadata for a . - /// - public JsonTypeInfoInternal( - JsonSerializerOptions options, - Func? createObjectFunc, - Func> converterCreator, - JsonTypeInfo? keyInfo, - JsonTypeInfo? valueInfo, - JsonNumberHandling numberHandling, - Action? serializeFunc, - Type keyType, - Type elementType, - object? createObjectWithArgs = null) - : base(typeof(T), options, ConverterStrategy.Dictionary) - { - JsonConverter converter = new JsonMetadataServicesConverter(converterCreator, ConverterStrategy.Dictionary); + ConverterStrategy strategy = collectionInfo.KeyInfo == null ? ConverterStrategy.Enumerable : ConverterStrategy.Dictionary; + JsonConverter converter = new JsonMetadataServicesConverter(converterCreator, strategy); KeyType = converter.KeyType; ElementType = converter.ElementType; - KeyTypeInfo = keyInfo ?? throw new ArgumentNullException(nameof(keyInfo)); - ElementType = converter.ElementType; - ElementTypeInfo = valueInfo ?? throw new ArgumentNullException(nameof(valueInfo)); - NumberHandling = numberHandling; + KeyTypeInfo = collectionInfo.KeyInfo; + ElementTypeInfo = collectionInfo.ElementInfo ?? throw new ArgumentNullException(nameof(collectionInfo.ElementInfo)); + NumberHandling = collectionInfo.NumberHandling; PropertyInfoForTypeInfo = JsonMetadataServices.CreateJsonPropertyInfoForClassInfo(typeof(T), this, converter, options); - Serialize = serializeFunc; + SerializeHandler = collectionInfo.SerializeHandler; CreateObjectWithArgs = createObjectWithArgs; - SetCreateObjectFunc(createObjectFunc); + AddMethodDelegate = addFunc; + SetCreateObjectFunc(collectionInfo.ObjectCreator); } private void SetCreateObjectFunc(Func? createObjectFunc) diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs index 337fd7cf1a3ca9..e09f840c2c0f50 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs @@ -15,8 +15,8 @@ public abstract class JsonTypeInfo : JsonTypeInfo { private Action? _serialize; - internal JsonTypeInfo(Type type, JsonSerializerOptions options, ConverterStrategy converterStrategy) : - base(type, options, converterStrategy) + internal JsonTypeInfo(Type type, JsonSerializerOptions options) : + base(type, options, dummy: false) { } internal JsonTypeInfo() @@ -25,10 +25,11 @@ internal JsonTypeInfo() } /// - /// A method that serializes an instance of using + /// Serializes an instance of using /// values specified at design time. /// - public Action? Serialize + /// The writer is not flushed after writing. + public Action? SerializeHandler { get { diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/ReflectionEmitMemberAccessor.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/ReflectionEmitMemberAccessor.cs index 4357b7dac9198b..0827931b5df1de 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/ReflectionEmitMemberAccessor.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/ReflectionEmitMemberAccessor.cs @@ -49,6 +49,11 @@ internal sealed class ReflectionEmitMemberAccessor : MemberAccessor else { generator.Emit(OpCodes.Newobj, realMethod); + if (type.IsValueType) + { + // Since C# 10 it's now possible to have parameterless constructors in structs + generator.Emit(OpCodes.Box, type); + } } generator.Emit(OpCodes.Ret); diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs index 7312f6f07df499..479cbe4abcca6d 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs @@ -40,6 +40,12 @@ internal struct WriteStack /// public CancellationToken CancellationToken; + /// + /// In the case of async serialization, used by resumable converters to signal that + /// the current buffer contents should not be flushed to the underlying stream. + /// + public bool SuppressFlush; + /// /// Stores a pending task that a resumable converter depends on to continue work. /// It must be awaited by the root context before serialization is resumed. @@ -341,7 +347,7 @@ public string PropertyPath() static void AppendStackFrame(StringBuilder sb, ref WriteStackFrame frame) { // Append the property name. - string? propertyName = frame.DeclaredJsonPropertyInfo?.MemberInfo?.Name; + string? propertyName = frame.DeclaredJsonPropertyInfo?.ClrName; if (propertyName == null) { // Attempt to get the JSON property name from the property name specified in re-entry. diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Serialization.cs b/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Serialization.cs index 9de23e8d011a9e..a75f5eaa484067 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Serialization.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.Serialization.cs @@ -215,9 +215,9 @@ public static void ThrowInvalidOperationException_ConstructorParameterIncomplete [DoesNotReturn] [MethodImpl(MethodImplOptions.NoInlining)] - public static void ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(MemberInfo memberInfo, Type classType) + public static void ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(JsonPropertyInfo jsonPropertyInfo) { - throw new InvalidOperationException(SR.Format(SR.ExtensionDataCannotBindToCtorParam, memberInfo, classType)); + throw new InvalidOperationException(SR.Format(SR.ExtensionDataCannotBindToCtorParam, jsonPropertyInfo.ClrName, jsonPropertyInfo.DeclaringType)); } [DoesNotReturn] diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Double.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Double.cs index f8a46a31468ca9..bf16e32e9f8d57 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Double.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Double.cs @@ -109,9 +109,7 @@ private static bool TryFormatDouble(double value, Span destination, out in #if BUILDING_INBOX_LIBRARY return Utf8Formatter.TryFormat(value, destination, out bytesWritten); #else - const string FormatString = "G17"; - - string utf16Text = value.ToString(FormatString, CultureInfo.InvariantCulture); + string utf16Text = value.ToString(JsonConstants.DoubleFormatString, CultureInfo.InvariantCulture); // Copy the value to the destination, if it's large enough. diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Float.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Float.cs index 2f046d872f6972..067971e86b5af4 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Float.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Float.cs @@ -109,9 +109,7 @@ private static bool TryFormatSingle(float value, Span destination, out int #if BUILDING_INBOX_LIBRARY return Utf8Formatter.TryFormat(value, destination, out bytesWritten); #else - const string FormatString = "G9"; - - string utf16Text = value.ToString(FormatString, CultureInfo.InvariantCulture); + string utf16Text = value.ToString(JsonConstants.SingleFormatString, CultureInfo.InvariantCulture); // Copy the value to the destination, if it's large enough. diff --git a/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.AsyncEnumerable.cs b/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.AsyncEnumerable.cs index ba855bd5f6bbf6..ac2999d72e3159 100644 --- a/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.AsyncEnumerable.cs +++ b/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.AsyncEnumerable.cs @@ -252,6 +252,24 @@ static async IAsyncEnumerable GetNumbersAsync() } } + [Fact] + public async Task RegressionTest_ExceptionOnFirstMoveNextShouldNotFlushBuffer() + { + // Regression test for https://github.com/dotnet/aspnetcore/issues/36977 + using var stream = new MemoryStream(); + await Assert.ThrowsAsync(async () => await JsonSerializer.SerializeAsync(stream, new { Data = GetFailingAsyncEnumerable() })); + Assert.Equal(0, stream.Length); + + static async IAsyncEnumerable GetFailingAsyncEnumerable() + { + await Task.Yield(); + throw new NotImplementedException(); +#pragma warning disable CS0162 // Unreachable code detected + yield break; +#pragma warning restore CS0162 // Unreachable code detected + } + } + public class MockedAsyncEnumerable : IAsyncEnumerable, IEnumerable { private readonly IEnumerable _source; diff --git a/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.Dictionary.NonStringKey.cs b/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.Dictionary.NonStringKey.cs index 177b42fae56e6e..2c2ee556fbb991 100644 --- a/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.Dictionary.NonStringKey.cs +++ b/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.Dictionary.NonStringKey.cs @@ -665,23 +665,26 @@ static void ValidateException(NotSupportedException ex) public class CustomInt32ConverterSerializerContext : JsonSerializerContext { - public CustomInt32ConverterSerializerContext() : base(null, null) { } + public CustomInt32ConverterSerializerContext() : base(null) { } public override JsonTypeInfo? GetTypeInfo(Type _) => throw new NotImplementedException(); public JsonTypeInfo> DictionaryInt32String => _dictionaryInt32String ??= CreateDictionaryConverter(); private JsonTypeInfo>? _dictionaryInt32String; + protected override JsonSerializerOptions? GeneratedSerializerOptions => null; + private JsonTypeInfo> CreateDictionaryConverter() { JsonTypeInfo keyInfo = JsonMetadataServices.CreateValueInfo(Options, new ConverterForInt32()); JsonTypeInfo valueInfo = JsonMetadataServices.CreateValueInfo(Options, JsonMetadataServices.StringConverter); - return JsonMetadataServices.CreateDictionaryInfo, int, string>( - Options, - createObjectFunc: () => new(), - keyInfo, valueInfo, - numberHandling: default, - serializeFunc: null - ); + JsonCollectionInfoValues> info = new() + { + ObjectCreator = () => new(), + KeyInfo = keyInfo, + ElementInfo = valueInfo, + }; + + return JsonMetadataServices.CreateDictionaryInfo, int, string>(Options, info); } } diff --git a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Cache.cs b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Cache.cs index e2275bc7ff7f8f..63c5398f901429 100644 --- a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Cache.cs +++ b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Cache.cs @@ -11,9 +11,6 @@ public abstract partial class ConstructorTests { [Fact] [OuterLoop] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task MultipleThreadsLooping() { const int Iterations = 100; @@ -25,13 +22,10 @@ public async Task MultipleThreadsLooping() } [Fact] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task MultipleThreads() { // Verify the test class has >32 properties since that is a threshold for using the fallback dictionary. - Assert.True(typeof(ClassWithConstructor_SimpleAndComplexParameters).GetProperties(BindingFlags.Instance | BindingFlags.Public).Length > 32); + Assert.True(typeof(ObjWCtorMixedParams).GetProperties(BindingFlags.Instance | BindingFlags.Public).Length > 32); async Task DeserializeObjectAsync(string json, Type type, JsonSerializerOptions options) { @@ -60,7 +54,7 @@ async Task DeserializeObjectNormalAsync(Type type, JsonSerializerOptions options async Task SerializeObject(Type type, JsonSerializerOptions options) { - var obj = ClassWithConstructor_SimpleAndComplexParameters.GetInstance(); + var obj = ObjWCtorMixedParams.GetInstance(); await JsonSerializerWrapperForString.SerializeWrapper(obj, options); }; @@ -87,7 +81,7 @@ async Task RunTestAsync(Type type) await Task.WhenAll(tasks); } - await RunTestAsync(typeof(ClassWithConstructor_SimpleAndComplexParameters)); + await RunTestAsync(typeof(ObjWCtorMixedParams)); await RunTestAsync(typeof(Person_Class)); await RunTestAsync(typeof(Parameterized_Class_With_ComplexTuple)); } @@ -99,13 +93,13 @@ public async Task PropertyCacheWithMinInputsFirst() var options = new JsonSerializerOptions(); string json = "{}"; - await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + await JsonSerializerWrapperForString.DeserializeWrapper(json, options); - ClassWithConstructor_SimpleAndComplexParameters testObj = ClassWithConstructor_SimpleAndComplexParameters.GetInstance(); + ObjWCtorMixedParams testObj = ObjWCtorMixedParams.GetInstance(); testObj.Verify(); json = await JsonSerializerWrapperForString.SerializeWrapper(testObj, options); - testObj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + testObj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); testObj.Verify(); } @@ -115,15 +109,15 @@ public async Task PropertyCacheWithMinInputsLast() // Use local options to avoid obtaining already cached metadata from the default options. var options = new JsonSerializerOptions(); - ClassWithConstructor_SimpleAndComplexParameters testObj = ClassWithConstructor_SimpleAndComplexParameters.GetInstance(); + ObjWCtorMixedParams testObj = ObjWCtorMixedParams.GetInstance(); testObj.Verify(); string json = await JsonSerializerWrapperForString.SerializeWrapper(testObj, options); - testObj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + testObj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); testObj.Verify(); json = "{}"; - await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + await JsonSerializerWrapperForString.DeserializeWrapper(json, options); } // Use a common options instance to encourage additional metadata collisions across types. Also since @@ -132,9 +126,6 @@ public async Task PropertyCacheWithMinInputsLast() [Fact] [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/45464", RuntimeConfiguration.Checked)] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task MultipleTypes() { async Task Serialize(object[] args) diff --git a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Exceptions.cs b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Exceptions.cs index f34687d65bd59c..679ddca2a04c80 100644 --- a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Exceptions.cs +++ b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Exceptions.cs @@ -114,14 +114,11 @@ public async Task RandomReferenceMetadataNotSupported() } [Fact] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task ExtensionDataProperty_CannotBindTo_CtorParam() { InvalidOperationException ex = await Assert.ThrowsAsync(() => JsonSerializerWrapperForString.DeserializeWrapper("{}")); - string exStr = ex.ToString(); // System.InvalidOperationException: 'The extension data property 'System.Collections.Generic.Dictionary`2[System.String,System.Text.Json.JsonElement] ExtensionData' on type 'System.Text.Json.Serialization.Tests.ConstructorTests+Class_ExtData_CtorParam' cannot bind with a parameter in constructor 'Void .ctor(System.Collections.Generic.Dictionary`2[System.String,System.Text.Json.JsonElement])'.' - Assert.Contains("System.Collections.Generic.Dictionary`2[System.String,System.Text.Json.JsonElement] ExtensionData", exStr); + string exStr = ex.ToString(); // System.InvalidOperationException: 'The extension data property 'ExtensionData' on type 'System.Text.Json.Serialization.Tests.ConstructorTests+Class_ExtData_CtorParam' cannot bind with a parameter in the deserialization constructor.' + Assert.Contains("ExtensionData", exStr); Assert.Contains("System.Text.Json.Serialization.Tests.ConstructorTests+Class_ExtData_CtorParam", exStr); } @@ -204,6 +201,7 @@ public async Task PathForChildListFails() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/39055 (already fixed in main)")] public async Task PathForChildDictionaryFails() { JsonException e = await Assert.ThrowsAsync(() => JsonSerializerWrapperForString.DeserializeWrapper(@"{""Child"":{""MyDictionary"":{""Key"": bad]")); @@ -273,21 +271,21 @@ public async Task CaseInsensitiveFails() // Baseline (no exception) { - var obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""mydecimal"":1}", options); + var obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""mydecimal"":1}", options); Assert.Equal(1, obj.MyDecimal); } { - var obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""MYDECIMAL"":1}", options); + var obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""MYDECIMAL"":1}", options); Assert.Equal(1, obj.MyDecimal); } JsonException e; - e = await Assert.ThrowsAsync(() => JsonSerializerWrapperForString.DeserializeWrapper(@"{""mydecimal"":bad}", options)); + e = await Assert.ThrowsAsync(() => JsonSerializerWrapperForString.DeserializeWrapper(@"{""mydecimal"":bad}", options)); Assert.Equal("$.mydecimal", e.Path); - e = await Assert.ThrowsAsync(() => JsonSerializerWrapperForString.DeserializeWrapper(@"{""MYDECIMAL"":bad}", options)); + e = await Assert.ThrowsAsync(() => JsonSerializerWrapperForString.DeserializeWrapper(@"{""MYDECIMAL"":bad}", options)); Assert.Equal("$.MYDECIMAL", e.Path); } diff --git a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.ParameterMatching.cs b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.ParameterMatching.cs index 5f2da8c2caa8cd..9bcd1bfe0586f8 100644 --- a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.ParameterMatching.cs +++ b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.ParameterMatching.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; +using System.Reflection; using System.Threading.Tasks; using Xunit; @@ -291,9 +292,6 @@ public async Task Null_AsArgument_To_ParameterThat_CanNotBeNull() } [Fact] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task OtherPropertiesAreSet() { var personClass = await JsonSerializerWrapperForString.DeserializeWrapper(Person_Class.s_json); @@ -312,9 +310,6 @@ public async Task ExtraProperties_AreIgnored() } [Fact] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task ExtraProperties_GoInExtensionData_IfPresent() { Point_2D_With_ExtData point = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""X"":1,""y"":2,""b"":3}"); @@ -368,7 +363,7 @@ public async Task IgnoreNullValues_DontSetNull_ToConstructorArguments_ThatCantBe [Fact] public async Task NumerousSimpleAndComplexParameters() { - var obj = await JsonSerializerWrapperForString.DeserializeWrapper(ClassWithConstructor_SimpleAndComplexParameters.s_json); + var obj = await JsonSerializerWrapperForString.DeserializeWrapper(ObjWCtorMixedParams.s_json); obj.Verify(); } @@ -565,7 +560,7 @@ public async Task TupleDeserialization_DefaultValuesUsed_WhenJsonMissing() #endif public async Task TupleDeserializationWorks_ClassWithParameterizedCtor() { - string classJson = ClassWithConstructor_SimpleAndComplexParameters.s_json; + string classJson = ObjWCtorMixedParams.s_json; StringBuilder sb = new StringBuilder(); sb.Append("{"); @@ -579,13 +574,13 @@ public async Task TupleDeserializationWorks_ClassWithParameterizedCtor() string complexTupleJson = sb.ToString(); var complexTuple = await JsonSerializerWrapperForString.DeserializeWrapper>(complexTupleJson); + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams>>(complexTupleJson); complexTuple.Item1.Verify(); complexTuple.Item2.Verify(); @@ -793,9 +788,6 @@ public async Task LastParameterWins() } [Fact] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task LastParameterWins_DoesNotGoToExtensionData() { string json = @"{ @@ -823,9 +815,6 @@ public async Task BitVector32_UsesStructDefaultCtor_MultipleParameterizedCtor() } [Fact] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task HonorExtensionDataGeneric() { var obj1 = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""key"": ""value""}"); @@ -1228,5 +1217,313 @@ public class TypeWithUri public TypeWithUri(Uri myUri = default) => MyUri = myUri; } + + [Fact] + public async Task SmallObject_ClrDefaultParamValueUsed_WhenMatchingPropIgnored() + { + string json = @"{""Prop"":20}"; + var obj1 = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(0, obj1.Prop); + + var obj2 = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(0, obj2.Prop); + } + + public class SmallType_IgnoredProp_Bind_ParamWithDefaultValue + { + [JsonIgnore] + public int Prop { get; set; } + + public SmallType_IgnoredProp_Bind_ParamWithDefaultValue(int prop = 5) + => Prop = prop; + } + + public class SmallType_IgnoredProp_Bind_Param + { + [JsonIgnore] + public int Prop { get; set; } + + public SmallType_IgnoredProp_Bind_Param(int prop) + => Prop = prop; + } + + [Fact] + public async Task LargeObject_ClrDefaultParamValueUsed_WhenMatchingPropIgnored() + { + string json = @"{""Prop"":20}"; + var obj1 = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(0, obj1.Prop); + + var obj2 = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(0, obj2.Prop); + } + + public class LargeType_IgnoredProp_Bind_ParamWithDefaultValue + { + public int W { get; set; } + + public int X { get; set; } + + public int Y { get; set; } + + public int Z { get; set; } + + [JsonIgnore] + public int Prop { get; set; } + + public LargeType_IgnoredProp_Bind_ParamWithDefaultValue(int w, int x, int y, int z, int prop = 5) + => Prop = prop; + } + + public class LargeType_IgnoredProp_Bind_Param + { + public int W { get; set; } + + public int X { get; set; } + + public int Y { get; set; } + + public int Z { get; set; } + + [JsonIgnore] + public int Prop { get; set; } + + public LargeType_IgnoredProp_Bind_Param(int w, int x, int y, int z, int prop) + => Prop = prop; + } + + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/34779")] + public async Task BindingBetweenRefProps() + { + string json = @"{""NameRef"":""John""}"; + await JsonSerializerWrapperForString.DeserializeWrapper(json); + } + + public class TypeWith_RefStringProp_ParamCtor + { + private string _name; + + public ref string NameRef => ref _name; + + public TypeWith_RefStringProp_ParamCtor(ref string nameRef) => _name = nameRef; + } + + [Fact] + public async Task BindToIgnoredPropOfSameType() + { + string json = @"{""Prop"":{}}"; + Assert.NotNull(await JsonSerializerWrapperForString.DeserializeWrapper(json)); + } + + public class ClassWithIgnoredSameType + { + [JsonIgnore] + public ClassWithIgnoredSameType Prop { get; } + + public ClassWithIgnoredSameType(ClassWithIgnoredSameType prop) { } + } + + [Fact] + public void StructWithPropertyInit_DeseralizeEmptyObject() + { + string json = @"{}"; + var obj = JsonSerializer.Deserialize(json); + Assert.Equal(42, obj.A); + Assert.Equal(0, obj.B); + } + + [Fact] + public void StructWithPropertyInit_OverrideInitedProperty() + { + string json = @"{""A"":43}"; + var obj = JsonSerializer.Deserialize(json); + Assert.Equal(43, obj.A); + Assert.Equal(0, obj.B); + + json = @"{""A"":0,""B"":44}"; + obj = JsonSerializer.Deserialize(json); + Assert.Equal(0, obj.A); + Assert.Equal(44, obj.B); + + json = @"{""B"":45}"; + obj = JsonSerializer.Deserialize(json); + Assert.Equal(42, obj.A); // JSON doesn't set A property so it's expected to be 42 + Assert.Equal(45, obj.B); + } + + public struct StructWithPropertyInit + { + public StructWithPropertyInit() {} + public long A { get; set; } = 42; + public long B { get; set; } = 0; + } + + [Fact] + public void StructWithFieldInit_DeseralizeEmptyObject() + { + string json = @"{}"; + var obj = JsonSerializer.Deserialize(json); + Assert.Equal(0, obj.A); + Assert.Equal(42, obj.B); + } + + public struct StructWithFieldInit + { + public StructWithFieldInit() {} + public long A = 0; + public long B = 42; + } + + [Fact] + public void StructWithExplicitParameterlessCtor_DeseralizeEmptyObject() + { + string json = @"{}"; + var obj = JsonSerializer.Deserialize(json); + Assert.Equal(42, obj.A); + } + + public struct StructWithExplicitParameterlessCtor + { + public long A; + public StructWithExplicitParameterlessCtor() => A = 42; + } + + public async Task TestClassWithDefaultCtorParams() + { + ClassWithDefaultCtorParams obj = new ClassWithDefaultCtorParams( + new Point_2D_Struct_WithAttribute(1, 2), + DayOfWeek.Sunday, + (DayOfWeek)(-2), + (DayOfWeek)19, + BindingFlags.CreateInstance | BindingFlags.FlattenHierarchy, + SampleEnumUInt32.MinZero, + "Hello world!", + null, + "xzy", + 'c', + ' ', + 23, + 4, + -40, + double.Epsilon, + 23, + 4, + -40, + float.MinValue, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10); + + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + JsonTestHelper.AssertJsonEqual(json, await JsonSerializerWrapperForString.SerializeWrapper(obj)); + } + + public class ClassWithDefaultCtorParams + { + public Point_2D_Struct_WithAttribute Struct { get; } + public DayOfWeek Enum1 { get; } + public DayOfWeek Enum2 { get; } + public DayOfWeek Enum3 { get; } + public BindingFlags Enum4 { get; } + public SampleEnumUInt32 Enum5 { get; } + public string Str1 { get; } + public string Str2 { get; } + public string Str3 { get; } + public char Char1 { get; } + public char Char2 { get; } + public double Double1 { get; } + public double Double2 { get; } + public double Double3 { get; } + public double Double4 { get; } + public double Double5 { get; } + public float Float1 { get; } + public float Float2 { get; } + public float Float3 { get; } + public float Float4 { get; } + public float Float5 { get; } + public byte Byte { get; } + public decimal Decimal1 { get; } + public decimal Decimal2 { get; } + public short Short { get; } + public sbyte Sbyte { get; } + public int Int { get; } + public long Long { get; } + public ushort UShort { get; } + public uint UInt { get; } + public ulong ULong { get; } + + public ClassWithDefaultCtorParams( + Point_2D_Struct_WithAttribute @struct = default, + DayOfWeek enum1 = default, + DayOfWeek enum2 = DayOfWeek.Sunday, + DayOfWeek enum3 = DayOfWeek.Sunday | DayOfWeek.Monday, + BindingFlags enum4 = BindingFlags.CreateInstance | BindingFlags.ExactBinding, + SampleEnumUInt32 enum5 = SampleEnumUInt32.MinZero, + string str1 = "abc", + string str2 = "", + string str3 = "\n\r⁉️\'\"\u200D\f\t\v\0\a\b\\\'\"", + char char1 = 'a', + char char2 = '\u200D', + double double1 = double.NegativeInfinity, + double double2 = double.PositiveInfinity, + double double3 = double.NaN, + double double4 = double.MaxValue, + double double5 = double.Epsilon, + float float1 = float.NegativeInfinity, + float float2 = float.PositiveInfinity, + float float3 = float.NaN, + float float4 = float.MinValue, + float float5 = float.Epsilon, + byte @byte = byte.MinValue, + decimal @decimal1 = decimal.MinValue, + decimal @decimal2 = decimal.MaxValue, + short @short = short.MinValue, + sbyte @sbyte = sbyte.MaxValue, + int @int = int.MinValue, + long @long = long.MaxValue, + ushort @ushort = ushort.MinValue, + uint @uint = uint.MaxValue, + ulong @ulong = ulong.MinValue) + { + Struct = @struct; + Enum1 = enum1; + Enum2 = enum2; + Enum3 = enum3; + Enum4 = enum4; + Enum5 = enum5; + Str1 = str1; + Str2 = str2; + Str3 = str3; + Char1 = char1; + Char2 = char2; + Double1 = double1; + Double2 = double2; + Double3 = double3; + Double4 = double4; + Float1 = float1; + Float2 = float2; + Float3 = float3; + Float4 = float4; + Byte = @byte; + Decimal1 = @decimal1; + Decimal2 = @decimal2; + Short = @short; + Sbyte = @sbyte; + Int = @int; + Long = @long; + UShort = @ushort; + UInt = @uint; + ULong = @ulong; + } + } } } diff --git a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Stream.cs b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Stream.cs index ac5cd60933bf9f..92b3b480506df0 100644 --- a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Stream.cs +++ b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Stream.cs @@ -12,9 +12,6 @@ public abstract partial class ConstructorTests { [Fact] [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/45464", RuntimeConfiguration.Checked)] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task ReadSimpleObjectAsync() { async Task RunTestAsync(byte[] testData) @@ -37,7 +34,7 @@ async Task RunTestAsync(byte[] testData) // Simple models can be deserialized. tasks[0] = Task.Run(async () => await RunTestAsync(Parameterized_IndexViewModel_Immutable.s_data)); // Complex models can be deserialized. - tasks[1] = Task.Run(async () => await RunTestAsync(ClassWithConstructor_SimpleAndComplexParameters.s_data)); + tasks[1] = Task.Run(async () => await RunTestAsync(ObjWCtorMixedParams.s_data)); tasks[2] = Task.Run(async () => await RunTestAsync(Parameterized_Class_With_ComplexTuple.s_data)); // JSON that doesn't bind to ctor args are matched with properties or ignored (as appropriate). tasks[3] = Task.Run(async () => await RunTestAsync(Person_Class.s_data)); @@ -62,9 +59,6 @@ async Task RunTestAsync(byte[] testData) } [Fact] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task ReadSimpleObjectWithTrailingTriviaAsync() { async Task RunTestAsync(string testData) @@ -89,7 +83,7 @@ async Task RunTestAsync(string testData) // Simple models can be deserialized. tasks[0] = Task.Run(async () => await RunTestAsync(Parameterized_IndexViewModel_Immutable.s_json)); // Complex models can be deserialized. - tasks[1] = Task.Run(async () => await RunTestAsync(ClassWithConstructor_SimpleAndComplexParameters.s_json)); + tasks[1] = Task.Run(async () => await RunTestAsync(ObjWCtorMixedParams.s_json)); tasks[2] = Task.Run(async () => await RunTestAsync(Parameterized_Class_With_ComplexTuple.s_json)); // JSON that doesn't bind to ctor args are matched with properties or ignored (as appropriate). tasks[3] = Task.Run(async () => await RunTestAsync(Person_Class.s_json)); @@ -157,9 +151,6 @@ async Task RunTestAsync() } [Fact] -#if BUILDING_SOURCE_GENERATOR_TESTS - [ActiveIssue("Needs JsonExtensionData support.")] -#endif public async Task ExerciseStreamCodePaths() { static string GetPropertyName(int index) => diff --git a/src/libraries/System.Text.Json/tests/Common/ExtensionDataTests.cs b/src/libraries/System.Text.Json/tests/Common/ExtensionDataTests.cs new file mode 100644 index 00000000000000..efa6bfb7e121ff --- /dev/null +++ b/src/libraries/System.Text.Json/tests/Common/ExtensionDataTests.cs @@ -0,0 +1,1466 @@ +// 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.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; +using System.Text.Encodings.Web; +using System.Text.Json.Nodes; +using System.Threading.Tasks; +using Xunit; + +namespace System.Text.Json.Serialization.Tests +{ + public abstract class ExtensionDataTests : SerializerTests + { + public ExtensionDataTests(JsonSerializerWrapperForString serializerWrapper) : base(serializerWrapper, null) { } + + [Fact] + public async Task EmptyPropertyName_WinsOver_ExtensionDataEmptyPropertyName() + { + string json = @"{"""":1}"; + + ClassWithEmptyPropertyNameAndExtensionProperty obj; + + // Create a new options instances to re-set any caches. + JsonSerializerOptions options = new JsonSerializerOptions(); + + // Verify the real property wins over the extension data property. + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + Assert.Equal(1, obj.MyInt1); + Assert.Null(obj.MyOverflow); + } + + [Fact] + public async Task EmptyPropertyNameInExtensionData() + { + { + string json = @"{"""":42}"; + EmptyClassWithExtensionProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(42, obj.MyOverflow[""].GetInt32()); + } + + { + // Verify that last-in wins. + string json = @"{"""":42, """":43}"; + EmptyClassWithExtensionProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(43, obj.MyOverflow[""].GetInt32()); + } + } + + [Fact] +#if BUILDING_SOURCE_GENERATOR_TESTS + [ActiveIssue("Needs SimpleTestClass support.")] +#endif + public async Task ExtensionPropertyNotUsed() + { + string json = @"{""MyNestedClass"":" + SimpleTestClass.s_json + "}"; + ClassWithExtensionProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Null(obj.MyOverflow); + } + + [Fact] + public async Task ExtensionPropertyRoundTrip() + { + ClassWithExtensionProperty obj; + + { + string json = @"{""MyIntMissing"":2, ""MyInt"":1, ""MyNestedClassMissing"":" + SimpleTestClass.s_json + "}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Verify(); + } + + // Round-trip the json. + { + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Verify(); + + // The json should not contain the dictionary name. + Assert.DoesNotContain(nameof(ClassWithExtensionProperty.MyOverflow), json); + } + + void Verify() + { + Assert.NotNull(obj.MyOverflow); + Assert.Equal(1, obj.MyInt); + Assert.Equal(2, obj.MyOverflow["MyIntMissing"].GetInt32()); + + JsonProperty[] properties = obj.MyOverflow["MyNestedClassMissing"].EnumerateObject().ToArray(); + + // Verify a couple properties + Assert.Equal(1, properties.Where(prop => prop.Name == "MyInt16").First().Value.GetInt32()); + Assert.True(properties.Where(prop => prop.Name == "MyBooleanTrue").First().Value.GetBoolean()); + } + } + + [Fact] +#if BUILDING_SOURCE_GENERATOR_TESTS + [ActiveIssue("Needs SimpleTestClass support.")] +#endif + public async Task ExtensionFieldNotUsed() + { + string json = @"{""MyNestedClass"":" + SimpleTestClass.s_json + "}"; + ClassWithExtensionField obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Null(obj.MyOverflow); + } + + [Fact] + public async Task ExtensionFieldRoundTrip() + { + ClassWithExtensionField obj; + + { + string json = @"{""MyIntMissing"":2, ""MyInt"":1, ""MyNestedClassMissing"":" + SimpleTestClass.s_json + "}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Verify(); + } + + // Round-trip the json. + { + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Verify(); + + // The json should not contain the dictionary name. + Assert.DoesNotContain(nameof(ClassWithExtensionField.MyOverflow), json); + } + + void Verify() + { + Assert.NotNull(obj.MyOverflow); + Assert.Equal(1, obj.MyInt); + Assert.Equal(2, obj.MyOverflow["MyIntMissing"].GetInt32()); + + JsonProperty[] properties = obj.MyOverflow["MyNestedClassMissing"].EnumerateObject().ToArray(); + + // Verify a couple properties + Assert.Equal(1, properties.Where(prop => prop.Name == "MyInt16").First().Value.GetInt32()); + Assert.True(properties.Where(prop => prop.Name == "MyBooleanTrue").First().Value.GetBoolean()); + } + } + + [Fact] + public async Task ExtensionPropertyIgnoredWhenWritingDefault() + { + string expected = @"{}"; + string actual = await JsonSerializerWrapperForString.SerializeWrapper(new ClassWithExtensionPropertyAsObject()); + Assert.Equal(expected, actual); + } + + [Fact] + public async Task MultipleExtensionPropertyIgnoredWhenWritingDefault() + { + var obj = new ClassWithMultipleDictionaries(); + string actual = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal("{\"ActualDictionary\":null}", actual); + + obj = new ClassWithMultipleDictionaries + { + ActualDictionary = new Dictionary() + }; + actual = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal("{\"ActualDictionary\":{}}", actual); + + obj = new ClassWithMultipleDictionaries + { + MyOverflow = new Dictionary + { + { "test", "value" } + } + }; + actual = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal("{\"ActualDictionary\":null,\"test\":\"value\"}", actual); + + obj = new ClassWithMultipleDictionaries + { + ActualDictionary = new Dictionary(), + MyOverflow = new Dictionary + { + { "test", "value" } + } + }; + actual = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal("{\"ActualDictionary\":{},\"test\":\"value\"}", actual); + } + + [Fact] + public async Task ExtensionPropertyInvalidJsonFail() + { + const string BadJson = @"{""Good"":""OK"",""Bad"":!}"; + + JsonException jsonException = await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(BadJson)); + Assert.Contains("Path: $.Bad | LineNumber: 0 | BytePositionInLine: 19.", jsonException.ToString()); + Assert.NotNull(jsonException.InnerException); + Assert.IsAssignableFrom(jsonException.InnerException); + Assert.Contains("!", jsonException.InnerException.ToString()); + } + + [Fact] + public async Task ExtensionPropertyAlreadyInstantiated() + { + Assert.NotNull(new ClassWithExtensionPropertyAlreadyInstantiated().MyOverflow); + + string json = @"{""MyIntMissing"":2}"; + + ClassWithExtensionProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(2, obj.MyOverflow["MyIntMissing"].GetInt32()); + } + + [Fact] + public async Task ExtensionPropertyAsObject() + { + string json = @"{""MyIntMissing"":2}"; + + ClassWithExtensionPropertyAsObject obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.IsType(obj.MyOverflow["MyIntMissing"]); + Assert.Equal(2, ((JsonElement)obj.MyOverflow["MyIntMissing"]).GetInt32()); + } + + [Fact] + public async Task ExtensionPropertyCamelCasing() + { + // Currently we apply no naming policy. If we do (such as a ExtensionPropertyNamingPolicy), we'd also have to add functionality to the JsonDocument. + + ClassWithExtensionProperty obj; + const string jsonWithProperty = @"{""MyIntMissing"":1}"; + const string jsonWithPropertyCamelCased = @"{""myIntMissing"":1}"; + + { + // Baseline Pascal-cased json + no casing option. + obj = await JsonSerializerWrapperForString.DeserializeWrapper(jsonWithProperty); + Assert.Equal(1, obj.MyOverflow["MyIntMissing"].GetInt32()); + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Contains(@"""MyIntMissing"":1", json); + } + + { + // Pascal-cased json + camel casing option. + JsonSerializerOptions options = new JsonSerializerOptions(); + options.DictionaryKeyPolicy = JsonNamingPolicy.CamelCase; + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + + obj = await JsonSerializerWrapperForString.DeserializeWrapper(jsonWithProperty, options); + Assert.Equal(1, obj.MyOverflow["MyIntMissing"].GetInt32()); + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Contains(@"""MyIntMissing"":1", json); + } + + { + // Baseline camel-cased json + no casing option. + obj = await JsonSerializerWrapperForString.DeserializeWrapper(jsonWithPropertyCamelCased); + Assert.Equal(1, obj.MyOverflow["myIntMissing"].GetInt32()); + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Contains(@"""myIntMissing"":1", json); + } + + { + // Baseline camel-cased json + camel casing option. + JsonSerializerOptions options = new JsonSerializerOptions(); + options.DictionaryKeyPolicy = JsonNamingPolicy.CamelCase; + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + + obj = await JsonSerializerWrapperForString.DeserializeWrapper(jsonWithPropertyCamelCased, options); + Assert.Equal(1, obj.MyOverflow["myIntMissing"].GetInt32()); + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Contains(@"""myIntMissing"":1", json); + } + } + + [Fact] + public async Task NullValuesIgnored() + { + const string json = @"{""MyNestedClass"":null}"; + const string jsonMissing = @"{""MyNestedClassMissing"":null}"; + + { + // Baseline with no missing. + ClassWithExtensionProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Null(obj.MyOverflow); + + string outJson = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Contains(@"""MyNestedClass"":null", outJson); + } + + { + // Baseline with missing. + ClassWithExtensionProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper(jsonMissing); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(JsonValueKind.Null, obj.MyOverflow["MyNestedClassMissing"].ValueKind); + } + + { + JsonSerializerOptions options = new JsonSerializerOptions(); + options.IgnoreNullValues = true; + + ClassWithExtensionProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper(jsonMissing, options); + + // Currently we do not ignore nulls in the extension data. The JsonDocument would also need to support this mode + // for any lower-level nulls. + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(JsonValueKind.Null, obj.MyOverflow["MyNestedClassMissing"].ValueKind); + } + } + + public class ClassWithInvalidExtensionProperty + { + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + } + + public class ClassWithTwoExtensionProperties + { + [JsonExtensionData] + public Dictionary MyOverflow1 { get; set; } + + [JsonExtensionData] + public Dictionary MyOverflow2 { get; set; } + } + + [Fact] +#if BUILDING_SOURCE_GENERATOR_TESTS + [ActiveIssue("https://github.com/dotnet/runtime/issues/58945")] +#endif + public async Task InvalidExtensionPropertyFail() + { + // Baseline + await JsonSerializerWrapperForString.DeserializeWrapper(@"{}"); + await JsonSerializerWrapperForString.DeserializeWrapper(@"{}"); + + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(@"{}")); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(@"{}")); + } + + public class ClassWithIgnoredData + { + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + + [JsonIgnore] + public int MyInt { get; set; } + } + + [Fact] + public async Task IgnoredDataShouldNotBeExtensionData() + { + ClassWithIgnoredData obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""MyInt"":1}"); + + Assert.Equal(0, obj.MyInt); + Assert.Null(obj.MyOverflow); + } + + public class ClassWithExtensionData + { + [JsonExtensionData] + public T Overflow { get; set; } + } + + public class CustomOverflowDictionary : Dictionary + { + } + + public class DictionaryOverflowConverter : JsonConverter> + { + public override Dictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + + public override void Write(Utf8JsonWriter writer, Dictionary value, JsonSerializerOptions options) + { + writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); + } + } + + public class JsonElementOverflowConverter : JsonConverter> + { + public override Dictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + + public override void Write(Utf8JsonWriter writer, Dictionary value, JsonSerializerOptions options) + { + writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); + } + } + + public class JsonObjectOverflowConverter : JsonConverter + { + public override JsonObject Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + + public override void Write(Utf8JsonWriter writer, JsonObject value, JsonSerializerOptions options) + { + writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); + } + } + + public class CustomObjectDictionaryOverflowConverter : JsonConverter> + { + public override CustomOverflowDictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + + public override void Write(Utf8JsonWriter writer, CustomOverflowDictionary value, JsonSerializerOptions options) + { + writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); + } + } + + public class CustomJsonElementDictionaryOverflowConverter : JsonConverter> + { + public override CustomOverflowDictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + + public override void Write(Utf8JsonWriter writer, CustomOverflowDictionary value, JsonSerializerOptions options) + { + writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); + } + } + + [Theory] + [InlineData(typeof(Dictionary), typeof(DictionaryOverflowConverter))] + [InlineData(typeof(Dictionary), typeof(JsonElementOverflowConverter))] + [InlineData(typeof(CustomOverflowDictionary), typeof(CustomObjectDictionaryOverflowConverter))] + [InlineData(typeof(CustomOverflowDictionary), typeof(CustomJsonElementDictionaryOverflowConverter))] + public void ExtensionProperty_SupportsWritingToCustomSerializerWithOptions(Type overflowType, Type converterType) + { + typeof(ExtensionDataTests) + .GetMethod(nameof(ExtensionProperty_SupportsWritingToCustomSerializerWithOptionsInternal), BindingFlags.Static | BindingFlags.NonPublic) + .MakeGenericMethod(overflowType, converterType) + .Invoke(null, null); + } + + private static void ExtensionProperty_SupportsWritingToCustomSerializerWithOptionsInternal() + where TDictionary : new() + where TConverter : JsonConverter, new() + { + var root = new ClassWithExtensionData() + { + Overflow = new TDictionary() + }; + + var options = new JsonSerializerOptions(); + options.Converters.Add(new TConverter()); + + string json = JsonSerializer.Serialize(root, options); + Assert.Equal(@"{""MyCustomOverflowWrite"":""OverflowValueWrite""}", json); + } + + private interface IClassWithOverflow + { + public T Overflow { get; set; } + } + + public class ClassWithExtensionDataWithAttributedConverter : IClassWithOverflow> + { + [JsonExtensionData] + [JsonConverter(typeof(DictionaryOverflowConverter))] + public Dictionary Overflow { get; set; } + } + + public class ClassWithJsonElementExtensionDataWithAttributedConverter : IClassWithOverflow> + { + [JsonExtensionData] + [JsonConverter(typeof(JsonElementOverflowConverter))] + public Dictionary Overflow { get; set; } + } + + public class ClassWithCustomElementExtensionDataWithAttributedConverter : IClassWithOverflow> + { + [JsonExtensionData] + [JsonConverter(typeof(CustomObjectDictionaryOverflowConverter))] + public CustomOverflowDictionary Overflow { get; set; } + } + + public class ClassWithCustomJsonElementExtensionDataWithAttributedConverter : IClassWithOverflow> + { + [JsonExtensionData] + [JsonConverter(typeof(CustomJsonElementDictionaryOverflowConverter))] + public CustomOverflowDictionary Overflow { get; set; } + } + + [Theory] + [InlineData(typeof(ClassWithExtensionDataWithAttributedConverter), typeof(Dictionary))] + [InlineData(typeof(ClassWithJsonElementExtensionDataWithAttributedConverter), typeof(Dictionary))] + [InlineData(typeof(ClassWithCustomElementExtensionDataWithAttributedConverter), typeof(CustomOverflowDictionary))] + [InlineData(typeof(ClassWithCustomJsonElementExtensionDataWithAttributedConverter), typeof(CustomOverflowDictionary))] + public void ExtensionProperty_SupportsWritingToCustomSerializerWithExplicitConverter(Type attributedType, Type dictionaryType) + { + typeof(ExtensionDataTests) + .GetMethod(nameof(ExtensionProperty_SupportsWritingToCustomSerializerWithExplicitConverterInternal), BindingFlags.Static | BindingFlags.NonPublic) + .MakeGenericMethod(attributedType, dictionaryType) + .Invoke(null, null); + } + + private static void ExtensionProperty_SupportsWritingToCustomSerializerWithExplicitConverterInternal() + where TRoot : IClassWithOverflow, new() + where TDictionary : new() + { + var root = new TRoot() + { + Overflow = new TDictionary() + }; + + string json = JsonSerializer.Serialize(root); + Assert.Equal(@"{""MyCustomOverflowWrite"":""OverflowValueWrite""}", json); + } + + [Theory] + [InlineData(typeof(Dictionary), typeof(DictionaryOverflowConverter), typeof(object))] + [InlineData(typeof(Dictionary), typeof(JsonElementOverflowConverter), typeof(JsonElement))] + [InlineData(typeof(CustomOverflowDictionary), typeof(CustomObjectDictionaryOverflowConverter), typeof(object))] + [InlineData(typeof(CustomOverflowDictionary), typeof(CustomJsonElementDictionaryOverflowConverter), typeof(JsonElement))] + public void ExtensionProperty_IgnoresCustomSerializerWithOptions(Type overflowType, Type converterType, Type elementType) + { + typeof(ExtensionDataTests) + .GetMethod(nameof(ExtensionProperty_IgnoresCustomSerializerWithOptionsInternal), BindingFlags.Static | BindingFlags.NonPublic) + .MakeGenericMethod(overflowType, elementType, converterType) + .Invoke(null, null); + } + + [Fact] + public async Task ExtensionProperty_IgnoresCustomSerializerWithOptions_JsonObject() + { + var options = new JsonSerializerOptions(); + options.Converters.Add(new JsonObjectOverflowConverter()); + + // A custom converter for JsonObject is not allowed on an extension property. + InvalidOperationException ex = await Assert.ThrowsAsync(async () => + await JsonSerializerWrapperForString.DeserializeWrapper>(@"{""TestKey"":""TestValue""}", options)); + + Assert.Contains("JsonObject", ex.ToString()); + } + + private static void ExtensionProperty_IgnoresCustomSerializerWithOptionsInternal() + where TConverter : JsonConverter, new() + where TDictionary : IDictionary + { + var options = new JsonSerializerOptions(); + options.Converters.Add(new TConverter()); + + ClassWithExtensionData obj + = JsonSerializer.Deserialize>(@"{""TestKey"":""TestValue""}", options); + + Assert.Equal("TestValue", ((JsonElement)(object)obj.Overflow["TestKey"]).GetString()); + } + + [Theory] + [InlineData(typeof(ClassWithExtensionDataWithAttributedConverter), typeof(Dictionary), typeof(object))] + [InlineData(typeof(ClassWithJsonElementExtensionDataWithAttributedConverter), typeof(Dictionary), typeof(JsonElement))] + [InlineData(typeof(ClassWithCustomElementExtensionDataWithAttributedConverter), typeof(CustomOverflowDictionary), typeof(object))] + [InlineData(typeof(ClassWithCustomJsonElementExtensionDataWithAttributedConverter), typeof(CustomOverflowDictionary), typeof(JsonElement))] + public void ExtensionProperty_IgnoresCustomSerializerWithExplicitConverter(Type attributedType, Type dictionaryType, Type elementType) + { + typeof(ExtensionDataTests) + .GetMethod(nameof(ExtensionProperty_IgnoresCustomSerializerWithExplicitConverterInternal), BindingFlags.Static | BindingFlags.NonPublic) + .MakeGenericMethod(attributedType, dictionaryType, elementType) + .Invoke(null, null); + } + + [Fact] + public async Task ExtensionProperty_IgnoresCustomSerializerWithExplicitConverter_JsonObject() + { + ClassWithExtensionData obj + = await JsonSerializerWrapperForString.DeserializeWrapper>(@"{""TestKey"":""TestValue""}"); + + Assert.Equal("TestValue", obj.Overflow["TestKey"].GetValue()); + } + + private static void ExtensionProperty_IgnoresCustomSerializerWithExplicitConverterInternal() + where TRoot : IClassWithOverflow, new() + where TDictionary : IDictionary + { + ClassWithExtensionData obj + = JsonSerializer.Deserialize>(@"{""TestKey"":""TestValue""}"); + + Assert.Equal("TestValue", ((JsonElement)(object)obj.Overflow["TestKey"]).GetString()); + } + + [Fact] + public async Task ExtensionPropertyObjectValue_Empty() + { + ClassWithExtensionPropertyAlreadyInstantiated obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{}"); + Assert.Equal(@"{}", await JsonSerializerWrapperForString.SerializeWrapper(obj)); + } + + [Fact] + public async Task ExtensionPropertyObjectValue_SameAsExtensionPropertyName() + { + const string json = @"{""MyOverflow"":{""Key1"":""V""}}"; + + // Deserializing directly into the overflow is not supported by design. + ClassWithExtensionPropertyAsObject obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + + // The JSON is treated as normal overflow. + Assert.NotNull(obj.MyOverflow["MyOverflow"]); + Assert.Equal(json, await JsonSerializerWrapperForString.SerializeWrapper(obj)); + } + + public class ClassWithExtensionPropertyAsObjectAndNameProperty + { + public string Name { get; set; } + + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + } + + public static IEnumerable JsonSerializerOptions() + { + yield return new object[] { null }; + yield return new object[] { new JsonSerializerOptions() }; + yield return new object[] { new JsonSerializerOptions { UnknownTypeHandling = JsonUnknownTypeHandling.JsonElement } }; + yield return new object[] { new JsonSerializerOptions { UnknownTypeHandling = JsonUnknownTypeHandling.JsonNode } }; + } + + [Theory] + [MemberData(nameof(JsonSerializerOptions))] + public async Task ExtensionPropertyDuplicateNames(JsonSerializerOptions options) + { + var obj = new ClassWithExtensionPropertyAsObjectAndNameProperty(); + obj.Name = "Name1"; + + obj.MyOverflow = new Dictionary(); + obj.MyOverflow["Name"] = "Name2"; + + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Equal(@"{""Name"":""Name1"",""Name"":""Name2""}", json); + + // The overflow value comes last in the JSON so it overwrites the original value. + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + Assert.Equal("Name2", obj.Name); + + // Since there was no overflow, this should be null. + Assert.Null(obj.MyOverflow); + } + + [Theory] + [MemberData(nameof(JsonSerializerOptions))] + public async Task Null_SystemObject(JsonSerializerOptions options) + { + const string json = @"{""MissingProperty"":null}"; + + { + ClassWithExtensionPropertyAsObject obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + + // A null value maps to , so the value is null. + object elem = obj.MyOverflow["MissingProperty"]; + Assert.Null(elem); + } + + { + ClassWithExtensionPropertyAsJsonObject obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + + JsonObject jObject = obj.MyOverflow; + JsonNode jNode = jObject["MissingProperty"]; + // Since JsonNode is a reference type the value is null. + Assert.Null(jNode); + } + } + + [Fact] + public async Task Null_JsonElement() + { + const string json = @"{""MissingProperty"":null}"; + + ClassWithExtensionPropertyAsJsonElement obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + object elem = obj.MyOverflow["MissingProperty"]; + // Since JsonElement is a struct, it treats null as JsonValueKind.Null. + Assert.IsType(elem); + Assert.Equal(JsonValueKind.Null, ((JsonElement)elem).ValueKind); + } + + [Fact] + public async Task Null_JsonObject() + { + const string json = @"{""MissingProperty"":null}"; + + ClassWithExtensionPropertyAsJsonObject obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + object elem = obj.MyOverflow["MissingProperty"]; + // Since JsonNode is a reference type the value is null. + Assert.Null(elem); + } + + [Fact] + public async Task ExtensionPropertyObjectValue() + { + // Baseline + ClassWithExtensionPropertyAlreadyInstantiated obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{}"); + obj.MyOverflow.Add("test", new object()); + obj.MyOverflow.Add("test1", 1); + + Assert.Equal(@"{""test"":{},""test1"":1}", await JsonSerializerWrapperForString.SerializeWrapper(obj)); + } + + public class DummyObj + { + public string Prop { get; set; } + } + + public struct DummyStruct + { + public string Prop { get; set; } + } + + [Theory] + [MemberData(nameof(JsonSerializerOptions))] + public async Task ExtensionPropertyObjectValue_RoundTrip(JsonSerializerOptions options) + { + // Baseline + ClassWithExtensionPropertyAlreadyInstantiated obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{}", options); + obj.MyOverflow.Add("test", new object()); + obj.MyOverflow.Add("test1", 1); + obj.MyOverflow.Add("test2", "text"); + obj.MyOverflow.Add("test3", new DummyObj() { Prop = "ObjectProp" }); + obj.MyOverflow.Add("test4", new DummyStruct() { Prop = "StructProp" }); + obj.MyOverflow.Add("test5", new Dictionary() { { "Key", "Value" }, { "Key1", "Value1" }, }); + + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + ClassWithExtensionPropertyAlreadyInstantiated roundTripObj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + + Assert.Equal(6, roundTripObj.MyOverflow.Count); + + if (options?.UnknownTypeHandling == JsonUnknownTypeHandling.JsonNode) + { + Assert.IsAssignableFrom(roundTripObj.MyOverflow["test"]); + Assert.IsAssignableFrom(roundTripObj.MyOverflow["test1"]); + Assert.IsAssignableFrom(roundTripObj.MyOverflow["test2"]); + Assert.IsAssignableFrom(roundTripObj.MyOverflow["test3"]); + + Assert.IsType(roundTripObj.MyOverflow["test"]); + + Assert.IsAssignableFrom(roundTripObj.MyOverflow["test1"]); + Assert.Equal(1, ((JsonValue)roundTripObj.MyOverflow["test1"]).GetValue()); + Assert.Equal(1, ((JsonValue)roundTripObj.MyOverflow["test1"]).GetValue()); + + Assert.IsAssignableFrom(roundTripObj.MyOverflow["test2"]); + Assert.Equal("text", ((JsonValue)roundTripObj.MyOverflow["test2"]).GetValue()); + + Assert.IsType(roundTripObj.MyOverflow["test3"]); + Assert.Equal("ObjectProp", ((JsonObject)roundTripObj.MyOverflow["test3"])["Prop"].GetValue()); + + Assert.IsType(roundTripObj.MyOverflow["test4"]); + Assert.Equal("StructProp", ((JsonObject)roundTripObj.MyOverflow["test4"])["Prop"].GetValue()); + + Assert.IsType(roundTripObj.MyOverflow["test5"]); + Assert.Equal("Value", ((JsonObject)roundTripObj.MyOverflow["test5"])["Key"].GetValue()); + Assert.Equal("Value1", ((JsonObject)roundTripObj.MyOverflow["test5"])["Key1"].GetValue()); + } + else + { + Assert.IsType(roundTripObj.MyOverflow["test"]); + Assert.IsType(roundTripObj.MyOverflow["test1"]); + Assert.IsType(roundTripObj.MyOverflow["test2"]); + Assert.IsType(roundTripObj.MyOverflow["test3"]); + + Assert.Equal(JsonValueKind.Object, ((JsonElement)roundTripObj.MyOverflow["test"]).ValueKind); + + Assert.Equal(JsonValueKind.Number, ((JsonElement)roundTripObj.MyOverflow["test1"]).ValueKind); + Assert.Equal(1, ((JsonElement)roundTripObj.MyOverflow["test1"]).GetInt32()); + Assert.Equal(1, ((JsonElement)roundTripObj.MyOverflow["test1"]).GetInt64()); + + Assert.Equal(JsonValueKind.String, ((JsonElement)roundTripObj.MyOverflow["test2"]).ValueKind); + Assert.Equal("text", ((JsonElement)roundTripObj.MyOverflow["test2"]).GetString()); + + Assert.Equal(JsonValueKind.Object, ((JsonElement)roundTripObj.MyOverflow["test3"]).ValueKind); + Assert.Equal("ObjectProp", ((JsonElement)roundTripObj.MyOverflow["test3"]).GetProperty("Prop").GetString()); + + Assert.Equal(JsonValueKind.Object, ((JsonElement)roundTripObj.MyOverflow["test4"]).ValueKind); + Assert.Equal("StructProp", ((JsonElement)roundTripObj.MyOverflow["test4"]).GetProperty("Prop").GetString()); + + Assert.Equal(JsonValueKind.Object, ((JsonElement)roundTripObj.MyOverflow["test5"]).ValueKind); + Assert.Equal("Value", ((JsonElement)roundTripObj.MyOverflow["test5"]).GetProperty("Key").GetString()); + Assert.Equal("Value1", ((JsonElement)roundTripObj.MyOverflow["test5"]).GetProperty("Key1").GetString()); + } + } + + [Fact] + public async Task DeserializeIntoJsonObjectProperty() + { + string json = @"{""MyDict"":{""Property1"":1}}"; + ClassWithExtensionPropertyAsJsonObject obj = + await JsonSerializerWrapperForString.DeserializeWrapper(json); + + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(1, obj.MyOverflow["MyDict"]["Property1"].GetValue()); + } + + [Fact] +#if BUILDING_SOURCE_GENERATOR_TESTS + [ActiveIssue("https://github.com/dotnet/runtime/issues/58945")] +#endif + + public async Task DeserializeIntoSystemObjectProperty() + { + string json = @"{""MyDict"":{""Property1"":1}}"; + + await Assert.ThrowsAsync(async () => + await JsonSerializerWrapperForString.DeserializeWrapper(json)); + + // Cannot deserialize into System.Object overflow even if UnknownTypeHandling is set to use JsonNode. + var options = new JsonSerializerOptions { UnknownTypeHandling = JsonUnknownTypeHandling.JsonNode }; + await Assert.ThrowsAsync(async () => + await JsonSerializerWrapperForString.DeserializeWrapper(json)); + } + + public class ClassWithReference + { + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + + public ClassWithExtensionProperty MyReference { get; set; } + } + + [Theory] + [InlineData(@"{""MyIntMissing"":2,""MyReference"":{""MyIntMissingChild"":3}}")] + [InlineData(@"{""MyReference"":{""MyIntMissingChild"":3},""MyIntMissing"":2}")] + [InlineData(@"{""MyReference"":{""MyNestedClass"":null,""MyInt"":0,""MyIntMissingChild"":3},""MyIntMissing"":2}")] + public async Task NestedClass(string json) + { + ClassWithReference obj; + + void Verify() + { + Assert.IsType(obj.MyOverflow["MyIntMissing"]); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(2, obj.MyOverflow["MyIntMissing"].GetInt32()); + + ClassWithExtensionProperty child = obj.MyReference; + + Assert.IsType(child.MyOverflow["MyIntMissingChild"]); + Assert.IsType(child.MyOverflow["MyIntMissingChild"]); + Assert.Equal(1, child.MyOverflow.Count); + Assert.Equal(3, child.MyOverflow["MyIntMissingChild"].GetInt32()); + Assert.Null(child.MyNestedClass); + Assert.Equal(0, child.MyInt); + } + + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Verify(); + + // Round-trip the json and verify. + json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Verify(); + } + + public class ParentClassWithObject + { + public string Text { get; set; } + public ChildClassWithObject Child { get; set; } + + [JsonExtensionData] + public Dictionary ExtensionData { get; set; } = new Dictionary(); + } + + public class ChildClassWithObject + { + public int Number { get; set; } + + [JsonExtensionData] + public Dictionary ExtensionData { get; set; } = new Dictionary(); + } + + [Fact] + public async Task NestedClassWithObjectExtensionDataProperty() + { + var child = new ChildClassWithObject { Number = 2 }; + child.ExtensionData.Add("SpecialInformation", "I am child class"); + + var parent = new ParentClassWithObject { Text = "Hello World" }; + parent.ExtensionData.Add("SpecialInformation", "I am parent class"); + parent.Child = child; + + // The extension data is based on the raw strings added above and not JsonElement. + Assert.Equal("Hello World", parent.Text); + Assert.IsType(parent.ExtensionData["SpecialInformation"]); + Assert.Equal("I am parent class", (string)parent.ExtensionData["SpecialInformation"]); + Assert.Equal(2, parent.Child.Number); + Assert.IsType(parent.Child.ExtensionData["SpecialInformation"]); + Assert.Equal("I am child class", (string)parent.Child.ExtensionData["SpecialInformation"]); + + // Round-trip and verify. Extension data is now based on JsonElement. + string json = await JsonSerializerWrapperForString.SerializeWrapper(parent); + parent = await JsonSerializerWrapperForString.DeserializeWrapper(json); + + Assert.Equal("Hello World", parent.Text); + Assert.IsType(parent.ExtensionData["SpecialInformation"]); + Assert.Equal("I am parent class", ((JsonElement)parent.ExtensionData["SpecialInformation"]).GetString()); + Assert.Equal(2, parent.Child.Number); + Assert.IsType(parent.Child.ExtensionData["SpecialInformation"]); + Assert.Equal("I am child class", ((JsonElement)parent.Child.ExtensionData["SpecialInformation"]).GetString()); + } + + public class ParentClassWithJsonElement + { + public string Text { get; set; } + + public List Children { get; set; } = new List(); + + [JsonExtensionData] + // Use SortedDictionary as verification of supporting derived dictionaries. + public SortedDictionary ExtensionData { get; set; } = new SortedDictionary(); + } + + public class ChildClassWithJsonElement + { + public int Number { get; set; } + + [JsonExtensionData] + public Dictionary ExtensionData { get; set; } = new Dictionary(); + } + + [Fact] + public async Task NestedClassWithJsonElementExtensionDataProperty() + { + var child = new ChildClassWithJsonElement { Number = 4 }; + child.ExtensionData.Add("SpecialInformation", JsonDocument.Parse(await JsonSerializerWrapperForString.SerializeWrapper("I am child class")).RootElement); + + var parent = new ParentClassWithJsonElement { Text = "Hello World" }; + parent.ExtensionData.Add("SpecialInformation", JsonDocument.Parse(await JsonSerializerWrapperForString.SerializeWrapper("I am parent class")).RootElement); + parent.Children.Add(child); + + Verify(); + + // Round-trip and verify. + string json = await JsonSerializerWrapperForString.SerializeWrapper(parent); + parent = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Verify(); + + void Verify() + { + Assert.Equal("Hello World", parent.Text); + Assert.Equal("I am parent class", parent.ExtensionData["SpecialInformation"].GetString()); + Assert.Equal(1, parent.Children.Count); + Assert.Equal(4, parent.Children[0].Number); + Assert.Equal("I am child class", parent.Children[0].ExtensionData["SpecialInformation"].GetString()); + } + } + + [Fact] + public async Task DeserializeIntoObjectProperty() + { + ClassWithExtensionPropertyAsObject obj; + string json; + + // Baseline dictionary. + json = @"{""MyDict"":{""Property1"":1}}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(1, ((JsonElement)obj.MyOverflow["MyDict"]).EnumerateObject().First().Value.GetInt32()); + + // Attempt to deserialize directly into the overflow property; this is just added as a normal missing property like MyDict above. + json = @"{""MyOverflow"":{""Property1"":1}}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(1, ((JsonElement)obj.MyOverflow["MyOverflow"]).EnumerateObject().First().Value.GetInt32()); + + // Attempt to deserialize null into the overflow property. This is also treated as a missing property. + json = @"{""MyOverflow"":null}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Null(obj.MyOverflow["MyOverflow"]); + + // Attempt to deserialize object into the overflow property. This is also treated as a missing property. + json = @"{""MyOverflow"":{}}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(JsonValueKind.Object, ((JsonElement)obj.MyOverflow["MyOverflow"]).ValueKind); + } + + [Fact] + public async Task DeserializeIntoMultipleDictionaries() + { + ClassWithMultipleDictionaries obj; + string json; + + // Baseline dictionary. + json = @"{""ActualDictionary"":{""Key"": {""Property0"":-1}},""MyDict"":{""Property1"":1}}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(1, ((JsonElement)obj.MyOverflow["MyDict"]).EnumerateObject().First().Value.GetInt32()); + Assert.Equal(1, obj.ActualDictionary.Count); + Assert.Equal(-1, ((JsonElement)obj.ActualDictionary["Key"]).EnumerateObject().First().Value.GetInt32()); + + // Attempt to deserialize null into the dictionary and overflow property. This is also treated as a missing property. + json = @"{""ActualDictionary"":null,""MyOverflow"":null}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Null(obj.MyOverflow["MyOverflow"]); + Assert.Null(obj.ActualDictionary); + + // Attempt to deserialize object into the dictionary and overflow property. This is also treated as a missing property. + json = @"{""ActualDictionary"":{},""MyOverflow"":{}}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(JsonValueKind.Object, ((JsonElement)obj.MyOverflow["MyOverflow"]).ValueKind); + Assert.Equal(0, obj.ActualDictionary.Count); + } + + [Fact] + public async Task DeserializeIntoJsonElementProperty() + { + ClassWithExtensionPropertyAsJsonElement obj; + string json; + + // Baseline dictionary. + json = @"{""MyDict"":{""Property1"":1}}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(1, obj.MyOverflow["MyDict"].EnumerateObject().First().Value.GetInt32()); + + // Attempt to deserialize directly into the overflow property; this is just added as a normal missing property like MyDict above. + json = @"{""MyOverflow"":{""Property1"":1}}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(1, obj.MyOverflow["MyOverflow"].EnumerateObject().First().Value.GetInt32()); + + // Attempt to deserialize null into the overflow property. This is also treated as a missing property. + json = @"{""MyOverflow"":null}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(JsonValueKind.Null, obj.MyOverflow["MyOverflow"].ValueKind); + + // Attempt to deserialize object into the overflow property. This is also treated as a missing property. + json = @"{""MyOverflow"":{}}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(JsonValueKind.Object, obj.MyOverflow["MyOverflow"].ValueKind); + } + + [Fact] + public async Task SerializerOutputRoundtripsWhenEscaping() + { + string jsonString = "{\"\u6C49\u5B57\":\"abc\",\"Class\":{\"\u6F22\u5B57\":\"xyz\"},\"\u62DC\u6258\":{\"\u62DC\u6258\u62DC\u6258\":1}}"; + + ClassWithEscapedProperty input = await JsonSerializerWrapperForString.DeserializeWrapper(jsonString); + + Assert.Equal("abc", input.\u6C49\u5B57); + Assert.Equal("xyz", input.Class.\u6F22\u5B57); + + string normalizedString = await JsonSerializerWrapperForString.SerializeWrapper(input); + + Assert.Equal(normalizedString, await JsonSerializerWrapperForString.SerializeWrapper(await JsonSerializerWrapperForString.DeserializeWrapper(normalizedString))); + } + + public class ClassWithEscapedProperty + { + public string \u6C49\u5B57 { get; set; } + public NestedClassWithEscapedProperty Class { get; set; } + + [JsonExtensionData] + public Dictionary Overflow { get; set; } + } + + public class NestedClassWithEscapedProperty + { + public string \u6F22\u5B57 { get; set; } + } + + public class ClassWithInvalidExtensionPropertyStringString + { + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + } + + public class ClassWithInvalidExtensionPropertyObjectString + { + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + } + + public class ClassWithInvalidExtensionPropertyStringJsonNode + { + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + } + + [Fact] +#if BUILDING_SOURCE_GENERATOR_TESTS + [ActiveIssue("https://github.com/dotnet/runtime/issues/58945")] +#endif + public async Task ExtensionProperty_InvalidDictionary() + { + var obj1 = new ClassWithInvalidExtensionPropertyStringString(); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(obj1)); + + var obj2 = new ClassWithInvalidExtensionPropertyObjectString(); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(obj2)); + + var obj3 = new ClassWithInvalidExtensionPropertyStringJsonNode(); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(obj3)); + } + + public class ClassWithExtensionPropertyAlreadyInstantiated + { + public ClassWithExtensionPropertyAlreadyInstantiated() + { + MyOverflow = new Dictionary(); + } + + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyAsObject + { + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyAsJsonElement + { + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyAsJsonObject + { + [JsonExtensionData] + public JsonObject MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyAsSystemObject + { + [JsonExtensionData] + public object MyOverflow { get; set; } + } + + public class ClassWithMultipleDictionaries + { + [JsonExtensionData] + public Dictionary MyOverflow { get; set; } + + public Dictionary ActualDictionary { get; set; } + } + + [Fact] +#if BUILDING_SOURCE_GENERATOR_TESTS + [ActiveIssue("https://github.com/dotnet/runtime/issues/58945")] +#endif + public async Task DeserializeIntoImmutableDictionaryProperty() + { + // baseline + await JsonSerializerWrapperForString.DeserializeWrapper(@"{}"); + await JsonSerializerWrapperForString.DeserializeWrapper(@"{}"); + await JsonSerializerWrapperForString.DeserializeWrapper(@"{}"); + await JsonSerializerWrapperForString.DeserializeWrapper(@"{}"); + + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{\"hello\":\"world\"}")); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{\"hello\":\"world\"}")); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{\"hello\":\"world\"}")); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{\"hello\":\"world\"}")); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{\"hello\":\"world\"}")); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{\"hello\":\"world\"}")); + } + + [Fact] + public async Task SerializeIntoImmutableDictionaryProperty() + { + // attempt to serialize a null immutable dictionary + string expectedJson = "{}"; + var obj = new ClassWithExtensionPropertyAsImmutable(); + var json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal(expectedJson, json); + + // attempt to serialize an empty immutable dictionary + expectedJson = "{}"; + obj = new ClassWithExtensionPropertyAsImmutable(); + obj.MyOverflow = ImmutableDictionary.Empty; + json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal(expectedJson, json); + + // attempt to serialize a populated immutable dictionary + expectedJson = "{\"hello\":\"world\"}"; + obj = new ClassWithExtensionPropertyAsImmutable(); + var dictionaryStringObject = new Dictionary { { "hello", "world" } }; + obj.MyOverflow = ImmutableDictionary.CreateRange(dictionaryStringObject); + json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal(expectedJson, json); + } + + public class ClassWithExtensionPropertyAsImmutable + { + [JsonExtensionData] + public ImmutableDictionary MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyAsImmutableJsonElement + { + [JsonExtensionData] + public ImmutableDictionary MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyPrivateConstructor + { + [JsonExtensionData] + public GenericIDictionaryWrapperPrivateConstructor MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyPrivateConstructorJsonElement + { + [JsonExtensionData] + public GenericIDictionaryWrapperPrivateConstructor MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyCustomIImmutable + { + [JsonExtensionData] + public GenericIImmutableDictionaryWrapper MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyCustomIImmutableJsonElement + { + [JsonExtensionData] + public GenericIImmutableDictionaryWrapper MyOverflow { get; set; } + } + + [Theory] + [InlineData(typeof(ClassWithExtensionPropertyNoGenericParameters))] + [InlineData(typeof(ClassWithExtensionPropertyOneGenericParameter))] + [InlineData(typeof(ClassWithExtensionPropertyThreeGenericParameters))] + public async Task DeserializeIntoGenericDictionaryParameterCount(Type type) + { + object obj = await JsonSerializerWrapperForString.DeserializeWrapper("{\"hello\":\"world\"}", type); + + IDictionary extData = (IDictionary)type.GetProperty("MyOverflow").GetValue(obj)!; + Assert.Equal("world", ((JsonElement)extData["hello"]).GetString()); + } + + public class ClassWithExtensionPropertyNoGenericParameters + { + [JsonExtensionData] + public StringToObjectIDictionaryWrapper MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyOneGenericParameter + { + [JsonExtensionData] + public StringToGenericIDictionaryWrapper MyOverflow { get; set; } + } + + public class ClassWithExtensionPropertyThreeGenericParameters + { + [JsonExtensionData] + public GenericIDictonaryWrapperThreeGenericParameters MyOverflow { get; set; } + } + + [Fact] + public async Task CustomObjectConverterInExtensionProperty() + { + const string Json = "{\"hello\": \"world\"}"; + + var options = new JsonSerializerOptions(); + options.Converters.Add(new ObjectConverter()); + + ClassWithExtensionPropertyAsObject obj = await JsonSerializerWrapperForString.DeserializeWrapper(Json, options); + object overflowProp = obj.MyOverflow["hello"]; + Assert.IsType(overflowProp); + Assert.Equal("world!!!", ((string)overflowProp)); + + string newJson = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Equal("{\"hello\":\"world!!!\"}", newJson); + } + + public class ObjectConverter : JsonConverter + { + public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.GetString() + "!!!"; + } + + public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options) + { + // Since we are in a user-provided (not internal to S.T.Json) object converter, + // this converter will be called, not the internal string converter. + writer.WriteStringValue((string)value); + } + } + + [Fact] + public async Task CustomJsonElementConverterInExtensionProperty() + { + const string Json = "{\"hello\": \"world\"}"; + + var options = new JsonSerializerOptions(); + options.Converters.Add(new JsonElementConverter()); + + ClassWithExtensionPropertyAsJsonElement obj = await JsonSerializerWrapperForString.DeserializeWrapper(Json, options); + JsonElement overflowProp = obj.MyOverflow["hello"]; + Assert.Equal(JsonValueKind.Undefined, overflowProp.ValueKind); + + string newJson = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Equal("{\"hello\":{\"Hi\":\"There\"}}", newJson); + } + + public class JsonElementConverter : JsonConverter + { + public override JsonElement Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + // Just return an empty JsonElement. + reader.Skip(); + return new JsonElement(); + } + + public override void Write(Utf8JsonWriter writer, JsonElement value, JsonSerializerOptions options) + { + // Write a string we can test against easily. + writer.WriteStartObject(); + writer.WriteString("Hi", "There"); + writer.WriteEndObject(); + } + } + + [Fact] + public async Task CustomJsonObjectConverterInExtensionProperty() + { + const string Json = "{\"hello\": \"world\"}"; + + var options = new JsonSerializerOptions(); + options.Converters.Add(new JsonObjectConverter()); + + // A custom converter for JsonObject is not allowed on an extension property. + InvalidOperationException ex = await Assert.ThrowsAsync(async () => + await JsonSerializerWrapperForString.DeserializeWrapper(Json, options)); + + Assert.Contains("JsonObject", ex.ToString()); + } + + public class JsonObjectConverter : JsonConverter + { + public override JsonObject Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + // Just return an empty JsonElement. + reader.Skip(); + return new JsonObject(); + } + + public override void Write(Utf8JsonWriter writer, JsonObject value, JsonSerializerOptions options) + { + // Write a string we can test against easily. + writer.WriteStartObject(); + writer.WriteString("Hi", "There"); + writer.WriteEndObject(); + } + } + + [Fact] + public async Task EmptyPropertyAndExtensionData_PropertyFirst() + { + // Verify any caching treats real property (with empty name) differently than a missing property. + + ClassWithEmptyPropertyNameAndExtensionProperty obj; + + // Create a new options instances to re-set any caches. + JsonSerializerOptions options = new JsonSerializerOptions(); + + // First use an empty property. + string json = @"{"""":43}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + Assert.Equal(43, obj.MyInt1); + Assert.Null(obj.MyOverflow); + + // Then populate cache with a missing property name. + json = @"{""DoesNotExist"":42}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + Assert.Equal(0, obj.MyInt1); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(42, obj.MyOverflow["DoesNotExist"].GetInt32()); + } + + [Fact] + public async Task EmptyPropertyNameAndExtensionData_ExtDataFirst() + { + // Verify any caching treats real property (with empty name) differently than a missing property. + + ClassWithEmptyPropertyNameAndExtensionProperty obj; + + // Create a new options instances to re-set any caches. + JsonSerializerOptions options = new JsonSerializerOptions(); + + // First populate cache with a missing property name. + string json = @"{""DoesNotExist"":42}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + Assert.Equal(0, obj.MyInt1); + Assert.Equal(1, obj.MyOverflow.Count); + Assert.Equal(42, obj.MyOverflow["DoesNotExist"].GetInt32()); + + // Then use an empty property. + json = @"{"""":43}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + Assert.Equal(43, obj.MyInt1); + Assert.Null(obj.MyOverflow); + } + + [Fact] + public async Task ExtensionDataDictionarySerialize_DoesNotHonor() + { + var options = new JsonSerializerOptions + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase + }; + + EmptyClassWithExtensionProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""Key1"": 1}", options); + + // Ignore naming policy for extension data properties by default. + Assert.False(obj.MyOverflow.ContainsKey("key1")); + Assert.Equal(1, obj.MyOverflow["Key1"].GetInt32()); + } + + [Theory] + [InlineData(0x1, 'v')] + [InlineData(0x1, '\u0467')] + [InlineData(0x10, 'v')] + [InlineData(0x10, '\u0467')] + [InlineData(0x100, 'v')] + [InlineData(0x100, '\u0467')] + [InlineData(0x1000, 'v')] + [InlineData(0x1000, '\u0467')] + [InlineData(0x10000, 'v')] + [InlineData(0x10000, '\u0467')] + public async Task LongPropertyNames(int propertyLength, char ch) + { + // Although the CLR may limit member length to 1023 bytes, the serializer doesn't have a hard limit. + + string val = new string(ch, propertyLength); + string json = @"{""" + val + @""":1}"; + + EmptyClassWithExtensionProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + + Assert.True(obj.MyOverflow.ContainsKey(val)); + + var options = new JsonSerializerOptions + { + // Avoid escaping '\u0467'. + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping + }; + + string jsonRoundTripped = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Equal(json, jsonRoundTripped); + } + + public class EmptyClassWithExtensionProperty + { + [JsonExtensionData] + public IDictionary MyOverflow { get; set; } + } + + public class ClassWithEmptyPropertyNameAndExtensionProperty + { + [JsonPropertyName("")] + public int MyInt1 { get; set; } + + [JsonExtensionData] + public IDictionary MyOverflow { get; set; } + } + } +} diff --git a/src/libraries/System.Text.Json/tests/Common/JsonTestHelper.cs b/src/libraries/System.Text.Json/tests/Common/JsonTestHelper.cs index 528ac2903e4057..1f1c05c9a8aece 100644 --- a/src/libraries/System.Text.Json/tests/Common/JsonTestHelper.cs +++ b/src/libraries/System.Text.Json/tests/Common/JsonTestHelper.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Text.Json.Serialization.Tests; +using System.Text.Json.Serialization.Tests.Schemas.OrderPayload; using System.Text.RegularExpressions; using System.Threading.Tasks; using Xunit; @@ -84,5 +86,187 @@ public static async Task> ToListAsync(this IAsyncEnumerable source public static string StripWhitespace(this string value) => s_stripWhitespace.Replace(value, string.Empty); + + internal static List PopulateLargeObject(int size) + { + List orders = new List(size); + for (int i = 0; i < size; i++) + { + Order order = new Order + { + OrderNumber = i, + Customer = new User + { + UserId = "222ffbbb888kkk", + Name = "John Doe", + Username = "johndoe", + CreatedAt = new DateTime(), + ImageId = string.Empty, + UserType = UserType.Customer, + UpdatedAt = new DateTime(), + TwitterId = string.Empty, + FacebookId = "9988998877662222111", + SubscriptionType = 2, + IsNew = true, + IsEmployee = false + }, + ShippingInfo = new List + { + new ShippingInfo() + { + OrderNumber = i, + Employee = new User + { + UserId = "222ffbbb888" + i, + Name = "Shipping Coordinator", + Username = "coordinator" + i, + CreatedAt = new DateTime(), + ImageId = string.Empty, + UserType = UserType.Employee, + UpdatedAt = new DateTime(), + TwitterId = string.Empty, + SubscriptionType = 0, + IsEmployee = true + }, + CarrierId = "TTT123999MMM", + ShippingType = "Ground", + EstimatedDelivery = new DateTime(), + Tracking = new Uri("http://TestShipCompany.test/track/123" + i), + CarrierName = "TestShipCompany", + HandlingInstruction = "Do cats eat bats? Do cats eat bats. Do cats eat bats? Do cats eat bats. Do cats eat bats? Do cats eat bats. Do cats eat bats? Do cats eat bats", + CurrentStatus = "Out for delivery", + IsDangerous = false + } + }, + OneTime = true, + Cancelled = false, + IsGift = i % 2 == 0, + IsGPickUp = i % 5 == 0, + ShippingAddress = new Address() + { + City = "Redmond" + }, + PickupAddress = new Address + { + City = "Bellevue" + }, + Coupon = SampleEnumInt64.Max, + UserInteractions = new List + { + new Comment + { + Id = 200 + i, + OrderNumber = i, + Customer = new User + { + UserId = "222ffbbb888kkk", + Name = "John Doe", + Username = "johndoe", + CreatedAt = new DateTime(), + ImageId = string.Empty, + UserType = UserType.Customer, + UpdatedAt = new DateTime(), + TwitterId = "twitterId" + i, + FacebookId = "9988998877662222111", + SubscriptionType = 2, + IsNew = true, + IsEmployee = false + }, + Title = "Green Field", + Message = "Down, down, down. Would the fall never come to an end! 'I wonder how many miles I've fallen by this time. I think-' (for, you see, Alice had learnt several things of this sort in her lessons in the schoolroom, and though this was not a very good opportunity for showing off her knowledge, as there was no one to listen to her, still it was good practice to say it over) '-yes, that's about the right distance-but then I wonder what Latitude or Longitude I've got to", + Responses = new List() + } + }, + Created = new DateTime(2019, 11, 10), + Confirmed = new DateTime(2019, 11, 11), + ShippingDate = new DateTime(2019, 11, 12), + EstimatedDelivery = new DateTime(2019, 11, 15), + ReviewedBy = new User() + { + UserId = "222ffbbb888" + i, + Name = "Shipping Coordinator", + Username = "coordinator" + i, + CreatedAt = new DateTime(), + ImageId = string.Empty, + UserType = UserType.Employee, + UpdatedAt = new DateTime(), + TwitterId = string.Empty, + SubscriptionType = 0, + IsEmployee = true + } + }; + List products = new List(); + for (int j = 0; j < i % 4; j++) + { + Product product = new Product() + { + ProductId = Guid.NewGuid(), + Name = "Surface Pro", + SKU = "LL123" + j, + Brand = new TestClassWithInitializedProperties(), + ProductCategory = new SimpleTestClassWithNonGenericCollectionWrappers(), + Description = "Down, down, down. Would the fall never come to an end! 'I wonder how many miles I've fallen by this time. I think-' (for, you see, Alice had learnt several things of this sort in her lessons in the schoolroom, and though this was not a very good opportunity for showing off her knowledge, as there was no one to listen to her, still it was good practice to say it over) '-yes, that's about the right distance-but then I wonder what Latitude or Longitude I've got to", + Created = new DateTime(2000, 10, 12), + Title = "Surface Pro 6 for Business - 512GB", + Price = new Price(), + BestChoice = true, + AverageStars = 4.8f, + Featured = true, + ProductRestrictions = new TestClassWithInitializedProperties(), + SalesInfo = new SimpleTestClassWithGenericCollectionWrappers(), + Origin = SampleEnum.One, + Manufacturer = new BasicCompany(), + Fragile = true, + DetailsUrl = new Uri("http://dotnet.test/link/entries/entry/1"), + NetWeight = 2.7m, + GrossWeight = 3.3m, + Length = i, + Height = i + 1, + Width = i + 2, + FeaturedImage = new FeaturedImage(), + PreviewImage = new PreviewImage(), + KeyWords = new List { "surface", "pro", "laptop" }, + RelatedImages = new List(), + RelatedVideo = new Uri("http://dotnet.test/link/entries/entry/2"), + GuaranteeStartsAt = new DateTime(), + GuaranteeEndsAt = new DateTime(), + IsActive = true, + RelatedProducts = new List() + }; + product.SalesInfo.Initialize(); + List reviews = new List(); + for (int k = 0; k < i % 3; k++) + { + + Review review = new Review + { + Customer = new User + { + UserId = "333344445555", + Name = "Customer" + i + k, + Username = "cust" + i + k, + CreatedAt = new DateTime(), + ImageId = string.Empty, + UserType = UserType.Customer, + SubscriptionType = k + }, + ProductSku = product.SKU, + CustomerName = "Customer" + i + k, + Stars = j + k, + Title = $"Title {i}{j}{k}", + Comment = "", + Images = new List { new Uri($"http://dotnet.test/link/images/image/{k}"), new Uri($"http://dotnet.test/link/images/image/{j}") }, + ReviewId = i + j + k + }; + reviews.Add(review); + } + product.Reviews = reviews; + products.Add(product); + } + order.Products = products; + orders.Add(order); + } + return orders; + } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonNode/SerializerInteropTests.cs b/src/libraries/System.Text.Json/tests/Common/NodeInteropTests.cs similarity index 65% rename from src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonNode/SerializerInteropTests.cs rename to src/libraries/System.Text.Json/tests/Common/NodeInteropTests.cs index 2d325eac994f1d..20562ef04fbc10 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonNode/SerializerInteropTests.cs +++ b/src/libraries/System.Text.Json/tests/Common/NodeInteropTests.cs @@ -2,20 +2,24 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Text.Json.Nodes; using System.Text.Json.Serialization.Tests.Schemas.OrderPayload; +using System.Threading.Tasks; using Xunit; -namespace System.Text.Json.Nodes.Tests +namespace System.Text.Json.Serialization.Tests { - public static class SerializerInteropTests + public abstract class NodeInteropTests : SerializerTests { + public NodeInteropTests(JsonSerializerWrapperForString serializerWrapper) : base(serializerWrapper) { } + [Fact] - public static void CompareResultsAgainstSerializer() + public async Task CompareResultsAgainstSerializer() { - List obj = Serialization.Tests.StreamTests.PopulateLargeObject(2); - string expected = JsonSerializer.Serialize(obj); + List obj = JsonTestHelper.PopulateLargeObject(2); + string expected = await JsonSerializerWrapperForString.SerializeWrapper(obj); - JsonArray jArray = JsonSerializer.Deserialize(expected); + JsonArray jArray = await JsonSerializerWrapperForString.DeserializeWrapper(expected); string actual = jArray.ToJsonString(); Assert.Equal(expected, actual); @@ -24,7 +28,7 @@ public static void CompareResultsAgainstSerializer() Assert.Equal(expected, actual); } - private class Poco + public class Poco { public string MyString { get; set; } public JsonNode Node { get; set; } @@ -35,7 +39,7 @@ private class Poco } [Fact] - public static void NodesAsPocoProperties() + public async Task NodesAsPocoProperties() { const string Expected = "{\"MyString\":null,\"Node\":42,\"Array\":[43],\"Value\":44,\"IntValue\":45,\"Object\":{\"Property\":46}}"; @@ -51,10 +55,10 @@ public static void NodesAsPocoProperties() } }; - string json = JsonSerializer.Serialize(poco); + string json = await JsonSerializerWrapperForString.SerializeWrapper(poco); Assert.Equal(Expected, json); - poco = JsonSerializer.Deserialize(json); + poco = await JsonSerializerWrapperForString.DeserializeWrapper(json); Assert.Equal(42, (int)poco.Node); Assert.Equal(43, (int)poco.Array[0]); Assert.Equal(44, (int)poco.Value); diff --git a/src/libraries/System.Text.Json/tests/Common/PropertyNameTests.cs b/src/libraries/System.Text.Json/tests/Common/PropertyNameTests.cs new file mode 100644 index 00000000000000..fe1c4b5f73ce3b --- /dev/null +++ b/src/libraries/System.Text.Json/tests/Common/PropertyNameTests.cs @@ -0,0 +1,484 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// This file is saved as Unicode in order to test inline (not escaped) unicode characters. + +using System.Collections.Generic; +using System.Text.Encodings.Web; +using System.Threading.Tasks; +using Xunit; + +namespace System.Text.Json.Serialization.Tests +{ + public abstract partial class PropertyNameTests : SerializerTests + { + public PropertyNameTests(JsonSerializerWrapperForString serializerWrapper) : base(serializerWrapper) { } + + [Fact] + public async Task CamelCaseDeserializeNoMatch() + { + var options = new JsonSerializerOptions(); + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + + SimpleTestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""MyInt16"":1}", options); + + // This is 0 (default value) because the data does not match the property "MyInt16" that is assuming camel-casing of "myInt16". + Assert.Equal(0, obj.MyInt16); + } + + [Fact] + public async Task CamelCaseDeserializeMatch() + { + var options = new JsonSerializerOptions(); + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + + SimpleTestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""myInt16"":1}", options); + + // This is 1 because the data matches the property "MyInt16" that is assuming camel-casing of "myInt16". + Assert.Equal(1, obj.MyInt16); + } + + [Fact] + public async Task CamelCaseSerialize() + { + var options = new JsonSerializerOptions(); + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + + SimpleTestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{}", options); + + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Contains(@"""myInt16"":0", json); + Assert.Contains(@"""myInt32"":0", json); + } + + [Fact] + public async Task CustomNamePolicy() + { + var options = new JsonSerializerOptions(); + options.PropertyNamingPolicy = new UppercaseNamingPolicy(); + + SimpleTestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""MYINT16"":1}", options); + + // This is 1 because the data matches the property "MYINT16" that is uppercase of "myInt16". + Assert.Equal(1, obj.MyInt16); + } + + [Fact] + public async Task NullNamePolicy() + { + var options = new JsonSerializerOptions(); + options.PropertyNamingPolicy = new NullNamingPolicy(); + + // A policy that returns null is not allowed. + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(@"{}", options)); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(new SimpleTestClass(), options)); + } + + [Fact] + public async Task IgnoreCase() + { + { + // A non-match scenario with no options (case-sensitive by default). + SimpleTestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""myint16"":1}"); + Assert.Equal(0, obj.MyInt16); + } + + { + // A non-match scenario with default options (case-sensitive by default). + var options = new JsonSerializerOptions(); + SimpleTestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""myint16"":1}", options); + Assert.Equal(0, obj.MyInt16); + } + + { + var options = new JsonSerializerOptions(); + options.PropertyNameCaseInsensitive = true; + SimpleTestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""myint16"":1}", options); + Assert.Equal(1, obj.MyInt16); + } + } + + [Fact] + public async Task JsonPropertyNameAttribute() + { + { + OverridePropertyNameDesignTime_TestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""Blah"":1}"); + Assert.Equal(1, obj.myInt); + + obj.myObject = 2; + + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Contains(@"""Blah"":1", json); + Assert.Contains(@"""BlahObject"":2", json); + } + + // The JsonPropertyNameAttribute should be unaffected by JsonNamingPolicy and PropertyNameCaseInsensitive. + { + var options = new JsonSerializerOptions(); + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + options.PropertyNameCaseInsensitive = true; + + OverridePropertyNameDesignTime_TestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""Blah"":1}", options); + Assert.Equal(1, obj.myInt); + + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Contains(@"""Blah"":1", json); + } + } + + [Fact] + public async Task JsonNameAttributeDuplicateDesignTimeFail() + { + { + var options = new JsonSerializerOptions(); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{}", options)); + } + + { + var options = new JsonSerializerOptions(); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(new DuplicatePropertyNameDesignTime_TestClass(), options)); + } + } + + [Fact] + public async Task JsonNameConflictOnCamelCasingFail() + { + { + // Baseline comparison - no options set. + IntPropertyNamesDifferentByCaseOnly_TestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper("{}"); + await JsonSerializerWrapperForString.SerializeWrapper(obj); + } + + { + var options = new JsonSerializerOptions(); + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{}", options)); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(new IntPropertyNamesDifferentByCaseOnly_TestClass(), options)); + } + + { + // Baseline comparison - no options set. + ObjectPropertyNamesDifferentByCaseOnly_TestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper("{}"); + await JsonSerializerWrapperForString.SerializeWrapper(obj); + } + + { + var options = new JsonSerializerOptions(); + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{}", options)); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(new ObjectPropertyNamesDifferentByCaseOnly_TestClass(), options)); + } + } + + [Fact] + public async Task JsonOutputNotAffectedByCasingPolicy() + { + { + // Baseline. + string json = await JsonSerializerWrapperForString.SerializeWrapper(new SimpleTestClass()); + Assert.Contains(@"""MyInt16"":0", json); + } + + // The JSON output should be unaffected by PropertyNameCaseInsensitive. + { + var options = new JsonSerializerOptions(); + options.PropertyNameCaseInsensitive = true; + + string json = await JsonSerializerWrapperForString.SerializeWrapper(new SimpleTestClass(), options); + Assert.Contains(@"""MyInt16"":0", json); + } + } + + [Fact] + public async Task EmptyPropertyName() + { + string json = @"{"""":1}"; + + { + var obj = new EmptyPropertyName_TestClass(); + obj.MyInt1 = 1; + + string jsonOut = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal(json, jsonOut); + } + + { + EmptyPropertyName_TestClass obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.MyInt1); + } + } + + [Fact] + public async Task UnicodePropertyNames() + { + ClassWithUnicodeProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper("{\"A\u0467\":1}"); + Assert.Equal(1, obj.A\u0467); + + // Specifying encoder on options does not impact deserialize. + var options = new JsonSerializerOptions(); + options.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping; + + obj = await JsonSerializerWrapperForString.DeserializeWrapper("{\"A\u0467\":1}", options); + Assert.Equal(1, obj.A\u0467); + + string json; + + // Verify the name is escaped after serialize. + json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Contains(@"""A\u0467"":1", json); + + // With custom escaper + json = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Contains("\"A\u0467\":1", json); + + // Verify the name is unescaped after deserialize. + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.A\u0467); + + // With custom escaper + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); + Assert.Equal(1, obj.A\u0467); + } + + [Fact] + public async Task UnicodePropertyNamesWithPooledAlloc() + { + // We want to go over StackallocByteThreshold=256 to force a pooled allocation, so this property is 400 chars and 401 bytes. + ClassWithUnicodeProperty obj = await JsonSerializerWrapperForString.DeserializeWrapper("{\"A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\":1}"); + Assert.Equal(1, obj.A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890); + + // Verify the name is escaped after serialize. + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Contains(@"""A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"":1", json); + + // Verify the name is unescaped after deserialize. + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890); + } + + public class ClassWithPropertyNamePermutations + { + public int a { get; set; } + public int aa { get; set; } + public int aaa { get; set; } + public int aaaa { get; set; } + public int aaaaa { get; set; } + public int aaaaaa { get; set; } + + // 7 characters - caching code only keys up to 7. + public int aaaaaaa { get; set; } + public int aaaaaab { get; set; } + + // 8 characters. + public int aaaaaaaa { get; set; } + public int aaaaaaab { get; set; } + + // 9 characters. + public int aaaaaaaaa { get; set; } + public int aaaaaaaab { get; set; } + + public int \u0467 { get; set; } + public int \u0467\u0467 { get; set; } + public int \u0467\u0467a { get; set; } + public int \u0467\u0467b { get; set; } + public int \u0467\u0467\u0467 { get; set; } + public int \u0467\u0467\u0467a { get; set; } + public int \u0467\u0467\u0467b { get; set; } + public int \u0467\u0467\u0467\u0467 { get; set; } + public int \u0467\u0467\u0467\u0467a { get; set; } + public int \u0467\u0467\u0467\u0467b { get; set; } + } + + [Fact] + public async Task CachingKeys() + { + ClassWithPropertyNamePermutations obj; + + void Verify() + { + Assert.Equal(1, obj.a); + Assert.Equal(2, obj.aa); + Assert.Equal(3, obj.aaa); + Assert.Equal(4, obj.aaaa); + Assert.Equal(5, obj.aaaaa); + Assert.Equal(6, obj.aaaaaa); + Assert.Equal(7, obj.aaaaaaa); + Assert.Equal(7, obj.aaaaaab); + Assert.Equal(8, obj.aaaaaaaa); + Assert.Equal(8, obj.aaaaaaab); + Assert.Equal(9, obj.aaaaaaaaa); + Assert.Equal(9, obj.aaaaaaaab); + + Assert.Equal(2, obj.\u0467); + Assert.Equal(4, obj.\u0467\u0467); + Assert.Equal(5, obj.\u0467\u0467a); + Assert.Equal(5, obj.\u0467\u0467b); + Assert.Equal(6, obj.\u0467\u0467\u0467); + Assert.Equal(7, obj.\u0467\u0467\u0467a); + Assert.Equal(7, obj.\u0467\u0467\u0467b); + Assert.Equal(8, obj.\u0467\u0467\u0467\u0467); + Assert.Equal(9, obj.\u0467\u0467\u0467\u0467a); + Assert.Equal(9, obj.\u0467\u0467\u0467\u0467b); + } + + obj = new ClassWithPropertyNamePermutations + { + a = 1, + aa = 2, + aaa = 3, + aaaa = 4, + aaaaa = 5, + aaaaaa = 6, + aaaaaaa = 7, + aaaaaab = 7, + aaaaaaaa = 8, + aaaaaaab = 8, + aaaaaaaaa = 9, + aaaaaaaab = 9, + \u0467 = 2, + \u0467\u0467 = 4, + \u0467\u0467a = 5, + \u0467\u0467b = 5, + \u0467\u0467\u0467 = 6, + \u0467\u0467\u0467a = 7, + \u0467\u0467\u0467b = 7, + \u0467\u0467\u0467\u0467 = 8, + \u0467\u0467\u0467\u0467a = 9, + \u0467\u0467\u0467\u0467b = 9, + }; + + // Verify baseline. + Verify(); + + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + + // Verify the length is consistent with a verified value. + Assert.Equal(354, json.Length); + + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + + // Verify round-tripped object. + Verify(); + } + + [Fact] + public async Task BadNamingPolicy_ThrowsInvalidOperation() + { + var options = new JsonSerializerOptions { DictionaryKeyPolicy = new NullNamingPolicy() }; + + var inputPrimitive = new Dictionary + { + { "validKey", 1 } + }; + + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(inputPrimitive, options)); + + var inputClass = new Dictionary + { + { "validKey", new OverridePropertyNameDesignTime_TestClass() } + }; + + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(inputClass, options)); + } + + public class OverridePropertyNameDesignTime_TestClass + { + [JsonPropertyName("Blah")] + public int myInt { get; set; } + + [JsonPropertyName("BlahObject")] + public object myObject { get; set; } + } + + public class DuplicatePropertyNameDesignTime_TestClass + { + [JsonPropertyName("Blah")] + public int MyInt1 { get; set; } + + [JsonPropertyName("Blah")] + public int MyInt2 { get; set; } + } + + public class EmptyPropertyName_TestClass + { + [JsonPropertyName("")] + public int MyInt1 { get; set; } + } + + public class NullPropertyName_TestClass + { + [JsonPropertyName(null)] + public int MyInt1 { get; set; } + } + + public class IntPropertyNamesDifferentByCaseOnly_TestClass + { + public int myInt { get; set; } + public int MyInt { get; set; } + } + + public class ObjectPropertyNamesDifferentByCaseOnly_TestClass + { + public int myObject { get; set; } + public int MyObject { get; set; } + } + + [Fact] + public async Task SpecialCharacters() + { + ClassWithSpecialCharacters obj = new() + { + Baseline = 1, + Schema = 2, + SmtpId = 3, + Emojies = 4, + ꀀ = 5, + YiIt_2 = 6 + }; + + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal( + "{\"Baseline\":1," + + "\"$schema\":2," + + "\"smtp-id\":3," + + "\"\\uD83D\\uDE00\\uD83D\\uDE01\":4," + + "\"\\uA000\":5," + + "\"\\uA000_2\":6}", json); + + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(1, obj.Baseline); + Assert.Equal(2, obj.Schema); + Assert.Equal(3, obj.SmtpId); + Assert.Equal(4, obj.Emojies); + Assert.Equal(5, obj.ꀀ); + Assert.Equal(6, obj.YiIt_2); + } + + public class ClassWithSpecialCharacters + { + [JsonPropertyOrder(1)] + public int Baseline { get; set; } + + [JsonPropertyOrder(2)] + [JsonPropertyName("$schema")] // Invalid C# property name. + public int Schema { get; set; } + + [JsonPropertyOrder(3)] + [JsonPropertyName("smtp-id")] // Invalid C# property name. + public int SmtpId { get; set; } + + [JsonPropertyOrder(4)] + [JsonPropertyName("😀😁")] // Invalid C# property name. Unicode:\uD83D\uDE00\uD83D\uDE01 + public int Emojies { get; set; } + + [JsonPropertyOrder(5)] + public int ꀀ { get; set; } // Valid C# property name. Unicode:\uA000 + + [JsonPropertyOrder(6)] + [JsonPropertyName("\uA000_2")] // Valid C# property name: ꀀ_2 + public int YiIt_2 { get; set; } + } + } +} diff --git a/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.NonPublicAccessors.cs b/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.NonPublicAccessors.cs index 0c8dc6a941c38f..af5159c0552e36 100644 --- a/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.NonPublicAccessors.cs +++ b/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.NonPublicAccessors.cs @@ -216,31 +216,46 @@ public async Task HonorNamingPolicy() } [Fact] - public virtual async Task HonorJsonPropertyName() + public virtual async Task HonorJsonPropertyName_PrivateGetter() { - string json = @"{""prop1"":1,""prop2"":2}"; + string json = @"{""prop1"":1}"; - var obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); - Assert.Equal(MySmallEnum.AnotherValue, obj.GetMyEnum); - Assert.Equal(2, obj.MyInt); + var obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(MySmallEnum.AnotherValue, obj.GetProxy()); json = await JsonSerializerWrapperForString.SerializeWrapper(obj); Assert.Contains(@"""prop1"":1", json); + } + + [Fact] + public virtual async Task HonorJsonPropertyName_PrivateSetter() + { + string json = @"{""prop2"":2}"; + + var obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(2, obj.MyInt); + + json = await JsonSerializerWrapperForString.SerializeWrapper(obj); Assert.Contains(@"""prop2"":2", json); } - public struct StructWithPropertiesWithJsonPropertyName + public struct StructWithPropertiesWithJsonPropertyName_PrivateGetter { [JsonInclude] [JsonPropertyName("prop1")] public MySmallEnum MyEnum { private get; set; } + // For test validation. + internal MySmallEnum GetProxy() => MyEnum; + } + + public struct StructWithPropertiesWithJsonPropertyName_PrivateSetter + { [JsonInclude] [JsonPropertyName("prop2")] public int MyInt { get; private set; } - // For test validation. - internal MySmallEnum GetMyEnum => MyEnum; + internal void SetProxy(int myInt) => MyInt = myInt; } [Fact] diff --git a/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.cs b/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.cs index 32f19eb120c39c..8c0f57b422a55d 100644 --- a/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.cs +++ b/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.cs @@ -241,6 +241,24 @@ public async Task Ignore_BasePublicPropertyIgnored_ConflictWithDerivedPrivate() Assert.Equal("NewDefaultValue", ((ClassWithIgnoredPublicPropertyAndNewSlotPrivate)obj).MyString); } + [Fact] + public async Task Ignore_VerifyNoReferenceToGetterAndSetter() + { + // Serialize + var obj = new ClassWithObsoleteAndIgnoredProperty(); + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + + Assert.Equal(@"{}", json); + + // Deserialize + json = @"{""MyString_Obsolete"":""NewValue""}"; + obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + +#pragma warning disable CS0618 // Type or member is obsolete + Assert.Equal("DefaultValue", obj.MyString_Obsolete); +#pragma warning restore CS0618 // Type or member is obsolete + } + [Fact] public async Task Ignore_PublicProperty_ConflictWithPrivateDueAttributes() { @@ -782,6 +800,13 @@ public class ClassWithIgnoredPublicProperty public string MyString { get; set; } = "DefaultValue"; } + public class ClassWithObsoleteAndIgnoredProperty + { + [Obsolete("Src gen should not generate reference to getter or setter")] + [JsonIgnore] + public string MyString_Obsolete { get; set; } = "DefaultValue"; + } + public class ClassWithIgnoredPublicPropertyAndNewSlotPrivate : ClassWithIgnoredPublicProperty { internal new string MyString { get; set; } = "NewDefaultValue"; @@ -2628,5 +2653,201 @@ public async Task JsonIgnoreCondition_WhenWritingDefault_OnInterface() json = await JsonSerializerWrapperForString.SerializeWrapper(obj); Assert.Equal("{\"MyProp\":{}}", json); } + + public class ConcreteDerivedClass : AbstractBaseClass + { + // Ignored including on base class: + [JsonIgnore] public override int Abstract_Ignored_Property { get; set; } + [JsonIgnore] public override int Virtual_Ignored_Property { get; set; } + + // Ignored but not specified on base class: + [JsonIgnore] public override int Abstract_IgnoredOnConcrete_Property { get; set; } + [JsonIgnore] public override int Virtual_IgnoredOnConcrete_Property { get; set; } + + // Ignored specified on base class: + [JsonPropertyOrder(1)] public override int Abstract_IgnoredOnBase_Property { get; set; } + [JsonPropertyOrder(2)] public override int Virtual_IgnoredOnBase_Property { get; set; } + + // Standard overrides (not ignored): + [JsonPropertyOrder(3)] public override int Abstract_Property { get; set; } + [JsonPropertyOrder(4)] public override int Virtual_Property { get; set; } + } + + public abstract class AbstractBaseClass + { + [JsonIgnore] public abstract int Abstract_Ignored_Property { get; set; } + [JsonIgnore] public virtual int Virtual_Ignored_Property { get; set; } + + public abstract int Abstract_IgnoredOnConcrete_Property { get; set; } + public virtual int Virtual_IgnoredOnConcrete_Property { get; set; } + + [JsonIgnore] public abstract int Abstract_IgnoredOnBase_Property { get; set; } + [JsonIgnore] public virtual int Virtual_IgnoredOnBase_Property { get; set; } + + public abstract int Abstract_Property { get; set; } + public virtual int Virtual_Property { get; set; } + } + + [Fact] + public async Task JsonIgnoreCondition_Polymorphic() + { + ConcreteDerivedClass obj = new() + { + Abstract_Ignored_Property = -1, + Virtual_Ignored_Property = -1, + Abstract_IgnoredOnConcrete_Property = -1, + Virtual_IgnoredOnConcrete_Property = -1, + Abstract_IgnoredOnBase_Property = 1, + Virtual_IgnoredOnBase_Property = 2, + Abstract_Property = 3, + Virtual_Property = 4, + }; + + // Verify properties work as expected. + Assert.Equal(-1, obj.Abstract_Ignored_Property); + Assert.Equal(-1, obj.Virtual_Ignored_Property); + Assert.Equal(-1, obj.Abstract_IgnoredOnConcrete_Property); + Assert.Equal(-1, obj.Virtual_IgnoredOnConcrete_Property); + Assert.Equal(1, obj.Abstract_IgnoredOnBase_Property); + Assert.Equal(2, obj.Virtual_IgnoredOnBase_Property); + Assert.Equal(3, obj.Abstract_Property); + Assert.Equal(4, obj.Virtual_Property); + + const string ExpectedJson = "{" + + "\"Abstract_IgnoredOnBase_Property\":1," + + "\"Virtual_IgnoredOnBase_Property\":2," + + "\"Abstract_Property\":3," + + "\"Virtual_Property\":4}"; + + string json = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal(ExpectedJson, json); + + const string Json = "{" + + "\"Abstract_Ignored_Property\":-1," + + "\"Virtual_Ignored_Property\":-1," + + "\"Abstract_IgnoredOnConcrete_Property\":-1," + + "\"Virtual_IgnoredOnConcrete_Property\":-1," + + "\"Abstract_IgnoredOnBase_Property\":1," + + "\"Virtual_IgnoredOnBase_Property\":2," + + "\"Abstract_Property\":3," + + "\"Virtual_Property\":4}"; + + obj = await JsonSerializerWrapperForString.DeserializeWrapper(Json); + Assert.Equal(0, obj.Abstract_Ignored_Property); + Assert.Equal(0, obj.Virtual_Ignored_Property); + Assert.Equal(0, obj.Abstract_IgnoredOnConcrete_Property); + Assert.Equal(0, obj.Virtual_IgnoredOnConcrete_Property); + Assert.Equal(1, obj.Abstract_IgnoredOnBase_Property); + Assert.Equal(2, obj.Virtual_IgnoredOnBase_Property); + Assert.Equal(3, obj.Abstract_Property); + Assert.Equal(4, obj.Virtual_Property); + } + + [Fact] + public async Task SerializationMetadataNotComputedWhenMemberIgnored() + { + string janePayload = @"{""Name"":""Jane Doe""}"; + +#if !BUILDING_SOURCE_GENERATOR_TESTS + // Without [JsonIgnore], serializer throws exceptions due to runtime-reflection-based property metadata inspection. + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(new TypeWith_RefStringProp())); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{}")); + + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(new TypeWith_PropWith_BadConverter())); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper("{}")); +#else + // Ref returns supported in source-gen mode + string expected = @"{""NameRef"":""John Doe"",""Name"":""John Doe""}"; + JsonTestHelper.AssertJsonEqual(expected, await JsonSerializerWrapperForString.SerializeWrapper(new TypeWith_RefStringProp())); + + var obj = await JsonSerializerWrapperForString.DeserializeWrapper(janePayload); + Assert.Equal("Jane Doe", obj.Name); + Assert.Equal("Jane Doe", obj.NameRef); + + var obj2 = new TypeWith_PropWith_BadConverter(); + obj2.Property = "Hello"; + + // Invalid converter specified, fallback to built-in converter. This should be corrected. + // https://github.com/dotnet/runtime/issues/60020. + + Assert.Equal(@"{""Property"":""Hello""}", await JsonSerializerWrapperForString.SerializeWrapper(obj2)); + + obj2 = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""Property"":""World""}"); + Assert.Equal("World", obj2.Property); +#endif + + // With [JsonIgnore], serializer skips property metadata inspection + Assert.Equal(@"{""Name"":""John Doe""}", await JsonSerializerWrapperForString.SerializeWrapper(new TypeWith_IgnoredRefStringProp())); + Assert.Equal("Jane Doe", (await JsonSerializerWrapperForString.DeserializeWrapper(janePayload)).Name); + + Assert.Equal("{}", await JsonSerializerWrapperForString.SerializeWrapper(new TypeWith_IgnoredPropWith_BadConverter())); + Assert.Null((await JsonSerializerWrapperForString.DeserializeWrapper("{}")).Property); + } + + internal class TypeWith_RefStringProp + { + public ref string NameRef => ref Name; + + [JsonInclude] // This is a field. + public string Name = "John Doe"; + } + + internal class TypeWith_IgnoredRefStringProp + { + [JsonIgnore] + public ref string NameRef => ref Name; + + [JsonInclude] // This is a field. + public string Name = "John Doe"; + } + + public class TypeWith_PropWith_BadConverter + { + [JsonConverter(typeof(BadConverter))] + public string? Property { get; set; } + } + + public class TypeWith_IgnoredPropWith_BadConverter + { + [JsonIgnore] + [JsonConverter(typeof(BadConverter))] + public string? Property { get; set; } + } + + public class BadConverter + { + } + + [Fact] + public async Task TestClassWithIgnoredCallbacks() + { + Assert.Equal("{}", await JsonSerializerWrapperForString.SerializeWrapper(new ClassWithIgnoredCallbacks())); + var obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""Func"":"""",""Action"":""""}"); + Assert.False(obj.Func("")); + Assert.Null(obj.Action); + } + + [Fact] + public async Task TestClassWithCallbacks() + { + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(new ClassWithCallbacks())); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(@"{""Func"":{},""Action"":{}")); + } + + public class ClassWithIgnoredCallbacks + { + [JsonIgnore] + public Func Func { get; set; } = (val) => false; + + [JsonIgnore] + public Action Action { get; set; } + } + + public class ClassWithCallbacks + { + public Func Func { get; set; } + + public Action Action { get; set; } = (val) => Console.WriteLine(); + } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/SampleTestData.OrderPayload.cs b/src/libraries/System.Text.Json/tests/Common/SampleTestData.OrderPayload.cs similarity index 100% rename from src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/SampleTestData.OrderPayload.cs rename to src/libraries/System.Text.Json/tests/Common/SampleTestData.OrderPayload.cs diff --git a/src/libraries/System.Text.Json/tests/Common/TestClasses/TestClasses.Constructor.cs b/src/libraries/System.Text.Json/tests/Common/TestClasses/TestClasses.Constructor.cs index 0d2749c7b13ca6..890d61f97245d1 100644 --- a/src/libraries/System.Text.Json/tests/Common/TestClasses/TestClasses.Constructor.cs +++ b/src/libraries/System.Text.Json/tests/Common/TestClasses/TestClasses.Constructor.cs @@ -923,7 +923,7 @@ public class NullArgTester_Mutable public int Int { get; set; } } - public class ClassWithConstructor_SimpleAndComplexParameters : ITestClassWithParameterizedCtor + public class ObjWCtorMixedParams : ITestClassWithParameterizedCtor { public byte MyByte { get; } public sbyte MySByte { get; set; } @@ -961,7 +961,7 @@ public class ClassWithConstructor_SimpleAndComplexParameters : ITestClassWithPar public ImmutableSortedSet MyStringImmutableSortedSetT { get; } public List MyListOfNullString { get; } - public ClassWithConstructor_SimpleAndComplexParameters( + public ObjWCtorMixedParams( byte myByte, char myChar, string myString, @@ -1011,8 +1011,8 @@ public ClassWithConstructor_SimpleAndComplexParameters( MyListOfNullString = myListOfNullString; } - public static ClassWithConstructor_SimpleAndComplexParameters GetInstance() => - JsonSerializer.Deserialize(s_json); + public static ObjWCtorMixedParams GetInstance() => + JsonSerializer.Deserialize(s_json); public static string s_json => $"{{{s_partialJson1},{s_partialJson2}}}"; @@ -1849,23 +1849,23 @@ public class CampaignSummaryViewModel public class Parameterized_Class_With_ComplexTuple : ITestClassWithParameterizedCtor { public Tuple< - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters> MyTuple { get; } + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams> MyTuple { get; } public Parameterized_Class_With_ComplexTuple( Tuple< - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters, - ClassWithConstructor_SimpleAndComplexParameters> myTuple) => MyTuple = myTuple; + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams, + ObjWCtorMixedParams> myTuple) => MyTuple = myTuple; private const string s_inner_json = @" { diff --git a/src/libraries/System.Text.Json/tests/Common/UnsupportedTypesTests.cs b/src/libraries/System.Text.Json/tests/Common/UnsupportedTypesTests.cs new file mode 100644 index 00000000000000..35359cafd159bd --- /dev/null +++ b/src/libraries/System.Text.Json/tests/Common/UnsupportedTypesTests.cs @@ -0,0 +1,272 @@ +// 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.Generic; +using System.Runtime.Serialization; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.Text.Json.Serialization.Tests +{ + public abstract class UnsupportedTypesTests : SerializerTests + { + private bool SupportsJsonPathOnSerialize { get; init; } + + public UnsupportedTypesTests( + JsonSerializerWrapperForString serializerWrapper, + bool supportsJsonPathOnSerialize) : base(serializerWrapper) + { + SupportsJsonPathOnSerialize = supportsJsonPathOnSerialize; + } + + [Fact] + public async Task DeserializeUnsupportedType() + { + // Any test payload is fine. + string json = @"""Some string"""; + + await RunTest(json); + await RunTest(json); + await RunTest(json); + await RunTest(json); // One nullable variation. + await RunTest(json); +#if NETCOREAPP + await RunTest(json); + await RunTest(json); +#endif +#if BUILDING_SOURCE_GENERATOR_TESTS + await RunTest>(json); + await RunTest(json); +#endif + + async Task RunTest(string json) + { + Type type = GetNullableOfTUnderlyingType(typeof(T), out bool isNullableOfT); + string fullName = type.FullName; + + NotSupportedException ex = await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(json)); + string exAsStr = ex.ToString(); + Assert.Contains(fullName, exAsStr); + Assert.Contains("$", exAsStr); + + json = $@"{{""Prop"":{json}}}"; + + ex = await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper>(json)); + exAsStr = ex.ToString(); + Assert.Contains(fullName, exAsStr); + Assert.Contains("$.Prop", exAsStr); + + // Verify Nullable<> semantics. NSE is not thrown because the serializer handles null. + if (isNullableOfT) + { + Assert.Null(JsonSerializer.Deserialize("null")); + + json = $@"{{""Prop"":null}}"; + ClassWithType obj = await JsonSerializerWrapperForString.DeserializeWrapper>(json); + Assert.Null(obj.Prop); + } + } + } + + [Fact] + public async Task SerializeUnsupportedType() + { + await RunTest(typeof(int)); + await RunTest(new SerializationInfo(typeof(Type), new FormatterConverter())); + await RunTest((IntPtr)123); + await RunTest(new IntPtr(123)); // One nullable variation. + await RunTest((UIntPtr)123); +#if NETCOREAPP + await RunTest(DateOnly.MaxValue); + await RunTest(TimeOnly.MinValue); +#endif +#if BUILDING_SOURCE_GENERATOR_TESTS + await RunTest(new ClassThatImplementsIAsyncEnumerable()); +#endif + + async Task RunTest(T value) + { + Type type = GetNullableOfTUnderlyingType(typeof(T), out bool isNullableOfT); + string fullName = type.FullName; + + NotSupportedException ex = await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(value)); + string exAsStr = ex.ToString(); + Assert.Contains(fullName, exAsStr); + Assert.Contains("$", exAsStr); + + ClassWithType obj = new ClassWithType { Prop = value }; + + ex = await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(obj)); + exAsStr = ex.ToString(); + Assert.Contains(fullName, exAsStr); + + if (SupportsJsonPathOnSerialize) + { + Assert.Contains("$.Prop", exAsStr); + } + else + { + Assert.Contains("$.", exAsStr); + Assert.DoesNotContain("$.Prop", exAsStr); + } + + // Verify null semantics. NSE is not thrown because the serializer handles null. + if (!type.IsValueType || isNullableOfT) + { + string serialized = await JsonSerializerWrapperForString.SerializeWrapper((T)(object)null); + Assert.Equal("null", serialized); + + obj.Prop = (T)(object)null; + serialized = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal(@"{""Prop"":null}", serialized); + + serialized = await JsonSerializerWrapperForString.SerializeWrapper(obj, new JsonSerializerOptions { IgnoreNullValues = true }); + Assert.Equal(@"{}", serialized); + } + } + } + + public class ClassWithIntPtr + { + public IntPtr MyIntPtr { get; set; } + } + + public class ClassWithIntPtrConverter + { + [JsonConverter(typeof(IntPtrConverter))] + public IntPtr MyIntPtr { get; set; } + } + + public class IntPtrConverter : JsonConverter + { + public override IntPtr Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + int value = reader.GetInt32(); + return new IntPtr(value); + } + + public override void Write(Utf8JsonWriter writer, IntPtr value, JsonSerializerOptions options) + { + writer.WriteNumberValue(value.ToInt32()); + } + } + + [Fact] + public async Task RuntimeConverterIsSupported_IntPtr() + { + const string Json = "{\"MyIntPtr\":42}"; + string serialized; + JsonSerializerOptions options = new(); + options.Converters.Add(new IntPtrConverter()); + + serialized = await JsonSerializerWrapperForString.SerializeWrapper(new IntPtr(42), options); + Assert.Equal("42", serialized); + + IntPtr intPtr = await JsonSerializerWrapperForString.DeserializeWrapper("42", options); + Assert.Equal(42, intPtr.ToInt32()); + + ClassWithIntPtr obj = new() { MyIntPtr = new IntPtr(42) }; + serialized = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Equal(Json, serialized); + + obj = await JsonSerializerWrapperForString.DeserializeWrapper(Json, options); + Assert.Equal(42, obj.MyIntPtr.ToInt32()); + } + + [Fact] + public async Task CompileTimeConverterIsSupported_IntPtr() + { + const string Json = "{\"MyIntPtr\":42}"; + + ClassWithIntPtrConverter obj = new() { MyIntPtr = new IntPtr(42) }; + string serialized = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal(Json, serialized); + + obj = await JsonSerializerWrapperForString.DeserializeWrapper(Json); + Assert.Equal(42, obj.MyIntPtr.ToInt32()); + } + + public class ClassWithAsyncEnumerableConverter + { + [JsonConverter(typeof(AsyncEnumerableConverter))] + public ClassThatImplementsIAsyncEnumerable MyAsyncEnumerable { get; set; } + } + + public class ClassThatImplementsIAsyncEnumerable : IAsyncEnumerable + { + public string Status { get; set; } = "Created"; + + // Should not be called. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) => throw new NotImplementedException(); + } + + public class AsyncEnumerableConverter : JsonConverter + { + public override ClassThatImplementsIAsyncEnumerable Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + Assert.Equal(JsonTokenType.StartArray, reader.TokenType); + reader.Read(); + Assert.Equal(JsonTokenType.EndArray, reader.TokenType); + return new ClassThatImplementsIAsyncEnumerable { Status = "Read" }; + } + + public override void Write(Utf8JsonWriter writer, ClassThatImplementsIAsyncEnumerable value, JsonSerializerOptions options) + { + writer.WriteStartArray(); + writer.WriteEndArray(); + value.Status = "Write"; + } + } + + [Fact] + public async Task RuntimeConverterIsSupported_AsyncEnumerable() + { + const string Json = "{\"MyAsyncEnumerable\":[]}"; + + string serialized; + JsonSerializerOptions options = new(); + options.Converters.Add(new AsyncEnumerableConverter()); + + ClassThatImplementsIAsyncEnumerable obj = new(); + Assert.Equal("Created", obj.Status); + serialized = await JsonSerializerWrapperForString.SerializeWrapper(obj, options); + Assert.Equal("[]", serialized); + Assert.Equal("Write", obj.Status); + obj = await JsonSerializerWrapperForString.DeserializeWrapper("[]", options); + Assert.Equal("Read", obj.Status); + + ClassWithAsyncEnumerableConverter poco = new(); + poco.MyAsyncEnumerable = new(); + Assert.Equal("Created", poco.MyAsyncEnumerable.Status); + serialized = await JsonSerializerWrapperForString.SerializeWrapper(poco, options); + Assert.Equal(Json, serialized); + Assert.Equal("Write", poco.MyAsyncEnumerable.Status); + poco = await JsonSerializerWrapperForString.DeserializeWrapper(Json, options); + Assert.Equal("Read", poco.MyAsyncEnumerable.Status); + } + + [Fact] + public async Task CompileTimeConverterIsSupported_AsyncEnumerable() + { + const string Json = "{\"MyAsyncEnumerable\":[]}"; + + ClassWithAsyncEnumerableConverter obj = new(); + obj.MyAsyncEnumerable = new(); + Assert.Equal("Created", obj.MyAsyncEnumerable.Status); + + string serialized = await JsonSerializerWrapperForString.SerializeWrapper(obj); + Assert.Equal(Json, serialized); + Assert.Equal("Write", obj.MyAsyncEnumerable.Status); + + obj = await JsonSerializerWrapperForString.DeserializeWrapper(Json); + Assert.Equal("Read", obj.MyAsyncEnumerable.Status); + } + + public static Type GetNullableOfTUnderlyingType(Type type, out bool isNullableOfT) + { + isNullableOfT = type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>); + return isNullableOfT ? type.GetGenericArguments()[0] : type; + } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/System.Text.Json.TestLibrary.Roslyn3.11.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/System.Text.Json.TestLibrary.Roslyn3.11.csproj new file mode 100644 index 00000000000000..367b28d96d3717 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/System.Text.Json.TestLibrary.Roslyn3.11.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/System.Text.Json.TestLibrary.Roslyn4.0.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/System.Text.Json.TestLibrary.Roslyn4.0.csproj new file mode 100644 index 00000000000000..138741ea7741a8 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/System.Text.Json.TestLibrary.Roslyn4.0.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/System.Text.Json.TestLibrary.targets b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/System.Text.Json.TestLibrary.targets new file mode 100644 index 00000000000000..bf1d9e18c74a03 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/System.Text.Json.TestLibrary.targets @@ -0,0 +1,17 @@ + + + netstandard2.0 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/TestClasses.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/TestClasses.cs new file mode 100644 index 00000000000000..a0eebf2e4fd383 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.TestLibrary/TestClasses.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Text.Json.Serialization; + +namespace System.Text.Json.SourceGeneration.Tests.NETStandard +{ + public class MyPoco + { + public string Value { get; set; } + } + + [JsonSerializable(typeof(MyPoco))] + public partial class NETStandardSerializerContext : JsonSerializerContext + { + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/ContextClasses.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/ContextClasses.cs index 72af4d22fe3faa..d7a76e4817b668 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/ContextClasses.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/ContextClasses.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Reflection; using System.Text.Json.Serialization; using System.Text.Json.Serialization.Metadata; @@ -9,6 +10,9 @@ namespace System.Text.Json.SourceGeneration.Tests { public interface ITestContext { + public JsonSourceGenerationMode JsonSourceGenerationMode { get; } + public bool IsIncludeFieldsEnabled => GetType().GetCustomAttribute()?.IncludeFields ?? false; + public JsonTypeInfo Location { get; } public JsonTypeInfo NumberTypes { get; } public JsonTypeInfo RepeatedLocation { get; } @@ -27,8 +31,21 @@ public interface ITestContext public JsonTypeInfo MyNestedClass { get; } public JsonTypeInfo MyNestedNestedClass { get; } public JsonTypeInfo ObjectArray { get; } + public JsonTypeInfo ByteArray { get; } public JsonTypeInfo String { get; } + public JsonTypeInfo<(string Label1, int Label2, bool)> ValueTupleStringInt32Boolean { get; } public JsonTypeInfo ClassWithEnumAndNullable { get; } + public JsonTypeInfo ClassWithNullableProperties { get; } + public JsonTypeInfo ClassWithCustomConverter { get; } + public JsonTypeInfo StructWithCustomConverter { get; } + public JsonTypeInfo ClassWithCustomConverterFactory { get; } + public JsonTypeInfo StructWithCustomConverterFactory { get; } + public JsonTypeInfo ClassWithCustomConverterProperty { get; } + public JsonTypeInfo StructWithCustomConverterProperty { get; } + public JsonTypeInfo ClassWithCustomConverterFactoryProperty { get; } + public JsonTypeInfo StructWithCustomConverterFactoryProperty { get; } + public JsonTypeInfo ClassWithBadCustomConverter { get; } + public JsonTypeInfo StructWithBadCustomConverter { get; } } internal partial class JsonContext : JsonSerializerContext @@ -42,14 +59,16 @@ internal partial class JsonContext : JsonSerializerContext private static JsonContext s_defaultContext; public static JsonContext Default => s_defaultContext ??= new JsonContext(new JsonSerializerOptions(s_defaultOptions)); - public JsonContext() : base(null, s_defaultOptions) + public JsonContext() : base(null) { } - public JsonContext(JsonSerializerOptions options) : base(options, s_defaultOptions) + public JsonContext(JsonSerializerOptions options) : base(options) { } + protected override JsonSerializerOptions? GeneratedSerializerOptions => s_defaultOptions; + public override JsonTypeInfo GetTypeInfo(global::System.Type type) { if (type == typeof(JsonMessage)) diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs index 49deae9acadd78..7bc91507d9ad53 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs @@ -1,6 +1,7 @@ // 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.Generic; using System.Reflection; using System.Text.Json.Serialization; using Microsoft.DotNet.RemoteExecutor; @@ -89,5 +90,44 @@ internal record Person(string FirstName, string LastName); internal partial class PersonJsonContext : JsonSerializerContext { } + + // Regression test for https://github.com/dotnet/runtime/issues/62079 + [Fact] + public static void SupportsPropertiesWithCustomConverterFactory() + { + var value = new ClassWithCustomConverterFactoryProperty { MyEnum = Serialization.Tests.SampleEnum.MinZero }; + string json = JsonSerializer.Serialize(value, SingleClassWithCustomConverterFactoryPropertyContext.Default.ClassWithCustomConverterFactoryProperty); + Assert.Equal(@"{""MyEnum"":""MinZero""}", json); + } + + public class ParentClass + { + public ClassWithCustomConverterFactoryProperty? Child { get; set; } + } + + [JsonSerializable(typeof(ParentClass))] + internal partial class SingleClassWithCustomConverterFactoryPropertyContext : JsonSerializerContext + { + } + + // Regression test for https://github.com/dotnet/runtime/issues/61860 + [Fact] + public static void SupportsGenericParameterWithCustomConverterFactory() + { + var value = new List { TestEnum.Cee }; + string json = JsonSerializer.Serialize(value, GenericParameterWithCustomConverterFactoryContext.Default.ListTestEnum); + Assert.Equal(@"[""Cee""]", json); + } + + [JsonConverter(typeof(JsonStringEnumConverter))] + public enum TestEnum + { + Aye, Bee, Cee + } + + [JsonSerializable(typeof(List))] + internal partial class GenericParameterWithCustomConverterFactoryContext : JsonSerializerContext + { + } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataAndSerializationContextTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataAndSerializationContextTests.cs index c924e5af8ccf37..2c7d518e87a7bd 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataAndSerializationContextTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataAndSerializationContextTests.cs @@ -22,13 +22,27 @@ namespace System.Text.Json.SourceGeneration.Tests [JsonSerializable(typeof(MyTypeWithPropertyOrdering))] [JsonSerializable(typeof(MyIntermediateType))] [JsonSerializable(typeof(HighLowTempsImmutable))] + [JsonSerializable(typeof(byte[]))] [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass))] [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass.MyNestedNestedClass))] [JsonSerializable(typeof(object[]))] [JsonSerializable(typeof(string))] + [JsonSerializable(typeof((string Label1, int Label2, bool)))] [JsonSerializable(typeof(RealWorldContextTests.ClassWithEnumAndNullable))] + [JsonSerializable(typeof(RealWorldContextTests.ClassWithNullableProperties))] + [JsonSerializable(typeof(ClassWithCustomConverter))] + [JsonSerializable(typeof(StructWithCustomConverter))] + [JsonSerializable(typeof(ClassWithCustomConverterFactory))] + [JsonSerializable(typeof(StructWithCustomConverterFactory))] + [JsonSerializable(typeof(ClassWithCustomConverterProperty))] + [JsonSerializable(typeof(StructWithCustomConverterProperty))] + [JsonSerializable(typeof(ClassWithCustomConverterFactoryProperty))] + [JsonSerializable(typeof(StructWithCustomConverterFactoryProperty))] + [JsonSerializable(typeof(ClassWithBadCustomConverter))] + [JsonSerializable(typeof(StructWithBadCustomConverter))] internal partial class MetadataAndSerializationContext : JsonSerializerContext, ITestContext { + public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Default; } public sealed class MetadataAndSerializationContextTests : RealWorldContextTests @@ -38,26 +52,39 @@ public sealed class MetadataAndSerializationContextTests : RealWorldContextTests [Fact] public override void EnsureFastPathGeneratedAsExpected() { - Assert.NotNull(MetadataAndSerializationContext.Default.Location.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.NumberTypes.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.RepeatedLocation.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.ActiveOrUpcomingEvent.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.CampaignSummaryViewModel.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.IndexViewModel.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.WeatherForecastWithPOCOs.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.EmptyPoco.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.HighLowTemps.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.MyType.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.MyType2.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.MyTypeWithCallbacks.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.MyTypeWithPropertyOrdering.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.MyIntermediateType.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.HighLowTempsImmutable.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.MyNestedClass.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.MyNestedNestedClass.Serialize); - Assert.Null(MetadataAndSerializationContext.Default.ObjectArray.Serialize); - Assert.Null(MetadataAndSerializationContext.Default.String.Serialize); - Assert.NotNull(MetadataAndSerializationContext.Default.ClassWithEnumAndNullable.Serialize); + Assert.NotNull(MetadataAndSerializationContext.Default.Location.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.NumberTypes.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.RepeatedLocation.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.ActiveOrUpcomingEvent.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.CampaignSummaryViewModel.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.IndexViewModel.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.WeatherForecastWithPOCOs.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.EmptyPoco.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.HighLowTemps.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.MyType.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.MyType2.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.MyTypeWithCallbacks.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.MyTypeWithPropertyOrdering.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.MyIntermediateType.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.HighLowTempsImmutable.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.MyNestedClass.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.MyNestedNestedClass.SerializeHandler); + Assert.Null(MetadataAndSerializationContext.Default.ObjectArray.SerializeHandler); + Assert.Null(MetadataAndSerializationContext.Default.SampleEnum.SerializeHandler); + Assert.Null(MetadataAndSerializationContext.Default.String.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.ValueTupleStringInt32Boolean.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.ClassWithEnumAndNullable.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.ClassWithNullableProperties.SerializeHandler); + Assert.NotNull(MetadataAndSerializationContext.Default.ClassWithCustomConverter); + Assert.NotNull(MetadataAndSerializationContext.Default.StructWithCustomConverter); + Assert.NotNull(MetadataAndSerializationContext.Default.ClassWithCustomConverterFactory); + Assert.NotNull(MetadataAndSerializationContext.Default.StructWithCustomConverterFactory); + Assert.NotNull(MetadataAndSerializationContext.Default.ClassWithCustomConverterProperty); + Assert.NotNull(MetadataAndSerializationContext.Default.StructWithCustomConverterProperty); + Assert.NotNull(MetadataAndSerializationContext.Default.ClassWithCustomConverterFactoryProperty); + Assert.NotNull(MetadataAndSerializationContext.Default.StructWithCustomConverterFactoryProperty); + Assert.Throws(() => MetadataAndSerializationContext.Default.ClassWithBadCustomConverter); + Assert.Throws(() => MetadataAndSerializationContext.Default.StructWithBadCustomConverter); } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataContextTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataContextTests.cs index e6d1fd754f10aa..4d3323cb7f9b3c 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataContextTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataContextTests.cs @@ -24,10 +24,24 @@ namespace System.Text.Json.SourceGeneration.Tests [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass), GenerationMode = JsonSourceGenerationMode.Metadata)] [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass.MyNestedNestedClass), GenerationMode = JsonSourceGenerationMode.Metadata)] [JsonSerializable(typeof(object[]), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(byte[]), GenerationMode = JsonSourceGenerationMode.Metadata)] [JsonSerializable(typeof(string), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof((string Label1, int Label2, bool)), GenerationMode = JsonSourceGenerationMode.Metadata)] [JsonSerializable(typeof(RealWorldContextTests.ClassWithEnumAndNullable), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(RealWorldContextTests.ClassWithNullableProperties), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(ClassWithCustomConverter), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(StructWithCustomConverter), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(ClassWithCustomConverterFactory), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(StructWithCustomConverterFactory), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(ClassWithCustomConverterProperty), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(StructWithCustomConverterProperty), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(ClassWithCustomConverterFactoryProperty), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(StructWithCustomConverterFactoryProperty), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(ClassWithBadCustomConverter), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(StructWithBadCustomConverter), GenerationMode = JsonSourceGenerationMode.Metadata)] internal partial class MetadataWithPerTypeAttributeContext : JsonSerializerContext, ITestContext { + public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Metadata; } public sealed class MetadataWithPerTypeAttributeContextTests : RealWorldContextTests @@ -37,28 +51,42 @@ public sealed class MetadataWithPerTypeAttributeContextTests : RealWorldContextT [Fact] public override void EnsureFastPathGeneratedAsExpected() { - Assert.Null(MetadataWithPerTypeAttributeContext.Default.Location.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.RepeatedLocation.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.NumberTypes.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.ActiveOrUpcomingEvent.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.CampaignSummaryViewModel.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.IndexViewModel.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.WeatherForecastWithPOCOs.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.EmptyPoco.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.HighLowTemps.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyType.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyType2.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyIntermediateType.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.HighLowTempsImmutable.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyNestedClass.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyNestedNestedClass.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.ObjectArray.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.String.Serialize); - Assert.Null(MetadataWithPerTypeAttributeContext.Default.ClassWithEnumAndNullable.Serialize); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.Location.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.RepeatedLocation.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.NumberTypes.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ActiveOrUpcomingEvent.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.CampaignSummaryViewModel.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.IndexViewModel.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.WeatherForecastWithPOCOs.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.EmptyPoco.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.HighLowTemps.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyType.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyType2.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyIntermediateType.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.HighLowTempsImmutable.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyNestedClass.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.MyNestedNestedClass.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ObjectArray.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ByteArray.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.SampleEnum.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.String.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ValueTupleStringInt32Boolean.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ClassWithEnumAndNullable.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ClassWithNullableProperties.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ClassWithCustomConverter.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.StructWithCustomConverter.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ClassWithCustomConverterFactory.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.StructWithCustomConverterFactory.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ClassWithCustomConverterProperty.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.StructWithCustomConverterProperty.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.ClassWithCustomConverterFactoryProperty.SerializeHandler); + Assert.Null(MetadataWithPerTypeAttributeContext.Default.StructWithCustomConverterFactoryProperty.SerializeHandler); + Assert.Throws(() => MetadataWithPerTypeAttributeContext.Default.ClassWithBadCustomConverter.SerializeHandler); + Assert.Throws(() => MetadataWithPerTypeAttributeContext.Default.StructWithBadCustomConverter.SerializeHandler); } } - [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata, IncludeFields = true)] [JsonSerializable(typeof(Location))] [JsonSerializable(typeof(RepeatedTypes.Location), TypeInfoPropertyName = "RepeatedLocation")] [JsonSerializable(typeof(NumberTypes))] @@ -77,9 +105,44 @@ public override void EnsureFastPathGeneratedAsExpected() [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass))] [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass.MyNestedNestedClass))] [JsonSerializable(typeof(object[]))] + [JsonSerializable(typeof(byte[]))] [JsonSerializable(typeof(string))] + [JsonSerializable(typeof((string Label1, int Label2, bool)))] [JsonSerializable(typeof(RealWorldContextTests.ClassWithEnumAndNullable))] + [JsonSerializable(typeof(RealWorldContextTests.ClassWithNullableProperties))] + [JsonSerializable(typeof(ClassWithCustomConverter))] + [JsonSerializable(typeof(StructWithCustomConverter))] + [JsonSerializable(typeof(ClassWithCustomConverterFactory))] + [JsonSerializable(typeof(StructWithCustomConverterFactory))] + [JsonSerializable(typeof(ClassWithCustomConverterProperty))] + [JsonSerializable(typeof(StructWithCustomConverterProperty))] + [JsonSerializable(typeof(ClassWithCustomConverterFactoryProperty))] + [JsonSerializable(typeof(StructWithCustomConverterFactoryProperty))] + [JsonSerializable(typeof(ClassWithBadCustomConverter))] + [JsonSerializable(typeof(StructWithBadCustomConverter))] internal partial class MetadataContext : JsonSerializerContext, ITestContext + { + public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Metadata; + } + + [JsonConverter(typeof(JsonStringEnumConverter))] + public enum EnumWrittenAsString + { + A = 1 + } + + [JsonSerializable(typeof(EnumWrittenAsString))] + public partial class ContextWithExplicitStringEnum : JsonSerializerContext + { + } + + public class PocoWithEnum + { + public EnumWrittenAsString MyEnum { get; set; } + } + + [JsonSerializable(typeof(PocoWithEnum))] + public partial class ContextWithImplicitStringEnum : JsonSerializerContext { } @@ -90,26 +153,77 @@ public sealed class MetadataContextTests : RealWorldContextTests [Fact] public override void EnsureFastPathGeneratedAsExpected() { - Assert.Null(MetadataContext.Default.Location.Serialize); - Assert.Null(MetadataContext.Default.RepeatedLocation.Serialize); - Assert.Null(MetadataContext.Default.NumberTypes.Serialize); - Assert.Null(MetadataContext.Default.ActiveOrUpcomingEvent.Serialize); - Assert.Null(MetadataContext.Default.CampaignSummaryViewModel.Serialize); - Assert.Null(MetadataContext.Default.IndexViewModel.Serialize); - Assert.Null(MetadataContext.Default.WeatherForecastWithPOCOs.Serialize); - Assert.Null(MetadataContext.Default.EmptyPoco.Serialize); - Assert.Null(MetadataContext.Default.HighLowTemps.Serialize); - Assert.Null(MetadataContext.Default.MyType.Serialize); - Assert.Null(MetadataContext.Default.MyType2.Serialize); - Assert.Null(MetadataContext.Default.MyTypeWithCallbacks.Serialize); - Assert.Null(MetadataContext.Default.MyTypeWithPropertyOrdering.Serialize); - Assert.Null(MetadataContext.Default.MyIntermediateType.Serialize); - Assert.Null(MetadataContext.Default.HighLowTempsImmutable.Serialize); - Assert.Null(MetadataContext.Default.MyNestedClass.Serialize); - Assert.Null(MetadataContext.Default.MyNestedNestedClass.Serialize); - Assert.Null(MetadataContext.Default.ObjectArray.Serialize); - Assert.Null(MetadataContext.Default.String.Serialize); - Assert.Null(MetadataContext.Default.ClassWithEnumAndNullable.Serialize); + Assert.Null(MetadataContext.Default.Location.SerializeHandler); + Assert.Null(MetadataContext.Default.RepeatedLocation.SerializeHandler); + Assert.Null(MetadataContext.Default.NumberTypes.SerializeHandler); + Assert.Null(MetadataContext.Default.ActiveOrUpcomingEvent.SerializeHandler); + Assert.Null(MetadataContext.Default.CampaignSummaryViewModel.SerializeHandler); + Assert.Null(MetadataContext.Default.IndexViewModel.SerializeHandler); + Assert.Null(MetadataContext.Default.WeatherForecastWithPOCOs.SerializeHandler); + Assert.Null(MetadataContext.Default.EmptyPoco.SerializeHandler); + Assert.Null(MetadataContext.Default.HighLowTemps.SerializeHandler); + Assert.Null(MetadataContext.Default.MyType.SerializeHandler); + Assert.Null(MetadataContext.Default.MyType2.SerializeHandler); + Assert.Null(MetadataContext.Default.MyTypeWithCallbacks.SerializeHandler); + Assert.Null(MetadataContext.Default.MyTypeWithPropertyOrdering.SerializeHandler); + Assert.Null(MetadataContext.Default.MyIntermediateType.SerializeHandler); + Assert.Null(MetadataContext.Default.HighLowTempsImmutable.SerializeHandler); + Assert.Null(MetadataContext.Default.MyNestedClass.SerializeHandler); + Assert.Null(MetadataContext.Default.MyNestedNestedClass.SerializeHandler); + Assert.Null(MetadataContext.Default.ObjectArray.SerializeHandler); + Assert.Null(MetadataContext.Default.ByteArray.SerializeHandler); + Assert.Null(MetadataContext.Default.SampleEnum.SerializeHandler); + Assert.Null(MetadataContext.Default.String.SerializeHandler); + Assert.Null(MetadataContext.Default.ValueTupleStringInt32Boolean.SerializeHandler); + Assert.Null(MetadataContext.Default.ClassWithEnumAndNullable.SerializeHandler); + Assert.Null(MetadataContext.Default.ClassWithNullableProperties.SerializeHandler); + Assert.Null(MetadataContext.Default.ClassWithCustomConverter.SerializeHandler); + Assert.Null(MetadataContext.Default.StructWithCustomConverter.SerializeHandler); + Assert.Null(MetadataContext.Default.ClassWithCustomConverterFactory.SerializeHandler); + Assert.Null(MetadataContext.Default.StructWithCustomConverterFactory.SerializeHandler); + Assert.Null(MetadataContext.Default.ClassWithCustomConverterProperty.SerializeHandler); + Assert.Null(MetadataContext.Default.StructWithCustomConverterProperty.SerializeHandler); + Assert.Null(MetadataContext.Default.ClassWithCustomConverterFactoryProperty.SerializeHandler); + Assert.Null(MetadataContext.Default.StructWithCustomConverterFactoryProperty.SerializeHandler); + Assert.Throws(() => MetadataContext.Default.ClassWithBadCustomConverter.SerializeHandler); + Assert.Throws(() => MetadataContext.Default.StructWithBadCustomConverter.SerializeHandler); + } + + [Fact] + public void EnsureHelperMethodGenerated_TypeFactory() + { + // There are 2 helper methods generated for obtaining a converter from a factory: + // - JsonConverter version that is property-based (that calls the one below) + // - JsonConverter version that is Type-based + // and this test verifies the latter one is generated. Other tests also have property-level + // factories and thus verify both are created. + + const string Json = "\"A\""; + + EnumWrittenAsString obj = EnumWrittenAsString.A; + + string json = JsonSerializer.Serialize(obj, ContextWithExplicitStringEnum.Default.EnumWrittenAsString); + Assert.Equal(Json, json); + + obj = JsonSerializer.Deserialize(Json, ContextWithExplicitStringEnum.Default.EnumWrittenAsString); + Assert.Equal(EnumWrittenAsString.A, obj); + } + + [Fact] + public void EnsureHelperMethodGenerated_ImplicitPropertyFactory() + { + // ContextWithImplicitStringEnum does not have an entry for EnumWrittenAsString since it is + // implictly added by PocoWithEnum. Verify helper methods are still being created properly. + + const string Json = "{\"MyEnum\":\"A\"}"; + + PocoWithEnum obj = new() { MyEnum = EnumWrittenAsString.A }; + + string json = JsonSerializer.Serialize(obj, ContextWithImplicitStringEnum.Default.PocoWithEnum); + Assert.Equal(Json, json); + + obj = JsonSerializer.Deserialize(Json, ContextWithImplicitStringEnum.Default.PocoWithEnum); + Assert.Equal(EnumWrittenAsString.A, obj.MyEnum); } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MixedModeContextTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MixedModeContextTests.cs index 64371e837de2ab..afdb3f93184193 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MixedModeContextTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MixedModeContextTests.cs @@ -6,6 +6,7 @@ namespace System.Text.Json.SourceGeneration.Tests { + [JsonSourceGenerationOptions(IncludeFields = true)] [JsonSerializable(typeof(Location), GenerationMode = JsonSourceGenerationMode.Metadata)] [JsonSerializable(typeof(RepeatedTypes.Location), TypeInfoPropertyName = "RepeatedLocation", GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(NumberTypes), GenerationMode = JsonSourceGenerationMode.Metadata)] @@ -24,10 +25,24 @@ namespace System.Text.Json.SourceGeneration.Tests [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass.MyNestedNestedClass), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(object[]), GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(byte[]), GenerationMode = JsonSourceGenerationMode.Metadata)] [JsonSerializable(typeof(string), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof((string Label1, int Label2, bool)), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(RealWorldContextTests.ClassWithEnumAndNullable), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(RealWorldContextTests.ClassWithNullableProperties), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverter), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverter), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverterFactory), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverterFactory), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverterProperty), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverterProperty), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverterFactoryProperty), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverterFactoryProperty), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithBadCustomConverter), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithBadCustomConverter), GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] internal partial class MixedModeContext : JsonSerializerContext, ITestContext { + public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization; } public sealed class MixedModeContextTests : RealWorldContextTests @@ -37,25 +52,39 @@ public sealed class MixedModeContextTests : RealWorldContextTests [Fact] public override void EnsureFastPathGeneratedAsExpected() { - Assert.Null(MixedModeContext.Default.Location.Serialize); - Assert.NotNull(MixedModeContext.Default.RepeatedLocation.Serialize); - Assert.Null(MixedModeContext.Default.NumberTypes.Serialize); - Assert.NotNull(MixedModeContext.Default.CampaignSummaryViewModel.Serialize); - Assert.Null(MixedModeContext.Default.IndexViewModel.Serialize); - Assert.Null(MixedModeContext.Default.WeatherForecastWithPOCOs.Serialize); - Assert.NotNull(MixedModeContext.Default.EmptyPoco.Serialize); - Assert.NotNull(MixedModeContext.Default.HighLowTemps.Serialize); - Assert.NotNull(MixedModeContext.Default.MyType.Serialize); - Assert.NotNull(MixedModeContext.Default.MyType2.Serialize); - Assert.NotNull(MixedModeContext.Default.MyTypeWithCallbacks.Serialize); - Assert.NotNull(MixedModeContext.Default.MyTypeWithPropertyOrdering.Serialize); - Assert.NotNull(MixedModeContext.Default.MyIntermediateType.Serialize); - Assert.Null(MixedModeContext.Default.HighLowTempsImmutable.Serialize); - Assert.NotNull(MixedModeContext.Default.MyNestedClass.Serialize); - Assert.NotNull(MixedModeContext.Default.MyNestedNestedClass.Serialize); - Assert.Null(MixedModeContext.Default.ObjectArray.Serialize); - Assert.Null(MixedModeContext.Default.String.Serialize); - Assert.NotNull(MixedModeContext.Default.ClassWithEnumAndNullable.Serialize); + Assert.Null(MixedModeContext.Default.Location.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.RepeatedLocation.SerializeHandler); + Assert.Null(MixedModeContext.Default.NumberTypes.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.CampaignSummaryViewModel.SerializeHandler); + Assert.Null(MixedModeContext.Default.IndexViewModel.SerializeHandler); + Assert.Null(MixedModeContext.Default.WeatherForecastWithPOCOs.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.EmptyPoco.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.HighLowTemps.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.MyType.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.MyType2.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.MyTypeWithCallbacks.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.MyTypeWithPropertyOrdering.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.MyIntermediateType.SerializeHandler); + Assert.Null(MixedModeContext.Default.HighLowTempsImmutable.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.MyNestedClass.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.MyNestedNestedClass.SerializeHandler); + Assert.Null(MixedModeContext.Default.ObjectArray.SerializeHandler); + Assert.Null(MixedModeContext.Default.ByteArray.SerializeHandler); + Assert.Null(MixedModeContext.Default.SampleEnum.SerializeHandler); + Assert.Null(MixedModeContext.Default.String.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.ValueTupleStringInt32Boolean.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.ClassWithEnumAndNullable.SerializeHandler); + Assert.NotNull(MixedModeContext.Default.ClassWithNullableProperties.SerializeHandler); + Assert.Null(MixedModeContext.Default.ClassWithCustomConverter.SerializeHandler); + Assert.Null(MixedModeContext.Default.StructWithCustomConverter.SerializeHandler); + Assert.Null(MixedModeContext.Default.ClassWithCustomConverterFactory.SerializeHandler); + Assert.Null(MixedModeContext.Default.StructWithCustomConverterFactory.SerializeHandler); + Assert.Null(MixedModeContext.Default.ClassWithCustomConverterProperty.SerializeHandler); + Assert.Null(MixedModeContext.Default.StructWithCustomConverterProperty.SerializeHandler); + Assert.Null(MixedModeContext.Default.ClassWithCustomConverterFactoryProperty.SerializeHandler); + Assert.Null(MixedModeContext.Default.StructWithCustomConverterFactoryProperty.SerializeHandler); + Assert.Throws(() => MixedModeContext.Default.ClassWithBadCustomConverter.SerializeHandler); + Assert.Throws(() => MixedModeContext.Default.StructWithBadCustomConverter.SerializeHandler); } [Fact] diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/NETStandardContextTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/NETStandardContextTests.cs new file mode 100644 index 00000000000000..557473b603b7de --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/NETStandardContextTests.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.Generic; +using System.IO; +using System.Linq; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Metadata; +using Xunit; + +namespace System.Text.Json.SourceGeneration.Tests.NETStandard +{ + public class NETStandardContextTests + { + /// + /// Tests that we can serialize and deserialize a type defined in a NETStandard assembly. + /// This tests an issue where we were emitting source-gen logic that caused the compiler + /// to emit a reference to an internal definition of IsExternalInit that was missing + /// on later versions of .NET (since it was defined by the framework). + /// + [Fact] + public void RoundTripNETStandardDefinedSourceGenType() + { + MyPoco expected = new MyPoco() { Value = "Hello from NETStandard type."}; + + string json = JsonSerializer.Serialize(expected, NETStandardSerializerContext.Default.MyPoco); + MyPoco actual = JsonSerializer.Deserialize(json, NETStandardSerializerContext.Default.MyPoco); + Assert.Equal(expected.Value, actual.Value); + } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/RealWorldContextTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/RealWorldContextTests.cs index ca941bea915903..1e2a9e5fe6be45 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/RealWorldContextTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/RealWorldContextTests.cs @@ -1,4 +1,4 @@ -// 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.Collections.Generic; @@ -6,6 +6,7 @@ using System.Linq; using System.Text.Json.Serialization; using System.Text.Json.Serialization.Metadata; +using System.Text.Json.Serialization.Tests; using Xunit; namespace System.Text.Json.SourceGeneration.Tests @@ -110,6 +111,222 @@ public virtual void RoundTripTypeNameClash() VerifyRepeatedLocation(expected, obj); } + [Fact] + public virtual void RoundTripValueTuple() + { + bool isIncludeFieldsEnabled = DefaultContext.IsIncludeFieldsEnabled; + + var tuple = (Label1: "string", Label2: 42, true); + string expectedJson = isIncludeFieldsEnabled + ? "{\"Item1\":\"string\",\"Item2\":42,\"Item3\":true}" + : "{}"; + + string json = JsonSerializer.Serialize(tuple, DefaultContext.ValueTupleStringInt32Boolean); + Assert.Equal(expectedJson, json); + + if (DefaultContext.JsonSourceGenerationMode == JsonSourceGenerationMode.Serialization) + { + // Deserialization not supported in fast path serialization only mode + Assert.Throws(() => JsonSerializer.Deserialize(json, DefaultContext.ValueTupleStringInt32Boolean)); + } + else + { + var deserializedTuple = JsonSerializer.Deserialize(json, DefaultContext.ValueTupleStringInt32Boolean); + Assert.Equal(isIncludeFieldsEnabled ? tuple : default, deserializedTuple); + } + } + + [Fact] + public virtual void RoundTripWithCustomConverter_Class() + { + const string Json = "{\"MyInt\":142}"; + + ClassWithCustomConverter obj = new ClassWithCustomConverter() + { + MyInt = 42 + }; + + string json = JsonSerializer.Serialize(obj, DefaultContext.ClassWithCustomConverter); + Assert.Equal(Json, json); + + obj = JsonSerializer.Deserialize(Json, DefaultContext.ClassWithCustomConverter); + Assert.Equal(42, obj.MyInt); + } + + [Fact] + public virtual void RoundTripWithCustomConverterFactory_Class() + { + const string Json = "{\"MyInt\":142}"; + + ClassWithCustomConverterFactory obj = new() + { + MyInt = 42 + }; + + string json = JsonSerializer.Serialize(obj, DefaultContext.ClassWithCustomConverterFactory); + Assert.Equal(Json, json); + + obj = JsonSerializer.Deserialize(Json, DefaultContext.ClassWithCustomConverterFactory); + Assert.Equal(42, obj.MyInt); + } + + [Fact] + public virtual void RoundTripWithCustomConverter_Struct() + { + const string Json = "{\"MyInt\":142}"; + + StructWithCustomConverter obj = new StructWithCustomConverter() + { + MyInt = 42 + }; + + string json = JsonSerializer.Serialize(obj, DefaultContext.StructWithCustomConverter); + Assert.Equal(Json, json); + + obj = JsonSerializer.Deserialize(Json, DefaultContext.StructWithCustomConverter); + Assert.Equal(42, obj.MyInt); + } + + [Fact] + public virtual void RoundtripWithCustomConverterProperty_Class() + { + const string ExpectedJson = "{\"Property\":42}"; + + ClassWithCustomConverterProperty obj = new() + { + Property = new ClassWithCustomConverterProperty.NestedPoco { Value = 42 } + }; + + // Types with properties in custom converters do not support fast path serialization. + Assert.True(DefaultContext.ClassWithCustomConverterProperty.SerializeHandler is null); + + if (DefaultContext.JsonSourceGenerationMode == JsonSourceGenerationMode.Serialization) + { + Assert.Throws(() => JsonSerializer.Serialize(obj, DefaultContext.ClassWithCustomConverterProperty)); + } + else + { + string json = JsonSerializer.Serialize(obj, DefaultContext.ClassWithCustomConverterProperty); + Assert.Equal(ExpectedJson, json); + } + + obj = JsonSerializer.Deserialize(ExpectedJson); + Assert.Equal(42, obj.Property.Value); + } + + [Fact] + public virtual void RoundtripWithCustomConverterProperty_Struct() + { + const string ExpectedJson = "{\"Property\":42}"; + + StructWithCustomConverterProperty obj = new() + { + Property = new ClassWithCustomConverterProperty.NestedPoco { Value = 42 } + }; + + // Types with properties in custom converters do not support fast path serialization. + Assert.True(DefaultContext.StructWithCustomConverterProperty.SerializeHandler is null); + + if (DefaultContext.JsonSourceGenerationMode == JsonSourceGenerationMode.Serialization) + { + Assert.Throws(() => JsonSerializer.Serialize(obj, DefaultContext.StructWithCustomConverterProperty)); + } + else + { + string json = JsonSerializer.Serialize(obj, DefaultContext.StructWithCustomConverterProperty); + Assert.Equal(ExpectedJson, json); + } + + obj = JsonSerializer.Deserialize(ExpectedJson); + Assert.Equal(42, obj.Property.Value); + } + + [Fact] + public virtual void RoundTripWithCustomPropertyConverterFactory_Class() + { + const string Json = "{\"MyEnum\":\"One\"}"; + + ClassWithCustomConverterFactoryProperty obj = new() + { + MyEnum = SampleEnum.One + }; + + if (DefaultContext.JsonSourceGenerationMode == JsonSourceGenerationMode.Serialization) + { + Assert.Throws(() => JsonSerializer.Serialize(obj, DefaultContext.ClassWithCustomConverterFactoryProperty)); + } + else + { + string json = JsonSerializer.Serialize(obj, DefaultContext.ClassWithCustomConverterFactoryProperty); + Assert.Equal(Json, json); + } + + if (DefaultContext.JsonSourceGenerationMode == JsonSourceGenerationMode.Serialization) + { + Assert.Throws(() => JsonSerializer.Serialize(obj, DefaultContext.ClassWithCustomConverterFactoryProperty)); + } + else + { + obj = JsonSerializer.Deserialize(Json, DefaultContext.ClassWithCustomConverterFactoryProperty); + Assert.Equal(SampleEnum.One, obj.MyEnum); + } + } + + [Fact] + public virtual void RoundTripWithCustomPropertyConverterFactory_Struct() + { + const string Json = "{\"MyEnum\":\"One\"}"; + + StructWithCustomConverterFactoryProperty obj = new() + { + MyEnum = SampleEnum.One + }; + + if (DefaultContext.JsonSourceGenerationMode == JsonSourceGenerationMode.Serialization) + { + Assert.Throws(() => JsonSerializer.Serialize(obj, DefaultContext.StructWithCustomConverterFactoryProperty)); + } + else + { + string json = JsonSerializer.Serialize(obj, DefaultContext.StructWithCustomConverterFactoryProperty); + Assert.Equal(Json, json); + } + + if (DefaultContext.JsonSourceGenerationMode == JsonSourceGenerationMode.Serialization) + { + Assert.Throws(() => JsonSerializer.Serialize(obj, DefaultContext.StructWithCustomConverterFactoryProperty)); + } + else + { + obj = JsonSerializer.Deserialize(Json, DefaultContext.StructWithCustomConverterFactoryProperty); + Assert.Equal(SampleEnum.One, obj.MyEnum); + } + } + + [Fact] + public virtual void BadCustomConverter_Class() + { + const string Json = "{\"MyInt\":142}"; + + Assert.Throws(() => + JsonSerializer.Serialize(new ClassWithBadCustomConverter(), DefaultContext.ClassWithBadCustomConverter)); + + Assert.Throws(() => + JsonSerializer.Deserialize(Json, DefaultContext.ClassWithBadCustomConverter)); + } + + [Fact] + public virtual void BadCustomConverter_Struct() + { + const string Json = "{\"MyInt\":142}"; + + Assert.Throws(() => + JsonSerializer.Serialize(new StructWithBadCustomConverter(), DefaultContext.StructWithBadCustomConverter)); + + Assert.Throws(() => + JsonSerializer.Deserialize(Json, DefaultContext.StructWithBadCustomConverter)); + } + protected static Location CreateLocation() { return new Location @@ -182,7 +399,8 @@ protected static ActiveOrUpcomingEvent CreateActiveOrUpcomingEvent() EndDate = DateTime.UtcNow.AddYears(1), Name = "Just a name", ImageUrl = "https://www.dotnetfoundation.org/theme/img/carousel/foundation-diagram-content.png", - StartDate = DateTime.UtcNow + StartDate = DateTime.UtcNow, + Offset = TimeSpan.FromHours(2) }; } @@ -196,6 +414,7 @@ protected static void VerifyActiveOrUpcomingEvent(ActiveOrUpcomingEvent expected Assert.Equal(expected.ImageUrl, obj.ImageUrl); Assert.Equal(expected.Name, obj.Name); Assert.Equal(expected.StartDate, obj.StartDate); + Assert.Equal(expected.Offset, obj.Offset); } protected static CampaignSummaryViewModel CreateCampaignSummaryViewModel() @@ -422,6 +641,19 @@ public virtual void SerializeObjectArray_SimpleTypes_WithCustomOptions() Assert.Equal("\"World\"", world.GetRawText()); } + [Fact] + public virtual void SerializeByteArray() + { + byte[] value = new byte[] { 1, 2, 3 }; + const string expectedJson = "\"AQID\""; + + string actualJson = JsonSerializer.Serialize(value, DefaultContext.ByteArray); + Assert.Equal(expectedJson, actualJson); + + byte[] arr = JsonSerializer.Deserialize(actualJson, DefaultContext.ByteArray); + Assert.Equal(value, arr); + } + [Fact] public virtual void HandlesNestedTypes() { @@ -517,6 +749,62 @@ public class ClassWithEnumAndNullable public DayOfWeek? NullableDay { get; set; } } + [Fact] + public virtual void ClassWithNullableProperties_Roundtrip() + { + RunTest(new ClassWithNullableProperties + { + Uri = new Uri("http://contoso.com"), + Array = new int[] { 42 }, + Poco = new ClassWithNullableProperties.MyPoco(), + + NullableUri = new Uri("http://contoso.com"), + NullableArray = new int[] { 42 }, + NullablePoco = new ClassWithNullableProperties.MyPoco() + }); + + RunTest(new ClassWithNullableProperties()); + + void RunTest(ClassWithNullableProperties expected) + { + string json = JsonSerializer.Serialize(expected, DefaultContext.ClassWithNullableProperties); + ClassWithNullableProperties actual = JsonSerializer.Deserialize(json, DefaultContext.ClassWithNullableProperties); + + Assert.Equal(expected.Uri, actual.Uri); + Assert.Equal(expected.Array, actual.Array); + Assert.Equal(expected.Poco, actual.Poco); + + Assert.Equal(expected.NullableUri, actual.NullableUri); + Assert.Equal(expected.NullableArray, actual.NullableArray); + Assert.Equal(expected.NullablePoco, actual.NullablePoco); + + Assert.Equal(expected.NullableUriParameter, actual.NullableUriParameter); + Assert.Equal(expected.NullableArrayParameter, actual.NullableArrayParameter); + Assert.Equal(expected.NullablePocoParameter, actual.NullablePocoParameter); + } + } + + public class ClassWithNullableProperties + { + public Uri Uri { get; set; } + public int[] Array { get; set; } + public MyPoco Poco { get; set; } + + public Uri? NullableUri { get; set; } + public int[]? NullableArray { get; set; } + public MyPoco? NullablePoco { get; set; } + + // struct types containing nullable reference types as generic parameters + public GenericStruct NullableUriParameter { get; set; } + public GenericStruct NullableArrayParameter { get; set; } + public GenericStruct NullablePocoParameter { get; set; } + + public (string? x, int y)? NullableArgumentOfNullableStruct { get; set; } + + public record MyPoco { } + public struct GenericStruct { } + } + private const string ExceptionMessageFromCustomContext = "Exception thrown from custom context."; [Fact] @@ -540,13 +828,15 @@ public void GetTypeInfoCalledDuringPolymorphicSerialization() internal class CustomContext : JsonSerializerContext { - public CustomContext(JsonSerializerOptions options) : base(options, null) { } + public CustomContext(JsonSerializerOptions options) : base(options) { } private JsonTypeInfo _object; public JsonTypeInfo Object => _object ??= JsonMetadataServices.CreateValueInfo(Options, JsonMetadataServices.ObjectConverter); private JsonTypeInfo _objectArray; - public JsonTypeInfo ObjectArray => _objectArray ??= JsonMetadataServices.CreateArrayInfo(Options, Object, default, serializeFunc: null); + public JsonTypeInfo ObjectArray => _objectArray ??= JsonMetadataServices.CreateArrayInfo(Options, new JsonCollectionInfoValues { ElementInfo = Object }); + + protected override JsonSerializerOptions? GeneratedSerializerOptions => null; public override JsonTypeInfo GetTypeInfo(Type type) { @@ -563,7 +853,7 @@ protected static void AssertFastPathLogicCorrect(string expectedJson, T value { using MemoryStream ms = new(); using Utf8JsonWriter writer = new(ms); - typeInfo.Serialize!(writer, value); + typeInfo.SerializeHandler!(writer, value); writer.Flush(); JsonTestHelper.AssertJsonEqual(expectedJson, Encoding.UTF8.GetString(ms.ToArray())); diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/ConstructorTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/ConstructorTests.cs index 01a7e4d0e39f96..3f65e034f6768e 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/ConstructorTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/ConstructorTests.cs @@ -49,7 +49,7 @@ protected ConstructorTests_Metadata(JsonSerializerWrapperForString stringWrapper [JsonSerializable(typeof(Parameterized_WrapperForICollection))] [JsonSerializable(typeof(Point_2D_Struct))] [JsonSerializable(typeof(Point_2D_Struct_WithAttribute))] - [JsonSerializable(typeof(ClassWithConstructor_SimpleAndComplexParameters))] + [JsonSerializable(typeof(ObjWCtorMixedParams))] [JsonSerializable(typeof(Person_Class))] [JsonSerializable(typeof(Point_2D))] [JsonSerializable(typeof(Point_MultipleMembers_BindTo_OneConstructorParameter))] @@ -123,6 +123,14 @@ protected ConstructorTests_Metadata(JsonSerializerWrapperForString stringWrapper [JsonSerializable(typeof(MyRecord))] [JsonSerializable(typeof(AgeRecord))] [JsonSerializable(typeof(JsonElement))] + [JsonSerializable(typeof(Parameterized_Class_With_ComplexTuple))] + [JsonSerializable(typeof(Parameterized_Person_Simple))] + [JsonSerializable(typeof(SmallType_IgnoredProp_Bind_ParamWithDefaultValue))] + [JsonSerializable(typeof(SmallType_IgnoredProp_Bind_Param))] + [JsonSerializable(typeof(LargeType_IgnoredProp_Bind_ParamWithDefaultValue))] + [JsonSerializable(typeof(LargeType_IgnoredProp_Bind_Param))] + [JsonSerializable(typeof(ClassWithIgnoredSameType))] + [JsonSerializable(typeof(ClassWithDefaultCtorParams))] internal sealed partial class ConstructorTestsContext_Metadata : JsonSerializerContext { } @@ -163,7 +171,7 @@ public ConstructorTests_Default() [JsonSerializable(typeof(Parameterized_WrapperForICollection))] [JsonSerializable(typeof(Point_2D_Struct))] [JsonSerializable(typeof(Point_2D_Struct_WithAttribute))] - [JsonSerializable(typeof(ClassWithConstructor_SimpleAndComplexParameters))] + [JsonSerializable(typeof(ObjWCtorMixedParams))] [JsonSerializable(typeof(Person_Class))] [JsonSerializable(typeof(Point_2D))] [JsonSerializable(typeof(Point_MultipleMembers_BindTo_OneConstructorParameter))] @@ -237,6 +245,14 @@ public ConstructorTests_Default() [JsonSerializable(typeof(MyRecord))] [JsonSerializable(typeof(AgeRecord))] [JsonSerializable(typeof(JsonElement))] + [JsonSerializable(typeof(Parameterized_Class_With_ComplexTuple))] + [JsonSerializable(typeof(Parameterized_Person_Simple))] + [JsonSerializable(typeof(SmallType_IgnoredProp_Bind_ParamWithDefaultValue))] + [JsonSerializable(typeof(SmallType_IgnoredProp_Bind_Param))] + [JsonSerializable(typeof(LargeType_IgnoredProp_Bind_ParamWithDefaultValue))] + [JsonSerializable(typeof(LargeType_IgnoredProp_Bind_Param))] + [JsonSerializable(typeof(ClassWithIgnoredSameType))] + [JsonSerializable(typeof(ClassWithDefaultCtorParams))] internal sealed partial class ConstructorTestsContext_Default : JsonSerializerContext { } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/ExtensionDataTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/ExtensionDataTests.cs new file mode 100644 index 00000000000000..22b67e71fe800a --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/ExtensionDataTests.cs @@ -0,0 +1,131 @@ +//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.Generic; +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Tests; + +namespace System.Text.Json.SourceGeneration.Tests +{ + public sealed partial class ExtensionDataTests_Metadata : ExtensionDataTests + { + public ExtensionDataTests_Metadata() + : base(new StringSerializerWrapper(ExtensionDataTestsContext_Metadata.Default, (options) => new ExtensionDataTestsContext_Metadata(options))) + { + } + + [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(ClassWithEmptyPropertyNameAndExtensionProperty))] + [JsonSerializable(typeof(EmptyClassWithExtensionProperty))] + [JsonSerializable(typeof(ClassWithExtensionProperty))] + [JsonSerializable(typeof(ClassWithExtensionField))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsObject))] + [JsonSerializable(typeof(ClassWithIgnoredData))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(CustomOverflowDictionary))] + [JsonSerializable(typeof(CustomOverflowDictionary))] + [JsonSerializable(typeof(ExtensionDataTests))] + [JsonSerializable(typeof(DictionaryOverflowConverter))] + [JsonSerializable(typeof(JsonElementOverflowConverter))] + [JsonSerializable(typeof(CustomObjectDictionaryOverflowConverter))] + [JsonSerializable(typeof(CustomJsonElementDictionaryOverflowConverter))] + [JsonSerializable(typeof(ClassWithExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithJsonElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithCustomElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithCustomJsonElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(CustomOverflowDictionary))] + [JsonSerializable(typeof(CustomOverflowDictionary))] + [JsonSerializable(typeof(ClassWithExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithJsonElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithCustomElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithCustomJsonElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAlreadyInstantiated))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsObjectAndNameProperty))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsJsonObject))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsJsonElement))] + [JsonSerializable(typeof(ClassWithReference))] + [JsonSerializable(typeof(ParentClassWithObject))] + [JsonSerializable(typeof(ParentClassWithJsonElement))] + [JsonSerializable(typeof(ClassWithMultipleDictionaries))] + [JsonSerializable(typeof(ClassWithEscapedProperty))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsImmutable))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsImmutableJsonElement))] + [JsonSerializable(typeof(ClassWithExtensionPropertyPrivateConstructor))] + [JsonSerializable(typeof(ClassWithExtensionPropertyPrivateConstructorJsonElement))] + [JsonSerializable(typeof(ClassWithExtensionPropertyNoGenericParameters))] + [JsonSerializable(typeof(ClassWithExtensionPropertyOneGenericParameter))] + [JsonSerializable(typeof(ClassWithExtensionPropertyThreeGenericParameters))] + [JsonSerializable(typeof(JsonElement))] + [JsonSerializable(typeof(ClassWithExtensionData))] + [JsonSerializable(typeof(int))] + [JsonSerializable(typeof(DummyObj))] + [JsonSerializable(typeof(DummyStruct))] + internal sealed partial class ExtensionDataTestsContext_Metadata : JsonSerializerContext + { + } + } + + public sealed partial class ExtensionDataTests_Default : ExtensionDataTests + { + public ExtensionDataTests_Default() + : base(new StringSerializerWrapper(ExtensionDataTestsContext_Default.Default, (options) => new ExtensionDataTestsContext_Default(options))) + { + } + + [JsonSerializable(typeof(ClassWithEmptyPropertyNameAndExtensionProperty))] + [JsonSerializable(typeof(EmptyClassWithExtensionProperty))] + [JsonSerializable(typeof(ClassWithExtensionProperty))] + [JsonSerializable(typeof(ClassWithExtensionField))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsObject))] + [JsonSerializable(typeof(ClassWithIgnoredData))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(CustomOverflowDictionary))] + [JsonSerializable(typeof(CustomOverflowDictionary))] + [JsonSerializable(typeof(ExtensionDataTests))] + [JsonSerializable(typeof(DictionaryOverflowConverter))] + [JsonSerializable(typeof(JsonElementOverflowConverter))] + [JsonSerializable(typeof(CustomObjectDictionaryOverflowConverter))] + [JsonSerializable(typeof(CustomJsonElementDictionaryOverflowConverter))] + [JsonSerializable(typeof(ClassWithExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithJsonElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithCustomElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithCustomJsonElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(CustomOverflowDictionary))] + [JsonSerializable(typeof(CustomOverflowDictionary))] + [JsonSerializable(typeof(ClassWithExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithJsonElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithCustomElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithCustomJsonElementExtensionDataWithAttributedConverter))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAlreadyInstantiated))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsObjectAndNameProperty))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsJsonObject))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsJsonElement))] + [JsonSerializable(typeof(ClassWithReference))] + [JsonSerializable(typeof(ParentClassWithObject))] + [JsonSerializable(typeof(ParentClassWithJsonElement))] + [JsonSerializable(typeof(ClassWithMultipleDictionaries))] + [JsonSerializable(typeof(ClassWithEscapedProperty))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsImmutable))] + [JsonSerializable(typeof(ClassWithExtensionPropertyAsImmutableJsonElement))] + [JsonSerializable(typeof(ClassWithExtensionPropertyPrivateConstructor))] + [JsonSerializable(typeof(ClassWithExtensionPropertyPrivateConstructorJsonElement))] + [JsonSerializable(typeof(ClassWithExtensionPropertyNoGenericParameters))] + [JsonSerializable(typeof(ClassWithExtensionPropertyOneGenericParameter))] + [JsonSerializable(typeof(ClassWithExtensionPropertyThreeGenericParameters))] + [JsonSerializable(typeof(JsonElement))] + [JsonSerializable(typeof(ClassWithExtensionData))] + [JsonSerializable(typeof(int))] + [JsonSerializable(typeof(DummyObj))] + [JsonSerializable(typeof(DummyStruct))] + internal sealed partial class ExtensionDataTestsContext_Default : JsonSerializerContext + { + } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/NodeInteropTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/NodeInteropTests.cs new file mode 100644 index 00000000000000..4a27daaf2ebc5b --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/NodeInteropTests.cs @@ -0,0 +1,44 @@ +// 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.Generic; +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Tests; +using System.Text.Json.Serialization.Tests.Schemas.OrderPayload; + +namespace System.Text.Json.SourceGeneration.Tests +{ + public sealed partial class NodeInteropTests_Metadata : NodeInteropTests + { + public NodeInteropTests_Metadata() + : base(new StringSerializerWrapper(NodeInteropTestsContext_Metadata.Default, (options) => new NodeInteropTestsContext_Metadata(options))) + { + } + + [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(List))] + [JsonSerializable(typeof(JsonArray))] + [JsonSerializable(typeof(Poco))] + [JsonSerializable(typeof(string))] + internal sealed partial class NodeInteropTestsContext_Metadata : JsonSerializerContext + { + } + } + + public sealed partial class NodeInteropTests_Default : NodeInteropTests + { + public NodeInteropTests_Default() + : base(new StringSerializerWrapper(NodeInteropTestsContext_Default.Default, (options) => new NodeInteropTestsContext_Default(options))) + { + } + + [JsonSerializable(typeof(List))] + [JsonSerializable(typeof(JsonArray))] + [JsonSerializable(typeof(Poco))] + [JsonSerializable(typeof(string))] + internal sealed partial class NodeInteropTestsContext_Default : JsonSerializerContext + { + } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/PropertyNameTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/PropertyNameTests.cs new file mode 100644 index 00000000000000..1beb220396a416 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/PropertyNameTests.cs @@ -0,0 +1,60 @@ +// 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.Generic; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Tests; + +namespace System.Text.Json.SourceGeneration.Tests +{ + public sealed partial class PropertyNameTests_Metadata : PropertyNameTests + { + public PropertyNameTests_Metadata() + : base(new StringSerializerWrapper(PropertyNameTestsContext_Metadata.Default, (options) => new PropertyNameTestsContext_Metadata(options))) + { + } + + [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata)] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(int))] + [JsonSerializable(typeof(ClassWithSpecialCharacters))] + [JsonSerializable(typeof(ClassWithPropertyNamePermutations))] + [JsonSerializable(typeof(ClassWithUnicodeProperty))] + [JsonSerializable(typeof(DuplicatePropertyNameDesignTime_TestClass))] + [JsonSerializable(typeof(EmptyPropertyName_TestClass))] + [JsonSerializable(typeof(IntPropertyNamesDifferentByCaseOnly_TestClass))] + [JsonSerializable(typeof(NullPropertyName_TestClass))] + [JsonSerializable(typeof(ObjectPropertyNamesDifferentByCaseOnly_TestClass))] + [JsonSerializable(typeof(OverridePropertyNameDesignTime_TestClass))] + [JsonSerializable(typeof(SimpleTestClass))] + internal sealed partial class PropertyNameTestsContext_Metadata : JsonSerializerContext + { + } + } + + public sealed partial class PropertyNameTests_Default : PropertyNameTests + { + public PropertyNameTests_Default() + : base(new StringSerializerWrapper(PropertyNameTestsContext_Default.Default, (options) => new PropertyNameTestsContext_Default(options))) + { + } + + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(Dictionary))] + [JsonSerializable(typeof(int))] + [JsonSerializable(typeof(ClassWithSpecialCharacters))] + [JsonSerializable(typeof(ClassWithPropertyNamePermutations))] + [JsonSerializable(typeof(ClassWithUnicodeProperty))] + [JsonSerializable(typeof(DuplicatePropertyNameDesignTime_TestClass))] + [JsonSerializable(typeof(EmptyPropertyName_TestClass))] + [JsonSerializable(typeof(IntPropertyNamesDifferentByCaseOnly_TestClass))] + [JsonSerializable(typeof(NullPropertyName_TestClass))] + [JsonSerializable(typeof(ObjectPropertyNamesDifferentByCaseOnly_TestClass))] + [JsonSerializable(typeof(OverridePropertyNameDesignTime_TestClass))] + [JsonSerializable(typeof(SimpleTestClass))] + internal sealed partial class PropertyNameTestsContext_Default : JsonSerializerContext + { + } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/PropertyVisibilityTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/PropertyVisibilityTests.cs index cc9b3d617107cc..a698165e3f9677 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/PropertyVisibilityTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/PropertyVisibilityTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Reflection; using System.Text.Json.Serialization; using System.Text.Json.Serialization.Tests; using System.Threading.Tasks; @@ -46,17 +47,10 @@ public override async Task Honor_JsonSerializablePropertyAttribute_OnProperties( ""MyUri"":""https://microsoft.com"" }"; - var obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); - Assert.Equal(0, obj.MyInt); // Source gen can't use private setter - Assert.Equal("Hello", obj.MyString); - Assert.Equal(2f, obj.GetMyFloat); - Assert.Equal(new Uri("https://microsoft.com"), obj.MyUri); - - json = await JsonSerializerWrapperForString.SerializeWrapper(obj); - Assert.Contains(@"""MyInt"":0", json); - Assert.Contains(@"""MyString"":""Hello""", json); - Assert.DoesNotContain(@"""MyFloat"":", json); // Source gen can't use private setter - Assert.Contains(@"""MyUri"":""https://microsoft.com""", json); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(json)); + + var obj = new MyClass_WithNonPublicAccessors_WithPropertyAttributes(); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(obj)); } [Theory] @@ -64,12 +58,15 @@ public override async Task Honor_JsonSerializablePropertyAttribute_OnProperties( [InlineData(typeof(StructWithInitOnlyProperty))] public override async Task InitOnlyProperties(Type type) { - // Init-only setters cannot be referenced as get/set helpers in generated code. - object obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""MyInt"":1}", type); - Assert.Equal(0, (int)type.GetProperty("MyInt").GetValue(obj)); + PropertyInfo property = type.GetProperty("MyInt"); // Init-only properties can be serialized. - Assert.Equal(@"{""MyInt"":0}", await JsonSerializerWrapperForString.SerializeWrapper(obj, type)); + object obj = Activator.CreateInstance(type); + property.SetValue(obj, 1); + Assert.Equal(@"{""MyInt"":1}", await JsonSerializerWrapperForString.SerializeWrapper(obj, type)); + + // Deserializing init-only properties is not supported. + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(@"{""MyInt"":1}", type)); } [Theory] @@ -78,12 +75,15 @@ public override async Task InitOnlyProperties(Type type) [InlineData(typeof(Class_PropertyWith_ProtectedInitOnlySetter_WithAttribute))] public override async Task NonPublicInitOnlySetter_With_JsonInclude(Type type) { - // Init-only setters cannot be referenced as get/set helpers in generated code. - object obj = await JsonSerializerWrapperForString.DeserializeWrapper(@"{""MyInt"":1}", type); - Assert.Equal(0, (int)type.GetProperty("MyInt").GetValue(obj)); + PropertyInfo property = type.GetProperty("MyInt"); // Init-only properties can be serialized. - Assert.Equal(@"{""MyInt"":0}", await JsonSerializerWrapperForString.SerializeWrapper(obj, type)); + object obj = Activator.CreateInstance(type); + property.SetValue(obj, 1); + Assert.Equal(@"{""MyInt"":1}", await JsonSerializerWrapperForString.SerializeWrapper(obj, type)); + + // Deserializing init-only properties is not supported. + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(@"{""MyInt"":1}", type)); } [Fact] @@ -94,15 +94,15 @@ public override async Task HonorCustomConverter_UsingPrivateSetter() string json = @"{""MyEnum"":""AnotherValue"",""MyInt"":2}"; - // Deserialization baseline, without enum converter, we get JsonException. + // Deserialization baseline, without enum converter, we get JsonException. NB order of members in deserialized type is significant for this assertion to succeed. await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(json)); - var obj = await JsonSerializerWrapperForString.DeserializeWrapper(json, options); - Assert.Equal(MySmallEnum.AnotherValue, obj.GetMyEnum); - Assert.Equal(0, obj.MyInt); // Private setter can't be used with source-gen. + // JsonInclude not supported in source gen. + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(json, options)); - // ConverterForInt32 throws this exception. - await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(obj, options)); + // JsonInclude on private getters not supported. + var obj = new StructWithPropertiesWithConverter(); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(obj, options)); } [Fact] @@ -116,25 +116,32 @@ public override async Task Public_And_NonPublicPropertyAccessors_PropertyAttribu Assert.Equal(3, obj.Y); Assert.Equal(4, obj.GetZ); - json = await JsonSerializerWrapperForString.SerializeWrapper(obj); - Assert.Contains(@"""W"":1", json); - Assert.Contains(@"""X"":2", json); - Assert.Contains(@"""Y"":3", json); - Assert.DoesNotContain(@"""Z"":", json); // Private setter cannot be used with source gen. + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(obj)); + } + + [Fact] + public override async Task HonorJsonPropertyName_PrivateGetter() + { + string json = @"{""prop1"":1}"; + + var obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); + Assert.Equal(MySmallEnum.AnotherValue, obj.GetProxy()); + + // JsonInclude for private members not supported in source gen + await Assert.ThrowsAsync(async() => await JsonSerializerWrapperForString.SerializeWrapper(obj)); } [Fact] - public override async Task HonorJsonPropertyName() + public override async Task HonorJsonPropertyName_PrivateSetter() { - string json = @"{""prop1"":1,""prop2"":2}"; + string json = @"{""prop2"":2}"; - var obj = await JsonSerializerWrapperForString.DeserializeWrapper(json); - Assert.Equal(MySmallEnum.AnotherValue, obj.GetMyEnum); - Assert.Equal(0, obj.MyInt); // Private setter cannot be used with source gen. + // JsonInclude for private members not supported in source gen + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(json)); - json = await JsonSerializerWrapperForString.SerializeWrapper(obj); - Assert.DoesNotContain(@"""prop1"":", json); // Private getter cannot be used with source gen. - Assert.Contains(@"""prop2"":0", json); + var obj = new StructWithPropertiesWithJsonPropertyName_PrivateSetter(); + obj.SetProxy(2); + Assert.Equal(json, await JsonSerializerWrapperForString.SerializeWrapper(obj)); } [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata)] @@ -161,10 +168,12 @@ public override async Task HonorJsonPropertyName() [JsonSerializable(typeof(StructWithBadIgnoreAttribute))] [JsonSerializable(typeof(Class_PropertyWith_InternalInitOnlySetter))] [JsonSerializable(typeof(Class_PropertyWith_ProtectedInitOnlySetter))] + [JsonSerializable(typeof(ClassWithIgnoredPublicProperty))] [JsonSerializable(typeof(ClassWithIgnoredPublicPropertyAndNewSlotPrivate))] [JsonSerializable(typeof(ClassWithIgnoredPropertyPolicyConflictPublic))] [JsonSerializable(typeof(ClassWithIgnoredPropertyNamingConflictPrivate))] [JsonSerializable(typeof(ClassWithIgnoredNewSlotProperty))] + [JsonSerializable(typeof(ClassWithObsoleteAndIgnoredProperty))] [JsonSerializable(typeof(ClassWithPublicGetterAndPrivateSetter))] [JsonSerializable(typeof(ClassWithInitializedProps))] [JsonSerializable(typeof(ClassWithNewSlotInternalProperty))] @@ -250,9 +259,17 @@ public override async Task HonorJsonPropertyName() [JsonSerializable(typeof(ClassTwiceInheritedWithPropertyPolicyConflictWhichThrows))] [JsonSerializable(typeof(MyClass_WithNonPublicAccessors))] [JsonSerializable(typeof(ClassWithThingsToIgnore_PerProperty))] - [JsonSerializable(typeof(StructWithPropertiesWithJsonPropertyName))] + [JsonSerializable(typeof(StructWithPropertiesWithJsonPropertyName_PrivateGetter))] + [JsonSerializable(typeof(StructWithPropertiesWithJsonPropertyName_PrivateSetter))] [JsonSerializable(typeof(ClassWithValueAndReferenceTypes))] [JsonSerializable(typeof(ClassWithReadOnlyStringProperty_IgnoreWhenWritingDefault))] + [JsonSerializable(typeof(ConcreteDerivedClass))] + [JsonSerializable(typeof(TypeWith_RefStringProp))] + [JsonSerializable(typeof(TypeWith_IgnoredRefStringProp))] + [JsonSerializable(typeof(TypeWith_PropWith_BadConverter))] + [JsonSerializable(typeof(TypeWith_IgnoredPropWith_BadConverter))] + [JsonSerializable(typeof(ClassWithIgnoredCallbacks))] + [JsonSerializable(typeof(ClassWithCallbacks))] internal sealed partial class PropertyVisibilityTestsContext_Metadata : JsonSerializerContext { } @@ -324,10 +341,12 @@ public override async Task JsonIgnoreCondition_WhenWritingNull_OnValueType_Fail_ [JsonSerializable(typeof(StructWithBadIgnoreAttribute))] [JsonSerializable(typeof(Class_PropertyWith_InternalInitOnlySetter))] [JsonSerializable(typeof(Class_PropertyWith_ProtectedInitOnlySetter))] + [JsonSerializable(typeof(ClassWithIgnoredPublicProperty))] [JsonSerializable(typeof(ClassWithIgnoredPublicPropertyAndNewSlotPrivate))] [JsonSerializable(typeof(ClassWithIgnoredPropertyPolicyConflictPublic))] [JsonSerializable(typeof(ClassWithIgnoredPropertyNamingConflictPrivate))] [JsonSerializable(typeof(ClassWithIgnoredNewSlotProperty))] + [JsonSerializable(typeof(ClassWithObsoleteAndIgnoredProperty))] [JsonSerializable(typeof(ClassWithPublicGetterAndPrivateSetter))] [JsonSerializable(typeof(ClassWithInitializedProps))] [JsonSerializable(typeof(ClassWithNewSlotInternalProperty))] @@ -413,9 +432,17 @@ public override async Task JsonIgnoreCondition_WhenWritingNull_OnValueType_Fail_ [JsonSerializable(typeof(ClassTwiceInheritedWithPropertyPolicyConflictWhichThrows))] [JsonSerializable(typeof(MyClass_WithNonPublicAccessors))] [JsonSerializable(typeof(ClassWithThingsToIgnore_PerProperty))] - [JsonSerializable(typeof(StructWithPropertiesWithJsonPropertyName))] + [JsonSerializable(typeof(StructWithPropertiesWithJsonPropertyName_PrivateGetter))] + [JsonSerializable(typeof(StructWithPropertiesWithJsonPropertyName_PrivateSetter))] [JsonSerializable(typeof(ClassWithValueAndReferenceTypes))] [JsonSerializable(typeof(ClassWithReadOnlyStringProperty_IgnoreWhenWritingDefault))] + [JsonSerializable(typeof(ConcreteDerivedClass))] + [JsonSerializable(typeof(TypeWith_RefStringProp))] + [JsonSerializable(typeof(TypeWith_IgnoredRefStringProp))] + [JsonSerializable(typeof(TypeWith_PropWith_BadConverter))] + [JsonSerializable(typeof(TypeWith_IgnoredPropWith_BadConverter))] + [JsonSerializable(typeof(ClassWithIgnoredCallbacks))] + [JsonSerializable(typeof(ClassWithCallbacks))] internal sealed partial class PropertyVisibilityTestsContext_Default : JsonSerializerContext { } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/UnsupportedTypesTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/UnsupportedTypesTests.cs new file mode 100644 index 00000000000000..fbe343eda582ab --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/UnsupportedTypesTests.cs @@ -0,0 +1,94 @@ +// 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.Generic; +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Tests; + +namespace System.Text.Json.SourceGeneration.Tests +{ + public sealed partial class UnsupportedTypesTests_Metadata : UnsupportedTypesTests + { + public UnsupportedTypesTests_Metadata() : base( + new StringSerializerWrapper( + UnsupportedTypesTestsContext_Metadata.Default, + (options) => new UnsupportedTypesTestsContext_Metadata(options)), + supportsJsonPathOnSerialize: true) + { + } + + [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata)] + // Supported types: + [JsonSerializable(typeof(int))] + [JsonSerializable(typeof(ClassWithIntPtrConverter))] + // Unsupported types: + [JsonSerializable(typeof(Type))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(SerializationInfo))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(IntPtr))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(ClassWithIntPtr))] + [JsonSerializable(typeof(IntPtr?))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(UIntPtr))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(IAsyncEnumerable))] + [JsonSerializable(typeof(ClassWithType>))] + [JsonSerializable(typeof(ClassThatImplementsIAsyncEnumerable))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(ClassWithAsyncEnumerableConverter))] + +#if NETCOREAPP + [JsonSerializable(typeof(DateOnly))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(TimeOnly))] + [JsonSerializable(typeof(ClassWithType))] +#endif + internal sealed partial class UnsupportedTypesTestsContext_Metadata : JsonSerializerContext + { + } + } + + public sealed partial class UnsupportedTypesTests_Default : UnsupportedTypesTests + { + public UnsupportedTypesTests_Default() : base( + new StringSerializerWrapper( + UnsupportedTypesTestsContext_Default.Default, + (options) => new UnsupportedTypesTestsContext_Default(options)), + supportsJsonPathOnSerialize: false) + { + } + + // Supported types: + [JsonSerializable(typeof(int))] + [JsonSerializable(typeof(ClassWithIntPtrConverter))] + // Unsupported types: + [JsonSerializable(typeof(Type))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(SerializationInfo))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(IntPtr))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(ClassWithIntPtr))] + [JsonSerializable(typeof(IntPtr?))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(UIntPtr))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(IAsyncEnumerable))] + [JsonSerializable(typeof(ClassWithType>))] + [JsonSerializable(typeof(ClassThatImplementsIAsyncEnumerable))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(ClassWithAsyncEnumerableConverter))] +#if NETCOREAPP + [JsonSerializable(typeof(DateOnly))] + [JsonSerializable(typeof(ClassWithType))] + [JsonSerializable(typeof(TimeOnly))] + [JsonSerializable(typeof(ClassWithType))] +#endif + internal sealed partial class UnsupportedTypesTestsContext_Default : JsonSerializerContext + { + } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationContextTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationContextTests.cs index 799de2b1032108..c658661b7a8c3f 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationContextTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationContextTests.cs @@ -25,10 +25,24 @@ namespace System.Text.Json.SourceGeneration.Tests [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass))] [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass.MyNestedNestedClass))] [JsonSerializable(typeof(object[]))] + [JsonSerializable(typeof(byte[]))] [JsonSerializable(typeof(string))] + [JsonSerializable(typeof((string Label1, int Label2, bool)))] [JsonSerializable(typeof(RealWorldContextTests.ClassWithEnumAndNullable))] + [JsonSerializable(typeof(RealWorldContextTests.ClassWithNullableProperties))] + [JsonSerializable(typeof(ClassWithCustomConverter))] + [JsonSerializable(typeof(StructWithCustomConverter))] + [JsonSerializable(typeof(ClassWithCustomConverterFactory))] + [JsonSerializable(typeof(StructWithCustomConverterFactory))] + [JsonSerializable(typeof(ClassWithCustomConverterProperty))] + [JsonSerializable(typeof(StructWithCustomConverterProperty))] + [JsonSerializable(typeof(ClassWithCustomConverterFactoryProperty))] + [JsonSerializable(typeof(StructWithCustomConverterFactoryProperty))] + [JsonSerializable(typeof(ClassWithBadCustomConverter))] + [JsonSerializable(typeof(StructWithBadCustomConverter))] internal partial class SerializationContext : JsonSerializerContext, ITestContext { + public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Serialization; } [JsonSerializable(typeof(Location), GenerationMode = JsonSourceGenerationMode.Serialization)] @@ -49,13 +63,27 @@ internal partial class SerializationContext : JsonSerializerContext, ITestContex [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass.MyNestedNestedClass), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(object[]), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(byte[]), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(string), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof((string Label1, int Label2, bool)), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(RealWorldContextTests.ClassWithEnumAndNullable), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(RealWorldContextTests.ClassWithNullableProperties), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverter), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverter), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverterFactory), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverterFactory), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverterProperty), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverterProperty), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverterFactoryProperty), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverterFactoryProperty), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithBadCustomConverter), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithBadCustomConverter), GenerationMode = JsonSourceGenerationMode.Serialization)] internal partial class SerializationWithPerTypeAttributeContext : JsonSerializerContext, ITestContext { + public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Serialization; } - [JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)] + [JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, IncludeFields = true)] [JsonSerializable(typeof(Location), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(RepeatedTypes.Location), GenerationMode = JsonSourceGenerationMode.Serialization, TypeInfoPropertyName = "RepeatedLocation")] [JsonSerializable(typeof(NumberTypes), GenerationMode = JsonSourceGenerationMode.Serialization)] @@ -74,10 +102,24 @@ internal partial class SerializationWithPerTypeAttributeContext : JsonSerializer [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(RealWorldContextTests.MyNestedClass.MyNestedNestedClass), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(object[]), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(byte[]), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(string), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof((string Label1, int Label2, bool)), GenerationMode = JsonSourceGenerationMode.Serialization)] [JsonSerializable(typeof(RealWorldContextTests.ClassWithEnumAndNullable), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(RealWorldContextTests.ClassWithNullableProperties), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverter), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverter), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverterFactory), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverterFactory), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverterProperty), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverterProperty), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithCustomConverterFactoryProperty), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithCustomConverterFactoryProperty), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassWithBadCustomConverter), GenerationMode = JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(StructWithBadCustomConverter), GenerationMode = JsonSourceGenerationMode.Serialization)] internal partial class SerializationContextWithCamelCase : JsonSerializerContext, ITestContext { + public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Serialization; } public class SerializationContextTests : RealWorldContextTests @@ -92,26 +134,36 @@ internal SerializationContextTests(ITestContext defaultContext, Func(() => SerializationContext.Default.ClassWithBadCustomConverter.SerializeHandler); + Assert.Throws(() => SerializationContext.Default.StructWithBadCustomConverter.SerializeHandler); } [Fact] @@ -324,6 +376,41 @@ void RunTest(ClassWithEnumAndNullable expected) } } + [Fact] + public override void ClassWithNullableProperties_Roundtrip() + { + RunTest(new ClassWithNullableProperties + { + Uri = new Uri("http://contoso.com"), + Array = new int[] { 42 }, + Poco = new ClassWithNullableProperties.MyPoco(), + + NullableUri = new Uri("http://contoso.com"), + NullableArray = new int[] { 42 }, + NullablePoco = new ClassWithNullableProperties.MyPoco() + }); + + RunTest(new ClassWithNullableProperties()); + + void RunTest(ClassWithNullableProperties expected) + { + string json = JsonSerializer.Serialize(expected, DefaultContext.ClassWithNullableProperties); + ClassWithNullableProperties actual = JsonSerializer.Deserialize(json, ((ITestContext)MetadataWithPerTypeAttributeContext.Default).ClassWithNullableProperties); + + Assert.Equal(expected.Uri, actual.Uri); + Assert.Equal(expected.Array, actual.Array); + Assert.Equal(expected.Poco, actual.Poco); + + Assert.Equal(expected.NullableUri, actual.NullableUri); + Assert.Equal(expected.NullableArray, actual.NullableArray); + Assert.Equal(expected.NullablePoco, actual.NullablePoco); + + Assert.Equal(expected.NullableUriParameter, actual.NullableUriParameter); + Assert.Equal(expected.NullableArrayParameter, actual.NullableArrayParameter); + Assert.Equal(expected.NullablePocoParameter, actual.NullablePocoParameter); + } + } + [Fact] public override void ParameterizedConstructor() { @@ -353,23 +440,36 @@ public sealed class SerializationWithPerTypeAttributeContextTests : Serializatio [Fact] public override void EnsureFastPathGeneratedAsExpected() { - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.Location.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.RepeatedLocation.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.ActiveOrUpcomingEvent.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.CampaignSummaryViewModel.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.IndexViewModel.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.WeatherForecastWithPOCOs.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.WeatherForecastWithPOCOs.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.HighLowTemps.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyType.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyType2.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyIntermediateType.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.HighLowTempsImmutable.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyNestedClass.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyNestedNestedClass.Serialize); - Assert.Null(SerializationWithPerTypeAttributeContext.Default.ObjectArray.Serialize); - Assert.Null(SerializationWithPerTypeAttributeContext.Default.String.Serialize); - Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.ClassWithEnumAndNullable.Serialize); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.Location.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.RepeatedLocation.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.ActiveOrUpcomingEvent.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.CampaignSummaryViewModel.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.IndexViewModel.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.WeatherForecastWithPOCOs.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.WeatherForecastWithPOCOs.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.HighLowTemps.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyType.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyType2.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyIntermediateType.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.HighLowTempsImmutable.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyNestedClass.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.MyNestedNestedClass.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.ObjectArray.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.ByteArray.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.SampleEnum.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.String.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.ValueTupleStringInt32Boolean.SerializeHandler); + Assert.NotNull(SerializationWithPerTypeAttributeContext.Default.ClassWithEnumAndNullable.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.ClassWithCustomConverter.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.StructWithCustomConverter.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.ClassWithCustomConverterFactory.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.StructWithCustomConverterFactory.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.ClassWithCustomConverterProperty.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.StructWithCustomConverterProperty.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.ClassWithCustomConverterFactoryProperty.SerializeHandler); + Assert.Null(SerializationWithPerTypeAttributeContext.Default.StructWithCustomConverterFactoryProperty.SerializeHandler); + Assert.Throws(() => SerializationWithPerTypeAttributeContext.Default.ClassWithBadCustomConverter.SerializeHandler); + Assert.Throws(() => SerializationWithPerTypeAttributeContext.Default.StructWithBadCustomConverter.SerializeHandler); } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationLogicTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationLogicTests.cs index a086659da54779..2bfb07086eecd9 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationLogicTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationLogicTests.cs @@ -52,11 +52,11 @@ public static void SerializationFuncNotInvokedWhenNotSupported(JsonSerializerOpt [Fact] public static void DictionaryFastPathPrimitiveValueSupported() { - Assert.NotNull(DictionaryTypeContext.Default.DictionaryStringString.Serialize); - Assert.NotNull(DictionaryTypeContext.Default.DictionaryStringJsonMessage.Serialize); - Assert.NotNull(DictionaryTypeContext.Default.JsonMessage.Serialize); - Assert.Null(DictionaryTypeContext.Default.String.Serialize); - Assert.Null(DictionaryTypeContext.Default.Int32.Serialize); + Assert.NotNull(DictionaryTypeContext.Default.DictionaryStringString.SerializeHandler); + Assert.NotNull(DictionaryTypeContext.Default.DictionaryStringJsonMessage.SerializeHandler); + Assert.NotNull(DictionaryTypeContext.Default.JsonMessage.SerializeHandler); + Assert.Null(DictionaryTypeContext.Default.String.SerializeHandler); + Assert.Null(DictionaryTypeContext.Default.Int32.SerializeHandler); } // Options with features that apply only to deserialization. diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Roslyn3.11.Tests.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Roslyn3.11.Tests.csproj new file mode 100644 index 00000000000000..8ac0061d4094bf --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Roslyn3.11.Tests.csproj @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Roslyn4.0.Tests.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Roslyn4.0.Tests.csproj new file mode 100644 index 00000000000000..82a98d9773af10 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Roslyn4.0.Tests.csproj @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.targets similarity index 88% rename from src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.csproj rename to src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.targets index 3fe38b92f50848..2f977168e80437 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.csproj +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.targets @@ -1,20 +1,18 @@ - + $(NetCoreAppCurrent);$(NetFrameworkCurrent) true true - $(NoWarn);SYSLIB0020 + + + $(NoWarn);SYSLIB0020;SYSLIB1037;SYSLIB1038 $(DefineConstants);BUILDING_SOURCE_GENERATOR_TESTS - - - - @@ -38,12 +36,16 @@ + + + + @@ -61,20 +63,27 @@ + + + + + + + - + diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/TestClasses.CustomConverters.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/TestClasses.CustomConverters.cs new file mode 100644 index 00000000000000..1fff23f8a6c55c --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/TestClasses.CustomConverters.cs @@ -0,0 +1,271 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Text.Json.Serialization; + +namespace System.Text.Json.SourceGeneration.Tests +{ + /// + /// Custom converter that adds\substract 100 from MyIntProperty. + /// + public class CustomConverter_ClassWithCustomConverter : JsonConverter + { + public override ClassWithCustomConverter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("No StartObject"); + } + + ClassWithCustomConverter obj = new(); + + reader.Read(); + if (reader.TokenType != JsonTokenType.PropertyName && + reader.GetString() != "MyInt") + { + throw new JsonException("Wrong property name"); + } + + reader.Read(); + obj.MyInt = reader.GetInt32() - 100; + + reader.Read(); + if (reader.TokenType != JsonTokenType.EndObject) + { + throw new JsonException("No EndObject"); + } + + return obj; + } + + public override void Write(Utf8JsonWriter writer, ClassWithCustomConverter value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteNumber(nameof(ClassWithCustomConverter.MyInt), value.MyInt + 100); + writer.WriteEndObject(); + } + } + + /// + /// Custom converter that adds\substract 100 from MyIntProperty. + /// + public class CustomConverter_ClassWithCustomConverterFactory : JsonConverter + { + public override ClassWithCustomConverterFactory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("No StartObject"); + } + + ClassWithCustomConverterFactory obj = new(); + + reader.Read(); + if (reader.TokenType != JsonTokenType.PropertyName && + reader.GetString() != "MyInt") + { + throw new JsonException("Wrong property name"); + } + + reader.Read(); + obj.MyInt = reader.GetInt32() - 100; + + reader.Read(); + if (reader.TokenType != JsonTokenType.EndObject) + { + throw new JsonException("No EndObject"); + } + + return obj; + } + + public override void Write(Utf8JsonWriter writer, ClassWithCustomConverterFactory value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteNumber(nameof(ClassWithCustomConverterFactory.MyInt), value.MyInt + 100); + writer.WriteEndObject(); + } + } + + /// + /// Custom converter that adds\substract 100 from MyIntProperty. + /// + public class CustomConverter_StructWithCustomConverter : JsonConverter + { + public override StructWithCustomConverter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("No StartObject"); + } + + StructWithCustomConverter obj = new(); + + reader.Read(); + if (reader.TokenType != JsonTokenType.PropertyName && + reader.GetString() != "MyInt") + { + throw new JsonException("Wrong property name"); + } + + reader.Read(); + obj.MyInt = reader.GetInt32() - 100; + + reader.Read(); + if (reader.TokenType != JsonTokenType.EndObject) + { + throw new JsonException("No EndObject"); + } + + return obj; + } + + public override void Write(Utf8JsonWriter writer, StructWithCustomConverter value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteNumber(nameof(StructWithCustomConverter.MyInt), value.MyInt + 100); + writer.WriteEndObject(); + } + } + + /// + /// Custom converter that adds\substract 100 from MyIntProperty. + /// + public class CustomConverter_StructWithCustomConverterFactory : JsonConverter + { + public override StructWithCustomConverterFactory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("No StartObject"); + } + + StructWithCustomConverterFactory obj = new(); + + reader.Read(); + if (reader.TokenType != JsonTokenType.PropertyName && + reader.GetString() != "MyInt") + { + throw new JsonException("Wrong property name"); + } + + reader.Read(); + obj.MyInt = reader.GetInt32() - 100; + + reader.Read(); + if (reader.TokenType != JsonTokenType.EndObject) + { + throw new JsonException("No EndObject"); + } + + return obj; + } + + public override void Write(Utf8JsonWriter writer, StructWithCustomConverterFactory value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + writer.WriteNumber(nameof(StructWithCustomConverterFactory.MyInt), value.MyInt + 100); + writer.WriteEndObject(); + } + } + + public class CustomConverterFactory : JsonConverterFactory + { + public CustomConverterFactory() + { + } + + public override bool CanConvert(Type typeToConvert) + { + return ( + typeToConvert == typeof(StructWithCustomConverterFactory) || + typeToConvert == typeof(ClassWithCustomConverterFactory)); + } + + public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options) + { + if (typeToConvert == typeof(StructWithCustomConverterFactory)) + { + return new CustomConverter_StructWithCustomConverterFactory(); + } + + if (typeToConvert == typeof(ClassWithCustomConverterFactory)) + { + return new CustomConverter_ClassWithCustomConverterFactory(); + } + + throw new InvalidOperationException("Not expected."); + } + } + + [JsonConverter(typeof(CustomConverter_ClassWithCustomConverter))] + public class ClassWithCustomConverter + { + public int MyInt { get; set; } + } + + [JsonConverter(typeof(CustomConverter_StructWithCustomConverter))] + public struct StructWithCustomConverter + { + public int MyInt { get; set; } + } + + [JsonConverter(typeof(CustomConverterFactory))] + public class ClassWithCustomConverterFactory + { + public int MyInt { get; set; } + } + + [JsonConverter(typeof(CustomConverterFactory))] + public struct StructWithCustomConverterFactory + { + public int MyInt { get; set; } + } + + public class ClassWithCustomConverterProperty + { + [JsonConverter(typeof(NestedPocoCustomConverter))] + public NestedPoco Property { get; set; } + + public class NestedPoco + { + public int Value { get; set; } + } + + public class NestedPocoCustomConverter : JsonConverter + { + public override NestedPoco? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => new NestedPoco { Value = reader.GetInt32() }; + public override void Write(Utf8JsonWriter writer, NestedPoco value, JsonSerializerOptions options) => writer.WriteNumberValue(value.Value); + } + } + + public struct StructWithCustomConverterProperty + { + [JsonConverter(typeof(ClassWithCustomConverterProperty.NestedPocoCustomConverter))] + public ClassWithCustomConverterProperty.NestedPoco Property { get; set; } + } + + public class ClassWithCustomConverterFactoryProperty + { + [JsonConverter(typeof(JsonStringEnumConverter))] // This converter is a JsonConverterFactory + public Serialization.Tests.SampleEnum MyEnum { get; set; } + } + + public struct StructWithCustomConverterFactoryProperty + { + [JsonConverter(typeof(JsonStringEnumConverter))] // This converter is a JsonConverterFactory + public Serialization.Tests.SampleEnum MyEnum { get; set; } + } + + [JsonConverter(typeof(CustomConverter_StructWithCustomConverter))] // Invalid + public class ClassWithBadCustomConverter + { + public int MyInt { get; set; } + } + + [JsonConverter(typeof(CustomConverter_StructWithCustomConverter))] // Invalid + public struct StructWithBadCustomConverter + { + public int MyInt { get; set; } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/TestClasses.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/TestClasses.cs index 887f65b80da83b..d28a73c7b24d55 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/TestClasses.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/TestClasses.cs @@ -60,6 +60,7 @@ public class ActiveOrUpcomingEvent public string Description { get; set; } public DateTimeOffset StartDate { get; set; } public DateTimeOffset EndDate { get; set; } + public TimeSpan Offset { get; set; } } public class CampaignSummaryViewModel diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/CompilationHelper.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs similarity index 61% rename from src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/CompilationHelper.cs rename to src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs index 86a261f284e67a..485a79cd333cd6 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/CompilationHelper.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.Immutable; +using System.Globalization; using System.IO; using System.Linq; using System.Reflection; @@ -16,6 +17,11 @@ namespace System.Text.Json.SourceGeneration.UnitTests { public class CompilationHelper { + private static readonly CSharpParseOptions s_parseOptions = + new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.Parse) + // workaround https://github.com/dotnet/roslyn/pull/55866. We can remove "LangVersion=Preview" when we get a Roslyn build with that change. + .WithLanguageVersion(LanguageVersion.Preview); + public static Compilation CreateCompilation( string source, MetadataReference[] additionalReferences = null, @@ -55,20 +61,30 @@ public static Compilation CreateCompilation( return CSharpCompilation.Create( assemblyName, - syntaxTrees: new[] { CSharpSyntaxTree.ParseText(source) }, + syntaxTrees: new[] { CSharpSyntaxTree.ParseText(source, s_parseOptions) }, references: references.ToArray(), options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary) ); } - private static GeneratorDriver CreateDriver(Compilation compilation, params ISourceGenerator[] generators) - => CSharpGeneratorDriver.Create( - generators: ImmutableArray.Create(generators), - parseOptions: new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.Parse)); - - public static Compilation RunGenerators(Compilation compilation, out ImmutableArray diagnostics, params ISourceGenerator[] generators) + public static Compilation RunGenerators( + Compilation compilation, + out ImmutableArray diagnostics, +#if ROSLYN4_0_OR_GREATER + params IIncrementalGenerator[] generators) + { + CSharpGeneratorDriver driver = CSharpGeneratorDriver.Create( + generators: generators.Select(g => g.AsSourceGenerator()), + parseOptions: s_parseOptions); +#else + params ISourceGenerator[] generators) { - CreateDriver(compilation, generators).RunGeneratorsAndUpdateCompilation(compilation, out Compilation outCompilation, out diagnostics); + CSharpGeneratorDriver driver = CSharpGeneratorDriver.Create( + generators: generators, + parseOptions: s_parseOptions); +#endif + + driver.RunGeneratorsAndUpdateCompilation(compilation, out Compilation outCompilation, out diagnostics); return outCompilation; } @@ -259,15 +275,147 @@ public class Location return CreateCompilation(source); } - internal static void CheckDiagnosticMessages(ImmutableArray diagnostics, DiagnosticSeverity level, string[] expectedMessages) + public static Compilation CreateCompilationWithInitOnlyProperties() + { + string source = @" + using System; + using System.Text.Json.Serialization; + + namespace HelloWorld + { + public class Location + { + public int Id { get; init; } + public string Address1 { get; init; } + public string Address2 { get; init; } + public string City { get; init; } + public string State { get; init; } + public string PostalCode { get; init; } + public string Name { get; init; } + public string PhoneNumber { get; init; } + public string Country { get; init; } + } + + [JsonSerializable(typeof(Location))] + public partial class MyJsonContext : JsonSerializerContext + { + } + }"; + + return CreateCompilation(source); + } + + public static Compilation CreateCompilationWithInaccessibleJsonIncludeProperties() { - string[] actualMessages = diagnostics.Where(diagnostic => diagnostic.Severity == level).Select(diagnostic => diagnostic.GetMessage()).ToArray(); + string source = @" + using System; + using System.Text.Json.Serialization; - // Can't depending on reflection order when generating type metadata. - Array.Sort(actualMessages); - Array.Sort(expectedMessages); + namespace HelloWorld + { + public class Location + { + [JsonInclude] + public int Id { get; private set; } + [JsonInclude] + public string Address1 { get; internal set; } + [JsonInclude] + private string Address2 { get; set; } + [JsonInclude] + public string PhoneNumber { internal get; set; } + [JsonInclude] + public string Country { private get; set; } + } - Assert.Equal(expectedMessages, actualMessages); + [JsonSerializable(typeof(Location))] + public partial class MyJsonContext : JsonSerializerContext + { + } + }"; + + return CreateCompilation(source); + } + + public static Compilation CreateReferencedLibRecordCompilation() + { + string source = @" + using System.Text.Json.Serialization; + + namespace ReferencedAssembly + { + public record LibRecord(int Id) + { + public string Address1 { get; set; } + public string Address2 { get; set; } + public string City { get; set; } + public string State { get; set; } + public string PostalCode { get; set; } + public string Name { get; set; } + [JsonInclude] + public string PhoneNumber; + [JsonInclude] + public string Country; + } + } +"; + + return CreateCompilation(source); + } + + public static Compilation CreateReferencedSimpleLibRecordCompilation() + { + string source = @" + using System.Text.Json.Serialization; + + namespace ReferencedAssembly + { + public record LibRecord + { + public int Id { get; set; } + public string Address1 { get; set; } + public string Address2 { get; set; } + public string City { get; set; } + public string State { get; set; } + public string PostalCode { get; set; } + public string Name { get; set; } + [JsonInclude] + public string PhoneNumber; + [JsonInclude] + public string Country; + } + } +"; + + return CreateCompilation(source); + } + + internal static void CheckDiagnosticMessages( + DiagnosticSeverity level, + ImmutableArray diagnostics, + (Location Location, string Message)[] expectedDiags, + bool sort = true) + { + (Location Location, string Message)[] actualDiags = diagnostics + .Where(diagnostic => diagnostic.Severity == level) + .Select(diagnostic => (diagnostic.Location, diagnostic.GetMessage())) + .ToArray(); + + if (sort) + { + // Can't depend on reflection order when generating type metadata. + Array.Sort(actualDiags); + Array.Sort(expectedDiags); + } + + if (CultureInfo.CurrentUICulture.Name.StartsWith("en", StringComparison.OrdinalIgnoreCase)) + { + Assert.Equal(expectedDiags, actualDiags); + } + else + { + // for non-English runs, just compare the number of messages are the same + Assert.Equal(expectedDiags.Length, actualDiags.Length); + } } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs new file mode 100644 index 00000000000000..1adc0fbec10da4 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs @@ -0,0 +1,259 @@ +// 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.Generic; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; +using Xunit; + +namespace System.Text.Json.SourceGeneration.UnitTests +{ + public class JsonSourceGeneratorDiagnosticsTests + { + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)] + public void SuccessfulSourceGeneration() + { + // Compile the referenced assembly first. + Compilation campaignCompilation = CompilationHelper.CreateCampaignSummaryViewModelCompilation(); + Compilation eventCompilation = CompilationHelper.CreateActiveOrUpcomingEventCompilation(); + + // Emit the image of the referenced assembly. + byte[] campaignImage = CompilationHelper.CreateAssemblyImage(campaignCompilation); + byte[] eventImage = CompilationHelper.CreateAssemblyImage(eventCompilation); + + // Main source for current compilation. + string source = @" + using System.Collections.Generic; + using System.Text.Json.Serialization; + using ReferencedAssembly; + + namespace JsonSourceGenerator + { + [JsonSerializable(typeof(JsonSourceGenerator.IndexViewModel)] + public partial class JsonContext : JsonSerializerContext + { + } + + public class IndexViewModel + { + public List ActiveOrUpcomingEvents { get; set; } + public CampaignSummaryViewModel FeaturedCampaign { get; set; } + public bool IsNewAccount { get; set; } + public bool HasFeaturedCampaign => FeaturedCampaign != null; + } + }"; + + MetadataReference[] additionalReferences = { + MetadataReference.CreateFromImage(campaignImage), + MetadataReference.CreateFromImage(eventImage), + }; + + Compilation compilation = CompilationHelper.CreateCompilation(source, additionalReferences); + + JsonSourceGenerator generator = new JsonSourceGenerator(); + + CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); + + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); + } + + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)] + public void UnsuccessfulSourceGeneration() + { + static void RunTest(bool explicitRef) + { + // Compile the referenced assembly first. + Compilation campaignCompilation = CompilationHelper.CreateCampaignSummaryViewModelCompilation(); + Compilation eventCompilation = CompilationHelper.CreateActiveOrUpcomingEventCompilation(); + + // Emit the image of the referenced assembly. + byte[] campaignImage = CompilationHelper.CreateAssemblyImage(campaignCompilation); + byte[] eventImage = CompilationHelper.CreateAssemblyImage(eventCompilation); + + string optionalAttribute = explicitRef ? "[JsonSerializable(typeof(ActiveOrUpcomingEvent[,])]" : null; + + // Main source for current compilation. + string source = @$" + using System.Collections.Generic; + using System.Text.Json.Serialization; + using ReferencedAssembly; + + namespace JsonSourceGenerator + {{ + {optionalAttribute} + [JsonSerializable(typeof(JsonSourceGenerator.IndexViewModel)] + public partial class JsonContext : JsonSerializerContext + {{ + }} + + public class IndexViewModel + {{ + public ActiveOrUpcomingEvent[,] ActiveOrUpcomingEvents {{ get; set; }} + public CampaignSummaryViewModel FeaturedCampaign {{ get; set; }} + public bool IsNewAccount {{ get; set; }} + public bool HasFeaturedCampaign => FeaturedCampaign != null; + }} + }}"; + + MetadataReference[] additionalReferences = { + MetadataReference.CreateFromImage(campaignImage), + MetadataReference.CreateFromImage(eventImage), + }; + + Compilation compilation = CompilationHelper.CreateCompilation(source, additionalReferences); + + JsonSourceGenerator generator = new JsonSourceGenerator(); + CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); + + Location location; + if (explicitRef) + { + // Unsupported type is not in compiling assembly, but is indicated directly with [JsonSerializable], so location points to attribute application. + INamedTypeSymbol symbol = (INamedTypeSymbol)compilation.GetSymbolsWithName("JsonContext").FirstOrDefault(); + SyntaxReference syntaxReference = symbol.GetAttributes().First().ApplicationSyntaxReference; + TextSpan textSpan = syntaxReference.Span; + location = syntaxReference.SyntaxTree.GetLocation(textSpan)!; + } + else + { + // Unsupported type is not in compiling assembly, and isn't indicated directly with [JsonSerializable], so location points to context type. + location = compilation.GetSymbolsWithName("JsonContext").First().Locations[0]; + } + + // Expected warning logs. + (Location, string)[] expectedWarningDiagnostics = new (Location, string)[] + { + (location, "Did not generate serialization metadata for type 'global::ReferencedAssembly.ActiveOrUpcomingEvent[]'.") + }; + + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, expectedWarningDiagnostics); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); + } + + RunTest(explicitRef: true); + RunTest(false); + } + + [Fact] + public void NameClashSourceGeneration() + { + // Without resolution. + Compilation compilation = CompilationHelper.CreateRepeatedLocationsCompilation(); + JsonSourceGenerator generator = new JsonSourceGenerator(); + CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); + + INamedTypeSymbol symbol = (INamedTypeSymbol)compilation.GetSymbolsWithName("JsonContext").FirstOrDefault(); + SyntaxReference syntaxReference = new List(symbol.GetAttributes())[1].ApplicationSyntaxReference; + TextSpan textSpan = syntaxReference.Span; + Location location = syntaxReference.SyntaxTree.GetLocation(textSpan)!; + + (Location, string)[] expectedWarningDiagnostics = new (Location, string)[] + { + (location, "There are multiple types named Location. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision.") + }; + + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, expectedWarningDiagnostics); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); + + // With resolution. + compilation = CompilationHelper.CreateRepeatedLocationsWithResolutionCompilation(); + generator = new JsonSourceGenerator(); + CompilationHelper.RunGenerators(compilation, out generatorDiags, generator); + + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); + } + + [Fact] + public void ProgramsThatDontUseGeneratorCompile() + { + // No STJ usage. + string source = @"using System; + + public class Program + { + public static void Main() + { + Console.WriteLine(""Hello World""); + } + } + "; + Compilation compilation = CompilationHelper.CreateCompilation(source); + JsonSourceGenerator generator = new JsonSourceGenerator(); + CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); + + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); + + // With STJ usage. + source = @"using System.Text.Json; + + public class Program + { + public static void Main() + { + JsonSerializer.Serialize(""Hello World""); + } + } + "; + compilation = CompilationHelper.CreateCompilation(source); + generator = new JsonSourceGenerator(); + CompilationHelper.RunGenerators(compilation, out generatorDiags, generator); + + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); + } + + [Fact] + public void WarnOnClassesWithInitOnlyProperties() + { + Compilation compilation = CompilationHelper.CreateCompilationWithInitOnlyProperties(); + JsonSourceGenerator generator = new JsonSourceGenerator(); + CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); + + Location location = compilation.GetSymbolsWithName("Id").First().Locations[0]; + + (Location, string)[] expectedWarningDiagnostics = new (Location, string)[] + { + (location, "The type 'Location' defines init-only properties, deserialization of which is currently not supported in source generation mode.") + }; + + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, expectedWarningDiagnostics); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); + } + + [Fact] + public void WarnOnClassesWithInaccessibleJsonIncludeProperties() + { + Compilation compilation = CompilationHelper.CreateCompilationWithInaccessibleJsonIncludeProperties(); + JsonSourceGenerator generator = new JsonSourceGenerator(); + CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); + + Location idLocation = compilation.GetSymbolsWithName("Id").First().Locations[0]; + Location address2Location = compilation.GetSymbolsWithName("Address2").First().Locations[0]; + Location countryLocation = compilation.GetSymbolsWithName("Country").First().Locations[0]; + + (Location, string)[] expectedWarningDiagnostics = new (Location, string)[] + { + (idLocation, "The member 'Location.Id' has been annotated with the JsonIncludeAttribute but is not visible to the source generator."), + (address2Location, "The member 'Location.Address2' has been annotated with the JsonIncludeAttribute but is not visible to the source generator."), + (countryLocation, "The member 'Location.Country' has been annotated with the JsonIncludeAttribute but is not visible to the source generator.") + }; + + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, expectedWarningDiagnostics, sort: false); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); + } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/JsonSourceGeneratorTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs similarity index 61% rename from src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/JsonSourceGeneratorTests.cs rename to src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs index f12e5b07c2057b..b75bdf829a1966 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/JsonSourceGeneratorTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs @@ -68,7 +68,7 @@ public void UsePrivates() Assert.Equal("HelloWorld.MyType", myType.FullName); // Check for received fields, properties and methods in created type. - string[] expectedPropertyNames = { "PublicPropertyInt", "PublicPropertyString",}; + string[] expectedPropertyNames = { "PublicPropertyInt", "PublicPropertyString", }; string[] expectedFieldNames = { "PublicChar", "PublicDouble" }; string[] expectedMethodNames = { "get_PrivatePropertyInt", "get_PrivatePropertyString", "get_PublicPropertyInt", "get_PublicPropertyString", "MyMethod", "MySecondMethod", "set_PrivatePropertyInt", "set_PrivatePropertyString", "set_PublicPropertyInt", "set_PublicPropertyString", "UsePrivates" }; CheckFieldsPropertiesMethods(myType, expectedFieldNames, expectedPropertyNames, expectedMethodNames); @@ -243,7 +243,7 @@ public void UsePrivates() string[] expectedPropertyNamesNotMyType = { "Address1", "Address2", "City", "Country", "Id", "Name", "PhoneNumber", "PostalCode", "State" }; string[] expectedMethodNamesNotMyType = { "get_Address1", "get_Address2", "get_City", "get_Country", "get_Id", "get_Name", "get_PhoneNumber", "get_PostalCode", "get_State", "set_Address1", "set_Address2", "set_City", "set_Country", "set_Id", "set_Name", "set_PhoneNumber", "set_PostalCode", "set_State" }; - CheckFieldsPropertiesMethods(notMyType, expectedFieldNamesNotMyType, expectedPropertyNamesNotMyType, expectedMethodNamesNotMyType ); + CheckFieldsPropertiesMethods(notMyType, expectedFieldNamesNotMyType, expectedPropertyNamesNotMyType, expectedMethodNamesNotMyType); } [Theory] @@ -289,9 +289,9 @@ public JsonSerializableAttribute(Type type) { } Assert.Null(types); } - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Info, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Warning, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Error, Array.Empty()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); } [Theory] @@ -321,9 +321,9 @@ public JsonSerializableAttribute(string typeInfoPropertyName, Type type) { } CompilationHelper.RunGenerators(compilation, out ImmutableArray generatorDiags, generator); Assert.Null(generator.GetSerializableTypes()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Info, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Warning, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Error, Array.Empty()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); } [Fact] @@ -448,24 +448,303 @@ public void UsePrivates() CheckFieldsPropertiesMethods(myType, expectedFieldNames, expectedPropertyNames, expectedMethodNames); } + [Fact] + public void Record() + { + // Compile the referenced assembly first. + Compilation referencedCompilation = CompilationHelper.CreateReferencedLibRecordCompilation(); + + // Emit the image of the referenced assembly. + byte[] referencedImage = CompilationHelper.CreateAssemblyImage(referencedCompilation); + + string source = @" + using System.Text.Json.Serialization; + + namespace HelloWorld + { + [JsonSerializable(typeof(AppRecord))] + internal partial class JsonContext : JsonSerializerContext + { + } + + public record AppRecord(int Id) + { + public string Address1 { get; set; } + public string Address2 { get; set; } + public string City { get; set; } + public string State { get; set; } + public string PostalCode { get; set; } + public string Name { get; set; } + [JsonInclude] + public string PhoneNumber; + [JsonInclude] + public string Country; + } + }"; + + MetadataReference[] additionalReferences = { MetadataReference.CreateFromImage(referencedImage) }; + + Compilation compilation = CompilationHelper.CreateCompilation(source); + + JsonSourceGenerator generator = new JsonSourceGenerator(); + + Compilation newCompilation = CompilationHelper.RunGenerators(compilation, out ImmutableArray generatorDiags, generator); + + // Make sure compilation was successful. + CheckCompilationDiagnosticsErrors(generatorDiags); + CheckCompilationDiagnosticsErrors(newCompilation.GetDiagnostics()); + + Dictionary types = generator.GetSerializableTypes(); + + // Check base functionality of found types. + Assert.Equal(1, types.Count); + Type recordType = types["HelloWorld.AppRecord"]; + Assert.Equal("HelloWorld.AppRecord", recordType.FullName); + + // Check for received fields, properties and methods for NotMyType. + string[] expectedFieldsNames = { "Country", "PhoneNumber" }; + string[] expectedPropertyNames = { "Address1", "Address2", "City", "Id", "Name", "PostalCode", "State" }; + CheckFieldsPropertiesMethods(recordType, expectedFieldsNames, expectedPropertyNames); + + Assert.Equal(1, recordType.GetConstructors().Length); + } + + [Fact] + public void RecordInExternalAssembly() + { + // Compile the referenced assembly first. + Compilation referencedCompilation = CompilationHelper.CreateReferencedLibRecordCompilation(); + + // Emit the image of the referenced assembly. + byte[] referencedImage = CompilationHelper.CreateAssemblyImage(referencedCompilation); + + string source = @" + using System.Text.Json.Serialization; + using ReferencedAssembly; + + namespace HelloWorld + { + [JsonSerializable(typeof(LibRecord))] + internal partial class JsonContext : JsonSerializerContext + { + } + }"; + + MetadataReference[] additionalReferences = { MetadataReference.CreateFromImage(referencedImage) }; + + Compilation compilation = CompilationHelper.CreateCompilation(source, additionalReferences); + + JsonSourceGenerator generator = new JsonSourceGenerator(); + + Compilation newCompilation = CompilationHelper.RunGenerators(compilation, out ImmutableArray generatorDiags, generator); + + // Make sure compilation was successful. + CheckCompilationDiagnosticsErrors(generatorDiags); + CheckCompilationDiagnosticsErrors(newCompilation.GetDiagnostics()); + + Dictionary types = generator.GetSerializableTypes(); + + Assert.Equal(1, types.Count); + Type recordType = types["ReferencedAssembly.LibRecord"]; + Assert.Equal("ReferencedAssembly.LibRecord", recordType.FullName); + + string[] expectedFieldsNames = { "Country", "PhoneNumber" }; + string[] expectedPropertyNames = { "Address1", "Address2", "City", "Id", "Name", "PostalCode", "State" }; + CheckFieldsPropertiesMethods(recordType, expectedFieldsNames, expectedPropertyNames); + + Assert.Equal(1, recordType.GetConstructors().Length); + } + + [Fact] + public void RecordDerivedFromRecordInExternalAssembly() + { + // Compile the referenced assembly first. + Compilation referencedCompilation = CompilationHelper.CreateReferencedSimpleLibRecordCompilation(); + + // Emit the image of the referenced assembly. + byte[] referencedImage = CompilationHelper.CreateAssemblyImage(referencedCompilation); + + string source = @" + using System.Text.Json.Serialization; + using ReferencedAssembly; + + namespace HelloWorld + { + [JsonSerializable(typeof(AppRecord))] + internal partial class JsonContext : JsonSerializerContext + { + } + + internal record AppRecord : LibRecord + { + public string ExtraData { get; set; } + } + }"; + + MetadataReference[] additionalReferences = { MetadataReference.CreateFromImage(referencedImage) }; + + Compilation compilation = CompilationHelper.CreateCompilation(source, additionalReferences); + + JsonSourceGenerator generator = new JsonSourceGenerator(); + + Compilation newCompilation = CompilationHelper.RunGenerators(compilation, out ImmutableArray generatorDiags, generator); + + // Make sure compilation was successful. + CheckCompilationDiagnosticsErrors(generatorDiags); + CheckCompilationDiagnosticsErrors(newCompilation.GetDiagnostics()); + + Dictionary types = generator.GetSerializableTypes(); + + Assert.Equal(1, types.Count); + Type recordType = types["HelloWorld.AppRecord"]; + Assert.Equal("HelloWorld.AppRecord", recordType.FullName); + + string[] expectedFieldsNames = { "Country", "PhoneNumber" }; + string[] expectedPropertyNames = { "Address1", "Address2", "City", "ExtraData", "Id", "Name", "PostalCode", "State" }; + CheckFieldsPropertiesMethods(recordType, expectedFieldsNames, expectedPropertyNames, inspectBaseTypes: true); + + Assert.Equal(1, recordType.GetConstructors().Length); + } + private void CheckCompilationDiagnosticsErrors(ImmutableArray diagnostics) { Assert.Empty(diagnostics.Where(diagnostic => diagnostic.Severity == DiagnosticSeverity.Error)); } - private void CheckFieldsPropertiesMethods(Type type, string[] expectedFields, string[] expectedProperties, string[] expectedMethods) + private void CheckFieldsPropertiesMethods( + Type type, + string[] expectedFields, + string[] expectedProperties, + string[] expectedMethods = null, + bool inspectBaseTypes = false) { BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance; - string[] receivedFields = type.GetFields(bindingFlags).Select(field => field.Name).OrderBy(s => s).ToArray(); - string[] receivedProperties = type.GetProperties(bindingFlags).Select(property => property.Name).OrderBy(s => s).ToArray(); + string[] receivedFields; + string[] receivedProperties; + + if (!inspectBaseTypes) + { + receivedFields = type.GetFields(bindingFlags).Select(field => field.Name).OrderBy(s => s).ToArray(); + receivedProperties = type.GetProperties(bindingFlags).Select(property => property.Name).OrderBy(s => s).ToArray(); + } + else + { + List fields = new List(); + List props = new List(); + + Type currentType = type; + while (currentType != null) + { + fields.AddRange(currentType.GetFields(bindingFlags).Select(property => property.Name).OrderBy(s => s).ToArray()); + props.AddRange(currentType.GetProperties(bindingFlags).Select(property => property.Name).OrderBy(s => s).ToArray()); + currentType = currentType.BaseType; + } + + receivedFields = fields.ToArray(); + receivedProperties = props.ToArray(); + } + string[] receivedMethods = type.GetMethods().Select(method => method.Name).OrderBy(s => s).ToArray(); + Array.Sort(receivedFields); + Array.Sort(receivedProperties); + Array.Sort(receivedMethods); + Assert.Equal(expectedFields, receivedFields); Assert.Equal(expectedProperties, receivedProperties); - Assert.Equal(expectedMethods, receivedMethods); + + if (expectedMethods != null) + { + Assert.Equal(expectedMethods, receivedMethods); + } } // TODO: add test guarding against (de)serializing static classes. + + [Fact] + public void TestMultipleDefinitions() + { + // Adding a dependency to an assembly that has internal definitions of public types + // should not result in a collision and break generation. + // Verify usage of the extension GetBestTypeByMetadataName(this Compilation) instead of Compilation.GetTypeByMetadataName(). + var referencedSource = @" + namespace System.Text.Json.Serialization + { + internal class JsonSerializerContext { } + internal class JsonSerializableAttribute { } + internal class JsonSourceGenerationOptionsAttribute { } + }"; + + // Compile the referenced assembly first. + Compilation referencedCompilation = CompilationHelper.CreateCompilation(referencedSource); + + // Obtain the image of the referenced assembly. + byte[] referencedImage = CompilationHelper.CreateAssemblyImage(referencedCompilation); + + // Generate the code + string source = @" + using System.Text.Json.Serialization; + namespace HelloWorld + { + [JsonSerializable(typeof(HelloWorld.MyType))] + internal partial class JsonContext : JsonSerializerContext + { + } + + public class MyType + { + public int MyInt { get; set; } + } + }"; + + MetadataReference[] additionalReferences = { MetadataReference.CreateFromImage(referencedImage) }; + Compilation compilation = CompilationHelper.CreateCompilation(source, additionalReferences); + JsonSourceGenerator generator = new JsonSourceGenerator(); + + Compilation newCompilation = CompilationHelper.RunGenerators( + compilation, + out ImmutableArray generatorDiags, generator); + + // Make sure compilation was successful. + Assert.Empty(generatorDiags.Where(diag => diag.Severity.Equals(DiagnosticSeverity.Error))); + Assert.Empty(newCompilation.GetDiagnostics().Where(diag => diag.Severity.Equals(DiagnosticSeverity.Error))); + + // Should find the generated type. + Dictionary types = generator.GetSerializableTypes(); + Assert.Equal(1, types.Count); + Assert.Equal("HelloWorld.MyType", types.Keys.First()); + } + + [Fact] + public static void NoWarningsDueToObsoleteMembers() + { + string source = @"using System; +using System.Text.Json.Serialization; + +namespace Test +{ + [JsonSerializable(typeof(ClassWithObsolete))] + public partial class JsonContext : JsonSerializerContext { } + + public class ClassWithObsolete + { + [Obsolete(""This is a test"")] + public bool Test { get; set; } + } +} +"; + + Compilation compilation = CompilationHelper.CreateCompilation(source); + JsonSourceGenerator generator = new JsonSourceGenerator(); + + Compilation newCompilation = CompilationHelper.RunGenerators(compilation, out _, generator); + ImmutableArray generatorDiags = newCompilation.GetDiagnostics(); + + // No diagnostics expected. + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Info, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Warning, generatorDiags, Array.Empty<(Location, string)>()); + CompilationHelper.CheckDiagnosticMessages(DiagnosticSeverity.Error, generatorDiags, Array.Empty<(Location, string)>()); + } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests.csproj new file mode 100644 index 00000000000000..5a99fa881f97f2 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests.csproj @@ -0,0 +1,11 @@ + + + $(MicrosoftCodeAnalysisCSharpWorkspacesVersion_3_11) + + + + + + + + diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests.csproj new file mode 100644 index 00000000000000..073d9ca3126c72 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests.csproj @@ -0,0 +1,12 @@ + + + $(MicrosoftCodeAnalysisCSharpWorkspacesVersion) + $(DefineConstants);ROSLYN4_0_OR_GREATER + + + + + + + + diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/System.Text.Json.SourceGeneration.UnitTests.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Unit.Tests.targets similarity index 81% rename from src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/System.Text.Json.SourceGeneration.UnitTests.csproj rename to src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Unit.Tests.targets index fad3b73e1026df..da4a8b8d65997b 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/System.Text.Json.SourceGeneration.UnitTests.csproj +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Unit.Tests.targets @@ -1,14 +1,13 @@ - + $(NetCoreAppCurrent);$(NetFrameworkCurrent) true - + - diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/TypeWrapperTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/TypeWrapperTests.cs similarity index 100% rename from src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/TypeWrapperTests.cs rename to src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/TypeWrapperTests.cs diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/JsonSourceGeneratorDiagnosticsTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/JsonSourceGeneratorDiagnosticsTests.cs deleted file mode 100644 index caa283f25f91a3..00000000000000 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.UnitTests/JsonSourceGeneratorDiagnosticsTests.cs +++ /dev/null @@ -1,194 +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 Microsoft.CodeAnalysis; -using Xunit; - -namespace System.Text.Json.SourceGeneration.UnitTests -{ - public class JsonSourceGeneratorDiagnosticsTests - { - [Fact] - [ActiveIssue("Figure out issue with CampaignSummaryViewModel namespace.")] - public void SuccessfulSourceGeneration() - { - // Compile the referenced assembly first. - Compilation campaignCompilation = CompilationHelper.CreateCampaignSummaryViewModelCompilation(); - Compilation eventCompilation = CompilationHelper.CreateActiveOrUpcomingEventCompilation(); - - // Emit the image of the referenced assembly. - byte[] campaignImage = CompilationHelper.CreateAssemblyImage(campaignCompilation); - byte[] eventImage = CompilationHelper.CreateAssemblyImage(eventCompilation); - - // Main source for current compilation. - string source = @" - using System.Collections.Generic; - using System.Text.Json.Serialization; - using ReferencedAssembly; - - [assembly: JsonSerializable(typeof(JsonSourceGenerator.IndexViewModel)] - - namespace JsonSourceGenerator - { - public class IndexViewModel - { - public List ActiveOrUpcomingEvents { get; set; } - public CampaignSummaryViewModel FeaturedCampaign { get; set; } - public bool IsNewAccount { get; set; } - public bool HasFeaturedCampaign => FeaturedCampaign != null; - } - }"; - - MetadataReference[] additionalReferences = { - MetadataReference.CreateFromImage(campaignImage), - MetadataReference.CreateFromImage(eventImage), - }; - - Compilation compilation = CompilationHelper.CreateCompilation(source, additionalReferences); - - JsonSourceGenerator generator = new JsonSourceGenerator(); - - CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); - - // Expected info logs. - string[] expectedInfoDiagnostics = new string[] { - "Generated serialization metadata for type System.Collections.Generic.List", - "Generated serialization metadata for type System.Int32", - "Generated serialization metadata for type System.String", - "Generated serialization metadata for type System.DateTimeOffset", - "Generated serialization metadata for type System.Boolean", - "Generated serialization metadata for type ReferencedAssembly.ActiveOrUpcomingEvent", - "Generated serialization metadata for type ReferencedAssembly.CampaignSummaryViewModel", - "Generated serialization metadata for type JsonSourceGenerator.IndexViewModel", - }; - - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Info, expectedInfoDiagnostics); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Warning, new string[] { }); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Error, new string[] { }); - } - - [Fact] - [ActiveIssue("Figure out issue with CampaignSummaryViewModel namespace.")] - public void UnsuccessfulSourceGeneration() - { - // Compile the referenced assembly first. - Compilation campaignCompilation = CompilationHelper.CreateCampaignSummaryViewModelCompilation(); - Compilation eventCompilation = CompilationHelper.CreateActiveOrUpcomingEventCompilation(); - - // Emit the image of the referenced assembly. - byte[] campaignImage = CompilationHelper.CreateAssemblyImage(campaignCompilation); - byte[] eventImage = CompilationHelper.CreateAssemblyImage(eventCompilation); - - // Main source for current compilation. - string source = @" - using System.Collections.Generic; - using System.Text.Json.Serialization; - using ReferencedAssembly; - - [assembly: JsonSerializable(typeof(JsonSourceGenerator.IndexViewModel)] - - namespace JsonSourceGenerator - { - public class IndexViewModel - { - public ISet ActiveOrUpcomingEvents { get; set; } - public CampaignSummaryViewModel FeaturedCampaign { get; set; } - public bool IsNewAccount { get; set; } - public bool HasFeaturedCampaign => FeaturedCampaign != null; - } - }"; - - MetadataReference[] additionalReferences = { - MetadataReference.CreateFromImage(campaignImage), - MetadataReference.CreateFromImage(eventImage), - }; - - Compilation compilation = CompilationHelper.CreateCompilation(source, additionalReferences); - - JsonSourceGenerator generator = new JsonSourceGenerator(); - - CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); - - // Expected success info logs. - string[] expectedInfoDiagnostics = new string[] { - "Generated serialization metadata for type JsonSourceGeneration.IndexViewModel", - "Generated serialization metadata for type System.Boolean", - "Generated serialization metadata for type ReferencedAssembly.CampaignSummaryViewModel" - }; - - // Expected warning logs. - string[] expectedWarningDiagnostics = new string[] { "Did not generate serialization metadata for type System.Collections.Generic.ISet" }; - - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Info, expectedInfoDiagnostics); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Warning, expectedWarningDiagnostics); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Error, new string[] { }); - } - - [Fact] - public void NameClashSourceGeneration() - { - // Without resolution. - Compilation compilation = CompilationHelper.CreateRepeatedLocationsCompilation(); - JsonSourceGenerator generator = new JsonSourceGenerator(); - CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); - - string[] expectedWarningDiagnostics = new string[] { "There are multiple types named Location. Source was generated for the first one detected. Use 'JsonSerializableAttribute.TypeInfoPropertyName' to resolve this collision." }; - - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Info, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Warning, expectedWarningDiagnostics); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Error, Array.Empty()); - - // With resolution. - compilation = CompilationHelper.CreateRepeatedLocationsWithResolutionCompilation(); - generator = new JsonSourceGenerator(); - CompilationHelper.RunGenerators(compilation, out generatorDiags, generator); - - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Info, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Warning, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Error, Array.Empty()); - } - - [Fact] - public void ProgramsThatDontUseGeneratorCompile() - { - // No STJ usage. - string source = @"using System; - -public class Program -{ - public static void Main() - { - Console.WriteLine(""Hello World""); - - } -} -"; - Compilation compilation = CompilationHelper.CreateCompilation(source); - JsonSourceGenerator generator = new JsonSourceGenerator(); - CompilationHelper.RunGenerators(compilation, out var generatorDiags, generator); - - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Info, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Warning, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Error, Array.Empty()); - - // With STJ usage. - source = @"using System.Text.Json; - -public class Program -{ - public static void Main() - { - JsonSerializer.Serialize(""Hello World""); - } -} -"; - compilation = CompilationHelper.CreateCompilation(source); - generator = new JsonSourceGenerator(); - CompilationHelper.RunGenerators(compilation, out generatorDiags, generator); - - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Info, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Warning, Array.Empty()); - CompilationHelper.CheckDiagnosticMessages(generatorDiags, DiagnosticSeverity.Error, Array.Empty()); - } - } -} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs index 5facb8cc718216..36c2a56f746d19 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs @@ -14,6 +14,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Threading.Tasks; +using System.Threading; namespace System.Text.Json.Tests { @@ -553,7 +554,7 @@ private static async Task ParseJsonAsync( using (var stream = new MemoryStream(dataUtf8)) using (var streamReader = new StreamReader(stream, Encoding.UTF8, false, 1024, true)) - using (JsonTextReader jsonReader = new JsonTextReader(streamReader)) + using (var jsonReader = new JsonTextReader(streamReader) { MaxDepth = null }) { JToken jToken = JToken.ReadFrom(jsonReader); @@ -2719,11 +2720,9 @@ public static void ObjectEnumeratorIndependentWalk() Assert.Equal(test, property.Value.GetInt32()); test++; - // Subsequent read of the same JsonProperty doesn't allocate a new string - // (if another property is inspected from the same document that guarantee - // doesn't hold). + // Subsequent read of the same JsonProperty should return an equal string string propertyName2 = property.Name; - Assert.Same(propertyName, propertyName2); + Assert.Equal(propertyName, propertyName2); } test = 0; @@ -3582,6 +3581,41 @@ public static void NameEquals_Empty_Throws() } } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [OuterLoop] // thread-safety / stress test + public static async Task GetString_ConcurrentUse_ThreadSafe() + { + using (JsonDocument doc = JsonDocument.Parse(SR.SimpleObjectJson)) + { + JsonElement first = doc.RootElement.GetProperty("first"); + JsonElement last = doc.RootElement.GetProperty("last"); + + const int Iters = 10_000; + using (var gate = new Barrier(2)) + { + await Task.WhenAll( + Task.Factory.StartNew(() => + { + gate.SignalAndWait(); + for (int i = 0; i < Iters; i++) + { + Assert.Equal("John", first.GetString()); + Assert.True(first.ValueEquals("John")); + } + }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default), + Task.Factory.StartNew(() => + { + gate.SignalAndWait(); + for (int i = 0; i < Iters; i++) + { + Assert.Equal("Smith", last.GetString()); + Assert.True(last.ValueEquals("Smith")); + } + }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default)); + } + } + } + private static void BuildSegmentedReader( out Utf8JsonReader reader, ReadOnlyMemory data, @@ -3631,7 +3665,7 @@ private static string GetCompactJson(TestCaseType testCaseType, string jsonStrin return existing; } - using (JsonTextReader jsonReader = new JsonTextReader(new StringReader(jsonString))) + using (var jsonReader = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null }) { jsonReader.FloatParseHandling = FloatParseHandling.Decimal; JToken jtoken = JToken.ReadFrom(jsonReader); diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs index d30e62a6b7a45c..d69984cb129c11 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs @@ -28,7 +28,7 @@ internal static partial class JsonTestHelper public static string NewtonsoftReturnStringHelper(TextReader reader) { var sb = new StringBuilder(); - var json = new JsonTextReader(reader); + var json = new JsonTextReader(reader) { MaxDepth = null }; while (json.Read()) { if (json.Value != null) @@ -344,7 +344,7 @@ public static string InsertCommentsEverywhere(string jsonString) { writer.Formatting = Formatting.Indented; - var newtonsoft = new JsonTextReader(new StringReader(jsonString)); + var newtonsoft = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null }; writer.WriteComment("comment"); while (newtonsoft.Read()) { @@ -358,7 +358,7 @@ public static string InsertCommentsEverywhere(string jsonString) public static List GetTokenTypes(string jsonString) { - var newtonsoft = new JsonTextReader(new StringReader(jsonString)); + var newtonsoft = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null }; int totalReads = 0; while (newtonsoft.Read()) { @@ -369,7 +369,7 @@ public static List GetTokenTypes(string jsonString) for (int i = 0; i < totalReads; i++) { - newtonsoft = new JsonTextReader(new StringReader(jsonString)); + newtonsoft = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null }; for (int j = 0; j < i; j++) { Assert.True(newtonsoft.Read()); @@ -689,7 +689,7 @@ public static decimal NextDecimal(Random random, double minValue, double maxValu public static string GetCompactString(string jsonString) { - using (JsonTextReader jsonReader = new JsonTextReader(new StringReader(jsonString))) + using (var jsonReader = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null }) { jsonReader.FloatParseHandling = FloatParseHandling.Decimal; JToken jtoken = JToken.ReadFrom(jsonReader); diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ExceptionTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ExceptionTests.cs index cf1b43ade3125d..fcd13f9ad4e816 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ExceptionTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ExceptionTests.cs @@ -512,92 +512,6 @@ public static void UnsupportedTypeFromRoot() Assert.DoesNotContain("Path: $", ex.Message); } - [Fact] - public static void DeserializeUnsupportedType() - { - // Any test payload is fine. - string json = @"""Some string"""; - - RunTest(json); - RunTest(json); - RunTest(json); - RunTest(json); -#if NETCOREAPP - RunTest(json); - RunTest(json); -#endif - - void RunTest(string json) - { - string fullName = typeof(T).FullName; - - NotSupportedException ex = Assert.Throws(() => JsonSerializer.Deserialize(json)); - string exAsStr = ex.ToString(); - Assert.Contains(fullName, exAsStr); - Assert.Contains("$", exAsStr); - - json = $@"{{""Prop"":{json}}}"; - - ex = Assert.Throws(() => JsonSerializer.Deserialize>(json)); - exAsStr = ex.ToString(); - Assert.Contains(fullName, exAsStr); - Assert.Contains("$.Prop", exAsStr); - - // NSE is not thrown because the serializer handles null. - if (!typeof(T).IsValueType) - { - Assert.Null(JsonSerializer.Deserialize("null")); - - ClassWithType obj = JsonSerializer.Deserialize>(@"{""Prop"":null}"); - Assert.Null(obj.Prop); - } - } - } - - [Fact] - public static void SerializeUnsupportedType() - { - RunTest(typeof(int)); - RunTest(new SerializationInfo(typeof(Type), new FormatterConverter())); - RunTest((IntPtr)123); - RunTest((UIntPtr)123); -#if NETCOREAPP - RunTest(DateOnly.MaxValue); - RunTest(TimeOnly.MinValue); -#endif - - void RunTest(T value) - { - Type type = typeof(T); - string fullName = type.FullName; - - NotSupportedException ex = Assert.Throws(() => JsonSerializer.Serialize(value)); - string exAsStr = ex.ToString(); - Assert.Contains(fullName, exAsStr); - Assert.Contains("$", exAsStr); - - ClassWithType obj = new ClassWithType { Prop = value }; - - ex = Assert.Throws(() => JsonSerializer.Serialize(obj)); - exAsStr = ex.ToString(); - Assert.Contains(fullName, exAsStr); - Assert.Contains("$.Prop", exAsStr); - - if (!type.IsValueType) - { - string serialized = JsonSerializer.Serialize((T)(object)null); - Assert.Equal("null", serialized); - - obj.Prop = (T)(object)null; - serialized = JsonSerializer.Serialize(obj); - Assert.Equal(@"{""Prop"":null}", serialized); - - serialized = JsonSerializer.Serialize(obj, new JsonSerializerOptions { IgnoreNullValues = true }); - Assert.Equal(@"{}", serialized); - } - } - } - [Theory] [InlineData(typeof(ClassWithBadCtor))] [InlineData(typeof(StructWithBadCtor))] diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ExtensionDataTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ExtensionDataTests.cs index 853ec365189827..00ca72aaeee5ea 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ExtensionDataTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ExtensionDataTests.cs @@ -1,1299 +1,10 @@ // 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.Generic; -using System.Collections.Immutable; -using System.Linq; -using System.Reflection; -using System.Text.Json.Nodes; -using System.Text.Json.Serialization; -using Xunit; - namespace System.Text.Json.Serialization.Tests { - public static class ExtensionDataTests + public sealed partial class ExtensionDataTestsDynamic : ExtensionDataTests { - [Fact] - public static void ExtensionPropertyNotUsed() - { - string json = @"{""MyNestedClass"":" + SimpleTestClass.s_json + "}"; - ClassWithExtensionProperty obj = JsonSerializer.Deserialize(json); - Assert.Null(obj.MyOverflow); - } - - [Fact] - public static void ExtensionPropertyRoundTrip() - { - ClassWithExtensionProperty obj; - - { - string json = @"{""MyIntMissing"":2, ""MyInt"":1, ""MyNestedClassMissing"":" + SimpleTestClass.s_json + "}"; - obj = JsonSerializer.Deserialize(json); - Verify(); - } - - // Round-trip the json. - { - string json = JsonSerializer.Serialize(obj); - obj = JsonSerializer.Deserialize(json); - Verify(); - - // The json should not contain the dictionary name. - Assert.DoesNotContain(nameof(ClassWithExtensionProperty.MyOverflow), json); - } - - void Verify() - { - Assert.NotNull(obj.MyOverflow); - Assert.Equal(1, obj.MyInt); - Assert.Equal(2, obj.MyOverflow["MyIntMissing"].GetInt32()); - - JsonProperty[] properties = obj.MyOverflow["MyNestedClassMissing"].EnumerateObject().ToArray(); - - // Verify a couple properties - Assert.Equal(1, properties.Where(prop => prop.Name == "MyInt16").First().Value.GetInt32()); - Assert.True(properties.Where(prop => prop.Name == "MyBooleanTrue").First().Value.GetBoolean()); - } - } - - [Fact] - public static void ExtensionFieldNotUsed() - { - string json = @"{""MyNestedClass"":" + SimpleTestClass.s_json + "}"; - ClassWithExtensionField obj = JsonSerializer.Deserialize(json); - Assert.Null(obj.MyOverflow); - } - - [Fact] - public static void ExtensionFieldRoundTrip() - { - ClassWithExtensionField obj; - - { - string json = @"{""MyIntMissing"":2, ""MyInt"":1, ""MyNestedClassMissing"":" + SimpleTestClass.s_json + "}"; - obj = JsonSerializer.Deserialize(json); - Verify(); - } - - // Round-trip the json. - { - string json = JsonSerializer.Serialize(obj); - obj = JsonSerializer.Deserialize(json); - Verify(); - - // The json should not contain the dictionary name. - Assert.DoesNotContain(nameof(ClassWithExtensionField.MyOverflow), json); - } - - void Verify() - { - Assert.NotNull(obj.MyOverflow); - Assert.Equal(1, obj.MyInt); - Assert.Equal(2, obj.MyOverflow["MyIntMissing"].GetInt32()); - - JsonProperty[] properties = obj.MyOverflow["MyNestedClassMissing"].EnumerateObject().ToArray(); - - // Verify a couple properties - Assert.Equal(1, properties.Where(prop => prop.Name == "MyInt16").First().Value.GetInt32()); - Assert.True(properties.Where(prop => prop.Name == "MyBooleanTrue").First().Value.GetBoolean()); - } - } - - [Fact] - public static void ExtensionPropertyIgnoredWhenWritingDefault() - { - string expected = @"{}"; - string actual = JsonSerializer.Serialize(new ClassWithExtensionPropertyAsObject()); - Assert.Equal(expected, actual); - } - - [Fact] - public static void MultipleExtensionPropertyIgnoredWhenWritingDefault() - { - var obj = new ClassWithMultipleDictionaries(); - string actual = JsonSerializer.Serialize(obj); - Assert.Equal("{\"ActualDictionary\":null}", actual); - - obj = new ClassWithMultipleDictionaries - { - ActualDictionary = new Dictionary() - }; - actual = JsonSerializer.Serialize(obj); - Assert.Equal("{\"ActualDictionary\":{}}", actual); - - obj = new ClassWithMultipleDictionaries - { - MyOverflow = new Dictionary - { - { "test", "value" } - } - }; - actual = JsonSerializer.Serialize(obj); - Assert.Equal("{\"ActualDictionary\":null,\"test\":\"value\"}", actual); - - obj = new ClassWithMultipleDictionaries - { - ActualDictionary = new Dictionary(), - MyOverflow = new Dictionary - { - { "test", "value" } - } - }; - actual = JsonSerializer.Serialize(obj); - Assert.Equal("{\"ActualDictionary\":{},\"test\":\"value\"}", actual); - } - - [Fact] - public static void ExtensionPropertyInvalidJsonFail() - { - const string BadJson = @"{""Good"":""OK"",""Bad"":!}"; - - JsonException jsonException = Assert.Throws(() => JsonSerializer.Deserialize(BadJson)); - Assert.Contains("Path: $.Bad | LineNumber: 0 | BytePositionInLine: 19.", jsonException.ToString()); - Assert.NotNull(jsonException.InnerException); - Assert.IsAssignableFrom(jsonException.InnerException); - Assert.Contains("!", jsonException.InnerException.ToString()); - } - - [Fact] - public static void ExtensionPropertyAlreadyInstantiated() - { - Assert.NotNull(new ClassWithExtensionPropertyAlreadyInstantiated().MyOverflow); - - string json = @"{""MyIntMissing"":2}"; - - ClassWithExtensionProperty obj = JsonSerializer.Deserialize(json); - Assert.Equal(2, obj.MyOverflow["MyIntMissing"].GetInt32()); - } - - [Fact] - public static void ExtensionPropertyAsObject() - { - string json = @"{""MyIntMissing"":2}"; - - ClassWithExtensionPropertyAsObject obj = JsonSerializer.Deserialize(json); - Assert.IsType(obj.MyOverflow["MyIntMissing"]); - Assert.Equal(2, ((JsonElement)obj.MyOverflow["MyIntMissing"]).GetInt32()); - } - - [Fact] - public static void ExtensionPropertyCamelCasing() - { - // Currently we apply no naming policy. If we do (such as a ExtensionPropertyNamingPolicy), we'd also have to add functionality to the JsonDocument. - - ClassWithExtensionProperty obj; - const string jsonWithProperty = @"{""MyIntMissing"":1}"; - const string jsonWithPropertyCamelCased = @"{""myIntMissing"":1}"; - - { - // Baseline Pascal-cased json + no casing option. - obj = JsonSerializer.Deserialize(jsonWithProperty); - Assert.Equal(1, obj.MyOverflow["MyIntMissing"].GetInt32()); - string json = JsonSerializer.Serialize(obj); - Assert.Contains(@"""MyIntMissing"":1", json); - } - - { - // Pascal-cased json + camel casing option. - JsonSerializerOptions options = new JsonSerializerOptions(); - options.DictionaryKeyPolicy = JsonNamingPolicy.CamelCase; - options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - - obj = JsonSerializer.Deserialize(jsonWithProperty, options); - Assert.Equal(1, obj.MyOverflow["MyIntMissing"].GetInt32()); - string json = JsonSerializer.Serialize(obj, options); - Assert.Contains(@"""MyIntMissing"":1", json); - } - - { - // Baseline camel-cased json + no casing option. - obj = JsonSerializer.Deserialize(jsonWithPropertyCamelCased); - Assert.Equal(1, obj.MyOverflow["myIntMissing"].GetInt32()); - string json = JsonSerializer.Serialize(obj); - Assert.Contains(@"""myIntMissing"":1", json); - } - - { - // Baseline camel-cased json + camel casing option. - JsonSerializerOptions options = new JsonSerializerOptions(); - options.DictionaryKeyPolicy = JsonNamingPolicy.CamelCase; - options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - - obj = JsonSerializer.Deserialize(jsonWithPropertyCamelCased, options); - Assert.Equal(1, obj.MyOverflow["myIntMissing"].GetInt32()); - string json = JsonSerializer.Serialize(obj, options); - Assert.Contains(@"""myIntMissing"":1", json); - } - } - - [Fact] - public static void NullValuesIgnored() - { - const string json = @"{""MyNestedClass"":null}"; - const string jsonMissing = @"{""MyNestedClassMissing"":null}"; - - { - // Baseline with no missing. - ClassWithExtensionProperty obj = JsonSerializer.Deserialize(json); - Assert.Null(obj.MyOverflow); - - string outJson = JsonSerializer.Serialize(obj); - Assert.Contains(@"""MyNestedClass"":null", outJson); - } - - { - // Baseline with missing. - ClassWithExtensionProperty obj = JsonSerializer.Deserialize(jsonMissing); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(JsonValueKind.Null, obj.MyOverflow["MyNestedClassMissing"].ValueKind); - } - - { - JsonSerializerOptions options = new JsonSerializerOptions(); - options.IgnoreNullValues = true; - - ClassWithExtensionProperty obj = JsonSerializer.Deserialize(jsonMissing, options); - - // Currently we do not ignore nulls in the extension data. The JsonDocument would also need to support this mode - // for any lower-level nulls. - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(JsonValueKind.Null, obj.MyOverflow["MyNestedClassMissing"].ValueKind); - } - } - - private class ClassWithInvalidExtensionProperty - { - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - } - - private class ClassWithTwoExtensionProperties - { - [JsonExtensionData] - public Dictionary MyOverflow1 { get; set; } - - [JsonExtensionData] - public Dictionary MyOverflow2 { get; set; } - } - - [Fact] - public static void InvalidExtensionPropertyFail() - { - // Baseline - JsonSerializer.Deserialize(@"{}"); - JsonSerializer.Deserialize(@"{}"); - - Assert.Throws(() => JsonSerializer.Deserialize(@"{}")); - Assert.Throws(() => JsonSerializer.Deserialize(@"{}")); - } - - private class ClassWithIgnoredData - { - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - - [JsonIgnore] - public int MyInt { get; set; } - } - - [Fact] - public static void IgnoredDataShouldNotBeExtensionData() - { - ClassWithIgnoredData obj = JsonSerializer.Deserialize(@"{""MyInt"":1}"); - - Assert.Equal(0, obj.MyInt); - Assert.Null(obj.MyOverflow); - } - - private class ClassWithExtensionData - { - [JsonExtensionData] - public T Overflow { get; set; } - } - - public class CustomOverflowDictionary : Dictionary - { - } - - public class DictionaryOverflowConverter : JsonConverter> - { - public override Dictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - throw new NotImplementedException(); - } - - public override void Write(Utf8JsonWriter writer, Dictionary value, JsonSerializerOptions options) - { - writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); - } - } - - public class JsonElementOverflowConverter : JsonConverter> - { - public override Dictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - throw new NotImplementedException(); - } - - public override void Write(Utf8JsonWriter writer, Dictionary value, JsonSerializerOptions options) - { - writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); - } - } - - public class JsonObjectOverflowConverter : JsonConverter - { - public override JsonObject Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - throw new NotImplementedException(); - } - - public override void Write(Utf8JsonWriter writer, JsonObject value, JsonSerializerOptions options) - { - writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); - } - } - - public class CustomObjectDictionaryOverflowConverter : JsonConverter> - { - public override CustomOverflowDictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - throw new NotImplementedException(); - } - - public override void Write(Utf8JsonWriter writer, CustomOverflowDictionary value, JsonSerializerOptions options) - { - writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); - } - } - - public class CustomJsonElementDictionaryOverflowConverter : JsonConverter> - { - public override CustomOverflowDictionary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - throw new NotImplementedException(); - } - - public override void Write(Utf8JsonWriter writer, CustomOverflowDictionary value, JsonSerializerOptions options) - { - writer.WriteString("MyCustomOverflowWrite", "OverflowValueWrite"); - } - } - - [Theory] - [InlineData(typeof(Dictionary), typeof(DictionaryOverflowConverter))] - [InlineData(typeof(Dictionary), typeof(JsonElementOverflowConverter))] - [InlineData(typeof(CustomOverflowDictionary), typeof(CustomObjectDictionaryOverflowConverter))] - [InlineData(typeof(CustomOverflowDictionary), typeof(CustomJsonElementDictionaryOverflowConverter))] - public static void ExtensionProperty_SupportsWritingToCustomSerializerWithOptions(Type overflowType, Type converterType) - { - typeof(ExtensionDataTests) - .GetMethod(nameof(ExtensionProperty_SupportsWritingToCustomSerializerWithOptionsInternal), BindingFlags.Static | BindingFlags.NonPublic) - .MakeGenericMethod(overflowType, converterType) - .Invoke(null, null); - } - - private static void ExtensionProperty_SupportsWritingToCustomSerializerWithOptionsInternal() - where TDictionary : new() - where TConverter : JsonConverter, new() - { - var root = new ClassWithExtensionData() - { - Overflow = new TDictionary() - }; - - var options = new JsonSerializerOptions(); - options.Converters.Add(new TConverter()); - - string json = JsonSerializer.Serialize(root, options); - Assert.Equal(@"{""MyCustomOverflowWrite"":""OverflowValueWrite""}", json); - } - - private interface IClassWithOverflow - { - public T Overflow { get; set; } - } - - private class ClassWithExtensionDataWithAttributedConverter : IClassWithOverflow> - { - [JsonExtensionData] - [JsonConverter(typeof(DictionaryOverflowConverter))] - public Dictionary Overflow { get; set; } - } - - private class ClassWithJsonElementExtensionDataWithAttributedConverter : IClassWithOverflow> - { - [JsonExtensionData] - [JsonConverter(typeof(JsonElementOverflowConverter))] - public Dictionary Overflow { get; set; } - } - - private class ClassWithCustomElementExtensionDataWithAttributedConverter : IClassWithOverflow> - { - [JsonExtensionData] - [JsonConverter(typeof(CustomObjectDictionaryOverflowConverter))] - public CustomOverflowDictionary Overflow { get; set; } - } - - private class ClassWithCustomJsonElementExtensionDataWithAttributedConverter : IClassWithOverflow> - { - [JsonExtensionData] - [JsonConverter(typeof(CustomJsonElementDictionaryOverflowConverter))] - public CustomOverflowDictionary Overflow { get; set; } - } - - [Theory] - [InlineData(typeof(ClassWithExtensionDataWithAttributedConverter), typeof(Dictionary))] - [InlineData(typeof(ClassWithJsonElementExtensionDataWithAttributedConverter), typeof(Dictionary))] - [InlineData(typeof(ClassWithCustomElementExtensionDataWithAttributedConverter), typeof(CustomOverflowDictionary))] - [InlineData(typeof(ClassWithCustomJsonElementExtensionDataWithAttributedConverter), typeof(CustomOverflowDictionary))] - public static void ExtensionProperty_SupportsWritingToCustomSerializerWithExplicitConverter(Type attributedType, Type dictionaryType) - { - typeof(ExtensionDataTests) - .GetMethod(nameof(ExtensionProperty_SupportsWritingToCustomSerializerWithExplicitConverterInternal), BindingFlags.Static | BindingFlags.NonPublic) - .MakeGenericMethod(attributedType, dictionaryType) - .Invoke(null, null); - } - - private static void ExtensionProperty_SupportsWritingToCustomSerializerWithExplicitConverterInternal() - where TRoot : IClassWithOverflow, new() - where TDictionary : new() - { - var root = new TRoot() - { - Overflow = new TDictionary() - }; - - string json = JsonSerializer.Serialize(root); - Assert.Equal(@"{""MyCustomOverflowWrite"":""OverflowValueWrite""}", json); - } - - [Theory] - [InlineData(typeof(Dictionary), typeof(DictionaryOverflowConverter), typeof(object))] - [InlineData(typeof(Dictionary), typeof(JsonElementOverflowConverter), typeof(JsonElement))] - [InlineData(typeof(CustomOverflowDictionary), typeof(CustomObjectDictionaryOverflowConverter), typeof(object))] - [InlineData(typeof(CustomOverflowDictionary), typeof(CustomJsonElementDictionaryOverflowConverter), typeof(JsonElement))] - public static void ExtensionProperty_IgnoresCustomSerializerWithOptions(Type overflowType, Type converterType, Type elementType) - { - typeof(ExtensionDataTests) - .GetMethod(nameof(ExtensionProperty_IgnoresCustomSerializerWithOptionsInternal), BindingFlags.Static | BindingFlags.NonPublic) - .MakeGenericMethod(overflowType, elementType, converterType) - .Invoke(null, null); - } - - [Fact] - public static void ExtensionProperty_IgnoresCustomSerializerWithOptions_JsonObject() - { - var options = new JsonSerializerOptions(); - options.Converters.Add(new JsonObjectOverflowConverter()); - - // A custom converter for JsonObject is not allowed on an extension property. - InvalidOperationException ex = Assert.Throws(() => - JsonSerializer.Deserialize>(@"{""TestKey"":""TestValue""}", options)); - - Assert.Contains("JsonObject", ex.ToString()); - } - - private static void ExtensionProperty_IgnoresCustomSerializerWithOptionsInternal() - where TConverter : JsonConverter, new() - where TDictionary : IDictionary - { - var options = new JsonSerializerOptions(); - options.Converters.Add(new TConverter()); - - ClassWithExtensionData obj - = JsonSerializer.Deserialize>(@"{""TestKey"":""TestValue""}", options); - - Assert.Equal("TestValue", ((JsonElement)(object)obj.Overflow["TestKey"]).GetString()); - } - - [Theory] - [InlineData(typeof(ClassWithExtensionDataWithAttributedConverter), typeof(Dictionary), typeof(object))] - [InlineData(typeof(ClassWithJsonElementExtensionDataWithAttributedConverter), typeof(Dictionary), typeof(JsonElement))] - [InlineData(typeof(ClassWithCustomElementExtensionDataWithAttributedConverter), typeof(CustomOverflowDictionary), typeof(object))] - [InlineData(typeof(ClassWithCustomJsonElementExtensionDataWithAttributedConverter), typeof(CustomOverflowDictionary), typeof(JsonElement))] - public static void ExtensionProperty_IgnoresCustomSerializerWithExplicitConverter(Type attributedType, Type dictionaryType, Type elementType) - { - typeof(ExtensionDataTests) - .GetMethod(nameof(ExtensionProperty_IgnoresCustomSerializerWithExplicitConverterInternal), BindingFlags.Static | BindingFlags.NonPublic) - .MakeGenericMethod(attributedType, dictionaryType, elementType) - .Invoke(null, null); - } - - [Fact] - public static void ExtensionProperty_IgnoresCustomSerializerWithExplicitConverter_JsonObject() - { - ClassWithExtensionData obj - = JsonSerializer.Deserialize>(@"{""TestKey"":""TestValue""}"); - - Assert.Equal("TestValue", obj.Overflow["TestKey"].GetValue()); - } - - private static void ExtensionProperty_IgnoresCustomSerializerWithExplicitConverterInternal() - where TRoot : IClassWithOverflow, new() - where TDictionary : IDictionary - { - ClassWithExtensionData obj - = JsonSerializer.Deserialize>(@"{""TestKey"":""TestValue""}"); - - Assert.Equal("TestValue", ((JsonElement)(object)obj.Overflow["TestKey"]).GetString()); - } - - [Fact] - public static void ExtensionPropertyObjectValue_Empty() - { - ClassWithExtensionPropertyAlreadyInstantiated obj = JsonSerializer.Deserialize(@"{}"); - Assert.Equal(@"{}", JsonSerializer.Serialize(obj)); - } - - [Fact] - public static void ExtensionPropertyObjectValue_SameAsExtensionPropertyName() - { - const string json = @"{""MyOverflow"":{""Key1"":""V""}}"; - - // Deserializing directly into the overflow is not supported by design. - ClassWithExtensionPropertyAsObject obj = JsonSerializer.Deserialize(json); - - // The JSON is treated as normal overflow. - Assert.NotNull(obj.MyOverflow["MyOverflow"]); - Assert.Equal(json, JsonSerializer.Serialize(obj)); - } - - private class ClassWithExtensionPropertyAsObjectAndNameProperty - { - public string Name { get; set; } - - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - } - - public static IEnumerable JsonSerializerOptions() - { - yield return new object[] { null }; - yield return new object[] { new JsonSerializerOptions() }; - yield return new object[] { new JsonSerializerOptions { UnknownTypeHandling = JsonUnknownTypeHandling.JsonElement } }; - yield return new object[] { new JsonSerializerOptions { UnknownTypeHandling = JsonUnknownTypeHandling.JsonNode } }; - } - - [Theory] - [MemberData(nameof(JsonSerializerOptions))] - public static void ExtensionPropertyDuplicateNames(JsonSerializerOptions options) - { - var obj = new ClassWithExtensionPropertyAsObjectAndNameProperty(); - obj.Name = "Name1"; - - obj.MyOverflow = new Dictionary(); - obj.MyOverflow["Name"] = "Name2"; - - string json = JsonSerializer.Serialize(obj, options); - Assert.Equal(@"{""Name"":""Name1"",""Name"":""Name2""}", json); - - // The overflow value comes last in the JSON so it overwrites the original value. - obj = JsonSerializer.Deserialize(json, options); - Assert.Equal("Name2", obj.Name); - - // Since there was no overflow, this should be null. - Assert.Null(obj.MyOverflow); - } - - [Theory] - [MemberData(nameof(JsonSerializerOptions))] - public static void Null_SystemObject(JsonSerializerOptions options) - { - const string json = @"{""MissingProperty"":null}"; - - { - ClassWithExtensionPropertyAsObject obj = JsonSerializer.Deserialize(json, options); - - // A null value maps to , so the value is null. - object elem = obj.MyOverflow["MissingProperty"]; - Assert.Null(elem); - } - - { - ClassWithExtensionPropertyAsJsonObject obj = JsonSerializer.Deserialize(json, options); - - JsonObject jObject = obj.MyOverflow; - JsonNode jNode = jObject["MissingProperty"]; - // Since JsonNode is a reference type the value is null. - Assert.Null(jNode); - } - } - - [Fact] - public static void Null_JsonElement() - { - const string json = @"{""MissingProperty"":null}"; - - ClassWithExtensionPropertyAsJsonElement obj = JsonSerializer.Deserialize(json); - object elem = obj.MyOverflow["MissingProperty"]; - // Since JsonElement is a struct, it treats null as JsonValueKind.Null. - Assert.IsType(elem); - Assert.Equal(JsonValueKind.Null, ((JsonElement)elem).ValueKind); - } - - [Fact] - public static void Null_JsonObject() - { - const string json = @"{""MissingProperty"":null}"; - - ClassWithExtensionPropertyAsJsonObject obj = JsonSerializer.Deserialize(json); - object elem = obj.MyOverflow["MissingProperty"]; - // Since JsonNode is a reference type the value is null. - Assert.Null(elem); - } - - [Fact] - public static void ExtensionPropertyObjectValue() - { - // Baseline - ClassWithExtensionPropertyAlreadyInstantiated obj = JsonSerializer.Deserialize(@"{}"); - obj.MyOverflow.Add("test", new object()); - obj.MyOverflow.Add("test1", 1); - - Assert.Equal(@"{""test"":{},""test1"":1}", JsonSerializer.Serialize(obj)); - } - - private class DummyObj - { - public string Prop { get; set; } - } - - private struct DummyStruct - { - public string Prop { get; set; } - } - - [Theory] - [MemberData(nameof(JsonSerializerOptions))] - public static void ExtensionPropertyObjectValue_RoundTrip(JsonSerializerOptions options) - { - // Baseline - ClassWithExtensionPropertyAlreadyInstantiated obj = JsonSerializer.Deserialize(@"{}", options); - obj.MyOverflow.Add("test", new object()); - obj.MyOverflow.Add("test1", 1); - obj.MyOverflow.Add("test2", "text"); - obj.MyOverflow.Add("test3", new DummyObj() { Prop = "ObjectProp" }); - obj.MyOverflow.Add("test4", new DummyStruct() { Prop = "StructProp" }); - obj.MyOverflow.Add("test5", new Dictionary() { { "Key", "Value" }, { "Key1", "Value1" }, }); - - string json = JsonSerializer.Serialize(obj); - ClassWithExtensionPropertyAlreadyInstantiated roundTripObj = JsonSerializer.Deserialize(json, options); - - Assert.Equal(6, roundTripObj.MyOverflow.Count); - - if (options?.UnknownTypeHandling == JsonUnknownTypeHandling.JsonNode) - { - Assert.IsAssignableFrom(roundTripObj.MyOverflow["test"]); - Assert.IsAssignableFrom(roundTripObj.MyOverflow["test1"]); - Assert.IsAssignableFrom(roundTripObj.MyOverflow["test2"]); - Assert.IsAssignableFrom(roundTripObj.MyOverflow["test3"]); - - Assert.IsType(roundTripObj.MyOverflow["test"]); - - Assert.IsAssignableFrom(roundTripObj.MyOverflow["test1"]); - Assert.Equal(1, ((JsonValue)roundTripObj.MyOverflow["test1"]).GetValue()); - Assert.Equal(1, ((JsonValue)roundTripObj.MyOverflow["test1"]).GetValue()); - - Assert.IsAssignableFrom(roundTripObj.MyOverflow["test2"]); - Assert.Equal("text", ((JsonValue)roundTripObj.MyOverflow["test2"]).GetValue()); - - Assert.IsType(roundTripObj.MyOverflow["test3"]); - Assert.Equal("ObjectProp", ((JsonObject)roundTripObj.MyOverflow["test3"])["Prop"].GetValue()); - - Assert.IsType(roundTripObj.MyOverflow["test4"]); - Assert.Equal("StructProp", ((JsonObject)roundTripObj.MyOverflow["test4"])["Prop"].GetValue()); - - Assert.IsType(roundTripObj.MyOverflow["test5"]); - Assert.Equal("Value", ((JsonObject)roundTripObj.MyOverflow["test5"])["Key"].GetValue()); - Assert.Equal("Value1", ((JsonObject)roundTripObj.MyOverflow["test5"])["Key1"].GetValue()); - } - else - { - Assert.IsType(roundTripObj.MyOverflow["test"]); - Assert.IsType(roundTripObj.MyOverflow["test1"]); - Assert.IsType(roundTripObj.MyOverflow["test2"]); - Assert.IsType(roundTripObj.MyOverflow["test3"]); - - Assert.Equal(JsonValueKind.Object, ((JsonElement)roundTripObj.MyOverflow["test"]).ValueKind); - - Assert.Equal(JsonValueKind.Number, ((JsonElement)roundTripObj.MyOverflow["test1"]).ValueKind); - Assert.Equal(1, ((JsonElement)roundTripObj.MyOverflow["test1"]).GetInt32()); - Assert.Equal(1, ((JsonElement)roundTripObj.MyOverflow["test1"]).GetInt64()); - - Assert.Equal(JsonValueKind.String, ((JsonElement)roundTripObj.MyOverflow["test2"]).ValueKind); - Assert.Equal("text", ((JsonElement)roundTripObj.MyOverflow["test2"]).GetString()); - - Assert.Equal(JsonValueKind.Object, ((JsonElement)roundTripObj.MyOverflow["test3"]).ValueKind); - Assert.Equal("ObjectProp", ((JsonElement)roundTripObj.MyOverflow["test3"]).GetProperty("Prop").GetString()); - - Assert.Equal(JsonValueKind.Object, ((JsonElement)roundTripObj.MyOverflow["test4"]).ValueKind); - Assert.Equal("StructProp", ((JsonElement)roundTripObj.MyOverflow["test4"]).GetProperty("Prop").GetString()); - - Assert.Equal(JsonValueKind.Object, ((JsonElement)roundTripObj.MyOverflow["test5"]).ValueKind); - Assert.Equal("Value", ((JsonElement)roundTripObj.MyOverflow["test5"]).GetProperty("Key").GetString()); - Assert.Equal("Value1", ((JsonElement)roundTripObj.MyOverflow["test5"]).GetProperty("Key1").GetString()); - } - } - - [Fact] - public static void DeserializeIntoJsonObjectProperty() - { - string json = @"{""MyDict"":{""Property1"":1}}"; - ClassWithExtensionPropertyAsJsonObject obj = - JsonSerializer.Deserialize(json); - - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(1, obj.MyOverflow["MyDict"]["Property1"].GetValue()); - } - - [Fact] - public static void DeserializeIntoSystemObjectProperty() - { - string json = @"{""MyDict"":{""Property1"":1}}"; - - Assert.Throws(() => - JsonSerializer.Deserialize(json)); - - // Cannot deserialize into System.Object overflow even if UnknownTypeHandling is set to use JsonNode. - var options = new JsonSerializerOptions { UnknownTypeHandling = JsonUnknownTypeHandling.JsonNode }; - Assert.Throws(() => - JsonSerializer.Deserialize(json)); - } - - private class ClassWithReference - { - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - - public ClassWithExtensionProperty MyReference { get; set; } - } - - [Theory] - [InlineData(@"{""MyIntMissing"":2,""MyReference"":{""MyIntMissingChild"":3}}")] - [InlineData(@"{""MyReference"":{""MyIntMissingChild"":3},""MyIntMissing"":2}")] - [InlineData(@"{""MyReference"":{""MyNestedClass"":null,""MyInt"":0,""MyIntMissingChild"":3},""MyIntMissing"":2}")] - public static void NestedClass(string json) - { - ClassWithReference obj; - - void Verify() - { - Assert.IsType(obj.MyOverflow["MyIntMissing"]); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(2, obj.MyOverflow["MyIntMissing"].GetInt32()); - - ClassWithExtensionProperty child = obj.MyReference; - - Assert.IsType(child.MyOverflow["MyIntMissingChild"]); - Assert.IsType(child.MyOverflow["MyIntMissingChild"]); - Assert.Equal(1, child.MyOverflow.Count); - Assert.Equal(3, child.MyOverflow["MyIntMissingChild"].GetInt32()); - Assert.Null(child.MyNestedClass); - Assert.Equal(0, child.MyInt); - } - - obj = JsonSerializer.Deserialize(json); - Verify(); - - // Round-trip the json and verify. - json = JsonSerializer.Serialize(obj); - obj = JsonSerializer.Deserialize(json); - Verify(); - } - - private class ParentClassWithObject - { - public string Text { get; set; } - public ChildClassWithObject Child { get; set; } - - [JsonExtensionData] - public Dictionary ExtensionData { get; set; } = new Dictionary(); - } - - private class ChildClassWithObject - { - public int Number { get; set; } - - [JsonExtensionData] - public Dictionary ExtensionData { get; set; } = new Dictionary(); - } - - [Fact] - public static void NestedClassWithObjectExtensionDataProperty() - { - var child = new ChildClassWithObject { Number = 2 }; - child.ExtensionData.Add("SpecialInformation", "I am child class"); - - var parent = new ParentClassWithObject { Text = "Hello World" }; - parent.ExtensionData.Add("SpecialInformation", "I am parent class"); - parent.Child = child; - - // The extension data is based on the raw strings added above and not JsonElement. - Assert.Equal("Hello World", parent.Text); - Assert.IsType(parent.ExtensionData["SpecialInformation"]); - Assert.Equal("I am parent class", (string)parent.ExtensionData["SpecialInformation"]); - Assert.Equal(2, parent.Child.Number); - Assert.IsType(parent.Child.ExtensionData["SpecialInformation"]); - Assert.Equal("I am child class", (string)parent.Child.ExtensionData["SpecialInformation"]); - - // Round-trip and verify. Extension data is now based on JsonElement. - string json = JsonSerializer.Serialize(parent); - parent = JsonSerializer.Deserialize(json); - - Assert.Equal("Hello World", parent.Text); - Assert.IsType(parent.ExtensionData["SpecialInformation"]); - Assert.Equal("I am parent class", ((JsonElement)parent.ExtensionData["SpecialInformation"]).GetString()); - Assert.Equal(2, parent.Child.Number); - Assert.IsType(parent.Child.ExtensionData["SpecialInformation"]); - Assert.Equal("I am child class", ((JsonElement)parent.Child.ExtensionData["SpecialInformation"]).GetString()); - } - - private class ParentClassWithJsonElement - { - public string Text { get; set; } - - public List Children { get; set; } = new List(); - - [JsonExtensionData] - // Use SortedDictionary as verification of supporting derived dictionaries. - public SortedDictionary ExtensionData { get; set; } = new SortedDictionary(); - } - - private class ChildClassWithJsonElement - { - public int Number { get; set; } - - [JsonExtensionData] - public Dictionary ExtensionData { get; set; } = new Dictionary(); - } - - [Fact] - public static void NestedClassWithJsonElementExtensionDataProperty() - { - var child = new ChildClassWithJsonElement { Number = 4 }; - child.ExtensionData.Add("SpecialInformation", JsonDocument.Parse(JsonSerializer.SerializeToUtf8Bytes("I am child class")).RootElement); - - var parent = new ParentClassWithJsonElement { Text = "Hello World" }; - parent.ExtensionData.Add("SpecialInformation", JsonDocument.Parse(JsonSerializer.SerializeToUtf8Bytes("I am parent class")).RootElement); - parent.Children.Add(child); - - Verify(); - - // Round-trip and verify. - string json = JsonSerializer.Serialize(parent); - parent = JsonSerializer.Deserialize(json); - Verify(); - - void Verify() - { - Assert.Equal("Hello World", parent.Text); - Assert.Equal("I am parent class", parent.ExtensionData["SpecialInformation"].GetString()); - Assert.Equal(1, parent.Children.Count); - Assert.Equal(4, parent.Children[0].Number); - Assert.Equal("I am child class", parent.Children[0].ExtensionData["SpecialInformation"].GetString()); - } - } - - [Fact] - public static void DeserializeIntoObjectProperty() - { - ClassWithExtensionPropertyAsObject obj; - string json; - - // Baseline dictionary. - json = @"{""MyDict"":{""Property1"":1}}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(1, ((JsonElement)obj.MyOverflow["MyDict"]).EnumerateObject().First().Value.GetInt32()); - - // Attempt to deserialize directly into the overflow property; this is just added as a normal missing property like MyDict above. - json = @"{""MyOverflow"":{""Property1"":1}}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(1, ((JsonElement)obj.MyOverflow["MyOverflow"]).EnumerateObject().First().Value.GetInt32()); - - // Attempt to deserialize null into the overflow property. This is also treated as a missing property. - json = @"{""MyOverflow"":null}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Null(obj.MyOverflow["MyOverflow"]); - - // Attempt to deserialize object into the overflow property. This is also treated as a missing property. - json = @"{""MyOverflow"":{}}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(JsonValueKind.Object, ((JsonElement)obj.MyOverflow["MyOverflow"]).ValueKind); - } - - [Fact] - public static void DeserializeIntoMultipleDictionaries() - { - ClassWithMultipleDictionaries obj; - string json; - - // Baseline dictionary. - json = @"{""ActualDictionary"":{""Key"": {""Property0"":-1}},""MyDict"":{""Property1"":1}}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(1, ((JsonElement)obj.MyOverflow["MyDict"]).EnumerateObject().First().Value.GetInt32()); - Assert.Equal(1, obj.ActualDictionary.Count); - Assert.Equal(-1, ((JsonElement)obj.ActualDictionary["Key"]).EnumerateObject().First().Value.GetInt32()); - - // Attempt to deserialize null into the dictionary and overflow property. This is also treated as a missing property. - json = @"{""ActualDictionary"":null,""MyOverflow"":null}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Null(obj.MyOverflow["MyOverflow"]); - Assert.Null(obj.ActualDictionary); - - // Attempt to deserialize object into the dictionary and overflow property. This is also treated as a missing property. - json = @"{""ActualDictionary"":{},""MyOverflow"":{}}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(JsonValueKind.Object, ((JsonElement)obj.MyOverflow["MyOverflow"]).ValueKind); - Assert.Equal(0, obj.ActualDictionary.Count); - } - - [Fact] - public static void DeserializeIntoJsonElementProperty() - { - ClassWithExtensionPropertyAsJsonElement obj; - string json; - - // Baseline dictionary. - json = @"{""MyDict"":{""Property1"":1}}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(1, obj.MyOverflow["MyDict"].EnumerateObject().First().Value.GetInt32()); - - // Attempt to deserialize directly into the overflow property; this is just added as a normal missing property like MyDict above. - json = @"{""MyOverflow"":{""Property1"":1}}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(1, obj.MyOverflow["MyOverflow"].EnumerateObject().First().Value.GetInt32()); - - // Attempt to deserialize null into the overflow property. This is also treated as a missing property. - json = @"{""MyOverflow"":null}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(JsonValueKind.Null, obj.MyOverflow["MyOverflow"].ValueKind); - - // Attempt to deserialize object into the overflow property. This is also treated as a missing property. - json = @"{""MyOverflow"":{}}"; - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(JsonValueKind.Object, obj.MyOverflow["MyOverflow"].ValueKind); - } - - [Fact] - public static void SerializerOutputRoundtripsWhenEscaping() - { - string jsonString = "{\"\u6C49\u5B57\":\"abc\",\"Class\":{\"\u6F22\u5B57\":\"xyz\"},\"\u62DC\u6258\":{\"\u62DC\u6258\u62DC\u6258\":1}}"; - - ClassWithEscapedProperty input = JsonSerializer.Deserialize(jsonString); - - Assert.Equal("abc", input.\u6C49\u5B57); - Assert.Equal("xyz", input.Class.\u6F22\u5B57); - - string normalizedString = JsonSerializer.Serialize(input); - - Assert.Equal(normalizedString, JsonSerializer.Serialize(JsonSerializer.Deserialize(normalizedString))); - } - - public class ClassWithEscapedProperty - { - public string \u6C49\u5B57 { get; set; } - public NestedClassWithEscapedProperty Class { get; set; } - - [JsonExtensionData] - public Dictionary Overflow { get; set; } - } - - public class NestedClassWithEscapedProperty - { - public string \u6F22\u5B57 { get; set; } - } - - private class ClassWithInvalidExtensionPropertyStringString - { - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - } - - private class ClassWithInvalidExtensionPropertyObjectString - { - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - } - - private class ClassWithInvalidExtensionPropertyStringJsonNode - { - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - } - - [Fact] - public static void ExtensionProperty_InvalidDictionary() - { - var obj1 = new ClassWithInvalidExtensionPropertyStringString(); - Assert.Throws(() => JsonSerializer.Serialize(obj1)); - - var obj2 = new ClassWithInvalidExtensionPropertyObjectString(); - Assert.Throws(() => JsonSerializer.Serialize(obj2)); - - var obj3 = new ClassWithInvalidExtensionPropertyStringJsonNode(); - Assert.Throws(() => JsonSerializer.Serialize(obj3)); - } - - private class ClassWithExtensionPropertyAlreadyInstantiated - { - public ClassWithExtensionPropertyAlreadyInstantiated() - { - MyOverflow = new Dictionary(); - } - - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyAsObject - { - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyAsJsonElement - { - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyAsJsonObject - { - [JsonExtensionData] - public JsonObject MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyAsSystemObject - { - [JsonExtensionData] - public object MyOverflow { get; set; } - } - - private class ClassWithMultipleDictionaries - { - [JsonExtensionData] - public Dictionary MyOverflow { get; set; } - - public Dictionary ActualDictionary { get; set; } - } - - [Fact] - public static void DeserializeIntoImmutableDictionaryProperty() - { - // baseline - JsonSerializer.Deserialize(@"{}"); - JsonSerializer.Deserialize(@"{}"); - JsonSerializer.Deserialize(@"{}"); - JsonSerializer.Deserialize(@"{}"); - - Assert.Throws(() => JsonSerializer.Deserialize("{\"hello\":\"world\"}")); - Assert.Throws(() => JsonSerializer.Deserialize("{\"hello\":\"world\"}")); - Assert.Throws(() => JsonSerializer.Deserialize("{\"hello\":\"world\"}")); - Assert.Throws(() => JsonSerializer.Deserialize("{\"hello\":\"world\"}")); - Assert.Throws(() => JsonSerializer.Deserialize("{\"hello\":\"world\"}")); - Assert.Throws(() => JsonSerializer.Deserialize("{\"hello\":\"world\"}")); - } - - [Fact] - public static void SerializeIntoImmutableDictionaryProperty() - { - // attempt to serialize a null immutable dictionary - string expectedJson = "{}"; - var obj = new ClassWithExtensionPropertyAsImmutable(); - var json = JsonSerializer.Serialize(obj); - Assert.Equal(expectedJson, json); - - // attempt to serialize an empty immutable dictionary - expectedJson = "{}"; - obj = new ClassWithExtensionPropertyAsImmutable(); - obj.MyOverflow = ImmutableDictionary.Empty; - json = JsonSerializer.Serialize(obj); - Assert.Equal(expectedJson, json); - - // attempt to serialize a populated immutable dictionary - expectedJson = "{\"hello\":\"world\"}"; - obj = new ClassWithExtensionPropertyAsImmutable(); - var dictionaryStringObject = new Dictionary { { "hello", "world" } }; - obj.MyOverflow = ImmutableDictionary.CreateRange(dictionaryStringObject); - json = JsonSerializer.Serialize(obj); - Assert.Equal(expectedJson, json); - } - - private class ClassWithExtensionPropertyAsImmutable - { - [JsonExtensionData] - public ImmutableDictionary MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyAsImmutableJsonElement - { - [JsonExtensionData] - public ImmutableDictionary MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyPrivateConstructor - { - [JsonExtensionData] - public GenericIDictionaryWrapperPrivateConstructor MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyPrivateConstructorJsonElement - { - [JsonExtensionData] - public GenericIDictionaryWrapperPrivateConstructor MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyCustomIImmutable - { - [JsonExtensionData] - public GenericIImmutableDictionaryWrapper MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyCustomIImmutableJsonElement - { - [JsonExtensionData] - public GenericIImmutableDictionaryWrapper MyOverflow { get; set; } - } - - [Theory] - [InlineData(typeof(ClassWithExtensionPropertyNoGenericParameters))] - [InlineData(typeof(ClassWithExtensionPropertyOneGenericParameter))] - [InlineData(typeof(ClassWithExtensionPropertyThreeGenericParameters))] - public static void DeserializeIntoGenericDictionaryParameterCount(Type type) - { - object obj = JsonSerializer.Deserialize("{\"hello\":\"world\"}", type); - - IDictionary extData = (IDictionary)type.GetProperty("MyOverflow").GetValue(obj)!; - Assert.Equal("world", ((JsonElement)extData["hello"]).GetString()); - } - - private class ClassWithExtensionPropertyNoGenericParameters - { - [JsonExtensionData] - public StringToObjectIDictionaryWrapper MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyOneGenericParameter - { - [JsonExtensionData] - public StringToGenericIDictionaryWrapper MyOverflow { get; set; } - } - - private class ClassWithExtensionPropertyThreeGenericParameters - { - [JsonExtensionData] - public GenericIDictonaryWrapperThreeGenericParameters MyOverflow { get; set; } - } - - [Fact] - public static void CustomObjectConverterInExtensionProperty() - { - const string Json = "{\"hello\": \"world\"}"; - - var options = new JsonSerializerOptions(); - options.Converters.Add(new ObjectConverter()); - - ClassWithExtensionPropertyAsObject obj = JsonSerializer.Deserialize(Json, options); - object overflowProp = obj.MyOverflow["hello"]; - Assert.IsType(overflowProp); - Assert.Equal("world!!!", ((string)overflowProp)); - - string newJson = JsonSerializer.Serialize(obj, options); - Assert.Equal("{\"hello\":\"world!!!\"}", newJson); - } - - private class ObjectConverter : JsonConverter - { - public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return reader.GetString() + "!!!"; - } - - public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options) - { - // Since we are in a user-provided (not internal to S.T.Json) object converter, - // this converter will be called, not the internal string converter. - writer.WriteStringValue((string)value); - } - } - - [Fact] - public static void CustomJsonElementConverterInExtensionProperty() - { - const string Json = "{\"hello\": \"world\"}"; - - var options = new JsonSerializerOptions(); - options.Converters.Add(new JsonElementConverter()); - - ClassWithExtensionPropertyAsJsonElement obj = JsonSerializer.Deserialize(Json, options); - JsonElement overflowProp = obj.MyOverflow["hello"]; - Assert.Equal(JsonValueKind.Undefined, overflowProp.ValueKind); - - string newJson = JsonSerializer.Serialize(obj, options); - Assert.Equal("{\"hello\":{\"Hi\":\"There\"}}", newJson); - } - - private class JsonElementConverter : JsonConverter - { - public override JsonElement Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - // Just return an empty JsonElement. - reader.Skip(); - return new JsonElement(); - } - - public override void Write(Utf8JsonWriter writer, JsonElement value, JsonSerializerOptions options) - { - // Write a string we can test against easily. - writer.WriteStartObject(); - writer.WriteString("Hi", "There"); - writer.WriteEndObject(); - } - } - - [Fact] - public static void CustomJsonObjectConverterInExtensionProperty() - { - const string Json = "{\"hello\": \"world\"}"; - - var options = new JsonSerializerOptions(); - options.Converters.Add(new JsonObjectConverter()); - - // A custom converter for JsonObject is not allowed on an extension property. - InvalidOperationException ex = Assert.Throws(() => - JsonSerializer.Deserialize(Json, options)); - - Assert.Contains("JsonObject", ex.ToString()); - } - - private class JsonObjectConverter : JsonConverter - { - public override JsonObject Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - // Just return an empty JsonElement. - reader.Skip(); - return new JsonObject(); - } - - public override void Write(Utf8JsonWriter writer, JsonObject value, JsonSerializerOptions options) - { - // Write a string we can test against easily. - writer.WriteStartObject(); - writer.WriteString("Hi", "There"); - writer.WriteEndObject(); - } - } + public ExtensionDataTestsDynamic() : base(JsonSerializerWrapperForString.StringSerializer) { } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonSerializerApiValidation.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonSerializerApiValidation.cs index aeb4c30fd2cabd..515579fc26ec85 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonSerializerApiValidation.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonSerializerApiValidation.cs @@ -61,9 +61,10 @@ private class MyPoco { } internal partial class MyDummyContext : JsonSerializerContext { - public MyDummyContext() : base(new JsonSerializerOptions(), new JsonSerializerOptions()) { } - public MyDummyContext(JsonSerializerOptions options) : base(options, new JsonSerializerOptions()) { } + public MyDummyContext() : base(new JsonSerializerOptions()) { } + public MyDummyContext(JsonSerializerOptions options) : base(options) { } public override JsonTypeInfo? GetTypeInfo(Type type) => throw new NotImplementedException(); + protected override JsonSerializerOptions? GeneratedSerializerOptions => null; } private JsonTypeInfo myDummyTypeInfo = GetTypeInfo(); diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/MetadataTests.Options.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/MetadataTests.Options.cs index c25e7803f9220d..567a2776b1e0c8 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/MetadataTests.Options.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/MetadataTests.Options.cs @@ -89,17 +89,20 @@ public void OptionsImmutableAfterBinding() private class MyJsonContext : JsonSerializerContext { - public MyJsonContext() : base(null, null) { } + public MyJsonContext() : base(null) { } - public MyJsonContext(JsonSerializerOptions options) : base(options, null) { } + public MyJsonContext(JsonSerializerOptions options) : base(options) { } public override JsonTypeInfo? GetTypeInfo(Type type) => throw new NotImplementedException(); + + protected override JsonSerializerOptions? GeneratedSerializerOptions => null; } private class MyJsonContextThatSetsOptionsInParameterlessCtor : JsonSerializerContext { - public MyJsonContextThatSetsOptionsInParameterlessCtor() : base(new JsonSerializerOptions(), null) { } + public MyJsonContextThatSetsOptionsInParameterlessCtor() : base(new JsonSerializerOptions()) { } public override JsonTypeInfo? GetTypeInfo(Type type) => throw new NotImplementedException(); + protected override JsonSerializerOptions? GeneratedSerializerOptions => null; } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/NodeInteropTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/NodeInteropTests.cs new file mode 100644 index 00000000000000..a424cb884f5605 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/NodeInteropTests.cs @@ -0,0 +1,10 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Text.Json.Serialization.Tests +{ + public sealed partial class NodeInteropTestsDynamic : NodeInteropTests + { + public NodeInteropTestsDynamic() : base(JsonSerializerWrapperForString.StringSerializer) { } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Object.ReadTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Object.ReadTests.cs index 6a36e96d3818b9..c8a745398af275 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Object.ReadTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Object.ReadTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Text.Json.Nodes; using Xunit; namespace System.Text.Json.Serialization.Tests @@ -655,5 +656,20 @@ public static void TooLittleJsonFails(string json) Assert.Equal(0, reader.BytesConsumed); } + + [Theory] + [InlineData(JsonUnknownTypeHandling.JsonElement, typeof(JsonElement))] + [InlineData(JsonUnknownTypeHandling.JsonNode, typeof(JsonNode))] + public static void ReadSystemObjectWithNumberHandling(JsonUnknownTypeHandling unknownTypeHandling, Type expectedType) + { + var options = new JsonSerializerOptions + { + NumberHandling = JsonNumberHandling.AllowReadingFromString, + UnknownTypeHandling = unknownTypeHandling + }; + + object result = JsonSerializer.Deserialize(@"{ ""key"" : ""42"" }", options); + Assert.IsAssignableFrom(expectedType, result); + } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Object.WriteTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Object.WriteTests.cs index d4e551d6d01b25..c569770e3027e1 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Object.WriteTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Object.WriteTests.cs @@ -138,5 +138,13 @@ public static void EscapingShouldntStackOverflow() Assert.Equal("{\"name\":\"\u6D4B\u8A6611\"}", result); } + + [Fact] + public static void WriteSystemObjectWithNumberHandling() + { + var options = new JsonSerializerOptions { NumberHandling = JsonNumberHandling.AllowReadingFromString }; + string result = JsonSerializer.Serialize(new object(), options); + Assert.Equal("{}", result); + } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/PropertyNameTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/PropertyNameTests.cs index 6a14f3ed63cb85..1423174297bff6 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/PropertyNameTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/PropertyNameTests.cs @@ -1,185 +1,28 @@ -// 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.Collections.Generic; -using System.Text.Encodings.Web; +using System.Threading.Tasks; using Xunit; namespace System.Text.Json.Serialization.Tests { - public static class PropertyNameTests + public sealed partial class PropertyNameTestsDynamic : PropertyNameTests { - [Fact] - public static void CamelCaseDeserializeNoMatch() - { - var options = new JsonSerializerOptions(); - options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - - SimpleTestClass obj = JsonSerializer.Deserialize(@"{""MyInt16"":1}", options); - - // This is 0 (default value) because the data does not match the property "MyInt16" that is assuming camel-casing of "myInt16". - Assert.Equal(0, obj.MyInt16); - } - - [Fact] - public static void CamelCaseDeserializeMatch() - { - var options = new JsonSerializerOptions(); - options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - - SimpleTestClass obj = JsonSerializer.Deserialize(@"{""myInt16"":1}", options); - - // This is 1 because the data matches the property "MyInt16" that is assuming camel-casing of "myInt16". - Assert.Equal(1, obj.MyInt16); - } - - [Fact] - public static void CamelCaseSerialize() - { - var options = new JsonSerializerOptions(); - options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - - SimpleTestClass obj = JsonSerializer.Deserialize(@"{}", options); - - string json = JsonSerializer.Serialize(obj, options); - Assert.Contains(@"""myInt16"":0", json); - Assert.Contains(@"""myInt32"":0", json); - } - - [Fact] - public static void CustomNamePolicy() - { - var options = new JsonSerializerOptions(); - options.PropertyNamingPolicy = new UppercaseNamingPolicy(); - - SimpleTestClass obj = JsonSerializer.Deserialize(@"{""MYINT16"":1}", options); - - // This is 1 because the data matches the property "MYINT16" that is uppercase of "myInt16". - Assert.Equal(1, obj.MyInt16); - } - - [Fact] - public static void NullNamePolicy() - { - var options = new JsonSerializerOptions(); - options.PropertyNamingPolicy = new NullNamingPolicy(); - - // A policy that returns null is not allowed. - Assert.Throws(() => JsonSerializer.Deserialize(@"{}", options)); - Assert.Throws(() => JsonSerializer.Serialize(new SimpleTestClass(), options)); - } - - [Fact] - public static void IgnoreCase() - { - { - // A non-match scenario with no options (case-sensitive by default). - SimpleTestClass obj = JsonSerializer.Deserialize(@"{""myint16"":1}"); - Assert.Equal(0, obj.MyInt16); - } - - { - // A non-match scenario with default options (case-sensitive by default). - var options = new JsonSerializerOptions(); - SimpleTestClass obj = JsonSerializer.Deserialize(@"{""myint16"":1}", options); - Assert.Equal(0, obj.MyInt16); - } - - { - var options = new JsonSerializerOptions(); - options.PropertyNameCaseInsensitive = true; - SimpleTestClass obj = JsonSerializer.Deserialize(@"{""myint16"":1}", options); - Assert.Equal(1, obj.MyInt16); - } - } - - [Fact] - public static void JsonPropertyNameAttribute() - { - { - OverridePropertyNameDesignTime_TestClass obj = JsonSerializer.Deserialize(@"{""Blah"":1}"); - Assert.Equal(1, obj.myInt); - - obj.myObject = 2; - - string json = JsonSerializer.Serialize(obj); - Assert.Contains(@"""Blah"":1", json); - Assert.Contains(@"""BlahObject"":2", json); - } - - // The JsonPropertyNameAttribute should be unaffected by JsonNamingPolicy and PropertyNameCaseInsensitive. - { - var options = new JsonSerializerOptions(); - options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - options.PropertyNameCaseInsensitive = true; - - OverridePropertyNameDesignTime_TestClass obj = JsonSerializer.Deserialize(@"{""Blah"":1}", options); - Assert.Equal(1, obj.myInt); - - string json = JsonSerializer.Serialize(obj); - Assert.Contains(@"""Blah"":1", json); - } - } - - [Fact] - public static void JsonNameAttributeDuplicateDesignTimeFail() - { - { - var options = new JsonSerializerOptions(); - Assert.Throws(() => JsonSerializer.Deserialize("{}", options)); - } - - { - var options = new JsonSerializerOptions(); - Assert.Throws(() => JsonSerializer.Serialize(new DuplicatePropertyNameDesignTime_TestClass(), options)); - } - } + public PropertyNameTestsDynamic() : base(JsonSerializerWrapperForString.StringSerializer) { } [Fact] - public static void JsonNullNameAttribute() + public async Task JsonNullNameAttribute() { var options = new JsonSerializerOptions(); options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; options.PropertyNameCaseInsensitive = true; // A null name in JsonPropertyNameAttribute is not allowed. - Assert.Throws(() => JsonSerializer.Serialize(new NullPropertyName_TestClass(), options)); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(new NullPropertyName_TestClass(), options)); } [Fact] - public static void JsonNameConflictOnCamelCasingFail() - { - { - // Baseline comparison - no options set. - IntPropertyNamesDifferentByCaseOnly_TestClass obj = JsonSerializer.Deserialize("{}"); - JsonSerializer.Serialize(obj); - } - - { - var options = new JsonSerializerOptions(); - options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - - Assert.Throws(() => JsonSerializer.Deserialize("{}", options)); - Assert.Throws(() => JsonSerializer.Serialize(new IntPropertyNamesDifferentByCaseOnly_TestClass(), options)); - } - - { - // Baseline comparison - no options set. - ObjectPropertyNamesDifferentByCaseOnly_TestClass obj = JsonSerializer.Deserialize("{}"); - JsonSerializer.Serialize(obj); - } - - { - var options = new JsonSerializerOptions(); - options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - - Assert.Throws(() => JsonSerializer.Deserialize("{}", options)); - Assert.Throws(() => JsonSerializer.Serialize(new ObjectPropertyNamesDifferentByCaseOnly_TestClass(), options)); - } - } - - [Fact] - public static void JsonNameConflictOnCaseInsensitiveFail() + public async Task JsonNameConflictOnCaseInsensitiveFail() { string json = @"{""myInt"":1,""MyInt"":2}"; @@ -187,407 +30,9 @@ public static void JsonNameConflictOnCaseInsensitiveFail() var options = new JsonSerializerOptions(); options.PropertyNameCaseInsensitive = true; - Assert.Throws(() => JsonSerializer.Deserialize(json, options)); - Assert.Throws(() => JsonSerializer.Serialize(new IntPropertyNamesDifferentByCaseOnly_TestClass(), options)); - } - } - - [Fact] - public static void JsonOutputNotAffectedByCasingPolicy() - { - { - // Baseline. - string json = JsonSerializer.Serialize(new SimpleTestClass()); - Assert.Contains(@"""MyInt16"":0", json); - } - - // The JSON output should be unaffected by PropertyNameCaseInsensitive. - { - var options = new JsonSerializerOptions(); - options.PropertyNameCaseInsensitive = true; - - string json = JsonSerializer.Serialize(new SimpleTestClass(), options); - Assert.Contains(@"""MyInt16"":0", json); - } - } - - [Fact] - public static void EmptyPropertyName() - { - string json = @"{"""":1}"; - - { - var obj = new EmptyPropertyName_TestClass(); - obj.MyInt1 = 1; - - string jsonOut = JsonSerializer.Serialize(obj); - Assert.Equal(json, jsonOut); - } - - { - EmptyPropertyName_TestClass obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyInt1); - } - } - - [Fact] - public static void EmptyPropertyNameInExtensionData() - { - { - string json = @"{"""":42}"; - EmptyClassWithExtensionProperty obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(42, obj.MyOverflow[""].GetInt32()); - } - - { - // Verify that last-in wins. - string json = @"{"""":42, """":43}"; - EmptyClassWithExtensionProperty obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(43, obj.MyOverflow[""].GetInt32()); - } - } - - [Fact] - public static void EmptyPropertyName_WinsOver_ExtensionDataEmptyPropertyName() - { - string json = @"{"""":1}"; - - ClassWithEmptyPropertyNameAndExtensionProperty obj; - - // Create a new options instances to re-set any caches. - JsonSerializerOptions options = new JsonSerializerOptions(); - - // Verify the real property wins over the extension data property. - obj = JsonSerializer.Deserialize(json, options); - Assert.Equal(1, obj.MyInt1); - Assert.Null(obj.MyOverflow); - } - - [Fact] - public static void EmptyPropertyNameAndExtensionData_ExtDataFirst() - { - // Verify any caching treats real property (with empty name) differently than a missing property. - - ClassWithEmptyPropertyNameAndExtensionProperty obj; - - // Create a new options instances to re-set any caches. - JsonSerializerOptions options = new JsonSerializerOptions(); - - // First populate cache with a missing property name. - string json = @"{""DoesNotExist"":42}"; - obj = JsonSerializer.Deserialize(json, options); - Assert.Equal(0, obj.MyInt1); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(42, obj.MyOverflow["DoesNotExist"].GetInt32()); - - // Then use an empty property. - json = @"{"""":43}"; - obj = JsonSerializer.Deserialize(json, options); - Assert.Equal(43, obj.MyInt1); - Assert.Null(obj.MyOverflow); - } - - [Fact] - public static void EmptyPropertyAndExtensionData_PropertyFirst() - { - // Verify any caching treats real property (with empty name) differently than a missing property. - - ClassWithEmptyPropertyNameAndExtensionProperty obj; - - // Create a new options instances to re-set any caches. - JsonSerializerOptions options = new JsonSerializerOptions(); - - // First use an empty property. - string json = @"{"""":43}"; - obj = JsonSerializer.Deserialize(json, options); - Assert.Equal(43, obj.MyInt1); - Assert.Null(obj.MyOverflow); - - // Then populate cache with a missing property name. - json = @"{""DoesNotExist"":42}"; - obj = JsonSerializer.Deserialize(json, options); - Assert.Equal(0, obj.MyInt1); - Assert.Equal(1, obj.MyOverflow.Count); - Assert.Equal(42, obj.MyOverflow["DoesNotExist"].GetInt32()); - } - - [Fact] - public static void UnicodePropertyNames() - { - ClassWithUnicodeProperty obj = JsonSerializer.Deserialize("{\"A\u0467\":1}"); - Assert.Equal(1, obj.A\u0467); - - // Specifying encoder on options does not impact deserialize. - var options = new JsonSerializerOptions(); - options.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping; - - obj = JsonSerializer.Deserialize("{\"A\u0467\":1}", options); - Assert.Equal(1, obj.A\u0467); - - string json; - - // Verify the name is escaped after serialize. - json = JsonSerializer.Serialize(obj); - Assert.Contains(@"""A\u0467"":1", json); - - // With custom escaper - json = JsonSerializer.Serialize(obj, options); - Assert.Contains("\"A\u0467\":1", json); - - // Verify the name is unescaped after deserialize. - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.A\u0467); - - // With custom escaper - obj = JsonSerializer.Deserialize(json, options); - Assert.Equal(1, obj.A\u0467); - } - - [Fact] - public static void UnicodePropertyNamesWithPooledAlloc() - { - // We want to go over StackallocByteThreshold=256 to force a pooled allocation, so this property is 400 chars and 401 bytes. - ClassWithUnicodeProperty obj = JsonSerializer.Deserialize("{\"A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\":1}"); - Assert.Equal(1, obj.A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890); - - // Verify the name is escaped after serialize. - string json = JsonSerializer.Serialize(obj); - Assert.Contains(@"""A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"":1", json); - - // Verify the name is unescaped after deserialize. - obj = JsonSerializer.Deserialize(json); - Assert.Equal(1, obj.A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890); - } - - [Fact] - public static void ExtensionDataDictionarySerialize_DoesNotHonor() - { - var options = new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.CamelCase - }; - - EmptyClassWithExtensionProperty obj = JsonSerializer.Deserialize(@"{""Key1"": 1}", options); - - // Ignore naming policy for extension data properties by default. - Assert.False(obj.MyOverflow.ContainsKey("key1")); - Assert.Equal(1, obj.MyOverflow["Key1"].GetInt32()); - } - - private class ClassWithPropertyNamePermutations - { - public int a { get; set; } - public int aa { get; set; } - public int aaa { get; set; } - public int aaaa { get; set; } - public int aaaaa { get; set; } - public int aaaaaa { get; set; } - - // 7 characters - caching code only keys up to 7. - public int aaaaaaa { get; set; } - public int aaaaaab { get; set; } - - // 8 characters. - public int aaaaaaaa { get; set; } - public int aaaaaaab { get; set; } - - // 9 characters. - public int aaaaaaaaa { get; set; } - public int aaaaaaaab { get; set; } - - public int \u0467 { get; set; } - public int \u0467\u0467 { get; set; } - public int \u0467\u0467a { get; set; } - public int \u0467\u0467b { get; set; } - public int \u0467\u0467\u0467 { get; set; } - public int \u0467\u0467\u0467a { get; set; } - public int \u0467\u0467\u0467b { get; set; } - public int \u0467\u0467\u0467\u0467 { get; set; } - public int \u0467\u0467\u0467\u0467a { get; set; } - public int \u0467\u0467\u0467\u0467b { get; set; } - } - - [Fact] - public static void CachingKeys() - { - ClassWithPropertyNamePermutations obj; - - void Verify() - { - Assert.Equal(1, obj.a); - Assert.Equal(2, obj.aa); - Assert.Equal(3, obj.aaa); - Assert.Equal(4, obj.aaaa); - Assert.Equal(5, obj.aaaaa); - Assert.Equal(6, obj.aaaaaa); - Assert.Equal(7, obj.aaaaaaa); - Assert.Equal(7, obj.aaaaaab); - Assert.Equal(8, obj.aaaaaaaa); - Assert.Equal(8, obj.aaaaaaab); - Assert.Equal(9, obj.aaaaaaaaa); - Assert.Equal(9, obj.aaaaaaaab); - - Assert.Equal(2, obj.\u0467); - Assert.Equal(4, obj.\u0467\u0467); - Assert.Equal(5, obj.\u0467\u0467a); - Assert.Equal(5, obj.\u0467\u0467b); - Assert.Equal(6, obj.\u0467\u0467\u0467); - Assert.Equal(7, obj.\u0467\u0467\u0467a); - Assert.Equal(7, obj.\u0467\u0467\u0467b); - Assert.Equal(8, obj.\u0467\u0467\u0467\u0467); - Assert.Equal(9, obj.\u0467\u0467\u0467\u0467a); - Assert.Equal(9, obj.\u0467\u0467\u0467\u0467b); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.DeserializeWrapper(json, options)); + await Assert.ThrowsAsync(async () => await JsonSerializerWrapperForString.SerializeWrapper(new IntPropertyNamesDifferentByCaseOnly_TestClass(), options)); } - - obj = new ClassWithPropertyNamePermutations - { - a = 1, - aa = 2, - aaa = 3, - aaaa = 4, - aaaaa = 5, - aaaaaa = 6, - aaaaaaa = 7, - aaaaaab = 7, - aaaaaaaa = 8, - aaaaaaab = 8, - aaaaaaaaa = 9, - aaaaaaaab = 9, - \u0467 = 2, - \u0467\u0467 = 4, - \u0467\u0467a = 5, - \u0467\u0467b = 5, - \u0467\u0467\u0467 = 6, - \u0467\u0467\u0467a = 7, - \u0467\u0467\u0467b = 7, - \u0467\u0467\u0467\u0467 = 8, - \u0467\u0467\u0467\u0467a = 9, - \u0467\u0467\u0467\u0467b = 9, - }; - - // Verify baseline. - Verify(); - - string json = JsonSerializer.Serialize(obj); - - // Verify the length is consistent with a verified value. - Assert.Equal(354, json.Length); - - obj = JsonSerializer.Deserialize(json); - - // Verify round-tripped object. - Verify(); } - - [Theory] - [InlineData(0x1, 'v')] - [InlineData(0x1, '\u0467')] - [InlineData(0x10, 'v')] - [InlineData(0x10, '\u0467')] - [InlineData(0x100, 'v')] - [InlineData(0x100, '\u0467')] - [InlineData(0x1000, 'v')] - [InlineData(0x1000, '\u0467')] - [InlineData(0x10000, 'v')] - [InlineData(0x10000, '\u0467')] - public static void LongPropertyNames(int propertyLength, char ch) - { - // Although the CLR may limit member length to 1023 bytes, the serializer doesn't have a hard limit. - - string val = new string(ch, propertyLength); - string json = @"{""" + val + @""":1}"; - - EmptyClassWithExtensionProperty obj = JsonSerializer.Deserialize(json); - - Assert.True(obj.MyOverflow.ContainsKey(val)); - - var options = new JsonSerializerOptions - { - // Avoid escaping '\u0467'. - Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping - }; - - string jsonRoundTripped = JsonSerializer.Serialize(obj, options); - Assert.Equal(json, jsonRoundTripped); - } - - [Fact] - public static void BadNamingPolicy_ThrowsInvalidOperation() - { - var options = new JsonSerializerOptions { DictionaryKeyPolicy = new NullNamingPolicy() }; - - var inputPrimitive = new Dictionary - { - { "validKey", 1 } - }; - - Assert.Throws(() => JsonSerializer.Serialize(inputPrimitive, options)); - - var inputClass = new Dictionary - { - { "validKey", new OverridePropertyNameDesignTime_TestClass() } - }; - - Assert.Throws(() => JsonSerializer.Serialize(inputClass, options)); - } - } - - public class OverridePropertyNameDesignTime_TestClass - { - [JsonPropertyName("Blah")] - public int myInt { get; set; } - - [JsonPropertyName("BlahObject")] - public object myObject { get; set; } - } - - public class DuplicatePropertyNameDesignTime_TestClass - { - [JsonPropertyName("Blah")] - public int MyInt1 { get; set; } - - [JsonPropertyName("Blah")] - public int MyInt2 { get; set; } - } - - public class EmptyPropertyName_TestClass - { - [JsonPropertyName("")] - public int MyInt1 { get; set; } - } - - public class NullPropertyName_TestClass - { - [JsonPropertyName(null)] - public int MyInt1 { get; set; } - } - - public class IntPropertyNamesDifferentByCaseOnly_TestClass - { - public int myInt { get; set; } - public int MyInt { get; set; } - } - - public class ObjectPropertyNamesDifferentByCaseOnly_TestClass - { - public int myObject { get; set; } - public int MyObject { get; set; } - } - - public class EmptyClassWithExtensionProperty - { - [JsonExtensionData] - public IDictionary MyOverflow { get; set; } - } - - public class ClassWithEmptyPropertyNameAndExtensionProperty - { - [JsonPropertyName("")] - public int MyInt1 { get; set; } - - [JsonExtensionData] - public IDictionary MyOverflow { get; set; } } } diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.WriteTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.WriteTests.cs index 35d96103569f37..d7e6e92ba90e02 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.WriteTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.WriteTests.cs @@ -289,7 +289,7 @@ public async Task LargeJsonFile(int bufferSize) [InlineData(1000, false, false)] public async Task VeryLargeJsonFileTest(int payloadSize, bool ignoreNull, bool writeIndented) { - List list = PopulateLargeObject(payloadSize); + List list = JsonTestHelper.PopulateLargeObject(payloadSize); JsonSerializerOptions options = new JsonSerializerOptions { @@ -337,10 +337,10 @@ public async Task DeepNestedJsonFileTest(int depthFactor, bool ignoreNull, bool int length = ListLength * depthFactor; List[] orders = new List[length]; - orders[0] = PopulateLargeObject(1); + orders[0] = JsonTestHelper.PopulateLargeObject(1); for (int i = 1; i < length; i++ ) { - orders[i] = PopulateLargeObject(1); + orders[i] = JsonTestHelper.PopulateLargeObject(1); orders[i - 1][0].RelatedOrder = orders[i]; } @@ -381,10 +381,10 @@ public async Task NestedJsonFileCircularDependencyTest(int depthFactor) int length = ListLength * depthFactor; List[] orders = new List[length]; - orders[0] = PopulateLargeObject(1000); + orders[0] = JsonTestHelper.PopulateLargeObject(1000); for (int i = 1; i < length; i++) { - orders[i] = PopulateLargeObject(1); + orders[i] = JsonTestHelper.PopulateLargeObject(1); orders[i - 1][0].RelatedOrder = orders[i]; } @@ -464,188 +464,6 @@ private static List GenerateListOfSize(int size) } return list; } - - internal static List PopulateLargeObject(int size) - { - List orders = new List(size); - for (int i = 0; i < size; i++) - { - Order order = new Order - { - OrderNumber = i, - Customer = new User - { - UserId = "222ffbbb888kkk", - Name = "John Doe", - Username = "johndoe", - CreatedAt = new DateTime(), - ImageId = string.Empty, - UserType = UserType.Customer, - UpdatedAt = new DateTime(), - TwitterId = string.Empty, - FacebookId = "9988998877662222111", - SubscriptionType = 2, - IsNew = true, - IsEmployee = false - }, - ShippingInfo = new List - { - new ShippingInfo() - { - OrderNumber = i, - Employee = new User - { - UserId = "222ffbbb888" + i, - Name = "Shipping Coordinator", - Username = "coordinator" + i, - CreatedAt = new DateTime(), - ImageId = string.Empty, - UserType = UserType.Employee, - UpdatedAt = new DateTime(), - TwitterId = string.Empty, - SubscriptionType = 0, - IsEmployee = true - }, - CarrierId = "TTT123999MMM", - ShippingType = "Ground", - EstimatedDelivery = new DateTime(), - Tracking = new Uri("http://TestShipCompany.test/track/123" + i), - CarrierName = "TestShipCompany", - HandlingInstruction = "Do cats eat bats? Do cats eat bats. Do cats eat bats? Do cats eat bats. Do cats eat bats? Do cats eat bats. Do cats eat bats? Do cats eat bats", - CurrentStatus = "Out for delivery", - IsDangerous = false - } - }, - OneTime = true, - Cancelled = false, - IsGift = i % 2 == 0, - IsGPickUp = i % 5 == 0, - ShippingAddress = new Address() - { - City = "Redmond" - }, - PickupAddress = new Address - { - City = "Bellevue" - }, - Coupon = SampleEnumInt64.Max, - UserInteractions = new List - { - new Comment - { - Id = 200 + i, - OrderNumber = i, - Customer = new User - { - UserId = "222ffbbb888kkk", - Name = "John Doe", - Username = "johndoe", - CreatedAt = new DateTime(), - ImageId = string.Empty, - UserType = UserType.Customer, - UpdatedAt = new DateTime(), - TwitterId = "twitterId" + i, - FacebookId = "9988998877662222111", - SubscriptionType = 2, - IsNew = true, - IsEmployee = false - }, - Title = "Green Field", - Message = "Down, down, down. Would the fall never come to an end! 'I wonder how many miles I've fallen by this time. I think-' (for, you see, Alice had learnt several things of this sort in her lessons in the schoolroom, and though this was not a very good opportunity for showing off her knowledge, as there was no one to listen to her, still it was good practice to say it over) '-yes, that's about the right distance-but then I wonder what Latitude or Longitude I've got to", - Responses = new List() - } - }, - Created = new DateTime(2019, 11, 10), - Confirmed = new DateTime(2019, 11, 11), - ShippingDate = new DateTime(2019, 11, 12), - EstimatedDelivery = new DateTime(2019, 11, 15), - ReviewedBy = new User() - { - UserId = "222ffbbb888" + i, - Name = "Shipping Coordinator", - Username = "coordinator" + i, - CreatedAt = new DateTime(), - ImageId = string.Empty, - UserType = UserType.Employee, - UpdatedAt = new DateTime(), - TwitterId = string.Empty, - SubscriptionType = 0, - IsEmployee = true - } - }; - List products = new List(); - for (int j = 0; j < i % 4; j++) - { - Product product = new Product() - { - ProductId = Guid.NewGuid(), - Name = "Surface Pro", - SKU = "LL123" + j, - Brand = new TestClassWithInitializedProperties(), - ProductCategory = new SimpleTestClassWithNonGenericCollectionWrappers(), - Description = "Down, down, down. Would the fall never come to an end! 'I wonder how many miles I've fallen by this time. I think-' (for, you see, Alice had learnt several things of this sort in her lessons in the schoolroom, and though this was not a very good opportunity for showing off her knowledge, as there was no one to listen to her, still it was good practice to say it over) '-yes, that's about the right distance-but then I wonder what Latitude or Longitude I've got to", - Created = new DateTime(2000, 10, 12), - Title = "Surface Pro 6 for Business - 512GB", - Price = new Price(), - BestChoice = true, - AverageStars = 4.8f, - Featured = true, - ProductRestrictions = new TestClassWithInitializedProperties(), - SalesInfo = new SimpleTestClassWithGenericCollectionWrappers(), - Origin = SampleEnum.One, - Manufacturer = new BasicCompany(), - Fragile = true, - DetailsUrl = new Uri("http://dotnet.test/link/entries/entry/1"), - NetWeight = 2.7m, - GrossWeight = 3.3m, - Length = i, - Height = i + 1, - Width = i + 2, - FeaturedImage = new FeaturedImage(), - PreviewImage = new PreviewImage(), - KeyWords = new List { "surface", "pro", "laptop" }, - RelatedImages = new List(), - RelatedVideo = new Uri("http://dotnet.test/link/entries/entry/2"), - GuaranteeStartsAt = new DateTime(), - GuaranteeEndsAt = new DateTime(), - IsActive = true, - RelatedProducts = new List() - }; - product.SalesInfo.Initialize(); - List reviews = new List(); - for (int k = 0; k < i % 3; k++) - { - - Review review = new Review - { - Customer = new User - { - UserId = "333344445555", - Name = "Customer" + i + k, - Username = "cust" + i + k, - CreatedAt = new DateTime(), - ImageId = string.Empty, - UserType = UserType.Customer, - SubscriptionType = k - }, - ProductSku = product.SKU, - CustomerName = "Customer" + i + k, - Stars = j + k, - Title = $"Title {i}{j}{k}", - Comment = "", - Images = new List{ new Uri($"http://dotnet.test/link/images/image/{k}"), new Uri($"http://dotnet.test/link/images/image/{j}")}, - ReviewId = i + j +k - }; - reviews.Add(review); - } - product.Reviews = reviews; - products.Add(product); - } - order.Products = products; - orders.Add(order); - } - return orders; - } } public sealed class TestStream : Stream diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/UnsupportedTypesTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/UnsupportedTypesTests.cs new file mode 100644 index 00000000000000..8de761544db237 --- /dev/null +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/UnsupportedTypesTests.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Text.Json.Serialization.Tests +{ + public sealed partial class UnsupportedTypesTestsDynamic : UnsupportedTypesTests + { + public UnsupportedTypesTestsDynamic() : base( + JsonSerializerWrapperForString.StringSerializer, + supportsJsonPathOnSerialize: true) + { + } + } +} diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/System.Text.Json.Tests.csproj b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/System.Text.Json.Tests.csproj index 3485690c39a559..475d0b30ee3bfb 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/System.Text.Json.Tests.csproj +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/System.Text.Json.Tests.csproj @@ -40,12 +40,16 @@ + + + + @@ -63,6 +67,7 @@ + @@ -85,7 +90,6 @@ - @@ -152,6 +156,7 @@ + @@ -170,7 +175,6 @@ - @@ -178,6 +182,7 @@ + @@ -212,6 +217,6 @@ - + diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs index 44b8d2bffb004a..1c172d74a5eeec 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs @@ -1025,7 +1025,7 @@ public static void TestingGetString(string jsonString) var expectedPropertyNames = new List(); var expectedValues = new List(); - var jsonNewtonsoft = new JsonTextReader(new StringReader(jsonString)); + var jsonNewtonsoft = new JsonTextReader(new StringReader(jsonString)) { MaxDepth = null }; while (jsonNewtonsoft.Read()) { if (jsonNewtonsoft.TokenType == JsonToken.String) diff --git a/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj b/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj index 77351ca146f7ae..ce562d56914ff0 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj +++ b/src/libraries/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj @@ -6,7 +6,6 @@ - @@ -51,6 +50,7 @@ + diff --git a/src/libraries/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj b/src/libraries/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj index 3f57e01ad4d1be..f699d479cc83a9 100644 --- a/src/libraries/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj +++ b/src/libraries/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj @@ -14,7 +14,7 @@ - + \ No newline at end of file diff --git a/src/libraries/System.Threading.AccessControl/src/CompatibilitySuppressions.xml b/src/libraries/System.Threading.AccessControl/src/CompatibilitySuppressions.xml index e3b9814aa9f0ff..1fabb2d07af7b1 100644 --- a/src/libraries/System.Threading.AccessControl/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Threading.AccessControl/src/CompatibilitySuppressions.xml @@ -1,10 +1,5 @@ - + - - CP0001 - lib/netstandard2.0/System.Threading.AccessControl.dll - lib/net461/System.Threading.AccessControl.dll - PKV006 .NETFramework,Version=v4.6 diff --git a/src/libraries/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj b/src/libraries/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj index f71a0d7bc6dc68..eef07db09ff2aa 100644 --- a/src/libraries/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj +++ b/src/libraries/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj @@ -4,6 +4,9 @@ true enable true + + false + 0 Provides support for managing access and audit control lists for synchronization primitives. Commonly Used Types: @@ -62,15 +65,16 @@ System.Security.AccessControl.SemaphoreSecurity + + + - - diff --git a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.ForEachAsync.cs b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.ForEachAsync.cs index ee56e0d1a18d15..3a7d40b7d0489b 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.ForEachAsync.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.ForEachAsync.cs @@ -480,18 +480,10 @@ public void Complete() } else { - // Fault with all of the received exceptions, but filter out those due to inner cancellation, - // as they're effectively an implementation detail and stem from the original exception. - Debug.Assert(_exceptions.Count > 0, "If _exceptions was created, it should have also been populated."); - for (int i = 0; i < _exceptions.Count; i++) - { - if (_exceptions[i] is OperationCanceledException oce && oce.CancellationToken == Cancellation.Token) - { - _exceptions[i] = null!; - } - } - _exceptions.RemoveAll(e => e is null); - Debug.Assert(_exceptions.Count > 0, "Since external cancellation wasn't requested, there should have been a non-cancellation exception that triggered internal cancellation."); + // Fail the task with the resulting exceptions. The first should be the initial + // exception that triggered the operation to shut down. The others, if any, may + // include cancellation exceptions from other concurrent operations being canceled + // in response to the primary exception. taskSet = TrySetException(_exceptions); } diff --git a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs index 91747d3828b622..97ac99bc159600 100644 --- a/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs +++ b/src/libraries/System.Threading.Tasks.Parallel/tests/ParallelForEachAsyncTests.cs @@ -618,6 +618,64 @@ static async IAsyncEnumerable Iterate() Assert.True(t.IsCanceled); } + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [InlineData(false)] + [InlineData(true)] + public async Task Cancellation_FaultsForOceForNonCancellation(bool internalToken) + { + static async IAsyncEnumerable Iterate() + { + int counter = 0; + while (true) + { + await Task.Yield(); + yield return counter++; + } + } + + var cts = new CancellationTokenSource(); + + Task t = Parallel.ForEachAsync(Iterate(), new ParallelOptions { CancellationToken = cts.Token }, (item, cancellationToken) => + { + throw new OperationCanceledException(internalToken ? cancellationToken : cts.Token); + }); + + await Assert.ThrowsAnyAsync(() => t); + Assert.True(t.IsFaulted); + } + + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + [InlineData(0, 4)] + [InlineData(1, 4)] + [InlineData(2, 4)] + [InlineData(3, 4)] + [InlineData(4, 4)] + public async Task Cancellation_InternalCancellationExceptionsArentFilteredOut(int numThrowingNonCanceledOce, int total) + { + var cts = new CancellationTokenSource(); + + var barrier = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + int remainingCount = total; + + Task t = Parallel.ForEachAsync(Enumerable.Range(0, total), new ParallelOptions { CancellationToken = cts.Token, MaxDegreeOfParallelism = total }, async (item, cancellationToken) => + { + // Wait for all operations to be started + if (Interlocked.Decrement(ref remainingCount) == 0) + { + barrier.SetResult(); + } + await barrier.Task; + + throw item < numThrowingNonCanceledOce ? + new OperationCanceledException(cancellationToken) : + throw new FormatException(); + }); + + await Assert.ThrowsAnyAsync(() => t); + Assert.Equal(total, t.Exception.InnerExceptions.Count); + Assert.Equal(numThrowingNonCanceledOce, t.Exception.InnerExceptions.Count(e => e is OperationCanceledException)); + } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] public void Exception_FromGetEnumerator_Sync() { @@ -672,7 +730,6 @@ static IEnumerable Iterate() Task t = Parallel.ForEachAsync(Iterate(), (item, cancellationToken) => default); await Assert.ThrowsAsync(() => t); Assert.True(t.IsFaulted); - Assert.Equal(1, t.Exception.InnerExceptions.Count); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] @@ -694,7 +751,6 @@ static async IAsyncEnumerable Iterate() Task t = Parallel.ForEachAsync(Iterate(), (item, cancellationToken) => default); await Assert.ThrowsAsync(() => t); Assert.True(t.IsFaulted); - Assert.Equal(1, t.Exception.InnerExceptions.Count); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] @@ -771,7 +827,6 @@ public async Task Exception_FromDispose_Sync() Task t = Parallel.ForEachAsync((IEnumerable)new ThrowsExceptionFromDispose(), (item, cancellationToken) => default); await Assert.ThrowsAsync(() => t); Assert.True(t.IsFaulted); - Assert.Equal(1, t.Exception.InnerExceptions.Count); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] @@ -780,7 +835,6 @@ public async Task Exception_FromDispose_Async() Task t = Parallel.ForEachAsync((IAsyncEnumerable)new ThrowsExceptionFromDispose(), (item, cancellationToken) => default); await Assert.ThrowsAsync(() => t); Assert.True(t.IsFaulted); - Assert.Equal(1, t.Exception.InnerExceptions.Count); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] diff --git a/src/libraries/System.Threading.Tasks/tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs b/src/libraries/System.Threading.Tasks/tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs index d90c0685451f3a..d4f156df42bc40 100644 --- a/src/libraries/System.Threading.Tasks/tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs +++ b/src/libraries/System.Threading.Tasks/tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs @@ -523,6 +523,7 @@ public static void CancellationDoesntResultInEventFiring() TaskScheduler.UnobservedTaskException -= handler; } + [ActiveIssue("https://github.com/dotnet/runtime/issues/57751")] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] public static async Task AsyncMethodsDropsStateMachineAndExecutionContextUponCompletion() { diff --git a/src/libraries/System.Threading.Tasks/tests/Task/ExecutionContextFlowTest.cs b/src/libraries/System.Threading.Tasks/tests/Task/ExecutionContextFlowTest.cs index 8374c56056996a..5ba5ec4922ab33 100644 --- a/src/libraries/System.Threading.Tasks/tests/Task/ExecutionContextFlowTest.cs +++ b/src/libraries/System.Threading.Tasks/tests/Task/ExecutionContextFlowTest.cs @@ -29,6 +29,7 @@ public void SuppressFlow_TaskCapturesContextAccordingly(bool suppressFlow) } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/57331")] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))] public static async Task TaskDropsExecutionContextUponCompletion() { diff --git a/src/libraries/System.Threading/ref/System.Threading.cs b/src/libraries/System.Threading/ref/System.Threading.cs index 1237c49cecaedc..e55f5c656315b7 100644 --- a/src/libraries/System.Threading/ref/System.Threading.cs +++ b/src/libraries/System.Threading/ref/System.Threading.cs @@ -50,6 +50,7 @@ public sealed partial class AutoResetEvent : System.Threading.EventWaitHandle { public AutoResetEvent(bool initialState) : base (default(bool), default(System.Threading.EventResetMode)) { } } +#if !BUILDING_CORELIB_REFERENCE public partial class Barrier : System.IDisposable { public Barrier(int participantCount) { } @@ -86,7 +87,9 @@ protected BarrierPostPhaseException(System.Runtime.Serialization.SerializationIn public BarrierPostPhaseException(string? message) { } public BarrierPostPhaseException(string? message, System.Exception? innerException) { } } +#endif public delegate void ContextCallback(object? state); +#if !BUILDING_CORELIB_REFERENCE public partial class CountdownEvent : System.IDisposable { public CountdownEvent(int initialCount) { } @@ -117,6 +120,7 @@ public void Wait(System.Threading.CancellationToken cancellationToken) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } } +#endif public enum EventResetMode { AutoReset = 0, @@ -147,6 +151,7 @@ public static void RestoreFlow() { } public static void Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object? state) { } public static System.Threading.AsyncFlowControl SuppressFlow() { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial class HostExecutionContext : System.IDisposable { public HostExecutionContext() { } @@ -163,6 +168,7 @@ public HostExecutionContextManager() { } public virtual void Revert(object previousState) { } public virtual object SetHostExecutionContext(System.Threading.HostExecutionContext hostExecutionContext) { throw null; } } +#endif public static partial class Interlocked { public static int Add(ref int location1, int value) { throw null; } @@ -235,6 +241,7 @@ public static partial class LazyInitializer public static T EnsureInitialized([System.Diagnostics.CodeAnalysis.NotNullAttribute] ref T? target, System.Func valueFactory) where T : class { throw null; } public static T EnsureInitialized([System.Diagnostics.CodeAnalysis.NotNullAttribute] ref T? target, [System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("syncLock")] ref object? syncLock, System.Func valueFactory) where T : class { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial struct LockCookie { private int _dummyPrimitive; @@ -244,6 +251,7 @@ public partial struct LockCookie public static bool operator ==(System.Threading.LockCookie a, System.Threading.LockCookie b) { throw null; } public static bool operator !=(System.Threading.LockCookie a, System.Threading.LockCookie b) { throw null; } } +#endif public partial class LockRecursionException : System.Exception { public LockRecursionException() { } @@ -321,6 +329,7 @@ public Mutex(bool initiallyOwned, string? name) { } public void ReleaseMutex() { } public static bool TryOpenExisting(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Threading.Mutex? result) { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public sealed partial class ReaderWriterLock : System.Runtime.ConstrainedExecution.CriticalFinalizerObject { public ReaderWriterLock() { } @@ -345,6 +354,7 @@ public void RestoreLock(ref System.Threading.LockCookie lockCookie) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] public System.Threading.LockCookie UpgradeToWriterLock(System.TimeSpan timeout) { throw null; } } +#endif public partial class ReaderWriterLockSlim : System.IDisposable { public ReaderWriterLockSlim() { } diff --git a/src/libraries/System.Threading/tests/SemaphoreSlimTests.cs b/src/libraries/System.Threading/tests/SemaphoreSlimTests.cs index 2682166b24c512..7aabd01c39f1e2 100644 --- a/src/libraries/System.Threading/tests/SemaphoreSlimTests.cs +++ b/src/libraries/System.Threading/tests/SemaphoreSlimTests.cs @@ -2,7 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Threading.Tasks; +using Microsoft.DotNet.RemoteExecutor; using Xunit; namespace System.Threading.Tests @@ -615,5 +617,28 @@ public static void TestConcurrentWaitAndWaitAsync(int syncWaiters, int asyncWait semaphore.Release(totalWaiters / 2); Task.WaitAll(tasks); } + + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + public void WaitAsync_Timeout_NoUnhandledException() + { + RemoteExecutor.Invoke(async () => + { + Exception error = null; + TaskScheduler.UnobservedTaskException += (s, e) => Volatile.Write(ref error, e.Exception); + + var sem = new SemaphoreSlim(0); + for (int i = 0; i < 2; ++i) + { + await sem.WaitAsync(1); + GC.Collect(); + GC.WaitForPendingFinalizers(); + } + + if (Volatile.Read(ref error) is Exception e) + { + throw e; + } + }).Dispose(); + } } } diff --git a/src/libraries/System.Windows.Extensions/src/CompatibilitySuppressions.xml b/src/libraries/System.Windows.Extensions/src/CompatibilitySuppressions.xml index c6379c3e4ac3ca..7dc1f27798f23a 100644 --- a/src/libraries/System.Windows.Extensions/src/CompatibilitySuppressions.xml +++ b/src/libraries/System.Windows.Extensions/src/CompatibilitySuppressions.xml @@ -1,12 +1,12 @@ - + PKV006 - .NETCoreapp,Version=v3.0 + .NETCoreApp,Version=v3.0 PKV007 - .NETCoreapp,Version=v3.0-win + .NETCoreApp,Version=v3.0-win - \ No newline at end of file + diff --git a/src/libraries/System.Xml.XmlSerializer/ref/System.Xml.XmlSerializer.cs b/src/libraries/System.Xml.XmlSerializer/ref/System.Xml.XmlSerializer.cs index cfe776222b80fe..f53a671de838c8 100644 --- a/src/libraries/System.Xml.XmlSerializer/ref/System.Xml.XmlSerializer.cs +++ b/src/libraries/System.Xml.XmlSerializer/ref/System.Xml.XmlSerializer.cs @@ -734,11 +734,11 @@ public event System.Xml.Serialization.UnreferencedObjectEventHandler Unreference [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Members from deserialized types may be trimmed if not referenced directly")] public object? Deserialize(System.Xml.XmlReader xmlReader, System.Xml.Serialization.XmlDeserializationEvents events) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Members from serialized types may be trimmed if not referenced directly")] - public static System.Xml.Serialization.XmlSerializer[] FromMappings(System.Xml.Serialization.XmlMapping[]? mappings) { throw null; } + public static System.Xml.Serialization.XmlSerializer?[] FromMappings(System.Xml.Serialization.XmlMapping[]? mappings) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Members from serialized types may be trimmed if not referenced directly")] - public static System.Xml.Serialization.XmlSerializer[] FromMappings(System.Xml.Serialization.XmlMapping[]? mappings, System.Type? type) { throw null; } + public static System.Xml.Serialization.XmlSerializer?[] FromMappings(System.Xml.Serialization.XmlMapping[]? mappings, System.Type? type) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Members from serialized types may be trimmed if not referenced directly")] - public static System.Xml.Serialization.XmlSerializer[] FromTypes(System.Type[]? types) { throw null; } + public static System.Xml.Serialization.XmlSerializer?[] FromTypes(System.Type[]? types) { throw null; } public static string GetXmlSerializerAssemblyName(System.Type type) { throw null; } public static string GetXmlSerializerAssemblyName(System.Type type, string? defaultNamespace) { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Members from serialized types may be trimmed if not referenced directly")] diff --git a/src/libraries/externals.csproj b/src/libraries/externals.csproj index 6ef3ddc0f19015..969ed9603a2cda 100644 --- a/src/libraries/externals.csproj +++ b/src/libraries/externals.csproj @@ -9,6 +9,7 @@ true false true + true @@ -16,7 +17,7 @@ Version="$(MicrosoftDiaSymReaderNativeVersion)" /> - + - + + + + + + + + + + diff --git a/src/libraries/sendtohelixhelp.proj b/src/libraries/sendtohelixhelp.proj index 14cf90630710d4..93cbb9aca5c907 100644 --- a/src/libraries/sendtohelixhelp.proj +++ b/src/libraries/sendtohelixhelp.proj @@ -294,7 +294,7 @@ $(AppleTestTarget) - + false @@ -415,10 +415,10 @@ - + $(_BuildWasmAppsPayloadArchive) - set "HELIX_XUNIT_ARGS=-class Wasm.Build.Tests.%(Identity)" - export "HELIX_XUNIT_ARGS=-class Wasm.Build.Tests.%(Identity)" + set "HELIX_XUNIT_ARGS=-class %(Identity)" + export "HELIX_XUNIT_ARGS=-class %(Identity)" $(HelixCommand) $(_workItemTimeout) diff --git a/src/libraries/shims/ApiCompat.proj b/src/libraries/shims/ApiCompat.proj index 4ade3e1c90441e..d28a09f2d21372 100644 --- a/src/libraries/shims/ApiCompat.proj +++ b/src/libraries/shims/ApiCompat.proj @@ -3,9 +3,9 @@ false - net5.0 + net6.0 microsoft.netcore.app.ref - 5.0.0 + 6.0.0 diff --git a/src/libraries/shims/ApiCompatBaseline.PreviousNetCoreApp.txt b/src/libraries/shims/ApiCompatBaseline.PreviousNetCoreApp.txt index 69f17447741d89..740cf4995ce1bb 100644 --- a/src/libraries/shims/ApiCompatBaseline.PreviousNetCoreApp.txt +++ b/src/libraries/shims/ApiCompatBaseline.PreviousNetCoreApp.txt @@ -68,8 +68,8 @@ CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerAttribute' on ' CannotRemoveAttribute : Attribute 'System.ComponentModel.DesignerAttribute' exists on 'System.ComponentModel.MarshalByValueComponent' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.ComponentModel.TypeDescriptionProvider.CreateInstance(System.IServiceProvider, System.Type, System.Type[], System.Object[])' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.ComponentModel.TypeDescriptor.CreateInstance(System.IServiceProvider, System.Type, System.Type[], System.Object[])' in the contract but not the implementation. -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MaxWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("windows")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MinWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("windows")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. +CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MaxWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("freebsd")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. +CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MinWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("freebsd")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.AllowNullAttribute' exists on parameter 'value' on member 'System.Net.Cookie.Name.set(System.String)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Net.HttpListener.ExtendedProtectionPolicy.set(System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Net.HttpListenerResponse.Abort()' in the contract but not the implementation. @@ -97,8 +97,8 @@ CannotChangeAttribute : Attribute 'System.ComponentModel.DesignerAttribute' on ' CannotRemoveAttribute : Attribute 'System.ComponentModel.DesignerAttribute' exists on 'System.ComponentModel.MarshalByValueComponent' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.ComponentModel.TypeDescriptionProvider.CreateInstance(System.IServiceProvider, System.Type, System.Type[], System.Object[])' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.ComponentModel.TypeDescriptor.CreateInstance(System.IServiceProvider, System.Type, System.Type[], System.Object[])' in the contract but not the implementation. -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MaxWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("windows")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MinWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("windows")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. +CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MaxWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("freebsd")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. +CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MinWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("freebsd")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.AllowNullAttribute' exists on parameter 'value' on member 'System.Net.Cookie.Name.set(System.String)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Net.HttpListener.ExtendedProtectionPolicy.set(System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy)' in the contract but not the implementation. CannotRemoveAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' exists on 'System.Net.HttpListenerResponse.Abort()' in the contract but not the implementation. @@ -130,8 +130,8 @@ CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatfo CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Console.WindowHeight.get()' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("android")]' in the implementation. CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Console.WindowWidth.get()' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("android")]' in the implementation. Compat issues with assembly System.Diagnostics.Process: -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MaxWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("windows")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. -CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MinWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("windows")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. +CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MaxWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("freebsd")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. +CannotChangeAttribute : Attribute 'System.Runtime.Versioning.SupportedOSPlatformAttribute' on 'System.Diagnostics.Process.MinWorkingSet.set(System.IntPtr)' changed from '[SupportedOSPlatformAttribute("freebsd")]' in the contract to '[SupportedOSPlatformAttribute("freebsd")]' in the implementation. Compat issues with assembly System.Net: CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.AllowNullAttribute' exists on parameter 'value' on member 'System.Net.Cookie.Name.set(System.String)' in the contract but not the implementation. Compat issues with assembly System.Net.HttpListener: diff --git a/src/libraries/src.proj b/src/libraries/src.proj index 8b38ce5b449390..4e0fea066f7507 100644 --- a/src/libraries/src.proj +++ b/src/libraries/src.proj @@ -14,6 +14,11 @@ Microsoft.Windows.Compatibility\src\Microsoft.Windows.Compatibility.csproj" Condition="'$(BuildAllConfigurations)' != 'true'" /> + + <_allSrc Remove="Microsoft.Extensions.DependencyInjection.Specification.Tests\src\Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj; + Microsoft.Windows.Compatibility\src\Microsoft.Windows.Compatibility.csproj" + Condition="'$(DotNetBuildFromSource)' == 'true'" /> + diff --git a/src/libraries/testPackages/packageSettings/System.Runtime.InteropServices.NFloat.Internal/settings.targets b/src/libraries/testPackages/packageSettings/System.Runtime.InteropServices.NFloat.Internal/settings.targets new file mode 100644 index 00000000000000..eaa4cdfb1bb52c --- /dev/null +++ b/src/libraries/testPackages/packageSettings/System.Runtime.InteropServices.NFloat.Internal/settings.targets @@ -0,0 +1,5 @@ + + + true + + \ No newline at end of file diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index b5237feb3410af..d23edef411c61e 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -15,7 +15,17 @@ - + + + + + + + + + + + @@ -81,7 +91,6 @@ - @@ -120,6 +129,7 @@ + @@ -139,77 +149,52 @@ + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - + + - - - - - - - - - - - - - - + + + @@ -230,6 +215,17 @@ + + + + + + + + + + + @@ -278,6 +274,10 @@ + + + + @@ -307,8 +307,9 @@ - + + + + + + + + + + + + $(TestArchiveRoot)tests/ + $(TestArchiveRoot)runonly/ + + $(TestArchiveNormalTestsRoot)$(OSPlatformConfig)/ + $(TestArchiveFunctionalTestsRoot)$(OSPlatformConfig)/ + + $(AppBundleRoot)/tests/ + $(AppBundleRoot)/runonly/ + + $(AppBundleRoot)/tests.all/ + $(AppBundleRoot)/runonly.all/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_NuGetConfigForWorkloadInstall>$(ArtifactsBinDir)workload-nuget.config + + @@ -6,7 +10,7 @@ - + @@ -16,6 +20,7 @@ + @@ -23,21 +28,43 @@ - + - <_DotNetInstallScriptPath Condition="!$([MSBuild]::IsOSPlatform('windows'))">$(DOTNET_INSTALL_DIR)/dotnet-install.sh - <_DotNetInstallScriptPath Condition=" $([MSBuild]::IsOSPlatform('windows'))">$(RepoRoot).dotnet\dotnet-install.ps1 + <_DotNetInstallScriptName Condition="!$([MSBuild]::IsOSPlatform('windows'))">dotnet-install.sh + <_DotNetInstallScriptName Condition=" $([MSBuild]::IsOSPlatform('windows'))">dotnet-install.ps1 + + <_DotNetInstallScriptPath>$(ArtifactsObjDir)$(_DotNetInstallScriptName) + + <_DotNetInstallCommand Condition="!$([MSBuild]::IsOSPlatform('windows'))" + >$(_DotNetInstallScriptPath) -i $(SdkWithNoWorkloadForTestingPath) -v $(SdkVersionForWorkloadTesting) + <_DotNetInstallCommand Condition="$([MSBuild]::IsOSPlatform('windows'))" + >$(_DotNetInstallScriptPath) -InstallDir $(SdkWithNoWorkloadForTestingPath) -Version $(SdkVersionForWorkloadTesting) + + + + <_DotNetInstallCommand Condition="!$([MSBuild]::IsOSPlatform('windows'))" + >$(_DotNetInstallScriptPath) -i $(SdkWithNoWorkloadForTestingPath) -q daily -c $(SdkChannelForWorkloadTesting) + <_DotNetInstallCommand Condition="$([MSBuild]::IsOSPlatform('windows'))" + >$(_DotNetInstallScriptPath) -InstallDir $(SdkWithNoWorkloadForTestingPath) -Quality daily -Channel $(SdkChannelForWorkloadTesting) + + + + + IgnoreStandardErrorWarningFormat="true" + Command="chmod +x $(_DotNetInstallScriptPath); $(_DotNetInstallCommand)" /> + Command='powershell -ExecutionPolicy ByPass -NoProfile -command "& $(_DotNetInstallCommand)"' /> @@ -60,7 +87,7 @@ - <_NuGetSourceForWorkloads Include="dotnet6" Value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" /> <_BuiltNuGets Include="$(LibrariesShippingPackagesDir)\*.nupkg" /> + <_PackageVersion Condition="'$(StabilizePackageVersion)' == 'true'">$(ProductVersion) + <_PackageVersion Condition="'$(_PackageVersion)' == ''">$(PackageVersion) - <_AOTCrossNuGetPath>$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.AOT.$(NETCoreSdkRuntimeIdentifier).Cross.$(RuntimeIdentifier).$(PackageVersion).nupkg + <_AOTCrossNuGetPath>$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.AOT.$(NETCoreSdkRuntimeIdentifier).Cross.$(RuntimeIdentifier).$(_PackageVersion).nupkg @@ -112,11 +139,59 @@ + + + + + + + + + + + + + + + + + + + + + + + $(RepoRoot)NuGet.config + + @(RestoreTestSource -> '<add key="%(Key)" value="%(Identity)" />', '%0A ') + + $([System.IO.File]::ReadAllText('$(TemplateNuGetConfigFile)').Replace( + '<!-- TEST_RESTORE_SOURCES_INSERTION_LINE -->', + '$(RestoreTestSourceConfigLines)')) + + + $([System.Text.RegularExpressions.Regex]::Replace( + '$(TestRestoreNuGetConfigContent)', + '<add key=".+" value="https://pkgs.dev.azure.com/dnceng/internal/.+" />', + '')) + + + + diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index bd636b92e284ea..32af6567438634 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -205,6 +205,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(HOST_LINUX 1) add_definitions(-D_GNU_SOURCE -D_REENTRANT) add_definitions(-D_THREAD_SAFE) + # Enable the "full RELRO" options (RELRO & BIND_NOW) at link time + add_link_options(-Wl,-z,relro) + add_link_options(-Wl,-z,now) elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") set(HOST_LINUX 1) add_definitions(-D_GNU_SOURCE -D_REENTRANT) @@ -244,12 +247,18 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") add_compile_options(/W3) # set warning level 3 add_compile_options(/EHsc) # set exception handling behavior add_compile_options(/FC) # use full pathnames in diagnostics + add_link_options(/STACK:0x800000) # set stack size to 8MB (default is 1MB) if(CMAKE_BUILD_TYPE STREQUAL "Release") - add_compile_options(/Oi) # enable intrinsics - add_compile_options(/GF) # enable string pooling - add_compile_options(/Zi) # enable debugging information - add_compile_options(/GL) # whole program optimization - add_link_options(/LTCG) # link-time code generation + add_compile_options(/Oi) # enable intrinsics + add_compile_options(/GF) # enable string pooling + add_compile_options(/Zi) # enable debugging information + add_compile_options(/GL) # whole program optimization + add_link_options(/LTCG) # link-time code generation + add_link_options(/DEBUG) # enable debugging information + add_link_options(/OPT:REF) # optimize: remove unreferenced functions & data + add_link_options(/OPT:ICF) # optimize: enable COMDAT folding + # the combination of /Zi compiler flag and /DEBUG /OPT:REF /OPT:ICF + # linker flags is needed to create .pdb output on release builds endif() elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS") set(HOST_SOLARIS 1) @@ -719,11 +728,13 @@ endif() ###################################### # EXTRACT VERSION ###################################### -if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/_version.h") - if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/_version.h") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_version.h" "#undef VER_PRODUCTVERSION_STR\n#define VER_PRODUCTVERSION_STR \"42.42.42.42424\"\n") - else() - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_version.h" "static char sccsid[] __attribute__((used)) = \"@(#)Version 42.42.42.42424 @Commit: AAA\";\n") + endif() +else() + if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/version.c") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/version.c" "static char sccsid[] __attribute__((used)) = \"@(#)Version 42.42.42.42424 @Commit: AAA\";\n") endif() endif() if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/NativeVersion.rc") @@ -745,7 +756,7 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/_version.h" product_version_string_line REGEX "VER_PRODUCTVERSION_STR ") string(REGEX REPLACE ".*VER_PRODUCTVERSION_STR *(.*)" "\\1" product_version_string ${product_version_string_line}) else() - file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/_version.h" product_version_string_line REGEX "sccsid") + file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/version.c" product_version_string_line REGEX "sccsid") string(REGEX REPLACE ".*Version *(.*)\";" "\"\\1\"" product_version_string ${product_version_string_line}) endif() @@ -773,6 +784,14 @@ if (TARGET_BROWSER) # sys/errno.h exists, but just emits a warning and includes errno.h unset(HAVE_SYS_ERRNO_H) endif() + +if(TARGET_DARWIN) + check_c_compiler_flag(-fno-objc-msgsend-selector-stubs COMPILER_SUPPORTS_FNO_OBJC_MSGSEND_SELECTOR_STUBS) + if(COMPILER_SUPPORTS_FNO_OBJC_MSGSEND_SELECTOR_STUBS) + set(CLR_CMAKE_COMMON_OBJC_FLAGS "${CLR_CMAKE_COMMON_OBJC_FLAGS} -fno-objc-msgsend-selector-stubs") + endif() +endif() + ### End of OS specific checks add_subdirectory(mono) diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index 1878cb4ed7c053..05459da848e340 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -32,6 +32,7 @@ v4.0.30319 $(ProductVersion) + $(ProductVersion) true $(NoWarn),0419,0649 enable @@ -265,12 +266,24 @@ + + Common\Interop\Unix\System.Native\Interop.GetEnv.cs + + + Common\Interop\Unix\System.Native\Interop.GetEnviron.cs + + + + Common\Interop\OSX\Interop.SearchPath.cs + + Common\Interop\OSX\Interop.SearchPath.iOS.cs + @@ -334,4 +347,10 @@ + + + true + + + diff --git a/src/mono/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml b/src/mono/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml index eac1bad9a0b2aa..6272fd40fe50e2 100644 --- a/src/mono/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml +++ b/src/mono/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml @@ -412,11 +412,6 @@ - - - - - diff --git a/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs index 94cb9eb7feea62..6a61e0ebd53f35 100644 --- a/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs @@ -164,6 +164,7 @@ private static void Copy(Array sourceArray, int sourceIndex, Array destinationAr Type src_type = sourceArray.GetType().GetElementType()!; Type dst_type = destinationArray.GetType().GetElementType()!; + Type dst_elem_type = dst_type; bool dst_type_vt = dst_type.IsValueType && Nullable.GetUnderlyingType(dst_type) == null; bool src_is_enum = src_type.IsEnum; @@ -196,12 +197,9 @@ private static void Copy(Array sourceArray, int sourceIndex, Array destinationAr { object srcval = sourceArray.GetValueImpl(source_pos + i); - if (!src_type.IsValueType && dst_is_enum) + if (dst_type_vt && (srcval == null || (src_type == typeof(object) && !dst_elem_type.IsAssignableFrom (srcval.GetType())))) throw new InvalidCastException(SR.InvalidCast_DownCastArrayElement); - if (dst_type_vt && (srcval == null || (src_type == typeof(object) && srcval.GetType() != dst_type))) - throw new InvalidCastException(); - try { destinationArray.SetValueRelaxedImpl(srcval, dest_pos + i); diff --git a/src/mono/System.Private.CoreLib/src/System/Environment.Android.cs b/src/mono/System.Private.CoreLib/src/System/Environment.Android.cs new file mode 100644 index 00000000000000..44c8988532f367 --- /dev/null +++ b/src/mono/System.Private.CoreLib/src/System/Environment.Android.cs @@ -0,0 +1,97 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.IO; +using System.Threading; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Diagnostics; + +namespace System +{ + public static partial class Environment + { + private static Dictionary? s_specialFolders; + + private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option) + { + if (s_specialFolders == null) + { + Interlocked.CompareExchange(ref s_specialFolders, new Dictionary(), null); + } + + string? path; + lock (s_specialFolders) + { + if (!s_specialFolders.TryGetValue(folder, out path)) + { + path = GetSpecialFolder(folder) ?? string.Empty; + s_specialFolders[folder] = path; + } + } + return path; + } + + private static string? GetSpecialFolder(SpecialFolder folder) + { + string? home = null; + try + { + home = PersistedFiles.GetHomeDirectory(); + } + catch (Exception exc) + { + Debug.Fail($"Unable to get home directory: {exc}"); + } + + // Fall back to '/' when we can't determine the home directory. + // This location isn't writable by non-root users which provides some safeguard + // that the application doesn't write data which is meant to be private. + if (string.IsNullOrEmpty(home)) + { + home = "/"; + } + + switch (folder) + { + case SpecialFolder.Personal: + case SpecialFolder.LocalApplicationData: + return home; + + case SpecialFolder.ApplicationData: + return Path.Combine(home, ".config"); + + case SpecialFolder.Desktop: + case SpecialFolder.DesktopDirectory: + return Path.Combine(home, "Desktop"); + + case SpecialFolder.MyMusic: + return Path.Combine(home, "Music"); + + case SpecialFolder.MyPictures: + return Path.Combine(home, "Pictures"); + + case SpecialFolder.Templates: + return Path.Combine(home, "Templates"); + + case SpecialFolder.MyVideos: + return Path.Combine(home, "Videos"); + + case SpecialFolder.CommonTemplates: + return "/usr/share/templates"; + + case SpecialFolder.Fonts: + return Path.Combine(home, ".fonts"); + + case SpecialFolder.UserProfile: + return GetEnvironmentVariable("HOME"); + + case SpecialFolder.CommonApplicationData: + return "/usr/share"; + + default: + return string.Empty; + } + } + } +} diff --git a/src/mono/System.Private.CoreLib/src/System/Environment.Unix.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Environment.Unix.Mono.cs index 1b75ae0abbc2ba..5858d78f4c9727 100644 --- a/src/mono/System.Private.CoreLib/src/System/Environment.Unix.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Environment.Unix.Mono.cs @@ -5,8 +5,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using System.Threading; -using Mono; namespace System { @@ -20,7 +20,7 @@ public partial class Environment if (s_environment == null) { - return InternalGetEnvironmentVariable(variable); + return Marshal.PtrToStringAnsi(Interop.Sys.GetEnv(variable)); } variable = TrimStringOnFirstZero(variable); @@ -31,23 +31,15 @@ public partial class Environment } } - private static string InternalGetEnvironmentVariable(string name) - { - using (SafeStringMarshal handle = RuntimeMarshal.MarshalString(name)) - { - return internalGetEnvironmentVariable_native(handle.Value); - } - } - private static unsafe void SetEnvironmentVariableCore(string variable, string? value) { Debug.Assert(variable != null); EnsureEnvironmentCached(); + variable = TrimStringOnFirstZero(variable); + value = value == null ? null : TrimStringOnFirstZero(value); lock (s_environment!) { - variable = TrimStringOnFirstZero(variable); - value = value == null ? null : TrimStringOnFirstZero(value); if (string.IsNullOrEmpty(value)) { s_environment.Remove(variable); @@ -97,22 +89,75 @@ private static Dictionary GetSystemEnvironmentVariables() { var results = new Dictionary(); - foreach (string name in GetEnvironmentVariableNames()) + IntPtr block = Interop.Sys.GetEnviron(); + if (block != IntPtr.Zero) { - if (name != null) + try + { + IntPtr blockIterator = block; + + // Per man page, environment variables come back as an array of pointers to strings + // Parse each pointer of strings individually + while (ParseEntry(blockIterator, out string? key, out string? value)) + { + if (key != null && value != null) + { + try + { + // Add may throw if the environment block was corrupted leading to duplicate entries. + // We allow such throws and eat them (rather than proactively checking for duplication) + // to provide a non-fatal notification about the corruption. + results.Add(key, value); + } + catch (ArgumentException) { } + } + + // Increment to next environment variable entry + blockIterator += IntPtr.Size; + } + } + finally { - results.Add(name, InternalGetEnvironmentVariable(name)); + Interop.Sys.FreeEnviron(block); } } return results; - } - - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern string internalGetEnvironmentVariable_native(IntPtr variable); - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern string[] GetEnvironmentVariableNames(); + // Use a local, unsafe function since we cannot use `yield return` inside of an `unsafe` block + static unsafe bool ParseEntry(IntPtr current, out string? key, out string? value) + { + // Setup + key = null; + value = null; + + // Point to current entry + byte* entry = *(byte**)current; + + // Per man page, "The last pointer in this array has the value NULL" + // Therefore, if entry is null then we're at the end and can bail + if (entry == null) + return false; + + // Parse each byte of the entry until we hit either the separator '=' or '\0'. + // This finds the split point for creating key/value strings below. + // On some old OS, the environment block can be corrupted. + // Some will not have '=', so we need to check for '\0'. + byte* splitpoint = entry; + while (*splitpoint != '=' && *splitpoint != '\0') + splitpoint++; + + // Skip over entries starting with '=' and entries with no value (just a null-terminating char '\0') + if (splitpoint == entry || *splitpoint == '\0') + return true; + + // The key is the bytes from start (0) until our splitpoint + key = new string((sbyte*)entry, 0, checked((int)(splitpoint - entry))); + // The value is the rest of the bytes starting after the splitpoint + value = new string((sbyte*)(splitpoint + 1)); + + return true; + } + } } } diff --git a/src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs b/src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs index 1a95bdc408f1c2..99d5b3305fbcf5 100644 --- a/src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs +++ b/src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs @@ -36,18 +36,14 @@ private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOptio { switch (folder) { - // TODO: fix for tvOS (https://github.com/dotnet/runtime/issues/34007) - // The "normal" NSDocumentDirectory is a read-only directory on tvOS - // and that breaks a lot of assumptions in the runtime and the BCL - case SpecialFolder.Personal: case SpecialFolder.LocalApplicationData: - return Interop.Sys.SearchPath(NSSearchPathDirectory.NSDocumentDirectory); + return CombineDocumentDirectory(string.Empty); case SpecialFolder.ApplicationData: // note: at first glance that looked like a good place to return NSLibraryDirectory // but it would break isolated storage for existing applications - return CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, ".config"); + return CombineDocumentDirectory(".config"); case SpecialFolder.Resources: return Interop.Sys.SearchPath(NSSearchPathDirectory.NSLibraryDirectory); // older (8.2 and previous) would return String.Empty @@ -63,7 +59,7 @@ private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOptio return Path.Combine(GetFolderPathCore(SpecialFolder.Personal, SpecialFolderOption.None), "Pictures"); case SpecialFolder.Templates: - return CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, "Templates"); + return CombineDocumentDirectory("Templates"); case SpecialFolder.MyVideos: return Path.Combine(GetFolderPathCore(SpecialFolder.Personal, SpecialFolderOption.None), "Videos"); @@ -72,7 +68,7 @@ private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOptio return "/usr/share/templates"; case SpecialFolder.Fonts: - return CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, ".fonts"); + return CombineDocumentDirectory(".fonts"); case SpecialFolder.Favorites: return CombineSearchPath(NSSearchPathDirectory.NSLibraryDirectory, "Favorites"); @@ -84,7 +80,7 @@ private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOptio return Interop.Sys.SearchPath(NSSearchPathDirectory.NSCachesDirectory); case SpecialFolder.UserProfile: - return InternalGetEnvironmentVariable("HOME"); + return GetEnvironmentVariable("HOME"); case SpecialFolder.CommonApplicationData: return "/usr/share"; @@ -100,6 +96,24 @@ static string CombineSearchPath(NSSearchPathDirectory searchPath, string subdire Path.Combine(path, subdirectory) : string.Empty; } + + static string CombineDocumentDirectory(string subdirectory) + { +#if TARGET_TVOS + string? path = CombineSearchPath(NSSearchPathDirectory.NSLibraryDirectory, Path.Combine("Caches", "Documents")); + // Special version of CombineSearchPath which creates the path if needed. + // This isn't needed for "real" search paths which always exist, but on tvOS + // the base path is really a subdirectory we define rather than an OS directory. + // In order to not treat Directory.Exists(SpecialFolder.ApplicationData) differently + // on tvOS, guarantee that it exists by creating it here + if (!Directory.Exists(path)) + Directory.CreateDirectory(path); + path = Path.Combine(path, subdirectory); +#else + string? path = CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, subdirectory); +#endif + return path; + } } } } diff --git a/src/mono/System.Private.CoreLib/src/System/Exception.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Exception.Mono.cs index a8fda176114d66..7573a63dac4574 100644 --- a/src/mono/System.Private.CoreLib/src/System/Exception.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Exception.Mono.cs @@ -70,11 +70,17 @@ internal DispatchState CaptureDispatchState() if (stackFrames.Length > 0) stackFrames[stackFrames.Length - 1].isLastFrameFromForeignException = true; - if (foreignExceptionsFrames != null) + // Make sure foreignExceptionsFrames does not change at this point. + // Otherwise, the Array.Copy into combinedStackFrames can fail due to size differences + // + // See https://github.com/dotnet/runtime/issues/70081 + MonoStackFrame[]? feFrames = foreignExceptionsFrames; + + if (feFrames != null) { - var combinedStackFrames = new MonoStackFrame[stackFrames.Length + foreignExceptionsFrames.Length]; - Array.Copy(foreignExceptionsFrames, 0, combinedStackFrames, 0, foreignExceptionsFrames.Length); - Array.Copy(stackFrames, 0, combinedStackFrames, foreignExceptionsFrames.Length, stackFrames.Length); + var combinedStackFrames = new MonoStackFrame[stackFrames.Length + feFrames.Length]; + Array.Copy(feFrames, 0, combinedStackFrames, 0, feFrames.Length); + Array.Copy(stackFrames, 0, combinedStackFrames, feFrames.Length, stackFrames.Length); stackFrames = combinedStackFrames; } @@ -90,7 +96,6 @@ internal DispatchState CaptureDispatchState() internal void RestoreDispatchState(in DispatchState state) { foreignExceptionsFrames = state.StackFrames; - _stackTraceString = null; } diff --git a/src/mono/System.Private.CoreLib/src/System/GC.Mono.cs b/src/mono/System.Private.CoreLib/src/System/GC.Mono.cs index a92ebab49920d7..4a383c9efb7172 100644 --- a/src/mono/System.Private.CoreLib/src/System/GC.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/GC.Mono.cs @@ -313,5 +313,10 @@ internal static int GetLastGCPercentTimeInGC() { return (int)EventPipeInternal.GetRuntimeCounterValue(EventPipeInternal.RuntimeCounters.GC_LAST_PERCENT_TIME_IN_GC); } + + public static TimeSpan GetTotalPauseDuration() + { + return TimeSpan.Zero; + } } } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs index 0c1d75229cf95f..919015e8567e39 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.Mono.cs @@ -185,6 +185,7 @@ public sealed partial class AssemblyBuilder : Assembly private CustomAttributeBuilder[]? cattrs; private string? version; private string? culture; + private byte[]? public_key_token; private Module[]? loaded_modules; private uint access; #endregion @@ -221,6 +222,7 @@ private AssemblyBuilder(AssemblyName n, AssemblyBuilderAccess access) { version = v.ToString(); } + public_key_token = n.GetPublicKeyToken(); basic_init(this); @@ -396,7 +398,7 @@ public override bool IsDefined(Type attributeType, bool inherit) => public override object[] GetCustomAttributes(Type attributeType, bool inherit) => CustomAttribute.GetCustomAttributes(this, attributeType, inherit); - public override IList GetCustomAttributesData() => CustomAttributeData.GetCustomAttributes(this); + public override IList GetCustomAttributesData() => CustomAttribute.GetCustomAttributesData(this); } } #endif diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.Mono.cs index 7f26920c5e52d8..a34ea7064705d6 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.Mono.cs @@ -123,7 +123,7 @@ private static bool IsValidType(Type t) // depends on this Enum.GetUnderlyingType(t); } - if (t.IsClass && !(t.IsArray || t == typeof(object) || t == typeof(Type) || t == typeof(string) || t.Assembly.GetName().Name == "mscorlib")) + if (t.IsClass && !(t.IsArray || t == typeof(object) || typeof(Type).IsAssignableFrom(t) || t == typeof(string) || t.Assembly.GetName().Name == "mscorlib")) return false; if (t.IsValueType && !(t.IsPrimitive || t.IsEnum || ((t.Assembly is AssemblyBuilder) && t.Assembly.GetName().Name == "mscorlib"))) return false; @@ -149,7 +149,7 @@ private static bool IsValidValue(Type type, object? value) { if (type.IsValueType && value == null) return false; - if (type.IsArray && type.GetElementType()!.IsValueType) + if (type.IsArray && type.GetElementType()!.IsValueType && value != null) { foreach (object? v in (Array)value!) { diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs index 2c8a240f79b595..1e471e8b26805b 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs @@ -952,7 +952,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit) public override IList GetCustomAttributesData() { - return CustomAttributeData.GetCustomAttributes(this); + return CustomAttribute.GetCustomAttributesData(this); } [RequiresUnreferencedCode("Fields might be removed")] diff --git a/src/mono/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.Mono.cs index 2ec69c7393648d..f646ccb652f0b3 100644 --- a/src/mono/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.Mono.cs @@ -80,6 +80,7 @@ internal static Assembly[] GetLoadedAssemblies() // We only support looking up load context for runtime assemblies. if (rtAsm != null) { + var _ = Default; // ensure the default ALC is initialized. RuntimeAssembly runtimeAssembly = rtAsm; IntPtr ptrAssemblyLoadContext = GetLoadContextForAssembly(runtimeAssembly); loadContextForAssembly = GetAssemblyLoadContext(ptrAssemblyLoadContext); diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs index 2d0a4b925096e4..f6d349d99ba261 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs @@ -1336,8 +1336,9 @@ public override Type MakeGenericType(Type[] instantiation) for (int iCopy = 0; iCopy < instantiation.Length; iCopy++) instantiationCopy[iCopy] = instantiation[iCopy]; instantiation = instantiationCopy; - - throw new NotImplementedException(); + if (!RuntimeFeature.IsDynamicCodeSupported) + throw new PlatformNotSupportedException(); + return System.Reflection.Emit.TypeBuilderInstantiation.MakeGenericType(this, instantiation); } instantiationRuntimeType[i] = rtInstantiationElem; diff --git a/src/mono/System.Private.CoreLib/src/System/String.Mono.cs b/src/mono/System.Private.CoreLib/src/System/String.Mono.cs index 0a661586dfaf95..19887d46edbb10 100644 --- a/src/mono/System.Private.CoreLib/src/System/String.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/String.Mono.cs @@ -47,16 +47,27 @@ private static unsafe void memset(byte* dest, int val, int len) } return; } - if (val != 0) +#if TARGET_64BIT + const int word_size = 8; + long word_val; +#else + const int word_size = 4; + int word_val; +#endif + word_val = val; + if (word_val != 0) { - val = val | (val << 8); - val = val | (val << 16); + word_val |= (word_val << 8); + word_val |= (word_val << 16); +#if TARGET_64BIT + word_val |= (word_val << 32); +#endif } - // align to 4 - int rest = (int)dest & 3; + // align to word_size + int rest = (int)dest & (word_size - 1); if (rest != 0) { - rest = 4 - rest; + rest = word_size - rest; len -= rest; do { @@ -65,20 +76,30 @@ private static unsafe void memset(byte* dest, int val, int len) --rest; } while (rest != 0); } + while (len >= 16) { - ((int*)dest)[0] = val; - ((int*)dest)[1] = val; - ((int*)dest)[2] = val; - ((int*)dest)[3] = val; +#if TARGET_64BIT + ((long*)dest)[0] = word_val; + ((long*)dest)[1] = word_val; +#else + ((int*)dest)[0] = word_val; + ((int*)dest)[1] = word_val; + ((int*)dest)[2] = word_val; + ((int*)dest)[3] = word_val; +#endif dest += 16; len -= 16; } - while (len >= 4) + while (len >= word_size) { - ((int*)dest)[0] = val; - dest += 4; - len -= 4; +#if TARGET_64BIT + ((long*)dest)[0] = word_val; +#else + ((int*)dest)[0] = word_val; +#endif + dest += word_size; + len -= word_size; } // tail bytes while (len > 0) diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs index 5ad4ea2e23cead..4187cfcb829089 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs @@ -17,7 +17,9 @@ internal partial class TimerQueue { private static List? s_scheduledTimers; private static List? s_scheduledTimersToFire; + private static long s_shortestDueTimeMs = long.MaxValue; + // this means that it's in the s_scheduledTimers collection, not that it's the one which would run on the next TimeoutCallback private bool _isScheduled; private long _scheduledDueTimeMs; @@ -27,24 +29,25 @@ private TimerQueue(int id) [DynamicDependency("TimeoutCallback")] // The id argument is unused in netcore + // This replaces the current pending setTimeout with shorter one [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void SetTimeout(int timeout, int id); // Called by mini-wasm.c:mono_set_timeout_exec private static void TimeoutCallback() { - int shortestWaitDurationMs = PumpTimerQueue(); + // always only have one scheduled at a time + s_shortestDueTimeMs = long.MaxValue; - if (shortestWaitDurationMs != int.MaxValue) - { - SetTimeout((int)shortestWaitDurationMs, 0); - } + long currentTimeMs = TickCount64; + ReplaceNextSetTimeout(PumpTimerQueue(currentTimeMs), currentTimeMs); } + // this is called with shortest of timers scheduled on the particular TimerQueue private bool SetTimer(uint actualDuration) { Debug.Assert((int)actualDuration >= 0); - long dueTimeMs = TickCount64 + (int)actualDuration; + long currentTimeMs = TickCount64; if (!_isScheduled) { s_scheduledTimers ??= new List(Instances.Length); @@ -52,24 +55,65 @@ private bool SetTimer(uint actualDuration) s_scheduledTimers.Add(this); _isScheduled = true; } - _scheduledDueTimeMs = dueTimeMs; - SetTimeout((int)actualDuration, 0); + + _scheduledDueTimeMs = currentTimeMs + (int)actualDuration; + + ReplaceNextSetTimeout(ShortestDueTime(), currentTimeMs); return true; } - private static int PumpTimerQueue() + // shortest time of all TimerQueues + private static void ReplaceNextSetTimeout(long shortestDueTimeMs, long currentTimeMs) { - if (s_scheduledTimersToFire == null) + if (shortestDueTimeMs == int.MaxValue) + { + return; + } + + // this also covers s_shortestDueTimeMs = long.MaxValue when none is scheduled + if (s_shortestDueTimeMs > shortestDueTimeMs) + { + s_shortestDueTimeMs = shortestDueTimeMs; + int shortestWait = Math.Max((int)(shortestDueTimeMs - currentTimeMs), 0); + // this would cancel the previous schedule and create shorter one + // it is expensive call + SetTimeout(shortestWait, 0); + } + } + + private static long ShortestDueTime() + { + if (s_scheduledTimers == null) { return int.MaxValue; } + long shortestDueTimeMs = long.MaxValue; + var timers = s_scheduledTimers!; + for (int i = timers.Count - 1; i >= 0; --i) + { + TimerQueue timer = timers[i]; + if (timer._scheduledDueTimeMs < shortestDueTimeMs) + { + shortestDueTimeMs = timer._scheduledDueTimeMs; + } + } + + return shortestDueTimeMs; + } + + private static long PumpTimerQueue(long currentTimeMs) + { + if (s_scheduledTimersToFire == null) + { + return ShortestDueTime(); + } + List timersToFire = s_scheduledTimersToFire!; List timers; timers = s_scheduledTimers!; - long currentTimeMs = TickCount64; - int shortestWaitDurationMs = int.MaxValue; + long shortestDueTimeMs = int.MaxValue; for (int i = timers.Count - 1; i >= 0; --i) { TimerQueue timer = timers[i]; @@ -88,9 +132,9 @@ private static int PumpTimerQueue() continue; } - if (waitDurationMs < shortestWaitDurationMs) + if (timer._scheduledDueTimeMs < shortestDueTimeMs) { - shortestWaitDurationMs = (int)waitDurationMs; + shortestDueTimeMs = timer._scheduledDueTimeMs; } } @@ -103,7 +147,7 @@ private static int PumpTimerQueue() timersToFire.Clear(); } - return shortestWaitDurationMs; + return shortestDueTimeMs; } } } diff --git a/src/mono/cmake/config.h.in b/src/mono/cmake/config.h.in index 6e6fc568b8b3b1..1df5b2df3429ba 100644 --- a/src/mono/cmake/config.h.in +++ b/src/mono/cmake/config.h.in @@ -501,14 +501,11 @@ /* Define to 1 if you have the `strerror_r' function. */ #cmakedefine HAVE_STRERROR_R 1 -/* Define to 1 if strerror_r returns char *. */ -#cmakedefine STRERROR_R_CHAR_P 1 - /* Have GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY */ #cmakedefine GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY 1 /* GLIBC has CPU_COUNT macro in sched.h */ -#cmakedefine GLIBC_HAS_CPU_COUNT 1 +#cmakedefine HAVE_GNU_CPU_COUNT /* Have large file support */ #cmakedefine HAVE_LARGE_FILE_SUPPORT 1 @@ -695,6 +692,8 @@ /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T @SIZEOF_SIZE_T@ +#cmakedefine01 HAVE_GNU_STRERROR_R + /* Define to 1 if the system has the type `struct sockaddr'. */ #cmakedefine HAVE_STRUCT_SOCKADDR 1 @@ -719,6 +718,9 @@ /* Define to 1 if `kp_proc' is a member of `struct kinfo_proc'. */ #cmakedefine HAVE_STRUCT_KINFO_PROC_KP_PROC 1 +/* Define to 1 if `super_class' is a member of `struct objc_super'. */ +#cmakedefine HAVE_OBJC_SUPER_SUPER_CLASS 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TIME_H 1 diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake index b3d3f47c894e0b..a2820777f06c7d 100644 --- a/src/mono/cmake/configure.cmake +++ b/src/mono/cmake/configure.cmake @@ -6,6 +6,7 @@ include(CheckTypeSize) include(CheckStructHasMember) include(CheckSymbolExists) include(CheckCCompilerFlag) +include(CheckCSourceCompiles) # Apple platforms like macOS/iOS allow targeting older operating system versions with a single SDK, # the mere presence of a symbol in the SDK doesn't tell us whether the deployment target really supports it. @@ -79,6 +80,21 @@ ac_check_funcs ( gethrtime read_real_time gethostbyname gethostbyname2 getnameinfo getifaddrs access inet_ntop Qp2getifaddrs) +check_c_source_compiles( + " + #include + int main(void) + { + #if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230) + #else + #error No good zlib found + #endif + return 0; + } + " + HAVE_SYS_ZLIB) + + if(NOT HOST_DARWIN) # getentropy was introduced in macOS 10.12 / iOS 10.0 ac_check_funcs (getentropy) @@ -113,12 +129,47 @@ check_struct_has_member("struct sockaddr_in6" sin6_len "netinet/in.h" HAVE_SOCKA check_struct_has_member("struct stat" st_atim "sys/types.h;sys/stat.h;unistd.h" HAVE_STRUCT_STAT_ST_ATIM) check_struct_has_member("struct stat" st_atimespec "sys/types.h;sys/stat.h;unistd.h" HAVE_STRUCT_STAT_ST_ATIMESPEC) +if (HOST_DARWIN) + check_struct_has_member("struct objc_super" super_class "objc/runtime.h;objc/message.h" HAVE_OBJC_SUPER_SUPER_CLASS) +endif() + check_type_size("int" SIZEOF_INT) check_type_size("void*" SIZEOF_VOID_P) check_type_size("long" SIZEOF_LONG) check_type_size("long long" SIZEOF_LONG_LONG) check_type_size("size_t" SIZEOF_SIZE_T) +if (HOST_LINUX OR HOST_ANDROID) + set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) +endif() + +check_c_source_compiles( + " + #include + int main(void) + { + char buffer[1]; + char c = *strerror_r(0, buffer, 0); + return 0; + } + " + HAVE_GNU_STRERROR_R) + +check_c_source_compiles( + " + #include + int main(void) + { + CPU_COUNT((void *) 0); + return 0; + } + " + HAVE_GNU_CPU_COUNT) + +if (HOST_LINUX OR HOST_ANDROID) + set(CMAKE_REQUIRED_DEFINITIONS) +endif() + # ICONV set(ICONV_LIB) find_library(LIBICONV_FOUND iconv) @@ -126,14 +177,6 @@ if(NOT LIBICONV_FOUND STREQUAL "LIBICONV_FOUND-NOTFOUND") set(ICONV_LIB "iconv") endif() -file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test.c - "#include \n" - "void main () { CPU_COUNT((void *) 0); }\n" -) -try_compile(GLIBC_HAS_CPU_COUNT ${CMAKE_BINARY_DIR}/CMakeTmp SOURCES "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test.c" - COMPILE_DEFINITIONS "-D_GNU_SOURCE") - - if(HOST_WIN32) # checking for this doesn't work for some reason, hardcode result set(HAVE_WINTERNL_H 1) diff --git a/src/mono/cmake/defines-todo.cmake b/src/mono/cmake/defines-todo.cmake index 55c5b6f85bb625..fd2c6b0622f7c5 100644 --- a/src/mono/cmake/defines-todo.cmake +++ b/src/mono/cmake/defines-todo.cmake @@ -4,7 +4,6 @@ #option (MAJOR_IN_MKDEV "Define to 1 if `major', `minor', and `makedev' are declared in .") #option (MAJOR_IN_SYSMACROS "Define to 1 if `major', `minor', and `makedev' are declared in .") -#option (STRERROR_R_CHAR_P "Define to 1 if strerror_r returns char *.") #option (HAVE_LIBICONV "Define to 1 if you have the `iconv' library (-liconv).") #option (ANDROID_UNIFIED_HEADERS "Whether Android NDK unified headers are used") #option (MONO_DL_NEED_USCORE "Does dlsym require leading underscore.") @@ -25,7 +24,6 @@ #option (NEED_LINK_UNLINK "Define if Unix sockets cannot be created in an anonymous namespace") #option (HAVE_CLASSIC_WINAPI_SUPPORT "Use classic Windows API support") #option (HAVE_UWP_WINAPI_SUPPORT "Don't use UWP Windows API support") -#option (HAVE_SYS_ZLIB "Use OS-provided zlib") #option (MONO_XEN_OPT "Xen-specific behaviour") #option (MONO_SMALL_CONFIG "Reduce runtime requirements (and capabilities)") #option (AC_APPLE_UNIVERSAL_BUILD "Define if building universal (internal helper macro)") diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 9b4d254d42598a..d6a0c9a8ec2037 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -36,6 +36,8 @@ $(LibPrefix)$(MonoLibName)$(StaticLibExt) $(MonoStaticLibFileName) $(MonoSharedLibFileName) + mono-aot-cross$(ExeExt) + mono-aot-cross.pdb $(Configuration) $(Configuration) $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'tests', 'coreclr', '$(TargetOS).$(Platform).$(CoreClrTestConfig)', 'Tests', 'Core_Root')) @@ -504,6 +506,7 @@ <_Objcopy>objcopy <_Objcopy Condition="'$(Platform)' == 'arm'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy) <_Objcopy Condition="'$(Platform)' == 'arm64'">aarch64-linux-$(_LinuxAbi)-$(_Objcopy) + <_Objcopy Condition="'$(Platform)' == 's390x'">s390x-linux-$(_LinuxAbi)-$(_Objcopy) <_Objcopy Condition="'$(Platform)' == 'x64'">x86_64-linux-$(_LinuxAbi)-$(_Objcopy) <_Objcopy Condition="'$(Platform)' == 'x86'">i686-linux-$(_LinuxAbi)-$(_Objcopy) <_Objcopy Condition="'$(TargetsAndroid)' == 'true'">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/bin/$(_Objcopy) @@ -516,17 +519,17 @@ <_Objcopy Condition="'$(_ObjcopyFound)' != '0'">objcopy - + - - - - - - + + + + + + @@ -672,6 +675,8 @@ + + @@ -720,13 +725,18 @@ + + _version.h + version.c + + + Properties="NativeVersionFile=$(MonoObjDir)$(NativeVersionFile);RuntimeVersionFile=$(MonoObjDir)runtime_version.h" /> + Properties="NativeVersionFile=$(MonoObjCrossDir)$(NativeVersionFile);RuntimeVersionFile=$(MonoObjCrossDir)runtime_version.h" /> @@ -745,7 +755,8 @@ <_MonoIncludeIcuFiles Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true'">true - <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\mono-sgen$(ExeExt) + <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\$(MonoAotCrossFileName) + <_MonoAotCrossPdbFilePath>$(MonoObjCrossDir)out\bin\$(MonoAotCrossPdbFileName) @@ -774,7 +785,10 @@ $(RuntimeBinDir)%(_MonoRuntimeComponentsSharedFilePath.Filename)%(_MonoRuntimeComponentsSharedFilePath.Extension) <_MonoRuntimeArtifacts Include="$(_MonoAotCrossFilePath)"> - $(RuntimeBinDir)cross\$(PackageRID)\mono-aot-cross$(ExeExt) + $(RuntimeBinDir)cross\$(PackageRID)\$(MonoAotCrossFileName) + + <_MonoRuntimeArtifacts Include="$(_MonoAotCrossPdbFilePath)" Condition="Exists('$(_MonoAotCrossPdbFilePath)')"> + $(RuntimeBinDir)cross\$(PackageRID)\$(MonoAotCrossPdbFileName) <_MonoRuntimeArtifacts Condition="'$(MonoBundleLLVMOptimizer)' == 'true'" Include="$(MonoLLVMDir)\bin\llc$(ExeExt)"> $(RuntimeBinDir)\llc$(ExeExt) diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index 2cff5c0dec1445..fdd07a5f8d1eea 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -357,7 +357,9 @@ static int objref_id = 0; static int event_request_id = 0; +#ifndef TARGET_WASM static int frame_id = 0; +#endif static GPtrArray *event_requests; @@ -700,6 +702,25 @@ debugger_agent_parse_options (char *options) exit (1); } } + + mini_get_debug_options ()->gen_sdb_seq_points = TRUE; + /* + * This is needed because currently we don't handle liveness info. + */ + mini_get_debug_options ()->mdb_optimizations = TRUE; + +#ifndef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG + /* This is needed because we can't set local variables in registers yet */ + mono_disable_optimizations (MONO_OPT_LINEARS); +#endif + + /* + * The stack walk done from thread_interrupt () needs to be signal safe, but it + * isn't, since it can call into mono_aot_find_jit_info () which is not signal + * safe (#3411). So load AOT info eagerly when the debugger is running as a + * workaround. + */ + mini_get_debug_options ()->load_aot_jit_info_eagerly = TRUE; } void @@ -821,25 +842,6 @@ debugger_agent_init (MonoDefaults *mono_defaults) objrefs_init (); suspend_init (); - mini_get_debug_options ()->gen_sdb_seq_points = TRUE; - /* - * This is needed because currently we don't handle liveness info. - */ - mini_get_debug_options ()->mdb_optimizations = TRUE; - -#ifndef MONO_ARCH_HAVE_CONTEXT_SET_INT_REG - /* This is needed because we can't set local variables in registers yet */ - mono_disable_optimizations (MONO_OPT_LINEARS); -#endif - - /* - * The stack walk done from thread_interrupt () needs to be signal safe, but it - * isn't, since it can call into mono_aot_find_jit_info () which is not signal - * safe (#3411). So load AOT info eagerly when the debugger is running as a - * workaround. - */ - mini_get_debug_options ()->load_aot_jit_info_eagerly = TRUE; - #ifdef HAVE_SETPGID if (agent_config.setpgid) setpgid (0, 0); @@ -3026,7 +3028,7 @@ compute_frame_info (MonoInternalThread *thread, DebuggerTlsData *tls, gboolean f { ComputeFramesUserData user_data; GSList *tmp; - int i, findex, new_frame_count; + int findex, new_frame_count; StackFrame **new_frames, *f; MonoUnwindOptions opts = (MonoUnwindOptions)(MONO_UNWIND_DEFAULT | MONO_UNWIND_REG_LOCATIONS); @@ -3085,6 +3087,8 @@ compute_frame_info (MonoInternalThread *thread, DebuggerTlsData *tls, gboolean f for (tmp = user_data.frames; tmp; tmp = tmp->next) { f = (StackFrame *)tmp->data; +#ifndef TARGET_WASM + int i; /* * Reuse the id for already existing stack frames, so invokes don't invalidate * the still valid stack frames. @@ -3098,7 +3102,9 @@ compute_frame_info (MonoInternalThread *thread, DebuggerTlsData *tls, gboolean f if (i >= tls->frame_count) f->id = mono_atomic_inc_i32 (&frame_id); - +#else //keep the same behavior that we have for wasm before start using debugger-agent + f->id = findex+1; +#endif new_frames [findex ++] = f; } @@ -5551,7 +5557,8 @@ decode_value_internal (MonoType *t, int type, MonoDomain *domain, guint8 *addr, */ buf2 = buf; is_enum = decode_byte (buf, &buf, limit); - decode_byte (buf, &buf, limit); //ignore is boxed + if (CHECK_PROTOCOL_VERSION(2, 61)) + decode_byte (buf, &buf, limit); //ignore is boxed klass = decode_typeid (buf, &buf, limit, &d, &err); if (err != ERR_NONE) return err; @@ -8572,7 +8579,7 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g return ERR_INVALID_ARGUMENT; } - locals = mono_debug_lookup_locals (method, FALSE); + locals = mono_debug_lookup_locals (method); if (!locals) { if (CHECK_PROTOCOL_VERSION (2, 43)) { /* Scopes */ @@ -9289,13 +9296,14 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf) pos = - pos - 1; cmd_stack_frame_get_parameter (frame, sig, pos, buf, jit); } else { - MonoDebugLocalsInfo *locals; - - locals = mono_debug_lookup_locals (frame->de.method, TRUE); - if (locals) { - g_assert (pos < locals->num_locals); - pos = locals->locals [pos].index; - mono_debug_free_locals (locals); + if (!CHECK_PROTOCOL_VERSION (2, 59)) { //from newer protocol versions it's sent the pdb index + MonoDebugLocalsInfo *locals; + locals = mono_debug_lookup_locals (frame->de.method); + if (locals) { + g_assert (pos < locals->num_locals); + pos = locals->locals [pos].index; + mono_debug_free_locals (locals); + } } PRINT_DEBUG_MSG (4, "[dbg] send local %d.\n", pos); @@ -9343,13 +9351,14 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf) var = &jit->params [pos]; is_arg = TRUE; } else { - MonoDebugLocalsInfo *locals; - - locals = mono_debug_lookup_locals (frame->de.method, TRUE); - if (locals) { - g_assert (pos < locals->num_locals); - pos = locals->locals [pos].index; - mono_debug_free_locals (locals); + if (!CHECK_PROTOCOL_VERSION (2, 59)) { //from newer protocol versions it's sent the pdb index + MonoDebugLocalsInfo *locals; + locals = mono_debug_lookup_locals (frame->de.method); + if (locals) { + g_assert (pos < locals->num_locals); + pos = locals->locals [pos].index; + mono_debug_free_locals (locals); + } } g_assert (pos >= 0 && pos < jit->num_locals); diff --git a/src/mono/mono/component/debugger-stub.c b/src/mono/mono/component/debugger-stub.c index 77bd42ccca939f..2bfb88e2abd5fb 100644 --- a/src/mono/mono/component/debugger-stub.c +++ b/src/mono/mono/component/debugger-stub.c @@ -155,7 +155,8 @@ stub_debugger_end_exception_filter (MonoException *exc, MonoContext *ctx, MonoCo static void stub_debugger_user_break (void) { - G_BREAKPOINT (); + if (get_mini_debug_options ()->native_debugger_break) + G_BREAKPOINT (); } static void diff --git a/src/mono/mono/component/hot_reload.c b/src/mono/mono/component/hot_reload.c index 80374aeef906bc..d43cca86b251a6 100644 --- a/src/mono/mono/component/hot_reload.c +++ b/src/mono/mono/component/hot_reload.c @@ -793,6 +793,13 @@ hot_reload_effective_table_slow (const MonoTableInfo **t, int *idx) if (G_LIKELY (*idx < table_info_get_rows (*t) && !any_modified)) return; + /* FIXME: when adding methods this won't work anymore. We will need to update the delta + * images' suppressed columns (see the Note in pass2 about + * CMiniMdRW::m_SuppressedDeltaColumns) with the baseline values. */ + /* The only column from the updates that matters the RVA, which is looked up elsewhere. */ + if (tbl_index == MONO_TABLE_METHOD) + return; + GList *list = info->delta_image; MonoImage *dmeta; int ridx; @@ -1272,6 +1279,29 @@ apply_enclog_pass2 (MonoImage *image_base, BaselineInfo *base_info, uint32_t gen MonoTableInfo *table_enclog = &image_dmeta->tables [MONO_TABLE_ENCLOG]; int rows = table_info_get_rows (table_enclog); + /* NOTE: Suppressed colums + * + * Certain column values in some tables in the deltas are not meant to be applied over the + * previous generation. See CMiniMdRW::m_SuppressedDeltaColumns in CoreCLR. For example the + * MONO_METHOD_PARAMLIST column in MONO_TABLE_METHOD is always 0 in an update - for modified + * rows the previous value must be carried over. For added rows, it is supposed to be + * initialized to the end of the param table and updated with the "Param create" func code + * in subsequent EnCLog records. + * + * For mono's immutable model (where we don't change the baseline image data), we will need + * to mutate the delta image tables to incorporate the suppressed column values from the + * previous generation. + * + * For Baseline capabilities, the only suppressed column is MONO_METHOD_PARAMLIST - which we + * can ignore because we don't do anything with param updates and the only column we care + * about is MONO_METHOD_RVA which gets special case treatment with set_update_method(). + * + * But when we implement additional capabilities (for example UpdateParameters), we will + * need to start mutating the delta image tables to pick up the suppressed column values. + * Fortunately whether we get the delta from the debugger or from the runtime API, we always + * have it in writable memory (and not mmap-ed pages), so we can rewrite the table values. + */ + gboolean assemblyref_updated = FALSE; for (int i = 0; i < rows ; ++i) { guint32 cols [MONO_ENCLOG_SIZE]; diff --git a/src/mono/mono/component/mini-wasm-debugger.c b/src/mono/mono/component/mini-wasm-debugger.c index f70738d7cb0c15..20c0ea07625c66 100644 --- a/src/mono/mono/component/mini-wasm-debugger.c +++ b/src/mono/mono/component/mini-wasm-debugger.c @@ -370,6 +370,12 @@ mono_wasm_set_is_debugger_attached (gboolean is_attached) EMSCRIPTEN_KEEPALIVE gboolean mono_wasm_send_dbg_command_with_parms (int id, MdbgProtCommandSet command_set, int command, guint8* data, unsigned int size, int valtype, char* newvalue) { + if (!debugger_enabled) { + EM_ASM ({ + MONO.mono_wasm_add_dbg_command_received ($0, $1, $2, $3); + }, 0, id, 0, 0); + return TRUE; + } MdbgProtBuffer bufWithParms; buffer_init (&bufWithParms, 128); m_dbgprot_buffer_add_data (&bufWithParms, data, size); @@ -387,6 +393,12 @@ mono_wasm_send_dbg_command_with_parms (int id, MdbgProtCommandSet command_set, i EMSCRIPTEN_KEEPALIVE gboolean mono_wasm_send_dbg_command (int id, MdbgProtCommandSet command_set, int command, guint8* data, unsigned int size) { + if (!debugger_enabled) { + EM_ASM ({ + MONO.mono_wasm_add_dbg_command_received ($0, $1, $2, $3); + }, 0, id, 0, 0); + return TRUE; + } ss_calculate_framecount (NULL, NULL, TRUE, NULL, NULL); MdbgProtBuffer buf; buffer_init (&buf, 128); @@ -414,7 +426,7 @@ static gboolean receive_debugger_agent_message (void *data, int len) { EM_ASM ({ - MONO.mono_wasm_add_dbg_command_received (1, -1, $0, $1); + MONO.mono_wasm_add_dbg_command_received (1, 0, $0, $1); }, data, len); mono_wasm_save_thread_context(); mono_wasm_fire_debugger_agent_message (); diff --git a/src/mono/mono/eglib/CMakeLists.txt b/src/mono/mono/eglib/CMakeLists.txt index 1325ee6c1126ce..69bf7e188696b1 100644 --- a/src/mono/mono/eglib/CMakeLists.txt +++ b/src/mono/mono/eglib/CMakeLists.txt @@ -43,6 +43,10 @@ set(eglib_common_sources gunicode.c unicode-data.h) +if(HAVE_CLOCK_NANOSLEEP) +list(APPEND eglib_common_sources gclock-nanosleep.c) +endif() + addprefix(eglib_sources ../eglib/ "${eglib_platform_sources};${eglib_common_sources}") add_library(eglib_objects OBJECT "${eglib_sources}") diff --git a/src/mono/mono/eglib/eglib-remap.h b/src/mono/mono/eglib/eglib-remap.h index c3e956842dea85..3af646a8e47b2f 100644 --- a/src/mono/mono/eglib/eglib-remap.h +++ b/src/mono/mono/eglib/eglib-remap.h @@ -318,3 +318,7 @@ #define g_ascii_charcmp monoeg_ascii_charcmp #define g_ascii_charcasecmp monoeg_ascii_charcasecmp #define g_warning_d monoeg_warning_d + +#ifdef HAVE_CLOCK_NANOSLEEP +#define g_clock_nanosleep monoeg_clock_nanosleep +#endif diff --git a/src/mono/mono/eglib/gclock-nanosleep.c b/src/mono/mono/eglib/gclock-nanosleep.c new file mode 100644 index 00000000000000..f2ced8b2c07d1a --- /dev/null +++ b/src/mono/mono/eglib/gclock-nanosleep.c @@ -0,0 +1,31 @@ +/* + * gclock_nanosleep.c: Clock nanosleep on platforms that have clock_nanosleep(). + * + * Copyright 2022 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. +*/ + +#include +#include +#include + +gint +g_clock_nanosleep (clockid_t clockid, gint flags, const struct timespec *request, struct timespec *remain) +{ + gint ret = 0; + +#if defined(HAVE_CLOCK_NANOSLEEP) && !defined(__PASE__) + ret = clock_nanosleep (clockid, flags, request, remain); +#else + g_assert_not_reached (); +#endif + +#ifdef HOST_ANDROID + // Workaround for incorrect implementation of clock_nanosleep return value on old Android (<=5.1) + // See https://github.com/xamarin/xamarin-android/issues/6600 + if (ret == -1) + ret = errno; +#endif + + return ret; +} diff --git a/src/mono/mono/eglib/gdate-unix.c b/src/mono/mono/eglib/gdate-unix.c index 53f4bbb3d5adc2..9a98e663045762 100644 --- a/src/mono/mono/eglib/gdate-unix.c +++ b/src/mono/mono/eglib/gdate-unix.c @@ -64,7 +64,7 @@ g_usleep (gulong microseconds) } do { - ret = clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &target, NULL); + ret = g_clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &target, NULL); if (ret != 0 && ret != EINTR) g_error ("%s: clock_nanosleep () returned %d", __func__, ret); } while (ret == EINTR); diff --git a/src/mono/mono/eglib/gfile-posix.c b/src/mono/mono/eglib/gfile-posix.c index 5bda34cdfc8291..f46f8098f6bcf8 100644 --- a/src/mono/mono/eglib/gfile-posix.c +++ b/src/mono/mono/eglib/gfile-posix.c @@ -161,26 +161,3 @@ g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **gerror) } return fd; } - -gchar * -g_get_current_dir (void) -{ - int s = 32; - char *buffer = NULL, *r; - gboolean fail; - - do { - buffer = g_realloc (buffer, s); - r = getcwd (buffer, s); - fail = (r == NULL && errno == ERANGE); - if (fail) { - s <<= 1; - } - } while (fail); - - /* On amd64 sometimes the bottom 32-bits of r == the bottom 32-bits of buffer - * but the top 32-bits of r have overflown to 0xffffffff (seriously, getcwd - * so we return the buffer here since it has a pointer to the valid string - */ - return buffer; -} diff --git a/src/mono/mono/eglib/ghashtable.c b/src/mono/mono/eglib/ghashtable.c index 5329fab0cabc5a..8799ed46f8e57c 100644 --- a/src/mono/mono/eglib/ghashtable.c +++ b/src/mono/mono/eglib/ghashtable.c @@ -673,7 +673,7 @@ guint g_str_hash (gconstpointer v1) { guint hash = 0; - char *p = (char *) v1; + unsigned char *p = (unsigned char *) v1; while (*p++) hash = (hash << 5) - (hash + *p); diff --git a/src/mono/mono/eglib/glib.h b/src/mono/mono/eglib/glib.h index 5a454a037202f5..4c08f44732eee5 100644 --- a/src/mono/mono/eglib/glib.h +++ b/src/mono/mono/eglib/glib.h @@ -27,6 +27,7 @@ #include #include #include +#include // - Pointers should only be converted to or from pointer-sized integers. // - Any size integer can be converted to any other size integer. @@ -1508,4 +1509,13 @@ mono_qsort (void* base, size_t num, size_t size, int (*compare)(const void*, con #define g_try_realloc(obj, size) (g_cast (monoeg_try_realloc ((obj), (size)))) #define g_memdup(mem, size) (g_cast (monoeg_g_memdup ((mem), (size)))) +/* + * Clock Nanosleep + */ + +#ifdef HAVE_CLOCK_NANOSLEEP +gint +g_clock_nanosleep (clockid_t clockid, gint flags, const struct timespec *request, struct timespec *remain); +#endif + #endif // __GLIB_H diff --git a/src/mono/mono/eglib/gmisc-unix.c b/src/mono/mono/eglib/gmisc-unix.c index 2a3afc002596ae..2630d515fda5f8 100644 --- a/src/mono/mono/eglib/gmisc-unix.c +++ b/src/mono/mono/eglib/gmisc-unix.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -201,3 +202,25 @@ g_get_tmp_dir (void) return tmp_dir; } +gchar * +g_get_current_dir (void) +{ + int s = 32; + char *buffer = NULL, *r; + gboolean fail; + + do { + buffer = g_realloc (buffer, s); + r = getcwd (buffer, s); + fail = (r == NULL && errno == ERANGE); + if (fail) { + s <<= 1; + } + } while (fail); + + /* On amd64 sometimes the bottom 32-bits of r == the bottom 32-bits of buffer + * but the top 32-bits of r have overflown to 0xffffffff (seriously, getcwd + * so we return the buffer here since it has a pointer to the valid string + */ + return buffer; +} diff --git a/src/mono/mono/eglib/gmisc-win32.c b/src/mono/mono/eglib/gmisc-win32.c index f5589cb63d5320..82860a575ed12d 100644 --- a/src/mono/mono/eglib/gmisc-win32.c +++ b/src/mono/mono/eglib/gmisc-win32.c @@ -232,3 +232,35 @@ g_get_tmp_dir (void) } return tmp_dir; } + +gchar * +g_get_current_dir (void) +{ + gunichar2 *buffer = NULL; + gchar* val = NULL; + gint32 retval, buffer_size = MAX_PATH; + + buffer = g_new (gunichar2, buffer_size); + retval = GetCurrentDirectoryW (buffer_size, buffer); + + if (retval != 0) { + // the size might be larger than MAX_PATH + // https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd + if (retval > buffer_size) { + buffer_size = retval; + buffer = g_realloc (buffer, buffer_size*sizeof(gunichar2)); + retval = GetCurrentDirectoryW (buffer_size, buffer); + } + + val = u16to8 (buffer); + } else { + if (GetLastError () != ERROR_ENVVAR_NOT_FOUND) { + val = g_malloc (1); + *val = 0; + } + } + + g_free (buffer); + + return val; +} diff --git a/src/mono/mono/eglib/gstr.c b/src/mono/mono/eglib/gstr.c index c549b241894f14..cbf63d8f02b979 100644 --- a/src/mono/mono/eglib/gstr.c +++ b/src/mono/mono/eglib/gstr.c @@ -249,7 +249,11 @@ g_strerror (gint errnum) size_t buff_len = sizeof (tmp_buff); buff [0] = 0; -#ifndef STRERROR_R_CHAR_P +#if HAVE_GNU_STRERROR_R + buff = strerror_r (errnum, buff, buff_len); + if (!error_messages [errnum]) + error_messages [errnum] = g_strdup (buff); +#else /* HAVE_GNU_STRERROR_R */ int r; while ((r = strerror_r (errnum, buff, buff_len - 1))) { if (r != ERANGE) { @@ -261,17 +265,13 @@ g_strerror (gint errnum) else buff = g_realloc (buff, buff_len * 2); buff_len *= 2; - //Spec is not clean on whether size argument includes space for null terminator or not + //Spec is not clean on whether size argument includes space for null terminator or not } if (!error_messages [errnum]) error_messages [errnum] = g_strdup (buff); if (buff != tmp_buff) g_free (buff); -#else /* STRERROR_R_CHAR_P */ - buff = strerror_r (errnum, buff, buff_len); - if (!error_messages [errnum]) - error_messages [errnum] = g_strdup (buff); -#endif /* STRERROR_R_CHAR_P */ +#endif /* HAVE_GNU_STRERROR_R */ #else /* HAVE_STRERROR_R */ if (!error_messages [errnum]) diff --git a/src/mono/mono/eventpipe/CMakeLists.txt b/src/mono/mono/eventpipe/CMakeLists.txt index 530abd5908667f..ccc55d57300a5f 100644 --- a/src/mono/mono/eventpipe/CMakeLists.txt +++ b/src/mono/mono/eventpipe/CMakeLists.txt @@ -1,3 +1,8 @@ +# For feature detection to work correctly, this needs to be outside of the conditional. +set(EP_GENERATED_HEADER_PATH "${MONO_EVENTPIPE_GEN_INCLUDE_PATH}") +include(../../../../eng/native/configurepaths.cmake) +include(${SHARED_EVENTPIPE_SOURCE_PATH}configure.cmake) + if(ENABLE_PERFTRACING) include(${MONO_EVENTPIPE_SHIM_SOURCE_PATH}/gen-eventing.cmake) @@ -79,7 +84,7 @@ if(ENABLE_PERFTRACING) addprefix(shared_diagnostic_server_sources_base ${SHARED_EVENTPIPE_SOURCE_PATH} "${shared_diagnostic_server_sources_base}") addprefix(mono_diagnostic_server_shim_sources_base ${MONO_EVENTPIPE_SHIM_SOURCE_PATH} "${mono_diagnostic_server_shim_sources_base}") - set(eventpipe_sources ${shared_eventpipe_sources_base} ${mono_eventpipe_shim_sources_base} ${MONO_EVENTPIPE_GEN_HEADERS} ${MONO_EVENTPIPE_GEN_SOURCES}) + set(eventpipe_sources ${shared_eventpipe_sources_base} ${SHARED_EVENTPIPE_CONFIG_HEADERS} ${mono_eventpipe_shim_sources_base} ${MONO_EVENTPIPE_GEN_HEADERS} ${MONO_EVENTPIPE_GEN_SOURCES}) set(diagnostic_server_sources ${shared_diagnostic_server_sources_base} ${mono_diagnostic_server_shim_sources_base}) set_source_files_properties(${SHARED_EVENTPIPE_SOURCE_PATH}/ep-sources.c PROPERTIES COMPILE_DEFINITIONS EP_FORCE_INCLUDE_SOURCE_FILES) diff --git a/src/mono/mono/eventpipe/ds-rt-mono.h b/src/mono/mono/eventpipe/ds-rt-mono.h index 1785d6e51037c5..d3ed4f02b1b229 100644 --- a/src/mono/mono/eventpipe/ds-rt-mono.h +++ b/src/mono/mono/eventpipe/ds-rt-mono.h @@ -172,7 +172,7 @@ ds_rt_config_value_get_default_port_suspend (void) static inline ds_ipc_result_t -ds_rt_generate_core_dump (DiagnosticsGenerateCoreDumpCommandPayload *payload) +ds_rt_generate_core_dump (DiagnosticsDumpCommandId commandId, DiagnosticsGenerateCoreDumpCommandPayload *payload) { // TODO: Implement. return DS_IPC_E_NOTSUPPORTED; diff --git a/src/mono/mono/eventpipe/ep-rt-mono.c b/src/mono/mono/eventpipe/ep-rt-mono.c index acdaf8f1a5078d..f222b099fcee1b 100644 --- a/src/mono/mono/eventpipe/ep-rt-mono.c +++ b/src/mono/mono/eventpipe/ep-rt-mono.c @@ -2553,6 +2553,16 @@ ep_rt_mono_sample_profiler_write_sampling_event_for_threads ( // as second, re-classify current callstack to be executing managed code. data->payload_data = EP_SAMPLE_PROFILER_SAMPLE_TYPE_MANAGED; } + if (data->stack_walk_data.top_frame && ep_stack_contents_get_length (&data->stack_contents) == 0) { + // If no managed frames (including helper frames) are located on stack, mark sample as beginning in external code. + // This can happen on attached embedding threads returning to native code between runtime invokes. + // Make sure sample is still written into EventPipe for all attached threads even if they are currently not having + // any managed frames on stack. Prevents some tools applying thread time heuristics to prolong duration of last sample + // when embedding thread returns to native code. It also opens ability to visualize number of samples in unmanaged code + // on attached threads when executing outside of runtime. If tooling is not interested in these sample events, they are easy + // to identify and filter out. + data->payload_data = EP_SAMPLE_PROFILER_SAMPLE_TYPE_EXTERNAL; + } sampled_thread_count++; } @@ -2570,7 +2580,7 @@ ep_rt_mono_sample_profiler_write_sampling_event_for_threads ( THREAD_INFO_TYPE adapter = { { 0 } }; for (uint32_t i = 0; i < sampled_thread_count; ++i) { EventPipeSampleProfileStackWalkData *data = &g_array_index (_ep_rt_mono_sampled_thread_callstacks, EventPipeSampleProfileStackWalkData, i); - if (data->payload_data != EP_SAMPLE_PROFILER_SAMPLE_TYPE_ERROR && ep_stack_contents_get_length(&data->stack_contents) > 0) { + if ((data->stack_walk_data.top_frame && data->payload_data == EP_SAMPLE_PROFILER_SAMPLE_TYPE_EXTERNAL) || (data->payload_data != EP_SAMPLE_PROFILER_SAMPLE_TYPE_ERROR && ep_stack_contents_get_length (&data->stack_contents) > 0)) { // Check if we have an async frame, if so we will need to make sure all frames are registered in regular jit info table. // TODO: An async frame can contain wrapper methods (no way to check during stackwalk), we could skip writing profile event // for this specific stackwalk or we could cleanup stack_frames before writing profile event. @@ -2943,6 +2953,8 @@ get_module_event_data ( module_data->module_flags |= MODULE_FLAGS_NATIVE_MODULE; module_data->module_il_path = image && image->filename ? image->filename : ""; + module_data->module_il_pdb_path = ""; + module_data->module_il_pdb_age = 0; if (image && image->image_info) { MonoPEDirEntry *debug_dir_entry = (MonoPEDirEntry *)&image->image_info->cli_header.datadir.pe_debug; @@ -2984,6 +2996,7 @@ ep_rt_mono_write_event_module_load (MonoImage *image) if (image) { ModuleEventData module_data; + memset (&module_data, 0, sizeof (module_data)); if (get_module_event_data (image, &module_data)) { FireEtwModuleLoad_V2 ( module_data.module_id, @@ -3027,6 +3040,7 @@ ep_rt_mono_write_event_module_unload (MonoImage *image) if (image) { ModuleEventData module_data; + memset (&module_data, 0, sizeof (module_data)); if (get_module_event_data (image, &module_data)) { FireEtwModuleUnload_V2 ( module_data.module_id, @@ -3085,6 +3099,7 @@ ep_rt_mono_write_event_assembly_load (MonoAssembly *assembly) if (assembly) { AssemblyEventData assembly_data; + memset (&assembly_data, 0, sizeof (assembly_data)); if (get_assembly_event_data (assembly, &assembly_data)) { FireEtwAssemblyLoad_V1 ( assembly_data.assembly_id, @@ -3111,6 +3126,7 @@ ep_rt_mono_write_event_assembly_unload (MonoAssembly *assembly) if (assembly) { AssemblyEventData assembly_data; + memset (&assembly_data, 0, sizeof (assembly_data)); if (get_assembly_event_data (assembly, &assembly_data)) { FireEtwAssemblyUnload_V1 ( assembly_data.assembly_id, @@ -3276,10 +3292,14 @@ ep_rt_mono_write_event_exception_thrown (MonoObject *obj) flags |= EXCEPTION_THROWN_FLAGS_IS_CLS_COMPLIANT; if (exception->inner_ex) flags |= EXCEPTION_THROWN_FLAGS_HAS_INNER; - exception_message = ep_rt_utf16_to_utf8_string (mono_string_chars_internal (exception->message), mono_string_length_internal (exception->message)); + if (exception->message) + exception_message = ep_rt_utf16_to_utf8_string (mono_string_chars_internal (exception->message), mono_string_length_internal (exception->message)); hresult = exception->hresult; } + if (exception_message == NULL) + exception_message = g_strdup (""); + if (mono_get_eh_callbacks ()->mono_walk_stack_with_ctx) mono_get_eh_callbacks ()->mono_walk_stack_with_ctx (get_exception_ip_func, NULL, MONO_UNWIND_SIGNAL_SAFE, (void *)&ip); @@ -5463,6 +5483,7 @@ mono_profiler_module_loaded ( if (image) { ModuleEventData module_data; + memset (&module_data, 0, sizeof (module_data)); if (get_module_event_data (image, &module_data)) module_path = (const ep_char8_t *)module_data.module_il_path; module_guid = (const ep_char8_t *)mono_image_get_guid (image); @@ -5514,6 +5535,7 @@ mono_profiler_module_unloaded ( if (image) { ModuleEventData module_data; + memset (&module_data, 0, sizeof (module_data)); if (get_module_event_data (image, &module_data)) module_path = (const ep_char8_t *)module_data.module_il_path; module_guid = (const ep_char8_t *)mono_image_get_guid (image); diff --git a/src/mono/mono/eventpipe/ep-rt-mono.h b/src/mono/mono/eventpipe/ep-rt-mono.h index b42aa108f7c29a..550526366cc41f 100644 --- a/src/mono/mono/eventpipe/ep-rt-mono.h +++ b/src/mono/mono/eventpipe/ep-rt-mono.h @@ -602,7 +602,19 @@ inline size_t ep_rt_atomic_compare_exchange_size_t (volatile size_t *target, size_t expected, size_t value) { +#if SIZEOF_SIZE_T == 8 + return (size_t)(mono_atomic_cas_i64((volatile gint64*)(target), (gint64)(value), (gint64)(expected))); +#else return (size_t)(mono_atomic_cas_i32 ((volatile gint32 *)(target), (gint32)(value), (gint32)(expected))); +#endif +} + +static +inline +ep_char8_t * +ep_rt_atomic_compare_exchange_utf8_string (ep_char8_t *volatile *target, ep_char8_t *expected, ep_char8_t *value) +{ + return (ep_char8_t *)mono_atomic_cas_ptr ((volatile gpointer *)target, (gpointer)value, (gpointer)expected); } /* @@ -1855,7 +1867,15 @@ inline const ep_char8_t * ep_rt_entrypoint_assembly_name_get_utf8 (void) { - return (const ep_char8_t *)m_image_get_assembly_name (mono_assembly_get_main ()->image); + MonoAssembly *main_assembly = mono_assembly_get_main (); + if (!main_assembly || !main_assembly->image) + return ""; + + const char *assembly_name = m_image_get_assembly_name (main_assembly->image); + if (!assembly_name) + return ""; + + return (const ep_char8_t*)assembly_name; } static diff --git a/src/mono/mono/eventpipe/test/ep-provider-callback-dataqueue-tests.c b/src/mono/mono/eventpipe/test/ep-provider-callback-dataqueue-tests.c index b60af234fe136b..32acf62243719a 100644 --- a/src/mono/mono/eventpipe/test/ep-provider-callback-dataqueue-tests.c +++ b/src/mono/mono/eventpipe/test/ep-provider-callback-dataqueue-tests.c @@ -46,23 +46,26 @@ test_provider_callback_data_queue (void) EventPipeProviderCallbackDataQueue callback_data_queue; EventPipeProviderCallbackDataQueue *provider_callback_data_queue = ep_provider_callback_data_queue_init (&callback_data_queue); - EventPipeProviderCallbackData enqueue_callback_data; - EventPipeProviderCallbackData *provider_enqueue_callback_data = ep_provider_callback_data_init ( - &enqueue_callback_data, - "", - provider_callback, - NULL, - 1, - EP_EVENT_LEVEL_LOGALWAYS, - true); - - for (uint32_t i = 0; i < 1000; ++i) + for (uint32_t i = 0; i < 1000; ++i) { + EventPipeProviderCallbackData enqueue_callback_data; + EventPipeProviderCallbackData *provider_enqueue_callback_data = ep_provider_callback_data_init ( + &enqueue_callback_data, + "", + provider_callback, + NULL, + 1, + EP_EVENT_LEVEL_LOGALWAYS, + true); ep_provider_callback_data_queue_enqueue (provider_callback_data_queue, provider_enqueue_callback_data); + ep_provider_callback_data_fini (provider_enqueue_callback_data); + } EventPipeProviderCallbackData dequeue_callback_data; uint32_t deque_counter = 0; - while (ep_provider_callback_data_queue_try_dequeue (provider_callback_data_queue, &dequeue_callback_data)) + while (ep_provider_callback_data_queue_try_dequeue(provider_callback_data_queue, &dequeue_callback_data)) { deque_counter++; + ep_provider_callback_data_fini (&dequeue_callback_data); + } if (deque_counter != 1000) { result = FAILED ("Unexpected number of provider callback invokes"); diff --git a/src/mono/mono/eventpipe/test/ep-tests.c b/src/mono/mono/eventpipe/test/ep-tests.c index 5ff65d1497a2c2..e9e30c39833215 100644 --- a/src/mono/mono/eventpipe/test/ep-tests.c +++ b/src/mono/mono/eventpipe/test/ep-tests.c @@ -620,7 +620,7 @@ test_create_delete_provider_with_callback (void) EventPipeProvider *test_provider = NULL; EventPipeProviderConfiguration provider_config; - EventPipeProviderConfiguration *current_provider_config =ep_provider_config_init (&provider_config, TEST_PROVIDER_NAME, 1, EP_EVENT_LEVEL_LOGALWAYS, ""); + EventPipeProviderConfiguration *current_provider_config = ep_provider_config_init (&provider_config, TEST_PROVIDER_NAME, 1, EP_EVENT_LEVEL_LOGALWAYS, ""); ep_raise_error_if_nok (current_provider_config != NULL); test_location = 1; diff --git a/src/mono/mono/metadata/assembly.c b/src/mono/mono/metadata/assembly.c index d30fc22d275e76..424e67803364d0 100644 --- a/src/mono/mono/metadata/assembly.c +++ b/src/mono/mono/metadata/assembly.c @@ -288,7 +288,7 @@ mono_assembly_names_equal_flags (MonoAssemblyName *l, MonoAssemblyName *r, MonoA * if \p r is a lower version than \p l, or zero if \p l and \p r are equal * versions (comparing upto \p maxcomps components). * - * Components are \c major, \c minor, \c revision, and \c build. \p maxcomps 1 means just compare + * Components are \c major, \c minor, \c build, and \c revision. \p maxcomps 1 means just compare * majors. 2 means majors then minors. etc. */ static int @@ -304,9 +304,9 @@ assembly_names_compare_versions (MonoAssemblyName *l, MonoAssemblyName *r, int m ++i; CMP (minor); ++i; - CMP (revision); - ++i; CMP (build); + ++i; + CMP (revision); #undef CMP return 0; } diff --git a/src/mono/mono/metadata/class-setup-vtable.c b/src/mono/mono/metadata/class-setup-vtable.c index ae1727efa0beb0..2c56437ae97a52 100644 --- a/src/mono/mono/metadata/class-setup-vtable.c +++ b/src/mono/mono/metadata/class-setup-vtable.c @@ -1643,6 +1643,10 @@ check_vtable_covariant_override_impls (MonoClass *klass, MonoMethod **vtable, in break; MonoMethod *prev_impl = cur_class->vtable[slot]; + // if the current class re-abstracted the method, it may not be there. + if (!prev_impl) + continue; + if (prev_impl != last_checked_prev_override) { /* * the new impl should be subsumed by the prior one, ie this @@ -1742,11 +1746,11 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o for (int i = 0; i < iface_onum; i++) { MonoMethod *decl = iface_overrides [i*2]; MonoMethod *override = iface_overrides [i*2 + 1]; - if (decl->is_inflated) { + if (mono_class_is_gtd (override->klass)) { + override = mono_class_inflate_generic_method_full_checked (override, ic, mono_class_get_context (ic), error); + } else if (decl->is_inflated) { override = mono_class_inflate_generic_method_checked (override, mono_method_get_context (decl), error); mono_error_assert_ok (error); - } else if (mono_class_is_gtd (override->klass)) { - override = mono_class_inflate_generic_method_full_checked (override, ic, mono_class_get_context (ic), error); } if (!apply_override (klass, ic, vtable, decl, override, &override_map, &override_class_map, &conflict_map)) goto fail; diff --git a/src/mono/mono/metadata/custom-attrs.c b/src/mono/mono/metadata/custom-attrs.c index 48571da6a085ea..29c64c48f3fafc 100644 --- a/src/mono/mono/metadata/custom-attrs.c +++ b/src/mono/mono/metadata/custom-attrs.c @@ -397,7 +397,11 @@ MONO_RESTORE_WARNING // to decode some attributes in assemblies that Windows .NET Framework // and CoreCLR both manage to decode. // See https://simonsapin.github.io/wtf-8/ for a description of wtf-8. - *out_obj = (MonoObject*)mono_string_new_wtf8_len_checked (p, slen, error); + // Always use string.Empty for empty strings + if (slen == 0) + *out_obj = (MonoObject*)mono_string_empty_internal (mono_domain_get ()); + else + *out_obj = (MonoObject*)mono_string_new_wtf8_len_checked (p, slen, error); return NULL; } case MONO_TYPE_CLASS: { diff --git a/src/mono/mono/metadata/external-only.c b/src/mono/mono/metadata/external-only.c index 19999e384c7763..08d629dbf2dfc1 100644 --- a/src/mono/mono/metadata/external-only.c +++ b/src/mono/mono/metadata/external-only.c @@ -23,6 +23,7 @@ #include "assembly-internals.h" #include "external-only.h" #include "threads.h" +#include #include "threads-types.h" #include "jit-info.h" @@ -696,3 +697,25 @@ mono_domain_owns_vtable_slot (MonoDomain *domain, gpointer vtable_slot) { return mono_mem_manager_mp_contains_addr (mono_mem_manager_get_ambient (), vtable_slot); } + +/** + * mono_method_get_unmanaged_callers_only_ftnptr: + * \param method method to generate a thunk for. + * \param error set on error + * + * Returns a function pointer for calling the given UnmanagedCallersOnly method from native code. + * The function pointer will use the calling convention specified on the UnmanagedCallersOnly + * attribute (or the default platform calling convention if omitted). + * + * Unlike \c mono_method_get_unmanaged_thunk, minimal marshaling is done to the method parameters in + * the wrapper. See + * https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.unmanagedcallersonlyattribute?view=net-6.0 + * The method must be static and only use blittable argument types. There is no exception out-argument. + * + * + */ +void* +mono_method_get_unmanaged_callers_only_ftnptr (MonoMethod *method, MonoError *error) +{ + MONO_EXTERNAL_ONLY_GC_UNSAFE (gpointer, mono_method_get_unmanaged_wrapper_ftnptr_internal (method, TRUE, error)); +} diff --git a/src/mono/mono/metadata/icall-def-netcore.h b/src/mono/mono/metadata/icall-def-netcore.h index 8e026693a109ee..02dfa0ed3cbe0e 100644 --- a/src/mono/mono/metadata/icall-def-netcore.h +++ b/src/mono/mono/metadata/icall-def-netcore.h @@ -98,12 +98,10 @@ ICALL_TYPE(ENV, "System.Environment", ENV_1) NOHANDLES(ICALL(ENV_1, "Exit", ves_icall_System_Environment_Exit)) HANDLES(ENV_1a, "FailFast", ves_icall_System_Environment_FailFast, void, 3, (MonoString, MonoException, MonoString)) HANDLES(ENV_2, "GetCommandLineArgs", ves_icall_System_Environment_GetCommandLineArgs, MonoArray, 0, ()) -HANDLES(ENV_3, "GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames, MonoArray, 0, ()) NOHANDLES(ICALL(ENV_4, "GetProcessorCount", ves_icall_System_Environment_get_ProcessorCount)) NOHANDLES(ICALL(ENV_9, "get_ExitCode", mono_environment_exitcode_get)) NOHANDLES(ICALL(ENV_15, "get_TickCount", ves_icall_System_Environment_get_TickCount)) NOHANDLES(ICALL(ENV_15a, "get_TickCount64", ves_icall_System_Environment_get_TickCount64)) -HANDLES(ENV_17, "internalGetEnvironmentVariable_native", ves_icall_System_Environment_GetEnvironmentVariable_native, MonoString, 1, (const_char_ptr)) NOHANDLES(ICALL(ENV_20, "set_ExitCode", mono_environment_exitcode_set)) ICALL_TYPE(GC, "System.GC", GC_13) diff --git a/src/mono/mono/metadata/icall-internals.h b/src/mono/mono/metadata/icall-internals.h index 082a57b64cf808..45a51a2224b174 100644 --- a/src/mono/mono/metadata/icall-internals.h +++ b/src/mono/mono/metadata/icall-internals.h @@ -35,12 +35,6 @@ mono_icall_get_new_line (MonoError *error); MonoBoolean mono_icall_is_64bit_os (void); -MonoArrayHandle -mono_icall_get_environment_variable_names (MonoError *error); - -void -mono_icall_set_environment_variable (MonoString *name, MonoString *value); - MonoStringHandle mono_icall_get_windows_folder_path (int folder, MonoError *error); diff --git a/src/mono/mono/metadata/icall-windows.c b/src/mono/mono/metadata/icall-windows.c index e288e2d2447174..0b5adb2488679f 100644 --- a/src/mono/mono/metadata/icall-windows.c +++ b/src/mono/mono/metadata/icall-windows.c @@ -88,64 +88,6 @@ mono_icall_is_64bit_os (void) #endif } -MonoArrayHandle -mono_icall_get_environment_variable_names (MonoError *error) -{ - MonoArrayHandle names; - MonoStringHandle str; - WCHAR* env_strings; - WCHAR* env_string; - WCHAR* equal_str; - int n = 0; - - env_strings = GetEnvironmentStrings(); - - if (env_strings) { - env_string = env_strings; - while (*env_string != '\0') { - /* weird case that MS seems to skip */ - if (*env_string != '=') - n++; - while (*env_string != '\0') - env_string++; - env_string++; - } - } - - names = mono_array_new_handle (mono_defaults.string_class, n, error); - return_val_if_nok (error, NULL_HANDLE_ARRAY); - - if (env_strings) { - n = 0; - str = MONO_HANDLE_NEW (MonoString, NULL); - env_string = env_strings; - while (*env_string != '\0') { - /* weird case that MS seems to skip */ - if (*env_string != '=') { - equal_str = wcschr(env_string, '='); - g_assert(equal_str); - MonoString *s = mono_string_new_utf16_checked (env_string, (gint32)(equal_str - env_string), error); - goto_if_nok (error, cleanup); - MONO_HANDLE_ASSIGN_RAW (str, s); - - mono_array_handle_setref (names, n, str); - n++; - } - while (*env_string != '\0') - env_string++; - env_string++; - } - - } - -cleanup: - if (env_strings) - FreeEnvironmentStrings (env_strings); - if (!is_ok (error)) - return NULL_HANDLE_ARRAY; - return names; -} - #if HAVE_API_SUPPORT_WIN32_SH_GET_FOLDER_PATH #include MonoStringHandle diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index 7dd21b9b538c6c..a671c641175072 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -3227,44 +3227,47 @@ init_io_stream_slots (void) io_stream_slots_set = TRUE; } -MonoBoolean -ves_icall_System_IO_Stream_HasOverriddenBeginEndRead (MonoObjectHandle stream, MonoError *error) + +static MonoBoolean +stream_has_overriden_begin_or_end_method (MonoObjectHandle stream, int begin_slot, int end_slot, MonoError *error) { MonoClass* curr_klass = MONO_HANDLE_GET_CLASS (stream); MonoClass* base_klass = mono_class_try_get_stream_class (); - if (!io_stream_slots_set) - init_io_stream_slots (); + mono_class_setup_vtable (curr_klass); + if (mono_class_has_failure (curr_klass)) { + mono_error_set_for_class_failure (error, curr_klass); + return_val_if_nok (error, FALSE); + } // slots can still be -1 and it means Linker removed the methods from the base class (Stream) // in this case we can safely assume the methods are not overridden // otherwise - check vtable MonoMethod **curr_klass_vtable = m_class_get_vtable (curr_klass); - gboolean begin_read_is_overriden = io_stream_begin_read_slot != -1 && curr_klass_vtable [io_stream_begin_read_slot]->klass != base_klass; - gboolean end_read_is_overriden = io_stream_end_read_slot != -1 && curr_klass_vtable [io_stream_end_read_slot]->klass != base_klass; + gboolean begin_is_overriden = begin_slot != -1 && curr_klass_vtable [begin_slot] != NULL && curr_klass_vtable [begin_slot]->klass != base_klass; + gboolean end_is_overriden = end_slot != -1 && curr_klass_vtable [end_slot] != NULL && curr_klass_vtable [end_slot]->klass != base_klass; + + return begin_is_overriden || end_is_overriden; +} + +MonoBoolean +ves_icall_System_IO_Stream_HasOverriddenBeginEndRead (MonoObjectHandle stream, MonoError *error) +{ + if (!io_stream_slots_set) + init_io_stream_slots (); // return true if BeginRead or EndRead were overriden - return begin_read_is_overriden || end_read_is_overriden; + return stream_has_overriden_begin_or_end_method (stream, io_stream_begin_read_slot, io_stream_end_read_slot, error); } MonoBoolean ves_icall_System_IO_Stream_HasOverriddenBeginEndWrite (MonoObjectHandle stream, MonoError *error) { - MonoClass* curr_klass = MONO_HANDLE_GETVAL (stream, vtable)->klass; - MonoClass* base_klass = mono_class_try_get_stream_class (); - if (!io_stream_slots_set) init_io_stream_slots (); - // slots can still be -1 and it means Linker removed the methods from the base class (Stream) - // in this case we can safely assume the methods are not overridden - // otherwise - check vtable - MonoMethod **curr_klass_vtable = m_class_get_vtable (curr_klass); - gboolean begin_write_is_overriden = io_stream_begin_write_slot != -1 && curr_klass_vtable [io_stream_begin_write_slot]->klass != base_klass; - gboolean end_write_is_overriden = io_stream_end_write_slot != -1 && curr_klass_vtable [io_stream_end_write_slot]->klass != base_klass; - // return true if BeginWrite or EndWrite were overriden - return begin_write_is_overriden || end_write_is_overriden; + return stream_has_overriden_begin_or_end_method (stream, io_stream_begin_write_slot, io_stream_end_write_slot, error); } MonoBoolean @@ -6519,52 +6522,6 @@ ves_icall_System_Environment_GetIs64BitOperatingSystem (void) return mono_icall_is_64bit_os (); } -MonoStringHandle -ves_icall_System_Environment_GetEnvironmentVariable_native (const gchar *utf8_name, MonoError *error) -{ - gchar *value; - - if (utf8_name == NULL) - return NULL_HANDLE_STRING; - - value = g_getenv (utf8_name); - - if (value == 0) - return NULL_HANDLE_STRING; - - MonoStringHandle res = mono_string_new_handle (value, error); - g_free (value); - return res; -} - -/* - * There is no standard way to get at environ. - */ -#ifndef _MSC_VER -#ifndef __MINGW32_VERSION -#if defined(__APPLE__) -#if defined (TARGET_OSX) -/* Apple defines this in crt_externs.h but doesn't provide that header for - * arm-apple-darwin9. We'll manually define the symbol on Apple as it does - * in fact exist on all implementations (so far) - */ -G_BEGIN_DECLS -gchar ***_NSGetEnviron(void); -G_END_DECLS -#define environ (*_NSGetEnviron()) -#else -static char *mono_environ[1] = { NULL }; -#define environ mono_environ -#endif /* defined (TARGET_OSX) */ -#else -G_BEGIN_DECLS -extern -char **environ; -G_END_DECLS -#endif -#endif -#endif - MonoArrayHandle ves_icall_System_Environment_GetCommandLineArgs (MonoError *error) { @@ -6572,51 +6529,6 @@ ves_icall_System_Environment_GetCommandLineArgs (MonoError *error) return result; } -#ifndef HOST_WIN32 -static MonoArrayHandle -mono_icall_get_environment_variable_names (MonoError *error) -{ - MonoArrayHandle names; - MonoStringHandle str; - gchar **e, **parts; - int n; - - n = 0; - for (e = environ; *e != 0; ++ e) - ++ n; - - names = mono_array_new_handle (mono_defaults.string_class, n, error); - return_val_if_nok (error, NULL_HANDLE_ARRAY); - - str = MONO_HANDLE_NEW (MonoString, NULL); - n = 0; - for (e = environ; *e != 0; ++ e) { - parts = g_strsplit (*e, "=", 2); - if (*parts != 0) { - MonoString *s = mono_string_new_checked (*parts, error); - MONO_HANDLE_ASSIGN_RAW (str, s); - if (!is_ok (error)) { - g_strfreev (parts); - return NULL_HANDLE_ARRAY; - } - mono_array_handle_setref (names, n, str); - } - - g_strfreev (parts); - - ++ n; - } - - return names; -} -#endif /* !HOST_WIN32 */ - -MonoArrayHandle -ves_icall_System_Environment_GetEnvironmentVariableNames (MonoError *error) -{ - return mono_icall_get_environment_variable_names (error); -} - void ves_icall_System_Environment_Exit (int result) { @@ -6691,6 +6603,19 @@ ves_icall_System_Environment_get_TickCount64 (void) gpointer ves_icall_RuntimeMethodHandle_GetFunctionPointer (MonoMethod *method, MonoError *error) { + return mono_method_get_unmanaged_wrapper_ftnptr_internal (method, FALSE, error); +} + +void* +mono_method_get_unmanaged_wrapper_ftnptr_internal (MonoMethod *method, gboolean only_unmanaged_callers_only, MonoError *error) +{ + /* WISH: we should do this in managed */ + if (G_UNLIKELY (mono_method_has_unmanaged_callers_only_attribute (method))) { + method = mono_marshal_get_managed_wrapper (method, NULL, (MonoGCHandle)0, error); + return_val_if_nok (error, NULL); + } else { + g_assert (!only_unmanaged_callers_only); + } return mono_get_runtime_callbacks ()->get_ftnptr (method, error); } diff --git a/src/mono/mono/metadata/marshal.c b/src/mono/mono/metadata/marshal.c index 0a9d8f8ff1abd0..ede9551b57459d 100644 --- a/src/mono/mono/metadata/marshal.c +++ b/src/mono/mono/metadata/marshal.c @@ -1,7 +1,7 @@ /** * \file * Routines for marshaling complex types in P/Invoke methods. - * + * * Author: * Paolo Molaro (lupus@ximian.com) * @@ -76,7 +76,7 @@ enum { }; #undef OPDEF -/* +/* * This mutex protects the various marshalling related caches in MonoImage * and a few other data structures static to this file. * @@ -145,7 +145,7 @@ mono_signature_no_pinvoke (MonoMethod *method) sig = mono_metadata_signature_dup_full (get_method_image (method), sig); sig->pinvoke = FALSE; } - + return sig; } @@ -348,7 +348,7 @@ mono_delegate_to_ftnptr_impl (MonoDelegateHandle delegate, MonoError *error) return result; } -/* +/* * this hash table maps from a delegate trampoline object to a weak reference * of the delegate. As an optimizations with a non-moving GC we store the * object pointer itself, otherwise we use a GC handle. @@ -360,7 +360,7 @@ delegate_hash_table_new (void) { return g_hash_table_new (NULL, NULL); } -static void +static void delegate_hash_table_remove (MonoDelegate *d) { MonoGCHandle gchandle = NULL; @@ -429,7 +429,7 @@ parse_unmanaged_function_pointer_attr (MonoClass *klass, MonoMethodPInvoke *piin /* The attribute is only available in Net 2.0 */ if (mono_class_try_get_unmanaged_function_pointer_attribute_class ()) { - /* + /* * The pinvoke attributes are stored in a real custom attribute so we have to * construct it. */ @@ -652,7 +652,7 @@ mono_array_to_lparray_impl (MonoArrayHandle array_handle, MonoError *error) break; case MONO_TYPE_GENERICINST: case MONO_TYPE_OBJECT: - case MONO_TYPE_ARRAY: + case MONO_TYPE_ARRAY: case MONO_TYPE_SZARRAY: case MONO_TYPE_STRING: default: @@ -1138,7 +1138,7 @@ mono_type_to_ldind (MonoType *type) case MONO_TYPE_STRING: case MONO_TYPE_OBJECT: case MONO_TYPE_SZARRAY: - case MONO_TYPE_ARRAY: + case MONO_TYPE_ARRAY: return CEE_LDIND_REF; case MONO_TYPE_I8: case MONO_TYPE_U8: @@ -1192,7 +1192,7 @@ mono_type_to_stind (MonoType *type) case MONO_TYPE_STRING: case MONO_TYPE_OBJECT: case MONO_TYPE_SZARRAY: - case MONO_TYPE_ARRAY: + case MONO_TYPE_ARRAY: return CEE_STIND_REF; case MONO_TYPE_I8: case MONO_TYPE_U8: @@ -1389,7 +1389,7 @@ mono_marshal_get_ptr_to_stringbuilder_conv (MonoMethodPInvoke *piinfo, MonoMarsh } /* - * Return whenever a field of a native structure or an array member needs to + * Return whenever a field of a native structure or an array member needs to * be freed. */ gboolean @@ -1426,7 +1426,7 @@ get_cache (GHashTable **var, GHashFunc hash_func, GCompareFunc equal_func) if (!(*var)) { mono_marshal_lock (); if (!(*var)) { - GHashTable *cache = + GHashTable *cache = g_hash_table_new (hash_func, equal_func); mono_memory_barrier (); *var = cache; @@ -1503,7 +1503,7 @@ mono_mb_create_and_cache_full (GHashTable *cache, gpointer key, } return res; -} +} MonoMethod* mono_mb_create_and_cache (GHashTable *cache, gpointer key, @@ -1616,14 +1616,14 @@ get_wrapper_target_class (MonoImage *image) /* * Notes: * - can't put all wrappers into an mscorlib class, because they reference - * metadata (signature) so they should be put into the same image as the + * metadata (signature) so they should be put into the same image as the * method they wrap, so they are unloaded together. - * - putting them into a class with a type initalizer could cause the - * initializer to be executed which can be a problem if the wrappers are + * - putting them into a class with a type initalizer could cause the + * initializer to be executed which can be a problem if the wrappers are * shared. - * - putting them into an inflated class can cause problems if the the + * - putting them into an inflated class can cause problems if the the * class is deleted because it references an image which is unloaded. - * To avoid these problems, we put the wrappers into the class of + * To avoid these problems, we put the wrappers into the class of * the image. */ if (image_is_dynamic (image)) { @@ -1818,7 +1818,7 @@ mono_marshal_get_delegate_begin_invoke (MonoMethod *method) return res; } else { cache = get_cache (&get_method_image (method)->wrapper_caches.delegate_begin_invoke_cache, - (GHashFunc)mono_signature_hash, + (GHashFunc)mono_signature_hash, (GCompareFunc)mono_metadata_signature_equal); if ((res = mono_marshal_find_in_cache (cache, sig))) return res; @@ -1896,7 +1896,7 @@ mono_marshal_get_delegate_end_invoke (MonoMethod *method) return res; } else { cache = get_cache (&get_method_image (method)->wrapper_caches.delegate_end_invoke_cache, - (GHashFunc)mono_signature_hash, + (GHashFunc)mono_signature_hash, (GCompareFunc)mono_metadata_signature_equal); if ((res = mono_marshal_find_in_cache (cache, sig))) return res; @@ -1991,8 +1991,8 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt invoke_sig = sig = mono_signature_no_pinvoke (method); /* - * If the delegate target is null, and the target method is not static, a virtual - * call is made to that method with the first delegate argument as this. This is + * If the delegate target is null, and the target method is not static, a virtual + * call is made to that method with the first delegate argument as this. This is * a non-documented .NET feature. */ if (callvirt) { @@ -2056,7 +2056,7 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt cache_ptr = &mono_method_get_wrapper_cache (target_method)->delegate_bound_static_invoke_cache; cache = get_cache (cache_ptr, - (GHashFunc)mono_signature_hash, + (GHashFunc)mono_signature_hash, (GCompareFunc)mono_metadata_signature_equal); /* * The wrapper is based on sig+invoke_sig, but sig can be derived from invoke_sig. @@ -2085,7 +2085,7 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt // Inflated methods should not be in this cache because it's not stored on the imageset. g_assert (!method->is_inflated); cache = get_cache (&get_method_image (method)->wrapper_caches.delegate_invoke_cache, - (GHashFunc)mono_signature_hash, + (GHashFunc)mono_signature_hash, (GCompareFunc)mono_metadata_signature_equal); res = mono_marshal_find_in_cache (cache, sig); if (res) @@ -2147,7 +2147,7 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt /* mono_method_print_code (res); */ - return res; + return res; } /** @@ -2377,7 +2377,7 @@ wrapper_cache_signature_key_equal (MonoWrapperSignatureCacheKey *key1, MonoWrapp * * We also catch exceptions if \p exc is not NULL. * If \p virtual is TRUE, then \p method is invoked virtually on \p this. This is useful since - * it means that the compiled code for \p method does not have to be looked up + * it means that the compiled code for \p method does not have to be looked up * before calling the runtime invoke wrapper. In this case, the wrapper ignores * its \p method argument. */ @@ -2559,7 +2559,7 @@ mono_marshal_get_runtime_invoke_full (MonoMethod *method, gboolean virtual_, gbo mono_mb_free (mb); - return res; + return res; } MonoMethod * @@ -2597,7 +2597,7 @@ mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean virtual_) * dynamically. * The signature of the returned method is given by RuntimeInvokeDynamicFunction: * void runtime_invoke (void *args, MonoObject **exc, void *compiled_method) - * ARGS should point to an architecture specific structure containing + * ARGS should point to an architecture specific structure containing * the arguments and space for the return value. * The other arguments are the same as for runtime_invoke (), except that * ARGS should contain the this argument too. @@ -2759,7 +2759,7 @@ mono_marshal_get_icall_wrapper (MonoJitICallInfo *callinfo, gboolean check_excep WrapperInfo *info; gconstpointer const func = callinfo->func; - + GHashTable *cache = get_cache (& m_class_get_image (mono_defaults.object_class)->icall_wrapper_cache, mono_aligned_addr_hash, NULL); if ((res = mono_marshal_find_in_cache (cache, (gpointer) func))) return res; @@ -2961,8 +2961,8 @@ mono_marshal_boolean_managed_conv_in_get_conv_arg_class (MonoMarshalSpec *spec, } int -mono_emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t, - MonoMarshalSpec *spec, int conv_arg, +mono_emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t, + MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action) { /* Ensure that we have marshalling info for this param */ @@ -2973,12 +2973,12 @@ mono_emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t, if (spec && spec->native == MONO_NATIVE_ASANY) return get_marshal_cb ()->emit_marshal_asany (m, argnum, t, spec, conv_arg, conv_arg_type, action); - + switch (t->type) { case MONO_TYPE_VALUETYPE: if (t->data.klass == mono_class_try_get_handleref_class ()) return get_marshal_cb ()->emit_marshal_handleref (m, argnum, t, spec, conv_arg, conv_arg_type, action); - + return get_marshal_cb ()->emit_marshal_vtype (m, argnum, t, spec, conv_arg, conv_arg_type, action); case MONO_TYPE_STRING: return get_marshal_cb ()->emit_marshal_string (m, argnum, t, spec, conv_arg, conv_arg_type, action); @@ -2995,8 +2995,8 @@ mono_emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t, spec->native == MONO_NATIVE_INTERFACE)) || (t->type == MONO_TYPE_CLASS && mono_cominterop_is_interface(t->data.klass))) return mono_cominterop_emit_marshal_com_interface (m, argnum, t, spec, conv_arg, conv_arg_type, action); - if (spec && (spec->native == MONO_NATIVE_SAFEARRAY) && - (spec->data.safearray_data.elem_type == MONO_VARIANT_VARIANT) && + if (spec && (spec->native == MONO_NATIVE_SAFEARRAY) && + (spec->data.safearray_data.elem_type == MONO_VARIANT_VARIANT) && ((action == MARSHAL_ACTION_CONV_OUT) || (action == MARSHAL_ACTION_CONV_IN) || (action == MARSHAL_ACTION_PUSH))) return mono_cominterop_emit_marshal_safearray (m, argnum, t, spec, conv_arg, conv_arg_type, action); #endif @@ -3004,7 +3004,7 @@ mono_emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t, if (mono_class_try_get_safehandle_class () != NULL && t->data.klass && mono_class_is_subclass_of_internal (t->data.klass, mono_class_try_get_safehandle_class (), FALSE)) return get_marshal_cb ()->emit_marshal_safehandle (m, argnum, t, spec, conv_arg, conv_arg_type, action); - + return get_marshal_cb ()->emit_marshal_object (m, argnum, t, spec, conv_arg, conv_arg_type, action); case MONO_TYPE_ARRAY: case MONO_TYPE_SZARRAY: @@ -3439,7 +3439,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, * wrapper. */ MonoMethod * -mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig, +mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func) { MonoMethodSignature *csig; @@ -3589,17 +3589,17 @@ mono_marshal_get_native_func_wrapper_indirect (MonoClass *caller_class, MonoMeth #endif GHashTable *cache = get_cache (&image->wrapper_caches.native_func_wrapper_indirect_cache, - (GHashFunc)mono_signature_hash, + (GHashFunc)mono_signature_hash, (GCompareFunc)mono_metadata_signature_equal); - + MonoMethod *res; if ((res = mono_marshal_find_in_cache (cache, sig))) return res; - + #if 0 fprintf (stderr, "generating wrapper for signature %s\n", mono_signature_full_name (sig)); #endif - + /* FIXME: better wrapper name */ char * name = g_strdup_printf ("wrapper_native_indirect_%p", sig); MonoMethodBuilder *mb = mono_mb_new (caller_class, name, MONO_WRAPPER_MANAGED_TO_NATIVE); @@ -3689,7 +3689,7 @@ method_signature_is_blittable (MonoMethodSignature *sig) /** * mono_marshal_get_managed_wrapper: - * Generates IL code to call managed methods from unmanaged code + * Generates IL code to call managed methods from unmanaged code * If \p target_handle is \c 0, the wrapper info will be a \c WrapperInfo structure. * * If \p delegate_klass is \c NULL, we're creating a wrapper for a function pointer to a method marked with @@ -3715,7 +3715,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, return NULL; } - /* + /* * FIXME: Should cache the method+delegate type pair, since the same method * could be called with different delegates, thus different marshalling * options. @@ -3785,7 +3785,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, MonoCustomAttrInfo *cinfo; MonoCustomAttrEntry *attr; - /* + /* * The pinvoke attributes are stored in a real custom attribute. Obtain the * contents of the attribute without constructing it, as that might not be * possible when running in cross-compiling mode. @@ -4296,7 +4296,7 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method) } mono_mb_free (mb); - return res; + return res; } /** @@ -4320,7 +4320,7 @@ mono_marshal_get_unbox_wrapper (MonoMethod *method) mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_UNBOX); g_assert (sig->hasthis); - + get_marshal_cb ()->emit_unbox_wrapper (mb, method); info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NONE); @@ -4332,7 +4332,7 @@ mono_marshal_get_unbox_wrapper (MonoMethod *method) /* mono_method_print_code (res); */ - return res; + return res; } static gboolean @@ -4493,7 +4493,7 @@ mono_marshal_get_stelemref (void) WrapperInfo *info; MONO_STATIC_POINTER_INIT (MonoMethod, ret) - + mb = mono_mb_new (mono_defaults.object_class, "stelemref", MONO_WRAPPER_STELEMREF); sig = mono_metadata_signature_alloc (mono_defaults.corlib, 3); @@ -4533,9 +4533,9 @@ mono_marshal_get_gsharedvt_in_wrapper (void) MonoMethodSignature *sig; MonoMethodBuilder *mb; WrapperInfo *info; - + mb = mono_mb_new (mono_defaults.object_class, "gsharedvt_in", MONO_WRAPPER_OTHER); - + sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0); sig->ret = mono_get_void_type (); @@ -4566,9 +4566,9 @@ mono_marshal_get_gsharedvt_out_wrapper (void) MonoMethodSignature *sig; MonoMethodBuilder *mb; WrapperInfo *info; - + mb = mono_mb_new (mono_defaults.object_class, "gsharedvt_out", MONO_WRAPPER_OTHER); - + sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0); sig->ret = mono_get_void_type (); @@ -4646,7 +4646,7 @@ mono_marshal_get_array_address (int rank, int elem_size) name = g_strdup_printf ("ElementAddr_%d", elem_size); mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_MANAGED_TO_MANAGED); g_free (name); - + get_marshal_cb ()->emit_array_address (mb, rank, elem_size); info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_ELEMENT_ADDR); @@ -4738,7 +4738,7 @@ mono_marshal_get_array_accessor_wrapper (MonoMethod *method) } mono_mb_free (mb); - return res; + return res; } #ifndef HOST_WIN32 @@ -4802,7 +4802,7 @@ mono_marshal_free (gpointer ptr) * mono_marshal_free_array: */ void -mono_marshal_free_array (gpointer *ptr, int size) +mono_marshal_free_array (gpointer *ptr, int size) { int i; @@ -5070,9 +5070,9 @@ mono_struct_delete_old (MonoClass *klass, char *ptr) if (ftype->attrs & FIELD_ATTRIBUTE_STATIC) continue; - mono_type_to_unmanaged (ftype, info->fields [i].mspec, TRUE, + mono_type_to_unmanaged (ftype, info->fields [i].mspec, TRUE, m_class_is_unicode (klass), &conv); - + cpos = ptr + info->fields [i].offset; switch (conv) { @@ -5087,7 +5087,7 @@ mono_struct_delete_old (MonoClass *klass, char *ptr) break; case MONO_MARSHAL_CONV_STR_LPTSTR: #ifdef TARGET_WIN32 - /* We assume this field points inside a MonoString + /* We assume this field points inside a MonoString * on Win32 */ break; #endif @@ -5259,7 +5259,7 @@ ves_icall_System_Runtime_InteropServices_Marshal_IsPinnableType (MonoReflectionT if (m_class_get_rank (klass)) { MonoClass *eklass = m_class_get_element_class (klass); if (m_class_is_primitive (eklass)) - return TRUE; + return TRUE; return eklass != mono_defaults.object_class && m_class_is_blittable (eklass); } else return m_class_is_blittable (klass); @@ -5283,7 +5283,7 @@ mono_marshal_is_loading_type_info (MonoClass *klass) * mono_marshal_load_type_info: * * Initialize \c klass::marshal_info using information from metadata. This function can - * recursively call itself, and the caller is responsible to avoid that by calling + * recursively call itself, and the caller is responsible to avoid that by calling * \c mono_marshal_is_loading_type_info beforehand. * * LOCKING: Acquires the loader lock. @@ -5320,7 +5320,7 @@ mono_marshal_load_type_info (MonoClass* klass) loads_list = (GSList *)mono_native_tls_get_value (load_type_info_tls_id); loads_list = g_slist_prepend (loads_list, klass); mono_native_tls_set_value (load_type_info_tls_id, loads_list); - + iter = NULL; while ((field = mono_class_get_fields_internal (klass, &iter))) { if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) @@ -5334,7 +5334,7 @@ mono_marshal_load_type_info (MonoClass* klass) info = (MonoMarshalType *)mono_image_alloc0 (m_class_get_image (klass), MONO_SIZEOF_MARSHAL_TYPE + sizeof (MonoMarshalField) * count); info->num_fields = count; - + /* Try to find a size for this type in metadata */ mono_metadata_packing_from_typedef (m_class_get_image (klass), m_class_get_type_token (klass), NULL, &native_size); @@ -5352,14 +5352,14 @@ mono_marshal_load_type_info (MonoClass* klass) while ((field = mono_class_get_fields_internal (klass, &iter))) { int size; guint32 align; - + if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; if (mono_field_is_deleted (field)) continue; if (field->type->attrs & FIELD_ATTRIBUTE_HAS_FIELD_MARSHAL) - mono_metadata_field_info_with_mempool (m_class_get_image (klass), mono_metadata_token_index (mono_class_get_field_token (field)) - 1, + mono_metadata_field_info_with_mempool (m_class_get_image (klass), mono_metadata_token_index (mono_class_get_field_token (field)) - 1, NULL, NULL, &info->fields [j].mspec); info->fields [j].field = field; @@ -5373,7 +5373,7 @@ mono_marshal_load_type_info (MonoClass* klass) switch (layout) { case TYPE_ATTRIBUTE_AUTO_LAYOUT: case TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT: - size = mono_marshal_type_size (field->type, info->fields [j].mspec, + size = mono_marshal_type_size (field->type, info->fields [j].mspec, &align, TRUE, m_class_is_unicode (klass)); align = m_class_get_packing_size (klass) ? MIN (m_class_get_packing_size (klass), align): align; min_align = MAX (align, min_align); @@ -5383,13 +5383,13 @@ mono_marshal_load_type_info (MonoClass* klass) info->native_size = info->fields [j].offset + size; break; case TYPE_ATTRIBUTE_EXPLICIT_LAYOUT: - size = mono_marshal_type_size (field->type, info->fields [j].mspec, + size = mono_marshal_type_size (field->type, info->fields [j].mspec, &align, TRUE, m_class_is_unicode (klass)); min_align = MAX (align, min_align); info->fields [j].offset = field->offset - MONO_ABI_SIZEOF (MonoObject); info->native_size = MAX (info->native_size, info->fields [j].offset + size); break; - } + } j++; } @@ -5448,9 +5448,9 @@ mono_marshal_load_type_info (MonoClass* klass) /** * mono_class_native_size: - * \param klass a class - * \returns the native size of an object instance (when marshaled - * to unmanaged code) + * \param klass a class + * \returns the native size of an object instance (when marshaled + * to unmanaged code) */ gint32 mono_class_native_size (MonoClass *klass, guint32 *align) @@ -5531,7 +5531,7 @@ mono_type_native_stack_size (MonoType *t, guint32 *align) if (!mono_type_generic_inst_is_valuetype (t)) { *align = TARGET_SIZEOF_VOID_P; return TARGET_SIZEOF_VOID_P; - } + } /* Fall through */ case MONO_TYPE_TYPEDBYREF: case MONO_TYPE_VALUETYPE: { @@ -5544,7 +5544,7 @@ mono_type_native_stack_size (MonoType *t, guint32 *align) size = mono_class_native_size (klass, align); *align = *align + 3; *align &= ~3; - + size += 3; size &= ~3; @@ -5615,19 +5615,12 @@ mono_marshal_type_size (MonoType *type, MonoMarshalSpec *mspec, guint32 *align, case MONO_NATIVE_LPSTRUCT: *align = MONO_ABI_ALIGNOF (gpointer); return TARGET_SIZEOF_VOID_P; - case MONO_NATIVE_STRUCT: + case MONO_NATIVE_STRUCT: klass = mono_class_from_mono_type_internal (type); if (klass == mono_defaults.object_class && (mspec && mspec->native == MONO_NATIVE_STRUCT)) { *align = 16; return 16; - } else if (strcmp (m_class_get_name_space (klass), "System") == 0 && - strcmp (m_class_get_name (klass), "Decimal") == 0) { - - // Special case: Managed Decimal consists of 4 int32 fields, the alignment should be 8 on x64 to follow - // https://github.com/dotnet/coreclr/blob/4450e5ca663b9e66c20e6f9751c941efa3716fde/src/vm/methodtablebuilder.cpp#L9753 - *align = MONO_ABI_ALIGNOF (gpointer); - return mono_class_native_size (klass, NULL); } padded_size = mono_class_native_size (klass, align); if (padded_size == 0) @@ -5659,7 +5652,7 @@ mono_marshal_type_size (MonoType *type, MonoMarshalSpec *mspec, guint32 *align, case MONO_NATIVE_CURRENCY: case MONO_NATIVE_VBBYREFSTR: default: - g_error ("native type %02x not implemented", native_type); + g_error ("native type %02x not implemented", native_type); break; } g_assert_not_reached (); @@ -5732,7 +5725,7 @@ mono_marshal_asany_impl (MonoObjectHandle o, MonoMarshalNative string_encoding, return res; } case MONO_TYPE_SZARRAY: { - //TODO: Implement structs and in-params for all value types + //TODO: Implement structs and in-params for all value types MonoClass *klass = t->data.klass; MonoClass *eklass = m_class_get_element_class (klass); MonoArray *arr = (MonoArray *) MONO_HANDLE_RAW (o); @@ -6040,7 +6033,7 @@ mono_marshal_free_dynamic_wrappers (MonoMethod *method) /* This could be called during shutdown */ if (marshal_mutex_initialized) mono_marshal_lock (); - /* + /* * FIXME: We currently leak the wrappers. Freeing them would be tricky as * they could be shared with other methods ? */ diff --git a/src/mono/mono/metadata/metadata.c b/src/mono/mono/metadata/metadata.c index 1e3cd55ed2d8f5..1e954b1c3ded1b 100644 --- a/src/mono/mono/metadata/metadata.c +++ b/src/mono/mono/metadata/metadata.c @@ -1923,7 +1923,7 @@ static guint mono_generic_class_hash (gconstpointer data) { const MonoGenericClass *gclass = (const MonoGenericClass *) data; - guint hash = mono_metadata_type_hash (m_class_get_byval_arg (gclass->container_class)); + guint hash = mono_metadata_str_hash (m_class_get_name (gclass->container_class)); hash *= 13; hash += gclass->is_tb_open; @@ -5386,7 +5386,8 @@ guint mono_metadata_str_hash (gconstpointer v1) { /* Same as g_str_hash () in glib */ - char *p = (char *) v1; + /* note: signed/unsigned char matters - we feed UTF-8 to this function, so the high bit will give diferent results if we don't match. */ + unsigned char *p = (unsigned char *) v1; guint hash = *p; while (*p++) { diff --git a/src/mono/mono/metadata/mono-debug.c b/src/mono/mono/metadata/mono-debug.c index b9bea0e78f5d06..03626981f441d0 100644 --- a/src/mono/mono/metadata/mono-debug.c +++ b/src/mono/mono/metadata/mono-debug.c @@ -867,7 +867,7 @@ mono_debug_method_lookup_location (MonoDebugMethodInfo *minfo, int il_offset) * The result should be freed using mono_debug_free_locals (). */ MonoDebugLocalsInfo* -mono_debug_lookup_locals (MonoMethod *method, mono_bool ignore_pdb) +mono_debug_lookup_locals (MonoMethod *method) { MonoDebugMethodInfo *minfo; MonoDebugLocalsInfo *res; @@ -893,18 +893,16 @@ mono_debug_lookup_locals (MonoMethod *method, mono_bool ignore_pdb) return NULL; } - if (ignore_pdb) - res = mono_debug_symfile_lookup_locals (minfo); - else { - if (minfo->handle->ppdb) { - res = mono_ppdb_lookup_locals (minfo); - } else { - if (!minfo->handle->symfile || !mono_debug_symfile_is_loaded (minfo->handle->symfile)) - res = NULL; - else - res = mono_debug_symfile_lookup_locals (minfo); - } + + if (minfo->handle->ppdb) { + res = mono_ppdb_lookup_locals (minfo); + } else { + if (!minfo->handle->symfile || !mono_debug_symfile_is_loaded (minfo->handle->symfile)) + res = NULL; + else + res = mono_debug_symfile_lookup_locals (minfo); } + mono_debugger_unlock (); return res; diff --git a/src/mono/mono/metadata/mono-debug.h b/src/mono/mono/metadata/mono-debug.h index 2ddbce09947153..2fe6a3394afda1 100644 --- a/src/mono/mono/metadata/mono-debug.h +++ b/src/mono/mono/metadata/mono-debug.h @@ -189,7 +189,7 @@ MONO_API void mono_debug_add_delegate_trampoline (void* code, int size); MONO_API MonoDebugLocalsInfo* -mono_debug_lookup_locals (MonoMethod *method, mono_bool ignore_pdb); +mono_debug_lookup_locals (MonoMethod *method); MONO_API MonoDebugMethodAsyncInfo* mono_debug_lookup_method_async_debug_info (MonoMethod *method); diff --git a/src/mono/mono/metadata/mono-private-unstable.h b/src/mono/mono/metadata/mono-private-unstable.h index 4618c8fe08bc92..72f0a912c5207b 100644 --- a/src/mono/mono/metadata/mono-private-unstable.h +++ b/src/mono/mono/metadata/mono-private-unstable.h @@ -42,4 +42,7 @@ mono_create_new_bundled_satellite_assembly (const char *name, const char *cultur typedef void * (*PInvokeOverrideFn) (const char *libraryName, const char *entrypointName); +MONO_API MONO_RT_EXTERNAL_ONLY void* +mono_method_get_unmanaged_callers_only_ftnptr (MonoMethod *method, MonoError *error); + #endif /*__MONO_METADATA_MONO_PRIVATE_UNSTABLE_H__*/ diff --git a/src/mono/mono/metadata/native-library.c b/src/mono/mono/metadata/native-library.c index dd67477d092d4c..ab5f6432386552 100644 --- a/src/mono/mono/metadata/native-library.c +++ b/src/mono/mono/metadata/native-library.c @@ -92,7 +92,7 @@ mono_dllmap_lookup_list (MonoDllMap *dll_map, const char *dll, const char* func, if (!dll_map) goto exit; - /* + /* * we use the first entry we find that matches, since entries from * the config file are prepended to the list and we document that the * later entries win. @@ -254,7 +254,7 @@ mono_global_dllmap_cleanup (void) * This function is used to programatically add \c DllImport remapping in either * a specific assembly, or as a global remapping. This is done by remapping * references in a \c DllImport attribute from the \p dll library name into the \p tdll - * name. If the \p dll name contains the prefix i:, the comparison of the + * name. If the \p dll name contains the prefix i:, the comparison of the * library name is done without case sensitivity. * * If you pass \p func, this is the name of the \c EntryPoint in a \c DllImport if specified @@ -518,21 +518,38 @@ netcore_probe_for_module (MonoImage *image, const char *file_name, int flags) // TODO: this algorithm doesn't quite match CoreCLR, so respecting DLLIMPORTSEARCHPATH_LEGACY_BEHAVIOR makes little sense // If the difference becomes a problem, overhaul this algorithm to match theirs exactly - // Try without any path additions - module = netcore_probe_for_module_variations (NULL, file_name, lflags); + gboolean probe_first_without_prepend = FALSE; + +#if defined(HOST_ANDROID) + // On Android, try without any path additions first. It is sensitive to probing that will always miss + // and lookup for some libraries is required to use a relative path + probe_first_without_prepend = TRUE; +#else + if (file_name != NULL && g_path_is_absolute (file_name)) + probe_first_without_prepend = TRUE; +#endif + if (module == NULL && probe_first_without_prepend) + module = netcore_probe_for_module_variations (NULL, file_name, lflags); // Check the NATIVE_DLL_SEARCH_DIRECTORIES for (int i = 0; i < pinvoke_search_directories_count && module == NULL; ++i) module = netcore_probe_for_module_variations (pinvoke_search_directories[i], file_name, lflags); // Check the assembly directory if the search flag is set and the image exists - if (flags & DLLIMPORTSEARCHPATH_ASSEMBLY_DIRECTORY && image != NULL && module == NULL) { + if ((flags & DLLIMPORTSEARCHPATH_ASSEMBLY_DIRECTORY) != 0 && image != NULL && + module == NULL && (image->filename != NULL)) { char *mdirname = g_path_get_dirname (image->filename); if (mdirname) module = netcore_probe_for_module_variations (mdirname, file_name, lflags); g_free (mdirname); } + // Try without any path additions, if we didn't try it already + if (module == NULL && !probe_first_without_prepend) + { + module = netcore_probe_for_module_variations (NULL, file_name, lflags); + } + // TODO: Pass remaining flags on to LoadLibraryEx on Windows where appropriate, see https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.dllimportsearchpath?view=netcore-3.1 return module; @@ -951,6 +968,7 @@ lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_ou const char *new_import = NULL; const char *orig_scope = NULL; const char *new_scope = NULL; + const char *error_scope = NULL; char *error_msg = NULL; MonoDl *module = NULL; gpointer addr = NULL; @@ -997,6 +1015,8 @@ lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_ou new_import = g_strdup (orig_import); #endif + error_scope = new_scope; + /* If qcalls are disabled, we fall back to the normal pinvoke code for them */ #ifndef DISABLE_QCALLS if (strcmp (new_scope, "QCall") == 0) { @@ -1045,16 +1065,16 @@ lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_ou mono_custom_attrs_free (cinfo); } if (flags < 0) - flags = 0; + flags = DLLIMPORTSEARCHPATH_ASSEMBLY_DIRECTORY; module = netcore_lookup_native_library (alc, image, new_scope, flags); if (!module) { mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_DLLIMPORT, "DllImport unable to load library '%s'.", - new_scope); + error_scope); status_out->err_code = LOOKUP_PINVOKE_ERR_NO_LIB; - status_out->err_arg = g_strdup (new_scope); + status_out->err_arg = g_strdup (error_scope); goto exit; } @@ -1066,7 +1086,7 @@ lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_ou if (!addr) { #ifndef HOST_WIN32 if (strcmp (new_scope, "__Internal") == 0) { - g_free ((char *)new_scope); + g_assert (error_scope == new_scope); new_scope = g_strdup (MONO_LOADER_LIBRARY_NAME); goto retry_with_libcoreclr; } @@ -1078,6 +1098,9 @@ lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_ou piinfo->addr = addr; exit: + if (error_scope != new_scope) { + g_free ((char *)error_scope); + } g_free ((char *)new_import); g_free ((char *)new_scope); g_free (error_msg); @@ -1148,7 +1171,7 @@ pinvoke_probe_for_symbol (MonoDl *module, MonoMethodPInvoke *piinfo, const char #if HOST_WIN32 && HOST_X86 /* Try the stdcall mangled name */ - /* + /* * gcc under windows creates mangled names without the underscore, but MS.NET * doesn't support it, so we doesn't support it either. */ @@ -1388,7 +1411,7 @@ mono_loader_save_bundled_library (int fd, uint64_t offset, uint64_t size, const char *file, *buffer, *err, *internal_path; if (!bundle_save_library_initialized) bundle_save_library_initialize (); - + file = g_build_filename (bundled_dylibrary_directory, destfname, (const char*)NULL); buffer = g_str_from_file_region (fd, offset, size); g_file_set_contents (file, buffer, size, NULL); @@ -1403,7 +1426,7 @@ mono_loader_save_bundled_library (int fd, uint64_t offset, uint64_t size, const mono_loader_register_module (internal_path, lib); g_free (internal_path); bundle_library_paths = g_slist_append (bundle_library_paths, file); - + g_free (buffer); } diff --git a/src/mono/mono/metadata/object-internals.h b/src/mono/mono/metadata/object-internals.h index 9702920b3c26eb..d5c69bbf2877f9 100644 --- a/src/mono/mono/metadata/object-internals.h +++ b/src/mono/mono/metadata/object-internals.h @@ -1068,6 +1068,7 @@ typedef struct { MonoArray *cattrs; MonoString *version; MonoString *culture; + MonoArray *public_key_token; MonoArray *loaded_modules; guint32 access; } MonoReflectionAssemblyBuilder; @@ -2096,4 +2097,7 @@ int mono_string_instance_is_interned (MonoString *str); #endif +gpointer +mono_method_get_unmanaged_wrapper_ftnptr_internal (MonoMethod *method, gboolean only_unmanaged_callers_only, MonoError *error); + #endif /* __MONO_OBJECT_INTERNALS_H__ */ diff --git a/src/mono/mono/metadata/object.c b/src/mono/mono/metadata/object.c index b4a19469544991..2caf2cb4ba6cfc 100644 --- a/src/mono/mono/metadata/object.c +++ b/src/mono/mono/metadata/object.c @@ -397,6 +397,7 @@ mono_runtime_run_module_cctor (MonoImage *image, MonoError *error) MonoClass *module_klass; MonoVTable *module_vtable; + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_TYPE, "Running module .cctor for '%s'", image->name); module_klass = mono_class_get_checked (image, MONO_TOKEN_TYPE_DEF | 1, error); if (!module_klass) { return FALSE; @@ -522,6 +523,11 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error) if (do_initialization) { MonoException *exc = NULL; + if (mono_trace_is_traced (G_LOG_LEVEL_DEBUG, MONO_TRACE_TYPE)) { + char* type_name = mono_type_full_name (m_class_get_byval_arg (klass)); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_TYPE, "Running class .cctor for %s from '%s'", type_name, m_class_get_image (klass)->name); + g_free (type_name); + } /* We are holding the per-vtable lock, do the actual initialization */ mono_threads_begin_abort_protected_block (); @@ -1358,8 +1364,8 @@ print_imt_entry (const char* message, MonoImtBuilderEntry *e, int num) { message, num, method, - method->klass->name_space, - method->klass->name, + m_class_get_name_space (method->klass), + m_class_get_name (method->klass), method->name); } else { printf (" * %s: NULL\n", message); @@ -1472,12 +1478,11 @@ get_generic_virtual_entries (MonoMemoryManager *mem_manager, gpointer *vtable_sl * */ static void -build_imt_slots (MonoClass *klass, MonoVTable *vt, gpointer* imt, GSList *extra_interfaces, int slot_num) +build_imt_slots (MonoClass *klass, MonoVTable *vt, gpointer* imt, int slot_num) { MONO_REQ_GC_NEUTRAL_MODE; int i; - GSList *list_item; guint32 imt_collisions_bitmap = 0; MonoImtBuilderEntry **imt_builder = (MonoImtBuilderEntry **)g_calloc (MONO_IMT_SIZE, sizeof (MonoImtBuilderEntry*)); int method_count = 0; @@ -1513,6 +1518,8 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, gpointer* imt, GSList *extra_ * add_imt_builder_entry anyway. */ method = mono_class_get_method_by_index (mono_class_get_generic_class (iface)->container_class, method_slot_in_interface); + if (m_method_is_static (method)) + continue; if (mono_method_get_imt_slot (method) != slot_num) { vt_slot ++; continue; @@ -1520,8 +1527,10 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, gpointer* imt, GSList *extra_ } method = mono_class_get_method_by_index (iface, method_slot_in_interface); if (method->is_generic) { - has_generic_virtual = TRUE; - vt_slot ++; + if (m_method_is_virtual (method)) { + has_generic_virtual = TRUE; + vt_slot ++; + } continue; } @@ -1534,23 +1543,6 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, gpointer* imt, GSList *extra_ } } } - if (extra_interfaces) { - int interface_offset = m_class_get_vtable_size (klass); - - for (list_item = extra_interfaces; list_item != NULL; list_item=list_item->next) { - MonoClass* iface = (MonoClass *)list_item->data; - int method_slot_in_interface; - int mcount = mono_class_get_method_count (iface); - for (method_slot_in_interface = 0; method_slot_in_interface < mcount; method_slot_in_interface++) { - MonoMethod *method = mono_class_get_method_by_index (iface, method_slot_in_interface); - - if (method->is_generic) - has_generic_virtual = TRUE; - add_imt_builder_entry (imt_builder, method, &imt_collisions_bitmap, interface_offset + method_slot_in_interface, slot_num); - } - interface_offset += mcount; - } - } for (i = 0; i < MONO_IMT_SIZE; ++i) { /* overwrite the imt slot only if we're building all the entries or if * we're building this specific one @@ -1650,7 +1642,7 @@ mono_vtable_build_imt_slot (MonoVTable* vtable, int imt_slot) mono_loader_lock (); /* we change the slot only if it wasn't changed from the generic imt trampoline already */ if (!callbacks.imt_entry_inited (vtable, imt_slot)) - build_imt_slots (vtable->klass, vtable, imt, NULL, imt_slot); + build_imt_slots (vtable->klass, vtable, imt, imt_slot); mono_loader_unlock (); } diff --git a/src/mono/mono/metadata/sre.c b/src/mono/mono/metadata/sre.c index 17e49231129ea6..c2c599d197a4f9 100644 --- a/src/mono/mono/metadata/sre.c +++ b/src/mono/mono/metadata/sre.c @@ -1263,6 +1263,13 @@ mono_reflection_dynimage_basic_init (MonoReflectionAssemblyBuilder *assemblyb, M assembly->assembly.aname.revision = 0; } + if (assemblyb->public_key_token) { + for (int i = 0; i < 8 && i < mono_array_length_internal (assemblyb->public_key_token); i++) { + guint8 byte = mono_array_get_internal (assemblyb->public_key_token, guint8, i); + sprintf ((char*)(assembly->assembly.aname.public_key_token + 2 * i), "%02x", byte); + } + } + /* SRE assemblies are loaded into the individual loading context, ie, * they only fire AssemblyResolve events, they don't cause probing for * referenced assemblies to happen. */ diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index 3e9ca497336abf..1ab14164663022 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -23,7 +23,7 @@ if(HOST_DARWIN) set(OS_LIBS "-framework CoreFoundation" "-framework Foundation") if(CMAKE_SYSTEM_VARIANT STREQUAL "MacCatalyst") - set(OS_LIBS "-lobjc" "-lc++") + set(OS_LIBS ${OS_LIBS} "-lobjc" "-lc++") endif() elseif(HOST_IOS) set(OS_LIBS "-framework CoreFoundation" "-lobjc" "-lc++") @@ -44,8 +44,10 @@ include(../eglib/CMakeLists.txt) include(../utils/CMakeLists.txt) include(../metadata/CMakeLists.txt) include(../sgen/CMakeLists.txt) -if(INTERNAL_ZLIB) # TODO: hook up HAVE_SYS_ZLIB instead +if(INTERNAL_ZLIB) include(../zlib/CMakeLists.txt) +elseif(HAVE_SYS_ZLIB) + set(Z_LIBS z) endif() include(../component/CMakeLists.txt) @@ -77,9 +79,19 @@ if(HAVE_SYS_ICU) pal_timeZoneInfo.c entrypoints.c ${pal_icushim_sources_base}) + + if (TARGET_DARWIN) + set(icu_shim_sources_base + ${icu_shim_sources_base} + pal_locale.m) + endif() + addprefix(icu_shim_sources "${ICU_SHIM_PATH}" "${icu_shim_sources_base}") set_source_files_properties(${icu_shim_sources} PROPERTIES COMPILE_DEFINITIONS OSX_ICU_LIBRARY_PATH="${OSX_ICU_LIBRARY_PATH}") set_source_files_properties(${icu_shim_sources} PROPERTIES COMPILE_FLAGS "-I\"${ICU_INCLUDEDIR}\" -I\"${CMAKE_CURRENT_SOURCE_DIR}/../../../libraries/Native/Unix/System.Globalization.Native/\" -I\"${CMAKE_CURRENT_SOURCE_DIR}/../../../libraries/Native/Unix/Common/\" ${ICU_FLAGS}") + if(TARGET_DARWIN) + set_property(SOURCE "${ICU_SHIM_PATH}/pal_locale.m" APPEND_STRING PROPERTY COMPILE_FLAGS "${CLR_CMAKE_COMMON_OBJC_FLAGS}") + endif() if(TARGET_WIN32) set_source_files_properties(${icu_shim_sources} PROPERTIES LANGUAGE CXX) endif() @@ -315,6 +327,8 @@ endif() if(HOST_WIN32) set(mini_sources "${mini_sources};${PROJECT_BINARY_DIR}/../../NativeVersion.rc") # this is generated by GenerateMonoVersionFile in mono.proj +elseif(NOT HOST_BROWSER) +set(mini_sources "${mini_sources};${PROJECT_BINARY_DIR}/../../version.c") # this is generated by GenerateMonoVersionFile in mono.proj endif() set(monosgen-sources "${metadata_sources};${utils_sources};${sgen_sources};${icu_shim_sources};${mini_sources};${zlib_sources}") @@ -352,7 +366,7 @@ if(NOT DISABLE_SHARED_LIBS) # to avoid a conflict we rename the import library with the .import.lib suffix set_target_properties(monosgen-shared PROPERTIES IMPORT_SUFFIX ".import.lib") endif() - target_link_libraries(monosgen-shared PRIVATE ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS}) + target_link_libraries(monosgen-shared PRIVATE ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS}) if(ICU_LDFLAGS) set_property(TARGET monosgen-shared APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}") endif() @@ -402,7 +416,7 @@ if(NOT DISABLE_SHARED_LIBS) add_library(${frameworkconfig} SHARED $) target_compile_definitions(${frameworkconfig} PRIVATE -DMONO_DLL_EXPORT) target_sources(${frameworkconfig} PRIVATE $) - target_link_libraries(${frameworkconfig} PRIVATE ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS}) + target_link_libraries(${frameworkconfig} PRIVATE ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS}) if(ICU_LDFLAGS) set_property(TARGET ${frameworkconfig} APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}") endif() @@ -473,7 +487,10 @@ if(NOT DISABLE_EXECUTABLES) set(sgen_sources "${sgen_sources};${PROJECT_BINARY_DIR}/../../NativeVersion.rc") endif() add_executable(mono-sgen "${sgen_sources}") - target_link_libraries(mono-sgen PRIVATE monosgen-static ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS}) + if(MONO_CROSS_COMPILE_EXECUTABLE_NAME) + set_target_properties(mono-sgen PROPERTIES OUTPUT_NAME mono-aot-cross) + endif() + target_link_libraries(mono-sgen PRIVATE monosgen-static ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS}) if(NOT DISABLE_COMPONENTS AND STATIC_COMPONENTS AND NOT DISABLE_LINK_STATIC_COMPONENTS) # if components are built statically, link them into runtime. target_sources(mono-sgen PRIVATE "${mono-components-objects}") @@ -492,4 +509,7 @@ if(NOT DISABLE_EXECUTABLES) set_property(TARGET mono-sgen APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}") endif() install(TARGETS mono-sgen RUNTIME) + if(HOST_WIN32) + install(FILES $ DESTINATION bin OPTIONAL) + endif() endif() diff --git a/src/mono/mono/mini/abcremoval.c b/src/mono/mono/mini/abcremoval.c index 44317cdac6c5cb..c758a485a0fcfa 100644 --- a/src/mono/mono/mini/abcremoval.c +++ b/src/mono/mono/mini/abcremoval.c @@ -493,7 +493,7 @@ get_relations_from_previous_bb (MonoVariableRelationsEvaluationArea *area, MonoB symmetric_relation = MONO_SYMMETRIC_RELATION (branch_relation); /* FIXME: Other compare opcodes */ - if (compare->opcode == OP_ICOMPARE) { + if (compare->opcode == OP_ICOMPARE && compare->sreg1 != compare->sreg2) { relations->relation1.variable = compare->sreg1; relations->relation1.relation.relation = branch_relation; relations->relation1.relation.related_value.type = MONO_VARIABLE_SUMMARIZED_VALUE; diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 369016e11892d6..732c2cd961d294 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -1149,7 +1149,7 @@ arch_init (MonoAotCompile *acfg) if (strstr (acfg->aot_opts.mtriple, "ios")) { g_string_append (acfg->llc_args, " -mattr=+v7"); - g_string_append (acfg->llc_args, " -exception-model=dwarf -disable-fp-elim"); + g_string_append (acfg->llc_args, " -exception-model=dwarf -frame-pointer=all"); } } @@ -11753,7 +11753,7 @@ emit_objc_selectors (MonoAotCompile *acfg) fprintf (acfg->fp, ".align 3\n"); fprintf (acfg->fp, "L_OBJC_IMAGE_INFO:\n"); fprintf (acfg->fp, ".long 0\n"); - fprintf (acfg->fp, ".long 16\n"); + fprintf (acfg->fp, ".long 0\n"); } static void diff --git a/src/mono/mono/mini/aot-runtime.c b/src/mono/mono/mini/aot-runtime.c index 3b753a44cb0d44..3254660f894d95 100644 --- a/src/mono/mono/mini/aot-runtime.c +++ b/src/mono/mono/mini/aot-runtime.c @@ -62,6 +62,7 @@ #include #include #include +#include #include "mini.h" #include "seq-points.h" @@ -1895,7 +1896,6 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer gpointer *globals = NULL; MonoAotFileInfo *info = NULL; int i, version; - gboolean do_load_image = TRUE; int align_double, align_int64; guint8 *aot_data = NULL; @@ -2289,7 +2289,7 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer * non-lazily, since we can't handle out-of-date errors later. * The cached class info also depends on the exact assemblies. */ - if (do_load_image) { + if (!mono_opt_aot_lazy_assembly_load) { for (i = 0; i < amodule->image_table_len; ++i) { ERROR_DECL (error); load_image (amodule, i, error); @@ -3534,7 +3534,17 @@ mono_aot_find_jit_info (MonoImage *image, gpointer addr) else code_len = amodule->llvm_code_end - code; } else { - code_len = (guint8*)methods [pos + 1] - (guint8*)methods [pos]; + guint8* code_end = (guint8*)methods [pos + 1]; + + if (code >= amodule->jit_code_start && code < amodule->jit_code_end && code_end > amodule->jit_code_end) { + code_end = amodule->jit_code_end; + } + + if (code >= amodule->llvm_code_start && code < amodule->llvm_code_end && code_end > amodule->llvm_code_end) { + code_end = amodule->llvm_code_end; + } + + code_len = code_end - code; } #endif diff --git a/src/mono/mono/mini/cpu-amd64.md b/src/mono/mono/mini/cpu-amd64.md index 48a1b9f0fbafae..8ee095962f51f1 100644 --- a/src/mono/mono/mini/cpu-amd64.md +++ b/src/mono/mono/mini/cpu-amd64.md @@ -284,7 +284,6 @@ float_cgt_membase: dest:i src1:f src2:b len:35 float_cgt_un_membase: dest:i src1:f src2:b len:48 float_clt_membase: dest:i src1:f src2:b len:35 float_clt_un_membase: dest:i src1:f src2:b len:42 -float_conv_to_u: dest:i src1:f len:46 # R4 opcodes r4_conv_to_i1: dest:i src1:f len:32 diff --git a/src/mono/mono/mini/cpu-arm.md b/src/mono/mono/mini/cpu-arm.md index b14cc6f3218128..625d7caf9b8638 100644 --- a/src/mono/mono/mini/cpu-arm.md +++ b/src/mono/mono/mini/cpu-arm.md @@ -60,7 +60,7 @@ seq_point: len:52 clob:c il_seq_point: len:0 throw: src1:i len:24 -rethrow: src1:i len:20 +rethrow: src1:i len:24 start_handler: len:20 endfinally: len:32 call_handler: len:16 clob:c @@ -220,7 +220,6 @@ float_clt_un: dest:i src1:f src2:f len:20 float_cneq: dest:y src1:f src2:f len:20 float_cge: dest:y src1:f src2:f len:20 float_cle: dest:y src1:f src2:f len:20 -float_conv_to_u: dest:i src1:f len:36 # R4 opcodes rmove: dest:f src1:f len:4 diff --git a/src/mono/mono/mini/cpu-arm64.md b/src/mono/mono/mini/cpu-arm64.md index aff89052937a78..06e4fe0d5e9798 100644 --- a/src/mono/mono/mini/cpu-arm64.md +++ b/src/mono/mono/mini/cpu-arm64.md @@ -218,7 +218,6 @@ float_clt_un: dest:i src1:f src2:f len:20 float_cneq: dest:i src1:f src2:f len:20 float_cge: dest:i src1:f src2:f len:20 float_cle: dest:i src1:f src2:f len:20 -float_conv_to_u: dest:i src1:f len:36 setfret: src1:f len:12 # R4 opcodes diff --git a/src/mono/mono/mini/cpu-mips.md b/src/mono/mono/mini/cpu-mips.md index 96920a0747b52c..3757749fcdf676 100644 --- a/src/mono/mono/mini/cpu-mips.md +++ b/src/mono/mono/mini/cpu-mips.md @@ -383,7 +383,6 @@ float_cgt: dest:i src1:f src2:f len:20 float_cgt_un: dest:i src1:f src2:f len:20 float_clt: dest:i src1:f src2:f len:20 float_clt_un: dest:i src1:f src2:f len:20 -float_conv_to_u: dest:i src1:f len:36 call_handler: len:20 clob:c endfilter: src1:i len:16 aotconst: dest:i len:8 diff --git a/src/mono/mono/mini/cpu-ppc.md b/src/mono/mono/mini/cpu-ppc.md index 6ef33f2887220a..69e9e1beb525ff 100644 --- a/src/mono/mono/mini/cpu-ppc.md +++ b/src/mono/mono/mini/cpu-ppc.md @@ -200,7 +200,6 @@ float_cgt: dest:i src1:f src2:f len:16 float_cgt_un: dest:i src1:f src2:f len:20 float_clt: dest:i src1:f src2:f len:16 float_clt_un: dest:i src1:f src2:f len:20 -float_conv_to_u: dest:i src1:f len:36 float_cneq: dest:i src1:f src2:f len:16 float_cge: dest:i src1:f src2:f len:16 float_cle: dest:i src1:f src2:f len:16 diff --git a/src/mono/mono/mini/cpu-ppc64.md b/src/mono/mono/mini/cpu-ppc64.md index fc0e634baa460f..6ce9314bffe8e5 100644 --- a/src/mono/mono/mini/cpu-ppc64.md +++ b/src/mono/mono/mini/cpu-ppc64.md @@ -204,7 +204,6 @@ float_cgt: dest:i src1:f src2:f len:16 float_cgt_un: dest:i src1:f src2:f len:20 float_clt: dest:i src1:f src2:f len:16 float_clt_un: dest:i src1:f src2:f len:20 -float_conv_to_u: dest:i src1:f len:36 float_cneq: dest:i src1:f src2:f len:16 float_cge: dest:i src1:f src2:f len:16 float_cle: dest:i src1:f src2:f len:16 diff --git a/src/mono/mono/mini/cpu-s390x.md b/src/mono/mono/mini/cpu-s390x.md index f3196485c13a36..d4469bda39c972 100644 --- a/src/mono/mono/mini/cpu-s390x.md +++ b/src/mono/mono/mini/cpu-s390x.md @@ -128,7 +128,6 @@ float_conv_to_u1: dest:i src1:f len:72 float_conv_to_u2: dest:i src1:f len:72 float_conv_to_u4: dest:i src1:f len:72 float_conv_to_u8: dest:i src1:f len:72 -float_conv_to_u: dest:i src1:f len:36 float_div: dest:f src1:f src2:f len:24 float_div_un: dest:f src1:f src2:f len:30 float_mul: dest:f src1:f src2:f len:8 diff --git a/src/mono/mono/mini/cpu-sparc.md b/src/mono/mono/mini/cpu-sparc.md index 403a73c380ee80..64487cf52a328e 100644 --- a/src/mono/mono/mini/cpu-sparc.md +++ b/src/mono/mono/mini/cpu-sparc.md @@ -180,7 +180,6 @@ float_cgt: dest:i src1:f src2:f len:64 float_cgt_un: dest:i src1:f src2:f len:64 float_clt: dest:i src1:f src2:f len:64 float_clt_un: dest:i src1:f src2:f len:64 -float_conv_to_u: dest:i src1:f len:64 call_handler: len:64 clob:c aotconst: dest:i len:64 adc: dest:i src1:i src2:i len:4 diff --git a/src/mono/mono/mini/cpu-x86.md b/src/mono/mono/mini/cpu-x86.md index 25e44d16eea5b7..6132887bbd3450 100644 --- a/src/mono/mono/mini/cpu-x86.md +++ b/src/mono/mono/mini/cpu-x86.md @@ -266,7 +266,6 @@ float_clt_un: dest:y src1:f src2:f len:32 float_cneq: dest:y src1:f src2:f len:25 float_cge: dest:y src1:f src2:f len:37 float_cle: dest:y src1:f src2:f len:37 -float_conv_to_u: dest:i src1:f len:36 call_handler: len:11 clob:c aotconst: dest:i len:5 load_gotaddr: dest:i len:64 diff --git a/src/mono/mono/mini/driver.c b/src/mono/mono/mini/driver.c index 3e7a07c17c674a..ce42a3ed0cf946 100644 --- a/src/mono/mono/mini/driver.c +++ b/src/mono/mono/mini/driver.c @@ -1787,11 +1787,23 @@ parse_qualified_method_name (char *method_name) void mono_jit_parse_options (int argc, char * argv[]) { + ERROR_DECL (error); int i; char *trace_options = NULL; int mini_verbose_level = 0; guint32 opt; + /* Make a copy since mono_options_parse_options () modifies argv */ + char **copy_argv = g_new0 (char*, argc); + memcpy (copy_argv, argv, sizeof (char*) * argc); + argv = copy_argv; + + mono_options_parse_options ((const char**)argv, argc, &argc, error); + if (!is_ok (error)) { + g_printerr ("%s", mono_error_get_message (error)); + mono_error_cleanup (error); + } + /* * Some options have no effect here, since they influence the behavior of * mono_main (). @@ -1880,6 +1892,9 @@ mono_jit_parse_options (int argc, char * argv[]) if (mini_verbose_level) mono_set_verbose_level (mini_verbose_level); + + /* Free the copy */ + g_free (argv); } static void diff --git a/src/mono/mono/mini/dwarfwriter.c b/src/mono/mono/mini/dwarfwriter.c index 1bac0d946391e7..d23074199bc65c 100644 --- a/src/mono/mono/mini/dwarfwriter.c +++ b/src/mono/mono/mini/dwarfwriter.c @@ -1899,7 +1899,7 @@ mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod g_free (names); /* Locals */ - locals_info = mono_debug_lookup_locals (method, FALSE); + locals_info = mono_debug_lookup_locals (method); for (i = 0; i < header->num_locals; ++i) { MonoInst *ins = locals [i]; diff --git a/src/mono/mono/mini/image-writer.c b/src/mono/mono/mini/image-writer.c index cc81ac7b070dcd..db6fd89acad0be 100644 --- a/src/mono/mono/mini/image-writer.c +++ b/src/mono/mono/mini/image-writer.c @@ -77,7 +77,7 @@ #elif defined(TARGET_ASM_GAS) && defined(TARGET_WIN32) #define AS_INT16_DIRECTIVE ".word" #elif defined(TARGET_ASM_GAS) -#define AS_INT16_DIRECTIVE ".hword" +#define AS_INT16_DIRECTIVE ".short" #else #define AS_INT16_DIRECTIVE ".word" #endif diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 6db2f621167d95..69fa5f84e78cb6 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -495,8 +495,12 @@ mono_interp_get_imethod (MonoMethod *method, MonoError *error) imethod->param_types [i] = mini_get_underlying_type (sig->params [i]); jit_mm_lock (jit_mm); - if (!mono_internal_hash_table_lookup (&jit_mm->interp_code_hash, method)) + InterpMethod *old_imethod; + if (!((old_imethod = mono_internal_hash_table_lookup (&jit_mm->interp_code_hash, method)))) mono_internal_hash_table_insert (&jit_mm->interp_code_hash, method, imethod); + else { + imethod = old_imethod; /* leak the newly allocated InterpMethod to the mempool */ + } jit_mm_unlock (jit_mm); imethod->prof_flags = mono_profiler_get_call_instrumentation_flags (imethod->method); @@ -3446,7 +3450,12 @@ interp_exec_method (InterpFrame *frame, ThreadContext *context, FrameClauseArgs } else if (del_imethod->method->flags & METHOD_ATTRIBUTE_VIRTUAL && !del->target && !m_class_is_valuetype (del_imethod->method->klass)) { // 'this' is passed dynamically, we need to recompute the target method // with each call - del_imethod = get_virtual_method (del_imethod, LOCAL_VAR (call_args_offset + MINT_STACK_SLOT_SIZE, MonoObject*)->vtable); + MonoObject *obj = LOCAL_VAR (call_args_offset + MINT_STACK_SLOT_SIZE, MonoObject*); + del_imethod = get_virtual_method (del_imethod, obj->vtable); + if (m_class_is_valuetype (obj->vtable->klass) && m_class_is_valuetype (del_imethod->method->klass)) { + // We are calling into a value type method, `this` needs to be unboxed + LOCAL_VAR (call_args_offset + MINT_STACK_SLOT_SIZE, gpointer) = mono_object_unbox_internal (obj); + } } else { del->interp_invoke_impl = del_imethod; } @@ -4873,7 +4882,7 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; MINT_IN_BREAK; MINT_IN_CASE(MINT_CONV_U4_R8) #ifdef MONO_ARCH_EMULATE_FCONV_TO_U4 - LOCAL_VAR (ip [1], gint32) = mono_fconv_u4_2 (LOCAL_VAR (ip [2], double)); + LOCAL_VAR (ip [1], gint32) = mono_fconv_u4 (LOCAL_VAR (ip [2], double)); #else LOCAL_VAR (ip [1], gint32) = (guint32) LOCAL_VAR (ip [2], double); #endif @@ -4929,7 +4938,7 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; MINT_IN_BREAK; MINT_IN_CASE(MINT_CONV_U8_R8) #ifdef MONO_ARCH_EMULATE_FCONV_TO_U8 - LOCAL_VAR (ip [1], gint64) = mono_fconv_u8_2 (LOCAL_VAR (ip [2], double)); + LOCAL_VAR (ip [1], gint64) = mono_fconv_u8 (LOCAL_VAR (ip [2], double)); #else LOCAL_VAR (ip [1], gint64) = (guint64) LOCAL_VAR (ip [2], double); #endif @@ -5414,6 +5423,16 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; MINT_IN_BREAK; } + MINT_IN_CASE(MINT_LDSFLD_W) { + MonoVTable *vtable = (MonoVTable*) frame->imethod->data_items [READ32 (ip + 2)]; + INIT_VTABLE (vtable); + gpointer addr = frame->imethod->data_items [READ32 (ip + 4)]; + MonoClass *klass = frame->imethod->data_items [READ32 (ip + 6)]; + stackval_from_data (m_class_get_byval_arg (klass), (stackval*)(locals + ip [1]), addr, FALSE); + ip += 8; + MINT_IN_BREAK; + } + #define STSFLD(datatype, fieldtype) { \ MonoVTable *vtable = (MonoVTable*) frame->imethod->data_items [ip [2]]; \ INIT_VTABLE (vtable); \ @@ -5440,6 +5459,16 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; MINT_IN_BREAK; } + MINT_IN_CASE(MINT_STSFLD_W) { + MonoVTable *vtable = (MonoVTable*) frame->imethod->data_items [READ32 (ip + 2)]; + INIT_VTABLE (vtable); + gpointer addr = frame->imethod->data_items [READ32 (ip + 4)]; + MonoClass *klass = frame->imethod->data_items [READ32 (ip + 6)]; + stackval_to_data (m_class_get_byval_arg (klass), (stackval*)(locals + ip [1]), addr, FALSE); + ip += 8; + MINT_IN_BREAK; + } + MINT_IN_CASE(MINT_STOBJ_VT) { MonoClass *c = (MonoClass*)frame->imethod->data_items [ip [3]]; mono_value_copy_internal (LOCAL_VAR (ip [1], gpointer), locals + ip [2], c); @@ -5472,33 +5501,29 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_U8_R4) { float val = LOCAL_VAR (ip [2], float); - if (mono_isnan (val) || mono_trunc (val) != (guint64)val) + if (!mono_try_trunc_u64 (val, (guint64*)(locals + ip [1]))) THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], guint64) = (guint64)val; ip += 3; MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_U8_R8) { double val = LOCAL_VAR (ip [2], double); - if (mono_isnan (val) || mono_trunc (val) != (guint64)val) + if (!mono_try_trunc_u64 (val, (guint64*)(locals + ip [1]))) THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], guint64) = (guint64)val; ip += 3; MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_I8_R4) { float val = LOCAL_VAR (ip [2], float); - if (mono_isnan (val) || mono_trunc (val) != (gint64)val) + if (!mono_try_trunc_i64 (val, (gint64*)(locals + ip [1]))) THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint64) = (gint64)val; ip += 3; MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_I8_R8) { double val = LOCAL_VAR (ip [2], double); - if (mono_isnan (val) || mono_trunc (val) != (gint64)val) + if (!mono_try_trunc_i64 (val, (gint64*)(locals + ip [1]))) THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint64) = (gint64)val; ip += 3; MINT_IN_BREAK; } @@ -5800,17 +5825,20 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_I4_R4) { float val = LOCAL_VAR (ip [2], float); - if (mono_isnan (val) || mono_trunc (val) != (gint32)val) + double val_r8 = (double)val; + if (val_r8 > ((double)G_MININT32 - 1) && val_r8 < ((double)G_MAXINT32 + 1)) + LOCAL_VAR (ip [1], gint32) = (gint32) val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (gint32) val; ip += 3; MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_I4_R8) { double val = LOCAL_VAR (ip [2], double); - if (val < G_MININT32 || val > G_MAXINT32 || isnan (val)) + if (val > ((double)G_MININT32 - 1) && val < ((double)G_MAXINT32 + 1)) + LOCAL_VAR (ip [1], gint32) = (gint32) val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (gint32)val; ip += 3; MINT_IN_BREAK; } @@ -5832,17 +5860,20 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_U4_R4) { float val = LOCAL_VAR (ip [2], float); - if (mono_isnan (val) || mono_trunc (val) != (guint32)val) + double val_r8 = val; + if (val_r8 > -1.0 && val_r8 < ((double)G_MAXUINT32 + 1)) + LOCAL_VAR (ip [1], gint32) = (guint32)val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (guint32)val; ip += 3; MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_U4_R8) { double val = LOCAL_VAR (ip [2], double); - if (val < 0 || val > G_MAXUINT32 || isnan (val)) + if (val > -1.0 && val < ((double)G_MAXUINT32 + 1)) + LOCAL_VAR (ip [1], gint32) = (guint32)val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (guint32) val; ip += 3; MINT_IN_BREAK; } @@ -5880,17 +5911,19 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_I2_R4) { float val = LOCAL_VAR (ip [2], float); - if (val < G_MININT16 || val > G_MAXINT16 || isnan (val)) + if (val > (G_MININT16 - 1) && val < (G_MAXINT16 + 1)) + LOCAL_VAR (ip [1], gint32) = (gint16) val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (gint16) val; ip += 3; MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_I2_R8) { double val = LOCAL_VAR (ip [2], double); - if (val < G_MININT16 || val > G_MAXINT16 || isnan (val)) + if (val > (G_MININT16 - 1) && val < (G_MAXINT16 + 1)) + LOCAL_VAR (ip [1], gint32) = (gint16) val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (gint16) val; ip += 3; MINT_IN_BREAK; } @@ -5912,17 +5945,19 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_U2_R4) { float val = LOCAL_VAR (ip [2], float); - if (val < 0 || val > G_MAXUINT16 || isnan (val)) + if (val > -1.0f && val < (G_MAXUINT16 + 1)) + LOCAL_VAR (ip [1], gint32) = (guint16) val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (guint16) val; ip += 3; MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_U2_R8) { double val = LOCAL_VAR (ip [2], double); - if (val < 0 || val > G_MAXUINT16 || isnan (val)) + if (val > -1.0 && val < (G_MAXUINT16 + 1)) + LOCAL_VAR (ip [1], gint32) = (guint16) val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (guint16) val; ip += 3; MINT_IN_BREAK; } @@ -5960,17 +5995,19 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_I1_R4) { float val = LOCAL_VAR (ip [2], float); - if (val < G_MININT8 || val > G_MAXINT8 || isnan (val)) + if (val > (G_MININT8 - 1) && val < (G_MAXINT8 + 1)) + LOCAL_VAR (ip [1], gint32) = (gint8) val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (gint8) val; ip += 3; MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_I1_R8) { double val = LOCAL_VAR (ip [2], double); - if (val < G_MININT8 || val > G_MAXINT8 || isnan (val)) + if (val > (G_MININT8 - 1) && val < (G_MAXINT8 + 1)) + LOCAL_VAR (ip [1], gint32) = (gint8) val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (gint8) val; ip += 3; MINT_IN_BREAK; } @@ -5992,17 +6029,19 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_U1_R4) { float val = LOCAL_VAR (ip [2], float); - if (val < 0 || val > G_MAXUINT8 || isnan (val)) + if (val > -1.0f && val < (G_MAXUINT8 + 1)) + LOCAL_VAR (ip [1], gint32) = (guint8)val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (guint8) val; ip += 3; MINT_IN_BREAK; } MINT_IN_CASE(MINT_CONV_OVF_U1_R8) { double val = LOCAL_VAR (ip [2], double); - if (val < 0 || val > G_MAXUINT8 || isnan (val)) + if (val > -1.0 && val < (G_MAXUINT8 + 1)) + LOCAL_VAR (ip [1], gint32) = (guint8)val; + else THROW_EX (mono_get_exception_overflow (), ip); - LOCAL_VAR (ip [1], gint32) = (guint8) val; ip += 3; MINT_IN_BREAK; } @@ -7421,28 +7460,44 @@ interp_invalidate_transformed (void) } typedef struct { - InterpJitInfoFunc func; - gpointer user_data; -} InterpJitInfoFuncUserData; + MonoJitInfo **jit_info_array; + gint size; + gint next; +} InterpCopyJitInfoFuncUserData; static void -interp_call_jit_info_func (gpointer imethod, gpointer user_data) +interp_copy_jit_info_func (gpointer imethod, gpointer user_data) { - InterpJitInfoFuncUserData *data = (InterpJitInfoFuncUserData *)user_data; - data->func (((InterpMethod *)imethod)->jinfo, data->user_data); + InterpCopyJitInfoFuncUserData *data = (InterpCopyJitInfoFuncUserData*)user_data; + if (data->next < data->size) + data->jit_info_array [data->next++] = ((InterpMethod *)imethod)->jinfo; } static void interp_jit_info_foreach (InterpJitInfoFunc func, gpointer user_data) { - InterpJitInfoFuncUserData data = {func, user_data}; + InterpCopyJitInfoFuncUserData copy_jit_info_data; // FIXME: Enumerate all memory managers MonoJitMemoryManager *jit_mm = get_default_jit_mm (); - jit_mm_lock (jit_mm); - mono_internal_hash_table_apply (&jit_mm->interp_code_hash, interp_call_jit_info_func, &data); - jit_mm_unlock (jit_mm); + // Can't keep memory manager lock while iterating and calling callback since it might take other locks + // causing poential deadlock situations. Instead, create copy of interpreter imethod jinfo pointers into + // plain array and use pointers from array when when running callbacks. + copy_jit_info_data.size = mono_atomic_load_i32 (&(jit_mm->interp_code_hash.num_entries)); + copy_jit_info_data.next = 0; + copy_jit_info_data.jit_info_array = (MonoJitInfo**) g_new (MonoJitInfo*, copy_jit_info_data.size); + if (copy_jit_info_data.jit_info_array) { + jit_mm_lock (jit_mm); + mono_internal_hash_table_apply (&jit_mm->interp_code_hash, interp_copy_jit_info_func, ©_jit_info_data); + jit_mm_unlock (jit_mm); + } + + if (copy_jit_info_data.jit_info_array) { + for (size_t i = 0; i < copy_jit_info_data.next; ++i) + func (copy_jit_info_data.jit_info_array [i], user_data); + g_free (copy_jit_info_data.jit_info_array); + } } static void diff --git a/src/mono/mono/mini/interp/mintops.def b/src/mono/mono/mini/interp/mintops.def index 04ff11b2124c18..9ef942e9d1b25a 100644 --- a/src/mono/mono/mini/interp/mintops.def +++ b/src/mono/mono/mini/interp/mintops.def @@ -85,6 +85,7 @@ OPDEF(MINT_LDSFLD_R4, "ldsfld.r4", 4, 1, 0, MintOpUShortInt) OPDEF(MINT_LDSFLD_R8, "ldsfld.r8", 4, 1, 0, MintOpUShortInt) OPDEF(MINT_LDSFLD_O, "ldsfld.o", 4, 1, 0, MintOpUShortInt) OPDEF(MINT_LDSFLD_VT, "ldsfld.vt", 5, 1, 0, MintOpTwoShorts) +OPDEF(MINT_LDSFLD_W, "ldsfld.w", 8, 1, 0, MintOpTwoInts) OPDEF(MINT_STSFLD_I1, "stsfld.i1", 4, 0, 1, MintOpUShortInt) OPDEF(MINT_STSFLD_U1, "stsfld.u1", 4, 0, 1, MintOpUShortInt) @@ -96,6 +97,7 @@ OPDEF(MINT_STSFLD_R4, "stsfld.r4", 4, 0, 1, MintOpUShortInt) OPDEF(MINT_STSFLD_R8, "stsfld.r8", 4, 0, 1, MintOpUShortInt) OPDEF(MINT_STSFLD_O, "stsfld.o", 4, 0, 1, MintOpUShortInt) OPDEF(MINT_STSFLD_VT, "stsfld.vt", 5, 0, 1, MintOpTwoShorts) +OPDEF(MINT_STSFLD_W, "stsfld.w", 8, 0, 1, MintOpTwoInts) OPDEF(MINT_LDSFLDA, "ldsflda", 4, 1, 0, MintOpTwoShorts) OPDEF(MINT_LDTSFLDA, "ldtsflda", 4, 1, 0, MintOpInt) diff --git a/src/mono/mono/mini/interp/mintops.h b/src/mono/mono/mini/interp/mintops.h index 82c78ac9243bfa..e1a381f0a5ddad 100644 --- a/src/mono/mono/mini/interp/mintops.h +++ b/src/mono/mono/mini/interp/mintops.h @@ -23,6 +23,7 @@ typedef enum MintOpFieldToken, MintOpClassToken, MintOpTwoShorts, + MintOpTwoInts, MintOpShortAndInt, MintOpShortAndShortBranch, MintOpPair2, @@ -58,10 +59,13 @@ typedef enum { #define MINT_SWITCH_LEN(n) (4 + (n) * 2) +#define MINT_IS_NOP(op) ((op) == MINT_NOP || (op) == MINT_DEF || (op) == MINT_DUMMY_USE || (op) == MINT_IL_SEQ_POINT) #define MINT_IS_MOV(op) ((op) >= MINT_MOV_I1 && (op) <= MINT_MOV_VT) +#define MINT_IS_UNCONDITIONAL_BRANCH(op) ((op) >= MINT_BR && (op) <= MINT_CALL_HANDLER_S) #define MINT_IS_CONDITIONAL_BRANCH(op) ((op) >= MINT_BRFALSE_I4 && (op) <= MINT_BLT_UN_R8_S) #define MINT_IS_UNOP_CONDITIONAL_BRANCH(op) ((op) >= MINT_BRFALSE_I4 && (op) <= MINT_BRTRUE_R8_S) #define MINT_IS_BINOP_CONDITIONAL_BRANCH(op) ((op) >= MINT_BEQ_I4 && (op) <= MINT_BLT_UN_R8_S) +#define MINT_IS_SUPER_BRANCH(op) ((op) >= MINT_BRFALSE_I4_SP && (op) <= MINT_BLT_UN_I8_IMM_SP) #define MINT_IS_CALL(op) ((op) >= MINT_CALL && (op) <= MINT_JIT_CALL) #define MINT_IS_PATCHABLE_CALL(op) ((op) >= MINT_CALL && (op) <= MINT_VCALL) #define MINT_IS_LDC_I4(op) ((op) >= MINT_LDC_I4_M1 && (op) <= MINT_LDC_I4) diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 952cfa5dd0cbba..0bf1a71388d38e 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -582,7 +582,7 @@ interp_merge_bblocks (TransformData *td, InterpBasicBlock *bb, InterpBasicBlock if (bb->last_ins) { InterpInst *last_ins = (bb->last_ins->opcode != MINT_NOP) ? bb->last_ins : interp_prev_ins (bb->last_ins); if (last_ins) { - if (last_ins->opcode == MINT_BR || last_ins->opcode == MINT_BR_S) { + if (last_ins->opcode == MINT_BR) { g_assert (last_ins->info.target_bb == bbadd); interp_clear_ins (last_ins); } else if (last_ins->opcode == MINT_SWITCH) { @@ -779,9 +779,8 @@ init_bb_stack_state (TransformData *td, InterpBasicBlock *bb) } static void -handle_branch (TransformData *td, int short_op, int long_op, int offset) +handle_branch (TransformData *td, int long_op, int offset) { - int shorten_branch = 0; int target = td->ip + offset - td->il_code; if (target < 0 || target >= td->code_size) g_assert_not_reached (); @@ -794,7 +793,7 @@ handle_branch (TransformData *td, int short_op, int long_op, int offset) InterpBasicBlock *target_bb = td->offset_to_bb [target]; g_assert (target_bb); - if (short_op == MINT_LEAVE_S || short_op == MINT_LEAVE_S_CHECK) + if (long_op == MINT_LEAVE || long_op == MINT_LEAVE_CHECK) target_bb->eh_block = TRUE; fixup_newbb_stack_locals (td, target_bb); @@ -803,16 +802,8 @@ handle_branch (TransformData *td, int short_op, int long_op, int offset) interp_link_bblocks (td, td->cbb, target_bb); - if (td->header->code_size <= 25000) /* FIX to be precise somehow? */ - shorten_branch = 1; - - if (shorten_branch) { - interp_add_ins (td, short_op); - td->last_ins->info.target_bb = target_bb; - } else { - interp_add_ins (td, long_op); - td->last_ins->info.target_bb = target_bb; - } + interp_add_ins (td, long_op); + td->last_ins->info.target_bb = target_bb; } static void @@ -820,11 +811,10 @@ one_arg_branch(TransformData *td, int mint_op, int offset, int inst_size) { int type = td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP ? STACK_TYPE_I : td->sp [-1].type; int long_op = mint_op + type - STACK_TYPE_I4; - int short_op = long_op + MINT_BRFALSE_I4_S - MINT_BRFALSE_I4; CHECK_STACK(td, 1); --td->sp; if (offset) { - handle_branch (td, short_op, long_op, offset + inst_size); + handle_branch (td, long_op, offset + inst_size); interp_ins_set_sreg (td->last_ins, td->sp->local); } else { interp_add_ins (td, MINT_NOP); @@ -870,10 +860,9 @@ two_arg_branch(TransformData *td, int mint_op, int offset, int inst_size) } int long_op = mint_op + type1 - STACK_TYPE_I4; - int short_op = long_op + MINT_BEQ_I4_S - MINT_BEQ_I4; td->sp -= 2; if (offset) { - handle_branch (td, short_op, long_op, offset + inst_size); + handle_branch (td, long_op, offset + inst_size); interp_ins_set_sregs2 (td->last_ins, td->sp [0].local, td->sp [1].local); } else { interp_add_ins (td, MINT_NOP); @@ -1093,11 +1082,11 @@ store_local (TransformData *td, int local) td->last_ins->data [0] = td->locals [local].size; } -static guint16 -get_data_item_index (TransformData *td, void *ptr) +static guint32 +get_data_item_wide_index (TransformData *td, void *ptr) { gpointer p = g_hash_table_lookup (td->data_hash, ptr); - guint index; + guint32 index; if (p != NULL) return GPOINTER_TO_UINT (p) - 1; if (td->max_data_items == td->n_data_items) { @@ -1111,6 +1100,20 @@ get_data_item_index (TransformData *td, void *ptr) return index; } +static guint16 +get_data_item_index (TransformData *td, void *ptr) +{ + guint32 index = get_data_item_wide_index (td, ptr); + g_assertf (index <= G_MAXUINT16, "Interpreter data item index 0x%x for method '%s' overflows", index, td->method->name); + return (guint16)index; +} + +static gboolean +is_data_item_wide_index (guint32 data_item_index) +{ + return data_item_index > G_MAXUINT16; +} + static guint16 get_data_item_index_nonshared (TransformData *td, void *ptr) { @@ -1347,6 +1350,9 @@ dump_interp_ins_data (InterpInst *ins, gint32 ins_offset, const guint16 *data, g case MintOpTwoShorts: g_string_append_printf (str, " %u,%u", *(guint16*)data, *(guint16 *)(data + 1)); break; + case MintOpTwoInts: + g_string_append_printf (str, " %u,%u", (guint32)READ32(data), (guint32)READ32(data + 2)); + break; case MintOpShortAndInt: g_string_append_printf (str, " %u,%u", *(guint16*)data, (guint32)READ32(data + 1)); break; @@ -1439,25 +1445,27 @@ dump_interp_compacted_ins (const guint16 *ip, const guint16 *start) { int opcode = *ip; int ins_offset = ip - start; + GString *str = g_string_new (""); - g_print ("IR_%04x: %-14s", ins_offset, mono_interp_opname (opcode)); + g_string_append_printf (str, "IR_%04x: %-14s", ins_offset, mono_interp_opname (opcode)); ip++; if (mono_interp_op_dregs [opcode] > 0) - g_print (" [%d <-", *ip++); + g_string_append_printf (str, " [%d <-", *ip++); else - g_print (" [nil <-"); + g_string_append_printf (str, " [nil <-"); if (mono_interp_op_sregs [opcode] > 0) { for (int i = 0; i < mono_interp_op_sregs [opcode]; i++) - g_print (" %d", *ip++); - g_print ("],"); + g_string_append_printf (str, " %d", *ip++); + g_string_append_printf (str, "],"); } else { - g_print (" nil],"); + g_string_append_printf (str, " nil],"); } - char *ins = dump_interp_ins_data (NULL, ins_offset, ip, opcode); - g_print ("%s\n", ins); - g_free (ins); + char *ins_data = dump_interp_ins_data (NULL, ins_offset, ip, opcode); + g_print ("%s%s\n", str->str, ins_data); + g_string_free (str, TRUE); + g_free (ins_data); } static void @@ -1471,51 +1479,47 @@ dump_interp_code (const guint16 *start, const guint16* end) } static void -dump_interp_inst_no_newline (InterpInst *ins) +dump_interp_inst (InterpInst *ins) { int opcode = ins->opcode; - g_print ("IL_%04x: %-14s", ins->il_offset, mono_interp_opname (opcode)); + GString *str = g_string_new (""); + g_string_append_printf (str, "IL_%04x: %-14s", ins->il_offset, mono_interp_opname (opcode)); if (mono_interp_op_dregs [opcode] > 0) - g_print (" [%d <-", ins->dreg); + g_string_append_printf (str, " [%d <-", ins->dreg); else - g_print (" [nil <-"); + g_string_append_printf (str, " [nil <-"); if (mono_interp_op_sregs [opcode] > 0) { for (int i = 0; i < mono_interp_op_sregs [opcode]; i++) { if (ins->sregs [i] == MINT_CALL_ARGS_SREG) { - g_print (" c:"); + g_string_append_printf (str, " c:"); int *call_args = ins->info.call_args; if (call_args) { while (*call_args != -1) { - g_print (" %d", *call_args); + g_string_append_printf (str, " %d", *call_args); call_args++; } } } else { - g_print (" %d", ins->sregs [i]); + g_string_append_printf (str, " %d", ins->sregs [i]); } } - g_print ("],"); + g_string_append_printf (str, "],"); } else { - g_print (" nil],"); + g_string_append_printf (str, " nil],"); } if (opcode == MINT_LDLOCA_S) { // LDLOCA has special semantics, it has data in sregs [0], but it doesn't have any sregs - g_print (" %d", ins->sregs [0]); + g_string_append_printf (str, " %d", ins->sregs [0]); } else { char *descr = dump_interp_ins_data (ins, ins->il_offset, &ins->data [0], ins->opcode); - g_print ("%s", descr); + g_string_append_printf (str, "%s", descr); g_free (descr); } -} - -static void -dump_interp_inst (InterpInst *ins) -{ - dump_interp_inst_no_newline (ins); - g_print ("\n"); + g_print ("%s\n", str->str); + g_string_free (str, TRUE); } static G_GNUC_UNUSED void @@ -1574,21 +1578,6 @@ interp_method_get_header (MonoMethod* method, MonoError *error) return mono_method_get_header_internal (method, error); } -/* stores top of stack as local and pushes address of it on stack */ -static void -emit_store_value_as_local (TransformData *td, MonoType *src) -{ - int local = create_interp_local (td, mini_native_type_replace_type (src)); - - store_local (td, local); - - interp_add_ins (td, MINT_LDLOCA_S); - push_simple_type (td, STACK_TYPE_MP); - interp_ins_set_dreg (td->last_ins, td->sp [-1].local); - interp_ins_set_sreg (td->last_ins, local); - td->locals [local].indirects++; -} - static gboolean interp_ip_in_cbb (TransformData *td, int il_offset) { @@ -1899,15 +1888,15 @@ interp_handle_magic_type_intrinsics (TransformData *td, MonoMethod *target_metho int src_size = mini_magic_type_size (NULL, src); int dst_size = mini_magic_type_size (NULL, dst); - gboolean store_value_as_local = FALSE; + gboolean managed_fallback = FALSE; switch (type_index) { case 0: case 1: if (!mini_magic_is_int_type (src) || !mini_magic_is_int_type (dst)) { if (mini_magic_is_int_type (src)) - store_value_as_local = TRUE; + managed_fallback = TRUE; else if (mono_class_is_magic_float (src_klass)) - store_value_as_local = TRUE; + managed_fallback = TRUE; else return FALSE; } @@ -1915,21 +1904,17 @@ interp_handle_magic_type_intrinsics (TransformData *td, MonoMethod *target_metho case 2: if (!mini_magic_is_float_type (src) || !mini_magic_is_float_type (dst)) { if (mini_magic_is_float_type (src)) - store_value_as_local = TRUE; + managed_fallback = TRUE; else if (mono_class_is_magic_int (src_klass)) - store_value_as_local = TRUE; + managed_fallback = TRUE; else return FALSE; } break; } - if (store_value_as_local) { - emit_store_value_as_local (td, src); - - /* emit call to managed conversion method */ + if (managed_fallback) return FALSE; - } if (src_size > dst_size) { // 8 -> 4 switch (type_index) { @@ -1986,15 +1971,6 @@ interp_handle_magic_type_intrinsics (TransformData *td, MonoMethod *target_metho td->ip += 5; return TRUE; } else if (!strcmp ("CompareTo", tm) || !strcmp ("Equals", tm)) { - MonoType *arg = csignature->params [0]; - int mt = mint_type (arg); - - /* on 'System.n*::{CompareTo,Equals} (System.n*)' variant we need to push managed - * pointer instead of value */ - if (mt != MINT_TYPE_O) - emit_store_value_as_local (td, arg); - - /* emit call to managed conversion method */ return FALSE; } else if (!strcmp (".cctor", tm)) { return FALSE; @@ -2436,7 +2412,7 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas if (!strcmp (tm, "InternalGetHashCode")) { *op = MINT_INTRINS_GET_HASHCODE; } else if (!strcmp (tm, "GetType")) { - if (constrained_class && m_class_is_valuetype (constrained_class)) { + if (constrained_class && m_class_is_valuetype (constrained_class) && !mono_class_is_nullable (constrained_class)) { // If constrained_class is valuetype we already know its type. // Resolve GetType to a constant so we can fold type comparisons ERROR_DECL(error); @@ -2453,8 +2429,16 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas return TRUE; } else { if (constrained_class) { - // deref the managed pointer to get the object - interp_add_ins (td, MINT_LDIND_I); + if (mono_class_is_nullable (constrained_class)) { + // We can't determine the behavior here statically because we don't know if the + // nullable vt has a value or not. If it has a value, the result type is + // m_class_get_cast_class (constrained_class), otherwise GetType should throw NRE. + interp_add_ins (td, MINT_BOX_NULLABLE_PTR); + td->last_ins->data [0] = get_data_item_index (td, constrained_class); + } else { + // deref the managed pointer to get the object + interp_add_ins (td, MINT_LDIND_I); + } td->sp--; interp_ins_set_sreg (td->last_ins, td->sp [0].local); push_simple_type (td, STACK_TYPE_O); @@ -2823,8 +2807,7 @@ interp_method_check_inlining (TransformData *td, MonoMethod *method, MonoMethodS if (method->wrapper_type != MONO_WRAPPER_NONE) return FALSE; - /* Our usage of `emit_store_value_as_local ()` for nint, nuint and nfloat - * is kinda hacky, and doesn't work with the inliner */ + // FIXME Re-enable this if (mono_class_get_magic_index (method->klass) >= 0) return FALSE; @@ -3305,7 +3288,7 @@ interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target for (i = csignature->param_count - 1 + !!csignature->hasthis; i >= 0; --i) store_arg (td, i); - interp_add_ins (td, MINT_BR_S); + interp_add_ins (td, MINT_BR); // We are branching to the beginning of the method td->last_ins->info.target_bb = td->entry_bb; int in_offset = td->ip - td->il_code; @@ -4199,7 +4182,20 @@ interp_emit_sfld_access (TransformData *td, MonoClassField *field, MonoClass *fi if (interp_emit_load_const (td, field_addr, mt)) return; } - if (mt == MINT_TYPE_VT) { + } + guint32 vtable_index = get_data_item_wide_index (td, vtable); + guint32 addr_index = get_data_item_wide_index (td, (char*)field_addr); + gboolean wide_data = is_data_item_wide_index (vtable_index) || is_data_item_wide_index (addr_index); + guint32 klass_index = !wide_data ? 0 : get_data_item_wide_index (td, field_class); + if (is_load) { + if (G_UNLIKELY (wide_data)) { + interp_add_ins (td, MINT_LDSFLD_W); + if (mt == MINT_TYPE_VT) { + push_type_vt (td, field_class, size); + } else { + push_type (td, stack_type [mt], field_class); + } + } else if (mt == MINT_TYPE_VT) { interp_add_ins (td, MINT_LDSFLD_VT); push_type_vt (td, field_class, size); } else { @@ -4208,15 +4204,24 @@ interp_emit_sfld_access (TransformData *td, MonoClassField *field, MonoClass *fi } interp_ins_set_dreg (td->last_ins, td->sp [-1].local); } else { - interp_add_ins (td, (mt == MINT_TYPE_VT) ? MINT_STSFLD_VT : (MINT_STSFLD_I1 + mt - MINT_TYPE_I1)); + if (G_LIKELY (!wide_data)) + interp_add_ins (td, (mt == MINT_TYPE_VT) ? MINT_STSFLD_VT : (MINT_STSFLD_I1 + mt - MINT_TYPE_I1)); + else + interp_add_ins (td, MINT_STSFLD_W); td->sp--; interp_ins_set_sreg (td->last_ins, td->sp [0].local); } - td->last_ins->data [0] = get_data_item_index (td, vtable); - td->last_ins->data [1] = get_data_item_index (td, (char*)field_addr); - if (mt == MINT_TYPE_VT) - td->last_ins->data [2] = size; + if (G_LIKELY (!wide_data)) { + td->last_ins->data [0] = (guint16) vtable_index; + td->last_ins->data [1] = (guint16) addr_index; + if (mt == MINT_TYPE_VT) + td->last_ins->data [2] = size; + } else { + WRITE32_INS (td->last_ins, 0, &vtable_index); + WRITE32_INS (td->last_ins, 2, &addr_index); + WRITE32_INS (td->last_ins, 4, &klass_index); + } } } @@ -4389,6 +4394,9 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header, end = td->ip + header->code_size; td->cbb = td->entry_bb = (InterpBasicBlock*)mono_mempool_alloc0 (td->mempool, sizeof (InterpBasicBlock)); + if (td->gen_sdb_seq_points) + td->basic_blocks = g_list_prepend_mempool (td->mempool, td->basic_blocks, td->cbb); + td->cbb->index = td->bb_count++; td->cbb->native_offset = -1; td->cbb->stack_height = td->sp - td->stack; @@ -4919,7 +4927,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header, if (inlining) { td->ip++; fixup_newbb_stack_locals (td, exit_bb); - interp_add_ins (td, MINT_BR_S); + interp_add_ins (td, MINT_BR); td->last_ins->info.target_bb = exit_bb; init_bb_stack_state (td, exit_bb); interp_link_bblocks (td, td->cbb, exit_bb); @@ -4983,7 +4991,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header, case CEE_BR: { int offset = read32 (td->ip + 1); if (offset) { - handle_branch (td, MINT_BR_S, MINT_BR, 5 + offset); + handle_branch (td, MINT_BR, 5 + offset); link_bblocks = FALSE; } td->ip += 5; @@ -4992,7 +5000,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header, case CEE_BR_S: { int offset = (gint8)td->ip [1]; if (offset) { - handle_branch (td, MINT_BR_S, MINT_BR, 2 + (gint8)td->ip [1]); + handle_branch (td, MINT_BR, 2 + (gint8)td->ip [1]); link_bblocks = FALSE; } td->ip += 2; @@ -5989,6 +5997,8 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header, td->sp--; interp_emit_sfld_access (td, field, field_klass, mt, TRUE, error); goto_if_nok (error, exit); + } else if (td->sp [-1].type != STACK_TYPE_O && td->sp [-1].type != STACK_TYPE_MP && (mono_class_is_magic_int (klass) || mono_class_is_magic_float (klass))) { + // No need to load anything, the value is already on the execution stack } else if (td->sp [-1].type == STACK_TYPE_VT) { int size = 0; /* First we pop the vt object from the stack. Then we push the field */ @@ -6862,20 +6872,16 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header, continue; if (MONO_OFFSET_IN_CLAUSE (clause, (td->ip - header->code)) && (!MONO_OFFSET_IN_CLAUSE (clause, (target_offset + in_offset)))) { - handle_branch (td, MINT_CALL_HANDLER_S, MINT_CALL_HANDLER, clause->handler_offset - in_offset); - // FIXME We need new IR to get rid of _S ugliness - if (td->last_ins->opcode == MINT_CALL_HANDLER_S) - td->last_ins->data [1] = i; - else - td->last_ins->data [2] = i; + handle_branch (td, MINT_CALL_HANDLER, clause->handler_offset - in_offset); + td->last_ins->data [2] = i; } } if (td->clause_indexes [in_offset] != -1) { /* LEAVE instructions in catch clauses need to check for abort exceptions */ - handle_branch (td, MINT_LEAVE_S_CHECK, MINT_LEAVE_CHECK, target_offset); + handle_branch (td, MINT_LEAVE_CHECK, target_offset); } else { - handle_branch (td, MINT_LEAVE_S, MINT_LEAVE, target_offset); + handle_branch (td, MINT_LEAVE, target_offset); } if (*td->ip == CEE_LEAVE) @@ -7597,6 +7603,60 @@ get_inst_length (InterpInst *ins) return mono_interp_oplen [ins->opcode]; } +static int +compute_native_offset_estimates (TransformData *td) +{ + InterpBasicBlock *bb; + int noe = 0; + for (bb = td->entry_bb; bb != NULL; bb = bb->next_bb) { + InterpInst *ins; + bb->native_offset_estimate = noe; + for (ins = bb->first_ins; ins != NULL; ins = ins->next) { + int opcode = ins->opcode; + // Skip dummy opcodes for more precise offset computation + if (MINT_IS_NOP (opcode)) + continue; + noe += get_inst_length (ins); + } + } + return noe; +} + +static gboolean +is_short_offset (int src_offset, int dest_offset) +{ + int diff = dest_offset - src_offset; + if (diff >= G_MININT16 && diff <= G_MAXINT16) + return TRUE; + return FALSE; +} + +static int +get_short_brop (int opcode) +{ + if (MINT_IS_UNCONDITIONAL_BRANCH (opcode)) { + if (opcode == MINT_BR) + return MINT_BR_S; + else if (opcode == MINT_LEAVE) + return MINT_LEAVE_S; + else if (opcode == MINT_LEAVE_CHECK) + return MINT_LEAVE_S_CHECK; + else if (opcode == MINT_CALL_HANDLER) + return MINT_CALL_HANDLER_S; + else + return opcode; + } + + if (opcode >= MINT_BRFALSE_I4 && opcode <= MINT_BRTRUE_R8) + return opcode + MINT_BRFALSE_I4_S - MINT_BRFALSE_I4; + + if (opcode >= MINT_BEQ_I4 && opcode <= MINT_BLT_UN_R8) + return opcode + MINT_BEQ_I4_S - MINT_BEQ_I4; + + // Already short branch + return opcode; +} + static guint16* emit_compacted_instruction (TransformData *td, guint16* start_ip, InterpInst *ins) @@ -7636,56 +7696,47 @@ emit_compacted_instruction (TransformData *td, guint16* start_ip, InterpInst *in *ip++ = 0xdead; *ip++ = 0xbeef; } - } else if ((opcode >= MINT_BRFALSE_I4_S && opcode <= MINT_BRTRUE_R8_S) || - (opcode >= MINT_BEQ_I4_S && opcode <= MINT_BLT_UN_R8_S) || - (opcode >= MINT_BRFALSE_I4_SP && opcode <= MINT_BLT_UN_I8_IMM_SP) || - opcode == MINT_BR_S || opcode == MINT_LEAVE_S || opcode == MINT_LEAVE_S_CHECK || opcode == MINT_CALL_HANDLER_S) { + } else if (MINT_IS_UNCONDITIONAL_BRANCH (opcode) || MINT_IS_CONDITIONAL_BRANCH (opcode) || MINT_IS_SUPER_BRANCH (opcode)) { const int br_offset = start_ip - td->new_code; gboolean has_imm = opcode >= MINT_BEQ_I4_IMM_SP && opcode <= MINT_BLT_UN_I8_IMM_SP; for (int i = 0; i < mono_interp_op_sregs [opcode]; i++) *ip++ = td->locals [ins->sregs [i]].offset; if (has_imm) *ip++ = ins->data [0]; + if (ins->info.target_bb->native_offset >= 0) { + int offset = ins->info.target_bb->native_offset - br_offset; // Backwards branch. We can already patch it. - *ip++ = ins->info.target_bb->native_offset - br_offset; - } else if (opcode == MINT_BR_S && ins->info.target_bb == td->cbb->next_bb) { - // Ignore branch to the next basic block. Revert the added MINT_BR_S. + if (is_short_offset (br_offset, ins->info.target_bb->native_offset)) { + // Replace the long opcode we added at the start + *start_ip = get_short_brop (opcode); + *ip++ = ins->info.target_bb->native_offset - br_offset; + } else { + WRITE32 (ip, &offset); + } + } else if (opcode == MINT_BR && ins->info.target_bb == td->cbb->next_bb) { + // Ignore branch to the next basic block. Revert the added MINT_BR. ip--; } else { + // If the estimate offset is short, then surely the real offset is short + gboolean is_short = is_short_offset (br_offset, ins->info.target_bb->native_offset_estimate); + if (is_short) + *start_ip = get_short_brop (opcode); + // We don't know the in_offset of the target, add a reloc Reloc *reloc = (Reloc*)mono_mempool_alloc0 (td->mempool, sizeof (Reloc)); - reloc->type = RELOC_SHORT_BRANCH; + reloc->type = is_short ? RELOC_SHORT_BRANCH : RELOC_LONG_BRANCH; reloc->skip = mono_interp_op_sregs [opcode] + has_imm; reloc->offset = br_offset; reloc->target_bb = ins->info.target_bb; g_ptr_array_add (td->relocs, reloc); *ip++ = 0xdead; - } - if (opcode == MINT_CALL_HANDLER_S) - *ip++ = ins->data [1]; - } else if ((opcode >= MINT_BRFALSE_I4 && opcode <= MINT_BRTRUE_R8) || - (opcode >= MINT_BEQ_I4 && opcode <= MINT_BLT_UN_R8) || - opcode == MINT_BR || opcode == MINT_LEAVE || opcode == MINT_LEAVE_CHECK || opcode == MINT_CALL_HANDLER) { - const int br_offset = start_ip - td->new_code; - for (int i = 0; i < mono_interp_op_sregs [opcode]; i++) - *ip++ = td->locals [ins->sregs [i]].offset; - if (ins->info.target_bb->native_offset >= 0) { - // Backwards branch. We can already patch it - int target_offset = ins->info.target_bb->native_offset - br_offset; - WRITE32 (ip, &target_offset); - } else { - Reloc *reloc = (Reloc*)mono_mempool_alloc0 (td->mempool, sizeof (Reloc)); - reloc->type = RELOC_LONG_BRANCH; - reloc->skip = mono_interp_op_sregs [opcode]; - reloc->offset = br_offset; - reloc->target_bb = ins->info.target_bb; - g_ptr_array_add (td->relocs, reloc); - *ip++ = 0xdead; - *ip++ = 0xbeef; + if (!is_short) + *ip++ = 0xbeef; } if (opcode == MINT_CALL_HANDLER) *ip++ = ins->data [2]; + } else if (opcode == MINT_SDB_SEQ_POINT || opcode == MINT_IL_SEQ_POINT) { SeqPoint *seqp = (SeqPoint*)mono_mempool_alloc0 (td->mempool, sizeof (SeqPoint)); InterpBasicBlock *cbb; @@ -7755,7 +7806,7 @@ emit_compacted_instruction (TransformData *td, guint16* start_ip, InterpInst *in #endif } else if (opcode >= MINT_MOV_8_2 && opcode <= MINT_MOV_8_4) { // This instruction is not marked as operating on any vars, all instruction slots are - // actually vas. Resolve their offset + // actually vars. Resolve their offset int num_vars = mono_interp_oplen [opcode] - 1; for (int i = 0; i < num_vars; i++) *ip++ = td->locals [ins->data [i]].offset; @@ -7789,18 +7840,13 @@ static void generate_compacted_code (TransformData *td) { guint16 *ip; - int size = 0; + int size; td->relocs = g_ptr_array_new (); InterpBasicBlock *bb; - // Iterate once for preliminary computations - for (bb = td->entry_bb; bb != NULL; bb = bb->next_bb) { - InterpInst *ins = bb->first_ins; - while (ins) { - size += get_inst_length (ins); - ins = ins->next; - } - } + // This iteration could be avoided at the cost of less precise size result, following + // super instruction pass + size = compute_native_offset_estimates (td); // Generate the compacted stream of instructions td->new_code = ip = (guint16*)mono_mem_manager_alloc0 (td->mem_manager, size * sizeof (guint16)); @@ -8027,7 +8073,7 @@ interp_fold_unop (TransformData *td, LocalValue *local_defs, InterpInst *ins) #define INTERP_FOLD_UNOP_BR(_opcode,_local_type,_cond) \ case _opcode: \ if (_cond) { \ - ins->opcode = MINT_BR_S; \ + ins->opcode = MINT_BR; \ if (cbb->next_bb != ins->info.target_bb) \ interp_unlink_bblocks (cbb, cbb->next_bb); \ for (InterpInst *it = ins->next; it != NULL; it = it->next) \ @@ -8051,10 +8097,10 @@ interp_fold_unop_cond_br (TransformData *td, InterpBasicBlock *cbb, LocalValue * // Top of the stack is a constant switch (ins->opcode) { - INTERP_FOLD_UNOP_BR (MINT_BRFALSE_I4_S, LOCAL_VALUE_I4, val->i == 0); - INTERP_FOLD_UNOP_BR (MINT_BRFALSE_I8_S, LOCAL_VALUE_I8, val->l == 0); - INTERP_FOLD_UNOP_BR (MINT_BRTRUE_I4_S, LOCAL_VALUE_I4, val->i != 0); - INTERP_FOLD_UNOP_BR (MINT_BRTRUE_I8_S, LOCAL_VALUE_I8, val->l != 0); + INTERP_FOLD_UNOP_BR (MINT_BRFALSE_I4, LOCAL_VALUE_I4, val->i == 0); + INTERP_FOLD_UNOP_BR (MINT_BRFALSE_I8, LOCAL_VALUE_I8, val->l == 0); + INTERP_FOLD_UNOP_BR (MINT_BRTRUE_I4, LOCAL_VALUE_I4, val->i != 0); + INTERP_FOLD_UNOP_BR (MINT_BRTRUE_I8, LOCAL_VALUE_I8, val->l != 0); default: return ins; @@ -8203,11 +8249,11 @@ interp_fold_binop (TransformData *td, LocalValue *local_defs, InterpInst *ins, g // Due to poor current design, the branch op might not be the last instruction in the bblock // (in case we fallthrough and need to have the stack locals match the ones from next_bb, done // in fixup_newbb_stack_locals). If that's the case, clear all these mov's. This helps bblock -// merging quickly find the MINT_BR_S opcode. +// merging quickly find the MINT_BR opcode. #define INTERP_FOLD_BINOP_BR(_opcode,_local_type,_cond) \ case _opcode: \ if (_cond) { \ - ins->opcode = MINT_BR_S; \ + ins->opcode = MINT_BR; \ if (cbb->next_bb != ins->info.target_bb) \ interp_unlink_bblocks (cbb, cbb->next_bb); \ for (InterpInst *it = ins->next; it != NULL; it = it->next) \ @@ -8234,27 +8280,27 @@ interp_fold_binop_cond_br (TransformData *td, InterpBasicBlock *cbb, LocalValue return ins; switch (ins->opcode) { - INTERP_FOLD_BINOP_BR (MINT_BEQ_I4_S, LOCAL_VALUE_I4, val1->i == val2->i); - INTERP_FOLD_BINOP_BR (MINT_BEQ_I8_S, LOCAL_VALUE_I8, val1->l == val2->l); - INTERP_FOLD_BINOP_BR (MINT_BGE_I4_S, LOCAL_VALUE_I4, val1->i >= val2->i); - INTERP_FOLD_BINOP_BR (MINT_BGE_I8_S, LOCAL_VALUE_I8, val1->l >= val2->l); - INTERP_FOLD_BINOP_BR (MINT_BGT_I4_S, LOCAL_VALUE_I4, val1->i > val2->i); - INTERP_FOLD_BINOP_BR (MINT_BGT_I8_S, LOCAL_VALUE_I8, val1->l > val2->l); - INTERP_FOLD_BINOP_BR (MINT_BLT_I4_S, LOCAL_VALUE_I4, val1->i < val2->i); - INTERP_FOLD_BINOP_BR (MINT_BLT_I8_S, LOCAL_VALUE_I8, val1->l < val2->l); - INTERP_FOLD_BINOP_BR (MINT_BLE_I4_S, LOCAL_VALUE_I4, val1->i <= val2->i); - INTERP_FOLD_BINOP_BR (MINT_BLE_I8_S, LOCAL_VALUE_I8, val1->l <= val2->l); - - INTERP_FOLD_BINOP_BR (MINT_BNE_UN_I4_S, LOCAL_VALUE_I4, val1->i != val2->i); - INTERP_FOLD_BINOP_BR (MINT_BNE_UN_I8_S, LOCAL_VALUE_I8, val1->l != val2->l); - INTERP_FOLD_BINOP_BR (MINT_BGE_UN_I4_S, LOCAL_VALUE_I4, (guint32)val1->i >= (guint32)val2->i); - INTERP_FOLD_BINOP_BR (MINT_BGE_UN_I8_S, LOCAL_VALUE_I8, (guint64)val1->l >= (guint64)val2->l); - INTERP_FOLD_BINOP_BR (MINT_BGT_UN_I4_S, LOCAL_VALUE_I4, (guint32)val1->i > (guint32)val2->i); - INTERP_FOLD_BINOP_BR (MINT_BGT_UN_I8_S, LOCAL_VALUE_I8, (guint64)val1->l > (guint64)val2->l); - INTERP_FOLD_BINOP_BR (MINT_BLE_UN_I4_S, LOCAL_VALUE_I4, (guint32)val1->i <= (guint32)val2->i); - INTERP_FOLD_BINOP_BR (MINT_BLE_UN_I8_S, LOCAL_VALUE_I8, (guint64)val1->l <= (guint64)val2->l); - INTERP_FOLD_BINOP_BR (MINT_BLT_UN_I4_S, LOCAL_VALUE_I4, (guint32)val1->i < (guint32)val2->i); - INTERP_FOLD_BINOP_BR (MINT_BLT_UN_I8_S, LOCAL_VALUE_I8, (guint64)val1->l < (guint64)val2->l); + INTERP_FOLD_BINOP_BR (MINT_BEQ_I4, LOCAL_VALUE_I4, val1->i == val2->i); + INTERP_FOLD_BINOP_BR (MINT_BEQ_I8, LOCAL_VALUE_I8, val1->l == val2->l); + INTERP_FOLD_BINOP_BR (MINT_BGE_I4, LOCAL_VALUE_I4, val1->i >= val2->i); + INTERP_FOLD_BINOP_BR (MINT_BGE_I8, LOCAL_VALUE_I8, val1->l >= val2->l); + INTERP_FOLD_BINOP_BR (MINT_BGT_I4, LOCAL_VALUE_I4, val1->i > val2->i); + INTERP_FOLD_BINOP_BR (MINT_BGT_I8, LOCAL_VALUE_I8, val1->l > val2->l); + INTERP_FOLD_BINOP_BR (MINT_BLT_I4, LOCAL_VALUE_I4, val1->i < val2->i); + INTERP_FOLD_BINOP_BR (MINT_BLT_I8, LOCAL_VALUE_I8, val1->l < val2->l); + INTERP_FOLD_BINOP_BR (MINT_BLE_I4, LOCAL_VALUE_I4, val1->i <= val2->i); + INTERP_FOLD_BINOP_BR (MINT_BLE_I8, LOCAL_VALUE_I8, val1->l <= val2->l); + + INTERP_FOLD_BINOP_BR (MINT_BNE_UN_I4, LOCAL_VALUE_I4, val1->i != val2->i); + INTERP_FOLD_BINOP_BR (MINT_BNE_UN_I8, LOCAL_VALUE_I8, val1->l != val2->l); + INTERP_FOLD_BINOP_BR (MINT_BGE_UN_I4, LOCAL_VALUE_I4, (guint32)val1->i >= (guint32)val2->i); + INTERP_FOLD_BINOP_BR (MINT_BGE_UN_I8, LOCAL_VALUE_I8, (guint64)val1->l >= (guint64)val2->l); + INTERP_FOLD_BINOP_BR (MINT_BGT_UN_I4, LOCAL_VALUE_I4, (guint32)val1->i > (guint32)val2->i); + INTERP_FOLD_BINOP_BR (MINT_BGT_UN_I8, LOCAL_VALUE_I8, (guint64)val1->l > (guint64)val2->l); + INTERP_FOLD_BINOP_BR (MINT_BLE_UN_I4, LOCAL_VALUE_I4, (guint32)val1->i <= (guint32)val2->i); + INTERP_FOLD_BINOP_BR (MINT_BLE_UN_I8, LOCAL_VALUE_I8, (guint64)val1->l <= (guint64)val2->l); + INTERP_FOLD_BINOP_BR (MINT_BLT_UN_I4, LOCAL_VALUE_I4, (guint32)val1->i < (guint32)val2->i); + INTERP_FOLD_BINOP_BR (MINT_BLT_UN_I8, LOCAL_VALUE_I8, (guint64)val1->l < (guint64)val2->l); default: return ins; @@ -8664,26 +8710,26 @@ static int get_binop_condbr_imm_sp (int opcode) { switch (opcode) { - case MINT_BEQ_I4_S: return MINT_BEQ_I4_IMM_SP; - case MINT_BEQ_I8_S: return MINT_BEQ_I8_IMM_SP; - case MINT_BGE_I4_S: return MINT_BGE_I4_IMM_SP; - case MINT_BGE_I8_S: return MINT_BGE_I8_IMM_SP; - case MINT_BGT_I4_S: return MINT_BGT_I4_IMM_SP; - case MINT_BGT_I8_S: return MINT_BGT_I8_IMM_SP; - case MINT_BLT_I4_S: return MINT_BLT_I4_IMM_SP; - case MINT_BLT_I8_S: return MINT_BLT_I8_IMM_SP; - case MINT_BLE_I4_S: return MINT_BLE_I4_IMM_SP; - case MINT_BLE_I8_S: return MINT_BLE_I8_IMM_SP; - case MINT_BNE_UN_I4_S: return MINT_BNE_UN_I4_IMM_SP; - case MINT_BNE_UN_I8_S: return MINT_BNE_UN_I8_IMM_SP; - case MINT_BGE_UN_I4_S: return MINT_BGE_UN_I4_IMM_SP; - case MINT_BGE_UN_I8_S: return MINT_BGE_UN_I8_IMM_SP; - case MINT_BGT_UN_I4_S: return MINT_BGT_UN_I4_IMM_SP; - case MINT_BGT_UN_I8_S: return MINT_BGT_UN_I8_IMM_SP; - case MINT_BLE_UN_I4_S: return MINT_BLE_UN_I4_IMM_SP; - case MINT_BLE_UN_I8_S: return MINT_BLE_UN_I8_IMM_SP; - case MINT_BLT_UN_I4_S: return MINT_BLT_UN_I4_IMM_SP; - case MINT_BLT_UN_I8_S: return MINT_BLT_UN_I8_IMM_SP; + case MINT_BEQ_I4: return MINT_BEQ_I4_IMM_SP; + case MINT_BEQ_I8: return MINT_BEQ_I8_IMM_SP; + case MINT_BGE_I4: return MINT_BGE_I4_IMM_SP; + case MINT_BGE_I8: return MINT_BGE_I8_IMM_SP; + case MINT_BGT_I4: return MINT_BGT_I4_IMM_SP; + case MINT_BGT_I8: return MINT_BGT_I8_IMM_SP; + case MINT_BLT_I4: return MINT_BLT_I4_IMM_SP; + case MINT_BLT_I8: return MINT_BLT_I8_IMM_SP; + case MINT_BLE_I4: return MINT_BLE_I4_IMM_SP; + case MINT_BLE_I8: return MINT_BLE_I8_IMM_SP; + case MINT_BNE_UN_I4: return MINT_BNE_UN_I4_IMM_SP; + case MINT_BNE_UN_I8: return MINT_BNE_UN_I8_IMM_SP; + case MINT_BGE_UN_I4: return MINT_BGE_UN_I4_IMM_SP; + case MINT_BGE_UN_I8: return MINT_BGE_UN_I8_IMM_SP; + case MINT_BGT_UN_I4: return MINT_BGT_UN_I4_IMM_SP; + case MINT_BGT_UN_I8: return MINT_BGT_UN_I8_IMM_SP; + case MINT_BLE_UN_I4: return MINT_BLE_UN_I4_IMM_SP; + case MINT_BLE_UN_I8: return MINT_BLE_UN_I8_IMM_SP; + case MINT_BLT_UN_I4: return MINT_BLT_UN_I4_IMM_SP; + case MINT_BLT_UN_I8: return MINT_BLT_UN_I8_IMM_SP; default: return MINT_NOP; } } @@ -8692,26 +8738,26 @@ static int get_binop_condbr_sp (int opcode) { switch (opcode) { - case MINT_BEQ_I4_S: return MINT_BEQ_I4_SP; - case MINT_BEQ_I8_S: return MINT_BEQ_I8_SP; - case MINT_BGE_I4_S: return MINT_BGE_I4_SP; - case MINT_BGE_I8_S: return MINT_BGE_I8_SP; - case MINT_BGT_I4_S: return MINT_BGT_I4_SP; - case MINT_BGT_I8_S: return MINT_BGT_I8_SP; - case MINT_BLT_I4_S: return MINT_BLT_I4_SP; - case MINT_BLT_I8_S: return MINT_BLT_I8_SP; - case MINT_BLE_I4_S: return MINT_BLE_I4_SP; - case MINT_BLE_I8_S: return MINT_BLE_I8_SP; - case MINT_BNE_UN_I4_S: return MINT_BNE_UN_I4_SP; - case MINT_BNE_UN_I8_S: return MINT_BNE_UN_I8_SP; - case MINT_BGE_UN_I4_S: return MINT_BGE_UN_I4_SP; - case MINT_BGE_UN_I8_S: return MINT_BGE_UN_I8_SP; - case MINT_BGT_UN_I4_S: return MINT_BGT_UN_I4_SP; - case MINT_BGT_UN_I8_S: return MINT_BGT_UN_I8_SP; - case MINT_BLE_UN_I4_S: return MINT_BLE_UN_I4_SP; - case MINT_BLE_UN_I8_S: return MINT_BLE_UN_I8_SP; - case MINT_BLT_UN_I4_S: return MINT_BLT_UN_I4_SP; - case MINT_BLT_UN_I8_S: return MINT_BLT_UN_I8_SP; + case MINT_BEQ_I4: return MINT_BEQ_I4_SP; + case MINT_BEQ_I8: return MINT_BEQ_I8_SP; + case MINT_BGE_I4: return MINT_BGE_I4_SP; + case MINT_BGE_I8: return MINT_BGE_I8_SP; + case MINT_BGT_I4: return MINT_BGT_I4_SP; + case MINT_BGT_I8: return MINT_BGT_I8_SP; + case MINT_BLT_I4: return MINT_BLT_I4_SP; + case MINT_BLT_I8: return MINT_BLT_I8_SP; + case MINT_BLE_I4: return MINT_BLE_I4_SP; + case MINT_BLE_I8: return MINT_BLE_I8_SP; + case MINT_BNE_UN_I4: return MINT_BNE_UN_I4_SP; + case MINT_BNE_UN_I8: return MINT_BNE_UN_I8_SP; + case MINT_BGE_UN_I4: return MINT_BGE_UN_I4_SP; + case MINT_BGE_UN_I8: return MINT_BGE_UN_I8_SP; + case MINT_BGT_UN_I4: return MINT_BGT_UN_I4_SP; + case MINT_BGT_UN_I8: return MINT_BGT_UN_I8_SP; + case MINT_BLE_UN_I4: return MINT_BLE_UN_I4_SP; + case MINT_BLE_UN_I8: return MINT_BLE_UN_I8_SP; + case MINT_BLT_UN_I4: return MINT_BLT_UN_I4_SP; + case MINT_BLT_UN_I8: return MINT_BLT_UN_I8_SP; default: return MINT_NOP; } } @@ -8720,10 +8766,10 @@ static int get_unop_condbr_sp (int opcode) { switch (opcode) { - case MINT_BRFALSE_I4_S: return MINT_BRFALSE_I4_SP; - case MINT_BRFALSE_I8_S: return MINT_BRFALSE_I8_SP; - case MINT_BRTRUE_I4_S: return MINT_BRTRUE_I4_SP; - case MINT_BRTRUE_I8_S: return MINT_BRTRUE_I8_SP; + case MINT_BRFALSE_I4: return MINT_BRFALSE_I4_SP; + case MINT_BRFALSE_I8: return MINT_BRFALSE_I8_SP; + case MINT_BRTRUE_I4: return MINT_BRTRUE_I4_SP; + case MINT_BRTRUE_I8: return MINT_BRTRUE_I8_SP; default: return MINT_NOP; } } @@ -8733,16 +8779,20 @@ interp_super_instructions (TransformData *td) { InterpBasicBlock *bb; int *local_ref_count = td->local_ref_count; + + compute_native_offset_estimates (td); + // Add some actual super instructions for (bb = td->entry_bb; bb != NULL; bb = bb->next_bb) { InterpInst *ins; + int noe; // Set cbb since we do some instruction inserting below td->cbb = bb; - + noe = bb->native_offset_estimate; for (ins = bb->first_ins; ins != NULL; ins = ins->next) { int opcode = ins->opcode; - if (opcode == MINT_NOP) + if (MINT_IS_NOP (opcode)) continue; if (mono_interp_op_dregs [opcode] && !(td->locals [ins->dreg].flags & INTERP_LOCAL_FLAG_GLOBAL)) td->locals [ins->dreg].def = ins; @@ -8910,7 +8960,7 @@ interp_super_instructions (TransformData *td) local_ref_count [obj_sreg]--; mono_interp_stats.super_instructions++; } - } else if (MINT_IS_BINOP_CONDITIONAL_BRANCH (opcode)) { + } else if (MINT_IS_BINOP_CONDITIONAL_BRANCH (opcode) && is_short_offset (noe, ins->info.target_bb->native_offset_estimate)) { gint16 imm; int sreg_imm = ins->sregs [1]; if (get_sreg_imm (td, sreg_imm, &imm)) { @@ -8946,7 +8996,7 @@ interp_super_instructions (TransformData *td) } } } - } else if (MINT_IS_UNOP_CONDITIONAL_BRANCH (opcode)) { + } else if (MINT_IS_UNOP_CONDITIONAL_BRANCH (opcode) && is_short_offset (noe, ins->info.target_bb->native_offset_estimate)) { InterpInst *prev_ins = interp_prev_ins (ins); if (prev_ins && prev_ins->opcode == MINT_SAFEPOINT) { int condbr_op = get_unop_condbr_sp (opcode); @@ -8961,6 +9011,7 @@ interp_super_instructions (TransformData *td) } } + noe += get_inst_length (ins); } } } @@ -9288,8 +9339,8 @@ interp_alloc_offsets (TransformData *td) if (ins->flags & INTERP_INST_FLAG_CALL) { int *call_args = ins->info.call_args; if (call_args) { - int pair_sregs [MINT_MOV_PAIRS_MAX]; - int pair_dregs [MINT_MOV_PAIRS_MAX]; + guint16 pair_sregs [MINT_MOV_PAIRS_MAX]; + guint16 pair_dregs [MINT_MOV_PAIRS_MAX]; int num_pairs = 0; int var = *call_args; @@ -9303,9 +9354,10 @@ interp_alloc_offsets (TransformData *td) td->locals [new_var].flags |= INTERP_LOCAL_FLAG_CALL_ARGS; int mt = mint_type (td->locals [var].type); - if (mt != MINT_TYPE_VT && num_pairs < MINT_MOV_PAIRS_MAX) { - pair_sregs [num_pairs] = var; - pair_dregs [num_pairs] = new_var; + if (mt != MINT_TYPE_VT && num_pairs < MINT_MOV_PAIRS_MAX && var <= G_MAXUINT16 && new_var <= G_MAXUINT16) { + // We store these in the instruction data slots so we do this optimizations only if they fit + pair_sregs [num_pairs] = (guint16)var; + pair_dregs [num_pairs] = (guint16)new_var; num_pairs++; // The arg of the call is no longer global *call_args = new_var; diff --git a/src/mono/mono/mini/interp/transform.h b/src/mono/mono/mini/interp/transform.h index c57b0981d1b1d8..80a2eae7486a4f 100644 --- a/src/mono/mono/mini/interp/transform.h +++ b/src/mono/mono/mini/interp/transform.h @@ -99,7 +99,16 @@ struct _InterpBasicBlock { gint16 out_count; InterpBasicBlock **out_bb; + /* The real native offset of this bblock, computed when emitting the instructions in the code stream */ int native_offset; + /* + * Estimated native offset computed before the final code stream is generated. These offsets are used + * to determine whether we will use a long or short branch when branching to this bblock. Native offset + * estimates must respect the following condition: |bb1->n_o_e - bb2->n_o_e| >= |bb1->n_o - bb2->n_o|. + * The real native offset between two instructions is always smaller or equal to the estimate, allowing + * us to safely insert short branches based on the estimated offset. + */ + int native_offset_estimate; /* * The state of the stack when entering this basic block. By default, the stack height is diff --git a/src/mono/mono/mini/intrinsics.c b/src/mono/mono/mini/intrinsics.c index f91a8a659b5c80..8b4db42b078b4f 100644 --- a/src/mono/mono/mini/intrinsics.c +++ b/src/mono/mono/mini/intrinsics.c @@ -1810,12 +1810,14 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign ins->type = STACK_I4; MONO_ADD_INS (cfg->cbb, ins); return ins; - } else if (((!strcmp (cmethod_klass_image->assembly->aname.name, "MonoMac") || - !strcmp (cmethod_klass_image->assembly->aname.name, "monotouch")) && - !strcmp (cmethod_klass_name_space, "XamCore.ObjCRuntime") && - !strcmp (cmethod_klass_name, "Selector")) || - ((!strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.iOS") || - !strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.Mac")) && + } else if (((!strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.iOS") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.TVOS") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.MacCatalyst") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Xamarin.Mac") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Microsoft.iOS") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Microsoft.tvOS") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Microsoft.MacCatalyst") || + !strcmp (cmethod_klass_image->assembly->aname.name, "Microsoft.macOS")) && !strcmp (cmethod_klass_name_space, "ObjCRuntime") && !strcmp (cmethod_klass_name, "Selector")) ) { diff --git a/src/mono/mono/mini/jit-icalls.c b/src/mono/mono/mini/jit-icalls.c index 84b800d69e6c4b..49cd2e73d5a047 100644 --- a/src/mono/mono/mini/jit-icalls.c +++ b/src/mono/mono/mini/jit-icalls.c @@ -868,6 +868,7 @@ mono_ldtoken_wrapper_generic_shared (MonoImage *image, int token, MonoMethod *me return mono_ldtoken_wrapper (image, token, generic_context); } +#ifdef MONO_ARCH_EMULATE_FCONV_TO_U8 guint64 mono_fconv_u8 (double v) { @@ -885,18 +886,6 @@ mono_fconv_u8 (double v) #endif } -#ifdef MONO_ARCH_EMULATE_FCONV_TO_U8 -guint64 -mono_fconv_u8_2 (double v) -{ - // Separate from mono_fconv_u8 to avoid duplicate JIT icall. - // - // When there are duplicates, there is single instancing - // against function address that breaks stuff. For example, - // wrappers are only produced for one of them, breaking FullAOT. - return mono_fconv_u8 (v); -} - guint64 mono_rconv_u8 (float v) { @@ -923,6 +912,7 @@ mono_fconv_i8 (double v) } #endif +#ifdef MONO_ARCH_EMULATE_FCONV_TO_U4 guint32 mono_fconv_u4 (double v) { @@ -932,18 +922,6 @@ mono_fconv_u4 (double v) return (guint32)v; } -#ifdef MONO_ARCH_EMULATE_FCONV_TO_U4 -guint32 -mono_fconv_u4_2 (double v) -{ - // Separate from mono_fconv_u4 to avoid duplicate JIT icall. - // - // When there are duplicates, there is single instancing - // against function address that breaks stuff. For example, - // wrappers are only produced for one of them, breaking FullAOT. - return mono_fconv_u4 (v); -} - guint32 mono_rconv_u4 (float v) { diff --git a/src/mono/mono/mini/jit-icalls.h b/src/mono/mono/mini/jit-icalls.h index 86b96a7612f52e..6a7c969710ded4 100644 --- a/src/mono/mono/mini/jit-icalls.h +++ b/src/mono/mono/mini/jit-icalls.h @@ -73,14 +73,12 @@ ICALL_EXPORT gpointer mono_ldtoken_wrapper (MonoImage *image, int token, MonoGen ICALL_EXPORT gpointer mono_ldtoken_wrapper_generic_shared (MonoImage *image, int token, MonoMethod *method); ICALL_EXPORT guint64 mono_fconv_u8 (double v); -ICALL_EXPORT guint64 mono_fconv_u8_2 (double v); ICALL_EXPORT guint64 mono_rconv_u8 (float v); ICALL_EXPORT gint64 mono_fconv_i8 (double v); ICALL_EXPORT guint32 mono_fconv_u4 (double v); -ICALL_EXPORT guint32 mono_fconv_u4_2 (double v); ICALL_EXPORT guint32 mono_rconv_u4 (float v); diff --git a/src/mono/mono/mini/local-propagation.c b/src/mono/mono/mini/local-propagation.c index 3bd878e66b56a0..19801edd1f2814 100644 --- a/src/mono/mono/mini/local-propagation.c +++ b/src/mono/mono/mini/local-propagation.c @@ -223,7 +223,7 @@ mono_strength_reduction_division (MonoCompile *cfg, MonoInst *ins) guint32 tmp_regi; #endif struct magic_signed mag; - int power2 = mono_is_power_of_two (ins->inst_imm); + int power2 = (ins->inst_imm > 0) ? mono_is_power_of_two (ins->inst_imm) : -1; /* The decomposition doesn't handle exception throwing */ /* Optimization with MUL does not apply for -1, 0 and 1 divisors */ if (ins->inst_imm == 0 || ins->inst_imm == -1) { @@ -350,7 +350,7 @@ mono_strength_reduction_ins (MonoCompile *cfg, MonoInst *ins, const char **spec) ins->opcode = OP_INEG; } else if ((ins->opcode == OP_LMUL_IMM) && (ins->inst_imm == -1)) { ins->opcode = OP_LNEG; - } else { + } else if (ins->inst_imm > 0) { int power2 = mono_is_power_of_two (ins->inst_imm); if (power2 >= 0) { ins->opcode = (ins->opcode == OP_MUL_IMM) ? OP_SHL_IMM : ((ins->opcode == OP_LMUL_IMM) ? OP_LSHL_IMM : OP_ISHL_IMM); diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index 5b607e55636ead..0d2fee12d1e219 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -1149,7 +1149,10 @@ type_from_op (MonoCompile *cfg, MonoInst *ins, MonoInst *src1, MonoInst *src2) ins->opcode = OP_LCONV_TO_U; break; case STACK_R8: - ins->opcode = OP_FCONV_TO_U; + if (TARGET_SIZEOF_VOID_P == 8) + ins->opcode = OP_FCONV_TO_U8; + else + ins->opcode = OP_FCONV_TO_U4; break; case STACK_R4: if (TARGET_SIZEOF_VOID_P == 8) @@ -5324,20 +5327,20 @@ handle_call_res_devirt (MonoCompile *cfg, MonoMethod *cmethod, MonoInst *call_re MonoClass *gcomparer = mono_class_get_geqcomparer_class (); g_assert (gcomparer); gcomparer_inst = mono_class_inflate_generic_class_checked (gcomparer, &ctx, error); - mono_error_assert_ok (error); + if (is_ok (error)) { + MONO_INST_NEW (cfg, typed_objref, OP_TYPED_OBJREF); + typed_objref->type = STACK_OBJ; + typed_objref->dreg = alloc_ireg_ref (cfg); + typed_objref->sreg1 = call_res->dreg; + typed_objref->klass = gcomparer_inst; + MONO_ADD_INS (cfg->cbb, typed_objref); - MONO_INST_NEW (cfg, typed_objref, OP_TYPED_OBJREF); - typed_objref->type = STACK_OBJ; - typed_objref->dreg = alloc_ireg_ref (cfg); - typed_objref->sreg1 = call_res->dreg; - typed_objref->klass = gcomparer_inst; - MONO_ADD_INS (cfg->cbb, typed_objref); + call_res = typed_objref; - call_res = typed_objref; - - /* Force decompose */ - cfg->flags |= MONO_CFG_NEEDS_DECOMPOSE; - cfg->cbb->needs_decompose = TRUE; + /* Force decompose */ + cfg->flags |= MONO_CFG_NEEDS_DECOMPOSE; + cfg->cbb->needs_decompose = TRUE; + } } } @@ -6080,6 +6083,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b seq_points = FALSE; } + if (method->wrapper_type == MONO_WRAPPER_OTHER) { + WrapperInfo *info = mono_marshal_get_wrapper_info (method); + if (info->subtype == WRAPPER_SUBTYPE_INTERP_IN) { + /* We could hit a seq point before attaching to the JIT (#8338) */ + seq_points = FALSE; + } + } + if (cfg->prof_coverage) { if (cfg->compile_aot) g_error ("Coverage profiling is not supported with AOT."); @@ -7314,13 +7325,16 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b sp -= n; - if (virtual_ && cmethod && sp [0]->opcode == OP_TYPED_OBJREF) { + if (virtual_ && cmethod && sp [0] && sp [0]->opcode == OP_TYPED_OBJREF) { ERROR_DECL (error); MonoMethod *new_cmethod = mono_class_get_virtual_method (sp [0]->klass, cmethod, error); - mono_error_assert_ok (error); - cmethod = new_cmethod; - virtual_ = FALSE; + if (is_ok (error)) { + cmethod = new_cmethod; + virtual_ = FALSE; + } else { + mono_error_cleanup (error); + } } if (cmethod && method_does_not_return (cmethod)) { diff --git a/src/mono/mono/mini/mini-amd64.c b/src/mono/mono/mini/mini-amd64.c index 87c0b175ee6c7a..b615bc37060c03 100644 --- a/src/mono/mono/mini/mini-amd64.c +++ b/src/mono/mono/mini/mini-amd64.c @@ -363,7 +363,7 @@ collect_field_info_nested (MonoClass *klass, GArray *fields_array, int offset, g g_assert(info); for (i = 0; i < info->num_fields; ++i) { if (MONO_TYPE_ISSTRUCT (info->fields [i].field->type)) { - collect_field_info_nested (mono_class_from_mono_type_internal (info->fields [i].field->type), fields_array, info->fields [i].offset, pinvoke, unicode); + collect_field_info_nested (mono_class_from_mono_type_internal (info->fields [i].field->type), fields_array, (offset + info->fields [i].offset), pinvoke, unicode); } else { guint32 align; StructFieldInfo f; @@ -373,7 +373,7 @@ collect_field_info_nested (MonoClass *klass, GArray *fields_array, int offset, g info->fields [i].mspec, &align, TRUE, unicode); f.offset = offset + info->fields [i].offset; - if (i == info->num_fields - 1 && f.size + f.offset < info->native_size) { + if ((i == info->num_fields - 1) && ((f.size + f.offset) < (info->native_size))) { /* This can happen with .pack directives eg. 'fixed' arrays */ if (MONO_TYPE_IS_PRIMITIVE (f.type)) { /* Replicate the last field to fill out the remaining place, since the code in add_valuetype () needs type information */ @@ -6010,9 +6010,9 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, FALSE); break; case OP_FCONV_TO_I4: - case OP_FCONV_TO_I: code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE); break; + case OP_FCONV_TO_I: case OP_FCONV_TO_I8: code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 8, TRUE); break; diff --git a/src/mono/mono/mini/mini-arm.c b/src/mono/mono/mini/mini-arm.c index 58c0cef04842e9..59170bd09e8a5b 100644 --- a/src/mono/mono/mini/mini-arm.c +++ b/src/mono/mono/mini/mini-arm.c @@ -3466,7 +3466,7 @@ mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb) ins->inst_c0 = 0; break; } - imm8 = mono_is_power_of_two (ins->inst_imm); + imm8 = (ins->inst_imm > 0) ? mono_is_power_of_two (ins->inst_imm) : -1; if (imm8 > 0) { ins->opcode = OP_SHL_IMM; ins->inst_imm = imm8; @@ -5685,7 +5685,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE); break; case OP_FCONV_TO_U4: - case OP_FCONV_TO_U: code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, FALSE); break; case OP_FCONV_TO_I8: diff --git a/src/mono/mono/mini/mini-arm64.c b/src/mono/mono/mini/mini-arm64.c index a868facb7ff488..9231ca72bcdfff 100644 --- a/src/mono/mono/mini/mini-arm64.c +++ b/src/mono/mono/mini/mini-arm64.c @@ -4225,7 +4225,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) arm_uxthw (code, dreg, dreg); break; case OP_FCONV_TO_I4: - case OP_FCONV_TO_I: arm_fcvtzs_dx (code, dreg, sreg1); arm_sxtwx (code, dreg, dreg); break; @@ -4233,6 +4232,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) arm_fcvtzu_dx (code, dreg, sreg1); break; case OP_FCONV_TO_I8: + case OP_FCONV_TO_I: arm_fcvtzs_dx (code, dreg, sreg1); break; case OP_FCONV_TO_U8: diff --git a/src/mono/mono/mini/mini-exceptions.c b/src/mono/mono/mini/mini-exceptions.c index eea17726ba2e0e..ce9c8799f20f23 100644 --- a/src/mono/mono/mini/mini-exceptions.c +++ b/src/mono/mono/mini/mini-exceptions.c @@ -827,7 +827,7 @@ mono_get_generic_info_from_stack_frame (MonoJitInfo *ji, MonoContext *ctx) } method = jinfo_get_method (ji); - if (mono_method_get_context (method)->method_inst) { + if (mono_method_get_context (method)->method_inst || mini_method_is_default_method (method)) { /* A MonoMethodRuntimeGenericContext* */ return info; } else if ((method->flags & METHOD_ATTRIBUTE_STATIC) || m_class_is_valuetype (method->klass)) { @@ -855,12 +855,13 @@ mono_get_generic_context_from_stack_frame (MonoJitInfo *ji, gpointer generic_inf method = jinfo_get_method (ji); g_assert (method->is_inflated); - if (mono_method_get_context (method)->method_inst) { + if (mono_method_get_context (method)->method_inst || mini_method_is_default_method (method)) { MonoMethodRuntimeGenericContext *mrgctx = (MonoMethodRuntimeGenericContext *)generic_info; klass = mrgctx->class_vtable->klass; context.method_inst = mrgctx->method_inst; - g_assert (context.method_inst); + if (!mini_method_is_default_method (method)) + g_assert (context.method_inst); } else { MonoVTable *vtable = (MonoVTable *)generic_info; @@ -873,6 +874,12 @@ mono_get_generic_context_from_stack_frame (MonoJitInfo *ji, gpointer generic_inf else method_container_class = method->klass; + if (mini_method_is_default_method (method)) { + if (mono_class_is_ginst (klass) || mono_class_is_gtd (klass)) + context.class_inst = mini_class_get_context (klass)->class_inst; + return context; + } + /* class might refer to a subclass of method's class */ while (!(klass == method->klass || (mono_class_is_ginst (klass) && mono_class_get_generic_class (klass)->container_class == method_container_class))) { klass = m_class_get_parent (klass); diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index ada72e46a90afd..0974486ce17caa 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -529,23 +529,27 @@ ThisType (void) return TARGET_SIZEOF_VOID_P == 8 ? LLVMPointerType (LLVMInt64Type (), 0) : LLVMPointerType (LLVMInt32Type (), 0); } +typedef struct { + int32_t size; + uint32_t align; +} MonoSizeAlign; + /* * get_vtype_size: * * Return the size of the LLVM representation of the vtype T. */ -static guint32 -get_vtype_size (MonoType *t) +static MonoSizeAlign +get_vtype_size_align (MonoType *t) { - int size; - - size = mono_class_value_size (mono_class_from_mono_type_internal (t), NULL); + uint32_t align = 0; + int32_t size = mono_class_value_size (mono_class_from_mono_type_internal (t), &align); /* LLVMArgAsIArgs depends on this since it stores whole words */ while (size < 2 * TARGET_SIZEOF_VOID_P && mono_is_power_of_two (size) == -1) size ++; - - return size; + MonoSizeAlign ret = { size, align }; + return ret; } /* @@ -680,11 +684,17 @@ create_llvm_type_for_type (MonoLLVMModule *module, MonoClass *klass) for (i = 0; i < size; ++i) eltypes [i] = esize == 4 ? LLVMFloatType () : LLVMDoubleType (); } else { - size = get_vtype_size (t); - - eltypes = g_new (LLVMTypeRef, size); - for (i = 0; i < size; ++i) - eltypes [i] = LLVMInt8Type (); + MonoSizeAlign size_align = get_vtype_size_align (t); + eltypes = g_new (LLVMTypeRef, size_align.size); + size = 0; + uint32_t bytes = 0; + uint32_t chunk = size_align.align < TARGET_SIZEOF_VOID_P ? size_align.align : TARGET_SIZEOF_VOID_P; + for (; chunk > 0; chunk = chunk >> 1) { + for (; (bytes + chunk) <= size_align.size; bytes += chunk) { + eltypes [size] = LLVMIntType (chunk * 8); + ++size; + } + } } name = mono_type_full_name (m_class_get_byval_arg (klass)); @@ -965,7 +975,6 @@ op_to_llvm_type (int opcode) case OP_RCONV_TO_U8: return LLVMInt64Type (); case OP_FCONV_TO_I: - case OP_FCONV_TO_U: return TARGET_SIZEOF_VOID_P == 8 ? LLVMInt64Type () : LLVMInt32Type (); case OP_IADD_OVF: case OP_IADD_OVF_UN: @@ -2671,11 +2680,11 @@ static void emit_vtype_to_args (EmitContext *ctx, LLVMBuilderRef builder, MonoType *t, LLVMValueRef address, LLVMArgInfo *ainfo, LLVMValueRef *args, guint32 *nargs) { int pindex = 0; - int j, size, nslots; + int j, nslots; LLVMTypeRef arg_type; t = mini_get_underlying_type (t); - size = get_vtype_size (t); + int32_t size = get_vtype_size_align (t).size; if (MONO_CLASS_IS_SIMD (ctx->cfg, mono_class_from_mono_type_internal (t))) address = LLVMBuildBitCast (ctx->builder, address, LLVMPointerType (LLVMInt8Type (), 0), ""); @@ -7341,7 +7350,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) } else if (ainfo->storage == LLVMArgVtypeAddr || values [ins->sreg1] == addresses [ins->sreg1]) { /* LLVMArgVtypeByRef/LLVMArgVtypeAddr, have to make a copy */ addresses [ins->dreg] = build_alloca (ctx, t); - LLVMValueRef v = LLVMBuildLoad (builder, addresses [ins->sreg1], ""); + LLVMValueRef v = LLVMBuildLoad (builder, addresses [ins->sreg1], "llvm_outarg_vt_copy"); LLVMBuildStore (builder, convert (ctx, v, type_to_llvm_type (ctx, t)), addresses [ins->dreg]); } else { addresses [ins->dreg] = addresses [ins->sreg1]; @@ -7357,7 +7366,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) ctx->module->objc_selector_to_var = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); LLVMValueRef info_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), 8), "@OBJC_IMAGE_INFO"); - int32_t objc_imageinfo [] = { 0, 16 }; + int32_t objc_imageinfo [] = { 0, 0 }; LLVMSetInitializer (info_var, mono_llvm_create_constant_data_array ((uint8_t *) &objc_imageinfo, 8)); LLVMSetLinkage (info_var, LLVMPrivateLinkage); LLVMSetExternallyInitialized (info_var, TRUE); @@ -11473,7 +11482,7 @@ emit_method_inner (EmitContext *ctx) mono_llvm_add_func_attr (method, LLVM_ATTR_UW_TABLE); if (cfg->disable_omit_fp) - mono_llvm_add_func_attr_nv (method, "no-frame-pointer-elim", "true"); + mono_llvm_add_func_attr_nv (method, "frame-pointer", "all"); if (cfg->compile_aot) { if (mono_aot_is_externally_callable (cfg->method)) { diff --git a/src/mono/mono/mini/mini-mips.c b/src/mono/mono/mini/mini-mips.c index 9a353ce85fa1ea..01dc86ce28ea91 100644 --- a/src/mono/mono/mini/mini-mips.c +++ b/src/mono/mono/mini/mini-mips.c @@ -1987,7 +1987,7 @@ mono_arch_peephole_pass_2 (MonoCompile *cfg, MonoBasicBlock *bb) MONO_DELETE_INS (bb, ins); continue; } - } else { + } else if (ins->inst_imm > 0) { int power2 = mono_is_power_of_two (ins->inst_imm); if (power2 > 0) { ins->opcode = OP_SHL_IMM; @@ -2666,7 +2666,7 @@ mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb) ins->inst_c0 = 0; break; } - imm = mono_is_power_of_two (ins->inst_imm); + imm = (ins->inst_imm > 0) ? mono_is_power_of_two (ins->inst_imm) : -1; if (imm > 0) { ins->opcode = OP_SHL_IMM; ins->inst_imm = imm; @@ -4270,7 +4270,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE); break; case OP_FCONV_TO_U4: - case OP_FCONV_TO_U: code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, FALSE); break; case OP_SQRT: diff --git a/src/mono/mono/mini/mini-native-types.c b/src/mono/mono/mini/mini-native-types.c index 08f72acafe6840..6c7e6ffb1a8528 100644 --- a/src/mono/mono/mini/mini-native-types.c +++ b/src/mono/mono/mini/mini-native-types.c @@ -372,6 +372,16 @@ mono_class_is_magic_assembly (MonoClass *klass) return TRUE; if (!strcmp ("Xamarin.WatchOS", aname)) return TRUE; + if (!strcmp ("Xamarin.MacCatalyst", aname)) + return TRUE; + if (!strcmp ("Microsoft.iOS", aname)) + return TRUE; + if (!strcmp ("Microsoft.macOS", aname)) + return TRUE; + if (!strcmp ("Microsoft.watchOS", aname)) + return TRUE; + if (!strcmp ("Microsoft.MacCatalyst", aname)) + return TRUE; /* regression test suite */ if (!strcmp ("builtin-types", aname)) return TRUE; @@ -427,7 +437,7 @@ mono_class_is_magic_float (MonoClass *klass) if (!mono_class_is_magic_assembly (klass)) return FALSE; - if (strcmp ("System", m_class_get_name_space (klass)) != 0) + if (strcmp ("System", m_class_get_name_space (klass)) != 0 && strcmp ("ObjCRuntime", m_class_get_name_space (klass)) != 0) return FALSE; if (strcmp ("nfloat", m_class_get_name (klass)) == 0) { diff --git a/src/mono/mono/mini/mini-ops.h b/src/mono/mono/mini/mini-ops.h index ed2d11d563a08c..9cfb59cdb4fbe1 100644 --- a/src/mono/mono/mini/mini-ops.h +++ b/src/mono/mono/mini/mini-ops.h @@ -583,7 +583,6 @@ MINI_OP(OP_FCGT_UN_MEMBASE,"float_cgt_un_membase", IREG, FREG, IREG) MINI_OP(OP_FCLT_MEMBASE, "float_clt_membase", IREG, FREG, IREG) MINI_OP(OP_FCLT_UN_MEMBASE,"float_clt_un_membase", IREG, FREG, IREG) -MINI_OP(OP_FCONV_TO_U, "float_conv_to_u", IREG, FREG, NONE) MINI_OP(OP_CKFINITE, "ckfinite", FREG, FREG, NONE) /* r4 opcodes: must be in the same order as the matching CEE_ opcodes: ovfops_op_map */ diff --git a/src/mono/mono/mini/mini-posix.c b/src/mono/mono/mini/mini-posix.c index 346b4bd43f2efd..79bf8c84f88885 100644 --- a/src/mono/mono/mini/mini-posix.c +++ b/src/mono/mono/mini/mini-posix.c @@ -79,6 +79,7 @@ #include #include "mini-runtime.h" #include "jit-icalls.h" +#include #ifdef HOST_DARWIN #include @@ -530,7 +531,7 @@ clock_init_for_profiler (MonoProfilerSampleMode mode) * CLOCK_PROCESS_CPUTIME_ID clock but don't actually support it. For * those systems, we fall back to CLOCK_MONOTONIC if we get EINVAL. */ - if (clock_nanosleep (CLOCK_PROCESS_CPUTIME_ID, TIMER_ABSTIME, &ts, NULL) != EINVAL) { + if (g_clock_nanosleep (CLOCK_PROCESS_CPUTIME_ID, TIMER_ABSTIME, &ts, NULL) != EINVAL) { sampling_clock = CLOCK_PROCESS_CPUTIME_ID; break; } @@ -554,7 +555,7 @@ clock_sleep_ns_abs (guint64 ns_abs) then.tv_nsec = ns_abs % 1000000000; do { - ret = clock_nanosleep (sampling_clock, TIMER_ABSTIME, &then, NULL); + ret = g_clock_nanosleep (sampling_clock, TIMER_ABSTIME, &then, NULL); if (ret != 0 && ret != EINTR) g_error ("%s: clock_nanosleep () returned %d", __func__, ret); diff --git a/src/mono/mono/mini/mini-ppc.c b/src/mono/mono/mini/mini-ppc.c index 19097c9df89d91..112abb168bfe96 100644 --- a/src/mono/mono/mini/mini-ppc.c +++ b/src/mono/mono/mini/mini-ppc.c @@ -1963,7 +1963,7 @@ mono_arch_peephole_pass_2 (MonoCompile *cfg, MonoBasicBlock *bb) MONO_DELETE_INS (bb, ins); continue; } - } else { + } else if (inst->inst_imm > 0) { int power2 = mono_is_power_of_two (ins->inst_imm); if (power2 > 0) { ins->opcode = OP_SHL_IMM; @@ -2537,7 +2537,7 @@ mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb) ins->inst_c0 = 0; break; } - imm = mono_is_power_of_two (ins->inst_imm); + imm = (ins->inst_imm > 0) ? mono_is_power_of_two (ins->inst_imm) : -1; if (imm > 0) { ins->opcode = OP_SHL_IMM; ins->inst_imm = imm; @@ -4163,7 +4163,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE); break; case OP_FCONV_TO_U4: - case OP_FCONV_TO_U: code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, FALSE); break; case OP_LCONV_TO_R_UN: diff --git a/src/mono/mono/mini/mini-runtime.c b/src/mono/mono/mini/mini-runtime.c index 2ca296b1fd60b5..812a8348c5f438 100644 --- a/src/mono/mono/mini/mini-runtime.c +++ b/src/mono/mono/mini/mini-runtime.c @@ -2999,6 +2999,8 @@ typedef struct { gpointer *wrapper_arg; } RuntimeInvokeInfo; +#define MONO_SIZEOF_DYN_CALL_RET_BUF TARGET_SIZEOF_VOID_P + static RuntimeInvokeInfo* create_runtime_invoke_info (MonoMethod *method, gpointer compiled_method, gboolean callee_gsharedvt, gboolean use_interp, MonoError *error) { @@ -3157,8 +3159,8 @@ mono_llvmonly_runtime_invoke (MonoMethod *method, RuntimeInvokeInfo *info, void { MonoMethodSignature *sig = info->sig; MonoObject *(*runtime_invoke) (MonoObject *this_obj, void **params, MonoObject **exc, void* compiled_method); - gpointer retval_ptr; - guint8 retval [256]; + int32_t retval_size = MONO_SIZEOF_DYN_CALL_RET_BUF; + gpointer retval = NULL; int i, pindex; error_init (error); @@ -3185,8 +3187,21 @@ mono_llvmonly_runtime_invoke (MonoMethod *method, RuntimeInvokeInfo *info, void if (sig->hasthis) args [pindex ++] = &obj; if (sig->ret->type != MONO_TYPE_VOID) { - retval_ptr = &retval; - args [pindex ++] = &retval_ptr; + if (info->ret_box_class && !sig->ret->byref && + (sig->ret->type == MONO_TYPE_VALUETYPE || + (sig->ret->type == MONO_TYPE_GENERICINST && !MONO_TYPE_IS_REFERENCE (sig->ret)))) { + // if the return type is a struct, allocate enough stack space to hold it + MonoClass *ret_klass = mono_class_from_mono_type_internal (sig->ret); + g_assert (!mono_class_has_failure (ret_klass)); + int32_t inst_size = mono_class_instance_size (ret_klass); + if (inst_size > MONO_SIZEOF_DYN_CALL_RET_BUF) { + retval_size = inst_size; + } + } + } + retval = g_alloca (retval_size); + if (sig->ret->type != MONO_TYPE_VOID) { + args [pindex ++] = &retval; } for (i = 0; i < sig->param_count; ++i) { MonoType *t = sig->params [i]; @@ -3235,7 +3250,8 @@ mono_llvmonly_runtime_invoke (MonoMethod *method, RuntimeInvokeInfo *info, void if (sig->ret->byref) { return mono_value_box_checked (info->ret_box_class, *(gpointer*)retval, error); } else { - return mono_value_box_checked (info->ret_box_class, retval, error); + MonoObject *ret = mono_value_box_checked (info->ret_box_class, retval, error); + return ret; } } else { if (sig->ret->byref) @@ -3398,7 +3414,22 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec gpointer *args; int i, pindex, buf_size; guint8 *buf; - guint8 retval [256]; + int32_t retval_size = MONO_SIZEOF_DYN_CALL_RET_BUF; + guint8 *retval = NULL; + + /* if the return type is a struct and it's too big, allocate more space for it */ + if (info->ret_box_class && !sig->ret->byref && + (sig->ret->type == MONO_TYPE_VALUETYPE || + (sig->ret->type == MONO_TYPE_GENERICINST && !MONO_TYPE_IS_REFERENCE (sig->ret)))) { + MonoClass *ret_klass = mono_class_from_mono_type_internal (sig->ret); + g_assert (!mono_class_has_failure (ret_klass)); + int32_t inst_size = mono_class_instance_size (ret_klass); + if (inst_size > MONO_SIZEOF_DYN_CALL_RET_BUF) { + retval_size = inst_size; + } + } + + retval = g_alloca (retval_size); /* Convert the arguments to the format expected by start_dyn_call () */ args = (void **)g_alloca ((sig->param_count + sig->hasthis) * sizeof (gpointer)); @@ -3434,10 +3465,29 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec return NULL; } - if (info->ret_box_class) - return mono_value_box_checked (info->ret_box_class, retval, error); - else - return *(MonoObject**)retval; + if (sig->ret->byref) { + if (*(gpointer*)retval == NULL) { + MonoClass *klass = mono_class_get_nullbyrefreturn_ex_class (); + MonoObject *ex = mono_object_new_checked (klass, error); + mono_error_assert_ok (error); + mono_error_set_exception_instance (error, (MonoException*)ex); + return NULL; + } + } + + if (info->ret_box_class) { + if (sig->ret->byref) { + return mono_value_box_checked (info->ret_box_class, *(gpointer*)retval, error); + } else { + MonoObject *boxed_ret = mono_value_box_checked (info->ret_box_class, retval, error); + return boxed_ret; + } + } else { + if (sig->ret->byref) + return **(MonoObject***)retval; + else + return *(MonoObject**)retval; + } } #endif @@ -4334,13 +4384,14 @@ mini_init (const char *filename, const char *runtime_version) #endif mono_interp_stub_init (); + mono_components_init (); + + mono_component_debugger ()->parse_options (mono_debugger_agent_get_sdb_options ()); + #ifndef DISABLE_INTERPRETER if (mono_use_interpreter) mono_ee_interp_init (mono_interp_opts_string); #endif - mono_components_init (); - - mono_component_debugger ()->parse_options (mono_debugger_agent_get_sdb_options ()); mono_os_mutex_init_recursive (&jit_mutex); @@ -4697,11 +4748,11 @@ register_icalls (void) #endif #ifdef MONO_ARCH_EMULATE_FCONV_TO_U8 - register_opcode_emulation (OP_FCONV_TO_U8, __emul_fconv_to_u8, mono_icall_sig_ulong_double, mono_fconv_u8_2, FALSE); + register_opcode_emulation (OP_FCONV_TO_U8, __emul_fconv_to_u8, mono_icall_sig_ulong_double, mono_fconv_u8, FALSE); register_opcode_emulation (OP_RCONV_TO_U8, __emul_rconv_to_u8, mono_icall_sig_ulong_float, mono_rconv_u8, FALSE); #endif #ifdef MONO_ARCH_EMULATE_FCONV_TO_U4 - register_opcode_emulation (OP_FCONV_TO_U4, __emul_fconv_to_u4, mono_icall_sig_uint32_double, mono_fconv_u4_2, FALSE); + register_opcode_emulation (OP_FCONV_TO_U4, __emul_fconv_to_u4, mono_icall_sig_uint32_double, mono_fconv_u4, FALSE); register_opcode_emulation (OP_RCONV_TO_U4, __emul_rconv_to_u4, mono_icall_sig_uint32_float, mono_rconv_u4, FALSE); #endif register_opcode_emulation (OP_FCONV_TO_OVF_I8, __emul_fconv_to_ovf_i8, mono_icall_sig_long_double, mono_fconv_ovf_i8, FALSE); @@ -4779,13 +4830,6 @@ register_icalls (void) register_icall (mono_class_interface_match, mono_icall_sig_uint32_ptr_int32, TRUE); #endif - // FIXME Elsewhere these are registered with no_wrapper = FALSE -#if SIZEOF_REGISTER == 4 - register_opcode_emulation (OP_FCONV_TO_U, __emul_fconv_to_u, mono_icall_sig_uint32_double, mono_fconv_u4, TRUE); -#else - register_opcode_emulation (OP_FCONV_TO_U, __emul_fconv_to_u, mono_icall_sig_ulong_double, mono_fconv_u8, TRUE); -#endif - /* other jit icalls */ register_icall (ves_icall_mono_delegate_ctor, mono_icall_sig_void_object_object_ptr, FALSE); register_icall (ves_icall_mono_delegate_ctor_interp, mono_icall_sig_void_object_object_ptr, FALSE); diff --git a/src/mono/mono/mini/mini-s390x.c b/src/mono/mono/mini/mini-s390x.c index 5ad3edbef2c4a7..3414f6bea2c4ac 100644 --- a/src/mono/mono/mini/mini-s390x.c +++ b/src/mono/mono/mini/mini-s390x.c @@ -4282,11 +4282,9 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) } break; case OP_FCONV_TO_I4: - case OP_FCONV_TO_I: s390_cfdbr (code, ins->dreg, 5, ins->sreg1); break; case OP_FCONV_TO_U4: - case OP_FCONV_TO_U: if (mono_hwcap_s390x_has_fpe) { s390_clgdbr (code, ins->dreg, 5, ins->sreg1, 0); } else { @@ -4294,6 +4292,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) } break; case OP_FCONV_TO_I8: + case OP_FCONV_TO_I: s390_cgdbr (code, ins->dreg, 5, ins->sreg1); break; case OP_FCONV_TO_U8: @@ -4338,7 +4337,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) } break; case OP_RCONV_TO_I4: - case OP_RCONV_TO_I: s390_cfebr (code, ins->dreg, 5, ins->sreg1); break; case OP_RCONV_TO_U4: @@ -4349,6 +4347,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) } break; case OP_RCONV_TO_I8: + case OP_RCONV_TO_I: s390_cgebr (code, ins->dreg, 5, ins->sreg1); break; case OP_RCONV_TO_U8: diff --git a/src/mono/mono/mini/mini-sparc.c b/src/mono/mono/mini/mini-sparc.c index 448f150c5505b8..01cbb979c48547 100644 --- a/src/mono/mono/mini/mini-sparc.c +++ b/src/mono/mono/mini/mini-sparc.c @@ -3395,7 +3395,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) case OP_FCONV_TO_U2: #ifndef SPARCV9 case OP_FCONV_TO_I: - case OP_FCONV_TO_U: #endif case OP_FCONV_TO_I4: case OP_FCONV_TO_U4: { diff --git a/src/mono/mono/mini/mini-trampolines.c b/src/mono/mono/mini/mini-trampolines.c index c6901fb339330d..07a50524a0feb2 100644 --- a/src/mono/mono/mini/mini-trampolines.c +++ b/src/mono/mono/mini/mini-trampolines.c @@ -554,7 +554,7 @@ common_call_trampoline (host_mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTa /* * The caller is gshared code, compute the actual method to call from M and this/rgctx. */ - if (m->is_inflated && mono_method_get_context (m)->method_inst) { + if (m->is_inflated && (mono_method_get_context (m)->method_inst || mini_method_is_default_method (m))) { MonoMethodRuntimeGenericContext *mrgctx = (MonoMethodRuntimeGenericContext*)mono_arch_find_static_call_vtable (regs, code); klass = mrgctx->class_vtable->klass; @@ -632,11 +632,13 @@ common_call_trampoline (host_mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTa return NULL; if (generic_virtual || variant_iface) { - if (m_class_is_valuetype (vt->klass)) /*FIXME is this required variant iface?*/ + if (m_class_is_valuetype (vt->klass) && !mini_method_is_default_method (m)) /*FIXME is this required variant iface?*/ need_unbox_tramp = TRUE; } else if (orig_vtable_slot) { - if (m_class_is_valuetype (m->klass)) + if (m_class_is_valuetype (m->klass)) { + g_assert (!mini_method_is_default_method (m)); need_unbox_tramp = TRUE; + } } addr = mini_add_method_trampoline (m, compiled_method, need_rgctx_tramp, need_unbox_tramp); diff --git a/src/mono/mono/profiler/CMakeLists.txt b/src/mono/mono/profiler/CMakeLists.txt index 784ceb0203d3d4..2b06ab374feb45 100644 --- a/src/mono/mono/profiler/CMakeLists.txt +++ b/src/mono/mono/profiler/CMakeLists.txt @@ -22,6 +22,10 @@ if(NOT DISABLE_LIBS) add_library(mono-profiler-log-static STATIC helper.c log.c log-args.c) set_target_properties(mono-profiler-log-static PROPERTIES OUTPUT_NAME mono-profiler-log) install(TARGETS mono-profiler-log-static LIBRARY) + + if(HAVE_SYS_ZLIB) + target_link_libraries(mono-profiler-log z) + endif() endif() add_library(mono-profiler-aot-static STATIC aot.c helper.c) diff --git a/src/mono/mono/sgen/sgen-cardtable.c b/src/mono/mono/sgen/sgen-cardtable.c index 120afe0d4ea2c9..31a25f47fd8fdc 100644 --- a/src/mono/mono/sgen/sgen-cardtable.c +++ b/src/mono/mono/sgen/sgen-cardtable.c @@ -594,9 +594,9 @@ sgen_cardtable_scan_object (GCObject *obj, mword block_obj_size, guint8 *cards, HEAVY_STAT (++bloby_objects); if (cards) { if (sgen_card_table_is_range_marked (cards, (mword)obj, block_obj_size)) - ctx.ops->scan_object (obj, sgen_obj_get_descriptor (obj), ctx.queue); + ctx.ops->scan_object (obj, sgen_obj_get_descriptor_safe (obj), ctx.queue); } else if (sgen_card_table_region_begin_scanning ((mword)obj, block_obj_size)) { - ctx.ops->scan_object (obj, sgen_obj_get_descriptor (obj), ctx.queue); + ctx.ops->scan_object (obj, sgen_obj_get_descriptor_safe (obj), ctx.queue); } sgen_binary_protocol_card_scan (obj, sgen_safe_object_get_size (obj)); diff --git a/src/mono/mono/sgen/sgen-marksweep.c b/src/mono/mono/sgen/sgen-marksweep.c index ca01a483e9d545..f767431c1699ee 100644 --- a/src/mono/mono/sgen/sgen-marksweep.c +++ b/src/mono/mono/sgen/sgen-marksweep.c @@ -2661,7 +2661,7 @@ scan_card_table_for_block (MSBlockInfo *block, CardTableScanType scan_type, Scan if (small_objects) { HEAVY_STAT (++scanned_objects); - scan_func (object, sgen_obj_get_descriptor (object), queue); + scan_func (object, sgen_obj_get_descriptor_safe (object), queue); } else { size_t offset = sgen_card_table_get_card_offset (obj, block_start); sgen_cardtable_scan_object (object, block_obj_size, card_base + offset, ctx); diff --git a/src/mono/mono/utils/mono-math.h b/src/mono/mono/utils/mono-math.h index 0f535e8ca28629..a24a0a303a9efc 100644 --- a/src/mono/mono/utils/mono-math.h +++ b/src/mono/mono/utils/mono-math.h @@ -7,6 +7,7 @@ #include #include +#include // Instead of isfinite, isinf, isnan, etc., // use mono_isfininite, mono_isinf, mono_isnan, etc. @@ -99,4 +100,27 @@ mono_round_to_even (double x) return copysign (floor_tmp, x); } +static inline gboolean +mono_try_trunc_i64 (double val, gint64 *out) +{ + const double two63 = 2147483648.0 * 4294967296.0; + // 0x402 is epsilon used to get us to the next value + if (val > (-two63 - 0x402) && val < two63) { + *out = (gint64)val; + return TRUE; + } + return FALSE; +} + +static inline gboolean +mono_try_trunc_u64 (double val, guint64 *out) +{ + const double two64 = 4294967296.0 * 4294967296.0; + if (val > -1.0 && val < two64) { + *out = (guint64)val; + return TRUE; + } + return FALSE; +} + #endif diff --git a/src/mono/mono/utils/mono-proclib.c b/src/mono/mono/utils/mono-proclib.c index 1b19cdec49fb52..1c69d81765b7ba 100644 --- a/src/mono/mono/utils/mono-proclib.c +++ b/src/mono/mono/utils/mono-proclib.c @@ -81,7 +81,7 @@ #endif #ifdef HAVE_SCHED_GETAFFINITY -# ifndef GLIBC_HAS_CPU_COUNT +# ifndef HAVE_GNU_CPU_COUNT static int CPU_COUNT(cpu_set_t *set) { diff --git a/src/mono/mono/utils/mono-threads-coop.c b/src/mono/mono/utils/mono-threads-coop.c index 44d1ee8681df82..970a7099e9ecfa 100644 --- a/src/mono/mono/utils/mono-threads-coop.c +++ b/src/mono/mono/utils/mono-threads-coop.c @@ -95,12 +95,11 @@ coop_tls_pop (gpointer received_cookie) static void check_info (MonoThreadInfo *info, const gchar *action, const gchar *state, const char *func) { - if (!info) - g_error ("%s Cannot %s GC %s region if the thread is not attached", func, action, state); - if (!mono_thread_info_is_current (info)) - g_error ("%s [%p] Cannot %s GC %s region on a different thread", func, mono_thread_info_get_tid (info), action, state); - if (!mono_thread_info_is_live (info)) - g_error ("%s [%p] Cannot %s GC %s region if the thread is not live", func, mono_thread_info_get_tid (info), action, state); +#ifdef ENABLE_CHECKED_BUILD + g_assertf (info, "%s Cannot %s GC %s region if the thread is not attached", func, action, state); + g_assertf (mono_thread_info_is_current (info), "%s [%p] Cannot %s GC %s region on a different thread", func, mono_thread_info_get_tid (info), action, state); + g_assertf (mono_thread_info_is_live (info), "%s [%p] Cannot %s GC %s region if the thread is not live", func, mono_thread_info_get_tid (info), action, state); +#endif } static int coop_reset_blocking_count; diff --git a/src/mono/mono/utils/mono-threads-mach-helper.c b/src/mono/mono/utils/mono-threads-mach-helper.c index 7b4f140b619ef9..0a2ff341fc43e8 100644 --- a/src/mono/mono/utils/mono-threads-mach-helper.c +++ b/src/mono/mono/utils/mono-threads-mach-helper.c @@ -59,10 +59,10 @@ mono_dead_letter_dealloc (id self, SEL _cmd) { struct objc_super super; super.receiver = self; -#if !defined(__cplusplus) && !__OBJC2__ - super.class = nsobject; -#else +#if defined(__cplusplus) || defined(HAVE_OBJC_SUPER_SUPER_CLASS) super.super_class = nsobject; +#else + super.class = nsobject; #endif void (*objc_msgSendSuper_op)(struct objc_super *, SEL) = (void (*)(struct objc_super *, SEL)) objc_msgSendSuper; objc_msgSendSuper_op (&super, dealloc); diff --git a/src/mono/mono/utils/mono-threads-state-machine.c b/src/mono/mono/utils/mono-threads-state-machine.c index 2d9a06cd76f61b..927d86d619f23a 100644 --- a/src/mono/mono/utils/mono-threads-state-machine.c +++ b/src/mono/mono/utils/mono-threads-state-machine.c @@ -105,6 +105,7 @@ unwrap_thread_state (MonoThreadInfo* info, static void check_thread_state (MonoThreadInfo* info) { +#ifdef ENABLE_CHECKED_BUILD int raw_state, cur_state, suspend_count; gboolean no_safepoints; UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, no_safepoints, info); @@ -133,6 +134,7 @@ check_thread_state (MonoThreadInfo* info) default: g_error ("Invalid state %d", cur_state); } +#endif } static void diff --git a/src/mono/mono/utils/mono-threads.c b/src/mono/mono/utils/mono-threads.c index 52890fe288ea33..e26cc53e02ca6e 100644 --- a/src/mono/mono/utils/mono-threads.c +++ b/src/mono/mono/utils/mono-threads.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -1743,7 +1744,7 @@ mono_thread_info_sleep (guint32 ms, gboolean *alerted) } do { - ret = clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &target, NULL); + ret = g_clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &target, NULL); } while (ret != 0); #elif HOST_WIN32 Sleep (ms); diff --git a/src/mono/mono/utils/options-def.h b/src/mono/mono/utils/options-def.h index 00a13ece118c86..fe5ad3898c4af7 100644 --- a/src/mono/mono/utils/options-def.h +++ b/src/mono/mono/utils/options-def.h @@ -60,6 +60,7 @@ DEFINE_BOOL_READONLY(readonly_flag, "readonly-flag", FALSE, "Example") #endif */ +DEFINE_BOOL(aot_lazy_assembly_load, "aot-lazy-assembly-load", FALSE, "Load assemblies referenced by AOT images lazily") /* Cleanup */ #undef DEFINE_OPTION_FULL #undef DEFINE_OPTION_READONLY diff --git a/src/mono/mono/utils/options.c b/src/mono/mono/utils/options.c index f25b0fd773b43c..10daa6171908d4 100644 --- a/src/mono/mono/utils/options.c +++ b/src/mono/mono/utils/options.c @@ -86,7 +86,7 @@ mono_options_print_usage (void) } /* - * mono_optiond_parse_options: + * mono_options_parse_options: * * Set options based on the command line arguments in ARGV/ARGC. * Remove processed arguments from ARGV and set *OUT_ARGC to the diff --git a/src/mono/mono/zlib/cgmanifest.json b/src/mono/mono/zlib/cgmanifest.json new file mode 100644 index 00000000000000..14f72ac4a1fe61 --- /dev/null +++ b/src/mono/mono/zlib/cgmanifest.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "Registrations": [ + { + "Component": { + "Type": "git", + "Git": { + "RepositoryUrl": "https://github.com/madler/zlib", + "CommitHash": "04f42ceca40f73e2978b50e93806c2a18c1281fc" + } + }, + "DevelopmentDependency": false + } + ] +} diff --git a/src/mono/mono/zlib/compress.c b/src/mono/mono/zlib/compress.c index e2db404abf888b..2ad5326c14ec04 100644 --- a/src/mono/mono/zlib/compress.c +++ b/src/mono/mono/zlib/compress.c @@ -19,7 +19,7 @@ memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) +int ZEXPORT compress2(dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -65,7 +65,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) /* =========================================================================== */ -int ZEXPORT compress (dest, destLen, source, sourceLen) +int ZEXPORT compress(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -78,7 +78,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ -uLong ZEXPORT compressBound (sourceLen) +uLong ZEXPORT compressBound(sourceLen) uLong sourceLen; { return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + diff --git a/src/mono/mono/zlib/crc32.c b/src/mono/mono/zlib/crc32.c index aa6b63c8d57231..f8357b083f7636 100644 --- a/src/mono/mono/zlib/crc32.c +++ b/src/mono/mono/zlib/crc32.c @@ -1,12 +1,10 @@ /* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + * This interleaved implementation of a CRC makes use of pipelined multiple + * arithmetic-logic units, commonly found in modern CPU cores. It is due to + * Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution. */ /* @(#) $Id$ */ @@ -14,11 +12,12 @@ /* Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore protection on the static variables used to control the first-use generation - of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should first call get_crc_table() to initialize the tables before allowing more than one thread to use crc32(). - DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. + MAKECRCH can be #defined to write out crc32.h. A main() routine is also + produced, so that this one source file can be compiled to an executable. */ #ifdef MAKECRCH @@ -28,415 +27,1099 @@ # endif /* !DYNAMIC_CRC_TABLE */ #endif /* MAKECRCH */ -#include "zutil.h" /* for STDC and FAR definitions */ +#include "zutil.h" /* for Z_U4, Z_U8, z_crc_t, and FAR definitions */ -/* Definitions for doing the crc four data bytes at a time. */ -#if !defined(NOBYFOUR) && defined(Z_U4) -# define BYFOUR + /* + A CRC of a message is computed on N braids of words in the message, where + each word consists of W bytes (4 or 8). If N is 3, for example, then three + running sparse CRCs are calculated respectively on each braid, at these + indices in the array of words: 0, 3, 6, ..., 1, 4, 7, ..., and 2, 5, 8, ... + This is done starting at a word boundary, and continues until as many blocks + of N * W bytes as are available have been processed. The results are combined + into a single CRC at the end. For this code, N must be in the range 1..6 and + W must be 4 or 8. The upper limit on N can be increased if desired by adding + more #if blocks, extending the patterns apparent in the code. In addition, + crc32.h would need to be regenerated, if the maximum N value is increased. + + N and W are chosen empirically by benchmarking the execution time on a given + processor. The choices for N and W below were based on testing on Intel Kaby + Lake i7, AMD Ryzen 7, ARM Cortex-A57, Sparc64-VII, PowerPC POWER9, and MIPS64 + Octeon II processors. The Intel, AMD, and ARM processors were all fastest + with N=5, W=8. The Sparc, PowerPC, and MIPS64 were all fastest at N=5, W=4. + They were all tested with either gcc or clang, all using the -O3 optimization + level. Your mileage may vary. + */ + +/* Define N */ +#ifdef Z_TESTN +# define N Z_TESTN +#else +# define N 5 +#endif +#if N < 1 || N > 6 +# error N must be in 1..6 #endif -#ifdef BYFOUR - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, z_size_t)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, z_size_t)); -# define TBLS 8 + +/* + z_crc_t must be at least 32 bits. z_word_t must be at least as long as + z_crc_t. It is assumed here that z_word_t is either 32 bits or 64 bits, and + that bytes are eight bits. + */ + +/* + Define W and the associated z_word_t type. If W is not defined, then a + braided calculation is not used, and the associated tables and code are not + compiled. + */ +#ifdef Z_TESTW +# if Z_TESTW-1 != -1 +# define W Z_TESTW +# endif #else -# define TBLS 1 -#endif /* BYFOUR */ +# ifdef MAKECRCH +# define W 8 /* required for MAKECRCH */ +# else +# if defined(__x86_64__) || defined(__aarch64__) +# define W 8 +# else +# define W 4 +# endif +# endif +#endif +#ifdef W +# if W == 8 && defined(Z_U8) + typedef Z_U8 z_word_t; +# elif defined(Z_U4) +# undef W +# define W 4 + typedef Z_U4 z_word_t; +# else +# undef W +# endif +#endif + +/* If available, use the ARM processor CRC32 instruction. */ +#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 +# define ARMCRC32 +#endif + +/* Local functions. */ +local z_crc_t multmodp OF((z_crc_t a, z_crc_t b)); +local z_crc_t x2nmodp OF((z_off64_t n, unsigned k)); + +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) + local z_word_t byte_swap OF((z_word_t word)); +#endif + +#if defined(W) && !defined(ARMCRC32) + local z_crc_t crc_word OF((z_word_t data)); + local z_word_t crc_word_big OF((z_word_t data)); +#endif -/* Local functions for crc concatenation */ -local unsigned long gf2_matrix_times OF((unsigned long *mat, - unsigned long vec)); -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); -local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) +/* + Swap the bytes in a z_word_t to convert between little and big endian. Any + self-respecting compiler will optimize this to a single machine byte-swap + instruction, if one is available. This assumes that word_t is either 32 bits + or 64 bits. + */ +local z_word_t byte_swap(word) + z_word_t word; +{ +# if W == 8 + return + (word & 0xff00000000000000) >> 56 | + (word & 0xff000000000000) >> 40 | + (word & 0xff0000000000) >> 24 | + (word & 0xff00000000) >> 8 | + (word & 0xff000000) << 8 | + (word & 0xff0000) << 24 | + (word & 0xff00) << 40 | + (word & 0xff) << 56; +# else /* W == 4 */ + return + (word & 0xff000000) >> 24 | + (word & 0xff0000) >> 8 | + (word & 0xff00) << 8 | + (word & 0xff) << 24; +# endif +} +#endif +/* CRC polynomial. */ +#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */ #ifdef DYNAMIC_CRC_TABLE -local volatile int crc_table_empty = 1; -local z_crc_t FAR crc_table[TBLS][256]; +local z_crc_t FAR crc_table[256]; +local z_crc_t FAR x2n_table[32]; local void make_crc_table OF((void)); +#ifdef W + local z_word_t FAR crc_big_table[256]; + local z_crc_t FAR crc_braid_table[W][256]; + local z_word_t FAR crc_braid_big_table[W][256]; + local void braid OF((z_crc_t [][256], z_word_t [][256], int, int)); +#endif #ifdef MAKECRCH - local void write_table OF((FILE *, const z_crc_t FAR *)); + local void write_table OF((FILE *, const z_crc_t FAR *, int)); + local void write_table32hi OF((FILE *, const z_word_t FAR *, int)); + local void write_table64 OF((FILE *, const z_word_t FAR *, int)); #endif /* MAKECRCH */ + +/* + Define a once() function depending on the availability of atomics. If this is + compiled with DYNAMIC_CRC_TABLE defined, and if CRCs will be computed in + multiple threads, and if atomics are not available, then get_crc_table() must + be called to initialize the tables and must return before any threads are + allowed to compute or combine CRCs. + */ + +/* Definition of once functionality. */ +typedef struct once_s once_t; +local void once OF((once_t *, void (*)(void))); + +/* Check for the availability of atomics. */ +#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \ + !defined(__STDC_NO_ATOMICS__) + +#include + +/* Structure for once(), which must be initialized with ONCE_INIT. */ +struct once_s { + atomic_flag begun; + atomic_int done; +}; +#define ONCE_INIT {ATOMIC_FLAG_INIT, 0} + +/* + Run the provided init() function exactly once, even if multiple threads + invoke once() at the same time. The state must be a once_t initialized with + ONCE_INIT. + */ +local void once(state, init) + once_t *state; + void (*init)(void); +{ + if (!atomic_load(&state->done)) { + if (atomic_flag_test_and_set(&state->begun)) + while (!atomic_load(&state->done)) + ; + else { + init(); + atomic_store(&state->done, 1); + } + } +} + +#else /* no atomics */ + +/* Structure for once(), which must be initialized with ONCE_INIT. */ +struct once_s { + volatile int begun; + volatile int done; +}; +#define ONCE_INIT {0, 0} + +/* Test and set. Alas, not atomic, but tries to minimize the period of + vulnerability. */ +local int test_and_set OF((int volatile *)); +local int test_and_set(flag) + int volatile *flag; +{ + int was; + + was = *flag; + *flag = 1; + return was; +} + +/* Run the provided init() function once. This is not thread-safe. */ +local void once(state, init) + once_t *state; + void (*init)(void); +{ + if (!state->done) { + if (test_and_set(&state->begun)) + while (!state->done) + ; + else { + init(); + state->done = 1; + } + } +} + +#endif + +/* State for once(). */ +local once_t made = ONCE_INIT; + /* Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials + with the lowest powers in the most significant bit. Then adding polynomials is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the + one. If we call the above polynomial p, and represent a byte as the polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + byte 0xb1 is the polynomial x^7+x^3+x^2+1), then the CRC is (q*x^32) mod p, where a mod b means the remainder after dividing a by b. This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each + taking the remainder. The register is initialized to zero, and for each incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x + (which is shifting right by one and adding x^32 mod p if the bit shifted out + is a one). We start with the highest power (least significant bit) of q and + repeat for all eight bits of q. + + The table is simply the CRC of all possible eight bit values. This is all the + information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. + */ + local void make_crc_table() { - z_crc_t c; - int n, k; - z_crc_t poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static volatile int first = 1; /* flag to limit concurrent making */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* See if another task is already doing this (not thread-safe, but better - than nothing -- significantly reduces duration of vulnerability in - case the advice about DYNAMIC_CRC_TABLE is ignored) */ - if (first) { - first = 0; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0; - for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) - poly |= (z_crc_t)1 << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (z_crc_t)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = ZSWAP32(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = ZSWAP32(c); - } - } -#endif /* BYFOUR */ + unsigned i, j, n; + z_crc_t p; - crc_table_empty = 0; - } - else { /* not first */ - /* wait for the other guy to finish (not efficient, but rare) */ - while (crc_table_empty) - ; + /* initialize the CRC of bytes tables */ + for (i = 0; i < 256; i++) { + p = i; + for (j = 0; j < 8; j++) + p = p & 1 ? (p >> 1) ^ POLY : p >> 1; + crc_table[i] = p; +#ifdef W + crc_big_table[i] = byte_swap(p); +#endif } + /* initialize the x^2^n mod p(x) table */ + p = (z_crc_t)1 << 30; /* x^1 */ + x2n_table[0] = p; + for (n = 1; n < 32; n++) + x2n_table[n] = p = multmodp(p, p); + +#ifdef W + /* initialize the braiding tables -- needs x2n_table[] */ + braid(crc_braid_table, crc_braid_big_table, N, W); +#endif + #ifdef MAKECRCH - /* write out CRC tables to crc32.h */ { + /* + The crc32.h header file contains tables for both 32-bit and 64-bit + z_word_t's, and so requires a 64-bit type be available. In that case, + z_word_t must be defined to be 64-bits. This code then also generates + and writes out the tables for the case that z_word_t is 32 bits. + */ +#if !defined(W) || W != 8 +# error Need a 64-bit integer type in order to generate crc32.h. +#endif FILE *out; + int k, n; + z_crc_t ltl[8][256]; + z_word_t big[8][256]; out = fopen("crc32.h", "w"); if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const z_crc_t FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); + + /* write out little-endian CRC table to crc32.h */ + fprintf(out, + "/* crc32.h -- tables for rapid CRC calculation\n" + " * Generated automatically by crc32.c\n */\n" + "\n" + "local const z_crc_t FAR crc_table[] = {\n" + " "); + write_table(out, crc_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#ifdef W\n" + "\n" + "#if W == 8\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table64(out, crc_big_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table32hi(out, crc_big_table, 256); + fprintf(out, + "};\n" + "\n" + "#endif\n"); + + /* write out braid tables for each value of N */ + for (n = 1; n <= 6; n++) { + fprintf(out, + "\n" + "#if N == %d\n", n); + + /* compute braid tables for this N and 64-bit word_t */ + braid(ltl, big, n, 8); + + /* write out braid tables for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#if W == 8\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table64(out, big[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n"); + + /* compute braid tables for this N and 32-bit word_t */ + braid(ltl, big, n, 4); + + /* write out braid tables for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table32hi(out, big[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "#endif\n" + "\n" + "#endif\n"); } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); + fprintf(out, + "\n" + "#endif\n"); + + /* write out zeros operator table to crc32.h */ + fprintf(out, + "\n" + "local const z_crc_t FAR x2n_table[] = {\n" + " "); + write_table(out, x2n_table, 32); + fprintf(out, + "};\n"); fclose(out); } #endif /* MAKECRCH */ } #ifdef MAKECRCH -local void write_table(out, table) + +/* + Write the 32-bit values in table[0..k-1] to out, five per line in + hexadecimal separated by commas. + */ +local void write_table(out, table, k) FILE *out; const z_crc_t FAR *table; + int k; { int n; - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", (unsigned long)(table[n]), - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); +} + +/* + Write the high 32-bits of each value in table[0..k-1] to out, five per line + in hexadecimal separated by commas. + */ +local void write_table32hi(out, table, k) +FILE *out; +const z_word_t FAR *table; +int k; +{ + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", + (unsigned long)(table[n] >> 32), + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); +} + +/* + Write the 64-bit values in table[0..k-1] to out, three per line in + hexadecimal separated by commas. This assumes that if there is a 64-bit + type, then there is also a long long integer type, and it is at least 64 + bits. If not, then the type cast and format string can be adjusted + accordingly. + */ +local void write_table64(out, table, k) + FILE *out; + const z_word_t FAR *table; + int k; +{ + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%016llx%s", n == 0 || n % 3 ? "" : " ", + (unsigned long long)(table[n]), + n == k - 1 ? "" : (n % 3 == 2 ? ",\n" : ", ")); } + +/* Actually do the deed. */ +int main() +{ + make_crc_table(); + return 0; +} + #endif /* MAKECRCH */ +#ifdef W +/* + Generate the little and big-endian braid tables for the given n and z_word_t + size w. Each array must have room for w blocks of 256 elements. + */ +local void braid(ltl, big, n, w) + z_crc_t ltl[][256]; + z_word_t big[][256]; + int n; + int w; +{ + int k; + z_crc_t i, p, q; + for (k = 0; k < w; k++) { + p = x2nmodp((n * w + 3 - k) << 3, 0); + ltl[k][0] = 0; + big[w - 1 - k][0] = 0; + for (i = 1; i < 256; i++) { + ltl[k][i] = q = multmodp(i << 24, p); + big[w - 1 - k][i] = byte_swap(q); + } + } +} +#endif + #else /* !DYNAMIC_CRC_TABLE */ /* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + * Tables for byte-wise and braided CRC-32 calculations, and a table of powers + * of x for combining CRC-32s, all made by make_crc_table(). */ #include "crc32.h" #endif /* DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Routines used for CRC calculation. Some are also required for the table + * generation above. + */ + +/* + Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, + reflected. For speed, this requires that a not be zero. + */ +local z_crc_t multmodp(a, b) + z_crc_t a; + z_crc_t b; +{ + z_crc_t m, p; + + m = (z_crc_t)1 << 31; + p = 0; + for (;;) { + if (a & m) { + p ^= b; + if ((a & (m - 1)) == 0) + break; + } + m >>= 1; + b = b & 1 ? (b >> 1) ^ POLY : b >> 1; + } + return p; +} + +/* + Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been + initialized. + */ +local z_crc_t x2nmodp(n, k) + z_off64_t n; + unsigned k; +{ + z_crc_t p; + + p = (z_crc_t)1 << 31; /* x^0 == 1 */ + while (n) { + if (n & 1) + p = multmodp(x2n_table[k & 31], p); + n >>= 1; + k++; + } + return p; +} + /* ========================================================================= - * This function can be used by asm versions of crc32() + * This function can be used by asm versions of crc32(), and to force the + * generation of the CRC tables in a threaded application. */ const z_crc_t FAR * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); + once(&made, make_crc_table); #endif /* DYNAMIC_CRC_TABLE */ return (const z_crc_t FAR *)crc_table; } -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 +/* ========================================================================= + * Use ARM machine instructions if available. This will compute the CRC about + * ten times faster than the braided calculation. This code does not check for + * the presence of the CRC instruction at run time. __ARM_FEATURE_CRC32 will + * only be defined if the compilation specifies an ARM processor architecture + * that has the instructions. For example, compiling with -march=armv8.1-a or + * -march=armv8-a+crc, or -march=native if the compile machine has the crc32 + * instructions. + */ +#ifdef ARMCRC32 + +/* + Constants empirically determined to maximize speed. These values are from + measurements on a Cortex-A57. Your mileage may vary. + */ +#define Z_BATCH 3990 /* number of words in a batch */ +#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */ +#define Z_BATCH_MIN 800 /* fewest words in a final batch */ -/* ========================================================================= */ unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; z_size_t len; { - if (buf == Z_NULL) return 0UL; + z_crc_t val; + z_word_t crc1, crc2; + const z_word_t *word; + z_word_t val0, val1, val2; + z_size_t last, last2, i; + z_size_t num; + + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; #ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); + once(&made, make_crc_table); #endif /* DYNAMIC_CRC_TABLE */ -#ifdef BYFOUR - if (sizeof(void *) == sizeof(ptrdiff_t)) { - z_crc_t endian; + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); + /* Compute the CRC up to a word boundary. */ + while (len && ((z_size_t)buf & 7) != 0) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; - while (len >= 8) { - DO8; - len -= 8; + + /* Prepare to compute the CRC on full 64-bit words word[0..num-1]. */ + word = (z_word_t const *)buf; + num = len >> 3; + len &= 7; + + /* Do three interleaved CRCs to realize the throughput of one crc32x + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ + while (num >= 3 * Z_BATCH) { + crc1 = 0; + crc2 = 0; + for (i = 0; i < Z_BATCH; i++) { + val0 = word[i]; + val1 = word[i + Z_BATCH]; + val2 = word[i + 2 * Z_BATCH]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * Z_BATCH; + num -= 3 * Z_BATCH; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc1; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc2; } - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - uInt len; -{ - return crc32_z(crc, buf, len); + /* Do one last smaller batch with the remaining words, if there are enough + to pay for the combination of CRCs. */ + last = num / 3; + if (last >= Z_BATCH_MIN) { + last2 = last << 1; + crc1 = 0; + crc2 = 0; + for (i = 0; i < last; i++) { + val0 = word[i]; + val1 = word[i + last]; + val2 = word[i + last2]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * last; + num -= 3 * last; + val = x2nmodp(last, 6); + crc = multmodp(val, crc) ^ crc1; + crc = multmodp(val, crc) ^ crc2; + } + + /* Compute the CRC on any remaining words. */ + for (i = 0; i < num; i++) { + val0 = word[i]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + } + word += num; + + /* Complete the CRC on any remaining bytes. */ + buf = (const unsigned char FAR *)word; + while (len) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); + } + + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; } -#ifdef BYFOUR +#else + +#ifdef W /* - This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit - integer pointer type. This violates the strict aliasing rule, where a - compiler can assume, for optimization purposes, that two pointers to - fundamentally different types won't ever point to the same memory. This can - manifest as a problem only if one of the pointers is written to. This code - only reads from those pointers. So long as this code remains isolated in - this compilation unit, there won't be a problem. For this reason, this code - should not be copied and pasted into a compilation unit in which other code - writes to the buffer that is passed to these routines. + Return the CRC of the W bytes in the word_t data, taking the + least-significant byte of the word as the first byte of data, without any pre + or post conditioning. This is used to combine the CRCs of each braid. */ +local z_crc_t crc_word(data) + z_word_t data; +{ + int k; + for (k = 0; k < W; k++) + data = (data >> 8) ^ crc_table[data & 0xff]; + return (z_crc_t)data; +} -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 +local z_word_t crc_word_big(data) + z_word_t data; +{ + int k; + for (k = 0; k < W; k++) + data = (data << 8) ^ + crc_big_table[(data >> ((W - 1) << 3)) & 0xff]; + return data; +} + +#endif /* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) +unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; z_size_t len; { - register z_crc_t c; - register const z_crc_t FAR *buf4; + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; - c = (z_crc_t)crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOLIT32; - len -= 32; - } - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} +#ifdef W -/* ========================================================================= */ -#define DOBIG4 c ^= *buf4++; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + /* If provided enough bytes, do a braided CRC calculation. */ + if (len >= N * W + W - 1) { + z_size_t blks; + z_word_t const *words; + unsigned endian; + int k; -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; + /* Compute the CRC up to a z_word_t boundary. */ + while (len && ((z_size_t)buf & (W - 1)) != 0) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + } - c = ZSWAP32((z_crc_t)crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; + /* Compute the CRC on as many N z_word_t blocks as are available. */ + blks = len / (N * W); + len -= blks * N * W; + words = (z_word_t const *)buf; + + /* Do endian check at execution time instead of compile time, since ARM + processors can change the endianess at execution time. If the + compiler knows what the endianess will be, it can optimize out the + check and the unused branch. */ + endian = 1; + if (*(unsigned char *)&endian) { + /* Little endian. */ + + z_crc_t crc0; + z_word_t word0; +#if N > 1 + z_crc_t crc1; + z_word_t word1; +#if N > 2 + z_crc_t crc2; + z_word_t word2; +#if N > 3 + z_crc_t crc3; + z_word_t word3; +#if N > 4 + z_crc_t crc4; + z_word_t word4; +#if N > 5 + z_crc_t crc5; + z_word_t word5; +#endif +#endif +#endif +#endif +#endif + + /* Initialize the CRC for each braid. */ + crc0 = crc; +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif + + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + crc = crc_word(crc0 ^ words[0]); +#if N > 1 + crc = crc_word(crc1 ^ words[1] ^ crc); +#if N > 2 + crc = crc_word(crc2 ^ words[2] ^ crc); +#if N > 3 + crc = crc_word(crc3 ^ words[3] ^ crc); +#if N > 4 + crc = crc_word(crc4 ^ words[4] ^ crc); +#if N > 5 + crc = crc_word(crc5 ^ words[5] ^ crc); +#endif +#endif +#endif +#endif +#endif + words += N; + } + else { + /* Big endian. */ + + z_word_t crc0, word0, comb; +#if N > 1 + z_word_t crc1, word1; +#if N > 2 + z_word_t crc2, word2; +#if N > 3 + z_word_t crc3, word3; +#if N > 4 + z_word_t crc4, word4; +#if N > 5 + z_word_t crc5, word5; +#endif +#endif +#endif +#endif +#endif + + /* Initialize the CRC for each braid. */ + crc0 = byte_swap(crc); +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif + + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_big_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_big_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_big_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_big_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_big_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_big_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_big_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_big_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_big_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_big_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_big_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_big_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + comb = crc_word_big(crc0 ^ words[0]); +#if N > 1 + comb = crc_word_big(crc1 ^ words[1] ^ comb); +#if N > 2 + comb = crc_word_big(crc2 ^ words[2] ^ comb); +#if N > 3 + comb = crc_word_big(crc3 ^ words[3] ^ comb); +#if N > 4 + comb = crc_word_big(crc4 ^ words[4] ^ comb); +#if N > 5 + comb = crc_word_big(crc5 ^ words[5] ^ comb); +#endif +#endif +#endif +#endif +#endif + words += N; + crc = byte_swap(comb); + } + + /* + Update the pointer to the remaining bytes to process. + */ + buf = (unsigned char const *)words; } - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOBIG32; - len -= 32; +#endif /* W */ + + /* Complete the computation of the CRC on any remaining bytes. */ + while (len >= 8) { + len -= 8; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; } - while (len >= 4) { - DOBIG4; - len -= 4; + while (len) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; } - buf = (const unsigned char FAR *)buf4; - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(ZSWAP32(c)); + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; } -#endif /* BYFOUR */ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ +#endif /* ========================================================================= */ -local unsigned long gf2_matrix_times(mat, vec) - unsigned long *mat; - unsigned long vec; +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; { - unsigned long sum; - - sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; + return crc32_z(crc, buf, len); } /* ========================================================================= */ -local void gf2_matrix_square(square, mat) - unsigned long *square; - unsigned long *mat; +uLong ZEXPORT crc32_combine64(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; { - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff); } /* ========================================================================= */ -local uLong crc32_combine_(crc1, crc2, len2) +uLong ZEXPORT crc32_combine(crc1, crc2, len2) uLong crc1; uLong crc2; - z_off64_t len2; + z_off_t len2; { - int n; - unsigned long row; - unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ - unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ - - /* degenerate case (also disallow negative lengths) */ - if (len2 <= 0) - return crc1; - - /* put operator for one zero bit in odd */ - odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ - row = 1; - for (n = 1; n < GF2_DIM; n++) { - odd[n] = row; - row <<= 1; - } + return crc32_combine64(crc1, crc2, (z_off64_t)len2); +} - /* put operator for two zero bits in even */ - gf2_matrix_square(even, odd); - - /* put operator for four zero bits in odd */ - gf2_matrix_square(odd, even); - - /* apply len2 zeros to crc1 (first square will put the operator for one - zero byte, eight zero bits, in even) */ - do { - /* apply zeros operator for this bit of len2 */ - gf2_matrix_square(even, odd); - if (len2 & 1) - crc1 = gf2_matrix_times(even, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - if (len2 == 0) - break; - - /* another iteration of the loop with odd and even swapped */ - gf2_matrix_square(odd, even); - if (len2 & 1) - crc1 = gf2_matrix_times(odd, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - } while (len2 != 0); - - /* return combined crc */ - crc1 ^= crc2; - return crc1; +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_gen64(len2) + z_off64_t len2; +{ +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return x2nmodp(len2, 3); } /* ========================================================================= */ -uLong ZEXPORT crc32_combine(crc1, crc2, len2) - uLong crc1; - uLong crc2; +uLong ZEXPORT crc32_combine_gen(len2) z_off_t len2; { - return crc32_combine_(crc1, crc2, (z_off64_t)len2); + return crc32_combine_gen64((z_off64_t)len2); } -uLong ZEXPORT crc32_combine64(crc1, crc2, len2) +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_op(crc1, crc2, op) uLong crc1; uLong crc2; - z_off64_t len2; + uLong op; { - return crc32_combine_(crc1, crc2, len2); + return multmodp(op, crc1) ^ (crc2 & 0xffffffff); } diff --git a/src/mono/mono/zlib/crc32.h b/src/mono/mono/zlib/crc32.h index 9e0c7781025148..137df68d616c5e 100644 --- a/src/mono/mono/zlib/crc32.h +++ b/src/mono/mono/zlib/crc32.h @@ -2,440 +2,9445 @@ * Generated automatically by crc32.c */ -local const z_crc_t FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL +local const z_crc_t FAR crc_table[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}; + +#ifdef W + +#if W == 8 + +local const z_word_t FAR crc_big_table[] = { + 0x0000000000000000, 0x9630077700000000, 0x2c610eee00000000, + 0xba51099900000000, 0x19c46d0700000000, 0x8ff46a7000000000, + 0x35a563e900000000, 0xa395649e00000000, 0x3288db0e00000000, + 0xa4b8dc7900000000, 0x1ee9d5e000000000, 0x88d9d29700000000, + 0x2b4cb60900000000, 0xbd7cb17e00000000, 0x072db8e700000000, + 0x911dbf9000000000, 0x6410b71d00000000, 0xf220b06a00000000, + 0x4871b9f300000000, 0xde41be8400000000, 0x7dd4da1a00000000, + 0xebe4dd6d00000000, 0x51b5d4f400000000, 0xc785d38300000000, + 0x56986c1300000000, 0xc0a86b6400000000, 0x7af962fd00000000, + 0xecc9658a00000000, 0x4f5c011400000000, 0xd96c066300000000, + 0x633d0ffa00000000, 0xf50d088d00000000, 0xc8206e3b00000000, + 0x5e10694c00000000, 0xe44160d500000000, 0x727167a200000000, + 0xd1e4033c00000000, 0x47d4044b00000000, 0xfd850dd200000000, + 0x6bb50aa500000000, 0xfaa8b53500000000, 0x6c98b24200000000, + 0xd6c9bbdb00000000, 0x40f9bcac00000000, 0xe36cd83200000000, + 0x755cdf4500000000, 0xcf0dd6dc00000000, 0x593dd1ab00000000, + 0xac30d92600000000, 0x3a00de5100000000, 0x8051d7c800000000, + 0x1661d0bf00000000, 0xb5f4b42100000000, 0x23c4b35600000000, + 0x9995bacf00000000, 0x0fa5bdb800000000, 0x9eb8022800000000, + 0x0888055f00000000, 0xb2d90cc600000000, 0x24e90bb100000000, + 0x877c6f2f00000000, 0x114c685800000000, 0xab1d61c100000000, + 0x3d2d66b600000000, 0x9041dc7600000000, 0x0671db0100000000, + 0xbc20d29800000000, 0x2a10d5ef00000000, 0x8985b17100000000, + 0x1fb5b60600000000, 0xa5e4bf9f00000000, 0x33d4b8e800000000, + 0xa2c9077800000000, 0x34f9000f00000000, 0x8ea8099600000000, + 0x18980ee100000000, 0xbb0d6a7f00000000, 0x2d3d6d0800000000, + 0x976c649100000000, 0x015c63e600000000, 0xf4516b6b00000000, + 0x62616c1c00000000, 0xd830658500000000, 0x4e0062f200000000, + 0xed95066c00000000, 0x7ba5011b00000000, 0xc1f4088200000000, + 0x57c40ff500000000, 0xc6d9b06500000000, 0x50e9b71200000000, + 0xeab8be8b00000000, 0x7c88b9fc00000000, 0xdf1ddd6200000000, + 0x492dda1500000000, 0xf37cd38c00000000, 0x654cd4fb00000000, + 0x5861b24d00000000, 0xce51b53a00000000, 0x7400bca300000000, + 0xe230bbd400000000, 0x41a5df4a00000000, 0xd795d83d00000000, + 0x6dc4d1a400000000, 0xfbf4d6d300000000, 0x6ae9694300000000, + 0xfcd96e3400000000, 0x468867ad00000000, 0xd0b860da00000000, + 0x732d044400000000, 0xe51d033300000000, 0x5f4c0aaa00000000, + 0xc97c0ddd00000000, 0x3c71055000000000, 0xaa41022700000000, + 0x10100bbe00000000, 0x86200cc900000000, 0x25b5685700000000, + 0xb3856f2000000000, 0x09d466b900000000, 0x9fe461ce00000000, + 0x0ef9de5e00000000, 0x98c9d92900000000, 0x2298d0b000000000, + 0xb4a8d7c700000000, 0x173db35900000000, 0x810db42e00000000, + 0x3b5cbdb700000000, 0xad6cbac000000000, 0x2083b8ed00000000, + 0xb6b3bf9a00000000, 0x0ce2b60300000000, 0x9ad2b17400000000, + 0x3947d5ea00000000, 0xaf77d29d00000000, 0x1526db0400000000, + 0x8316dc7300000000, 0x120b63e300000000, 0x843b649400000000, + 0x3e6a6d0d00000000, 0xa85a6a7a00000000, 0x0bcf0ee400000000, + 0x9dff099300000000, 0x27ae000a00000000, 0xb19e077d00000000, + 0x44930ff000000000, 0xd2a3088700000000, 0x68f2011e00000000, + 0xfec2066900000000, 0x5d5762f700000000, 0xcb67658000000000, + 0x71366c1900000000, 0xe7066b6e00000000, 0x761bd4fe00000000, + 0xe02bd38900000000, 0x5a7ada1000000000, 0xcc4add6700000000, + 0x6fdfb9f900000000, 0xf9efbe8e00000000, 0x43beb71700000000, + 0xd58eb06000000000, 0xe8a3d6d600000000, 0x7e93d1a100000000, + 0xc4c2d83800000000, 0x52f2df4f00000000, 0xf167bbd100000000, + 0x6757bca600000000, 0xdd06b53f00000000, 0x4b36b24800000000, + 0xda2b0dd800000000, 0x4c1b0aaf00000000, 0xf64a033600000000, + 0x607a044100000000, 0xc3ef60df00000000, 0x55df67a800000000, + 0xef8e6e3100000000, 0x79be694600000000, 0x8cb361cb00000000, + 0x1a8366bc00000000, 0xa0d26f2500000000, 0x36e2685200000000, + 0x95770ccc00000000, 0x03470bbb00000000, 0xb916022200000000, + 0x2f26055500000000, 0xbe3bbac500000000, 0x280bbdb200000000, + 0x925ab42b00000000, 0x046ab35c00000000, 0xa7ffd7c200000000, + 0x31cfd0b500000000, 0x8b9ed92c00000000, 0x1daede5b00000000, + 0xb0c2649b00000000, 0x26f263ec00000000, 0x9ca36a7500000000, + 0x0a936d0200000000, 0xa906099c00000000, 0x3f360eeb00000000, + 0x8567077200000000, 0x1357000500000000, 0x824abf9500000000, + 0x147ab8e200000000, 0xae2bb17b00000000, 0x381bb60c00000000, + 0x9b8ed29200000000, 0x0dbed5e500000000, 0xb7efdc7c00000000, + 0x21dfdb0b00000000, 0xd4d2d38600000000, 0x42e2d4f100000000, + 0xf8b3dd6800000000, 0x6e83da1f00000000, 0xcd16be8100000000, + 0x5b26b9f600000000, 0xe177b06f00000000, 0x7747b71800000000, + 0xe65a088800000000, 0x706a0fff00000000, 0xca3b066600000000, + 0x5c0b011100000000, 0xff9e658f00000000, 0x69ae62f800000000, + 0xd3ff6b6100000000, 0x45cf6c1600000000, 0x78e20aa000000000, + 0xeed20dd700000000, 0x5483044e00000000, 0xc2b3033900000000, + 0x612667a700000000, 0xf71660d000000000, 0x4d47694900000000, + 0xdb776e3e00000000, 0x4a6ad1ae00000000, 0xdc5ad6d900000000, + 0x660bdf4000000000, 0xf03bd83700000000, 0x53aebca900000000, + 0xc59ebbde00000000, 0x7fcfb24700000000, 0xe9ffb53000000000, + 0x1cf2bdbd00000000, 0x8ac2baca00000000, 0x3093b35300000000, + 0xa6a3b42400000000, 0x0536d0ba00000000, 0x9306d7cd00000000, + 0x2957de5400000000, 0xbf67d92300000000, 0x2e7a66b300000000, + 0xb84a61c400000000, 0x021b685d00000000, 0x942b6f2a00000000, + 0x37be0bb400000000, 0xa18e0cc300000000, 0x1bdf055a00000000, + 0x8def022d00000000}; + +#else /* W == 4 */ + +local const z_word_t FAR crc_big_table[] = { + 0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, + 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, + 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, + 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, + 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, + 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, + 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, + 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, + 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, + 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, + 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, + 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, + 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, + 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, + 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, + 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, + 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, + 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, + 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, + 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, + 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, + 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, + 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, + 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, + 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, + 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, + 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, + 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, + 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, + 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, + 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, + 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, + 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, + 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, + 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, + 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, + 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, + 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, + 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, + 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, + 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, + 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, + 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, + 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, + 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, + 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, + 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, + 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, + 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, + 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, + 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, + 0x8def022d}; + +#endif + +#if N == 1 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xccaa009e, 0x4225077d, 0x8e8f07e3, 0x844a0efa, + 0x48e00e64, 0xc66f0987, 0x0ac50919, 0xd3e51bb5, 0x1f4f1b2b, + 0x91c01cc8, 0x5d6a1c56, 0x57af154f, 0x9b0515d1, 0x158a1232, + 0xd92012ac, 0x7cbb312b, 0xb01131b5, 0x3e9e3656, 0xf23436c8, + 0xf8f13fd1, 0x345b3f4f, 0xbad438ac, 0x767e3832, 0xaf5e2a9e, + 0x63f42a00, 0xed7b2de3, 0x21d12d7d, 0x2b142464, 0xe7be24fa, + 0x69312319, 0xa59b2387, 0xf9766256, 0x35dc62c8, 0xbb53652b, + 0x77f965b5, 0x7d3c6cac, 0xb1966c32, 0x3f196bd1, 0xf3b36b4f, + 0x2a9379e3, 0xe639797d, 0x68b67e9e, 0xa41c7e00, 0xaed97719, + 0x62737787, 0xecfc7064, 0x205670fa, 0x85cd537d, 0x496753e3, + 0xc7e85400, 0x0b42549e, 0x01875d87, 0xcd2d5d19, 0x43a25afa, + 0x8f085a64, 0x562848c8, 0x9a824856, 0x140d4fb5, 0xd8a74f2b, + 0xd2624632, 0x1ec846ac, 0x9047414f, 0x5ced41d1, 0x299dc2ed, + 0xe537c273, 0x6bb8c590, 0xa712c50e, 0xadd7cc17, 0x617dcc89, + 0xeff2cb6a, 0x2358cbf4, 0xfa78d958, 0x36d2d9c6, 0xb85dde25, + 0x74f7debb, 0x7e32d7a2, 0xb298d73c, 0x3c17d0df, 0xf0bdd041, + 0x5526f3c6, 0x998cf358, 0x1703f4bb, 0xdba9f425, 0xd16cfd3c, + 0x1dc6fda2, 0x9349fa41, 0x5fe3fadf, 0x86c3e873, 0x4a69e8ed, + 0xc4e6ef0e, 0x084cef90, 0x0289e689, 0xce23e617, 0x40ace1f4, + 0x8c06e16a, 0xd0eba0bb, 0x1c41a025, 0x92cea7c6, 0x5e64a758, + 0x54a1ae41, 0x980baedf, 0x1684a93c, 0xda2ea9a2, 0x030ebb0e, + 0xcfa4bb90, 0x412bbc73, 0x8d81bced, 0x8744b5f4, 0x4beeb56a, + 0xc561b289, 0x09cbb217, 0xac509190, 0x60fa910e, 0xee7596ed, + 0x22df9673, 0x281a9f6a, 0xe4b09ff4, 0x6a3f9817, 0xa6959889, + 0x7fb58a25, 0xb31f8abb, 0x3d908d58, 0xf13a8dc6, 0xfbff84df, + 0x37558441, 0xb9da83a2, 0x7570833c, 0x533b85da, 0x9f918544, + 0x111e82a7, 0xddb48239, 0xd7718b20, 0x1bdb8bbe, 0x95548c5d, + 0x59fe8cc3, 0x80de9e6f, 0x4c749ef1, 0xc2fb9912, 0x0e51998c, + 0x04949095, 0xc83e900b, 0x46b197e8, 0x8a1b9776, 0x2f80b4f1, + 0xe32ab46f, 0x6da5b38c, 0xa10fb312, 0xabcaba0b, 0x6760ba95, + 0xe9efbd76, 0x2545bde8, 0xfc65af44, 0x30cfafda, 0xbe40a839, + 0x72eaa8a7, 0x782fa1be, 0xb485a120, 0x3a0aa6c3, 0xf6a0a65d, + 0xaa4de78c, 0x66e7e712, 0xe868e0f1, 0x24c2e06f, 0x2e07e976, + 0xe2ade9e8, 0x6c22ee0b, 0xa088ee95, 0x79a8fc39, 0xb502fca7, + 0x3b8dfb44, 0xf727fbda, 0xfde2f2c3, 0x3148f25d, 0xbfc7f5be, + 0x736df520, 0xd6f6d6a7, 0x1a5cd639, 0x94d3d1da, 0x5879d144, + 0x52bcd85d, 0x9e16d8c3, 0x1099df20, 0xdc33dfbe, 0x0513cd12, + 0xc9b9cd8c, 0x4736ca6f, 0x8b9ccaf1, 0x8159c3e8, 0x4df3c376, + 0xc37cc495, 0x0fd6c40b, 0x7aa64737, 0xb60c47a9, 0x3883404a, + 0xf42940d4, 0xfeec49cd, 0x32464953, 0xbcc94eb0, 0x70634e2e, + 0xa9435c82, 0x65e95c1c, 0xeb665bff, 0x27cc5b61, 0x2d095278, + 0xe1a352e6, 0x6f2c5505, 0xa386559b, 0x061d761c, 0xcab77682, + 0x44387161, 0x889271ff, 0x825778e6, 0x4efd7878, 0xc0727f9b, + 0x0cd87f05, 0xd5f86da9, 0x19526d37, 0x97dd6ad4, 0x5b776a4a, + 0x51b26353, 0x9d1863cd, 0x1397642e, 0xdf3d64b0, 0x83d02561, + 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, + 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, + 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd, + 0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, + 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, + 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, + 0x264b06e6}, + {0x00000000, 0xa6770bb4, 0x979f1129, 0x31e81a9d, 0xf44f2413, + 0x52382fa7, 0x63d0353a, 0xc5a73e8e, 0x33ef4e67, 0x959845d3, + 0xa4705f4e, 0x020754fa, 0xc7a06a74, 0x61d761c0, 0x503f7b5d, + 0xf64870e9, 0x67de9cce, 0xc1a9977a, 0xf0418de7, 0x56368653, + 0x9391b8dd, 0x35e6b369, 0x040ea9f4, 0xa279a240, 0x5431d2a9, + 0xf246d91d, 0xc3aec380, 0x65d9c834, 0xa07ef6ba, 0x0609fd0e, + 0x37e1e793, 0x9196ec27, 0xcfbd399c, 0x69ca3228, 0x582228b5, + 0xfe552301, 0x3bf21d8f, 0x9d85163b, 0xac6d0ca6, 0x0a1a0712, + 0xfc5277fb, 0x5a257c4f, 0x6bcd66d2, 0xcdba6d66, 0x081d53e8, + 0xae6a585c, 0x9f8242c1, 0x39f54975, 0xa863a552, 0x0e14aee6, + 0x3ffcb47b, 0x998bbfcf, 0x5c2c8141, 0xfa5b8af5, 0xcbb39068, + 0x6dc49bdc, 0x9b8ceb35, 0x3dfbe081, 0x0c13fa1c, 0xaa64f1a8, + 0x6fc3cf26, 0xc9b4c492, 0xf85cde0f, 0x5e2bd5bb, 0x440b7579, + 0xe27c7ecd, 0xd3946450, 0x75e36fe4, 0xb044516a, 0x16335ade, + 0x27db4043, 0x81ac4bf7, 0x77e43b1e, 0xd19330aa, 0xe07b2a37, + 0x460c2183, 0x83ab1f0d, 0x25dc14b9, 0x14340e24, 0xb2430590, + 0x23d5e9b7, 0x85a2e203, 0xb44af89e, 0x123df32a, 0xd79acda4, + 0x71edc610, 0x4005dc8d, 0xe672d739, 0x103aa7d0, 0xb64dac64, + 0x87a5b6f9, 0x21d2bd4d, 0xe47583c3, 0x42028877, 0x73ea92ea, + 0xd59d995e, 0x8bb64ce5, 0x2dc14751, 0x1c295dcc, 0xba5e5678, + 0x7ff968f6, 0xd98e6342, 0xe86679df, 0x4e11726b, 0xb8590282, + 0x1e2e0936, 0x2fc613ab, 0x89b1181f, 0x4c162691, 0xea612d25, + 0xdb8937b8, 0x7dfe3c0c, 0xec68d02b, 0x4a1fdb9f, 0x7bf7c102, + 0xdd80cab6, 0x1827f438, 0xbe50ff8c, 0x8fb8e511, 0x29cfeea5, + 0xdf879e4c, 0x79f095f8, 0x48188f65, 0xee6f84d1, 0x2bc8ba5f, + 0x8dbfb1eb, 0xbc57ab76, 0x1a20a0c2, 0x8816eaf2, 0x2e61e146, + 0x1f89fbdb, 0xb9fef06f, 0x7c59cee1, 0xda2ec555, 0xebc6dfc8, + 0x4db1d47c, 0xbbf9a495, 0x1d8eaf21, 0x2c66b5bc, 0x8a11be08, + 0x4fb68086, 0xe9c18b32, 0xd82991af, 0x7e5e9a1b, 0xefc8763c, + 0x49bf7d88, 0x78576715, 0xde206ca1, 0x1b87522f, 0xbdf0599b, + 0x8c184306, 0x2a6f48b2, 0xdc27385b, 0x7a5033ef, 0x4bb82972, + 0xedcf22c6, 0x28681c48, 0x8e1f17fc, 0xbff70d61, 0x198006d5, + 0x47abd36e, 0xe1dcd8da, 0xd034c247, 0x7643c9f3, 0xb3e4f77d, + 0x1593fcc9, 0x247be654, 0x820cede0, 0x74449d09, 0xd23396bd, + 0xe3db8c20, 0x45ac8794, 0x800bb91a, 0x267cb2ae, 0x1794a833, + 0xb1e3a387, 0x20754fa0, 0x86024414, 0xb7ea5e89, 0x119d553d, + 0xd43a6bb3, 0x724d6007, 0x43a57a9a, 0xe5d2712e, 0x139a01c7, + 0xb5ed0a73, 0x840510ee, 0x22721b5a, 0xe7d525d4, 0x41a22e60, + 0x704a34fd, 0xd63d3f49, 0xcc1d9f8b, 0x6a6a943f, 0x5b828ea2, + 0xfdf58516, 0x3852bb98, 0x9e25b02c, 0xafcdaab1, 0x09baa105, + 0xfff2d1ec, 0x5985da58, 0x686dc0c5, 0xce1acb71, 0x0bbdf5ff, + 0xadcafe4b, 0x9c22e4d6, 0x3a55ef62, 0xabc30345, 0x0db408f1, + 0x3c5c126c, 0x9a2b19d8, 0x5f8c2756, 0xf9fb2ce2, 0xc813367f, + 0x6e643dcb, 0x982c4d22, 0x3e5b4696, 0x0fb35c0b, 0xa9c457bf, + 0x6c636931, 0xca146285, 0xfbfc7818, 0x5d8b73ac, 0x03a0a617, + 0xa5d7ada3, 0x943fb73e, 0x3248bc8a, 0xf7ef8204, 0x519889b0, + 0x6070932d, 0xc6079899, 0x304fe870, 0x9638e3c4, 0xa7d0f959, + 0x01a7f2ed, 0xc400cc63, 0x6277c7d7, 0x539fdd4a, 0xf5e8d6fe, + 0x647e3ad9, 0xc209316d, 0xf3e12bf0, 0x55962044, 0x90311eca, + 0x3646157e, 0x07ae0fe3, 0xa1d90457, 0x579174be, 0xf1e67f0a, + 0xc00e6597, 0x66796e23, 0xa3de50ad, 0x05a95b19, 0x34414184, + 0x92364a30}, + {0x00000000, 0xcb5cd3a5, 0x4dc8a10b, 0x869472ae, 0x9b914216, + 0x50cd91b3, 0xd659e31d, 0x1d0530b8, 0xec53826d, 0x270f51c8, + 0xa19b2366, 0x6ac7f0c3, 0x77c2c07b, 0xbc9e13de, 0x3a0a6170, + 0xf156b2d5, 0x03d6029b, 0xc88ad13e, 0x4e1ea390, 0x85427035, + 0x9847408d, 0x531b9328, 0xd58fe186, 0x1ed33223, 0xef8580f6, + 0x24d95353, 0xa24d21fd, 0x6911f258, 0x7414c2e0, 0xbf481145, + 0x39dc63eb, 0xf280b04e, 0x07ac0536, 0xccf0d693, 0x4a64a43d, + 0x81387798, 0x9c3d4720, 0x57619485, 0xd1f5e62b, 0x1aa9358e, + 0xebff875b, 0x20a354fe, 0xa6372650, 0x6d6bf5f5, 0x706ec54d, + 0xbb3216e8, 0x3da66446, 0xf6fab7e3, 0x047a07ad, 0xcf26d408, + 0x49b2a6a6, 0x82ee7503, 0x9feb45bb, 0x54b7961e, 0xd223e4b0, + 0x197f3715, 0xe82985c0, 0x23755665, 0xa5e124cb, 0x6ebdf76e, + 0x73b8c7d6, 0xb8e41473, 0x3e7066dd, 0xf52cb578, 0x0f580a6c, + 0xc404d9c9, 0x4290ab67, 0x89cc78c2, 0x94c9487a, 0x5f959bdf, + 0xd901e971, 0x125d3ad4, 0xe30b8801, 0x28575ba4, 0xaec3290a, + 0x659ffaaf, 0x789aca17, 0xb3c619b2, 0x35526b1c, 0xfe0eb8b9, + 0x0c8e08f7, 0xc7d2db52, 0x4146a9fc, 0x8a1a7a59, 0x971f4ae1, + 0x5c439944, 0xdad7ebea, 0x118b384f, 0xe0dd8a9a, 0x2b81593f, + 0xad152b91, 0x6649f834, 0x7b4cc88c, 0xb0101b29, 0x36846987, + 0xfdd8ba22, 0x08f40f5a, 0xc3a8dcff, 0x453cae51, 0x8e607df4, + 0x93654d4c, 0x58399ee9, 0xdeadec47, 0x15f13fe2, 0xe4a78d37, + 0x2ffb5e92, 0xa96f2c3c, 0x6233ff99, 0x7f36cf21, 0xb46a1c84, + 0x32fe6e2a, 0xf9a2bd8f, 0x0b220dc1, 0xc07ede64, 0x46eaacca, + 0x8db67f6f, 0x90b34fd7, 0x5bef9c72, 0xdd7beedc, 0x16273d79, + 0xe7718fac, 0x2c2d5c09, 0xaab92ea7, 0x61e5fd02, 0x7ce0cdba, + 0xb7bc1e1f, 0x31286cb1, 0xfa74bf14, 0x1eb014d8, 0xd5ecc77d, + 0x5378b5d3, 0x98246676, 0x852156ce, 0x4e7d856b, 0xc8e9f7c5, + 0x03b52460, 0xf2e396b5, 0x39bf4510, 0xbf2b37be, 0x7477e41b, + 0x6972d4a3, 0xa22e0706, 0x24ba75a8, 0xefe6a60d, 0x1d661643, + 0xd63ac5e6, 0x50aeb748, 0x9bf264ed, 0x86f75455, 0x4dab87f0, + 0xcb3ff55e, 0x006326fb, 0xf135942e, 0x3a69478b, 0xbcfd3525, + 0x77a1e680, 0x6aa4d638, 0xa1f8059d, 0x276c7733, 0xec30a496, + 0x191c11ee, 0xd240c24b, 0x54d4b0e5, 0x9f886340, 0x828d53f8, + 0x49d1805d, 0xcf45f2f3, 0x04192156, 0xf54f9383, 0x3e134026, + 0xb8873288, 0x73dbe12d, 0x6eded195, 0xa5820230, 0x2316709e, + 0xe84aa33b, 0x1aca1375, 0xd196c0d0, 0x5702b27e, 0x9c5e61db, + 0x815b5163, 0x4a0782c6, 0xcc93f068, 0x07cf23cd, 0xf6999118, + 0x3dc542bd, 0xbb513013, 0x700de3b6, 0x6d08d30e, 0xa65400ab, + 0x20c07205, 0xeb9ca1a0, 0x11e81eb4, 0xdab4cd11, 0x5c20bfbf, + 0x977c6c1a, 0x8a795ca2, 0x41258f07, 0xc7b1fda9, 0x0ced2e0c, + 0xfdbb9cd9, 0x36e74f7c, 0xb0733dd2, 0x7b2fee77, 0x662adecf, + 0xad760d6a, 0x2be27fc4, 0xe0beac61, 0x123e1c2f, 0xd962cf8a, + 0x5ff6bd24, 0x94aa6e81, 0x89af5e39, 0x42f38d9c, 0xc467ff32, + 0x0f3b2c97, 0xfe6d9e42, 0x35314de7, 0xb3a53f49, 0x78f9ecec, + 0x65fcdc54, 0xaea00ff1, 0x28347d5f, 0xe368aefa, 0x16441b82, + 0xdd18c827, 0x5b8cba89, 0x90d0692c, 0x8dd55994, 0x46898a31, + 0xc01df89f, 0x0b412b3a, 0xfa1799ef, 0x314b4a4a, 0xb7df38e4, + 0x7c83eb41, 0x6186dbf9, 0xaada085c, 0x2c4e7af2, 0xe712a957, + 0x15921919, 0xdececabc, 0x585ab812, 0x93066bb7, 0x8e035b0f, + 0x455f88aa, 0xc3cbfa04, 0x089729a1, 0xf9c19b74, 0x329d48d1, + 0xb4093a7f, 0x7f55e9da, 0x6250d962, 0xa90c0ac7, 0x2f987869, + 0xe4c4abcc}, + {0x00000000, 0x3d6029b0, 0x7ac05360, 0x47a07ad0, 0xf580a6c0, + 0xc8e08f70, 0x8f40f5a0, 0xb220dc10, 0x30704bc1, 0x0d106271, + 0x4ab018a1, 0x77d03111, 0xc5f0ed01, 0xf890c4b1, 0xbf30be61, + 0x825097d1, 0x60e09782, 0x5d80be32, 0x1a20c4e2, 0x2740ed52, + 0x95603142, 0xa80018f2, 0xefa06222, 0xd2c04b92, 0x5090dc43, + 0x6df0f5f3, 0x2a508f23, 0x1730a693, 0xa5107a83, 0x98705333, + 0xdfd029e3, 0xe2b00053, 0xc1c12f04, 0xfca106b4, 0xbb017c64, + 0x866155d4, 0x344189c4, 0x0921a074, 0x4e81daa4, 0x73e1f314, + 0xf1b164c5, 0xccd14d75, 0x8b7137a5, 0xb6111e15, 0x0431c205, + 0x3951ebb5, 0x7ef19165, 0x4391b8d5, 0xa121b886, 0x9c419136, + 0xdbe1ebe6, 0xe681c256, 0x54a11e46, 0x69c137f6, 0x2e614d26, + 0x13016496, 0x9151f347, 0xac31daf7, 0xeb91a027, 0xd6f18997, + 0x64d15587, 0x59b17c37, 0x1e1106e7, 0x23712f57, 0x58f35849, + 0x659371f9, 0x22330b29, 0x1f532299, 0xad73fe89, 0x9013d739, + 0xd7b3ade9, 0xead38459, 0x68831388, 0x55e33a38, 0x124340e8, + 0x2f236958, 0x9d03b548, 0xa0639cf8, 0xe7c3e628, 0xdaa3cf98, + 0x3813cfcb, 0x0573e67b, 0x42d39cab, 0x7fb3b51b, 0xcd93690b, + 0xf0f340bb, 0xb7533a6b, 0x8a3313db, 0x0863840a, 0x3503adba, + 0x72a3d76a, 0x4fc3feda, 0xfde322ca, 0xc0830b7a, 0x872371aa, + 0xba43581a, 0x9932774d, 0xa4525efd, 0xe3f2242d, 0xde920d9d, + 0x6cb2d18d, 0x51d2f83d, 0x167282ed, 0x2b12ab5d, 0xa9423c8c, + 0x9422153c, 0xd3826fec, 0xeee2465c, 0x5cc29a4c, 0x61a2b3fc, + 0x2602c92c, 0x1b62e09c, 0xf9d2e0cf, 0xc4b2c97f, 0x8312b3af, + 0xbe729a1f, 0x0c52460f, 0x31326fbf, 0x7692156f, 0x4bf23cdf, + 0xc9a2ab0e, 0xf4c282be, 0xb362f86e, 0x8e02d1de, 0x3c220dce, + 0x0142247e, 0x46e25eae, 0x7b82771e, 0xb1e6b092, 0x8c869922, + 0xcb26e3f2, 0xf646ca42, 0x44661652, 0x79063fe2, 0x3ea64532, + 0x03c66c82, 0x8196fb53, 0xbcf6d2e3, 0xfb56a833, 0xc6368183, + 0x74165d93, 0x49767423, 0x0ed60ef3, 0x33b62743, 0xd1062710, + 0xec660ea0, 0xabc67470, 0x96a65dc0, 0x248681d0, 0x19e6a860, + 0x5e46d2b0, 0x6326fb00, 0xe1766cd1, 0xdc164561, 0x9bb63fb1, + 0xa6d61601, 0x14f6ca11, 0x2996e3a1, 0x6e369971, 0x5356b0c1, + 0x70279f96, 0x4d47b626, 0x0ae7ccf6, 0x3787e546, 0x85a73956, + 0xb8c710e6, 0xff676a36, 0xc2074386, 0x4057d457, 0x7d37fde7, + 0x3a978737, 0x07f7ae87, 0xb5d77297, 0x88b75b27, 0xcf1721f7, + 0xf2770847, 0x10c70814, 0x2da721a4, 0x6a075b74, 0x576772c4, + 0xe547aed4, 0xd8278764, 0x9f87fdb4, 0xa2e7d404, 0x20b743d5, + 0x1dd76a65, 0x5a7710b5, 0x67173905, 0xd537e515, 0xe857cca5, + 0xaff7b675, 0x92979fc5, 0xe915e8db, 0xd475c16b, 0x93d5bbbb, + 0xaeb5920b, 0x1c954e1b, 0x21f567ab, 0x66551d7b, 0x5b3534cb, + 0xd965a31a, 0xe4058aaa, 0xa3a5f07a, 0x9ec5d9ca, 0x2ce505da, + 0x11852c6a, 0x562556ba, 0x6b457f0a, 0x89f57f59, 0xb49556e9, + 0xf3352c39, 0xce550589, 0x7c75d999, 0x4115f029, 0x06b58af9, + 0x3bd5a349, 0xb9853498, 0x84e51d28, 0xc34567f8, 0xfe254e48, + 0x4c059258, 0x7165bbe8, 0x36c5c138, 0x0ba5e888, 0x28d4c7df, + 0x15b4ee6f, 0x521494bf, 0x6f74bd0f, 0xdd54611f, 0xe03448af, + 0xa794327f, 0x9af41bcf, 0x18a48c1e, 0x25c4a5ae, 0x6264df7e, + 0x5f04f6ce, 0xed242ade, 0xd044036e, 0x97e479be, 0xaa84500e, + 0x4834505d, 0x755479ed, 0x32f4033d, 0x0f942a8d, 0xbdb4f69d, + 0x80d4df2d, 0xc774a5fd, 0xfa148c4d, 0x78441b9c, 0x4524322c, + 0x028448fc, 0x3fe4614c, 0x8dc4bd5c, 0xb0a494ec, 0xf704ee3c, + 0xca64c78c}, + {0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, + 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, + 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, + 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, + 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, + 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, + 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, + 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, + 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, + 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, + 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, + 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, + 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, + 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, + 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, + 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, + 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, + 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, + 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, + 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, + 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, + 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, + 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, + 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, + 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, + 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, + 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, + 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, + 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, + 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, + 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, + 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, + 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, + 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, + 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, + 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, + 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, + 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, + 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, + 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, + 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, + 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, + 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, + 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, + 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, + 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, + 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, + 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, + 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, + 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, + 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, + 0xde0506f1}, + {0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, + 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, + 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, + 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, + 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, + 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, + 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, + 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, + 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, + 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, + 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, + 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, + 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, + 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, + 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, + 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, + 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, + 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, + 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, + 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, + 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, + 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, + 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, + 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, + 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, + 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, + 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, + 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, + 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, + 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, + 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, + 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, + 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, + 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, + 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, + 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, + 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, + 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, + 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, + 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, + 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, + 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, + 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, + 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, + 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, + 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, + 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, + 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, + 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, + 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, + 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, + 0xbe9834ed}, + {0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, + 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, + 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, + 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, + 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, + 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, + 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, + 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, + 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, + 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, + 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, + 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, + 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, + 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, + 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, + 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, + 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, + 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, + 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, + 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, + 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, + 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, + 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, + 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, + 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, + 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, + 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, + 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, + 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, + 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, + 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, + 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, + 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, + 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, + 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, + 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, + 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, + 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, + 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, + 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, + 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, + 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, + 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, + 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, + 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, + 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, + 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, + 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, + 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, + 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, + 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, + 0x9324fd72}, + {0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x9630077700000000, 0x2c610eee00000000, + 0xba51099900000000, 0x19c46d0700000000, 0x8ff46a7000000000, + 0x35a563e900000000, 0xa395649e00000000, 0x3288db0e00000000, + 0xa4b8dc7900000000, 0x1ee9d5e000000000, 0x88d9d29700000000, + 0x2b4cb60900000000, 0xbd7cb17e00000000, 0x072db8e700000000, + 0x911dbf9000000000, 0x6410b71d00000000, 0xf220b06a00000000, + 0x4871b9f300000000, 0xde41be8400000000, 0x7dd4da1a00000000, + 0xebe4dd6d00000000, 0x51b5d4f400000000, 0xc785d38300000000, + 0x56986c1300000000, 0xc0a86b6400000000, 0x7af962fd00000000, + 0xecc9658a00000000, 0x4f5c011400000000, 0xd96c066300000000, + 0x633d0ffa00000000, 0xf50d088d00000000, 0xc8206e3b00000000, + 0x5e10694c00000000, 0xe44160d500000000, 0x727167a200000000, + 0xd1e4033c00000000, 0x47d4044b00000000, 0xfd850dd200000000, + 0x6bb50aa500000000, 0xfaa8b53500000000, 0x6c98b24200000000, + 0xd6c9bbdb00000000, 0x40f9bcac00000000, 0xe36cd83200000000, + 0x755cdf4500000000, 0xcf0dd6dc00000000, 0x593dd1ab00000000, + 0xac30d92600000000, 0x3a00de5100000000, 0x8051d7c800000000, + 0x1661d0bf00000000, 0xb5f4b42100000000, 0x23c4b35600000000, + 0x9995bacf00000000, 0x0fa5bdb800000000, 0x9eb8022800000000, + 0x0888055f00000000, 0xb2d90cc600000000, 0x24e90bb100000000, + 0x877c6f2f00000000, 0x114c685800000000, 0xab1d61c100000000, + 0x3d2d66b600000000, 0x9041dc7600000000, 0x0671db0100000000, + 0xbc20d29800000000, 0x2a10d5ef00000000, 0x8985b17100000000, + 0x1fb5b60600000000, 0xa5e4bf9f00000000, 0x33d4b8e800000000, + 0xa2c9077800000000, 0x34f9000f00000000, 0x8ea8099600000000, + 0x18980ee100000000, 0xbb0d6a7f00000000, 0x2d3d6d0800000000, + 0x976c649100000000, 0x015c63e600000000, 0xf4516b6b00000000, + 0x62616c1c00000000, 0xd830658500000000, 0x4e0062f200000000, + 0xed95066c00000000, 0x7ba5011b00000000, 0xc1f4088200000000, + 0x57c40ff500000000, 0xc6d9b06500000000, 0x50e9b71200000000, + 0xeab8be8b00000000, 0x7c88b9fc00000000, 0xdf1ddd6200000000, + 0x492dda1500000000, 0xf37cd38c00000000, 0x654cd4fb00000000, + 0x5861b24d00000000, 0xce51b53a00000000, 0x7400bca300000000, + 0xe230bbd400000000, 0x41a5df4a00000000, 0xd795d83d00000000, + 0x6dc4d1a400000000, 0xfbf4d6d300000000, 0x6ae9694300000000, + 0xfcd96e3400000000, 0x468867ad00000000, 0xd0b860da00000000, + 0x732d044400000000, 0xe51d033300000000, 0x5f4c0aaa00000000, + 0xc97c0ddd00000000, 0x3c71055000000000, 0xaa41022700000000, + 0x10100bbe00000000, 0x86200cc900000000, 0x25b5685700000000, + 0xb3856f2000000000, 0x09d466b900000000, 0x9fe461ce00000000, + 0x0ef9de5e00000000, 0x98c9d92900000000, 0x2298d0b000000000, + 0xb4a8d7c700000000, 0x173db35900000000, 0x810db42e00000000, + 0x3b5cbdb700000000, 0xad6cbac000000000, 0x2083b8ed00000000, + 0xb6b3bf9a00000000, 0x0ce2b60300000000, 0x9ad2b17400000000, + 0x3947d5ea00000000, 0xaf77d29d00000000, 0x1526db0400000000, + 0x8316dc7300000000, 0x120b63e300000000, 0x843b649400000000, + 0x3e6a6d0d00000000, 0xa85a6a7a00000000, 0x0bcf0ee400000000, + 0x9dff099300000000, 0x27ae000a00000000, 0xb19e077d00000000, + 0x44930ff000000000, 0xd2a3088700000000, 0x68f2011e00000000, + 0xfec2066900000000, 0x5d5762f700000000, 0xcb67658000000000, + 0x71366c1900000000, 0xe7066b6e00000000, 0x761bd4fe00000000, + 0xe02bd38900000000, 0x5a7ada1000000000, 0xcc4add6700000000, + 0x6fdfb9f900000000, 0xf9efbe8e00000000, 0x43beb71700000000, + 0xd58eb06000000000, 0xe8a3d6d600000000, 0x7e93d1a100000000, + 0xc4c2d83800000000, 0x52f2df4f00000000, 0xf167bbd100000000, + 0x6757bca600000000, 0xdd06b53f00000000, 0x4b36b24800000000, + 0xda2b0dd800000000, 0x4c1b0aaf00000000, 0xf64a033600000000, + 0x607a044100000000, 0xc3ef60df00000000, 0x55df67a800000000, + 0xef8e6e3100000000, 0x79be694600000000, 0x8cb361cb00000000, + 0x1a8366bc00000000, 0xa0d26f2500000000, 0x36e2685200000000, + 0x95770ccc00000000, 0x03470bbb00000000, 0xb916022200000000, + 0x2f26055500000000, 0xbe3bbac500000000, 0x280bbdb200000000, + 0x925ab42b00000000, 0x046ab35c00000000, 0xa7ffd7c200000000, + 0x31cfd0b500000000, 0x8b9ed92c00000000, 0x1daede5b00000000, + 0xb0c2649b00000000, 0x26f263ec00000000, 0x9ca36a7500000000, + 0x0a936d0200000000, 0xa906099c00000000, 0x3f360eeb00000000, + 0x8567077200000000, 0x1357000500000000, 0x824abf9500000000, + 0x147ab8e200000000, 0xae2bb17b00000000, 0x381bb60c00000000, + 0x9b8ed29200000000, 0x0dbed5e500000000, 0xb7efdc7c00000000, + 0x21dfdb0b00000000, 0xd4d2d38600000000, 0x42e2d4f100000000, + 0xf8b3dd6800000000, 0x6e83da1f00000000, 0xcd16be8100000000, + 0x5b26b9f600000000, 0xe177b06f00000000, 0x7747b71800000000, + 0xe65a088800000000, 0x706a0fff00000000, 0xca3b066600000000, + 0x5c0b011100000000, 0xff9e658f00000000, 0x69ae62f800000000, + 0xd3ff6b6100000000, 0x45cf6c1600000000, 0x78e20aa000000000, + 0xeed20dd700000000, 0x5483044e00000000, 0xc2b3033900000000, + 0x612667a700000000, 0xf71660d000000000, 0x4d47694900000000, + 0xdb776e3e00000000, 0x4a6ad1ae00000000, 0xdc5ad6d900000000, + 0x660bdf4000000000, 0xf03bd83700000000, 0x53aebca900000000, + 0xc59ebbde00000000, 0x7fcfb24700000000, 0xe9ffb53000000000, + 0x1cf2bdbd00000000, 0x8ac2baca00000000, 0x3093b35300000000, + 0xa6a3b42400000000, 0x0536d0ba00000000, 0x9306d7cd00000000, + 0x2957de5400000000, 0xbf67d92300000000, 0x2e7a66b300000000, + 0xb84a61c400000000, 0x021b685d00000000, 0x942b6f2a00000000, + 0x37be0bb400000000, 0xa18e0cc300000000, 0x1bdf055a00000000, + 0x8def022d00000000}, + {0x0000000000000000, 0x41311b1900000000, 0x8262363200000000, + 0xc3532d2b00000000, 0x04c56c6400000000, 0x45f4777d00000000, + 0x86a75a5600000000, 0xc796414f00000000, 0x088ad9c800000000, + 0x49bbc2d100000000, 0x8ae8effa00000000, 0xcbd9f4e300000000, + 0x0c4fb5ac00000000, 0x4d7eaeb500000000, 0x8e2d839e00000000, + 0xcf1c988700000000, 0x5112c24a00000000, 0x1023d95300000000, + 0xd370f47800000000, 0x9241ef6100000000, 0x55d7ae2e00000000, + 0x14e6b53700000000, 0xd7b5981c00000000, 0x9684830500000000, + 0x59981b8200000000, 0x18a9009b00000000, 0xdbfa2db000000000, + 0x9acb36a900000000, 0x5d5d77e600000000, 0x1c6c6cff00000000, + 0xdf3f41d400000000, 0x9e0e5acd00000000, 0xa224849500000000, + 0xe3159f8c00000000, 0x2046b2a700000000, 0x6177a9be00000000, + 0xa6e1e8f100000000, 0xe7d0f3e800000000, 0x2483dec300000000, + 0x65b2c5da00000000, 0xaaae5d5d00000000, 0xeb9f464400000000, + 0x28cc6b6f00000000, 0x69fd707600000000, 0xae6b313900000000, + 0xef5a2a2000000000, 0x2c09070b00000000, 0x6d381c1200000000, + 0xf33646df00000000, 0xb2075dc600000000, 0x715470ed00000000, + 0x30656bf400000000, 0xf7f32abb00000000, 0xb6c231a200000000, + 0x75911c8900000000, 0x34a0079000000000, 0xfbbc9f1700000000, + 0xba8d840e00000000, 0x79dea92500000000, 0x38efb23c00000000, + 0xff79f37300000000, 0xbe48e86a00000000, 0x7d1bc54100000000, + 0x3c2ade5800000000, 0x054f79f000000000, 0x447e62e900000000, + 0x872d4fc200000000, 0xc61c54db00000000, 0x018a159400000000, + 0x40bb0e8d00000000, 0x83e823a600000000, 0xc2d938bf00000000, + 0x0dc5a03800000000, 0x4cf4bb2100000000, 0x8fa7960a00000000, + 0xce968d1300000000, 0x0900cc5c00000000, 0x4831d74500000000, + 0x8b62fa6e00000000, 0xca53e17700000000, 0x545dbbba00000000, + 0x156ca0a300000000, 0xd63f8d8800000000, 0x970e969100000000, + 0x5098d7de00000000, 0x11a9ccc700000000, 0xd2fae1ec00000000, + 0x93cbfaf500000000, 0x5cd7627200000000, 0x1de6796b00000000, + 0xdeb5544000000000, 0x9f844f5900000000, 0x58120e1600000000, + 0x1923150f00000000, 0xda70382400000000, 0x9b41233d00000000, + 0xa76bfd6500000000, 0xe65ae67c00000000, 0x2509cb5700000000, + 0x6438d04e00000000, 0xa3ae910100000000, 0xe29f8a1800000000, + 0x21cca73300000000, 0x60fdbc2a00000000, 0xafe124ad00000000, + 0xeed03fb400000000, 0x2d83129f00000000, 0x6cb2098600000000, + 0xab2448c900000000, 0xea1553d000000000, 0x29467efb00000000, + 0x687765e200000000, 0xf6793f2f00000000, 0xb748243600000000, + 0x741b091d00000000, 0x352a120400000000, 0xf2bc534b00000000, + 0xb38d485200000000, 0x70de657900000000, 0x31ef7e6000000000, + 0xfef3e6e700000000, 0xbfc2fdfe00000000, 0x7c91d0d500000000, + 0x3da0cbcc00000000, 0xfa368a8300000000, 0xbb07919a00000000, + 0x7854bcb100000000, 0x3965a7a800000000, 0x4b98833b00000000, + 0x0aa9982200000000, 0xc9fab50900000000, 0x88cbae1000000000, + 0x4f5def5f00000000, 0x0e6cf44600000000, 0xcd3fd96d00000000, + 0x8c0ec27400000000, 0x43125af300000000, 0x022341ea00000000, + 0xc1706cc100000000, 0x804177d800000000, 0x47d7369700000000, + 0x06e62d8e00000000, 0xc5b500a500000000, 0x84841bbc00000000, + 0x1a8a417100000000, 0x5bbb5a6800000000, 0x98e8774300000000, + 0xd9d96c5a00000000, 0x1e4f2d1500000000, 0x5f7e360c00000000, + 0x9c2d1b2700000000, 0xdd1c003e00000000, 0x120098b900000000, + 0x533183a000000000, 0x9062ae8b00000000, 0xd153b59200000000, + 0x16c5f4dd00000000, 0x57f4efc400000000, 0x94a7c2ef00000000, + 0xd596d9f600000000, 0xe9bc07ae00000000, 0xa88d1cb700000000, + 0x6bde319c00000000, 0x2aef2a8500000000, 0xed796bca00000000, + 0xac4870d300000000, 0x6f1b5df800000000, 0x2e2a46e100000000, + 0xe136de6600000000, 0xa007c57f00000000, 0x6354e85400000000, + 0x2265f34d00000000, 0xe5f3b20200000000, 0xa4c2a91b00000000, + 0x6791843000000000, 0x26a09f2900000000, 0xb8aec5e400000000, + 0xf99fdefd00000000, 0x3accf3d600000000, 0x7bfde8cf00000000, + 0xbc6ba98000000000, 0xfd5ab29900000000, 0x3e099fb200000000, + 0x7f3884ab00000000, 0xb0241c2c00000000, 0xf115073500000000, + 0x32462a1e00000000, 0x7377310700000000, 0xb4e1704800000000, + 0xf5d06b5100000000, 0x3683467a00000000, 0x77b25d6300000000, + 0x4ed7facb00000000, 0x0fe6e1d200000000, 0xccb5ccf900000000, + 0x8d84d7e000000000, 0x4a1296af00000000, 0x0b238db600000000, + 0xc870a09d00000000, 0x8941bb8400000000, 0x465d230300000000, + 0x076c381a00000000, 0xc43f153100000000, 0x850e0e2800000000, + 0x42984f6700000000, 0x03a9547e00000000, 0xc0fa795500000000, + 0x81cb624c00000000, 0x1fc5388100000000, 0x5ef4239800000000, + 0x9da70eb300000000, 0xdc9615aa00000000, 0x1b0054e500000000, + 0x5a314ffc00000000, 0x996262d700000000, 0xd85379ce00000000, + 0x174fe14900000000, 0x567efa5000000000, 0x952dd77b00000000, + 0xd41ccc6200000000, 0x138a8d2d00000000, 0x52bb963400000000, + 0x91e8bb1f00000000, 0xd0d9a00600000000, 0xecf37e5e00000000, + 0xadc2654700000000, 0x6e91486c00000000, 0x2fa0537500000000, + 0xe836123a00000000, 0xa907092300000000, 0x6a54240800000000, + 0x2b653f1100000000, 0xe479a79600000000, 0xa548bc8f00000000, + 0x661b91a400000000, 0x272a8abd00000000, 0xe0bccbf200000000, + 0xa18dd0eb00000000, 0x62defdc000000000, 0x23efe6d900000000, + 0xbde1bc1400000000, 0xfcd0a70d00000000, 0x3f838a2600000000, + 0x7eb2913f00000000, 0xb924d07000000000, 0xf815cb6900000000, + 0x3b46e64200000000, 0x7a77fd5b00000000, 0xb56b65dc00000000, + 0xf45a7ec500000000, 0x370953ee00000000, 0x763848f700000000, + 0xb1ae09b800000000, 0xf09f12a100000000, 0x33cc3f8a00000000, + 0x72fd249300000000}, + {0x0000000000000000, 0x376ac20100000000, 0x6ed4840300000000, + 0x59be460200000000, 0xdca8090700000000, 0xebc2cb0600000000, + 0xb27c8d0400000000, 0x85164f0500000000, 0xb851130e00000000, + 0x8f3bd10f00000000, 0xd685970d00000000, 0xe1ef550c00000000, + 0x64f91a0900000000, 0x5393d80800000000, 0x0a2d9e0a00000000, + 0x3d475c0b00000000, 0x70a3261c00000000, 0x47c9e41d00000000, + 0x1e77a21f00000000, 0x291d601e00000000, 0xac0b2f1b00000000, + 0x9b61ed1a00000000, 0xc2dfab1800000000, 0xf5b5691900000000, + 0xc8f2351200000000, 0xff98f71300000000, 0xa626b11100000000, + 0x914c731000000000, 0x145a3c1500000000, 0x2330fe1400000000, + 0x7a8eb81600000000, 0x4de47a1700000000, 0xe0464d3800000000, + 0xd72c8f3900000000, 0x8e92c93b00000000, 0xb9f80b3a00000000, + 0x3cee443f00000000, 0x0b84863e00000000, 0x523ac03c00000000, + 0x6550023d00000000, 0x58175e3600000000, 0x6f7d9c3700000000, + 0x36c3da3500000000, 0x01a9183400000000, 0x84bf573100000000, + 0xb3d5953000000000, 0xea6bd33200000000, 0xdd01113300000000, + 0x90e56b2400000000, 0xa78fa92500000000, 0xfe31ef2700000000, + 0xc95b2d2600000000, 0x4c4d622300000000, 0x7b27a02200000000, + 0x2299e62000000000, 0x15f3242100000000, 0x28b4782a00000000, + 0x1fdeba2b00000000, 0x4660fc2900000000, 0x710a3e2800000000, + 0xf41c712d00000000, 0xc376b32c00000000, 0x9ac8f52e00000000, + 0xada2372f00000000, 0xc08d9a7000000000, 0xf7e7587100000000, + 0xae591e7300000000, 0x9933dc7200000000, 0x1c25937700000000, + 0x2b4f517600000000, 0x72f1177400000000, 0x459bd57500000000, + 0x78dc897e00000000, 0x4fb64b7f00000000, 0x16080d7d00000000, + 0x2162cf7c00000000, 0xa474807900000000, 0x931e427800000000, + 0xcaa0047a00000000, 0xfdcac67b00000000, 0xb02ebc6c00000000, + 0x87447e6d00000000, 0xdefa386f00000000, 0xe990fa6e00000000, + 0x6c86b56b00000000, 0x5bec776a00000000, 0x0252316800000000, + 0x3538f36900000000, 0x087faf6200000000, 0x3f156d6300000000, + 0x66ab2b6100000000, 0x51c1e96000000000, 0xd4d7a66500000000, + 0xe3bd646400000000, 0xba03226600000000, 0x8d69e06700000000, + 0x20cbd74800000000, 0x17a1154900000000, 0x4e1f534b00000000, + 0x7975914a00000000, 0xfc63de4f00000000, 0xcb091c4e00000000, + 0x92b75a4c00000000, 0xa5dd984d00000000, 0x989ac44600000000, + 0xaff0064700000000, 0xf64e404500000000, 0xc124824400000000, + 0x4432cd4100000000, 0x73580f4000000000, 0x2ae6494200000000, + 0x1d8c8b4300000000, 0x5068f15400000000, 0x6702335500000000, + 0x3ebc755700000000, 0x09d6b75600000000, 0x8cc0f85300000000, + 0xbbaa3a5200000000, 0xe2147c5000000000, 0xd57ebe5100000000, + 0xe839e25a00000000, 0xdf53205b00000000, 0x86ed665900000000, + 0xb187a45800000000, 0x3491eb5d00000000, 0x03fb295c00000000, + 0x5a456f5e00000000, 0x6d2fad5f00000000, 0x801b35e100000000, + 0xb771f7e000000000, 0xeecfb1e200000000, 0xd9a573e300000000, + 0x5cb33ce600000000, 0x6bd9fee700000000, 0x3267b8e500000000, + 0x050d7ae400000000, 0x384a26ef00000000, 0x0f20e4ee00000000, + 0x569ea2ec00000000, 0x61f460ed00000000, 0xe4e22fe800000000, + 0xd388ede900000000, 0x8a36abeb00000000, 0xbd5c69ea00000000, + 0xf0b813fd00000000, 0xc7d2d1fc00000000, 0x9e6c97fe00000000, + 0xa90655ff00000000, 0x2c101afa00000000, 0x1b7ad8fb00000000, + 0x42c49ef900000000, 0x75ae5cf800000000, 0x48e900f300000000, + 0x7f83c2f200000000, 0x263d84f000000000, 0x115746f100000000, + 0x944109f400000000, 0xa32bcbf500000000, 0xfa958df700000000, + 0xcdff4ff600000000, 0x605d78d900000000, 0x5737bad800000000, + 0x0e89fcda00000000, 0x39e33edb00000000, 0xbcf571de00000000, + 0x8b9fb3df00000000, 0xd221f5dd00000000, 0xe54b37dc00000000, + 0xd80c6bd700000000, 0xef66a9d600000000, 0xb6d8efd400000000, + 0x81b22dd500000000, 0x04a462d000000000, 0x33cea0d100000000, + 0x6a70e6d300000000, 0x5d1a24d200000000, 0x10fe5ec500000000, + 0x27949cc400000000, 0x7e2adac600000000, 0x494018c700000000, + 0xcc5657c200000000, 0xfb3c95c300000000, 0xa282d3c100000000, + 0x95e811c000000000, 0xa8af4dcb00000000, 0x9fc58fca00000000, + 0xc67bc9c800000000, 0xf1110bc900000000, 0x740744cc00000000, + 0x436d86cd00000000, 0x1ad3c0cf00000000, 0x2db902ce00000000, + 0x4096af9100000000, 0x77fc6d9000000000, 0x2e422b9200000000, + 0x1928e99300000000, 0x9c3ea69600000000, 0xab54649700000000, + 0xf2ea229500000000, 0xc580e09400000000, 0xf8c7bc9f00000000, + 0xcfad7e9e00000000, 0x9613389c00000000, 0xa179fa9d00000000, + 0x246fb59800000000, 0x1305779900000000, 0x4abb319b00000000, + 0x7dd1f39a00000000, 0x3035898d00000000, 0x075f4b8c00000000, + 0x5ee10d8e00000000, 0x698bcf8f00000000, 0xec9d808a00000000, + 0xdbf7428b00000000, 0x8249048900000000, 0xb523c68800000000, + 0x88649a8300000000, 0xbf0e588200000000, 0xe6b01e8000000000, + 0xd1dadc8100000000, 0x54cc938400000000, 0x63a6518500000000, + 0x3a18178700000000, 0x0d72d58600000000, 0xa0d0e2a900000000, + 0x97ba20a800000000, 0xce0466aa00000000, 0xf96ea4ab00000000, + 0x7c78ebae00000000, 0x4b1229af00000000, 0x12ac6fad00000000, + 0x25c6adac00000000, 0x1881f1a700000000, 0x2feb33a600000000, + 0x765575a400000000, 0x413fb7a500000000, 0xc429f8a000000000, + 0xf3433aa100000000, 0xaafd7ca300000000, 0x9d97bea200000000, + 0xd073c4b500000000, 0xe71906b400000000, 0xbea740b600000000, + 0x89cd82b700000000, 0x0cdbcdb200000000, 0x3bb10fb300000000, + 0x620f49b100000000, 0x55658bb000000000, 0x6822d7bb00000000, + 0x5f4815ba00000000, 0x06f653b800000000, 0x319c91b900000000, + 0xb48adebc00000000, 0x83e01cbd00000000, 0xda5e5abf00000000, + 0xed3498be00000000}, + {0x0000000000000000, 0x6567bcb800000000, 0x8bc809aa00000000, + 0xeeafb51200000000, 0x5797628f00000000, 0x32f0de3700000000, + 0xdc5f6b2500000000, 0xb938d79d00000000, 0xef28b4c500000000, + 0x8a4f087d00000000, 0x64e0bd6f00000000, 0x018701d700000000, + 0xb8bfd64a00000000, 0xddd86af200000000, 0x3377dfe000000000, + 0x5610635800000000, 0x9f57195000000000, 0xfa30a5e800000000, + 0x149f10fa00000000, 0x71f8ac4200000000, 0xc8c07bdf00000000, + 0xada7c76700000000, 0x4308727500000000, 0x266fcecd00000000, + 0x707fad9500000000, 0x1518112d00000000, 0xfbb7a43f00000000, + 0x9ed0188700000000, 0x27e8cf1a00000000, 0x428f73a200000000, + 0xac20c6b000000000, 0xc9477a0800000000, 0x3eaf32a000000000, + 0x5bc88e1800000000, 0xb5673b0a00000000, 0xd00087b200000000, + 0x6938502f00000000, 0x0c5fec9700000000, 0xe2f0598500000000, + 0x8797e53d00000000, 0xd187866500000000, 0xb4e03add00000000, + 0x5a4f8fcf00000000, 0x3f28337700000000, 0x8610e4ea00000000, + 0xe377585200000000, 0x0dd8ed4000000000, 0x68bf51f800000000, + 0xa1f82bf000000000, 0xc49f974800000000, 0x2a30225a00000000, + 0x4f579ee200000000, 0xf66f497f00000000, 0x9308f5c700000000, + 0x7da740d500000000, 0x18c0fc6d00000000, 0x4ed09f3500000000, + 0x2bb7238d00000000, 0xc518969f00000000, 0xa07f2a2700000000, + 0x1947fdba00000000, 0x7c20410200000000, 0x928ff41000000000, + 0xf7e848a800000000, 0x3d58149b00000000, 0x583fa82300000000, + 0xb6901d3100000000, 0xd3f7a18900000000, 0x6acf761400000000, + 0x0fa8caac00000000, 0xe1077fbe00000000, 0x8460c30600000000, + 0xd270a05e00000000, 0xb7171ce600000000, 0x59b8a9f400000000, + 0x3cdf154c00000000, 0x85e7c2d100000000, 0xe0807e6900000000, + 0x0e2fcb7b00000000, 0x6b4877c300000000, 0xa20f0dcb00000000, + 0xc768b17300000000, 0x29c7046100000000, 0x4ca0b8d900000000, + 0xf5986f4400000000, 0x90ffd3fc00000000, 0x7e5066ee00000000, + 0x1b37da5600000000, 0x4d27b90e00000000, 0x284005b600000000, + 0xc6efb0a400000000, 0xa3880c1c00000000, 0x1ab0db8100000000, + 0x7fd7673900000000, 0x9178d22b00000000, 0xf41f6e9300000000, + 0x03f7263b00000000, 0x66909a8300000000, 0x883f2f9100000000, + 0xed58932900000000, 0x546044b400000000, 0x3107f80c00000000, + 0xdfa84d1e00000000, 0xbacff1a600000000, 0xecdf92fe00000000, + 0x89b82e4600000000, 0x67179b5400000000, 0x027027ec00000000, + 0xbb48f07100000000, 0xde2f4cc900000000, 0x3080f9db00000000, + 0x55e7456300000000, 0x9ca03f6b00000000, 0xf9c783d300000000, + 0x176836c100000000, 0x720f8a7900000000, 0xcb375de400000000, + 0xae50e15c00000000, 0x40ff544e00000000, 0x2598e8f600000000, + 0x73888bae00000000, 0x16ef371600000000, 0xf840820400000000, + 0x9d273ebc00000000, 0x241fe92100000000, 0x4178559900000000, + 0xafd7e08b00000000, 0xcab05c3300000000, 0x3bb659ed00000000, + 0x5ed1e55500000000, 0xb07e504700000000, 0xd519ecff00000000, + 0x6c213b6200000000, 0x094687da00000000, 0xe7e932c800000000, + 0x828e8e7000000000, 0xd49eed2800000000, 0xb1f9519000000000, + 0x5f56e48200000000, 0x3a31583a00000000, 0x83098fa700000000, + 0xe66e331f00000000, 0x08c1860d00000000, 0x6da63ab500000000, + 0xa4e140bd00000000, 0xc186fc0500000000, 0x2f29491700000000, + 0x4a4ef5af00000000, 0xf376223200000000, 0x96119e8a00000000, + 0x78be2b9800000000, 0x1dd9972000000000, 0x4bc9f47800000000, + 0x2eae48c000000000, 0xc001fdd200000000, 0xa566416a00000000, + 0x1c5e96f700000000, 0x79392a4f00000000, 0x97969f5d00000000, + 0xf2f123e500000000, 0x05196b4d00000000, 0x607ed7f500000000, + 0x8ed162e700000000, 0xebb6de5f00000000, 0x528e09c200000000, + 0x37e9b57a00000000, 0xd946006800000000, 0xbc21bcd000000000, + 0xea31df8800000000, 0x8f56633000000000, 0x61f9d62200000000, + 0x049e6a9a00000000, 0xbda6bd0700000000, 0xd8c101bf00000000, + 0x366eb4ad00000000, 0x5309081500000000, 0x9a4e721d00000000, + 0xff29cea500000000, 0x11867bb700000000, 0x74e1c70f00000000, + 0xcdd9109200000000, 0xa8beac2a00000000, 0x4611193800000000, + 0x2376a58000000000, 0x7566c6d800000000, 0x10017a6000000000, + 0xfeaecf7200000000, 0x9bc973ca00000000, 0x22f1a45700000000, + 0x479618ef00000000, 0xa939adfd00000000, 0xcc5e114500000000, + 0x06ee4d7600000000, 0x6389f1ce00000000, 0x8d2644dc00000000, + 0xe841f86400000000, 0x51792ff900000000, 0x341e934100000000, + 0xdab1265300000000, 0xbfd69aeb00000000, 0xe9c6f9b300000000, + 0x8ca1450b00000000, 0x620ef01900000000, 0x07694ca100000000, + 0xbe519b3c00000000, 0xdb36278400000000, 0x3599929600000000, + 0x50fe2e2e00000000, 0x99b9542600000000, 0xfcdee89e00000000, + 0x12715d8c00000000, 0x7716e13400000000, 0xce2e36a900000000, + 0xab498a1100000000, 0x45e63f0300000000, 0x208183bb00000000, + 0x7691e0e300000000, 0x13f65c5b00000000, 0xfd59e94900000000, + 0x983e55f100000000, 0x2106826c00000000, 0x44613ed400000000, + 0xaace8bc600000000, 0xcfa9377e00000000, 0x38417fd600000000, + 0x5d26c36e00000000, 0xb389767c00000000, 0xd6eecac400000000, + 0x6fd61d5900000000, 0x0ab1a1e100000000, 0xe41e14f300000000, + 0x8179a84b00000000, 0xd769cb1300000000, 0xb20e77ab00000000, + 0x5ca1c2b900000000, 0x39c67e0100000000, 0x80fea99c00000000, + 0xe599152400000000, 0x0b36a03600000000, 0x6e511c8e00000000, + 0xa716668600000000, 0xc271da3e00000000, 0x2cde6f2c00000000, + 0x49b9d39400000000, 0xf081040900000000, 0x95e6b8b100000000, + 0x7b490da300000000, 0x1e2eb11b00000000, 0x483ed24300000000, + 0x2d596efb00000000, 0xc3f6dbe900000000, 0xa691675100000000, + 0x1fa9b0cc00000000, 0x7ace0c7400000000, 0x9461b96600000000, + 0xf10605de00000000}, + {0x0000000000000000, 0xb029603d00000000, 0x6053c07a00000000, + 0xd07aa04700000000, 0xc0a680f500000000, 0x708fe0c800000000, + 0xa0f5408f00000000, 0x10dc20b200000000, 0xc14b703000000000, + 0x7162100d00000000, 0xa118b04a00000000, 0x1131d07700000000, + 0x01edf0c500000000, 0xb1c490f800000000, 0x61be30bf00000000, + 0xd197508200000000, 0x8297e06000000000, 0x32be805d00000000, + 0xe2c4201a00000000, 0x52ed402700000000, 0x4231609500000000, + 0xf21800a800000000, 0x2262a0ef00000000, 0x924bc0d200000000, + 0x43dc905000000000, 0xf3f5f06d00000000, 0x238f502a00000000, + 0x93a6301700000000, 0x837a10a500000000, 0x3353709800000000, + 0xe329d0df00000000, 0x5300b0e200000000, 0x042fc1c100000000, + 0xb406a1fc00000000, 0x647c01bb00000000, 0xd455618600000000, + 0xc489413400000000, 0x74a0210900000000, 0xa4da814e00000000, + 0x14f3e17300000000, 0xc564b1f100000000, 0x754dd1cc00000000, + 0xa537718b00000000, 0x151e11b600000000, 0x05c2310400000000, + 0xb5eb513900000000, 0x6591f17e00000000, 0xd5b8914300000000, + 0x86b821a100000000, 0x3691419c00000000, 0xe6ebe1db00000000, + 0x56c281e600000000, 0x461ea15400000000, 0xf637c16900000000, + 0x264d612e00000000, 0x9664011300000000, 0x47f3519100000000, + 0xf7da31ac00000000, 0x27a091eb00000000, 0x9789f1d600000000, + 0x8755d16400000000, 0x377cb15900000000, 0xe706111e00000000, + 0x572f712300000000, 0x4958f35800000000, 0xf971936500000000, + 0x290b332200000000, 0x9922531f00000000, 0x89fe73ad00000000, + 0x39d7139000000000, 0xe9adb3d700000000, 0x5984d3ea00000000, + 0x8813836800000000, 0x383ae35500000000, 0xe840431200000000, + 0x5869232f00000000, 0x48b5039d00000000, 0xf89c63a000000000, + 0x28e6c3e700000000, 0x98cfa3da00000000, 0xcbcf133800000000, + 0x7be6730500000000, 0xab9cd34200000000, 0x1bb5b37f00000000, + 0x0b6993cd00000000, 0xbb40f3f000000000, 0x6b3a53b700000000, + 0xdb13338a00000000, 0x0a84630800000000, 0xbaad033500000000, + 0x6ad7a37200000000, 0xdafec34f00000000, 0xca22e3fd00000000, + 0x7a0b83c000000000, 0xaa71238700000000, 0x1a5843ba00000000, + 0x4d77329900000000, 0xfd5e52a400000000, 0x2d24f2e300000000, + 0x9d0d92de00000000, 0x8dd1b26c00000000, 0x3df8d25100000000, + 0xed82721600000000, 0x5dab122b00000000, 0x8c3c42a900000000, + 0x3c15229400000000, 0xec6f82d300000000, 0x5c46e2ee00000000, + 0x4c9ac25c00000000, 0xfcb3a26100000000, 0x2cc9022600000000, + 0x9ce0621b00000000, 0xcfe0d2f900000000, 0x7fc9b2c400000000, + 0xafb3128300000000, 0x1f9a72be00000000, 0x0f46520c00000000, + 0xbf6f323100000000, 0x6f15927600000000, 0xdf3cf24b00000000, + 0x0eaba2c900000000, 0xbe82c2f400000000, 0x6ef862b300000000, + 0xded1028e00000000, 0xce0d223c00000000, 0x7e24420100000000, + 0xae5ee24600000000, 0x1e77827b00000000, 0x92b0e6b100000000, + 0x2299868c00000000, 0xf2e326cb00000000, 0x42ca46f600000000, + 0x5216664400000000, 0xe23f067900000000, 0x3245a63e00000000, + 0x826cc60300000000, 0x53fb968100000000, 0xe3d2f6bc00000000, + 0x33a856fb00000000, 0x838136c600000000, 0x935d167400000000, + 0x2374764900000000, 0xf30ed60e00000000, 0x4327b63300000000, + 0x102706d100000000, 0xa00e66ec00000000, 0x7074c6ab00000000, + 0xc05da69600000000, 0xd081862400000000, 0x60a8e61900000000, + 0xb0d2465e00000000, 0x00fb266300000000, 0xd16c76e100000000, + 0x614516dc00000000, 0xb13fb69b00000000, 0x0116d6a600000000, + 0x11caf61400000000, 0xa1e3962900000000, 0x7199366e00000000, + 0xc1b0565300000000, 0x969f277000000000, 0x26b6474d00000000, + 0xf6cce70a00000000, 0x46e5873700000000, 0x5639a78500000000, + 0xe610c7b800000000, 0x366a67ff00000000, 0x864307c200000000, + 0x57d4574000000000, 0xe7fd377d00000000, 0x3787973a00000000, + 0x87aef70700000000, 0x9772d7b500000000, 0x275bb78800000000, + 0xf72117cf00000000, 0x470877f200000000, 0x1408c71000000000, + 0xa421a72d00000000, 0x745b076a00000000, 0xc472675700000000, + 0xd4ae47e500000000, 0x648727d800000000, 0xb4fd879f00000000, + 0x04d4e7a200000000, 0xd543b72000000000, 0x656ad71d00000000, + 0xb510775a00000000, 0x0539176700000000, 0x15e537d500000000, + 0xa5cc57e800000000, 0x75b6f7af00000000, 0xc59f979200000000, + 0xdbe815e900000000, 0x6bc175d400000000, 0xbbbbd59300000000, + 0x0b92b5ae00000000, 0x1b4e951c00000000, 0xab67f52100000000, + 0x7b1d556600000000, 0xcb34355b00000000, 0x1aa365d900000000, + 0xaa8a05e400000000, 0x7af0a5a300000000, 0xcad9c59e00000000, + 0xda05e52c00000000, 0x6a2c851100000000, 0xba56255600000000, + 0x0a7f456b00000000, 0x597ff58900000000, 0xe95695b400000000, + 0x392c35f300000000, 0x890555ce00000000, 0x99d9757c00000000, + 0x29f0154100000000, 0xf98ab50600000000, 0x49a3d53b00000000, + 0x983485b900000000, 0x281de58400000000, 0xf86745c300000000, + 0x484e25fe00000000, 0x5892054c00000000, 0xe8bb657100000000, + 0x38c1c53600000000, 0x88e8a50b00000000, 0xdfc7d42800000000, + 0x6feeb41500000000, 0xbf94145200000000, 0x0fbd746f00000000, + 0x1f6154dd00000000, 0xaf4834e000000000, 0x7f3294a700000000, + 0xcf1bf49a00000000, 0x1e8ca41800000000, 0xaea5c42500000000, + 0x7edf646200000000, 0xcef6045f00000000, 0xde2a24ed00000000, + 0x6e0344d000000000, 0xbe79e49700000000, 0x0e5084aa00000000, + 0x5d50344800000000, 0xed79547500000000, 0x3d03f43200000000, + 0x8d2a940f00000000, 0x9df6b4bd00000000, 0x2ddfd48000000000, + 0xfda574c700000000, 0x4d8c14fa00000000, 0x9c1b447800000000, + 0x2c32244500000000, 0xfc48840200000000, 0x4c61e43f00000000, + 0x5cbdc48d00000000, 0xec94a4b000000000, 0x3cee04f700000000, + 0x8cc764ca00000000}, + {0x0000000000000000, 0xa5d35ccb00000000, 0x0ba1c84d00000000, + 0xae72948600000000, 0x1642919b00000000, 0xb391cd5000000000, + 0x1de359d600000000, 0xb830051d00000000, 0x6d8253ec00000000, + 0xc8510f2700000000, 0x66239ba100000000, 0xc3f0c76a00000000, + 0x7bc0c27700000000, 0xde139ebc00000000, 0x70610a3a00000000, + 0xd5b256f100000000, 0x9b02d60300000000, 0x3ed18ac800000000, + 0x90a31e4e00000000, 0x3570428500000000, 0x8d40479800000000, + 0x28931b5300000000, 0x86e18fd500000000, 0x2332d31e00000000, + 0xf68085ef00000000, 0x5353d92400000000, 0xfd214da200000000, + 0x58f2116900000000, 0xe0c2147400000000, 0x451148bf00000000, + 0xeb63dc3900000000, 0x4eb080f200000000, 0x3605ac0700000000, + 0x93d6f0cc00000000, 0x3da4644a00000000, 0x9877388100000000, + 0x20473d9c00000000, 0x8594615700000000, 0x2be6f5d100000000, + 0x8e35a91a00000000, 0x5b87ffeb00000000, 0xfe54a32000000000, + 0x502637a600000000, 0xf5f56b6d00000000, 0x4dc56e7000000000, + 0xe81632bb00000000, 0x4664a63d00000000, 0xe3b7faf600000000, + 0xad077a0400000000, 0x08d426cf00000000, 0xa6a6b24900000000, + 0x0375ee8200000000, 0xbb45eb9f00000000, 0x1e96b75400000000, + 0xb0e423d200000000, 0x15377f1900000000, 0xc08529e800000000, + 0x6556752300000000, 0xcb24e1a500000000, 0x6ef7bd6e00000000, + 0xd6c7b87300000000, 0x7314e4b800000000, 0xdd66703e00000000, + 0x78b52cf500000000, 0x6c0a580f00000000, 0xc9d904c400000000, + 0x67ab904200000000, 0xc278cc8900000000, 0x7a48c99400000000, + 0xdf9b955f00000000, 0x71e901d900000000, 0xd43a5d1200000000, + 0x01880be300000000, 0xa45b572800000000, 0x0a29c3ae00000000, + 0xaffa9f6500000000, 0x17ca9a7800000000, 0xb219c6b300000000, + 0x1c6b523500000000, 0xb9b80efe00000000, 0xf7088e0c00000000, + 0x52dbd2c700000000, 0xfca9464100000000, 0x597a1a8a00000000, + 0xe14a1f9700000000, 0x4499435c00000000, 0xeaebd7da00000000, + 0x4f388b1100000000, 0x9a8adde000000000, 0x3f59812b00000000, + 0x912b15ad00000000, 0x34f8496600000000, 0x8cc84c7b00000000, + 0x291b10b000000000, 0x8769843600000000, 0x22bad8fd00000000, + 0x5a0ff40800000000, 0xffdca8c300000000, 0x51ae3c4500000000, + 0xf47d608e00000000, 0x4c4d659300000000, 0xe99e395800000000, + 0x47ecadde00000000, 0xe23ff11500000000, 0x378da7e400000000, + 0x925efb2f00000000, 0x3c2c6fa900000000, 0x99ff336200000000, + 0x21cf367f00000000, 0x841c6ab400000000, 0x2a6efe3200000000, + 0x8fbda2f900000000, 0xc10d220b00000000, 0x64de7ec000000000, + 0xcaacea4600000000, 0x6f7fb68d00000000, 0xd74fb39000000000, + 0x729cef5b00000000, 0xdcee7bdd00000000, 0x793d271600000000, + 0xac8f71e700000000, 0x095c2d2c00000000, 0xa72eb9aa00000000, + 0x02fde56100000000, 0xbacde07c00000000, 0x1f1ebcb700000000, + 0xb16c283100000000, 0x14bf74fa00000000, 0xd814b01e00000000, + 0x7dc7ecd500000000, 0xd3b5785300000000, 0x7666249800000000, + 0xce56218500000000, 0x6b857d4e00000000, 0xc5f7e9c800000000, + 0x6024b50300000000, 0xb596e3f200000000, 0x1045bf3900000000, + 0xbe372bbf00000000, 0x1be4777400000000, 0xa3d4726900000000, + 0x06072ea200000000, 0xa875ba2400000000, 0x0da6e6ef00000000, + 0x4316661d00000000, 0xe6c53ad600000000, 0x48b7ae5000000000, + 0xed64f29b00000000, 0x5554f78600000000, 0xf087ab4d00000000, + 0x5ef53fcb00000000, 0xfb26630000000000, 0x2e9435f100000000, + 0x8b47693a00000000, 0x2535fdbc00000000, 0x80e6a17700000000, + 0x38d6a46a00000000, 0x9d05f8a100000000, 0x33776c2700000000, + 0x96a430ec00000000, 0xee111c1900000000, 0x4bc240d200000000, + 0xe5b0d45400000000, 0x4063889f00000000, 0xf8538d8200000000, + 0x5d80d14900000000, 0xf3f245cf00000000, 0x5621190400000000, + 0x83934ff500000000, 0x2640133e00000000, 0x883287b800000000, + 0x2de1db7300000000, 0x95d1de6e00000000, 0x300282a500000000, + 0x9e70162300000000, 0x3ba34ae800000000, 0x7513ca1a00000000, + 0xd0c096d100000000, 0x7eb2025700000000, 0xdb615e9c00000000, + 0x63515b8100000000, 0xc682074a00000000, 0x68f093cc00000000, + 0xcd23cf0700000000, 0x189199f600000000, 0xbd42c53d00000000, + 0x133051bb00000000, 0xb6e30d7000000000, 0x0ed3086d00000000, + 0xab0054a600000000, 0x0572c02000000000, 0xa0a19ceb00000000, + 0xb41ee81100000000, 0x11cdb4da00000000, 0xbfbf205c00000000, + 0x1a6c7c9700000000, 0xa25c798a00000000, 0x078f254100000000, + 0xa9fdb1c700000000, 0x0c2eed0c00000000, 0xd99cbbfd00000000, + 0x7c4fe73600000000, 0xd23d73b000000000, 0x77ee2f7b00000000, + 0xcfde2a6600000000, 0x6a0d76ad00000000, 0xc47fe22b00000000, + 0x61acbee000000000, 0x2f1c3e1200000000, 0x8acf62d900000000, + 0x24bdf65f00000000, 0x816eaa9400000000, 0x395eaf8900000000, + 0x9c8df34200000000, 0x32ff67c400000000, 0x972c3b0f00000000, + 0x429e6dfe00000000, 0xe74d313500000000, 0x493fa5b300000000, + 0xececf97800000000, 0x54dcfc6500000000, 0xf10fa0ae00000000, + 0x5f7d342800000000, 0xfaae68e300000000, 0x821b441600000000, + 0x27c818dd00000000, 0x89ba8c5b00000000, 0x2c69d09000000000, + 0x9459d58d00000000, 0x318a894600000000, 0x9ff81dc000000000, + 0x3a2b410b00000000, 0xef9917fa00000000, 0x4a4a4b3100000000, + 0xe438dfb700000000, 0x41eb837c00000000, 0xf9db866100000000, + 0x5c08daaa00000000, 0xf27a4e2c00000000, 0x57a912e700000000, + 0x1919921500000000, 0xbccacede00000000, 0x12b85a5800000000, + 0xb76b069300000000, 0x0f5b038e00000000, 0xaa885f4500000000, + 0x04facbc300000000, 0xa129970800000000, 0x749bc1f900000000, + 0xd1489d3200000000, 0x7f3a09b400000000, 0xdae9557f00000000, + 0x62d9506200000000, 0xc70a0ca900000000, 0x6978982f00000000, + 0xccabc4e400000000}, + {0x0000000000000000, 0xb40b77a600000000, 0x29119f9700000000, + 0x9d1ae83100000000, 0x13244ff400000000, 0xa72f385200000000, + 0x3a35d06300000000, 0x8e3ea7c500000000, 0x674eef3300000000, + 0xd345989500000000, 0x4e5f70a400000000, 0xfa54070200000000, + 0x746aa0c700000000, 0xc061d76100000000, 0x5d7b3f5000000000, + 0xe97048f600000000, 0xce9cde6700000000, 0x7a97a9c100000000, + 0xe78d41f000000000, 0x5386365600000000, 0xddb8919300000000, + 0x69b3e63500000000, 0xf4a90e0400000000, 0x40a279a200000000, + 0xa9d2315400000000, 0x1dd946f200000000, 0x80c3aec300000000, + 0x34c8d96500000000, 0xbaf67ea000000000, 0x0efd090600000000, + 0x93e7e13700000000, 0x27ec969100000000, 0x9c39bdcf00000000, + 0x2832ca6900000000, 0xb528225800000000, 0x012355fe00000000, + 0x8f1df23b00000000, 0x3b16859d00000000, 0xa60c6dac00000000, + 0x12071a0a00000000, 0xfb7752fc00000000, 0x4f7c255a00000000, + 0xd266cd6b00000000, 0x666dbacd00000000, 0xe8531d0800000000, + 0x5c586aae00000000, 0xc142829f00000000, 0x7549f53900000000, + 0x52a563a800000000, 0xe6ae140e00000000, 0x7bb4fc3f00000000, + 0xcfbf8b9900000000, 0x41812c5c00000000, 0xf58a5bfa00000000, + 0x6890b3cb00000000, 0xdc9bc46d00000000, 0x35eb8c9b00000000, + 0x81e0fb3d00000000, 0x1cfa130c00000000, 0xa8f164aa00000000, + 0x26cfc36f00000000, 0x92c4b4c900000000, 0x0fde5cf800000000, + 0xbbd52b5e00000000, 0x79750b4400000000, 0xcd7e7ce200000000, + 0x506494d300000000, 0xe46fe37500000000, 0x6a5144b000000000, + 0xde5a331600000000, 0x4340db2700000000, 0xf74bac8100000000, + 0x1e3be47700000000, 0xaa3093d100000000, 0x372a7be000000000, + 0x83210c4600000000, 0x0d1fab8300000000, 0xb914dc2500000000, + 0x240e341400000000, 0x900543b200000000, 0xb7e9d52300000000, + 0x03e2a28500000000, 0x9ef84ab400000000, 0x2af33d1200000000, + 0xa4cd9ad700000000, 0x10c6ed7100000000, 0x8ddc054000000000, + 0x39d772e600000000, 0xd0a73a1000000000, 0x64ac4db600000000, + 0xf9b6a58700000000, 0x4dbdd22100000000, 0xc38375e400000000, + 0x7788024200000000, 0xea92ea7300000000, 0x5e999dd500000000, + 0xe54cb68b00000000, 0x5147c12d00000000, 0xcc5d291c00000000, + 0x78565eba00000000, 0xf668f97f00000000, 0x42638ed900000000, + 0xdf7966e800000000, 0x6b72114e00000000, 0x820259b800000000, + 0x36092e1e00000000, 0xab13c62f00000000, 0x1f18b18900000000, + 0x9126164c00000000, 0x252d61ea00000000, 0xb83789db00000000, + 0x0c3cfe7d00000000, 0x2bd068ec00000000, 0x9fdb1f4a00000000, + 0x02c1f77b00000000, 0xb6ca80dd00000000, 0x38f4271800000000, + 0x8cff50be00000000, 0x11e5b88f00000000, 0xa5eecf2900000000, + 0x4c9e87df00000000, 0xf895f07900000000, 0x658f184800000000, + 0xd1846fee00000000, 0x5fbac82b00000000, 0xebb1bf8d00000000, + 0x76ab57bc00000000, 0xc2a0201a00000000, 0xf2ea168800000000, + 0x46e1612e00000000, 0xdbfb891f00000000, 0x6ff0feb900000000, + 0xe1ce597c00000000, 0x55c52eda00000000, 0xc8dfc6eb00000000, + 0x7cd4b14d00000000, 0x95a4f9bb00000000, 0x21af8e1d00000000, + 0xbcb5662c00000000, 0x08be118a00000000, 0x8680b64f00000000, + 0x328bc1e900000000, 0xaf9129d800000000, 0x1b9a5e7e00000000, + 0x3c76c8ef00000000, 0x887dbf4900000000, 0x1567577800000000, + 0xa16c20de00000000, 0x2f52871b00000000, 0x9b59f0bd00000000, + 0x0643188c00000000, 0xb2486f2a00000000, 0x5b3827dc00000000, + 0xef33507a00000000, 0x7229b84b00000000, 0xc622cfed00000000, + 0x481c682800000000, 0xfc171f8e00000000, 0x610df7bf00000000, + 0xd506801900000000, 0x6ed3ab4700000000, 0xdad8dce100000000, + 0x47c234d000000000, 0xf3c9437600000000, 0x7df7e4b300000000, + 0xc9fc931500000000, 0x54e67b2400000000, 0xe0ed0c8200000000, + 0x099d447400000000, 0xbd9633d200000000, 0x208cdbe300000000, + 0x9487ac4500000000, 0x1ab90b8000000000, 0xaeb27c2600000000, + 0x33a8941700000000, 0x87a3e3b100000000, 0xa04f752000000000, + 0x1444028600000000, 0x895eeab700000000, 0x3d559d1100000000, + 0xb36b3ad400000000, 0x07604d7200000000, 0x9a7aa54300000000, + 0x2e71d2e500000000, 0xc7019a1300000000, 0x730aedb500000000, + 0xee10058400000000, 0x5a1b722200000000, 0xd425d5e700000000, + 0x602ea24100000000, 0xfd344a7000000000, 0x493f3dd600000000, + 0x8b9f1dcc00000000, 0x3f946a6a00000000, 0xa28e825b00000000, + 0x1685f5fd00000000, 0x98bb523800000000, 0x2cb0259e00000000, + 0xb1aacdaf00000000, 0x05a1ba0900000000, 0xecd1f2ff00000000, + 0x58da855900000000, 0xc5c06d6800000000, 0x71cb1ace00000000, + 0xfff5bd0b00000000, 0x4bfecaad00000000, 0xd6e4229c00000000, + 0x62ef553a00000000, 0x4503c3ab00000000, 0xf108b40d00000000, + 0x6c125c3c00000000, 0xd8192b9a00000000, 0x56278c5f00000000, + 0xe22cfbf900000000, 0x7f3613c800000000, 0xcb3d646e00000000, + 0x224d2c9800000000, 0x96465b3e00000000, 0x0b5cb30f00000000, + 0xbf57c4a900000000, 0x3169636c00000000, 0x856214ca00000000, + 0x1878fcfb00000000, 0xac738b5d00000000, 0x17a6a00300000000, + 0xa3add7a500000000, 0x3eb73f9400000000, 0x8abc483200000000, + 0x0482eff700000000, 0xb089985100000000, 0x2d93706000000000, + 0x999807c600000000, 0x70e84f3000000000, 0xc4e3389600000000, + 0x59f9d0a700000000, 0xedf2a70100000000, 0x63cc00c400000000, + 0xd7c7776200000000, 0x4add9f5300000000, 0xfed6e8f500000000, + 0xd93a7e6400000000, 0x6d3109c200000000, 0xf02be1f300000000, + 0x4420965500000000, 0xca1e319000000000, 0x7e15463600000000, + 0xe30fae0700000000, 0x5704d9a100000000, 0xbe74915700000000, + 0x0a7fe6f100000000, 0x97650ec000000000, 0x236e796600000000, + 0xad50dea300000000, 0x195ba90500000000, 0x8441413400000000, + 0x304a369200000000}, + {0x0000000000000000, 0x9e00aacc00000000, 0x7d07254200000000, + 0xe3078f8e00000000, 0xfa0e4a8400000000, 0x640ee04800000000, + 0x87096fc600000000, 0x1909c50a00000000, 0xb51be5d300000000, + 0x2b1b4f1f00000000, 0xc81cc09100000000, 0x561c6a5d00000000, + 0x4f15af5700000000, 0xd115059b00000000, 0x32128a1500000000, + 0xac1220d900000000, 0x2b31bb7c00000000, 0xb53111b000000000, + 0x56369e3e00000000, 0xc83634f200000000, 0xd13ff1f800000000, + 0x4f3f5b3400000000, 0xac38d4ba00000000, 0x32387e7600000000, + 0x9e2a5eaf00000000, 0x002af46300000000, 0xe32d7bed00000000, + 0x7d2dd12100000000, 0x6424142b00000000, 0xfa24bee700000000, + 0x1923316900000000, 0x87239ba500000000, 0x566276f900000000, + 0xc862dc3500000000, 0x2b6553bb00000000, 0xb565f97700000000, + 0xac6c3c7d00000000, 0x326c96b100000000, 0xd16b193f00000000, + 0x4f6bb3f300000000, 0xe379932a00000000, 0x7d7939e600000000, + 0x9e7eb66800000000, 0x007e1ca400000000, 0x1977d9ae00000000, + 0x8777736200000000, 0x6470fcec00000000, 0xfa70562000000000, + 0x7d53cd8500000000, 0xe353674900000000, 0x0054e8c700000000, + 0x9e54420b00000000, 0x875d870100000000, 0x195d2dcd00000000, + 0xfa5aa24300000000, 0x645a088f00000000, 0xc848285600000000, + 0x5648829a00000000, 0xb54f0d1400000000, 0x2b4fa7d800000000, + 0x324662d200000000, 0xac46c81e00000000, 0x4f41479000000000, + 0xd141ed5c00000000, 0xedc29d2900000000, 0x73c237e500000000, + 0x90c5b86b00000000, 0x0ec512a700000000, 0x17ccd7ad00000000, + 0x89cc7d6100000000, 0x6acbf2ef00000000, 0xf4cb582300000000, + 0x58d978fa00000000, 0xc6d9d23600000000, 0x25de5db800000000, + 0xbbdef77400000000, 0xa2d7327e00000000, 0x3cd798b200000000, + 0xdfd0173c00000000, 0x41d0bdf000000000, 0xc6f3265500000000, + 0x58f38c9900000000, 0xbbf4031700000000, 0x25f4a9db00000000, + 0x3cfd6cd100000000, 0xa2fdc61d00000000, 0x41fa499300000000, + 0xdffae35f00000000, 0x73e8c38600000000, 0xede8694a00000000, + 0x0eefe6c400000000, 0x90ef4c0800000000, 0x89e6890200000000, + 0x17e623ce00000000, 0xf4e1ac4000000000, 0x6ae1068c00000000, + 0xbba0ebd000000000, 0x25a0411c00000000, 0xc6a7ce9200000000, + 0x58a7645e00000000, 0x41aea15400000000, 0xdfae0b9800000000, + 0x3ca9841600000000, 0xa2a92eda00000000, 0x0ebb0e0300000000, + 0x90bba4cf00000000, 0x73bc2b4100000000, 0xedbc818d00000000, + 0xf4b5448700000000, 0x6ab5ee4b00000000, 0x89b261c500000000, + 0x17b2cb0900000000, 0x909150ac00000000, 0x0e91fa6000000000, + 0xed9675ee00000000, 0x7396df2200000000, 0x6a9f1a2800000000, + 0xf49fb0e400000000, 0x17983f6a00000000, 0x899895a600000000, + 0x258ab57f00000000, 0xbb8a1fb300000000, 0x588d903d00000000, + 0xc68d3af100000000, 0xdf84fffb00000000, 0x4184553700000000, + 0xa283dab900000000, 0x3c83707500000000, 0xda853b5300000000, + 0x4485919f00000000, 0xa7821e1100000000, 0x3982b4dd00000000, + 0x208b71d700000000, 0xbe8bdb1b00000000, 0x5d8c549500000000, + 0xc38cfe5900000000, 0x6f9ede8000000000, 0xf19e744c00000000, + 0x1299fbc200000000, 0x8c99510e00000000, 0x9590940400000000, + 0x0b903ec800000000, 0xe897b14600000000, 0x76971b8a00000000, + 0xf1b4802f00000000, 0x6fb42ae300000000, 0x8cb3a56d00000000, + 0x12b30fa100000000, 0x0bbacaab00000000, 0x95ba606700000000, + 0x76bdefe900000000, 0xe8bd452500000000, 0x44af65fc00000000, + 0xdaafcf3000000000, 0x39a840be00000000, 0xa7a8ea7200000000, + 0xbea12f7800000000, 0x20a185b400000000, 0xc3a60a3a00000000, + 0x5da6a0f600000000, 0x8ce74daa00000000, 0x12e7e76600000000, + 0xf1e068e800000000, 0x6fe0c22400000000, 0x76e9072e00000000, + 0xe8e9ade200000000, 0x0bee226c00000000, 0x95ee88a000000000, + 0x39fca87900000000, 0xa7fc02b500000000, 0x44fb8d3b00000000, + 0xdafb27f700000000, 0xc3f2e2fd00000000, 0x5df2483100000000, + 0xbef5c7bf00000000, 0x20f56d7300000000, 0xa7d6f6d600000000, + 0x39d65c1a00000000, 0xdad1d39400000000, 0x44d1795800000000, + 0x5dd8bc5200000000, 0xc3d8169e00000000, 0x20df991000000000, + 0xbedf33dc00000000, 0x12cd130500000000, 0x8ccdb9c900000000, + 0x6fca364700000000, 0xf1ca9c8b00000000, 0xe8c3598100000000, + 0x76c3f34d00000000, 0x95c47cc300000000, 0x0bc4d60f00000000, + 0x3747a67a00000000, 0xa9470cb600000000, 0x4a40833800000000, + 0xd44029f400000000, 0xcd49ecfe00000000, 0x5349463200000000, + 0xb04ec9bc00000000, 0x2e4e637000000000, 0x825c43a900000000, + 0x1c5ce96500000000, 0xff5b66eb00000000, 0x615bcc2700000000, + 0x7852092d00000000, 0xe652a3e100000000, 0x05552c6f00000000, + 0x9b5586a300000000, 0x1c761d0600000000, 0x8276b7ca00000000, + 0x6171384400000000, 0xff71928800000000, 0xe678578200000000, + 0x7878fd4e00000000, 0x9b7f72c000000000, 0x057fd80c00000000, + 0xa96df8d500000000, 0x376d521900000000, 0xd46add9700000000, + 0x4a6a775b00000000, 0x5363b25100000000, 0xcd63189d00000000, + 0x2e64971300000000, 0xb0643ddf00000000, 0x6125d08300000000, + 0xff257a4f00000000, 0x1c22f5c100000000, 0x82225f0d00000000, + 0x9b2b9a0700000000, 0x052b30cb00000000, 0xe62cbf4500000000, + 0x782c158900000000, 0xd43e355000000000, 0x4a3e9f9c00000000, + 0xa939101200000000, 0x3739bade00000000, 0x2e307fd400000000, + 0xb030d51800000000, 0x53375a9600000000, 0xcd37f05a00000000, + 0x4a146bff00000000, 0xd414c13300000000, 0x37134ebd00000000, + 0xa913e47100000000, 0xb01a217b00000000, 0x2e1a8bb700000000, + 0xcd1d043900000000, 0x531daef500000000, 0xff0f8e2c00000000, + 0x610f24e000000000, 0x8208ab6e00000000, 0x1c0801a200000000, + 0x0501c4a800000000, 0x9b016e6400000000, 0x7806e1ea00000000, + 0xe6064b2600000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, + 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, + 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, + 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, + 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, + 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, + 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, + 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, + 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, + 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, + 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, + 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, + 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, + 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, + 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, + 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, + 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, + 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, + 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, + 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, + 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, + 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, + 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, + 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, + 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, + 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, + 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, + 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, + 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, + 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, + 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, + 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, + 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, + 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, + 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, + 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, + 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, + 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, + 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, + 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, + 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, + 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, + 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, + 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, + 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, + 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, + 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, + 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, + 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, + 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, + 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, + 0xde0506f1}, + {0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, + 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, + 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, + 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, + 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, + 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, + 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, + 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, + 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, + 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, + 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, + 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, + 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, + 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, + 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, + 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, + 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, + 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, + 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, + 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, + 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, + 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, + 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, + 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, + 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, + 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, + 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, + 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, + 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, + 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, + 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, + 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, + 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, + 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, + 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, + 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, + 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, + 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, + 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, + 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, + 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, + 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, + 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, + 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, + 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, + 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, + 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, + 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, + 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, + 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, + 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, + 0xbe9834ed}, + {0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, + 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, + 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, + 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, + 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, + 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, + 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, + 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, + 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, + 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, + 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, + 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, + 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, + 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, + 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, + 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, + 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, + 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, + 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, + 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, + 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, + 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, + 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, + 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, + 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, + 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, + 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, + 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, + 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, + 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, + 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, + 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, + 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, + 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, + 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, + 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, + 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, + 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, + 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, + 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, + 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, + 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, + 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, + 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, + 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, + 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, + 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, + 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, + 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, + 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, + 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, + 0x9324fd72}, + {0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, + 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, + 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, + 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, + 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, + 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, + 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, + 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, + 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, + 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, + 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, + 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, + 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, + 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, + 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, + 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, + 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, + 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, + 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, + 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, + 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, + 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, + 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, + 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, + 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, + 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, + 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, + 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, + 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, + 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, + 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, + 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, + 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, + 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, + 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, + 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, + 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, + 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, + 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, + 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, + 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, + 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, + 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, + 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, + 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, + 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, + 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, + 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, + 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, + 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, + 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, + 0x8def022d}, + {0x00000000, 0x41311b19, 0x82623632, 0xc3532d2b, 0x04c56c64, + 0x45f4777d, 0x86a75a56, 0xc796414f, 0x088ad9c8, 0x49bbc2d1, + 0x8ae8effa, 0xcbd9f4e3, 0x0c4fb5ac, 0x4d7eaeb5, 0x8e2d839e, + 0xcf1c9887, 0x5112c24a, 0x1023d953, 0xd370f478, 0x9241ef61, + 0x55d7ae2e, 0x14e6b537, 0xd7b5981c, 0x96848305, 0x59981b82, + 0x18a9009b, 0xdbfa2db0, 0x9acb36a9, 0x5d5d77e6, 0x1c6c6cff, + 0xdf3f41d4, 0x9e0e5acd, 0xa2248495, 0xe3159f8c, 0x2046b2a7, + 0x6177a9be, 0xa6e1e8f1, 0xe7d0f3e8, 0x2483dec3, 0x65b2c5da, + 0xaaae5d5d, 0xeb9f4644, 0x28cc6b6f, 0x69fd7076, 0xae6b3139, + 0xef5a2a20, 0x2c09070b, 0x6d381c12, 0xf33646df, 0xb2075dc6, + 0x715470ed, 0x30656bf4, 0xf7f32abb, 0xb6c231a2, 0x75911c89, + 0x34a00790, 0xfbbc9f17, 0xba8d840e, 0x79dea925, 0x38efb23c, + 0xff79f373, 0xbe48e86a, 0x7d1bc541, 0x3c2ade58, 0x054f79f0, + 0x447e62e9, 0x872d4fc2, 0xc61c54db, 0x018a1594, 0x40bb0e8d, + 0x83e823a6, 0xc2d938bf, 0x0dc5a038, 0x4cf4bb21, 0x8fa7960a, + 0xce968d13, 0x0900cc5c, 0x4831d745, 0x8b62fa6e, 0xca53e177, + 0x545dbbba, 0x156ca0a3, 0xd63f8d88, 0x970e9691, 0x5098d7de, + 0x11a9ccc7, 0xd2fae1ec, 0x93cbfaf5, 0x5cd76272, 0x1de6796b, + 0xdeb55440, 0x9f844f59, 0x58120e16, 0x1923150f, 0xda703824, + 0x9b41233d, 0xa76bfd65, 0xe65ae67c, 0x2509cb57, 0x6438d04e, + 0xa3ae9101, 0xe29f8a18, 0x21cca733, 0x60fdbc2a, 0xafe124ad, + 0xeed03fb4, 0x2d83129f, 0x6cb20986, 0xab2448c9, 0xea1553d0, + 0x29467efb, 0x687765e2, 0xf6793f2f, 0xb7482436, 0x741b091d, + 0x352a1204, 0xf2bc534b, 0xb38d4852, 0x70de6579, 0x31ef7e60, + 0xfef3e6e7, 0xbfc2fdfe, 0x7c91d0d5, 0x3da0cbcc, 0xfa368a83, + 0xbb07919a, 0x7854bcb1, 0x3965a7a8, 0x4b98833b, 0x0aa99822, + 0xc9fab509, 0x88cbae10, 0x4f5def5f, 0x0e6cf446, 0xcd3fd96d, + 0x8c0ec274, 0x43125af3, 0x022341ea, 0xc1706cc1, 0x804177d8, + 0x47d73697, 0x06e62d8e, 0xc5b500a5, 0x84841bbc, 0x1a8a4171, + 0x5bbb5a68, 0x98e87743, 0xd9d96c5a, 0x1e4f2d15, 0x5f7e360c, + 0x9c2d1b27, 0xdd1c003e, 0x120098b9, 0x533183a0, 0x9062ae8b, + 0xd153b592, 0x16c5f4dd, 0x57f4efc4, 0x94a7c2ef, 0xd596d9f6, + 0xe9bc07ae, 0xa88d1cb7, 0x6bde319c, 0x2aef2a85, 0xed796bca, + 0xac4870d3, 0x6f1b5df8, 0x2e2a46e1, 0xe136de66, 0xa007c57f, + 0x6354e854, 0x2265f34d, 0xe5f3b202, 0xa4c2a91b, 0x67918430, + 0x26a09f29, 0xb8aec5e4, 0xf99fdefd, 0x3accf3d6, 0x7bfde8cf, + 0xbc6ba980, 0xfd5ab299, 0x3e099fb2, 0x7f3884ab, 0xb0241c2c, + 0xf1150735, 0x32462a1e, 0x73773107, 0xb4e17048, 0xf5d06b51, + 0x3683467a, 0x77b25d63, 0x4ed7facb, 0x0fe6e1d2, 0xccb5ccf9, + 0x8d84d7e0, 0x4a1296af, 0x0b238db6, 0xc870a09d, 0x8941bb84, + 0x465d2303, 0x076c381a, 0xc43f1531, 0x850e0e28, 0x42984f67, + 0x03a9547e, 0xc0fa7955, 0x81cb624c, 0x1fc53881, 0x5ef42398, + 0x9da70eb3, 0xdc9615aa, 0x1b0054e5, 0x5a314ffc, 0x996262d7, + 0xd85379ce, 0x174fe149, 0x567efa50, 0x952dd77b, 0xd41ccc62, + 0x138a8d2d, 0x52bb9634, 0x91e8bb1f, 0xd0d9a006, 0xecf37e5e, + 0xadc26547, 0x6e91486c, 0x2fa05375, 0xe836123a, 0xa9070923, + 0x6a542408, 0x2b653f11, 0xe479a796, 0xa548bc8f, 0x661b91a4, + 0x272a8abd, 0xe0bccbf2, 0xa18dd0eb, 0x62defdc0, 0x23efe6d9, + 0xbde1bc14, 0xfcd0a70d, 0x3f838a26, 0x7eb2913f, 0xb924d070, + 0xf815cb69, 0x3b46e642, 0x7a77fd5b, 0xb56b65dc, 0xf45a7ec5, + 0x370953ee, 0x763848f7, 0xb1ae09b8, 0xf09f12a1, 0x33cc3f8a, + 0x72fd2493}, + {0x00000000, 0x376ac201, 0x6ed48403, 0x59be4602, 0xdca80907, + 0xebc2cb06, 0xb27c8d04, 0x85164f05, 0xb851130e, 0x8f3bd10f, + 0xd685970d, 0xe1ef550c, 0x64f91a09, 0x5393d808, 0x0a2d9e0a, + 0x3d475c0b, 0x70a3261c, 0x47c9e41d, 0x1e77a21f, 0x291d601e, + 0xac0b2f1b, 0x9b61ed1a, 0xc2dfab18, 0xf5b56919, 0xc8f23512, + 0xff98f713, 0xa626b111, 0x914c7310, 0x145a3c15, 0x2330fe14, + 0x7a8eb816, 0x4de47a17, 0xe0464d38, 0xd72c8f39, 0x8e92c93b, + 0xb9f80b3a, 0x3cee443f, 0x0b84863e, 0x523ac03c, 0x6550023d, + 0x58175e36, 0x6f7d9c37, 0x36c3da35, 0x01a91834, 0x84bf5731, + 0xb3d59530, 0xea6bd332, 0xdd011133, 0x90e56b24, 0xa78fa925, + 0xfe31ef27, 0xc95b2d26, 0x4c4d6223, 0x7b27a022, 0x2299e620, + 0x15f32421, 0x28b4782a, 0x1fdeba2b, 0x4660fc29, 0x710a3e28, + 0xf41c712d, 0xc376b32c, 0x9ac8f52e, 0xada2372f, 0xc08d9a70, + 0xf7e75871, 0xae591e73, 0x9933dc72, 0x1c259377, 0x2b4f5176, + 0x72f11774, 0x459bd575, 0x78dc897e, 0x4fb64b7f, 0x16080d7d, + 0x2162cf7c, 0xa4748079, 0x931e4278, 0xcaa0047a, 0xfdcac67b, + 0xb02ebc6c, 0x87447e6d, 0xdefa386f, 0xe990fa6e, 0x6c86b56b, + 0x5bec776a, 0x02523168, 0x3538f369, 0x087faf62, 0x3f156d63, + 0x66ab2b61, 0x51c1e960, 0xd4d7a665, 0xe3bd6464, 0xba032266, + 0x8d69e067, 0x20cbd748, 0x17a11549, 0x4e1f534b, 0x7975914a, + 0xfc63de4f, 0xcb091c4e, 0x92b75a4c, 0xa5dd984d, 0x989ac446, + 0xaff00647, 0xf64e4045, 0xc1248244, 0x4432cd41, 0x73580f40, + 0x2ae64942, 0x1d8c8b43, 0x5068f154, 0x67023355, 0x3ebc7557, + 0x09d6b756, 0x8cc0f853, 0xbbaa3a52, 0xe2147c50, 0xd57ebe51, + 0xe839e25a, 0xdf53205b, 0x86ed6659, 0xb187a458, 0x3491eb5d, + 0x03fb295c, 0x5a456f5e, 0x6d2fad5f, 0x801b35e1, 0xb771f7e0, + 0xeecfb1e2, 0xd9a573e3, 0x5cb33ce6, 0x6bd9fee7, 0x3267b8e5, + 0x050d7ae4, 0x384a26ef, 0x0f20e4ee, 0x569ea2ec, 0x61f460ed, + 0xe4e22fe8, 0xd388ede9, 0x8a36abeb, 0xbd5c69ea, 0xf0b813fd, + 0xc7d2d1fc, 0x9e6c97fe, 0xa90655ff, 0x2c101afa, 0x1b7ad8fb, + 0x42c49ef9, 0x75ae5cf8, 0x48e900f3, 0x7f83c2f2, 0x263d84f0, + 0x115746f1, 0x944109f4, 0xa32bcbf5, 0xfa958df7, 0xcdff4ff6, + 0x605d78d9, 0x5737bad8, 0x0e89fcda, 0x39e33edb, 0xbcf571de, + 0x8b9fb3df, 0xd221f5dd, 0xe54b37dc, 0xd80c6bd7, 0xef66a9d6, + 0xb6d8efd4, 0x81b22dd5, 0x04a462d0, 0x33cea0d1, 0x6a70e6d3, + 0x5d1a24d2, 0x10fe5ec5, 0x27949cc4, 0x7e2adac6, 0x494018c7, + 0xcc5657c2, 0xfb3c95c3, 0xa282d3c1, 0x95e811c0, 0xa8af4dcb, + 0x9fc58fca, 0xc67bc9c8, 0xf1110bc9, 0x740744cc, 0x436d86cd, + 0x1ad3c0cf, 0x2db902ce, 0x4096af91, 0x77fc6d90, 0x2e422b92, + 0x1928e993, 0x9c3ea696, 0xab546497, 0xf2ea2295, 0xc580e094, + 0xf8c7bc9f, 0xcfad7e9e, 0x9613389c, 0xa179fa9d, 0x246fb598, + 0x13057799, 0x4abb319b, 0x7dd1f39a, 0x3035898d, 0x075f4b8c, + 0x5ee10d8e, 0x698bcf8f, 0xec9d808a, 0xdbf7428b, 0x82490489, + 0xb523c688, 0x88649a83, 0xbf0e5882, 0xe6b01e80, 0xd1dadc81, + 0x54cc9384, 0x63a65185, 0x3a181787, 0x0d72d586, 0xa0d0e2a9, + 0x97ba20a8, 0xce0466aa, 0xf96ea4ab, 0x7c78ebae, 0x4b1229af, + 0x12ac6fad, 0x25c6adac, 0x1881f1a7, 0x2feb33a6, 0x765575a4, + 0x413fb7a5, 0xc429f8a0, 0xf3433aa1, 0xaafd7ca3, 0x9d97bea2, + 0xd073c4b5, 0xe71906b4, 0xbea740b6, 0x89cd82b7, 0x0cdbcdb2, + 0x3bb10fb3, 0x620f49b1, 0x55658bb0, 0x6822d7bb, 0x5f4815ba, + 0x06f653b8, 0x319c91b9, 0xb48adebc, 0x83e01cbd, 0xda5e5abf, + 0xed3498be}, + {0x00000000, 0x6567bcb8, 0x8bc809aa, 0xeeafb512, 0x5797628f, + 0x32f0de37, 0xdc5f6b25, 0xb938d79d, 0xef28b4c5, 0x8a4f087d, + 0x64e0bd6f, 0x018701d7, 0xb8bfd64a, 0xddd86af2, 0x3377dfe0, + 0x56106358, 0x9f571950, 0xfa30a5e8, 0x149f10fa, 0x71f8ac42, + 0xc8c07bdf, 0xada7c767, 0x43087275, 0x266fcecd, 0x707fad95, + 0x1518112d, 0xfbb7a43f, 0x9ed01887, 0x27e8cf1a, 0x428f73a2, + 0xac20c6b0, 0xc9477a08, 0x3eaf32a0, 0x5bc88e18, 0xb5673b0a, + 0xd00087b2, 0x6938502f, 0x0c5fec97, 0xe2f05985, 0x8797e53d, + 0xd1878665, 0xb4e03add, 0x5a4f8fcf, 0x3f283377, 0x8610e4ea, + 0xe3775852, 0x0dd8ed40, 0x68bf51f8, 0xa1f82bf0, 0xc49f9748, + 0x2a30225a, 0x4f579ee2, 0xf66f497f, 0x9308f5c7, 0x7da740d5, + 0x18c0fc6d, 0x4ed09f35, 0x2bb7238d, 0xc518969f, 0xa07f2a27, + 0x1947fdba, 0x7c204102, 0x928ff410, 0xf7e848a8, 0x3d58149b, + 0x583fa823, 0xb6901d31, 0xd3f7a189, 0x6acf7614, 0x0fa8caac, + 0xe1077fbe, 0x8460c306, 0xd270a05e, 0xb7171ce6, 0x59b8a9f4, + 0x3cdf154c, 0x85e7c2d1, 0xe0807e69, 0x0e2fcb7b, 0x6b4877c3, + 0xa20f0dcb, 0xc768b173, 0x29c70461, 0x4ca0b8d9, 0xf5986f44, + 0x90ffd3fc, 0x7e5066ee, 0x1b37da56, 0x4d27b90e, 0x284005b6, + 0xc6efb0a4, 0xa3880c1c, 0x1ab0db81, 0x7fd76739, 0x9178d22b, + 0xf41f6e93, 0x03f7263b, 0x66909a83, 0x883f2f91, 0xed589329, + 0x546044b4, 0x3107f80c, 0xdfa84d1e, 0xbacff1a6, 0xecdf92fe, + 0x89b82e46, 0x67179b54, 0x027027ec, 0xbb48f071, 0xde2f4cc9, + 0x3080f9db, 0x55e74563, 0x9ca03f6b, 0xf9c783d3, 0x176836c1, + 0x720f8a79, 0xcb375de4, 0xae50e15c, 0x40ff544e, 0x2598e8f6, + 0x73888bae, 0x16ef3716, 0xf8408204, 0x9d273ebc, 0x241fe921, + 0x41785599, 0xafd7e08b, 0xcab05c33, 0x3bb659ed, 0x5ed1e555, + 0xb07e5047, 0xd519ecff, 0x6c213b62, 0x094687da, 0xe7e932c8, + 0x828e8e70, 0xd49eed28, 0xb1f95190, 0x5f56e482, 0x3a31583a, + 0x83098fa7, 0xe66e331f, 0x08c1860d, 0x6da63ab5, 0xa4e140bd, + 0xc186fc05, 0x2f294917, 0x4a4ef5af, 0xf3762232, 0x96119e8a, + 0x78be2b98, 0x1dd99720, 0x4bc9f478, 0x2eae48c0, 0xc001fdd2, + 0xa566416a, 0x1c5e96f7, 0x79392a4f, 0x97969f5d, 0xf2f123e5, + 0x05196b4d, 0x607ed7f5, 0x8ed162e7, 0xebb6de5f, 0x528e09c2, + 0x37e9b57a, 0xd9460068, 0xbc21bcd0, 0xea31df88, 0x8f566330, + 0x61f9d622, 0x049e6a9a, 0xbda6bd07, 0xd8c101bf, 0x366eb4ad, + 0x53090815, 0x9a4e721d, 0xff29cea5, 0x11867bb7, 0x74e1c70f, + 0xcdd91092, 0xa8beac2a, 0x46111938, 0x2376a580, 0x7566c6d8, + 0x10017a60, 0xfeaecf72, 0x9bc973ca, 0x22f1a457, 0x479618ef, + 0xa939adfd, 0xcc5e1145, 0x06ee4d76, 0x6389f1ce, 0x8d2644dc, + 0xe841f864, 0x51792ff9, 0x341e9341, 0xdab12653, 0xbfd69aeb, + 0xe9c6f9b3, 0x8ca1450b, 0x620ef019, 0x07694ca1, 0xbe519b3c, + 0xdb362784, 0x35999296, 0x50fe2e2e, 0x99b95426, 0xfcdee89e, + 0x12715d8c, 0x7716e134, 0xce2e36a9, 0xab498a11, 0x45e63f03, + 0x208183bb, 0x7691e0e3, 0x13f65c5b, 0xfd59e949, 0x983e55f1, + 0x2106826c, 0x44613ed4, 0xaace8bc6, 0xcfa9377e, 0x38417fd6, + 0x5d26c36e, 0xb389767c, 0xd6eecac4, 0x6fd61d59, 0x0ab1a1e1, + 0xe41e14f3, 0x8179a84b, 0xd769cb13, 0xb20e77ab, 0x5ca1c2b9, + 0x39c67e01, 0x80fea99c, 0xe5991524, 0x0b36a036, 0x6e511c8e, + 0xa7166686, 0xc271da3e, 0x2cde6f2c, 0x49b9d394, 0xf0810409, + 0x95e6b8b1, 0x7b490da3, 0x1e2eb11b, 0x483ed243, 0x2d596efb, + 0xc3f6dbe9, 0xa6916751, 0x1fa9b0cc, 0x7ace0c74, 0x9461b966, + 0xf10605de}}; + +#endif + +#endif + +#if N == 2 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xae689191, 0x87a02563, 0x29c8b4f2, 0xd4314c87, + 0x7a59dd16, 0x539169e4, 0xfdf9f875, 0x73139f4f, 0xdd7b0ede, + 0xf4b3ba2c, 0x5adb2bbd, 0xa722d3c8, 0x094a4259, 0x2082f6ab, + 0x8eea673a, 0xe6273e9e, 0x484faf0f, 0x61871bfd, 0xcfef8a6c, + 0x32167219, 0x9c7ee388, 0xb5b6577a, 0x1bdec6eb, 0x9534a1d1, + 0x3b5c3040, 0x129484b2, 0xbcfc1523, 0x4105ed56, 0xef6d7cc7, + 0xc6a5c835, 0x68cd59a4, 0x173f7b7d, 0xb957eaec, 0x909f5e1e, + 0x3ef7cf8f, 0xc30e37fa, 0x6d66a66b, 0x44ae1299, 0xeac68308, + 0x642ce432, 0xca4475a3, 0xe38cc151, 0x4de450c0, 0xb01da8b5, + 0x1e753924, 0x37bd8dd6, 0x99d51c47, 0xf11845e3, 0x5f70d472, + 0x76b86080, 0xd8d0f111, 0x25290964, 0x8b4198f5, 0xa2892c07, + 0x0ce1bd96, 0x820bdaac, 0x2c634b3d, 0x05abffcf, 0xabc36e5e, + 0x563a962b, 0xf85207ba, 0xd19ab348, 0x7ff222d9, 0x2e7ef6fa, + 0x8016676b, 0xa9ded399, 0x07b64208, 0xfa4fba7d, 0x54272bec, + 0x7def9f1e, 0xd3870e8f, 0x5d6d69b5, 0xf305f824, 0xdacd4cd6, + 0x74a5dd47, 0x895c2532, 0x2734b4a3, 0x0efc0051, 0xa09491c0, + 0xc859c864, 0x663159f5, 0x4ff9ed07, 0xe1917c96, 0x1c6884e3, + 0xb2001572, 0x9bc8a180, 0x35a03011, 0xbb4a572b, 0x1522c6ba, + 0x3cea7248, 0x9282e3d9, 0x6f7b1bac, 0xc1138a3d, 0xe8db3ecf, + 0x46b3af5e, 0x39418d87, 0x97291c16, 0xbee1a8e4, 0x10893975, + 0xed70c100, 0x43185091, 0x6ad0e463, 0xc4b875f2, 0x4a5212c8, + 0xe43a8359, 0xcdf237ab, 0x639aa63a, 0x9e635e4f, 0x300bcfde, + 0x19c37b2c, 0xb7abeabd, 0xdf66b319, 0x710e2288, 0x58c6967a, + 0xf6ae07eb, 0x0b57ff9e, 0xa53f6e0f, 0x8cf7dafd, 0x229f4b6c, + 0xac752c56, 0x021dbdc7, 0x2bd50935, 0x85bd98a4, 0x784460d1, + 0xd62cf140, 0xffe445b2, 0x518cd423, 0x5cfdedf4, 0xf2957c65, + 0xdb5dc897, 0x75355906, 0x88cca173, 0x26a430e2, 0x0f6c8410, + 0xa1041581, 0x2fee72bb, 0x8186e32a, 0xa84e57d8, 0x0626c649, + 0xfbdf3e3c, 0x55b7afad, 0x7c7f1b5f, 0xd2178ace, 0xbadad36a, + 0x14b242fb, 0x3d7af609, 0x93126798, 0x6eeb9fed, 0xc0830e7c, + 0xe94bba8e, 0x47232b1f, 0xc9c94c25, 0x67a1ddb4, 0x4e696946, + 0xe001f8d7, 0x1df800a2, 0xb3909133, 0x9a5825c1, 0x3430b450, + 0x4bc29689, 0xe5aa0718, 0xcc62b3ea, 0x620a227b, 0x9ff3da0e, + 0x319b4b9f, 0x1853ff6d, 0xb63b6efc, 0x38d109c6, 0x96b99857, + 0xbf712ca5, 0x1119bd34, 0xece04541, 0x4288d4d0, 0x6b406022, + 0xc528f1b3, 0xade5a817, 0x038d3986, 0x2a458d74, 0x842d1ce5, + 0x79d4e490, 0xd7bc7501, 0xfe74c1f3, 0x501c5062, 0xdef63758, + 0x709ea6c9, 0x5956123b, 0xf73e83aa, 0x0ac77bdf, 0xa4afea4e, + 0x8d675ebc, 0x230fcf2d, 0x72831b0e, 0xdceb8a9f, 0xf5233e6d, + 0x5b4baffc, 0xa6b25789, 0x08dac618, 0x211272ea, 0x8f7ae37b, + 0x01908441, 0xaff815d0, 0x8630a122, 0x285830b3, 0xd5a1c8c6, + 0x7bc95957, 0x5201eda5, 0xfc697c34, 0x94a42590, 0x3accb401, + 0x130400f3, 0xbd6c9162, 0x40956917, 0xeefdf886, 0xc7354c74, + 0x695ddde5, 0xe7b7badf, 0x49df2b4e, 0x60179fbc, 0xce7f0e2d, + 0x3386f658, 0x9dee67c9, 0xb426d33b, 0x1a4e42aa, 0x65bc6073, + 0xcbd4f1e2, 0xe21c4510, 0x4c74d481, 0xb18d2cf4, 0x1fe5bd65, + 0x362d0997, 0x98459806, 0x16afff3c, 0xb8c76ead, 0x910fda5f, + 0x3f674bce, 0xc29eb3bb, 0x6cf6222a, 0x453e96d8, 0xeb560749, + 0x839b5eed, 0x2df3cf7c, 0x043b7b8e, 0xaa53ea1f, 0x57aa126a, + 0xf9c283fb, 0xd00a3709, 0x7e62a698, 0xf088c1a2, 0x5ee05033, + 0x7728e4c1, 0xd9407550, 0x24b98d25, 0x8ad11cb4, 0xa319a846, + 0x0d7139d7}, + {0x00000000, 0xb9fbdbe8, 0xa886b191, 0x117d6a79, 0x8a7c6563, + 0x3387be8b, 0x22fad4f2, 0x9b010f1a, 0xcf89cc87, 0x7672176f, + 0x670f7d16, 0xdef4a6fe, 0x45f5a9e4, 0xfc0e720c, 0xed731875, + 0x5488c39d, 0x44629f4f, 0xfd9944a7, 0xece42ede, 0x551ff536, + 0xce1efa2c, 0x77e521c4, 0x66984bbd, 0xdf639055, 0x8beb53c8, + 0x32108820, 0x236de259, 0x9a9639b1, 0x019736ab, 0xb86ced43, + 0xa911873a, 0x10ea5cd2, 0x88c53e9e, 0x313ee576, 0x20438f0f, + 0x99b854e7, 0x02b95bfd, 0xbb428015, 0xaa3fea6c, 0x13c43184, + 0x474cf219, 0xfeb729f1, 0xefca4388, 0x56319860, 0xcd30977a, + 0x74cb4c92, 0x65b626eb, 0xdc4dfd03, 0xcca7a1d1, 0x755c7a39, + 0x64211040, 0xdddacba8, 0x46dbc4b2, 0xff201f5a, 0xee5d7523, + 0x57a6aecb, 0x032e6d56, 0xbad5b6be, 0xaba8dcc7, 0x1253072f, + 0x89520835, 0x30a9d3dd, 0x21d4b9a4, 0x982f624c, 0xcafb7b7d, + 0x7300a095, 0x627dcaec, 0xdb861104, 0x40871e1e, 0xf97cc5f6, + 0xe801af8f, 0x51fa7467, 0x0572b7fa, 0xbc896c12, 0xadf4066b, + 0x140fdd83, 0x8f0ed299, 0x36f50971, 0x27886308, 0x9e73b8e0, + 0x8e99e432, 0x37623fda, 0x261f55a3, 0x9fe48e4b, 0x04e58151, + 0xbd1e5ab9, 0xac6330c0, 0x1598eb28, 0x411028b5, 0xf8ebf35d, + 0xe9969924, 0x506d42cc, 0xcb6c4dd6, 0x7297963e, 0x63eafc47, + 0xda1127af, 0x423e45e3, 0xfbc59e0b, 0xeab8f472, 0x53432f9a, + 0xc8422080, 0x71b9fb68, 0x60c49111, 0xd93f4af9, 0x8db78964, + 0x344c528c, 0x253138f5, 0x9ccae31d, 0x07cbec07, 0xbe3037ef, + 0xaf4d5d96, 0x16b6867e, 0x065cdaac, 0xbfa70144, 0xaeda6b3d, + 0x1721b0d5, 0x8c20bfcf, 0x35db6427, 0x24a60e5e, 0x9d5dd5b6, + 0xc9d5162b, 0x702ecdc3, 0x6153a7ba, 0xd8a87c52, 0x43a97348, + 0xfa52a8a0, 0xeb2fc2d9, 0x52d41931, 0x4e87f0bb, 0xf77c2b53, + 0xe601412a, 0x5ffa9ac2, 0xc4fb95d8, 0x7d004e30, 0x6c7d2449, + 0xd586ffa1, 0x810e3c3c, 0x38f5e7d4, 0x29888dad, 0x90735645, + 0x0b72595f, 0xb28982b7, 0xa3f4e8ce, 0x1a0f3326, 0x0ae56ff4, + 0xb31eb41c, 0xa263de65, 0x1b98058d, 0x80990a97, 0x3962d17f, + 0x281fbb06, 0x91e460ee, 0xc56ca373, 0x7c97789b, 0x6dea12e2, + 0xd411c90a, 0x4f10c610, 0xf6eb1df8, 0xe7967781, 0x5e6dac69, + 0xc642ce25, 0x7fb915cd, 0x6ec47fb4, 0xd73fa45c, 0x4c3eab46, + 0xf5c570ae, 0xe4b81ad7, 0x5d43c13f, 0x09cb02a2, 0xb030d94a, + 0xa14db333, 0x18b668db, 0x83b767c1, 0x3a4cbc29, 0x2b31d650, + 0x92ca0db8, 0x8220516a, 0x3bdb8a82, 0x2aa6e0fb, 0x935d3b13, + 0x085c3409, 0xb1a7efe1, 0xa0da8598, 0x19215e70, 0x4da99ded, + 0xf4524605, 0xe52f2c7c, 0x5cd4f794, 0xc7d5f88e, 0x7e2e2366, + 0x6f53491f, 0xd6a892f7, 0x847c8bc6, 0x3d87502e, 0x2cfa3a57, + 0x9501e1bf, 0x0e00eea5, 0xb7fb354d, 0xa6865f34, 0x1f7d84dc, + 0x4bf54741, 0xf20e9ca9, 0xe373f6d0, 0x5a882d38, 0xc1892222, + 0x7872f9ca, 0x690f93b3, 0xd0f4485b, 0xc01e1489, 0x79e5cf61, + 0x6898a518, 0xd1637ef0, 0x4a6271ea, 0xf399aa02, 0xe2e4c07b, + 0x5b1f1b93, 0x0f97d80e, 0xb66c03e6, 0xa711699f, 0x1eeab277, + 0x85ebbd6d, 0x3c106685, 0x2d6d0cfc, 0x9496d714, 0x0cb9b558, + 0xb5426eb0, 0xa43f04c9, 0x1dc4df21, 0x86c5d03b, 0x3f3e0bd3, + 0x2e4361aa, 0x97b8ba42, 0xc33079df, 0x7acba237, 0x6bb6c84e, + 0xd24d13a6, 0x494c1cbc, 0xf0b7c754, 0xe1caad2d, 0x583176c5, + 0x48db2a17, 0xf120f1ff, 0xe05d9b86, 0x59a6406e, 0xc2a74f74, + 0x7b5c949c, 0x6a21fee5, 0xd3da250d, 0x8752e690, 0x3ea93d78, + 0x2fd45701, 0x962f8ce9, 0x0d2e83f3, 0xb4d5581b, 0xa5a83262, + 0x1c53e98a}, + {0x00000000, 0x9d0fe176, 0xe16ec4ad, 0x7c6125db, 0x19ac8f1b, + 0x84a36e6d, 0xf8c24bb6, 0x65cdaac0, 0x33591e36, 0xae56ff40, + 0xd237da9b, 0x4f383bed, 0x2af5912d, 0xb7fa705b, 0xcb9b5580, + 0x5694b4f6, 0x66b23c6c, 0xfbbddd1a, 0x87dcf8c1, 0x1ad319b7, + 0x7f1eb377, 0xe2115201, 0x9e7077da, 0x037f96ac, 0x55eb225a, + 0xc8e4c32c, 0xb485e6f7, 0x298a0781, 0x4c47ad41, 0xd1484c37, + 0xad2969ec, 0x3026889a, 0xcd6478d8, 0x506b99ae, 0x2c0abc75, + 0xb1055d03, 0xd4c8f7c3, 0x49c716b5, 0x35a6336e, 0xa8a9d218, + 0xfe3d66ee, 0x63328798, 0x1f53a243, 0x825c4335, 0xe791e9f5, + 0x7a9e0883, 0x06ff2d58, 0x9bf0cc2e, 0xabd644b4, 0x36d9a5c2, + 0x4ab88019, 0xd7b7616f, 0xb27acbaf, 0x2f752ad9, 0x53140f02, + 0xce1bee74, 0x988f5a82, 0x0580bbf4, 0x79e19e2f, 0xe4ee7f59, + 0x8123d599, 0x1c2c34ef, 0x604d1134, 0xfd42f042, 0x41b9f7f1, + 0xdcb61687, 0xa0d7335c, 0x3dd8d22a, 0x581578ea, 0xc51a999c, + 0xb97bbc47, 0x24745d31, 0x72e0e9c7, 0xefef08b1, 0x938e2d6a, + 0x0e81cc1c, 0x6b4c66dc, 0xf64387aa, 0x8a22a271, 0x172d4307, + 0x270bcb9d, 0xba042aeb, 0xc6650f30, 0x5b6aee46, 0x3ea74486, + 0xa3a8a5f0, 0xdfc9802b, 0x42c6615d, 0x1452d5ab, 0x895d34dd, + 0xf53c1106, 0x6833f070, 0x0dfe5ab0, 0x90f1bbc6, 0xec909e1d, + 0x719f7f6b, 0x8cdd8f29, 0x11d26e5f, 0x6db34b84, 0xf0bcaaf2, + 0x95710032, 0x087ee144, 0x741fc49f, 0xe91025e9, 0xbf84911f, + 0x228b7069, 0x5eea55b2, 0xc3e5b4c4, 0xa6281e04, 0x3b27ff72, + 0x4746daa9, 0xda493bdf, 0xea6fb345, 0x77605233, 0x0b0177e8, + 0x960e969e, 0xf3c33c5e, 0x6eccdd28, 0x12adf8f3, 0x8fa21985, + 0xd936ad73, 0x44394c05, 0x385869de, 0xa55788a8, 0xc09a2268, + 0x5d95c31e, 0x21f4e6c5, 0xbcfb07b3, 0x8373efe2, 0x1e7c0e94, + 0x621d2b4f, 0xff12ca39, 0x9adf60f9, 0x07d0818f, 0x7bb1a454, + 0xe6be4522, 0xb02af1d4, 0x2d2510a2, 0x51443579, 0xcc4bd40f, + 0xa9867ecf, 0x34899fb9, 0x48e8ba62, 0xd5e75b14, 0xe5c1d38e, + 0x78ce32f8, 0x04af1723, 0x99a0f655, 0xfc6d5c95, 0x6162bde3, + 0x1d039838, 0x800c794e, 0xd698cdb8, 0x4b972cce, 0x37f60915, + 0xaaf9e863, 0xcf3442a3, 0x523ba3d5, 0x2e5a860e, 0xb3556778, + 0x4e17973a, 0xd318764c, 0xaf795397, 0x3276b2e1, 0x57bb1821, + 0xcab4f957, 0xb6d5dc8c, 0x2bda3dfa, 0x7d4e890c, 0xe041687a, + 0x9c204da1, 0x012facd7, 0x64e20617, 0xf9ede761, 0x858cc2ba, + 0x188323cc, 0x28a5ab56, 0xb5aa4a20, 0xc9cb6ffb, 0x54c48e8d, + 0x3109244d, 0xac06c53b, 0xd067e0e0, 0x4d680196, 0x1bfcb560, + 0x86f35416, 0xfa9271cd, 0x679d90bb, 0x02503a7b, 0x9f5fdb0d, + 0xe33efed6, 0x7e311fa0, 0xc2ca1813, 0x5fc5f965, 0x23a4dcbe, + 0xbeab3dc8, 0xdb669708, 0x4669767e, 0x3a0853a5, 0xa707b2d3, + 0xf1930625, 0x6c9ce753, 0x10fdc288, 0x8df223fe, 0xe83f893e, + 0x75306848, 0x09514d93, 0x945eace5, 0xa478247f, 0x3977c509, + 0x4516e0d2, 0xd81901a4, 0xbdd4ab64, 0x20db4a12, 0x5cba6fc9, + 0xc1b58ebf, 0x97213a49, 0x0a2edb3f, 0x764ffee4, 0xeb401f92, + 0x8e8db552, 0x13825424, 0x6fe371ff, 0xf2ec9089, 0x0fae60cb, + 0x92a181bd, 0xeec0a466, 0x73cf4510, 0x1602efd0, 0x8b0d0ea6, + 0xf76c2b7d, 0x6a63ca0b, 0x3cf77efd, 0xa1f89f8b, 0xdd99ba50, + 0x40965b26, 0x255bf1e6, 0xb8541090, 0xc435354b, 0x593ad43d, + 0x691c5ca7, 0xf413bdd1, 0x8872980a, 0x157d797c, 0x70b0d3bc, + 0xedbf32ca, 0x91de1711, 0x0cd1f667, 0x5a454291, 0xc74aa3e7, + 0xbb2b863c, 0x2624674a, 0x43e9cd8a, 0xdee62cfc, 0xa2870927, + 0x3f88e851}, + {0x00000000, 0xdd96d985, 0x605cb54b, 0xbdca6cce, 0xc0b96a96, + 0x1d2fb313, 0xa0e5dfdd, 0x7d730658, 0x5a03d36d, 0x87950ae8, + 0x3a5f6626, 0xe7c9bfa3, 0x9abab9fb, 0x472c607e, 0xfae60cb0, + 0x2770d535, 0xb407a6da, 0x69917f5f, 0xd45b1391, 0x09cdca14, + 0x74becc4c, 0xa92815c9, 0x14e27907, 0xc974a082, 0xee0475b7, + 0x3392ac32, 0x8e58c0fc, 0x53ce1979, 0x2ebd1f21, 0xf32bc6a4, + 0x4ee1aa6a, 0x937773ef, 0xb37e4bf5, 0x6ee89270, 0xd322febe, + 0x0eb4273b, 0x73c72163, 0xae51f8e6, 0x139b9428, 0xce0d4dad, + 0xe97d9898, 0x34eb411d, 0x89212dd3, 0x54b7f456, 0x29c4f20e, + 0xf4522b8b, 0x49984745, 0x940e9ec0, 0x0779ed2f, 0xdaef34aa, + 0x67255864, 0xbab381e1, 0xc7c087b9, 0x1a565e3c, 0xa79c32f2, + 0x7a0aeb77, 0x5d7a3e42, 0x80ece7c7, 0x3d268b09, 0xe0b0528c, + 0x9dc354d4, 0x40558d51, 0xfd9fe19f, 0x2009381a, 0xbd8d91ab, + 0x601b482e, 0xddd124e0, 0x0047fd65, 0x7d34fb3d, 0xa0a222b8, + 0x1d684e76, 0xc0fe97f3, 0xe78e42c6, 0x3a189b43, 0x87d2f78d, + 0x5a442e08, 0x27372850, 0xfaa1f1d5, 0x476b9d1b, 0x9afd449e, + 0x098a3771, 0xd41ceef4, 0x69d6823a, 0xb4405bbf, 0xc9335de7, + 0x14a58462, 0xa96fe8ac, 0x74f93129, 0x5389e41c, 0x8e1f3d99, + 0x33d55157, 0xee4388d2, 0x93308e8a, 0x4ea6570f, 0xf36c3bc1, + 0x2efae244, 0x0ef3da5e, 0xd36503db, 0x6eaf6f15, 0xb339b690, + 0xce4ab0c8, 0x13dc694d, 0xae160583, 0x7380dc06, 0x54f00933, + 0x8966d0b6, 0x34acbc78, 0xe93a65fd, 0x944963a5, 0x49dfba20, + 0xf415d6ee, 0x29830f6b, 0xbaf47c84, 0x6762a501, 0xdaa8c9cf, + 0x073e104a, 0x7a4d1612, 0xa7dbcf97, 0x1a11a359, 0xc7877adc, + 0xe0f7afe9, 0x3d61766c, 0x80ab1aa2, 0x5d3dc327, 0x204ec57f, + 0xfdd81cfa, 0x40127034, 0x9d84a9b1, 0xa06a2517, 0x7dfcfc92, + 0xc036905c, 0x1da049d9, 0x60d34f81, 0xbd459604, 0x008ffaca, + 0xdd19234f, 0xfa69f67a, 0x27ff2fff, 0x9a354331, 0x47a39ab4, + 0x3ad09cec, 0xe7464569, 0x5a8c29a7, 0x871af022, 0x146d83cd, + 0xc9fb5a48, 0x74313686, 0xa9a7ef03, 0xd4d4e95b, 0x094230de, + 0xb4885c10, 0x691e8595, 0x4e6e50a0, 0x93f88925, 0x2e32e5eb, + 0xf3a43c6e, 0x8ed73a36, 0x5341e3b3, 0xee8b8f7d, 0x331d56f8, + 0x13146ee2, 0xce82b767, 0x7348dba9, 0xaede022c, 0xd3ad0474, + 0x0e3bddf1, 0xb3f1b13f, 0x6e6768ba, 0x4917bd8f, 0x9481640a, + 0x294b08c4, 0xf4ddd141, 0x89aed719, 0x54380e9c, 0xe9f26252, + 0x3464bbd7, 0xa713c838, 0x7a8511bd, 0xc74f7d73, 0x1ad9a4f6, + 0x67aaa2ae, 0xba3c7b2b, 0x07f617e5, 0xda60ce60, 0xfd101b55, + 0x2086c2d0, 0x9d4cae1e, 0x40da779b, 0x3da971c3, 0xe03fa846, + 0x5df5c488, 0x80631d0d, 0x1de7b4bc, 0xc0716d39, 0x7dbb01f7, + 0xa02dd872, 0xdd5ede2a, 0x00c807af, 0xbd026b61, 0x6094b2e4, + 0x47e467d1, 0x9a72be54, 0x27b8d29a, 0xfa2e0b1f, 0x875d0d47, + 0x5acbd4c2, 0xe701b80c, 0x3a976189, 0xa9e01266, 0x7476cbe3, + 0xc9bca72d, 0x142a7ea8, 0x695978f0, 0xb4cfa175, 0x0905cdbb, + 0xd493143e, 0xf3e3c10b, 0x2e75188e, 0x93bf7440, 0x4e29adc5, + 0x335aab9d, 0xeecc7218, 0x53061ed6, 0x8e90c753, 0xae99ff49, + 0x730f26cc, 0xcec54a02, 0x13539387, 0x6e2095df, 0xb3b64c5a, + 0x0e7c2094, 0xd3eaf911, 0xf49a2c24, 0x290cf5a1, 0x94c6996f, + 0x495040ea, 0x342346b2, 0xe9b59f37, 0x547ff3f9, 0x89e92a7c, + 0x1a9e5993, 0xc7088016, 0x7ac2ecd8, 0xa754355d, 0xda273305, + 0x07b1ea80, 0xba7b864e, 0x67ed5fcb, 0x409d8afe, 0x9d0b537b, + 0x20c13fb5, 0xfd57e630, 0x8024e068, 0x5db239ed, 0xe0785523, + 0x3dee8ca6}, + {0x00000000, 0x9ba54c6f, 0xec3b9e9f, 0x779ed2f0, 0x03063b7f, + 0x98a37710, 0xef3da5e0, 0x7498e98f, 0x060c76fe, 0x9da93a91, + 0xea37e861, 0x7192a40e, 0x050a4d81, 0x9eaf01ee, 0xe931d31e, + 0x72949f71, 0x0c18edfc, 0x97bda193, 0xe0237363, 0x7b863f0c, + 0x0f1ed683, 0x94bb9aec, 0xe325481c, 0x78800473, 0x0a149b02, + 0x91b1d76d, 0xe62f059d, 0x7d8a49f2, 0x0912a07d, 0x92b7ec12, + 0xe5293ee2, 0x7e8c728d, 0x1831dbf8, 0x83949797, 0xf40a4567, + 0x6faf0908, 0x1b37e087, 0x8092ace8, 0xf70c7e18, 0x6ca93277, + 0x1e3dad06, 0x8598e169, 0xf2063399, 0x69a37ff6, 0x1d3b9679, + 0x869eda16, 0xf10008e6, 0x6aa54489, 0x14293604, 0x8f8c7a6b, + 0xf812a89b, 0x63b7e4f4, 0x172f0d7b, 0x8c8a4114, 0xfb1493e4, + 0x60b1df8b, 0x122540fa, 0x89800c95, 0xfe1ede65, 0x65bb920a, + 0x11237b85, 0x8a8637ea, 0xfd18e51a, 0x66bda975, 0x3063b7f0, + 0xabc6fb9f, 0xdc58296f, 0x47fd6500, 0x33658c8f, 0xa8c0c0e0, + 0xdf5e1210, 0x44fb5e7f, 0x366fc10e, 0xadca8d61, 0xda545f91, + 0x41f113fe, 0x3569fa71, 0xaeccb61e, 0xd95264ee, 0x42f72881, + 0x3c7b5a0c, 0xa7de1663, 0xd040c493, 0x4be588fc, 0x3f7d6173, + 0xa4d82d1c, 0xd346ffec, 0x48e3b383, 0x3a772cf2, 0xa1d2609d, + 0xd64cb26d, 0x4de9fe02, 0x3971178d, 0xa2d45be2, 0xd54a8912, + 0x4eefc57d, 0x28526c08, 0xb3f72067, 0xc469f297, 0x5fccbef8, + 0x2b545777, 0xb0f11b18, 0xc76fc9e8, 0x5cca8587, 0x2e5e1af6, + 0xb5fb5699, 0xc2658469, 0x59c0c806, 0x2d582189, 0xb6fd6de6, + 0xc163bf16, 0x5ac6f379, 0x244a81f4, 0xbfefcd9b, 0xc8711f6b, + 0x53d45304, 0x274cba8b, 0xbce9f6e4, 0xcb772414, 0x50d2687b, + 0x2246f70a, 0xb9e3bb65, 0xce7d6995, 0x55d825fa, 0x2140cc75, + 0xbae5801a, 0xcd7b52ea, 0x56de1e85, 0x60c76fe0, 0xfb62238f, + 0x8cfcf17f, 0x1759bd10, 0x63c1549f, 0xf86418f0, 0x8ffaca00, + 0x145f866f, 0x66cb191e, 0xfd6e5571, 0x8af08781, 0x1155cbee, + 0x65cd2261, 0xfe686e0e, 0x89f6bcfe, 0x1253f091, 0x6cdf821c, + 0xf77ace73, 0x80e41c83, 0x1b4150ec, 0x6fd9b963, 0xf47cf50c, + 0x83e227fc, 0x18476b93, 0x6ad3f4e2, 0xf176b88d, 0x86e86a7d, + 0x1d4d2612, 0x69d5cf9d, 0xf27083f2, 0x85ee5102, 0x1e4b1d6d, + 0x78f6b418, 0xe353f877, 0x94cd2a87, 0x0f6866e8, 0x7bf08f67, + 0xe055c308, 0x97cb11f8, 0x0c6e5d97, 0x7efac2e6, 0xe55f8e89, + 0x92c15c79, 0x09641016, 0x7dfcf999, 0xe659b5f6, 0x91c76706, + 0x0a622b69, 0x74ee59e4, 0xef4b158b, 0x98d5c77b, 0x03708b14, + 0x77e8629b, 0xec4d2ef4, 0x9bd3fc04, 0x0076b06b, 0x72e22f1a, + 0xe9476375, 0x9ed9b185, 0x057cfdea, 0x71e41465, 0xea41580a, + 0x9ddf8afa, 0x067ac695, 0x50a4d810, 0xcb01947f, 0xbc9f468f, + 0x273a0ae0, 0x53a2e36f, 0xc807af00, 0xbf997df0, 0x243c319f, + 0x56a8aeee, 0xcd0de281, 0xba933071, 0x21367c1e, 0x55ae9591, + 0xce0bd9fe, 0xb9950b0e, 0x22304761, 0x5cbc35ec, 0xc7197983, + 0xb087ab73, 0x2b22e71c, 0x5fba0e93, 0xc41f42fc, 0xb381900c, + 0x2824dc63, 0x5ab04312, 0xc1150f7d, 0xb68bdd8d, 0x2d2e91e2, + 0x59b6786d, 0xc2133402, 0xb58de6f2, 0x2e28aa9d, 0x489503e8, + 0xd3304f87, 0xa4ae9d77, 0x3f0bd118, 0x4b933897, 0xd03674f8, + 0xa7a8a608, 0x3c0dea67, 0x4e997516, 0xd53c3979, 0xa2a2eb89, + 0x3907a7e6, 0x4d9f4e69, 0xd63a0206, 0xa1a4d0f6, 0x3a019c99, + 0x448dee14, 0xdf28a27b, 0xa8b6708b, 0x33133ce4, 0x478bd56b, + 0xdc2e9904, 0xabb04bf4, 0x3015079b, 0x428198ea, 0xd924d485, + 0xaeba0675, 0x351f4a1a, 0x4187a395, 0xda22effa, 0xadbc3d0a, + 0x36197165}, + {0x00000000, 0xc18edfc0, 0x586cb9c1, 0x99e26601, 0xb0d97382, + 0x7157ac42, 0xe8b5ca43, 0x293b1583, 0xbac3e145, 0x7b4d3e85, + 0xe2af5884, 0x23218744, 0x0a1a92c7, 0xcb944d07, 0x52762b06, + 0x93f8f4c6, 0xaef6c4cb, 0x6f781b0b, 0xf69a7d0a, 0x3714a2ca, + 0x1e2fb749, 0xdfa16889, 0x46430e88, 0x87cdd148, 0x1435258e, + 0xd5bbfa4e, 0x4c599c4f, 0x8dd7438f, 0xa4ec560c, 0x656289cc, + 0xfc80efcd, 0x3d0e300d, 0x869c8fd7, 0x47125017, 0xdef03616, + 0x1f7ee9d6, 0x3645fc55, 0xf7cb2395, 0x6e294594, 0xafa79a54, + 0x3c5f6e92, 0xfdd1b152, 0x6433d753, 0xa5bd0893, 0x8c861d10, + 0x4d08c2d0, 0xd4eaa4d1, 0x15647b11, 0x286a4b1c, 0xe9e494dc, + 0x7006f2dd, 0xb1882d1d, 0x98b3389e, 0x593de75e, 0xc0df815f, + 0x01515e9f, 0x92a9aa59, 0x53277599, 0xcac51398, 0x0b4bcc58, + 0x2270d9db, 0xe3fe061b, 0x7a1c601a, 0xbb92bfda, 0xd64819ef, + 0x17c6c62f, 0x8e24a02e, 0x4faa7fee, 0x66916a6d, 0xa71fb5ad, + 0x3efdd3ac, 0xff730c6c, 0x6c8bf8aa, 0xad05276a, 0x34e7416b, + 0xf5699eab, 0xdc528b28, 0x1ddc54e8, 0x843e32e9, 0x45b0ed29, + 0x78bedd24, 0xb93002e4, 0x20d264e5, 0xe15cbb25, 0xc867aea6, + 0x09e97166, 0x900b1767, 0x5185c8a7, 0xc27d3c61, 0x03f3e3a1, + 0x9a1185a0, 0x5b9f5a60, 0x72a44fe3, 0xb32a9023, 0x2ac8f622, + 0xeb4629e2, 0x50d49638, 0x915a49f8, 0x08b82ff9, 0xc936f039, + 0xe00de5ba, 0x21833a7a, 0xb8615c7b, 0x79ef83bb, 0xea17777d, + 0x2b99a8bd, 0xb27bcebc, 0x73f5117c, 0x5ace04ff, 0x9b40db3f, + 0x02a2bd3e, 0xc32c62fe, 0xfe2252f3, 0x3fac8d33, 0xa64eeb32, + 0x67c034f2, 0x4efb2171, 0x8f75feb1, 0x169798b0, 0xd7194770, + 0x44e1b3b6, 0x856f6c76, 0x1c8d0a77, 0xdd03d5b7, 0xf438c034, + 0x35b61ff4, 0xac5479f5, 0x6ddaa635, 0x77e1359f, 0xb66fea5f, + 0x2f8d8c5e, 0xee03539e, 0xc738461d, 0x06b699dd, 0x9f54ffdc, + 0x5eda201c, 0xcd22d4da, 0x0cac0b1a, 0x954e6d1b, 0x54c0b2db, + 0x7dfba758, 0xbc757898, 0x25971e99, 0xe419c159, 0xd917f154, + 0x18992e94, 0x817b4895, 0x40f59755, 0x69ce82d6, 0xa8405d16, + 0x31a23b17, 0xf02ce4d7, 0x63d41011, 0xa25acfd1, 0x3bb8a9d0, + 0xfa367610, 0xd30d6393, 0x1283bc53, 0x8b61da52, 0x4aef0592, + 0xf17dba48, 0x30f36588, 0xa9110389, 0x689fdc49, 0x41a4c9ca, + 0x802a160a, 0x19c8700b, 0xd846afcb, 0x4bbe5b0d, 0x8a3084cd, + 0x13d2e2cc, 0xd25c3d0c, 0xfb67288f, 0x3ae9f74f, 0xa30b914e, + 0x62854e8e, 0x5f8b7e83, 0x9e05a143, 0x07e7c742, 0xc6691882, + 0xef520d01, 0x2edcd2c1, 0xb73eb4c0, 0x76b06b00, 0xe5489fc6, + 0x24c64006, 0xbd242607, 0x7caaf9c7, 0x5591ec44, 0x941f3384, + 0x0dfd5585, 0xcc738a45, 0xa1a92c70, 0x6027f3b0, 0xf9c595b1, + 0x384b4a71, 0x11705ff2, 0xd0fe8032, 0x491ce633, 0x889239f3, + 0x1b6acd35, 0xdae412f5, 0x430674f4, 0x8288ab34, 0xabb3beb7, + 0x6a3d6177, 0xf3df0776, 0x3251d8b6, 0x0f5fe8bb, 0xced1377b, + 0x5733517a, 0x96bd8eba, 0xbf869b39, 0x7e0844f9, 0xe7ea22f8, + 0x2664fd38, 0xb59c09fe, 0x7412d63e, 0xedf0b03f, 0x2c7e6fff, + 0x05457a7c, 0xc4cba5bc, 0x5d29c3bd, 0x9ca71c7d, 0x2735a3a7, + 0xe6bb7c67, 0x7f591a66, 0xbed7c5a6, 0x97ecd025, 0x56620fe5, + 0xcf8069e4, 0x0e0eb624, 0x9df642e2, 0x5c789d22, 0xc59afb23, + 0x041424e3, 0x2d2f3160, 0xeca1eea0, 0x754388a1, 0xb4cd5761, + 0x89c3676c, 0x484db8ac, 0xd1afdead, 0x1021016d, 0x391a14ee, + 0xf894cb2e, 0x6176ad2f, 0xa0f872ef, 0x33008629, 0xf28e59e9, + 0x6b6c3fe8, 0xaae2e028, 0x83d9f5ab, 0x42572a6b, 0xdbb54c6a, + 0x1a3b93aa}, + {0x00000000, 0xefc26b3e, 0x04f5d03d, 0xeb37bb03, 0x09eba07a, + 0xe629cb44, 0x0d1e7047, 0xe2dc1b79, 0x13d740f4, 0xfc152bca, + 0x172290c9, 0xf8e0fbf7, 0x1a3ce08e, 0xf5fe8bb0, 0x1ec930b3, + 0xf10b5b8d, 0x27ae81e8, 0xc86cead6, 0x235b51d5, 0xcc993aeb, + 0x2e452192, 0xc1874aac, 0x2ab0f1af, 0xc5729a91, 0x3479c11c, + 0xdbbbaa22, 0x308c1121, 0xdf4e7a1f, 0x3d926166, 0xd2500a58, + 0x3967b15b, 0xd6a5da65, 0x4f5d03d0, 0xa09f68ee, 0x4ba8d3ed, + 0xa46ab8d3, 0x46b6a3aa, 0xa974c894, 0x42437397, 0xad8118a9, + 0x5c8a4324, 0xb348281a, 0x587f9319, 0xb7bdf827, 0x5561e35e, + 0xbaa38860, 0x51943363, 0xbe56585d, 0x68f38238, 0x8731e906, + 0x6c065205, 0x83c4393b, 0x61182242, 0x8eda497c, 0x65edf27f, + 0x8a2f9941, 0x7b24c2cc, 0x94e6a9f2, 0x7fd112f1, 0x901379cf, + 0x72cf62b6, 0x9d0d0988, 0x763ab28b, 0x99f8d9b5, 0x9eba07a0, + 0x71786c9e, 0x9a4fd79d, 0x758dbca3, 0x9751a7da, 0x7893cce4, + 0x93a477e7, 0x7c661cd9, 0x8d6d4754, 0x62af2c6a, 0x89989769, + 0x665afc57, 0x8486e72e, 0x6b448c10, 0x80733713, 0x6fb15c2d, + 0xb9148648, 0x56d6ed76, 0xbde15675, 0x52233d4b, 0xb0ff2632, + 0x5f3d4d0c, 0xb40af60f, 0x5bc89d31, 0xaac3c6bc, 0x4501ad82, + 0xae361681, 0x41f47dbf, 0xa32866c6, 0x4cea0df8, 0xa7ddb6fb, + 0x481fddc5, 0xd1e70470, 0x3e256f4e, 0xd512d44d, 0x3ad0bf73, + 0xd80ca40a, 0x37cecf34, 0xdcf97437, 0x333b1f09, 0xc2304484, + 0x2df22fba, 0xc6c594b9, 0x2907ff87, 0xcbdbe4fe, 0x24198fc0, + 0xcf2e34c3, 0x20ec5ffd, 0xf6498598, 0x198beea6, 0xf2bc55a5, + 0x1d7e3e9b, 0xffa225e2, 0x10604edc, 0xfb57f5df, 0x14959ee1, + 0xe59ec56c, 0x0a5cae52, 0xe16b1551, 0x0ea97e6f, 0xec756516, + 0x03b70e28, 0xe880b52b, 0x0742de15, 0xe6050901, 0x09c7623f, + 0xe2f0d93c, 0x0d32b202, 0xefeea97b, 0x002cc245, 0xeb1b7946, + 0x04d91278, 0xf5d249f5, 0x1a1022cb, 0xf12799c8, 0x1ee5f2f6, + 0xfc39e98f, 0x13fb82b1, 0xf8cc39b2, 0x170e528c, 0xc1ab88e9, + 0x2e69e3d7, 0xc55e58d4, 0x2a9c33ea, 0xc8402893, 0x278243ad, + 0xccb5f8ae, 0x23779390, 0xd27cc81d, 0x3dbea323, 0xd6891820, + 0x394b731e, 0xdb976867, 0x34550359, 0xdf62b85a, 0x30a0d364, + 0xa9580ad1, 0x469a61ef, 0xadaddaec, 0x426fb1d2, 0xa0b3aaab, + 0x4f71c195, 0xa4467a96, 0x4b8411a8, 0xba8f4a25, 0x554d211b, + 0xbe7a9a18, 0x51b8f126, 0xb364ea5f, 0x5ca68161, 0xb7913a62, + 0x5853515c, 0x8ef68b39, 0x6134e007, 0x8a035b04, 0x65c1303a, + 0x871d2b43, 0x68df407d, 0x83e8fb7e, 0x6c2a9040, 0x9d21cbcd, + 0x72e3a0f3, 0x99d41bf0, 0x761670ce, 0x94ca6bb7, 0x7b080089, + 0x903fbb8a, 0x7ffdd0b4, 0x78bf0ea1, 0x977d659f, 0x7c4ade9c, + 0x9388b5a2, 0x7154aedb, 0x9e96c5e5, 0x75a17ee6, 0x9a6315d8, + 0x6b684e55, 0x84aa256b, 0x6f9d9e68, 0x805ff556, 0x6283ee2f, + 0x8d418511, 0x66763e12, 0x89b4552c, 0x5f118f49, 0xb0d3e477, + 0x5be45f74, 0xb426344a, 0x56fa2f33, 0xb938440d, 0x520fff0e, + 0xbdcd9430, 0x4cc6cfbd, 0xa304a483, 0x48331f80, 0xa7f174be, + 0x452d6fc7, 0xaaef04f9, 0x41d8bffa, 0xae1ad4c4, 0x37e20d71, + 0xd820664f, 0x3317dd4c, 0xdcd5b672, 0x3e09ad0b, 0xd1cbc635, + 0x3afc7d36, 0xd53e1608, 0x24354d85, 0xcbf726bb, 0x20c09db8, + 0xcf02f686, 0x2ddeedff, 0xc21c86c1, 0x292b3dc2, 0xc6e956fc, + 0x104c8c99, 0xff8ee7a7, 0x14b95ca4, 0xfb7b379a, 0x19a72ce3, + 0xf66547dd, 0x1d52fcde, 0xf29097e0, 0x039bcc6d, 0xec59a753, + 0x076e1c50, 0xe8ac776e, 0x0a706c17, 0xe5b20729, 0x0e85bc2a, + 0xe147d714}, + {0x00000000, 0x177b1443, 0x2ef62886, 0x398d3cc5, 0x5dec510c, + 0x4a97454f, 0x731a798a, 0x64616dc9, 0xbbd8a218, 0xaca3b65b, + 0x952e8a9e, 0x82559edd, 0xe634f314, 0xf14fe757, 0xc8c2db92, + 0xdfb9cfd1, 0xacc04271, 0xbbbb5632, 0x82366af7, 0x954d7eb4, + 0xf12c137d, 0xe657073e, 0xdfda3bfb, 0xc8a12fb8, 0x1718e069, + 0x0063f42a, 0x39eec8ef, 0x2e95dcac, 0x4af4b165, 0x5d8fa526, + 0x640299e3, 0x73798da0, 0x82f182a3, 0x958a96e0, 0xac07aa25, + 0xbb7cbe66, 0xdf1dd3af, 0xc866c7ec, 0xf1ebfb29, 0xe690ef6a, + 0x392920bb, 0x2e5234f8, 0x17df083d, 0x00a41c7e, 0x64c571b7, + 0x73be65f4, 0x4a335931, 0x5d484d72, 0x2e31c0d2, 0x394ad491, + 0x00c7e854, 0x17bcfc17, 0x73dd91de, 0x64a6859d, 0x5d2bb958, + 0x4a50ad1b, 0x95e962ca, 0x82927689, 0xbb1f4a4c, 0xac645e0f, + 0xc80533c6, 0xdf7e2785, 0xe6f31b40, 0xf1880f03, 0xde920307, + 0xc9e91744, 0xf0642b81, 0xe71f3fc2, 0x837e520b, 0x94054648, + 0xad887a8d, 0xbaf36ece, 0x654aa11f, 0x7231b55c, 0x4bbc8999, + 0x5cc79dda, 0x38a6f013, 0x2fdde450, 0x1650d895, 0x012bccd6, + 0x72524176, 0x65295535, 0x5ca469f0, 0x4bdf7db3, 0x2fbe107a, + 0x38c50439, 0x014838fc, 0x16332cbf, 0xc98ae36e, 0xdef1f72d, + 0xe77ccbe8, 0xf007dfab, 0x9466b262, 0x831da621, 0xba909ae4, + 0xadeb8ea7, 0x5c6381a4, 0x4b1895e7, 0x7295a922, 0x65eebd61, + 0x018fd0a8, 0x16f4c4eb, 0x2f79f82e, 0x3802ec6d, 0xe7bb23bc, + 0xf0c037ff, 0xc94d0b3a, 0xde361f79, 0xba5772b0, 0xad2c66f3, + 0x94a15a36, 0x83da4e75, 0xf0a3c3d5, 0xe7d8d796, 0xde55eb53, + 0xc92eff10, 0xad4f92d9, 0xba34869a, 0x83b9ba5f, 0x94c2ae1c, + 0x4b7b61cd, 0x5c00758e, 0x658d494b, 0x72f65d08, 0x169730c1, + 0x01ec2482, 0x38611847, 0x2f1a0c04, 0x6655004f, 0x712e140c, + 0x48a328c9, 0x5fd83c8a, 0x3bb95143, 0x2cc24500, 0x154f79c5, + 0x02346d86, 0xdd8da257, 0xcaf6b614, 0xf37b8ad1, 0xe4009e92, + 0x8061f35b, 0x971ae718, 0xae97dbdd, 0xb9eccf9e, 0xca95423e, + 0xddee567d, 0xe4636ab8, 0xf3187efb, 0x97791332, 0x80020771, + 0xb98f3bb4, 0xaef42ff7, 0x714de026, 0x6636f465, 0x5fbbc8a0, + 0x48c0dce3, 0x2ca1b12a, 0x3bdaa569, 0x025799ac, 0x152c8def, + 0xe4a482ec, 0xf3df96af, 0xca52aa6a, 0xdd29be29, 0xb948d3e0, + 0xae33c7a3, 0x97befb66, 0x80c5ef25, 0x5f7c20f4, 0x480734b7, + 0x718a0872, 0x66f11c31, 0x029071f8, 0x15eb65bb, 0x2c66597e, + 0x3b1d4d3d, 0x4864c09d, 0x5f1fd4de, 0x6692e81b, 0x71e9fc58, + 0x15889191, 0x02f385d2, 0x3b7eb917, 0x2c05ad54, 0xf3bc6285, + 0xe4c776c6, 0xdd4a4a03, 0xca315e40, 0xae503389, 0xb92b27ca, + 0x80a61b0f, 0x97dd0f4c, 0xb8c70348, 0xafbc170b, 0x96312bce, + 0x814a3f8d, 0xe52b5244, 0xf2504607, 0xcbdd7ac2, 0xdca66e81, + 0x031fa150, 0x1464b513, 0x2de989d6, 0x3a929d95, 0x5ef3f05c, + 0x4988e41f, 0x7005d8da, 0x677ecc99, 0x14074139, 0x037c557a, + 0x3af169bf, 0x2d8a7dfc, 0x49eb1035, 0x5e900476, 0x671d38b3, + 0x70662cf0, 0xafdfe321, 0xb8a4f762, 0x8129cba7, 0x9652dfe4, + 0xf233b22d, 0xe548a66e, 0xdcc59aab, 0xcbbe8ee8, 0x3a3681eb, + 0x2d4d95a8, 0x14c0a96d, 0x03bbbd2e, 0x67dad0e7, 0x70a1c4a4, + 0x492cf861, 0x5e57ec22, 0x81ee23f3, 0x969537b0, 0xaf180b75, + 0xb8631f36, 0xdc0272ff, 0xcb7966bc, 0xf2f45a79, 0xe58f4e3a, + 0x96f6c39a, 0x818dd7d9, 0xb800eb1c, 0xaf7bff5f, 0xcb1a9296, + 0xdc6186d5, 0xe5ecba10, 0xf297ae53, 0x2d2e6182, 0x3a5575c1, + 0x03d84904, 0x14a35d47, 0x70c2308e, 0x67b924cd, 0x5e341808, + 0x494f0c4b}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x43147b1700000000, 0x8628f62e00000000, + 0xc53c8d3900000000, 0x0c51ec5d00000000, 0x4f45974a00000000, + 0x8a791a7300000000, 0xc96d616400000000, 0x18a2d8bb00000000, + 0x5bb6a3ac00000000, 0x9e8a2e9500000000, 0xdd9e558200000000, + 0x14f334e600000000, 0x57e74ff100000000, 0x92dbc2c800000000, + 0xd1cfb9df00000000, 0x7142c0ac00000000, 0x3256bbbb00000000, + 0xf76a368200000000, 0xb47e4d9500000000, 0x7d132cf100000000, + 0x3e0757e600000000, 0xfb3bdadf00000000, 0xb82fa1c800000000, + 0x69e0181700000000, 0x2af4630000000000, 0xefc8ee3900000000, + 0xacdc952e00000000, 0x65b1f44a00000000, 0x26a58f5d00000000, + 0xe399026400000000, 0xa08d797300000000, 0xa382f18200000000, + 0xe0968a9500000000, 0x25aa07ac00000000, 0x66be7cbb00000000, + 0xafd31ddf00000000, 0xecc766c800000000, 0x29fbebf100000000, + 0x6aef90e600000000, 0xbb20293900000000, 0xf834522e00000000, + 0x3d08df1700000000, 0x7e1ca40000000000, 0xb771c56400000000, + 0xf465be7300000000, 0x3159334a00000000, 0x724d485d00000000, + 0xd2c0312e00000000, 0x91d44a3900000000, 0x54e8c70000000000, + 0x17fcbc1700000000, 0xde91dd7300000000, 0x9d85a66400000000, + 0x58b92b5d00000000, 0x1bad504a00000000, 0xca62e99500000000, + 0x8976928200000000, 0x4c4a1fbb00000000, 0x0f5e64ac00000000, + 0xc63305c800000000, 0x85277edf00000000, 0x401bf3e600000000, + 0x030f88f100000000, 0x070392de00000000, 0x4417e9c900000000, + 0x812b64f000000000, 0xc23f1fe700000000, 0x0b527e8300000000, + 0x4846059400000000, 0x8d7a88ad00000000, 0xce6ef3ba00000000, + 0x1fa14a6500000000, 0x5cb5317200000000, 0x9989bc4b00000000, + 0xda9dc75c00000000, 0x13f0a63800000000, 0x50e4dd2f00000000, + 0x95d8501600000000, 0xd6cc2b0100000000, 0x7641527200000000, + 0x3555296500000000, 0xf069a45c00000000, 0xb37ddf4b00000000, + 0x7a10be2f00000000, 0x3904c53800000000, 0xfc38480100000000, + 0xbf2c331600000000, 0x6ee38ac900000000, 0x2df7f1de00000000, + 0xe8cb7ce700000000, 0xabdf07f000000000, 0x62b2669400000000, + 0x21a61d8300000000, 0xe49a90ba00000000, 0xa78eebad00000000, + 0xa481635c00000000, 0xe795184b00000000, 0x22a9957200000000, + 0x61bdee6500000000, 0xa8d08f0100000000, 0xebc4f41600000000, + 0x2ef8792f00000000, 0x6dec023800000000, 0xbc23bbe700000000, + 0xff37c0f000000000, 0x3a0b4dc900000000, 0x791f36de00000000, + 0xb07257ba00000000, 0xf3662cad00000000, 0x365aa19400000000, + 0x754eda8300000000, 0xd5c3a3f000000000, 0x96d7d8e700000000, + 0x53eb55de00000000, 0x10ff2ec900000000, 0xd9924fad00000000, + 0x9a8634ba00000000, 0x5fbab98300000000, 0x1caec29400000000, + 0xcd617b4b00000000, 0x8e75005c00000000, 0x4b498d6500000000, + 0x085df67200000000, 0xc130971600000000, 0x8224ec0100000000, + 0x4718613800000000, 0x040c1a2f00000000, 0x4f00556600000000, + 0x0c142e7100000000, 0xc928a34800000000, 0x8a3cd85f00000000, + 0x4351b93b00000000, 0x0045c22c00000000, 0xc5794f1500000000, + 0x866d340200000000, 0x57a28ddd00000000, 0x14b6f6ca00000000, + 0xd18a7bf300000000, 0x929e00e400000000, 0x5bf3618000000000, + 0x18e71a9700000000, 0xdddb97ae00000000, 0x9ecfecb900000000, + 0x3e4295ca00000000, 0x7d56eedd00000000, 0xb86a63e400000000, + 0xfb7e18f300000000, 0x3213799700000000, 0x7107028000000000, + 0xb43b8fb900000000, 0xf72ff4ae00000000, 0x26e04d7100000000, + 0x65f4366600000000, 0xa0c8bb5f00000000, 0xe3dcc04800000000, + 0x2ab1a12c00000000, 0x69a5da3b00000000, 0xac99570200000000, + 0xef8d2c1500000000, 0xec82a4e400000000, 0xaf96dff300000000, + 0x6aaa52ca00000000, 0x29be29dd00000000, 0xe0d348b900000000, + 0xa3c733ae00000000, 0x66fbbe9700000000, 0x25efc58000000000, + 0xf4207c5f00000000, 0xb734074800000000, 0x72088a7100000000, + 0x311cf16600000000, 0xf871900200000000, 0xbb65eb1500000000, + 0x7e59662c00000000, 0x3d4d1d3b00000000, 0x9dc0644800000000, + 0xded41f5f00000000, 0x1be8926600000000, 0x58fce97100000000, + 0x9191881500000000, 0xd285f30200000000, 0x17b97e3b00000000, + 0x54ad052c00000000, 0x8562bcf300000000, 0xc676c7e400000000, + 0x034a4add00000000, 0x405e31ca00000000, 0x893350ae00000000, + 0xca272bb900000000, 0x0f1ba68000000000, 0x4c0fdd9700000000, + 0x4803c7b800000000, 0x0b17bcaf00000000, 0xce2b319600000000, + 0x8d3f4a8100000000, 0x44522be500000000, 0x074650f200000000, + 0xc27addcb00000000, 0x816ea6dc00000000, 0x50a11f0300000000, + 0x13b5641400000000, 0xd689e92d00000000, 0x959d923a00000000, + 0x5cf0f35e00000000, 0x1fe4884900000000, 0xdad8057000000000, + 0x99cc7e6700000000, 0x3941071400000000, 0x7a557c0300000000, + 0xbf69f13a00000000, 0xfc7d8a2d00000000, 0x3510eb4900000000, + 0x7604905e00000000, 0xb3381d6700000000, 0xf02c667000000000, + 0x21e3dfaf00000000, 0x62f7a4b800000000, 0xa7cb298100000000, + 0xe4df529600000000, 0x2db233f200000000, 0x6ea648e500000000, + 0xab9ac5dc00000000, 0xe88ebecb00000000, 0xeb81363a00000000, + 0xa8954d2d00000000, 0x6da9c01400000000, 0x2ebdbb0300000000, + 0xe7d0da6700000000, 0xa4c4a17000000000, 0x61f82c4900000000, + 0x22ec575e00000000, 0xf323ee8100000000, 0xb037959600000000, + 0x750b18af00000000, 0x361f63b800000000, 0xff7202dc00000000, + 0xbc6679cb00000000, 0x795af4f200000000, 0x3a4e8fe500000000, + 0x9ac3f69600000000, 0xd9d78d8100000000, 0x1ceb00b800000000, + 0x5fff7baf00000000, 0x96921acb00000000, 0xd58661dc00000000, + 0x10baece500000000, 0x53ae97f200000000, 0x82612e2d00000000, + 0xc175553a00000000, 0x0449d80300000000, 0x475da31400000000, + 0x8e30c27000000000, 0xcd24b96700000000, 0x0818345e00000000, + 0x4b0c4f4900000000}, + {0x0000000000000000, 0x3e6bc2ef00000000, 0x3dd0f50400000000, + 0x03bb37eb00000000, 0x7aa0eb0900000000, 0x44cb29e600000000, + 0x47701e0d00000000, 0x791bdce200000000, 0xf440d71300000000, + 0xca2b15fc00000000, 0xc990221700000000, 0xf7fbe0f800000000, + 0x8ee03c1a00000000, 0xb08bfef500000000, 0xb330c91e00000000, + 0x8d5b0bf100000000, 0xe881ae2700000000, 0xd6ea6cc800000000, + 0xd5515b2300000000, 0xeb3a99cc00000000, 0x9221452e00000000, + 0xac4a87c100000000, 0xaff1b02a00000000, 0x919a72c500000000, + 0x1cc1793400000000, 0x22aabbdb00000000, 0x21118c3000000000, + 0x1f7a4edf00000000, 0x6661923d00000000, 0x580a50d200000000, + 0x5bb1673900000000, 0x65daa5d600000000, 0xd0035d4f00000000, + 0xee689fa000000000, 0xedd3a84b00000000, 0xd3b86aa400000000, + 0xaaa3b64600000000, 0x94c874a900000000, 0x9773434200000000, + 0xa91881ad00000000, 0x24438a5c00000000, 0x1a2848b300000000, + 0x19937f5800000000, 0x27f8bdb700000000, 0x5ee3615500000000, + 0x6088a3ba00000000, 0x6333945100000000, 0x5d5856be00000000, + 0x3882f36800000000, 0x06e9318700000000, 0x0552066c00000000, + 0x3b39c48300000000, 0x4222186100000000, 0x7c49da8e00000000, + 0x7ff2ed6500000000, 0x41992f8a00000000, 0xccc2247b00000000, + 0xf2a9e69400000000, 0xf112d17f00000000, 0xcf79139000000000, + 0xb662cf7200000000, 0x88090d9d00000000, 0x8bb23a7600000000, + 0xb5d9f89900000000, 0xa007ba9e00000000, 0x9e6c787100000000, + 0x9dd74f9a00000000, 0xa3bc8d7500000000, 0xdaa7519700000000, + 0xe4cc937800000000, 0xe777a49300000000, 0xd91c667c00000000, + 0x54476d8d00000000, 0x6a2caf6200000000, 0x6997988900000000, + 0x57fc5a6600000000, 0x2ee7868400000000, 0x108c446b00000000, + 0x1337738000000000, 0x2d5cb16f00000000, 0x488614b900000000, + 0x76edd65600000000, 0x7556e1bd00000000, 0x4b3d235200000000, + 0x3226ffb000000000, 0x0c4d3d5f00000000, 0x0ff60ab400000000, + 0x319dc85b00000000, 0xbcc6c3aa00000000, 0x82ad014500000000, + 0x811636ae00000000, 0xbf7df44100000000, 0xc66628a300000000, + 0xf80dea4c00000000, 0xfbb6dda700000000, 0xc5dd1f4800000000, + 0x7004e7d100000000, 0x4e6f253e00000000, 0x4dd412d500000000, + 0x73bfd03a00000000, 0x0aa40cd800000000, 0x34cfce3700000000, + 0x3774f9dc00000000, 0x091f3b3300000000, 0x844430c200000000, + 0xba2ff22d00000000, 0xb994c5c600000000, 0x87ff072900000000, + 0xfee4dbcb00000000, 0xc08f192400000000, 0xc3342ecf00000000, + 0xfd5fec2000000000, 0x988549f600000000, 0xa6ee8b1900000000, + 0xa555bcf200000000, 0x9b3e7e1d00000000, 0xe225a2ff00000000, + 0xdc4e601000000000, 0xdff557fb00000000, 0xe19e951400000000, + 0x6cc59ee500000000, 0x52ae5c0a00000000, 0x51156be100000000, + 0x6f7ea90e00000000, 0x166575ec00000000, 0x280eb70300000000, + 0x2bb580e800000000, 0x15de420700000000, 0x010905e600000000, + 0x3f62c70900000000, 0x3cd9f0e200000000, 0x02b2320d00000000, + 0x7ba9eeef00000000, 0x45c22c0000000000, 0x46791beb00000000, + 0x7812d90400000000, 0xf549d2f500000000, 0xcb22101a00000000, + 0xc89927f100000000, 0xf6f2e51e00000000, 0x8fe939fc00000000, + 0xb182fb1300000000, 0xb239ccf800000000, 0x8c520e1700000000, + 0xe988abc100000000, 0xd7e3692e00000000, 0xd4585ec500000000, + 0xea339c2a00000000, 0x932840c800000000, 0xad43822700000000, + 0xaef8b5cc00000000, 0x9093772300000000, 0x1dc87cd200000000, + 0x23a3be3d00000000, 0x201889d600000000, 0x1e734b3900000000, + 0x676897db00000000, 0x5903553400000000, 0x5ab862df00000000, + 0x64d3a03000000000, 0xd10a58a900000000, 0xef619a4600000000, + 0xecdaadad00000000, 0xd2b16f4200000000, 0xabaab3a000000000, + 0x95c1714f00000000, 0x967a46a400000000, 0xa811844b00000000, + 0x254a8fba00000000, 0x1b214d5500000000, 0x189a7abe00000000, + 0x26f1b85100000000, 0x5fea64b300000000, 0x6181a65c00000000, + 0x623a91b700000000, 0x5c51535800000000, 0x398bf68e00000000, + 0x07e0346100000000, 0x045b038a00000000, 0x3a30c16500000000, + 0x432b1d8700000000, 0x7d40df6800000000, 0x7efbe88300000000, + 0x40902a6c00000000, 0xcdcb219d00000000, 0xf3a0e37200000000, + 0xf01bd49900000000, 0xce70167600000000, 0xb76bca9400000000, + 0x8900087b00000000, 0x8abb3f9000000000, 0xb4d0fd7f00000000, + 0xa10ebf7800000000, 0x9f657d9700000000, 0x9cde4a7c00000000, + 0xa2b5889300000000, 0xdbae547100000000, 0xe5c5969e00000000, + 0xe67ea17500000000, 0xd815639a00000000, 0x554e686b00000000, + 0x6b25aa8400000000, 0x689e9d6f00000000, 0x56f55f8000000000, + 0x2fee836200000000, 0x1185418d00000000, 0x123e766600000000, + 0x2c55b48900000000, 0x498f115f00000000, 0x77e4d3b000000000, + 0x745fe45b00000000, 0x4a3426b400000000, 0x332ffa5600000000, + 0x0d4438b900000000, 0x0eff0f5200000000, 0x3094cdbd00000000, + 0xbdcfc64c00000000, 0x83a404a300000000, 0x801f334800000000, + 0xbe74f1a700000000, 0xc76f2d4500000000, 0xf904efaa00000000, + 0xfabfd84100000000, 0xc4d41aae00000000, 0x710de23700000000, + 0x4f6620d800000000, 0x4cdd173300000000, 0x72b6d5dc00000000, + 0x0bad093e00000000, 0x35c6cbd100000000, 0x367dfc3a00000000, + 0x08163ed500000000, 0x854d352400000000, 0xbb26f7cb00000000, + 0xb89dc02000000000, 0x86f602cf00000000, 0xffedde2d00000000, + 0xc1861cc200000000, 0xc23d2b2900000000, 0xfc56e9c600000000, + 0x998c4c1000000000, 0xa7e78eff00000000, 0xa45cb91400000000, + 0x9a377bfb00000000, 0xe32ca71900000000, 0xdd4765f600000000, + 0xdefc521d00000000, 0xe09790f200000000, 0x6dcc9b0300000000, + 0x53a759ec00000000, 0x501c6e0700000000, 0x6e77ace800000000, + 0x176c700a00000000, 0x2907b2e500000000, 0x2abc850e00000000, + 0x14d747e100000000}, + {0x0000000000000000, 0xc0df8ec100000000, 0xc1b96c5800000000, + 0x0166e29900000000, 0x8273d9b000000000, 0x42ac577100000000, + 0x43cab5e800000000, 0x83153b2900000000, 0x45e1c3ba00000000, + 0x853e4d7b00000000, 0x8458afe200000000, 0x4487212300000000, + 0xc7921a0a00000000, 0x074d94cb00000000, 0x062b765200000000, + 0xc6f4f89300000000, 0xcbc4f6ae00000000, 0x0b1b786f00000000, + 0x0a7d9af600000000, 0xcaa2143700000000, 0x49b72f1e00000000, + 0x8968a1df00000000, 0x880e434600000000, 0x48d1cd8700000000, + 0x8e25351400000000, 0x4efabbd500000000, 0x4f9c594c00000000, + 0x8f43d78d00000000, 0x0c56eca400000000, 0xcc89626500000000, + 0xcdef80fc00000000, 0x0d300e3d00000000, 0xd78f9c8600000000, + 0x1750124700000000, 0x1636f0de00000000, 0xd6e97e1f00000000, + 0x55fc453600000000, 0x9523cbf700000000, 0x9445296e00000000, + 0x549aa7af00000000, 0x926e5f3c00000000, 0x52b1d1fd00000000, + 0x53d7336400000000, 0x9308bda500000000, 0x101d868c00000000, + 0xd0c2084d00000000, 0xd1a4ead400000000, 0x117b641500000000, + 0x1c4b6a2800000000, 0xdc94e4e900000000, 0xddf2067000000000, + 0x1d2d88b100000000, 0x9e38b39800000000, 0x5ee73d5900000000, + 0x5f81dfc000000000, 0x9f5e510100000000, 0x59aaa99200000000, + 0x9975275300000000, 0x9813c5ca00000000, 0x58cc4b0b00000000, + 0xdbd9702200000000, 0x1b06fee300000000, 0x1a601c7a00000000, + 0xdabf92bb00000000, 0xef1948d600000000, 0x2fc6c61700000000, + 0x2ea0248e00000000, 0xee7faa4f00000000, 0x6d6a916600000000, + 0xadb51fa700000000, 0xacd3fd3e00000000, 0x6c0c73ff00000000, + 0xaaf88b6c00000000, 0x6a2705ad00000000, 0x6b41e73400000000, + 0xab9e69f500000000, 0x288b52dc00000000, 0xe854dc1d00000000, + 0xe9323e8400000000, 0x29edb04500000000, 0x24ddbe7800000000, + 0xe40230b900000000, 0xe564d22000000000, 0x25bb5ce100000000, + 0xa6ae67c800000000, 0x6671e90900000000, 0x67170b9000000000, + 0xa7c8855100000000, 0x613c7dc200000000, 0xa1e3f30300000000, + 0xa085119a00000000, 0x605a9f5b00000000, 0xe34fa47200000000, + 0x23902ab300000000, 0x22f6c82a00000000, 0xe22946eb00000000, + 0x3896d45000000000, 0xf8495a9100000000, 0xf92fb80800000000, + 0x39f036c900000000, 0xbae50de000000000, 0x7a3a832100000000, + 0x7b5c61b800000000, 0xbb83ef7900000000, 0x7d7717ea00000000, + 0xbda8992b00000000, 0xbcce7bb200000000, 0x7c11f57300000000, + 0xff04ce5a00000000, 0x3fdb409b00000000, 0x3ebda20200000000, + 0xfe622cc300000000, 0xf35222fe00000000, 0x338dac3f00000000, + 0x32eb4ea600000000, 0xf234c06700000000, 0x7121fb4e00000000, + 0xb1fe758f00000000, 0xb098971600000000, 0x704719d700000000, + 0xb6b3e14400000000, 0x766c6f8500000000, 0x770a8d1c00000000, + 0xb7d503dd00000000, 0x34c038f400000000, 0xf41fb63500000000, + 0xf57954ac00000000, 0x35a6da6d00000000, 0x9f35e17700000000, + 0x5fea6fb600000000, 0x5e8c8d2f00000000, 0x9e5303ee00000000, + 0x1d4638c700000000, 0xdd99b60600000000, 0xdcff549f00000000, + 0x1c20da5e00000000, 0xdad422cd00000000, 0x1a0bac0c00000000, + 0x1b6d4e9500000000, 0xdbb2c05400000000, 0x58a7fb7d00000000, + 0x987875bc00000000, 0x991e972500000000, 0x59c119e400000000, + 0x54f117d900000000, 0x942e991800000000, 0x95487b8100000000, + 0x5597f54000000000, 0xd682ce6900000000, 0x165d40a800000000, + 0x173ba23100000000, 0xd7e42cf000000000, 0x1110d46300000000, + 0xd1cf5aa200000000, 0xd0a9b83b00000000, 0x107636fa00000000, + 0x93630dd300000000, 0x53bc831200000000, 0x52da618b00000000, + 0x9205ef4a00000000, 0x48ba7df100000000, 0x8865f33000000000, + 0x890311a900000000, 0x49dc9f6800000000, 0xcac9a44100000000, + 0x0a162a8000000000, 0x0b70c81900000000, 0xcbaf46d800000000, + 0x0d5bbe4b00000000, 0xcd84308a00000000, 0xcce2d21300000000, + 0x0c3d5cd200000000, 0x8f2867fb00000000, 0x4ff7e93a00000000, + 0x4e910ba300000000, 0x8e4e856200000000, 0x837e8b5f00000000, + 0x43a1059e00000000, 0x42c7e70700000000, 0x821869c600000000, + 0x010d52ef00000000, 0xc1d2dc2e00000000, 0xc0b43eb700000000, + 0x006bb07600000000, 0xc69f48e500000000, 0x0640c62400000000, + 0x072624bd00000000, 0xc7f9aa7c00000000, 0x44ec915500000000, + 0x84331f9400000000, 0x8555fd0d00000000, 0x458a73cc00000000, + 0x702ca9a100000000, 0xb0f3276000000000, 0xb195c5f900000000, + 0x714a4b3800000000, 0xf25f701100000000, 0x3280fed000000000, + 0x33e61c4900000000, 0xf339928800000000, 0x35cd6a1b00000000, + 0xf512e4da00000000, 0xf474064300000000, 0x34ab888200000000, + 0xb7beb3ab00000000, 0x77613d6a00000000, 0x7607dff300000000, + 0xb6d8513200000000, 0xbbe85f0f00000000, 0x7b37d1ce00000000, + 0x7a51335700000000, 0xba8ebd9600000000, 0x399b86bf00000000, + 0xf944087e00000000, 0xf822eae700000000, 0x38fd642600000000, + 0xfe099cb500000000, 0x3ed6127400000000, 0x3fb0f0ed00000000, + 0xff6f7e2c00000000, 0x7c7a450500000000, 0xbca5cbc400000000, + 0xbdc3295d00000000, 0x7d1ca79c00000000, 0xa7a3352700000000, + 0x677cbbe600000000, 0x661a597f00000000, 0xa6c5d7be00000000, + 0x25d0ec9700000000, 0xe50f625600000000, 0xe46980cf00000000, + 0x24b60e0e00000000, 0xe242f69d00000000, 0x229d785c00000000, + 0x23fb9ac500000000, 0xe324140400000000, 0x60312f2d00000000, + 0xa0eea1ec00000000, 0xa188437500000000, 0x6157cdb400000000, + 0x6c67c38900000000, 0xacb84d4800000000, 0xaddeafd100000000, + 0x6d01211000000000, 0xee141a3900000000, 0x2ecb94f800000000, + 0x2fad766100000000, 0xef72f8a000000000, 0x2986003300000000, + 0xe9598ef200000000, 0xe83f6c6b00000000, 0x28e0e2aa00000000, + 0xabf5d98300000000, 0x6b2a574200000000, 0x6a4cb5db00000000, + 0xaa933b1a00000000}, + {0x0000000000000000, 0x6f4ca59b00000000, 0x9f9e3bec00000000, + 0xf0d29e7700000000, 0x7f3b060300000000, 0x1077a39800000000, + 0xe0a53def00000000, 0x8fe9987400000000, 0xfe760c0600000000, + 0x913aa99d00000000, 0x61e837ea00000000, 0x0ea4927100000000, + 0x814d0a0500000000, 0xee01af9e00000000, 0x1ed331e900000000, + 0x719f947200000000, 0xfced180c00000000, 0x93a1bd9700000000, + 0x637323e000000000, 0x0c3f867b00000000, 0x83d61e0f00000000, + 0xec9abb9400000000, 0x1c4825e300000000, 0x7304807800000000, + 0x029b140a00000000, 0x6dd7b19100000000, 0x9d052fe600000000, + 0xf2498a7d00000000, 0x7da0120900000000, 0x12ecb79200000000, + 0xe23e29e500000000, 0x8d728c7e00000000, 0xf8db311800000000, + 0x9797948300000000, 0x67450af400000000, 0x0809af6f00000000, + 0x87e0371b00000000, 0xe8ac928000000000, 0x187e0cf700000000, + 0x7732a96c00000000, 0x06ad3d1e00000000, 0x69e1988500000000, + 0x993306f200000000, 0xf67fa36900000000, 0x79963b1d00000000, + 0x16da9e8600000000, 0xe60800f100000000, 0x8944a56a00000000, + 0x0436291400000000, 0x6b7a8c8f00000000, 0x9ba812f800000000, + 0xf4e4b76300000000, 0x7b0d2f1700000000, 0x14418a8c00000000, + 0xe49314fb00000000, 0x8bdfb16000000000, 0xfa40251200000000, + 0x950c808900000000, 0x65de1efe00000000, 0x0a92bb6500000000, + 0x857b231100000000, 0xea37868a00000000, 0x1ae518fd00000000, + 0x75a9bd6600000000, 0xf0b7633000000000, 0x9ffbc6ab00000000, + 0x6f2958dc00000000, 0x0065fd4700000000, 0x8f8c653300000000, + 0xe0c0c0a800000000, 0x10125edf00000000, 0x7f5efb4400000000, + 0x0ec16f3600000000, 0x618dcaad00000000, 0x915f54da00000000, + 0xfe13f14100000000, 0x71fa693500000000, 0x1eb6ccae00000000, + 0xee6452d900000000, 0x8128f74200000000, 0x0c5a7b3c00000000, + 0x6316dea700000000, 0x93c440d000000000, 0xfc88e54b00000000, + 0x73617d3f00000000, 0x1c2dd8a400000000, 0xecff46d300000000, + 0x83b3e34800000000, 0xf22c773a00000000, 0x9d60d2a100000000, + 0x6db24cd600000000, 0x02fee94d00000000, 0x8d17713900000000, + 0xe25bd4a200000000, 0x12894ad500000000, 0x7dc5ef4e00000000, + 0x086c522800000000, 0x6720f7b300000000, 0x97f269c400000000, + 0xf8becc5f00000000, 0x7757542b00000000, 0x181bf1b000000000, + 0xe8c96fc700000000, 0x8785ca5c00000000, 0xf61a5e2e00000000, + 0x9956fbb500000000, 0x698465c200000000, 0x06c8c05900000000, + 0x8921582d00000000, 0xe66dfdb600000000, 0x16bf63c100000000, + 0x79f3c65a00000000, 0xf4814a2400000000, 0x9bcdefbf00000000, + 0x6b1f71c800000000, 0x0453d45300000000, 0x8bba4c2700000000, + 0xe4f6e9bc00000000, 0x142477cb00000000, 0x7b68d25000000000, + 0x0af7462200000000, 0x65bbe3b900000000, 0x95697dce00000000, + 0xfa25d85500000000, 0x75cc402100000000, 0x1a80e5ba00000000, + 0xea527bcd00000000, 0x851ede5600000000, 0xe06fc76000000000, + 0x8f2362fb00000000, 0x7ff1fc8c00000000, 0x10bd591700000000, + 0x9f54c16300000000, 0xf01864f800000000, 0x00cafa8f00000000, + 0x6f865f1400000000, 0x1e19cb6600000000, 0x71556efd00000000, + 0x8187f08a00000000, 0xeecb551100000000, 0x6122cd6500000000, + 0x0e6e68fe00000000, 0xfebcf68900000000, 0x91f0531200000000, + 0x1c82df6c00000000, 0x73ce7af700000000, 0x831ce48000000000, + 0xec50411b00000000, 0x63b9d96f00000000, 0x0cf57cf400000000, + 0xfc27e28300000000, 0x936b471800000000, 0xe2f4d36a00000000, + 0x8db876f100000000, 0x7d6ae88600000000, 0x12264d1d00000000, + 0x9dcfd56900000000, 0xf28370f200000000, 0x0251ee8500000000, + 0x6d1d4b1e00000000, 0x18b4f67800000000, 0x77f853e300000000, + 0x872acd9400000000, 0xe866680f00000000, 0x678ff07b00000000, + 0x08c355e000000000, 0xf811cb9700000000, 0x975d6e0c00000000, + 0xe6c2fa7e00000000, 0x898e5fe500000000, 0x795cc19200000000, + 0x1610640900000000, 0x99f9fc7d00000000, 0xf6b559e600000000, + 0x0667c79100000000, 0x692b620a00000000, 0xe459ee7400000000, + 0x8b154bef00000000, 0x7bc7d59800000000, 0x148b700300000000, + 0x9b62e87700000000, 0xf42e4dec00000000, 0x04fcd39b00000000, + 0x6bb0760000000000, 0x1a2fe27200000000, 0x756347e900000000, + 0x85b1d99e00000000, 0xeafd7c0500000000, 0x6514e47100000000, + 0x0a5841ea00000000, 0xfa8adf9d00000000, 0x95c67a0600000000, + 0x10d8a45000000000, 0x7f9401cb00000000, 0x8f469fbc00000000, + 0xe00a3a2700000000, 0x6fe3a25300000000, 0x00af07c800000000, + 0xf07d99bf00000000, 0x9f313c2400000000, 0xeeaea85600000000, + 0x81e20dcd00000000, 0x713093ba00000000, 0x1e7c362100000000, + 0x9195ae5500000000, 0xfed90bce00000000, 0x0e0b95b900000000, + 0x6147302200000000, 0xec35bc5c00000000, 0x837919c700000000, + 0x73ab87b000000000, 0x1ce7222b00000000, 0x930eba5f00000000, + 0xfc421fc400000000, 0x0c9081b300000000, 0x63dc242800000000, + 0x1243b05a00000000, 0x7d0f15c100000000, 0x8ddd8bb600000000, + 0xe2912e2d00000000, 0x6d78b65900000000, 0x023413c200000000, + 0xf2e68db500000000, 0x9daa282e00000000, 0xe803954800000000, + 0x874f30d300000000, 0x779daea400000000, 0x18d10b3f00000000, + 0x9738934b00000000, 0xf87436d000000000, 0x08a6a8a700000000, + 0x67ea0d3c00000000, 0x1675994e00000000, 0x79393cd500000000, + 0x89eba2a200000000, 0xe6a7073900000000, 0x694e9f4d00000000, + 0x06023ad600000000, 0xf6d0a4a100000000, 0x999c013a00000000, + 0x14ee8d4400000000, 0x7ba228df00000000, 0x8b70b6a800000000, + 0xe43c133300000000, 0x6bd58b4700000000, 0x04992edc00000000, + 0xf44bb0ab00000000, 0x9b07153000000000, 0xea98814200000000, + 0x85d424d900000000, 0x7506baae00000000, 0x1a4a1f3500000000, + 0x95a3874100000000, 0xfaef22da00000000, 0x0a3dbcad00000000, + 0x6571193600000000}, + {0x0000000000000000, 0x85d996dd00000000, 0x4bb55c6000000000, + 0xce6ccabd00000000, 0x966ab9c000000000, 0x13b32f1d00000000, + 0xdddfe5a000000000, 0x5806737d00000000, 0x6dd3035a00000000, + 0xe80a958700000000, 0x26665f3a00000000, 0xa3bfc9e700000000, + 0xfbb9ba9a00000000, 0x7e602c4700000000, 0xb00ce6fa00000000, + 0x35d5702700000000, 0xdaa607b400000000, 0x5f7f916900000000, + 0x91135bd400000000, 0x14cacd0900000000, 0x4cccbe7400000000, + 0xc91528a900000000, 0x0779e21400000000, 0x82a074c900000000, + 0xb77504ee00000000, 0x32ac923300000000, 0xfcc0588e00000000, + 0x7919ce5300000000, 0x211fbd2e00000000, 0xa4c62bf300000000, + 0x6aaae14e00000000, 0xef73779300000000, 0xf54b7eb300000000, + 0x7092e86e00000000, 0xbefe22d300000000, 0x3b27b40e00000000, + 0x6321c77300000000, 0xe6f851ae00000000, 0x28949b1300000000, + 0xad4d0dce00000000, 0x98987de900000000, 0x1d41eb3400000000, + 0xd32d218900000000, 0x56f4b75400000000, 0x0ef2c42900000000, + 0x8b2b52f400000000, 0x4547984900000000, 0xc09e0e9400000000, + 0x2fed790700000000, 0xaa34efda00000000, 0x6458256700000000, + 0xe181b3ba00000000, 0xb987c0c700000000, 0x3c5e561a00000000, + 0xf2329ca700000000, 0x77eb0a7a00000000, 0x423e7a5d00000000, + 0xc7e7ec8000000000, 0x098b263d00000000, 0x8c52b0e000000000, + 0xd454c39d00000000, 0x518d554000000000, 0x9fe19ffd00000000, + 0x1a38092000000000, 0xab918dbd00000000, 0x2e481b6000000000, + 0xe024d1dd00000000, 0x65fd470000000000, 0x3dfb347d00000000, + 0xb822a2a000000000, 0x764e681d00000000, 0xf397fec000000000, + 0xc6428ee700000000, 0x439b183a00000000, 0x8df7d28700000000, + 0x082e445a00000000, 0x5028372700000000, 0xd5f1a1fa00000000, + 0x1b9d6b4700000000, 0x9e44fd9a00000000, 0x71378a0900000000, + 0xf4ee1cd400000000, 0x3a82d66900000000, 0xbf5b40b400000000, + 0xe75d33c900000000, 0x6284a51400000000, 0xace86fa900000000, + 0x2931f97400000000, 0x1ce4895300000000, 0x993d1f8e00000000, + 0x5751d53300000000, 0xd28843ee00000000, 0x8a8e309300000000, + 0x0f57a64e00000000, 0xc13b6cf300000000, 0x44e2fa2e00000000, + 0x5edaf30e00000000, 0xdb0365d300000000, 0x156faf6e00000000, + 0x90b639b300000000, 0xc8b04ace00000000, 0x4d69dc1300000000, + 0x830516ae00000000, 0x06dc807300000000, 0x3309f05400000000, + 0xb6d0668900000000, 0x78bcac3400000000, 0xfd653ae900000000, + 0xa563499400000000, 0x20badf4900000000, 0xeed615f400000000, + 0x6b0f832900000000, 0x847cf4ba00000000, 0x01a5626700000000, + 0xcfc9a8da00000000, 0x4a103e0700000000, 0x12164d7a00000000, + 0x97cfdba700000000, 0x59a3111a00000000, 0xdc7a87c700000000, + 0xe9aff7e000000000, 0x6c76613d00000000, 0xa21aab8000000000, + 0x27c33d5d00000000, 0x7fc54e2000000000, 0xfa1cd8fd00000000, + 0x3470124000000000, 0xb1a9849d00000000, 0x17256aa000000000, + 0x92fcfc7d00000000, 0x5c9036c000000000, 0xd949a01d00000000, + 0x814fd36000000000, 0x049645bd00000000, 0xcafa8f0000000000, + 0x4f2319dd00000000, 0x7af669fa00000000, 0xff2fff2700000000, + 0x3143359a00000000, 0xb49aa34700000000, 0xec9cd03a00000000, + 0x694546e700000000, 0xa7298c5a00000000, 0x22f01a8700000000, + 0xcd836d1400000000, 0x485afbc900000000, 0x8636317400000000, + 0x03efa7a900000000, 0x5be9d4d400000000, 0xde30420900000000, + 0x105c88b400000000, 0x95851e6900000000, 0xa0506e4e00000000, + 0x2589f89300000000, 0xebe5322e00000000, 0x6e3ca4f300000000, + 0x363ad78e00000000, 0xb3e3415300000000, 0x7d8f8bee00000000, + 0xf8561d3300000000, 0xe26e141300000000, 0x67b782ce00000000, + 0xa9db487300000000, 0x2c02deae00000000, 0x7404add300000000, + 0xf1dd3b0e00000000, 0x3fb1f1b300000000, 0xba68676e00000000, + 0x8fbd174900000000, 0x0a64819400000000, 0xc4084b2900000000, + 0x41d1ddf400000000, 0x19d7ae8900000000, 0x9c0e385400000000, + 0x5262f2e900000000, 0xd7bb643400000000, 0x38c813a700000000, + 0xbd11857a00000000, 0x737d4fc700000000, 0xf6a4d91a00000000, + 0xaea2aa6700000000, 0x2b7b3cba00000000, 0xe517f60700000000, + 0x60ce60da00000000, 0x551b10fd00000000, 0xd0c2862000000000, + 0x1eae4c9d00000000, 0x9b77da4000000000, 0xc371a93d00000000, + 0x46a83fe000000000, 0x88c4f55d00000000, 0x0d1d638000000000, + 0xbcb4e71d00000000, 0x396d71c000000000, 0xf701bb7d00000000, + 0x72d82da000000000, 0x2ade5edd00000000, 0xaf07c80000000000, + 0x616b02bd00000000, 0xe4b2946000000000, 0xd167e44700000000, + 0x54be729a00000000, 0x9ad2b82700000000, 0x1f0b2efa00000000, + 0x470d5d8700000000, 0xc2d4cb5a00000000, 0x0cb801e700000000, + 0x8961973a00000000, 0x6612e0a900000000, 0xe3cb767400000000, + 0x2da7bcc900000000, 0xa87e2a1400000000, 0xf078596900000000, + 0x75a1cfb400000000, 0xbbcd050900000000, 0x3e1493d400000000, + 0x0bc1e3f300000000, 0x8e18752e00000000, 0x4074bf9300000000, + 0xc5ad294e00000000, 0x9dab5a3300000000, 0x1872ccee00000000, + 0xd61e065300000000, 0x53c7908e00000000, 0x49ff99ae00000000, + 0xcc260f7300000000, 0x024ac5ce00000000, 0x8793531300000000, + 0xdf95206e00000000, 0x5a4cb6b300000000, 0x94207c0e00000000, + 0x11f9ead300000000, 0x242c9af400000000, 0xa1f50c2900000000, + 0x6f99c69400000000, 0xea40504900000000, 0xb246233400000000, + 0x379fb5e900000000, 0xf9f37f5400000000, 0x7c2ae98900000000, + 0x93599e1a00000000, 0x168008c700000000, 0xd8ecc27a00000000, + 0x5d3554a700000000, 0x053327da00000000, 0x80eab10700000000, + 0x4e867bba00000000, 0xcb5fed6700000000, 0xfe8a9d4000000000, + 0x7b530b9d00000000, 0xb53fc12000000000, 0x30e657fd00000000, + 0x68e0248000000000, 0xed39b25d00000000, 0x235578e000000000, + 0xa68cee3d00000000}, + {0x0000000000000000, 0x76e10f9d00000000, 0xadc46ee100000000, + 0xdb25617c00000000, 0x1b8fac1900000000, 0x6d6ea38400000000, + 0xb64bc2f800000000, 0xc0aacd6500000000, 0x361e593300000000, + 0x40ff56ae00000000, 0x9bda37d200000000, 0xed3b384f00000000, + 0x2d91f52a00000000, 0x5b70fab700000000, 0x80559bcb00000000, + 0xf6b4945600000000, 0x6c3cb26600000000, 0x1addbdfb00000000, + 0xc1f8dc8700000000, 0xb719d31a00000000, 0x77b31e7f00000000, + 0x015211e200000000, 0xda77709e00000000, 0xac967f0300000000, + 0x5a22eb5500000000, 0x2cc3e4c800000000, 0xf7e685b400000000, + 0x81078a2900000000, 0x41ad474c00000000, 0x374c48d100000000, + 0xec6929ad00000000, 0x9a88263000000000, 0xd87864cd00000000, + 0xae996b5000000000, 0x75bc0a2c00000000, 0x035d05b100000000, + 0xc3f7c8d400000000, 0xb516c74900000000, 0x6e33a63500000000, + 0x18d2a9a800000000, 0xee663dfe00000000, 0x9887326300000000, + 0x43a2531f00000000, 0x35435c8200000000, 0xf5e991e700000000, + 0x83089e7a00000000, 0x582dff0600000000, 0x2eccf09b00000000, + 0xb444d6ab00000000, 0xc2a5d93600000000, 0x1980b84a00000000, + 0x6f61b7d700000000, 0xafcb7ab200000000, 0xd92a752f00000000, + 0x020f145300000000, 0x74ee1bce00000000, 0x825a8f9800000000, + 0xf4bb800500000000, 0x2f9ee17900000000, 0x597feee400000000, + 0x99d5238100000000, 0xef342c1c00000000, 0x34114d6000000000, + 0x42f042fd00000000, 0xf1f7b94100000000, 0x8716b6dc00000000, + 0x5c33d7a000000000, 0x2ad2d83d00000000, 0xea78155800000000, + 0x9c991ac500000000, 0x47bc7bb900000000, 0x315d742400000000, + 0xc7e9e07200000000, 0xb108efef00000000, 0x6a2d8e9300000000, + 0x1ccc810e00000000, 0xdc664c6b00000000, 0xaa8743f600000000, + 0x71a2228a00000000, 0x07432d1700000000, 0x9dcb0b2700000000, + 0xeb2a04ba00000000, 0x300f65c600000000, 0x46ee6a5b00000000, + 0x8644a73e00000000, 0xf0a5a8a300000000, 0x2b80c9df00000000, + 0x5d61c64200000000, 0xabd5521400000000, 0xdd345d8900000000, + 0x06113cf500000000, 0x70f0336800000000, 0xb05afe0d00000000, + 0xc6bbf19000000000, 0x1d9e90ec00000000, 0x6b7f9f7100000000, + 0x298fdd8c00000000, 0x5f6ed21100000000, 0x844bb36d00000000, + 0xf2aabcf000000000, 0x3200719500000000, 0x44e17e0800000000, + 0x9fc41f7400000000, 0xe92510e900000000, 0x1f9184bf00000000, + 0x69708b2200000000, 0xb255ea5e00000000, 0xc4b4e5c300000000, + 0x041e28a600000000, 0x72ff273b00000000, 0xa9da464700000000, + 0xdf3b49da00000000, 0x45b36fea00000000, 0x3352607700000000, + 0xe877010b00000000, 0x9e960e9600000000, 0x5e3cc3f300000000, + 0x28ddcc6e00000000, 0xf3f8ad1200000000, 0x8519a28f00000000, + 0x73ad36d900000000, 0x054c394400000000, 0xde69583800000000, + 0xa88857a500000000, 0x68229ac000000000, 0x1ec3955d00000000, + 0xc5e6f42100000000, 0xb307fbbc00000000, 0xe2ef738300000000, + 0x940e7c1e00000000, 0x4f2b1d6200000000, 0x39ca12ff00000000, + 0xf960df9a00000000, 0x8f81d00700000000, 0x54a4b17b00000000, + 0x2245bee600000000, 0xd4f12ab000000000, 0xa210252d00000000, + 0x7935445100000000, 0x0fd44bcc00000000, 0xcf7e86a900000000, + 0xb99f893400000000, 0x62bae84800000000, 0x145be7d500000000, + 0x8ed3c1e500000000, 0xf832ce7800000000, 0x2317af0400000000, + 0x55f6a09900000000, 0x955c6dfc00000000, 0xe3bd626100000000, + 0x3898031d00000000, 0x4e790c8000000000, 0xb8cd98d600000000, + 0xce2c974b00000000, 0x1509f63700000000, 0x63e8f9aa00000000, + 0xa34234cf00000000, 0xd5a33b5200000000, 0x0e865a2e00000000, + 0x786755b300000000, 0x3a97174e00000000, 0x4c7618d300000000, + 0x975379af00000000, 0xe1b2763200000000, 0x2118bb5700000000, + 0x57f9b4ca00000000, 0x8cdcd5b600000000, 0xfa3dda2b00000000, + 0x0c894e7d00000000, 0x7a6841e000000000, 0xa14d209c00000000, + 0xd7ac2f0100000000, 0x1706e26400000000, 0x61e7edf900000000, + 0xbac28c8500000000, 0xcc23831800000000, 0x56aba52800000000, + 0x204aaab500000000, 0xfb6fcbc900000000, 0x8d8ec45400000000, + 0x4d24093100000000, 0x3bc506ac00000000, 0xe0e067d000000000, + 0x9601684d00000000, 0x60b5fc1b00000000, 0x1654f38600000000, + 0xcd7192fa00000000, 0xbb909d6700000000, 0x7b3a500200000000, + 0x0ddb5f9f00000000, 0xd6fe3ee300000000, 0xa01f317e00000000, + 0x1318cac200000000, 0x65f9c55f00000000, 0xbedca42300000000, + 0xc83dabbe00000000, 0x089766db00000000, 0x7e76694600000000, + 0xa553083a00000000, 0xd3b207a700000000, 0x250693f100000000, + 0x53e79c6c00000000, 0x88c2fd1000000000, 0xfe23f28d00000000, + 0x3e893fe800000000, 0x4868307500000000, 0x934d510900000000, + 0xe5ac5e9400000000, 0x7f2478a400000000, 0x09c5773900000000, + 0xd2e0164500000000, 0xa40119d800000000, 0x64abd4bd00000000, + 0x124adb2000000000, 0xc96fba5c00000000, 0xbf8eb5c100000000, + 0x493a219700000000, 0x3fdb2e0a00000000, 0xe4fe4f7600000000, + 0x921f40eb00000000, 0x52b58d8e00000000, 0x2454821300000000, + 0xff71e36f00000000, 0x8990ecf200000000, 0xcb60ae0f00000000, + 0xbd81a19200000000, 0x66a4c0ee00000000, 0x1045cf7300000000, + 0xd0ef021600000000, 0xa60e0d8b00000000, 0x7d2b6cf700000000, + 0x0bca636a00000000, 0xfd7ef73c00000000, 0x8b9ff8a100000000, + 0x50ba99dd00000000, 0x265b964000000000, 0xe6f15b2500000000, + 0x901054b800000000, 0x4b3535c400000000, 0x3dd43a5900000000, + 0xa75c1c6900000000, 0xd1bd13f400000000, 0x0a98728800000000, + 0x7c797d1500000000, 0xbcd3b07000000000, 0xca32bfed00000000, + 0x1117de9100000000, 0x67f6d10c00000000, 0x9142455a00000000, + 0xe7a34ac700000000, 0x3c862bbb00000000, 0x4a67242600000000, + 0x8acde94300000000, 0xfc2ce6de00000000, 0x270987a200000000, + 0x51e8883f00000000}, + {0x0000000000000000, 0xe8dbfbb900000000, 0x91b186a800000000, + 0x796a7d1100000000, 0x63657c8a00000000, 0x8bbe873300000000, + 0xf2d4fa2200000000, 0x1a0f019b00000000, 0x87cc89cf00000000, + 0x6f17727600000000, 0x167d0f6700000000, 0xfea6f4de00000000, + 0xe4a9f54500000000, 0x0c720efc00000000, 0x751873ed00000000, + 0x9dc3885400000000, 0x4f9f624400000000, 0xa74499fd00000000, + 0xde2ee4ec00000000, 0x36f51f5500000000, 0x2cfa1ece00000000, + 0xc421e57700000000, 0xbd4b986600000000, 0x559063df00000000, + 0xc853eb8b00000000, 0x2088103200000000, 0x59e26d2300000000, + 0xb139969a00000000, 0xab36970100000000, 0x43ed6cb800000000, + 0x3a8711a900000000, 0xd25cea1000000000, 0x9e3ec58800000000, + 0x76e53e3100000000, 0x0f8f432000000000, 0xe754b89900000000, + 0xfd5bb90200000000, 0x158042bb00000000, 0x6cea3faa00000000, + 0x8431c41300000000, 0x19f24c4700000000, 0xf129b7fe00000000, + 0x8843caef00000000, 0x6098315600000000, 0x7a9730cd00000000, + 0x924ccb7400000000, 0xeb26b66500000000, 0x03fd4ddc00000000, + 0xd1a1a7cc00000000, 0x397a5c7500000000, 0x4010216400000000, + 0xa8cbdadd00000000, 0xb2c4db4600000000, 0x5a1f20ff00000000, + 0x23755dee00000000, 0xcbaea65700000000, 0x566d2e0300000000, + 0xbeb6d5ba00000000, 0xc7dca8ab00000000, 0x2f07531200000000, + 0x3508528900000000, 0xddd3a93000000000, 0xa4b9d42100000000, + 0x4c622f9800000000, 0x7d7bfbca00000000, 0x95a0007300000000, + 0xecca7d6200000000, 0x041186db00000000, 0x1e1e874000000000, + 0xf6c57cf900000000, 0x8faf01e800000000, 0x6774fa5100000000, + 0xfab7720500000000, 0x126c89bc00000000, 0x6b06f4ad00000000, + 0x83dd0f1400000000, 0x99d20e8f00000000, 0x7109f53600000000, + 0x0863882700000000, 0xe0b8739e00000000, 0x32e4998e00000000, + 0xda3f623700000000, 0xa3551f2600000000, 0x4b8ee49f00000000, + 0x5181e50400000000, 0xb95a1ebd00000000, 0xc03063ac00000000, + 0x28eb981500000000, 0xb528104100000000, 0x5df3ebf800000000, + 0x249996e900000000, 0xcc426d5000000000, 0xd64d6ccb00000000, + 0x3e96977200000000, 0x47fcea6300000000, 0xaf2711da00000000, + 0xe3453e4200000000, 0x0b9ec5fb00000000, 0x72f4b8ea00000000, + 0x9a2f435300000000, 0x802042c800000000, 0x68fbb97100000000, + 0x1191c46000000000, 0xf94a3fd900000000, 0x6489b78d00000000, + 0x8c524c3400000000, 0xf538312500000000, 0x1de3ca9c00000000, + 0x07eccb0700000000, 0xef3730be00000000, 0x965d4daf00000000, + 0x7e86b61600000000, 0xacda5c0600000000, 0x4401a7bf00000000, + 0x3d6bdaae00000000, 0xd5b0211700000000, 0xcfbf208c00000000, + 0x2764db3500000000, 0x5e0ea62400000000, 0xb6d55d9d00000000, + 0x2b16d5c900000000, 0xc3cd2e7000000000, 0xbaa7536100000000, + 0x527ca8d800000000, 0x4873a94300000000, 0xa0a852fa00000000, + 0xd9c22feb00000000, 0x3119d45200000000, 0xbbf0874e00000000, + 0x532b7cf700000000, 0x2a4101e600000000, 0xc29afa5f00000000, + 0xd895fbc400000000, 0x304e007d00000000, 0x49247d6c00000000, + 0xa1ff86d500000000, 0x3c3c0e8100000000, 0xd4e7f53800000000, + 0xad8d882900000000, 0x4556739000000000, 0x5f59720b00000000, + 0xb78289b200000000, 0xcee8f4a300000000, 0x26330f1a00000000, + 0xf46fe50a00000000, 0x1cb41eb300000000, 0x65de63a200000000, + 0x8d05981b00000000, 0x970a998000000000, 0x7fd1623900000000, + 0x06bb1f2800000000, 0xee60e49100000000, 0x73a36cc500000000, + 0x9b78977c00000000, 0xe212ea6d00000000, 0x0ac911d400000000, + 0x10c6104f00000000, 0xf81debf600000000, 0x817796e700000000, + 0x69ac6d5e00000000, 0x25ce42c600000000, 0xcd15b97f00000000, + 0xb47fc46e00000000, 0x5ca43fd700000000, 0x46ab3e4c00000000, + 0xae70c5f500000000, 0xd71ab8e400000000, 0x3fc1435d00000000, + 0xa202cb0900000000, 0x4ad930b000000000, 0x33b34da100000000, + 0xdb68b61800000000, 0xc167b78300000000, 0x29bc4c3a00000000, + 0x50d6312b00000000, 0xb80dca9200000000, 0x6a51208200000000, + 0x828adb3b00000000, 0xfbe0a62a00000000, 0x133b5d9300000000, + 0x09345c0800000000, 0xe1efa7b100000000, 0x9885daa000000000, + 0x705e211900000000, 0xed9da94d00000000, 0x054652f400000000, + 0x7c2c2fe500000000, 0x94f7d45c00000000, 0x8ef8d5c700000000, + 0x66232e7e00000000, 0x1f49536f00000000, 0xf792a8d600000000, + 0xc68b7c8400000000, 0x2e50873d00000000, 0x573afa2c00000000, + 0xbfe1019500000000, 0xa5ee000e00000000, 0x4d35fbb700000000, + 0x345f86a600000000, 0xdc847d1f00000000, 0x4147f54b00000000, + 0xa99c0ef200000000, 0xd0f673e300000000, 0x382d885a00000000, + 0x222289c100000000, 0xcaf9727800000000, 0xb3930f6900000000, + 0x5b48f4d000000000, 0x89141ec000000000, 0x61cfe57900000000, + 0x18a5986800000000, 0xf07e63d100000000, 0xea71624a00000000, + 0x02aa99f300000000, 0x7bc0e4e200000000, 0x931b1f5b00000000, + 0x0ed8970f00000000, 0xe6036cb600000000, 0x9f6911a700000000, + 0x77b2ea1e00000000, 0x6dbdeb8500000000, 0x8566103c00000000, + 0xfc0c6d2d00000000, 0x14d7969400000000, 0x58b5b90c00000000, + 0xb06e42b500000000, 0xc9043fa400000000, 0x21dfc41d00000000, + 0x3bd0c58600000000, 0xd30b3e3f00000000, 0xaa61432e00000000, + 0x42bab89700000000, 0xdf7930c300000000, 0x37a2cb7a00000000, + 0x4ec8b66b00000000, 0xa6134dd200000000, 0xbc1c4c4900000000, + 0x54c7b7f000000000, 0x2dadcae100000000, 0xc576315800000000, + 0x172adb4800000000, 0xfff120f100000000, 0x869b5de000000000, + 0x6e40a65900000000, 0x744fa7c200000000, 0x9c945c7b00000000, + 0xe5fe216a00000000, 0x0d25dad300000000, 0x90e6528700000000, + 0x783da93e00000000, 0x0157d42f00000000, 0xe98c2f9600000000, + 0xf3832e0d00000000, 0x1b58d5b400000000, 0x6232a8a500000000, + 0x8ae9531c00000000}, + {0x0000000000000000, 0x919168ae00000000, 0x6325a08700000000, + 0xf2b4c82900000000, 0x874c31d400000000, 0x16dd597a00000000, + 0xe469915300000000, 0x75f8f9fd00000000, 0x4f9f137300000000, + 0xde0e7bdd00000000, 0x2cbab3f400000000, 0xbd2bdb5a00000000, + 0xc8d322a700000000, 0x59424a0900000000, 0xabf6822000000000, + 0x3a67ea8e00000000, 0x9e3e27e600000000, 0x0faf4f4800000000, + 0xfd1b876100000000, 0x6c8aefcf00000000, 0x1972163200000000, + 0x88e37e9c00000000, 0x7a57b6b500000000, 0xebc6de1b00000000, + 0xd1a1349500000000, 0x40305c3b00000000, 0xb284941200000000, + 0x2315fcbc00000000, 0x56ed054100000000, 0xc77c6def00000000, + 0x35c8a5c600000000, 0xa459cd6800000000, 0x7d7b3f1700000000, + 0xecea57b900000000, 0x1e5e9f9000000000, 0x8fcff73e00000000, + 0xfa370ec300000000, 0x6ba6666d00000000, 0x9912ae4400000000, + 0x0883c6ea00000000, 0x32e42c6400000000, 0xa37544ca00000000, + 0x51c18ce300000000, 0xc050e44d00000000, 0xb5a81db000000000, + 0x2439751e00000000, 0xd68dbd3700000000, 0x471cd59900000000, + 0xe34518f100000000, 0x72d4705f00000000, 0x8060b87600000000, + 0x11f1d0d800000000, 0x6409292500000000, 0xf598418b00000000, + 0x072c89a200000000, 0x96bde10c00000000, 0xacda0b8200000000, + 0x3d4b632c00000000, 0xcfffab0500000000, 0x5e6ec3ab00000000, + 0x2b963a5600000000, 0xba0752f800000000, 0x48b39ad100000000, + 0xd922f27f00000000, 0xfaf67e2e00000000, 0x6b67168000000000, + 0x99d3dea900000000, 0x0842b60700000000, 0x7dba4ffa00000000, + 0xec2b275400000000, 0x1e9fef7d00000000, 0x8f0e87d300000000, + 0xb5696d5d00000000, 0x24f805f300000000, 0xd64ccdda00000000, + 0x47dda57400000000, 0x32255c8900000000, 0xa3b4342700000000, + 0x5100fc0e00000000, 0xc09194a000000000, 0x64c859c800000000, + 0xf559316600000000, 0x07edf94f00000000, 0x967c91e100000000, + 0xe384681c00000000, 0x721500b200000000, 0x80a1c89b00000000, + 0x1130a03500000000, 0x2b574abb00000000, 0xbac6221500000000, + 0x4872ea3c00000000, 0xd9e3829200000000, 0xac1b7b6f00000000, + 0x3d8a13c100000000, 0xcf3edbe800000000, 0x5eafb34600000000, + 0x878d413900000000, 0x161c299700000000, 0xe4a8e1be00000000, + 0x7539891000000000, 0x00c170ed00000000, 0x9150184300000000, + 0x63e4d06a00000000, 0xf275b8c400000000, 0xc812524a00000000, + 0x59833ae400000000, 0xab37f2cd00000000, 0x3aa69a6300000000, + 0x4f5e639e00000000, 0xdecf0b3000000000, 0x2c7bc31900000000, + 0xbdeaabb700000000, 0x19b366df00000000, 0x88220e7100000000, + 0x7a96c65800000000, 0xeb07aef600000000, 0x9eff570b00000000, + 0x0f6e3fa500000000, 0xfddaf78c00000000, 0x6c4b9f2200000000, + 0x562c75ac00000000, 0xc7bd1d0200000000, 0x3509d52b00000000, + 0xa498bd8500000000, 0xd160447800000000, 0x40f12cd600000000, + 0xb245e4ff00000000, 0x23d48c5100000000, 0xf4edfd5c00000000, + 0x657c95f200000000, 0x97c85ddb00000000, 0x0659357500000000, + 0x73a1cc8800000000, 0xe230a42600000000, 0x10846c0f00000000, + 0x811504a100000000, 0xbb72ee2f00000000, 0x2ae3868100000000, + 0xd8574ea800000000, 0x49c6260600000000, 0x3c3edffb00000000, + 0xadafb75500000000, 0x5f1b7f7c00000000, 0xce8a17d200000000, + 0x6ad3daba00000000, 0xfb42b21400000000, 0x09f67a3d00000000, + 0x9867129300000000, 0xed9feb6e00000000, 0x7c0e83c000000000, + 0x8eba4be900000000, 0x1f2b234700000000, 0x254cc9c900000000, + 0xb4dda16700000000, 0x4669694e00000000, 0xd7f801e000000000, + 0xa200f81d00000000, 0x339190b300000000, 0xc125589a00000000, + 0x50b4303400000000, 0x8996c24b00000000, 0x1807aae500000000, + 0xeab362cc00000000, 0x7b220a6200000000, 0x0edaf39f00000000, + 0x9f4b9b3100000000, 0x6dff531800000000, 0xfc6e3bb600000000, + 0xc609d13800000000, 0x5798b99600000000, 0xa52c71bf00000000, + 0x34bd191100000000, 0x4145e0ec00000000, 0xd0d4884200000000, + 0x2260406b00000000, 0xb3f128c500000000, 0x17a8e5ad00000000, + 0x86398d0300000000, 0x748d452a00000000, 0xe51c2d8400000000, + 0x90e4d47900000000, 0x0175bcd700000000, 0xf3c174fe00000000, + 0x62501c5000000000, 0x5837f6de00000000, 0xc9a69e7000000000, + 0x3b12565900000000, 0xaa833ef700000000, 0xdf7bc70a00000000, + 0x4eeaafa400000000, 0xbc5e678d00000000, 0x2dcf0f2300000000, + 0x0e1b837200000000, 0x9f8aebdc00000000, 0x6d3e23f500000000, + 0xfcaf4b5b00000000, 0x8957b2a600000000, 0x18c6da0800000000, + 0xea72122100000000, 0x7be37a8f00000000, 0x4184900100000000, + 0xd015f8af00000000, 0x22a1308600000000, 0xb330582800000000, + 0xc6c8a1d500000000, 0x5759c97b00000000, 0xa5ed015200000000, + 0x347c69fc00000000, 0x9025a49400000000, 0x01b4cc3a00000000, + 0xf300041300000000, 0x62916cbd00000000, 0x1769954000000000, + 0x86f8fdee00000000, 0x744c35c700000000, 0xe5dd5d6900000000, + 0xdfbab7e700000000, 0x4e2bdf4900000000, 0xbc9f176000000000, + 0x2d0e7fce00000000, 0x58f6863300000000, 0xc967ee9d00000000, + 0x3bd326b400000000, 0xaa424e1a00000000, 0x7360bc6500000000, + 0xe2f1d4cb00000000, 0x10451ce200000000, 0x81d4744c00000000, + 0xf42c8db100000000, 0x65bde51f00000000, 0x97092d3600000000, + 0x0698459800000000, 0x3cffaf1600000000, 0xad6ec7b800000000, + 0x5fda0f9100000000, 0xce4b673f00000000, 0xbbb39ec200000000, + 0x2a22f66c00000000, 0xd8963e4500000000, 0x490756eb00000000, + 0xed5e9b8300000000, 0x7ccff32d00000000, 0x8e7b3b0400000000, + 0x1fea53aa00000000, 0x6a12aa5700000000, 0xfb83c2f900000000, + 0x09370ad000000000, 0x98a6627e00000000, 0xa2c188f000000000, + 0x3350e05e00000000, 0xc1e4287700000000, 0x507540d900000000, + 0x258db92400000000, 0xb41cd18a00000000, 0x46a819a300000000, + 0xd739710d00000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xccaa009e, 0x4225077d, 0x8e8f07e3, 0x844a0efa, + 0x48e00e64, 0xc66f0987, 0x0ac50919, 0xd3e51bb5, 0x1f4f1b2b, + 0x91c01cc8, 0x5d6a1c56, 0x57af154f, 0x9b0515d1, 0x158a1232, + 0xd92012ac, 0x7cbb312b, 0xb01131b5, 0x3e9e3656, 0xf23436c8, + 0xf8f13fd1, 0x345b3f4f, 0xbad438ac, 0x767e3832, 0xaf5e2a9e, + 0x63f42a00, 0xed7b2de3, 0x21d12d7d, 0x2b142464, 0xe7be24fa, + 0x69312319, 0xa59b2387, 0xf9766256, 0x35dc62c8, 0xbb53652b, + 0x77f965b5, 0x7d3c6cac, 0xb1966c32, 0x3f196bd1, 0xf3b36b4f, + 0x2a9379e3, 0xe639797d, 0x68b67e9e, 0xa41c7e00, 0xaed97719, + 0x62737787, 0xecfc7064, 0x205670fa, 0x85cd537d, 0x496753e3, + 0xc7e85400, 0x0b42549e, 0x01875d87, 0xcd2d5d19, 0x43a25afa, + 0x8f085a64, 0x562848c8, 0x9a824856, 0x140d4fb5, 0xd8a74f2b, + 0xd2624632, 0x1ec846ac, 0x9047414f, 0x5ced41d1, 0x299dc2ed, + 0xe537c273, 0x6bb8c590, 0xa712c50e, 0xadd7cc17, 0x617dcc89, + 0xeff2cb6a, 0x2358cbf4, 0xfa78d958, 0x36d2d9c6, 0xb85dde25, + 0x74f7debb, 0x7e32d7a2, 0xb298d73c, 0x3c17d0df, 0xf0bdd041, + 0x5526f3c6, 0x998cf358, 0x1703f4bb, 0xdba9f425, 0xd16cfd3c, + 0x1dc6fda2, 0x9349fa41, 0x5fe3fadf, 0x86c3e873, 0x4a69e8ed, + 0xc4e6ef0e, 0x084cef90, 0x0289e689, 0xce23e617, 0x40ace1f4, + 0x8c06e16a, 0xd0eba0bb, 0x1c41a025, 0x92cea7c6, 0x5e64a758, + 0x54a1ae41, 0x980baedf, 0x1684a93c, 0xda2ea9a2, 0x030ebb0e, + 0xcfa4bb90, 0x412bbc73, 0x8d81bced, 0x8744b5f4, 0x4beeb56a, + 0xc561b289, 0x09cbb217, 0xac509190, 0x60fa910e, 0xee7596ed, + 0x22df9673, 0x281a9f6a, 0xe4b09ff4, 0x6a3f9817, 0xa6959889, + 0x7fb58a25, 0xb31f8abb, 0x3d908d58, 0xf13a8dc6, 0xfbff84df, + 0x37558441, 0xb9da83a2, 0x7570833c, 0x533b85da, 0x9f918544, + 0x111e82a7, 0xddb48239, 0xd7718b20, 0x1bdb8bbe, 0x95548c5d, + 0x59fe8cc3, 0x80de9e6f, 0x4c749ef1, 0xc2fb9912, 0x0e51998c, + 0x04949095, 0xc83e900b, 0x46b197e8, 0x8a1b9776, 0x2f80b4f1, + 0xe32ab46f, 0x6da5b38c, 0xa10fb312, 0xabcaba0b, 0x6760ba95, + 0xe9efbd76, 0x2545bde8, 0xfc65af44, 0x30cfafda, 0xbe40a839, + 0x72eaa8a7, 0x782fa1be, 0xb485a120, 0x3a0aa6c3, 0xf6a0a65d, + 0xaa4de78c, 0x66e7e712, 0xe868e0f1, 0x24c2e06f, 0x2e07e976, + 0xe2ade9e8, 0x6c22ee0b, 0xa088ee95, 0x79a8fc39, 0xb502fca7, + 0x3b8dfb44, 0xf727fbda, 0xfde2f2c3, 0x3148f25d, 0xbfc7f5be, + 0x736df520, 0xd6f6d6a7, 0x1a5cd639, 0x94d3d1da, 0x5879d144, + 0x52bcd85d, 0x9e16d8c3, 0x1099df20, 0xdc33dfbe, 0x0513cd12, + 0xc9b9cd8c, 0x4736ca6f, 0x8b9ccaf1, 0x8159c3e8, 0x4df3c376, + 0xc37cc495, 0x0fd6c40b, 0x7aa64737, 0xb60c47a9, 0x3883404a, + 0xf42940d4, 0xfeec49cd, 0x32464953, 0xbcc94eb0, 0x70634e2e, + 0xa9435c82, 0x65e95c1c, 0xeb665bff, 0x27cc5b61, 0x2d095278, + 0xe1a352e6, 0x6f2c5505, 0xa386559b, 0x061d761c, 0xcab77682, + 0x44387161, 0x889271ff, 0x825778e6, 0x4efd7878, 0xc0727f9b, + 0x0cd87f05, 0xd5f86da9, 0x19526d37, 0x97dd6ad4, 0x5b776a4a, + 0x51b26353, 0x9d1863cd, 0x1397642e, 0xdf3d64b0, 0x83d02561, + 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, + 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, + 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd, + 0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, + 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, + 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, + 0x264b06e6}, + {0x00000000, 0xa6770bb4, 0x979f1129, 0x31e81a9d, 0xf44f2413, + 0x52382fa7, 0x63d0353a, 0xc5a73e8e, 0x33ef4e67, 0x959845d3, + 0xa4705f4e, 0x020754fa, 0xc7a06a74, 0x61d761c0, 0x503f7b5d, + 0xf64870e9, 0x67de9cce, 0xc1a9977a, 0xf0418de7, 0x56368653, + 0x9391b8dd, 0x35e6b369, 0x040ea9f4, 0xa279a240, 0x5431d2a9, + 0xf246d91d, 0xc3aec380, 0x65d9c834, 0xa07ef6ba, 0x0609fd0e, + 0x37e1e793, 0x9196ec27, 0xcfbd399c, 0x69ca3228, 0x582228b5, + 0xfe552301, 0x3bf21d8f, 0x9d85163b, 0xac6d0ca6, 0x0a1a0712, + 0xfc5277fb, 0x5a257c4f, 0x6bcd66d2, 0xcdba6d66, 0x081d53e8, + 0xae6a585c, 0x9f8242c1, 0x39f54975, 0xa863a552, 0x0e14aee6, + 0x3ffcb47b, 0x998bbfcf, 0x5c2c8141, 0xfa5b8af5, 0xcbb39068, + 0x6dc49bdc, 0x9b8ceb35, 0x3dfbe081, 0x0c13fa1c, 0xaa64f1a8, + 0x6fc3cf26, 0xc9b4c492, 0xf85cde0f, 0x5e2bd5bb, 0x440b7579, + 0xe27c7ecd, 0xd3946450, 0x75e36fe4, 0xb044516a, 0x16335ade, + 0x27db4043, 0x81ac4bf7, 0x77e43b1e, 0xd19330aa, 0xe07b2a37, + 0x460c2183, 0x83ab1f0d, 0x25dc14b9, 0x14340e24, 0xb2430590, + 0x23d5e9b7, 0x85a2e203, 0xb44af89e, 0x123df32a, 0xd79acda4, + 0x71edc610, 0x4005dc8d, 0xe672d739, 0x103aa7d0, 0xb64dac64, + 0x87a5b6f9, 0x21d2bd4d, 0xe47583c3, 0x42028877, 0x73ea92ea, + 0xd59d995e, 0x8bb64ce5, 0x2dc14751, 0x1c295dcc, 0xba5e5678, + 0x7ff968f6, 0xd98e6342, 0xe86679df, 0x4e11726b, 0xb8590282, + 0x1e2e0936, 0x2fc613ab, 0x89b1181f, 0x4c162691, 0xea612d25, + 0xdb8937b8, 0x7dfe3c0c, 0xec68d02b, 0x4a1fdb9f, 0x7bf7c102, + 0xdd80cab6, 0x1827f438, 0xbe50ff8c, 0x8fb8e511, 0x29cfeea5, + 0xdf879e4c, 0x79f095f8, 0x48188f65, 0xee6f84d1, 0x2bc8ba5f, + 0x8dbfb1eb, 0xbc57ab76, 0x1a20a0c2, 0x8816eaf2, 0x2e61e146, + 0x1f89fbdb, 0xb9fef06f, 0x7c59cee1, 0xda2ec555, 0xebc6dfc8, + 0x4db1d47c, 0xbbf9a495, 0x1d8eaf21, 0x2c66b5bc, 0x8a11be08, + 0x4fb68086, 0xe9c18b32, 0xd82991af, 0x7e5e9a1b, 0xefc8763c, + 0x49bf7d88, 0x78576715, 0xde206ca1, 0x1b87522f, 0xbdf0599b, + 0x8c184306, 0x2a6f48b2, 0xdc27385b, 0x7a5033ef, 0x4bb82972, + 0xedcf22c6, 0x28681c48, 0x8e1f17fc, 0xbff70d61, 0x198006d5, + 0x47abd36e, 0xe1dcd8da, 0xd034c247, 0x7643c9f3, 0xb3e4f77d, + 0x1593fcc9, 0x247be654, 0x820cede0, 0x74449d09, 0xd23396bd, + 0xe3db8c20, 0x45ac8794, 0x800bb91a, 0x267cb2ae, 0x1794a833, + 0xb1e3a387, 0x20754fa0, 0x86024414, 0xb7ea5e89, 0x119d553d, + 0xd43a6bb3, 0x724d6007, 0x43a57a9a, 0xe5d2712e, 0x139a01c7, + 0xb5ed0a73, 0x840510ee, 0x22721b5a, 0xe7d525d4, 0x41a22e60, + 0x704a34fd, 0xd63d3f49, 0xcc1d9f8b, 0x6a6a943f, 0x5b828ea2, + 0xfdf58516, 0x3852bb98, 0x9e25b02c, 0xafcdaab1, 0x09baa105, + 0xfff2d1ec, 0x5985da58, 0x686dc0c5, 0xce1acb71, 0x0bbdf5ff, + 0xadcafe4b, 0x9c22e4d6, 0x3a55ef62, 0xabc30345, 0x0db408f1, + 0x3c5c126c, 0x9a2b19d8, 0x5f8c2756, 0xf9fb2ce2, 0xc813367f, + 0x6e643dcb, 0x982c4d22, 0x3e5b4696, 0x0fb35c0b, 0xa9c457bf, + 0x6c636931, 0xca146285, 0xfbfc7818, 0x5d8b73ac, 0x03a0a617, + 0xa5d7ada3, 0x943fb73e, 0x3248bc8a, 0xf7ef8204, 0x519889b0, + 0x6070932d, 0xc6079899, 0x304fe870, 0x9638e3c4, 0xa7d0f959, + 0x01a7f2ed, 0xc400cc63, 0x6277c7d7, 0x539fdd4a, 0xf5e8d6fe, + 0x647e3ad9, 0xc209316d, 0xf3e12bf0, 0x55962044, 0x90311eca, + 0x3646157e, 0x07ae0fe3, 0xa1d90457, 0x579174be, 0xf1e67f0a, + 0xc00e6597, 0x66796e23, 0xa3de50ad, 0x05a95b19, 0x34414184, + 0x92364a30}, + {0x00000000, 0xcb5cd3a5, 0x4dc8a10b, 0x869472ae, 0x9b914216, + 0x50cd91b3, 0xd659e31d, 0x1d0530b8, 0xec53826d, 0x270f51c8, + 0xa19b2366, 0x6ac7f0c3, 0x77c2c07b, 0xbc9e13de, 0x3a0a6170, + 0xf156b2d5, 0x03d6029b, 0xc88ad13e, 0x4e1ea390, 0x85427035, + 0x9847408d, 0x531b9328, 0xd58fe186, 0x1ed33223, 0xef8580f6, + 0x24d95353, 0xa24d21fd, 0x6911f258, 0x7414c2e0, 0xbf481145, + 0x39dc63eb, 0xf280b04e, 0x07ac0536, 0xccf0d693, 0x4a64a43d, + 0x81387798, 0x9c3d4720, 0x57619485, 0xd1f5e62b, 0x1aa9358e, + 0xebff875b, 0x20a354fe, 0xa6372650, 0x6d6bf5f5, 0x706ec54d, + 0xbb3216e8, 0x3da66446, 0xf6fab7e3, 0x047a07ad, 0xcf26d408, + 0x49b2a6a6, 0x82ee7503, 0x9feb45bb, 0x54b7961e, 0xd223e4b0, + 0x197f3715, 0xe82985c0, 0x23755665, 0xa5e124cb, 0x6ebdf76e, + 0x73b8c7d6, 0xb8e41473, 0x3e7066dd, 0xf52cb578, 0x0f580a6c, + 0xc404d9c9, 0x4290ab67, 0x89cc78c2, 0x94c9487a, 0x5f959bdf, + 0xd901e971, 0x125d3ad4, 0xe30b8801, 0x28575ba4, 0xaec3290a, + 0x659ffaaf, 0x789aca17, 0xb3c619b2, 0x35526b1c, 0xfe0eb8b9, + 0x0c8e08f7, 0xc7d2db52, 0x4146a9fc, 0x8a1a7a59, 0x971f4ae1, + 0x5c439944, 0xdad7ebea, 0x118b384f, 0xe0dd8a9a, 0x2b81593f, + 0xad152b91, 0x6649f834, 0x7b4cc88c, 0xb0101b29, 0x36846987, + 0xfdd8ba22, 0x08f40f5a, 0xc3a8dcff, 0x453cae51, 0x8e607df4, + 0x93654d4c, 0x58399ee9, 0xdeadec47, 0x15f13fe2, 0xe4a78d37, + 0x2ffb5e92, 0xa96f2c3c, 0x6233ff99, 0x7f36cf21, 0xb46a1c84, + 0x32fe6e2a, 0xf9a2bd8f, 0x0b220dc1, 0xc07ede64, 0x46eaacca, + 0x8db67f6f, 0x90b34fd7, 0x5bef9c72, 0xdd7beedc, 0x16273d79, + 0xe7718fac, 0x2c2d5c09, 0xaab92ea7, 0x61e5fd02, 0x7ce0cdba, + 0xb7bc1e1f, 0x31286cb1, 0xfa74bf14, 0x1eb014d8, 0xd5ecc77d, + 0x5378b5d3, 0x98246676, 0x852156ce, 0x4e7d856b, 0xc8e9f7c5, + 0x03b52460, 0xf2e396b5, 0x39bf4510, 0xbf2b37be, 0x7477e41b, + 0x6972d4a3, 0xa22e0706, 0x24ba75a8, 0xefe6a60d, 0x1d661643, + 0xd63ac5e6, 0x50aeb748, 0x9bf264ed, 0x86f75455, 0x4dab87f0, + 0xcb3ff55e, 0x006326fb, 0xf135942e, 0x3a69478b, 0xbcfd3525, + 0x77a1e680, 0x6aa4d638, 0xa1f8059d, 0x276c7733, 0xec30a496, + 0x191c11ee, 0xd240c24b, 0x54d4b0e5, 0x9f886340, 0x828d53f8, + 0x49d1805d, 0xcf45f2f3, 0x04192156, 0xf54f9383, 0x3e134026, + 0xb8873288, 0x73dbe12d, 0x6eded195, 0xa5820230, 0x2316709e, + 0xe84aa33b, 0x1aca1375, 0xd196c0d0, 0x5702b27e, 0x9c5e61db, + 0x815b5163, 0x4a0782c6, 0xcc93f068, 0x07cf23cd, 0xf6999118, + 0x3dc542bd, 0xbb513013, 0x700de3b6, 0x6d08d30e, 0xa65400ab, + 0x20c07205, 0xeb9ca1a0, 0x11e81eb4, 0xdab4cd11, 0x5c20bfbf, + 0x977c6c1a, 0x8a795ca2, 0x41258f07, 0xc7b1fda9, 0x0ced2e0c, + 0xfdbb9cd9, 0x36e74f7c, 0xb0733dd2, 0x7b2fee77, 0x662adecf, + 0xad760d6a, 0x2be27fc4, 0xe0beac61, 0x123e1c2f, 0xd962cf8a, + 0x5ff6bd24, 0x94aa6e81, 0x89af5e39, 0x42f38d9c, 0xc467ff32, + 0x0f3b2c97, 0xfe6d9e42, 0x35314de7, 0xb3a53f49, 0x78f9ecec, + 0x65fcdc54, 0xaea00ff1, 0x28347d5f, 0xe368aefa, 0x16441b82, + 0xdd18c827, 0x5b8cba89, 0x90d0692c, 0x8dd55994, 0x46898a31, + 0xc01df89f, 0x0b412b3a, 0xfa1799ef, 0x314b4a4a, 0xb7df38e4, + 0x7c83eb41, 0x6186dbf9, 0xaada085c, 0x2c4e7af2, 0xe712a957, + 0x15921919, 0xdececabc, 0x585ab812, 0x93066bb7, 0x8e035b0f, + 0x455f88aa, 0xc3cbfa04, 0x089729a1, 0xf9c19b74, 0x329d48d1, + 0xb4093a7f, 0x7f55e9da, 0x6250d962, 0xa90c0ac7, 0x2f987869, + 0xe4c4abcc}, + {0x00000000, 0x3d6029b0, 0x7ac05360, 0x47a07ad0, 0xf580a6c0, + 0xc8e08f70, 0x8f40f5a0, 0xb220dc10, 0x30704bc1, 0x0d106271, + 0x4ab018a1, 0x77d03111, 0xc5f0ed01, 0xf890c4b1, 0xbf30be61, + 0x825097d1, 0x60e09782, 0x5d80be32, 0x1a20c4e2, 0x2740ed52, + 0x95603142, 0xa80018f2, 0xefa06222, 0xd2c04b92, 0x5090dc43, + 0x6df0f5f3, 0x2a508f23, 0x1730a693, 0xa5107a83, 0x98705333, + 0xdfd029e3, 0xe2b00053, 0xc1c12f04, 0xfca106b4, 0xbb017c64, + 0x866155d4, 0x344189c4, 0x0921a074, 0x4e81daa4, 0x73e1f314, + 0xf1b164c5, 0xccd14d75, 0x8b7137a5, 0xb6111e15, 0x0431c205, + 0x3951ebb5, 0x7ef19165, 0x4391b8d5, 0xa121b886, 0x9c419136, + 0xdbe1ebe6, 0xe681c256, 0x54a11e46, 0x69c137f6, 0x2e614d26, + 0x13016496, 0x9151f347, 0xac31daf7, 0xeb91a027, 0xd6f18997, + 0x64d15587, 0x59b17c37, 0x1e1106e7, 0x23712f57, 0x58f35849, + 0x659371f9, 0x22330b29, 0x1f532299, 0xad73fe89, 0x9013d739, + 0xd7b3ade9, 0xead38459, 0x68831388, 0x55e33a38, 0x124340e8, + 0x2f236958, 0x9d03b548, 0xa0639cf8, 0xe7c3e628, 0xdaa3cf98, + 0x3813cfcb, 0x0573e67b, 0x42d39cab, 0x7fb3b51b, 0xcd93690b, + 0xf0f340bb, 0xb7533a6b, 0x8a3313db, 0x0863840a, 0x3503adba, + 0x72a3d76a, 0x4fc3feda, 0xfde322ca, 0xc0830b7a, 0x872371aa, + 0xba43581a, 0x9932774d, 0xa4525efd, 0xe3f2242d, 0xde920d9d, + 0x6cb2d18d, 0x51d2f83d, 0x167282ed, 0x2b12ab5d, 0xa9423c8c, + 0x9422153c, 0xd3826fec, 0xeee2465c, 0x5cc29a4c, 0x61a2b3fc, + 0x2602c92c, 0x1b62e09c, 0xf9d2e0cf, 0xc4b2c97f, 0x8312b3af, + 0xbe729a1f, 0x0c52460f, 0x31326fbf, 0x7692156f, 0x4bf23cdf, + 0xc9a2ab0e, 0xf4c282be, 0xb362f86e, 0x8e02d1de, 0x3c220dce, + 0x0142247e, 0x46e25eae, 0x7b82771e, 0xb1e6b092, 0x8c869922, + 0xcb26e3f2, 0xf646ca42, 0x44661652, 0x79063fe2, 0x3ea64532, + 0x03c66c82, 0x8196fb53, 0xbcf6d2e3, 0xfb56a833, 0xc6368183, + 0x74165d93, 0x49767423, 0x0ed60ef3, 0x33b62743, 0xd1062710, + 0xec660ea0, 0xabc67470, 0x96a65dc0, 0x248681d0, 0x19e6a860, + 0x5e46d2b0, 0x6326fb00, 0xe1766cd1, 0xdc164561, 0x9bb63fb1, + 0xa6d61601, 0x14f6ca11, 0x2996e3a1, 0x6e369971, 0x5356b0c1, + 0x70279f96, 0x4d47b626, 0x0ae7ccf6, 0x3787e546, 0x85a73956, + 0xb8c710e6, 0xff676a36, 0xc2074386, 0x4057d457, 0x7d37fde7, + 0x3a978737, 0x07f7ae87, 0xb5d77297, 0x88b75b27, 0xcf1721f7, + 0xf2770847, 0x10c70814, 0x2da721a4, 0x6a075b74, 0x576772c4, + 0xe547aed4, 0xd8278764, 0x9f87fdb4, 0xa2e7d404, 0x20b743d5, + 0x1dd76a65, 0x5a7710b5, 0x67173905, 0xd537e515, 0xe857cca5, + 0xaff7b675, 0x92979fc5, 0xe915e8db, 0xd475c16b, 0x93d5bbbb, + 0xaeb5920b, 0x1c954e1b, 0x21f567ab, 0x66551d7b, 0x5b3534cb, + 0xd965a31a, 0xe4058aaa, 0xa3a5f07a, 0x9ec5d9ca, 0x2ce505da, + 0x11852c6a, 0x562556ba, 0x6b457f0a, 0x89f57f59, 0xb49556e9, + 0xf3352c39, 0xce550589, 0x7c75d999, 0x4115f029, 0x06b58af9, + 0x3bd5a349, 0xb9853498, 0x84e51d28, 0xc34567f8, 0xfe254e48, + 0x4c059258, 0x7165bbe8, 0x36c5c138, 0x0ba5e888, 0x28d4c7df, + 0x15b4ee6f, 0x521494bf, 0x6f74bd0f, 0xdd54611f, 0xe03448af, + 0xa794327f, 0x9af41bcf, 0x18a48c1e, 0x25c4a5ae, 0x6264df7e, + 0x5f04f6ce, 0xed242ade, 0xd044036e, 0x97e479be, 0xaa84500e, + 0x4834505d, 0x755479ed, 0x32f4033d, 0x0f942a8d, 0xbdb4f69d, + 0x80d4df2d, 0xc774a5fd, 0xfa148c4d, 0x78441b9c, 0x4524322c, + 0x028448fc, 0x3fe4614c, 0x8dc4bd5c, 0xb0a494ec, 0xf704ee3c, + 0xca64c78c}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0xb029603d, 0x6053c07a, 0xd07aa047, 0xc0a680f5, + 0x708fe0c8, 0xa0f5408f, 0x10dc20b2, 0xc14b7030, 0x7162100d, + 0xa118b04a, 0x1131d077, 0x01edf0c5, 0xb1c490f8, 0x61be30bf, + 0xd1975082, 0x8297e060, 0x32be805d, 0xe2c4201a, 0x52ed4027, + 0x42316095, 0xf21800a8, 0x2262a0ef, 0x924bc0d2, 0x43dc9050, + 0xf3f5f06d, 0x238f502a, 0x93a63017, 0x837a10a5, 0x33537098, + 0xe329d0df, 0x5300b0e2, 0x042fc1c1, 0xb406a1fc, 0x647c01bb, + 0xd4556186, 0xc4894134, 0x74a02109, 0xa4da814e, 0x14f3e173, + 0xc564b1f1, 0x754dd1cc, 0xa537718b, 0x151e11b6, 0x05c23104, + 0xb5eb5139, 0x6591f17e, 0xd5b89143, 0x86b821a1, 0x3691419c, + 0xe6ebe1db, 0x56c281e6, 0x461ea154, 0xf637c169, 0x264d612e, + 0x96640113, 0x47f35191, 0xf7da31ac, 0x27a091eb, 0x9789f1d6, + 0x8755d164, 0x377cb159, 0xe706111e, 0x572f7123, 0x4958f358, + 0xf9719365, 0x290b3322, 0x9922531f, 0x89fe73ad, 0x39d71390, + 0xe9adb3d7, 0x5984d3ea, 0x88138368, 0x383ae355, 0xe8404312, + 0x5869232f, 0x48b5039d, 0xf89c63a0, 0x28e6c3e7, 0x98cfa3da, + 0xcbcf1338, 0x7be67305, 0xab9cd342, 0x1bb5b37f, 0x0b6993cd, + 0xbb40f3f0, 0x6b3a53b7, 0xdb13338a, 0x0a846308, 0xbaad0335, + 0x6ad7a372, 0xdafec34f, 0xca22e3fd, 0x7a0b83c0, 0xaa712387, + 0x1a5843ba, 0x4d773299, 0xfd5e52a4, 0x2d24f2e3, 0x9d0d92de, + 0x8dd1b26c, 0x3df8d251, 0xed827216, 0x5dab122b, 0x8c3c42a9, + 0x3c152294, 0xec6f82d3, 0x5c46e2ee, 0x4c9ac25c, 0xfcb3a261, + 0x2cc90226, 0x9ce0621b, 0xcfe0d2f9, 0x7fc9b2c4, 0xafb31283, + 0x1f9a72be, 0x0f46520c, 0xbf6f3231, 0x6f159276, 0xdf3cf24b, + 0x0eaba2c9, 0xbe82c2f4, 0x6ef862b3, 0xded1028e, 0xce0d223c, + 0x7e244201, 0xae5ee246, 0x1e77827b, 0x92b0e6b1, 0x2299868c, + 0xf2e326cb, 0x42ca46f6, 0x52166644, 0xe23f0679, 0x3245a63e, + 0x826cc603, 0x53fb9681, 0xe3d2f6bc, 0x33a856fb, 0x838136c6, + 0x935d1674, 0x23747649, 0xf30ed60e, 0x4327b633, 0x102706d1, + 0xa00e66ec, 0x7074c6ab, 0xc05da696, 0xd0818624, 0x60a8e619, + 0xb0d2465e, 0x00fb2663, 0xd16c76e1, 0x614516dc, 0xb13fb69b, + 0x0116d6a6, 0x11caf614, 0xa1e39629, 0x7199366e, 0xc1b05653, + 0x969f2770, 0x26b6474d, 0xf6cce70a, 0x46e58737, 0x5639a785, + 0xe610c7b8, 0x366a67ff, 0x864307c2, 0x57d45740, 0xe7fd377d, + 0x3787973a, 0x87aef707, 0x9772d7b5, 0x275bb788, 0xf72117cf, + 0x470877f2, 0x1408c710, 0xa421a72d, 0x745b076a, 0xc4726757, + 0xd4ae47e5, 0x648727d8, 0xb4fd879f, 0x04d4e7a2, 0xd543b720, + 0x656ad71d, 0xb510775a, 0x05391767, 0x15e537d5, 0xa5cc57e8, + 0x75b6f7af, 0xc59f9792, 0xdbe815e9, 0x6bc175d4, 0xbbbbd593, + 0x0b92b5ae, 0x1b4e951c, 0xab67f521, 0x7b1d5566, 0xcb34355b, + 0x1aa365d9, 0xaa8a05e4, 0x7af0a5a3, 0xcad9c59e, 0xda05e52c, + 0x6a2c8511, 0xba562556, 0x0a7f456b, 0x597ff589, 0xe95695b4, + 0x392c35f3, 0x890555ce, 0x99d9757c, 0x29f01541, 0xf98ab506, + 0x49a3d53b, 0x983485b9, 0x281de584, 0xf86745c3, 0x484e25fe, + 0x5892054c, 0xe8bb6571, 0x38c1c536, 0x88e8a50b, 0xdfc7d428, + 0x6feeb415, 0xbf941452, 0x0fbd746f, 0x1f6154dd, 0xaf4834e0, + 0x7f3294a7, 0xcf1bf49a, 0x1e8ca418, 0xaea5c425, 0x7edf6462, + 0xcef6045f, 0xde2a24ed, 0x6e0344d0, 0xbe79e497, 0x0e5084aa, + 0x5d503448, 0xed795475, 0x3d03f432, 0x8d2a940f, 0x9df6b4bd, + 0x2ddfd480, 0xfda574c7, 0x4d8c14fa, 0x9c1b4478, 0x2c322445, + 0xfc488402, 0x4c61e43f, 0x5cbdc48d, 0xec94a4b0, 0x3cee04f7, + 0x8cc764ca}, + {0x00000000, 0xa5d35ccb, 0x0ba1c84d, 0xae729486, 0x1642919b, + 0xb391cd50, 0x1de359d6, 0xb830051d, 0x6d8253ec, 0xc8510f27, + 0x66239ba1, 0xc3f0c76a, 0x7bc0c277, 0xde139ebc, 0x70610a3a, + 0xd5b256f1, 0x9b02d603, 0x3ed18ac8, 0x90a31e4e, 0x35704285, + 0x8d404798, 0x28931b53, 0x86e18fd5, 0x2332d31e, 0xf68085ef, + 0x5353d924, 0xfd214da2, 0x58f21169, 0xe0c21474, 0x451148bf, + 0xeb63dc39, 0x4eb080f2, 0x3605ac07, 0x93d6f0cc, 0x3da4644a, + 0x98773881, 0x20473d9c, 0x85946157, 0x2be6f5d1, 0x8e35a91a, + 0x5b87ffeb, 0xfe54a320, 0x502637a6, 0xf5f56b6d, 0x4dc56e70, + 0xe81632bb, 0x4664a63d, 0xe3b7faf6, 0xad077a04, 0x08d426cf, + 0xa6a6b249, 0x0375ee82, 0xbb45eb9f, 0x1e96b754, 0xb0e423d2, + 0x15377f19, 0xc08529e8, 0x65567523, 0xcb24e1a5, 0x6ef7bd6e, + 0xd6c7b873, 0x7314e4b8, 0xdd66703e, 0x78b52cf5, 0x6c0a580f, + 0xc9d904c4, 0x67ab9042, 0xc278cc89, 0x7a48c994, 0xdf9b955f, + 0x71e901d9, 0xd43a5d12, 0x01880be3, 0xa45b5728, 0x0a29c3ae, + 0xaffa9f65, 0x17ca9a78, 0xb219c6b3, 0x1c6b5235, 0xb9b80efe, + 0xf7088e0c, 0x52dbd2c7, 0xfca94641, 0x597a1a8a, 0xe14a1f97, + 0x4499435c, 0xeaebd7da, 0x4f388b11, 0x9a8adde0, 0x3f59812b, + 0x912b15ad, 0x34f84966, 0x8cc84c7b, 0x291b10b0, 0x87698436, + 0x22bad8fd, 0x5a0ff408, 0xffdca8c3, 0x51ae3c45, 0xf47d608e, + 0x4c4d6593, 0xe99e3958, 0x47ecadde, 0xe23ff115, 0x378da7e4, + 0x925efb2f, 0x3c2c6fa9, 0x99ff3362, 0x21cf367f, 0x841c6ab4, + 0x2a6efe32, 0x8fbda2f9, 0xc10d220b, 0x64de7ec0, 0xcaacea46, + 0x6f7fb68d, 0xd74fb390, 0x729cef5b, 0xdcee7bdd, 0x793d2716, + 0xac8f71e7, 0x095c2d2c, 0xa72eb9aa, 0x02fde561, 0xbacde07c, + 0x1f1ebcb7, 0xb16c2831, 0x14bf74fa, 0xd814b01e, 0x7dc7ecd5, + 0xd3b57853, 0x76662498, 0xce562185, 0x6b857d4e, 0xc5f7e9c8, + 0x6024b503, 0xb596e3f2, 0x1045bf39, 0xbe372bbf, 0x1be47774, + 0xa3d47269, 0x06072ea2, 0xa875ba24, 0x0da6e6ef, 0x4316661d, + 0xe6c53ad6, 0x48b7ae50, 0xed64f29b, 0x5554f786, 0xf087ab4d, + 0x5ef53fcb, 0xfb266300, 0x2e9435f1, 0x8b47693a, 0x2535fdbc, + 0x80e6a177, 0x38d6a46a, 0x9d05f8a1, 0x33776c27, 0x96a430ec, + 0xee111c19, 0x4bc240d2, 0xe5b0d454, 0x4063889f, 0xf8538d82, + 0x5d80d149, 0xf3f245cf, 0x56211904, 0x83934ff5, 0x2640133e, + 0x883287b8, 0x2de1db73, 0x95d1de6e, 0x300282a5, 0x9e701623, + 0x3ba34ae8, 0x7513ca1a, 0xd0c096d1, 0x7eb20257, 0xdb615e9c, + 0x63515b81, 0xc682074a, 0x68f093cc, 0xcd23cf07, 0x189199f6, + 0xbd42c53d, 0x133051bb, 0xb6e30d70, 0x0ed3086d, 0xab0054a6, + 0x0572c020, 0xa0a19ceb, 0xb41ee811, 0x11cdb4da, 0xbfbf205c, + 0x1a6c7c97, 0xa25c798a, 0x078f2541, 0xa9fdb1c7, 0x0c2eed0c, + 0xd99cbbfd, 0x7c4fe736, 0xd23d73b0, 0x77ee2f7b, 0xcfde2a66, + 0x6a0d76ad, 0xc47fe22b, 0x61acbee0, 0x2f1c3e12, 0x8acf62d9, + 0x24bdf65f, 0x816eaa94, 0x395eaf89, 0x9c8df342, 0x32ff67c4, + 0x972c3b0f, 0x429e6dfe, 0xe74d3135, 0x493fa5b3, 0xececf978, + 0x54dcfc65, 0xf10fa0ae, 0x5f7d3428, 0xfaae68e3, 0x821b4416, + 0x27c818dd, 0x89ba8c5b, 0x2c69d090, 0x9459d58d, 0x318a8946, + 0x9ff81dc0, 0x3a2b410b, 0xef9917fa, 0x4a4a4b31, 0xe438dfb7, + 0x41eb837c, 0xf9db8661, 0x5c08daaa, 0xf27a4e2c, 0x57a912e7, + 0x19199215, 0xbccacede, 0x12b85a58, 0xb76b0693, 0x0f5b038e, + 0xaa885f45, 0x04facbc3, 0xa1299708, 0x749bc1f9, 0xd1489d32, + 0x7f3a09b4, 0xdae9557f, 0x62d95062, 0xc70a0ca9, 0x6978982f, + 0xccabc4e4}, + {0x00000000, 0xb40b77a6, 0x29119f97, 0x9d1ae831, 0x13244ff4, + 0xa72f3852, 0x3a35d063, 0x8e3ea7c5, 0x674eef33, 0xd3459895, + 0x4e5f70a4, 0xfa540702, 0x746aa0c7, 0xc061d761, 0x5d7b3f50, + 0xe97048f6, 0xce9cde67, 0x7a97a9c1, 0xe78d41f0, 0x53863656, + 0xddb89193, 0x69b3e635, 0xf4a90e04, 0x40a279a2, 0xa9d23154, + 0x1dd946f2, 0x80c3aec3, 0x34c8d965, 0xbaf67ea0, 0x0efd0906, + 0x93e7e137, 0x27ec9691, 0x9c39bdcf, 0x2832ca69, 0xb5282258, + 0x012355fe, 0x8f1df23b, 0x3b16859d, 0xa60c6dac, 0x12071a0a, + 0xfb7752fc, 0x4f7c255a, 0xd266cd6b, 0x666dbacd, 0xe8531d08, + 0x5c586aae, 0xc142829f, 0x7549f539, 0x52a563a8, 0xe6ae140e, + 0x7bb4fc3f, 0xcfbf8b99, 0x41812c5c, 0xf58a5bfa, 0x6890b3cb, + 0xdc9bc46d, 0x35eb8c9b, 0x81e0fb3d, 0x1cfa130c, 0xa8f164aa, + 0x26cfc36f, 0x92c4b4c9, 0x0fde5cf8, 0xbbd52b5e, 0x79750b44, + 0xcd7e7ce2, 0x506494d3, 0xe46fe375, 0x6a5144b0, 0xde5a3316, + 0x4340db27, 0xf74bac81, 0x1e3be477, 0xaa3093d1, 0x372a7be0, + 0x83210c46, 0x0d1fab83, 0xb914dc25, 0x240e3414, 0x900543b2, + 0xb7e9d523, 0x03e2a285, 0x9ef84ab4, 0x2af33d12, 0xa4cd9ad7, + 0x10c6ed71, 0x8ddc0540, 0x39d772e6, 0xd0a73a10, 0x64ac4db6, + 0xf9b6a587, 0x4dbdd221, 0xc38375e4, 0x77880242, 0xea92ea73, + 0x5e999dd5, 0xe54cb68b, 0x5147c12d, 0xcc5d291c, 0x78565eba, + 0xf668f97f, 0x42638ed9, 0xdf7966e8, 0x6b72114e, 0x820259b8, + 0x36092e1e, 0xab13c62f, 0x1f18b189, 0x9126164c, 0x252d61ea, + 0xb83789db, 0x0c3cfe7d, 0x2bd068ec, 0x9fdb1f4a, 0x02c1f77b, + 0xb6ca80dd, 0x38f42718, 0x8cff50be, 0x11e5b88f, 0xa5eecf29, + 0x4c9e87df, 0xf895f079, 0x658f1848, 0xd1846fee, 0x5fbac82b, + 0xebb1bf8d, 0x76ab57bc, 0xc2a0201a, 0xf2ea1688, 0x46e1612e, + 0xdbfb891f, 0x6ff0feb9, 0xe1ce597c, 0x55c52eda, 0xc8dfc6eb, + 0x7cd4b14d, 0x95a4f9bb, 0x21af8e1d, 0xbcb5662c, 0x08be118a, + 0x8680b64f, 0x328bc1e9, 0xaf9129d8, 0x1b9a5e7e, 0x3c76c8ef, + 0x887dbf49, 0x15675778, 0xa16c20de, 0x2f52871b, 0x9b59f0bd, + 0x0643188c, 0xb2486f2a, 0x5b3827dc, 0xef33507a, 0x7229b84b, + 0xc622cfed, 0x481c6828, 0xfc171f8e, 0x610df7bf, 0xd5068019, + 0x6ed3ab47, 0xdad8dce1, 0x47c234d0, 0xf3c94376, 0x7df7e4b3, + 0xc9fc9315, 0x54e67b24, 0xe0ed0c82, 0x099d4474, 0xbd9633d2, + 0x208cdbe3, 0x9487ac45, 0x1ab90b80, 0xaeb27c26, 0x33a89417, + 0x87a3e3b1, 0xa04f7520, 0x14440286, 0x895eeab7, 0x3d559d11, + 0xb36b3ad4, 0x07604d72, 0x9a7aa543, 0x2e71d2e5, 0xc7019a13, + 0x730aedb5, 0xee100584, 0x5a1b7222, 0xd425d5e7, 0x602ea241, + 0xfd344a70, 0x493f3dd6, 0x8b9f1dcc, 0x3f946a6a, 0xa28e825b, + 0x1685f5fd, 0x98bb5238, 0x2cb0259e, 0xb1aacdaf, 0x05a1ba09, + 0xecd1f2ff, 0x58da8559, 0xc5c06d68, 0x71cb1ace, 0xfff5bd0b, + 0x4bfecaad, 0xd6e4229c, 0x62ef553a, 0x4503c3ab, 0xf108b40d, + 0x6c125c3c, 0xd8192b9a, 0x56278c5f, 0xe22cfbf9, 0x7f3613c8, + 0xcb3d646e, 0x224d2c98, 0x96465b3e, 0x0b5cb30f, 0xbf57c4a9, + 0x3169636c, 0x856214ca, 0x1878fcfb, 0xac738b5d, 0x17a6a003, + 0xa3add7a5, 0x3eb73f94, 0x8abc4832, 0x0482eff7, 0xb0899851, + 0x2d937060, 0x999807c6, 0x70e84f30, 0xc4e33896, 0x59f9d0a7, + 0xedf2a701, 0x63cc00c4, 0xd7c77762, 0x4add9f53, 0xfed6e8f5, + 0xd93a7e64, 0x6d3109c2, 0xf02be1f3, 0x44209655, 0xca1e3190, + 0x7e154636, 0xe30fae07, 0x5704d9a1, 0xbe749157, 0x0a7fe6f1, + 0x97650ec0, 0x236e7966, 0xad50dea3, 0x195ba905, 0x84414134, + 0x304a3692}, + {0x00000000, 0x9e00aacc, 0x7d072542, 0xe3078f8e, 0xfa0e4a84, + 0x640ee048, 0x87096fc6, 0x1909c50a, 0xb51be5d3, 0x2b1b4f1f, + 0xc81cc091, 0x561c6a5d, 0x4f15af57, 0xd115059b, 0x32128a15, + 0xac1220d9, 0x2b31bb7c, 0xb53111b0, 0x56369e3e, 0xc83634f2, + 0xd13ff1f8, 0x4f3f5b34, 0xac38d4ba, 0x32387e76, 0x9e2a5eaf, + 0x002af463, 0xe32d7bed, 0x7d2dd121, 0x6424142b, 0xfa24bee7, + 0x19233169, 0x87239ba5, 0x566276f9, 0xc862dc35, 0x2b6553bb, + 0xb565f977, 0xac6c3c7d, 0x326c96b1, 0xd16b193f, 0x4f6bb3f3, + 0xe379932a, 0x7d7939e6, 0x9e7eb668, 0x007e1ca4, 0x1977d9ae, + 0x87777362, 0x6470fcec, 0xfa705620, 0x7d53cd85, 0xe3536749, + 0x0054e8c7, 0x9e54420b, 0x875d8701, 0x195d2dcd, 0xfa5aa243, + 0x645a088f, 0xc8482856, 0x5648829a, 0xb54f0d14, 0x2b4fa7d8, + 0x324662d2, 0xac46c81e, 0x4f414790, 0xd141ed5c, 0xedc29d29, + 0x73c237e5, 0x90c5b86b, 0x0ec512a7, 0x17ccd7ad, 0x89cc7d61, + 0x6acbf2ef, 0xf4cb5823, 0x58d978fa, 0xc6d9d236, 0x25de5db8, + 0xbbdef774, 0xa2d7327e, 0x3cd798b2, 0xdfd0173c, 0x41d0bdf0, + 0xc6f32655, 0x58f38c99, 0xbbf40317, 0x25f4a9db, 0x3cfd6cd1, + 0xa2fdc61d, 0x41fa4993, 0xdffae35f, 0x73e8c386, 0xede8694a, + 0x0eefe6c4, 0x90ef4c08, 0x89e68902, 0x17e623ce, 0xf4e1ac40, + 0x6ae1068c, 0xbba0ebd0, 0x25a0411c, 0xc6a7ce92, 0x58a7645e, + 0x41aea154, 0xdfae0b98, 0x3ca98416, 0xa2a92eda, 0x0ebb0e03, + 0x90bba4cf, 0x73bc2b41, 0xedbc818d, 0xf4b54487, 0x6ab5ee4b, + 0x89b261c5, 0x17b2cb09, 0x909150ac, 0x0e91fa60, 0xed9675ee, + 0x7396df22, 0x6a9f1a28, 0xf49fb0e4, 0x17983f6a, 0x899895a6, + 0x258ab57f, 0xbb8a1fb3, 0x588d903d, 0xc68d3af1, 0xdf84fffb, + 0x41845537, 0xa283dab9, 0x3c837075, 0xda853b53, 0x4485919f, + 0xa7821e11, 0x3982b4dd, 0x208b71d7, 0xbe8bdb1b, 0x5d8c5495, + 0xc38cfe59, 0x6f9ede80, 0xf19e744c, 0x1299fbc2, 0x8c99510e, + 0x95909404, 0x0b903ec8, 0xe897b146, 0x76971b8a, 0xf1b4802f, + 0x6fb42ae3, 0x8cb3a56d, 0x12b30fa1, 0x0bbacaab, 0x95ba6067, + 0x76bdefe9, 0xe8bd4525, 0x44af65fc, 0xdaafcf30, 0x39a840be, + 0xa7a8ea72, 0xbea12f78, 0x20a185b4, 0xc3a60a3a, 0x5da6a0f6, + 0x8ce74daa, 0x12e7e766, 0xf1e068e8, 0x6fe0c224, 0x76e9072e, + 0xe8e9ade2, 0x0bee226c, 0x95ee88a0, 0x39fca879, 0xa7fc02b5, + 0x44fb8d3b, 0xdafb27f7, 0xc3f2e2fd, 0x5df24831, 0xbef5c7bf, + 0x20f56d73, 0xa7d6f6d6, 0x39d65c1a, 0xdad1d394, 0x44d17958, + 0x5dd8bc52, 0xc3d8169e, 0x20df9910, 0xbedf33dc, 0x12cd1305, + 0x8ccdb9c9, 0x6fca3647, 0xf1ca9c8b, 0xe8c35981, 0x76c3f34d, + 0x95c47cc3, 0x0bc4d60f, 0x3747a67a, 0xa9470cb6, 0x4a408338, + 0xd44029f4, 0xcd49ecfe, 0x53494632, 0xb04ec9bc, 0x2e4e6370, + 0x825c43a9, 0x1c5ce965, 0xff5b66eb, 0x615bcc27, 0x7852092d, + 0xe652a3e1, 0x05552c6f, 0x9b5586a3, 0x1c761d06, 0x8276b7ca, + 0x61713844, 0xff719288, 0xe6785782, 0x7878fd4e, 0x9b7f72c0, + 0x057fd80c, 0xa96df8d5, 0x376d5219, 0xd46add97, 0x4a6a775b, + 0x5363b251, 0xcd63189d, 0x2e649713, 0xb0643ddf, 0x6125d083, + 0xff257a4f, 0x1c22f5c1, 0x82225f0d, 0x9b2b9a07, 0x052b30cb, + 0xe62cbf45, 0x782c1589, 0xd43e3550, 0x4a3e9f9c, 0xa9391012, + 0x3739bade, 0x2e307fd4, 0xb030d518, 0x53375a96, 0xcd37f05a, + 0x4a146bff, 0xd414c133, 0x37134ebd, 0xa913e471, 0xb01a217b, + 0x2e1a8bb7, 0xcd1d0439, 0x531daef5, 0xff0f8e2c, 0x610f24e0, + 0x8208ab6e, 0x1c0801a2, 0x0501c4a8, 0x9b016e64, 0x7806e1ea, + 0xe6064b26}}; + #endif - } -}; + +#endif + +#if N == 3 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x81256527, 0xd93bcc0f, 0x581ea928, 0x69069e5f, + 0xe823fb78, 0xb03d5250, 0x31183777, 0xd20d3cbe, 0x53285999, + 0x0b36f0b1, 0x8a139596, 0xbb0ba2e1, 0x3a2ec7c6, 0x62306eee, + 0xe3150bc9, 0x7f6b7f3d, 0xfe4e1a1a, 0xa650b332, 0x2775d615, + 0x166de162, 0x97488445, 0xcf562d6d, 0x4e73484a, 0xad664383, + 0x2c4326a4, 0x745d8f8c, 0xf578eaab, 0xc460dddc, 0x4545b8fb, + 0x1d5b11d3, 0x9c7e74f4, 0xfed6fe7a, 0x7ff39b5d, 0x27ed3275, + 0xa6c85752, 0x97d06025, 0x16f50502, 0x4eebac2a, 0xcfcec90d, + 0x2cdbc2c4, 0xadfea7e3, 0xf5e00ecb, 0x74c56bec, 0x45dd5c9b, + 0xc4f839bc, 0x9ce69094, 0x1dc3f5b3, 0x81bd8147, 0x0098e460, + 0x58864d48, 0xd9a3286f, 0xe8bb1f18, 0x699e7a3f, 0x3180d317, + 0xb0a5b630, 0x53b0bdf9, 0xd295d8de, 0x8a8b71f6, 0x0bae14d1, + 0x3ab623a6, 0xbb934681, 0xe38defa9, 0x62a88a8e, 0x26dcfab5, + 0xa7f99f92, 0xffe736ba, 0x7ec2539d, 0x4fda64ea, 0xceff01cd, + 0x96e1a8e5, 0x17c4cdc2, 0xf4d1c60b, 0x75f4a32c, 0x2dea0a04, + 0xaccf6f23, 0x9dd75854, 0x1cf23d73, 0x44ec945b, 0xc5c9f17c, + 0x59b78588, 0xd892e0af, 0x808c4987, 0x01a92ca0, 0x30b11bd7, + 0xb1947ef0, 0xe98ad7d8, 0x68afb2ff, 0x8bbab936, 0x0a9fdc11, + 0x52817539, 0xd3a4101e, 0xe2bc2769, 0x6399424e, 0x3b87eb66, + 0xbaa28e41, 0xd80a04cf, 0x592f61e8, 0x0131c8c0, 0x8014ade7, + 0xb10c9a90, 0x3029ffb7, 0x6837569f, 0xe91233b8, 0x0a073871, + 0x8b225d56, 0xd33cf47e, 0x52199159, 0x6301a62e, 0xe224c309, + 0xba3a6a21, 0x3b1f0f06, 0xa7617bf2, 0x26441ed5, 0x7e5ab7fd, + 0xff7fd2da, 0xce67e5ad, 0x4f42808a, 0x175c29a2, 0x96794c85, + 0x756c474c, 0xf449226b, 0xac578b43, 0x2d72ee64, 0x1c6ad913, + 0x9d4fbc34, 0xc551151c, 0x4474703b, 0x4db9f56a, 0xcc9c904d, + 0x94823965, 0x15a75c42, 0x24bf6b35, 0xa59a0e12, 0xfd84a73a, + 0x7ca1c21d, 0x9fb4c9d4, 0x1e91acf3, 0x468f05db, 0xc7aa60fc, + 0xf6b2578b, 0x779732ac, 0x2f899b84, 0xaeacfea3, 0x32d28a57, + 0xb3f7ef70, 0xebe94658, 0x6acc237f, 0x5bd41408, 0xdaf1712f, + 0x82efd807, 0x03cabd20, 0xe0dfb6e9, 0x61fad3ce, 0x39e47ae6, + 0xb8c11fc1, 0x89d928b6, 0x08fc4d91, 0x50e2e4b9, 0xd1c7819e, + 0xb36f0b10, 0x324a6e37, 0x6a54c71f, 0xeb71a238, 0xda69954f, + 0x5b4cf068, 0x03525940, 0x82773c67, 0x616237ae, 0xe0475289, + 0xb859fba1, 0x397c9e86, 0x0864a9f1, 0x8941ccd6, 0xd15f65fe, + 0x507a00d9, 0xcc04742d, 0x4d21110a, 0x153fb822, 0x941add05, + 0xa502ea72, 0x24278f55, 0x7c39267d, 0xfd1c435a, 0x1e094893, + 0x9f2c2db4, 0xc732849c, 0x4617e1bb, 0x770fd6cc, 0xf62ab3eb, + 0xae341ac3, 0x2f117fe4, 0x6b650fdf, 0xea406af8, 0xb25ec3d0, + 0x337ba6f7, 0x02639180, 0x8346f4a7, 0xdb585d8f, 0x5a7d38a8, + 0xb9683361, 0x384d5646, 0x6053ff6e, 0xe1769a49, 0xd06ead3e, + 0x514bc819, 0x09556131, 0x88700416, 0x140e70e2, 0x952b15c5, + 0xcd35bced, 0x4c10d9ca, 0x7d08eebd, 0xfc2d8b9a, 0xa43322b2, + 0x25164795, 0xc6034c5c, 0x4726297b, 0x1f388053, 0x9e1de574, + 0xaf05d203, 0x2e20b724, 0x763e1e0c, 0xf71b7b2b, 0x95b3f1a5, + 0x14969482, 0x4c883daa, 0xcdad588d, 0xfcb56ffa, 0x7d900add, + 0x258ea3f5, 0xa4abc6d2, 0x47becd1b, 0xc69ba83c, 0x9e850114, + 0x1fa06433, 0x2eb85344, 0xaf9d3663, 0xf7839f4b, 0x76a6fa6c, + 0xead88e98, 0x6bfdebbf, 0x33e34297, 0xb2c627b0, 0x83de10c7, + 0x02fb75e0, 0x5ae5dcc8, 0xdbc0b9ef, 0x38d5b226, 0xb9f0d701, + 0xe1ee7e29, 0x60cb1b0e, 0x51d32c79, 0xd0f6495e, 0x88e8e076, + 0x09cd8551}, + {0x00000000, 0x9b73ead4, 0xed96d3e9, 0x76e5393d, 0x005ca193, + 0x9b2f4b47, 0xedca727a, 0x76b998ae, 0x00b94326, 0x9bcaa9f2, + 0xed2f90cf, 0x765c7a1b, 0x00e5e2b5, 0x9b960861, 0xed73315c, + 0x7600db88, 0x0172864c, 0x9a016c98, 0xece455a5, 0x7797bf71, + 0x012e27df, 0x9a5dcd0b, 0xecb8f436, 0x77cb1ee2, 0x01cbc56a, + 0x9ab82fbe, 0xec5d1683, 0x772efc57, 0x019764f9, 0x9ae48e2d, + 0xec01b710, 0x77725dc4, 0x02e50c98, 0x9996e64c, 0xef73df71, + 0x740035a5, 0x02b9ad0b, 0x99ca47df, 0xef2f7ee2, 0x745c9436, + 0x025c4fbe, 0x992fa56a, 0xefca9c57, 0x74b97683, 0x0200ee2d, + 0x997304f9, 0xef963dc4, 0x74e5d710, 0x03978ad4, 0x98e46000, + 0xee01593d, 0x7572b3e9, 0x03cb2b47, 0x98b8c193, 0xee5df8ae, + 0x752e127a, 0x032ec9f2, 0x985d2326, 0xeeb81a1b, 0x75cbf0cf, + 0x03726861, 0x980182b5, 0xeee4bb88, 0x7597515c, 0x05ca1930, + 0x9eb9f3e4, 0xe85ccad9, 0x732f200d, 0x0596b8a3, 0x9ee55277, + 0xe8006b4a, 0x7373819e, 0x05735a16, 0x9e00b0c2, 0xe8e589ff, + 0x7396632b, 0x052ffb85, 0x9e5c1151, 0xe8b9286c, 0x73cac2b8, + 0x04b89f7c, 0x9fcb75a8, 0xe92e4c95, 0x725da641, 0x04e43eef, + 0x9f97d43b, 0xe972ed06, 0x720107d2, 0x0401dc5a, 0x9f72368e, + 0xe9970fb3, 0x72e4e567, 0x045d7dc9, 0x9f2e971d, 0xe9cbae20, + 0x72b844f4, 0x072f15a8, 0x9c5cff7c, 0xeab9c641, 0x71ca2c95, + 0x0773b43b, 0x9c005eef, 0xeae567d2, 0x71968d06, 0x0796568e, + 0x9ce5bc5a, 0xea008567, 0x71736fb3, 0x07caf71d, 0x9cb91dc9, + 0xea5c24f4, 0x712fce20, 0x065d93e4, 0x9d2e7930, 0xebcb400d, + 0x70b8aad9, 0x06013277, 0x9d72d8a3, 0xeb97e19e, 0x70e40b4a, + 0x06e4d0c2, 0x9d973a16, 0xeb72032b, 0x7001e9ff, 0x06b87151, + 0x9dcb9b85, 0xeb2ea2b8, 0x705d486c, 0x0b943260, 0x90e7d8b4, + 0xe602e189, 0x7d710b5d, 0x0bc893f3, 0x90bb7927, 0xe65e401a, + 0x7d2daace, 0x0b2d7146, 0x905e9b92, 0xe6bba2af, 0x7dc8487b, + 0x0b71d0d5, 0x90023a01, 0xe6e7033c, 0x7d94e9e8, 0x0ae6b42c, + 0x91955ef8, 0xe77067c5, 0x7c038d11, 0x0aba15bf, 0x91c9ff6b, + 0xe72cc656, 0x7c5f2c82, 0x0a5ff70a, 0x912c1dde, 0xe7c924e3, + 0x7cbace37, 0x0a035699, 0x9170bc4d, 0xe7958570, 0x7ce66fa4, + 0x09713ef8, 0x9202d42c, 0xe4e7ed11, 0x7f9407c5, 0x092d9f6b, + 0x925e75bf, 0xe4bb4c82, 0x7fc8a656, 0x09c87dde, 0x92bb970a, + 0xe45eae37, 0x7f2d44e3, 0x0994dc4d, 0x92e73699, 0xe4020fa4, + 0x7f71e570, 0x0803b8b4, 0x93705260, 0xe5956b5d, 0x7ee68189, + 0x085f1927, 0x932cf3f3, 0xe5c9cace, 0x7eba201a, 0x08bafb92, + 0x93c91146, 0xe52c287b, 0x7e5fc2af, 0x08e65a01, 0x9395b0d5, + 0xe57089e8, 0x7e03633c, 0x0e5e2b50, 0x952dc184, 0xe3c8f8b9, + 0x78bb126d, 0x0e028ac3, 0x95716017, 0xe394592a, 0x78e7b3fe, + 0x0ee76876, 0x959482a2, 0xe371bb9f, 0x7802514b, 0x0ebbc9e5, + 0x95c82331, 0xe32d1a0c, 0x785ef0d8, 0x0f2cad1c, 0x945f47c8, + 0xe2ba7ef5, 0x79c99421, 0x0f700c8f, 0x9403e65b, 0xe2e6df66, + 0x799535b2, 0x0f95ee3a, 0x94e604ee, 0xe2033dd3, 0x7970d707, + 0x0fc94fa9, 0x94baa57d, 0xe25f9c40, 0x792c7694, 0x0cbb27c8, + 0x97c8cd1c, 0xe12df421, 0x7a5e1ef5, 0x0ce7865b, 0x97946c8f, + 0xe17155b2, 0x7a02bf66, 0x0c0264ee, 0x97718e3a, 0xe194b707, + 0x7ae75dd3, 0x0c5ec57d, 0x972d2fa9, 0xe1c81694, 0x7abbfc40, + 0x0dc9a184, 0x96ba4b50, 0xe05f726d, 0x7b2c98b9, 0x0d950017, + 0x96e6eac3, 0xe003d3fe, 0x7b70392a, 0x0d70e2a2, 0x96030876, + 0xe0e6314b, 0x7b95db9f, 0x0d2c4331, 0x965fa9e5, 0xe0ba90d8, + 0x7bc97a0c}, + {0x00000000, 0x172864c0, 0x2e50c980, 0x3978ad40, 0x5ca19300, + 0x4b89f7c0, 0x72f15a80, 0x65d93e40, 0xb9432600, 0xae6b42c0, + 0x9713ef80, 0x803b8b40, 0xe5e2b500, 0xf2cad1c0, 0xcbb27c80, + 0xdc9a1840, 0xa9f74a41, 0xbedf2e81, 0x87a783c1, 0x908fe701, + 0xf556d941, 0xe27ebd81, 0xdb0610c1, 0xcc2e7401, 0x10b46c41, + 0x079c0881, 0x3ee4a5c1, 0x29ccc101, 0x4c15ff41, 0x5b3d9b81, + 0x624536c1, 0x756d5201, 0x889f92c3, 0x9fb7f603, 0xa6cf5b43, + 0xb1e73f83, 0xd43e01c3, 0xc3166503, 0xfa6ec843, 0xed46ac83, + 0x31dcb4c3, 0x26f4d003, 0x1f8c7d43, 0x08a41983, 0x6d7d27c3, + 0x7a554303, 0x432dee43, 0x54058a83, 0x2168d882, 0x3640bc42, + 0x0f381102, 0x181075c2, 0x7dc94b82, 0x6ae12f42, 0x53998202, + 0x44b1e6c2, 0x982bfe82, 0x8f039a42, 0xb67b3702, 0xa15353c2, + 0xc48a6d82, 0xd3a20942, 0xeadaa402, 0xfdf2c0c2, 0xca4e23c7, + 0xdd664707, 0xe41eea47, 0xf3368e87, 0x96efb0c7, 0x81c7d407, + 0xb8bf7947, 0xaf971d87, 0x730d05c7, 0x64256107, 0x5d5dcc47, + 0x4a75a887, 0x2fac96c7, 0x3884f207, 0x01fc5f47, 0x16d43b87, + 0x63b96986, 0x74910d46, 0x4de9a006, 0x5ac1c4c6, 0x3f18fa86, + 0x28309e46, 0x11483306, 0x066057c6, 0xdafa4f86, 0xcdd22b46, + 0xf4aa8606, 0xe382e2c6, 0x865bdc86, 0x9173b846, 0xa80b1506, + 0xbf2371c6, 0x42d1b104, 0x55f9d5c4, 0x6c817884, 0x7ba91c44, + 0x1e702204, 0x095846c4, 0x3020eb84, 0x27088f44, 0xfb929704, + 0xecbaf3c4, 0xd5c25e84, 0xc2ea3a44, 0xa7330404, 0xb01b60c4, + 0x8963cd84, 0x9e4ba944, 0xeb26fb45, 0xfc0e9f85, 0xc57632c5, + 0xd25e5605, 0xb7876845, 0xa0af0c85, 0x99d7a1c5, 0x8effc505, + 0x5265dd45, 0x454db985, 0x7c3514c5, 0x6b1d7005, 0x0ec44e45, + 0x19ec2a85, 0x209487c5, 0x37bce305, 0x4fed41cf, 0x58c5250f, + 0x61bd884f, 0x7695ec8f, 0x134cd2cf, 0x0464b60f, 0x3d1c1b4f, + 0x2a347f8f, 0xf6ae67cf, 0xe186030f, 0xd8feae4f, 0xcfd6ca8f, + 0xaa0ff4cf, 0xbd27900f, 0x845f3d4f, 0x9377598f, 0xe61a0b8e, + 0xf1326f4e, 0xc84ac20e, 0xdf62a6ce, 0xbabb988e, 0xad93fc4e, + 0x94eb510e, 0x83c335ce, 0x5f592d8e, 0x4871494e, 0x7109e40e, + 0x662180ce, 0x03f8be8e, 0x14d0da4e, 0x2da8770e, 0x3a8013ce, + 0xc772d30c, 0xd05ab7cc, 0xe9221a8c, 0xfe0a7e4c, 0x9bd3400c, + 0x8cfb24cc, 0xb583898c, 0xa2abed4c, 0x7e31f50c, 0x691991cc, + 0x50613c8c, 0x4749584c, 0x2290660c, 0x35b802cc, 0x0cc0af8c, + 0x1be8cb4c, 0x6e85994d, 0x79adfd8d, 0x40d550cd, 0x57fd340d, + 0x32240a4d, 0x250c6e8d, 0x1c74c3cd, 0x0b5ca70d, 0xd7c6bf4d, + 0xc0eedb8d, 0xf99676cd, 0xeebe120d, 0x8b672c4d, 0x9c4f488d, + 0xa537e5cd, 0xb21f810d, 0x85a36208, 0x928b06c8, 0xabf3ab88, + 0xbcdbcf48, 0xd902f108, 0xce2a95c8, 0xf7523888, 0xe07a5c48, + 0x3ce04408, 0x2bc820c8, 0x12b08d88, 0x0598e948, 0x6041d708, + 0x7769b3c8, 0x4e111e88, 0x59397a48, 0x2c542849, 0x3b7c4c89, + 0x0204e1c9, 0x152c8509, 0x70f5bb49, 0x67dddf89, 0x5ea572c9, + 0x498d1609, 0x95170e49, 0x823f6a89, 0xbb47c7c9, 0xac6fa309, + 0xc9b69d49, 0xde9ef989, 0xe7e654c9, 0xf0ce3009, 0x0d3cf0cb, + 0x1a14940b, 0x236c394b, 0x34445d8b, 0x519d63cb, 0x46b5070b, + 0x7fcdaa4b, 0x68e5ce8b, 0xb47fd6cb, 0xa357b20b, 0x9a2f1f4b, + 0x8d077b8b, 0xe8de45cb, 0xfff6210b, 0xc68e8c4b, 0xd1a6e88b, + 0xa4cbba8a, 0xb3e3de4a, 0x8a9b730a, 0x9db317ca, 0xf86a298a, + 0xef424d4a, 0xd63ae00a, 0xc11284ca, 0x1d889c8a, 0x0aa0f84a, + 0x33d8550a, 0x24f031ca, 0x41290f8a, 0x56016b4a, 0x6f79c60a, + 0x7851a2ca}, + {0x00000000, 0x9fda839e, 0xe4c4017d, 0x7b1e82e3, 0x12f904bb, + 0x8d238725, 0xf63d05c6, 0x69e78658, 0x25f20976, 0xba288ae8, + 0xc136080b, 0x5eec8b95, 0x370b0dcd, 0xa8d18e53, 0xd3cf0cb0, + 0x4c158f2e, 0x4be412ec, 0xd43e9172, 0xaf201391, 0x30fa900f, + 0x591d1657, 0xc6c795c9, 0xbdd9172a, 0x220394b4, 0x6e161b9a, + 0xf1cc9804, 0x8ad21ae7, 0x15089979, 0x7cef1f21, 0xe3359cbf, + 0x982b1e5c, 0x07f19dc2, 0x97c825d8, 0x0812a646, 0x730c24a5, + 0xecd6a73b, 0x85312163, 0x1aeba2fd, 0x61f5201e, 0xfe2fa380, + 0xb23a2cae, 0x2de0af30, 0x56fe2dd3, 0xc924ae4d, 0xa0c32815, + 0x3f19ab8b, 0x44072968, 0xdbddaaf6, 0xdc2c3734, 0x43f6b4aa, + 0x38e83649, 0xa732b5d7, 0xced5338f, 0x510fb011, 0x2a1132f2, + 0xb5cbb16c, 0xf9de3e42, 0x6604bddc, 0x1d1a3f3f, 0x82c0bca1, + 0xeb273af9, 0x74fdb967, 0x0fe33b84, 0x9039b81a, 0xf4e14df1, + 0x6b3bce6f, 0x10254c8c, 0x8fffcf12, 0xe618494a, 0x79c2cad4, + 0x02dc4837, 0x9d06cba9, 0xd1134487, 0x4ec9c719, 0x35d745fa, + 0xaa0dc664, 0xc3ea403c, 0x5c30c3a2, 0x272e4141, 0xb8f4c2df, + 0xbf055f1d, 0x20dfdc83, 0x5bc15e60, 0xc41bddfe, 0xadfc5ba6, + 0x3226d838, 0x49385adb, 0xd6e2d945, 0x9af7566b, 0x052dd5f5, + 0x7e335716, 0xe1e9d488, 0x880e52d0, 0x17d4d14e, 0x6cca53ad, + 0xf310d033, 0x63296829, 0xfcf3ebb7, 0x87ed6954, 0x1837eaca, + 0x71d06c92, 0xee0aef0c, 0x95146def, 0x0aceee71, 0x46db615f, + 0xd901e2c1, 0xa21f6022, 0x3dc5e3bc, 0x542265e4, 0xcbf8e67a, + 0xb0e66499, 0x2f3ce707, 0x28cd7ac5, 0xb717f95b, 0xcc097bb8, + 0x53d3f826, 0x3a347e7e, 0xa5eefde0, 0xdef07f03, 0x412afc9d, + 0x0d3f73b3, 0x92e5f02d, 0xe9fb72ce, 0x7621f150, 0x1fc67708, + 0x801cf496, 0xfb027675, 0x64d8f5eb, 0x32b39da3, 0xad691e3d, + 0xd6779cde, 0x49ad1f40, 0x204a9918, 0xbf901a86, 0xc48e9865, + 0x5b541bfb, 0x174194d5, 0x889b174b, 0xf38595a8, 0x6c5f1636, + 0x05b8906e, 0x9a6213f0, 0xe17c9113, 0x7ea6128d, 0x79578f4f, + 0xe68d0cd1, 0x9d938e32, 0x02490dac, 0x6bae8bf4, 0xf474086a, + 0x8f6a8a89, 0x10b00917, 0x5ca58639, 0xc37f05a7, 0xb8618744, + 0x27bb04da, 0x4e5c8282, 0xd186011c, 0xaa9883ff, 0x35420061, + 0xa57bb87b, 0x3aa13be5, 0x41bfb906, 0xde653a98, 0xb782bcc0, + 0x28583f5e, 0x5346bdbd, 0xcc9c3e23, 0x8089b10d, 0x1f533293, + 0x644db070, 0xfb9733ee, 0x9270b5b6, 0x0daa3628, 0x76b4b4cb, + 0xe96e3755, 0xee9faa97, 0x71452909, 0x0a5babea, 0x95812874, + 0xfc66ae2c, 0x63bc2db2, 0x18a2af51, 0x87782ccf, 0xcb6da3e1, + 0x54b7207f, 0x2fa9a29c, 0xb0732102, 0xd994a75a, 0x464e24c4, + 0x3d50a627, 0xa28a25b9, 0xc652d052, 0x598853cc, 0x2296d12f, + 0xbd4c52b1, 0xd4abd4e9, 0x4b715777, 0x306fd594, 0xafb5560a, + 0xe3a0d924, 0x7c7a5aba, 0x0764d859, 0x98be5bc7, 0xf159dd9f, + 0x6e835e01, 0x159ddce2, 0x8a475f7c, 0x8db6c2be, 0x126c4120, + 0x6972c3c3, 0xf6a8405d, 0x9f4fc605, 0x0095459b, 0x7b8bc778, + 0xe45144e6, 0xa844cbc8, 0x379e4856, 0x4c80cab5, 0xd35a492b, + 0xbabdcf73, 0x25674ced, 0x5e79ce0e, 0xc1a34d90, 0x519af58a, + 0xce407614, 0xb55ef4f7, 0x2a847769, 0x4363f131, 0xdcb972af, + 0xa7a7f04c, 0x387d73d2, 0x7468fcfc, 0xebb27f62, 0x90acfd81, + 0x0f767e1f, 0x6691f847, 0xf94b7bd9, 0x8255f93a, 0x1d8f7aa4, + 0x1a7ee766, 0x85a464f8, 0xfebae61b, 0x61606585, 0x0887e3dd, + 0x975d6043, 0xec43e2a0, 0x7399613e, 0x3f8cee10, 0xa0566d8e, + 0xdb48ef6d, 0x44926cf3, 0x2d75eaab, 0xb2af6935, 0xc9b1ebd6, + 0x566b6848}, + {0x00000000, 0x65673b46, 0xcace768c, 0xafa94dca, 0x4eedeb59, + 0x2b8ad01f, 0x84239dd5, 0xe144a693, 0x9ddbd6b2, 0xf8bcedf4, + 0x5715a03e, 0x32729b78, 0xd3363deb, 0xb65106ad, 0x19f84b67, + 0x7c9f7021, 0xe0c6ab25, 0x85a19063, 0x2a08dda9, 0x4f6fe6ef, + 0xae2b407c, 0xcb4c7b3a, 0x64e536f0, 0x01820db6, 0x7d1d7d97, + 0x187a46d1, 0xb7d30b1b, 0xd2b4305d, 0x33f096ce, 0x5697ad88, + 0xf93ee042, 0x9c59db04, 0x1afc500b, 0x7f9b6b4d, 0xd0322687, + 0xb5551dc1, 0x5411bb52, 0x31768014, 0x9edfcdde, 0xfbb8f698, + 0x872786b9, 0xe240bdff, 0x4de9f035, 0x288ecb73, 0xc9ca6de0, + 0xacad56a6, 0x03041b6c, 0x6663202a, 0xfa3afb2e, 0x9f5dc068, + 0x30f48da2, 0x5593b6e4, 0xb4d71077, 0xd1b02b31, 0x7e1966fb, + 0x1b7e5dbd, 0x67e12d9c, 0x028616da, 0xad2f5b10, 0xc8486056, + 0x290cc6c5, 0x4c6bfd83, 0xe3c2b049, 0x86a58b0f, 0x35f8a016, + 0x509f9b50, 0xff36d69a, 0x9a51eddc, 0x7b154b4f, 0x1e727009, + 0xb1db3dc3, 0xd4bc0685, 0xa82376a4, 0xcd444de2, 0x62ed0028, + 0x078a3b6e, 0xe6ce9dfd, 0x83a9a6bb, 0x2c00eb71, 0x4967d037, + 0xd53e0b33, 0xb0593075, 0x1ff07dbf, 0x7a9746f9, 0x9bd3e06a, + 0xfeb4db2c, 0x511d96e6, 0x347aada0, 0x48e5dd81, 0x2d82e6c7, + 0x822bab0d, 0xe74c904b, 0x060836d8, 0x636f0d9e, 0xccc64054, + 0xa9a17b12, 0x2f04f01d, 0x4a63cb5b, 0xe5ca8691, 0x80adbdd7, + 0x61e91b44, 0x048e2002, 0xab276dc8, 0xce40568e, 0xb2df26af, + 0xd7b81de9, 0x78115023, 0x1d766b65, 0xfc32cdf6, 0x9955f6b0, + 0x36fcbb7a, 0x539b803c, 0xcfc25b38, 0xaaa5607e, 0x050c2db4, + 0x606b16f2, 0x812fb061, 0xe4488b27, 0x4be1c6ed, 0x2e86fdab, + 0x52198d8a, 0x377eb6cc, 0x98d7fb06, 0xfdb0c040, 0x1cf466d3, + 0x79935d95, 0xd63a105f, 0xb35d2b19, 0x6bf1402c, 0x0e967b6a, + 0xa13f36a0, 0xc4580de6, 0x251cab75, 0x407b9033, 0xefd2ddf9, + 0x8ab5e6bf, 0xf62a969e, 0x934dadd8, 0x3ce4e012, 0x5983db54, + 0xb8c77dc7, 0xdda04681, 0x72090b4b, 0x176e300d, 0x8b37eb09, + 0xee50d04f, 0x41f99d85, 0x249ea6c3, 0xc5da0050, 0xa0bd3b16, + 0x0f1476dc, 0x6a734d9a, 0x16ec3dbb, 0x738b06fd, 0xdc224b37, + 0xb9457071, 0x5801d6e2, 0x3d66eda4, 0x92cfa06e, 0xf7a89b28, + 0x710d1027, 0x146a2b61, 0xbbc366ab, 0xdea45ded, 0x3fe0fb7e, + 0x5a87c038, 0xf52e8df2, 0x9049b6b4, 0xecd6c695, 0x89b1fdd3, + 0x2618b019, 0x437f8b5f, 0xa23b2dcc, 0xc75c168a, 0x68f55b40, + 0x0d926006, 0x91cbbb02, 0xf4ac8044, 0x5b05cd8e, 0x3e62f6c8, + 0xdf26505b, 0xba416b1d, 0x15e826d7, 0x708f1d91, 0x0c106db0, + 0x697756f6, 0xc6de1b3c, 0xa3b9207a, 0x42fd86e9, 0x279abdaf, + 0x8833f065, 0xed54cb23, 0x5e09e03a, 0x3b6edb7c, 0x94c796b6, + 0xf1a0adf0, 0x10e40b63, 0x75833025, 0xda2a7def, 0xbf4d46a9, + 0xc3d23688, 0xa6b50dce, 0x091c4004, 0x6c7b7b42, 0x8d3fddd1, + 0xe858e697, 0x47f1ab5d, 0x2296901b, 0xbecf4b1f, 0xdba87059, + 0x74013d93, 0x116606d5, 0xf022a046, 0x95459b00, 0x3aecd6ca, + 0x5f8bed8c, 0x23149dad, 0x4673a6eb, 0xe9daeb21, 0x8cbdd067, + 0x6df976f4, 0x089e4db2, 0xa7370078, 0xc2503b3e, 0x44f5b031, + 0x21928b77, 0x8e3bc6bd, 0xeb5cfdfb, 0x0a185b68, 0x6f7f602e, + 0xc0d62de4, 0xa5b116a2, 0xd92e6683, 0xbc495dc5, 0x13e0100f, + 0x76872b49, 0x97c38dda, 0xf2a4b69c, 0x5d0dfb56, 0x386ac010, + 0xa4331b14, 0xc1542052, 0x6efd6d98, 0x0b9a56de, 0xeadef04d, + 0x8fb9cb0b, 0x201086c1, 0x4577bd87, 0x39e8cda6, 0x5c8ff6e0, + 0xf326bb2a, 0x9641806c, 0x770526ff, 0x12621db9, 0xbdcb5073, + 0xd8ac6b35}, + {0x00000000, 0xd7e28058, 0x74b406f1, 0xa35686a9, 0xe9680de2, + 0x3e8a8dba, 0x9ddc0b13, 0x4a3e8b4b, 0x09a11d85, 0xde439ddd, + 0x7d151b74, 0xaaf79b2c, 0xe0c91067, 0x372b903f, 0x947d1696, + 0x439f96ce, 0x13423b0a, 0xc4a0bb52, 0x67f63dfb, 0xb014bda3, + 0xfa2a36e8, 0x2dc8b6b0, 0x8e9e3019, 0x597cb041, 0x1ae3268f, + 0xcd01a6d7, 0x6e57207e, 0xb9b5a026, 0xf38b2b6d, 0x2469ab35, + 0x873f2d9c, 0x50ddadc4, 0x26847614, 0xf166f64c, 0x523070e5, + 0x85d2f0bd, 0xcfec7bf6, 0x180efbae, 0xbb587d07, 0x6cbafd5f, + 0x2f256b91, 0xf8c7ebc9, 0x5b916d60, 0x8c73ed38, 0xc64d6673, + 0x11afe62b, 0xb2f96082, 0x651be0da, 0x35c64d1e, 0xe224cd46, + 0x41724bef, 0x9690cbb7, 0xdcae40fc, 0x0b4cc0a4, 0xa81a460d, + 0x7ff8c655, 0x3c67509b, 0xeb85d0c3, 0x48d3566a, 0x9f31d632, + 0xd50f5d79, 0x02eddd21, 0xa1bb5b88, 0x7659dbd0, 0x4d08ec28, + 0x9aea6c70, 0x39bcead9, 0xee5e6a81, 0xa460e1ca, 0x73826192, + 0xd0d4e73b, 0x07366763, 0x44a9f1ad, 0x934b71f5, 0x301df75c, + 0xe7ff7704, 0xadc1fc4f, 0x7a237c17, 0xd975fabe, 0x0e977ae6, + 0x5e4ad722, 0x89a8577a, 0x2afed1d3, 0xfd1c518b, 0xb722dac0, + 0x60c05a98, 0xc396dc31, 0x14745c69, 0x57ebcaa7, 0x80094aff, + 0x235fcc56, 0xf4bd4c0e, 0xbe83c745, 0x6961471d, 0xca37c1b4, + 0x1dd541ec, 0x6b8c9a3c, 0xbc6e1a64, 0x1f389ccd, 0xc8da1c95, + 0x82e497de, 0x55061786, 0xf650912f, 0x21b21177, 0x622d87b9, + 0xb5cf07e1, 0x16998148, 0xc17b0110, 0x8b458a5b, 0x5ca70a03, + 0xfff18caa, 0x28130cf2, 0x78cea136, 0xaf2c216e, 0x0c7aa7c7, + 0xdb98279f, 0x91a6acd4, 0x46442c8c, 0xe512aa25, 0x32f02a7d, + 0x716fbcb3, 0xa68d3ceb, 0x05dbba42, 0xd2393a1a, 0x9807b151, + 0x4fe53109, 0xecb3b7a0, 0x3b5137f8, 0x9a11d850, 0x4df35808, + 0xeea5dea1, 0x39475ef9, 0x7379d5b2, 0xa49b55ea, 0x07cdd343, + 0xd02f531b, 0x93b0c5d5, 0x4452458d, 0xe704c324, 0x30e6437c, + 0x7ad8c837, 0xad3a486f, 0x0e6ccec6, 0xd98e4e9e, 0x8953e35a, + 0x5eb16302, 0xfde7e5ab, 0x2a0565f3, 0x603beeb8, 0xb7d96ee0, + 0x148fe849, 0xc36d6811, 0x80f2fedf, 0x57107e87, 0xf446f82e, + 0x23a47876, 0x699af33d, 0xbe787365, 0x1d2ef5cc, 0xcacc7594, + 0xbc95ae44, 0x6b772e1c, 0xc821a8b5, 0x1fc328ed, 0x55fda3a6, + 0x821f23fe, 0x2149a557, 0xf6ab250f, 0xb534b3c1, 0x62d63399, + 0xc180b530, 0x16623568, 0x5c5cbe23, 0x8bbe3e7b, 0x28e8b8d2, + 0xff0a388a, 0xafd7954e, 0x78351516, 0xdb6393bf, 0x0c8113e7, + 0x46bf98ac, 0x915d18f4, 0x320b9e5d, 0xe5e91e05, 0xa67688cb, + 0x71940893, 0xd2c28e3a, 0x05200e62, 0x4f1e8529, 0x98fc0571, + 0x3baa83d8, 0xec480380, 0xd7193478, 0x00fbb420, 0xa3ad3289, + 0x744fb2d1, 0x3e71399a, 0xe993b9c2, 0x4ac53f6b, 0x9d27bf33, + 0xdeb829fd, 0x095aa9a5, 0xaa0c2f0c, 0x7deeaf54, 0x37d0241f, + 0xe032a447, 0x436422ee, 0x9486a2b6, 0xc45b0f72, 0x13b98f2a, + 0xb0ef0983, 0x670d89db, 0x2d330290, 0xfad182c8, 0x59870461, + 0x8e658439, 0xcdfa12f7, 0x1a1892af, 0xb94e1406, 0x6eac945e, + 0x24921f15, 0xf3709f4d, 0x502619e4, 0x87c499bc, 0xf19d426c, + 0x267fc234, 0x8529449d, 0x52cbc4c5, 0x18f54f8e, 0xcf17cfd6, + 0x6c41497f, 0xbba3c927, 0xf83c5fe9, 0x2fdedfb1, 0x8c885918, + 0x5b6ad940, 0x1154520b, 0xc6b6d253, 0x65e054fa, 0xb202d4a2, + 0xe2df7966, 0x353df93e, 0x966b7f97, 0x4189ffcf, 0x0bb77484, + 0xdc55f4dc, 0x7f037275, 0xa8e1f22d, 0xeb7e64e3, 0x3c9ce4bb, + 0x9fca6212, 0x4828e24a, 0x02166901, 0xd5f4e959, 0x76a26ff0, + 0xa140efa8}, + {0x00000000, 0xef52b6e1, 0x05d46b83, 0xea86dd62, 0x0ba8d706, + 0xe4fa61e7, 0x0e7cbc85, 0xe12e0a64, 0x1751ae0c, 0xf80318ed, + 0x1285c58f, 0xfdd7736e, 0x1cf9790a, 0xf3abcfeb, 0x192d1289, + 0xf67fa468, 0x2ea35c18, 0xc1f1eaf9, 0x2b77379b, 0xc425817a, + 0x250b8b1e, 0xca593dff, 0x20dfe09d, 0xcf8d567c, 0x39f2f214, + 0xd6a044f5, 0x3c269997, 0xd3742f76, 0x325a2512, 0xdd0893f3, + 0x378e4e91, 0xd8dcf870, 0x5d46b830, 0xb2140ed1, 0x5892d3b3, + 0xb7c06552, 0x56ee6f36, 0xb9bcd9d7, 0x533a04b5, 0xbc68b254, + 0x4a17163c, 0xa545a0dd, 0x4fc37dbf, 0xa091cb5e, 0x41bfc13a, + 0xaeed77db, 0x446baab9, 0xab391c58, 0x73e5e428, 0x9cb752c9, + 0x76318fab, 0x9963394a, 0x784d332e, 0x971f85cf, 0x7d9958ad, + 0x92cbee4c, 0x64b44a24, 0x8be6fcc5, 0x616021a7, 0x8e329746, + 0x6f1c9d22, 0x804e2bc3, 0x6ac8f6a1, 0x859a4040, 0xba8d7060, + 0x55dfc681, 0xbf591be3, 0x500bad02, 0xb125a766, 0x5e771187, + 0xb4f1cce5, 0x5ba37a04, 0xaddcde6c, 0x428e688d, 0xa808b5ef, + 0x475a030e, 0xa674096a, 0x4926bf8b, 0xa3a062e9, 0x4cf2d408, + 0x942e2c78, 0x7b7c9a99, 0x91fa47fb, 0x7ea8f11a, 0x9f86fb7e, + 0x70d44d9f, 0x9a5290fd, 0x7500261c, 0x837f8274, 0x6c2d3495, + 0x86abe9f7, 0x69f95f16, 0x88d75572, 0x6785e393, 0x8d033ef1, + 0x62518810, 0xe7cbc850, 0x08997eb1, 0xe21fa3d3, 0x0d4d1532, + 0xec631f56, 0x0331a9b7, 0xe9b774d5, 0x06e5c234, 0xf09a665c, + 0x1fc8d0bd, 0xf54e0ddf, 0x1a1cbb3e, 0xfb32b15a, 0x146007bb, + 0xfee6dad9, 0x11b46c38, 0xc9689448, 0x263a22a9, 0xccbcffcb, + 0x23ee492a, 0xc2c0434e, 0x2d92f5af, 0xc71428cd, 0x28469e2c, + 0xde393a44, 0x316b8ca5, 0xdbed51c7, 0x34bfe726, 0xd591ed42, + 0x3ac35ba3, 0xd04586c1, 0x3f173020, 0xae6be681, 0x41395060, + 0xabbf8d02, 0x44ed3be3, 0xa5c33187, 0x4a918766, 0xa0175a04, + 0x4f45ece5, 0xb93a488d, 0x5668fe6c, 0xbcee230e, 0x53bc95ef, + 0xb2929f8b, 0x5dc0296a, 0xb746f408, 0x581442e9, 0x80c8ba99, + 0x6f9a0c78, 0x851cd11a, 0x6a4e67fb, 0x8b606d9f, 0x6432db7e, + 0x8eb4061c, 0x61e6b0fd, 0x97991495, 0x78cba274, 0x924d7f16, + 0x7d1fc9f7, 0x9c31c393, 0x73637572, 0x99e5a810, 0x76b71ef1, + 0xf32d5eb1, 0x1c7fe850, 0xf6f93532, 0x19ab83d3, 0xf88589b7, + 0x17d73f56, 0xfd51e234, 0x120354d5, 0xe47cf0bd, 0x0b2e465c, + 0xe1a89b3e, 0x0efa2ddf, 0xefd427bb, 0x0086915a, 0xea004c38, + 0x0552fad9, 0xdd8e02a9, 0x32dcb448, 0xd85a692a, 0x3708dfcb, + 0xd626d5af, 0x3974634e, 0xd3f2be2c, 0x3ca008cd, 0xcadfaca5, + 0x258d1a44, 0xcf0bc726, 0x205971c7, 0xc1777ba3, 0x2e25cd42, + 0xc4a31020, 0x2bf1a6c1, 0x14e696e1, 0xfbb42000, 0x1132fd62, + 0xfe604b83, 0x1f4e41e7, 0xf01cf706, 0x1a9a2a64, 0xf5c89c85, + 0x03b738ed, 0xece58e0c, 0x0663536e, 0xe931e58f, 0x081fefeb, + 0xe74d590a, 0x0dcb8468, 0xe2993289, 0x3a45caf9, 0xd5177c18, + 0x3f91a17a, 0xd0c3179b, 0x31ed1dff, 0xdebfab1e, 0x3439767c, + 0xdb6bc09d, 0x2d1464f5, 0xc246d214, 0x28c00f76, 0xc792b997, + 0x26bcb3f3, 0xc9ee0512, 0x2368d870, 0xcc3a6e91, 0x49a02ed1, + 0xa6f29830, 0x4c744552, 0xa326f3b3, 0x4208f9d7, 0xad5a4f36, + 0x47dc9254, 0xa88e24b5, 0x5ef180dd, 0xb1a3363c, 0x5b25eb5e, + 0xb4775dbf, 0x555957db, 0xba0be13a, 0x508d3c58, 0xbfdf8ab9, + 0x670372c9, 0x8851c428, 0x62d7194a, 0x8d85afab, 0x6caba5cf, + 0x83f9132e, 0x697fce4c, 0x862d78ad, 0x7052dcc5, 0x9f006a24, + 0x7586b746, 0x9ad401a7, 0x7bfa0bc3, 0x94a8bd22, 0x7e2e6040, + 0x917cd6a1}, + {0x00000000, 0x87a6cb43, 0xd43c90c7, 0x539a5b84, 0x730827cf, + 0xf4aeec8c, 0xa734b708, 0x20927c4b, 0xe6104f9e, 0x61b684dd, + 0x322cdf59, 0xb58a141a, 0x95186851, 0x12bea312, 0x4124f896, + 0xc68233d5, 0x1751997d, 0x90f7523e, 0xc36d09ba, 0x44cbc2f9, + 0x6459beb2, 0xe3ff75f1, 0xb0652e75, 0x37c3e536, 0xf141d6e3, + 0x76e71da0, 0x257d4624, 0xa2db8d67, 0x8249f12c, 0x05ef3a6f, + 0x567561eb, 0xd1d3aaa8, 0x2ea332fa, 0xa905f9b9, 0xfa9fa23d, + 0x7d39697e, 0x5dab1535, 0xda0dde76, 0x899785f2, 0x0e314eb1, + 0xc8b37d64, 0x4f15b627, 0x1c8feda3, 0x9b2926e0, 0xbbbb5aab, + 0x3c1d91e8, 0x6f87ca6c, 0xe821012f, 0x39f2ab87, 0xbe5460c4, + 0xedce3b40, 0x6a68f003, 0x4afa8c48, 0xcd5c470b, 0x9ec61c8f, + 0x1960d7cc, 0xdfe2e419, 0x58442f5a, 0x0bde74de, 0x8c78bf9d, + 0xaceac3d6, 0x2b4c0895, 0x78d65311, 0xff709852, 0x5d4665f4, + 0xdae0aeb7, 0x897af533, 0x0edc3e70, 0x2e4e423b, 0xa9e88978, + 0xfa72d2fc, 0x7dd419bf, 0xbb562a6a, 0x3cf0e129, 0x6f6abaad, + 0xe8cc71ee, 0xc85e0da5, 0x4ff8c6e6, 0x1c629d62, 0x9bc45621, + 0x4a17fc89, 0xcdb137ca, 0x9e2b6c4e, 0x198da70d, 0x391fdb46, + 0xbeb91005, 0xed234b81, 0x6a8580c2, 0xac07b317, 0x2ba17854, + 0x783b23d0, 0xff9de893, 0xdf0f94d8, 0x58a95f9b, 0x0b33041f, + 0x8c95cf5c, 0x73e5570e, 0xf4439c4d, 0xa7d9c7c9, 0x207f0c8a, + 0x00ed70c1, 0x874bbb82, 0xd4d1e006, 0x53772b45, 0x95f51890, + 0x1253d3d3, 0x41c98857, 0xc66f4314, 0xe6fd3f5f, 0x615bf41c, + 0x32c1af98, 0xb56764db, 0x64b4ce73, 0xe3120530, 0xb0885eb4, + 0x372e95f7, 0x17bce9bc, 0x901a22ff, 0xc380797b, 0x4426b238, + 0x82a481ed, 0x05024aae, 0x5698112a, 0xd13eda69, 0xf1aca622, + 0x760a6d61, 0x259036e5, 0xa236fda6, 0xba8ccbe8, 0x3d2a00ab, + 0x6eb05b2f, 0xe916906c, 0xc984ec27, 0x4e222764, 0x1db87ce0, + 0x9a1eb7a3, 0x5c9c8476, 0xdb3a4f35, 0x88a014b1, 0x0f06dff2, + 0x2f94a3b9, 0xa83268fa, 0xfba8337e, 0x7c0ef83d, 0xaddd5295, + 0x2a7b99d6, 0x79e1c252, 0xfe470911, 0xded5755a, 0x5973be19, + 0x0ae9e59d, 0x8d4f2ede, 0x4bcd1d0b, 0xcc6bd648, 0x9ff18dcc, + 0x1857468f, 0x38c53ac4, 0xbf63f187, 0xecf9aa03, 0x6b5f6140, + 0x942ff912, 0x13893251, 0x401369d5, 0xc7b5a296, 0xe727dedd, + 0x6081159e, 0x331b4e1a, 0xb4bd8559, 0x723fb68c, 0xf5997dcf, + 0xa603264b, 0x21a5ed08, 0x01379143, 0x86915a00, 0xd50b0184, + 0x52adcac7, 0x837e606f, 0x04d8ab2c, 0x5742f0a8, 0xd0e43beb, + 0xf07647a0, 0x77d08ce3, 0x244ad767, 0xa3ec1c24, 0x656e2ff1, + 0xe2c8e4b2, 0xb152bf36, 0x36f47475, 0x1666083e, 0x91c0c37d, + 0xc25a98f9, 0x45fc53ba, 0xe7caae1c, 0x606c655f, 0x33f63edb, + 0xb450f598, 0x94c289d3, 0x13644290, 0x40fe1914, 0xc758d257, + 0x01dae182, 0x867c2ac1, 0xd5e67145, 0x5240ba06, 0x72d2c64d, + 0xf5740d0e, 0xa6ee568a, 0x21489dc9, 0xf09b3761, 0x773dfc22, + 0x24a7a7a6, 0xa3016ce5, 0x839310ae, 0x0435dbed, 0x57af8069, + 0xd0094b2a, 0x168b78ff, 0x912db3bc, 0xc2b7e838, 0x4511237b, + 0x65835f30, 0xe2259473, 0xb1bfcff7, 0x361904b4, 0xc9699ce6, + 0x4ecf57a5, 0x1d550c21, 0x9af3c762, 0xba61bb29, 0x3dc7706a, + 0x6e5d2bee, 0xe9fbe0ad, 0x2f79d378, 0xa8df183b, 0xfb4543bf, + 0x7ce388fc, 0x5c71f4b7, 0xdbd73ff4, 0x884d6470, 0x0febaf33, + 0xde38059b, 0x599eced8, 0x0a04955c, 0x8da25e1f, 0xad302254, + 0x2a96e917, 0x790cb293, 0xfeaa79d0, 0x38284a05, 0xbf8e8146, + 0xec14dac2, 0x6bb21181, 0x4b206dca, 0xcc86a689, 0x9f1cfd0d, + 0x18ba364e}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x43cba68700000000, 0xc7903cd400000000, + 0x845b9a5300000000, 0xcf27087300000000, 0x8cecaef400000000, + 0x08b734a700000000, 0x4b7c922000000000, 0x9e4f10e600000000, + 0xdd84b66100000000, 0x59df2c3200000000, 0x1a148ab500000000, + 0x5168189500000000, 0x12a3be1200000000, 0x96f8244100000000, + 0xd53382c600000000, 0x7d99511700000000, 0x3e52f79000000000, + 0xba096dc300000000, 0xf9c2cb4400000000, 0xb2be596400000000, + 0xf175ffe300000000, 0x752e65b000000000, 0x36e5c33700000000, + 0xe3d641f100000000, 0xa01de77600000000, 0x24467d2500000000, + 0x678ddba200000000, 0x2cf1498200000000, 0x6f3aef0500000000, + 0xeb61755600000000, 0xa8aad3d100000000, 0xfa32a32e00000000, + 0xb9f905a900000000, 0x3da29ffa00000000, 0x7e69397d00000000, + 0x3515ab5d00000000, 0x76de0dda00000000, 0xf285978900000000, + 0xb14e310e00000000, 0x647db3c800000000, 0x27b6154f00000000, + 0xa3ed8f1c00000000, 0xe026299b00000000, 0xab5abbbb00000000, + 0xe8911d3c00000000, 0x6cca876f00000000, 0x2f0121e800000000, + 0x87abf23900000000, 0xc46054be00000000, 0x403bceed00000000, + 0x03f0686a00000000, 0x488cfa4a00000000, 0x0b475ccd00000000, + 0x8f1cc69e00000000, 0xccd7601900000000, 0x19e4e2df00000000, + 0x5a2f445800000000, 0xde74de0b00000000, 0x9dbf788c00000000, + 0xd6c3eaac00000000, 0x95084c2b00000000, 0x1153d67800000000, + 0x529870ff00000000, 0xf465465d00000000, 0xb7aee0da00000000, + 0x33f57a8900000000, 0x703edc0e00000000, 0x3b424e2e00000000, + 0x7889e8a900000000, 0xfcd272fa00000000, 0xbf19d47d00000000, + 0x6a2a56bb00000000, 0x29e1f03c00000000, 0xadba6a6f00000000, + 0xee71cce800000000, 0xa50d5ec800000000, 0xe6c6f84f00000000, + 0x629d621c00000000, 0x2156c49b00000000, 0x89fc174a00000000, + 0xca37b1cd00000000, 0x4e6c2b9e00000000, 0x0da78d1900000000, + 0x46db1f3900000000, 0x0510b9be00000000, 0x814b23ed00000000, + 0xc280856a00000000, 0x17b307ac00000000, 0x5478a12b00000000, + 0xd0233b7800000000, 0x93e89dff00000000, 0xd8940fdf00000000, + 0x9b5fa95800000000, 0x1f04330b00000000, 0x5ccf958c00000000, + 0x0e57e57300000000, 0x4d9c43f400000000, 0xc9c7d9a700000000, + 0x8a0c7f2000000000, 0xc170ed0000000000, 0x82bb4b8700000000, + 0x06e0d1d400000000, 0x452b775300000000, 0x9018f59500000000, + 0xd3d3531200000000, 0x5788c94100000000, 0x14436fc600000000, + 0x5f3ffde600000000, 0x1cf45b6100000000, 0x98afc13200000000, + 0xdb6467b500000000, 0x73ceb46400000000, 0x300512e300000000, + 0xb45e88b000000000, 0xf7952e3700000000, 0xbce9bc1700000000, + 0xff221a9000000000, 0x7b7980c300000000, 0x38b2264400000000, + 0xed81a48200000000, 0xae4a020500000000, 0x2a11985600000000, + 0x69da3ed100000000, 0x22a6acf100000000, 0x616d0a7600000000, + 0xe536902500000000, 0xa6fd36a200000000, 0xe8cb8cba00000000, + 0xab002a3d00000000, 0x2f5bb06e00000000, 0x6c9016e900000000, + 0x27ec84c900000000, 0x6427224e00000000, 0xe07cb81d00000000, + 0xa3b71e9a00000000, 0x76849c5c00000000, 0x354f3adb00000000, + 0xb114a08800000000, 0xf2df060f00000000, 0xb9a3942f00000000, + 0xfa6832a800000000, 0x7e33a8fb00000000, 0x3df80e7c00000000, + 0x9552ddad00000000, 0xd6997b2a00000000, 0x52c2e17900000000, + 0x110947fe00000000, 0x5a75d5de00000000, 0x19be735900000000, + 0x9de5e90a00000000, 0xde2e4f8d00000000, 0x0b1dcd4b00000000, + 0x48d66bcc00000000, 0xcc8df19f00000000, 0x8f46571800000000, + 0xc43ac53800000000, 0x87f163bf00000000, 0x03aaf9ec00000000, + 0x40615f6b00000000, 0x12f92f9400000000, 0x5132891300000000, + 0xd569134000000000, 0x96a2b5c700000000, 0xddde27e700000000, + 0x9e15816000000000, 0x1a4e1b3300000000, 0x5985bdb400000000, + 0x8cb63f7200000000, 0xcf7d99f500000000, 0x4b2603a600000000, + 0x08eda52100000000, 0x4391370100000000, 0x005a918600000000, + 0x84010bd500000000, 0xc7caad5200000000, 0x6f607e8300000000, + 0x2cabd80400000000, 0xa8f0425700000000, 0xeb3be4d000000000, + 0xa04776f000000000, 0xe38cd07700000000, 0x67d74a2400000000, + 0x241ceca300000000, 0xf12f6e6500000000, 0xb2e4c8e200000000, + 0x36bf52b100000000, 0x7574f43600000000, 0x3e08661600000000, + 0x7dc3c09100000000, 0xf9985ac200000000, 0xba53fc4500000000, + 0x1caecae700000000, 0x5f656c6000000000, 0xdb3ef63300000000, + 0x98f550b400000000, 0xd389c29400000000, 0x9042641300000000, + 0x1419fe4000000000, 0x57d258c700000000, 0x82e1da0100000000, + 0xc12a7c8600000000, 0x4571e6d500000000, 0x06ba405200000000, + 0x4dc6d27200000000, 0x0e0d74f500000000, 0x8a56eea600000000, + 0xc99d482100000000, 0x61379bf000000000, 0x22fc3d7700000000, + 0xa6a7a72400000000, 0xe56c01a300000000, 0xae10938300000000, + 0xeddb350400000000, 0x6980af5700000000, 0x2a4b09d000000000, + 0xff788b1600000000, 0xbcb32d9100000000, 0x38e8b7c200000000, + 0x7b23114500000000, 0x305f836500000000, 0x739425e200000000, + 0xf7cfbfb100000000, 0xb404193600000000, 0xe69c69c900000000, + 0xa557cf4e00000000, 0x210c551d00000000, 0x62c7f39a00000000, + 0x29bb61ba00000000, 0x6a70c73d00000000, 0xee2b5d6e00000000, + 0xade0fbe900000000, 0x78d3792f00000000, 0x3b18dfa800000000, + 0xbf4345fb00000000, 0xfc88e37c00000000, 0xb7f4715c00000000, + 0xf43fd7db00000000, 0x70644d8800000000, 0x33afeb0f00000000, + 0x9b0538de00000000, 0xd8ce9e5900000000, 0x5c95040a00000000, + 0x1f5ea28d00000000, 0x542230ad00000000, 0x17e9962a00000000, + 0x93b20c7900000000, 0xd079aafe00000000, 0x054a283800000000, + 0x46818ebf00000000, 0xc2da14ec00000000, 0x8111b26b00000000, + 0xca6d204b00000000, 0x89a686cc00000000, 0x0dfd1c9f00000000, + 0x4e36ba1800000000}, + {0x0000000000000000, 0xe1b652ef00000000, 0x836bd40500000000, + 0x62dd86ea00000000, 0x06d7a80b00000000, 0xe761fae400000000, + 0x85bc7c0e00000000, 0x640a2ee100000000, 0x0cae511700000000, + 0xed1803f800000000, 0x8fc5851200000000, 0x6e73d7fd00000000, + 0x0a79f91c00000000, 0xebcfabf300000000, 0x89122d1900000000, + 0x68a47ff600000000, 0x185ca32e00000000, 0xf9eaf1c100000000, + 0x9b37772b00000000, 0x7a8125c400000000, 0x1e8b0b2500000000, + 0xff3d59ca00000000, 0x9de0df2000000000, 0x7c568dcf00000000, + 0x14f2f23900000000, 0xf544a0d600000000, 0x9799263c00000000, + 0x762f74d300000000, 0x12255a3200000000, 0xf39308dd00000000, + 0x914e8e3700000000, 0x70f8dcd800000000, 0x30b8465d00000000, + 0xd10e14b200000000, 0xb3d3925800000000, 0x5265c0b700000000, + 0x366fee5600000000, 0xd7d9bcb900000000, 0xb5043a5300000000, + 0x54b268bc00000000, 0x3c16174a00000000, 0xdda045a500000000, + 0xbf7dc34f00000000, 0x5ecb91a000000000, 0x3ac1bf4100000000, + 0xdb77edae00000000, 0xb9aa6b4400000000, 0x581c39ab00000000, + 0x28e4e57300000000, 0xc952b79c00000000, 0xab8f317600000000, + 0x4a39639900000000, 0x2e334d7800000000, 0xcf851f9700000000, + 0xad58997d00000000, 0x4ceecb9200000000, 0x244ab46400000000, + 0xc5fce68b00000000, 0xa721606100000000, 0x4697328e00000000, + 0x229d1c6f00000000, 0xc32b4e8000000000, 0xa1f6c86a00000000, + 0x40409a8500000000, 0x60708dba00000000, 0x81c6df5500000000, + 0xe31b59bf00000000, 0x02ad0b5000000000, 0x66a725b100000000, + 0x8711775e00000000, 0xe5ccf1b400000000, 0x047aa35b00000000, + 0x6cdedcad00000000, 0x8d688e4200000000, 0xefb508a800000000, + 0x0e035a4700000000, 0x6a0974a600000000, 0x8bbf264900000000, + 0xe962a0a300000000, 0x08d4f24c00000000, 0x782c2e9400000000, + 0x999a7c7b00000000, 0xfb47fa9100000000, 0x1af1a87e00000000, + 0x7efb869f00000000, 0x9f4dd47000000000, 0xfd90529a00000000, + 0x1c26007500000000, 0x74827f8300000000, 0x95342d6c00000000, + 0xf7e9ab8600000000, 0x165ff96900000000, 0x7255d78800000000, + 0x93e3856700000000, 0xf13e038d00000000, 0x1088516200000000, + 0x50c8cbe700000000, 0xb17e990800000000, 0xd3a31fe200000000, + 0x32154d0d00000000, 0x561f63ec00000000, 0xb7a9310300000000, + 0xd574b7e900000000, 0x34c2e50600000000, 0x5c669af000000000, + 0xbdd0c81f00000000, 0xdf0d4ef500000000, 0x3ebb1c1a00000000, + 0x5ab132fb00000000, 0xbb07601400000000, 0xd9dae6fe00000000, + 0x386cb41100000000, 0x489468c900000000, 0xa9223a2600000000, + 0xcbffbccc00000000, 0x2a49ee2300000000, 0x4e43c0c200000000, + 0xaff5922d00000000, 0xcd2814c700000000, 0x2c9e462800000000, + 0x443a39de00000000, 0xa58c6b3100000000, 0xc751eddb00000000, + 0x26e7bf3400000000, 0x42ed91d500000000, 0xa35bc33a00000000, + 0xc18645d000000000, 0x2030173f00000000, 0x81e66bae00000000, + 0x6050394100000000, 0x028dbfab00000000, 0xe33bed4400000000, + 0x8731c3a500000000, 0x6687914a00000000, 0x045a17a000000000, + 0xe5ec454f00000000, 0x8d483ab900000000, 0x6cfe685600000000, + 0x0e23eebc00000000, 0xef95bc5300000000, 0x8b9f92b200000000, + 0x6a29c05d00000000, 0x08f446b700000000, 0xe942145800000000, + 0x99bac88000000000, 0x780c9a6f00000000, 0x1ad11c8500000000, + 0xfb674e6a00000000, 0x9f6d608b00000000, 0x7edb326400000000, + 0x1c06b48e00000000, 0xfdb0e66100000000, 0x9514999700000000, + 0x74a2cb7800000000, 0x167f4d9200000000, 0xf7c91f7d00000000, + 0x93c3319c00000000, 0x7275637300000000, 0x10a8e59900000000, + 0xf11eb77600000000, 0xb15e2df300000000, 0x50e87f1c00000000, + 0x3235f9f600000000, 0xd383ab1900000000, 0xb78985f800000000, + 0x563fd71700000000, 0x34e251fd00000000, 0xd554031200000000, + 0xbdf07ce400000000, 0x5c462e0b00000000, 0x3e9ba8e100000000, + 0xdf2dfa0e00000000, 0xbb27d4ef00000000, 0x5a91860000000000, + 0x384c00ea00000000, 0xd9fa520500000000, 0xa9028edd00000000, + 0x48b4dc3200000000, 0x2a695ad800000000, 0xcbdf083700000000, + 0xafd526d600000000, 0x4e63743900000000, 0x2cbef2d300000000, + 0xcd08a03c00000000, 0xa5acdfca00000000, 0x441a8d2500000000, + 0x26c70bcf00000000, 0xc771592000000000, 0xa37b77c100000000, + 0x42cd252e00000000, 0x2010a3c400000000, 0xc1a6f12b00000000, + 0xe196e61400000000, 0x0020b4fb00000000, 0x62fd321100000000, + 0x834b60fe00000000, 0xe7414e1f00000000, 0x06f71cf000000000, + 0x642a9a1a00000000, 0x859cc8f500000000, 0xed38b70300000000, + 0x0c8ee5ec00000000, 0x6e53630600000000, 0x8fe531e900000000, + 0xebef1f0800000000, 0x0a594de700000000, 0x6884cb0d00000000, + 0x893299e200000000, 0xf9ca453a00000000, 0x187c17d500000000, + 0x7aa1913f00000000, 0x9b17c3d000000000, 0xff1ded3100000000, + 0x1eabbfde00000000, 0x7c76393400000000, 0x9dc06bdb00000000, + 0xf564142d00000000, 0x14d246c200000000, 0x760fc02800000000, + 0x97b992c700000000, 0xf3b3bc2600000000, 0x1205eec900000000, + 0x70d8682300000000, 0x916e3acc00000000, 0xd12ea04900000000, + 0x3098f2a600000000, 0x5245744c00000000, 0xb3f326a300000000, + 0xd7f9084200000000, 0x364f5aad00000000, 0x5492dc4700000000, + 0xb5248ea800000000, 0xdd80f15e00000000, 0x3c36a3b100000000, + 0x5eeb255b00000000, 0xbf5d77b400000000, 0xdb57595500000000, + 0x3ae10bba00000000, 0x583c8d5000000000, 0xb98adfbf00000000, + 0xc972036700000000, 0x28c4518800000000, 0x4a19d76200000000, + 0xabaf858d00000000, 0xcfa5ab6c00000000, 0x2e13f98300000000, + 0x4cce7f6900000000, 0xad782d8600000000, 0xc5dc527000000000, + 0x246a009f00000000, 0x46b7867500000000, 0xa701d49a00000000, + 0xc30bfa7b00000000, 0x22bda89400000000, 0x40602e7e00000000, + 0xa1d67c9100000000}, + {0x0000000000000000, 0x5880e2d700000000, 0xf106b47400000000, + 0xa98656a300000000, 0xe20d68e900000000, 0xba8d8a3e00000000, + 0x130bdc9d00000000, 0x4b8b3e4a00000000, 0x851da10900000000, + 0xdd9d43de00000000, 0x741b157d00000000, 0x2c9bf7aa00000000, + 0x6710c9e000000000, 0x3f902b3700000000, 0x96167d9400000000, + 0xce969f4300000000, 0x0a3b421300000000, 0x52bba0c400000000, + 0xfb3df66700000000, 0xa3bd14b000000000, 0xe8362afa00000000, + 0xb0b6c82d00000000, 0x19309e8e00000000, 0x41b07c5900000000, + 0x8f26e31a00000000, 0xd7a601cd00000000, 0x7e20576e00000000, + 0x26a0b5b900000000, 0x6d2b8bf300000000, 0x35ab692400000000, + 0x9c2d3f8700000000, 0xc4addd5000000000, 0x1476842600000000, + 0x4cf666f100000000, 0xe570305200000000, 0xbdf0d28500000000, + 0xf67beccf00000000, 0xaefb0e1800000000, 0x077d58bb00000000, + 0x5ffdba6c00000000, 0x916b252f00000000, 0xc9ebc7f800000000, + 0x606d915b00000000, 0x38ed738c00000000, 0x73664dc600000000, + 0x2be6af1100000000, 0x8260f9b200000000, 0xdae01b6500000000, + 0x1e4dc63500000000, 0x46cd24e200000000, 0xef4b724100000000, + 0xb7cb909600000000, 0xfc40aedc00000000, 0xa4c04c0b00000000, + 0x0d461aa800000000, 0x55c6f87f00000000, 0x9b50673c00000000, + 0xc3d085eb00000000, 0x6a56d34800000000, 0x32d6319f00000000, + 0x795d0fd500000000, 0x21dded0200000000, 0x885bbba100000000, + 0xd0db597600000000, 0x28ec084d00000000, 0x706cea9a00000000, + 0xd9eabc3900000000, 0x816a5eee00000000, 0xcae160a400000000, + 0x9261827300000000, 0x3be7d4d000000000, 0x6367360700000000, + 0xadf1a94400000000, 0xf5714b9300000000, 0x5cf71d3000000000, + 0x0477ffe700000000, 0x4ffcc1ad00000000, 0x177c237a00000000, + 0xbefa75d900000000, 0xe67a970e00000000, 0x22d74a5e00000000, + 0x7a57a88900000000, 0xd3d1fe2a00000000, 0x8b511cfd00000000, + 0xc0da22b700000000, 0x985ac06000000000, 0x31dc96c300000000, + 0x695c741400000000, 0xa7caeb5700000000, 0xff4a098000000000, + 0x56cc5f2300000000, 0x0e4cbdf400000000, 0x45c783be00000000, + 0x1d47616900000000, 0xb4c137ca00000000, 0xec41d51d00000000, + 0x3c9a8c6b00000000, 0x641a6ebc00000000, 0xcd9c381f00000000, + 0x951cdac800000000, 0xde97e48200000000, 0x8617065500000000, + 0x2f9150f600000000, 0x7711b22100000000, 0xb9872d6200000000, + 0xe107cfb500000000, 0x4881991600000000, 0x10017bc100000000, + 0x5b8a458b00000000, 0x030aa75c00000000, 0xaa8cf1ff00000000, + 0xf20c132800000000, 0x36a1ce7800000000, 0x6e212caf00000000, + 0xc7a77a0c00000000, 0x9f2798db00000000, 0xd4aca69100000000, + 0x8c2c444600000000, 0x25aa12e500000000, 0x7d2af03200000000, + 0xb3bc6f7100000000, 0xeb3c8da600000000, 0x42badb0500000000, + 0x1a3a39d200000000, 0x51b1079800000000, 0x0931e54f00000000, + 0xa0b7b3ec00000000, 0xf837513b00000000, 0x50d8119a00000000, + 0x0858f34d00000000, 0xa1dea5ee00000000, 0xf95e473900000000, + 0xb2d5797300000000, 0xea559ba400000000, 0x43d3cd0700000000, + 0x1b532fd000000000, 0xd5c5b09300000000, 0x8d45524400000000, + 0x24c304e700000000, 0x7c43e63000000000, 0x37c8d87a00000000, + 0x6f483aad00000000, 0xc6ce6c0e00000000, 0x9e4e8ed900000000, + 0x5ae3538900000000, 0x0263b15e00000000, 0xabe5e7fd00000000, + 0xf365052a00000000, 0xb8ee3b6000000000, 0xe06ed9b700000000, + 0x49e88f1400000000, 0x11686dc300000000, 0xdffef28000000000, + 0x877e105700000000, 0x2ef846f400000000, 0x7678a42300000000, + 0x3df39a6900000000, 0x657378be00000000, 0xccf52e1d00000000, + 0x9475ccca00000000, 0x44ae95bc00000000, 0x1c2e776b00000000, + 0xb5a821c800000000, 0xed28c31f00000000, 0xa6a3fd5500000000, + 0xfe231f8200000000, 0x57a5492100000000, 0x0f25abf600000000, + 0xc1b334b500000000, 0x9933d66200000000, 0x30b580c100000000, + 0x6835621600000000, 0x23be5c5c00000000, 0x7b3ebe8b00000000, + 0xd2b8e82800000000, 0x8a380aff00000000, 0x4e95d7af00000000, + 0x1615357800000000, 0xbf9363db00000000, 0xe713810c00000000, + 0xac98bf4600000000, 0xf4185d9100000000, 0x5d9e0b3200000000, + 0x051ee9e500000000, 0xcb8876a600000000, 0x9308947100000000, + 0x3a8ec2d200000000, 0x620e200500000000, 0x29851e4f00000000, + 0x7105fc9800000000, 0xd883aa3b00000000, 0x800348ec00000000, + 0x783419d700000000, 0x20b4fb0000000000, 0x8932ada300000000, + 0xd1b24f7400000000, 0x9a39713e00000000, 0xc2b993e900000000, + 0x6b3fc54a00000000, 0x33bf279d00000000, 0xfd29b8de00000000, + 0xa5a95a0900000000, 0x0c2f0caa00000000, 0x54afee7d00000000, + 0x1f24d03700000000, 0x47a432e000000000, 0xee22644300000000, + 0xb6a2869400000000, 0x720f5bc400000000, 0x2a8fb91300000000, + 0x8309efb000000000, 0xdb890d6700000000, 0x9002332d00000000, + 0xc882d1fa00000000, 0x6104875900000000, 0x3984658e00000000, + 0xf712facd00000000, 0xaf92181a00000000, 0x06144eb900000000, + 0x5e94ac6e00000000, 0x151f922400000000, 0x4d9f70f300000000, + 0xe419265000000000, 0xbc99c48700000000, 0x6c429df100000000, + 0x34c27f2600000000, 0x9d44298500000000, 0xc5c4cb5200000000, + 0x8e4ff51800000000, 0xd6cf17cf00000000, 0x7f49416c00000000, + 0x27c9a3bb00000000, 0xe95f3cf800000000, 0xb1dfde2f00000000, + 0x1859888c00000000, 0x40d96a5b00000000, 0x0b52541100000000, + 0x53d2b6c600000000, 0xfa54e06500000000, 0xa2d402b200000000, + 0x6679dfe200000000, 0x3ef93d3500000000, 0x977f6b9600000000, + 0xcfff894100000000, 0x8474b70b00000000, 0xdcf455dc00000000, + 0x7572037f00000000, 0x2df2e1a800000000, 0xe3647eeb00000000, + 0xbbe49c3c00000000, 0x1262ca9f00000000, 0x4ae2284800000000, + 0x0169160200000000, 0x59e9f4d500000000, 0xf06fa27600000000, + 0xa8ef40a100000000}, + {0x0000000000000000, 0x463b676500000000, 0x8c76ceca00000000, + 0xca4da9af00000000, 0x59ebed4e00000000, 0x1fd08a2b00000000, + 0xd59d238400000000, 0x93a644e100000000, 0xb2d6db9d00000000, + 0xf4edbcf800000000, 0x3ea0155700000000, 0x789b723200000000, + 0xeb3d36d300000000, 0xad0651b600000000, 0x674bf81900000000, + 0x21709f7c00000000, 0x25abc6e000000000, 0x6390a18500000000, + 0xa9dd082a00000000, 0xefe66f4f00000000, 0x7c402bae00000000, + 0x3a7b4ccb00000000, 0xf036e56400000000, 0xb60d820100000000, + 0x977d1d7d00000000, 0xd1467a1800000000, 0x1b0bd3b700000000, + 0x5d30b4d200000000, 0xce96f03300000000, 0x88ad975600000000, + 0x42e03ef900000000, 0x04db599c00000000, 0x0b50fc1a00000000, + 0x4d6b9b7f00000000, 0x872632d000000000, 0xc11d55b500000000, + 0x52bb115400000000, 0x1480763100000000, 0xdecddf9e00000000, + 0x98f6b8fb00000000, 0xb986278700000000, 0xffbd40e200000000, + 0x35f0e94d00000000, 0x73cb8e2800000000, 0xe06dcac900000000, + 0xa656adac00000000, 0x6c1b040300000000, 0x2a20636600000000, + 0x2efb3afa00000000, 0x68c05d9f00000000, 0xa28df43000000000, + 0xe4b6935500000000, 0x7710d7b400000000, 0x312bb0d100000000, + 0xfb66197e00000000, 0xbd5d7e1b00000000, 0x9c2de16700000000, + 0xda16860200000000, 0x105b2fad00000000, 0x566048c800000000, + 0xc5c60c2900000000, 0x83fd6b4c00000000, 0x49b0c2e300000000, + 0x0f8ba58600000000, 0x16a0f83500000000, 0x509b9f5000000000, + 0x9ad636ff00000000, 0xdced519a00000000, 0x4f4b157b00000000, + 0x0970721e00000000, 0xc33ddbb100000000, 0x8506bcd400000000, + 0xa47623a800000000, 0xe24d44cd00000000, 0x2800ed6200000000, + 0x6e3b8a0700000000, 0xfd9dcee600000000, 0xbba6a98300000000, + 0x71eb002c00000000, 0x37d0674900000000, 0x330b3ed500000000, + 0x753059b000000000, 0xbf7df01f00000000, 0xf946977a00000000, + 0x6ae0d39b00000000, 0x2cdbb4fe00000000, 0xe6961d5100000000, + 0xa0ad7a3400000000, 0x81dde54800000000, 0xc7e6822d00000000, + 0x0dab2b8200000000, 0x4b904ce700000000, 0xd836080600000000, + 0x9e0d6f6300000000, 0x5440c6cc00000000, 0x127ba1a900000000, + 0x1df0042f00000000, 0x5bcb634a00000000, 0x9186cae500000000, + 0xd7bdad8000000000, 0x441be96100000000, 0x02208e0400000000, + 0xc86d27ab00000000, 0x8e5640ce00000000, 0xaf26dfb200000000, + 0xe91db8d700000000, 0x2350117800000000, 0x656b761d00000000, + 0xf6cd32fc00000000, 0xb0f6559900000000, 0x7abbfc3600000000, + 0x3c809b5300000000, 0x385bc2cf00000000, 0x7e60a5aa00000000, + 0xb42d0c0500000000, 0xf2166b6000000000, 0x61b02f8100000000, + 0x278b48e400000000, 0xedc6e14b00000000, 0xabfd862e00000000, + 0x8a8d195200000000, 0xccb67e3700000000, 0x06fbd79800000000, + 0x40c0b0fd00000000, 0xd366f41c00000000, 0x955d937900000000, + 0x5f103ad600000000, 0x192b5db300000000, 0x2c40f16b00000000, + 0x6a7b960e00000000, 0xa0363fa100000000, 0xe60d58c400000000, + 0x75ab1c2500000000, 0x33907b4000000000, 0xf9ddd2ef00000000, + 0xbfe6b58a00000000, 0x9e962af600000000, 0xd8ad4d9300000000, + 0x12e0e43c00000000, 0x54db835900000000, 0xc77dc7b800000000, + 0x8146a0dd00000000, 0x4b0b097200000000, 0x0d306e1700000000, + 0x09eb378b00000000, 0x4fd050ee00000000, 0x859df94100000000, + 0xc3a69e2400000000, 0x5000dac500000000, 0x163bbda000000000, + 0xdc76140f00000000, 0x9a4d736a00000000, 0xbb3dec1600000000, + 0xfd068b7300000000, 0x374b22dc00000000, 0x717045b900000000, + 0xe2d6015800000000, 0xa4ed663d00000000, 0x6ea0cf9200000000, + 0x289ba8f700000000, 0x27100d7100000000, 0x612b6a1400000000, + 0xab66c3bb00000000, 0xed5da4de00000000, 0x7efbe03f00000000, + 0x38c0875a00000000, 0xf28d2ef500000000, 0xb4b6499000000000, + 0x95c6d6ec00000000, 0xd3fdb18900000000, 0x19b0182600000000, + 0x5f8b7f4300000000, 0xcc2d3ba200000000, 0x8a165cc700000000, + 0x405bf56800000000, 0x0660920d00000000, 0x02bbcb9100000000, + 0x4480acf400000000, 0x8ecd055b00000000, 0xc8f6623e00000000, + 0x5b5026df00000000, 0x1d6b41ba00000000, 0xd726e81500000000, + 0x911d8f7000000000, 0xb06d100c00000000, 0xf656776900000000, + 0x3c1bdec600000000, 0x7a20b9a300000000, 0xe986fd4200000000, + 0xafbd9a2700000000, 0x65f0338800000000, 0x23cb54ed00000000, + 0x3ae0095e00000000, 0x7cdb6e3b00000000, 0xb696c79400000000, + 0xf0ada0f100000000, 0x630be41000000000, 0x2530837500000000, + 0xef7d2ada00000000, 0xa9464dbf00000000, 0x8836d2c300000000, + 0xce0db5a600000000, 0x04401c0900000000, 0x427b7b6c00000000, + 0xd1dd3f8d00000000, 0x97e658e800000000, 0x5dabf14700000000, + 0x1b90962200000000, 0x1f4bcfbe00000000, 0x5970a8db00000000, + 0x933d017400000000, 0xd506661100000000, 0x46a022f000000000, + 0x009b459500000000, 0xcad6ec3a00000000, 0x8ced8b5f00000000, + 0xad9d142300000000, 0xeba6734600000000, 0x21ebdae900000000, + 0x67d0bd8c00000000, 0xf476f96d00000000, 0xb24d9e0800000000, + 0x780037a700000000, 0x3e3b50c200000000, 0x31b0f54400000000, + 0x778b922100000000, 0xbdc63b8e00000000, 0xfbfd5ceb00000000, + 0x685b180a00000000, 0x2e607f6f00000000, 0xe42dd6c000000000, + 0xa216b1a500000000, 0x83662ed900000000, 0xc55d49bc00000000, + 0x0f10e01300000000, 0x492b877600000000, 0xda8dc39700000000, + 0x9cb6a4f200000000, 0x56fb0d5d00000000, 0x10c06a3800000000, + 0x141b33a400000000, 0x522054c100000000, 0x986dfd6e00000000, + 0xde569a0b00000000, 0x4df0deea00000000, 0x0bcbb98f00000000, + 0xc186102000000000, 0x87bd774500000000, 0xa6cde83900000000, + 0xe0f68f5c00000000, 0x2abb26f300000000, 0x6c80419600000000, + 0xff26057700000000, 0xb91d621200000000, 0x7350cbbd00000000, + 0x356bacd800000000}, + {0x0000000000000000, 0x9e83da9f00000000, 0x7d01c4e400000000, + 0xe3821e7b00000000, 0xbb04f91200000000, 0x2587238d00000000, + 0xc6053df600000000, 0x5886e76900000000, 0x7609f22500000000, + 0xe88a28ba00000000, 0x0b0836c100000000, 0x958bec5e00000000, + 0xcd0d0b3700000000, 0x538ed1a800000000, 0xb00ccfd300000000, + 0x2e8f154c00000000, 0xec12e44b00000000, 0x72913ed400000000, + 0x911320af00000000, 0x0f90fa3000000000, 0x57161d5900000000, + 0xc995c7c600000000, 0x2a17d9bd00000000, 0xb494032200000000, + 0x9a1b166e00000000, 0x0498ccf100000000, 0xe71ad28a00000000, + 0x7999081500000000, 0x211fef7c00000000, 0xbf9c35e300000000, + 0x5c1e2b9800000000, 0xc29df10700000000, 0xd825c89700000000, + 0x46a6120800000000, 0xa5240c7300000000, 0x3ba7d6ec00000000, + 0x6321318500000000, 0xfda2eb1a00000000, 0x1e20f56100000000, + 0x80a32ffe00000000, 0xae2c3ab200000000, 0x30afe02d00000000, + 0xd32dfe5600000000, 0x4dae24c900000000, 0x1528c3a000000000, + 0x8bab193f00000000, 0x6829074400000000, 0xf6aadddb00000000, + 0x34372cdc00000000, 0xaab4f64300000000, 0x4936e83800000000, + 0xd7b532a700000000, 0x8f33d5ce00000000, 0x11b00f5100000000, + 0xf232112a00000000, 0x6cb1cbb500000000, 0x423edef900000000, + 0xdcbd046600000000, 0x3f3f1a1d00000000, 0xa1bcc08200000000, + 0xf93a27eb00000000, 0x67b9fd7400000000, 0x843be30f00000000, + 0x1ab8399000000000, 0xf14de1f400000000, 0x6fce3b6b00000000, + 0x8c4c251000000000, 0x12cfff8f00000000, 0x4a4918e600000000, + 0xd4cac27900000000, 0x3748dc0200000000, 0xa9cb069d00000000, + 0x874413d100000000, 0x19c7c94e00000000, 0xfa45d73500000000, + 0x64c60daa00000000, 0x3c40eac300000000, 0xa2c3305c00000000, + 0x41412e2700000000, 0xdfc2f4b800000000, 0x1d5f05bf00000000, + 0x83dcdf2000000000, 0x605ec15b00000000, 0xfedd1bc400000000, + 0xa65bfcad00000000, 0x38d8263200000000, 0xdb5a384900000000, + 0x45d9e2d600000000, 0x6b56f79a00000000, 0xf5d52d0500000000, + 0x1657337e00000000, 0x88d4e9e100000000, 0xd0520e8800000000, + 0x4ed1d41700000000, 0xad53ca6c00000000, 0x33d010f300000000, + 0x2968296300000000, 0xb7ebf3fc00000000, 0x5469ed8700000000, + 0xcaea371800000000, 0x926cd07100000000, 0x0cef0aee00000000, + 0xef6d149500000000, 0x71eece0a00000000, 0x5f61db4600000000, + 0xc1e201d900000000, 0x22601fa200000000, 0xbce3c53d00000000, + 0xe465225400000000, 0x7ae6f8cb00000000, 0x9964e6b000000000, + 0x07e73c2f00000000, 0xc57acd2800000000, 0x5bf917b700000000, + 0xb87b09cc00000000, 0x26f8d35300000000, 0x7e7e343a00000000, + 0xe0fdeea500000000, 0x037ff0de00000000, 0x9dfc2a4100000000, + 0xb3733f0d00000000, 0x2df0e59200000000, 0xce72fbe900000000, + 0x50f1217600000000, 0x0877c61f00000000, 0x96f41c8000000000, + 0x757602fb00000000, 0xebf5d86400000000, 0xa39db33200000000, + 0x3d1e69ad00000000, 0xde9c77d600000000, 0x401fad4900000000, + 0x18994a2000000000, 0x861a90bf00000000, 0x65988ec400000000, + 0xfb1b545b00000000, 0xd594411700000000, 0x4b179b8800000000, + 0xa89585f300000000, 0x36165f6c00000000, 0x6e90b80500000000, + 0xf013629a00000000, 0x13917ce100000000, 0x8d12a67e00000000, + 0x4f8f577900000000, 0xd10c8de600000000, 0x328e939d00000000, + 0xac0d490200000000, 0xf48bae6b00000000, 0x6a0874f400000000, + 0x898a6a8f00000000, 0x1709b01000000000, 0x3986a55c00000000, + 0xa7057fc300000000, 0x448761b800000000, 0xda04bb2700000000, + 0x82825c4e00000000, 0x1c0186d100000000, 0xff8398aa00000000, + 0x6100423500000000, 0x7bb87ba500000000, 0xe53ba13a00000000, + 0x06b9bf4100000000, 0x983a65de00000000, 0xc0bc82b700000000, + 0x5e3f582800000000, 0xbdbd465300000000, 0x233e9ccc00000000, + 0x0db1898000000000, 0x9332531f00000000, 0x70b04d6400000000, + 0xee3397fb00000000, 0xb6b5709200000000, 0x2836aa0d00000000, + 0xcbb4b47600000000, 0x55376ee900000000, 0x97aa9fee00000000, + 0x0929457100000000, 0xeaab5b0a00000000, 0x7428819500000000, + 0x2cae66fc00000000, 0xb22dbc6300000000, 0x51afa21800000000, + 0xcf2c788700000000, 0xe1a36dcb00000000, 0x7f20b75400000000, + 0x9ca2a92f00000000, 0x022173b000000000, 0x5aa794d900000000, + 0xc4244e4600000000, 0x27a6503d00000000, 0xb9258aa200000000, + 0x52d052c600000000, 0xcc53885900000000, 0x2fd1962200000000, + 0xb1524cbd00000000, 0xe9d4abd400000000, 0x7757714b00000000, + 0x94d56f3000000000, 0x0a56b5af00000000, 0x24d9a0e300000000, + 0xba5a7a7c00000000, 0x59d8640700000000, 0xc75bbe9800000000, + 0x9fdd59f100000000, 0x015e836e00000000, 0xe2dc9d1500000000, + 0x7c5f478a00000000, 0xbec2b68d00000000, 0x20416c1200000000, + 0xc3c3726900000000, 0x5d40a8f600000000, 0x05c64f9f00000000, + 0x9b45950000000000, 0x78c78b7b00000000, 0xe64451e400000000, + 0xc8cb44a800000000, 0x56489e3700000000, 0xb5ca804c00000000, + 0x2b495ad300000000, 0x73cfbdba00000000, 0xed4c672500000000, + 0x0ece795e00000000, 0x904da3c100000000, 0x8af59a5100000000, + 0x147640ce00000000, 0xf7f45eb500000000, 0x6977842a00000000, + 0x31f1634300000000, 0xaf72b9dc00000000, 0x4cf0a7a700000000, + 0xd2737d3800000000, 0xfcfc687400000000, 0x627fb2eb00000000, + 0x81fdac9000000000, 0x1f7e760f00000000, 0x47f8916600000000, + 0xd97b4bf900000000, 0x3af9558200000000, 0xa47a8f1d00000000, + 0x66e77e1a00000000, 0xf864a48500000000, 0x1be6bafe00000000, + 0x8565606100000000, 0xdde3870800000000, 0x43605d9700000000, + 0xa0e243ec00000000, 0x3e61997300000000, 0x10ee8c3f00000000, + 0x8e6d56a000000000, 0x6def48db00000000, 0xf36c924400000000, + 0xabea752d00000000, 0x3569afb200000000, 0xd6ebb1c900000000, + 0x48686b5600000000}, + {0x0000000000000000, 0xc064281700000000, 0x80c9502e00000000, + 0x40ad783900000000, 0x0093a15c00000000, 0xc0f7894b00000000, + 0x805af17200000000, 0x403ed96500000000, 0x002643b900000000, + 0xc0426bae00000000, 0x80ef139700000000, 0x408b3b8000000000, + 0x00b5e2e500000000, 0xc0d1caf200000000, 0x807cb2cb00000000, + 0x40189adc00000000, 0x414af7a900000000, 0x812edfbe00000000, + 0xc183a78700000000, 0x01e78f9000000000, 0x41d956f500000000, + 0x81bd7ee200000000, 0xc11006db00000000, 0x01742ecc00000000, + 0x416cb41000000000, 0x81089c0700000000, 0xc1a5e43e00000000, + 0x01c1cc2900000000, 0x41ff154c00000000, 0x819b3d5b00000000, + 0xc136456200000000, 0x01526d7500000000, 0xc3929f8800000000, + 0x03f6b79f00000000, 0x435bcfa600000000, 0x833fe7b100000000, + 0xc3013ed400000000, 0x036516c300000000, 0x43c86efa00000000, + 0x83ac46ed00000000, 0xc3b4dc3100000000, 0x03d0f42600000000, + 0x437d8c1f00000000, 0x8319a40800000000, 0xc3277d6d00000000, + 0x0343557a00000000, 0x43ee2d4300000000, 0x838a055400000000, + 0x82d8682100000000, 0x42bc403600000000, 0x0211380f00000000, + 0xc275101800000000, 0x824bc97d00000000, 0x422fe16a00000000, + 0x0282995300000000, 0xc2e6b14400000000, 0x82fe2b9800000000, + 0x429a038f00000000, 0x02377bb600000000, 0xc25353a100000000, + 0x826d8ac400000000, 0x4209a2d300000000, 0x02a4daea00000000, + 0xc2c0f2fd00000000, 0xc7234eca00000000, 0x074766dd00000000, + 0x47ea1ee400000000, 0x878e36f300000000, 0xc7b0ef9600000000, + 0x07d4c78100000000, 0x4779bfb800000000, 0x871d97af00000000, + 0xc7050d7300000000, 0x0761256400000000, 0x47cc5d5d00000000, + 0x87a8754a00000000, 0xc796ac2f00000000, 0x07f2843800000000, + 0x475ffc0100000000, 0x873bd41600000000, 0x8669b96300000000, + 0x460d917400000000, 0x06a0e94d00000000, 0xc6c4c15a00000000, + 0x86fa183f00000000, 0x469e302800000000, 0x0633481100000000, + 0xc657600600000000, 0x864ffada00000000, 0x462bd2cd00000000, + 0x0686aaf400000000, 0xc6e282e300000000, 0x86dc5b8600000000, + 0x46b8739100000000, 0x06150ba800000000, 0xc67123bf00000000, + 0x04b1d14200000000, 0xc4d5f95500000000, 0x8478816c00000000, + 0x441ca97b00000000, 0x0422701e00000000, 0xc446580900000000, + 0x84eb203000000000, 0x448f082700000000, 0x049792fb00000000, + 0xc4f3baec00000000, 0x845ec2d500000000, 0x443aeac200000000, + 0x040433a700000000, 0xc4601bb000000000, 0x84cd638900000000, + 0x44a94b9e00000000, 0x45fb26eb00000000, 0x859f0efc00000000, + 0xc53276c500000000, 0x05565ed200000000, 0x456887b700000000, + 0x850cafa000000000, 0xc5a1d79900000000, 0x05c5ff8e00000000, + 0x45dd655200000000, 0x85b94d4500000000, 0xc514357c00000000, + 0x05701d6b00000000, 0x454ec40e00000000, 0x852aec1900000000, + 0xc587942000000000, 0x05e3bc3700000000, 0xcf41ed4f00000000, + 0x0f25c55800000000, 0x4f88bd6100000000, 0x8fec957600000000, + 0xcfd24c1300000000, 0x0fb6640400000000, 0x4f1b1c3d00000000, + 0x8f7f342a00000000, 0xcf67aef600000000, 0x0f0386e100000000, + 0x4faefed800000000, 0x8fcad6cf00000000, 0xcff40faa00000000, + 0x0f9027bd00000000, 0x4f3d5f8400000000, 0x8f59779300000000, + 0x8e0b1ae600000000, 0x4e6f32f100000000, 0x0ec24ac800000000, + 0xcea662df00000000, 0x8e98bbba00000000, 0x4efc93ad00000000, + 0x0e51eb9400000000, 0xce35c38300000000, 0x8e2d595f00000000, + 0x4e49714800000000, 0x0ee4097100000000, 0xce80216600000000, + 0x8ebef80300000000, 0x4edad01400000000, 0x0e77a82d00000000, + 0xce13803a00000000, 0x0cd372c700000000, 0xccb75ad000000000, + 0x8c1a22e900000000, 0x4c7e0afe00000000, 0x0c40d39b00000000, + 0xcc24fb8c00000000, 0x8c8983b500000000, 0x4cedaba200000000, + 0x0cf5317e00000000, 0xcc91196900000000, 0x8c3c615000000000, + 0x4c58494700000000, 0x0c66902200000000, 0xcc02b83500000000, + 0x8cafc00c00000000, 0x4ccbe81b00000000, 0x4d99856e00000000, + 0x8dfdad7900000000, 0xcd50d54000000000, 0x0d34fd5700000000, + 0x4d0a243200000000, 0x8d6e0c2500000000, 0xcdc3741c00000000, + 0x0da75c0b00000000, 0x4dbfc6d700000000, 0x8ddbeec000000000, + 0xcd7696f900000000, 0x0d12beee00000000, 0x4d2c678b00000000, + 0x8d484f9c00000000, 0xcde537a500000000, 0x0d811fb200000000, + 0x0862a38500000000, 0xc8068b9200000000, 0x88abf3ab00000000, + 0x48cfdbbc00000000, 0x08f102d900000000, 0xc8952ace00000000, + 0x883852f700000000, 0x485c7ae000000000, 0x0844e03c00000000, + 0xc820c82b00000000, 0x888db01200000000, 0x48e9980500000000, + 0x08d7416000000000, 0xc8b3697700000000, 0x881e114e00000000, + 0x487a395900000000, 0x4928542c00000000, 0x894c7c3b00000000, + 0xc9e1040200000000, 0x09852c1500000000, 0x49bbf57000000000, + 0x89dfdd6700000000, 0xc972a55e00000000, 0x09168d4900000000, + 0x490e179500000000, 0x896a3f8200000000, 0xc9c747bb00000000, + 0x09a36fac00000000, 0x499db6c900000000, 0x89f99ede00000000, + 0xc954e6e700000000, 0x0930cef000000000, 0xcbf03c0d00000000, + 0x0b94141a00000000, 0x4b396c2300000000, 0x8b5d443400000000, + 0xcb639d5100000000, 0x0b07b54600000000, 0x4baacd7f00000000, + 0x8bcee56800000000, 0xcbd67fb400000000, 0x0bb257a300000000, + 0x4b1f2f9a00000000, 0x8b7b078d00000000, 0xcb45dee800000000, + 0x0b21f6ff00000000, 0x4b8c8ec600000000, 0x8be8a6d100000000, + 0x8abacba400000000, 0x4adee3b300000000, 0x0a739b8a00000000, + 0xca17b39d00000000, 0x8a296af800000000, 0x4a4d42ef00000000, + 0x0ae03ad600000000, 0xca8412c100000000, 0x8a9c881d00000000, + 0x4af8a00a00000000, 0x0a55d83300000000, 0xca31f02400000000, + 0x8a0f294100000000, 0x4a6b015600000000, 0x0ac6796f00000000, + 0xcaa2517800000000}, + {0x0000000000000000, 0xd4ea739b00000000, 0xe9d396ed00000000, + 0x3d39e57600000000, 0x93a15c0000000000, 0x474b2f9b00000000, + 0x7a72caed00000000, 0xae98b97600000000, 0x2643b90000000000, + 0xf2a9ca9b00000000, 0xcf902fed00000000, 0x1b7a5c7600000000, + 0xb5e2e50000000000, 0x6108969b00000000, 0x5c3173ed00000000, + 0x88db007600000000, 0x4c86720100000000, 0x986c019a00000000, + 0xa555e4ec00000000, 0x71bf977700000000, 0xdf272e0100000000, + 0x0bcd5d9a00000000, 0x36f4b8ec00000000, 0xe21ecb7700000000, + 0x6ac5cb0100000000, 0xbe2fb89a00000000, 0x83165dec00000000, + 0x57fc2e7700000000, 0xf964970100000000, 0x2d8ee49a00000000, + 0x10b701ec00000000, 0xc45d727700000000, 0x980ce50200000000, + 0x4ce6969900000000, 0x71df73ef00000000, 0xa535007400000000, + 0x0badb90200000000, 0xdf47ca9900000000, 0xe27e2fef00000000, + 0x36945c7400000000, 0xbe4f5c0200000000, 0x6aa52f9900000000, + 0x579ccaef00000000, 0x8376b97400000000, 0x2dee000200000000, + 0xf904739900000000, 0xc43d96ef00000000, 0x10d7e57400000000, + 0xd48a970300000000, 0x0060e49800000000, 0x3d5901ee00000000, + 0xe9b3727500000000, 0x472bcb0300000000, 0x93c1b89800000000, + 0xaef85dee00000000, 0x7a122e7500000000, 0xf2c92e0300000000, + 0x26235d9800000000, 0x1b1ab8ee00000000, 0xcff0cb7500000000, + 0x6168720300000000, 0xb582019800000000, 0x88bbe4ee00000000, + 0x5c51977500000000, 0x3019ca0500000000, 0xe4f3b99e00000000, + 0xd9ca5ce800000000, 0x0d202f7300000000, 0xa3b8960500000000, + 0x7752e59e00000000, 0x4a6b00e800000000, 0x9e81737300000000, + 0x165a730500000000, 0xc2b0009e00000000, 0xff89e5e800000000, + 0x2b63967300000000, 0x85fb2f0500000000, 0x51115c9e00000000, + 0x6c28b9e800000000, 0xb8c2ca7300000000, 0x7c9fb80400000000, + 0xa875cb9f00000000, 0x954c2ee900000000, 0x41a65d7200000000, + 0xef3ee40400000000, 0x3bd4979f00000000, 0x06ed72e900000000, + 0xd207017200000000, 0x5adc010400000000, 0x8e36729f00000000, + 0xb30f97e900000000, 0x67e5e47200000000, 0xc97d5d0400000000, + 0x1d972e9f00000000, 0x20aecbe900000000, 0xf444b87200000000, + 0xa8152f0700000000, 0x7cff5c9c00000000, 0x41c6b9ea00000000, + 0x952cca7100000000, 0x3bb4730700000000, 0xef5e009c00000000, + 0xd267e5ea00000000, 0x068d967100000000, 0x8e56960700000000, + 0x5abce59c00000000, 0x678500ea00000000, 0xb36f737100000000, + 0x1df7ca0700000000, 0xc91db99c00000000, 0xf4245cea00000000, + 0x20ce2f7100000000, 0xe4935d0600000000, 0x30792e9d00000000, + 0x0d40cbeb00000000, 0xd9aab87000000000, 0x7732010600000000, + 0xa3d8729d00000000, 0x9ee197eb00000000, 0x4a0be47000000000, + 0xc2d0e40600000000, 0x163a979d00000000, 0x2b0372eb00000000, + 0xffe9017000000000, 0x5171b80600000000, 0x859bcb9d00000000, + 0xb8a22eeb00000000, 0x6c485d7000000000, 0x6032940b00000000, + 0xb4d8e79000000000, 0x89e102e600000000, 0x5d0b717d00000000, + 0xf393c80b00000000, 0x2779bb9000000000, 0x1a405ee600000000, + 0xceaa2d7d00000000, 0x46712d0b00000000, 0x929b5e9000000000, + 0xafa2bbe600000000, 0x7b48c87d00000000, 0xd5d0710b00000000, + 0x013a029000000000, 0x3c03e7e600000000, 0xe8e9947d00000000, + 0x2cb4e60a00000000, 0xf85e959100000000, 0xc56770e700000000, + 0x118d037c00000000, 0xbf15ba0a00000000, 0x6bffc99100000000, + 0x56c62ce700000000, 0x822c5f7c00000000, 0x0af75f0a00000000, + 0xde1d2c9100000000, 0xe324c9e700000000, 0x37ceba7c00000000, + 0x9956030a00000000, 0x4dbc709100000000, 0x708595e700000000, + 0xa46fe67c00000000, 0xf83e710900000000, 0x2cd4029200000000, + 0x11ede7e400000000, 0xc507947f00000000, 0x6b9f2d0900000000, + 0xbf755e9200000000, 0x824cbbe400000000, 0x56a6c87f00000000, + 0xde7dc80900000000, 0x0a97bb9200000000, 0x37ae5ee400000000, + 0xe3442d7f00000000, 0x4ddc940900000000, 0x9936e79200000000, + 0xa40f02e400000000, 0x70e5717f00000000, 0xb4b8030800000000, + 0x6052709300000000, 0x5d6b95e500000000, 0x8981e67e00000000, + 0x27195f0800000000, 0xf3f32c9300000000, 0xcecac9e500000000, + 0x1a20ba7e00000000, 0x92fbba0800000000, 0x4611c99300000000, + 0x7b282ce500000000, 0xafc25f7e00000000, 0x015ae60800000000, + 0xd5b0959300000000, 0xe88970e500000000, 0x3c63037e00000000, + 0x502b5e0e00000000, 0x84c12d9500000000, 0xb9f8c8e300000000, + 0x6d12bb7800000000, 0xc38a020e00000000, 0x1760719500000000, + 0x2a5994e300000000, 0xfeb3e77800000000, 0x7668e70e00000000, + 0xa282949500000000, 0x9fbb71e300000000, 0x4b51027800000000, + 0xe5c9bb0e00000000, 0x3123c89500000000, 0x0c1a2de300000000, + 0xd8f05e7800000000, 0x1cad2c0f00000000, 0xc8475f9400000000, + 0xf57ebae200000000, 0x2194c97900000000, 0x8f0c700f00000000, + 0x5be6039400000000, 0x66dfe6e200000000, 0xb235957900000000, + 0x3aee950f00000000, 0xee04e69400000000, 0xd33d03e200000000, + 0x07d7707900000000, 0xa94fc90f00000000, 0x7da5ba9400000000, + 0x409c5fe200000000, 0x94762c7900000000, 0xc827bb0c00000000, + 0x1ccdc89700000000, 0x21f42de100000000, 0xf51e5e7a00000000, + 0x5b86e70c00000000, 0x8f6c949700000000, 0xb25571e100000000, + 0x66bf027a00000000, 0xee64020c00000000, 0x3a8e719700000000, + 0x07b794e100000000, 0xd35de77a00000000, 0x7dc55e0c00000000, + 0xa92f2d9700000000, 0x9416c8e100000000, 0x40fcbb7a00000000, + 0x84a1c90d00000000, 0x504bba9600000000, 0x6d725fe000000000, + 0xb9982c7b00000000, 0x1700950d00000000, 0xc3eae69600000000, + 0xfed303e000000000, 0x2a39707b00000000, 0xa2e2700d00000000, + 0x7608039600000000, 0x4b31e6e000000000, 0x9fdb957b00000000, + 0x31432c0d00000000, 0xe5a95f9600000000, 0xd890bae000000000, + 0x0c7ac97b00000000}, + {0x0000000000000000, 0x2765258100000000, 0x0fcc3bd900000000, + 0x28a91e5800000000, 0x5f9e066900000000, 0x78fb23e800000000, + 0x50523db000000000, 0x7737183100000000, 0xbe3c0dd200000000, + 0x9959285300000000, 0xb1f0360b00000000, 0x9695138a00000000, + 0xe1a20bbb00000000, 0xc6c72e3a00000000, 0xee6e306200000000, + 0xc90b15e300000000, 0x3d7f6b7f00000000, 0x1a1a4efe00000000, + 0x32b350a600000000, 0x15d6752700000000, 0x62e16d1600000000, + 0x4584489700000000, 0x6d2d56cf00000000, 0x4a48734e00000000, + 0x834366ad00000000, 0xa426432c00000000, 0x8c8f5d7400000000, + 0xabea78f500000000, 0xdcdd60c400000000, 0xfbb8454500000000, + 0xd3115b1d00000000, 0xf4747e9c00000000, 0x7afed6fe00000000, + 0x5d9bf37f00000000, 0x7532ed2700000000, 0x5257c8a600000000, + 0x2560d09700000000, 0x0205f51600000000, 0x2aaceb4e00000000, + 0x0dc9cecf00000000, 0xc4c2db2c00000000, 0xe3a7fead00000000, + 0xcb0ee0f500000000, 0xec6bc57400000000, 0x9b5cdd4500000000, + 0xbc39f8c400000000, 0x9490e69c00000000, 0xb3f5c31d00000000, + 0x4781bd8100000000, 0x60e4980000000000, 0x484d865800000000, + 0x6f28a3d900000000, 0x181fbbe800000000, 0x3f7a9e6900000000, + 0x17d3803100000000, 0x30b6a5b000000000, 0xf9bdb05300000000, + 0xded895d200000000, 0xf6718b8a00000000, 0xd114ae0b00000000, + 0xa623b63a00000000, 0x814693bb00000000, 0xa9ef8de300000000, + 0x8e8aa86200000000, 0xb5fadc2600000000, 0x929ff9a700000000, + 0xba36e7ff00000000, 0x9d53c27e00000000, 0xea64da4f00000000, + 0xcd01ffce00000000, 0xe5a8e19600000000, 0xc2cdc41700000000, + 0x0bc6d1f400000000, 0x2ca3f47500000000, 0x040aea2d00000000, + 0x236fcfac00000000, 0x5458d79d00000000, 0x733df21c00000000, + 0x5b94ec4400000000, 0x7cf1c9c500000000, 0x8885b75900000000, + 0xafe092d800000000, 0x87498c8000000000, 0xa02ca90100000000, + 0xd71bb13000000000, 0xf07e94b100000000, 0xd8d78ae900000000, + 0xffb2af6800000000, 0x36b9ba8b00000000, 0x11dc9f0a00000000, + 0x3975815200000000, 0x1e10a4d300000000, 0x6927bce200000000, + 0x4e42996300000000, 0x66eb873b00000000, 0x418ea2ba00000000, + 0xcf040ad800000000, 0xe8612f5900000000, 0xc0c8310100000000, + 0xe7ad148000000000, 0x909a0cb100000000, 0xb7ff293000000000, + 0x9f56376800000000, 0xb83312e900000000, 0x7138070a00000000, + 0x565d228b00000000, 0x7ef43cd300000000, 0x5991195200000000, + 0x2ea6016300000000, 0x09c324e200000000, 0x216a3aba00000000, + 0x060f1f3b00000000, 0xf27b61a700000000, 0xd51e442600000000, + 0xfdb75a7e00000000, 0xdad27fff00000000, 0xade567ce00000000, + 0x8a80424f00000000, 0xa2295c1700000000, 0x854c799600000000, + 0x4c476c7500000000, 0x6b2249f400000000, 0x438b57ac00000000, + 0x64ee722d00000000, 0x13d96a1c00000000, 0x34bc4f9d00000000, + 0x1c1551c500000000, 0x3b70744400000000, 0x6af5b94d00000000, + 0x4d909ccc00000000, 0x6539829400000000, 0x425ca71500000000, + 0x356bbf2400000000, 0x120e9aa500000000, 0x3aa784fd00000000, + 0x1dc2a17c00000000, 0xd4c9b49f00000000, 0xf3ac911e00000000, + 0xdb058f4600000000, 0xfc60aac700000000, 0x8b57b2f600000000, + 0xac32977700000000, 0x849b892f00000000, 0xa3feacae00000000, + 0x578ad23200000000, 0x70eff7b300000000, 0x5846e9eb00000000, + 0x7f23cc6a00000000, 0x0814d45b00000000, 0x2f71f1da00000000, + 0x07d8ef8200000000, 0x20bdca0300000000, 0xe9b6dfe000000000, + 0xced3fa6100000000, 0xe67ae43900000000, 0xc11fc1b800000000, + 0xb628d98900000000, 0x914dfc0800000000, 0xb9e4e25000000000, + 0x9e81c7d100000000, 0x100b6fb300000000, 0x376e4a3200000000, + 0x1fc7546a00000000, 0x38a271eb00000000, 0x4f9569da00000000, + 0x68f04c5b00000000, 0x4059520300000000, 0x673c778200000000, + 0xae37626100000000, 0x895247e000000000, 0xa1fb59b800000000, + 0x869e7c3900000000, 0xf1a9640800000000, 0xd6cc418900000000, + 0xfe655fd100000000, 0xd9007a5000000000, 0x2d7404cc00000000, + 0x0a11214d00000000, 0x22b83f1500000000, 0x05dd1a9400000000, + 0x72ea02a500000000, 0x558f272400000000, 0x7d26397c00000000, + 0x5a431cfd00000000, 0x9348091e00000000, 0xb42d2c9f00000000, + 0x9c8432c700000000, 0xbbe1174600000000, 0xccd60f7700000000, + 0xebb32af600000000, 0xc31a34ae00000000, 0xe47f112f00000000, + 0xdf0f656b00000000, 0xf86a40ea00000000, 0xd0c35eb200000000, + 0xf7a67b3300000000, 0x8091630200000000, 0xa7f4468300000000, + 0x8f5d58db00000000, 0xa8387d5a00000000, 0x613368b900000000, + 0x46564d3800000000, 0x6eff536000000000, 0x499a76e100000000, + 0x3ead6ed000000000, 0x19c84b5100000000, 0x3161550900000000, + 0x1604708800000000, 0xe2700e1400000000, 0xc5152b9500000000, + 0xedbc35cd00000000, 0xcad9104c00000000, 0xbdee087d00000000, + 0x9a8b2dfc00000000, 0xb22233a400000000, 0x9547162500000000, + 0x5c4c03c600000000, 0x7b29264700000000, 0x5380381f00000000, + 0x74e51d9e00000000, 0x03d205af00000000, 0x24b7202e00000000, + 0x0c1e3e7600000000, 0x2b7b1bf700000000, 0xa5f1b39500000000, + 0x8294961400000000, 0xaa3d884c00000000, 0x8d58adcd00000000, + 0xfa6fb5fc00000000, 0xdd0a907d00000000, 0xf5a38e2500000000, + 0xd2c6aba400000000, 0x1bcdbe4700000000, 0x3ca89bc600000000, + 0x1401859e00000000, 0x3364a01f00000000, 0x4453b82e00000000, + 0x63369daf00000000, 0x4b9f83f700000000, 0x6cfaa67600000000, + 0x988ed8ea00000000, 0xbfebfd6b00000000, 0x9742e33300000000, + 0xb027c6b200000000, 0xc710de8300000000, 0xe075fb0200000000, + 0xc8dce55a00000000, 0xefb9c0db00000000, 0x26b2d53800000000, + 0x01d7f0b900000000, 0x297eeee100000000, 0x0e1bcb6000000000, + 0x792cd35100000000, 0x5e49f6d000000000, 0x76e0e88800000000, + 0x5185cd0900000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x9ba54c6f, 0xec3b9e9f, 0x779ed2f0, 0x03063b7f, + 0x98a37710, 0xef3da5e0, 0x7498e98f, 0x060c76fe, 0x9da93a91, + 0xea37e861, 0x7192a40e, 0x050a4d81, 0x9eaf01ee, 0xe931d31e, + 0x72949f71, 0x0c18edfc, 0x97bda193, 0xe0237363, 0x7b863f0c, + 0x0f1ed683, 0x94bb9aec, 0xe325481c, 0x78800473, 0x0a149b02, + 0x91b1d76d, 0xe62f059d, 0x7d8a49f2, 0x0912a07d, 0x92b7ec12, + 0xe5293ee2, 0x7e8c728d, 0x1831dbf8, 0x83949797, 0xf40a4567, + 0x6faf0908, 0x1b37e087, 0x8092ace8, 0xf70c7e18, 0x6ca93277, + 0x1e3dad06, 0x8598e169, 0xf2063399, 0x69a37ff6, 0x1d3b9679, + 0x869eda16, 0xf10008e6, 0x6aa54489, 0x14293604, 0x8f8c7a6b, + 0xf812a89b, 0x63b7e4f4, 0x172f0d7b, 0x8c8a4114, 0xfb1493e4, + 0x60b1df8b, 0x122540fa, 0x89800c95, 0xfe1ede65, 0x65bb920a, + 0x11237b85, 0x8a8637ea, 0xfd18e51a, 0x66bda975, 0x3063b7f0, + 0xabc6fb9f, 0xdc58296f, 0x47fd6500, 0x33658c8f, 0xa8c0c0e0, + 0xdf5e1210, 0x44fb5e7f, 0x366fc10e, 0xadca8d61, 0xda545f91, + 0x41f113fe, 0x3569fa71, 0xaeccb61e, 0xd95264ee, 0x42f72881, + 0x3c7b5a0c, 0xa7de1663, 0xd040c493, 0x4be588fc, 0x3f7d6173, + 0xa4d82d1c, 0xd346ffec, 0x48e3b383, 0x3a772cf2, 0xa1d2609d, + 0xd64cb26d, 0x4de9fe02, 0x3971178d, 0xa2d45be2, 0xd54a8912, + 0x4eefc57d, 0x28526c08, 0xb3f72067, 0xc469f297, 0x5fccbef8, + 0x2b545777, 0xb0f11b18, 0xc76fc9e8, 0x5cca8587, 0x2e5e1af6, + 0xb5fb5699, 0xc2658469, 0x59c0c806, 0x2d582189, 0xb6fd6de6, + 0xc163bf16, 0x5ac6f379, 0x244a81f4, 0xbfefcd9b, 0xc8711f6b, + 0x53d45304, 0x274cba8b, 0xbce9f6e4, 0xcb772414, 0x50d2687b, + 0x2246f70a, 0xb9e3bb65, 0xce7d6995, 0x55d825fa, 0x2140cc75, + 0xbae5801a, 0xcd7b52ea, 0x56de1e85, 0x60c76fe0, 0xfb62238f, + 0x8cfcf17f, 0x1759bd10, 0x63c1549f, 0xf86418f0, 0x8ffaca00, + 0x145f866f, 0x66cb191e, 0xfd6e5571, 0x8af08781, 0x1155cbee, + 0x65cd2261, 0xfe686e0e, 0x89f6bcfe, 0x1253f091, 0x6cdf821c, + 0xf77ace73, 0x80e41c83, 0x1b4150ec, 0x6fd9b963, 0xf47cf50c, + 0x83e227fc, 0x18476b93, 0x6ad3f4e2, 0xf176b88d, 0x86e86a7d, + 0x1d4d2612, 0x69d5cf9d, 0xf27083f2, 0x85ee5102, 0x1e4b1d6d, + 0x78f6b418, 0xe353f877, 0x94cd2a87, 0x0f6866e8, 0x7bf08f67, + 0xe055c308, 0x97cb11f8, 0x0c6e5d97, 0x7efac2e6, 0xe55f8e89, + 0x92c15c79, 0x09641016, 0x7dfcf999, 0xe659b5f6, 0x91c76706, + 0x0a622b69, 0x74ee59e4, 0xef4b158b, 0x98d5c77b, 0x03708b14, + 0x77e8629b, 0xec4d2ef4, 0x9bd3fc04, 0x0076b06b, 0x72e22f1a, + 0xe9476375, 0x9ed9b185, 0x057cfdea, 0x71e41465, 0xea41580a, + 0x9ddf8afa, 0x067ac695, 0x50a4d810, 0xcb01947f, 0xbc9f468f, + 0x273a0ae0, 0x53a2e36f, 0xc807af00, 0xbf997df0, 0x243c319f, + 0x56a8aeee, 0xcd0de281, 0xba933071, 0x21367c1e, 0x55ae9591, + 0xce0bd9fe, 0xb9950b0e, 0x22304761, 0x5cbc35ec, 0xc7197983, + 0xb087ab73, 0x2b22e71c, 0x5fba0e93, 0xc41f42fc, 0xb381900c, + 0x2824dc63, 0x5ab04312, 0xc1150f7d, 0xb68bdd8d, 0x2d2e91e2, + 0x59b6786d, 0xc2133402, 0xb58de6f2, 0x2e28aa9d, 0x489503e8, + 0xd3304f87, 0xa4ae9d77, 0x3f0bd118, 0x4b933897, 0xd03674f8, + 0xa7a8a608, 0x3c0dea67, 0x4e997516, 0xd53c3979, 0xa2a2eb89, + 0x3907a7e6, 0x4d9f4e69, 0xd63a0206, 0xa1a4d0f6, 0x3a019c99, + 0x448dee14, 0xdf28a27b, 0xa8b6708b, 0x33133ce4, 0x478bd56b, + 0xdc2e9904, 0xabb04bf4, 0x3015079b, 0x428198ea, 0xd924d485, + 0xaeba0675, 0x351f4a1a, 0x4187a395, 0xda22effa, 0xadbc3d0a, + 0x36197165}, + {0x00000000, 0xc18edfc0, 0x586cb9c1, 0x99e26601, 0xb0d97382, + 0x7157ac42, 0xe8b5ca43, 0x293b1583, 0xbac3e145, 0x7b4d3e85, + 0xe2af5884, 0x23218744, 0x0a1a92c7, 0xcb944d07, 0x52762b06, + 0x93f8f4c6, 0xaef6c4cb, 0x6f781b0b, 0xf69a7d0a, 0x3714a2ca, + 0x1e2fb749, 0xdfa16889, 0x46430e88, 0x87cdd148, 0x1435258e, + 0xd5bbfa4e, 0x4c599c4f, 0x8dd7438f, 0xa4ec560c, 0x656289cc, + 0xfc80efcd, 0x3d0e300d, 0x869c8fd7, 0x47125017, 0xdef03616, + 0x1f7ee9d6, 0x3645fc55, 0xf7cb2395, 0x6e294594, 0xafa79a54, + 0x3c5f6e92, 0xfdd1b152, 0x6433d753, 0xa5bd0893, 0x8c861d10, + 0x4d08c2d0, 0xd4eaa4d1, 0x15647b11, 0x286a4b1c, 0xe9e494dc, + 0x7006f2dd, 0xb1882d1d, 0x98b3389e, 0x593de75e, 0xc0df815f, + 0x01515e9f, 0x92a9aa59, 0x53277599, 0xcac51398, 0x0b4bcc58, + 0x2270d9db, 0xe3fe061b, 0x7a1c601a, 0xbb92bfda, 0xd64819ef, + 0x17c6c62f, 0x8e24a02e, 0x4faa7fee, 0x66916a6d, 0xa71fb5ad, + 0x3efdd3ac, 0xff730c6c, 0x6c8bf8aa, 0xad05276a, 0x34e7416b, + 0xf5699eab, 0xdc528b28, 0x1ddc54e8, 0x843e32e9, 0x45b0ed29, + 0x78bedd24, 0xb93002e4, 0x20d264e5, 0xe15cbb25, 0xc867aea6, + 0x09e97166, 0x900b1767, 0x5185c8a7, 0xc27d3c61, 0x03f3e3a1, + 0x9a1185a0, 0x5b9f5a60, 0x72a44fe3, 0xb32a9023, 0x2ac8f622, + 0xeb4629e2, 0x50d49638, 0x915a49f8, 0x08b82ff9, 0xc936f039, + 0xe00de5ba, 0x21833a7a, 0xb8615c7b, 0x79ef83bb, 0xea17777d, + 0x2b99a8bd, 0xb27bcebc, 0x73f5117c, 0x5ace04ff, 0x9b40db3f, + 0x02a2bd3e, 0xc32c62fe, 0xfe2252f3, 0x3fac8d33, 0xa64eeb32, + 0x67c034f2, 0x4efb2171, 0x8f75feb1, 0x169798b0, 0xd7194770, + 0x44e1b3b6, 0x856f6c76, 0x1c8d0a77, 0xdd03d5b7, 0xf438c034, + 0x35b61ff4, 0xac5479f5, 0x6ddaa635, 0x77e1359f, 0xb66fea5f, + 0x2f8d8c5e, 0xee03539e, 0xc738461d, 0x06b699dd, 0x9f54ffdc, + 0x5eda201c, 0xcd22d4da, 0x0cac0b1a, 0x954e6d1b, 0x54c0b2db, + 0x7dfba758, 0xbc757898, 0x25971e99, 0xe419c159, 0xd917f154, + 0x18992e94, 0x817b4895, 0x40f59755, 0x69ce82d6, 0xa8405d16, + 0x31a23b17, 0xf02ce4d7, 0x63d41011, 0xa25acfd1, 0x3bb8a9d0, + 0xfa367610, 0xd30d6393, 0x1283bc53, 0x8b61da52, 0x4aef0592, + 0xf17dba48, 0x30f36588, 0xa9110389, 0x689fdc49, 0x41a4c9ca, + 0x802a160a, 0x19c8700b, 0xd846afcb, 0x4bbe5b0d, 0x8a3084cd, + 0x13d2e2cc, 0xd25c3d0c, 0xfb67288f, 0x3ae9f74f, 0xa30b914e, + 0x62854e8e, 0x5f8b7e83, 0x9e05a143, 0x07e7c742, 0xc6691882, + 0xef520d01, 0x2edcd2c1, 0xb73eb4c0, 0x76b06b00, 0xe5489fc6, + 0x24c64006, 0xbd242607, 0x7caaf9c7, 0x5591ec44, 0x941f3384, + 0x0dfd5585, 0xcc738a45, 0xa1a92c70, 0x6027f3b0, 0xf9c595b1, + 0x384b4a71, 0x11705ff2, 0xd0fe8032, 0x491ce633, 0x889239f3, + 0x1b6acd35, 0xdae412f5, 0x430674f4, 0x8288ab34, 0xabb3beb7, + 0x6a3d6177, 0xf3df0776, 0x3251d8b6, 0x0f5fe8bb, 0xced1377b, + 0x5733517a, 0x96bd8eba, 0xbf869b39, 0x7e0844f9, 0xe7ea22f8, + 0x2664fd38, 0xb59c09fe, 0x7412d63e, 0xedf0b03f, 0x2c7e6fff, + 0x05457a7c, 0xc4cba5bc, 0x5d29c3bd, 0x9ca71c7d, 0x2735a3a7, + 0xe6bb7c67, 0x7f591a66, 0xbed7c5a6, 0x97ecd025, 0x56620fe5, + 0xcf8069e4, 0x0e0eb624, 0x9df642e2, 0x5c789d22, 0xc59afb23, + 0x041424e3, 0x2d2f3160, 0xeca1eea0, 0x754388a1, 0xb4cd5761, + 0x89c3676c, 0x484db8ac, 0xd1afdead, 0x1021016d, 0x391a14ee, + 0xf894cb2e, 0x6176ad2f, 0xa0f872ef, 0x33008629, 0xf28e59e9, + 0x6b6c3fe8, 0xaae2e028, 0x83d9f5ab, 0x42572a6b, 0xdbb54c6a, + 0x1a3b93aa}, + {0x00000000, 0xefc26b3e, 0x04f5d03d, 0xeb37bb03, 0x09eba07a, + 0xe629cb44, 0x0d1e7047, 0xe2dc1b79, 0x13d740f4, 0xfc152bca, + 0x172290c9, 0xf8e0fbf7, 0x1a3ce08e, 0xf5fe8bb0, 0x1ec930b3, + 0xf10b5b8d, 0x27ae81e8, 0xc86cead6, 0x235b51d5, 0xcc993aeb, + 0x2e452192, 0xc1874aac, 0x2ab0f1af, 0xc5729a91, 0x3479c11c, + 0xdbbbaa22, 0x308c1121, 0xdf4e7a1f, 0x3d926166, 0xd2500a58, + 0x3967b15b, 0xd6a5da65, 0x4f5d03d0, 0xa09f68ee, 0x4ba8d3ed, + 0xa46ab8d3, 0x46b6a3aa, 0xa974c894, 0x42437397, 0xad8118a9, + 0x5c8a4324, 0xb348281a, 0x587f9319, 0xb7bdf827, 0x5561e35e, + 0xbaa38860, 0x51943363, 0xbe56585d, 0x68f38238, 0x8731e906, + 0x6c065205, 0x83c4393b, 0x61182242, 0x8eda497c, 0x65edf27f, + 0x8a2f9941, 0x7b24c2cc, 0x94e6a9f2, 0x7fd112f1, 0x901379cf, + 0x72cf62b6, 0x9d0d0988, 0x763ab28b, 0x99f8d9b5, 0x9eba07a0, + 0x71786c9e, 0x9a4fd79d, 0x758dbca3, 0x9751a7da, 0x7893cce4, + 0x93a477e7, 0x7c661cd9, 0x8d6d4754, 0x62af2c6a, 0x89989769, + 0x665afc57, 0x8486e72e, 0x6b448c10, 0x80733713, 0x6fb15c2d, + 0xb9148648, 0x56d6ed76, 0xbde15675, 0x52233d4b, 0xb0ff2632, + 0x5f3d4d0c, 0xb40af60f, 0x5bc89d31, 0xaac3c6bc, 0x4501ad82, + 0xae361681, 0x41f47dbf, 0xa32866c6, 0x4cea0df8, 0xa7ddb6fb, + 0x481fddc5, 0xd1e70470, 0x3e256f4e, 0xd512d44d, 0x3ad0bf73, + 0xd80ca40a, 0x37cecf34, 0xdcf97437, 0x333b1f09, 0xc2304484, + 0x2df22fba, 0xc6c594b9, 0x2907ff87, 0xcbdbe4fe, 0x24198fc0, + 0xcf2e34c3, 0x20ec5ffd, 0xf6498598, 0x198beea6, 0xf2bc55a5, + 0x1d7e3e9b, 0xffa225e2, 0x10604edc, 0xfb57f5df, 0x14959ee1, + 0xe59ec56c, 0x0a5cae52, 0xe16b1551, 0x0ea97e6f, 0xec756516, + 0x03b70e28, 0xe880b52b, 0x0742de15, 0xe6050901, 0x09c7623f, + 0xe2f0d93c, 0x0d32b202, 0xefeea97b, 0x002cc245, 0xeb1b7946, + 0x04d91278, 0xf5d249f5, 0x1a1022cb, 0xf12799c8, 0x1ee5f2f6, + 0xfc39e98f, 0x13fb82b1, 0xf8cc39b2, 0x170e528c, 0xc1ab88e9, + 0x2e69e3d7, 0xc55e58d4, 0x2a9c33ea, 0xc8402893, 0x278243ad, + 0xccb5f8ae, 0x23779390, 0xd27cc81d, 0x3dbea323, 0xd6891820, + 0x394b731e, 0xdb976867, 0x34550359, 0xdf62b85a, 0x30a0d364, + 0xa9580ad1, 0x469a61ef, 0xadaddaec, 0x426fb1d2, 0xa0b3aaab, + 0x4f71c195, 0xa4467a96, 0x4b8411a8, 0xba8f4a25, 0x554d211b, + 0xbe7a9a18, 0x51b8f126, 0xb364ea5f, 0x5ca68161, 0xb7913a62, + 0x5853515c, 0x8ef68b39, 0x6134e007, 0x8a035b04, 0x65c1303a, + 0x871d2b43, 0x68df407d, 0x83e8fb7e, 0x6c2a9040, 0x9d21cbcd, + 0x72e3a0f3, 0x99d41bf0, 0x761670ce, 0x94ca6bb7, 0x7b080089, + 0x903fbb8a, 0x7ffdd0b4, 0x78bf0ea1, 0x977d659f, 0x7c4ade9c, + 0x9388b5a2, 0x7154aedb, 0x9e96c5e5, 0x75a17ee6, 0x9a6315d8, + 0x6b684e55, 0x84aa256b, 0x6f9d9e68, 0x805ff556, 0x6283ee2f, + 0x8d418511, 0x66763e12, 0x89b4552c, 0x5f118f49, 0xb0d3e477, + 0x5be45f74, 0xb426344a, 0x56fa2f33, 0xb938440d, 0x520fff0e, + 0xbdcd9430, 0x4cc6cfbd, 0xa304a483, 0x48331f80, 0xa7f174be, + 0x452d6fc7, 0xaaef04f9, 0x41d8bffa, 0xae1ad4c4, 0x37e20d71, + 0xd820664f, 0x3317dd4c, 0xdcd5b672, 0x3e09ad0b, 0xd1cbc635, + 0x3afc7d36, 0xd53e1608, 0x24354d85, 0xcbf726bb, 0x20c09db8, + 0xcf02f686, 0x2ddeedff, 0xc21c86c1, 0x292b3dc2, 0xc6e956fc, + 0x104c8c99, 0xff8ee7a7, 0x14b95ca4, 0xfb7b379a, 0x19a72ce3, + 0xf66547dd, 0x1d52fcde, 0xf29097e0, 0x039bcc6d, 0xec59a753, + 0x076e1c50, 0xe8ac776e, 0x0a706c17, 0xe5b20729, 0x0e85bc2a, + 0xe147d714}, + {0x00000000, 0x177b1443, 0x2ef62886, 0x398d3cc5, 0x5dec510c, + 0x4a97454f, 0x731a798a, 0x64616dc9, 0xbbd8a218, 0xaca3b65b, + 0x952e8a9e, 0x82559edd, 0xe634f314, 0xf14fe757, 0xc8c2db92, + 0xdfb9cfd1, 0xacc04271, 0xbbbb5632, 0x82366af7, 0x954d7eb4, + 0xf12c137d, 0xe657073e, 0xdfda3bfb, 0xc8a12fb8, 0x1718e069, + 0x0063f42a, 0x39eec8ef, 0x2e95dcac, 0x4af4b165, 0x5d8fa526, + 0x640299e3, 0x73798da0, 0x82f182a3, 0x958a96e0, 0xac07aa25, + 0xbb7cbe66, 0xdf1dd3af, 0xc866c7ec, 0xf1ebfb29, 0xe690ef6a, + 0x392920bb, 0x2e5234f8, 0x17df083d, 0x00a41c7e, 0x64c571b7, + 0x73be65f4, 0x4a335931, 0x5d484d72, 0x2e31c0d2, 0x394ad491, + 0x00c7e854, 0x17bcfc17, 0x73dd91de, 0x64a6859d, 0x5d2bb958, + 0x4a50ad1b, 0x95e962ca, 0x82927689, 0xbb1f4a4c, 0xac645e0f, + 0xc80533c6, 0xdf7e2785, 0xe6f31b40, 0xf1880f03, 0xde920307, + 0xc9e91744, 0xf0642b81, 0xe71f3fc2, 0x837e520b, 0x94054648, + 0xad887a8d, 0xbaf36ece, 0x654aa11f, 0x7231b55c, 0x4bbc8999, + 0x5cc79dda, 0x38a6f013, 0x2fdde450, 0x1650d895, 0x012bccd6, + 0x72524176, 0x65295535, 0x5ca469f0, 0x4bdf7db3, 0x2fbe107a, + 0x38c50439, 0x014838fc, 0x16332cbf, 0xc98ae36e, 0xdef1f72d, + 0xe77ccbe8, 0xf007dfab, 0x9466b262, 0x831da621, 0xba909ae4, + 0xadeb8ea7, 0x5c6381a4, 0x4b1895e7, 0x7295a922, 0x65eebd61, + 0x018fd0a8, 0x16f4c4eb, 0x2f79f82e, 0x3802ec6d, 0xe7bb23bc, + 0xf0c037ff, 0xc94d0b3a, 0xde361f79, 0xba5772b0, 0xad2c66f3, + 0x94a15a36, 0x83da4e75, 0xf0a3c3d5, 0xe7d8d796, 0xde55eb53, + 0xc92eff10, 0xad4f92d9, 0xba34869a, 0x83b9ba5f, 0x94c2ae1c, + 0x4b7b61cd, 0x5c00758e, 0x658d494b, 0x72f65d08, 0x169730c1, + 0x01ec2482, 0x38611847, 0x2f1a0c04, 0x6655004f, 0x712e140c, + 0x48a328c9, 0x5fd83c8a, 0x3bb95143, 0x2cc24500, 0x154f79c5, + 0x02346d86, 0xdd8da257, 0xcaf6b614, 0xf37b8ad1, 0xe4009e92, + 0x8061f35b, 0x971ae718, 0xae97dbdd, 0xb9eccf9e, 0xca95423e, + 0xddee567d, 0xe4636ab8, 0xf3187efb, 0x97791332, 0x80020771, + 0xb98f3bb4, 0xaef42ff7, 0x714de026, 0x6636f465, 0x5fbbc8a0, + 0x48c0dce3, 0x2ca1b12a, 0x3bdaa569, 0x025799ac, 0x152c8def, + 0xe4a482ec, 0xf3df96af, 0xca52aa6a, 0xdd29be29, 0xb948d3e0, + 0xae33c7a3, 0x97befb66, 0x80c5ef25, 0x5f7c20f4, 0x480734b7, + 0x718a0872, 0x66f11c31, 0x029071f8, 0x15eb65bb, 0x2c66597e, + 0x3b1d4d3d, 0x4864c09d, 0x5f1fd4de, 0x6692e81b, 0x71e9fc58, + 0x15889191, 0x02f385d2, 0x3b7eb917, 0x2c05ad54, 0xf3bc6285, + 0xe4c776c6, 0xdd4a4a03, 0xca315e40, 0xae503389, 0xb92b27ca, + 0x80a61b0f, 0x97dd0f4c, 0xb8c70348, 0xafbc170b, 0x96312bce, + 0x814a3f8d, 0xe52b5244, 0xf2504607, 0xcbdd7ac2, 0xdca66e81, + 0x031fa150, 0x1464b513, 0x2de989d6, 0x3a929d95, 0x5ef3f05c, + 0x4988e41f, 0x7005d8da, 0x677ecc99, 0x14074139, 0x037c557a, + 0x3af169bf, 0x2d8a7dfc, 0x49eb1035, 0x5e900476, 0x671d38b3, + 0x70662cf0, 0xafdfe321, 0xb8a4f762, 0x8129cba7, 0x9652dfe4, + 0xf233b22d, 0xe548a66e, 0xdcc59aab, 0xcbbe8ee8, 0x3a3681eb, + 0x2d4d95a8, 0x14c0a96d, 0x03bbbd2e, 0x67dad0e7, 0x70a1c4a4, + 0x492cf861, 0x5e57ec22, 0x81ee23f3, 0x969537b0, 0xaf180b75, + 0xb8631f36, 0xdc0272ff, 0xcb7966bc, 0xf2f45a79, 0xe58f4e3a, + 0x96f6c39a, 0x818dd7d9, 0xb800eb1c, 0xaf7bff5f, 0xcb1a9296, + 0xdc6186d5, 0xe5ecba10, 0xf297ae53, 0x2d2e6182, 0x3a5575c1, + 0x03d84904, 0x14a35d47, 0x70c2308e, 0x67b924cd, 0x5e341808, + 0x494f0c4b}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x43147b17, 0x8628f62e, 0xc53c8d39, 0x0c51ec5d, + 0x4f45974a, 0x8a791a73, 0xc96d6164, 0x18a2d8bb, 0x5bb6a3ac, + 0x9e8a2e95, 0xdd9e5582, 0x14f334e6, 0x57e74ff1, 0x92dbc2c8, + 0xd1cfb9df, 0x7142c0ac, 0x3256bbbb, 0xf76a3682, 0xb47e4d95, + 0x7d132cf1, 0x3e0757e6, 0xfb3bdadf, 0xb82fa1c8, 0x69e01817, + 0x2af46300, 0xefc8ee39, 0xacdc952e, 0x65b1f44a, 0x26a58f5d, + 0xe3990264, 0xa08d7973, 0xa382f182, 0xe0968a95, 0x25aa07ac, + 0x66be7cbb, 0xafd31ddf, 0xecc766c8, 0x29fbebf1, 0x6aef90e6, + 0xbb202939, 0xf834522e, 0x3d08df17, 0x7e1ca400, 0xb771c564, + 0xf465be73, 0x3159334a, 0x724d485d, 0xd2c0312e, 0x91d44a39, + 0x54e8c700, 0x17fcbc17, 0xde91dd73, 0x9d85a664, 0x58b92b5d, + 0x1bad504a, 0xca62e995, 0x89769282, 0x4c4a1fbb, 0x0f5e64ac, + 0xc63305c8, 0x85277edf, 0x401bf3e6, 0x030f88f1, 0x070392de, + 0x4417e9c9, 0x812b64f0, 0xc23f1fe7, 0x0b527e83, 0x48460594, + 0x8d7a88ad, 0xce6ef3ba, 0x1fa14a65, 0x5cb53172, 0x9989bc4b, + 0xda9dc75c, 0x13f0a638, 0x50e4dd2f, 0x95d85016, 0xd6cc2b01, + 0x76415272, 0x35552965, 0xf069a45c, 0xb37ddf4b, 0x7a10be2f, + 0x3904c538, 0xfc384801, 0xbf2c3316, 0x6ee38ac9, 0x2df7f1de, + 0xe8cb7ce7, 0xabdf07f0, 0x62b26694, 0x21a61d83, 0xe49a90ba, + 0xa78eebad, 0xa481635c, 0xe795184b, 0x22a99572, 0x61bdee65, + 0xa8d08f01, 0xebc4f416, 0x2ef8792f, 0x6dec0238, 0xbc23bbe7, + 0xff37c0f0, 0x3a0b4dc9, 0x791f36de, 0xb07257ba, 0xf3662cad, + 0x365aa194, 0x754eda83, 0xd5c3a3f0, 0x96d7d8e7, 0x53eb55de, + 0x10ff2ec9, 0xd9924fad, 0x9a8634ba, 0x5fbab983, 0x1caec294, + 0xcd617b4b, 0x8e75005c, 0x4b498d65, 0x085df672, 0xc1309716, + 0x8224ec01, 0x47186138, 0x040c1a2f, 0x4f005566, 0x0c142e71, + 0xc928a348, 0x8a3cd85f, 0x4351b93b, 0x0045c22c, 0xc5794f15, + 0x866d3402, 0x57a28ddd, 0x14b6f6ca, 0xd18a7bf3, 0x929e00e4, + 0x5bf36180, 0x18e71a97, 0xdddb97ae, 0x9ecfecb9, 0x3e4295ca, + 0x7d56eedd, 0xb86a63e4, 0xfb7e18f3, 0x32137997, 0x71070280, + 0xb43b8fb9, 0xf72ff4ae, 0x26e04d71, 0x65f43666, 0xa0c8bb5f, + 0xe3dcc048, 0x2ab1a12c, 0x69a5da3b, 0xac995702, 0xef8d2c15, + 0xec82a4e4, 0xaf96dff3, 0x6aaa52ca, 0x29be29dd, 0xe0d348b9, + 0xa3c733ae, 0x66fbbe97, 0x25efc580, 0xf4207c5f, 0xb7340748, + 0x72088a71, 0x311cf166, 0xf8719002, 0xbb65eb15, 0x7e59662c, + 0x3d4d1d3b, 0x9dc06448, 0xded41f5f, 0x1be89266, 0x58fce971, + 0x91918815, 0xd285f302, 0x17b97e3b, 0x54ad052c, 0x8562bcf3, + 0xc676c7e4, 0x034a4add, 0x405e31ca, 0x893350ae, 0xca272bb9, + 0x0f1ba680, 0x4c0fdd97, 0x4803c7b8, 0x0b17bcaf, 0xce2b3196, + 0x8d3f4a81, 0x44522be5, 0x074650f2, 0xc27addcb, 0x816ea6dc, + 0x50a11f03, 0x13b56414, 0xd689e92d, 0x959d923a, 0x5cf0f35e, + 0x1fe48849, 0xdad80570, 0x99cc7e67, 0x39410714, 0x7a557c03, + 0xbf69f13a, 0xfc7d8a2d, 0x3510eb49, 0x7604905e, 0xb3381d67, + 0xf02c6670, 0x21e3dfaf, 0x62f7a4b8, 0xa7cb2981, 0xe4df5296, + 0x2db233f2, 0x6ea648e5, 0xab9ac5dc, 0xe88ebecb, 0xeb81363a, + 0xa8954d2d, 0x6da9c014, 0x2ebdbb03, 0xe7d0da67, 0xa4c4a170, + 0x61f82c49, 0x22ec575e, 0xf323ee81, 0xb0379596, 0x750b18af, + 0x361f63b8, 0xff7202dc, 0xbc6679cb, 0x795af4f2, 0x3a4e8fe5, + 0x9ac3f696, 0xd9d78d81, 0x1ceb00b8, 0x5fff7baf, 0x96921acb, + 0xd58661dc, 0x10baece5, 0x53ae97f2, 0x82612e2d, 0xc175553a, + 0x0449d803, 0x475da314, 0x8e30c270, 0xcd24b967, 0x0818345e, + 0x4b0c4f49}, + {0x00000000, 0x3e6bc2ef, 0x3dd0f504, 0x03bb37eb, 0x7aa0eb09, + 0x44cb29e6, 0x47701e0d, 0x791bdce2, 0xf440d713, 0xca2b15fc, + 0xc9902217, 0xf7fbe0f8, 0x8ee03c1a, 0xb08bfef5, 0xb330c91e, + 0x8d5b0bf1, 0xe881ae27, 0xd6ea6cc8, 0xd5515b23, 0xeb3a99cc, + 0x9221452e, 0xac4a87c1, 0xaff1b02a, 0x919a72c5, 0x1cc17934, + 0x22aabbdb, 0x21118c30, 0x1f7a4edf, 0x6661923d, 0x580a50d2, + 0x5bb16739, 0x65daa5d6, 0xd0035d4f, 0xee689fa0, 0xedd3a84b, + 0xd3b86aa4, 0xaaa3b646, 0x94c874a9, 0x97734342, 0xa91881ad, + 0x24438a5c, 0x1a2848b3, 0x19937f58, 0x27f8bdb7, 0x5ee36155, + 0x6088a3ba, 0x63339451, 0x5d5856be, 0x3882f368, 0x06e93187, + 0x0552066c, 0x3b39c483, 0x42221861, 0x7c49da8e, 0x7ff2ed65, + 0x41992f8a, 0xccc2247b, 0xf2a9e694, 0xf112d17f, 0xcf791390, + 0xb662cf72, 0x88090d9d, 0x8bb23a76, 0xb5d9f899, 0xa007ba9e, + 0x9e6c7871, 0x9dd74f9a, 0xa3bc8d75, 0xdaa75197, 0xe4cc9378, + 0xe777a493, 0xd91c667c, 0x54476d8d, 0x6a2caf62, 0x69979889, + 0x57fc5a66, 0x2ee78684, 0x108c446b, 0x13377380, 0x2d5cb16f, + 0x488614b9, 0x76edd656, 0x7556e1bd, 0x4b3d2352, 0x3226ffb0, + 0x0c4d3d5f, 0x0ff60ab4, 0x319dc85b, 0xbcc6c3aa, 0x82ad0145, + 0x811636ae, 0xbf7df441, 0xc66628a3, 0xf80dea4c, 0xfbb6dda7, + 0xc5dd1f48, 0x7004e7d1, 0x4e6f253e, 0x4dd412d5, 0x73bfd03a, + 0x0aa40cd8, 0x34cfce37, 0x3774f9dc, 0x091f3b33, 0x844430c2, + 0xba2ff22d, 0xb994c5c6, 0x87ff0729, 0xfee4dbcb, 0xc08f1924, + 0xc3342ecf, 0xfd5fec20, 0x988549f6, 0xa6ee8b19, 0xa555bcf2, + 0x9b3e7e1d, 0xe225a2ff, 0xdc4e6010, 0xdff557fb, 0xe19e9514, + 0x6cc59ee5, 0x52ae5c0a, 0x51156be1, 0x6f7ea90e, 0x166575ec, + 0x280eb703, 0x2bb580e8, 0x15de4207, 0x010905e6, 0x3f62c709, + 0x3cd9f0e2, 0x02b2320d, 0x7ba9eeef, 0x45c22c00, 0x46791beb, + 0x7812d904, 0xf549d2f5, 0xcb22101a, 0xc89927f1, 0xf6f2e51e, + 0x8fe939fc, 0xb182fb13, 0xb239ccf8, 0x8c520e17, 0xe988abc1, + 0xd7e3692e, 0xd4585ec5, 0xea339c2a, 0x932840c8, 0xad438227, + 0xaef8b5cc, 0x90937723, 0x1dc87cd2, 0x23a3be3d, 0x201889d6, + 0x1e734b39, 0x676897db, 0x59035534, 0x5ab862df, 0x64d3a030, + 0xd10a58a9, 0xef619a46, 0xecdaadad, 0xd2b16f42, 0xabaab3a0, + 0x95c1714f, 0x967a46a4, 0xa811844b, 0x254a8fba, 0x1b214d55, + 0x189a7abe, 0x26f1b851, 0x5fea64b3, 0x6181a65c, 0x623a91b7, + 0x5c515358, 0x398bf68e, 0x07e03461, 0x045b038a, 0x3a30c165, + 0x432b1d87, 0x7d40df68, 0x7efbe883, 0x40902a6c, 0xcdcb219d, + 0xf3a0e372, 0xf01bd499, 0xce701676, 0xb76bca94, 0x8900087b, + 0x8abb3f90, 0xb4d0fd7f, 0xa10ebf78, 0x9f657d97, 0x9cde4a7c, + 0xa2b58893, 0xdbae5471, 0xe5c5969e, 0xe67ea175, 0xd815639a, + 0x554e686b, 0x6b25aa84, 0x689e9d6f, 0x56f55f80, 0x2fee8362, + 0x1185418d, 0x123e7666, 0x2c55b489, 0x498f115f, 0x77e4d3b0, + 0x745fe45b, 0x4a3426b4, 0x332ffa56, 0x0d4438b9, 0x0eff0f52, + 0x3094cdbd, 0xbdcfc64c, 0x83a404a3, 0x801f3348, 0xbe74f1a7, + 0xc76f2d45, 0xf904efaa, 0xfabfd841, 0xc4d41aae, 0x710de237, + 0x4f6620d8, 0x4cdd1733, 0x72b6d5dc, 0x0bad093e, 0x35c6cbd1, + 0x367dfc3a, 0x08163ed5, 0x854d3524, 0xbb26f7cb, 0xb89dc020, + 0x86f602cf, 0xffedde2d, 0xc1861cc2, 0xc23d2b29, 0xfc56e9c6, + 0x998c4c10, 0xa7e78eff, 0xa45cb914, 0x9a377bfb, 0xe32ca719, + 0xdd4765f6, 0xdefc521d, 0xe09790f2, 0x6dcc9b03, 0x53a759ec, + 0x501c6e07, 0x6e77ace8, 0x176c700a, 0x2907b2e5, 0x2abc850e, + 0x14d747e1}, + {0x00000000, 0xc0df8ec1, 0xc1b96c58, 0x0166e299, 0x8273d9b0, + 0x42ac5771, 0x43cab5e8, 0x83153b29, 0x45e1c3ba, 0x853e4d7b, + 0x8458afe2, 0x44872123, 0xc7921a0a, 0x074d94cb, 0x062b7652, + 0xc6f4f893, 0xcbc4f6ae, 0x0b1b786f, 0x0a7d9af6, 0xcaa21437, + 0x49b72f1e, 0x8968a1df, 0x880e4346, 0x48d1cd87, 0x8e253514, + 0x4efabbd5, 0x4f9c594c, 0x8f43d78d, 0x0c56eca4, 0xcc896265, + 0xcdef80fc, 0x0d300e3d, 0xd78f9c86, 0x17501247, 0x1636f0de, + 0xd6e97e1f, 0x55fc4536, 0x9523cbf7, 0x9445296e, 0x549aa7af, + 0x926e5f3c, 0x52b1d1fd, 0x53d73364, 0x9308bda5, 0x101d868c, + 0xd0c2084d, 0xd1a4ead4, 0x117b6415, 0x1c4b6a28, 0xdc94e4e9, + 0xddf20670, 0x1d2d88b1, 0x9e38b398, 0x5ee73d59, 0x5f81dfc0, + 0x9f5e5101, 0x59aaa992, 0x99752753, 0x9813c5ca, 0x58cc4b0b, + 0xdbd97022, 0x1b06fee3, 0x1a601c7a, 0xdabf92bb, 0xef1948d6, + 0x2fc6c617, 0x2ea0248e, 0xee7faa4f, 0x6d6a9166, 0xadb51fa7, + 0xacd3fd3e, 0x6c0c73ff, 0xaaf88b6c, 0x6a2705ad, 0x6b41e734, + 0xab9e69f5, 0x288b52dc, 0xe854dc1d, 0xe9323e84, 0x29edb045, + 0x24ddbe78, 0xe40230b9, 0xe564d220, 0x25bb5ce1, 0xa6ae67c8, + 0x6671e909, 0x67170b90, 0xa7c88551, 0x613c7dc2, 0xa1e3f303, + 0xa085119a, 0x605a9f5b, 0xe34fa472, 0x23902ab3, 0x22f6c82a, + 0xe22946eb, 0x3896d450, 0xf8495a91, 0xf92fb808, 0x39f036c9, + 0xbae50de0, 0x7a3a8321, 0x7b5c61b8, 0xbb83ef79, 0x7d7717ea, + 0xbda8992b, 0xbcce7bb2, 0x7c11f573, 0xff04ce5a, 0x3fdb409b, + 0x3ebda202, 0xfe622cc3, 0xf35222fe, 0x338dac3f, 0x32eb4ea6, + 0xf234c067, 0x7121fb4e, 0xb1fe758f, 0xb0989716, 0x704719d7, + 0xb6b3e144, 0x766c6f85, 0x770a8d1c, 0xb7d503dd, 0x34c038f4, + 0xf41fb635, 0xf57954ac, 0x35a6da6d, 0x9f35e177, 0x5fea6fb6, + 0x5e8c8d2f, 0x9e5303ee, 0x1d4638c7, 0xdd99b606, 0xdcff549f, + 0x1c20da5e, 0xdad422cd, 0x1a0bac0c, 0x1b6d4e95, 0xdbb2c054, + 0x58a7fb7d, 0x987875bc, 0x991e9725, 0x59c119e4, 0x54f117d9, + 0x942e9918, 0x95487b81, 0x5597f540, 0xd682ce69, 0x165d40a8, + 0x173ba231, 0xd7e42cf0, 0x1110d463, 0xd1cf5aa2, 0xd0a9b83b, + 0x107636fa, 0x93630dd3, 0x53bc8312, 0x52da618b, 0x9205ef4a, + 0x48ba7df1, 0x8865f330, 0x890311a9, 0x49dc9f68, 0xcac9a441, + 0x0a162a80, 0x0b70c819, 0xcbaf46d8, 0x0d5bbe4b, 0xcd84308a, + 0xcce2d213, 0x0c3d5cd2, 0x8f2867fb, 0x4ff7e93a, 0x4e910ba3, + 0x8e4e8562, 0x837e8b5f, 0x43a1059e, 0x42c7e707, 0x821869c6, + 0x010d52ef, 0xc1d2dc2e, 0xc0b43eb7, 0x006bb076, 0xc69f48e5, + 0x0640c624, 0x072624bd, 0xc7f9aa7c, 0x44ec9155, 0x84331f94, + 0x8555fd0d, 0x458a73cc, 0x702ca9a1, 0xb0f32760, 0xb195c5f9, + 0x714a4b38, 0xf25f7011, 0x3280fed0, 0x33e61c49, 0xf3399288, + 0x35cd6a1b, 0xf512e4da, 0xf4740643, 0x34ab8882, 0xb7beb3ab, + 0x77613d6a, 0x7607dff3, 0xb6d85132, 0xbbe85f0f, 0x7b37d1ce, + 0x7a513357, 0xba8ebd96, 0x399b86bf, 0xf944087e, 0xf822eae7, + 0x38fd6426, 0xfe099cb5, 0x3ed61274, 0x3fb0f0ed, 0xff6f7e2c, + 0x7c7a4505, 0xbca5cbc4, 0xbdc3295d, 0x7d1ca79c, 0xa7a33527, + 0x677cbbe6, 0x661a597f, 0xa6c5d7be, 0x25d0ec97, 0xe50f6256, + 0xe46980cf, 0x24b60e0e, 0xe242f69d, 0x229d785c, 0x23fb9ac5, + 0xe3241404, 0x60312f2d, 0xa0eea1ec, 0xa1884375, 0x6157cdb4, + 0x6c67c389, 0xacb84d48, 0xaddeafd1, 0x6d012110, 0xee141a39, + 0x2ecb94f8, 0x2fad7661, 0xef72f8a0, 0x29860033, 0xe9598ef2, + 0xe83f6c6b, 0x28e0e2aa, 0xabf5d983, 0x6b2a5742, 0x6a4cb5db, + 0xaa933b1a}, + {0x00000000, 0x6f4ca59b, 0x9f9e3bec, 0xf0d29e77, 0x7f3b0603, + 0x1077a398, 0xe0a53def, 0x8fe99874, 0xfe760c06, 0x913aa99d, + 0x61e837ea, 0x0ea49271, 0x814d0a05, 0xee01af9e, 0x1ed331e9, + 0x719f9472, 0xfced180c, 0x93a1bd97, 0x637323e0, 0x0c3f867b, + 0x83d61e0f, 0xec9abb94, 0x1c4825e3, 0x73048078, 0x029b140a, + 0x6dd7b191, 0x9d052fe6, 0xf2498a7d, 0x7da01209, 0x12ecb792, + 0xe23e29e5, 0x8d728c7e, 0xf8db3118, 0x97979483, 0x67450af4, + 0x0809af6f, 0x87e0371b, 0xe8ac9280, 0x187e0cf7, 0x7732a96c, + 0x06ad3d1e, 0x69e19885, 0x993306f2, 0xf67fa369, 0x79963b1d, + 0x16da9e86, 0xe60800f1, 0x8944a56a, 0x04362914, 0x6b7a8c8f, + 0x9ba812f8, 0xf4e4b763, 0x7b0d2f17, 0x14418a8c, 0xe49314fb, + 0x8bdfb160, 0xfa402512, 0x950c8089, 0x65de1efe, 0x0a92bb65, + 0x857b2311, 0xea37868a, 0x1ae518fd, 0x75a9bd66, 0xf0b76330, + 0x9ffbc6ab, 0x6f2958dc, 0x0065fd47, 0x8f8c6533, 0xe0c0c0a8, + 0x10125edf, 0x7f5efb44, 0x0ec16f36, 0x618dcaad, 0x915f54da, + 0xfe13f141, 0x71fa6935, 0x1eb6ccae, 0xee6452d9, 0x8128f742, + 0x0c5a7b3c, 0x6316dea7, 0x93c440d0, 0xfc88e54b, 0x73617d3f, + 0x1c2dd8a4, 0xecff46d3, 0x83b3e348, 0xf22c773a, 0x9d60d2a1, + 0x6db24cd6, 0x02fee94d, 0x8d177139, 0xe25bd4a2, 0x12894ad5, + 0x7dc5ef4e, 0x086c5228, 0x6720f7b3, 0x97f269c4, 0xf8becc5f, + 0x7757542b, 0x181bf1b0, 0xe8c96fc7, 0x8785ca5c, 0xf61a5e2e, + 0x9956fbb5, 0x698465c2, 0x06c8c059, 0x8921582d, 0xe66dfdb6, + 0x16bf63c1, 0x79f3c65a, 0xf4814a24, 0x9bcdefbf, 0x6b1f71c8, + 0x0453d453, 0x8bba4c27, 0xe4f6e9bc, 0x142477cb, 0x7b68d250, + 0x0af74622, 0x65bbe3b9, 0x95697dce, 0xfa25d855, 0x75cc4021, + 0x1a80e5ba, 0xea527bcd, 0x851ede56, 0xe06fc760, 0x8f2362fb, + 0x7ff1fc8c, 0x10bd5917, 0x9f54c163, 0xf01864f8, 0x00cafa8f, + 0x6f865f14, 0x1e19cb66, 0x71556efd, 0x8187f08a, 0xeecb5511, + 0x6122cd65, 0x0e6e68fe, 0xfebcf689, 0x91f05312, 0x1c82df6c, + 0x73ce7af7, 0x831ce480, 0xec50411b, 0x63b9d96f, 0x0cf57cf4, + 0xfc27e283, 0x936b4718, 0xe2f4d36a, 0x8db876f1, 0x7d6ae886, + 0x12264d1d, 0x9dcfd569, 0xf28370f2, 0x0251ee85, 0x6d1d4b1e, + 0x18b4f678, 0x77f853e3, 0x872acd94, 0xe866680f, 0x678ff07b, + 0x08c355e0, 0xf811cb97, 0x975d6e0c, 0xe6c2fa7e, 0x898e5fe5, + 0x795cc192, 0x16106409, 0x99f9fc7d, 0xf6b559e6, 0x0667c791, + 0x692b620a, 0xe459ee74, 0x8b154bef, 0x7bc7d598, 0x148b7003, + 0x9b62e877, 0xf42e4dec, 0x04fcd39b, 0x6bb07600, 0x1a2fe272, + 0x756347e9, 0x85b1d99e, 0xeafd7c05, 0x6514e471, 0x0a5841ea, + 0xfa8adf9d, 0x95c67a06, 0x10d8a450, 0x7f9401cb, 0x8f469fbc, + 0xe00a3a27, 0x6fe3a253, 0x00af07c8, 0xf07d99bf, 0x9f313c24, + 0xeeaea856, 0x81e20dcd, 0x713093ba, 0x1e7c3621, 0x9195ae55, + 0xfed90bce, 0x0e0b95b9, 0x61473022, 0xec35bc5c, 0x837919c7, + 0x73ab87b0, 0x1ce7222b, 0x930eba5f, 0xfc421fc4, 0x0c9081b3, + 0x63dc2428, 0x1243b05a, 0x7d0f15c1, 0x8ddd8bb6, 0xe2912e2d, + 0x6d78b659, 0x023413c2, 0xf2e68db5, 0x9daa282e, 0xe8039548, + 0x874f30d3, 0x779daea4, 0x18d10b3f, 0x9738934b, 0xf87436d0, + 0x08a6a8a7, 0x67ea0d3c, 0x1675994e, 0x79393cd5, 0x89eba2a2, + 0xe6a70739, 0x694e9f4d, 0x06023ad6, 0xf6d0a4a1, 0x999c013a, + 0x14ee8d44, 0x7ba228df, 0x8b70b6a8, 0xe43c1333, 0x6bd58b47, + 0x04992edc, 0xf44bb0ab, 0x9b071530, 0xea988142, 0x85d424d9, + 0x7506baae, 0x1a4a1f35, 0x95a38741, 0xfaef22da, 0x0a3dbcad, + 0x65711936}}; + +#endif + +#endif + +#if N == 4 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xf1da05aa, 0x38c50d15, 0xc91f08bf, 0x718a1a2a, + 0x80501f80, 0x494f173f, 0xb8951295, 0xe3143454, 0x12ce31fe, + 0xdbd13941, 0x2a0b3ceb, 0x929e2e7e, 0x63442bd4, 0xaa5b236b, + 0x5b8126c1, 0x1d596ee9, 0xec836b43, 0x259c63fc, 0xd4466656, + 0x6cd374c3, 0x9d097169, 0x541679d6, 0xa5cc7c7c, 0xfe4d5abd, + 0x0f975f17, 0xc68857a8, 0x37525202, 0x8fc74097, 0x7e1d453d, + 0xb7024d82, 0x46d84828, 0x3ab2ddd2, 0xcb68d878, 0x0277d0c7, + 0xf3add56d, 0x4b38c7f8, 0xbae2c252, 0x73fdcaed, 0x8227cf47, + 0xd9a6e986, 0x287cec2c, 0xe163e493, 0x10b9e139, 0xa82cf3ac, + 0x59f6f606, 0x90e9feb9, 0x6133fb13, 0x27ebb33b, 0xd631b691, + 0x1f2ebe2e, 0xeef4bb84, 0x5661a911, 0xa7bbacbb, 0x6ea4a404, + 0x9f7ea1ae, 0xc4ff876f, 0x352582c5, 0xfc3a8a7a, 0x0de08fd0, + 0xb5759d45, 0x44af98ef, 0x8db09050, 0x7c6a95fa, 0x7565bba4, + 0x84bfbe0e, 0x4da0b6b1, 0xbc7ab31b, 0x04efa18e, 0xf535a424, + 0x3c2aac9b, 0xcdf0a931, 0x96718ff0, 0x67ab8a5a, 0xaeb482e5, + 0x5f6e874f, 0xe7fb95da, 0x16219070, 0xdf3e98cf, 0x2ee49d65, + 0x683cd54d, 0x99e6d0e7, 0x50f9d858, 0xa123ddf2, 0x19b6cf67, + 0xe86ccacd, 0x2173c272, 0xd0a9c7d8, 0x8b28e119, 0x7af2e4b3, + 0xb3edec0c, 0x4237e9a6, 0xfaa2fb33, 0x0b78fe99, 0xc267f626, + 0x33bdf38c, 0x4fd76676, 0xbe0d63dc, 0x77126b63, 0x86c86ec9, + 0x3e5d7c5c, 0xcf8779f6, 0x06987149, 0xf74274e3, 0xacc35222, + 0x5d195788, 0x94065f37, 0x65dc5a9d, 0xdd494808, 0x2c934da2, + 0xe58c451d, 0x145640b7, 0x528e089f, 0xa3540d35, 0x6a4b058a, + 0x9b910020, 0x230412b5, 0xd2de171f, 0x1bc11fa0, 0xea1b1a0a, + 0xb19a3ccb, 0x40403961, 0x895f31de, 0x78853474, 0xc01026e1, + 0x31ca234b, 0xf8d52bf4, 0x090f2e5e, 0xeacb7748, 0x1b1172e2, + 0xd20e7a5d, 0x23d47ff7, 0x9b416d62, 0x6a9b68c8, 0xa3846077, + 0x525e65dd, 0x09df431c, 0xf80546b6, 0x311a4e09, 0xc0c04ba3, + 0x78555936, 0x898f5c9c, 0x40905423, 0xb14a5189, 0xf79219a1, + 0x06481c0b, 0xcf5714b4, 0x3e8d111e, 0x8618038b, 0x77c20621, + 0xbedd0e9e, 0x4f070b34, 0x14862df5, 0xe55c285f, 0x2c4320e0, + 0xdd99254a, 0x650c37df, 0x94d63275, 0x5dc93aca, 0xac133f60, + 0xd079aa9a, 0x21a3af30, 0xe8bca78f, 0x1966a225, 0xa1f3b0b0, + 0x5029b51a, 0x9936bda5, 0x68ecb80f, 0x336d9ece, 0xc2b79b64, + 0x0ba893db, 0xfa729671, 0x42e784e4, 0xb33d814e, 0x7a2289f1, + 0x8bf88c5b, 0xcd20c473, 0x3cfac1d9, 0xf5e5c966, 0x043fcccc, + 0xbcaade59, 0x4d70dbf3, 0x846fd34c, 0x75b5d6e6, 0x2e34f027, + 0xdfeef58d, 0x16f1fd32, 0xe72bf898, 0x5fbeea0d, 0xae64efa7, + 0x677be718, 0x96a1e2b2, 0x9faeccec, 0x6e74c946, 0xa76bc1f9, + 0x56b1c453, 0xee24d6c6, 0x1ffed36c, 0xd6e1dbd3, 0x273bde79, + 0x7cbaf8b8, 0x8d60fd12, 0x447ff5ad, 0xb5a5f007, 0x0d30e292, + 0xfceae738, 0x35f5ef87, 0xc42fea2d, 0x82f7a205, 0x732da7af, + 0xba32af10, 0x4be8aaba, 0xf37db82f, 0x02a7bd85, 0xcbb8b53a, + 0x3a62b090, 0x61e39651, 0x903993fb, 0x59269b44, 0xa8fc9eee, + 0x10698c7b, 0xe1b389d1, 0x28ac816e, 0xd97684c4, 0xa51c113e, + 0x54c61494, 0x9dd91c2b, 0x6c031981, 0xd4960b14, 0x254c0ebe, + 0xec530601, 0x1d8903ab, 0x4608256a, 0xb7d220c0, 0x7ecd287f, + 0x8f172dd5, 0x37823f40, 0xc6583aea, 0x0f473255, 0xfe9d37ff, + 0xb8457fd7, 0x499f7a7d, 0x808072c2, 0x715a7768, 0xc9cf65fd, + 0x38156057, 0xf10a68e8, 0x00d06d42, 0x5b514b83, 0xaa8b4e29, + 0x63944696, 0x924e433c, 0x2adb51a9, 0xdb015403, 0x121e5cbc, + 0xe3c45916}, + {0x00000000, 0x0ee7e8d1, 0x1dcfd1a2, 0x13283973, 0x3b9fa344, + 0x35784b95, 0x265072e6, 0x28b79a37, 0x773f4688, 0x79d8ae59, + 0x6af0972a, 0x64177ffb, 0x4ca0e5cc, 0x42470d1d, 0x516f346e, + 0x5f88dcbf, 0xee7e8d10, 0xe09965c1, 0xf3b15cb2, 0xfd56b463, + 0xd5e12e54, 0xdb06c685, 0xc82efff6, 0xc6c91727, 0x9941cb98, + 0x97a62349, 0x848e1a3a, 0x8a69f2eb, 0xa2de68dc, 0xac39800d, + 0xbf11b97e, 0xb1f651af, 0x078c1c61, 0x096bf4b0, 0x1a43cdc3, + 0x14a42512, 0x3c13bf25, 0x32f457f4, 0x21dc6e87, 0x2f3b8656, + 0x70b35ae9, 0x7e54b238, 0x6d7c8b4b, 0x639b639a, 0x4b2cf9ad, + 0x45cb117c, 0x56e3280f, 0x5804c0de, 0xe9f29171, 0xe71579a0, + 0xf43d40d3, 0xfadaa802, 0xd26d3235, 0xdc8adae4, 0xcfa2e397, + 0xc1450b46, 0x9ecdd7f9, 0x902a3f28, 0x8302065b, 0x8de5ee8a, + 0xa55274bd, 0xabb59c6c, 0xb89da51f, 0xb67a4dce, 0x0f1838c2, + 0x01ffd013, 0x12d7e960, 0x1c3001b1, 0x34879b86, 0x3a607357, + 0x29484a24, 0x27afa2f5, 0x78277e4a, 0x76c0969b, 0x65e8afe8, + 0x6b0f4739, 0x43b8dd0e, 0x4d5f35df, 0x5e770cac, 0x5090e47d, + 0xe166b5d2, 0xef815d03, 0xfca96470, 0xf24e8ca1, 0xdaf91696, + 0xd41efe47, 0xc736c734, 0xc9d12fe5, 0x9659f35a, 0x98be1b8b, + 0x8b9622f8, 0x8571ca29, 0xadc6501e, 0xa321b8cf, 0xb00981bc, + 0xbeee696d, 0x089424a3, 0x0673cc72, 0x155bf501, 0x1bbc1dd0, + 0x330b87e7, 0x3dec6f36, 0x2ec45645, 0x2023be94, 0x7fab622b, + 0x714c8afa, 0x6264b389, 0x6c835b58, 0x4434c16f, 0x4ad329be, + 0x59fb10cd, 0x571cf81c, 0xe6eaa9b3, 0xe80d4162, 0xfb257811, + 0xf5c290c0, 0xdd750af7, 0xd392e226, 0xc0badb55, 0xce5d3384, + 0x91d5ef3b, 0x9f3207ea, 0x8c1a3e99, 0x82fdd648, 0xaa4a4c7f, + 0xa4ada4ae, 0xb7859ddd, 0xb962750c, 0x1e307184, 0x10d79955, + 0x03ffa026, 0x0d1848f7, 0x25afd2c0, 0x2b483a11, 0x38600362, + 0x3687ebb3, 0x690f370c, 0x67e8dfdd, 0x74c0e6ae, 0x7a270e7f, + 0x52909448, 0x5c777c99, 0x4f5f45ea, 0x41b8ad3b, 0xf04efc94, + 0xfea91445, 0xed812d36, 0xe366c5e7, 0xcbd15fd0, 0xc536b701, + 0xd61e8e72, 0xd8f966a3, 0x8771ba1c, 0x899652cd, 0x9abe6bbe, + 0x9459836f, 0xbcee1958, 0xb209f189, 0xa121c8fa, 0xafc6202b, + 0x19bc6de5, 0x175b8534, 0x0473bc47, 0x0a945496, 0x2223cea1, + 0x2cc42670, 0x3fec1f03, 0x310bf7d2, 0x6e832b6d, 0x6064c3bc, + 0x734cfacf, 0x7dab121e, 0x551c8829, 0x5bfb60f8, 0x48d3598b, + 0x4634b15a, 0xf7c2e0f5, 0xf9250824, 0xea0d3157, 0xe4ead986, + 0xcc5d43b1, 0xc2baab60, 0xd1929213, 0xdf757ac2, 0x80fda67d, + 0x8e1a4eac, 0x9d3277df, 0x93d59f0e, 0xbb620539, 0xb585ede8, + 0xa6add49b, 0xa84a3c4a, 0x11284946, 0x1fcfa197, 0x0ce798e4, + 0x02007035, 0x2ab7ea02, 0x245002d3, 0x37783ba0, 0x399fd371, + 0x66170fce, 0x68f0e71f, 0x7bd8de6c, 0x753f36bd, 0x5d88ac8a, + 0x536f445b, 0x40477d28, 0x4ea095f9, 0xff56c456, 0xf1b12c87, + 0xe29915f4, 0xec7efd25, 0xc4c96712, 0xca2e8fc3, 0xd906b6b0, + 0xd7e15e61, 0x886982de, 0x868e6a0f, 0x95a6537c, 0x9b41bbad, + 0xb3f6219a, 0xbd11c94b, 0xae39f038, 0xa0de18e9, 0x16a45527, + 0x1843bdf6, 0x0b6b8485, 0x058c6c54, 0x2d3bf663, 0x23dc1eb2, + 0x30f427c1, 0x3e13cf10, 0x619b13af, 0x6f7cfb7e, 0x7c54c20d, + 0x72b32adc, 0x5a04b0eb, 0x54e3583a, 0x47cb6149, 0x492c8998, + 0xf8dad837, 0xf63d30e6, 0xe5150995, 0xebf2e144, 0xc3457b73, + 0xcda293a2, 0xde8aaad1, 0xd06d4200, 0x8fe59ebf, 0x8102766e, + 0x922a4f1d, 0x9ccda7cc, 0xb47a3dfb, 0xba9dd52a, 0xa9b5ec59, + 0xa7520488}, + {0x00000000, 0x3c60e308, 0x78c1c610, 0x44a12518, 0xf1838c20, + 0xcde36f28, 0x89424a30, 0xb522a938, 0x38761e01, 0x0416fd09, + 0x40b7d811, 0x7cd73b19, 0xc9f59221, 0xf5957129, 0xb1345431, + 0x8d54b739, 0x70ec3c02, 0x4c8cdf0a, 0x082dfa12, 0x344d191a, + 0x816fb022, 0xbd0f532a, 0xf9ae7632, 0xc5ce953a, 0x489a2203, + 0x74fac10b, 0x305be413, 0x0c3b071b, 0xb919ae23, 0x85794d2b, + 0xc1d86833, 0xfdb88b3b, 0xe1d87804, 0xddb89b0c, 0x9919be14, + 0xa5795d1c, 0x105bf424, 0x2c3b172c, 0x689a3234, 0x54fad13c, + 0xd9ae6605, 0xe5ce850d, 0xa16fa015, 0x9d0f431d, 0x282dea25, + 0x144d092d, 0x50ec2c35, 0x6c8ccf3d, 0x91344406, 0xad54a70e, + 0xe9f58216, 0xd595611e, 0x60b7c826, 0x5cd72b2e, 0x18760e36, + 0x2416ed3e, 0xa9425a07, 0x9522b90f, 0xd1839c17, 0xede37f1f, + 0x58c1d627, 0x64a1352f, 0x20001037, 0x1c60f33f, 0x18c1f649, + 0x24a11541, 0x60003059, 0x5c60d351, 0xe9427a69, 0xd5229961, + 0x9183bc79, 0xade35f71, 0x20b7e848, 0x1cd70b40, 0x58762e58, + 0x6416cd50, 0xd1346468, 0xed548760, 0xa9f5a278, 0x95954170, + 0x682dca4b, 0x544d2943, 0x10ec0c5b, 0x2c8cef53, 0x99ae466b, + 0xa5cea563, 0xe16f807b, 0xdd0f6373, 0x505bd44a, 0x6c3b3742, + 0x289a125a, 0x14faf152, 0xa1d8586a, 0x9db8bb62, 0xd9199e7a, + 0xe5797d72, 0xf9198e4d, 0xc5796d45, 0x81d8485d, 0xbdb8ab55, + 0x089a026d, 0x34fae165, 0x705bc47d, 0x4c3b2775, 0xc16f904c, + 0xfd0f7344, 0xb9ae565c, 0x85ceb554, 0x30ec1c6c, 0x0c8cff64, + 0x482dda7c, 0x744d3974, 0x89f5b24f, 0xb5955147, 0xf134745f, + 0xcd549757, 0x78763e6f, 0x4416dd67, 0x00b7f87f, 0x3cd71b77, + 0xb183ac4e, 0x8de34f46, 0xc9426a5e, 0xf5228956, 0x4000206e, + 0x7c60c366, 0x38c1e67e, 0x04a10576, 0x3183ec92, 0x0de30f9a, + 0x49422a82, 0x7522c98a, 0xc00060b2, 0xfc6083ba, 0xb8c1a6a2, + 0x84a145aa, 0x09f5f293, 0x3595119b, 0x71343483, 0x4d54d78b, + 0xf8767eb3, 0xc4169dbb, 0x80b7b8a3, 0xbcd75bab, 0x416fd090, + 0x7d0f3398, 0x39ae1680, 0x05cef588, 0xb0ec5cb0, 0x8c8cbfb8, + 0xc82d9aa0, 0xf44d79a8, 0x7919ce91, 0x45792d99, 0x01d80881, + 0x3db8eb89, 0x889a42b1, 0xb4faa1b9, 0xf05b84a1, 0xcc3b67a9, + 0xd05b9496, 0xec3b779e, 0xa89a5286, 0x94fab18e, 0x21d818b6, + 0x1db8fbbe, 0x5919dea6, 0x65793dae, 0xe82d8a97, 0xd44d699f, + 0x90ec4c87, 0xac8caf8f, 0x19ae06b7, 0x25cee5bf, 0x616fc0a7, + 0x5d0f23af, 0xa0b7a894, 0x9cd74b9c, 0xd8766e84, 0xe4168d8c, + 0x513424b4, 0x6d54c7bc, 0x29f5e2a4, 0x159501ac, 0x98c1b695, + 0xa4a1559d, 0xe0007085, 0xdc60938d, 0x69423ab5, 0x5522d9bd, + 0x1183fca5, 0x2de31fad, 0x29421adb, 0x1522f9d3, 0x5183dccb, + 0x6de33fc3, 0xd8c196fb, 0xe4a175f3, 0xa00050eb, 0x9c60b3e3, + 0x113404da, 0x2d54e7d2, 0x69f5c2ca, 0x559521c2, 0xe0b788fa, + 0xdcd76bf2, 0x98764eea, 0xa416ade2, 0x59ae26d9, 0x65cec5d1, + 0x216fe0c9, 0x1d0f03c1, 0xa82daaf9, 0x944d49f1, 0xd0ec6ce9, + 0xec8c8fe1, 0x61d838d8, 0x5db8dbd0, 0x1919fec8, 0x25791dc0, + 0x905bb4f8, 0xac3b57f0, 0xe89a72e8, 0xd4fa91e0, 0xc89a62df, + 0xf4fa81d7, 0xb05ba4cf, 0x8c3b47c7, 0x3919eeff, 0x05790df7, + 0x41d828ef, 0x7db8cbe7, 0xf0ec7cde, 0xcc8c9fd6, 0x882dbace, + 0xb44d59c6, 0x016ff0fe, 0x3d0f13f6, 0x79ae36ee, 0x45ced5e6, + 0xb8765edd, 0x8416bdd5, 0xc0b798cd, 0xfcd77bc5, 0x49f5d2fd, + 0x759531f5, 0x313414ed, 0x0d54f7e5, 0x800040dc, 0xbc60a3d4, + 0xf8c186cc, 0xc4a165c4, 0x7183ccfc, 0x4de32ff4, 0x09420aec, + 0x3522e9e4}, + {0x00000000, 0x6307d924, 0xc60fb248, 0xa5086b6c, 0x576e62d1, + 0x3469bbf5, 0x9161d099, 0xf26609bd, 0xaedcc5a2, 0xcddb1c86, + 0x68d377ea, 0x0bd4aece, 0xf9b2a773, 0x9ab57e57, 0x3fbd153b, + 0x5cbacc1f, 0x86c88d05, 0xe5cf5421, 0x40c73f4d, 0x23c0e669, + 0xd1a6efd4, 0xb2a136f0, 0x17a95d9c, 0x74ae84b8, 0x281448a7, + 0x4b139183, 0xee1bfaef, 0x8d1c23cb, 0x7f7a2a76, 0x1c7df352, + 0xb975983e, 0xda72411a, 0xd6e01c4b, 0xb5e7c56f, 0x10efae03, + 0x73e87727, 0x818e7e9a, 0xe289a7be, 0x4781ccd2, 0x248615f6, + 0x783cd9e9, 0x1b3b00cd, 0xbe336ba1, 0xdd34b285, 0x2f52bb38, + 0x4c55621c, 0xe95d0970, 0x8a5ad054, 0x5028914e, 0x332f486a, + 0x96272306, 0xf520fa22, 0x0746f39f, 0x64412abb, 0xc14941d7, + 0xa24e98f3, 0xfef454ec, 0x9df38dc8, 0x38fbe6a4, 0x5bfc3f80, + 0xa99a363d, 0xca9def19, 0x6f958475, 0x0c925d51, 0x76b13ed7, + 0x15b6e7f3, 0xb0be8c9f, 0xd3b955bb, 0x21df5c06, 0x42d88522, + 0xe7d0ee4e, 0x84d7376a, 0xd86dfb75, 0xbb6a2251, 0x1e62493d, + 0x7d659019, 0x8f0399a4, 0xec044080, 0x490c2bec, 0x2a0bf2c8, + 0xf079b3d2, 0x937e6af6, 0x3676019a, 0x5571d8be, 0xa717d103, + 0xc4100827, 0x6118634b, 0x021fba6f, 0x5ea57670, 0x3da2af54, + 0x98aac438, 0xfbad1d1c, 0x09cb14a1, 0x6acccd85, 0xcfc4a6e9, + 0xacc37fcd, 0xa051229c, 0xc356fbb8, 0x665e90d4, 0x055949f0, + 0xf73f404d, 0x94389969, 0x3130f205, 0x52372b21, 0x0e8de73e, + 0x6d8a3e1a, 0xc8825576, 0xab858c52, 0x59e385ef, 0x3ae45ccb, + 0x9fec37a7, 0xfcebee83, 0x2699af99, 0x459e76bd, 0xe0961dd1, + 0x8391c4f5, 0x71f7cd48, 0x12f0146c, 0xb7f87f00, 0xd4ffa624, + 0x88456a3b, 0xeb42b31f, 0x4e4ad873, 0x2d4d0157, 0xdf2b08ea, + 0xbc2cd1ce, 0x1924baa2, 0x7a236386, 0xed627dae, 0x8e65a48a, + 0x2b6dcfe6, 0x486a16c2, 0xba0c1f7f, 0xd90bc65b, 0x7c03ad37, + 0x1f047413, 0x43beb80c, 0x20b96128, 0x85b10a44, 0xe6b6d360, + 0x14d0dadd, 0x77d703f9, 0xd2df6895, 0xb1d8b1b1, 0x6baaf0ab, + 0x08ad298f, 0xada542e3, 0xcea29bc7, 0x3cc4927a, 0x5fc34b5e, + 0xfacb2032, 0x99ccf916, 0xc5763509, 0xa671ec2d, 0x03798741, + 0x607e5e65, 0x921857d8, 0xf11f8efc, 0x5417e590, 0x37103cb4, + 0x3b8261e5, 0x5885b8c1, 0xfd8dd3ad, 0x9e8a0a89, 0x6cec0334, + 0x0febda10, 0xaae3b17c, 0xc9e46858, 0x955ea447, 0xf6597d63, + 0x5351160f, 0x3056cf2b, 0xc230c696, 0xa1371fb2, 0x043f74de, + 0x6738adfa, 0xbd4aece0, 0xde4d35c4, 0x7b455ea8, 0x1842878c, + 0xea248e31, 0x89235715, 0x2c2b3c79, 0x4f2ce55d, 0x13962942, + 0x7091f066, 0xd5999b0a, 0xb69e422e, 0x44f84b93, 0x27ff92b7, + 0x82f7f9db, 0xe1f020ff, 0x9bd34379, 0xf8d49a5d, 0x5ddcf131, + 0x3edb2815, 0xccbd21a8, 0xafbaf88c, 0x0ab293e0, 0x69b54ac4, + 0x350f86db, 0x56085fff, 0xf3003493, 0x9007edb7, 0x6261e40a, + 0x01663d2e, 0xa46e5642, 0xc7698f66, 0x1d1bce7c, 0x7e1c1758, + 0xdb147c34, 0xb813a510, 0x4a75acad, 0x29727589, 0x8c7a1ee5, + 0xef7dc7c1, 0xb3c70bde, 0xd0c0d2fa, 0x75c8b996, 0x16cf60b2, + 0xe4a9690f, 0x87aeb02b, 0x22a6db47, 0x41a10263, 0x4d335f32, + 0x2e348616, 0x8b3ced7a, 0xe83b345e, 0x1a5d3de3, 0x795ae4c7, + 0xdc528fab, 0xbf55568f, 0xe3ef9a90, 0x80e843b4, 0x25e028d8, + 0x46e7f1fc, 0xb481f841, 0xd7862165, 0x728e4a09, 0x1189932d, + 0xcbfbd237, 0xa8fc0b13, 0x0df4607f, 0x6ef3b95b, 0x9c95b0e6, + 0xff9269c2, 0x5a9a02ae, 0x399ddb8a, 0x65271795, 0x0620ceb1, + 0xa328a5dd, 0xc02f7cf9, 0x32497544, 0x514eac60, 0xf446c70c, + 0x97411e28}, + {0x00000000, 0x01b5fd1d, 0x036bfa3a, 0x02de0727, 0x06d7f474, + 0x07620969, 0x05bc0e4e, 0x0409f353, 0x0dafe8e8, 0x0c1a15f5, + 0x0ec412d2, 0x0f71efcf, 0x0b781c9c, 0x0acde181, 0x0813e6a6, + 0x09a61bbb, 0x1b5fd1d0, 0x1aea2ccd, 0x18342bea, 0x1981d6f7, + 0x1d8825a4, 0x1c3dd8b9, 0x1ee3df9e, 0x1f562283, 0x16f03938, + 0x1745c425, 0x159bc302, 0x142e3e1f, 0x1027cd4c, 0x11923051, + 0x134c3776, 0x12f9ca6b, 0x36bfa3a0, 0x370a5ebd, 0x35d4599a, + 0x3461a487, 0x306857d4, 0x31ddaac9, 0x3303adee, 0x32b650f3, + 0x3b104b48, 0x3aa5b655, 0x387bb172, 0x39ce4c6f, 0x3dc7bf3c, + 0x3c724221, 0x3eac4506, 0x3f19b81b, 0x2de07270, 0x2c558f6d, + 0x2e8b884a, 0x2f3e7557, 0x2b378604, 0x2a827b19, 0x285c7c3e, + 0x29e98123, 0x204f9a98, 0x21fa6785, 0x232460a2, 0x22919dbf, + 0x26986eec, 0x272d93f1, 0x25f394d6, 0x244669cb, 0x6d7f4740, + 0x6ccaba5d, 0x6e14bd7a, 0x6fa14067, 0x6ba8b334, 0x6a1d4e29, + 0x68c3490e, 0x6976b413, 0x60d0afa8, 0x616552b5, 0x63bb5592, + 0x620ea88f, 0x66075bdc, 0x67b2a6c1, 0x656ca1e6, 0x64d95cfb, + 0x76209690, 0x77956b8d, 0x754b6caa, 0x74fe91b7, 0x70f762e4, + 0x71429ff9, 0x739c98de, 0x722965c3, 0x7b8f7e78, 0x7a3a8365, + 0x78e48442, 0x7951795f, 0x7d588a0c, 0x7ced7711, 0x7e337036, + 0x7f868d2b, 0x5bc0e4e0, 0x5a7519fd, 0x58ab1eda, 0x591ee3c7, + 0x5d171094, 0x5ca2ed89, 0x5e7ceaae, 0x5fc917b3, 0x566f0c08, + 0x57daf115, 0x5504f632, 0x54b10b2f, 0x50b8f87c, 0x510d0561, + 0x53d30246, 0x5266ff5b, 0x409f3530, 0x412ac82d, 0x43f4cf0a, + 0x42413217, 0x4648c144, 0x47fd3c59, 0x45233b7e, 0x4496c663, + 0x4d30ddd8, 0x4c8520c5, 0x4e5b27e2, 0x4feedaff, 0x4be729ac, + 0x4a52d4b1, 0x488cd396, 0x49392e8b, 0xdafe8e80, 0xdb4b739d, + 0xd99574ba, 0xd82089a7, 0xdc297af4, 0xdd9c87e9, 0xdf4280ce, + 0xdef77dd3, 0xd7516668, 0xd6e49b75, 0xd43a9c52, 0xd58f614f, + 0xd186921c, 0xd0336f01, 0xd2ed6826, 0xd358953b, 0xc1a15f50, + 0xc014a24d, 0xc2caa56a, 0xc37f5877, 0xc776ab24, 0xc6c35639, + 0xc41d511e, 0xc5a8ac03, 0xcc0eb7b8, 0xcdbb4aa5, 0xcf654d82, + 0xced0b09f, 0xcad943cc, 0xcb6cbed1, 0xc9b2b9f6, 0xc80744eb, + 0xec412d20, 0xedf4d03d, 0xef2ad71a, 0xee9f2a07, 0xea96d954, + 0xeb232449, 0xe9fd236e, 0xe848de73, 0xe1eec5c8, 0xe05b38d5, + 0xe2853ff2, 0xe330c2ef, 0xe73931bc, 0xe68ccca1, 0xe452cb86, + 0xe5e7369b, 0xf71efcf0, 0xf6ab01ed, 0xf47506ca, 0xf5c0fbd7, + 0xf1c90884, 0xf07cf599, 0xf2a2f2be, 0xf3170fa3, 0xfab11418, + 0xfb04e905, 0xf9daee22, 0xf86f133f, 0xfc66e06c, 0xfdd31d71, + 0xff0d1a56, 0xfeb8e74b, 0xb781c9c0, 0xb63434dd, 0xb4ea33fa, + 0xb55fcee7, 0xb1563db4, 0xb0e3c0a9, 0xb23dc78e, 0xb3883a93, + 0xba2e2128, 0xbb9bdc35, 0xb945db12, 0xb8f0260f, 0xbcf9d55c, + 0xbd4c2841, 0xbf922f66, 0xbe27d27b, 0xacde1810, 0xad6be50d, + 0xafb5e22a, 0xae001f37, 0xaa09ec64, 0xabbc1179, 0xa962165e, + 0xa8d7eb43, 0xa171f0f8, 0xa0c40de5, 0xa21a0ac2, 0xa3aff7df, + 0xa7a6048c, 0xa613f991, 0xa4cdfeb6, 0xa57803ab, 0x813e6a60, + 0x808b977d, 0x8255905a, 0x83e06d47, 0x87e99e14, 0x865c6309, + 0x8482642e, 0x85379933, 0x8c918288, 0x8d247f95, 0x8ffa78b2, + 0x8e4f85af, 0x8a4676fc, 0x8bf38be1, 0x892d8cc6, 0x889871db, + 0x9a61bbb0, 0x9bd446ad, 0x990a418a, 0x98bfbc97, 0x9cb64fc4, + 0x9d03b2d9, 0x9fddb5fe, 0x9e6848e3, 0x97ce5358, 0x967bae45, + 0x94a5a962, 0x9510547f, 0x9119a72c, 0x90ac5a31, 0x92725d16, + 0x93c7a00b}, + {0x00000000, 0x6e8c1b41, 0xdd183682, 0xb3942dc3, 0x61416b45, + 0x0fcd7004, 0xbc595dc7, 0xd2d54686, 0xc282d68a, 0xac0ecdcb, + 0x1f9ae008, 0x7116fb49, 0xa3c3bdcf, 0xcd4fa68e, 0x7edb8b4d, + 0x1057900c, 0x5e74ab55, 0x30f8b014, 0x836c9dd7, 0xede08696, + 0x3f35c010, 0x51b9db51, 0xe22df692, 0x8ca1edd3, 0x9cf67ddf, + 0xf27a669e, 0x41ee4b5d, 0x2f62501c, 0xfdb7169a, 0x933b0ddb, + 0x20af2018, 0x4e233b59, 0xbce956aa, 0xd2654deb, 0x61f16028, + 0x0f7d7b69, 0xdda83def, 0xb32426ae, 0x00b00b6d, 0x6e3c102c, + 0x7e6b8020, 0x10e79b61, 0xa373b6a2, 0xcdffade3, 0x1f2aeb65, + 0x71a6f024, 0xc232dde7, 0xacbec6a6, 0xe29dfdff, 0x8c11e6be, + 0x3f85cb7d, 0x5109d03c, 0x83dc96ba, 0xed508dfb, 0x5ec4a038, + 0x3048bb79, 0x201f2b75, 0x4e933034, 0xfd071df7, 0x938b06b6, + 0x415e4030, 0x2fd25b71, 0x9c4676b2, 0xf2ca6df3, 0xa2a3ab15, + 0xcc2fb054, 0x7fbb9d97, 0x113786d6, 0xc3e2c050, 0xad6edb11, + 0x1efaf6d2, 0x7076ed93, 0x60217d9f, 0x0ead66de, 0xbd394b1d, + 0xd3b5505c, 0x016016da, 0x6fec0d9b, 0xdc782058, 0xb2f43b19, + 0xfcd70040, 0x925b1b01, 0x21cf36c2, 0x4f432d83, 0x9d966b05, + 0xf31a7044, 0x408e5d87, 0x2e0246c6, 0x3e55d6ca, 0x50d9cd8b, + 0xe34de048, 0x8dc1fb09, 0x5f14bd8f, 0x3198a6ce, 0x820c8b0d, + 0xec80904c, 0x1e4afdbf, 0x70c6e6fe, 0xc352cb3d, 0xadded07c, + 0x7f0b96fa, 0x11878dbb, 0xa213a078, 0xcc9fbb39, 0xdcc82b35, + 0xb2443074, 0x01d01db7, 0x6f5c06f6, 0xbd894070, 0xd3055b31, + 0x609176f2, 0x0e1d6db3, 0x403e56ea, 0x2eb24dab, 0x9d266068, + 0xf3aa7b29, 0x217f3daf, 0x4ff326ee, 0xfc670b2d, 0x92eb106c, + 0x82bc8060, 0xec309b21, 0x5fa4b6e2, 0x3128ada3, 0xe3fdeb25, + 0x8d71f064, 0x3ee5dda7, 0x5069c6e6, 0x9e36506b, 0xf0ba4b2a, + 0x432e66e9, 0x2da27da8, 0xff773b2e, 0x91fb206f, 0x226f0dac, + 0x4ce316ed, 0x5cb486e1, 0x32389da0, 0x81acb063, 0xef20ab22, + 0x3df5eda4, 0x5379f6e5, 0xe0eddb26, 0x8e61c067, 0xc042fb3e, + 0xaecee07f, 0x1d5acdbc, 0x73d6d6fd, 0xa103907b, 0xcf8f8b3a, + 0x7c1ba6f9, 0x1297bdb8, 0x02c02db4, 0x6c4c36f5, 0xdfd81b36, + 0xb1540077, 0x638146f1, 0x0d0d5db0, 0xbe997073, 0xd0156b32, + 0x22df06c1, 0x4c531d80, 0xffc73043, 0x914b2b02, 0x439e6d84, + 0x2d1276c5, 0x9e865b06, 0xf00a4047, 0xe05dd04b, 0x8ed1cb0a, + 0x3d45e6c9, 0x53c9fd88, 0x811cbb0e, 0xef90a04f, 0x5c048d8c, + 0x328896cd, 0x7cabad94, 0x1227b6d5, 0xa1b39b16, 0xcf3f8057, + 0x1deac6d1, 0x7366dd90, 0xc0f2f053, 0xae7eeb12, 0xbe297b1e, + 0xd0a5605f, 0x63314d9c, 0x0dbd56dd, 0xdf68105b, 0xb1e40b1a, + 0x027026d9, 0x6cfc3d98, 0x3c95fb7e, 0x5219e03f, 0xe18dcdfc, + 0x8f01d6bd, 0x5dd4903b, 0x33588b7a, 0x80cca6b9, 0xee40bdf8, + 0xfe172df4, 0x909b36b5, 0x230f1b76, 0x4d830037, 0x9f5646b1, + 0xf1da5df0, 0x424e7033, 0x2cc26b72, 0x62e1502b, 0x0c6d4b6a, + 0xbff966a9, 0xd1757de8, 0x03a03b6e, 0x6d2c202f, 0xdeb80dec, + 0xb03416ad, 0xa06386a1, 0xceef9de0, 0x7d7bb023, 0x13f7ab62, + 0xc122ede4, 0xafaef6a5, 0x1c3adb66, 0x72b6c027, 0x807cadd4, + 0xeef0b695, 0x5d649b56, 0x33e88017, 0xe13dc691, 0x8fb1ddd0, + 0x3c25f013, 0x52a9eb52, 0x42fe7b5e, 0x2c72601f, 0x9fe64ddc, + 0xf16a569d, 0x23bf101b, 0x4d330b5a, 0xfea72699, 0x902b3dd8, + 0xde080681, 0xb0841dc0, 0x03103003, 0x6d9c2b42, 0xbf496dc4, + 0xd1c57685, 0x62515b46, 0x0cdd4007, 0x1c8ad00b, 0x7206cb4a, + 0xc192e689, 0xaf1efdc8, 0x7dcbbb4e, 0x1347a00f, 0xa0d38dcc, + 0xce5f968d}, + {0x00000000, 0xe71da697, 0x154a4b6f, 0xf257edf8, 0x2a9496de, + 0xcd893049, 0x3fdeddb1, 0xd8c37b26, 0x55292dbc, 0xb2348b2b, + 0x406366d3, 0xa77ec044, 0x7fbdbb62, 0x98a01df5, 0x6af7f00d, + 0x8dea569a, 0xaa525b78, 0x4d4ffdef, 0xbf181017, 0x5805b680, + 0x80c6cda6, 0x67db6b31, 0x958c86c9, 0x7291205e, 0xff7b76c4, + 0x1866d053, 0xea313dab, 0x0d2c9b3c, 0xd5efe01a, 0x32f2468d, + 0xc0a5ab75, 0x27b80de2, 0x8fd5b0b1, 0x68c81626, 0x9a9ffbde, + 0x7d825d49, 0xa541266f, 0x425c80f8, 0xb00b6d00, 0x5716cb97, + 0xdafc9d0d, 0x3de13b9a, 0xcfb6d662, 0x28ab70f5, 0xf0680bd3, + 0x1775ad44, 0xe52240bc, 0x023fe62b, 0x2587ebc9, 0xc29a4d5e, + 0x30cda0a6, 0xd7d00631, 0x0f137d17, 0xe80edb80, 0x1a593678, + 0xfd4490ef, 0x70aec675, 0x97b360e2, 0x65e48d1a, 0x82f92b8d, + 0x5a3a50ab, 0xbd27f63c, 0x4f701bc4, 0xa86dbd53, 0xc4da6723, + 0x23c7c1b4, 0xd1902c4c, 0x368d8adb, 0xee4ef1fd, 0x0953576a, + 0xfb04ba92, 0x1c191c05, 0x91f34a9f, 0x76eeec08, 0x84b901f0, + 0x63a4a767, 0xbb67dc41, 0x5c7a7ad6, 0xae2d972e, 0x493031b9, + 0x6e883c5b, 0x89959acc, 0x7bc27734, 0x9cdfd1a3, 0x441caa85, + 0xa3010c12, 0x5156e1ea, 0xb64b477d, 0x3ba111e7, 0xdcbcb770, + 0x2eeb5a88, 0xc9f6fc1f, 0x11358739, 0xf62821ae, 0x047fcc56, + 0xe3626ac1, 0x4b0fd792, 0xac127105, 0x5e459cfd, 0xb9583a6a, + 0x619b414c, 0x8686e7db, 0x74d10a23, 0x93ccacb4, 0x1e26fa2e, + 0xf93b5cb9, 0x0b6cb141, 0xec7117d6, 0x34b26cf0, 0xd3afca67, + 0x21f8279f, 0xc6e58108, 0xe15d8cea, 0x06402a7d, 0xf417c785, + 0x130a6112, 0xcbc91a34, 0x2cd4bca3, 0xde83515b, 0x399ef7cc, + 0xb474a156, 0x536907c1, 0xa13eea39, 0x46234cae, 0x9ee03788, + 0x79fd911f, 0x8baa7ce7, 0x6cb7da70, 0x52c5c807, 0xb5d86e90, + 0x478f8368, 0xa09225ff, 0x78515ed9, 0x9f4cf84e, 0x6d1b15b6, + 0x8a06b321, 0x07ece5bb, 0xe0f1432c, 0x12a6aed4, 0xf5bb0843, + 0x2d787365, 0xca65d5f2, 0x3832380a, 0xdf2f9e9d, 0xf897937f, + 0x1f8a35e8, 0xedddd810, 0x0ac07e87, 0xd20305a1, 0x351ea336, + 0xc7494ece, 0x2054e859, 0xadbebec3, 0x4aa31854, 0xb8f4f5ac, + 0x5fe9533b, 0x872a281d, 0x60378e8a, 0x92606372, 0x757dc5e5, + 0xdd1078b6, 0x3a0dde21, 0xc85a33d9, 0x2f47954e, 0xf784ee68, + 0x109948ff, 0xe2cea507, 0x05d30390, 0x8839550a, 0x6f24f39d, + 0x9d731e65, 0x7a6eb8f2, 0xa2adc3d4, 0x45b06543, 0xb7e788bb, + 0x50fa2e2c, 0x774223ce, 0x905f8559, 0x620868a1, 0x8515ce36, + 0x5dd6b510, 0xbacb1387, 0x489cfe7f, 0xaf8158e8, 0x226b0e72, + 0xc576a8e5, 0x3721451d, 0xd03ce38a, 0x08ff98ac, 0xefe23e3b, + 0x1db5d3c3, 0xfaa87554, 0x961faf24, 0x710209b3, 0x8355e44b, + 0x644842dc, 0xbc8b39fa, 0x5b969f6d, 0xa9c17295, 0x4edcd402, + 0xc3368298, 0x242b240f, 0xd67cc9f7, 0x31616f60, 0xe9a21446, + 0x0ebfb2d1, 0xfce85f29, 0x1bf5f9be, 0x3c4df45c, 0xdb5052cb, + 0x2907bf33, 0xce1a19a4, 0x16d96282, 0xf1c4c415, 0x039329ed, + 0xe48e8f7a, 0x6964d9e0, 0x8e797f77, 0x7c2e928f, 0x9b333418, + 0x43f04f3e, 0xa4ede9a9, 0x56ba0451, 0xb1a7a2c6, 0x19ca1f95, + 0xfed7b902, 0x0c8054fa, 0xeb9df26d, 0x335e894b, 0xd4432fdc, + 0x2614c224, 0xc10964b3, 0x4ce33229, 0xabfe94be, 0x59a97946, + 0xbeb4dfd1, 0x6677a4f7, 0x816a0260, 0x733def98, 0x9420490f, + 0xb39844ed, 0x5485e27a, 0xa6d20f82, 0x41cfa915, 0x990cd233, + 0x7e1174a4, 0x8c46995c, 0x6b5b3fcb, 0xe6b16951, 0x01accfc6, + 0xf3fb223e, 0x14e684a9, 0xcc25ff8f, 0x2b385918, 0xd96fb4e0, + 0x3e721277}, + {0x00000000, 0xa58b900e, 0x9066265d, 0x35edb653, 0xfbbd4afb, + 0x5e36daf5, 0x6bdb6ca6, 0xce50fca8, 0x2c0b93b7, 0x898003b9, + 0xbc6db5ea, 0x19e625e4, 0xd7b6d94c, 0x723d4942, 0x47d0ff11, + 0xe25b6f1f, 0x5817276e, 0xfd9cb760, 0xc8710133, 0x6dfa913d, + 0xa3aa6d95, 0x0621fd9b, 0x33cc4bc8, 0x9647dbc6, 0x741cb4d9, + 0xd19724d7, 0xe47a9284, 0x41f1028a, 0x8fa1fe22, 0x2a2a6e2c, + 0x1fc7d87f, 0xba4c4871, 0xb02e4edc, 0x15a5ded2, 0x20486881, + 0x85c3f88f, 0x4b930427, 0xee189429, 0xdbf5227a, 0x7e7eb274, + 0x9c25dd6b, 0x39ae4d65, 0x0c43fb36, 0xa9c86b38, 0x67989790, + 0xc213079e, 0xf7feb1cd, 0x527521c3, 0xe83969b2, 0x4db2f9bc, + 0x785f4fef, 0xddd4dfe1, 0x13842349, 0xb60fb347, 0x83e20514, + 0x2669951a, 0xc432fa05, 0x61b96a0b, 0x5454dc58, 0xf1df4c56, + 0x3f8fb0fe, 0x9a0420f0, 0xafe996a3, 0x0a6206ad, 0xbb2d9bf9, + 0x1ea60bf7, 0x2b4bbda4, 0x8ec02daa, 0x4090d102, 0xe51b410c, + 0xd0f6f75f, 0x757d6751, 0x9726084e, 0x32ad9840, 0x07402e13, + 0xa2cbbe1d, 0x6c9b42b5, 0xc910d2bb, 0xfcfd64e8, 0x5976f4e6, + 0xe33abc97, 0x46b12c99, 0x735c9aca, 0xd6d70ac4, 0x1887f66c, + 0xbd0c6662, 0x88e1d031, 0x2d6a403f, 0xcf312f20, 0x6ababf2e, + 0x5f57097d, 0xfadc9973, 0x348c65db, 0x9107f5d5, 0xa4ea4386, + 0x0161d388, 0x0b03d525, 0xae88452b, 0x9b65f378, 0x3eee6376, + 0xf0be9fde, 0x55350fd0, 0x60d8b983, 0xc553298d, 0x27084692, + 0x8283d69c, 0xb76e60cf, 0x12e5f0c1, 0xdcb50c69, 0x793e9c67, + 0x4cd32a34, 0xe958ba3a, 0x5314f24b, 0xf69f6245, 0xc372d416, + 0x66f94418, 0xa8a9b8b0, 0x0d2228be, 0x38cf9eed, 0x9d440ee3, + 0x7f1f61fc, 0xda94f1f2, 0xef7947a1, 0x4af2d7af, 0x84a22b07, + 0x2129bb09, 0x14c40d5a, 0xb14f9d54, 0xad2a31b3, 0x08a1a1bd, + 0x3d4c17ee, 0x98c787e0, 0x56977b48, 0xf31ceb46, 0xc6f15d15, + 0x637acd1b, 0x8121a204, 0x24aa320a, 0x11478459, 0xb4cc1457, + 0x7a9ce8ff, 0xdf1778f1, 0xeafacea2, 0x4f715eac, 0xf53d16dd, + 0x50b686d3, 0x655b3080, 0xc0d0a08e, 0x0e805c26, 0xab0bcc28, + 0x9ee67a7b, 0x3b6dea75, 0xd936856a, 0x7cbd1564, 0x4950a337, + 0xecdb3339, 0x228bcf91, 0x87005f9f, 0xb2ede9cc, 0x176679c2, + 0x1d047f6f, 0xb88fef61, 0x8d625932, 0x28e9c93c, 0xe6b93594, + 0x4332a59a, 0x76df13c9, 0xd35483c7, 0x310fecd8, 0x94847cd6, + 0xa169ca85, 0x04e25a8b, 0xcab2a623, 0x6f39362d, 0x5ad4807e, + 0xff5f1070, 0x45135801, 0xe098c80f, 0xd5757e5c, 0x70feee52, + 0xbeae12fa, 0x1b2582f4, 0x2ec834a7, 0x8b43a4a9, 0x6918cbb6, + 0xcc935bb8, 0xf97eedeb, 0x5cf57de5, 0x92a5814d, 0x372e1143, + 0x02c3a710, 0xa748371e, 0x1607aa4a, 0xb38c3a44, 0x86618c17, + 0x23ea1c19, 0xedbae0b1, 0x483170bf, 0x7ddcc6ec, 0xd85756e2, + 0x3a0c39fd, 0x9f87a9f3, 0xaa6a1fa0, 0x0fe18fae, 0xc1b17306, + 0x643ae308, 0x51d7555b, 0xf45cc555, 0x4e108d24, 0xeb9b1d2a, + 0xde76ab79, 0x7bfd3b77, 0xb5adc7df, 0x102657d1, 0x25cbe182, + 0x8040718c, 0x621b1e93, 0xc7908e9d, 0xf27d38ce, 0x57f6a8c0, + 0x99a65468, 0x3c2dc466, 0x09c07235, 0xac4be23b, 0xa629e496, + 0x03a27498, 0x364fc2cb, 0x93c452c5, 0x5d94ae6d, 0xf81f3e63, + 0xcdf28830, 0x6879183e, 0x8a227721, 0x2fa9e72f, 0x1a44517c, + 0xbfcfc172, 0x719f3dda, 0xd414add4, 0xe1f91b87, 0x44728b89, + 0xfe3ec3f8, 0x5bb553f6, 0x6e58e5a5, 0xcbd375ab, 0x05838903, + 0xa008190d, 0x95e5af5e, 0x306e3f50, 0xd235504f, 0x77bec041, + 0x42537612, 0xe7d8e61c, 0x29881ab4, 0x8c038aba, 0xb9ee3ce9, + 0x1c65ace7}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x0e908ba500000000, 0x5d26669000000000, + 0x53b6ed3500000000, 0xfb4abdfb00000000, 0xf5da365e00000000, + 0xa66cdb6b00000000, 0xa8fc50ce00000000, 0xb7930b2c00000000, + 0xb903808900000000, 0xeab56dbc00000000, 0xe425e61900000000, + 0x4cd9b6d700000000, 0x42493d7200000000, 0x11ffd04700000000, + 0x1f6f5be200000000, 0x6e27175800000000, 0x60b79cfd00000000, + 0x330171c800000000, 0x3d91fa6d00000000, 0x956daaa300000000, + 0x9bfd210600000000, 0xc84bcc3300000000, 0xc6db479600000000, + 0xd9b41c7400000000, 0xd72497d100000000, 0x84927ae400000000, + 0x8a02f14100000000, 0x22fea18f00000000, 0x2c6e2a2a00000000, + 0x7fd8c71f00000000, 0x71484cba00000000, 0xdc4e2eb000000000, + 0xd2dea51500000000, 0x8168482000000000, 0x8ff8c38500000000, + 0x2704934b00000000, 0x299418ee00000000, 0x7a22f5db00000000, + 0x74b27e7e00000000, 0x6bdd259c00000000, 0x654dae3900000000, + 0x36fb430c00000000, 0x386bc8a900000000, 0x9097986700000000, + 0x9e0713c200000000, 0xcdb1fef700000000, 0xc321755200000000, + 0xb26939e800000000, 0xbcf9b24d00000000, 0xef4f5f7800000000, + 0xe1dfd4dd00000000, 0x4923841300000000, 0x47b30fb600000000, + 0x1405e28300000000, 0x1a95692600000000, 0x05fa32c400000000, + 0x0b6ab96100000000, 0x58dc545400000000, 0x564cdff100000000, + 0xfeb08f3f00000000, 0xf020049a00000000, 0xa396e9af00000000, + 0xad06620a00000000, 0xf99b2dbb00000000, 0xf70ba61e00000000, + 0xa4bd4b2b00000000, 0xaa2dc08e00000000, 0x02d1904000000000, + 0x0c411be500000000, 0x5ff7f6d000000000, 0x51677d7500000000, + 0x4e08269700000000, 0x4098ad3200000000, 0x132e400700000000, + 0x1dbecba200000000, 0xb5429b6c00000000, 0xbbd210c900000000, + 0xe864fdfc00000000, 0xe6f4765900000000, 0x97bc3ae300000000, + 0x992cb14600000000, 0xca9a5c7300000000, 0xc40ad7d600000000, + 0x6cf6871800000000, 0x62660cbd00000000, 0x31d0e18800000000, + 0x3f406a2d00000000, 0x202f31cf00000000, 0x2ebfba6a00000000, + 0x7d09575f00000000, 0x7399dcfa00000000, 0xdb658c3400000000, + 0xd5f5079100000000, 0x8643eaa400000000, 0x88d3610100000000, + 0x25d5030b00000000, 0x2b4588ae00000000, 0x78f3659b00000000, + 0x7663ee3e00000000, 0xde9fbef000000000, 0xd00f355500000000, + 0x83b9d86000000000, 0x8d2953c500000000, 0x9246082700000000, + 0x9cd6838200000000, 0xcf606eb700000000, 0xc1f0e51200000000, + 0x690cb5dc00000000, 0x679c3e7900000000, 0x342ad34c00000000, + 0x3aba58e900000000, 0x4bf2145300000000, 0x45629ff600000000, + 0x16d472c300000000, 0x1844f96600000000, 0xb0b8a9a800000000, + 0xbe28220d00000000, 0xed9ecf3800000000, 0xe30e449d00000000, + 0xfc611f7f00000000, 0xf2f194da00000000, 0xa14779ef00000000, + 0xafd7f24a00000000, 0x072ba28400000000, 0x09bb292100000000, + 0x5a0dc41400000000, 0x549d4fb100000000, 0xb3312aad00000000, + 0xbda1a10800000000, 0xee174c3d00000000, 0xe087c79800000000, + 0x487b975600000000, 0x46eb1cf300000000, 0x155df1c600000000, + 0x1bcd7a6300000000, 0x04a2218100000000, 0x0a32aa2400000000, + 0x5984471100000000, 0x5714ccb400000000, 0xffe89c7a00000000, + 0xf17817df00000000, 0xa2cefaea00000000, 0xac5e714f00000000, + 0xdd163df500000000, 0xd386b65000000000, 0x80305b6500000000, + 0x8ea0d0c000000000, 0x265c800e00000000, 0x28cc0bab00000000, + 0x7b7ae69e00000000, 0x75ea6d3b00000000, 0x6a8536d900000000, + 0x6415bd7c00000000, 0x37a3504900000000, 0x3933dbec00000000, + 0x91cf8b2200000000, 0x9f5f008700000000, 0xcce9edb200000000, + 0xc279661700000000, 0x6f7f041d00000000, 0x61ef8fb800000000, + 0x3259628d00000000, 0x3cc9e92800000000, 0x9435b9e600000000, + 0x9aa5324300000000, 0xc913df7600000000, 0xc78354d300000000, + 0xd8ec0f3100000000, 0xd67c849400000000, 0x85ca69a100000000, + 0x8b5ae20400000000, 0x23a6b2ca00000000, 0x2d36396f00000000, + 0x7e80d45a00000000, 0x70105fff00000000, 0x0158134500000000, + 0x0fc898e000000000, 0x5c7e75d500000000, 0x52eefe7000000000, + 0xfa12aebe00000000, 0xf482251b00000000, 0xa734c82e00000000, + 0xa9a4438b00000000, 0xb6cb186900000000, 0xb85b93cc00000000, + 0xebed7ef900000000, 0xe57df55c00000000, 0x4d81a59200000000, + 0x43112e3700000000, 0x10a7c30200000000, 0x1e3748a700000000, + 0x4aaa071600000000, 0x443a8cb300000000, 0x178c618600000000, + 0x191cea2300000000, 0xb1e0baed00000000, 0xbf70314800000000, + 0xecc6dc7d00000000, 0xe25657d800000000, 0xfd390c3a00000000, + 0xf3a9879f00000000, 0xa01f6aaa00000000, 0xae8fe10f00000000, + 0x0673b1c100000000, 0x08e33a6400000000, 0x5b55d75100000000, + 0x55c55cf400000000, 0x248d104e00000000, 0x2a1d9beb00000000, + 0x79ab76de00000000, 0x773bfd7b00000000, 0xdfc7adb500000000, + 0xd157261000000000, 0x82e1cb2500000000, 0x8c71408000000000, + 0x931e1b6200000000, 0x9d8e90c700000000, 0xce387df200000000, + 0xc0a8f65700000000, 0x6854a69900000000, 0x66c42d3c00000000, + 0x3572c00900000000, 0x3be24bac00000000, 0x96e429a600000000, + 0x9874a20300000000, 0xcbc24f3600000000, 0xc552c49300000000, + 0x6dae945d00000000, 0x633e1ff800000000, 0x3088f2cd00000000, + 0x3e18796800000000, 0x2177228a00000000, 0x2fe7a92f00000000, + 0x7c51441a00000000, 0x72c1cfbf00000000, 0xda3d9f7100000000, + 0xd4ad14d400000000, 0x871bf9e100000000, 0x898b724400000000, + 0xf8c33efe00000000, 0xf653b55b00000000, 0xa5e5586e00000000, + 0xab75d3cb00000000, 0x0389830500000000, 0x0d1908a000000000, + 0x5eafe59500000000, 0x503f6e3000000000, 0x4f5035d200000000, + 0x41c0be7700000000, 0x1276534200000000, 0x1ce6d8e700000000, + 0xb41a882900000000, 0xba8a038c00000000, 0xe93ceeb900000000, + 0xe7ac651c00000000}, + {0x0000000000000000, 0x97a61de700000000, 0x6f4b4a1500000000, + 0xf8ed57f200000000, 0xde96942a00000000, 0x493089cd00000000, + 0xb1ddde3f00000000, 0x267bc3d800000000, 0xbc2d295500000000, + 0x2b8b34b200000000, 0xd366634000000000, 0x44c07ea700000000, + 0x62bbbd7f00000000, 0xf51da09800000000, 0x0df0f76a00000000, + 0x9a56ea8d00000000, 0x785b52aa00000000, 0xeffd4f4d00000000, + 0x171018bf00000000, 0x80b6055800000000, 0xa6cdc68000000000, + 0x316bdb6700000000, 0xc9868c9500000000, 0x5e20917200000000, + 0xc4767bff00000000, 0x53d0661800000000, 0xab3d31ea00000000, + 0x3c9b2c0d00000000, 0x1ae0efd500000000, 0x8d46f23200000000, + 0x75aba5c000000000, 0xe20db82700000000, 0xb1b0d58f00000000, + 0x2616c86800000000, 0xdefb9f9a00000000, 0x495d827d00000000, + 0x6f2641a500000000, 0xf8805c4200000000, 0x006d0bb000000000, + 0x97cb165700000000, 0x0d9dfcda00000000, 0x9a3be13d00000000, + 0x62d6b6cf00000000, 0xf570ab2800000000, 0xd30b68f000000000, + 0x44ad751700000000, 0xbc4022e500000000, 0x2be63f0200000000, + 0xc9eb872500000000, 0x5e4d9ac200000000, 0xa6a0cd3000000000, + 0x3106d0d700000000, 0x177d130f00000000, 0x80db0ee800000000, + 0x7836591a00000000, 0xef9044fd00000000, 0x75c6ae7000000000, + 0xe260b39700000000, 0x1a8de46500000000, 0x8d2bf98200000000, + 0xab503a5a00000000, 0x3cf627bd00000000, 0xc41b704f00000000, + 0x53bd6da800000000, 0x2367dac400000000, 0xb4c1c72300000000, + 0x4c2c90d100000000, 0xdb8a8d3600000000, 0xfdf14eee00000000, + 0x6a57530900000000, 0x92ba04fb00000000, 0x051c191c00000000, + 0x9f4af39100000000, 0x08ecee7600000000, 0xf001b98400000000, + 0x67a7a46300000000, 0x41dc67bb00000000, 0xd67a7a5c00000000, + 0x2e972dae00000000, 0xb931304900000000, 0x5b3c886e00000000, + 0xcc9a958900000000, 0x3477c27b00000000, 0xa3d1df9c00000000, + 0x85aa1c4400000000, 0x120c01a300000000, 0xeae1565100000000, + 0x7d474bb600000000, 0xe711a13b00000000, 0x70b7bcdc00000000, + 0x885aeb2e00000000, 0x1ffcf6c900000000, 0x3987351100000000, + 0xae2128f600000000, 0x56cc7f0400000000, 0xc16a62e300000000, + 0x92d70f4b00000000, 0x057112ac00000000, 0xfd9c455e00000000, + 0x6a3a58b900000000, 0x4c419b6100000000, 0xdbe7868600000000, + 0x230ad17400000000, 0xb4accc9300000000, 0x2efa261e00000000, + 0xb95c3bf900000000, 0x41b16c0b00000000, 0xd61771ec00000000, + 0xf06cb23400000000, 0x67caafd300000000, 0x9f27f82100000000, + 0x0881e5c600000000, 0xea8c5de100000000, 0x7d2a400600000000, + 0x85c717f400000000, 0x12610a1300000000, 0x341ac9cb00000000, + 0xa3bcd42c00000000, 0x5b5183de00000000, 0xccf79e3900000000, + 0x56a174b400000000, 0xc107695300000000, 0x39ea3ea100000000, + 0xae4c234600000000, 0x8837e09e00000000, 0x1f91fd7900000000, + 0xe77caa8b00000000, 0x70dab76c00000000, 0x07c8c55200000000, + 0x906ed8b500000000, 0x68838f4700000000, 0xff2592a000000000, + 0xd95e517800000000, 0x4ef84c9f00000000, 0xb6151b6d00000000, + 0x21b3068a00000000, 0xbbe5ec0700000000, 0x2c43f1e000000000, + 0xd4aea61200000000, 0x4308bbf500000000, 0x6573782d00000000, + 0xf2d565ca00000000, 0x0a38323800000000, 0x9d9e2fdf00000000, + 0x7f9397f800000000, 0xe8358a1f00000000, 0x10d8dded00000000, + 0x877ec00a00000000, 0xa10503d200000000, 0x36a31e3500000000, + 0xce4e49c700000000, 0x59e8542000000000, 0xc3bebead00000000, + 0x5418a34a00000000, 0xacf5f4b800000000, 0x3b53e95f00000000, + 0x1d282a8700000000, 0x8a8e376000000000, 0x7263609200000000, + 0xe5c57d7500000000, 0xb67810dd00000000, 0x21de0d3a00000000, + 0xd9335ac800000000, 0x4e95472f00000000, 0x68ee84f700000000, + 0xff48991000000000, 0x07a5cee200000000, 0x9003d30500000000, + 0x0a55398800000000, 0x9df3246f00000000, 0x651e739d00000000, + 0xf2b86e7a00000000, 0xd4c3ada200000000, 0x4365b04500000000, + 0xbb88e7b700000000, 0x2c2efa5000000000, 0xce23427700000000, + 0x59855f9000000000, 0xa168086200000000, 0x36ce158500000000, + 0x10b5d65d00000000, 0x8713cbba00000000, 0x7ffe9c4800000000, + 0xe85881af00000000, 0x720e6b2200000000, 0xe5a876c500000000, + 0x1d45213700000000, 0x8ae33cd000000000, 0xac98ff0800000000, + 0x3b3ee2ef00000000, 0xc3d3b51d00000000, 0x5475a8fa00000000, + 0x24af1f9600000000, 0xb309027100000000, 0x4be4558300000000, + 0xdc42486400000000, 0xfa398bbc00000000, 0x6d9f965b00000000, + 0x9572c1a900000000, 0x02d4dc4e00000000, 0x988236c300000000, + 0x0f242b2400000000, 0xf7c97cd600000000, 0x606f613100000000, + 0x4614a2e900000000, 0xd1b2bf0e00000000, 0x295fe8fc00000000, + 0xbef9f51b00000000, 0x5cf44d3c00000000, 0xcb5250db00000000, + 0x33bf072900000000, 0xa4191ace00000000, 0x8262d91600000000, + 0x15c4c4f100000000, 0xed29930300000000, 0x7a8f8ee400000000, + 0xe0d9646900000000, 0x777f798e00000000, 0x8f922e7c00000000, + 0x1834339b00000000, 0x3e4ff04300000000, 0xa9e9eda400000000, + 0x5104ba5600000000, 0xc6a2a7b100000000, 0x951fca1900000000, + 0x02b9d7fe00000000, 0xfa54800c00000000, 0x6df29deb00000000, + 0x4b895e3300000000, 0xdc2f43d400000000, 0x24c2142600000000, + 0xb36409c100000000, 0x2932e34c00000000, 0xbe94feab00000000, + 0x4679a95900000000, 0xd1dfb4be00000000, 0xf7a4776600000000, + 0x60026a8100000000, 0x98ef3d7300000000, 0x0f49209400000000, + 0xed4498b300000000, 0x7ae2855400000000, 0x820fd2a600000000, + 0x15a9cf4100000000, 0x33d20c9900000000, 0xa474117e00000000, + 0x5c99468c00000000, 0xcb3f5b6b00000000, 0x5169b1e600000000, + 0xc6cfac0100000000, 0x3e22fbf300000000, 0xa984e61400000000, + 0x8fff25cc00000000, 0x1859382b00000000, 0xe0b46fd900000000, + 0x7712723e00000000}, + {0x0000000000000000, 0x411b8c6e00000000, 0x823618dd00000000, + 0xc32d94b300000000, 0x456b416100000000, 0x0470cd0f00000000, + 0xc75d59bc00000000, 0x8646d5d200000000, 0x8ad682c200000000, + 0xcbcd0eac00000000, 0x08e09a1f00000000, 0x49fb167100000000, + 0xcfbdc3a300000000, 0x8ea64fcd00000000, 0x4d8bdb7e00000000, + 0x0c90571000000000, 0x55ab745e00000000, 0x14b0f83000000000, + 0xd79d6c8300000000, 0x9686e0ed00000000, 0x10c0353f00000000, + 0x51dbb95100000000, 0x92f62de200000000, 0xd3eda18c00000000, + 0xdf7df69c00000000, 0x9e667af200000000, 0x5d4bee4100000000, + 0x1c50622f00000000, 0x9a16b7fd00000000, 0xdb0d3b9300000000, + 0x1820af2000000000, 0x593b234e00000000, 0xaa56e9bc00000000, + 0xeb4d65d200000000, 0x2860f16100000000, 0x697b7d0f00000000, + 0xef3da8dd00000000, 0xae2624b300000000, 0x6d0bb00000000000, + 0x2c103c6e00000000, 0x20806b7e00000000, 0x619be71000000000, + 0xa2b673a300000000, 0xe3adffcd00000000, 0x65eb2a1f00000000, + 0x24f0a67100000000, 0xe7dd32c200000000, 0xa6c6beac00000000, + 0xfffd9de200000000, 0xbee6118c00000000, 0x7dcb853f00000000, + 0x3cd0095100000000, 0xba96dc8300000000, 0xfb8d50ed00000000, + 0x38a0c45e00000000, 0x79bb483000000000, 0x752b1f2000000000, + 0x3430934e00000000, 0xf71d07fd00000000, 0xb6068b9300000000, + 0x30405e4100000000, 0x715bd22f00000000, 0xb276469c00000000, + 0xf36dcaf200000000, 0x15aba3a200000000, 0x54b02fcc00000000, + 0x979dbb7f00000000, 0xd686371100000000, 0x50c0e2c300000000, + 0x11db6ead00000000, 0xd2f6fa1e00000000, 0x93ed767000000000, + 0x9f7d216000000000, 0xde66ad0e00000000, 0x1d4b39bd00000000, + 0x5c50b5d300000000, 0xda16600100000000, 0x9b0dec6f00000000, + 0x582078dc00000000, 0x193bf4b200000000, 0x4000d7fc00000000, + 0x011b5b9200000000, 0xc236cf2100000000, 0x832d434f00000000, + 0x056b969d00000000, 0x44701af300000000, 0x875d8e4000000000, + 0xc646022e00000000, 0xcad6553e00000000, 0x8bcdd95000000000, + 0x48e04de300000000, 0x09fbc18d00000000, 0x8fbd145f00000000, + 0xcea6983100000000, 0x0d8b0c8200000000, 0x4c9080ec00000000, + 0xbffd4a1e00000000, 0xfee6c67000000000, 0x3dcb52c300000000, + 0x7cd0dead00000000, 0xfa960b7f00000000, 0xbb8d871100000000, + 0x78a013a200000000, 0x39bb9fcc00000000, 0x352bc8dc00000000, + 0x743044b200000000, 0xb71dd00100000000, 0xf6065c6f00000000, + 0x704089bd00000000, 0x315b05d300000000, 0xf276916000000000, + 0xb36d1d0e00000000, 0xea563e4000000000, 0xab4db22e00000000, + 0x6860269d00000000, 0x297baaf300000000, 0xaf3d7f2100000000, + 0xee26f34f00000000, 0x2d0b67fc00000000, 0x6c10eb9200000000, + 0x6080bc8200000000, 0x219b30ec00000000, 0xe2b6a45f00000000, + 0xa3ad283100000000, 0x25ebfde300000000, 0x64f0718d00000000, + 0xa7dde53e00000000, 0xe6c6695000000000, 0x6b50369e00000000, + 0x2a4bbaf000000000, 0xe9662e4300000000, 0xa87da22d00000000, + 0x2e3b77ff00000000, 0x6f20fb9100000000, 0xac0d6f2200000000, + 0xed16e34c00000000, 0xe186b45c00000000, 0xa09d383200000000, + 0x63b0ac8100000000, 0x22ab20ef00000000, 0xa4edf53d00000000, + 0xe5f6795300000000, 0x26dbede000000000, 0x67c0618e00000000, + 0x3efb42c000000000, 0x7fe0ceae00000000, 0xbccd5a1d00000000, + 0xfdd6d67300000000, 0x7b9003a100000000, 0x3a8b8fcf00000000, + 0xf9a61b7c00000000, 0xb8bd971200000000, 0xb42dc00200000000, + 0xf5364c6c00000000, 0x361bd8df00000000, 0x770054b100000000, + 0xf146816300000000, 0xb05d0d0d00000000, 0x737099be00000000, + 0x326b15d000000000, 0xc106df2200000000, 0x801d534c00000000, + 0x4330c7ff00000000, 0x022b4b9100000000, 0x846d9e4300000000, + 0xc576122d00000000, 0x065b869e00000000, 0x47400af000000000, + 0x4bd05de000000000, 0x0acbd18e00000000, 0xc9e6453d00000000, + 0x88fdc95300000000, 0x0ebb1c8100000000, 0x4fa090ef00000000, + 0x8c8d045c00000000, 0xcd96883200000000, 0x94adab7c00000000, + 0xd5b6271200000000, 0x169bb3a100000000, 0x57803fcf00000000, + 0xd1c6ea1d00000000, 0x90dd667300000000, 0x53f0f2c000000000, + 0x12eb7eae00000000, 0x1e7b29be00000000, 0x5f60a5d000000000, + 0x9c4d316300000000, 0xdd56bd0d00000000, 0x5b1068df00000000, + 0x1a0be4b100000000, 0xd926700200000000, 0x983dfc6c00000000, + 0x7efb953c00000000, 0x3fe0195200000000, 0xfccd8de100000000, + 0xbdd6018f00000000, 0x3b90d45d00000000, 0x7a8b583300000000, + 0xb9a6cc8000000000, 0xf8bd40ee00000000, 0xf42d17fe00000000, + 0xb5369b9000000000, 0x761b0f2300000000, 0x3700834d00000000, + 0xb146569f00000000, 0xf05ddaf100000000, 0x33704e4200000000, + 0x726bc22c00000000, 0x2b50e16200000000, 0x6a4b6d0c00000000, + 0xa966f9bf00000000, 0xe87d75d100000000, 0x6e3ba00300000000, + 0x2f202c6d00000000, 0xec0db8de00000000, 0xad1634b000000000, + 0xa18663a000000000, 0xe09defce00000000, 0x23b07b7d00000000, + 0x62abf71300000000, 0xe4ed22c100000000, 0xa5f6aeaf00000000, + 0x66db3a1c00000000, 0x27c0b67200000000, 0xd4ad7c8000000000, + 0x95b6f0ee00000000, 0x569b645d00000000, 0x1780e83300000000, + 0x91c63de100000000, 0xd0ddb18f00000000, 0x13f0253c00000000, + 0x52eba95200000000, 0x5e7bfe4200000000, 0x1f60722c00000000, + 0xdc4de69f00000000, 0x9d566af100000000, 0x1b10bf2300000000, + 0x5a0b334d00000000, 0x9926a7fe00000000, 0xd83d2b9000000000, + 0x810608de00000000, 0xc01d84b000000000, 0x0330100300000000, + 0x422b9c6d00000000, 0xc46d49bf00000000, 0x8576c5d100000000, + 0x465b516200000000, 0x0740dd0c00000000, 0x0bd08a1c00000000, + 0x4acb067200000000, 0x89e692c100000000, 0xc8fd1eaf00000000, + 0x4ebbcb7d00000000, 0x0fa0471300000000, 0xcc8dd3a000000000, + 0x8d965fce00000000}, + {0x0000000000000000, 0x1dfdb50100000000, 0x3afa6b0300000000, + 0x2707de0200000000, 0x74f4d70600000000, 0x6909620700000000, + 0x4e0ebc0500000000, 0x53f3090400000000, 0xe8e8af0d00000000, + 0xf5151a0c00000000, 0xd212c40e00000000, 0xcfef710f00000000, + 0x9c1c780b00000000, 0x81e1cd0a00000000, 0xa6e6130800000000, + 0xbb1ba60900000000, 0xd0d15f1b00000000, 0xcd2cea1a00000000, + 0xea2b341800000000, 0xf7d6811900000000, 0xa425881d00000000, + 0xb9d83d1c00000000, 0x9edfe31e00000000, 0x8322561f00000000, + 0x3839f01600000000, 0x25c4451700000000, 0x02c39b1500000000, + 0x1f3e2e1400000000, 0x4ccd271000000000, 0x5130921100000000, + 0x76374c1300000000, 0x6bcaf91200000000, 0xa0a3bf3600000000, + 0xbd5e0a3700000000, 0x9a59d43500000000, 0x87a4613400000000, + 0xd457683000000000, 0xc9aadd3100000000, 0xeead033300000000, + 0xf350b63200000000, 0x484b103b00000000, 0x55b6a53a00000000, + 0x72b17b3800000000, 0x6f4cce3900000000, 0x3cbfc73d00000000, + 0x2142723c00000000, 0x0645ac3e00000000, 0x1bb8193f00000000, + 0x7072e02d00000000, 0x6d8f552c00000000, 0x4a888b2e00000000, + 0x57753e2f00000000, 0x0486372b00000000, 0x197b822a00000000, + 0x3e7c5c2800000000, 0x2381e92900000000, 0x989a4f2000000000, + 0x8567fa2100000000, 0xa260242300000000, 0xbf9d912200000000, + 0xec6e982600000000, 0xf1932d2700000000, 0xd694f32500000000, + 0xcb69462400000000, 0x40477f6d00000000, 0x5dbaca6c00000000, + 0x7abd146e00000000, 0x6740a16f00000000, 0x34b3a86b00000000, + 0x294e1d6a00000000, 0x0e49c36800000000, 0x13b4766900000000, + 0xa8afd06000000000, 0xb552656100000000, 0x9255bb6300000000, + 0x8fa80e6200000000, 0xdc5b076600000000, 0xc1a6b26700000000, + 0xe6a16c6500000000, 0xfb5cd96400000000, 0x9096207600000000, + 0x8d6b957700000000, 0xaa6c4b7500000000, 0xb791fe7400000000, + 0xe462f77000000000, 0xf99f427100000000, 0xde989c7300000000, + 0xc365297200000000, 0x787e8f7b00000000, 0x65833a7a00000000, + 0x4284e47800000000, 0x5f79517900000000, 0x0c8a587d00000000, + 0x1177ed7c00000000, 0x3670337e00000000, 0x2b8d867f00000000, + 0xe0e4c05b00000000, 0xfd19755a00000000, 0xda1eab5800000000, + 0xc7e31e5900000000, 0x9410175d00000000, 0x89eda25c00000000, + 0xaeea7c5e00000000, 0xb317c95f00000000, 0x080c6f5600000000, + 0x15f1da5700000000, 0x32f6045500000000, 0x2f0bb15400000000, + 0x7cf8b85000000000, 0x61050d5100000000, 0x4602d35300000000, + 0x5bff665200000000, 0x30359f4000000000, 0x2dc82a4100000000, + 0x0acff44300000000, 0x1732414200000000, 0x44c1484600000000, + 0x593cfd4700000000, 0x7e3b234500000000, 0x63c6964400000000, + 0xd8dd304d00000000, 0xc520854c00000000, 0xe2275b4e00000000, + 0xffdaee4f00000000, 0xac29e74b00000000, 0xb1d4524a00000000, + 0x96d38c4800000000, 0x8b2e394900000000, 0x808efeda00000000, + 0x9d734bdb00000000, 0xba7495d900000000, 0xa78920d800000000, + 0xf47a29dc00000000, 0xe9879cdd00000000, 0xce8042df00000000, + 0xd37df7de00000000, 0x686651d700000000, 0x759be4d600000000, + 0x529c3ad400000000, 0x4f618fd500000000, 0x1c9286d100000000, + 0x016f33d000000000, 0x2668edd200000000, 0x3b9558d300000000, + 0x505fa1c100000000, 0x4da214c000000000, 0x6aa5cac200000000, + 0x77587fc300000000, 0x24ab76c700000000, 0x3956c3c600000000, + 0x1e511dc400000000, 0x03aca8c500000000, 0xb8b70ecc00000000, + 0xa54abbcd00000000, 0x824d65cf00000000, 0x9fb0d0ce00000000, + 0xcc43d9ca00000000, 0xd1be6ccb00000000, 0xf6b9b2c900000000, + 0xeb4407c800000000, 0x202d41ec00000000, 0x3dd0f4ed00000000, + 0x1ad72aef00000000, 0x072a9fee00000000, 0x54d996ea00000000, + 0x492423eb00000000, 0x6e23fde900000000, 0x73de48e800000000, + 0xc8c5eee100000000, 0xd5385be000000000, 0xf23f85e200000000, + 0xefc230e300000000, 0xbc3139e700000000, 0xa1cc8ce600000000, + 0x86cb52e400000000, 0x9b36e7e500000000, 0xf0fc1ef700000000, + 0xed01abf600000000, 0xca0675f400000000, 0xd7fbc0f500000000, + 0x8408c9f100000000, 0x99f57cf000000000, 0xbef2a2f200000000, + 0xa30f17f300000000, 0x1814b1fa00000000, 0x05e904fb00000000, + 0x22eedaf900000000, 0x3f136ff800000000, 0x6ce066fc00000000, + 0x711dd3fd00000000, 0x561a0dff00000000, 0x4be7b8fe00000000, + 0xc0c981b700000000, 0xdd3434b600000000, 0xfa33eab400000000, + 0xe7ce5fb500000000, 0xb43d56b100000000, 0xa9c0e3b000000000, + 0x8ec73db200000000, 0x933a88b300000000, 0x28212eba00000000, + 0x35dc9bbb00000000, 0x12db45b900000000, 0x0f26f0b800000000, + 0x5cd5f9bc00000000, 0x41284cbd00000000, 0x662f92bf00000000, + 0x7bd227be00000000, 0x1018deac00000000, 0x0de56bad00000000, + 0x2ae2b5af00000000, 0x371f00ae00000000, 0x64ec09aa00000000, + 0x7911bcab00000000, 0x5e1662a900000000, 0x43ebd7a800000000, + 0xf8f071a100000000, 0xe50dc4a000000000, 0xc20a1aa200000000, + 0xdff7afa300000000, 0x8c04a6a700000000, 0x91f913a600000000, + 0xb6fecda400000000, 0xab0378a500000000, 0x606a3e8100000000, + 0x7d978b8000000000, 0x5a90558200000000, 0x476de08300000000, + 0x149ee98700000000, 0x09635c8600000000, 0x2e64828400000000, + 0x3399378500000000, 0x8882918c00000000, 0x957f248d00000000, + 0xb278fa8f00000000, 0xaf854f8e00000000, 0xfc76468a00000000, + 0xe18bf38b00000000, 0xc68c2d8900000000, 0xdb71988800000000, + 0xb0bb619a00000000, 0xad46d49b00000000, 0x8a410a9900000000, + 0x97bcbf9800000000, 0xc44fb69c00000000, 0xd9b2039d00000000, + 0xfeb5dd9f00000000, 0xe348689e00000000, 0x5853ce9700000000, + 0x45ae7b9600000000, 0x62a9a59400000000, 0x7f54109500000000, + 0x2ca7199100000000, 0x315aac9000000000, 0x165d729200000000, + 0x0ba0c79300000000}, + {0x0000000000000000, 0x24d9076300000000, 0x48b20fc600000000, + 0x6c6b08a500000000, 0xd1626e5700000000, 0xf5bb693400000000, + 0x99d0619100000000, 0xbd0966f200000000, 0xa2c5dcae00000000, + 0x861cdbcd00000000, 0xea77d36800000000, 0xceaed40b00000000, + 0x73a7b2f900000000, 0x577eb59a00000000, 0x3b15bd3f00000000, + 0x1fccba5c00000000, 0x058dc88600000000, 0x2154cfe500000000, + 0x4d3fc74000000000, 0x69e6c02300000000, 0xd4efa6d100000000, + 0xf036a1b200000000, 0x9c5da91700000000, 0xb884ae7400000000, + 0xa748142800000000, 0x8391134b00000000, 0xeffa1bee00000000, + 0xcb231c8d00000000, 0x762a7a7f00000000, 0x52f37d1c00000000, + 0x3e9875b900000000, 0x1a4172da00000000, 0x4b1ce0d600000000, + 0x6fc5e7b500000000, 0x03aeef1000000000, 0x2777e87300000000, + 0x9a7e8e8100000000, 0xbea789e200000000, 0xd2cc814700000000, + 0xf615862400000000, 0xe9d93c7800000000, 0xcd003b1b00000000, + 0xa16b33be00000000, 0x85b234dd00000000, 0x38bb522f00000000, + 0x1c62554c00000000, 0x70095de900000000, 0x54d05a8a00000000, + 0x4e91285000000000, 0x6a482f3300000000, 0x0623279600000000, + 0x22fa20f500000000, 0x9ff3460700000000, 0xbb2a416400000000, + 0xd74149c100000000, 0xf3984ea200000000, 0xec54f4fe00000000, + 0xc88df39d00000000, 0xa4e6fb3800000000, 0x803ffc5b00000000, + 0x3d369aa900000000, 0x19ef9dca00000000, 0x7584956f00000000, + 0x515d920c00000000, 0xd73eb17600000000, 0xf3e7b61500000000, + 0x9f8cbeb000000000, 0xbb55b9d300000000, 0x065cdf2100000000, + 0x2285d84200000000, 0x4eeed0e700000000, 0x6a37d78400000000, + 0x75fb6dd800000000, 0x51226abb00000000, 0x3d49621e00000000, + 0x1990657d00000000, 0xa499038f00000000, 0x804004ec00000000, + 0xec2b0c4900000000, 0xc8f20b2a00000000, 0xd2b379f000000000, + 0xf66a7e9300000000, 0x9a01763600000000, 0xbed8715500000000, + 0x03d117a700000000, 0x270810c400000000, 0x4b63186100000000, + 0x6fba1f0200000000, 0x7076a55e00000000, 0x54afa23d00000000, + 0x38c4aa9800000000, 0x1c1dadfb00000000, 0xa114cb0900000000, + 0x85cdcc6a00000000, 0xe9a6c4cf00000000, 0xcd7fc3ac00000000, + 0x9c2251a000000000, 0xb8fb56c300000000, 0xd4905e6600000000, + 0xf049590500000000, 0x4d403ff700000000, 0x6999389400000000, + 0x05f2303100000000, 0x212b375200000000, 0x3ee78d0e00000000, + 0x1a3e8a6d00000000, 0x765582c800000000, 0x528c85ab00000000, + 0xef85e35900000000, 0xcb5ce43a00000000, 0xa737ec9f00000000, + 0x83eeebfc00000000, 0x99af992600000000, 0xbd769e4500000000, + 0xd11d96e000000000, 0xf5c4918300000000, 0x48cdf77100000000, + 0x6c14f01200000000, 0x007ff8b700000000, 0x24a6ffd400000000, + 0x3b6a458800000000, 0x1fb342eb00000000, 0x73d84a4e00000000, + 0x57014d2d00000000, 0xea082bdf00000000, 0xced12cbc00000000, + 0xa2ba241900000000, 0x8663237a00000000, 0xae7d62ed00000000, + 0x8aa4658e00000000, 0xe6cf6d2b00000000, 0xc2166a4800000000, + 0x7f1f0cba00000000, 0x5bc60bd900000000, 0x37ad037c00000000, + 0x1374041f00000000, 0x0cb8be4300000000, 0x2861b92000000000, + 0x440ab18500000000, 0x60d3b6e600000000, 0xdddad01400000000, + 0xf903d77700000000, 0x9568dfd200000000, 0xb1b1d8b100000000, + 0xabf0aa6b00000000, 0x8f29ad0800000000, 0xe342a5ad00000000, + 0xc79ba2ce00000000, 0x7a92c43c00000000, 0x5e4bc35f00000000, + 0x3220cbfa00000000, 0x16f9cc9900000000, 0x093576c500000000, + 0x2dec71a600000000, 0x4187790300000000, 0x655e7e6000000000, + 0xd857189200000000, 0xfc8e1ff100000000, 0x90e5175400000000, + 0xb43c103700000000, 0xe561823b00000000, 0xc1b8855800000000, + 0xadd38dfd00000000, 0x890a8a9e00000000, 0x3403ec6c00000000, + 0x10daeb0f00000000, 0x7cb1e3aa00000000, 0x5868e4c900000000, + 0x47a45e9500000000, 0x637d59f600000000, 0x0f16515300000000, + 0x2bcf563000000000, 0x96c630c200000000, 0xb21f37a100000000, + 0xde743f0400000000, 0xfaad386700000000, 0xe0ec4abd00000000, + 0xc4354dde00000000, 0xa85e457b00000000, 0x8c87421800000000, + 0x318e24ea00000000, 0x1557238900000000, 0x793c2b2c00000000, + 0x5de52c4f00000000, 0x4229961300000000, 0x66f0917000000000, + 0x0a9b99d500000000, 0x2e429eb600000000, 0x934bf84400000000, + 0xb792ff2700000000, 0xdbf9f78200000000, 0xff20f0e100000000, + 0x7943d39b00000000, 0x5d9ad4f800000000, 0x31f1dc5d00000000, + 0x1528db3e00000000, 0xa821bdcc00000000, 0x8cf8baaf00000000, + 0xe093b20a00000000, 0xc44ab56900000000, 0xdb860f3500000000, + 0xff5f085600000000, 0x933400f300000000, 0xb7ed079000000000, + 0x0ae4616200000000, 0x2e3d660100000000, 0x42566ea400000000, + 0x668f69c700000000, 0x7cce1b1d00000000, 0x58171c7e00000000, + 0x347c14db00000000, 0x10a513b800000000, 0xadac754a00000000, + 0x8975722900000000, 0xe51e7a8c00000000, 0xc1c77def00000000, + 0xde0bc7b300000000, 0xfad2c0d000000000, 0x96b9c87500000000, + 0xb260cf1600000000, 0x0f69a9e400000000, 0x2bb0ae8700000000, + 0x47dba62200000000, 0x6302a14100000000, 0x325f334d00000000, + 0x1686342e00000000, 0x7aed3c8b00000000, 0x5e343be800000000, + 0xe33d5d1a00000000, 0xc7e45a7900000000, 0xab8f52dc00000000, + 0x8f5655bf00000000, 0x909aefe300000000, 0xb443e88000000000, + 0xd828e02500000000, 0xfcf1e74600000000, 0x41f881b400000000, + 0x652186d700000000, 0x094a8e7200000000, 0x2d93891100000000, + 0x37d2fbcb00000000, 0x130bfca800000000, 0x7f60f40d00000000, + 0x5bb9f36e00000000, 0xe6b0959c00000000, 0xc26992ff00000000, + 0xae029a5a00000000, 0x8adb9d3900000000, 0x9517276500000000, + 0xb1ce200600000000, 0xdda528a300000000, 0xf97c2fc000000000, + 0x4475493200000000, 0x60ac4e5100000000, 0x0cc746f400000000, + 0x281e419700000000}, + {0x0000000000000000, 0x08e3603c00000000, 0x10c6c17800000000, + 0x1825a14400000000, 0x208c83f100000000, 0x286fe3cd00000000, + 0x304a428900000000, 0x38a922b500000000, 0x011e763800000000, + 0x09fd160400000000, 0x11d8b74000000000, 0x193bd77c00000000, + 0x2192f5c900000000, 0x297195f500000000, 0x315434b100000000, + 0x39b7548d00000000, 0x023cec7000000000, 0x0adf8c4c00000000, + 0x12fa2d0800000000, 0x1a194d3400000000, 0x22b06f8100000000, + 0x2a530fbd00000000, 0x3276aef900000000, 0x3a95cec500000000, + 0x03229a4800000000, 0x0bc1fa7400000000, 0x13e45b3000000000, + 0x1b073b0c00000000, 0x23ae19b900000000, 0x2b4d798500000000, + 0x3368d8c100000000, 0x3b8bb8fd00000000, 0x0478d8e100000000, + 0x0c9bb8dd00000000, 0x14be199900000000, 0x1c5d79a500000000, + 0x24f45b1000000000, 0x2c173b2c00000000, 0x34329a6800000000, + 0x3cd1fa5400000000, 0x0566aed900000000, 0x0d85cee500000000, + 0x15a06fa100000000, 0x1d430f9d00000000, 0x25ea2d2800000000, + 0x2d094d1400000000, 0x352cec5000000000, 0x3dcf8c6c00000000, + 0x0644349100000000, 0x0ea754ad00000000, 0x1682f5e900000000, + 0x1e6195d500000000, 0x26c8b76000000000, 0x2e2bd75c00000000, + 0x360e761800000000, 0x3eed162400000000, 0x075a42a900000000, + 0x0fb9229500000000, 0x179c83d100000000, 0x1f7fe3ed00000000, + 0x27d6c15800000000, 0x2f35a16400000000, 0x3710002000000000, + 0x3ff3601c00000000, 0x49f6c11800000000, 0x4115a12400000000, + 0x5930006000000000, 0x51d3605c00000000, 0x697a42e900000000, + 0x619922d500000000, 0x79bc839100000000, 0x715fe3ad00000000, + 0x48e8b72000000000, 0x400bd71c00000000, 0x582e765800000000, + 0x50cd166400000000, 0x686434d100000000, 0x608754ed00000000, + 0x78a2f5a900000000, 0x7041959500000000, 0x4bca2d6800000000, + 0x43294d5400000000, 0x5b0cec1000000000, 0x53ef8c2c00000000, + 0x6b46ae9900000000, 0x63a5cea500000000, 0x7b806fe100000000, + 0x73630fdd00000000, 0x4ad45b5000000000, 0x42373b6c00000000, + 0x5a129a2800000000, 0x52f1fa1400000000, 0x6a58d8a100000000, + 0x62bbb89d00000000, 0x7a9e19d900000000, 0x727d79e500000000, + 0x4d8e19f900000000, 0x456d79c500000000, 0x5d48d88100000000, + 0x55abb8bd00000000, 0x6d029a0800000000, 0x65e1fa3400000000, + 0x7dc45b7000000000, 0x75273b4c00000000, 0x4c906fc100000000, + 0x44730ffd00000000, 0x5c56aeb900000000, 0x54b5ce8500000000, + 0x6c1cec3000000000, 0x64ff8c0c00000000, 0x7cda2d4800000000, + 0x74394d7400000000, 0x4fb2f58900000000, 0x475195b500000000, + 0x5f7434f100000000, 0x579754cd00000000, 0x6f3e767800000000, + 0x67dd164400000000, 0x7ff8b70000000000, 0x771bd73c00000000, + 0x4eac83b100000000, 0x464fe38d00000000, 0x5e6a42c900000000, + 0x568922f500000000, 0x6e20004000000000, 0x66c3607c00000000, + 0x7ee6c13800000000, 0x7605a10400000000, 0x92ec833100000000, + 0x9a0fe30d00000000, 0x822a424900000000, 0x8ac9227500000000, + 0xb26000c000000000, 0xba8360fc00000000, 0xa2a6c1b800000000, + 0xaa45a18400000000, 0x93f2f50900000000, 0x9b11953500000000, + 0x8334347100000000, 0x8bd7544d00000000, 0xb37e76f800000000, + 0xbb9d16c400000000, 0xa3b8b78000000000, 0xab5bd7bc00000000, + 0x90d06f4100000000, 0x98330f7d00000000, 0x8016ae3900000000, + 0x88f5ce0500000000, 0xb05cecb000000000, 0xb8bf8c8c00000000, + 0xa09a2dc800000000, 0xa8794df400000000, 0x91ce197900000000, + 0x992d794500000000, 0x8108d80100000000, 0x89ebb83d00000000, + 0xb1429a8800000000, 0xb9a1fab400000000, 0xa1845bf000000000, + 0xa9673bcc00000000, 0x96945bd000000000, 0x9e773bec00000000, + 0x86529aa800000000, 0x8eb1fa9400000000, 0xb618d82100000000, + 0xbefbb81d00000000, 0xa6de195900000000, 0xae3d796500000000, + 0x978a2de800000000, 0x9f694dd400000000, 0x874cec9000000000, + 0x8faf8cac00000000, 0xb706ae1900000000, 0xbfe5ce2500000000, + 0xa7c06f6100000000, 0xaf230f5d00000000, 0x94a8b7a000000000, + 0x9c4bd79c00000000, 0x846e76d800000000, 0x8c8d16e400000000, + 0xb424345100000000, 0xbcc7546d00000000, 0xa4e2f52900000000, + 0xac01951500000000, 0x95b6c19800000000, 0x9d55a1a400000000, + 0x857000e000000000, 0x8d9360dc00000000, 0xb53a426900000000, + 0xbdd9225500000000, 0xa5fc831100000000, 0xad1fe32d00000000, + 0xdb1a422900000000, 0xd3f9221500000000, 0xcbdc835100000000, + 0xc33fe36d00000000, 0xfb96c1d800000000, 0xf375a1e400000000, + 0xeb5000a000000000, 0xe3b3609c00000000, 0xda04341100000000, + 0xd2e7542d00000000, 0xcac2f56900000000, 0xc221955500000000, + 0xfa88b7e000000000, 0xf26bd7dc00000000, 0xea4e769800000000, + 0xe2ad16a400000000, 0xd926ae5900000000, 0xd1c5ce6500000000, + 0xc9e06f2100000000, 0xc1030f1d00000000, 0xf9aa2da800000000, + 0xf1494d9400000000, 0xe96cecd000000000, 0xe18f8cec00000000, + 0xd838d86100000000, 0xd0dbb85d00000000, 0xc8fe191900000000, + 0xc01d792500000000, 0xf8b45b9000000000, 0xf0573bac00000000, + 0xe8729ae800000000, 0xe091fad400000000, 0xdf629ac800000000, + 0xd781faf400000000, 0xcfa45bb000000000, 0xc7473b8c00000000, + 0xffee193900000000, 0xf70d790500000000, 0xef28d84100000000, + 0xe7cbb87d00000000, 0xde7cecf000000000, 0xd69f8ccc00000000, + 0xceba2d8800000000, 0xc6594db400000000, 0xfef06f0100000000, + 0xf6130f3d00000000, 0xee36ae7900000000, 0xe6d5ce4500000000, + 0xdd5e76b800000000, 0xd5bd168400000000, 0xcd98b7c000000000, + 0xc57bd7fc00000000, 0xfdd2f54900000000, 0xf531957500000000, + 0xed14343100000000, 0xe5f7540d00000000, 0xdc40008000000000, + 0xd4a360bc00000000, 0xcc86c1f800000000, 0xc465a1c400000000, + 0xfccc837100000000, 0xf42fe34d00000000, 0xec0a420900000000, + 0xe4e9223500000000}, + {0x0000000000000000, 0xd1e8e70e00000000, 0xa2d1cf1d00000000, + 0x7339281300000000, 0x44a39f3b00000000, 0x954b783500000000, + 0xe672502600000000, 0x379ab72800000000, 0x88463f7700000000, + 0x59aed87900000000, 0x2a97f06a00000000, 0xfb7f176400000000, + 0xcce5a04c00000000, 0x1d0d474200000000, 0x6e346f5100000000, + 0xbfdc885f00000000, 0x108d7eee00000000, 0xc16599e000000000, + 0xb25cb1f300000000, 0x63b456fd00000000, 0x542ee1d500000000, + 0x85c606db00000000, 0xf6ff2ec800000000, 0x2717c9c600000000, + 0x98cb419900000000, 0x4923a69700000000, 0x3a1a8e8400000000, + 0xebf2698a00000000, 0xdc68dea200000000, 0x0d8039ac00000000, + 0x7eb911bf00000000, 0xaf51f6b100000000, 0x611c8c0700000000, + 0xb0f46b0900000000, 0xc3cd431a00000000, 0x1225a41400000000, + 0x25bf133c00000000, 0xf457f43200000000, 0x876edc2100000000, + 0x56863b2f00000000, 0xe95ab37000000000, 0x38b2547e00000000, + 0x4b8b7c6d00000000, 0x9a639b6300000000, 0xadf92c4b00000000, + 0x7c11cb4500000000, 0x0f28e35600000000, 0xdec0045800000000, + 0x7191f2e900000000, 0xa07915e700000000, 0xd3403df400000000, + 0x02a8dafa00000000, 0x35326dd200000000, 0xe4da8adc00000000, + 0x97e3a2cf00000000, 0x460b45c100000000, 0xf9d7cd9e00000000, + 0x283f2a9000000000, 0x5b06028300000000, 0x8aeee58d00000000, + 0xbd7452a500000000, 0x6c9cb5ab00000000, 0x1fa59db800000000, + 0xce4d7ab600000000, 0xc238180f00000000, 0x13d0ff0100000000, + 0x60e9d71200000000, 0xb101301c00000000, 0x869b873400000000, + 0x5773603a00000000, 0x244a482900000000, 0xf5a2af2700000000, + 0x4a7e277800000000, 0x9b96c07600000000, 0xe8afe86500000000, + 0x39470f6b00000000, 0x0eddb84300000000, 0xdf355f4d00000000, + 0xac0c775e00000000, 0x7de4905000000000, 0xd2b566e100000000, + 0x035d81ef00000000, 0x7064a9fc00000000, 0xa18c4ef200000000, + 0x9616f9da00000000, 0x47fe1ed400000000, 0x34c736c700000000, + 0xe52fd1c900000000, 0x5af3599600000000, 0x8b1bbe9800000000, + 0xf822968b00000000, 0x29ca718500000000, 0x1e50c6ad00000000, + 0xcfb821a300000000, 0xbc8109b000000000, 0x6d69eebe00000000, + 0xa324940800000000, 0x72cc730600000000, 0x01f55b1500000000, + 0xd01dbc1b00000000, 0xe7870b3300000000, 0x366fec3d00000000, + 0x4556c42e00000000, 0x94be232000000000, 0x2b62ab7f00000000, + 0xfa8a4c7100000000, 0x89b3646200000000, 0x585b836c00000000, + 0x6fc1344400000000, 0xbe29d34a00000000, 0xcd10fb5900000000, + 0x1cf81c5700000000, 0xb3a9eae600000000, 0x62410de800000000, + 0x117825fb00000000, 0xc090c2f500000000, 0xf70a75dd00000000, + 0x26e292d300000000, 0x55dbbac000000000, 0x84335dce00000000, + 0x3befd59100000000, 0xea07329f00000000, 0x993e1a8c00000000, + 0x48d6fd8200000000, 0x7f4c4aaa00000000, 0xaea4ada400000000, + 0xdd9d85b700000000, 0x0c7562b900000000, 0x8471301e00000000, + 0x5599d71000000000, 0x26a0ff0300000000, 0xf748180d00000000, + 0xc0d2af2500000000, 0x113a482b00000000, 0x6203603800000000, + 0xb3eb873600000000, 0x0c370f6900000000, 0xdddfe86700000000, + 0xaee6c07400000000, 0x7f0e277a00000000, 0x4894905200000000, + 0x997c775c00000000, 0xea455f4f00000000, 0x3badb84100000000, + 0x94fc4ef000000000, 0x4514a9fe00000000, 0x362d81ed00000000, + 0xe7c566e300000000, 0xd05fd1cb00000000, 0x01b736c500000000, + 0x728e1ed600000000, 0xa366f9d800000000, 0x1cba718700000000, + 0xcd52968900000000, 0xbe6bbe9a00000000, 0x6f83599400000000, + 0x5819eebc00000000, 0x89f109b200000000, 0xfac821a100000000, + 0x2b20c6af00000000, 0xe56dbc1900000000, 0x34855b1700000000, + 0x47bc730400000000, 0x9654940a00000000, 0xa1ce232200000000, + 0x7026c42c00000000, 0x031fec3f00000000, 0xd2f70b3100000000, + 0x6d2b836e00000000, 0xbcc3646000000000, 0xcffa4c7300000000, + 0x1e12ab7d00000000, 0x29881c5500000000, 0xf860fb5b00000000, + 0x8b59d34800000000, 0x5ab1344600000000, 0xf5e0c2f700000000, + 0x240825f900000000, 0x57310dea00000000, 0x86d9eae400000000, + 0xb1435dcc00000000, 0x60abbac200000000, 0x139292d100000000, + 0xc27a75df00000000, 0x7da6fd8000000000, 0xac4e1a8e00000000, + 0xdf77329d00000000, 0x0e9fd59300000000, 0x390562bb00000000, + 0xe8ed85b500000000, 0x9bd4ada600000000, 0x4a3c4aa800000000, + 0x4649281100000000, 0x97a1cf1f00000000, 0xe498e70c00000000, + 0x3570000200000000, 0x02eab72a00000000, 0xd302502400000000, + 0xa03b783700000000, 0x71d39f3900000000, 0xce0f176600000000, + 0x1fe7f06800000000, 0x6cded87b00000000, 0xbd363f7500000000, + 0x8aac885d00000000, 0x5b446f5300000000, 0x287d474000000000, + 0xf995a04e00000000, 0x56c456ff00000000, 0x872cb1f100000000, + 0xf41599e200000000, 0x25fd7eec00000000, 0x1267c9c400000000, + 0xc38f2eca00000000, 0xb0b606d900000000, 0x615ee1d700000000, + 0xde82698800000000, 0x0f6a8e8600000000, 0x7c53a69500000000, + 0xadbb419b00000000, 0x9a21f6b300000000, 0x4bc911bd00000000, + 0x38f039ae00000000, 0xe918dea000000000, 0x2755a41600000000, + 0xf6bd431800000000, 0x85846b0b00000000, 0x546c8c0500000000, + 0x63f63b2d00000000, 0xb21edc2300000000, 0xc127f43000000000, + 0x10cf133e00000000, 0xaf139b6100000000, 0x7efb7c6f00000000, + 0x0dc2547c00000000, 0xdc2ab37200000000, 0xebb0045a00000000, + 0x3a58e35400000000, 0x4961cb4700000000, 0x98892c4900000000, + 0x37d8daf800000000, 0xe6303df600000000, 0x950915e500000000, + 0x44e1f2eb00000000, 0x737b45c300000000, 0xa293a2cd00000000, + 0xd1aa8ade00000000, 0x00426dd000000000, 0xbf9ee58f00000000, + 0x6e76028100000000, 0x1d4f2a9200000000, 0xcca7cd9c00000000, + 0xfb3d7ab400000000, 0x2ad59dba00000000, 0x59ecb5a900000000, + 0x880452a700000000}, + {0x0000000000000000, 0xaa05daf100000000, 0x150dc53800000000, + 0xbf081fc900000000, 0x2a1a8a7100000000, 0x801f508000000000, + 0x3f174f4900000000, 0x951295b800000000, 0x543414e300000000, + 0xfe31ce1200000000, 0x4139d1db00000000, 0xeb3c0b2a00000000, + 0x7e2e9e9200000000, 0xd42b446300000000, 0x6b235baa00000000, + 0xc126815b00000000, 0xe96e591d00000000, 0x436b83ec00000000, + 0xfc639c2500000000, 0x566646d400000000, 0xc374d36c00000000, + 0x6971099d00000000, 0xd679165400000000, 0x7c7ccca500000000, + 0xbd5a4dfe00000000, 0x175f970f00000000, 0xa85788c600000000, + 0x0252523700000000, 0x9740c78f00000000, 0x3d451d7e00000000, + 0x824d02b700000000, 0x2848d84600000000, 0xd2ddb23a00000000, + 0x78d868cb00000000, 0xc7d0770200000000, 0x6dd5adf300000000, + 0xf8c7384b00000000, 0x52c2e2ba00000000, 0xedcafd7300000000, + 0x47cf278200000000, 0x86e9a6d900000000, 0x2cec7c2800000000, + 0x93e463e100000000, 0x39e1b91000000000, 0xacf32ca800000000, + 0x06f6f65900000000, 0xb9fee99000000000, 0x13fb336100000000, + 0x3bb3eb2700000000, 0x91b631d600000000, 0x2ebe2e1f00000000, + 0x84bbf4ee00000000, 0x11a9615600000000, 0xbbacbba700000000, + 0x04a4a46e00000000, 0xaea17e9f00000000, 0x6f87ffc400000000, + 0xc582253500000000, 0x7a8a3afc00000000, 0xd08fe00d00000000, + 0x459d75b500000000, 0xef98af4400000000, 0x5090b08d00000000, + 0xfa956a7c00000000, 0xa4bb657500000000, 0x0ebebf8400000000, + 0xb1b6a04d00000000, 0x1bb37abc00000000, 0x8ea1ef0400000000, + 0x24a435f500000000, 0x9bac2a3c00000000, 0x31a9f0cd00000000, + 0xf08f719600000000, 0x5a8aab6700000000, 0xe582b4ae00000000, + 0x4f876e5f00000000, 0xda95fbe700000000, 0x7090211600000000, + 0xcf983edf00000000, 0x659de42e00000000, 0x4dd53c6800000000, + 0xe7d0e69900000000, 0x58d8f95000000000, 0xf2dd23a100000000, + 0x67cfb61900000000, 0xcdca6ce800000000, 0x72c2732100000000, + 0xd8c7a9d000000000, 0x19e1288b00000000, 0xb3e4f27a00000000, + 0x0cecedb300000000, 0xa6e9374200000000, 0x33fba2fa00000000, + 0x99fe780b00000000, 0x26f667c200000000, 0x8cf3bd3300000000, + 0x7666d74f00000000, 0xdc630dbe00000000, 0x636b127700000000, + 0xc96ec88600000000, 0x5c7c5d3e00000000, 0xf67987cf00000000, + 0x4971980600000000, 0xe37442f700000000, 0x2252c3ac00000000, + 0x8857195d00000000, 0x375f069400000000, 0x9d5adc6500000000, + 0x084849dd00000000, 0xa24d932c00000000, 0x1d458ce500000000, + 0xb740561400000000, 0x9f088e5200000000, 0x350d54a300000000, + 0x8a054b6a00000000, 0x2000919b00000000, 0xb512042300000000, + 0x1f17ded200000000, 0xa01fc11b00000000, 0x0a1a1bea00000000, + 0xcb3c9ab100000000, 0x6139404000000000, 0xde315f8900000000, + 0x7434857800000000, 0xe12610c000000000, 0x4b23ca3100000000, + 0xf42bd5f800000000, 0x5e2e0f0900000000, 0x4877cbea00000000, + 0xe272111b00000000, 0x5d7a0ed200000000, 0xf77fd42300000000, + 0x626d419b00000000, 0xc8689b6a00000000, 0x776084a300000000, + 0xdd655e5200000000, 0x1c43df0900000000, 0xb64605f800000000, + 0x094e1a3100000000, 0xa34bc0c000000000, 0x3659557800000000, + 0x9c5c8f8900000000, 0x2354904000000000, 0x89514ab100000000, + 0xa11992f700000000, 0x0b1c480600000000, 0xb41457cf00000000, + 0x1e118d3e00000000, 0x8b03188600000000, 0x2106c27700000000, + 0x9e0eddbe00000000, 0x340b074f00000000, 0xf52d861400000000, + 0x5f285ce500000000, 0xe020432c00000000, 0x4a2599dd00000000, + 0xdf370c6500000000, 0x7532d69400000000, 0xca3ac95d00000000, + 0x603f13ac00000000, 0x9aaa79d000000000, 0x30afa32100000000, + 0x8fa7bce800000000, 0x25a2661900000000, 0xb0b0f3a100000000, + 0x1ab5295000000000, 0xa5bd369900000000, 0x0fb8ec6800000000, + 0xce9e6d3300000000, 0x649bb7c200000000, 0xdb93a80b00000000, + 0x719672fa00000000, 0xe484e74200000000, 0x4e813db300000000, + 0xf189227a00000000, 0x5b8cf88b00000000, 0x73c420cd00000000, + 0xd9c1fa3c00000000, 0x66c9e5f500000000, 0xcccc3f0400000000, + 0x59deaabc00000000, 0xf3db704d00000000, 0x4cd36f8400000000, + 0xe6d6b57500000000, 0x27f0342e00000000, 0x8df5eedf00000000, + 0x32fdf11600000000, 0x98f82be700000000, 0x0deabe5f00000000, + 0xa7ef64ae00000000, 0x18e77b6700000000, 0xb2e2a19600000000, + 0xecccae9f00000000, 0x46c9746e00000000, 0xf9c16ba700000000, + 0x53c4b15600000000, 0xc6d624ee00000000, 0x6cd3fe1f00000000, + 0xd3dbe1d600000000, 0x79de3b2700000000, 0xb8f8ba7c00000000, + 0x12fd608d00000000, 0xadf57f4400000000, 0x07f0a5b500000000, + 0x92e2300d00000000, 0x38e7eafc00000000, 0x87eff53500000000, + 0x2dea2fc400000000, 0x05a2f78200000000, 0xafa72d7300000000, + 0x10af32ba00000000, 0xbaaae84b00000000, 0x2fb87df300000000, + 0x85bda70200000000, 0x3ab5b8cb00000000, 0x90b0623a00000000, + 0x5196e36100000000, 0xfb93399000000000, 0x449b265900000000, + 0xee9efca800000000, 0x7b8c691000000000, 0xd189b3e100000000, + 0x6e81ac2800000000, 0xc48476d900000000, 0x3e111ca500000000, + 0x9414c65400000000, 0x2b1cd99d00000000, 0x8119036c00000000, + 0x140b96d400000000, 0xbe0e4c2500000000, 0x010653ec00000000, + 0xab03891d00000000, 0x6a25084600000000, 0xc020d2b700000000, + 0x7f28cd7e00000000, 0xd52d178f00000000, 0x403f823700000000, + 0xea3a58c600000000, 0x5532470f00000000, 0xff379dfe00000000, + 0xd77f45b800000000, 0x7d7a9f4900000000, 0xc272808000000000, + 0x68775a7100000000, 0xfd65cfc900000000, 0x5760153800000000, + 0xe8680af100000000, 0x426dd00000000000, 0x834b515b00000000, + 0x294e8baa00000000, 0x9646946300000000, 0x3c434e9200000000, + 0xa951db2a00000000, 0x035401db00000000, 0xbc5c1e1200000000, + 0x1659c4e300000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xae689191, 0x87a02563, 0x29c8b4f2, 0xd4314c87, + 0x7a59dd16, 0x539169e4, 0xfdf9f875, 0x73139f4f, 0xdd7b0ede, + 0xf4b3ba2c, 0x5adb2bbd, 0xa722d3c8, 0x094a4259, 0x2082f6ab, + 0x8eea673a, 0xe6273e9e, 0x484faf0f, 0x61871bfd, 0xcfef8a6c, + 0x32167219, 0x9c7ee388, 0xb5b6577a, 0x1bdec6eb, 0x9534a1d1, + 0x3b5c3040, 0x129484b2, 0xbcfc1523, 0x4105ed56, 0xef6d7cc7, + 0xc6a5c835, 0x68cd59a4, 0x173f7b7d, 0xb957eaec, 0x909f5e1e, + 0x3ef7cf8f, 0xc30e37fa, 0x6d66a66b, 0x44ae1299, 0xeac68308, + 0x642ce432, 0xca4475a3, 0xe38cc151, 0x4de450c0, 0xb01da8b5, + 0x1e753924, 0x37bd8dd6, 0x99d51c47, 0xf11845e3, 0x5f70d472, + 0x76b86080, 0xd8d0f111, 0x25290964, 0x8b4198f5, 0xa2892c07, + 0x0ce1bd96, 0x820bdaac, 0x2c634b3d, 0x05abffcf, 0xabc36e5e, + 0x563a962b, 0xf85207ba, 0xd19ab348, 0x7ff222d9, 0x2e7ef6fa, + 0x8016676b, 0xa9ded399, 0x07b64208, 0xfa4fba7d, 0x54272bec, + 0x7def9f1e, 0xd3870e8f, 0x5d6d69b5, 0xf305f824, 0xdacd4cd6, + 0x74a5dd47, 0x895c2532, 0x2734b4a3, 0x0efc0051, 0xa09491c0, + 0xc859c864, 0x663159f5, 0x4ff9ed07, 0xe1917c96, 0x1c6884e3, + 0xb2001572, 0x9bc8a180, 0x35a03011, 0xbb4a572b, 0x1522c6ba, + 0x3cea7248, 0x9282e3d9, 0x6f7b1bac, 0xc1138a3d, 0xe8db3ecf, + 0x46b3af5e, 0x39418d87, 0x97291c16, 0xbee1a8e4, 0x10893975, + 0xed70c100, 0x43185091, 0x6ad0e463, 0xc4b875f2, 0x4a5212c8, + 0xe43a8359, 0xcdf237ab, 0x639aa63a, 0x9e635e4f, 0x300bcfde, + 0x19c37b2c, 0xb7abeabd, 0xdf66b319, 0x710e2288, 0x58c6967a, + 0xf6ae07eb, 0x0b57ff9e, 0xa53f6e0f, 0x8cf7dafd, 0x229f4b6c, + 0xac752c56, 0x021dbdc7, 0x2bd50935, 0x85bd98a4, 0x784460d1, + 0xd62cf140, 0xffe445b2, 0x518cd423, 0x5cfdedf4, 0xf2957c65, + 0xdb5dc897, 0x75355906, 0x88cca173, 0x26a430e2, 0x0f6c8410, + 0xa1041581, 0x2fee72bb, 0x8186e32a, 0xa84e57d8, 0x0626c649, + 0xfbdf3e3c, 0x55b7afad, 0x7c7f1b5f, 0xd2178ace, 0xbadad36a, + 0x14b242fb, 0x3d7af609, 0x93126798, 0x6eeb9fed, 0xc0830e7c, + 0xe94bba8e, 0x47232b1f, 0xc9c94c25, 0x67a1ddb4, 0x4e696946, + 0xe001f8d7, 0x1df800a2, 0xb3909133, 0x9a5825c1, 0x3430b450, + 0x4bc29689, 0xe5aa0718, 0xcc62b3ea, 0x620a227b, 0x9ff3da0e, + 0x319b4b9f, 0x1853ff6d, 0xb63b6efc, 0x38d109c6, 0x96b99857, + 0xbf712ca5, 0x1119bd34, 0xece04541, 0x4288d4d0, 0x6b406022, + 0xc528f1b3, 0xade5a817, 0x038d3986, 0x2a458d74, 0x842d1ce5, + 0x79d4e490, 0xd7bc7501, 0xfe74c1f3, 0x501c5062, 0xdef63758, + 0x709ea6c9, 0x5956123b, 0xf73e83aa, 0x0ac77bdf, 0xa4afea4e, + 0x8d675ebc, 0x230fcf2d, 0x72831b0e, 0xdceb8a9f, 0xf5233e6d, + 0x5b4baffc, 0xa6b25789, 0x08dac618, 0x211272ea, 0x8f7ae37b, + 0x01908441, 0xaff815d0, 0x8630a122, 0x285830b3, 0xd5a1c8c6, + 0x7bc95957, 0x5201eda5, 0xfc697c34, 0x94a42590, 0x3accb401, + 0x130400f3, 0xbd6c9162, 0x40956917, 0xeefdf886, 0xc7354c74, + 0x695ddde5, 0xe7b7badf, 0x49df2b4e, 0x60179fbc, 0xce7f0e2d, + 0x3386f658, 0x9dee67c9, 0xb426d33b, 0x1a4e42aa, 0x65bc6073, + 0xcbd4f1e2, 0xe21c4510, 0x4c74d481, 0xb18d2cf4, 0x1fe5bd65, + 0x362d0997, 0x98459806, 0x16afff3c, 0xb8c76ead, 0x910fda5f, + 0x3f674bce, 0xc29eb3bb, 0x6cf6222a, 0x453e96d8, 0xeb560749, + 0x839b5eed, 0x2df3cf7c, 0x043b7b8e, 0xaa53ea1f, 0x57aa126a, + 0xf9c283fb, 0xd00a3709, 0x7e62a698, 0xf088c1a2, 0x5ee05033, + 0x7728e4c1, 0xd9407550, 0x24b98d25, 0x8ad11cb4, 0xa319a846, + 0x0d7139d7}, + {0x00000000, 0xb9fbdbe8, 0xa886b191, 0x117d6a79, 0x8a7c6563, + 0x3387be8b, 0x22fad4f2, 0x9b010f1a, 0xcf89cc87, 0x7672176f, + 0x670f7d16, 0xdef4a6fe, 0x45f5a9e4, 0xfc0e720c, 0xed731875, + 0x5488c39d, 0x44629f4f, 0xfd9944a7, 0xece42ede, 0x551ff536, + 0xce1efa2c, 0x77e521c4, 0x66984bbd, 0xdf639055, 0x8beb53c8, + 0x32108820, 0x236de259, 0x9a9639b1, 0x019736ab, 0xb86ced43, + 0xa911873a, 0x10ea5cd2, 0x88c53e9e, 0x313ee576, 0x20438f0f, + 0x99b854e7, 0x02b95bfd, 0xbb428015, 0xaa3fea6c, 0x13c43184, + 0x474cf219, 0xfeb729f1, 0xefca4388, 0x56319860, 0xcd30977a, + 0x74cb4c92, 0x65b626eb, 0xdc4dfd03, 0xcca7a1d1, 0x755c7a39, + 0x64211040, 0xdddacba8, 0x46dbc4b2, 0xff201f5a, 0xee5d7523, + 0x57a6aecb, 0x032e6d56, 0xbad5b6be, 0xaba8dcc7, 0x1253072f, + 0x89520835, 0x30a9d3dd, 0x21d4b9a4, 0x982f624c, 0xcafb7b7d, + 0x7300a095, 0x627dcaec, 0xdb861104, 0x40871e1e, 0xf97cc5f6, + 0xe801af8f, 0x51fa7467, 0x0572b7fa, 0xbc896c12, 0xadf4066b, + 0x140fdd83, 0x8f0ed299, 0x36f50971, 0x27886308, 0x9e73b8e0, + 0x8e99e432, 0x37623fda, 0x261f55a3, 0x9fe48e4b, 0x04e58151, + 0xbd1e5ab9, 0xac6330c0, 0x1598eb28, 0x411028b5, 0xf8ebf35d, + 0xe9969924, 0x506d42cc, 0xcb6c4dd6, 0x7297963e, 0x63eafc47, + 0xda1127af, 0x423e45e3, 0xfbc59e0b, 0xeab8f472, 0x53432f9a, + 0xc8422080, 0x71b9fb68, 0x60c49111, 0xd93f4af9, 0x8db78964, + 0x344c528c, 0x253138f5, 0x9ccae31d, 0x07cbec07, 0xbe3037ef, + 0xaf4d5d96, 0x16b6867e, 0x065cdaac, 0xbfa70144, 0xaeda6b3d, + 0x1721b0d5, 0x8c20bfcf, 0x35db6427, 0x24a60e5e, 0x9d5dd5b6, + 0xc9d5162b, 0x702ecdc3, 0x6153a7ba, 0xd8a87c52, 0x43a97348, + 0xfa52a8a0, 0xeb2fc2d9, 0x52d41931, 0x4e87f0bb, 0xf77c2b53, + 0xe601412a, 0x5ffa9ac2, 0xc4fb95d8, 0x7d004e30, 0x6c7d2449, + 0xd586ffa1, 0x810e3c3c, 0x38f5e7d4, 0x29888dad, 0x90735645, + 0x0b72595f, 0xb28982b7, 0xa3f4e8ce, 0x1a0f3326, 0x0ae56ff4, + 0xb31eb41c, 0xa263de65, 0x1b98058d, 0x80990a97, 0x3962d17f, + 0x281fbb06, 0x91e460ee, 0xc56ca373, 0x7c97789b, 0x6dea12e2, + 0xd411c90a, 0x4f10c610, 0xf6eb1df8, 0xe7967781, 0x5e6dac69, + 0xc642ce25, 0x7fb915cd, 0x6ec47fb4, 0xd73fa45c, 0x4c3eab46, + 0xf5c570ae, 0xe4b81ad7, 0x5d43c13f, 0x09cb02a2, 0xb030d94a, + 0xa14db333, 0x18b668db, 0x83b767c1, 0x3a4cbc29, 0x2b31d650, + 0x92ca0db8, 0x8220516a, 0x3bdb8a82, 0x2aa6e0fb, 0x935d3b13, + 0x085c3409, 0xb1a7efe1, 0xa0da8598, 0x19215e70, 0x4da99ded, + 0xf4524605, 0xe52f2c7c, 0x5cd4f794, 0xc7d5f88e, 0x7e2e2366, + 0x6f53491f, 0xd6a892f7, 0x847c8bc6, 0x3d87502e, 0x2cfa3a57, + 0x9501e1bf, 0x0e00eea5, 0xb7fb354d, 0xa6865f34, 0x1f7d84dc, + 0x4bf54741, 0xf20e9ca9, 0xe373f6d0, 0x5a882d38, 0xc1892222, + 0x7872f9ca, 0x690f93b3, 0xd0f4485b, 0xc01e1489, 0x79e5cf61, + 0x6898a518, 0xd1637ef0, 0x4a6271ea, 0xf399aa02, 0xe2e4c07b, + 0x5b1f1b93, 0x0f97d80e, 0xb66c03e6, 0xa711699f, 0x1eeab277, + 0x85ebbd6d, 0x3c106685, 0x2d6d0cfc, 0x9496d714, 0x0cb9b558, + 0xb5426eb0, 0xa43f04c9, 0x1dc4df21, 0x86c5d03b, 0x3f3e0bd3, + 0x2e4361aa, 0x97b8ba42, 0xc33079df, 0x7acba237, 0x6bb6c84e, + 0xd24d13a6, 0x494c1cbc, 0xf0b7c754, 0xe1caad2d, 0x583176c5, + 0x48db2a17, 0xf120f1ff, 0xe05d9b86, 0x59a6406e, 0xc2a74f74, + 0x7b5c949c, 0x6a21fee5, 0xd3da250d, 0x8752e690, 0x3ea93d78, + 0x2fd45701, 0x962f8ce9, 0x0d2e83f3, 0xb4d5581b, 0xa5a83262, + 0x1c53e98a}, + {0x00000000, 0x9d0fe176, 0xe16ec4ad, 0x7c6125db, 0x19ac8f1b, + 0x84a36e6d, 0xf8c24bb6, 0x65cdaac0, 0x33591e36, 0xae56ff40, + 0xd237da9b, 0x4f383bed, 0x2af5912d, 0xb7fa705b, 0xcb9b5580, + 0x5694b4f6, 0x66b23c6c, 0xfbbddd1a, 0x87dcf8c1, 0x1ad319b7, + 0x7f1eb377, 0xe2115201, 0x9e7077da, 0x037f96ac, 0x55eb225a, + 0xc8e4c32c, 0xb485e6f7, 0x298a0781, 0x4c47ad41, 0xd1484c37, + 0xad2969ec, 0x3026889a, 0xcd6478d8, 0x506b99ae, 0x2c0abc75, + 0xb1055d03, 0xd4c8f7c3, 0x49c716b5, 0x35a6336e, 0xa8a9d218, + 0xfe3d66ee, 0x63328798, 0x1f53a243, 0x825c4335, 0xe791e9f5, + 0x7a9e0883, 0x06ff2d58, 0x9bf0cc2e, 0xabd644b4, 0x36d9a5c2, + 0x4ab88019, 0xd7b7616f, 0xb27acbaf, 0x2f752ad9, 0x53140f02, + 0xce1bee74, 0x988f5a82, 0x0580bbf4, 0x79e19e2f, 0xe4ee7f59, + 0x8123d599, 0x1c2c34ef, 0x604d1134, 0xfd42f042, 0x41b9f7f1, + 0xdcb61687, 0xa0d7335c, 0x3dd8d22a, 0x581578ea, 0xc51a999c, + 0xb97bbc47, 0x24745d31, 0x72e0e9c7, 0xefef08b1, 0x938e2d6a, + 0x0e81cc1c, 0x6b4c66dc, 0xf64387aa, 0x8a22a271, 0x172d4307, + 0x270bcb9d, 0xba042aeb, 0xc6650f30, 0x5b6aee46, 0x3ea74486, + 0xa3a8a5f0, 0xdfc9802b, 0x42c6615d, 0x1452d5ab, 0x895d34dd, + 0xf53c1106, 0x6833f070, 0x0dfe5ab0, 0x90f1bbc6, 0xec909e1d, + 0x719f7f6b, 0x8cdd8f29, 0x11d26e5f, 0x6db34b84, 0xf0bcaaf2, + 0x95710032, 0x087ee144, 0x741fc49f, 0xe91025e9, 0xbf84911f, + 0x228b7069, 0x5eea55b2, 0xc3e5b4c4, 0xa6281e04, 0x3b27ff72, + 0x4746daa9, 0xda493bdf, 0xea6fb345, 0x77605233, 0x0b0177e8, + 0x960e969e, 0xf3c33c5e, 0x6eccdd28, 0x12adf8f3, 0x8fa21985, + 0xd936ad73, 0x44394c05, 0x385869de, 0xa55788a8, 0xc09a2268, + 0x5d95c31e, 0x21f4e6c5, 0xbcfb07b3, 0x8373efe2, 0x1e7c0e94, + 0x621d2b4f, 0xff12ca39, 0x9adf60f9, 0x07d0818f, 0x7bb1a454, + 0xe6be4522, 0xb02af1d4, 0x2d2510a2, 0x51443579, 0xcc4bd40f, + 0xa9867ecf, 0x34899fb9, 0x48e8ba62, 0xd5e75b14, 0xe5c1d38e, + 0x78ce32f8, 0x04af1723, 0x99a0f655, 0xfc6d5c95, 0x6162bde3, + 0x1d039838, 0x800c794e, 0xd698cdb8, 0x4b972cce, 0x37f60915, + 0xaaf9e863, 0xcf3442a3, 0x523ba3d5, 0x2e5a860e, 0xb3556778, + 0x4e17973a, 0xd318764c, 0xaf795397, 0x3276b2e1, 0x57bb1821, + 0xcab4f957, 0xb6d5dc8c, 0x2bda3dfa, 0x7d4e890c, 0xe041687a, + 0x9c204da1, 0x012facd7, 0x64e20617, 0xf9ede761, 0x858cc2ba, + 0x188323cc, 0x28a5ab56, 0xb5aa4a20, 0xc9cb6ffb, 0x54c48e8d, + 0x3109244d, 0xac06c53b, 0xd067e0e0, 0x4d680196, 0x1bfcb560, + 0x86f35416, 0xfa9271cd, 0x679d90bb, 0x02503a7b, 0x9f5fdb0d, + 0xe33efed6, 0x7e311fa0, 0xc2ca1813, 0x5fc5f965, 0x23a4dcbe, + 0xbeab3dc8, 0xdb669708, 0x4669767e, 0x3a0853a5, 0xa707b2d3, + 0xf1930625, 0x6c9ce753, 0x10fdc288, 0x8df223fe, 0xe83f893e, + 0x75306848, 0x09514d93, 0x945eace5, 0xa478247f, 0x3977c509, + 0x4516e0d2, 0xd81901a4, 0xbdd4ab64, 0x20db4a12, 0x5cba6fc9, + 0xc1b58ebf, 0x97213a49, 0x0a2edb3f, 0x764ffee4, 0xeb401f92, + 0x8e8db552, 0x13825424, 0x6fe371ff, 0xf2ec9089, 0x0fae60cb, + 0x92a181bd, 0xeec0a466, 0x73cf4510, 0x1602efd0, 0x8b0d0ea6, + 0xf76c2b7d, 0x6a63ca0b, 0x3cf77efd, 0xa1f89f8b, 0xdd99ba50, + 0x40965b26, 0x255bf1e6, 0xb8541090, 0xc435354b, 0x593ad43d, + 0x691c5ca7, 0xf413bdd1, 0x8872980a, 0x157d797c, 0x70b0d3bc, + 0xedbf32ca, 0x91de1711, 0x0cd1f667, 0x5a454291, 0xc74aa3e7, + 0xbb2b863c, 0x2624674a, 0x43e9cd8a, 0xdee62cfc, 0xa2870927, + 0x3f88e851}, + {0x00000000, 0xdd96d985, 0x605cb54b, 0xbdca6cce, 0xc0b96a96, + 0x1d2fb313, 0xa0e5dfdd, 0x7d730658, 0x5a03d36d, 0x87950ae8, + 0x3a5f6626, 0xe7c9bfa3, 0x9abab9fb, 0x472c607e, 0xfae60cb0, + 0x2770d535, 0xb407a6da, 0x69917f5f, 0xd45b1391, 0x09cdca14, + 0x74becc4c, 0xa92815c9, 0x14e27907, 0xc974a082, 0xee0475b7, + 0x3392ac32, 0x8e58c0fc, 0x53ce1979, 0x2ebd1f21, 0xf32bc6a4, + 0x4ee1aa6a, 0x937773ef, 0xb37e4bf5, 0x6ee89270, 0xd322febe, + 0x0eb4273b, 0x73c72163, 0xae51f8e6, 0x139b9428, 0xce0d4dad, + 0xe97d9898, 0x34eb411d, 0x89212dd3, 0x54b7f456, 0x29c4f20e, + 0xf4522b8b, 0x49984745, 0x940e9ec0, 0x0779ed2f, 0xdaef34aa, + 0x67255864, 0xbab381e1, 0xc7c087b9, 0x1a565e3c, 0xa79c32f2, + 0x7a0aeb77, 0x5d7a3e42, 0x80ece7c7, 0x3d268b09, 0xe0b0528c, + 0x9dc354d4, 0x40558d51, 0xfd9fe19f, 0x2009381a, 0xbd8d91ab, + 0x601b482e, 0xddd124e0, 0x0047fd65, 0x7d34fb3d, 0xa0a222b8, + 0x1d684e76, 0xc0fe97f3, 0xe78e42c6, 0x3a189b43, 0x87d2f78d, + 0x5a442e08, 0x27372850, 0xfaa1f1d5, 0x476b9d1b, 0x9afd449e, + 0x098a3771, 0xd41ceef4, 0x69d6823a, 0xb4405bbf, 0xc9335de7, + 0x14a58462, 0xa96fe8ac, 0x74f93129, 0x5389e41c, 0x8e1f3d99, + 0x33d55157, 0xee4388d2, 0x93308e8a, 0x4ea6570f, 0xf36c3bc1, + 0x2efae244, 0x0ef3da5e, 0xd36503db, 0x6eaf6f15, 0xb339b690, + 0xce4ab0c8, 0x13dc694d, 0xae160583, 0x7380dc06, 0x54f00933, + 0x8966d0b6, 0x34acbc78, 0xe93a65fd, 0x944963a5, 0x49dfba20, + 0xf415d6ee, 0x29830f6b, 0xbaf47c84, 0x6762a501, 0xdaa8c9cf, + 0x073e104a, 0x7a4d1612, 0xa7dbcf97, 0x1a11a359, 0xc7877adc, + 0xe0f7afe9, 0x3d61766c, 0x80ab1aa2, 0x5d3dc327, 0x204ec57f, + 0xfdd81cfa, 0x40127034, 0x9d84a9b1, 0xa06a2517, 0x7dfcfc92, + 0xc036905c, 0x1da049d9, 0x60d34f81, 0xbd459604, 0x008ffaca, + 0xdd19234f, 0xfa69f67a, 0x27ff2fff, 0x9a354331, 0x47a39ab4, + 0x3ad09cec, 0xe7464569, 0x5a8c29a7, 0x871af022, 0x146d83cd, + 0xc9fb5a48, 0x74313686, 0xa9a7ef03, 0xd4d4e95b, 0x094230de, + 0xb4885c10, 0x691e8595, 0x4e6e50a0, 0x93f88925, 0x2e32e5eb, + 0xf3a43c6e, 0x8ed73a36, 0x5341e3b3, 0xee8b8f7d, 0x331d56f8, + 0x13146ee2, 0xce82b767, 0x7348dba9, 0xaede022c, 0xd3ad0474, + 0x0e3bddf1, 0xb3f1b13f, 0x6e6768ba, 0x4917bd8f, 0x9481640a, + 0x294b08c4, 0xf4ddd141, 0x89aed719, 0x54380e9c, 0xe9f26252, + 0x3464bbd7, 0xa713c838, 0x7a8511bd, 0xc74f7d73, 0x1ad9a4f6, + 0x67aaa2ae, 0xba3c7b2b, 0x07f617e5, 0xda60ce60, 0xfd101b55, + 0x2086c2d0, 0x9d4cae1e, 0x40da779b, 0x3da971c3, 0xe03fa846, + 0x5df5c488, 0x80631d0d, 0x1de7b4bc, 0xc0716d39, 0x7dbb01f7, + 0xa02dd872, 0xdd5ede2a, 0x00c807af, 0xbd026b61, 0x6094b2e4, + 0x47e467d1, 0x9a72be54, 0x27b8d29a, 0xfa2e0b1f, 0x875d0d47, + 0x5acbd4c2, 0xe701b80c, 0x3a976189, 0xa9e01266, 0x7476cbe3, + 0xc9bca72d, 0x142a7ea8, 0x695978f0, 0xb4cfa175, 0x0905cdbb, + 0xd493143e, 0xf3e3c10b, 0x2e75188e, 0x93bf7440, 0x4e29adc5, + 0x335aab9d, 0xeecc7218, 0x53061ed6, 0x8e90c753, 0xae99ff49, + 0x730f26cc, 0xcec54a02, 0x13539387, 0x6e2095df, 0xb3b64c5a, + 0x0e7c2094, 0xd3eaf911, 0xf49a2c24, 0x290cf5a1, 0x94c6996f, + 0x495040ea, 0x342346b2, 0xe9b59f37, 0x547ff3f9, 0x89e92a7c, + 0x1a9e5993, 0xc7088016, 0x7ac2ecd8, 0xa754355d, 0xda273305, + 0x07b1ea80, 0xba7b864e, 0x67ed5fcb, 0x409d8afe, 0x9d0b537b, + 0x20c13fb5, 0xfd57e630, 0x8024e068, 0x5db239ed, 0xe0785523, + 0x3dee8ca6}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x85d996dd, 0x4bb55c60, 0xce6ccabd, 0x966ab9c0, + 0x13b32f1d, 0xdddfe5a0, 0x5806737d, 0x6dd3035a, 0xe80a9587, + 0x26665f3a, 0xa3bfc9e7, 0xfbb9ba9a, 0x7e602c47, 0xb00ce6fa, + 0x35d57027, 0xdaa607b4, 0x5f7f9169, 0x91135bd4, 0x14cacd09, + 0x4cccbe74, 0xc91528a9, 0x0779e214, 0x82a074c9, 0xb77504ee, + 0x32ac9233, 0xfcc0588e, 0x7919ce53, 0x211fbd2e, 0xa4c62bf3, + 0x6aaae14e, 0xef737793, 0xf54b7eb3, 0x7092e86e, 0xbefe22d3, + 0x3b27b40e, 0x6321c773, 0xe6f851ae, 0x28949b13, 0xad4d0dce, + 0x98987de9, 0x1d41eb34, 0xd32d2189, 0x56f4b754, 0x0ef2c429, + 0x8b2b52f4, 0x45479849, 0xc09e0e94, 0x2fed7907, 0xaa34efda, + 0x64582567, 0xe181b3ba, 0xb987c0c7, 0x3c5e561a, 0xf2329ca7, + 0x77eb0a7a, 0x423e7a5d, 0xc7e7ec80, 0x098b263d, 0x8c52b0e0, + 0xd454c39d, 0x518d5540, 0x9fe19ffd, 0x1a380920, 0xab918dbd, + 0x2e481b60, 0xe024d1dd, 0x65fd4700, 0x3dfb347d, 0xb822a2a0, + 0x764e681d, 0xf397fec0, 0xc6428ee7, 0x439b183a, 0x8df7d287, + 0x082e445a, 0x50283727, 0xd5f1a1fa, 0x1b9d6b47, 0x9e44fd9a, + 0x71378a09, 0xf4ee1cd4, 0x3a82d669, 0xbf5b40b4, 0xe75d33c9, + 0x6284a514, 0xace86fa9, 0x2931f974, 0x1ce48953, 0x993d1f8e, + 0x5751d533, 0xd28843ee, 0x8a8e3093, 0x0f57a64e, 0xc13b6cf3, + 0x44e2fa2e, 0x5edaf30e, 0xdb0365d3, 0x156faf6e, 0x90b639b3, + 0xc8b04ace, 0x4d69dc13, 0x830516ae, 0x06dc8073, 0x3309f054, + 0xb6d06689, 0x78bcac34, 0xfd653ae9, 0xa5634994, 0x20badf49, + 0xeed615f4, 0x6b0f8329, 0x847cf4ba, 0x01a56267, 0xcfc9a8da, + 0x4a103e07, 0x12164d7a, 0x97cfdba7, 0x59a3111a, 0xdc7a87c7, + 0xe9aff7e0, 0x6c76613d, 0xa21aab80, 0x27c33d5d, 0x7fc54e20, + 0xfa1cd8fd, 0x34701240, 0xb1a9849d, 0x17256aa0, 0x92fcfc7d, + 0x5c9036c0, 0xd949a01d, 0x814fd360, 0x049645bd, 0xcafa8f00, + 0x4f2319dd, 0x7af669fa, 0xff2fff27, 0x3143359a, 0xb49aa347, + 0xec9cd03a, 0x694546e7, 0xa7298c5a, 0x22f01a87, 0xcd836d14, + 0x485afbc9, 0x86363174, 0x03efa7a9, 0x5be9d4d4, 0xde304209, + 0x105c88b4, 0x95851e69, 0xa0506e4e, 0x2589f893, 0xebe5322e, + 0x6e3ca4f3, 0x363ad78e, 0xb3e34153, 0x7d8f8bee, 0xf8561d33, + 0xe26e1413, 0x67b782ce, 0xa9db4873, 0x2c02deae, 0x7404add3, + 0xf1dd3b0e, 0x3fb1f1b3, 0xba68676e, 0x8fbd1749, 0x0a648194, + 0xc4084b29, 0x41d1ddf4, 0x19d7ae89, 0x9c0e3854, 0x5262f2e9, + 0xd7bb6434, 0x38c813a7, 0xbd11857a, 0x737d4fc7, 0xf6a4d91a, + 0xaea2aa67, 0x2b7b3cba, 0xe517f607, 0x60ce60da, 0x551b10fd, + 0xd0c28620, 0x1eae4c9d, 0x9b77da40, 0xc371a93d, 0x46a83fe0, + 0x88c4f55d, 0x0d1d6380, 0xbcb4e71d, 0x396d71c0, 0xf701bb7d, + 0x72d82da0, 0x2ade5edd, 0xaf07c800, 0x616b02bd, 0xe4b29460, + 0xd167e447, 0x54be729a, 0x9ad2b827, 0x1f0b2efa, 0x470d5d87, + 0xc2d4cb5a, 0x0cb801e7, 0x8961973a, 0x6612e0a9, 0xe3cb7674, + 0x2da7bcc9, 0xa87e2a14, 0xf0785969, 0x75a1cfb4, 0xbbcd0509, + 0x3e1493d4, 0x0bc1e3f3, 0x8e18752e, 0x4074bf93, 0xc5ad294e, + 0x9dab5a33, 0x1872ccee, 0xd61e0653, 0x53c7908e, 0x49ff99ae, + 0xcc260f73, 0x024ac5ce, 0x87935313, 0xdf95206e, 0x5a4cb6b3, + 0x94207c0e, 0x11f9ead3, 0x242c9af4, 0xa1f50c29, 0x6f99c694, + 0xea405049, 0xb2462334, 0x379fb5e9, 0xf9f37f54, 0x7c2ae989, + 0x93599e1a, 0x168008c7, 0xd8ecc27a, 0x5d3554a7, 0x053327da, + 0x80eab107, 0x4e867bba, 0xcb5fed67, 0xfe8a9d40, 0x7b530b9d, + 0xb53fc120, 0x30e657fd, 0x68e02480, 0xed39b25d, 0x235578e0, + 0xa68cee3d}, + {0x00000000, 0x76e10f9d, 0xadc46ee1, 0xdb25617c, 0x1b8fac19, + 0x6d6ea384, 0xb64bc2f8, 0xc0aacd65, 0x361e5933, 0x40ff56ae, + 0x9bda37d2, 0xed3b384f, 0x2d91f52a, 0x5b70fab7, 0x80559bcb, + 0xf6b49456, 0x6c3cb266, 0x1addbdfb, 0xc1f8dc87, 0xb719d31a, + 0x77b31e7f, 0x015211e2, 0xda77709e, 0xac967f03, 0x5a22eb55, + 0x2cc3e4c8, 0xf7e685b4, 0x81078a29, 0x41ad474c, 0x374c48d1, + 0xec6929ad, 0x9a882630, 0xd87864cd, 0xae996b50, 0x75bc0a2c, + 0x035d05b1, 0xc3f7c8d4, 0xb516c749, 0x6e33a635, 0x18d2a9a8, + 0xee663dfe, 0x98873263, 0x43a2531f, 0x35435c82, 0xf5e991e7, + 0x83089e7a, 0x582dff06, 0x2eccf09b, 0xb444d6ab, 0xc2a5d936, + 0x1980b84a, 0x6f61b7d7, 0xafcb7ab2, 0xd92a752f, 0x020f1453, + 0x74ee1bce, 0x825a8f98, 0xf4bb8005, 0x2f9ee179, 0x597feee4, + 0x99d52381, 0xef342c1c, 0x34114d60, 0x42f042fd, 0xf1f7b941, + 0x8716b6dc, 0x5c33d7a0, 0x2ad2d83d, 0xea781558, 0x9c991ac5, + 0x47bc7bb9, 0x315d7424, 0xc7e9e072, 0xb108efef, 0x6a2d8e93, + 0x1ccc810e, 0xdc664c6b, 0xaa8743f6, 0x71a2228a, 0x07432d17, + 0x9dcb0b27, 0xeb2a04ba, 0x300f65c6, 0x46ee6a5b, 0x8644a73e, + 0xf0a5a8a3, 0x2b80c9df, 0x5d61c642, 0xabd55214, 0xdd345d89, + 0x06113cf5, 0x70f03368, 0xb05afe0d, 0xc6bbf190, 0x1d9e90ec, + 0x6b7f9f71, 0x298fdd8c, 0x5f6ed211, 0x844bb36d, 0xf2aabcf0, + 0x32007195, 0x44e17e08, 0x9fc41f74, 0xe92510e9, 0x1f9184bf, + 0x69708b22, 0xb255ea5e, 0xc4b4e5c3, 0x041e28a6, 0x72ff273b, + 0xa9da4647, 0xdf3b49da, 0x45b36fea, 0x33526077, 0xe877010b, + 0x9e960e96, 0x5e3cc3f3, 0x28ddcc6e, 0xf3f8ad12, 0x8519a28f, + 0x73ad36d9, 0x054c3944, 0xde695838, 0xa88857a5, 0x68229ac0, + 0x1ec3955d, 0xc5e6f421, 0xb307fbbc, 0xe2ef7383, 0x940e7c1e, + 0x4f2b1d62, 0x39ca12ff, 0xf960df9a, 0x8f81d007, 0x54a4b17b, + 0x2245bee6, 0xd4f12ab0, 0xa210252d, 0x79354451, 0x0fd44bcc, + 0xcf7e86a9, 0xb99f8934, 0x62bae848, 0x145be7d5, 0x8ed3c1e5, + 0xf832ce78, 0x2317af04, 0x55f6a099, 0x955c6dfc, 0xe3bd6261, + 0x3898031d, 0x4e790c80, 0xb8cd98d6, 0xce2c974b, 0x1509f637, + 0x63e8f9aa, 0xa34234cf, 0xd5a33b52, 0x0e865a2e, 0x786755b3, + 0x3a97174e, 0x4c7618d3, 0x975379af, 0xe1b27632, 0x2118bb57, + 0x57f9b4ca, 0x8cdcd5b6, 0xfa3dda2b, 0x0c894e7d, 0x7a6841e0, + 0xa14d209c, 0xd7ac2f01, 0x1706e264, 0x61e7edf9, 0xbac28c85, + 0xcc238318, 0x56aba528, 0x204aaab5, 0xfb6fcbc9, 0x8d8ec454, + 0x4d240931, 0x3bc506ac, 0xe0e067d0, 0x9601684d, 0x60b5fc1b, + 0x1654f386, 0xcd7192fa, 0xbb909d67, 0x7b3a5002, 0x0ddb5f9f, + 0xd6fe3ee3, 0xa01f317e, 0x1318cac2, 0x65f9c55f, 0xbedca423, + 0xc83dabbe, 0x089766db, 0x7e766946, 0xa553083a, 0xd3b207a7, + 0x250693f1, 0x53e79c6c, 0x88c2fd10, 0xfe23f28d, 0x3e893fe8, + 0x48683075, 0x934d5109, 0xe5ac5e94, 0x7f2478a4, 0x09c57739, + 0xd2e01645, 0xa40119d8, 0x64abd4bd, 0x124adb20, 0xc96fba5c, + 0xbf8eb5c1, 0x493a2197, 0x3fdb2e0a, 0xe4fe4f76, 0x921f40eb, + 0x52b58d8e, 0x24548213, 0xff71e36f, 0x8990ecf2, 0xcb60ae0f, + 0xbd81a192, 0x66a4c0ee, 0x1045cf73, 0xd0ef0216, 0xa60e0d8b, + 0x7d2b6cf7, 0x0bca636a, 0xfd7ef73c, 0x8b9ff8a1, 0x50ba99dd, + 0x265b9640, 0xe6f15b25, 0x901054b8, 0x4b3535c4, 0x3dd43a59, + 0xa75c1c69, 0xd1bd13f4, 0x0a987288, 0x7c797d15, 0xbcd3b070, + 0xca32bfed, 0x1117de91, 0x67f6d10c, 0x9142455a, 0xe7a34ac7, + 0x3c862bbb, 0x4a672426, 0x8acde943, 0xfc2ce6de, 0x270987a2, + 0x51e8883f}, + {0x00000000, 0xe8dbfbb9, 0x91b186a8, 0x796a7d11, 0x63657c8a, + 0x8bbe8733, 0xf2d4fa22, 0x1a0f019b, 0x87cc89cf, 0x6f177276, + 0x167d0f67, 0xfea6f4de, 0xe4a9f545, 0x0c720efc, 0x751873ed, + 0x9dc38854, 0x4f9f6244, 0xa74499fd, 0xde2ee4ec, 0x36f51f55, + 0x2cfa1ece, 0xc421e577, 0xbd4b9866, 0x559063df, 0xc853eb8b, + 0x20881032, 0x59e26d23, 0xb139969a, 0xab369701, 0x43ed6cb8, + 0x3a8711a9, 0xd25cea10, 0x9e3ec588, 0x76e53e31, 0x0f8f4320, + 0xe754b899, 0xfd5bb902, 0x158042bb, 0x6cea3faa, 0x8431c413, + 0x19f24c47, 0xf129b7fe, 0x8843caef, 0x60983156, 0x7a9730cd, + 0x924ccb74, 0xeb26b665, 0x03fd4ddc, 0xd1a1a7cc, 0x397a5c75, + 0x40102164, 0xa8cbdadd, 0xb2c4db46, 0x5a1f20ff, 0x23755dee, + 0xcbaea657, 0x566d2e03, 0xbeb6d5ba, 0xc7dca8ab, 0x2f075312, + 0x35085289, 0xddd3a930, 0xa4b9d421, 0x4c622f98, 0x7d7bfbca, + 0x95a00073, 0xecca7d62, 0x041186db, 0x1e1e8740, 0xf6c57cf9, + 0x8faf01e8, 0x6774fa51, 0xfab77205, 0x126c89bc, 0x6b06f4ad, + 0x83dd0f14, 0x99d20e8f, 0x7109f536, 0x08638827, 0xe0b8739e, + 0x32e4998e, 0xda3f6237, 0xa3551f26, 0x4b8ee49f, 0x5181e504, + 0xb95a1ebd, 0xc03063ac, 0x28eb9815, 0xb5281041, 0x5df3ebf8, + 0x249996e9, 0xcc426d50, 0xd64d6ccb, 0x3e969772, 0x47fcea63, + 0xaf2711da, 0xe3453e42, 0x0b9ec5fb, 0x72f4b8ea, 0x9a2f4353, + 0x802042c8, 0x68fbb971, 0x1191c460, 0xf94a3fd9, 0x6489b78d, + 0x8c524c34, 0xf5383125, 0x1de3ca9c, 0x07eccb07, 0xef3730be, + 0x965d4daf, 0x7e86b616, 0xacda5c06, 0x4401a7bf, 0x3d6bdaae, + 0xd5b02117, 0xcfbf208c, 0x2764db35, 0x5e0ea624, 0xb6d55d9d, + 0x2b16d5c9, 0xc3cd2e70, 0xbaa75361, 0x527ca8d8, 0x4873a943, + 0xa0a852fa, 0xd9c22feb, 0x3119d452, 0xbbf0874e, 0x532b7cf7, + 0x2a4101e6, 0xc29afa5f, 0xd895fbc4, 0x304e007d, 0x49247d6c, + 0xa1ff86d5, 0x3c3c0e81, 0xd4e7f538, 0xad8d8829, 0x45567390, + 0x5f59720b, 0xb78289b2, 0xcee8f4a3, 0x26330f1a, 0xf46fe50a, + 0x1cb41eb3, 0x65de63a2, 0x8d05981b, 0x970a9980, 0x7fd16239, + 0x06bb1f28, 0xee60e491, 0x73a36cc5, 0x9b78977c, 0xe212ea6d, + 0x0ac911d4, 0x10c6104f, 0xf81debf6, 0x817796e7, 0x69ac6d5e, + 0x25ce42c6, 0xcd15b97f, 0xb47fc46e, 0x5ca43fd7, 0x46ab3e4c, + 0xae70c5f5, 0xd71ab8e4, 0x3fc1435d, 0xa202cb09, 0x4ad930b0, + 0x33b34da1, 0xdb68b618, 0xc167b783, 0x29bc4c3a, 0x50d6312b, + 0xb80dca92, 0x6a512082, 0x828adb3b, 0xfbe0a62a, 0x133b5d93, + 0x09345c08, 0xe1efa7b1, 0x9885daa0, 0x705e2119, 0xed9da94d, + 0x054652f4, 0x7c2c2fe5, 0x94f7d45c, 0x8ef8d5c7, 0x66232e7e, + 0x1f49536f, 0xf792a8d6, 0xc68b7c84, 0x2e50873d, 0x573afa2c, + 0xbfe10195, 0xa5ee000e, 0x4d35fbb7, 0x345f86a6, 0xdc847d1f, + 0x4147f54b, 0xa99c0ef2, 0xd0f673e3, 0x382d885a, 0x222289c1, + 0xcaf97278, 0xb3930f69, 0x5b48f4d0, 0x89141ec0, 0x61cfe579, + 0x18a59868, 0xf07e63d1, 0xea71624a, 0x02aa99f3, 0x7bc0e4e2, + 0x931b1f5b, 0x0ed8970f, 0xe6036cb6, 0x9f6911a7, 0x77b2ea1e, + 0x6dbdeb85, 0x8566103c, 0xfc0c6d2d, 0x14d79694, 0x58b5b90c, + 0xb06e42b5, 0xc9043fa4, 0x21dfc41d, 0x3bd0c586, 0xd30b3e3f, + 0xaa61432e, 0x42bab897, 0xdf7930c3, 0x37a2cb7a, 0x4ec8b66b, + 0xa6134dd2, 0xbc1c4c49, 0x54c7b7f0, 0x2dadcae1, 0xc5763158, + 0x172adb48, 0xfff120f1, 0x869b5de0, 0x6e40a659, 0x744fa7c2, + 0x9c945c7b, 0xe5fe216a, 0x0d25dad3, 0x90e65287, 0x783da93e, + 0x0157d42f, 0xe98c2f96, 0xf3832e0d, 0x1b58d5b4, 0x6232a8a5, + 0x8ae9531c}, + {0x00000000, 0x919168ae, 0x6325a087, 0xf2b4c829, 0x874c31d4, + 0x16dd597a, 0xe4699153, 0x75f8f9fd, 0x4f9f1373, 0xde0e7bdd, + 0x2cbab3f4, 0xbd2bdb5a, 0xc8d322a7, 0x59424a09, 0xabf68220, + 0x3a67ea8e, 0x9e3e27e6, 0x0faf4f48, 0xfd1b8761, 0x6c8aefcf, + 0x19721632, 0x88e37e9c, 0x7a57b6b5, 0xebc6de1b, 0xd1a13495, + 0x40305c3b, 0xb2849412, 0x2315fcbc, 0x56ed0541, 0xc77c6def, + 0x35c8a5c6, 0xa459cd68, 0x7d7b3f17, 0xecea57b9, 0x1e5e9f90, + 0x8fcff73e, 0xfa370ec3, 0x6ba6666d, 0x9912ae44, 0x0883c6ea, + 0x32e42c64, 0xa37544ca, 0x51c18ce3, 0xc050e44d, 0xb5a81db0, + 0x2439751e, 0xd68dbd37, 0x471cd599, 0xe34518f1, 0x72d4705f, + 0x8060b876, 0x11f1d0d8, 0x64092925, 0xf598418b, 0x072c89a2, + 0x96bde10c, 0xacda0b82, 0x3d4b632c, 0xcfffab05, 0x5e6ec3ab, + 0x2b963a56, 0xba0752f8, 0x48b39ad1, 0xd922f27f, 0xfaf67e2e, + 0x6b671680, 0x99d3dea9, 0x0842b607, 0x7dba4ffa, 0xec2b2754, + 0x1e9fef7d, 0x8f0e87d3, 0xb5696d5d, 0x24f805f3, 0xd64ccdda, + 0x47dda574, 0x32255c89, 0xa3b43427, 0x5100fc0e, 0xc09194a0, + 0x64c859c8, 0xf5593166, 0x07edf94f, 0x967c91e1, 0xe384681c, + 0x721500b2, 0x80a1c89b, 0x1130a035, 0x2b574abb, 0xbac62215, + 0x4872ea3c, 0xd9e38292, 0xac1b7b6f, 0x3d8a13c1, 0xcf3edbe8, + 0x5eafb346, 0x878d4139, 0x161c2997, 0xe4a8e1be, 0x75398910, + 0x00c170ed, 0x91501843, 0x63e4d06a, 0xf275b8c4, 0xc812524a, + 0x59833ae4, 0xab37f2cd, 0x3aa69a63, 0x4f5e639e, 0xdecf0b30, + 0x2c7bc319, 0xbdeaabb7, 0x19b366df, 0x88220e71, 0x7a96c658, + 0xeb07aef6, 0x9eff570b, 0x0f6e3fa5, 0xfddaf78c, 0x6c4b9f22, + 0x562c75ac, 0xc7bd1d02, 0x3509d52b, 0xa498bd85, 0xd1604478, + 0x40f12cd6, 0xb245e4ff, 0x23d48c51, 0xf4edfd5c, 0x657c95f2, + 0x97c85ddb, 0x06593575, 0x73a1cc88, 0xe230a426, 0x10846c0f, + 0x811504a1, 0xbb72ee2f, 0x2ae38681, 0xd8574ea8, 0x49c62606, + 0x3c3edffb, 0xadafb755, 0x5f1b7f7c, 0xce8a17d2, 0x6ad3daba, + 0xfb42b214, 0x09f67a3d, 0x98671293, 0xed9feb6e, 0x7c0e83c0, + 0x8eba4be9, 0x1f2b2347, 0x254cc9c9, 0xb4dda167, 0x4669694e, + 0xd7f801e0, 0xa200f81d, 0x339190b3, 0xc125589a, 0x50b43034, + 0x8996c24b, 0x1807aae5, 0xeab362cc, 0x7b220a62, 0x0edaf39f, + 0x9f4b9b31, 0x6dff5318, 0xfc6e3bb6, 0xc609d138, 0x5798b996, + 0xa52c71bf, 0x34bd1911, 0x4145e0ec, 0xd0d48842, 0x2260406b, + 0xb3f128c5, 0x17a8e5ad, 0x86398d03, 0x748d452a, 0xe51c2d84, + 0x90e4d479, 0x0175bcd7, 0xf3c174fe, 0x62501c50, 0x5837f6de, + 0xc9a69e70, 0x3b125659, 0xaa833ef7, 0xdf7bc70a, 0x4eeaafa4, + 0xbc5e678d, 0x2dcf0f23, 0x0e1b8372, 0x9f8aebdc, 0x6d3e23f5, + 0xfcaf4b5b, 0x8957b2a6, 0x18c6da08, 0xea721221, 0x7be37a8f, + 0x41849001, 0xd015f8af, 0x22a13086, 0xb3305828, 0xc6c8a1d5, + 0x5759c97b, 0xa5ed0152, 0x347c69fc, 0x9025a494, 0x01b4cc3a, + 0xf3000413, 0x62916cbd, 0x17699540, 0x86f8fdee, 0x744c35c7, + 0xe5dd5d69, 0xdfbab7e7, 0x4e2bdf49, 0xbc9f1760, 0x2d0e7fce, + 0x58f68633, 0xc967ee9d, 0x3bd326b4, 0xaa424e1a, 0x7360bc65, + 0xe2f1d4cb, 0x10451ce2, 0x81d4744c, 0xf42c8db1, 0x65bde51f, + 0x97092d36, 0x06984598, 0x3cffaf16, 0xad6ec7b8, 0x5fda0f91, + 0xce4b673f, 0xbbb39ec2, 0x2a22f66c, 0xd8963e45, 0x490756eb, + 0xed5e9b83, 0x7ccff32d, 0x8e7b3b04, 0x1fea53aa, 0x6a12aa57, + 0xfb83c2f9, 0x09370ad0, 0x98a6627e, 0xa2c188f0, 0x3350e05e, + 0xc1e42877, 0x507540d9, 0x258db924, 0xb41cd18a, 0x46a819a3, + 0xd739710d}}; + +#endif + +#endif + +#if N == 5 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xaf449247, 0x85f822cf, 0x2abcb088, 0xd08143df, + 0x7fc5d198, 0x55796110, 0xfa3df357, 0x7a7381ff, 0xd53713b8, + 0xff8ba330, 0x50cf3177, 0xaaf2c220, 0x05b65067, 0x2f0ae0ef, + 0x804e72a8, 0xf4e703fe, 0x5ba391b9, 0x711f2131, 0xde5bb376, + 0x24664021, 0x8b22d266, 0xa19e62ee, 0x0edaf0a9, 0x8e948201, + 0x21d01046, 0x0b6ca0ce, 0xa4283289, 0x5e15c1de, 0xf1515399, + 0xdbede311, 0x74a97156, 0x32bf01bd, 0x9dfb93fa, 0xb7472372, + 0x1803b135, 0xe23e4262, 0x4d7ad025, 0x67c660ad, 0xc882f2ea, + 0x48cc8042, 0xe7881205, 0xcd34a28d, 0x627030ca, 0x984dc39d, + 0x370951da, 0x1db5e152, 0xb2f17315, 0xc6580243, 0x691c9004, + 0x43a0208c, 0xece4b2cb, 0x16d9419c, 0xb99dd3db, 0x93216353, + 0x3c65f114, 0xbc2b83bc, 0x136f11fb, 0x39d3a173, 0x96973334, + 0x6caac063, 0xc3ee5224, 0xe952e2ac, 0x461670eb, 0x657e037a, + 0xca3a913d, 0xe08621b5, 0x4fc2b3f2, 0xb5ff40a5, 0x1abbd2e2, + 0x3007626a, 0x9f43f02d, 0x1f0d8285, 0xb04910c2, 0x9af5a04a, + 0x35b1320d, 0xcf8cc15a, 0x60c8531d, 0x4a74e395, 0xe53071d2, + 0x91990084, 0x3edd92c3, 0x1461224b, 0xbb25b00c, 0x4118435b, + 0xee5cd11c, 0xc4e06194, 0x6ba4f3d3, 0xebea817b, 0x44ae133c, + 0x6e12a3b4, 0xc15631f3, 0x3b6bc2a4, 0x942f50e3, 0xbe93e06b, + 0x11d7722c, 0x57c102c7, 0xf8859080, 0xd2392008, 0x7d7db24f, + 0x87404118, 0x2804d35f, 0x02b863d7, 0xadfcf190, 0x2db28338, + 0x82f6117f, 0xa84aa1f7, 0x070e33b0, 0xfd33c0e7, 0x527752a0, + 0x78cbe228, 0xd78f706f, 0xa3260139, 0x0c62937e, 0x26de23f6, + 0x899ab1b1, 0x73a742e6, 0xdce3d0a1, 0xf65f6029, 0x591bf26e, + 0xd95580c6, 0x76111281, 0x5cada209, 0xf3e9304e, 0x09d4c319, + 0xa690515e, 0x8c2ce1d6, 0x23687391, 0xcafc06f4, 0x65b894b3, + 0x4f04243b, 0xe040b67c, 0x1a7d452b, 0xb539d76c, 0x9f8567e4, + 0x30c1f5a3, 0xb08f870b, 0x1fcb154c, 0x3577a5c4, 0x9a333783, + 0x600ec4d4, 0xcf4a5693, 0xe5f6e61b, 0x4ab2745c, 0x3e1b050a, + 0x915f974d, 0xbbe327c5, 0x14a7b582, 0xee9a46d5, 0x41ded492, + 0x6b62641a, 0xc426f65d, 0x446884f5, 0xeb2c16b2, 0xc190a63a, + 0x6ed4347d, 0x94e9c72a, 0x3bad556d, 0x1111e5e5, 0xbe5577a2, + 0xf8430749, 0x5707950e, 0x7dbb2586, 0xd2ffb7c1, 0x28c24496, + 0x8786d6d1, 0xad3a6659, 0x027ef41e, 0x823086b6, 0x2d7414f1, + 0x07c8a479, 0xa88c363e, 0x52b1c569, 0xfdf5572e, 0xd749e7a6, + 0x780d75e1, 0x0ca404b7, 0xa3e096f0, 0x895c2678, 0x2618b43f, + 0xdc254768, 0x7361d52f, 0x59dd65a7, 0xf699f7e0, 0x76d78548, + 0xd993170f, 0xf32fa787, 0x5c6b35c0, 0xa656c697, 0x091254d0, + 0x23aee458, 0x8cea761f, 0xaf82058e, 0x00c697c9, 0x2a7a2741, + 0x853eb506, 0x7f034651, 0xd047d416, 0xfafb649e, 0x55bff6d9, + 0xd5f18471, 0x7ab51636, 0x5009a6be, 0xff4d34f9, 0x0570c7ae, + 0xaa3455e9, 0x8088e561, 0x2fcc7726, 0x5b650670, 0xf4219437, + 0xde9d24bf, 0x71d9b6f8, 0x8be445af, 0x24a0d7e8, 0x0e1c6760, + 0xa158f527, 0x2116878f, 0x8e5215c8, 0xa4eea540, 0x0baa3707, + 0xf197c450, 0x5ed35617, 0x746fe69f, 0xdb2b74d8, 0x9d3d0433, + 0x32799674, 0x18c526fc, 0xb781b4bb, 0x4dbc47ec, 0xe2f8d5ab, + 0xc8446523, 0x6700f764, 0xe74e85cc, 0x480a178b, 0x62b6a703, + 0xcdf23544, 0x37cfc613, 0x988b5454, 0xb237e4dc, 0x1d73769b, + 0x69da07cd, 0xc69e958a, 0xec222502, 0x4366b745, 0xb95b4412, + 0x161fd655, 0x3ca366dd, 0x93e7f49a, 0x13a98632, 0xbced1475, + 0x9651a4fd, 0x391536ba, 0xc328c5ed, 0x6c6c57aa, 0x46d0e722, + 0xe9947565}, + {0x00000000, 0x4e890ba9, 0x9d121752, 0xd39b1cfb, 0xe15528e5, + 0xafdc234c, 0x7c473fb7, 0x32ce341e, 0x19db578b, 0x57525c22, + 0x84c940d9, 0xca404b70, 0xf88e7f6e, 0xb60774c7, 0x659c683c, + 0x2b156395, 0x33b6af16, 0x7d3fa4bf, 0xaea4b844, 0xe02db3ed, + 0xd2e387f3, 0x9c6a8c5a, 0x4ff190a1, 0x01789b08, 0x2a6df89d, + 0x64e4f334, 0xb77fefcf, 0xf9f6e466, 0xcb38d078, 0x85b1dbd1, + 0x562ac72a, 0x18a3cc83, 0x676d5e2c, 0x29e45585, 0xfa7f497e, + 0xb4f642d7, 0x863876c9, 0xc8b17d60, 0x1b2a619b, 0x55a36a32, + 0x7eb609a7, 0x303f020e, 0xe3a41ef5, 0xad2d155c, 0x9fe32142, + 0xd16a2aeb, 0x02f13610, 0x4c783db9, 0x54dbf13a, 0x1a52fa93, + 0xc9c9e668, 0x8740edc1, 0xb58ed9df, 0xfb07d276, 0x289cce8d, + 0x6615c524, 0x4d00a6b1, 0x0389ad18, 0xd012b1e3, 0x9e9bba4a, + 0xac558e54, 0xe2dc85fd, 0x31479906, 0x7fce92af, 0xcedabc58, + 0x8053b7f1, 0x53c8ab0a, 0x1d41a0a3, 0x2f8f94bd, 0x61069f14, + 0xb29d83ef, 0xfc148846, 0xd701ebd3, 0x9988e07a, 0x4a13fc81, + 0x049af728, 0x3654c336, 0x78ddc89f, 0xab46d464, 0xe5cfdfcd, + 0xfd6c134e, 0xb3e518e7, 0x607e041c, 0x2ef70fb5, 0x1c393bab, + 0x52b03002, 0x812b2cf9, 0xcfa22750, 0xe4b744c5, 0xaa3e4f6c, + 0x79a55397, 0x372c583e, 0x05e26c20, 0x4b6b6789, 0x98f07b72, + 0xd67970db, 0xa9b7e274, 0xe73ee9dd, 0x34a5f526, 0x7a2cfe8f, + 0x48e2ca91, 0x066bc138, 0xd5f0ddc3, 0x9b79d66a, 0xb06cb5ff, + 0xfee5be56, 0x2d7ea2ad, 0x63f7a904, 0x51399d1a, 0x1fb096b3, + 0xcc2b8a48, 0x82a281e1, 0x9a014d62, 0xd48846cb, 0x07135a30, + 0x499a5199, 0x7b546587, 0x35dd6e2e, 0xe64672d5, 0xa8cf797c, + 0x83da1ae9, 0xcd531140, 0x1ec80dbb, 0x50410612, 0x628f320c, + 0x2c0639a5, 0xff9d255e, 0xb1142ef7, 0x46c47ef1, 0x084d7558, + 0xdbd669a3, 0x955f620a, 0xa7915614, 0xe9185dbd, 0x3a834146, + 0x740a4aef, 0x5f1f297a, 0x119622d3, 0xc20d3e28, 0x8c843581, + 0xbe4a019f, 0xf0c30a36, 0x235816cd, 0x6dd11d64, 0x7572d1e7, + 0x3bfbda4e, 0xe860c6b5, 0xa6e9cd1c, 0x9427f902, 0xdaaef2ab, + 0x0935ee50, 0x47bce5f9, 0x6ca9866c, 0x22208dc5, 0xf1bb913e, + 0xbf329a97, 0x8dfcae89, 0xc375a520, 0x10eeb9db, 0x5e67b272, + 0x21a920dd, 0x6f202b74, 0xbcbb378f, 0xf2323c26, 0xc0fc0838, + 0x8e750391, 0x5dee1f6a, 0x136714c3, 0x38727756, 0x76fb7cff, + 0xa5606004, 0xebe96bad, 0xd9275fb3, 0x97ae541a, 0x443548e1, + 0x0abc4348, 0x121f8fcb, 0x5c968462, 0x8f0d9899, 0xc1849330, + 0xf34aa72e, 0xbdc3ac87, 0x6e58b07c, 0x20d1bbd5, 0x0bc4d840, + 0x454dd3e9, 0x96d6cf12, 0xd85fc4bb, 0xea91f0a5, 0xa418fb0c, + 0x7783e7f7, 0x390aec5e, 0x881ec2a9, 0xc697c900, 0x150cd5fb, + 0x5b85de52, 0x694bea4c, 0x27c2e1e5, 0xf459fd1e, 0xbad0f6b7, + 0x91c59522, 0xdf4c9e8b, 0x0cd78270, 0x425e89d9, 0x7090bdc7, + 0x3e19b66e, 0xed82aa95, 0xa30ba13c, 0xbba86dbf, 0xf5216616, + 0x26ba7aed, 0x68337144, 0x5afd455a, 0x14744ef3, 0xc7ef5208, + 0x896659a1, 0xa2733a34, 0xecfa319d, 0x3f612d66, 0x71e826cf, + 0x432612d1, 0x0daf1978, 0xde340583, 0x90bd0e2a, 0xef739c85, + 0xa1fa972c, 0x72618bd7, 0x3ce8807e, 0x0e26b460, 0x40afbfc9, + 0x9334a332, 0xddbda89b, 0xf6a8cb0e, 0xb821c0a7, 0x6bbadc5c, + 0x2533d7f5, 0x17fde3eb, 0x5974e842, 0x8aeff4b9, 0xc466ff10, + 0xdcc53393, 0x924c383a, 0x41d724c1, 0x0f5e2f68, 0x3d901b76, + 0x731910df, 0xa0820c24, 0xee0b078d, 0xc51e6418, 0x8b976fb1, + 0x580c734a, 0x168578e3, 0x244b4cfd, 0x6ac24754, 0xb9595baf, + 0xf7d05006}, + {0x00000000, 0x8d88fde2, 0xc060fd85, 0x4de80067, 0x5bb0fd4b, + 0xd63800a9, 0x9bd000ce, 0x1658fd2c, 0xb761fa96, 0x3ae90774, + 0x77010713, 0xfa89faf1, 0xecd107dd, 0x6159fa3f, 0x2cb1fa58, + 0xa13907ba, 0xb5b2f36d, 0x383a0e8f, 0x75d20ee8, 0xf85af30a, + 0xee020e26, 0x638af3c4, 0x2e62f3a3, 0xa3ea0e41, 0x02d309fb, + 0x8f5bf419, 0xc2b3f47e, 0x4f3b099c, 0x5963f4b0, 0xd4eb0952, + 0x99030935, 0x148bf4d7, 0xb014e09b, 0x3d9c1d79, 0x70741d1e, + 0xfdfce0fc, 0xeba41dd0, 0x662ce032, 0x2bc4e055, 0xa64c1db7, + 0x07751a0d, 0x8afde7ef, 0xc715e788, 0x4a9d1a6a, 0x5cc5e746, + 0xd14d1aa4, 0x9ca51ac3, 0x112de721, 0x05a613f6, 0x882eee14, + 0xc5c6ee73, 0x484e1391, 0x5e16eebd, 0xd39e135f, 0x9e761338, + 0x13feeeda, 0xb2c7e960, 0x3f4f1482, 0x72a714e5, 0xff2fe907, + 0xe977142b, 0x64ffe9c9, 0x2917e9ae, 0xa49f144c, 0xbb58c777, + 0x36d03a95, 0x7b383af2, 0xf6b0c710, 0xe0e83a3c, 0x6d60c7de, + 0x2088c7b9, 0xad003a5b, 0x0c393de1, 0x81b1c003, 0xcc59c064, + 0x41d13d86, 0x5789c0aa, 0xda013d48, 0x97e93d2f, 0x1a61c0cd, + 0x0eea341a, 0x8362c9f8, 0xce8ac99f, 0x4302347d, 0x555ac951, + 0xd8d234b3, 0x953a34d4, 0x18b2c936, 0xb98bce8c, 0x3403336e, + 0x79eb3309, 0xf463ceeb, 0xe23b33c7, 0x6fb3ce25, 0x225bce42, + 0xafd333a0, 0x0b4c27ec, 0x86c4da0e, 0xcb2cda69, 0x46a4278b, + 0x50fcdaa7, 0xdd742745, 0x909c2722, 0x1d14dac0, 0xbc2ddd7a, + 0x31a52098, 0x7c4d20ff, 0xf1c5dd1d, 0xe79d2031, 0x6a15ddd3, + 0x27fdddb4, 0xaa752056, 0xbefed481, 0x33762963, 0x7e9e2904, + 0xf316d4e6, 0xe54e29ca, 0x68c6d428, 0x252ed44f, 0xa8a629ad, + 0x099f2e17, 0x8417d3f5, 0xc9ffd392, 0x44772e70, 0x522fd35c, + 0xdfa72ebe, 0x924f2ed9, 0x1fc7d33b, 0xadc088af, 0x2048754d, + 0x6da0752a, 0xe02888c8, 0xf67075e4, 0x7bf88806, 0x36108861, + 0xbb987583, 0x1aa17239, 0x97298fdb, 0xdac18fbc, 0x5749725e, + 0x41118f72, 0xcc997290, 0x817172f7, 0x0cf98f15, 0x18727bc2, + 0x95fa8620, 0xd8128647, 0x559a7ba5, 0x43c28689, 0xce4a7b6b, + 0x83a27b0c, 0x0e2a86ee, 0xaf138154, 0x229b7cb6, 0x6f737cd1, + 0xe2fb8133, 0xf4a37c1f, 0x792b81fd, 0x34c3819a, 0xb94b7c78, + 0x1dd46834, 0x905c95d6, 0xddb495b1, 0x503c6853, 0x4664957f, + 0xcbec689d, 0x860468fa, 0x0b8c9518, 0xaab592a2, 0x273d6f40, + 0x6ad56f27, 0xe75d92c5, 0xf1056fe9, 0x7c8d920b, 0x3165926c, + 0xbced6f8e, 0xa8669b59, 0x25ee66bb, 0x680666dc, 0xe58e9b3e, + 0xf3d66612, 0x7e5e9bf0, 0x33b69b97, 0xbe3e6675, 0x1f0761cf, + 0x928f9c2d, 0xdf679c4a, 0x52ef61a8, 0x44b79c84, 0xc93f6166, + 0x84d76101, 0x095f9ce3, 0x16984fd8, 0x9b10b23a, 0xd6f8b25d, + 0x5b704fbf, 0x4d28b293, 0xc0a04f71, 0x8d484f16, 0x00c0b2f4, + 0xa1f9b54e, 0x2c7148ac, 0x619948cb, 0xec11b529, 0xfa494805, + 0x77c1b5e7, 0x3a29b580, 0xb7a14862, 0xa32abcb5, 0x2ea24157, + 0x634a4130, 0xeec2bcd2, 0xf89a41fe, 0x7512bc1c, 0x38fabc7b, + 0xb5724199, 0x144b4623, 0x99c3bbc1, 0xd42bbba6, 0x59a34644, + 0x4ffbbb68, 0xc273468a, 0x8f9b46ed, 0x0213bb0f, 0xa68caf43, + 0x2b0452a1, 0x66ec52c6, 0xeb64af24, 0xfd3c5208, 0x70b4afea, + 0x3d5caf8d, 0xb0d4526f, 0x11ed55d5, 0x9c65a837, 0xd18da850, + 0x5c0555b2, 0x4a5da89e, 0xc7d5557c, 0x8a3d551b, 0x07b5a8f9, + 0x133e5c2e, 0x9eb6a1cc, 0xd35ea1ab, 0x5ed65c49, 0x488ea165, + 0xc5065c87, 0x88ee5ce0, 0x0566a102, 0xa45fa6b8, 0x29d75b5a, + 0x643f5b3d, 0xe9b7a6df, 0xffef5bf3, 0x7267a611, 0x3f8fa676, + 0xb2075b94}, + {0x00000000, 0x80f0171f, 0xda91287f, 0x5a613f60, 0x6e5356bf, + 0xeea341a0, 0xb4c27ec0, 0x343269df, 0xdca6ad7e, 0x5c56ba61, + 0x06378501, 0x86c7921e, 0xb2f5fbc1, 0x3205ecde, 0x6864d3be, + 0xe894c4a1, 0x623c5cbd, 0xe2cc4ba2, 0xb8ad74c2, 0x385d63dd, + 0x0c6f0a02, 0x8c9f1d1d, 0xd6fe227d, 0x560e3562, 0xbe9af1c3, + 0x3e6ae6dc, 0x640bd9bc, 0xe4fbcea3, 0xd0c9a77c, 0x5039b063, + 0x0a588f03, 0x8aa8981c, 0xc478b97a, 0x4488ae65, 0x1ee99105, + 0x9e19861a, 0xaa2befc5, 0x2adbf8da, 0x70bac7ba, 0xf04ad0a5, + 0x18de1404, 0x982e031b, 0xc24f3c7b, 0x42bf2b64, 0x768d42bb, + 0xf67d55a4, 0xac1c6ac4, 0x2cec7ddb, 0xa644e5c7, 0x26b4f2d8, + 0x7cd5cdb8, 0xfc25daa7, 0xc817b378, 0x48e7a467, 0x12869b07, + 0x92768c18, 0x7ae248b9, 0xfa125fa6, 0xa07360c6, 0x208377d9, + 0x14b11e06, 0x94410919, 0xce203679, 0x4ed02166, 0x538074b5, + 0xd37063aa, 0x89115cca, 0x09e14bd5, 0x3dd3220a, 0xbd233515, + 0xe7420a75, 0x67b21d6a, 0x8f26d9cb, 0x0fd6ced4, 0x55b7f1b4, + 0xd547e6ab, 0xe1758f74, 0x6185986b, 0x3be4a70b, 0xbb14b014, + 0x31bc2808, 0xb14c3f17, 0xeb2d0077, 0x6bdd1768, 0x5fef7eb7, + 0xdf1f69a8, 0x857e56c8, 0x058e41d7, 0xed1a8576, 0x6dea9269, + 0x378bad09, 0xb77bba16, 0x8349d3c9, 0x03b9c4d6, 0x59d8fbb6, + 0xd928eca9, 0x97f8cdcf, 0x1708dad0, 0x4d69e5b0, 0xcd99f2af, + 0xf9ab9b70, 0x795b8c6f, 0x233ab30f, 0xa3caa410, 0x4b5e60b1, + 0xcbae77ae, 0x91cf48ce, 0x113f5fd1, 0x250d360e, 0xa5fd2111, + 0xff9c1e71, 0x7f6c096e, 0xf5c49172, 0x7534866d, 0x2f55b90d, + 0xafa5ae12, 0x9b97c7cd, 0x1b67d0d2, 0x4106efb2, 0xc1f6f8ad, + 0x29623c0c, 0xa9922b13, 0xf3f31473, 0x7303036c, 0x47316ab3, + 0xc7c17dac, 0x9da042cc, 0x1d5055d3, 0xa700e96a, 0x27f0fe75, + 0x7d91c115, 0xfd61d60a, 0xc953bfd5, 0x49a3a8ca, 0x13c297aa, + 0x933280b5, 0x7ba64414, 0xfb56530b, 0xa1376c6b, 0x21c77b74, + 0x15f512ab, 0x950505b4, 0xcf643ad4, 0x4f942dcb, 0xc53cb5d7, + 0x45cca2c8, 0x1fad9da8, 0x9f5d8ab7, 0xab6fe368, 0x2b9ff477, + 0x71fecb17, 0xf10edc08, 0x199a18a9, 0x996a0fb6, 0xc30b30d6, + 0x43fb27c9, 0x77c94e16, 0xf7395909, 0xad586669, 0x2da87176, + 0x63785010, 0xe388470f, 0xb9e9786f, 0x39196f70, 0x0d2b06af, + 0x8ddb11b0, 0xd7ba2ed0, 0x574a39cf, 0xbfdefd6e, 0x3f2eea71, + 0x654fd511, 0xe5bfc20e, 0xd18dabd1, 0x517dbcce, 0x0b1c83ae, + 0x8bec94b1, 0x01440cad, 0x81b41bb2, 0xdbd524d2, 0x5b2533cd, + 0x6f175a12, 0xefe74d0d, 0xb586726d, 0x35766572, 0xdde2a1d3, + 0x5d12b6cc, 0x077389ac, 0x87839eb3, 0xb3b1f76c, 0x3341e073, + 0x6920df13, 0xe9d0c80c, 0xf4809ddf, 0x74708ac0, 0x2e11b5a0, + 0xaee1a2bf, 0x9ad3cb60, 0x1a23dc7f, 0x4042e31f, 0xc0b2f400, + 0x282630a1, 0xa8d627be, 0xf2b718de, 0x72470fc1, 0x4675661e, + 0xc6857101, 0x9ce44e61, 0x1c14597e, 0x96bcc162, 0x164cd67d, + 0x4c2de91d, 0xccddfe02, 0xf8ef97dd, 0x781f80c2, 0x227ebfa2, + 0xa28ea8bd, 0x4a1a6c1c, 0xcaea7b03, 0x908b4463, 0x107b537c, + 0x24493aa3, 0xa4b92dbc, 0xfed812dc, 0x7e2805c3, 0x30f824a5, + 0xb00833ba, 0xea690cda, 0x6a991bc5, 0x5eab721a, 0xde5b6505, + 0x843a5a65, 0x04ca4d7a, 0xec5e89db, 0x6cae9ec4, 0x36cfa1a4, + 0xb63fb6bb, 0x820ddf64, 0x02fdc87b, 0x589cf71b, 0xd86ce004, + 0x52c47818, 0xd2346f07, 0x88555067, 0x08a54778, 0x3c972ea7, + 0xbc6739b8, 0xe60606d8, 0x66f611c7, 0x8e62d566, 0x0e92c279, + 0x54f3fd19, 0xd403ea06, 0xe03183d9, 0x60c194c6, 0x3aa0aba6, + 0xba50bcb9}, + {0x00000000, 0x9570d495, 0xf190af6b, 0x64e07bfe, 0x38505897, + 0xad208c02, 0xc9c0f7fc, 0x5cb02369, 0x70a0b12e, 0xe5d065bb, + 0x81301e45, 0x1440cad0, 0x48f0e9b9, 0xdd803d2c, 0xb96046d2, + 0x2c109247, 0xe141625c, 0x7431b6c9, 0x10d1cd37, 0x85a119a2, + 0xd9113acb, 0x4c61ee5e, 0x288195a0, 0xbdf14135, 0x91e1d372, + 0x049107e7, 0x60717c19, 0xf501a88c, 0xa9b18be5, 0x3cc15f70, + 0x5821248e, 0xcd51f01b, 0x19f3c2f9, 0x8c83166c, 0xe8636d92, + 0x7d13b907, 0x21a39a6e, 0xb4d34efb, 0xd0333505, 0x4543e190, + 0x695373d7, 0xfc23a742, 0x98c3dcbc, 0x0db30829, 0x51032b40, + 0xc473ffd5, 0xa093842b, 0x35e350be, 0xf8b2a0a5, 0x6dc27430, + 0x09220fce, 0x9c52db5b, 0xc0e2f832, 0x55922ca7, 0x31725759, + 0xa40283cc, 0x8812118b, 0x1d62c51e, 0x7982bee0, 0xecf26a75, + 0xb042491c, 0x25329d89, 0x41d2e677, 0xd4a232e2, 0x33e785f2, + 0xa6975167, 0xc2772a99, 0x5707fe0c, 0x0bb7dd65, 0x9ec709f0, + 0xfa27720e, 0x6f57a69b, 0x434734dc, 0xd637e049, 0xb2d79bb7, + 0x27a74f22, 0x7b176c4b, 0xee67b8de, 0x8a87c320, 0x1ff717b5, + 0xd2a6e7ae, 0x47d6333b, 0x233648c5, 0xb6469c50, 0xeaf6bf39, + 0x7f866bac, 0x1b661052, 0x8e16c4c7, 0xa2065680, 0x37768215, + 0x5396f9eb, 0xc6e62d7e, 0x9a560e17, 0x0f26da82, 0x6bc6a17c, + 0xfeb675e9, 0x2a14470b, 0xbf64939e, 0xdb84e860, 0x4ef43cf5, + 0x12441f9c, 0x8734cb09, 0xe3d4b0f7, 0x76a46462, 0x5ab4f625, + 0xcfc422b0, 0xab24594e, 0x3e548ddb, 0x62e4aeb2, 0xf7947a27, + 0x937401d9, 0x0604d54c, 0xcb552557, 0x5e25f1c2, 0x3ac58a3c, + 0xafb55ea9, 0xf3057dc0, 0x6675a955, 0x0295d2ab, 0x97e5063e, + 0xbbf59479, 0x2e8540ec, 0x4a653b12, 0xdf15ef87, 0x83a5ccee, + 0x16d5187b, 0x72356385, 0xe745b710, 0x67cf0be4, 0xf2bfdf71, + 0x965fa48f, 0x032f701a, 0x5f9f5373, 0xcaef87e6, 0xae0ffc18, + 0x3b7f288d, 0x176fbaca, 0x821f6e5f, 0xe6ff15a1, 0x738fc134, + 0x2f3fe25d, 0xba4f36c8, 0xdeaf4d36, 0x4bdf99a3, 0x868e69b8, + 0x13febd2d, 0x771ec6d3, 0xe26e1246, 0xbede312f, 0x2baee5ba, + 0x4f4e9e44, 0xda3e4ad1, 0xf62ed896, 0x635e0c03, 0x07be77fd, + 0x92cea368, 0xce7e8001, 0x5b0e5494, 0x3fee2f6a, 0xaa9efbff, + 0x7e3cc91d, 0xeb4c1d88, 0x8fac6676, 0x1adcb2e3, 0x466c918a, + 0xd31c451f, 0xb7fc3ee1, 0x228cea74, 0x0e9c7833, 0x9becaca6, + 0xff0cd758, 0x6a7c03cd, 0x36cc20a4, 0xa3bcf431, 0xc75c8fcf, + 0x522c5b5a, 0x9f7dab41, 0x0a0d7fd4, 0x6eed042a, 0xfb9dd0bf, + 0xa72df3d6, 0x325d2743, 0x56bd5cbd, 0xc3cd8828, 0xefdd1a6f, + 0x7aadcefa, 0x1e4db504, 0x8b3d6191, 0xd78d42f8, 0x42fd966d, + 0x261ded93, 0xb36d3906, 0x54288e16, 0xc1585a83, 0xa5b8217d, + 0x30c8f5e8, 0x6c78d681, 0xf9080214, 0x9de879ea, 0x0898ad7f, + 0x24883f38, 0xb1f8ebad, 0xd5189053, 0x406844c6, 0x1cd867af, + 0x89a8b33a, 0xed48c8c4, 0x78381c51, 0xb569ec4a, 0x201938df, + 0x44f94321, 0xd18997b4, 0x8d39b4dd, 0x18496048, 0x7ca91bb6, + 0xe9d9cf23, 0xc5c95d64, 0x50b989f1, 0x3459f20f, 0xa129269a, + 0xfd9905f3, 0x68e9d166, 0x0c09aa98, 0x99797e0d, 0x4ddb4cef, + 0xd8ab987a, 0xbc4be384, 0x293b3711, 0x758b1478, 0xe0fbc0ed, + 0x841bbb13, 0x116b6f86, 0x3d7bfdc1, 0xa80b2954, 0xcceb52aa, + 0x599b863f, 0x052ba556, 0x905b71c3, 0xf4bb0a3d, 0x61cbdea8, + 0xac9a2eb3, 0x39eafa26, 0x5d0a81d8, 0xc87a554d, 0x94ca7624, + 0x01baa2b1, 0x655ad94f, 0xf02a0dda, 0xdc3a9f9d, 0x494a4b08, + 0x2daa30f6, 0xb8dae463, 0xe46ac70a, 0x711a139f, 0x15fa6861, + 0x808abcf4}, + {0x00000000, 0xcf9e17c8, 0x444d29d1, 0x8bd33e19, 0x889a53a2, + 0x4704446a, 0xccd77a73, 0x03496dbb, 0xca45a105, 0x05dbb6cd, + 0x8e0888d4, 0x41969f1c, 0x42dff2a7, 0x8d41e56f, 0x0692db76, + 0xc90cccbe, 0x4ffa444b, 0x80645383, 0x0bb76d9a, 0xc4297a52, + 0xc76017e9, 0x08fe0021, 0x832d3e38, 0x4cb329f0, 0x85bfe54e, + 0x4a21f286, 0xc1f2cc9f, 0x0e6cdb57, 0x0d25b6ec, 0xc2bba124, + 0x49689f3d, 0x86f688f5, 0x9ff48896, 0x506a9f5e, 0xdbb9a147, + 0x1427b68f, 0x176edb34, 0xd8f0ccfc, 0x5323f2e5, 0x9cbde52d, + 0x55b12993, 0x9a2f3e5b, 0x11fc0042, 0xde62178a, 0xdd2b7a31, + 0x12b56df9, 0x996653e0, 0x56f84428, 0xd00eccdd, 0x1f90db15, + 0x9443e50c, 0x5bddf2c4, 0x58949f7f, 0x970a88b7, 0x1cd9b6ae, + 0xd347a166, 0x1a4b6dd8, 0xd5d57a10, 0x5e064409, 0x919853c1, + 0x92d13e7a, 0x5d4f29b2, 0xd69c17ab, 0x19020063, 0xe498176d, + 0x2b0600a5, 0xa0d53ebc, 0x6f4b2974, 0x6c0244cf, 0xa39c5307, + 0x284f6d1e, 0xe7d17ad6, 0x2eddb668, 0xe143a1a0, 0x6a909fb9, + 0xa50e8871, 0xa647e5ca, 0x69d9f202, 0xe20acc1b, 0x2d94dbd3, + 0xab625326, 0x64fc44ee, 0xef2f7af7, 0x20b16d3f, 0x23f80084, + 0xec66174c, 0x67b52955, 0xa82b3e9d, 0x6127f223, 0xaeb9e5eb, + 0x256adbf2, 0xeaf4cc3a, 0xe9bda181, 0x2623b649, 0xadf08850, + 0x626e9f98, 0x7b6c9ffb, 0xb4f28833, 0x3f21b62a, 0xf0bfa1e2, + 0xf3f6cc59, 0x3c68db91, 0xb7bbe588, 0x7825f240, 0xb1293efe, + 0x7eb72936, 0xf564172f, 0x3afa00e7, 0x39b36d5c, 0xf62d7a94, + 0x7dfe448d, 0xb2605345, 0x3496dbb0, 0xfb08cc78, 0x70dbf261, + 0xbf45e5a9, 0xbc0c8812, 0x73929fda, 0xf841a1c3, 0x37dfb60b, + 0xfed37ab5, 0x314d6d7d, 0xba9e5364, 0x750044ac, 0x76492917, + 0xb9d73edf, 0x320400c6, 0xfd9a170e, 0x1241289b, 0xdddf3f53, + 0x560c014a, 0x99921682, 0x9adb7b39, 0x55456cf1, 0xde9652e8, + 0x11084520, 0xd804899e, 0x179a9e56, 0x9c49a04f, 0x53d7b787, + 0x509eda3c, 0x9f00cdf4, 0x14d3f3ed, 0xdb4de425, 0x5dbb6cd0, + 0x92257b18, 0x19f64501, 0xd66852c9, 0xd5213f72, 0x1abf28ba, + 0x916c16a3, 0x5ef2016b, 0x97fecdd5, 0x5860da1d, 0xd3b3e404, + 0x1c2df3cc, 0x1f649e77, 0xd0fa89bf, 0x5b29b7a6, 0x94b7a06e, + 0x8db5a00d, 0x422bb7c5, 0xc9f889dc, 0x06669e14, 0x052ff3af, + 0xcab1e467, 0x4162da7e, 0x8efccdb6, 0x47f00108, 0x886e16c0, + 0x03bd28d9, 0xcc233f11, 0xcf6a52aa, 0x00f44562, 0x8b277b7b, + 0x44b96cb3, 0xc24fe446, 0x0dd1f38e, 0x8602cd97, 0x499cda5f, + 0x4ad5b7e4, 0x854ba02c, 0x0e989e35, 0xc10689fd, 0x080a4543, + 0xc794528b, 0x4c476c92, 0x83d97b5a, 0x809016e1, 0x4f0e0129, + 0xc4dd3f30, 0x0b4328f8, 0xf6d93ff6, 0x3947283e, 0xb2941627, + 0x7d0a01ef, 0x7e436c54, 0xb1dd7b9c, 0x3a0e4585, 0xf590524d, + 0x3c9c9ef3, 0xf302893b, 0x78d1b722, 0xb74fa0ea, 0xb406cd51, + 0x7b98da99, 0xf04be480, 0x3fd5f348, 0xb9237bbd, 0x76bd6c75, + 0xfd6e526c, 0x32f045a4, 0x31b9281f, 0xfe273fd7, 0x75f401ce, + 0xba6a1606, 0x7366dab8, 0xbcf8cd70, 0x372bf369, 0xf8b5e4a1, + 0xfbfc891a, 0x34629ed2, 0xbfb1a0cb, 0x702fb703, 0x692db760, + 0xa6b3a0a8, 0x2d609eb1, 0xe2fe8979, 0xe1b7e4c2, 0x2e29f30a, + 0xa5facd13, 0x6a64dadb, 0xa3681665, 0x6cf601ad, 0xe7253fb4, + 0x28bb287c, 0x2bf245c7, 0xe46c520f, 0x6fbf6c16, 0xa0217bde, + 0x26d7f32b, 0xe949e4e3, 0x629adafa, 0xad04cd32, 0xae4da089, + 0x61d3b741, 0xea008958, 0x259e9e90, 0xec92522e, 0x230c45e6, + 0xa8df7bff, 0x67416c37, 0x6408018c, 0xab961644, 0x2045285d, + 0xefdb3f95}, + {0x00000000, 0x24825136, 0x4904a26c, 0x6d86f35a, 0x920944d8, + 0xb68b15ee, 0xdb0de6b4, 0xff8fb782, 0xff638ff1, 0xdbe1dec7, + 0xb6672d9d, 0x92e57cab, 0x6d6acb29, 0x49e89a1f, 0x246e6945, + 0x00ec3873, 0x25b619a3, 0x01344895, 0x6cb2bbcf, 0x4830eaf9, + 0xb7bf5d7b, 0x933d0c4d, 0xfebbff17, 0xda39ae21, 0xdad59652, + 0xfe57c764, 0x93d1343e, 0xb7536508, 0x48dcd28a, 0x6c5e83bc, + 0x01d870e6, 0x255a21d0, 0x4b6c3346, 0x6fee6270, 0x0268912a, + 0x26eac01c, 0xd965779e, 0xfde726a8, 0x9061d5f2, 0xb4e384c4, + 0xb40fbcb7, 0x908ded81, 0xfd0b1edb, 0xd9894fed, 0x2606f86f, + 0x0284a959, 0x6f025a03, 0x4b800b35, 0x6eda2ae5, 0x4a587bd3, + 0x27de8889, 0x035cd9bf, 0xfcd36e3d, 0xd8513f0b, 0xb5d7cc51, + 0x91559d67, 0x91b9a514, 0xb53bf422, 0xd8bd0778, 0xfc3f564e, + 0x03b0e1cc, 0x2732b0fa, 0x4ab443a0, 0x6e361296, 0x96d8668c, + 0xb25a37ba, 0xdfdcc4e0, 0xfb5e95d6, 0x04d12254, 0x20537362, + 0x4dd58038, 0x6957d10e, 0x69bbe97d, 0x4d39b84b, 0x20bf4b11, + 0x043d1a27, 0xfbb2ada5, 0xdf30fc93, 0xb2b60fc9, 0x96345eff, + 0xb36e7f2f, 0x97ec2e19, 0xfa6add43, 0xdee88c75, 0x21673bf7, + 0x05e56ac1, 0x6863999b, 0x4ce1c8ad, 0x4c0df0de, 0x688fa1e8, + 0x050952b2, 0x218b0384, 0xde04b406, 0xfa86e530, 0x9700166a, + 0xb382475c, 0xddb455ca, 0xf93604fc, 0x94b0f7a6, 0xb032a690, + 0x4fbd1112, 0x6b3f4024, 0x06b9b37e, 0x223be248, 0x22d7da3b, + 0x06558b0d, 0x6bd37857, 0x4f512961, 0xb0de9ee3, 0x945ccfd5, + 0xf9da3c8f, 0xdd586db9, 0xf8024c69, 0xdc801d5f, 0xb106ee05, + 0x9584bf33, 0x6a0b08b1, 0x4e895987, 0x230faadd, 0x078dfbeb, + 0x0761c398, 0x23e392ae, 0x4e6561f4, 0x6ae730c2, 0x95688740, + 0xb1ead676, 0xdc6c252c, 0xf8ee741a, 0xf6c1cb59, 0xd2439a6f, + 0xbfc56935, 0x9b473803, 0x64c88f81, 0x404adeb7, 0x2dcc2ded, + 0x094e7cdb, 0x09a244a8, 0x2d20159e, 0x40a6e6c4, 0x6424b7f2, + 0x9bab0070, 0xbf295146, 0xd2afa21c, 0xf62df32a, 0xd377d2fa, + 0xf7f583cc, 0x9a737096, 0xbef121a0, 0x417e9622, 0x65fcc714, + 0x087a344e, 0x2cf86578, 0x2c145d0b, 0x08960c3d, 0x6510ff67, + 0x4192ae51, 0xbe1d19d3, 0x9a9f48e5, 0xf719bbbf, 0xd39bea89, + 0xbdadf81f, 0x992fa929, 0xf4a95a73, 0xd02b0b45, 0x2fa4bcc7, + 0x0b26edf1, 0x66a01eab, 0x42224f9d, 0x42ce77ee, 0x664c26d8, + 0x0bcad582, 0x2f4884b4, 0xd0c73336, 0xf4456200, 0x99c3915a, + 0xbd41c06c, 0x981be1bc, 0xbc99b08a, 0xd11f43d0, 0xf59d12e6, + 0x0a12a564, 0x2e90f452, 0x43160708, 0x6794563e, 0x67786e4d, + 0x43fa3f7b, 0x2e7ccc21, 0x0afe9d17, 0xf5712a95, 0xd1f37ba3, + 0xbc7588f9, 0x98f7d9cf, 0x6019add5, 0x449bfce3, 0x291d0fb9, + 0x0d9f5e8f, 0xf210e90d, 0xd692b83b, 0xbb144b61, 0x9f961a57, + 0x9f7a2224, 0xbbf87312, 0xd67e8048, 0xf2fcd17e, 0x0d7366fc, + 0x29f137ca, 0x4477c490, 0x60f595a6, 0x45afb476, 0x612de540, + 0x0cab161a, 0x2829472c, 0xd7a6f0ae, 0xf324a198, 0x9ea252c2, + 0xba2003f4, 0xbacc3b87, 0x9e4e6ab1, 0xf3c899eb, 0xd74ac8dd, + 0x28c57f5f, 0x0c472e69, 0x61c1dd33, 0x45438c05, 0x2b759e93, + 0x0ff7cfa5, 0x62713cff, 0x46f36dc9, 0xb97cda4b, 0x9dfe8b7d, + 0xf0787827, 0xd4fa2911, 0xd4161162, 0xf0944054, 0x9d12b30e, + 0xb990e238, 0x461f55ba, 0x629d048c, 0x0f1bf7d6, 0x2b99a6e0, + 0x0ec38730, 0x2a41d606, 0x47c7255c, 0x6345746a, 0x9ccac3e8, + 0xb84892de, 0xd5ce6184, 0xf14c30b2, 0xf1a008c1, 0xd52259f7, + 0xb8a4aaad, 0x9c26fb9b, 0x63a94c19, 0x472b1d2f, 0x2aadee75, + 0x0e2fbf43}, + {0x00000000, 0x36f290f3, 0x6de521e6, 0x5b17b115, 0xdbca43cc, + 0xed38d33f, 0xb62f622a, 0x80ddf2d9, 0x6ce581d9, 0x5a17112a, + 0x0100a03f, 0x37f230cc, 0xb72fc215, 0x81dd52e6, 0xdacae3f3, + 0xec387300, 0xd9cb03b2, 0xef399341, 0xb42e2254, 0x82dcb2a7, + 0x0201407e, 0x34f3d08d, 0x6fe46198, 0x5916f16b, 0xb52e826b, + 0x83dc1298, 0xd8cba38d, 0xee39337e, 0x6ee4c1a7, 0x58165154, + 0x0301e041, 0x35f370b2, 0x68e70125, 0x5e1591d6, 0x050220c3, + 0x33f0b030, 0xb32d42e9, 0x85dfd21a, 0xdec8630f, 0xe83af3fc, + 0x040280fc, 0x32f0100f, 0x69e7a11a, 0x5f1531e9, 0xdfc8c330, + 0xe93a53c3, 0xb22de2d6, 0x84df7225, 0xb12c0297, 0x87de9264, + 0xdcc92371, 0xea3bb382, 0x6ae6415b, 0x5c14d1a8, 0x070360bd, + 0x31f1f04e, 0xddc9834e, 0xeb3b13bd, 0xb02ca2a8, 0x86de325b, + 0x0603c082, 0x30f15071, 0x6be6e164, 0x5d147197, 0xd1ce024a, + 0xe73c92b9, 0xbc2b23ac, 0x8ad9b35f, 0x0a044186, 0x3cf6d175, + 0x67e16060, 0x5113f093, 0xbd2b8393, 0x8bd91360, 0xd0cea275, + 0xe63c3286, 0x66e1c05f, 0x501350ac, 0x0b04e1b9, 0x3df6714a, + 0x080501f8, 0x3ef7910b, 0x65e0201e, 0x5312b0ed, 0xd3cf4234, + 0xe53dd2c7, 0xbe2a63d2, 0x88d8f321, 0x64e08021, 0x521210d2, + 0x0905a1c7, 0x3ff73134, 0xbf2ac3ed, 0x89d8531e, 0xd2cfe20b, + 0xe43d72f8, 0xb929036f, 0x8fdb939c, 0xd4cc2289, 0xe23eb27a, + 0x62e340a3, 0x5411d050, 0x0f066145, 0x39f4f1b6, 0xd5cc82b6, + 0xe33e1245, 0xb829a350, 0x8edb33a3, 0x0e06c17a, 0x38f45189, + 0x63e3e09c, 0x5511706f, 0x60e200dd, 0x5610902e, 0x0d07213b, + 0x3bf5b1c8, 0xbb284311, 0x8ddad3e2, 0xd6cd62f7, 0xe03ff204, + 0x0c078104, 0x3af511f7, 0x61e2a0e2, 0x57103011, 0xd7cdc2c8, + 0xe13f523b, 0xba28e32e, 0x8cda73dd, 0x78ed02d5, 0x4e1f9226, + 0x15082333, 0x23fab3c0, 0xa3274119, 0x95d5d1ea, 0xcec260ff, + 0xf830f00c, 0x1408830c, 0x22fa13ff, 0x79eda2ea, 0x4f1f3219, + 0xcfc2c0c0, 0xf9305033, 0xa227e126, 0x94d571d5, 0xa1260167, + 0x97d49194, 0xccc32081, 0xfa31b072, 0x7aec42ab, 0x4c1ed258, + 0x1709634d, 0x21fbf3be, 0xcdc380be, 0xfb31104d, 0xa026a158, + 0x96d431ab, 0x1609c372, 0x20fb5381, 0x7bece294, 0x4d1e7267, + 0x100a03f0, 0x26f89303, 0x7def2216, 0x4b1db2e5, 0xcbc0403c, + 0xfd32d0cf, 0xa62561da, 0x90d7f129, 0x7cef8229, 0x4a1d12da, + 0x110aa3cf, 0x27f8333c, 0xa725c1e5, 0x91d75116, 0xcac0e003, + 0xfc3270f0, 0xc9c10042, 0xff3390b1, 0xa42421a4, 0x92d6b157, + 0x120b438e, 0x24f9d37d, 0x7fee6268, 0x491cf29b, 0xa524819b, + 0x93d61168, 0xc8c1a07d, 0xfe33308e, 0x7eeec257, 0x481c52a4, + 0x130be3b1, 0x25f97342, 0xa923009f, 0x9fd1906c, 0xc4c62179, + 0xf234b18a, 0x72e94353, 0x441bd3a0, 0x1f0c62b5, 0x29fef246, + 0xc5c68146, 0xf33411b5, 0xa823a0a0, 0x9ed13053, 0x1e0cc28a, + 0x28fe5279, 0x73e9e36c, 0x451b739f, 0x70e8032d, 0x461a93de, + 0x1d0d22cb, 0x2bffb238, 0xab2240e1, 0x9dd0d012, 0xc6c76107, + 0xf035f1f4, 0x1c0d82f4, 0x2aff1207, 0x71e8a312, 0x471a33e1, + 0xc7c7c138, 0xf13551cb, 0xaa22e0de, 0x9cd0702d, 0xc1c401ba, + 0xf7369149, 0xac21205c, 0x9ad3b0af, 0x1a0e4276, 0x2cfcd285, + 0x77eb6390, 0x4119f363, 0xad218063, 0x9bd31090, 0xc0c4a185, + 0xf6363176, 0x76ebc3af, 0x4019535c, 0x1b0ee249, 0x2dfc72ba, + 0x180f0208, 0x2efd92fb, 0x75ea23ee, 0x4318b31d, 0xc3c541c4, + 0xf537d137, 0xae206022, 0x98d2f0d1, 0x74ea83d1, 0x42181322, + 0x190fa237, 0x2ffd32c4, 0xaf20c01d, 0x99d250ee, 0xc2c5e1fb, + 0xf4377108}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0xf390f23600000000, 0xe621e56d00000000, + 0x15b1175b00000000, 0xcc43cadb00000000, 0x3fd338ed00000000, + 0x2a622fb600000000, 0xd9f2dd8000000000, 0xd981e56c00000000, + 0x2a11175a00000000, 0x3fa0000100000000, 0xcc30f23700000000, + 0x15c22fb700000000, 0xe652dd8100000000, 0xf3e3cada00000000, + 0x007338ec00000000, 0xb203cbd900000000, 0x419339ef00000000, + 0x54222eb400000000, 0xa7b2dc8200000000, 0x7e40010200000000, + 0x8dd0f33400000000, 0x9861e46f00000000, 0x6bf1165900000000, + 0x6b822eb500000000, 0x9812dc8300000000, 0x8da3cbd800000000, + 0x7e3339ee00000000, 0xa7c1e46e00000000, 0x5451165800000000, + 0x41e0010300000000, 0xb270f33500000000, 0x2501e76800000000, + 0xd691155e00000000, 0xc320020500000000, 0x30b0f03300000000, + 0xe9422db300000000, 0x1ad2df8500000000, 0x0f63c8de00000000, + 0xfcf33ae800000000, 0xfc80020400000000, 0x0f10f03200000000, + 0x1aa1e76900000000, 0xe931155f00000000, 0x30c3c8df00000000, + 0xc3533ae900000000, 0xd6e22db200000000, 0x2572df8400000000, + 0x97022cb100000000, 0x6492de8700000000, 0x7123c9dc00000000, + 0x82b33bea00000000, 0x5b41e66a00000000, 0xa8d1145c00000000, + 0xbd60030700000000, 0x4ef0f13100000000, 0x4e83c9dd00000000, + 0xbd133beb00000000, 0xa8a22cb000000000, 0x5b32de8600000000, + 0x82c0030600000000, 0x7150f13000000000, 0x64e1e66b00000000, + 0x9771145d00000000, 0x4a02ced100000000, 0xb9923ce700000000, + 0xac232bbc00000000, 0x5fb3d98a00000000, 0x8641040a00000000, + 0x75d1f63c00000000, 0x6060e16700000000, 0x93f0135100000000, + 0x93832bbd00000000, 0x6013d98b00000000, 0x75a2ced000000000, + 0x86323ce600000000, 0x5fc0e16600000000, 0xac50135000000000, + 0xb9e1040b00000000, 0x4a71f63d00000000, 0xf801050800000000, + 0x0b91f73e00000000, 0x1e20e06500000000, 0xedb0125300000000, + 0x3442cfd300000000, 0xc7d23de500000000, 0xd2632abe00000000, + 0x21f3d88800000000, 0x2180e06400000000, 0xd210125200000000, + 0xc7a1050900000000, 0x3431f73f00000000, 0xedc32abf00000000, + 0x1e53d88900000000, 0x0be2cfd200000000, 0xf8723de400000000, + 0x6f0329b900000000, 0x9c93db8f00000000, 0x8922ccd400000000, + 0x7ab23ee200000000, 0xa340e36200000000, 0x50d0115400000000, + 0x4561060f00000000, 0xb6f1f43900000000, 0xb682ccd500000000, + 0x45123ee300000000, 0x50a329b800000000, 0xa333db8e00000000, + 0x7ac1060e00000000, 0x8951f43800000000, 0x9ce0e36300000000, + 0x6f70115500000000, 0xdd00e26000000000, 0x2e90105600000000, + 0x3b21070d00000000, 0xc8b1f53b00000000, 0x114328bb00000000, + 0xe2d3da8d00000000, 0xf762cdd600000000, 0x04f23fe000000000, + 0x0481070c00000000, 0xf711f53a00000000, 0xe2a0e26100000000, + 0x1130105700000000, 0xc8c2cdd700000000, 0x3b523fe100000000, + 0x2ee328ba00000000, 0xdd73da8c00000000, 0xd502ed7800000000, + 0x26921f4e00000000, 0x3323081500000000, 0xc0b3fa2300000000, + 0x194127a300000000, 0xead1d59500000000, 0xff60c2ce00000000, + 0x0cf030f800000000, 0x0c83081400000000, 0xff13fa2200000000, + 0xeaa2ed7900000000, 0x19321f4f00000000, 0xc0c0c2cf00000000, + 0x335030f900000000, 0x26e127a200000000, 0xd571d59400000000, + 0x670126a100000000, 0x9491d49700000000, 0x8120c3cc00000000, + 0x72b031fa00000000, 0xab42ec7a00000000, 0x58d21e4c00000000, + 0x4d63091700000000, 0xbef3fb2100000000, 0xbe80c3cd00000000, + 0x4d1031fb00000000, 0x58a126a000000000, 0xab31d49600000000, + 0x72c3091600000000, 0x8153fb2000000000, 0x94e2ec7b00000000, + 0x67721e4d00000000, 0xf0030a1000000000, 0x0393f82600000000, + 0x1622ef7d00000000, 0xe5b21d4b00000000, 0x3c40c0cb00000000, + 0xcfd032fd00000000, 0xda6125a600000000, 0x29f1d79000000000, + 0x2982ef7c00000000, 0xda121d4a00000000, 0xcfa30a1100000000, + 0x3c33f82700000000, 0xe5c125a700000000, 0x1651d79100000000, + 0x03e0c0ca00000000, 0xf07032fc00000000, 0x4200c1c900000000, + 0xb19033ff00000000, 0xa42124a400000000, 0x57b1d69200000000, + 0x8e430b1200000000, 0x7dd3f92400000000, 0x6862ee7f00000000, + 0x9bf21c4900000000, 0x9b8124a500000000, 0x6811d69300000000, + 0x7da0c1c800000000, 0x8e3033fe00000000, 0x57c2ee7e00000000, + 0xa4521c4800000000, 0xb1e30b1300000000, 0x4273f92500000000, + 0x9f0023a900000000, 0x6c90d19f00000000, 0x7921c6c400000000, + 0x8ab134f200000000, 0x5343e97200000000, 0xa0d31b4400000000, + 0xb5620c1f00000000, 0x46f2fe2900000000, 0x4681c6c500000000, + 0xb51134f300000000, 0xa0a023a800000000, 0x5330d19e00000000, + 0x8ac20c1e00000000, 0x7952fe2800000000, 0x6ce3e97300000000, + 0x9f731b4500000000, 0x2d03e87000000000, 0xde931a4600000000, + 0xcb220d1d00000000, 0x38b2ff2b00000000, 0xe14022ab00000000, + 0x12d0d09d00000000, 0x0761c7c600000000, 0xf4f135f000000000, + 0xf4820d1c00000000, 0x0712ff2a00000000, 0x12a3e87100000000, + 0xe1331a4700000000, 0x38c1c7c700000000, 0xcb5135f100000000, + 0xdee022aa00000000, 0x2d70d09c00000000, 0xba01c4c100000000, + 0x499136f700000000, 0x5c2021ac00000000, 0xafb0d39a00000000, + 0x76420e1a00000000, 0x85d2fc2c00000000, 0x9063eb7700000000, + 0x63f3194100000000, 0x638021ad00000000, 0x9010d39b00000000, + 0x85a1c4c000000000, 0x763136f600000000, 0xafc3eb7600000000, + 0x5c53194000000000, 0x49e20e1b00000000, 0xba72fc2d00000000, + 0x08020f1800000000, 0xfb92fd2e00000000, 0xee23ea7500000000, + 0x1db3184300000000, 0xc441c5c300000000, 0x37d137f500000000, + 0x226020ae00000000, 0xd1f0d29800000000, 0xd183ea7400000000, + 0x2213184200000000, 0x37a20f1900000000, 0xc432fd2f00000000, + 0x1dc020af00000000, 0xee50d29900000000, 0xfbe1c5c200000000, + 0x087137f400000000}, + {0x0000000000000000, 0x3651822400000000, 0x6ca2044900000000, + 0x5af3866d00000000, 0xd844099200000000, 0xee158bb600000000, + 0xb4e60ddb00000000, 0x82b78fff00000000, 0xf18f63ff00000000, + 0xc7dee1db00000000, 0x9d2d67b600000000, 0xab7ce59200000000, + 0x29cb6a6d00000000, 0x1f9ae84900000000, 0x45696e2400000000, + 0x7338ec0000000000, 0xa319b62500000000, 0x9548340100000000, + 0xcfbbb26c00000000, 0xf9ea304800000000, 0x7b5dbfb700000000, + 0x4d0c3d9300000000, 0x17ffbbfe00000000, 0x21ae39da00000000, + 0x5296d5da00000000, 0x64c757fe00000000, 0x3e34d19300000000, + 0x086553b700000000, 0x8ad2dc4800000000, 0xbc835e6c00000000, + 0xe670d80100000000, 0xd0215a2500000000, 0x46336c4b00000000, + 0x7062ee6f00000000, 0x2a91680200000000, 0x1cc0ea2600000000, + 0x9e7765d900000000, 0xa826e7fd00000000, 0xf2d5619000000000, + 0xc484e3b400000000, 0xb7bc0fb400000000, 0x81ed8d9000000000, + 0xdb1e0bfd00000000, 0xed4f89d900000000, 0x6ff8062600000000, + 0x59a9840200000000, 0x035a026f00000000, 0x350b804b00000000, + 0xe52ada6e00000000, 0xd37b584a00000000, 0x8988de2700000000, + 0xbfd95c0300000000, 0x3d6ed3fc00000000, 0x0b3f51d800000000, + 0x51ccd7b500000000, 0x679d559100000000, 0x14a5b99100000000, + 0x22f43bb500000000, 0x7807bdd800000000, 0x4e563ffc00000000, + 0xcce1b00300000000, 0xfab0322700000000, 0xa043b44a00000000, + 0x9612366e00000000, 0x8c66d89600000000, 0xba375ab200000000, + 0xe0c4dcdf00000000, 0xd6955efb00000000, 0x5422d10400000000, + 0x6273532000000000, 0x3880d54d00000000, 0x0ed1576900000000, + 0x7de9bb6900000000, 0x4bb8394d00000000, 0x114bbf2000000000, + 0x271a3d0400000000, 0xa5adb2fb00000000, 0x93fc30df00000000, + 0xc90fb6b200000000, 0xff5e349600000000, 0x2f7f6eb300000000, + 0x192eec9700000000, 0x43dd6afa00000000, 0x758ce8de00000000, + 0xf73b672100000000, 0xc16ae50500000000, 0x9b99636800000000, + 0xadc8e14c00000000, 0xdef00d4c00000000, 0xe8a18f6800000000, + 0xb252090500000000, 0x84038b2100000000, 0x06b404de00000000, + 0x30e586fa00000000, 0x6a16009700000000, 0x5c4782b300000000, + 0xca55b4dd00000000, 0xfc0436f900000000, 0xa6f7b09400000000, + 0x90a632b000000000, 0x1211bd4f00000000, 0x24403f6b00000000, + 0x7eb3b90600000000, 0x48e23b2200000000, 0x3bdad72200000000, + 0x0d8b550600000000, 0x5778d36b00000000, 0x6129514f00000000, + 0xe39edeb000000000, 0xd5cf5c9400000000, 0x8f3cdaf900000000, + 0xb96d58dd00000000, 0x694c02f800000000, 0x5f1d80dc00000000, + 0x05ee06b100000000, 0x33bf849500000000, 0xb1080b6a00000000, + 0x8759894e00000000, 0xddaa0f2300000000, 0xebfb8d0700000000, + 0x98c3610700000000, 0xae92e32300000000, 0xf461654e00000000, + 0xc230e76a00000000, 0x4087689500000000, 0x76d6eab100000000, + 0x2c256cdc00000000, 0x1a74eef800000000, 0x59cbc1f600000000, + 0x6f9a43d200000000, 0x3569c5bf00000000, 0x0338479b00000000, + 0x818fc86400000000, 0xb7de4a4000000000, 0xed2dcc2d00000000, + 0xdb7c4e0900000000, 0xa844a20900000000, 0x9e15202d00000000, + 0xc4e6a64000000000, 0xf2b7246400000000, 0x7000ab9b00000000, + 0x465129bf00000000, 0x1ca2afd200000000, 0x2af32df600000000, + 0xfad277d300000000, 0xcc83f5f700000000, 0x9670739a00000000, + 0xa021f1be00000000, 0x22967e4100000000, 0x14c7fc6500000000, + 0x4e347a0800000000, 0x7865f82c00000000, 0x0b5d142c00000000, + 0x3d0c960800000000, 0x67ff106500000000, 0x51ae924100000000, + 0xd3191dbe00000000, 0xe5489f9a00000000, 0xbfbb19f700000000, + 0x89ea9bd300000000, 0x1ff8adbd00000000, 0x29a92f9900000000, + 0x735aa9f400000000, 0x450b2bd000000000, 0xc7bca42f00000000, + 0xf1ed260b00000000, 0xab1ea06600000000, 0x9d4f224200000000, + 0xee77ce4200000000, 0xd8264c6600000000, 0x82d5ca0b00000000, + 0xb484482f00000000, 0x3633c7d000000000, 0x006245f400000000, + 0x5a91c39900000000, 0x6cc041bd00000000, 0xbce11b9800000000, + 0x8ab099bc00000000, 0xd0431fd100000000, 0xe6129df500000000, + 0x64a5120a00000000, 0x52f4902e00000000, 0x0807164300000000, + 0x3e56946700000000, 0x4d6e786700000000, 0x7b3ffa4300000000, + 0x21cc7c2e00000000, 0x179dfe0a00000000, 0x952a71f500000000, + 0xa37bf3d100000000, 0xf98875bc00000000, 0xcfd9f79800000000, + 0xd5ad196000000000, 0xe3fc9b4400000000, 0xb90f1d2900000000, + 0x8f5e9f0d00000000, 0x0de910f200000000, 0x3bb892d600000000, + 0x614b14bb00000000, 0x571a969f00000000, 0x24227a9f00000000, + 0x1273f8bb00000000, 0x48807ed600000000, 0x7ed1fcf200000000, + 0xfc66730d00000000, 0xca37f12900000000, 0x90c4774400000000, + 0xa695f56000000000, 0x76b4af4500000000, 0x40e52d6100000000, + 0x1a16ab0c00000000, 0x2c47292800000000, 0xaef0a6d700000000, + 0x98a124f300000000, 0xc252a29e00000000, 0xf40320ba00000000, + 0x873bccba00000000, 0xb16a4e9e00000000, 0xeb99c8f300000000, + 0xddc84ad700000000, 0x5f7fc52800000000, 0x692e470c00000000, + 0x33ddc16100000000, 0x058c434500000000, 0x939e752b00000000, + 0xa5cff70f00000000, 0xff3c716200000000, 0xc96df34600000000, + 0x4bda7cb900000000, 0x7d8bfe9d00000000, 0x277878f000000000, + 0x1129fad400000000, 0x621116d400000000, 0x544094f000000000, + 0x0eb3129d00000000, 0x38e290b900000000, 0xba551f4600000000, + 0x8c049d6200000000, 0xd6f71b0f00000000, 0xe0a6992b00000000, + 0x3087c30e00000000, 0x06d6412a00000000, 0x5c25c74700000000, + 0x6a74456300000000, 0xe8c3ca9c00000000, 0xde9248b800000000, + 0x8461ced500000000, 0xb2304cf100000000, 0xc108a0f100000000, + 0xf75922d500000000, 0xadaaa4b800000000, 0x9bfb269c00000000, + 0x194ca96300000000, 0x2f1d2b4700000000, 0x75eead2a00000000, + 0x43bf2f0e00000000}, + {0x0000000000000000, 0xc8179ecf00000000, 0xd1294d4400000000, + 0x193ed38b00000000, 0xa2539a8800000000, 0x6a44044700000000, + 0x737ad7cc00000000, 0xbb6d490300000000, 0x05a145ca00000000, + 0xcdb6db0500000000, 0xd488088e00000000, 0x1c9f964100000000, + 0xa7f2df4200000000, 0x6fe5418d00000000, 0x76db920600000000, + 0xbecc0cc900000000, 0x4b44fa4f00000000, 0x8353648000000000, + 0x9a6db70b00000000, 0x527a29c400000000, 0xe91760c700000000, + 0x2100fe0800000000, 0x383e2d8300000000, 0xf029b34c00000000, + 0x4ee5bf8500000000, 0x86f2214a00000000, 0x9fccf2c100000000, + 0x57db6c0e00000000, 0xecb6250d00000000, 0x24a1bbc200000000, + 0x3d9f684900000000, 0xf588f68600000000, 0x9688f49f00000000, + 0x5e9f6a5000000000, 0x47a1b9db00000000, 0x8fb6271400000000, + 0x34db6e1700000000, 0xfcccf0d800000000, 0xe5f2235300000000, + 0x2de5bd9c00000000, 0x9329b15500000000, 0x5b3e2f9a00000000, + 0x4200fc1100000000, 0x8a1762de00000000, 0x317a2bdd00000000, + 0xf96db51200000000, 0xe053669900000000, 0x2844f85600000000, + 0xddcc0ed000000000, 0x15db901f00000000, 0x0ce5439400000000, + 0xc4f2dd5b00000000, 0x7f9f945800000000, 0xb7880a9700000000, + 0xaeb6d91c00000000, 0x66a147d300000000, 0xd86d4b1a00000000, + 0x107ad5d500000000, 0x0944065e00000000, 0xc153989100000000, + 0x7a3ed19200000000, 0xb2294f5d00000000, 0xab179cd600000000, + 0x6300021900000000, 0x6d1798e400000000, 0xa500062b00000000, + 0xbc3ed5a000000000, 0x74294b6f00000000, 0xcf44026c00000000, + 0x07539ca300000000, 0x1e6d4f2800000000, 0xd67ad1e700000000, + 0x68b6dd2e00000000, 0xa0a143e100000000, 0xb99f906a00000000, + 0x71880ea500000000, 0xcae547a600000000, 0x02f2d96900000000, + 0x1bcc0ae200000000, 0xd3db942d00000000, 0x265362ab00000000, + 0xee44fc6400000000, 0xf77a2fef00000000, 0x3f6db12000000000, + 0x8400f82300000000, 0x4c1766ec00000000, 0x5529b56700000000, + 0x9d3e2ba800000000, 0x23f2276100000000, 0xebe5b9ae00000000, + 0xf2db6a2500000000, 0x3accf4ea00000000, 0x81a1bde900000000, + 0x49b6232600000000, 0x5088f0ad00000000, 0x989f6e6200000000, + 0xfb9f6c7b00000000, 0x3388f2b400000000, 0x2ab6213f00000000, + 0xe2a1bff000000000, 0x59ccf6f300000000, 0x91db683c00000000, + 0x88e5bbb700000000, 0x40f2257800000000, 0xfe3e29b100000000, + 0x3629b77e00000000, 0x2f1764f500000000, 0xe700fa3a00000000, + 0x5c6db33900000000, 0x947a2df600000000, 0x8d44fe7d00000000, + 0x455360b200000000, 0xb0db963400000000, 0x78cc08fb00000000, + 0x61f2db7000000000, 0xa9e545bf00000000, 0x12880cbc00000000, + 0xda9f927300000000, 0xc3a141f800000000, 0x0bb6df3700000000, + 0xb57ad3fe00000000, 0x7d6d4d3100000000, 0x64539eba00000000, + 0xac44007500000000, 0x1729497600000000, 0xdf3ed7b900000000, + 0xc600043200000000, 0x0e179afd00000000, 0x9b28411200000000, + 0x533fdfdd00000000, 0x4a010c5600000000, 0x8216929900000000, + 0x397bdb9a00000000, 0xf16c455500000000, 0xe85296de00000000, + 0x2045081100000000, 0x9e8904d800000000, 0x569e9a1700000000, + 0x4fa0499c00000000, 0x87b7d75300000000, 0x3cda9e5000000000, + 0xf4cd009f00000000, 0xedf3d31400000000, 0x25e44ddb00000000, + 0xd06cbb5d00000000, 0x187b259200000000, 0x0145f61900000000, + 0xc95268d600000000, 0x723f21d500000000, 0xba28bf1a00000000, + 0xa3166c9100000000, 0x6b01f25e00000000, 0xd5cdfe9700000000, + 0x1dda605800000000, 0x04e4b3d300000000, 0xccf32d1c00000000, + 0x779e641f00000000, 0xbf89fad000000000, 0xa6b7295b00000000, + 0x6ea0b79400000000, 0x0da0b58d00000000, 0xc5b72b4200000000, + 0xdc89f8c900000000, 0x149e660600000000, 0xaff32f0500000000, + 0x67e4b1ca00000000, 0x7eda624100000000, 0xb6cdfc8e00000000, + 0x0801f04700000000, 0xc0166e8800000000, 0xd928bd0300000000, + 0x113f23cc00000000, 0xaa526acf00000000, 0x6245f40000000000, + 0x7b7b278b00000000, 0xb36cb94400000000, 0x46e44fc200000000, + 0x8ef3d10d00000000, 0x97cd028600000000, 0x5fda9c4900000000, + 0xe4b7d54a00000000, 0x2ca04b8500000000, 0x359e980e00000000, + 0xfd8906c100000000, 0x43450a0800000000, 0x8b5294c700000000, + 0x926c474c00000000, 0x5a7bd98300000000, 0xe116908000000000, + 0x29010e4f00000000, 0x303fddc400000000, 0xf828430b00000000, + 0xf63fd9f600000000, 0x3e28473900000000, 0x271694b200000000, + 0xef010a7d00000000, 0x546c437e00000000, 0x9c7bddb100000000, + 0x85450e3a00000000, 0x4d5290f500000000, 0xf39e9c3c00000000, + 0x3b8902f300000000, 0x22b7d17800000000, 0xeaa04fb700000000, + 0x51cd06b400000000, 0x99da987b00000000, 0x80e44bf000000000, + 0x48f3d53f00000000, 0xbd7b23b900000000, 0x756cbd7600000000, + 0x6c526efd00000000, 0xa445f03200000000, 0x1f28b93100000000, + 0xd73f27fe00000000, 0xce01f47500000000, 0x06166aba00000000, + 0xb8da667300000000, 0x70cdf8bc00000000, 0x69f32b3700000000, + 0xa1e4b5f800000000, 0x1a89fcfb00000000, 0xd29e623400000000, + 0xcba0b1bf00000000, 0x03b72f7000000000, 0x60b72d6900000000, + 0xa8a0b3a600000000, 0xb19e602d00000000, 0x7989fee200000000, + 0xc2e4b7e100000000, 0x0af3292e00000000, 0x13cdfaa500000000, + 0xdbda646a00000000, 0x651668a300000000, 0xad01f66c00000000, + 0xb43f25e700000000, 0x7c28bb2800000000, 0xc745f22b00000000, + 0x0f526ce400000000, 0x166cbf6f00000000, 0xde7b21a000000000, + 0x2bf3d72600000000, 0xe3e449e900000000, 0xfada9a6200000000, + 0x32cd04ad00000000, 0x89a04dae00000000, 0x41b7d36100000000, + 0x588900ea00000000, 0x909e9e2500000000, 0x2e5292ec00000000, + 0xe6450c2300000000, 0xff7bdfa800000000, 0x376c416700000000, + 0x8c01086400000000, 0x441696ab00000000, 0x5d28452000000000, + 0x953fdbef00000000}, + {0x0000000000000000, 0x95d4709500000000, 0x6baf90f100000000, + 0xfe7be06400000000, 0x9758503800000000, 0x028c20ad00000000, + 0xfcf7c0c900000000, 0x6923b05c00000000, 0x2eb1a07000000000, + 0xbb65d0e500000000, 0x451e308100000000, 0xd0ca401400000000, + 0xb9e9f04800000000, 0x2c3d80dd00000000, 0xd24660b900000000, + 0x4792102c00000000, 0x5c6241e100000000, 0xc9b6317400000000, + 0x37cdd11000000000, 0xa219a18500000000, 0xcb3a11d900000000, + 0x5eee614c00000000, 0xa095812800000000, 0x3541f1bd00000000, + 0x72d3e19100000000, 0xe707910400000000, 0x197c716000000000, + 0x8ca801f500000000, 0xe58bb1a900000000, 0x705fc13c00000000, + 0x8e24215800000000, 0x1bf051cd00000000, 0xf9c2f31900000000, + 0x6c16838c00000000, 0x926d63e800000000, 0x07b9137d00000000, + 0x6e9aa32100000000, 0xfb4ed3b400000000, 0x053533d000000000, + 0x90e1434500000000, 0xd773536900000000, 0x42a723fc00000000, + 0xbcdcc39800000000, 0x2908b30d00000000, 0x402b035100000000, + 0xd5ff73c400000000, 0x2b8493a000000000, 0xbe50e33500000000, + 0xa5a0b2f800000000, 0x3074c26d00000000, 0xce0f220900000000, + 0x5bdb529c00000000, 0x32f8e2c000000000, 0xa72c925500000000, + 0x5957723100000000, 0xcc8302a400000000, 0x8b11128800000000, + 0x1ec5621d00000000, 0xe0be827900000000, 0x756af2ec00000000, + 0x1c4942b000000000, 0x899d322500000000, 0x77e6d24100000000, + 0xe232a2d400000000, 0xf285e73300000000, 0x675197a600000000, + 0x992a77c200000000, 0x0cfe075700000000, 0x65ddb70b00000000, + 0xf009c79e00000000, 0x0e7227fa00000000, 0x9ba6576f00000000, + 0xdc34474300000000, 0x49e037d600000000, 0xb79bd7b200000000, + 0x224fa72700000000, 0x4b6c177b00000000, 0xdeb867ee00000000, + 0x20c3878a00000000, 0xb517f71f00000000, 0xaee7a6d200000000, + 0x3b33d64700000000, 0xc548362300000000, 0x509c46b600000000, + 0x39bff6ea00000000, 0xac6b867f00000000, 0x5210661b00000000, + 0xc7c4168e00000000, 0x805606a200000000, 0x1582763700000000, + 0xebf9965300000000, 0x7e2de6c600000000, 0x170e569a00000000, + 0x82da260f00000000, 0x7ca1c66b00000000, 0xe975b6fe00000000, + 0x0b47142a00000000, 0x9e9364bf00000000, 0x60e884db00000000, + 0xf53cf44e00000000, 0x9c1f441200000000, 0x09cb348700000000, + 0xf7b0d4e300000000, 0x6264a47600000000, 0x25f6b45a00000000, + 0xb022c4cf00000000, 0x4e5924ab00000000, 0xdb8d543e00000000, + 0xb2aee46200000000, 0x277a94f700000000, 0xd901749300000000, + 0x4cd5040600000000, 0x572555cb00000000, 0xc2f1255e00000000, + 0x3c8ac53a00000000, 0xa95eb5af00000000, 0xc07d05f300000000, + 0x55a9756600000000, 0xabd2950200000000, 0x3e06e59700000000, + 0x7994f5bb00000000, 0xec40852e00000000, 0x123b654a00000000, + 0x87ef15df00000000, 0xeecca58300000000, 0x7b18d51600000000, + 0x8563357200000000, 0x10b745e700000000, 0xe40bcf6700000000, + 0x71dfbff200000000, 0x8fa45f9600000000, 0x1a702f0300000000, + 0x73539f5f00000000, 0xe687efca00000000, 0x18fc0fae00000000, + 0x8d287f3b00000000, 0xcaba6f1700000000, 0x5f6e1f8200000000, + 0xa115ffe600000000, 0x34c18f7300000000, 0x5de23f2f00000000, + 0xc8364fba00000000, 0x364dafde00000000, 0xa399df4b00000000, + 0xb8698e8600000000, 0x2dbdfe1300000000, 0xd3c61e7700000000, + 0x46126ee200000000, 0x2f31debe00000000, 0xbae5ae2b00000000, + 0x449e4e4f00000000, 0xd14a3eda00000000, 0x96d82ef600000000, + 0x030c5e6300000000, 0xfd77be0700000000, 0x68a3ce9200000000, + 0x01807ece00000000, 0x94540e5b00000000, 0x6a2fee3f00000000, + 0xfffb9eaa00000000, 0x1dc93c7e00000000, 0x881d4ceb00000000, + 0x7666ac8f00000000, 0xe3b2dc1a00000000, 0x8a916c4600000000, + 0x1f451cd300000000, 0xe13efcb700000000, 0x74ea8c2200000000, + 0x33789c0e00000000, 0xa6acec9b00000000, 0x58d70cff00000000, + 0xcd037c6a00000000, 0xa420cc3600000000, 0x31f4bca300000000, + 0xcf8f5cc700000000, 0x5a5b2c5200000000, 0x41ab7d9f00000000, + 0xd47f0d0a00000000, 0x2a04ed6e00000000, 0xbfd09dfb00000000, + 0xd6f32da700000000, 0x43275d3200000000, 0xbd5cbd5600000000, + 0x2888cdc300000000, 0x6f1addef00000000, 0xfacead7a00000000, + 0x04b54d1e00000000, 0x91613d8b00000000, 0xf8428dd700000000, + 0x6d96fd4200000000, 0x93ed1d2600000000, 0x06396db300000000, + 0x168e285400000000, 0x835a58c100000000, 0x7d21b8a500000000, + 0xe8f5c83000000000, 0x81d6786c00000000, 0x140208f900000000, + 0xea79e89d00000000, 0x7fad980800000000, 0x383f882400000000, + 0xadebf8b100000000, 0x539018d500000000, 0xc644684000000000, + 0xaf67d81c00000000, 0x3ab3a88900000000, 0xc4c848ed00000000, + 0x511c387800000000, 0x4aec69b500000000, 0xdf38192000000000, + 0x2143f94400000000, 0xb49789d100000000, 0xddb4398d00000000, + 0x4860491800000000, 0xb61ba97c00000000, 0x23cfd9e900000000, + 0x645dc9c500000000, 0xf189b95000000000, 0x0ff2593400000000, + 0x9a2629a100000000, 0xf30599fd00000000, 0x66d1e96800000000, + 0x98aa090c00000000, 0x0d7e799900000000, 0xef4cdb4d00000000, + 0x7a98abd800000000, 0x84e34bbc00000000, 0x11373b2900000000, + 0x78148b7500000000, 0xedc0fbe000000000, 0x13bb1b8400000000, + 0x866f6b1100000000, 0xc1fd7b3d00000000, 0x54290ba800000000, + 0xaa52ebcc00000000, 0x3f869b5900000000, 0x56a52b0500000000, + 0xc3715b9000000000, 0x3d0abbf400000000, 0xa8decb6100000000, + 0xb32e9aac00000000, 0x26faea3900000000, 0xd8810a5d00000000, + 0x4d557ac800000000, 0x2476ca9400000000, 0xb1a2ba0100000000, + 0x4fd95a6500000000, 0xda0d2af000000000, 0x9d9f3adc00000000, + 0x084b4a4900000000, 0xf630aa2d00000000, 0x63e4dab800000000, + 0x0ac76ae400000000, 0x9f131a7100000000, 0x6168fa1500000000, + 0xf4bc8a8000000000}, + {0x0000000000000000, 0x1f17f08000000000, 0x7f2891da00000000, + 0x603f615a00000000, 0xbf56536e00000000, 0xa041a3ee00000000, + 0xc07ec2b400000000, 0xdf69323400000000, 0x7eada6dc00000000, + 0x61ba565c00000000, 0x0185370600000000, 0x1e92c78600000000, + 0xc1fbf5b200000000, 0xdeec053200000000, 0xbed3646800000000, + 0xa1c494e800000000, 0xbd5c3c6200000000, 0xa24bcce200000000, + 0xc274adb800000000, 0xdd635d3800000000, 0x020a6f0c00000000, + 0x1d1d9f8c00000000, 0x7d22fed600000000, 0x62350e5600000000, + 0xc3f19abe00000000, 0xdce66a3e00000000, 0xbcd90b6400000000, + 0xa3cefbe400000000, 0x7ca7c9d000000000, 0x63b0395000000000, + 0x038f580a00000000, 0x1c98a88a00000000, 0x7ab978c400000000, + 0x65ae884400000000, 0x0591e91e00000000, 0x1a86199e00000000, + 0xc5ef2baa00000000, 0xdaf8db2a00000000, 0xbac7ba7000000000, + 0xa5d04af000000000, 0x0414de1800000000, 0x1b032e9800000000, + 0x7b3c4fc200000000, 0x642bbf4200000000, 0xbb428d7600000000, + 0xa4557df600000000, 0xc46a1cac00000000, 0xdb7dec2c00000000, + 0xc7e544a600000000, 0xd8f2b42600000000, 0xb8cdd57c00000000, + 0xa7da25fc00000000, 0x78b317c800000000, 0x67a4e74800000000, + 0x079b861200000000, 0x188c769200000000, 0xb948e27a00000000, + 0xa65f12fa00000000, 0xc66073a000000000, 0xd977832000000000, + 0x061eb11400000000, 0x1909419400000000, 0x793620ce00000000, + 0x6621d04e00000000, 0xb574805300000000, 0xaa6370d300000000, + 0xca5c118900000000, 0xd54be10900000000, 0x0a22d33d00000000, + 0x153523bd00000000, 0x750a42e700000000, 0x6a1db26700000000, + 0xcbd9268f00000000, 0xd4ced60f00000000, 0xb4f1b75500000000, + 0xabe647d500000000, 0x748f75e100000000, 0x6b98856100000000, + 0x0ba7e43b00000000, 0x14b014bb00000000, 0x0828bc3100000000, + 0x173f4cb100000000, 0x77002deb00000000, 0x6817dd6b00000000, + 0xb77eef5f00000000, 0xa8691fdf00000000, 0xc8567e8500000000, + 0xd7418e0500000000, 0x76851aed00000000, 0x6992ea6d00000000, + 0x09ad8b3700000000, 0x16ba7bb700000000, 0xc9d3498300000000, + 0xd6c4b90300000000, 0xb6fbd85900000000, 0xa9ec28d900000000, + 0xcfcdf89700000000, 0xd0da081700000000, 0xb0e5694d00000000, + 0xaff299cd00000000, 0x709babf900000000, 0x6f8c5b7900000000, + 0x0fb33a2300000000, 0x10a4caa300000000, 0xb1605e4b00000000, + 0xae77aecb00000000, 0xce48cf9100000000, 0xd15f3f1100000000, + 0x0e360d2500000000, 0x1121fda500000000, 0x711e9cff00000000, + 0x6e096c7f00000000, 0x7291c4f500000000, 0x6d86347500000000, + 0x0db9552f00000000, 0x12aea5af00000000, 0xcdc7979b00000000, + 0xd2d0671b00000000, 0xb2ef064100000000, 0xadf8f6c100000000, + 0x0c3c622900000000, 0x132b92a900000000, 0x7314f3f300000000, + 0x6c03037300000000, 0xb36a314700000000, 0xac7dc1c700000000, + 0xcc42a09d00000000, 0xd355501d00000000, 0x6ae900a700000000, + 0x75fef02700000000, 0x15c1917d00000000, 0x0ad661fd00000000, + 0xd5bf53c900000000, 0xcaa8a34900000000, 0xaa97c21300000000, + 0xb580329300000000, 0x1444a67b00000000, 0x0b5356fb00000000, + 0x6b6c37a100000000, 0x747bc72100000000, 0xab12f51500000000, + 0xb405059500000000, 0xd43a64cf00000000, 0xcb2d944f00000000, + 0xd7b53cc500000000, 0xc8a2cc4500000000, 0xa89dad1f00000000, + 0xb78a5d9f00000000, 0x68e36fab00000000, 0x77f49f2b00000000, + 0x17cbfe7100000000, 0x08dc0ef100000000, 0xa9189a1900000000, + 0xb60f6a9900000000, 0xd6300bc300000000, 0xc927fb4300000000, + 0x164ec97700000000, 0x095939f700000000, 0x696658ad00000000, + 0x7671a82d00000000, 0x1050786300000000, 0x0f4788e300000000, + 0x6f78e9b900000000, 0x706f193900000000, 0xaf062b0d00000000, + 0xb011db8d00000000, 0xd02ebad700000000, 0xcf394a5700000000, + 0x6efddebf00000000, 0x71ea2e3f00000000, 0x11d54f6500000000, + 0x0ec2bfe500000000, 0xd1ab8dd100000000, 0xcebc7d5100000000, + 0xae831c0b00000000, 0xb194ec8b00000000, 0xad0c440100000000, + 0xb21bb48100000000, 0xd224d5db00000000, 0xcd33255b00000000, + 0x125a176f00000000, 0x0d4de7ef00000000, 0x6d7286b500000000, + 0x7265763500000000, 0xd3a1e2dd00000000, 0xccb6125d00000000, + 0xac89730700000000, 0xb39e838700000000, 0x6cf7b1b300000000, + 0x73e0413300000000, 0x13df206900000000, 0x0cc8d0e900000000, + 0xdf9d80f400000000, 0xc08a707400000000, 0xa0b5112e00000000, + 0xbfa2e1ae00000000, 0x60cbd39a00000000, 0x7fdc231a00000000, + 0x1fe3424000000000, 0x00f4b2c000000000, 0xa130262800000000, + 0xbe27d6a800000000, 0xde18b7f200000000, 0xc10f477200000000, + 0x1e66754600000000, 0x017185c600000000, 0x614ee49c00000000, + 0x7e59141c00000000, 0x62c1bc9600000000, 0x7dd64c1600000000, + 0x1de92d4c00000000, 0x02feddcc00000000, 0xdd97eff800000000, + 0xc2801f7800000000, 0xa2bf7e2200000000, 0xbda88ea200000000, + 0x1c6c1a4a00000000, 0x037beaca00000000, 0x63448b9000000000, + 0x7c537b1000000000, 0xa33a492400000000, 0xbc2db9a400000000, + 0xdc12d8fe00000000, 0xc305287e00000000, 0xa524f83000000000, + 0xba3308b000000000, 0xda0c69ea00000000, 0xc51b996a00000000, + 0x1a72ab5e00000000, 0x05655bde00000000, 0x655a3a8400000000, + 0x7a4dca0400000000, 0xdb895eec00000000, 0xc49eae6c00000000, + 0xa4a1cf3600000000, 0xbbb63fb600000000, 0x64df0d8200000000, + 0x7bc8fd0200000000, 0x1bf79c5800000000, 0x04e06cd800000000, + 0x1878c45200000000, 0x076f34d200000000, 0x6750558800000000, + 0x7847a50800000000, 0xa72e973c00000000, 0xb83967bc00000000, + 0xd80606e600000000, 0xc711f66600000000, 0x66d5628e00000000, + 0x79c2920e00000000, 0x19fdf35400000000, 0x06ea03d400000000, + 0xd98331e000000000, 0xc694c16000000000, 0xa6aba03a00000000, + 0xb9bc50ba00000000}, + {0x0000000000000000, 0xe2fd888d00000000, 0x85fd60c000000000, + 0x6700e84d00000000, 0x4bfdb05b00000000, 0xa90038d600000000, + 0xce00d09b00000000, 0x2cfd581600000000, 0x96fa61b700000000, + 0x7407e93a00000000, 0x1307017700000000, 0xf1fa89fa00000000, + 0xdd07d1ec00000000, 0x3ffa596100000000, 0x58fab12c00000000, + 0xba0739a100000000, 0x6df3b2b500000000, 0x8f0e3a3800000000, + 0xe80ed27500000000, 0x0af35af800000000, 0x260e02ee00000000, + 0xc4f38a6300000000, 0xa3f3622e00000000, 0x410eeaa300000000, + 0xfb09d30200000000, 0x19f45b8f00000000, 0x7ef4b3c200000000, + 0x9c093b4f00000000, 0xb0f4635900000000, 0x5209ebd400000000, + 0x3509039900000000, 0xd7f48b1400000000, 0x9be014b000000000, + 0x791d9c3d00000000, 0x1e1d747000000000, 0xfce0fcfd00000000, + 0xd01da4eb00000000, 0x32e02c6600000000, 0x55e0c42b00000000, + 0xb71d4ca600000000, 0x0d1a750700000000, 0xefe7fd8a00000000, + 0x88e715c700000000, 0x6a1a9d4a00000000, 0x46e7c55c00000000, + 0xa41a4dd100000000, 0xc31aa59c00000000, 0x21e72d1100000000, + 0xf613a60500000000, 0x14ee2e8800000000, 0x73eec6c500000000, + 0x91134e4800000000, 0xbdee165e00000000, 0x5f139ed300000000, + 0x3813769e00000000, 0xdaeefe1300000000, 0x60e9c7b200000000, + 0x82144f3f00000000, 0xe514a77200000000, 0x07e92fff00000000, + 0x2b1477e900000000, 0xc9e9ff6400000000, 0xaee9172900000000, + 0x4c149fa400000000, 0x77c758bb00000000, 0x953ad03600000000, + 0xf23a387b00000000, 0x10c7b0f600000000, 0x3c3ae8e000000000, + 0xdec7606d00000000, 0xb9c7882000000000, 0x5b3a00ad00000000, + 0xe13d390c00000000, 0x03c0b18100000000, 0x64c059cc00000000, + 0x863dd14100000000, 0xaac0895700000000, 0x483d01da00000000, + 0x2f3de99700000000, 0xcdc0611a00000000, 0x1a34ea0e00000000, + 0xf8c9628300000000, 0x9fc98ace00000000, 0x7d34024300000000, + 0x51c95a5500000000, 0xb334d2d800000000, 0xd4343a9500000000, + 0x36c9b21800000000, 0x8cce8bb900000000, 0x6e33033400000000, + 0x0933eb7900000000, 0xebce63f400000000, 0xc7333be200000000, + 0x25ceb36f00000000, 0x42ce5b2200000000, 0xa033d3af00000000, + 0xec274c0b00000000, 0x0edac48600000000, 0x69da2ccb00000000, + 0x8b27a44600000000, 0xa7dafc5000000000, 0x452774dd00000000, + 0x22279c9000000000, 0xc0da141d00000000, 0x7add2dbc00000000, + 0x9820a53100000000, 0xff204d7c00000000, 0x1dddc5f100000000, + 0x31209de700000000, 0xd3dd156a00000000, 0xb4ddfd2700000000, + 0x562075aa00000000, 0x81d4febe00000000, 0x6329763300000000, + 0x04299e7e00000000, 0xe6d416f300000000, 0xca294ee500000000, + 0x28d4c66800000000, 0x4fd42e2500000000, 0xad29a6a800000000, + 0x172e9f0900000000, 0xf5d3178400000000, 0x92d3ffc900000000, + 0x702e774400000000, 0x5cd32f5200000000, 0xbe2ea7df00000000, + 0xd92e4f9200000000, 0x3bd3c71f00000000, 0xaf88c0ad00000000, + 0x4d75482000000000, 0x2a75a06d00000000, 0xc88828e000000000, + 0xe47570f600000000, 0x0688f87b00000000, 0x6188103600000000, + 0x837598bb00000000, 0x3972a11a00000000, 0xdb8f299700000000, + 0xbc8fc1da00000000, 0x5e72495700000000, 0x728f114100000000, + 0x907299cc00000000, 0xf772718100000000, 0x158ff90c00000000, + 0xc27b721800000000, 0x2086fa9500000000, 0x478612d800000000, + 0xa57b9a5500000000, 0x8986c24300000000, 0x6b7b4ace00000000, + 0x0c7ba28300000000, 0xee862a0e00000000, 0x548113af00000000, + 0xb67c9b2200000000, 0xd17c736f00000000, 0x3381fbe200000000, + 0x1f7ca3f400000000, 0xfd812b7900000000, 0x9a81c33400000000, + 0x787c4bb900000000, 0x3468d41d00000000, 0xd6955c9000000000, + 0xb195b4dd00000000, 0x53683c5000000000, 0x7f95644600000000, + 0x9d68eccb00000000, 0xfa68048600000000, 0x18958c0b00000000, + 0xa292b5aa00000000, 0x406f3d2700000000, 0x276fd56a00000000, + 0xc5925de700000000, 0xe96f05f100000000, 0x0b928d7c00000000, + 0x6c92653100000000, 0x8e6fedbc00000000, 0x599b66a800000000, + 0xbb66ee2500000000, 0xdc66066800000000, 0x3e9b8ee500000000, + 0x1266d6f300000000, 0xf09b5e7e00000000, 0x979bb63300000000, + 0x75663ebe00000000, 0xcf61071f00000000, 0x2d9c8f9200000000, + 0x4a9c67df00000000, 0xa861ef5200000000, 0x849cb74400000000, + 0x66613fc900000000, 0x0161d78400000000, 0xe39c5f0900000000, + 0xd84f981600000000, 0x3ab2109b00000000, 0x5db2f8d600000000, + 0xbf4f705b00000000, 0x93b2284d00000000, 0x714fa0c000000000, + 0x164f488d00000000, 0xf4b2c00000000000, 0x4eb5f9a100000000, + 0xac48712c00000000, 0xcb48996100000000, 0x29b511ec00000000, + 0x054849fa00000000, 0xe7b5c17700000000, 0x80b5293a00000000, + 0x6248a1b700000000, 0xb5bc2aa300000000, 0x5741a22e00000000, + 0x30414a6300000000, 0xd2bcc2ee00000000, 0xfe419af800000000, + 0x1cbc127500000000, 0x7bbcfa3800000000, 0x994172b500000000, + 0x23464b1400000000, 0xc1bbc39900000000, 0xa6bb2bd400000000, + 0x4446a35900000000, 0x68bbfb4f00000000, 0x8a4673c200000000, + 0xed469b8f00000000, 0x0fbb130200000000, 0x43af8ca600000000, + 0xa152042b00000000, 0xc652ec6600000000, 0x24af64eb00000000, + 0x08523cfd00000000, 0xeaafb47000000000, 0x8daf5c3d00000000, + 0x6f52d4b000000000, 0xd555ed1100000000, 0x37a8659c00000000, + 0x50a88dd100000000, 0xb255055c00000000, 0x9ea85d4a00000000, + 0x7c55d5c700000000, 0x1b553d8a00000000, 0xf9a8b50700000000, + 0x2e5c3e1300000000, 0xcca1b69e00000000, 0xaba15ed300000000, + 0x495cd65e00000000, 0x65a18e4800000000, 0x875c06c500000000, + 0xe05cee8800000000, 0x02a1660500000000, 0xb8a65fa400000000, + 0x5a5bd72900000000, 0x3d5b3f6400000000, 0xdfa6b7e900000000, + 0xf35befff00000000, 0x11a6677200000000, 0x76a68f3f00000000, + 0x945b07b200000000}, + {0x0000000000000000, 0xa90b894e00000000, 0x5217129d00000000, + 0xfb1c9bd300000000, 0xe52855e100000000, 0x4c23dcaf00000000, + 0xb73f477c00000000, 0x1e34ce3200000000, 0x8b57db1900000000, + 0x225c525700000000, 0xd940c98400000000, 0x704b40ca00000000, + 0x6e7f8ef800000000, 0xc77407b600000000, 0x3c689c6500000000, + 0x9563152b00000000, 0x16afb63300000000, 0xbfa43f7d00000000, + 0x44b8a4ae00000000, 0xedb32de000000000, 0xf387e3d200000000, + 0x5a8c6a9c00000000, 0xa190f14f00000000, 0x089b780100000000, + 0x9df86d2a00000000, 0x34f3e46400000000, 0xcfef7fb700000000, + 0x66e4f6f900000000, 0x78d038cb00000000, 0xd1dbb18500000000, + 0x2ac72a5600000000, 0x83cca31800000000, 0x2c5e6d6700000000, + 0x8555e42900000000, 0x7e497ffa00000000, 0xd742f6b400000000, + 0xc976388600000000, 0x607db1c800000000, 0x9b612a1b00000000, + 0x326aa35500000000, 0xa709b67e00000000, 0x0e023f3000000000, + 0xf51ea4e300000000, 0x5c152dad00000000, 0x4221e39f00000000, + 0xeb2a6ad100000000, 0x1036f10200000000, 0xb93d784c00000000, + 0x3af1db5400000000, 0x93fa521a00000000, 0x68e6c9c900000000, + 0xc1ed408700000000, 0xdfd98eb500000000, 0x76d207fb00000000, + 0x8dce9c2800000000, 0x24c5156600000000, 0xb1a6004d00000000, + 0x18ad890300000000, 0xe3b112d000000000, 0x4aba9b9e00000000, + 0x548e55ac00000000, 0xfd85dce200000000, 0x0699473100000000, + 0xaf92ce7f00000000, 0x58bcdace00000000, 0xf1b7538000000000, + 0x0aabc85300000000, 0xa3a0411d00000000, 0xbd948f2f00000000, + 0x149f066100000000, 0xef839db200000000, 0x468814fc00000000, + 0xd3eb01d700000000, 0x7ae0889900000000, 0x81fc134a00000000, + 0x28f79a0400000000, 0x36c3543600000000, 0x9fc8dd7800000000, + 0x64d446ab00000000, 0xcddfcfe500000000, 0x4e136cfd00000000, + 0xe718e5b300000000, 0x1c047e6000000000, 0xb50ff72e00000000, + 0xab3b391c00000000, 0x0230b05200000000, 0xf92c2b8100000000, + 0x5027a2cf00000000, 0xc544b7e400000000, 0x6c4f3eaa00000000, + 0x9753a57900000000, 0x3e582c3700000000, 0x206ce20500000000, + 0x89676b4b00000000, 0x727bf09800000000, 0xdb7079d600000000, + 0x74e2b7a900000000, 0xdde93ee700000000, 0x26f5a53400000000, + 0x8ffe2c7a00000000, 0x91cae24800000000, 0x38c16b0600000000, + 0xc3ddf0d500000000, 0x6ad6799b00000000, 0xffb56cb000000000, + 0x56bee5fe00000000, 0xada27e2d00000000, 0x04a9f76300000000, + 0x1a9d395100000000, 0xb396b01f00000000, 0x488a2bcc00000000, + 0xe181a28200000000, 0x624d019a00000000, 0xcb4688d400000000, + 0x305a130700000000, 0x99519a4900000000, 0x8765547b00000000, + 0x2e6edd3500000000, 0xd57246e600000000, 0x7c79cfa800000000, + 0xe91ada8300000000, 0x401153cd00000000, 0xbb0dc81e00000000, + 0x1206415000000000, 0x0c328f6200000000, 0xa539062c00000000, + 0x5e259dff00000000, 0xf72e14b100000000, 0xf17ec44600000000, + 0x58754d0800000000, 0xa369d6db00000000, 0x0a625f9500000000, + 0x145691a700000000, 0xbd5d18e900000000, 0x4641833a00000000, + 0xef4a0a7400000000, 0x7a291f5f00000000, 0xd322961100000000, + 0x283e0dc200000000, 0x8135848c00000000, 0x9f014abe00000000, + 0x360ac3f000000000, 0xcd16582300000000, 0x641dd16d00000000, + 0xe7d1727500000000, 0x4edafb3b00000000, 0xb5c660e800000000, + 0x1ccde9a600000000, 0x02f9279400000000, 0xabf2aeda00000000, + 0x50ee350900000000, 0xf9e5bc4700000000, 0x6c86a96c00000000, + 0xc58d202200000000, 0x3e91bbf100000000, 0x979a32bf00000000, + 0x89aefc8d00000000, 0x20a575c300000000, 0xdbb9ee1000000000, + 0x72b2675e00000000, 0xdd20a92100000000, 0x742b206f00000000, + 0x8f37bbbc00000000, 0x263c32f200000000, 0x3808fcc000000000, + 0x9103758e00000000, 0x6a1fee5d00000000, 0xc314671300000000, + 0x5677723800000000, 0xff7cfb7600000000, 0x046060a500000000, + 0xad6be9eb00000000, 0xb35f27d900000000, 0x1a54ae9700000000, + 0xe148354400000000, 0x4843bc0a00000000, 0xcb8f1f1200000000, + 0x6284965c00000000, 0x99980d8f00000000, 0x309384c100000000, + 0x2ea74af300000000, 0x87acc3bd00000000, 0x7cb0586e00000000, + 0xd5bbd12000000000, 0x40d8c40b00000000, 0xe9d34d4500000000, + 0x12cfd69600000000, 0xbbc45fd800000000, 0xa5f091ea00000000, + 0x0cfb18a400000000, 0xf7e7837700000000, 0x5eec0a3900000000, + 0xa9c21e8800000000, 0x00c997c600000000, 0xfbd50c1500000000, + 0x52de855b00000000, 0x4cea4b6900000000, 0xe5e1c22700000000, + 0x1efd59f400000000, 0xb7f6d0ba00000000, 0x2295c59100000000, + 0x8b9e4cdf00000000, 0x7082d70c00000000, 0xd9895e4200000000, + 0xc7bd907000000000, 0x6eb6193e00000000, 0x95aa82ed00000000, + 0x3ca10ba300000000, 0xbf6da8bb00000000, 0x166621f500000000, + 0xed7aba2600000000, 0x4471336800000000, 0x5a45fd5a00000000, + 0xf34e741400000000, 0x0852efc700000000, 0xa159668900000000, + 0x343a73a200000000, 0x9d31faec00000000, 0x662d613f00000000, + 0xcf26e87100000000, 0xd112264300000000, 0x7819af0d00000000, + 0x830534de00000000, 0x2a0ebd9000000000, 0x859c73ef00000000, + 0x2c97faa100000000, 0xd78b617200000000, 0x7e80e83c00000000, + 0x60b4260e00000000, 0xc9bfaf4000000000, 0x32a3349300000000, + 0x9ba8bddd00000000, 0x0ecba8f600000000, 0xa7c021b800000000, + 0x5cdcba6b00000000, 0xf5d7332500000000, 0xebe3fd1700000000, + 0x42e8745900000000, 0xb9f4ef8a00000000, 0x10ff66c400000000, + 0x9333c5dc00000000, 0x3a384c9200000000, 0xc124d74100000000, + 0x682f5e0f00000000, 0x761b903d00000000, 0xdf10197300000000, + 0x240c82a000000000, 0x8d070bee00000000, 0x18641ec500000000, + 0xb16f978b00000000, 0x4a730c5800000000, 0xe378851600000000, + 0xfd4c4b2400000000, 0x5447c26a00000000, 0xaf5b59b900000000, + 0x0650d0f700000000}, + {0x0000000000000000, 0x479244af00000000, 0xcf22f88500000000, + 0x88b0bc2a00000000, 0xdf4381d000000000, 0x98d1c57f00000000, + 0x1061795500000000, 0x57f33dfa00000000, 0xff81737a00000000, + 0xb81337d500000000, 0x30a38bff00000000, 0x7731cf5000000000, + 0x20c2f2aa00000000, 0x6750b60500000000, 0xefe00a2f00000000, + 0xa8724e8000000000, 0xfe03e7f400000000, 0xb991a35b00000000, + 0x31211f7100000000, 0x76b35bde00000000, 0x2140662400000000, + 0x66d2228b00000000, 0xee629ea100000000, 0xa9f0da0e00000000, + 0x0182948e00000000, 0x4610d02100000000, 0xcea06c0b00000000, + 0x893228a400000000, 0xdec1155e00000000, 0x995351f100000000, + 0x11e3eddb00000000, 0x5671a97400000000, 0xbd01bf3200000000, + 0xfa93fb9d00000000, 0x722347b700000000, 0x35b1031800000000, + 0x62423ee200000000, 0x25d07a4d00000000, 0xad60c66700000000, + 0xeaf282c800000000, 0x4280cc4800000000, 0x051288e700000000, + 0x8da234cd00000000, 0xca30706200000000, 0x9dc34d9800000000, + 0xda51093700000000, 0x52e1b51d00000000, 0x1573f1b200000000, + 0x430258c600000000, 0x04901c6900000000, 0x8c20a04300000000, + 0xcbb2e4ec00000000, 0x9c41d91600000000, 0xdbd39db900000000, + 0x5363219300000000, 0x14f1653c00000000, 0xbc832bbc00000000, + 0xfb116f1300000000, 0x73a1d33900000000, 0x3433979600000000, + 0x63c0aa6c00000000, 0x2452eec300000000, 0xace252e900000000, + 0xeb70164600000000, 0x7a037e6500000000, 0x3d913aca00000000, + 0xb52186e000000000, 0xf2b3c24f00000000, 0xa540ffb500000000, + 0xe2d2bb1a00000000, 0x6a62073000000000, 0x2df0439f00000000, + 0x85820d1f00000000, 0xc21049b000000000, 0x4aa0f59a00000000, + 0x0d32b13500000000, 0x5ac18ccf00000000, 0x1d53c86000000000, + 0x95e3744a00000000, 0xd27130e500000000, 0x8400999100000000, + 0xc392dd3e00000000, 0x4b22611400000000, 0x0cb025bb00000000, + 0x5b43184100000000, 0x1cd15cee00000000, 0x9461e0c400000000, + 0xd3f3a46b00000000, 0x7b81eaeb00000000, 0x3c13ae4400000000, + 0xb4a3126e00000000, 0xf33156c100000000, 0xa4c26b3b00000000, + 0xe3502f9400000000, 0x6be093be00000000, 0x2c72d71100000000, + 0xc702c15700000000, 0x809085f800000000, 0x082039d200000000, + 0x4fb27d7d00000000, 0x1841408700000000, 0x5fd3042800000000, + 0xd763b80200000000, 0x90f1fcad00000000, 0x3883b22d00000000, + 0x7f11f68200000000, 0xf7a14aa800000000, 0xb0330e0700000000, + 0xe7c033fd00000000, 0xa052775200000000, 0x28e2cb7800000000, + 0x6f708fd700000000, 0x390126a300000000, 0x7e93620c00000000, + 0xf623de2600000000, 0xb1b19a8900000000, 0xe642a77300000000, + 0xa1d0e3dc00000000, 0x29605ff600000000, 0x6ef21b5900000000, + 0xc68055d900000000, 0x8112117600000000, 0x09a2ad5c00000000, + 0x4e30e9f300000000, 0x19c3d40900000000, 0x5e5190a600000000, + 0xd6e12c8c00000000, 0x9173682300000000, 0xf406fcca00000000, + 0xb394b86500000000, 0x3b24044f00000000, 0x7cb640e000000000, + 0x2b457d1a00000000, 0x6cd739b500000000, 0xe467859f00000000, + 0xa3f5c13000000000, 0x0b878fb000000000, 0x4c15cb1f00000000, + 0xc4a5773500000000, 0x8337339a00000000, 0xd4c40e6000000000, + 0x93564acf00000000, 0x1be6f6e500000000, 0x5c74b24a00000000, + 0x0a051b3e00000000, 0x4d975f9100000000, 0xc527e3bb00000000, + 0x82b5a71400000000, 0xd5469aee00000000, 0x92d4de4100000000, + 0x1a64626b00000000, 0x5df626c400000000, 0xf584684400000000, + 0xb2162ceb00000000, 0x3aa690c100000000, 0x7d34d46e00000000, + 0x2ac7e99400000000, 0x6d55ad3b00000000, 0xe5e5111100000000, + 0xa27755be00000000, 0x490743f800000000, 0x0e95075700000000, + 0x8625bb7d00000000, 0xc1b7ffd200000000, 0x9644c22800000000, + 0xd1d6868700000000, 0x59663aad00000000, 0x1ef47e0200000000, + 0xb686308200000000, 0xf114742d00000000, 0x79a4c80700000000, + 0x3e368ca800000000, 0x69c5b15200000000, 0x2e57f5fd00000000, + 0xa6e749d700000000, 0xe1750d7800000000, 0xb704a40c00000000, + 0xf096e0a300000000, 0x78265c8900000000, 0x3fb4182600000000, + 0x684725dc00000000, 0x2fd5617300000000, 0xa765dd5900000000, + 0xe0f799f600000000, 0x4885d77600000000, 0x0f1793d900000000, + 0x87a72ff300000000, 0xc0356b5c00000000, 0x97c656a600000000, + 0xd054120900000000, 0x58e4ae2300000000, 0x1f76ea8c00000000, + 0x8e0582af00000000, 0xc997c60000000000, 0x41277a2a00000000, + 0x06b53e8500000000, 0x5146037f00000000, 0x16d447d000000000, + 0x9e64fbfa00000000, 0xd9f6bf5500000000, 0x7184f1d500000000, + 0x3616b57a00000000, 0xbea6095000000000, 0xf9344dff00000000, + 0xaec7700500000000, 0xe95534aa00000000, 0x61e5888000000000, + 0x2677cc2f00000000, 0x7006655b00000000, 0x379421f400000000, + 0xbf249dde00000000, 0xf8b6d97100000000, 0xaf45e48b00000000, + 0xe8d7a02400000000, 0x60671c0e00000000, 0x27f558a100000000, + 0x8f87162100000000, 0xc815528e00000000, 0x40a5eea400000000, + 0x0737aa0b00000000, 0x50c497f100000000, 0x1756d35e00000000, + 0x9fe66f7400000000, 0xd8742bdb00000000, 0x33043d9d00000000, + 0x7496793200000000, 0xfc26c51800000000, 0xbbb481b700000000, + 0xec47bc4d00000000, 0xabd5f8e200000000, 0x236544c800000000, + 0x64f7006700000000, 0xcc854ee700000000, 0x8b170a4800000000, + 0x03a7b66200000000, 0x4435f2cd00000000, 0x13c6cf3700000000, + 0x54548b9800000000, 0xdce437b200000000, 0x9b76731d00000000, + 0xcd07da6900000000, 0x8a959ec600000000, 0x022522ec00000000, + 0x45b7664300000000, 0x12445bb900000000, 0x55d61f1600000000, + 0xdd66a33c00000000, 0x9af4e79300000000, 0x3286a91300000000, + 0x7514edbc00000000, 0xfda4519600000000, 0xba36153900000000, + 0xedc528c300000000, 0xaa576c6c00000000, 0x22e7d04600000000, + 0x657594e900000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x65673b46, 0xcace768c, 0xafa94dca, 0x4eedeb59, + 0x2b8ad01f, 0x84239dd5, 0xe144a693, 0x9ddbd6b2, 0xf8bcedf4, + 0x5715a03e, 0x32729b78, 0xd3363deb, 0xb65106ad, 0x19f84b67, + 0x7c9f7021, 0xe0c6ab25, 0x85a19063, 0x2a08dda9, 0x4f6fe6ef, + 0xae2b407c, 0xcb4c7b3a, 0x64e536f0, 0x01820db6, 0x7d1d7d97, + 0x187a46d1, 0xb7d30b1b, 0xd2b4305d, 0x33f096ce, 0x5697ad88, + 0xf93ee042, 0x9c59db04, 0x1afc500b, 0x7f9b6b4d, 0xd0322687, + 0xb5551dc1, 0x5411bb52, 0x31768014, 0x9edfcdde, 0xfbb8f698, + 0x872786b9, 0xe240bdff, 0x4de9f035, 0x288ecb73, 0xc9ca6de0, + 0xacad56a6, 0x03041b6c, 0x6663202a, 0xfa3afb2e, 0x9f5dc068, + 0x30f48da2, 0x5593b6e4, 0xb4d71077, 0xd1b02b31, 0x7e1966fb, + 0x1b7e5dbd, 0x67e12d9c, 0x028616da, 0xad2f5b10, 0xc8486056, + 0x290cc6c5, 0x4c6bfd83, 0xe3c2b049, 0x86a58b0f, 0x35f8a016, + 0x509f9b50, 0xff36d69a, 0x9a51eddc, 0x7b154b4f, 0x1e727009, + 0xb1db3dc3, 0xd4bc0685, 0xa82376a4, 0xcd444de2, 0x62ed0028, + 0x078a3b6e, 0xe6ce9dfd, 0x83a9a6bb, 0x2c00eb71, 0x4967d037, + 0xd53e0b33, 0xb0593075, 0x1ff07dbf, 0x7a9746f9, 0x9bd3e06a, + 0xfeb4db2c, 0x511d96e6, 0x347aada0, 0x48e5dd81, 0x2d82e6c7, + 0x822bab0d, 0xe74c904b, 0x060836d8, 0x636f0d9e, 0xccc64054, + 0xa9a17b12, 0x2f04f01d, 0x4a63cb5b, 0xe5ca8691, 0x80adbdd7, + 0x61e91b44, 0x048e2002, 0xab276dc8, 0xce40568e, 0xb2df26af, + 0xd7b81de9, 0x78115023, 0x1d766b65, 0xfc32cdf6, 0x9955f6b0, + 0x36fcbb7a, 0x539b803c, 0xcfc25b38, 0xaaa5607e, 0x050c2db4, + 0x606b16f2, 0x812fb061, 0xe4488b27, 0x4be1c6ed, 0x2e86fdab, + 0x52198d8a, 0x377eb6cc, 0x98d7fb06, 0xfdb0c040, 0x1cf466d3, + 0x79935d95, 0xd63a105f, 0xb35d2b19, 0x6bf1402c, 0x0e967b6a, + 0xa13f36a0, 0xc4580de6, 0x251cab75, 0x407b9033, 0xefd2ddf9, + 0x8ab5e6bf, 0xf62a969e, 0x934dadd8, 0x3ce4e012, 0x5983db54, + 0xb8c77dc7, 0xdda04681, 0x72090b4b, 0x176e300d, 0x8b37eb09, + 0xee50d04f, 0x41f99d85, 0x249ea6c3, 0xc5da0050, 0xa0bd3b16, + 0x0f1476dc, 0x6a734d9a, 0x16ec3dbb, 0x738b06fd, 0xdc224b37, + 0xb9457071, 0x5801d6e2, 0x3d66eda4, 0x92cfa06e, 0xf7a89b28, + 0x710d1027, 0x146a2b61, 0xbbc366ab, 0xdea45ded, 0x3fe0fb7e, + 0x5a87c038, 0xf52e8df2, 0x9049b6b4, 0xecd6c695, 0x89b1fdd3, + 0x2618b019, 0x437f8b5f, 0xa23b2dcc, 0xc75c168a, 0x68f55b40, + 0x0d926006, 0x91cbbb02, 0xf4ac8044, 0x5b05cd8e, 0x3e62f6c8, + 0xdf26505b, 0xba416b1d, 0x15e826d7, 0x708f1d91, 0x0c106db0, + 0x697756f6, 0xc6de1b3c, 0xa3b9207a, 0x42fd86e9, 0x279abdaf, + 0x8833f065, 0xed54cb23, 0x5e09e03a, 0x3b6edb7c, 0x94c796b6, + 0xf1a0adf0, 0x10e40b63, 0x75833025, 0xda2a7def, 0xbf4d46a9, + 0xc3d23688, 0xa6b50dce, 0x091c4004, 0x6c7b7b42, 0x8d3fddd1, + 0xe858e697, 0x47f1ab5d, 0x2296901b, 0xbecf4b1f, 0xdba87059, + 0x74013d93, 0x116606d5, 0xf022a046, 0x95459b00, 0x3aecd6ca, + 0x5f8bed8c, 0x23149dad, 0x4673a6eb, 0xe9daeb21, 0x8cbdd067, + 0x6df976f4, 0x089e4db2, 0xa7370078, 0xc2503b3e, 0x44f5b031, + 0x21928b77, 0x8e3bc6bd, 0xeb5cfdfb, 0x0a185b68, 0x6f7f602e, + 0xc0d62de4, 0xa5b116a2, 0xd92e6683, 0xbc495dc5, 0x13e0100f, + 0x76872b49, 0x97c38dda, 0xf2a4b69c, 0x5d0dfb56, 0x386ac010, + 0xa4331b14, 0xc1542052, 0x6efd6d98, 0x0b9a56de, 0xeadef04d, + 0x8fb9cb0b, 0x201086c1, 0x4577bd87, 0x39e8cda6, 0x5c8ff6e0, + 0xf326bb2a, 0x9641806c, 0x770526ff, 0x12621db9, 0xbdcb5073, + 0xd8ac6b35}, + {0x00000000, 0xd7e28058, 0x74b406f1, 0xa35686a9, 0xe9680de2, + 0x3e8a8dba, 0x9ddc0b13, 0x4a3e8b4b, 0x09a11d85, 0xde439ddd, + 0x7d151b74, 0xaaf79b2c, 0xe0c91067, 0x372b903f, 0x947d1696, + 0x439f96ce, 0x13423b0a, 0xc4a0bb52, 0x67f63dfb, 0xb014bda3, + 0xfa2a36e8, 0x2dc8b6b0, 0x8e9e3019, 0x597cb041, 0x1ae3268f, + 0xcd01a6d7, 0x6e57207e, 0xb9b5a026, 0xf38b2b6d, 0x2469ab35, + 0x873f2d9c, 0x50ddadc4, 0x26847614, 0xf166f64c, 0x523070e5, + 0x85d2f0bd, 0xcfec7bf6, 0x180efbae, 0xbb587d07, 0x6cbafd5f, + 0x2f256b91, 0xf8c7ebc9, 0x5b916d60, 0x8c73ed38, 0xc64d6673, + 0x11afe62b, 0xb2f96082, 0x651be0da, 0x35c64d1e, 0xe224cd46, + 0x41724bef, 0x9690cbb7, 0xdcae40fc, 0x0b4cc0a4, 0xa81a460d, + 0x7ff8c655, 0x3c67509b, 0xeb85d0c3, 0x48d3566a, 0x9f31d632, + 0xd50f5d79, 0x02eddd21, 0xa1bb5b88, 0x7659dbd0, 0x4d08ec28, + 0x9aea6c70, 0x39bcead9, 0xee5e6a81, 0xa460e1ca, 0x73826192, + 0xd0d4e73b, 0x07366763, 0x44a9f1ad, 0x934b71f5, 0x301df75c, + 0xe7ff7704, 0xadc1fc4f, 0x7a237c17, 0xd975fabe, 0x0e977ae6, + 0x5e4ad722, 0x89a8577a, 0x2afed1d3, 0xfd1c518b, 0xb722dac0, + 0x60c05a98, 0xc396dc31, 0x14745c69, 0x57ebcaa7, 0x80094aff, + 0x235fcc56, 0xf4bd4c0e, 0xbe83c745, 0x6961471d, 0xca37c1b4, + 0x1dd541ec, 0x6b8c9a3c, 0xbc6e1a64, 0x1f389ccd, 0xc8da1c95, + 0x82e497de, 0x55061786, 0xf650912f, 0x21b21177, 0x622d87b9, + 0xb5cf07e1, 0x16998148, 0xc17b0110, 0x8b458a5b, 0x5ca70a03, + 0xfff18caa, 0x28130cf2, 0x78cea136, 0xaf2c216e, 0x0c7aa7c7, + 0xdb98279f, 0x91a6acd4, 0x46442c8c, 0xe512aa25, 0x32f02a7d, + 0x716fbcb3, 0xa68d3ceb, 0x05dbba42, 0xd2393a1a, 0x9807b151, + 0x4fe53109, 0xecb3b7a0, 0x3b5137f8, 0x9a11d850, 0x4df35808, + 0xeea5dea1, 0x39475ef9, 0x7379d5b2, 0xa49b55ea, 0x07cdd343, + 0xd02f531b, 0x93b0c5d5, 0x4452458d, 0xe704c324, 0x30e6437c, + 0x7ad8c837, 0xad3a486f, 0x0e6ccec6, 0xd98e4e9e, 0x8953e35a, + 0x5eb16302, 0xfde7e5ab, 0x2a0565f3, 0x603beeb8, 0xb7d96ee0, + 0x148fe849, 0xc36d6811, 0x80f2fedf, 0x57107e87, 0xf446f82e, + 0x23a47876, 0x699af33d, 0xbe787365, 0x1d2ef5cc, 0xcacc7594, + 0xbc95ae44, 0x6b772e1c, 0xc821a8b5, 0x1fc328ed, 0x55fda3a6, + 0x821f23fe, 0x2149a557, 0xf6ab250f, 0xb534b3c1, 0x62d63399, + 0xc180b530, 0x16623568, 0x5c5cbe23, 0x8bbe3e7b, 0x28e8b8d2, + 0xff0a388a, 0xafd7954e, 0x78351516, 0xdb6393bf, 0x0c8113e7, + 0x46bf98ac, 0x915d18f4, 0x320b9e5d, 0xe5e91e05, 0xa67688cb, + 0x71940893, 0xd2c28e3a, 0x05200e62, 0x4f1e8529, 0x98fc0571, + 0x3baa83d8, 0xec480380, 0xd7193478, 0x00fbb420, 0xa3ad3289, + 0x744fb2d1, 0x3e71399a, 0xe993b9c2, 0x4ac53f6b, 0x9d27bf33, + 0xdeb829fd, 0x095aa9a5, 0xaa0c2f0c, 0x7deeaf54, 0x37d0241f, + 0xe032a447, 0x436422ee, 0x9486a2b6, 0xc45b0f72, 0x13b98f2a, + 0xb0ef0983, 0x670d89db, 0x2d330290, 0xfad182c8, 0x59870461, + 0x8e658439, 0xcdfa12f7, 0x1a1892af, 0xb94e1406, 0x6eac945e, + 0x24921f15, 0xf3709f4d, 0x502619e4, 0x87c499bc, 0xf19d426c, + 0x267fc234, 0x8529449d, 0x52cbc4c5, 0x18f54f8e, 0xcf17cfd6, + 0x6c41497f, 0xbba3c927, 0xf83c5fe9, 0x2fdedfb1, 0x8c885918, + 0x5b6ad940, 0x1154520b, 0xc6b6d253, 0x65e054fa, 0xb202d4a2, + 0xe2df7966, 0x353df93e, 0x966b7f97, 0x4189ffcf, 0x0bb77484, + 0xdc55f4dc, 0x7f037275, 0xa8e1f22d, 0xeb7e64e3, 0x3c9ce4bb, + 0x9fca6212, 0x4828e24a, 0x02166901, 0xd5f4e959, 0x76a26ff0, + 0xa140efa8}, + {0x00000000, 0xef52b6e1, 0x05d46b83, 0xea86dd62, 0x0ba8d706, + 0xe4fa61e7, 0x0e7cbc85, 0xe12e0a64, 0x1751ae0c, 0xf80318ed, + 0x1285c58f, 0xfdd7736e, 0x1cf9790a, 0xf3abcfeb, 0x192d1289, + 0xf67fa468, 0x2ea35c18, 0xc1f1eaf9, 0x2b77379b, 0xc425817a, + 0x250b8b1e, 0xca593dff, 0x20dfe09d, 0xcf8d567c, 0x39f2f214, + 0xd6a044f5, 0x3c269997, 0xd3742f76, 0x325a2512, 0xdd0893f3, + 0x378e4e91, 0xd8dcf870, 0x5d46b830, 0xb2140ed1, 0x5892d3b3, + 0xb7c06552, 0x56ee6f36, 0xb9bcd9d7, 0x533a04b5, 0xbc68b254, + 0x4a17163c, 0xa545a0dd, 0x4fc37dbf, 0xa091cb5e, 0x41bfc13a, + 0xaeed77db, 0x446baab9, 0xab391c58, 0x73e5e428, 0x9cb752c9, + 0x76318fab, 0x9963394a, 0x784d332e, 0x971f85cf, 0x7d9958ad, + 0x92cbee4c, 0x64b44a24, 0x8be6fcc5, 0x616021a7, 0x8e329746, + 0x6f1c9d22, 0x804e2bc3, 0x6ac8f6a1, 0x859a4040, 0xba8d7060, + 0x55dfc681, 0xbf591be3, 0x500bad02, 0xb125a766, 0x5e771187, + 0xb4f1cce5, 0x5ba37a04, 0xaddcde6c, 0x428e688d, 0xa808b5ef, + 0x475a030e, 0xa674096a, 0x4926bf8b, 0xa3a062e9, 0x4cf2d408, + 0x942e2c78, 0x7b7c9a99, 0x91fa47fb, 0x7ea8f11a, 0x9f86fb7e, + 0x70d44d9f, 0x9a5290fd, 0x7500261c, 0x837f8274, 0x6c2d3495, + 0x86abe9f7, 0x69f95f16, 0x88d75572, 0x6785e393, 0x8d033ef1, + 0x62518810, 0xe7cbc850, 0x08997eb1, 0xe21fa3d3, 0x0d4d1532, + 0xec631f56, 0x0331a9b7, 0xe9b774d5, 0x06e5c234, 0xf09a665c, + 0x1fc8d0bd, 0xf54e0ddf, 0x1a1cbb3e, 0xfb32b15a, 0x146007bb, + 0xfee6dad9, 0x11b46c38, 0xc9689448, 0x263a22a9, 0xccbcffcb, + 0x23ee492a, 0xc2c0434e, 0x2d92f5af, 0xc71428cd, 0x28469e2c, + 0xde393a44, 0x316b8ca5, 0xdbed51c7, 0x34bfe726, 0xd591ed42, + 0x3ac35ba3, 0xd04586c1, 0x3f173020, 0xae6be681, 0x41395060, + 0xabbf8d02, 0x44ed3be3, 0xa5c33187, 0x4a918766, 0xa0175a04, + 0x4f45ece5, 0xb93a488d, 0x5668fe6c, 0xbcee230e, 0x53bc95ef, + 0xb2929f8b, 0x5dc0296a, 0xb746f408, 0x581442e9, 0x80c8ba99, + 0x6f9a0c78, 0x851cd11a, 0x6a4e67fb, 0x8b606d9f, 0x6432db7e, + 0x8eb4061c, 0x61e6b0fd, 0x97991495, 0x78cba274, 0x924d7f16, + 0x7d1fc9f7, 0x9c31c393, 0x73637572, 0x99e5a810, 0x76b71ef1, + 0xf32d5eb1, 0x1c7fe850, 0xf6f93532, 0x19ab83d3, 0xf88589b7, + 0x17d73f56, 0xfd51e234, 0x120354d5, 0xe47cf0bd, 0x0b2e465c, + 0xe1a89b3e, 0x0efa2ddf, 0xefd427bb, 0x0086915a, 0xea004c38, + 0x0552fad9, 0xdd8e02a9, 0x32dcb448, 0xd85a692a, 0x3708dfcb, + 0xd626d5af, 0x3974634e, 0xd3f2be2c, 0x3ca008cd, 0xcadfaca5, + 0x258d1a44, 0xcf0bc726, 0x205971c7, 0xc1777ba3, 0x2e25cd42, + 0xc4a31020, 0x2bf1a6c1, 0x14e696e1, 0xfbb42000, 0x1132fd62, + 0xfe604b83, 0x1f4e41e7, 0xf01cf706, 0x1a9a2a64, 0xf5c89c85, + 0x03b738ed, 0xece58e0c, 0x0663536e, 0xe931e58f, 0x081fefeb, + 0xe74d590a, 0x0dcb8468, 0xe2993289, 0x3a45caf9, 0xd5177c18, + 0x3f91a17a, 0xd0c3179b, 0x31ed1dff, 0xdebfab1e, 0x3439767c, + 0xdb6bc09d, 0x2d1464f5, 0xc246d214, 0x28c00f76, 0xc792b997, + 0x26bcb3f3, 0xc9ee0512, 0x2368d870, 0xcc3a6e91, 0x49a02ed1, + 0xa6f29830, 0x4c744552, 0xa326f3b3, 0x4208f9d7, 0xad5a4f36, + 0x47dc9254, 0xa88e24b5, 0x5ef180dd, 0xb1a3363c, 0x5b25eb5e, + 0xb4775dbf, 0x555957db, 0xba0be13a, 0x508d3c58, 0xbfdf8ab9, + 0x670372c9, 0x8851c428, 0x62d7194a, 0x8d85afab, 0x6caba5cf, + 0x83f9132e, 0x697fce4c, 0x862d78ad, 0x7052dcc5, 0x9f006a24, + 0x7586b746, 0x9ad401a7, 0x7bfa0bc3, 0x94a8bd22, 0x7e2e6040, + 0x917cd6a1}, + {0x00000000, 0x87a6cb43, 0xd43c90c7, 0x539a5b84, 0x730827cf, + 0xf4aeec8c, 0xa734b708, 0x20927c4b, 0xe6104f9e, 0x61b684dd, + 0x322cdf59, 0xb58a141a, 0x95186851, 0x12bea312, 0x4124f896, + 0xc68233d5, 0x1751997d, 0x90f7523e, 0xc36d09ba, 0x44cbc2f9, + 0x6459beb2, 0xe3ff75f1, 0xb0652e75, 0x37c3e536, 0xf141d6e3, + 0x76e71da0, 0x257d4624, 0xa2db8d67, 0x8249f12c, 0x05ef3a6f, + 0x567561eb, 0xd1d3aaa8, 0x2ea332fa, 0xa905f9b9, 0xfa9fa23d, + 0x7d39697e, 0x5dab1535, 0xda0dde76, 0x899785f2, 0x0e314eb1, + 0xc8b37d64, 0x4f15b627, 0x1c8feda3, 0x9b2926e0, 0xbbbb5aab, + 0x3c1d91e8, 0x6f87ca6c, 0xe821012f, 0x39f2ab87, 0xbe5460c4, + 0xedce3b40, 0x6a68f003, 0x4afa8c48, 0xcd5c470b, 0x9ec61c8f, + 0x1960d7cc, 0xdfe2e419, 0x58442f5a, 0x0bde74de, 0x8c78bf9d, + 0xaceac3d6, 0x2b4c0895, 0x78d65311, 0xff709852, 0x5d4665f4, + 0xdae0aeb7, 0x897af533, 0x0edc3e70, 0x2e4e423b, 0xa9e88978, + 0xfa72d2fc, 0x7dd419bf, 0xbb562a6a, 0x3cf0e129, 0x6f6abaad, + 0xe8cc71ee, 0xc85e0da5, 0x4ff8c6e6, 0x1c629d62, 0x9bc45621, + 0x4a17fc89, 0xcdb137ca, 0x9e2b6c4e, 0x198da70d, 0x391fdb46, + 0xbeb91005, 0xed234b81, 0x6a8580c2, 0xac07b317, 0x2ba17854, + 0x783b23d0, 0xff9de893, 0xdf0f94d8, 0x58a95f9b, 0x0b33041f, + 0x8c95cf5c, 0x73e5570e, 0xf4439c4d, 0xa7d9c7c9, 0x207f0c8a, + 0x00ed70c1, 0x874bbb82, 0xd4d1e006, 0x53772b45, 0x95f51890, + 0x1253d3d3, 0x41c98857, 0xc66f4314, 0xe6fd3f5f, 0x615bf41c, + 0x32c1af98, 0xb56764db, 0x64b4ce73, 0xe3120530, 0xb0885eb4, + 0x372e95f7, 0x17bce9bc, 0x901a22ff, 0xc380797b, 0x4426b238, + 0x82a481ed, 0x05024aae, 0x5698112a, 0xd13eda69, 0xf1aca622, + 0x760a6d61, 0x259036e5, 0xa236fda6, 0xba8ccbe8, 0x3d2a00ab, + 0x6eb05b2f, 0xe916906c, 0xc984ec27, 0x4e222764, 0x1db87ce0, + 0x9a1eb7a3, 0x5c9c8476, 0xdb3a4f35, 0x88a014b1, 0x0f06dff2, + 0x2f94a3b9, 0xa83268fa, 0xfba8337e, 0x7c0ef83d, 0xaddd5295, + 0x2a7b99d6, 0x79e1c252, 0xfe470911, 0xded5755a, 0x5973be19, + 0x0ae9e59d, 0x8d4f2ede, 0x4bcd1d0b, 0xcc6bd648, 0x9ff18dcc, + 0x1857468f, 0x38c53ac4, 0xbf63f187, 0xecf9aa03, 0x6b5f6140, + 0x942ff912, 0x13893251, 0x401369d5, 0xc7b5a296, 0xe727dedd, + 0x6081159e, 0x331b4e1a, 0xb4bd8559, 0x723fb68c, 0xf5997dcf, + 0xa603264b, 0x21a5ed08, 0x01379143, 0x86915a00, 0xd50b0184, + 0x52adcac7, 0x837e606f, 0x04d8ab2c, 0x5742f0a8, 0xd0e43beb, + 0xf07647a0, 0x77d08ce3, 0x244ad767, 0xa3ec1c24, 0x656e2ff1, + 0xe2c8e4b2, 0xb152bf36, 0x36f47475, 0x1666083e, 0x91c0c37d, + 0xc25a98f9, 0x45fc53ba, 0xe7caae1c, 0x606c655f, 0x33f63edb, + 0xb450f598, 0x94c289d3, 0x13644290, 0x40fe1914, 0xc758d257, + 0x01dae182, 0x867c2ac1, 0xd5e67145, 0x5240ba06, 0x72d2c64d, + 0xf5740d0e, 0xa6ee568a, 0x21489dc9, 0xf09b3761, 0x773dfc22, + 0x24a7a7a6, 0xa3016ce5, 0x839310ae, 0x0435dbed, 0x57af8069, + 0xd0094b2a, 0x168b78ff, 0x912db3bc, 0xc2b7e838, 0x4511237b, + 0x65835f30, 0xe2259473, 0xb1bfcff7, 0x361904b4, 0xc9699ce6, + 0x4ecf57a5, 0x1d550c21, 0x9af3c762, 0xba61bb29, 0x3dc7706a, + 0x6e5d2bee, 0xe9fbe0ad, 0x2f79d378, 0xa8df183b, 0xfb4543bf, + 0x7ce388fc, 0x5c71f4b7, 0xdbd73ff4, 0x884d6470, 0x0febaf33, + 0xde38059b, 0x599eced8, 0x0a04955c, 0x8da25e1f, 0xad302254, + 0x2a96e917, 0x790cb293, 0xfeaa79d0, 0x38284a05, 0xbf8e8146, + 0xec14dac2, 0x6bb21181, 0x4b206dca, 0xcc86a689, 0x9f1cfd0d, + 0x18ba364e}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x43cba687, 0xc7903cd4, 0x845b9a53, 0xcf270873, + 0x8cecaef4, 0x08b734a7, 0x4b7c9220, 0x9e4f10e6, 0xdd84b661, + 0x59df2c32, 0x1a148ab5, 0x51681895, 0x12a3be12, 0x96f82441, + 0xd53382c6, 0x7d995117, 0x3e52f790, 0xba096dc3, 0xf9c2cb44, + 0xb2be5964, 0xf175ffe3, 0x752e65b0, 0x36e5c337, 0xe3d641f1, + 0xa01de776, 0x24467d25, 0x678ddba2, 0x2cf14982, 0x6f3aef05, + 0xeb617556, 0xa8aad3d1, 0xfa32a32e, 0xb9f905a9, 0x3da29ffa, + 0x7e69397d, 0x3515ab5d, 0x76de0dda, 0xf2859789, 0xb14e310e, + 0x647db3c8, 0x27b6154f, 0xa3ed8f1c, 0xe026299b, 0xab5abbbb, + 0xe8911d3c, 0x6cca876f, 0x2f0121e8, 0x87abf239, 0xc46054be, + 0x403bceed, 0x03f0686a, 0x488cfa4a, 0x0b475ccd, 0x8f1cc69e, + 0xccd76019, 0x19e4e2df, 0x5a2f4458, 0xde74de0b, 0x9dbf788c, + 0xd6c3eaac, 0x95084c2b, 0x1153d678, 0x529870ff, 0xf465465d, + 0xb7aee0da, 0x33f57a89, 0x703edc0e, 0x3b424e2e, 0x7889e8a9, + 0xfcd272fa, 0xbf19d47d, 0x6a2a56bb, 0x29e1f03c, 0xadba6a6f, + 0xee71cce8, 0xa50d5ec8, 0xe6c6f84f, 0x629d621c, 0x2156c49b, + 0x89fc174a, 0xca37b1cd, 0x4e6c2b9e, 0x0da78d19, 0x46db1f39, + 0x0510b9be, 0x814b23ed, 0xc280856a, 0x17b307ac, 0x5478a12b, + 0xd0233b78, 0x93e89dff, 0xd8940fdf, 0x9b5fa958, 0x1f04330b, + 0x5ccf958c, 0x0e57e573, 0x4d9c43f4, 0xc9c7d9a7, 0x8a0c7f20, + 0xc170ed00, 0x82bb4b87, 0x06e0d1d4, 0x452b7753, 0x9018f595, + 0xd3d35312, 0x5788c941, 0x14436fc6, 0x5f3ffde6, 0x1cf45b61, + 0x98afc132, 0xdb6467b5, 0x73ceb464, 0x300512e3, 0xb45e88b0, + 0xf7952e37, 0xbce9bc17, 0xff221a90, 0x7b7980c3, 0x38b22644, + 0xed81a482, 0xae4a0205, 0x2a119856, 0x69da3ed1, 0x22a6acf1, + 0x616d0a76, 0xe5369025, 0xa6fd36a2, 0xe8cb8cba, 0xab002a3d, + 0x2f5bb06e, 0x6c9016e9, 0x27ec84c9, 0x6427224e, 0xe07cb81d, + 0xa3b71e9a, 0x76849c5c, 0x354f3adb, 0xb114a088, 0xf2df060f, + 0xb9a3942f, 0xfa6832a8, 0x7e33a8fb, 0x3df80e7c, 0x9552ddad, + 0xd6997b2a, 0x52c2e179, 0x110947fe, 0x5a75d5de, 0x19be7359, + 0x9de5e90a, 0xde2e4f8d, 0x0b1dcd4b, 0x48d66bcc, 0xcc8df19f, + 0x8f465718, 0xc43ac538, 0x87f163bf, 0x03aaf9ec, 0x40615f6b, + 0x12f92f94, 0x51328913, 0xd5691340, 0x96a2b5c7, 0xddde27e7, + 0x9e158160, 0x1a4e1b33, 0x5985bdb4, 0x8cb63f72, 0xcf7d99f5, + 0x4b2603a6, 0x08eda521, 0x43913701, 0x005a9186, 0x84010bd5, + 0xc7caad52, 0x6f607e83, 0x2cabd804, 0xa8f04257, 0xeb3be4d0, + 0xa04776f0, 0xe38cd077, 0x67d74a24, 0x241ceca3, 0xf12f6e65, + 0xb2e4c8e2, 0x36bf52b1, 0x7574f436, 0x3e086616, 0x7dc3c091, + 0xf9985ac2, 0xba53fc45, 0x1caecae7, 0x5f656c60, 0xdb3ef633, + 0x98f550b4, 0xd389c294, 0x90426413, 0x1419fe40, 0x57d258c7, + 0x82e1da01, 0xc12a7c86, 0x4571e6d5, 0x06ba4052, 0x4dc6d272, + 0x0e0d74f5, 0x8a56eea6, 0xc99d4821, 0x61379bf0, 0x22fc3d77, + 0xa6a7a724, 0xe56c01a3, 0xae109383, 0xeddb3504, 0x6980af57, + 0x2a4b09d0, 0xff788b16, 0xbcb32d91, 0x38e8b7c2, 0x7b231145, + 0x305f8365, 0x739425e2, 0xf7cfbfb1, 0xb4041936, 0xe69c69c9, + 0xa557cf4e, 0x210c551d, 0x62c7f39a, 0x29bb61ba, 0x6a70c73d, + 0xee2b5d6e, 0xade0fbe9, 0x78d3792f, 0x3b18dfa8, 0xbf4345fb, + 0xfc88e37c, 0xb7f4715c, 0xf43fd7db, 0x70644d88, 0x33afeb0f, + 0x9b0538de, 0xd8ce9e59, 0x5c95040a, 0x1f5ea28d, 0x542230ad, + 0x17e9962a, 0x93b20c79, 0xd079aafe, 0x054a2838, 0x46818ebf, + 0xc2da14ec, 0x8111b26b, 0xca6d204b, 0x89a686cc, 0x0dfd1c9f, + 0x4e36ba18}, + {0x00000000, 0xe1b652ef, 0x836bd405, 0x62dd86ea, 0x06d7a80b, + 0xe761fae4, 0x85bc7c0e, 0x640a2ee1, 0x0cae5117, 0xed1803f8, + 0x8fc58512, 0x6e73d7fd, 0x0a79f91c, 0xebcfabf3, 0x89122d19, + 0x68a47ff6, 0x185ca32e, 0xf9eaf1c1, 0x9b37772b, 0x7a8125c4, + 0x1e8b0b25, 0xff3d59ca, 0x9de0df20, 0x7c568dcf, 0x14f2f239, + 0xf544a0d6, 0x9799263c, 0x762f74d3, 0x12255a32, 0xf39308dd, + 0x914e8e37, 0x70f8dcd8, 0x30b8465d, 0xd10e14b2, 0xb3d39258, + 0x5265c0b7, 0x366fee56, 0xd7d9bcb9, 0xb5043a53, 0x54b268bc, + 0x3c16174a, 0xdda045a5, 0xbf7dc34f, 0x5ecb91a0, 0x3ac1bf41, + 0xdb77edae, 0xb9aa6b44, 0x581c39ab, 0x28e4e573, 0xc952b79c, + 0xab8f3176, 0x4a396399, 0x2e334d78, 0xcf851f97, 0xad58997d, + 0x4ceecb92, 0x244ab464, 0xc5fce68b, 0xa7216061, 0x4697328e, + 0x229d1c6f, 0xc32b4e80, 0xa1f6c86a, 0x40409a85, 0x60708dba, + 0x81c6df55, 0xe31b59bf, 0x02ad0b50, 0x66a725b1, 0x8711775e, + 0xe5ccf1b4, 0x047aa35b, 0x6cdedcad, 0x8d688e42, 0xefb508a8, + 0x0e035a47, 0x6a0974a6, 0x8bbf2649, 0xe962a0a3, 0x08d4f24c, + 0x782c2e94, 0x999a7c7b, 0xfb47fa91, 0x1af1a87e, 0x7efb869f, + 0x9f4dd470, 0xfd90529a, 0x1c260075, 0x74827f83, 0x95342d6c, + 0xf7e9ab86, 0x165ff969, 0x7255d788, 0x93e38567, 0xf13e038d, + 0x10885162, 0x50c8cbe7, 0xb17e9908, 0xd3a31fe2, 0x32154d0d, + 0x561f63ec, 0xb7a93103, 0xd574b7e9, 0x34c2e506, 0x5c669af0, + 0xbdd0c81f, 0xdf0d4ef5, 0x3ebb1c1a, 0x5ab132fb, 0xbb076014, + 0xd9dae6fe, 0x386cb411, 0x489468c9, 0xa9223a26, 0xcbffbccc, + 0x2a49ee23, 0x4e43c0c2, 0xaff5922d, 0xcd2814c7, 0x2c9e4628, + 0x443a39de, 0xa58c6b31, 0xc751eddb, 0x26e7bf34, 0x42ed91d5, + 0xa35bc33a, 0xc18645d0, 0x2030173f, 0x81e66bae, 0x60503941, + 0x028dbfab, 0xe33bed44, 0x8731c3a5, 0x6687914a, 0x045a17a0, + 0xe5ec454f, 0x8d483ab9, 0x6cfe6856, 0x0e23eebc, 0xef95bc53, + 0x8b9f92b2, 0x6a29c05d, 0x08f446b7, 0xe9421458, 0x99bac880, + 0x780c9a6f, 0x1ad11c85, 0xfb674e6a, 0x9f6d608b, 0x7edb3264, + 0x1c06b48e, 0xfdb0e661, 0x95149997, 0x74a2cb78, 0x167f4d92, + 0xf7c91f7d, 0x93c3319c, 0x72756373, 0x10a8e599, 0xf11eb776, + 0xb15e2df3, 0x50e87f1c, 0x3235f9f6, 0xd383ab19, 0xb78985f8, + 0x563fd717, 0x34e251fd, 0xd5540312, 0xbdf07ce4, 0x5c462e0b, + 0x3e9ba8e1, 0xdf2dfa0e, 0xbb27d4ef, 0x5a918600, 0x384c00ea, + 0xd9fa5205, 0xa9028edd, 0x48b4dc32, 0x2a695ad8, 0xcbdf0837, + 0xafd526d6, 0x4e637439, 0x2cbef2d3, 0xcd08a03c, 0xa5acdfca, + 0x441a8d25, 0x26c70bcf, 0xc7715920, 0xa37b77c1, 0x42cd252e, + 0x2010a3c4, 0xc1a6f12b, 0xe196e614, 0x0020b4fb, 0x62fd3211, + 0x834b60fe, 0xe7414e1f, 0x06f71cf0, 0x642a9a1a, 0x859cc8f5, + 0xed38b703, 0x0c8ee5ec, 0x6e536306, 0x8fe531e9, 0xebef1f08, + 0x0a594de7, 0x6884cb0d, 0x893299e2, 0xf9ca453a, 0x187c17d5, + 0x7aa1913f, 0x9b17c3d0, 0xff1ded31, 0x1eabbfde, 0x7c763934, + 0x9dc06bdb, 0xf564142d, 0x14d246c2, 0x760fc028, 0x97b992c7, + 0xf3b3bc26, 0x1205eec9, 0x70d86823, 0x916e3acc, 0xd12ea049, + 0x3098f2a6, 0x5245744c, 0xb3f326a3, 0xd7f90842, 0x364f5aad, + 0x5492dc47, 0xb5248ea8, 0xdd80f15e, 0x3c36a3b1, 0x5eeb255b, + 0xbf5d77b4, 0xdb575955, 0x3ae10bba, 0x583c8d50, 0xb98adfbf, + 0xc9720367, 0x28c45188, 0x4a19d762, 0xabaf858d, 0xcfa5ab6c, + 0x2e13f983, 0x4cce7f69, 0xad782d86, 0xc5dc5270, 0x246a009f, + 0x46b78675, 0xa701d49a, 0xc30bfa7b, 0x22bda894, 0x40602e7e, + 0xa1d67c91}, + {0x00000000, 0x5880e2d7, 0xf106b474, 0xa98656a3, 0xe20d68e9, + 0xba8d8a3e, 0x130bdc9d, 0x4b8b3e4a, 0x851da109, 0xdd9d43de, + 0x741b157d, 0x2c9bf7aa, 0x6710c9e0, 0x3f902b37, 0x96167d94, + 0xce969f43, 0x0a3b4213, 0x52bba0c4, 0xfb3df667, 0xa3bd14b0, + 0xe8362afa, 0xb0b6c82d, 0x19309e8e, 0x41b07c59, 0x8f26e31a, + 0xd7a601cd, 0x7e20576e, 0x26a0b5b9, 0x6d2b8bf3, 0x35ab6924, + 0x9c2d3f87, 0xc4addd50, 0x14768426, 0x4cf666f1, 0xe5703052, + 0xbdf0d285, 0xf67beccf, 0xaefb0e18, 0x077d58bb, 0x5ffdba6c, + 0x916b252f, 0xc9ebc7f8, 0x606d915b, 0x38ed738c, 0x73664dc6, + 0x2be6af11, 0x8260f9b2, 0xdae01b65, 0x1e4dc635, 0x46cd24e2, + 0xef4b7241, 0xb7cb9096, 0xfc40aedc, 0xa4c04c0b, 0x0d461aa8, + 0x55c6f87f, 0x9b50673c, 0xc3d085eb, 0x6a56d348, 0x32d6319f, + 0x795d0fd5, 0x21dded02, 0x885bbba1, 0xd0db5976, 0x28ec084d, + 0x706cea9a, 0xd9eabc39, 0x816a5eee, 0xcae160a4, 0x92618273, + 0x3be7d4d0, 0x63673607, 0xadf1a944, 0xf5714b93, 0x5cf71d30, + 0x0477ffe7, 0x4ffcc1ad, 0x177c237a, 0xbefa75d9, 0xe67a970e, + 0x22d74a5e, 0x7a57a889, 0xd3d1fe2a, 0x8b511cfd, 0xc0da22b7, + 0x985ac060, 0x31dc96c3, 0x695c7414, 0xa7caeb57, 0xff4a0980, + 0x56cc5f23, 0x0e4cbdf4, 0x45c783be, 0x1d476169, 0xb4c137ca, + 0xec41d51d, 0x3c9a8c6b, 0x641a6ebc, 0xcd9c381f, 0x951cdac8, + 0xde97e482, 0x86170655, 0x2f9150f6, 0x7711b221, 0xb9872d62, + 0xe107cfb5, 0x48819916, 0x10017bc1, 0x5b8a458b, 0x030aa75c, + 0xaa8cf1ff, 0xf20c1328, 0x36a1ce78, 0x6e212caf, 0xc7a77a0c, + 0x9f2798db, 0xd4aca691, 0x8c2c4446, 0x25aa12e5, 0x7d2af032, + 0xb3bc6f71, 0xeb3c8da6, 0x42badb05, 0x1a3a39d2, 0x51b10798, + 0x0931e54f, 0xa0b7b3ec, 0xf837513b, 0x50d8119a, 0x0858f34d, + 0xa1dea5ee, 0xf95e4739, 0xb2d57973, 0xea559ba4, 0x43d3cd07, + 0x1b532fd0, 0xd5c5b093, 0x8d455244, 0x24c304e7, 0x7c43e630, + 0x37c8d87a, 0x6f483aad, 0xc6ce6c0e, 0x9e4e8ed9, 0x5ae35389, + 0x0263b15e, 0xabe5e7fd, 0xf365052a, 0xb8ee3b60, 0xe06ed9b7, + 0x49e88f14, 0x11686dc3, 0xdffef280, 0x877e1057, 0x2ef846f4, + 0x7678a423, 0x3df39a69, 0x657378be, 0xccf52e1d, 0x9475ccca, + 0x44ae95bc, 0x1c2e776b, 0xb5a821c8, 0xed28c31f, 0xa6a3fd55, + 0xfe231f82, 0x57a54921, 0x0f25abf6, 0xc1b334b5, 0x9933d662, + 0x30b580c1, 0x68356216, 0x23be5c5c, 0x7b3ebe8b, 0xd2b8e828, + 0x8a380aff, 0x4e95d7af, 0x16153578, 0xbf9363db, 0xe713810c, + 0xac98bf46, 0xf4185d91, 0x5d9e0b32, 0x051ee9e5, 0xcb8876a6, + 0x93089471, 0x3a8ec2d2, 0x620e2005, 0x29851e4f, 0x7105fc98, + 0xd883aa3b, 0x800348ec, 0x783419d7, 0x20b4fb00, 0x8932ada3, + 0xd1b24f74, 0x9a39713e, 0xc2b993e9, 0x6b3fc54a, 0x33bf279d, + 0xfd29b8de, 0xa5a95a09, 0x0c2f0caa, 0x54afee7d, 0x1f24d037, + 0x47a432e0, 0xee226443, 0xb6a28694, 0x720f5bc4, 0x2a8fb913, + 0x8309efb0, 0xdb890d67, 0x9002332d, 0xc882d1fa, 0x61048759, + 0x3984658e, 0xf712facd, 0xaf92181a, 0x06144eb9, 0x5e94ac6e, + 0x151f9224, 0x4d9f70f3, 0xe4192650, 0xbc99c487, 0x6c429df1, + 0x34c27f26, 0x9d442985, 0xc5c4cb52, 0x8e4ff518, 0xd6cf17cf, + 0x7f49416c, 0x27c9a3bb, 0xe95f3cf8, 0xb1dfde2f, 0x1859888c, + 0x40d96a5b, 0x0b525411, 0x53d2b6c6, 0xfa54e065, 0xa2d402b2, + 0x6679dfe2, 0x3ef93d35, 0x977f6b96, 0xcfff8941, 0x8474b70b, + 0xdcf455dc, 0x7572037f, 0x2df2e1a8, 0xe3647eeb, 0xbbe49c3c, + 0x1262ca9f, 0x4ae22848, 0x01691602, 0x59e9f4d5, 0xf06fa276, + 0xa8ef40a1}, + {0x00000000, 0x463b6765, 0x8c76ceca, 0xca4da9af, 0x59ebed4e, + 0x1fd08a2b, 0xd59d2384, 0x93a644e1, 0xb2d6db9d, 0xf4edbcf8, + 0x3ea01557, 0x789b7232, 0xeb3d36d3, 0xad0651b6, 0x674bf819, + 0x21709f7c, 0x25abc6e0, 0x6390a185, 0xa9dd082a, 0xefe66f4f, + 0x7c402bae, 0x3a7b4ccb, 0xf036e564, 0xb60d8201, 0x977d1d7d, + 0xd1467a18, 0x1b0bd3b7, 0x5d30b4d2, 0xce96f033, 0x88ad9756, + 0x42e03ef9, 0x04db599c, 0x0b50fc1a, 0x4d6b9b7f, 0x872632d0, + 0xc11d55b5, 0x52bb1154, 0x14807631, 0xdecddf9e, 0x98f6b8fb, + 0xb9862787, 0xffbd40e2, 0x35f0e94d, 0x73cb8e28, 0xe06dcac9, + 0xa656adac, 0x6c1b0403, 0x2a206366, 0x2efb3afa, 0x68c05d9f, + 0xa28df430, 0xe4b69355, 0x7710d7b4, 0x312bb0d1, 0xfb66197e, + 0xbd5d7e1b, 0x9c2de167, 0xda168602, 0x105b2fad, 0x566048c8, + 0xc5c60c29, 0x83fd6b4c, 0x49b0c2e3, 0x0f8ba586, 0x16a0f835, + 0x509b9f50, 0x9ad636ff, 0xdced519a, 0x4f4b157b, 0x0970721e, + 0xc33ddbb1, 0x8506bcd4, 0xa47623a8, 0xe24d44cd, 0x2800ed62, + 0x6e3b8a07, 0xfd9dcee6, 0xbba6a983, 0x71eb002c, 0x37d06749, + 0x330b3ed5, 0x753059b0, 0xbf7df01f, 0xf946977a, 0x6ae0d39b, + 0x2cdbb4fe, 0xe6961d51, 0xa0ad7a34, 0x81dde548, 0xc7e6822d, + 0x0dab2b82, 0x4b904ce7, 0xd8360806, 0x9e0d6f63, 0x5440c6cc, + 0x127ba1a9, 0x1df0042f, 0x5bcb634a, 0x9186cae5, 0xd7bdad80, + 0x441be961, 0x02208e04, 0xc86d27ab, 0x8e5640ce, 0xaf26dfb2, + 0xe91db8d7, 0x23501178, 0x656b761d, 0xf6cd32fc, 0xb0f65599, + 0x7abbfc36, 0x3c809b53, 0x385bc2cf, 0x7e60a5aa, 0xb42d0c05, + 0xf2166b60, 0x61b02f81, 0x278b48e4, 0xedc6e14b, 0xabfd862e, + 0x8a8d1952, 0xccb67e37, 0x06fbd798, 0x40c0b0fd, 0xd366f41c, + 0x955d9379, 0x5f103ad6, 0x192b5db3, 0x2c40f16b, 0x6a7b960e, + 0xa0363fa1, 0xe60d58c4, 0x75ab1c25, 0x33907b40, 0xf9ddd2ef, + 0xbfe6b58a, 0x9e962af6, 0xd8ad4d93, 0x12e0e43c, 0x54db8359, + 0xc77dc7b8, 0x8146a0dd, 0x4b0b0972, 0x0d306e17, 0x09eb378b, + 0x4fd050ee, 0x859df941, 0xc3a69e24, 0x5000dac5, 0x163bbda0, + 0xdc76140f, 0x9a4d736a, 0xbb3dec16, 0xfd068b73, 0x374b22dc, + 0x717045b9, 0xe2d60158, 0xa4ed663d, 0x6ea0cf92, 0x289ba8f7, + 0x27100d71, 0x612b6a14, 0xab66c3bb, 0xed5da4de, 0x7efbe03f, + 0x38c0875a, 0xf28d2ef5, 0xb4b64990, 0x95c6d6ec, 0xd3fdb189, + 0x19b01826, 0x5f8b7f43, 0xcc2d3ba2, 0x8a165cc7, 0x405bf568, + 0x0660920d, 0x02bbcb91, 0x4480acf4, 0x8ecd055b, 0xc8f6623e, + 0x5b5026df, 0x1d6b41ba, 0xd726e815, 0x911d8f70, 0xb06d100c, + 0xf6567769, 0x3c1bdec6, 0x7a20b9a3, 0xe986fd42, 0xafbd9a27, + 0x65f03388, 0x23cb54ed, 0x3ae0095e, 0x7cdb6e3b, 0xb696c794, + 0xf0ada0f1, 0x630be410, 0x25308375, 0xef7d2ada, 0xa9464dbf, + 0x8836d2c3, 0xce0db5a6, 0x04401c09, 0x427b7b6c, 0xd1dd3f8d, + 0x97e658e8, 0x5dabf147, 0x1b909622, 0x1f4bcfbe, 0x5970a8db, + 0x933d0174, 0xd5066611, 0x46a022f0, 0x009b4595, 0xcad6ec3a, + 0x8ced8b5f, 0xad9d1423, 0xeba67346, 0x21ebdae9, 0x67d0bd8c, + 0xf476f96d, 0xb24d9e08, 0x780037a7, 0x3e3b50c2, 0x31b0f544, + 0x778b9221, 0xbdc63b8e, 0xfbfd5ceb, 0x685b180a, 0x2e607f6f, + 0xe42dd6c0, 0xa216b1a5, 0x83662ed9, 0xc55d49bc, 0x0f10e013, + 0x492b8776, 0xda8dc397, 0x9cb6a4f2, 0x56fb0d5d, 0x10c06a38, + 0x141b33a4, 0x522054c1, 0x986dfd6e, 0xde569a0b, 0x4df0deea, + 0x0bcbb98f, 0xc1861020, 0x87bd7745, 0xa6cde839, 0xe0f68f5c, + 0x2abb26f3, 0x6c804196, 0xff260577, 0xb91d6212, 0x7350cbbd, + 0x356bacd8}}; + +#endif + +#endif + +#if N == 6 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x3db1ecdc, 0x7b63d9b8, 0x46d23564, 0xf6c7b370, + 0xcb765fac, 0x8da46ac8, 0xb0158614, 0x36fe60a1, 0x0b4f8c7d, + 0x4d9db919, 0x702c55c5, 0xc039d3d1, 0xfd883f0d, 0xbb5a0a69, + 0x86ebe6b5, 0x6dfcc142, 0x504d2d9e, 0x169f18fa, 0x2b2ef426, + 0x9b3b7232, 0xa68a9eee, 0xe058ab8a, 0xdde94756, 0x5b02a1e3, + 0x66b34d3f, 0x2061785b, 0x1dd09487, 0xadc51293, 0x9074fe4f, + 0xd6a6cb2b, 0xeb1727f7, 0xdbf98284, 0xe6486e58, 0xa09a5b3c, + 0x9d2bb7e0, 0x2d3e31f4, 0x108fdd28, 0x565de84c, 0x6bec0490, + 0xed07e225, 0xd0b60ef9, 0x96643b9d, 0xabd5d741, 0x1bc05155, + 0x2671bd89, 0x60a388ed, 0x5d126431, 0xb60543c6, 0x8bb4af1a, + 0xcd669a7e, 0xf0d776a2, 0x40c2f0b6, 0x7d731c6a, 0x3ba1290e, + 0x0610c5d2, 0x80fb2367, 0xbd4acfbb, 0xfb98fadf, 0xc6291603, + 0x763c9017, 0x4b8d7ccb, 0x0d5f49af, 0x30eea573, 0x6c820349, + 0x5133ef95, 0x17e1daf1, 0x2a50362d, 0x9a45b039, 0xa7f45ce5, + 0xe1266981, 0xdc97855d, 0x5a7c63e8, 0x67cd8f34, 0x211fba50, + 0x1cae568c, 0xacbbd098, 0x910a3c44, 0xd7d80920, 0xea69e5fc, + 0x017ec20b, 0x3ccf2ed7, 0x7a1d1bb3, 0x47acf76f, 0xf7b9717b, + 0xca089da7, 0x8cdaa8c3, 0xb16b441f, 0x3780a2aa, 0x0a314e76, + 0x4ce37b12, 0x715297ce, 0xc14711da, 0xfcf6fd06, 0xba24c862, + 0x879524be, 0xb77b81cd, 0x8aca6d11, 0xcc185875, 0xf1a9b4a9, + 0x41bc32bd, 0x7c0dde61, 0x3adfeb05, 0x076e07d9, 0x8185e16c, + 0xbc340db0, 0xfae638d4, 0xc757d408, 0x7742521c, 0x4af3bec0, + 0x0c218ba4, 0x31906778, 0xda87408f, 0xe736ac53, 0xa1e49937, + 0x9c5575eb, 0x2c40f3ff, 0x11f11f23, 0x57232a47, 0x6a92c69b, + 0xec79202e, 0xd1c8ccf2, 0x971af996, 0xaaab154a, 0x1abe935e, + 0x270f7f82, 0x61dd4ae6, 0x5c6ca63a, 0xd9040692, 0xe4b5ea4e, + 0xa267df2a, 0x9fd633f6, 0x2fc3b5e2, 0x1272593e, 0x54a06c5a, + 0x69118086, 0xeffa6633, 0xd24b8aef, 0x9499bf8b, 0xa9285357, + 0x193dd543, 0x248c399f, 0x625e0cfb, 0x5fefe027, 0xb4f8c7d0, + 0x89492b0c, 0xcf9b1e68, 0xf22af2b4, 0x423f74a0, 0x7f8e987c, + 0x395cad18, 0x04ed41c4, 0x8206a771, 0xbfb74bad, 0xf9657ec9, + 0xc4d49215, 0x74c11401, 0x4970f8dd, 0x0fa2cdb9, 0x32132165, + 0x02fd8416, 0x3f4c68ca, 0x799e5dae, 0x442fb172, 0xf43a3766, + 0xc98bdbba, 0x8f59eede, 0xb2e80202, 0x3403e4b7, 0x09b2086b, + 0x4f603d0f, 0x72d1d1d3, 0xc2c457c7, 0xff75bb1b, 0xb9a78e7f, + 0x841662a3, 0x6f014554, 0x52b0a988, 0x14629cec, 0x29d37030, + 0x99c6f624, 0xa4771af8, 0xe2a52f9c, 0xdf14c340, 0x59ff25f5, + 0x644ec929, 0x229cfc4d, 0x1f2d1091, 0xaf389685, 0x92897a59, + 0xd45b4f3d, 0xe9eaa3e1, 0xb58605db, 0x8837e907, 0xcee5dc63, + 0xf35430bf, 0x4341b6ab, 0x7ef05a77, 0x38226f13, 0x059383cf, + 0x8378657a, 0xbec989a6, 0xf81bbcc2, 0xc5aa501e, 0x75bfd60a, + 0x480e3ad6, 0x0edc0fb2, 0x336de36e, 0xd87ac499, 0xe5cb2845, + 0xa3191d21, 0x9ea8f1fd, 0x2ebd77e9, 0x130c9b35, 0x55deae51, + 0x686f428d, 0xee84a438, 0xd33548e4, 0x95e77d80, 0xa856915c, + 0x18431748, 0x25f2fb94, 0x6320cef0, 0x5e91222c, 0x6e7f875f, + 0x53ce6b83, 0x151c5ee7, 0x28adb23b, 0x98b8342f, 0xa509d8f3, + 0xe3dbed97, 0xde6a014b, 0x5881e7fe, 0x65300b22, 0x23e23e46, + 0x1e53d29a, 0xae46548e, 0x93f7b852, 0xd5258d36, 0xe89461ea, + 0x0383461d, 0x3e32aac1, 0x78e09fa5, 0x45517379, 0xf544f56d, + 0xc8f519b1, 0x8e272cd5, 0xb396c009, 0x357d26bc, 0x08ccca60, + 0x4e1eff04, 0x73af13d8, 0xc3ba95cc, 0xfe0b7910, 0xb8d94c74, + 0x8568a0a8}, + {0x00000000, 0x69790b65, 0xd2f216ca, 0xbb8b1daf, 0x7e952bd5, + 0x17ec20b0, 0xac673d1f, 0xc51e367a, 0xfd2a57aa, 0x94535ccf, + 0x2fd84160, 0x46a14a05, 0x83bf7c7f, 0xeac6771a, 0x514d6ab5, + 0x383461d0, 0x2125a915, 0x485ca270, 0xf3d7bfdf, 0x9aaeb4ba, + 0x5fb082c0, 0x36c989a5, 0x8d42940a, 0xe43b9f6f, 0xdc0ffebf, + 0xb576f5da, 0x0efde875, 0x6784e310, 0xa29ad56a, 0xcbe3de0f, + 0x7068c3a0, 0x1911c8c5, 0x424b522a, 0x2b32594f, 0x90b944e0, + 0xf9c04f85, 0x3cde79ff, 0x55a7729a, 0xee2c6f35, 0x87556450, + 0xbf610580, 0xd6180ee5, 0x6d93134a, 0x04ea182f, 0xc1f42e55, + 0xa88d2530, 0x1306389f, 0x7a7f33fa, 0x636efb3f, 0x0a17f05a, + 0xb19cedf5, 0xd8e5e690, 0x1dfbd0ea, 0x7482db8f, 0xcf09c620, + 0xa670cd45, 0x9e44ac95, 0xf73da7f0, 0x4cb6ba5f, 0x25cfb13a, + 0xe0d18740, 0x89a88c25, 0x3223918a, 0x5b5a9aef, 0x8496a454, + 0xedefaf31, 0x5664b29e, 0x3f1db9fb, 0xfa038f81, 0x937a84e4, + 0x28f1994b, 0x4188922e, 0x79bcf3fe, 0x10c5f89b, 0xab4ee534, + 0xc237ee51, 0x0729d82b, 0x6e50d34e, 0xd5dbcee1, 0xbca2c584, + 0xa5b30d41, 0xccca0624, 0x77411b8b, 0x1e3810ee, 0xdb262694, + 0xb25f2df1, 0x09d4305e, 0x60ad3b3b, 0x58995aeb, 0x31e0518e, + 0x8a6b4c21, 0xe3124744, 0x260c713e, 0x4f757a5b, 0xf4fe67f4, + 0x9d876c91, 0xc6ddf67e, 0xafa4fd1b, 0x142fe0b4, 0x7d56ebd1, + 0xb848ddab, 0xd131d6ce, 0x6abacb61, 0x03c3c004, 0x3bf7a1d4, + 0x528eaab1, 0xe905b71e, 0x807cbc7b, 0x45628a01, 0x2c1b8164, + 0x97909ccb, 0xfee997ae, 0xe7f85f6b, 0x8e81540e, 0x350a49a1, + 0x5c7342c4, 0x996d74be, 0xf0147fdb, 0x4b9f6274, 0x22e66911, + 0x1ad208c1, 0x73ab03a4, 0xc8201e0b, 0xa159156e, 0x64472314, + 0x0d3e2871, 0xb6b535de, 0xdfcc3ebb, 0xd25c4ee9, 0xbb25458c, + 0x00ae5823, 0x69d75346, 0xacc9653c, 0xc5b06e59, 0x7e3b73f6, + 0x17427893, 0x2f761943, 0x460f1226, 0xfd840f89, 0x94fd04ec, + 0x51e33296, 0x389a39f3, 0x8311245c, 0xea682f39, 0xf379e7fc, + 0x9a00ec99, 0x218bf136, 0x48f2fa53, 0x8deccc29, 0xe495c74c, + 0x5f1edae3, 0x3667d186, 0x0e53b056, 0x672abb33, 0xdca1a69c, + 0xb5d8adf9, 0x70c69b83, 0x19bf90e6, 0xa2348d49, 0xcb4d862c, + 0x90171cc3, 0xf96e17a6, 0x42e50a09, 0x2b9c016c, 0xee823716, + 0x87fb3c73, 0x3c7021dc, 0x55092ab9, 0x6d3d4b69, 0x0444400c, + 0xbfcf5da3, 0xd6b656c6, 0x13a860bc, 0x7ad16bd9, 0xc15a7676, + 0xa8237d13, 0xb132b5d6, 0xd84bbeb3, 0x63c0a31c, 0x0ab9a879, + 0xcfa79e03, 0xa6de9566, 0x1d5588c9, 0x742c83ac, 0x4c18e27c, + 0x2561e919, 0x9eeaf4b6, 0xf793ffd3, 0x328dc9a9, 0x5bf4c2cc, + 0xe07fdf63, 0x8906d406, 0x56caeabd, 0x3fb3e1d8, 0x8438fc77, + 0xed41f712, 0x285fc168, 0x4126ca0d, 0xfaadd7a2, 0x93d4dcc7, + 0xabe0bd17, 0xc299b672, 0x7912abdd, 0x106ba0b8, 0xd57596c2, + 0xbc0c9da7, 0x07878008, 0x6efe8b6d, 0x77ef43a8, 0x1e9648cd, + 0xa51d5562, 0xcc645e07, 0x097a687d, 0x60036318, 0xdb887eb7, + 0xb2f175d2, 0x8ac51402, 0xe3bc1f67, 0x583702c8, 0x314e09ad, + 0xf4503fd7, 0x9d2934b2, 0x26a2291d, 0x4fdb2278, 0x1481b897, + 0x7df8b3f2, 0xc673ae5d, 0xaf0aa538, 0x6a149342, 0x036d9827, + 0xb8e68588, 0xd19f8eed, 0xe9abef3d, 0x80d2e458, 0x3b59f9f7, + 0x5220f292, 0x973ec4e8, 0xfe47cf8d, 0x45ccd222, 0x2cb5d947, + 0x35a41182, 0x5cdd1ae7, 0xe7560748, 0x8e2f0c2d, 0x4b313a57, + 0x22483132, 0x99c32c9d, 0xf0ba27f8, 0xc88e4628, 0xa1f74d4d, + 0x1a7c50e2, 0x73055b87, 0xb61b6dfd, 0xdf626698, 0x64e97b37, + 0x0d907052}, + {0x00000000, 0x7fc99b93, 0xff933726, 0x805aacb5, 0x2457680d, + 0x5b9ef39e, 0xdbc45f2b, 0xa40dc4b8, 0x48aed01a, 0x37674b89, + 0xb73de73c, 0xc8f47caf, 0x6cf9b817, 0x13302384, 0x936a8f31, + 0xeca314a2, 0x915da034, 0xee943ba7, 0x6ece9712, 0x11070c81, + 0xb50ac839, 0xcac353aa, 0x4a99ff1f, 0x3550648c, 0xd9f3702e, + 0xa63aebbd, 0x26604708, 0x59a9dc9b, 0xfda41823, 0x826d83b0, + 0x02372f05, 0x7dfeb496, 0xf9ca4629, 0x8603ddba, 0x0659710f, + 0x7990ea9c, 0xdd9d2e24, 0xa254b5b7, 0x220e1902, 0x5dc78291, + 0xb1649633, 0xcead0da0, 0x4ef7a115, 0x313e3a86, 0x9533fe3e, + 0xeafa65ad, 0x6aa0c918, 0x1569528b, 0x6897e61d, 0x175e7d8e, + 0x9704d13b, 0xe8cd4aa8, 0x4cc08e10, 0x33091583, 0xb353b936, + 0xcc9a22a5, 0x20393607, 0x5ff0ad94, 0xdfaa0121, 0xa0639ab2, + 0x046e5e0a, 0x7ba7c599, 0xfbfd692c, 0x8434f2bf, 0x28e58a13, + 0x572c1180, 0xd776bd35, 0xa8bf26a6, 0x0cb2e21e, 0x737b798d, + 0xf321d538, 0x8ce84eab, 0x604b5a09, 0x1f82c19a, 0x9fd86d2f, + 0xe011f6bc, 0x441c3204, 0x3bd5a997, 0xbb8f0522, 0xc4469eb1, + 0xb9b82a27, 0xc671b1b4, 0x462b1d01, 0x39e28692, 0x9def422a, + 0xe226d9b9, 0x627c750c, 0x1db5ee9f, 0xf116fa3d, 0x8edf61ae, + 0x0e85cd1b, 0x714c5688, 0xd5419230, 0xaa8809a3, 0x2ad2a516, + 0x551b3e85, 0xd12fcc3a, 0xaee657a9, 0x2ebcfb1c, 0x5175608f, + 0xf578a437, 0x8ab13fa4, 0x0aeb9311, 0x75220882, 0x99811c20, + 0xe64887b3, 0x66122b06, 0x19dbb095, 0xbdd6742d, 0xc21fefbe, + 0x4245430b, 0x3d8cd898, 0x40726c0e, 0x3fbbf79d, 0xbfe15b28, + 0xc028c0bb, 0x64250403, 0x1bec9f90, 0x9bb63325, 0xe47fa8b6, + 0x08dcbc14, 0x77152787, 0xf74f8b32, 0x888610a1, 0x2c8bd419, + 0x53424f8a, 0xd318e33f, 0xacd178ac, 0x51cb1426, 0x2e028fb5, + 0xae582300, 0xd191b893, 0x759c7c2b, 0x0a55e7b8, 0x8a0f4b0d, + 0xf5c6d09e, 0x1965c43c, 0x66ac5faf, 0xe6f6f31a, 0x993f6889, + 0x3d32ac31, 0x42fb37a2, 0xc2a19b17, 0xbd680084, 0xc096b412, + 0xbf5f2f81, 0x3f058334, 0x40cc18a7, 0xe4c1dc1f, 0x9b08478c, + 0x1b52eb39, 0x649b70aa, 0x88386408, 0xf7f1ff9b, 0x77ab532e, + 0x0862c8bd, 0xac6f0c05, 0xd3a69796, 0x53fc3b23, 0x2c35a0b0, + 0xa801520f, 0xd7c8c99c, 0x57926529, 0x285bfeba, 0x8c563a02, + 0xf39fa191, 0x73c50d24, 0x0c0c96b7, 0xe0af8215, 0x9f661986, + 0x1f3cb533, 0x60f52ea0, 0xc4f8ea18, 0xbb31718b, 0x3b6bdd3e, + 0x44a246ad, 0x395cf23b, 0x469569a8, 0xc6cfc51d, 0xb9065e8e, + 0x1d0b9a36, 0x62c201a5, 0xe298ad10, 0x9d513683, 0x71f22221, + 0x0e3bb9b2, 0x8e611507, 0xf1a88e94, 0x55a54a2c, 0x2a6cd1bf, + 0xaa367d0a, 0xd5ffe699, 0x792e9e35, 0x06e705a6, 0x86bda913, + 0xf9743280, 0x5d79f638, 0x22b06dab, 0xa2eac11e, 0xdd235a8d, + 0x31804e2f, 0x4e49d5bc, 0xce137909, 0xb1dae29a, 0x15d72622, + 0x6a1ebdb1, 0xea441104, 0x958d8a97, 0xe8733e01, 0x97baa592, + 0x17e00927, 0x682992b4, 0xcc24560c, 0xb3edcd9f, 0x33b7612a, + 0x4c7efab9, 0xa0ddee1b, 0xdf147588, 0x5f4ed93d, 0x208742ae, + 0x848a8616, 0xfb431d85, 0x7b19b130, 0x04d02aa3, 0x80e4d81c, + 0xff2d438f, 0x7f77ef3a, 0x00be74a9, 0xa4b3b011, 0xdb7a2b82, + 0x5b208737, 0x24e91ca4, 0xc84a0806, 0xb7839395, 0x37d93f20, + 0x4810a4b3, 0xec1d600b, 0x93d4fb98, 0x138e572d, 0x6c47ccbe, + 0x11b97828, 0x6e70e3bb, 0xee2a4f0e, 0x91e3d49d, 0x35ee1025, + 0x4a278bb6, 0xca7d2703, 0xb5b4bc90, 0x5917a832, 0x26de33a1, + 0xa6849f14, 0xd94d0487, 0x7d40c03f, 0x02895bac, 0x82d3f719, + 0xfd1a6c8a}, + {0x00000000, 0xa396284c, 0x9c5d56d9, 0x3fcb7e95, 0xe3cbabf3, + 0x405d83bf, 0x7f96fd2a, 0xdc00d566, 0x1ce651a7, 0xbf7079eb, + 0x80bb077e, 0x232d2f32, 0xff2dfa54, 0x5cbbd218, 0x6370ac8d, + 0xc0e684c1, 0x39cca34e, 0x9a5a8b02, 0xa591f597, 0x0607dddb, + 0xda0708bd, 0x799120f1, 0x465a5e64, 0xe5cc7628, 0x252af2e9, + 0x86bcdaa5, 0xb977a430, 0x1ae18c7c, 0xc6e1591a, 0x65777156, + 0x5abc0fc3, 0xf92a278f, 0x7399469c, 0xd00f6ed0, 0xefc41045, + 0x4c523809, 0x9052ed6f, 0x33c4c523, 0x0c0fbbb6, 0xaf9993fa, + 0x6f7f173b, 0xcce93f77, 0xf32241e2, 0x50b469ae, 0x8cb4bcc8, + 0x2f229484, 0x10e9ea11, 0xb37fc25d, 0x4a55e5d2, 0xe9c3cd9e, + 0xd608b30b, 0x759e9b47, 0xa99e4e21, 0x0a08666d, 0x35c318f8, + 0x965530b4, 0x56b3b475, 0xf5259c39, 0xcaeee2ac, 0x6978cae0, + 0xb5781f86, 0x16ee37ca, 0x2925495f, 0x8ab36113, 0xe7328d38, + 0x44a4a574, 0x7b6fdbe1, 0xd8f9f3ad, 0x04f926cb, 0xa76f0e87, + 0x98a47012, 0x3b32585e, 0xfbd4dc9f, 0x5842f4d3, 0x67898a46, + 0xc41fa20a, 0x181f776c, 0xbb895f20, 0x844221b5, 0x27d409f9, + 0xdefe2e76, 0x7d68063a, 0x42a378af, 0xe13550e3, 0x3d358585, + 0x9ea3adc9, 0xa168d35c, 0x02fefb10, 0xc2187fd1, 0x618e579d, + 0x5e452908, 0xfdd30144, 0x21d3d422, 0x8245fc6e, 0xbd8e82fb, + 0x1e18aab7, 0x94abcba4, 0x373de3e8, 0x08f69d7d, 0xab60b531, + 0x77606057, 0xd4f6481b, 0xeb3d368e, 0x48ab1ec2, 0x884d9a03, + 0x2bdbb24f, 0x1410ccda, 0xb786e496, 0x6b8631f0, 0xc81019bc, + 0xf7db6729, 0x544d4f65, 0xad6768ea, 0x0ef140a6, 0x313a3e33, + 0x92ac167f, 0x4eacc319, 0xed3aeb55, 0xd2f195c0, 0x7167bd8c, + 0xb181394d, 0x12171101, 0x2ddc6f94, 0x8e4a47d8, 0x524a92be, + 0xf1dcbaf2, 0xce17c467, 0x6d81ec2b, 0x15141c31, 0xb682347d, + 0x89494ae8, 0x2adf62a4, 0xf6dfb7c2, 0x55499f8e, 0x6a82e11b, + 0xc914c957, 0x09f24d96, 0xaa6465da, 0x95af1b4f, 0x36393303, + 0xea39e665, 0x49afce29, 0x7664b0bc, 0xd5f298f0, 0x2cd8bf7f, + 0x8f4e9733, 0xb085e9a6, 0x1313c1ea, 0xcf13148c, 0x6c853cc0, + 0x534e4255, 0xf0d86a19, 0x303eeed8, 0x93a8c694, 0xac63b801, + 0x0ff5904d, 0xd3f5452b, 0x70636d67, 0x4fa813f2, 0xec3e3bbe, + 0x668d5aad, 0xc51b72e1, 0xfad00c74, 0x59462438, 0x8546f15e, + 0x26d0d912, 0x191ba787, 0xba8d8fcb, 0x7a6b0b0a, 0xd9fd2346, + 0xe6365dd3, 0x45a0759f, 0x99a0a0f9, 0x3a3688b5, 0x05fdf620, + 0xa66bde6c, 0x5f41f9e3, 0xfcd7d1af, 0xc31caf3a, 0x608a8776, + 0xbc8a5210, 0x1f1c7a5c, 0x20d704c9, 0x83412c85, 0x43a7a844, + 0xe0318008, 0xdffafe9d, 0x7c6cd6d1, 0xa06c03b7, 0x03fa2bfb, + 0x3c31556e, 0x9fa77d22, 0xf2269109, 0x51b0b945, 0x6e7bc7d0, + 0xcdedef9c, 0x11ed3afa, 0xb27b12b6, 0x8db06c23, 0x2e26446f, + 0xeec0c0ae, 0x4d56e8e2, 0x729d9677, 0xd10bbe3b, 0x0d0b6b5d, + 0xae9d4311, 0x91563d84, 0x32c015c8, 0xcbea3247, 0x687c1a0b, + 0x57b7649e, 0xf4214cd2, 0x282199b4, 0x8bb7b1f8, 0xb47ccf6d, + 0x17eae721, 0xd70c63e0, 0x749a4bac, 0x4b513539, 0xe8c71d75, + 0x34c7c813, 0x9751e05f, 0xa89a9eca, 0x0b0cb686, 0x81bfd795, + 0x2229ffd9, 0x1de2814c, 0xbe74a900, 0x62747c66, 0xc1e2542a, + 0xfe292abf, 0x5dbf02f3, 0x9d598632, 0x3ecfae7e, 0x0104d0eb, + 0xa292f8a7, 0x7e922dc1, 0xdd04058d, 0xe2cf7b18, 0x41595354, + 0xb87374db, 0x1be55c97, 0x242e2202, 0x87b80a4e, 0x5bb8df28, + 0xf82ef764, 0xc7e589f1, 0x6473a1bd, 0xa495257c, 0x07030d30, + 0x38c873a5, 0x9b5e5be9, 0x475e8e8f, 0xe4c8a6c3, 0xdb03d856, + 0x7895f01a}, + {0x00000000, 0x2a283862, 0x545070c4, 0x7e7848a6, 0xa8a0e188, + 0x8288d9ea, 0xfcf0914c, 0xd6d8a92e, 0x8a30c551, 0xa018fd33, + 0xde60b595, 0xf4488df7, 0x229024d9, 0x08b81cbb, 0x76c0541d, + 0x5ce86c7f, 0xcf108ce3, 0xe538b481, 0x9b40fc27, 0xb168c445, + 0x67b06d6b, 0x4d985509, 0x33e01daf, 0x19c825cd, 0x452049b2, + 0x6f0871d0, 0x11703976, 0x3b580114, 0xed80a83a, 0xc7a89058, + 0xb9d0d8fe, 0x93f8e09c, 0x45501f87, 0x6f7827e5, 0x11006f43, + 0x3b285721, 0xedf0fe0f, 0xc7d8c66d, 0xb9a08ecb, 0x9388b6a9, + 0xcf60dad6, 0xe548e2b4, 0x9b30aa12, 0xb1189270, 0x67c03b5e, + 0x4de8033c, 0x33904b9a, 0x19b873f8, 0x8a409364, 0xa068ab06, + 0xde10e3a0, 0xf438dbc2, 0x22e072ec, 0x08c84a8e, 0x76b00228, + 0x5c983a4a, 0x00705635, 0x2a586e57, 0x542026f1, 0x7e081e93, + 0xa8d0b7bd, 0x82f88fdf, 0xfc80c779, 0xd6a8ff1b, 0x8aa03f0e, + 0xa088076c, 0xdef04fca, 0xf4d877a8, 0x2200de86, 0x0828e6e4, + 0x7650ae42, 0x5c789620, 0x0090fa5f, 0x2ab8c23d, 0x54c08a9b, + 0x7ee8b2f9, 0xa8301bd7, 0x821823b5, 0xfc606b13, 0xd6485371, + 0x45b0b3ed, 0x6f988b8f, 0x11e0c329, 0x3bc8fb4b, 0xed105265, + 0xc7386a07, 0xb94022a1, 0x93681ac3, 0xcf8076bc, 0xe5a84ede, + 0x9bd00678, 0xb1f83e1a, 0x67209734, 0x4d08af56, 0x3370e7f0, + 0x1958df92, 0xcff02089, 0xe5d818eb, 0x9ba0504d, 0xb188682f, + 0x6750c101, 0x4d78f963, 0x3300b1c5, 0x192889a7, 0x45c0e5d8, + 0x6fe8ddba, 0x1190951c, 0x3bb8ad7e, 0xed600450, 0xc7483c32, + 0xb9307494, 0x93184cf6, 0x00e0ac6a, 0x2ac89408, 0x54b0dcae, + 0x7e98e4cc, 0xa8404de2, 0x82687580, 0xfc103d26, 0xd6380544, + 0x8ad0693b, 0xa0f85159, 0xde8019ff, 0xf4a8219d, 0x227088b3, + 0x0858b0d1, 0x7620f877, 0x5c08c015, 0xce31785d, 0xe419403f, + 0x9a610899, 0xb04930fb, 0x669199d5, 0x4cb9a1b7, 0x32c1e911, + 0x18e9d173, 0x4401bd0c, 0x6e29856e, 0x1051cdc8, 0x3a79f5aa, + 0xeca15c84, 0xc68964e6, 0xb8f12c40, 0x92d91422, 0x0121f4be, + 0x2b09ccdc, 0x5571847a, 0x7f59bc18, 0xa9811536, 0x83a92d54, + 0xfdd165f2, 0xd7f95d90, 0x8b1131ef, 0xa139098d, 0xdf41412b, + 0xf5697949, 0x23b1d067, 0x0999e805, 0x77e1a0a3, 0x5dc998c1, + 0x8b6167da, 0xa1495fb8, 0xdf31171e, 0xf5192f7c, 0x23c18652, + 0x09e9be30, 0x7791f696, 0x5db9cef4, 0x0151a28b, 0x2b799ae9, + 0x5501d24f, 0x7f29ea2d, 0xa9f14303, 0x83d97b61, 0xfda133c7, + 0xd7890ba5, 0x4471eb39, 0x6e59d35b, 0x10219bfd, 0x3a09a39f, + 0xecd10ab1, 0xc6f932d3, 0xb8817a75, 0x92a94217, 0xce412e68, + 0xe469160a, 0x9a115eac, 0xb03966ce, 0x66e1cfe0, 0x4cc9f782, + 0x32b1bf24, 0x18998746, 0x44914753, 0x6eb97f31, 0x10c13797, + 0x3ae90ff5, 0xec31a6db, 0xc6199eb9, 0xb861d61f, 0x9249ee7d, + 0xcea18202, 0xe489ba60, 0x9af1f2c6, 0xb0d9caa4, 0x6601638a, + 0x4c295be8, 0x3251134e, 0x18792b2c, 0x8b81cbb0, 0xa1a9f3d2, + 0xdfd1bb74, 0xf5f98316, 0x23212a38, 0x0909125a, 0x77715afc, + 0x5d59629e, 0x01b10ee1, 0x2b993683, 0x55e17e25, 0x7fc94647, + 0xa911ef69, 0x8339d70b, 0xfd419fad, 0xd769a7cf, 0x01c158d4, + 0x2be960b6, 0x55912810, 0x7fb91072, 0xa961b95c, 0x8349813e, + 0xfd31c998, 0xd719f1fa, 0x8bf19d85, 0xa1d9a5e7, 0xdfa1ed41, + 0xf589d523, 0x23517c0d, 0x0979446f, 0x77010cc9, 0x5d2934ab, + 0xced1d437, 0xe4f9ec55, 0x9a81a4f3, 0xb0a99c91, 0x667135bf, + 0x4c590ddd, 0x3221457b, 0x18097d19, 0x44e11166, 0x6ec92904, + 0x10b161a2, 0x3a9959c0, 0xec41f0ee, 0xc669c88c, 0xb811802a, + 0x9239b848}, + {0x00000000, 0x4713f6fb, 0x8e27edf6, 0xc9341b0d, 0xc73eddad, + 0x802d2b56, 0x4919305b, 0x0e0ac6a0, 0x550cbd1b, 0x121f4be0, + 0xdb2b50ed, 0x9c38a616, 0x923260b6, 0xd521964d, 0x1c158d40, + 0x5b067bbb, 0xaa197a36, 0xed0a8ccd, 0x243e97c0, 0x632d613b, + 0x6d27a79b, 0x2a345160, 0xe3004a6d, 0xa413bc96, 0xff15c72d, + 0xb80631d6, 0x71322adb, 0x3621dc20, 0x382b1a80, 0x7f38ec7b, + 0xb60cf776, 0xf11f018d, 0x8f43f22d, 0xc85004d6, 0x01641fdb, + 0x4677e920, 0x487d2f80, 0x0f6ed97b, 0xc65ac276, 0x8149348d, + 0xda4f4f36, 0x9d5cb9cd, 0x5468a2c0, 0x137b543b, 0x1d71929b, + 0x5a626460, 0x93567f6d, 0xd4458996, 0x255a881b, 0x62497ee0, + 0xab7d65ed, 0xec6e9316, 0xe26455b6, 0xa577a34d, 0x6c43b840, + 0x2b504ebb, 0x70563500, 0x3745c3fb, 0xfe71d8f6, 0xb9622e0d, + 0xb768e8ad, 0xf07b1e56, 0x394f055b, 0x7e5cf3a0, 0xc5f6e21b, + 0x82e514e0, 0x4bd10fed, 0x0cc2f916, 0x02c83fb6, 0x45dbc94d, + 0x8cefd240, 0xcbfc24bb, 0x90fa5f00, 0xd7e9a9fb, 0x1eddb2f6, + 0x59ce440d, 0x57c482ad, 0x10d77456, 0xd9e36f5b, 0x9ef099a0, + 0x6fef982d, 0x28fc6ed6, 0xe1c875db, 0xa6db8320, 0xa8d14580, + 0xefc2b37b, 0x26f6a876, 0x61e55e8d, 0x3ae32536, 0x7df0d3cd, + 0xb4c4c8c0, 0xf3d73e3b, 0xfdddf89b, 0xbace0e60, 0x73fa156d, + 0x34e9e396, 0x4ab51036, 0x0da6e6cd, 0xc492fdc0, 0x83810b3b, + 0x8d8bcd9b, 0xca983b60, 0x03ac206d, 0x44bfd696, 0x1fb9ad2d, + 0x58aa5bd6, 0x919e40db, 0xd68db620, 0xd8877080, 0x9f94867b, + 0x56a09d76, 0x11b36b8d, 0xe0ac6a00, 0xa7bf9cfb, 0x6e8b87f6, + 0x2998710d, 0x2792b7ad, 0x60814156, 0xa9b55a5b, 0xeea6aca0, + 0xb5a0d71b, 0xf2b321e0, 0x3b873aed, 0x7c94cc16, 0x729e0ab6, + 0x358dfc4d, 0xfcb9e740, 0xbbaa11bb, 0x509cc277, 0x178f348c, + 0xdebb2f81, 0x99a8d97a, 0x97a21fda, 0xd0b1e921, 0x1985f22c, + 0x5e9604d7, 0x05907f6c, 0x42838997, 0x8bb7929a, 0xcca46461, + 0xc2aea2c1, 0x85bd543a, 0x4c894f37, 0x0b9ab9cc, 0xfa85b841, + 0xbd964eba, 0x74a255b7, 0x33b1a34c, 0x3dbb65ec, 0x7aa89317, + 0xb39c881a, 0xf48f7ee1, 0xaf89055a, 0xe89af3a1, 0x21aee8ac, + 0x66bd1e57, 0x68b7d8f7, 0x2fa42e0c, 0xe6903501, 0xa183c3fa, + 0xdfdf305a, 0x98ccc6a1, 0x51f8ddac, 0x16eb2b57, 0x18e1edf7, + 0x5ff21b0c, 0x96c60001, 0xd1d5f6fa, 0x8ad38d41, 0xcdc07bba, + 0x04f460b7, 0x43e7964c, 0x4ded50ec, 0x0afea617, 0xc3cabd1a, + 0x84d94be1, 0x75c64a6c, 0x32d5bc97, 0xfbe1a79a, 0xbcf25161, + 0xb2f897c1, 0xf5eb613a, 0x3cdf7a37, 0x7bcc8ccc, 0x20caf777, + 0x67d9018c, 0xaeed1a81, 0xe9feec7a, 0xe7f42ada, 0xa0e7dc21, + 0x69d3c72c, 0x2ec031d7, 0x956a206c, 0xd279d697, 0x1b4dcd9a, + 0x5c5e3b61, 0x5254fdc1, 0x15470b3a, 0xdc731037, 0x9b60e6cc, + 0xc0669d77, 0x87756b8c, 0x4e417081, 0x0952867a, 0x075840da, + 0x404bb621, 0x897fad2c, 0xce6c5bd7, 0x3f735a5a, 0x7860aca1, + 0xb154b7ac, 0xf6474157, 0xf84d87f7, 0xbf5e710c, 0x766a6a01, + 0x31799cfa, 0x6a7fe741, 0x2d6c11ba, 0xe4580ab7, 0xa34bfc4c, + 0xad413aec, 0xea52cc17, 0x2366d71a, 0x647521e1, 0x1a29d241, + 0x5d3a24ba, 0x940e3fb7, 0xd31dc94c, 0xdd170fec, 0x9a04f917, + 0x5330e21a, 0x142314e1, 0x4f256f5a, 0x083699a1, 0xc10282ac, + 0x86117457, 0x881bb2f7, 0xcf08440c, 0x063c5f01, 0x412fa9fa, + 0xb030a877, 0xf7235e8c, 0x3e174581, 0x7904b37a, 0x770e75da, + 0x301d8321, 0xf929982c, 0xbe3a6ed7, 0xe53c156c, 0xa22fe397, + 0x6b1bf89a, 0x2c080e61, 0x2202c8c1, 0x65113e3a, 0xac252537, + 0xeb36d3cc}, + {0x00000000, 0xa13984ee, 0x99020f9d, 0x383b8b73, 0xe975197b, + 0x484c9d95, 0x707716e6, 0xd14e9208, 0x099b34b7, 0xa8a2b059, + 0x90993b2a, 0x31a0bfc4, 0xe0ee2dcc, 0x41d7a922, 0x79ec2251, + 0xd8d5a6bf, 0x1336696e, 0xb20fed80, 0x8a3466f3, 0x2b0de21d, + 0xfa437015, 0x5b7af4fb, 0x63417f88, 0xc278fb66, 0x1aad5dd9, + 0xbb94d937, 0x83af5244, 0x2296d6aa, 0xf3d844a2, 0x52e1c04c, + 0x6ada4b3f, 0xcbe3cfd1, 0x266cd2dc, 0x87555632, 0xbf6edd41, + 0x1e5759af, 0xcf19cba7, 0x6e204f49, 0x561bc43a, 0xf72240d4, + 0x2ff7e66b, 0x8ece6285, 0xb6f5e9f6, 0x17cc6d18, 0xc682ff10, + 0x67bb7bfe, 0x5f80f08d, 0xfeb97463, 0x355abbb2, 0x94633f5c, + 0xac58b42f, 0x0d6130c1, 0xdc2fa2c9, 0x7d162627, 0x452dad54, + 0xe41429ba, 0x3cc18f05, 0x9df80beb, 0xa5c38098, 0x04fa0476, + 0xd5b4967e, 0x748d1290, 0x4cb699e3, 0xed8f1d0d, 0x4cd9a5b8, + 0xede02156, 0xd5dbaa25, 0x74e22ecb, 0xa5acbcc3, 0x0495382d, + 0x3caeb35e, 0x9d9737b0, 0x4542910f, 0xe47b15e1, 0xdc409e92, + 0x7d791a7c, 0xac378874, 0x0d0e0c9a, 0x353587e9, 0x940c0307, + 0x5fefccd6, 0xfed64838, 0xc6edc34b, 0x67d447a5, 0xb69ad5ad, + 0x17a35143, 0x2f98da30, 0x8ea15ede, 0x5674f861, 0xf74d7c8f, + 0xcf76f7fc, 0x6e4f7312, 0xbf01e11a, 0x1e3865f4, 0x2603ee87, + 0x873a6a69, 0x6ab57764, 0xcb8cf38a, 0xf3b778f9, 0x528efc17, + 0x83c06e1f, 0x22f9eaf1, 0x1ac26182, 0xbbfbe56c, 0x632e43d3, + 0xc217c73d, 0xfa2c4c4e, 0x5b15c8a0, 0x8a5b5aa8, 0x2b62de46, + 0x13595535, 0xb260d1db, 0x79831e0a, 0xd8ba9ae4, 0xe0811197, + 0x41b89579, 0x90f60771, 0x31cf839f, 0x09f408ec, 0xa8cd8c02, + 0x70182abd, 0xd121ae53, 0xe91a2520, 0x4823a1ce, 0x996d33c6, + 0x3854b728, 0x006f3c5b, 0xa156b8b5, 0x99b34b70, 0x388acf9e, + 0x00b144ed, 0xa188c003, 0x70c6520b, 0xd1ffd6e5, 0xe9c45d96, + 0x48fdd978, 0x90287fc7, 0x3111fb29, 0x092a705a, 0xa813f4b4, + 0x795d66bc, 0xd864e252, 0xe05f6921, 0x4166edcf, 0x8a85221e, + 0x2bbca6f0, 0x13872d83, 0xb2bea96d, 0x63f03b65, 0xc2c9bf8b, + 0xfaf234f8, 0x5bcbb016, 0x831e16a9, 0x22279247, 0x1a1c1934, + 0xbb259dda, 0x6a6b0fd2, 0xcb528b3c, 0xf369004f, 0x525084a1, + 0xbfdf99ac, 0x1ee61d42, 0x26dd9631, 0x87e412df, 0x56aa80d7, + 0xf7930439, 0xcfa88f4a, 0x6e910ba4, 0xb644ad1b, 0x177d29f5, + 0x2f46a286, 0x8e7f2668, 0x5f31b460, 0xfe08308e, 0xc633bbfd, + 0x670a3f13, 0xace9f0c2, 0x0dd0742c, 0x35ebff5f, 0x94d27bb1, + 0x459ce9b9, 0xe4a56d57, 0xdc9ee624, 0x7da762ca, 0xa572c475, + 0x044b409b, 0x3c70cbe8, 0x9d494f06, 0x4c07dd0e, 0xed3e59e0, + 0xd505d293, 0x743c567d, 0xd56aeec8, 0x74536a26, 0x4c68e155, + 0xed5165bb, 0x3c1ff7b3, 0x9d26735d, 0xa51df82e, 0x04247cc0, + 0xdcf1da7f, 0x7dc85e91, 0x45f3d5e2, 0xe4ca510c, 0x3584c304, + 0x94bd47ea, 0xac86cc99, 0x0dbf4877, 0xc65c87a6, 0x67650348, + 0x5f5e883b, 0xfe670cd5, 0x2f299edd, 0x8e101a33, 0xb62b9140, + 0x171215ae, 0xcfc7b311, 0x6efe37ff, 0x56c5bc8c, 0xf7fc3862, + 0x26b2aa6a, 0x878b2e84, 0xbfb0a5f7, 0x1e892119, 0xf3063c14, + 0x523fb8fa, 0x6a043389, 0xcb3db767, 0x1a73256f, 0xbb4aa181, + 0x83712af2, 0x2248ae1c, 0xfa9d08a3, 0x5ba48c4d, 0x639f073e, + 0xc2a683d0, 0x13e811d8, 0xb2d19536, 0x8aea1e45, 0x2bd39aab, + 0xe030557a, 0x4109d194, 0x79325ae7, 0xd80bde09, 0x09454c01, + 0xa87cc8ef, 0x9047439c, 0x317ec772, 0xe9ab61cd, 0x4892e523, + 0x70a96e50, 0xd190eabe, 0x00de78b6, 0xa1e7fc58, 0x99dc772b, + 0x38e5f3c5}, + {0x00000000, 0xe81790a1, 0x0b5e2703, 0xe349b7a2, 0x16bc4e06, + 0xfeabdea7, 0x1de26905, 0xf5f5f9a4, 0x2d789c0c, 0xc56f0cad, + 0x2626bb0f, 0xce312bae, 0x3bc4d20a, 0xd3d342ab, 0x309af509, + 0xd88d65a8, 0x5af13818, 0xb2e6a8b9, 0x51af1f1b, 0xb9b88fba, + 0x4c4d761e, 0xa45ae6bf, 0x4713511d, 0xaf04c1bc, 0x7789a414, + 0x9f9e34b5, 0x7cd78317, 0x94c013b6, 0x6135ea12, 0x89227ab3, + 0x6a6bcd11, 0x827c5db0, 0xb5e27030, 0x5df5e091, 0xbebc5733, + 0x56abc792, 0xa35e3e36, 0x4b49ae97, 0xa8001935, 0x40178994, + 0x989aec3c, 0x708d7c9d, 0x93c4cb3f, 0x7bd35b9e, 0x8e26a23a, + 0x6631329b, 0x85788539, 0x6d6f1598, 0xef134828, 0x0704d889, + 0xe44d6f2b, 0x0c5aff8a, 0xf9af062e, 0x11b8968f, 0xf2f1212d, + 0x1ae6b18c, 0xc26bd424, 0x2a7c4485, 0xc935f327, 0x21226386, + 0xd4d79a22, 0x3cc00a83, 0xdf89bd21, 0x379e2d80, 0xb0b5e621, + 0x58a27680, 0xbbebc122, 0x53fc5183, 0xa609a827, 0x4e1e3886, + 0xad578f24, 0x45401f85, 0x9dcd7a2d, 0x75daea8c, 0x96935d2e, + 0x7e84cd8f, 0x8b71342b, 0x6366a48a, 0x802f1328, 0x68388389, + 0xea44de39, 0x02534e98, 0xe11af93a, 0x090d699b, 0xfcf8903f, + 0x14ef009e, 0xf7a6b73c, 0x1fb1279d, 0xc73c4235, 0x2f2bd294, + 0xcc626536, 0x2475f597, 0xd1800c33, 0x39979c92, 0xdade2b30, + 0x32c9bb91, 0x05579611, 0xed4006b0, 0x0e09b112, 0xe61e21b3, + 0x13ebd817, 0xfbfc48b6, 0x18b5ff14, 0xf0a26fb5, 0x282f0a1d, + 0xc0389abc, 0x23712d1e, 0xcb66bdbf, 0x3e93441b, 0xd684d4ba, + 0x35cd6318, 0xdddaf3b9, 0x5fa6ae09, 0xb7b13ea8, 0x54f8890a, + 0xbcef19ab, 0x491ae00f, 0xa10d70ae, 0x4244c70c, 0xaa5357ad, + 0x72de3205, 0x9ac9a2a4, 0x79801506, 0x919785a7, 0x64627c03, + 0x8c75eca2, 0x6f3c5b00, 0x872bcba1, 0xba1aca03, 0x520d5aa2, + 0xb144ed00, 0x59537da1, 0xaca68405, 0x44b114a4, 0xa7f8a306, + 0x4fef33a7, 0x9762560f, 0x7f75c6ae, 0x9c3c710c, 0x742be1ad, + 0x81de1809, 0x69c988a8, 0x8a803f0a, 0x6297afab, 0xe0ebf21b, + 0x08fc62ba, 0xebb5d518, 0x03a245b9, 0xf657bc1d, 0x1e402cbc, + 0xfd099b1e, 0x151e0bbf, 0xcd936e17, 0x2584feb6, 0xc6cd4914, + 0x2edad9b5, 0xdb2f2011, 0x3338b0b0, 0xd0710712, 0x386697b3, + 0x0ff8ba33, 0xe7ef2a92, 0x04a69d30, 0xecb10d91, 0x1944f435, + 0xf1536494, 0x121ad336, 0xfa0d4397, 0x2280263f, 0xca97b69e, + 0x29de013c, 0xc1c9919d, 0x343c6839, 0xdc2bf898, 0x3f624f3a, + 0xd775df9b, 0x5509822b, 0xbd1e128a, 0x5e57a528, 0xb6403589, + 0x43b5cc2d, 0xaba25c8c, 0x48ebeb2e, 0xa0fc7b8f, 0x78711e27, + 0x90668e86, 0x732f3924, 0x9b38a985, 0x6ecd5021, 0x86dac080, + 0x65937722, 0x8d84e783, 0x0aaf2c22, 0xe2b8bc83, 0x01f10b21, + 0xe9e69b80, 0x1c136224, 0xf404f285, 0x174d4527, 0xff5ad586, + 0x27d7b02e, 0xcfc0208f, 0x2c89972d, 0xc49e078c, 0x316bfe28, + 0xd97c6e89, 0x3a35d92b, 0xd222498a, 0x505e143a, 0xb849849b, + 0x5b003339, 0xb317a398, 0x46e25a3c, 0xaef5ca9d, 0x4dbc7d3f, + 0xa5abed9e, 0x7d268836, 0x95311897, 0x7678af35, 0x9e6f3f94, + 0x6b9ac630, 0x838d5691, 0x60c4e133, 0x88d37192, 0xbf4d5c12, + 0x575accb3, 0xb4137b11, 0x5c04ebb0, 0xa9f11214, 0x41e682b5, + 0xa2af3517, 0x4ab8a5b6, 0x9235c01e, 0x7a2250bf, 0x996be71d, + 0x717c77bc, 0x84898e18, 0x6c9e1eb9, 0x8fd7a91b, 0x67c039ba, + 0xe5bc640a, 0x0dabf4ab, 0xeee24309, 0x06f5d3a8, 0xf3002a0c, + 0x1b17baad, 0xf85e0d0f, 0x10499dae, 0xc8c4f806, 0x20d368a7, + 0xc39adf05, 0x2b8d4fa4, 0xde78b600, 0x366f26a1, 0xd5269103, + 0x3d3101a2}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0xa19017e800000000, 0x03275e0b00000000, + 0xa2b749e300000000, 0x064ebc1600000000, 0xa7deabfe00000000, + 0x0569e21d00000000, 0xa4f9f5f500000000, 0x0c9c782d00000000, + 0xad0c6fc500000000, 0x0fbb262600000000, 0xae2b31ce00000000, + 0x0ad2c43b00000000, 0xab42d3d300000000, 0x09f59a3000000000, + 0xa8658dd800000000, 0x1838f15a00000000, 0xb9a8e6b200000000, + 0x1b1faf5100000000, 0xba8fb8b900000000, 0x1e764d4c00000000, + 0xbfe65aa400000000, 0x1d51134700000000, 0xbcc104af00000000, + 0x14a4897700000000, 0xb5349e9f00000000, 0x1783d77c00000000, + 0xb613c09400000000, 0x12ea356100000000, 0xb37a228900000000, + 0x11cd6b6a00000000, 0xb05d7c8200000000, 0x3070e2b500000000, + 0x91e0f55d00000000, 0x3357bcbe00000000, 0x92c7ab5600000000, + 0x363e5ea300000000, 0x97ae494b00000000, 0x351900a800000000, + 0x9489174000000000, 0x3cec9a9800000000, 0x9d7c8d7000000000, + 0x3fcbc49300000000, 0x9e5bd37b00000000, 0x3aa2268e00000000, + 0x9b32316600000000, 0x3985788500000000, 0x98156f6d00000000, + 0x284813ef00000000, 0x89d8040700000000, 0x2b6f4de400000000, + 0x8aff5a0c00000000, 0x2e06aff900000000, 0x8f96b81100000000, + 0x2d21f1f200000000, 0x8cb1e61a00000000, 0x24d46bc200000000, + 0x85447c2a00000000, 0x27f335c900000000, 0x8663222100000000, + 0x229ad7d400000000, 0x830ac03c00000000, 0x21bd89df00000000, + 0x802d9e3700000000, 0x21e6b5b000000000, 0x8076a25800000000, + 0x22c1ebbb00000000, 0x8351fc5300000000, 0x27a809a600000000, + 0x86381e4e00000000, 0x248f57ad00000000, 0x851f404500000000, + 0x2d7acd9d00000000, 0x8ceada7500000000, 0x2e5d939600000000, + 0x8fcd847e00000000, 0x2b34718b00000000, 0x8aa4666300000000, + 0x28132f8000000000, 0x8983386800000000, 0x39de44ea00000000, + 0x984e530200000000, 0x3af91ae100000000, 0x9b690d0900000000, + 0x3f90f8fc00000000, 0x9e00ef1400000000, 0x3cb7a6f700000000, + 0x9d27b11f00000000, 0x35423cc700000000, 0x94d22b2f00000000, + 0x366562cc00000000, 0x97f5752400000000, 0x330c80d100000000, + 0x929c973900000000, 0x302bdeda00000000, 0x91bbc93200000000, + 0x1196570500000000, 0xb00640ed00000000, 0x12b1090e00000000, + 0xb3211ee600000000, 0x17d8eb1300000000, 0xb648fcfb00000000, + 0x14ffb51800000000, 0xb56fa2f000000000, 0x1d0a2f2800000000, + 0xbc9a38c000000000, 0x1e2d712300000000, 0xbfbd66cb00000000, + 0x1b44933e00000000, 0xbad484d600000000, 0x1863cd3500000000, + 0xb9f3dadd00000000, 0x09aea65f00000000, 0xa83eb1b700000000, + 0x0a89f85400000000, 0xab19efbc00000000, 0x0fe01a4900000000, + 0xae700da100000000, 0x0cc7444200000000, 0xad5753aa00000000, + 0x0532de7200000000, 0xa4a2c99a00000000, 0x0615807900000000, + 0xa785979100000000, 0x037c626400000000, 0xa2ec758c00000000, + 0x005b3c6f00000000, 0xa1cb2b8700000000, 0x03ca1aba00000000, + 0xa25a0d5200000000, 0x00ed44b100000000, 0xa17d535900000000, + 0x0584a6ac00000000, 0xa414b14400000000, 0x06a3f8a700000000, + 0xa733ef4f00000000, 0x0f56629700000000, 0xaec6757f00000000, + 0x0c713c9c00000000, 0xade12b7400000000, 0x0918de8100000000, + 0xa888c96900000000, 0x0a3f808a00000000, 0xabaf976200000000, + 0x1bf2ebe000000000, 0xba62fc0800000000, 0x18d5b5eb00000000, + 0xb945a20300000000, 0x1dbc57f600000000, 0xbc2c401e00000000, + 0x1e9b09fd00000000, 0xbf0b1e1500000000, 0x176e93cd00000000, + 0xb6fe842500000000, 0x1449cdc600000000, 0xb5d9da2e00000000, + 0x11202fdb00000000, 0xb0b0383300000000, 0x120771d000000000, + 0xb397663800000000, 0x33baf80f00000000, 0x922aefe700000000, + 0x309da60400000000, 0x910db1ec00000000, 0x35f4441900000000, + 0x946453f100000000, 0x36d31a1200000000, 0x97430dfa00000000, + 0x3f26802200000000, 0x9eb697ca00000000, 0x3c01de2900000000, + 0x9d91c9c100000000, 0x39683c3400000000, 0x98f82bdc00000000, + 0x3a4f623f00000000, 0x9bdf75d700000000, 0x2b82095500000000, + 0x8a121ebd00000000, 0x28a5575e00000000, 0x893540b600000000, + 0x2dccb54300000000, 0x8c5ca2ab00000000, 0x2eebeb4800000000, + 0x8f7bfca000000000, 0x271e717800000000, 0x868e669000000000, + 0x24392f7300000000, 0x85a9389b00000000, 0x2150cd6e00000000, + 0x80c0da8600000000, 0x2277936500000000, 0x83e7848d00000000, + 0x222caf0a00000000, 0x83bcb8e200000000, 0x210bf10100000000, + 0x809be6e900000000, 0x2462131c00000000, 0x85f204f400000000, + 0x27454d1700000000, 0x86d55aff00000000, 0x2eb0d72700000000, + 0x8f20c0cf00000000, 0x2d97892c00000000, 0x8c079ec400000000, + 0x28fe6b3100000000, 0x896e7cd900000000, 0x2bd9353a00000000, + 0x8a4922d200000000, 0x3a145e5000000000, 0x9b8449b800000000, + 0x3933005b00000000, 0x98a317b300000000, 0x3c5ae24600000000, + 0x9dcaf5ae00000000, 0x3f7dbc4d00000000, 0x9eedaba500000000, + 0x3688267d00000000, 0x9718319500000000, 0x35af787600000000, + 0x943f6f9e00000000, 0x30c69a6b00000000, 0x91568d8300000000, + 0x33e1c46000000000, 0x9271d38800000000, 0x125c4dbf00000000, + 0xb3cc5a5700000000, 0x117b13b400000000, 0xb0eb045c00000000, + 0x1412f1a900000000, 0xb582e64100000000, 0x1735afa200000000, + 0xb6a5b84a00000000, 0x1ec0359200000000, 0xbf50227a00000000, + 0x1de76b9900000000, 0xbc777c7100000000, 0x188e898400000000, + 0xb91e9e6c00000000, 0x1ba9d78f00000000, 0xba39c06700000000, + 0x0a64bce500000000, 0xabf4ab0d00000000, 0x0943e2ee00000000, + 0xa8d3f50600000000, 0x0c2a00f300000000, 0xadba171b00000000, + 0x0f0d5ef800000000, 0xae9d491000000000, 0x06f8c4c800000000, + 0xa768d32000000000, 0x05df9ac300000000, 0xa44f8d2b00000000, + 0x00b678de00000000, 0xa1266f3600000000, 0x039126d500000000, + 0xa201313d00000000}, + {0x0000000000000000, 0xee8439a100000000, 0x9d0f029900000000, + 0x738b3b3800000000, 0x7b1975e900000000, 0x959d4c4800000000, + 0xe616777000000000, 0x08924ed100000000, 0xb7349b0900000000, + 0x59b0a2a800000000, 0x2a3b999000000000, 0xc4bfa03100000000, + 0xcc2deee000000000, 0x22a9d74100000000, 0x5122ec7900000000, + 0xbfa6d5d800000000, 0x6e69361300000000, 0x80ed0fb200000000, + 0xf366348a00000000, 0x1de20d2b00000000, 0x157043fa00000000, + 0xfbf47a5b00000000, 0x887f416300000000, 0x66fb78c200000000, + 0xd95dad1a00000000, 0x37d994bb00000000, 0x4452af8300000000, + 0xaad6962200000000, 0xa244d8f300000000, 0x4cc0e15200000000, + 0x3f4bda6a00000000, 0xd1cfe3cb00000000, 0xdcd26c2600000000, + 0x3256558700000000, 0x41dd6ebf00000000, 0xaf59571e00000000, + 0xa7cb19cf00000000, 0x494f206e00000000, 0x3ac41b5600000000, + 0xd44022f700000000, 0x6be6f72f00000000, 0x8562ce8e00000000, + 0xf6e9f5b600000000, 0x186dcc1700000000, 0x10ff82c600000000, + 0xfe7bbb6700000000, 0x8df0805f00000000, 0x6374b9fe00000000, + 0xb2bb5a3500000000, 0x5c3f639400000000, 0x2fb458ac00000000, + 0xc130610d00000000, 0xc9a22fdc00000000, 0x2726167d00000000, + 0x54ad2d4500000000, 0xba2914e400000000, 0x058fc13c00000000, + 0xeb0bf89d00000000, 0x9880c3a500000000, 0x7604fa0400000000, + 0x7e96b4d500000000, 0x90128d7400000000, 0xe399b64c00000000, + 0x0d1d8fed00000000, 0xb8a5d94c00000000, 0x5621e0ed00000000, + 0x25aadbd500000000, 0xcb2ee27400000000, 0xc3bcaca500000000, + 0x2d38950400000000, 0x5eb3ae3c00000000, 0xb037979d00000000, + 0x0f91424500000000, 0xe1157be400000000, 0x929e40dc00000000, + 0x7c1a797d00000000, 0x748837ac00000000, 0x9a0c0e0d00000000, + 0xe987353500000000, 0x07030c9400000000, 0xd6ccef5f00000000, + 0x3848d6fe00000000, 0x4bc3edc600000000, 0xa547d46700000000, + 0xadd59ab600000000, 0x4351a31700000000, 0x30da982f00000000, + 0xde5ea18e00000000, 0x61f8745600000000, 0x8f7c4df700000000, + 0xfcf776cf00000000, 0x12734f6e00000000, 0x1ae101bf00000000, + 0xf465381e00000000, 0x87ee032600000000, 0x696a3a8700000000, + 0x6477b56a00000000, 0x8af38ccb00000000, 0xf978b7f300000000, + 0x17fc8e5200000000, 0x1f6ec08300000000, 0xf1eaf92200000000, + 0x8261c21a00000000, 0x6ce5fbbb00000000, 0xd3432e6300000000, + 0x3dc717c200000000, 0x4e4c2cfa00000000, 0xa0c8155b00000000, + 0xa85a5b8a00000000, 0x46de622b00000000, 0x3555591300000000, + 0xdbd160b200000000, 0x0a1e837900000000, 0xe49abad800000000, + 0x971181e000000000, 0x7995b84100000000, 0x7107f69000000000, + 0x9f83cf3100000000, 0xec08f40900000000, 0x028ccda800000000, + 0xbd2a187000000000, 0x53ae21d100000000, 0x20251ae900000000, + 0xcea1234800000000, 0xc6336d9900000000, 0x28b7543800000000, + 0x5b3c6f0000000000, 0xb5b856a100000000, 0x704bb39900000000, + 0x9ecf8a3800000000, 0xed44b10000000000, 0x03c088a100000000, + 0x0b52c67000000000, 0xe5d6ffd100000000, 0x965dc4e900000000, + 0x78d9fd4800000000, 0xc77f289000000000, 0x29fb113100000000, + 0x5a702a0900000000, 0xb4f413a800000000, 0xbc665d7900000000, + 0x52e264d800000000, 0x21695fe000000000, 0xcfed664100000000, + 0x1e22858a00000000, 0xf0a6bc2b00000000, 0x832d871300000000, + 0x6da9beb200000000, 0x653bf06300000000, 0x8bbfc9c200000000, + 0xf834f2fa00000000, 0x16b0cb5b00000000, 0xa9161e8300000000, + 0x4792272200000000, 0x34191c1a00000000, 0xda9d25bb00000000, + 0xd20f6b6a00000000, 0x3c8b52cb00000000, 0x4f0069f300000000, + 0xa184505200000000, 0xac99dfbf00000000, 0x421de61e00000000, + 0x3196dd2600000000, 0xdf12e48700000000, 0xd780aa5600000000, + 0x390493f700000000, 0x4a8fa8cf00000000, 0xa40b916e00000000, + 0x1bad44b600000000, 0xf5297d1700000000, 0x86a2462f00000000, + 0x68267f8e00000000, 0x60b4315f00000000, 0x8e3008fe00000000, + 0xfdbb33c600000000, 0x133f0a6700000000, 0xc2f0e9ac00000000, + 0x2c74d00d00000000, 0x5fffeb3500000000, 0xb17bd29400000000, + 0xb9e99c4500000000, 0x576da5e400000000, 0x24e69edc00000000, + 0xca62a77d00000000, 0x75c472a500000000, 0x9b404b0400000000, + 0xe8cb703c00000000, 0x064f499d00000000, 0x0edd074c00000000, + 0xe0593eed00000000, 0x93d205d500000000, 0x7d563c7400000000, + 0xc8ee6ad500000000, 0x266a537400000000, 0x55e1684c00000000, + 0xbb6551ed00000000, 0xb3f71f3c00000000, 0x5d73269d00000000, + 0x2ef81da500000000, 0xc07c240400000000, 0x7fdaf1dc00000000, + 0x915ec87d00000000, 0xe2d5f34500000000, 0x0c51cae400000000, + 0x04c3843500000000, 0xea47bd9400000000, 0x99cc86ac00000000, + 0x7748bf0d00000000, 0xa6875cc600000000, 0x4803656700000000, + 0x3b885e5f00000000, 0xd50c67fe00000000, 0xdd9e292f00000000, + 0x331a108e00000000, 0x40912bb600000000, 0xae15121700000000, + 0x11b3c7cf00000000, 0xff37fe6e00000000, 0x8cbcc55600000000, + 0x6238fcf700000000, 0x6aaab22600000000, 0x842e8b8700000000, + 0xf7a5b0bf00000000, 0x1921891e00000000, 0x143c06f300000000, + 0xfab83f5200000000, 0x8933046a00000000, 0x67b73dcb00000000, + 0x6f25731a00000000, 0x81a14abb00000000, 0xf22a718300000000, + 0x1cae482200000000, 0xa3089dfa00000000, 0x4d8ca45b00000000, + 0x3e079f6300000000, 0xd083a6c200000000, 0xd811e81300000000, + 0x3695d1b200000000, 0x451eea8a00000000, 0xab9ad32b00000000, + 0x7a5530e000000000, 0x94d1094100000000, 0xe75a327900000000, + 0x09de0bd800000000, 0x014c450900000000, 0xefc87ca800000000, + 0x9c43479000000000, 0x72c77e3100000000, 0xcd61abe900000000, + 0x23e5924800000000, 0x506ea97000000000, 0xbeea90d100000000, + 0xb678de0000000000, 0x58fce7a100000000, 0x2b77dc9900000000, + 0xc5f3e53800000000}, + {0x0000000000000000, 0xfbf6134700000000, 0xf6ed278e00000000, + 0x0d1b34c900000000, 0xaddd3ec700000000, 0x562b2d8000000000, + 0x5b30194900000000, 0xa0c60a0e00000000, 0x1bbd0c5500000000, + 0xe04b1f1200000000, 0xed502bdb00000000, 0x16a6389c00000000, + 0xb660329200000000, 0x4d9621d500000000, 0x408d151c00000000, + 0xbb7b065b00000000, 0x367a19aa00000000, 0xcd8c0aed00000000, + 0xc0973e2400000000, 0x3b612d6300000000, 0x9ba7276d00000000, + 0x6051342a00000000, 0x6d4a00e300000000, 0x96bc13a400000000, + 0x2dc715ff00000000, 0xd63106b800000000, 0xdb2a327100000000, + 0x20dc213600000000, 0x801a2b3800000000, 0x7bec387f00000000, + 0x76f70cb600000000, 0x8d011ff100000000, 0x2df2438f00000000, + 0xd60450c800000000, 0xdb1f640100000000, 0x20e9774600000000, + 0x802f7d4800000000, 0x7bd96e0f00000000, 0x76c25ac600000000, + 0x8d34498100000000, 0x364f4fda00000000, 0xcdb95c9d00000000, + 0xc0a2685400000000, 0x3b547b1300000000, 0x9b92711d00000000, + 0x6064625a00000000, 0x6d7f569300000000, 0x968945d400000000, + 0x1b885a2500000000, 0xe07e496200000000, 0xed657dab00000000, + 0x16936eec00000000, 0xb65564e200000000, 0x4da377a500000000, + 0x40b8436c00000000, 0xbb4e502b00000000, 0x0035567000000000, + 0xfbc3453700000000, 0xf6d871fe00000000, 0x0d2e62b900000000, + 0xade868b700000000, 0x561e7bf000000000, 0x5b054f3900000000, + 0xa0f35c7e00000000, 0x1be2f6c500000000, 0xe014e58200000000, + 0xed0fd14b00000000, 0x16f9c20c00000000, 0xb63fc80200000000, + 0x4dc9db4500000000, 0x40d2ef8c00000000, 0xbb24fccb00000000, + 0x005ffa9000000000, 0xfba9e9d700000000, 0xf6b2dd1e00000000, + 0x0d44ce5900000000, 0xad82c45700000000, 0x5674d71000000000, + 0x5b6fe3d900000000, 0xa099f09e00000000, 0x2d98ef6f00000000, + 0xd66efc2800000000, 0xdb75c8e100000000, 0x2083dba600000000, + 0x8045d1a800000000, 0x7bb3c2ef00000000, 0x76a8f62600000000, + 0x8d5ee56100000000, 0x3625e33a00000000, 0xcdd3f07d00000000, + 0xc0c8c4b400000000, 0x3b3ed7f300000000, 0x9bf8ddfd00000000, + 0x600eceba00000000, 0x6d15fa7300000000, 0x96e3e93400000000, + 0x3610b54a00000000, 0xcde6a60d00000000, 0xc0fd92c400000000, + 0x3b0b818300000000, 0x9bcd8b8d00000000, 0x603b98ca00000000, + 0x6d20ac0300000000, 0x96d6bf4400000000, 0x2dadb91f00000000, + 0xd65baa5800000000, 0xdb409e9100000000, 0x20b68dd600000000, + 0x807087d800000000, 0x7b86949f00000000, 0x769da05600000000, + 0x8d6bb31100000000, 0x006aace000000000, 0xfb9cbfa700000000, + 0xf6878b6e00000000, 0x0d71982900000000, 0xadb7922700000000, + 0x5641816000000000, 0x5b5ab5a900000000, 0xa0aca6ee00000000, + 0x1bd7a0b500000000, 0xe021b3f200000000, 0xed3a873b00000000, + 0x16cc947c00000000, 0xb60a9e7200000000, 0x4dfc8d3500000000, + 0x40e7b9fc00000000, 0xbb11aabb00000000, 0x77c29c5000000000, + 0x8c348f1700000000, 0x812fbbde00000000, 0x7ad9a89900000000, + 0xda1fa29700000000, 0x21e9b1d000000000, 0x2cf2851900000000, + 0xd704965e00000000, 0x6c7f900500000000, 0x9789834200000000, + 0x9a92b78b00000000, 0x6164a4cc00000000, 0xc1a2aec200000000, + 0x3a54bd8500000000, 0x374f894c00000000, 0xccb99a0b00000000, + 0x41b885fa00000000, 0xba4e96bd00000000, 0xb755a27400000000, + 0x4ca3b13300000000, 0xec65bb3d00000000, 0x1793a87a00000000, + 0x1a889cb300000000, 0xe17e8ff400000000, 0x5a0589af00000000, + 0xa1f39ae800000000, 0xace8ae2100000000, 0x571ebd6600000000, + 0xf7d8b76800000000, 0x0c2ea42f00000000, 0x013590e600000000, + 0xfac383a100000000, 0x5a30dfdf00000000, 0xa1c6cc9800000000, + 0xacddf85100000000, 0x572beb1600000000, 0xf7ede11800000000, + 0x0c1bf25f00000000, 0x0100c69600000000, 0xfaf6d5d100000000, + 0x418dd38a00000000, 0xba7bc0cd00000000, 0xb760f40400000000, + 0x4c96e74300000000, 0xec50ed4d00000000, 0x17a6fe0a00000000, + 0x1abdcac300000000, 0xe14bd98400000000, 0x6c4ac67500000000, + 0x97bcd53200000000, 0x9aa7e1fb00000000, 0x6151f2bc00000000, + 0xc197f8b200000000, 0x3a61ebf500000000, 0x377adf3c00000000, + 0xcc8ccc7b00000000, 0x77f7ca2000000000, 0x8c01d96700000000, + 0x811aedae00000000, 0x7aecfee900000000, 0xda2af4e700000000, + 0x21dce7a000000000, 0x2cc7d36900000000, 0xd731c02e00000000, + 0x6c206a9500000000, 0x97d679d200000000, 0x9acd4d1b00000000, + 0x613b5e5c00000000, 0xc1fd545200000000, 0x3a0b471500000000, + 0x371073dc00000000, 0xcce6609b00000000, 0x779d66c000000000, + 0x8c6b758700000000, 0x8170414e00000000, 0x7a86520900000000, + 0xda40580700000000, 0x21b64b4000000000, 0x2cad7f8900000000, + 0xd75b6cce00000000, 0x5a5a733f00000000, 0xa1ac607800000000, + 0xacb754b100000000, 0x574147f600000000, 0xf7874df800000000, + 0x0c715ebf00000000, 0x016a6a7600000000, 0xfa9c793100000000, + 0x41e77f6a00000000, 0xba116c2d00000000, 0xb70a58e400000000, + 0x4cfc4ba300000000, 0xec3a41ad00000000, 0x17cc52ea00000000, + 0x1ad7662300000000, 0xe121756400000000, 0x41d2291a00000000, + 0xba243a5d00000000, 0xb73f0e9400000000, 0x4cc91dd300000000, + 0xec0f17dd00000000, 0x17f9049a00000000, 0x1ae2305300000000, + 0xe114231400000000, 0x5a6f254f00000000, 0xa199360800000000, + 0xac8202c100000000, 0x5774118600000000, 0xf7b21b8800000000, + 0x0c4408cf00000000, 0x015f3c0600000000, 0xfaa92f4100000000, + 0x77a830b000000000, 0x8c5e23f700000000, 0x8145173e00000000, + 0x7ab3047900000000, 0xda750e7700000000, 0x21831d3000000000, + 0x2c9829f900000000, 0xd76e3abe00000000, 0x6c153ce500000000, + 0x97e32fa200000000, 0x9af81b6b00000000, 0x610e082c00000000, + 0xc1c8022200000000, 0x3a3e116500000000, 0x372525ac00000000, + 0xccd336eb00000000}, + {0x0000000000000000, 0x6238282a00000000, 0xc470505400000000, + 0xa648787e00000000, 0x88e1a0a800000000, 0xead9888200000000, + 0x4c91f0fc00000000, 0x2ea9d8d600000000, 0x51c5308a00000000, + 0x33fd18a000000000, 0x95b560de00000000, 0xf78d48f400000000, + 0xd924902200000000, 0xbb1cb80800000000, 0x1d54c07600000000, + 0x7f6ce85c00000000, 0xe38c10cf00000000, 0x81b438e500000000, + 0x27fc409b00000000, 0x45c468b100000000, 0x6b6db06700000000, + 0x0955984d00000000, 0xaf1de03300000000, 0xcd25c81900000000, + 0xb249204500000000, 0xd071086f00000000, 0x7639701100000000, + 0x1401583b00000000, 0x3aa880ed00000000, 0x5890a8c700000000, + 0xfed8d0b900000000, 0x9ce0f89300000000, 0x871f504500000000, + 0xe527786f00000000, 0x436f001100000000, 0x2157283b00000000, + 0x0ffef0ed00000000, 0x6dc6d8c700000000, 0xcb8ea0b900000000, + 0xa9b6889300000000, 0xd6da60cf00000000, 0xb4e248e500000000, + 0x12aa309b00000000, 0x709218b100000000, 0x5e3bc06700000000, + 0x3c03e84d00000000, 0x9a4b903300000000, 0xf873b81900000000, + 0x6493408a00000000, 0x06ab68a000000000, 0xa0e310de00000000, + 0xc2db38f400000000, 0xec72e02200000000, 0x8e4ac80800000000, + 0x2802b07600000000, 0x4a3a985c00000000, 0x3556700000000000, + 0x576e582a00000000, 0xf126205400000000, 0x931e087e00000000, + 0xbdb7d0a800000000, 0xdf8ff88200000000, 0x79c780fc00000000, + 0x1bffa8d600000000, 0x0e3fa08a00000000, 0x6c0788a000000000, + 0xca4ff0de00000000, 0xa877d8f400000000, 0x86de002200000000, + 0xe4e6280800000000, 0x42ae507600000000, 0x2096785c00000000, + 0x5ffa900000000000, 0x3dc2b82a00000000, 0x9b8ac05400000000, + 0xf9b2e87e00000000, 0xd71b30a800000000, 0xb523188200000000, + 0x136b60fc00000000, 0x715348d600000000, 0xedb3b04500000000, + 0x8f8b986f00000000, 0x29c3e01100000000, 0x4bfbc83b00000000, + 0x655210ed00000000, 0x076a38c700000000, 0xa12240b900000000, + 0xc31a689300000000, 0xbc7680cf00000000, 0xde4ea8e500000000, + 0x7806d09b00000000, 0x1a3ef8b100000000, 0x3497206700000000, + 0x56af084d00000000, 0xf0e7703300000000, 0x92df581900000000, + 0x8920f0cf00000000, 0xeb18d8e500000000, 0x4d50a09b00000000, + 0x2f6888b100000000, 0x01c1506700000000, 0x63f9784d00000000, + 0xc5b1003300000000, 0xa789281900000000, 0xd8e5c04500000000, + 0xbadde86f00000000, 0x1c95901100000000, 0x7eadb83b00000000, + 0x500460ed00000000, 0x323c48c700000000, 0x947430b900000000, + 0xf64c189300000000, 0x6aace00000000000, 0x0894c82a00000000, + 0xaedcb05400000000, 0xcce4987e00000000, 0xe24d40a800000000, + 0x8075688200000000, 0x263d10fc00000000, 0x440538d600000000, + 0x3b69d08a00000000, 0x5951f8a000000000, 0xff1980de00000000, + 0x9d21a8f400000000, 0xb388702200000000, 0xd1b0580800000000, + 0x77f8207600000000, 0x15c0085c00000000, 0x5d7831ce00000000, + 0x3f4019e400000000, 0x9908619a00000000, 0xfb3049b000000000, + 0xd599916600000000, 0xb7a1b94c00000000, 0x11e9c13200000000, + 0x73d1e91800000000, 0x0cbd014400000000, 0x6e85296e00000000, + 0xc8cd511000000000, 0xaaf5793a00000000, 0x845ca1ec00000000, + 0xe66489c600000000, 0x402cf1b800000000, 0x2214d99200000000, + 0xbef4210100000000, 0xdccc092b00000000, 0x7a84715500000000, + 0x18bc597f00000000, 0x361581a900000000, 0x542da98300000000, + 0xf265d1fd00000000, 0x905df9d700000000, 0xef31118b00000000, + 0x8d0939a100000000, 0x2b4141df00000000, 0x497969f500000000, + 0x67d0b12300000000, 0x05e8990900000000, 0xa3a0e17700000000, + 0xc198c95d00000000, 0xda67618b00000000, 0xb85f49a100000000, + 0x1e1731df00000000, 0x7c2f19f500000000, 0x5286c12300000000, + 0x30bee90900000000, 0x96f6917700000000, 0xf4ceb95d00000000, + 0x8ba2510100000000, 0xe99a792b00000000, 0x4fd2015500000000, + 0x2dea297f00000000, 0x0343f1a900000000, 0x617bd98300000000, + 0xc733a1fd00000000, 0xa50b89d700000000, 0x39eb714400000000, + 0x5bd3596e00000000, 0xfd9b211000000000, 0x9fa3093a00000000, + 0xb10ad1ec00000000, 0xd332f9c600000000, 0x757a81b800000000, + 0x1742a99200000000, 0x682e41ce00000000, 0x0a1669e400000000, + 0xac5e119a00000000, 0xce6639b000000000, 0xe0cfe16600000000, + 0x82f7c94c00000000, 0x24bfb13200000000, 0x4687991800000000, + 0x5347914400000000, 0x317fb96e00000000, 0x9737c11000000000, + 0xf50fe93a00000000, 0xdba631ec00000000, 0xb99e19c600000000, + 0x1fd661b800000000, 0x7dee499200000000, 0x0282a1ce00000000, + 0x60ba89e400000000, 0xc6f2f19a00000000, 0xa4cad9b000000000, + 0x8a63016600000000, 0xe85b294c00000000, 0x4e13513200000000, + 0x2c2b791800000000, 0xb0cb818b00000000, 0xd2f3a9a100000000, + 0x74bbd1df00000000, 0x1683f9f500000000, 0x382a212300000000, + 0x5a12090900000000, 0xfc5a717700000000, 0x9e62595d00000000, + 0xe10eb10100000000, 0x8336992b00000000, 0x257ee15500000000, + 0x4746c97f00000000, 0x69ef11a900000000, 0x0bd7398300000000, + 0xad9f41fd00000000, 0xcfa769d700000000, 0xd458c10100000000, + 0xb660e92b00000000, 0x1028915500000000, 0x7210b97f00000000, + 0x5cb961a900000000, 0x3e81498300000000, 0x98c931fd00000000, + 0xfaf119d700000000, 0x859df18b00000000, 0xe7a5d9a100000000, + 0x41eda1df00000000, 0x23d589f500000000, 0x0d7c512300000000, + 0x6f44790900000000, 0xc90c017700000000, 0xab34295d00000000, + 0x37d4d1ce00000000, 0x55ecf9e400000000, 0xf3a4819a00000000, + 0x919ca9b000000000, 0xbf35716600000000, 0xdd0d594c00000000, + 0x7b45213200000000, 0x197d091800000000, 0x6611e14400000000, + 0x0429c96e00000000, 0xa261b11000000000, 0xc059993a00000000, + 0xeef041ec00000000, 0x8cc869c600000000, 0x2a8011b800000000, + 0x48b8399200000000}, + {0x0000000000000000, 0x4c2896a300000000, 0xd9565d9c00000000, + 0x957ecb3f00000000, 0xf3abcbe300000000, 0xbf835d4000000000, + 0x2afd967f00000000, 0x66d500dc00000000, 0xa751e61c00000000, + 0xeb7970bf00000000, 0x7e07bb8000000000, 0x322f2d2300000000, + 0x54fa2dff00000000, 0x18d2bb5c00000000, 0x8dac706300000000, + 0xc184e6c000000000, 0x4ea3cc3900000000, 0x028b5a9a00000000, + 0x97f591a500000000, 0xdbdd070600000000, 0xbd0807da00000000, + 0xf120917900000000, 0x645e5a4600000000, 0x2876cce500000000, + 0xe9f22a2500000000, 0xa5dabc8600000000, 0x30a477b900000000, + 0x7c8ce11a00000000, 0x1a59e1c600000000, 0x5671776500000000, + 0xc30fbc5a00000000, 0x8f272af900000000, 0x9c46997300000000, + 0xd06e0fd000000000, 0x4510c4ef00000000, 0x0938524c00000000, + 0x6fed529000000000, 0x23c5c43300000000, 0xb6bb0f0c00000000, + 0xfa9399af00000000, 0x3b177f6f00000000, 0x773fe9cc00000000, + 0xe24122f300000000, 0xae69b45000000000, 0xc8bcb48c00000000, + 0x8494222f00000000, 0x11eae91000000000, 0x5dc27fb300000000, + 0xd2e5554a00000000, 0x9ecdc3e900000000, 0x0bb308d600000000, + 0x479b9e7500000000, 0x214e9ea900000000, 0x6d66080a00000000, + 0xf818c33500000000, 0xb430559600000000, 0x75b4b35600000000, + 0x399c25f500000000, 0xace2eeca00000000, 0xe0ca786900000000, + 0x861f78b500000000, 0xca37ee1600000000, 0x5f49252900000000, + 0x1361b38a00000000, 0x388d32e700000000, 0x74a5a44400000000, + 0xe1db6f7b00000000, 0xadf3f9d800000000, 0xcb26f90400000000, + 0x870e6fa700000000, 0x1270a49800000000, 0x5e58323b00000000, + 0x9fdcd4fb00000000, 0xd3f4425800000000, 0x468a896700000000, + 0x0aa21fc400000000, 0x6c771f1800000000, 0x205f89bb00000000, + 0xb521428400000000, 0xf909d42700000000, 0x762efede00000000, + 0x3a06687d00000000, 0xaf78a34200000000, 0xe35035e100000000, + 0x8585353d00000000, 0xc9ada39e00000000, 0x5cd368a100000000, + 0x10fbfe0200000000, 0xd17f18c200000000, 0x9d578e6100000000, + 0x0829455e00000000, 0x4401d3fd00000000, 0x22d4d32100000000, + 0x6efc458200000000, 0xfb828ebd00000000, 0xb7aa181e00000000, + 0xa4cbab9400000000, 0xe8e33d3700000000, 0x7d9df60800000000, + 0x31b560ab00000000, 0x5760607700000000, 0x1b48f6d400000000, + 0x8e363deb00000000, 0xc21eab4800000000, 0x039a4d8800000000, + 0x4fb2db2b00000000, 0xdacc101400000000, 0x96e486b700000000, + 0xf031866b00000000, 0xbc1910c800000000, 0x2967dbf700000000, + 0x654f4d5400000000, 0xea6867ad00000000, 0xa640f10e00000000, + 0x333e3a3100000000, 0x7f16ac9200000000, 0x19c3ac4e00000000, + 0x55eb3aed00000000, 0xc095f1d200000000, 0x8cbd677100000000, + 0x4d3981b100000000, 0x0111171200000000, 0x946fdc2d00000000, + 0xd8474a8e00000000, 0xbe924a5200000000, 0xf2badcf100000000, + 0x67c417ce00000000, 0x2bec816d00000000, 0x311c141500000000, + 0x7d3482b600000000, 0xe84a498900000000, 0xa462df2a00000000, + 0xc2b7dff600000000, 0x8e9f495500000000, 0x1be1826a00000000, + 0x57c914c900000000, 0x964df20900000000, 0xda6564aa00000000, + 0x4f1baf9500000000, 0x0333393600000000, 0x65e639ea00000000, + 0x29ceaf4900000000, 0xbcb0647600000000, 0xf098f2d500000000, + 0x7fbfd82c00000000, 0x33974e8f00000000, 0xa6e985b000000000, + 0xeac1131300000000, 0x8c1413cf00000000, 0xc03c856c00000000, + 0x55424e5300000000, 0x196ad8f000000000, 0xd8ee3e3000000000, + 0x94c6a89300000000, 0x01b863ac00000000, 0x4d90f50f00000000, + 0x2b45f5d300000000, 0x676d637000000000, 0xf213a84f00000000, + 0xbe3b3eec00000000, 0xad5a8d6600000000, 0xe1721bc500000000, + 0x740cd0fa00000000, 0x3824465900000000, 0x5ef1468500000000, + 0x12d9d02600000000, 0x87a71b1900000000, 0xcb8f8dba00000000, + 0x0a0b6b7a00000000, 0x4623fdd900000000, 0xd35d36e600000000, + 0x9f75a04500000000, 0xf9a0a09900000000, 0xb588363a00000000, + 0x20f6fd0500000000, 0x6cde6ba600000000, 0xe3f9415f00000000, + 0xafd1d7fc00000000, 0x3aaf1cc300000000, 0x76878a6000000000, + 0x10528abc00000000, 0x5c7a1c1f00000000, 0xc904d72000000000, + 0x852c418300000000, 0x44a8a74300000000, 0x088031e000000000, + 0x9dfefadf00000000, 0xd1d66c7c00000000, 0xb7036ca000000000, + 0xfb2bfa0300000000, 0x6e55313c00000000, 0x227da79f00000000, + 0x099126f200000000, 0x45b9b05100000000, 0xd0c77b6e00000000, + 0x9cefedcd00000000, 0xfa3aed1100000000, 0xb6127bb200000000, + 0x236cb08d00000000, 0x6f44262e00000000, 0xaec0c0ee00000000, + 0xe2e8564d00000000, 0x77969d7200000000, 0x3bbe0bd100000000, + 0x5d6b0b0d00000000, 0x11439dae00000000, 0x843d569100000000, + 0xc815c03200000000, 0x4732eacb00000000, 0x0b1a7c6800000000, + 0x9e64b75700000000, 0xd24c21f400000000, 0xb499212800000000, + 0xf8b1b78b00000000, 0x6dcf7cb400000000, 0x21e7ea1700000000, + 0xe0630cd700000000, 0xac4b9a7400000000, 0x3935514b00000000, + 0x751dc7e800000000, 0x13c8c73400000000, 0x5fe0519700000000, + 0xca9e9aa800000000, 0x86b60c0b00000000, 0x95d7bf8100000000, + 0xd9ff292200000000, 0x4c81e21d00000000, 0x00a974be00000000, + 0x667c746200000000, 0x2a54e2c100000000, 0xbf2a29fe00000000, + 0xf302bf5d00000000, 0x3286599d00000000, 0x7eaecf3e00000000, + 0xebd0040100000000, 0xa7f892a200000000, 0xc12d927e00000000, + 0x8d0504dd00000000, 0x187bcfe200000000, 0x5453594100000000, + 0xdb7473b800000000, 0x975ce51b00000000, 0x02222e2400000000, + 0x4e0ab88700000000, 0x28dfb85b00000000, 0x64f72ef800000000, + 0xf189e5c700000000, 0xbda1736400000000, 0x7c2595a400000000, + 0x300d030700000000, 0xa573c83800000000, 0xe95b5e9b00000000, + 0x8f8e5e4700000000, 0xc3a6c8e400000000, 0x56d803db00000000, + 0x1af0957800000000}, + {0x0000000000000000, 0x939bc97f00000000, 0x263793ff00000000, + 0xb5ac5a8000000000, 0x0d68572400000000, 0x9ef39e5b00000000, + 0x2b5fc4db00000000, 0xb8c40da400000000, 0x1ad0ae4800000000, + 0x894b673700000000, 0x3ce73db700000000, 0xaf7cf4c800000000, + 0x17b8f96c00000000, 0x8423301300000000, 0x318f6a9300000000, + 0xa214a3ec00000000, 0x34a05d9100000000, 0xa73b94ee00000000, + 0x1297ce6e00000000, 0x810c071100000000, 0x39c80ab500000000, + 0xaa53c3ca00000000, 0x1fff994a00000000, 0x8c64503500000000, + 0x2e70f3d900000000, 0xbdeb3aa600000000, 0x0847602600000000, + 0x9bdca95900000000, 0x2318a4fd00000000, 0xb0836d8200000000, + 0x052f370200000000, 0x96b4fe7d00000000, 0x2946caf900000000, + 0xbadd038600000000, 0x0f71590600000000, 0x9cea907900000000, + 0x242e9ddd00000000, 0xb7b554a200000000, 0x02190e2200000000, + 0x9182c75d00000000, 0x339664b100000000, 0xa00dadce00000000, + 0x15a1f74e00000000, 0x863a3e3100000000, 0x3efe339500000000, + 0xad65faea00000000, 0x18c9a06a00000000, 0x8b52691500000000, + 0x1de6976800000000, 0x8e7d5e1700000000, 0x3bd1049700000000, + 0xa84acde800000000, 0x108ec04c00000000, 0x8315093300000000, + 0x36b953b300000000, 0xa5229acc00000000, 0x0736392000000000, + 0x94adf05f00000000, 0x2101aadf00000000, 0xb29a63a000000000, + 0x0a5e6e0400000000, 0x99c5a77b00000000, 0x2c69fdfb00000000, + 0xbff2348400000000, 0x138ae52800000000, 0x80112c5700000000, + 0x35bd76d700000000, 0xa626bfa800000000, 0x1ee2b20c00000000, + 0x8d797b7300000000, 0x38d521f300000000, 0xab4ee88c00000000, + 0x095a4b6000000000, 0x9ac1821f00000000, 0x2f6dd89f00000000, + 0xbcf611e000000000, 0x04321c4400000000, 0x97a9d53b00000000, + 0x22058fbb00000000, 0xb19e46c400000000, 0x272ab8b900000000, + 0xb4b171c600000000, 0x011d2b4600000000, 0x9286e23900000000, + 0x2a42ef9d00000000, 0xb9d926e200000000, 0x0c757c6200000000, + 0x9feeb51d00000000, 0x3dfa16f100000000, 0xae61df8e00000000, + 0x1bcd850e00000000, 0x88564c7100000000, 0x309241d500000000, + 0xa30988aa00000000, 0x16a5d22a00000000, 0x853e1b5500000000, + 0x3acc2fd100000000, 0xa957e6ae00000000, 0x1cfbbc2e00000000, + 0x8f60755100000000, 0x37a478f500000000, 0xa43fb18a00000000, + 0x1193eb0a00000000, 0x8208227500000000, 0x201c819900000000, + 0xb38748e600000000, 0x062b126600000000, 0x95b0db1900000000, + 0x2d74d6bd00000000, 0xbeef1fc200000000, 0x0b43454200000000, + 0x98d88c3d00000000, 0x0e6c724000000000, 0x9df7bb3f00000000, + 0x285be1bf00000000, 0xbbc028c000000000, 0x0304256400000000, + 0x909fec1b00000000, 0x2533b69b00000000, 0xb6a87fe400000000, + 0x14bcdc0800000000, 0x8727157700000000, 0x328b4ff700000000, + 0xa110868800000000, 0x19d48b2c00000000, 0x8a4f425300000000, + 0x3fe318d300000000, 0xac78d1ac00000000, 0x2614cb5100000000, + 0xb58f022e00000000, 0x002358ae00000000, 0x93b891d100000000, + 0x2b7c9c7500000000, 0xb8e7550a00000000, 0x0d4b0f8a00000000, + 0x9ed0c6f500000000, 0x3cc4651900000000, 0xaf5fac6600000000, + 0x1af3f6e600000000, 0x89683f9900000000, 0x31ac323d00000000, + 0xa237fb4200000000, 0x179ba1c200000000, 0x840068bd00000000, + 0x12b496c000000000, 0x812f5fbf00000000, 0x3483053f00000000, + 0xa718cc4000000000, 0x1fdcc1e400000000, 0x8c47089b00000000, + 0x39eb521b00000000, 0xaa709b6400000000, 0x0864388800000000, + 0x9bfff1f700000000, 0x2e53ab7700000000, 0xbdc8620800000000, + 0x050c6fac00000000, 0x9697a6d300000000, 0x233bfc5300000000, + 0xb0a0352c00000000, 0x0f5201a800000000, 0x9cc9c8d700000000, + 0x2965925700000000, 0xbafe5b2800000000, 0x023a568c00000000, + 0x91a19ff300000000, 0x240dc57300000000, 0xb7960c0c00000000, + 0x1582afe000000000, 0x8619669f00000000, 0x33b53c1f00000000, + 0xa02ef56000000000, 0x18eaf8c400000000, 0x8b7131bb00000000, + 0x3edd6b3b00000000, 0xad46a24400000000, 0x3bf25c3900000000, + 0xa869954600000000, 0x1dc5cfc600000000, 0x8e5e06b900000000, + 0x369a0b1d00000000, 0xa501c26200000000, 0x10ad98e200000000, + 0x8336519d00000000, 0x2122f27100000000, 0xb2b93b0e00000000, + 0x0715618e00000000, 0x948ea8f100000000, 0x2c4aa55500000000, + 0xbfd16c2a00000000, 0x0a7d36aa00000000, 0x99e6ffd500000000, + 0x359e2e7900000000, 0xa605e70600000000, 0x13a9bd8600000000, + 0x803274f900000000, 0x38f6795d00000000, 0xab6db02200000000, + 0x1ec1eaa200000000, 0x8d5a23dd00000000, 0x2f4e803100000000, + 0xbcd5494e00000000, 0x097913ce00000000, 0x9ae2dab100000000, + 0x2226d71500000000, 0xb1bd1e6a00000000, 0x041144ea00000000, + 0x978a8d9500000000, 0x013e73e800000000, 0x92a5ba9700000000, + 0x2709e01700000000, 0xb492296800000000, 0x0c5624cc00000000, + 0x9fcdedb300000000, 0x2a61b73300000000, 0xb9fa7e4c00000000, + 0x1beedda000000000, 0x887514df00000000, 0x3dd94e5f00000000, + 0xae42872000000000, 0x16868a8400000000, 0x851d43fb00000000, + 0x30b1197b00000000, 0xa32ad00400000000, 0x1cd8e48000000000, + 0x8f432dff00000000, 0x3aef777f00000000, 0xa974be0000000000, + 0x11b0b3a400000000, 0x822b7adb00000000, 0x3787205b00000000, + 0xa41ce92400000000, 0x06084ac800000000, 0x959383b700000000, + 0x203fd93700000000, 0xb3a4104800000000, 0x0b601dec00000000, + 0x98fbd49300000000, 0x2d578e1300000000, 0xbecc476c00000000, + 0x2878b91100000000, 0xbbe3706e00000000, 0x0e4f2aee00000000, + 0x9dd4e39100000000, 0x2510ee3500000000, 0xb68b274a00000000, + 0x03277dca00000000, 0x90bcb4b500000000, 0x32a8175900000000, + 0xa133de2600000000, 0x149f84a600000000, 0x87044dd900000000, + 0x3fc0407d00000000, 0xac5b890200000000, 0x19f7d38200000000, + 0x8a6c1afd00000000}, + {0x0000000000000000, 0x650b796900000000, 0xca16f2d200000000, + 0xaf1d8bbb00000000, 0xd52b957e00000000, 0xb020ec1700000000, + 0x1f3d67ac00000000, 0x7a361ec500000000, 0xaa572afd00000000, + 0xcf5c539400000000, 0x6041d82f00000000, 0x054aa14600000000, + 0x7f7cbf8300000000, 0x1a77c6ea00000000, 0xb56a4d5100000000, + 0xd061343800000000, 0x15a9252100000000, 0x70a25c4800000000, + 0xdfbfd7f300000000, 0xbab4ae9a00000000, 0xc082b05f00000000, + 0xa589c93600000000, 0x0a94428d00000000, 0x6f9f3be400000000, + 0xbffe0fdc00000000, 0xdaf576b500000000, 0x75e8fd0e00000000, + 0x10e3846700000000, 0x6ad59aa200000000, 0x0fdee3cb00000000, + 0xa0c3687000000000, 0xc5c8111900000000, 0x2a524b4200000000, + 0x4f59322b00000000, 0xe044b99000000000, 0x854fc0f900000000, + 0xff79de3c00000000, 0x9a72a75500000000, 0x356f2cee00000000, + 0x5064558700000000, 0x800561bf00000000, 0xe50e18d600000000, + 0x4a13936d00000000, 0x2f18ea0400000000, 0x552ef4c100000000, + 0x30258da800000000, 0x9f38061300000000, 0xfa337f7a00000000, + 0x3ffb6e6300000000, 0x5af0170a00000000, 0xf5ed9cb100000000, + 0x90e6e5d800000000, 0xead0fb1d00000000, 0x8fdb827400000000, + 0x20c609cf00000000, 0x45cd70a600000000, 0x95ac449e00000000, + 0xf0a73df700000000, 0x5fbab64c00000000, 0x3ab1cf2500000000, + 0x4087d1e000000000, 0x258ca88900000000, 0x8a91233200000000, + 0xef9a5a5b00000000, 0x54a4968400000000, 0x31afefed00000000, + 0x9eb2645600000000, 0xfbb91d3f00000000, 0x818f03fa00000000, + 0xe4847a9300000000, 0x4b99f12800000000, 0x2e92884100000000, + 0xfef3bc7900000000, 0x9bf8c51000000000, 0x34e54eab00000000, + 0x51ee37c200000000, 0x2bd8290700000000, 0x4ed3506e00000000, + 0xe1cedbd500000000, 0x84c5a2bc00000000, 0x410db3a500000000, + 0x2406cacc00000000, 0x8b1b417700000000, 0xee10381e00000000, + 0x942626db00000000, 0xf12d5fb200000000, 0x5e30d40900000000, + 0x3b3bad6000000000, 0xeb5a995800000000, 0x8e51e03100000000, + 0x214c6b8a00000000, 0x444712e300000000, 0x3e710c2600000000, + 0x5b7a754f00000000, 0xf467fef400000000, 0x916c879d00000000, + 0x7ef6ddc600000000, 0x1bfda4af00000000, 0xb4e02f1400000000, + 0xd1eb567d00000000, 0xabdd48b800000000, 0xced631d100000000, + 0x61cbba6a00000000, 0x04c0c30300000000, 0xd4a1f73b00000000, + 0xb1aa8e5200000000, 0x1eb705e900000000, 0x7bbc7c8000000000, + 0x018a624500000000, 0x64811b2c00000000, 0xcb9c909700000000, + 0xae97e9fe00000000, 0x6b5ff8e700000000, 0x0e54818e00000000, + 0xa1490a3500000000, 0xc442735c00000000, 0xbe746d9900000000, + 0xdb7f14f000000000, 0x74629f4b00000000, 0x1169e62200000000, + 0xc108d21a00000000, 0xa403ab7300000000, 0x0b1e20c800000000, + 0x6e1559a100000000, 0x1423476400000000, 0x71283e0d00000000, + 0xde35b5b600000000, 0xbb3eccdf00000000, 0xe94e5cd200000000, + 0x8c4525bb00000000, 0x2358ae0000000000, 0x4653d76900000000, + 0x3c65c9ac00000000, 0x596eb0c500000000, 0xf6733b7e00000000, + 0x9378421700000000, 0x4319762f00000000, 0x26120f4600000000, + 0x890f84fd00000000, 0xec04fd9400000000, 0x9632e35100000000, + 0xf3399a3800000000, 0x5c24118300000000, 0x392f68ea00000000, + 0xfce779f300000000, 0x99ec009a00000000, 0x36f18b2100000000, + 0x53faf24800000000, 0x29ccec8d00000000, 0x4cc795e400000000, + 0xe3da1e5f00000000, 0x86d1673600000000, 0x56b0530e00000000, + 0x33bb2a6700000000, 0x9ca6a1dc00000000, 0xf9add8b500000000, + 0x839bc67000000000, 0xe690bf1900000000, 0x498d34a200000000, + 0x2c864dcb00000000, 0xc31c179000000000, 0xa6176ef900000000, + 0x090ae54200000000, 0x6c019c2b00000000, 0x163782ee00000000, + 0x733cfb8700000000, 0xdc21703c00000000, 0xb92a095500000000, + 0x694b3d6d00000000, 0x0c40440400000000, 0xa35dcfbf00000000, + 0xc656b6d600000000, 0xbc60a81300000000, 0xd96bd17a00000000, + 0x76765ac100000000, 0x137d23a800000000, 0xd6b532b100000000, + 0xb3be4bd800000000, 0x1ca3c06300000000, 0x79a8b90a00000000, + 0x039ea7cf00000000, 0x6695dea600000000, 0xc988551d00000000, + 0xac832c7400000000, 0x7ce2184c00000000, 0x19e9612500000000, + 0xb6f4ea9e00000000, 0xd3ff93f700000000, 0xa9c98d3200000000, + 0xccc2f45b00000000, 0x63df7fe000000000, 0x06d4068900000000, + 0xbdeaca5600000000, 0xd8e1b33f00000000, 0x77fc388400000000, + 0x12f741ed00000000, 0x68c15f2800000000, 0x0dca264100000000, + 0xa2d7adfa00000000, 0xc7dcd49300000000, 0x17bde0ab00000000, + 0x72b699c200000000, 0xddab127900000000, 0xb8a06b1000000000, + 0xc29675d500000000, 0xa79d0cbc00000000, 0x0880870700000000, + 0x6d8bfe6e00000000, 0xa843ef7700000000, 0xcd48961e00000000, + 0x62551da500000000, 0x075e64cc00000000, 0x7d687a0900000000, + 0x1863036000000000, 0xb77e88db00000000, 0xd275f1b200000000, + 0x0214c58a00000000, 0x671fbce300000000, 0xc802375800000000, + 0xad094e3100000000, 0xd73f50f400000000, 0xb234299d00000000, + 0x1d29a22600000000, 0x7822db4f00000000, 0x97b8811400000000, + 0xf2b3f87d00000000, 0x5dae73c600000000, 0x38a50aaf00000000, + 0x4293146a00000000, 0x27986d0300000000, 0x8885e6b800000000, + 0xed8e9fd100000000, 0x3defabe900000000, 0x58e4d28000000000, + 0xf7f9593b00000000, 0x92f2205200000000, 0xe8c43e9700000000, + 0x8dcf47fe00000000, 0x22d2cc4500000000, 0x47d9b52c00000000, + 0x8211a43500000000, 0xe71add5c00000000, 0x480756e700000000, + 0x2d0c2f8e00000000, 0x573a314b00000000, 0x3231482200000000, + 0x9d2cc39900000000, 0xf827baf000000000, 0x28468ec800000000, + 0x4d4df7a100000000, 0xe2507c1a00000000, 0x875b057300000000, + 0xfd6d1bb600000000, 0x986662df00000000, 0x377be96400000000, + 0x5270900d00000000}, + {0x0000000000000000, 0xdcecb13d00000000, 0xb8d9637b00000000, + 0x6435d24600000000, 0x70b3c7f600000000, 0xac5f76cb00000000, + 0xc86aa48d00000000, 0x148615b000000000, 0xa160fe3600000000, + 0x7d8c4f0b00000000, 0x19b99d4d00000000, 0xc5552c7000000000, + 0xd1d339c000000000, 0x0d3f88fd00000000, 0x690a5abb00000000, + 0xb5e6eb8600000000, 0x42c1fc6d00000000, 0x9e2d4d5000000000, + 0xfa189f1600000000, 0x26f42e2b00000000, 0x32723b9b00000000, + 0xee9e8aa600000000, 0x8aab58e000000000, 0x5647e9dd00000000, + 0xe3a1025b00000000, 0x3f4db36600000000, 0x5b78612000000000, + 0x8794d01d00000000, 0x9312c5ad00000000, 0x4ffe749000000000, + 0x2bcba6d600000000, 0xf72717eb00000000, 0x8482f9db00000000, + 0x586e48e600000000, 0x3c5b9aa000000000, 0xe0b72b9d00000000, + 0xf4313e2d00000000, 0x28dd8f1000000000, 0x4ce85d5600000000, + 0x9004ec6b00000000, 0x25e207ed00000000, 0xf90eb6d000000000, + 0x9d3b649600000000, 0x41d7d5ab00000000, 0x5551c01b00000000, + 0x89bd712600000000, 0xed88a36000000000, 0x3164125d00000000, + 0xc64305b600000000, 0x1aafb48b00000000, 0x7e9a66cd00000000, + 0xa276d7f000000000, 0xb6f0c24000000000, 0x6a1c737d00000000, + 0x0e29a13b00000000, 0xd2c5100600000000, 0x6723fb8000000000, + 0xbbcf4abd00000000, 0xdffa98fb00000000, 0x031629c600000000, + 0x17903c7600000000, 0xcb7c8d4b00000000, 0xaf495f0d00000000, + 0x73a5ee3000000000, 0x4903826c00000000, 0x95ef335100000000, + 0xf1dae11700000000, 0x2d36502a00000000, 0x39b0459a00000000, + 0xe55cf4a700000000, 0x816926e100000000, 0x5d8597dc00000000, + 0xe8637c5a00000000, 0x348fcd6700000000, 0x50ba1f2100000000, + 0x8c56ae1c00000000, 0x98d0bbac00000000, 0x443c0a9100000000, + 0x2009d8d700000000, 0xfce569ea00000000, 0x0bc27e0100000000, + 0xd72ecf3c00000000, 0xb31b1d7a00000000, 0x6ff7ac4700000000, + 0x7b71b9f700000000, 0xa79d08ca00000000, 0xc3a8da8c00000000, + 0x1f446bb100000000, 0xaaa2803700000000, 0x764e310a00000000, + 0x127be34c00000000, 0xce97527100000000, 0xda1147c100000000, + 0x06fdf6fc00000000, 0x62c824ba00000000, 0xbe24958700000000, + 0xcd817bb700000000, 0x116dca8a00000000, 0x755818cc00000000, + 0xa9b4a9f100000000, 0xbd32bc4100000000, 0x61de0d7c00000000, + 0x05ebdf3a00000000, 0xd9076e0700000000, 0x6ce1858100000000, + 0xb00d34bc00000000, 0xd438e6fa00000000, 0x08d457c700000000, + 0x1c52427700000000, 0xc0bef34a00000000, 0xa48b210c00000000, + 0x7867903100000000, 0x8f4087da00000000, 0x53ac36e700000000, + 0x3799e4a100000000, 0xeb75559c00000000, 0xfff3402c00000000, + 0x231ff11100000000, 0x472a235700000000, 0x9bc6926a00000000, + 0x2e2079ec00000000, 0xf2ccc8d100000000, 0x96f91a9700000000, + 0x4a15abaa00000000, 0x5e93be1a00000000, 0x827f0f2700000000, + 0xe64add6100000000, 0x3aa66c5c00000000, 0x920604d900000000, + 0x4eeab5e400000000, 0x2adf67a200000000, 0xf633d69f00000000, + 0xe2b5c32f00000000, 0x3e59721200000000, 0x5a6ca05400000000, + 0x8680116900000000, 0x3366faef00000000, 0xef8a4bd200000000, + 0x8bbf999400000000, 0x575328a900000000, 0x43d53d1900000000, + 0x9f398c2400000000, 0xfb0c5e6200000000, 0x27e0ef5f00000000, + 0xd0c7f8b400000000, 0x0c2b498900000000, 0x681e9bcf00000000, + 0xb4f22af200000000, 0xa0743f4200000000, 0x7c988e7f00000000, + 0x18ad5c3900000000, 0xc441ed0400000000, 0x71a7068200000000, + 0xad4bb7bf00000000, 0xc97e65f900000000, 0x1592d4c400000000, + 0x0114c17400000000, 0xddf8704900000000, 0xb9cda20f00000000, + 0x6521133200000000, 0x1684fd0200000000, 0xca684c3f00000000, + 0xae5d9e7900000000, 0x72b12f4400000000, 0x66373af400000000, + 0xbadb8bc900000000, 0xdeee598f00000000, 0x0202e8b200000000, + 0xb7e4033400000000, 0x6b08b20900000000, 0x0f3d604f00000000, + 0xd3d1d17200000000, 0xc757c4c200000000, 0x1bbb75ff00000000, + 0x7f8ea7b900000000, 0xa362168400000000, 0x5445016f00000000, + 0x88a9b05200000000, 0xec9c621400000000, 0x3070d32900000000, + 0x24f6c69900000000, 0xf81a77a400000000, 0x9c2fa5e200000000, + 0x40c314df00000000, 0xf525ff5900000000, 0x29c94e6400000000, + 0x4dfc9c2200000000, 0x91102d1f00000000, 0x859638af00000000, + 0x597a899200000000, 0x3d4f5bd400000000, 0xe1a3eae900000000, + 0xdb0586b500000000, 0x07e9378800000000, 0x63dce5ce00000000, + 0xbf3054f300000000, 0xabb6414300000000, 0x775af07e00000000, + 0x136f223800000000, 0xcf83930500000000, 0x7a65788300000000, + 0xa689c9be00000000, 0xc2bc1bf800000000, 0x1e50aac500000000, + 0x0ad6bf7500000000, 0xd63a0e4800000000, 0xb20fdc0e00000000, + 0x6ee36d3300000000, 0x99c47ad800000000, 0x4528cbe500000000, + 0x211d19a300000000, 0xfdf1a89e00000000, 0xe977bd2e00000000, + 0x359b0c1300000000, 0x51aede5500000000, 0x8d426f6800000000, + 0x38a484ee00000000, 0xe44835d300000000, 0x807de79500000000, + 0x5c9156a800000000, 0x4817431800000000, 0x94fbf22500000000, + 0xf0ce206300000000, 0x2c22915e00000000, 0x5f877f6e00000000, + 0x836bce5300000000, 0xe75e1c1500000000, 0x3bb2ad2800000000, + 0x2f34b89800000000, 0xf3d809a500000000, 0x97eddbe300000000, + 0x4b016ade00000000, 0xfee7815800000000, 0x220b306500000000, + 0x463ee22300000000, 0x9ad2531e00000000, 0x8e5446ae00000000, + 0x52b8f79300000000, 0x368d25d500000000, 0xea6194e800000000, + 0x1d46830300000000, 0xc1aa323e00000000, 0xa59fe07800000000, + 0x7973514500000000, 0x6df544f500000000, 0xb119f5c800000000, + 0xd52c278e00000000, 0x09c096b300000000, 0xbc267d3500000000, + 0x60cacc0800000000, 0x04ff1e4e00000000, 0xd813af7300000000, + 0xcc95bac300000000, 0x10790bfe00000000, 0x744cd9b800000000, + 0xa8a0688500000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x81256527, 0xd93bcc0f, 0x581ea928, 0x69069e5f, + 0xe823fb78, 0xb03d5250, 0x31183777, 0xd20d3cbe, 0x53285999, + 0x0b36f0b1, 0x8a139596, 0xbb0ba2e1, 0x3a2ec7c6, 0x62306eee, + 0xe3150bc9, 0x7f6b7f3d, 0xfe4e1a1a, 0xa650b332, 0x2775d615, + 0x166de162, 0x97488445, 0xcf562d6d, 0x4e73484a, 0xad664383, + 0x2c4326a4, 0x745d8f8c, 0xf578eaab, 0xc460dddc, 0x4545b8fb, + 0x1d5b11d3, 0x9c7e74f4, 0xfed6fe7a, 0x7ff39b5d, 0x27ed3275, + 0xa6c85752, 0x97d06025, 0x16f50502, 0x4eebac2a, 0xcfcec90d, + 0x2cdbc2c4, 0xadfea7e3, 0xf5e00ecb, 0x74c56bec, 0x45dd5c9b, + 0xc4f839bc, 0x9ce69094, 0x1dc3f5b3, 0x81bd8147, 0x0098e460, + 0x58864d48, 0xd9a3286f, 0xe8bb1f18, 0x699e7a3f, 0x3180d317, + 0xb0a5b630, 0x53b0bdf9, 0xd295d8de, 0x8a8b71f6, 0x0bae14d1, + 0x3ab623a6, 0xbb934681, 0xe38defa9, 0x62a88a8e, 0x26dcfab5, + 0xa7f99f92, 0xffe736ba, 0x7ec2539d, 0x4fda64ea, 0xceff01cd, + 0x96e1a8e5, 0x17c4cdc2, 0xf4d1c60b, 0x75f4a32c, 0x2dea0a04, + 0xaccf6f23, 0x9dd75854, 0x1cf23d73, 0x44ec945b, 0xc5c9f17c, + 0x59b78588, 0xd892e0af, 0x808c4987, 0x01a92ca0, 0x30b11bd7, + 0xb1947ef0, 0xe98ad7d8, 0x68afb2ff, 0x8bbab936, 0x0a9fdc11, + 0x52817539, 0xd3a4101e, 0xe2bc2769, 0x6399424e, 0x3b87eb66, + 0xbaa28e41, 0xd80a04cf, 0x592f61e8, 0x0131c8c0, 0x8014ade7, + 0xb10c9a90, 0x3029ffb7, 0x6837569f, 0xe91233b8, 0x0a073871, + 0x8b225d56, 0xd33cf47e, 0x52199159, 0x6301a62e, 0xe224c309, + 0xba3a6a21, 0x3b1f0f06, 0xa7617bf2, 0x26441ed5, 0x7e5ab7fd, + 0xff7fd2da, 0xce67e5ad, 0x4f42808a, 0x175c29a2, 0x96794c85, + 0x756c474c, 0xf449226b, 0xac578b43, 0x2d72ee64, 0x1c6ad913, + 0x9d4fbc34, 0xc551151c, 0x4474703b, 0x4db9f56a, 0xcc9c904d, + 0x94823965, 0x15a75c42, 0x24bf6b35, 0xa59a0e12, 0xfd84a73a, + 0x7ca1c21d, 0x9fb4c9d4, 0x1e91acf3, 0x468f05db, 0xc7aa60fc, + 0xf6b2578b, 0x779732ac, 0x2f899b84, 0xaeacfea3, 0x32d28a57, + 0xb3f7ef70, 0xebe94658, 0x6acc237f, 0x5bd41408, 0xdaf1712f, + 0x82efd807, 0x03cabd20, 0xe0dfb6e9, 0x61fad3ce, 0x39e47ae6, + 0xb8c11fc1, 0x89d928b6, 0x08fc4d91, 0x50e2e4b9, 0xd1c7819e, + 0xb36f0b10, 0x324a6e37, 0x6a54c71f, 0xeb71a238, 0xda69954f, + 0x5b4cf068, 0x03525940, 0x82773c67, 0x616237ae, 0xe0475289, + 0xb859fba1, 0x397c9e86, 0x0864a9f1, 0x8941ccd6, 0xd15f65fe, + 0x507a00d9, 0xcc04742d, 0x4d21110a, 0x153fb822, 0x941add05, + 0xa502ea72, 0x24278f55, 0x7c39267d, 0xfd1c435a, 0x1e094893, + 0x9f2c2db4, 0xc732849c, 0x4617e1bb, 0x770fd6cc, 0xf62ab3eb, + 0xae341ac3, 0x2f117fe4, 0x6b650fdf, 0xea406af8, 0xb25ec3d0, + 0x337ba6f7, 0x02639180, 0x8346f4a7, 0xdb585d8f, 0x5a7d38a8, + 0xb9683361, 0x384d5646, 0x6053ff6e, 0xe1769a49, 0xd06ead3e, + 0x514bc819, 0x09556131, 0x88700416, 0x140e70e2, 0x952b15c5, + 0xcd35bced, 0x4c10d9ca, 0x7d08eebd, 0xfc2d8b9a, 0xa43322b2, + 0x25164795, 0xc6034c5c, 0x4726297b, 0x1f388053, 0x9e1de574, + 0xaf05d203, 0x2e20b724, 0x763e1e0c, 0xf71b7b2b, 0x95b3f1a5, + 0x14969482, 0x4c883daa, 0xcdad588d, 0xfcb56ffa, 0x7d900add, + 0x258ea3f5, 0xa4abc6d2, 0x47becd1b, 0xc69ba83c, 0x9e850114, + 0x1fa06433, 0x2eb85344, 0xaf9d3663, 0xf7839f4b, 0x76a6fa6c, + 0xead88e98, 0x6bfdebbf, 0x33e34297, 0xb2c627b0, 0x83de10c7, + 0x02fb75e0, 0x5ae5dcc8, 0xdbc0b9ef, 0x38d5b226, 0xb9f0d701, + 0xe1ee7e29, 0x60cb1b0e, 0x51d32c79, 0xd0f6495e, 0x88e8e076, + 0x09cd8551}, + {0x00000000, 0x9b73ead4, 0xed96d3e9, 0x76e5393d, 0x005ca193, + 0x9b2f4b47, 0xedca727a, 0x76b998ae, 0x00b94326, 0x9bcaa9f2, + 0xed2f90cf, 0x765c7a1b, 0x00e5e2b5, 0x9b960861, 0xed73315c, + 0x7600db88, 0x0172864c, 0x9a016c98, 0xece455a5, 0x7797bf71, + 0x012e27df, 0x9a5dcd0b, 0xecb8f436, 0x77cb1ee2, 0x01cbc56a, + 0x9ab82fbe, 0xec5d1683, 0x772efc57, 0x019764f9, 0x9ae48e2d, + 0xec01b710, 0x77725dc4, 0x02e50c98, 0x9996e64c, 0xef73df71, + 0x740035a5, 0x02b9ad0b, 0x99ca47df, 0xef2f7ee2, 0x745c9436, + 0x025c4fbe, 0x992fa56a, 0xefca9c57, 0x74b97683, 0x0200ee2d, + 0x997304f9, 0xef963dc4, 0x74e5d710, 0x03978ad4, 0x98e46000, + 0xee01593d, 0x7572b3e9, 0x03cb2b47, 0x98b8c193, 0xee5df8ae, + 0x752e127a, 0x032ec9f2, 0x985d2326, 0xeeb81a1b, 0x75cbf0cf, + 0x03726861, 0x980182b5, 0xeee4bb88, 0x7597515c, 0x05ca1930, + 0x9eb9f3e4, 0xe85ccad9, 0x732f200d, 0x0596b8a3, 0x9ee55277, + 0xe8006b4a, 0x7373819e, 0x05735a16, 0x9e00b0c2, 0xe8e589ff, + 0x7396632b, 0x052ffb85, 0x9e5c1151, 0xe8b9286c, 0x73cac2b8, + 0x04b89f7c, 0x9fcb75a8, 0xe92e4c95, 0x725da641, 0x04e43eef, + 0x9f97d43b, 0xe972ed06, 0x720107d2, 0x0401dc5a, 0x9f72368e, + 0xe9970fb3, 0x72e4e567, 0x045d7dc9, 0x9f2e971d, 0xe9cbae20, + 0x72b844f4, 0x072f15a8, 0x9c5cff7c, 0xeab9c641, 0x71ca2c95, + 0x0773b43b, 0x9c005eef, 0xeae567d2, 0x71968d06, 0x0796568e, + 0x9ce5bc5a, 0xea008567, 0x71736fb3, 0x07caf71d, 0x9cb91dc9, + 0xea5c24f4, 0x712fce20, 0x065d93e4, 0x9d2e7930, 0xebcb400d, + 0x70b8aad9, 0x06013277, 0x9d72d8a3, 0xeb97e19e, 0x70e40b4a, + 0x06e4d0c2, 0x9d973a16, 0xeb72032b, 0x7001e9ff, 0x06b87151, + 0x9dcb9b85, 0xeb2ea2b8, 0x705d486c, 0x0b943260, 0x90e7d8b4, + 0xe602e189, 0x7d710b5d, 0x0bc893f3, 0x90bb7927, 0xe65e401a, + 0x7d2daace, 0x0b2d7146, 0x905e9b92, 0xe6bba2af, 0x7dc8487b, + 0x0b71d0d5, 0x90023a01, 0xe6e7033c, 0x7d94e9e8, 0x0ae6b42c, + 0x91955ef8, 0xe77067c5, 0x7c038d11, 0x0aba15bf, 0x91c9ff6b, + 0xe72cc656, 0x7c5f2c82, 0x0a5ff70a, 0x912c1dde, 0xe7c924e3, + 0x7cbace37, 0x0a035699, 0x9170bc4d, 0xe7958570, 0x7ce66fa4, + 0x09713ef8, 0x9202d42c, 0xe4e7ed11, 0x7f9407c5, 0x092d9f6b, + 0x925e75bf, 0xe4bb4c82, 0x7fc8a656, 0x09c87dde, 0x92bb970a, + 0xe45eae37, 0x7f2d44e3, 0x0994dc4d, 0x92e73699, 0xe4020fa4, + 0x7f71e570, 0x0803b8b4, 0x93705260, 0xe5956b5d, 0x7ee68189, + 0x085f1927, 0x932cf3f3, 0xe5c9cace, 0x7eba201a, 0x08bafb92, + 0x93c91146, 0xe52c287b, 0x7e5fc2af, 0x08e65a01, 0x9395b0d5, + 0xe57089e8, 0x7e03633c, 0x0e5e2b50, 0x952dc184, 0xe3c8f8b9, + 0x78bb126d, 0x0e028ac3, 0x95716017, 0xe394592a, 0x78e7b3fe, + 0x0ee76876, 0x959482a2, 0xe371bb9f, 0x7802514b, 0x0ebbc9e5, + 0x95c82331, 0xe32d1a0c, 0x785ef0d8, 0x0f2cad1c, 0x945f47c8, + 0xe2ba7ef5, 0x79c99421, 0x0f700c8f, 0x9403e65b, 0xe2e6df66, + 0x799535b2, 0x0f95ee3a, 0x94e604ee, 0xe2033dd3, 0x7970d707, + 0x0fc94fa9, 0x94baa57d, 0xe25f9c40, 0x792c7694, 0x0cbb27c8, + 0x97c8cd1c, 0xe12df421, 0x7a5e1ef5, 0x0ce7865b, 0x97946c8f, + 0xe17155b2, 0x7a02bf66, 0x0c0264ee, 0x97718e3a, 0xe194b707, + 0x7ae75dd3, 0x0c5ec57d, 0x972d2fa9, 0xe1c81694, 0x7abbfc40, + 0x0dc9a184, 0x96ba4b50, 0xe05f726d, 0x7b2c98b9, 0x0d950017, + 0x96e6eac3, 0xe003d3fe, 0x7b70392a, 0x0d70e2a2, 0x96030876, + 0xe0e6314b, 0x7b95db9f, 0x0d2c4331, 0x965fa9e5, 0xe0ba90d8, + 0x7bc97a0c}, + {0x00000000, 0x172864c0, 0x2e50c980, 0x3978ad40, 0x5ca19300, + 0x4b89f7c0, 0x72f15a80, 0x65d93e40, 0xb9432600, 0xae6b42c0, + 0x9713ef80, 0x803b8b40, 0xe5e2b500, 0xf2cad1c0, 0xcbb27c80, + 0xdc9a1840, 0xa9f74a41, 0xbedf2e81, 0x87a783c1, 0x908fe701, + 0xf556d941, 0xe27ebd81, 0xdb0610c1, 0xcc2e7401, 0x10b46c41, + 0x079c0881, 0x3ee4a5c1, 0x29ccc101, 0x4c15ff41, 0x5b3d9b81, + 0x624536c1, 0x756d5201, 0x889f92c3, 0x9fb7f603, 0xa6cf5b43, + 0xb1e73f83, 0xd43e01c3, 0xc3166503, 0xfa6ec843, 0xed46ac83, + 0x31dcb4c3, 0x26f4d003, 0x1f8c7d43, 0x08a41983, 0x6d7d27c3, + 0x7a554303, 0x432dee43, 0x54058a83, 0x2168d882, 0x3640bc42, + 0x0f381102, 0x181075c2, 0x7dc94b82, 0x6ae12f42, 0x53998202, + 0x44b1e6c2, 0x982bfe82, 0x8f039a42, 0xb67b3702, 0xa15353c2, + 0xc48a6d82, 0xd3a20942, 0xeadaa402, 0xfdf2c0c2, 0xca4e23c7, + 0xdd664707, 0xe41eea47, 0xf3368e87, 0x96efb0c7, 0x81c7d407, + 0xb8bf7947, 0xaf971d87, 0x730d05c7, 0x64256107, 0x5d5dcc47, + 0x4a75a887, 0x2fac96c7, 0x3884f207, 0x01fc5f47, 0x16d43b87, + 0x63b96986, 0x74910d46, 0x4de9a006, 0x5ac1c4c6, 0x3f18fa86, + 0x28309e46, 0x11483306, 0x066057c6, 0xdafa4f86, 0xcdd22b46, + 0xf4aa8606, 0xe382e2c6, 0x865bdc86, 0x9173b846, 0xa80b1506, + 0xbf2371c6, 0x42d1b104, 0x55f9d5c4, 0x6c817884, 0x7ba91c44, + 0x1e702204, 0x095846c4, 0x3020eb84, 0x27088f44, 0xfb929704, + 0xecbaf3c4, 0xd5c25e84, 0xc2ea3a44, 0xa7330404, 0xb01b60c4, + 0x8963cd84, 0x9e4ba944, 0xeb26fb45, 0xfc0e9f85, 0xc57632c5, + 0xd25e5605, 0xb7876845, 0xa0af0c85, 0x99d7a1c5, 0x8effc505, + 0x5265dd45, 0x454db985, 0x7c3514c5, 0x6b1d7005, 0x0ec44e45, + 0x19ec2a85, 0x209487c5, 0x37bce305, 0x4fed41cf, 0x58c5250f, + 0x61bd884f, 0x7695ec8f, 0x134cd2cf, 0x0464b60f, 0x3d1c1b4f, + 0x2a347f8f, 0xf6ae67cf, 0xe186030f, 0xd8feae4f, 0xcfd6ca8f, + 0xaa0ff4cf, 0xbd27900f, 0x845f3d4f, 0x9377598f, 0xe61a0b8e, + 0xf1326f4e, 0xc84ac20e, 0xdf62a6ce, 0xbabb988e, 0xad93fc4e, + 0x94eb510e, 0x83c335ce, 0x5f592d8e, 0x4871494e, 0x7109e40e, + 0x662180ce, 0x03f8be8e, 0x14d0da4e, 0x2da8770e, 0x3a8013ce, + 0xc772d30c, 0xd05ab7cc, 0xe9221a8c, 0xfe0a7e4c, 0x9bd3400c, + 0x8cfb24cc, 0xb583898c, 0xa2abed4c, 0x7e31f50c, 0x691991cc, + 0x50613c8c, 0x4749584c, 0x2290660c, 0x35b802cc, 0x0cc0af8c, + 0x1be8cb4c, 0x6e85994d, 0x79adfd8d, 0x40d550cd, 0x57fd340d, + 0x32240a4d, 0x250c6e8d, 0x1c74c3cd, 0x0b5ca70d, 0xd7c6bf4d, + 0xc0eedb8d, 0xf99676cd, 0xeebe120d, 0x8b672c4d, 0x9c4f488d, + 0xa537e5cd, 0xb21f810d, 0x85a36208, 0x928b06c8, 0xabf3ab88, + 0xbcdbcf48, 0xd902f108, 0xce2a95c8, 0xf7523888, 0xe07a5c48, + 0x3ce04408, 0x2bc820c8, 0x12b08d88, 0x0598e948, 0x6041d708, + 0x7769b3c8, 0x4e111e88, 0x59397a48, 0x2c542849, 0x3b7c4c89, + 0x0204e1c9, 0x152c8509, 0x70f5bb49, 0x67dddf89, 0x5ea572c9, + 0x498d1609, 0x95170e49, 0x823f6a89, 0xbb47c7c9, 0xac6fa309, + 0xc9b69d49, 0xde9ef989, 0xe7e654c9, 0xf0ce3009, 0x0d3cf0cb, + 0x1a14940b, 0x236c394b, 0x34445d8b, 0x519d63cb, 0x46b5070b, + 0x7fcdaa4b, 0x68e5ce8b, 0xb47fd6cb, 0xa357b20b, 0x9a2f1f4b, + 0x8d077b8b, 0xe8de45cb, 0xfff6210b, 0xc68e8c4b, 0xd1a6e88b, + 0xa4cbba8a, 0xb3e3de4a, 0x8a9b730a, 0x9db317ca, 0xf86a298a, + 0xef424d4a, 0xd63ae00a, 0xc11284ca, 0x1d889c8a, 0x0aa0f84a, + 0x33d8550a, 0x24f031ca, 0x41290f8a, 0x56016b4a, 0x6f79c60a, + 0x7851a2ca}, + {0x00000000, 0x9fda839e, 0xe4c4017d, 0x7b1e82e3, 0x12f904bb, + 0x8d238725, 0xf63d05c6, 0x69e78658, 0x25f20976, 0xba288ae8, + 0xc136080b, 0x5eec8b95, 0x370b0dcd, 0xa8d18e53, 0xd3cf0cb0, + 0x4c158f2e, 0x4be412ec, 0xd43e9172, 0xaf201391, 0x30fa900f, + 0x591d1657, 0xc6c795c9, 0xbdd9172a, 0x220394b4, 0x6e161b9a, + 0xf1cc9804, 0x8ad21ae7, 0x15089979, 0x7cef1f21, 0xe3359cbf, + 0x982b1e5c, 0x07f19dc2, 0x97c825d8, 0x0812a646, 0x730c24a5, + 0xecd6a73b, 0x85312163, 0x1aeba2fd, 0x61f5201e, 0xfe2fa380, + 0xb23a2cae, 0x2de0af30, 0x56fe2dd3, 0xc924ae4d, 0xa0c32815, + 0x3f19ab8b, 0x44072968, 0xdbddaaf6, 0xdc2c3734, 0x43f6b4aa, + 0x38e83649, 0xa732b5d7, 0xced5338f, 0x510fb011, 0x2a1132f2, + 0xb5cbb16c, 0xf9de3e42, 0x6604bddc, 0x1d1a3f3f, 0x82c0bca1, + 0xeb273af9, 0x74fdb967, 0x0fe33b84, 0x9039b81a, 0xf4e14df1, + 0x6b3bce6f, 0x10254c8c, 0x8fffcf12, 0xe618494a, 0x79c2cad4, + 0x02dc4837, 0x9d06cba9, 0xd1134487, 0x4ec9c719, 0x35d745fa, + 0xaa0dc664, 0xc3ea403c, 0x5c30c3a2, 0x272e4141, 0xb8f4c2df, + 0xbf055f1d, 0x20dfdc83, 0x5bc15e60, 0xc41bddfe, 0xadfc5ba6, + 0x3226d838, 0x49385adb, 0xd6e2d945, 0x9af7566b, 0x052dd5f5, + 0x7e335716, 0xe1e9d488, 0x880e52d0, 0x17d4d14e, 0x6cca53ad, + 0xf310d033, 0x63296829, 0xfcf3ebb7, 0x87ed6954, 0x1837eaca, + 0x71d06c92, 0xee0aef0c, 0x95146def, 0x0aceee71, 0x46db615f, + 0xd901e2c1, 0xa21f6022, 0x3dc5e3bc, 0x542265e4, 0xcbf8e67a, + 0xb0e66499, 0x2f3ce707, 0x28cd7ac5, 0xb717f95b, 0xcc097bb8, + 0x53d3f826, 0x3a347e7e, 0xa5eefde0, 0xdef07f03, 0x412afc9d, + 0x0d3f73b3, 0x92e5f02d, 0xe9fb72ce, 0x7621f150, 0x1fc67708, + 0x801cf496, 0xfb027675, 0x64d8f5eb, 0x32b39da3, 0xad691e3d, + 0xd6779cde, 0x49ad1f40, 0x204a9918, 0xbf901a86, 0xc48e9865, + 0x5b541bfb, 0x174194d5, 0x889b174b, 0xf38595a8, 0x6c5f1636, + 0x05b8906e, 0x9a6213f0, 0xe17c9113, 0x7ea6128d, 0x79578f4f, + 0xe68d0cd1, 0x9d938e32, 0x02490dac, 0x6bae8bf4, 0xf474086a, + 0x8f6a8a89, 0x10b00917, 0x5ca58639, 0xc37f05a7, 0xb8618744, + 0x27bb04da, 0x4e5c8282, 0xd186011c, 0xaa9883ff, 0x35420061, + 0xa57bb87b, 0x3aa13be5, 0x41bfb906, 0xde653a98, 0xb782bcc0, + 0x28583f5e, 0x5346bdbd, 0xcc9c3e23, 0x8089b10d, 0x1f533293, + 0x644db070, 0xfb9733ee, 0x9270b5b6, 0x0daa3628, 0x76b4b4cb, + 0xe96e3755, 0xee9faa97, 0x71452909, 0x0a5babea, 0x95812874, + 0xfc66ae2c, 0x63bc2db2, 0x18a2af51, 0x87782ccf, 0xcb6da3e1, + 0x54b7207f, 0x2fa9a29c, 0xb0732102, 0xd994a75a, 0x464e24c4, + 0x3d50a627, 0xa28a25b9, 0xc652d052, 0x598853cc, 0x2296d12f, + 0xbd4c52b1, 0xd4abd4e9, 0x4b715777, 0x306fd594, 0xafb5560a, + 0xe3a0d924, 0x7c7a5aba, 0x0764d859, 0x98be5bc7, 0xf159dd9f, + 0x6e835e01, 0x159ddce2, 0x8a475f7c, 0x8db6c2be, 0x126c4120, + 0x6972c3c3, 0xf6a8405d, 0x9f4fc605, 0x0095459b, 0x7b8bc778, + 0xe45144e6, 0xa844cbc8, 0x379e4856, 0x4c80cab5, 0xd35a492b, + 0xbabdcf73, 0x25674ced, 0x5e79ce0e, 0xc1a34d90, 0x519af58a, + 0xce407614, 0xb55ef4f7, 0x2a847769, 0x4363f131, 0xdcb972af, + 0xa7a7f04c, 0x387d73d2, 0x7468fcfc, 0xebb27f62, 0x90acfd81, + 0x0f767e1f, 0x6691f847, 0xf94b7bd9, 0x8255f93a, 0x1d8f7aa4, + 0x1a7ee766, 0x85a464f8, 0xfebae61b, 0x61606585, 0x0887e3dd, + 0x975d6043, 0xec43e2a0, 0x7399613e, 0x3f8cee10, 0xa0566d8e, + 0xdb48ef6d, 0x44926cf3, 0x2d75eaab, 0xb2af6935, 0xc9b1ebd6, + 0x566b6848}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x9e83da9f, 0x7d01c4e4, 0xe3821e7b, 0xbb04f912, + 0x2587238d, 0xc6053df6, 0x5886e769, 0x7609f225, 0xe88a28ba, + 0x0b0836c1, 0x958bec5e, 0xcd0d0b37, 0x538ed1a8, 0xb00ccfd3, + 0x2e8f154c, 0xec12e44b, 0x72913ed4, 0x911320af, 0x0f90fa30, + 0x57161d59, 0xc995c7c6, 0x2a17d9bd, 0xb4940322, 0x9a1b166e, + 0x0498ccf1, 0xe71ad28a, 0x79990815, 0x211fef7c, 0xbf9c35e3, + 0x5c1e2b98, 0xc29df107, 0xd825c897, 0x46a61208, 0xa5240c73, + 0x3ba7d6ec, 0x63213185, 0xfda2eb1a, 0x1e20f561, 0x80a32ffe, + 0xae2c3ab2, 0x30afe02d, 0xd32dfe56, 0x4dae24c9, 0x1528c3a0, + 0x8bab193f, 0x68290744, 0xf6aadddb, 0x34372cdc, 0xaab4f643, + 0x4936e838, 0xd7b532a7, 0x8f33d5ce, 0x11b00f51, 0xf232112a, + 0x6cb1cbb5, 0x423edef9, 0xdcbd0466, 0x3f3f1a1d, 0xa1bcc082, + 0xf93a27eb, 0x67b9fd74, 0x843be30f, 0x1ab83990, 0xf14de1f4, + 0x6fce3b6b, 0x8c4c2510, 0x12cfff8f, 0x4a4918e6, 0xd4cac279, + 0x3748dc02, 0xa9cb069d, 0x874413d1, 0x19c7c94e, 0xfa45d735, + 0x64c60daa, 0x3c40eac3, 0xa2c3305c, 0x41412e27, 0xdfc2f4b8, + 0x1d5f05bf, 0x83dcdf20, 0x605ec15b, 0xfedd1bc4, 0xa65bfcad, + 0x38d82632, 0xdb5a3849, 0x45d9e2d6, 0x6b56f79a, 0xf5d52d05, + 0x1657337e, 0x88d4e9e1, 0xd0520e88, 0x4ed1d417, 0xad53ca6c, + 0x33d010f3, 0x29682963, 0xb7ebf3fc, 0x5469ed87, 0xcaea3718, + 0x926cd071, 0x0cef0aee, 0xef6d1495, 0x71eece0a, 0x5f61db46, + 0xc1e201d9, 0x22601fa2, 0xbce3c53d, 0xe4652254, 0x7ae6f8cb, + 0x9964e6b0, 0x07e73c2f, 0xc57acd28, 0x5bf917b7, 0xb87b09cc, + 0x26f8d353, 0x7e7e343a, 0xe0fdeea5, 0x037ff0de, 0x9dfc2a41, + 0xb3733f0d, 0x2df0e592, 0xce72fbe9, 0x50f12176, 0x0877c61f, + 0x96f41c80, 0x757602fb, 0xebf5d864, 0xa39db332, 0x3d1e69ad, + 0xde9c77d6, 0x401fad49, 0x18994a20, 0x861a90bf, 0x65988ec4, + 0xfb1b545b, 0xd5944117, 0x4b179b88, 0xa89585f3, 0x36165f6c, + 0x6e90b805, 0xf013629a, 0x13917ce1, 0x8d12a67e, 0x4f8f5779, + 0xd10c8de6, 0x328e939d, 0xac0d4902, 0xf48bae6b, 0x6a0874f4, + 0x898a6a8f, 0x1709b010, 0x3986a55c, 0xa7057fc3, 0x448761b8, + 0xda04bb27, 0x82825c4e, 0x1c0186d1, 0xff8398aa, 0x61004235, + 0x7bb87ba5, 0xe53ba13a, 0x06b9bf41, 0x983a65de, 0xc0bc82b7, + 0x5e3f5828, 0xbdbd4653, 0x233e9ccc, 0x0db18980, 0x9332531f, + 0x70b04d64, 0xee3397fb, 0xb6b57092, 0x2836aa0d, 0xcbb4b476, + 0x55376ee9, 0x97aa9fee, 0x09294571, 0xeaab5b0a, 0x74288195, + 0x2cae66fc, 0xb22dbc63, 0x51afa218, 0xcf2c7887, 0xe1a36dcb, + 0x7f20b754, 0x9ca2a92f, 0x022173b0, 0x5aa794d9, 0xc4244e46, + 0x27a6503d, 0xb9258aa2, 0x52d052c6, 0xcc538859, 0x2fd19622, + 0xb1524cbd, 0xe9d4abd4, 0x7757714b, 0x94d56f30, 0x0a56b5af, + 0x24d9a0e3, 0xba5a7a7c, 0x59d86407, 0xc75bbe98, 0x9fdd59f1, + 0x015e836e, 0xe2dc9d15, 0x7c5f478a, 0xbec2b68d, 0x20416c12, + 0xc3c37269, 0x5d40a8f6, 0x05c64f9f, 0x9b459500, 0x78c78b7b, + 0xe64451e4, 0xc8cb44a8, 0x56489e37, 0xb5ca804c, 0x2b495ad3, + 0x73cfbdba, 0xed4c6725, 0x0ece795e, 0x904da3c1, 0x8af59a51, + 0x147640ce, 0xf7f45eb5, 0x6977842a, 0x31f16343, 0xaf72b9dc, + 0x4cf0a7a7, 0xd2737d38, 0xfcfc6874, 0x627fb2eb, 0x81fdac90, + 0x1f7e760f, 0x47f89166, 0xd97b4bf9, 0x3af95582, 0xa47a8f1d, + 0x66e77e1a, 0xf864a485, 0x1be6bafe, 0x85656061, 0xdde38708, + 0x43605d97, 0xa0e243ec, 0x3e619973, 0x10ee8c3f, 0x8e6d56a0, + 0x6def48db, 0xf36c9244, 0xabea752d, 0x3569afb2, 0xd6ebb1c9, + 0x48686b56}, + {0x00000000, 0xc0642817, 0x80c9502e, 0x40ad7839, 0x0093a15c, + 0xc0f7894b, 0x805af172, 0x403ed965, 0x002643b9, 0xc0426bae, + 0x80ef1397, 0x408b3b80, 0x00b5e2e5, 0xc0d1caf2, 0x807cb2cb, + 0x40189adc, 0x414af7a9, 0x812edfbe, 0xc183a787, 0x01e78f90, + 0x41d956f5, 0x81bd7ee2, 0xc11006db, 0x01742ecc, 0x416cb410, + 0x81089c07, 0xc1a5e43e, 0x01c1cc29, 0x41ff154c, 0x819b3d5b, + 0xc1364562, 0x01526d75, 0xc3929f88, 0x03f6b79f, 0x435bcfa6, + 0x833fe7b1, 0xc3013ed4, 0x036516c3, 0x43c86efa, 0x83ac46ed, + 0xc3b4dc31, 0x03d0f426, 0x437d8c1f, 0x8319a408, 0xc3277d6d, + 0x0343557a, 0x43ee2d43, 0x838a0554, 0x82d86821, 0x42bc4036, + 0x0211380f, 0xc2751018, 0x824bc97d, 0x422fe16a, 0x02829953, + 0xc2e6b144, 0x82fe2b98, 0x429a038f, 0x02377bb6, 0xc25353a1, + 0x826d8ac4, 0x4209a2d3, 0x02a4daea, 0xc2c0f2fd, 0xc7234eca, + 0x074766dd, 0x47ea1ee4, 0x878e36f3, 0xc7b0ef96, 0x07d4c781, + 0x4779bfb8, 0x871d97af, 0xc7050d73, 0x07612564, 0x47cc5d5d, + 0x87a8754a, 0xc796ac2f, 0x07f28438, 0x475ffc01, 0x873bd416, + 0x8669b963, 0x460d9174, 0x06a0e94d, 0xc6c4c15a, 0x86fa183f, + 0x469e3028, 0x06334811, 0xc6576006, 0x864ffada, 0x462bd2cd, + 0x0686aaf4, 0xc6e282e3, 0x86dc5b86, 0x46b87391, 0x06150ba8, + 0xc67123bf, 0x04b1d142, 0xc4d5f955, 0x8478816c, 0x441ca97b, + 0x0422701e, 0xc4465809, 0x84eb2030, 0x448f0827, 0x049792fb, + 0xc4f3baec, 0x845ec2d5, 0x443aeac2, 0x040433a7, 0xc4601bb0, + 0x84cd6389, 0x44a94b9e, 0x45fb26eb, 0x859f0efc, 0xc53276c5, + 0x05565ed2, 0x456887b7, 0x850cafa0, 0xc5a1d799, 0x05c5ff8e, + 0x45dd6552, 0x85b94d45, 0xc514357c, 0x05701d6b, 0x454ec40e, + 0x852aec19, 0xc5879420, 0x05e3bc37, 0xcf41ed4f, 0x0f25c558, + 0x4f88bd61, 0x8fec9576, 0xcfd24c13, 0x0fb66404, 0x4f1b1c3d, + 0x8f7f342a, 0xcf67aef6, 0x0f0386e1, 0x4faefed8, 0x8fcad6cf, + 0xcff40faa, 0x0f9027bd, 0x4f3d5f84, 0x8f597793, 0x8e0b1ae6, + 0x4e6f32f1, 0x0ec24ac8, 0xcea662df, 0x8e98bbba, 0x4efc93ad, + 0x0e51eb94, 0xce35c383, 0x8e2d595f, 0x4e497148, 0x0ee40971, + 0xce802166, 0x8ebef803, 0x4edad014, 0x0e77a82d, 0xce13803a, + 0x0cd372c7, 0xccb75ad0, 0x8c1a22e9, 0x4c7e0afe, 0x0c40d39b, + 0xcc24fb8c, 0x8c8983b5, 0x4cedaba2, 0x0cf5317e, 0xcc911969, + 0x8c3c6150, 0x4c584947, 0x0c669022, 0xcc02b835, 0x8cafc00c, + 0x4ccbe81b, 0x4d99856e, 0x8dfdad79, 0xcd50d540, 0x0d34fd57, + 0x4d0a2432, 0x8d6e0c25, 0xcdc3741c, 0x0da75c0b, 0x4dbfc6d7, + 0x8ddbeec0, 0xcd7696f9, 0x0d12beee, 0x4d2c678b, 0x8d484f9c, + 0xcde537a5, 0x0d811fb2, 0x0862a385, 0xc8068b92, 0x88abf3ab, + 0x48cfdbbc, 0x08f102d9, 0xc8952ace, 0x883852f7, 0x485c7ae0, + 0x0844e03c, 0xc820c82b, 0x888db012, 0x48e99805, 0x08d74160, + 0xc8b36977, 0x881e114e, 0x487a3959, 0x4928542c, 0x894c7c3b, + 0xc9e10402, 0x09852c15, 0x49bbf570, 0x89dfdd67, 0xc972a55e, + 0x09168d49, 0x490e1795, 0x896a3f82, 0xc9c747bb, 0x09a36fac, + 0x499db6c9, 0x89f99ede, 0xc954e6e7, 0x0930cef0, 0xcbf03c0d, + 0x0b94141a, 0x4b396c23, 0x8b5d4434, 0xcb639d51, 0x0b07b546, + 0x4baacd7f, 0x8bcee568, 0xcbd67fb4, 0x0bb257a3, 0x4b1f2f9a, + 0x8b7b078d, 0xcb45dee8, 0x0b21f6ff, 0x4b8c8ec6, 0x8be8a6d1, + 0x8abacba4, 0x4adee3b3, 0x0a739b8a, 0xca17b39d, 0x8a296af8, + 0x4a4d42ef, 0x0ae03ad6, 0xca8412c1, 0x8a9c881d, 0x4af8a00a, + 0x0a55d833, 0xca31f024, 0x8a0f2941, 0x4a6b0156, 0x0ac6796f, + 0xcaa25178}, + {0x00000000, 0xd4ea739b, 0xe9d396ed, 0x3d39e576, 0x93a15c00, + 0x474b2f9b, 0x7a72caed, 0xae98b976, 0x2643b900, 0xf2a9ca9b, + 0xcf902fed, 0x1b7a5c76, 0xb5e2e500, 0x6108969b, 0x5c3173ed, + 0x88db0076, 0x4c867201, 0x986c019a, 0xa555e4ec, 0x71bf9777, + 0xdf272e01, 0x0bcd5d9a, 0x36f4b8ec, 0xe21ecb77, 0x6ac5cb01, + 0xbe2fb89a, 0x83165dec, 0x57fc2e77, 0xf9649701, 0x2d8ee49a, + 0x10b701ec, 0xc45d7277, 0x980ce502, 0x4ce69699, 0x71df73ef, + 0xa5350074, 0x0badb902, 0xdf47ca99, 0xe27e2fef, 0x36945c74, + 0xbe4f5c02, 0x6aa52f99, 0x579ccaef, 0x8376b974, 0x2dee0002, + 0xf9047399, 0xc43d96ef, 0x10d7e574, 0xd48a9703, 0x0060e498, + 0x3d5901ee, 0xe9b37275, 0x472bcb03, 0x93c1b898, 0xaef85dee, + 0x7a122e75, 0xf2c92e03, 0x26235d98, 0x1b1ab8ee, 0xcff0cb75, + 0x61687203, 0xb5820198, 0x88bbe4ee, 0x5c519775, 0x3019ca05, + 0xe4f3b99e, 0xd9ca5ce8, 0x0d202f73, 0xa3b89605, 0x7752e59e, + 0x4a6b00e8, 0x9e817373, 0x165a7305, 0xc2b0009e, 0xff89e5e8, + 0x2b639673, 0x85fb2f05, 0x51115c9e, 0x6c28b9e8, 0xb8c2ca73, + 0x7c9fb804, 0xa875cb9f, 0x954c2ee9, 0x41a65d72, 0xef3ee404, + 0x3bd4979f, 0x06ed72e9, 0xd2070172, 0x5adc0104, 0x8e36729f, + 0xb30f97e9, 0x67e5e472, 0xc97d5d04, 0x1d972e9f, 0x20aecbe9, + 0xf444b872, 0xa8152f07, 0x7cff5c9c, 0x41c6b9ea, 0x952cca71, + 0x3bb47307, 0xef5e009c, 0xd267e5ea, 0x068d9671, 0x8e569607, + 0x5abce59c, 0x678500ea, 0xb36f7371, 0x1df7ca07, 0xc91db99c, + 0xf4245cea, 0x20ce2f71, 0xe4935d06, 0x30792e9d, 0x0d40cbeb, + 0xd9aab870, 0x77320106, 0xa3d8729d, 0x9ee197eb, 0x4a0be470, + 0xc2d0e406, 0x163a979d, 0x2b0372eb, 0xffe90170, 0x5171b806, + 0x859bcb9d, 0xb8a22eeb, 0x6c485d70, 0x6032940b, 0xb4d8e790, + 0x89e102e6, 0x5d0b717d, 0xf393c80b, 0x2779bb90, 0x1a405ee6, + 0xceaa2d7d, 0x46712d0b, 0x929b5e90, 0xafa2bbe6, 0x7b48c87d, + 0xd5d0710b, 0x013a0290, 0x3c03e7e6, 0xe8e9947d, 0x2cb4e60a, + 0xf85e9591, 0xc56770e7, 0x118d037c, 0xbf15ba0a, 0x6bffc991, + 0x56c62ce7, 0x822c5f7c, 0x0af75f0a, 0xde1d2c91, 0xe324c9e7, + 0x37ceba7c, 0x9956030a, 0x4dbc7091, 0x708595e7, 0xa46fe67c, + 0xf83e7109, 0x2cd40292, 0x11ede7e4, 0xc507947f, 0x6b9f2d09, + 0xbf755e92, 0x824cbbe4, 0x56a6c87f, 0xde7dc809, 0x0a97bb92, + 0x37ae5ee4, 0xe3442d7f, 0x4ddc9409, 0x9936e792, 0xa40f02e4, + 0x70e5717f, 0xb4b80308, 0x60527093, 0x5d6b95e5, 0x8981e67e, + 0x27195f08, 0xf3f32c93, 0xcecac9e5, 0x1a20ba7e, 0x92fbba08, + 0x4611c993, 0x7b282ce5, 0xafc25f7e, 0x015ae608, 0xd5b09593, + 0xe88970e5, 0x3c63037e, 0x502b5e0e, 0x84c12d95, 0xb9f8c8e3, + 0x6d12bb78, 0xc38a020e, 0x17607195, 0x2a5994e3, 0xfeb3e778, + 0x7668e70e, 0xa2829495, 0x9fbb71e3, 0x4b510278, 0xe5c9bb0e, + 0x3123c895, 0x0c1a2de3, 0xd8f05e78, 0x1cad2c0f, 0xc8475f94, + 0xf57ebae2, 0x2194c979, 0x8f0c700f, 0x5be60394, 0x66dfe6e2, + 0xb2359579, 0x3aee950f, 0xee04e694, 0xd33d03e2, 0x07d77079, + 0xa94fc90f, 0x7da5ba94, 0x409c5fe2, 0x94762c79, 0xc827bb0c, + 0x1ccdc897, 0x21f42de1, 0xf51e5e7a, 0x5b86e70c, 0x8f6c9497, + 0xb25571e1, 0x66bf027a, 0xee64020c, 0x3a8e7197, 0x07b794e1, + 0xd35de77a, 0x7dc55e0c, 0xa92f2d97, 0x9416c8e1, 0x40fcbb7a, + 0x84a1c90d, 0x504bba96, 0x6d725fe0, 0xb9982c7b, 0x1700950d, + 0xc3eae696, 0xfed303e0, 0x2a39707b, 0xa2e2700d, 0x76080396, + 0x4b31e6e0, 0x9fdb957b, 0x31432c0d, 0xe5a95f96, 0xd890bae0, + 0x0c7ac97b}, + {0x00000000, 0x27652581, 0x0fcc3bd9, 0x28a91e58, 0x5f9e0669, + 0x78fb23e8, 0x50523db0, 0x77371831, 0xbe3c0dd2, 0x99592853, + 0xb1f0360b, 0x9695138a, 0xe1a20bbb, 0xc6c72e3a, 0xee6e3062, + 0xc90b15e3, 0x3d7f6b7f, 0x1a1a4efe, 0x32b350a6, 0x15d67527, + 0x62e16d16, 0x45844897, 0x6d2d56cf, 0x4a48734e, 0x834366ad, + 0xa426432c, 0x8c8f5d74, 0xabea78f5, 0xdcdd60c4, 0xfbb84545, + 0xd3115b1d, 0xf4747e9c, 0x7afed6fe, 0x5d9bf37f, 0x7532ed27, + 0x5257c8a6, 0x2560d097, 0x0205f516, 0x2aaceb4e, 0x0dc9cecf, + 0xc4c2db2c, 0xe3a7fead, 0xcb0ee0f5, 0xec6bc574, 0x9b5cdd45, + 0xbc39f8c4, 0x9490e69c, 0xb3f5c31d, 0x4781bd81, 0x60e49800, + 0x484d8658, 0x6f28a3d9, 0x181fbbe8, 0x3f7a9e69, 0x17d38031, + 0x30b6a5b0, 0xf9bdb053, 0xded895d2, 0xf6718b8a, 0xd114ae0b, + 0xa623b63a, 0x814693bb, 0xa9ef8de3, 0x8e8aa862, 0xb5fadc26, + 0x929ff9a7, 0xba36e7ff, 0x9d53c27e, 0xea64da4f, 0xcd01ffce, + 0xe5a8e196, 0xc2cdc417, 0x0bc6d1f4, 0x2ca3f475, 0x040aea2d, + 0x236fcfac, 0x5458d79d, 0x733df21c, 0x5b94ec44, 0x7cf1c9c5, + 0x8885b759, 0xafe092d8, 0x87498c80, 0xa02ca901, 0xd71bb130, + 0xf07e94b1, 0xd8d78ae9, 0xffb2af68, 0x36b9ba8b, 0x11dc9f0a, + 0x39758152, 0x1e10a4d3, 0x6927bce2, 0x4e429963, 0x66eb873b, + 0x418ea2ba, 0xcf040ad8, 0xe8612f59, 0xc0c83101, 0xe7ad1480, + 0x909a0cb1, 0xb7ff2930, 0x9f563768, 0xb83312e9, 0x7138070a, + 0x565d228b, 0x7ef43cd3, 0x59911952, 0x2ea60163, 0x09c324e2, + 0x216a3aba, 0x060f1f3b, 0xf27b61a7, 0xd51e4426, 0xfdb75a7e, + 0xdad27fff, 0xade567ce, 0x8a80424f, 0xa2295c17, 0x854c7996, + 0x4c476c75, 0x6b2249f4, 0x438b57ac, 0x64ee722d, 0x13d96a1c, + 0x34bc4f9d, 0x1c1551c5, 0x3b707444, 0x6af5b94d, 0x4d909ccc, + 0x65398294, 0x425ca715, 0x356bbf24, 0x120e9aa5, 0x3aa784fd, + 0x1dc2a17c, 0xd4c9b49f, 0xf3ac911e, 0xdb058f46, 0xfc60aac7, + 0x8b57b2f6, 0xac329777, 0x849b892f, 0xa3feacae, 0x578ad232, + 0x70eff7b3, 0x5846e9eb, 0x7f23cc6a, 0x0814d45b, 0x2f71f1da, + 0x07d8ef82, 0x20bdca03, 0xe9b6dfe0, 0xced3fa61, 0xe67ae439, + 0xc11fc1b8, 0xb628d989, 0x914dfc08, 0xb9e4e250, 0x9e81c7d1, + 0x100b6fb3, 0x376e4a32, 0x1fc7546a, 0x38a271eb, 0x4f9569da, + 0x68f04c5b, 0x40595203, 0x673c7782, 0xae376261, 0x895247e0, + 0xa1fb59b8, 0x869e7c39, 0xf1a96408, 0xd6cc4189, 0xfe655fd1, + 0xd9007a50, 0x2d7404cc, 0x0a11214d, 0x22b83f15, 0x05dd1a94, + 0x72ea02a5, 0x558f2724, 0x7d26397c, 0x5a431cfd, 0x9348091e, + 0xb42d2c9f, 0x9c8432c7, 0xbbe11746, 0xccd60f77, 0xebb32af6, + 0xc31a34ae, 0xe47f112f, 0xdf0f656b, 0xf86a40ea, 0xd0c35eb2, + 0xf7a67b33, 0x80916302, 0xa7f44683, 0x8f5d58db, 0xa8387d5a, + 0x613368b9, 0x46564d38, 0x6eff5360, 0x499a76e1, 0x3ead6ed0, + 0x19c84b51, 0x31615509, 0x16047088, 0xe2700e14, 0xc5152b95, + 0xedbc35cd, 0xcad9104c, 0xbdee087d, 0x9a8b2dfc, 0xb22233a4, + 0x95471625, 0x5c4c03c6, 0x7b292647, 0x5380381f, 0x74e51d9e, + 0x03d205af, 0x24b7202e, 0x0c1e3e76, 0x2b7b1bf7, 0xa5f1b395, + 0x82949614, 0xaa3d884c, 0x8d58adcd, 0xfa6fb5fc, 0xdd0a907d, + 0xf5a38e25, 0xd2c6aba4, 0x1bcdbe47, 0x3ca89bc6, 0x1401859e, + 0x3364a01f, 0x4453b82e, 0x63369daf, 0x4b9f83f7, 0x6cfaa676, + 0x988ed8ea, 0xbfebfd6b, 0x9742e333, 0xb027c6b2, 0xc710de83, + 0xe075fb02, 0xc8dce55a, 0xefb9c0db, 0x26b2d538, 0x01d7f0b9, + 0x297eeee1, 0x0e1bcb60, 0x792cd351, 0x5e49f6d0, 0x76e0e888, + 0x5185cd09}}; + +#endif + +#endif + +#endif + +local const z_crc_t FAR x2n_table[] = { + 0x40000000, 0x20000000, 0x08000000, 0x00800000, 0x00008000, + 0xedb88320, 0xb1e6b092, 0xa06a2517, 0xed627dae, 0x88d14467, + 0xd7bbfe6a, 0xec447f11, 0x8e7ea170, 0x6427800e, 0x4d47bae0, + 0x09fe548f, 0x83852d0f, 0x30362f1a, 0x7b5a9cc3, 0x31fec169, + 0x9fec022a, 0x6c8dedc4, 0x15d6874d, 0x5fde7a4e, 0xbad90e37, + 0x2e4e5eef, 0x4eaba214, 0xa8a472c0, 0x429a969e, 0x148d302a, + 0xc40ba6d0, 0xc4e22c3c}; diff --git a/src/mono/mono/zlib/deflate.c b/src/mono/mono/zlib/deflate.c index 1ec761448de926..d2e1106ef5d07d 100644 --- a/src/mono/mono/zlib/deflate.c +++ b/src/mono/mono/zlib/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -87,13 +87,7 @@ local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifdef ASMV -# pragma message("Assembler code may have bugs -- use at your own risk") - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif #ifdef ZLIB_DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, @@ -160,7 +154,7 @@ local const config configuration_table[10] = { * characters, so that a running hash key can be computed from the previous * key instead of complete recalculation each time. */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) +#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== @@ -190,8 +184,11 @@ local const config configuration_table[10] = { * prev[] will be initialized on the fly. */ #define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + do { \ + s->head[s->hash_size - 1] = NIL; \ + zmemzero((Bytef *)s->head, \ + (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \ + } while (0) /* =========================================================================== * Slide the hash table when sliding the window down (could be avoided with 32 @@ -252,11 +249,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, int wrap = 1; static const char my_version[] = ZLIB_VERSION; - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { return Z_VERSION_ERROR; @@ -287,6 +279,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; + if (windowBits < -15) + return Z_STREAM_ERROR; windowBits = -windowBits; } #ifdef GZIP @@ -316,7 +310,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->hash_bits = (uInt)memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); @@ -326,9 +320,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + /* We overlay pending_buf and sym_buf. This works since the average size + * for length/distance pairs over any compressed block is assured to be 31 + * bits or less. + * + * Analysis: The longest fixed codes are a length code of 8 bits plus 5 + * extra bits, for lengths 131 to 257. The longest fixed distance codes are + * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest + * possible fixed-codes length/distance pair is then 31 bits total. + * + * sym_buf starts one-fourth of the way into pending_buf. So there are + * three bytes in sym_buf for every four bytes in pending_buf. Each symbol + * in sym_buf is three bytes -- two for the distance and one for the + * literal/length. As each symbol is consumed, the pointer to the next + * sym_buf value to read moves forward three bytes. From that symbol, up to + * 31 bits are written to pending_buf. The closest the written pending_buf + * bits gets to the next sym_buf symbol to read is just before the last + * code is written. At that time, 31*(n - 2) bits have been written, just + * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at + * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1 + * symbols are written.) The closest the writing gets to what is unread is + * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and + * can range from 128 to 32768. + * + * Therefore, at a minimum, there are 142 bits of space between what is + * written and what is read in the overlain buffers, so the symbols cannot + * be overwritten by the compressed data. That space is actually 139 bits, + * due to the three-bit fixed-code block header. + * + * That covers the case where either Z_FIXED is specified, forcing fixed + * codes, or when the use of fixed codes is chosen, because that choice + * results in a smaller compressed block than dynamic codes. That latter + * condition then assures that the above analysis also covers all dynamic + * blocks. A dynamic-code block will only be chosen to be emitted if it has + * fewer bits than a fixed-code block would for the same set of symbols. + * Therefore its average symbol length is assured to be less than 31. So + * the compressed data for a dynamic block also cannot overwrite the + * symbols from which it is being constructed. + */ + + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { @@ -337,8 +369,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, deflateEnd (strm); return Z_MEM_ERROR; } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + s->sym_buf = s->pending_buf + s->lit_bufsize; + s->sym_end = (s->lit_bufsize - 1) * 3; + /* We avoid equality with lit_bufsize*3 because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ s->level = level; s->strategy = strategy; @@ -350,7 +386,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, /* ========================================================================= * Check for a valid deflate stream state. Return 0 if ok, 1 if not. */ -local int deflateStateCheck (strm) +local int deflateStateCheck(strm) z_streamp strm; { deflate_state *s; @@ -373,7 +409,7 @@ local int deflateStateCheck (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; @@ -442,7 +478,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength) z_streamp strm; Bytef *dictionary; uInt *dictLength; @@ -464,7 +500,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateResetKeep (strm) +int ZEXPORT deflateResetKeep(strm) z_streamp strm; { deflate_state *s; @@ -488,13 +524,13 @@ int ZEXPORT deflateResetKeep (strm) #ifdef GZIP s->wrap == 2 ? GZIP_STATE : #endif - s->wrap ? INIT_STATE : BUSY_STATE; + INIT_STATE; strm->adler = #ifdef GZIP s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; + s->last_flush = -2; _tr_init(s); @@ -502,7 +538,7 @@ int ZEXPORT deflateResetKeep (strm) } /* ========================================================================= */ -int ZEXPORT deflateReset (strm) +int ZEXPORT deflateReset(strm) z_streamp strm; { int ret; @@ -514,7 +550,7 @@ int ZEXPORT deflateReset (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) +int ZEXPORT deflateSetHeader(strm, head) z_streamp strm; gz_headerp head; { @@ -525,7 +561,7 @@ int ZEXPORT deflateSetHeader (strm, head) } /* ========================================================================= */ -int ZEXPORT deflatePending (strm, pending, bits) +int ZEXPORT deflatePending(strm, pending, bits) unsigned *pending; int *bits; z_streamp strm; @@ -539,7 +575,7 @@ int ZEXPORT deflatePending (strm, pending, bits) } /* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) +int ZEXPORT deflatePrime(strm, bits, value) z_streamp strm; int bits; int value; @@ -549,7 +585,8 @@ int ZEXPORT deflatePrime (strm, bits, value) if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; - if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) + if (bits < 0 || bits > 16 || + s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; do { put = Buf_size - s->bi_valid; @@ -587,12 +624,12 @@ int ZEXPORT deflateParams(strm, level, strategy) func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && - s->high_water) { + s->last_flush != -2) { /* Flush the last buffer: */ int err = deflate(strm, Z_BLOCK); if (err == Z_STREAM_ERROR) return err; - if (strm->avail_out == 0) + if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead) return Z_BUF_ERROR; } if (s->level != level) { @@ -633,36 +670,50 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) } /* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. + * For the default windowBits of 15 and memLevel of 8, this function returns a + * close to exact, as well as small, upper bound on the compressed size. This + * is an expansion of ~0.03%, plus a small constant. + * + * For any setting other than those defaults for windowBits and memLevel, one + * of two worst case bounds is returned. This is at most an expansion of ~4% or + * ~13%, plus a small constant. * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. + * Both the 0.03% and 4% derive from the overhead of stored blocks. The first + * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second + * is for stored blocks of 127 bytes (the worst case memLevel == 1). The + * expansion results from five bytes of header for each stored block. * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. + * The larger expansion of 13% results from a window size less than or equal to + * the symbols buffer size (windowBits <= memLevel + 7). In that case some of + * the data being compressed may have slid out of the sliding window, impeding + * a stored block from being emitted. Then the only choice is a fixed or + * dynamic block, where a fixed block limits the maximum expansion to 9 bits + * per 8-bit byte, plus 10 bits for every block. The smallest block size for + * which this can occur is 255 (memLevel == 2). + * + * Shifts are used to approximate divisions, for speed. */ uLong ZEXPORT deflateBound(strm, sourceLen) z_streamp strm; uLong sourceLen; { deflate_state *s; - uLong complen, wraplen; + uLong fixedlen, storelen, wraplen; + + /* upper bound for fixed blocks with 9-bit literals and length 255 + (memLevel == 2, which is the lowest that may not use stored blocks) -- + ~13% overhead plus a small constant */ + fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) + + (sourceLen >> 9) + 4; - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + /* upper bound for stored blocks with length 127 (memLevel == 1) -- + ~4% overhead plus a small constant */ + storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) + + (sourceLen >> 11) + 7; - /* if can't get parameters, return conservative bound plus zlib wrapper */ + /* if can't get parameters, return larger bound plus a zlib wrapper */ if (deflateStateCheck(strm)) - return complen + 6; + return (fixedlen > storelen ? fixedlen : storelen) + 6; /* compute wrapper length */ s = strm->state; @@ -699,11 +750,13 @@ uLong ZEXPORT deflateBound(strm, sourceLen) wraplen = 6; } - /* if not default parameters, return conservative bound */ + /* if not default parameters, return one of the conservative bounds */ if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; + return (s->w_bits <= s->hash_bits && s->level ? fixedlen : storelen) + + wraplen; - /* default settings: return tight bound for that case */ + /* default settings: return tight bound for that case -- ~0.03% overhead + plus a small constant */ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; } @@ -713,7 +766,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ -local void putShortMSB (s, b) +local void putShortMSB(s, b) deflate_state *s; uInt b; { @@ -760,7 +813,7 @@ local void flush_pending(strm) } while (0) /* ========================================================================= */ -int ZEXPORT deflate (strm, flush) +int ZEXPORT deflate(strm, flush) z_streamp strm; int flush; { @@ -811,9 +864,11 @@ int ZEXPORT deflate (strm, flush) } /* Write the header */ + if (s->status == INIT_STATE && s->wrap == 0) + s->status = BUSY_STATE; if (s->status == INIT_STATE) { /* zlib header */ - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) @@ -1073,7 +1128,7 @@ int ZEXPORT deflate (strm, flush) } /* ========================================================================= */ -int ZEXPORT deflateEnd (strm) +int ZEXPORT deflateEnd(strm) z_streamp strm; { int status; @@ -1099,7 +1154,7 @@ int ZEXPORT deflateEnd (strm) * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ -int ZEXPORT deflateCopy (dest, source) +int ZEXPORT deflateCopy(dest, source) z_streamp dest; z_streamp source; { @@ -1108,7 +1163,6 @@ int ZEXPORT deflateCopy (dest, source) #else deflate_state *ds; deflate_state *ss; - ushf *overlay; if (deflateStateCheck(source) || dest == Z_NULL) { @@ -1128,8 +1182,7 @@ int ZEXPORT deflateCopy (dest, source) ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1143,8 +1196,7 @@ int ZEXPORT deflateCopy (dest, source) zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + ds->sym_buf = ds->pending_buf + ds->lit_bufsize; ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1191,7 +1243,7 @@ local unsigned read_buf(strm, buf, size) /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ -local void lm_init (s) +local void lm_init(s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; @@ -1212,11 +1264,6 @@ local void lm_init (s) s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif } #ifndef FASTEST @@ -1229,10 +1276,6 @@ local void lm_init (s) * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ @@ -1257,10 +1300,10 @@ local uInt longest_match(s, cur_match) */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); + register ush scan_end = *(ushf*)(scan + best_len - 1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end1 = scan[best_len - 1]; register Byte scan_end = scan[best_len]; #endif @@ -1278,7 +1321,8 @@ local uInt longest_match(s, cur_match) */ if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead; - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); @@ -1296,43 +1340,44 @@ local uInt longest_match(s, cur_match) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ - if (*(ushf*)(match+best_len-1) != scan_end || + if (*(ushf*)(match + best_len - 1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient + * strstart + 3, + 5, up to strstart + 257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + } while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + /* Here, scan <= window + strstart + 257 */ + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); if (*scan == *match) scan++; - len = (MAX_MATCH - 1) - (int)(strend-scan); + len = (MAX_MATCH - 1) - (int)(strend - scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; + if (match[best_len] != scan_end || + match[best_len - 1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1342,7 +1387,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1351,7 +1396,8 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; @@ -1363,9 +1409,9 @@ local uInt longest_match(s, cur_match) best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); + scan_end = *(ushf*)(scan + best_len - 1); #else - scan_end1 = scan[best_len-1]; + scan_end1 = scan[best_len - 1]; scan_end = scan[best_len]; #endif } @@ -1375,7 +1421,6 @@ local uInt longest_match(s, cur_match) if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } -#endif /* ASMV */ #else /* FASTEST */ @@ -1396,7 +1441,8 @@ local uInt longest_match(s, cur_match) */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); Assert(cur_match < s->strstart, "no future"); @@ -1406,7 +1452,7 @@ local uInt longest_match(s, cur_match) */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1416,7 +1462,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1425,7 +1471,7 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); @@ -1461,7 +1507,7 @@ local void check_match(s, start, match, length) z_error("invalid match"); } if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); + fprintf(stderr,"\\[%d,%d]", start - match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } @@ -1507,12 +1553,14 @@ local void fill_window(s) /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ - if (s->strstart >= wsize+MAX_DIST(s)) { + if (s->strstart >= wsize + MAX_DIST(s)) { - zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more); + zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; + if (s->insert > s->strstart) + s->insert = s->strstart; slide_hash(s); more += wsize; } @@ -1638,7 +1686,7 @@ local void fill_window(s) * * deflate_stored() is written to minimize the number of times an input byte is * copied. It is most efficient with large input and output buffers, which - * maximizes the opportunites to have a single copy from next_in to next_out. + * maximizes the opportunities to have a single copy from next_in to next_out. */ local block_state deflate_stored(s, flush) deflate_state *s; @@ -1742,6 +1790,7 @@ local block_state deflate_stored(s, flush) s->matches = 2; /* clear hash */ zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size); s->strstart = s->w_size; + s->insert = s->strstart; } else { if (s->window_size - s->strstart <= used) { @@ -1750,12 +1799,14 @@ local block_state deflate_stored(s, flush) zmemcpy(s->window, s->window + s->w_size, s->strstart); if (s->matches < 2) s->matches++; /* add a pending slide_hash() */ + if (s->insert > s->strstart) + s->insert = s->strstart; } zmemcpy(s->window + s->strstart, s->strm->next_in - used, used); s->strstart += used; + s->insert += MIN(used, s->w_size - s->insert); } s->block_start = s->strstart; - s->insert += MIN(used, s->w_size - s->insert); } if (s->high_water < s->strstart) s->high_water = s->strstart; @@ -1770,7 +1821,7 @@ local block_state deflate_stored(s, flush) return block_done; /* Fill the window with any remaining input. */ - have = s->window_size - s->strstart - 1; + have = s->window_size - s->strstart; if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) { /* Slide the window down. */ s->block_start -= s->w_size; @@ -1779,12 +1830,15 @@ local block_state deflate_stored(s, flush) if (s->matches < 2) s->matches++; /* add a pending slide_hash() */ have += s->w_size; /* more space now */ + if (s->insert > s->strstart) + s->insert = s->strstart; } if (have > s->strm->avail_in) have = s->strm->avail_in; if (have) { read_buf(s->strm, s->window + s->strstart, have); s->strstart += have; + s->insert += MIN(have, s->w_size - s->insert); } if (s->high_water < s->strstart) s->high_water = s->strstart; @@ -1842,7 +1896,7 @@ local block_state deflate_fast(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1890,7 +1944,7 @@ local block_state deflate_fast(s, flush) s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); + UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif @@ -1901,7 +1955,7 @@ local block_state deflate_fast(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -1912,7 +1966,7 @@ local block_state deflate_fast(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -1945,7 +1999,7 @@ local block_state deflate_slow(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1987,17 +2041,17 @@ local block_state deflate_slow(s, flush) uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ - check_match(s, s->strstart-1, s->prev_match, s->prev_length); + check_match(s, s->strstart - 1, s->prev_match, s->prev_length); - _tr_tally_dist(s, s->strstart -1 - s->prev_match, + _tr_tally_dist(s, s->strstart - 1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not + * strstart - 1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ - s->lookahead -= s->prev_length-1; + s->lookahead -= s->prev_length - 1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { @@ -2015,8 +2069,8 @@ local block_state deflate_slow(s, flush) * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } @@ -2034,8 +2088,8 @@ local block_state deflate_slow(s, flush) } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); s->match_available = 0; } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; @@ -2043,7 +2097,7 @@ local block_state deflate_slow(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -2092,7 +2146,8 @@ local block_state deflate_rle(s, flush) if (s->match_length > s->lookahead) s->match_length = s->lookahead; } - Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (uInt)(s->window_size - 1), + "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ @@ -2107,7 +2162,7 @@ local block_state deflate_rle(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -2118,7 +2173,7 @@ local block_state deflate_rle(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -2147,7 +2202,7 @@ local block_state deflate_huff(s, flush) /* Output a literal byte */ s->match_length = 0; Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); @@ -2157,7 +2212,7 @@ local block_state deflate_huff(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } diff --git a/src/mono/mono/zlib/deflate.h b/src/mono/mono/zlib/deflate.h index 23ecdd312bc06e..1a06cd5f25d107 100644 --- a/src/mono/mono/zlib/deflate.h +++ b/src/mono/mono/zlib/deflate.h @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2016 Jean-loup Gailly + * Copyright (C) 1995-2018 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -217,7 +217,7 @@ typedef struct internal_state { /* Depth of each subtree used as tie breaker for trees of equal frequency */ - uchf *l_buf; /* buffer for literals or lengths */ + uchf *sym_buf; /* buffer for distances and literals/lengths */ uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,13 +239,8 @@ typedef struct internal_state { * - I can't count above 4 */ - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ + uInt sym_next; /* running index in sym_buf */ + uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ @@ -325,20 +320,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ + s->sym_buf[s->sym_next++] = 0; \ + s->sym_buf[s->sym_next++] = 0; \ + s->sym_buf[s->sym_next++] = cc; \ s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ + flush = (s->sym_next == s->sym_end); \ } # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (uch)(length); \ ush dist = (ush)(distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ + s->sym_buf[s->sym_next++] = (uch)dist; \ + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \ + s->sym_buf[s->sym_next++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ + flush = (s->sym_next == s->sym_end); \ } #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) diff --git a/src/mono/mono/zlib/gzguts.h b/src/mono/mono/zlib/gzguts.h index 990a4d25149337..57faf37165a354 100644 --- a/src/mono/mono/zlib/gzguts.h +++ b/src/mono/mono/zlib/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler + * Copyright (C) 2004-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -39,7 +39,7 @@ # include #endif -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) # define WIDECHAR #endif @@ -190,6 +190,7 @@ typedef struct { /* just for writing */ int level; /* compression level */ int strategy; /* compression strategy */ + int reset; /* true if a reset is pending after a Z_FINISH */ /* seek request */ z_off64_t skip; /* amount to skip (already rewound if backwards) */ int seek; /* true if seek request pending */ diff --git a/src/mono/mono/zlib/infback.c b/src/mono/mono/zlib/infback.c index 59679ecbfc5d77..babeaf1806f98f 100644 --- a/src/mono/mono/zlib/infback.c +++ b/src/mono/mono/zlib/infback.c @@ -1,5 +1,5 @@ /* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -66,6 +66,7 @@ int stream_size; state->window = window; state->wnext = 0; state->whave = 0; + state->sane = 1; return Z_OK; } @@ -477,6 +478,7 @@ void FAR *out_desc; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; + /* fallthrough */ case LEN: /* use inflate_fast() if we have enough input and output */ @@ -604,25 +606,27 @@ void FAR *out_desc; break; case DONE: - /* inflate stream terminated properly -- write leftover output */ + /* inflate stream terminated properly */ ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; - default: /* can't happen, but makes compilers happy */ + default: + /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } - /* Return unused input */ + /* Write leftover output and return unused input */ inf_leave: + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left) && + ret == Z_STREAM_END) + ret = Z_BUF_ERROR; + } strm->next_in = next; strm->avail_in = have; return ret; diff --git a/src/mono/mono/zlib/inffast.c b/src/mono/mono/zlib/inffast.c index 0dbd1dbc09f2f6..1fec7f363fa665 100644 --- a/src/mono/mono/zlib/inffast.c +++ b/src/mono/mono/zlib/inffast.c @@ -70,7 +70,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ code const FAR *dcode; /* local strm->distcode */ unsigned lmask; /* mask for first level of length codes */ unsigned dmask; /* mask for first level of distance codes */ - code here; /* retrieved table entry */ + code const *here; /* retrieved table entry */ unsigned op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ unsigned len; /* match length, unused bytes */ @@ -107,20 +107,20 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ hold += (unsigned long)(*in++) << bits; bits += 8; } - here = lcode[hold & lmask]; + here = lcode + (hold & lmask); dolen: - op = (unsigned)(here.bits); + op = (unsigned)(here->bits); hold >>= op; bits -= op; - op = (unsigned)(here.op); + op = (unsigned)(here->op); if (op == 0) { /* literal */ - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ? "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - *out++ = (unsigned char)(here.val); + "inflate: literal 0x%02x\n", here->val)); + *out++ = (unsigned char)(here->val); } else if (op & 16) { /* length base */ - len = (unsigned)(here.val); + len = (unsigned)(here->val); op &= 15; /* number of extra bits */ if (op) { if (bits < op) { @@ -138,14 +138,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ hold += (unsigned long)(*in++) << bits; bits += 8; } - here = dcode[hold & dmask]; + here = dcode + (hold & dmask); dodist: - op = (unsigned)(here.bits); + op = (unsigned)(here->bits); hold >>= op; bits -= op; - op = (unsigned)(here.op); + op = (unsigned)(here->op); if (op & 16) { /* distance base */ - dist = (unsigned)(here.val); + dist = (unsigned)(here->val); op &= 15; /* number of extra bits */ if (bits < op) { hold += (unsigned long)(*in++) << bits; @@ -264,7 +264,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ } } else if ((op & 64) == 0) { /* 2nd level distance code */ - here = dcode[here.val + (hold & ((1U << op) - 1))]; + here = dcode + here->val + (hold & ((1U << op) - 1)); goto dodist; } else { @@ -274,7 +274,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ } } else if ((op & 64) == 0) { /* 2nd level length code */ - here = lcode[here.val + (hold & ((1U << op) - 1))]; + here = lcode + here->val + (hold & ((1U << op) - 1)); goto dolen; } else if (op & 32) { /* end-of-block */ diff --git a/src/mono/mono/zlib/inflate.c b/src/mono/mono/zlib/inflate.c index ac333e8c2edae9..8acbef44e993ba 100644 --- a/src/mono/mono/zlib/inflate.c +++ b/src/mono/mono/zlib/inflate.c @@ -1,5 +1,5 @@ /* inflate.c -- zlib decompression - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -130,6 +130,7 @@ z_streamp strm; state->mode = HEAD; state->last = 0; state->havedict = 0; + state->flags = -1; state->dmax = 32768U; state->head = Z_NULL; state->hold = 0; @@ -167,6 +168,8 @@ int windowBits; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { + if (windowBits < -15) + return Z_STREAM_ERROR; wrap = 0; windowBits = -windowBits; } @@ -447,10 +450,10 @@ unsigned copy; /* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP -# define UPDATE(check, buf, len) \ +# define UPDATE_CHECK(check, buf, len) \ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) #else -# define UPDATE(check, buf, len) adler32(check, buf, len) +# define UPDATE_CHECK(check, buf, len) adler32(check, buf, len) #endif /* check macros for header crc */ @@ -670,7 +673,6 @@ int flush; state->mode = FLAGS; break; } - state->flags = 0; /* expect zlib header */ if (state->head != Z_NULL) state->head->done = -1; if (!(state->wrap & 1) || /* check if zlib header allowed */ @@ -697,6 +699,7 @@ int flush; break; } state->dmax = 1U << len; + state->flags = 0; /* indicate zlib header */ Tracev((stderr, "inflate: zlib header ok\n")); strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = hold & 0x200 ? DICTID : TYPE; @@ -722,6 +725,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = TIME; + /* fallthrough */ case TIME: NEEDBITS(32); if (state->head != Z_NULL) @@ -730,6 +734,7 @@ int flush; CRC4(state->check, hold); INITBITS(); state->mode = OS; + /* fallthrough */ case OS: NEEDBITS(16); if (state->head != Z_NULL) { @@ -740,6 +745,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; + /* fallthrough */ case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); @@ -753,14 +759,16 @@ int flush; else if (state->head != Z_NULL) state->head->extra = Z_NULL; state->mode = EXTRA; + /* fallthrough */ case EXTRA: if (state->flags & 0x0400) { copy = state->length; if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); @@ -775,6 +783,7 @@ int flush; } state->length = 0; state->mode = NAME; + /* fallthrough */ case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; @@ -796,6 +805,7 @@ int flush; state->head->name = Z_NULL; state->length = 0; state->mode = COMMENT; + /* fallthrough */ case COMMENT: if (state->flags & 0x1000) { if (have == 0) goto inf_leave; @@ -816,6 +826,7 @@ int flush; else if (state->head != Z_NULL) state->head->comment = Z_NULL; state->mode = HCRC; + /* fallthrough */ case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); @@ -839,6 +850,7 @@ int flush; strm->adler = state->check = ZSWAP32(hold); INITBITS(); state->mode = DICT; + /* fallthrough */ case DICT: if (state->havedict == 0) { RESTORE(); @@ -846,8 +858,10 @@ int flush; } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; + /* fallthrough */ case TYPE: if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + /* fallthrough */ case TYPEDO: if (state->last) { BYTEBITS(); @@ -898,8 +912,10 @@ int flush; INITBITS(); state->mode = COPY_; if (flush == Z_TREES) goto inf_leave; + /* fallthrough */ case COPY_: state->mode = COPY; + /* fallthrough */ case COPY: copy = state->length; if (copy) { @@ -935,6 +951,7 @@ int flush; Tracev((stderr, "inflate: table sizes ok\n")); state->have = 0; state->mode = LENLENS; + /* fallthrough */ case LENLENS: while (state->have < state->ncode) { NEEDBITS(3); @@ -956,6 +973,7 @@ int flush; Tracev((stderr, "inflate: code lengths ok\n")); state->have = 0; state->mode = CODELENS; + /* fallthrough */ case CODELENS: while (state->have < state->nlen + state->ndist) { for (;;) { @@ -1039,8 +1057,10 @@ int flush; Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN_; if (flush == Z_TREES) goto inf_leave; + /* fallthrough */ case LEN_: state->mode = LEN; + /* fallthrough */ case LEN: if (have >= 6 && left >= 258) { RESTORE(); @@ -1090,6 +1110,7 @@ int flush; } state->extra = (unsigned)(here.op) & 15; state->mode = LENEXT; + /* fallthrough */ case LENEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1100,6 +1121,7 @@ int flush; Tracevv((stderr, "inflate: length %u\n", state->length)); state->was = state->length; state->mode = DIST; + /* fallthrough */ case DIST: for (;;) { here = state->distcode[BITS(state->distbits)]; @@ -1127,6 +1149,7 @@ int flush; state->offset = (unsigned)here.val; state->extra = (unsigned)(here.op) & 15; state->mode = DISTEXT; + /* fallthrough */ case DISTEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1143,6 +1166,7 @@ int flush; #endif Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; + /* fallthrough */ case MATCH: if (left == 0) goto inf_leave; copy = out - left; @@ -1202,7 +1226,7 @@ int flush; state->total += out; if ((state->wrap & 4) && out) strm->adler = state->check = - UPDATE(state->check, put - out, out); + UPDATE_CHECK(state->check, put - out, out); out = left; if ((state->wrap & 4) && ( #ifdef GUNZIP @@ -1218,10 +1242,11 @@ int flush; } #ifdef GUNZIP state->mode = LENGTH; + /* fallthrough */ case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { + if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) { strm->msg = (char *)"incorrect length check"; state->mode = BAD; break; @@ -1231,6 +1256,7 @@ int flush; } #endif state->mode = DONE; + /* fallthrough */ case DONE: ret = Z_STREAM_END; goto inf_leave; @@ -1240,6 +1266,7 @@ int flush; case MEM: return Z_MEM_ERROR; case SYNC: + /* fallthrough */ default: return Z_STREAM_ERROR; } @@ -1265,7 +1292,7 @@ int flush; state->total += out; if ((state->wrap & 4) && out) strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); + UPDATE_CHECK(state->check, strm->next_out - out, out); strm->data_type = (int)state->bits + (state->last ? 64 : 0) + (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); @@ -1401,6 +1428,7 @@ int ZEXPORT inflateSync(strm) z_streamp strm; { unsigned len; /* number of bytes to look at or looked at */ + int flags; /* temporary to save header status */ unsigned long in, out; /* temporary to save total_in and total_out */ unsigned char buf[4]; /* to restore bit buffer to byte string */ struct inflate_state FAR *state; @@ -1433,9 +1461,15 @@ z_streamp strm; /* return no joy or set up to restart inflate() on a new block */ if (state->have != 4) return Z_DATA_ERROR; + if (state->flags == -1) + state->wrap = 0; /* if no header yet, treat as raw */ + else + state->wrap &= ~4; /* no point in computing a check value now */ + flags = state->flags; in = strm->total_in; out = strm->total_out; inflateReset(strm); strm->total_in = in; strm->total_out = out; + state->flags = flags; state->mode = TYPE; return Z_OK; } @@ -1531,7 +1565,7 @@ int check; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; - if (check) + if (check && state->wrap) state->wrap |= 4; else state->wrap &= ~4; diff --git a/src/mono/mono/zlib/inflate.h b/src/mono/mono/zlib/inflate.h index a46cce6b6d05ef..f127b6b1fa5f7d 100644 --- a/src/mono/mono/zlib/inflate.h +++ b/src/mono/mono/zlib/inflate.h @@ -1,5 +1,5 @@ /* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -86,7 +86,8 @@ struct inflate_state { int wrap; /* bit 0 true for zlib, bit 1 true for gzip, bit 2 true to validate check value */ int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ + int flags; /* gzip header method and flags, 0 if zlib, or + -1 if raw or no header yet */ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ unsigned long check; /* protected copy of check value */ unsigned long total; /* protected copy of output count */ diff --git a/src/mono/mono/zlib/inftrees.c b/src/mono/mono/zlib/inftrees.c index 2ea08fc13ea8ec..57d2793bec931f 100644 --- a/src/mono/mono/zlib/inftrees.c +++ b/src/mono/mono/zlib/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2017 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.11 Copyright 1995-2017 Mark Adler "; + " inflate 1.2.13 Copyright 1995-2022 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -62,7 +62,7 @@ unsigned short FAR *work; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, diff --git a/src/mono/mono/zlib/inftrees.h b/src/mono/mono/zlib/inftrees.h index baa53a0b1a199c..f53665311c1624 100644 --- a/src/mono/mono/zlib/inftrees.h +++ b/src/mono/mono/zlib/inftrees.h @@ -38,7 +38,7 @@ typedef struct { /* Maximum size of the dynamic table. The maximum number of code structures is 1444, which is the sum of 852 for literal/length codes and 592 for distance codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that + examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes returns returns 852, and "enough 30 6 15" for distance codes returns 592. diff --git a/src/mono/mono/zlib/trees.c b/src/mono/mono/zlib/trees.c index 50cf4b4571cfec..5f305c47221e90 100644 --- a/src/mono/mono/zlib/trees.c +++ b/src/mono/mono/zlib/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2017 Jean-loup Gailly + * Copyright (C) 1995-2021 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -149,7 +149,7 @@ local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, local void compress_block OF((deflate_state *s, const ct_data *ltree, const ct_data *dtree)); local int detect_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); +local unsigned bi_reverse OF((unsigned code, int len)); local void bi_windup OF((deflate_state *s)); local void bi_flush OF((deflate_state *s)); @@ -193,7 +193,7 @@ local void send_bits(s, value, length) s->bits_sent += (ulg)length; /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * (16 - bi_valid) bits from value, leaving (width - (16 - bi_valid)) * unused bits in value. */ if (s->bi_valid > (int)Buf_size - length) { @@ -256,7 +256,7 @@ local void tr_static_init() length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { _dist_code[256 + dist++] = (uch)code; } } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); + Assert (dist == 256, "tr_static_init: 256 + dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; @@ -312,7 +312,7 @@ local void tr_static_init() } /* =========================================================================== - * Genererate the file trees.h describing the static trees. + * Generate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H # ifndef ZLIB_DEBUG @@ -321,7 +321,7 @@ local void tr_static_init() # define SEPARATOR(i, last, width) \ ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) + ((i) % (width) == (width) - 1 ? ",\n" : ", ")) void gen_trees_header() { @@ -416,7 +416,7 @@ local void init_block(s) s->dyn_ltree[END_BLOCK].Freq = 1; s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; + s->sym_next = s->matches = 0; } #define SMALLEST 1 @@ -458,7 +458,7 @@ local void pqdownheap(s, tree, k) while (j <= s->heap_len) { /* Set j to the smallest of the two sons: */ if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) { j++; } /* Exit if v is smaller than both sons */ @@ -507,7 +507,7 @@ local void gen_bitlen(s, desc) */ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + for (h = s->heap_max + 1; h < HEAP_SIZE; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len + 1; if (bits > max_length) bits = max_length, overflow++; @@ -518,7 +518,7 @@ local void gen_bitlen(s, desc) s->bl_count[bits]++; xbits = 0; - if (n >= base) xbits = extra[n-base]; + if (n >= base) xbits = extra[n - base]; f = tree[n].Freq; s->opt_len += (ulg)f * (unsigned)(bits + xbits); if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits); @@ -530,10 +530,10 @@ local void gen_bitlen(s, desc) /* Find the first bit length which could increase: */ do { - bits = max_length-1; + bits = max_length - 1; while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */ s->bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] @@ -569,7 +569,7 @@ local void gen_bitlen(s, desc) * OUT assertion: the field code is set for all tree elements of non * zero code length. */ -local void gen_codes (tree, max_code, bl_count) +local void gen_codes(tree, max_code, bl_count) ct_data *tree; /* the tree to decorate */ int max_code; /* largest code with non zero frequency */ ushf *bl_count; /* number of codes at each bit length */ @@ -583,13 +583,13 @@ local void gen_codes (tree, max_code, bl_count) * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { - code = (code + bl_count[bits-1]) << 1; + code = (code + bl_count[bits - 1]) << 1; next_code[bits] = (ush)code; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ - Assert (code + bl_count[MAX_BITS]-1 == (1<heap_len = 0, s->heap_max = HEAP_SIZE; @@ -652,7 +652,7 @@ local void build_tree(s, desc) } desc->max_code = max_code; - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); @@ -700,7 +700,7 @@ local void build_tree(s, desc) * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ -local void scan_tree (s, tree, max_code) +local void scan_tree(s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ @@ -714,10 +714,10 @@ local void scan_tree (s, tree, max_code) int min_count = 4; /* min repeat count */ if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ + tree[max_code + 1].Len = (ush)0xffff; /* guard */ for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; + curlen = nextlen; nextlen = tree[n + 1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { @@ -745,7 +745,7 @@ local void scan_tree (s, tree, max_code) * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ -local void send_tree (s, tree, max_code) +local void send_tree(s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ @@ -758,11 +758,11 @@ local void send_tree (s, tree, max_code) int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ - /* tree[max_code+1].Len = -1; */ /* guard already set */ + /* tree[max_code + 1].Len = -1; */ /* guard already set */ if (nextlen == 0) max_count = 138, min_count = 3; for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; + curlen = nextlen; nextlen = tree[n + 1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { @@ -773,13 +773,13 @@ local void send_tree (s, tree, max_code) send_code(s, curlen, s->bl_tree); count--; } Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2); } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3); } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7); } count = 0; prevlen = curlen; if (nextlen == 0) { @@ -807,8 +807,8 @@ local int build_bl_tree(s) /* Build the bit length tree: */ build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + /* opt_len now includes the length of the tree representations, except the + * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format @@ -819,7 +819,7 @@ local int build_bl_tree(s) if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4; + s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", s->opt_len, s->static_len)); @@ -841,19 +841,19 @@ local void send_all_trees(s, lcodes, dcodes, blcodes) Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); } Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } @@ -866,17 +866,18 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) ulg stored_len; /* length of input block */ int last; /* one if this is the last block for a file */ { - send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ + send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */ bi_windup(s); /* align on byte boundary */ put_short(s, (ush)stored_len); put_short(s, (ush)~stored_len); - zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); + if (stored_len) + zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); s->pending += stored_len; #ifdef ZLIB_DEBUG s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; s->bits_sent += 2*16; - s->bits_sent += stored_len<<3; + s->bits_sent += stored_len << 3; #endif } @@ -942,14 +943,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; + opt_lenb = (s->opt_len + 3 + 7) >> 3; + static_lenb = (s->static_len + 3 + 7) >> 3; Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); + s->sym_next / 3)); - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; +#ifndef FORCE_STATIC + if (static_lenb <= opt_lenb || s->strategy == Z_FIXED) +#endif + opt_lenb = static_lenb; } else { Assert(buf != (char*)0, "lost buf"); @@ -959,7 +963,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) #ifdef FORCE_STORED if (buf != (char*)0) { /* force stored block */ #else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { + if (stored_len + 4 <= opt_lenb && buf != (char*)0) { /* 4: two words for the lengths */ #endif /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. @@ -970,21 +974,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) */ _tr_stored_block(s, buf, stored_len, last); -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+last, 3); + } else if (static_lenb == opt_lenb) { + send_bits(s, (STATIC_TREES<<1) + last, 3); compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree); #ifdef ZLIB_DEBUG s->compressed_len += 3 + s->static_len; #endif } else { - send_bits(s, (DYN_TREES<<1)+last, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); + send_bits(s, (DYN_TREES<<1) + last, 3); + send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1, + max_blindex + 1); compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree); #ifdef ZLIB_DEBUG @@ -1003,21 +1003,22 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) s->compressed_len += 7; /* align on byte boundary */ #endif } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*last)); + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3, + s->compressed_len - 7*last)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ -int ZLIB_INTERNAL _tr_tally (s, dist, lc) +int ZLIB_INTERNAL _tr_tally(s, dist, lc) deflate_state *s; unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ + unsigned lc; /* match length - MIN_MATCH or unmatched char (dist==0) */ { - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; + s->sym_buf[s->sym_next++] = (uch)dist; + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); + s->sym_buf[s->sym_next++] = (uch)lc; if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; @@ -1029,33 +1030,10 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_ltree[_length_code[lc] + LITERALS + 1].Freq++; s->dyn_dtree[d_code(dist)].Freq++; } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ + return (s->sym_next == s->sym_end); } /* =========================================================================== @@ -1068,20 +1046,21 @@ local void compress_block(s, ltree, dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ + unsigned sx = 0; /* running index in sym_buf */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; + if (s->sym_next != 0) do { + dist = s->sym_buf[sx++] & 0xff; + dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; + lc = s->sym_buf[sx++]; if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ + send_code(s, code + LITERALS + 1, ltree); /* send length code */ extra = extra_lbits[code]; if (extra != 0) { lc -= base_length[code]; @@ -1099,11 +1078,10 @@ local void compress_block(s, ltree, dtree) } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); + /* Check that the overlay between pending_buf and sym_buf is ok: */ + Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); - } while (lx < s->last_lit); + } while (sx < s->sym_next); send_code(s, END_BLOCK, ltree); } @@ -1112,9 +1090,9 @@ local void compress_block(s, ltree, dtree) * Check if the data type is TEXT or BINARY, using the following algorithm: * - TEXT if the two conditions below are satisfied: * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). + * "block list" (0..6, 14..25, 28..31). * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). * - BINARY otherwise. * - The following partially-portable control characters form a * "gray list" that is ignored in this detection algorithm: @@ -1124,19 +1102,19 @@ local void compress_block(s, ltree, dtree) local int detect_data_type(s) deflate_state *s; { - /* black_mask is the bit mask of black-listed bytes + /* block_mask is the bit mask of block-listed bytes * set bits 0..6, 14..25, and 28..31 * 0xf3ffc07f = binary 11110011111111111100000001111111 */ - unsigned long black_mask = 0xf3ffc07fUL; + unsigned long block_mask = 0xf3ffc07fUL; int n; - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>= 1) - if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + /* Check for non-textual ("block-listed") bytes. */ + for (n = 0; n <= 31; n++, block_mask >>= 1) + if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0)) return Z_BINARY; - /* Check for textual ("white-listed") bytes. */ + /* Check for textual ("allow-listed") bytes. */ if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0) return Z_TEXT; @@ -1144,7 +1122,7 @@ local int detect_data_type(s) if (s->dyn_ltree[n].Freq != 0) return Z_TEXT; - /* There are no "black-listed" or "white-listed" bytes: + /* There are no "block-listed" or "allow-listed" bytes: * this stream either is empty or has tolerated ("gray-listed") bytes only. */ return Z_BINARY; @@ -1198,6 +1176,6 @@ local void bi_windup(s) s->bi_buf = 0; s->bi_valid = 0; #ifdef ZLIB_DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; + s->bits_sent = (s->bits_sent + 7) & ~7; #endif } diff --git a/src/mono/mono/zlib/uncompr.c b/src/mono/mono/zlib/uncompr.c index f03a1a865e347d..f9532f46c1a69f 100644 --- a/src/mono/mono/zlib/uncompr.c +++ b/src/mono/mono/zlib/uncompr.c @@ -24,7 +24,7 @@ Z_DATA_ERROR if the input data was corrupted, including if the input data is an incomplete zlib stream. */ -int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) +int ZEXPORT uncompress2(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -83,7 +83,7 @@ int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) err; } -int ZEXPORT uncompress (dest, destLen, source, sourceLen) +int ZEXPORT uncompress(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; diff --git a/src/mono/mono/zlib/zconf.h b/src/mono/mono/zlib/zconf.h index 5e1d68a004e974..bf977d3e70adef 100644 --- a/src/mono/mono/zlib/zconf.h +++ b/src/mono/mono/zlib/zconf.h @@ -38,6 +38,9 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound @@ -349,6 +352,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -467,11 +473,18 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ diff --git a/src/mono/mono/zlib/zlib.h b/src/mono/mono/zlib/zlib.h index f09cdaf1e0543d..953cb5012dc203 100644 --- a/src/mono/mono/zlib/zlib.h +++ b/src/mono/mono/zlib/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11, January 15th, 2017 + version 1.2.13, October 13th, 2022 - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.11" -#define ZLIB_VERNUM 0x12b0 +#define ZLIB_VERSION "1.2.13" +#define ZLIB_VERNUM 0x12d0 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 11 +#define ZLIB_VER_REVISION 13 #define ZLIB_VER_SUBREVISION 0 /* @@ -276,7 +276,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more ouput + which can be used if desired to determine whether or not there is more output in that case. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to @@ -543,8 +543,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int strategy)); This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by the - caller. + fields zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. @@ -661,7 +660,7 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If deflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. deflateGetDictionary() may return a length less than the window size, even when more than the window size in input has been provided. It may return up @@ -712,11 +711,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does not have enough output space to complete, then the parameter change will not @@ -865,9 +865,11 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see - below), inflate() will not automatically decode concatenated gzip streams. - inflate() will return Z_STREAM_END at the end of the gzip stream. The state - would need to be reset to continue decoding a subsequent gzip stream. + below), inflate() will *not* automatically decode concatenated gzip members. + inflate() will return Z_STREAM_END at the end of the gzip member. The state + would need to be reset to continue decoding a subsequent gzip member. This + *must* be done if there is more data after a gzip member, in order for the + decompression to be compliant with the gzip standard (RFC 1952). inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the @@ -913,7 +915,7 @@ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If inflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. @@ -1302,14 +1304,14 @@ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ /* ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); - Opens a gzip (.gz) file for reading or writing. The mode parameter is as - in fopen ("rb" or "wb") but can also include a compression level ("wb9") or - a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only - compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' - for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) 'T' will - request transparent writing or appending with no compression and not using - the gzip format. + Open the gzip (.gz) file at path for reading and decompressing, or + compressing and writing. The mode parameter is as in fopen ("rb" or "wb") + but can also include a compression level ("wb9") or a strategy: 'f' for + filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", + 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression + as in "wb9F". (See the description of deflateInit2 for more information + about the strategy parameter.) 'T' will request transparent writing or + appending with no compression and not using the gzip format. "a" can be used instead of "w" to request that the gzip stream that will be written be appended to the file. "+" will result in an error, since @@ -1339,9 +1341,9 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* - gzdopen associates a gzFile with the file descriptor fd. File descriptors - are obtained from calls like open, dup, creat, pipe or fileno (if the file - has been previously opened with fopen). The mode parameter is as in gzopen. + Associate a gzFile with the file descriptor fd. File descriptors are + obtained from calls like open, dup, creat, pipe or fileno (if the file has + been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor @@ -1362,13 +1364,13 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); /* - Set the internal buffer size used by this library's functions. The - default buffer size is 8192 bytes. This function must be called after - gzopen() or gzdopen(), and before any other calls that read or write the - file. The buffer memory allocation is always deferred to the first read or - write. Three times that size in buffer space is allocated. A larger buffer - size of, for example, 64K or 128K bytes will noticeably increase the speed - of decompression (reading). + Set the internal buffer size used by this library's functions for file to + size. The default buffer size is 8192 bytes. This function must be called + after gzopen() or gzdopen(), and before any other calls that read or write + the file. The buffer memory allocation is always deferred to the first read + or write. Three times that size in buffer space is allocated. A larger + buffer size of, for example, 64K or 128K bytes will noticeably increase the + speed of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). @@ -1378,9 +1380,9 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. Previously provided - data is flushed before the parameter change. + Dynamically update the compression level and strategy for file. See the + description of deflateInit2 for the meaning of these parameters. Previously + provided data is flushed before applying the parameter changes. gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not opened for writing, Z_ERRNO if there is an error writing the flushed data, @@ -1389,7 +1391,7 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* - Reads the given number of uncompressed bytes from the compressed file. If + Read and decompress up to len uncompressed bytes from file into buf. If the input file is not in gzip format, gzread copies the given number of bytes into the buffer directly from the file. @@ -1420,11 +1422,11 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, gzFile file)); /* - Read up to nitems items of size size from file to buf, otherwise operating - as gzread() does. This duplicates the interface of stdio's fread(), with - size_t request and return types. If the library defines size_t, then - z_size_t is identical to size_t. If not, then z_size_t is an unsigned - integer type that can contain a pointer. + Read and decompress up to nitems items of size size from file into buf, + otherwise operating as gzread() does. This duplicates the interface of + stdio's fread(), with size_t request and return types. If the library + defines size_t, then z_size_t is identical to size_t. If not, then z_size_t + is an unsigned integer type that can contain a pointer. gzfread() returns the number of full items read of size size, or zero if the end of the file was reached and a full item could not be read, or if @@ -1435,26 +1437,24 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, In the event that the end of file is reached and only a partial item is available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevetheless read into buf + multiple of size, then the final partial item is nevertheless read into buf and the end-of-file flag is set. The length of the partial item read is not provided, but could be inferred from the result of gztell(). This behavior is the same as the behavior of fread() implementations in common libraries, but it prevents the direct use of gzfread() to read a concurrently written - file, reseting and retrying on end-of-file, when size is not 1. + file, resetting and retrying on end-of-file, when size is not 1. */ -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); /* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes written or 0 in case of - error. + Compress and write the len uncompressed bytes at buf to file. gzwrite + returns the number of uncompressed bytes written or 0 in case of error. */ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, z_size_t nitems, gzFile file)); /* - gzfwrite() writes nitems items of size size from buf to file, duplicating + Compress and write nitems items of size size from buf to file, duplicating the interface of stdio's fwrite(), with size_t request and return types. If the library defines size_t, then z_size_t is identical to size_t. If not, then z_size_t is an unsigned integer type that can contain a pointer. @@ -1467,22 +1467,22 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); /* - Converts, formats, and writes the arguments to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of + Convert, format, compress, and write the arguments (...) to file under + control of the string format, as in fprintf. gzprintf returns the number of uncompressed bytes actually written, or a negative zlib error code in case of error. The number of uncompressed bytes written is limited to 8191, or one less than the buffer size given to gzbuffer(). The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() + zlib was compiled with the insecure functions sprintf() or vsprintf(), because the secure snprintf() or vsnprintf() functions were not available. This can be determined using zlibCompileFlags(). */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* - Writes the given null-terminated string to the compressed file, excluding + Compress and write the given null-terminated string s to file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. @@ -1490,11 +1490,12 @@ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* - Reads bytes from the compressed file until len-1 characters are read, or a - newline character is read and transferred to buf, or an end-of-file - condition is encountered. If any characters are read or if len == 1, the - string is terminated with a null character. If no characters are read due - to an end-of-file or len < 1, then the buffer is left untouched. + Read and decompress bytes from file into buf, until len-1 characters are + read, or until a newline character is read and transferred to buf, or an + end-of-file condition is encountered. If any characters are read or if len + is one, the string is terminated with a null character. If no characters + are read due to an end-of-file or len is less than one, then the buffer is + left untouched. gzgets returns buf which is a null-terminated string, or it returns NULL for end-of-file or in case of error. If there was an error, the contents at @@ -1503,13 +1504,13 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* - Writes c, converted to an unsigned char, into the compressed file. gzputc + Compress and write c, converted to an unsigned char, into file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* - Reads one byte from the compressed file. gzgetc returns this byte or -1 + Read and decompress one byte from file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. it does not check to see if file is NULL, nor whether the structure file @@ -1518,8 +1519,8 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); /* - Push one character back onto the stream to be read as the first character - on the next read. At least one character of push-back is allowed. + Push c back onto the stream for file to be read as the first character on + the next read. At least one character of push-back is always allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if c is -1, and may fail if a character has been pushed but not read yet. If gzungetc is used immediately after gzopen or gzdopen, at least the @@ -1530,9 +1531,9 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* - Flushes all pending output into the compressed file. The parameter flush - is as in the deflate() function. The return value is the zlib error number - (see function gzerror below). gzflush is only permitted when writing. + Flush all pending output to file. The parameter flush is as in the + deflate() function. The return value is the zlib error number (see function + gzerror below). gzflush is only permitted when writing. If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new @@ -1547,8 +1548,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the + Set the starting position to offset relative to whence for the next gzread + or gzwrite on file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. @@ -1565,18 +1566,18 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* - Rewinds the given file. This function is supported only for reading. + Rewind file. This function is supported only for reading. - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET). */ /* ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); - Returns the starting position for the next gzread or gzwrite on the given - compressed file. This position represents a number of bytes in the - uncompressed data stream, and is zero when starting, even if appending or - reading a gzip stream from the middle of a file using gzdopen(). + Return the starting position for the next gzread or gzwrite on file. + This position represents a number of bytes in the uncompressed data stream, + and is zero when starting, even if appending or reading a gzip stream from + the middle of a file using gzdopen(). gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ @@ -1584,22 +1585,22 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); /* ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); - Returns the current offset in the file being read or written. This offset - includes the count of bytes that precede the gzip stream, for example when - appending or when using gzdopen() for reading. When reading, the offset - does not include as yet unused buffered input. This information can be used - for a progress indicator. On error, gzoffset() returns -1. + Return the current compressed (actual) read or write offset of file. This + offset includes the count of bytes that precede the gzip stream, for example + when appending or when using gzdopen() for reading. When reading, the + offset does not include as yet unused buffered input. This information can + be used for a progress indicator. On error, gzoffset() returns -1. */ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* - Returns true (1) if the end-of-file indicator has been set while reading, - false (0) otherwise. Note that the end-of-file indicator is set only if the - read tried to go past the end of the input, but came up short. Therefore, - just like feof(), gzeof() may return false even if there is no more data to - read, in the event that the last read request was for the exact number of - bytes remaining in the input file. This will happen if the input file size - is an exact multiple of the buffer size. + Return true (1) if the end-of-file indicator for file has been set while + reading, false (0) otherwise. Note that the end-of-file indicator is set + only if the read tried to go past the end of the input, but came up short. + Therefore, just like feof(), gzeof() may return false even if there is no + more data to read, in the event that the last read request was for the exact + number of bytes remaining in the input file. This will happen if the input + file size is an exact multiple of the buffer size. If gzeof() returns true, then the read functions will return no more data, unless the end-of-file indicator is reset by gzclearerr() and the input file @@ -1608,7 +1609,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* - Returns true (1) if file is being copied directly while reading, or false + Return true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed. If the input file is empty, gzdirect() will return true, since the input @@ -1629,8 +1630,8 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* - Flushes all pending output if necessary, closes the compressed file and - deallocates the (de)compression state. Note that once file is closed, you + Flush all pending output for file, if necessary, close file and + deallocate the (de)compression state. Note that once file is closed, you cannot call gzerror with file, since its structures have been deallocated. gzclose must not be called more than once on the same file, just as free must not be called more than once on the same allocation. @@ -1654,10 +1655,10 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* - Returns the error message for the last error which occurred on the given - compressed file. errnum is set to zlib error number. If an error occurred - in the file system and not in the compression library, errnum is set to - Z_ERRNO and the application may consult errno to get the exact error code. + Return the error message for the last error which occurred on file. + errnum is set to zlib error number. If an error occurred in the file system + and not in the compression library, errnum is set to Z_ERRNO and the + application may consult errno to get the exact error code. The application must not modify the returned string. Future calls to this function may invalidate the previously returned string. If file is @@ -1670,7 +1671,7 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); /* - Clears the error and end-of-file flags for file. This is analogous to the + Clear the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ @@ -1688,8 +1689,9 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. + return the updated checksum. An Adler-32 value is in the range of a 32-bit + unsigned integer. If buf is Z_NULL, this function returns the required + initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed much faster. @@ -1722,12 +1724,13 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, negative, the result has no meaning or utility. */ -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. + updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. + If buf is Z_NULL, this function returns the required initial value for the + crc. Pre- and post-conditioning (one's complement) is performed within this + function so it shouldn't be done by the application. Usage example: @@ -1739,7 +1742,7 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); if (crc != original_crc) error(); */ -ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, +ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf, z_size_t len)); /* Same as crc32(), but with a size_t length. @@ -1755,6 +1758,20 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); len2. */ +/* +ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2)); + + Return the operator corresponding to length len2, to be used with + crc32_combine_op(). +*/ + +ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op)); +/* + Give the same result as crc32_combine(), using op in place of len2. op is + is generated from len2 by crc32_combine_gen(). This will be faster than + crc32_combine() if the generated op is used more than once. +*/ + /* various hacks, don't look :) */ @@ -1842,6 +1859,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off64_t)); #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) @@ -1852,6 +1870,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define z_gzoffset z_gzoffset64 # define z_adler32_combine z_adler32_combine64 # define z_crc32_combine z_crc32_combine64 +# define z_crc32_combine_gen z_crc32_combine_gen64 # else # define gzopen gzopen64 # define gzseek gzseek64 @@ -1859,6 +1878,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 +# define crc32_combine_gen crc32_combine_gen64 # endif # ifndef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); @@ -1867,6 +1887,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t)); # endif #else ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); @@ -1875,12 +1896,14 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t)); #endif #else /* Z_SOLO */ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t)); #endif /* !Z_SOLO */ @@ -1890,10 +1913,10 @@ ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); -ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp)); ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); -#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) +#if defined(_WIN32) && !defined(Z_SOLO) ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, const char *mode)); #endif diff --git a/src/mono/mono/zlib/zutil.c b/src/mono/mono/zlib/zutil.c index a76c6b0c7e557f..9543ae825e3250 100644 --- a/src/mono/mono/zlib/zutil.c +++ b/src/mono/mono/zlib/zutil.c @@ -61,9 +61,11 @@ uLong ZEXPORT zlibCompileFlags() #ifdef ZLIB_DEBUG flags += 1 << 8; #endif + /* #if defined(ASMV) || defined(ASMINF) flags += 1 << 9; #endif + */ #ifdef ZLIB_WINAPI flags += 1 << 10; #endif @@ -119,7 +121,7 @@ uLong ZEXPORT zlibCompileFlags() # endif int ZLIB_INTERNAL z_verbose = verbose; -void ZLIB_INTERNAL z_error (m) +void ZLIB_INTERNAL z_error(m) char *m; { fprintf(stderr, "%s\n", m); @@ -136,8 +138,8 @@ const char * ZEXPORT zError(err) return ERR_MSG(err); } -#if defined(_WIN32_WCE) - /* The Microsoft C Run-Time Library for Windows CE doesn't have +#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 + /* The older Microsoft C Run-Time Library for Windows CE doesn't have * errno. We define it as a global variable to simplify porting. * Its value is always 0 and should not be used. */ @@ -214,7 +216,7 @@ local ptr_table table[MAX_PTR]; * a protected system like OS/2. Use Microsoft C instead. */ -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { voidpf buf; ulg bsize = (ulg)items*size; @@ -240,7 +242,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) return buf; } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { int n; @@ -277,13 +279,13 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) # define _hfree hfree #endif -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) { (void)opaque; return _halloc((long)items, size); } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { (void)opaque; _hfree(ptr); @@ -302,7 +304,7 @@ extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif -voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) +voidpf ZLIB_INTERNAL zcalloc(opaque, items, size) voidpf opaque; unsigned items; unsigned size; @@ -312,7 +314,7 @@ voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) (voidpf)calloc(items, size); } -void ZLIB_INTERNAL zcfree (opaque, ptr) +void ZLIB_INTERNAL zcfree(opaque, ptr) voidpf opaque; voidpf ptr; { diff --git a/src/mono/mono/zlib/zutil.h b/src/mono/mono/zlib/zutil.h index b079ea6a80f5ab..0bc7f4ecd1c0e5 100644 --- a/src/mono/mono/zlib/zutil.h +++ b/src/mono/mono/zlib/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -29,10 +29,6 @@ # include #endif -#ifdef Z_SOLO - typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ -#endif - #ifndef local # define local static #endif @@ -46,6 +42,17 @@ typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; +#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC) +# include +# if (ULONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long +# elif (ULLONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long long +# elif (UINT_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned +# endif +#endif + extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ @@ -170,10 +177,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX # if defined(_WIN32_WCE) # define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif # else # define fdopen(fd,type) _fdopen(fd,type) # endif @@ -190,6 +193,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t)); #endif /* common defaults */ diff --git a/src/mono/nuget/Directory.Build.props b/src/mono/nuget/Directory.Build.props index e4a7e0f90ba31e..7b96c763867037 100644 --- a/src/mono/nuget/Directory.Build.props +++ b/src/mono/nuget/Directory.Build.props @@ -14,8 +14,9 @@ true - 6.0.0 + $(ProductVersion) $(PackageVersion) + diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets index fcf1ff70d9a8f5..029a79028ea696 100644 --- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets @@ -115,4 +115,13 @@ Text="_MonoComponent item list includes components '@(_MonoRuntimeSelectedMissingComponents)' which are not defined in the runtime pack. Runtime pack includes '@(_MonoRuntimeComponentNameForRid)'" /> + + + + + + + diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/Microsoft.NET.Workload.Mono.Toolchain.Manifest.pkgproj b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/Microsoft.NET.Workload.Mono.Toolchain.Manifest.pkgproj index 747da02070f2f9..940dd5cd4f3bfc 100644 --- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/Microsoft.NET.Workload.Mono.Toolchain.Manifest.pkgproj +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/Microsoft.NET.Workload.Mono.Toolchain.Manifest.pkgproj @@ -20,6 +20,12 @@ + + + + data/localize + + @@ -31,6 +37,7 @@ <_WorkloadManifestValues Include="WorkloadVersion" Value="$(PackageVersion)" /> <_WorkloadManifestValues Include="PackageVersion" Value="$(PackageVersion)" /> + <_WorkloadManifestValues Include="NetCoreAppCurrent" Value="$(NetCoreAppCurrent)" /> <_WorkloadManifestValues Include="EmscriptenVersion" Value="$(MicrosoftNETRuntimeEmscriptenVersion)" /> diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in index e34ff6d173b85a..13c313fe8e9f9b 100644 --- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in @@ -7,91 +7,91 @@ "wasm-tools": { "description": ".NET WebAssembly build tools", "packs": [ - "Microsoft.NET.Runtime.WebAssembly.Sdk", - "Microsoft.NETCore.App.Runtime.Mono.browser-wasm", - "Microsoft.NETCore.App.Runtime.AOT.Cross.browser-wasm" + "Microsoft.NET.Runtime.WebAssembly.Sdk.net6", + "Microsoft.NETCore.App.Runtime.Mono.net6.browser-wasm", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.browser-wasm" ], "extends": [ "microsoft-net-runtime-mono-tooling", "microsoft-net-sdk-emscripten" ], - "platforms": [ "win-x64", "linux-x64", "osx-x64", "osx-arm64" ] + "platforms": [ "win-x64", "win-arm64", "linux-x64", "osx-x64", "osx-arm64" ] }, "microsoft-net-runtime-android": { "abstract": true, "description": "Android Mono Runtime", "packs": [ - "Microsoft.NETCore.App.Runtime.Mono.android-arm", - "Microsoft.NETCore.App.Runtime.Mono.android-arm64", - "Microsoft.NETCore.App.Runtime.Mono.android-x64", - "Microsoft.NETCore.App.Runtime.Mono.android-x86" + "Microsoft.NETCore.App.Runtime.Mono.net6.android-arm", + "Microsoft.NETCore.App.Runtime.Mono.net6.android-arm64", + "Microsoft.NETCore.App.Runtime.Mono.net6.android-x64", + "Microsoft.NETCore.App.Runtime.Mono.net6.android-x86" ], "extends": [ "microsoft-net-runtime-mono-tooling" ], - "platforms": [ "win-x64", "linux-x64", "osx-x64", "osx-arm64" ] + "platforms": [ "win-x64", "win-arm64", "linux-x64", "osx-x64", "osx-arm64" ] }, "microsoft-net-runtime-android-aot": { "abstract": true, "description": "Android Mono AOT Workload", "packs": [ - "Microsoft.NETCore.App.Runtime.AOT.Cross.android-x86", - "Microsoft.NETCore.App.Runtime.AOT.Cross.android-x64", - "Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm", - "Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm64" + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.android-x86", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.android-x64", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.android-arm", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.android-arm64" ], "extends": [ "microsoft-net-runtime-android" ], - "platforms": [ "win-x64", "linux-x64", "osx-x64", "osx-arm64" ] + "platforms": [ "win-x64", "win-arm64", "linux-x64", "osx-x64", "osx-arm64" ] }, "microsoft-net-runtime-ios": { "abstract": true, "description": "iOS Mono Runtime and AOT Workload", "packs": [ - "Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm", - "Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64", - "Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-arm64", - "Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x64", - "Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x86" + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.ios-arm", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.ios-arm64", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.iossimulator-arm64", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.iossimulator-x64", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.iossimulator-x86" ], "extends": [ "runtimes-ios" ], - "platforms": [ "win-x64", "osx-arm64", "osx-x64" ] + "platforms": [ "win-x64", "win-arm64", "osx-arm64", "osx-x64" ] }, "runtimes-ios": { "abstract": true, "description": "iOS Mono Runtime Packs", "packs": [ - "Microsoft.NETCore.App.Runtime.Mono.ios-arm", - "Microsoft.NETCore.App.Runtime.Mono.ios-arm64", - "Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64", - "Microsoft.NETCore.App.Runtime.Mono.iossimulator-x64", - "Microsoft.NETCore.App.Runtime.Mono.iossimulator-x86" + "Microsoft.NETCore.App.Runtime.Mono.net6.ios-arm", + "Microsoft.NETCore.App.Runtime.Mono.net6.ios-arm64", + "Microsoft.NETCore.App.Runtime.Mono.net6.iossimulator-arm64", + "Microsoft.NETCore.App.Runtime.Mono.net6.iossimulator-x64", + "Microsoft.NETCore.App.Runtime.Mono.net6.iossimulator-x86" ], "extends": [ "microsoft-net-runtime-mono-tooling" ], - "platforms": [ "win-x64", "osx-arm64", "osx-x64" ] + "platforms": [ "win-x64", "win-arm64", "osx-arm64", "osx-x64" ] }, "microsoft-net-runtime-maccatalyst": { "abstract": true, "description": "MacCatalyst Mono Runtime and AOT Workload", "packs": [ - "Microsoft.NETCore.App.Runtime.AOT.Cross.maccatalyst-arm64", - "Microsoft.NETCore.App.Runtime.AOT.Cross.maccatalyst-x64" + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.maccatalyst-arm64", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.maccatalyst-x64" ], "extends": [ "runtimes-maccatalyst" ], - "platforms": [ "win-x64", "osx-arm64", "osx-x64" ] + "platforms": [ "win-x64", "win-arm64", "osx-arm64", "osx-x64" ] }, "runtimes-maccatalyst": { "abstract": true, "description": "MacCatalyst Mono Runtime Packs", "packs": [ - "Microsoft.NETCore.App.Runtime.Mono.maccatalyst-arm64", - "Microsoft.NETCore.App.Runtime.Mono.maccatalyst-x64" + "Microsoft.NETCore.App.Runtime.Mono.net6.maccatalyst-arm64", + "Microsoft.NETCore.App.Runtime.Mono.net6.maccatalyst-x64" ], "extends": [ "microsoft-net-runtime-mono-tooling" ], - "platforms": [ "win-x64", "osx-arm64", "osx-x64" ] + "platforms": [ "win-x64", "win-arm64", "osx-arm64", "osx-x64" ] }, "microsoft-net-runtime-macos": { "abstract": true, "description": "MacOS CoreCLR and Mono Runtime Workload", "packs": [ - "Microsoft.NETCore.App.Runtime.Mono.osx-arm64", - "Microsoft.NETCore.App.Runtime.Mono.osx-x64", - "Microsoft.NETCore.App.Runtime.osx-arm64", - "Microsoft.NETCore.App.Runtime.osx-x64" + "Microsoft.NETCore.App.Runtime.Mono.net6.osx-arm64", + "Microsoft.NETCore.App.Runtime.Mono.net6.osx-x64", + "Microsoft.NETCore.App.Runtime.net6.osx-arm64", + "Microsoft.NETCore.App.Runtime.net6.osx-x64" ], "extends": [ "microsoft-net-runtime-mono-tooling" ], "platforms": [ "osx-arm64", "osx-x64" ] @@ -100,167 +100,243 @@ "abstract": true, "description": "tvOS Mono Runtime and AOT Workload", "packs": [ - "Microsoft.NETCore.App.Runtime.AOT.Cross.tvos-arm64", - "Microsoft.NETCore.App.Runtime.AOT.Cross.tvossimulator-arm64", - "Microsoft.NETCore.App.Runtime.AOT.Cross.tvossimulator-x64" + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.tvos-arm64", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.tvossimulator-arm64", + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.tvossimulator-x64" ], "extends": [ "runtimes-tvos" ], - "platforms": [ "win-x64", "osx-arm64", "osx-x64" ] + "platforms": [ "win-x64", "win-arm64", "osx-arm64", "osx-x64" ] }, "runtimes-tvos": { "abstract": true, "description": "tvOS Mono Runtime Packs", "packs": [ - "Microsoft.NETCore.App.Runtime.Mono.tvos-arm64", - "Microsoft.NETCore.App.Runtime.Mono.tvossimulator-arm64", - "Microsoft.NETCore.App.Runtime.Mono.tvossimulator-x64" + "Microsoft.NETCore.App.Runtime.Mono.net6.tvos-arm64", + "Microsoft.NETCore.App.Runtime.Mono.net6.tvossimulator-arm64", + "Microsoft.NETCore.App.Runtime.Mono.net6.tvossimulator-x64" ], "extends": [ "microsoft-net-runtime-mono-tooling" ], - "platforms": [ "win-x64", "osx-arm64", "osx-x64" ] + "platforms": [ "win-x64", "win-arm64", "osx-arm64", "osx-x64" ] + }, + "runtimes-windows": { + "description": "Windows Runtime Packs", + "packs": [ + "Microsoft.NETCore.App.Runtime.net6.win-x64", + "Microsoft.NETCore.App.Runtime.net6.win-x86", + "Microsoft.NETCore.App.Runtime.net6.win-arm", + "Microsoft.NETCore.App.Runtime.net6.win-arm64" + ] }, "microsoft-net-runtime-mono-tooling": { "abstract": true, "description": "Shared native build tooling for Mono runtime", "packs": [ - "Microsoft.NET.Runtime.MonoAOTCompiler.Task", - "Microsoft.NET.Runtime.MonoTargets.Sdk", + "Microsoft.NET.Runtime.MonoAOTCompiler.Task.net6", + "Microsoft.NET.Runtime.MonoTargets.Sdk.net6", ], } }, "packs": { - "Microsoft.NET.Runtime.MonoAOTCompiler.Task": { + "Microsoft.NET.Runtime.MonoAOTCompiler.Task.net6": { "kind": "Sdk", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NET.Runtime.MonoAOTCompiler.Task" + } }, - "Microsoft.NET.Runtime.MonoTargets.Sdk": { + "Microsoft.NET.Runtime.MonoTargets.Sdk.net6": { "kind": "Sdk", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NET.Runtime.MonoTargets.Sdk" + } }, - "Microsoft.NET.Runtime.WebAssembly.Sdk": { + "Microsoft.NET.Runtime.WebAssembly.Sdk.net6": { "kind": "Sdk", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NET.Runtime.WebAssembly.Sdk" + } }, - "Microsoft.NETCore.App.Runtime.Mono.android-arm": { + "Microsoft.NETCore.App.Runtime.Mono.net6.android-arm": { "kind": "framework", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.android-arm" + } }, - "Microsoft.NETCore.App.Runtime.Mono.android-arm64": { + "Microsoft.NETCore.App.Runtime.Mono.net6.android-arm64": { "kind": "framework", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.android-arm64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.android-x64": { + "Microsoft.NETCore.App.Runtime.Mono.net6.android-x64": { "kind": "framework", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.android-x64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.android-x86": { + "Microsoft.NETCore.App.Runtime.Mono.net6.android-x86": { "kind": "framework", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.android-x86" + } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.android-x86": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.android-x86": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { "win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x86", + "win-arm64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x86", "linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-x86", "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-x86", "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-x86" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.android-x64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.android-x64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { "win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x64", + "win-arm64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x64", "linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-x64", "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-x64", "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-x64" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.android-arm": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { "win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm", + "win-arm64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm", "linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-arm", "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-arm", "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-arm" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.android-arm64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { "win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64", + "win-arm64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64", "linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-arm64", "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-arm64", "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.android-arm64" } }, - "Microsoft.NETCore.App.Runtime.Mono.maccatalyst-arm64": { + "Microsoft.NETCore.App.Runtime.Mono.net6.maccatalyst-arm64": { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.maccatalyst-arm64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.maccatalyst-x64": { + "Microsoft.NETCore.App.Runtime.Mono.net6.maccatalyst-x64": { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.maccatalyst-x64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.osx-arm64": { + "Microsoft.NETCore.App.Runtime.Mono.net6.osx-arm64": { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.osx-arm64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.osx-x64": { + "Microsoft.NETCore.App.Runtime.Mono.net6.osx-x64": { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.osx-x64" + } }, - "Microsoft.NETCore.App.Runtime.osx-arm64": { + "Microsoft.NETCore.App.Runtime.net6.osx-arm64": { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.net6.osx-arm64" + } }, - "Microsoft.NETCore.App.Runtime.osx-x64": { + "Microsoft.NETCore.App.Runtime.net6.osx-x64": { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.net6.osx-x64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.ios-arm" : { + "Microsoft.NETCore.App.Runtime.Mono.net6.ios-arm" : { "kind": "framework", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.ios-arm" + } }, - "Microsoft.NETCore.App.Runtime.Mono.ios-arm64" : { + "Microsoft.NETCore.App.Runtime.Mono.net6.ios-arm64" : { "kind": "framework", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.ios-arm64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64" : { + "Microsoft.NETCore.App.Runtime.Mono.net6.iossimulator-arm64" : { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.iossimulator-arm64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.iossimulator-x64" : { + "Microsoft.NETCore.App.Runtime.Mono.net6.iossimulator-x64" : { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.iossimulator-x64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.iossimulator-x86" : { + "Microsoft.NETCore.App.Runtime.Mono.net6.iossimulator-x86" : { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.iossimulator-x86" + } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.tvos-arm64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.tvos-arm64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvos-arm64", - "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvos-arm64", + "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvos-arm64" } }, - "Microsoft.NETCore.App.Runtime.Mono.tvos-arm64" : { + "Microsoft.NETCore.App.Runtime.Mono.net6.tvos-arm64" : { "kind": "framework", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.tvos-arm64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.tvossimulator-arm64" : { + "Microsoft.NETCore.App.Runtime.Mono.net6.tvossimulator-arm64" : { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.tvossimulator-arm64" + } }, - "Microsoft.NETCore.App.Runtime.Mono.tvossimulator-x64" : { + "Microsoft.NETCore.App.Runtime.Mono.net6.tvossimulator-x64" : { "kind": "framework", "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.tvossimulator-x64" + } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.maccatalyst-arm64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.maccatalyst-arm64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { @@ -268,7 +344,7 @@ "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-arm64" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.maccatalyst-x64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.maccatalyst-x64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { @@ -276,7 +352,7 @@ "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.maccatalyst-x64" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.tvossimulator-arm64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.tvossimulator-arm64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { @@ -284,7 +360,7 @@ "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvossimulator-arm64" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.tvossimulator-x64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.tvossimulator-x64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { @@ -292,7 +368,7 @@ "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvossimulator-x64" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.ios-arm": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { @@ -300,7 +376,7 @@ "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm", } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.ios-arm64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.ios-arm64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { @@ -308,7 +384,7 @@ "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64", } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-arm64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.iossimulator-arm64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { @@ -316,7 +392,7 @@ "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-arm64" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x64": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.iossimulator-x64": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { @@ -324,7 +400,7 @@ "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-x64" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.iossimulator-x86": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.iossimulator-x86": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { @@ -332,19 +408,51 @@ "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.iossimulator-x86" } }, - "Microsoft.NETCore.App.Runtime.AOT.Cross.browser-wasm": { + "Microsoft.NETCore.App.Runtime.AOT.Cross.net6.browser-wasm": { "kind": "Sdk", "version": "${PackageVersion}", "alias-to": { "win-x64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm", + "win-arm64": "Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm", "linux-x64": "Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.browser-wasm", "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.browser-wasm", "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.browser-wasm" } }, - "Microsoft.NETCore.App.Runtime.Mono.browser-wasm" : { + "Microsoft.NETCore.App.Runtime.Mono.net6.browser-wasm" : { + "kind": "framework", + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.Mono.browser-wasm" + } + }, + "Microsoft.NETCore.App.Runtime.net6.win-x64" : { + "kind": "framework", + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.win-x64" + } + }, + "Microsoft.NETCore.App.Runtime.net6.win-x86" : { "kind": "framework", - "version": "${PackageVersion}" + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.win-x86" + } }, + "Microsoft.NETCore.App.Runtime.net6.win-arm" : { + "kind": "framework", + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.win-arm" + } + }, + "Microsoft.NETCore.App.Runtime.net6.win-arm64" : { + "kind": "framework", + "version": "${PackageVersion}", + "alias-to": { + "any": "Microsoft.NETCore.App.Runtime.win-arm64" + } + } } } diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in index d9a9dc2a72d463..f16f1b59839d92 100644 --- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets.in @@ -7,13 +7,9 @@ !$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '6.0'))">true - - <_NativeBuildNeeded Condition="'$(RunAOTCompilation)' == 'true'">true - WebAssembly workloads (required for AOT) are only supported for projects targeting net6.0+ - - - true + + true $(WasmNativeWorkload) @@ -27,66 +23,66 @@ true - + - - + + - - - - + + + + - - + + - - + + - - - - - + + + + + - - + + - - + + - - + + - - - + + + - - - - + + + + @@ -95,40 +91,26 @@ - - - - + + $(_MonoWorkloadRuntimePackPackageVersion) + - - + + + + + + + + + + diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.cs.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.cs.json new file mode 100644 index 00000000000000..da1ee8979a0a73 --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.cs.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": "Nástroje pro sestavení .NET WebAssembly" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.de.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.de.json new file mode 100644 index 00000000000000..3d4467d7b055eb --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.de.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": ".NET WebAssembly-Buildtools" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.en.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.en.json new file mode 100644 index 00000000000000..a6dcccedcf59ff --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.en.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": ".NET WebAssembly build tools" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.es.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.es.json new file mode 100644 index 00000000000000..166e1db9fe8162 --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.es.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": "Herramientas de compilación de WebAssembly de .NET" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.fr.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.fr.json new file mode 100644 index 00000000000000..e660e45a264dbe --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.fr.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": "Outils de construction .NET WebAssembly" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.it.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.it.json new file mode 100644 index 00000000000000..6703c0025606b4 --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.it.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": "Strumenti di compilazione WebAssembly .NET" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.ja.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.ja.json new file mode 100644 index 00000000000000..fd3fe984155ab5 --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.ja.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": ".NET WebAssembly ビルド ツール" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.ko.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.ko.json new file mode 100644 index 00000000000000..c5261248ff6092 --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.ko.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": ".NET WebAssembly 빌드 도구" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.pl.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.pl.json new file mode 100644 index 00000000000000..858653c73b527a --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.pl.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": "Narzędzia kompilacji zestawu WebAssembly platformy .NET" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.pt-BR.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.pt-BR.json new file mode 100644 index 00000000000000..a8dceaf324f2cb --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.pt-BR.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": "Ferramentas de build do .NET WebAssembly" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.ru.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.ru.json new file mode 100644 index 00000000000000..102e67acdc2c21 --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.ru.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": "Средства сборки WebAssembly .NET" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.tr.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.tr.json new file mode 100644 index 00000000000000..34d4e3b66de92e --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.tr.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": ".NET WebAssembly derleme araçları" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.zh-Hans.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.zh-Hans.json new file mode 100644 index 00000000000000..360e1e5a5d1f03 --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.zh-Hans.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": ".NET WebAssembly 生成工具" +} \ No newline at end of file diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.zh-Hant.json b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.zh-Hant.json new file mode 100644 index 00000000000000..c5d85ecc0f5c04 --- /dev/null +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.zh-Hant.json @@ -0,0 +1,3 @@ +{ + "workloads/wasm-tools/description": ".NET WebAssembly 組建工具" +} \ No newline at end of file diff --git a/src/mono/nuget/mono-packages.proj b/src/mono/nuget/mono-packages.proj index a56c63f8827642..98b576787e8841 100644 --- a/src/mono/nuget/mono-packages.proj +++ b/src/mono/nuget/mono-packages.proj @@ -14,11 +14,18 @@ - - + + + + + + diff --git a/src/mono/sample/Android/AndroidSampleApp.csproj b/src/mono/sample/Android/AndroidSampleApp.csproj index 1abf7659bd0997..a5129bdfe82c68 100644 --- a/src/mono/sample/Android/AndroidSampleApp.csproj +++ b/src/mono/sample/Android/AndroidSampleApp.csproj @@ -72,6 +72,7 @@ AotModulesTablePath="$(_AotModulesTablePath)" ToolPrefix="$(_AotToolPrefix)" LibraryFormat="$(_AotLibraryFormat)" + IntermediateOutputPath="$(IntermediateOutputPath)" UseLLVM="$(UseLLVM)" LLVMPath="$(MonoAotCrossDir)"> diff --git a/src/mono/sample/iOS/Makefile b/src/mono/sample/iOS/Makefile index 34279c41d8187c..bdfc6c8f854b2b 100644 --- a/src/mono/sample/iOS/Makefile +++ b/src/mono/sample/iOS/Makefile @@ -4,6 +4,8 @@ DOTNET := ../../../../dotnet.sh USE_LLVM=true AOT?=false TARGET?=iOSSimulator +DEPLOY_AND_RUN?=true +APP_SANDBOX?=false #If DIAGNOSTIC_PORTS is enabled, RUNTIME_COMPONENTS must also be enabled. #If RUNTIME_COMPONENTS is enabled, DIAGNOSTIC_PORTS is optional. @@ -31,6 +33,7 @@ run: clean appbuilder /p:UseLLVM=$(USE_LLVM) \ /p:ForceAOT=$(AOT) \ '/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \ + '/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \ '/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"' run-sim: clean appbuilder @@ -41,10 +44,12 @@ run-sim: clean appbuilder /p:UseLLVM=$(USE_LLVM) \ /p:ForceAOT=$(AOT) \ '/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \ + '/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \ '/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"' build-appbundle: clean appbuilder $(DOTNET) publish -c $(MONO_CONFIG) /p:TargetOS=$(TARGET) /p:TargetArchitecture=$(MONO_ARCH) \ + '/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \ /p:UseLLVM=$(USE_LLVM) /p:ForceAOT=$(AOT) /bl \ run-catalyst: @@ -52,8 +57,10 @@ run-catalyst: -c $(MONO_CONFIG) \ /p:TargetOS=MacCatalyst \ /p:TargetArchitecture=$(MONO_ARCH) \ + '/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \ /p:UseLLVM=False \ - /p:ForceAOT=True + /p:ForceAOT=True \ + /p:EnableAppSandbox=$(APP_SANDBOX) run-sim-interp: clean appbuilder $(DOTNET) publish \ @@ -63,6 +70,7 @@ run-sim-interp: clean appbuilder /p:UseLLVM=$(USE_LLVM) \ /p:ForceAOT=$(AOT) \ /p:MonoForceInterpreter=true \ + '/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \ '/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \ '/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"' @@ -72,7 +80,9 @@ run-catalyst-interp: /p:TargetOS=MacCatalyst \ /p:TargetArchitecture=$(MONO_ARCH) \ /p:UseLLVM=False \ + '/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \ /p:ForceAOT=True \ + /p:EnableAppSandbox=$(APP_SANDBOX) \ /p:MonoForceInterpreter=true clean: diff --git a/src/mono/sample/iOS/Program.csproj b/src/mono/sample/iOS/Program.csproj index 471abcbbe69c81..65f252e7e55221 100644 --- a/src/mono/sample/iOS/Program.csproj +++ b/src/mono/sample/iOS/Program.csproj @@ -5,6 +5,7 @@ $(NetCoreAppToolCurrent) iOS iOSSimulator + true $(TargetOS.ToLower())-$(TargetArchitecture) $(DefineConstants);CI_TEST @@ -17,6 +18,7 @@ adhoc + false @@ -59,6 +61,7 @@ AotModulesTablePath="$(AppDir)\modules.m" AotModulesTableLanguage="ObjC" OutputDir="$(PublishDir)" + IntermediateOutputPath="$(IntermediateOutputPath)" UseLLVM="$(UseLLVM)" LLVMPath="$(MonoAotCrossDir)"> @@ -79,6 +82,7 @@ ForceAOT="$(RunAOTCompilation)" ForceInterpreter="$(MonoForceInterpreter)" RuntimeComponents="$(RuntimeComponents)" + EnableAppSandbox="$(EnableAppSandbox)" DiagnosticPorts="$(DiagnosticPorts)" AppDir="$(MSBuildThisFileDirectory)$(PublishDir)"> @@ -91,7 +95,7 @@ + Condition="'$(ArchiveTests)' != 'true' and '$(DeployAndRun)' == 'true'"> diff --git a/src/mono/sample/mbr/browser/WasmDelta.csproj b/src/mono/sample/mbr/browser/WasmDelta.csproj index 322a01ba8595a7..c150529f753c6d 100644 --- a/src/mono/sample/mbr/browser/WasmDelta.csproj +++ b/src/mono/sample/mbr/browser/WasmDelta.csproj @@ -31,7 +31,6 @@ - \%(_DeltaFileForPublish.Filename)%(_DeltaFileForPublish.Extension) diff --git a/src/mono/sample/wasm/Directory.Build.targets b/src/mono/sample/wasm/Directory.Build.targets index 492c61cf048467..bc7f6b24b0ba27 100644 --- a/src/mono/sample/wasm/Directory.Build.targets +++ b/src/mono/sample/wasm/Directory.Build.targets @@ -1,10 +1,5 @@ - - - - - Main(string[] args) } return args.Length; } -} \ No newline at end of file +} diff --git a/src/mono/sample/wasm/wasm.mk b/src/mono/sample/wasm/wasm.mk index 2eb4adcfb45853..e3405dbcc0d0d5 100644 --- a/src/mono/sample/wasm/wasm.mk +++ b/src/mono/sample/wasm/wasm.mk @@ -10,9 +10,12 @@ CONFIG?=Release WASM_DEFAULT_BUILD_ARGS?=/p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=$(CONFIG) -all: build +all: publish build: + EMSDK_PATH=$(realpath $(TOP)/src/mono/wasm/emsdk) $(DOTNET) build $(DOTNET_Q_ARGS) $(WASM_DEFAULT_BUILD_ARGS) $(MSBUILD_ARGS) $(PROJECT_NAME) + +publish: EMSDK_PATH=$(realpath $(TOP)/src/mono/wasm/emsdk) $(DOTNET) publish $(DOTNET_Q_ARGS) $(WASM_DEFAULT_BUILD_ARGS) $(MSBUILD_ARGS) $(PROJECT_NAME) clean: diff --git a/src/mono/wasm/Makefile b/src/mono/wasm/Makefile index 52e5de9e30227e..63e03b225468c7 100644 --- a/src/mono/wasm/Makefile +++ b/src/mono/wasm/Makefile @@ -72,7 +72,7 @@ MONO_LIBS = \ $(ICU_LIBDIR)/libicui18n.a EMCC_DEBUG_FLAGS =-g -Os -s -DDEBUG=1 -EMCC_RELEASE_FLAGS=-Oz +EMCC_RELEASE_FLAGS=-O2 ifeq ($(NOSTRIP),) STRIP_CMD=&& $(EMSDK_PATH)/upstream/bin/wasm-opt --strip-dwarf $(NATIVE_BIN_DIR)/dotnet.wasm -o $(NATIVE_BIN_DIR)/dotnet.wasm diff --git a/src/mono/wasm/build/README.md b/src/mono/wasm/build/README.md index 854ea041398fa0..312b5308645c39 100644 --- a/src/mono/wasm/build/README.md +++ b/src/mono/wasm/build/README.md @@ -1,3 +1,58 @@ +# Wasm app build + +This usually consists of taking the built assemblies, and related files, and generating an app bundle. + +Wasm app build can run in two scenarios: + +1. After build, eg. when running the app in VS, or `dotnet build foo.csproj` +2. For Publish, eg, when publishing the app to a folder, or Azure + +A dotnet wasm app has some native wasm files (`dotnet.wasm`, and `dotnet.js`). How these files are obtained, or generated: + +1. Build + a. with no native libraries referenced (AOT setting is ignored here) + - files from the runtime pack are used as-is + b. with native libraries referenced + - dotnet.wasm is relinked with the native libraries +2. Publish + - dotnet.wasm is relinked with the native libraries, and updated pinvoke/icalls from the trimmed assemblies + - if `RunAOTCompilation=true`, then the relinking includes AOT'ed assemblies + +## `Build` + +Implementation: + +- Target `WasmBuildApp` +- runs after `Build` by default + - which can be disabled by `$(DisableAutoWasmBuildApp)` + - or the run-after target can be set via `$(WasmBuildAppAfterThisTarget)` + +- To run a custom target + - *before* any of the wasm build targets, use `$(WasmBuildAppDependsOn)`, and prepend your target name to that + - *after* any of the wasm build targets, use `AfterTargets="WasmBuildApp"` on that target +- Avoid depending on this target, because it is available only when the workload is installed. Use `$(WasmNativeWorkload)` to check if it is installed. + +## `Publish` + +Implementation: + +- This part runs as a nested build using a `MSBuild` task, which means that the project gets reevaluated. So, if there were any changes made to items/properties in targets before this, then they won't be visible in the nested build. +- By default `WasmTriggerPublishApp` runs after the `Publish` target, and that triggers the nested build + - The nested build runs `WasmNestedPublishApp`, which causes `Build`, and `Publish` targets to be run + - Because this causes `Build` to be run again, if you have any targets that get triggered by that, then they will be running twice. + - But the original *build* run, and this *publish* run can be differentiated using `$(WasmBuildingForNestedPublish)` + +- `WasmTriggerPublishApp` essentially just invokes the nested publish + - This runs after `Publish` + - which can be disabled by `$(DisableAutoWasmPublishApp)` + - or the run-after target can be set via `$(WasmTriggerPublishAppAfterThisTarget)` + + - To influence the wasm build for publish, use `WasmNestedPublishApp` + - To run a custom target before it, use `$(WasmNestedPublishAppDependsOn)` + - to run a custom target *after* it, use `AfterTargets="WasmNestedPublishApp"` + + - If you want to *dependsOn* on this, then use `DependsOnTargets="WasmTriggerPublishApp"` + # `WasmApp.{props,targets}`, and `WasmApp.InTree.{props,targets}` - Any project that wants to use this, can import the props+targets, and set up the @@ -74,4 +129,4 @@ them for the new task assembly. 3. Make changes similar to the one for existing dependent tasks in - `eng/testing/linker/trimmingTests.targets`, - `src/tests/Common/wasm-test-runner/WasmTestRunner.proj` - - `src/tests/Directory.Build.targets` \ No newline at end of file + - `src/tests/Directory.Build.targets` diff --git a/src/mono/wasm/build/WasmApp.InTree.targets b/src/mono/wasm/build/WasmApp.InTree.targets index b345da95cf93c2..bb1db72a5c67ba 100644 --- a/src/mono/wasm/build/WasmApp.InTree.targets +++ b/src/mono/wasm/build/WasmApp.InTree.targets @@ -17,7 +17,7 @@ Condition="'$(_LocalMicrosoftNetCoreAppRuntimePackDir)' != '' and '%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App'" /> - + @@ -35,9 +35,9 @@ + DependsOnTargets="WasmTriggerPublishApp"> $(MSBuildProjectName) @@ -51,4 +51,13 @@ + + + + + + + diff --git a/src/mono/wasm/build/WasmApp.LocalBuild.props b/src/mono/wasm/build/WasmApp.LocalBuild.props index d92024f720d46c..a37ad835de96b4 100644 --- a/src/mono/wasm/build/WasmApp.LocalBuild.props +++ b/src/mono/wasm/build/WasmApp.LocalBuild.props @@ -32,7 +32,7 @@ $([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'microsoft.netcore.app.runtime.browser-wasm', $(RuntimeConfig))) - $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(_NetCoreAppToolCurrent)', 'publish')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(_NetCoreAppToolCurrent)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmBuildTasks', 'Debug', '$(_NetCoreAppToolCurrent)', 'publish')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(_NetCoreAppToolCurrent)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'RuntimeConfigParser', 'Debug', '$(_NetCoreAppToolCurrent)')) @@ -71,4 +71,12 @@ $([MSBuild]::NormalizePath('$(JsonToItemsTaskFactoryDir)', 'JsonToItemsTaskFactory.dll')) + + + + + + diff --git a/src/mono/wasm/build/WasmApp.LocalBuild.targets b/src/mono/wasm/build/WasmApp.LocalBuild.targets index 23f5249786d665..47559bccb84288 100644 --- a/src/mono/wasm/build/WasmApp.LocalBuild.targets +++ b/src/mono/wasm/build/WasmApp.LocalBuild.targets @@ -25,7 +25,7 @@ - true + true link @@ -45,7 +45,7 @@ Condition="'$(MicrosoftNetCoreAppRuntimePackLocationToUse)' != '' and '%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App'" /> - + diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets index 5b43374ab16b7f..879ca70edfc6af 100644 --- a/src/mono/wasm/build/WasmApp.Native.targets +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -17,12 +17,6 @@ _CompleteWasmBuildNative - - _InitializeCommonProperties; - _PrepareForWasmBuildNativeOnly; - _WasmBuildNativeCore; - - <_BeforeWasmBuildAppDependsOn> $(_BeforeWasmBuildAppDependsOn); _SetupEmscripten; @@ -33,22 +27,16 @@ true + + + + <_MonoComponent Include="hot_reload;debugger" /> - - - - - - <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> - <_WasmAssembliesInternal Include="@(WasmAssembliesToBundle->Distinct())" /> - - - <_EMSDKMissingPaths Condition="'$(_EMSDKMissingPaths)' == '' and ('$(EmscriptenSdkToolsPath)' == '' or !Exists('$(EmscriptenSdkToolsPath)'))">%24(EmscriptenSdkToolsPath)=$(EmscriptenSdkToolsPath) @@ -117,11 +105,27 @@ - + + + + true + + true + false + + + + + true true - false - true + + + false + + + true + false @@ -143,6 +147,7 @@ <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','browser-wasm')) <_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp')) + false true true $(WasmBuildNative) @@ -152,15 +157,15 @@ <_WasmPInvokeHPath>$(_WasmRuntimePackIncludeDir)wasm\pinvoke.h <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c - <_DriverGenCNeeded Condition="'$(_DriverGenCNeeded)' == '' and '$(RunAOTCompilation)' == 'true'">true + <_DriverGenCNeeded Condition="'$(_DriverGenCNeeded)' == '' and '$(_WasmShouldAOT)' == 'true'">true <_EmccAssertionLevelDefault>0 <_EmccOptimizationFlagDefault Condition="'$(_WasmDevel)' == 'true'">-O0 -s ASSERTIONS=$(_EmccAssertionLevelDefault) - <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(OS)' != 'Windows_NT' and '$(Configuration)' == 'Debug'">-Os - <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(Configuration)' != 'Debug'">-Oz + <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == '' and '$(Configuration)' == 'Debug' and '$(WasmBuildingForNestedPublish)' != 'true'">-O1 <_EmccOptimizationFlagDefault Condition="'$(_EmccOptimizationFlagDefault)' == ''">-Oz $(_EmccOptimizationFlagDefault) + -O2 $(EmccCompileOptimizationFlag) <_EmccCompileRsp>$(_WasmIntermediateOutputPath)emcc-compile.rsp @@ -190,8 +195,8 @@ <_EmccCFlags Include="$(EmccCompileOptimizationFlag)" /> <_EmccCFlags Include="@(_EmccCommonFlags)" /> - <_EmccCFlags Include="-DENABLE_AOT=1" Condition="'$(RunAOTCompilation)' == 'true'" /> - <_EmccCFlags Include="-DDRIVER_GEN=1" Condition="'$(RunAOTCompilation)' == 'true'" /> + <_EmccCFlags Include="-DENABLE_AOT=1" Condition="'$(_WasmShouldAOT)' == 'true'" /> + <_EmccCFlags Include="-DDRIVER_GEN=1" Condition="'$(_WasmShouldAOT)' == 'true'" /> <_EmccCFlags Include="-DINVARIANT_GLOBALIZATION=1" Condition="'$(InvariantGlobalization)' == 'true'" /> <_EmccCFlags Include="-DLINK_ICALLS=1" Condition="'$(WasmLinkIcalls)' == 'true'" /> <_EmccCFlags Include="-DCORE_BINDINGS" /> @@ -206,6 +211,9 @@ <_EmccLDFlags Include="@(_EmccCommonFlags)" /> <_EmccLDFlags Include="-s TOTAL_MEMORY=$(EmccTotalMemory)" /> + + <_EmccLDFlags Include="-s ERROR_ON_UNDEFINED_SYMBOLS=0" Condition="'$(WasmBuildingForNestedPublish)' != 'true'" /> + <_DriverCDependencies Include="$(_WasmPInvokeHPath);$(_WasmICallTablePath)" /> <_DriverCDependencies Include="$(_DriverGenCPath)" Condition="'$(_DriverGenCNeeded)' == 'true'" /> @@ -236,7 +244,9 @@ + OutputPath="$(_WasmPInvokeTablePath)"> + + @@ -244,10 +254,16 @@ Text="Could not find AOT cross compiler at %24(_MonoAotCrossCompilerPath)=$(_MonoAotCrossCompilerPath)" /> + + + + + OutputPath="$(_WasmICallTablePath)"> + + @@ -263,6 +279,9 @@ + + + @@ -276,14 +295,17 @@ SourceFiles="@(_WasmSourceFileToCompile)" Arguments='"@$(_EmccDefaultFlagsRsp)" "@$(_EmccCompileRsp)"' EnvironmentVariables="@(EmscriptenEnvVars)" - OutputMessageImportance="$(_EmccCompileOutputMessageImportance)" /> + OutputMessageImportance="$(_EmccCompileOutputMessageImportance)"> + + + Condition="'$(_WasmShouldAOT)' == 'true' and @(_BitcodeFile->Count()) > 0" + DependsOnTargets="_WasmWriteRspForCompilingBitcode" + Returns="@(FileWrites)"> <_BitCodeFile Dependencies="%(_BitCodeFile.Dependencies);$(_EmccDefaultFlagsRsp);$(_EmccCompileBitcodeRsp)" /> @@ -294,7 +316,9 @@ SourceFiles="@(_BitCodeFile)" Arguments=""@$(_EmccDefaultFlagsRsp)" "@$(_EmccCompileBitcodeRsp)"" EnvironmentVariables="@(EmscriptenEnvVars)" - OutputMessageImportance="$(_EmccCompileOutputMessageImportance)" /> + OutputMessageImportance="$(_EmccCompileOutputMessageImportance)"> + + @@ -303,6 +327,9 @@ <_BitcodeLDFlags Include="$(EmccExtraBitcodeLDFlags)" /> + + + @@ -312,8 +339,8 @@ <_WasmNativeFileForLinking Include="%(_WasmSourceFileToCompile.ObjectFile)" /> <_WasmNativeFileForLinking - Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)\*.a" - Exclude="@(_MonoRuntimeComponentDontLink->'$(MicrosoftNetCoreAppRuntimePackRidNativeDir)\%(Identity)')" /> + Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)*.a" + Exclude="@(_MonoRuntimeComponentDontLink->'$(MicrosoftNetCoreAppRuntimePackRidNativeDir)%(Identity)')" /> <_WasmExtraJSFile Include="@(Content)" Condition="'%(Content.Extension)' == '.js'" /> @@ -336,16 +363,24 @@ + + + + DependsOnTargets="_WasmSelectRuntimeComponentsForLinking;_WasmCompileAssemblyBitCodeFilesForAOT;_WasmWriteRspFilesForLinking" + Returns="@(FileWrites)" > + + + + @@ -358,7 +393,7 @@ - + $(EmccExtraCFlags) -DDRIVER_GEN=1 <_DriverGenCNeeded>true @@ -414,7 +449,7 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_ ******************************* --> - + <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','browser-wasm')) @@ -433,13 +468,11 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_ - <_AotInputAssemblies Include="@(_WasmAssembliesInternal)" Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'"> + <_AotInputAssemblies Include="@(_WasmAssembliesInternal)"> @(MonoAOTCompilerDefaultAotArguments, ';') @(MonoAOTCompilerDefaultProcessArguments, ';') - <_AOT_InternalForceInterpretAssemblies Include="@(_WasmAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" /> - <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> <_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)" /> @@ -452,16 +485,13 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_ <_AOTCompilerCacheFile>$(_WasmIntermediateOutputPath)aot_compiler_cache.json - - <_WasmDedupAssembly>$(_WasmIntermediateOutputPath)\aot-instances.dll - + + LLVMPath="$(EmscriptenUpstreamBinPath)" + IntermediateOutputPath="$(_WasmIntermediateOutputPath)"> - - <_WasmAssembliesInternal Include="@(_AOT_InternalForceInterpretAssemblies)" /> - - <_AOTAssemblies Include="@(_WasmAssembliesInternal)" Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'" /> <_BitcodeFile Include="%(_WasmAssembliesInternal.LlvmBitcodeFile)" /> <_BitcodeFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" /> - + <_WasmStrippedAssembliesPath>$([MSBuild]::NormalizeDirectory($(_WasmIntermediateOutputPath), 'stripped-assemblies')) + <_AOTedAssemblies Include="@(_WasmAssembliesInternal)" /> <_WasmStrippedAssemblies - Condition="'%(_WasmAssembliesInternal._InternalForceInterpret)' != 'true'" - Include="@(_WasmAssembliesInternal->'$(_WasmStrippedAssembliesPath)%(FileName)%(Extension)')" + Include="@(_AOTedAssemblies)" OriginalPath="%(_WasmAssembliesInternal.Identity)" /> - <_WasmInterpOnlyAssembly Include="@(_WasmAssembliesInternal->WithMetadataValue('_InternalForceInterpret', 'true'))" /> @@ -531,14 +557,7 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_ <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> - <_WasmAssembliesInternal Include="@(_WasmStrippedAssemblies);@(_WasmInterpOnlyAssembly)" /> + <_WasmAssembliesInternal Include="@(_WasmStrippedAssemblies)" /> - - - - - - diff --git a/src/mono/wasm/build/WasmApp.props b/src/mono/wasm/build/WasmApp.props index bc45a6d54d73d8..7fdde27c4affb5 100644 --- a/src/mono/wasm/build/WasmApp.props +++ b/src/mono/wasm/build/WasmApp.props @@ -5,8 +5,7 @@ browser-wasm true - Publish - + <_WasmBuildCoreDependsOn> _InitializeCommonProperties; _BeforeWasmBuildApp; _WasmResolveReferences; @@ -15,6 +14,16 @@ _WasmBuildNativeCore; _WasmGenerateAppBundle; _AfterWasmBuildApp + + + + _PrepareForAfterBuild; + $(_WasmBuildCoreDependsOn) + + + _PrepareForNestedPublish; + $(_WasmBuildCoreDependsOn) + diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index e5ceb13def292e..7642cf01694908 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -5,9 +5,6 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs) + + + + + + - - + + <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs) + + + + - + + + Text="%24(MicrosoftNetCoreAppRuntimePackDir)='', and cannot find %25(ResolvedRuntimePack.PackageDirectory)=%(ResolvedRuntimePack.PackageDirectory). One of these need to be set to a valid path" /> @@ -106,37 +171,50 @@ <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include')) <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src')) - <_WasmIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm')) + <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' == ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-build')) + <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' != ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-publish')) <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c + <_WasmShouldAOT Condition="'$(WasmBuildingForNestedPublish)' == 'true' and '$(RunAOTCompilation)' == 'true'">true + <_WasmShouldAOT Condition="'$(RunAOTCompilationAfterBuild)' == 'true' and '$(RunAOTCompilation)' == 'true'">true + <_WasmShouldAOT Condition="'$(_WasmShouldAOT)' == ''">false + + + + + + - true + true + false $([MSBuild]::NormalizeDirectory($(OutputPath), 'AppBundle')) $(TargetFileName) $([MSBuild]::NormalizeDirectory($(WasmAppDir))) <_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll' and $(WasmGenerateAppBundle) == 'true'">%(WasmAssembliesToBundle.Identity) - <_WasmRuntimeConfigFilePath Condition="$(_MainAssemblyPath) != ''">$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json')) - <_ParsedRuntimeConfigFilePath Condition="'$(_MainAssemblyPath)' != ''">$([System.IO.Path]::GetDirectoryName($(_MainAssemblyPath)))\runtimeconfig.bin + <_WasmRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' == '' and $(_MainAssemblyPath) != ''">$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json')) + <_ParsedRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' != ''">$([System.IO.Path]::GetDirectoryName($(_WasmRuntimeConfigFilePath)))\runtimeconfig.bin - + + <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> <_WasmAssembliesInternal Include="@(WasmAssembliesToBundle->Distinct())" /> + <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" /> <_WasmSatelliteAssemblies Include="@(_WasmAssembliesInternal)" /> <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))" /> @@ -166,9 +244,7 @@ - - - + icudt.dat @@ -184,7 +260,16 @@ + + + + + + + diff --git a/src/mono/wasm/data/aot-tests/ProxyProjectForAOTOnHelix.proj b/src/mono/wasm/data/aot-tests/ProxyProjectForAOTOnHelix.proj index 3a7b66fac7389f..65a0df19fb640c 100644 --- a/src/mono/wasm/data/aot-tests/ProxyProjectForAOTOnHelix.proj +++ b/src/mono/wasm/data/aot-tests/ProxyProjectForAOTOnHelix.proj @@ -5,6 +5,7 @@ $(MSBuildThisFileDirectory)..\wasm_build\ true + true $(TestRootDir)..\publish\ $(OriginalPublishDir)..\extraFiles\ $(TestRootDir)\obj\ diff --git a/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj b/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj index 66d0b287f76559..0efbe95332682c 100644 --- a/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj +++ b/src/mono/wasm/debugger/BrowserDebugHost/BrowserDebugHost.csproj @@ -4,6 +4,7 @@ $(AspNetCoreAppCurrent) true $(NoWarn),CA2007 + Major diff --git a/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs b/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs index c4de27f4ee9f6f..8583186ad64fda 100644 --- a/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs +++ b/src/mono/wasm/debugger/BrowserDebugHost/Startup.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Net.Http; using System.Text.Json; +using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -139,7 +140,9 @@ async Task RewriteArray(HttpContext context) Dictionary[] tabs = await ProxyGetJsonAsync[]>(GetEndpoint(context)); Dictionary[] alteredTabs = tabs.Select(t => mapFunc(t, context, devToolsHost)).ToArray(); context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(alteredTabs)); + byte[] bytes = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(alteredTabs)); + context.Response.ContentLength = bytes.Length; + await context.Response.Body.WriteAsync(bytes); } async Task ConnectProxy(HttpContext context) diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/BrowserDebugProxy.csproj b/src/mono/wasm/debugger/BrowserDebugProxy/BrowserDebugProxy.csproj index 169856bc091234..27465c4f382021 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/BrowserDebugProxy.csproj +++ b/src/mono/wasm/debugger/BrowserDebugProxy/BrowserDebugProxy.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs b/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs index be7d729dd019e4..08ca2a974b4360 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs @@ -514,20 +514,30 @@ internal class AssemblyInfo internal PEReader peReader; internal MemoryStream asmStream; internal MemoryStream pdbStream; - public int DebugId { get; set; } + private int debugId; public bool TriedToLoadSymbolsOnDemand { get; set; } public unsafe AssemblyInfo(string url, byte[] assembly, byte[] pdb) { + debugId = -1; this.id = Interlocked.Increment(ref next_id); asmStream = new MemoryStream(assembly); peReader = new PEReader(asmStream); asmMetadataReader = PEReaderExtensions.GetMetadataReader(peReader); + Name = asmMetadataReader.GetAssemblyDefinition().GetAssemblyName().Name + ".dll"; + AssemblyNameUnqualified = Name; if (pdb != null) { pdbStream = new MemoryStream(pdb); - pdbMetadataReader = MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader(); + try + { + pdbMetadataReader = MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader(); + } + catch (BadImageFormatException) + { + Console.WriteLine($"Warning: Unable to read debug information of: {Name} (use DebugType=Portable/Embedded)"); + } } else { @@ -538,11 +548,21 @@ public unsafe AssemblyInfo(string url, byte[] assembly, byte[] pdb) pdbMetadataReader = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embeddedPdbEntry).GetMetadataReader(); } } - Name = asmMetadataReader.GetAssemblyDefinition().GetAssemblyName().Name + ".dll"; - AssemblyNameUnqualified = asmMetadataReader.GetAssemblyDefinition().GetAssemblyName().Name + ".dll"; Populate(); } + public async Task GetDebugId(SessionId sessionId, MonoSDBHelper sdbAgent, CancellationToken token) + { + if (debugId > 0) + return debugId; + debugId = await sdbAgent.GetAssemblyId(sessionId, Name, token); + return debugId; + } + public void SetDebugId(int id) + { + if (debugId <= 0 && debugId != id) + debugId = id; + } public bool EnC(byte[] meta, byte[] pdb) { var asmStream = new MemoryStream(meta); diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs b/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs index bc0f4faeb456b5..aa33f94f5cd541 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsHelper.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -267,6 +268,14 @@ internal enum StepKind Out } + internal enum PauseOnExceptionsKind + { + Unset, + None, + Uncaught, + All + } + internal class ExecutionContext { public string DebugId { get; set; } @@ -279,8 +288,8 @@ internal class ExecutionContext public int Id { get; set; } public object AuxData { get; set; } - public bool PauseOnUncaught { get; set; } - public bool PauseOnCaught { get; set; } + public PauseOnExceptionsKind PauseOnExceptions { get; set; } + internal bool Destroyed { get; set; } public List CallStack { get; set; } @@ -334,4 +343,70 @@ public PerScopeCache() { } } + + internal sealed class ConcurrentExecutionContextDictionary + { + private ConcurrentDictionary> contexts = new ConcurrentDictionary>(); + public ExecutionContext GetCurrentContext(SessionId sessionId) + => TryGetCurrentExecutionContextValue(sessionId, out ExecutionContext context) + ? context + : throw new KeyNotFoundException($"No execution context found for session {sessionId}"); + + public bool TryGetCurrentExecutionContextValue(SessionId id, out ExecutionContext executionContext, bool ignoreDestroyedContext = true) + { + executionContext = null; + if (!contexts.TryGetValue(id, out ConcurrentBag contextBag)) + return false; + if (contextBag.IsEmpty) + return false; + IEnumerable validContexts = null; + if (ignoreDestroyedContext) + validContexts = contextBag.Where(context => context.Destroyed == false); + else + validContexts = contextBag; + if (!validContexts.Any()) + return false; + int maxId = validContexts.Max(context => context.Id); + executionContext = contextBag.FirstOrDefault(context => context.Id == maxId); + return executionContext != null; + } + + public void OnDefaultContextUpdate(SessionId sessionId, ExecutionContext newContext) + { + if (TryGetAndAddContext(sessionId, newContext, out ExecutionContext previousContext)) + { + foreach (KeyValuePair kvp in previousContext.BreakpointRequests) + { + newContext.BreakpointRequests[kvp.Key] = kvp.Value.Clone(); + } + newContext.PauseOnExceptions = previousContext.PauseOnExceptions; + } + } + + public bool TryGetAndAddContext(SessionId sessionId, ExecutionContext newExecutionContext, out ExecutionContext previousExecutionContext) + { + bool hasExisting = TryGetCurrentExecutionContextValue(sessionId, out previousExecutionContext, ignoreDestroyedContext: false); + ConcurrentBag bag = contexts.GetOrAdd(sessionId, _ => new ConcurrentBag()); + bag.Add(newExecutionContext); + return hasExisting; + } + + public void DestroyContext(SessionId sessionId, int id) + { + if (!contexts.TryGetValue(sessionId, out ConcurrentBag contextBag)) + return; + foreach (ExecutionContext context in contextBag.Where(x => x.Id == id).ToList()) + context.Destroyed = true; + } + + public void ClearContexts(SessionId sessionId) + { + if (!contexts.TryGetValue(sessionId, out ConcurrentBag contextBag)) + return; + foreach (ExecutionContext context in contextBag) + context.Destroyed = true; + } + + public bool ContainsKey(SessionId sessionId) => contexts.ContainsKey(sessionId); + } } diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsProxy.cs b/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsProxy.cs index 8474a2dc21cdc1..7411024a0802cb 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsProxy.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/DevToolsProxy.cs @@ -8,6 +8,7 @@ using System.Net.WebSockets; using System.Text; using System.Threading; +using System.Threading.Channels; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Newtonsoft.Json; @@ -24,7 +25,8 @@ internal class DevToolsProxy private ClientWebSocket browser; private WebSocket ide; private int next_cmd_id; - private List pending_ops = new List(); + private readonly ChannelWriter _channelWriter; + private readonly ChannelReader _channelReader; private List queues = new List(); protected readonly ILogger logger; @@ -32,6 +34,10 @@ internal class DevToolsProxy public DevToolsProxy(ILoggerFactory loggerFactory) { logger = loggerFactory.CreateLogger(); + + var channel = Channel.CreateUnbounded(new UnboundedChannelOptions { SingleReader = true }); + _channelWriter = channel.Writer; + _channelReader = channel.Reader; } protected virtual Task AcceptEvent(SessionId sessionId, string method, JObject args, CancellationToken token) @@ -82,7 +88,7 @@ private DevToolsQueue GetQueueForTask(Task task) return queues.FirstOrDefault(q => q.CurrentSend == task); } - private void Send(WebSocket to, JObject o, CancellationToken token) + private async Task Send(WebSocket to, JObject o, CancellationToken token) { string sender = browser == to ? "Send-browser" : "Send-ide"; @@ -95,7 +101,7 @@ private void Send(WebSocket to, JObject o, CancellationToken token) Task task = queue.Send(bytes, token); if (task != null) - pending_ops.Add(task); + await _channelWriter.WriteAsync(task, token); } private async Task OnEvent(SessionId sessionId, string method, JObject args, CancellationToken token) @@ -105,7 +111,7 @@ private async Task OnEvent(SessionId sessionId, string method, JObject args, Can if (!await AcceptEvent(sessionId, method, args, token)) { //logger.LogDebug ("proxy browser: {0}::{1}",method, args); - SendEventInternal(sessionId, method, args, token); + await SendEventInternal(sessionId, method, args, token); } } catch (Exception e) @@ -121,7 +127,7 @@ private async Task OnCommand(MessageId id, string method, JObject args, Cancella if (!await AcceptCommand(id, method, args, token)) { Result res = await SendCommandInternal(id, method, args, token); - SendResponseInternal(id, res, token); + await SendResponseInternal(id, res, token); } } catch (Exception e) @@ -142,7 +148,7 @@ private void OnResponse(MessageId id, Result result) logger.LogError("Cannot respond to command: {id} with result: {result} - command is not pending", id, result); } - private void ProcessBrowserMessage(string msg, CancellationToken token) + private Task ProcessBrowserMessage(string msg, CancellationToken token) { var res = JObject.Parse(msg); @@ -151,23 +157,30 @@ private void ProcessBrowserMessage(string msg, CancellationToken token) Log("protocol", $"browser: {msg}"); if (res["id"] == null) - pending_ops.Add(OnEvent(res.ToObject(), res["method"].Value(), res["params"] as JObject, token)); + { + return OnEvent(res.ToObject(), res["method"].Value(), res["params"] as JObject, token); + } else + { OnResponse(res.ToObject(), Result.FromJson(res)); + return null; + } } - private void ProcessIdeMessage(string msg, CancellationToken token) + private Task ProcessIdeMessage(string msg, CancellationToken token) { Log("protocol", $"ide: {msg}"); if (!string.IsNullOrEmpty(msg)) { var res = JObject.Parse(msg); var id = res.ToObject(); - pending_ops.Add(OnCommand( + return OnCommand( id, res["method"].Value(), - res["params"] as JObject, token)); + res["params"] as JObject, token); } + + return null; } internal async Task SendCommand(SessionId id, string method, JObject args, CancellationToken token) @@ -176,7 +189,7 @@ internal async Task SendCommand(SessionId id, string method, JObject arg return await SendCommandInternal(id, method, args, token); } - private Task SendCommandInternal(SessionId sessionId, string method, JObject args, CancellationToken token) + private async Task SendCommandInternal(SessionId sessionId, string method, JObject args, CancellationToken token) { int id = Interlocked.Increment(ref next_cmd_id); @@ -194,17 +207,17 @@ private Task SendCommandInternal(SessionId sessionId, string method, JOb //Log ("verbose", $"add cmd id {sessionId}-{id}"); pending_cmds[msgId] = tcs; - Send(this.browser, o, token); - return tcs.Task; + await Send(browser, o, token); + return await tcs.Task; } - public void SendEvent(SessionId sessionId, string method, JObject args, CancellationToken token) + public Task SendEvent(SessionId sessionId, string method, JObject args, CancellationToken token) { //Log ("verbose", $"sending event {method}: {args}"); - SendEventInternal(sessionId, method, args, token); + return SendEventInternal(sessionId, method, args, token); } - private void SendEventInternal(SessionId sessionId, string method, JObject args, CancellationToken token) + private Task SendEventInternal(SessionId sessionId, string method, JObject args, CancellationToken token) { var o = JObject.FromObject(new { @@ -214,7 +227,7 @@ private void SendEventInternal(SessionId sessionId, string method, JObject args, if (sessionId.sessionId != null) o["sessionId"] = sessionId.sessionId; - Send(this.ide, o, token); + return Send(ide, o, token); } internal void SendResponse(MessageId id, Result result, CancellationToken token) @@ -222,13 +235,13 @@ internal void SendResponse(MessageId id, Result result, CancellationToken token) SendResponseInternal(id, result, token); } - private void SendResponseInternal(MessageId id, Result result, CancellationToken token) + private Task SendResponseInternal(MessageId id, Result result, CancellationToken token) { JObject o = result.ToJObject(id); if (result.IsErr) logger.LogError($"sending error response for id: {id} -> {result}"); - Send(this.ide, o, token); + return Send(this.ide, o, token); } // , HttpContext context) @@ -248,10 +261,14 @@ public async Task Run(Uri browserUri, WebSocket ideSocket) Log("verbose", $"DevToolsProxy: Client connected on {browserUri}"); var x = new CancellationTokenSource(); + List pending_ops = new(); + pending_ops.Add(ReadOne(browser, x.Token)); pending_ops.Add(ReadOne(ide, x.Token)); pending_ops.Add(side_exception.Task); pending_ops.Add(client_initiated_close.Task); + Task readerTask = _channelReader.WaitToReadAsync(x.Token).AsTask(); + pending_ops.Add(readerTask); try { @@ -268,6 +285,16 @@ public async Task Run(Uri browserUri, WebSocket ideSocket) break; } + if (readerTask.IsCompleted) + { + while (_channelReader.TryRead(out Task newTask)) + { + pending_ops.Add(newTask); + } + + pending_ops[4] = _channelReader.WaitToReadAsync(x.Token).AsTask(); + } + //logger.LogTrace ("pump {0} {1}", task, pending_ops.IndexOf (task)); if (task == pending_ops[0]) { @@ -275,7 +302,9 @@ public async Task Run(Uri browserUri, WebSocket ideSocket) if (msg != null) { pending_ops[0] = ReadOne(browser, x.Token); //queue next read - ProcessBrowserMessage(msg, x.Token); + Task newTask = ProcessBrowserMessage(msg, x.Token); + if (newTask != null) + pending_ops.Add(newTask); } } else if (task == pending_ops[1]) @@ -284,7 +313,9 @@ public async Task Run(Uri browserUri, WebSocket ideSocket) if (msg != null) { pending_ops[1] = ReadOne(ide, x.Token); //queue next read - ProcessIdeMessage(msg, x.Token); + Task newTask = ProcessIdeMessage(msg, x.Token); + if (newTask != null) + pending_ops.Add(newTask); } } else if (task == pending_ops[2]) @@ -304,11 +335,14 @@ public async Task Run(Uri browserUri, WebSocket ideSocket) } } } + + _channelWriter.Complete(); } catch (Exception e) { - Log("error", $"DevToolsProxy::Run: Exception {e}"); - //throw; + if (e.InnerException is null || e.InnerException is not System.Net.WebSockets.WebSocketException) + Log("error", $"DevToolsProxy::Run: Exception {e}"); + _channelWriter.Complete(e); } finally { diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs index 55896677f2b052..9469cac5b9951a 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs @@ -124,7 +124,7 @@ public async Task TryToRunOnLoadedClasses(string varName, CancellationT var type = asm.GetTypeByName(classNameToFind); if (type != null) { - typeId = await sdbHelper.GetTypeIdFromToken(sessionId, asm.DebugId, type.Token, token); + typeId = await sdbHelper.GetTypeIdFromToken(sessionId, await asm.GetDebugId(sessionId, sdbHelper, token), type.Token, token); } } } diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs index 95aa6dedcd0069..36a6d8eea56fec 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs @@ -22,7 +22,7 @@ internal class MonoProxy : DevToolsProxy private IList urlSymbolServerList; private static HttpClient client = new HttpClient(); private HashSet sessions = new HashSet(); - private Dictionary contexts = new Dictionary(); + internal ConcurrentExecutionContextDictionary Contexts = new ConcurrentExecutionContextDictionary(); private const string sPauseOnUncaught = "pause_on_uncaught"; private const string sPauseOnCaught = "pause_on_caught"; @@ -32,21 +32,6 @@ public MonoProxy(ILoggerFactory loggerFactory, IList urlSymbolServerList SdbHelper = new MonoSDBHelper(this, logger); } - internal ExecutionContext GetContext(SessionId sessionId) - { - if (contexts.TryGetValue(sessionId, out ExecutionContext context)) - return context; - - throw new ArgumentException($"Invalid Session: \"{sessionId}\"", nameof(sessionId)); - } - - private bool UpdateContext(SessionId sessionId, ExecutionContext executionContext, out ExecutionContext previousExecutionContext) - { - bool previous = contexts.TryGetValue(sessionId, out previousExecutionContext); - contexts[sessionId] = executionContext; - return previous; - } - internal Task SendMonoCommand(SessionId id, MonoCommands cmd, CancellationToken token) => SendCommand(id, "Runtime.evaluate", JObject.FromObject(cmd), token); protected override async Task AcceptEvent(SessionId sessionId, string method, JObject args, CancellationToken token) @@ -55,6 +40,9 @@ protected override async Task AcceptEvent(SessionId sessionId, string meth { case "Runtime.consoleAPICalled": { + // Don't process events from sessions we aren't tracking + if (!Contexts.TryGetCurrentExecutionContextValue(sessionId, out ExecutionContext context)) + return false; string type = args["type"]?.ToString(); if (type == "debug") { @@ -68,7 +56,6 @@ protected override async Task AcceptEvent(SessionId sessionId, string meth { // The optional 3rd argument is the stringified assembly // list so that we don't have to make more round trips - ExecutionContext context = GetContext(sessionId); string loaded = a?[2]?["value"]?.ToString(); if (loaded != null) context.LoadedFiles = JToken.Parse(loaded).ToObject(); @@ -109,7 +96,7 @@ protected override async Task AcceptEvent(SessionId sessionId, string meth case "Runtime.executionContextCreated": { - SendEvent(sessionId, method, args, token); + await SendEvent(sessionId, method, args, token); JToken ctx = args?["context"]; var aux_data = ctx?["auxData"] as JObject; int id = ctx["id"].Value(); @@ -126,20 +113,41 @@ protected override async Task AcceptEvent(SessionId sessionId, string meth case "Runtime.exceptionThrown": { - if (!GetContext(sessionId).IsRuntimeReady) + // Don't process events from sessions we aren't tracking + if (!Contexts.TryGetCurrentExecutionContextValue(sessionId, out ExecutionContext context)) + return false; + + if (!context.IsRuntimeReady) { string exceptionError = args?["exceptionDetails"]?["exception"]?["value"]?.Value(); if (exceptionError == sPauseOnUncaught || exceptionError == sPauseOnCaught) - { return true; - } } break; } + case "Runtime.executionContextDestroyed": + { + Contexts.DestroyContext(sessionId, args["executionContextId"].Value()); + return false; + } + + case "Runtime.executionContextsCleared": + { + Contexts.ClearContexts(sessionId); + return false; + } + case "Debugger.paused": { - if (!GetContext(sessionId).IsRuntimeReady) + // Don't process events from sessions we aren't tracking + if (!Contexts.TryGetCurrentExecutionContextValue(sessionId, out ExecutionContext context)) + return false; + + if (args?["callFrames"]?.Value()?.Count == 0) + return false; + + if (!context.IsRuntimeReady) { string reason = args?["reason"]?.Value(); if (reason == "exception") @@ -148,17 +156,19 @@ protected override async Task AcceptEvent(SessionId sessionId, string meth if (exceptionError == sPauseOnUncaught) { await SendCommand(sessionId, "Debugger.resume", new JObject(), token); - GetContext(sessionId).PauseOnUncaught = true; + if (context.PauseOnExceptions == PauseOnExceptionsKind.Unset) + context.PauseOnExceptions = PauseOnExceptionsKind.Uncaught; return true; } if (exceptionError == sPauseOnCaught) { await SendCommand(sessionId, "Debugger.resume", new JObject(), token); - GetContext(sessionId).PauseOnCaught = true; + context.PauseOnExceptions = PauseOnExceptionsKind.All; return true; } } } + //TODO figure out how to stich out more frames and, in particular what happens when real wasm is on the stack string top_func = args?["callFrames"]?[0]?["functionName"]?.Value(); switch (top_func) { @@ -225,7 +235,7 @@ protected override async Task AcceptEvent(SessionId sessionId, string meth private async Task IsRuntimeAlreadyReadyAlready(SessionId sessionId, CancellationToken token) { - if (contexts.TryGetValue(sessionId, out ExecutionContext context) && context.IsRuntimeReady) + if (Contexts.TryGetCurrentExecutionContextValue(sessionId, out ExecutionContext context) && context.IsRuntimeReady) return true; Result res = await SendMonoCommand(sessionId, MonoCommands.IsRuntimeReady(), token); @@ -239,8 +249,11 @@ protected override async Task AcceptCommand(MessageId id, string method, J if (id == SessionId.Null) await AttachToTarget(id, token); - if (!contexts.TryGetValue(id, out ExecutionContext context)) - return false; + if (!Contexts.TryGetCurrentExecutionContextValue(id, out ExecutionContext context)) + { + // for Dotnetdebugger.* messages, treat them as handled, thus not passing them on to the browser + return method.StartsWith("DotnetDebugger.", StringComparison.OrdinalIgnoreCase); + } switch (method) { @@ -434,23 +447,16 @@ protected override async Task AcceptCommand(MessageId id, string method, J case "Debugger.setPauseOnExceptions": { string state = args["state"].Value(); - if (!context.IsRuntimeReady) + context.PauseOnExceptions = state switch { - context.PauseOnCaught = false; - context.PauseOnUncaught = false; - switch (state) - { - case "all": - context.PauseOnCaught = true; - context.PauseOnUncaught = true; - break; - case "uncaught": - context.PauseOnUncaught = true; - break; - } - } - else - await SdbHelper.EnableExceptions(id, state, token); + "all" => PauseOnExceptionsKind.All, + "uncaught" => PauseOnExceptionsKind.Uncaught, + "none" => PauseOnExceptionsKind.None, + _ => PauseOnExceptionsKind.Unset + }; + + if (context.IsRuntimeReady) + await SdbHelper.EnableExceptions(id, context.PauseOnExceptions, token); // Pass this on to JS too return false; } @@ -533,7 +539,8 @@ protected override async Task AcceptCommand(MessageId id, string method, J } } - return false; + // for Dotnetdebugger.* messages, treat them as handled, thus not passing them on to the browser + return method.StartsWith("DotnetDebugger.", StringComparison.OrdinalIgnoreCase); } private async Task CallOnFunction(MessageId id, JObject args, CancellationToken token) { @@ -552,7 +559,7 @@ private async Task CallOnFunction(MessageId id, JObject args, Cancellation args["details"] = await SdbHelper.GetPointerContent(id, int.Parse(objectId.Value), token); break; case "array": - args["details"] = await SdbHelper.GetArrayValues(id, int.Parse(objectId.Value), token); + args["details"] = await SdbHelper.GetArrayValuesProxy(id, int.Parse(objectId.Value), token); break; case "cfo_res": { @@ -597,7 +604,7 @@ private async Task CallOnFunction(MessageId id, JObject args, Cancellation private async Task OnSetVariableValue(MessageId id, int scopeId, string varName, JToken varValue, CancellationToken token) { - ExecutionContext ctx = GetContext(id); + ExecutionContext ctx = Contexts.GetCurrentContext(id); Frame scope = ctx.CallStack.FirstOrDefault(s => s.Id == scopeId); if (scope == null) return false; @@ -820,10 +827,11 @@ private async Task SendCallStack(SessionId sessionId, ExecutionContext con }); if (!await EvaluateCondition(sessionId, context, context.CallStack.First(), bp, token)) { + context.ClearState(); await SendCommand(sessionId, "Debugger.resume", new JObject(), token); return true; } - SendEvent(sessionId, "Debugger.paused", o, token); + await SendEvent(sessionId, "Debugger.paused", o, token); return true; } @@ -833,7 +841,7 @@ private async Task OnReceiveDebuggerAgentEvent(SessionId sessionId, JObjec if (res.IsErr) return false; - ExecutionContext context = GetContext(sessionId); + ExecutionContext context = Contexts.GetCurrentContext(sessionId); byte[] newBytes = Convert.FromBase64String(res.Value?["result"]?["value"]?["value"]?.Value()); var retDebuggerCmd = new MemoryStream(newBytes); var retDebuggerCmdReader = new MonoBinaryReader(retDebuggerCmd); @@ -866,7 +874,7 @@ private async Task OnReceiveDebuggerAgentEvent(SessionId sessionId, JObjec int object_id = retDebuggerCmdReader.ReadInt32(); var caught = retDebuggerCmdReader.ReadByte(); var exceptionObject = await SdbHelper.GetObjectValues(sessionId, object_id, GetObjectCommandOptions.WithProperties | GetObjectCommandOptions.OwnProperties, token); - var exceptionObjectMessage = exceptionObject.FirstOrDefault(attr => attr["name"].Value().Equals("message")); + var exceptionObjectMessage = exceptionObject.FirstOrDefault(attr => attr["name"].Value().Equals("_message")); var data = JObject.FromObject(new { type = "object", @@ -899,7 +907,7 @@ private async Task OnReceiveDebuggerAgentEvent(SessionId sessionId, JObjec internal async Task LoadSymbolsOnDemand(AssemblyInfo asm, int method_token, SessionId sessionId, CancellationToken token) { - ExecutionContext context = GetContext(sessionId); + ExecutionContext context = Contexts.GetCurrentContext(sessionId); if (urlSymbolServerList.Count == 0) return null; if (asm.TriedToLoadSymbolsOnDemand) @@ -932,7 +940,7 @@ internal async Task LoadSymbolsOnDemand(AssemblyInfo asm, int method foreach (SourceFile source in asm.Sources) { var scriptSource = JObject.FromObject(source.ToScriptSource(context.Id, context.AuxData)); - SendEvent(sessionId, "Debugger.scriptParsed", scriptSource, token); + await SendEvent(sessionId, "Debugger.scriptParsed", scriptSource, token); } return asm.GetMethodByToken(method_token); } @@ -950,13 +958,7 @@ internal async Task LoadSymbolsOnDemand(AssemblyInfo asm, int method private async Task OnDefaultContext(SessionId sessionId, ExecutionContext context, CancellationToken token) { Log("verbose", "Default context created, clearing state and sending events"); - if (UpdateContext(sessionId, context, out ExecutionContext previousContext)) - { - foreach (KeyValuePair kvp in previousContext.BreakpointRequests) - { - context.BreakpointRequests[kvp.Key] = kvp.Value.Clone(); - } - } + Contexts.OnDefaultContextUpdate(sessionId, context); if (await IsRuntimeAlreadyReadyAlready(sessionId, token)) await RuntimeReady(sessionId, token); @@ -964,7 +966,7 @@ private async Task OnDefaultContext(SessionId sessionId, ExecutionContext contex private async Task OnResume(MessageId msg_id, CancellationToken token) { - ExecutionContext ctx = GetContext(msg_id); + ExecutionContext ctx = Contexts.GetCurrentContext(msg_id); if (ctx.CallStack != null) { // Stopped on managed code @@ -973,12 +975,12 @@ private async Task OnResume(MessageId msg_id, CancellationToken token) //discard managed frames SdbHelper.ClearCache(); - GetContext(msg_id).ClearState(); + Contexts.GetCurrentContext(msg_id).ClearState(); } private async Task Step(MessageId msg_id, StepKind kind, CancellationToken token) { - ExecutionContext context = GetContext(msg_id); + ExecutionContext context = Contexts.GetCurrentContext(msg_id); if (context.CallStack == null) return false; @@ -1049,7 +1051,7 @@ private async Task OnAssemblyLoadedJSEvent(SessionId sessionId, JObject ev var assembly_data = Convert.FromBase64String(assembly_b64); var pdb_data = string.IsNullOrEmpty(pdb_b64) ? null : Convert.FromBase64String(pdb_b64); - var context = GetContext(sessionId); + var context = Contexts.GetCurrentContext(sessionId); foreach (var source in store.Add(sessionId, assembly_data, pdb_data)) { await OnSourceFileAdded(sessionId, source, context, token); @@ -1068,7 +1070,7 @@ private async Task OnEvaluateOnCallFrame(MessageId msg_id, int scopeId, st { try { - ExecutionContext context = GetContext(msg_id); + ExecutionContext context = Contexts.GetCurrentContext(msg_id); if (context.CallStack == null) return false; @@ -1109,7 +1111,7 @@ internal async Task GetScopeProperties(SessionId msg_id, int scopeId, Ca { try { - ExecutionContext ctx = GetContext(msg_id); + ExecutionContext ctx = Contexts.GetCurrentContext(msg_id); Frame scope = ctx.CallStack.FirstOrDefault(s => s.Id == scopeId); if (scope == null) return Result.Err(JObject.FromObject(new { message = $"Could not find scope with id #{scopeId}" })); @@ -1162,38 +1164,45 @@ private async Task OnSourceFileAdded(SessionId sessionId, SourceFile source, Exe { JObject scriptSource = JObject.FromObject(source.ToScriptSource(context.Id, context.AuxData)); Log("debug", $"sending {source.Url} {context.Id} {sessionId.sessionId}"); - SendEvent(sessionId, "Debugger.scriptParsed", scriptSource, token); + await SendEvent(sessionId, "Debugger.scriptParsed", scriptSource, token); foreach (var req in context.BreakpointRequests.Values) { if (req.TryResolve(source)) { - await SetBreakpoint(sessionId, context.store, req, true, token); + try + { + await SetBreakpoint(sessionId, context.store, req, true, token); + } + catch (Exception e) + { + logger.LogDebug($"Unexpected error on OnSourceFileAdded {e}"); + } } } } internal async Task LoadStore(SessionId sessionId, CancellationToken token) { - ExecutionContext context = GetContext(sessionId); + ExecutionContext context = Contexts.GetCurrentContext(sessionId); if (Interlocked.CompareExchange(ref context.store, new DebugStore(logger), null) != null) return await context.Source.Task; try { - string[] loaded_files = context.LoadedFiles; + string[] loaded_files = await GetLoadedFiles(sessionId, context, token); if (loaded_files == null) { - Result loaded = await SendMonoCommand(sessionId, MonoCommands.GetLoadedFiles(), token); - loaded_files = loaded.Value?["result"]?["value"]?.ToObject(); + Console.WriteLine($"Failed to get the list of loaded files. Managed code debugging won't work due to this."); } - - await - foreach (SourceFile source in context.store.Load(sessionId, loaded_files, token).WithCancellation(token)) + else { - await OnSourceFileAdded(sessionId, source, context, token); + await foreach (SourceFile source in context.store.Load(sessionId, loaded_files, token).WithCancellation(token)) + { + await OnSourceFileAdded(sessionId, source, context, token); + } } } catch (Exception e) @@ -1204,25 +1213,38 @@ internal async Task LoadStore(SessionId sessionId, CancellationToken if (!context.Source.Task.IsCompleted) context.Source.SetResult(context.store); return context.store; + + async Task GetLoadedFiles(SessionId sessionId, ExecutionContext context, CancellationToken token) + { + if (context.LoadedFiles != null) + return context.LoadedFiles; + + Result loaded = await SendMonoCommand(sessionId, MonoCommands.GetLoadedFiles(), token); + if (!loaded.IsOk) + { + Console.WriteLine($"Error on mono_wasm_get_loaded_files {loaded}"); + return null; + } + + string[] files = loaded.Value?["result"]?["value"]?.ToObject(); + if (files == null) + Console.WriteLine($"Error extracting the list of loaded_files from the result of mono_wasm_get_loaded_files: {loaded}"); + + return files; + } } private async Task RuntimeReady(SessionId sessionId, CancellationToken token) { - ExecutionContext context = GetContext(sessionId); + ExecutionContext context = Contexts.GetCurrentContext(sessionId); if (Interlocked.CompareExchange(ref context.ready, new TaskCompletionSource(), null) != null) return await context.ready.Task; var commandParams = new MemoryStream(); - var retDebuggerCmdReader = await SdbHelper.SendDebuggerAgentCommand(sessionId, CmdEventRequest.ClearAllBreakpoints, commandParams, token); - if (retDebuggerCmdReader == null) - { - Log("verbose", $"Failed to clear breakpoints"); - } + await SdbHelper.SendDebuggerAgentCommand(sessionId, CmdEventRequest.ClearAllBreakpoints, commandParams, token); - if (context.PauseOnCaught && context.PauseOnUncaught) - await SdbHelper.EnableExceptions(sessionId, "all", token); - else if (context.PauseOnUncaught) - await SdbHelper.EnableExceptions(sessionId, "uncaught", token); + if (context.PauseOnExceptions != PauseOnExceptionsKind.None && context.PauseOnExceptions != PauseOnExceptionsKind.Unset) + await SdbHelper.EnableExceptions(sessionId, context.PauseOnExceptions, token); await SdbHelper.SetProtocolVersion(sessionId, token); await SdbHelper.EnableReceiveRequests(sessionId, EventKind.UserBreak, token); @@ -1231,14 +1253,14 @@ private async Task RuntimeReady(SessionId sessionId, CancellationTok DebugStore store = await LoadStore(sessionId, token); context.ready.SetResult(store); - SendEvent(sessionId, "Mono.runtimeReady", new JObject(), token); - SdbHelper.SetStore(store); + await SendEvent(sessionId, "Mono.runtimeReady", new JObject(), token); + SdbHelper.ResetStore(store); return store; } private async Task ResetBreakpoint(SessionId msg_id, MethodInfo method, CancellationToken token) { - ExecutionContext context = GetContext(msg_id); + ExecutionContext context = Contexts.GetCurrentContext(msg_id); foreach (var req in context.BreakpointRequests.Values) { if (req.Method != null) @@ -1254,7 +1276,7 @@ private async Task RemoveBreakpoint(SessionId msg_id, JObject args, bool isEnCRe { string bpid = args?["breakpointId"]?.Value(); - ExecutionContext context = GetContext(msg_id); + ExecutionContext context = Contexts.GetCurrentContext(msg_id); if (!context.BreakpointRequests.TryGetValue(bpid, out BreakpointRequest breakpointRequest)) return; @@ -1278,7 +1300,7 @@ private async Task RemoveBreakpoint(SessionId msg_id, JObject args, bool isEnCRe private async Task SetBreakpoint(SessionId sessionId, DebugStore store, BreakpointRequest req, bool sendResolvedEvent, CancellationToken token) { - ExecutionContext context = GetContext(sessionId); + ExecutionContext context = Contexts.GetCurrentContext(sessionId); if (req.Locations.Any()) { Log("debug", $"locations already loaded for {req.Id}"); @@ -1294,7 +1316,7 @@ private async Task SetBreakpoint(SessionId sessionId, DebugStore store, Breakpoi .OrderBy(l => l.Column) .GroupBy(l => l.Id); - logger.LogDebug("BP request for '{req}' runtime ready {context.RuntimeReady}", req, GetContext(sessionId).IsRuntimeReady); + logger.LogDebug("BP request for '{req}' runtime ready {context.RuntimeReady}", req, Contexts.GetCurrentContext(sessionId).IsRuntimeReady); var breakpoints = new List(); @@ -1318,7 +1340,7 @@ private async Task SetBreakpoint(SessionId sessionId, DebugStore store, Breakpoi }; if (sendResolvedEvent) - SendEvent(sessionId, "Debugger.breakpointResolved", JObject.FromObject(resolvedLocation), token); + await SendEvent(sessionId, "Debugger.breakpointResolved", JObject.FromObject(resolvedLocation), token); } req.Locations.AddRange(breakpoints); @@ -1384,8 +1406,19 @@ private async Task AttachToTarget(SessionId sessionId, CancellationToken token) // see https://github.com/mono/mono/issues/19549 for background if (sessions.Add(sessionId)) { - string checkUncaughtExceptions = $"throw \"{sPauseOnUncaught}\";"; - string checkCaughtExceptions = $"try {{throw \"{sPauseOnCaught}\";}} catch {{}}"; + string checkUncaughtExceptions = string.Empty; + string checkCaughtExceptions = string.Empty; + + //we only need this check if it's a non-vs debugging + if (sessionId == SessionId.Null) + { + if (!Contexts.TryGetCurrentExecutionContextValue(sessionId, out ExecutionContext context) || context.PauseOnExceptions == PauseOnExceptionsKind.Unset) + { + checkUncaughtExceptions = $"throw \"{sPauseOnUncaught}\";"; + checkCaughtExceptions = $"try {{throw \"{sPauseOnCaught}\";}} catch {{}}"; + } + } + await SendMonoCommand(sessionId, new MonoCommands("globalThis.dotnetDebugger = true"), token); Result res = await SendCommand(sessionId, "Page.addScriptToEvaluateOnNewDocument", diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs index d804421e78ab51..614bbd4738a46a 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs @@ -17,6 +17,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp; using System.Reflection; +using System.Text; namespace Microsoft.WebAssembly.Diagnostics { @@ -357,6 +358,52 @@ internal enum StepSize Line } + internal record ArrayDimensions + { + internal int Rank { get; } + internal int [] Bounds { get; } + internal int TotalLength { get; } + public ArrayDimensions(int [] rank) + { + Rank = rank.Length; + Bounds = rank; + TotalLength = 1; + for (int i = 0 ; i < Rank ; i++) + TotalLength *= Bounds[i]; + } + + public override string ToString() + { + return $"{string.Join(", ", Bounds)}"; + } + internal string GetArrayIndexString(int idx) + { + if (idx < 0 || idx >= TotalLength) + return "Invalid Index"; + int boundLimit = 1; + int lastBoundLimit = 1; + int[] arrayStr = new int[Rank]; + int rankStart = 0; + while (idx > 0) + { + boundLimit = 1; + for (int i = Rank - 1; i >= rankStart; i--) + { + lastBoundLimit = boundLimit; + boundLimit *= Bounds[i]; + if (idx < boundLimit) + { + arrayStr[i] = (int)(idx / lastBoundLimit); + idx -= arrayStr[i] * lastBoundLimit; + rankStart = i; + break; + } + } + } + return $"{string.Join(", ", arrayStr)}"; + } + } + internal record MethodInfoWithDebugInformation(MethodInfo Info, int DebugId, string Name); internal class TypeInfoWithDebugInformation @@ -365,7 +412,7 @@ internal class TypeInfoWithDebugInformation public int DebugId { get; } public string Name { get; } public List FieldsList { get; set; } - public MonoBinaryReader PropertiesBinaryReader { get; set; } + public byte[] PropertiesBuffer { get; set; } public List TypeParamsOrArgsForGenericType { get; set; } public TypeInfoWithDebugInformation(TypeInfo typeInfo, int debugId, string name) @@ -378,7 +425,11 @@ public TypeInfoWithDebugInformation(TypeInfo typeInfo, int debugId, string name) internal class MonoBinaryReader : BinaryReader { - public MonoBinaryReader(Stream stream) : base(stream) {} + public bool HasError { get; } + public MonoBinaryReader(Stream stream, bool hasError = false) : base(stream) + { + HasError = hasError; + } internal static unsafe void PutBytesBE (byte *dest, byte *src, int count) { @@ -397,9 +448,10 @@ internal static unsafe void PutBytesBE (byte *dest, byte *src, int count) public override string ReadString() { var valueLen = ReadInt32(); - char[] value = new char[valueLen]; + byte[] value = new byte[valueLen]; Read(value, 0, valueLen); - return new string(value); + + return new string(Encoding.UTF8.GetChars(value, 0, valueLen)); } public unsafe long ReadLong() { @@ -649,14 +701,14 @@ public PointerValue(long address, int typeId, string varName) internal class MonoSDBHelper { private static int debuggerObjectId; - private static int cmdId; - private static int GetId() {return cmdId++;} + private static int cmdId = 1; //cmdId == 0 is used by events which come from runtime + private static int GetNewId() {return cmdId++;} private static int MINOR_VERSION = 61; private static int MAJOR_VERSION = 2; - private Dictionary methods = new(); - private Dictionary assemblies = new(); - private Dictionary types = new(); + private Dictionary methods; + private Dictionary assemblies; + private Dictionary types; internal Dictionary valueTypes = new Dictionary(); internal Dictionary pointerValues = new Dictionary(); @@ -671,12 +723,16 @@ public MonoSDBHelper(MonoProxy proxy, ILogger logger) { this.proxy = proxy; this.logger = logger; - this.store = null; + ResetStore(null); } - public void SetStore(DebugStore store) + public void ResetStore(DebugStore store) { this.store = store; + this.methods = new(); + this.assemblies = new(); + this.types = new(); + ClearCache(); } public async Task GetAssemblyInfo(SessionId sessionId, int assemblyId, CancellationToken token) @@ -700,7 +756,7 @@ public async Task GetAssemblyInfo(SessionId sessionId, int assembl return null; } } - asm.DebugId = assemblyId; + asm.SetDebugId(assemblyId); assemblies[assemblyId] = asm; return asm; } @@ -813,13 +869,13 @@ public async Task EnableReceiveRequests(SessionId sessionId, EventKind eve internal async Task SendDebuggerAgentCommandInternal(SessionId sessionId, int command_set, int command, MemoryStream parms, CancellationToken token) { - Result res = await proxy.SendMonoCommand(sessionId, MonoCommands.SendDebuggerAgentCommand(GetId(), command_set, command, Convert.ToBase64String(parms.ToArray())), token); - if (res.IsErr) { - throw new Exception($"SendDebuggerAgentCommand Error - {(CommandSet)command_set} - {command}"); + Result res = await proxy.SendMonoCommand(sessionId, MonoCommands.SendDebuggerAgentCommand(GetNewId(), command_set, command, Convert.ToBase64String(parms.ToArray())), token); + byte[] newBytes = Array.Empty(); + if (!res.IsErr) { + newBytes = Convert.FromBase64String(res.Value?["result"]?["value"]?["value"]?.Value()); } - byte[] newBytes = Convert.FromBase64String(res.Value?["result"]?["value"]?["value"]?.Value()); var retDebuggerCmd = new MemoryStream(newBytes); - var retDebuggerCmdReader = new MonoBinaryReader(retDebuggerCmd); + var retDebuggerCmdReader = new MonoBinaryReader(retDebuggerCmd, res.IsErr); return retDebuggerCmdReader; } @@ -851,13 +907,13 @@ internal Task SendDebuggerAgentCommandWithParms(SessionId s internal async Task SendDebuggerAgentCommandWithParmsInternal(SessionId sessionId, int command_set, int command, MemoryStream parms, int type, string extraParm, CancellationToken token) { - Result res = await proxy.SendMonoCommand(sessionId, MonoCommands.SendDebuggerAgentCommandWithParms(GetId(), command_set, command, Convert.ToBase64String(parms.ToArray()), parms.ToArray().Length, type, extraParm), token); - if (res.IsErr) { - throw new Exception("SendDebuggerAgentCommandWithParms Error"); + Result res = await proxy.SendMonoCommand(sessionId, MonoCommands.SendDebuggerAgentCommandWithParms(GetNewId(), command_set, command, Convert.ToBase64String(parms.ToArray()), parms.ToArray().Length, type, extraParm), token); + byte[] newBytes = Array.Empty(); + if (!res.IsErr) { + newBytes = Convert.FromBase64String(res.Value?["result"]?["value"]?["value"]?.Value()); } - byte[] newBytes = Convert.FromBase64String(res.Value?["result"]?["value"]?["value"]?.Value()); var retDebuggerCmd = new MemoryStream(newBytes); - var retDebuggerCmdReader = new MonoBinaryReader(retDebuggerCmd); + var retDebuggerCmdReader = new MonoBinaryReader(retDebuggerCmd, res.IsErr); return retDebuggerCmdReader; } @@ -1210,18 +1266,21 @@ public async Task GetTypePropertiesReader(SessionId sessionId, if (typeInfo == null) return null; - if (typeInfo.PropertiesBinaryReader != null) + if (typeInfo.PropertiesBuffer != null) { - typeInfo.PropertiesBinaryReader.BaseStream.Seek(0, SeekOrigin.Begin); - return typeInfo.PropertiesBinaryReader; + var retDebuggerCmd = new MemoryStream(typeInfo.PropertiesBuffer); + var retDebuggerCmdReader = new MonoBinaryReader(retDebuggerCmd); + return retDebuggerCmdReader; } var commandParams = new MemoryStream(); var commandParamsWriter = new MonoBinaryWriter(commandParams); commandParamsWriter.Write(typeId); - typeInfo.PropertiesBinaryReader = await SendDebuggerAgentCommand(sessionId, CmdType.GetProperties, commandParams, token); - return typeInfo.PropertiesBinaryReader; + var reader = await SendDebuggerAgentCommand(sessionId, CmdType.GetProperties, commandParams, token); + typeInfo.PropertiesBuffer = reader.ReadBytes((int)reader.BaseStream.Length); + reader.BaseStream.Position = 0; + return reader; } public async Task> GetTypeFields(SessionId sessionId, int typeId, CancellationToken token) @@ -1349,7 +1408,7 @@ public async Task GetValueFromDebuggerDisplayAttribute(SessionId session var stringId = getCAttrsRetReader.ReadInt32(); var dispAttrStr = await GetStringValue(sessionId, stringId, token); - ExecutionContext context = proxy.GetContext(sessionId); + ExecutionContext context = proxy.Contexts.GetCurrentContext(sessionId); JArray objectValues = await GetObjectValues(sessionId, objectId, GetObjectCommandOptions.WithProperties | GetObjectCommandOptions.ForDebuggerDisplayAttribute, token); var thisObj = CreateJObject(value: "", type: "object", description: "", writable: false, objectId: $"dotnet:object:{objectId}"); @@ -1387,7 +1446,8 @@ public async Task GetTypeName(SessionId sessionId, int typeId, Cancellat string className = await GetTypeNameOriginal(sessionId, typeId, token); className = className.Replace("+", "."); className = Regex.Replace(className, @"`\d+", ""); - className = className.Replace("[]", "__SQUARED_BRACKETS__"); + className = Regex.Replace(className, @"[[, ]+]", "__SQUARED_BRACKETS__"); + //className = className.Replace("[]", "__SQUARED_BRACKETS__"); className = className.Replace("[", "<"); className = className.Replace("]", ">"); className = className.Replace("__SQUARED_BRACKETS__", "[]"); @@ -1438,15 +1498,20 @@ public async Task GetStringValue(SessionId sessionId, int string_id, Can } return null; } - public async Task GetArrayLength(SessionId sessionId, int object_id, CancellationToken token) + public async Task GetArrayDimensions(SessionId sessionId, int object_id, CancellationToken token) { var commandParams = new MemoryStream(); var commandParamsWriter = new MonoBinaryWriter(commandParams); commandParamsWriter.Write(object_id); var retDebuggerCmdReader = await SendDebuggerAgentCommand(sessionId, CmdArray.GetLength, commandParams, token); var length = retDebuggerCmdReader.ReadInt32(); - length = retDebuggerCmdReader.ReadInt32(); - return length; + var rank = new int[length]; + for (int i = 0 ; i < length; i++) + { + rank[i] = retDebuggerCmdReader.ReadInt32(); + retDebuggerCmdReader.ReadInt32(); //lower_bound + } + return new ArrayDimensions(rank); } public async Task> GetTypeIdFromObject(SessionId sessionId, int object_id, bool withParents, CancellationToken token) { @@ -1765,9 +1830,14 @@ public async Task CreateJObjectForString(SessionId sessionId, MonoBinar public async Task CreateJObjectForArray(SessionId sessionId, MonoBinaryReader retDebuggerCmdReader, CancellationToken token) { var objectId = retDebuggerCmdReader.ReadInt32(); - var value = await GetClassNameFromObject(sessionId, objectId, token); - var length = await GetArrayLength(sessionId, objectId, token); - return CreateJObject(null, "object", $"{value.ToString()}({length})", false, value.ToString(), "dotnet:array:" + objectId, null, "array"); + var className = await GetClassNameFromObject(sessionId, objectId, token); + var arrayType = className.ToString(); + var length = await GetArrayDimensions(sessionId, objectId, token); + if (arrayType.LastIndexOf('[') > 0) + arrayType = arrayType.Insert(arrayType.LastIndexOf('[')+1, length.ToString()); + if (className.LastIndexOf('[') > 0) + className = className.Insert(arrayType.LastIndexOf('[')+1, new string(',', length.Rank-1)); + return CreateJObject(null, "object", description : arrayType, writable : false, className.ToString(), "dotnet:array:" + objectId, null, subtype : length.Rank == 1 ? "array" : null); } public async Task CreateJObjectForObject(SessionId sessionId, MonoBinaryReader retDebuggerCmdReader, int typeIdFromAttribute, bool forDebuggerDisplayAttribute, CancellationToken token) @@ -2183,7 +2253,8 @@ public async Task GetValueTypeProxy(SessionId sessionId, int valueTypeId commandSet = CommandSet.Vm, command = CmdVM.InvokeMethod, buffer = Convert.ToBase64String(command_params_to_proxy.ToArray()), - length = command_params_to_proxy.ToArray().Length + length = command_params_to_proxy.ToArray().Length, + id = GetNewId() }), name = propertyNameStr })); @@ -2193,23 +2264,41 @@ public async Task GetValueTypeProxy(SessionId sessionId, int valueTypeId public async Task GetArrayValues(SessionId sessionId, int arrayId, CancellationToken token) { - var length = await GetArrayLength(sessionId, arrayId, token); + var dimensions = await GetArrayDimensions(sessionId, arrayId, token); var commandParams = new MemoryStream(); var commandParamsWriter = new MonoBinaryWriter(commandParams); commandParamsWriter.Write(arrayId); commandParamsWriter.Write(0); - commandParamsWriter.Write(length); + commandParamsWriter.Write(dimensions.TotalLength); var retDebuggerCmdReader = await SendDebuggerAgentCommand(sessionId, CmdArray.GetValues, commandParams, token); JArray array = new JArray(); - for (int i = 0 ; i < length ; i++) + for (int i = 0 ; i < dimensions.TotalLength; i++) { - var var_json = await CreateJObjectForVariableValue(sessionId, retDebuggerCmdReader, i.ToString(), false, -1, false, token); + var var_json = await CreateJObjectForVariableValue(sessionId, retDebuggerCmdReader, dimensions.GetArrayIndexString(i), isOwn : false, -1, forDebuggerDisplayAttribute : false, token); array.Add(var_json); } return array; } - public async Task EnableExceptions(SessionId sessionId, string state, CancellationToken token) + + public async Task GetArrayValuesProxy(SessionId sessionId, int arrayId, CancellationToken token) + { + var length = await GetArrayDimensions(sessionId, arrayId, token); + var arrayProxy = JObject.FromObject(new + { + items = await GetArrayValues(sessionId, arrayId, token), + dimensionsDetails = length.Bounds + }); + return arrayProxy; + } + + public async Task EnableExceptions(SessionId sessionId, PauseOnExceptionsKind state, CancellationToken token) { + if (state == PauseOnExceptionsKind.Unset) + { + logger.LogDebug($"Trying to setPauseOnExceptions using status Unset"); + return false; + } + var commandParams = new MemoryStream(); var commandParamsWriter = new MonoBinaryWriter(commandParams); commandParamsWriter.Write((byte)EventKind.Exception); @@ -2217,14 +2306,16 @@ public async Task EnableExceptions(SessionId sessionId, string state, Canc commandParamsWriter.Write((byte)1); commandParamsWriter.Write((byte)ModifierKind.ExceptionOnly); commandParamsWriter.Write(0); //exc_class - if (state == "all") + if (state == PauseOnExceptionsKind.All) commandParamsWriter.Write((byte)1); //caught else commandParamsWriter.Write((byte)0); //caught - if (state == "uncaught" || state == "all") + + if (state == PauseOnExceptionsKind.Uncaught || state == PauseOnExceptionsKind.All) commandParamsWriter.Write((byte)1); //uncaught else commandParamsWriter.Write((byte)0); //uncaught + commandParamsWriter.Write((byte)1);//subclasses commandParamsWriter.Write((byte)0);//not_filtered_feature commandParamsWriter.Write((byte)0);//everything_else @@ -2280,10 +2371,16 @@ public async Task GetValuesFromDebuggerProxyAttribute(SessionId sessionI var assemblyNameArg = await GetFullAssemblyName(sessionId, assemblyIdArg, token); var classNameArg = await GetTypeNameOriginal(sessionId, genericTypeArgs[k], token); typeToSearch += classNameArg +", " + assemblyNameArg; + if (k + 1 < genericTypeArgs.Count) + typeToSearch += "], ["; + else + typeToSearch += "]"; } - typeToSearch += "]]"; + typeToSearch += "]"; typeToSearch += ", " + assemblyName; var genericTypeId = await GetTypeByName(sessionId, typeToSearch, token); + if (genericTypeId < 0) + return null; methodId = await GetMethodIdByName(sessionId, genericTypeId, ".ctor", token); } else @@ -2374,7 +2471,8 @@ public async Task GetObjectValues(SessionId sessionId, int objectId, Get command = CmdObject.RefSetValues, buffer = Convert.ToBase64String(command_params_to_set.ToArray()), valtype, - length = command_params_to_set.ToArray().Length + length = command_params_to_set.ToArray().Length, + id = GetNewId() })); } objectFields.Add(fieldValue); @@ -2468,7 +2566,8 @@ public async Task GetObjectProxy(SessionId sessionId, int objectId, Canc command = CmdVM.InvokeMethod, buffer = Convert.ToBase64String(command_params_to_set.ToArray()), valtype = attr["set"]["valtype"], - length = command_params_to_set.ToArray().Length + length = command_params_to_set.ToArray().Length, + id = GetNewId() }); } continue; @@ -2487,7 +2586,8 @@ public async Task GetObjectProxy(SessionId sessionId, int objectId, Canc commandSet = CommandSet.Vm, command = CmdVM.InvokeMethod, buffer = Convert.ToBase64String(command_params_to_get.ToArray()), - length = command_params_to_get.ToArray().Length + length = command_params_to_get.ToArray().Length, + id = GetNewId() }), name = propertyNameStr })); @@ -2511,15 +2611,9 @@ public async Task SetVariableValue(SessionId sessionId, int thread_id, int JArray locals = new JArray(); retDebuggerCmdReader = await SendDebuggerAgentCommand(sessionId, CmdFrame.GetValues, commandParams, token); int etype = retDebuggerCmdReader.ReadByte(); - try - { - retDebuggerCmdReader = await SendDebuggerAgentCommandWithParms(sessionId, CmdFrame.SetValues, commandParams, etype, newValue, token); - } - catch (Exception) - { + retDebuggerCmdReader = await SendDebuggerAgentCommandWithParms(sessionId, CmdFrame.SetValues, commandParams, etype, newValue, token); + if (retDebuggerCmdReader.HasError) return false; - } - return true; } } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/ArrayTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/ArrayTests.cs index dfe99aed5a7694..22447a87c88806 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/ArrayTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/ArrayTests.cs @@ -198,6 +198,24 @@ public async Task InspectGenericValueTypeArrayLocals2(int line, int col, string frame_idx: frame_idx, use_cfo: use_cfo); + async Task GetObjectWithCFO(string objectId, JObject fn_args = null) + { + var fn_decl = "function () { return this; }"; + var cfo_args = JObject.FromObject(new + { + functionDeclaration = fn_decl, + objectId = objectId + }); + + if (fn_args != null) + cfo_args["arguments"] = fn_args; + + // callFunctionOn + var result = await cli.SendCommand("Runtime.callFunctionOn", cfo_args, token); + + return await GetProperties(result.Value["result"]["objectId"]?.Value(), fn_args); + } + async Task TestSimpleArrayLocals(int line, int col, string entry_method_name, string method_name, string etype_name, string local_var_name_prefix, object[] array, object[] array_elem_props, bool test_prev_frame = false, int frame_idx = 0, bool use_cfo = false) @@ -215,8 +233,8 @@ async Task TestSimpleArrayLocals(int line, int col, string entry_method_name, st var locals = await GetProperties(pause_location["callFrames"][frame_idx]["callFrameId"].Value()); Assert.Equal(4, locals.Count()); - CheckArray(locals, $"{local_var_name_prefix}_arr", $"{etype_name}[]", array?.Length ?? 0); - CheckArray(locals, $"{local_var_name_prefix}_arr_empty", $"{etype_name}[]", 0); + CheckArray(locals, $"{local_var_name_prefix}_arr", $"{etype_name}[]", $"{etype_name}[{array?.Length ?? 0}]"); + CheckArray(locals, $"{local_var_name_prefix}_arr_empty", $"{etype_name}[]", $"{etype_name}[0]"); CheckObject(locals, $"{local_var_name_prefix}_arr_null", $"{etype_name}[]", is_null: true); CheckBool(locals, "call_other", test_prev_frame); @@ -264,24 +282,6 @@ async Task TestSimpleArrayLocals(int line, int col, string entry_method_name, st var props = await GetObjectOnFrame(pause_location["callFrames"][frame_idx], $"{local_var_name_prefix}_arr_empty"); await CheckProps(props, new object[0], "${local_var_name_prefix}_arr_empty"); - - async Task GetObjectWithCFO(string objectId, JObject fn_args = null) - { - var fn_decl = "function () { return this; }"; - var cfo_args = JObject.FromObject(new - { - functionDeclaration = fn_decl, - objectId = objectId - }); - - if (fn_args != null) - cfo_args["arguments"] = fn_args; - - // callFunctionOn - var result = await cli.SendCommand("Runtime.callFunctionOn", cfo_args, token); - - return await GetProperties(result.Value["result"]["objectId"]?.Value(), fn_args); - } } [Theory] @@ -313,10 +313,10 @@ public async Task InspectObjectArrayMembers(bool use_cfo) await CheckProps(c_props, new { id = TString("c#id"), - ClassArrayProperty = TArray("DebuggerTests.SimpleClass[]", 3), - ClassArrayField = TArray("DebuggerTests.SimpleClass[]", 3), - PointsProperty = TArray("DebuggerTests.Point[]", 2), - PointsField = TArray("DebuggerTests.Point[]", 2) + ClassArrayProperty = TArray("DebuggerTests.SimpleClass[]", "DebuggerTests.SimpleClass[3]"), + ClassArrayField = TArray("DebuggerTests.SimpleClass[]", "DebuggerTests.SimpleClass[3]"), + PointsProperty = TArray("DebuggerTests.Point[]", "DebuggerTests.Point[2]"), + PointsField = TArray("DebuggerTests.Point[]", "DebuggerTests.Point[2]") }, "c" ); @@ -382,8 +382,8 @@ public async Task InspectValueTypeArrayLocalsStaticAsync(bool use_cfo) await CheckProps(frame_locals, new { call_other = TBool(false), - gvclass_arr = TArray("DebuggerTests.SimpleGenericStruct[]", 2), - gvclass_arr_empty = TArray("DebuggerTests.SimpleGenericStruct[]"), + gvclass_arr = TArray("DebuggerTests.SimpleGenericStruct[]", "DebuggerTests.SimpleGenericStruct[2]"), + gvclass_arr_empty = TArray("DebuggerTests.SimpleGenericStruct[]", "DebuggerTests.SimpleGenericStruct[0]"), gvclass_arr_null = TObject("DebuggerTests.SimpleGenericStruct[]", is_null: true), gvclass = TValueType("DebuggerTests.SimpleGenericStruct"), // BUG: this shouldn't be null! @@ -448,7 +448,7 @@ public async Task InspectValueTypeArrayLocalsInstanceAsync(bool use_cfo) { t1 = TObject("DebuggerTests.SimpleGenericStruct"), @this = TObject("DebuggerTests.ArrayTestsClass"), - point_arr = TArray("DebuggerTests.Point[]", 2), + point_arr = TArray("DebuggerTests.Point[]", "DebuggerTests.Point[2]"), point = TValueType("DebuggerTests.Point") }, "InspectValueTypeArrayLocalsInstanceAsync#locals"); @@ -642,6 +642,59 @@ public async Task InvalidAccessors() => await CheckInspectLocalsAtBreakpointSite AssertEqual("undefined", res.Value["result"]?["type"]?.ToString(), "Expected to get undefined result for non-existant accessor"); } }); + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task InspectPrimitiveTypeMultiArrayLocals(bool use_cfo) + { + var debugger_test_loc = "dotnet://debugger-test.dll/debugger-array-test.cs"; + + var eval_expr = "window.setTimeout(function() { invoke_static_method (" + + $"'[debugger-test] DebuggerTests.MultiDimensionalArray:run'" + + "); }, 1);"; + var pause_location = await EvaluateAndCheck(eval_expr, debugger_test_loc, 343, 12, "run"); + + var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); + Assert.Equal(3, locals.Count()); + var int_arr_1 = !use_cfo ? + await GetProperties(locals[0]["value"]["objectId"].Value()) : + await GetObjectWithCFO((locals[0]["value"]["objectId"].Value())); + + CheckNumber(int_arr_1, "0", 0); + CheckNumber(int_arr_1, "1", 1); + var int_arr_2 = !use_cfo ? + await GetProperties(locals[1]["value"]["objectId"].Value()) : + await GetObjectWithCFO((locals[1]["value"]["objectId"].Value())); + CheckNumber(int_arr_2, "0, 0", 0); + CheckNumber(int_arr_2, "0, 1", 1); + CheckNumber(int_arr_2, "0, 2", 2); + CheckNumber(int_arr_2, "1, 0", 10); + CheckNumber(int_arr_2, "1, 1", 11); + CheckNumber(int_arr_2, "1, 2", 12); + + var int_arr_3 = !use_cfo ? + await GetProperties(locals[2]["value"]["objectId"].Value()) : + await GetObjectWithCFO((locals[2]["value"]["objectId"].Value())); + CheckNumber(int_arr_3, "0, 0, 0", 0); + CheckNumber(int_arr_3, "0, 0, 1", 1); + CheckNumber(int_arr_3, "0, 0, 2", 2); + CheckNumber(int_arr_3, "0, 1, 0", 10); + CheckNumber(int_arr_3, "0, 1, 1", 11); + CheckNumber(int_arr_3, "0, 1, 2", 12); + CheckNumber(int_arr_3, "0, 2, 0", 20); + CheckNumber(int_arr_3, "0, 2, 1", 21); + CheckNumber(int_arr_3, "0, 2, 2", 22); + CheckNumber(int_arr_3, "1, 0, 0", 100); + CheckNumber(int_arr_3, "1, 0, 1", 101); + CheckNumber(int_arr_3, "1, 0, 2", 102); + CheckNumber(int_arr_3, "1, 1, 0", 110); + CheckNumber(int_arr_3, "1, 1, 1", 111); + CheckNumber(int_arr_3, "1, 1, 2", 112); + CheckNumber(int_arr_3, "1, 2, 0", 120); + CheckNumber(int_arr_3, "1, 2, 1", 121); + CheckNumber(int_arr_3, "1, 2, 2", 122); + } } } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/AssignmentTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/AssignmentTests.cs index 1afa97939d5ef1..0601552db6b606 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/AssignmentTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/AssignmentTests.cs @@ -19,7 +19,7 @@ public class AssignmentTests : DebuggerTestBase { "MONO_TYPE_CHAR", TSymbol("0 '\u0000'"), TSymbol("97 'a'") }, { "MONO_TYPE_STRING", TString(default), TString("hello") }, { "MONO_TYPE_ENUM", TEnum("DebuggerTests.RGB", "Red"), TEnum("DebuggerTests.RGB", "Blue") }, - { "MONO_TYPE_ARRAY", TObject("byte[]", is_null: true), TArray("byte[]", 2) }, + { "MONO_TYPE_ARRAY", TObject("byte[]", is_null: true), TArray("byte[]", "byte[2]") }, { "MONO_TYPE_VALUETYPE", TValueType("DebuggerTests.Point"), TValueType("DebuggerTests.Point") }, { "MONO_TYPE_VALUETYPE2", TValueType("System.Decimal","0"), TValueType("System.Decimal", "1.1") }, { "MONO_TYPE_GENERICINST", TObject("System.Func", is_null: true), TDelegate("System.Func", "int Prepare ()") }, diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs index db5fbf34b40c26..2c95d68eec9b22 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs @@ -8,6 +8,7 @@ using Newtonsoft.Json.Linq; using System.IO; using Xunit; +using System.Threading; namespace DebuggerTests { @@ -131,11 +132,6 @@ public async Task CreateGoodBreakpointAndHit() { var bp = await SetBreakpoint("dotnet://debugger-test.dll/debugger-test.cs", 10, 8); - var eval_req = JObject.FromObject(new - { - expression = "window.setTimeout(function() { invoke_add(); }, 1);", - }); - await EvaluateAndCheck( "window.setTimeout(function() { invoke_add(); }, 1);", "dotnet://debugger-test.dll/debugger-test.cs", 10, 8, @@ -448,5 +444,273 @@ await StepAndCheck(StepKind.Over, "dotnet://ApplyUpdateReferencedAssembly.dll/Me pause_location = await SendCommandAndCheck(JObject.FromObject(new { }), "Debugger.resume", "dotnet://ApplyUpdateReferencedAssembly.dll/MethodBody1.cs", 38, 8, "StaticMethod4"); locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); } + + [Fact] + public async Task ConditionalBreakpointInALoop() + { + var bp_conditional = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 4, condition:"i == 3"); + var bp_check = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 5); + await EvaluateAndCheck( + "window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", + bp_conditional.Value["locations"][0]["lineNumber"].Value(), + bp_conditional.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak", + locals_fn: (locals) => + { + CheckNumber(locals, "i", 3); + } + ); + + await SendCommandAndCheck(null, "Debugger.resume", + null, + bp_check.Value["locations"][0]["lineNumber"].Value(), + bp_check.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak"); + } + + [Fact] + public async Task ConditionalBreakpointInALoopStopMoreThanOnce() + { + var bp_conditional = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 4, condition:"i % 3 == 0"); + var bp_check = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 5); + await EvaluateAndCheck( + "window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", + bp_conditional.Value["locations"][0]["lineNumber"].Value(), + bp_conditional.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak", + locals_fn: (locals) => + { + CheckNumber(locals, "i", 0); + } + ); + + await SendCommandAndCheck(null, "Debugger.resume", + null, + bp_conditional.Value["locations"][0]["lineNumber"].Value(), + bp_conditional.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak", + locals_fn: (locals) => + { + CheckNumber(locals, "i", 3); + }); + + await SendCommandAndCheck(null, "Debugger.resume", + null, + bp_conditional.Value["locations"][0]["lineNumber"].Value(), + bp_conditional.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak", + locals_fn: (locals) => + { + CheckNumber(locals, "i", 6); + }); + + await SendCommandAndCheck(null, "Debugger.resume", + null, + bp_conditional.Value["locations"][0]["lineNumber"].Value(), + bp_conditional.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak", + locals_fn: (locals) => + { + CheckNumber(locals, "i", 9); + }); + + await SendCommandAndCheck(null, "Debugger.resume", + null, + bp_check.Value["locations"][0]["lineNumber"].Value(), + bp_check.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak"); + } + + [Fact] + public async Task ConditionalBreakpointNoStopInALoop() + { + var bp_conditional = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 4, condition:"i == \"10\""); + var bp_check = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 5); + await EvaluateAndCheck( + "window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", + bp_check.Value["locations"][0]["lineNumber"].Value(), + bp_check.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak" + ); + } + + [Fact] + public async Task ConditionalBreakpointNotBooleanInALoop() + { + var bp_conditional = await SetBreakpointInMethod("debugger-test.dll", "LoopClass", "LoopToBreak", 4, condition:"i + 4"); + await EvaluateAndCheck( + "window.setTimeout(function() { invoke_static_method('[debugger-test] LoopClass:LoopToBreak'); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", + bp_conditional.Value["locations"][0]["lineNumber"].Value(), + bp_conditional.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak", + locals_fn: (locals) => + { + CheckNumber(locals, "i", 0); + } + ); + + await SendCommandAndCheck(null, "Debugger.resume", + null, + bp_conditional.Value["locations"][0]["lineNumber"].Value(), + bp_conditional.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak", + locals_fn: (locals) => + { + CheckNumber(locals, "i", 1); + }); + + await SendCommandAndCheck(null, "Debugger.resume", + null, + bp_conditional.Value["locations"][0]["lineNumber"].Value(), + bp_conditional.Value["locations"][0]["columnNumber"].Value(), + "LoopToBreak", + locals_fn: (locals) => + { + CheckNumber(locals, "i", 2); + }); + } + + [Fact] + public async Task CreateGoodBreakpointAndHitGoToNonWasmPageComeBackAndHitAgain() + { + var bp = await SetBreakpoint("dotnet://debugger-test.dll/debugger-test.cs", 10, 8); + var pause_location = await EvaluateAndCheck( + "window.setTimeout(function() { invoke_add(); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", 10, 8, + "IntAdd"); + Assert.Equal("other", pause_location["reason"]?.Value()); + Assert.Equal(bp.Value["breakpointId"]?.ToString(), pause_location["hitBreakpoints"]?[0]?.Value()); + + var top_frame = pause_location["callFrames"][0]; + Assert.Equal("IntAdd", top_frame["functionName"].Value()); + Assert.Contains("debugger-test.cs", top_frame["url"].Value()); + + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 8, 4, scripts, top_frame["functionLocation"]); + + //now check the scope + var scope = top_frame["scopeChain"][0]; + Assert.Equal("local", scope["type"]); + Assert.Equal("IntAdd", scope["name"]); + + Assert.Equal("object", scope["object"]["type"]); + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 8, 4, scripts, scope["startLocation"]); + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 14, 4, scripts, scope["endLocation"]); + + await cli.SendCommand("Debugger.resume", null, token); + + var run_method = JObject.FromObject(new + { + expression = "window.setTimeout(function() { load_non_wasm_page(); }, 1);" + }); + await cli.SendCommand("Runtime.evaluate", run_method, token); + await Task.Delay(1000, token); + + run_method = JObject.FromObject(new + { + expression = "window.setTimeout(function() { reload_wasm_page(); }, 1);" + }); + await cli.SendCommand("Runtime.evaluate", run_method, token); + await insp.WaitFor(Inspector.READY); + await EvaluateAndCheck( + "window.setTimeout(function() { invoke_add(); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", 10, 8, + "IntAdd", + wait_for_event_fn: (pause_location) => + { + Assert.Equal("other", pause_location["reason"]?.Value()); + Assert.Equal(bp.Value["breakpointId"]?.ToString(), pause_location["hitBreakpoints"]?[0]?.Value()); + + var top_frame = pause_location["callFrames"][0]; + Assert.Equal("IntAdd", top_frame["functionName"].Value()); + Assert.Contains("debugger-test.cs", top_frame["url"].Value()); + + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 8, 4, scripts, top_frame["functionLocation"]); + + //now check the scope + var scope = top_frame["scopeChain"][0]; + Assert.Equal("local", scope["type"]); + Assert.Equal("IntAdd", scope["name"]); + + Assert.Equal("object", scope["object"]["type"]); + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 8, 4, scripts, scope["startLocation"]); + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 14, 4, scripts, scope["endLocation"]); + return Task.CompletedTask; + } + ); + } + + [Fact] + public async Task CreateGoodBreakpointAndHitGoToWasmPageWithoutAssetsComeBackAndHitAgain() + { + var bp = await SetBreakpoint("dotnet://debugger-test.dll/debugger-test.cs", 10, 8); + var pause_location = await EvaluateAndCheck( + "window.setTimeout(function() { invoke_add(); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", 10, 8, + "IntAdd"); + Assert.Equal("other", pause_location["reason"]?.Value()); + Assert.Equal(bp.Value["breakpointId"]?.ToString(), pause_location["hitBreakpoints"]?[0]?.Value()); + + var top_frame = pause_location["callFrames"][0]; + Assert.Equal("IntAdd", top_frame["functionName"].Value()); + Assert.Contains("debugger-test.cs", top_frame["url"].Value()); + + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 8, 4, scripts, top_frame["functionLocation"]); + + //now check the scope + var scope = top_frame["scopeChain"][0]; + Assert.Equal("local", scope["type"]); + Assert.Equal("IntAdd", scope["name"]); + + Assert.Equal("object", scope["object"]["type"]); + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 8, 4, scripts, scope["startLocation"]); + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 14, 4, scripts, scope["endLocation"]); + + await cli.SendCommand("Debugger.resume", null, token); + + var run_method = JObject.FromObject(new + { + expression = "window.setTimeout(function() { load_wasm_page_without_assets(); }, 1);" + }); + await cli.SendCommand("Runtime.evaluate", run_method, token); + await Task.Delay(1000, token); + run_method = JObject.FromObject(new + { + expression = "window.setTimeout(function() { reload_wasm_page(); }, 1);" + }); + await cli.SendCommand("Runtime.evaluate", run_method, token); + await Task.Delay(1000, token); + await insp.WaitFor(Inspector.READY); + await EvaluateAndCheck( + "window.setTimeout(function() { invoke_add(); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", 10, 8, + "IntAdd", + wait_for_event_fn: async (pause_location) => + { + Assert.Equal("other", pause_location["reason"]?.Value()); + Assert.Equal(bp.Value["breakpointId"]?.ToString(), pause_location["hitBreakpoints"]?[0]?.Value()); + + var top_frame = pause_location["callFrames"][0]; + Assert.Equal("IntAdd", top_frame["functionName"].Value()); + Assert.Contains("debugger-test.cs", top_frame["url"].Value()); + + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 8, 4, scripts, top_frame["functionLocation"]); + + //now check the scope + var scope = top_frame["scopeChain"][0]; + Assert.Equal("local", scope["type"]); + Assert.Equal("IntAdd", scope["name"]); + + Assert.Equal("object", scope["object"]["type"]); + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 8, 4, scripts, scope["startLocation"]); + CheckLocation("dotnet://debugger-test.dll/debugger-test.cs", 14, 4, scripts, scope["endLocation"]); + await Task.CompletedTask; + } + ); + } + } } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/CallFunctionOnTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/CallFunctionOnTests.cs index 5b101f0236d040..e80fe46224695e 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/CallFunctionOnTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/CallFunctionOnTests.cs @@ -361,7 +361,7 @@ public async Task RunOnJSObject(bool roundtrip) => await RunCallFunctionOn( await CheckProps(obj_own_val, new { a_obj = TObject("Object"), - b_arr = TArray("Array", 2) + b_arr = TArray("Array", "Array(2)") }, "obj_own"); }); @@ -641,7 +641,7 @@ public async Task PropertyGettersTest(string eval_fn, string method_name, int li // Check arrays through getters res = await InvokeGetter(obj, get_args_fn(new[] { "IntArray" }), cfo_fn); - await CheckValue(res.Value["result"], TArray("int[]", 2), $"{local_name}.IntArray"); + await CheckValue(res.Value["result"], TArray("int[]", "int[2]"), $"{local_name}.IntArray"); { var arr_elems = await GetProperties(res.Value["result"]?["objectId"]?.Value()); var exp_elems = new[] @@ -654,7 +654,7 @@ public async Task PropertyGettersTest(string eval_fn, string method_name, int li } res = await InvokeGetter(obj, get_args_fn(new[] { "DTArray" }), cfo_fn); - await CheckValue(res.Value["result"], TArray("System.DateTime[]", 2), $"{local_name}.DTArray"); + await CheckValue(res.Value["result"], TArray("System.DateTime[]", "System.DateTime[2]"), $"{local_name}.DTArray"); { var dt0 = new DateTime(6, 7, 8, 9, 10, 11); var dt1 = new DateTime(1, 2, 3, 4, 5, 6); @@ -944,7 +944,7 @@ async Task CheckCFOResult(Result result) if (res_array_len < 0) await CheckValue(result.Value["result"], TObject("Object"), $"cfo-res"); else - await CheckValue(result.Value["result"], TArray("Array", res_array_len), $"cfo-res"); + await CheckValue(result.Value["result"], TArray("Array", $"Array({res_array_len})"), $"cfo-res"); } } } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/CustomViewTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/CustomViewTests.cs index 09bee325d72c43..06516155b7d399 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/CustomViewTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/CustomViewTests.cs @@ -8,6 +8,7 @@ using Newtonsoft.Json.Linq; using System.Threading; using Xunit; +using System.Collections.Generic; namespace DebuggerTests { @@ -17,7 +18,7 @@ public class CustomViewTests : DebuggerTestBase [Fact] public async Task UsingDebuggerDisplay() { - var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest", "run", 6); + var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest", "run", 15); var pause_location = await EvaluateAndCheck( "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.DebuggerCustomViewTest:run'); }, 1);", "dotnet://debugger-test.dll/debugger-custom-view-test.cs", @@ -29,12 +30,14 @@ public async Task UsingDebuggerDisplay() CheckObject(locals, "a", "DebuggerTests.WithDisplayString", description:"Some one Value 2 End"); CheckObject(locals, "c", "DebuggerTests.DebuggerDisplayMethodTest", description: "First Int:32 Second Int:43"); CheckObject(locals, "myList", "System.Collections.Generic.List", description: "Count = 4"); + CheckObject(locals, "person1", "DebuggerTests.Person", description: "FirstName: Anton, SurName: Mueller, Age: 44"); + CheckObject(locals, "person2", "DebuggerTests.Person", description: "FirstName: Lisa, SurName: Müller, Age: 41"); } [Fact] public async Task UsingDebuggerTypeProxy() { - var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest", "run", 6); + var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest", "run", 15); var pause_location = await EvaluateAndCheck( "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.DebuggerCustomViewTest:run'); }, 1);", "dotnet://debugger-test.dll/debugger-custom-view-test.cs", @@ -48,14 +51,54 @@ public async Task UsingDebuggerTypeProxy() var props = await GetObjectOnFrame(frame, "myList"); Assert.Equal(1, props.Count()); - CheckArray(props, "Items", "int[]", 4); + CheckArray(props, "Items", "int[]", "int[4]"); CheckObject(locals, "b", "DebuggerTests.WithProxy", description:"DebuggerTests.WithProxy"); props = await GetObjectOnFrame(frame, "b"); CheckString(props, "Val2", "one"); + CheckObject(locals, "openWith", "System.Collections.Generic.Dictionary", description: "Count = 3"); + props = await GetObjectOnFrame(frame, "openWith"); + Assert.Equal(1, props.Count()); + await EvaluateOnCallFrameAndCheck(frame["callFrameId"].Value(), ("listToTestToList.ToList()", TObject("System.Collections.Generic.List", description: "Count = 11"))); + + } + + [Fact] + public async Task UsingDebuggerDisplayConcurrent() + { + async Task CheckProperties(JObject pause_location) + { + var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); + var l = GetAndAssertObjectWithName(locals, "myList"); + var val = l["value"]; + if (val["description"].Value() != "Count = 0") + return false; + return true; + } + + var bp = await SetBreakpointInMethod("debugger-test.dll", "DebuggerTests.DebuggerCustomViewTest2", "run", 2); + var pause_location = await EvaluateAndCheck( + "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.DebuggerCustomViewTest2:run'); }, 1);", + "dotnet://debugger-test.dll/debugger-custom-view-test.cs", + bp.Value["locations"][0]["lineNumber"].Value(), + bp.Value["locations"][0]["columnNumber"].Value(), + "run"); + + pause_location = await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-custom-view-test.cs", bp.Value["locations"][0]["lineNumber"].Value()+2, bp.Value["locations"][0]["columnNumber"].Value(), "run"); + + List> tasks = new(); + for (int i = 0 ; i < 10; i++) + { + var task = CheckProperties(pause_location); + tasks.Add(task); + } + foreach(Task task in tasks) + { + Assert.True(task.Result); + } } } } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs b/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs index 1d30086b6b2d9c..fb4c0cf63f05e8 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs @@ -352,10 +352,10 @@ internal JToken CheckEnum(JToken locals, string name, string class_name, string return l; } - internal void CheckArray(JToken locals, string name, string class_name, int length) + internal void CheckArray(JToken locals, string name, string class_name, string description) => CheckValue( GetAndAssertObjectWithName(locals, name)["value"], - TArray(class_name, length), name).Wait(); + TArray(class_name, description), name).Wait(); internal JToken GetAndAssertObjectWithName(JToken obj, string name, string label = "") { @@ -974,7 +974,7 @@ internal static JObject TObject(string className, string description = null, boo JObject.FromObject(new { type = "object", className = className, description = description ?? className, subtype = is_null ? "null" : null }) : JObject.FromObject(new { type = "object", className = className, description = description ?? className }); - internal static JObject TArray(string className, int length = 0) => JObject.FromObject(new { type = "object", className = className, description = $"{className}({length})", subtype = "array" }); + internal static JObject TArray(string className, string description) => JObject.FromObject(new { type = "object", className, description, subtype = "array" }); internal static JObject TBool(bool value) => JObject.FromObject(new { type = "boolean", value = @value, description = @value ? "true" : "false" }); diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/DelegateTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/DelegateTests.cs index 2fc0fb52ce99f9..cdbee2079e72aa 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/DelegateTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/DelegateTests.cs @@ -32,19 +32,19 @@ await CheckInspectLocalsAtBreakpointSite( { fn_func = TDelegate("System.Func", "bool |(Math)"), fn_func_null = TObject("System.Func", is_null: true), - fn_func_arr = TArray("System.Func[]", 1), + fn_func_arr = TArray("System.Func[]", "System.Func[1]"), fn_del = TDelegate("Math.IsMathNull", "bool IsMathNullDelegateTarget (Math)"), fn_del_null = TObject("Math.IsMathNull", is_null: true), - fn_del_arr = TArray("Math.IsMathNull[]", 1), + fn_del_arr = TArray("Math.IsMathNull[]", "Math.IsMathNull[1]"), // Unused locals fn_func_unused = TDelegate("System.Func", "bool |(Math)"), fn_func_null_unused = TObject("System.Func", is_null: true), - fn_func_arr_unused = TArray("System.Func[]", 1), + fn_func_arr_unused = TArray("System.Func[]", "System.Func[1]"), fn_del_unused = TDelegate("Math.IsMathNull", "bool IsMathNullDelegateTarget (Math)"), fn_del_null_unused = TObject("Math.IsMathNull", is_null: true), - fn_del_arr_unused = TArray("Math.IsMathNull[]", 1), + fn_del_arr_unused = TArray("Math.IsMathNull[]", "Math.IsMathNull[1]"), res = TBool(false), m_obj = TObject("Math") @@ -105,7 +105,7 @@ public async Task InspectDelegateSignaturesWithFunc(int frame, int line, int col fn_func_null = TObject("System.Func>, Math.GenericStruct>", is_null: true), fn_func_only_ret = TDelegate("System.Func", "bool |()"), - fn_func_arr = TArray("System.Func>, Math.GenericStruct>[]", 1), + fn_func_arr = TArray("System.Func>, Math.GenericStruct>[]", "System.Func>, Math.GenericStruct>[1]"), fn_del = TDelegate("Math.DelegateForSignatureTest", "Math.GenericStruct DelegateTargetForSignatureTest (Math,Math.GenericStruct>)"), @@ -114,16 +114,16 @@ public async Task InspectDelegateSignaturesWithFunc(int frame, int line, int col "Math.GenericStruct |(Math,Math.GenericStruct>)"), fn_del_null = TObject("Math.DelegateForSignatureTest", is_null: true), - fn_del_arr = TArray("Math.DelegateForSignatureTest[]", 2), + fn_del_arr = TArray("Math.DelegateForSignatureTest[]", "Math.DelegateForSignatureTest[2]"), m_obj = TObject("Math"), gs_gs = TValueType("Math.GenericStruct>"), fn_void_del = TDelegate("Math.DelegateWithVoidReturn", "void DelegateTargetWithVoidReturn (Math.GenericStruct)"), - fn_void_del_arr = TArray("Math.DelegateWithVoidReturn[]", 1), + fn_void_del_arr = TArray("Math.DelegateWithVoidReturn[]", "Math.DelegateWithVoidReturn[1]"), fn_void_del_null = TObject("Math.DelegateWithVoidReturn", is_null: true), gs = TValueType("Math.GenericStruct"), - rets = TArray("Math.GenericStruct[]", 6) + rets = TArray("Math.GenericStruct[]", "Math.GenericStruct[6]") }, "locals"); await CompareObjectPropertiesFor(locals, "fn_func_arr", new[] @@ -176,7 +176,7 @@ public async Task ActionTSignatureTest(int frame, int line, int col, string bp_m fn_action_null = TObject("System.Action>", is_null: true), - fn_action_arr = TArray("System.Action>[]", 3), + fn_action_arr = TArray("System.Action>[]", "System.Action>[3]"), gs = TValueType("Math.GenericStruct"), }, "locals"); @@ -212,8 +212,8 @@ public async Task NestedDelegatesTest(int frame, int line, int col, string bp_me fn_func = TDelegate("System.Func, bool>", "bool |(Func)"), fn_func_null = TObject("System.Func, bool>", is_null: true), - fn_func_arr = TArray("System.Func, bool>[]", 1), - fn_del_arr = TArray("System.Func, bool>[]", 1), + fn_func_arr = TArray("System.Func, bool>[]", "System.Func, bool>[1]"), + fn_del_arr = TArray("System.Func, bool>[]", "System.Func, bool>[1]"), m_obj = TObject("Math"), fn_del_null = TObject("System.Func, bool>", is_null: true), @@ -253,7 +253,7 @@ public async Task DelegatesAsMethodArgsTest(int frame, int line, int col, string await CheckProps(locals, new { @this = TObject("Math"), - dst_arr = TArray("Math.DelegateForSignatureTest[]", 2), + dst_arr = TArray("Math.DelegateForSignatureTest[]", "Math.DelegateForSignatureTest[2]"), fn_func = TDelegate("System.Func", "bool |(char[])"), fn_action = TDelegate("System.Action[]>", @@ -284,7 +284,7 @@ public async Task MethodWithDelegatesAsyncTest(bool use_cfo) => await CheckInspe await CheckProps(locals, new { @this = TObject("Math"), - _dst_arr = TArray("Math.DelegateForSignatureTest[]", 2), + _dst_arr = TArray("Math.DelegateForSignatureTest[]", "Math.DelegateForSignatureTest[2]"), _fn_func = TDelegate("System.Func", "bool |(char[])"), _fn_action = TDelegate("System.Action[]>", diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs index 0b613dcca3370a..724648ccee9518 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs @@ -641,6 +641,28 @@ await EvaluateOnCallFrameFail(id, ); }); + [Fact] + public async Task EvaluateStaticAttributeInAssemblyNotRelatedButLoaded() => await CheckInspectLocalsAtBreakpointSite( + "DebuggerTests.EvaluateTestsClass/TestEvaluate", "EvaluateLocalsFromAnotherAssembly", 5, "EvaluateLocalsFromAnotherAssembly", + "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateTestsClass:EvaluateLocalsFromAnotherAssembly'); })", + wait_for_event_fn: async (pause_location) => + { + var id = pause_location["callFrames"][0]["callFrameId"].Value(); + await EvaluateOnCallFrameAndCheck(id, + ("DebuggerTests.ClassToBreak.valueToCheck", TNumber(10))); + }); + + [Fact] + public async Task EvaluateLocalObjectFromAssemblyNotRelatedButLoaded() + => await CheckInspectLocalsAtBreakpointSite( + "DebuggerTests.EvaluateTestsClass/TestEvaluate", "EvaluateLocalsFromAnotherAssembly", 5, "EvaluateLocalsFromAnotherAssembly", + "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.EvaluateTestsClass:EvaluateLocalsFromAnotherAssembly'); })", + wait_for_event_fn: async (pause_location) => + { + var id = pause_location["callFrames"][0]["callFrameId"].Value(); + await EvaluateOnCallFrameAndCheck(id, + ("a.valueToCheck", TNumber(20))); + }); } } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/ExceptionTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/ExceptionTests.cs index eb0ebe0cc0d540..33dbd2b6db64f8 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/ExceptionTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/ExceptionTests.cs @@ -232,10 +232,11 @@ await CheckValue(pause_location["data"], JObject.FromObject(new CheckString(exception_members, "message", "not implemented uncaught"); } - [Fact] - public async Task ExceptionTestAllWithReload() + [Theory] + [InlineData("[debugger-test] DebuggerTests.ExceptionTestsClassDefault:TestExceptions", "System.Exception", 76)] + [InlineData("[debugger-test] DebuggerTests.ExceptionTestsClass:TestExceptions", "DebuggerTests.CustomException", 28)] + public async Task ExceptionTestAllWithReload(string entry_method_name, string class_name, int line_number) { - string entry_method_name = "[debugger-test] DebuggerTests.ExceptionTestsClass:TestExceptions"; var debugger_test_loc = "dotnet://debugger-test.dll/debugger-exception-test.cs"; await SetPauseOnException("all"); @@ -255,7 +256,7 @@ public async Task ExceptionTestAllWithReload() i++; } - + var eval_expr = "window.setTimeout(function() { invoke_static_method (" + $"'{entry_method_name}'" + "); }, 1);"; @@ -270,29 +271,31 @@ await CheckValue(pause_location["data"], JObject.FromObject(new { type = "object", subtype = "error", - className = "DebuggerTests.CustomException", - uncaught = false + className = class_name, + uncaught = false, + description = "not implemented caught" }), "exception0.data"); var exception_members = await GetProperties(pause_location["data"]["objectId"]?.Value()); - CheckString(exception_members, "message", "not implemented caught"); + CheckString(exception_members, "_message", "not implemented caught"); pause_location = await WaitForManagedException(null); AssertEqual("run", pause_location["callFrames"]?[0]?["functionName"]?.Value(), "pause1"); //stop in the uncaught exception - CheckLocation(debugger_test_loc, 28, 16, scripts, pause_location["callFrames"][0]["location"]); + CheckLocation(debugger_test_loc, line_number, 16, scripts, pause_location["callFrames"][0]["location"]); await CheckValue(pause_location["data"], JObject.FromObject(new { type = "object", subtype = "error", - className = "DebuggerTests.CustomException", - uncaught = true + className = class_name, + uncaught = true, + description = "not implemented uncaught" }), "exception1.data"); exception_members = await GetProperties(pause_location["data"]["objectId"]?.Value()); - CheckString(exception_members, "message", "not implemented uncaught"); + CheckString(exception_members, "_message", "not implemented uncaught"); } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/PointerTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/PointerTests.cs index ee703b29648bb1..891eea7352c8aa 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/PointerTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/PointerTests.cs @@ -81,7 +81,7 @@ public async Task InspectLocalPointerArrays(string eval_fn, string type, string var dt = new DateTime(5, 6, 7, 8, 9, 10); await CheckProps(locals, new { - ipa = TArray("int*[]", 3) + ipa = TArray("int*[]", "int*[3]") }, "locals", num_fields: 26); var ipa_elems = await CompareObjectPropertiesFor(locals, "ipa", new[] @@ -112,7 +112,7 @@ public async Task InspectLocalDoublePointerToPrimitiveTypeArrays(string eval_fn, var dt = new DateTime(5, 6, 7, 8, 9, 10); await CheckProps(locals, new { - ippa = TArray("int**[]", 5) + ippa = TArray("int**[]", "int**[5]") }, "locals", num_fields: 26); var ippa_elems = await CompareObjectPropertiesFor(locals, "ippa", new[] @@ -223,7 +223,7 @@ public async Task InspectLocalPointersToValueTypeArrays(string eval_fn, string t var dt = new DateTime(5, 6, 7, 8, 9, 10); await CheckProps(locals, new { - dtpa = TArray("System.DateTime*[]", 2) + dtpa = TArray("System.DateTime*[]", "System.DateTime*[2]") }, "locals", num_fields: 26); // dtpa @@ -256,7 +256,7 @@ public async Task InspectLocalPointersToGenericValueTypeArrays(string eval_fn, s var dt = new DateTime(5, 6, 7, 8, 9, 10); await CheckProps(locals, new { - gspa = TArray("DebuggerTests.GenericStructWithUnmanagedT*[]", 3), + gspa = TArray("DebuggerTests.GenericStructWithUnmanagedT*[]", "DebuggerTests.GenericStructWithUnmanagedT*[3]"), }, "locals", num_fields: 26); // dtpa @@ -323,7 +323,7 @@ public async Task InspectLocalDoublePointersToValueTypeArrays(string eval_fn, st var dt = new DateTime(5, 6, 7, 8, 9, 10); await CheckProps(locals, new { - dtppa = TArray("System.DateTime**[]", 3), + dtppa = TArray("System.DateTime**[]", "System.DateTime**[3]"), }, "locals", num_fields: 26); // DateTime**[] dtppa = new DateTime**[] { &dtp, &dtp_null, null }; @@ -395,8 +395,8 @@ public async Task InspectPrimitiveTypePointersAsMethodArgs(string eval_fn, strin { ip = TPointer("int*"), ipp = TPointer("int**"), - ipa = TArray("int*[]", 3), - ippa = TArray("int**[]", 5) + ipa = TArray("int*[]", "int*[3]"), + ippa = TArray("int**[]", "int**[5]") }, "locals", num_fields: 8); // ip @@ -468,8 +468,8 @@ public async Task InspectValueTypePointersAsMethodArgs(string eval_fn, string ty { dtp = TPointer("System.DateTime*"), dtpp = TPointer("System.DateTime**"), - dtpa = TArray("System.DateTime*[]", 2), - dtppa = TArray("System.DateTime**[]", 3) + dtpa = TArray("System.DateTime*[]", "System.DateTime*[2]"), + dtppa = TArray("System.DateTime**[]", "System.DateTime**[3]") }, "locals", num_fields: 8); // *dtp diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/SteppingTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/SteppingTests.cs index e64348bc675eb0..e1a4a46fd83ea4 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/SteppingTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/SteppingTests.cs @@ -354,7 +354,7 @@ public async Task InspectLocalsInAsyncMethods(bool use_cfo) CheckObject(locals, "this", "Math.NestedInMath"); //FIXME: check fields CheckValueType(locals, "ss", "Math.SimpleStruct"); - CheckArray(locals, "ss_arr", "Math.SimpleStruct[]", 0); + CheckArray(locals, "ss_arr", "Math.SimpleStruct[]", "Math.SimpleStruct[0]"); // TODO: struct fields } ); @@ -584,7 +584,7 @@ async Task CheckArrayElements(JToken pause_location, DateTime dt) var locals = await GetProperties(pause_location["callFrames"][0]["callFrameId"].Value()); await CheckProps(locals, new { - ssta = TArray("DebuggerTests.StructForToStringTests[]", 1) + ssta = TArray("DebuggerTests.StructForToStringTests[]", "DebuggerTests.StructForToStringTests[1]") }, "locals"); var ssta = await GetObjectOnLocals(locals, "ssta"); @@ -928,5 +928,25 @@ await EvaluateAndCheck( await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test.cs", 719, 8, "MoveNext"); await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test.cs", 720, 4, "MoveNext"); } + + [Fact] + public async Task CheckResetFrameNumberForEachStep() + { + var bp_conditional = await SetBreakpointInMethod("debugger-test.dll", "SteppingInto", "MethodToStep", 1); + await EvaluateAndCheck( + "window.setTimeout(function() { invoke_static_method('[debugger-test] SteppingInto:MethodToStep'); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", + bp_conditional.Value["locations"][0]["lineNumber"].Value(), + bp_conditional.Value["locations"][0]["columnNumber"].Value(), + "MethodToStep" + ); + var pause_location = await StepAndCheck(StepKind.Into, "dotnet://debugger-test.dll/debugger-test.cs", 799, 4, "Increment"); + pause_location = await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test.cs", 800, 8, "Increment"); + Assert.Equal(pause_location["callFrames"][0]["callFrameId"], "dotnet:scope:1"); + pause_location = await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test.cs", 801, 8, "Increment"); + Assert.Equal(pause_location["callFrames"][0]["callFrameId"], "dotnet:scope:1"); + pause_location = await StepAndCheck(StepKind.Over, "dotnet://debugger-test.dll/debugger-test.cs", 806, 8, "Increment"); + Assert.Equal(pause_location["callFrames"][0]["callFrameId"], "dotnet:scope:1"); + } } } diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs index 548b012901a5a3..9a7879190055d2 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/Tests.cs @@ -140,7 +140,7 @@ await CheckInspectLocalsAtBreakpointSite( str_spaces, str_esc, - strings = TArray("string[]", 4) + strings = TArray("string[]", "string[4]") }, "locals"); var strings_arr = await GetObjectOnLocals(locals, "strings"); @@ -204,14 +204,14 @@ await CheckInspectLocalsAtBreakpointSite( CheckObject(locals, "list", "System.Collections.Generic.Dictionary", description: "Count = 0"); CheckObject(locals, "list_null", "System.Collections.Generic.Dictionary", is_null: true); - CheckArray(locals, "list_arr", "System.Collections.Generic.Dictionary[]", 1); + CheckArray(locals, "list_arr", "System.Collections.Generic.Dictionary[]", "System.Collections.Generic.Dictionary[1]"); CheckObject(locals, "list_arr_null", "System.Collections.Generic.Dictionary[]", is_null: true); // Unused locals CheckObject(locals, "list_unused", "System.Collections.Generic.Dictionary", description: "Count = 0"); CheckObject(locals, "list_null_unused", "System.Collections.Generic.Dictionary", is_null: true); - CheckArray(locals, "list_arr_unused", "System.Collections.Generic.Dictionary[]", 1); + CheckArray(locals, "list_arr_unused", "System.Collections.Generic.Dictionary[]", "System.Collections.Generic.Dictionary[1]"); CheckObject(locals, "list_arr_null_unused", "System.Collections.Generic.Dictionary[]", is_null: true); } ); @@ -367,7 +367,7 @@ public async Task InspectBoxedLocals(string method_name, bool is_async) => await o_n_dt = TDateTime(dt), o_null = TObject("object", is_null: true), - o_ia = TArray("int[]", 2), + o_ia = TArray("int[]", "int[2]"), }, "locals"); foreach (var name in new[] { "n_gs", "o_gs", "o_n_gs" }) @@ -541,7 +541,7 @@ public async Task InspectLocalsForToStringDescriptions(int line, int col, string ts = TValueType("System.TimeSpan", ts.ToString()), dec = TValueType("System.Decimal", "123987123"), guid = TValueType("System.Guid", "3D36E07E-AC90-48C6-B7EC-A481E289D014"), - dts = TArray("System.DateTime[]", 2), + dts = TArray("System.DateTime[]", "System.DateTime[2]"), obj = TObject("DebuggerTests.ClassForToStringTests"), sst = TObject("DebuggerTests.StructForToStringTests") }, "locals#0"); @@ -712,7 +712,7 @@ public async Task PreviousFrameForAReflectedCall() => await CheckInspectLocalsAt mi = TObject("System.Reflection.RuntimeMethodInfo"), //this is what is returned when debugging desktop apps using VS dt = TDateTime(new DateTime(4210, 3, 4, 5, 6, 7)), i = TNumber(4), - strings = TArray("string[]", 1), + strings = TArray("string[]", "string[1]"), cs = TValueType("DebuggerTests.GetPropertiesTests.CloneableStruct"), num = TNumber(10), @@ -845,6 +845,49 @@ public async Task InspectTaskAtLocals() => await CheckInspectLocalsAtBreakpointS }, "t_props", num_fields: 53); }); + + [Fact] + public async Task InspectLocalsWithIndexAndPositionWithDifferentValues() //https://github.com/xamarin/xamarin-android/issues/6161 + { + await EvaluateAndCheck( + "window.setTimeout(function() { invoke_static_method('[debugger-test] MainPage:CallSetValue'); }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", 758, 16, + "set_SomeValue", + locals_fn: (locals) => + { + CheckNumber(locals, "view", 150); + } + ); + } + + [Fact] + public async Task InspectLocalsUsingClassFromLibraryUsingDebugTypeFull() + { + byte[] bytes = File.ReadAllBytes(Path.Combine(DebuggerTestAppPath, "debugger-test-with-full-debug-type.dll")); + string asm_base64 = Convert.ToBase64String(bytes); + + string pdb_base64 = null; + bytes = File.ReadAllBytes(Path.Combine(DebuggerTestAppPath, "debugger-test-with-full-debug-type.pdb")); + pdb_base64 = Convert.ToBase64String(bytes); + + var expression = $"{{ let asm_b64 = '{asm_base64}'; let pdb_b64 = '{pdb_base64}'; invoke_static_method('[debugger-test] DebugTypeFull:CallToEvaluateLocal', asm_b64, pdb_b64); }}"; + + await EvaluateAndCheck( + "window.setTimeout(function() {" + expression + "; }, 1);", + "dotnet://debugger-test.dll/debugger-test.cs", 818, 8, + "CallToEvaluateLocal", + wait_for_event_fn: async (pause_location) => + { + var a_props = await GetObjectOnFrame(pause_location["callFrames"][0], "a"); + await CheckProps(a_props, new + { + a = TNumber(10), + b = TNumber(20), + c = TNumber(30) + }, "a"); + } + ); + } //TODO add tests covering basic stepping behavior as step in/out/over } } diff --git a/src/mono/wasm/debugger/tests/Directory.Build.props b/src/mono/wasm/debugger/tests/Directory.Build.props index 0cff1f10a52d40..ff8864839daf17 100644 --- a/src/mono/wasm/debugger/tests/Directory.Build.props +++ b/src/mono/wasm/debugger/tests/Directory.Build.props @@ -4,6 +4,7 @@ $(AspNetCoreAppCurrent) Library + true Debug Release diff --git a/src/mono/wasm/debugger/tests/debugger-test-with-full-debug-type/debugger-test-with-full-debug-type.csproj b/src/mono/wasm/debugger/tests/debugger-test-with-full-debug-type/debugger-test-with-full-debug-type.csproj new file mode 100644 index 00000000000000..5eb1be9d8ea299 --- /dev/null +++ b/src/mono/wasm/debugger/tests/debugger-test-with-full-debug-type/debugger-test-with-full-debug-type.csproj @@ -0,0 +1,5 @@ + + + full + + \ No newline at end of file diff --git a/src/mono/wasm/debugger/tests/debugger-test-with-full-debug-type/test.cs b/src/mono/wasm/debugger/tests/debugger-test-with-full-debug-type/test.cs new file mode 100644 index 00000000000000..64609af24a547f --- /dev/null +++ b/src/mono/wasm/debugger/tests/debugger-test-with-full-debug-type/test.cs @@ -0,0 +1,20 @@ +using System; + +namespace DebuggerTests +{ + public class ClassToInspectWithDebugTypeFull + { + int a; + int b; + int c; + public ClassToInspectWithDebugTypeFull() + { + a = 10; + b = 20; + c = 30; + Console.WriteLine(a); + Console.WriteLine(b); + Console.WriteLine(c); + } + } +} \ No newline at end of file diff --git a/src/mono/wasm/debugger/tests/debugger-test-with-source-link/test.cs b/src/mono/wasm/debugger/tests/debugger-test-with-source-link/test.cs index af90df3e9a05f4..53b80df37033bc 100644 --- a/src/mono/wasm/debugger/tests/debugger-test-with-source-link/test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test-with-source-link/test.cs @@ -8,5 +8,14 @@ public static int TestBreakpoint() { return 50; } + public static int valueToCheck = 10; } -} + public class ClassToCheckFieldValue + { + public int valueToCheck; + public ClassToCheckFieldValue() + { + valueToCheck = 20; + } + } +} \ No newline at end of file diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-array-test.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-array-test.cs index 26acccf68dc767..f1a2b41bd18a48 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-array-test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-array-test.cs @@ -305,4 +305,44 @@ public static void run() new Point { X = 90, Y = -4, Id = "point#Id", Color = RGB.Green }.GenericInstanceMethod(sc); } } + public class MultiDimensionalArray + { + public static void run() + { + var int_arr_1 = new int[2]; + int_arr_1[0] = 0; + int_arr_1[1] = 1; + + var int_arr_2 = new int[2, 3]; + int_arr_2[0, 0] = 0; + int_arr_2[0, 1] = 1; + int_arr_2[0, 2] = 2; + int_arr_2[1, 0] = 10; + int_arr_2[1, 1] = 11; + int_arr_2[1, 2] = 12; + + var int_arr_3 = new int[2, 3, 3]; + int_arr_3[0, 0, 0] = 0; + int_arr_3[0, 0, 1] = 1; + int_arr_3[0, 0, 2] = 2; + int_arr_3[0, 1, 0] = 10; + int_arr_3[0, 1, 1] = 11; + int_arr_3[0, 1, 2] = 12; + int_arr_3[0, 2, 0] = 20; + int_arr_3[0, 2, 1] = 21; + int_arr_3[0, 2, 2] = 22; + int_arr_3[1, 0, 0] = 100; + int_arr_3[1, 0, 1] = 101; + int_arr_3[1, 0, 2] = 102; + int_arr_3[1, 1, 0] = 110; + int_arr_3[1, 1, 1] = 111; + int_arr_3[1, 1, 2] = 112; + int_arr_3[1, 2, 0] = 120; + int_arr_3[1, 2, 1] = 121; + int_arr_3[1, 2, 2] = 122; + + System.Diagnostics.Debugger.Break(); + Console.WriteLine($"int_arr: {int_arr_3.Length}"); + } + } } diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-custom-view-test.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-custom-view-test.cs index ecdccf0251f9ff..e2d8163ee91ad9 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-custom-view-test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-custom-view-test.cs @@ -58,6 +58,13 @@ string GetDebuggerDisplay () } } + [DebuggerDisplay("FirstName: {FirstName}, SurName: {SurName}, Age: {Age}")] + public class Person { + public string FirstName { get; set; } + public string SurName { get; set; } + public int Age { get; set; } + } + class DebuggerCustomViewTest { public static void run() @@ -67,7 +74,37 @@ public static void run() var c = new DebuggerDisplayMethodTest(); List myList = new List{ 1, 2, 3, 4 }; var listToTestToList = System.Linq.Enumerable.Range(1, 11); + + Dictionary openWith = new Dictionary(); + + openWith.Add("txt", "notepad"); + openWith.Add("bmp", "paint"); + openWith.Add("dib", "paint"); + var person1 = new Person { FirstName = "Anton", SurName="Mueller", Age = 44}; + var person2 = new Person { FirstName = "Lisa", SurName="Müller", Age = 41}; + + Console.WriteLine("break here"); + Console.WriteLine("break here"); } } + + class DebuggerCustomViewTest2 + { + public static void run() + { + List myList = new List (); + List myList2 = new List (); + + myList.Add(1); + myList.Add(2); + myList.Add(3); + myList.Add(4); + myList2.Add(1); + myList2.Add(1); + myList2.Add(1); + myList2.Add(1); + + } + } } diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-driver.html b/src/mono/wasm/debugger/tests/debugger-test/debugger-driver.html index b1bfcd859d0644..21e1f156966b73 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-driver.html +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-driver.html @@ -1,8 +1,8 @@ - - - + + + - - - - Stuff goes here - - + function load_non_wasm_page () { + console.log("load_non_wasm_page") + window.location.replace("http://localhost:9400/non-wasm-page.html"); + } + function load_wasm_page_without_assets () { + console.log("load_wasm_page_without_assets") + window.location.replace("http://localhost:9400/wasm-page-without-assets.html"); + } + + + + + Stuff goes here + + diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs index 01bdda2868ddde..75e9631be7a58c 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs @@ -28,6 +28,13 @@ public void run(int g, int h, string a, string valString, int this_a) b = b + 1; c = c + 1; } + public void EvaluateLocalsFromAnotherAssembly() + { + var asm = System.Reflection.Assembly.LoadFrom("debugger-test-with-source-link.dll"); + var myType = asm.GetType("DebuggerTests.ClassToCheckFieldValue"); + var myMethod = myType.GetConstructor(new Type[] { }); + var a = myMethod.Invoke(new object[]{}); + } } public static void EvaluateLocals() @@ -41,6 +48,11 @@ public static void EvaluateLocals() var f_g_s = new EvaluateTestsGenericStruct(); f_g_s.EvaluateTestsGenericStructInstanceMethod(100, 200, "test"); } + public static void EvaluateLocalsFromAnotherAssembly() + { + TestEvaluate eval = new TestEvaluate(); + eval.EvaluateLocalsFromAnotherAssembly(); + } } diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-exception-test.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-exception-test.cs index 86904ca27ea879..ebf82dc4909200 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-exception-test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-exception-test.cs @@ -52,4 +52,40 @@ public CustomException(string message) this.message = message; } } + + public class ExceptionTestsClassDefault + { + public class TestCaughtException + { + public void run() + { + try + { + throw new Exception("not implemented caught"); + } + catch + { + Console.WriteLine("caught exception"); + } + } + } + + public class TestUncaughtException + { + public void run() + { + throw new Exception("not implemented uncaught"); + } + } + + public static void TestExceptions() + { + TestCaughtException f = new TestCaughtException(); + f.run(); + + TestUncaughtException g = new TestUncaughtException(); + g.run(); + } + + } } diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs index 4a893f9948feb2..df623485bf1576 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs @@ -725,5 +725,97 @@ public async System.Threading.Tasks.Task AsyncMethod() Console.WriteLine($"time for await"); return true; } + +} + +public class MainPage +{ + public MainPage() + { + } + + int count = 0; + private int someValue; + + public int SomeValue + { + get + { + return someValue; + } + set + { + someValue = value; + count++; + + if (count == 10) + { + var view = 150; + + if (view != 50) + { + + } + System.Diagnostics.Debugger.Break(); + } + + SomeValue = count; + } + } + + public static void CallSetValue() + { + var mainPage = new MainPage(); + mainPage.SomeValue = 10; + } } +public class LoopClass +{ + public static void LoopToBreak() + { + for (int i = 0; i < 10; i++) + { + Console.WriteLine($"should pause only on i == 3"); + } + Console.WriteLine("breakpoint to check"); + } +} + +public class SteppingInto +{ + static int currentCount = 0; + static MyIncrementer incrementer = new MyIncrementer(); + public static void MethodToStep() + { + currentCount = incrementer.Increment(currentCount); + } +} + +public class MyIncrementer +{ + private Func todayFunc = () => DateTime.Now; + + public int Increment(int count) + { + var today = todayFunc(); + if (today.DayOfWeek == DayOfWeek.Sunday) + { + return count + 2; + } + + return count + 1; + } +} + +public class DebugTypeFull +{ + public static void CallToEvaluateLocal(string asm_base64, string pdb_base64) + { + var asm = System.Reflection.Assembly.LoadFrom("debugger-test-with-full-debug-type.dll"); + var myType = asm.GetType("DebuggerTests.ClassToInspectWithDebugTypeFull"); + var myMethod = myType.GetConstructor(new Type[] { }); + var a = myMethod.Invoke(new object[]{}); + System.Diagnostics.Debugger.Break(); + } +} \ No newline at end of file diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj index 0503feaaff07e8..89a81f1b7cf094 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj @@ -5,10 +5,13 @@ true false PrepareForWasmBuildApp;$(WasmBuildAppDependsOn) + true + + @@ -20,10 +23,12 @@ + + false $(AppDir) $(MonoProjectRoot)wasm\runtime-test.js @@ -35,6 +40,7 @@ + diff --git a/src/mono/wasm/debugger/tests/debugger-test/non-wasm-page.html b/src/mono/wasm/debugger/tests/debugger-test/non-wasm-page.html new file mode 100644 index 00000000000000..2894375a79c809 --- /dev/null +++ b/src/mono/wasm/debugger/tests/debugger-test/non-wasm-page.html @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/src/mono/wasm/debugger/tests/debugger-test/wasm-page-without-assets.html b/src/mono/wasm/debugger/tests/debugger-test/wasm-page-without-assets.html new file mode 100644 index 00000000000000..d8bfb820c0d427 --- /dev/null +++ b/src/mono/wasm/debugger/tests/debugger-test/wasm-page-without-assets.html @@ -0,0 +1,21 @@ + + + + + + + + + + Stuff goes here + + \ No newline at end of file diff --git a/src/mono/wasm/runtime/binding_support.js b/src/mono/wasm/runtime/binding_support.js index 6e2fb3c508d42d..11d50bfc9558b1 100644 --- a/src/mono/wasm/runtime/binding_support.js +++ b/src/mono/wasm/runtime/binding_support.js @@ -160,6 +160,16 @@ var BindingSupportLib = { return Promise.resolve(js_obj) === js_obj || ((typeof js_obj === "object" || typeof js_obj === "function") && typeof js_obj.then === "function") }; + this.isChromium = false; + if (globalThis.navigator) { + var nav = globalThis.navigator; + if (nav.userAgentData && nav.userAgentData.brands) { + this.isChromium = nav.userAgentData.brands.some((i) => i.brand == 'Chromium'); + } + else if (globalThis.navigator.userAgent) { + this.isChromium = nav.userAgent.includes("Chrome"); + } + } this._empty_string = ""; this._empty_string_ptr = 0; @@ -372,7 +382,7 @@ var BindingSupportLib = { return this._wrap_delegate_gc_handle_as_function(gc_handle); }, - _wrap_delegate_gc_handle_as_function: function (gc_handle) { + _wrap_delegate_gc_handle_as_function: function (gc_handle, after_listener_callback) { this.bindings_lazy_init (); // see if we have js owned instance for this gc_handle already @@ -384,7 +394,11 @@ var BindingSupportLib = { result = function() { const delegateRoot = MONO.mono_wasm_new_root (BINDING.get_js_owned_object_by_gc_handle(gc_handle)); try { - return BINDING.call_method (result[BINDING.delegate_invoke_symbol], delegateRoot.value, result[BINDING.delegate_invoke_signature_symbol], arguments); + const res = BINDING.call_method(result[BINDING.delegate_invoke_symbol], delegateRoot.value, result[BINDING.delegate_invoke_signature_symbol], arguments); + if (after_listener_callback) { + after_listener_callback(); + } + return res; } finally { delegateRoot.release(); } @@ -2042,7 +2056,12 @@ var BindingSupportLib = { var obj = BINDING.mono_wasm_get_jsobj_from_js_handle(objHandle); if (!obj) throw new Error("ERR09: Invalid JS object handle for '"+sName+"'"); - var listener = BINDING._wrap_delegate_gc_handle_as_function(listener_gc_handle); + + const prevent_timer_throttling = !BINDING.isChromium || obj.constructor.name !== 'WebSocket' + ? null + : () => MONO.prevent_timer_throttling(0); + + var listener = BINDING._wrap_delegate_gc_handle_as_function(listener_gc_handle, prevent_timer_throttling); if (!listener) throw new Error("ERR10: Invalid listener gc_handle"); diff --git a/src/mono/wasm/runtime/library_mono.js b/src/mono/wasm/runtime/library_mono.js index 8f8d4cbcfe537a..a94ea28f4afc02 100644 --- a/src/mono/wasm/runtime/library_mono.js +++ b/src/mono/wasm/runtime/library_mono.js @@ -52,6 +52,7 @@ var MonoSupportLib = { $MONO: { pump_count: 0, timeout_queue: [], + spread_timers_maximum:0, _vt_stack: [], mono_wasm_runtime_is_ready : false, mono_wasm_ignore_pdb_load_errors: true, @@ -74,6 +75,8 @@ var MonoSupportLib = { export_functions: function (module) { module ["pump_message"] = MONO.pump_message.bind(MONO); + module ["prevent_timer_throttling"] = MONO.prevent_timer_throttling.bind(MONO); + module ["mono_wasm_set_timeout_exec"] = MONO.mono_wasm_set_timeout_exec.bind(MONO); module ["mono_load_runtime_and_bcl"] = MONO.mono_load_runtime_and_bcl.bind(MONO); module ["mono_load_runtime_and_bcl_args"] = MONO.mono_load_runtime_and_bcl_args.bind(MONO); module ["mono_wasm_load_bytes_into_heap"] = MONO.mono_wasm_load_bytes_into_heap.bind(MONO); @@ -565,7 +568,8 @@ var MonoSupportLib = { }, }, - mono_wasm_add_dbg_command_received: function(res_ok, id, buffer, buffer_len) { + mono_wasm_add_dbg_command_received: function(res_ok, id, buffer, buffer_len) + { const assembly_data = new Uint8Array(Module.HEAPU8.buffer, buffer, buffer_len); const base64String = MONO._base64Converter.toBase64StringImpl(assembly_data); const buffer_obj = { @@ -575,15 +579,29 @@ var MonoSupportLib = { value: base64String } } - MONO.commands_received = buffer_obj; + if (MONO.commands_received.has(id)) + console.warn("Addind an id that already exists in commands_received"); + MONO.commands_received.set(id, buffer_obj); + }, + + mono_wasm_malloc_and_set_debug_buffer: function (command_parameters) + { + if (command_parameters.length > this._debugger_buffer_len) + { + if (this._debugger_buffer) + Module._free (this._debugger_buffer); + this._debugger_buffer_len = Math.max(command_parameters.length, this._debugger_buffer_len, 256); + this._debugger_buffer = Module._malloc (this._debugger_buffer_len); + } + this._debugger_heap_bytes = new Uint8Array (Module.HEAPU8.buffer, this._debugger_buffer, this._debugger_buffer_len); + this._debugger_heap_bytes.set(this._base64_to_uint8 (command_parameters)); }, mono_wasm_send_dbg_command_with_parms: function (id, command_set, command, command_parameters, length, valtype, newvalue) { - const dataHeap = new Uint8Array (Module.HEAPU8.buffer, command_parameters, command_parameters.length); - dataHeap.set (new Uint8Array (this._base64_to_uint8 (command_parameters))); - this._c_fn_table.mono_wasm_send_dbg_command_with_parms_wrapper (id, command_set, command, dataHeap.byteOffset, length, valtype, newvalue.toString()); - let { res_ok, res } = MONO.commands_received; + this.mono_wasm_malloc_and_set_debug_buffer(command_parameters); + this._c_fn_table.mono_wasm_send_dbg_command_with_parms_wrapper (id, command_set, command, this._debugger_buffer, length, valtype, newvalue.toString()); + let { res_ok, res } = MONO.commands_received.remove(id);; if (!res_ok) throw new Error (`Failed on mono_wasm_invoke_method_debugger_agent_with_parms`); return res; @@ -591,12 +609,9 @@ var MonoSupportLib = { mono_wasm_send_dbg_command: function (id, command_set, command, command_parameters) { - const dataHeap = new Uint8Array (Module.HEAPU8.buffer, command_parameters, command_parameters.length); - dataHeap.set (new Uint8Array (this._base64_to_uint8 (command_parameters))); - - this._c_fn_table.mono_wasm_send_dbg_command_wrapper (id, command_set, command, dataHeap.byteOffset, command_parameters.length); - - let { res_ok, res } = MONO.commands_received; + this.mono_wasm_malloc_and_set_debug_buffer(command_parameters); + this._c_fn_table.mono_wasm_send_dbg_command_wrapper (id, command_set, command, this._debugger_buffer, command_parameters.length); + let { res_ok, res } = MONO.commands_received.remove(id); if (!res_ok) throw new Error (`Failed on mono_wasm_send_dbg_command`); return res; @@ -605,7 +620,7 @@ var MonoSupportLib = { mono_wasm_get_dbg_command_info: function () { - let { res_ok, res } = MONO.commands_received; + let { res_ok, res } = MONO.commands_received.remove(0); if (!res_ok) throw new Error (`Failed on mono_wasm_get_dbg_command_info`); return res; @@ -687,8 +702,16 @@ var MonoSupportLib = { _create_proxy_from_object_id: function (objectId, details) { if (objectId.startsWith ('dotnet:array:')) { - let ret = details.map (p => p.value); - return ret; + if (details.items === undefined) + { + const ret = details.map (p => p.value); + return ret; + } + if (details.dimensionsDetails == undefined || details.dimensionsDetails.length == 1) + { + const ret = details.items.map (p => p.value); + return ret; + } } let proxy = {}; @@ -697,14 +720,14 @@ var MonoSupportLib = { if (prop.get !== undefined) { Object.defineProperty (proxy, prop.name, - { get () { return MONO.mono_wasm_send_dbg_command(-1, prop.get.commandSet, prop.get.command, prop.get.buffer, prop.get.length); }, - set: function (newValue) { MONO.mono_wasm_send_dbg_command_with_parms(-1, prop.set.commandSet, prop.set.command, prop.set.buffer, prop.set.length, prop.set.valtype, newValue); return MONO.commands_received.res_ok;}} + { get () { return MONO.mono_wasm_send_dbg_command(prop.get.id, prop.get.commandSet, prop.get.command, prop.get.buffer, prop.get.length); }, + set: function (newValue) { MONO.mono_wasm_send_dbg_command_with_parms(prop.set.id, prop.set.commandSet, prop.set.command, prop.set.buffer, prop.set.length, prop.set.valtype, newValue); return true;}} ); } else if (prop.set !== undefined ){ Object.defineProperty (proxy, prop.name, { get () { return prop.value; }, - set: function (newValue) { MONO.mono_wasm_send_dbg_command_with_parms(-1, prop.set.commandSet, prop.set.command, prop.set.buffer, prop.set.length, prop.set.valtype, newValue); return MONO.commands_received.res_ok;}} + set: function (newValue) { MONO.mono_wasm_send_dbg_command_with_parms(prop.set.id, prop.set.commandSet, prop.set.command, prop.set.buffer, prop.set.length, prop.set.valtype, newValue); return true;}} ); } else { proxy [prop.name] = prop.value; @@ -820,6 +843,8 @@ var MonoSupportLib = { }, mono_wasm_runtime_ready: function () { + MONO.commands_received = new Map(); + MONO.commands_received.remove = function (key) { const value = this.get(key); this.delete(key); return value;}; this.mono_wasm_runtime_is_ready = true; this._clear_per_step_state (); @@ -830,7 +855,7 @@ var MonoSupportLib = { this._c_fn_table = {}; this._register_c_fn ('mono_wasm_send_dbg_command', 'bool', [ 'number', 'number', 'number', 'number', 'number' ]); this._register_c_fn ('mono_wasm_send_dbg_command_with_parms', 'bool', [ 'number', 'number', 'number', 'number', 'number', 'number', 'string' ]); - + this._debugger_buffer_len = -1; // DO NOT REMOVE - magic debugger init function if (globalThis.dotnetDebugger) debugger; @@ -1289,15 +1314,15 @@ var MonoSupportLib = { try { if (asset.name === attemptUrl) { if (ctx.tracing) - console.log ("Attempting to fetch '" + attemptUrl + "'"); + console.log ("Attempting to fetch '%s'", attemptUrl); } else { if (ctx.tracing) - console.log ("Attempting to fetch '" + attemptUrl + "' for", asset.name); + console.log ("Attempting to fetch '%s' for '%s'", attemptUrl, asset.name); } var fetch_promise = fetch_file_cb (attemptUrl); fetch_promise.then (handleFetchResponse); } catch (exc) { - console.error ("MONO_WASM: Error fetching " + attemptUrl, exc); + console.error ("MONO_WASM: Error fetching '%s'\n%s", attemptUrl, exc); attemptNextSource (); } }; @@ -1457,6 +1482,28 @@ var MonoSupportLib = { } finally { Module.removeRunDependency(configFilePath); } + }, + mono_wasm_set_timeout_exec: function(id){ + if (!this.mono_set_timeout_exec) + this.mono_set_timeout_exec = Module.cwrap ("mono_set_timeout_exec", null, [ 'number' ]); + this.mono_set_timeout_exec (id); + }, + prevent_timer_throttling: function () { + // this will schedule timers every second for next 6 minutes, it should be called from WebSocket event, to make it work + // on next call, it would only extend the timers to cover yet uncovered future + let now = new Date().valueOf(); + const desired_reach_time = now + (1000 * 60 * 6); + const next_reach_time = Math.max(now + 1000, this.spread_timers_maximum); + const light_throttling_frequency = 1000; + for (var schedule = next_reach_time; schedule < desired_reach_time; schedule += light_throttling_frequency) { + const delay = schedule - now; + setTimeout(() => { + this.mono_wasm_set_timeout_exec(0); + MONO.pump_count++; + MONO.pump_message(); + }, delay); + } + this.spread_timers_maximum = desired_reach_time; } }, schedule_background_exec: function () { @@ -1467,17 +1514,19 @@ var MonoSupportLib = { }, mono_set_timeout: function (timeout, id) { - if (!this.mono_set_timeout_exec) - this.mono_set_timeout_exec = Module.cwrap ("mono_set_timeout_exec", null, [ 'number' ]); if (typeof globalThis.setTimeout === 'function') { - globalThis.setTimeout (function () { - this.mono_set_timeout_exec (id); + if (MONO.lastScheduleTimeoutId) { + globalThis.clearTimeout(MONO.lastScheduleTimeoutId); + MONO.lastScheduleTimeoutId = undefined; + } + MONO.lastScheduleTimeoutId = globalThis.setTimeout(function mono_wasm_set_timeout_exec () { + MONO.mono_wasm_set_timeout_exec(id); }, timeout); } else { ++MONO.pump_count; MONO.timeout_queue.push(function() { - this.mono_set_timeout_exec (id); + MONO.mono_wasm_set_timeout_exec (id); }) } }, diff --git a/src/mono/wasm/sln/WasmBuild.sln b/src/mono/wasm/sln/WasmBuild.sln new file mode 100755 index 00000000000000..10256d28e62648 --- /dev/null +++ b/src/mono/wasm/sln/WasmBuild.sln @@ -0,0 +1,73 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31722.452 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WasmBuildTasks", "..\..\..\tasks\WasmBuildTasks\WasmBuildTasks.csproj", "{D5BD9C0C-8A05-493E-BE45-13AF8286CD92}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WasmAppBuilder", "..\..\..\tasks\WasmAppBuilder\WasmAppBuilder.csproj", "{8DEBFDE2-B127-46D7-92CF-EEA6D1DA2554}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoAOTCompiler", "..\..\..\tasks\AotCompilerTask\MonoAOTCompiler.csproj", "{A9C02284-0387-42E7-BF78-47DF13656D5E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wasm.Build.Tests", "..\..\..\tests\BuildWasmApps\Wasm.Build.Tests\Wasm.Build.Tests.csproj", "{94E18644-B0E5-4DBB-9CE4-EA1515ACE4C2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DebuggerTestSuite", "..\debugger\DebuggerTestSuite\DebuggerTestSuite.csproj", "{4C0EE027-FC30-4167-B2CF-A6D18F00E08F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BrowserDebugHost", "..\debugger\BrowserDebugHost\BrowserDebugHost.csproj", "{292A88FD-795F-467A-8801-B5B791CEF96E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BrowserDebugProxy", "..\debugger\BrowserDebugProxy\BrowserDebugProxy.csproj", "{F5AE2AF5-3C30-45E3-A0C6-D962C51FE5E7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WasmAppHost", "..\host\WasmAppHost.csproj", "{C7099764-EC2E-4FAF-9057-0321893DE4F8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplyUpdateReferencedAssembly", "..\debugger\tests\ApplyUpdateReferencedAssembly\ApplyUpdateReferencedAssembly.csproj", "{75477B6F-DC8E-4002-88B8-017C992C568E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5BD9C0C-8A05-493E-BE45-13AF8286CD92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5BD9C0C-8A05-493E-BE45-13AF8286CD92}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5BD9C0C-8A05-493E-BE45-13AF8286CD92}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5BD9C0C-8A05-493E-BE45-13AF8286CD92}.Release|Any CPU.Build.0 = Release|Any CPU + {8DEBFDE2-B127-46D7-92CF-EEA6D1DA2554}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8DEBFDE2-B127-46D7-92CF-EEA6D1DA2554}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8DEBFDE2-B127-46D7-92CF-EEA6D1DA2554}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8DEBFDE2-B127-46D7-92CF-EEA6D1DA2554}.Release|Any CPU.Build.0 = Release|Any CPU + {A9C02284-0387-42E7-BF78-47DF13656D5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A9C02284-0387-42E7-BF78-47DF13656D5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A9C02284-0387-42E7-BF78-47DF13656D5E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A9C02284-0387-42E7-BF78-47DF13656D5E}.Release|Any CPU.Build.0 = Release|Any CPU + {94E18644-B0E5-4DBB-9CE4-EA1515ACE4C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {94E18644-B0E5-4DBB-9CE4-EA1515ACE4C2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {94E18644-B0E5-4DBB-9CE4-EA1515ACE4C2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94E18644-B0E5-4DBB-9CE4-EA1515ACE4C2}.Release|Any CPU.Build.0 = Release|Any CPU + {4C0EE027-FC30-4167-B2CF-A6D18F00E08F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4C0EE027-FC30-4167-B2CF-A6D18F00E08F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4C0EE027-FC30-4167-B2CF-A6D18F00E08F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4C0EE027-FC30-4167-B2CF-A6D18F00E08F}.Release|Any CPU.Build.0 = Release|Any CPU + {292A88FD-795F-467A-8801-B5B791CEF96E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {292A88FD-795F-467A-8801-B5B791CEF96E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {292A88FD-795F-467A-8801-B5B791CEF96E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {292A88FD-795F-467A-8801-B5B791CEF96E}.Release|Any CPU.Build.0 = Release|Any CPU + {F5AE2AF5-3C30-45E3-A0C6-D962C51FE5E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F5AE2AF5-3C30-45E3-A0C6-D962C51FE5E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F5AE2AF5-3C30-45E3-A0C6-D962C51FE5E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F5AE2AF5-3C30-45E3-A0C6-D962C51FE5E7}.Release|Any CPU.Build.0 = Release|Any CPU + {75477B6F-DC8E-4002-88B8-017C992C568E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {75477B6F-DC8E-4002-88B8-017C992C568E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75477B6F-DC8E-4002-88B8-017C992C568E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {75477B6F-DC8E-4002-88B8-017C992C568E}.Release|Any CPU.Build.0 = Release|Any CPU + {C7099764-EC2E-4FAF-9057-0321893DE4F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7099764-EC2E-4FAF-9057-0321893DE4F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7099764-EC2E-4FAF-9057-0321893DE4F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7099764-EC2E-4FAF-9057-0321893DE4F8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2BDE8FDE-4261-4B4D-8B54-ACC88B06C8D1} + EndGlobalSection +EndGlobal diff --git a/src/mono/wasm/wasm.proj b/src/mono/wasm/wasm.proj index 3eacc3e1307c13..7b37edbdb7fdc2 100644 --- a/src/mono/wasm/wasm.proj +++ b/src/mono/wasm/wasm.proj @@ -12,6 +12,7 @@ emcc $(ArtifactsObjDir)wasm <_EmccDefaultsRspPath>$(NativeBinDir)src\emcc-default.rsp + false @@ -81,7 +82,6 @@ <_EmccFlags Include="@(_EmccCommonFlags)" /> - <_EmccFlags Include="-s USE_ZLIB=1" /> -g -Os -s -DENABLE_NETCORE=1 -DDEBUG=1 - -Oz -DENABLE_NETCORE=1 + -O2 -DENABLE_NETCORE=1 "$(EMSDK_PATH)/upstream/bin/wasm-opt" --strip-dwarf "$(NativeBinDir)dotnet.wasm" -o "$(NativeBinDir)dotnet.wasm" $(ArtifactsObjDir)wasm $(WasmObjDir)\emcc-version.txt diff --git a/src/coreclr/dlls/mscoree/delayloadhook.cpp b/src/native/common/delayloadhook_windows.cpp similarity index 97% rename from src/coreclr/dlls/mscoree/delayloadhook.cpp rename to src/native/common/delayloadhook_windows.cpp index b09cd75215a200..901ac5661749c8 100644 --- a/src/coreclr/dlls/mscoree/delayloadhook.cpp +++ b/src/native/common/delayloadhook_windows.cpp @@ -4,8 +4,7 @@ // File: delayloadhook.cpp // -#include "stdafx.h" - +#include #include FARPROC WINAPI secureDelayHook(unsigned dliNotify, PDelayLoadInfo pdli) diff --git a/src/native/corehost/apphost/apphost.windows.cpp b/src/native/corehost/apphost/apphost.windows.cpp index b6c229e93086a1..a4fd29084d53fa 100644 --- a/src/native/corehost/apphost/apphost.windows.cpp +++ b/src/native/corehost/apphost/apphost.windows.cpp @@ -50,30 +50,53 @@ namespace ::DeregisterEventSource(eventSource); } - void show_error_dialog(const pal::char_t *executable_name, int error_code) + bool try_get_url_from_line(const pal::string_t& line, pal::string_t& url) { - // Show message dialog for UI apps with actionable errors - if (error_code != StatusCode::CoreHostLibMissingFailure // missing hostfxr - && error_code != StatusCode::FrameworkMissingFailure) // missing framework - return; + const pal::char_t url_prefix[] = DOTNET_CORE_APPLAUNCH_URL _X("?"); + if (utils::starts_with(line, url_prefix, true)) + { + url.assign(line); + return true; + } + + const pal::char_t url_prefix_before_7_0[] = _X(" - ") DOTNET_CORE_APPLAUNCH_URL _X("?"); + if (utils::starts_with(line, url_prefix_before_7_0, true)) + { + size_t offset = utils::strlen(url_prefix_before_7_0) - utils::strlen(DOTNET_CORE_APPLAUNCH_URL) - 1; + url.assign(line.substr(offset, line.length() - offset)); + return true; + } + return false; + } + + pal::string_t get_runtime_not_found_message() + { + pal::string_t msg = INSTALL_NET_DESKTOP_ERROR_MESSAGE _X("\n\n") + _X("Architecture: "); + msg.append(get_arch()); + msg.append(_X("\n") + _X("App host version: ") _STRINGIFY(COMMON_HOST_PKG_VER) _X("\n\n")); + return msg; + } + + void show_error_dialog(const pal::char_t *executable_name, int error_code) + { pal::string_t gui_errors_disabled; if (pal::getenv(_X("DOTNET_DISABLE_GUI_ERRORS"), &gui_errors_disabled) && pal::xtoi(gui_errors_disabled.c_str()) == 1) return; pal::string_t dialogMsg; pal::string_t url; - const pal::string_t url_prefix = _X(" - ") DOTNET_CORE_APPLAUNCH_URL _X("?"); if (error_code == StatusCode::CoreHostLibMissingFailure) { - dialogMsg = pal::string_t(_X("To run this application, you must install .NET Desktop Runtime ")) + _STRINGIFY(COMMON_HOST_PKG_VER) + _X(" (") + get_arch() + _X(").\n\n"); + dialogMsg = get_runtime_not_found_message(); pal::string_t line; pal::stringstream_t ss(g_buffered_errors); - while (std::getline(ss, line, _X('\n'))) { - if (starts_with(line, url_prefix, true)) + while (std::getline(ss, line, _X('\n'))) + { + if (try_get_url_from_line(line, url)) { - size_t offset = url_prefix.length() - pal::strlen(DOTNET_CORE_APPLAUNCH_URL) - 1; - url = line.substr(offset, line.length() - offset); break; } } @@ -82,40 +105,67 @@ namespace { // We don't have a great way of passing out different kinds of detailed error info across components, so // just match the expected error string. See fx_resolver.messages.cpp. - dialogMsg = pal::string_t(_X("To run this application, you must install missing frameworks for .NET.\n\n")); + dialogMsg = pal::string_t(INSTALL_OR_UPDATE_NET_ERROR_MESSAGE _X("\n\n")); pal::string_t line; pal::stringstream_t ss(g_buffered_errors); - while (std::getline(ss, line, _X('\n'))){ - const pal::string_t prefix = _X("The framework '"); - const pal::string_t suffix = _X("' was not found."); - const pal::string_t custom_prefix = _X(" _ "); - if (starts_with(line, prefix, true) && ends_with(line, suffix, true)) + while (std::getline(ss, line, _X('\n'))) + { + const pal::char_t prefix[] = _X("Framework: '"); + const pal::char_t prefix_before_7_0[] = _X("The framework '"); + const pal::char_t suffix_before_7_0[] = _X(" was not found."); + const pal::char_t custom_prefix[] = _X(" _ "); + if (utils::starts_with(line, prefix, true) + || (utils::starts_with(line, prefix_before_7_0, true) && utils::ends_with(line, suffix_before_7_0, true))) { dialogMsg.append(line); dialogMsg.append(_X("\n\n")); } - else if (starts_with(line, custom_prefix, true)) + else if (utils::starts_with(line, custom_prefix, true)) { dialogMsg.erase(); - dialogMsg.append(line.substr(custom_prefix.length())); + dialogMsg.append(line.substr(utils::strlen(custom_prefix))); dialogMsg.append(_X("\n\n")); } - else if (starts_with(line, url_prefix, true)) + else if (try_get_url_from_line(line, url)) { - size_t offset = url_prefix.length() - pal::strlen(DOTNET_CORE_APPLAUNCH_URL) - 1; - url = line.substr(offset, line.length() - offset); break; } } } + else if (error_code == StatusCode::BundleExtractionFailure) + { + pal::string_t line; + pal::stringstream_t ss(g_buffered_errors); + while (std::getline(ss, line, _X('\n'))) + { + if (utils::starts_with(line, _X("Bundle header version compatibility check failed."), true)) + { + dialogMsg = get_runtime_not_found_message(); + url = get_download_url(); + url.append(_X("&apphost_version=")); + url.append(_STRINGIFY(COMMON_HOST_PKG_VER)); + } + } + + if (dialogMsg.empty()) + return; + } + else + { + return; + } - dialogMsg.append(_X("Would you like to download it now?")); + dialogMsg.append( + _X("Would you like to download it now?\n\n") + _X("Learn about ")); + dialogMsg.append(error_code == StatusCode::FrameworkMissingFailure ? _X("framework resolution:") : _X("runtime installation:")); + dialogMsg.append(_X("\n") DOTNET_APP_LAUNCH_FAILED_URL); assert(url.length() > 0); assert(is_gui_application()); url.append(_X("&gui=true")); - trace::verbose(_X("Showing error dialog for application: '%s' - error code: 0x%x - url: '%s'"), executable_name, error_code, url.c_str()); + trace::verbose(_X("Showing error dialog for application: '%s' - error code: 0x%x - url: '%s' - dialog message: %s"), executable_name, error_code, url.c_str(), dialogMsg.c_str()); if (::MessageBoxW(nullptr, dialogMsg.c_str(), executable_name, MB_ICONERROR | MB_YESNO) == IDYES) { // Open the URL in default browser diff --git a/src/native/corehost/apphost/standalone/CMakeLists.txt b/src/native/corehost/apphost/standalone/CMakeLists.txt index b17e63beaf4f1b..d7a52a8534f99f 100644 --- a/src/native/corehost/apphost/standalone/CMakeLists.txt +++ b/src/native/corehost/apphost/standalone/CMakeLists.txt @@ -49,5 +49,5 @@ endif() # Specify non-default Windows libs to be used for Arm/Arm64 builds if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)) - target_link_libraries(apphost Advapi32.lib shell32.lib) + target_link_libraries(apphost shell32.lib) endif() diff --git a/src/native/corehost/apphost/static/CMakeLists.txt b/src/native/corehost/apphost/static/CMakeLists.txt index 0d9ae541c33b1d..c166fbb4367fde 100644 --- a/src/native/corehost/apphost/static/CMakeLists.txt +++ b/src/native/corehost/apphost/static/CMakeLists.txt @@ -63,7 +63,9 @@ endif() if(CLR_CMAKE_TARGET_WIN32) list(APPEND SOURCES - ../apphost.windows.cpp) + ../apphost.windows.cpp + ${CLR_SRC_NATIVE_DIR}/common/delayloadhook_windows.cpp + ) list(APPEND HEADERS ../apphost.windows.h) @@ -73,8 +75,8 @@ if(CLR_CMAKE_TARGET_WIN32) add_linker_flag("/DEF:${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost.def") else() - if(CLR_CMAKE_TARGET_OSX) - set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_OSXexports.src) + if(CLR_CMAKE_TARGET_FREEBSD) + set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_freebsdexports.src) else() set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_unixexports.src) endif() @@ -110,6 +112,12 @@ if(CLR_CMAKE_TARGET_WIN32) # Incremental linking results in the linker inserting extra padding and routing function calls via thunks that can break the # invariants (e.g. size of region between Jit_PatchedCodeLast-Jit_PatchCodeStart needs to fit in a page). add_linker_flag("/INCREMENTAL:NO") + + # Delay load libraries required for WinRT as that is not supported on all platforms. + add_linker_flag("/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll") + + # Delay load version.dll so that we can specify how to search when loading it as it is not part of Windows' known DLLs + add_linker_flag("/DELAYLOAD:version.dll") endif() if(CLR_CMAKE_TARGET_WIN32) @@ -130,6 +138,7 @@ if(CLR_CMAKE_TARGET_WIN32) shell32.lib bcrypt.lib RuntimeObject.lib + delayimp.lib ) set(RUNTIMEINFO_LIB runtimeinfo) diff --git a/src/native/corehost/apphost/static/singlefilehost_OSXexports.src b/src/native/corehost/apphost/static/singlefilehost_freebsdexports.src similarity index 81% rename from src/native/corehost/apphost/static/singlefilehost_OSXexports.src rename to src/native/corehost/apphost/static/singlefilehost_freebsdexports.src index 18d5697e84580e..767c9546a3b473 100644 --- a/src/native/corehost/apphost/static/singlefilehost_OSXexports.src +++ b/src/native/corehost/apphost/static/singlefilehost_freebsdexports.src @@ -9,3 +9,7 @@ g_dacTable ; Used by profilers MetaDataGetDispenser + +; FreeBSD needs to reexport these +__progname +environ diff --git a/src/native/corehost/apphost/static/singlefilehost_unixexports.src b/src/native/corehost/apphost/static/singlefilehost_unixexports.src index 1f9c5178218555..18d5697e84580e 100644 --- a/src/native/corehost/apphost/static/singlefilehost_unixexports.src +++ b/src/native/corehost/apphost/static/singlefilehost_unixexports.src @@ -9,7 +9,3 @@ g_dacTable ; Used by profilers MetaDataGetDispenser - -; FreeBSD needs to reexport these -__progname -environ diff --git a/src/native/corehost/build.sh b/src/native/corehost/build.sh index 3aa6820e73a10f..4d7828a008d5c6 100755 --- a/src/native/corehost/build.sh +++ b/src/native/corehost/build.sh @@ -83,14 +83,13 @@ __LogsDir="$__RootBinDir/log" __MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs" # Set the remaining variables based upon the determined build configuration -__DistroRidLower="$(echo $__DistroRid | tr '[:upper:]' '[:lower:]')" -__BinDir="$__RootBinDir/bin/$__DistroRidLower.$__BuildType" -__IntermediatesDir="$__RootBinDir/obj/$__DistroRidLower.$__BuildType" +__BinDir="$__RootBinDir/bin/$__OutputRid.$__BuildType" +__IntermediatesDir="$__RootBinDir/obj/$__OutputRid.$__BuildType" export __BinDir __IntermediatesDir __CoreClrArtifacts __RuntimeFlavor __CMakeArgs="-DCLI_CMAKE_HOST_VER=\"$__host_ver\" -DCLI_CMAKE_COMMON_HOST_VER=\"$__apphost_ver\" -DCLI_CMAKE_HOST_FXR_VER=\"$__fxr_ver\" $__CMakeArgs" -__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__DistroRid\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs" +__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__OutputRid\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs" __CMakeArgs="-DRUNTIME_FLAVOR=\"$__RuntimeFlavor\" $__CMakeArgs" __CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs" diff --git a/src/native/corehost/bundle/file_entry.cpp b/src/native/corehost/bundle/file_entry.cpp index ace0ef514927e6..a6610d7de97b92 100644 --- a/src/native/corehost/bundle/file_entry.cpp +++ b/src/native/corehost/bundle/file_entry.cpp @@ -19,15 +19,18 @@ file_entry_t file_entry_t::read(reader_t &reader, uint32_t bundle_major_version, // First read the fixed-sized portion of file-entry file_entry_fixed_t fixed_data; - fixed_data.offset = *(int64_t*)reader.read_direct(sizeof(int64_t)); - fixed_data.size = *(int64_t*)reader.read_direct(sizeof(int64_t)); + // NB: the file data is potentially unaligned, thus we use "read" to fetch 64bit values + reader.read(&fixed_data.offset, sizeof(int64_t)); + reader.read(&fixed_data.size, sizeof(int64_t)); // compressedSize is present only in v6+ headers - fixed_data.compressedSize = bundle_major_version >= 6 ? - *(int64_t*)reader.read_direct(sizeof(int64_t)) : - 0; + fixed_data.compressedSize = 0; + if (bundle_major_version >= 6) + { + reader.read(&fixed_data.compressedSize, sizeof(int64_t)); + } - fixed_data.type = *(file_type_t*)reader.read_direct(sizeof(file_type_t)); + fixed_data.type = (file_type_t)reader.read_byte(); file_entry_t entry(&fixed_data, force_extraction); diff --git a/src/native/corehost/bundle/header.cpp b/src/native/corehost/bundle/header.cpp index 268ef867146ae0..bc549f4c7af8c7 100644 --- a/src/native/corehost/bundle/header.cpp +++ b/src/native/corehost/bundle/header.cpp @@ -24,23 +24,23 @@ bool header_fixed_t::is_valid() const header_t header_t::read(reader_t& reader) { - const header_fixed_t* fixed_header = reinterpret_cast(reader.read_direct(sizeof(header_fixed_t))); + header_fixed_t fixed_header; + reader.read(&fixed_header, sizeof(header_fixed_t)); - if (!fixed_header->is_valid()) + if (!fixed_header.is_valid()) { trace::error(_X("Failure processing application bundle.")); - trace::error(_X("Bundle header version compatibility check failed.")); + trace::error(_X("Bundle header version compatibility check failed. Header version: %d.%d"), fixed_header.major_version, fixed_header.minor_version); throw StatusCode::BundleExtractionFailure; } - header_t header(fixed_header->major_version, fixed_header->minor_version, fixed_header->num_embedded_files); + header_t header(fixed_header.major_version, fixed_header.minor_version, fixed_header.num_embedded_files); // bundle_id is a component of the extraction path reader.read_path_string(header.m_bundle_id); - const header_fixed_v2_t *v2_header = reinterpret_cast(reader.read_direct(sizeof(header_fixed_v2_t))); - header.m_v2_header = *v2_header; + reader.read(&header.m_v2_header, sizeof(header_fixed_v2_t)); return header; } diff --git a/src/native/corehost/bundle/info.cpp b/src/native/corehost/bundle/info.cpp index 4d58a00ae647be..493ac73259853b 100644 --- a/src/native/corehost/bundle/info.cpp +++ b/src/native/corehost/bundle/info.cpp @@ -108,7 +108,14 @@ char* info_t::config_t::map(const pal::string_t& path, const location_t* &locati // * There is no performance limitation due to a larger sized mapping, since we actually only read the pages with relevant contents. // * Files that are too large to be mapped (ex: that exhaust 32-bit virtual address space) are not supported. +#ifdef _WIN32 + // Since we can't use in-situ parsing on Windows, as JSON data is encoded in + // UTF-8 and the host expects wide strings. + // We do not need COW and read-only mapping will be enough. + char* addr = (char*)pal::mmap_read(app->m_bundle_path); +#else // _WIN32 char* addr = (char*)pal::mmap_copy_on_write(app->m_bundle_path); +#endif // _WIN32 if (addr == nullptr) { trace::error(_X("Failure processing application bundle.")); @@ -117,14 +124,15 @@ char* info_t::config_t::map(const pal::string_t& path, const location_t* &locati trace::info(_X("Mapped bundle for [%s]"), path.c_str()); - return addr + location->offset + app->m_offset_in_file; + // Adjust to the beginning of the bundle + return addr + (location->offset + app->m_offset_in_file); } void info_t::config_t::unmap(const char* addr, const location_t* location) { - // Adjust to the beginning of the bundle. const bundle::info_t* app = bundle::info_t::the_app; - addr -= location->offset - app->m_offset_in_file; + // Reverse the adjustment to the beginning of the bundle + addr = addr - (location->offset + app->m_offset_in_file); bundle::info_t::the_app->unmap_bundle(addr); } diff --git a/src/native/corehost/bundle/reader.cpp b/src/native/corehost/bundle/reader.cpp index a7b5e580f0b562..8461e5db920be2 100644 --- a/src/native/corehost/bundle/reader.cpp +++ b/src/native/corehost/bundle/reader.cpp @@ -54,7 +54,7 @@ size_t reader_t::read_path_length() { size_t length = 0; - int8_t first_byte = read(); + int8_t first_byte = read_byte(); // If the high bit is set, it means there are more bytes to read. if ((first_byte & 0x80) == 0) @@ -63,7 +63,7 @@ size_t reader_t::read_path_length() } else { - int8_t second_byte = read(); + int8_t second_byte = read_byte(); if (second_byte & 0x80) { diff --git a/src/native/corehost/bundle/reader.h b/src/native/corehost/bundle/reader.h index 576ecd04c8e0fe..a4c1e07be19ece 100644 --- a/src/native/corehost/bundle/reader.h +++ b/src/native/corehost/bundle/reader.h @@ -81,7 +81,7 @@ namespace bundle return m_ptr; } - int8_t read() + int8_t read_byte() { bounds_check(); return *m_ptr++; @@ -100,16 +100,6 @@ namespace bundle m_ptr += len; } - // Return a pointer to the requested bytes within the memory-mapped file. - // Skip over len bytes. - const char* read_direct(int64_t len) - { - bounds_check(len); - const char *ptr = m_ptr; - m_ptr += len; - return ptr; - } - size_t read_path_length(); size_t read_path_string(pal::string_t &str); diff --git a/src/native/corehost/comhost/CMakeLists.txt b/src/native/corehost/comhost/CMakeLists.txt index 7517306cdc1d6b..36251ad79598ba 100644 --- a/src/native/corehost/comhost/CMakeLists.txt +++ b/src/native/corehost/comhost/CMakeLists.txt @@ -35,7 +35,7 @@ if (CLR_CMAKE_TARGET_WIN32) # Specify non-default Windows libs to be used for Arm/Arm64 builds if (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64) - list(APPEND WINLIBS Advapi32.lib Ole32.lib OleAut32.lib) + list(APPEND WINLIBS Ole32.lib OleAut32.lib) endif() target_link_libraries(comhost ${WINLIBS}) diff --git a/src/native/corehost/common.cmake b/src/native/corehost/common.cmake index eb5faa6b5602d7..717c3b5d89cf22 100644 --- a/src/native/corehost/common.cmake +++ b/src/native/corehost/common.cmake @@ -48,7 +48,7 @@ function(set_common_libs TargetType) # Specify the import library to link against for Arm32 build since the default set is minimal if (CLR_CMAKE_TARGET_ARCH_ARM) if (CLR_CMAKE_TARGET_WIN32) - target_link_libraries(${DOTNET_PROJECT_NAME} shell32.lib) + target_link_libraries(${DOTNET_PROJECT_NAME} shell32.lib advapi32.lib) else() target_link_libraries(${DOTNET_PROJECT_NAME} atomic.a) endif() diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj index ba630e8d2f8e15..004358388b1e86 100644 --- a/src/native/corehost/corehost.proj +++ b/src/native/corehost/corehost.proj @@ -33,6 +33,7 @@ $(BuildArgs) -ninja $(BuildArgs) -runtimeflavor $(RuntimeFlavor) $(BuildArgs) /p:OfficialBuildId="$(OfficialBuildId)" + $(BuildArgs) -outputrid $(OutputRid) $(NoWarn),CS8604,CS8602 + true - - - - + + + @@ -36,6 +36,11 @@ <_PublishFramework Include="$(TargetFrameworks)" /> + + + + diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.props b/src/tasks/AotCompilerTask/MonoAOTCompiler.props index 4f2721d7483cef..6ef2f973eb8140 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.props +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.props @@ -1,8 +1,10 @@ - + + - + + @@ -20,7 +22,8 @@ - + + diff --git a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs index 9127192f9f6c4f..bd0a775ce55109 100644 --- a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs +++ b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs @@ -15,7 +15,7 @@ public class AppleAppBuilderTask : Task private string targetOS = TargetNames.iOS; /// - /// The Apple OS we are targeting (iOS or tvOS) + /// The Apple OS we are targeting (ios, tvos, iossimulator, tvossimulator) /// [Required] public string TargetOS @@ -64,7 +64,7 @@ public string TargetOS public ITaskItem[] Assemblies { get; set; } = Array.Empty(); /// - /// Target arch, can be "arm64" (device) or "x64" (simulator) at the moment + /// Target arch, can be "arm64", "arm" or "x64" at the moment /// [Required] public string Arch { get; set; } = ""!; @@ -106,6 +106,11 @@ public string TargetOS /// public bool GenerateXcodeProject { get; set; } + /// + /// Generate CMake project + /// + public bool GenerateCMakeProject { get; set; } + /// /// Files to be ignored in AppDir /// @@ -153,6 +158,11 @@ public string TargetOS /// public bool EnableRuntimeLogging { get; set; } + /// + /// Enables App Sandbox for Mac Catalyst apps + /// + public bool EnableAppSandbox { get; set; } + public override bool Execute() { bool isDevice = (TargetOS == TargetNames.iOS || TargetOS == TargetNames.tvOS); @@ -224,14 +234,17 @@ public override bool Execute() throw new ArgumentException("Using DiagnosticPorts require diagnostics_tracing runtime component."); } - if (GenerateXcodeProject) + if (EnableAppSandbox && (string.IsNullOrEmpty(DevTeamProvisioning) || DevTeamProvisioning == "-")) { - Xcode generator = new Xcode(Log, TargetOS, Arch); - generator.EnableRuntimeLogging = EnableRuntimeLogging; - generator.DiagnosticPorts = DiagnosticPorts; + throw new ArgumentException("DevTeamProvisioning must be set to a valid value when App Sandbox is enabled, using '-' is not supported."); + } + + var generator = new Xcode(Log, TargetOS, Arch); + if (GenerateXcodeProject) + { XcodeProjectPath = generator.GenerateXCode(ProjectName, MainLibraryFileName, assemblerFiles, assemblerFilesToLink, - AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, Optimized, RuntimeComponents, NativeMainSource); + AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, NativeMainSource); if (BuildAppBundle) { @@ -242,10 +255,15 @@ public override bool Execute() } else { - AppBundlePath = generator.BuildAppBundle(XcodeProjectPath, Arch, Optimized, DevTeamProvisioning); + AppBundlePath = generator.BuildAppBundle(XcodeProjectPath, Optimized, DevTeamProvisioning); } } } + else if (GenerateCMakeProject) + { + generator.GenerateCMake(ProjectName, MainLibraryFileName, assemblerFiles, assemblerFilesToLink, + AppDir, binDir, MonoRuntimeHeaders, !isDevice, UseConsoleUITemplate, ForceAOT, ForceInterpreter, InvariantGlobalization, Optimized, EnableRuntimeLogging, EnableAppSandbox, DiagnosticPorts, RuntimeComponents, NativeMainSource); + } return true; } diff --git a/src/tasks/AppleAppBuilder/AppleAppBuilder.csproj b/src/tasks/AppleAppBuilder/AppleAppBuilder.csproj index 7ceb4480e1ce78..6fca3f38b6807a 100644 --- a/src/tasks/AppleAppBuilder/AppleAppBuilder.csproj +++ b/src/tasks/AppleAppBuilder/AppleAppBuilder.csproj @@ -11,10 +11,8 @@ - - - - + + diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 2e938d8ea0e36b..df0c182e84aaab 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -9,10 +9,111 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; +public class XcodeCreateProject : Task +{ + private string targetOS = TargetNames.iOS; + + /// + /// The Apple OS we are targeting (ios, tvos, iossimulator, tvossimulator) + /// + [Required] + public string TargetOS + { + get + { + return targetOS; + } + + set + { + targetOS = value.ToLower(); + } + } + + /// + /// Target arch, can be "arm64", "arm" or "x64" at the moment + /// + [Required] + public string Arch { get; set; } = ""!; + + /// + /// Path to the directory with the CMakeLists.txt to create a project for. + /// + [Required] + public string CMakeListsDirectory { get; set; } = ""!; + + /// + /// Name of the generated project. + /// + [Required] + public string ProjectName { get; set; } = ""!; + + public override bool Execute() + { + new Xcode(Log, TargetOS, Arch).CreateXcodeProject(ProjectName, CMakeListsDirectory); + + return true; + } +} + +public class XcodeBuildApp : Task +{ + private string targetOS = TargetNames.iOS; + + /// + /// The Apple OS we are targeting (ios, tvos, iossimulator, tvossimulator) + /// + [Required] + public string TargetOS + { + get + { + return targetOS; + } + + set + { + targetOS = value.ToLower(); + } + } + + /// + /// Target arch, can be "arm64", "arm" or "x64" at the moment + /// + [Required] + public string Arch { get; set; } = ""!; + + /// + /// Path to the .xcodeproj file + /// + [Required] + public string XcodeProjectPath { get; set; } = ""!; + + /// + /// DEVELOPER_TEAM provisioning, needed for arm64 builds. + /// + public string? DevTeamProvisioning { get; set; } + + /// + /// Produce optimized binaries and use 'Release' config in xcode + /// + public bool Optimized { get; set; } + + /// Path to the directory where the .app should be created + /// + public string? DestinationFolder { get; set; } + + public override bool Execute() + { + new Xcode(Log, TargetOS, Arch).BuildAppBundle(XcodeProjectPath, Optimized, DevTeamProvisioning, DestinationFolder); + + return true; + } +} + internal class Xcode { private string RuntimeIdentifier { get; set; } - private string SysRoot { get; set; } private string Target { get; set; } private string XcodeArch { get; set; } private TaskLoggingHelper Logger { get; set; } @@ -21,33 +122,72 @@ public Xcode(TaskLoggingHelper logger, string target, string arch) { Logger = logger; Target = target; - XcodeArch = (arch == "x64") ? "x86_64" : arch; + RuntimeIdentifier = $"{Target}-{arch}"; + XcodeArch = arch switch { + "x64" => "x86_64", + "arm" => "armv7", + _ => arch + }; + } + + public string GenerateXCode( + string projectName, + string entryPointLib, + IEnumerable asmFiles, + IEnumerable asmLinkFiles, + string workspace, + string binDir, + string monoInclude, + bool preferDylibs, + bool useConsoleUiTemplate, + bool forceAOT, + bool forceInterpreter, + bool invariantGlobalization, + bool optimized, + bool enableRuntimeLogging, + bool enableAppSandbox, + string? diagnosticPorts, + string? runtimeComponents=null, + string? nativeMainSource = null) + { + var cmakeDirectoryPath = GenerateCMake(projectName, entryPointLib, asmFiles, asmLinkFiles, workspace, binDir, monoInclude, preferDylibs, useConsoleUiTemplate, forceAOT, forceInterpreter, invariantGlobalization, optimized, enableRuntimeLogging, enableAppSandbox, diagnosticPorts, runtimeComponents, nativeMainSource); + CreateXcodeProject(projectName, cmakeDirectoryPath); + return Path.Combine(binDir, projectName, projectName + ".xcodeproj"); + } + + public void CreateXcodeProject(string projectName, string cmakeDirectoryPath) + { + string targetName; switch (Target) { - case TargetNames.iOS: - SysRoot = Utils.RunProcess(Logger, "xcrun", "--sdk iphoneos --show-sdk-path"); + case TargetNames.MacCatalyst: + targetName = "Darwin"; break; + case TargetNames.iOS: case TargetNames.iOSsim: - SysRoot = Utils.RunProcess(Logger, "xcrun", "--sdk iphonesimulator --show-sdk-path"); + targetName = "iOS"; break; case TargetNames.tvOS: - SysRoot = Utils.RunProcess(Logger, "xcrun", "--sdk appletvos --show-sdk-path"); - break; case TargetNames.tvOSsim: - SysRoot = Utils.RunProcess(Logger, "xcrun", "--sdk appletvsimulator --show-sdk-path"); + targetName = "tvOS"; break; default: - SysRoot = Utils.RunProcess(Logger, "xcrun", "--sdk macosx --show-sdk-path"); + targetName = Target.ToString(); break; } + var deployTarget = (Target == TargetNames.MacCatalyst) ? " -DCMAKE_OSX_ARCHITECTURES=" + XcodeArch : " -DCMAKE_OSX_DEPLOYMENT_TARGET=10.1"; + var cmakeArgs = new StringBuilder(); + cmakeArgs + .Append("-S.") + .Append(" -B").Append(projectName) + .Append(" -GXcode") + .Append(" -DCMAKE_SYSTEM_NAME=").Append(targetName) + .Append(deployTarget); - RuntimeIdentifier = $"{Target}-{arch}"; + Utils.RunProcess(Logger, "cmake", cmakeArgs.ToString(), workingDir: cmakeDirectoryPath); } - public bool EnableRuntimeLogging { get; set; } - public string? DiagnosticPorts { get; set; } = ""!; - - public string GenerateXCode( + public string GenerateCMake( string projectName, string entryPointLib, IEnumerable asmFiles, @@ -60,13 +200,16 @@ public string GenerateXCode( bool forceAOT, bool forceInterpreter, bool invariantGlobalization, - bool stripDebugSymbols, + bool optimized, + bool enableRuntimeLogging, + bool enableAppSandbox, + string? diagnosticPorts, string? runtimeComponents=null, string? nativeMainSource = null) { // bundle everything as resources excluding native files var excludes = new List { ".dll.o", ".dll.s", ".dwarf", ".m", ".h", ".a", ".bc", "libmonosgen-2.0.dylib", "libcoreclr.dylib" }; - if (stripDebugSymbols) + if (optimized) { excludes.Add(".pdb"); } @@ -95,7 +238,8 @@ public string GenerateXCode( var entitlements = new List>(); bool hardenedRuntime = false; - if (Target == TargetNames.MacCatalyst && !forceAOT) { + if (Target == TargetNames.MacCatalyst && !forceAOT) + { hardenedRuntime = true; /* for mmmap MAP_JIT */ @@ -104,6 +248,15 @@ public string GenerateXCode( entitlements.Add (KeyValuePair.Create ("com.apple.security.cs.disable-library-validation", "")); } + if (enableAppSandbox) + { + hardenedRuntime = true; + entitlements.Add (KeyValuePair.Create ("com.apple.security.app-sandbox", "")); + + // the networking entitlement is necessary to enable communication between the test app and xharness + entitlements.Add (KeyValuePair.Create ("com.apple.security.network.client", "")); + } + string cmakeLists = Utils.GetEmbeddedResource("CMakeLists.txt.template") .Replace("%ProjectName%", projectName) .Replace("%AppResources%", string.Join(Environment.NewLine, resources.Where(r => !r.EndsWith("-llvm.o")).Select(r => " " + Path.GetRelativePath(binDir, r)))) @@ -181,9 +334,9 @@ public string GenerateXCode( { // these libraries are linked via modules.m var name = Path.GetFileNameWithoutExtension(asm); - aotSources += $"add_library({name} OBJECT {asm}){Environment.NewLine}"; - toLink += $" {name}{Environment.NewLine}"; - aotList += $" {name}"; + aotSources += $"add_library({projectName}_{name} OBJECT {asm}){Environment.NewLine}"; + toLink += $" {projectName}_{name}{Environment.NewLine}"; + aotList += $" {projectName}_{name}"; } foreach (string asmLinkFile in asmLinkFiles) @@ -219,14 +372,14 @@ public string GenerateXCode( defines.AppendLine("add_definitions(-DINVARIANT_GLOBALIZATION=1)"); } - if (EnableRuntimeLogging) + if (enableRuntimeLogging) { defines.AppendLine("add_definitions(-DENABLE_RUNTIME_LOGGING=1)"); } - if (!string.IsNullOrEmpty(DiagnosticPorts)) + if (!string.IsNullOrEmpty(diagnosticPorts)) { - defines.AppendLine($"\nadd_definitions(-DDIAGNOSTIC_PORTS=\"{DiagnosticPorts}\")"); + defines.AppendLine($"\nadd_definitions(-DDIAGNOSTIC_PORTS=\"{diagnosticPorts}\")"); } cmakeLists = cmakeLists.Replace("%Defines%", defines.ToString()); @@ -252,33 +405,6 @@ public string GenerateXCode( File.WriteAllText(Path.Combine(binDir, "app.entitlements"), entitlementsTemplate.Replace("%Entitlements%", ent.ToString())); } - string targetName; - switch (Target) - { - case TargetNames.MacCatalyst: - targetName = "Darwin"; - break; - case TargetNames.iOS: - case TargetNames.iOSsim: - targetName = "iOS"; - break; - case TargetNames.tvOS: - case TargetNames.tvOSsim: - targetName = "tvOS"; - break; - default: - targetName = Target.ToString(); - break; - } - var deployTarget = (Target == TargetNames.MacCatalyst) ? " -DCMAKE_OSX_ARCHITECTURES=" + XcodeArch : " -DCMAKE_OSX_DEPLOYMENT_TARGET=10.1"; - var cmakeArgs = new StringBuilder(); - cmakeArgs - .Append("-S.") - .Append(" -B").Append(projectName) - .Append(" -GXcode") - .Append(" -DCMAKE_SYSTEM_NAME=").Append(targetName) - .Append(deployTarget); - File.WriteAllText(Path.Combine(binDir, "runtime.h"), Utils.GetEmbeddedResource("runtime.h")); @@ -302,13 +428,11 @@ public string GenerateXCode( .Replace("//%APPLE_RUNTIME_IDENTIFIER%", RuntimeIdentifier) .Replace("%EntryPointLibName%", Path.GetFileName(entryPointLib))); - Utils.RunProcess(Logger, "cmake", cmakeArgs.ToString(), workingDir: binDir); - - return Path.Combine(binDir, projectName, projectName + ".xcodeproj"); + return binDir; } public string BuildAppBundle( - string xcodePrjPath, string architecture, bool optimized, string? devTeamProvisioning = null) + string xcodePrjPath, bool optimized, string? devTeamProvisioning = null, string? destination = null) { string sdk = ""; var args = new StringBuilder(); @@ -330,29 +454,28 @@ public string BuildAppBundle( .Append(" DEVELOPMENT_TEAM=").Append(devTeamProvisioning); } - - if (architecture == "arm64") + if (XcodeArch == "arm64" || XcodeArch == "armv7") { switch (Target) { case TargetNames.iOS: sdk = "iphoneos"; - args.Append(" -arch arm64") + args.Append(" -arch " + XcodeArch) .Append(" -sdk ").Append(sdk); break; case TargetNames.iOSsim: sdk = "iphonesimulator"; - args.Append(" -arch arm64") + args.Append(" -arch " + XcodeArch) .Append(" -sdk ").Append(sdk); break; case TargetNames.tvOS: sdk = "appletvos"; - args.Append(" -arch arm64") + args.Append(" -arch " + XcodeArch) .Append(" -sdk ").Append(sdk); break; case TargetNames.tvOSsim: sdk = "appletvsimulator"; - args.Append(" -arch arm64") + args.Append(" -arch " + XcodeArch) .Append(" -sdk ").Append(sdk); break; default: @@ -372,12 +495,12 @@ public string BuildAppBundle( { case TargetNames.iOSsim: sdk = "iphonesimulator"; - args.Append(" -arch x86_64") + args.Append(" -arch " + XcodeArch) .Append(" -sdk ").Append(sdk); break; case TargetNames.tvOSsim: sdk = "appletvsimulator"; - args.Append(" -arch x86_64") + args.Append(" -arch " + XcodeArch) .Append(" -sdk ").Append(sdk); break; default: @@ -397,8 +520,22 @@ public string BuildAppBundle( Utils.RunProcess(Logger, "xcodebuild", args.ToString(), workingDir: Path.GetDirectoryName(xcodePrjPath)); - string appPath = Path.Combine(Path.GetDirectoryName(xcodePrjPath)!, config + "-" + sdk, - Path.GetFileNameWithoutExtension(xcodePrjPath) + ".app"); + string appDirectory = Path.Combine(Path.GetDirectoryName(xcodePrjPath)!, config + "-" + sdk); + if (!Directory.Exists(appDirectory)) + { + // cmake 3.25.0 seems to have changed the output directory for MacCatalyst, move it back to the old format + string appDirectoryWithoutSdk = Path.Combine(Path.GetDirectoryName(xcodePrjPath)!, config); + Directory.Move(appDirectoryWithoutSdk, appDirectory); + } + + string appPath = Path.Combine(appDirectory, Path.GetFileNameWithoutExtension(xcodePrjPath) + ".app"); + + if (destination != null) + { + var newAppPath = Path.Combine(destination, Path.GetFileNameWithoutExtension(xcodePrjPath) + ".app"); + Directory.Move(appPath, newAppPath); + appPath = newAppPath; + } long appSize = new DirectoryInfo(appPath) .EnumerateFiles("*", SearchOption.AllDirectories) diff --git a/src/tasks/Common/Utils.cs b/src/tasks/Common/Utils.cs index 2c1a8b49370c7a..2c624214937d66 100644 --- a/src/tasks/Common/Utils.cs +++ b/src/tasks/Common/Utils.cs @@ -212,7 +212,7 @@ public static bool CopyIfDifferent(string src, string dst, bool useHash) throw new ArgumentException($"Cannot find {src} file to copy", nameof(src)); bool areDifferent = !File.Exists(dst) || - (useHash && Utils.ComputeHash(src) != Utils.ComputeHash(dst)) || + (useHash && ComputeHash(src) != ComputeHash(dst)) || (File.ReadAllText(src) != File.ReadAllText(dst)); if (areDifferent) diff --git a/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj b/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj index fcd5b20ab2cf31..fa79a9436ee885 100644 --- a/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj +++ b/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj @@ -9,11 +9,9 @@ $(NoWarn),CS8604,CS8602 - - - - - + + + diff --git a/src/tasks/Directory.Build.props b/src/tasks/Directory.Build.props index 695833da3dbcd7..887be3a86036fb 100644 --- a/src/tasks/Directory.Build.props +++ b/src/tasks/Directory.Build.props @@ -3,6 +3,9 @@ net472 + + + net6.0 diff --git a/src/tasks/ILStripTask/ILStrip.cs b/src/tasks/ILStripTask/ILStrip.cs index 7ce5a5ecc07cf1..8086e68b91785f 100644 --- a/src/tasks/ILStripTask/ILStrip.cs +++ b/src/tasks/ILStripTask/ILStrip.cs @@ -8,10 +8,10 @@ using System.Threading.Tasks; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -using Mono.Cecil; -using Mono.Cecil.Binary; -using Mono.Cecil.Cil; -using Mono.Cecil.Metadata; +using CilStrip.Mono.Cecil; +using CilStrip.Mono.Cecil.Binary; +using CilStrip.Mono.Cecil.Cil; +using CilStrip.Mono.Cecil.Metadata; public class ILStrip : Microsoft.Build.Utilities.Task { diff --git a/src/tasks/ILStripTask/ILStrip.csproj b/src/tasks/ILStripTask/ILStrip.csproj index 879c56f26ae262..04f999b0aabb80 100644 --- a/src/tasks/ILStripTask/ILStrip.csproj +++ b/src/tasks/ILStripTask/ILStrip.csproj @@ -8,10 +8,8 @@ false - - - - + + @@ -27,6 +25,7 @@ <_PublishFramework Include="$(TargetFrameworks)" /> + diff --git a/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj b/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj index d6df214fce7963..4fb3ce43beafae 100644 --- a/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj +++ b/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj @@ -9,12 +9,16 @@ - - - - + + + + + + + + @@ -26,6 +30,7 @@ <_PublishFramework Include="$(TargetFrameworks)" /> + diff --git a/src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj b/src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj index 2fb35e649eed73..ed7c8d5f07a786 100644 --- a/src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj +++ b/src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj @@ -10,10 +10,9 @@ $(NoWarn),CS8604,CS8602 - - - - + + + @@ -33,6 +32,7 @@ <_PublishFramework Include="$(TargetFrameworks)" /> + diff --git a/src/tasks/WasmAppBuilder/EmccCompile.cs b/src/tasks/WasmAppBuilder/EmccCompile.cs index e869e98e8564ff..66d4743d81b4d4 100644 --- a/src/tasks/WasmAppBuilder/EmccCompile.cs +++ b/src/tasks/WasmAppBuilder/EmccCompile.cs @@ -44,6 +44,19 @@ public class EmccCompile : Microsoft.Build.Utilities.Task private int _numCompiled; public override bool Execute() + { + try + { + return ExecuteActual(); + } + catch (LogAsErrorException laee) + { + Log.LogError(laee.Message); + return false; + } + } + + private bool ExecuteActual() { if (SourceFiles.Length == 0) { @@ -82,6 +95,7 @@ public override bool Execute() if (!ShouldCompile(srcFile, objFile, depFiles, out string reason)) { Log.LogMessage(MessageImportance.Low, $"Skipping {srcFile} because {reason}."); + outputItems.Add(CreateOutputItemFor(srcFile, objFile)); } else { @@ -94,7 +108,8 @@ public override bool Execute() if (_numCompiled == _totalFiles) { // nothing to do! - return true; + OutputFiles = outputItems.ToArray(); + return !Log.HasLoggedErrors; } if (_numCompiled > 0) @@ -110,31 +125,20 @@ public override bool Execute() _tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); Directory.CreateDirectory(_tempPath); - int allowedParallelism = Math.Min(SourceFiles.Length, Environment.ProcessorCount); + int allowedParallelism = DisableParallelCompile ? 1 : Math.Min(SourceFiles.Length, Environment.ProcessorCount); if (BuildEngine is IBuildEngine9 be9) allowedParallelism = be9.RequestCores(allowedParallelism); - if (DisableParallelCompile || allowedParallelism == 1) + ParallelLoopResult result = Parallel.ForEach(filesToCompile, + new ParallelOptions { MaxDegreeOfParallelism = allowedParallelism }, + (toCompile, state) => { - foreach ((string srcFile, string outFile) in filesToCompile) - { - if (!ProcessSourceFile(srcFile, outFile)) - return false; - } - } - else - { - ParallelLoopResult result = Parallel.ForEach(filesToCompile, - new ParallelOptions { MaxDegreeOfParallelism = allowedParallelism }, - (toCompile, state) => - { - if (!ProcessSourceFile(toCompile.Item1, toCompile.Item2)) - state.Stop(); - }); + if (!ProcessSourceFile(toCompile.Item1, toCompile.Item2)) + state.Stop(); + }); - if (!result.IsCompleted && !Log.HasLoggedErrors) - Log.LogError("Unknown failed occured while compiling"); - } + if (!result.IsCompleted && !Log.HasLoggedErrors) + Log.LogError("Unknown failure occured while compiling. Check logs to get more details."); if (!Log.HasLoggedErrors) { @@ -187,9 +191,7 @@ bool ProcessSourceFile(string srcFile, string objFile) else Log.LogMessage(MessageImportance.Low, $"Copied {tmpObjFile} to {objFile}"); - ITaskItem newItem = new TaskItem(objFile); - newItem.SetMetadata("SourceFile", srcFile); - outputItems.Add(newItem); + outputItems.Add(CreateOutputItemFor(srcFile, objFile)); int count = Interlocked.Increment(ref _numCompiled); Log.LogMessage(MessageImportance.High, $"[{count}/{_totalFiles}] {Path.GetFileName(srcFile)} -> {Path.GetFileName(objFile)} [took {elapsedSecs:F}s]"); @@ -206,12 +208,19 @@ bool ProcessSourceFile(string srcFile, string objFile) File.Delete(tmpObjFile); } } + + ITaskItem CreateOutputItemFor(string srcFile, string objFile) + { + ITaskItem newItem = new TaskItem(objFile); + newItem.SetMetadata("SourceFile", srcFile); + return newItem; + } } private bool ShouldCompile(string srcFile, string objFile, string[] depFiles, out string reason) { if (!File.Exists(srcFile)) - throw new ArgumentException($"Could not find source file {srcFile}"); + throw new LogAsErrorException($"Could not find source file {srcFile}"); if (!File.Exists(objFile)) { @@ -228,7 +237,7 @@ private bool ShouldCompile(string srcFile, string objFile, string[] depFiles, ou return true; } - reason = "everything is up-to-date."; + reason = "everything is up-to-date"; return false; bool IsNewerThanOutput(string inFile, string outFile, out string reason) diff --git a/src/tasks/WasmAppBuilder/IcallTableGenerator.cs b/src/tasks/WasmAppBuilder/IcallTableGenerator.cs index 13c75c39bc64cd..a9f5f95161575d 100644 --- a/src/tasks/WasmAppBuilder/IcallTableGenerator.cs +++ b/src/tasks/WasmAppBuilder/IcallTableGenerator.cs @@ -23,6 +23,9 @@ public class IcallTableGenerator : Task [Required, NotNull] public string? OutputPath { get; set; } + [Output] + public string? FileWrites { get; private set; } = ""; + private List _icalls = new List (); private Dictionary _runtimeIcalls = new Dictionary (); @@ -42,7 +45,7 @@ public void GenIcallTable(string runtimeIcallTableFile, string[] assemblies) { ReadTable (runtimeIcallTableFile); var resolver = new PathAssemblyResolver(assemblies); - var mlc = new MetadataLoadContext(resolver, "System.Private.CoreLib"); + using var mlc = new MetadataLoadContext(resolver, "System.Private.CoreLib"); foreach (var aname in assemblies) { var a = mlc.LoadFromAssemblyPath(aname); @@ -58,6 +61,7 @@ public void GenIcallTable(string runtimeIcallTableFile, string[] assemblies) Log.LogMessage(MessageImportance.Low, $"Generating icall table to '{OutputPath}'."); else Log.LogMessage(MessageImportance.Low, $"Icall table in {OutputPath} is unchanged."); + FileWrites = OutputPath; File.Delete(tmpFileName); } @@ -103,11 +107,8 @@ private void EmitTable (StreamWriter w) // Read the icall table generated by mono --print-icall-table private void ReadTable (string filename) { - JsonDocument json; - using (var stream = File.Open (filename, FileMode.Open)) - { - json = JsonDocument.Parse (stream); - } + using var stream = File.OpenRead (filename); + using JsonDocument json = JsonDocument.Parse (stream); var arr = json.RootElement; foreach (var v in arr.EnumerateArray ()) diff --git a/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs b/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs index f6b89533f98632..c1c0d70a302db8 100644 --- a/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs +++ b/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs @@ -3,33 +3,53 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; -using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Text; -using System.Text.Json; using System.Reflection; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; public class PInvokeTableGenerator : Task { - [Required] - public ITaskItem[]? Modules { get; set; } - [Required] - public ITaskItem[]? Assemblies { get; set; } + [Required, NotNull] + public string[]? Modules { get; set; } + [Required, NotNull] + public string[]? Assemblies { get; set; } [Required, NotNull] public string? OutputPath { get; set; } - private static char[] s_charsToReplace = new[] { '.', '-', }; + [Output] + public string FileWrites { get; private set; } = string.Empty; + + private static char[] s_charsToReplace = new[] { '.', '-', '+' }; public override bool Execute() { - GenPInvokeTable(Modules!.Select(item => item.ItemSpec).ToArray(), Assemblies!.Select(item => item.ItemSpec).ToArray()); - return true; + if (Assemblies.Length == 0) + { + Log.LogError($"No assemblies given to scan for pinvokes"); + return false; + } + + if (Modules.Length == 0) + { + Log.LogError($"{nameof(PInvokeTableGenerator)}.{nameof(Modules)} cannot be empty"); + return false; + } + + try + { + GenPInvokeTable(Modules, Assemblies); + return !Log.HasLoggedErrors; + } + catch (LogAsErrorException laee) + { + Log.LogError(laee.Message); + return false; + } } public void GenPInvokeTable(string[] pinvokeModules, string[] assemblies) @@ -42,7 +62,7 @@ public void GenPInvokeTable(string[] pinvokeModules, string[] assemblies) var callbacks = new List(); var resolver = new PathAssemblyResolver(assemblies); - var mlc = new MetadataLoadContext(resolver, "System.Private.CoreLib"); + using var mlc = new MetadataLoadContext(resolver, "System.Private.CoreLib"); foreach (var aname in assemblies) { var a = mlc.LoadFromAssemblyPath(aname); @@ -61,13 +81,28 @@ public void GenPInvokeTable(string[] pinvokeModules, string[] assemblies) Log.LogMessage(MessageImportance.Low, $"Generating pinvoke table to '{OutputPath}'."); else Log.LogMessage(MessageImportance.Low, $"PInvoke table in {OutputPath} is unchanged."); + FileWrites = OutputPath; File.Delete(tmpFileName); } private void CollectPInvokes(List pinvokes, List callbacks, Type type) { - foreach (var method in type.GetMethods(BindingFlags.DeclaredOnly|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Static|BindingFlags.Instance)) { + foreach (var method in type.GetMethods(BindingFlags.DeclaredOnly|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Static|BindingFlags.Instance)) + { + try + { + CollectPInvokesForMethod(method); + } + catch (Exception ex) + { + Log.LogMessage(MessageImportance.Low, $"Could not get pinvoke, or callbacks for method {method.Name}: {ex}"); + continue; + } + } + + void CollectPInvokesForMethod(MethodInfo method) + { if ((method.Attributes & MethodAttributes.PinvokeImpl) != 0) { var dllimport = method.CustomAttributes.First(attr => attr.AttributeType.Name == "DllImportAttribute"); @@ -97,25 +132,40 @@ private void EmitPInvokeTable(StreamWriter w, Dictionary modules w.WriteLine("// GENERATED FILE, DO NOT MODIFY"); w.WriteLine(); - var decls = new HashSet(); - foreach (var pinvoke in pinvokes.OrderBy(l => l.EntryPoint)) + var pinvokesGroupedByEntryPoint = pinvokes + .Where(l => modules.ContainsKey(l.Module)) + .OrderBy(l => l.EntryPoint) + .GroupBy(l => l.EntryPoint); + + var comparer = new PInvokeComparer(); + foreach (IGrouping group in pinvokesGroupedByEntryPoint) { - if (modules.ContainsKey(pinvoke.Module)) { - try - { - var decl = GenPInvokeDecl(pinvoke); - if (decls.Contains(decl)) - continue; + var candidates = group.Distinct(comparer).ToArray(); + PInvoke first = candidates[0]; + if (ShouldTreatAsVariadic(candidates)) + { + string imports = string.Join(Environment.NewLine, + candidates.Select( + p => $" {p.Method} (in [{p.Method.DeclaringType?.Assembly.GetName().Name}] {p.Method.DeclaringType})")); + Log.LogWarning($"Found a native function ({first.EntryPoint}) with varargs in {first.Module}." + + " Calling such functions is not supported, and will fail at runtime." + + $" Managed DllImports: {Environment.NewLine}{imports}"); - w.WriteLine(decl); - decls.Add(decl); - } - catch (NotSupportedException) - { - // See the FIXME in GenPInvokeDecl - Log.LogWarning($"Cannot handle function pointer arguments/return value in pinvoke method '{pinvoke.Method}' in type '{pinvoke.Method.DeclaringType}'."); - pinvoke.Skip = true; - } + foreach (var c in candidates) + c.Skip = true; + + continue; + } + + var decls = new HashSet(); + foreach (var candidate in candidates) + { + var decl = GenPInvokeDecl(candidate); + if (decl == null || decls.Contains(decl)) + continue; + + w.WriteLine(decl); + decls.Add(decl); } } @@ -128,7 +178,8 @@ private void EmitPInvokeTable(StreamWriter w, Dictionary modules Where(l => l.Module == module && !l.Skip). OrderBy(l => l.EntryPoint). GroupBy(d => d.EntryPoint). - Select (l => "{\"" + l.Key + "\", " + l.Key + "}, // " + string.Join (", ", l.Select(c => c.Method.DeclaringType!.Module!.Assembly!.GetName ()!.Name!).Distinct().OrderBy(n => n))); + Select (l => "{\"" + FixupSymbolName(l.Key) + "\", " + FixupSymbolName(l.Key) + "}, " + + "// " + string.Join (", ", l.Select(c => c.Method.DeclaringType!.Module!.Assembly!.GetName ()!.Name!).Distinct().OrderBy(n => n))); foreach (var pinvoke in assemblies_pinvokes) { w.WriteLine (pinvoke); @@ -162,6 +213,61 @@ static string ModuleNameToId(string name) return fixedName; } + + static bool ShouldTreatAsVariadic(PInvoke[] candidates) + { + if (candidates.Length < 2) + return false; + + PInvoke first = candidates[0]; + if (TryIsMethodGetParametersUnsupported(first.Method, out _)) + return false; + + int firstNumArgs = first.Method.GetParameters().Length; + return candidates + .Skip(1) + .Any(c => !TryIsMethodGetParametersUnsupported(c.Method, out _) && + c.Method.GetParameters().Length != firstNumArgs); + } + } + + private static string FixupSymbolName(string name) + { + UTF8Encoding utf8 = new(); + byte[] bytes = utf8.GetBytes(name); + StringBuilder sb = new(); + + foreach (byte b in bytes) + { + if ((b >= (byte)'0' && b <= (byte)'9') || + (b >= (byte)'a' && b <= (byte)'z') || + (b >= (byte)'A' && b <= (byte)'Z') || + (b == (byte)'_')) + { + sb.Append((char) b); + } + else if (s_charsToReplace.Contains((char) b)) + { + sb.Append('_'); + } + else + { + sb.Append($"_{b:X}_"); + } + } + + return sb.ToString(); + } + + private static string SymbolNameForMethod(MethodInfo method) + { + StringBuilder sb = new(); + Type? type = method.DeclaringType; + sb.Append($"{type!.Module!.Assembly!.GetName()!.Name!}_"); + sb.Append($"{(type!.IsNested ? type!.FullName : type!.Name)}_"); + sb.Append(method.Name); + + return FixupSymbolName(sb.ToString()); } private string MapType (Type t) @@ -181,18 +287,48 @@ private string MapType (Type t) return "int"; } - private string GenPInvokeDecl(PInvoke pinvoke) + // FIXME: System.Reflection.MetadataLoadContext can't decode function pointer types + // https://github.com/dotnet/runtime/issues/43791 + private static bool TryIsMethodGetParametersUnsupported(MethodInfo method, [NotNullWhen(true)] out string? reason) + { + try + { + method.GetParameters(); + } + catch (NotSupportedException nse) + { + reason = nse.Message; + return true; + } + catch + { + // not concerned with other exceptions + } + + reason = null; + return false; + } + + private string? GenPInvokeDecl(PInvoke pinvoke) { var sb = new StringBuilder(); var method = pinvoke.Method; if (method.Name == "EnumCalendarInfo") { // FIXME: System.Reflection.MetadataLoadContext can't decode function pointer types // https://github.com/dotnet/runtime/issues/43791 - sb.Append($"int {pinvoke.EntryPoint} (int, int, int, int, int);"); + sb.Append($"int {FixupSymbolName(pinvoke.EntryPoint)} (int, int, int, int, int);"); return sb.ToString(); } + + if (TryIsMethodGetParametersUnsupported(pinvoke.Method, out string? reason)) + { + Log.LogWarning($"Skipping the following DllImport because '{reason}'. {Environment.NewLine} {pinvoke.Method}"); + pinvoke.Skip = true; + return null; + } + sb.Append(MapType(method.ReturnType)); - sb.Append($" {pinvoke.EntryPoint} ("); + sb.Append($" {FixupSymbolName(pinvoke.EntryPoint)} ("); int pindex = 0; var pars = method.GetParameters(); foreach (var p in pars) { @@ -244,7 +380,7 @@ private void EmitNativeToInterp(StreamWriter w, List callbacks) sb.Append($" (*WasmInterpEntrySig_{cb_index}) ("); int pindex = 0; if (method.ReturnType.Name != "Void") { - sb.Append("int"); + sb.Append("int*"); pindex++; } foreach (var p in method.GetParameters()) { @@ -333,20 +469,16 @@ private void EmitNativeToInterp(StreamWriter w, List callbacks) private static bool IsBlittable (Type type) { - if (type.IsPrimitive || type.IsByRef || type.IsPointer) + if (type.IsPrimitive || type.IsByRef || type.IsPointer || type.IsEnum) return true; else return false; } - private static void Error (string msg) - { - // FIXME: - throw new Exception(msg); - } + private static void Error (string msg) => throw new LogAsErrorException(msg); } -internal class PInvoke +internal class PInvoke : IEquatable { public PInvoke(string entryPoint, string module, MethodInfo method) { @@ -359,6 +491,30 @@ public PInvoke(string entryPoint, string module, MethodInfo method) public string Module; public MethodInfo Method; public bool Skip; + + public bool Equals(PInvoke? other) + => other != null && + string.Equals(EntryPoint, other.EntryPoint, StringComparison.Ordinal) && + string.Equals(Module, other.Module, StringComparison.Ordinal) && + string.Equals(Method.ToString(), other.Method.ToString(), StringComparison.Ordinal); + + public override string ToString() => $"{{ EntryPoint: {EntryPoint}, Module: {Module}, Method: {Method}, Skip: {Skip} }}"; +} + +internal class PInvokeComparer : IEqualityComparer +{ + public bool Equals(PInvoke? x, PInvoke? y) + { + if (x == null && y == null) + return true; + if (x == null || y == null) + return false; + + return x.Equals(y); + } + + public int GetHashCode(PInvoke pinvoke) + => $"{pinvoke.EntryPoint}{pinvoke.Module}{pinvoke.Method}".GetHashCode(); } internal class PInvokeCallback diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs index 57cb7c383f107a..58b4b9259e629c 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs @@ -117,11 +117,24 @@ public IcuData(string name) : base(name, "icu") {} } public override bool Execute () + { + try + { + return ExecuteInternal(); + } + catch (LogAsErrorException laee) + { + Log.LogError(laee.Message); + return false; + } + } + + private bool ExecuteInternal () { if (!File.Exists(MainJS)) - throw new ArgumentException($"File MainJS='{MainJS}' doesn't exist."); + throw new LogAsErrorException($"File MainJS='{MainJS}' doesn't exist."); if (!InvariantGlobalization && string.IsNullOrEmpty(IcuDataFileName)) - throw new ArgumentException("IcuDataFileName property shouldn't be empty if InvariantGlobalization=false"); + throw new LogAsErrorException("IcuDataFileName property shouldn't be empty if InvariantGlobalization=false"); if (Assemblies?.Length == 0) { @@ -162,8 +175,12 @@ public override bool Execute () } FileCopyChecked(MainJS!, Path.Combine(AppDir, "runtime.js"), string.Empty); - var html = @""; - File.WriteAllText(Path.Combine(AppDir, "index.html"), html); + string indexHtmlPath = Path.Combine(AppDir, "index.html"); + if (!File.Exists(indexHtmlPath)) + { + var html = @""; + File.WriteAllText(indexHtmlPath, html); + } foreach (var assembly in _assemblies) { diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj b/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj index 3c93ab5d643ac8..58e452613c3ac4 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj +++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj @@ -6,6 +6,7 @@ $(NoWarn),CS8604,CS8602 false + true @@ -15,37 +16,36 @@ + - - - - - + + + - + + + - - - <_PublishFramework Include="$(TargetFrameworks)" /> - - - + + + + + + + + - <_PublishFramework Remove="@(_PublishFramework)" /> - <_PublishFramework Include="$(TargetFrameworks)" /> - - - diff --git a/src/tasks/WasmBuildTasks/WasmBuildTasks.csproj b/src/tasks/WasmBuildTasks/WasmBuildTasks.csproj index 0f8b6c93993a47..a20503892a04ef 100644 --- a/src/tasks/WasmBuildTasks/WasmBuildTasks.csproj +++ b/src/tasks/WasmBuildTasks/WasmBuildTasks.csproj @@ -6,10 +6,8 @@ $(NoWarn),CA1050 - - - - + + (); - public override bool Execute() { if (!HasMetadata(WorkloadId, nameof(WorkloadId), "Version") || @@ -48,6 +46,12 @@ public override bool Execute() return false; } + if (!File.Exists(NuGetConfigFile)) + { + Log.LogError($"Cannot find NuGetConfigFile={NuGetConfigFile}"); + return false; + } + Log.LogMessage(MessageImportance.High, $"{Environment.NewLine}** Installing workload manifest {WorkloadId.ItemSpec} **{Environment.NewLine}"); string nugetConfigContents = GetNuGetConfig(); @@ -84,38 +88,24 @@ public override bool Execute() return !Log.HasLoggedErrors; } - private string GetNuGetConfig() + private string GetNuGetConfig() => File.ReadAllText(NuGetConfigFile); + + private bool InstallWorkloadManifest(string name, string version, string nugetConfigContents, bool stopOnMissing) { - StringBuilder nugetConfigBuilder = new(); - nugetConfigBuilder.AppendLine($"{Environment.NewLine}"); + Log.LogMessage(MessageImportance.High, $"Installing workload manifest for {name}/{version} for sdk band {VersionBand}"); - nugetConfigBuilder.AppendLine($@""); - foreach (ITaskItem source in ExtraNuGetSources) + string sdkManifestsVersionBadDir = Path.Combine(SdkDir, "sdk-manifests", VersionBand); + if (!Directory.Exists(sdkManifestsVersionBadDir)) { - string key = source.ItemSpec; - string value = source.GetMetadata("Value"); - if (string.IsNullOrEmpty(value)) - { - Log.LogWarning($"ExtraNuGetSource {key} is missing Value metadata"); - continue; - } - - nugetConfigBuilder.AppendLine($@""); + Log.LogMessage(MessageImportance.Low, $"Creating directory {sdkManifestsVersionBadDir} because it does not already exist."); + Directory.CreateDirectory(sdkManifestsVersionBadDir); } - nugetConfigBuilder.AppendLine($"{Environment.NewLine}"); - return nugetConfigBuilder.ToString(); - } - - private bool InstallWorkloadManifest(string name, string version, string nugetConfigContents, bool stopOnMissing) - { - Log.LogMessage(MessageImportance.High, $"Installing workload manifest for {name}/{version}"); - // Find any existing directory with the manifest name, ignoring the case // Multiple directories for a manifest, differing only in case causes // workload install to fail due to duplicate manifests! // This is applicable only on case-sensitive filesystems - string outputDir = FindSubDirIgnoringCase(Path.Combine(SdkDir, "sdk-manifests", VersionBand), name); + string outputDir = FindOrCreateSubDirIgnoringCase(sdkManifestsVersionBadDir, name); PackageReference pkgRef = new(Name: $"{name}.Manifest-{VersionBand}", Version: version, @@ -162,7 +152,15 @@ private bool InstallWorkloadManifest(string name, string version, string nugetCo { if (!InstallWorkloadManifest(depName, depVersion, nugetConfigContents, stopOnMissing: false)) { - Log.LogWarning($"Could not install manifest {depName}/{depVersion}. This can be ignored if the workload {WorkloadId.ItemSpec} doesn't depend on it."); + Log.LogMessage(MessageImportance.High, + $" ***** warning ******{Environment.NewLine}" + + Environment.NewLine + + $"Could not install a dependent manifest {depName}/{depVersion} for sdk band {VersionBand}.{Environment.NewLine}" + + $"If this is because this manifest doesn't have a package for sdk band {VersionBand}, " + + $"then the workload resolver will automatically fallback to the older one, and this message can be ignored.{Environment.NewLine}" + + $"This can also be safely ignored if the workload {WorkloadId.ItemSpec} doesn't use the dependency.{Environment.NewLine}" + + Environment.NewLine + + $" ********************{Environment.NewLine}"); continue; } } @@ -180,7 +178,7 @@ private bool HasMetadata(ITaskItem item, string itemName, string metadataName) return false; } - private string FindSubDirIgnoringCase(string parentDir, string dirName) + private string FindOrCreateSubDirIgnoringCase(string parentDir, string dirName) { IEnumerable matchingDirs = Directory.EnumerateDirectories(parentDir, dirName, @@ -193,7 +191,7 @@ private string FindSubDirIgnoringCase(string parentDir, string dirName) + $"{Environment.NewLine}Using the first one: {first}"); } - return first ?? Path.Combine(parentDir, dirName); + return first ?? Path.Combine(parentDir, dirName.ToLower(CultureInfo.InvariantCulture)); } private record ManifestInformation( diff --git a/src/tasks/WorkloadBuildTasks/PackageInstaller.cs b/src/tasks/WorkloadBuildTasks/PackageInstaller.cs index 227dcb4fbf9b70..d656b1f1d5750e 100644 --- a/src/tasks/WorkloadBuildTasks/PackageInstaller.cs +++ b/src/tasks/WorkloadBuildTasks/PackageInstaller.cs @@ -63,7 +63,7 @@ private bool InstallActual(PackageReference[] references, bool stopOnMissing) (int exitCode, string output) = Utils.TryRunProcess(_logger, "dotnet", args, silent: false, debugMessageImportance: MessageImportance.Low); if (exitCode != 0) { - LogErrorOrWarning($"Restoring packages failed with exit code: {exitCode}. Output:{Environment.NewLine}{output}", stopOnMissing); + LogFailure($"Restoring packages failed with exit code: {exitCode}. Output:{Environment.NewLine}{output}", stopOnMissing); return false; } @@ -76,7 +76,7 @@ private bool InstallActual(PackageReference[] references, bool stopOnMissing) { _logger.LogMessage(MessageImportance.Normal, output); foreach ((PackageReference pkgRef, string pkgDir) in failedToRestore) - LogErrorOrWarning($"Could not restore {pkgRef.Name}/{pkgRef.Version} (can't find {pkgDir})", stopOnMissing); + LogFailure($"Could not restore {pkgRef.Name}/{pkgRef.Version} (can't find {pkgDir})", stopOnMissing); return false; } @@ -91,7 +91,7 @@ private bool LayoutPackages(IEnumerable references, bool stopO var source = Path.Combine(_packagesDir, pkgRef.Name.ToLower(), pkgRef.Version, pkgRef.relativeSourceDir); if (!Directory.Exists(source)) { - LogErrorOrWarning($"Failed to restore {pkgRef.Name}/{pkgRef.Version} (could not find {source})", stopOnMissing); + LogFailure($"Failed to restore {pkgRef.Name}/{pkgRef.Version} (could not find {source})", stopOnMissing); if (stopOnMissing) return false; } @@ -152,12 +152,12 @@ private bool CopyDirectoryAfresh(string srcDir, string destDir) } } - private void LogErrorOrWarning(string msg, bool stopOnMissing) + private void LogFailure(string msg, bool asError) { - if (stopOnMissing) + if (asError) _logger.LogError(msg); else - _logger.LogWarning(msg); + _logger.LogMessage(MessageImportance.High, $"warning: {msg}"); } } } diff --git a/src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj b/src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj index 537418ef31dc6d..2abf1b0b24eb16 100644 --- a/src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj +++ b/src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj @@ -8,10 +8,8 @@ - - - - + + - $(TargetFrameworkForNETCoreTasks);net461 + $(NetCoreAppToolCurrent);$(NetFrameworkToolCurrent) false false - + - - - + + + + - + diff --git a/src/tasks/tasks.proj b/src/tasks/tasks.proj index 9c62f8b76b989f..03a049e1bf46f9 100644 --- a/src/tasks/tasks.proj +++ b/src/tasks/tasks.proj @@ -1,6 +1,11 @@ + + + + - + false + $(ProductVersion) @@ -36,8 +36,8 @@ - - + + diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmBuildAppTest.cs b/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmBuildAppTest.cs index 412bf4a3da2eae..d5df20a90ff547 100644 --- a/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmBuildAppTest.cs +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmBuildAppTest.cs @@ -110,13 +110,14 @@ public void PropertiesFromRuntimeConfigJson(BuildArgs buildArgs, RunHost host, s }"; BuildProject(buildArgs, - initProject: () => - { - File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), programText); - File.WriteAllText(Path.Combine(_projectDir!, "runtimeconfig.template.json"), runtimeConfigTemplateJson); - }, - id: id, - dotnetWasmFromRuntimePack: !(buildArgs.AOT || buildArgs.Config == "Release")); + id: id, + new BuildProjectOptions( + InitProject: () => + { + File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), programText); + File.WriteAllText(Path.Combine(_projectDir!, "runtimeconfig.template.json"), runtimeConfigTemplateJson); + }, + DotnetWasmFromRuntimePack: !(buildArgs.AOT || buildArgs.Config == "Release"))); RunAndTestWasmApp(buildArgs, expectedExitCode: 42, test: output => Assert.Contains("test_runtimeconfig_json: 25", output), host: host, id: id); @@ -139,12 +140,13 @@ public void PropertiesFromCsproj(BuildArgs buildArgs, RunHost host, string id) "; BuildProject(buildArgs, - initProject: () => - { - File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), programText); - }, - id: id, - dotnetWasmFromRuntimePack: !(buildArgs.AOT || buildArgs.Config == "Release")); + id: id, + new BuildProjectOptions( + InitProject: () => + { + File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), programText); + }, + DotnetWasmFromRuntimePack: !(buildArgs.AOT || buildArgs.Config == "Release"))); RunAndTestWasmApp(buildArgs, expectedExitCode: 42, test: output => Assert.Contains("System.Threading.ThreadPool.MaxThreads: 20", output), host: host, id: id); @@ -165,9 +167,10 @@ void TestMain(string projectName, dotnetWasmFromRuntimePack = !(buildArgs.AOT || buildArgs.Config == "Release"); BuildProject(buildArgs, - initProject: () => File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), programText), - id: id, - dotnetWasmFromRuntimePack: dotnetWasmFromRuntimePack); + id: id, + new BuildProjectOptions( + InitProject: () => File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), programText), + DotnetWasmFromRuntimePack: dotnetWasmFromRuntimePack)); RunAndTestWasmApp(buildArgs, expectedExitCode: 42, test: output => Assert.Contains("Hello, World!", output), host: host, id: id); diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmNativeDefaultsTests.cs b/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmNativeDefaultsTests.cs new file mode 100644 index 00000000000000..00674bf4630dcc --- /dev/null +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmNativeDefaultsTests.cs @@ -0,0 +1,103 @@ +// 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.IO; +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; + +#nullable enable + +namespace Wasm.Build.Tests +{ + public class WasmNativeDefaultsTests : BuildTestBase + { + public WasmNativeDefaultsTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext) + : base(output, buildContext) + { + } + + [Theory] + /* relink by default for publish+Release */ + [InlineData("Release", "", /*aot*/ false, /*build*/ false, /*publish*/ true)] + /* NO relink by default for publish+Release, even when not trimming */ + [InlineData("Release", "false", /*aot*/ false, /*build*/ false, /*publish*/ false)] + + [InlineData("Debug", "", /*aot*/ false, /*build*/ false, /*publish*/ false)] + + /* AOT */ + [InlineData("Release", "", /*aot*/ true, /*build*/ false, /*publish*/ true)] + [InlineData("Debug", "", /*aot*/ true, /*build*/ false, /*publish*/ true)] + // FIXME: separate test + // [InlineData("Release", "true", + // /*aot*/ true, /*build*/ true, /*publish*/ true)] + + /* AOT not affected by trimming */ + [InlineData("Release", "false", /*aot*/ true, /*build*/ false, /*publish*/ true)] + [InlineData("Debug", "false", /*aot*/ true, /*build*/ false, /*publish*/ true)] + public void Defaults(string config, string extraProperties, bool aot, bool buildValue, bool publishValue) + { + string output = CheckWasmNativeDefaultValue("native_defaults_publish", config, extraProperties, aot, dotnetWasmFromRuntimePack: !publishValue); + + Assert.Contains($"** WasmBuildNative: '{buildValue.ToString().ToLower()}', WasmBuildingForNestedPublish: ''", output); + Assert.Contains($"** WasmBuildNative: '{publishValue.ToString().ToLower()}', WasmBuildingForNestedPublish: 'true'", output); + Assert.Contains("Stopping the build", output); + } + + [Theory] + /* always relink */ + [InlineData("Release", "", /*build*/ true, /*publish*/ true)] + [InlineData("Debug", "", /*build*/ true, /*publish*/ true)] + [InlineData("Release", "false", /*build*/ true, /*publish*/ true)] + public void WithNativeReference(string config, string extraProperties, bool buildValue, bool publishValue) + { + string nativeLibPath = Path.Combine(BuildEnvironment.TestAssetsPath, "native-libs", "native-lib.o"); + string nativeRefItem = @$""; + string output = CheckWasmNativeDefaultValue("native_defaults_publish", + config, + extraProperties, + aot: false, + dotnetWasmFromRuntimePack: !publishValue, + extraItems: nativeRefItem); + + Assert.Contains($"** WasmBuildNative: '{buildValue.ToString().ToLower()}', WasmBuildingForNestedPublish: ''", output); + Assert.Contains($"** WasmBuildNative: '{publishValue.ToString().ToLower()}', WasmBuildingForNestedPublish: 'true'", output); + Assert.Contains("Stopping the build", output); + } + + private string CheckWasmNativeDefaultValue(string projectName, + string config, + string extraProperties, + bool aot, + bool dotnetWasmFromRuntimePack, + string extraItems = "") + { + // builds with -O0 + extraProperties += "<_WasmDevel>true"; + + string printValueTarget = @" + + + + "; + + BuildArgs buildArgs = new(ProjectName: projectName, Config: config, AOT: aot, string.Empty, null); + buildArgs = ExpandBuildArgs(buildArgs, + extraProperties: extraProperties, + extraItems: extraItems, + insertAtEnd: printValueTarget); + + (_, string output) = BuildProject(buildArgs, + id: Path.GetRandomFileName(), + new BuildProjectOptions( + InitProject: () => File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), s_mainReturns42), + DotnetWasmFromRuntimePack: dotnetWasmFromRuntimePack, + ExpectSuccess: false, + UseCache: false, + BuildOnlyAfterPublish: false)); + + return output; + } + } +} diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Directory.Build.targets b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Directory.Build.targets index f77fc96c48d059..5cef9821d8f805 100644 --- a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Directory.Build.targets +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Directory.Build.targets @@ -10,7 +10,8 @@ + AfterTargets="ProcessFrameworkReferences" + Condition="'$(WasmNativeWorkload)' == 'true'"> @@ -21,7 +22,8 @@ + AfterTargets="ResolveFrameworkReferences" + Condition="'$(WasmNativeWorkload)' == 'true'"> + AfterTargets="ResolveTargetingPackAssets" + Condition="'$(WasmNativeWorkload)' == 'true'"> @@ -56,7 +59,7 @@ diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Local.Directory.Build.props b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Local.Directory.Build.props new file mode 100644 index 00000000000000..909ea0382ba0ef --- /dev/null +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Local.Directory.Build.props @@ -0,0 +1,11 @@ + + + $(RuntimeSrcDir)\artifacts\bin\ + $([MSBuild]::NormalizeDirectory($(ArtifactsBinDir), 'microsoft.netcore.app.runtime.browser-wasm', $(RuntimeConfig))) + + + + $(WasmBuildSupportDir)\ + $([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'microsoft.netcore.app.runtime.browser-wasm')) + + diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Local.Directory.Build.targets b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Local.Directory.Build.targets new file mode 100644 index 00000000000000..639a8413dc3f6a --- /dev/null +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Local.Directory.Build.targets @@ -0,0 +1,36 @@ + + + <_MicrosoftNetCoreAppRefDir>$(AppRefDir)\ + + + + + + + + + + + + + + + + + diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.props b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.props index 1a9c112e747d9b..6d53e53b3bf551 100644 --- a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.props +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.props @@ -7,8 +7,4 @@ - - - PrepareForWasmBuild;$(WasmBuildAppDependsOn) - diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.targets b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.targets index 65f76e4fc8582c..b327d1e91f6eb8 100644 --- a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.targets +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Local.Directory.Build.targets @@ -16,12 +16,6 @@ Text="%24(WasmMainJS) is set when %24(WasmGenerateAppBundle) is not true: it won't be used because an app bundle is not being generated. Possible build authoring error" /> - - - - - - diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Workloads.Directory.Build.targets b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Workloads.Directory.Build.targets index 105c0a74c08757..34eeeaeee7bd7c 100644 --- a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Workloads.Directory.Build.targets +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Workloads.Directory.Build.targets @@ -1,15 +1,8 @@ - PrepareForWasmBuild;$(WasmBuildAppDependsOn) <_MicrosoftNetCoreAppRefDir>$(AppRefDir)\ - - - - - - diff --git a/src/tests/BuildWasmApps/testassets/native-libs/variadic.c b/src/tests/BuildWasmApps/testassets/native-libs/variadic.c new file mode 100644 index 00000000000000..cd4009439d19da --- /dev/null +++ b/src/tests/BuildWasmApps/testassets/native-libs/variadic.c @@ -0,0 +1,14 @@ +#include + +int sum(int n, ...) +{ + int result = 0; + va_list ptr; + va_start(ptr, n); + + for (int i = 0; i < n; i++) + result += va_arg(ptr, int); + + va_end(ptr); + return result; +} diff --git a/src/tests/BuildWasmApps/testassets/native-libs/variadic.o b/src/tests/BuildWasmApps/testassets/native-libs/variadic.o new file mode 100644 index 00000000000000..b4558ce3519793 Binary files /dev/null and b/src/tests/BuildWasmApps/testassets/native-libs/variadic.o differ diff --git a/src/tests/Common/CLRTest.CrossGen.targets b/src/tests/Common/CLRTest.CrossGen.targets index 94c6c403f8411f..4d3e8ea07d3ac3 100644 --- a/src/tests/Common/CLRTest.CrossGen.targets +++ b/src/tests/Common/CLRTest.CrossGen.targets @@ -225,6 +225,7 @@ if defined RunCrossGen2 ( echo -o:!__OutputFile!>>!__ResponseFile! echo --targetarch:$(TargetArchitecture)>>!__ResponseFile! echo --verify-type-and-field-layout>>!__ResponseFile! + echo --method-layout:random>>!__ResponseFile! echo -r:!CORE_ROOT!\System.*.dll>>!__ResponseFile! echo -r:!CORE_ROOT!\Microsoft.*.dll>>!__ResponseFile! echo -r:!CORE_ROOT!\mscorlib.dll>>!__ResponseFile! diff --git a/src/tests/Common/CoreCLRTestLibrary/Utilities.cs b/src/tests/Common/CoreCLRTestLibrary/Utilities.cs index bd1eb1be37de73..4e22339154be8c 100644 --- a/src/tests/Common/CoreCLRTestLibrary/Utilities.cs +++ b/src/tests/Common/CoreCLRTestLibrary/Utilities.cs @@ -68,6 +68,9 @@ public static bool Verbose public static bool IsWindows7 => IsWindows && Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 1; public static bool IsWindowsNanoServer => (!IsWindowsIoTCore && GetInstallationType().Equals("Nano Server", StringComparison.OrdinalIgnoreCase)); + private static string _variant = Environment.GetEnvironmentVariable("DOTNET_RUNTIME_VARIANT"); + public static bool IsMonoLLVMFULLAOT => _variant == "llvmfullaot"; + // Windows 10 October 2018 Update public static bool IsWindows10Version1809OrGreater => IsWindows && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildNumber() >= 17763; diff --git a/src/tests/Common/Directory.Build.targets b/src/tests/Common/Directory.Build.targets index ed56d4d011b722..6ffee68f72477b 100644 --- a/src/tests/Common/Directory.Build.targets +++ b/src/tests/Common/Directory.Build.targets @@ -143,7 +143,7 @@ - - + + diff --git a/src/tests/Common/ilasm/ilasm.ilproj b/src/tests/Common/ilasm/ilasm.ilproj index 35c0b4ee0c5195..c73f6efe31f8e3 100644 --- a/src/tests/Common/ilasm/ilasm.ilproj +++ b/src/tests/Common/ilasm/ilasm.ilproj @@ -4,6 +4,6 @@ needed by the IL SDK. --> - $(PackageRID) + $(OutputRid) diff --git a/src/tests/Common/publishdependency.targets b/src/tests/Common/publishdependency.targets index 596e4573756df1..de7913a8c6afeb 100644 --- a/src/tests/Common/publishdependency.targets +++ b/src/tests/Common/publishdependency.targets @@ -28,7 +28,7 @@ + Properties="Language=C#;RuntimeIdentifier=$(OutputRid)" /> diff --git a/src/tests/Common/test_dependencies/test_dependencies.csproj b/src/tests/Common/test_dependencies/test_dependencies.csproj index 22f94efd8f2f5f..d20bbec28869cd 100644 --- a/src/tests/Common/test_dependencies/test_dependencies.csproj +++ b/src/tests/Common/test_dependencies/test_dependencies.csproj @@ -5,7 +5,7 @@ $(NetCoreAppToolCurrent) true true - win-arm;win-arm64;win-x64;win-x86;$(PackageRID) + win-arm;win-arm64;win-x64;win-x86;$(OutputRid) true diff --git a/src/tests/Common/test_dependencies_fs/test_dependencies.fsproj b/src/tests/Common/test_dependencies_fs/test_dependencies.fsproj index c23ba6368a498a..196db8eabec630 100644 --- a/src/tests/Common/test_dependencies_fs/test_dependencies.fsproj +++ b/src/tests/Common/test_dependencies_fs/test_dependencies.fsproj @@ -5,7 +5,7 @@ $(NetCoreAppToolCurrent) true true - win-arm;win-arm64;win-x64;win-x86;$(PackageRID) + win-arm;win-arm64;win-x64;win-x86;$(OutputRid) true diff --git a/src/tests/Common/testenvironment.proj b/src/tests/Common/testenvironment.proj index c6d0a7c358d155..293feb331da49c 100644 --- a/src/tests/Common/testenvironment.proj +++ b/src/tests/Common/testenvironment.proj @@ -201,6 +201,8 @@ <_TestEnvFileLine Condition="'$(RuntimeVariant)' == 'monointerpreter'" Include="set MONO_ENV_OPTIONS=--interpreter" /> + <_TestEnvFileLine Condition="'$(RuntimeVariant)' != ''" Include="set DOTNET_RUNTIME_VARIANT=$(RuntimeVariant)" /> + <_TestEnvFileLine Condition="'$(Scenario)' == 'clrinterpreter'" Include="set COMPlus_Interpret=%2A" /> <_TestEnvFileLine Condition="'$(Scenario)' == 'clrinterpreter'" Include="set COMPlus_InterpreterHWIntrinsicsIsSupportedFalse=1" /> @@ -216,6 +218,8 @@ <_TestEnvFileLine Condition="'$(RuntimeVariant)' == 'monointerpreter'" Include="export MONO_ENV_OPTIONS=--interpreter" /> + <_TestEnvFileLine Condition="'$(RuntimeVariant)' != ''" Include="export DOTNET_RUNTIME_VARIANT=$(RuntimeVariant)" /> + <_TestEnvFileLine Condition="'$(RuntimeVariant)' == 'llvmaot'" Include="export MONO_ENV_OPTIONS=--llvm" /> diff --git a/src/tests/Common/wasm-test-runner/WasmTestRunner.proj b/src/tests/Common/wasm-test-runner/WasmTestRunner.proj index 5f4d4f084d13be..d5d3c46d7ea271 100644 --- a/src/tests/Common/wasm-test-runner/WasmTestRunner.proj +++ b/src/tests/Common/wasm-test-runner/WasmTestRunner.proj @@ -1,6 +1,8 @@ - - + + + $(TestBinDir)\obj\ + + false @@ -10,14 +12,17 @@ $(MSBuildThisFileDirectory)\obj\$(Configuration)\wasm $(TestBinDir)/WasmApp/ 99.0 + true + true $(CORE_ROOT)\WasmAppBuilder\WasmAppBuilder.dll $(CORE_ROOT)\MonoAOTCompiler\MonoAOTCompiler.dll $(CORE_ROOT)\JsonToItemsTaskFactory\JsonToItemsTaskFactory.dll $(CORE_ROOT)\RuntimeConfigParser\RuntimeConfigParser.dll + BuildApp;$(WasmBuildAppDependsOn) - + $(TestAssemblyFileName) $(AppDir) diff --git a/src/tests/Directory.Build.props b/src/tests/Directory.Build.props index 6841b4938e70b2..93868bfab8586b 100644 --- a/src/tests/Directory.Build.props +++ b/src/tests/Directory.Build.props @@ -115,7 +115,7 @@ - true + true C# F# IL diff --git a/src/tests/Directory.Build.targets b/src/tests/Directory.Build.targets index 8ab2ab3cd31210..086f8806513d8a 100644 --- a/src/tests/Directory.Build.targets +++ b/src/tests/Directory.Build.targets @@ -369,7 +369,7 @@ diff --git a/src/tests/Exceptions/UnwindFpBleedTest/UnwindFpBleedTest.cs b/src/tests/Exceptions/UnwindFpBleedTest/UnwindFpBleedTest.cs new file mode 100644 index 00000000000000..2240d3f5c7914a --- /dev/null +++ b/src/tests/Exceptions/UnwindFpBleedTest/UnwindFpBleedTest.cs @@ -0,0 +1,82 @@ +using System; +using System.Runtime.CompilerServices; + +class Program +{ + static int Main() + { + double a0 = 1.0; + double a1 = 2.0; + double a2 = 3.0; + double a3 = 4.0; + double a4 = 5.0; + double a5 = 6.0; + double a6 = 7.0; + double a7 = 8.0; + double a8 = 9.0; + double a9 = 10.0; + + for (int i = 1; i < 10; i++) + { + a0 *= 1.0; + a1 *= 2.0; + a2 *= 3.0; + a3 *= 4.0; + a4 *= 5.0; + a5 *= 6.0; + a6 *= 7.0; + a7 *= 8.0; + a8 *= 9.0; + a9 *= 10.0; + } + + EHMethod(); + + bool isExpectedValue = + a0 == 1.0 + && a1 == Math.Pow(2, 10) + && a2 == Math.Pow(3, 10) + && a3 == Math.Pow(4, 10) + && a4 == Math.Pow(5, 10) + && a5 == Math.Pow(6, 10) + && a6 == Math.Pow(7, 10) + && a7 == Math.Pow(8, 10) + && a8 == Math.Pow(9, 10) + && a9 == Math.Pow(10, 10); + + return isExpectedValue ? 100 : 1; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static void EHMethod() + { + try + { + FloatManipulationMethod(); + } + catch (Exception) { } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static void FloatManipulationMethod() + { + // Enough locals to try to get the JIT to touch at least some of the non-volatile + // registers (some spilling might happen, but hopefully the lack of EH prioritizes + // registers). + double a0 = 1, a1 = 2, a2 = 3, a3 = 4, a4 = 5, a5 = 6, a6 = 7, a7 = 8; + double a8 = 1, a9 = 2, a10 = 3, a11 = 4, a12 = 5, a13 = 6, a14 = 7, a15 = 8; + double a16 = 1, a17 = 2, a18 = 3, a19 = 4, a20 = 5, a21 = 6, a22 = 7, a23 = 8; + double a24 = 1, a25 = 2, a26 = 3, a27 = 4, a28 = 5, a29 = 6, a30 = 7, a31 = 8; + + // Some busy math to prevent easy optimizations and folding. + for (int i = 0; i < 5; i++) + { + a0 -= 1; a1 -= 2; a2 -= 3; a3 -= 4; a4 -= 5; a5 -= 6; a6 -= 7; a7 -= 8; + a8 -= 9; a9 -= 10; a10 -= 11; a11 -= 12; a12 -= 13; a13 -= 14; a14 -= 15; a15 -= 16; + a16 -= 17; a17 -= 18; a18 -= 19; a19 -= 20; a20 -= 21; a21 -= 22; a22 -= 23; a23 -= 24; + a24 -= 25; a25 -= 26; a26 -= 27; a27 -= 28; a28 -= 29; a29 -= 30; a30 -= 31; a31 -= 32; + } + + throw new Exception(); + } +} diff --git a/src/tests/Exceptions/UnwindFpBleedTest/UnwindFpBleedTest.csproj b/src/tests/Exceptions/UnwindFpBleedTest/UnwindFpBleedTest.csproj new file mode 100644 index 00000000000000..f4e80e7eb58b8d --- /dev/null +++ b/src/tests/Exceptions/UnwindFpBleedTest/UnwindFpBleedTest.csproj @@ -0,0 +1,8 @@ + + + Exe + + + + + diff --git a/src/tests/FunctionalTests/Android/Device_Emulator/AOT_System.IO.Stream/Android.Device_Emulator.Aot_System.IO.Stream.Test.csproj b/src/tests/FunctionalTests/Android/Device_Emulator/AOT_System.IO.Stream/Android.Device_Emulator.Aot_System.IO.Stream.Test.csproj new file mode 100644 index 00000000000000..c8d2f37c34880d --- /dev/null +++ b/src/tests/FunctionalTests/Android/Device_Emulator/AOT_System.IO.Stream/Android.Device_Emulator.Aot_System.IO.Stream.Test.csproj @@ -0,0 +1,16 @@ + + + Exe + true + false + true + $(NetCoreAppCurrent) + Android.Device_Emulator.Aot_System.IO.Stream.Test.dll + 42 + true + + + + + + diff --git a/src/tests/FunctionalTests/Android/Device_Emulator/AOT_System.IO.Stream/Program.cs b/src/tests/FunctionalTests/Android/Device_Emulator/AOT_System.IO.Stream/Program.cs new file mode 100644 index 00000000000000..29215aeb777147 --- /dev/null +++ b/src/tests/FunctionalTests/Android/Device_Emulator/AOT_System.IO.Stream/Program.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +#nullable enable + +using System; +using System.IO; + +// https://github.com/dotnet/runtime/issues/67402 + +public static class Program +{ + public static int Main(string[] args) + { + var stream = new DummyStream(); + var buffer = new byte[stream.Length]; + int read = stream.ReadAsync(buffer, 0, buffer.Length).GetAwaiter().GetResult(); + return read + buffer[0]; + } + + private sealed class DummyStream : System.IO.Stream + { + protected override void Dispose (bool disposing) => throw new NotImplementedException (); + + public override int Read (byte[] buffer, int offset, int count) + { + buffer[0] = 41; + return 1; + } + + public override long Seek (long offset, SeekOrigin origin) => 0; + public override void SetLength (long value) {} + public override void Write (byte[] buffer, int offset, int count) {} + public override void Flush () {} + + public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state) + { + Console.WriteLine("BeginRead"); + return base.BeginRead(buffer, offset, count, callback, state); + } + + public override bool CanRead => true; + public override bool CanSeek => false; + public override bool CanWrite => false; + + public override long Length => 1; + public override long Position { get; set; } = 0; + } +} diff --git a/src/tests/FunctionalTests/WebAssembly/Browser/HotReload/WebAssembly.Browser.HotReload.Test.csproj b/src/tests/FunctionalTests/WebAssembly/Browser/HotReload/WebAssembly.Browser.HotReload.Test.csproj index 2ba05527c2a42d..d9dbaa2ebd4443 100644 --- a/src/tests/FunctionalTests/WebAssembly/Browser/HotReload/WebAssembly.Browser.HotReload.Test.csproj +++ b/src/tests/FunctionalTests/WebAssembly/Browser/HotReload/WebAssembly.Browser.HotReload.Test.csproj @@ -16,13 +16,10 @@ Always + - - - - diff --git a/src/tests/FunctionalTests/WebAssembly/Browser/RuntimeConfig/WebAssembly.Browser.RuntimeConfig.Test.csproj b/src/tests/FunctionalTests/WebAssembly/Browser/RuntimeConfig/WebAssembly.Browser.RuntimeConfig.Test.csproj index 4efa17aab45d9b..35e9eec2cae877 100644 --- a/src/tests/FunctionalTests/WebAssembly/Browser/RuntimeConfig/WebAssembly.Browser.RuntimeConfig.Test.csproj +++ b/src/tests/FunctionalTests/WebAssembly/Browser/RuntimeConfig/WebAssembly.Browser.RuntimeConfig.Test.csproj @@ -5,13 +5,9 @@ 42 runtime.js - + + - - - - - diff --git a/src/tests/FunctionalTests/WebAssembly/Directory.Build.targets b/src/tests/FunctionalTests/WebAssembly/Directory.Build.targets index b0d320fabe3776..802f2525e58808 100644 --- a/src/tests/FunctionalTests/WebAssembly/Directory.Build.targets +++ b/src/tests/FunctionalTests/WebAssembly/Directory.Build.targets @@ -2,13 +2,6 @@ - PrepareForWasmBuild;$(WasmBuildAppDependsOn) $(OutputPath)\$(Configuration)\AppBundle\ - - - - - - diff --git a/src/tests/GC/API/GC/GetTotalPauseDuration.cs b/src/tests/GC/API/GC/GetTotalPauseDuration.cs new file mode 100644 index 00000000000000..96ac42640c804b --- /dev/null +++ b/src/tests/GC/API/GC/GetTotalPauseDuration.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// Tests GC.GetTotalPauseDuration() + +using System; +using System.Diagnostics; +using System.Reflection; + +public class Test_Collect +{ + public static int Main() + { + Stopwatch sw = Stopwatch.StartNew(); + GC.Collect(); + sw.Stop(); + TimeSpan elapsed = sw.Elapsed; + TimeSpan totalPauseDuration = (TimeSpan)typeof(GC).GetMethod("GetTotalPauseDuration", BindingFlags.Public | BindingFlags.Static).Invoke(null, null); + GCMemoryInfo memoryInfo = GC.GetGCMemoryInfo(); + TimeSpan lastGcDuration = memoryInfo.PauseDurations[0]; + + // These conditions assume the only GC in the process + // is the one we just triggered. This makes the test incompatible + // with any changes that might introduce extra GCs. + + if (TimeSpan.Zero < totalPauseDuration && + totalPauseDuration <= elapsed && + lastGcDuration == totalPauseDuration) + { + return 100; + } + else + { + return 101; + } + } +} diff --git a/src/tests/GC/API/GC/GetTotalPauseDuration.csproj b/src/tests/GC/API/GC/GetTotalPauseDuration.csproj new file mode 100644 index 00000000000000..358a5cea38bb5e --- /dev/null +++ b/src/tests/GC/API/GC/GetTotalPauseDuration.csproj @@ -0,0 +1,16 @@ + + + Exe + + true + + 0 + + + + PdbOnly + + + + + diff --git a/src/tests/Interop/COM/ComWrappers/API/Program.cs b/src/tests/Interop/COM/ComWrappers/API/Program.cs index 52da8f8d060cfd..98f09ac4d00a70 100644 --- a/src/tests/Interop/COM/ComWrappers/API/Program.cs +++ b/src/tests/Interop/COM/ComWrappers/API/Program.cs @@ -624,6 +624,9 @@ static int Main(string[] doNotUse) ValidateQueryInterfaceAfterManagedObjectCollected(); ValidateAggregationWithComObject(); ValidateAggregationWithReferenceTrackerObject(); + + // Ensure all objects have been cleaned up. + ForceGC(); } catch (Exception e) { diff --git a/src/tests/Interop/COM/ComWrappers/Common.cs b/src/tests/Interop/COM/ComWrappers/Common.cs index d100744cb271fc..bd4e7404ef2027 100644 --- a/src/tests/Interop/COM/ComWrappers/Common.cs +++ b/src/tests/Interop/COM/ComWrappers/Common.cs @@ -156,6 +156,12 @@ public static AllocationCountResult CountTrackerObjectAllocations() [DllImport(nameof(MockReferenceTrackerRuntime))] extern public static int TrackerTarget_ReleaseFromReferenceTracker(IntPtr ptr); + + // Suppressing the GC transition here as we want to make sure we are in-sync + // with the GC which is setting the connected value. + [SuppressGCTransition] + [DllImport(nameof(MockReferenceTrackerRuntime))] + extern public static byte IsTrackerObjectConnected(IntPtr instance); } [Guid("42951130-245C-485E-B60B-4ED4254256F8")] @@ -219,6 +225,12 @@ static IntPtr CreateInstance(IntPtr outer, out IntPtr inner) } else { + byte isConnected = MockReferenceTrackerRuntime.IsTrackerObjectConnected(this.classNative.Instance); + if (isConnected != 0) + { + throw new Exception("TrackerObject should be disconnected prior to finalization"); + } + ComWrappersHelper.Cleanup(ref this.classNative); } } diff --git a/src/tests/Interop/COM/ComWrappers/GlobalInstance/GlobalInstance.cs b/src/tests/Interop/COM/ComWrappers/GlobalInstance/GlobalInstance.cs index 7a358a972f2da6..38c25329315968 100644 --- a/src/tests/Interop/COM/ComWrappers/GlobalInstance/GlobalInstance.cs +++ b/src/tests/Interop/COM/ComWrappers/GlobalInstance/GlobalInstance.cs @@ -171,6 +171,11 @@ protected override object CreateObject(IntPtr externalComObject, CreateObjectFla protected override void ReleaseObjects(IEnumerable objects) { + foreach (object o in objects) + { + Assert.IsNotNull(o); + } + throw new Exception() { HResult = ReleaseObjectsCallAck }; } diff --git a/src/tests/Interop/COM/ComWrappers/MockReferenceTrackerRuntime/ReferenceTrackerRuntime.cpp b/src/tests/Interop/COM/ComWrappers/MockReferenceTrackerRuntime/ReferenceTrackerRuntime.cpp index 63a013b5cb484b..cacd112eb7afb5 100644 --- a/src/tests/Interop/COM/ComWrappers/MockReferenceTrackerRuntime/ReferenceTrackerRuntime.cpp +++ b/src/tests/Interop/COM/ComWrappers/MockReferenceTrackerRuntime/ReferenceTrackerRuntime.cpp @@ -218,6 +218,11 @@ namespace } } + bool IsConnected() + { + return _connected; + } + STDMETHOD(AddObjectRef)(_In_ IUnknown* c, _Out_ int* id) { assert(c != nullptr && id != nullptr); @@ -546,6 +551,12 @@ extern "C" DLL_EXPORT int STDMETHODCALLTYPE Trigger_NotifyEndOfReferenceTracking return TrackerRuntimeManager.NotifyEndOfReferenceTrackingOnThread(); } +extern "C" DLL_EXPORT bool STDMETHODCALLTYPE IsTrackerObjectConnected(IUnknown* inst) +{ + auto trackerObject = reinterpret_cast(inst); + return trackerObject->IsConnected(); +} + extern "C" DLL_EXPORT void* STDMETHODCALLTYPE TrackerTarget_AddRefFromReferenceTrackerAndReturn(IUnknown *obj) { assert(obj != nullptr); diff --git a/src/tests/Interop/COM/ComWrappers/WeakReference/WeakReferenceNative.cpp b/src/tests/Interop/COM/ComWrappers/WeakReference/WeakReferenceNative.cpp index 89a0b996f88eab..1b521366f21e70 100644 --- a/src/tests/Interop/COM/ComWrappers/WeakReference/WeakReferenceNative.cpp +++ b/src/tests/Interop/COM/ComWrappers/WeakReference/WeakReferenceNative.cpp @@ -167,8 +167,122 @@ namespace return UnknownImpl::DoRelease(); } }; + + struct WeakReferenceSource : public IWeakReferenceSource, public IInspectable + { + private: + IUnknown* _outerUnknown; + ComSmartPtr _weakReference; + public: + WeakReferenceSource(IUnknown* outerUnknown) + :_outerUnknown(outerUnknown), + _weakReference(new WeakReference(this, 1)) + { + } + + STDMETHOD(GetWeakReference)(IWeakReference** ppWeakReference) + { + _weakReference->AddRef(); + *ppWeakReference = _weakReference; + return S_OK; + } + + STDMETHOD(QueryInterface)( + /* [in] */ REFIID riid, + /* [iid_is][out] */ void ** ppvObject) + { + if (riid == __uuidof(IWeakReferenceSource)) + { + *ppvObject = static_cast(this); + _weakReference->AddStrongRef(); + return S_OK; + } + return _outerUnknown->QueryInterface(riid, ppvObject); + } + STDMETHOD_(ULONG, AddRef)(void) + { + return _weakReference->AddStrongRef(); + } + STDMETHOD_(ULONG, Release)(void) + { + return _weakReference->ReleaseStrongRef(); + } + + STDMETHOD(GetRuntimeClassName)(HSTRING* pRuntimeClassName) + { + return E_NOTIMPL; + } + + STDMETHOD(GetIids)( + ULONG *iidCount, + IID **iids) + { + return E_NOTIMPL; + } + + STDMETHOD(GetTrustLevel)(TrustLevel *trustLevel) + { + *trustLevel = FullTrust; + return S_OK; + } + }; + + struct AggregatedWeakReferenceSource : IInspectable + { + private: + IUnknown* _outerUnknown; + ComSmartPtr _weakReference; + public: + AggregatedWeakReferenceSource(IUnknown* outerUnknown) + :_outerUnknown(outerUnknown), + _weakReference(new WeakReferenceSource(outerUnknown)) + { + } + + STDMETHOD(GetRuntimeClassName)(HSTRING* pRuntimeClassName) + { + return E_NOTIMPL; + } + + STDMETHOD(GetIids)( + ULONG *iidCount, + IID **iids) + { + return E_NOTIMPL; + } + + STDMETHOD(GetTrustLevel)(TrustLevel *trustLevel) + { + *trustLevel = FullTrust; + return S_OK; + } + + STDMETHOD(QueryInterface)( + /* [in] */ REFIID riid, + /* [iid_is][out] */ void ** ppvObject) + { + if (riid == __uuidof(IWeakReferenceSource)) + { + return _weakReference->QueryInterface(riid, ppvObject); + } + return _outerUnknown->QueryInterface(riid, ppvObject); + } + STDMETHOD_(ULONG, AddRef)(void) + { + return _outerUnknown->AddRef(); + } + STDMETHOD_(ULONG, Release)(void) + { + return _outerUnknown->Release(); + } + }; } extern "C" DLL_EXPORT WeakReferencableObject* STDMETHODCALLTYPE CreateWeakReferencableObject() { return new WeakReferencableObject(); } + +extern "C" DLL_EXPORT AggregatedWeakReferenceSource* STDMETHODCALLTYPE CreateAggregatedWeakReferenceObject(IUnknown* pOuter) +{ + return new AggregatedWeakReferenceSource(pOuter); +} diff --git a/src/tests/Interop/COM/ComWrappers/WeakReference/WeakReferenceTest.cs b/src/tests/Interop/COM/ComWrappers/WeakReference/WeakReferenceTest.cs index 38e40d129243f6..1d2ebe821ace3d 100644 --- a/src/tests/Interop/COM/ComWrappers/WeakReference/WeakReferenceTest.cs +++ b/src/tests/Interop/COM/ComWrappers/WeakReference/WeakReferenceTest.cs @@ -14,6 +14,9 @@ static class WeakReferenceNative { [DllImport(nameof(WeakReferenceNative))] public static extern IntPtr CreateWeakReferencableObject(); + + [DllImport(nameof(WeakReferenceNative))] + public static extern IntPtr CreateAggregatedWeakReferenceObject(IntPtr outer); } public struct VtblPtr @@ -28,71 +31,96 @@ public enum WrapperRegistration Marshalling, } - public class WeakReferenceableWrapper + public unsafe class WeakReferenceableWrapper { private struct Vtbl { - public IntPtr QueryInterface; - public _AddRef AddRef; - public _Release Release; + public delegate* unmanaged QueryInterface; + public delegate* unmanaged AddRef; + public delegate* unmanaged Release; } - private delegate int _AddRef(IntPtr This); - private delegate int _Release(IntPtr This); - private readonly IntPtr instance; private readonly Vtbl vtable; + private readonly bool releaseInFinalizer; public WrapperRegistration Registration { get; } - public WeakReferenceableWrapper(IntPtr instance, WrapperRegistration reg) + public WeakReferenceableWrapper(IntPtr instance, WrapperRegistration reg, bool releaseInFinalizer = true) { var inst = Marshal.PtrToStructure(instance); this.vtable = Marshal.PtrToStructure(inst.Vtbl); this.instance = instance; + this.releaseInFinalizer = releaseInFinalizer; Registration = reg; } + public int QueryInterface(Guid iid, out IntPtr ptr) + { + fixed(IntPtr* ppv = &ptr) + { + return this.vtable.QueryInterface(this.instance, &iid, ppv); + } + } + ~WeakReferenceableWrapper() { - if (this.instance != IntPtr.Zero) + if (this.instance != IntPtr.Zero && this.releaseInFinalizer) { this.vtable.Release(this.instance); } } } - class Program + class DerivedObject : ICustomQueryInterface { - class TestComWrappers : ComWrappers + private WeakReferenceableWrapper inner; + public DerivedObject(TestComWrappers comWrappersInstance) { - public WrapperRegistration Registration { get; } + IntPtr innerInstance = WeakReferenceNative.CreateAggregatedWeakReferenceObject( + comWrappersInstance.GetOrCreateComInterfaceForObject(this, CreateComInterfaceFlags.None)); + inner = new WeakReferenceableWrapper(innerInstance, comWrappersInstance.Registration, releaseInFinalizer: false); + comWrappersInstance.GetOrRegisterObjectForComInstance(innerInstance, CreateObjectFlags.Aggregation, this); + } - public TestComWrappers(WrapperRegistration reg = WrapperRegistration.Local) - { - Registration = reg; - } + public CustomQueryInterfaceResult GetInterface(ref Guid iid, out IntPtr ppv) + { + return inner.QueryInterface(iid, out ppv) == 0 ? CustomQueryInterfaceResult.Handled : CustomQueryInterfaceResult.Failed; + } + } - protected unsafe override ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) - { - count = 0; - return null; - } + class TestComWrappers : ComWrappers + { + public WrapperRegistration Registration { get; } - protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flag) - { - Marshal.AddRef(externalComObject); - return new WeakReferenceableWrapper(externalComObject, Registration); - } + public TestComWrappers(WrapperRegistration reg = WrapperRegistration.Local) + { + Registration = reg; + } - protected override void ReleaseObjects(IEnumerable objects) - { - } + protected unsafe override ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) + { + count = 0; + return null; + } + + protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flag) + { + Marshal.AddRef(externalComObject); + return new WeakReferenceableWrapper(externalComObject, Registration); + } - public static readonly TestComWrappers TrackerSupportInstance = new TestComWrappers(WrapperRegistration.TrackerSupport); - public static readonly TestComWrappers MarshallingInstance = new TestComWrappers(WrapperRegistration.Marshalling); + protected override void ReleaseObjects(IEnumerable objects) + { } + public static readonly TestComWrappers TrackerSupportInstance = new TestComWrappers(WrapperRegistration.TrackerSupport); + public static readonly TestComWrappers MarshallingInstance = new TestComWrappers(WrapperRegistration.Marshalling); + } + + class Program + { + private static void ValidateWeakReferenceState(WeakReference wr, bool expectedIsAlive, TestComWrappers sourceWrappers = null) { WeakReferenceableWrapper target; @@ -135,7 +163,7 @@ private static void ValidateNativeWeakReference(TestComWrappers cw) // a global ComWrappers instance. If the RCW was created throug a local ComWrappers instance, the weak // reference should be dead and stay dead once the RCW is collected. bool supportsRehydration = cw.Registration != WrapperRegistration.Local; - + Console.WriteLine($" -- Validate RCW recreation"); ValidateWeakReferenceState(weakRef, expectedIsAlive: supportsRehydration, cw); @@ -221,6 +249,26 @@ bool HasTarget(WeakReference wr) Assert.IsNull(weakRef.Target); } + static void ValidateAggregatedWeakReference() + { + Console.WriteLine("Validate weak reference with aggregation."); + var (handle, weakRef) = GetWeakReference(); + + GC.Collect(); + GC.WaitForPendingFinalizers(); + + Assert.IsNull(handle.Target); + Assert.IsFalse(weakRef.TryGetTarget(out _)); + + static (GCHandle handle, WeakReference) GetWeakReference() + { + DerivedObject obj = new DerivedObject(TestComWrappers.TrackerSupportInstance); + // We use an explicit weak GC handle here to enable us to validate that we are using "weak" GCHandle + // semantics with the weak reference. + return (GCHandle.Alloc(obj, GCHandleType.Weak), new WeakReference(obj)); + } + } + static int Main(string[] doNotUse) { try @@ -235,6 +283,7 @@ static int Main(string[] doNotUse) ComWrappers.RegisterForTrackerSupport(TestComWrappers.TrackerSupportInstance); ValidateGlobalInstanceTrackerSupport(); + ValidateAggregatedWeakReference(); ValidateLocalInstance(); } diff --git a/src/tests/Interop/DllImportAttribute/DllImportPath/DllImportPathTest.cs b/src/tests/Interop/DllImportAttribute/DllImportPath/DllImportPathTest.cs index c83295d89292a4..ee92305b789623 100644 --- a/src/tests/Interop/DllImportAttribute/DllImportPath/DllImportPathTest.cs +++ b/src/tests/Interop/DllImportAttribute/DllImportPath/DllImportPathTest.cs @@ -174,11 +174,14 @@ public static int Main(string[] args) { TestNativeLibraryProbingOnLocalPath(); TestNativeLibraryProbingOnRelativePath(); - if (!OperatingSystem.IsMacOS()) // This test fails due to a bug in OSX 10.12 combined with the weird way that HFS+ handles unicode file names + if (!OperatingSystem.IsMacOS()) { + // This test fails due to a bug in OSX 10.12 combined with the weird way that HFS+ handles unicode file names TestNativeLibraryProbingUnicode(); + + // Propagating LD_LIBRARY_PATH/DYLD_LIBRARY_PATH may blocked on Mac due to System Integrity Protection + TestNativeLibraryProbingOnPathEnv(); } - TestNativeLibraryProbingOnPathEnv(); if (OperatingSystem.IsWindows()) { TestNativeExeProbing(); diff --git a/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.cs b/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.cs new file mode 100644 index 00000000000000..8534824d20d7d9 --- /dev/null +++ b/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.cs @@ -0,0 +1,85 @@ +// 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.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using Xunit; + +public class DllImportSearchPathsTest +{ + private static string Subdirectory => Path.Combine(NativeLibraryToLoad.GetDirectory(), "subdirectory"); + private static bool CanLoadAssemblyInSubdirectory => + !TestLibrary.Utilities.IsMonoLLVMFULLAOT && + !OperatingSystem.IsAndroid() && + !OperatingSystem.IsIOS() && + !OperatingSystem.IsTvOS() && + !OperatingSystem.IsBrowser(); + + static int Main(string[] args) + { + try + { + AssemblyDirectory_NotFound(); + if (CanLoadAssemblyInSubdirectory) + AssemblyDirectory_Found(); + + if (OperatingSystem.IsWindows()) + AssemblyDirectory_Fallback_Found(); + } + catch (Exception e) + { + Console.WriteLine($"Test Failure: {e}"); + return 101; + } + + return 100; + } + + public static void AssemblyDirectory_NotFound() + { + // Library should not be found in the assembly directory + Assert.Throws(() => NativeLibraryPInvoke.Sum(1, 2)); + } + + public static void AssemblyDirectory_Found() + { + // Library should be found in the assembly directory + var assembly = Assembly.LoadFile(Path.Combine(Subdirectory, $"{nameof(DllImportSearchPathsTest)}.dll")); + var type = assembly.GetType(nameof(NativeLibraryPInvoke)); + var method = type.GetMethod(nameof(NativeLibraryPInvoke.Sum)); + + int sum = (int)method.Invoke(null, new object[] { 1, 2 }); + Assert.Equal(3, sum); + } + + public static void AssemblyDirectory_Fallback_Found() + { + string currentDirectory = Environment.CurrentDirectory; + try + { + Environment.CurrentDirectory = Subdirectory; + + // Library should not be found in the assembly directory, but should fall back to the default OS search which includes CWD on Windows + int sum = NativeLibraryPInvoke.Sum(1, 2); + Assert.Equal(3, sum); + } + finally + { + Environment.CurrentDirectory = currentDirectory; + } + } +} + +public class NativeLibraryPInvoke +{ + public static int Sum(int a, int b) + { + return NativeSum(a, b); + } + + [DllImport(NativeLibraryToLoad.Name)] + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory)] + static extern int NativeSum(int arg1, int arg2); +} diff --git a/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.csproj b/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.csproj new file mode 100644 index 00000000000000..70277c524034f7 --- /dev/null +++ b/src/tests/Interop/DllImportSearchPaths/DllImportSearchPathsTest.csproj @@ -0,0 +1,25 @@ + + + Exe + true + + + + + + + + + + $(OutDir)/subdirectory + -in-subdirectory + + + <_FilesToCopy Include="$(OutDir)/$(TargetName).dll" /> + <_FilesToMove Include="$(OutDir)/libNativeLibrary.*" /> + <_FilesToMove Include="$(OutDir)/NativeLibrary.*" /> + + + + + diff --git a/src/tests/Interop/IDynamicInterfaceCastable/Program.cs b/src/tests/Interop/IDynamicInterfaceCastable/Program.cs index 00e9863d451493..73febecafdb7ed 100644 --- a/src/tests/Interop/IDynamicInterfaceCastable/Program.cs +++ b/src/tests/Interop/IDynamicInterfaceCastable/Program.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using TestLibrary; @@ -26,9 +27,9 @@ public interface ITest int CallImplemented(ImplementationToCall toCall); } - public interface ITestGeneric + public interface ITestGeneric { - T ReturnArg(T t); + U ReturnArg(T t); } public interface IDirectlyImplemented @@ -115,18 +116,24 @@ Type ITest.GetMyType() } [DynamicInterfaceCastableImplementation] - public interface ITestGenericImpl: ITestGeneric + public interface ITestGenericImpl: ITestGeneric { - T ITestGeneric.ReturnArg(T t) + U ITestGeneric.ReturnArg(T t) { - return t; + if (!typeof(T).IsAssignableTo(typeof(U)) + && !t.GetType().IsAssignableTo(typeof(U))) + { + throw new Exception($"Invalid covariance conversion from {typeof(T)} or {t.GetType()} to {typeof(U)}"); + } + + return Unsafe.As(ref t); } } [DynamicInterfaceCastableImplementation] - public interface ITestGenericIntImpl: ITestGeneric + public interface ITestGenericIntImpl: ITestGeneric { - int ITestGeneric.ReturnArg(int i) + int ITestGeneric.ReturnArg(int i) { return i; } @@ -312,27 +319,34 @@ private static void ValidateGenericInterface() Console.WriteLine($"Running {nameof(ValidateGenericInterface)}"); object castableObj = new DynamicInterfaceCastable(new Dictionary { - { typeof(ITestGeneric), typeof(ITestGenericIntImpl) }, - { typeof(ITestGeneric), typeof(ITestGenericImpl) }, + { typeof(ITestGeneric), typeof(ITestGenericIntImpl) }, + { typeof(ITestGeneric), typeof(ITestGenericImpl) }, + { typeof(ITestGeneric), typeof(ITestGenericImpl) }, }); Console.WriteLine(" -- Validate cast"); - // ITestGeneric -> ITestGenericIntImpl - Assert.IsTrue(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); - Assert.IsNotNull(castableObj as ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via as"); - ITestGeneric testInt = (ITestGeneric)castableObj; + // ITestGeneric -> ITestGenericIntImpl + Assert.IsTrue(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); + Assert.IsNotNull(castableObj as ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via as"); + ITestGeneric testInt = (ITestGeneric)castableObj; + + // ITestGeneric -> ITestGenericImpl + Assert.IsTrue(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); + Assert.IsNotNull(castableObj as ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via as"); + ITestGeneric testStr = (ITestGeneric)castableObj; - // ITestGeneric -> ITestGenericImpl - Assert.IsTrue(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); - Assert.IsNotNull(castableObj as ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via as"); - ITestGeneric testStr = (ITestGeneric)castableObj; + // Validate Variance + // ITestGeneric -> ITestGenericImpl + Assert.IsTrue(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); + Assert.IsNotNull(castableObj as ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via as"); + ITestGeneric testVar = (ITestGeneric)castableObj; - // ITestGeneric is not recognized - Assert.IsFalse(castableObj is ITestGeneric, $"Should not be castable to {nameof(ITestGeneric)} via is"); - Assert.IsNull(castableObj as ITestGeneric, $"Should not be castable to {nameof(ITestGeneric)} via as"); - var ex = Assert.Throws(() => { var _ = (ITestGeneric)castableObj; }); - Assert.AreEqual(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric)), ex.Message); + // ITestGeneric is not recognized + Assert.IsFalse(castableObj is ITestGeneric, $"Should not be castable to {nameof(ITestGeneric)} via is"); + Assert.IsNull(castableObj as ITestGeneric, $"Should not be castable to {nameof(ITestGeneric)} via as"); + var ex = Assert.Throws(() => { var _ = (ITestGeneric)castableObj; }); + Assert.AreEqual(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric)), ex.Message); int expectedInt = 42; string expectedStr = "str"; @@ -340,12 +354,15 @@ private static void ValidateGenericInterface() Console.WriteLine(" -- Validate method call"); Assert.AreEqual(expectedInt, testInt.ReturnArg(42)); Assert.AreEqual(expectedStr, testStr.ReturnArg(expectedStr)); + Assert.AreEqual(expectedStr, testVar.ReturnArg(expectedStr)); Console.WriteLine(" -- Validate delegate call"); Func funcInt = new Func(testInt.ReturnArg); Assert.AreEqual(expectedInt, funcInt(expectedInt)); Func funcStr = new Func(testStr.ReturnArg); Assert.AreEqual(expectedStr, funcStr(expectedStr)); + Func funcVar = new Func(testVar.ReturnArg); + Assert.AreEqual(expectedStr, funcVar(expectedStr)); } private static void ValidateOverriddenInterface() diff --git a/src/tests/Interop/IJW/IJW.cmake b/src/tests/Interop/IJW/IJW.cmake index 1ba007427185c2..0e94553450b0d3 100644 --- a/src/tests/Interop/IJW/IJW.cmake +++ b/src/tests/Interop/IJW/IJW.cmake @@ -32,7 +32,7 @@ if (CLR_CMAKE_HOST_WIN32) string(REPLACE "/GR-" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") endif() - set(CLR_SDK_REF_PACK "") + set(CLR_SDK_REF_PACK_OUTPUT "") set(CLR_SDK_REF_PACK_DISCOVERY_ERROR "") set(CLR_SDK_REF_PACK_DISCOVERY_RESULT 0) @@ -40,14 +40,14 @@ if (CLR_CMAKE_HOST_WIN32) message("Using live-built ref assemblies for C++/CLI runtime tests.") execute_process( COMMAND powershell -ExecutionPolicy ByPass -NoProfile "${CMAKE_CURRENT_LIST_DIR}/getRefPackFolderFromArtifacts.ps1" - OUTPUT_VARIABLE CLR_SDK_REF_PACK + OUTPUT_VARIABLE CLR_SDK_REF_PACK_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_VARIABLE CLR_SDK_REF_PACK_DISCOVERY_ERROR RESULT_VARIABLE CLR_SDK_REF_PACK_DISCOVERY_RESULT) else() execute_process( COMMAND powershell -ExecutionPolicy ByPass -NoProfile "${CMAKE_CURRENT_LIST_DIR}/getRefPackFolderFromSdk.ps1" - OUTPUT_VARIABLE CLR_SDK_REF_PACK + OUTPUT_VARIABLE CLR_SDK_REF_PACK_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_VARIABLE CLR_SDK_REF_PACK_DISCOVERY_ERROR RESULT_VARIABLE CLR_SDK_REF_PACK_DISCOVERY_RESULT) @@ -57,6 +57,8 @@ if (CLR_CMAKE_HOST_WIN32) message(FATAL_ERROR "Unable to find reference assemblies: ${CLR_SDK_REF_PACK_DISCOVERY_ERROR}") endif() + string(REGEX REPLACE ".*refPackPath=(.*)" "\\1" CLR_SDK_REF_PACK ${CLR_SDK_REF_PACK_OUTPUT}) + add_compile_options(/AI${CLR_SDK_REF_PACK}) list(APPEND LINK_LIBRARIES_ADDITIONAL ijwhost) diff --git a/src/tests/Interop/IJW/getRefPackFolderFromArtifacts.ps1 b/src/tests/Interop/IJW/getRefPackFolderFromArtifacts.ps1 index aaf5e93661ae3a..98242949f440b4 100644 --- a/src/tests/Interop/IJW/getRefPackFolderFromArtifacts.ps1 +++ b/src/tests/Interop/IJW/getRefPackFolderFromArtifacts.ps1 @@ -18,4 +18,4 @@ if (-not (Test-Path $refPackPath)) return 1 } -Write-Output $refPackPath +Write-Output "refPackPath=$refPackPath" diff --git a/src/tests/Interop/IJW/getRefPackFolderFromSdk.ps1 b/src/tests/Interop/IJW/getRefPackFolderFromSdk.ps1 index bb2404d27a6265..0b94bca5e10721 100644 --- a/src/tests/Interop/IJW/getRefPackFolderFromSdk.ps1 +++ b/src/tests/Interop/IJW/getRefPackFolderFromSdk.ps1 @@ -25,4 +25,4 @@ if (-not (Test-Path $refPackPath)) return 1 } -Write-Output $refPackPath +Write-Output "refPackPath=$refPackPath" diff --git a/src/tests/Interop/NativeLibrary/API/NativeLibraryTests.cs b/src/tests/Interop/NativeLibrary/API/NativeLibraryTests.cs index 4742b2e0b5bdbb..699a125dfb2c42 100644 --- a/src/tests/Interop/NativeLibrary/API/NativeLibraryTests.cs +++ b/src/tests/Interop/NativeLibrary/API/NativeLibraryTests.cs @@ -110,13 +110,22 @@ public static int Main() if (TestLibrary.Utilities.IsWindows && File.Exists(Path.Combine(Environment.SystemDirectory, libName))) { - // Calls on a valid library from System32 directory + // Library should be found in the system directory success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.System32)); success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.System32)); - // Calls on a valid library from application directory + // Library should not be found in the assembly directory and should be found in the system directory + success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.System32)); + success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.System32)); + + // Library should not be found in the assembly directory, but should fall back to the default OS search which includes CWD on Windows + success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory)); + success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory)); + + // Library should not be found in application directory success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.ApplicationDirectory), TestResult.DllNotFound); success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.ApplicationDirectory), TestResult.ReturnFailure); + } // Calls with null libName input @@ -134,6 +143,35 @@ public static int Main() success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory), TestResult.DllNotFound); success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory), TestResult.ReturnFailure); + string suffix = "-in-subdirectory"; + libName = $"{NativeLibraryToLoad.Name}{suffix}"; + string subdirectory = Path.Combine(testBinDir, "subdirectory"); + + if (!TestLibrary.Utilities.IsMonoLLVMFULLAOT) + { + // Library should be found in the assembly directory + Assembly assemblyInSubdirectory = Assembly.LoadFile(Path.Combine(subdirectory, $"{Path.GetFileNameWithoutExtension(assembly.Location)}{suffix}.dll")); + EXPECT(LoadLibraryAdvanced(libName, assemblyInSubdirectory, DllImportSearchPath.AssemblyDirectory)); + EXPECT(TryLoadLibraryAdvanced(libName, assemblyInSubdirectory, DllImportSearchPath.AssemblyDirectory)); + } + + if (OperatingSystem.IsWindows()) + { + string currentDirectory = Environment.CurrentDirectory; + try + { + Environment.CurrentDirectory = subdirectory; + + // Library should not be found in the assembly directory, but should fall back to the default OS search which includes CWD on Windows + EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory)); + EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.AssemblyDirectory)); + } + finally + { + Environment.CurrentDirectory = currentDirectory; + } + } + // ----------------------------------------------- // FreeLibrary Tests // ----------------------------------------------- diff --git a/src/tests/Interop/NativeLibrary/API/NativeLibraryTests.csproj b/src/tests/Interop/NativeLibrary/API/NativeLibraryTests.csproj index 51c156e0d9b9e6..47cfe35cd59ecb 100644 --- a/src/tests/Interop/NativeLibrary/API/NativeLibraryTests.csproj +++ b/src/tests/Interop/NativeLibrary/API/NativeLibraryTests.csproj @@ -16,4 +16,17 @@ + + + + $(OutDir)/subdirectory + -in-subdirectory + + + + + + + + diff --git a/src/tests/Interop/NativeLibrary/NativeLibraryToLoad/NativeLibraryToLoad.cs b/src/tests/Interop/NativeLibrary/NativeLibraryToLoad/NativeLibraryToLoad.cs index 4a61c599961f5a..efc878fd9fc520 100644 --- a/src/tests/Interop/NativeLibrary/NativeLibraryToLoad/NativeLibraryToLoad.cs +++ b/src/tests/Interop/NativeLibrary/NativeLibraryToLoad/NativeLibraryToLoad.cs @@ -27,8 +27,11 @@ public static string GetFileName() public static string GetFullPath() { - Assembly assembly = Assembly.GetExecutingAssembly(); - string directory = Path.GetDirectoryName(assembly.Location); - return Path.Combine(directory, GetFileName()); + return Path.Combine(GetDirectory(), GetFileName()); + } + + public static string GetDirectory() + { + return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } } diff --git a/src/tests/Interop/StructMarshalling/PInvoke/GameControllerButtonBind.cs b/src/tests/Interop/StructMarshalling/PInvoke/GameControllerButtonBind.cs new file mode 100644 index 00000000000000..a65994f2307a3f --- /dev/null +++ b/src/tests/Interop/StructMarshalling/PInvoke/GameControllerButtonBind.cs @@ -0,0 +1,63 @@ +// 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.Runtime.InteropServices; +using System.Runtime.CompilerServices; +using System.Text; + +public unsafe partial struct GameControllerButtonBind +{ + public GameControllerButtonBind + ( + GameControllerBindType? bindType = null, + GameControllerButtonBindValue? value = null + ) : this() + { + if (bindType is not null) + { + BindType = bindType.Value; + } + + if (value is not null) + { + Value = value.Value; + } + } + + public GameControllerBindType BindType; + + public GameControllerButtonBindValue Value; +} + +public enum GameControllerBindType : int +{ + ControllerBindtypeNone = 0x0, + ControllerBindtypeButton = 0x1, + ControllerBindtypeAxis = 0x2, + ControllerBindtypeHat = 0x3, + None = 0x0, + Button = 0x1, + Axis = 0x2, + Hat = 0x3, +} + +[StructLayout(LayoutKind.Explicit)] +public unsafe partial struct GameControllerButtonBindValue +{ + [FieldOffset(0)] + public int Button; + + [FieldOffset(0)] + public int Axis; + + [FieldOffset(0)] + public GameControllerButtonBindValueHat Hat; +} + +public unsafe partial struct GameControllerButtonBindValueHat +{ + public int Hat; + + public int HatMask; +} diff --git a/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.cpp b/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.cpp index 9278650d20dce8..e19eec7feb0737 100644 --- a/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.cpp +++ b/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.cpp @@ -1297,3 +1297,8 @@ extern "C" DLL_EXPORT Int32CLongStruct STDMETHODCALLTYPE AddCLongs(Int32CLongStr { return { lhs.i + rhs.i, lhs.l + rhs.l }; } + +extern "C" DLL_EXPORT SDL_GameControllerBindType STDMETHODCALLTYPE getBindType(SDL_GameControllerButtonBind button) +{ + return button.bindType; +} diff --git a/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h b/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h index 4a74572717890c..cb59b80bf09888 100644 --- a/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h +++ b/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h @@ -974,3 +974,26 @@ struct Int32CLongStruct int32_t i; long l; }; + +typedef enum +{ + SDL_CONTROLLER_BINDTYPE_NONE = 0, + SDL_CONTROLLER_BINDTYPE_BUTTON, + SDL_CONTROLLER_BINDTYPE_AXIS, + SDL_CONTROLLER_BINDTYPE_HAT +} SDL_GameControllerBindType; + +typedef struct SDL_GameControllerButtonBind +{ + SDL_GameControllerBindType bindType; + union + { + int button; + int axis; + struct { + int hat; + int hat_mask; + } hat; + } value; + +} SDL_GameControllerButtonBind; diff --git a/src/tests/Interop/StructMarshalling/PInvoke/NestedStruct.cs b/src/tests/Interop/StructMarshalling/PInvoke/NestedStruct.cs new file mode 100644 index 00000000000000..870e75bff62525 --- /dev/null +++ b/src/tests/Interop/StructMarshalling/PInvoke/NestedStruct.cs @@ -0,0 +1,27 @@ +// 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.Runtime.InteropServices; +using Xunit; + +public class Managed +{ + [DllImport("MarshalStructAsParam")] + static extern GameControllerBindType getBindType (GameControllerButtonBind button); + + public static int Main() + { + GameControllerButtonBind button = new GameControllerButtonBind(GameControllerBindType.ControllerBindtypeAxis, null); + if (getBindType(button) == GameControllerBindType.ControllerBindtypeAxis) + { + Console.WriteLine("\nTEST PASSED!"); + return 100; + } + else + { + Console.WriteLine("\nTEST FAILED!"); + return 1; + } + } +} diff --git a/src/tests/Interop/StructMarshalling/PInvoke/NestedStruct.csproj b/src/tests/Interop/StructMarshalling/PInvoke/NestedStruct.csproj new file mode 100644 index 00000000000000..1cfbdf526f377b --- /dev/null +++ b/src/tests/Interop/StructMarshalling/PInvoke/NestedStruct.csproj @@ -0,0 +1,14 @@ + + + exe + true + + + + + + + + + + diff --git a/src/tests/JIT/Directed/debugging/poison.cs b/src/tests/JIT/Directed/debugging/poison.cs index 463894a4e6a35d..81c669a8037282 100644 --- a/src/tests/JIT/Directed/debugging/poison.cs +++ b/src/tests/JIT/Directed/debugging/poison.cs @@ -19,6 +19,24 @@ public static unsafe int Main() WithoutGCRef poisoned2; Unsafe.SkipInit(out poisoned2); result &= VerifyPoison(&poisoned2, sizeof(WithoutGCRef)); + + Massive notPoisoned; + Unsafe.SkipInit(out notPoisoned); + // too large to be poisoned, just expose it but don't check return value + VerifyPoison(¬Poisoned, sizeof(Massive)); + + WithoutGCRef poisoned4; + Unsafe.SkipInit(out poisoned4); + result &= VerifyPoison(&poisoned4, sizeof(WithoutGCRef)); + + Massive notPoisoned2; + Unsafe.SkipInit(out notPoisoned2); + // too large to be poisoned, just expose it but don't check return value + VerifyPoison(¬Poisoned2, sizeof(Massive)); + + GCRef zeroed2; + Unsafe.SkipInit(out zeroed2); + result &= VerifyZero(Unsafe.AsPointer(ref zeroed2), Unsafe.SizeOf()); return result ? 100 : 101; } @@ -53,4 +71,9 @@ private struct WithoutGCRef public int ANumber; public float AFloat; } -} + + private unsafe struct Massive + { + public fixed byte Bytes[0x10008]; + } +} \ No newline at end of file diff --git a/src/tests/JIT/Directed/nullabletypes/gettype.cs b/src/tests/JIT/Directed/nullabletypes/gettype.cs new file mode 100644 index 00000000000000..15bbef729d26f9 --- /dev/null +++ b/src/tests/JIT/Directed/nullabletypes/gettype.cs @@ -0,0 +1,48 @@ +// 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.Linq; +using System.Collections.Generic; + +class C +{ + public IEnumerable Data { get; set; } + + public C() { } + + public bool Check() + { + return Data.ElementAt(0).GetType() == typeof(bool); + } +} + +public class P +{ + public static int Main() + { + C c = new(); + + // Try a nullable with value + c.Data = new List { true }; + if(!c.Check()) + return 666; + + // Try a nullable without value. Should throw NRE + c.Data = new List { new Nullable() }; + + bool thrown = false; + try + { + c.Check(); + } + catch(NullReferenceException) + { + thrown = true; + } + if(!thrown) + return 667; + return 100; + } +} + diff --git a/src/tests/JIT/Directed/nullabletypes/gettype_d.csproj b/src/tests/JIT/Directed/nullabletypes/gettype_d.csproj new file mode 100644 index 00000000000000..749b1f23c89758 --- /dev/null +++ b/src/tests/JIT/Directed/nullabletypes/gettype_d.csproj @@ -0,0 +1,13 @@ + + + Exe + 1 + + + Full + False + + + + + diff --git a/src/tests/JIT/Directed/nullabletypes/gettype_do.csproj b/src/tests/JIT/Directed/nullabletypes/gettype_do.csproj new file mode 100644 index 00000000000000..34744812c89277 --- /dev/null +++ b/src/tests/JIT/Directed/nullabletypes/gettype_do.csproj @@ -0,0 +1,13 @@ + + + Exe + 1 + + + Full + True + + + + + diff --git a/src/tests/JIT/Directed/nullabletypes/gettype_r.csproj b/src/tests/JIT/Directed/nullabletypes/gettype_r.csproj new file mode 100644 index 00000000000000..fea75d031b0ed3 --- /dev/null +++ b/src/tests/JIT/Directed/nullabletypes/gettype_r.csproj @@ -0,0 +1,13 @@ + + + Exe + 1 + + + None + False + + + + + diff --git a/src/tests/JIT/Directed/nullabletypes/gettype_ro.csproj b/src/tests/JIT/Directed/nullabletypes/gettype_ro.csproj new file mode 100644 index 00000000000000..f51b4298ce4d6e --- /dev/null +++ b/src/tests/JIT/Directed/nullabletypes/gettype_ro.csproj @@ -0,0 +1,13 @@ + + + Exe + 1 + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/GitHub_67102/GitHub_67102.cs b/src/tests/JIT/Regression/JitBlue/GitHub_67102/GitHub_67102.cs new file mode 100644 index 00000000000000..08af95ba02b7de --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/GitHub_67102/GitHub_67102.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// +// Note: In linux-arm, for double type variable, we assign pair of registers +// to an interval. During unassigning, if the current interval doesn't +// have any more reference, we would restore the register pair to the +// previously assigned interval. However, after that, we were again +// resetting the assignedInterval of single register out of the pair +// to `nullptr` thinking that we just need to unassign. This was not +// needed and because of that we would see mismatch in assigned +// interval for those two registers. +using System; + +public class Program_67102 +{ + public static int Main() + { + new Func(new OrientationBasedMeasures().MinorMajorSize)(1, 2); + return 100; + } +} + +internal enum ScrollOrientation +{ + Vertical, + Horizontal, +} + +internal class OrientationBasedMeasures +{ + public ScrollOrientation ScrollOrientation { get; set; } = ScrollOrientation.Vertical; + public Size MinorMajorSize(double minor, double major) + { + return ScrollOrientation == ScrollOrientation.Vertical ? + new Size(minor, major) : + new Size(major, minor); + } +} + +public record struct Size(double Width, double Height); \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/GitHub_67102/GitHub_67102.csproj b/src/tests/JIT/Regression/JitBlue/GitHub_67102/GitHub_67102.csproj new file mode 100644 index 00000000000000..32cb6ef8930aab --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/GitHub_67102/GitHub_67102.csproj @@ -0,0 +1,11 @@ + + + Exe + + + PdbOnly + + + + + \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/ImageSharp_2117/ImageSharp_2117.cs b/src/tests/JIT/Regression/JitBlue/ImageSharp_2117/ImageSharp_2117.cs new file mode 100644 index 00000000000000..b7c62091a0ea6e --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/ImageSharp_2117/ImageSharp_2117.cs @@ -0,0 +1,37 @@ +// 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.Intrinsics; +using System.Runtime.Intrinsics.X86; + +public unsafe class ImageSharp_2117 +{ + public static int Main(string[] args) + { + if (Sse.IsSupported) + { + Vector128 fnan = Vector128.Create(float.NaN); + Vector128 res1 = Sse.Max(Sse.LoadVector128((float*)(&fnan)), Vector128.Zero); + Vector128 res2 = Sse.Min(Sse.LoadVector128((float*)(&fnan)), Vector128.Zero); + + if (float.IsNaN(res1.GetElement(0)) || float.IsNaN(res2.GetElement(0))) + { + return 0; + } + } + + if (Sse2.IsSupported) + { + Vector128 dnan = Vector128.Create(double.NaN); + Vector128 res3 = Sse2.Max(Sse2.LoadVector128((double*)(&dnan)), Vector128.Zero); + Vector128 res4 = Sse2.Min(Sse2.LoadVector128((double*)(&dnan)), Vector128.Zero); + + if (double.IsNaN(res3.GetElement(0)) || double.IsNaN(res4.GetElement(0))) + { + return 0; + } + } + + return 100; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/ImageSharp_2117/ImageSharp_2117.csproj b/src/tests/JIT/Regression/JitBlue/ImageSharp_2117/ImageSharp_2117.csproj new file mode 100644 index 00000000000000..e7284d26ab2f18 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/ImageSharp_2117/ImageSharp_2117.csproj @@ -0,0 +1,13 @@ + + + Exe + True + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_53549/Runtime_53549_1.cs b/src/tests/JIT/Regression/JitBlue/Runtime_53549/Runtime_53549_1.cs new file mode 100644 index 00000000000000..07d1d397fe532c --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_53549/Runtime_53549_1.cs @@ -0,0 +1,72 @@ +// 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.Globalization; +using System.Threading; +using System.Runtime.CompilerServices; + +class A +{ + public static string I(FormattableString formattable) + { + return FormattableString.Invariant(formattable); + } + + public virtual decimal X => d; + public decimal D => X; + public decimal P => p; + public string S => "S"; + public decimal d; + public decimal p; + + // This method would produce improper code with GDV + [MethodImpl(MethodImplOptions.NoInlining)] + public override string ToString() => I($"{S} {D} {P}"); +} + +class B : A +{ + public override decimal X => d + 1; +} + +class Repro +{ + static string s; + + [MethodImpl(MethodImplOptions.NoInlining)] + public static int F(A[] a) + { + int i = 0; + for (; i < a.Length; i++) + { + s = a[i].ToString(); + } + + return i; + } + + public static int Main() + { + A[] a = new A[1000]; + + for (int i = 0; i < a.Length; i++) + { + a[i] = new B(); + } + + for (int j = 0; j < 50; j++) + { + F(a); + Thread.Sleep(15); + } + + Thread.Sleep(100); + + int r = F(a); + + Console.WriteLine($"Result is {s} after {r} iterations\n"); + + return r / 10; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_53549/Runtime_53549_1.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_53549/Runtime_53549_1.csproj new file mode 100644 index 00000000000000..9a3423ff0d39b1 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_53549/Runtime_53549_1.csproj @@ -0,0 +1,24 @@ + + + Exe + + + None + True + + + + + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_54102/Runtime_54102.cs b/src/tests/JIT/Regression/JitBlue/Runtime_54102/Runtime_54102.cs new file mode 100644 index 00000000000000..8afef4323c2fbd --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_54102/Runtime_54102.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.Runtime.CompilerServices; + +// Generated by Fuzzlyn v1.1 on 2021-06-12 11:06:35 +// Seed: 8276490119048877745 +// Reduced from 962.5 KiB to 0.6 KiB in 00:05:32 +// Debug: Outputs 0 +// Release: Outputs 1 + +struct S0 +{ + public ushort F1; + public uint F2; + public byte F3; + public int F5; + public S0(byte f3): this() + { + F3 = f3; + } +} + +struct S1 +{ + public S0 F0; + public S0 F4; + public S1(S0 f0): this() + { + F0 = f0; + } +} + +struct S2 +{ + public S1 F0; + public S2(S1 f0): this() + { + F0 = f0; + } +} + +public class Program +{ + public static int Main() + { + S2 vr0 = new S2(new S1(new S0(100))); + int ret = vr0.F0.F0.F3 + vr0.F0.F4.F1; + return ret; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_54102/Runtime_54102.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_54102/Runtime_54102.csproj new file mode 100644 index 00000000000000..f3e1cbd44b4041 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_54102/Runtime_54102.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_56980/Runtime_56980.cs b/src/tests/JIT/Regression/JitBlue/Runtime_56980/Runtime_56980.cs new file mode 100644 index 00000000000000..1ff1c7611e84fc --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_56980/Runtime_56980.cs @@ -0,0 +1,61 @@ +// 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.Runtime.CompilerServices; + +// Generated by Fuzzlyn v1.2 on 2021-07-06 09:46:44 +// Seed: 16635934940619066544 +// Reduced from 447.5 KiB to 0.6 KiB in 00:02:24 +// Debug: Runs successfully +// Release: Throws 'System.NullReferenceException' +struct S0 +{ + public uint F1; + public byte F3; + public long F4; + public uint F5; + public S0(long f4): this() + { + F4 = f4; + } +} + +class C0 +{ + public S0 F4; +} + +struct S1 +{ + public C0 F2; + public S0 F8; + public S1(C0 f2, S0 f8): this() + { + F2 = f2; + F8 = f8; + } +} + +struct S2 +{ + public S1 F0; + public S2(S1 f0): this() + { + F0 = f0; + } +} + +public class Program +{ + public static int Main() + { + S2 vr0 = new S2(new S1(new C0(), new S0(0))); + M17(ref vr0.F0.F2.F4.F1); + return 100; + } + + static void M17(ref uint arg2) + { + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_56980/Runtime_56980.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_56980/Runtime_56980.csproj new file mode 100644 index 00000000000000..f3e1cbd44b4041 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_56980/Runtime_56980.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_1.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_1.cs new file mode 100644 index 00000000000000..9a13f069e29069 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_1.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Generated by Fuzzlyn v1.2 on 2021-08-16 12:59:38 +// Run on .NET 6.0.0-dev on X64 Windows +// Seed: 9053537220764489964 +// Reduced from 104.8 KiB to 0.8 KiB in 00:00:44 +// Debug: Outputs 1, 0 +// Release: Outputs 1, 1 +struct S0 +{ + public short F1; + public ushort F4; + public S0(short f1) : this() + { + F1 = f1; + } +} + +struct S1 +{ + public S0 F0; + public S1(S0 f0) : this() + { + F0 = f0; + } +} + +struct S2 +{ + public S1 F1; + public S0 F2; + public S2(S1 f1) : this() + { + F1 = f1; + } +} + +struct S3 +{ + public S2 F0; + public S3(S2 f0) : this() + { + F0 = f0; + } +} + +struct S4 +{ + public sbyte F4; + public S3 F5; + public S4(S3 f5) : this() + { + F5 = f5; + } +} + +public class Program +{ + public static int Test() + { + S4 vr0 = new S4(new S3(new S2(new S1(new S0(1))))); + System.Console.WriteLine(vr0.F5.F0.F1.F0.F1); + System.Console.WriteLine(vr0.F5.F0.F1.F0.F4); + return vr0.F5.F0.F1.F0.F1 + vr0.F5.F0.F1.F0.F4; + } + + public static int Main() + { + if (Test() == 1) + { + return 100; + } + return 101; + + } + +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_1.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_1.csproj new file mode 100644 index 00000000000000..f3e1cbd44b4041 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_1.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_2.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_2.cs new file mode 100644 index 00000000000000..fc78551f5c6779 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_2.cs @@ -0,0 +1,73 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Generated by Fuzzlyn v1.2 on 2021-08-16 12:56:37 +// Run on .NET 6.0.0-dev on X64 Windows +// Seed: 10782465293682251646 +// Reduced from 129.7 KiB to 0.8 KiB in 00:01:40 +// Debug: Outputs 0 +// Release: Outputs 1 +struct S0 +{ + public short F0; + public short F1; + public int F2; + public short F3; + public short F4; + public S0(short f4) : this() + { + F4 = f4; + } +} + +struct S1 +{ + public S0 F0; + public int F3; + public S1(S0 f0) : this() + { + F0 = f0; + } +} + +struct S3 +{ + public S1 F0; + public S3(S1 f0) : this() + { + F0 = f0; + } +} + +struct S4 +{ + public ushort F3; + public S3 F4; + public S4(S3 f4) : this() + { + F4 = f4; + } +} + +public class Program +{ + static S0[] s_9 = new S0[] { new S0(0) }; + + public static int Test() + { + S0 vr4 = default(S0); + S4 vr5 = new S4(new S3(new S1(new S0(1)))); + s_9[0].F4 = vr5.F4.F0.F0.F4; + System.Console.WriteLine(vr4.F1); + return vr4.F1; + } + + public static int Main() + { + if (Test() == 0) + { + return 100; + } + return 101; + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_2.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_2.csproj new file mode 100644 index 00000000000000..f3e1cbd44b4041 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57282/Runtime_57282_2.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.cs new file mode 100644 index 00000000000000..1af66647dff377 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.cs @@ -0,0 +1,28 @@ +using System; +using System.Runtime.CompilerServices; + +class Runtime_57535 +{ + static long z; + + public static int Main() + { + z = 10; + int[] a = F(); + long zz = z; + int result = 0; + for (int i = 0; i < (int) zz; i++) + { + result += a[i]; + } + return result; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static int[] F() + { + int[] result = new int[100]; + result[3] = 100; + return result; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.csproj new file mode 100644 index 00000000000000..f3e1cbd44b4041 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.cs new file mode 100644 index 00000000000000..83040ad93efcaf --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.cs @@ -0,0 +1,31 @@ +using System; +using System.Runtime.CompilerServices; + +class Runtime_57535_1 +{ + static long z; + + public static int Main() + { + z = 2; + int[] a = F(); + long zz = z; + int result = 0; + for (int i = (int) zz; i < a.Length; i++) + { + result += a[i]; + } + Bar(zz); + return result; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static int[] F() + { + int[] result = new int[100]; + result[3] = 100; + return result; + } + + static void Bar(long z) {} +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.csproj new file mode 100644 index 00000000000000..f3e1cbd44b4041 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57535/Runtime_57535_1.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.cs new file mode 100644 index 00000000000000..906780463e8a2f --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Generated by Fuzzlyn v1.2 on 2021-08-15 23:15:19 +// Run on .NET 6.0.0-dev on Arm Linux +// Seed: 18219619158927602726 +// Reduced from 82.6 KiB to 0.3 KiB in 00:02:54 +// Debug: Outputs 14270 +// Release: Outputs 4294953026 +public class Runtime_57640 +{ + static long[] s_28 = new long[]{1}; + public static int Main() + { + bool correct = true; + var vr10 = s_28[0]; + for (int vr13 = 0; vr13 < 2; vr13++) + { + uint vr12 = (uint)(0 - (-14270 * vr10)); + correct &= vr12 == 14270; + } + + return correct ? 100 : -1; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.csproj new file mode 100644 index 00000000000000..f3e1cbd44b4041 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57640/Runtime_57640.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57912/Runtime_57912.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57912/Runtime_57912.cs new file mode 100644 index 00000000000000..620b598306619f --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57912/Runtime_57912.cs @@ -0,0 +1,43 @@ +// 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[StructLayout(LayoutKind.Sequential)] +internal struct AA +{ + public short tmp1; + public short q; + + public ushort tmp2; + public int tmp3; + + public AA(short qq) + { + tmp1 = 106; + tmp2 = 107; + tmp3 = 108; + q = qq; + } + + // The test verifies that we accurately update the byref variable that is a field of struct. + public static short call_target_ref(ref short arg) { arg = 100; return arg; } +} + + +public class Runtime_57912 +{ + + public static int Main() + { + return (int)test_0_17(100, new AA(100), new AA(0)); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static short test_0_17(int num, AA init, AA zero) + { + return AA.call_target_ref(ref init.q); + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57912/Runtime_57912.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57912/Runtime_57912.csproj new file mode 100644 index 00000000000000..edc51be9ca25b2 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57912/Runtime_57912.csproj @@ -0,0 +1,10 @@ + + + Exe + True + None + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57914/Runtime_57914.cs b/src/tests/JIT/Regression/JitBlue/Runtime_57914/Runtime_57914.cs new file mode 100644 index 00000000000000..f11dc7d8302077 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57914/Runtime_57914.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.Runtime.CompilerServices; + +public class Program +{ + public static int Main() + { + return (Test1() && Test2()) ? 100 : 101; + } + + private static bool Test1() + { + byte[] array = new byte[2]; + array[0] = 1; + array[1] = 2; + + // a1, a2 and a3 all have different values here + byte a1 = Unsafe.ReadUnaligned(ref array[0]); + short a2 = Unsafe.ReadUnaligned(ref array[0]); + array[1] = 42; + short a3 = Unsafe.ReadUnaligned(ref array[0]); + + return a1 != a2 && a1 != a3 && a2 != a3; + } + + private static bool Test2() + { + bool result = true; + byte[] buffer = new byte[4]; + buffer[0] = 0x1; + buffer[1] = 0x2; + buffer[2] = 0x3; + buffer[3] = 0x4; + + if (buffer.Length > 0) + { + int n = Unsafe.ReadUnaligned(ref buffer[0]); + if (n != 0x4030201) + result = false; + Consume(n); + } + return result; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static void Consume(int n) {} +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_57914/Runtime_57914.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_57914/Runtime_57914.csproj new file mode 100644 index 00000000000000..f3e1cbd44b4041 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_57914/Runtime_57914.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58259/Runtime_58259.cs b/src/tests/JIT/Regression/JitBlue/Runtime_58259/Runtime_58259.cs new file mode 100644 index 00000000000000..7e49a3c9208310 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58259/Runtime_58259.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +public unsafe class Runtime_58259 +{ + public static int Main() + { + M(out _); + return 100; + } + + static delegate* unmanaged _f; + + public static void M(out int index) + { + if (_f != null) + { + _f(out index); + _f(out index); + } + else + { + index = 0; + } + } +} + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58259/Runtime_58259.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_58259/Runtime_58259.csproj new file mode 100644 index 00000000000000..d1dc80557b728c --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58259/Runtime_58259.csproj @@ -0,0 +1,14 @@ + + + Exe + True + 1 + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_1.cs b/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_1.cs new file mode 100644 index 00000000000000..76a46072e556d2 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_1.cs @@ -0,0 +1,29 @@ +// 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.Runtime.CompilerServices; + +public unsafe class Runtime_58373 +{ + public static int Main() + { + short halfValue = HalfToInt16Bits(MakeHalf()); + int x = halfValue; + short val2 = HalfToInt16Bits(*(Half*)&x); + + return halfValue == val2 ? 100 : -1; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static Half MakeHalf() + { + return (Half)(-1.0f); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static short HalfToInt16Bits(Half h) + { + return *(short*)&h; + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_1.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_1.csproj new file mode 100644 index 00000000000000..1a1d3eadae5ce4 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_1.csproj @@ -0,0 +1,13 @@ + + + Exe + + + None + True + True + + + + + \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_2.cs b/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_2.cs new file mode 100644 index 00000000000000..c8d1286c1ba7b2 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_2.cs @@ -0,0 +1,47 @@ +// 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.Runtime.CompilerServices; + +public unsafe class Runtime_58373 +{ + public static int Main() + { + // Use up a lot of registers + int a = GetVal(); + int b = GetVal(); + int c = GetVal(); + int d = GetVal(); + int e = GetVal(); + int f = GetVal(); + int g = GetVal(); + int h = GetVal(); + int i = GetVal(); + + short val1 = HalfToInt16Bits(MakeHalf()); + Half half = MakeHalf(); + MakeHalf(); // This will spill lower 16 bits of 'half' to memory + short val2 = HalfToInt16Bits(half); // This will pass 32 bits as arg with upper 16 bits undefined + + return val1 == val2 ? 100 + a + b + c + d + e + f + g + h + i : -1; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static int GetVal() + { + return 0; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static Half MakeHalf() + { + return default; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static short HalfToInt16Bits(Half h) + { + return *(short*)&h; + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_2.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_2.csproj new file mode 100644 index 00000000000000..1a1d3eadae5ce4 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58373/Runtime_58373_2.csproj @@ -0,0 +1,13 @@ + + + Exe + + + None + True + True + + + + + \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58832/Runtime_58832.cs b/src/tests/JIT/Regression/JitBlue/Runtime_58832/Runtime_58832.cs new file mode 100644 index 00000000000000..9acd698ca4c13c --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58832/Runtime_58832.cs @@ -0,0 +1,30 @@ +// 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.Runtime.CompilerServices; + +public class Runtime_58832 +{ + public static int Main() + { + try + { + Test(double.MaxValue); + } + catch (OverflowException) + { + return 100; + } + return 101; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static void Test(double x) + { + try { Console.WriteLine(checked((ulong)x)); } catch { } + + if ((ulong)x == checked((ulong)x)) + Console.WriteLine("Should not be invoked"); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58832/Runtime_58832.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_58832/Runtime_58832.csproj new file mode 100644 index 00000000000000..1100f420532dc8 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58832/Runtime_58832.csproj @@ -0,0 +1,10 @@ + + + Exe + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58874/Runtime_58874.cs b/src/tests/JIT/Regression/JitBlue/Runtime_58874/Runtime_58874.cs new file mode 100644 index 00000000000000..f1f7207b3c6c64 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58874/Runtime_58874.cs @@ -0,0 +1,97 @@ +// 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +public unsafe class Runtime_58874 +{ + private static int Main(string[] args) + { + using EndOfPage endOfPage = EndOfPage.Create(); + if (endOfPage != null) + { + Foo(endOfPage.Pointer); + } + return 100; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static Test Foo(Test* t) + { + // This read was too wide. + return *t; + } + + private class EndOfPage : IDisposable + { + private void* _addr; + private EndOfPage() + { + } + + public Test* Pointer => (Test*)((byte*)_addr + 0x1000 - sizeof(Test)); + public void Dispose() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + const int MEM_RELEASE = 0x8000; + VirtualFree(_addr, 0, MEM_RELEASE); + } + else + { + NativeMemory.Free(_addr); + } + } + + public static EndOfPage Create() + { + void* mem; + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + const int MEM_COMMIT = 0x1000; + const int MEM_RESERVE = 0x2000; + const int PAGE_READWRITE = 0x04; + + // Reserve 2 pages + void* pages = VirtualAlloc(null, 0x2000, MEM_RESERVE, PAGE_READWRITE); + if (pages == null) + { + return null; + } + // Commit first page + mem = VirtualAlloc(pages, 0x1000, MEM_COMMIT, PAGE_READWRITE); + if (mem != pages) + { + return null; + } + } + else + { + try + { + mem = NativeMemory.Alloc(0x1000); + } + catch (OutOfMemoryException) + { + return null; + } + } + + return new EndOfPage { _addr = mem }; + } + + [DllImport("kernel32")] + private static extern void* VirtualAlloc(void* lpAddress, nuint dwSize, uint flAllocationType, uint flProtect); + + [DllImport("kernel32")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool VirtualFree(void* lpAddress, nuint dwSize, uint dwFreeType); + } +} + +struct Test +{ + public byte A, B; +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58874/Runtime_58874.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_58874/Runtime_58874.csproj new file mode 100644 index 00000000000000..8c7132fd350c9d --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58874/Runtime_58874.csproj @@ -0,0 +1,10 @@ + + + Exe + True + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58972/Runtime_58972.cs b/src/tests/JIT/Regression/JitBlue/Runtime_58972/Runtime_58972.cs new file mode 100644 index 00000000000000..b63c1d907f14c1 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58972/Runtime_58972.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; + +public class Runtime_58972 +{ + public static int Main() + { + GetItem(new MyStruct[1], 0); + return 100; + } + + // This code results in a struct returned in register where we replace the local + // of type MyStruct by its only field, and where that field cannot be enregistered. + // We would potentially miss normalization if the struct was returned as an integer + // type and hit a defensive assertion because of it. + static MyStruct GetItem(MyStruct[] a, int i) + { + try + { + return a[i]; + } + catch (IndexOutOfRangeException) + { + ThrowHelper(); + return default; + } + } + + static void ThrowHelper() => throw new Exception(); + + struct MyStruct + { + byte b; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_58972/Runtime_58972.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_58972/Runtime_58972.csproj new file mode 100644 index 00000000000000..f3e1cbd44b4041 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_58972/Runtime_58972.csproj @@ -0,0 +1,12 @@ + + + Exe + + + None + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_61359/Runtime_61359.cs b/src/tests/JIT/Regression/JitBlue/Runtime_61359/Runtime_61359.cs new file mode 100644 index 00000000000000..6a38a4cf157de6 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_61359/Runtime_61359.cs @@ -0,0 +1,19 @@ +// 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.Runtime.CompilerServices; + +public unsafe class Runtime_61359 +{ + public static int Main() + { + return HalfToInt16Bits((Half)(-1)) == -17408 ? 100 : -1; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static short HalfToInt16Bits(Half h) + { + return *(short*)&h; + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_61359/Runtime_61359.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_61359/Runtime_61359.csproj new file mode 100644 index 00000000000000..1a1d3eadae5ce4 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_61359/Runtime_61359.csproj @@ -0,0 +1,13 @@ + + + Exe + + + None + True + True + + + + + \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_61486/Runtime_61486.cs b/src/tests/JIT/Regression/JitBlue/Runtime_61486/Runtime_61486.cs new file mode 100644 index 00000000000000..3285ee9cc556a9 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_61486/Runtime_61486.cs @@ -0,0 +1,45 @@ +// 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.Reflection; +using System.Runtime.CompilerServices; + +public class Runtime_61486 +{ + public static int Main() + { + var my = new My(new My(null)); + var m = my.GetType().GetMethod("M"); + try + { + m.Invoke(my, null); + return -1; + } + catch (TargetInvocationException ex) when (ex.InnerException is NullReferenceException) + { + return 100; + } + } + + public interface IFace + { + void M(); + } + + public class My : IFace + { + private IFace _face; + + public My(IFace face) + { + _face = face; + } + + // We cannot handle a null ref inside a VSD if the caller is not + // managed frame. This test is verifying that JIT null checks ahead of + // time in this case. + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + public void M() => _face.M(); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_61486/Runtime_61486.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_61486/Runtime_61486.csproj new file mode 100644 index 00000000000000..6946bed81bfd5b --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_61486/Runtime_61486.csproj @@ -0,0 +1,9 @@ + + + Exe + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_62597/Runtime_62597.cs b/src/tests/JIT/Regression/JitBlue/Runtime_62597/Runtime_62597.cs new file mode 100644 index 00000000000000..fb3ccef4ade51b --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_62597/Runtime_62597.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// +// Note: In below test case, we were not honoring the fact that the explicit struct size +// of struct is 32 bytes while the only 2 fields it has is just 2 bytes. In such case, +// we would pass partial struct value. +using System; +using System.Reflection.Emit; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; + +[StructLayout(LayoutKind.Explicit, Size = 32)] +public readonly unsafe struct SmallString +{ + [FieldOffset(0)] private readonly byte _length; + [FieldOffset(1)] private readonly byte _firstByte; + + public SmallString(string value) + { + fixed (char* srcPtr = value) + fixed (byte* destPtr = &_firstByte) + { + Encoding.ASCII.GetBytes(srcPtr, value.Length, destPtr, value.Length); + } + + _length = (byte)value.Length; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public byte Dump() + { + fixed (byte* ptr = &_firstByte) + { + byte* next = ptr + 1; + return *next; + } + } +} + +public static class Program +{ + static int result = 0; + public static int Main() + { + var value = new SmallString("foobar"); + + TheTest(value); + + return result; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void TheTest(SmallString foo) + { + Execute(foo); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static object Execute(SmallString foo) + { + byte value = foo.Dump(); + // 111 corresponds to the ASCII code of 2nd characted of string "foobar" i.e. ASCII value of 'o'. + if (value == 111) + { + result = 100; + } + return new StringBuilder(); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_62597/Runtime_62597.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_62597/Runtime_62597.csproj new file mode 100644 index 00000000000000..e822a8b10a5a6f --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_62597/Runtime_62597.csproj @@ -0,0 +1,13 @@ + + + Exe + True + + + None + True + + + + + \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_65694/Runtime_65694.cs b/src/tests/JIT/Regression/JitBlue/Runtime_65694/Runtime_65694.cs new file mode 100644 index 00000000000000..1dae258e5273c0 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_65694/Runtime_65694.cs @@ -0,0 +1,73 @@ +// 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.Runtime.CompilerServices; + +public struct Key +{ + public int a; + public string s; +} + +public struct Problem +{ + public int x; + public double d; + public string s0; + public int y; + public double e; + public string s1; +} + +public class Runtime_65694 +{ + public Dictionary _d; + + [MethodImpl(MethodImplOptions.NoInlining)] + public void D() + { + Problem p = new Problem { s0 = "hello", s1 = "world", x = 33 }; + Key k = new Key() { a = 0, s = "a" }; + Dictionary d = new Dictionary(); + d[k] = p; + + _d = d; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void F() + { + GC.Collect(); + } + + [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)] + public int G(Key k, bool b) + { + Problem p = default; + + F(); + + if (b) + { + if (_d?.TryGetValue(k, out p) == true && (p.x == 33)) + { + return 22; + } + } + + return 0; + } + + public static int Main() + { + var r = new Runtime_65694(); + r.D(); + int result = 0; + Key k = new Key() { a = 0, s = "a" }; + result += r.G(k, true); + return result + 78; + } +} + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_65694/Runtime_65694.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_65694/Runtime_65694.csproj new file mode 100644 index 00000000000000..f492aeac9d056b --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_65694/Runtime_65694.csproj @@ -0,0 +1,9 @@ + + + Exe + True + + + + + \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_66254/Runtime_66254.cs b/src/tests/JIT/Regression/JitBlue/Runtime_66254/Runtime_66254.cs new file mode 100644 index 00000000000000..20a2506dd9d78e --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_66254/Runtime_66254.cs @@ -0,0 +1,104 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Test that loop cloning won't consider a[i].struct_field[j] to be +// a jagged array a[i][j]. + +using System; + +public class Runtime_66254 +{ + public static void t1() + { + var a = new ValueTuple[] + { + new (new[] { 0 }, 1), + new (new[] { 2 }, 3) + }; + + for (var i1 = 0; i1 < a.Length; i1++) + { + for (var i2 = 0; i2 < a[i1].Item1.Length; i2++) + { + var elem = a[i1].Item1[i2]; + Console.WriteLine(elem); + } + } + } + + public static void t2() + { + var a = new ValueTuple[] + { + new (new[] { 0 }, 1), + new (new[] { 2 }, 3) + }; + + for (var i1 = 0; i1 < a.Length; i1++) + { + var length = a[i1].Item1.Length; + for (var i2 = 0; i2 < length; i2++) + { + var elem = a[i1].Item1[i2]; + Console.WriteLine(elem); + } + } + } + + public static void t3() + { + var a = new ValueTuple[] + { + new (1, new[] { 2 }), + new (3, new[] { 4 }) + }; + + for (var i1 = 0; i1 < a.Length; i1++) + { + var length = a[i1].Item2.Length; + for (var i2 = 0; i2 < length; i2++) + { + var elem = a[i1].Item2[i2]; + Console.WriteLine(elem); + } + } + } + + public static int Main() + { + int result = 100; + + try + { + t1(); + } + catch (Exception e) + { + Console.WriteLine($"t1 failed: {e}"); + result = 101; + } + + try + { + t2(); + } + catch (Exception e) + { + Console.WriteLine($"t2 failed: {e}"); + result = 101; + } + + try + { + t3(); + } + catch (Exception e) + { + Console.WriteLine($"t3 failed: {e}"); + result = 101; + } + + Console.WriteLine((result == 100) ? "PASS" : "FAIL"); + return result; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_66254/Runtime_66254.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_66254/Runtime_66254.csproj new file mode 100644 index 00000000000000..e1f15f64fb4085 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_66254/Runtime_66254.csproj @@ -0,0 +1,10 @@ + + + Exe + True + 1 + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_66720/Runtime_66720.cs b/src/tests/JIT/Regression/JitBlue/Runtime_66720/Runtime_66720.cs new file mode 100644 index 00000000000000..77303e01a8f8c3 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_66720/Runtime_66720.cs @@ -0,0 +1,29 @@ +// 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.CompilerServices; + +public class Runtime_66720 +{ + public static int Main() + { + return Test(0); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static int Test(in short zero) + { + // Fill arg stack slot with all ones + LastArg(0, 0, 0, 0, 0, 0, 0, 0, -1); + // Bug was that the last arg passed here would write only 16 bits + // instead of 32 bits + int last = LastArg(0, 0, 0, 0, 0, 0, 0, 0, zero); + return last == 0 ? 100 : -1; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static int LastArg(int a, int b, int c, int d, int e, int f, int g, int h, int i) + { + return i; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_66720/Runtime_66720.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_66720/Runtime_66720.csproj new file mode 100644 index 00000000000000..f492aeac9d056b --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_66720/Runtime_66720.csproj @@ -0,0 +1,9 @@ + + + Exe + True + + + + + \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_71592/test71592.cs b/src/tests/JIT/Regression/JitBlue/Runtime_71592/test71592.cs new file mode 100644 index 00000000000000..21912e06ce8810 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_71592/test71592.cs @@ -0,0 +1,33 @@ +// 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.Threading.Tasks; + +public class Test +{ + public int foo; + + public override bool Equals(object o) => false; + public override int GetHashCode() => 0; + + public static bool operator ==(Test t1, Test t2) { + if (ReferenceEquals(t1, t1)) + return true; + return t1.foo == t2.foo; + } + + public static bool operator !=(Test t1, Test t2) { + if (ReferenceEquals(t1, t1)) + return true; + return t1.foo == t2.foo; + } + + public static int Main () { + var t1 = new Test () { foo = 1 }; + var t2 = new Test () { foo = 2 }; + if (t1 == t2) + return 100; + return 100; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_71592/test71592.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_71592/test71592.csproj new file mode 100644 index 00000000000000..4ccbe30ff30925 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_71592/test71592.csproj @@ -0,0 +1,9 @@ + + + Exe + 0 + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_72775/Runtime_72775.cs b/src/tests/JIT/Regression/JitBlue/Runtime_72775/Runtime_72775.cs new file mode 100644 index 00000000000000..a53cb3bb0d4947 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_72775/Runtime_72775.cs @@ -0,0 +1,53 @@ +// 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.Runtime.CompilerServices; +using System.Threading; + +public class Runtime_72775 +{ + public static int Main() + { + for (int i = 0; i < 100; i++) + { + Call(new Impl1()); + if (i > 30 && i < 40) + Thread.Sleep(10); + } + + // With GDV, JIT would optimize Call by fully removing the box since Impl1.Foo does not use it. + // This would cause null to be passed to Impl2.Foo. + return Call(new Impl2()); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static int Call(I i) => i.Foo(5); +} + +public interface I +{ + int Foo(object o); +} + +class Impl1 : I +{ + public int Foo(object o) => 0; +} + +class Impl2 : I +{ + public int Foo(object o) + { + if (o is not int i || i != 5) + { + Console.WriteLine("FAIL: Got {0}", o?.ToString() ?? "(null)"); + return -1; + } + else + { + Console.WriteLine("PASS: Got 5"); + return 100; + } + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_72775/Runtime_72775.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_72775/Runtime_72775.csproj new file mode 100644 index 00000000000000..db201bf0c84dcb --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_72775/Runtime_72775.csproj @@ -0,0 +1,21 @@ + + + Exe + True + + + + + + + + + \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.cs b/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.cs new file mode 100644 index 00000000000000..8114d964526fc0 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.cs @@ -0,0 +1,45 @@ +// 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.Reflection; + +public interface IGetContents { + (string, int, string) GetContents(); +} + +public struct MyStruct : IGetContents { + public string s1; + public int a; + public string s2; + + public (string, int, string) GetContents() + { + return (s1, a, s2); + } +} + +public class Program { + + public delegate (string, int, string) MyDelegate(IGetContents arg); + + public static int Main(string[] args) + { + MyStruct str = new MyStruct(); + str.s1 = "test1"; + str.a = 42; + str.s2 = "test2"; + + MethodInfo mi = typeof(IGetContents).GetMethod("GetContents"); + MyDelegate func = (MyDelegate)mi.CreateDelegate(typeof(MyDelegate)); + + (string c1, int c2, string c3) = func(str); + if (c1 != "test1") + return 1; + if (c2 != 42) + return 2; + if (c3 != "test2") + return 3; + return 100; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.csproj new file mode 100644 index 00000000000000..75e7d24ec6fd6d --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.csproj @@ -0,0 +1,9 @@ + + + Exe + True + + + + + diff --git a/src/tests/JIT/opt/Structs/structcopies.cs b/src/tests/JIT/opt/Structs/structcopies.cs index e1331e38f00614..61d8a6f424f0f1 100644 --- a/src/tests/JIT/opt/Structs/structcopies.cs +++ b/src/tests/JIT/opt/Structs/structcopies.cs @@ -36,7 +36,7 @@ struct S4W struct S4WW { - public S4W s4; + public S4W s4W; } struct S4Copy @@ -142,18 +142,18 @@ static int TestS4_WW1() { S4 s1 = new S4(); S4WW s2 = new S4WW(); - s2.s4.s4.i = 1; + s2.s4W.s4.i = 1; if (s1.i != 0) { return 101; } - s1 = s2.s4.s4; - s2.s4.s4.i = 2; + s1 = s2.s4W.s4; + s2.s4W.s4.i = 2; if (s1.i != 1) { return 101; } - if (s2.s4.s4.i != 2) + if (s2.s4W.s4.i != 2) { return 101; } @@ -166,13 +166,13 @@ static int TestS4_WW2() S4WW s1 = new S4WW(); S4 s2 = new S4(); s2.i = 1; - if (s1.s4.s4.i != 0) + if (s1.s4W.s4.i != 0) { return 101; } - s1.s4.s4 = s2; + s1.s4W.s4 = s2; s2.i = 2; - if (s1.s4.s4.i != 1) + if (s1.s4W.s4.i != 1) { return 101; } @@ -462,7 +462,7 @@ struct S8W struct S8WW { - public S8W s8; + public S8W s8W; } struct S8Copy @@ -605,8 +605,8 @@ static int TestS8_WW1() { S8 s1 = new S8(); S8WW s2 = new S8WW(); - s2.s8.s8.i1 = 1; - s2.s8.s8.i2 = 2; + s2.s8W.s8.i1 = 1; + s2.s8W.s8.i2 = 2; if (s1.i1 != 0) { return 101; @@ -615,9 +615,9 @@ static int TestS8_WW1() { return 101; } - s1 = s2.s8.s8; - s2.s8.s8.i1 = 3; - s2.s8.s8.i2 = 4; + s1 = s2.s8W.s8; + s2.s8W.s8.i1 = 3; + s2.s8W.s8.i2 = 4; if (s1.i1 != 1) { return 101; @@ -626,11 +626,11 @@ static int TestS8_WW1() { return 101; } - if (s2.s8.s8.i1 != 3) + if (s2.s8W.s8.i1 != 3) { return 101; } - if (s2.s8.s8.i2 != 4) + if (s2.s8W.s8.i2 != 4) { return 101; } @@ -644,22 +644,22 @@ static int TestS8_WW2() S8 s2 = new S8(); s2.i1 = 1; s2.i2 = 2; - if (s1.s8.s8.i1 != 0) + if (s1.s8W.s8.i1 != 0) { return 101; } - if (s1.s8.s8.i2 != 0) + if (s1.s8W.s8.i2 != 0) { return 101; } - s1.s8.s8 = s2; + s1.s8W.s8 = s2; s2.i1 = 3; s2.i2 = 4; - if (s1.s8.s8.i1 != 1) + if (s1.s8W.s8.i1 != 1) { return 101; } - if (s1.s8.s8.i2 != 2) + if (s1.s8W.s8.i2 != 2) { return 101; } @@ -989,7 +989,7 @@ struct S16W struct S16WW { - public S16W s16; + public S16W s16W; } struct S16Copy @@ -1215,10 +1215,10 @@ static int TestS16_WW1() { S16 s1 = new S16(); S16WW s2 = new S16WW(); - s2.s16.s16.i1 = 1; - s2.s16.s16.i2 = 2; - s2.s16.s16.i3 = 3; - s2.s16.s16.i4 = 4; + s2.s16W.s16.i1 = 1; + s2.s16W.s16.i2 = 2; + s2.s16W.s16.i3 = 3; + s2.s16W.s16.i4 = 4; if (s1.i1 != 0) { return 101; @@ -1235,11 +1235,11 @@ static int TestS16_WW1() { return 101; } - s1 = s2.s16.s16; - s2.s16.s16.i1 = 5; - s2.s16.s16.i2 = 6; - s2.s16.s16.i3 = 7; - s2.s16.s16.i4 = 8; + s1 = s2.s16W.s16; + s2.s16W.s16.i1 = 5; + s2.s16W.s16.i2 = 6; + s2.s16W.s16.i3 = 7; + s2.s16W.s16.i4 = 8; if (s1.i1 != 1) { @@ -1258,19 +1258,19 @@ static int TestS16_WW1() return 101; } - if (s2.s16.s16.i1 != 5) + if (s2.s16W.s16.i1 != 5) { return 101; } - if (s2.s16.s16.i2 != 6) + if (s2.s16W.s16.i2 != 6) { return 101; } - if (s2.s16.s16.i3 != 7) + if (s2.s16W.s16.i3 != 7) { return 101; } - if (s2.s16.s16.i4 != 8) + if (s2.s16W.s16.i4 != 8) { return 101; } @@ -1286,41 +1286,41 @@ static int TestS16_WW2() s2.i2 = 2; s2.i3 = 3; s2.i4 = 4; - if (s1.s16.s16.i1 != 0) + if (s1.s16W.s16.i1 != 0) { return 101; } - if (s1.s16.s16.i2 != 0) + if (s1.s16W.s16.i2 != 0) { return 101; } - if (s1.s16.s16.i3 != 0) + if (s1.s16W.s16.i3 != 0) { return 101; } - if (s1.s16.s16.i4 != 0) + if (s1.s16W.s16.i4 != 0) { return 101; } - s1.s16.s16 = s2; + s1.s16W.s16 = s2; s2.i1 = 5; s2.i2 = 6; s2.i3 = 7; s2.i4 = 8; - if (s1.s16.s16.i1 != 1) + if (s1.s16W.s16.i1 != 1) { return 101; } - if (s1.s16.s16.i2 != 2) + if (s1.s16W.s16.i2 != 2) { return 101; } - if (s1.s16.s16.i3 != 3) + if (s1.s16W.s16.i3 != 3) { return 101; } - if (s1.s16.s16.i4 != 4) + if (s1.s16W.s16.i4 != 4) { return 101; } diff --git a/src/tests/JIT/opt/Structs/structcopies.csproj b/src/tests/JIT/opt/Structs/structcopies.csproj index c85bacc9218e5c..f3e1cbd44b4041 100644 --- a/src/tests/JIT/opt/Structs/structcopies.csproj +++ b/src/tests/JIT/opt/Structs/structcopies.csproj @@ -5,8 +5,6 @@ None True - - True diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github58394.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github58394.cs new file mode 100644 index 00000000000000..ee94e5422908dc --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github58394.cs @@ -0,0 +1,47 @@ +// 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.Runtime.CompilerServices; + +namespace GenericDimValuetypeBug +{ + class Program + { + static int Main() + { + if (RunOne() != 17) + return 1; + if (RunTwo() != 23) + return 2; + return 100; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static int RunOne() + { + return (new Foo() { x = 17 } as IFoo).NoCrash(); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static int RunTwo() + { + return (new Foo() { x = 23 } as IFoo).Crash(); + } + } + + interface IFoo + { + int Crash() => Bla(); + + int NoCrash() => Bla(); + + int Bla(); + } + + struct Foo: IFoo + { + public int x; + public int Bla() => x; + } +} diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github58394.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github58394.csproj new file mode 100644 index 00000000000000..aab61d4e4497b8 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github58394.csproj @@ -0,0 +1,11 @@ + + + true + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github60486.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github60486.cs new file mode 100644 index 00000000000000..fa751c14ee8146 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github60486.cs @@ -0,0 +1,190 @@ +using System; +using System.Runtime.CompilerServices; + +public interface IPublisher +{ + event Action OnPublish; +} + +public interface TestItf1 +{ + [MethodImpl(MethodImplOptions.NoInlining)] + void TestMethod1(IPublisher publisher, StackFrame[] expectedFrames) + { + StackFrame.Validate(Environment.StackTrace, expectedFrames); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + void TestMethod2(IPublisher publisher, StackFrame[] expectedFrames) + { + TestMethod3(this, publisher, expectedFrames); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + protected static void TestMethod3(TestItf1 subscriber, IPublisher publisher, StackFrame[] expectedFrames) + { + StackFrame.Validate(Environment.StackTrace, expectedFrames); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + void TestMethod4(IPublisher publisher, StackFrame[] expectedFrames) + { + TestMethod3(this, publisher, expectedFrames); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + void TestMethod5(IPublisher publisher, StackFrame[] expectedFrames) + { + TestMethod3(this, publisher, expectedFrames); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + void TestMethod10(IPublisher publisher, StackFrame[] expectedFrames) + { + TestMethod3(this, publisher, expectedFrames); + } + + void TestMethod11(IPublisher publisher, StackFrame[] expectedFrames); +} + +public interface TestItf2 : TestItf1 +{ + [MethodImpl(MethodImplOptions.NoInlining)] + void TestItf1.TestMethod5(IPublisher publisher, StackFrame[] expectedFrames) + { + TestMethod3(this, publisher, expectedFrames); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + void TestItf1.TestMethod10(IPublisher publisher, StackFrame[] expectedFrames) + { + TestMethod3(this, publisher, expectedFrames); + } +} + +public interface TestItf3 : TestItf1 +{ + [MethodImpl(MethodImplOptions.NoInlining)] + void TestMethod6(IPublisher publisher, StackFrame[] expectedFrames) + { + TestMethod3(this, publisher, expectedFrames); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + void TestMethod7(IPublisher publisher, StackFrame[] expectedFrames) + { + TestMethod8(this, publisher, expectedFrames); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + protected static void TestMethod8(TestItf1 subscriber, IPublisher publisher, StackFrame[] expectedFrames) + { + StackFrame.Validate(Environment.StackTrace, expectedFrames); + } + + void TestMethod9(IPublisher publisher, StackFrame[] expectedFrames); +} + +public interface TestItf4 : TestItf3 +{ + [MethodImpl(MethodImplOptions.NoInlining)] + void TestItf3.TestMethod9(IPublisher publisher, StackFrame[] expectedFrames) + { + TestMethod8(this, publisher, expectedFrames); + } +} + +public class ProgramBase : TestItf4 +{ + [MethodImpl(MethodImplOptions.NoInlining)] + public void TestMethod10(IPublisher publisher, StackFrame[] expectedFrames) + { + TestItf1.TestMethod3(this, publisher, expectedFrames); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public void TestMethod11(IPublisher publisher, StackFrame[] expectedFrames) + { + TestItf1.TestMethod3(this, publisher, expectedFrames); + } +} + +public class Program : ProgramBase, TestItf2 +{ + static int Main(string[] args) + { + new Program().Start(); + return 100; + } + + public void Start() + { + var t1 = this as TestItf1; + t1.TestMethod1(null, new[] { new StackFrame("TestItf1`1", "TestMethod1") }); + t1.TestMethod2(null, new[] { new StackFrame("TestItf1`1", "TestMethod3"), new StackFrame("TestItf1`1", "TestMethod2") }); + t1.TestMethod4(null, new[] { new StackFrame("TestItf1`1", "TestMethod3"), new StackFrame("Program", "TestMethod4") }); + t1.TestMethod5(null, new[] { new StackFrame("TestItf1`1", "TestMethod3"), new StackFrame(new[] { "TestItf2`1", "TestItf1" }, "TestMethod5") }); + + var t3 = this as TestItf3; + t3.TestMethod6(null, new[] { new StackFrame("TestItf1`1", "TestMethod3"), new StackFrame("TestItf3`1", "TestMethod6") }); + t3.TestMethod7(null, new[] { new StackFrame("TestItf3`1", "TestMethod8"), new StackFrame("TestItf3`1", "TestMethod7") }); + t3.TestMethod9(null, new[] { new StackFrame("TestItf3`1", "TestMethod8"), new StackFrame(new[] { "TestItf4`1", "TestItf3" }, "TestMethod9") }); + + t1.TestMethod10(null, new[] { new StackFrame("TestItf1`1", "TestMethod3"), new StackFrame("ProgramBase`1", "TestMethod10") }); + t1.TestMethod11(null, new[] { new StackFrame("TestItf1`1", "TestMethod3"), new StackFrame("ProgramBase`1", "TestMethod11") }); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public void TestMethod4(IPublisher publisher, StackFrame[] expectedFrames) + { + TestItf1.TestMethod3(this, publisher, expectedFrames); + } +} + +public class InputData +{ + public int i; +} + +public class StackFrame +{ + public string [] ClassName { get; set; } + public string MethodName { get; set; } = string.Empty; + + public StackFrame(string [] className, string methodName) + { + ClassName = className; + MethodName = methodName; + } + + public StackFrame(string className, string methodName) + { + ClassName = new string[] { className }; + MethodName = methodName; + } + + public static void Validate(string testStack, StackFrame[] expectedFrames) + { + int index = 1; + + string[] lines = testStack.Split( + new string[] { Environment.NewLine }, + StringSplitOptions.None + ); + + //Console.WriteLine(testStack); + + foreach (var frame in expectedFrames) + { + var line = lines[index++].Trim(); + + + if (!line.StartsWith($"at {frame.ClassName[0]}") || !line.Contains($".{frame.MethodName}") || (frame.ClassName.Length > 1 && !line.Contains($".{frame.ClassName[1]}"))) + { + Console.WriteLine($"Expected {frame.ClassName}.{frame.MethodName} but got {line}"); + Console.WriteLine(testStack); + Environment.Exit(1); + } + } + } +} \ No newline at end of file diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github60486.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github60486.csproj new file mode 100644 index 00000000000000..aab61d4e4497b8 --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github60486.csproj @@ -0,0 +1,11 @@ + + + true + Exe + BuildAndRun + 0 + + + + + diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs new file mode 100644 index 00000000000000..ae08369177388d --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs @@ -0,0 +1,81 @@ +// The .NET Foundation licenses this file to you under the MIT license. + +using System; + +// In GH issue 61244 the mono runtime aborted when inflating the default +// interface method because the context used was from the base interface. + +// The OneArgBaseInterface portion of this test handles the original bug +// where the base interface has less generic arguments than the derived +// interface and the runtime aborts. + +// The SecondInterface portion of this test handles an additional scenario +// where the number of generic arguments are the same in the base and +// derived interface contexts, but the order is changed (or different.) +// When this occurs the generic info is incorrect for the inflated method. + +class Program +{ + static int Main(string[] args) + { + return new TestClass().DoTest(); + } +} + +public interface OneArgBaseInterface +{ + int SomeFunc1(T1 someParam1, Type someParam1Type); +} + +public interface TwoArgBaseInterface +{ + int SomeFunc1(T1 someParam1, T2 someParam2, Type someParam1Type, Type someParam2Type); +} + +public interface SecondInterface : OneArgBaseInterface, TwoArgBaseInterface +{ + int OneArgBaseInterface.SomeFunc1(TParam1Type someParam1, Type someParam1Type) + { + if (typeof(TParam1Type) != someParam1Type) + { + Console.WriteLine("Failed => 101"); + return 101; + } + + return 100; + } + + int TwoArgBaseInterface.SomeFunc1(TParam1Type someParam1, TParam2Type someParam2, Type someParam1Type, Type someParam2Type) + { + if (typeof(TParam1Type) != someParam1Type) + { + Console.WriteLine("Failed => 102"); + return 102; + } + + if (typeof(TParam2Type) != someParam2Type) + { + Console.WriteLine("Failed => 103"); + return 103; + } + + return 100; + } +} + +public class TestClass : SecondInterface +{ + public int DoTest () + { + int ret = (this as OneArgBaseInterface).SomeFunc1("test string", typeof(string)); + if (ret != 100) + return ret; + + ret = (this as TwoArgBaseInterface).SomeFunc1("test string", 0, typeof(string), typeof(int)); + if (ret != 100) + return ret; + + Console.WriteLine("Passed => 100"); + return 100; + } +} \ No newline at end of file diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.csproj b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.csproj new file mode 100644 index 00000000000000..42c7a9e8ffc90f --- /dev/null +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.csproj @@ -0,0 +1,9 @@ + + + true + Exe + + + + + diff --git a/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/OverrideReabstracted.cs b/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/OverrideReabstracted.cs new file mode 100644 index 00000000000000..f0f461777e7002 --- /dev/null +++ b/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/OverrideReabstracted.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; + + +namespace ReproMAUI6811; + +public static class Program +{ + public static int Main() + { + Leaf l = new Leaf(); + + if (l.getI().ToString() != "Leaf") + return 1; + if (((Intermediate)l).getI().ToString() != "Leaf") + return 2; + if (((PseudoBase)l).getI().ToString() != "Leaf") + return 3; + if (((Base)l).getI().ToString() != "Leaf") + return 4; + return 100; + } +} + +public abstract class Base { + public abstract I getI(); +} + +public class PseudoBase : Base { + public override I getI() => new C ("PseudoBase"); +} + +public abstract class Intermediate : PseudoBase { + public override abstract I getI(); +} + +public class Leaf : Intermediate { + public Leaf() {} + public override C getI() { return new C ("Leaf"); } +} + +public interface I {} + +public class C : I { + private readonly string _repr; + public C(string s) { _repr = s; } + public override string ToString() => _repr; +} + + diff --git a/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/OverrideReabstracted.csproj b/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/OverrideReabstracted.csproj new file mode 100644 index 00000000000000..570644f1dbcb7e --- /dev/null +++ b/src/tests/Loader/classloader/MethodImpl/CovariantReturns/UnitTest/OverrideReabstracted.csproj @@ -0,0 +1,8 @@ + + + Exe + + + + + diff --git a/src/tests/Loader/classloader/regressions/GitHub_82187/GitHub_82187.csproj b/src/tests/Loader/classloader/regressions/GitHub_82187/GitHub_82187.csproj new file mode 100644 index 00000000000000..32355f272f9085 --- /dev/null +++ b/src/tests/Loader/classloader/regressions/GitHub_82187/GitHub_82187.csproj @@ -0,0 +1,9 @@ + + + true + Exe + + + + + diff --git a/src/tests/Loader/classloader/regressions/GitHub_82187/repro.cs b/src/tests/Loader/classloader/regressions/GitHub_82187/repro.cs new file mode 100644 index 00000000000000..1ab3e5476a66b0 --- /dev/null +++ b/src/tests/Loader/classloader/regressions/GitHub_82187/repro.cs @@ -0,0 +1,31 @@ +using System; + +/* Regression test for https://github.com/dotnet/runtime/issues/78638 + * and https://github.com/dotnet/runtime/issues/82187 ensure AOT + * cross-compiler and AOT runtime use the same name hashing for names + * that include UTF-8 continuation bytes. + */ + +[MySpecial(typeof(MeineTüre))] +public class Program +{ + public static int Main() + { + var attr = (MySpecialAttribute)Attribute.GetCustomAttribute(typeof (Program), typeof(MySpecialAttribute), false); + if (attr == null) + return 101; + if (attr.Type == null) + return 102; + if (attr.Type.FullName != "MeineTüre") + return 103; + return 100; + } +} + +public class MySpecialAttribute : Attribute +{ + public Type Type {get; private set; } + public MySpecialAttribute(Type t) { Type = t; } +} + +public class MeineTüre {} diff --git a/src/tests/Loader/classloader/regressions/GitHub_93770/GitHub_93770.cs b/src/tests/Loader/classloader/regressions/GitHub_93770/GitHub_93770.cs new file mode 100644 index 00000000000000..7784ed40a0c73d --- /dev/null +++ b/src/tests/Loader/classloader/regressions/GitHub_93770/GitHub_93770.cs @@ -0,0 +1,128 @@ +// 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.Runtime.CompilerServices; +using Xunit; + +namespace ReproGH93770; + +// By default in Mono every class that implements interfaces has 19 +// interface method table slots that are used to dispatch interface +// calls. The methods are assigned to slots based on a hash of some +// metadata. This test tries to create at least one IMT slot that has +// a collision by creating an interface with 20 virtual methods. +// +// The bug is that if the method also has a non-virtual generic +// method, the IMT slot with the collision calls the wrong vtable +// element. + +public class ReproGH93770 +{ + [Fact] + public static int TestEntryPoint() + { + C c = new C(); + I1 i1 = c; + Helper(i1); + return 100; + } + [MethodImpl(MethodImplOptions.NoInlining)] + private static void Helper(I1 i1) + { + var e = 0; + var n = i1.M0(); + Assert.Equal(e, n); + e++; + n = i1.M1(); + Assert.Equal(e, n); + e++; + n = i1.M2(); + Assert.Equal(e, n); + e++; + n = i1.M3(); + Assert.Equal(e, n); + e++; + n = i1.M4(); + Assert.Equal(e, n); + e++; + n = i1.M5(); + Assert.Equal(e, n); + e++; + n = i1.M6(); + Assert.Equal(e, n); + e++; + n = i1.M7(); + Assert.Equal(e, n); + e++; + n = i1.M8(); + Assert.Equal(e, n); + e++; + n = i1.M9(); + Assert.Equal(e, n); + e++; + n = i1.M10(); + Assert.Equal(e, n); + e++; + n = i1.M11(); + Assert.Equal(e, n); + e++; + n = i1.M12(); + Assert.Equal(e, n); + e++; + n = i1.M13(); + Assert.Equal(e, n); + e++; + n = i1.M14(); + Assert.Equal(e, n); + e++; + n = i1.M15(); + Assert.Equal(e, n); + e++; + n = i1.M16(); + Assert.Equal(e, n); + e++; + n = i1.M17(); + Assert.Equal(e, n); + e++; + n = i1.M18(); + Assert.Equal(e, n); + e++; + n = i1.M19(); + Assert.Equal(e, n); + e++; + } +} + +public interface I1 { + public static T Id (T t)=> t; + + public int M0() => 0; + public int M1() => 1; + public int M2() => 2; + public int M3() => 3; + public int M4() => 4; + + public int M5() => 5; + public int M6() => 6; + public int M7() => 7; + public int M8() => 8; + public int M9() => 9; + public int M10() => 10; + public int M11() => 11; + public int M12() => 12; + public int M13() => 13; + public int M14() => 14; + public int M15() => 15; + public int M16() => 16; + public int M17() => 17; + public int M18() => 18; + public int M19() => 19; + +} + +public class C : I1 { + +} + + diff --git a/src/tests/Loader/classloader/regressions/GitHub_93770/GitHub_93770.csproj b/src/tests/Loader/classloader/regressions/GitHub_93770/GitHub_93770.csproj new file mode 100644 index 00000000000000..72aaed3e55208c --- /dev/null +++ b/src/tests/Loader/classloader/regressions/GitHub_93770/GitHub_93770.csproj @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/tests/Regressions/coreclr/GitHub_45929/test45929.cs b/src/tests/Regressions/coreclr/GitHub_45929/test45929.cs index 72632a5b4aaf6b..ba783a498a7de7 100644 --- a/src/tests/Regressions/coreclr/GitHub_45929/test45929.cs +++ b/src/tests/Regressions/coreclr/GitHub_45929/test45929.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics; using System.Reflection; using System.Runtime.ExceptionServices; using System.Threading; @@ -46,18 +47,40 @@ public static void Run() long progress = 0; var test = new Test(); const int MaxCount = 1000000; - Parallel.For( - 0, - MaxCount, - new ParallelOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount }, - i => + int increment = 100; + bool done = false; + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + Console.WriteLine($"{DateTime.Now} : {progress * 100D / MaxCount:000.0}% : {stopwatch.ElapsedMilliseconds}"); + + Action makeProgress = i => { - if (Interlocked.Increment(ref progress) % 10000 == 0) + if (done) return; + long newProgress = Interlocked.Increment(ref progress); + if (newProgress % increment == 0) { - Console.WriteLine($"{DateTime.Now} : {progress * 100D / MaxCount:000.0}%"); + int newIncrement = (increment * 3) / 2; + if (newIncrement > 10000) + newIncrement = 10000; + increment = newIncrement; + + Console.WriteLine($"{DateTime.Now} : {newProgress * 100D / MaxCount:000.0}% : {stopwatch.ElapsedMilliseconds}"); + if (stopwatch.ElapsedMilliseconds > 150000) + { + Console.WriteLine($"Attempting to finish early"); + done = true; + } } test.Invoke(); - }); + }; + + makeProgress(0); + + Parallel.For( + 1, + MaxCount, + new ParallelOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount }, + makeProgress); } public void Invoke() diff --git a/src/tests/Regressions/coreclr/GitHub_61104/test61104.cs b/src/tests/Regressions/coreclr/GitHub_61104/test61104.cs new file mode 100644 index 00000000000000..2e01b96bf31d52 --- /dev/null +++ b/src/tests/Regressions/coreclr/GitHub_61104/test61104.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +var type = Type.GetType("_测试数据记录仪_Iiİı_åäö_Controller_DataLogger1_log_all_", false); +var obj = Activator.CreateInstance(type!); +Console.WriteLine(obj?.GetType().Name); + +return 100; + +public class _测试数据记录仪_Iiİı_åäö_Controller_DataLogger1_log_all_ +{ +} diff --git a/src/tests/Regressions/coreclr/GitHub_61104/test61104.csproj b/src/tests/Regressions/coreclr/GitHub_61104/test61104.csproj new file mode 100644 index 00000000000000..b72e9a46cf95a8 --- /dev/null +++ b/src/tests/Regressions/coreclr/GitHub_61104/test61104.csproj @@ -0,0 +1,17 @@ + + + + Exe + enable + enable + 1 + + + true + + + + + + + diff --git a/src/tests/Regressions/coreclr/GitHub_62058/test62058.cs b/src/tests/Regressions/coreclr/GitHub_62058/test62058.cs new file mode 100644 index 00000000000000..bffbf999e7396f --- /dev/null +++ b/src/tests/Regressions/coreclr/GitHub_62058/test62058.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; + +public class Program +{ + private interface IFoo + { + bool IsValid { get; } + } + + private class Foo : IFoo + { + public bool IsValid { get; set; } + } + + public static int Main(string[] args) + { + bool warmup = new Foo().IsValid; + CatchIgnore(() => + CatchRethrow(() => + { + IFoo[] foos = {new Foo(), null}; + foreach (var foo in foos) + { + bool check = foo.IsValid; + } + })); + + return 100; + } + + public static void CatchRethrow(Action action) + { + try + { + action.Invoke(); + } + catch (Exception e) + { + Console.Out.WriteLine("catch"); + Console.Out.Flush(); + throw new Exception("catch", e); + } + } + + public static void CatchIgnore(Action action) + { + try + { + action.Invoke(); + } + catch (Exception) + { + Console.Out.WriteLine("ignore"); + Console.Out.Flush(); + } + } +} diff --git a/src/tests/Regressions/coreclr/GitHub_62058/test62058.csproj b/src/tests/Regressions/coreclr/GitHub_62058/test62058.csproj new file mode 100644 index 00000000000000..0fce5a0556f40e --- /dev/null +++ b/src/tests/Regressions/coreclr/GitHub_62058/test62058.csproj @@ -0,0 +1,9 @@ + + + Exe + 1 + + + + + diff --git a/src/tests/Regressions/coreclr/GitHub_66005/test66005.cs b/src/tests/Regressions/coreclr/GitHub_66005/test66005.cs new file mode 100644 index 00000000000000..39e370556482cf --- /dev/null +++ b/src/tests/Regressions/coreclr/GitHub_66005/test66005.cs @@ -0,0 +1,35 @@ +// 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.Runtime.CompilerServices; + +class Program +{ + [MethodImpl(MethodImplOptions.NoInlining)] + static void Test() where TException : Exception + { + try + { + throw new InvalidOperationException(); + } + catch (TException) + { + return; + } + } + + static int Main() + { + try + { + Test(); + } + catch + { + return -1; + } + + return 100; + } +} diff --git a/src/tests/Regressions/coreclr/GitHub_66005/test66005.csproj b/src/tests/Regressions/coreclr/GitHub_66005/test66005.csproj new file mode 100644 index 00000000000000..59b9f6272434d7 --- /dev/null +++ b/src/tests/Regressions/coreclr/GitHub_66005/test66005.csproj @@ -0,0 +1,9 @@ + + + Exe + 1 + + + + + diff --git a/src/tests/baseservices/RuntimeConfiguration/TestConfig.cs b/src/tests/baseservices/RuntimeConfiguration/TestConfig.cs new file mode 100644 index 00000000000000..383a5d08f466d3 --- /dev/null +++ b/src/tests/baseservices/RuntimeConfiguration/TestConfig.cs @@ -0,0 +1,159 @@ +// 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.Linq; +using System.Text; +using System.Reflection; +using System.Runtime; + +using Xunit; + +class TestConfig +{ + const int Success = 100; + const int Fail = 101; + + [Fact] + [EnvVar("DOTNET_gcServer", "1")] + static int Verify_ServerGC_Env_Enable(string[] _) + { + return GCSettings.IsServerGC + ? Success + : Fail; + } + + [Fact] + [ConfigProperty("DOTNET_gcServer", "0")] + static int Verify_ServerGC_Env_Disable(string[] _) + { + return GCSettings.IsServerGC + ? Fail + : Success; + } + + [Fact] + [ConfigProperty("System.GC.Server", "true")] + static int Verify_ServerGC_Prop_Enable(string[] _) + { + return GCSettings.IsServerGC + ? Success + : Fail; + } + + [Fact] + [ConfigProperty("System.GC.Server", "false")] + static int Verify_ServerGC_Prop_Disable(string[] _) + { + return GCSettings.IsServerGC + ? Fail + : Success; + } + + [Fact] + [EnvVar("DOTNET_gcServer", "0")] + [ConfigProperty("System.GC.Server", "true")] + static int Verify_ServerGC_Env_Override_Prop(string[] _) + { + return GCSettings.IsServerGC + ? Fail + : Success; + } + + static int Main(string[] args) + { + if (args.Length == 0) + { + return RunTests(); + } + + MethodInfo infos = typeof(TestConfig).GetMethod(args[0], BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); + if (infos is null) + { + return Fail; + } + return (int)infos.Invoke(null, new object[] { args[1..] }); + } + + [AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)] + class EnvVarAttribute : Attribute + { + public EnvVarAttribute(string name, string value) { Name = name; Value = value; } + public string Name { get; init; } + public string Value { get; init; } + } + + [AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)] + class ConfigPropertyAttribute : Attribute + { + public ConfigPropertyAttribute(string name, string value) { Name = name; Value = value; } + public string Name { get; init; } + public string Value { get; init; } + } + + static int RunTests() + { + string corerunPath = GetCorerunPath(); + MethodInfo[] infos = typeof(TestConfig).GetMethods(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); + foreach (var mi in infos) + { + var factMaybe = mi.GetCustomAttributes(typeof(FactAttribute)); + if (!factMaybe.Any()) + { + continue; + } + + using Process process = new(); + + StringBuilder arguments = new(); + var configProperties = mi.GetCustomAttributes(typeof(ConfigPropertyAttribute)); + + foreach (Attribute cp in configProperties) + { + ConfigPropertyAttribute configProp = (ConfigPropertyAttribute)cp; + arguments.Append($"-p {configProp.Name}={configProp.Value} "); + } + + arguments.Append($"\"{System.Reflection.Assembly.GetExecutingAssembly().Location}\" {mi.Name}"); + + process.StartInfo.FileName = corerunPath; + process.StartInfo.Arguments = arguments.ToString(); + + var envVariables = mi.GetCustomAttributes(typeof(EnvVarAttribute)); + foreach (string key in Environment.GetEnvironmentVariables().Keys) + { + process.StartInfo.EnvironmentVariables[key] = Environment.GetEnvironmentVariable(key); + } + + Console.WriteLine($"Running: {process.StartInfo.Arguments}"); + foreach (Attribute ev in envVariables) + { + EnvVarAttribute envVar = (EnvVarAttribute)ev; + process.StartInfo.EnvironmentVariables[envVar.Name] = envVar.Value; + Console.WriteLine($" set {envVar.Name}={envVar.Value}"); + } + + process.Start(); + process.WaitForExit(); + if (process.ExitCode != Success) + { + Console.WriteLine($"Failed: {mi.Name}"); + return process.ExitCode; + } + } + + return Success; + } + + static string GetCorerunPath() + { + string corerunName = "corerun"; + if (TestLibrary.Utilities.IsWindows) + { + corerunName += ".exe"; + } + return Path.Combine(Environment.GetEnvironmentVariable("CORE_ROOT"), corerunName); + } +} \ No newline at end of file diff --git a/src/tests/baseservices/RuntimeConfiguration/TestConfig.csproj b/src/tests/baseservices/RuntimeConfiguration/TestConfig.csproj new file mode 100644 index 00000000000000..efba9444477cd8 --- /dev/null +++ b/src/tests/baseservices/RuntimeConfiguration/TestConfig.csproj @@ -0,0 +1,15 @@ + + + Exe + + true + true + true + + + + + + + + \ No newline at end of file diff --git a/src/tests/ilverify/ILVerification.Tests.csproj b/src/tests/ilverify/ILVerification.Tests.csproj index 779ef5ed4e5b27..8a0f2009143788 100644 --- a/src/tests/ilverify/ILVerification.Tests.csproj +++ b/src/tests/ilverify/ILVerification.Tests.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 85efa7cd8ae6d6..62d7c3e233593f 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -597,6 +597,9 @@ Needs Triage + + Windows's unwinder in ARM64v8 queue doesn't contain FP unwind fix + @@ -649,6 +652,9 @@ Needs Triage + + https://github.com/dotnet/runtime/issues/67603 + @@ -684,6 +690,9 @@ Allocates large contiguous array that is not consistently available on 32-bit platforms + + https://github.com/dotnet/runtime/issues/67603 + @@ -954,6 +963,10 @@ + + https://github.com/dotnet/runtime/issues/68032 + + https://github.com/dotnet/runtime/issues/56887 @@ -968,27 +981,9 @@ - - https://github.com/dotnet/runtime/issues/51323 - - - https://github.com/dotnet/runtime/issues/51323 - Mono does not define out of range fp to int conversions - - https://github.com/dotnet/runtime/issues/51323 - - - https://github.com/dotnet/runtime/issues/51323 - - - https://github.com/dotnet/runtime/issues/51323 - - - https://github.com/dotnet/runtime/issues/51323 - https://github.com/dotnet/runtime/issues/48190 @@ -1005,6 +1000,9 @@ Tests features specific to coreclr + + Tests features specific to coreclr + https://github.com/dotnet/runtime/issues/40394 @@ -1122,9 +1120,33 @@ needs triage + + PlatformDetection.IsPreciseGcSupported false on mono + + + PlatformDetection.IsPreciseGcSupported false on mono + + + PlatformDetection.IsPreciseGcSupported false on mono + + + PlatformDetection.IsPreciseGcSupported false on mono + PlatformDetection.IsPreciseGcSupported false on mono + + PlatformDetection.IsPreciseGcSupported false on mono + + + PlatformDetection.IsPreciseGcSupported false on mono + + + PlatformDetection.IsPreciseGcSupported false on mono + + + PlatformDetection.IsPreciseGcSupported false on mono + PlatformDetection.IsPreciseGcSupported false on mono @@ -1143,9 +1165,9 @@ https://github.com/dotnet/runtime/issues/34371 - - Not supported on Mono - + + Not supported on Mono + needs triage @@ -1242,9 +1264,6 @@ needs triage - - https://github.com/dotnet/runtime/issues/51323 - needs triage @@ -2013,6 +2032,9 @@ needs triage + + https://github.com/dotnet/runtime/issues/57350 + needs triage @@ -2186,6 +2208,24 @@ https://github.com/dotnet/runtime/issues/54113 + + https://github.com/dotnet/runtime/issues/81907 + + + https://github.com/dotnet/runtime/issues/81907 + + + https://github.com/dotnet/runtime/issues/81907 + + + https://github.com/dotnet/runtime/issues/81907 + + + https://github.com/dotnet/runtime/issues/81907 + + + https://github.com/dotnet/runtime/issues/81907 + @@ -2369,6 +2409,9 @@ https://github.com/dotnet/runtime/issues/41193 + + Loads an assembly from file + https://github.com/dotnet/runtime/issues/41519 @@ -2852,6 +2895,9 @@ https://github.com/dotnet/runtime/issues/53353 + + Loads an assembly from file + @@ -2866,6 +2912,12 @@ + + + https://github.com/dotnet/runtime/issues/64127 + + + missing assembly diff --git a/src/tests/profiler/multiple/multiple.csproj b/src/tests/profiler/multiple/multiple.csproj index c7b6a7b209a090..b93b878c8f17b9 100644 --- a/src/tests/profiler/multiple/multiple.csproj +++ b/src/tests/profiler/multiple/multiple.csproj @@ -5,6 +5,10 @@ BuildAndRun true 0 + + true + + true diff --git a/src/tests/profiler/native/gcprofiler/gcprofiler.cpp b/src/tests/profiler/native/gcprofiler/gcprofiler.cpp index 42666a2d8eac82..ed6312cd89c461 100644 --- a/src/tests/profiler/native/gcprofiler/gcprofiler.cpp +++ b/src/tests/profiler/native/gcprofiler/gcprofiler.cpp @@ -37,6 +37,10 @@ HRESULT GCProfiler::Shutdown() { printf("GCProfiler::Shutdown: FAIL: Expected GarbageCollectionFinished to be called\n"); } + else if (_allocatedByClassCalls == 0) + { + printf("GCProfiler::Shutdown: FAIL: Expected ObjectsAllocatedByClass to be called\n"); + } else if (_pohObjectsSeenRootReferences == 0 || _pohObjectsSeenObjectReferences == 0) { printf("GCProfiler::Shutdown: FAIL: no POH objects seen. root references=%d object references=%d\n", @@ -86,6 +90,20 @@ HRESULT GCProfiler::GarbageCollectionFinished() return S_OK; } +HRESULT GCProfiler::ObjectsAllocatedByClass(ULONG cClassCount, ClassID classIds[], ULONG cObjects[]) +{ + SHUTDOWNGUARD(); + + _allocatedByClassCalls++; + if (_gcStarts != _allocatedByClassCalls) + { + _failures++; + printf("GCProfiler::ObjectsAllocatedByClass: FAIL: Expected ObjectsAllocatedByClass Calls == GCStart. AllocatedByClassCalls=%d, GCStart=%d\n", (int)_allocatedByClassCalls, (int)_gcStarts); + } + + return S_OK; +} + HRESULT GCProfiler::ObjectReferences(ObjectID objectId, ClassID classId, ULONG cObjectRefs, ObjectID objectRefIds[]) { SHUTDOWNGUARD(); diff --git a/src/tests/profiler/native/gcprofiler/gcprofiler.h b/src/tests/profiler/native/gcprofiler/gcprofiler.h index ab519f6f53399a..eebdb06853f7a1 100644 --- a/src/tests/profiler/native/gcprofiler/gcprofiler.h +++ b/src/tests/profiler/native/gcprofiler/gcprofiler.h @@ -16,6 +16,7 @@ class GCProfiler : public Profiler GCProfiler() : Profiler(), _gcStarts(0), _gcFinishes(0), + _allocatedByClassCalls(0), _failures(0), _pohObjectsSeenRootReferences(0), _pohObjectsSeenObjectReferences(0), @@ -28,12 +29,14 @@ class GCProfiler : public Profiler virtual HRESULT STDMETHODCALLTYPE Shutdown(); virtual HRESULT STDMETHODCALLTYPE GarbageCollectionStarted(int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason); virtual HRESULT STDMETHODCALLTYPE GarbageCollectionFinished(); + virtual HRESULT STDMETHODCALLTYPE ObjectsAllocatedByClass(ULONG cClassCount, ClassID classIds[], ULONG cObjects[]); virtual HRESULT STDMETHODCALLTYPE ObjectReferences(ObjectID objectId, ClassID classId, ULONG cObjectRefs, ObjectID objectRefIds[]); virtual HRESULT STDMETHODCALLTYPE RootReferences(ULONG cRootRefs, ObjectID rootRefIds[]); private: std::atomic _gcStarts; std::atomic _gcFinishes; + std::atomic _allocatedByClassCalls; std::atomic _failures; std::atomic _pohObjectsSeenRootReferences; std::atomic _pohObjectsSeenObjectReferences; diff --git a/src/tests/run.proj b/src/tests/run.proj index f21a0bd1284065..1636171ec28487 100644 --- a/src/tests/run.proj +++ b/src/tests/run.proj @@ -101,7 +101,7 @@ $(_XunitEpilog) $(XUnitTestBinBase)\$(CategoryWithSlash) - $(MicrosoftNETCoreAppVersion) + $(MicrosoftNETCoreAppRuntimewinx64Version) false @@ -589,8 +589,8 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\",""). $(MonoBinDir) - $(MonoBinDir)/cross/$(PackageRID)/mono-aot-cross - $(MonoBinDir)/cross/$(PackageRID) + $(MonoBinDir)/cross/$(OutputRid)/mono-aot-cross + $(MonoBinDir)/cross/$(OutputRid) @@ -775,6 +775,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\",""). MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)/include/mono-2.0" Assemblies="@(BundleAssemblies)" ForceInterpreter="$(MonoForceInterpreter)" + EnableAppSandbox="$(EnableAppSandbox)" UseConsoleUITemplate="True" GenerateXcodeProject="True" BuildAppBundle="True" @@ -826,7 +827,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\",""). + Properties="Language=C#;OutputRid=$(OutputRid);RuntimeIdentifier=$(OutputRid)" /> diff --git a/src/tests/tracing/eventcounter/runtimecounters.cs b/src/tests/tracing/eventcounter/runtimecounters.cs index bdab454300ade0..e6623649736d1b 100644 --- a/src/tests/tracing/eventcounter/runtimecounters.cs +++ b/src/tests/tracing/eventcounter/runtimecounters.cs @@ -54,7 +54,9 @@ protected override void OnEventSourceCreated(EventSource source) { Dictionary refreshInterval = new Dictionary(); refreshInterval.Add("EventCounterIntervalSec", "1"); - EnableEvents(source, EventLevel.Informational, (EventKeywords)(-1), refreshInterval); + EnableEvents(source, EventLevel.Informational, + (EventKeywords)(-1 & (~1 /* RuntimeEventSource.Keywords.AppContext */)), + refreshInterval); } } @@ -100,7 +102,7 @@ public static int Main(string[] args) // Create an EventListener. using (RuntimeCounterListener myListener = new RuntimeCounterListener()) { - Thread.Sleep(3000); + Thread.Sleep(3000); if (myListener.Verify()) { Console.WriteLine("Test passed"); diff --git a/src/tests/tracing/eventlistener/EventListener.cs b/src/tests/tracing/eventlistener/EventListener.cs index 23a1ff37d131b7..0cd7e18459cb82 100644 --- a/src/tests/tracing/eventlistener/EventListener.cs +++ b/src/tests/tracing/eventlistener/EventListener.cs @@ -15,6 +15,20 @@ public SimpleEventSource() : base(true) { } [Event(1)] internal void MathResult(int x, int y, int z, string formula) { this.WriteEvent(1, x, y, z, formula); } + + [Event(2)] + internal void DateTimeEvent(DateTime dateTime) => WriteEvent(2, dateTime); + + + [NonEvent] + private unsafe void WriteEvent(int eventId, DateTime dateTime) + { + EventData* desc = stackalloc EventData[1]; + long fileTime = dateTime.ToFileTimeUtc(); + desc[0].DataPointer = (IntPtr)(&fileTime); + desc[0].Size = 8; + WriteEventCore(eventId, 1, desc); + } } internal sealed class SimpleEventListener : EventListener @@ -23,6 +37,7 @@ internal sealed class SimpleEventListener : EventListener private readonly EventLevel _level; public int EventCount { get; private set; } = 0; + public DateTime DateObserved { get; private set; } = DateTime.MinValue; public SimpleEventListener(string targetSourceName, EventLevel level) { @@ -41,13 +56,19 @@ protected override void OnEventSourceCreated(EventSource source) protected override void OnEventWritten(EventWrittenEventArgs eventData) { - EventCount++; + if (eventData.EventId == 2) + { + DateObserved = (DateTime)eventData.Payload[0]; + } + else + EventCount++; } } class EventPipeSmoke { private static int messageIterations = 100; + private static readonly DateTime ThePast = DateTime.UtcNow; static int Main(string[] args) { @@ -68,10 +89,12 @@ static int Main(string[] args) eventSource.MathResult(x, y, x+y, formula); } + eventSource.DateTimeEvent(ThePast); Console.WriteLine("\tEnd: Messaging.\n"); Console.WriteLine($"\tEventListener received {listener.EventCount} event(s)\n"); - pass = listener.EventCount == messageIterations; + Console.WriteLine($"\tEventListener received {listener.DateObserved} vs {ThePast}\n"); + pass = listener.EventCount == messageIterations && ThePast == listener.DateObserved; } return pass ? 100 : -1; diff --git a/src/tests/tracing/eventpipe/pauseonstart/pauseonstart.cs b/src/tests/tracing/eventpipe/pauseonstart/pauseonstart.cs index d319b4c9905378..84d1c0dbab2bf6 100644 --- a/src/tests/tracing/eventpipe/pauseonstart/pauseonstart.cs +++ b/src/tests/tracing/eventpipe/pauseonstart/pauseonstart.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Collections.Generic; using System.Reflection; +using System.Runtime.InteropServices; using Microsoft.Diagnostics.Tools.RuntimeClient; using Tracing.Tests.Common; using System.Threading; @@ -305,6 +306,133 @@ public static async Task TEST_DisabledCommandsError() return fSuccess; } + public static async Task TEST_ProcessInfoBeforeAndAfterSuspension() + { + // This test only applies to platforms where the PAL is used + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + return true; + + // This test only applies to CoreCLR (this checks if we're running on Mono) + if (Type.GetType("Mono.RuntimeStructs") != null) + return true; + + bool fSuccess = true; + string serverName = ReverseServer.MakeServerAddress(); + Logger.logger.Log($"Server name is '{serverName}'"); + var server = new ReverseServer(serverName); + using var memoryStream1 = new MemoryStream(); + using var memoryStream2 = new MemoryStream(); + using var memoryStream3 = new MemoryStream(); + Task subprocessTask = Utils.RunSubprocess( + currentAssembly: Assembly.GetExecutingAssembly(), + environment: new Dictionary { { Utils.DiagnosticPortsEnvKey, $"{serverName}" } }, + duringExecution: async (pid) => + { + Process currentProcess = Process.GetCurrentProcess(); + + Stream stream = await server.AcceptAsync(); + IpcAdvertise advertise = IpcAdvertise.Parse(stream); + Logger.logger.Log(advertise.ToString()); + + Logger.logger.Log($"Get ProcessInfo while process is suspended"); + // 0x04 = ProcessCommandSet, 0x04 = ProcessInfo2 + var message = new IpcMessage(0x04, 0x04); + Logger.logger.Log($"Sent: {message.ToString()}"); + IpcMessage response = IpcClient.SendMessage(stream, message); + Logger.logger.Log($"received: {response.ToString()}"); + + ProcessInfo2 pi2Before = ProcessInfo2.TryParse(response.Payload); + Utils.Assert(pi2Before.Commandline.Equals(currentProcess.MainModule.FileName), $"Before resuming, the commandline should be the mock value of the host executable path '{currentProcess.MainModule.FileName}'. Observed: '{pi2Before.Commandline}'"); + + // recycle + stream = await server.AcceptAsync(); + advertise = IpcAdvertise.Parse(stream); + Logger.logger.Log(advertise.ToString()); + + // Start EP session to know when runtime is resumed + var config = new SessionConfiguration( + circularBufferSizeMB: 1000, + format: EventPipeSerializationFormat.NetTrace, + providers: new List { + new Provider("Microsoft-Windows-DotNETRuntimePrivate", 0x80000000, EventLevel.Verbose), + new Provider("Microsoft-DotNETCore-SampleProfiler") + }); + Logger.logger.Log("Starting EventPipeSession over standard connection"); + using Stream eventStream = EventPipeClient.CollectTracing(pid, config, out var sessionId); + Logger.logger.Log($"Started EventPipeSession over standard connection with session id: 0x{sessionId:x}"); + + TaskCompletionSource runtimeResumed = new(false, TaskCreationOptions.RunContinuationsAsynchronously); + + var eventPipeTask = Task.Run(() => + { + Logger.logger.Log("Creating source"); + using var source = new EventPipeEventSource(eventStream); + var parser = new ClrPrivateTraceEventParser(source); + parser.StartupEEStartupStart += (_) => runtimeResumed.SetResult(true); + source.Process(); + Logger.logger.Log("stopping processing"); + }); + + Logger.logger.Log($"Send ResumeRuntime Diagnostics IPC Command"); + // send ResumeRuntime command (0x04=ProcessCommandSet, 0x01=ResumeRuntime commandid) + message = new IpcMessage(0x04,0x01); + Logger.logger.Log($"Sent: {message.ToString()}"); + response = IpcClient.SendMessage(stream, message); + Logger.logger.Log($"received: {response.ToString()}"); + + // recycle + stream = await server.AcceptAsync(); + advertise = IpcAdvertise.Parse(stream); + Logger.logger.Log(advertise.ToString()); + + // wait a little bit to make sure the runtime of the target is fully up, i.e., g_EEStarted == true + // on resource constrained CI machines this may not be instantaneous + Logger.logger.Log($"awaiting resume"); + await Utils.WaitTillTimeout(runtimeResumed.Task, TimeSpan.FromSeconds(10)); + Logger.logger.Log($"resumed"); + + // await Task.Delay(TimeSpan.FromSeconds(1)); + Logger.logger.Log("Stopping EventPipeSession over standard connection"); + EventPipeClient.StopTracing(pid, sessionId); + Logger.logger.Log($"Await reader task"); + await eventPipeTask; + Logger.logger.Log("Stopped EventPipeSession over standard connection"); + + ProcessInfo2 pi2After = default; + + // The timing is not exact. There is a small window after resuming where the mock + // value is still present. Retry several times to catch it. + var retryTask = Task.Run(async () => + { + int i = 0; + do { + Logger.logger.Log($"Get ProcessInfo after resumption: attempt {i++}"); + // 0x04 = ProcessCommandSet, 0x04 = ProcessInfo2 + message = new IpcMessage(0x04, 0x04); + Logger.logger.Log($"Sent: {message.ToString()}"); + response = IpcClient.SendMessage(stream, message); + Logger.logger.Log($"received: {response.ToString()}"); + + pi2After = ProcessInfo2.TryParse(response.Payload); + + // recycle + stream = await server.AcceptAsync(); + advertise = IpcAdvertise.Parse(stream); + Logger.logger.Log(advertise.ToString()); + } while (pi2After.Commandline.Equals(pi2Before.Commandline)); + }); + + await Utils.WaitTillTimeout(retryTask, TimeSpan.FromSeconds(10)); + + Utils.Assert(!pi2After.Commandline.Equals(pi2Before.Commandline), $"After resuming, the commandline should be the correct value. Observed: Before='{pi2Before.Commandline}' After='{pi2After.Commandline}'"); + } + ); + + fSuccess &= await subprocessTask; + + return fSuccess; + } + public static async Task Main(string[] args) { if (args.Length >= 1) diff --git a/src/tests/tracing/eventpipe/processinfo2/processinfo2.cs b/src/tests/tracing/eventpipe/processinfo2/processinfo2.cs index 31f4b677681c2a..9cdc77a19eb881 100644 --- a/src/tests/tracing/eventpipe/processinfo2/processinfo2.cs +++ b/src/tests/tracing/eventpipe/processinfo2/processinfo2.cs @@ -243,7 +243,8 @@ public static int Main(string[] args) string expectedClrProductVersion = typeof(object).Assembly.GetCustomAttribute()?.InformationalVersion; - Utils.Assert(expectedClrProductVersion.Equals(clrProductVersion), $"ClrProductVersion must match. Expected: \"{expectedClrProductVersion}\", received: \"{clrProductVersion}\""); + // https://github.com/dotnet/runtime/issues/60532 + // Utils.Assert(expectedClrProductVersion.Equals(clrProductVersion), $"ClrProductVersion must match. Expected: \"{expectedClrProductVersion}\", received: \"{clrProductVersion}\""); Utils.Assert(end == totalSize, $"Full payload should have been read. Expected: {totalSize}, Received: {end}"); diff --git a/src/tests/tracing/runtimeeventsource/NativeRuntimeEventSourceTest.cs b/src/tests/tracing/runtimeeventsource/NativeRuntimeEventSourceTest.cs new file mode 100644 index 00000000000000..c05747fca34382 --- /dev/null +++ b/src/tests/tracing/runtimeeventsource/NativeRuntimeEventSourceTest.cs @@ -0,0 +1,137 @@ +// 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.IO; +using System.Diagnostics.Tracing; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using Tracing.Tests.Common; +using System.Collections.Generic; + +namespace Tracing.Tests +{ + public sealed class NativeRuntimeEventSourceTest + { + static int Main(string[] args) + { + SimpleEventListener.EnableKeywords = (EventKeywords)0; + using (SimpleEventListener noEventsListener = new SimpleEventListener("NoEvents")) + { + // Create an EventListener. + SimpleEventListener.EnableKeywords = (EventKeywords)0x4c14fccbd; + using (SimpleEventListener listener = new SimpleEventListener("Simple")) + { + // Trigger the allocator task. + Task.Run(new Action(Allocator)); + + // If on Windows, attempt some Overlapped IO (triggers ThreadPool events) + if (OperatingSystem.IsWindows()) + DoOverlappedIO(); + + // Wait for events. + Thread.Sleep(1000); + + // Generate some GC events. + GC.Collect(2, GCCollectionMode.Forced); + + // Wait for more events. + Thread.Sleep(1000); + + // Ensure that we've seen some events. + foreach (string s in listener.SeenProvidersAndEvents) + Console.WriteLine(s); + Assert.True("listener.EventCount > 0", listener.EventCount > 0); + if (OperatingSystem.IsWindows()) + Assert.True("Saw the ThreadPoolIOPack event", listener.SeenProvidersAndEvents.Contains("Microsoft-Windows-DotNETRuntime/EVENTID(65)")); + } + + // Generate some more GC events. + GC.Collect(2, GCCollectionMode.Forced); + + // Ensure that we've seen no events. + Assert.True("noEventsListener.EventCount == 0", noEventsListener.EventCount == 0); + } + + return 100; + } + + private static void Allocator() + { + while (true) + { + for(int i=0; i<1000; i++) + GC.KeepAlive(new object()); + + Thread.Sleep(10); + } + } + + private static unsafe void DoOverlappedIO() + { + Console.WriteLine("DOOVERLAPPEDIO"); + Overlapped overlapped = new(); + NativeOverlapped* pOverlap = overlapped.Pack(null, null); + Overlapped.Free(pOverlap); + } + } + + internal sealed class SimpleEventListener : EventListener + { + public HashSet SeenProvidersAndEvents { get; private set; } = new(); + private string m_name; + + // Keep track of the set of keywords to be enabled. + public static EventKeywords EnableKeywords + { + get; + set; + } + + public SimpleEventListener(string name) + { + m_name = name; + } + + public int EventCount { get; private set; } = 0; + + protected override void OnEventSourceCreated(EventSource eventSource) + { + if (eventSource.Name.Equals("Microsoft-Windows-DotNETRuntime")) + { + if (EnableKeywords != 0) + { + // Enable events. + EnableEvents(eventSource, EventLevel.Verbose, EnableKeywords); + } + else + { + // Enable the provider, but not any keywords, so we should get no events as long as no rundown occurs. + EnableEvents(eventSource, EventLevel.Critical, EnableKeywords); + } + } + } + + protected override void OnEventWritten(EventWrittenEventArgs eventData) + { + Console.WriteLine($"[{m_name}] ThreadID = {eventData.OSThreadId} ID = {eventData.EventId} Name = {eventData.EventName}"); + Console.WriteLine($"TimeStamp: {eventData.TimeStamp.ToLocalTime()}"); + Console.WriteLine($"LocalTime: {DateTime.Now}"); + Console.WriteLine($"Difference: {DateTime.UtcNow - eventData.TimeStamp}"); + Assert.True("eventData.TimeStamp <= DateTime.UtcNow", eventData.TimeStamp <= DateTime.UtcNow); + for (int i = 0; i < eventData.Payload.Count; i++) + { + string payloadString = eventData.Payload[i] != null ? eventData.Payload[i].ToString() : string.Empty; + Console.WriteLine($"\tName = \"{eventData.PayloadNames[i]}\" Value = \"{payloadString}\""); + } + Console.WriteLine("\n"); + + SeenProvidersAndEvents.Add($"{eventData.EventSource.Name}"); + SeenProvidersAndEvents.Add($"{eventData.EventSource.Name}/EVENTID({eventData.EventId})"); + + EventCount++; + } + } +} diff --git a/src/tests/tracing/runtimeeventsource/RuntimeEventSourceTest.cs b/src/tests/tracing/runtimeeventsource/RuntimeEventSourceTest.cs index 4474176d360da5..3a4b4bd38667e9 100644 --- a/src/tests/tracing/runtimeeventsource/RuntimeEventSourceTest.cs +++ b/src/tests/tracing/runtimeeventsource/RuntimeEventSourceTest.cs @@ -1,114 +1,101 @@ // 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.IO; +#if USE_MDT_EVENTSOURCE +using Microsoft.Diagnostics.Tracing; +#else using System.Diagnostics.Tracing; -using System.Runtime.CompilerServices; +#endif +using System; +using System.Collections.Generic; using System.Threading; -using Tracing.Tests.Common; +using System.Threading.Tasks; +using System.Diagnostics; -namespace Tracing.Tests +AppContext.SetSwitch("appContextSwitch", true); +AppDomain.CurrentDomain.SetData("appContextBoolData", true); // Not loggeed, bool key +AppDomain.CurrentDomain.SetData("appContextBoolAsStringData", "true"); +AppDomain.CurrentDomain.SetData("appContextStringData", "myString"); // Not logged, string does not parse as bool +AppDomain.CurrentDomain.SetData("appContextSwitch", "false"); // should not override the SetSwitch above + +// Create an EventListener. +using (var myListener = new RuntimeEventListener()) { - public sealed class RuntimeEventSourceTest + if (myListener.Verify()) + { + Console.WriteLine("Test passed"); + return 100; + } + else { - static int Main(string[] args) + Console.WriteLine($"Test Failed - did not see one or more of the expected runtime counters."); + Console.WriteLine("Observed events: "); + foreach (var (k, v) in myListener.ObservedEvents) { - SimpleEventListener.EnableKeywords = (EventKeywords)0; - using (SimpleEventListener noEventsListener = new SimpleEventListener("NoEvents")) - { - // Create an EventListener. - SimpleEventListener.EnableKeywords = (EventKeywords)0x4c14fccbd; - using (SimpleEventListener listener = new SimpleEventListener("Simple")) - { - // Trigger the allocator task. - System.Threading.Tasks.Task.Run(new Action(Allocator)); - - // Wait for events. - Thread.Sleep(1000); - - // Generate some GC events. - GC.Collect(2, GCCollectionMode.Forced); - - // Wait for more events. - Thread.Sleep(1000); - - // Ensure that we've seen some events. - Assert.True("listener.EventCount > 0", listener.EventCount > 0); - } + Console.WriteLine("Event: " + k + " " + v); + } + return 1; + } +} - // Generate some more GC events. - GC.Collect(2, GCCollectionMode.Forced); +public class RuntimeEventListener : EventListener +{ + internal readonly Dictionary ObservedEvents = new Dictionary(); - // Ensure that we've seen no events. - Assert.True("noEventsListener.EventCount == 0", noEventsListener.EventCount == 0); - } + private static readonly string[] s_expectedEvents = new[] { + "appContextSwitch", + "appContextBoolAsStringData", + "RuntimeHostConfigSwitch", // Set in the project file + }; - return 100; - } + private static readonly string[] s_unexpectedEvents = new[] { + "appContextBoolData", + "appContextStringData", + }; - private static void Allocator() + protected override void OnEventSourceCreated(EventSource source) + { + if (source.Name.Equals("System.Runtime")) { - while (true) - { - for(int i=0; i<1000; i++) - GC.KeepAlive(new object()); - - Thread.Sleep(10); - } + EnableEvents(source, EventLevel.Informational, (EventKeywords)1 /* RuntimeEventSource.Keywords.AppContext */); } } - internal sealed class SimpleEventListener : EventListener + protected override void OnEventWritten(EventWrittenEventArgs eventData) { - private string m_name; - - // Keep track of the set of keywords to be enabled. - public static EventKeywords EnableKeywords - { - get; - set; - } - - public SimpleEventListener(string name) + // Check AppContext switches + if (eventData is { EventName: "LogAppContextSwitch", + Payload: { Count: 2 } }) { - m_name = name; + var switchName = (string)eventData.Payload[0]; + ObservedEvents[switchName] = ((int)eventData.Payload[1]) == 1; + return; } + } - public int EventCount { get; private set; } = 0; - - protected override void OnEventSourceCreated(EventSource eventSource) + public bool Verify() + { + foreach (var key in s_expectedEvents) { - if (eventSource.Name.Equals("Microsoft-Windows-DotNETRuntime")) + if (!ObservedEvents[key]) { - if (EnableKeywords != 0) - { - // Enable events. - EnableEvents(eventSource, EventLevel.Verbose, EnableKeywords); - } - else - { - // Enable the provider, but not any keywords, so we should get no events as long as no rundown occurs. - EnableEvents(eventSource, EventLevel.Critical, EnableKeywords); - } + Console.WriteLine($"Could not find key {key}"); + return false; + } + else + { + Console.WriteLine($"Saw {key}"); } } - protected override void OnEventWritten(EventWrittenEventArgs eventData) + foreach (var key in s_unexpectedEvents) { - Console.WriteLine($"[{m_name}] ThreadID = {eventData.OSThreadId} ID = {eventData.EventId} Name = {eventData.EventName}"); - Console.WriteLine($"TimeStamp: {eventData.TimeStamp.ToLocalTime()}"); - Console.WriteLine($"LocalTime: {DateTime.Now}"); - Console.WriteLine($"Difference: {DateTime.UtcNow - eventData.TimeStamp}"); - Assert.True("eventData.TimeStamp <= DateTime.UtcNow", eventData.TimeStamp <= DateTime.UtcNow); - for (int i = 0; i < eventData.Payload.Count; i++) + if (ObservedEvents.ContainsKey(key)) { - string payloadString = eventData.Payload[i] != null ? eventData.Payload[i].ToString() : string.Empty; - Console.WriteLine($"\tName = \"{eventData.PayloadNames[i]}\" Value = \"{payloadString}\""); + Console.WriteLine($"Should not have seen {key}"); + return false; } - Console.WriteLine("\n"); - - EventCount++; } + return true; } -} +} \ No newline at end of file diff --git a/src/tests/tracing/runtimeeventsource/nativeruntimeeventsource.csproj b/src/tests/tracing/runtimeeventsource/nativeruntimeeventsource.csproj new file mode 100644 index 00000000000000..2d90928194e63a --- /dev/null +++ b/src/tests/tracing/runtimeeventsource/nativeruntimeeventsource.csproj @@ -0,0 +1,15 @@ + + + Exe + BuildAndRun + true + 0 + true + + true + + + + + + diff --git a/src/tests/tracing/runtimeeventsource/runtimeeventsource.csproj b/src/tests/tracing/runtimeeventsource/runtimeeventsource.csproj index 70336054f35e5c..79075307131d43 100644 --- a/src/tests/tracing/runtimeeventsource/runtimeeventsource.csproj +++ b/src/tests/tracing/runtimeeventsource/runtimeeventsource.csproj @@ -4,18 +4,13 @@ BuildAndRun true 0 - true true - - true + true + diff --git a/src/workloads/workloads.csproj b/src/workloads/workloads.csproj index 92b25bf61fc46b..808af76ab3bead 100644 --- a/src/workloads/workloads.csproj +++ b/src/workloads/workloads.csproj @@ -1,4 +1,4 @@ - + @@ -8,8 +8,7 @@ $(NuGetPackageRoot)microsoft.dotnet.build.tasks.installers\$(MicrosoftDotNetBuildTasksInstallersVersion)\tools\$(MicrosoftDotNetBuildTasksInstallersTaskTargetFramework)\Microsoft.DotNet.Build.Tasks.Installers.dll - - + @@ -19,6 +18,7 @@ false $(ArtifactsObjDir)workloads/ + $(WorkloadIntermediateOutputPath)VS/ $(ArtifactsBinDir)workloads/ $(workloadArtifactsPath)/ $(ArtifactsShippingPackagesDir) @@ -34,45 +34,48 @@ - $(PkgWix)\tools + $(PkgMicrosoft_Signed_Wix)\tools $(PkgMicroBuild_Plugins_SwixBuild_Dotnet) $(SwixPluginPath)\build\MicroBuild.Plugins.SwixBuild.targets - + - + - - - - - - - - - - - - - - + <_ComponentResources Include="microsoft-net-runtime-mono-tooling" Title=".NET Shared Mobile Build Tools" + Description="Shared build tasks for mobile platform development."/> + <_ComponentResources Include="wasm-tools" Title=".NET WebAssembly Build Tools" + Description="Build tools for WebAssembly ahead-of-time (AoT) compilation and native linking."/> + <_ComponentResources Include="microsoft-net-runtime-android" Title=".NET Android Build Tools" + Description="Build tools for Android compilation and native linking."/> + <_ComponentResources Include="microsoft-net-runtime-android-aot" Title=".NET Android Build Tools (AoT)" + Description="Build tools for Android ahead-of-time (AoT) compilation and native linking."/> + <_ComponentResources Include="microsoft-net-runtime-ios" Title=".NET iOS Build Tools" + Description="Build tools for iOS compilation and native linking."/> + <_ComponentResources Include="microsoft-net-runtime-tvos" Title=".NET tvOS Build Tools" + Description="Build tools for tvOS compilation and native linking."/> + <_ComponentResources Include="microsoft-net-runtime-maccatalyst" Title=".NET Mac Catalyst Build Tools" + Description="Build tools for Mac Catalyst compilation and native linking."/> + <_ComponentResources Include="runtimes-ios" Title=".NET iOS Runtimes" + Description=".NET runtime components for iOS execution."/> + <_ComponentResources Include="runtimes-tvos" Title=".NET tvOS Build Tools" + Description=".NET runtime components for tvOS execution."/> + <_ComponentResources Include="runtimes-maccatalyst" Title=".NET Mac Catalyst Build Tools" + Description=".NET runtime components for Mac Catalyst execution."/> + <_ComponentResources Include="runtimes-windows" Title=".NET Windows Runtimes" + Description=".NET runtime components for Windows execution."/> + + @@ -91,61 +94,73 @@ - + + - - - - - - - - - + - + - - - + + + + + + - - - + + - + - + - + + + + + + + + + + + + + + + + + + + + - - + @@ -172,39 +187,32 @@ - - - - - - - - - + - - - - - - - + - $(GitCommitCount.PadLeft(6,'0')) + 5 + + 1996-04-01 + - - $(_PatchNumber) - - $(GitCommitCount) + + + + - - $(FileVersion) - - $(VersionPrefix).$(CombinedBuildNumberAndRevision) - + + +